@telia-ace/widget-services 1.0.21-experimental.8 → 1.0.21-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +93 -89
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
1
|
+
var R = Object.defineProperty;
|
|
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
5
|
for (var n in t || (t = {}))
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
for (var n of
|
|
9
|
-
|
|
6
|
+
B.call(t, n) && J(e, n, t[n]);
|
|
7
|
+
if (V)
|
|
8
|
+
for (var n of V(t))
|
|
9
|
+
F.call(t, n) && J(e, n, t[n]);
|
|
10
10
|
return e;
|
|
11
11
|
};
|
|
12
|
-
var S = (e, t, n) =>
|
|
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) => {
|
|
13
14
|
var o = (i) => {
|
|
14
15
|
try {
|
|
15
16
|
c(n.next(i));
|
|
@@ -25,14 +26,14 @@ var S = (e, t, n) => new Promise((r, a) => {
|
|
|
25
26
|
}, c = (i) => i.done ? r(i.value) : Promise.resolve(i.value).then(o, s);
|
|
26
27
|
c((n = n.apply(e, t)).next());
|
|
27
28
|
});
|
|
28
|
-
import { Logger as g, lock as p, deepClone as
|
|
29
|
-
var l = /* @__PURE__ */ ((e) => (e.Cookie = "cookie", e.Local = "local", e.Session = "session", e))(l || {}),
|
|
30
|
-
const
|
|
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(
|
|
31
32
|
`createStorageWriter: Attempted to create storage writer using unallowed category.
|
|
32
33
|
Key: ${t}
|
|
33
34
|
Category: ${JSON.stringify(n)}
|
|
34
35
|
Options: ${JSON.stringify(r)}`
|
|
35
|
-
), (o) => (
|
|
36
|
+
), (o) => (k(e), L(e, n).then((s) => {
|
|
36
37
|
if (s) {
|
|
37
38
|
process.env.NODE_ENV !== "production" && g.warn(
|
|
38
39
|
`storageWriter: Attempted to write to storage using unallowed category.
|
|
@@ -44,119 +45,119 @@ const q = (e, t, n, r = {}) => W(e, n).then((a) => (process.env.NODE_ENV !== "pr
|
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
47
|
const {
|
|
47
|
-
scope: c =
|
|
48
|
+
scope: c = $.Widget,
|
|
48
49
|
medium: i = l.Session,
|
|
49
50
|
duration: m
|
|
50
|
-
} = r, u =
|
|
51
|
-
return u[c][t] =
|
|
52
|
-
})))),
|
|
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 }]) => {
|
|
53
54
|
typeof n == "undefined" && delete e[t];
|
|
54
|
-
}),
|
|
55
|
+
}), U = (e, t) => {
|
|
55
56
|
const n = {
|
|
56
57
|
tenant: f(f({}, e.tenant), t.tenant),
|
|
57
58
|
implementation: f(f({}, e.implementation), t.implementation),
|
|
58
59
|
widget: f(f({}, e.widget), t.widget)
|
|
59
60
|
};
|
|
60
|
-
return
|
|
61
|
-
},
|
|
61
|
+
return _(n.tenant), _(n.implementation), _(n.widget), n;
|
|
62
|
+
}, H = (e) => Object.entries(e).reduce((n, r) => {
|
|
62
63
|
const [a, o] = r;
|
|
63
64
|
return Object.entries(o).forEach((s) => {
|
|
64
65
|
const [c, { expiration: i }] = s;
|
|
65
66
|
i && n.push(i);
|
|
66
67
|
}), n;
|
|
67
|
-
}, []).slice().sort((n, r) => new Date(r).valueOf() - new Date(n).valueOf()).shift() ||
|
|
68
|
+
}, []).slice().sort((n, r) => new Date(r).valueOf() - new Date(n).valueOf()).shift() || C(), E = (e) => {
|
|
68
69
|
const {
|
|
69
70
|
name: t,
|
|
70
71
|
implementation: { name: n, tenant: r }
|
|
71
72
|
} = e.get("$widget");
|
|
72
73
|
return [
|
|
73
74
|
`humany_${r}`,
|
|
74
|
-
`humany_${
|
|
75
|
-
`humany_${
|
|
75
|
+
`humany_${W(r + n)}`,
|
|
76
|
+
`humany_${W(r + n + t)}`
|
|
76
77
|
];
|
|
77
|
-
},
|
|
78
|
+
}, b = (e) => {
|
|
78
79
|
const t = new RegExp(`(?:^|;)\\s?${e}=(.*?)(?:;|$)`, "i"), n = document.cookie.match(t);
|
|
79
80
|
return n && n[1] && JSON.parse(n[1]) || void 0;
|
|
80
|
-
},
|
|
81
|
+
}, D = (e, t, n) => {
|
|
81
82
|
const r = `${e}=${JSON.stringify(t).trim()}`, a = `expires=${new Date(n).toUTCString()}`, o = "path=/", s = "SameSite=None;Secure";
|
|
82
83
|
return document.cookie = `${r}; ${a}; ${o}; ${s}`;
|
|
83
|
-
},
|
|
84
|
-
const [t, n, r] =
|
|
84
|
+
}, x = (e) => {
|
|
85
|
+
const [t, n, r] = E(e), a = b(t) || {}, o = b(n) || {}, s = b(r) || {};
|
|
85
86
|
return {
|
|
86
87
|
tenant: a,
|
|
87
88
|
implementation: o,
|
|
88
89
|
widget: s
|
|
89
90
|
};
|
|
90
|
-
},
|
|
91
|
-
const n =
|
|
92
|
-
|
|
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(
|
|
93
94
|
o,
|
|
94
95
|
i,
|
|
95
|
-
y(i) ? u :
|
|
96
|
-
),
|
|
97
|
-
},
|
|
98
|
-
const [n, r, a] =
|
|
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) || "{}";
|
|
99
100
|
return {
|
|
100
101
|
tenant: JSON.parse(o),
|
|
101
102
|
implementation: JSON.parse(s),
|
|
102
103
|
widget: JSON.parse(c)
|
|
103
104
|
};
|
|
104
|
-
},
|
|
105
|
-
const r =
|
|
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;
|
|
106
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);
|
|
107
|
-
},
|
|
108
|
+
}, Q = () => ({ tenant: {}, implementation: {}, widget: {} }), X = (e) => e ? !!e && new Date() > new Date(e) : !1, v = (e, t) => {
|
|
108
109
|
const n = e.widget[t] || e.implementation[t] || e.tenant[t];
|
|
109
110
|
return n == null ? void 0 : n.value;
|
|
110
|
-
},
|
|
111
|
+
}, T = (e, t, n) => n ? {
|
|
111
112
|
value: e,
|
|
112
113
|
category: t,
|
|
113
|
-
expiration: typeof n == "object" ?
|
|
114
|
+
expiration: typeof n == "object" ? C(n) : n
|
|
114
115
|
} : {
|
|
115
116
|
value: e,
|
|
116
117
|
category: t
|
|
117
|
-
},
|
|
118
|
-
const n =
|
|
118
|
+
}, w = (e, t) => {
|
|
119
|
+
const n = q(e);
|
|
119
120
|
return Object.entries(n).forEach(([r, a]) => {
|
|
120
121
|
Object.entries(a).forEach(([o, s]) => {
|
|
121
122
|
const { expiration: c, category: i } = s;
|
|
122
|
-
(
|
|
123
|
+
(X(c) || Y(t, i)) && (a[o] = T(void 0, i, c));
|
|
123
124
|
});
|
|
124
125
|
}), n;
|
|
125
|
-
},
|
|
126
|
+
}, L = (e, t) => G(e, "storagePolicy", l.Cookie).then(
|
|
126
127
|
(n = [d.Necessary]) => !!t && n.indexOf(t) === -1
|
|
127
|
-
),
|
|
128
|
-
const t =
|
|
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] = [
|
|
129
130
|
t,
|
|
130
131
|
n,
|
|
131
132
|
r
|
|
132
|
-
].map((i) =>
|
|
133
|
-
|
|
134
|
-
},
|
|
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 }) => {
|
|
135
136
|
const { days: t = 0, hours: n = 0, minutes: r = 0, seconds: a = 0 } = e, o = new Date();
|
|
136
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();
|
|
137
|
-
},
|
|
138
|
+
}, Z = (e) => p(document)(() => x(e)), ee = (e, t) => p(document)(() => M(e, t)), te = (e, t) => {
|
|
138
139
|
const n = t === l.Local ? window.localStorage : window.sessionStorage;
|
|
139
|
-
return p(n)(() =>
|
|
140
|
-
},
|
|
140
|
+
return p(n)(() => N(e, n));
|
|
141
|
+
}, ne = (e, t, n) => {
|
|
141
142
|
const r = t === l.Local ? window.localStorage : window.sessionStorage;
|
|
142
|
-
return p(r)(() =>
|
|
143
|
+
return p(r)(() => K(e, r, n));
|
|
143
144
|
};
|
|
144
|
-
class
|
|
145
|
+
class I {
|
|
145
146
|
constructor() {
|
|
146
|
-
this
|
|
147
|
+
S(this, "memory", {
|
|
147
148
|
tenant: {},
|
|
148
149
|
implementation: {},
|
|
149
150
|
widget: {}
|
|
150
|
-
};
|
|
151
|
+
});
|
|
151
152
|
}
|
|
152
153
|
setItem(a, o) {
|
|
153
|
-
return
|
|
154
|
+
return h(this, arguments, function* (t, n, r = {}) {
|
|
154
155
|
return p(this)(() => {
|
|
155
|
-
const s =
|
|
156
|
-
s[c][t] =
|
|
156
|
+
const s = w(this.memory, [d.Necessary]), { scope: c = $.Tenant, expiration: i } = r;
|
|
157
|
+
s[c][t] = T(
|
|
157
158
|
n,
|
|
158
159
|
d.Necessary,
|
|
159
|
-
(i == null ? void 0 : i.toISOString()) ||
|
|
160
|
+
(i == null ? void 0 : i.toISOString()) || C()
|
|
160
161
|
), this.memory = s, process.env.NODE_ENV !== "production" && g.warn(
|
|
161
162
|
`StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value stored temporarily in memory.
|
|
162
163
|
Key: ${t}
|
|
@@ -168,23 +169,23 @@ class b {
|
|
|
168
169
|
});
|
|
169
170
|
}
|
|
170
171
|
getItem(t) {
|
|
171
|
-
return
|
|
172
|
+
return h(this, null, function* () {
|
|
172
173
|
return p(this)(() => {
|
|
173
|
-
const n =
|
|
174
|
+
const n = w(this.memory, [d.Necessary]);
|
|
174
175
|
process.env.NODE_ENV !== "production" && g.warn(
|
|
175
176
|
`StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value fetched from legacy memory storage.
|
|
176
177
|
Key: ${t}
|
|
177
178
|
Memory: ${JSON.stringify(n)}`
|
|
178
179
|
);
|
|
179
|
-
const r =
|
|
180
|
+
const r = v(n, t);
|
|
180
181
|
return this.memory = n, r;
|
|
181
182
|
});
|
|
182
183
|
});
|
|
183
184
|
}
|
|
184
185
|
removeItem(t) {
|
|
185
|
-
return
|
|
186
|
+
return h(this, null, function* () {
|
|
186
187
|
return p(this)(() => {
|
|
187
|
-
const n =
|
|
188
|
+
const n = w(this.memory, [d.Necessary]);
|
|
188
189
|
delete n.tenant[t], delete n.implementation[t], delete n.widget[t], this.memory = n, process.env.NODE_ENV !== "production" && g.warn(
|
|
189
190
|
`StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value removed from memory.
|
|
190
191
|
Key: ${t}
|
|
@@ -194,42 +195,45 @@ class b {
|
|
|
194
195
|
});
|
|
195
196
|
}
|
|
196
197
|
clear() {
|
|
197
|
-
return
|
|
198
|
+
return h(this, null, function* () {
|
|
198
199
|
return Promise.resolve();
|
|
199
200
|
});
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
|
-
class
|
|
203
|
+
class ae {
|
|
203
204
|
constructor() {
|
|
204
|
-
|
|
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();
|
|
205
209
|
}
|
|
206
210
|
}
|
|
207
211
|
globalThis && globalThis.__spreadArrays;
|
|
208
|
-
var
|
|
212
|
+
var O;
|
|
209
213
|
(function(e) {
|
|
210
214
|
e.Implementation = "implementation", e.Widget = "widget";
|
|
211
|
-
})(
|
|
212
|
-
var
|
|
215
|
+
})(O || (O = {}));
|
|
216
|
+
var A;
|
|
213
217
|
(function(e) {
|
|
214
218
|
e.Pre = "pre", e.Post = "post";
|
|
215
|
-
})(
|
|
216
|
-
function
|
|
219
|
+
})(A || (A = {}));
|
|
220
|
+
function j(e, t) {
|
|
217
221
|
return typeof e == "undefined" ? t : e;
|
|
218
222
|
}
|
|
219
|
-
var
|
|
223
|
+
var re = function() {
|
|
220
224
|
function e(t) {
|
|
221
225
|
t === void 0 && (t = {}), this.part = t;
|
|
222
226
|
}
|
|
223
227
|
return e.prototype.createCommand = function(t, n, r) {
|
|
224
228
|
var a = this, o;
|
|
225
229
|
typeof n == "function" ? o = {
|
|
226
|
-
scope:
|
|
227
|
-
stage:
|
|
230
|
+
scope: O.Widget,
|
|
231
|
+
stage: A.Post,
|
|
228
232
|
defaultArgs: void 0,
|
|
229
233
|
handlerResolver: n
|
|
230
234
|
} : o = {
|
|
231
|
-
scope:
|
|
232
|
-
stage:
|
|
235
|
+
scope: j(n.scope, O.Widget),
|
|
236
|
+
stage: j(n.stage, A.Post),
|
|
233
237
|
defaultArgs: n.defaultArgs,
|
|
234
238
|
handlerResolver: r
|
|
235
239
|
};
|
|
@@ -243,11 +247,11 @@ var ne = function() {
|
|
|
243
247
|
}, e.prototype.get = function() {
|
|
244
248
|
return this.part;
|
|
245
249
|
}, e;
|
|
246
|
-
}(),
|
|
247
|
-
var t = new
|
|
250
|
+
}(), oe = function(e) {
|
|
251
|
+
var t = new re({});
|
|
248
252
|
return e(t), t.get();
|
|
249
253
|
};
|
|
250
|
-
const
|
|
254
|
+
const ce = oe((e) => {
|
|
251
255
|
e.createCommand("storage", (t) => (n = {}) => {
|
|
252
256
|
const { consent: r } = n;
|
|
253
257
|
if (typeof r != "undefined") {
|
|
@@ -276,17 +280,17 @@ const ae = re((e) => {
|
|
|
276
280
|
return a.indexOf(d.Necessary) === -1 && (process.env.NODE_ENV !== "production" && g.warn(
|
|
277
281
|
`storagePolicyConfigurationApi: passed consent does not include category: '${d.Necessary}'. Consent has to atleast include the '${d.Necessary}' category.
|
|
278
282
|
Passed consent: ${JSON.stringify(r)}`
|
|
279
|
-
), a.unshift(d.Necessary)),
|
|
283
|
+
), a.unshift(d.Necessary)), z(
|
|
280
284
|
t.container,
|
|
281
285
|
"storagePolicy",
|
|
282
286
|
d.Necessary,
|
|
283
287
|
{
|
|
284
288
|
medium: l.Cookie,
|
|
285
|
-
scope:
|
|
289
|
+
scope: $.Tenant,
|
|
286
290
|
duration: { days: 365 }
|
|
287
291
|
}
|
|
288
292
|
).then((o) => o(a)).then(() => {
|
|
289
|
-
|
|
293
|
+
k(t.container), t.events.dispatch("storage:policy-changed", a);
|
|
290
294
|
});
|
|
291
295
|
}
|
|
292
296
|
});
|
|
@@ -294,11 +298,11 @@ const ae = re((e) => {
|
|
|
294
298
|
export {
|
|
295
299
|
d as StorageCategory,
|
|
296
300
|
l as StorageMedium,
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
ae as StorageProvider,
|
|
302
|
+
$ as StorageScope,
|
|
303
|
+
I as StorageService,
|
|
304
|
+
z as createStorageWriter,
|
|
305
|
+
G as readStorage,
|
|
306
|
+
ce as storagePolicyConfigurationApi
|
|
303
307
|
};
|
|
304
308
|
//# 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","_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,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;AA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/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,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QACR;AAAA,QACAnH,EAAgB;AAAA,QAChB;AAAA,UACI,QAAQF,EAAc;AAAA,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;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-services",
|
|
3
|
-
"version": "1.0.21-
|
|
3
|
+
"version": "1.0.21-next.0",
|
|
4
4
|
"description": "Services for ACE Widgets.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
},
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@telia-ace/widget-utilities": "1.0.10-
|
|
24
|
+
"@telia-ace/widget-utilities": "1.0.10-next.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@telia-ace/widget-developer-tools": "1.0.16-
|
|
27
|
+
"@telia-ace/widget-developer-tools": "1.0.16-next.0",
|
|
28
28
|
"@webprovisions/platform": "^1.1.2"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|