@shoppexio/storefront 1.0.59 → 1.0.61

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
@@ -1423,11 +1423,10 @@ interface CheckoutOptions {
1423
1423
  /**
1424
1424
  * A Cloudflare Turnstile proof for the `storefront_checkout` action.
1425
1425
  *
1426
- * Normally omitted. A checkout surface may provide a renewed proof when a
1427
- * legitimate shared network reaches the public invoice-create budget. The
1428
- * widget must run on the same origin that calls this SDK, while the proof is
1429
- * transport-only and does not change the checkout intent or its idempotency
1430
- * key.
1426
+ * Normally omitted. When checkout returns a challenge, mount the hosted
1427
+ * broker with `mountCheckoutChallenge()` and retry with its renewed proof.
1428
+ * The proof is transport-only and does not change the checkout intent or its
1429
+ * idempotency key.
1431
1430
  */
1432
1431
  turnstileToken?: string;
1433
1432
  /**
@@ -1501,9 +1500,9 @@ interface CheckoutResult {
1501
1500
  */
1502
1501
  code?: string;
1503
1502
  /**
1504
- * Human-verification challenge returned when a legitimate shared network
1505
- * reaches the invoice-create budget. Render the named provider on the same
1506
- * origin that calls the SDK, then retry with its proof as `turnstileToken`.
1503
+ * Human-verification challenge required before creating the invoice. Mount
1504
+ * it with `mountCheckoutChallenge()`, then retry with its proof as
1505
+ * `turnstileToken`.
1507
1506
  */
1508
1507
  challenge?: ApiChallenge;
1509
1508
  }
