@shopify/hydrogen-react 2022.10.5 → 2022.10.7

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 (43) 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/cart-queries.mjs +207 -59
  4. package/dist/browser-dev/cart-queries.mjs.map +1 -1
  5. package/dist/browser-dev/useCartAPIStateMachine.mjs +6 -3
  6. package/dist/browser-dev/useCartAPIStateMachine.mjs.map +1 -1
  7. package/dist/browser-prod/CartProvider.mjs +5 -109
  8. package/dist/browser-prod/CartProvider.mjs.map +1 -1
  9. package/dist/browser-prod/cart-queries.mjs +207 -59
  10. package/dist/browser-prod/cart-queries.mjs.map +1 -1
  11. package/dist/browser-prod/useCartAPIStateMachine.mjs +6 -3
  12. package/dist/browser-prod/useCartAPIStateMachine.mjs.map +1 -1
  13. package/dist/node-dev/CartProvider.js +6 -110
  14. package/dist/node-dev/CartProvider.js.map +1 -1
  15. package/dist/node-dev/CartProvider.mjs +5 -109
  16. package/dist/node-dev/CartProvider.mjs.map +1 -1
  17. package/dist/node-dev/cart-queries.js +206 -58
  18. package/dist/node-dev/cart-queries.js.map +1 -1
  19. package/dist/node-dev/cart-queries.mjs +207 -59
  20. package/dist/node-dev/cart-queries.mjs.map +1 -1
  21. package/dist/node-dev/useCartAPIStateMachine.js +6 -3
  22. package/dist/node-dev/useCartAPIStateMachine.js.map +1 -1
  23. package/dist/node-dev/useCartAPIStateMachine.mjs +6 -3
  24. package/dist/node-dev/useCartAPIStateMachine.mjs.map +1 -1
  25. package/dist/node-prod/CartProvider.js +6 -110
  26. package/dist/node-prod/CartProvider.js.map +1 -1
  27. package/dist/node-prod/CartProvider.mjs +5 -109
  28. package/dist/node-prod/CartProvider.mjs.map +1 -1
  29. package/dist/node-prod/cart-queries.js +206 -58
  30. package/dist/node-prod/cart-queries.js.map +1 -1
  31. package/dist/node-prod/cart-queries.mjs +207 -59
  32. package/dist/node-prod/cart-queries.mjs.map +1 -1
  33. package/dist/node-prod/useCartAPIStateMachine.js +6 -3
  34. package/dist/node-prod/useCartAPIStateMachine.js.map +1 -1
  35. package/dist/node-prod/useCartAPIStateMachine.mjs +6 -3
  36. package/dist/node-prod/useCartAPIStateMachine.mjs.map +1 -1
  37. package/dist/types/CartProvider.d.ts +0 -1
  38. package/dist/types/cart-queries.d.ts +1 -1
  39. package/dist/umd/hydrogen-react.dev.js +216 -170
  40. package/dist/umd/hydrogen-react.dev.js.map +1 -1
  41. package/dist/umd/hydrogen-react.prod.js +195 -148
  42. package/dist/umd/hydrogen-react.prod.js.map +1 -1
  43. package/package.json +3 -8
@@ -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;;;;;;;;;;;"}
@@ -1,104 +1,251 @@
1
1
  const CartLineAdd = (cartFragment) => `
2
- mutation CartLineAdd($cartId: ID!, $lines: [CartLineInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
3
- cartLinesAdd(cartId: $cartId, lines: $lines) {
4
- cart {
5
- ...CartFragment
2
+ mutation CartLineAdd(
3
+ $cartId: ID!
4
+ $lines: [CartLineInput!]!
5
+ $numCartLines: Int = 250
6
+ $country: CountryCode = ZZ
7
+ ) @inContext(country: $country) {
8
+ cartLinesAdd(cartId: $cartId, lines: $lines) {
9
+ cart {
10
+ ...CartFragment
11
+ }
6
12
  }
7
13
  }
8
- }
9
14
 
10
- ${cartFragment}
15
+ ${cartFragment}
11
16
  `;
