@shopify/hydrogen 0.19.0 → 0.20.0

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 (72) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/config.d.ts +1 -0
  3. package/dist/esnext/components/CartLineImage/CartLineImage.client.d.ts +4 -7
  4. package/dist/esnext/components/CartLineImage/CartLineImage.client.js +1 -2
  5. package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +3 -1
  6. package/dist/esnext/components/CartProvider/CartProvider.client.js +22 -20
  7. package/dist/esnext/components/CartProvider/cart-queries.d.ts +10 -9
  8. package/dist/esnext/components/CartProvider/cart-queries.js +58 -743
  9. package/dist/esnext/components/CartProvider/hooks.client.js +4 -2
  10. package/dist/esnext/components/CartProvider/types.d.ts +2 -0
  11. package/dist/esnext/components/Image/Image.d.ts +77 -39
  12. package/dist/esnext/components/Image/Image.js +54 -54
  13. package/dist/esnext/components/Image/index.d.ts +1 -0
  14. package/dist/esnext/components/MediaFile/MediaFile.d.ts +2 -2
  15. package/dist/esnext/components/MediaFile/MediaFile.js +2 -2
  16. package/dist/esnext/components/Video/Video.d.ts +3 -3
  17. package/dist/esnext/components/Video/Video.js +7 -4
  18. package/dist/esnext/entry-server.d.ts +13 -1
  19. package/dist/esnext/foundation/fetchSync/server/fetchSync.d.ts +1 -1
  20. package/dist/esnext/foundation/fetchSync/server/fetchSync.js +1 -1
  21. package/dist/esnext/framework/Hydration/Html.js +3 -1
  22. package/dist/esnext/framework/plugin.js +3 -30
  23. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.d.ts +1 -1
  24. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +68 -3
  25. package/dist/esnext/framework/plugins/vite-plugin-hydration-auto-import.js +1 -4
  26. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +5 -4
  27. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +1 -1
  28. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +2 -3
  29. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -0
  30. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +35 -0
  31. package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +1 -1
  32. package/dist/esnext/framework/plugins/vite-plugin-ssr-interop.js +6 -3
  33. package/dist/esnext/storefront-api-types.d.ts +5 -3
  34. package/dist/esnext/storefront-api-types.js +5 -3
  35. package/dist/esnext/types.d.ts +3 -3
  36. package/dist/esnext/utilities/image_size.d.ts +4 -22
  37. package/dist/esnext/utilities/image_size.js +15 -33
  38. package/dist/esnext/utilities/index.d.ts +1 -1
  39. package/dist/esnext/utilities/index.js +1 -1
  40. package/dist/esnext/version.d.ts +1 -1
  41. package/dist/esnext/version.js +1 -1
  42. package/dist/node/components/Image/Image.d.ts +84 -0
  43. package/dist/node/components/Image/Image.js +86 -0
  44. package/dist/node/components/Image/index.d.ts +2 -0
  45. package/dist/node/components/Image/index.js +5 -0
  46. package/dist/node/entry-server.d.ts +13 -1
  47. package/dist/node/framework/Hydration/Html.js +3 -1
  48. package/dist/node/framework/plugin.js +3 -53
  49. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.d.ts +1 -1
  50. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +71 -3
  51. package/dist/node/framework/plugins/vite-plugin-hydration-auto-import.js +1 -4
  52. package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +5 -4
  53. package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +1 -1
  54. package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +2 -3
  55. package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -0
  56. package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +41 -0
  57. package/dist/node/framework/plugins/vite-plugin-platform-entry.js +1 -1
  58. package/dist/node/framework/plugins/vite-plugin-ssr-interop.js +6 -3
  59. package/dist/node/storefront-api-types.d.ts +5 -3
  60. package/dist/node/storefront-api-types.js +5 -3
  61. package/dist/node/types.d.ts +3 -3
  62. package/dist/node/utilities/image_size.d.ts +4 -22
  63. package/dist/node/utilities/image_size.js +16 -58
  64. package/dist/node/utilities/index.d.ts +1 -1
  65. package/dist/node/utilities/index.js +1 -2
  66. package/dist/node/version.d.ts +1 -1
  67. package/dist/node/version.js +1 -1
  68. package/entry-server.d.ts +1 -1
  69. package/package.json +1 -1
  70. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +173 -29
  71. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +2 -0
  72. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +173 -29
