@shopify/hydrogen-react 2022.10.4 → 2022.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/browser-dev/CartProvider.mjs +5 -109
  2. package/dist/browser-dev/CartProvider.mjs.map +1 -1
  3. package/dist/browser-dev/Money.mjs.map +1 -1
  4. package/dist/browser-dev/cart-queries.mjs +207 -59
  5. package/dist/browser-dev/cart-queries.mjs.map +1 -1
  6. package/dist/browser-dev/storefront-client.mjs +12 -5
  7. package/dist/browser-dev/storefront-client.mjs.map +1 -1
  8. package/dist/browser-dev/useCartAPIStateMachine.mjs +6 -3
  9. package/dist/browser-dev/useCartAPIStateMachine.mjs.map +1 -1
  10. package/dist/browser-prod/CartProvider.mjs +5 -109
  11. package/dist/browser-prod/CartProvider.mjs.map +1 -1
  12. package/dist/browser-prod/Money.mjs.map +1 -1
  13. package/dist/browser-prod/cart-queries.mjs +207 -59
  14. package/dist/browser-prod/cart-queries.mjs.map +1 -1
  15. package/dist/browser-prod/storefront-client.mjs +8 -1
  16. package/dist/browser-prod/storefront-client.mjs.map +1 -1
  17. package/dist/browser-prod/useCartAPIStateMachine.mjs +6 -3
  18. package/dist/browser-prod/useCartAPIStateMachine.mjs.map +1 -1
  19. package/dist/node-dev/CartProvider.js +6 -110
  20. package/dist/node-dev/CartProvider.js.map +1 -1
  21. package/dist/node-dev/CartProvider.mjs +5 -109
  22. package/dist/node-dev/CartProvider.mjs.map +1 -1
  23. package/dist/node-dev/Money.js.map +1 -1
  24. package/dist/node-dev/Money.mjs.map +1 -1
  25. package/dist/node-dev/cart-queries.js +206 -58
  26. package/dist/node-dev/cart-queries.js.map +1 -1
  27. package/dist/node-dev/cart-queries.mjs +207 -59
  28. package/dist/node-dev/cart-queries.mjs.map +1 -1
  29. package/dist/node-dev/storefront-client.js +12 -5
  30. package/dist/node-dev/storefront-client.js.map +1 -1
  31. package/dist/node-dev/storefront-client.mjs +12 -5
  32. package/dist/node-dev/storefront-client.mjs.map +1 -1
  33. package/dist/node-dev/useCartAPIStateMachine.js +6 -3
  34. package/dist/node-dev/useCartAPIStateMachine.js.map +1 -1
  35. package/dist/node-dev/useCartAPIStateMachine.mjs +6 -3
  36. package/dist/node-dev/useCartAPIStateMachine.mjs.map +1 -1
  37. package/dist/node-prod/CartProvider.js +6 -110
  38. package/dist/node-prod/CartProvider.js.map +1 -1
  39. package/dist/node-prod/CartProvider.mjs +5 -109
  40. package/dist/node-prod/CartProvider.mjs.map +1 -1
  41. package/dist/node-prod/Money.js.map +1 -1
  42. package/dist/node-prod/Money.mjs.map +1 -1
  43. package/dist/node-prod/cart-queries.js +206 -58
  44. package/dist/node-prod/cart-queries.js.map +1 -1
  45. package/dist/node-prod/cart-queries.mjs +207 -59
  46. package/dist/node-prod/cart-queries.mjs.map +1 -1
  47. package/dist/node-prod/storefront-client.js +8 -1
  48. package/dist/node-prod/storefront-client.js.map +1 -1
  49. package/dist/node-prod/storefront-client.mjs +8 -1
  50. package/dist/node-prod/storefront-client.mjs.map +1 -1
  51. package/dist/node-prod/useCartAPIStateMachine.js +6 -3
  52. package/dist/node-prod/useCartAPIStateMachine.js.map +1 -1
  53. package/dist/node-prod/useCartAPIStateMachine.mjs +6 -3
  54. package/dist/node-prod/useCartAPIStateMachine.mjs.map +1 -1
  55. package/dist/types/CartProvider.d.ts +0 -1
  56. package/dist/types/Money.d.ts +1 -1
  57. package/dist/types/cart-queries.d.ts +1 -1
  58. package/dist/umd/hydrogen-react.dev.js +228 -175
  59. package/dist/umd/hydrogen-react.dev.js.map +1 -1
  60. package/dist/umd/hydrogen-react.prod.js +200 -153
  61. package/dist/umd/hydrogen-react.prod.js.map +1 -1
  62. package/package.json +10 -14
