@sesamy/sesamy-js 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -406,12 +406,12 @@ async function Cr(t, e) {
406
406
  }
407
407
  if (S)
408
408
  throw S;
409
- const y = _.json, { error: l, error_description: b } = y, C = Q(y, ["error", "error_description"]), { ok: O } = _;
409
+ const y = _.json, { error: l, error_description: b } = y, x = Q(y, ["error", "error_description"]), { ok: O } = _;
410
410
  if (!O) {
411
411
  const A = b || `HTTP error. Unable to fetch ${u}`;
412
- throw l === "mfa_required" ? new Or(l, A, C.mfa_token) : l === "missing_refresh_token" ? new zn(h, d) : new H(l || "request_error", A);
412
+ throw l === "mfa_required" ? new Or(l, A, x.mfa_token) : l === "missing_refresh_token" ? new zn(h, d) : new H(l || "request_error", A);
413
413
  }
414
- return C;
414
+ return x;
415
415
  }(`${n}/oauth/token`, r, i || "default", o, { method: "POST", body: f, headers: { "Content-Type": s ? "application/x-www-form-urlencoded" : "application/json", "Auth0-Client": btoa(JSON.stringify(a || Tn)) } }, e, s);
416
416
  }
417
417
  const Ke = (...t) => {
@@ -939,14 +939,14 @@ let Jr = class {
939
939
  window.document.body.contains(y) && (window.document.body.removeChild(y), window.removeEventListener("message", b, !1));
940
940
  };
941
941
  let b;
942
- const C = setTimeout(() => {
942
+ const x = setTimeout(() => {
943
943
  S(new bt()), l();
944
944
  }, 1e3 * v);
945
945
  b = function(O) {
946
946
  if (O.origin != k || !O.data || O.data.type !== "authorization_response")
947
947
  return;
948
948
  const A = O.source;
949
- A && A.close(), O.data.response.error ? S(H.fromPayload(O.data.response)) : _(O.data.response), clearTimeout(C), window.removeEventListener("message", b, !1), setTimeout(l, 2e3);
949
+ A && A.close(), O.data.response.error ? S(H.fromPayload(O.data.response)) : _(O.data.response), clearTimeout(x), window.removeEventListener("message", b, !1), setTimeout(l, 2e3);
950
950
  }, window.addEventListener("message", b, !1), window.document.body.appendChild(y), y.setAttribute("src", w);
951
951
  }))(i, this.domainUrl, c);
952
952
  if (o !== h.state)
@@ -1193,8 +1193,8 @@ const li = (t) => {
1193
1193
  CAUSE: ` + d.stack, l.response = y, l.url = c, y.type === "opaque")
1194
1194
  throw l;
1195
1195
  return y.text().then((b) => {
1196
- var C;
1197
- if (l.message = b, i.errorType === "json" || ((C = y.headers.get("Content-Type")) === null || C === void 0 ? void 0 : C.split(";")[0]) === "application/json")
1196
+ var x;
1197
+ if (l.message = b, i.errorType === "json" || ((x = y.headers.get("Content-Type")) === null || x === void 0 ? void 0 : x.split(";")[0]) === "application/json")
1198
1198
  try {
1199
1199
  l.json = JSON.parse(b);
1200
1200
  } catch {
@@ -1204,13 +1204,13 @@ CAUSE: ` + d.stack, l.response = y, l.url = c, y.type === "opaque")
1204
1204
  }
1205
1205
  return y;
