@getlupa/vue 0.0.11 → 0.0.13
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/lupaSearch.js
CHANGED
|
@@ -2583,9 +2583,14 @@ const redirectToResultsPage = (link, searchText, facet, routingBehavior = "direc
|
|
|
2583
2583
|
window.location.assign(url);
|
|
2584
2584
|
}
|
|
2585
2585
|
};
|
|
2586
|
-
const getPageUrl = (pathnameOverride) => {
|
|
2587
|
-
|
|
2588
|
-
|
|
2586
|
+
const getPageUrl = (pathnameOverride, ssr) => {
|
|
2587
|
+
if (typeof window !== "undefined") {
|
|
2588
|
+
const pathname = pathnameOverride || window.location.pathname;
|
|
2589
|
+
const origin = window.location.origin;
|
|
2590
|
+
const search2 = window.location.search;
|
|
2591
|
+
return new URL(origin + pathname + search2);
|
|
2592
|
+
}
|
|
2593
|
+
return new URL(ssr.url, ssr.baseUrl);
|
|
2589
2594
|
};
|
|
2590
2595
|
const getFacetKey = (key, type) => {
|
|
2591
2596
|
return `${FACET_FILTER_MAP[type]}${key}`;
|
|
@@ -2671,11 +2676,11 @@ const useParamsStore = defineStore("params", () => {
|
|
|
2671
2676
|
var _a;
|
|
2672
2677
|
return (_a = params.value.filters) != null ? _a : {};
|
|
2673
2678
|
});
|
|
2674
|
-
const add = (newParams) => {
|
|
2679
|
+
const add = (newParams, ssr) => {
|
|
2675
2680
|
if (!newParams) {
|
|
2676
2681
|
return { params: params.value };
|
|
2677
2682
|
}
|
|
2678
|
-
const url = getPageUrl();
|
|
2683
|
+
const url = getPageUrl(void 0, ssr);
|
|
2679
2684
|
params.value = newParams;
|
|
2680
2685
|
searchString.value = url.search;
|
|
2681
2686
|
};
|
|
@@ -7588,10 +7593,12 @@ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
|
7588
7593
|
},
|
|
7589
7594
|
setup(__props) {
|
|
7590
7595
|
const props = __props;
|
|
7591
|
-
const optionsValue = vue.computed(
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7596
|
+
const optionsValue = vue.computed(
|
|
7597
|
+
() => {
|
|
7598
|
+
var _a;
|
|
7599
|
+
return (_a = props.options) != null ? _a : { labels: {} };
|
|
7600
|
+
}
|
|
7601
|
+
);
|
|
7595
7602
|
const paramStore = useParamsStore();
|
|
7596
7603
|
const searchResultStore = useSearchResultStore();
|
|
7597
7604
|
const optionsStore = useOptionsStore();
|
|
@@ -8438,7 +8445,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
|
8438
8445
|
const { layout } = storeToRefs(searchResultStore);
|
|
8439
8446
|
const { searchResultsRoutingBehavior, searchResultOptions, trackingOptions } = storeToRefs(optionsStore);
|
|
8440
8447
|
const { query } = storeToRefs(paramsStore);
|
|
8441
|
-
const isInStock = vue.ref(
|
|
8448
|
+
const isInStock = vue.ref(true);
|
|
8442
8449
|
const listLayoutClass = vue.computed(() => {
|
|
8443
8450
|
return layout.value === ResultsLayoutEnum.LIST && !props.isAdditionalPanel ? "lupa-search-result-product-contents-list" : "";
|
|
8444
8451
|
});
|
|
@@ -8480,6 +8487,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
|
8480
8487
|
const title = vue.computed(() => {
|
|
8481
8488
|
return props.options.titleKey ? props.product[props.options.titleKey] : "";
|
|
8482
8489
|
});
|
|
8490
|
+
const ssr = vue.computed(() => Boolean(optionsStore.searchResultOptions.ssr));
|
|
8483
8491
|
const clickTrackingType = vue.computed(() => {
|
|
8484
8492
|
if (clickTrackingSettings.value.eventType) {
|
|
8485
8493
|
return clickTrackingSettings.value.eventType;
|
|
@@ -8550,6 +8558,9 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
|
8550
8558
|
const handleNavigation = (event) => {
|
|
8551
8559
|
handleRoutingEvent(link.value, event, hasEventRouting.value);
|
|
8552
8560
|
};
|
|
8561
|
+
if (ssr.value) {
|
|
8562
|
+
checkIfIsInStock();
|
|
8563
|
+
}
|
|
8553
8564
|
return (_ctx, _cache) => {
|
|
8554
8565
|
var _a;
|
|
8555
8566
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -8911,12 +8922,14 @@ const _hoisted_5 = { key: 4 };
|
|
|
8911
8922
|
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
8912
8923
|
__name: "SearchResultsProducts",
|
|
8913
8924
|
props: {
|
|
8914
|
-
options: {}
|
|
8925
|
+
options: {},
|
|
8926
|
+
ssr: { type: Boolean }
|
|
8915
8927
|
},
|
|
8916
8928
|
setup(__props) {
|
|
8917
8929
|
const props = __props;
|
|
8918
8930
|
const searchResultStore = useSearchResultStore();
|
|
8919
8931
|
const paramStore = useParamsStore();
|
|
8932
|
+
useOptionsStore();
|
|
8920
8933
|
const {
|
|
8921
8934
|
hasResults,
|
|
8922
8935
|
currentQueryText,
|
|
@@ -8975,11 +8988,18 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8975
8988
|
return (_e = (_d = (_c = (_b = (_a = props.options) == null ? void 0 : _a.filters) == null ? void 0 : _b.currentFilters) == null ? void 0 : _c.desktopToolbar) == null ? void 0 : _d.activeFiltersExpanded) != null ? _e : false;
|
|
8976
8989
|
});
|
|
8977
8990
|
const columnSize = vue.computed(() => {
|
|
8991
|
+
if (props.ssr) {
|
|
8992
|
+
return "";
|
|
8993
|
+
}
|
|
8978
8994
|
if (layout.value === ResultsLayoutEnum.LIST) {
|
|
8979
8995
|
return "width: 100%";
|
|
8980
8996
|
}
|
|
8981
8997
|
return `width: ${100 / columnCount.value}%`;
|
|
8982
8998
|
});
|
|
8999
|
+
const hasSimilarQueries = vue.computed(() => {
|
|
9000
|
+
var _a;
|
|
9001
|
+
return (_a = searchResult.value.similarQueries) == null ? void 0 : _a.length;
|
|
9002
|
+
});
|
|
8983
9003
|
const getProductKeyAction = (index, product) => {
|
|
8984
9004
|
return getProductKey(`${index}`, product, props.options.idKey);
|
|
8985
9005
|
};
|
|
@@ -9064,7 +9084,7 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9064
9084
|
vue.createTextVNode(vue.toDisplayString(_ctx.options.labels.emptyResults) + " ", 1),
|
|
9065
9085
|
vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(currentQueryText)), 1)
|
|
9066
9086
|
])) : vue.createCommentVNode("", true),
|
|
9067
|
-
|
|
9087
|
+
hasSimilarQueries.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
|
|
9068
9088
|
vue.createVNode(_sfc_main$a, {
|
|
9069
9089
|
labels: similarQueriesLabels.value,
|
|
9070
9090
|
columnSize: columnSize.value,
|
|
@@ -9168,6 +9188,8 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9168
9188
|
const { searchString } = storeToRefs(paramStore);
|
|
9169
9189
|
const { defaultSearchResultPageSize } = storeToRefs(optionStore);
|
|
9170
9190
|
const searchResultsFilters = vue.ref(null);
|
|
9191
|
+
const ssrSetupDone = vue.ref(false);
|
|
9192
|
+
const ssrEnabled = vue.computed(() => Boolean(props.options.ssr));
|
|
9171
9193
|
const didYouMeanLabels = vue.computed(() => {
|
|
9172
9194
|
return pick(props.options.labels, ["noResultsSuggestion", "didYouMean"]);
|
|
9173
9195
|
});
|
|
@@ -9182,6 +9204,9 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9182
9204
|
var _a, _b;
|
|
9183
9205
|
window.addEventListener("resize", handleResize);
|
|
9184
9206
|
optionStore.setSearchResultOptions({ options: props.options });
|
|
9207
|
+
if (props.initialData) {
|
|
9208
|
+
searchResultStore.add(__spreadValues({}, props.initialData));
|
|
9209
|
+
}
|
|
9185
9210
|
handleMounted();
|
|
9186
9211
|
optionStore.setInitialFilters({ initialFilters: initialFilters.value });
|
|
9187
9212
|
(_b = (_a = props.options.callbacks) == null ? void 0 : _a.onMounted) == null ? void 0 : _b.call(_a);
|
|
@@ -9285,18 +9310,44 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9285
9310
|
};
|
|
9286
9311
|
vue.watch(searchString, () => handleParamsChange());
|
|
9287
9312
|
const handleParamsChange = () => {
|
|
9288
|
-
var _a, _b;
|
|
9313
|
+
var _a, _b, _c, _d;
|
|
9314
|
+
const searchParams = getSearchParams(
|
|
9315
|
+
(_a = props.options.ssr) == null ? void 0 : _a.url,
|
|
9316
|
+
void 0,
|
|
9317
|
+
(_b = props.options.ssr) == null ? void 0 : _b.baseUrl
|
|
9318
|
+
);
|
|
9319
|
+
if (searchParams.has(QUERY_PARAMS.QUERY) && props.initialData && !ssrSetupDone.value) {
|
|
9320
|
+
ssrSetupDone.value = true;
|
|
9321
|
+
return;
|
|
9322
|
+
}
|
|
9289
9323
|
handleUrlChange();
|
|
9290
|
-
(
|
|
9324
|
+
(_d = (_c = props.options.callbacks) == null ? void 0 : _c.onUrlQueryChange) == null ? void 0 : _d.call(_c, {
|
|
9291
9325
|
queryKey: props.options.queryKey,
|
|
9292
9326
|
urlQueryString: searchString.value
|
|
9293
9327
|
});
|
|
9294
9328
|
};
|
|
9295
9329
|
const handleCreated = () => {
|
|
9330
|
+
var _a, _b;
|
|
9296
9331
|
const initialData = props.initialData;
|
|
9297
9332
|
if (initialData) {
|
|
9298
|
-
|
|
9333
|
+
if (typeof window !== "undefined") {
|
|
9334
|
+
optionStore.setSearchResultOptions({ options: props.options });
|
|
9335
|
+
if (props.initialData) {
|
|
9336
|
+
searchResultStore.add(__spreadValues({}, props.initialData));
|
|
9337
|
+
}
|
|
9338
|
+
handleMounted();
|
|
9339
|
+
return;
|
|
9340
|
+
}
|
|
9341
|
+
const searchParams = getSearchParams(
|
|
9342
|
+
(_a = props.options.ssr) == null ? void 0 : _a.url,
|
|
9343
|
+
void 0,
|
|
9344
|
+
(_b = props.options.ssr) == null ? void 0 : _b.baseUrl
|
|
9345
|
+
);
|
|
9346
|
+
optionStore.setSearchResultOptions({ options: props.options });
|
|
9299
9347
|
searchResultStore.add(__spreadValues({}, initialData));
|
|
9348
|
+
paramStore.add(parseParams(searchParams), props.options.ssr);
|
|
9349
|
+
paramStore.setDefaultLimit(defaultSearchResultPageSize.value);
|
|
9350
|
+
handleResults({ queryKey: props.options.queryKey, results: initialData });
|
|
9300
9351
|
}
|
|
9301
9352
|
};
|
|
9302
9353
|
handleCreated();
|
|
@@ -9338,12 +9389,15 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9338
9389
|
options: _ctx.options,
|
|
9339
9390
|
"is-product-list": (_c = _ctx.isProductList) != null ? _c : false
|
|
9340
9391
|
}, null, 8, ["options", "is-product-list"]),
|
|
9341
|
-
vue.createVNode(_sfc_main$6, {
|
|
9392
|
+
vue.createVNode(_sfc_main$6, {
|
|
9393
|
+
options: _ctx.options,
|
|
9394
|
+
ssr: ssrEnabled.value
|
|
9395
|
+
}, {
|
|
9342
9396
|
append: vue.withCtx(() => [
|
|
9343
9397
|
vue.renderSlot(_ctx.$slots, "default")
|
|
9344
9398
|
]),
|
|
9345
9399
|
_: 3
|
|
9346
|
-
}, 8, ["options"])
|
|
9400
|
+
}, 8, ["options", "ssr"])
|
|
9347
9401
|
])
|
|
9348
9402
|
])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 5 }, [
|
|
9349
9403
|
vue.createVNode(_sfc_main$Q, { labels: didYouMeanLabels.value }, null, 8, ["labels"]),
|
|
@@ -9358,7 +9412,10 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9358
9412
|
ref_key: "searchResultsFilters",
|
|
9359
9413
|
ref: searchResultsFilters
|
|
9360
9414
|
}, null, 8, ["options"])) : vue.createCommentVNode("", true),
|
|
9361
|
-
vue.createVNode(_sfc_main$6, {
|
|
9415
|
+
vue.createVNode(_sfc_main$6, {
|
|
9416
|
+
options: _ctx.options,
|
|
9417
|
+
ssr: ssrEnabled.value
|
|
9418
|
+
}, vue.createSlots({
|
|
9362
9419
|
append: vue.withCtx(() => [
|
|
9363
9420
|
vue.renderSlot(_ctx.$slots, "default")
|
|
9364
9421
|
]),
|
|
@@ -9371,7 +9428,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9371
9428
|
]),
|
|
9372
9429
|
key: "0"
|
|
9373
9430
|
} : void 0
|
|
9374
|
-
]), 1032, ["options"])
|
|
9431
|
+
]), 1032, ["options", "ssr"])
|
|
9375
9432
|
])
|
|
9376
9433
|
], 64))
|
|
9377
9434
|
], 2);
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -2581,9 +2581,14 @@ const redirectToResultsPage = (link, searchText, facet, routingBehavior = "direc
|
|
|
2581
2581
|
window.location.assign(url);
|
|
2582
2582
|
}
|
|
2583
2583
|
};
|
|
2584
|
-
const getPageUrl = (pathnameOverride) => {
|
|
2585
|
-
|
|
2586
|
-
|
|
2584
|
+
const getPageUrl = (pathnameOverride, ssr) => {
|
|
2585
|
+
if (typeof window !== "undefined") {
|
|
2586
|
+
const pathname = pathnameOverride || window.location.pathname;
|
|
2587
|
+
const origin = window.location.origin;
|
|
2588
|
+
const search2 = window.location.search;
|
|
2589
|
+
return new URL(origin + pathname + search2);
|
|
2590
|
+
}
|
|
2591
|
+
return new URL(ssr.url, ssr.baseUrl);
|
|
2587
2592
|
};
|
|
2588
2593
|
const getFacetKey = (key, type) => {
|
|
2589
2594
|
return `${FACET_FILTER_MAP[type]}${key}`;
|
|
@@ -2669,11 +2674,11 @@ const useParamsStore = defineStore("params", () => {
|
|
|
2669
2674
|
var _a;
|
|
2670
2675
|
return (_a = params.value.filters) != null ? _a : {};
|
|
2671
2676
|
});
|
|
2672
|
-
const add = (newParams) => {
|
|
2677
|
+
const add = (newParams, ssr) => {
|
|
2673
2678
|
if (!newParams) {
|
|
2674
2679
|
return { params: params.value };
|
|
2675
2680
|
}
|
|
2676
|
-
const url = getPageUrl();
|
|
2681
|
+
const url = getPageUrl(void 0, ssr);
|
|
2677
2682
|
params.value = newParams;
|
|
2678
2683
|
searchString.value = url.search;
|
|
2679
2684
|
};
|
|
@@ -7586,10 +7591,12 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7586
7591
|
},
|
|
7587
7592
|
setup(__props) {
|
|
7588
7593
|
const props = __props;
|
|
7589
|
-
const optionsValue = computed(
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7594
|
+
const optionsValue = computed(
|
|
7595
|
+
() => {
|
|
7596
|
+
var _a;
|
|
7597
|
+
return (_a = props.options) != null ? _a : { labels: {} };
|
|
7598
|
+
}
|
|
7599
|
+
);
|
|
7593
7600
|
const paramStore = useParamsStore();
|
|
7594
7601
|
const searchResultStore = useSearchResultStore();
|
|
7595
7602
|
const optionsStore = useOptionsStore();
|
|
@@ -8436,7 +8443,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
8436
8443
|
const { layout } = storeToRefs(searchResultStore);
|
|
8437
8444
|
const { searchResultsRoutingBehavior, searchResultOptions, trackingOptions } = storeToRefs(optionsStore);
|
|
8438
8445
|
const { query } = storeToRefs(paramsStore);
|
|
8439
|
-
const isInStock = ref(
|
|
8446
|
+
const isInStock = ref(true);
|
|
8440
8447
|
const listLayoutClass = computed(() => {
|
|
8441
8448
|
return layout.value === ResultsLayoutEnum.LIST && !props.isAdditionalPanel ? "lupa-search-result-product-contents-list" : "";
|
|
8442
8449
|
});
|
|
@@ -8478,6 +8485,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
8478
8485
|
const title = computed(() => {
|
|
8479
8486
|
return props.options.titleKey ? props.product[props.options.titleKey] : "";
|
|
8480
8487
|
});
|
|
8488
|
+
const ssr = computed(() => Boolean(optionsStore.searchResultOptions.ssr));
|
|
8481
8489
|
const clickTrackingType = computed(() => {
|
|
8482
8490
|
if (clickTrackingSettings.value.eventType) {
|
|
8483
8491
|
return clickTrackingSettings.value.eventType;
|
|
@@ -8548,6 +8556,9 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
8548
8556
|
const handleNavigation = (event) => {
|
|
8549
8557
|
handleRoutingEvent(link.value, event, hasEventRouting.value);
|
|
8550
8558
|
};
|
|
8559
|
+
if (ssr.value) {
|
|
8560
|
+
checkIfIsInStock();
|
|
8561
|
+
}
|
|
8551
8562
|
return (_ctx, _cache) => {
|
|
8552
8563
|
var _a;
|
|
8553
8564
|
return openBlock(), createElementBlock("div", {
|
|
@@ -8909,12 +8920,14 @@ const _hoisted_5 = { key: 4 };
|
|
|
8909
8920
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
8910
8921
|
__name: "SearchResultsProducts",
|
|
8911
8922
|
props: {
|
|
8912
|
-
options: {}
|
|
8923
|
+
options: {},
|
|
8924
|
+
ssr: { type: Boolean }
|
|
8913
8925
|
},
|
|
8914
8926
|
setup(__props) {
|
|
8915
8927
|
const props = __props;
|
|
8916
8928
|
const searchResultStore = useSearchResultStore();
|
|
8917
8929
|
const paramStore = useParamsStore();
|
|
8930
|
+
useOptionsStore();
|
|
8918
8931
|
const {
|
|
8919
8932
|
hasResults,
|
|
8920
8933
|
currentQueryText,
|
|
@@ -8973,11 +8986,18 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
8973
8986
|
return (_e = (_d = (_c = (_b = (_a = props.options) == null ? void 0 : _a.filters) == null ? void 0 : _b.currentFilters) == null ? void 0 : _c.desktopToolbar) == null ? void 0 : _d.activeFiltersExpanded) != null ? _e : false;
|
|
8974
8987
|
});
|
|
8975
8988
|
const columnSize = computed(() => {
|
|
8989
|
+
if (props.ssr) {
|
|
8990
|
+
return "";
|
|
8991
|
+
}
|
|
8976
8992
|
if (layout.value === ResultsLayoutEnum.LIST) {
|
|
8977
8993
|
return "width: 100%";
|
|
8978
8994
|
}
|
|
8979
8995
|
return `width: ${100 / columnCount.value}%`;
|
|
8980
8996
|
});
|
|
8997
|
+
const hasSimilarQueries = computed(() => {
|
|
8998
|
+
var _a;
|
|
8999
|
+
return (_a = searchResult.value.similarQueries) == null ? void 0 : _a.length;
|
|
9000
|
+
});
|
|
8981
9001
|
const getProductKeyAction = (index, product) => {
|
|
8982
9002
|
return getProductKey(`${index}`, product, props.options.idKey);
|
|
8983
9003
|
};
|
|
@@ -9062,7 +9082,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
9062
9082
|
createTextVNode(toDisplayString(_ctx.options.labels.emptyResults) + " ", 1),
|
|
9063
9083
|
createElementVNode("span", null, toDisplayString(unref(currentQueryText)), 1)
|
|
9064
9084
|
])) : createCommentVNode("", true),
|
|
9065
|
-
|
|
9085
|
+
hasSimilarQueries.value ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
9066
9086
|
createVNode(_sfc_main$a, {
|
|
9067
9087
|
labels: similarQueriesLabels.value,
|
|
9068
9088
|
columnSize: columnSize.value,
|
|
@@ -9166,6 +9186,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9166
9186
|
const { searchString } = storeToRefs(paramStore);
|
|
9167
9187
|
const { defaultSearchResultPageSize } = storeToRefs(optionStore);
|
|
9168
9188
|
const searchResultsFilters = ref(null);
|
|
9189
|
+
const ssrSetupDone = ref(false);
|
|
9190
|
+
const ssrEnabled = computed(() => Boolean(props.options.ssr));
|
|
9169
9191
|
const didYouMeanLabels = computed(() => {
|
|
9170
9192
|
return pick(props.options.labels, ["noResultsSuggestion", "didYouMean"]);
|
|
9171
9193
|
});
|
|
@@ -9180,6 +9202,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9180
9202
|
var _a, _b;
|
|
9181
9203
|
window.addEventListener("resize", handleResize);
|
|
9182
9204
|
optionStore.setSearchResultOptions({ options: props.options });
|
|
9205
|
+
if (props.initialData) {
|
|
9206
|
+
searchResultStore.add(__spreadValues({}, props.initialData));
|
|
9207
|
+
}
|
|
9183
9208
|
handleMounted();
|
|
9184
9209
|
optionStore.setInitialFilters({ initialFilters: initialFilters.value });
|
|
9185
9210
|
(_b = (_a = props.options.callbacks) == null ? void 0 : _a.onMounted) == null ? void 0 : _b.call(_a);
|
|
@@ -9283,18 +9308,44 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9283
9308
|
};
|
|
9284
9309
|
watch(searchString, () => handleParamsChange());
|
|
9285
9310
|
const handleParamsChange = () => {
|
|
9286
|
-
var _a, _b;
|
|
9311
|
+
var _a, _b, _c, _d;
|
|
9312
|
+
const searchParams = getSearchParams(
|
|
9313
|
+
(_a = props.options.ssr) == null ? void 0 : _a.url,
|
|
9314
|
+
void 0,
|
|
9315
|
+
(_b = props.options.ssr) == null ? void 0 : _b.baseUrl
|
|
9316
|
+
);
|
|
9317
|
+
if (searchParams.has(QUERY_PARAMS.QUERY) && props.initialData && !ssrSetupDone.value) {
|
|
9318
|
+
ssrSetupDone.value = true;
|
|
9319
|
+
return;
|
|
9320
|
+
}
|
|
9287
9321
|
handleUrlChange();
|
|
9288
|
-
(
|
|
9322
|
+
(_d = (_c = props.options.callbacks) == null ? void 0 : _c.onUrlQueryChange) == null ? void 0 : _d.call(_c, {
|
|
9289
9323
|
queryKey: props.options.queryKey,
|
|
9290
9324
|
urlQueryString: searchString.value
|
|
9291
9325
|
});
|
|
9292
9326
|
};
|
|
9293
9327
|
const handleCreated = () => {
|
|
9328
|
+
var _a, _b;
|
|
9294
9329
|
const initialData = props.initialData;
|
|
9295
9330
|
if (initialData) {
|
|
9296
|
-
|
|
9331
|
+
if (typeof window !== "undefined") {
|
|
9332
|
+
optionStore.setSearchResultOptions({ options: props.options });
|
|
9333
|
+
if (props.initialData) {
|
|
9334
|
+
searchResultStore.add(__spreadValues({}, props.initialData));
|
|
9335
|
+
}
|
|
9336
|
+
handleMounted();
|
|
9337
|
+
return;
|
|
9338
|
+
}
|
|
9339
|
+
const searchParams = getSearchParams(
|
|
9340
|
+
(_a = props.options.ssr) == null ? void 0 : _a.url,
|
|
9341
|
+
void 0,
|
|
9342
|
+
(_b = props.options.ssr) == null ? void 0 : _b.baseUrl
|
|
9343
|
+
);
|
|
9344
|
+
optionStore.setSearchResultOptions({ options: props.options });
|
|
9297
9345
|
searchResultStore.add(__spreadValues({}, initialData));
|
|
9346
|
+
paramStore.add(parseParams(searchParams), props.options.ssr);
|
|
9347
|
+
paramStore.setDefaultLimit(defaultSearchResultPageSize.value);
|
|
9348
|
+
handleResults({ queryKey: props.options.queryKey, results: initialData });
|
|
9298
9349
|
}
|
|
9299
9350
|
};
|
|
9300
9351
|
handleCreated();
|
|
@@ -9336,12 +9387,15 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9336
9387
|
options: _ctx.options,
|
|
9337
9388
|
"is-product-list": (_c = _ctx.isProductList) != null ? _c : false
|
|
9338
9389
|
}, null, 8, ["options", "is-product-list"]),
|
|
9339
|
-
createVNode(_sfc_main$6, {
|
|
9390
|
+
createVNode(_sfc_main$6, {
|
|
9391
|
+
options: _ctx.options,
|
|
9392
|
+
ssr: ssrEnabled.value
|
|
9393
|
+
}, {
|
|
9340
9394
|
append: withCtx(() => [
|
|
9341
9395
|
renderSlot(_ctx.$slots, "default")
|
|
9342
9396
|
]),
|
|
9343
9397
|
_: 3
|
|
9344
|
-
}, 8, ["options"])
|
|
9398
|
+
}, 8, ["options", "ssr"])
|
|
9345
9399
|
])
|
|
9346
9400
|
])) : (openBlock(), createElementBlock(Fragment, { key: 5 }, [
|
|
9347
9401
|
createVNode(_sfc_main$Q, { labels: didYouMeanLabels.value }, null, 8, ["labels"]),
|
|
@@ -9356,7 +9410,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9356
9410
|
ref_key: "searchResultsFilters",
|
|
9357
9411
|
ref: searchResultsFilters
|
|
9358
9412
|
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
9359
|
-
createVNode(_sfc_main$6, {
|
|
9413
|
+
createVNode(_sfc_main$6, {
|
|
9414
|
+
options: _ctx.options,
|
|
9415
|
+
ssr: ssrEnabled.value
|
|
9416
|
+
}, createSlots({
|
|
9360
9417
|
append: withCtx(() => [
|
|
9361
9418
|
renderSlot(_ctx.$slots, "default")
|
|
9362
9419
|
]),
|
|
@@ -9369,7 +9426,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9369
9426
|
]),
|
|
9370
9427
|
key: "0"
|
|
9371
9428
|
} : void 0
|
|
9372
|
-
]), 1032, ["options"])
|
|
9429
|
+
]), 1032, ["options", "ssr"])
|
|
9373
9430
|
])
|
|
9374
9431
|
], 64))
|
|
9375
9432
|
], 2);
|
|
@@ -5,10 +5,18 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
5
5
|
type: __PropType<SearchResultsProductOptions>;
|
|
6
6
|
required: true;
|
|
7
7
|
};
|
|
8
|
+
ssr: {
|
|
9
|
+
type: __PropType<boolean>;
|
|
10
|
+
required: false;
|
|
11
|
+
};
|
|
8
12
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
13
|
options: {
|
|
10
14
|
type: __PropType<SearchResultsProductOptions>;
|
|
11
15
|
required: true;
|
|
12
16
|
};
|
|
17
|
+
ssr: {
|
|
18
|
+
type: __PropType<boolean>;
|
|
19
|
+
required: false;
|
|
20
|
+
};
|
|
13
21
|
}>>, {}, {}>;
|
|
14
22
|
export default _sfc_main;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Ref } from 'vue';
|
|
2
2
|
import type { QueryParams } from '../types/search-results/QueryParams';
|
|
3
3
|
import type { InputSuggestionFacet } from '../types/search-box/Common';
|
|
4
|
+
import { SsrOptions } from '..';
|
|
4
5
|
export declare const useParamsStore: import("pinia").StoreDefinition<"params", import("pinia")._UnwrapAll<Pick<{
|
|
5
6
|
params: Ref<QueryParams>;
|
|
6
7
|
defaultLimit: Ref<number>;
|
|
@@ -11,7 +12,7 @@ export declare const useParamsStore: import("pinia").StoreDefinition<"params", i
|
|
|
11
12
|
limit: import("vue").ComputedRef<number>;
|
|
12
13
|
sort: import("vue").ComputedRef<string>;
|
|
13
14
|
filters: import("vue").ComputedRef<import("@getlupa/client-sdk/Types").FilterGroup>;
|
|
14
|
-
add: (newParams: QueryParams) => {
|
|
15
|
+
add: (newParams: QueryParams, ssr?: SsrOptions) => {
|
|
15
16
|
params: QueryParams;
|
|
16
17
|
};
|
|
17
18
|
removeAllFilters: () => void;
|
|
@@ -51,7 +52,7 @@ export declare const useParamsStore: import("pinia").StoreDefinition<"params", i
|
|
|
51
52
|
limit: import("vue").ComputedRef<number>;
|
|
52
53
|
sort: import("vue").ComputedRef<string>;
|
|
53
54
|
filters: import("vue").ComputedRef<import("@getlupa/client-sdk/Types").FilterGroup>;
|
|
54
|
-
add: (newParams: QueryParams) => {
|
|
55
|
+
add: (newParams: QueryParams, ssr?: SsrOptions) => {
|
|
55
56
|
params: QueryParams;
|
|
56
57
|
};
|
|
57
58
|
removeAllFilters: () => void;
|
|
@@ -91,7 +92,7 @@ export declare const useParamsStore: import("pinia").StoreDefinition<"params", i
|
|
|
91
92
|
limit: import("vue").ComputedRef<number>;
|
|
92
93
|
sort: import("vue").ComputedRef<string>;
|
|
93
94
|
filters: import("vue").ComputedRef<import("@getlupa/client-sdk/Types").FilterGroup>;
|
|
94
|
-
add: (newParams: QueryParams) => {
|
|
95
|
+
add: (newParams: QueryParams, ssr?: SsrOptions) => {
|
|
95
96
|
params: QueryParams;
|
|
96
97
|
};
|
|
97
98
|
removeAllFilters: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InputSuggestionFacet } from '../types/search-box/Common';
|
|
2
|
-
import type { RoutingBehavior } from '..';
|
|
2
|
+
import type { RoutingBehavior, SsrOptions } from '..';
|
|
3
3
|
export declare const emitRoutingEvent: (url: string) => void;
|
|
4
4
|
export declare const handleRoutingEvent: (link: string, event?: Event, hasEventRouting?: boolean) => void;
|
|
5
5
|
export declare const redirectToResultsPage: (link: string, searchText: string, facet?: InputSuggestionFacet, routingBehavior?: RoutingBehavior) => void;
|
|
6
|
-
export declare const getPageUrl: (pathnameOverride?: string) => URL;
|
|
6
|
+
export declare const getPageUrl: (pathnameOverride?: string, ssr?: SsrOptions) => URL;
|