@@ -1 +1 @@
1
- {"version":3,"file":"Money.mjs","sources":["../../src/Money.tsx"],"sourcesContent":["import {type ReactNode} from 'react';\nimport {useMoney} from './useMoney.js';\nimport type {MoneyV2, UnitPriceMeasurement} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\n\ninterface CustomProps<ComponentGeneric extends React.ElementType> {\n /** An HTML tag or React Component to be rendered as the base element wrapper. The default is `div`. */\n as?: ComponentGeneric;\n /** An object with fields that correspond to the Storefront API's [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2). */\n data: PartialDeep<MoneyV2, {recurseIntoArrays: true}>;\n /** Whether to remove the currency symbol from the output. */\n withoutCurrency?: boolean;\n /** Whether to remove trailing zeros (fractional money) from the output. */\n withoutTrailingZeros?: boolean;\n /** A [UnitPriceMeasurement object](https://shopify.dev/api/storefront/latest/objects/unitpricemeasurement). */\n measurement?: PartialDeep<UnitPriceMeasurement, {recurseIntoArrays: true}>;\n /** Customizes the separator between the money output and the measurement output. Used with the `measurement` prop. Defaults to `'/'`. */\n measurementSeparator?: ReactNode;\n}\n\n// This article helps understand the typing here https://www.benmvp.com/blog/polymorphic-react-components-typescript/ Ben is the best :)\nexport type MoneyProps<ComponentGeneric extends React.ElementType> =\n CustomProps<ComponentGeneric> &\n Omit<\n React.ComponentPropsWithoutRef<ComponentGeneric>,\n keyof CustomProps<ComponentGeneric>\n >;\n\n/**\n * The `Money` component renders a string of the Storefront API's\n * [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2) according to the\n * `locale` in the `ShopifyProvider` component.\n */\nexport function Money<ComponentGeneric extends React.ElementType>({\n data,\n as,\n withoutCurrency,\n withoutTrailingZeros,\n measurement,\n measurementSeparator = '/',\n ...passthroughProps\n}: MoneyProps<ComponentGeneric>) {\n if (!isMoney(data)) {\n throw new Error(\n `<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'`\n );\n }\n const moneyObject = useMoney(data);\n const Wrapper = as ?? 'div';\n\n let output = moneyObject.localizedString;\n\n if (withoutCurrency || withoutTrailingZeros) {\n if (withoutCurrency && !withoutTrailingZeros) {\n output = moneyObject.amount;\n } else if (!withoutCurrency && withoutTrailingZeros) {\n output = moneyObject.withoutTrailingZeros;\n } else {\n // both\n output = moneyObject.withoutTrailingZerosAndCurrency;\n }\n }\n\n return (\n <Wrapper {...passthroughProps}>\n {output}\n {measurement && measurement.referenceUnit && (\n <>\n {measurementSeparator}\n {measurement.referenceUnit}\n </>\n )}\n </Wrapper>\n );\n}\n\n// required in order to narrow the money object down and make TS happy\nfunction isMoney(\n maybeMoney: PartialDeep<MoneyV2, {recurseIntoArrays: true}>\n): maybeMoney is MoneyV2 {\n return (\n typeof maybeMoney.amount === 'string' &&\n !!maybeMoney.amount &&\n typeof maybeMoney.currencyCode === 'string' &&\n !!maybeMoney.currencyCode\n );\n}\n"],"names":["Money","data","as","withoutCurrency","withoutTrailingZeros","measurement","measurementSeparator","passthroughProps","isMoney","Error","moneyObject","useMoney","Wrapper","output","localizedString","amount","withoutTrailingZerosAndCurrency","referenceUnit","_Fragment","maybeMoney","currencyCode"],"mappings":";;AAiCO,SAASA,MAAkD;AAAA,EAChEC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,uBAAuB;AAAA,KACpBC;AACyB,GAAG;AAC3B,MAAA,CAACC,QAAQP,IAAI,GAAG;AACZ,UAAA,IAAIQ,MACP,yEAAwE;AAAA,EAE7E;AACMC,QAAAA,cAAcC,SAASV,IAAI;AACjC,QAAMW,UAAUV,kBAAM;AAEtB,MAAIW,SAASH,YAAYI;AAEzB,MAAIX,mBAAmBC,sBAAsB;AACvCD,QAAAA,mBAAmB,CAACC,sBAAsB;AAC5CS,eAASH,YAAYK;AAAAA,IAAAA,WACZ,CAACZ,mBAAmBC,sBAAsB;AACnDS,eAASH,YAAYN;AAAAA,IAAAA,OAChB;AAELS,eAASH,YAAYM;AAAAA,IACvB;AAAA,EACF;AAEA,8BACG,SAAO;AAAA,IAAA,GAAKT;AAAAA,IAAgB,UAAA,CAC1BM,QACAR,eAAeA,YAAYY,sCAC1BC,UAAA;AAAA,MAAA,UAAA,CACGZ,sBACAD,YAAYY,aAAa;AAAA,IAAA,CAE7B,CAAA;AAAA,EAAA,CACO;AAEd;AAGA,SAAST,QACPW,YACuB;AACvB,SACE,OAAOA,WAAWJ,WAAW,YAC7B,CAAC,CAACI,WAAWJ,UACb,OAAOI,WAAWC,iBAAiB,YACnC,CAAC,CAACD,WAAWC;AAEjB;"}
1
+ {"version":3,"file":"Money.mjs","sources":["../../src/Money.tsx"],"sourcesContent":["import {type ReactNode} from 'react';\nimport {useMoney} from './useMoney.js';\nimport type {MoneyV2, UnitPriceMeasurement} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\n\ninterface CustomProps<ComponentGeneric extends React.ElementType> {\n /** An HTML tag or React Component to be rendered as the base element wrapper. The default is `div`. */\n as?: ComponentGeneric;\n /** An object with fields that correspond to the Storefront API's [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2). */\n data: PartialDeep<MoneyV2, {recurseIntoArrays: true}>;\n /** Whether to remove the currency symbol from the output. */\n withoutCurrency?: boolean;\n /** Whether to remove trailing zeros (fractional money) from the output. */\n withoutTrailingZeros?: boolean;\n /** A [UnitPriceMeasurement object](https://shopify.dev/api/storefront/latest/objects/unitpricemeasurement). */\n measurement?: PartialDeep<UnitPriceMeasurement, {recurseIntoArrays: true}>;\n /** Customizes the separator between the money output and the measurement output. Used with the `measurement` prop. Defaults to `'/'`. */\n measurementSeparator?: ReactNode;\n}\n\n// This article helps understand the typing here https://www.benmvp.com/blog/polymorphic-react-components-typescript/ Ben is the best :)\nexport type MoneyProps<ComponentGeneric extends React.ElementType> =\n CustomProps<ComponentGeneric> &\n Omit<\n React.ComponentPropsWithoutRef<ComponentGeneric>,\n keyof CustomProps<ComponentGeneric>\n >;\n\n/**\n * The `Money` component renders a string of the Storefront API's\n * [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2) according to the\n * `locale` in the `ShopifyProvider` component.\n */\nexport function Money<ComponentGeneric extends React.ElementType = 'div'>({\n data,\n as,\n withoutCurrency,\n withoutTrailingZeros,\n measurement,\n measurementSeparator = '/',\n ...passthroughProps\n}: MoneyProps<ComponentGeneric>) {\n if (!isMoney(data)) {\n throw new Error(\n `<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'`\n );\n }\n const moneyObject = useMoney(data);\n const Wrapper = as ?? 'div';\n\n let output = moneyObject.localizedString;\n\n if (withoutCurrency || withoutTrailingZeros) {\n if (withoutCurrency && !withoutTrailingZeros) {\n output = moneyObject.amount;\n } else if (!withoutCurrency && withoutTrailingZeros) {\n output = moneyObject.withoutTrailingZeros;\n } else {\n // both\n output = moneyObject.withoutTrailingZerosAndCurrency;\n }\n }\n\n return (\n <Wrapper {...passthroughProps}>\n {output}\n {measurement && measurement.referenceUnit && (\n <>\n {measurementSeparator}\n {measurement.referenceUnit}\n </>\n )}\n </Wrapper>\n );\n}\n\n// required in order to narrow the money object down and make TS happy\nfunction isMoney(\n maybeMoney: PartialDeep<MoneyV2, {recurseIntoArrays: true}>\n): maybeMoney is MoneyV2 {\n return (\n typeof maybeMoney.amount === 'string' &&\n !!maybeMoney.amount &&\n typeof maybeMoney.currencyCode === 'string' &&\n !!maybeMoney.currencyCode\n );\n}\n"],"names":["Money","data","as","withoutCurrency","withoutTrailingZeros","measurement","measurementSeparator","passthroughProps","isMoney","Error","moneyObject","useMoney","Wrapper","output","localizedString","amount","withoutTrailingZerosAndCurrency","referenceUnit","_Fragment","maybeMoney","currencyCode"],"mappings":";;AAiCO,SAASA,MAA0D;AAAA,EACxEC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,uBAAuB;AAAA,KACpBC;AACyB,GAAG;AAC3B,MAAA,CAACC,QAAQP,IAAI,GAAG;AACZ,UAAA,IAAIQ,MACP,yEAAwE;AAAA,EAE7E;AACMC,QAAAA,cAAcC,SAASV,IAAI;AACjC,QAAMW,UAAUV,kBAAM;AAEtB,MAAIW,SAASH,YAAYI;AAEzB,MAAIX,mBAAmBC,sBAAsB;AACvCD,QAAAA,mBAAmB,CAACC,sBAAsB;AAC5CS,eAASH,YAAYK;AAAAA,IAAAA,WACZ,CAACZ,mBAAmBC,sBAAsB;AACnDS,eAASH,YAAYN;AAAAA,IAAAA,OAChB;AAELS,eAASH,YAAYM;AAAAA,IACvB;AAAA,EACF;AAEA,8BACG,SAAO;AAAA,IAAA,GAAKT;AAAAA,IAAgB,UAAA,CAC1BM,QACAR,eAAeA,YAAYY,sCAC1BC,UAAA;AAAA,MAAA,UAAA,CACGZ,sBACAD,YAAYY,aAAa;AAAA,IAAA,CAE7B,CAAA;AAAA,EAAA,CACO;AAEd;AAGA,SAAST,QACPW,YACuB;AACvB,SACE,OAAOA,WAAWJ,WAAW,YAC7B,CAAC,CAACI,WAAWJ,UACb,OAAOI,WAAWC,iBAAiB,YACnC,CAAC,CAACD,WAAWC;AAEjB;"}
@@ -1,106 +1,253 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const CartLineAdd = (cartFragment) => `
4
- mutation CartLineAdd($cartId: ID!, $lines: [CartLineInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
5
- cartLinesAdd(cartId: $cartId, lines: $lines) {
6
- cart {
7
- ...CartFragment
4
+ mutation CartLineAdd(
5
+ $cartId: ID!
6
+ $lines: [CartLineInput!]!
7
+ $numCartLines: Int = 250
8
+ $country: CountryCode = ZZ
9
+ ) @inContext(country: $country) {
10
+ cartLinesAdd(cartId: $cartId, lines: $lines) {
11
+ cart {
12
+ ...CartFragment
13
+ }
8
14
  }
9
15
  }
10
- }
11
16
 
12
- ${cartFragment}
17
+ ${cartFragment}
13
18
  `;