package/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1257](https://github.com/Shopify/hydrogen/pull/1257) [`5cd7a672`](https://github.com/Shopify/hydrogen/commit/5cd7a6727befe1e06f35b9ec68d4c81a8858d46f) Thanks [@frandiox](https://github.com/frandiox)! - Support for CSS Modules has been improved. It now behaves closer to the default behavior in Vite where styles are collected automatically.
8
+
9
+ Remove the `StyleTag` component that was needed before:
10
+
11
+ ```diff
12
+ export default function MyComponent() {
13
+ return (
14
+ <div>
15
+ - <myStyles.StyleTag />
16
+ <h1>Title</h1>
17
+ </div>
18
+ );
19
+ }
20
+ ```
21
+
22
+ Optionally, update your wildcard imports to default or named imports:
23
+
24
+ ```diff
25
+ -import * as myStyles from './my.module.css';
26
+ +import myStyles from './my.module.css';
27
+ // Or
28
+ +import {red, green, blue} from './my.module.css';
29
+ ```
30
+
31
+ * [#1271](https://github.com/Shopify/hydrogen/pull/1271) [`9d0359b8`](https://github.com/Shopify/hydrogen/commit/9d0359b87b0cfa04f12ffa9376e5b8ad72c560a3) Thanks [@frehner](https://github.com/frehner)! - ## `<Image/>`
32
+
33
+ The `<Image/>` component and related utility functions were reworked and the following changes apply:
34
+
35
+ - `useImageUrl` is no longer available; use `shopifyImageLoader` instead, which is available to run both server- and client-side.
36
+ - The TypeScript experience with `<Image/>` is improved; props will be validated better, and `loader` and `loaderOptions` will be better typed
37
+ - When using the `src` prop, `width` and `height` are now required
38
+ - When using the `data` prop, `data.width` and `data.height` or `width` and `height` props are required
39
+ - The `src` and `data` props are mutually exclusive
40
+ - The `loader` prop now receives a singular param as an object
41
+ - `options` has been merged with `loaderOptions`. When using the `data` prop, `loaderOptions` will be the options for Shopify CDN images. When using the `src` prop, `loaderOptions` will be whatever you define them to be.
42
+ - The TypeScript type `ImageSizeOptions` is now named `ShopifyLoaderOptions`
43
+ - The TypeScript type `ImageLoaderOptions` is now named `ShopifyLoaderParams`
44
+ - The `priority` prop was removed; use the HTML-standard `loading` prop instead
45
+
46
+ ## `<Video/>`
47
+
48
+ - The `<Video/>` component's `options` props was renamed to `imagePreviewOptions` to add clarity as to what the options were for.
49
+ - `imagePreviewOptions` matches the (newly updated) shape of `<Image/>`'s `loaderOptions`
50
+
51
+ - [#1290](https://github.com/Shopify/hydrogen/pull/1290) [`437b1616`](https://github.com/Shopify/hydrogen/commit/437b1616fcfa15d8b4b2c033b364b2f74b99d6e4) Thanks [@jplhomer](https://github.com/jplhomer)! - Allow cart queries to be customized by adding a new `cartFragment` prop to `CartProvider`. [Learn more](https://shopify.dev/api/hydrogen/components/cart/cartprovider#cart-fragment).
52
+
53
+ ### Patch Changes
54
+
55
+ - [#1247](https://github.com/Shopify/hydrogen/pull/1247) [`ee64873e`](https://github.com/Shopify/hydrogen/commit/ee64873ece372f9be2d6eb08b0594a91f4ed135a) Thanks [@frandiox](https://github.com/frandiox)! - Improve the way client components are discovered in order to reduce bundle sizes.
56
+
57
+ * [#1276](https://github.com/Shopify/hydrogen/pull/1276) [`c6ce6a43`](https://github.com/Shopify/hydrogen/commit/c6ce6a43bbb944b67aec5fdc7e5566768846dac5) Thanks [@frandiox](https://github.com/frandiox)! - Fix page loading in Firefox during development ([known bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1737882)).
58
+
59
+ - [#1286](https://github.com/Shopify/hydrogen/pull/1286) [`53270249`](https://github.com/Shopify/hydrogen/commit/5327024995ff7b8823ddb8ea835b3a5b95175841) Thanks [@jplhomer](https://github.com/jplhomer)! - Fix some sourcemap warnings in server console
60
+
3
61
  ## 0.19.0
4
62
 
5
63
  ### Minor Changes
package/config.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/esnext/config';
@@ -1,12 +1,9 @@
1
- import React from 'react';
2
- import { Image } from '../Image';
3
- import { ImageSizeOptions } from '../../utilities';
4
- declare type PropsWeControl = 'data' | 'options';
1
+ import { type ShopifyImageProps } from '../Image';
2
+ import type { Simplify } from 'type-fest';
3
+ declare type PropsWeControl = 'data';
5
4
  /**
6
5
  * The `CartLineImage` component renders an `Image` component for the cart line merchandise's image.
7
6
  * It must be a descendent of a `CartLineProvider` component.
8
7
  */
9
- export declare function CartLineImage(props: Omit<React.ComponentProps<typeof Image>, PropsWeControl> & {
10
- options?: ImageSizeOptions;
11
- }): JSX.Element | null;
8
+ export declare function CartLineImage(props: Simplify<Omit<ShopifyImageProps, PropsWeControl>>): JSX.Element | null;
12
9
  export {};
@@ -7,6 +7,5 @@ import { Image } from '../Image';
7
7
  */
8
8
  export function CartLineImage(props) {
9
9
  const cartLine = useCartLine();
10
- const { options, ...passthroughProps } = props;
11
- return cartLine.merchandise.image ? (React.createElement(Image, { ...passthroughProps, data: cartLine.merchandise.image, options: options })) : null;
10
+ return cartLine.merchandise.image ? (React.createElement(Image, { ...props, data: cartLine.merchandise.image })) : null;
12
11
  }
@@ -9,7 +9,7 @@ import { CartFragmentFragment } from './graphql/CartFragment';
9
9
  * The `CartProvider` component must be a descendent of the `ShopifyProvider` component.
10
10
  * You must use this component if you want to use the `useCart` hook or related hooks, or if you would like to use the `AddToCartButton` component.
11
11
  */
12
- export declare function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, }: {
12
+ export declare function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, cartFragment, }: {
13
13
  /** Any `ReactNode` elements. */
14
14
  children: React.ReactNode;
15
15
  numCartLines?: number;
@@ -33,4 +33,6 @@ export declare function CartProvider({ children, numCartLines, onCreate, onLineA
33
33
  * An object with fields that correspond to the Storefront API's [Cart object](https://shopify.dev/api/storefront/latest/objects/cart).
34
34
  */
35
35
  data?: CartFragmentFragment;
36
+ /** A fragment used to query the Storefront API's [Cart object](https://shopify.dev/api/storefront/latest/objects/cart) for all queries and mutations. A default value is used if no argument is provided. */
37
+ cartFragment?: string;
36
38
  }): JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useCallback, useReducer, useMemo, useRef, } from 'react';
2
2
  import { flattenConnection } from '../../utilities';
3
- import { CartLineAdd, CartCreate, CartLineRemove, CartLineUpdate, CartNoteUpdate, CartBuyerIdentityUpdate, CartAttributesUpdate, CartDiscountCodesUpdate, CartQuery, } from './cart-queries';
3
+ import { CartLineAdd, CartCreate, CartLineRemove, CartLineUpdate, CartNoteUpdate, CartBuyerIdentityUpdate, CartAttributesUpdate, CartDiscountCodesUpdate, CartQuery, defaultCartFragment, } from './cart-queries';
4
4
  import { useCartFetch } from './hooks.client';
5
5
  import { CartContext } from './context';
6
6
  import { CART_ID_STORAGE_KEY } from './constants';
@@ -150,7 +150,7 @@ function cartReducer(state, action) {
150
150
  * The `CartProvider` component must be a descendent of the `ShopifyProvider` component.
151
151
  * You must use this component if you want to use the `useCart` hook or related hooks, or if you would like to use the `AddToCartButton` component.
152
152
  */
153
- export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, }) {
153
+ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, cartFragment = defaultCartFragment, }) {
154
154
  var _a;
155
155
  const { serverProps } = useServerProps();
156
156
  const countryCode = (_a = serverProps === null || serverProps === void 0 ? void 0 : serverProps.country) === null || _a === void 0 ? void 0 : _a.isoCode;
@@ -162,7 +162,7 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
162
162
  const cartFetch = useCallback(async (cartId) => {
163
163
  dispatch({ type: 'cartFetch' });
164
164
  const { data } = await fetchCart({
165
- query: CartQuery,
165
+ query: CartQuery(cartFragment),
166
166
  variables: {
167
167
  id: cartId,
168
168
  numCartLines,
@@ -175,7 +175,7 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
175
175
  return;
176
176
  }
177
177
  dispatch({ type: 'resolve', cart: cartFromGraphQL(data.cart) });
178
- }, [fetchCart, numCartLines, countryCode]);
178
+ }, [fetchCart, cartFragment, numCartLines, countryCode]);
179
179
  const cartCreate = useCallback(async (cart) => {
180
180
  var _a, _b;
181
181
  dispatch({ type: 'cartCreate' });
@@ -187,7 +187,7 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
187
187
  cart.buyerIdentity.countryCode = countryCode;
188
188
  }
189
189
  const { data, error } = await fetchCart({
190
- query: CartCreate,
190
+ query: CartCreate(cartFragment),
191
191
  variables: {
192
192
  input: cart,
193
193
  numCartLines,
@@ -213,14 +213,14 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
213
213
  });
214
214
  window.localStorage.setItem(CART_ID_STORAGE_KEY, data.cartCreate.cart.id);
215
215
  }
216
- }, [onCreate, fetchCart, numCartLines, countryCode]);
216
+ }, [onCreate, countryCode, fetchCart, cartFragment, numCartLines]);
217
217
  const addLineItem = useCallback(async (lines, state) => {
218
218
  var _a;
219
219
  if (state.status === 'idle') {
220
220
  dispatch({ type: 'addLineItem' });
221
221
  onLineAdd === null || onLineAdd === void 0 ? void 0 : onLineAdd();
222
222
  const { data, error } = await fetchCart({
223
- query: CartLineAdd,
223
+ query: CartLineAdd(cartFragment),
224
224
  variables: {
225
225
  cartId: state.cart.id,
226
226
  lines,
@@ -245,14 +245,14 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
245
245
  });
246
246
  }
247
247
  }
248
- }, [fetchCart, numCartLines, onLineAdd, countryCode]);
248
+ }, [onLineAdd, fetchCart, cartFragment, numCartLines, countryCode]);
249
249
  const removeLineItem = useCallback(async (lines, state) => {
250
250
  var _a;
251
251
  if (state.status === 'idle') {
252
252
  dispatch({ type: 'removeLineItem', lines });
253
253
  onLineRemove === null || onLineRemove === void 0 ? void 0 : onLineRemove();
254
254
  const { data, error } = await fetchCart({
255
- query: CartLineRemove,
255
+ query: CartLineRemove(cartFragment),
256
256
  variables: {
257
257
  cartId: state.cart.id,
258
258
  lines,
@@ -277,14 +277,14 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
277
277
  });
278
278
  }
279
279
  }
280
- }, [fetchCart, onLineRemove, numCartLines, countryCode]);
280
+ }, [onLineRemove, fetchCart, cartFragment, numCartLines, countryCode]);
281
281
  const updateLineItem = useCallback(async (lines, state) => {
282
282
  var _a;
283
283
  if (state.status === 'idle') {
284
284
  dispatch({ type: 'updateLineItem', lines });
285
285
  onLineUpdate === null || onLineUpdate === void 0 ? void 0 : onLineUpdate();
286
286
  const { data, error } = await fetchCart({
287
- query: CartLineUpdate,
287
+ query: CartLineUpdate(cartFragment),
288
288
  variables: {
289
289
  cartId: state.cart.id,
290
290
  lines,
@@ -309,14 +309,14 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
309
309
  });
310
310
  }
311
311
  }
312
- }, [fetchCart, onLineUpdate, numCartLines, countryCode]);
312
+ }, [onLineUpdate, fetchCart, cartFragment, numCartLines, countryCode]);
313
313
  const noteUpdate = useCallback(async (note, state) => {
314
314
  var _a;
315
315
  if (state.status === 'idle') {
316
316
  dispatch({ type: 'noteUpdate' });
317
317
  onNoteUpdate === null || onNoteUpdate === void 0 ? void 0 : onNoteUpdate();
318
318
  const { data, error } = await fetchCart({
319
- query: CartNoteUpdate,
319
+ query: CartNoteUpdate(cartFragment),
320
320
  variables: {
321
321
  cartId: state.cart.id,
322
322
  note,
@@ -337,14 +337,14 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
337
337
  });
338
338
  }
339
339
  }
340
- }, [fetchCart, onNoteUpdate, numCartLines, countryCode]);
340
+ }, [onNoteUpdate, fetchCart, cartFragment, numCartLines, countryCode]);
341
341
  const buyerIdentityUpdate = useCallback(async (buyerIdentity, state) => {
342
342
  var _a;
343
343
  if (state.status === 'idle') {
344
344
  dispatch({ type: 'buyerIdentityUpdate' });
345
345
  onBuyerIdentityUpdate === null || onBuyerIdentityUpdate === void 0 ? void 0 : onBuyerIdentityUpdate();
346
346
  const { data, error } = await fetchCart({
347
- query: CartBuyerIdentityUpdate,
347
+ query: CartBuyerIdentityUpdate(cartFragment),
348
348
  variables: {
349
349
  cartId: state.cart.id,
350
350
  buyerIdentity,
@@ -365,14 +365,14 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
365
365
  });
366
366
  }
367
367
  }
368
- }, [fetchCart, onBuyerIdentityUpdate, numCartLines, countryCode]);
368
+ }, [onBuyerIdentityUpdate, fetchCart, cartFragment, numCartLines, countryCode]);
369
369
  const cartAttributesUpdate = useCallback(async (attributes, state) => {
370
370
  var _a;
371
371
  if (state.status === 'idle') {
372
372
  dispatch({ type: 'cartAttributesUpdate' });
373
373
  onAttributesUpdate === null || onAttributesUpdate === void 0 ? void 0 : onAttributesUpdate();
374
374
  const { data, error } = await fetchCart({
375
- query: CartAttributesUpdate,
375
+ query: CartAttributesUpdate(cartFragment),
376
376
  variables: {
377
377
  cartId: state.cart.id,
378
378
  attributes,
@@ -393,14 +393,14 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
393
393
  });
394
394
  }
395
395
  }
396
- }, [fetchCart, onAttributesUpdate, numCartLines, countryCode]);
396
+ }, [onAttributesUpdate, fetchCart, cartFragment, numCartLines, countryCode]);
397
397
  const discountCodesUpdate = useCallback(async (discountCodes, state) => {
398
398
  var _a;
399
399
  if (state.status === 'idle') {
400
400
  dispatch({ type: 'discountCodesUpdate' });
401
401
  onDiscountCodesUpdate === null || onDiscountCodesUpdate === void 0 ? void 0 : onDiscountCodesUpdate();
402
402
  const { data, error } = await fetchCart({
403
- query: CartDiscountCodesUpdate,
403
+ query: CartDiscountCodesUpdate(cartFragment),
404
404
  variables: {
405
405
  cartId: state.cart.id,
406
406
  discountCodes,
@@ -425,7 +425,7 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
425
425
  });
426
426
  }
427
427
  }
428
- }, [fetchCart, onDiscountCodesUpdate, numCartLines, countryCode]);
428
+ }, [onDiscountCodesUpdate, fetchCart, cartFragment, numCartLines, countryCode]);
429
429
  const didFetchCart = useRef(false);
