@fast-simon/dashboard-utilities 1.0.181-beta.6 → 1.0.181-beta.8
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.
|
@@ -18,7 +18,7 @@ interface LandingPageResponse {
|
|
|
18
18
|
avoid_tag_prefixes?: string;
|
|
19
19
|
}
|
|
20
20
|
export declare const LandingPage: {
|
|
21
|
-
landingPage: ({ uuid, storeID, landingPage, page, sortBy, facets, narrow, productsPerPage, withProductAttributes, searchWithinResultsQuery, type, visualMerchandising, merchandisingRules, idsOnly,
|
|
21
|
+
landingPage: ({ uuid, storeID, landingPage, page, sortBy, facets, narrow, productsPerPage, withProductAttributes, searchWithinResultsQuery, type, visualMerchandising, merchandisingRules, idsOnly, }: any) => Promise<{
|
|
22
22
|
data: LandingPageResponse;
|
|
23
23
|
getFacets: () => Promise<import("@fast-simon/utilities").Facet[]>;
|
|
24
24
|
}>;
|
|
@@ -12,7 +12,7 @@ import { fastSimonPost } from "./API";
|
|
|
12
12
|
import { FacetsParser } from "@fast-simon/utilities";
|
|
13
13
|
const BASE_URL = (_a = import.meta.env.VITE_SERVING_BASE_URL) !== null && _a !== void 0 ? _a : "https://internal-v3joil6oqa-uc.a.run.app/search";
|
|
14
14
|
export const LandingPage = {
|
|
15
|
-
landingPage: ({ uuid, storeID, landingPage, page = 1, sortBy = "relevency", facets = true, narrow, productsPerPage, withProductAttributes = undefined, searchWithinResultsQuery, type, visualMerchandising, merchandisingRules, idsOnly,
|
|
15
|
+
landingPage: ({ uuid, storeID, landingPage, page = 1, sortBy = "relevency", facets = true, narrow, productsPerPage, withProductAttributes = undefined, searchWithinResultsQuery, type, visualMerchandising, merchandisingRules, idsOnly, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
const params = {
|
|
17
17
|
UUID: uuid,
|
|
18
18
|
store_id: storeID,
|
|
@@ -31,9 +31,9 @@ export const LandingPage = {
|
|
|
31
31
|
merchandising_rules: type == 1 && merchandisingRules && Object.keys(merchandisingRules).length > 0
|
|
32
32
|
? JSON.stringify(merchandisingRules)
|
|
33
33
|
: undefined,
|
|
34
|
+
// No last_product: serving ignores visual merchandising on landing_page_editor, so its order never moves,
|
|
35
|
+
// while the client re-sorts pins locally; resuming after the client's last card would re-send cards already shown.
|
|
34
36
|
ids_only: idsOnly ? 1 : undefined,
|
|
35
|
-
// Page N resumes after the last card shown, so a "Set position" move skips none (#16215).
|
|
36
|
-
last_product: lastProduct || undefined,
|
|
37
37
|
};
|
|
38
38
|
const res = yield fastSimonPost(BASE_URL, "landing_page_editor", params);
|
|
39
39
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"landingPage.js","sourceRoot":"","sources":["../../src/services/landingPage.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,EAAe,aAAa,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,EAAC,YAAY,EAAc,MAAM,uBAAuB,CAAA;AAoD/D,MAAM,QAAQ,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,mCAAI,iDAAiD,CAAC;AAkB5G,MAAM,CAAC,MAAM,WAAW,GAAG;IACnB,WAAW,EAAE,CAAO,EACpB,IAAI,EACJ,OAAO,EACP,WAAW,EACX,IAAI,GAAG,CAAC,EACR,MAAM,GAAG,WAAW,EACpB,MAAM,GAAG,IAAI,EACb,MAAM,EACN,eAAe,EACf,qBAAqB,GAAG,SAAS,EACjC,wBAAwB,EACxB,IAAI,EACJ,mBAAmB,EACnB,kBAAkB,EAClB,OAAO,
|
|
1
|
+
{"version":3,"file":"landingPage.js","sourceRoot":"","sources":["../../src/services/landingPage.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,EAAe,aAAa,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,EAAC,YAAY,EAAc,MAAM,uBAAuB,CAAA;AAoD/D,MAAM,QAAQ,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAA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,CAAC,mBAAmB,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC;YACrG,mBAAmB,EAAE,kBAAkB;gBACnC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC;gBACpC,CAAC,CAAC,SAAS;YACf,CAAC,EAAE,CAAC;SACP,CACJ,CAAC;QACF,OAAO,uBAAuB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACzE,CAAC,CAAA;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAgB,EAAE,gBAAyB,EAAE,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC,WAAW,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import type {SortBy} from \"../@types/sortBy\";\nimport type {Narrow, ServerNarrow} from \"@fast-simon/utilities\";\nimport {fastSimonGet, fastSimonPost} from \"./API\";\nimport {FacetsParser, ServerFacet} from \"@fast-simon/utilities\"\nimport {AncestorCategory} from \"../@types/categories\";\nimport {EditorProduct} from \"../@types/editorProduct\";\ninterface LandingPageRequest {\n uuid: string;\n storeID: string;\n landingPage: string\n type: number\n page?: number\n sortBy?: SortBy\n facets?: boolean\n narrow?: Narrow\n productsPerPage?: number\n withProductAttributes?: boolean\n searchWithinResultsQuery?: string\n idsOnly?: boolean\n}\n\ninterface LandingPageFacetsOnly extends Omit<LandingPageRequest, \"facets\"> {\n avoid_tag_prefixes?: string\n}\n\ninterface LandingPageServerResponseFacetsOnly {\n total_results: number\n term: string\n narrow?: ServerNarrow\n facets_completed: true\n facets: ServerFacet[],\n}\n\ninterface LandingPageServerResponseAll {\n items: EditorProduct[]\n alternatives?: string[]\n facets_completed: boolean\n narrow?: ServerNarrow[]\n p: number\n total_p: number\n total_results: number\n term: string\n lp_slug: string\n title: string\n index_page: number\n banner_html: string\n banner_html_mobile: string\n facets: ServerFacet[]\n sort_by: SortBy\n avoid_tag_prefixes?: string\n cms_number_found?: number\n within_search_results_for?: string,\n ancestor_categories?: AncestorCategory[]\n}\n\nconst BASE_URL = import.meta.env.VITE_SERVING_BASE_URL ?? \"https://internal-v3joil6oqa-uc.a.run.app/search\";\n\ninterface LandingPageResponse {\n items: EditorProduct[]\n facets_completed: boolean\n narrow?: Narrow[]\n p: number\n total_p: number\n isp_quick_view_mode: number\n related_results: boolean\n total_results: number\n lp_slug: string\n title: string\n facets: ServerFacet[]\n sort_by: SortBy\n avoid_tag_prefixes?: string\n}\n\nexport const LandingPage = {\n landingPage: async ({\n uuid,\n storeID,\n landingPage,\n page = 1,\n sortBy = \"relevency\",\n facets = true,\n narrow,\n productsPerPage,\n withProductAttributes = undefined,\n searchWithinResultsQuery,\n type,\n visualMerchandising,\n merchandisingRules,\n idsOnly,\n }: any) => {\n const params: Record<string, any> = {\n UUID: uuid,\n store_id: storeID,\n facets_required: facets ? 1 : 0,\n products_per_page: productsPerPage,\n narrow: JSON.stringify(narrow),\n lp: landingPage,\n page_num: page,\n type: type,\n with_product_attributes: withProductAttributes,\n search_within_search: searchWithinResultsQuery\n ? searchWithinResultsQuery\n : undefined,\n visual_merchandising: JSON.stringify(visualMerchandising).replaceAll('\"[', \"[\").replaceAll(']\"', \"]\"),\n m: 1,\n merchandising_rules:\n type == 1 && merchandisingRules && Object.keys(merchandisingRules).length > 0\n ? JSON.stringify(merchandisingRules)\n : undefined,\n // No last_product: serving ignores visual merchandising on landing_page_editor, so its order never moves,\n // while the client re-sorts pins locally; resuming after the client's last card would re-send cards already shown.\n ids_only: idsOnly ? 1 : undefined,\n };\n const res = await fastSimonPost<LandingPageResponse>(\n BASE_URL,\n \"landing_page_editor\",\n params\n );\n return {\n data: res,\n getFacets: async () =>\n res?.facets_completed\n ? transformFacetsOnlyData(\n res.facets,\n res.avoid_tag_prefixes\n )\n : await LandingPage.landingPageFacetsOnly({\n uuid,\n storeID,\n landingPage,\n page,\n narrow,\n type,\n productsPerPage,\n searchWithinResultsQuery,\n withProductAttributes,\n visualMerchandising,\n merchandisingRules,\n }),\n };\n },\n\n landingPageFacetsOnly: async ({\n uuid,\n storeID,\n landingPage,\n page = 1,\n narrow,\n type,\n productsPerPage,\n searchWithinResultsQuery,\n withProductAttributes = false,\n visualMerchandising,\n merchandisingRules\n }: any) => {\n const data = await fastSimonPost<LandingPageServerResponseAll>(\n BASE_URL,\n \"landing_page_editor\",\n {\n UUID: uuid,\n store_id: storeID,\n facets_required: 2,\n products_per_page: productsPerPage,\n narrow: JSON.stringify(narrow),\n type: type,\n lp: landingPage,\n page_num: page ?? 1,\n with_product_attributes: withProductAttributes,\n search_within_search: searchWithinResultsQuery\n ? searchWithinResultsQuery\n : undefined,\n visual_merchandising: JSON.stringify(visualMerchandising).replaceAll('\"[', \"[\").replaceAll(']\"', \"]\"),\n merchandising_rules: merchandisingRules\n ? JSON.stringify(merchandisingRules)\n : undefined,\n m: 1,\n }\n );\n return transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes);\n },\n};\n\nexport const transformFacetsOnlyData = (r: ServerFacet[], avoidTagPrefixes?: string) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(\",\") : []);"]}
|