14
19
  const CartCreate = (cartFragment) => `
15
- mutation CartCreate($input: CartInput!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
16
- cartCreate(input: $input) {
17
- cart {
18
- ...CartFragment
20
+ mutation CartCreate(
21
+ $input: CartInput!
22
+ $numCartLines: Int = 250
23
+ $country: CountryCode = ZZ
24
+ ) @inContext(country: $country) {
25
+ cartCreate(input: $input) {
26
+ cart {
27
+ ...CartFragment
28
+ }
19
29
  }
20
30
  }
21
- }
22
31
 
23
- ${cartFragment}
32
+ ${cartFragment}
24
33
  `;
25
34
  const CartLineRemove = (cartFragment) => `
26
- mutation CartLineRemove($cartId: ID!, $lines: [ID!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
27
- cartLinesRemove(cartId: $cartId, lineIds: $lines) {
28
- cart {
29
- ...CartFragment
35
+ mutation CartLineRemove(
36
+ $cartId: ID!
37
+ $lines: [ID!]!
38
+ $numCartLines: Int = 250
39
+ $country: CountryCode = ZZ
40
+ ) @inContext(country: $country) {
41
+ cartLinesRemove(cartId: $cartId, lineIds: $lines) {
42
+ cart {
43
+ ...CartFragment
44
+ }
30
45
  }
31
46
  }
32
- }
33
47
 
34
- ${cartFragment}
48
+ ${cartFragment}
35
49
  `;
