@nevios/storefront-kit 1.3.0 → 1.4.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- import { StorefrontClient, Money, Product, ProductMedia, ProductVariant, CollectionDetail, ProductSort, Cart, AddLineInput, CartLine, Checkout, CreateCheckoutInput, SetAddressInput, ShippingQuote, PaymentMethod, OrderStatus, PaymentState, OrderPhase, PaymentInstructions, Customer, MagicLinkResult, ReorderResult } from '@nevios/storefront-js';
2
+ import * as _nevios_storefront_js from '@nevios/storefront-js';
3
+ import { StorefrontClient, Money, Product, ProductMedia, ProductVariant, CollectionDetail, ProductSort, SubscriptionPlan, Cart, AddLineInput, UpdateCartLineInput, CartLine, SubscriptionSelection, SubscriptionQuote, Checkout, CreateCheckoutInput, SetAddressInput, ShippingQuote, PaymentMethod, SubscriptionAcceptance, SubscriptionEnrollmentResult, SubscriptionPayment, OrderStatus, PaymentState, OrderPhase, PaymentInstructions, Customer, MagicLinkResult, ReorderResult, SubscriptionDetails, Subscription } from '@nevios/storefront-js';
3
4
 
4
5
  /**
5
6
  * NeviosProvider — puts a configured storefront client on React context so
@@ -71,6 +72,16 @@ declare function ThemeProvider({ theme, children, as: Tag, }: ThemeProviderProps
71
72
  * provider picks the category for the active locale via `Intl.PluralRules`.
72
73
  */
