@searchcraft/javascript-sdk 0.10.3 → 0.10.4

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.
Files changed (41) hide show
  1. package/dist/components/index.d.ts +1 -1
  2. package/dist/components/index.js +4 -4
  3. package/dist/components/{p-53c795bd.js → p-163402fb.js} +14 -2
  4. package/dist/components/p-163402fb.js.map +1 -0
  5. package/dist/components/{p-508ee769.js → p-2d975f19.js} +2 -2
  6. package/dist/components/{p-508ee769.js.map → p-2d975f19.js.map} +1 -1
  7. package/dist/components/{p-ad569b01.js → p-35ee16e2.js} +2 -2
  8. package/dist/components/{p-ad569b01.js.map → p-35ee16e2.js.map} +1 -1
  9. package/dist/components/{p-da1fb5c0.js → p-4c610bc4.js} +2 -2
  10. package/dist/components/{p-da1fb5c0.js.map → p-4c610bc4.js.map} +1 -1
  11. package/dist/components/{p-5a4be632.js → p-6065aee1.js} +2 -2
  12. package/dist/components/{p-5a4be632.js.map → p-6065aee1.js.map} +1 -1
  13. package/dist/components/{p-d4558d44.js → p-60fd824d.js} +69 -68
  14. package/dist/components/p-60fd824d.js.map +1 -0
  15. package/dist/components/{p-fd564261.js → p-6ed5cca1.js} +4 -4
  16. package/dist/components/{p-fd564261.js.map → p-6ed5cca1.js.map} +1 -1
  17. package/dist/components/{p-6717ab82.js → p-9d2e55a7.js} +2 -2
  18. package/dist/components/{p-6717ab82.js.map → p-9d2e55a7.js.map} +1 -1
  19. package/dist/components/{p-06bac1fc.js → p-eb633481.js} +2 -2
  20. package/dist/components/{p-06bac1fc.js.map → p-eb633481.js.map} +1 -1
  21. package/dist/components/searchcraft-ad.js +1 -1
  22. package/dist/components/searchcraft-facet-list.js +1 -1
  23. package/dist/components/searchcraft-filter-panel.js +3 -3
  24. package/dist/components/searchcraft-input-form.js +1 -1
  25. package/dist/components/searchcraft-pagination.js +1 -1
  26. package/dist/components/searchcraft-popover-button.js +1 -1
  27. package/dist/components/searchcraft-popover-footer.js +1 -1
  28. package/dist/components/searchcraft-popover-form.js +6 -6
  29. package/dist/components/searchcraft-popover-list-item.js +1 -1
  30. package/dist/components/searchcraft-popover-list-view.js +1 -1
  31. package/dist/components/searchcraft-results-info.js +1 -1
  32. package/dist/components/searchcraft-search-result.js +1 -1
  33. package/dist/components/searchcraft-search-results-per-page.js +1 -1
  34. package/dist/components/searchcraft-search-results.js +3 -3
  35. package/dist/components/searchcraft-toggle-button.js +1 -1
  36. package/dist/hydrate/index.js +63 -51
  37. package/dist/hydrate/index.mjs +63 -51
  38. package/dist/types/store/SearchcraftStore.types.d.ts +1 -1
  39. package/package.json +3 -3
  40. package/dist/components/p-53c795bd.js.map +0 -1
  41. package/dist/components/p-d4558d44.js.map +0 -1