36
50
  const CartLineUpdate = (cartFragment) => `
37
- mutation CartLineUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
38
- cartLinesUpdate(cartId: $cartId, lines: $lines) {
39
- cart {
40
- ...CartFragment
51
+ mutation CartLineUpdate(
52
+ $cartId: ID!
53
+ $lines: [CartLineUpdateInput!]!
54
+ $numCartLines: Int = 250
55
+ $country: CountryCode = ZZ
56
+ ) @inContext(country: $country) {
57
+ cartLinesUpdate(cartId: $cartId, lines: $lines) {
58
+ cart {
59
+ ...CartFragment
60
+ }
41
61
  }
42
62
  }
43
- }
44
63
 
45
- ${cartFragment}
64
+ ${cartFragment}
46
65
  `;
47
66
  const CartNoteUpdate = (cartFragment) => `
48
- mutation CartNoteUpdate($cartId: ID!, $note: String, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
49
- cartNoteUpdate(cartId: $cartId, note: $note) {
50
- cart {
51
- ...CartFragment
67
+ mutation CartNoteUpdate(
68
+ $cartId: ID!
69
+ $note: String
70
+ $numCartLines: Int = 250
71
+ $country: CountryCode = ZZ
72
+ ) @inContext(country: $country) {
73
+ cartNoteUpdate(cartId: $cartId, note: $note) {
74
+ cart {
75
+ ...CartFragment
76
+ }
52
77
  }
53
78
  }
54
- }
55
79
 
56
- ${cartFragment}
80
+ ${cartFragment}
57
81
  `;