73
74
  declare const en: {
75
+ "subscriptions.purchaseOption": string;
76
+ "subscriptions.empty": string;
77
+ "subscriptions.status.active": string;
78
+ "subscriptions.status.paused": string;
79
+ "subscriptions.status.pending": string;
80
+ "subscriptions.status.cancelled": string;
81
+ "subscriptions.title": string;
82
+ "subscriptions.consent": string;
83
+ "subscriptions.eachDelivery": string;
84
+ "subscriptions.once": string;
74
85
  "common.free": string;
75
86
  "common.close": string;
76
87
  "common.loadingShort": string;
@@ -510,6 +521,16 @@ interface TagFilterProps {
510
521
  /** Toggleable tag chips. Multi-select; emits the selected list. */
511
522
  declare function TagFilter({ tags, selected, onChange }: TagFilterProps): React.ReactElement | null;
512
523
 
524
+ /** Controlled PDP selector. Pass value to AddToCart.subscriptionPlanId.
525
+ * Plans and prices must come from client.subscriptions.plans(variantId). */
526
+ declare function PurchaseOptions({ plans, value, onChange, disabled, locale }: {
527
+ plans: SubscriptionPlan[];
528
+ value: string | null;
529
+ onChange(planId: string | null): void;
530
+ disabled?: boolean;
531
+ locale?: string;
532
+ }): React.ReactElement;
533
+
513
534
  /**
514
535
  * CartProvider + useCart — shared cart state for the whole app. The drawer, the
515
536
  * PDP add-to-cart, and a header cart count all read the same cart and re-render
@@ -527,8 +548,9 @@ interface CartState {
527
548
  loading: boolean;
528
549
  itemCount: number;
529
550
  addLine(input: AddLineInput): Promise<Cart>;
530
- updateLine(lineId: string, quantity: number): Promise<Cart>;
551
+ updateLine(lineId: string, quantity: number | UpdateCartLineInput): Promise<Cart>;
531
552
  removeLine(lineId: string): Promise<Cart>;
553
+ clearSubscription(): Promise<Cart>;
532
554
  /** Re-fetch the cart from the server. */
533
555
  refresh(): Promise<void>;
534
556
  }
@@ -547,11 +569,12 @@ declare function useCart(): CartState;
547
569
  interface AddToCartProps {
548
570
  variant: ProductVariant | null;
549
571
  quantity?: number;
572
+ subscriptionPlanId?: string | null;
550
573
  /** Button label. Defaults to "Add to cart". */
551
574
  children?: React.ReactNode;
552
575
  onAdded?: () => void;
553
576
  }
554
- declare function AddToCart({ variant, quantity, children, onAdded, }: AddToCartProps): React.ReactElement;
577
+ declare function AddToCart({ variant, quantity, subscriptionPlanId, children, onAdded, }: AddToCartProps): React.ReactElement;
555
578
 
556
579
  /**
557
580
  * CartLineItem — one cart row: thumbnail, title + variant, a quantity stepper,
@@ -615,8 +638,16 @@ type PayResult = {
615
638
  } | {
616
639
  kind: "order";
617
640
  checkout: Checkout;
641
+ } | {
642
+ kind: "subscription";
643
+ subscription: SubscriptionEnrollmentResult;
644
+ } | {
645
+ kind: "subscription_payment";
646
+ payment: SubscriptionPayment;
618
647
  };
619
648
  interface PayOptions {
649
+ /** Explicit acceptance of the currently displayed recurring quote. */
650
+ subscription?: SubscriptionAcceptance;
620
651
  /** Where the gateway returns the customer after paying. */
621
652
  returnUrl?: string;
622
653
  /** Where the gateway returns the customer on cancel. */
@@ -629,6 +660,9 @@ interface PayOptions {
629
660
  redirect?: boolean;
630
661
  }
631
662
  interface CheckoutState {
663
+ selectSubscription(selection: SubscriptionSelection): Promise<SubscriptionQuote>;
664
+ clearSubscription(): Promise<Checkout>;
665
+ reviewSubscription(): Promise<SubscriptionQuote>;
632
666
  checkout: Checkout | null;
633
667
  /** True while a checkout request is in flight. */
634
668
  loading: boolean;
@@ -678,6 +712,8 @@ declare function useCheckout(): CheckoutState;
678
712
  interface CheckoutFlowProps {
679
713
  /** If set and no checkout exists yet, create one from this cart token. */
680
714
  cartToken?: string;
715
+ /** Confirm with Stripe.js, then the flow refreshes the server payment state. */
716
+ onSubscriptionPayment?: (payment: SubscriptionPayment) => void | Promise<void>;
681
717
  /** Called when a (non-gateway) order is placed. Gateway flows redirect away
682
718
  * before this fires. */
683
719
  onOrderPlaced?: (checkout: Checkout) => void;
@@ -690,7 +726,7 @@ interface CheckoutFlowProps {
690
726
  cancelUrl?: string;
691
727
  locale?: string;
692
728
  }
693
- declare function CheckoutFlow({ cartToken, onOrderPlaced, emptyState, renderConfirmation, returnUrl, cancelUrl, locale, }: CheckoutFlowProps): React.ReactElement;
729
+ declare function CheckoutFlow({ cartToken, onSubscriptionPayment, onOrderPlaced, emptyState, renderConfirmation, returnUrl, cancelUrl, locale, }: CheckoutFlowProps): React.ReactElement;
694
730
 
695
731
  /**
696
732
  * AddressForm — collects email + shipping address (the checkout's first step).
@@ -731,7 +767,7 @@ declare function ShippingPicker({ title, submitLabel, onComplete, locale, }: Shi
731
767
  * one, and places the order. The category drives the final action:
732
768
  * • gateway → `pay()` starts the payment and redirects to the gateway
733
769
  * • cod/bank/manual → `pay()` completes the order directly → `onOrderPlaced`
734
- * The storefront never embeds a gateway — paying a card means a redirect.
770
+ * Recurring Stripe payments use the merchant's Stripe.js callback.
735
771
  */
736
772
 
737
773
  interface PaymentSectionProps {
@@ -743,8 +779,10 @@ interface PaymentSectionProps {
743
779
  /** Called when a non-gateway order is placed (gateway flows redirect away). */
744
780
  onOrderPlaced?: (checkout: Checkout) => void;
745
781
  locale?: string;
782
+ /** Confirm the returned intent using your Stripe.js Payment Element. */
783
+ onSubscriptionPayment?: (payment: SubscriptionPayment) => void | Promise<void>;
746
784
  }
747
- declare function PaymentSection({ title, returnUrl, cancelUrl, onOrderPlaced, locale, }: PaymentSectionProps): React.ReactElement;
785
+ declare function PaymentSection({ title, returnUrl, cancelUrl, onOrderPlaced, locale, onSubscriptionPayment, }: PaymentSectionProps): React.ReactElement;
748
786
 
749
787
  /**
750
788
  * OrderSummary — the checkout's running total: line items + the full breakdown
@@ -761,6 +799,14 @@ interface OrderSummaryProps {
761
799
  }
762
800
  declare function OrderSummary({ checkout: override, totalsOnly, locale, }: OrderSummaryProps): React.ReactElement | null;
763
801
 
802
+ /** Displays the exact server quote. Never pre-check consent or calculate a discount. */
803
+ declare function SubscriptionTerms({ quote, checked, onChange, locale }: {
804
+ quote: SubscriptionQuote;
805
+ checked: boolean;
806
+ onChange(checked: boolean): void;
807
+ locale?: string;
808
+ }): React.ReactElement;
809
+
764
810
  interface OrderStatusState {
765
811
  order: OrderStatus | null;
766
812
  loading: boolean;
@@ -1051,6 +1097,68 @@ declare function ProfileEditor(): React.ReactElement | null;
1051
1097
  /** Email verification, session revocation and explicit account-closure confirmation. */
1052
1098
  declare function AccountSecurity(): React.ReactElement | null;
1053
1099
 
1100
+ /** Customer-only API plus reload-safe query state. Changing a saved account
1101
+ * address never silently changes a recurring contract; preview/commit explicitly. */
1102
+ declare function useCustomerSubscriptions(): {
1103
+ subscriptions: Subscription[];
1104
+ loading: boolean;
1105
+ error: Error | null;
1106
+ refresh: () => Promise<void>;
1107
+ api: {
1108
+ plans(variantId: string, marketId?: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionPlan[]>;
1109
+ select(checkoutToken: string, selection: _nevios_storefront_js.SubscriptionSelection, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionQuote>;
1110
+ clear(checkoutToken: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<void>;
1111
+ enroll(checkoutToken: string, selection: _nevios_storefront_js.SubscriptionEnrollment, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionEnrollmentResult>;
1112
+ checkoutPayment(checkoutToken: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionPayment>;
1113
+ list(opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription[]>;
1114
+ get(id: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription>;
1115
+ management(id: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<SubscriptionDetails>;
1116
+ command: (id: string, body: _nevios_storefront_js.SubscriptionCommand, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1117
+ pause: (id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1118
+ resume: (id: string, expectedVersion: number, nextAt: string, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1119
+ skipNext: (id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1120
+ cancel: (id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1121
+ payment(id: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionPayment>;
1122
+ previewChanges(id: string, changes: _nevios_storefront_js.SubscriptionChanges, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionChangeQuote>;
1123
+ commitChanges(id: string, changes: _nevios_storefront_js.SubscriptionChanges, quote: _nevios_storefront_js.SubscriptionChangeQuote, consentEvidence: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription>;
1124
+ confirmCard(id: string, setupIntentId: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription>;
1125
+ replaceCard(id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionCardSetup>;
1126
+ };
1127
+ };
1128
+ /** Unified upcoming/history/items view. Async results never survive a logout or
1129
+ * switching customer/contract. Call refresh after an explicitly reviewed change. */
1130
+ declare function useCustomerSubscription(id: string | null): {
1131
+ subscription: SubscriptionDetails | null;
1132
+ loading: boolean;
1133
+ error: Error | null;
1134
+ refresh: () => Promise<void>;
1135
+ api: {
1136
+ plans(variantId: string, marketId?: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionPlan[]>;
1137
+ select(checkoutToken: string, selection: _nevios_storefront_js.SubscriptionSelection, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionQuote>;
1138
+ clear(checkoutToken: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<void>;
1139
+ enroll(checkoutToken: string, selection: _nevios_storefront_js.SubscriptionEnrollment, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionEnrollmentResult>;
1140
+ checkoutPayment(checkoutToken: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionPayment>;
1141
+ list(opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription[]>;
1142
+ get(id: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription>;
1143
+ management(id: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<SubscriptionDetails>;
1144
+ command: (id: string, body: _nevios_storefront_js.SubscriptionCommand, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1145
+ pause: (id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1146
+ resume: (id: string, expectedVersion: number, nextAt: string, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1147
+ skipNext: (id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1148
+ cancel: (id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1149
+ payment(id: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionPayment>;
1150
+ previewChanges(id: string, changes: _nevios_storefront_js.SubscriptionChanges, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionChangeQuote>;
1151
+ commitChanges(id: string, changes: _nevios_storefront_js.SubscriptionChanges, quote: _nevios_storefront_js.SubscriptionChangeQuote, consentEvidence: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription>;
1152
+ confirmCard(id: string, setupIntentId: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription>;
1153
+ replaceCard(id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionCardSetup>;
1154
+ };
1155
+ };
1156
+
1157
+ declare function SubscriptionList({ href, locale }: {
1158
+ href(id: string): string;
1159
+ locale?: string;
1160
+ }): React.ReactElement;
1161
+
1054
1162
  /**
1055
1163
  * ProductJsonLd — schema.org/Product structured data for rich results (price,
1056
1164
  * availability, brand). Drop it in the PDP <head> (or anywhere; it's a script).
@@ -1127,4 +1235,4 @@ interface JsonLdProps {
1127
1235
  /** Render a JSON-LD `<script>` for the given (already-shaped) data object. */
1128
1236
  declare function JsonLd({ data }: JsonLdProps): React.ReactElement;
1129
1237
 
1130
- export { AccountDashboard, type AccountDashboardProps, AccountProvider, AccountSecurity, type AccountState, AddToCart, type AddToCartProps, AddressBook, AddressForm, type AddressFormProps, AvailabilityFilter, type AvailabilityFilterProps, BackInStockForm, type BackInStockFormProps, type BreadcrumbItem, BreadcrumbJsonLd, type BreadcrumbJsonLdProps, CartDrawer, type CartDrawerProps, CartLineItem, type CartLineItemProps, CartProvider, type CartState, CartSummary, type CartSummaryProps, CheckoutFlow, type CheckoutFlowProps, CheckoutProvider, type CheckoutState, CollectionPage, type CollectionPageProps, I18nProvider, type I18nProviderProps, type I18nValue, JsonLd, type JsonLdProps, LoginForm, type LoginFormProps, type MarketOption, MarketSwitcher, type MarketSwitcherProps, type MessageKey, type Messages, NeviosProvider, type NeviosProviderProps, OrderConfirmation, type OrderConfirmationProps, OrderHistory, type OrderHistoryProps, OrderLines, OrderStatusPage, type OrderStatusPageProps, type OrderStatusState, OrderSummary, type OrderSummaryProps, OrderTotals, OrganizationJsonLd, type OrganizationJsonLdProps, type PayOptions, type PayResult, PaymentMethodPicker, type PaymentMethodPickerProps, PaymentPage, type PaymentPageProps, type PaymentPageState, PaymentSection, type PaymentSectionProps, PhaseTimeline, PriceMoney, type PriceMoneyProps, PriceRangeFilter, type PriceRangeFilterProps, ProductCard, type ProductCardProps, ProductDetailPage, type ProductDetailPageProps, ProductGallery, type ProductGalleryProps, ProductJsonLd, type ProductJsonLdProps, ProfileEditor, ShippingPicker, type ShippingPickerProps, SortSelect, type SortSelectProps, StatusBanner, StockBadge, type StockBadgeProps, type StorefrontTheme, type TFunction, type TVars, TagFilter, type TagFilterProps, ThemeProvider, type ThemeProviderProps, TransferInstructions, type TransferInstructionsProps, VariantPicker, type VariantPickerProps, type VerifyStatus, absoluteUrl, bundledMessages, cs, en, formatCents, formatMoney, isTerminal, serializeJsonLd, stripHtml, themeToCssVars, useAccount, useCart, useCheckout, useI18n, useMagicLinkVerify, useOrderStatus, usePayment, useStorefront, useStorefrontOptional, useT };
1238
+ export { AccountDashboard, type AccountDashboardProps, AccountProvider, AccountSecurity, type AccountState, AddToCart, type AddToCartProps, AddressBook, AddressForm, type AddressFormProps, AvailabilityFilter, type AvailabilityFilterProps, BackInStockForm, type BackInStockFormProps, type BreadcrumbItem, BreadcrumbJsonLd, type BreadcrumbJsonLdProps, CartDrawer, type CartDrawerProps, CartLineItem, type CartLineItemProps, CartProvider, type CartState, CartSummary, type CartSummaryProps, CheckoutFlow, type CheckoutFlowProps, CheckoutProvider, type CheckoutState, CollectionPage, type CollectionPageProps, I18nProvider, type I18nProviderProps, type I18nValue, JsonLd, type JsonLdProps, LoginForm, type LoginFormProps, type MarketOption, MarketSwitcher, type MarketSwitcherProps, type MessageKey, type Messages, NeviosProvider, type NeviosProviderProps, OrderConfirmation, type OrderConfirmationProps, OrderHistory, type OrderHistoryProps, OrderLines, OrderStatusPage, type OrderStatusPageProps, type OrderStatusState, OrderSummary, type OrderSummaryProps, OrderTotals, OrganizationJsonLd, type OrganizationJsonLdProps, type PayOptions, type PayResult, PaymentMethodPicker, type PaymentMethodPickerProps, PaymentPage, type PaymentPageProps, type PaymentPageState, PaymentSection, type PaymentSectionProps, PhaseTimeline, PriceMoney, type PriceMoneyProps, PriceRangeFilter, type PriceRangeFilterProps, ProductCard, type ProductCardProps, ProductDetailPage, type ProductDetailPageProps, ProductGallery, type ProductGalleryProps, ProductJsonLd, type ProductJsonLdProps, ProfileEditor, PurchaseOptions, ShippingPicker, type ShippingPickerProps, SortSelect, type SortSelectProps, StatusBanner, StockBadge, type StockBadgeProps, type StorefrontTheme, SubscriptionList, SubscriptionTerms, type TFunction, type TVars, TagFilter, type TagFilterProps, ThemeProvider, type ThemeProviderProps, TransferInstructions, type TransferInstructionsProps, VariantPicker, type VariantPickerProps, type VerifyStatus, absoluteUrl, bundledMessages, cs, en, formatCents, formatMoney, isTerminal, serializeJsonLd, stripHtml, themeToCssVars, useAccount, useCart, useCheckout, useCustomerSubscription, useCustomerSubscriptions, useI18n, useMagicLinkVerify, useOrderStatus, usePayment, useStorefront, useStorefrontOptional, useT };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- import { StorefrontClient, Money, Product, ProductMedia, ProductVariant, CollectionDetail, ProductSort, Cart, AddLineInput, CartLine, Checkout, CreateCheckoutInput, SetAddressInput, ShippingQuote, PaymentMethod, OrderStatus, PaymentState, OrderPhase, PaymentInstructions, Customer, MagicLinkResult, ReorderResult } from '@nevios/storefront-js';
2
+ import * as _nevios_storefront_js from '@nevios/storefront-js';
3
+ import { StorefrontClient, Money, Product, ProductMedia, ProductVariant, CollectionDetail, ProductSort, SubscriptionPlan, Cart, AddLineInput, UpdateCartLineInput, CartLine, SubscriptionSelection, SubscriptionQuote, Checkout, CreateCheckoutInput, SetAddressInput, ShippingQuote, PaymentMethod, SubscriptionAcceptance, SubscriptionEnrollmentResult, SubscriptionPayment, OrderStatus, PaymentState, OrderPhase, PaymentInstructions, Customer, MagicLinkResult, ReorderResult, SubscriptionDetails, Subscription } from '@nevios/storefront-js';
3
4
 
4
5
  /**
5
6
  * NeviosProvider — puts a configured storefront client on React context so
@@ -71,6 +72,16 @@ declare function ThemeProvider({ theme, children, as: Tag, }: ThemeProviderProps
71
72
  * provider picks the category for the active locale via `Intl.PluralRules`.
72
73
  */
73
74
  declare const en: {
75
+ "subscriptions.purchaseOption": string;
76
+ "subscriptions.empty": string;
77
+ "subscriptions.status.active": string;
78
+ "subscriptions.status.paused": string;
79
+ "subscriptions.status.pending": string;
80
+ "subscriptions.status.cancelled": string;
81
+ "subscriptions.title": string;
82
+ "subscriptions.consent": string;
83
+ "subscriptions.eachDelivery": string;
84
+ "subscriptions.once": string;
74
85
  "common.free": string;
75
86
  "common.close": string;
76
87
  "common.loadingShort": string;
@@ -510,6 +521,16 @@ interface TagFilterProps {
510
521
  /** Toggleable tag chips. Multi-select; emits the selected list. */
511
522
  declare function TagFilter({ tags, selected, onChange }: TagFilterProps): React.ReactElement | null;
512
523
 
524
+ /** Controlled PDP selector. Pass value to AddToCart.subscriptionPlanId.
525
+ * Plans and prices must come from client.subscriptions.plans(variantId). */
526
+ declare function PurchaseOptions({ plans, value, onChange, disabled, locale }: {
527
+ plans: SubscriptionPlan[];
528
+ value: string | null;
529
+ onChange(planId: string | null): void;
530
+ disabled?: boolean;
531
+ locale?: string;
532
+ }): React.ReactElement;
533
+
513
534
  /**
514
535
  * CartProvider + useCart — shared cart state for the whole app. The drawer, the
515
536
  * PDP add-to-cart, and a header cart count all read the same cart and re-render
@@ -527,8 +548,9 @@ interface CartState {
527
548
  loading: boolean;
528
549
  itemCount: number;
529
550
  addLine(input: AddLineInput): Promise<Cart>;
530
- updateLine(lineId: string, quantity: number): Promise<Cart>;
551
+ updateLine(lineId: string, quantity: number | UpdateCartLineInput): Promise<Cart>;
531
552
  removeLine(lineId: string): Promise<Cart>;
553
+ clearSubscription(): Promise<Cart>;
532
554
  /** Re-fetch the cart from the server. */
533
555
  refresh(): Promise<void>;
534
556
  }
@@ -547,11 +569,12 @@ declare function useCart(): CartState;
547
569
  interface AddToCartProps {
548
570
  variant: ProductVariant | null;
549
571
  quantity?: number;
572
+ subscriptionPlanId?: string | null;
550
573
  /** Button label. Defaults to "Add to cart". */
551
574
  children?: React.ReactNode;
552
575
  onAdded?: () => void;
553
576
  }
554
- declare function AddToCart({ variant, quantity, children, onAdded, }: AddToCartProps): React.ReactElement;
577
+ declare function AddToCart({ variant, quantity, subscriptionPlanId, children, onAdded, }: AddToCartProps): React.ReactElement;
555
578
 
556
579
  /**
557
580
  * CartLineItem — one cart row: thumbnail, title + variant, a quantity stepper,
@@ -615,8 +638,16 @@ type PayResult = {
615
638
  } | {
616
639
  kind: "order";
617
640
  checkout: Checkout;
641
+ } | {
642
+ kind: "subscription";
643
+ subscription: SubscriptionEnrollmentResult;
644
+ } | {
645
+ kind: "subscription_payment";
646
+ payment: SubscriptionPayment;
618
647
  };
619
648
  interface PayOptions {
649
+ /** Explicit acceptance of the currently displayed recurring quote. */
650
+ subscription?: SubscriptionAcceptance;
620
651
  /** Where the gateway returns the customer after paying. */
621
652
  returnUrl?: string;
622
653
  /** Where the gateway returns the customer on cancel. */
@@ -629,6 +660,9 @@ interface PayOptions {
629
660
  redirect?: boolean;
630
661
  }
631
662
  interface CheckoutState {
663
+ selectSubscription(selection: SubscriptionSelection): Promise<SubscriptionQuote>;
664
+ clearSubscription(): Promise<Checkout>;
665
+ reviewSubscription(): Promise<SubscriptionQuote>;
632
666
  checkout: Checkout | null;
633
667
  /** True while a checkout request is in flight. */
634
668
  loading: boolean;
@@ -678,6 +712,8 @@ declare function useCheckout(): CheckoutState;
678
712
  interface CheckoutFlowProps {
679
713
  /** If set and no checkout exists yet, create one from this cart token. */
680
714
  cartToken?: string;
715
+ /** Confirm with Stripe.js, then the flow refreshes the server payment state. */
716
+ onSubscriptionPayment?: (payment: SubscriptionPayment) => void | Promise<void>;
681
717
  /** Called when a (non-gateway) order is placed. Gateway flows redirect away
682
718
  * before this fires. */
683
719
  onOrderPlaced?: (checkout: Checkout) => void;
@@ -690,7 +726,7 @@ interface CheckoutFlowProps {
690
726
  cancelUrl?: string;
691
727
  locale?: string;
692
728
  }
693
- declare function CheckoutFlow({ cartToken, onOrderPlaced, emptyState, renderConfirmation, returnUrl, cancelUrl, locale, }: CheckoutFlowProps): React.ReactElement;
729
+ declare function CheckoutFlow({ cartToken, onSubscriptionPayment, onOrderPlaced, emptyState, renderConfirmation, returnUrl, cancelUrl, locale, }: CheckoutFlowProps): React.ReactElement;
694
730
 
695
731
  /**
696
732
  * AddressForm — collects email + shipping address (the checkout's first step).
@@ -731,7 +767,7 @@ declare function ShippingPicker({ title, submitLabel, onComplete, locale, }: Shi
731
767
  * one, and places the order. The category drives the final action:
732
768
  * • gateway → `pay()` starts the payment and redirects to the gateway
733
769
  * • cod/bank/manual → `pay()` completes the order directly → `onOrderPlaced`
734
- * The storefront never embeds a gateway — paying a card means a redirect.
770
+ * Recurring Stripe payments use the merchant's Stripe.js callback.
735
771
  */
736
772
 
737
773
  interface PaymentSectionProps {
@@ -743,8 +779,10 @@ interface PaymentSectionProps {
743
779
  /** Called when a non-gateway order is placed (gateway flows redirect away). */
744
780
  onOrderPlaced?: (checkout: Checkout) => void;
745
781
  locale?: string;
782
+ /** Confirm the returned intent using your Stripe.js Payment Element. */
783
+ onSubscriptionPayment?: (payment: SubscriptionPayment) => void | Promise<void>;
746
784
  }
747
- declare function PaymentSection({ title, returnUrl, cancelUrl, onOrderPlaced, locale, }: PaymentSectionProps): React.ReactElement;
785
+ declare function PaymentSection({ title, returnUrl, cancelUrl, onOrderPlaced, locale, onSubscriptionPayment, }: PaymentSectionProps): React.ReactElement;
748
786
 
749
787
  /**
750
788
  * OrderSummary — the checkout's running total: line items + the full breakdown
@@ -761,6 +799,14 @@ interface OrderSummaryProps {
761
799
  }
762
800
  declare function OrderSummary({ checkout: override, totalsOnly, locale, }: OrderSummaryProps): React.ReactElement | null;
763
801
 
802
+ /** Displays the exact server quote. Never pre-check consent or calculate a discount. */
803
+ declare function SubscriptionTerms({ quote, checked, onChange, locale }: {
804
+ quote: SubscriptionQuote;
805
+ checked: boolean;
806
+ onChange(checked: boolean): void;
807
+ locale?: string;
808
+ }): React.ReactElement;
809
+
764
810
  interface OrderStatusState {
765
811
  order: OrderStatus | null;
766
812
  loading: boolean;
@@ -1051,6 +1097,68 @@ declare function ProfileEditor(): React.ReactElement | null;
1051
1097
  /** Email verification, session revocation and explicit account-closure confirmation. */
1052
1098
  declare function AccountSecurity(): React.ReactElement | null;
1053
1099
 
1100
+ /** Customer-only API plus reload-safe query state. Changing a saved account
1101
+ * address never silently changes a recurring contract; preview/commit explicitly. */
1102
+ declare function useCustomerSubscriptions(): {
1103
+ subscriptions: Subscription[];
1104
+ loading: boolean;
1105
+ error: Error | null;
1106
+ refresh: () => Promise<void>;
1107
+ api: {
1108
+ plans(variantId: string, marketId?: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionPlan[]>;
1109
+ select(checkoutToken: string, selection: _nevios_storefront_js.SubscriptionSelection, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionQuote>;
1110
+ clear(checkoutToken: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<void>;
1111
+ enroll(checkoutToken: string, selection: _nevios_storefront_js.SubscriptionEnrollment, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionEnrollmentResult>;
1112
+ checkoutPayment(checkoutToken: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionPayment>;
1113
+ list(opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription[]>;
1114
+ get(id: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription>;
1115
+ management(id: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<SubscriptionDetails>;
1116
+ command: (id: string, body: _nevios_storefront_js.SubscriptionCommand, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1117
+ pause: (id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1118
+ resume: (id: string, expectedVersion: number, nextAt: string, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1119
+ skipNext: (id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1120
+ cancel: (id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1121
+ payment(id: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionPayment>;
1122
+ previewChanges(id: string, changes: _nevios_storefront_js.SubscriptionChanges, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionChangeQuote>;
1123
+ commitChanges(id: string, changes: _nevios_storefront_js.SubscriptionChanges, quote: _nevios_storefront_js.SubscriptionChangeQuote, consentEvidence: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription>;
1124
+ confirmCard(id: string, setupIntentId: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription>;
1125
+ replaceCard(id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionCardSetup>;
1126
+ };
1127
+ };
1128
+ /** Unified upcoming/history/items view. Async results never survive a logout or
1129
+ * switching customer/contract. Call refresh after an explicitly reviewed change. */
1130
+ declare function useCustomerSubscription(id: string | null): {
1131
+ subscription: SubscriptionDetails | null;
1132
+ loading: boolean;
1133
+ error: Error | null;
1134
+ refresh: () => Promise<void>;
1135
+ api: {
1136
+ plans(variantId: string, marketId?: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionPlan[]>;
1137
+ select(checkoutToken: string, selection: _nevios_storefront_js.SubscriptionSelection, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionQuote>;
1138
+ clear(checkoutToken: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<void>;
1139
+ enroll(checkoutToken: string, selection: _nevios_storefront_js.SubscriptionEnrollment, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionEnrollmentResult>;
1140
+ checkoutPayment(checkoutToken: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionPayment>;
1141
+ list(opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription[]>;
1142
+ get(id: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription>;
1143
+ management(id: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<SubscriptionDetails>;
1144
+ command: (id: string, body: _nevios_storefront_js.SubscriptionCommand, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1145
+ pause: (id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1146
+ resume: (id: string, expectedVersion: number, nextAt: string, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1147
+ skipNext: (id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1148
+ cancel: (id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions) => Promise<Subscription>;
1149
+ payment(id: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionPayment>;
1150
+ previewChanges(id: string, changes: _nevios_storefront_js.SubscriptionChanges, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionChangeQuote>;
1151
+ commitChanges(id: string, changes: _nevios_storefront_js.SubscriptionChanges, quote: _nevios_storefront_js.SubscriptionChangeQuote, consentEvidence: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription>;
1152
+ confirmCard(id: string, setupIntentId: string, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<Subscription>;
1153
+ replaceCard(id: string, expectedVersion: number, opts?: _nevios_storefront_js.SubscriptionCallOptions): Promise<_nevios_storefront_js.SubscriptionCardSetup>;
1154
+ };
1155
+ };
1156
+
1157
+ declare function SubscriptionList({ href, locale }: {
1158
+ href(id: string): string;
1159
+ locale?: string;
1160
+ }): React.ReactElement;
1161
+
1054
1162
  /**
1055
1163
  * ProductJsonLd — schema.org/Product structured data for rich results (price,
1056
1164
  * availability, brand). Drop it in the PDP <head> (or anywhere; it's a script).
@@ -1127,4 +1235,4 @@ interface JsonLdProps {
1127
1235
  /** Render a JSON-LD `<script>` for the given (already-shaped) data object. */
1128
1236
  declare function JsonLd({ data }: JsonLdProps): React.ReactElement;
1129
1237
 
1130
- export { AccountDashboard, type AccountDashboardProps, AccountProvider, AccountSecurity, type AccountState, AddToCart, type AddToCartProps, AddressBook, AddressForm, type AddressFormProps, AvailabilityFilter, type AvailabilityFilterProps, BackInStockForm, type BackInStockFormProps, type BreadcrumbItem, BreadcrumbJsonLd, type BreadcrumbJsonLdProps, CartDrawer, type CartDrawerProps, CartLineItem, type CartLineItemProps, CartProvider, type CartState, CartSummary, type CartSummaryProps, CheckoutFlow, type CheckoutFlowProps, CheckoutProvider, type CheckoutState, CollectionPage, type CollectionPageProps, I18nProvider, type I18nProviderProps, type I18nValue, JsonLd, type JsonLdProps, LoginForm, type LoginFormProps, type MarketOption, MarketSwitcher, type MarketSwitcherProps, type MessageKey, type Messages, NeviosProvider, type NeviosProviderProps, OrderConfirmation, type OrderConfirmationProps, OrderHistory, type OrderHistoryProps, OrderLines, OrderStatusPage, type OrderStatusPageProps, type OrderStatusState, OrderSummary, type OrderSummaryProps, OrderTotals, OrganizationJsonLd, type OrganizationJsonLdProps, type PayOptions, type PayResult, PaymentMethodPicker, type PaymentMethodPickerProps, PaymentPage, type PaymentPageProps, type PaymentPageState, PaymentSection, type PaymentSectionProps, PhaseTimeline, PriceMoney, type PriceMoneyProps, PriceRangeFilter, type PriceRangeFilterProps, ProductCard, type ProductCardProps, ProductDetailPage, type ProductDetailPageProps, ProductGallery, type ProductGalleryProps, ProductJsonLd, type ProductJsonLdProps, ProfileEditor, ShippingPicker, type ShippingPickerProps, SortSelect, type SortSelectProps, StatusBanner, StockBadge, type StockBadgeProps, type StorefrontTheme, type TFunction, type TVars, TagFilter, type TagFilterProps, ThemeProvider, type ThemeProviderProps, TransferInstructions, type TransferInstructionsProps, VariantPicker, type VariantPickerProps, type VerifyStatus, absoluteUrl, bundledMessages, cs, en, formatCents, formatMoney, isTerminal, serializeJsonLd, stripHtml, themeToCssVars, useAccount, useCart, useCheckout, useI18n, useMagicLinkVerify, useOrderStatus, usePayment, useStorefront, useStorefrontOptional, useT };
1238
+ export { AccountDashboard, type AccountDashboardProps, AccountProvider, AccountSecurity, type AccountState, AddToCart, type AddToCartProps, AddressBook, AddressForm, type AddressFormProps, AvailabilityFilter, type AvailabilityFilterProps, BackInStockForm, type BackInStockFormProps, type BreadcrumbItem, BreadcrumbJsonLd, type BreadcrumbJsonLdProps, CartDrawer, type CartDrawerProps, CartLineItem, type CartLineItemProps, CartProvider, type CartState, CartSummary, type CartSummaryProps, CheckoutFlow, type CheckoutFlowProps, CheckoutProvider, type CheckoutState, CollectionPage, type CollectionPageProps, I18nProvider, type I18nProviderProps, type I18nValue, JsonLd, type JsonLdProps, LoginForm, type LoginFormProps, type MarketOption, MarketSwitcher, type MarketSwitcherProps, type MessageKey, type Messages, NeviosProvider, type NeviosProviderProps, OrderConfirmation, type OrderConfirmationProps, OrderHistory, type OrderHistoryProps, OrderLines, OrderStatusPage, type OrderStatusPageProps, type OrderStatusState, OrderSummary, type OrderSummaryProps, OrderTotals, OrganizationJsonLd, type OrganizationJsonLdProps, type PayOptions, type PayResult, PaymentMethodPicker, type PaymentMethodPickerProps, PaymentPage, type PaymentPageProps, type PaymentPageState, PaymentSection, type PaymentSectionProps, PhaseTimeline, PriceMoney, type PriceMoneyProps, PriceRangeFilter, type PriceRangeFilterProps, ProductCard, type ProductCardProps, ProductDetailPage, type ProductDetailPageProps, ProductGallery, type ProductGalleryProps, ProductJsonLd, type ProductJsonLdProps, ProfileEditor, PurchaseOptions, ShippingPicker, type ShippingPickerProps, SortSelect, type SortSelectProps, StatusBanner, StockBadge, type StockBadgeProps, type StorefrontTheme, SubscriptionList, SubscriptionTerms, type TFunction, type TVars, TagFilter, type TagFilterProps, ThemeProvider, type ThemeProviderProps, TransferInstructions, type TransferInstructionsProps, VariantPicker, type VariantPickerProps, type VerifyStatus, absoluteUrl, bundledMessages, cs, en, formatCents, formatMoney, isTerminal, serializeJsonLd, stripHtml, themeToCssVars, useAccount, useCart, useCheckout, useCustomerSubscription, useCustomerSubscriptions, useI18n, useMagicLinkVerify, useOrderStatus, usePayment, useStorefront, useStorefrontOptional, useT };