shared-definitions.ts 23 KB

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