shared-definitions.ts 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074
  1. import gql from 'graphql-tag';
  2. import {
  3. ADMINISTRATOR_FRAGMENT,
  4. ASSET_FRAGMENT,
  5. CHANNEL_FRAGMENT,
  6. COLLECTION_FRAGMENT,
  7. COUNTRY_FRAGMENT,
  8. CURRENT_USER_FRAGMENT,
  9. CUSTOMER_FRAGMENT,
  10. CUSTOMER_GROUP_FRAGMENT,
  11. FACET_WITH_VALUES_FRAGMENT,
  12. FULFILLMENT_FRAGMENT,
  13. GLOBAL_SETTINGS_FRAGMENT,
  14. ORDER_FRAGMENT,
  15. ORDER_WITH_LINES_FRAGMENT,
  16. PAYMENT_FRAGMENT,
  17. PRODUCT_OPTION_GROUP_FRAGMENT,
  18. PRODUCT_VARIANT_FRAGMENT,
  19. PRODUCT_WITH_OPTIONS_FRAGMENT,
  20. PRODUCT_WITH_VARIANTS_FRAGMENT,
  21. PROMOTION_FRAGMENT,
  22. ROLE_FRAGMENT,
  23. SHIPPING_METHOD_FRAGMENT,
  24. TAX_RATE_FRAGMENT,
  25. VARIANT_WITH_STOCK_FRAGMENT,
  26. } from './fragments';
  27. export const CREATE_ADMINISTRATOR = gql`
  28. mutation CreateAdministrator($input: CreateAdministratorInput!) {
  29. createAdministrator(input: $input) {
  30. ...Administrator
  31. }
  32. }
  33. ${ADMINISTRATOR_FRAGMENT}
  34. `;
  35. export const UPDATE_PRODUCT = gql`
  36. mutation UpdateProduct($input: UpdateProductInput!) {
  37. updateProduct(input: $input) {
  38. ...ProductWithVariants
  39. }
  40. }
  41. ${PRODUCT_WITH_VARIANTS_FRAGMENT}
  42. `;
  43. export const CREATE_PRODUCT = gql`
  44. mutation CreateProduct($input: CreateProductInput!) {
  45. createProduct(input: $input) {
  46. ...ProductWithVariants
  47. }
  48. }
  49. ${PRODUCT_WITH_VARIANTS_FRAGMENT}
  50. `;
  51. export const GET_PRODUCT_WITH_VARIANTS = gql`
  52. query GetProductWithVariants($id: ID, $slug: String) {
  53. product(slug: $slug, id: $id) {
  54. ...ProductWithVariants
  55. }
  56. }
  57. ${PRODUCT_WITH_VARIANTS_FRAGMENT}
  58. `;
  59. export const GET_PRODUCT_LIST = gql`
  60. query GetProductList($options: ProductListOptions) {
  61. products(options: $options) {
  62. items {
  63. id
  64. languageCode
  65. name
  66. slug
  67. featuredAsset {
  68. id
  69. preview
  70. }
  71. }
  72. totalItems
  73. }
  74. }
  75. `;
  76. export const CREATE_PRODUCT_VARIANTS = gql`
  77. mutation CreateProductVariants($input: [CreateProductVariantInput!]!) {
  78. createProductVariants(input: $input) {
  79. ...ProductVariant
  80. }
  81. }
  82. ${PRODUCT_VARIANT_FRAGMENT}
  83. `;
  84. export const UPDATE_PRODUCT_VARIANTS = gql`
  85. mutation UpdateProductVariants($input: [UpdateProductVariantInput!]!) {
  86. updateProductVariants(input: $input) {
  87. ...ProductVariant
  88. }
  89. }
  90. ${PRODUCT_VARIANT_FRAGMENT}
  91. `;
  92. export const UPDATE_TAX_RATE = gql`
  93. mutation UpdateTaxRate($input: UpdateTaxRateInput!) {
  94. updateTaxRate(input: $input) {
  95. ...TaxRate
  96. }
  97. }
  98. ${TAX_RATE_FRAGMENT}
  99. `;
  100. export const CREATE_FACET = gql`
  101. mutation CreateFacet($input: CreateFacetInput!) {
  102. createFacet(input: $input) {
  103. ...FacetWithValues
  104. }
  105. }
  106. ${FACET_WITH_VALUES_FRAGMENT}
  107. `;
  108. export const UPDATE_FACET = gql`
  109. mutation UpdateFacet($input: UpdateFacetInput!) {
  110. updateFacet(input: $input) {
  111. ...FacetWithValues
  112. }
  113. }
  114. ${FACET_WITH_VALUES_FRAGMENT}
  115. `;
  116. export const GET_CUSTOMER_LIST = gql`
  117. query GetCustomerList($options: CustomerListOptions) {
  118. customers(options: $options) {
  119. items {
  120. id
  121. title
  122. firstName
  123. lastName
  124. emailAddress
  125. phoneNumber
  126. user {
  127. id
  128. identifier
  129. verified
  130. }
  131. }
  132. totalItems
  133. }
  134. }
  135. `;
  136. export const GET_ASSET_LIST = gql`
  137. query GetAssetList($options: AssetListOptions) {
  138. assets(options: $options) {
  139. items {
  140. ...Asset
  141. }
  142. totalItems
  143. }
  144. }
  145. ${ASSET_FRAGMENT}
  146. `;
  147. export const CREATE_ROLE = gql`
  148. mutation CreateRole($input: CreateRoleInput!) {
  149. createRole(input: $input) {
  150. ...Role
  151. }
  152. }
  153. ${ROLE_FRAGMENT}
  154. `;
  155. export const CREATE_COLLECTION = gql`
  156. mutation CreateCollection($input: CreateCollectionInput!) {
  157. createCollection(input: $input) {
  158. ...Collection
  159. }
  160. }
  161. ${COLLECTION_FRAGMENT}
  162. `;
  163. export const UPDATE_COLLECTION = gql`
  164. mutation UpdateCollection($input: UpdateCollectionInput!) {
  165. updateCollection(input: $input) {
  166. ...Collection
  167. }
  168. }
  169. ${COLLECTION_FRAGMENT}
  170. `;
  171. export const GET_CUSTOMER = gql`
  172. query GetCustomer($id: ID!, $orderListOptions: OrderListOptions) {
  173. customer(id: $id) {
  174. ...Customer
  175. orders(options: $orderListOptions) {
  176. items {
  177. id
  178. code
  179. state
  180. total
  181. currencyCode
  182. updatedAt
  183. }
  184. totalItems
  185. }
  186. }
  187. }
  188. ${CUSTOMER_FRAGMENT}
  189. `;
  190. export const ATTEMPT_LOGIN = gql`
  191. mutation AttemptLogin($username: String!, $password: String!, $rememberMe: Boolean) {
  192. login(username: $username, password: $password, rememberMe: $rememberMe) {
  193. ...CurrentUser
  194. ... on ErrorResult {
  195. errorCode
  196. message
  197. }
  198. }
  199. }
  200. ${CURRENT_USER_FRAGMENT}
  201. `;
  202. export const GET_COUNTRY_LIST = gql`
  203. query GetCountryList($options: CountryListOptions) {
  204. countries(options: $options) {
  205. items {
  206. id
  207. code
  208. name
  209. enabled
  210. }
  211. totalItems
  212. }
  213. }
  214. `;
  215. export const UPDATE_COUNTRY = gql`
  216. mutation UpdateCountry($input: UpdateCountryInput!) {
  217. updateCountry(input: $input) {
  218. ...Country
  219. }
  220. }
  221. ${COUNTRY_FRAGMENT}
  222. `;
  223. export const GET_FACET_LIST = gql`
  224. query GetFacetList($options: FacetListOptions) {
  225. facets(options: $options) {
  226. items {
  227. ...FacetWithValues
  228. }
  229. totalItems
  230. }
  231. }
  232. ${FACET_WITH_VALUES_FRAGMENT}
  233. `;
  234. export const GET_FACET_LIST_SIMPLE = gql`
  235. query GetFacetListSimple($options: FacetListOptions) {
  236. facets(options: $options) {
  237. items {
  238. id
  239. name
  240. }
  241. totalItems
  242. }
  243. }
  244. `;
  245. export const DELETE_PRODUCT = gql`
  246. mutation DeleteProduct($id: ID!) {
  247. deleteProduct(id: $id) {
  248. result
  249. }
  250. }
  251. `;
  252. export const GET_PRODUCT_SIMPLE = gql`
  253. query GetProductSimple($id: ID, $slug: String) {
  254. product(slug: $slug, id: $id) {
  255. id
  256. slug
  257. }
  258. }
  259. `;
  260. export const GET_STOCK_MOVEMENT = gql`
  261. query GetStockMovement($id: ID!) {
  262. product(id: $id) {
  263. id
  264. variants {
  265. ...VariantWithStock
  266. }
  267. }
  268. }
  269. ${VARIANT_WITH_STOCK_FRAGMENT}
  270. `;
  271. export const GET_RUNNING_JOBS = gql`
  272. query GetRunningJobs($options: JobListOptions) {
  273. jobs(options: $options) {
  274. items {
  275. id
  276. queueName
  277. state
  278. isSettled
  279. duration
  280. }
  281. totalItems
  282. }
  283. }
  284. `;
  285. export const CREATE_PROMOTION = gql`
  286. mutation CreatePromotion($input: CreatePromotionInput!) {
  287. createPromotion(input: $input) {
  288. ...Promotion
  289. ... on ErrorResult {
  290. errorCode
  291. message
  292. }
  293. }
  294. }
  295. ${PROMOTION_FRAGMENT}
  296. `;
  297. export const ME = gql`
  298. query Me {
  299. me {
  300. ...CurrentUser
  301. }
  302. }
  303. ${CURRENT_USER_FRAGMENT}
  304. `;
  305. export const CREATE_CHANNEL = gql`
  306. mutation CreateChannel($input: CreateChannelInput!) {
  307. createChannel(input: $input) {
  308. ...Channel
  309. ... on LanguageNotAvailableError {
  310. errorCode
  311. message
  312. languageCode
  313. }
  314. }
  315. }
  316. ${CHANNEL_FRAGMENT}
  317. `;
  318. export const DELETE_PRODUCT_VARIANT = gql`
  319. mutation DeleteProductVariant($id: ID!) {
  320. deleteProductVariant(id: $id) {
  321. result
  322. message
  323. }
  324. }
  325. `;
  326. export const ASSIGN_PRODUCT_TO_CHANNEL = gql`
  327. mutation AssignProductsToChannel($input: AssignProductsToChannelInput!) {
  328. assignProductsToChannel(input: $input) {
  329. ...ProductWithVariants
  330. }
  331. }
  332. ${PRODUCT_WITH_VARIANTS_FRAGMENT}
  333. `;
  334. export const REMOVE_PRODUCT_FROM_CHANNEL = gql`
  335. mutation RemoveProductsFromChannel($input: RemoveProductsFromChannelInput!) {
  336. removeProductsFromChannel(input: $input) {
  337. ...ProductWithVariants
  338. }
  339. }
  340. ${PRODUCT_WITH_VARIANTS_FRAGMENT}
  341. `;
  342. export const ASSIGN_PRODUCTVARIANT_TO_CHANNEL = gql`
  343. mutation AssignProductVariantsToChannel($input: AssignProductVariantsToChannelInput!) {
  344. assignProductVariantsToChannel(input: $input) {
  345. ...ProductVariant
  346. }
  347. }
  348. ${PRODUCT_VARIANT_FRAGMENT}
  349. `;
  350. export const REMOVE_PRODUCTVARIANT_FROM_CHANNEL = gql`
  351. mutation RemoveProductVariantsFromChannel($input: RemoveProductVariantsFromChannelInput!) {
  352. removeProductVariantsFromChannel(input: $input) {
  353. ...ProductVariant
  354. }
  355. }
  356. ${PRODUCT_VARIANT_FRAGMENT}
  357. `;
  358. export const UPDATE_ASSET = gql`
  359. mutation UpdateAsset($input: UpdateAssetInput!) {
  360. updateAsset(input: $input) {
  361. ...Asset
  362. ... on Asset {
  363. tags {
  364. id
  365. value
  366. }
  367. focalPoint {
  368. x
  369. y
  370. }
  371. }
  372. }
  373. }
  374. ${ASSET_FRAGMENT}
  375. `;
  376. export const DELETE_ASSET = gql`
  377. mutation DeleteAsset($input: DeleteAssetInput!) {
  378. deleteAsset(input: $input) {
  379. result
  380. message
  381. }
  382. }
  383. `;
  384. export const UPDATE_CHANNEL = gql`
  385. mutation UpdateChannel($input: UpdateChannelInput!) {
  386. updateChannel(input: $input) {
  387. ...Channel
  388. ... on LanguageNotAvailableError {
  389. errorCode
  390. message
  391. languageCode
  392. }
  393. }
  394. }
  395. ${CHANNEL_FRAGMENT}
  396. `;
  397. export const GET_CUSTOMER_HISTORY = gql`
  398. query GetCustomerHistory($id: ID!, $options: HistoryEntryListOptions) {
  399. customer(id: $id) {
  400. id
  401. history(options: $options) {
  402. totalItems
  403. items {
  404. id
  405. administrator {
  406. id
  407. }
  408. type
  409. data
  410. }
  411. }
  412. }
  413. }
  414. `;
  415. export const GET_ORDER = gql`
  416. query GetOrder($id: ID!) {
  417. order(id: $id) {
  418. ...OrderWithLines
  419. }
  420. }
  421. ${ORDER_WITH_LINES_FRAGMENT}
  422. `;
  423. export const CREATE_CUSTOMER_GROUP = gql`
  424. mutation CreateCustomerGroup($input: CreateCustomerGroupInput!) {
  425. createCustomerGroup(input: $input) {
  426. ...CustomerGroup
  427. }
  428. }
  429. ${CUSTOMER_GROUP_FRAGMENT}
  430. `;
  431. export const REMOVE_CUSTOMERS_FROM_GROUP = gql`
  432. mutation RemoveCustomersFromGroup($groupId: ID!, $customerIds: [ID!]!) {
  433. removeCustomersFromGroup(customerGroupId: $groupId, customerIds: $customerIds) {
  434. ...CustomerGroup
  435. }
  436. }
  437. ${CUSTOMER_GROUP_FRAGMENT}
  438. `;
  439. export const CREATE_FULFILLMENT = gql`
  440. mutation CreateFulfillment($input: FulfillOrderInput!) {
  441. addFulfillmentToOrder(input: $input) {
  442. ...Fulfillment
  443. ... on ErrorResult {
  444. errorCode
  445. message
  446. }
  447. ... on CreateFulfillmentError {
  448. fulfillmentHandlerError
  449. }
  450. }
  451. }
  452. ${FULFILLMENT_FRAGMENT}
  453. `;
  454. export const TRANSIT_FULFILLMENT = gql`
  455. mutation TransitFulfillment($id: ID!, $state: String!) {
  456. transitionFulfillmentToState(id: $id, state: $state) {
  457. ...Fulfillment
  458. ... on FulfillmentStateTransitionError {
  459. errorCode
  460. message
  461. transitionError
  462. fromState
  463. toState
  464. }
  465. }
  466. }
  467. ${FULFILLMENT_FRAGMENT}
  468. `;
  469. export const GET_ORDER_FULFILLMENTS = gql`
  470. query GetOrderFulfillments($id: ID!) {
  471. order(id: $id) {
  472. id
  473. state
  474. fulfillments {
  475. id
  476. state
  477. nextStates
  478. method
  479. summary {
  480. orderLine {
  481. id
  482. }
  483. quantity
  484. }
  485. }
  486. }
  487. }
  488. `;
  489. export const GET_ORDERS_LIST = gql`
  490. query GetOrderList($options: OrderListOptions) {
  491. orders(options: $options) {
  492. items {
  493. ...Order
  494. }
  495. totalItems
  496. }
  497. }
  498. ${ORDER_FRAGMENT}
  499. `;
  500. export const CREATE_ADDRESS = gql`
  501. mutation CreateAddress($id: ID!, $input: CreateAddressInput!) {
  502. createCustomerAddress(customerId: $id, input: $input) {
  503. id
  504. fullName
  505. company
  506. streetLine1
  507. streetLine2
  508. city
  509. province
  510. postalCode
  511. country {
  512. code
  513. name
  514. }
  515. phoneNumber
  516. defaultShippingAddress
  517. defaultBillingAddress
  518. }
  519. }
  520. `;
  521. export const UPDATE_ADDRESS = gql`
  522. mutation UpdateAddress($input: UpdateAddressInput!) {
  523. updateCustomerAddress(input: $input) {
  524. id
  525. defaultShippingAddress
  526. defaultBillingAddress
  527. country {
  528. code
  529. name
  530. }
  531. }
  532. }
  533. `;
  534. export const CREATE_CUSTOMER = gql`
  535. mutation CreateCustomer($input: CreateCustomerInput!, $password: String) {
  536. createCustomer(input: $input, password: $password) {
  537. ...Customer
  538. ... on ErrorResult {
  539. errorCode
  540. message
  541. }
  542. }
  543. }
  544. ${CUSTOMER_FRAGMENT}
  545. `;
  546. export const UPDATE_CUSTOMER = gql`
  547. mutation UpdateCustomer($input: UpdateCustomerInput!) {
  548. updateCustomer(input: $input) {
  549. ...Customer
  550. ... on ErrorResult {
  551. errorCode
  552. message
  553. }
  554. }
  555. }
  556. ${CUSTOMER_FRAGMENT}
  557. `;
  558. export const DELETE_CUSTOMER = gql`
  559. mutation DeleteCustomer($id: ID!) {
  560. deleteCustomer(id: $id) {
  561. result
  562. }
  563. }
  564. `;
  565. export const UPDATE_CUSTOMER_NOTE = gql`
  566. mutation UpdateCustomerNote($input: UpdateCustomerNoteInput!) {
  567. updateCustomerNote(input: $input) {
  568. id
  569. data
  570. isPublic
  571. }
  572. }
  573. `;
  574. export const DELETE_CUSTOMER_NOTE = gql`
  575. mutation DeleteCustomerNote($id: ID!) {
  576. deleteCustomerNote(id: $id) {
  577. result
  578. message
  579. }
  580. }
  581. `;
  582. export const UPDATE_CUSTOMER_GROUP = gql`
  583. mutation UpdateCustomerGroup($input: UpdateCustomerGroupInput!) {
  584. updateCustomerGroup(input: $input) {
  585. ...CustomerGroup
  586. }
  587. }
  588. ${CUSTOMER_GROUP_FRAGMENT}
  589. `;
  590. export const DELETE_CUSTOMER_GROUP = gql`
  591. mutation DeleteCustomerGroup($id: ID!) {
  592. deleteCustomerGroup(id: $id) {
  593. result
  594. message
  595. }
  596. }
  597. `;
  598. export const GET_CUSTOMER_GROUPS = gql`
  599. query GetCustomerGroups($options: CustomerGroupListOptions) {
  600. customerGroups(options: $options) {
  601. items {
  602. id
  603. name
  604. }
  605. totalItems
  606. }
  607. }
  608. `;
  609. export const GET_CUSTOMER_GROUP = gql`
  610. query GetCustomerGroup($id: ID!, $options: CustomerListOptions) {
  611. customerGroup(id: $id) {
  612. id
  613. name
  614. customers(options: $options) {
  615. items {
  616. id
  617. }
  618. totalItems
  619. }
  620. }
  621. }
  622. `;
  623. export const ADD_CUSTOMERS_TO_GROUP = gql`
  624. mutation AddCustomersToGroup($groupId: ID!, $customerIds: [ID!]!) {
  625. addCustomersToGroup(customerGroupId: $groupId, customerIds: $customerIds) {
  626. ...CustomerGroup
  627. }
  628. }
  629. ${CUSTOMER_GROUP_FRAGMENT}
  630. `;
  631. export const GET_CUSTOMER_WITH_GROUPS = gql`
  632. query GetCustomerWithGroups($id: ID!) {
  633. customer(id: $id) {
  634. id
  635. groups {
  636. id
  637. name
  638. }
  639. }
  640. }
  641. `;
  642. export const ADMIN_TRANSITION_TO_STATE = gql`
  643. mutation AdminTransition($id: ID!, $state: String!) {
  644. transitionOrderToState(id: $id, state: $state) {
  645. ...Order
  646. ... on OrderStateTransitionError {
  647. errorCode
  648. message
  649. transitionError
  650. fromState
  651. toState
  652. }
  653. }
  654. }
  655. ${ORDER_FRAGMENT}
  656. `;
  657. export const CANCEL_ORDER = gql`
  658. mutation CancelOrder($input: CancelOrderInput!) {
  659. cancelOrder(input: $input) {
  660. ...CanceledOrder
  661. ... on ErrorResult {
  662. errorCode
  663. message
  664. }
  665. }
  666. }
  667. fragment CanceledOrder on Order {
  668. id
  669. state
  670. lines {
  671. id
  672. quantity
  673. }
  674. }
  675. `;
  676. export const UPDATE_GLOBAL_SETTINGS = gql`
  677. mutation UpdateGlobalSettings($input: UpdateGlobalSettingsInput!) {
  678. updateGlobalSettings(input: $input) {
  679. ...GlobalSettings
  680. ... on ErrorResult {
  681. errorCode
  682. message
  683. }
  684. }
  685. }
  686. ${GLOBAL_SETTINGS_FRAGMENT}
  687. `;
  688. export const UPDATE_ROLE = gql`
  689. mutation UpdateRole($input: UpdateRoleInput!) {
  690. updateRole(input: $input) {
  691. ...Role
  692. }
  693. }
  694. ${ROLE_FRAGMENT}
  695. `;
  696. export const GET_PRODUCTS_WITH_VARIANT_PRICES = gql`
  697. query GetProductsWithVariantPrices {
  698. products {
  699. items {
  700. id
  701. slug
  702. variants {
  703. id
  704. price
  705. priceWithTax
  706. currencyCode
  707. sku
  708. facetValues {
  709. id
  710. code
  711. }
  712. }
  713. }
  714. }
  715. }
  716. `;
  717. export const CREATE_PRODUCT_OPTION_GROUP = gql`
  718. mutation CreateProductOptionGroup($input: CreateProductOptionGroupInput!) {
  719. createProductOptionGroup(input: $input) {
  720. ...ProductOptionGroup
  721. }
  722. }
  723. ${PRODUCT_OPTION_GROUP_FRAGMENT}
  724. `;
  725. export const ADD_OPTION_GROUP_TO_PRODUCT = gql`
  726. mutation AddOptionGroupToProduct($productId: ID!, $optionGroupId: ID!) {
  727. addOptionGroupToProduct(productId: $productId, optionGroupId: $optionGroupId) {
  728. ...ProductWithOptions
  729. }
  730. }
  731. ${PRODUCT_WITH_OPTIONS_FRAGMENT}
  732. `;
  733. export const CREATE_SHIPPING_METHOD = gql`
  734. mutation CreateShippingMethod($input: CreateShippingMethodInput!) {
  735. createShippingMethod(input: $input) {
  736. ...ShippingMethod
  737. }
  738. }
  739. ${SHIPPING_METHOD_FRAGMENT}
  740. `;
  741. export const SETTLE_PAYMENT = gql`
  742. mutation SettlePayment($id: ID!) {
  743. settlePayment(id: $id) {
  744. ...Payment
  745. ... on ErrorResult {
  746. errorCode
  747. message
  748. }
  749. ... on SettlePaymentError {
  750. paymentErrorMessage
  751. }
  752. }
  753. }
  754. ${PAYMENT_FRAGMENT}
  755. `;
  756. export const GET_ORDER_HISTORY = gql`
  757. query GetOrderHistory($id: ID!, $options: HistoryEntryListOptions) {
  758. order(id: $id) {
  759. id
  760. history(options: $options) {
  761. totalItems
  762. items {
  763. id
  764. type
  765. administrator {
  766. id
  767. }
  768. data
  769. }
  770. }
  771. }
  772. }
  773. `;
  774. export const UPDATE_SHIPPING_METHOD = gql`
  775. mutation UpdateShippingMethod($input: UpdateShippingMethodInput!) {
  776. updateShippingMethod(input: $input) {
  777. ...ShippingMethod
  778. }
  779. }
  780. ${SHIPPING_METHOD_FRAGMENT}
  781. `;
  782. export const GET_ASSET = gql`
  783. query GetAsset($id: ID!) {
  784. asset(id: $id) {
  785. ...Asset
  786. width
  787. height
  788. }
  789. }
  790. ${ASSET_FRAGMENT}
  791. `;
  792. export const GET_ASSET_FRAGMENT_FIRST = gql`
  793. fragment AssetFragFirst on Asset {
  794. id
  795. preview
  796. }
  797. query GetAssetFragmentFirst($id: ID!) {
  798. asset(id: $id) {
  799. ...AssetFragFirst
  800. }
  801. }
  802. `;
  803. export const ASSET_WITH_TAGS_AND_FOCAL_POINT_FRAGMENT = gql`
  804. fragment AssetWithTagsAndFocalPoint on Asset {
  805. ...Asset
  806. focalPoint {
  807. x
  808. y
  809. }
  810. tags {
  811. id
  812. value
  813. }
  814. }
  815. ${ASSET_FRAGMENT}
  816. `;
  817. export const CREATE_ASSETS = gql`
  818. mutation CreateAssets($input: [CreateAssetInput!]!) {
  819. createAssets(input: $input) {
  820. ...AssetWithTagsAndFocalPoint
  821. ... on MimeTypeError {
  822. message
  823. fileName
  824. mimeType
  825. }
  826. }
  827. }
  828. ${ASSET_WITH_TAGS_AND_FOCAL_POINT_FRAGMENT}
  829. `;
  830. export const DELETE_SHIPPING_METHOD = gql`
  831. mutation DeleteShippingMethod($id: ID!) {
  832. deleteShippingMethod(id: $id) {
  833. result
  834. message
  835. }
  836. }
  837. `;
  838. export const ASSIGN_PROMOTIONS_TO_CHANNEL = gql`
  839. mutation AssignPromotionToChannel($input: AssignPromotionsToChannelInput!) {
  840. assignPromotionsToChannel(input: $input) {
  841. id
  842. name
  843. }
  844. }
  845. `;
  846. export const REMOVE_PROMOTIONS_FROM_CHANNEL = gql`
  847. mutation RemovePromotionFromChannel($input: RemovePromotionsFromChannelInput!) {
  848. removePromotionsFromChannel(input: $input) {
  849. id
  850. name
  851. }
  852. }
  853. `;
  854. export const GET_TAX_RATES_LIST = gql`
  855. query GetTaxRates($options: TaxRateListOptions) {
  856. taxRates(options: $options) {
  857. items {
  858. ...TaxRate
  859. }
  860. totalItems
  861. }
  862. }
  863. ${TAX_RATE_FRAGMENT}
  864. `;
  865. export const GET_SHIPPING_METHOD_LIST = gql`
  866. query GetShippingMethodList {
  867. shippingMethods {
  868. items {
  869. ...ShippingMethod
  870. }
  871. totalItems
  872. }
  873. }
  874. ${SHIPPING_METHOD_FRAGMENT}
  875. `;
  876. export const GET_COLLECTIONS = gql`
  877. query GetCollections {
  878. collections {
  879. items {
  880. id
  881. name
  882. position
  883. parent {
  884. id
  885. name
  886. }
  887. }
  888. }
  889. }
  890. `;
  891. export const TRANSITION_PAYMENT_TO_STATE = gql`
  892. mutation TransitionPaymentToState($id: ID!, $state: String!) {
  893. transitionPaymentToState(id: $id, state: $state) {
  894. ...Payment
  895. ... on ErrorResult {
  896. errorCode
  897. message
  898. }
  899. ... on PaymentStateTransitionError {
  900. transitionError
  901. }
  902. }
  903. }
  904. ${PAYMENT_FRAGMENT}
  905. `;
  906. export const GET_PRODUCT_VARIANT_LIST = gql`
  907. query GetProductVariantList($options: ProductVariantListOptions, $productId: ID) {
  908. productVariants(options: $options, productId: $productId) {
  909. items {
  910. id
  911. name
  912. sku
  913. price
  914. priceWithTax
  915. currencyCode
  916. prices {
  917. currencyCode
  918. price
  919. }
  920. }
  921. totalItems
  922. }
  923. }
  924. `;
  925. export const DELETE_PROMOTION = gql`
  926. mutation DeletePromotion($id: ID!) {
  927. deletePromotion(id: $id) {
  928. result
  929. }
  930. }
  931. `;
  932. export const GET_CHANNELS = gql`
  933. query GetChannels {
  934. channels {
  935. items {
  936. id
  937. code
  938. token
  939. }
  940. }
  941. }
  942. `;
  943. export const UPDATE_ADMINISTRATOR = gql`
  944. mutation UpdateAdministrator($input: UpdateAdministratorInput!) {
  945. updateAdministrator(input: $input) {
  946. ...Administrator
  947. }
  948. }
  949. ${ADMINISTRATOR_FRAGMENT}
  950. `;
  951. export const ASSIGN_COLLECTIONS_TO_CHANNEL = gql`
  952. mutation AssignCollectionsToChannel($input: AssignCollectionsToChannelInput!) {
  953. assignCollectionsToChannel(input: $input) {
  954. ...Collection
  955. }
  956. }
  957. ${COLLECTION_FRAGMENT}
  958. `;
  959. export const GET_COLLECTION = gql`
  960. query GetCollection($id: ID, $slug: String, $variantListOptions: ProductVariantListOptions) {
  961. collection(id: $id, slug: $slug) {
  962. ...Collection
  963. productVariants(options: $variantListOptions) {
  964. items {
  965. id
  966. name
  967. price
  968. }
  969. }
  970. }
  971. }
  972. ${COLLECTION_FRAGMENT}
  973. `;
  974. export const GET_FACET_WITH_VALUES = gql`
  975. query GetFacetWithValues($id: ID!) {
  976. facet(id: $id) {
  977. ...FacetWithValues
  978. }
  979. }
  980. ${FACET_WITH_VALUES_FRAGMENT}
  981. `;
  982. export const GET_PROMOTION = gql`
  983. query GetPromotion($id: ID!) {
  984. promotion(id: $id) {
  985. ...Promotion
  986. }
  987. }
  988. ${PROMOTION_FRAGMENT}
  989. `;