@@ -1546,6 +1545,25 @@ declare function buildCheckoutUrl(couponOrOptions?: string | CheckoutOptions, op
1546
1545
  */
1547
1546
  declare function buildCheckoutUrlSync(): never;
1548
1547
 
1548
+ interface CheckoutChallengeCallbacks {
1549
+ onSuccess(token: string): void;
1550
+ onExpired?(): void;
1551
+ onUnavailable?(): void;
1552
+ }
1553
+ interface CheckoutChallengeFrame {
1554
+ element: HTMLIFrameElement;
1555
+ dispose(): void;
1556
+ }
1557
+ /**
1558
+ * Mount the Shoppex-hosted Turnstile broker requested by a checkout refusal.
1559
+ *
1560
+ * The challenge always executes on the configured hosted-checkout origin, so
1561
+ * this works on arbitrary custom storefront domains without adding each one
1562
+ * to Cloudflare's widget hostname allowlist. Retry `checkout()` or
1563
+ * `buildCheckoutUrl()` with the token delivered to `onSuccess`.
1564
+ */
1565
+ declare function mountCheckoutChallenge(container: HTMLElement, challenge: ApiChallenge, callbacks: CheckoutChallengeCallbacks): CheckoutChallengeFrame;
1566
+
1549
1567
  interface SearchOptions {
1550
1568
  hideOutOfStock?: boolean;
1551
1569
  maxResults?: number;
@@ -1898,6 +1916,7 @@ declare const shoppex: {
1898
1916
  checkout: typeof checkout;
1899
1917
  buildCheckoutUrl: typeof buildCheckoutUrl;
1900
1918
  buildCheckoutUrlSync: typeof buildCheckoutUrlSync;
1919
+ mountCheckoutChallenge: typeof mountCheckoutChallenge;
1901
1920
  captureAffiliateFromUrl: typeof captureAffiliateFromUrl;
1902
1921
  validateAffiliateCode: typeof validateAffiliateCode;
1903
1922
  applyAffiliateCode: typeof applyAffiliateCode;
@@ -1976,4 +1995,4 @@ declare const shoppex: {
1976
1995
  mergeSettings: typeof mergeSettings;
1977
1996
  };
1978
1997
 
1979
- export { type AffiliateValidation, type ApiChallenge, ApiError, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, type CartAddOptions, type CartAddon, type CartAppliedDiscount, type CartBasketMergeLine, type CartCodeSource, CartError, type CartItem, type CartItemUpdate, type CartLineIdentityInput, type CartMetadata, type CartPayload, type CartQuote, type CartQuoteLine, type CartStats, type Category, CheckoutCreateError, type CheckoutOptions, type CheckoutResult, type CouponValidation, type CouponValidationOptions, type CursorPagination, type CustomFieldDefinition, type CustomerEmailPreferencesPatch, type CustomerProfilePatch, type CustomerSubscriptionCancelOptions, type CustomerTicketPayload, type EligibleBundleDeal, type EligibleBundleDealProduct, type EligibleCartDeal, type Feedback, type Invoice, type InvoiceProduct, type Menu, type MenuItem, NetworkError, NotInitializedError, type Page, type PageLayout, type PriceVariant, type Product, type ProductAddon, type ProductBundle, type ProductBundleProduct, type ProductCategory, type ProductDescriptionTab, type ProductFaq, type ProductFeedback, type ProductGroup, type ProductImage, type ProductVariant, type PublishedBuilderSettings, type PublishedThemeSettingsPayload, type ResellerCatalogQuery, type ResellerOrderItem, type ResellerOrdersQuery, type ResolvedThemeSettings, type RewardActionType, type RewardGrantStatus, type RewardProgramSummary, type RewardProgramTeaserItem, type RewardReason, type SDKResponse, type SearchOptions, type SectionDefinition, type SettingField, type Shop, type ShopFeedback, type ShopReviewsPage, type ShopReviewsSummary, type ShopTheme, type ShoppexConfig, ShoppexError, type ShoppexInitOptions, type StorefrontAddon, type StorefrontAddonBootstrap, type StorefrontAnnouncementBarAddon, type StorefrontCatalogSearchItem, type StorefrontContactTicketInput, type StorefrontContactTicketResult, type StorefrontCountdownBarAddon, type StorefrontCouponPopupModalAddon, type StorefrontCustomField, type StorefrontData, type StorefrontItem, type StorefrontOnlineUsers, type StorefrontPromoInfoCardAddon, type StorefrontRecentPurchasePopupAddon, type StorefrontRecentSaleEntry, type StorefrontRecentSales, type StorefrontSearchFilterOptions, type StorefrontSocialLinks, type Subscription, type SubscriptionFlags, type SubscriptionInterval, type ThemeBlockManifest, type ThemeConfig, type TrustedChecks, ValidationError, acceptResellerInvite, addFavorite, affiliate, affiliateStats, applyForReseller, buildStorefrontContactMessage, buildStorefrontCustomFieldPayload, buildStorefrontProductLookup, cancelSubscription, claimWarranty, collectProductSearchHaystack, computeCartLineId, createTicket, dashboard, shoppex as default, emailPreferences, enrollAsReseller, ensureCartLineId, favorites, fetchPublishedBuilderSettings, fetchPublishedThemeSettings, filterProductsBySearchQuery, getMenu, getMenuBySlot, getMenuByTitle, getMenuSlotTitles, getMenus, getMergedStorefrontProducts, getShopReviewsPage, getStorefrontGroupProducts, getStorefrontOnlineUsers, getStorefrontRecentSales, groupMatchesSearchQuery, isProductInStock, isProductOutOfStock, isStorefrontCheckboxCustomFieldValueChecked, isVariantOutOfStock, logout, loyalty, me, mergeSettings, normalizeSearchQuery, normalizeStorefrontCustomFields, order, orders, pauseSubscription, productMatchesSearchQuery, quoteResellerOrder, redeemLoyaltyPoints, removeAvatar, removeFavorite, replyToTicket, requestOtp, reseller, resellerApiKeys, resellerCatalog, resellerOrder, resellerOrders, resellerWallet, resetLicenseHwid, resolveDefaults, resolveDisplayStock, resolveStorefrontApiBaseUrl, resolveStorefrontSocialLinks, resolveVariantStockValue, resumeSubscription, revokeAllSessions, revokeSession, searchMergedStorefrontCatalog, searchMergedStorefrontCatalogItems, sessions, shoppex, stripHtmlFromText, submitStorefrontContactTicket, subscriptionBillingHistory, ticket, touchStorefrontPresence, trackPageView, updateAvatar, updateEmailPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
1998
+ export { type AffiliateValidation, type ApiChallenge, ApiError, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, type CartAddOptions, type CartAddon, type CartAppliedDiscount, type CartBasketMergeLine, type CartCodeSource, CartError, type CartItem, type CartItemUpdate, type CartLineIdentityInput, type CartMetadata, type CartPayload, type CartQuote, type CartQuoteLine, type CartStats, type Category, type CheckoutChallengeCallbacks, type CheckoutChallengeFrame, CheckoutCreateError, type CheckoutOptions, type CheckoutResult, type CouponValidation, type CouponValidationOptions, type CursorPagination, type CustomFieldDefinition, type CustomerEmailPreferencesPatch, type CustomerProfilePatch, type CustomerSubscriptionCancelOptions, type CustomerTicketPayload, type EligibleBundleDeal, type EligibleBundleDealProduct, type EligibleCartDeal, type Feedback, type Invoice, type InvoiceProduct, type Menu, type MenuItem, NetworkError, NotInitializedError, type Page, type PageLayout, type PriceVariant, type Product, type ProductAddon, type ProductBundle, type ProductBundleProduct, type ProductCategory, type ProductDescriptionTab, type ProductFaq, type ProductFeedback, type ProductGroup, type ProductImage, type ProductVariant, type PublishedBuilderSettings, type PublishedThemeSettingsPayload, type ResellerCatalogQuery, type ResellerOrderItem, type ResellerOrdersQuery, type ResolvedThemeSettings, type RewardActionType, type RewardGrantStatus, type RewardProgramSummary, type RewardProgramTeaserItem, type RewardReason, type SDKResponse, type SearchOptions, type SectionDefinition, type SettingField, type Shop, type ShopFeedback, type ShopReviewsPage, type ShopReviewsSummary, type ShopTheme, type ShoppexConfig, ShoppexError, type ShoppexInitOptions, type StorefrontAddon, type StorefrontAddonBootstrap, type StorefrontAnnouncementBarAddon, type StorefrontCatalogSearchItem, type StorefrontContactTicketInput, type StorefrontContactTicketResult, type StorefrontCountdownBarAddon, type StorefrontCouponPopupModalAddon, type StorefrontCustomField, type StorefrontData, type StorefrontItem, type StorefrontOnlineUsers, type StorefrontPromoInfoCardAddon, type StorefrontRecentPurchasePopupAddon, type StorefrontRecentSaleEntry, type StorefrontRecentSales, type StorefrontSearchFilterOptions, type StorefrontSocialLinks, type Subscription, type SubscriptionFlags, type SubscriptionInterval, type ThemeBlockManifest, type ThemeConfig, type TrustedChecks, ValidationError, acceptResellerInvite, addFavorite, affiliate, affiliateStats, applyForReseller, buildStorefrontContactMessage, buildStorefrontCustomFieldPayload, buildStorefrontProductLookup, cancelSubscription, claimWarranty, collectProductSearchHaystack, computeCartLineId, createTicket, dashboard, shoppex as default, emailPreferences, enrollAsReseller, ensureCartLineId, favorites, fetchPublishedBuilderSettings, fetchPublishedThemeSettings, filterProductsBySearchQuery, getMenu, getMenuBySlot, getMenuByTitle, getMenuSlotTitles, getMenus, getMergedStorefrontProducts, getShopReviewsPage, getStorefrontGroupProducts, getStorefrontOnlineUsers, getStorefrontRecentSales, groupMatchesSearchQuery, isProductInStock, isProductOutOfStock, isStorefrontCheckboxCustomFieldValueChecked, isVariantOutOfStock, logout, loyalty, me, mergeSettings, mountCheckoutChallenge, normalizeSearchQuery, normalizeStorefrontCustomFields, order, orders, pauseSubscription, productMatchesSearchQuery, quoteResellerOrder, redeemLoyaltyPoints, removeAvatar, removeFavorite, replyToTicket, requestOtp, reseller, resellerApiKeys, resellerCatalog, resellerOrder, resellerOrders, resellerWallet, resetLicenseHwid, resolveDefaults, resolveDisplayStock, resolveStorefrontApiBaseUrl, resolveStorefrontSocialLinks, resolveVariantStockValue, resumeSubscription, revokeAllSessions, revokeSession, searchMergedStorefrontCatalog, searchMergedStorefrontCatalogItems, sessions, shoppex, stripHtmlFromText, submitStorefrontContactTicket, subscriptionBillingHistory, ticket, touchStorefrontPresence, trackPageView, updateAvatar, updateEmailPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
package/dist/index.d.ts CHANGED
@@ -1423,11 +1423,10 @@ interface CheckoutOptions {
1423
1423
  /**
1424
1424
  * A Cloudflare Turnstile proof for the `storefront_checkout` action.
1425
1425
  *
1426
- * Normally omitted. A checkout surface may provide a renewed proof when a
1427
- * legitimate shared network reaches the public invoice-create budget. The
1428
- * widget must run on the same origin that calls this SDK, while the proof is
1429
- * transport-only and does not change the checkout intent or its idempotency
1430
- * key.
1426
+ * Normally omitted. When checkout returns a challenge, mount the hosted
1427
+ * broker with `mountCheckoutChallenge()` and retry with its renewed proof.
1428
+ * The proof is transport-only and does not change the checkout intent or its
1429
+ * idempotency key.
1431
1430
  */
1432
1431
  turnstileToken?: string;
1433
1432
  /**
@@ -1501,9 +1500,9 @@ interface CheckoutResult {
1501
1500
  */
1502
1501
  code?: string;
1503
1502
  /**
1504
- * Human-verification challenge returned when a legitimate shared network
1505
- * reaches the invoice-create budget. Render the named provider on the same
1506
- * origin that calls the SDK, then retry with its proof as `turnstileToken`.
1503
+ * Human-verification challenge required before creating the invoice. Mount
1504
+ * it with `mountCheckoutChallenge()`, then retry with its proof as
1505
+ * `turnstileToken`.
1507
1506
  */
1508
1507
  challenge?: ApiChallenge;
1509
1508
  }
@@ -1546,6 +1545,25 @@ declare function buildCheckoutUrl(couponOrOptions?: string | CheckoutOptions, op
1546
1545
  */
1547
1546
  declare function buildCheckoutUrlSync(): never;
1548
1547
 
1548
+ interface CheckoutChallengeCallbacks {
1549
+ onSuccess(token: string): void;
1550
+ onExpired?(): void;
1551
+ onUnavailable?(): void;
1552
+ }
1553
+ interface CheckoutChallengeFrame {
1554
+ element: HTMLIFrameElement;
1555
+ dispose(): void;
1556
+ }
1557
+ /**
1558
+ * Mount the Shoppex-hosted Turnstile broker requested by a checkout refusal.
1559
+ *
1560
+ * The challenge always executes on the configured hosted-checkout origin, so
1561
+ * this works on arbitrary custom storefront domains without adding each one
1562
+ * to Cloudflare's widget hostname allowlist. Retry `checkout()` or
1563
+ * `buildCheckoutUrl()` with the token delivered to `onSuccess`.
1564
+ */
1565
+ declare function mountCheckoutChallenge(container: HTMLElement, challenge: ApiChallenge, callbacks: CheckoutChallengeCallbacks): CheckoutChallengeFrame;
1566
+
1549
1567
  interface SearchOptions {
1550
1568
  hideOutOfStock?: boolean;
1551
1569
  maxResults?: number;
@@ -1898,6 +1916,7 @@ declare const shoppex: {
1898
1916
  checkout: typeof checkout;
1899
1917
  buildCheckoutUrl: typeof buildCheckoutUrl;
1900
1918
  buildCheckoutUrlSync: typeof buildCheckoutUrlSync;
1919
+ mountCheckoutChallenge: typeof mountCheckoutChallenge;
1901
1920
  captureAffiliateFromUrl: typeof captureAffiliateFromUrl;
1902
1921
  validateAffiliateCode: typeof validateAffiliateCode;
1903
1922
  applyAffiliateCode: typeof applyAffiliateCode;
@@ -1976,4 +1995,4 @@ declare const shoppex: {
1976
1995
  mergeSettings: typeof mergeSettings;
1977
1996
  };
1978
1997
 
1979
- export { type AffiliateValidation, type ApiChallenge, ApiError, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, type CartAddOptions, type CartAddon, type CartAppliedDiscount, type CartBasketMergeLine, type CartCodeSource, CartError, type CartItem, type CartItemUpdate, type CartLineIdentityInput, type CartMetadata, type CartPayload, type CartQuote, type CartQuoteLine, type CartStats, type Category, CheckoutCreateError, type CheckoutOptions, type CheckoutResult, type CouponValidation, type CouponValidationOptions, type CursorPagination, type CustomFieldDefinition, type CustomerEmailPreferencesPatch, type CustomerProfilePatch, type CustomerSubscriptionCancelOptions, type CustomerTicketPayload, type EligibleBundleDeal, type EligibleBundleDealProduct, type EligibleCartDeal, type Feedback, type Invoice, type InvoiceProduct, type Menu, type MenuItem, NetworkError, NotInitializedError, type Page, type PageLayout, type PriceVariant, type Product, type ProductAddon, type ProductBundle, type ProductBundleProduct, type ProductCategory, type ProductDescriptionTab, type ProductFaq, type ProductFeedback, type ProductGroup, type ProductImage, type ProductVariant, type PublishedBuilderSettings, type PublishedThemeSettingsPayload, type ResellerCatalogQuery, type ResellerOrderItem, type ResellerOrdersQuery, type ResolvedThemeSettings, type RewardActionType, type RewardGrantStatus, type RewardProgramSummary, type RewardProgramTeaserItem, type RewardReason, type SDKResponse, type SearchOptions, type SectionDefinition, type SettingField, type Shop, type ShopFeedback, type ShopReviewsPage, type ShopReviewsSummary, type ShopTheme, type ShoppexConfig, ShoppexError, type ShoppexInitOptions, type StorefrontAddon, type StorefrontAddonBootstrap, type StorefrontAnnouncementBarAddon, type StorefrontCatalogSearchItem, type StorefrontContactTicketInput, type StorefrontContactTicketResult, type StorefrontCountdownBarAddon, type StorefrontCouponPopupModalAddon, type StorefrontCustomField, type StorefrontData, type StorefrontItem, type StorefrontOnlineUsers, type StorefrontPromoInfoCardAddon, type StorefrontRecentPurchasePopupAddon, type StorefrontRecentSaleEntry, type StorefrontRecentSales, type StorefrontSearchFilterOptions, type StorefrontSocialLinks, type Subscription, type SubscriptionFlags, type SubscriptionInterval, type ThemeBlockManifest, type ThemeConfig, type TrustedChecks, ValidationError, acceptResellerInvite, addFavorite, affiliate, affiliateStats, applyForReseller, buildStorefrontContactMessage, buildStorefrontCustomFieldPayload, buildStorefrontProductLookup, cancelSubscription, claimWarranty, collectProductSearchHaystack, computeCartLineId, createTicket, dashboard, shoppex as default, emailPreferences, enrollAsReseller, ensureCartLineId, favorites, fetchPublishedBuilderSettings, fetchPublishedThemeSettings, filterProductsBySearchQuery, getMenu, getMenuBySlot, getMenuByTitle, getMenuSlotTitles, getMenus, getMergedStorefrontProducts, getShopReviewsPage, getStorefrontGroupProducts, getStorefrontOnlineUsers, getStorefrontRecentSales, groupMatchesSearchQuery, isProductInStock, isProductOutOfStock, isStorefrontCheckboxCustomFieldValueChecked, isVariantOutOfStock, logout, loyalty, me, mergeSettings, normalizeSearchQuery, normalizeStorefrontCustomFields, order, orders, pauseSubscription, productMatchesSearchQuery, quoteResellerOrder, redeemLoyaltyPoints, removeAvatar, removeFavorite, replyToTicket, requestOtp, reseller, resellerApiKeys, resellerCatalog, resellerOrder, resellerOrders, resellerWallet, resetLicenseHwid, resolveDefaults, resolveDisplayStock, resolveStorefrontApiBaseUrl, resolveStorefrontSocialLinks, resolveVariantStockValue, resumeSubscription, revokeAllSessions, revokeSession, searchMergedStorefrontCatalog, searchMergedStorefrontCatalogItems, sessions, shoppex, stripHtmlFromText, submitStorefrontContactTicket, subscriptionBillingHistory, ticket, touchStorefrontPresence, trackPageView, updateAvatar, updateEmailPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
1998
+ export { type AffiliateValidation, type ApiChallenge, ApiError, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, type CartAddOptions, type CartAddon, type CartAppliedDiscount, type CartBasketMergeLine, type CartCodeSource, CartError, type CartItem, type CartItemUpdate, type CartLineIdentityInput, type CartMetadata, type CartPayload, type CartQuote, type CartQuoteLine, type CartStats, type Category, type CheckoutChallengeCallbacks, type CheckoutChallengeFrame, CheckoutCreateError, type CheckoutOptions, type CheckoutResult, type CouponValidation, type CouponValidationOptions, type CursorPagination, type CustomFieldDefinition, type CustomerEmailPreferencesPatch, type CustomerProfilePatch, type CustomerSubscriptionCancelOptions, type CustomerTicketPayload, type EligibleBundleDeal, type EligibleBundleDealProduct, type EligibleCartDeal, type Feedback, type Invoice, type InvoiceProduct, type Menu, type MenuItem, NetworkError, NotInitializedError, type Page, type PageLayout, type PriceVariant, type Product, type ProductAddon, type ProductBundle, type ProductBundleProduct, type ProductCategory, type ProductDescriptionTab, type ProductFaq, type ProductFeedback, type ProductGroup, type ProductImage, type ProductVariant, type PublishedBuilderSettings, type PublishedThemeSettingsPayload, type ResellerCatalogQuery, type ResellerOrderItem, type ResellerOrdersQuery, type ResolvedThemeSettings, type RewardActionType, type RewardGrantStatus, type RewardProgramSummary, type RewardProgramTeaserItem, type RewardReason, type SDKResponse, type SearchOptions, type SectionDefinition, type SettingField, type Shop, type ShopFeedback, type ShopReviewsPage, type ShopReviewsSummary, type ShopTheme, type ShoppexConfig, ShoppexError, type ShoppexInitOptions, type StorefrontAddon, type StorefrontAddonBootstrap, type StorefrontAnnouncementBarAddon, type StorefrontCatalogSearchItem, type StorefrontContactTicketInput, type StorefrontContactTicketResult, type StorefrontCountdownBarAddon, type StorefrontCouponPopupModalAddon, type StorefrontCustomField, type StorefrontData, type StorefrontItem, type StorefrontOnlineUsers, type StorefrontPromoInfoCardAddon, type StorefrontRecentPurchasePopupAddon, type StorefrontRecentSaleEntry, type StorefrontRecentSales, type StorefrontSearchFilterOptions, type StorefrontSocialLinks, type Subscription, type SubscriptionFlags, type SubscriptionInterval, type ThemeBlockManifest, type ThemeConfig, type TrustedChecks, ValidationError, acceptResellerInvite, addFavorite, affiliate, affiliateStats, applyForReseller, buildStorefrontContactMessage, buildStorefrontCustomFieldPayload, buildStorefrontProductLookup, cancelSubscription, claimWarranty, collectProductSearchHaystack, computeCartLineId, createTicket, dashboard, shoppex as default, emailPreferences, enrollAsReseller, ensureCartLineId, favorites, fetchPublishedBuilderSettings, fetchPublishedThemeSettings, filterProductsBySearchQuery, getMenu, getMenuBySlot, getMenuByTitle, getMenuSlotTitles, getMenus, getMergedStorefrontProducts, getShopReviewsPage, getStorefrontGroupProducts, getStorefrontOnlineUsers, getStorefrontRecentSales, groupMatchesSearchQuery, isProductInStock, isProductOutOfStock, isStorefrontCheckboxCustomFieldValueChecked, isVariantOutOfStock, logout, loyalty, me, mergeSettings, mountCheckoutChallenge, normalizeSearchQuery, normalizeStorefrontCustomFields, order, orders, pauseSubscription, productMatchesSearchQuery, quoteResellerOrder, redeemLoyaltyPoints, removeAvatar, removeFavorite, replyToTicket, requestOtp, reseller, resellerApiKeys, resellerCatalog, resellerOrder, resellerOrders, resellerWallet, resetLicenseHwid, resolveDefaults, resolveDisplayStock, resolveStorefrontApiBaseUrl, resolveStorefrontSocialLinks, resolveVariantStockValue, resumeSubscription, revokeAllSessions, revokeSession, searchMergedStorefrontCatalog, searchMergedStorefrontCatalogItems, sessions, shoppex, stripHtmlFromText, submitStorefrontContactTicket, subscriptionBillingHistory, ticket, touchStorefrontPresence, trackPageView, updateAvatar, updateEmailPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
package/dist/index.js CHANGED
@@ -1030,7 +1030,7 @@ var PaymentGatewayStateSchema = object({
1030
1030
  });
1031
1031
 
1032
1032
  // ../contracts/src/style-center.ts
1033
- var CHECKOUT_PLATFORM_BRAND_COLOR = "#2563eb";
1033
+ var CHECKOUT_PLATFORM_BRAND_COLOR = "#7c3aed";
1034
1034
  var CHECKOUT_PLATFORM_FONT_FAMILY = "Geist";
1035
1035
  var checkoutStyleSurfaceValues = ["checkout", "payment_link", "embed"];
1036
1036
  var checkoutStyleDensityValues = ["comfortable", "compact"];
@@ -1057,17 +1057,28 @@ var checkoutStyleTokenDefinitions = [
1057
1057
  // background. Setting an explicit hex would clobber the ambient gradient and
1058
1058
  // the right-panel `--surface-2` accent for every default-theme checkout.
1059
1059
  { key: "color.background", cssVar: "--spx-checkout-bg", group: "color", type: "color", default: "" },
1060
- { key: "color.surface", cssVar: "--spx-checkout-surface", group: "color", type: "color", default: "#18181b" },
1061
- { key: "color.surfaceRaised", cssVar: "--spx-checkout-surface-raised", group: "color", type: "color", default: "#27272a" },
1062
- { key: "color.text", cssVar: "--spx-checkout-text", group: "color", type: "color", default: "#fafafa", protected: true },
1063
- { key: "color.textMuted", cssVar: "--spx-checkout-text-muted", group: "color", type: "color", default: "#a1a1aa" },
1064
- // Default '#3f3f46' (zinc-700) feeds many runtime-style fallbacks for
1065
- // payment-method cards, product cards, pills, and inputs. Setting it to ''
1066
- // would turn those slots' `var(--spx-checkout-border, currentColor)` into
1067
- // bright text-color borders. The grey-divider regression on the aside is
1068
- // fixed in the layout file by using the Tailwind `border-border` class
1069
- // instead of binding to this token, which keeps both concerns separated.
1070
- { key: "color.border", cssVar: "--spx-checkout-border", group: "color", type: "color", default: "#222222" },
1060
+ // The four neutrals below are the DARK appearance of the hosted checkout's
1061
+ // tonal ladder (`apps/checkout/app/globals.css`); the light values sit in
1062
+ // CHECKOUT_PLATFORM_BASELINE_LIGHT_DEFAULTS. They are materialised into the
1063
+ // live checkout root, so they are what a shop with no Style Center theme
1064
+ // actually renders which is why each one has to name the SAME rung the
1065
+ // component paints, not a palette of its own.
1066
+ // surface → `--surface-0`, the working panel the buyer pays in
1067
+ // surfaceRaised `--card`, a panel raised above that panel
1068
+ // (the provider widget frame and its loading skeleton)
1069
+ // text → `--foreground`
1070
+ // textMuted → `--muted-foreground`
1071
+ // border → `--border`
1072
+ { key: "color.surface", cssVar: "--spx-checkout-surface", group: "color", type: "color", default: "#1b1b1b" },
1073
+ { key: "color.surfaceRaised", cssVar: "--spx-checkout-surface-raised", group: "color", type: "color", default: "#222222" },
1074
+ { key: "color.text", cssVar: "--spx-checkout-text", group: "color", type: "color", default: "#f5f5f5", protected: true },
1075
+ { key: "color.textMuted", cssVar: "--spx-checkout-text-muted", group: "color", type: "color", default: "#a1a1a1" },
1076
+ // Never '': the border token feeds runtime-style fallbacks for inputs,
1077
+ // provider widgets and buttons, and an unset value turns those slots'
1078
+ // `var(--spx-checkout-border, …)` chains loose. The hosted checkout draws
1079
+ // almost no hairlines any more — the slots that still do read this, the rest
1080
+ // resolve their border to `transparent` in the system CSS.
1081
+ { key: "color.border", cssVar: "--spx-checkout-border", group: "color", type: "color", default: "#2c2c2c" },
1071
1082
  { key: "color.focus", cssVar: "--spx-checkout-focus", group: "color", type: "color", default: CHECKOUT_PLATFORM_BRAND_COLOR, protected: true },
1072
1083
  { key: "color.success", cssVar: "--spx-checkout-success", group: "color", type: "color", default: "#22c55e", protected: true },
1073
1084
  { key: "color.warning", cssVar: "--spx-checkout-warning", group: "color", type: "color", default: "#f59e0b", protected: true },
@@ -1079,9 +1090,16 @@ var checkoutStyleTokenDefinitions = [
1079
1090
  // actually loaded.
1080
1091
  { key: "typography.googleFontFamily", cssVar: "--spx-checkout-google-font", group: "typography", type: "font", default: "" },
1081
1092
  { key: "typography.baseSize", cssVar: "--spx-checkout-font-size", group: "typography", type: "number", default: 14, min: 12, max: 18, step: 1, unit: "px" },
1082
- { key: "shape.buttonRadius", cssVar: "--spx-checkout-button-radius", group: "shape", type: "number", default: 8, min: 0, max: 24, step: 1, unit: "px" },
1083
- { key: "shape.inputRadius", cssVar: "--spx-checkout-input-radius", group: "shape", type: "number", default: 8, min: 0, max: 24, step: 1, unit: "px" },
1084
- { key: "shape.cardRadius", cssVar: "--spx-checkout-card-radius", group: "shape", type: "number", default: 12, min: 0, max: 28, step: 1, unit: "px" },
1093
+ // 12px, not 8, for the same reason as the input below: the hosted pay CTA is
1094
+ // `rounded-xl` and this token is materialised over every slotted button. At 8
1095
+ // the store-credit and manual actions rendered one step tighter than the
1096
+ // field directly above them and than the CTA they stand in for.
1097
+ { key: "shape.buttonRadius", cssVar: "--spx-checkout-button-radius", group: "shape", type: "number", default: 10, min: 0, max: 24, step: 1, unit: "px" },
1098
+ // 12px, not 8: the hosted `Input` primitive is `rounded-lg`, and this token is
1099
+ // materialised over it. At 8 the system CSS rounded every field one step
1100
+ // tighter than the component that drew it.
1101
+ { key: "shape.inputRadius", cssVar: "--spx-checkout-input-radius", group: "shape", type: "number", default: 10, min: 0, max: 24, step: 1, unit: "px" },
1102
+ { key: "shape.cardRadius", cssVar: "--spx-checkout-card-radius", group: "shape", type: "number", default: 10, min: 0, max: 28, step: 1, unit: "px" },
1085
1103
  {
1086
1104
  key: "spacing.density",
1087
1105
  cssVar: "--spx-checkout-density",
@@ -1093,8 +1111,8 @@ var checkoutStyleTokenDefinitions = [
1093
1111
  { key: "spacing.controlHeight", cssVar: "--spx-checkout-control-height", group: "spacing", type: "number", default: 48, min: 36, max: 56, step: 2, unit: "px" },
1094
1112
  { key: "component.primaryButton.background", cssVar: "--spx-checkout-button-bg", group: "component", type: "color", default: "", protected: true },
1095
1113
  { key: "component.primaryButton.text", cssVar: "--spx-checkout-button-text", group: "component", type: "color", default: "#ffffff", protected: true },
1096
- { key: "component.input.background", cssVar: "--spx-checkout-input-bg", group: "component", type: "color", default: "#111111" },
1097
- { key: "component.input.border", cssVar: "--spx-checkout-input-border", group: "component", type: "color", default: "#222222" },
1114
+ { key: "component.input.background", cssVar: "--spx-checkout-input-bg", group: "component", type: "color", default: "#292929" },
1115
+ { key: "component.input.border", cssVar: "--spx-checkout-input-border", group: "component", type: "color", default: "#2c2c2c" },
1098
1116
  { key: "component.input.focusRing", cssVar: "--spx-checkout-input-focus-ring", group: "component", type: "color", default: "" },
1099
1117
  // Default '' is filtered out by the preview-iframe normaliser, so the
1100
1118
  // CSS fallback chain on [data-spx-slot="summary.panel"] resolves to
@@ -1119,14 +1137,14 @@ var checkoutStyleTokenDefinitions = [
1119
1137
  { key: "component.brandAvatar.border", cssVar: "--spx-checkout-brand-avatar-border", group: "component", type: "color", default: "rgba(255,255,255,0.1)" },
1120
1138
  { key: "component.pill.background", cssVar: "--spx-checkout-pill-bg", group: "component", type: "color", default: "rgba(255,255,255,0.04)" },
1121
1139
  { key: "component.pill.border", cssVar: "--spx-checkout-pill-border", group: "component", type: "color", default: "rgba(255,255,255,0.08)" },
1122
- { key: "component.pill.text", cssVar: "--spx-checkout-pill-text", group: "component", type: "color", default: "#a1a1aa" },
1140
+ { key: "component.pill.text", cssVar: "--spx-checkout-pill-text", group: "component", type: "color", default: "#a1a1a1" },
1123
1141
  { key: "component.errorBanner.background", cssVar: "--spx-checkout-error-bg", group: "component", type: "color", default: "rgba(239,68,68,0.1)" },
1124
1142
  { key: "component.errorBanner.border", cssVar: "--spx-checkout-error-border", group: "component", type: "color", default: "rgba(239,68,68,0.2)" },
1125
1143
  { key: "component.errorBanner.text", cssVar: "--spx-checkout-error-text", group: "component", type: "color", default: "#ef4444" },
1126
1144
  { key: "component.warningBanner.background", cssVar: "--spx-checkout-warning-bg", group: "component", type: "color", default: "" },
1127
1145
  { key: "component.warningBanner.border", cssVar: "--spx-checkout-warning-border", group: "component", type: "color", default: "" },
1128
1146
  { key: "component.warningBanner.text", cssVar: "--spx-checkout-warning-text", group: "component", type: "color", default: "" },
1129
- { key: "component.radio.idleRing", cssVar: "--spx-checkout-radio-idle-ring", group: "component", type: "color", default: "rgba(161,161,170,0.5)" },
1147
+ { key: "component.radio.idleRing", cssVar: "--spx-checkout-radio-idle-ring", group: "component", type: "color", default: "rgba(161,161,161,0.5)" },
1130
1148
  { key: "component.radio.checkedFill", cssVar: "--spx-checkout-radio-checked-fill", group: "component", type: "color", default: "" },
1131
1149
  { key: "component.radio.checkedIcon", cssVar: "--spx-checkout-radio-checked-icon", group: "component", type: "color", default: "#ffffff" },
1132
1150
  { key: "component.divider.color", cssVar: "--spx-checkout-divider", group: "component", type: "color", default: "rgba(255,255,255,0.06)" }
@@ -1928,6 +1946,32 @@ var externalPaymentAdapterConformanceResponseSchema = externalPaymentAdapterBase
1928
1946
  });
1929
1947
 
1930
1948
  // ../contracts/src/redirect-link-template.ts
1949
+ var REMAINING_PLACEHOLDER_PATTERNS = [
1950
+ /\{\{[\s\S]*?\}\}/g,
1951
+ /(?<!\{)\{[^{}]+\}(?!\})/g
1952
+ ];
1953
+ function findDanglingBraceFragments(template) {
1954
+ let stripped = template;
1955
+ for (const pattern of REMAINING_PLACEHOLDER_PATTERNS) {
1956
+ stripped = stripped.replace(pattern, "");
1957
+ }
1958
+ return /[{}]/.test(stripped) ? [...new Set(stripped.match(/[{}]+/g) ?? [])] : [];
1959
+ }
1960
+ function findRemainingProductRedirectPlaceholders(template) {
1961
+ if (!template.trim()) {
1962
+ return [];
1963
+ }
1964
+ const remaining = /* @__PURE__ */ new Set();
1965
+ for (const pattern of REMAINING_PLACEHOLDER_PATTERNS) {
1966
+ for (const match of template.matchAll(pattern)) {
1967
+ remaining.add(match[0]);
1968
+ }
1969
+ }
1970
+ for (const fragment of findDanglingBraceFragments(template)) {
1971
+ remaining.add(fragment);
1972
+ }
1973
+ return [...remaining];
1974
+ }
1931
1975
  function isSafeHttpsRedirectTemplateUrl(url2) {
1932
1976
  const trimmed = url2.trim();
1933
1977
  if (!trimmed) {
@@ -1989,6 +2033,11 @@ function requirePriceDisplayUnlessPayWhatYouWant(product, ctx) {
1989
2033
  }
1990
2034
  var publicInvoiceWireProductSchema = external_exports.object({
1991
2035
  addons: external_exports.array(publicInvoiceWireProductAddonSchema).optional(),
2036
+ /** Per-line cart-edit capability from the enricher; the checkout renders no
2037
+ * control without an explicit true. */
2038
+ quantity_editable: external_exports.boolean().optional(),
2039
+ addons_editable: external_exports.boolean().optional(),
2040
+ removable: external_exports.boolean().optional(),
1992
2041
  available_addons: external_exports.array(external_exports.unknown()).optional(),
1993
2042
  cloudflare_image_id: external_exports.string().nullable(),
1994
2043
  created_at: external_exports.string().optional(),
@@ -4522,6 +4571,9 @@ function resolvePostPurchaseRedirectUrl(redirectUrl) {
4522
4571
  if (!isSafeHttpsRedirectTemplateUrl(normalized)) {
4523
4572
  return { value: null, error: "redirectUrl must be an absolute HTTPS URL." };
4524
4573
  }
4574
+ if (findRemainingProductRedirectPlaceholders(normalized).length > 0) {
4575
+ return { value: null, error: "redirectUrl must not contain template placeholders." };
4576
+ }
4525
4577
  return { value: normalized, error: null };
4526
4578
  }
4527
4579
  var pendingCheckoutCreates = /* @__PURE__ */ new Map();
@@ -4934,6 +4986,67 @@ function buildCheckoutUrlSync() {
4934
4986
  throw new Error("buildCheckoutUrlSync is deprecated. Use buildCheckoutUrl (async) instead.");
4935
4987
  }
4936
4988
 
4989
+ // ../sdk/src/modules/checkout-challenge.ts
4990
+ var TURNSTILE_FRAME_MESSAGE_SOURCE = "shoppex-turnstile";
4991
+ var TURNSTILE_FRAME_MESSAGE_VERSION = 1;
4992
+ function readFrameMessage(value, nonce) {
4993
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
4994
+ const record2 = value;
4995
+ if (record2.source !== TURNSTILE_FRAME_MESSAGE_SOURCE || record2.version !== TURNSTILE_FRAME_MESSAGE_VERSION || record2.nonce !== nonce || !["success", "expired", "timeout", "error"].includes(String(record2.type))) return null;
4996
+ if (record2.type === "success" && (typeof record2.token !== "string" || !record2.token.trim())) {
4997
+ return null;
4998
+ }
4999
+ return {
5000
+ type: record2.type,
5001
+ ...typeof record2.token === "string" ? { token: record2.token.trim() } : {}
5002
+ };
5003
+ }
5004
+ function mountCheckoutChallenge(container, challenge, callbacks) {
5005
+ if (challenge.provider !== "turnstile" || !challenge.siteKey.trim()) {
5006
+ throw new Error("Checkout challenge is invalid.");
5007
+ }
5008
+ const win = container.ownerDocument.defaultView;
5009
+ if (!win) throw new Error("Checkout challenge requires a browser document.");
5010
+ const checkoutBaseUrl = getConfig().checkoutBaseUrl;
5011
+ const frameUrl = new URL("/turnstile", checkoutBaseUrl);
5012
+ if (frameUrl.protocol !== "https:" && frameUrl.protocol !== "http:") {
5013
+ throw new Error("Checkout base URL must use http or https.");
5014
+ }
5015
+ const nonce = win.crypto.randomUUID();
5016
+ frameUrl.searchParams.set("site_key", challenge.siteKey.trim());
5017
+ frameUrl.searchParams.set("nonce", nonce);
5018
+ const frame = container.ownerDocument.createElement("iframe");
5019
+ frame.src = frameUrl.toString();
5020
+ frame.title = "Checkout verification";
5021
+ frame.referrerPolicy = "no-referrer";
5022
+ frame.style.border = "0";
5023
+ frame.style.width = "100%";
5024
+ frame.style.height = "72px";
5025
+ let disposed = false;
5026
+ const onMessage = (event) => {
5027
+ if (disposed || event.origin !== frameUrl.origin || event.source !== frame.contentWindow) return;
5028
+ const message = readFrameMessage(event.data, nonce);
5029
+ if (!message) return;
5030
+ if (message.type === "success") callbacks.onSuccess(message.token);
5031
+ if (message.type === "expired" || message.type === "timeout") callbacks.onExpired?.();
5032
+ if (message.type === "error") callbacks.onUnavailable?.();
5033
+ };
5034
+ const onFrameError = () => callbacks.onUnavailable?.();
5035
+ win.addEventListener("message", onMessage);
5036
+ frame.addEventListener("error", onFrameError, { once: true });
5037
+ container.appendChild(frame);
5038
+ return {
5039
+ element: frame,
5040
+ dispose() {
5041
+ if (disposed) return;
5042
+ disposed = true;
5043
+ win.removeEventListener("message", onMessage);
5044
+ frame.removeEventListener("error", onFrameError);
5045
+ frame.remove();
5046
+ }
5047
+ };
5048
+ }
5049
+
4937
5050
  // ../sdk/src/modules/coupons.ts
4938
5051
  async function resolveShopId() {
4939
5052
  const cachedShopId2 = getShopId();
@@ -5943,6 +6056,7 @@ var shoppex = {
5943
6056
  checkout,
5944
6057
  buildCheckoutUrl,
5945
6058
  buildCheckoutUrlSync,
6059
+ mountCheckoutChallenge,
5946
6060
  // Affiliates
5947
6061
  captureAffiliateFromUrl,
5948
6062
  validateAffiliateCode,
@@ -6091,6 +6205,7 @@ export {
6091
6205
  loyalty,
6092
6206
  me,
6093
6207
  mergeSettings,
6208
+ mountCheckoutChallenge,
6094
6209
  normalizeSearchQuery,
6095
6210
  normalizeStorefrontCustomFields,
6096
6211
  order,