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