@kotao/storefront 0.2.10 → 0.2.11

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/react.d.ts CHANGED
@@ -1,16 +1,15 @@
1
1
  import react__default, { ReactNode, ReactElement, ImgHTMLAttributes, VideoHTMLAttributes, ElementType, AnchorHTMLAttributes, CSSProperties, ComponentPropsWithoutRef, ComponentType } from 'react';
2
2
  import { FetcherWithComponents } from 'react-router';
3
3
  import { j as CartFormAction, a as CartLineInput } from './types-C4yXcret.js';
4
- import { g as getCartFormInput, S as ShopAnalytics, A as AnalyticsContext, C as ConsentState, a as AnalyticsEmitter, b as AnalyticsBus } from './shop-4y-4z3oZ.js';
5
- export { u as useNonce } from './shop-4y-4z3oZ.js';
4
+ import { R as getCartFormInput, z as ShopAnalytics, A as AnalyticsContext, a as ConsentState, f as AnalyticsEmitter, c as AnalyticsBus, p as ContentSecurityPolicyResult$1, r as CreateContentSecurityPolicyOptions } from './shop-wJdcWcVz.js';
6
5
  import { Cart } from './storefront-api-types.js';
7
6
  import { ImageAttrsOptions, ImageData, ImageCrop, ImageFormat } from './image.js';
8
- import { C as Connection, P as PaginationInfo } from './pagination-DCrQk02Q.js';
7
+ import { C as Connection, b as PaginationInfo } from './pagination-CPgH3fAa.js';
9
8
  import { S as SeoConfig } from './types-BkY0yET-.js';
10
9
  import { T as ThemeSettingsStore, R as ResolvedSettings, c as ThemeSettingsSnapshot } from './store-ZzoBbWir.js';
11
10
  import { S as SmartCartMountConfig, C as CartAdapter } from './cart-documents-BLavRDiu.js';
12
11
  export { R as REACT_SEAM_CART_DOCUMENTS, a as SmartCartBranding, b as SmartCartLine, c as SmartCartLineDiscount, d as SmartCartLineOption, e as SmartCartMoney, f as SmartCartState, g as createStorefrontApiCartAdapter } from './cart-documents-BLavRDiu.js';
13
- import { P as PublicForm, a as FormAnswers, b as FormFieldErrors } from './types-CSNXbGFW.js';
12
+ import { P as PublicForm, b as FormAnswers, e as FormFieldErrors } from './types-BTUTZXxJ.js';
14
13
  import { a as HydrogenEditorPreviewRuntime, x as HydrogenEditorReconciliationReason, l as HydrogenEditorInstanceSnapshot } from './hydrogen-CqDMW3YC.js';
15
14
  import '@kotao/storefront-contracts';
16
15
  import './bridge-CfNBWu0H.js';
