@fast-simon/dashboard-utilities 1.0.181-beta.9 → 1.0.182-beta.1

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.
@@ -69,6 +69,7 @@ export interface smartCollectionsProps {
69
69
  personalization?: string | null;
70
70
  force_and?: boolean;
71
71
  session_token?: string;
72
+ include_unpublished?: boolean;
72
73
  }
73
74
  export type FacetRequired = 0 | 1 | 2;
74
75
  export type smartCollectionsCallback = ({}: {
@@ -1 +1 @@
1
- {"version":3,"file":"categories.js","sourceRoot":"","sources":["../../src/@types/categories.ts"],"names":[],"mappings":"","sourcesContent":["import {SortBy} from \"./sortBy\";\nimport {Narrow, ServerNarrow} from \"./narrow\";\nimport { ServerProduct} from \"./product\";\nimport {ServerFacet} from \"./facets\";\nimport {ContextFilteringData, QueryUnderstanding} from \"./results\";\n\n\nexport type AncestorCategory = [string, string, string] // category_id, category_name, category_url\nexport interface RelatedCategory {\n id: string\n l: string\n t: string\n u: string\n}\nexport type CategoryAncestor = [string, string, string]\nexport interface Category {\n d: string\n id: string\n l: string\n p_id: string\n t: string\n u: string\n parent_name?: string\n}\nexport interface FastCategory {\n d: string\n id: string\n l: string\n p_id: string\n t: string\n u: string\n parent_name?: string\n}\nexport interface smartCollectionsProps {\n storeID: number\n uuid: string\n siteKey?:string\n cdn: number\n categoryID: string,\n userToken: string,\n sessionStart: number,\n page?: number\n productsPerPage?: number\n sortBy?: SortBy\n narrowBy?: ServerNarrow[]\n facetRequired?: FacetRequired\n withAttributes?: boolean\n recent?: string\n rec?: boolean\n searchWithinSearch?: string,\n segments?: string[],\n hasShopifyMarkets?: boolean,\n disable_turbolinks?:boolean\n disable_strategies?:boolean\n disable_merchandising?:boolean\n disable_semantics?:boolean\n disable_merchandising_rules?:boolean\n disable_antonyms?:boolean\n custom_sort_settings?:{personalization_rank: number, creation_date: number, popularity: number, inventory: number}\n with_product_analytics?:boolean\n market_context?: string | null // Region code for market-specific filtering (e.g., \"US\", \"CA\", \"UK\")\n variation_id?: string | null // A/B test variation ID for reasoning/experiment tracking\n ps?: 'new' | 'returning' | null // Personalization segment for user segment coefficient preview (new/returning user)\n spv?: string | null // Session Product Views JSON for personalization preview (e.g., '{\"pid1\":ts,\"pid2\":ts}')\n spc?: string | null // Session Product Cart-adds JSON for size personalization preview (e.g., '{\"pid::vid\":ts}'); collection-only\n personalization?: string | null // Comma-separated personalization types to enable (e.g., 'gender')\n force_and?: boolean\n session_token?: string // Session token override for AI Explainer (sent as st param)\n}\nexport type FacetRequired = 0 | 1 | 2\nexport type smartCollectionsCallback = ({}: {\n action: \"products\" | \"facets and products\"\n payload: smartCollectionsResults\n}) => void\nexport interface smartCollectionsResults {\n ancestors: CategoryAncestor[]\n categoryID: string\n name: string\n category_name: string\n products: ServerProduct[]\n facets?: ServerFacet[]\n totalResults: number\n sortBy?: SortBy,\n narrow?: Narrow[],\n isNoResults?: boolean\n page?: number\n pageCount?: number\n avoidPrefixList?: string[]\n antonyms?: Record<string, number[]>\n merch?: any\n bannerHTML?: string\n turbolink?:string\n hiddenProducts?:ServerProduct[]\n within_search_results_for?:string\n results_for?: string\n id_list?:number[]\n personalized_products?: number[] // Product IDs affected by RPI personalization\n context?: ContextFilteringData // Context-based filtering data (market contexts)\n analytics?: {\n badges?: {\n winners?: Record<string, string> // Product ID -> tooltip message\n overexposed?: Record<string, string> // Product ID -> tooltip message\n new_arrivals?: string[]\n }\n key_hidden_winners?: string\n key_overexposed?: string\n }\n matching_sets?: Record<string, string> // Product ID -> set name\n group_strategy?: Record<string, string> // Product ID -> group name\n variety_strategy?: number[] // Product IDs affected by variety strategy\n query_understanding?: QueryUnderstanding\n reformulation_source?: string\n request_url?: string // Full URL with all params that was executed (for debugging)\n rpi_methodology_assigned?: string | null\n rpi_methodology_preview_requested?: boolean\n rpi_methodology_effective?: string | null\n rpi_methodology_fallback_reason?: string | null\n rpi_snapshot_computed_at?: string | null\n rpi_snapshot_covered_until?: string | null\n rpi_candidate_available?: boolean\n rpi_candidate_unavailable_reason?: string | null\n rpi_candidate_readiness_status?: string | null\n\n}\nexport type inventoryCallback = ({}: {\n action: \"products inventory\"\n payload: {productsInventory: productsInventoryResults[]}\n}) => void\nexport interface productsInventoryResults {\n id: string;\n totalInventory: number;\n}\n"]}
1
+ {"version":3,"file":"categories.js","sourceRoot":"","sources":["../../src/@types/categories.ts"],"names":[],"mappings":"","sourcesContent":["import {SortBy} from \"./sortBy\";\nimport {Narrow, ServerNarrow} from \"./narrow\";\nimport { ServerProduct} from \"./product\";\nimport {ServerFacet} from \"./facets\";\nimport {ContextFilteringData, QueryUnderstanding} from \"./results\";\n\n\nexport type AncestorCategory = [string, string, string] // category_id, category_name, category_url\nexport interface RelatedCategory {\n id: string\n l: string\n t: string\n u: string\n}\nexport type CategoryAncestor = [string, string, string]\nexport interface Category {\n d: string\n id: string\n l: string\n p_id: string\n t: string\n u: string\n parent_name?: string\n}\nexport interface FastCategory {\n d: string\n id: string\n l: string\n p_id: string\n t: string\n u: string\n parent_name?: string\n}\nexport interface smartCollectionsProps {\n storeID: number\n uuid: string\n siteKey?:string\n cdn: number\n categoryID: string,\n userToken: string,\n sessionStart: number,\n page?: number\n productsPerPage?: number\n sortBy?: SortBy\n narrowBy?: ServerNarrow[]\n facetRequired?: FacetRequired\n withAttributes?: boolean\n recent?: string\n rec?: boolean\n searchWithinSearch?: string,\n segments?: string[],\n hasShopifyMarkets?: boolean,\n disable_turbolinks?:boolean\n disable_strategies?:boolean\n disable_merchandising?:boolean\n disable_semantics?:boolean\n disable_merchandising_rules?:boolean\n disable_antonyms?:boolean\n custom_sort_settings?:{personalization_rank: number, creation_date: number, popularity: number, inventory: number}\n with_product_analytics?:boolean\n market_context?: string | null // Region code for market-specific filtering (e.g., \"US\", \"CA\", \"UK\")\n variation_id?: string | null // A/B test variation ID for reasoning/experiment tracking\n ps?: 'new' | 'returning' | null // Personalization segment for user segment coefficient preview (new/returning user)\n spv?: string | null // Session Product Views JSON for personalization preview (e.g., '{\"pid1\":ts,\"pid2\":ts}')\n spc?: string | null // Session Product Cart-adds JSON for size personalization preview (e.g., '{\"pid::vid\":ts}'); collection-only\n personalization?: string | null // Comma-separated personalization types to enable (e.g., 'gender')\n force_and?: boolean\n session_token?: string // Session token override for AI Explainer (sent as st param)\n include_unpublished?: boolean // AI Explainer \"Unpublished products\" switch; sent only on the page and analytics requests\n}\nexport type FacetRequired = 0 | 1 | 2\nexport type smartCollectionsCallback = ({}: {\n action: \"products\" | \"facets and products\"\n payload: smartCollectionsResults\n}) => void\nexport interface smartCollectionsResults {\n ancestors: CategoryAncestor[]\n categoryID: string\n name: string\n category_name: string\n products: ServerProduct[]\n facets?: ServerFacet[]\n totalResults: number\n sortBy?: SortBy,\n narrow?: Narrow[],\n isNoResults?: boolean\n page?: number\n pageCount?: number\n avoidPrefixList?: string[]\n antonyms?: Record<string, number[]>\n merch?: any\n bannerHTML?: string\n turbolink?:string\n hiddenProducts?:ServerProduct[]\n within_search_results_for?:string\n results_for?: string\n id_list?:number[]\n personalized_products?: number[] // Product IDs affected by RPI personalization\n context?: ContextFilteringData // Context-based filtering data (market contexts)\n analytics?: {\n badges?: {\n winners?: Record<string, string> // Product ID -> tooltip message\n overexposed?: Record<string, string> // Product ID -> tooltip message\n new_arrivals?: string[]\n }\n key_hidden_winners?: string\n key_overexposed?: string\n }\n matching_sets?: Record<string, string> // Product ID -> set name\n group_strategy?: Record<string, string> // Product ID -> group name\n variety_strategy?: number[] // Product IDs affected by variety strategy\n query_understanding?: QueryUnderstanding\n reformulation_source?: string\n request_url?: string // Full URL with all params that was executed (for debugging)\n rpi_methodology_assigned?: string | null\n rpi_methodology_preview_requested?: boolean\n rpi_methodology_effective?: string | null\n rpi_methodology_fallback_reason?: string | null\n rpi_snapshot_computed_at?: string | null\n rpi_snapshot_covered_until?: string | null\n rpi_candidate_available?: boolean\n rpi_candidate_unavailable_reason?: string | null\n rpi_candidate_readiness_status?: string | null\n\n}\nexport type inventoryCallback = ({}: {\n action: \"products inventory\"\n payload: {productsInventory: productsInventoryResults[]}\n}) => void\nexport interface productsInventoryResults {\n id: string;\n totalInventory: number;\n}\n"]}
@@ -57,7 +57,6 @@ export interface Pillar {
57
57
  export interface PersonalizationStory {
58
58
  confidence: PersonalizationConfidence;
59
59
  pillars: Pillar[];
60
- for_you?: boolean;
61
60
  }
62
61
  export declare enum FeaturedRanking {
63
62
  FEATURED_RANK_NO = 0,
@@ -1 +1 @@
1
- {"version":3,"file":"product.js","sourceRoot":"","sources":["../../src/@types/product.ts"],"names":[],"mappings":"AA2EA,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,6EAAgB,CAAA;IAChB,yFAAsB,CAAA;IACtB,qFAAoB,CAAA;IACpB,mFAAmB,CAAA;AACvB,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B","sourcesContent":["import type {Currency} from \"./currency\";\nimport {PromoTileConfig} from \"./promoTile\";\n\nexport interface ProductAnalytics {\n global_impressions?: string\n context_impressions?: string\n global_cpi?: string\n context_cpi?: string\n global_rpi?: string\n context_rpi?: string\n global_rpi_corrected?: number\n context_rpi_corrected?: number\n global_rpi_cp_lower?: number\n context_rpi_cp_lower?: number\n global_rpi_corrected_cp_lower?: number\n context_rpi_corrected_cp_lower?: number\n beta_alpha_post_local?: number\n beta_beta_post_local?: number\n aov_for_cdf_local?: number\n sales_days?: number[]\n sales_weeks?: number[]\n sales_months?: number[]\n is_hidden_winner?: boolean\n is_overexposed?: boolean\n explanation?: string\n}\n\nexport interface FilterCoefEntry {\n raw: number;\n power?: number;\n effective?: number;\n pair?: string;\n pair_index?: number;\n}\n\nexport interface ProductPersonalizationCoefficients {\n rpi?: {\n baseline: number;\n coefficient: number;\n secondary_coefficient?: number;\n final: number;\n local_cpi?: number;\n global_rpi?: number;\n global_cpi?: number;\n primary?: 'local' | 'local_cpi' | 'global_rpi' | 'global_cpi';\n };\n user_segment_coef?: number;\n sales_speed_coef?: number; // ranking multiplier (neutral = 1.0; methodology defines its time windows)\n size_availability?: number; // size-availability ranking multiplier in [0,1] (from cart-adds / spc)\n price_discrimination?: number; // price-band ranking multiplier (p/pi around 1.0, from clicked products)\n price_discrimination_band?: string; // the product's synthetic band label, e.g. \"dresses_3\"\n filter_coefs?: Record<string, FilterCoefEntry | number>;\n}\n\nexport type PillarKind =\n | 'shopper_intent'\n | 'style_affinity'\n | 'collection_standout'\n | 'audience_demand'\n | 'price_discrimination';\n\nexport type PersonalizationConfidence = 'high' | 'medium' | 'low';\n\nexport interface Pillar {\n kind: PillarKind;\n label: string;\n}\n\nexport interface PersonalizationStory {\n confidence: PersonalizationConfidence;\n pillars: Pillar[];\n // Set when the product kept a For You badge on this page.\n for_you?: boolean;\n}\n\nexport enum FeaturedRanking {\n FEATURED_RANK_NO,\n FEATURED_RANK_ON_MATCH,\n FEATURED_RANK_ALWAYS,\n FEATURED_RANK_NEVER,\n}\n\nexport interface ServerProduct {\n c: Currency\n d: string\n f: FeaturedRanking\n id: productID\n iso: boolean\n l: string\n p: string\n p_c: string\n p_max: string\n p_max_c: string\n p_min: string\n p_min_c: string\n p_spl: number\n p_spl_id?: string\n review?: number\n reviews_count?: number\n s: string\n sku: string\n skus: string[]\n t: string\n t2: string\n u: string\n v_c: number\n v: string\n vra: ServerVariant[]\n vrc: object\n att?: Attribute[]\n real_sku?: string\n image_id?: string\n alt?: AlternativeColor[]\n inventory_lvl?: number\n promotile?: boolean\n imageID?: string\n rec_src?: number\n analytics?: ProductAnalytics\n personalization_coefs?: ProductPersonalizationCoefficients\n personalization_story?: PersonalizationStory\n}\n\nexport type ServerVariant = [number, VariantData[]]\nexport type VariantData = [string, string[]]\n\nexport type Attribute = [string, AttributeData[]]\nexport type AttributeData = string[] | string[][]\n\nexport interface ServerAltProductVariant {\n sellable: boolean;\n size: string;\n v_id: number;\n}\n\nexport interface ServerAltProductData {\n l: string;\n p: string;\n p_c: string;\n p_spl: number;\n p_spl_id?: number;\n sku?: string;\n t: string[];\n vra: ServerAltProductVariant[];\n review?: number;\n reviews_count?: number;\n att?: any[];\n s?: string;\n p_min: string;\n p_max: string;\n}\n\nexport type AlternativeColor = [AlternativeColorName, AlternativeColorURL, productID?, ServerAltProductData?]\n\ntype AlternativeColorName = string\ntype AlternativeColorURL = string\ntype productID = number\n\nexport interface Badge {\n tag: string;\n url: string;\n}\n\nexport interface TextBadge {\n badgeText: string;\n tag: string;\n badgeStyle: {\n backgroundColor: string;\n borderColor: string;\n borderRadius: number;\n horizontal: string;\n vertical: string;\n size: number;\n textColor: string;\n }\n}\n\nexport interface Products {\n [id: string]: Product\n}\n\nexport interface Product {\n currency: Currency\n id: string\n title: string\n description: string\n variants: Variants\n isSoldOut: boolean\n price: number\n minPrice: number\n maxPrice: number\n maxCompare: number\n comparePrice: number\n maxFormattedCompare: string;\n reviewScore: number | undefined\n reviewCount: number | undefined\n imageURL: string\n imageURL2: string\n optimizedURL?: string;\n formattedPrice: string\n formattedCompare: string | undefined\n vendor: string\n sku: string\n s: string\n inventory_lvl?: number\n imagesSrcset: string\n productURL: string\n productBadges: Badge[]\n productTextBadges?: TextBadge[]\n alternativeProducts?: AlternativeProduct[]\n tags?: string[]\n promoTileConfig?: PromoTileConfig\n attributes?: Attribute[]\n p_spl?: number\n p_spl_id?: string\n isIspNoPrice?: boolean\n imageID?: string\n vrc?: object\n analytics?: ProductAnalytics\n personalization_coefs?: ProductPersonalizationCoefficients\n personalization_story?: PersonalizationStory\n}\n\nexport interface Variant {\n id: number,\n attributes: {\n [key: string]: VariantsAttribute\n }\n}\n\nexport type Variants = Variant[]\n\nexport type VariantsAttribute = string | number | boolean | string[] | undefined\n\nexport interface AlternativeProduct {\n color: string,\n url: string,\n id: string,\n variants?: Variants,\n s?: string,\n price: number\n comparePrice: number,\n formattedCompare?: string,\n formattedPrice?: string,\n attributes?: Attribute[] | undefined\n}\n\nexport interface ServerPromotile {\n height: number;\n id: string;\n image: string;\n link: string;\n width: number;\n title: string;\n}\n"]}
1
+ {"version":3,"file":"product.js","sourceRoot":"","sources":["../../src/@types/product.ts"],"names":[],"mappings":"AAyEA,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,6EAAgB,CAAA;IAChB,yFAAsB,CAAA;IACtB,qFAAoB,CAAA;IACpB,mFAAmB,CAAA;AACvB,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B","sourcesContent":["import type {Currency} from \"./currency\";\nimport {PromoTileConfig} from \"./promoTile\";\n\nexport interface ProductAnalytics {\n global_impressions?: string\n context_impressions?: string\n global_cpi?: string\n context_cpi?: string\n global_rpi?: string\n context_rpi?: string\n global_rpi_corrected?: number\n context_rpi_corrected?: number\n global_rpi_cp_lower?: number\n context_rpi_cp_lower?: number\n global_rpi_corrected_cp_lower?: number\n context_rpi_corrected_cp_lower?: number\n beta_alpha_post_local?: number\n beta_beta_post_local?: number\n aov_for_cdf_local?: number\n sales_days?: number[]\n sales_weeks?: number[]\n sales_months?: number[]\n is_hidden_winner?: boolean\n is_overexposed?: boolean\n explanation?: string\n}\n\nexport interface FilterCoefEntry {\n raw: number;\n power?: number;\n effective?: number;\n pair?: string;\n pair_index?: number;\n}\n\nexport interface ProductPersonalizationCoefficients {\n rpi?: {\n baseline: number;\n coefficient: number;\n secondary_coefficient?: number;\n final: number;\n local_cpi?: number;\n global_rpi?: number;\n global_cpi?: number;\n primary?: 'local' | 'local_cpi' | 'global_rpi' | 'global_cpi';\n };\n user_segment_coef?: number;\n sales_speed_coef?: number; // ranking multiplier (neutral = 1.0; methodology defines its time windows)\n size_availability?: number; // size-availability ranking multiplier in [0,1] (from cart-adds / spc)\n price_discrimination?: number; // price-band ranking multiplier (p/pi around 1.0, from clicked products)\n price_discrimination_band?: string; // the product's synthetic band label, e.g. \"dresses_3\"\n filter_coefs?: Record<string, FilterCoefEntry | number>;\n}\n\nexport type PillarKind =\n | 'shopper_intent'\n | 'style_affinity'\n | 'collection_standout'\n | 'audience_demand'\n | 'price_discrimination';\n\nexport type PersonalizationConfidence = 'high' | 'medium' | 'low';\n\nexport interface Pillar {\n kind: PillarKind;\n label: string;\n}\n\nexport interface PersonalizationStory {\n confidence: PersonalizationConfidence;\n pillars: Pillar[];\n}\n\nexport enum FeaturedRanking {\n FEATURED_RANK_NO,\n FEATURED_RANK_ON_MATCH,\n FEATURED_RANK_ALWAYS,\n FEATURED_RANK_NEVER,\n}\n\nexport interface ServerProduct {\n c: Currency\n d: string\n f: FeaturedRanking\n id: productID\n iso: boolean\n l: string\n p: string\n p_c: string\n p_max: string\n p_max_c: string\n p_min: string\n p_min_c: string\n p_spl: number\n p_spl_id?: string\n review?: number\n reviews_count?: number\n s: string\n sku: string\n skus: string[]\n t: string\n t2: string\n u: string\n v_c: number\n v: string\n vra: ServerVariant[]\n vrc: object\n att?: Attribute[]\n real_sku?: string\n image_id?: string\n alt?: AlternativeColor[]\n inventory_lvl?: number\n promotile?: boolean\n imageID?: string\n rec_src?: number\n analytics?: ProductAnalytics\n personalization_coefs?: ProductPersonalizationCoefficients\n personalization_story?: PersonalizationStory\n}\n\nexport type ServerVariant = [number, VariantData[]]\nexport type VariantData = [string, string[]]\n\nexport type Attribute = [string, AttributeData[]]\nexport type AttributeData = string[] | string[][]\n\nexport interface ServerAltProductVariant {\n sellable: boolean;\n size: string;\n v_id: number;\n}\n\nexport interface ServerAltProductData {\n l: string;\n p: string;\n p_c: string;\n p_spl: number;\n p_spl_id?: number;\n sku?: string;\n t: string[];\n vra: ServerAltProductVariant[];\n review?: number;\n reviews_count?: number;\n att?: any[];\n s?: string;\n p_min: string;\n p_max: string;\n}\n\nexport type AlternativeColor = [AlternativeColorName, AlternativeColorURL, productID?, ServerAltProductData?]\n\ntype AlternativeColorName = string\ntype AlternativeColorURL = string\ntype productID = number\n\nexport interface Badge {\n tag: string;\n url: string;\n}\n\nexport interface TextBadge {\n badgeText: string;\n tag: string;\n badgeStyle: {\n backgroundColor: string;\n borderColor: string;\n borderRadius: number;\n horizontal: string;\n vertical: string;\n size: number;\n textColor: string;\n }\n}\n\nexport interface Products {\n [id: string]: Product\n}\n\nexport interface Product {\n currency: Currency\n id: string\n title: string\n description: string\n variants: Variants\n isSoldOut: boolean\n price: number\n minPrice: number\n maxPrice: number\n maxCompare: number\n comparePrice: number\n maxFormattedCompare: string;\n reviewScore: number | undefined\n reviewCount: number | undefined\n imageURL: string\n imageURL2: string\n optimizedURL?: string;\n formattedPrice: string\n formattedCompare: string | undefined\n vendor: string\n sku: string\n s: string\n inventory_lvl?: number\n imagesSrcset: string\n productURL: string\n productBadges: Badge[]\n productTextBadges?: TextBadge[]\n alternativeProducts?: AlternativeProduct[]\n tags?: string[]\n promoTileConfig?: PromoTileConfig\n attributes?: Attribute[]\n p_spl?: number\n p_spl_id?: string\n isIspNoPrice?: boolean\n imageID?: string\n vrc?: object\n analytics?: ProductAnalytics\n personalization_coefs?: ProductPersonalizationCoefficients\n personalization_story?: PersonalizationStory\n}\n\nexport interface Variant {\n id: number,\n attributes: {\n [key: string]: VariantsAttribute\n }\n}\n\nexport type Variants = Variant[]\n\nexport type VariantsAttribute = string | number | boolean | string[] | undefined\n\nexport interface AlternativeProduct {\n color: string,\n url: string,\n id: string,\n variants?: Variants,\n s?: string,\n price: number\n comparePrice: number,\n formattedCompare?: string,\n formattedPrice?: string,\n attributes?: Attribute[] | undefined\n}\n\nexport interface ServerPromotile {\n height: number;\n id: string;\n image: string;\n link: string;\n width: number;\n title: string;\n}\n"]}
@@ -33,6 +33,8 @@ interface Props {
33
33
  allowSearchPreview?: boolean;
34
34
  variationId?: string | null;
35
35
  customSortSettingsTransform?: (settings: CustomSortSettings | undefined, isCollection: boolean) => CustomSortSettings | null | undefined;
36
+ merchantToken?: string;
37
+ onMerchantTokenRejected?: () => Promise<string>;
36
38
  }
37
39
  export interface MainTheme {
38
40
  primaryColor: string;
@@ -34,6 +34,7 @@ export { analyticsMatchesRankingSnapshot } from "../../utils/rpiSnapshot";
34
34
  import { FullTextSearch } from "../../services/search";
35
35
  import { SmartCollections } from "../../services/smartCollections";
36
36
  import { Autocomplete } from "../../services/autocomplete";
37
+ import { setMerchantToken, setOnMerchantTokenRejected } from "../../services/API";
37
38
  const mainTheme = {
38
39
  primaryColor: "#1976d2",
39
40
  lighterPrimary: "rgba(25,118,210,0.71)",
@@ -76,7 +77,15 @@ export function attachPersonalizationToItems(response) {
76
77
  }
77
78
  const FastSimonApi = (_a) => {
78
79
  var _b;
79
- var { storeID, uuid, siteKey, children, defaultSort, promoTiles = false, theme, withProductAttributes = false, isInfiniteScroll = false, getTitle, useFilters, noReport = false, customTitleChange, isEnterpriseMerchandising = false, subscription = 0, marketContext = null, forceProductAnalytics = false, allowSearchPreview = true, variationId = null, customSortSettingsTransform } = _a, props = __rest(_a, ["storeID", "uuid", "siteKey", "children", "defaultSort", "promoTiles", "theme", "withProductAttributes", "isInfiniteScroll", "getTitle", "useFilters", "noReport", "customTitleChange", "isEnterpriseMerchandising", "subscription", "marketContext", "forceProductAnalytics", "allowSearchPreview", "variationId", "customSortSettingsTransform"]);
80
+ var { storeID, uuid, siteKey, children, defaultSort, promoTiles = false, theme, withProductAttributes = false, isInfiniteScroll = false, getTitle, useFilters, noReport = false, customTitleChange, isEnterpriseMerchandising = false, subscription = 0, marketContext = null, forceProductAnalytics = false, allowSearchPreview = true, variationId = null, customSortSettingsTransform, merchantToken, onMerchantTokenRejected } = _a, props = __rest(_a, ["storeID", "uuid", "siteKey", "children", "defaultSort", "promoTiles", "theme", "withProductAttributes", "isInfiniteScroll", "getTitle", "useFilters", "noReport", "customTitleChange", "isEnterpriseMerchandising", "subscription", "marketContext", "forceProductAnalytics", "allowSearchPreview", "variationId", "customSortSettingsTransform", "merchantToken", "onMerchantTokenRejected"]);
81
+ // During render, not in an effect: effects run child-first, so a child's first request would leave before a
82
+ // parent's effect set the token. Only when passed: a host that passes none may have set them on the module.
83
+ if (merchantToken !== undefined) {
84
+ setMerchantToken(merchantToken);
85
+ }
86
+ if (onMerchantTokenRejected) {
87
+ setOnMerchantTokenRejected(onMerchantTokenRejected);
88
+ }
80
89
  const [state, dispatch] = useReducer === null || useReducer === void 0 ? void 0 : useReducer(fastStateReducer, {
81
90
  isReady: false,
82
91
  type: (_b = props.type) !== null && _b !== void 0 ? _b : 'SPA',
@@ -102,6 +111,7 @@ const FastSimonApi = (_a) => {
102
111
  user_segment_preview: 'none',
103
112
  personalization_preview: null,
104
113
  session_token: undefined,
114
+ include_unpublished: false,
105
115
  // Compare Mode state
106
116
  comparisonData: null,
107
117
  isComparing: false
@@ -120,6 +130,11 @@ const FastSimonApi = (_a) => {
120
130
  const v = customSortSettingsRef.current;
121
131
  return v === null ? undefined : v;
122
132
  };
133
+ // Ref for include_unpublished: a memoized caller (the mount-time event handlers among them) reaches
134
+ // onCollection through a stale closure whose `state` predates a toggle, so the requests read the ref,
135
+ // never `state`, and the chip and the requests cannot disagree.
136
+ const includeUnpublishedRef = useRef(!!state.include_unpublished);
137
+ includeUnpublishedRef.current = !!state.include_unpublished;
123
138
  // Ref for personalization_preview: enables synchronous reads across closures
124
139
  const personalizationPreviewRef = useRef(state.personalization_preview);
125
140
  personalizationPreviewRef.current = state.personalization_preview;
@@ -174,6 +189,9 @@ const FastSimonApi = (_a) => {
174
189
  if ('custom_sort_settings' in settings) {
175
190
  customSortSettingsRef.current = (_a = settings.custom_sort_settings) !== null && _a !== void 0 ? _a : undefined;
176
191
  }
192
+ if ('include_unpublished' in settings) {
193
+ includeUnpublishedRef.current = !!settings.include_unpublished;
194
+ }
177
195
  dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: 'updateSettingsAndRefetch', payload: settings });
178
196
  }
179
197
  function setUserSegmentPreview(preview) {
@@ -670,7 +688,10 @@ const FastSimonApi = (_a) => {
670
688
  const requestId = ++searchRequestCounterRef.current;
671
689
  pendingAnalyticsRef.current = null;
672
690
  let fastRankingResponse = null;
673
- const commonRequestParams = Object.assign(Object.assign({}, props), { withAttributes: promoTiles || withProductAttributes, market_context: marketContext, variation_id: state.variation_id, ps: personalizationSegment, spv: personalizationParams.spv, spc: personalizationParams.spc, personalization: personalizationParams.personalization, force_and: state.force_and, session_token: state.session_token });
691
+ const commonRequestParams = Object.assign(Object.assign({}, props), { withAttributes: promoTiles || withProductAttributes, market_context: marketContext, variation_id: state.variation_id, ps: personalizationSegment, spv: personalizationParams.spv, spc: personalizationParams.spc, personalization: personalizationParams.personalization, force_and: state.force_and, session_token: state.session_token,
692
+ // Only the page and analytics requests carry it; the ids-only and facets-only requests below are
693
+ // built from `props`, which never holds it, so id_list stays the live list.
694
+ include_unpublished: includeUnpublishedRef.current });
674
695
  // Fire analytics request in parallel (fire-and-forget) — only if analytics needed
675
696
  if (shouldFetchAnalytics) {
676
697
  SmartCollections.getSmartCollections(Object.assign(Object.assign({}, commonRequestParams), { with_product_analytics: true, facetRequired: 0 })).then(analyticsResponse => {
@@ -740,7 +761,9 @@ const FastSimonApi = (_a) => {
740
761
  listIdRequestProps.spc = personalizationParams.spc;
741
762
  listIdRequestProps.personalization = personalizationParams.personalization;
742
763
  listIdRequestProps.session_token = state.session_token;
764
+ listIdRequestProps.include_unpublished = false;
743
765
  const facetsRequestProps = Object.assign({}, props);
766
+ facetsRequestProps.include_unpublished = false;
744
767
  facetsRequestProps.facetRequired = 2;
745
768
  facetsRequestProps.searchWithinSearch = props.searchWithinSearch;
746
769
  facetsRequestProps.productsPerPage = props.productsPerPage;
@@ -865,8 +888,9 @@ const FastSimonApi = (_a) => {
865
888
  force_and: state.force_and,
866
889
  flag: state.flag,
867
890
  comparisonData: state.comparisonData,
868
- isComparing: state.isComparing
869
- }), [narrow, results, page, query, sortBy, type, collectionID, isLoading, recommendations, singleProducts, isReady, autocomplete, isAutocomplete, state.variation_id, state.force_and, state.flag, state.comparisonData, state.isComparing]);
891
+ isComparing: state.isComparing,
892
+ include_unpublished: state.include_unpublished
893
+ }), [narrow, results, page, query, sortBy, type, collectionID, isLoading, recommendations, singleProducts, isReady, autocomplete, isAutocomplete, state.variation_id, state.force_and, state.flag, state.comparisonData, state.isComparing, state.include_unpublished]);
870
894
  // Memoize theme to prevent unnecessary object creation
871
895
  const mergedTheme = useMemo(() => (Object.assign(Object.assign({}, mainTheme), theme)), [theme]);
872
896
  // @ts-ignore