58
82
  const CartBuyerIdentityUpdate = (cartFragment) => `
59
- mutation CartBuyerIdentityUpdate(
60
- $cartId: ID!
61
- $buyerIdentity: CartBuyerIdentityInput!
62
- $numCartLines: Int = 250
63
- $country: CountryCode = ZZ
64
- ) @inContext(country: $country) {
65
- cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
66
- cart {
67
- ...CartFragment
83
+ mutation CartBuyerIdentityUpdate(
84
+ $cartId: ID!
85
+ $buyerIdentity: CartBuyerIdentityInput!
86
+ $numCartLines: Int = 250
87
+ $country: CountryCode = ZZ
88
+ ) @inContext(country: $country) {
89
+ cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
90
+ cart {
91
+ ...CartFragment
92
+ }
68
93
  }
69
94
  }
70
- }
71
95
 
72
- ${cartFragment}
96
+ ${cartFragment}
73
97
  `;
74
98
  const CartAttributesUpdate = (cartFragment) => `
75
- mutation CartAttributesUpdate($attributes: [AttributeInput!]!, $cartId: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
76
- cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {
77
- cart {
78
- ...CartFragment
99
+ mutation CartAttributesUpdate(
100
+ $attributes: [AttributeInput!]!
101
+ $cartId: ID!
102
+ $numCartLines: Int = 250
103
+ $country: CountryCode = ZZ
104
+ ) @inContext(country: $country) {
105
+ cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {
106
+ cart {
107
+ ...CartFragment
108
+ }
79
109
  }
80
110
  }
81
- }
82
111
 
83
- ${cartFragment}
112
+ ${cartFragment}
84
113
  `;