@@ -232,6 +231,18 @@ interface MoneyProps {
232
231
  declare function useMoney(data: MoneyData): UseMoneyValue;
233
232
  declare function Money({ as: Component, data, withoutCurrency, withoutTrailingZeros, ...passthrough }: MoneyProps): ReactElement;
234
233
 
234
+ type BoundNonceProvider = (props: {
235
+ readonly children?: ReactNode;
236
+ }) => ReactNode;
237
+ /** Hydrogen-compatible nonce hook. */
238
+ declare function useNonce(): string | undefined;
239
+
240
+ interface ContentSecurityPolicyResult extends ContentSecurityPolicyResult$1 {
241
+ readonly NonceProvider: BoundNonceProvider;
242
+ }
243
+ /** Hydrogen's React-shaped result lives in the optional React preset. */
244
+ declare function createContentSecurityPolicy(options?: CreateContentSecurityPolicyOptions): ContentSecurityPolicyResult;
245
+
235
246
  type PaginationLinkProps = AnchorHTMLAttributes<HTMLAnchorElement>;
236
247
  interface HydrogenPaginationInfo<T = any> extends PaginationInfo<T> {
237
248
  readonly isLoading: boolean;
@@ -386,4 +397,4 @@ interface HydrogenEditorSlotProps {
386
397
  }
387
398
  declare function HydrogenEditorSlot({ empty, existingChildren, parentInstanceId, slotId, }: HydrogenEditorSlotProps): ReactElement;
388
399
 
389
- export { Analytics, AnalyticsCartView, type AnalyticsCartViewProps, AnalyticsCollectionView, type AnalyticsCollectionViewProps, AnalyticsProductView, type AnalyticsProductViewProps, AnalyticsProvider, type AnalyticsProviderProps, AnalyticsSearchView, type AnalyticsSearchViewProps, CartAdapter, CartDrawerOverlay, type CartDrawerOverlayProps, CartForm, type CartFormFetcher, type CartFormProps, type CartQueryDataReturn, type CartReturn, ConsentBanner, type ConsentBannerProps, type ConsentBannerRenderProps, HydrogenEditorBoundary, type HydrogenEditorBoundaryProps, HydrogenEditorProvider, type HydrogenEditorProviderProps, type HydrogenEditorReactInstance, type HydrogenEditorRegisteredComponent, type HydrogenEditorRegisteredComponentProps, HydrogenEditorSlot, type HydrogenEditorSlotProps, Image, type ImageProps, MediaFile, type MediaFileImageOptions, type MediaFileProps, type MediaFileVideoOptions, Money, type MoneyData, type MoneyProps, type OptimisticCartLineInput, OptimisticInput, type OptimisticInputData, type OptimisticInputProps, Pagination, type PaginationProps, Seo, type SeoProps, ShopPayButton, type ShopPayButtonProps, SmartCartMountConfig, StorefrontForm, StorefrontFormFields, type StorefrontFormFieldsProps, type StorefrontFormProps, ThemeSettingsProvider, type ThemeSettingsProviderProps, type UseMoneyValue, openSmartCart, useAnalytics, useGlobalThemeTokens, useHydrogenEditorInstance, useHydrogenEditorSlot, useMoney, useOptimisticData, useSectionSettings, useThemeSettings };
400
+ export { Analytics, AnalyticsCartView, type AnalyticsCartViewProps, AnalyticsCollectionView, type AnalyticsCollectionViewProps, AnalyticsProductView, type AnalyticsProductViewProps, AnalyticsProvider, type AnalyticsProviderProps, AnalyticsSearchView, type AnalyticsSearchViewProps, CartAdapter, CartDrawerOverlay, type CartDrawerOverlayProps, CartForm, type CartFormFetcher, type CartFormProps, type CartQueryDataReturn, type CartReturn, ConsentBanner, type ConsentBannerProps, type ConsentBannerRenderProps, type ContentSecurityPolicyResult, HydrogenEditorBoundary, type HydrogenEditorBoundaryProps, HydrogenEditorProvider, type HydrogenEditorProviderProps, type HydrogenEditorReactInstance, type HydrogenEditorRegisteredComponent, type HydrogenEditorRegisteredComponentProps, HydrogenEditorSlot, type HydrogenEditorSlotProps, Image, type ImageProps, MediaFile, type MediaFileImageOptions, type MediaFileProps, type MediaFileVideoOptions, Money, type MoneyData, type MoneyProps, type OptimisticCartLineInput, OptimisticInput, type OptimisticInputData, type OptimisticInputProps, Pagination, type PaginationProps, Seo, type SeoProps, ShopPayButton, type ShopPayButtonProps, SmartCartMountConfig, StorefrontForm, StorefrontFormFields, type StorefrontFormFieldsProps, type StorefrontFormProps, ThemeSettingsProvider, type ThemeSettingsProviderProps, type UseMoneyValue, createContentSecurityPolicy, openSmartCart, useAnalytics, useGlobalThemeTokens, useHydrogenEditorInstance, useHydrogenEditorSlot, useMoney, useNonce, useOptimisticData, useSectionSettings, useThemeSettings };
package/dist/react.js CHANGED
@@ -1,5 +1,4 @@
1
- import { getCartFormInput, createAnalyticsBus, collectAnalyticsAttribution, createPixelTransport } from './chunk-BV4OLXV4.js';
2
- export { useNonce } from './chunk-BV4OLXV4.js';
1
+ import { getCartFormInput, createAnalyticsBus, collectAnalyticsAttribution, createPixelTransport, createContentSecurityPolicy } from './chunk-NRWS7HJ2.js';
3
2
  import { getPaginationInfo } from './chunk-5QOFKGKD.js';
4
3
  import { CART_FORM_ACTIONS, DENIED_CONSENT, mergeConsent, buildConsentCookie, readConsentCookie, CONSENT_COOKIE } from './chunk-GR4QJ7EC.js';
5
4
  import { getSeoMeta, serializeJsonLd } from './chunk-SVMYFYIA.js';
@@ -8,6 +7,7 @@ import { resolveHydrogenEditorStyles } from './chunk-XXNCFWXT.js';
8
7
  export { StorefrontForm, StorefrontFormFields } from './chunk-VV653S52.js';
9
8
  import './chunk-IIOHENCG.js';
10
9
  import { buildImageAttrs } from './chunk-PWVXOMDE.js';
10
+ import * as ReactRuntime from 'react';
11
11
  import { createContext, useState, useRef, useMemo, useEffect, useCallback, useContext, useSyncExternalStore, Children, isValidElement, cloneElement, createElement } from 'react';
12
12
  import { useFetcher } from 'react-router';
13
13
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -512,6 +512,28 @@ function Money({
512
512
  const text = data == null ? "" : withoutCurrency === true ? useMoney(data).withoutTrailingZerosAndCurrency : withoutTrailingZeros === true ? useMoney(data).withoutTrailingZeros : useMoney(data).localizedString;
513
513
  return /* @__PURE__ */ jsx(Component, { ...passthrough, children: text });
514
514
  }
515
+ var NonceContext = createContext(void 0);
516
+ function createNonceProvider(nonce) {
517
+ return function BoundNonceProvider(props) {
518
+ return createElement(NonceContext.Provider, { value: nonce }, props.children);
519
+ };
520
+ }
521
+ function useNonce() {
522
+ if (!hasReactDispatcher()) return void 0;
523
+ return useContext(NonceContext);
524
+ }
525
+ function hasReactDispatcher() {
526
+ const runtime = ReactRuntime;
527
+ return Boolean(
528
+ runtime.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE?.H ?? runtime.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentDispatcher?.current
529
+ );
530
+ }
531
+
532
+ // src/react/content-security-policy.ts
533
+ function createContentSecurityPolicy2(options = {}) {
534
+ const policy = createContentSecurityPolicy(options);
535
+ return { ...policy, NonceProvider: createNonceProvider(policy.nonce) };
536
+ }
515
537
  function Pagination({
516
538
  connection,
517
539
  currentUrl,
@@ -2341,6 +2363,6 @@ function HydrogenEditorSlot({
2341
2363
  );
2342
2364
  }
2343
2365
 
2344
- export { Analytics, AnalyticsCartView, AnalyticsCollectionView, AnalyticsProductView, AnalyticsProvider, AnalyticsSearchView, CartDrawerOverlay, CartForm, ConsentBanner, HydrogenEditorBoundary, HydrogenEditorProvider, HydrogenEditorSlot, Image, MediaFile, Money, OptimisticInput, Pagination, Seo, ShopPayButton, ThemeSettingsProvider, openSmartCart, useAnalytics, useGlobalThemeTokens, useHydrogenEditorInstance, useHydrogenEditorSlot, useMoney, useOptimisticData, useSectionSettings, useThemeSettings };
2366
+ export { Analytics, AnalyticsCartView, AnalyticsCollectionView, AnalyticsProductView, AnalyticsProvider, AnalyticsSearchView, CartDrawerOverlay, CartForm, ConsentBanner, HydrogenEditorBoundary, HydrogenEditorProvider, HydrogenEditorSlot, Image, MediaFile, Money, OptimisticInput, Pagination, Seo, ShopPayButton, ThemeSettingsProvider, createContentSecurityPolicy2 as createContentSecurityPolicy, openSmartCart, useAnalytics, useGlobalThemeTokens, useHydrogenEditorInstance, useHydrogenEditorSlot, useMoney, useNonce, useOptimisticData, useSectionSettings, useThemeSettings };
2345
2367
  //# sourceMappingURL=react.js.map
2346
2368
  //# sourceMappingURL=react.js.map