1206
1206
  }), k = (y) => y.catch((l) => {
1207
- const b = l.hasOwnProperty(ve), C = b ? l[ve] : l, O = (C == null ? void 0 : C.status) && f.get(C.status) || f.get(C == null ? void 0 : C.name) || b && f.has(ve) && f.get(ve);
1207
+ const b = l.hasOwnProperty(ve), x = b ? l[ve] : l, O = (x == null ? void 0 : x.status) && f.get(x.status) || f.get(x == null ? void 0 : x.name) || b && f.has(ve) && f.get(ve);
1208
1208
  if (O)
1209
- return O(C, t);
1209
+ return O(x, t);
1210
1210
  const A = f.get(Mn);
1211
1211
  if (A)
1212
- return A(C, t);
1213
- throw C;
1212
+ return A(x, t);
1213
+ throw x;
1214
1214
  }), v = (y) => (l) => /* If a callback is provided, then callback with the body result otherwise return the parsed body itself. */ k(y ? w.then((b) => b && b[y]()).then((b) => l ? l(b) : b) : w.then((b) => l ? l(b) : b)), _ = {
1215
1215
  _wretchReq: t,
1216
1216
  _fetchReq: h,
@@ -1370,38 +1370,38 @@ oe.errorType = ci;
1370
1370
  oe.polyfills = si;
1371
1371
  oe.WretchError = Kn;
1372
1372
  function hi(t) {
1373
- const e = t.endpoint || `https://api2.${Rn}`, n = (I = !0) => (j) => async (N, W) => {
1373
+ const e = t.endpoint || `https://api2.${Rn}`, n = (I = !0) => (C) => async (N, W) => {
1374
1374
  let R = null;
1375
1375
  if (R = await Br(I), !R) {
1376
1376
  if (I)
1377
1377
  throw new Error("No access token available");
1378
- return j(N, W);
1378
+ return C(N, W);
1379
1379
  }
1380
- const x = {
1380
+ const j = {
1381
1381
  ...W,
1382
1382
  headers: {
1383
1383
  ...W.headers,
1384
1384
  ...R ? { Authorization: `Bearer ${R}` } : {}
1385
1385
  }
1386
1386
  };
1387
- return j(N, x);
1388
- }, r = (I) => (j, N) => {
1387
+ return C(N, j);
1388
+ }, r = (I) => (C, N) => {
1389
1389
  if (N.headers.Authorization)
1390
- return I(j, N);
1391
- const W = localStorage.getItem("__anon_id"), R = btoa(`${W}:`), x = {
1390
+ return I(C, N);
1391
+ const W = localStorage.getItem("__anon_id"), R = btoa(`${W}:`), j = {
1392
1392
  ...N,
1393
1393
  headers: {
1394
1394
  ...N.headers,
1395
1395
  Authorization: `Basic ${R}`
1396
1396
  }
1397
1397
  };
1398
- return I(j, x);
1398
+ return I(C, j);
1399
1399
  }, i = oe(e).headers({ "Content-Type": "application/json" }).middlewares([
1400
1400
  n(),
1401
1401
  Vt(),
1402
1402
  Yt({
1403
1403
  delayTimer: 1e3,
1404
- delayRamp: (I, j) => I * j,
1404
+ delayRamp: (I, C) => I * C,
1405
1405
  maxAttempts: 3,
1406
1406
  until: (I) => !!(I && (I.ok || I.status >= 400 && I.status < 500)),
1407
1407
  retryOnNetworkError: !1
@@ -1412,7 +1412,7 @@ function hi(t) {
1412
1412
  Vt(),
1413
1413
  Yt({
1414
1414
  delayTimer: 1e3,
1415
- delayRamp: (I, j) => I * j,
1415
+ delayRamp: (I, C) => I * C,
1416
1416
  maxAttempts: 3,
1417
1417
  until: (I) => !!(I && (I.ok || I.status >= 400 && I.status < 500)),
1418
1418
  retryOnNetworkError: !1
@@ -1422,8 +1422,8 @@ function hi(t) {
1422
1422
  return i.get("/entitlements").json();
1423
1423
  }
1424
1424
  async function s(I) {
1425
- const j = await i.get("/entitlements").json();
1426
- return j == null ? void 0 : j.find((N) => N.id === I);
1425
+ const C = await i.get("/entitlements").json();
1426
+ return C == null ? void 0 : C.find((N) => N.id === I);
1427
1427
  }
1428
1428
  async function p(I) {
1429
1429
  return i.get(`/entitlements/${I}/access`).json();
@@ -1432,18 +1432,18 @@ function hi(t) {
1432
1432
  return i.get("/contracts").json();
1433
1433
  }
1434
1434
  async function u(I) {
1435
- const j = await i.get("/contracts").json();
1436
- return j == null ? void 0 : j.find((N) => N.id === I);
1435
+ const C = await i.get("/contracts").json();
1436
+ return C == null ? void 0 : C.find((N) => N.id === I);
1437
1437
  }
1438
1438
  async function c() {
1439
1439
  return i.get("/bills").json();
1440
1440
  }
1441
1441
  async function h(I) {
1442
- const j = await i.get("/bills").json();
1443
- return j == null ? void 0 : j.find((N) => N.id === I);
1442
+ const C = await i.get("/bills").json();
1443
+ return C == null ? void 0 : C.find((N) => N.id === I);
1444
1444
  }
1445
- async function d(I, j) {
1446
- return await i.url(`/user-metadata/${I}`).put(j).json();
1445
+ async function d(I, C) {
1446
+ return await i.url(`/user-metadata/${I}`).put(C).json();
1447
1447
  }
1448
1448
  async function w(I) {
1449
1449
  return (await i.url(`/user-metadata/${I}`).delete().res()).ok;
@@ -1469,17 +1469,17 @@ function hi(t) {
1469
1469
  async function b() {
1470
1470
  return await o.url("/tallies").get().json();
1471
1471
  }
1472
- async function C(I) {
1472
+ async function x(I) {
1473
1473
  return (await o.url(`/tallies/${I}`).delete().res()).ok;
1474
1474
  }
1475
- async function O(I, j) {
1476
- return await o.url(`/tallies/${I}/push`).post(j).json();
1475
+ async function O(I, C) {
1476
+ return await o.url(`/tallies/${I}/push`).post(C).json();
1477
1477
  }
1478
1478
  async function A(I) {
1479
1479
  return await i.url(`/products/${I}`).get().json();
1480
1480
  }
1481
1481
  async function Z(I) {
1482
- return await i.url(`/products/${I}/auto-onboard`).post().json();
1482
+ return i.url(`/products/${I}/auto-onboard`).post().json();
1483
1483
  }
1484
1484
  return {
1485
1485
  getEntitlements: a,
@@ -1498,7 +1498,7 @@ function hi(t) {
1498
1498
  setTag: y,
1499
1499
  getTally: l,
1500
1500
  getTallies: b,
1501
- deleteTally: C,
1501
+ deleteTally: x,
1502
1502
  pushTally: O,
1503
1503
  getProduct: A,
1504
1504
  autoOnboardProduct: Z
@@ -1967,8 +1967,8 @@ function Qn(t, e, n) {
1967
1967
  var h = s.actions[c], d = h.plugin, w = h.payload.type, k = i[d][w];
1968
1968
  if (k && G(k)) {
1969
1969
  var v, _ = function(l, b) {
1970
- return l === void 0 && (l = {}), b === void 0 && (b = {}), [te, ke].reduce(function(C, O) {
1971
- return l.hasOwnProperty(O) && b[O] && b[O] !== l[O] && (C[O] = b[O]), C;
1970
+ return l === void 0 && (l = {}), b === void 0 && (b = {}), [te, ke].reduce(function(x, O) {
1971
+ return l.hasOwnProperty(O) && b[O] && b[O] !== l[O] && (x[O] = b[O]), x;
1972
1972
  }, l);
1973
1973
  }(h.payload, p), S = r[_.meta.rid];
1974
1974
  if (!S && (v = k({ payload: _, config: a[d].config, instance: n, abort: Di })) && F(v) && v.abort)
@@ -1997,16 +1997,16 @@ var ft = function(t) {
1997
1997
  }));
1998
1998
  var w = /* @__PURE__ */ function(v, _) {
1999
1999
  return function(S, y, l) {
2000
- var b = y.config, C = y.name, O = C + "." + S.type;
2000
+ var b = y.config, x = y.name, O = x + "." + S.type;
2001
2001
  l && (O = l.event);
2002
- var A = S.type.match(_e) ? /* @__PURE__ */ function(Z, I, j, N, W) {
2003
- return function(R, x) {
2004
- var J = N ? N.name : Z, X = x && Ze(x) ? x : j;
2005
- if (N && (!(X = x && Ze(x) ? x : [Z]).includes(Z) || X.length !== 1))
2002
+ var A = S.type.match(_e) ? /* @__PURE__ */ function(Z, I, C, N, W) {
2003
+ return function(R, j) {
2004
+ var J = N ? N.name : Z, X = j && Ze(j) ? j : C;
2005
+ if (N && (!(X = j && Ze(j) ? j : [Z]).includes(Z) || X.length !== 1))
2006
2006
  throw new Error("Method " + I + " can only abort " + Z + " plugin. " + JSON.stringify(X) + " input valid");
2007
2007
  return P({}, W, { abort: { reason: R, plugins: X, caller: I, _: J } });
2008
2008
  };
2009
- }(C, O, _, l, S) : /* @__PURE__ */ function(Z, I) {
2009
+ }(x, O, _, l, S) : /* @__PURE__ */ function(Z, I) {
2010
2010
  return function() {
2011
2011
  throw new Error(Z.type + " action not cancellable. Remove abort in " + I);
2012
2012
  };
@@ -2024,25 +2024,25 @@ var ft = function(t) {
2024
2024
  function b() {
2025
2025
  return Promise.resolve(l);
2026
2026
  }
2027
- var C = function() {
2027
+ var x = function() {
2028
2028
  if (e.namespaced && e.namespaced[y])
2029
2029
  return Promise.resolve(e.namespaced[y].reduce(function(O, A, Z) {
2030
2030
  try {
2031
2031
  return Promise.resolve(O).then(function(I) {
2032
- return A.method && G(A.method) ? (function(R, x) {
2032
+ return A.method && G(A.method) ? (function(R, j) {
2033
2033
  var J = pn(R);
2034
- if (J && J.name === x) {
2034
+ if (J && J.name === j) {
2035
2035
  var X = pn(J.method);
2036
- throw new Error([x + " plugin is calling method " + R, "Plugins cant call self", "Use " + J.method + " " + (X ? "or " + X.method : "") + " in " + x + " plugin insteadof " + R].join(`
2036
+ throw new Error([j + " plugin is calling method " + R, "Plugins cant call self", "Use " + J.method + " " + (X ? "or " + X.method : "") + " in " + j + " plugin insteadof " + R].join(`
2037
2037
  `));
2038
2038
  }
2039
- }(A.methodName, A.pluginName), Promise.resolve(A.method({ payload: I, instance: r, abort: (j = I, N = y, W = A.pluginName, function(R, x) {
2040
- return P({}, j, { abort: { reason: R, plugins: x || [N], caller: c, from: W || N } });
2039
+ }(A.methodName, A.pluginName), Promise.resolve(A.method({ payload: I, instance: r, abort: (C = I, N = y, W = A.pluginName, function(R, j) {
2040
+ return P({}, C, { abort: { reason: R, plugins: j || [N], caller: c, from: W || N } });
2041
2041
  }), config: ln(A.pluginName, f, o), plugins: f })).then(function(R) {
2042
- var x = F(R) ? R : {};
2043
- return Promise.resolve(P({}, I, x));
2042
+ var j = F(R) ? R : {};
2043
+ return Promise.resolve(P({}, I, j));
2044
2044
  })) : I;
2045
- var j, N, W;
2045
+ var C, N, W;
2046
2046
  });
2047
2047
  } catch (I) {
2048
2048
  return Promise.reject(I);
@@ -2052,7 +2052,7 @@ var ft = function(t) {
2052
2052
  });
2053
2053
  l[y] = n;
2054
2054
  }();
2055
- return C && C.then ? C.then(b) : b();
2055
+ return x && x.then ? x.then(b) : b();
2056
2056
  });
2057
2057
  } catch (l) {
2058
2058
  return Promise.reject(l);
@@ -2060,7 +2060,7 @@ var ft = function(t) {
2060
2060
  }, Promise.resolve({}))).then(function(v) {
2061
2061
  return Promise.resolve(e.exact.reduce(function(_, S, y) {
2062
2062
  try {
2063
- var l = e.exact.length === y + 1, b = S.pluginName, C = o[b];
2063
+ var l = e.exact.length === y + 1, b = S.pluginName, x = o[b];
2064
2064
  return Promise.resolve(_).then(function(O) {
2065
2065
  var A = v[b] ? v[b] : {};
2066
2066
  if (h && (A = O), mt(A, b))
@@ -2070,8 +2070,8 @@ var ft = function(t) {
2070
2070
  if (k.hasOwnProperty(b) && k[b] === !0)
2071
2071
  return s.dispatch({ type: "queue", plugin: b, payload: A, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(O);
2072
2072
  var Z = w(v[b], o[b]);
2073
- return Promise.resolve(C[c]({ abort: Z.abort, payload: A, instance: r, config: ln(b, f, o), plugins: f })).then(function(I) {
2074
- var j = F(I) ? I : {}, N = P({}, O, j), W = v[b];
2073
+ return Promise.resolve(x[c]({ abort: Z.abort, payload: A, instance: r, config: ln(b, f, o), plugins: f })).then(function(I) {
2074
+ var C = F(I) ? I : {}, N = P({}, O, C), W = v[b];
2075
2075
  if (mt(W, b))
2076
2076
  pt({ data: W, method: c, instance: r, pluginName: b, store: s });
2077
2077
  else {
@@ -2162,13 +2162,13 @@ function Li(t, e, n) {
2162
2162
  }).map(function(l) {
2163
2163
  return h[l];
2164
2164
  }), k = [], v = [], _ = a.disabled, S = w.map(function(l) {
2165
- var b = l.loaded, C = l.name, O = l.config;
2165
+ var b = l.loaded, x = l.name, O = l.config;
2166
2166
  return qn(l, function() {
2167
2167
  return b({ config: O });
2168
2168
  }, 1e4).then(function(A) {
2169
- return r[C] || (i.dispatch({ type: T.pluginReadyType(C), name: C, events: Object.keys(l).filter(function(Z) {
2169
+ return r[x] || (i.dispatch({ type: T.pluginReadyType(x), name: x, events: Object.keys(l).filter(function(Z) {
2170
2170
  return !_t.includes(Z);
2171
- }) }), r[C] = !0), k = k.concat(C), l;
2171
+ }) }), r[x] = !0), k = k.concat(x), l;
2172
2172
  }).catch(function(A) {
2173
2173
  if (A instanceof Error)
2174
2174
  throw new Error(A);
@@ -2186,12 +2186,12 @@ function Li(t, e, n) {
2186
2186
  if (f !== T.bootstrap)
2187
2187
  return /^ready:([^:]*)$/.test(f) && setTimeout(function() {
2188
2188
  return Qn(i, e, t);
2189
- }, 0), Promise.resolve(function(l, b, C, O, A) {
2189
+ }, 0), Promise.resolve(function(l, b, x, O, A) {
2190
2190
  try {
2191
- var Z = G(b) ? b() : b, I = l.type, j = I.replace(_e, "");
2191
+ var Z = G(b) ? b() : b, I = l.type, C = I.replace(_e, "");
2192
2192
  if (l._ && l._.called)
2193
2193
  return Promise.resolve(l);
2194
- var N = C.getState(), W = (J = Z, (X = N.plugins) === void 0 && (X = {}), (Ce = l.options) === void 0 && (Ce = {}), Object.keys(J).filter(function(m) {
2194
+ var N = x.getState(), W = (J = Z, (X = N.plugins) === void 0 && (X = {}), (Ce = l.options) === void 0 && (Ce = {}), Object.keys(J).filter(function(m) {
2195
2195
  var g = Ce.plugins || {};
2196
2196
  return wi(g[m]) ? g[m] : g.all !== !1 && (!X[m] || X[m].enabled !== !1);
2197
2197
  }).map(function(m) {
@@ -2205,7 +2205,7 @@ function Li(t, e, n) {
2205
2205
  }));
2206
2206
  var R = W.map(function(m) {
2207
2207
  return m.name;
2208
- }), x = function(m, g, E) {
2208
+ }), j = function(m, g, E) {
2209
2209
  var $ = hn(m).map(function(z) {
2210
2210
  return dn(z, g);
2211
2211
  });
@@ -2216,11 +2216,11 @@ function Li(t, e, n) {
2216
2216
  return M.length && (z.beforeNS[K] = M), U.length && (z.duringNS[K] = U), q.length && (z.afterNS[K] = q), z;
2217
2217
  }, { before: $[0], beforeNS: {}, during: $[1], duringNS: {}, after: $[2], afterNS: {} });
2218
2218
  }(I, W);
2219
- return Promise.resolve(ft({ action: l, data: { exact: x.before, namespaced: x.beforeNS }, state: N, allPlugins: Z, allMatches: x, instance: C, store: O, EVENTS: A })).then(function(m) {
2219
+ return Promise.resolve(ft({ action: l, data: { exact: j.before, namespaced: j.beforeNS }, state: N, allPlugins: Z, allMatches: j, instance: x, store: O, EVENTS: A })).then(function(m) {
2220
2220
  function g() {
2221
2221
  var z = function() {
2222
2222
  if (I.match(_e))
2223
- return Promise.resolve(ft({ action: P({}, E, { type: j + "End" }), data: { exact: x.after, namespaced: x.afterNS }, state: N, allPlugins: Z, allMatches: x, instance: C, store: O, EVENTS: A })).then(function(D) {
2223
+ return Promise.resolve(ft({ action: P({}, E, { type: C + "End" }), data: { exact: j.after, namespaced: j.afterNS }, state: N, allPlugins: Z, allMatches: j, instance: x, store: O, EVENTS: A })).then(function(D) {
2224
2224
  D.meta && D.meta.hasCallback && sn(D.meta.rid, { payload: D });
2225
2225
  });
2226
2226
  }();
@@ -2231,8 +2231,8 @@ function Li(t, e, n) {
2231
2231
  if (er(m, R.length))
2232
2232
  return m;
2233
2233
  var E, $ = function() {
2234
- if (I !== j)
2235
- return Promise.resolve(ft({ action: P({}, m, { type: j }), data: { exact: x.during, namespaced: x.duringNS }, state: N, allPlugins: Z, allMatches: x, instance: C, store: O, EVENTS: A })).then(function(z) {
2234
+ if (I !== C)
2235
+ return Promise.resolve(ft({ action: P({}, m, { type: C }), data: { exact: j.during, namespaced: j.duringNS }, state: N, allPlugins: Z, allMatches: j, instance: x, store: O, EVENTS: A })).then(function(z) {
2236
2236
  E = z;
2237
2237
  });
2238
2238
  E = m;
@@ -2502,11 +2502,11 @@ function eo(t) {
2502
2502
  S.anonymousId || (S.anonymousId = ot());
2503
2503
  var y = P({ enable: function(m, g) {
2504
2504
  return new Promise(function(E) {
2505
- x.dispatch({ type: T.enablePlugin, plugins: gt(m), _: { originalAction: T.enablePlugin } }, E, [g]);
2505
+ j.dispatch({ type: T.enablePlugin, plugins: gt(m), _: { originalAction: T.enablePlugin } }, E, [g]);
2506
2506
  });
2507
2507
  }, disable: function(m, g) {
2508
2508
  return new Promise(function(E) {
2509
- x.dispatch({ type: T.disablePlugin, plugins: gt(m), _: { originalAction: T.disablePlugin } }, E, [g]);
2509
+ j.dispatch({ type: T.disablePlugin, plugins: gt(m), _: { originalAction: T.disablePlugin } }, E, [g]);
2510
2510
  });
2511
2511
  } }, r.methods), l = !1, b = { identify: function(m, g, E, $) {
2512
2512
  try {
@@ -2514,7 +2514,7 @@ function eo(t) {
2514
2514
  ye(St(te), z);
2515
2515
  var M = z || D.userId || o(te, b, D);
2516
2516
  return Promise.resolve(new Promise(function(U) {
2517
- x.dispatch(P({ type: T.identifyStart, userId: M, traits: D || {}, options: K, anonymousId: L.anonymousId }, L.id && L.id !== z && { previousId: L.id }), U, [g, E, $]);
2517
+ j.dispatch(P({ type: T.identifyStart, userId: M, traits: D || {}, options: K, anonymousId: L.anonymousId }, L.id && L.id !== z && { previousId: L.id }), U, [g, E, $]);
2518
2518
  }));
2519
2519
  } catch (U) {
2520
2520
  return Promise.reject(U);
@@ -2526,7 +2526,7 @@ function eo(t) {
2526
2526
  throw new Error("EventMissing");
2527
2527
  var D = F(m) ? m : g || {}, K = F(E) ? E : {};
2528
2528
  return Promise.resolve(new Promise(function(L) {
2529
- x.dispatch({ type: T.trackStart, event: z, properties: D, options: K, userId: o(te, b, g), anonymousId: o(ke, b, g) }, L, [g, E, $]);
2529
+ j.dispatch({ type: T.trackStart, event: z, properties: D, options: K, userId: o(te, b, g), anonymousId: o(ke, b, g) }, L, [g, E, $]);
2530
2530
  }));
2531
2531
  } catch (L) {
2532
2532
  return Promise.reject(L);
@@ -2535,7 +2535,7 @@ function eo(t) {
2535
2535
  try {
2536
2536
  var $ = F(m) ? m : {}, z = F(g) ? g : {};
2537
2537
  return Promise.resolve(new Promise(function(D) {
2538
- x.dispatch({ type: T.pageStart, properties: Hi($), options: z, userId: o(te, b, $), anonymousId: o(ke, b, $) }, D, [m, g, E]);
2538
+ j.dispatch({ type: T.pageStart, properties: Hi($), options: z, userId: o(te, b, $), anonymousId: o(ke, b, $) }, D, [m, g, E]);
2539
2539
  }));
2540
2540
  } catch (D) {
2541
2541
  return Promise.reject(D);
@@ -2549,7 +2549,7 @@ function eo(t) {
2549
2549
  return m ? qt(g, m) : g;
2550
2550
  }, reset: function(m) {
2551
2551
  return new Promise(function(g) {
2552
- x.dispatch({ type: T.resetStart }, g, m);
2552
+ j.dispatch({ type: T.resetStart }, g, m);
2553
2553
  });
2554
2554
  }, ready: function(m) {
2555
2555
  return l && m({ plugins: y, instance: b }), b.on(T.ready, function(g) {
@@ -2599,21 +2599,21 @@ function eo(t) {
2599
2599
  });
2600
2600
  return E;
2601
2601
  }, getState: function(m) {
2602
- var g = x.getState();
2602
+ var g = j.getState();
2603
2603
  return m ? qt(g, m) : Object.assign({}, g);
2604
2604
  }, dispatch: function(m) {
2605
2605
  var g = re(m) ? { type: m } : m;
2606
2606
  if (Be.includes(g.type))
2607
2607
  throw new Error("reserved action " + g.type);
2608
2608
  var E = P({}, g, { _: P({ originalAction: g.type }, m._ || {}) });
2609
- x.dispatch(E);
2609
+ j.dispatch(E);
2610
2610
  }, enablePlugin: y.enable, disablePlugin: y.disable, plugins: y, storage: { getItem: i.getItem, setItem: function(m, g, E) {
2611
- x.dispatch({ type: T.setItemStart, key: m, value: g, options: E });
2611
+ j.dispatch({ type: T.setItemStart, key: m, value: g, options: E });
2612
2612
  }, removeItem: function(m, g) {
2613
- x.dispatch({ type: T.removeItemStart, key: m, options: g });
2613
+ j.dispatch({ type: T.removeItemStart, key: m, options: g });
2614
2614
  } }, setAnonymousId: function(m, g) {
2615
2615
  b.storage.setItem(ie, m, g);
2616
- }, events: { core: Be, plugins: s } }, C = r.middlewares.concat([function(m) {
2616
+ }, events: { core: Be, plugins: s } }, x = r.middlewares.concat([function(m) {
2617
2617
  return function(g) {
2618
2618
  return function(E) {
2619
2619
  return E.meta || (E.meta = wn()), g(E);
@@ -2626,14 +2626,14 @@ function eo(t) {
2626
2626
  return arguments.length === 0 ? sr() : F(typeof arguments[0]) ? vn() : vn().apply(null, arguments);
2627
2627
  };
2628
2628
  }
2629
- var j, N = function(m) {
2629
+ var C, N = function(m) {
2630
2630
  return Object.keys(m).reduce(function(g, E) {
2631
2631
  return Bi.includes(E) || (g[E] = m[E]), g;
2632
2632
  }, {});
2633
2633
  }(t), W = r.pluginsArray.reduce(function(m, g) {
2634
2634
  var E = g.name, $ = g.config, z = g.loaded, D = r.pluginEnabled[E];
2635
2635
  return m[E] = { enabled: D, initialized: !!D && !g.initialize, loaded: !!z({ config: $ }), config: $ }, m;
2636
- }, {}), R = { context: N, user: S, plugins: W }, x = Bn(function(m) {
2636
+ }, {}), R = { context: N, user: S, plugins: W }, j = Bn(function(m) {
2637
2637
  for (var g = Object.keys(m), E = {}, $ = 0; $ < g.length; $++) {
2638
2638
  var z = g[$];
2639
2639
  typeof m[z] === ne && (E[z] = m[z]);
@@ -2663,28 +2663,28 @@ function eo(t) {
2663
2663
  }
2664
2664
  return U ? q : L;
2665
2665
  };
2666
- }(P({}, O, e)), R, Z(A(Ai.apply(void 0, C))));
2667
- x.dispatch = (j = x.dispatch, function(m, g, E) {
2666
+ }(P({}, O, e)), R, Z(A(Ai.apply(void 0, x))));
2667
+ j.dispatch = (C = j.dispatch, function(m, g, E) {
2668
2668
  var $ = P({}, m, { meta: wn(m.meta, g, gt(E)) });
2669
- return j.apply(null, [$]);
2669
+ return C.apply(null, [$]);
2670
2670
  });
2671
2671
  var J = Object.keys(a);
2672
- x.dispatch({ type: T.bootstrap, plugins: J, config: N, params: v, user: S, initialUser: n, persistedUser: _ });
2672
+ j.dispatch({ type: T.bootstrap, plugins: J, config: N, params: v, user: S, initialUser: n, persistedUser: _ });
2673
2673
  var X = J.filter(function(m) {
2674
2674
  return r.pluginEnabled[m];
2675
2675
  }), Ce = J.filter(function(m) {
2676
2676
  return !r.pluginEnabled[m];
2677
2677
  });
2678
- return x.dispatch({ type: T.registerPlugins, plugins: J, enabled: r.pluginEnabled }), r.pluginsArray.map(function(m, g) {
2678
+ return j.dispatch({ type: T.registerPlugins, plugins: J, enabled: r.pluginEnabled }), r.pluginsArray.map(function(m, g) {
2679
2679
  var E = m.bootstrap, $ = m.config, z = m.name;
2680
- E && G(E) && E({ instance: b, config: $, payload: m }), x.dispatch({ type: T.registerPluginType(z), name: z, enabled: r.pluginEnabled[z], plugin: m }), r.pluginsArray.length === g + 1 && x.dispatch({ type: T.initializeStart, plugins: X, disabled: Ce });
2680
+ E && G(E) && E({ instance: b, config: $, payload: m }), j.dispatch({ type: T.registerPluginType(z), name: z, enabled: r.pluginEnabled[z], plugin: m }), r.pluginsArray.length === g + 1 && j.dispatch({ type: T.initializeStart, plugins: X, disabled: Ce });
2681
2681
  }), Qi(function(m) {
2682
- x.dispatch({ type: m ? T.offline : T.online });
2682
+ j.dispatch({ type: m ? T.offline : T.online });
2683
2683
  }), function(m, g, E) {
2684
2684
  setInterval(function() {
2685
2685
  return Qn(m, g, E);
2686
2686
  }, 3e3);
2687
- }(x, u, b), b;
2687
+ }(j, u, b), b;
2688
2688
  }
2689
2689
  var He = "before", Ve = "after", Ue = "cookie", ue = lr(), cr = at, to = at;
2690
2690
  function ur(t) {
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "registry": "https://registry.npmjs.org/",
7
7
  "tag": "latest"
8
8
  },
9
- "version": "1.5.0",
9
+ "version": "1.5.1",
10
10
  "main": "dist/sesamy-js.cjs",
11
11
  "module": "dist/sesamy-js.mjs",
12
12
  "types": "dist/sesamy-js.d.ts",