@shopify/hydrogen 2024.4.2 → 2024.4.4
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/README.md +1 -1
- package/dist/development/index.cjs +295 -148
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +293 -147
- package/dist/development/index.js.map +1 -1
- package/dist/production/index.cjs +86 -85
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.d.cts +38 -13
- package/dist/production/index.d.ts +38 -13
- package/dist/production/index.js +38 -38
- package/dist/production/index.js.map +1 -1
- package/dist/vite/plugin.js +18 -15
- package/dist/vite/request-events.js +4 -3
- package/dist/vite/virtual-routes/routes/index.jsx +0 -10
- package/package.json +8 -6
- package/dist/vite/virtual-routes/components/IconDiscord.jsx +0 -21
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createStorefrontClient as createStorefrontClient$1, StorefrontClientProps, ShopPayButton as ShopPayButton$1 } from '@shopify/hydrogen-react';
|
|
1
|
+
import { createStorefrontClient as createStorefrontClient$1, StorefrontClientProps, ShopPayButton as ShopPayButton$1, RichText as RichText$1 } from '@shopify/hydrogen-react';
|
|
2
2
|
export { AnalyticsEventName, AnalyticsPageType, ClientBrowserParameters, ExternalVideo, IMAGE_FRAGMENT, Image, MediaFile, ModelViewer, Money, ParsedMetafields, ShopifyAnalytics as SendShopifyAnalyticsEvent, ShopifyAddToCart, ShopifyAddToCartPayload, ShopifyAnalyticsPayload, ShopifyAnalyticsProduct, ShopifyCookies, ShopifyPageView, ShopifyPageViewPayload, ShopifySalesChannel, StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiResponseOk, StorefrontApiResponseOkPartial, StorefrontApiResponsePartial, Video, customerAccountApiCustomScalars, flattenConnection, getClientBrowserParameters, getShopifyCookies, parseGid, parseMetafield, sendShopifyAnalytics, storefrontApiCustomScalars, useLoadScript, useMoney, useShopifyCookies } from '@shopify/hydrogen-react';
|
|
3
|
-
import { LanguageCode, CountryCode, Maybe, PageInfo, BuyerInput, CartMetafieldsSetInput, Cart, Scalars, CartUserError, MetafieldsSetUserError, MetafieldDeleteUserError, AttributeInput, CartBuyerIdentityInput, CartInput,
|
|
3
|
+
import { LanguageCode, CountryCode, Maybe, PageInfo, BuyerInput, CartMetafieldsSetInput, Cart, Scalars, CartUserError, MetafieldsSetUserError, MetafieldDeleteUserError, CartLineInput, AttributeInput, CartBuyerIdentityInput, CartInput, CartLineUpdateInput, CartSelectedDeliveryOptionInput, CartLine, ProductVariant, ProductOption, ProductVariantConnection, SelectedOptionInput, ComponentizableCartLine, Product, CurrencyCode } from '@shopify/hydrogen-react/storefront-api-types';
|
|
4
4
|
import { ExecutionArgs } from 'graphql';
|
|
5
5
|
import { LoaderFunctionArgs, LoaderFunction, SerializeFrom, SessionData, FlashSessionData, Session, SessionStorage } from '@remix-run/server-runtime';
|
|
6
6
|
import * as react from 'react';
|
|
@@ -221,7 +221,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
221
221
|
```
|
|
222
222
|
|
|
223
223
|
@link https://github.com/microsoft/TypeScript/issues/15300
|
|
224
|
-
|
|
224
|
+
@see SimplifyDeep
|
|
225
225
|
@category Object
|
|
226
226
|
*/
|
|
227
227
|
type Simplify<T> = {
|
|
@@ -1033,6 +1033,7 @@ type RequestEventPayload = {
|
|
|
1033
1033
|
};
|
|
1034
1034
|
|
|
1035
1035
|
declare const CUSTOMER_ACCOUNT_SESSION_KEY = "customerAccount";
|
|
1036
|
+
declare const BUYER_SESSION_KEY = "buyer";
|
|
1036
1037
|
|
|
1037
1038
|
interface HydrogenSessionData {
|
|
1038
1039
|
[CUSTOMER_ACCOUNT_SESSION_KEY]: {
|
|
@@ -1295,16 +1296,19 @@ type CartDiscountCodesUpdateRequire = {
|
|
|
1295
1296
|
discountCodes: string[];
|
|
1296
1297
|
} & OtherFormData;
|
|
1297
1298
|
};
|
|
1299
|
+
type OptimisticCartLine = CartLineInput & {
|
|
1300
|
+
selectedVariant?: unknown;
|
|
1301
|
+
};
|
|
1298
1302
|
type CartLinesAddProps = {
|
|
1299
1303
|
action: 'LinesAdd';
|
|
1300
1304
|
inputs?: {
|
|
1301
|
-
lines:
|
|
1305
|
+
lines: Array<OptimisticCartLine>;
|
|
1302
1306
|
} & OtherFormData;
|
|
1303
1307
|
};
|
|
1304
1308
|
type CartLinesAddRequire = {
|
|
1305
1309
|
action: 'LinesAdd';
|
|
1306
1310
|
inputs: {
|
|
1307
|
-
lines:
|
|
1311
|
+
lines: Array<OptimisticCartLine>;
|
|
1308
1312
|
} & OtherFormData;
|
|
1309
1313
|
};
|
|
1310
1314
|
type CartLinesUpdateProps = {
|
|
@@ -1459,7 +1463,7 @@ type CartGetOptions = CartQueryOptions & {
|
|
|
1459
1463
|
};
|
|
1460
1464
|
declare function cartGetDefault({ storefront, customerAccount, getCartId, cartFragment, }: CartGetOptions): CartGetFunction;
|
|
1461
1465
|
|
|
1462
|
-
type CartLinesAddFunction = (lines:
|
|
1466
|
+
type CartLinesAddFunction = (lines: Array<OptimisticCartLine>, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1463
1467
|
declare function cartLinesAddDefault(options: CartQueryOptions): CartLinesAddFunction;
|
|
1464
1468
|
|
|
1465
1469
|
type CartLinesUpdateFunction = (lines: CartLineUpdateInput[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
@@ -1534,6 +1538,21 @@ type HydrogenCartCustom<TCustomMethods extends Partial<HydrogenCart> & CustomMet
|
|
|
1534
1538
|
declare function createCartHandler(options: CartHandlerOptions): HydrogenCart;
|
|
1535
1539
|
declare function createCartHandler<TCustomMethods extends CustomMethodsBase>(options: CartHandlerOptionsWithCustom<TCustomMethods>): HydrogenCartCustom<TCustomMethods>;
|
|
1536
1540
|
|
|
1541
|
+
type OptimisticCart<T = ReturnType<typeof cartGetDefault>> = T & {
|
|
1542
|
+
isOptimistic?: boolean;
|
|
1543
|
+
lines: {
|
|
1544
|
+
nodes: Array<CartLine & {
|
|
1545
|
+
isOptimistic?: boolean;
|
|
1546
|
+
}>;
|
|
1547
|
+
};
|
|
1548
|
+
};
|
|
1549
|
+
/**
|
|
1550
|
+
* @param cart The cart object from `context.cart.get()` returned by a server loader.
|
|
1551
|
+
*
|
|
1552
|
+
* @returns A new cart object augmented with optimistic state. Each cart line item that is optimistically added includes an `isOptimistic` property. Also if the cart has _any_ optimistic state, a root property `isOptimistic` will be set to `true`.
|
|
1553
|
+
*/
|
|
1554
|
+
declare function useOptimisticCart<DefaultCart = CartReturn>(cart: DefaultCart): OptimisticCart<DefaultCart>;
|
|
1555
|
+
|
|
1537
1556
|
type VariantOption = {
|
|
1538
1557
|
name: string;
|
|
1539
1558
|
value?: string;
|
|
@@ -1545,6 +1564,7 @@ type VariantOptionValue = {
|
|
|
1545
1564
|
to: string;
|
|
1546
1565
|
search: string;
|
|
1547
1566
|
isActive: boolean;
|
|
1567
|
+
variant?: PartialDeep<ProductVariant>;
|
|
1548
1568
|
};
|
|
1549
1569
|
type VariantSelectorProps = {
|
|
1550
1570
|
/** The product handle for all of the variants */
|
|
@@ -1599,6 +1619,7 @@ type DirectiveValues = string[] | string | boolean;
|
|
|
1599
1619
|
type CreateContentSecurityPolicy = {
|
|
1600
1620
|
defaultSrc?: DirectiveValues;
|
|
1601
1621
|
scriptSrc?: DirectiveValues;
|
|
1622
|
+
scriptSrcElem?: DirectiveValues;
|
|
1602
1623
|
styleSrc?: DirectiveValues;
|
|
1603
1624
|
imgSrc?: DirectiveValues;
|
|
1604
1625
|
connectSrc?: DirectiveValues;
|
|
@@ -1734,7 +1755,7 @@ type CartLinePayload = {
|
|
|
1734
1755
|
};
|
|
1735
1756
|
type CollectionViewPayload = CollectionPayload & UrlPayload & BasePayload;
|
|
1736
1757
|
type ProductViewPayload = ProductsPayload & UrlPayload & BasePayload;
|
|
1737
|
-
type CartViewPayload = UrlPayload & BasePayload;
|
|
1758
|
+
type CartViewPayload = CartPayload & UrlPayload & BasePayload;
|
|
1738
1759
|
type PageViewPayload = UrlPayload & BasePayload;
|
|
1739
1760
|
type SearchViewPayload = SearchPayload & UrlPayload & BasePayload;
|
|
1740
1761
|
type CartUpdatePayload = CartPayload & BasePayload & OtherData;
|
|
@@ -1767,7 +1788,7 @@ declare function AnalyticsCartView(props: BasicViewProps): react_jsx_runtime.JSX
|
|
|
1767
1788
|
declare function AnalyticsSearchView(props: SearchViewProps): react_jsx_runtime.JSX.Element;
|
|
1768
1789
|
declare function AnalyticsCustomView(props: CustomViewProps): react_jsx_runtime.JSX.Element;
|
|
1769
1790
|
|
|
1770
|
-
type ConsentStatus =
|
|
1791
|
+
type ConsentStatus = boolean | undefined;
|
|
1771
1792
|
type VisitorConsent = {
|
|
1772
1793
|
marketing: ConsentStatus;
|
|
1773
1794
|
analytics: ConsentStatus;
|
|
@@ -1841,7 +1862,7 @@ type CustomerPrivacyApiProps = {
|
|
|
1841
1862
|
onReady?: () => void;
|
|
1842
1863
|
};
|
|
1843
1864
|
declare function useCustomerPrivacy(props: CustomerPrivacyApiProps): void;
|
|
1844
|
-
declare function getCustomerPrivacy():
|
|
1865
|
+
declare function getCustomerPrivacy(): CustomerPrivacy$1 | null;
|
|
1845
1866
|
|
|
1846
1867
|
type ShopAnalytics = {
|
|
1847
1868
|
/** The shop ID. */
|
|
@@ -1865,9 +1886,11 @@ type AnalyticsProviderProps = {
|
|
|
1865
1886
|
/** The shop configuration required to publish analytics events to Shopify. Use [`getShopAnalytics`](/docs/api/hydrogen/2024-04/utilities/getshopanalytics). */
|
|
1866
1887
|
shop: Promise<ShopAnalytics | null> | ShopAnalytics | null;
|
|
1867
1888
|
/** The customer privacy consent configuration and options. */
|
|
1868
|
-
consent: CustomerPrivacyApiProps
|
|
1869
|
-
/** Disable throwing errors when required props are missing. */
|
|
1889
|
+
consent: Partial<Pick<CustomerPrivacyApiProps, 'checkoutDomain' | 'storefrontAccessToken' | 'withPrivacyBanner'>>;
|
|
1890
|
+
/** @deprecated Disable throwing errors when required props are missing. */
|
|
1870
1891
|
disableThrowOnError?: boolean;
|
|
1892
|
+
/** The domain scope of the cookie set with `useShopifyCookies`. **/
|
|
1893
|
+
cookieDomain?: string;
|
|
1871
1894
|
};
|
|
1872
1895
|
type AnalyticsContextValue = {
|
|
1873
1896
|
/** A function to tell you the current state of if the user can be tracked by analytics. Defaults to Customer Privacy API's `window.Shopify.customerPrivacy.analyticsProcessingAllowed()`. */
|
|
@@ -1906,7 +1929,7 @@ declare function publish(event: typeof AnalyticsEvent.CART_UPDATED, payload: Car
|
|
|
1906
1929
|
declare function publish(event: typeof AnalyticsEvent.PRODUCT_ADD_TO_CART, payload: CartLineUpdatePayload): void;
|
|
1907
1930
|
declare function publish(event: typeof AnalyticsEvent.PRODUCT_REMOVED_FROM_CART, payload: CartLineUpdatePayload): void;
|
|
1908
1931
|
declare function publish(event: typeof AnalyticsEvent.CUSTOM_EVENT, payload: OtherData): void;
|
|
1909
|
-
declare function AnalyticsProvider({ canTrack: customCanTrack, cart: currentCart, children, consent, customData, shop: shopProp, disableThrowOnError, }: AnalyticsProviderProps): JSX.Element;
|
|
1932
|
+
declare function AnalyticsProvider({ canTrack: customCanTrack, cart: currentCart, children, consent, customData, shop: shopProp, disableThrowOnError, cookieDomain, }: AnalyticsProviderProps): JSX.Element;
|
|
1910
1933
|
declare function useAnalytics(): AnalyticsContextValue;
|
|
1911
1934
|
type ShopAnalyticsProps = {
|
|
1912
1935
|
/**
|
|
@@ -1928,4 +1951,6 @@ declare const Analytics: {
|
|
|
1928
1951
|
SearchView: typeof AnalyticsSearchView;
|
|
1929
1952
|
};
|
|
1930
1953
|
|
|
1931
|
-
|
|
1954
|
+
declare const RichText: typeof RichText$1;
|
|
1955
|
+
|
|
1956
|
+
export { Analytics, AnalyticsEvent, CacheCustom, CacheKey, CacheLong, CacheNone, CacheShort, CachingStrategy, CartActionInput, CartForm, CartLineUpdatePayload, CartQueryDataReturn, CartQueryOptions, CartQueryReturn, CartReturn, CartUpdatePayload, CartViewPayload, CollectionViewPayload, ConsentStatus, CookieOptions, CreateStorefrontClientForDocs, CreateStorefrontClientOptions, CustomEventMap$1 as CustomEventMap, CustomerAccount, CustomerAccountMutations, CustomerAccountQueries, CustomerPrivacy$1 as CustomerPrivacy, CustomerPrivacyApiProps, CustomerPrivacyConsentConfig, HydrogenCart, HydrogenCartCustom, HydrogenSession, HydrogenSessionData, I18nBase, InMemoryCache, MetafieldWithoutOwnerId, NoStoreStrategy, OptimisticCart, OptimisticCartLine, OptimisticInput, PageViewPayload, Pagination, PrivacyBanner$1 as PrivacyBanner, ProductViewPayload, RichText, Script, SearchViewPayload, Seo, SeoConfig, SeoHandleFunction, SetConsentHeadlessParams, ShopPayButton, Storefront, StorefrontApiErrors, StorefrontClient, StorefrontForDoc, StorefrontMutationOptionsForDocs, StorefrontMutations, StorefrontQueries, StorefrontQueryOptionsForDocs, VariantOption, VariantOptionValue, VariantSelector, VisitorConsent, VisitorConsentCollected, WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, changelogHandler, createCartHandler, createContentSecurityPolicy, createCustomerAccountClient, createStorefrontClient, createWithCache, formatAPIResult, generateCacheControlHeader, getCustomerPrivacy, getPaginationVariables, getSelectedProductOptions, getSeoMeta, getShopAnalytics, graphiqlLoader, storefrontRedirect, useAnalytics, useCustomerPrivacy, useNonce, useOptimisticCart, useOptimisticData };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createStorefrontClient as createStorefrontClient$1, StorefrontClientProps, ShopPayButton as ShopPayButton$1 } from '@shopify/hydrogen-react';
|
|
1
|
+
import { createStorefrontClient as createStorefrontClient$1, StorefrontClientProps, ShopPayButton as ShopPayButton$1, RichText as RichText$1 } from '@shopify/hydrogen-react';
|
|
2
2
|
export { AnalyticsEventName, AnalyticsPageType, ClientBrowserParameters, ExternalVideo, IMAGE_FRAGMENT, Image, MediaFile, ModelViewer, Money, ParsedMetafields, ShopifyAnalytics as SendShopifyAnalyticsEvent, ShopifyAddToCart, ShopifyAddToCartPayload, ShopifyAnalyticsPayload, ShopifyAnalyticsProduct, ShopifyCookies, ShopifyPageView, ShopifyPageViewPayload, ShopifySalesChannel, StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiResponseOk, StorefrontApiResponseOkPartial, StorefrontApiResponsePartial, Video, customerAccountApiCustomScalars, flattenConnection, getClientBrowserParameters, getShopifyCookies, parseGid, parseMetafield, sendShopifyAnalytics, storefrontApiCustomScalars, useLoadScript, useMoney, useShopifyCookies } from '@shopify/hydrogen-react';
|
|
3
|
-
import { LanguageCode, CountryCode, Maybe, PageInfo, BuyerInput, CartMetafieldsSetInput, Cart, Scalars, CartUserError, MetafieldsSetUserError, MetafieldDeleteUserError, AttributeInput, CartBuyerIdentityInput, CartInput,
|
|
3
|
+
import { LanguageCode, CountryCode, Maybe, PageInfo, BuyerInput, CartMetafieldsSetInput, Cart, Scalars, CartUserError, MetafieldsSetUserError, MetafieldDeleteUserError, CartLineInput, AttributeInput, CartBuyerIdentityInput, CartInput, CartLineUpdateInput, CartSelectedDeliveryOptionInput, CartLine, ProductVariant, ProductOption, ProductVariantConnection, SelectedOptionInput, ComponentizableCartLine, Product, CurrencyCode } from '@shopify/hydrogen-react/storefront-api-types';
|
|
4
4
|
import { ExecutionArgs } from 'graphql';
|
|
5
5
|
import { LoaderFunctionArgs, LoaderFunction, SerializeFrom, SessionData, FlashSessionData, Session, SessionStorage } from '@remix-run/server-runtime';
|
|
6
6
|
import * as react from 'react';
|
|
@@ -221,7 +221,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
221
221
|
```
|
|
222
222
|
|
|
223
223
|
@link https://github.com/microsoft/TypeScript/issues/15300
|
|
224
|
-
|
|
224
|
+
@see SimplifyDeep
|
|
225
225
|
@category Object
|
|
226
226
|
*/
|
|
227
227
|
type Simplify<T> = {
|
|
@@ -1033,6 +1033,7 @@ type RequestEventPayload = {
|
|
|
1033
1033
|
};
|
|
1034
1034
|
|
|
1035
1035
|
declare const CUSTOMER_ACCOUNT_SESSION_KEY = "customerAccount";
|
|
1036
|
+
declare const BUYER_SESSION_KEY = "buyer";
|
|
1036
1037
|
|
|
1037
1038
|
interface HydrogenSessionData {
|
|
1038
1039
|
[CUSTOMER_ACCOUNT_SESSION_KEY]: {
|
|
@@ -1295,16 +1296,19 @@ type CartDiscountCodesUpdateRequire = {
|
|
|
1295
1296
|
discountCodes: string[];
|
|
1296
1297
|
} & OtherFormData;
|
|
1297
1298
|
};
|
|
1299
|
+
type OptimisticCartLine = CartLineInput & {
|
|
1300
|
+
selectedVariant?: unknown;
|
|
1301
|
+
};
|
|
1298
1302
|
type CartLinesAddProps = {
|
|
1299
1303
|
action: 'LinesAdd';
|
|
1300
1304
|
inputs?: {
|
|
1301
|
-
lines:
|
|
1305
|
+
lines: Array<OptimisticCartLine>;
|
|
1302
1306
|
} & OtherFormData;
|
|
1303
1307
|
};
|
|
1304
1308
|
type CartLinesAddRequire = {
|
|
1305
1309
|
action: 'LinesAdd';
|
|
1306
1310
|
inputs: {
|
|
1307
|
-
lines:
|
|
1311
|
+
lines: Array<OptimisticCartLine>;
|
|
1308
1312
|
} & OtherFormData;
|
|
1309
1313
|
};
|
|
1310
1314
|
type CartLinesUpdateProps = {
|
|
@@ -1459,7 +1463,7 @@ type CartGetOptions = CartQueryOptions & {
|
|
|
1459
1463
|
};
|
|
1460
1464
|
declare function cartGetDefault({ storefront, customerAccount, getCartId, cartFragment, }: CartGetOptions): CartGetFunction;
|
|
1461
1465
|
|
|
1462
|
-
type CartLinesAddFunction = (lines:
|
|
1466
|
+
type CartLinesAddFunction = (lines: Array<OptimisticCartLine>, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1463
1467
|
declare function cartLinesAddDefault(options: CartQueryOptions): CartLinesAddFunction;
|
|
1464
1468
|
|
|
1465
1469
|
type CartLinesUpdateFunction = (lines: CartLineUpdateInput[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
@@ -1534,6 +1538,21 @@ type HydrogenCartCustom<TCustomMethods extends Partial<HydrogenCart> & CustomMet
|
|
|
1534
1538
|
declare function createCartHandler(options: CartHandlerOptions): HydrogenCart;
|
|
1535
1539
|
declare function createCartHandler<TCustomMethods extends CustomMethodsBase>(options: CartHandlerOptionsWithCustom<TCustomMethods>): HydrogenCartCustom<TCustomMethods>;
|
|
1536
1540
|
|
|
1541
|
+
type OptimisticCart<T = ReturnType<typeof cartGetDefault>> = T & {
|
|
1542
|
+
isOptimistic?: boolean;
|
|
1543
|
+
lines: {
|
|
1544
|
+
nodes: Array<CartLine & {
|
|
1545
|
+
isOptimistic?: boolean;
|
|
1546
|
+
}>;
|
|
1547
|
+
};
|
|
1548
|
+
};
|
|
1549
|
+
/**
|
|
1550
|
+
* @param cart The cart object from `context.cart.get()` returned by a server loader.
|
|
1551
|
+
*
|
|
1552
|
+
* @returns A new cart object augmented with optimistic state. Each cart line item that is optimistically added includes an `isOptimistic` property. Also if the cart has _any_ optimistic state, a root property `isOptimistic` will be set to `true`.
|
|
1553
|
+
*/
|
|
1554
|
+
declare function useOptimisticCart<DefaultCart = CartReturn>(cart: DefaultCart): OptimisticCart<DefaultCart>;
|
|
1555
|
+
|
|
1537
1556
|
type VariantOption = {
|
|
1538
1557
|
name: string;
|
|
1539
1558
|
value?: string;
|
|
@@ -1545,6 +1564,7 @@ type VariantOptionValue = {
|
|
|
1545
1564
|
to: string;
|
|
1546
1565
|
search: string;
|
|
1547
1566
|
isActive: boolean;
|
|
1567
|
+
variant?: PartialDeep<ProductVariant>;
|
|
1548
1568
|
};
|
|
1549
1569
|
type VariantSelectorProps = {
|
|
1550
1570
|
/** The product handle for all of the variants */
|
|
@@ -1599,6 +1619,7 @@ type DirectiveValues = string[] | string | boolean;
|
|
|
1599
1619
|
type CreateContentSecurityPolicy = {
|
|
1600
1620
|
defaultSrc?: DirectiveValues;
|
|
1601
1621
|
scriptSrc?: DirectiveValues;
|
|
1622
|
+
scriptSrcElem?: DirectiveValues;
|
|
1602
1623
|
styleSrc?: DirectiveValues;
|
|
1603
1624
|
imgSrc?: DirectiveValues;
|
|
1604
1625
|
connectSrc?: DirectiveValues;
|
|
@@ -1734,7 +1755,7 @@ type CartLinePayload = {
|
|
|
1734
1755
|
};
|
|
1735
1756
|
type CollectionViewPayload = CollectionPayload & UrlPayload & BasePayload;
|
|
1736
1757
|
type ProductViewPayload = ProductsPayload & UrlPayload & BasePayload;
|
|
1737
|
-
type CartViewPayload = UrlPayload & BasePayload;
|
|
1758
|
+
type CartViewPayload = CartPayload & UrlPayload & BasePayload;
|
|
1738
1759
|
type PageViewPayload = UrlPayload & BasePayload;
|
|
1739
1760
|
type SearchViewPayload = SearchPayload & UrlPayload & BasePayload;
|
|
1740
1761
|
type CartUpdatePayload = CartPayload & BasePayload & OtherData;
|
|
@@ -1767,7 +1788,7 @@ declare function AnalyticsCartView(props: BasicViewProps): react_jsx_runtime.JSX
|
|
|
1767
1788
|
declare function AnalyticsSearchView(props: SearchViewProps): react_jsx_runtime.JSX.Element;
|
|
1768
1789
|
declare function AnalyticsCustomView(props: CustomViewProps): react_jsx_runtime.JSX.Element;
|
|
1769
1790
|
|
|
1770
|
-
type ConsentStatus =
|
|
1791
|
+
type ConsentStatus = boolean | undefined;
|
|
1771
1792
|
type VisitorConsent = {
|
|
1772
1793
|
marketing: ConsentStatus;
|
|
1773
1794
|
analytics: ConsentStatus;
|
|
@@ -1841,7 +1862,7 @@ type CustomerPrivacyApiProps = {
|
|
|
1841
1862
|
onReady?: () => void;
|
|
1842
1863
|
};
|
|
1843
1864
|
declare function useCustomerPrivacy(props: CustomerPrivacyApiProps): void;
|
|
1844
|
-
declare function getCustomerPrivacy():
|
|
1865
|
+
declare function getCustomerPrivacy(): CustomerPrivacy$1 | null;
|
|
1845
1866
|
|
|
1846
1867
|
type ShopAnalytics = {
|
|
1847
1868
|
/** The shop ID. */
|
|
@@ -1865,9 +1886,11 @@ type AnalyticsProviderProps = {
|
|
|
1865
1886
|
/** The shop configuration required to publish analytics events to Shopify. Use [`getShopAnalytics`](/docs/api/hydrogen/2024-04/utilities/getshopanalytics). */
|
|
1866
1887
|
shop: Promise<ShopAnalytics | null> | ShopAnalytics | null;
|
|
1867
1888
|
/** The customer privacy consent configuration and options. */
|
|
1868
|
-
consent: CustomerPrivacyApiProps
|
|
1869
|
-
/** Disable throwing errors when required props are missing. */
|
|
1889
|
+
consent: Partial<Pick<CustomerPrivacyApiProps, 'checkoutDomain' | 'storefrontAccessToken' | 'withPrivacyBanner'>>;
|
|
1890
|
+
/** @deprecated Disable throwing errors when required props are missing. */
|
|
1870
1891
|
disableThrowOnError?: boolean;
|
|
1892
|
+
/** The domain scope of the cookie set with `useShopifyCookies`. **/
|
|
1893
|
+
cookieDomain?: string;
|
|
1871
1894
|
};
|
|
1872
1895
|
type AnalyticsContextValue = {
|
|
1873
1896
|
/** A function to tell you the current state of if the user can be tracked by analytics. Defaults to Customer Privacy API's `window.Shopify.customerPrivacy.analyticsProcessingAllowed()`. */
|
|
@@ -1906,7 +1929,7 @@ declare function publish(event: typeof AnalyticsEvent.CART_UPDATED, payload: Car
|
|
|
1906
1929
|
declare function publish(event: typeof AnalyticsEvent.PRODUCT_ADD_TO_CART, payload: CartLineUpdatePayload): void;
|
|
1907
1930
|
declare function publish(event: typeof AnalyticsEvent.PRODUCT_REMOVED_FROM_CART, payload: CartLineUpdatePayload): void;
|
|
1908
1931
|
declare function publish(event: typeof AnalyticsEvent.CUSTOM_EVENT, payload: OtherData): void;
|
|
1909
|
-
declare function AnalyticsProvider({ canTrack: customCanTrack, cart: currentCart, children, consent, customData, shop: shopProp, disableThrowOnError, }: AnalyticsProviderProps): JSX.Element;
|
|
1932
|
+
declare function AnalyticsProvider({ canTrack: customCanTrack, cart: currentCart, children, consent, customData, shop: shopProp, disableThrowOnError, cookieDomain, }: AnalyticsProviderProps): JSX.Element;
|
|
1910
1933
|
declare function useAnalytics(): AnalyticsContextValue;
|
|
1911
1934
|
type ShopAnalyticsProps = {
|
|
1912
1935
|
/**
|
|
@@ -1928,4 +1951,6 @@ declare const Analytics: {
|
|
|
1928
1951
|
SearchView: typeof AnalyticsSearchView;
|
|
1929
1952
|
};
|
|
1930
1953
|
|
|
1931
|
-
|
|
1954
|
+
declare const RichText: typeof RichText$1;
|
|
1955
|
+
|
|
1956
|
+
export { Analytics, AnalyticsEvent, CacheCustom, CacheKey, CacheLong, CacheNone, CacheShort, CachingStrategy, CartActionInput, CartForm, CartLineUpdatePayload, CartQueryDataReturn, CartQueryOptions, CartQueryReturn, CartReturn, CartUpdatePayload, CartViewPayload, CollectionViewPayload, ConsentStatus, CookieOptions, CreateStorefrontClientForDocs, CreateStorefrontClientOptions, CustomEventMap$1 as CustomEventMap, CustomerAccount, CustomerAccountMutations, CustomerAccountQueries, CustomerPrivacy$1 as CustomerPrivacy, CustomerPrivacyApiProps, CustomerPrivacyConsentConfig, HydrogenCart, HydrogenCartCustom, HydrogenSession, HydrogenSessionData, I18nBase, InMemoryCache, MetafieldWithoutOwnerId, NoStoreStrategy, OptimisticCart, OptimisticCartLine, OptimisticInput, PageViewPayload, Pagination, PrivacyBanner$1 as PrivacyBanner, ProductViewPayload, RichText, Script, SearchViewPayload, Seo, SeoConfig, SeoHandleFunction, SetConsentHeadlessParams, ShopPayButton, Storefront, StorefrontApiErrors, StorefrontClient, StorefrontForDoc, StorefrontMutationOptionsForDocs, StorefrontMutations, StorefrontQueries, StorefrontQueryOptionsForDocs, VariantOption, VariantOptionValue, VariantSelector, VisitorConsent, VisitorConsentCollected, WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, changelogHandler, createCartHandler, createContentSecurityPolicy, createCustomerAccountClient, createStorefrontClient, createWithCache, formatAPIResult, generateCacheControlHeader, getCustomerPrivacy, getPaginationVariables, getSelectedProductOptions, getSeoMeta, getShopAnalytics, graphiqlLoader, storefrontRedirect, useAnalytics, useCustomerPrivacy, useNonce, useOptimisticCart, useOptimisticData };
|