@visitscotland/component-library 5.18.0 → 5.18.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.
- package/dist/client/manifest.json +9 -9
- package/dist/client/scripts/265b7c9f403e78b8db65.js +1 -0
- package/dist/client/scripts/9b38d68c8dc4375aa543.js +1 -0
- package/dist/client/scripts/cca4a73561360df71bc6.js +1 -0
- package/dist/components/stores/federatedSearch.store.d.ts +7 -4
- package/dist/components/vs-component-library.js +1 -1
- package/dist/components/vs-component-library.mjs +59 -52
- package/dist/ssr/index.js +1 -1
- package/dist/ssr/manifest.json +1 -1
- package/package.json +1 -1
- package/dist/client/scripts/19bf3fda24af130d6309.js +0 -1
- package/dist/client/scripts/a457e9c50e47ef615e6a.js +0 -1
- package/dist/client/scripts/ada624c5fa37983735da.js +0 -1
- /package/dist/client/styles/{a457e9c50e47ef615e6a.css → 265b7c9f403e78b8db65.css} +0 -0
- /package/dist/client/styles/{19bf3fda24af130d6309.css → cca4a73561360df71bc6.css} +0 -0
- /package/dist/ssr/styles/{b69602448346519334cf.css → 7674e66aa2c9fb6cb6d9.css} +0 -0
|
@@ -34029,12 +34029,12 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
|
|
|
34029
34029
|
if (l.value ? D.searchParams.set("search-term", l.value) : D.searchParams.delete("search-term"), u.value ? D.searchParams.set("category", encodeURIComponent(u.value)) : D.searchParams.delete("category"), m.value.length > 0 ? D.searchParams.set("sub-category", encodeURIComponent(m.value.join(","))) : D.searchParams.delete("sub-category"), A ? (a.value = 1, D.searchParams.set("page", a.value.toString())) : a.value && a.value > 1 ? D.searchParams.set("page", a.value.toString()) : D.searchParams.delete("page"), v.value ? D.searchParams.set("start-date", v.value) : D.searchParams.delete("start-date"), b.value ? D.searchParams.set("end-date", b.value) : D.searchParams.delete("end-date"), k.value ? D.searchParams.set("sort-by", k.value) : D.searchParams.delete("sort-by"), !_.value)
|
|
34030
34030
|
window.history.pushState({}, "", D), V();
|
|
34031
34031
|
else {
|
|
34032
|
-
const O =
|
|
34032
|
+
const O = `${C.value}/${D.search}`;
|
|
34033
34033
|
window.location.href = O;
|
|
34034
34034
|
}
|
|
34035
34035
|
}
|
|
34036
34036
|
return {
|
|
34037
|
-
|
|
34037
|
+
filters: e,
|
|
34038
34038
|
currentPage: a,
|
|
34039
34039
|
cludoCredentials: n,
|
|
34040
34040
|
cludoError: t,
|
|
@@ -34045,6 +34045,7 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
|
|
|
34045
34045
|
isLoading: o,
|
|
34046
34046
|
results: i,
|
|
34047
34047
|
searchTerm: l,
|
|
34048
|
+
searchUrl: C,
|
|
34048
34049
|
selectedCategory: c,
|
|
34049
34050
|
selectedCategoryKey: u,
|
|
34050
34051
|
selectedSubCategory: d,
|
|
@@ -34316,6 +34317,13 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
|
|
|
34316
34317
|
type: String,
|
|
34317
34318
|
default: void 0
|
|
34318
34319
|
},
|
|
34320
|
+
/**
|
|
34321
|
+
* Array of filters to be used in the FedSearchInput component.
|
|
34322
|
+
*/
|
|
34323
|
+
filters: {
|
|
34324
|
+
type: Array,
|
|
34325
|
+
default: void 0
|
|
34326
|
+
},
|
|
34319
34327
|
/**
|
|
34320
34328
|
* Array of sub filters to be used in the FedSearchInput component.
|
|
34321
34329
|
*/
|
|
@@ -34332,40 +34340,40 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
|
|
|
34332
34340
|
}
|
|
34333
34341
|
},
|
|
34334
34342
|
setup(e) {
|
|
34335
|
-
const n = e, t = useFederatedSearchStore(), a = ref()
|
|
34336
|
-
async function
|
|
34337
|
-
t.currentPage = 1, t.searchTerm =
|
|
34338
|
-
const
|
|
34339
|
-
t.searchTerm &&
|
|
34343
|
+
const n = e, t = useFederatedSearchStore(), a = ref();
|
|
34344
|
+
async function r(m) {
|
|
34345
|
+
t.currentPage = 1, t.searchTerm = m.value.trim();
|
|
34346
|
+
const f = window.location.search, p = new URLSearchParams(f);
|
|
34347
|
+
t.searchTerm && p.get("search-term") !== t.searchTerm && (a.value = await t.getAutoComplete()), t.searchTerm || (a.value = null);
|
|
34340
34348
|
}
|
|
34341
|
-
function
|
|
34349
|
+
function s() {
|
|
34342
34350
|
a.value = null, t.navigateToResultsPage();
|
|
34343
34351
|
}
|
|
34344
|
-
function
|
|
34345
|
-
t.searchTerm =
|
|
34352
|
+
function o(m) {
|
|
34353
|
+
t.searchTerm = m, a.value = null, t.navigateToResultsPage();
|
|
34346
34354
|
}
|
|
34347
|
-
function
|
|
34348
|
-
return
|
|
34355
|
+
function i(m) {
|
|
34356
|
+
return m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
34349
34357
|
}
|
|
34350
|
-
function
|
|
34351
|
-
return
|
|
34358
|
+
function l(m) {
|
|
34359
|
+
return m.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
34352
34360
|
}
|
|
34353
|
-
function
|
|
34354
|
-
const
|
|
34355
|
-
if (!
|
|
34356
|
-
const
|
|
34357
|
-
return
|
|
34361
|
+
function c(m) {
|
|
34362
|
+
const f = (t.searchTerm || "").trim();
|
|
34363
|
+
if (!f) return l(m);
|
|
34364
|
+
const p = new RegExp(`(${i(f)})`, "gi");
|
|
34365
|
+
return l(m).replace(p, "<strong>$1</strong>");
|
|
34358
34366
|
}
|
|
34359
|
-
function
|
|
34360
|
-
const
|
|
34361
|
-
|
|
34367
|
+
function u(m) {
|
|
34368
|
+
const f = new URL(window.location);
|
|
34369
|
+
f.searchParams.delete("page"), t.currentPage = 1, f.searchParams.delete("start-date"), f.searchParams.delete("end-date"), t.startDate = "", t.endDate = "", t.sortBy = void 0, t.selectedSubCategory = [], t.selectedSubCategoryKey = [], t.selectedCategory = t.selectedCategory !== m.Label ? m.Label : "", t.selectedCategoryKey = t.selectedCategoryKey !== m.Key ? m.Key : "", t.navigateToResultsPage(!0);
|
|
34362
34370
|
}
|
|
34363
|
-
function m
|
|
34364
|
-
if (!t.selectedSubCategoryKey.includes(
|
|
34365
|
-
t.selectedSubCategory.push(
|
|
34371
|
+
function d(m) {
|
|
34372
|
+
if (!t.selectedSubCategoryKey.includes(m.Key))
|
|
34373
|
+
t.selectedSubCategory.push(m.Label), t.selectedSubCategoryKey.push(m.Key);
|
|
34366
34374
|
else {
|
|
34367
|
-
const
|
|
34368
|
-
|
|
34375
|
+
const f = t.selectedSubCategoryKey.indexOf(m.Key);
|
|
34376
|
+
f >= 0 && (t.selectedSubCategory.splice(f, 1), t.selectedSubCategoryKey.splice(f, 1));
|
|
34369
34377
|
}
|
|
34370
34378
|
t.navigateToResultsPage(!0);
|
|
34371
34379
|
}
|
|
@@ -34374,14 +34382,14 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
|
|
|
34374
34382
|
apiKey: n.cludoApiKey,
|
|
34375
34383
|
customerId: n.cludoCustomerId,
|
|
34376
34384
|
engineId: n.cludoEngineId
|
|
34377
|
-
}, t.isHomePage = n.isHomePage;
|
|
34378
|
-
const
|
|
34379
|
-
|
|
34380
|
-
}), (
|
|
34385
|
+
}, t.isHomePage = n.isHomePage, n.searchUrl && (t.searchUrl = n.searchUrl);
|
|
34386
|
+
const m = window.location.search, f = new URLSearchParams(m);
|
|
34387
|
+
f.has("search-term") && (t.searchTerm = f.get("search-term")), f.has("category") && (t.selectedCategoryKey = decodeURIComponent(f.get("category"))), f.has("sub-category") && decodeURIComponent(f.get("sub-category")).split(",").forEach((g) => t.selectedSubCategoryKey.push(g)), f.has("category") && f.get("category") === "events" && f.has("sort-by") && (t.sortBy = f.get("sort-by")), f.has("start-date") && (t.startDate = f.get("start-date")), f.has("end-date") && (t.endDate = f.get("end-date")), (f.has("search-term") || f.has("category")) && t.getSearchResults();
|
|
34388
|
+
}), (m, f) => (openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
34381
34389
|
createElementVNode("div", _hoisted_2$2, [
|
|
34382
34390
|
createElementVNode("div", _hoisted_3$1, [
|
|
34383
34391
|
createElementVNode("label", _hoisted_4$1, [
|
|
34384
|
-
|
|
34392
|
+
f[0] || (f[0] = createElementVNode("span", { class: "visually-hidden" }, " Search for something ", -1)),
|
|
34385
34393
|
createVNode(unref(VsIcon), {
|
|
34386
34394
|
icon: "vs-icon-control-search",
|
|
34387
34395
|
size: "xs"
|
|
@@ -34395,14 +34403,14 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
|
|
|
34395
34403
|
placeholder: n.labels.searchLabel,
|
|
34396
34404
|
type: "search",
|
|
34397
34405
|
value: unref(t).searchTerm,
|
|
34398
|
-
onUpdated:
|
|
34399
|
-
onKeyup: withKeys(
|
|
34406
|
+
onUpdated: r,
|
|
34407
|
+
onKeyup: withKeys(s, ["enter"])
|
|
34400
34408
|
}, null, 8, ["placeholder", "value"])
|
|
34401
34409
|
]),
|
|
34402
34410
|
createVNode(unref(VsButton), {
|
|
34403
34411
|
class: "d-none d-lg-block px-200",
|
|
34404
34412
|
disabled: unref(t).isLoading,
|
|
34405
|
-
onClick:
|
|
34413
|
+
onClick: s
|
|
34406
34414
|
}, {
|
|
34407
34415
|
default: withCtx(() => [
|
|
34408
34416
|
createTextVNode(toDisplayString(n.labels.search), 1)
|
|
@@ -34414,25 +34422,25 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
|
|
|
34414
34422
|
a.value ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
|
|
34415
34423
|
createVNode(unref(VsList), { unstyled: "" }, {
|
|
34416
34424
|
default: withCtx(() => [
|
|
34417
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(a.value, (
|
|
34418
|
-
key:
|
|
34425
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(a.value, (p) => (openBlock(), createElementBlock("li", {
|
|
34426
|
+
key: p,
|
|
34419
34427
|
class: "vs-fed-search-input__autocomplete__suggestion",
|
|
34420
|
-
onClick: (
|
|
34421
|
-
onKeyup: withKeys((
|
|
34428
|
+
onClick: (g) => o(p),
|
|
34429
|
+
onKeyup: withKeys((g) => o(p), ["enter"]),
|
|
34422
34430
|
tabindex: "0",
|
|
34423
|
-
innerHTML:
|
|
34431
|
+
innerHTML: c(p)
|
|
34424
34432
|
}, null, 40, _hoisted_7$1))), 128))
|
|
34425
34433
|
]),
|
|
34426
34434
|
_: 1
|
|
34427
34435
|
})
|
|
34428
34436
|
])) : createCommentVNode("", !0)
|
|
34429
34437
|
]),
|
|
34430
|
-
|
|
34438
|
+
n.filters ? (openBlock(), createBlock(_sfc_main$3, {
|
|
34431
34439
|
key: 0,
|
|
34432
34440
|
"active-filter": unref(t).selectedCategoryKey,
|
|
34433
|
-
"filter-categories":
|
|
34441
|
+
"filter-categories": n.filters,
|
|
34434
34442
|
wrap: !0,
|
|
34435
|
-
onFilterUpdated:
|
|
34443
|
+
onFilterUpdated: u
|
|
34436
34444
|
}, null, 8, ["active-filter", "filter-categories"])) : createCommentVNode("", !0),
|
|
34437
34445
|
unref(t).selectedCategoryKey === "events" && n.subFilters ? (openBlock(), createBlock(_sfc_main$3, {
|
|
34438
34446
|
key: 1,
|
|
@@ -34440,7 +34448,7 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
|
|
|
34440
34448
|
class: "mt-200",
|
|
34441
34449
|
"filter-categories": n.subFilters,
|
|
34442
34450
|
variant: "secondary",
|
|
34443
|
-
onFilterUpdated:
|
|
34451
|
+
onFilterUpdated: d
|
|
34444
34452
|
}, {
|
|
34445
34453
|
"fed-filter-header": withCtx(() => [
|
|
34446
34454
|
createTextVNode(toDisplayString(n.labels.refine), 1)
|
|
@@ -34620,9 +34628,9 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
|
|
|
34620
34628
|
default: getEnvValue("EVENTS_API_URL")
|
|
34621
34629
|
},
|
|
34622
34630
|
/**
|
|
34623
|
-
* Array of
|
|
34631
|
+
* Array of filters.
|
|
34624
34632
|
*/
|
|
34625
|
-
|
|
34633
|
+
filters: {
|
|
34626
34634
|
type: Array,
|
|
34627
34635
|
default: void 0
|
|
34628
34636
|
},
|
|
@@ -34694,9 +34702,7 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
|
|
|
34694
34702
|
message: "",
|
|
34695
34703
|
error: !1
|
|
34696
34704
|
}
|
|
34697
|
-
), a = e
|
|
34698
|
-
provide("cludoCategories", a.cludoCategories);
|
|
34699
|
-
const r = computed$1(() => {
|
|
34705
|
+
), a = e, r = computed$1(() => {
|
|
34700
34706
|
let f;
|
|
34701
34707
|
return n.selectedCategoryKey ? n.selectedCategoryKey !== "events" ? f = Math.ceil(n.totalResultsCludo / 12) : n.selectedCategoryKey === "events" && (f = Math.ceil(n.totalResultsEvents / 12)) : f = n.totalResultsCludo >= n.totalResultsEvents ? Math.ceil(n.totalResultsCludo / 6) : Math.ceil(n.totalResultsEvents / 6), f;
|
|
34702
34708
|
});
|
|
@@ -34709,7 +34715,7 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
|
|
|
34709
34715
|
apiKey: a.cludoApiKey,
|
|
34710
34716
|
customerId: a.cludoCustomerId,
|
|
34711
34717
|
engineId: a.cludoEngineId
|
|
34712
|
-
}, n.eventsApi = a.eventsApi, n.
|
|
34718
|
+
}, n.eventsApi = a.eventsApi, n.filters = a.filters, n.siteLanguage = a.siteLanguage, s(), typeof window < "u" && typeof document < "u") {
|
|
34713
34719
|
const f = new URLSearchParams(document.location.search), p = f.get("search-term"), g = parseInt(f.get("page"), 10);
|
|
34714
34720
|
g && (n.currentPage = g), p && (n.searchTerm = p, n.getSearchResults());
|
|
34715
34721
|
}
|
|
@@ -34754,11 +34760,12 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
|
|
|
34754
34760
|
"cludo-api-key": a.cludoApiKey,
|
|
34755
34761
|
"cludo-customer-id": a.cludoCustomerId,
|
|
34756
34762
|
"cludo-engine-id": a.cludoEngineId,
|
|
34763
|
+
filters: a.filters,
|
|
34757
34764
|
"sub-filters": a.subFilters,
|
|
34758
34765
|
labels: a.searchLabels
|
|
34759
|
-
}, null, 8, ["cludo-api-key", "cludo-customer-id", "cludo-engine-id", "sub-filters", "labels"]),
|
|
34766
|
+
}, null, 8, ["cludo-api-key", "cludo-customer-id", "cludo-engine-id", "filters", "sub-filters", "labels"]),
|
|
34760
34767
|
createVNode(_sfc_main$4, { class: "my-200" }),
|
|
34761
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n).
|
|
34768
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n).filters, (g, _) => withDirectives((openBlock(), createElementBlock("div", {
|
|
34762
34769
|
key: _,
|
|
34763
34770
|
class: "mb-200"
|
|
34764
34771
|
}, [
|