85
114
  const CartDiscountCodesUpdate = (cartFragment) => `
86
- mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!], $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
87
- cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
88
- cart {
89
- ...CartFragment
115
+ mutation CartDiscountCodesUpdate(
116
+ $cartId: ID!
117
+ $discountCodes: [String!]
118
+ $numCartLines: Int = 250
119
+ $country: CountryCode = ZZ
120
+ ) @inContext(country: $country) {
121
+ cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
122
+ cart {
123
+ ...CartFragment
124
+ }
90
125
  }
91
126
  }
92
- }
93
127
 
94
- ${cartFragment}
128
+ ${cartFragment}
95
129
  `;
96
130
  const CartQuery = (cartFragment) => `
97
- query CartQuery($id: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
98
- cart(id: $id) {
99
- ...CartFragment
131
+ query CartQuery(
132
+ $id: ID!
133
+ $numCartLines: Int = 250
134
+ $country: CountryCode = ZZ
135
+ ) @inContext(country: $country) {
136
+ cart(id: $id) {
137
+ ...CartFragment
138
+ }
100
139
  }
101
- }
102
140
 
103
- ${cartFragment}
141
+ ${cartFragment}
142
+ `;
143
+ const defaultCartFragment = `
144
+ fragment CartFragment on Cart {
145
+ id
146
+ checkoutUrl
147
+ totalQuantity
148
+ buyerIdentity {
149
+ countryCode
150
+ customer {
151
+ id
152
+ email
153
+ firstName
154
+ lastName
155
+ displayName
156
+ }
157
+ email
158
+ phone
159
+ }
160
+ lines(first: $numCartLines) {
161
+ edges {
162
+ node {
163
+ id
164
+ quantity
165
+ attributes {
166
+ key
167
+ value
168
+ }
169
+ cost {
170
+ totalAmount {
171
+ amount
172
+ currencyCode
173
+ }
174
+ compareAtAmountPerQuantity {
175
+ amount
176
+ currencyCode
177
+ }
178
+ }
179
+ merchandise {
180
+ ... on ProductVariant {
181
+ id
182
+ availableForSale
183
+ compareAtPrice {
184
+ ...MoneyFragment
185
+ }
186
+ # @deprecated remove in next major
187
+ compareAtPriceV2 {
188
+ ...MoneyFragment
189
+ }
190
+ price {
191
+ ...MoneyFragment
192
+ }
193
+ # @deprecated remove in next major
194
+ priceV2 {
195
+ ...MoneyFragment
196
+ }
197
+ requiresShipping
198
+ title
199
+ image {
200
+ ...ImageFragment
201
+ }
202
+ product {
203
+ handle
204
+ title
205
+ id
206
+ }
207
+ selectedOptions {
208
+ name
209
+ value
210
+ }
211
+ }
212
+ }
213
+ }
214
+ }
215
+ }
216
+ cost {
217
+ subtotalAmount {
218
+ ...MoneyFragment
219
+ }
220
+ totalAmount {
221
+ ...MoneyFragment
222
+ }
223
+ totalDutyAmount {
224
+ ...MoneyFragment
225
+ }
226
+ totalTaxAmount {
227
+ ...MoneyFragment
228
+ }
229
+ }
230
+ note
231
+ attributes {
232
+ key
233
+ value
234
+ }
235
+ discountCodes {
236
+ code
237
+ }
238
+ }
239
+
240
+ fragment MoneyFragment on MoneyV2 {
241
+ currencyCode
242
+ amount
243
+ }
244
+ fragment ImageFragment on Image {
245
+ id
246
+ url
247
+ altText
248
+ width
249
+ height
250
+ }
104
251
  `;
105
252
  exports.CartAttributesUpdate = CartAttributesUpdate;
106
253
  exports.CartBuyerIdentityUpdate = CartBuyerIdentityUpdate;
@@ -111,4 +258,5 @@ exports.CartLineRemove = CartLineRemove;
111
258
  exports.CartLineUpdate = CartLineUpdate;
