@shoppexio/storefront 1.0.87 → 1.0.89

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
@@ -487,6 +487,13 @@ interface ShopReviewsPage {
487
487
  feedback: Feedback[];
488
488
  pagination: CursorPagination;
489
489
  summary: ShopReviewsSummary;
490
+ /**
491
+ * The product filter the API applied (the `product` passed in), or null for
492
+ * the whole shop. `getShopReviewsPage` fails a filtered request whose answer
493
+ * does not carry the same id, so a caller never gets another product's
494
+ * reviews from an API that ignored the filter.
495
+ */
496
+ product?: string | null;
490
497
  }
491
498
  interface ProductBundle {
492
499
  id?: string;
@@ -1701,6 +1708,8 @@ declare function validateCoupon(code: string, productOrOptions?: string | Coupon
1701
1708
  * Note: Shoppex has shop-level feedback, not product-level reviews.
1702
1709
  */
1703
1710
 
1711
+ /** `code` of a filtered request the API answered without applying the filter. */
1712
+ declare const PRODUCT_FILTER_UNSUPPORTED = "reviews_product_filter_unsupported";
1704
1713
  interface ShopReviewsPageOptions {
1705
1714
  /**
1706
1715
  * One product's reviews, by the product's public id (the `id` the catalog
@@ -1923,14 +1932,14 @@ declare function trackPageView(cartValue?: number, itemCount?: number): Promise<
1923
1932
  /**
1924
1933
  * Reports a cart change for the live visitor map without counting a page view
1925
1934
  * (`event_type: 'presence'`). Use it when the cart changes on a page that was
1926
- * already counted. A cart state the server already acknowledged, or that a tab
1927
- * of this shop is sending right now, is not sent again, so a cross-tab `storage`
1928
- * echo of a change is not a second ping. A failed send leaves nothing behind:
1929
- * the same state goes out again on the next change or page load.
1935
+ * already counted. A cart state the server holds, or will hold once a send in
1936
+ * flight lands, is not sent again, so a cross-tab `storage` echo of a change is
1937
+ * not a second ping. A failed send leaves nothing behind: the same state goes
1938
+ * out again on the next change or page load.
1930
1939
  *
1931
- * The check runs when the change's turn comes, after this tab's earlier sends
1932
- * settled, never at call time: a revert to the confirmed cart while another
1933
- * state is on the wire must still go out once that send confirms its state.
1940
+ * The sequence is taken at call time; the check runs when the change's turn
1941
+ * comes, after this tab's earlier sends settled: a revert to the confirmed
1942
+ * cart while another state is on the wire must still go out.
1934
1943
  */
1935
1944
  declare function trackCartActivity(cartValue: number, itemCount: number): Promise<void>;
1936
1945
 
@@ -2111,4 +2120,4 @@ declare const shoppex: {
2111
2120
  mergeSettings: typeof mergeSettings;
2112
2121
  };
2113
2122
 
2114
- export { type AffiliateValidation, ApiError, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, CURRENCY_UNAVAILABLE_ERROR_CODE, 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, trackCartActivity, trackPageView, updateAvatar, updateEmailPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
2123
+ export { type AffiliateValidation, ApiError, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, CURRENCY_UNAVAILABLE_ERROR_CODE, 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, PRODUCT_FILTER_UNSUPPORTED, 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, trackCartActivity, trackPageView, updateAvatar, updateEmailPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
package/dist/index.d.ts CHANGED
@@ -487,6 +487,13 @@ interface ShopReviewsPage {
487
487
  feedback: Feedback[];
488
488
  pagination: CursorPagination;
489
489
  summary: ShopReviewsSummary;
490
+ /**
491
+ * The product filter the API applied (the `product` passed in), or null for
492
+ * the whole shop. `getShopReviewsPage` fails a filtered request whose answer
493
+ * does not carry the same id, so a caller never gets another product's
494
+ * reviews from an API that ignored the filter.
495
+ */
496
+ product?: string | null;
490
497
  }
491
498
  interface ProductBundle {
492
499
  id?: string;
@@ -1701,6 +1708,8 @@ declare function validateCoupon(code: string, productOrOptions?: string | Coupon
1701
1708
  * Note: Shoppex has shop-level feedback, not product-level reviews.
1702
1709
  */
1703
1710
 
1711
+ /** `code` of a filtered request the API answered without applying the filter. */
1712
+ declare const PRODUCT_FILTER_UNSUPPORTED = "reviews_product_filter_unsupported";
1704
1713
  interface ShopReviewsPageOptions {
1705
1714
  /**
1706
1715
  * One product's reviews, by the product's public id (the `id` the catalog
@@ -1923,14 +1932,14 @@ declare function trackPageView(cartValue?: number, itemCount?: number): Promise<
1923
1932
  /**
1924
1933
  * Reports a cart change for the live visitor map without counting a page view
1925
1934
  * (`event_type: 'presence'`). Use it when the cart changes on a page that was
1926
- * already counted. A cart state the server already acknowledged, or that a tab
1927
- * of this shop is sending right now, is not sent again, so a cross-tab `storage`
1928
- * echo of a change is not a second ping. A failed send leaves nothing behind:
1929
- * the same state goes out again on the next change or page load.
1935
+ * already counted. A cart state the server holds, or will hold once a send in
1936
+ * flight lands, is not sent again, so a cross-tab `storage` echo of a change is
1937
+ * not a second ping. A failed send leaves nothing behind: the same state goes
1938
+ * out again on the next change or page load.
1930
1939
  *
1931
- * The check runs when the change's turn comes, after this tab's earlier sends
1932
- * settled, never at call time: a revert to the confirmed cart while another
1933
- * state is on the wire must still go out once that send confirms its state.
1940
+ * The sequence is taken at call time; the check runs when the change's turn
1941
+ * comes, after this tab's earlier sends settled: a revert to the confirmed
1942
+ * cart while another state is on the wire must still go out.
1934
1943
  */
1935
1944
  declare function trackCartActivity(cartValue: number, itemCount: number): Promise<void>;
1936
1945
 
@@ -2111,4 +2120,4 @@ declare const shoppex: {
2111
2120
  mergeSettings: typeof mergeSettings;
2112
2121
  };
2113
2122
 
2114
- export { type AffiliateValidation, ApiError, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, CURRENCY_UNAVAILABLE_ERROR_CODE, 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, trackCartActivity, trackPageView, updateAvatar, updateEmailPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
2123
+ export { type AffiliateValidation, ApiError, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, CURRENCY_UNAVAILABLE_ERROR_CODE, 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, PRODUCT_FILTER_UNSUPPORTED, 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, trackCartActivity, trackPageView, updateAvatar, updateEmailPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
package/dist/index.js CHANGED
@@ -5372,6 +5372,7 @@ function normalizeFeedback(raw, index) {
5372
5372
  created_at
5373
5373
  };
5374
5374
  }
5375
+ var PRODUCT_FILTER_UNSUPPORTED = "reviews_product_filter_unsupported";
5375
5376
  async function getShopReviewsPage(cursor, options = {}) {
5376
5377
  const config = getConfig();
5377
5378
  const query = new URLSearchParams();
@@ -5397,6 +5398,15 @@ async function getShopReviewsPage(cursor, options = {}) {
5397
5398
  }
5398
5399
  );
5399
5400
  if (response.success && response.data) {
5401
+ if (product && response.data.product !== product) {
5402
+ return {
5403
+ success: false,
5404
+ message: "Reviews for a single product are not available from this store yet.",
5405
+ code: PRODUCT_FILTER_UNSUPPORTED,
5406
+ status: 200,
5407
+ responseReceived: true
5408
+ };
5409
+ }
5400
5410
  return {
5401
5411
  success: true,
5402
5412
  data: {
@@ -6082,6 +6092,7 @@ function isPlatformPageTrackerActive() {
6082
6092
  // ../sdk/src/modules/analytics.ts
6083
6093
  var CONFIRMED_CART_STORAGE_PREFIX = "reported_cart_";
6084
6094
  var IN_FLIGHT_CART_STORAGE_PREFIX = "reporting_cart_";
6095
+ var CART_SEQUENCE_STORAGE_PREFIX = "presence_cart_seq_";
6085
6096
  var CART_CLAIM_TTL_MS = 1e4;
6086
6097
  function confirmedCartKey(storeSlug) {
6087
6098
  return `${CONFIRMED_CART_STORAGE_PREFIX}${storeSlug}`;
@@ -6089,33 +6100,77 @@ function confirmedCartKey(storeSlug) {
6089
6100
  function inFlightCartKey(storeSlug) {
6090
6101
  return `${IN_FLIGHT_CART_STORAGE_PREFIX}${storeSlug}`;
6091
6102
  }
6103
+ function cartSequenceKey(storeSlug) {
6104
+ return `${CART_SEQUENCE_STORAGE_PREFIX}${storeSlug}`;
6105
+ }
6092
6106
  function cartSnapshot(cartValue, itemCount) {
6093
6107
  return `${cartValue ?? ""}|${itemCount ?? ""}`;
6094
6108
  }
6109
+ function isCartSequence(value) {
6110
+ return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
6111
+ }
6112
+ var CART_SEQUENCE_SCOPE_MAX_LENGTH = 64;
6113
+ function readCartCounter(storeSlug) {
6114
+ const counter = getItem(cartSequenceKey(storeSlug));
6115
+ if (!counter || typeof counter.scope !== "string" || counter.scope.length === 0 || counter.scope.length > CART_SEQUENCE_SCOPE_MAX_LENGTH || !isCartSequence(counter.seq)) {
6116
+ return null;
6117
+ }
6118
+ return counter;
6119
+ }
6120
+ var lastCartOrder = null;
6121
+ function nextCartOrder(storeSlug) {
6122
+ const stored = readCartCounter(storeSlug);
6123
+ const scope = stored?.scope ?? lastCartOrder?.scope ?? createClaimToken();
6124
+ const floor = Math.max(stored?.seq ?? 0, lastCartOrder?.scope === scope ? lastCartOrder.seq : 0);
6125
+ const order2 = { scope, seq: Math.max(Date.now(), floor + 1) };
6126
+ lastCartOrder = order2;
6127
+ setItem(cartSequenceKey(storeSlug), order2);
6128
+ return order2;
6129
+ }
6130
+ function cartSequenceLocks() {
6131
+ if (typeof navigator === "undefined") return null;
6132
+ const locks = navigator.locks;
6133
+ return locks && typeof locks.request === "function" ? locks : null;
6134
+ }
6135
+ function reserveCartOrder(storeSlug) {
6136
+ const take = () => nextCartOrder(storeSlug);
6137
+ const locks = cartSequenceLocks();
6138
+ if (!locks) return Promise.resolve(take());
6139
+ return locks.request(cartSequenceKey(storeSlug), take).catch(take);
6140
+ }
6141
+ function readConfirmedCart(storeSlug) {
6142
+ const confirmed = getItem(confirmedCartKey(storeSlug));
6143
+ if (!confirmed || typeof confirmed.snapshot !== "string" || !isCartSequence(confirmed.seq)) return null;
6144
+ return confirmed;
6145
+ }
6095
6146
  function readInFlightCart(storeSlug) {
6096
6147
  const claim = getItem(inFlightCartKey(storeSlug));
6097
- if (!claim || typeof claim.snapshot !== "string" || typeof claim.token !== "string" || typeof claim.at !== "number") {
6148
+ if (!claim || typeof claim.snapshot !== "string" || !isCartSequence(claim.seq) || typeof claim.token !== "string" || typeof claim.at !== "number") {
6098
6149
  return null;
6099
6150
  }
6100
6151
  return claim;
6101
6152
  }
6102
6153
  function isCartReportedOrInFlight(storeSlug, snapshot) {
6103
- if (getItem(confirmedCartKey(storeSlug)) === snapshot) return true;
6154
+ const confirmed = readConfirmedCart(storeSlug);
6104
6155
  const claim = readInFlightCart(storeSlug);
6105
- return claim !== null && claim.snapshot === snapshot && Date.now() - claim.at < CART_CLAIM_TTL_MS;
6156
+ const liveClaim = claim && Date.now() - claim.at < CART_CLAIM_TTL_MS ? claim : null;
6157
+ const expected = liveClaim && (!confirmed || liveClaim.seq > confirmed.seq) ? liveClaim : confirmed;
6158
+ return expected?.snapshot === snapshot;
6106
6159
  }
6107
6160
  function createClaimToken() {
6108
6161
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") return crypto.randomUUID();
6109
6162
  return `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`;
6110
6163
  }
6111
- function claimCartReport(storeSlug, cartValue, itemCount) {
6164
+ function claimCartReport(storeSlug, seq, cartValue, itemCount) {
6112
6165
  const snapshot = cartSnapshot(cartValue, itemCount);
6113
6166
  const token = createClaimToken();
6114
- setItem(inFlightCartKey(storeSlug), { snapshot, token, at: Date.now() });
6167
+ setItem(inFlightCartKey(storeSlug), { snapshot, seq, token, at: Date.now() });
6115
6168
  return (delivered) => {
6116
- if (readInFlightCart(storeSlug)?.token !== token) return;
6117
- if (delivered) setItem(confirmedCartKey(storeSlug), snapshot);
6118
- removeItem(inFlightCartKey(storeSlug));
6169
+ if (delivered) {
6170
+ const confirmed = readConfirmedCart(storeSlug);
6171
+ if (!confirmed || seq > confirmed.seq) setItem(confirmedCartKey(storeSlug), { snapshot, seq });
6172
+ }
6173
+ if (readInFlightCart(storeSlug)?.token === token) removeItem(inFlightCartKey(storeSlug));
6119
6174
  };
6120
6175
  }
6121
6176
  var cartSendTail = Promise.resolve();
@@ -6156,42 +6211,50 @@ async function postPing(body) {
6156
6211
  async function trackPageView(cartValue, itemCount) {
6157
6212
  if (!isInitialized()) return;
6158
6213
  if (typeof document === "undefined") return;
6214
+ const config = getConfig();
6159
6215
  const carriesCart = cartValue !== void 0 || itemCount !== void 0;
6216
+ const reservedOrder = carriesCart ? reserveCartOrder(config.storeSlug) : void 0;
6160
6217
  if (isPlatformPageTrackerActive()) {
6161
- if (carriesCart) await enqueueCartSend(() => sendCartActivity(cartValue, itemCount));
6218
+ if (reservedOrder) await enqueueCartSend(async () => sendCartActivity(await reservedOrder, cartValue, itemCount));
6162
6219
  return;
6163
6220
  }
6164
- const config = getConfig();
6165
6221
  const sendView = async () => {
6166
- const settle = carriesCart ? claimCartReport(config.storeSlug, cartValue, itemCount) : void 0;
6222
+ const order2 = reservedOrder ? await reservedOrder : void 0;
6223
+ const settle = order2 ? claimCartReport(config.storeSlug, order2.seq, cartValue, itemCount) : void 0;
6167
6224
  const delivered = await postPing({
6168
6225
  referer: document.referrer || void 0,
6169
6226
  cart_value: cartValue,
6170
6227
  item_count: itemCount,
6228
+ cart_seq: order2?.seq,
6229
+ cart_seq_scope: order2?.scope,
6171
6230
  connection_id: getStorefrontConnectionId(config.storeSlug) ?? void 0,
6172
6231
  path: resolveStorefrontPagePath(),
6173
6232
  utm: resolveUtmParameters(config.storeSlug)
6174
6233
  });
6175
6234
  settle?.(delivered);
6176
6235
  };
6177
- await (carriesCart ? enqueueCartSend(sendView) : sendView());
6236
+ await (reservedOrder ? enqueueCartSend(sendView) : sendView());
6178
6237
  }
6179
6238
  async function trackCartActivity(cartValue, itemCount) {
6180
6239
  if (!isInitialized()) return;
6181
6240
  if (typeof document === "undefined") return;
6182
6241
  const snapshot = cartSnapshot(cartValue, itemCount);
6242
+ const reservedOrder = reserveCartOrder(getConfig().storeSlug);
6183
6243
  await enqueueCartSend(async (isLatest) => {
6244
+ const order2 = await reservedOrder;
6184
6245
  if (!isLatest() || isCartReportedOrInFlight(getConfig().storeSlug, snapshot)) return;
6185
- await sendCartActivity(cartValue, itemCount);
6246
+ await sendCartActivity(order2, cartValue, itemCount);
6186
6247
  });
6187
6248
  }
6188
- async function sendCartActivity(cartValue, itemCount) {
6249
+ async function sendCartActivity(order2, cartValue, itemCount) {
6189
6250
  const config = getConfig();
6190
- const settle = claimCartReport(config.storeSlug, cartValue, itemCount);
6251
+ const settle = claimCartReport(config.storeSlug, order2.seq, cartValue, itemCount);
6191
6252
  const delivered = await postPing({
6192
6253
  event_type: "presence",
6193
6254
  cart_value: cartValue,
6194
6255
  item_count: itemCount,
6256
+ cart_seq: order2.seq,
6257
+ cart_seq_scope: order2.scope,
6195
6258
  connection_id: getStorefrontConnectionId(config.storeSlug) ?? void 0,
6196
6259
  path: resolveStorefrontPagePath()
6197
6260
  });
@@ -6501,6 +6564,7 @@ export {
6501
6564
  NetworkError,
6502
6565
  NotInitializedError,
6503
6566
  PAYABLE_AMOUNT_DECIMAL_PLACES,
6567
+ PRODUCT_FILTER_UNSUPPORTED,
6504
6568
  ShoppexError,
6505
6569
  ValidationError,
6506
6570
  acceptResellerInvite,