430
430
  useEffect(() => {
431
431
  if (localStorage.getItem(CART_ID_STORAGE_KEY) &&
@@ -485,11 +485,13 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
485
485
  discountCodesUpdate(discountCodes) {
486
486
  discountCodesUpdate(discountCodes, state);
487
487
  },
488
+ cartFragment,
488
489
  };
489
490
  }, [
490
491
  state,
491
492
  cart,
492
493
  cartCreate,
494
+ cartFragment,
493
495
  addLineItem,
494
496
  removeLineItem,
495
497
  updateLineItem,
@@ -1,9 +1,10 @@
1
- export declare const CartLineAdd = "\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\nfragment CartFragment on Cart {\n id\n checkoutUrl\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 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 }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n estimatedCost {\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";
2
- export declare const CartCreate = "\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\nfragment CartFragment on Cart {\n id\n checkoutUrl\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 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 }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n estimatedCost {\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";
3
- export declare const CartLineRemove = "\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\nfragment CartFragment on Cart {\n id\n checkoutUrl\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 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 }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n estimatedCost {\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";
4
- export declare const CartLineUpdate = "\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\nfragment CartFragment on Cart {\n id\n checkoutUrl\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 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 }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n estimatedCost {\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";
5
- export declare const CartNoteUpdate = "\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\nfragment CartFragment on Cart {\n id\n checkoutUrl\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 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 }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n estimatedCost {\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";
6
- export declare const CartBuyerIdentityUpdate = "\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\nfragment CartFragment on Cart {\n id\n checkoutUrl\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 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 }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n estimatedCost {\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";
7
- export declare const CartAttributesUpdate = "\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\nfragment CartFragment on Cart {\n id\n checkoutUrl\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 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 }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n estimatedCost {\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";
8
- export declare const CartDiscountCodesUpdate = "\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\nfragment CartFragment on Cart {\n id\n checkoutUrl\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 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 }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n estimatedCost {\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";
9
- export declare const CartQuery = "\nquery CartQuery($id: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cart(id: $id) {\n ...CartFragment\n }\n}\n\nfragment CartFragment on Cart {\n id\n checkoutUrl\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 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 }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n estimatedCost {\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";
1
+ export declare const CartLineAdd: (cartFragment: string) => string;
2
+ export declare const CartCreate: (cartFragment: string) => string;
3
+ export declare const CartLineRemove: (cartFragment: string) => string;
4
+ export declare const CartLineUpdate: (cartFragment: string) => string;
5
+ export declare const CartNoteUpdate: (cartFragment: string) => string;
6
+ export declare const CartBuyerIdentityUpdate: (cartFragment: string) => string;
7
+ export declare const CartAttributesUpdate: (cartFragment: string) => string;
8
+ export declare const CartDiscountCodesUpdate: (cartFragment: string) => string;
9
+ export declare const CartQuery: (cartFragment: string) => string;
10
+ export declare const defaultCartFragment = "\nfragment CartFragment on Cart {\n id\n checkoutUrl\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 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 }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n estimatedCost {\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";