shared-definitions.ts 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974
  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 CREATE_ASSETS = gql`
  801. mutation CreateAssets($input: [CreateAssetInput!]!) {
  802. createAssets(input: $input) {
  803. ...Asset
  804. ... on Asset {
  805. focalPoint {
  806. x
  807. y
  808. }
  809. tags {
  810. id
  811. value
  812. }
  813. }
  814. ... on MimeTypeError {
  815. message
  816. fileName
  817. mimeType
  818. }
  819. }
  820. }
  821. ${ASSET_FRAGMENT}
  822. `;
  823. export const DELETE_SHIPPING_METHOD = gql`
  824. mutation DeleteShippingMethod($id: ID!) {
  825. deleteShippingMethod(id: $id) {
  826. result
  827. message
  828. }
  829. }
  830. `;
  831. export const ASSIGN_PROMOTIONS_TO_CHANNEL = gql`
  832. mutation AssignPromotionToChannel($input: AssignPromotionsToChannelInput!) {
  833. assignPromotionsToChannel(input: $input) {
  834. id
  835. name
  836. }
  837. }
  838. `;
  839. export const REMOVE_PROMOTIONS_FROM_CHANNEL = gql`
  840. mutation RemovePromotionFromChannel($input: RemovePromotionsFromChannelInput!) {
  841. removePromotionsFromChannel(input: $input) {
  842. id
  843. name
  844. }
  845. }
  846. `;
  847. export const GET_TAX_RATES_LIST = gql`
  848. query GetTaxRates($options: TaxRateListOptions) {
  849. taxRates(options: $options) {
  850. items {
  851. ...TaxRate
  852. }
  853. totalItems
  854. }
  855. }
  856. ${TAX_RATE_FRAGMENT}
  857. `;
  858. export const GET_SHIPPING_METHOD_LIST = gql`
  859. query GetShippingMethodList {
  860. shippingMethods {
  861. items {
  862. ...ShippingMethod
  863. }
  864. totalItems
  865. }
  866. }
  867. ${SHIPPING_METHOD_FRAGMENT}
  868. `;
  869. export const GET_COLLECTIONS = gql`
  870. query GetCollections {
  871. collections {
  872. items {
  873. id
  874. name
  875. position
  876. parent {
  877. id
  878. name
  879. }
  880. }
  881. }
  882. }
  883. `;
  884. export const TRANSITION_PAYMENT_TO_STATE = gql`
  885. mutation TransitionPaymentToState($id: ID!, $state: String!) {
  886. transitionPaymentToState(id: $id, state: $state) {
  887. ...Payment
  888. ... on ErrorResult {
  889. errorCode
  890. message
  891. }
  892. ... on PaymentStateTransitionError {
  893. transitionError
  894. }
  895. }
  896. }
  897. ${PAYMENT_FRAGMENT}
  898. `;