shared-definitions.ts 20 KB

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