112
259
  exports.CartNoteUpdate = CartNoteUpdate;
113
260
  exports.CartQuery = CartQuery;
261
+ exports.defaultCartFragment = defaultCartFragment;
114
262
  //# sourceMappingURL=cart-queries.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cart-queries.js","sources":["../../src/cart-queries.ts"],"sourcesContent":["export const CartLineAdd = (cartFragment: string) => `\nmutation CartLineAdd($cartId: ID!, $lines: [CartLineInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartCreate = (cartFragment: string) => `\nmutation CartCreate($input: CartInput!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartCreate(input: $input) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartLineRemove = (cartFragment: string) => `\nmutation CartLineRemove($cartId: ID!, $lines: [ID!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartLinesRemove(cartId: $cartId, lineIds: $lines) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartLineUpdate = (cartFragment: string) => `\nmutation CartLineUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartNoteUpdate = (cartFragment: string) => `\nmutation CartNoteUpdate($cartId: ID!, $note: String, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartBuyerIdentityUpdate = (cartFragment: string) => `\nmutation CartBuyerIdentityUpdate(\n $cartId: ID!\n $buyerIdentity: CartBuyerIdentityInput!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n) @inContext(country: $country) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartAttributesUpdate = (cartFragment: string) => `\nmutation CartAttributesUpdate($attributes: [AttributeInput!]!, $cartId: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartDiscountCodesUpdate = (cartFragment: string) => `\nmutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!], $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartQuery = (cartFragment: string) => `\nquery CartQuery($id: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cart(id: $id) {\n ...CartFragment\n }\n}\n\n${cartFragment}\n`;\n\nexport const defaultCartFragment = `\nfragment CartFragment on Cart {\n id\n checkoutUrl\n totalQuantity\n buyerIdentity {\n countryCode\n customer {\n id\n email\n firstName\n lastName\n displayName\n }\n email\n phone\n }\n lines(first: $numCartLines) {\n edges {\n node {\n id\n quantity\n attributes {\n key\n value\n }\n cost {\n totalAmount {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n }\n merchandise {\n ... on ProductVariant {\n id\n availableForSale\n compareAtPriceV2 {\n ...MoneyFragment\n }\n priceV2 {\n ...MoneyFragment\n }\n requiresShipping\n title\n image {\n ...ImageFragment\n }\n product {\n handle\n title\n id\n }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n cost {\n subtotalAmount {\n ...MoneyFragment\n }\n totalAmount {\n ...MoneyFragment\n }\n totalDutyAmount {\n ...MoneyFragment\n }\n totalTaxAmount {\n ...MoneyFragment\n }\n }\n note\n attributes {\n key\n value\n }\n discountCodes {\n code\n }\n}\n\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}\nfragment ImageFragment on Image {\n id\n url\n altText\n width\n height\n}\n`;\n"],"names":[],"mappings":";;AAAa,MAAA,cAAc,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnD;AAAA;AAGW,MAAA,aAAa,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlD;AAAA;AAGW,MAAA,iBAAiB,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStD;AAAA;AAGW,MAAA,iBAAiB,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStD;AAAA;AAGW,MAAA,iBAAiB,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStD;AAAA;AAGW,MAAA,0BAA0B,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAc/D;AAAA;AAGW,MAAA,uBAAuB,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS5D;AAAA;AAGW,MAAA,0BAA0B,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS/D;AAAA;AAGW,MAAA,YAAY,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjD;AAAA;;;;;;;;;;"}
