@nosto/nosto-react 2.0.0 → 2.1.0

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/index.es.js CHANGED
@@ -1,56 +1,53 @@
1
- import M, { useEffect as se, useRef as oe, useMemo as Et, createContext as Rt, useContext as _t, isValidElement as bt } from "react";
2
- import { createRoot as wt } from "react-dom/client";
3
- const De = (r) => String(r) === "[object Object]";
4
- function Fe(r) {
5
- if (!De(r))
1
+ import Ne, { useEffect as ie, useRef as ne, useMemo as hr, createContext as Er, useContext as Rr, cloneElement as wr, useState as br, isValidElement as _r } from "react";
2
+ import { createRoot as Cr } from "react-dom/client";
3
+ const Ae = (t) => String(t) === "[object Object]";
4
+ function De(t) {
5
+ if (!Ae(t))
6
6
  return !1;
7
- const o = r.constructor;
8
- if (o === void 0)
7
+ const n = t.constructor;
8
+ if (n === void 0)
9
9
  return !0;
10
- const a = o.prototype;
11
- return !(!De(a) || !a.hasOwnProperty("isPrototypeOf"));
10
+ const a = n.prototype;
11
+ return !(!Ae(a) || !a.hasOwnProperty("isPrototypeOf"));
12
12
  }
13
- function ae(r, o) {
14
- if (r === o)
13
+ function oe(t, n) {
14
+ if (t === n)
15
15
  return !0;
16
- if (r instanceof Date && o instanceof Date)
17
- return r.getTime() === o.getTime();
18
- if (r instanceof Array && o instanceof Array)
19
- return r.length !== o.length ? !1 : r.every((a, s) => ae(a, o[s]));
20
- if (Fe(r) && Fe(o)) {
21
- const a = Object.entries(r);
22
- return a.length !== Object.keys(o).length ? !1 : a.every(([s, d]) => ae(d, o[s]));
16
+ if (t instanceof Date && n instanceof Date)
17
+ return t.getTime() === n.getTime();
18
+ if (t instanceof Array && n instanceof Array)
19
+ return t.length !== n.length ? !1 : t.every((a, c) => oe(a, n[c]));
20
+ if (De(t) && De(n)) {
21
+ const a = Object.entries(t);
22
+ return a.length !== Object.keys(n).length ? !1 : a.every(([c, i]) => oe(i, n[c]));
23
23
  }
24
24
  return !1;
25
25
  }
26
- function Ie(r, o) {
27
- return se(r, Ct(o));
26
+ function Ie(t, n) {
27
+ return ie(t, Pr(n));
28
28
  }
29
- function Ct(r) {
30
- const o = oe(r), a = oe(0);
31
- return ae(r, o.current) || (o.current = r, a.current += 1), Et(() => o.current, [a.current]);
29
+ function Pr(t) {
30
+ const n = ne(t), a = ne(0);
31
+ return oe(t, n.current) || (n.current = t, a.current += 1), hr(() => n.current, [a.current]);
32
32
  }
33
- const $e = Rt({
33
+ const $e = Er({
34
34
  account: "",
35
35
  currentVariation: "",
36
36
  responseMode: "HTML",
37
37
  clientScriptLoaded: !1
38
38
  });
39
- function ce() {
40
- const r = _t($e);
41
- if (!r)
42
- throw new Error("No nosto context found");
43
- return r;
39
+ function se() {
40
+ return Rr($e);
44
41
  }
45
- function A(r, o, a) {
46
- const { clientScriptLoaded: s, currentVariation: d, responseMode: p } = ce();
47
- (a != null && a.deep ? Ie : se)(() => {
48
- s && window.nostojs((g) => {
49
- g.defaultSession().setVariation(d).setResponseMode(p), r(g);
42
+ function x(t, n, a) {
43
+ const { clientScriptLoaded: c, currentVariation: i, responseMode: m } = se();
44
+ (a != null && a.deep ? Ie : ie)(() => {
45
+ c && window.nostojs((v) => {
46
+ v.defaultSession().setVariation(i).setResponseMode(m), t(v);
50
47
  });
51
- }, [s, d, p, ...o ?? []]);
48
+ }, [c, i, m, ...n ?? []]);
52
49
  }
53
- var ie = { exports: {} }, V = {};
50
+ var ae = { exports: {} }, $ = {};
54
51
  /**
55
52
  * @license React
56
53
  * react-jsx-runtime.production.min.js
@@ -60,25 +57,25 @@ var ie = { exports: {} }, V = {};
60
57
  * This source code is licensed under the MIT license found in the
61
58
  * LICENSE file in the root directory of this source tree.
62
59
  */
63
- var Ne;
64
- function Pt() {
65
- if (Ne)
66
- return V;
67
- Ne = 1;
68
- var r = M, o = Symbol.for("react.element"), a = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, d = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: !0, ref: !0, __self: !0, __source: !0 };
69
- function l(g, y, S) {
70
- var R, C = {}, O = null, D = null;
71
- S !== void 0 && (O = "" + S), y.key !== void 0 && (O = "" + y.key), y.ref !== void 0 && (D = y.ref);
72
- for (R in y)
73
- s.call(y, R) && !p.hasOwnProperty(R) && (C[R] = y[R]);
74
- if (g && g.defaultProps)
75
- for (R in y = g.defaultProps, y)
76
- C[R] === void 0 && (C[R] = y[R]);
77
- return { $$typeof: o, type: g, key: O, ref: D, props: C, _owner: d.current };
60
+ var Fe;
61
+ function Sr() {
62
+ if (Fe)
63
+ return $;
64
+ Fe = 1;
65
+ var t = Ne, n = Symbol.for("react.element"), a = Symbol.for("react.fragment"), c = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, m = { key: !0, ref: !0, __self: !0, __source: !0 };
66
+ function h(v, g, P) {
67
+ var R, f = {}, _ = null, O = null;
68
+ P !== void 0 && (_ = "" + P), g.key !== void 0 && (_ = "" + g.key), g.ref !== void 0 && (O = g.ref);
69
+ for (R in g)
70
+ c.call(g, R) && !m.hasOwnProperty(R) && (f[R] = g[R]);
71
+ if (v && v.defaultProps)
72
+ for (R in g = v.defaultProps, g)
73
+ f[R] === void 0 && (f[R] = g[R]);
74
+ return { $$typeof: n, type: v, key: _, ref: O, props: f, _owner: i.current };
78
75
  }
79
- return V.Fragment = a, V.jsx = l, V.jsxs = l, V;
76
+ return $.Fragment = a, $.jsx = h, $.jsxs = h, $;
80
77
  }
81
- var Y = {};
78
+ var W = {};
82
79
  /**
83
80
  * @license React
84
81
  * react-jsx-runtime.development.js
@@ -89,90 +86,90 @@ var Y = {};
89
86
  * LICENSE file in the root directory of this source tree.
90
87
  */
91
88
  var Le;
92
- function St() {
89
+ function Or() {
93
90
  return Le || (Le = 1, process.env.NODE_ENV !== "production" && function() {
94
- var r = M, o = Symbol.for("react.element"), a = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), p = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), g = Symbol.for("react.context"), y = Symbol.for("react.forward_ref"), S = Symbol.for("react.suspense"), R = Symbol.for("react.suspense_list"), C = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), D = Symbol.for("react.offscreen"), I = Symbol.iterator, v = "@@iterator";
95
- function T(e) {
91
+ var t = Ne, n = Symbol.for("react.element"), a = Symbol.for("react.portal"), c = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), m = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), v = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), R = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), O = Symbol.for("react.offscreen"), D = Symbol.iterator, Y = "@@iterator";
92
+ function U(e) {
96
93
  if (e === null || typeof e != "object")
97
94
  return null;
98
- var t = I && e[I] || e[v];
99
- return typeof t == "function" ? t : null;
95
+ var r = D && e[D] || e[Y];
96
+ return typeof r == "function" ? r : null;
100
97
  }
101
- var b = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
102
- function _(e) {
98
+ var S = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
99
+ function w(e) {
103
100
  {
104
- for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
105
- n[i - 1] = arguments[i];
106
- Ve("error", e, n);
101
+ for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), s = 1; s < r; s++)
102
+ o[s - 1] = arguments[s];
103
+ We("error", e, o);
107
104
  }
108
105
  }
109
- function Ve(e, t, n) {
106
+ function We(e, r, o) {
110
107
  {
111
- var i = b.ReactDebugCurrentFrame, f = i.getStackAddendum();
112
- f !== "" && (t += "%s", n = n.concat([f]));
113
- var m = n.map(function(u) {
114
- return String(u);
108
+ var s = S.ReactDebugCurrentFrame, d = s.getStackAddendum();
109
+ d !== "" && (r += "%s", o = o.concat([d]));
110
+ var p = o.map(function(l) {
111
+ return String(l);
115
112
  });
116
- m.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, m);
113
+ p.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, p);
117
114
  }
118
115
  }
119
- var Ye = !1, Me = !1, Ue = !1, qe = !1, Be = !1, ue;
120
- ue = Symbol.for("react.module.reference");
121
- function ze(e) {
122
- return !!(typeof e == "string" || typeof e == "function" || e === s || e === p || Be || e === d || e === S || e === R || qe || e === D || Ye || Me || Ue || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === C || e.$$typeof === l || e.$$typeof === g || e.$$typeof === y || // This needs to include all possible module reference object
116
+ var Me = !1, Ve = !1, Ye = !1, Ue = !1, qe = !1, ce;
117
+ ce = Symbol.for("react.module.reference");
118
+ function Be(e) {
119
+ return !!(typeof e == "string" || typeof e == "function" || e === c || e === m || qe || e === i || e === P || e === R || Ue || e === O || Me || Ve || Ye || typeof e == "object" && e !== null && (e.$$typeof === _ || e.$$typeof === f || e.$$typeof === h || e.$$typeof === v || e.$$typeof === g || // This needs to include all possible module reference object
123
120
  // types supported by any Flight configuration anywhere since
124
121
  // we don't know which Flight build this will end up being used
125
122
  // with.
126
- e.$$typeof === ue || e.getModuleId !== void 0));
123
+ e.$$typeof === ce || e.getModuleId !== void 0));
127
124
  }
128
- function He(e, t, n) {
129
- var i = e.displayName;
130
- if (i)
131
- return i;
132
- var f = t.displayName || t.name || "";
133
- return f !== "" ? n + "(" + f + ")" : n;
125
+ function ze(e, r, o) {
126
+ var s = e.displayName;
127
+ if (s)
128
+ return s;
129
+ var d = r.displayName || r.name || "";
130
+ return d !== "" ? o + "(" + d + ")" : o;
134
131
  }
135
- function le(e) {
132
+ function ue(e) {
136
133
  return e.displayName || "Context";
137
134
  }
138
- function j(e) {
135
+ function T(e) {
139
136
  if (e == null)
140
137
  return null;
141
- if (typeof e.tag == "number" && _("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
138
+ if (typeof e.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
142
139
  return e.displayName || e.name || null;
143
140
  if (typeof e == "string")
144
141
  return e;
145
142
  switch (e) {
146
- case s:
143
+ case c:
147
144
  return "Fragment";
148
145
  case a:
149
146
  return "Portal";
150
- case p:
147
+ case m:
151
148
  return "Profiler";
152
- case d:
149
+ case i:
153
150
  return "StrictMode";
154
- case S:
151
+ case P:
155
152
  return "Suspense";
156
153
  case R:
157
154
  return "SuspenseList";
158
155
  }
159
156
  if (typeof e == "object")
160
157
  switch (e.$$typeof) {
158
+ case v:
159
+ var r = e;
160
+ return ue(r) + ".Consumer";
161
+ case h:
162
+ var o = e;
163
+ return ue(o._context) + ".Provider";
161
164
  case g:
162
- var t = e;
163
- return le(t) + ".Consumer";
164
- case l:
165
- var n = e;
166
- return le(n._context) + ".Provider";
167
- case y:
168
- return He(e, e.render, "ForwardRef");
169
- case C:
170
- var i = e.displayName || null;
171
- return i !== null ? i : j(e.type) || "Memo";
172
- case O: {
173
- var f = e, m = f._payload, u = f._init;
165
+ return ze(e, e.render, "ForwardRef");
166
+ case f:
167
+ var s = e.displayName || null;
168
+ return s !== null ? s : T(e.type) || "Memo";
169
+ case _: {
170
+ var d = e, p = d._payload, l = d._init;
174
171
  try {
175
- return j(u(m));
172
+ return T(l(p));
176
173
  } catch {
177
174
  return null;
178
175
  }
@@ -180,18 +177,18 @@ function St() {
180
177
  }
181
178
  return null;
182
179
  }
183
- var F = Object.assign, $ = 0, fe, de, me, pe, ve, ge, ye;
184
- function he() {
180
+ var A = Object.assign, N = 0, le, fe, de, me, pe, ve, ge;
181
+ function ye() {
185
182
  }
186
- he.__reactDisabledLog = !0;
187
- function Je() {
183
+ ye.__reactDisabledLog = !0;
184
+ function He() {
188
185
  {
189
- if ($ === 0) {
190
- fe = console.log, de = console.info, me = console.warn, pe = console.error, ve = console.group, ge = console.groupCollapsed, ye = console.groupEnd;
186
+ if (N === 0) {
187
+ le = console.log, fe = console.info, de = console.warn, me = console.error, pe = console.group, ve = console.groupCollapsed, ge = console.groupEnd;
191
188
  var e = {
192
189
  configurable: !0,
193
190
  enumerable: !0,
194
- value: he,
191
+ value: ye,
195
192
  writable: !0
196
193
  };
197
194
  Object.defineProperties(console, {
@@ -204,336 +201,336 @@ function St() {
204
201
  groupEnd: e
205
202
  });
206
203
  }
207
- $++;
204
+ N++;
208
205
  }
209
206
  }
210
- function Ge() {
207
+ function Je() {
211
208
  {
212
- if ($--, $ === 0) {
209
+ if (N--, N === 0) {
213
210
  var e = {
214
211
  configurable: !0,
215
212
  enumerable: !0,
216
213
  writable: !0
217
214
  };
218
215
  Object.defineProperties(console, {
219
- log: F({}, e, {
216
+ log: A({}, e, {
217
+ value: le
218
+ }),
219
+ info: A({}, e, {
220
220
  value: fe
221
221
  }),
222
- info: F({}, e, {
222
+ warn: A({}, e, {
223
223
  value: de
224
224
  }),
225
- warn: F({}, e, {
225
+ error: A({}, e, {
226
226
  value: me
227
227
  }),
228
- error: F({}, e, {
228
+ group: A({}, e, {
229
229
  value: pe
230
230
  }),
231
- group: F({}, e, {
231
+ groupCollapsed: A({}, e, {
232
232
  value: ve
233
233
  }),
234
- groupCollapsed: F({}, e, {
234
+ groupEnd: A({}, e, {
235
235
  value: ge
236
- }),
237
- groupEnd: F({}, e, {
238
- value: ye
239
236
  })
240
237
  });
241
238
  }
242
- $ < 0 && _("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
239
+ N < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
243
240
  }
244
241
  }
245
- var K = b.ReactCurrentDispatcher, X;
246
- function q(e, t, n) {
242
+ var G = S.ReactCurrentDispatcher, K;
243
+ function q(e, r, o) {
247
244
  {
248
- if (X === void 0)
245
+ if (K === void 0)
249
246
  try {
250
247
  throw Error();
251
- } catch (f) {
252
- var i = f.stack.trim().match(/\n( *(at )?)/);
253
- X = i && i[1] || "";
248
+ } catch (d) {
249
+ var s = d.stack.trim().match(/\n( *(at )?)/);
250
+ K = s && s[1] || "";
254
251
  }
255
252
  return `
256
- ` + X + e;
253
+ ` + K + e;
257
254
  }
258
255
  }
259
- var Z = !1, B;
256
+ var X = !1, B;
260
257
  {
261
- var Ke = typeof WeakMap == "function" ? WeakMap : Map;
262
- B = new Ke();
258
+ var Ge = typeof WeakMap == "function" ? WeakMap : Map;
259
+ B = new Ge();
263
260
  }
264
- function Ee(e, t) {
265
- if (!e || Z)
261
+ function he(e, r) {
262
+ if (!e || X)
266
263
  return "";
267
264
  {
268
- var n = B.get(e);
269
- if (n !== void 0)
270
- return n;
265
+ var o = B.get(e);
266
+ if (o !== void 0)
267
+ return o;
271
268
  }
272
- var i;
273
- Z = !0;
274
- var f = Error.prepareStackTrace;
269
+ var s;
270
+ X = !0;
271
+ var d = Error.prepareStackTrace;
275
272
  Error.prepareStackTrace = void 0;
276
- var m;
277
- m = K.current, K.current = null, Je();
273
+ var p;
274
+ p = G.current, G.current = null, He();
278
275
  try {
279
- if (t) {
280
- var u = function() {
276
+ if (r) {
277
+ var l = function() {
281
278
  throw Error();
282
279
  };
283
- if (Object.defineProperty(u.prototype, "props", {
280
+ if (Object.defineProperty(l.prototype, "props", {
284
281
  set: function() {
285
282
  throw Error();
286
283
  }
287
284
  }), typeof Reflect == "object" && Reflect.construct) {
288
285
  try {
289
- Reflect.construct(u, []);
290
- } catch (x) {
291
- i = x;
286
+ Reflect.construct(l, []);
287
+ } catch (j) {
288
+ s = j;
292
289
  }
293
- Reflect.construct(e, [], u);
290
+ Reflect.construct(e, [], l);
294
291
  } else {
295
292
  try {
296
- u.call();
297
- } catch (x) {
298
- i = x;
293
+ l.call();
294
+ } catch (j) {
295
+ s = j;
299
296
  }
300
- e.call(u.prototype);
297
+ e.call(l.prototype);
301
298
  }
302
299
  } else {
303
300
  try {
304
301
  throw Error();
305
- } catch (x) {
306
- i = x;
302
+ } catch (j) {
303
+ s = j;
307
304
  }
308
305
  e();
309
306
  }
310
- } catch (x) {
311
- if (x && i && typeof x.stack == "string") {
312
- for (var c = x.stack.split(`
313
- `), w = i.stack.split(`
314
- `), h = c.length - 1, E = w.length - 1; h >= 1 && E >= 0 && c[h] !== w[E]; )
307
+ } catch (j) {
308
+ if (j && s && typeof j.stack == "string") {
309
+ for (var u = j.stack.split(`
310
+ `), b = s.stack.split(`
311
+ `), y = u.length - 1, E = b.length - 1; y >= 1 && E >= 0 && u[y] !== b[E]; )
315
312
  E--;
316
- for (; h >= 1 && E >= 0; h--, E--)
317
- if (c[h] !== w[E]) {
318
- if (h !== 1 || E !== 1)
313
+ for (; y >= 1 && E >= 0; y--, E--)
314
+ if (u[y] !== b[E]) {
315
+ if (y !== 1 || E !== 1)
319
316
  do
320
- if (h--, E--, E < 0 || c[h] !== w[E]) {
321
- var P = `
322
- ` + c[h].replace(" at new ", " at ");
323
- return e.displayName && P.includes("<anonymous>") && (P = P.replace("<anonymous>", e.displayName)), typeof e == "function" && B.set(e, P), P;
317
+ if (y--, E--, E < 0 || u[y] !== b[E]) {
318
+ var C = `
319
+ ` + u[y].replace(" at new ", " at ");
320
+ return e.displayName && C.includes("<anonymous>") && (C = C.replace("<anonymous>", e.displayName)), typeof e == "function" && B.set(e, C), C;
324
321
  }
325
- while (h >= 1 && E >= 0);
322
+ while (y >= 1 && E >= 0);
326
323
  break;
327
324
  }
328
325
  }
329
326
  } finally {
330
- Z = !1, K.current = m, Ge(), Error.prepareStackTrace = f;
327
+ X = !1, G.current = p, Je(), Error.prepareStackTrace = d;
331
328
  }
332
329
  var L = e ? e.displayName || e.name : "", ke = L ? q(L) : "";
333
330
  return typeof e == "function" && B.set(e, ke), ke;
334
331
  }
335
- function Xe(e, t, n) {
336
- return Ee(e, !1);
332
+ function Ke(e, r, o) {
333
+ return he(e, !1);
337
334
  }
338
- function Ze(e) {
339
- var t = e.prototype;
340
- return !!(t && t.isReactComponent);
335
+ function Xe(e) {
336
+ var r = e.prototype;
337
+ return !!(r && r.isReactComponent);
341
338
  }
342
- function z(e, t, n) {
339
+ function z(e, r, o) {
343
340
  if (e == null)
344
341
  return "";
345
342
  if (typeof e == "function")
346
- return Ee(e, Ze(e));
343
+ return he(e, Xe(e));
347
344
  if (typeof e == "string")
348
345
  return q(e);
349
346
  switch (e) {
350
- case S:
347
+ case P:
351
348
  return q("Suspense");
352
349
  case R:
353
350
  return q("SuspenseList");
354
351
  }
355
352
  if (typeof e == "object")
356
353
  switch (e.$$typeof) {
357
- case y:
358
- return Xe(e.render);
359
- case C:
360
- return z(e.type, t, n);
361
- case O: {
362
- var i = e, f = i._payload, m = i._init;
354
+ case g:
355
+ return Ke(e.render);
356
+ case f:
357
+ return z(e.type, r, o);
358
+ case _: {
359
+ var s = e, d = s._payload, p = s._init;
363
360
  try {
364
- return z(m(f), t, n);
361
+ return z(p(d), r, o);
365
362
  } catch {
366
363
  }
367
364
  }
368
365
  }
369
366
  return "";
370
367
  }
371
- var H = Object.prototype.hasOwnProperty, Re = {}, _e = b.ReactDebugCurrentFrame;
368
+ var H = Object.prototype.hasOwnProperty, Ee = {}, Re = S.ReactDebugCurrentFrame;
372
369
  function J(e) {
373
370
  if (e) {
374
- var t = e._owner, n = z(e.type, e._source, t ? t.type : null);
375
- _e.setExtraStackFrame(n);
371
+ var r = e._owner, o = z(e.type, e._source, r ? r.type : null);
372
+ Re.setExtraStackFrame(o);
376
373
  } else
377
- _e.setExtraStackFrame(null);
374
+ Re.setExtraStackFrame(null);
378
375
  }
379
- function Qe(e, t, n, i, f) {
376
+ function Ze(e, r, o, s, d) {
380
377
  {
381
- var m = Function.call.bind(H);
382
- for (var u in e)
383
- if (m(e, u)) {
384
- var c = void 0;
378
+ var p = Function.call.bind(H);
379
+ for (var l in e)
380
+ if (p(e, l)) {
381
+ var u = void 0;
385
382
  try {
386
- if (typeof e[u] != "function") {
387
- var w = Error((i || "React class") + ": " + n + " type `" + u + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[u] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
388
- throw w.name = "Invariant Violation", w;
383
+ if (typeof e[l] != "function") {
384
+ var b = Error((s || "React class") + ": " + o + " type `" + l + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[l] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
385
+ throw b.name = "Invariant Violation", b;
389
386
  }
390
- c = e[u](t, u, i, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
391
- } catch (h) {
392
- c = h;
387
+ u = e[l](r, l, s, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
388
+ } catch (y) {
389
+ u = y;
393
390
  }
394
- c && !(c instanceof Error) && (J(f), _("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", i || "React class", n, u, typeof c), J(null)), c instanceof Error && !(c.message in Re) && (Re[c.message] = !0, J(f), _("Failed %s type: %s", n, c.message), J(null));
391
+ u && !(u instanceof Error) && (J(d), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", s || "React class", o, l, typeof u), J(null)), u instanceof Error && !(u.message in Ee) && (Ee[u.message] = !0, J(d), w("Failed %s type: %s", o, u.message), J(null));
395
392
  }
396
393
  }
397
394
  }
398
- var et = Array.isArray;
399
- function Q(e) {
400
- return et(e);
395
+ var Qe = Array.isArray;
396
+ function Z(e) {
397
+ return Qe(e);
401
398
  }
402
- function tt(e) {
399
+ function er(e) {
403
400
  {
404
- var t = typeof Symbol == "function" && Symbol.toStringTag, n = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
405
- return n;
401
+ var r = typeof Symbol == "function" && Symbol.toStringTag, o = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
402
+ return o;
406
403
  }
407
404
  }
408
- function rt(e) {
405
+ function rr(e) {
409
406
  try {
410
- return be(e), !1;
407
+ return we(e), !1;
411
408
  } catch {
412
409
  return !0;
413
410
  }
414
411
  }
415
- function be(e) {
412
+ function we(e) {
416
413
  return "" + e;
417
414
  }
418
- function we(e) {
419
- if (rt(e))
420
- return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", tt(e)), be(e);
415
+ function be(e) {
416
+ if (rr(e))
417
+ return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", er(e)), we(e);
421
418
  }
422
- var W = b.ReactCurrentOwner, nt = {
419
+ var I = S.ReactCurrentOwner, tr = {
423
420
  key: !0,
424
421
  ref: !0,
425
422
  __self: !0,
426
423
  __source: !0
427
- }, Ce, Pe, ee;
428
- ee = {};
429
- function ot(e) {
424
+ }, _e, Ce, Q;
425
+ Q = {};
426
+ function nr(e) {
430
427
  if (H.call(e, "ref")) {
431
- var t = Object.getOwnPropertyDescriptor(e, "ref").get;
432
- if (t && t.isReactWarning)
428
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
429
+ if (r && r.isReactWarning)
433
430
  return !1;
434
431
  }
435
432
  return e.ref !== void 0;
436
433
  }
437
- function at(e) {
434
+ function or(e) {
438
435
  if (H.call(e, "key")) {
439
- var t = Object.getOwnPropertyDescriptor(e, "key").get;
440
- if (t && t.isReactWarning)
436
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
437
+ if (r && r.isReactWarning)
441
438
  return !1;
442
439
  }
443
440
  return e.key !== void 0;
444
441
  }
445
- function it(e, t) {
446
- if (typeof e.ref == "string" && W.current && t && W.current.stateNode !== t) {
447
- var n = j(W.current.type);
448
- ee[n] || (_('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', j(W.current.type), e.ref), ee[n] = !0);
442
+ function ar(e, r) {
443
+ if (typeof e.ref == "string" && I.current && r && I.current.stateNode !== r) {
444
+ var o = T(I.current.type);
445
+ Q[o] || (w('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', T(I.current.type), e.ref), Q[o] = !0);
449
446
  }
450
447
  }
451
- function st(e, t) {
448
+ function ir(e, r) {
452
449
  {
453
- var n = function() {
454
- Ce || (Ce = !0, _("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
450
+ var o = function() {
451
+ _e || (_e = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
455
452
  };
456
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
457
- get: n,
453
+ o.isReactWarning = !0, Object.defineProperty(e, "key", {
454
+ get: o,
458
455
  configurable: !0
459
456
  });
460
457
  }
461
458
  }
462
- function ct(e, t) {
459
+ function sr(e, r) {
463
460
  {
464
- var n = function() {
465
- Pe || (Pe = !0, _("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
461
+ var o = function() {
462
+ Ce || (Ce = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
466
463
  };
467
- n.isReactWarning = !0, Object.defineProperty(e, "ref", {
468
- get: n,
464
+ o.isReactWarning = !0, Object.defineProperty(e, "ref", {
465
+ get: o,
469
466
  configurable: !0
470
467
  });
471
468
  }
472
469
  }
473
- var ut = function(e, t, n, i, f, m, u) {
474
- var c = {
470
+ var cr = function(e, r, o, s, d, p, l) {
471
+ var u = {
475
472
  // This tag allows us to uniquely identify this as a React Element
476
- $$typeof: o,
473
+ $$typeof: n,
477
474
  // Built-in properties that belong on the element
478
475
  type: e,
479
- key: t,
480
- ref: n,
481
- props: u,
476
+ key: r,
477
+ ref: o,
478
+ props: l,
482
479
  // Record the component responsible for creating this element.
483
- _owner: m
480
+ _owner: p
484
481
  };
485
- return c._store = {}, Object.defineProperty(c._store, "validated", {
482
+ return u._store = {}, Object.defineProperty(u._store, "validated", {
486
483
  configurable: !1,
487
484
  enumerable: !1,
488
485
  writable: !0,
489
486
  value: !1
490
- }), Object.defineProperty(c, "_self", {
487
+ }), Object.defineProperty(u, "_self", {
491
488
  configurable: !1,
492
489
  enumerable: !1,
493
490
  writable: !1,
494
- value: i
495
- }), Object.defineProperty(c, "_source", {
491
+ value: s
492
+ }), Object.defineProperty(u, "_source", {
496
493
  configurable: !1,
497
494
  enumerable: !1,
498
495
  writable: !1,
499
- value: f
500
- }), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
496
+ value: d
497
+ }), Object.freeze && (Object.freeze(u.props), Object.freeze(u)), u;
501
498
  };
502
- function lt(e, t, n, i, f) {
499
+ function ur(e, r, o, s, d) {
503
500
  {
504
- var m, u = {}, c = null, w = null;
505
- n !== void 0 && (we(n), c = "" + n), at(t) && (we(t.key), c = "" + t.key), ot(t) && (w = t.ref, it(t, f));
506
- for (m in t)
507
- H.call(t, m) && !nt.hasOwnProperty(m) && (u[m] = t[m]);
501
+ var p, l = {}, u = null, b = null;
502
+ o !== void 0 && (be(o), u = "" + o), or(r) && (be(r.key), u = "" + r.key), nr(r) && (b = r.ref, ar(r, d));
503
+ for (p in r)
504
+ H.call(r, p) && !tr.hasOwnProperty(p) && (l[p] = r[p]);
508
505
  if (e && e.defaultProps) {
509
- var h = e.defaultProps;
510
- for (m in h)
511
- u[m] === void 0 && (u[m] = h[m]);
506
+ var y = e.defaultProps;
507
+ for (p in y)
508
+ l[p] === void 0 && (l[p] = y[p]);
512
509
  }
513
- if (c || w) {
510
+ if (u || b) {
514
511
  var E = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
515
- c && st(u, E), w && ct(u, E);
512
+ u && ir(l, E), b && sr(l, E);
516
513
  }
517
- return ut(e, c, w, f, i, W.current, u);
514
+ return cr(e, u, b, d, s, I.current, l);
518
515
  }
519
516
  }
520
- var te = b.ReactCurrentOwner, Se = b.ReactDebugCurrentFrame;
521
- function N(e) {
517
+ var ee = S.ReactCurrentOwner, Pe = S.ReactDebugCurrentFrame;
518
+ function F(e) {
522
519
  if (e) {
523
- var t = e._owner, n = z(e.type, e._source, t ? t.type : null);
524
- Se.setExtraStackFrame(n);
520
+ var r = e._owner, o = z(e.type, e._source, r ? r.type : null);
521
+ Pe.setExtraStackFrame(o);
525
522
  } else
526
- Se.setExtraStackFrame(null);
523
+ Pe.setExtraStackFrame(null);
527
524
  }
528
525
  var re;
529
526
  re = !1;
530
- function ne(e) {
531
- return typeof e == "object" && e !== null && e.$$typeof === o;
527
+ function te(e) {
528
+ return typeof e == "object" && e !== null && e.$$typeof === n;
532
529
  }
533
- function Oe() {
530
+ function Se() {
534
531
  {
535
- if (te.current) {
536
- var e = j(te.current.type);
532
+ if (ee.current) {
533
+ var e = T(ee.current.type);
537
534
  if (e)
538
535
  return `
539
536
 
@@ -542,355 +539,354 @@ Check the render method of \`` + e + "`.";
542
539
  return "";
543
540
  }
544
541
  }
545
- function ft(e) {
542
+ function lr(e) {
546
543
  return "";
547
544
  }
548
- var Te = {};
549
- function dt(e) {
545
+ var Oe = {};
546
+ function fr(e) {
550
547
  {
551
- var t = Oe();
552
- if (!t) {
553
- var n = typeof e == "string" ? e : e.displayName || e.name;
554
- n && (t = `
548
+ var r = Se();
549
+ if (!r) {
550
+ var o = typeof e == "string" ? e : e.displayName || e.name;
551
+ o && (r = `
555
552
 
556
- Check the top-level render call using <` + n + ">.");
553
+ Check the top-level render call using <` + o + ">.");
557
554
  }
558
- return t;
555
+ return r;
559
556
  }
560
557
  }
561
- function je(e, t) {
558
+ function Te(e, r) {
562
559
  {
563
560
  if (!e._store || e._store.validated || e.key != null)
564
561
  return;
565
562
  e._store.validated = !0;
566
- var n = dt(t);
567
- if (Te[n])
563
+ var o = fr(r);
564
+ if (Oe[o])
568
565
  return;
569
- Te[n] = !0;
570
- var i = "";
571
- e && e._owner && e._owner !== te.current && (i = " It was passed a child from " + j(e._owner.type) + "."), N(e), _('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, i), N(null);
566
+ Oe[o] = !0;
567
+ var s = "";
568
+ e && e._owner && e._owner !== ee.current && (s = " It was passed a child from " + T(e._owner.type) + "."), F(e), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', o, s), F(null);
572
569
  }
573
570
  }
574
- function xe(e, t) {
571
+ function je(e, r) {
575
572
  {
576
573
  if (typeof e != "object")
577
574
  return;
578
- if (Q(e))
579
- for (var n = 0; n < e.length; n++) {
580
- var i = e[n];
581
- ne(i) && je(i, t);
575
+ if (Z(e))
576
+ for (var o = 0; o < e.length; o++) {
577
+ var s = e[o];
578
+ te(s) && Te(s, r);
582
579
  }
583
- else if (ne(e))
580
+ else if (te(e))
584
581
  e._store && (e._store.validated = !0);
585
582
  else if (e) {
586
- var f = T(e);
587
- if (typeof f == "function" && f !== e.entries)
588
- for (var m = f.call(e), u; !(u = m.next()).done; )
589
- ne(u.value) && je(u.value, t);
583
+ var d = U(e);
584
+ if (typeof d == "function" && d !== e.entries)
585
+ for (var p = d.call(e), l; !(l = p.next()).done; )
586
+ te(l.value) && Te(l.value, r);
590
587
  }
591
588
  }
592
589
  }
593
- function mt(e) {
590
+ function dr(e) {
594
591
  {
595
- var t = e.type;
596
- if (t == null || typeof t == "string")
592
+ var r = e.type;
593
+ if (r == null || typeof r == "string")
597
594
  return;
598
- var n;
599
- if (typeof t == "function")
600
- n = t.propTypes;
601
- else if (typeof t == "object" && (t.$$typeof === y || // Note: Memo only checks outer props here.
595
+ var o;
596
+ if (typeof r == "function")
597
+ o = r.propTypes;
598
+ else if (typeof r == "object" && (r.$$typeof === g || // Note: Memo only checks outer props here.
602
599
  // Inner props are checked in the reconciler.
603
- t.$$typeof === C))
604
- n = t.propTypes;
600
+ r.$$typeof === f))
601
+ o = r.propTypes;
605
602
  else
606
603
  return;
607
- if (n) {
608
- var i = j(t);
609
- Qe(n, e.props, "prop", i, e);
610
- } else if (t.PropTypes !== void 0 && !re) {
604
+ if (o) {
605
+ var s = T(r);
606
+ Ze(o, e.props, "prop", s, e);
607
+ } else if (r.PropTypes !== void 0 && !re) {
611
608
  re = !0;
612
- var f = j(t);
613
- _("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", f || "Unknown");
609
+ var d = T(r);
610
+ w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", d || "Unknown");
614
611
  }
615
- typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && _("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
612
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
616
613
  }
617
614
  }
618
- function pt(e) {
615
+ function mr(e) {
619
616
  {
620
- for (var t = Object.keys(e.props), n = 0; n < t.length; n++) {
621
- var i = t[n];
622
- if (i !== "children" && i !== "key") {
623
- N(e), _("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", i), N(null);
617
+ for (var r = Object.keys(e.props), o = 0; o < r.length; o++) {
618
+ var s = r[o];
619
+ if (s !== "children" && s !== "key") {
620
+ F(e), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", s), F(null);
624
621
  break;
625
622
  }
626
623
  }
627
- e.ref !== null && (N(e), _("Invalid attribute `ref` supplied to `React.Fragment`."), N(null));
624
+ e.ref !== null && (F(e), w("Invalid attribute `ref` supplied to `React.Fragment`."), F(null));
628
625
  }
629
626
  }
630
- function Ae(e, t, n, i, f, m) {
627
+ function xe(e, r, o, s, d, p) {
631
628
  {
632
- var u = ze(e);
633
- if (!u) {
634
- var c = "";
635
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (c += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
636
- var w = ft();
637
- w ? c += w : c += Oe();
638
- var h;
639
- e === null ? h = "null" : Q(e) ? h = "array" : e !== void 0 && e.$$typeof === o ? (h = "<" + (j(e.type) || "Unknown") + " />", c = " Did you accidentally export a JSX literal instead of a component?") : h = typeof e, _("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", h, c);
629
+ var l = Be(e);
630
+ if (!l) {
631
+ var u = "";
632
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (u += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
633
+ var b = lr();
634
+ b ? u += b : u += Se();
635
+ var y;
636
+ e === null ? y = "null" : Z(e) ? y = "array" : e !== void 0 && e.$$typeof === n ? (y = "<" + (T(e.type) || "Unknown") + " />", u = " Did you accidentally export a JSX literal instead of a component?") : y = typeof e, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", y, u);
640
637
  }
641
- var E = lt(e, t, n, f, m);
638
+ var E = ur(e, r, o, d, p);
642
639
  if (E == null)
643
640
  return E;
644
- if (u) {
645
- var P = t.children;
646
- if (P !== void 0)
647
- if (i)
648
- if (Q(P)) {
649
- for (var L = 0; L < P.length; L++)
650
- xe(P[L], e);
651
- Object.freeze && Object.freeze(P);
641
+ if (l) {
642
+ var C = r.children;
643
+ if (C !== void 0)
644
+ if (s)
645
+ if (Z(C)) {
646
+ for (var L = 0; L < C.length; L++)
647
+ je(C[L], e);
648
+ Object.freeze && Object.freeze(C);
652
649
  } else
653
- _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
650
+ w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
654
651
  else
655
- xe(P, e);
652
+ je(C, e);
656
653
  }
657
- return e === s ? pt(E) : mt(E), E;
654
+ return e === c ? mr(E) : dr(E), E;
658
655
  }
659
656
  }
660
- function vt(e, t, n) {
661
- return Ae(e, t, n, !0);
657
+ function pr(e, r, o) {
658
+ return xe(e, r, o, !0);
662
659
  }
663
- function gt(e, t, n) {
664
- return Ae(e, t, n, !1);
660
+ function vr(e, r, o) {
661
+ return xe(e, r, o, !1);
665
662
  }
666
- var yt = gt, ht = vt;
667
- Y.Fragment = s, Y.jsx = yt, Y.jsxs = ht;
668
- }()), Y;
663
+ var gr = vr, yr = pr;
664
+ W.Fragment = c, W.jsx = gr, W.jsxs = yr;
665
+ }()), W;
669
666
  }
670
- process.env.NODE_ENV === "production" ? ie.exports = Pt() : ie.exports = St();
671
- var We = ie.exports;
672
- const G = We.jsx, Ot = We.Fragment;
673
- function Tt(r) {
674
- return M.cloneElement(r.recommendationComponent, {
667
+ process.env.NODE_ENV === "production" ? ae.exports = Sr() : ae.exports = Or();
668
+ var M = ae.exports;
669
+ function Tr(t) {
670
+ return wr(t.recommendationComponent, {
675
671
  // eslint-disable-next-line react/prop-types
676
- nostoRecommendation: r.nostoRecommendation
672
+ nostoRecommendation: t.nostoRecommendation
677
673
  });
678
674
  }
679
- function jt(r) {
675
+ function jr(t) {
680
676
  if (!window.nostojs)
681
677
  throw new Error("Nosto has not yet been initialized");
682
- window.nostojs((o) => {
683
- o.placements.injectCampaigns(r.recommendations);
678
+ window.nostojs((n) => {
679
+ n.placements.injectCampaigns(t.recommendations);
684
680
  });
685
681
  }
686
682
  function k() {
687
- const {
688
- responseMode: r,
689
- recommendationComponent: o
690
- } = ce(), a = oe({});
691
- if (r == "HTML")
692
- return {
693
- renderCampaigns: jt
694
- };
695
- function s(d) {
696
- var l;
697
- const p = ((l = d.campaigns) == null ? void 0 : l.recommendations) ?? {};
698
- for (const g in p) {
699
- const y = p[g], S = "#" + g, R = document.querySelector(S);
700
- R && (a.current[g] || (a.current[g] = wt(R)), a.current[g].render(/* @__PURE__ */ G(Tt, {
701
- recommendationComponent: o,
702
- nostoRecommendation: y
703
- })));
683
+ const { responseMode: t, recommendationComponent: n } = se(), a = ne({});
684
+ if (t == "HTML")
685
+ return { renderCampaigns: jr };
686
+ function c(i) {
687
+ var h;
688
+ const m = ((h = i.campaigns) == null ? void 0 : h.recommendations) ?? {};
689
+ for (const v in m) {
690
+ const g = m[v], P = "#" + v, R = document.querySelector(P);
691
+ R && (a.current[v] || (a.current[v] = Cr(R)), a.current[v].render(
692
+ /* @__PURE__ */ M.jsx(
693
+ Tr,
694
+ {
695
+ recommendationComponent: n,
696
+ nostoRecommendation: g
697
+ }
698
+ )
699
+ ));
704
700
  }
705
701
  }
706
- return {
707
- renderCampaigns: s
708
- };
702
+ return { renderCampaigns: c };
709
703
  }
710
- function Nt(r) {
711
- const {
712
- renderCampaigns: o
713
- } = k();
714
- return A(async (a) => {
715
- const s = await a.defaultSession().viewNotFound().setPlacements(r.placements || a.placements.getPlacements()).load();
716
- o(s);
717
- }), null;
704
+ function xr() {
705
+ return typeof window.nosto < "u";
718
706
  }
719
- function Lt(r) {
720
- const {
721
- renderCampaigns: o
722
- } = k();
723
- return A(async (a) => {
724
- const s = await a.defaultSession().viewOther().setPlacements(r.placements || a.placements.getPlacements()).load();
725
- o(s);
726
- }), null;
707
+ function kr(t, n) {
708
+ return new Promise((a, c) => {
709
+ const i = document.createElement("script");
710
+ i.type = "text/javascript", i.src = t, i.async = !0, i.onload = () => a(), i.onerror = () => c(), Object.entries((n == null ? void 0 : n.attributes) ?? {}).forEach(([m, h]) => i.setAttribute(m, h)), (n == null ? void 0 : n.position) === "head" ? document.head.appendChild(i) : document.body.appendChild(i);
711
+ });
727
712
  }
728
- function It(r) {
729
- const {
730
- renderCampaigns: o
731
- } = k();
732
- return A(async (a) => {
733
- const s = await a.defaultSession().viewCart().setPlacements(r.placements || a.placements.getPlacements()).load();
734
- o(s);
735
- }), null;
713
+ function Ar(t) {
714
+ const { host: n = "connect.nosto.com", scriptLoader: a = kr, account: c, shopifyMarkets: i, loadScript: m = !0 } = t, [h, v] = br(!1);
715
+ return ie(() => {
716
+ function g() {
717
+ var f;
718
+ "nostoReactTest" in window && ((f = window.nosto) == null || f.reload({
719
+ site: "localhost"
720
+ })), v(!0);
721
+ }
722
+ async function P(f, _ = {}) {
723
+ const O = `//${n}${f}`, D = { "nosto-client-script": "", ..._ };
724
+ await a(O, { attributes: D }), g();
725
+ }
726
+ function R() {
727
+ var Y, U;
728
+ const f = document.querySelector("[nosto-client-script]"), _ = String((i == null ? void 0 : i.marketId) || ""), O = (i == null ? void 0 : i.language) || "", D = (f == null ? void 0 : f.getAttribute("nosto-language")) !== O || (f == null ? void 0 : f.getAttribute("nosto-market-id")) !== _;
729
+ if (!f || D) {
730
+ h && v(!1);
731
+ const S = document.querySelector("#nosto-sandbox");
732
+ (Y = f == null ? void 0 : f.parentNode) == null || Y.removeChild(f), (U = S == null ? void 0 : S.parentNode) == null || U.removeChild(S);
733
+ const w = `/script/shopify/market/nosto.js?merchant=${c}&market=${_}&locale=${O.toLowerCase()}`;
734
+ P(w, { "nosto-language": O, "nosto-market-id": _ });
735
+ }
736
+ }
737
+ if (window.nostojs || (window.nostojs = (f) => {
738
+ (window.nostojs.q = window.nostojs.q || []).push(f);
739
+ }, window.nostojs((f) => f.setAutoLoad(!1))), !m) {
740
+ window.nosto ? g() : window.nostojs(g);
741
+ return;
742
+ }
743
+ if (!xr() && !i) {
744
+ const f = `/include/${c}`;
745
+ P(f);
746
+ }
747
+ i && R();
748
+ }, [i == null ? void 0 : i.marketId, i == null ? void 0 : i.language]), { clientScriptLoaded: h };
736
749
  }
737
- function $t(r) {
738
- const {
739
- product: o,
740
- tagging: a,
741
- placements: s
742
- } = r, {
743
- renderCampaigns: d
744
- } = k();
745
- return A(async (p) => {
746
- const l = await p.defaultSession().viewProduct(a ?? o).setPlacements(s || p.placements.getPlacements()).load();
747
- d(l);
748
- }, [o, a == null ? void 0 : a.selected_sku_id]), null;
750
+ function Ir(t) {
751
+ const { renderCampaigns: n } = k();
752
+ return x(
753
+ async (a) => {
754
+ const c = await a.defaultSession().viewNotFound().setPlacements(t.placements || a.placements.getPlacements()).load();
755
+ n(c);
756
+ }
757
+ ), null;
749
758
  }
750
- function Wt(r) {
751
- const {
752
- category: o,
753
- placements: a
754
- } = r, {
755
- renderCampaigns: s
756
- } = k();
757
- return A(async (d) => {
758
- const p = await d.defaultSession().viewCategory(o).setPlacements(a || d.placements.getPlacements()).load();
759
- s(p);
760
- }, [o]), null;
759
+ function $r(t) {
760
+ const { renderCampaigns: n } = k();
761
+ return x(
762
+ async (a) => {
763
+ const c = await a.defaultSession().viewOther().setPlacements(t.placements || a.placements.getPlacements()).load();
764
+ n(c);
765
+ }
766
+ ), null;
761
767
  }
762
- function Vt(r) {
763
- const {
764
- query: o,
765
- placements: a
766
- } = r, {
767
- renderCampaigns: s
768
- } = k();
769
- return A(async (d) => {
770
- const p = await d.defaultSession().viewSearch(o).setPlacements(a || d.placements.getPlacements()).load();
771
- s(p);
772
- }, [o]), null;
768
+ function Wr(t) {
769
+ const { renderCampaigns: n } = k();
770
+ return x(
771
+ async (a) => {
772
+ const c = await a.defaultSession().viewCart().setPlacements(t.placements || a.placements.getPlacements()).load();
773
+ n(c);
774
+ }
775
+ ), null;
773
776
  }
774
- function U(r) {
775
- return !r || typeof r != "object" || xt(r) || At(r) ? r : Array.isArray(r) ? r.map(U) : Object.keys(r).reduce((o, a) => {
776
- const s = a[0].toLowerCase() + a.slice(1).replace(/([A-Z]+)/g, (d, p) => "_" + p.toLowerCase());
777
- return o[s] = U(r[a]), o;
778
- }, {});
777
+ function Mr(t) {
778
+ const { product: n, tagging: a, placements: c } = t, { renderCampaigns: i } = k();
779
+ return x(
780
+ async (m) => {
781
+ const h = await m.defaultSession().viewProduct(a ?? n).setPlacements(c || m.placements.getPlacements()).load();
782
+ i(h);
783
+ },
784
+ [n, a == null ? void 0 : a.selected_sku_id]
785
+ ), null;
779
786
  }
780
- function xt(r) {
781
- return Object.prototype.toString.call(r) === "[object Date]";
787
+ function Vr(t) {
788
+ const { category: n, placements: a } = t, { renderCampaigns: c } = k();
789
+ return x(
790
+ async (i) => {
791
+ const m = await i.defaultSession().viewCategory(n).setPlacements(a || i.placements.getPlacements()).load();
792
+ c(m);
793
+ },
794
+ [n]
795
+ ), null;
782
796
  }
783
- function At(r) {
784
- return Object.prototype.toString.call(r) === "[object RegExp]";
797
+ function Yr(t) {
798
+ const { query: n, placements: a } = t, { renderCampaigns: c } = k();
799
+ return x(
800
+ async (i) => {
801
+ const m = await i.defaultSession().viewSearch(n).setPlacements(a || i.placements.getPlacements()).load();
802
+ c(m);
803
+ },
804
+ [n]
805
+ ), null;
785
806
  }
786
- function Yt(r) {
787
- const {
788
- order: o,
789
- placements: a
790
- } = r, {
791
- renderCampaigns: s
792
- } = k();
793
- return A(async (d) => {
794
- const p = await d.defaultSession().addOrder(U(o)).setPlacements(a || d.placements.getPlacements()).load();
795
- s(p);
796
- }, [o], {
797
- deep: !0
798
- }), null;
807
+ function V(t) {
808
+ return !t || typeof t != "object" || Dr(t) || Fr(t) ? t : Array.isArray(t) ? t.map(V) : Object.keys(t).reduce((n, a) => {
809
+ const c = a[0].toLowerCase() + a.slice(1).replace(/([A-Z]+)/g, (i, m) => "_" + m.toLowerCase());
810
+ return n[c] = V(t[a]), n;
811
+ }, {});
799
812
  }
800
- function Mt(r) {
801
- const {
802
- renderCampaigns: o
803
- } = k();
804
- return A(async (a) => {
805
- const s = await a.defaultSession().viewFrontPage().setPlacements(r.placements || a.placements.getPlacements()).load();
806
- o(s);
807
- }), null;
813
+ function Dr(t) {
814
+ return Object.prototype.toString.call(t) === "[object Date]";
808
815
  }
809
- function Ut(r) {
810
- const {
811
- id: o,
812
- pageType: a
813
- } = r;
814
- return /* @__PURE__ */ G("div", {
815
- className: "nosto_element",
816
- id: o
817
- }, o + (a || ""));
816
+ function Fr(t) {
817
+ return Object.prototype.toString.call(t) === "[object RegExp]";
818
818
  }
819
- function kt() {
820
- return typeof window.nosto < "u";
819
+ function Ur(t) {
820
+ const { order: n, placements: a } = t, { renderCampaigns: c } = k();
821
+ return x(
822
+ async (i) => {
823
+ const m = await i.defaultSession().addOrder(V(n)).setPlacements(a || i.placements.getPlacements()).load();
824
+ c(m);
825
+ },
826
+ [n],
827
+ { deep: !0 }
828
+ ), null;
821
829
  }
822
- function qt(r) {
830
+ function qr(t) {
831
+ const { renderCampaigns: n } = k();
832
+ return x(
833
+ async (a) => {
834
+ const c = await a.defaultSession().viewFrontPage().setPlacements(t.placements || a.placements.getPlacements()).load();
835
+ n(c);
836
+ }
837
+ ), null;
838
+ }
839
+ function Br(t) {
840
+ const { id: n, pageType: a } = t;
841
+ return /* @__PURE__ */ M.jsx("div", { className: "nosto_element", id: n }, n + (a || ""));
842
+ }
843
+ function zr(t) {
823
844
  const {
824
- account: o,
845
+ account: n,
825
846
  multiCurrency: a = !1,
826
- host: s,
827
- children: d,
828
- recommendationComponent: p,
829
- shopifyMarkets: l
830
- } = r, [g, y] = M.useState(!1), S = M.useMemo(() => g, [g]), R = a ? r.currentVariation : "", C = bt(p) ? "JSON_ORIGINAL" : "HTML";
831
- return se(() => {
832
- var O, D, I;
833
- if (window.nostojs || (window.nostojs = (v) => {
834
- (window.nostojs.q = window.nostojs.q || []).push(v);
835
- }, window.nostojs((v) => v.setAutoLoad(!1))), !kt() && !l) {
836
- const v = document.createElement("script");
837
- v.type = "text/javascript", v.src = "//" + (s || "connect.nosto.com") + "/include/" + o, v.async = !0, v.setAttribute("nosto-client-script", ""), v.onload = () => {
838
- var T;
839
- typeof jest < "u" && ((T = window.nosto) == null || T.reload({
840
- site: "localhost"
841
- })), y(!0);
842
- }, document.body.appendChild(v);
843
- }
844
- if (l) {
845
- const v = document.querySelector("[nosto-client-script]"), T = document.querySelector("#nosto-sandbox");
846
- if (!v || (v == null ? void 0 : v.getAttribute("nosto-language")) !== (l == null ? void 0 : l.language) || (v == null ? void 0 : v.getAttribute("nosto-market-id")) !== (l == null ? void 0 : l.marketId)) {
847
- g && y(!1), (O = v == null ? void 0 : v.parentNode) == null || O.removeChild(v), (D = T == null ? void 0 : T.parentNode) == null || D.removeChild(T);
848
- const b = document.createElement("script");
849
- b.type = "text/javascript", b.src = "//" + (s || "connect.nosto.com") + `/script/shopify/market/nosto.js?merchant=${o}&market=${l.marketId || ""}&locale=${((I = l == null ? void 0 : l.language) == null ? void 0 : I.toLowerCase()) || ""}`, b.async = !0, b.setAttribute("nosto-client-script", ""), b.setAttribute("nosto-language", (l == null ? void 0 : l.language) || ""), b.setAttribute("nosto-market-id", String(l == null ? void 0 : l.marketId)), b.onload = () => {
850
- var _;
851
- typeof jest < "u" && ((_ = window.nosto) == null || _.reload({
852
- site: "localhost"
853
- })), y(!0);
854
- }, document.body.appendChild(b);
855
- }
856
- }
857
- }, [g, l]), /* @__PURE__ */ G($e.Provider, {
858
- value: {
859
- account: o,
860
- clientScriptLoaded: S,
861
- currentVariation: R,
862
- responseMode: C,
863
- recommendationComponent: p
864
- },
865
- children: d
866
- });
847
+ children: c,
848
+ recommendationComponent: i
849
+ } = t, m = a ? t.currentVariation : "";
850
+ if (i && !_r(i))
851
+ throw new Error(
852
+ "The recommendationComponent prop must be a valid React element. Please provide a valid React element."
853
+ );
854
+ const h = i ? "JSON_ORIGINAL" : "HTML", { clientScriptLoaded: v } = Ar(t);
855
+ return /* @__PURE__ */ M.jsx(
856
+ $e.Provider,
857
+ {
858
+ value: {
859
+ account: n,
860
+ clientScriptLoaded: v,
861
+ currentVariation: m,
862
+ responseMode: h,
863
+ recommendationComponent: i
864
+ },
865
+ children: c
866
+ }
867
+ );
867
868
  }
868
- function Bt(r) {
869
- const {
870
- cart: o,
871
- customer: a
872
- } = r ?? {}, {
873
- clientScriptLoaded: s
874
- } = ce();
869
+ function Hr(t) {
870
+ const { cart: n, customer: a } = t ?? {}, { clientScriptLoaded: c } = se();
875
871
  return Ie(() => {
876
- const d = o ? U(o) : void 0, p = a ? U(a) : void 0;
877
- s && window.nostojs((l) => {
878
- l.defaultSession().setResponseMode("HTML").setCart(d).setCustomer(p).viewOther().load();
872
+ const i = n ? V(n) : void 0, m = a ? V(a) : void 0;
873
+ c && window.nostojs((h) => {
874
+ h.defaultSession().setResponseMode("HTML").setCart(i).setCustomer(m).viewOther().load();
879
875
  });
880
- }, [s, o, a]), /* @__PURE__ */ G(Ot, {});
876
+ }, [c, n, a]), /* @__PURE__ */ M.jsx(M.Fragment, {});
881
877
  }
882
878
  export {
883
- Nt as Nosto404,
884
- Wt as NostoCategory,
885
- It as NostoCheckout,
879
+ Ir as Nosto404,
880
+ Vr as NostoCategory,
881
+ Wr as NostoCheckout,
886
882
  $e as NostoContext,
887
- Mt as NostoHome,
888
- Yt as NostoOrder,
889
- Lt as NostoOther,
890
- Ut as NostoPlacement,
891
- $t as NostoProduct,
892
- qt as NostoProvider,
893
- Vt as NostoSearch,
894
- Bt as NostoSession,
895
- ce as useNostoContext
883
+ qr as NostoHome,
884
+ Ur as NostoOrder,
885
+ $r as NostoOther,
886
+ Br as NostoPlacement,
887
+ Mr as NostoProduct,
888
+ zr as NostoProvider,
889
+ Yr as NostoSearch,
890
+ Hr as NostoSession,
891
+ se as useNostoContext
896
892
  };