shared-definitions.ts 24 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  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. }
  194. }
  195. ${CURRENT_USER_FRAGMENT}
  196. `;
  197. export const GET_COUNTRY_LIST = gql`
  198. query GetCountryList($options: CountryListOptions) {
  199. countries(options: $options) {
  200. items {
  201. id
  202. code
  203. name
  204. enabled
  205. }
  206. totalItems
  207. }
  208. }
  209. `;
  210. export const UPDATE_COUNTRY = gql`
  211. mutation UpdateCountry($input: UpdateCountryInput!) {
  212. updateCountry(input: $input) {
  213. ...Country
  214. }
  215. }
  216. ${COUNTRY_FRAGMENT}
  217. `;
  218. export const GET_FACET_LIST = gql`
  219. query GetFacetList($options: FacetListOptions) {
  220. facets(options: $options) {
  221. items {
  222. ...FacetWithValues
  223. }
  224. totalItems
  225. }
  226. }
  227. ${FACET_WITH_VALUES_FRAGMENT}
  228. `;
  229. export const GET_FACET_LIST_SIMPLE = gql`
  230. query GetFacetListSimple($options: FacetListOptions) {
  231. facets(options: $options) {
  232. items {
  233. id
  234. name
  235. }
  236. totalItems
  237. }
  238. }
  239. `;
  240. export const DELETE_PRODUCT = gql`
  241. mutation DeleteProduct($id: ID!) {
  242. deleteProduct(id: $id) {
  243. result
  244. }
  245. }
  246. `;
  247. export const GET_PRODUCT_SIMPLE = gql`
  248. query GetProductSimple($id: ID, $slug: String) {
  249. product(slug: $slug, id: $id) {
  250. id
  251. slug
  252. }
  253. }
  254. `;
  255. export const GET_STOCK_MOVEMENT = gql`
  256. query GetStockMovement($id: ID!) {
  257. product(id: $id) {
  258. id
  259. variants {
  260. ...VariantWithStock
  261. }
  262. }
  263. }
  264. ${VARIANT_WITH_STOCK_FRAGMENT}
  265. `;
  266. export const GET_RUNNING_JOBS = gql`
  267. query GetRunningJobs($options: JobListOptions) {
  268. jobs(options: $options) {
  269. items {
  270. id
  271. queueName
  272. state
  273. isSettled
  274. duration
  275. }
  276. totalItems
  277. }
  278. }
  279. `;
  280. export const CREATE_PROMOTION = gql`
  281. mutation CreatePromotion($input: CreatePromotionInput!) {
  282. createPromotion(input: $input) {
  283. ...Promotion
  284. ... on ErrorResult {
  285. errorCode
  286. message
  287. }
  288. }
  289. }
  290. ${PROMOTION_FRAGMENT}
  291. `;
  292. export const ME = gql`
  293. query Me {
  294. me {
  295. ...CurrentUser
  296. }
  297. }
  298. ${CURRENT_USER_FRAGMENT}
  299. `;
  300. export const CREATE_CHANNEL = gql`
  301. mutation CreateChannel($input: CreateChannelInput!) {
  302. createChannel(input: $input) {
  303. ...Channel
  304. ... on LanguageNotAvailableError {
  305. errorCode
  306. message
  307. languageCode
  308. }
  309. }
  310. }
  311. ${CHANNEL_FRAGMENT}
  312. `;
  313. export const DELETE_PRODUCT_VARIANT = gql`
  314. mutation DeleteProductVariant($id: ID!) {
  315. deleteProductVariant(id: $id) {
  316. result
  317. message
  318. }
  319. }
  320. `;
  321. export const ASSIGN_PRODUCT_TO_CHANNEL = gql`
  322. mutation AssignProductsToChannel($input: AssignProductsToChannelInput!) {
  323. assignProductsToChannel(input: $input) {
  324. ...ProductWithVariants
  325. }
  326. }
  327. ${PRODUCT_WITH_VARIANTS_FRAGMENT}
  328. `;
  329. export const REMOVE_PRODUCT_FROM_CHANNEL = gql`
  330. mutation RemoveProductsFromChannel($input: RemoveProductsFromChannelInput!) {
  331. removeProductsFromChannel(input: $input) {
  332. ...ProductWithVariants
  333. }
  334. }
  335. ${PRODUCT_WITH_VARIANTS_FRAGMENT}
  336. `;
  337. export const ASSIGN_PRODUCTVARIANT_TO_CHANNEL = gql`
  338. mutation AssignProductVariantsToChannel($input: AssignProductVariantsToChannelInput!) {
  339. assignProductVariantsToChannel(input: $input) {
  340. ...ProductVariant
  341. }
  342. }
  343. ${PRODUCT_VARIANT_FRAGMENT}
  344. `;
  345. export const REMOVE_PRODUCTVARIANT_FROM_CHANNEL = gql`
  346. mutation RemoveProductVariantsFromChannel($input: RemoveProductVariantsFromChannelInput!) {
  347. removeProductVariantsFromChannel(input: $input) {
  348. ...ProductVariant
  349. }
  350. }
  351. ${PRODUCT_VARIANT_FRAGMENT}
  352. `;
  353. export const UPDATE_ASSET = gql`
  354. mutation UpdateAsset($input: UpdateAssetInput!) {
  355. updateAsset(input: $input) {
  356. ...Asset
  357. ... on Asset {
  358. tags {
  359. id
  360. value
  361. }
  362. focalPoint {
  363. x
  364. y
  365. }
  366. }
  367. }
  368. }
  369. ${ASSET_FRAGMENT}
  370. `;
  371. export const DELETE_ASSET = gql`
  372. mutation DeleteAsset($input: DeleteAssetInput!) {
  373. deleteAsset(input: $input) {
  374. result
  375. message
  376. }
  377. }
  378. `;
  379. export const UPDATE_CHANNEL = gql`
  380. mutation UpdateChannel($input: UpdateChannelInput!) {
  381. updateChannel(input: $input) {
  382. ...Channel
  383. ... on LanguageNotAvailableError {
  384. errorCode
  385. message
  386. languageCode
  387. }
  388. }
  389. }
  390. ${CHANNEL_FRAGMENT}
  391. `;
  392. export const GET_CUSTOMER_HISTORY = gql`
  393. query GetCustomerHistory($id: ID!, $options: HistoryEntryListOptions) {
  394. customer(id: $id) {
  395. id
  396. history(options: $options) {
  397. totalItems
  398. items {
  399. id
  400. administrator {
  401. id
  402. }
  403. type
  404. data
  405. }
  406. }
  407. }
  408. }
  409. `;
  410. export const GET_ORDER = gql`
  411. query GetOrder($id: ID!) {
  412. order(id: $id) {
  413. ...OrderWithLines
  414. }
  415. }
  416. ${ORDER_WITH_LINES_FRAGMENT}
  417. `;
  418. export const CREATE_CUSTOMER_GROUP = gql`
  419. mutation CreateCustomerGroup($input: CreateCustomerGroupInput!) {
  420. createCustomerGroup(input: $input) {
  421. ...CustomerGroup
  422. }
  423. }
  424. ${CUSTOMER_GROUP_FRAGMENT}
  425. `;
  426. export const REMOVE_CUSTOMERS_FROM_GROUP = gql`
  427. mutation RemoveCustomersFromGroup($groupId: ID!, $customerIds: [ID!]!) {
  428. removeCustomersFromGroup(customerGroupId: $groupId, customerIds: $customerIds) {
  429. ...CustomerGroup
  430. }
  431. }
  432. ${CUSTOMER_GROUP_FRAGMENT}
  433. `;
  434. export const CREATE_FULFILLMENT = gql`
  435. mutation CreateFulfillment($input: FulfillOrderInput!) {
  436. addFulfillmentToOrder(input: $input) {
  437. ...Fulfillment
  438. ... on ErrorResult {
  439. errorCode
  440. message
  441. }
  442. ... on CreateFulfillmentError {
  443. fulfillmentHandlerError
  444. }
  445. }
  446. }
  447. ${FULFILLMENT_FRAGMENT}
  448. `;
  449. export const TRANSIT_FULFILLMENT = gql`
  450. mutation TransitFulfillment($id: ID!, $state: String!) {
  451. transitionFulfillmentToState(id: $id, state: $state) {
  452. ...Fulfillment
  453. ... on FulfillmentStateTransitionError {
  454. errorCode
  455. message
  456. transitionError
  457. fromState
  458. toState
  459. }
  460. }
  461. }
  462. ${FULFILLMENT_FRAGMENT}
  463. `;
  464. export const GET_ORDER_FULFILLMENTS = gql`
  465. query GetOrderFulfillments($id: ID!) {
  466. order(id: $id) {
  467. id
  468. state
  469. fulfillments {
  470. id
  471. state
  472. nextStates
  473. method
  474. summary {
  475. orderLine {
  476. id
  477. }
  478. quantity
  479. }
  480. }
  481. }
  482. }
  483. `;
  484. export const GET_ORDERS_LIST = gql`
  485. query GetOrderList($options: OrderListOptions) {
  486. orders(options: $options) {
  487. items {
  488. ...Order
  489. }
  490. totalItems
  491. }
  492. }
  493. ${ORDER_FRAGMENT}
  494. `;
  495. export const CREATE_ADDRESS = gql`
  496. mutation CreateAddress($id: ID!, $input: CreateAddressInput!) {
  497. createCustomerAddress(customerId: $id, input: $input) {
  498. id
  499. fullName
  500. company
  501. streetLine1
  502. streetLine2
  503. city
  504. province
  505. postalCode
  506. country {
  507. code
  508. name
  509. }
  510. phoneNumber
  511. defaultShippingAddress
  512. defaultBillingAddress
  513. }
  514. }
  515. `;
  516. export const UPDATE_ADDRESS = gql`
  517. mutation UpdateAddress($input: UpdateAddressInput!) {
  518. updateCustomerAddress(input: $input) {
  519. id
  520. defaultShippingAddress
  521. defaultBillingAddress
  522. country {
  523. code
  524. name
  525. }
  526. }
  527. }
  528. `;
  529. export const CREATE_CUSTOMER = gql`
  530. mutation CreateCustomer($input: CreateCustomerInput!, $password: String) {
  531. createCustomer(input: $input, password: $password) {
  532. ...Customer
  533. ... on ErrorResult {
  534. errorCode
  535. message
  536. }
  537. }
  538. }
  539. ${CUSTOMER_FRAGMENT}
  540. `;
  541. export const UPDATE_CUSTOMER = gql`
  542. mutation UpdateCustomer($input: UpdateCustomerInput!) {
  543. updateCustomer(input: $input) {
  544. ...Customer
  545. ... on ErrorResult {
  546. errorCode
  547. message
  548. }
  549. }
  550. }
  551. ${CUSTOMER_FRAGMENT}
  552. `;
  553. export const DELETE_CUSTOMER = gql`
  554. mutation DeleteCustomer($id: ID!) {
  555. deleteCustomer(id: $id) {
  556. result
  557. }
  558. }
  559. `;
  560. export const UPDATE_CUSTOMER_NOTE = gql`
  561. mutation UpdateCustomerNote($input: UpdateCustomerNoteInput!) {
  562. updateCustomerNote(input: $input) {
  563. id
  564. data
  565. isPublic
  566. }
  567. }
  568. `;
  569. export const DELETE_CUSTOMER_NOTE = gql`
  570. mutation DeleteCustomerNote($id: ID!) {
  571. deleteCustomerNote(id: $id) {
  572. result
  573. message
  574. }
  575. }
  576. `;
  577. export const UPDATE_CUSTOMER_GROUP = gql`
  578. mutation UpdateCustomerGroup($input: UpdateCustomerGroupInput!) {
  579. updateCustomerGroup(input: $input) {
  580. ...CustomerGroup
  581. }
  582. }
  583. ${CUSTOMER_GROUP_FRAGMENT}
  584. `;
  585. export const DELETE_CUSTOMER_GROUP = gql`
  586. mutation DeleteCustomerGroup($id: ID!) {
  587. deleteCustomerGroup(id: $id) {
  588. result
  589. message
  590. }
  591. }
  592. `;
  593. export const GET_CUSTOMER_GROUPS = gql`
  594. query GetCustomerGroups($options: CustomerGroupListOptions) {
  595. customerGroups(options: $options) {
  596. items {
  597. id
  598. name
  599. }
  600. totalItems
  601. }
  602. }
  603. `;
  604. export const GET_CUSTOMER_GROUP = gql`
  605. query GetCustomerGroup($id: ID!, $options: CustomerListOptions) {
  606. customerGroup(id: $id) {
  607. id
  608. name
  609. customers(options: $options) {
  610. items {
  611. id
  612. }
  613. totalItems
  614. }
  615. }
  616. }
  617. `;
  618. export const ADD_CUSTOMERS_TO_GROUP = gql`
  619. mutation AddCustomersToGroup($groupId: ID!, $customerIds: [ID!]!) {
  620. addCustomersToGroup(customerGroupId: $groupId, customerIds: $customerIds) {
  621. ...CustomerGroup
  622. }
  623. }
  624. ${CUSTOMER_GROUP_FRAGMENT}
  625. `;
  626. export const GET_CUSTOMER_WITH_GROUPS = gql`
  627. query GetCustomerWithGroups($id: ID!) {
  628. customer(id: $id) {
  629. id
  630. groups {
  631. id
  632. name
  633. }
  634. }
  635. }
  636. `;
  637. export const ADMIN_TRANSITION_TO_STATE = gql`
  638. mutation AdminTransition($id: ID!, $state: String!) {
  639. transitionOrderToState(id: $id, state: $state) {
  640. ...Order
  641. ... on OrderStateTransitionError {
  642. errorCode
  643. message
  644. transitionError
  645. fromState
  646. toState
  647. }
  648. }
  649. }
  650. ${ORDER_FRAGMENT}
  651. `;
  652. export const CANCEL_ORDER = gql`
  653. mutation CancelOrder($input: CancelOrderInput!) {
  654. cancelOrder(input: $input) {
  655. ...CanceledOrder
  656. ... on ErrorResult {
  657. errorCode
  658. message
  659. }
  660. }
  661. }
  662. fragment CanceledOrder on Order {
  663. id
  664. state
  665. lines {
  666. quantity
  667. items {
  668. id
  669. cancelled
  670. }
  671. }
  672. }
  673. `;
  674. export const UPDATE_GLOBAL_SETTINGS = gql`
  675. mutation UpdateGlobalSettings($input: UpdateGlobalSettingsInput!) {
  676. updateGlobalSettings(input: $input) {
  677. ...GlobalSettings
  678. ... on ErrorResult {
  679. errorCode
  680. message
  681. }
  682. }
  683. }
  684. ${GLOBAL_SETTINGS_FRAGMENT}
  685. `;
  686. export const UPDATE_ROLE = gql`
  687. mutation UpdateRole($input: UpdateRoleInput!) {
  688. updateRole(input: $input) {
  689. ...Role
  690. }
  691. }
  692. ${ROLE_FRAGMENT}
  693. `;
  694. export const GET_PRODUCTS_WITH_VARIANT_PRICES = gql`
  695. query GetProductsWithVariantPrices {
  696. products {
  697. items {
  698. id
  699. slug
  700. variants {
  701. id
  702. price
  703. priceWithTax
  704. sku
  705. facetValues {
  706. id
  707. code
  708. }
  709. }
  710. }
  711. }
  712. }
  713. `;
  714. export const CREATE_PRODUCT_OPTION_GROUP = gql`
  715. mutation CreateProductOptionGroup($input: CreateProductOptionGroupInput!) {
  716. createProductOptionGroup(input: $input) {
  717. ...ProductOptionGroup
  718. }
  719. }
  720. ${PRODUCT_OPTION_GROUP_FRAGMENT}
  721. `;
  722. export const ADD_OPTION_GROUP_TO_PRODUCT = gql`
  723. mutation AddOptionGroupToProduct($productId: ID!, $optionGroupId: ID!) {
  724. addOptionGroupToProduct(productId: $productId, optionGroupId: $optionGroupId) {
  725. ...ProductWithOptions
  726. }
  727. }
  728. ${PRODUCT_WITH_OPTIONS_FRAGMENT}
  729. `;
  730. export const CREATE_SHIPPING_METHOD = gql`
  731. mutation CreateShippingMethod($input: CreateShippingMethodInput!) {
  732. createShippingMethod(input: $input) {
  733. ...ShippingMethod
  734. }
  735. }
  736. ${SHIPPING_METHOD_FRAGMENT}
  737. `;
  738. export const SETTLE_PAYMENT = gql`
  739. mutation SettlePayment($id: ID!) {
  740. settlePayment(id: $id) {
  741. ...Payment
  742. ... on ErrorResult {
  743. errorCode
  744. message
  745. }
  746. ... on SettlePaymentError {
  747. paymentErrorMessage
  748. }
  749. }
  750. }
  751. ${PAYMENT_FRAGMENT}
  752. `;
  753. export const GET_ORDER_HISTORY = gql`
  754. query GetOrderHistory($id: ID!, $options: HistoryEntryListOptions) {
  755. order(id: $id) {
  756. id
  757. history(options: $options) {
  758. totalItems
  759. items {
  760. id
  761. type
  762. administrator {
  763. id
  764. }
  765. data
  766. }
  767. }
  768. }
  769. }
  770. `;
  771. export const UPDATE_SHIPPING_METHOD = gql`
  772. mutation UpdateShippingMethod($input: UpdateShippingMethodInput!) {
  773. updateShippingMethod(input: $input) {
  774. ...ShippingMethod
  775. }
  776. }
  777. ${SHIPPING_METHOD_FRAGMENT}
  778. `;
  779. export const GET_ASSET = gql`
  780. query GetAsset($id: ID!) {
  781. asset(id: $id) {
  782. ...Asset
  783. width
  784. height
  785. }
  786. }
  787. ${ASSET_FRAGMENT}
  788. `;
  789. export const GET_ASSET_FRAGMENT_FIRST = gql`
  790. fragment AssetFragFirst on Asset {
  791. id
  792. preview
  793. }
  794. query GetAssetFragmentFirst($id: ID!) {
  795. asset(id: $id) {
  796. ...AssetFragFirst
  797. }
  798. }
  799. `;
  800. export const ASSET_WITH_TAGS_AND_FOCAL_POINT_FRAGMENT = gql`
  801. fragment AssetWithTagsAndFocalPoint on Asset {
  802. ...Asset
  803. focalPoint {
  804. x
  805. y
  806. }
  807. tags {
  808. id
  809. value
  810. }
  811. }
  812. ${ASSET_FRAGMENT}
  813. `;
  814. export const CREATE_ASSETS = gql`
  815. mutation CreateAssets($input: [CreateAssetInput!]!) {
  816. createAssets(input: $input) {
  817. ...AssetWithTagsAndFocalPoint
  818. ... on MimeTypeError {
  819. message
  820. fileName
  821. mimeType
  822. }
  823. }
  824. }
  825. ${ASSET_WITH_TAGS_AND_FOCAL_POINT_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. `;