1
+ {"version":3,"file":"cart-queries.js","sources":["../../src/cart-queries.ts"],"sourcesContent":["export const CartLineAdd = (cartFragment: string) => /* GraphQL */ `\n mutation CartLineAdd(\n $cartId: ID!\n $lines: [CartLineInput!]!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n ) @inContext(country: $country) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${cartFragment}\n`;\n\nexport const CartCreate = (cartFragment: string) => /* GraphQL */ `\n mutation CartCreate(\n $input: CartInput!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n ) @inContext(country: $country) {\n cartCreate(input: $input) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${cartFragment}\n`;\n\nexport const CartLineRemove = (cartFragment: string) => /* GraphQL */ `\n mutation CartLineRemove(\n $cartId: ID!\n $lines: [ID!]!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n ) @inContext(country: $country) {\n cartLinesRemove(cartId: $cartId, lineIds: $lines) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${cartFragment}\n`;\n\nexport const CartLineUpdate = (cartFragment: string) => /* GraphQL */ `\n mutation CartLineUpdate(\n $cartId: ID!\n $lines: [CartLineUpdateInput!]!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n ) @inContext(country: $country) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${cartFragment}\n`;\n\nexport const CartNoteUpdate = (cartFragment: string) => /* GraphQL */ `\n mutation CartNoteUpdate(\n $cartId: ID!\n $note: String\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n ) @inContext(country: $country) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${cartFragment}\n`;\n\nexport const CartBuyerIdentityUpdate = (cartFragment: string) => /* GraphQL */ `\n mutation CartBuyerIdentityUpdate(\n $cartId: ID!\n $buyerIdentity: CartBuyerIdentityInput!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n ) @inContext(country: $country) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${cartFragment}\n`;\n\nexport const CartAttributesUpdate = (cartFragment: string) => /* GraphQL */ `\n mutation CartAttributesUpdate(\n $attributes: [AttributeInput!]!\n $cartId: ID!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n ) @inContext(country: $country) {\n cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${cartFragment}\n`;\n\nexport const CartDiscountCodesUpdate = (cartFragment: string) => /* GraphQL */ `\n mutation CartDiscountCodesUpdate(\n $cartId: ID!\n $discountCodes: [String!]\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n ) @inContext(country: $country) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${cartFragment}\n`;\n\nexport const CartQuery = (cartFragment: string) => /* GraphQL */ `\n query CartQuery(\n $id: ID!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n ) @inContext(country: $country) {\n cart(id: $id) {\n ...CartFragment\n }\n }\n\n ${cartFragment}\n`;\n\nexport const defaultCartFragment = /* GraphQL */ `\n fragment CartFragment on Cart {\n id\n checkoutUrl\n totalQuantity\n buyerIdentity {\n countryCode\n customer {\n id\n email\n firstName\n lastName\n displayName\n }\n email\n phone\n }\n lines(first: $numCartLines) {\n edges {\n node {\n id\n quantity\n attributes {\n key\n value\n }\n cost {\n totalAmount {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n }\n merchandise {\n ... on ProductVariant {\n id\n availableForSale\n compareAtPrice {\n ...MoneyFragment\n }\n # @deprecated remove in next major\n compareAtPriceV2 {\n ...MoneyFragment\n }\n price {\n ...MoneyFragment\n }\n # @deprecated remove in next major\n priceV2 {\n ...MoneyFragment\n }\n requiresShipping\n title\n image {\n ...ImageFragment\n }\n product {\n handle\n title\n id\n }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n cost {\n subtotalAmount {\n ...MoneyFragment\n }\n totalAmount {\n ...MoneyFragment\n }\n totalDutyAmount {\n ...MoneyFragment\n }\n totalTaxAmount {\n ...MoneyFragment\n }\n }\n note\n attributes {\n key\n value\n }\n discountCodes {\n code\n }\n }\n\n fragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n }\n fragment ImageFragment on Image {\n id\n url\n altText\n width\n height\n }\n`;\n"],"names":[],"mappings":";;AAAa,MAAA,cAAc,CAAC,iBAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAc/D;AAAA;AAGS,MAAA,aAAa,CAAC,iBAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAa9D;AAAA;AAGS,MAAA,iBAAiB,CAAC,iBAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAclE;AAAA;AAGS,MAAA,iBAAiB,CAAC,iBAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAclE;AAAA;AAGS,MAAA,iBAAiB,CAAC,iBAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAclE;AAAA;AAGS,MAAA,0BAA0B,CAAC,iBAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAc3E;AAAA;AAGS,MAAA,uBAAuB,CAAC,iBAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAcxE;AAAA;AAGS,MAAA,0BAA0B,CAAC,iBAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAc3E;AAAA;AAGS,MAAA,YAAY,CAAC,iBAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAW7D;AAAA;AAGG,MAAM,sBAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;"}