@shopify/hydrogen 1.5.0 → 1.6.1
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.
- package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +20 -11
- package/dist/esnext/components/CartProvider/CartProvider.client.js +457 -477
- package/dist/esnext/components/CartProvider/cart-queries.d.ts +1 -1
- package/dist/esnext/components/CartProvider/cart-queries.js +4 -1
- package/dist/esnext/components/Seo/Seo.client.d.ts +1 -1
- package/dist/esnext/entry-server.js +12 -2
- package/dist/esnext/experimental.d.ts +0 -1
- package/dist/esnext/experimental.js +0 -1
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.js +21 -14
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.js +15 -9
- package/dist/esnext/foundation/Analytics/connectors/Shopify/const.d.ts +5 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/const.js +5 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/customer-events.client.d.ts +2 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/customer-events.client.js +182 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/utils.d.ts +3 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/utils.js +69 -0
- package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.d.ts +1 -0
- package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.js +2 -8
- package/dist/esnext/foundation/Route/Route.server.d.ts +3 -1
- package/dist/esnext/foundation/Route/Route.server.js +2 -2
- package/dist/esnext/hooks/useShopQuery/hooks.js +10 -6
- package/dist/esnext/utilities/random.d.ts +1 -0
- package/dist/esnext/utilities/random.js +11 -0
- package/dist/esnext/utilities/tests/price.js +0 -1
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/package.json +2 -1
- package/dist/esnext/components/CartProvider/CartProviderV2.client.d.ts +0 -50
- package/dist/esnext/components/CartProvider/CartProviderV2.client.js +0 -513
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CartBuyerIdentityInput, CountryCode } from '../../storefront-api-types.js';
|
|
3
2
|
import { CartFragmentFragment } from './graphql/CartFragment.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* that can be accessed by any descendent component using the `useCart` hook and related hooks. It also carries out
|
|
7
|
-
* any callback props when a relevant action is performed. For example, if a `onLineAdd` callback is provided,
|
|
8
|
-
* then the callback will be called when a new line item is successfully added to the cart.
|
|
9
|
-
*
|
|
10
|
-
* The `CartProvider` component must be a descendent of the `ShopifyProvider` component.
|
|
11
|
-
* 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.
|
|
12
|
-
*/
|
|
13
|
-
export declare function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, cartFragment, customerAccessToken, countryCode, }: {
|
|
3
|
+
import { CartBuyerIdentityInput, CountryCode } from '../../storefront-api-types.js';
|
|
4
|
+
export declare function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, onCreateComplete, onLineAddComplete, onLineRemoveComplete, onLineUpdateComplete, onNoteUpdateComplete, onBuyerIdentityUpdateComplete, onAttributesUpdateComplete, onDiscountCodesUpdateComplete, data: cart, cartFragment, customerAccessToken, countryCode, }: {
|
|
14
5
|
/** Any `ReactNode` elements. */
|
|
15
6
|
children: React.ReactNode;
|
|
7
|
+
/** Maximum number of cart lines to fetch. Defaults to 250 cart lines. */
|
|
16
8
|
numCartLines?: number;
|
|
17
9
|
/** A callback that is invoked when the process to create a cart begins, but before the cart is created in the Storefront API. */
|
|
18
10
|
onCreate?: () => void;
|
|
@@ -30,6 +22,22 @@ export declare function CartProvider({ children, numCartLines, onCreate, onLineA
|
|
|
30
22
|
onAttributesUpdate?: () => void;
|
|
31
23
|
/** A callback that is invoked when the process to update the cart discount codes begins, but before the discount codes are updated in the Storefront API. */
|
|
32
24
|
onDiscountCodesUpdate?: () => void;
|
|
25
|
+
/** A callback that is invoked when the process to create a cart completes successfully */
|
|
26
|
+
onCreateComplete?: () => void;
|
|
27
|
+
/** A callback that is invoked when the process to add a line item to the cart completes successfully */
|
|
28
|
+
onLineAddComplete?: () => void;
|
|
29
|
+
/** A callback that is invoked when the process to remove a line item to the cart completes successfully */
|
|
30
|
+
onLineRemoveComplete?: () => void;
|
|
31
|
+
/** A callback that is invoked when the process to update a line item in the cart completes successfully */
|
|
32
|
+
onLineUpdateComplete?: () => void;
|
|
33
|
+
/** A callback that is invoked when the process to add or update a note in the cart completes successfully */
|
|
34
|
+
onNoteUpdateComplete?: () => void;
|
|
35
|
+
/** A callback that is invoked when the process to update the buyer identity completes successfully */
|
|
36
|
+
onBuyerIdentityUpdateComplete?: () => void;
|
|
37
|
+
/** A callback that is invoked when the process to update the cart attributes completes successfully */
|
|
38
|
+
onAttributesUpdateComplete?: () => void;
|
|
39
|
+
/** A callback that is invoked when the process to update the cart discount codes completes successfully */
|
|
40
|
+
onDiscountCodesUpdateComplete?: () => void;
|
|
33
41
|
/** An object with fields that correspond to the Storefront API's [Cart object](https://shopify.dev/api/storefront/latest/objects/cart). */
|
|
34
42
|
data?: CartFragmentFragment;
|
|
35
43
|
/** 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. */
|
|
@@ -39,3 +47,4 @@ export declare function CartProvider({ children, numCartLines, onCreate, onLineA
|
|
|
39
47
|
/** The ISO country code for i18n. */
|
|
40
48
|
countryCode?: CountryCode;
|
|
41
49
|
}): JSX.Element;
|
|
50
|
+
export declare 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 }\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";
|