@@ -44,25 +44,25 @@ function w(a, e, n, r) {
44
44
  return new (n || (n = Promise))(function(i, o) {
45
45
  function t(c) {
46
46
  try {
47
- h(r.next(c));
47
+ d(r.next(c));
48
48
  } catch (s) {
49
49
  o(s);
50
50
  }
51
51
  }
52
52
  function u(c) {
53
53
  try {
54
- h(r.throw(c));
54
+ d(r.throw(c));
55
55
  } catch (s) {
56
56
  o(s);
57
57
  }
58
58
  }
59
- function h(c) {
59
+ function d(c) {
60
60
  var s;
61
61
  c.done ? i(c.value) : (s = c.value, s instanceof n ? s : new n(function(p) {
62
62
  p(s);
63
63
  })).then(t, u);
64
64
  }
65
- h((r = r.apply(a, [])).next());
65
+ d((r = r.apply(a, [])).next());
66
66
  });
67
67
  }
68
68
  function y(a, e) {
@@ -73,7 +73,7 @@ function y(a, e) {
73
73
  return o = { next: u(0), throw: u(1), return: u(2) }, typeof Symbol == "function" && (o[Symbol.iterator] = function() {
74
74
  return this;
75
75
  }), o;
76
- function u(h) {
76
+ function u(d) {
77
77
  return function(c) {
78
78
  return function(s) {
79
79
  if (n) throw new TypeError("Generator is already executing.");
@@ -120,7 +120,7 @@ function y(a, e) {
120
120
  }
121
121
  if (5 & s[0]) throw s[1];
122
122
  return { value: s[0] ? s[1] : void 0, done: !0 };
123
- }([h, c]);
123
+ }([d, c]);
124
124
  };
125
125
  }
126
126
  }
@@ -146,13 +146,13 @@ function I(a, e) {
146
146
  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");
147
147
  var r = new Uint32Array([e, e, e, e]);
148
148
  ((function(o, t) {
149
- for (var u = o.byteLength / 16 | 0, h = new Uint32Array(o, 0, 4 * u), c = 0; c < u; c++) {
150
- var s = h.subarray(4 * c, 4 * (c + 1));
149
+ for (var u = o.byteLength / 16 | 0, d = new Uint32Array(o, 0, 4 * u), c = 0; c < u; c++) {
150
+ var s = d.subarray(4 * c, 4 * (c + 1));
151
151
  s[0] = Math.imul(s[0], m[0]), s[0] = g(s[0], 15), s[0] = Math.imul(s[0], m[1]), t[0] = t[0] ^ s[0], t[0] = g(t[0], 19), t[0] = t[0] + t[1], t[0] = Math.imul(t[0], 5) + 1444728091, s[1] = Math.imul(s[1], m[1]), s[1] = g(s[1], 16), s[1] = Math.imul(s[1], m[2]), t[1] = t[1] ^ s[1], t[1] = g(t[1], 17), t[1] = t[1] + t[2], t[1] = Math.imul(t[1], 5) + 197830471, s[2] = Math.imul(s[2], m[2]), s[2] = g(s[2], 17), s[2] = Math.imul(s[2], m[3]), t[2] = t[2] ^ s[2], t[2] = g(t[2], 15), t[2] = t[2] + t[3], t[2] = Math.imul(t[2], 5) + 2530024501, s[3] = Math.imul(s[3], m[3]), s[3] = g(s[3], 18), s[3] = Math.imul(s[3], m[0]), t[3] = t[3] ^ s[3], t[3] = g(t[3], 13), t[3] = t[3] + t[0], t[3] = Math.imul(t[3], 5) + 850148119;
152
152
  }
153
153
  }))(a, r), function(o, t) {
154
- var u = o.byteLength / 16 | 0, h = o.byteLength % 16, c = new Uint32Array(4), s = new Uint8Array(o, 16 * u, h);
155
- switch (h) {
154
+ var u = o.byteLength / 16 | 0, d = o.byteLength % 16, c = new Uint32Array(4), s = new Uint8Array(o, 16 * u, d);
155
+ switch (d) {
156
156
  case 15:
157
157
  c[3] = c[3] ^ s[14] << 16;
158
158
  case 14:
@@ -231,8 +231,8 @@ function U(a, e) {
231
231
  var t = a[o];
232
232
  if (typeof t != "object" || Array.isArray(t)) e.includes(o) || (n[o] = t);
233
233
  else {
234
- var u = U(t, e.map(function(h) {
235
- return h.startsWith(o + ".") ? h.slice(o.length + 1) : h;
234
+ var u = U(t, e.map(function(d) {
235
+ return d.startsWith(o + ".") ? d.slice(o.length + 1) : d;
236
236
  }));
237
237
  Object.keys(u).length > 0 && (n[o] = u);
238
238
  }
@@ -294,11 +294,11 @@ v("audio", function() {
294
294
  var r = new (window.OfflineAudioContext || window.webkitOfflineAudioContext)(1, 5e3, 44100), i = r.createBufferSource(), o = r.createOscillator();
295
295
  o.frequency.value = 1e3;
296
296
  var t, u = r.createDynamicsCompressor();
297
- u.threshold.value = -50, u.knee.value = 40, u.ratio.value = 12, u.attack.value = 0, u.release.value = 0.2, o.connect(u), u.connect(r.destination), o.start(), r.oncomplete = function(h) {
298
- t = h.renderedBuffer.getChannelData(0), e({ sampleHash: H(t), oscillator: o.type, maxChannels: r.destination.maxChannelCount, channelCountMode: i.channelCountMode });
297
+ u.threshold.value = -50, u.knee.value = 40, u.ratio.value = 12, u.attack.value = 0, u.release.value = 0.2, o.connect(u), u.connect(r.destination), o.start(), r.oncomplete = function(d) {
298
+ t = d.renderedBuffer.getChannelData(0), e({ sampleHash: H(t), oscillator: o.type, maxChannels: r.destination.maxChannelCount, channelCountMode: i.channelCountMode });
299
299
  }, r.startRendering();
300
- } catch (h) {
301
- console.error("Error creating audio fingerprint:", h), n(h);
300
+ } catch (d) {
301
+ console.error("Error creating audio fingerprint:", d), n(d);
302
302
  }
303
303
  })];
304
304
  });
@@ -335,8 +335,8 @@ function Y() {
335
335
  if (!i.length || !r.length) {
336
336
  var t = n.getExtension("WEBGL_debug_renderer_info");
337
337
  if (t) {
338
- var u = (n.getParameter(t.UNMASKED_VENDOR_WEBGL) || "").toString(), h = (n.getParameter(t.UNMASKED_RENDERER_WEBGL) || "").toString();
339
- u && (o.vendorUnmasked = u), h && (o.rendererUnmasked = h);
338
+ var u = (n.getParameter(t.UNMASKED_VENDOR_WEBGL) || "").toString(), d = (n.getParameter(t.UNMASKED_RENDERER_WEBGL) || "").toString();
339
+ u && (o.vendorUnmasked = u), d && (o.rendererUnmasked = d);
340
340
  }
341
341
  }
342
342
  return o;
@@ -358,9 +358,9 @@ function ee(a, e) {
358
358
  var s = String(c);
359
359
  t[s] = (t[s] || 0) + 1;
360
360
  });
361
- var u = o[0], h = 1;
361
+ var u = o[0], d = 1;
362
362
  return Object.keys(t).forEach(function(c) {
363
- t[c] > h && (u = c, h = t[c]);
363
+ t[c] > d && (u = c, d = t[c]);
364
364
  }), u;
365
365
  }(a.map(function(o) {
366
366
  return r in o ? o[r] : void 0;
@@ -394,14 +394,14 @@ C().name != "Firefox" && v("fonts", function() {
394
394
  var i;
395
395
  w(this, void 0, void 0, function() {
396
396
  var o, t, u;
397
- return y(this, function(h) {
398
- switch (h.label) {
397
+ return y(this, function(d) {
398
+ switch (d.label) {
399
399
  case 0:
400
400
  return document.body ? [3, 2] : [4, (c = 50, new Promise(function(p) {
401
401
  return setTimeout(p, c, s);
402
402
  }))];
403
403
  case 1:
404
- return h.sent(), [3, 0];
404
+ return d.sent(), [3, 0];
405
405
  case 2:
406
406
  if ((o = document.createElement("iframe")).setAttribute("frameBorder", "0"), (t = o.style).setProperty("position", "fixed"), t.setProperty("display", "block", "important"), t.setProperty("visibility", "visible"), t.setProperty("border", "0"), t.setProperty("opacity", "0"), o.src = "about:blank", document.body.appendChild(o), !(u = o.contentDocument || ((i = o.contentWindow) === null || i === void 0 ? void 0 : i.document))) throw new Error("Iframe document is not accessible");
407
407
  return r({ iframe: u }), setTimeout(function() {
@@ -414,14 +414,14 @@ C().name != "Firefox" && v("fonts", function() {
414
414
  })(function(r) {
415
415
  var i = r.iframe;
416
416
  return w(a, void 0, void 0, function() {
417
- var o, t, u, h;
417
+ var o, t, u, d;
418
418
  return y(this, function(c) {
419
419
  return o = i.createElement("canvas"), t = o.getContext("2d"), u = J.map(function(s) {
420
420
  return F(t, s);
421
- }), h = {}, X.forEach(function(s) {
421
+ }), d = {}, X.forEach(function(s) {
422
422
  var p = F(t, s);
423
- u.includes(p) || (h[s] = p);
424
- }), e(h), [2];
423
+ u.includes(p) || (d[s] = p);
424
+ }), e(d), [2];
425
425
  });
426
426
  });
427
427
  });
@@ -491,18 +491,18 @@ C().name != "Firefox" && v("fonts", function() {
491
491
  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() });
492
492
  });
493
493
  });
494
- var f, re = C().name !== "SamsungBrowser" ? 1 : 3, d = null;
494
+ var f, re = C().name !== "SamsungBrowser" ? 1 : 3, h = null;
495
495
  v("webgl", function() {
496
496
  return w(this, void 0, void 0, function() {
497
497
  var a;
498
498
  return y(this, function(e) {
499
- typeof document < "u" && ((f = document.createElement("canvas")).width = 200, f.height = 100, d = f.getContext("webgl"));
499
+ typeof document < "u" && ((f = document.createElement("canvas")).width = 200, f.height = 100, h = f.getContext("webgl"));
500
500
  try {
501
- if (!d) throw new Error("WebGL not supported");
501
+ if (!h) throw new Error("WebGL not supported");
502
502
  return a = Array.from({ length: re }, function() {
503
503
  return function() {
504
504
  try {
505
- if (!d) throw new Error("WebGL not supported");
505
+ if (!h) throw new Error("WebGL not supported");
506
506
  var n = `
507
507
  attribute vec2 position;
508
508
  void main() {
@@ -513,28 +513,28 @@ v("webgl", function() {
513
513
  void main() {
514
514
  gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color
515
515
  }
516
- `, i = d.createShader(d.VERTEX_SHADER), o = d.createShader(d.FRAGMENT_SHADER);
516
+ `, i = h.createShader(h.VERTEX_SHADER), o = h.createShader(h.FRAGMENT_SHADER);
517
517
  if (!i || !o) throw new Error("Failed to create shaders");
518
- if (d.shaderSource(i, n), d.shaderSource(o, r), d.compileShader(i), !d.getShaderParameter(i, d.COMPILE_STATUS)) throw new Error("Vertex shader compilation failed: " + d.getShaderInfoLog(i));
519
- if (d.compileShader(o), !d.getShaderParameter(o, d.COMPILE_STATUS)) throw new Error("Fragment shader compilation failed: " + d.getShaderInfoLog(o));
520
- var t = d.createProgram();
518
+ if (h.shaderSource(i, n), h.shaderSource(o, r), h.compileShader(i), !h.getShaderParameter(i, h.COMPILE_STATUS)) throw new Error("Vertex shader compilation failed: " + h.getShaderInfoLog(i));
519
+ if (h.compileShader(o), !h.getShaderParameter(o, h.COMPILE_STATUS)) throw new Error("Fragment shader compilation failed: " + h.getShaderInfoLog(o));
520
+ var t = h.createProgram();
521
521
  if (!t) throw new Error("Failed to create shader program");
522
- if (d.attachShader(t, i), d.attachShader(t, o), d.linkProgram(t), !d.getProgramParameter(t, d.LINK_STATUS)) throw new Error("Shader program linking failed: " + d.getProgramInfoLog(t));
523
- d.useProgram(t);
524
- for (var u = 137, h = new Float32Array(4 * u), c = 2 * Math.PI / u, s = 0; s < u; s++) {
522
+ if (h.attachShader(t, i), h.attachShader(t, o), h.linkProgram(t), !h.getProgramParameter(t, h.LINK_STATUS)) throw new Error("Shader program linking failed: " + h.getProgramInfoLog(t));
523
+ h.useProgram(t);
524
+ for (var u = 137, d = new Float32Array(4 * u), c = 2 * Math.PI / u, s = 0; s < u; s++) {
525
525
  var p = s * c;
526
- h[4 * s] = 0, h[4 * s + 1] = 0, h[4 * s + 2] = Math.cos(p) * (f.width / 2), h[4 * s + 3] = Math.sin(p) * (f.height / 2);
526
+ d[4 * s] = 0, d[4 * s + 1] = 0, d[4 * s + 2] = Math.cos(p) * (f.width / 2), d[4 * s + 3] = Math.sin(p) * (f.height / 2);
527
527
  }
528
- var q = d.createBuffer();
529
- d.bindBuffer(d.ARRAY_BUFFER, q), d.bufferData(d.ARRAY_BUFFER, h, d.STATIC_DRAW);
530
- var R = d.getAttribLocation(t, "position");
531
- d.enableVertexAttribArray(R), d.vertexAttribPointer(R, 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);
528
+ var q = h.createBuffer();
529
+ h.bindBuffer(h.ARRAY_BUFFER, q), h.bufferData(h.ARRAY_BUFFER, d, h.STATIC_DRAW);
530
+ var R = h.getAttribLocation(t, "position");
531
+ h.enableVertexAttribArray(R), h.vertexAttribPointer(R, 2, h.FLOAT, !1, 0, 0), h.viewport(0, 0, f.width, f.height), h.clearColor(0, 0, 0, 1), h.clear(h.COLOR_BUFFER_BIT), h.drawArrays(h.LINES, 0, 2 * u);
532
532
  var x = new Uint8ClampedArray(f.width * f.height * 4);
533
- return d.readPixels(0, 0, f.width, f.height, d.RGBA, d.UNSIGNED_BYTE, x), new ImageData(x, f.width, f.height);
533
+ return h.readPixels(0, 0, f.width, f.height, h.RGBA, h.UNSIGNED_BYTE, x), new ImageData(x, f.width, f.height);
534
534
  } catch {
535
535
  return new ImageData(1, 1);
536
536
  } finally {
537
- d && (d.bindBuffer(d.ARRAY_BUFFER, null), d.useProgram(null), d.viewport(0, 0, d.drawingBufferWidth, d.drawingBufferHeight), d.clearColor(0, 0, 0, 0));
537
+ h && (h.bindBuffer(h.ARRAY_BUFFER, null), h.useProgram(null), h.viewport(0, 0, h.drawingBufferWidth, h.drawingBufferHeight), h.clearColor(0, 0, 0, 0));
538
538
  }
539
539
  }();
540
540
  }), [2, { commonImageHash: I(L(a, f.width, f.height).data.toString()).toString() }];
@@ -792,7 +792,7 @@ class me {
792
792
  * @returns
793
793
  */
794
794
  l(this, "getSearchResponseItems", async (e) => {
795
- var i, o, t, u, h;
795
+ var i, o, t, u, d;
796
796
  let n;
797
797
  const r = typeof e == "string" ? e : e.searchTerm;
798
798
  try {
@@ -821,7 +821,7 @@ class me {
821
821
  }
822
822
  }), (((u = n.data.hits) == null ? void 0 : u.length) || 0) === 0 && this.parent.emitEvent("no_results_returned", {
823
823
  name: "no_results_returned"
824
- }), (h = this.parent.adClient) == null || h.onQueryFetched(
824
+ }), (d = this.parent.adClient) == null || d.onQueryFetched(
825
825
  typeof e == "string" ? { searchTerm: r, mode: "exact" } : e,
826
826
  n
827
827
  ), n;
@@ -903,34 +903,35 @@ class me {
903
903
  */
904
904
  formatParamsForRequest(e) {
905
905
  const n = [];
906
- e.facetPathsForIndexFields && Object.keys(e.facetPathsForIndexFields).forEach((o) => {
907
- var u;
908
- const t = (u = e.facetPathsForIndexFields) == null ? void 0 : u[o];
909
- t && n.push({
906
+ let r = "should";
907
+ e.facetPathsForIndexFields && Object.keys(e.facetPathsForIndexFields).forEach((t) => {
908
+ var d;
909
+ const u = (d = e.facetPathsForIndexFields) == null ? void 0 : d[t];
910
+ u && (r = "must", n.push({
910
911
  occur: "must",
911
912
  exact: {
912
- ctx: _(t.value)
913
+ ctx: _(u.value)
913
914
  }
914
- });
915
- }), e.rangeValueForIndexFields && Object.keys(e.rangeValueForIndexFields).forEach((o) => {
916
- var u;
917
- const t = (u = e.rangeValueForIndexFields) == null ? void 0 : u[o];
918
- t && n.push({
915
+ }));
916
+ }), e.rangeValueForIndexFields && Object.keys(e.rangeValueForIndexFields).forEach((t) => {
917
+ var d;
918
+ const u = (d = e.rangeValueForIndexFields) == null ? void 0 : d[t];
919
+ u && (r = "must", n.push({
919
920
  occur: "must",
920
921
  exact: {
921
- ctx: _(t.value)
922
+ ctx: _(u.value)
922
923
  }
923
- });
924
+ }));
924
925
  });
925
- const r = _(e.searchTerm), i = e.mode === "fuzzy" ? { fuzzy: { ctx: r } } : {
926
+ const i = _(e.searchTerm), o = e.mode === "fuzzy" ? { fuzzy: { ctx: i } } : {
926
927
  exact: {
927
- ctx: `${r.startsWith('"') ? r : `"${r}"`}`
928
+ ctx: `${i.startsWith('"') ? i : `"${i}"`}`
928
929
  }
929
930
  };
930
931
  return n.push({
931
- occur: e.mode === "exact" ? "must" : "should",
932
+ occur: e.mode === "exact" ? "must" : r,
932
933
  // Valid, as 'occur' is a required property in SearchClientQuery
933
- ...i
934
+ ...o
934
935
  }), n;
935
936
  }
936
937
  }
@@ -950,10 +951,10 @@ class ve {
950
951
  const o = await ((u = this == null ? void 0 : this.searchClient) == null ? void 0 : u.getSearchResponseItems(e));
951
952
  if (!o)
952
953
  throw new Error("Search client was not initialized.");
953
- const t = (o.data.hits || []).filter((h) => !!h.doc).map((h) => ({
954
+ const t = (o.data.hits || []).filter((d) => !!d.doc).map((d) => ({
954
955
  id: E(),
955
- document: h.doc || { id: -1 },
956
- source_index: h.source_index,
956
+ document: d.doc || { id: -1 },
957
+ source_index: d.source_index,
957
958
  type: "SearchDocument"
958
959
  }));
959
960
  n(o, t);
@@ -1821,7 +1822,7 @@ const searchcraftStore = zustand.createStore((_set, get) => {
1821
1822
  // Reset to first page when response count changes
1822
1823
  count === state.searchResultsCount ? state.searchResultsPage : 1,
1823
1824
  searchResultsCount: count,
1824
- ...(facets && { searchResponseFacetPrime: facets }),
1825
+ searchResponseFacetPrime: facets,
1825
1826
  };
1826
1827
  });
1827
1828
  state.logger?.log(O.DEBUG, `Search results: ${JSON.stringify(items)}`);
@@ -1901,4 +1902,4 @@ const searchcraftStore = zustand.createStore((_set, get) => {
1901
1902
 
1902
1903
  export { searchcraftStore as s, ve as v };
1903
1904
 
1904
- //# sourceMappingURL=p-d4558d44.js.map
1905
+ //# sourceMappingURL=p-60fd824d.js.map