12
17
  const CartCreate = (cartFragment) => `
13
- mutation CartCreate($input: CartInput!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
14
- cartCreate(input: $input) {
15
- cart {
16
- ...CartFragment
18
+ mutation CartCreate(
19
+ $input: CartInput!
20
+ $numCartLines: Int = 250
21
+ $country: CountryCode = ZZ
22
+ ) @inContext(country: $country) {
23
+ cartCreate(input: $input) {
24
+ cart {
25
+ ...CartFragment
26
+ }
17
27
  }
18
28
  }
19
- }
20
29
 
21
- ${cartFragment}
30
+ ${cartFragment}
22
31
  `;
23
32
  const CartLineRemove = (cartFragment) => `
24
- mutation CartLineRemove($cartId: ID!, $lines: [ID!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
25
- cartLinesRemove(cartId: $cartId, lineIds: $lines) {
26
- cart {
27
- ...CartFragment
33
+ mutation CartLineRemove(
34
+ $cartId: ID!
35
+ $lines: [ID!]!
36
+ $numCartLines: Int = 250
37
+ $country: CountryCode = ZZ
38
+ ) @inContext(country: $country) {
39
+ cartLinesRemove(cartId: $cartId, lineIds: $lines) {
40
+ cart {
41
+ ...CartFragment
42
+ }
28
43
  }
29
44
  }
30
- }
31
45
 
32
- ${cartFragment}
46
+ ${cartFragment}
33
47
  `;
34
48
  const CartLineUpdate = (cartFragment) => `
35
- mutation CartLineUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
36
- cartLinesUpdate(cartId: $cartId, lines: $lines) {
37
- cart {
38
- ...CartFragment
49
+ mutation CartLineUpdate(
50
+ $cartId: ID!
51
+ $lines: [CartLineUpdateInput!]!
52
+ $numCartLines: Int = 250
53
+ $country: CountryCode = ZZ
54
+ ) @inContext(country: $country) {
55
+ cartLinesUpdate(cartId: $cartId, lines: $lines) {
56
+ cart {
57
+ ...CartFragment
58
+ }
39
59
  }
40
60
  }
41
- }
42
61
 
43
- ${cartFragment}
62
+ ${cartFragment}
44
63
  `;
45
64
  const CartNoteUpdate = (cartFragment) => `
46
- mutation CartNoteUpdate($cartId: ID!, $note: String, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
47
- cartNoteUpdate(cartId: $cartId, note: $note) {
48
- cart {
49
- ...CartFragment
65
+ mutation CartNoteUpdate(
66
+ $cartId: ID!
67
+ $note: String
68
+ $numCartLines: Int = 250
69
+ $country: CountryCode = ZZ
70
+ ) @inContext(country: $country) {
71
+ cartNoteUpdate(cartId: $cartId, note: $note) {
72
+ cart {
73
+ ...CartFragment
74
+ }
50
75
  }
51
76
  }
52
- }
53
77
 
54
- ${cartFragment}
78
+ ${cartFragment}
55
79
  `;
56
80
  const CartBuyerIdentityUpdate = (cartFragment) => `
57
- mutation CartBuyerIdentityUpdate(
58
- $cartId: ID!
59
- $buyerIdentity: CartBuyerIdentityInput!
60
- $numCartLines: Int = 250
61
- $country: CountryCode = ZZ
62
- ) @inContext(country: $country) {
63
- cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
64
- cart {
65
- ...CartFragment
81
+ mutation CartBuyerIdentityUpdate(
82
+ $cartId: ID!
83
+ $buyerIdentity: CartBuyerIdentityInput!
84
+ $numCartLines: Int = 250
85
+ $country: CountryCode = ZZ
86
+ ) @inContext(country: $country) {
87
+ cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
88
+ cart {
89
+ ...CartFragment
90
+ }
66
91
  }
67
92
  }
68
- }
69
93
 
70
- ${cartFragment}
94
+ ${cartFragment}
71
95
  `;
72
96
  const CartAttributesUpdate = (cartFragment) => `
73
- mutation CartAttributesUpdate($attributes: [AttributeInput!]!, $cartId: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
74
- cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {
75
- cart {
76
- ...CartFragment
97
+ mutation CartAttributesUpdate(
98
+ $attributes: [AttributeInput!]!
99
+ $cartId: ID!
100
+ $numCartLines: Int = 250
101
+ $country: CountryCode = ZZ
102
+ ) @inContext(country: $country) {
103
+ cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {
104
+ cart {
105
+ ...CartFragment
106
+ }
77
107
  }
78
108
  }
79
- }
80
109
 
81
- ${cartFragment}
110
+ ${cartFragment}
82
111
  `;
