@telia-ace/widget-services 1.0.26-next.4 → 1.0.26-next.6

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.js CHANGED
@@ -1,262 +1,374 @@
1
- var R = Object.defineProperty;
1
+ var q = Object.defineProperty;
2
2
  var V = Object.getOwnPropertySymbols;
3
- var B = Object.prototype.hasOwnProperty, F = Object.prototype.propertyIsEnumerable;
4
- var J = (e, t, n) => t in e ? R(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, f = (e, t) => {
5
- for (var n in t || (t = {}))
6
- B.call(t, n) && J(e, n, t[n]);
3
+ var B = Object.prototype.hasOwnProperty, G = Object.prototype.propertyIsEnumerable;
4
+ var W = (n, e, t) => e in n ? q(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, p = (n, e) => {
5
+ for (var t in e || (e = {}))
6
+ B.call(e, t) && W(n, t, e[t]);
7
7
  if (V)
8
- for (var n of V(t))
9
- F.call(t, n) && J(e, n, t[n]);
10
- return e;
8
+ for (var t of V(e))
9
+ G.call(e, t) && W(n, t, e[t]);
10
+ return n;
11
11
  };
12
- var S = (e, t, n) => (J(e, typeof t != "symbol" ? t + "" : t, n), n);
13
- var h = (e, t, n) => new Promise((r, a) => {
14
- var o = (i) => {
12
+ var S = (n, e, t) => new Promise((r, s) => {
13
+ var o = (a) => {
15
14
  try {
16
- c(n.next(i));
17
- } catch (m) {
18
- a(m);
15
+ c(t.next(a));
16
+ } catch (g) {
17
+ s(g);
19
18
  }
20
- }, s = (i) => {
19
+ }, i = (a) => {
21
20
  try {
22
- c(n.throw(i));
23
- } catch (m) {
24
- a(m);
21
+ c(t.throw(a));
22
+ } catch (g) {
23
+ s(g);
25
24
  }
26
- }, c = (i) => i.done ? r(i.value) : Promise.resolve(i.value).then(o, s);
27
- c((n = n.apply(e, t)).next());
25
+ }, c = (a) => a.done ? r(a.value) : Promise.resolve(a.value).then(o, i);
26
+ c((t = t.apply(n, e)).next());
28
27
  });
29
- import { Logger as g, lock as p, deepClone as q, hash as W } from "@telia-ace/widget-utilities";
30
- var l = /* @__PURE__ */ ((e) => (e.Cookie = "cookie", e.Local = "local", e.Session = "session", e))(l || {}), $ = /* @__PURE__ */ ((e) => (e.Tenant = "tenant", e.Implementation = "implementation", e.Widget = "widget", e))($ || {}), d = /* @__PURE__ */ ((e) => (e.Necessary = "necessary", e.Functional = "functional", e.Analytical = "analytical", e.Marketing = "marketing", e))(d || {});
31
- const z = (e, t, n, r = {}) => L(e, n).then((a) => (process.env.NODE_ENV !== "production" && a && g.warn(
28
+ import { Logger as l, lock as f, deepClone as H, hash as L } from "@telia-ace/widget-utilities";
29
+ var u = /* @__PURE__ */ ((n) => (n.Cookie = "cookie", n.Local = "local", n.Session = "session", n))(u || {}), C = /* @__PURE__ */ ((n) => (n.Tenant = "tenant", n.Implementation = "implementation", n.Widget = "widget", n))(C || {}), m = /* @__PURE__ */ ((n) => (n.Necessary = "necessary", n.Functional = "functional", n.Analytical = "analytical", n.Marketing = "marketing", n))(m || {});
30
+ const Q = (n, e, t, r = {}) => j(n, t).then((s) => (process.env.NODE_ENV !== "production" && s && l.warn(
32
31
  `createStorageWriter: Attempted to create storage writer using unallowed category.
33
- Key: ${t}
34
- Category: ${JSON.stringify(n)}
32
+ Key: ${e}
33
+ Category: ${JSON.stringify(t)}
35
34
  Options: ${JSON.stringify(r)}`
36
- ), (o) => (k(e), L(e, n).then((s) => {
37
- if (s) {
38
- process.env.NODE_ENV !== "production" && g.warn(
35
+ ), (o) => (T(n), j(n, t).then((i) => {
36
+ if (i) {
37
+ process.env.NODE_ENV !== "production" && l.warn(
39
38
  `storageWriter: Attempted to write to storage using unallowed category.
40
- Key: ${t}
41
- Category: ${JSON.stringify(n)}
39
+ Key: ${e}
40
+ Category: ${JSON.stringify(t)}
42
41
  Value: ${JSON.stringify(o)}
43
42
  Options: ${JSON.stringify(r)}`
44
43
  );
45
44
  return;
46
45
  }
47
46
  const {
48
- scope: c = $.Widget,
49
- medium: i = l.Session,
50
- duration: m
51
- } = r, u = Q();
52
- return u[c][t] = T(o, n, m), i === l.Cookie ? ee(e, u) : ne(e, i, u);
53
- })))), G = (e, t, n = l.Session) => (k(e), typeof t == "undefined" ? (process.env.NODE_ENV !== "production" && g.warn("readStorage: Undefined key passed when reading storage. ", t, n), Promise.resolve(void 0)) : n === l.Cookie ? Z(e).then((r) => v(r, t)) : te(e, n).then((r) => v(r, t))), y = (e) => !!Object.entries(e).filter(([t, n]) => typeof n != "undefined").length, _ = (e) => Object.entries(e).filter(([t, n]) => typeof n != "undefined").forEach(([t, { value: n }]) => {
54
- typeof n == "undefined" && delete e[t];
55
- }), U = (e, t) => {
56
- const n = {
57
- tenant: f(f({}, e.tenant), t.tenant),
58
- implementation: f(f({}, e.implementation), t.implementation),
59
- widget: f(f({}, e.widget), t.widget)
47
+ scope: c = C.Widget,
48
+ medium: a = u.Session,
49
+ duration: g
50
+ } = r, d = Z();
51
+ return d[c][e] = x(o, t, g), a === u.Cookie ? re(n, d) : se(n, a, d);
52
+ })))), X = (n, e, t = u.Session) => (T(n), typeof e == "undefined" ? (process.env.NODE_ENV !== "production" && l.warn("readStorage: Undefined key passed when reading storage. ", e, t), Promise.resolve(void 0)) : t === u.Cookie ? ne(n).then((r) => $(r, e)) : oe(n, t).then((r) => $(r, e))), h = (n) => !!Object.entries(n).filter(([e, t]) => typeof t != "undefined").length, b = (n) => Object.entries(n).filter(([e, t]) => typeof t != "undefined").forEach(([e, { value: t }]) => {
53
+ typeof t == "undefined" && delete n[e];
54
+ }), z = (n, e) => {
55
+ const t = {
56
+ tenant: p(p({}, n.tenant), e.tenant),
57
+ implementation: p(p({}, n.implementation), e.implementation),
58
+ widget: p(p({}, n.widget), e.widget)
60
59
  };
61
- return _(n.tenant), _(n.implementation), _(n.widget), n;
62
- }, H = (e) => Object.entries(e).reduce((n, r) => {
63
- const [a, o] = r;
64
- return Object.entries(o).forEach((s) => {
65
- const [c, { expiration: i }] = s;
66
- i && n.push(i);
67
- }), n;
68
- }, []).slice().sort((n, r) => new Date(r).valueOf() - new Date(n).valueOf()).shift() || C(), E = (e) => {
60
+ return b(t.tenant), b(t.implementation), b(t.widget), t;
61
+ }, Y = (n) => Object.entries(n).reduce((t, r) => {
62
+ const [s, o] = r;
63
+ return Object.entries(o).forEach((i) => {
64
+ const [c, { expiration: a }] = i;
65
+ a && t.push(a);
66
+ }), t;
67
+ }, []).slice().sort((t, r) => new Date(r).valueOf() - new Date(t).valueOf()).shift() || P(), E = (n) => {
69
68
  const {
70
- name: t,
71
- implementation: { name: n, tenant: r }
72
- } = e.get("$widget");
69
+ name: e,
70
+ implementation: { name: t, tenant: r }
71
+ } = n.get("$widget");
73
72
  return [
74
73
  `humany_${r}`,
75
- `humany_${W(r + n)}`,
76
- `humany_${W(r + n + t)}`
74
+ `humany_${L(r + t)}`,
75
+ `humany_${L(r + t + e)}`
77
76
  ];
78
- }, b = (e) => {
79
- const t = new RegExp(`(?:^|;)\\s?${e}=(.*?)(?:;|$)`, "i"), n = document.cookie.match(t);
80
- return n && n[1] && JSON.parse(n[1]) || void 0;
81
- }, D = (e, t, n) => {
82
- const r = `${e}=${JSON.stringify(t).trim()}`, a = `expires=${new Date(n).toUTCString()}`, o = "path=/", s = "SameSite=None;Secure";
83
- return document.cookie = `${r}; ${a}; ${o}; ${s}`;
84
- }, x = (e) => {
85
- const [t, n, r] = E(e), a = b(t) || {}, o = b(n) || {}, s = b(r) || {};
77
+ }, I = (n) => {
78
+ const e = new RegExp(`(?:^|;)\\s?${n}=(.*?)(?:;|$)`, "i"), t = document.cookie.match(e);
79
+ return t && t[1] && JSON.parse(t[1]) || void 0;
80
+ }, J = (n, e, t) => {
81
+ const r = `${n}=${JSON.stringify(e).trim()}`, s = `expires=${new Date(t).toUTCString()}`, o = "path=/", i = "SameSite=None;Secure";
82
+ return document.cookie = `${r}; ${s}; ${o}; ${i}`;
83
+ }, _ = (n) => {
84
+ const [e, t, r] = E(n), s = I(e) || {}, o = I(t) || {}, i = I(r) || {};
86
85
  return {
87
- tenant: a,
86
+ tenant: s,
88
87
  implementation: o,
89
- widget: s
88
+ widget: i
90
89
  };
91
- }, M = (e, t) => {
92
- const n = x(e), r = U(n, t), [a, o, s] = E(e), { tenant: c, implementation: i, widget: m } = r, u = H(t), P = C({ days: -1 });
93
- D(a, c, y(c) ? u : P), D(
90
+ }, M = (n, e) => {
91
+ const t = _(n), r = z(t, e), [s, o, i] = E(n), { tenant: c, implementation: a, widget: g } = r, d = Y(e), w = P({ days: -1 });
92
+ J(s, c, h(c) ? d : w), J(
94
93
  o,
95
- i,
96
- y(i) ? u : P
97
- ), D(s, m, y(m) ? u : P);
98
- }, N = (e, t) => {
99
- const [n, r, a] = E(e), o = t.getItem(n) || "{}", s = t.getItem(r) || "{}", c = t.getItem(a) || "{}";
94
+ a,
95
+ h(a) ? d : w
96
+ ), J(i, g, h(g) ? d : w);
97
+ }, O = (n, e) => {
98
+ const [t, r, s] = E(n), o = e.getItem(t) || "{}", i = e.getItem(r) || "{}", c = e.getItem(s) || "{}";
100
99
  return {
101
100
  tenant: JSON.parse(o),
102
- implementation: JSON.parse(s),
101
+ implementation: JSON.parse(i),
103
102
  widget: JSON.parse(c)
104
103
  };
105
- }, K = (e, t, n) => {
106
- const r = N(e, t), a = U(r, n), [o, s, c] = E(e), { tenant: i, implementation: m, widget: u } = a;
107
- y(i) ? t.setItem(o, JSON.stringify(i)) : t.removeItem(o), y(m) ? t.setItem(s, JSON.stringify(m)) : t.removeItem(s), y(u) ? t.setItem(c, JSON.stringify(u)) : t.removeItem(c);
108
- }, Q = () => ({ tenant: {}, implementation: {}, widget: {} }), X = (e) => e ? !!e && new Date() > new Date(e) : !1, v = (e, t) => {
109
- const n = e.widget[t] || e.implementation[t] || e.tenant[t];
110
- return n == null ? void 0 : n.value;
111
- }, T = (e, t, n) => n ? {
112
- value: e,
113
- category: t,
114
- expiration: typeof n == "object" ? C(n) : n
104
+ }, K = (n, e, t) => {
105
+ const r = O(n, e), s = z(r, t), [o, i, c] = E(n), { tenant: a, implementation: g, widget: d } = s;
106
+ h(a) ? e.setItem(o, JSON.stringify(a)) : e.removeItem(o), h(g) ? e.setItem(i, JSON.stringify(g)) : e.removeItem(i), h(d) ? e.setItem(c, JSON.stringify(d)) : e.removeItem(c);
107
+ }, Z = () => ({ tenant: {}, implementation: {}, widget: {} }), ee = (n) => n ? !!n && /* @__PURE__ */ new Date() > new Date(n) : !1, $ = (n, e) => {
108
+ const t = n.widget[e] || n.implementation[e] || n.tenant[e];
109
+ return t == null ? void 0 : t.value;
110
+ }, x = (n, e, t) => t ? {
111
+ value: n,
112
+ category: e,
113
+ expiration: typeof t == "object" ? P(t) : t
115
114
  } : {
116
- value: e,
117
- category: t
118
- }, w = (e, t) => {
119
- const n = q(e);
120
- return Object.entries(n).forEach(([r, a]) => {
121
- Object.entries(a).forEach(([o, s]) => {
122
- const { expiration: c, category: i } = s;
123
- (X(c) || Y(t, i)) && (a[o] = T(void 0, i, c));
115
+ value: n,
116
+ category: e
117
+ }, v = (n, e) => {
118
+ const t = H(n);
119
+ return Object.entries(t).forEach(([r, s]) => {
120
+ Object.entries(s).forEach(([o, i]) => {
121
+ const { expiration: c, category: a } = i;
122
+ (ee(c) || te(e, a)) && (s[o] = x(void 0, a, c));
124
123
  });
125
- }), n;
126
- }, L = (e, t) => G(e, "storagePolicy", l.Cookie).then(
127
- (n = [d.Necessary]) => !!t && n.indexOf(t) === -1
128
- ), Y = (e = [d.Necessary], t) => !!t && e.indexOf(t) === -1, k = (e) => {
129
- const t = x(e), n = N(e, window.localStorage), r = N(e, sessionStorage), a = v(t, "storagePolicy"), [o, s, c] = [
124
+ }), t;
125
+ }, j = (n, e) => X(n, "storagePolicy", u.Cookie).then(
126
+ (t = [m.Necessary]) => !!e && t.indexOf(e) === -1
127
+ ), te = (n = [m.Necessary], e) => !!e && n.indexOf(e) === -1, T = (n) => {
128
+ const e = _(n), t = O(n, window.localStorage), r = O(n, sessionStorage), s = $(e, "storagePolicy"), [o, i, c] = [
129
+ e,
130
130
  t,
131
- n,
132
131
  r
133
- ].map((i) => w(i, a));
134
- M(e, o), K(e, window.localStorage, s), K(e, window.sessionStorage, c);
135
- }, C = (e = { days: 30 }) => {
136
- const { days: t = 0, hours: n = 0, minutes: r = 0, seconds: a = 0 } = e, o = new Date();
137
- return o.setTime(o.getTime() + n * 60 * 60 * 1e3), o.setTime(o.getTime() + t * 24 * 60 * 60 * 1e3), o.setTime(o.getTime() + r * 60 * 1e3), o.setTime(o.getTime() + a * 1e3), o.toISOString();
138
- }, Z = (e) => p(document)(() => x(e)), ee = (e, t) => p(document)(() => M(e, t)), te = (e, t) => {
139
- const n = t === l.Local ? window.localStorage : window.sessionStorage;
140
- return p(n)(() => N(e, n));
141
- }, ne = (e, t, n) => {
142
- const r = t === l.Local ? window.localStorage : window.sessionStorage;
143
- return p(r)(() => K(e, r, n));
132
+ ].map((a) => v(a, s));
133
+ M(n, o), K(n, window.localStorage, i), K(n, window.sessionStorage, c);
134
+ }, P = (n = { days: 30 }) => {
135
+ const { days: e = 0, hours: t = 0, minutes: r = 0, seconds: s = 0 } = n, o = /* @__PURE__ */ new Date();
136
+ return o.setTime(o.getTime() + t * 60 * 60 * 1e3), o.setTime(o.getTime() + e * 24 * 60 * 60 * 1e3), o.setTime(o.getTime() + r * 60 * 1e3), o.setTime(o.getTime() + s * 1e3), o.toISOString();
137
+ }, ne = (n) => f(document)(() => _(n)), re = (n, e) => f(document)(() => M(n, e)), oe = (n, e) => {
138
+ const t = e === u.Local ? window.localStorage : window.sessionStorage;
139
+ return f(t)(() => O(n, t));
140
+ }, se = (n, e, t) => {
141
+ const r = e === u.Local ? window.localStorage : window.sessionStorage;
142
+ return f(r)(() => K(n, r, t));
144
143
  };
145
- class I {
144
+ class k {
146
145
  constructor() {
147
- S(this, "memory", {
146
+ this.memory = {
148
147
  tenant: {},
149
148
  implementation: {},
150
149
  widget: {}
151
- });
150
+ };
152
151
  }
153
- setItem(a, o) {
154
- return h(this, arguments, function* (t, n, r = {}) {
155
- return p(this)(() => {
156
- const s = w(this.memory, [d.Necessary]), { scope: c = $.Tenant, expiration: i } = r;
157
- s[c][t] = T(
158
- n,
159
- d.Necessary,
160
- (i == null ? void 0 : i.toISOString()) || C()
161
- ), this.memory = s, process.env.NODE_ENV !== "production" && g.warn(
152
+ setItem(s, o) {
153
+ return S(this, arguments, function* (e, t, r = {}) {
154
+ return f(this)(() => {
155
+ const i = v(this.memory, [m.Necessary]), { scope: c = C.Tenant, expiration: a } = r;
156
+ i[c][e] = x(
157
+ t,
158
+ m.Necessary,
159
+ (a == null ? void 0 : a.toISOString()) || P()
160
+ ), this.memory = i, process.env.NODE_ENV !== "production" && l.warn(
162
161
  `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value stored temporarily in memory.
163
- Key: ${t}
164
- Value: ${JSON.stringify(n)}
162
+ Key: ${e}
163
+ Value: ${JSON.stringify(t)}
165
164
  Options: ${JSON.stringify(r)}
166
- Memory: ${JSON.stringify(s)}`
165
+ Memory: ${JSON.stringify(i)}`
167
166
  );
168
167
  });
169
168
  });
170
169
  }
171
- getItem(t) {
172
- return h(this, null, function* () {
173
- return p(this)(() => {
174
- const n = w(this.memory, [d.Necessary]);
175
- process.env.NODE_ENV !== "production" && g.warn(
170
+ getItem(e) {
171
+ return S(this, null, function* () {
172
+ return f(this)(() => {
173
+ const t = v(this.memory, [m.Necessary]);
174
+ process.env.NODE_ENV !== "production" && l.warn(
176
175
  `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value fetched from legacy memory storage.
177
- Key: ${t}
178
- Memory: ${JSON.stringify(n)}`
176
+ Key: ${e}
177
+ Memory: ${JSON.stringify(t)}`
179
178
  );
180
- const r = v(n, t);
181
- return this.memory = n, r;
179
+ const r = $(t, e);
180
+ return this.memory = t, r;
182
181
  });
183
182
  });
184
183
  }
185
- removeItem(t) {
186
- return h(this, null, function* () {
187
- return p(this)(() => {
188
- const n = w(this.memory, [d.Necessary]);
189
- delete n.tenant[t], delete n.implementation[t], delete n.widget[t], this.memory = n, process.env.NODE_ENV !== "production" && g.warn(
184
+ removeItem(e) {
185
+ return S(this, null, function* () {
186
+ return f(this)(() => {
187
+ const t = v(this.memory, [m.Necessary]);
188
+ delete t.tenant[e], delete t.implementation[e], delete t.widget[e], this.memory = t, process.env.NODE_ENV !== "production" && l.warn(
190
189
  `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value removed from memory.
191
- Key: ${t}
192
- Memory: ${JSON.stringify(n)}`
190
+ Key: ${e}
191
+ Memory: ${JSON.stringify(t)}`
193
192
  );
194
193
  });
195
194
  });
196
195
  }
197
196
  clear() {
198
- return h(this, null, function* () {
197
+ return S(this, null, function* () {
199
198
  return Promise.resolve();
200
199
  });
201
200
  }
202
201
  }
203
- class ae {
202
+ class de {
204
203
  constructor() {
205
- S(this, "cookies");
206
- S(this, "session");
207
- S(this, "local");
208
- this.cookies = new I(), this.session = new I(), this.local = new I();
204
+ this.cookies = new k(), this.session = new k(), this.local = new k();
209
205
  }
210
206
  }
211
- globalThis && globalThis.__spreadArrays;
212
- var O;
213
- (function(e) {
214
- e.Implementation = "implementation", e.Widget = "widget";
215
- })(O || (O = {}));
216
- var A;
217
- (function(e) {
218
- e.Pre = "pre", e.Post = "post";
219
- })(A || (A = {}));
220
- function j(e, t) {
221
- return typeof e == "undefined" ? t : e;
207
+ const D = (n, e, t, ...r) => {
208
+ const s = `[${n.get("$environment").name || "webprovisions"}] ${t}`;
209
+ switch (e) {
210
+ case "info":
211
+ console.info(s, ...r);
212
+ break;
213
+ case "warning":
214
+ console.warn(s, ...r);
215
+ break;
216
+ case "error":
217
+ console.error(s, ...r);
218
+ break;
219
+ }
220
+ }, ie = (n) => {
221
+ const e = n.container || n;
222
+ return {
223
+ info: (t, ...r) => D(e, "info", t, ...r),
224
+ warn: (t, ...r) => D(e, "warning", t, ...r),
225
+ error: (t, ...r) => D(e, "error", t, ...r)
226
+ };
227
+ };
228
+ var A = /* @__PURE__ */ ((n) => (n.Implementation = "implementation", n.Widget = "widget", n))(A || {}), y = /* @__PURE__ */ ((n) => (n.Pre = "pre", n.Post = "post", n))(y || {});
229
+ const ae = (n, e, t, r) => {
230
+ try {
231
+ const s = new e(t, r);
232
+ return {
233
+ name: n,
234
+ invoke: (o, i) => {
235
+ let c;
236
+ return s[o] && (c = s[o].call(s, i)), Promise.resolve(c);
237
+ },
238
+ getInstance: () => s
239
+ };
240
+ } catch (s) {
241
+ if (s.message && s.message.indexOf("is not a constructor") >= 0)
242
+ return {
243
+ name: n,
244
+ invoke: (o) => {
245
+ let i;
246
+ return o === "initialize" && (i = e(t, r)), Promise.resolve(i);
247
+ },
248
+ getInstance: () => e
249
+ };
250
+ throw s;
251
+ }
252
+ };
253
+ function F(n, e) {
254
+ return typeof n == "undefined" ? e : n;
222
255
  }
223
- var re = function() {
224
- function e(t) {
225
- t === void 0 && (t = {}), this.part = t;
256
+ class ce {
257
+ constructor(e = {}) {
258
+ this.part = e;
226
259
  }
227
- return e.prototype.createCommand = function(t, n, r) {
228
- var a = this, o;
229
- typeof n == "function" ? o = {
230
- scope: O.Widget,
231
- stage: A.Post,
260
+ createCommand(e, t, r) {
261
+ let s;
262
+ typeof t == "function" ? s = {
263
+ scope: A.Widget,
264
+ stage: y.Post,
232
265
  defaultArgs: void 0,
233
- handlerResolver: n
234
- } : o = {
235
- scope: j(n.scope, O.Widget),
236
- stage: j(n.stage, A.Post),
237
- defaultArgs: n.defaultArgs,
266
+ handlerResolver: t
267
+ } : s = {
268
+ scope: F(t.scope, A.Widget),
269
+ stage: F(t.stage, y.Post),
270
+ defaultArgs: t.defaultArgs,
238
271
  handlerResolver: r
239
272
  };
240
- var s = this.part, c = t.split(".");
241
- return c.forEach(function(i, m) {
242
- var u = m === c.length - 1;
243
- u ? s[i] || (s[i] = function() {
244
- return o;
245
- }) : s = a.part[i] = a.part[i] || {};
273
+ let o = this.part;
274
+ const i = e.split(".");
275
+ return i.forEach((c, a) => {
276
+ a === i.length - 1 ? o[c] || (o[c] = () => s) : o = this.part[c] = this.part[c] || {};
246
277
  }), this;
247
- }, e.prototype.get = function() {
278
+ }
279
+ get() {
248
280
  return this.part;
249
- }, e;
250
- }(), oe = function(e) {
251
- var t = new re({});
252
- return e(t), t.get();
281
+ }
282
+ }
283
+ const R = (n) => {
284
+ const e = new ce({});
285
+ return n(e), e.get();
253
286
  };
254
- const ce = oe((e) => {
255
- e.createCommand("storage", (t) => (n = {}) => {
256
- const { consent: r } = n;
287
+ R((n) => {
288
+ n.createCommand(
289
+ "types.register",
290
+ { scope: A.Implementation, stage: y.Pre },
291
+ (e) => (t, r) => {
292
+ e.container.get("$types")[t] = r;
293
+ }
294
+ ).createCommand(
295
+ "type",
296
+ { stage: y.Pre },
297
+ (e) => (t) => {
298
+ e.container.register("$type", t);
299
+ }
300
+ ).createCommand(
301
+ "settings",
302
+ { stage: y.Pre, defaultArgs: [null] },
303
+ (e) => (t) => {
304
+ e.events.dispatch(
305
+ "settings:change",
306
+ t,
307
+ { bubbles: !0 }
308
+ ), e.container.register("$settings", t);
309
+ }
310
+ ).createCommand(
311
+ "plugin",
312
+ { stage: y.Pre },
313
+ (e) => (t, r, s) => {
314
+ const { container: o } = e;
315
+ let i = null, c = t, a = r;
316
+ typeof t == "string" && (i = t, c = r, a = s);
317
+ const g = (d) => {
318
+ const { transformPluginSettings: w } = e.container.get("$environmentOptions"), U = w ? w(
319
+ a || {},
320
+ i,
321
+ e.container,
322
+ c
323
+ ) : r;
324
+ try {
325
+ const N = ae(
326
+ i,
327
+ c,
328
+ o,
329
+ U
330
+ );
331
+ o.get("$plugins").push(N), d && N.invoke("initialize", null);
332
+ } catch (N) {
333
+ ie(e).warn("Error when initializing plugin", N);
334
+ }
335
+ };
336
+ e.container.get("$instance") ? g(!0) : e.events.subscribeOnce("widget:instance-created", () => g(!1));
337
+ }
338
+ ).createCommand(
339
+ "container.register",
340
+ (e) => (t, r) => {
341
+ e.container.register(t, r);
342
+ }
343
+ ).createCommand(
344
+ "container.registerAsync",
345
+ (e) => (t, r) => {
346
+ e.container.registerAsync(t, r);
347
+ }
348
+ ).createCommand(
349
+ "container.registerFactory",
350
+ (e) => (t, r) => {
351
+ e.container.registerFactory(t, r);
352
+ }
353
+ ).createCommand(
354
+ "container.touch",
355
+ (e) => (t, r) => {
356
+ e.container.touch(t, r);
357
+ }
358
+ ).createCommand(
359
+ "csp",
360
+ {},
361
+ (e) => (t) => {
362
+ e.container.register("csp", t);
363
+ }
364
+ );
365
+ });
366
+ const le = R((n) => {
367
+ n.createCommand("storage", (e) => (t = {}) => {
368
+ const { consent: r } = t;
257
369
  if (typeof r != "undefined") {
258
370
  if (typeof r != "number" && typeof r != "string" && !Array.isArray(r)) {
259
- process.env.NODE_ENV !== "production" && g.warn(
371
+ process.env.NODE_ENV !== "production" && l.warn(
260
372
  `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
261
373
  Passed consent: ${JSON.stringify(r)}`
262
374
  );
@@ -265,44 +377,44 @@ const ce = oe((e) => {
265
377
  if (Array.isArray(r) && !r.every(
266
378
  (o) => typeof o == "number" || typeof o == "string"
267
379
  )) {
268
- process.env.NODE_ENV !== "production" && g.warn(
380
+ process.env.NODE_ENV !== "production" && l.warn(
269
381
  `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
270
382
  Passed consent: ${JSON.stringify(r)}`
271
383
  );
272
384
  return;
273
385
  }
274
- const a = [
275
- d.Necessary,
276
- d.Functional,
277
- d.Analytical,
278
- d.Marketing
279
- ].filter((o, s, c) => typeof r == "number" ? r > s : typeof r == "string" ? c.indexOf(r) + 1 > s : Array.isArray(r) ? r.findIndex((i) => i === s + 1 || i === o) > -1 : !0);
280
- return a.indexOf(d.Necessary) === -1 && (process.env.NODE_ENV !== "production" && g.warn(
281
- `storagePolicyConfigurationApi: passed consent does not include category: '${d.Necessary}'. Consent has to atleast include the '${d.Necessary}' category.
386
+ const s = [
387
+ m.Necessary,
388
+ m.Functional,
389
+ m.Analytical,
390
+ m.Marketing
391
+ ].filter((o, i, c) => typeof r == "number" ? r > i : typeof r == "string" ? c.indexOf(r) + 1 > i : Array.isArray(r) ? r.findIndex((a) => a === i + 1 || a === o) > -1 : !0);
392
+ return s.indexOf(m.Necessary) === -1 && (process.env.NODE_ENV !== "production" && l.warn(
393
+ `storagePolicyConfigurationApi: passed consent does not include category: '${m.Necessary}'. Consent has to atleast include the '${m.Necessary}' category.
282
394
  Passed consent: ${JSON.stringify(r)}`
283
- ), a.unshift(d.Necessary)), z(
284
- t.container,
395
+ ), s.unshift(m.Necessary)), Q(
396
+ e.container,
285
397
  "storagePolicy",
286
- d.Necessary,
398
+ m.Necessary,
287
399
  {
288
- medium: l.Cookie,
289
- scope: $.Tenant,
400
+ medium: u.Cookie,
401
+ scope: C.Tenant,
290
402
  duration: { days: 365 }
291
403
  }
292
- ).then((o) => o(a)).then(() => {
293
- k(t.container), t.events.dispatch("storage:policy-changed", a);
404
+ ).then((o) => o(s)).then(() => {
405
+ T(e.container), e.events.dispatch("storage:policy-changed", s);
294
406
  });
295
407
  }
296
408
  });
297
409
  });
298
410
  export {
299
- d as StorageCategory,
300
- l as StorageMedium,
301
- ae as StorageProvider,
302
- $ as StorageScope,
303
- I as StorageService,
304
- z as createStorageWriter,
305
- G as readStorage,
306
- ce as storagePolicyConfigurationApi
411
+ m as StorageCategory,
412
+ u as StorageMedium,
413
+ de as StorageProvider,
414
+ C as StorageScope,
415
+ k as StorageService,
416
+ Q as createStorageWriter,
417
+ X as readStorage,
418
+ le as storagePolicyConfigurationApi
307
419
  };
308
420
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/storage/types.ts","../src/storage/storage.ts","../src/storage/utils.ts","../src/storage/legacy-storage-provider.ts","../../../node_modules/.pnpm/@webprovisions+platform@1.1.2/node_modules/@webprovisions/platform/lib-esm/configuration/configurator.js","../../../node_modules/.pnpm/@webprovisions+platform@1.1.2/node_modules/@webprovisions/platform/lib-esm/configuration/api-builder.js","../src/storage/storage-policy-configuration-api.ts"],"sourcesContent":["export enum StorageMedium {\n Cookie = 'cookie',\n Local = 'local',\n Session = 'session',\n}\n\nexport enum StorageScope {\n Tenant = 'tenant',\n Implementation = 'implementation',\n Widget = 'widget',\n}\n\nexport type Store = {\n tenant: StorageContainer;\n implementation: StorageContainer;\n widget: StorageContainer;\n};\n\nexport type StorageContainer = { [key: string]: StoredValue };\n\nexport type StoredValue = {\n value: any;\n expiration?: string;\n category: StorageCategory;\n};\n\nexport enum StorageCategory {\n Necessary = 'necessary',\n Functional = 'functional',\n Analytical = 'analytical',\n Marketing = 'marketing',\n}\n\nexport type StorageWriter = (value?: any) => Promise<void>;\n\nexport type StorageConfigurationOptions = {\n consent?: StorageConsent;\n};\n\nexport type StorageConsent = number | number[] | StorageCategory | StorageCategory[];\n\nexport type Duration = {\n days?: number;\n hours?: number;\n minutes?: number;\n seconds?: number;\n};\n\nexport type StorageWriterOptions = {\n scope?: StorageScope;\n duration?: Duration;\n medium?: StorageMedium;\n};\n","import { Logger } from '@telia-ace/widget-utilities';\nimport { Container } from '@webprovisions/platform';\nimport {\n StorageCategory,\n StorageMedium,\n StorageScope,\n StorageWriter,\n StorageWriterOptions,\n} from './types';\nimport {\n createEmptyStore,\n createValue,\n getApplicationStoreAsync,\n getCookieStoreAsync,\n getValue,\n isNotAllowedAsync,\n processStorage,\n setApplicationStoreAsync,\n setCookieStoreAsync,\n} from './utils';\n\n/**\n * Creates a writer to be used to write to cookie, local or session storage.\n * @param container Widget Container.\n * @param key Key to use when writing.\n * @param category StorageCategory to use when writing.\n * @param options StorageWriterOptions to use when writing default {scope: StorageScope.Widget, medium = StorageMedium.Session, duration = infinite }.\n * @returns a function to be used to write a value to the storage using given settings.\n */\nexport const createStorageWriter = (\n container: Container,\n key: string,\n category: StorageCategory,\n options: StorageWriterOptions = {}\n): Promise<StorageWriter> => {\n return isNotAllowedAsync(container, category).then((notAllowed) => {\n if (process.env.NODE_ENV !== 'production') {\n if (notAllowed) {\n Logger.warn(\n `createStorageWriter: Attempted to create storage writer using unallowed category.\n Key: ${key}\n Category: ${JSON.stringify(category)}\n Options: ${JSON.stringify(options)}`\n );\n }\n }\n\n return (value: any) => {\n processStorage(container);\n\n return isNotAllowedAsync(container, category).then((notAllowed) => {\n if (notAllowed) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storageWriter: Attempted to write to storage using unallowed category.\n Key: ${key}\n Category: ${JSON.stringify(category)}\n Value: ${JSON.stringify(value)}\n Options: ${JSON.stringify(options)}`\n );\n }\n return;\n }\n\n const {\n scope = StorageScope.Widget,\n medium = StorageMedium.Session,\n duration,\n } = options;\n\n const store = createEmptyStore();\n store[scope][key] = createValue(value, category, duration);\n\n if (medium === StorageMedium.Cookie) return setCookieStoreAsync(container, store);\n else return setApplicationStoreAsync(container, medium, store);\n });\n };\n });\n};\n\n/**\n * Read the widget cookie, local or session storage.\n * @param container Widget Container.\n * @param key Key to read.\n * @param medium Storage medium to read from (default: session).\n * @returns the value stored with passed key.\n */\nexport const readStorage = <Type>(\n container: Container,\n key: string,\n medium: StorageMedium = StorageMedium.Session\n): Promise<Type | undefined> => {\n processStorage(container);\n\n if (typeof key === 'undefined') {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn('readStorage: Undefined key passed when reading storage. ', key, medium);\n }\n return Promise.resolve(undefined);\n }\n\n if (medium === StorageMedium.Cookie)\n return getCookieStoreAsync(container).then((store) => getValue(store, key));\n else return getApplicationStoreAsync(container, medium).then((store) => getValue(store, key));\n};\n","import { deepClone, hash, lock } from '@telia-ace/widget-utilities';\nimport { Container, Widget } from '@webprovisions/platform';\nimport { readStorage } from './storage';\nimport {\n Duration,\n StorageCategory,\n StorageContainer,\n StorageMedium,\n Store,\n StoredValue\n} from './types';\n\nconst hasEntries = (object: object) =>\n !!Object.entries(object).filter(([_, value]) => typeof value !== 'undefined').length;\n\nconst cleanUndefined = (object: StorageContainer) =>\n Object.entries(object)\n .filter(([_, value]) => typeof value !== 'undefined')\n .forEach(([key, { value }]) => {\n if (typeof value === 'undefined') {\n delete object[key];\n }\n });\n\nconst mergeAndClean = (target: Store, source: Store): Store => {\n const merged: Store = {\n tenant: { ...target.tenant, ...source.tenant },\n implementation: { ...target.implementation, ...source.implementation },\n widget: { ...target.widget, ...source.widget }\n };\n\n cleanUndefined(merged.tenant);\n cleanUndefined(merged.implementation);\n cleanUndefined(merged.widget);\n\n return merged;\n};\n\nconst getLongestExpirationDate = (store: Store): string => {\n const expirationDates = Object.entries(store).reduce<string[]>((acc, storeEntry) => {\n const [_, container] = storeEntry;\n Object.entries(container).forEach((containerEntry) => {\n const [_, { expiration }] = containerEntry;\n if (expiration) acc.push(expiration);\n });\n return acc;\n }, []);\n\n return (\n expirationDates\n .slice()\n .sort((a, b) => new Date(b).valueOf() - new Date(a).valueOf())\n .shift() || createExpirationDate()\n );\n};\n\nconst createStorageKeys = (\n container: Container\n): [tenant: string, implementation: string, widget: string] => {\n const {\n name: widgetName,\n implementation: { name: implementationName, tenant: tenantName },\n } = <Widget>container.get('$widget');\n\n return [\n `humany_${tenantName}`,\n `humany_${hash(tenantName + implementationName)}`,\n `humany_${hash(tenantName + implementationName + widgetName)}`,\n ];\n};\n\nconst getCookie = <Type>(cookieName: string): Type | undefined => {\n const regExp = new RegExp(`(?:^|;)\\\\s?${cookieName}=(.*?)(?:;|$)`, 'i');\n const cookie = document.cookie.match(regExp);\n const value = cookie && cookie[1] && JSON.parse(cookie[1]);\n\n return value || undefined;\n};\n\nconst setCookie = (cookieName: string, value: any, expires: string) => {\n const cookie = `${cookieName}=${JSON.stringify(value).trim()}`;\n const expiration = `expires=${new Date(expires).toUTCString()}`;\n const path = 'path=/';\n const options = 'SameSite=None;Secure'\n return (document.cookie = `${cookie}; ${expiration}; ${path}; ${options}`);\n};\n\nconst getCookieStore = (container: Container): Store => {\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const tenant = getCookie<StorageContainer>(tenantKey) || {};\n const implementation = getCookie<StorageContainer>(implementationKey) || {};\n const widget = getCookie<StorageContainer>(widgetKey) || {};\n\n return {\n tenant,\n implementation,\n widget,\n };\n};\n\nconst setCookieStore = (container: Container, store: Store): void => {\n const current = getCookieStore(container);\n const merged = mergeAndClean(current, store);\n\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const { tenant, implementation, widget } = merged;\n const expirationDate = getLongestExpirationDate(store);\n const deleteDate = createExpirationDate({ days: -1 });\n\n setCookie(tenantKey, tenant, hasEntries(tenant) ? expirationDate : deleteDate);\n setCookie(\n implementationKey,\n implementation,\n hasEntries(implementation) ? expirationDate : deleteDate\n );\n setCookie(widgetKey, widget, hasEntries(widget) ? expirationDate : deleteDate);\n};\n\nconst getApplicationStore = (container: Container, storage: Storage): Store => {\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const tenant = storage.getItem(tenantKey) || '{}';\n const implementation = storage.getItem(implementationKey) || '{}';\n const widget = storage.getItem(widgetKey) || '{}';\n\n return {\n tenant: JSON.parse(tenant),\n implementation: JSON.parse(implementation),\n widget: JSON.parse(widget),\n };\n};\n\nconst setApplicationStore = (\n container: Container,\n applicationStorage: Storage,\n store: Store\n): void => {\n const current = getApplicationStore(container, applicationStorage);\n const merged = mergeAndClean(current, store);\n\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const { tenant, implementation, widget } = merged;\n\n hasEntries(tenant)\n ? applicationStorage.setItem(tenantKey, JSON.stringify(tenant))\n : applicationStorage.removeItem(tenantKey);\n hasEntries(implementation)\n ? applicationStorage.setItem(implementationKey, JSON.stringify(implementation))\n : applicationStorage.removeItem(implementationKey);\n hasEntries(widget)\n ? applicationStorage.setItem(widgetKey, JSON.stringify(widget))\n : applicationStorage.removeItem(widgetKey);\n};\n\nexport const createEmptyStore = (): Store => ({ tenant: {}, implementation: {}, widget: {} });\n\nexport const isExpired = (isoDateString?: string) => {\n if (!isoDateString) return false;\n return !!isoDateString && new Date() > new Date(isoDateString);\n};\n\nexport const getValue = <Type>(store: Store, key: string): Type | undefined => {\n const storedValue = store.widget[key] || store.implementation[key] || store.tenant[key];\n return storedValue?.value;\n};\n\nexport const createValue = (\n value: any,\n category: StorageCategory,\n duration?: Duration | string\n): StoredValue => {\n if (duration) {\n return {\n value,\n category,\n expiration: typeof duration === 'object' ? createExpirationDate(duration) : duration,\n };\n }\n return {\n value,\n category,\n };\n};\n\nexport const processStore = (store: Store, policy?: StorageCategory[]): Store => {\n const clone = deepClone(store);\n\n Object.entries(clone).forEach(([_, storageContainer]) => {\n Object.entries(storageContainer).forEach(([key, storedValue]) => {\n const { expiration, category } = storedValue;\n\n if (isExpired(expiration) || isNotAllowed(policy, category))\n storageContainer[key] = createValue(undefined, category, expiration);\n });\n });\n\n return clone;\n};\n\n/**\n * @param category Storage Category.\n * @param policy Current Storage Policy.\n * @returns true if not allowed, false if allowed.\n */\nexport const isNotAllowedAsync = (\n container: Container,\n category?: StorageCategory\n): Promise<boolean> => {\n return readStorage<StorageCategory[]>(container, 'storagePolicy', StorageMedium.Cookie).then(\n (policy = [StorageCategory.Necessary]) => !!category && policy.indexOf(category) === -1\n );\n};\n\n/**\n * @param category Storage Category.\n * @param policy Current Storage Policy.\n * @returns true if not allowed, false if allowed.\n */\nexport const isNotAllowed = (\n policy: StorageCategory[] = [StorageCategory.Necessary],\n category?: StorageCategory\n): boolean => {\n return !!category && policy.indexOf(category) === -1;\n};\n\n/**\n * Processes storage and removes items if they are expired or if\n * the storage policy is defined and the category of the stored\n * value is not allowed.\n * @param container Widget Container\n */\nexport const processStorage = (container: Container): void => {\n const cookieStore = getCookieStore(container);\n const localStore = getApplicationStore(container, window.localStorage);\n const sessionStore = getApplicationStore(container, sessionStorage);\n const policy = getValue<StorageCategory[]>(cookieStore, 'storagePolicy');\n\n const [processedCookieStore, processedLocalStore, processedSessionStore] = [\n cookieStore,\n localStore,\n sessionStore,\n ].map((store) => processStore(store, policy));\n\n setCookieStore(container, processedCookieStore);\n setApplicationStore(container, window.localStorage, processedLocalStore);\n setApplicationStore(container, window.sessionStorage, processedSessionStore);\n};\n\n/**\n * Creates an expiration date string with the passed options.\n * @param options Duration options.\n * @returns ISO formatted date string.\n */\nexport const createExpirationDate = (options: Duration = { days: 30 }): string => {\n const { days = 0, hours = 0, minutes = 0, seconds = 0 } = options;\n const date = new Date();\n date.setTime(date.getTime() + hours * 60 * 60 * 1000);\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n date.setTime(date.getTime() + minutes * 60 * 1000);\n date.setTime(date.getTime() + seconds * 1000);\n return date.toISOString();\n};\n\nexport const getCookieStoreAsync = (container: Container): Promise<Store> => {\n return lock(document)(() => getCookieStore(container));\n};\n\nexport const setCookieStoreAsync = (container: Container, store: Store): Promise<any> => {\n return lock(document)(() => setCookieStore(container, store));\n};\n\nexport const getApplicationStoreAsync = (\n container: Container,\n type: StorageMedium.Local | StorageMedium.Session\n): Promise<Store> => {\n const storage = type === StorageMedium.Local ? window.localStorage : window.sessionStorage;\n return lock(storage)(() => getApplicationStore(container, storage));\n};\n\nexport const setApplicationStoreAsync = (\n container: Container,\n type: StorageMedium.Local | StorageMedium.Session,\n store: Store\n): Promise<void> => {\n const storage = type === StorageMedium.Local ? window.localStorage : window.sessionStorage;\n return lock(storage)(() => setApplicationStore(container, storage, store));\n};\n","import { lock, Logger } from '@telia-ace/widget-utilities';\nimport { StorageCategory } from '.';\nimport { StorageScope, Store } from './types';\nimport { createExpirationDate, createValue, getValue, processStore } from './utils';\n\ntype LegacyOptions = {\n scope?: StorageScope;\n expiration?: Date;\n};\n\ninterface LegacyMedium {\n setItem(key: string, value: any, options?: LegacyOptions): Promise<void>;\n getItem(key: string): Promise<any>;\n removeItem(key: string): Promise<void>;\n clear(): Promise<void>;\n}\n\nexport class LegacyStorage implements LegacyMedium {\n private memory: Store = {\n tenant: {},\n implementation: {},\n widget: {},\n };\n async setItem(key: string, value: any, options: LegacyOptions = {}): Promise<void> {\n return lock(this)(() => {\n const processedStore = processStore(this.memory, [StorageCategory.Necessary]);\n const { scope = StorageScope.Tenant, expiration } = options;\n\n processedStore[scope][key] = createValue(\n value,\n StorageCategory.Necessary,\n expiration?.toISOString() || createExpirationDate()\n );\n this.memory = processedStore;\n\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value stored temporarily in memory.\n Key: ${key}\n Value: ${JSON.stringify(value)}\n Options: ${JSON.stringify(options)}\n Memory: ${JSON.stringify(processedStore)}`\n );\n }\n });\n }\n async getItem(key: string): Promise<any> {\n return lock(this)(() => {\n const processedStore = processStore(this.memory, [StorageCategory.Necessary]);\n\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value fetched from legacy memory storage.\n Key: ${key}\n Memory: ${JSON.stringify(processedStore)}`\n );\n }\n\n const value = getValue(processedStore, key);\n this.memory = processedStore;\n\n return value;\n });\n }\n async removeItem(key: string): Promise<void> {\n return lock(this)(() => {\n const processedStore = processStore(this.memory, [StorageCategory.Necessary]);\n\n delete processedStore.tenant[key];\n delete processedStore.implementation[key];\n delete processedStore.widget[key];\n this.memory = processedStore;\n\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value removed from memory.\n Key: ${key}\n Memory: ${JSON.stringify(processedStore)}`\n );\n }\n });\n }\n async clear(): Promise<void> {\n return Promise.resolve();\n }\n}\n\nexport default class LegacyStorageProvider {\n cookies: LegacyStorage;\n session: LegacyStorage;\n local: LegacyStorage;\n constructor() {\n this.cookies = new LegacyStorage();\n this.session = new LegacyStorage();\n this.local = new LegacyStorage();\n }\n}\n","var __spreadArrays = (this && this.__spreadArrays) || function () {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\nimport { selectWidgets } from '../selectors';\r\nimport ns from '../namespace';\r\nvar internal = ns();\r\nexport var matchInstructions = function (instructions, stage, widget) {\r\n return instructions.filter(function (instruction) {\r\n return instruction.stage === stage\r\n && selectWidgets(instruction.selector)(widget);\r\n });\r\n};\r\nexport function clearContextRoot(contextRoot) {\r\n var environment = contextRoot.container.get('$environment');\r\n var configurationCache = internal(environment).configurationCache;\r\n if (configurationCache) {\r\n configurationCache = configurationCache\r\n .filter(function (item) { return item[0] !== contextRoot; });\r\n internal(environment).configurationCache = configurationCache;\r\n }\r\n}\r\nexport var ConfigurationScope;\r\n(function (ConfigurationScope) {\r\n ConfigurationScope[\"Implementation\"] = \"implementation\";\r\n ConfigurationScope[\"Widget\"] = \"widget\";\r\n})(ConfigurationScope || (ConfigurationScope = {}));\r\nexport var ConfigurationStage;\r\n(function (ConfigurationStage) {\r\n /**\r\n * Configurations to be applied BEFORE a widget is configured.\r\n */\r\n ConfigurationStage[\"Pre\"] = \"pre\";\r\n /**\r\n * Configurations to be applied AFTER a widget is configured\r\n */\r\n ConfigurationStage[\"Post\"] = \"post\";\r\n})(ConfigurationStage || (ConfigurationStage = {}));\r\nvar constructApi = function (target, apiDefinition, applyCommand) {\r\n Object.keys(apiDefinition).forEach(function (key) {\r\n var commandDescriptorOrApiPart = apiDefinition[key];\r\n if (typeof commandDescriptorOrApiPart === 'function') {\r\n var commandDescriptor_1 = commandDescriptorOrApiPart();\r\n if (typeof commandDescriptor_1.defaultArgs !== 'undefined') {\r\n applyCommand.apply(void 0, __spreadArrays([commandDescriptor_1], commandDescriptor_1.defaultArgs));\r\n }\r\n target[key] = (function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var trackedCommandDescriptor = Object.assign({}, commandDescriptor_1, { handlerResolver: commandDescriptor_1.handlerResolver.bind({}) });\r\n applyCommand.apply(void 0, __spreadArrays([trackedCommandDescriptor], args));\r\n return target;\r\n });\r\n }\r\n else {\r\n target[key] = constructApi({}, commandDescriptorOrApiPart, applyCommand);\r\n }\r\n });\r\n return target;\r\n};\r\nvar resolveContextRoot = function (widget, scope) {\r\n switch (scope) {\r\n case ConfigurationScope.Implementation:\r\n return widget.implementation;\r\n case ConfigurationScope.Widget:\r\n return widget;\r\n }\r\n};\r\nvar createConfiguratorObject = function (target, selector, implementation, apiDefinitions) {\r\n apiDefinitions.forEach(function (definition) {\r\n constructApi(target, definition, function (commandDescriptor) {\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n var instruction = {\r\n selector: selector,\r\n stage: commandDescriptor.stage,\r\n handler: function (widget) {\r\n var contextRoot = resolveContextRoot(widget, commandDescriptor.scope);\r\n var context = { container: contextRoot.container, events: contextRoot.events };\r\n var resolveHandler = commandDescriptor.handlerResolver;\r\n var commandHandler = resolveHandler(context);\r\n // The configuration cache prevents the same combination of 'contextRoot' and\r\n // 'commandHandler' to be executed more than once. Let's say a commandHandler\r\n // is scoped to 'Implementation', then it will match all containing widgets, but\r\n // the unique commandHandler instance should be executed only once (else the\r\n // commandHandler will configure the implementation context once for every widget).\r\n var configurationCache = internal(implementation.environment).configurationCache;\r\n if (!configurationCache) {\r\n configurationCache = internal(implementation.environment).configurationCache = [];\r\n }\r\n if (!configurationCache.find(function (item) {\r\n return item.indexOf(contextRoot) > -1 && item.indexOf(resolveHandler) > -1;\r\n })) {\r\n configurationCache.push([contextRoot, resolveHandler]);\r\n return Promise.resolve(commandHandler.apply(void 0, args));\r\n }\r\n },\r\n };\r\n implementation.instructions.push(instruction);\r\n });\r\n });\r\n return target;\r\n};\r\nexport function createConfigurator(implementation, configurationAPIs) {\r\n function configurator(selector) {\r\n return createConfiguratorObject({}, selector, implementation, configurationAPIs);\r\n }\r\n return createConfiguratorObject(configurator, '*', implementation, configurationAPIs);\r\n}\r\n//# sourceMappingURL=configurator.js.map","import { ConfigurationScope, ConfigurationStage } from './configurator';\r\nfunction fallbackIfUndefined(value, fallback) {\r\n if (typeof value === 'undefined') {\r\n return fallback;\r\n }\r\n return value;\r\n}\r\nvar ConfigurationApiBuilder = /** @class */ (function () {\r\n function ConfigurationApiBuilder(part) {\r\n if (part === void 0) { part = {}; }\r\n this.part = part;\r\n }\r\n ConfigurationApiBuilder.prototype.createCommand = function (name, factoryOrOptions, factory) {\r\n var _this = this;\r\n var descriptor;\r\n if (typeof factoryOrOptions === 'function') {\r\n descriptor = {\r\n scope: ConfigurationScope.Widget,\r\n stage: ConfigurationStage.Post,\r\n defaultArgs: undefined,\r\n handlerResolver: factoryOrOptions,\r\n };\r\n }\r\n else {\r\n descriptor = {\r\n scope: fallbackIfUndefined(factoryOrOptions.scope, ConfigurationScope.Widget),\r\n stage: fallbackIfUndefined(factoryOrOptions.stage, ConfigurationStage.Post),\r\n defaultArgs: factoryOrOptions.defaultArgs,\r\n handlerResolver: factory,\r\n };\r\n }\r\n var part = this.part;\r\n var sections = name.split('.');\r\n sections.forEach(function (ns, i) {\r\n var last = i === sections.length - 1;\r\n if (last) {\r\n if (!part[ns]) {\r\n part[ns] = function () { return descriptor; };\r\n }\r\n }\r\n else {\r\n part = (_this.part[ns] = (_this.part[ns] || {}));\r\n }\r\n });\r\n return this;\r\n };\r\n ConfigurationApiBuilder.prototype.get = function () {\r\n return this.part;\r\n };\r\n return ConfigurationApiBuilder;\r\n}());\r\nexport { ConfigurationApiBuilder };\r\nexport var createConfigurationApi = function (factory) {\r\n var builder = new ConfigurationApiBuilder({});\r\n factory(builder);\r\n return builder.get();\r\n};\r\n//# sourceMappingURL=api-builder.js.map","import { Logger } from '@telia-ace/widget-utilities';\nimport { createConfigurationApi } from '@webprovisions/platform';\nimport { createStorageWriter } from './storage';\nimport { StorageCategory, StorageConfigurationOptions, StorageMedium, StorageScope } from './types';\nimport { processStorage } from './utils';\n\nexport default createConfigurationApi((builder) => {\n builder.createCommand('storage', (context) => (options: StorageConfigurationOptions = {}) => {\n const { consent } = options;\n if (typeof consent !== 'undefined') {\n if (\n typeof consent !== 'number' &&\n typeof consent !== 'string' &&\n !Array.isArray(consent)\n ) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.\n Passed consent: ${JSON.stringify(consent)}`\n );\n }\n return;\n }\n\n if (\n Array.isArray(consent) &&\n !(consent as string[]).every(\n (c: any) => typeof c === 'number' || typeof c === 'string'\n )\n ) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.\n Passed consent: ${JSON.stringify(consent)}`\n );\n }\n return;\n }\n\n const policy: StorageCategory[] = [\n StorageCategory.Necessary,\n StorageCategory.Functional,\n StorageCategory.Analytical,\n StorageCategory.Marketing,\n ].filter((category, index, array) => {\n if (typeof consent === 'number') {\n // Passed consent is a category level (number)\n // Include the passed category level and all categories below it\n return consent > index;\n } else if (typeof consent === 'string') {\n // Passed consent is a category (string)\n // Include the passed category and all categories below its level\n return array.indexOf(consent) + 1 > index;\n } else if (Array.isArray(consent)) {\n // Passed consent is an array with category levels (number), categories (string) or both\n // Include all categories in passed array\n return (\n consent.findIndex((c: number | StorageCategory) => {\n return c === index + 1 || c === category;\n }) > -1\n );\n } else {\n return true;\n }\n });\n\n if (policy.indexOf(StorageCategory.Necessary) === -1) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storagePolicyConfigurationApi: passed consent does not include category: '${\n StorageCategory.Necessary\n }'. Consent has to atleast include the '${\n StorageCategory.Necessary\n }' category.\n Passed consent: ${JSON.stringify(consent)}`\n );\n }\n policy.unshift(StorageCategory.Necessary);\n }\n\n return createStorageWriter(\n context.container,\n 'storagePolicy',\n StorageCategory.Necessary,\n {\n medium: StorageMedium.Cookie,\n scope: StorageScope.Tenant,\n duration: { days: 365 },\n }\n )\n .then((write) => write(policy))\n .then(() => {\n processStorage(context.container);\n\n context.events.dispatch('storage:policy-changed', policy);\n });\n }\n });\n});\n"],"names":["StorageMedium","StorageScope","StorageCategory","createStorageWriter","container","key","category","options","isNotAllowedAsync","notAllowed","Logger","value","processStorage","scope","medium","duration","store","createEmptyStore","createValue","setCookieStoreAsync","setApplicationStoreAsync","readStorage","getCookieStoreAsync","getValue","getApplicationStoreAsync","hasEntries","object","_","cleanUndefined","mergeAndClean","target","source","merged","__spreadValues","getLongestExpirationDate","acc","storeEntry","containerEntry","expiration","a","b","createExpirationDate","createStorageKeys","widgetName","implementationName","tenantName","hash","getCookie","cookieName","regExp","cookie","setCookie","expires","path","getCookieStore","tenantKey","implementationKey","widgetKey","tenant","implementation","widget","setCookieStore","current","expirationDate","deleteDate","getApplicationStore","storage","setApplicationStore","applicationStorage","isExpired","isoDateString","storedValue","processStore","policy","clone","deepClone","storageContainer","isNotAllowed","cookieStore","localStore","sessionStore","processedCookieStore","processedLocalStore","processedSessionStore","days","hours","minutes","seconds","date","lock","type","LegacyStorage","__publicField","_0","_1","__async","processedStore","LegacyStorageProvider","this","ConfigurationScope","ConfigurationStage","fallbackIfUndefined","fallback","ConfigurationApiBuilder","part","name","factoryOrOptions","factory","_this","descriptor","sections","ns","i","last","createConfigurationApi","builder","storagePolicyConfigurationApi","context","consent","c","index","array","write"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAY,IAAAA,sBAAAA,OACRA,EAAA,SAAS,UACTA,EAAA,QAAQ,SACRA,EAAA,UAAU,WAHFA,IAAAA,KAAA,CAAA,CAAA,GAMAC,sBAAAA,OACRA,EAAA,SAAS,UACTA,EAAA,iBAAiB,kBACjBA,EAAA,SAAS,UAHDA,IAAAA,KAAA,CAAA,CAAA,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UACtB,OAAOC,EAAa;AAAA,UACpB,UAAU,EAAE,MAAM,IAAI;AAAA,QAC1B;AAAA,MAAA,EAEC,KAAK,CAACyH,MAAUA,EAAMjD,CAAM,CAAC,EAC7B,KAAK,MAAM;AACR,QAAA7D,EAAeyG,EAAQ,SAAS,GAExBA,EAAA,OAAO,SAAS,0BAA0B5C,CAAM;AAAA,MAAA,CAC3D;AAAA,IACT;AAAA,EAAA,CACH;AACL,CAAC;"}
1
+ {"version":3,"file":"index.js","sources":["../src/storage/types.ts","../src/storage/storage.ts","../src/storage/utils.ts","../src/storage/legacy-storage-provider.ts","../../../node_modules/.pnpm/@webprovisions+platform@1.1.3-rc.3/node_modules/@webprovisions/platform/dist/index.js","../src/storage/storage-policy-configuration-api.ts"],"sourcesContent":["export enum StorageMedium {\n Cookie = 'cookie',\n Local = 'local',\n Session = 'session',\n}\n\nexport enum StorageScope {\n Tenant = 'tenant',\n Implementation = 'implementation',\n Widget = 'widget',\n}\n\nexport type Store = {\n tenant: StorageContainer;\n implementation: StorageContainer;\n widget: StorageContainer;\n};\n\nexport type StorageContainer = { [key: string]: StoredValue };\n\nexport type StoredValue = {\n value: any;\n expiration?: string;\n category: StorageCategory;\n};\n\nexport enum StorageCategory {\n Necessary = 'necessary',\n Functional = 'functional',\n Analytical = 'analytical',\n Marketing = 'marketing',\n}\n\nexport type StorageWriter = (value?: any) => Promise<void>;\n\nexport type StorageConfigurationOptions = {\n consent?: StorageConsent;\n};\n\nexport type StorageConsent = number | number[] | StorageCategory | StorageCategory[];\n\nexport type Duration = {\n days?: number;\n hours?: number;\n minutes?: number;\n seconds?: number;\n};\n\nexport type StorageWriterOptions = {\n scope?: StorageScope;\n duration?: Duration;\n medium?: StorageMedium;\n};\n","import { Logger } from '@telia-ace/widget-utilities';\nimport { Container } from '@webprovisions/platform';\nimport {\n StorageCategory,\n StorageMedium,\n StorageScope,\n StorageWriter,\n StorageWriterOptions,\n} from './types';\nimport {\n createEmptyStore,\n createValue,\n getApplicationStoreAsync,\n getCookieStoreAsync,\n getValue,\n isNotAllowedAsync,\n processStorage,\n setApplicationStoreAsync,\n setCookieStoreAsync,\n} from './utils';\n\n/**\n * Creates a writer to be used to write to cookie, local or session storage.\n * @param container Widget Container.\n * @param key Key to use when writing.\n * @param category StorageCategory to use when writing.\n * @param options StorageWriterOptions to use when writing default {scope: StorageScope.Widget, medium = StorageMedium.Session, duration = infinite }.\n * @returns a function to be used to write a value to the storage using given settings.\n */\nexport const createStorageWriter = (\n container: Container,\n key: string,\n category: StorageCategory,\n options: StorageWriterOptions = {}\n): Promise<StorageWriter> => {\n return isNotAllowedAsync(container, category).then((notAllowed) => {\n if (process.env.NODE_ENV !== 'production') {\n if (notAllowed) {\n Logger.warn(\n `createStorageWriter: Attempted to create storage writer using unallowed category.\n Key: ${key}\n Category: ${JSON.stringify(category)}\n Options: ${JSON.stringify(options)}`\n );\n }\n }\n\n return (value: any) => {\n processStorage(container);\n\n return isNotAllowedAsync(container, category).then((notAllowed) => {\n if (notAllowed) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storageWriter: Attempted to write to storage using unallowed category.\n Key: ${key}\n Category: ${JSON.stringify(category)}\n Value: ${JSON.stringify(value)}\n Options: ${JSON.stringify(options)}`\n );\n }\n return;\n }\n\n const {\n scope = StorageScope.Widget,\n medium = StorageMedium.Session,\n duration,\n } = options;\n\n const store = createEmptyStore();\n store[scope][key] = createValue(value, category, duration);\n\n if (medium === StorageMedium.Cookie) return setCookieStoreAsync(container, store);\n else return setApplicationStoreAsync(container, medium, store);\n });\n };\n });\n};\n\n/**\n * Read the widget cookie, local or session storage.\n * @param container Widget Container.\n * @param key Key to read.\n * @param medium Storage medium to read from (default: session).\n * @returns the value stored with passed key.\n */\nexport const readStorage = <Type>(\n container: Container,\n key: string,\n medium: StorageMedium = StorageMedium.Session\n): Promise<Type | undefined> => {\n processStorage(container);\n\n if (typeof key === 'undefined') {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn('readStorage: Undefined key passed when reading storage. ', key, medium);\n }\n return Promise.resolve(undefined);\n }\n\n if (medium === StorageMedium.Cookie)\n return getCookieStoreAsync(container).then((store) => getValue(store, key));\n else return getApplicationStoreAsync(container, medium).then((store) => getValue(store, key));\n};\n","import { deepClone, hash, lock } from '@telia-ace/widget-utilities';\nimport { Container, Widget } from '@webprovisions/platform';\nimport { readStorage } from './storage';\nimport {\n Duration,\n StorageCategory,\n StorageContainer,\n StorageMedium,\n Store,\n StoredValue\n} from './types';\n\nconst hasEntries = (object: object) =>\n !!Object.entries(object).filter(([_, value]) => typeof value !== 'undefined').length;\n\nconst cleanUndefined = (object: StorageContainer) =>\n Object.entries(object)\n .filter(([_, value]) => typeof value !== 'undefined')\n .forEach(([key, { value }]) => {\n if (typeof value === 'undefined') {\n delete object[key];\n }\n });\n\nconst mergeAndClean = (target: Store, source: Store): Store => {\n const merged: Store = {\n tenant: { ...target.tenant, ...source.tenant },\n implementation: { ...target.implementation, ...source.implementation },\n widget: { ...target.widget, ...source.widget }\n };\n\n cleanUndefined(merged.tenant);\n cleanUndefined(merged.implementation);\n cleanUndefined(merged.widget);\n\n return merged;\n};\n\nconst getLongestExpirationDate = (store: Store): string => {\n const expirationDates = Object.entries(store).reduce<string[]>((acc, storeEntry) => {\n const [_, container] = storeEntry;\n Object.entries(container).forEach((containerEntry) => {\n const [_, { expiration }] = containerEntry;\n if (expiration) acc.push(expiration);\n });\n return acc;\n }, []);\n\n return (\n expirationDates\n .slice()\n .sort((a, b) => new Date(b).valueOf() - new Date(a).valueOf())\n .shift() || createExpirationDate()\n );\n};\n\nconst createStorageKeys = (\n container: Container\n): [tenant: string, implementation: string, widget: string] => {\n const {\n name: widgetName,\n implementation: { name: implementationName, tenant: tenantName },\n } = <Widget>container.get('$widget');\n\n return [\n `humany_${tenantName}`,\n `humany_${hash(tenantName + implementationName)}`,\n `humany_${hash(tenantName + implementationName + widgetName)}`,\n ];\n};\n\nconst getCookie = <Type>(cookieName: string): Type | undefined => {\n const regExp = new RegExp(`(?:^|;)\\\\s?${cookieName}=(.*?)(?:;|$)`, 'i');\n const cookie = document.cookie.match(regExp);\n const value = cookie && cookie[1] && JSON.parse(cookie[1]);\n\n return value || undefined;\n};\n\nconst setCookie = (cookieName: string, value: any, expires: string) => {\n const cookie = `${cookieName}=${JSON.stringify(value).trim()}`;\n const expiration = `expires=${new Date(expires).toUTCString()}`;\n const path = 'path=/';\n const options = 'SameSite=None;Secure'\n return (document.cookie = `${cookie}; ${expiration}; ${path}; ${options}`);\n};\n\nconst getCookieStore = (container: Container): Store => {\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const tenant = getCookie<StorageContainer>(tenantKey) || {};\n const implementation = getCookie<StorageContainer>(implementationKey) || {};\n const widget = getCookie<StorageContainer>(widgetKey) || {};\n\n return {\n tenant,\n implementation,\n widget,\n };\n};\n\nconst setCookieStore = (container: Container, store: Store): void => {\n const current = getCookieStore(container);\n const merged = mergeAndClean(current, store);\n\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const { tenant, implementation, widget } = merged;\n const expirationDate = getLongestExpirationDate(store);\n const deleteDate = createExpirationDate({ days: -1 });\n\n setCookie(tenantKey, tenant, hasEntries(tenant) ? expirationDate : deleteDate);\n setCookie(\n implementationKey,\n implementation,\n hasEntries(implementation) ? expirationDate : deleteDate\n );\n setCookie(widgetKey, widget, hasEntries(widget) ? expirationDate : deleteDate);\n};\n\nconst getApplicationStore = (container: Container, storage: Storage): Store => {\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const tenant = storage.getItem(tenantKey) || '{}';\n const implementation = storage.getItem(implementationKey) || '{}';\n const widget = storage.getItem(widgetKey) || '{}';\n\n return {\n tenant: JSON.parse(tenant),\n implementation: JSON.parse(implementation),\n widget: JSON.parse(widget),\n };\n};\n\nconst setApplicationStore = (\n container: Container,\n applicationStorage: Storage,\n store: Store\n): void => {\n const current = getApplicationStore(container, applicationStorage);\n const merged = mergeAndClean(current, store);\n\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const { tenant, implementation, widget } = merged;\n\n hasEntries(tenant)\n ? applicationStorage.setItem(tenantKey, JSON.stringify(tenant))\n : applicationStorage.removeItem(tenantKey);\n hasEntries(implementation)\n ? applicationStorage.setItem(implementationKey, JSON.stringify(implementation))\n : applicationStorage.removeItem(implementationKey);\n hasEntries(widget)\n ? applicationStorage.setItem(widgetKey, JSON.stringify(widget))\n : applicationStorage.removeItem(widgetKey);\n};\n\nexport const createEmptyStore = (): Store => ({ tenant: {}, implementation: {}, widget: {} });\n\nexport const isExpired = (isoDateString?: string) => {\n if (!isoDateString) return false;\n return !!isoDateString && new Date() > new Date(isoDateString);\n};\n\nexport const getValue = <Type>(store: Store, key: string): Type | undefined => {\n const storedValue = store.widget[key] || store.implementation[key] || store.tenant[key];\n return storedValue?.value;\n};\n\nexport const createValue = (\n value: any,\n category: StorageCategory,\n duration?: Duration | string\n): StoredValue => {\n if (duration) {\n return {\n value,\n category,\n expiration: typeof duration === 'object' ? createExpirationDate(duration) : duration,\n };\n }\n return {\n value,\n category,\n };\n};\n\nexport const processStore = (store: Store, policy?: StorageCategory[]): Store => {\n const clone = deepClone(store);\n\n Object.entries(clone).forEach(([_, storageContainer]) => {\n Object.entries(storageContainer).forEach(([key, storedValue]) => {\n const { expiration, category } = storedValue;\n\n if (isExpired(expiration) || isNotAllowed(policy, category))\n storageContainer[key] = createValue(undefined, category, expiration);\n });\n });\n\n return clone;\n};\n\n/**\n * @param category Storage Category.\n * @param policy Current Storage Policy.\n * @returns true if not allowed, false if allowed.\n */\nexport const isNotAllowedAsync = (\n container: Container,\n category?: StorageCategory\n): Promise<boolean> => {\n return readStorage<StorageCategory[]>(container, 'storagePolicy', StorageMedium.Cookie).then(\n (policy = [StorageCategory.Necessary]) => !!category && policy.indexOf(category) === -1\n );\n};\n\n/**\n * @param category Storage Category.\n * @param policy Current Storage Policy.\n * @returns true if not allowed, false if allowed.\n */\nexport const isNotAllowed = (\n policy: StorageCategory[] = [StorageCategory.Necessary],\n category?: StorageCategory\n): boolean => {\n return !!category && policy.indexOf(category) === -1;\n};\n\n/**\n * Processes storage and removes items if they are expired or if\n * the storage policy is defined and the category of the stored\n * value is not allowed.\n * @param container Widget Container\n */\nexport const processStorage = (container: Container): void => {\n const cookieStore = getCookieStore(container);\n const localStore = getApplicationStore(container, window.localStorage);\n const sessionStore = getApplicationStore(container, sessionStorage);\n const policy = getValue<StorageCategory[]>(cookieStore, 'storagePolicy');\n\n const [processedCookieStore, processedLocalStore, processedSessionStore] = [\n cookieStore,\n localStore,\n sessionStore,\n ].map((store) => processStore(store, policy));\n\n setCookieStore(container, processedCookieStore);\n setApplicationStore(container, window.localStorage, processedLocalStore);\n setApplicationStore(container, window.sessionStorage, processedSessionStore);\n};\n\n/**\n * Creates an expiration date string with the passed options.\n * @param options Duration options.\n * @returns ISO formatted date string.\n */\nexport const createExpirationDate = (options: Duration = { days: 30 }): string => {\n const { days = 0, hours = 0, minutes = 0, seconds = 0 } = options;\n const date = new Date();\n date.setTime(date.getTime() + hours * 60 * 60 * 1000);\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n date.setTime(date.getTime() + minutes * 60 * 1000);\n date.setTime(date.getTime() + seconds * 1000);\n return date.toISOString();\n};\n\nexport const getCookieStoreAsync = (container: Container): Promise<Store> => {\n return lock(document)(() => getCookieStore(container));\n};\n\nexport const setCookieStoreAsync = (container: Container, store: Store): Promise<any> => {\n return lock(document)(() => setCookieStore(container, store));\n};\n\nexport const getApplicationStoreAsync = (\n container: Container,\n type: StorageMedium.Local | StorageMedium.Session\n): Promise<Store> => {\n const storage = type === StorageMedium.Local ? window.localStorage : window.sessionStorage;\n return lock(storage)(() => getApplicationStore(container, storage));\n};\n\nexport const setApplicationStoreAsync = (\n container: Container,\n type: StorageMedium.Local | StorageMedium.Session,\n store: Store\n): Promise<void> => {\n const storage = type === StorageMedium.Local ? window.localStorage : window.sessionStorage;\n return lock(storage)(() => setApplicationStore(container, storage, store));\n};\n","import { lock, Logger } from '@telia-ace/widget-utilities';\nimport { StorageCategory } from '.';\nimport { StorageScope, Store } from './types';\nimport { createExpirationDate, createValue, getValue, processStore } from './utils';\n\ntype LegacyOptions = {\n scope?: StorageScope;\n expiration?: Date;\n};\n\ninterface LegacyMedium {\n setItem(key: string, value: any, options?: LegacyOptions): Promise<void>;\n getItem(key: string): Promise<any>;\n removeItem(key: string): Promise<void>;\n clear(): Promise<void>;\n}\n\nexport class LegacyStorage implements LegacyMedium {\n private memory: Store = {\n tenant: {},\n implementation: {},\n widget: {},\n };\n async setItem(key: string, value: any, options: LegacyOptions = {}): Promise<void> {\n return lock(this)(() => {\n const processedStore = processStore(this.memory, [StorageCategory.Necessary]);\n const { scope = StorageScope.Tenant, expiration } = options;\n\n processedStore[scope][key] = createValue(\n value,\n StorageCategory.Necessary,\n expiration?.toISOString() || createExpirationDate()\n );\n this.memory = processedStore;\n\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value stored temporarily in memory.\n Key: ${key}\n Value: ${JSON.stringify(value)}\n Options: ${JSON.stringify(options)}\n Memory: ${JSON.stringify(processedStore)}`\n );\n }\n });\n }\n async getItem(key: string): Promise<any> {\n return lock(this)(() => {\n const processedStore = processStore(this.memory, [StorageCategory.Necessary]);\n\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value fetched from legacy memory storage.\n Key: ${key}\n Memory: ${JSON.stringify(processedStore)}`\n );\n }\n\n const value = getValue(processedStore, key);\n this.memory = processedStore;\n\n return value;\n });\n }\n async removeItem(key: string): Promise<void> {\n return lock(this)(() => {\n const processedStore = processStore(this.memory, [StorageCategory.Necessary]);\n\n delete processedStore.tenant[key];\n delete processedStore.implementation[key];\n delete processedStore.widget[key];\n this.memory = processedStore;\n\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value removed from memory.\n Key: ${key}\n Memory: ${JSON.stringify(processedStore)}`\n );\n }\n });\n }\n async clear(): Promise<void> {\n return Promise.resolve();\n }\n}\n\nexport default class LegacyStorageProvider {\n cookies: LegacyStorage;\n session: LegacyStorage;\n local: LegacyStorage;\n constructor() {\n this.cookies = new LegacyStorage();\n this.session = new LegacyStorage();\n this.local = new LegacyStorage();\n }\n}\n","const z = /* @__PURE__ */ new WeakMap();\nfunction b() {\n return (s) => (z.has(s) || z.set(s, {}), z.get(s));\n}\nconst I = (s, t, e, ...n) => {\n const o = `[${s.get(\"$environment\").name || \"webprovisions\"}] ${e}`;\n switch (t) {\n case \"info\":\n console.info(o, ...n);\n break;\n case \"warning\":\n console.warn(o, ...n);\n break;\n case \"error\":\n console.error(o, ...n);\n break;\n }\n}, u = (s) => {\n const t = s.container || s;\n return {\n info: (e, ...n) => I(t, \"info\", e, ...n),\n warn: (e, ...n) => I(t, \"warning\", e, ...n),\n error: (e, ...n) => I(t, \"error\", e, ...n)\n };\n}, c = b(), M = (() => {\n let s = 0;\n return () => ++s;\n})(), _ = (s, t, e) => {\n const n = c(s).touchQueue.get(t);\n n && n.forEach((i) => {\n i(e, s);\n });\n};\nclass G {\n constructor(t, e, n, i) {\n this.key = t, this.factory = e, this.parent = n, this.container = i, this.id = M(), this.resolved = !1, this.constructed = !1, this.async = !0;\n }\n resolve() {\n if (!this.constructed) {\n const t = this.factory(this.parent, this.container);\n return this.constructed = !0, this.value = Promise.resolve(t).then((e) => (this.resolved = !0, _(this.container, this.key, e), e));\n }\n return this.value;\n }\n}\nclass J {\n constructor(t, e, n, i) {\n this.key = t, this.value = e, this.parent = n, this.container = i, this.id = M(), this.async = !1, this.resolved = !1, this.constructed = !0, this.resolve = () => (this.resolved = !0, _(this.container, this.key, this.value), this.value);\n }\n}\nclass X {\n constructor(t, e, n, i) {\n this.key = t, this.value = e, this.parent = n, this.container = i, this.id = M(), this.async = !1, this.resolved = !1, this.constructed = !1, this.resolve = () => {\n this.resolved = !0, this.constructed = !0;\n const r = this.value(this.parent, this.container);\n return _(this.container, this.key, this.value), r;\n };\n }\n}\nclass W {\n /**\n * Creates a new instance of `Container`.\n * @param owner The object owning this inctance.\n * @param name Optional name for the container.\n * @param parent Parent container this should be a child of.\n */\n constructor(t, e, n) {\n this.owner = t, this.name = e, this.parent = n, c(this).resolvers = /* @__PURE__ */ new Map(), c(this).touchQueue = /* @__PURE__ */ new Map(), c(this).children = [];\n }\n /**\n * Deletes an existing resolver by its unique id.\n * @param id Resolver id.\n */\n delete(t) {\n const e = c(this).resolvers, i = Array.from(e.values()).find((r) => r.id === t);\n return i ? (c(this).touchQueue.delete(i.key), Promise.resolve(e.delete(i.key))) : this.parent ? this.parent.delete(t) : Promise.resolve(!1);\n }\n /**\n * Clears the `Container` and any child containers by deleteing all registered resolvers.\n */\n clear() {\n const t = c(this).resolvers, e = Array.from(t.values());\n return Promise.all(e.map((n) => {\n if (n.constructed)\n return Promise.resolve(n.resolve()).then((i) => {\n if (i !== null && typeof i == \"object\" && typeof i.dispose == \"function\")\n return i.dispose.call(i, this, n);\n });\n })).then(() => {\n e.forEach((n) => this.delete(n.id)), c(this).children.forEach((n) => n.clear());\n });\n }\n /**\n * Detaches this `Container` instance from its parent, allowing it to be garbage-collected.\n */\n detach() {\n if (this.parent) {\n const t = c(this.parent).children, e = t.indexOf(this);\n e > -1 && (t.splice(e, 1), delete this.parent);\n }\n }\n /**\n * Provides a way of touching a value in the `Container` without forcing it to be resolved.\n * @param key Key of the resolved value to touch.\n * @param handler Handler function for touching the resolved value.\n */\n touch(t, e) {\n const i = c(this).resolvers.get(t);\n if (i && i.constructed)\n Promise.resolve(i.resolve()).then((o) => {\n e(o, this);\n });\n else {\n const o = c(this).touchQueue;\n let a = o.get(t);\n a || (a = [], o.set(t, a)), a.push(e);\n }\n return this.parent && !i ? this.parent.touch(t, e) : Promise.resolve();\n }\n /**\n * Registers an asynchronous resolver.\n * @param key Key of the resolver.\n * @param factory Value factory.\n */\n registerAsync(t, e) {\n const n = c(this).resolvers.get(t);\n n && !n.async && process.env.NODE_ENV !== \"production\" && u(this).warn(`Mismatching resolver type. You are registering an async resolver with a key ('${t}') previously used by a non-async resolver.`);\n const i = new G(t, e, n, this);\n return c(this).resolvers.set(t, i), i.id;\n }\n /**\n * Registers a factory resolver for constructing the value to be resolved.\n * @param key Key of the resolver.\n * @param factory Value factory.\n */\n registerFactory(t, e) {\n const n = c(this).resolvers.get(t);\n n && n.async && process.env.NODE_ENV !== \"production\" && u(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);\n const i = new X(t, e, n, this);\n return c(this).resolvers.set(t, i), i.id;\n }\n /**\n * Registers an synchronous resolver.\n * @param key Key of the resolver.\n * @param value Value.\n */\n register(t, e) {\n const n = c(this).resolvers.get(t);\n n && n.async && process.env.NODE_ENV !== \"production\" && u(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);\n const i = new J(t, e, n, this);\n return c(this).resolvers.set(t, i), i.id;\n }\n /**\n * Gets the value for a synchronous resolver.\n * @param key Key of resolver to get.\n */\n get(t) {\n const e = c(this).resolvers.get(t);\n if (e)\n return e.async && process.env.NODE_ENV !== \"production\" && u(this).warn(`You are retrieving an async value (with key '${t}') by the non-async function 'container.get(key)'. This will not be supported in future versions. Use 'container.getAsync(key) instead.'`), e.resolve();\n if (this.parent)\n return this.parent.get(t);\n }\n /**\n * Gets the value for a asynchronous resolver.\n * @param key Key of resolver to get.\n */\n getAsync(t) {\n const e = c(this).resolvers.get(t);\n if (e) {\n if (!e.async)\n throw process.env.NODE_ENV !== \"production\" && u(this).warn(`You are retrieving a non-async value (with key '${t}') by the async function 'container.getAsync(key)'.Use 'container.get(key) instead.'`), \"Mismatching resolver type\";\n return e.resolve();\n }\n return this.parent ? this.parent.getAsync(t) : Promise.resolve(void 0);\n }\n getMany(...t) {\n const e = {};\n return t.forEach((n) => e[n] = this.get(n)), e;\n }\n getManyAsync(...t) {\n const e = {};\n return Promise.all(t.map((n) => this.getAsync(n).then((i) => e[n] = i))).then(() => e);\n }\n createChild(t, e) {\n const n = new W(t, e, this);\n return c(this).children.push(n), n;\n }\n}\nclass L {\n /**\n * \n * @param type Type of event.\n * @param target The target of the event, which will handle the default behavour.\n * @param cancelable Whether the event is cancelable by calling preventDefault().\n * @param bubbles Whether the event will bubble up the parent hierarchy.\n */\n constructor(t, e, n = !1, i = !1) {\n this.type = t, this.target = e, this.cancelable = !!n, this.bubbles = !!i, this.defaultPrevented = !1;\n }\n /**\n * Cancels the default behaviour (if the event is cancelable).\n */\n preventDefault() {\n this.cancelable && (this.defaultPrevented = !0);\n }\n}\nconst p = b(), q = (s, t) => [].concat(\n p(s).listenerLookup.get(t.toLowerCase()) || [],\n p(s).listenerLookup.get(\"*\") || []\n), F = (s, t, e, n) => {\n let i, r;\n return t instanceof L ? (i = t, r = t.type) : (i = new L(t, s.target, !!e.cancelable, !!e.bubbles), r = t), { event: i, type: r, async: n };\n};\nclass D {\n /**\n * Creates a new Event Manager instance.\n * @param target The target of events dispatched from this Event Manager instance.\n * @param parent Parent Event Manager instance.\n */\n constructor(t, e) {\n this.target = t, this.parent = e, p(this).listenerLookup = /* @__PURE__ */ new Map(), p(this).children = [];\n }\n /**\n * Clears registered event listeners in this `EventManager` as well as in any children.\n */\n clear() {\n p(this).listenerLookup.clear(), p(this).children.forEach((t) => t.clear());\n }\n /**\n * Detaches this `EventManager` instance from its parent, allowing it to be garbage-collected.\n */\n detach() {\n if (this.parent) {\n const t = p(this.parent).children, e = t.indexOf(this);\n e > -1 && t.splice(e, 1);\n }\n }\n /**\n * Creates an event subscription by registering an listener for an event type.\n * @param type Event type to subscribe to.\n * @param listener Listener for the event.\n */\n subscribe(t, e, n) {\n const i = p(this).listenerLookup, r = t.toLowerCase();\n return i.has(r) || i.set(r, []), i.get(r).push(e), () => this.unsubscribe(t, e);\n }\n /**\n * Similar to `subscribe()` but immediately removes the subscription after the first call.\n * @param type Event type to subscribe to.\n * @param listener Listener for the event.\n */\n subscribeOnce(t, e) {\n const n = this.subscribe(t, (i, r) => (n(), e(i, r)));\n }\n /**\n * Removes a listener for the specified event type.\n * @param type Event type to remove subscription for.\n * @param listener Event listener to remove.\n */\n unsubscribe(t, e) {\n const n = p(this).listenerLookup.get(t.toLowerCase());\n if (n) {\n const i = n.indexOf(e);\n i > -1 && n.splice(i, 1);\n }\n }\n /**\n * Dispatches an asynchonous event to registered event listeners.\n * @param eventOrType Event type or Event object to dispatch.\n * @param data Optional data to be passed to event listeners.\n * @param options Optional event options used if first parameter is an event type.\n */\n dispatchAsync(t, e, n = {}) {\n const { event: i, type: r } = F(this, t, n, !0), o = q(this, r);\n let a = 0;\n const l = o.length;\n let h = Promise.resolve();\n for (a = 0; a < l; a++)\n ((m) => {\n h = h.then((y) => y ? Promise.resolve(!0) : Promise.resolve(m(i, e)).then(() => i.defaultPrevented));\n })(o[a]);\n return h.then((m) => !m && i.bubbles && this.parent ? this.parent.dispatchAsync(i, e) : m);\n }\n /**\n * Dispatches an event to registered event listeners.\n * @param eventOrType Event type or Event object to dispatch.\n * @param data Optional data to be passed to event listeners.\n * @param options Optional event options used if first parameter is an event type.\n */\n dispatch(t, e, n = {}) {\n const { event: i, type: r } = F(this, t, n, !1), o = q(this, r);\n let a = 0;\n const l = o.length;\n let h = !1;\n for (a = 0; a < l; a++)\n if (o[a](i, e), i.defaultPrevented) {\n h = !0;\n break;\n }\n return !h && i.bubbles && this.parent && (h = this.parent.dispatch(i, e)), h;\n }\n /**\n * Creates a child instance to the current Event manager.\n */\n createChild(t) {\n const e = new D(t, this);\n return p(this).children.push(e), e;\n }\n}\nconst P = (s, t, e) => {\n const i = s.get(\"$plugins\").map((r) => {\n try {\n return r.invoke(t, e);\n } catch (o) {\n u(s).error(\"An error occured when invoking a plugin.\", r, o);\n }\n });\n return Promise.all(i);\n};\nclass Z {\n constructor(t) {\n this.widget = t.get(\"$widget\"), this.events = this.widget.events, this.container = this.widget.container, this.initialized = null, this.activated = null, this.initialize = this.initialize.bind(this), this.activate = this.activate.bind(this), this.deactivate = this.deactivate.bind(this), this.invoke = this.invoke.bind(this), this.createInstance();\n }\n createInstance() {\n if (!this.widget.container.get(\"$instance\")) {\n const t = this.widget.container.get(\"$types\"), e = this.widget.container.get(\"$type\");\n !e && u(this).error(\"Unable to create widget. No type is specified.\");\n const n = t[e];\n !n && u(this).error(`Unable to create widget. Type '${e}' is not registered.`), this.widget.events.dispatch(\"widget:create-instance\", {}, { bubbles: !0 });\n try {\n this.widget.container.register(\n \"$instance\",\n new n(this.container)\n );\n } catch (i) {\n u(this).error(\"Unable to create widget type.\", i);\n }\n this.widget.events.dispatch(\"widget:instance-created\", {}, { bubbles: !0 });\n }\n }\n /**\n * The initialization is performed before the widget is activated but after it's configured\n * and thus all required services are available. This hook is a good place to bind events that\n * should trigger activation (e.g. click on \"trigger links\" or routing events)\n * @param {object} data Custom initialization data passed to the widget.\n */\n initialize(t) {\n return this.initialized = this.initialized || (() => {\n const e = this.container.get(\"$instance\"), n = e.initialize || (() => {\n });\n return this.initialized = Promise.resolve(n.call(e, t)).then(() => P(this.container, \"initialize\", t)).then(() => {\n });\n })();\n }\n /**\n * The activation is where the widget is actually created and rendered.\n * Activation can be initialized from the outside or from an event originated\n * in the \"initialize\" hook.\n * @param {object} data Custom activation data passed to the widget.\n */\n activate(t) {\n return (this.initialized || this.initialize()).then(() => {\n this.activated = this.activated || (() => P(this.container, \"activate\").then(() => {\n const n = this.container.get(\"$instance\");\n return this.activated = n.activate(t);\n }))();\n });\n }\n deactivate() {\n const t = this.container.get(\"$instance\"), e = t.deactivate || (() => {\n });\n return P(this.container, \"deactivate\").then(() => Promise.resolve(e.call(t))).then(() => {\n this.initialized = null, this.activated = null;\n }).then(() => {\n });\n }\n /**\n * Invokes a command on the widget component.\n * @param command Name of command\n * @param args Command arguments\n */\n invoke(t, ...e) {\n return P(this.container, \"invoke\", { command: t, args: e }).then(() => {\n const n = this.container.get(\"$instance\");\n if (n[t])\n return n[t].apply(n, e);\n const i = n.invoke;\n if (i)\n return i.call(n, t, ...e);\n });\n }\n}\nconst w = (s, t) => {\n if (!t)\n return !0;\n if (typeof t == \"string\") {\n const e = t.split(\",\");\n for (let n = 0, i = e.length; n < i; n++) {\n const r = e[n].trim();\n if (r === s || r === \"*\")\n return !0;\n }\n }\n return t instanceof Array ? t.indexOf(s) > -1 : !1;\n}, K = (s, t) => {\n if (typeof t == \"function\")\n return t(s);\n const e = typeof t == \"string\" ? nt(t) : t;\n return !(!w(s.implementation.tenant || \"\", e.tenant || \"\") || !w(s.implementation.name, e.implementation || \"\") || !w(s.name, e.widget || \"\") || !w(s.container.get(\"$type\"), e.type || \"\"));\n}, tt = (s, t) => {\n if (typeof t == \"function\")\n return t(s);\n const e = typeof t == \"string\" ? st(t) : t;\n return !(!w(s.tenant || \"\", e.tenant || \"\") || !w(s.name, e.implementation || \"\"));\n}, Q = (s) => (t) => K(t, s), et = (s) => (t) => tt(t, s), f = (s) => s instanceof Array && s.length === 1 ? s[0] : s, nt = (s) => {\n const t = {}, e = s.split(\":\");\n return e.length === 1 ? t.widget = f(e[0].split(\",\")) : e.length === 2 ? (t.implementation = f(e[0].split(\",\")), t.widget = f(e[1].split(\",\"))) : (t.tenant = f(e[0].split(\",\")), t.implementation = f(e[1].split(\",\")), t.widget = f(e[2].split(\",\"))), t;\n}, st = (s) => {\n const t = {}, e = s.split(\":\");\n return e.length === 1 ? t.implementation = f(e[0].split(\",\")) : (t.tenant = f(e[0].split(\",\")), t.implementation = f(e[1].split(\",\"))), t;\n}, E = b(), V = (s, t, e) => s.filter((n) => n.stage === t && Q(n.selector)(e));\nfunction it(s) {\n const t = s.container.get(\"$environment\");\n let e = E(t).configurationCache;\n e && (e = e.filter((n) => n[0] !== s), E(t).configurationCache = e);\n}\nvar k = /* @__PURE__ */ ((s) => (s.Implementation = \"implementation\", s.Widget = \"widget\", s))(k || {}), g = /* @__PURE__ */ ((s) => (s.Pre = \"pre\", s.Post = \"post\", s))(g || {});\nconst T = (s, t, e) => (Object.keys(t).forEach((n) => {\n const i = t[n];\n if (typeof i == \"function\") {\n const r = i();\n typeof r.defaultArgs != \"undefined\" && e(r, ...r.defaultArgs), s[n] = (...o) => {\n const a = Object.assign(\n {},\n r,\n { handlerResolver: r.handlerResolver.bind({}) }\n );\n return e(a, ...o), s;\n };\n } else\n s[n] = T(\n {},\n i,\n e\n );\n}), s), rt = (s, t) => {\n switch (t) {\n case \"implementation\":\n return s.implementation;\n case \"widget\":\n return s;\n }\n}, O = (s, t, e, n) => (n.forEach((i) => {\n T(\n s,\n i,\n (r, ...o) => {\n const a = {\n selector: t,\n stage: r.stage,\n handler: (l) => {\n const h = rt(l, r.scope), m = { container: h.container, events: h.events }, y = r.handlerResolver, x = y(m);\n let v = E(e.environment).configurationCache;\n return v || (v = E(e.environment).configurationCache = []), v.find((R) => R.indexOf(h) > -1 && R.indexOf(y) > -1) ? Promise.resolve() : (v.push([h, y]), Promise.resolve(x(...o)));\n }\n };\n e.instructions.push(a);\n }\n );\n}), s);\nfunction ot(s, t) {\n function e(n) {\n return O(\n {},\n n,\n s,\n t\n );\n }\n return O(\n e,\n \"*\",\n s,\n t\n );\n}\nclass $t {\n constructor(t, e) {\n this.container = t, this.settings = e, this.widget = t.get(\"$widget\"), this.events = this.widget.events;\n }\n}\nconst at = (s, t, e, n) => {\n try {\n const i = new t(e, n);\n return {\n name: s,\n invoke: (r, o) => {\n let a;\n return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);\n },\n getInstance: () => i\n };\n } catch (i) {\n if (i.message && i.message.indexOf(\"is not a constructor\") >= 0)\n return {\n name: s,\n invoke: (r) => {\n let o;\n return r === \"initialize\" && (o = t(e, n)), Promise.resolve(o);\n },\n getInstance: () => t\n };\n throw i;\n }\n};\nfunction j(s, t) {\n return typeof s == \"undefined\" ? t : s;\n}\nclass ct {\n constructor(t = {}) {\n this.part = t;\n }\n createCommand(t, e, n) {\n let i;\n typeof e == \"function\" ? i = {\n scope: k.Widget,\n stage: g.Post,\n defaultArgs: void 0,\n handlerResolver: e\n } : i = {\n scope: j(e.scope, k.Widget),\n stage: j(e.stage, g.Post),\n defaultArgs: e.defaultArgs,\n handlerResolver: n\n };\n let r = this.part;\n const o = t.split(\".\");\n return o.forEach((a, l) => {\n l === o.length - 1 ? r[a] || (r[a] = () => i) : r = this.part[a] = this.part[a] || {};\n }), this;\n }\n get() {\n return this.part;\n }\n}\nconst ht = (s) => {\n const t = new ct({});\n return s(t), t.get();\n}, lt = ht((s) => {\n s.createCommand(\n \"types.register\",\n { scope: k.Implementation, stage: g.Pre },\n (t) => (e, n) => {\n t.container.get(\"$types\")[e] = n;\n }\n ).createCommand(\n \"type\",\n { stage: g.Pre },\n (t) => (e) => {\n t.container.register(\"$type\", e);\n }\n ).createCommand(\n \"settings\",\n { stage: g.Pre, defaultArgs: [null] },\n (t) => (e) => {\n t.events.dispatch(\n \"settings:change\",\n e,\n { bubbles: !0 }\n ), t.container.register(\"$settings\", e);\n }\n ).createCommand(\n \"plugin\",\n { stage: g.Pre },\n (t) => (e, n, i) => {\n const { container: r } = t;\n let o = null, a = e, l = n;\n typeof e == \"string\" && (o = e, a = n, l = i);\n const h = (m) => {\n const { transformPluginSettings: y } = t.container.get(\"$environmentOptions\"), x = y ? y(\n l || {},\n o,\n t.container,\n a\n ) : n;\n try {\n const v = at(\n o,\n a,\n r,\n x\n );\n r.get(\"$plugins\").push(v), m && v.invoke(\"initialize\", null);\n } catch (v) {\n u(t).warn(\"Error when initializing plugin\", v);\n }\n };\n t.container.get(\"$instance\") ? h(!0) : t.events.subscribeOnce(\"widget:instance-created\", () => h(!1));\n }\n ).createCommand(\n \"container.register\",\n (t) => (e, n) => {\n t.container.register(e, n);\n }\n ).createCommand(\n \"container.registerAsync\",\n (t) => (e, n) => {\n t.container.registerAsync(e, n);\n }\n ).createCommand(\n \"container.registerFactory\",\n (t) => (e, n) => {\n t.container.registerFactory(e, n);\n }\n ).createCommand(\n \"container.touch\",\n (t) => (e, n) => {\n t.container.touch(e, n);\n }\n ).createCommand(\n \"csp\",\n {},\n (t) => (e) => {\n t.container.register(\"csp\", e);\n }\n );\n}), ut = lt;\nfunction dt(s, t, e = []) {\n const n = [ut].concat(e), i = ot(\n t,\n n\n );\n s(i, t);\n}\nclass pt {\n constructor() {\n this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);\n }\n add(t, e, n, i) {\n this.tasks.push({ task: t, resolve: e, reject: n, done: i }), this.next();\n }\n next() {\n this.current = this.current.then(() => {\n const t = this.tasks.shift();\n if (t) {\n const e = Promise.resolve(t.task());\n return Promise.resolve(e).then(this.next).then(() => e.then((n) => {\n t.done(), t.resolve(n);\n })).catch((n) => (t.done(), t.reject(n), this.next()));\n }\n return Promise.resolve();\n });\n }\n}\nconst A = /* @__PURE__ */ new WeakMap();\nfunction vt(s) {\n return A.has(s) || A.set(s, new pt()), (t) => new Promise((e, n) => {\n const i = A.get(s);\n i.add(t, e, n, () => {\n i.tasks.length || A.delete(s);\n });\n });\n}\nconst U = (s) => typeof s != \"undefined\";\nvar ft = /* @__PURE__ */ ((s) => (s.Activating = \"activating\", s.Loading = \"loading\", s.Activated = \"activated\", s.Deactivating = \"deactivating\", s.Deactivated = \"deactivated\", s))(ft || {});\nconst $ = (s, t) => {\n s.events.dispatch(\"widget:state-change\", { state: t }, { bubbles: !0 }), s.state = t, s.events.dispatch(\"widget:state-changed\", {}, { bubbles: !0 });\n}, d = b(), gt = (s) => {\n const { container: t, events: e } = s;\n t.get(\"$controller\") || (t.register(\"$controller\", new Z(t)), e.dispatch(\"widget:controller-created\", {}, { bubbles: !0 }));\n};\nclass mt {\n /**\n * Creates a new `Widget` instance.\n * @param name Name of widget.\n * @param implementation The implementation this instance belongs to.\n * @param configuration Configuration for the widget.\n */\n constructor(t, e, n) {\n this.state = \"deactivated\", this.name = t, this.implementation = e, this.container = e.container.createChild(this, t), this.events = e.events.createChild(this), d(this).subscriptions = [], n && e.configure((i) => {\n const r = i(t);\n U(n.type) && r.type(n.type), U(n.settings) && r.settings(n.settings), n.plugins && Object.keys(n.plugins).forEach((o) => {\n var l;\n const a = (l = n.plugins) == null ? void 0 : l[o];\n r.plugin(o, a);\n });\n }), this.load = this.load.bind(this), this.activate = this.activate.bind(this), this.invoke = this.invoke.bind(this), this.deactivate = this.deactivate.bind(this);\n }\n /**\n * Initializes the widget, if not already initialized, and applies any\n * pending configuration.\n */\n load() {\n return vt(this)(() => {\n d(this).deactivatedPromise = null;\n const t = this.state === \"deactivated\";\n t && ($(\n this,\n \"activating\"\n /* Activating */\n ), this.container.register(\"$widget\", this), this.container.register(\"$controller\", null), this.container.register(\"$plugins\", []), this.container.register(\"$type\", null), this.container.register(\"$instance\", null)), $(\n this,\n \"loading\"\n /* Loading */\n );\n const e = this.implementation.instructions, n = V(e, g.Pre, this);\n return Promise.all(n.map((i) => i.handler(this))).then(() => {\n gt(this);\n const i = V(e, g.Post, this);\n return Promise.all(i.map((r) => r.handler(this))).then(() => {\n t && this.container.get(\"$controller\").initialize();\n });\n }).then(() => ($(\n this,\n \"activated\"\n /* Activated */\n ), this));\n });\n }\n /**\n * Activates the widget and makes it ready for receiving commands.\n * @param data Activation data\n */\n activate(t) {\n d(this).subscriptions.push(\n this.implementation.events.subscribe(\"implementation:configured\", () => {\n [\n \"activated\",\n \"activating\",\n \"loading\"\n /* Loading */\n ].indexOf(this.state) > -1 && this.load();\n })\n );\n const e = d(this).activatedPromise;\n return e ? (process.env.NODE_ENV !== \"production\" && u(this).warn(`Widget '${this.name}' has already been activated. The passed arguments for this activation will be discarded.`, t), e) : d(this).activatedPromise = this.load().then(() => this.container.get(\"$controller\").activate(t));\n }\n /**\n * Invokes a command on a widget. If the widget isn't activate the invocation \n * will be suspended until activation.\n * @param command Command to invoke.\n * @param args Command arguments.\n */\n invoke(t, ...e) {\n const n = d(this).activatedPromise, i = (r, ...o) => n.then(this.load).then(() => this.container.get(\"$controller\").invoke(r, ...o));\n return n ? i(t, ...e) : (process.env.NODE_ENV !== \"production\" && u(this).warn(\"You are invoking a command on a deactivated widget. The invocation will be queued until the widget is activated.\", this), new Promise((r) => {\n const o = this.events.subscribe(\"widget:state-changed\", () => {\n this.state === \"activated\" && (o(), r(i(t, ...e)));\n });\n }));\n }\n /**\n * Deactivates the widget by clearing the `Container` and removing any event subscriptions in the\n * `EventManager`.\n */\n deactivate() {\n const t = d(this).deactivatedPromise;\n return t || (this.state === \"deactivated\" ? Promise.resolve() : ($(\n this,\n \"deactivating\"\n /* Deactivating */\n ), d(this).deactivatedPromise = this.container.get(\"$controller\").deactivate().then(() => (d(this).activatedPromise = null, d(this).subscriptions.forEach((e) => e()), d(this).subscriptions = [], this.container.clear().then(() => {\n this.events.clear(), it(this), $(\n this,\n \"deactivated\"\n /* Deactivated */\n );\n })))));\n }\n}\nconst Pt = (s) => s.deactivate().then(() => {\n s.events.detach(), s.container.detach(), s.implementation.widgets.delete(s.name);\n});\nclass At {\n /**\n * Creates a new `Widget` instance.\n * @param container The `Container` instance to base the widget upon.\n */\n constructor(t) {\n this.container = t, this.widget = t.get(\"$widget\"), this.settings = t.get(\"$settings\"), this.events = this.widget.events, this.widget.events.subscribe(\"settings:change\", (e, n) => {\n this.settings = n;\n });\n }\n}\nconst Y = b();\nclass yt {\n /**\n * Creates a new Implementation instance.\n * @param configuration Configuration for the implementation.\n * @param environment The parent environment.\n * @param configurationApiExtensions Optional configuration API extensions.\n */\n constructor(t, e, n = []) {\n this.instructions = [], this.widgets = /* @__PURE__ */ new Map(), this.name = t.name, this.tenant = t.tenant, this.environment = e, this.container = e.container.createChild(this, this.name), this.events = e.events.createChild(this), this.container.register(\"$types\", {}), Y(this).configurationApiExtensions = n;\n }\n /**\n * Loads all widgets in the implementation.\n */\n load() {\n const t = Array.from(this.widgets.values());\n return Promise.all(t.map((e) => e.load())).then(() => t);\n }\n /**\n * Configures the implementation by adding a configuration callback.\n * @param configFn Callback function for configuration.\n */\n configure(t) {\n return dt(t, this, Y(this).configurationApiExtensions), this.events.dispatch(\n \"implementation:configured\",\n { implementation: this },\n { bubbles: !0 }\n ), this;\n }\n /**\n * Creates a widget on the implementation and returns its `WidgetData`.\n * @param name Widget name.\n * @param configuration Widget configuration.\n */\n createWidget(t, e) {\n const n = new mt(t, this, e);\n return this.widgets.set(n.name, n), n;\n }\n}\nfunction wt(s, t, e) {\n const n = new yt(s, t, e);\n return s.widgets && Object.keys(s.widgets).forEach((i) => {\n var o;\n const r = (o = s.widgets) == null ? void 0 : o[i];\n n.createWidget(i, r);\n }), n;\n}\nclass C {\n constructor(t, e) {\n this.selectorFactory = e, typeof t == \"function\" ? this.resolver = t : this.resolver = () => t;\n }\n append(t) {\n const e = typeof t == \"function\" ? t : () => t;\n return new C(\n () => this.all().concat(e()),\n this.selectorFactory\n );\n }\n all() {\n return this.resolver().concat([]);\n }\n query(t) {\n return this.all().filter(this.selectorFactory(t));\n }\n find(t) {\n const e = this.query(t);\n if (e.length)\n return e[0];\n }\n}\nconst S = \"#____version____#\";\nfunction Et(s, t) {\n const e = B.create(s);\n return Promise.all(\n (t || []).map((n) => Promise.resolve(n(e)))\n ).then(() => e);\n}\nconst N = b(), bt = (s) => s.tenant ? `${s.name}:${s.tenant}` : s.name, H = class {\n constructor(s, t = [], e = {}) {\n this.widgets = new C(\n () => {\n let n = [];\n return this.implementations.all().forEach((i) => {\n n = n.concat(Array.from(i.widgets.values()));\n }), n;\n },\n Q\n ), this.implementations = new C([], et), this.name = s, this.container = new W(this, s), this.events = new D(this), this.container.register(\"$version\", S), this.container.register(\"$environment\", this), this.container.register(\"$environmentOptions\", e), N(this).configurationApiExtensions = t;\n }\n /**\n * Creates an implementation based on the provided configuration.\n * @param config Implementation configuration.\n */\n createImplementation(s) {\n const t = bt(s);\n let e = this.implementations.find(t);\n if (e)\n return process.env.NODE_ENV !== \"production\" && u(e).warn(`Implementation \"${t}\" already exist on current environment.`), e;\n const n = N(this).configurationApiExtensions;\n return e = wt(\n s,\n this,\n n\n ), this.implementations = this.implementations.append([e]), this.events.dispatch(\"implementation:created\", { implementation: e }), e;\n }\n /**\n * Patches the Environment instance configuration.\n * @param configuration Environment configuration.\n */\n patch(s = {}) {\n const { name: t, configurationApiExtensions: e } = s;\n typeof t != \"undefined\" && t !== null && (this.name = t), e && e.forEach(\n (n) => {\n N(this).configurationApiExtensions.push(n);\n }\n );\n }\n /**\n * Creates a new Environment instance based on the provided configuration.\n * @param configuration Environment configuration.\n */\n static create(s = {}) {\n return new H(\n s.name || \"\",\n s.configurationApiExtensions,\n s.options\n );\n }\n};\nlet B = H;\nB.version = S;\nexport {\n k as ConfigurationScope,\n g as ConfigurationStage,\n W as Container,\n B as Environment,\n D as EventManager,\n L as EventObject,\n yt as Implementation,\n $t as Plugin,\n mt as Widget,\n Z as WidgetController,\n ft as WidgetState,\n At as WidgetType,\n ht as createConfigurationApi,\n Et as createEnvironment,\n Pt as destroy,\n Pt as destroyWidget,\n u as logger,\n et as selectImplementations,\n Q as selectWidgets,\n S as version\n};\n//# sourceMappingURL=index.js.map\n","import { Logger } from '@telia-ace/widget-utilities';\nimport { createConfigurationApi } from '@webprovisions/platform';\nimport { createStorageWriter } from './storage';\nimport { StorageCategory, StorageConfigurationOptions, StorageMedium, StorageScope } from './types';\nimport { processStorage } from './utils';\n\nexport default createConfigurationApi((builder) => {\n builder.createCommand('storage', (context) => (options: StorageConfigurationOptions = {}) => {\n const { consent } = options;\n if (typeof consent !== 'undefined') {\n if (\n typeof consent !== 'number' &&\n typeof consent !== 'string' &&\n !Array.isArray(consent)\n ) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.\n Passed consent: ${JSON.stringify(consent)}`\n );\n }\n return;\n }\n\n if (\n Array.isArray(consent) &&\n !(consent as string[]).every(\n (c: any) => typeof c === 'number' || typeof c === 'string'\n )\n ) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.\n Passed consent: ${JSON.stringify(consent)}`\n );\n }\n return;\n }\n\n const policy: StorageCategory[] = [\n StorageCategory.Necessary,\n StorageCategory.Functional,\n StorageCategory.Analytical,\n StorageCategory.Marketing,\n ].filter((category, index, array) => {\n if (typeof consent === 'number') {\n // Passed consent is a category level (number)\n // Include the passed category level and all categories below it\n return consent > index;\n } else if (typeof consent === 'string') {\n // Passed consent is a category (string)\n // Include the passed category and all categories below its level\n return array.indexOf(consent) + 1 > index;\n } else if (Array.isArray(consent)) {\n // Passed consent is an array with category levels (number), categories (string) or both\n // Include all categories in passed array\n return (\n consent.findIndex((c: number | StorageCategory) => {\n return c === index + 1 || c === category;\n }) > -1\n );\n } else {\n return true;\n }\n });\n\n if (policy.indexOf(StorageCategory.Necessary) === -1) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storagePolicyConfigurationApi: passed consent does not include category: '${\n StorageCategory.Necessary\n }'. Consent has to atleast include the '${\n StorageCategory.Necessary\n }' category.\n Passed consent: ${JSON.stringify(consent)}`\n );\n }\n policy.unshift(StorageCategory.Necessary);\n }\n\n return createStorageWriter(\n context.container,\n 'storagePolicy',\n StorageCategory.Necessary,\n {\n medium: StorageMedium.Cookie,\n scope: StorageScope.Tenant,\n duration: { days: 365 },\n }\n )\n .then((write) => write(policy))\n .then(() => {\n processStorage(context.container);\n\n context.events.dispatch('storage:policy-changed', policy);\n });\n }\n });\n});\n"],"names":["StorageMedium","StorageScope","StorageCategory","createStorageWriter","container","key","category","options","isNotAllowedAsync","notAllowed","Logger","value","processStorage","scope","medium","duration","store","createEmptyStore","createValue","setCookieStoreAsync","setApplicationStoreAsync","readStorage","getCookieStoreAsync","getValue","getApplicationStoreAsync","hasEntries","object","_","cleanUndefined","mergeAndClean","target","source","merged","__spreadValues","getLongestExpirationDate","acc","storeEntry","containerEntry","expiration","a","b","createExpirationDate","createStorageKeys","widgetName","implementationName","tenantName","hash","getCookie","cookieName","regExp","cookie","setCookie","expires","path","getCookieStore","tenantKey","implementationKey","widgetKey","tenant","implementation","widget","setCookieStore","current","expirationDate","deleteDate","getApplicationStore","storage","setApplicationStore","applicationStorage","isExpired","isoDateString","storedValue","processStore","policy","clone","deepClone","storageContainer","isNotAllowed","cookieStore","localStore","sessionStore","processedCookieStore","processedLocalStore","processedSessionStore","days","hours","minutes","seconds","date","lock","type","LegacyStorage","_0","_1","__async","processedStore","LegacyStorageProvider","I","s","t","e","n","o","u","k","g","at","i","r","j","ct","l","ht","h","m","y","x","v","storagePolicyConfigurationApi","createConfigurationApi","builder","context","consent","c","index","array","write"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAY,IAAAA,sBAAAA,OACRA,EAAA,SAAS,UACTA,EAAA,QAAQ,SACRA,EAAA,UAAU,WAHFA,IAAAA,KAAA,CAAA,CAAA,GAMAC,sBAAAA,OACRA,EAAA,SAAS,UACTA,EAAA,iBAAiB,kBACjBA,EAAA,SAAS,UAHDA,IAAAA,KAAA,CAAA,CAAA,GAoBAC,sBAAAA,OACRA,EAAA,YAAY,aACZA,EAAA,aAAa,cACbA,EAAA,aAAa,cACbA,EAAA,YAAY,aAJJA,IAAAA,KAAA,CAAA,CAAA;ACGL,MAAMC,IAAsB,CAC/BC,GACAC,GACAC,GACAC,IAAgC,CAAA,MAEzBC,EAAkBJ,GAAWE,CAAQ,EAAE,KAAK,CAACG,OAC5C,QAAQ,IAAI,aAAa,gBACrBA,KACOC,EAAA;AAAA,EACH;AAAA,2BACOL;AAAA,gCACK,KAAK,UAAUC,CAAQ;AAAA,+BACxB,KAAK,UAAUC,CAAO;AAAA,GAKtC,CAACI,OACJC,EAAeR,CAAS,GAEjBI,EAAkBJ,GAAWE,CAAQ,EAAE,KAAK,CAACG,MAAe;AAC/D,MAAIA,GAAY;AACR,IAAA,QAAQ,IAAI,aAAa,gBAClBC,EAAA;AAA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,aAAImE,EAAO,QAAQvE,EAAgB,SAAS,MAAM,OAC1C,QAAQ,IAAI,aAAa,gBAClBQ,EAAA;AAAA,QACH,6EACIR,EAAgB,mDAEhBA,EAAgB;AAAA,0CAEF,KAAK,UAAUwH,CAAO;AAAA,MAAA,GAGzCjD,EAAA,QAAQvE,EAAgB,SAAS,IAGrCC;AAAA,QACHsH,EAAQ;AAAA,QACR;AAAA,QACAvH,EAAgB;AAAA,QAChB;AAAA,UACI,QAAQF,EAAc;AAAA,UACtB,OAAOC,EAAa;AAAA,UACpB,UAAU,EAAE,MAAM,IAAI;AAAA,QAC1B;AAAA,MAAA,EAEC,KAAK,CAAC6H,MAAUA,EAAMrD,CAAM,CAAC,EAC7B,KAAK,MAAM;AACR,QAAA7D,EAAe6G,EAAQ,SAAS,GAExBA,EAAA,OAAO,SAAS,0BAA0BhD,CAAM;AAAA,MAAA,CAC3D;AAAA;AAAA,EACT,CACH;AACL,CAAC;","x_google_ignoreList":[4]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-services",
3
- "version": "1.0.26-next.4",
3
+ "version": "1.0.26-next.6",
4
4
  "description": "Services for ACE Widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
@@ -21,11 +21,11 @@
21
21
  },
22
22
  "sideEffects": false,
23
23
  "dependencies": {
24
- "@telia-ace/widget-utilities": "1.0.15-next.4"
24
+ "@telia-ace/widget-utilities": "1.0.15-next.6"
25
25
  },
26
26
  "devDependencies": {
27
- "@telia-ace/widget-developer-tools": "1.0.21-next.4",
28
- "@webprovisions/platform": "^1.1.2"
27
+ "@telia-ace/widget-developer-tools": "1.0.21-next.6",
28
+ "@webprovisions/platform": "^1.1.3-rc.3"
29
29
  },
30
30
  "scripts": {
31
31
  "clean": "rimraf ./dist",