shared-definitions.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951
  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. }
  475. }
  476. }
  477. `;
  478. export const GET_ORDERS_LIST = gql`
  479. query GetOrderList($options: OrderListOptions) {
  480. orders(options: $options) {
  481. items {
  482. ...Order
  483. }
  484. totalItems
  485. }
  486. }
  487. ${ORDER_FRAGMENT}
  488. `;
  489. export const CREATE_ADDRESS = gql`
  490. mutation CreateAddress($id: ID!, $input: CreateAddressInput!) {
  491. createCustomerAddress(customerId: $id, input: $input) {
  492. id
  493. fullName
  494. company
  495. streetLine1
  496. streetLine2
  497. city
  498. province
  499. postalCode
  500. country {
  501. code
  502. name
  503. }
  504. phoneNumber
  505. defaultShippingAddress
  506. defaultBillingAddress
  507. }
  508. }
  509. `;
  510. export const UPDATE_ADDRESS = gql`
  511. mutation UpdateAddress($input: UpdateAddressInput!) {
  512. updateCustomerAddress(input: $input) {
  513. id
  514. defaultShippingAddress
  515. defaultBillingAddress
  516. country {
  517. code
  518. name
  519. }
  520. }
  521. }
  522. `;
  523. export const CREATE_CUSTOMER = gql`
  524. mutation CreateCustomer($input: CreateCustomerInput!, $password: String) {
  525. createCustomer(input: $input, password: $password) {
  526. ...Customer
  527. ... on ErrorResult {
  528. errorCode
  529. message
  530. }
  531. }
  532. }
  533. ${CUSTOMER_FRAGMENT}
  534. `;
  535. export const UPDATE_CUSTOMER = gql`
  536. mutation UpdateCustomer($input: UpdateCustomerInput!) {
  537. updateCustomer(input: $input) {
  538. ...Customer
  539. ... on ErrorResult {
  540. errorCode
  541. message
  542. }
  543. }
  544. }
  545. ${CUSTOMER_FRAGMENT}
  546. `;
  547. export const DELETE_CUSTOMER = gql`
  548. mutation DeleteCustomer($id: ID!) {
  549. deleteCustomer(id: $id) {
  550. result
  551. }
  552. }
  553. `;
  554. export const UPDATE_CUSTOMER_NOTE = gql`
  555. mutation UpdateCustomerNote($input: UpdateCustomerNoteInput!) {
  556. updateCustomerNote(input: $input) {
  557. id
  558. data
  559. isPublic
  560. }
  561. }
  562. `;
  563. export const DELETE_CUSTOMER_NOTE = gql`
  564. mutation DeleteCustomerNote($id: ID!) {
  565. deleteCustomerNote(id: $id) {
  566. result
  567. message
  568. }
  569. }
  570. `;
  571. export const UPDATE_CUSTOMER_GROUP = gql`
  572. mutation UpdateCustomerGroup($input: UpdateCustomerGroupInput!) {
  573. updateCustomerGroup(input: $input) {
  574. ...CustomerGroup
  575. }
  576. }
  577. ${CUSTOMER_GROUP_FRAGMENT}
  578. `;
  579. export const DELETE_CUSTOMER_GROUP = gql`
  580. mutation DeleteCustomerGroup($id: ID!) {
  581. deleteCustomerGroup(id: $id) {
  582. result
  583. message
  584. }
  585. }
  586. `;
  587. export const GET_CUSTOMER_GROUPS = gql`
  588. query GetCustomerGroups($options: CustomerGroupListOptions) {
  589. customerGroups(options: $options) {
  590. items {
  591. id
  592. name
  593. }
  594. totalItems
  595. }
  596. }
  597. `;
  598. export const GET_CUSTOMER_GROUP = gql`
  599. query GetCustomerGroup($id: ID!, $options: CustomerListOptions) {
  600. customerGroup(id: $id) {
  601. id
  602. name
  603. customers(options: $options) {
  604. items {
  605. id
  606. }
  607. totalItems
  608. }
  609. }
  610. }
  611. `;
  612. export const ADD_CUSTOMERS_TO_GROUP = gql`
  613. mutation AddCustomersToGroup($groupId: ID!, $customerIds: [ID!]!) {
  614. addCustomersToGroup(customerGroupId: $groupId, customerIds: $customerIds) {
  615. ...CustomerGroup
  616. }
  617. }
  618. ${CUSTOMER_GROUP_FRAGMENT}
  619. `;
  620. export const GET_CUSTOMER_WITH_GROUPS = gql`
  621. query GetCustomerWithGroups($id: ID!) {
  622. customer(id: $id) {
  623. id
  624. groups {
  625. id
  626. name
  627. }
  628. }
  629. }
  630. `;
  631. export const ADMIN_TRANSITION_TO_STATE = gql`
  632. mutation AdminTransition($id: ID!, $state: String!) {
  633. transitionOrderToState(id: $id, state: $state) {
  634. ...Order
  635. ... on OrderStateTransitionError {
  636. errorCode
  637. message
  638. transitionError
  639. fromState
  640. toState
  641. }
  642. }
  643. }
  644. ${ORDER_FRAGMENT}
  645. `;
  646. export const CANCEL_ORDER = gql`
  647. mutation CancelOrder($input: CancelOrderInput!) {
  648. cancelOrder(input: $input) {
  649. ...CanceledOrder
  650. ... on ErrorResult {
  651. errorCode
  652. message
  653. }
  654. }
  655. }
  656. fragment CanceledOrder on Order {
  657. id
  658. lines {
  659. quantity
  660. items {
  661. id
  662. cancelled
  663. }
  664. }
  665. }
  666. `;
  667. export const UPDATE_GLOBAL_SETTINGS = gql`
  668. mutation UpdateGlobalSettings($input: UpdateGlobalSettingsInput!) {
  669. updateGlobalSettings(input: $input) {
  670. ...GlobalSettings
  671. ... on ErrorResult {
  672. errorCode
  673. message
  674. }
  675. }
  676. }
  677. ${GLOBAL_SETTINGS_FRAGMENT}
  678. `;
  679. export const UPDATE_ROLE = gql`
  680. mutation UpdateRole($input: UpdateRoleInput!) {
  681. updateRole(input: $input) {
  682. ...Role
  683. }
  684. }
  685. ${ROLE_FRAGMENT}
  686. `;
  687. export const GET_PRODUCTS_WITH_VARIANT_PRICES = gql`
  688. query GetProductsWithVariantPrices {
  689. products {
  690. items {
  691. id
  692. slug
  693. variants {
  694. id
  695. price
  696. priceWithTax
  697. sku
  698. facetValues {
  699. id
  700. code
  701. }
  702. }
  703. }
  704. }
  705. }
  706. `;
  707. export const CREATE_PRODUCT_OPTION_GROUP = gql`
  708. mutation CreateProductOptionGroup($input: CreateProductOptionGroupInput!) {
  709. createProductOptionGroup(input: $input) {
  710. ...ProductOptionGroup
  711. }
  712. }
  713. ${PRODUCT_OPTION_GROUP_FRAGMENT}
  714. `;
  715. export const ADD_OPTION_GROUP_TO_PRODUCT = gql`
  716. mutation AddOptionGroupToProduct($productId: ID!, $optionGroupId: ID!) {
  717. addOptionGroupToProduct(productId: $productId, optionGroupId: $optionGroupId) {
  718. ...ProductWithOptions
  719. }
  720. }
  721. ${PRODUCT_WITH_OPTIONS_FRAGMENT}
  722. `;
  723. export const CREATE_SHIPPING_METHOD = gql`
  724. mutation CreateShippingMethod($input: CreateShippingMethodInput!) {
  725. createShippingMethod(input: $input) {
  726. ...ShippingMethod
  727. }
  728. }
  729. ${SHIPPING_METHOD_FRAGMENT}
  730. `;
  731. export const SETTLE_PAYMENT = gql`
  732. mutation SettlePayment($id: ID!) {
  733. settlePayment(id: $id) {
  734. ...Payment
  735. ... on ErrorResult {
  736. errorCode
  737. message
  738. }
  739. ... on SettlePaymentError {
  740. paymentErrorMessage
  741. }
  742. }
  743. }
  744. ${PAYMENT_FRAGMENT}
  745. `;
  746. export const GET_ORDER_HISTORY = gql`
  747. query GetOrderHistory($id: ID!, $options: HistoryEntryListOptions) {
  748. order(id: $id) {
  749. id
  750. history(options: $options) {
  751. totalItems
  752. items {
  753. id
  754. type
  755. administrator {
  756. id
  757. }
  758. data
  759. }
  760. }
  761. }
  762. }
  763. `;
  764. export const UPDATE_SHIPPING_METHOD = gql`
  765. mutation UpdateShippingMethod($input: UpdateShippingMethodInput!) {
  766. updateShippingMethod(input: $input) {
  767. ...ShippingMethod
  768. }
  769. }
  770. ${SHIPPING_METHOD_FRAGMENT}
  771. `;
  772. export const GET_ASSET = gql`
  773. query GetAsset($id: ID!) {
  774. asset(id: $id) {
  775. ...Asset
  776. width
  777. height
  778. }
  779. }
  780. ${ASSET_FRAGMENT}
  781. `;
  782. export const GET_ASSET_FRAGMENT_FIRST = gql`
  783. fragment AssetFragFirst on Asset {
  784. id
  785. preview
  786. }
  787. query GetAssetFragmentFirst($id: ID!) {
  788. asset(id: $id) {
  789. ...AssetFragFirst
  790. }
  791. }
  792. `;
  793. export const CREATE_ASSETS = gql`
  794. mutation CreateAssets($input: [CreateAssetInput!]!) {
  795. createAssets(input: $input) {
  796. ...Asset
  797. ... on Asset {
  798. focalPoint {
  799. x
  800. y
  801. }
  802. tags {
  803. id
  804. value
  805. }
  806. }
  807. ... on MimeTypeError {
  808. message
  809. fileName
  810. mimeType
  811. }
  812. }
  813. }
  814. ${ASSET_FRAGMENT}
  815. `;
  816. export const DELETE_SHIPPING_METHOD = gql`
  817. mutation DeleteShippingMethod($id: ID!) {
  818. deleteShippingMethod(id: $id) {
  819. result
  820. message
  821. }
  822. }
  823. `;
  824. export const ASSIGN_PROMOTIONS_TO_CHANNEL = gql`
  825. mutation AssignPromotionToChannel($input: AssignPromotionsToChannelInput!) {
  826. assignPromotionsToChannel(input: $input) {
  827. id
  828. name
  829. }
  830. }
  831. `;
  832. export const REMOVE_PROMOTIONS_FROM_CHANNEL = gql`
  833. mutation RemovePromotionFromChannel($input: RemovePromotionsFromChannelInput!) {
  834. removePromotionsFromChannel(input: $input) {
  835. id
  836. name
  837. }
  838. }
  839. `;
  840. export const GET_TAX_RATES_LIST = gql`
  841. query GetTaxRates($options: TaxRateListOptions) {
  842. taxRates(options: $options) {
  843. items {
  844. ...TaxRate
  845. }
  846. totalItems
  847. }
  848. }
  849. ${TAX_RATE_FRAGMENT}
  850. `;
  851. export const GET_SHIPPING_METHOD_LIST = gql`
  852. query GetShippingMethodList {
  853. shippingMethods {
  854. items {
  855. ...ShippingMethod
  856. }
  857. totalItems
  858. }
  859. }
  860. ${SHIPPING_METHOD_FRAGMENT}
  861. `;
  862. export const GET_COLLECTIONS = gql`
  863. query GetCollections {
  864. collections {
  865. items {
  866. id
  867. name
  868. position
  869. parent {
  870. id
  871. name
  872. }
  873. }
  874. }
  875. }
  876. `;