83
112
  const CartDiscountCodesUpdate = (cartFragment) => `
84
- mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!], $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
85
- cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
86
- cart {
87
- ...CartFragment
113
+ mutation CartDiscountCodesUpdate(
114
+ $cartId: ID!
115
+ $discountCodes: [String!]
116
+ $numCartLines: Int = 250
117
+ $country: CountryCode = ZZ
118
+ ) @inContext(country: $country) {
119
+ cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
120
+ cart {
121
+ ...CartFragment
122
+ }
88
123
  }
89
124
  }
90
- }
91
125
 
92
- ${cartFragment}
126
+ ${cartFragment}
93
127
  `;
94
128
  const CartQuery = (cartFragment) => `
95
- query CartQuery($id: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
96
- cart(id: $id) {
97
- ...CartFragment
129
+ query CartQuery(
130
+ $id: ID!
131
+ $numCartLines: Int = 250
132
+ $country: CountryCode = ZZ
133
+ ) @inContext(country: $country) {
134
+ cart(id: $id) {
135
+ ...CartFragment
136
+ }
98
137
  }
99
- }
100
138
 
101
- ${cartFragment}
139
+ ${cartFragment}
140
+ `;
141
+ const defaultCartFragment = `
142
+ fragment CartFragment on Cart {
143
+ id
144
+ checkoutUrl
145
+ totalQuantity
146
+ buyerIdentity {
147
+ countryCode
148
+ customer {
149
+ id
150
+ email
151
+ firstName
152
+ lastName
153
+ displayName
154
+ }
155
+ email
156
+ phone
157
+ }
158
+ lines(first: $numCartLines) {
159
+ edges {
160
+ node {
161
+ id
162
+ quantity
163
+ attributes {
164
+ key
165
+ value
166
+ }
167
+ cost {
168
+ totalAmount {
169
+ amount
170
+ currencyCode
171
+ }
172
+ compareAtAmountPerQuantity {
173
+ amount
174
+ currencyCode
175
+ }
176
+ }
177
+ merchandise {
178
+ ... on ProductVariant {
179
+ id
180
+ availableForSale
181
+ compareAtPrice {
182
+ ...MoneyFragment
183
+ }
184
+ # @deprecated remove in next major
185
+ compareAtPriceV2 {
186
+ ...MoneyFragment
187
+ }
188
+ price {
189
+ ...MoneyFragment
190
+ }
191
+ # @deprecated remove in next major
192
+ priceV2 {
193
+ ...MoneyFragment
194
+ }
195
+ requiresShipping
196
+ title
197
+ image {
198
+ ...ImageFragment
199
+ }
200
+ product {
201
+ handle
202
+ title
203
+ id
204
+ }
205
+ selectedOptions {
206
+ name
207
+ value
208
+ }
209
+ }
210
+ }
211
+ }
212
+ }
213
+ }
214
+ cost {
215
+ subtotalAmount {
216
+ ...MoneyFragment
217
+ }
218
+ totalAmount {
219
+ ...MoneyFragment
220
+ }
221
+ totalDutyAmount {
222
+ ...MoneyFragment
223
+ }
224
+ totalTaxAmount {
225
+ ...MoneyFragment
226
+ }
227
+ }
228
+ note
229
+ attributes {
230
+ key
231
+ value
232
+ }
233
+ discountCodes {
234
+ code
235
+ }
236
+ }
237
+
238
+ fragment MoneyFragment on MoneyV2 {
239
+ currencyCode
240
+ amount
241
+ }
242
+ fragment ImageFragment on Image {
243
+ id
244
+ url
245
+ altText
246
+ width
247
+ height
248
+ }
102
249
  `;
103
250
  export {
104
251
  CartAttributesUpdate,
@@ -109,6 +256,7 @@ export {
109
256
  CartLineRemove,
110
257
  CartLineUpdate,
111
258
  CartNoteUpdate,
112
- CartQuery
259
+ CartQuery,
260
+ defaultCartFragment
113
261
  };
114
262
  //# sourceMappingURL=cart-queries.mjs.map