@searchcraft/javascript-sdk 0.10.6 → 0.10.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/components/index.d.ts +11 -4
- package/dist/components/index.js +4 -4
- package/dist/components/{p-b54873ff.js → p-062d6b80.js} +122 -110
- package/dist/components/p-062d6b80.js.map +1 -0
- package/dist/components/{p-f2976b33.js → p-274c5cc8.js} +2 -2
- package/dist/components/{p-f2976b33.js.map → p-274c5cc8.js.map} +1 -1
- package/dist/components/{p-2735dceb.js → p-320e3895.js} +2 -2
- package/dist/components/{p-2735dceb.js.map → p-320e3895.js.map} +1 -1
- package/dist/components/{p-a7d611cd.js → p-acab4d41.js} +2 -2
- package/dist/components/{p-a7d611cd.js.map → p-acab4d41.js.map} +1 -1
- package/dist/components/{p-6e5ed641.js → p-adc6236e.js} +80 -35
- package/dist/components/p-adc6236e.js.map +1 -0
- package/dist/components/{p-aba24c85.js → p-b01f8216.js} +11 -11
- package/dist/components/p-b01f8216.js.map +1 -0
- package/dist/components/{p-9f4c50ed.js → p-b4cac872.js} +2 -2
- package/dist/components/{p-9f4c50ed.js.map → p-b4cac872.js.map} +1 -1
- package/dist/components/{p-b194d081.js → p-e99cd628.js} +2 -2
- package/dist/components/{p-b194d081.js.map → p-e99cd628.js.map} +1 -1
- package/dist/components/{p-75134ca7.js → p-ea48ccae.js} +2 -2
- package/dist/components/{p-75134ca7.js.map → p-ea48ccae.js.map} +1 -1
- package/dist/components/searchcraft-ad.js +1 -1
- package/dist/components/searchcraft-facet-list.js +1 -1
- package/dist/components/searchcraft-filter-panel.js +3 -3
- package/dist/components/searchcraft-input-form.js +1 -1
- package/dist/components/searchcraft-pagination.js +1 -1
- package/dist/components/searchcraft-popover-button.js +1 -1
- package/dist/components/searchcraft-popover-footer.js +1 -1
- package/dist/components/searchcraft-popover-form.js +6 -6
- package/dist/components/searchcraft-popover-list-item.js +1 -1
- package/dist/components/searchcraft-popover-list-view.js +1 -1
- package/dist/components/searchcraft-results-info.js +1 -1
- package/dist/components/searchcraft-search-result.js +1 -1
- package/dist/components/searchcraft-search-results-per-page.js +1 -1
- package/dist/components/searchcraft-search-results.js +10 -10
- package/dist/components/searchcraft-search-results.js.map +1 -1
- package/dist/components/searchcraft-toggle-button.js +1 -1
- package/dist/hydrate/index.js +144 -99
- package/dist/hydrate/index.mjs +144 -99
- package/dist/types/components/searchcraft-ad/searchcraft-ad.d.ts +22 -2
- package/dist/types/components.d.ts +8 -2
- package/package.json +3 -3
- package/dist/components/p-6e5ed641.js.map +0 -1
- package/dist/components/p-aba24c85.js.map +0 -1
- package/dist/components/p-b54873ff.js.map +0 -1
package/dist/hydrate/index.js
CHANGED
|
@@ -3183,7 +3183,7 @@ Object.keys(react).forEach(function (k) {
|
|
|
3183
3183
|
var B = Object.defineProperty;
|
|
3184
3184
|
var N = (a, e, n) => e in a ? B(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
|
|
3185
3185
|
var h = (a, e, n) => N(a, typeof e != "symbol" ? e + "" : e, n);
|
|
3186
|
-
var
|
|
3186
|
+
var D = /* @__PURE__ */ ((a) => (a[a.DEBUG = 0] = "DEBUG", a[a.INFO = 1] = "INFO", a[a.WARN = 2] = "WARN", a[a.ERROR = 3] = "ERROR", a))(D || {});
|
|
3187
3187
|
class pe {
|
|
3188
3188
|
constructor(e) {
|
|
3189
3189
|
h(this, "logLevel");
|
|
@@ -3191,7 +3191,7 @@ class pe {
|
|
|
3191
3191
|
this.logLevel = e.logLevel || 1, this.logFormatter = e.logFormatter || this.defaultFormatter;
|
|
3192
3192
|
}
|
|
3193
3193
|
defaultFormatter(e, n) {
|
|
3194
|
-
return `[${
|
|
3194
|
+
return `[${D[e]}] ${( new Date()).toISOString()}: ${n}`;
|
|
3195
3195
|
}
|
|
3196
3196
|
debug(e) {
|
|
3197
3197
|
this.logLevel <= 0 && console.log(this.logFormatter(0, e));
|
|
@@ -3222,7 +3222,7 @@ class pe {
|
|
|
3222
3222
|
}
|
|
3223
3223
|
}
|
|
3224
3224
|
}
|
|
3225
|
-
function
|
|
3225
|
+
function w(a, e, n, r) {
|
|
3226
3226
|
return new (n || (n = Promise))(function(o, i) {
|
|
3227
3227
|
function t(s) {
|
|
3228
3228
|
try {
|
|
@@ -3247,7 +3247,7 @@ function y(a, e, n, r) {
|
|
|
3247
3247
|
l((r = r.apply(a, [])).next());
|
|
3248
3248
|
});
|
|
3249
3249
|
}
|
|
3250
|
-
function
|
|
3250
|
+
function y(a, e) {
|
|
3251
3251
|
var n, r, o, i, t = { label: 0, sent: function() {
|
|
3252
3252
|
if (1 & o[0]) throw o[1];
|
|
3253
3253
|
return o[1];
|
|
@@ -3306,17 +3306,17 @@ function w(a, e) {
|
|
|
3306
3306
|
};
|
|
3307
3307
|
}
|
|
3308
3308
|
}
|
|
3309
|
-
var S = { exclude: [] },
|
|
3310
|
-
typeof window < "u" && (
|
|
3309
|
+
var S = { exclude: [] }, U = {}, v = function(a, e) {
|
|
3310
|
+
typeof window < "u" && (U[a] = e);
|
|
3311
3311
|
};
|
|
3312
|
-
function
|
|
3312
|
+
function I(a) {
|
|
3313
3313
|
return a ^= a >>> 16, a = Math.imul(a, 2246822507), a ^= a >>> 13, a = Math.imul(a, 3266489909), (a ^= a >>> 16) >>> 0;
|
|
3314
3314
|
}
|
|
3315
3315
|
var m = new Uint32Array([597399067, 2869860233, 951274213, 2716044179]);
|
|
3316
3316
|
function p(a, e) {
|
|
3317
3317
|
return a << e | a >>> 32 - e;
|
|
3318
3318
|
}
|
|
3319
|
-
function
|
|
3319
|
+
function R(a, e) {
|
|
3320
3320
|
var n;
|
|
3321
3321
|
if (e === void 0 && (e = 0), e = e ? 0 | e : 0, typeof a == "string" && (n = a, a = new TextEncoder().encode(n).buffer), !(a instanceof ArrayBuffer)) throw new TypeError("Expected key to be ArrayBuffer or string");
|
|
3322
3322
|
var r = new Uint32Array([e, e, e, e]);
|
|
@@ -3360,7 +3360,7 @@ function _(a, e) {
|
|
|
3360
3360
|
s[0] = s[0] ^ c[0] << 0, s[0] = Math.imul(s[0], m[0]), s[0] = p(s[0], 15), s[0] = Math.imul(s[0], m[1]), t[0] = t[0] ^ s[0];
|
|
3361
3361
|
}
|
|
3362
3362
|
}(a, r), function(i, t) {
|
|
3363
|
-
t[0] = t[0] ^ i.byteLength, t[1] = t[1] ^ i.byteLength, t[2] = t[2] ^ i.byteLength, t[3] = t[3] ^ i.byteLength, t[0] = t[0] + t[1] | 0, t[0] = t[0] + t[2] | 0, t[0] = t[0] + t[3] | 0, t[1] = t[1] + t[0] | 0, t[2] = t[2] + t[0] | 0, t[3] = t[3] + t[0] | 0, t[0] =
|
|
3363
|
+
t[0] = t[0] ^ i.byteLength, t[1] = t[1] ^ i.byteLength, t[2] = t[2] ^ i.byteLength, t[3] = t[3] ^ i.byteLength, t[0] = t[0] + t[1] | 0, t[0] = t[0] + t[2] | 0, t[0] = t[0] + t[3] | 0, t[1] = t[1] + t[0] | 0, t[2] = t[2] + t[0] | 0, t[3] = t[3] + t[0] | 0, t[0] = I(t[0]), t[1] = I(t[1]), t[2] = I(t[2]), t[3] = I(t[3]), t[0] = t[0] + t[1] | 0, t[0] = t[0] + t[2] | 0, t[0] = t[0] + t[3] | 0, t[1] = t[1] + t[0] | 0, t[2] = t[2] + t[0] | 0, t[3] = t[3] + t[0] | 0;
|
|
3364
3364
|
}(a, r);
|
|
3365
3365
|
var o = new Uint8Array(r.buffer);
|
|
3366
3366
|
return Array.from(o).map(function(i) {
|
|
@@ -3371,7 +3371,7 @@ function H(a) {
|
|
|
3371
3371
|
for (var e = 0, n = 0; n < a.length; ++n) e += Math.abs(a[n]);
|
|
3372
3372
|
return e;
|
|
3373
3373
|
}
|
|
3374
|
-
function
|
|
3374
|
+
function L(a, e, n) {
|
|
3375
3375
|
for (var r = [], o = 0; o < a[0].data.length; o++) {
|
|
3376
3376
|
for (var i = [], t = 0; t < a.length; t++) i.push(a[t].data[o]);
|
|
3377
3377
|
r.push(Q(i));
|
|
@@ -3387,7 +3387,7 @@ function Q(a) {
|
|
|
3387
3387
|
for (var i in e) e[i] > e[o] && (o = parseInt(i, 10));
|
|
3388
3388
|
return o;
|
|
3389
3389
|
}
|
|
3390
|
-
function
|
|
3390
|
+
function A() {
|
|
3391
3391
|
if (typeof navigator > "u") return { name: "unknown", version: "unknown" };
|
|
3392
3392
|
for (var a = navigator.userAgent, e = { Edg: "Edge", OPR: "Opera" }, n = 0, r = [/(?<name>Edge|Edg)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Chrome|Chromium|OPR|Opera|Vivaldi|Brave))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Firefox|Waterfox|Iceweasel|IceCat))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>Safari)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)?)/, /(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)?)/]; n < r.length; n++) {
|
|
3393
3393
|
var o = r[n], i = a.match(o);
|
|
@@ -3396,8 +3396,8 @@ function C() {
|
|
|
3396
3396
|
return { name: "unknown", version: "unknown" };
|
|
3397
3397
|
}
|
|
3398
3398
|
v("audio", function() {
|
|
3399
|
-
return
|
|
3400
|
-
return
|
|
3399
|
+
return w(this, void 0, void 0, function() {
|
|
3400
|
+
return y(this, function(a) {
|
|
3401
3401
|
return [2, new Promise(function(e, n) {
|
|
3402
3402
|
try {
|
|
3403
3403
|
var r = new (window.OfflineAudioContext || window.webkitOfflineAudioContext)(1, 5e3, 44100), o = r.createBufferSource(), i = r.createOscillator();
|
|
@@ -3413,14 +3413,14 @@ v("audio", function() {
|
|
|
3413
3413
|
});
|
|
3414
3414
|
});
|
|
3415
3415
|
});
|
|
3416
|
-
var K =
|
|
3417
|
-
|
|
3416
|
+
var K = A().name !== "SamsungBrowser" ? 1 : 3, k = 280, F = 20;
|
|
3417
|
+
A().name != "Firefox" && v("canvas", function() {
|
|
3418
3418
|
return document.createElement("canvas").getContext("2d"), new Promise(function(a) {
|
|
3419
3419
|
var e = Array.from({ length: K }, function() {
|
|
3420
3420
|
return function() {
|
|
3421
3421
|
var n = document.createElement("canvas"), r = n.getContext("2d");
|
|
3422
3422
|
if (!r) return new ImageData(1, 1);
|
|
3423
|
-
n.width =
|
|
3423
|
+
n.width = k, n.height = F;
|
|
3424
3424
|
var o = r.createLinearGradient(0, 0, n.width, n.height);
|
|
3425
3425
|
o.addColorStop(0, "red"), o.addColorStop(0.16666666666666666, "orange"), o.addColorStop(0.3333333333333333, "yellow"), o.addColorStop(0.5, "green"), o.addColorStop(0.6666666666666666, "blue"), o.addColorStop(0.8333333333333334, "indigo"), o.addColorStop(1, "violet"), r.fillStyle = o, r.fillRect(0, 0, n.width, n.height);
|
|
3426
3426
|
var i = "Random Text WMwmil10Oo";
|
|
@@ -3429,11 +3429,11 @@ C().name != "Firefox" && v("canvas", function() {
|
|
|
3429
3429
|
return t;
|
|
3430
3430
|
}();
|
|
3431
3431
|
});
|
|
3432
|
-
a({ commonImageDataHash:
|
|
3432
|
+
a({ commonImageDataHash: R(L(e, k, F).data.toString()).toString() });
|
|
3433
3433
|
});
|
|
3434
3434
|
});
|
|
3435
|
-
var
|
|
3436
|
-
function
|
|
3435
|
+
var M, X = ["Arial", "Arial Black", "Arial Narrow", "Arial Rounded MT", "Arimo", "Archivo", "Barlow", "Bebas Neue", "Bitter", "Bookman", "Calibri", "Cabin", "Candara", "Century", "Century Gothic", "Comic Sans MS", "Constantia", "Courier", "Courier New", "Crimson Text", "DM Mono", "DM Sans", "DM Serif Display", "DM Serif Text", "Dosis", "Droid Sans", "Exo", "Fira Code", "Fira Sans", "Franklin Gothic Medium", "Garamond", "Geneva", "Georgia", "Gill Sans", "Helvetica", "Impact", "Inconsolata", "Indie Flower", "Inter", "Josefin Sans", "Karla", "Lato", "Lexend", "Lucida Bright", "Lucida Console", "Lucida Sans Unicode", "Manrope", "Merriweather", "Merriweather Sans", "Montserrat", "Myriad", "Noto Sans", "Nunito", "Nunito Sans", "Open Sans", "Optima", "Orbitron", "Oswald", "Pacifico", "Palatino", "Perpetua", "PT Sans", "PT Serif", "Poppins", "Prompt", "Public Sans", "Quicksand", "Rajdhani", "Recursive", "Roboto", "Roboto Condensed", "Rockwell", "Rubik", "Segoe Print", "Segoe Script", "Segoe UI", "Sora", "Source Sans Pro", "Space Mono", "Tahoma", "Taviraj", "Times", "Times New Roman", "Titillium Web", "Trebuchet MS", "Ubuntu", "Varela Round", "Verdana", "Work Sans"], J = ["monospace", "sans-serif", "serif"];
|
|
3436
|
+
function O(a, e) {
|
|
3437
3437
|
if (!a) throw new Error("Canvas context not supported");
|
|
3438
3438
|
return a.font = "72px ".concat(e), a.measureText("WwMmLli0Oo").width;
|
|
3439
3439
|
}
|
|
@@ -3495,15 +3495,15 @@ function ne() {
|
|
|
3495
3495
|
}
|
|
3496
3496
|
return 0;
|
|
3497
3497
|
}
|
|
3498
|
-
|
|
3498
|
+
A().name != "Firefox" && v("fonts", function() {
|
|
3499
3499
|
var a = this;
|
|
3500
3500
|
return new Promise(function(e, n) {
|
|
3501
3501
|
try {
|
|
3502
3502
|
(function(r) {
|
|
3503
3503
|
var o;
|
|
3504
|
-
|
|
3504
|
+
w(this, void 0, void 0, function() {
|
|
3505
3505
|
var i, t, u;
|
|
3506
|
-
return
|
|
3506
|
+
return y(this, function(l) {
|
|
3507
3507
|
switch (l.label) {
|
|
3508
3508
|
case 0:
|
|
3509
3509
|
return document.body ? [3, 2] : [4, (s = 50, new Promise(function(g) {
|
|
@@ -3522,13 +3522,13 @@ C().name != "Firefox" && v("fonts", function() {
|
|
|
3522
3522
|
});
|
|
3523
3523
|
})(function(r) {
|
|
3524
3524
|
var o = r.iframe;
|
|
3525
|
-
return
|
|
3525
|
+
return w(a, void 0, void 0, function() {
|
|
3526
3526
|
var i, t, u, l;
|
|
3527
|
-
return
|
|
3527
|
+
return y(this, function(s) {
|
|
3528
3528
|
return i = o.createElement("canvas"), t = i.getContext("2d"), u = J.map(function(c) {
|
|
3529
|
-
return
|
|
3529
|
+
return O(t, c);
|
|
3530
3530
|
}), l = {}, X.forEach(function(c) {
|
|
3531
|
-
var g =
|
|
3531
|
+
var g = O(t, c);
|
|
3532
3532
|
u.includes(g) || (l[c] = g);
|
|
3533
3533
|
}), e(l), [2];
|
|
3534
3534
|
});
|
|
@@ -3548,17 +3548,17 @@ C().name != "Firefox" && v("fonts", function() {
|
|
|
3548
3548
|
a({ languages: navigator.language, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone });
|
|
3549
3549
|
});
|
|
3550
3550
|
}), v("permissions", function() {
|
|
3551
|
-
return
|
|
3551
|
+
return w(this, void 0, void 0, function() {
|
|
3552
3552
|
var a;
|
|
3553
|
-
return
|
|
3554
|
-
return
|
|
3553
|
+
return y(this, function(e) {
|
|
3554
|
+
return M = (S == null ? void 0 : S.permissions_to_check) || ["accelerometer", "accessibility", "accessibility-events", "ambient-light-sensor", "background-fetch", "background-sync", "bluetooth", "camera", "clipboard-read", "clipboard-write", "device-info", "display-capture", "gyroscope", "geolocation", "local-fonts", "magnetometer", "microphone", "midi", "nfc", "notifications", "payment-handler", "persistent-storage", "push", "speaker", "storage-access", "top-level-storage-access", "window-management", "query"], a = Array.from({ length: (S == null ? void 0 : S.retries) || 3 }, function() {
|
|
3555
3555
|
return function() {
|
|
3556
|
-
return
|
|
3556
|
+
return w(this, void 0, void 0, function() {
|
|
3557
3557
|
var n, r, o, i, t;
|
|
3558
|
-
return
|
|
3558
|
+
return y(this, function(u) {
|
|
3559
3559
|
switch (u.label) {
|
|
3560
3560
|
case 0:
|
|
3561
|
-
n = {}, r = 0, o =
|
|
3561
|
+
n = {}, r = 0, o = M, u.label = 1;
|
|
3562
3562
|
case 1:
|
|
3563
3563
|
if (!(r < o.length)) return [3, 6];
|
|
3564
3564
|
i = o[r], u.label = 2;
|
|
@@ -3577,7 +3577,7 @@ C().name != "Firefox" && v("fonts", function() {
|
|
|
3577
3577
|
});
|
|
3578
3578
|
}();
|
|
3579
3579
|
}), [2, Promise.all(a).then(function(n) {
|
|
3580
|
-
return ee(n,
|
|
3580
|
+
return ee(n, M);
|
|
3581
3581
|
})];
|
|
3582
3582
|
});
|
|
3583
3583
|
});
|
|
@@ -3596,15 +3596,15 @@ C().name != "Firefox" && v("fonts", function() {
|
|
|
3596
3596
|
});
|
|
3597
3597
|
}), v("system", function() {
|
|
3598
3598
|
return new Promise(function(a) {
|
|
3599
|
-
var e =
|
|
3599
|
+
var e = A();
|
|
3600
3600
|
a({ platform: window.navigator.platform, cookieEnabled: window.navigator.cookieEnabled, productSub: navigator.productSub, product: navigator.product, useragent: navigator.userAgent, hardwareConcurrency: navigator.hardwareConcurrency, browser: { name: e.name, version: e.version }, applePayVersion: ne() });
|
|
3601
3601
|
});
|
|
3602
3602
|
});
|
|
3603
|
-
var f, re =
|
|
3603
|
+
var f, re = A().name !== "SamsungBrowser" ? 1 : 3, d = null;
|
|
3604
3604
|
v("webgl", function() {
|
|
3605
|
-
return
|
|
3605
|
+
return w(this, void 0, void 0, function() {
|
|
3606
3606
|
var a;
|
|
3607
|
-
return
|
|
3607
|
+
return y(this, function(e) {
|
|
3608
3608
|
typeof document < "u" && ((f = document.createElement("canvas")).width = 200, f.height = 100, d = f.getContext("webgl"));
|
|
3609
3609
|
try {
|
|
3610
3610
|
if (!d) throw new Error("WebGL not supported");
|
|
@@ -3634,19 +3634,19 @@ v("webgl", function() {
|
|
|
3634
3634
|
var g = c * s;
|
|
3635
3635
|
l[4 * c] = 0, l[4 * c + 1] = 0, l[4 * c + 2] = Math.cos(g) * (f.width / 2), l[4 * c + 3] = Math.sin(g) * (f.height / 2);
|
|
3636
3636
|
}
|
|
3637
|
-
var
|
|
3638
|
-
d.bindBuffer(d.ARRAY_BUFFER,
|
|
3639
|
-
var
|
|
3640
|
-
d.enableVertexAttribArray(
|
|
3641
|
-
var
|
|
3642
|
-
return d.readPixels(0, 0, f.width, f.height, d.RGBA, d.UNSIGNED_BYTE,
|
|
3637
|
+
var T = d.createBuffer();
|
|
3638
|
+
d.bindBuffer(d.ARRAY_BUFFER, T), d.bufferData(d.ARRAY_BUFFER, l, d.STATIC_DRAW);
|
|
3639
|
+
var E = d.getAttribLocation(t, "position");
|
|
3640
|
+
d.enableVertexAttribArray(E), d.vertexAttribPointer(E, 2, d.FLOAT, !1, 0, 0), d.viewport(0, 0, f.width, f.height), d.clearColor(0, 0, 0, 1), d.clear(d.COLOR_BUFFER_BIT), d.drawArrays(d.LINES, 0, 2 * u);
|
|
3641
|
+
var P = new Uint8ClampedArray(f.width * f.height * 4);
|
|
3642
|
+
return d.readPixels(0, 0, f.width, f.height, d.RGBA, d.UNSIGNED_BYTE, P), new ImageData(P, f.width, f.height);
|
|
3643
3643
|
} catch {
|
|
3644
3644
|
return new ImageData(1, 1);
|
|
3645
3645
|
} finally {
|
|
3646
3646
|
d && (d.bindBuffer(d.ARRAY_BUFFER, null), d.useProgram(null), d.viewport(0, 0, d.drawingBufferWidth, d.drawingBufferHeight), d.clearColor(0, 0, 0, 0));
|
|
3647
3647
|
}
|
|
3648
3648
|
}();
|
|
3649
|
-
}), [2, { commonImageHash:
|
|
3649
|
+
}), [2, { commonImageHash: R(L(a, f.width, f.height).data.toString()).toString() }];
|
|
3650
3650
|
} catch {
|
|
3651
3651
|
return [2, { webgl: "unsupported" }];
|
|
3652
3652
|
}
|
|
@@ -3660,8 +3660,8 @@ var b = function(a, e, n, r) {
|
|
|
3660
3660
|
return i * o;
|
|
3661
3661
|
};
|
|
3662
3662
|
v("math", function() {
|
|
3663
|
-
return
|
|
3664
|
-
return
|
|
3663
|
+
return w(void 0, void 0, void 0, function() {
|
|
3664
|
+
return y(this, function(a) {
|
|
3665
3665
|
return [2, { acos: Math.acos(0.5), asin: b(Math.asin, -1, 1, 97), atan: b(Math.atan, -1, 1, 97), cos: b(Math.cos, 0, Math.PI, 97), cosh: Math.cosh(9 / 7), e: Math.E, largeCos: Math.cos(1e20), largeSin: Math.sin(1e20), largeTan: Math.tan(1e20), log: Math.log(1e3), pi: Math.PI, sin: b(Math.sin, -Math.PI, Math.PI, 97), sinh: b(Math.sinh, -9 / 7, 7 / 9, 97), sqrt: Math.sqrt(2), tan: b(Math.tan, 0, 2 * Math.PI, 97), tanh: b(Math.tanh, -9 / 7, 7 / 9, 97) }];
|
|
3666
3666
|
});
|
|
3667
3667
|
});
|
|
@@ -3718,7 +3718,7 @@ const searchcraftStore = zustand.createStore((_set, get) => {
|
|
|
3718
3718
|
},
|
|
3719
3719
|
init: (core, debug = false) => {
|
|
3720
3720
|
const logger = debug
|
|
3721
|
-
? new pe({ logLevel:
|
|
3721
|
+
? new pe({ logLevel: D.DEBUG })
|
|
3722
3722
|
: undefined;
|
|
3723
3723
|
const state = functions.set({
|
|
3724
3724
|
core,
|
|
@@ -3756,12 +3756,12 @@ const searchcraftStore = zustand.createStore((_set, get) => {
|
|
|
3756
3756
|
},
|
|
3757
3757
|
search: async () => {
|
|
3758
3758
|
const state = get();
|
|
3759
|
-
state.logger?.log(
|
|
3759
|
+
state.logger?.log(D.INFO, `Starting search with search term: "${state.searchTerm}"`);
|
|
3760
3760
|
if (!state.core) {
|
|
3761
3761
|
throw new Error('Searchcraft instance is not initialized.');
|
|
3762
3762
|
}
|
|
3763
3763
|
if (!state.searchTerm.trim()) {
|
|
3764
|
-
state.logger?.log(
|
|
3764
|
+
state.logger?.log(D.INFO, 'No search request was made: search term was empty.');
|
|
3765
3765
|
functions.set({
|
|
3766
3766
|
searchClientResponseItems: [],
|
|
3767
3767
|
searchResultsCount: 0,
|
|
@@ -3801,8 +3801,8 @@ const searchcraftStore = zustand.createStore((_set, get) => {
|
|
|
3801
3801
|
searchClientRequest: request,
|
|
3802
3802
|
};
|
|
3803
3803
|
});
|
|
3804
|
-
state.logger?.log(
|
|
3805
|
-
state.logger?.log(
|
|
3804
|
+
state.logger?.log(D.DEBUG, `Search results: ${JSON.stringify(items)}`);
|
|
3805
|
+
state.logger?.log(D.DEBUG, `Facets from response: ${JSON.stringify(facets)}`);
|
|
3806
3806
|
},
|
|
3807
3807
|
setInitialSearchClientResponseItemsFromResponse: (request, response, items) => {
|
|
3808
3808
|
const state = get();
|
|
@@ -3819,11 +3819,11 @@ const searchcraftStore = zustand.createStore((_set, get) => {
|
|
|
3819
3819
|
searchClientRequest: request,
|
|
3820
3820
|
};
|
|
3821
3821
|
});
|
|
3822
|
-
state.logger?.log(
|
|
3822
|
+
state.logger?.log(D.DEBUG, `Search results: ${JSON.stringify(items)}`);
|
|
3823
3823
|
},
|
|
3824
3824
|
setInitialQuery: async (query) => {
|
|
3825
3825
|
const state = functions.set({ initialQuery: query });
|
|
3826
|
-
state.logger?.log(
|
|
3826
|
+
state.logger?.log(D.INFO, `Starting search with query: "${state.initialQuery}"`);
|
|
3827
3827
|
if (!state.core) {
|
|
3828
3828
|
throw new Error('Searchcraft instance is not initialized.');
|
|
3829
3829
|
}
|
|
@@ -6904,40 +6904,99 @@ class SearchcraftPopoverListItemAd {
|
|
|
6904
6904
|
}
|
|
6905
6905
|
adSource = 'Custom';
|
|
6906
6906
|
adClientResponseItem;
|
|
6907
|
-
|
|
6907
|
+
/**
|
|
6908
|
+
* Where the ad is being rendered within the search results div.
|
|
6909
|
+
* Lifecycle behavior differs for ads being rendered in different positions,
|
|
6910
|
+
* so we need to be able to handle all of those cases.
|
|
6911
|
+
*/
|
|
6912
|
+
renderPosition = 'interstitial';
|
|
6908
6913
|
searchTerm;
|
|
6909
6914
|
isSearchInProgress = false;
|
|
6915
|
+
searchResultCount = 0;
|
|
6910
6916
|
get hostElement() { return getElement(this); }
|
|
6911
6917
|
core;
|
|
6912
6918
|
intersectionObserver;
|
|
6913
6919
|
storeUnsubscribe;
|
|
6914
6920
|
adContainerRenderedTimeout;
|
|
6915
|
-
isComponentConnected =
|
|
6921
|
+
isComponentConnected = false;
|
|
6922
|
+
timeTaken;
|
|
6923
|
+
adContainerId = '';
|
|
6924
|
+
/**
|
|
6925
|
+
* Handles when an ad container is first rendered.
|
|
6926
|
+
* Core emits an ad_container_rendered event and performs ad client side effects
|
|
6927
|
+
*
|
|
6928
|
+
*/
|
|
6929
|
+
handleAdRendered() {
|
|
6930
|
+
this.adContainerId = nanoid();
|
|
6931
|
+
if (this.isComponentConnected && this.searchResultCount > 0) {
|
|
6932
|
+
clearTimeout(this.adContainerRenderedTimeout);
|
|
6933
|
+
this.adContainerRenderedTimeout = setTimeout(() => {
|
|
6934
|
+
this.core?.handleAdContainerRendered({
|
|
6935
|
+
adClientResponseItem: this.adClientResponseItem,
|
|
6936
|
+
adContainerId: this.adContainerId,
|
|
6937
|
+
adSource: this.adSource,
|
|
6938
|
+
searchTerm: this.searchTerm || '',
|
|
6939
|
+
});
|
|
6940
|
+
}, this.core?.config?.adContainerRenderedDebounceDelay || 300);
|
|
6941
|
+
}
|
|
6942
|
+
}
|
|
6943
|
+
handleAdViewed() {
|
|
6944
|
+
this.core?.handleAdContainerViewed({
|
|
6945
|
+
adClientResponseItem: this.adClientResponseItem,
|
|
6946
|
+
adContainerId: this.adContainerId,
|
|
6947
|
+
adSource: this.adSource,
|
|
6948
|
+
searchTerm: this.searchTerm || '',
|
|
6949
|
+
});
|
|
6950
|
+
}
|
|
6951
|
+
/**
|
|
6952
|
+
* Things to do when there's a new incoming search request.
|
|
6953
|
+
*/
|
|
6954
|
+
handleNewIncomingSearchRequest(state) {
|
|
6955
|
+
const request = state.searchClientRequest;
|
|
6956
|
+
if (request && typeof request === 'object') {
|
|
6957
|
+
this.searchTerm = request.searchTerm;
|
|
6958
|
+
}
|
|
6959
|
+
this.searchResultCount = state.searchClientResponseItems.length;
|
|
6960
|
+
this.handleAdRendered();
|
|
6961
|
+
this.startIntersectionObserver();
|
|
6962
|
+
}
|
|
6916
6963
|
connectedCallback() {
|
|
6917
6964
|
const currentState = searchcraftStore.getState();
|
|
6965
|
+
this.isComponentConnected = true;
|
|
6918
6966
|
this.core = currentState.core;
|
|
6919
|
-
this.searchTerm = currentState.searchTerm;
|
|
6920
6967
|
this.isSearchInProgress = currentState.isSearchInProgress;
|
|
6968
|
+
this.searchResultCount = currentState.searchClientResponseItems.length;
|
|
6969
|
+
this.timeTaken = currentState.searchResponseTimeTaken;
|
|
6970
|
+
const request = currentState.searchClientRequest;
|
|
6971
|
+
if (request && typeof request === 'object') {
|
|
6972
|
+
this.searchTerm = request.searchTerm;
|
|
6973
|
+
}
|
|
6974
|
+
/**
|
|
6975
|
+
* Interstial ads have a different lifecycle, where we need handle an incoming search
|
|
6976
|
+
* request immediately, because they are rendered alongside the search results.
|
|
6977
|
+
*/
|
|
6978
|
+
if (this.renderPosition === 'interstitial') {
|
|
6979
|
+
this.handleNewIncomingSearchRequest(currentState);
|
|
6980
|
+
}
|
|
6921
6981
|
// Subscribes to store changes (for search term).
|
|
6922
6982
|
this.storeUnsubscribe = searchcraftStore.subscribe((state) => {
|
|
6923
|
-
this.
|
|
6983
|
+
if (this.timeTaken !== state.searchResponseTimeTaken) {
|
|
6984
|
+
this.handleNewIncomingSearchRequest(state);
|
|
6985
|
+
}
|
|
6986
|
+
this.timeTaken = state.searchResponseTimeTaken;
|
|
6924
6987
|
this.isSearchInProgress = state.isSearchInProgress;
|
|
6925
6988
|
});
|
|
6926
6989
|
}
|
|
6927
|
-
|
|
6990
|
+
startIntersectionObserver() {
|
|
6991
|
+
this.intersectionObserver?.disconnect();
|
|
6928
6992
|
/**
|
|
6929
6993
|
* Handles when an ad container is viewable within the document,
|
|
6930
6994
|
* Core emits an ad_container_viewed event and performs ad client side effects
|
|
6931
6995
|
*/
|
|
6932
6996
|
if (this.hostElement) {
|
|
6933
6997
|
this.intersectionObserver = new IntersectionObserver(([entry]) => {
|
|
6934
|
-
if (entry?.isIntersecting &&
|
|
6935
|
-
this.
|
|
6936
|
-
adClientResponseItem: this.adClientResponseItem,
|
|
6937
|
-
adContainerId: this.adContainerId,
|
|
6938
|
-
adSource: this.adSource,
|
|
6939
|
-
searchTerm: this.searchTerm || '',
|
|
6940
|
-
});
|
|
6998
|
+
if (entry?.isIntersecting && this.searchResultCount > 0) {
|
|
6999
|
+
this.handleAdViewed();
|
|
6941
7000
|
}
|
|
6942
7001
|
}, { threshold: 0 });
|
|
6943
7002
|
this.intersectionObserver.observe(this.hostElement);
|
|
@@ -6977,26 +7036,10 @@ class SearchcraftPopoverListItemAd {
|
|
|
6977
7036
|
return (hAsync("div", { id: `searchcraft-native-ad-${this.adContainerId}`, class: classNames('searchcraft-ad', nativoClassName), "data-searchcraft-ad-container-id": this.adContainerId }));
|
|
6978
7037
|
}
|
|
6979
7038
|
render() {
|
|
6980
|
-
// Don't render ads
|
|
6981
|
-
if (this.
|
|
7039
|
+
// Don't render ads if no search results
|
|
7040
|
+
if (this.searchResultCount === 0) {
|
|
6982
7041
|
return;
|
|
6983
7042
|
}
|
|
6984
|
-
/**
|
|
6985
|
-
* Handles when an ad container is first rendered.
|
|
6986
|
-
* Core emits an ad_container_rendered event and performs ad client side effects
|
|
6987
|
-
*
|
|
6988
|
-
*/
|
|
6989
|
-
if (this.isComponentConnected) {
|
|
6990
|
-
clearTimeout(this.adContainerRenderedTimeout);
|
|
6991
|
-
this.adContainerRenderedTimeout = setTimeout(() => {
|
|
6992
|
-
this.core?.handleAdContainerRendered({
|
|
6993
|
-
adClientResponseItem: this.adClientResponseItem,
|
|
6994
|
-
adContainerId: this.adContainerId,
|
|
6995
|
-
adSource: this.adSource,
|
|
6996
|
-
searchTerm: this.searchTerm || '',
|
|
6997
|
-
});
|
|
6998
|
-
}, this.core?.config?.adContainerRenderedDebounceDelay || 500);
|
|
6999
|
-
}
|
|
7000
7043
|
switch (this.adSource) {
|
|
7001
7044
|
case 'adMarketplace':
|
|
7002
7045
|
return this.renderADMAd();
|
|
@@ -7014,9 +7057,11 @@ class SearchcraftPopoverListItemAd {
|
|
|
7014
7057
|
"$members$": {
|
|
7015
7058
|
"adSource": [1, "ad-source"],
|
|
7016
7059
|
"adClientResponseItem": [16],
|
|
7017
|
-
"
|
|
7060
|
+
"renderPosition": [1, "render-position"],
|
|
7018
7061
|
"searchTerm": [32],
|
|
7019
|
-
"isSearchInProgress": [32]
|
|
7062
|
+
"isSearchInProgress": [32],
|
|
7063
|
+
"searchResultCount": [32],
|
|
7064
|
+
"adContainerId": [32]
|
|
7020
7065
|
},
|
|
7021
7066
|
"$listeners$": undefined,
|
|
7022
7067
|
"$lazyBundleId$": "-",
|
|
@@ -7053,7 +7098,7 @@ class SearchcraftPopoverListView {
|
|
|
7053
7098
|
searchResultsPerPage;
|
|
7054
7099
|
config = searchcraftStore.getState().core?.config;
|
|
7055
7100
|
renderWithADMAds() {
|
|
7056
|
-
return (hAsync("div", { class: 'searchcraft-popover-list-view' }, this.adClientResponseItems?.map((item) => (hAsync("searchcraft-ad", { adClientResponseItem: item,
|
|
7101
|
+
return (hAsync("div", { class: 'searchcraft-popover-list-view' }, this.adClientResponseItems?.map((item) => (hAsync("searchcraft-ad", { adClientResponseItem: item, adSource: 'adMarketplace', key: item.id, renderPosition: 'top' }))), this.searchClientResponseItems?.map((item, index) => (hAsync("searchcraft-popover-list-item", { item: item, key: item.id, popoverResultMappings: this.popoverResultMappings, documentPosition: this.searchResultsPerPage * (this.searchResultsPage - 1) + index })))));
|
|
7057
7102
|
}
|
|
7058
7103
|
renderWithCustomAds() {
|
|
7059
7104
|
const itemsToRender = [];
|
|
@@ -7064,7 +7109,7 @@ class SearchcraftPopoverListView {
|
|
|
7064
7109
|
const searchItems = this.searchClientResponseItems || [];
|
|
7065
7110
|
// Renders ads at beginning
|
|
7066
7111
|
for (let n = 0; n < adStartQuantity; n++) {
|
|
7067
|
-
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Custom',
|
|
7112
|
+
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Custom', key: `${n}-ad`, renderPosition: 'top' }));
|
|
7068
7113
|
}
|
|
7069
7114
|
// Renders search results + interstitial ads
|
|
7070
7115
|
searchItems.forEach((item, index) => {
|
|
@@ -7073,14 +7118,14 @@ class SearchcraftPopoverListView {
|
|
|
7073
7118
|
index + interstitialInterval < searchItems.length &&
|
|
7074
7119
|
index >= interstitialInterval) {
|
|
7075
7120
|
for (let n = 0; n < interstitialQuantity; n++) {
|
|
7076
|
-
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Custom',
|
|
7121
|
+
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Custom', key: `${item.id}-ad-${n}`, renderPosition: 'interstitial' }));
|
|
7077
7122
|
}
|
|
7078
7123
|
}
|
|
7079
7124
|
itemsToRender.push(hAsync("searchcraft-popover-list-item", { item: item, key: item.id, popoverResultMappings: this.popoverResultMappings, documentPosition: this.searchResultsPerPage * (this.searchResultsPage - 1) + index }));
|
|
7080
7125
|
});
|
|
7081
7126
|
// Renders ads at end
|
|
7082
7127
|
for (let n = 0; n < adEndQuantity; n++) {
|
|
7083
|
-
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Custom',
|
|
7128
|
+
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Custom', key: `${n}-ad`, renderPosition: 'bottom' }));
|
|
7084
7129
|
}
|
|
7085
7130
|
return hAsync("div", { class: 'searchcraft-popover-list-view' }, itemsToRender);
|
|
7086
7131
|
}
|
|
@@ -7094,7 +7139,7 @@ class SearchcraftPopoverListView {
|
|
|
7094
7139
|
const searchItems = this.searchClientResponseItems || [];
|
|
7095
7140
|
// Renders ads at beginning
|
|
7096
7141
|
for (let n = 0; n < adStartQuantity; n++) {
|
|
7097
|
-
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Nativo',
|
|
7142
|
+
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Nativo', key: `${n}-ad`, renderPosition: 'top' }));
|
|
7098
7143
|
}
|
|
7099
7144
|
// Renders search results + interstitial ads
|
|
7100
7145
|
searchItems.forEach((item, index) => {
|
|
@@ -7103,14 +7148,14 @@ class SearchcraftPopoverListView {
|
|
|
7103
7148
|
index + interstitialInterval < searchItems.length &&
|
|
7104
7149
|
index >= interstitialInterval) {
|
|
7105
7150
|
for (let n = 0; n < interstitialQuantity; n++) {
|
|
7106
|
-
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Nativo',
|
|
7151
|
+
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Nativo', key: `${item.id}-ad-${n}`, renderPosition: 'interstitial' }));
|
|
7107
7152
|
}
|
|
7108
7153
|
}
|
|
7109
7154
|
itemsToRender.push(hAsync("searchcraft-popover-list-item", { item: item, key: item.id, popoverResultMappings: this.popoverResultMappings, documentPosition: this.searchResultsPerPage * (this.searchResultsPage - 1) + index }));
|
|
7110
7155
|
});
|
|
7111
7156
|
// Renders ads at end
|
|
7112
7157
|
for (let n = 0; n < adEndQuantity; n++) {
|
|
7113
|
-
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Nativo',
|
|
7158
|
+
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Nativo', key: `${n}-ad`, renderPosition: 'bottom' }));
|
|
7114
7159
|
}
|
|
7115
7160
|
return hAsync("div", { class: 'searchcraft-popover-list-view' }, itemsToRender);
|
|
7116
7161
|
}
|
|
@@ -7467,7 +7512,7 @@ class SearchcraftSearchResults {
|
|
|
7467
7512
|
: this.initialSearchClientResponseItems?.length
|
|
7468
7513
|
? this.initialSearchClientResponseItems
|
|
7469
7514
|
: [];
|
|
7470
|
-
return (hAsync("div", { class: 'searchcraft-search-results' }, this.adClientResponseItems?.map((item) => (hAsync("searchcraft-ad", { adSource: 'adMarketplace', adClientResponseItem: item,
|
|
7515
|
+
return (hAsync("div", { class: 'searchcraft-search-results' }, this.adClientResponseItems?.map((item) => (hAsync("searchcraft-ad", { adSource: 'adMarketplace', adClientResponseItem: item, key: item.id, renderPosition: 'top' }))), items.map((item, index) => (hAsync("searchcraft-search-result", { key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template })))));
|
|
7471
7516
|
}
|
|
7472
7517
|
renderWithCustomAds() {
|
|
7473
7518
|
const itemsToRender = [];
|
|
@@ -7482,7 +7527,7 @@ class SearchcraftSearchResults {
|
|
|
7482
7527
|
: [];
|
|
7483
7528
|
// Renders ads at beginning
|
|
7484
7529
|
for (let n = 0; n < adStartQuantity; n++) {
|
|
7485
|
-
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Custom',
|
|
7530
|
+
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Custom', key: `${n}-ad`, renderPosition: 'top' }));
|
|
7486
7531
|
}
|
|
7487
7532
|
// Renders search results + interstitial ads
|
|
7488
7533
|
items.forEach((item, index) => {
|
|
@@ -7491,14 +7536,14 @@ class SearchcraftSearchResults {
|
|
|
7491
7536
|
index + interstitialInterval < items.length &&
|
|
7492
7537
|
index >= interstitialInterval) {
|
|
7493
7538
|
for (let n = 0; n < interstitialQuantity; n++) {
|
|
7494
|
-
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Custom',
|
|
7539
|
+
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Custom', key: `${item.id}-ad-${n}`, renderPosition: 'interstitial' }));
|
|
7495
7540
|
}
|
|
7496
7541
|
}
|
|
7497
7542
|
itemsToRender.push(hAsync("searchcraft-search-result", { key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template }));
|
|
7498
7543
|
});
|
|
7499
7544
|
// Renders ads at end
|
|
7500
7545
|
for (let n = 0; n < adEndQuantity; n++) {
|
|
7501
|
-
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Custom',
|
|
7546
|
+
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Custom', key: `${n}-ad`, renderPosition: 'bottom' }));
|
|
7502
7547
|
}
|
|
7503
7548
|
return hAsync("div", { class: 'searchcraft-search-results' }, itemsToRender);
|
|
7504
7549
|
}
|
|
@@ -7516,7 +7561,7 @@ class SearchcraftSearchResults {
|
|
|
7516
7561
|
: [];
|
|
7517
7562
|
// Renders ads at beginning
|
|
7518
7563
|
for (let n = 0; n < adStartQuantity; n++) {
|
|
7519
|
-
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Nativo',
|
|
7564
|
+
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Nativo', key: `${n}-ad`, renderPosition: 'top' }));
|
|
7520
7565
|
}
|
|
7521
7566
|
// Renders search results + interstitial ads
|
|
7522
7567
|
items.forEach((item, index) => {
|
|
@@ -7525,14 +7570,14 @@ class SearchcraftSearchResults {
|
|
|
7525
7570
|
index + interstitialInterval < items.length &&
|
|
7526
7571
|
index >= interstitialInterval) {
|
|
7527
7572
|
for (let n = 0; n < interstitialQuantity; n++) {
|
|
7528
|
-
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Nativo',
|
|
7573
|
+
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Nativo', key: `${item.id}-ad-${n}`, renderPosition: 'interstitial' }));
|
|
7529
7574
|
}
|
|
7530
7575
|
}
|
|
7531
7576
|
itemsToRender.push(hAsync("searchcraft-search-result", { key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template }));
|
|
7532
7577
|
});
|
|
7533
7578
|
// Renders ads at end
|
|
7534
7579
|
for (let n = 0; n < adEndQuantity; n++) {
|
|
7535
|
-
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Nativo',
|
|
7580
|
+
itemsToRender.push(hAsync("searchcraft-ad", { adSource: 'Nativo', key: `${n}-ad`, renderPosition: 'bottom' }));
|
|
7536
7581
|
}
|
|
7537
7582
|
return hAsync("div", { class: 'searchcraft-search-results' }, itemsToRender);
|
|
7538
7583
|
}
|