@nevios/storefront-kit 1.2.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;
@@ -213,6 +224,20 @@ declare const en: {
213
224
  "account.signOut": string;
214
225
  "account.greeting": string;
215
226
  "account.orders": string;
227
+ "account.loadError": string;
228
+ "account.retry": string;
229
+ "account.loadMore": string;
230
+ "account.signInError": string;
231
+ "account.security": string;
232
+ "account.newEmail": string;
233
+ "account.changeEmail": string;
234
+ "account.recentLogin": string;
235
+ "account.sessions": string;
236
+ "account.currentSession": string;
237
+ "account.revokeSession": string;
238
+ "account.closeAccount": string;
239
+ "account.closeWarning": string;
240
+ "account.confirmClose": string;
216
241
  "account.noOrders": string;
217
242
  "account.addresses": string;
218
243
  "account.noAddresses": string;
@@ -496,6 +521,16 @@ interface TagFilterProps {
496
521
  /** Toggleable tag chips. Multi-select; emits the selected list. */
497
522
  declare function TagFilter({ tags, selected, onChange }: TagFilterProps): React.ReactElement | null;
498
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
+
499
534
  /**
500
535
  * CartProvider + useCart — shared cart state for the whole app. The drawer, the
501
536
  * PDP add-to-cart, and a header cart count all read the same cart and re-render
@@ -513,8 +548,9 @@ interface CartState {
513
548
  loading: boolean;
514
549
  itemCount: number;
515
550
  addLine(input: AddLineInput): Promise<Cart>;
516
- updateLine(lineId: string, quantity: number): Promise<Cart>;
551
+ updateLine(lineId: string, quantity: number | UpdateCartLineInput): Promise<Cart>;
517
552
  removeLine(lineId: string): Promise<Cart>;
553
+ clearSubscription(): Promise<Cart>;
518
554
  /** Re-fetch the cart from the server. */
519
555
  refresh(): Promise<void>;
520
556
  }
@@ -533,11 +569,12 @@ declare function useCart(): CartState;
533
569
  interface AddToCartProps {
534
570
  variant: ProductVariant | null;
535
571
  quantity?: number;
572
+ subscriptionPlanId?: string | null;
536
573
  /** Button label. Defaults to "Add to cart". */
537
574
  children?: React.ReactNode;
538
575
  onAdded?: () => void;
539
576
  }
540
- declare function AddToCart({ variant, quantity, children, onAdded, }: AddToCartProps): React.ReactElement;
577
+ declare function AddToCart({ variant, quantity, subscriptionPlanId, children, onAdded, }: AddToCartProps): React.ReactElement;
541
578
 
542
579
  /**
543
580
  * CartLineItem — one cart row: thumbnail, title + variant, a quantity stepper,
@@ -601,8 +638,16 @@ type PayResult = {
601
638
  } | {
602
639
  kind: "order";
603
640
  checkout: Checkout;
641
+ } | {
642
+ kind: "subscription";
643
+ subscription: SubscriptionEnrollmentResult;
644
+ } | {
645
+ kind: "subscription_payment";
646
+ payment: SubscriptionPayment;
604
647
  };
605
648
  interface PayOptions {
649
+ /** Explicit acceptance of the currently displayed recurring quote. */
650
+ subscription?: SubscriptionAcceptance;
606
651
  /** Where the gateway returns the customer after paying. */
607
652
  returnUrl?: string;
608
653
  /** Where the gateway returns the customer on cancel. */
@@ -615,6 +660,9 @@ interface PayOptions {
615
660
  redirect?: boolean;
616
661
  }
617
662
  interface CheckoutState {
663
+ selectSubscription(selection: SubscriptionSelection): Promise<SubscriptionQuote>;
664
+ clearSubscription(): Promise<Checkout>;
665
+ reviewSubscription(): Promise<SubscriptionQuote>;
618
666
  checkout: Checkout | null;
619
667
  /** True while a checkout request is in flight. */
620
668
  loading: boolean;
@@ -664,6 +712,8 @@ declare function useCheckout(): CheckoutState;
664
712
  interface CheckoutFlowProps {
665
713
  /** If set and no checkout exists yet, create one from this cart token. */
666
714
  cartToken?: string;
715
+ /** Confirm with Stripe.js, then the flow refreshes the server payment state. */
716
+ onSubscriptionPayment?: (payment: SubscriptionPayment) => void | Promise<void>;
667
717
  /** Called when a (non-gateway) order is placed. Gateway flows redirect away
668
718
  * before this fires. */
669
719
  onOrderPlaced?: (checkout: Checkout) => void;
@@ -676,7 +726,7 @@ interface CheckoutFlowProps {
676
726
  cancelUrl?: string;
677
727
  locale?: string;
678
728
  }
679
- 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;
680
730
 
681
731
  /**
682
732
  * AddressForm — collects email + shipping address (the checkout's first step).
@@ -717,7 +767,7 @@ declare function ShippingPicker({ title, submitLabel, onComplete, locale, }: Shi
717
767
  * one, and places the order. The category drives the final action:
718
768
  * • gateway → `pay()` starts the payment and redirects to the gateway
719
769
  * • cod/bank/manual → `pay()` completes the order directly → `onOrderPlaced`
720
- * The storefront never embeds a gateway — paying a card means a redirect.
770
+ * Recurring Stripe payments use the merchant's Stripe.js callback.
721
771
  */
722
772
 
723
773
  interface PaymentSectionProps {
@@ -729,8 +779,10 @@ interface PaymentSectionProps {
729
779
  /** Called when a non-gateway order is placed (gateway flows redirect away). */
730
780
  onOrderPlaced?: (checkout: Checkout) => void;
731
781
  locale?: string;
782
+ /** Confirm the returned intent using your Stripe.js Payment Element. */
783
+ onSubscriptionPayment?: (payment: SubscriptionPayment) => void | Promise<void>;
732
784
  }
733
- declare function PaymentSection({ title, returnUrl, cancelUrl, onOrderPlaced, locale, }: PaymentSectionProps): React.ReactElement;
785
+ declare function PaymentSection({ title, returnUrl, cancelUrl, onOrderPlaced, locale, onSubscriptionPayment, }: PaymentSectionProps): React.ReactElement;
734
786
 
735
787
  /**
736
788
  * OrderSummary — the checkout's running total: line items + the full breakdown
@@ -747,6 +799,14 @@ interface OrderSummaryProps {
747
799
  }
748
800
  declare function OrderSummary({ checkout: override, totalsOnly, locale, }: OrderSummaryProps): React.ReactElement | null;
749
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
+
750
810
  interface OrderStatusState {
751
811
  order: OrderStatus | null;
752
812
  loading: boolean;
@@ -958,6 +1018,7 @@ interface AccountState {
958
1018
  signedIn: boolean;
959
1019
  /** True until the initial session check resolves. */
960
1020
  loading: boolean;
1021
+ error: boolean;
961
1022
  requestMagicLink(email: string): Promise<MagicLinkResult>;
962
1023
  /** Exchange a magic token for a session (sets `customer`). */
963
1024
  verify(token: string): Promise<Customer>;
@@ -1033,6 +1094,71 @@ declare function AddressBook(): React.ReactElement;
1033
1094
 
1034
1095
  declare function ProfileEditor(): React.ReactElement | null;
1035
1096
 
1097
+ /** Email verification, session revocation and explicit account-closure confirmation. */
1098
+ declare function AccountSecurity(): React.ReactElement | null;
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
+
1036
1162
  /**
1037
1163
  * ProductJsonLd — schema.org/Product structured data for rich results (price,
1038
1164
  * availability, brand). Drop it in the PDP <head> (or anywhere; it's a script).
@@ -1109,4 +1235,4 @@ interface JsonLdProps {
1109
1235
  /** Render a JSON-LD `<script>` for the given (already-shaped) data object. */
1110
1236
  declare function JsonLd({ data }: JsonLdProps): React.ReactElement;
1111
1237
 
1112
- export { AccountDashboard, type AccountDashboardProps, AccountProvider, 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;
@@ -213,6 +224,20 @@ declare const en: {
213
224
  "account.signOut": string;
214
225
  "account.greeting": string;
215
226
  "account.orders": string;
227
+ "account.loadError": string;
228
+ "account.retry": string;
229
+ "account.loadMore": string;
230
+ "account.signInError": string;
231
+ "account.security": string;
232
+ "account.newEmail": string;
233
+ "account.changeEmail": string;
234
+ "account.recentLogin": string;
235
+ "account.sessions": string;
236
+ "account.currentSession": string;
237
+ "account.revokeSession": string;
238
+ "account.closeAccount": string;
239
+ "account.closeWarning": string;
240
+ "account.confirmClose": string;
216
241
  "account.noOrders": string;
217
242
  "account.addresses": string;
218
243
  "account.noAddresses": string;
@@ -496,6 +521,16 @@ interface TagFilterProps {
496
521
  /** Toggleable tag chips. Multi-select; emits the selected list. */
497
522
  declare function TagFilter({ tags, selected, onChange }: TagFilterProps): React.ReactElement | null;
498
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
+
499
534
  /**
500
535
  * CartProvider + useCart — shared cart state for the whole app. The drawer, the
501
536
  * PDP add-to-cart, and a header cart count all read the same cart and re-render
@@ -513,8 +548,9 @@ interface CartState {
513
548
  loading: boolean;
514
549
  itemCount: number;
515
550
  addLine(input: AddLineInput): Promise<Cart>;
516
- updateLine(lineId: string, quantity: number): Promise<Cart>;
551
+ updateLine(lineId: string, quantity: number | UpdateCartLineInput): Promise<Cart>;
517
552
  removeLine(lineId: string): Promise<Cart>;
553
+ clearSubscription(): Promise<Cart>;
518
554
  /** Re-fetch the cart from the server. */
519
555
  refresh(): Promise<void>;
520
556
  }
@@ -533,11 +569,12 @@ declare function useCart(): CartState;
533
569
  interface AddToCartProps {
534
570
  variant: ProductVariant | null;
535
571
  quantity?: number;
572
+ subscriptionPlanId?: string | null;
536
573
  /** Button label. Defaults to "Add to cart". */
537
574
  children?: React.ReactNode;
538
575
  onAdded?: () => void;
539
576
  }
540
- declare function AddToCart({ variant, quantity, children, onAdded, }: AddToCartProps): React.ReactElement;
577
+ declare function AddToCart({ variant, quantity, subscriptionPlanId, children, onAdded, }: AddToCartProps): React.ReactElement;
541
578
 
542
579
  /**
543
580
  * CartLineItem — one cart row: thumbnail, title + variant, a quantity stepper,
@@ -601,8 +638,16 @@ type PayResult = {
601
638
  } | {
602
639
  kind: "order";
603
640
  checkout: Checkout;
641
+ } | {
642
+ kind: "subscription";
643
+ subscription: SubscriptionEnrollmentResult;
644
+ } | {
645
+ kind: "subscription_payment";
646
+ payment: SubscriptionPayment;
604
647
  };
605
648
  interface PayOptions {
649
+ /** Explicit acceptance of the currently displayed recurring quote. */
650
+ subscription?: SubscriptionAcceptance;
606
651
  /** Where the gateway returns the customer after paying. */
607
652
  returnUrl?: string;
608
653
  /** Where the gateway returns the customer on cancel. */
@@ -615,6 +660,9 @@ interface PayOptions {
615
660
  redirect?: boolean;
616
661
  }
617
662
  interface CheckoutState {
663
+ selectSubscription(selection: SubscriptionSelection): Promise<SubscriptionQuote>;
664
+ clearSubscription(): Promise<Checkout>;
665
+ reviewSubscription(): Promise<SubscriptionQuote>;
618
666
  checkout: Checkout | null;
619
667
  /** True while a checkout request is in flight. */
620
668
  loading: boolean;
@@ -664,6 +712,8 @@ declare function useCheckout(): CheckoutState;
664
712
  interface CheckoutFlowProps {
665
713
  /** If set and no checkout exists yet, create one from this cart token. */
666
714
  cartToken?: string;
715
+ /** Confirm with Stripe.js, then the flow refreshes the server payment state. */
716
+ onSubscriptionPayment?: (payment: SubscriptionPayment) => void | Promise<void>;
667
717
  /** Called when a (non-gateway) order is placed. Gateway flows redirect away
668
718
  * before this fires. */
669
719
  onOrderPlaced?: (checkout: Checkout) => void;
@@ -676,7 +726,7 @@ interface CheckoutFlowProps {
676
726
  cancelUrl?: string;
677
727
  locale?: string;
678
728
  }
679
- 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;
680
730
 
681
731
  /**
682
732
  * AddressForm — collects email + shipping address (the checkout's first step).
@@ -717,7 +767,7 @@ declare function ShippingPicker({ title, submitLabel, onComplete, locale, }: Shi
717
767
  * one, and places the order. The category drives the final action:
718
768
  * • gateway → `pay()` starts the payment and redirects to the gateway
719
769
  * • cod/bank/manual → `pay()` completes the order directly → `onOrderPlaced`
720
- * The storefront never embeds a gateway — paying a card means a redirect.
770
+ * Recurring Stripe payments use the merchant's Stripe.js callback.
721
771
  */
722
772
 
723
773
  interface PaymentSectionProps {
@@ -729,8 +779,10 @@ interface PaymentSectionProps {
729
779
  /** Called when a non-gateway order is placed (gateway flows redirect away). */
730
780
  onOrderPlaced?: (checkout: Checkout) => void;
731
781
  locale?: string;
782
+ /** Confirm the returned intent using your Stripe.js Payment Element. */
783
+ onSubscriptionPayment?: (payment: SubscriptionPayment) => void | Promise<void>;
732
784
  }
733
- declare function PaymentSection({ title, returnUrl, cancelUrl, onOrderPlaced, locale, }: PaymentSectionProps): React.ReactElement;
785
+ declare function PaymentSection({ title, returnUrl, cancelUrl, onOrderPlaced, locale, onSubscriptionPayment, }: PaymentSectionProps): React.ReactElement;
734
786
 
735
787
  /**
736
788
  * OrderSummary — the checkout's running total: line items + the full breakdown
@@ -747,6 +799,14 @@ interface OrderSummaryProps {
747
799
  }
748
800
  declare function OrderSummary({ checkout: override, totalsOnly, locale, }: OrderSummaryProps): React.ReactElement | null;
749
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
+
750
810
  interface OrderStatusState {
751
811
  order: OrderStatus | null;
752
812
  loading: boolean;
@@ -958,6 +1018,7 @@ interface AccountState {
958
1018
  signedIn: boolean;
959
1019
  /** True until the initial session check resolves. */
960
1020
  loading: boolean;
1021
+ error: boolean;
961
1022
  requestMagicLink(email: string): Promise<MagicLinkResult>;
962
1023
  /** Exchange a magic token for a session (sets `customer`). */
963
1024
  verify(token: string): Promise<Customer>;
@@ -1033,6 +1094,71 @@ declare function AddressBook(): React.ReactElement;
1033
1094
 
1034
1095
  declare function ProfileEditor(): React.ReactElement | null;
1035
1096
 
1097
+ /** Email verification, session revocation and explicit account-closure confirmation. */
1098
+ declare function AccountSecurity(): React.ReactElement | null;
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
+
1036
1162
  /**
1037
1163
  * ProductJsonLd — schema.org/Product structured data for rich results (price,
1038
1164
  * availability, brand). Drop it in the PDP <head> (or anywhere; it's a script).
@@ -1109,4 +1235,4 @@ interface JsonLdProps {
1109
1235
  /** Render a JSON-LD `<script>` for the given (already-shaped) data object. */
1110
1236
  declare function JsonLd({ data }: JsonLdProps): React.ReactElement;
1111
1237
 
1112
- export { AccountDashboard, type AccountDashboardProps, AccountProvider, 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 };