@shoppexio/storefront 0.3.1 → 0.3.7

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
@@ -540,6 +540,10 @@ type StorefrontAddon = StorefrontAnnouncementBarAddon | StorefrontCountdownBarAd
540
540
  interface StorefrontAddonBootstrap {
541
541
  items: StorefrontAddon[];
542
542
  }
543
+ interface StorefrontOnlineUsers {
544
+ count: number;
545
+ window_seconds: number;
546
+ }
543
547
  type StorefrontItem = {
544
548
  item_type: 'PRODUCT' | 'GROUP';
545
549
  uniqid: string;
@@ -634,7 +638,7 @@ interface CartPayload {
634
638
  coupon?: string;
635
639
  }
636
640
  interface CartAppliedDiscount {
637
- source: 'AUTOMATIC_PRODUCT_DEAL' | 'BUNDLE_DEAL' | 'COUPON';
641
+ source: 'PRODUCT_DISCOUNT' | 'VOLUME_DISCOUNT' | 'AUTOMATIC_PRODUCT_DEAL' | 'BUNDLE_DEAL' | 'COUPON';
638
642
  source_id: string | null;
639
643
  source_uniqid: string | null;
640
644
  label: string;
@@ -870,6 +874,31 @@ type ResolvedThemeSettings = {
870
874
  };
871
875
  };
872
876
 
877
+ type JsonRecord = Record<string, unknown>;
878
+ interface PublishedBuilderSettings {
879
+ version: number;
880
+ revision: number;
881
+ theme: {
882
+ content: JsonRecord;
883
+ layout: JsonRecord;
884
+ style_slots: JsonRecord;
885
+ pages?: unknown[];
886
+ terms?: JsonRecord;
887
+ [key: string]: unknown;
888
+ };
889
+ [key: string]: unknown;
890
+ }
891
+ interface PublishedThemeSettingsPayload {
892
+ settings: ResolvedThemeSettings;
893
+ builder_settings: PublishedBuilderSettings | null;
894
+ content: JsonRecord;
895
+ style_slots: JsonRecord;
896
+ }
897
+ declare function fetchPublishedBuilderSettings(shopSlug: string): Promise<PublishedThemeSettingsPayload | null>;
898
+ declare function fetchPublishedThemeSettings(shopSlug: string): Promise<ResolvedThemeSettings | null>;
899
+ declare function resolveDefaults(config: ThemeConfig): ResolvedThemeSettings;
900
+ declare function mergeSettings(defaults: ResolvedThemeSettings, overrides: Partial<ResolvedThemeSettings>): ResolvedThemeSettings;
901
+
873
902
  /**
874
903
  * Store Module
875
904
  *
@@ -895,6 +924,9 @@ declare function getStoreBannerUrl(): Promise<string | null>;
895
924
  interface GetStorefrontProductsPageOptions {
896
925
  cursor?: string | null;
897
926
  limit?: number;
927
+ sort?: 'featured' | 'newest' | 'price-asc' | 'price-desc' | string | null;
928
+ category?: string | null;
929
+ hideOutOfStock?: boolean;
898
930
  }
899
931
  declare function getProducts(): Promise<SDKResponse<Product[]>>;
900
932
  declare function getStorefrontProductsPage(options?: GetStorefrontProductsPageOptions): Promise<SDKResponse<{
@@ -1032,6 +1064,10 @@ declare function getMenus(): Promise<SDKResponse<Menu[]>>;
1032
1064
  * Get a menu by its exact title.
1033
1065
  */
1034
1066
  declare function getMenuByTitle(title: string): Promise<SDKResponse<Menu>>;
1067
+ /**
1068
+ * Get a menu by its exact title.
1069
+ */
1070
+ declare function getMenu(title: string): Promise<SDKResponse<Menu>>;
1035
1071
  /**
1036
1072
  * Get a menu by canonical slot. The backend resolves legacy menu titles too.
1037
1073
  */
@@ -1040,6 +1076,11 @@ declare function getMenuSlotTitles(slot: NavigationMenuSlot): string[];
1040
1076
 
1041
1077
  declare function trackPageView(cartValue?: number, itemCount?: number): Promise<void>;
1042
1078
 
1079
+ declare function getStorefrontOnlineUsers(): Promise<SDKResponse<StorefrontOnlineUsers>>;
1080
+ declare function touchStorefrontPresence(): Promise<SDKResponse<{
1081
+ pong: string;
1082
+ }>>;
1083
+
1043
1084
  /**
1044
1085
  * Formatting Utilities
1045
1086
  */
@@ -1056,10 +1097,6 @@ declare function getCacheStats(): CacheStats;
1056
1097
  declare function clearCache(): void;
1057
1098
  declare function invalidateCache(prefixOrKey: string): void;
1058
1099
 
1059
- declare function fetchPublishedThemeSettings(shopSlug: string): Promise<ResolvedThemeSettings | null>;
1060
- declare function resolveDefaults(config: ThemeConfig): ResolvedThemeSettings;
1061
- declare function mergeSettings(defaults: ResolvedThemeSettings, overrides: Partial<ResolvedThemeSettings>): ResolvedThemeSettings;
1062
-
1063
1100
  /**
1064
1101
  * Shoppex Storefront SDK
1065
1102
  *
@@ -1134,18 +1171,22 @@ declare const shoppex: {
1134
1171
  getPages: typeof getPages;
1135
1172
  getPage: typeof getPage;
1136
1173
  getMenus: typeof getMenus;
1174
+ getMenu: typeof getMenu;
1137
1175
  getMenuBySlot: typeof getMenuBySlot;
1138
1176
  getMenuByTitle: typeof getMenuByTitle;
1139
1177
  getMenuSlotTitles: typeof getMenuSlotTitles;
1140
1178
  trackPageView: typeof trackPageView;
1179
+ getStorefrontOnlineUsers: typeof getStorefrontOnlineUsers;
1180
+ touchStorefrontPresence: typeof touchStorefrontPresence;
1141
1181
  createFormatter: typeof createFormatter;
1142
1182
  formatPrice: typeof formatPrice;
1143
1183
  clearCache: typeof clearCache;
1144
1184
  invalidateCache: typeof invalidateCache;
1145
1185
  getCacheStats: typeof getCacheStats;
1186
+ fetchPublishedBuilderSettings: typeof fetchPublishedBuilderSettings;
1146
1187
  fetchPublishedThemeSettings: typeof fetchPublishedThemeSettings;
1147
1188
  resolveDefaults: typeof resolveDefaults;
1148
1189
  mergeSettings: typeof mergeSettings;
1149
1190
  };
1150
1191
 
1151
- export { type AffiliateValidation, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, type CartAddOptions, type CartAddon, type CartAppliedDiscount, CartError, type CartItem, type CartMetadata, type CartPayload, type CartQuote, type CartStats, type Category, type CouponValidation, type CouponValidationOptions, type CursorPagination, type CustomFieldDefinition, 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 ProductFaq, type ProductFeedback, type ProductGroup, type ProductImage, type ProductVariant, type ResolvedThemeSettings, type RewardActionType, type RewardGrantStatus, type RewardProgramSummary, type RewardProgramTeaserItem, type RewardReason, type SDKResponse, type SectionDefinition, type SettingField, type Shop, type ShopFeedback, type ShopTheme, type ShoppexConfig, ShoppexError, type ShoppexInitOptions, type StorefrontAddon, type StorefrontAddonBootstrap, type StorefrontAnnouncementBarAddon, type StorefrontCountdownBarAddon, type StorefrontCouponPopupModalAddon, type StorefrontCustomField, type StorefrontData, type StorefrontItem, type StorefrontPromoInfoCardAddon, type StorefrontRecentPurchasePopupAddon, type Subscription, type SubscriptionFlags, type SubscriptionInterval, type ThemeBlockManifest, type ThemeConfig, type TrustedChecks, ValidationError, buildStorefrontCustomFieldPayload, shoppex as default, fetchPublishedThemeSettings, getMenuBySlot, getMenuByTitle, getMenuSlotTitles, isStorefrontCheckboxCustomFieldValueChecked, mergeSettings, normalizeStorefrontCustomFields, resolveDefaults, shoppex, trackPageView, validateStorefrontCustomFieldValue };
1192
+ export { type AffiliateValidation, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, type CartAddOptions, type CartAddon, type CartAppliedDiscount, CartError, type CartItem, type CartMetadata, type CartPayload, type CartQuote, type CartStats, type Category, type CouponValidation, type CouponValidationOptions, type CursorPagination, type CustomFieldDefinition, 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 ProductFaq, type ProductFeedback, type ProductGroup, type ProductImage, type ProductVariant, type PublishedBuilderSettings, type PublishedThemeSettingsPayload, type ResolvedThemeSettings, type RewardActionType, type RewardGrantStatus, type RewardProgramSummary, type RewardProgramTeaserItem, type RewardReason, type SDKResponse, type SectionDefinition, type SettingField, type Shop, type ShopFeedback, type ShopTheme, type ShoppexConfig, ShoppexError, type ShoppexInitOptions, type StorefrontAddon, type StorefrontAddonBootstrap, type StorefrontAnnouncementBarAddon, type StorefrontCountdownBarAddon, type StorefrontCouponPopupModalAddon, type StorefrontCustomField, type StorefrontData, type StorefrontItem, type StorefrontOnlineUsers, type StorefrontPromoInfoCardAddon, type StorefrontRecentPurchasePopupAddon, type Subscription, type SubscriptionFlags, type SubscriptionInterval, type ThemeBlockManifest, type ThemeConfig, type TrustedChecks, ValidationError, buildStorefrontCustomFieldPayload, shoppex as default, fetchPublishedBuilderSettings, fetchPublishedThemeSettings, getMenu, getMenuBySlot, getMenuByTitle, getMenuSlotTitles, getMenus, getStorefrontOnlineUsers, isStorefrontCheckboxCustomFieldValueChecked, mergeSettings, normalizeStorefrontCustomFields, resolveDefaults, shoppex, touchStorefrontPresence, trackPageView, validateStorefrontCustomFieldValue };
package/dist/index.d.ts CHANGED
@@ -540,6 +540,10 @@ type StorefrontAddon = StorefrontAnnouncementBarAddon | StorefrontCountdownBarAd
540
540
  interface StorefrontAddonBootstrap {
541
541
  items: StorefrontAddon[];
542
542
  }
543
+ interface StorefrontOnlineUsers {
544
+ count: number;
545
+ window_seconds: number;
546
+ }
543
547
  type StorefrontItem = {
544
548
  item_type: 'PRODUCT' | 'GROUP';
545
549
  uniqid: string;
@@ -634,7 +638,7 @@ interface CartPayload {
634
638
  coupon?: string;
635
639
  }
636
640
  interface CartAppliedDiscount {
637
- source: 'AUTOMATIC_PRODUCT_DEAL' | 'BUNDLE_DEAL' | 'COUPON';
641
+ source: 'PRODUCT_DISCOUNT' | 'VOLUME_DISCOUNT' | 'AUTOMATIC_PRODUCT_DEAL' | 'BUNDLE_DEAL' | 'COUPON';
638
642
  source_id: string | null;
639
643
  source_uniqid: string | null;
640
644
  label: string;
@@ -870,6 +874,31 @@ type ResolvedThemeSettings = {
870
874
  };
871
875
  };
872
876
 
877
+ type JsonRecord = Record<string, unknown>;
878
+ interface PublishedBuilderSettings {
879
+ version: number;
880
+ revision: number;
881
+ theme: {
882
+ content: JsonRecord;
883
+ layout: JsonRecord;
884
+ style_slots: JsonRecord;
885
+ pages?: unknown[];
886
+ terms?: JsonRecord;
887
+ [key: string]: unknown;
888
+ };
889
+ [key: string]: unknown;
890
+ }
891
+ interface PublishedThemeSettingsPayload {
892
+ settings: ResolvedThemeSettings;
893
+ builder_settings: PublishedBuilderSettings | null;
894
+ content: JsonRecord;
895
+ style_slots: JsonRecord;
896
+ }
897
+ declare function fetchPublishedBuilderSettings(shopSlug: string): Promise<PublishedThemeSettingsPayload | null>;
898
+ declare function fetchPublishedThemeSettings(shopSlug: string): Promise<ResolvedThemeSettings | null>;
899
+ declare function resolveDefaults(config: ThemeConfig): ResolvedThemeSettings;
900
+ declare function mergeSettings(defaults: ResolvedThemeSettings, overrides: Partial<ResolvedThemeSettings>): ResolvedThemeSettings;
901
+
873
902
  /**
874
903
  * Store Module
875
904
  *
@@ -895,6 +924,9 @@ declare function getStoreBannerUrl(): Promise<string | null>;
895
924
  interface GetStorefrontProductsPageOptions {
896
925
  cursor?: string | null;
897
926
  limit?: number;
927
+ sort?: 'featured' | 'newest' | 'price-asc' | 'price-desc' | string | null;
928
+ category?: string | null;
929
+ hideOutOfStock?: boolean;
898
930
  }
899
931
  declare function getProducts(): Promise<SDKResponse<Product[]>>;
900
932
  declare function getStorefrontProductsPage(options?: GetStorefrontProductsPageOptions): Promise<SDKResponse<{
@@ -1032,6 +1064,10 @@ declare function getMenus(): Promise<SDKResponse<Menu[]>>;
1032
1064
  * Get a menu by its exact title.
1033
1065
  */
1034
1066
  declare function getMenuByTitle(title: string): Promise<SDKResponse<Menu>>;
1067
+ /**
1068
+ * Get a menu by its exact title.
1069
+ */
1070
+ declare function getMenu(title: string): Promise<SDKResponse<Menu>>;
1035
1071
  /**
1036
1072
  * Get a menu by canonical slot. The backend resolves legacy menu titles too.
1037
1073
  */
@@ -1040,6 +1076,11 @@ declare function getMenuSlotTitles(slot: NavigationMenuSlot): string[];
1040
1076
 
1041
1077
  declare function trackPageView(cartValue?: number, itemCount?: number): Promise<void>;
1042
1078
 
1079
+ declare function getStorefrontOnlineUsers(): Promise<SDKResponse<StorefrontOnlineUsers>>;
1080
+ declare function touchStorefrontPresence(): Promise<SDKResponse<{
1081
+ pong: string;
1082
+ }>>;
1083
+
1043
1084
  /**
1044
1085
  * Formatting Utilities
1045
1086
  */
@@ -1056,10 +1097,6 @@ declare function getCacheStats(): CacheStats;
1056
1097
  declare function clearCache(): void;
1057
1098
  declare function invalidateCache(prefixOrKey: string): void;
1058
1099
 
1059
- declare function fetchPublishedThemeSettings(shopSlug: string): Promise<ResolvedThemeSettings | null>;
1060
- declare function resolveDefaults(config: ThemeConfig): ResolvedThemeSettings;
1061
- declare function mergeSettings(defaults: ResolvedThemeSettings, overrides: Partial<ResolvedThemeSettings>): ResolvedThemeSettings;
1062
-
1063
1100
  /**
1064
1101
  * Shoppex Storefront SDK
1065
1102
  *
@@ -1134,18 +1171,22 @@ declare const shoppex: {
1134
1171
  getPages: typeof getPages;
1135
1172
  getPage: typeof getPage;
1136
1173
  getMenus: typeof getMenus;
1174
+ getMenu: typeof getMenu;
1137
1175
  getMenuBySlot: typeof getMenuBySlot;
1138
1176
  getMenuByTitle: typeof getMenuByTitle;
1139
1177
  getMenuSlotTitles: typeof getMenuSlotTitles;
1140
1178
  trackPageView: typeof trackPageView;
1179
+ getStorefrontOnlineUsers: typeof getStorefrontOnlineUsers;
1180
+ touchStorefrontPresence: typeof touchStorefrontPresence;
1141
1181
  createFormatter: typeof createFormatter;
1142
1182
  formatPrice: typeof formatPrice;
1143
1183
  clearCache: typeof clearCache;
1144
1184
  invalidateCache: typeof invalidateCache;
1145
1185
  getCacheStats: typeof getCacheStats;
1186
+ fetchPublishedBuilderSettings: typeof fetchPublishedBuilderSettings;
1146
1187
  fetchPublishedThemeSettings: typeof fetchPublishedThemeSettings;
1147
1188
  resolveDefaults: typeof resolveDefaults;
1148
1189
  mergeSettings: typeof mergeSettings;
1149
1190
  };
1150
1191
 
1151
- export { type AffiliateValidation, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, type CartAddOptions, type CartAddon, type CartAppliedDiscount, CartError, type CartItem, type CartMetadata, type CartPayload, type CartQuote, type CartStats, type Category, type CouponValidation, type CouponValidationOptions, type CursorPagination, type CustomFieldDefinition, 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 ProductFaq, type ProductFeedback, type ProductGroup, type ProductImage, type ProductVariant, type ResolvedThemeSettings, type RewardActionType, type RewardGrantStatus, type RewardProgramSummary, type RewardProgramTeaserItem, type RewardReason, type SDKResponse, type SectionDefinition, type SettingField, type Shop, type ShopFeedback, type ShopTheme, type ShoppexConfig, ShoppexError, type ShoppexInitOptions, type StorefrontAddon, type StorefrontAddonBootstrap, type StorefrontAnnouncementBarAddon, type StorefrontCountdownBarAddon, type StorefrontCouponPopupModalAddon, type StorefrontCustomField, type StorefrontData, type StorefrontItem, type StorefrontPromoInfoCardAddon, type StorefrontRecentPurchasePopupAddon, type Subscription, type SubscriptionFlags, type SubscriptionInterval, type ThemeBlockManifest, type ThemeConfig, type TrustedChecks, ValidationError, buildStorefrontCustomFieldPayload, shoppex as default, fetchPublishedThemeSettings, getMenuBySlot, getMenuByTitle, getMenuSlotTitles, isStorefrontCheckboxCustomFieldValueChecked, mergeSettings, normalizeStorefrontCustomFields, resolveDefaults, shoppex, trackPageView, validateStorefrontCustomFieldValue };
1192
+ export { type AffiliateValidation, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, type CartAddOptions, type CartAddon, type CartAppliedDiscount, CartError, type CartItem, type CartMetadata, type CartPayload, type CartQuote, type CartStats, type Category, type CouponValidation, type CouponValidationOptions, type CursorPagination, type CustomFieldDefinition, 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 ProductFaq, type ProductFeedback, type ProductGroup, type ProductImage, type ProductVariant, type PublishedBuilderSettings, type PublishedThemeSettingsPayload, type ResolvedThemeSettings, type RewardActionType, type RewardGrantStatus, type RewardProgramSummary, type RewardProgramTeaserItem, type RewardReason, type SDKResponse, type SectionDefinition, type SettingField, type Shop, type ShopFeedback, type ShopTheme, type ShoppexConfig, ShoppexError, type ShoppexInitOptions, type StorefrontAddon, type StorefrontAddonBootstrap, type StorefrontAnnouncementBarAddon, type StorefrontCountdownBarAddon, type StorefrontCouponPopupModalAddon, type StorefrontCustomField, type StorefrontData, type StorefrontItem, type StorefrontOnlineUsers, type StorefrontPromoInfoCardAddon, type StorefrontRecentPurchasePopupAddon, type Subscription, type SubscriptionFlags, type SubscriptionInterval, type ThemeBlockManifest, type ThemeConfig, type TrustedChecks, ValidationError, buildStorefrontCustomFieldPayload, shoppex as default, fetchPublishedBuilderSettings, fetchPublishedThemeSettings, getMenu, getMenuBySlot, getMenuByTitle, getMenuSlotTitles, getMenus, getStorefrontOnlineUsers, isStorefrontCheckboxCustomFieldValueChecked, mergeSettings, normalizeStorefrontCustomFields, resolveDefaults, shoppex, touchStorefrontPresence, trackPageView, validateStorefrontCustomFieldValue };