@shoppexio/storefront 1.0.82 → 1.0.84
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/CHANGELOG.md +7 -0
- package/README.md +2 -0
- package/dist/index.cjs +46 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +45 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1908,7 +1908,19 @@ declare function getMenu(title: string): Promise<SDKResponse<Menu>>;
|
|
|
1908
1908
|
declare function getMenuBySlot(slot: NavigationMenuSlot): Promise<SDKResponse<Menu>>;
|
|
1909
1909
|
declare function getMenuSlotTitles(slot: NavigationMenuSlot): string[];
|
|
1910
1910
|
|
|
1911
|
+
/**
|
|
1912
|
+
* Counts a page view. Call it once per page load or client-side navigation.
|
|
1913
|
+
* Passing the cart also records it for the live visitor map.
|
|
1914
|
+
*/
|
|
1911
1915
|
declare function trackPageView(cartValue?: number, itemCount?: number): Promise<void>;
|
|
1916
|
+
/**
|
|
1917
|
+
* Reports a cart change for the live visitor map without counting a page view
|
|
1918
|
+
* (`event_type: 'presence'`). Use it when the cart changes on a page that was
|
|
1919
|
+
* already counted. A cart state that any tab of this shop already reported is
|
|
1920
|
+
* not sent again, so a cross-tab `storage` echo of a change is not a second
|
|
1921
|
+
* ping.
|
|
1922
|
+
*/
|
|
1923
|
+
declare function trackCartActivity(cartValue: number, itemCount: number): Promise<void>;
|
|
1912
1924
|
|
|
1913
1925
|
/**
|
|
1914
1926
|
* Anonymized recent-sales feed for storefront social proof (product title +
|
|
@@ -1917,6 +1929,12 @@ declare function trackPageView(cartValue?: number, itemCount?: number): Promise<
|
|
|
1917
1929
|
*/
|
|
1918
1930
|
declare function getStorefrontRecentSales(): Promise<SDKResponse<StorefrontRecentSales>>;
|
|
1919
1931
|
declare function getStorefrontOnlineUsers(): Promise<SDKResponse<StorefrontOnlineUsers>>;
|
|
1932
|
+
/**
|
|
1933
|
+
* Keeps this visitor's live presence fresh. The ping carries
|
|
1934
|
+
* `event_type: 'presence'`, so the server refreshes the live session without
|
|
1935
|
+
* counting a shop view: an idle tab that touches presence every minute must
|
|
1936
|
+
* not add a view every few minutes. Page views go through `trackPageView()`.
|
|
1937
|
+
*/
|
|
1920
1938
|
declare function touchStorefrontPresence(): Promise<SDKResponse<{
|
|
1921
1939
|
pong: string;
|
|
1922
1940
|
}>>;
|
|
@@ -2066,6 +2084,7 @@ declare const shoppex: {
|
|
|
2066
2084
|
getMenuByTitle: typeof getMenuByTitle;
|
|
2067
2085
|
getMenuSlotTitles: typeof getMenuSlotTitles;
|
|
2068
2086
|
trackPageView: typeof trackPageView;
|
|
2087
|
+
trackCartActivity: typeof trackCartActivity;
|
|
2069
2088
|
getStorefrontOnlineUsers: typeof getStorefrontOnlineUsers;
|
|
2070
2089
|
getStorefrontRecentSales: typeof getStorefrontRecentSales;
|
|
2071
2090
|
touchStorefrontPresence: typeof touchStorefrontPresence;
|
|
@@ -2080,4 +2099,4 @@ declare const shoppex: {
|
|
|
2080
2099
|
mergeSettings: typeof mergeSettings;
|
|
2081
2100
|
};
|
|
2082
2101
|
|
|
2083
|
-
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, trackPageView, updateAvatar, updateEmailPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
|
|
2102
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1908,7 +1908,19 @@ declare function getMenu(title: string): Promise<SDKResponse<Menu>>;
|
|
|
1908
1908
|
declare function getMenuBySlot(slot: NavigationMenuSlot): Promise<SDKResponse<Menu>>;
|
|
1909
1909
|
declare function getMenuSlotTitles(slot: NavigationMenuSlot): string[];
|
|
1910
1910
|
|
|
1911
|
+
/**
|
|
1912
|
+
* Counts a page view. Call it once per page load or client-side navigation.
|
|
1913
|
+
* Passing the cart also records it for the live visitor map.
|
|
1914
|
+
*/
|
|
1911
1915
|
declare function trackPageView(cartValue?: number, itemCount?: number): Promise<void>;
|
|
1916
|
+
/**
|
|
1917
|
+
* Reports a cart change for the live visitor map without counting a page view
|
|
1918
|
+
* (`event_type: 'presence'`). Use it when the cart changes on a page that was
|
|
1919
|
+
* already counted. A cart state that any tab of this shop already reported is
|
|
1920
|
+
* not sent again, so a cross-tab `storage` echo of a change is not a second
|
|
1921
|
+
* ping.
|
|
1922
|
+
*/
|
|
1923
|
+
declare function trackCartActivity(cartValue: number, itemCount: number): Promise<void>;
|
|
1912
1924
|
|
|
1913
1925
|
/**
|
|
1914
1926
|
* Anonymized recent-sales feed for storefront social proof (product title +
|
|
@@ -1917,6 +1929,12 @@ declare function trackPageView(cartValue?: number, itemCount?: number): Promise<
|
|
|
1917
1929
|
*/
|
|
1918
1930
|
declare function getStorefrontRecentSales(): Promise<SDKResponse<StorefrontRecentSales>>;
|
|
1919
1931
|
declare function getStorefrontOnlineUsers(): Promise<SDKResponse<StorefrontOnlineUsers>>;
|
|
1932
|
+
/**
|
|
1933
|
+
* Keeps this visitor's live presence fresh. The ping carries
|
|
1934
|
+
* `event_type: 'presence'`, so the server refreshes the live session without
|
|
1935
|
+
* counting a shop view: an idle tab that touches presence every minute must
|
|
1936
|
+
* not add a view every few minutes. Page views go through `trackPageView()`.
|
|
1937
|
+
*/
|
|
1920
1938
|
declare function touchStorefrontPresence(): Promise<SDKResponse<{
|
|
1921
1939
|
pong: string;
|
|
1922
1940
|
}>>;
|
|
@@ -2066,6 +2084,7 @@ declare const shoppex: {
|
|
|
2066
2084
|
getMenuByTitle: typeof getMenuByTitle;
|
|
2067
2085
|
getMenuSlotTitles: typeof getMenuSlotTitles;
|
|
2068
2086
|
trackPageView: typeof trackPageView;
|
|
2087
|
+
trackCartActivity: typeof trackCartActivity;
|
|
2069
2088
|
getStorefrontOnlineUsers: typeof getStorefrontOnlineUsers;
|
|
2070
2089
|
getStorefrontRecentSales: typeof getStorefrontRecentSales;
|
|
2071
2090
|
touchStorefrontPresence: typeof touchStorefrontPresence;
|
|
@@ -2080,4 +2099,4 @@ declare const shoppex: {
|
|
|
2080
2099
|
mergeSettings: typeof mergeSettings;
|
|
2081
2100
|
};
|
|
2082
2101
|
|
|
2083
|
-
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, trackPageView, updateAvatar, updateEmailPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
|
|
2102
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -6083,13 +6083,27 @@ function isPlatformPageTrackerActive() {
|
|
|
6083
6083
|
}
|
|
6084
6084
|
|
|
6085
6085
|
// ../sdk/src/modules/analytics.ts
|
|
6086
|
+
var REPORTED_CART_STORAGE_PREFIX = "reported_cart_";
|
|
6087
|
+
function reportedCartKey(storeSlug) {
|
|
6088
|
+
return `${REPORTED_CART_STORAGE_PREFIX}${storeSlug}`;
|
|
6089
|
+
}
|
|
6090
|
+
function cartSnapshot(cartValue, itemCount) {
|
|
6091
|
+
return `${cartValue ?? ""}|${itemCount ?? ""}`;
|
|
6092
|
+
}
|
|
6093
|
+
function rememberReportedCart(storeSlug, cartValue, itemCount) {
|
|
6094
|
+
setItem(reportedCartKey(storeSlug), cartSnapshot(cartValue, itemCount));
|
|
6095
|
+
}
|
|
6086
6096
|
async function trackPageView(cartValue, itemCount) {
|
|
6087
6097
|
if (!isInitialized()) return;
|
|
6088
6098
|
if (typeof document === "undefined") return;
|
|
6089
6099
|
const carriesCart = cartValue !== void 0 || itemCount !== void 0;
|
|
6090
|
-
if (isPlatformPageTrackerActive()
|
|
6100
|
+
if (isPlatformPageTrackerActive()) {
|
|
6101
|
+
if (carriesCart) await sendCartActivity(cartValue ?? 0, itemCount ?? 0);
|
|
6102
|
+
return;
|
|
6103
|
+
}
|
|
6091
6104
|
const config = getConfig();
|
|
6092
6105
|
const connectionId = getStorefrontConnectionId(config.storeSlug);
|
|
6106
|
+
if (carriesCart) rememberReportedCart(config.storeSlug, cartValue, itemCount);
|
|
6093
6107
|
try {
|
|
6094
6108
|
const endpoint = buildEndpoint("/v1/storefront/shops/:storeSlug/ping", {
|
|
6095
6109
|
storeSlug: config.storeSlug
|
|
@@ -6109,6 +6123,33 @@ async function trackPageView(cartValue, itemCount) {
|
|
|
6109
6123
|
} catch {
|
|
6110
6124
|
}
|
|
6111
6125
|
}
|
|
6126
|
+
async function trackCartActivity(cartValue, itemCount) {
|
|
6127
|
+
if (!isInitialized()) return;
|
|
6128
|
+
if (typeof document === "undefined") return;
|
|
6129
|
+
if (getItem(reportedCartKey(getConfig().storeSlug)) === cartSnapshot(cartValue, itemCount)) return;
|
|
6130
|
+
await sendCartActivity(cartValue, itemCount);
|
|
6131
|
+
}
|
|
6132
|
+
async function sendCartActivity(cartValue, itemCount) {
|
|
6133
|
+
const config = getConfig();
|
|
6134
|
+
rememberReportedCart(config.storeSlug, cartValue, itemCount);
|
|
6135
|
+
try {
|
|
6136
|
+
const endpoint = buildEndpoint("/v1/storefront/shops/:storeSlug/ping", {
|
|
6137
|
+
storeSlug: config.storeSlug
|
|
6138
|
+
});
|
|
6139
|
+
await fetch(`${config.apiBaseUrl}${endpoint}`, {
|
|
6140
|
+
method: "POST",
|
|
6141
|
+
headers: { "Content-Type": "application/json" },
|
|
6142
|
+
body: JSON.stringify({
|
|
6143
|
+
event_type: "presence",
|
|
6144
|
+
cart_value: cartValue,
|
|
6145
|
+
item_count: itemCount,
|
|
6146
|
+
connection_id: getStorefrontConnectionId(config.storeSlug) ?? void 0,
|
|
6147
|
+
path: resolveStorefrontPagePath()
|
|
6148
|
+
})
|
|
6149
|
+
});
|
|
6150
|
+
} catch {
|
|
6151
|
+
}
|
|
6152
|
+
}
|
|
6112
6153
|
|
|
6113
6154
|
// ../sdk/src/modules/presence.ts
|
|
6114
6155
|
async function getStorefrontRecentSales() {
|
|
@@ -6159,6 +6200,7 @@ async function touchStorefrontPresence() {
|
|
|
6159
6200
|
return post(
|
|
6160
6201
|
endpoint,
|
|
6161
6202
|
{
|
|
6203
|
+
event_type: "presence",
|
|
6162
6204
|
referer: document.referrer || void 0,
|
|
6163
6205
|
connection_id: getStorefrontConnectionId(config.storeSlug) ?? void 0,
|
|
6164
6206
|
path: resolveStorefrontPagePath(),
|
|
@@ -6378,6 +6420,7 @@ var shoppex = {
|
|
|
6378
6420
|
getMenuSlotTitles,
|
|
6379
6421
|
// Analytics
|
|
6380
6422
|
trackPageView,
|
|
6423
|
+
trackCartActivity,
|
|
6381
6424
|
getStorefrontOnlineUsers,
|
|
6382
6425
|
getStorefrontRecentSales,
|
|
6383
6426
|
touchStorefrontPresence,
|
|
@@ -6491,6 +6534,7 @@ export {
|
|
|
6491
6534
|
subscriptionBillingHistory,
|
|
6492
6535
|
ticket,
|
|
6493
6536
|
touchStorefrontPresence,
|
|
6537
|
+
trackCartActivity,
|
|
6494
6538
|
trackPageView,
|
|
6495
6539
|
updateAvatar,
|
|
6496
6540
|
updateEmailPreferences,
|