shared-definitions.ts 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135
  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_VALUE_FRAGMENT,
  12. FACET_WITH_VALUES_FRAGMENT,
  13. FULFILLMENT_FRAGMENT,
  14. GLOBAL_SETTINGS_FRAGMENT,
  15. ORDER_FRAGMENT,
  16. ORDER_WITH_LINES_FRAGMENT,
  17. PAYMENT_FRAGMENT,
  18. PRODUCT_OPTION_GROUP_FRAGMENT,
  19. PRODUCT_VARIANT_FRAGMENT,
  20. PRODUCT_WITH_OPTIONS_FRAGMENT,
  21. PRODUCT_WITH_VARIANTS_FRAGMENT,
  22. PROMOTION_FRAGMENT,
  23. ROLE_FRAGMENT,
  24. SHIPPING_METHOD_FRAGMENT,
  25. TAX_RATE_FRAGMENT,
  26. VARIANT_WITH_STOCK_FRAGMENT,
  27. } from './fragments';
  28. export const CREATE_ADMINISTRATOR = gql`
  29. mutation CreateAdministrator($input: CreateAdministratorInput!) {
  30. createAdministrator(input: $input) {
  31. ...Administrator
  32. }
  33. }
  34. ${ADMINISTRATOR_FRAGMENT}
  35. `;
  36. export const UPDATE_PRODUCT = gql`
  37. mutation UpdateProduct($input: UpdateProductInput!) {
  38. updateProduct(input: $input) {
  39. ...ProductWithVariants
  40. }
  41. }
  42. ${PRODUCT_WITH_VARIANTS_FRAGMENT}
  43. `;
  44. export const CREATE_PRODUCT = gql`
  45. mutation CreateProduct($input: CreateProductInput!) {
  46. createProduct(input: $input) {
  47. ...ProductWithVariants
  48. }
  49. }
  50. ${PRODUCT_WITH_VARIANTS_FRAGMENT}
  51. `;
  52. export const GET_PRODUCT_WITH_VARIANTS = gql`
  53. query GetProductWithVariants($id: ID, $slug: String) {
  54. product(slug: $slug, id: $id) {
  55. ...ProductWithVariants
  56. }
  57. }
  58. ${PRODUCT_WITH_VARIANTS_FRAGMENT}
  59. `;
  60. export const GET_PRODUCT_LIST = gql`
  61. query GetProductList($options: ProductListOptions) {
  62. products(options: $options) {
  63. items {
  64. id
  65. languageCode
  66. name
  67. slug
  68. featuredAsset {
  69. id
  70. preview
  71. }
  72. }
  73. totalItems
  74. }
  75. }
  76. `;
  77. export const CREATE_PRODUCT_VARIANTS = gql`
  78. mutation CreateProductVariants($input: [CreateProductVariantInput!]!) {
  79. createProductVariants(input: $input) {
  80. ...ProductVariant
  81. }
  82. }
  83. ${PRODUCT_VARIANT_FRAGMENT}
  84. `;
  85. export const UPDATE_PRODUCT_VARIANTS = gql`
  86. mutation UpdateProductVariants($input: [UpdateProductVariantInput!]!) {
  87. updateProductVariants(input: $input) {
  88. ...ProductVariant
  89. }
  90. }
  91. ${PRODUCT_VARIANT_FRAGMENT}
  92. `;
  93. export const UPDATE_TAX_RATE = gql`
  94. mutation UpdateTaxRate($input: UpdateTaxRateInput!) {
  95. updateTaxRate(input: $input) {
  96. ...TaxRate
  97. }
  98. }
  99. ${TAX_RATE_FRAGMENT}
  100. `;
  101. export const CREATE_FACET = gql`
  102. mutation CreateFacet($input: CreateFacetInput!) {
  103. createFacet(input: $input) {
  104. ...FacetWithValues
  105. }
  106. }
  107. ${FACET_WITH_VALUES_FRAGMENT}
  108. `;
  109. export const UPDATE_FACET = gql`
  110. mutation UpdateFacet($input: UpdateFacetInput!) {
  111. updateFacet(input: $input) {
  112. ...FacetWithValues
  113. }
  114. }
  115. ${FACET_WITH_VALUES_FRAGMENT}
  116. `;
  117. export const CREATE_FACET_VALUE = gql`
  118. mutation CreateFacetValue($input: CreateFacetValueInput!) {
  119. createFacetValue(input: $input) {
  120. ...FacetValue
  121. }
  122. }
  123. ${FACET_VALUE_FRAGMENT}
  124. `;
  125. export const UPDATE_FACET_VALUE = gql`
  126. mutation UpdateFacetValue($input: UpdateFacetValueInput!) {
  127. updateFacetValue(input: $input) {
  128. ...FacetValue
  129. }
  130. }
  131. ${FACET_VALUE_FRAGMENT}
  132. `;
  133. export const GET_CUSTOMER_LIST = gql`
  134. query GetCustomerList($options: CustomerListOptions) {
  135. customers(options: $options) {
  136. items {
  137. id
  138. title
  139. firstName
  140. lastName
  141. emailAddress
  142. phoneNumber
  143. user {
  144. id
  145. identifier
  146. verified
  147. }
  148. }
  149. totalItems
  150. }
  151. }
  152. `;
  153. export const GET_ASSET_LIST = gql`
  154. query GetAssetList($options: AssetListOptions) {
  155. assets(options: $options) {
  156. items {
  157. ...Asset
  158. }
  159. totalItems
  160. }
  161. }
  162. ${ASSET_FRAGMENT}
  163. `;
  164. export const CREATE_ROLE = gql`
  165. mutation CreateRole($input: CreateRoleInput!) {
  166. createRole(input: $input) {
  167. ...Role
  168. }
  169. }
  170. ${ROLE_FRAGMENT}
  171. `;
  172. export const CREATE_COLLECTION = gql`
  173. mutation CreateCollection($input: CreateCollectionInput!) {
  174. createCollection(input: $input) {
  175. ...Collection
  176. }
  177. }
  178. ${COLLECTION_FRAGMENT}
  179. `;
  180. export const UPDATE_COLLECTION = gql`
  181. mutation UpdateCollection($input: UpdateCollectionInput!) {
  182. updateCollection(input: $input) {
  183. ...Collection
  184. }
  185. }
  186. ${COLLECTION_FRAGMENT}
  187. `;
  188. export const GET_CUSTOMER = gql`
  189. query GetCustomer($id: ID!, $orderListOptions: OrderListOptions) {
  190. customer(id: $id) {
  191. ...Customer
  192. orders(options: $orderListOptions) {
  193. items {
  194. id
  195. code
  196. state
  197. total
  198. currencyCode
  199. updatedAt
  200. }
  201. totalItems
  202. }
  203. }
  204. }
  205. ${CUSTOMER_FRAGMENT}
  206. `;
  207. export const ATTEMPT_LOGIN = gql`
  208. mutation AttemptLogin($username: String!, $password: String!, $rememberMe: Boolean) {
  209. login(username: $username, password: $password, rememberMe: $rememberMe) {
  210. ...CurrentUser
  211. ... on ErrorResult {
  212. errorCode
  213. message
  214. }
  215. }
  216. }
  217. ${CURRENT_USER_FRAGMENT}
  218. `;
  219. export const GET_COUNTRY_LIST = gql`
  220. query GetCountryList($options: CountryListOptions) {
  221. countries(options: $options) {
  222. items {
  223. id
  224. code
  225. name
  226. enabled
  227. }
  228. totalItems
  229. }
  230. }
  231. `;
  232. export const UPDATE_COUNTRY = gql`
  233. mutation UpdateCountry($input: UpdateCountryInput!) {
  234. updateCountry(input: $input) {
  235. ...Country
  236. }
  237. }
  238. ${COUNTRY_FRAGMENT}
  239. `;
  240. export const GET_FACET_LIST = gql`
  241. query GetFacetList($options: FacetListOptions) {
  242. facets(options: $options) {
  243. items {
  244. ...FacetWithValues
  245. }
  246. totalItems
  247. }
  248. }
  249. ${FACET_WITH_VALUES_FRAGMENT}
  250. `;
  251. export const GET_FACET_LIST_SIMPLE = gql`
  252. query GetFacetListSimple($options: FacetListOptions) {
  253. facets(options: $options) {
  254. items {
  255. id
  256. name
  257. }
  258. totalItems
  259. }
  260. }
  261. `;
  262. export const DELETE_PRODUCT = gql`
  263. mutation DeleteProduct($id: ID!) {
  264. deleteProduct(id: $id) {
  265. result
  266. }
  267. }
  268. `;
  269. export const GET_PRODUCT_SIMPLE = gql`
  270. query GetProductSimple($id: ID, $slug: String) {
  271. product(slug: $slug, id: $id) {
  272. id
  273. slug
  274. }
  275. }
  276. `;
  277. export const GET_STOCK_MOVEMENT = gql`
  278. query GetStockMovement($id: ID!) {
  279. product(id: $id) {
  280. id
  281. variants {
  282. ...VariantWithStock
  283. }
  284. }
  285. }
  286. ${VARIANT_WITH_STOCK_FRAGMENT}
  287. `;
  288. export const GET_STOCK_MOVEMENT_BY_TYPE = gql`
  289. query GetStockMovementByType($id: ID!, $type: StockMovementType!) {
  290. product(id: $id) {
  291. id
  292. variants {
  293. stockMovements(options: { type: $type }) {
  294. items {
  295. ... on StockMovement {
  296. id
  297. type
  298. quantity
  299. }
  300. }
  301. totalItems
  302. }
  303. }
  304. }
  305. }
  306. `;
  307. export const GET_RUNNING_JOBS = gql`
  308. query GetRunningJobs($options: JobListOptions) {
  309. jobs(options: $options) {
  310. items {
  311. id
  312. queueName
  313. state
  314. isSettled
  315. duration
  316. }
  317. totalItems
  318. }
  319. }
  320. `;
  321. export const CREATE_PROMOTION = gql`
  322. mutation CreatePromotion($input: CreatePromotionInput!) {
  323. createPromotion(input: $input) {
  324. ...Promotion
  325. ... on ErrorResult {
  326. errorCode
  327. message
  328. }
  329. }
  330. }
  331. ${PROMOTION_FRAGMENT}
  332. `;
  333. export const ME = gql`
  334. query Me {
  335. me {
  336. ...CurrentUser
  337. }
  338. }
  339. ${CURRENT_USER_FRAGMENT}
  340. `;
  341. export const CREATE_CHANNEL = gql`
  342. mutation CreateChannel($input: CreateChannelInput!) {
  343. createChannel(input: $input) {
  344. ...Channel
  345. ... on LanguageNotAvailableError {
  346. errorCode
  347. message
  348. languageCode
  349. }
  350. }
  351. }
  352. ${CHANNEL_FRAGMENT}
  353. `;
  354. export const DELETE_PRODUCT_VARIANT = gql`
  355. mutation DeleteProductVariant($id: ID!) {
  356. deleteProductVariant(id: $id) {
  357. result
  358. message
  359. }
  360. }
  361. `;
  362. export const ASSIGN_PRODUCT_TO_CHANNEL = gql`
  363. mutation AssignProductsToChannel($input: AssignProductsToChannelInput!) {
  364. assignProductsToChannel(input: $input) {
  365. ...ProductWithVariants
  366. }
  367. }
  368. ${PRODUCT_WITH_VARIANTS_FRAGMENT}
  369. `;
  370. export const REMOVE_PRODUCT_FROM_CHANNEL = gql`
  371. mutation RemoveProductsFromChannel($input: RemoveProductsFromChannelInput!) {
  372. removeProductsFromChannel(input: $input) {
  373. ...ProductWithVariants
  374. }
  375. }
  376. ${PRODUCT_WITH_VARIANTS_FRAGMENT}
  377. `;
  378. export const ASSIGN_PRODUCTVARIANT_TO_CHANNEL = gql`
  379. mutation AssignProductVariantsToChannel($input: AssignProductVariantsToChannelInput!) {
  380. assignProductVariantsToChannel(input: $input) {
  381. ...ProductVariant
  382. }
  383. }
  384. ${PRODUCT_VARIANT_FRAGMENT}
  385. `;
  386. export const REMOVE_PRODUCTVARIANT_FROM_CHANNEL = gql`
  387. mutation RemoveProductVariantsFromChannel($input: RemoveProductVariantsFromChannelInput!) {
  388. removeProductVariantsFromChannel(input: $input) {
  389. ...ProductVariant
  390. }
  391. }
  392. ${PRODUCT_VARIANT_FRAGMENT}
  393. `;
  394. export const UPDATE_ASSET = gql`
  395. mutation UpdateAsset($input: UpdateAssetInput!) {
  396. updateAsset(input: $input) {
  397. ...Asset
  398. ... on Asset {
  399. tags {
  400. id
  401. value
  402. }
  403. focalPoint {
  404. x
  405. y
  406. }
  407. }
  408. }
  409. }
  410. ${ASSET_FRAGMENT}
  411. `;
  412. export const DELETE_ASSET = gql`
  413. mutation DeleteAsset($input: DeleteAssetInput!) {
  414. deleteAsset(input: $input) {
  415. result
  416. message
  417. }
  418. }
  419. `;
  420. export const UPDATE_CHANNEL = gql`
  421. mutation UpdateChannel($input: UpdateChannelInput!) {
  422. updateChannel(input: $input) {
  423. ...Channel
  424. ... on LanguageNotAvailableError {
  425. errorCode
  426. message
  427. languageCode
  428. }
  429. }
  430. }
  431. ${CHANNEL_FRAGMENT}
  432. `;
  433. export const GET_CUSTOMER_HISTORY = gql`
  434. query GetCustomerHistory($id: ID!, $options: HistoryEntryListOptions) {
  435. customer(id: $id) {
  436. id
  437. history(options: $options) {
  438. totalItems
  439. items {
  440. id
  441. administrator {
  442. id
  443. }
  444. type
  445. data
  446. }
  447. }
  448. }
  449. }
  450. `;
  451. export const GET_ORDER = gql`
  452. query GetOrder($id: ID!) {
  453. order(id: $id) {
  454. ...OrderWithLines
  455. }
  456. }
  457. ${ORDER_WITH_LINES_FRAGMENT}
  458. `;
  459. export const CREATE_CUSTOMER_GROUP = gql`
  460. mutation CreateCustomerGroup($input: CreateCustomerGroupInput!) {
  461. createCustomerGroup(input: $input) {
  462. ...CustomerGroup
  463. }
  464. }
  465. ${CUSTOMER_GROUP_FRAGMENT}
  466. `;
  467. export const REMOVE_CUSTOMERS_FROM_GROUP = gql`
  468. mutation RemoveCustomersFromGroup($groupId: ID!, $customerIds: [ID!]!) {
  469. removeCustomersFromGroup(customerGroupId: $groupId, customerIds: $customerIds) {
  470. ...CustomerGroup
  471. }
  472. }
  473. ${CUSTOMER_GROUP_FRAGMENT}
  474. `;
  475. export const CREATE_FULFILLMENT = gql`
  476. mutation CreateFulfillment($input: FulfillOrderInput!) {
  477. addFulfillmentToOrder(input: $input) {
  478. ...Fulfillment
  479. ... on ErrorResult {
  480. errorCode
  481. message
  482. }
  483. ... on CreateFulfillmentError {
  484. fulfillmentHandlerError
  485. }
  486. }
  487. }
  488. ${FULFILLMENT_FRAGMENT}
  489. `;
  490. export const TRANSIT_FULFILLMENT = gql`
  491. mutation TransitFulfillment($id: ID!, $state: String!) {
  492. transitionFulfillmentToState(id: $id, state: $state) {
  493. ...Fulfillment
  494. ... on FulfillmentStateTransitionError {
  495. errorCode
  496. message
  497. transitionError
  498. fromState
  499. toState
  500. }
  501. }
  502. }
  503. ${FULFILLMENT_FRAGMENT}
  504. `;
  505. export const GET_ORDER_FULFILLMENTS = gql`
  506. query GetOrderFulfillments($id: ID!) {
  507. order(id: $id) {
  508. id
  509. state
  510. fulfillments {
  511. id
  512. state
  513. nextStates
  514. method
  515. summary {
  516. orderLine {
  517. id
  518. }
  519. quantity
  520. }
  521. }
  522. }
  523. }
  524. `;
  525. export const GET_ORDERS_LIST = gql`
  526. query GetOrderList($options: OrderListOptions) {
  527. orders(options: $options) {
  528. items {
  529. ...Order
  530. }
  531. totalItems
  532. }
  533. }
  534. ${ORDER_FRAGMENT}
  535. `;
  536. export const CREATE_ADDRESS = gql`
  537. mutation CreateAddress($id: ID!, $input: CreateAddressInput!) {
  538. createCustomerAddress(customerId: $id, input: $input) {
  539. id
  540. fullName
  541. company
  542. streetLine1
  543. streetLine2
  544. city
  545. province
  546. postalCode
  547. country {
  548. code
  549. name
  550. }
  551. phoneNumber
  552. defaultShippingAddress
  553. defaultBillingAddress
  554. }
  555. }
  556. `;
  557. export const UPDATE_ADDRESS = gql`
  558. mutation UpdateAddress($input: UpdateAddressInput!) {
  559. updateCustomerAddress(input: $input) {
  560. id
  561. defaultShippingAddress
  562. defaultBillingAddress
  563. country {
  564. code
  565. name
  566. }
  567. }
  568. }
  569. `;
  570. export const CREATE_CUSTOMER = gql`
  571. mutation CreateCustomer($input: CreateCustomerInput!, $password: String) {
  572. createCustomer(input: $input, password: $password) {
  573. ...Customer
  574. ... on ErrorResult {
  575. errorCode
  576. message
  577. }
  578. }
  579. }
  580. ${CUSTOMER_FRAGMENT}
  581. `;
  582. export const UPDATE_CUSTOMER = gql`
  583. mutation UpdateCustomer($input: UpdateCustomerInput!) {
  584. updateCustomer(input: $input) {
  585. ...Customer
  586. ... on ErrorResult {
  587. errorCode
  588. message
  589. }
  590. }
  591. }
  592. ${CUSTOMER_FRAGMENT}
  593. `;
  594. export const DELETE_CUSTOMER = gql`
  595. mutation DeleteCustomer($id: ID!) {
  596. deleteCustomer(id: $id) {
  597. result
  598. }
  599. }
  600. `;
  601. export const UPDATE_CUSTOMER_NOTE = gql`
  602. mutation UpdateCustomerNote($input: UpdateCustomerNoteInput!) {
  603. updateCustomerNote(input: $input) {
  604. id
  605. data
  606. isPublic
  607. }
  608. }
  609. `;
  610. export const DELETE_CUSTOMER_NOTE = gql`
  611. mutation DeleteCustomerNote($id: ID!) {
  612. deleteCustomerNote(id: $id) {
  613. result
  614. message
  615. }
  616. }
  617. `;
  618. export const UPDATE_CUSTOMER_GROUP = gql`
  619. mutation UpdateCustomerGroup($input: UpdateCustomerGroupInput!) {
  620. updateCustomerGroup(input: $input) {
  621. ...CustomerGroup
  622. }
  623. }
  624. ${CUSTOMER_GROUP_FRAGMENT}
  625. `;
  626. export const DELETE_CUSTOMER_GROUP = gql`
  627. mutation DeleteCustomerGroup($id: ID!) {
  628. deleteCustomerGroup(id: $id) {
  629. result
  630. message
  631. }
  632. }
  633. `;
  634. export const GET_CUSTOMER_GROUPS = gql`
  635. query GetCustomerGroups($options: CustomerGroupListOptions) {
  636. customerGroups(options: $options) {
  637. items {
  638. id
  639. name
  640. }
  641. totalItems
  642. }
  643. }
  644. `;
  645. export const GET_CUSTOMER_GROUP = gql`
  646. query GetCustomerGroup($id: ID!, $options: CustomerListOptions) {
  647. customerGroup(id: $id) {
  648. id
  649. name
  650. customers(options: $options) {
  651. items {
  652. id
  653. }
  654. totalItems
  655. }
  656. }
  657. }
  658. `;
  659. export const ADD_CUSTOMERS_TO_GROUP = gql`
  660. mutation AddCustomersToGroup($groupId: ID!, $customerIds: [ID!]!) {
  661. addCustomersToGroup(customerGroupId: $groupId, customerIds: $customerIds) {
  662. ...CustomerGroup
  663. }
  664. }
  665. ${CUSTOMER_GROUP_FRAGMENT}
  666. `;
  667. export const GET_CUSTOMER_WITH_GROUPS = gql`
  668. query GetCustomerWithGroups($id: ID!) {
  669. customer(id: $id) {
  670. id
  671. groups {
  672. id
  673. name
  674. }
  675. }
  676. }
  677. `;
  678. export const ADMIN_TRANSITION_TO_STATE = gql`
  679. mutation AdminTransition($id: ID!, $state: String!) {
  680. transitionOrderToState(id: $id, state: $state) {
  681. ...Order
  682. ... on OrderStateTransitionError {
  683. errorCode
  684. message
  685. transitionError
  686. fromState
  687. toState
  688. }
  689. }
  690. }
  691. ${ORDER_FRAGMENT}
  692. `;
  693. export const CANCEL_ORDER = gql`
  694. mutation CancelOrder($input: CancelOrderInput!) {
  695. cancelOrder(input: $input) {
  696. ...CanceledOrder
  697. ... on ErrorResult {
  698. errorCode
  699. message
  700. }
  701. }
  702. }
  703. fragment CanceledOrder on Order {
  704. id
  705. state
  706. lines {
  707. id
  708. quantity
  709. }
  710. }
  711. `;
  712. export const UPDATE_GLOBAL_SETTINGS = gql`
  713. mutation UpdateGlobalSettings($input: UpdateGlobalSettingsInput!) {
  714. updateGlobalSettings(input: $input) {
  715. ...GlobalSettings
  716. ... on ErrorResult {
  717. errorCode
  718. message
  719. }
  720. }
  721. }
  722. ${GLOBAL_SETTINGS_FRAGMENT}
  723. `;
  724. export const UPDATE_ROLE = gql`
  725. mutation UpdateRole($input: UpdateRoleInput!) {
  726. updateRole(input: $input) {
  727. ...Role
  728. }
  729. }
  730. ${ROLE_FRAGMENT}
  731. `;
  732. export const GET_PRODUCTS_WITH_VARIANT_PRICES = gql`
  733. query GetProductsWithVariantPrices {
  734. products {
  735. items {
  736. id
  737. slug
  738. variants {
  739. id
  740. price
  741. priceWithTax
  742. currencyCode
  743. sku
  744. facetValues {
  745. id
  746. code
  747. }
  748. }
  749. }
  750. }
  751. }
  752. `;
  753. export const CREATE_PRODUCT_OPTION_GROUP = gql`
  754. mutation CreateProductOptionGroup($input: CreateProductOptionGroupInput!) {
  755. createProductOptionGroup(input: $input) {
  756. ...ProductOptionGroup
  757. }
  758. }
  759. ${PRODUCT_OPTION_GROUP_FRAGMENT}
  760. `;
  761. export const ADD_OPTION_GROUP_TO_PRODUCT = gql`
  762. mutation AddOptionGroupToProduct($productId: ID!, $optionGroupId: ID!) {
  763. addOptionGroupToProduct(productId: $productId, optionGroupId: $optionGroupId) {
  764. ...ProductWithOptions
  765. }
  766. }
  767. ${PRODUCT_WITH_OPTIONS_FRAGMENT}
  768. `;
  769. export const CREATE_SHIPPING_METHOD = gql`
  770. mutation CreateShippingMethod($input: CreateShippingMethodInput!) {
  771. createShippingMethod(input: $input) {
  772. ...ShippingMethod
  773. }
  774. }
  775. ${SHIPPING_METHOD_FRAGMENT}
  776. `;
  777. export const SETTLE_PAYMENT = gql`
  778. mutation SettlePayment($id: ID!) {
  779. settlePayment(id: $id) {
  780. ...Payment
  781. ... on ErrorResult {
  782. errorCode
  783. message
  784. }
  785. ... on SettlePaymentError {
  786. paymentErrorMessage
  787. }
  788. }
  789. }
  790. ${PAYMENT_FRAGMENT}
  791. `;
  792. export const GET_ORDER_HISTORY = gql`
  793. query GetOrderHistory($id: ID!, $options: HistoryEntryListOptions) {
  794. order(id: $id) {
  795. id
  796. history(options: $options) {
  797. totalItems
  798. items {
  799. id
  800. type
  801. administrator {
  802. id
  803. }
  804. data
  805. }
  806. }
  807. }
  808. }
  809. `;
  810. export const UPDATE_SHIPPING_METHOD = gql`
  811. mutation UpdateShippingMethod($input: UpdateShippingMethodInput!) {
  812. updateShippingMethod(input: $input) {
  813. ...ShippingMethod
  814. }
  815. }
  816. ${SHIPPING_METHOD_FRAGMENT}
  817. `;
  818. export const GET_ASSET = gql`
  819. query GetAsset($id: ID!) {
  820. asset(id: $id) {
  821. ...Asset
  822. width
  823. height
  824. }
  825. }
  826. ${ASSET_FRAGMENT}
  827. `;
  828. export const GET_ASSET_FRAGMENT_FIRST = gql`
  829. fragment AssetFragFirst on Asset {
  830. id
  831. preview
  832. }
  833. query GetAssetFragmentFirst($id: ID!) {
  834. asset(id: $id) {
  835. ...AssetFragFirst
  836. }
  837. }
  838. `;
  839. export const ASSET_WITH_TAGS_AND_FOCAL_POINT_FRAGMENT = gql`
  840. fragment AssetWithTagsAndFocalPoint on Asset {
  841. ...Asset
  842. focalPoint {
  843. x
  844. y
  845. }
  846. tags {
  847. id
  848. value
  849. }
  850. }
  851. ${ASSET_FRAGMENT}
  852. `;
  853. export const CREATE_ASSETS = gql`
  854. mutation CreateAssets($input: [CreateAssetInput!]!) {
  855. createAssets(input: $input) {
  856. ...AssetWithTagsAndFocalPoint
  857. ... on MimeTypeError {
  858. message
  859. fileName
  860. mimeType
  861. }
  862. }
  863. }
  864. ${ASSET_WITH_TAGS_AND_FOCAL_POINT_FRAGMENT}
  865. `;
  866. export const DELETE_SHIPPING_METHOD = gql`
  867. mutation DeleteShippingMethod($id: ID!) {
  868. deleteShippingMethod(id: $id) {
  869. result
  870. message
  871. }
  872. }
  873. `;
  874. export const ASSIGN_PROMOTIONS_TO_CHANNEL = gql`
  875. mutation AssignPromotionToChannel($input: AssignPromotionsToChannelInput!) {
  876. assignPromotionsToChannel(input: $input) {
  877. id
  878. name
  879. }
  880. }
  881. `;
  882. export const REMOVE_PROMOTIONS_FROM_CHANNEL = gql`
  883. mutation RemovePromotionFromChannel($input: RemovePromotionsFromChannelInput!) {
  884. removePromotionsFromChannel(input: $input) {
  885. id
  886. name
  887. }
  888. }
  889. `;
  890. export const GET_TAX_RATES_LIST = gql`
  891. query GetTaxRates($options: TaxRateListOptions) {
  892. taxRates(options: $options) {
  893. items {
  894. ...TaxRate
  895. }
  896. totalItems
  897. }
  898. }
  899. ${TAX_RATE_FRAGMENT}
  900. `;
  901. export const GET_SHIPPING_METHOD_LIST = gql`
  902. query GetShippingMethodList {
  903. shippingMethods {
  904. items {
  905. ...ShippingMethod
  906. }
  907. totalItems
  908. }
  909. }
  910. ${SHIPPING_METHOD_FRAGMENT}
  911. `;
  912. export const GET_COLLECTIONS = gql`
  913. query GetCollections {
  914. collections {
  915. items {
  916. id
  917. name
  918. position
  919. parent {
  920. id
  921. name
  922. }
  923. }
  924. }
  925. }
  926. `;
  927. export const TRANSITION_PAYMENT_TO_STATE = gql`
  928. mutation TransitionPaymentToState($id: ID!, $state: String!) {
  929. transitionPaymentToState(id: $id, state: $state) {
  930. ...Payment
  931. ... on ErrorResult {
  932. errorCode
  933. message
  934. }
  935. ... on PaymentStateTransitionError {
  936. transitionError
  937. }
  938. }
  939. }
  940. ${PAYMENT_FRAGMENT}
  941. `;
  942. export const GET_PRODUCT_VARIANT_LIST = gql`
  943. query GetProductVariantList($options: ProductVariantListOptions, $productId: ID) {
  944. productVariants(options: $options, productId: $productId) {
  945. items {
  946. id
  947. name
  948. sku
  949. price
  950. priceWithTax
  951. currencyCode
  952. prices {
  953. currencyCode
  954. price
  955. }
  956. }
  957. totalItems
  958. }
  959. }
  960. `;
  961. export const DELETE_PROMOTION = gql`
  962. mutation DeletePromotion($id: ID!) {
  963. deletePromotion(id: $id) {
  964. result
  965. }
  966. }
  967. `;
  968. export const GET_CHANNELS = gql`
  969. query GetChannels {
  970. channels {
  971. items {
  972. id
  973. code
  974. token
  975. }
  976. }
  977. }
  978. `;
  979. export const UPDATE_ADMINISTRATOR = gql`
  980. mutation UpdateAdministrator($input: UpdateAdministratorInput!) {
  981. updateAdministrator(input: $input) {
  982. ...Administrator
  983. }
  984. }
  985. ${ADMINISTRATOR_FRAGMENT}
  986. `;
  987. export const ASSIGN_COLLECTIONS_TO_CHANNEL = gql`
  988. mutation AssignCollectionsToChannel($input: AssignCollectionsToChannelInput!) {
  989. assignCollectionsToChannel(input: $input) {
  990. ...Collection
  991. }
  992. }
  993. ${COLLECTION_FRAGMENT}
  994. `;
  995. export const GET_COLLECTION = gql`
  996. query GetCollection($id: ID, $slug: String, $variantListOptions: ProductVariantListOptions) {
  997. collection(id: $id, slug: $slug) {
  998. ...Collection
  999. productVariants(options: $variantListOptions) {
  1000. items {
  1001. id
  1002. name
  1003. price
  1004. }
  1005. }
  1006. }
  1007. }
  1008. ${COLLECTION_FRAGMENT}
  1009. `;
  1010. export const GET_FACET_WITH_VALUES = gql`
  1011. query GetFacetWithValues($id: ID!) {
  1012. facet(id: $id) {
  1013. ...FacetWithValues
  1014. }
  1015. }
  1016. ${FACET_WITH_VALUES_FRAGMENT}
  1017. `;
  1018. export const GET_FACET_VALUES = gql`
  1019. query GetFacetValues($options: FacetValueListOptions) {
  1020. facetValues(options: $options) {
  1021. items {
  1022. ...FacetValue
  1023. }
  1024. totalItems
  1025. }
  1026. }
  1027. ${FACET_VALUE_FRAGMENT}
  1028. `;
  1029. export const GET_FACET_VALUE = gql`
  1030. query GetFacetValue($id: ID!) {
  1031. facetValue(id: $id) {
  1032. ...FacetValue
  1033. }
  1034. }
  1035. ${FACET_VALUE_FRAGMENT}
  1036. `;
  1037. export const GET_PROMOTION = gql`
  1038. query GetPromotion($id: ID!) {
  1039. promotion(id: $id) {
  1040. ...Promotion
  1041. }
  1042. }
  1043. ${PROMOTION_FRAGMENT}
  1044. `;