@monterosa/sdk-storage-kit 0.18.10 → 2.0.0-rc.2

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.
@@ -1,498 +0,0 @@
1
- import { getItem, setItem, removeItem, clear, checkAvailability, getErrorMessage, MonterosaError, createError } from '@monterosa/sdk-util';
2
- import { registerEmbedHook, onSdkMessage, respondToSdkMessage, BridgeError, sendSdkRequest, getParentApplication } from '@monterosa/sdk-launcher-kit';
3
-
4
- /*! *****************************************************************************
5
- Copyright (c) Microsoft Corporation.
6
-
7
- Permission to use, copy, modify, and/or distribute this software for any
8
- purpose with or without fee is hereby granted.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
- PERFORMANCE OF THIS SOFTWARE.
17
- ***************************************************************************** */
18
-
19
- function __awaiter(thisArg, _arguments, P, generator) {
20
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
21
- return new (P || (P = Promise))(function (resolve, reject) {
22
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
23
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
24
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
25
- step((generator = generator.apply(thisArg, _arguments || [])).next());
26
- });
27
- }
28
-
29
- function __generator(thisArg, body) {
30
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
31
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
32
- function verb(n) { return function (v) { return step([n, v]); }; }
33
- function step(op) {
34
- if (f) throw new TypeError("Generator is already executing.");
35
- while (_) try {
36
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
37
- if (y = 0, t) op = [op[0] & 2, t.value];
38
- switch (op[0]) {
39
- case 0: case 1: t = op; break;
40
- case 4: _.label++; return { value: op[1], done: false };
41
- case 5: _.label++; y = op[1]; op = [0]; continue;
42
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
43
- default:
44
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
45
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
46
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
47
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
48
- if (t[2]) _.ops.pop();
49
- _.trys.pop(); continue;
50
- }
51
- op = body.call(thisArg, _);
52
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
53
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
54
- }
55
- }
56
-
57
- /**
58
- * @license
59
- * types.ts
60
- * storage-kit
61
- *
62
- * Copyright © 2025 Monterosa Productions Limited. All rights reserved.
63
- *
64
- * More details on the license can be found at https://www.monterosa.co/sdk/license
65
- */
66
- var _a;
67
- var StorageAction;
68
- (function (StorageAction) {
69
- StorageAction["Read"] = "storageRead";
70
- StorageAction["Write"] = "storageWrite";
71
- StorageAction["Remove"] = "storageRemove";
72
- StorageAction["Clear"] = "storageClear";
73
- })(StorageAction || (StorageAction = {}));
74
- /**
75
- * Defines a set of error codes that may be encountered when using the
76
- * Storage kit of the Monterosa SDK.
77
- *
78
- * @example
79
- * ```javascript
80
- * try {
81
- * // some code that uses the StorageKit
82
- * } catch (err) {
83
- * if (err.code === StorageError.ParentApp) {
84
- * // handle parent app error
85
- * } else {
86
- * // handle other error types
87
- * }
88
- * }
89
- * ```
90
- *
91
- * @remarks
92
- * - The `StorageError` enum provides a convenient way to handle errors
93
- * encountered when using the `StorageKit` module. By checking the code
94
- * property of the caught error against the values of the enum, the error
95
- * type can be determined and appropriate action taken.
96
- *
97
- * - The `StorageError` enum is not intended to be instantiated or extended.
98
- */
99
- var StorageError;
100
- (function (StorageError) {
101
- /**
102
- * Indicates an error occurred in the parent app.
103
- */
104
- StorageError["ParentAppError"] = "parent_app_error";
105
- /**
106
- * Indicates a timeout occurred when communicating with the parent app.
107
- */
108
- StorageError["ParentTimeoutError"] = "parent_timeout_error";
109
- /**
110
- * Indicates an error occurred when reading from the storage.
111
- */
112
- StorageError["ReadError"] = "read_error";
113
- /**
114
- * Indicates an error occurred when writing to the storage.
115
- */
116
- StorageError["WriteError"] = "write_error";
117
- /**
118
- * Indicates an error occurred when removing from the storage.
119
- */
120
- StorageError["RemoveError"] = "remove_error";
121
- /**
122
- * Indicates an error occurred when clearing the storage.
123
- */
124
- StorageError["ClearError"] = "clear_error";
125
- })(StorageError || (StorageError = {}));
126
- /**
127
- * @internal
128
- */
129
- var StorageErrorMessages = (_a = {},
130
- _a[StorageError.ParentAppError] = function (error) {
131
- return "Parent application error: " + error;
132
- },
133
- _a[StorageError.ParentTimeoutError] = function (error) {
134
- return "Parent application timeout: " + error + ". Please check if the storage-kit is imported on the parent page.";
135
- },
136
- _a[StorageError.ReadError] = function (error) { return "Storage read error: " + error; },
137
- _a[StorageError.WriteError] = function (error) { return "Storage write error: " + error; },
138
- _a[StorageError.RemoveError] = function (error) {
139
- return "Storage remove error: " + error;
140
- },
141
- _a[StorageError.ClearError] = function (error) { return "Storage clear error: " + error; },
142
- _a);
143
-
144
- /**
145
- * @license
146
- * storage_impl.ts
147
- * storage-kit
148
- *
149
- * Copyright © 2025 Monterosa Productions Limited. All rights reserved.
150
- *
151
- * More details on the license can be found at https://www.monterosa.co/sdk/license
152
- */
153
- var StorageImpl = /** @class */ (function () {
154
- function StorageImpl() {
155
- this.memoryStore = {};
156
- this.accessible = checkAvailability();
157
- this._persistent = true;
158
- }
159
- Object.defineProperty(StorageImpl.prototype, "persistent", {
160
- get: function () {
161
- return this._persistent;
162
- },
163
- set: function (newValue) {
164
- var oldValue = this._persistent;
165
- if (oldValue === newValue) {
166
- return;
167
- }
168
- var swapToStorage = newValue === true && this.accessible;
169
- var swapToMemory = newValue === false && this.accessible;
170
- if (swapToStorage) {
171
- for (var _i = 0, _a = Object.entries(this.memoryStore); _i < _a.length; _i++) {
172
- var _b = _a[_i], key = _b[0], value = _b[1];
173
- setItem(key, value);
174
- }
175
- }
176
- if (swapToMemory) {
177
- clear();
178
- }
179
- this._persistent = newValue;
180
- },
181
- enumerable: false,
182
- configurable: true
183
- });
184
- StorageImpl.prototype.getItem = function (key) {
185
- if (this.persistent && this.accessible) {
186
- return getItem(key);
187
- }
188
- if (Object.prototype.hasOwnProperty.call(this.memoryStore, key)) {
189
- return this.memoryStore[key];
190
- }
191
- return null;
192
- };
193
- StorageImpl.prototype.setItem = function (key, value) {
194
- if (this.persistent && this.accessible) {
195
- setItem(key, value);
196
- }
197
- this.memoryStore[key] = value;
198
- };
199
- StorageImpl.prototype.removeItem = function (key) {
200
- if (this.persistent && this.accessible) {
201
- removeItem(key);
202
- }
203
- delete this.memoryStore[key];
204
- };
205
- StorageImpl.prototype.clear = function () {
206
- if (this.persistent && this.accessible) {
207
- clear();
208
- }
209
- this.memoryStore = {};
210
- };
211
- return StorageImpl;
212
- }());
213
-
214
- /**
215
- * @license
216
- * api.ts
217
- * storage-kit
218
- *
219
- * Copyright © 2025 Monterosa Productions Limited. All rights reserved.
220
- *
221
- * More details on the license can be found at https://www.monterosa.co/sdk/license
222
- */
223
- /**
224
- * @internal
225
- */
226
- var storage = new StorageImpl();
227
- /**
228
- * @internal
229
- */
230
- function listenStorageMessages(experience) {
231
- return onSdkMessage(experience, function (message) {
232
- if (!Object.values(StorageAction).includes(message.action)) {
233
- return;
234
- }
235
- try {
236
- var payload = {};
237
- switch (message.action) {
238
- case StorageAction.Read:
239
- payload = {
240
- key: message.payload.key,
241
- value: storage.getItem(message.payload.key),
242
- };
243
- break;
244
- case StorageAction.Write:
245
- payload = {
246
- key: message.payload.key,
247
- };
248
- storage.setItem(message.payload.key, message.payload.value);
249
- break;
250
- case StorageAction.Remove:
251
- payload = {
252
- key: message.payload.key,
253
- };
254
- storage.removeItem(message.payload.key);
255
- break;
256
- case StorageAction.Clear:
257
- storage.clear();
258
- break;
259
- }
260
- respondToSdkMessage(experience, message, payload);
261
- }
262
- catch (err) {
263
- var errorMessage = getErrorMessage(err);
264
- console.error("Unable to handle storage message " + message.action + " with error: " + errorMessage);
265
- respondToSdkMessage(experience, message, {
266
- key: message.payload.key,
267
- error: errorMessage,
268
- });
269
- }
270
- });
271
- }
272
- function parentAppRequest(parentApp, action, payload) {
273
- return __awaiter(this, void 0, void 0, function () {
274
- var response, _a, value, error, err_1, errorMessage;
275
- return __generator(this, function (_b) {
276
- switch (_b.label) {
277
- case 0:
278
- _b.trys.push([0, 2, , 3]);
279
- return [4 /*yield*/, sendSdkRequest(parentApp, action, payload)];
280
- case 1:
281
- response = _b.sent();
282
- _a = response.payload, value = _a.value, error = _a.error;
283
- if (error !== undefined) {
284
- throw createError(StorageError.ParentAppError, StorageErrorMessages, error);
285
- }
286
- return [2 /*return*/, value];
287
- case 2:
288
- err_1 = _b.sent();
289
- if (err_1 instanceof MonterosaError &&
290
- err_1.code === BridgeError.RequestTimeoutError) {
291
- errorMessage = getErrorMessage(err_1);
292
- throw createError(StorageError.ParentTimeoutError, StorageErrorMessages, errorMessage);
293
- }
294
- throw err_1;
295
- case 3: return [2 /*return*/];
296
- }
297
- });
298
- });
299
- }
300
- /**
301
- * The `setStoragePersistent` function is a simple function that allows to
302
- * control the persistence of the SDK storage. If the argument `persistent` is
303
- * set to `true`, then the storage will be persistent across browser sessions
304
- * and if it is set to `false`, then the storage will save to memory.
305
- * It is important to note that the use of persistent storage may be subject
306
- * to laws and regulations, such as those related to data privacy and protection.
307
- *
308
- * @remarks
309
- * - We transition from persistent to memory and memory to persistent in
310
- * a seamless manner for you
311
- *
312
- * - By default we store in memory
313
- *
314
- * - The value of storage persistent persists across session (aka put it to true,
315
- * it will remain so, put it back to false, it will remain so)
316
- *
317
- * - You have the responsibility to comply with any laws and regulations, and
318
- * store only the data if you know it's valid to do so
319
- *
320
- * @param persistent - Determines whether or not SDK storage should persist
321
- * across browser sessions.
322
- */
323
- function setStoragePersistent(persistent) {
324
- storage.persistent = persistent;
325
- }
326
- /**
327
- * The function allows to read data from the SDK storage.
328
- *
329
- * @param key - The name of the item to be read from storage.
330
- *
331
- * @throws
332
- * The function throws an error if there is a timeout reading the data
333
- * from the parent application storage.
334
- *
335
- * @returns A promise that resolves to the value
336
- * of the item in storage or `null` if the item doesn't exist.
337
- */
338
- function storageRead(key) {
339
- return __awaiter(this, void 0, void 0, function () {
340
- var parentApp, value, err_2, errorMessage;
341
- return __generator(this, function (_a) {
342
- switch (_a.label) {
343
- case 0:
344
- parentApp = getParentApplication();
345
- value = null;
346
- _a.label = 1;
347
- case 1:
348
- _a.trys.push([1, 5, , 6]);
349
- if (!(parentApp !== null)) return [3 /*break*/, 3];
350
- return [4 /*yield*/, parentAppRequest(parentApp, StorageAction.Read, {
351
- key: key,
352
- })];
353
- case 2:
354
- value = _a.sent();
355
- return [3 /*break*/, 4];
356
- case 3:
357
- value = storage.getItem(key);
358
- _a.label = 4;
359
- case 4: return [3 /*break*/, 6];
360
- case 5:
361
- err_2 = _a.sent();
362
- errorMessage = getErrorMessage(err_2);
363
- console.error("Unable to read storage item \"" + key + "\" with error: " + errorMessage);
364
- throw createError(StorageError.ReadError, StorageErrorMessages, errorMessage);
365
- case 6: return [2 /*return*/, value];
366
- }
367
- });
368
- });
369
- }
370
- /**
371
- * The function allows to write data to the SDK storage.
372
- *
373
- * @param key - A name of the item to be stored.
374
- * @param value - A value to be stored.
375
- *
376
- * @throws
377
- * The function throws an error if there is a timeout writing the data
378
- * to the parent's application storage.
379
- *
380
- * @returns A promise that resolves to `void` once the data has
381
- * been successfully stored.
382
- */
383
- function storageWrite(key, value) {
384
- return __awaiter(this, void 0, void 0, function () {
385
- var parentApp, err_3, errorMessage;
386
- return __generator(this, function (_a) {
387
- switch (_a.label) {
388
- case 0:
389
- parentApp = getParentApplication();
390
- _a.label = 1;
391
- case 1:
392
- _a.trys.push([1, 5, , 6]);
393
- if (!(parentApp !== null)) return [3 /*break*/, 3];
394
- return [4 /*yield*/, parentAppRequest(parentApp, StorageAction.Write, {
395
- key: key,
396
- value: value,
397
- })];
398
- case 2:
399
- _a.sent();
400
- return [3 /*break*/, 4];
401
- case 3:
402
- storage.setItem(key, value);
403
- _a.label = 4;
404
- case 4: return [3 /*break*/, 6];
405
- case 5:
406
- err_3 = _a.sent();
407
- errorMessage = getErrorMessage(err_3);
408
- console.error("Unable to write storage item \"" + key + "\" with error: " + errorMessage);
409
- throw createError(StorageError.WriteError, StorageErrorMessages, errorMessage);
410
- case 6: return [2 /*return*/];
411
- }
412
- });
413
- });
414
- }
415
- /**
416
- * The function allows to remove an item from the SDK storage.
417
- *
418
- * @param key - A name of the item to be removed.
419
- *
420
- * @throws
421
- * The function throws an error if there is a timeout removing the data
422
- * from the parent's application storage.
423
- *
424
- * @returns A promise that resolves to `void` once the data has
425
- * been successfully removed.
426
- */
427
- function storageRemove(key) {
428
- return __awaiter(this, void 0, void 0, function () {
429
- var parentApp, err_4, errorMessage;
430
- return __generator(this, function (_a) {
431
- switch (_a.label) {
432
- case 0:
433
- parentApp = getParentApplication();
434
- _a.label = 1;
435
- case 1:
436
- _a.trys.push([1, 5, , 6]);
437
- if (!(parentApp !== null)) return [3 /*break*/, 3];
438
- return [4 /*yield*/, parentAppRequest(parentApp, StorageAction.Remove, { key: key })];
439
- case 2:
440
- _a.sent();
441
- return [3 /*break*/, 4];
442
- case 3:
443
- storage.removeItem(key);
444
- _a.label = 4;
445
- case 4: return [3 /*break*/, 6];
446
- case 5:
447
- err_4 = _a.sent();
448
- errorMessage = getErrorMessage(err_4);
449
- console.error("Unable to remove storage item \"" + key + "\" with error: " + errorMessage);
450
- throw createError(StorageError.RemoveError, StorageErrorMessages, errorMessage);
451
- case 6: return [2 /*return*/];
452
- }
453
- });
454
- });
455
- }
456
- /**
457
- * The function allows to clear all data from the SDK storage.
458
- *
459
- * @throws
460
- * The function throws an error if there is a timeout clearing the parent's
461
- * application storage.
462
- *
463
- * @returns A promise that resolves to `void` once the data has been
464
- * successfully cleared.
465
- */
466
- function storageClear() {
467
- return __awaiter(this, void 0, void 0, function () {
468
- var parentApp, err_5, errorMessage;
469
- return __generator(this, function (_a) {
470
- switch (_a.label) {
471
- case 0:
472
- parentApp = getParentApplication();
473
- _a.label = 1;
474
- case 1:
475
- _a.trys.push([1, 5, , 6]);
476
- if (!(parentApp !== null)) return [3 /*break*/, 3];
477
- return [4 /*yield*/, parentAppRequest(parentApp, StorageAction.Clear)];
478
- case 2:
479
- _a.sent();
480
- return [3 /*break*/, 4];
481
- case 3:
482
- storage.clear();
483
- _a.label = 4;
484
- case 4: return [3 /*break*/, 6];
485
- case 5:
486
- err_5 = _a.sent();
487
- errorMessage = getErrorMessage(err_5);
488
- console.error("Unable to clear storage with error: " + errorMessage);
489
- throw createError(StorageError.ClearError, StorageErrorMessages, errorMessage);
490
- case 6: return [2 /*return*/];
491
- }
492
- });
493
- });
494
- }
495
- registerEmbedHook(listenStorageMessages);
496
-
497
- export { StorageError, listenStorageMessages, parentAppRequest, setStoragePersistent, storage, storageClear, storageRead, storageRemove, storageWrite };
498
- //# sourceMappingURL=index.esm5.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm5.js","sources":["../src/types.ts","../src/storage_impl.ts","../src/api.ts"],"sourcesContent":["/**\n * @license\n * types.ts\n * storage-kit\n *\n * Copyright © 2025 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nexport enum StorageAction {\n Read = 'storageRead',\n Write = 'storageWrite',\n Remove = 'storageRemove',\n Clear = 'storageClear',\n}\n\nexport type ResponsePayload = {\n key: string;\n value?: string | null;\n error?: string;\n};\n\n/**\n * Defines a set of error codes that may be encountered when using the\n * Storage kit of the Monterosa SDK.\n *\n * @example\n * ```javascript\n * try {\n * // some code that uses the StorageKit\n * } catch (err) {\n * if (err.code === StorageError.ParentApp) {\n * // handle parent app error\n * } else {\n * // handle other error types\n * }\n * }\n * ```\n *\n * @remarks\n * - The `StorageError` enum provides a convenient way to handle errors\n * encountered when using the `StorageKit` module. By checking the code\n * property of the caught error against the values of the enum, the error\n * type can be determined and appropriate action taken.\n *\n * - The `StorageError` enum is not intended to be instantiated or extended.\n */\nexport enum StorageError {\n /**\n * Indicates an error occurred in the parent app.\n */\n ParentAppError = 'parent_app_error',\n /**\n * Indicates a timeout occurred when communicating with the parent app.\n */\n ParentTimeoutError = 'parent_timeout_error',\n /**\n * Indicates an error occurred when reading from the storage.\n */\n ReadError = 'read_error',\n /**\n * Indicates an error occurred when writing to the storage.\n */\n WriteError = 'write_error',\n /**\n * Indicates an error occurred when removing from the storage.\n */\n RemoveError = 'remove_error',\n /**\n * Indicates an error occurred when clearing the storage.\n */\n ClearError = 'clear_error',\n}\n\n/**\n * @internal\n */\nexport const StorageErrorMessages = {\n [StorageError.ParentAppError]: (error: string) =>\n `Parent application error: ${error}`,\n [StorageError.ParentTimeoutError]: (error: string) =>\n `Parent application timeout: ${error}. Please check if the storage-kit is imported on the parent page.`,\n [StorageError.ReadError]: (error: string) => `Storage read error: ${error}`,\n [StorageError.WriteError]: (error: string) => `Storage write error: ${error}`,\n [StorageError.RemoveError]: (error: string) =>\n `Storage remove error: ${error}`,\n [StorageError.ClearError]: (error: string) => `Storage clear error: ${error}`,\n};\n","/**\n * @license\n * storage_impl.ts\n * storage-kit\n *\n * Copyright © 2025 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport {\n checkAvailability,\n getItem,\n setItem,\n removeItem,\n clear,\n} from '@monterosa/sdk-util';\n\nexport class StorageImpl {\n private memoryStore: { [key: string]: string } = {};\n private accessible: boolean = checkAvailability();\n private _persistent: boolean = true;\n\n set persistent(newValue: boolean) {\n const oldValue = this._persistent;\n\n if (oldValue === newValue) {\n return;\n }\n\n const swapToStorage = newValue === true && this.accessible;\n const swapToMemory = newValue === false && this.accessible;\n\n if (swapToStorage) {\n for (const [key, value] of Object.entries(this.memoryStore)) {\n setItem(key, value);\n }\n }\n\n if (swapToMemory) {\n clear();\n }\n\n this._persistent = newValue;\n }\n\n get persistent(): boolean {\n return this._persistent;\n }\n\n getItem(key: string): string | null {\n if (this.persistent && this.accessible) {\n return getItem(key);\n }\n\n if (Object.prototype.hasOwnProperty.call(this.memoryStore, key)) {\n return this.memoryStore[key];\n }\n\n return null;\n }\n\n setItem(key: string, value: string): void {\n if (this.persistent && this.accessible) {\n setItem(key, value);\n }\n\n this.memoryStore[key] = value;\n }\n\n removeItem(key: string): void {\n if (this.persistent && this.accessible) {\n removeItem(key);\n }\n\n delete this.memoryStore[key];\n }\n\n clear(): void {\n if (this.persistent && this.accessible) {\n clear();\n }\n\n this.memoryStore = {};\n }\n}\n","/**\n * @license\n * api.ts\n * storage-kit\n *\n * Copyright © 2025 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport {\n MonterosaError,\n Unsubscribe,\n createError,\n getErrorMessage,\n} from '@monterosa/sdk-util';\nimport {\n Experience,\n Payload,\n ParentApplication,\n registerEmbedHook,\n getParentApplication,\n sendSdkRequest,\n respondToSdkMessage,\n onSdkMessage,\n BridgeError,\n} from '@monterosa/sdk-launcher-kit';\n\nimport {\n StorageAction,\n ResponsePayload,\n StorageError,\n StorageErrorMessages,\n} from './types';\nimport { StorageImpl } from './storage_impl';\n\n/**\n * @internal\n */\nexport const storage = new StorageImpl();\n\n/**\n * @internal\n */\nexport function listenStorageMessages(experience: Experience): Unsubscribe {\n return onSdkMessage(experience, (message) => {\n if (\n !Object.values(StorageAction).includes(message.action as StorageAction)\n ) {\n return;\n }\n\n try {\n let payload: Payload = {};\n\n switch (message.action) {\n case StorageAction.Read:\n payload = {\n key: message.payload.key,\n value: storage.getItem(message.payload.key),\n };\n break;\n case StorageAction.Write:\n payload = {\n key: message.payload.key,\n };\n storage.setItem(message.payload.key, message.payload.value);\n break;\n case StorageAction.Remove:\n payload = {\n key: message.payload.key,\n };\n storage.removeItem(message.payload.key);\n break;\n case StorageAction.Clear:\n storage.clear();\n break;\n }\n\n respondToSdkMessage(experience, message, payload);\n } catch (err) {\n const errorMessage = getErrorMessage(err);\n\n console.error(\n `Unable to handle storage message ${message.action} with error: ${errorMessage}`,\n );\n\n respondToSdkMessage(experience, message, {\n key: message.payload.key,\n error: errorMessage,\n });\n }\n });\n}\n\n/**\n * @internal\n */\nexport async function parentAppRequest(\n parentApp: ParentApplication,\n action: StorageAction.Read,\n payload?: Payload,\n): Promise<string | null>;\n\nexport async function parentAppRequest(\n parentApp: ParentApplication,\n action: StorageAction.Write | StorageAction.Remove | StorageAction.Clear,\n payload?: Payload,\n): Promise<undefined>;\n\nexport async function parentAppRequest(\n parentApp: ParentApplication,\n action: StorageAction,\n payload?: Payload,\n): Promise<string | null | undefined> {\n try {\n const response = await sendSdkRequest(parentApp, action, payload);\n\n const { value, error } = response.payload as ResponsePayload;\n\n if (error !== undefined) {\n throw createError(\n StorageError.ParentAppError,\n StorageErrorMessages,\n error,\n );\n }\n\n return value;\n } catch (err) {\n if (\n err instanceof MonterosaError &&\n err.code === BridgeError.RequestTimeoutError\n ) {\n const errorMessage = getErrorMessage(err);\n\n throw createError(\n StorageError.ParentTimeoutError,\n StorageErrorMessages,\n errorMessage,\n );\n }\n\n throw err;\n }\n}\n\n/**\n * The `setStoragePersistent` function is a simple function that allows to\n * control the persistence of the SDK storage. If the argument `persistent` is\n * set to `true`, then the storage will be persistent across browser sessions\n * and if it is set to `false`, then the storage will save to memory.\n * It is important to note that the use of persistent storage may be subject\n * to laws and regulations, such as those related to data privacy and protection.\n *\n * @remarks\n * - We transition from persistent to memory and memory to persistent in\n * a seamless manner for you\n *\n * - By default we store in memory\n *\n * - The value of storage persistent persists across session (aka put it to true,\n * it will remain so, put it back to false, it will remain so)\n *\n * - You have the responsibility to comply with any laws and regulations, and\n * store only the data if you know it's valid to do so\n *\n * @param persistent - Determines whether or not SDK storage should persist\n * across browser sessions.\n */\nexport function setStoragePersistent(persistent: boolean): void {\n storage.persistent = persistent;\n}\n\n/**\n * The function allows to read data from the SDK storage.\n *\n * @param key - The name of the item to be read from storage.\n *\n * @throws\n * The function throws an error if there is a timeout reading the data\n * from the parent application storage.\n *\n * @returns A promise that resolves to the value\n * of the item in storage or `null` if the item doesn't exist.\n */\nexport async function storageRead(key: string): Promise<string | null> {\n const parentApp = getParentApplication();\n\n let value: string | null = null;\n\n try {\n if (parentApp !== null) {\n value = await parentAppRequest(parentApp, StorageAction.Read, {\n key,\n });\n } else {\n value = storage.getItem(key);\n }\n } catch (err) {\n const errorMessage = getErrorMessage(err);\n\n console.error(\n `Unable to read storage item \"${key}\" with error: ${errorMessage}`,\n );\n\n throw createError(\n StorageError.ReadError,\n StorageErrorMessages,\n errorMessage,\n );\n }\n\n return value;\n}\n\n/**\n * The function allows to write data to the SDK storage.\n *\n * @param key - A name of the item to be stored.\n * @param value - A value to be stored.\n *\n * @throws\n * The function throws an error if there is a timeout writing the data\n * to the parent's application storage.\n *\n * @returns A promise that resolves to `void` once the data has\n * been successfully stored.\n */\nexport async function storageWrite(key: string, value: string): Promise<void> {\n const parentApp = getParentApplication();\n\n try {\n if (parentApp !== null) {\n await parentAppRequest(parentApp, StorageAction.Write, {\n key,\n value,\n });\n } else {\n storage.setItem(key, value);\n }\n } catch (err) {\n const errorMessage = getErrorMessage(err);\n\n console.error(\n `Unable to write storage item \"${key}\" with error: ${errorMessage}`,\n );\n\n throw createError(\n StorageError.WriteError,\n StorageErrorMessages,\n errorMessage,\n );\n }\n}\n\n/**\n * The function allows to remove an item from the SDK storage.\n *\n * @param key - A name of the item to be removed.\n *\n * @throws\n * The function throws an error if there is a timeout removing the data\n * from the parent's application storage.\n *\n * @returns A promise that resolves to `void` once the data has\n * been successfully removed.\n */\nexport async function storageRemove(key: string): Promise<void> {\n const parentApp = getParentApplication();\n\n try {\n if (parentApp !== null) {\n await parentAppRequest(parentApp, StorageAction.Remove, { key });\n } else {\n storage.removeItem(key);\n }\n } catch (err) {\n const errorMessage = getErrorMessage(err);\n\n console.error(\n `Unable to remove storage item \"${key}\" with error: ${errorMessage}`,\n );\n\n throw createError(\n StorageError.RemoveError,\n StorageErrorMessages,\n errorMessage,\n );\n }\n}\n\n/**\n * The function allows to clear all data from the SDK storage.\n *\n * @throws\n * The function throws an error if there is a timeout clearing the parent's\n * application storage.\n *\n * @returns A promise that resolves to `void` once the data has been\n * successfully cleared.\n */\nexport async function storageClear(): Promise<void> {\n const parentApp = getParentApplication();\n\n try {\n if (parentApp !== null) {\n await parentAppRequest(parentApp, StorageAction.Clear);\n } else {\n storage.clear();\n }\n } catch (err) {\n const errorMessage = getErrorMessage(err);\n\n console.error(`Unable to clear storage with error: ${errorMessage}`);\n\n throw createError(\n StorageError.ClearError,\n StorageErrorMessages,\n errorMessage,\n );\n }\n}\n\nregisterEmbedHook(listenStorageMessages);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AAQG;;AAEH,IAAY,aAKX,CAAA;AALD,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,MAAA,CAAA,G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