shared-definitions.ts 23 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016
  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. `;
  899. export const GET_PRODUCT_VARIANT_LIST = gql`
  900. query GetProductVariantLIST($options: ProductVariantListOptions, $productId: ID) {
  901. productVariants(options: $options, productId: $productId) {
  902. items {
  903. id
  904. name
  905. sku
  906. price
  907. priceWithTax
  908. }
  909. totalItems
  910. }
  911. }
  912. `;
  913. export const DELETE_PROMOTION = gql`
  914. mutation DeletePromotion($id: ID!) {
  915. deletePromotion(id: $id) {
  916. result
  917. }
  918. }
  919. `;
  920. export const GET_CHANNELS = gql`
  921. query GetChannels {
  922. channels {
  923. id
  924. code
  925. token
  926. }
  927. }
  928. `;
  929. export const UPDATE_ADMINISTRATOR = gql`
  930. mutation UpdateAdministrator($input: UpdateAdministratorInput!) {
  931. updateAdministrator(input: $input) {
  932. ...Administrator
  933. }
  934. }
  935. ${ADMINISTRATOR_FRAGMENT}
  936. `;