shop-definitions.ts 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509
  1. import { graphql } from './graphql-shop';
  2. export const testOrderFragment = graphql(`
  3. fragment TestOrderFragment on Order {
  4. id
  5. code
  6. state
  7. active
  8. subTotal
  9. subTotalWithTax
  10. shipping
  11. shippingWithTax
  12. total
  13. totalWithTax
  14. currencyCode
  15. couponCodes
  16. discounts {
  17. adjustmentSource
  18. amount
  19. amountWithTax
  20. description
  21. type
  22. }
  23. lines {
  24. id
  25. quantity
  26. linePrice
  27. linePriceWithTax
  28. unitPrice
  29. unitPriceWithTax
  30. unitPriceChangeSinceAdded
  31. unitPriceWithTaxChangeSinceAdded
  32. discountedUnitPriceWithTax
  33. proratedUnitPriceWithTax
  34. productVariant {
  35. id
  36. }
  37. discounts {
  38. adjustmentSource
  39. amount
  40. amountWithTax
  41. description
  42. type
  43. }
  44. }
  45. shippingLines {
  46. priceWithTax
  47. shippingMethod {
  48. id
  49. code
  50. description
  51. }
  52. }
  53. customer {
  54. id
  55. user {
  56. id
  57. identifier
  58. }
  59. }
  60. history {
  61. items {
  62. id
  63. type
  64. data
  65. }
  66. }
  67. }
  68. `);
  69. export const updatedOrderFragment = graphql(`
  70. fragment UpdatedOrder on Order {
  71. id
  72. code
  73. state
  74. active
  75. total
  76. totalWithTax
  77. currencyCode
  78. shipping
  79. shippingWithTax
  80. customer {
  81. id
  82. }
  83. shippingAddress {
  84. fullName
  85. company
  86. streetLine1
  87. streetLine2
  88. city
  89. province
  90. postalCode
  91. country
  92. phoneNumber
  93. }
  94. billingAddress {
  95. fullName
  96. company
  97. streetLine1
  98. streetLine2
  99. city
  100. province
  101. postalCode
  102. country
  103. phoneNumber
  104. }
  105. shippingLines {
  106. priceWithTax
  107. shippingMethod {
  108. id
  109. code
  110. description
  111. }
  112. }
  113. payments {
  114. id
  115. transactionId
  116. method
  117. amount
  118. state
  119. metadata
  120. }
  121. lines {
  122. id
  123. quantity
  124. productVariant {
  125. id
  126. }
  127. unitPrice
  128. unitPriceWithTax
  129. linePrice
  130. linePriceWithTax
  131. featuredAsset {
  132. id
  133. }
  134. discounts {
  135. adjustmentSource
  136. amount
  137. amountWithTax
  138. description
  139. type
  140. }
  141. }
  142. discounts {
  143. adjustmentSource
  144. amount
  145. amountWithTax
  146. description
  147. type
  148. }
  149. }
  150. `);
  151. export const updatedOrderWithCustomFieldsFragment = graphql(`
  152. fragment UpdatedOrderWithCustomFields on Order {
  153. id
  154. code
  155. state
  156. active
  157. total
  158. totalWithTax
  159. currencyCode
  160. shipping
  161. shippingWithTax
  162. customer {
  163. id
  164. }
  165. shippingAddress {
  166. fullName
  167. company
  168. streetLine1
  169. streetLine2
  170. city
  171. province
  172. postalCode
  173. country
  174. phoneNumber
  175. }
  176. billingAddress {
  177. fullName
  178. company
  179. streetLine1
  180. streetLine2
  181. city
  182. province
  183. postalCode
  184. country
  185. phoneNumber
  186. }
  187. shippingLines {
  188. priceWithTax
  189. shippingMethod {
  190. id
  191. code
  192. description
  193. }
  194. }
  195. payments {
  196. id
  197. transactionId
  198. method
  199. amount
  200. state
  201. metadata
  202. }
  203. lines {
  204. id
  205. quantity
  206. productVariant {
  207. id
  208. }
  209. unitPrice
  210. unitPriceWithTax
  211. linePrice
  212. linePriceWithTax
  213. featuredAsset {
  214. id
  215. }
  216. # Ignore error - customFields are dynamically generated at runtime, not in introspection schema
  217. customFields {
  218. notes
  219. lineImage {
  220. id
  221. }
  222. lineImages {
  223. id
  224. }
  225. }
  226. discounts {
  227. adjustmentSource
  228. amount
  229. amountWithTax
  230. description
  231. type
  232. }
  233. }
  234. discounts {
  235. adjustmentSource
  236. amount
  237. amountWithTax
  238. description
  239. type
  240. }
  241. }
  242. `);
  243. export const addItemToOrderDocument = graphql(
  244. `
  245. mutation AddItemToOrder($productVariantId: ID!, $quantity: Int!) {
  246. addItemToOrder(productVariantId: $productVariantId, quantity: $quantity) {
  247. ...UpdatedOrder
  248. ... on ErrorResult {
  249. errorCode
  250. message
  251. }
  252. ... on InsufficientStockError {
  253. quantityAvailable
  254. order {
  255. ...UpdatedOrder
  256. }
  257. }
  258. ... on OrderInterceptorError {
  259. interceptorError
  260. }
  261. }
  262. }
  263. `,
  264. [updatedOrderFragment],
  265. );
  266. export const addMultipleItemsToOrderDocument = graphql(
  267. `
  268. mutation AddItemsToOrder($inputs: [AddItemInput!]!) {
  269. addItemsToOrder(inputs: $inputs) {
  270. order {
  271. ...UpdatedOrder
  272. }
  273. errorResults {
  274. ... on ErrorResult {
  275. errorCode
  276. message
  277. }
  278. }
  279. }
  280. }
  281. `,
  282. [updatedOrderFragment],
  283. );
  284. export const searchProductsShopDocument = graphql(`
  285. query SearchProductsShop($input: SearchInput!) {
  286. search(input: $input) {
  287. totalItems
  288. items {
  289. productId
  290. productName
  291. productVariantId
  292. productVariantName
  293. sku
  294. collectionIds
  295. price {
  296. ... on SinglePrice {
  297. value
  298. }
  299. ... on PriceRange {
  300. min
  301. max
  302. }
  303. }
  304. }
  305. }
  306. }
  307. `);
  308. export const registerAccountDocument = graphql(`
  309. mutation Register($input: RegisterCustomerInput!) {
  310. registerCustomerAccount(input: $input) {
  311. ... on Success {
  312. success
  313. }
  314. ... on ErrorResult {
  315. errorCode
  316. message
  317. }
  318. ... on PasswordValidationError {
  319. validationErrorMessage
  320. }
  321. }
  322. }
  323. `);
  324. export const currentUserFragment = graphql(`
  325. fragment CurrentUserShop on CurrentUser {
  326. id
  327. identifier
  328. channels {
  329. code
  330. token
  331. permissions
  332. }
  333. }
  334. `);
  335. export const verifyEmailDocument = graphql(
  336. `
  337. mutation Verify($password: String, $token: String!) {
  338. verifyCustomerAccount(password: $password, token: $token) {
  339. ...CurrentUserShop
  340. ... on ErrorResult {
  341. errorCode
  342. message
  343. }
  344. ... on PasswordValidationError {
  345. validationErrorMessage
  346. }
  347. }
  348. }
  349. `,
  350. [currentUserFragment],
  351. );
  352. export const refreshTokenDocument = graphql(`
  353. mutation RefreshToken($emailAddress: String!) {
  354. refreshCustomerVerification(emailAddress: $emailAddress) {
  355. ... on Success {
  356. success
  357. }
  358. ... on ErrorResult {
  359. errorCode
  360. message
  361. }
  362. }
  363. }
  364. `);
  365. export const requestPasswordResetDocument = graphql(`
  366. mutation RequestPasswordReset($identifier: String!) {
  367. requestPasswordReset(emailAddress: $identifier) {
  368. ... on Success {
  369. success
  370. }
  371. ... on ErrorResult {
  372. errorCode
  373. message
  374. }
  375. }
  376. }
  377. `);
  378. export const resetPasswordDocument = graphql(
  379. `
  380. mutation ResetPassword($token: String!, $password: String!) {
  381. resetPassword(token: $token, password: $password) {
  382. ...CurrentUserShop
  383. ... on ErrorResult {
  384. errorCode
  385. message
  386. }
  387. ... on PasswordValidationError {
  388. validationErrorMessage
  389. }
  390. }
  391. }
  392. `,
  393. [currentUserFragment],
  394. );
  395. export const requestUpdateEmailAddressDocument = graphql(`
  396. mutation RequestUpdateEmailAddress($password: String!, $newEmailAddress: String!) {
  397. requestUpdateCustomerEmailAddress(password: $password, newEmailAddress: $newEmailAddress) {
  398. ... on Success {
  399. success
  400. }
  401. ... on ErrorResult {
  402. errorCode
  403. message
  404. }
  405. }
  406. }
  407. `);
  408. export const updateEmailAddressDocument = graphql(`
  409. mutation UpdateEmailAddress($token: String!) {
  410. updateCustomerEmailAddress(token: $token) {
  411. ... on Success {
  412. success
  413. }
  414. ... on ErrorResult {
  415. errorCode
  416. message
  417. }
  418. }
  419. }
  420. `);
  421. export const getActiveCustomerDocument = graphql(`
  422. query GetActiveCustomer {
  423. activeCustomer {
  424. id
  425. emailAddress
  426. }
  427. }
  428. `);
  429. export const createAddressDocument = graphql(`
  430. mutation CreateAddressShop($input: CreateAddressInput!) {
  431. createCustomerAddress(input: $input) {
  432. id
  433. streetLine1
  434. country {
  435. code
  436. }
  437. }
  438. }
  439. `);
  440. export const updateAddressDocument = graphql(`
  441. mutation UpdateAddressShop($input: UpdateAddressInput!) {
  442. updateCustomerAddress(input: $input) {
  443. streetLine1
  444. country {
  445. code
  446. }
  447. }
  448. }
  449. `);
  450. export const deleteAddressDocument = graphql(`
  451. mutation DeleteAddressShop($id: ID!) {
  452. deleteCustomerAddress(id: $id) {
  453. success
  454. }
  455. }
  456. `);
  457. export const updateCustomerDocument = graphql(`
  458. mutation UpdateCustomer($input: UpdateCustomerInput!) {
  459. updateCustomer(input: $input) {
  460. id
  461. firstName
  462. lastName
  463. }
  464. }
  465. `);
  466. export const updatePasswordDocument = graphql(`
  467. mutation UpdatePassword($old: String!, $new: String!) {
  468. updateCustomerPassword(currentPassword: $old, newPassword: $new) {
  469. ... on Success {
  470. success
  471. }
  472. ... on ErrorResult {
  473. errorCode
  474. message
  475. }
  476. }
  477. }
  478. `);
  479. export const getActiveOrderDocument = graphql(
  480. `
  481. query GetActiveOrder {
  482. activeOrder {
  483. ...TestOrderFragment
  484. }
  485. }
  486. `,
  487. [testOrderFragment],
  488. );
  489. export const getActiveOrderWithPriceDataDocument = graphql(`
  490. query GetActiveOrderWithPriceData {
  491. activeOrder {
  492. id
  493. subTotal
  494. subTotalWithTax
  495. total
  496. totalWithTax
  497. total
  498. lines {
  499. id
  500. unitPrice
  501. unitPriceWithTax
  502. taxRate
  503. linePrice
  504. lineTax
  505. linePriceWithTax
  506. taxLines {
  507. taxRate
  508. description
  509. }
  510. }
  511. taxSummary {
  512. description
  513. taxRate
  514. taxBase
  515. taxTotal
  516. }
  517. }
  518. }
  519. `);
  520. export const adjustItemQuantityDocument = graphql(
  521. `
  522. mutation AdjustItemQuantity($orderLineId: ID!, $quantity: Int!) {
  523. adjustOrderLine(orderLineId: $orderLineId, quantity: $quantity) {
  524. ...TestOrderFragment
  525. ... on ErrorResult {
  526. errorCode
  527. message
  528. }
  529. ... on OrderInterceptorError {
  530. interceptorError
  531. }
  532. }
  533. }
  534. `,
  535. [testOrderFragment],
  536. );
  537. export const removeItemFromOrderDocument = graphql(
  538. `
  539. mutation RemoveItemFromOrder($orderLineId: ID!) {
  540. removeOrderLine(orderLineId: $orderLineId) {
  541. ...TestOrderFragment
  542. ... on ErrorResult {
  543. errorCode
  544. message
  545. }
  546. ... on OrderInterceptorError {
  547. interceptorError
  548. }
  549. }
  550. }
  551. `,
  552. [testOrderFragment],
  553. );
  554. export const getEligibleShippingMethodsDocument = graphql(`
  555. query GetShippingMethods {
  556. eligibleShippingMethods {
  557. id
  558. code
  559. price
  560. name
  561. description
  562. }
  563. }
  564. `);
  565. export const setShippingMethodDocument = graphql(
  566. `
  567. mutation SetShippingMethod($id: [ID!]!) {
  568. setOrderShippingMethod(shippingMethodId: $id) {
  569. ...TestOrderFragment
  570. ... on ErrorResult {
  571. errorCode
  572. message
  573. }
  574. }
  575. }
  576. `,
  577. [testOrderFragment],
  578. );
  579. export const activeOrderCustomerDocument = graphql(`
  580. fragment ActiveOrderCustomer on Order {
  581. id
  582. customer {
  583. id
  584. emailAddress
  585. firstName
  586. lastName
  587. }
  588. lines {
  589. id
  590. }
  591. }
  592. `);
  593. export const setCustomerDocument = graphql(
  594. `
  595. mutation SetCustomerForOrder($input: CreateCustomerInput!) {
  596. setCustomerForOrder(input: $input) {
  597. ...ActiveOrderCustomer
  598. ... on ErrorResult {
  599. errorCode
  600. message
  601. }
  602. ... on GuestCheckoutError {
  603. errorDetail
  604. }
  605. }
  606. }
  607. `,
  608. [activeOrderCustomerDocument],
  609. );
  610. export const getOrderByCodeDocument = graphql(
  611. `
  612. query GetOrderByCode($code: String!) {
  613. orderByCode(code: $code) {
  614. ...TestOrderFragment
  615. }
  616. }
  617. `,
  618. [testOrderFragment],
  619. );
  620. export const getOrderShopDocument = graphql(
  621. `
  622. query GetOrderShop($id: ID!) {
  623. order(id: $id) {
  624. ...TestOrderFragment
  625. }
  626. }
  627. `,
  628. [testOrderFragment],
  629. );
  630. export const getOrderPromotionsByCodeDocument = graphql(
  631. `
  632. query GetOrderPromotionsByCode($code: String!) {
  633. orderByCode(code: $code) {
  634. ...TestOrderFragment
  635. promotions {
  636. id
  637. name
  638. }
  639. }
  640. }
  641. `,
  642. [testOrderFragment],
  643. );
  644. export const getAvailableCountriesDocument = graphql(`
  645. query GetAvailableCountries {
  646. availableCountries {
  647. id
  648. code
  649. }
  650. }
  651. `);
  652. export const transitionToStateDocument = graphql(
  653. `
  654. mutation TransitionToState($state: String!) {
  655. transitionOrderToState(state: $state) {
  656. ...TestOrderFragment
  657. ... on OrderStateTransitionError {
  658. errorCode
  659. message
  660. transitionError
  661. fromState
  662. toState
  663. }
  664. }
  665. }
  666. `,
  667. [testOrderFragment],
  668. );
  669. export const orderWithAddressesFragmentDocument = graphql(`
  670. fragment OrderWithAddresses on Order {
  671. lines {
  672. id
  673. }
  674. shippingAddress {
  675. fullName
  676. company
  677. streetLine1
  678. streetLine2
  679. city
  680. province
  681. postalCode
  682. country
  683. phoneNumber
  684. }
  685. billingAddress {
  686. fullName
  687. company
  688. streetLine1
  689. streetLine2
  690. city
  691. province
  692. postalCode
  693. country
  694. phoneNumber
  695. }
  696. }
  697. `);
  698. export const setShippingAddressDocument = graphql(
  699. `
  700. mutation SetShippingAddress($input: CreateAddressInput!) {
  701. setOrderShippingAddress(input: $input) {
  702. ...OrderWithAddresses
  703. ... on ErrorResult {
  704. errorCode
  705. message
  706. }
  707. }
  708. }
  709. `,
  710. [orderWithAddressesFragmentDocument],
  711. );
  712. export const setBillingAddressDocument = graphql(
  713. `
  714. mutation SetBillingAddress($input: CreateAddressInput!) {
  715. setOrderBillingAddress(input: $input) {
  716. ...OrderWithAddresses
  717. ... on ErrorResult {
  718. errorCode
  719. message
  720. }
  721. }
  722. }
  723. `,
  724. [orderWithAddressesFragmentDocument],
  725. );
  726. export const unsetShippingAddressDocument = graphql(
  727. `
  728. mutation UnsetShippingAddress {
  729. unsetOrderShippingAddress {
  730. ...OrderWithAddresses
  731. ... on ErrorResult {
  732. errorCode
  733. message
  734. }
  735. }
  736. }
  737. `,
  738. [orderWithAddressesFragmentDocument],
  739. );
  740. export const unsetBillingAddressDocument = graphql(
  741. `
  742. mutation UnsetBillingAddress {
  743. unsetOrderBillingAddress {
  744. ...OrderWithAddresses
  745. ... on ErrorResult {
  746. errorCode
  747. message
  748. }
  749. }
  750. }
  751. `,
  752. [orderWithAddressesFragmentDocument],
  753. );
  754. export const testOrderWithPaymentsFragment = graphql(
  755. `
  756. fragment TestOrderWithPayments on Order {
  757. ...TestOrderFragment
  758. payments {
  759. id
  760. transactionId
  761. method
  762. amount
  763. state
  764. metadata
  765. }
  766. }
  767. `,
  768. [testOrderFragment],
  769. );
  770. export const getActiveOrderWithPaymentsDocument = graphql(
  771. `
  772. query GetActiveOrderWithPayments {
  773. activeOrder {
  774. ...TestOrderWithPayments
  775. }
  776. }
  777. `,
  778. [testOrderWithPaymentsFragment],
  779. );
  780. export const addPaymentDocument = graphql(
  781. `
  782. mutation AddPaymentToOrder($input: PaymentInput!) {
  783. addPaymentToOrder(input: $input) {
  784. ...TestOrderWithPayments
  785. ... on ErrorResult {
  786. errorCode
  787. message
  788. }
  789. ... on PaymentDeclinedError {
  790. paymentErrorMessage
  791. }
  792. ... on PaymentFailedError {
  793. paymentErrorMessage
  794. }
  795. ... on OrderStateTransitionError {
  796. transitionError
  797. }
  798. ... on IneligiblePaymentMethodError {
  799. eligibilityCheckerMessage
  800. }
  801. }
  802. }
  803. `,
  804. [testOrderWithPaymentsFragment],
  805. );
  806. export const getActiveOrderPaymentsDocument = graphql(`
  807. query GetActiveOrderPayments {
  808. activeOrder {
  809. id
  810. payments {
  811. id
  812. transactionId
  813. method
  814. amount
  815. state
  816. errorMessage
  817. metadata
  818. }
  819. }
  820. }
  821. `);
  822. export const getOrderByCodeWithPaymentsDocument = graphql(
  823. `
  824. query GetOrderByCodeWithPayments($code: String!) {
  825. orderByCode(code: $code) {
  826. ...TestOrderWithPayments
  827. }
  828. }
  829. `,
  830. [testOrderWithPaymentsFragment],
  831. );
  832. export const getActiveOrderCustomerWithItemFulfillmentsDocument = graphql(`
  833. query GetActiveCustomerOrderWithItemFulfillments {
  834. activeCustomer {
  835. orders(
  836. options: { skip: 0, take: 5, sort: { createdAt: DESC }, filter: { active: { eq: false } } }
  837. ) {
  838. totalItems
  839. items {
  840. id
  841. code
  842. state
  843. lines {
  844. id
  845. }
  846. fulfillments {
  847. id
  848. state
  849. method
  850. trackingCode
  851. }
  852. }
  853. }
  854. }
  855. }
  856. `);
  857. export const getNextStatesDocument = graphql(`
  858. query GetNextOrderStates {
  859. nextOrderStates
  860. }
  861. `);
  862. export const getActiveOrderAddressesDocument = graphql(`
  863. query GetCustomerAddresses {
  864. activeOrder {
  865. customer {
  866. addresses {
  867. id
  868. streetLine1
  869. }
  870. }
  871. }
  872. }
  873. `);
  874. export const getActiveOrderShippingBillingDocument = graphql(`
  875. query GetActiveOrderShippingBilling {
  876. activeOrder {
  877. shippingAddress {
  878. ...OrderAddress
  879. }
  880. billingAddress {
  881. ...OrderAddress
  882. }
  883. }
  884. }
  885. fragment OrderAddress on OrderAddress {
  886. fullName
  887. company
  888. streetLine1
  889. streetLine2
  890. city
  891. province
  892. postalCode
  893. countryCode
  894. phoneNumber
  895. }
  896. `);
  897. export const getActiveOrderOrdersDocument = graphql(`
  898. query GetCustomerOrders {
  899. activeOrder {
  900. customer {
  901. orders {
  902. items {
  903. id
  904. }
  905. }
  906. }
  907. }
  908. }
  909. `);
  910. export const getActiveCustomerOrdersDocument = graphql(`
  911. query GetActiveCustomerOrders {
  912. activeCustomer {
  913. id
  914. orders {
  915. totalItems
  916. items {
  917. id
  918. state
  919. }
  920. }
  921. }
  922. }
  923. `);
  924. export const applyCouponCodeDocument = graphql(
  925. `
  926. mutation ApplyCouponCode($couponCode: String!) {
  927. applyCouponCode(couponCode: $couponCode) {
  928. ...TestOrderFragment
  929. ... on ErrorResult {
  930. errorCode
  931. message
  932. }
  933. }
  934. }
  935. `,
  936. [testOrderFragment],
  937. );
  938. export const removeCouponCodeDocument = graphql(
  939. `
  940. mutation RemoveCouponCode($couponCode: String!) {
  941. removeCouponCode(couponCode: $couponCode) {
  942. ...TestOrderFragment
  943. }
  944. }
  945. `,
  946. [testOrderFragment],
  947. );
  948. export const removeAllOrderLinesDocument = graphql(
  949. `
  950. mutation RemoveAllOrderLines {
  951. removeAllOrderLines {
  952. ...TestOrderFragment
  953. ... on ErrorResult {
  954. errorCode
  955. message
  956. }
  957. }
  958. }
  959. `,
  960. [testOrderFragment],
  961. );
  962. export const getEligiblePaymentMethodsDocument = graphql(`
  963. query GetEligiblePaymentMethods {
  964. eligiblePaymentMethods {
  965. id
  966. code
  967. eligibilityMessage
  968. isEligible
  969. }
  970. }
  971. `);
  972. export const getProductWithStockLevelDocument = graphql(`
  973. query GetProductStockLevel($id: ID!) {
  974. product(id: $id) {
  975. id
  976. variants {
  977. id
  978. stockLevel
  979. }
  980. }
  981. }
  982. `);
  983. export const getActiveCustomerWithOrdersProductSlugDocument = graphql(`
  984. query GetActiveCustomerWithOrdersProductSlug($options: OrderListOptions) {
  985. activeCustomer {
  986. orders(options: $options) {
  987. items {
  988. lines {
  989. productVariant {
  990. product {
  991. slug
  992. }
  993. }
  994. }
  995. }
  996. }
  997. }
  998. }
  999. `);
  1000. export const getActiveCustomerWithOrdersProductPriceDocument = graphql(`
  1001. query GetActiveCustomerWithOrdersProductPrice($options: OrderListOptions) {
  1002. activeCustomer {
  1003. orders(options: $options) {
  1004. items {
  1005. lines {
  1006. linePrice
  1007. productVariant {
  1008. id
  1009. name
  1010. price
  1011. }
  1012. }
  1013. }
  1014. }
  1015. }
  1016. }
  1017. `);
  1018. export const activePaymentMethodsQueryDocument = graphql(`
  1019. query ActivePaymentMethods {
  1020. activePaymentMethods {
  1021. id
  1022. code
  1023. name
  1024. description
  1025. translations {
  1026. languageCode
  1027. name
  1028. description
  1029. }
  1030. }
  1031. }
  1032. `);
  1033. export const getActiveShippingMethodsDocument = graphql(`
  1034. query GetActiveShippingMethods {
  1035. activeShippingMethods {
  1036. id
  1037. code
  1038. name
  1039. description
  1040. translations {
  1041. languageCode
  1042. name
  1043. description
  1044. }
  1045. }
  1046. }
  1047. `);
  1048. export const getCollectionShopDocument = graphql(`
  1049. query GetCollectionShop($id: ID, $slug: String) {
  1050. collection(id: $id, slug: $slug) {
  1051. id
  1052. name
  1053. slug
  1054. description
  1055. parent {
  1056. id
  1057. name
  1058. }
  1059. children {
  1060. id
  1061. name
  1062. }
  1063. }
  1064. }
  1065. `);
  1066. export const getCollectionVariantsDocument = graphql(`
  1067. query GetCollectionVariants($id: ID, $slug: String) {
  1068. collection(id: $id, slug: $slug) {
  1069. id
  1070. productVariants {
  1071. items {
  1072. id
  1073. name
  1074. }
  1075. }
  1076. }
  1077. }
  1078. `);
  1079. export const getCollectionListDocument = graphql(`
  1080. query GetCollectionList {
  1081. collections {
  1082. items {
  1083. id
  1084. name
  1085. }
  1086. }
  1087. }
  1088. `);
  1089. export const getProductFacetValuesDocument = graphql(`
  1090. query GetProductFacetValues($id: ID!) {
  1091. product(id: $id) {
  1092. id
  1093. name
  1094. facetValues {
  1095. name
  1096. }
  1097. }
  1098. }
  1099. `);
  1100. export const getProductVariantFacetValuesDocument = graphql(`
  1101. query GetVariantFacetValues($id: ID!) {
  1102. product(id: $id) {
  1103. id
  1104. name
  1105. variants {
  1106. id
  1107. facetValues {
  1108. name
  1109. }
  1110. }
  1111. }
  1112. }
  1113. `);
  1114. export const getProductsTake3Document = graphql(`
  1115. query GetProductsTake3 {
  1116. products(options: { take: 3 }) {
  1117. items {
  1118. id
  1119. }
  1120. }
  1121. }
  1122. `);
  1123. export const getProduct1Document = graphql(`
  1124. query GetProduct1 {
  1125. product(id: "T_1") {
  1126. id
  1127. }
  1128. }
  1129. `);
  1130. export const getProduct2VariantsDocument = graphql(`
  1131. query GetProduct2Variants {
  1132. product(id: "T_2") {
  1133. id
  1134. variants {
  1135. id
  1136. name
  1137. }
  1138. }
  1139. }
  1140. `);
  1141. export const getProductCollectionDocument = graphql(`
  1142. query GetProductCollection {
  1143. product(id: "T_12") {
  1144. collections {
  1145. id
  1146. name
  1147. }
  1148. }
  1149. }
  1150. `);
  1151. export const getOrderCustomFieldsDocument = graphql(`
  1152. query GetOrderCustomFields {
  1153. activeOrder {
  1154. id
  1155. customFields {
  1156. giftWrap
  1157. orderImage {
  1158. id
  1159. }
  1160. }
  1161. }
  1162. }
  1163. `);
  1164. export const setOrderCustomFieldsDocument = graphql(`
  1165. mutation SetOrderCustomFields($input: UpdateOrderInput!) {
  1166. setOrderCustomFields(input: $input) {
  1167. ... on Order {
  1168. id
  1169. customFields {
  1170. giftWrap
  1171. orderImage {
  1172. id
  1173. }
  1174. }
  1175. }
  1176. ... on ErrorResult {
  1177. errorCode
  1178. message
  1179. }
  1180. }
  1181. }
  1182. `);
  1183. export const logOutDocument = graphql(`
  1184. mutation LogOut {
  1185. logout {
  1186. success
  1187. }
  1188. }
  1189. `);
  1190. export const addItemToOrderWithCustomFieldsDocument = graphql(
  1191. `
  1192. mutation AddItemToOrderWithCustomFields(
  1193. $productVariantId: ID!
  1194. $quantity: Int!
  1195. $customFields: OrderLineCustomFieldsInput
  1196. ) {
  1197. addItemToOrder(
  1198. productVariantId: $productVariantId
  1199. quantity: $quantity
  1200. customFields: $customFields
  1201. ) {
  1202. ...UpdatedOrderWithCustomFields
  1203. ... on ErrorResult {
  1204. errorCode
  1205. message
  1206. }
  1207. }
  1208. }
  1209. `,
  1210. [updatedOrderWithCustomFieldsFragment],
  1211. );
  1212. export const addMultipleItemsToOrderWithCustomFieldsDocument = graphql(
  1213. `
  1214. mutation AddMultipleItemsToOrderWithCustomFields($inputs: [AddItemInput!]!) {
  1215. addItemsToOrder(inputs: $inputs) {
  1216. order {
  1217. ...UpdatedOrder
  1218. lines {
  1219. id
  1220. quantity
  1221. productVariant {
  1222. id
  1223. }
  1224. customFields {
  1225. notes
  1226. }
  1227. }
  1228. }
  1229. errorResults {
  1230. ... on ErrorResult {
  1231. errorCode
  1232. message
  1233. }
  1234. }
  1235. }
  1236. }
  1237. `,
  1238. [updatedOrderFragment],
  1239. );
  1240. export const adjustOrderLineWithCustomFieldsDocument = graphql(`
  1241. mutation AdjustOrderLineWithCustomFields(
  1242. $orderLineId: ID!
  1243. $quantity: Int!
  1244. $customFields: OrderLineCustomFieldsInput
  1245. ) {
  1246. adjustOrderLine(orderLineId: $orderLineId, quantity: $quantity, customFields: $customFields) {
  1247. ... on Order {
  1248. lines {
  1249. id
  1250. customFields {
  1251. notes
  1252. lineImage {
  1253. id
  1254. }
  1255. lineImages {
  1256. id
  1257. }
  1258. }
  1259. }
  1260. }
  1261. }
  1262. }
  1263. `);
  1264. export const getOrderWithOrderLineCustomFieldsDocument = graphql(`
  1265. query GetOrderWithOrderLineCustomFields {
  1266. activeOrder {
  1267. lines {
  1268. id
  1269. customFields {
  1270. notes
  1271. lineImage {
  1272. id
  1273. }
  1274. lineImages {
  1275. id
  1276. }
  1277. }
  1278. }
  1279. }
  1280. }
  1281. `);
  1282. export const localUpdatedOrderFragment = graphql(`
  1283. fragment UpdatedOrderMinimal on Order {
  1284. id
  1285. code
  1286. state
  1287. active
  1288. total
  1289. totalWithTax
  1290. currencyCode
  1291. lines {
  1292. id
  1293. linePrice
  1294. linePriceWithTax
  1295. }
  1296. }
  1297. `);
  1298. export const localAddItemToOrderDocument = graphql(
  1299. `
  1300. mutation AddItemToOrderMinimal($productVariantId: ID!, $quantity: Int!) {
  1301. addItemToOrder(productVariantId: $productVariantId, quantity: $quantity) {
  1302. ...UpdatedOrderMinimal
  1303. ... on ErrorResult {
  1304. errorCode
  1305. message
  1306. }
  1307. ... on InsufficientStockError {
  1308. quantityAvailable
  1309. order {
  1310. ...UpdatedOrderMinimal
  1311. }
  1312. }
  1313. }
  1314. }
  1315. `,
  1316. [localUpdatedOrderFragment],
  1317. );
  1318. export const searchFacetValuesDocument = graphql(`
  1319. query SearchFacetValues($input: SearchInput!) {
  1320. search(input: $input) {
  1321. totalItems
  1322. facetValues {
  1323. count
  1324. facetValue {
  1325. id
  1326. name
  1327. }
  1328. }
  1329. }
  1330. }
  1331. `);
  1332. export const searchCollectionsDocument = graphql(`
  1333. query SearchCollections($input: SearchInput!) {
  1334. search(input: $input) {
  1335. totalItems
  1336. collections {
  1337. count
  1338. collection {
  1339. id
  1340. name
  1341. }
  1342. }
  1343. }
  1344. }
  1345. `);
  1346. export const searchGetPricesShopDocument = graphql(`
  1347. query SearchGetPrices($input: SearchInput!) {
  1348. search(input: $input) {
  1349. items {
  1350. price {
  1351. ... on PriceRange {
  1352. min
  1353. max
  1354. }
  1355. ... on SinglePrice {
  1356. value
  1357. }
  1358. }
  1359. priceWithTax {
  1360. ... on PriceRange {
  1361. min
  1362. max
  1363. }
  1364. ... on SinglePrice {
  1365. value
  1366. }
  1367. }
  1368. }
  1369. }
  1370. }
  1371. `);
  1372. export const orderWithLinesAndItemsFragment = graphql(`
  1373. fragment OrderWithLinesAndItems on Order {
  1374. id
  1375. subTotal
  1376. subTotalWithTax
  1377. shipping
  1378. total
  1379. totalWithTax
  1380. lines {
  1381. id
  1382. quantity
  1383. unitPrice
  1384. unitPriceWithTax
  1385. }
  1386. }
  1387. `);
  1388. export const addItemToOrderCustomFieldsDocument = graphql(
  1389. `
  1390. mutation AddItemToOrderCustomFields(
  1391. $productVariantId: ID!
  1392. $quantity: Int!
  1393. $customFields: OrderLineCustomFieldsInput
  1394. ) {
  1395. addItemToOrder(
  1396. productVariantId: $productVariantId
  1397. quantity: $quantity
  1398. customFields: $customFields
  1399. ) {
  1400. ...OrderWithLinesAndItems
  1401. }
  1402. }
  1403. `,
  1404. [orderWithLinesAndItemsFragment],
  1405. );
  1406. export const adjustOrderLineCustomFieldsDocument = graphql(
  1407. `
  1408. mutation AdjustOrderLineCustomFields(
  1409. $orderLineId: ID!
  1410. $quantity: Int!
  1411. $customFields: OrderLineCustomFieldsInput
  1412. ) {
  1413. adjustOrderLine(orderLineId: $orderLineId, quantity: $quantity, customFields: $customFields) {
  1414. ...OrderWithLinesAndItems
  1415. }
  1416. }
  1417. `,
  1418. [orderWithLinesAndItemsFragment],
  1419. );
  1420. export const registerSellerDocument = graphql(`
  1421. mutation RegisterSeller($input: RegisterSellerInput!) {
  1422. registerNewSeller(input: $input) {
  1423. id
  1424. code
  1425. token
  1426. }
  1427. }
  1428. `);