@aifeatures/react 0.19.0 → 0.21.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
@@ -842,6 +842,11 @@ interface UseCartSummaryOptions {
842
842
  interface UseCartSummaryResult {
843
843
  /** Null until the first successful pass, and on an empty cart. */
844
844
  summary: CartSummary | null;
845
+ /**
846
+ * True from the moment the cart, market or shipping option changes until
847
+ * that change is priced — including the debounce wait. While true, `summary`
848
+ * still prices the previous state, so hold checkout on it.
849
+ */
845
850
  loading: boolean;
846
851
  /** Transient failure text. The last good `summary` is KEPT alongside it. */
847
852
  error: string | null;
@@ -1306,6 +1311,55 @@ declare namespace CartCheckoutButton {
1306
1311
  var neverConsentGate: string;
1307
1312
  }
1308
1313
 
1314
+ /** The parts of the page a site can restyle. A part given a class drops its
1315
+ * built-in inline style, so Tailwind (or any CSS) owns it completely. */
1316
+ type CartPagePart = 'list' | 'line' | 'image' | 'name' | 'variant' | 'unitPrice' | 'lineTotal' | 'quantity' | 'quantityButton' | 'remove' | 'notice' | 'summary' | 'summaryRow' | 'total' | 'checkoutButton' | 'alert' | 'empty';
1317
+ interface CartPageProps {
1318
+ /** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
1319
+ apiUrl?: string;
1320
+ /** Class for the root element. Without it the root gets a minimal inline layout. */
1321
+ className?: string;
1322
+ style?: CSSProperties;
1323
+ /** Per-part classes — see CartPagePart. */
1324
+ classNames?: Partial<Record<CartPagePart, string>>;
1325
+ /**
1326
+ * The product page for a line, so its name and image link back to it.
1327
+ * `line.pdpSearch` preselects the line's options, e.g.
1328
+ * `(line) => \`/shop/${slugs[line.productId]}?${new URLSearchParams(line.pdpSearch)}\``.
1329
+ * Omit (or return null) to render names as plain text.
1330
+ */
1331
+ productHref?: (line: CartItemLine) => string | null;
1332
+ /** Where "Continue shopping" goes on the empty cart. Default "/". */
1333
+ continueShoppingHref?: string;
1334
+ /** Replaces the whole empty state. */
1335
+ renderEmpty?: () => ReactNode;
1336
+ /** Ready-state label for the checkout button (default "Checkout"). Disabled-state labels always win. */
1337
+ checkoutLabel?: ReactNode;
1338
+ /** Defaults to `${window.location.origin}/order/confirmation`. */
1339
+ successUrl?: string;
1340
+ /** Defaults to the current page URL. */
1341
+ cancelUrl?: string;
1342
+ /** Prefills the email field on the Stripe Checkout page. */
1343
+ customerEmail?: string;
1344
+ /** Opaque passthrough stored on the order (string values only). */
1345
+ metadata?: Record<string, string>;
1346
+ }
1347
+ /**
1348
+ * The whole cart page: line list, quantity and remove controls, the
1349
+ * server-priced summary with postage choice, and checkout. Render it from the
1350
+ * site's `app/routes/cart.tsx`; the route owns the page heading and frame.
1351
+ *
1352
+ * Every amount comes from the server (`useCartItems` per line,
1353
+ * `useCartSummary` for the order) and nothing is derived on the page: the
1354
+ * free-shipping threshold, the bottom label ("Total" only when Stripe cannot
1355
+ * add anything) and the postage the buyer picked are the same values checkout
1356
+ * will charge.
1357
+ */
1358
+ declare function CartPage({ apiUrl, className, style, classNames, productHref, continueShoppingHref, renderEmpty, checkoutLabel, successUrl, cancelUrl, customerEmail, metadata, }: CartPageProps): react_jsx_runtime.JSX.Element;
1359
+ declare namespace CartPage {
1360
+ var neverConsentGate: string;
1361
+ }
1362
+
1309
1363
  type OrderStatus = "pending" | "paid" | "failed" | "expired" | "refunded" | "partially_refunded" | "disputed";
1310
1364
  interface OrderFulfillment {
1311
1365
  /** `mixed` only when a cart genuinely combines types (download + redirect). */
@@ -2736,4 +2790,4 @@ declare namespace AccountReviews {
2736
2790
  var neverConsentGate: string;
2737
2791
  }
2738
2792
 
2739
- export { AccountLogin, type AccountLoginFormContext, type AccountLoginProps, type AccountLoginSentContext, type AccountMePayload, type AccountOrder, AccountOrders, type AccountOrdersProps, AccountPage, type AccountPagePmBannerContext, type AccountPageProps, AccountReviews, type AccountReviewsProps, type AccountShippingAddressInput, type AccountSubscription, type AddCartLineInput, AddToCartButton, type AddToCartButtonProps, type AddToCartResult, AifeaturesCaptcha, type AifeaturesCaptchaProps, AifeaturesProvider, type AifeaturesProviderProps, BuyButton, type BuyButtonProps, CartCheckoutButton, type CartCheckoutButtonProps, type CartCheckoutLine, type CartConflictItem, type CartItemLine, type CartLine, type CartLineDisplay, type CartLineStatus, type CartSummary, type CartSummaryShipping, type CartSummaryShippingOption, ConsentBanner, type ConsentBannerDisclosureProps, type ConsentBannerProps, type ConsentCategory, type ConsentDisclosureStrings, type ConsentGrants, type ConsentIntegration, type ConsentLocale, type ConsentManifest, ConsentPolicyDetails, type ConsentPolicyDetailsProps, ConsentProvider, type ConsentProviderProps, type ConsentThemeTokens, CookieSettingsLink, type CookieSettingsLinkProps, GatedContent, type GatedContentProps, type GatedContentStrings, GatedScript, type GatedScriptProps, type LoginResult, MARKET_COUNTRIES, MAX_CART_LINES, type MarketCountry, OrderConfirmation, type OrderConfirmationProps, type OrderFulfillment, type OrderSession, type OrderSessionLineItem, type OrderSessionSubscription, type OrderStatus, type OwnProductReview, PlanPicker, type PlanPickerOptionContext, type PlanPickerProps, PreferencesPanel, type PreferencesPanelProps, type PreferencesStrings, ProductPrice, type ProductPriceProps, ProductRating, type ProductRatingProps, type ProductReview, ProductReviewForm, type ProductReviewFormProps, ProductReviews, type ProductReviewsProps, type PublicOption, type PublicOptionValue, type PublicProduct, type PublicProductSubscription, type PublicSubscriptionPlan, type PublicVariant, type PublicVariantOptionValue, type ReviewAvailability, type ReviewSummary, type SessionCustomer, type SessionReason, type SessionStatus, type ShippingOptionConflict, type StartCartCheckoutOptions, type StartCheckoutOptions, SubscriptionList, type SubscriptionListAuth, type SubscriptionListProps, type SubscriptionMutationState, type SubscriptionRowContext, type UseCartCheckoutOptions, type UseCartCheckoutResult, type UseCartItemsOptions, type UseCartItemsResult, type UseCartResult, type UseCartSummaryOptions, type UseCartSummaryResult, type UseCheckoutOptions, type UseCheckoutResult, type UseConsentResult, type UseMarketOptions, type UseMarketResult, type UseProductOptions, type UseProductResult, type UseProductReviewsOptions, type UseProductReviewsResult, type UseSessionOptions, type UseSessionResult, VariantPicker, type VariantPickerProps, type VariantSelection, type VerifyResult, ZERO_DECIMAL_CURRENCIES, applySelectionToUrl, consentLocales, formatPrice, getOptions, getVariants, isMultiVariant, isValueAvailable, isValueInCatalog, planRecurringAmount, reanchorSelection, resolveVariant, searchFromSelection, selectedImages, selectedValues, selectionFromSearch, useAifeaturesApiUrl, useCart, useCartCheckout, useCartItems, useCartSummary, useCheckout, useConsent, useMarket, useProduct, useProductReviews, useSession, valueSlug, variantPriceRange };
2793
+ export { AccountLogin, type AccountLoginFormContext, type AccountLoginProps, type AccountLoginSentContext, type AccountMePayload, type AccountOrder, AccountOrders, type AccountOrdersProps, AccountPage, type AccountPagePmBannerContext, type AccountPageProps, AccountReviews, type AccountReviewsProps, type AccountShippingAddressInput, type AccountSubscription, type AddCartLineInput, AddToCartButton, type AddToCartButtonProps, type AddToCartResult, AifeaturesCaptcha, type AifeaturesCaptchaProps, AifeaturesProvider, type AifeaturesProviderProps, BuyButton, type BuyButtonProps, CartCheckoutButton, type CartCheckoutButtonProps, type CartCheckoutLine, type CartConflictItem, type CartItemLine, type CartLine, type CartLineDisplay, type CartLineStatus, CartPage, type CartPagePart, type CartPageProps, type CartSummary, type CartSummaryShipping, type CartSummaryShippingOption, ConsentBanner, type ConsentBannerDisclosureProps, type ConsentBannerProps, type ConsentCategory, type ConsentDisclosureStrings, type ConsentGrants, type ConsentIntegration, type ConsentLocale, type ConsentManifest, ConsentPolicyDetails, type ConsentPolicyDetailsProps, ConsentProvider, type ConsentProviderProps, type ConsentThemeTokens, CookieSettingsLink, type CookieSettingsLinkProps, GatedContent, type GatedContentProps, type GatedContentStrings, GatedScript, type GatedScriptProps, type LoginResult, MARKET_COUNTRIES, MAX_CART_LINES, type MarketCountry, OrderConfirmation, type OrderConfirmationProps, type OrderFulfillment, type OrderSession, type OrderSessionLineItem, type OrderSessionSubscription, type OrderStatus, type OwnProductReview, PlanPicker, type PlanPickerOptionContext, type PlanPickerProps, PreferencesPanel, type PreferencesPanelProps, type PreferencesStrings, ProductPrice, type ProductPriceProps, ProductRating, type ProductRatingProps, type ProductReview, ProductReviewForm, type ProductReviewFormProps, ProductReviews, type ProductReviewsProps, type PublicOption, type PublicOptionValue, type PublicProduct, type PublicProductSubscription, type PublicSubscriptionPlan, type PublicVariant, type PublicVariantOptionValue, type ReviewAvailability, type ReviewSummary, type SessionCustomer, type SessionReason, type SessionStatus, type ShippingOptionConflict, type StartCartCheckoutOptions, type StartCheckoutOptions, SubscriptionList, type SubscriptionListAuth, type SubscriptionListProps, type SubscriptionMutationState, type SubscriptionRowContext, type UseCartCheckoutOptions, type UseCartCheckoutResult, type UseCartItemsOptions, type UseCartItemsResult, type UseCartResult, type UseCartSummaryOptions, type UseCartSummaryResult, type UseCheckoutOptions, type UseCheckoutResult, type UseConsentResult, type UseMarketOptions, type UseMarketResult, type UseProductOptions, type UseProductResult, type UseProductReviewsOptions, type UseProductReviewsResult, type UseSessionOptions, type UseSessionResult, VariantPicker, type VariantPickerProps, type VariantSelection, type VerifyResult, ZERO_DECIMAL_CURRENCIES, applySelectionToUrl, consentLocales, formatPrice, getOptions, getVariants, isMultiVariant, isValueAvailable, isValueInCatalog, planRecurringAmount, reanchorSelection, resolveVariant, searchFromSelection, selectedImages, selectedValues, selectionFromSearch, useAifeaturesApiUrl, useCart, useCartCheckout, useCartItems, useCartSummary, useCheckout, useConsent, useMarket, useProduct, useProductReviews, useSession, valueSlug, variantPriceRange };
package/dist/index.d.ts CHANGED
@@ -842,6 +842,11 @@ interface UseCartSummaryOptions {
842
842
  interface UseCartSummaryResult {
843
843
  /** Null until the first successful pass, and on an empty cart. */
844
844
  summary: CartSummary | null;
845
+ /**
846
+ * True from the moment the cart, market or shipping option changes until
847
+ * that change is priced — including the debounce wait. While true, `summary`
848
+ * still prices the previous state, so hold checkout on it.
849
+ */
845
850
  loading: boolean;
846
851
  /** Transient failure text. The last good `summary` is KEPT alongside it. */
847
852
  error: string | null;
@@ -1306,6 +1311,55 @@ declare namespace CartCheckoutButton {
1306
1311
  var neverConsentGate: string;
1307
1312
  }
1308
1313
 
1314
+ /** The parts of the page a site can restyle. A part given a class drops its
1315
+ * built-in inline style, so Tailwind (or any CSS) owns it completely. */
1316
+ type CartPagePart = 'list' | 'line' | 'image' | 'name' | 'variant' | 'unitPrice' | 'lineTotal' | 'quantity' | 'quantityButton' | 'remove' | 'notice' | 'summary' | 'summaryRow' | 'total' | 'checkoutButton' | 'alert' | 'empty';
1317
+ interface CartPageProps {
1318
+ /** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
1319
+ apiUrl?: string;
1320
+ /** Class for the root element. Without it the root gets a minimal inline layout. */
1321
+ className?: string;
1322
+ style?: CSSProperties;
1323
+ /** Per-part classes — see CartPagePart. */
1324
+ classNames?: Partial<Record<CartPagePart, string>>;
1325
+ /**
1326
+ * The product page for a line, so its name and image link back to it.
1327
+ * `line.pdpSearch` preselects the line's options, e.g.
1328
+ * `(line) => \`/shop/${slugs[line.productId]}?${new URLSearchParams(line.pdpSearch)}\``.
1329
+ * Omit (or return null) to render names as plain text.
1330
+ */
1331
+ productHref?: (line: CartItemLine) => string | null;
1332
+ /** Where "Continue shopping" goes on the empty cart. Default "/". */
1333
+ continueShoppingHref?: string;
1334
+ /** Replaces the whole empty state. */
1335
+ renderEmpty?: () => ReactNode;
1336
+ /** Ready-state label for the checkout button (default "Checkout"). Disabled-state labels always win. */
1337
+ checkoutLabel?: ReactNode;
1338
+ /** Defaults to `${window.location.origin}/order/confirmation`. */
1339
+ successUrl?: string;
1340
+ /** Defaults to the current page URL. */
1341
+ cancelUrl?: string;
1342
+ /** Prefills the email field on the Stripe Checkout page. */
1343
+ customerEmail?: string;
1344
+ /** Opaque passthrough stored on the order (string values only). */
1345
+ metadata?: Record<string, string>;
1346
+ }
1347
+ /**
1348
+ * The whole cart page: line list, quantity and remove controls, the
1349
+ * server-priced summary with postage choice, and checkout. Render it from the
1350
+ * site's `app/routes/cart.tsx`; the route owns the page heading and frame.
1351
+ *
1352
+ * Every amount comes from the server (`useCartItems` per line,
1353
+ * `useCartSummary` for the order) and nothing is derived on the page: the
1354
+ * free-shipping threshold, the bottom label ("Total" only when Stripe cannot
1355
+ * add anything) and the postage the buyer picked are the same values checkout
1356
+ * will charge.
1357
+ */
1358
+ declare function CartPage({ apiUrl, className, style, classNames, productHref, continueShoppingHref, renderEmpty, checkoutLabel, successUrl, cancelUrl, customerEmail, metadata, }: CartPageProps): react_jsx_runtime.JSX.Element;
1359
+ declare namespace CartPage {
1360
+ var neverConsentGate: string;
1361
+ }
1362
+
1309
1363
  type OrderStatus = "pending" | "paid" | "failed" | "expired" | "refunded" | "partially_refunded" | "disputed";
1310
1364
  interface OrderFulfillment {
1311
1365
  /** `mixed` only when a cart genuinely combines types (download + redirect). */
@@ -2736,4 +2790,4 @@ declare namespace AccountReviews {
2736
2790
  var neverConsentGate: string;
2737
2791
  }
2738
2792
 
2739
- export { AccountLogin, type AccountLoginFormContext, type AccountLoginProps, type AccountLoginSentContext, type AccountMePayload, type AccountOrder, AccountOrders, type AccountOrdersProps, AccountPage, type AccountPagePmBannerContext, type AccountPageProps, AccountReviews, type AccountReviewsProps, type AccountShippingAddressInput, type AccountSubscription, type AddCartLineInput, AddToCartButton, type AddToCartButtonProps, type AddToCartResult, AifeaturesCaptcha, type AifeaturesCaptchaProps, AifeaturesProvider, type AifeaturesProviderProps, BuyButton, type BuyButtonProps, CartCheckoutButton, type CartCheckoutButtonProps, type CartCheckoutLine, type CartConflictItem, type CartItemLine, type CartLine, type CartLineDisplay, type CartLineStatus, type CartSummary, type CartSummaryShipping, type CartSummaryShippingOption, ConsentBanner, type ConsentBannerDisclosureProps, type ConsentBannerProps, type ConsentCategory, type ConsentDisclosureStrings, type ConsentGrants, type ConsentIntegration, type ConsentLocale, type ConsentManifest, ConsentPolicyDetails, type ConsentPolicyDetailsProps, ConsentProvider, type ConsentProviderProps, type ConsentThemeTokens, CookieSettingsLink, type CookieSettingsLinkProps, GatedContent, type GatedContentProps, type GatedContentStrings, GatedScript, type GatedScriptProps, type LoginResult, MARKET_COUNTRIES, MAX_CART_LINES, type MarketCountry, OrderConfirmation, type OrderConfirmationProps, type OrderFulfillment, type OrderSession, type OrderSessionLineItem, type OrderSessionSubscription, type OrderStatus, type OwnProductReview, PlanPicker, type PlanPickerOptionContext, type PlanPickerProps, PreferencesPanel, type PreferencesPanelProps, type PreferencesStrings, ProductPrice, type ProductPriceProps, ProductRating, type ProductRatingProps, type ProductReview, ProductReviewForm, type ProductReviewFormProps, ProductReviews, type ProductReviewsProps, type PublicOption, type PublicOptionValue, type PublicProduct, type PublicProductSubscription, type PublicSubscriptionPlan, type PublicVariant, type PublicVariantOptionValue, type ReviewAvailability, type ReviewSummary, type SessionCustomer, type SessionReason, type SessionStatus, type ShippingOptionConflict, type StartCartCheckoutOptions, type StartCheckoutOptions, SubscriptionList, type SubscriptionListAuth, type SubscriptionListProps, type SubscriptionMutationState, type SubscriptionRowContext, type UseCartCheckoutOptions, type UseCartCheckoutResult, type UseCartItemsOptions, type UseCartItemsResult, type UseCartResult, type UseCartSummaryOptions, type UseCartSummaryResult, type UseCheckoutOptions, type UseCheckoutResult, type UseConsentResult, type UseMarketOptions, type UseMarketResult, type UseProductOptions, type UseProductResult, type UseProductReviewsOptions, type UseProductReviewsResult, type UseSessionOptions, type UseSessionResult, VariantPicker, type VariantPickerProps, type VariantSelection, type VerifyResult, ZERO_DECIMAL_CURRENCIES, applySelectionToUrl, consentLocales, formatPrice, getOptions, getVariants, isMultiVariant, isValueAvailable, isValueInCatalog, planRecurringAmount, reanchorSelection, resolveVariant, searchFromSelection, selectedImages, selectedValues, selectionFromSearch, useAifeaturesApiUrl, useCart, useCartCheckout, useCartItems, useCartSummary, useCheckout, useConsent, useMarket, useProduct, useProductReviews, useSession, valueSlug, variantPriceRange };
2793
+ export { AccountLogin, type AccountLoginFormContext, type AccountLoginProps, type AccountLoginSentContext, type AccountMePayload, type AccountOrder, AccountOrders, type AccountOrdersProps, AccountPage, type AccountPagePmBannerContext, type AccountPageProps, AccountReviews, type AccountReviewsProps, type AccountShippingAddressInput, type AccountSubscription, type AddCartLineInput, AddToCartButton, type AddToCartButtonProps, type AddToCartResult, AifeaturesCaptcha, type AifeaturesCaptchaProps, AifeaturesProvider, type AifeaturesProviderProps, BuyButton, type BuyButtonProps, CartCheckoutButton, type CartCheckoutButtonProps, type CartCheckoutLine, type CartConflictItem, type CartItemLine, type CartLine, type CartLineDisplay, type CartLineStatus, CartPage, type CartPagePart, type CartPageProps, type CartSummary, type CartSummaryShipping, type CartSummaryShippingOption, ConsentBanner, type ConsentBannerDisclosureProps, type ConsentBannerProps, type ConsentCategory, type ConsentDisclosureStrings, type ConsentGrants, type ConsentIntegration, type ConsentLocale, type ConsentManifest, ConsentPolicyDetails, type ConsentPolicyDetailsProps, ConsentProvider, type ConsentProviderProps, type ConsentThemeTokens, CookieSettingsLink, type CookieSettingsLinkProps, GatedContent, type GatedContentProps, type GatedContentStrings, GatedScript, type GatedScriptProps, type LoginResult, MARKET_COUNTRIES, MAX_CART_LINES, type MarketCountry, OrderConfirmation, type OrderConfirmationProps, type OrderFulfillment, type OrderSession, type OrderSessionLineItem, type OrderSessionSubscription, type OrderStatus, type OwnProductReview, PlanPicker, type PlanPickerOptionContext, type PlanPickerProps, PreferencesPanel, type PreferencesPanelProps, type PreferencesStrings, ProductPrice, type ProductPriceProps, ProductRating, type ProductRatingProps, type ProductReview, ProductReviewForm, type ProductReviewFormProps, ProductReviews, type ProductReviewsProps, type PublicOption, type PublicOptionValue, type PublicProduct, type PublicProductSubscription, type PublicSubscriptionPlan, type PublicVariant, type PublicVariantOptionValue, type ReviewAvailability, type ReviewSummary, type SessionCustomer, type SessionReason, type SessionStatus, type ShippingOptionConflict, type StartCartCheckoutOptions, type StartCheckoutOptions, SubscriptionList, type SubscriptionListAuth, type SubscriptionListProps, type SubscriptionMutationState, type SubscriptionRowContext, type UseCartCheckoutOptions, type UseCartCheckoutResult, type UseCartItemsOptions, type UseCartItemsResult, type UseCartResult, type UseCartSummaryOptions, type UseCartSummaryResult, type UseCheckoutOptions, type UseCheckoutResult, type UseConsentResult, type UseMarketOptions, type UseMarketResult, type UseProductOptions, type UseProductResult, type UseProductReviewsOptions, type UseProductReviewsResult, type UseSessionOptions, type UseSessionResult, VariantPicker, type VariantPickerProps, type VariantSelection, type VerifyResult, ZERO_DECIMAL_CURRENCIES, applySelectionToUrl, consentLocales, formatPrice, getOptions, getVariants, isMultiVariant, isValueAvailable, isValueInCatalog, planRecurringAmount, reanchorSelection, resolveVariant, searchFromSelection, selectedImages, selectedValues, selectionFromSearch, useAifeaturesApiUrl, useCart, useCartCheckout, useCartItems, useCartSummary, useCheckout, useConsent, useMarket, useProduct, useProductReviews, useSession, valueSlug, variantPriceRange };