buzzcasting-storage 2.10.4 → 2.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,8 @@ export declare enum API {
9
9
 
10
10
  export declare type ApiData = ISeries & IMessages & ICloud;
11
11
 
12
+ export declare function attrs(attributes: NamedNodeMap): any;
13
+
12
14
  export declare class BuzzcastingStorageManager {
13
15
  private sm;
14
16
  private api;
@@ -153,7 +155,7 @@ export declare interface IDynamics {
153
155
  }
154
156
 
155
157
  declare interface IFilteredAttributes {
156
- [x: string]: string;
158
+ [key: string]: string | object;
157
159
  }
158
160
 
159
161
  export declare interface IGeo {
@@ -1,12 +1,12 @@
1
1
  var Ei = Object.defineProperty;
2
2
  var Oi = (v, o, l) => o in v ? Ei(v, o, { enumerable: !0, configurable: !0, writable: !0, value: l }) : v[o] = l;
3
- var I = (v, o, l) => (Oi(v, typeof o != "symbol" ? o + "" : o, l), l);
4
- const xi = "2.10.3";
3
+ var P = (v, o, l) => (Oi(v, typeof o != "symbol" ? o + "" : o, l), l);
4
+ const xi = "2.10.5";
5
5
  class ki {
6
6
  constructor(o) {
7
- I(this, "options");
8
- I(this, "url");
9
- I(this, "headers", () => {
7
+ P(this, "options");
8
+ P(this, "url");
9
+ P(this, "headers", () => {
10
10
  const o = `Bearer ${this.options.bearer}`;
11
11
  return {
12
12
  headers: new Headers({
@@ -19,9 +19,9 @@ class ki {
19
19
  this.options = o, this.url = `https://${o.app}.buzzcasting.net`;
20
20
  }
21
21
  async get(o) {
22
- const { version: l } = this.options, y = this.headers(), P = Object.assign({}, o);
23
- delete P.slide, delete P.type, delete P.hash;
24
- const M = Object.keys(P).length > 0 ? `?${new URLSearchParams(P).toString()}` : "";
22
+ const { version: l } = this.options, y = this.headers(), I = Object.assign({}, o);
23
+ delete I.slide, delete I.type, delete I.hash;
24
+ const M = Object.keys(I).length > 0 ? `?${new URLSearchParams(I).toString()}` : "";
25
25
  return console.debug(
26
26
  "%capi%c %cget",
27
27
  x.API,
@@ -39,7 +39,7 @@ class ki {
39
39
  }).then((j) => j.json()).then((j) => (j.query = o, j)).catch((j) => ({ success: !1, message: `${j}`, data: null }));
40
40
  }
41
41
  async hideMessage(o) {
42
- const { app: l, version: y } = this.options, P = this.headers(), M = "?action=visible";
42
+ const { app: l, version: y } = this.options, I = this.headers(), M = "?action=visible";
43
43
  return console.info(
44
44
  "%capi%c %cpost",
45
45
  x.API,
@@ -47,10 +47,10 @@ class ki {
47
47
  x.GET_DATA,
48
48
  ue.HIDE_MESSAGE,
49
49
  [l, "api", y, o.type, o.id].join("/") + M,
50
- { ...P, method: "put" }
50
+ { ...I, method: "put" }
51
51
  ), await fetch(
52
52
  [l, "api", y, o.type, o.id].join("/") + M,
53
- { ...P, method: "put" }
53
+ { ...I, method: "put" }
54
54
  ).then((j) => {
55
55
  if (!j.ok)
56
56
  throw new Error(j.statusText);
@@ -82,7 +82,7 @@ var Rr = { exports: {} };
82
82
  return e;
83
83
  }).apply(this, arguments);
84
84
  };
85
- function P(e, t, n) {
85
+ function I(e, t, n) {
86
86
  if (n || arguments.length === 2)
87
87
  for (var r, i = 0, a = t.length; i < a; i++)
88
88
  !r && i in t || ((r = r || Array.prototype.slice.call(t, 0, i))[i] = t[i]);
@@ -2462,7 +2462,7 @@ var Rr = { exports: {} };
2462
2462
  var d, p, m, w = B.trans, g = c.keys || jn(r, c);
2463
2463
  if (!g)
2464
2464
  throw new Error("Keys missing");
2465
- return (c = c.type === "add" || c.type === "put" ? y(y({}, c), { keys: g }) : y({}, c)).type !== "delete" && (c.values = P([], c.values, !0)), c.keys && (c.keys = P([], c.keys, !0)), d = n, m = g, ((p = c).type === "add" ? Promise.resolve([]) : d.getMany({ trans: p.trans, keys: m, cache: "immutable" })).then(function(_) {
2465
+ return (c = c.type === "add" || c.type === "put" ? y(y({}, c), { keys: g }) : y({}, c)).type !== "delete" && (c.values = I([], c.values, !0)), c.keys && (c.keys = I([], c.keys, !0)), d = n, m = g, ((p = c).type === "add" ? Promise.resolve([]) : d.getMany({ trans: p.trans, keys: m, cache: "immutable" })).then(function(_) {
2466
2466
  var S = g.map(function(E, O) {
2467
2467
  var k, C, A, R = _[O], D = { onerror: null, onsuccess: null };
2468
2468
  return c.type === "delete" ? u.fire.call(D, E, R, w) : c.type === "add" || R === void 0 ? (k = h.fire.call(D, E, c.values[O], w), E == null && k != null && (c.keys[O] = E = k, r.outbound || fe(c.values[O], r.keyPath, E))) : (k = Tn(R, c.values[O]), (C = f.fire.call(D, k, E, R, w)) && (A = c.values[O], Object.keys(C).forEach(function(G) {
@@ -3246,10 +3246,10 @@ function nt(v) {
3246
3246
  }
3247
3247
  function vt(v, o) {
3248
3248
  var N;
3249
- let l, y, P, M, j;
3249
+ let l, y, I, M, j;
3250
3250
  switch (v.moderation) {
3251
3251
  case Xt.BEFORE:
3252
- l = /* @__PURE__ */ new Date(), y = (N = v.beforeTime) == null ? void 0 : N.split(":"), P = Number.parseInt(y ? y[0] : "00"), M = Number.parseInt(y ? y[1] : "00"), j = Number.parseInt(y ? y[2] : "00"), o.before = l.setHours(P, M, j, 0) / 1e3, o.period || (o.period = l.getDay() === 1 ? 72 : 24);
3252
+ l = /* @__PURE__ */ new Date(), y = (N = v.beforeTime) == null ? void 0 : N.split(":"), I = Number.parseInt(y ? y[0] : "00"), M = Number.parseInt(y ? y[1] : "00"), j = Number.parseInt(y ? y[2] : "00"), o.before = l.setHours(I, M, j, 0) / 1e3, o.period || (o.period = l.getDay() === 1 ? 72 : 24);
3253
3253
  break;
3254
3254
  case Xt.DELAYED:
3255
3255
  v.delay && v.delay > 0 && (o.delay = `${v.delay}`);
@@ -3264,15 +3264,15 @@ function vt(v, o) {
3264
3264
  }
3265
3265
  class Tr {
3266
3266
  constructor(o) {
3267
- I(this, "db");
3268
- I(this, "subscribers", []);
3269
- I(this, "options");
3267
+ P(this, "db");
3268
+ P(this, "subscribers", []);
3269
+ P(this, "options");
3270
3270
  /**
3271
3271
  * Retrieve Cloud Data
3272
3272
  * @param query IQuery
3273
3273
  * @returns IResponse
3274
3274
  */
3275
- I(this, "getCloud", async (o) => {
3275
+ P(this, "getCloud", async (o) => {
3276
3276
  const l = await this.db.table(K.CLOUD).where({ id: o.widget }).last().catch(() => (console.warn(
3277
3277
  "%capi%C %ccloud",
3278
3278
  x.API,
@@ -3288,7 +3288,7 @@ class Tr {
3288
3288
  * @param query IQuery
3289
3289
  * @returns IResponse
3290
3290
  */
3291
- I(this, "getSeries", async (o) => {
3291
+ P(this, "getSeries", async (o) => {
3292
3292
  const l = await this.db.table(K.SERIES).where({ id: o.widget }).last().catch(() => (console.warn(
3293
3293
  "%capi%c %cseries",
3294
3294
  x.API,
@@ -3304,10 +3304,10 @@ class Tr {
3304
3304
  * @param query IQuery
3305
3305
  * @returns IResponse
3306
3306
  */
3307
- I(this, "getMessages", async (o) => {
3308
- const l = (M) => M.widget_id === o.widget, y = (M) => M.utc > ((o == null ? void 0 : o.since) || 0), P = (M) => (M == null ? void 0 : M.visible) !== 0;
3307
+ P(this, "getMessages", async (o) => {
3308
+ const l = (M) => M.widget_id === o.widget, y = (M) => M.utc > ((o == null ? void 0 : o.since) || 0), I = (M) => (M == null ? void 0 : M.visible) !== 0;
3309
3309
  try {
3310
- const M = await this.db.table(K.TOPICS).orderBy("utc").reverse().filter(l).filter(y).filter(P).limit((o == null ? void 0 : o.limit) ?? 25).toArray().catch(() => (console.warn(
3310
+ const M = await this.db.table(K.TOPICS).orderBy("utc").reverse().filter(l).filter(y).filter(I).limit((o == null ? void 0 : o.limit) ?? 25).toArray().catch(() => (console.warn(
3311
3311
  "%capi%c %cmessages",
3312
3312
  x.API,
3313
3313
  x.NONE,
@@ -3341,7 +3341,7 @@ class Tr {
3341
3341
  * @param data
3342
3342
  * @returns number
3343
3343
  */
3344
- I(this, "setCloud", async (o, l) => o.type === K.CLOUD && l !== "" ? await this.db.table(K.CLOUD).put({
3344
+ P(this, "setCloud", async (o, l) => o.type === K.CLOUD && l !== "" ? await this.db.table(K.CLOUD).put({
3345
3345
  id: o.widget,
3346
3346
  dashboard_id: o.dashboard,
3347
3347
  data: l.data
@@ -3352,7 +3352,7 @@ class Tr {
3352
3352
  * @param data
3353
3353
  * @returns number
3354
3354
  */
3355
- I(this, "setSeries", async (o, l) => o.type === K.SERIES && l !== "" ? await this.db.table(K.SERIES).put({
3355
+ P(this, "setSeries", async (o, l) => o.type === K.SERIES && l !== "" ? await this.db.table(K.SERIES).put({
3356
3356
  id: o.widget,
3357
3357
  dashboard_id: o.dashboard,
3358
3358
  data: l.data
@@ -3366,36 +3366,36 @@ class Tr {
3366
3366
  * @param data.data.messages IMessages
3367
3367
  * @returns number
3368
3368
  */
3369
- I(this, "setMessages", async (o, l) => {
3369
+ P(this, "setMessages", async (o, l) => {
3370
3370
  if (o.type !== K.MESSAGES)
3371
3371
  return 400;
3372
3372
  const y = l.title;
3373
3373
  try {
3374
- return l.data.messages.forEach(async (P) => {
3374
+ return l.data.messages.forEach(async (I) => {
3375
3375
  var M, j, N;
3376
- await this.db.table(K.MESSAGES).put({ id: P.id, utc: P.utc, data: P }), await this.db.table(K.TOPICS).put({
3376
+ await this.db.table(K.MESSAGES).put({ id: I.id, utc: I.utc, data: I }), await this.db.table(K.TOPICS).put({
3377
3377
  widget_id: o.widget,
3378
- message_id: P.id,
3378
+ message_id: I.id,
3379
3379
  dashboard_id: o.dashboard,
3380
3380
  title: y,
3381
- engagement: (M = P.dynamics) == null ? void 0 : M.engagement,
3382
- impressions: (j = P.dynamics) == null ? void 0 : j.semrush_visits,
3383
- reach: (N = P.dynamics) == null ? void 0 : N.potential_reach,
3384
- sentiment: P.topics[0].sentiment,
3385
- utc: P.utc
3381
+ engagement: (M = I.dynamics) == null ? void 0 : M.engagement,
3382
+ impressions: (j = I.dynamics) == null ? void 0 : j.semrush_visits,
3383
+ reach: (N = I.dynamics) == null ? void 0 : N.potential_reach,
3384
+ sentiment: I.topics[0].sentiment,
3385
+ utc: I.utc
3386
3386
  });
3387
3387
  }), 201;
3388
- } catch (P) {
3389
- return console.error("%cstorage", x.STORAGE, "set", o, P), 400;
3388
+ } catch (I) {
3389
+ return console.error("%cstorage", x.STORAGE, "set", o, I), 400;
3390
3390
  }
3391
3391
  });
3392
3392
  /**
3393
3393
  * Wipe Message data after number of seconds
3394
3394
  * @param retentionDuration
3395
3395
  */
3396
- I(this, "cleanMessages", async (o) => {
3397
- const l = Date.now() / 1e3, y = (P) => P.utc < o - l;
3398
- await this.db.table("topics").orderBy("utc").filter(y).modify((P, M) => {
3396
+ P(this, "cleanMessages", async (o) => {
3397
+ const l = Date.now() / 1e3, y = (I) => I.utc < o - l;
3398
+ await this.db.table("topics").orderBy("utc").filter(y).modify((I, M) => {
3399
3399
  delete M.value;
3400
3400
  });
3401
3401
  });
@@ -3404,7 +3404,7 @@ class Tr {
3404
3404
  * @param query IQuery
3405
3405
  * @returns number
3406
3406
  */
3407
- I(this, "setWidget", async (o) => await this.db.table(K.WIDGETS).put({
3407
+ P(this, "setWidget", async (o) => await this.db.table(K.WIDGETS).put({
3408
3408
  id: o.widget,
3409
3409
  dashboard_id: o.dashboard,
3410
3410
  type: o.type
@@ -3414,7 +3414,7 @@ class Tr {
3414
3414
  * @param query IQuery
3415
3415
  * @returns null
3416
3416
  */
3417
- I(this, "subscribe", (o) => (o = nt(o), this.subscribers.filter(
3417
+ P(this, "subscribe", (o) => (o = nt(o), this.subscribers.filter(
3418
3418
  (y) => y.widget === o.widget
3419
3419
  ).length > 0 || (o.type === K.MESSAGES && (o = vt(this.options, o)), console.debug(
3420
3420
  "%cstorage%c %csubscribe",
@@ -3428,7 +3428,7 @@ class Tr {
3428
3428
  * Get current subscribers
3429
3429
  * @returns IQuery[]
3430
3430
  */
3431
- I(this, "getSubscribers", async () => await new Promise((o) => o(this.subscribers)));
3431
+ P(this, "getSubscribers", async () => await new Promise((o) => o(this.subscribers)));
3432
3432
  this.options = o, this.db = new Wn(o.app), this.db.version(2).stores({
3433
3433
  player: "id,title,name,location",
3434
3434
  monitor: "id,player_id,cols,rows,order,width,height,physicalwidth,physicalheight,devicePixelRatio,screenLeft,screenTop,orientation,monitor",
@@ -3452,7 +3452,7 @@ function Pi(v, o) {
3452
3452
  const l = indexedDB.open(v);
3453
3453
  l.onupgradeneeded = () => l.result.createObjectStore(o);
3454
3454
  const y = zn(l);
3455
- return (P, M) => y.then((j) => M(j.transaction(o, P).objectStore(o)));
3455
+ return (I, M) => y.then((j) => M(j.transaction(o, I).objectStore(o)));
3456
3456
  }
3457
3457
  let Gn;
3458
3458
  function jr() {
@@ -3466,17 +3466,17 @@ function Vt(v, o, l = jr()) {
3466
3466
  }
3467
3467
  class Mr {
3468
3468
  constructor(o) {
3469
- I(this, "subscribers", []);
3470
- I(this, "options");
3471
- I(this, "getCloud", async (o) => {
3469
+ P(this, "subscribers", []);
3470
+ P(this, "options");
3471
+ P(this, "getCloud", async (o) => {
3472
3472
  const l = X(o);
3473
3473
  return await Ln(l).then((y) => y).catch(() => (console.warn("%capi", x.API, K.CLOUD, o.slide, o.widget), { data: null, message: "Cloud Data error", success: !1 }));
3474
3474
  });
3475
- I(this, "getSeries", async (o) => {
3475
+ P(this, "getSeries", async (o) => {
3476
3476
  const l = X(o);
3477
3477
  return await Ln(l).then((y) => y).catch(() => (console.warn("%capi", x.API, K.SERIES, o.slide, o.widget), { data: null, message: "Series Data error", success: !1 }));
3478
3478
  });
3479
- I(this, "getMessages", async (o) => {
3479
+ P(this, "getMessages", async (o) => {
3480
3480
  const l = X(o);
3481
3481
  return await Ln(l).then((y) => y).catch(() => (console.warn("%capi", x.API, K.MESSAGES, o.slide, o.widget), { data: null, message: "Messages Data error", success: !1 }));
3482
3482
  });
@@ -3486,11 +3486,11 @@ class Mr {
3486
3486
  * @param data
3487
3487
  * @returns number
3488
3488
  */
3489
- I(this, "setCloud", async (o, l) => {
3489
+ P(this, "setCloud", async (o, l) => {
3490
3490
  if (!l.success)
3491
3491
  return 400;
3492
3492
  const y = X(o);
3493
- return delete l.success, delete l.message, await Vt(y, l).then(() => 201).catch((P) => (console.error("%cstorage", x.STORAGE, K.CLOUD, o, P), 400));
3493
+ return delete l.success, delete l.message, await Vt(y, l).then(() => 201).catch((I) => (console.error("%cstorage", x.STORAGE, K.CLOUD, o, I), 400));
3494
3494
  });
3495
3495
  /**
3496
3496
  * Update Series
@@ -3498,11 +3498,11 @@ class Mr {
3498
3498
  * @param data
3499
3499
  * @returns bumber
3500
3500
  */
3501
- I(this, "setSeries", async (o, l) => {
3501
+ P(this, "setSeries", async (o, l) => {
3502
3502
  if (!l.success)
3503
3503
  return 400;
3504
3504
  const y = X(o);
3505
- return delete l.success, delete l.message, await Vt(y, l).then(() => 201).catch((P) => (console.error("%cstorage", x.STORAGE, K.SERIES, o, P), 400));
3505
+ return delete l.success, delete l.message, await Vt(y, l).then(() => 201).catch((I) => (console.error("%cstorage", x.STORAGE, K.SERIES, o, I), 400));
3506
3506
  });
3507
3507
  /**
3508
3508
  * Update Messages
@@ -3510,32 +3510,32 @@ class Mr {
3510
3510
  * @param data
3511
3511
  * @returns number
3512
3512
  */
3513
- I(this, "setMessages", async (o, l) => {
3513
+ P(this, "setMessages", async (o, l) => {
3514
3514
  if (!l.success)
3515
3515
  return 400;
3516
3516
  const y = X(o);
3517
- return delete l.success, delete l.message, await Vt(y, l).then(() => 201).catch((P) => (console.error("%cstorage", x.STORAGE, K.MESSAGES, o, P), 400));
3517
+ return delete l.success, delete l.message, await Vt(y, l).then(() => 201).catch((I) => (console.error("%cstorage", x.STORAGE, K.MESSAGES, o, I), 400));
3518
3518
  });
3519
- I(this, "cleanMessages", async (o) => (console.log("cleanMessages not implemented for ", this.options.storage), await new Promise((l) => l())));
3519
+ P(this, "cleanMessages", async (o) => (console.log("cleanMessages not implemented for ", this.options.storage), await new Promise((l) => l())));
3520
3520
  /**
3521
3521
  * Update Cloud
3522
3522
  * @param query IQuery
3523
3523
  * @returns number
3524
3524
  */
3525
- I(this, "setWidget", async (o) => {
3525
+ P(this, "setWidget", async (o) => {
3526
3526
  const l = X(o), y = {
3527
3527
  id: o.widget,
3528
3528
  dashboard_id: o.dashboard,
3529
3529
  type: o.type
3530
3530
  };
3531
- return await Vt(l, y).then(() => 201).catch((P) => (console.error("%cstorage", x.STORAGE, K.WIDGET, o, P), 400));
3531
+ return await Vt(l, y).then(() => 201).catch((I) => (console.error("%cstorage", x.STORAGE, K.WIDGET, o, I), 400));
3532
3532
  });
3533
3533
  /**
3534
3534
  * Add component subscriber
3535
3535
  * @param query IQuery
3536
3536
  * @returns null
3537
3537
  */
3538
- I(this, "subscribe", (o) => (o = nt(o), o.type === K.MESSAGES && (o = vt(this.options, o)), this.subscribers.filter(
3538
+ P(this, "subscribe", (o) => (o = nt(o), o.type === K.MESSAGES && (o = vt(this.options, o)), this.subscribers.filter(
3539
3539
  (y) => y.widget === o.widget
3540
3540
  ).length > 0 || (console.debug(
3541
3541
  "%cstorage%c %csubscribe",
@@ -3549,15 +3549,15 @@ class Mr {
3549
3549
  * Get current subscribers
3550
3550
  * @returns IQuery[]
3551
3551
  */
3552
- I(this, "getSubscribers", async () => await new Promise((o) => o(this.subscribers)));
3552
+ P(this, "getSubscribers", async () => await new Promise((o) => o(this.subscribers)));
3553
3553
  this.options = o;
3554
3554
  }
3555
3555
  }
3556
3556
  class Kr {
3557
3557
  constructor(o) {
3558
- I(this, "subscribers", []);
3559
- I(this, "options");
3560
- I(this, "getCloud", async (o) => {
3558
+ P(this, "subscribers", []);
3559
+ P(this, "options");
3560
+ P(this, "getCloud", async (o) => {
3561
3561
  const l = X(o);
3562
3562
  try {
3563
3563
  return localStorage.getObject(l);
@@ -3565,7 +3565,7 @@ class Kr {
3565
3565
  return console.warn("%capi", x.API, K.CLOUD, o.slide, o.widget), { data: null, message: "Messages Data error", success: !1 };
3566
3566
  }
3567
3567
  });
3568
- I(this, "getSeries", async (o) => {
3568
+ P(this, "getSeries", async (o) => {
3569
3569
  const l = X(o);
3570
3570
  try {
3571
3571
  return localStorage.getObject(l);
@@ -3573,7 +3573,7 @@ class Kr {
3573
3573
  return console.warn("%capi", x.API, K.SERIES, o.slide, o.widget), { data: null, message: "Messages Data error", success: !1 };
3574
3574
  }
3575
3575
  });
3576
- I(this, "getMessages", async (o) => {
3576
+ P(this, "getMessages", async (o) => {
3577
3577
  const l = X(o);
3578
3578
  try {
3579
3579
  return localStorage.getObject(l);
@@ -3587,12 +3587,12 @@ class Kr {
3587
3587
  * @param data
3588
3588
  * @returns number
3589
3589
  */
3590
- I(this, "setCloud", async (o, l) => {
3590
+ P(this, "setCloud", async (o, l) => {
3591
3591
  const y = X(o);
3592
3592
  try {
3593
3593
  return localStorage.setObject(y, l), 201;
3594
- } catch (P) {
3595
- return console.error("%cstorage", x.STORAGE, K.CLOUD, o, P), 400;
3594
+ } catch (I) {
3595
+ return console.error("%cstorage", x.STORAGE, K.CLOUD, o, I), 400;
3596
3596
  }
3597
3597
  });
3598
3598
  /**
@@ -3601,12 +3601,12 @@ class Kr {
3601
3601
  * @param data
3602
3602
  * @returns number
3603
3603
  */
3604
- I(this, "setSeries", async (o, l) => {
3604
+ P(this, "setSeries", async (o, l) => {
3605
3605
  const y = X(o);
3606
3606
  try {
3607
3607
  return localStorage.setObject(y, l), 201;
3608
- } catch (P) {
3609
- return console.error("%cstorage", x.STORAGE, K.SERIES, o, P), 400;
3608
+ } catch (I) {
3609
+ return console.error("%cstorage", x.STORAGE, K.SERIES, o, I), 400;
3610
3610
  }
3611
3611
  });
3612
3612
  /**
@@ -3615,18 +3615,18 @@ class Kr {
3615
3615
  * @param data
3616
3616
  * @returns number
3617
3617
  */
3618
- I(this, "setMessages", async (o, l) => {
3618
+ P(this, "setMessages", async (o, l) => {
3619
3619
  const y = X(o);
3620
3620
  try {
3621
3621
  return localStorage.setObject(y, l), 200;
3622
- } catch (P) {
3623
- return console.error("%cstorage", x.STORAGE, K.MESSAGES, o, P), 400;
3622
+ } catch (I) {
3623
+ return console.error("%cstorage", x.STORAGE, K.MESSAGES, o, I), 400;
3624
3624
  }
3625
3625
  });
3626
- I(this, "cleanMessages", async (o) => {
3626
+ P(this, "cleanMessages", async (o) => {
3627
3627
  console.log("cleanMessages not implemented for ", this.options.storage);
3628
3628
  });
3629
- I(this, "setWidget", async (o) => {
3629
+ P(this, "setWidget", async (o) => {
3630
3630
  const l = `widget.${o.widget}`;
3631
3631
  try {
3632
3632
  return localStorage.setObject(l, o), 201;
@@ -3639,7 +3639,7 @@ class Kr {
3639
3639
  * @param query IQuery
3640
3640
  * @returns null
3641
3641
  */
3642
- I(this, "subscribe", (o) => (o = nt(o), o.type === K.MESSAGES && (o = vt(this.options, o)), this.subscribers.filter(
3642
+ P(this, "subscribe", (o) => (o = nt(o), o.type === K.MESSAGES && (o = vt(this.options, o)), this.subscribers.filter(
3643
3643
  (y) => y.widget === o.widget
3644
3644
  ).length || (console.debug(
3645
3645
  "%cstorage%c %csubscribe",
@@ -3653,7 +3653,7 @@ class Kr {
3653
3653
  * Get current subscribers
3654
3654
  * @returns IQuery[]
3655
3655
  */
3656
- I(this, "getSubscribers", async () => await new Promise((o) => o(this.subscribers)));
3656
+ P(this, "getSubscribers", async () => await new Promise((o) => o(this.subscribers)));
3657
3657
  this.options = o, Storage.prototype.setObject = function(l, y) {
3658
3658
  this.setObject(l, JSON.stringify(y));
3659
3659
  }, Storage.prototype.getObject = function(l) {
@@ -3664,9 +3664,9 @@ class Kr {
3664
3664
  }
3665
3665
  class Br {
3666
3666
  constructor(o) {
3667
- I(this, "subscribers", []);
3668
- I(this, "options");
3669
- I(this, "getCloud", async (o) => {
3667
+ P(this, "subscribers", []);
3668
+ P(this, "options");
3669
+ P(this, "getCloud", async (o) => {
3670
3670
  const l = X(o);
3671
3671
  try {
3672
3672
  return sessionStorage.getObject(l);
@@ -3674,7 +3674,7 @@ class Br {
3674
3674
  return console.warn("%capi", x.API, K.CLOUD, o.slide, o.widget), { data: null, message: "Messages Data error", success: !1 };
3675
3675
  }
3676
3676
  });
3677
- I(this, "getSeries", async (o) => {
3677
+ P(this, "getSeries", async (o) => {
3678
3678
  const l = X(o);
3679
3679
  try {
3680
3680
  return sessionStorage.getObject(l);
@@ -3682,7 +3682,7 @@ class Br {
3682
3682
  return console.warn("%capi", x.API, K.SERIES, o.slide, o.widget), { data: null, message: "Messages Data error", success: !1 };
3683
3683
  }
3684
3684
  });
3685
- I(this, "getMessages", async (o) => {
3685
+ P(this, "getMessages", async (o) => {
3686
3686
  const l = X(o);
3687
3687
  try {
3688
3688
  return sessionStorage.getObject(l);
@@ -3696,12 +3696,12 @@ class Br {
3696
3696
  * @param data
3697
3697
  * @returns number
3698
3698
  */
3699
- I(this, "setCloud", async (o, l) => {
3699
+ P(this, "setCloud", async (o, l) => {
3700
3700
  const y = X(o);
3701
3701
  try {
3702
3702
  return sessionStorage.setObject(y, l), 201;
3703
- } catch (P) {
3704
- return console.error("%cstorage", x.STORAGE, K.CLOUD, o, P), 400;
3703
+ } catch (I) {
3704
+ return console.error("%cstorage", x.STORAGE, K.CLOUD, o, I), 400;
3705
3705
  }
3706
3706
  });
3707
3707
  /**
@@ -3710,12 +3710,12 @@ class Br {
3710
3710
  * @param data
3711
3711
  * @returns number
3712
3712
  */
3713
- I(this, "setSeries", async (o, l) => {
3713
+ P(this, "setSeries", async (o, l) => {
3714
3714
  const y = X(o);
3715
3715
  try {
3716
3716
  return sessionStorage.setObject(y, l), 201;
3717
- } catch (P) {
3718
- return console.error("%cstorage", x.STORAGE, K.SERIES, o, P), 400;
3717
+ } catch (I) {
3718
+ return console.error("%cstorage", x.STORAGE, K.SERIES, o, I), 400;
3719
3719
  }
3720
3720
  });
3721
3721
  /**
@@ -3724,18 +3724,18 @@ class Br {
3724
3724
  * @param data
3725
3725
  * @returns number
3726
3726
  */
3727
- I(this, "setMessages", async (o, l) => {
3727
+ P(this, "setMessages", async (o, l) => {
3728
3728
  const y = X(o);
3729
3729
  try {
3730
3730
  return sessionStorage.setObject(y, l), 200;
3731
- } catch (P) {
3732
- return console.error("%cstorage", x.STORAGE, K.MESSAGES, o, P), 400;
3731
+ } catch (I) {
3732
+ return console.error("%cstorage", x.STORAGE, K.MESSAGES, o, I), 400;
3733
3733
  }
3734
3734
  });
3735
- I(this, "cleanMessages", async (o) => {
3735
+ P(this, "cleanMessages", async (o) => {
3736
3736
  console.log("cleanMessages not implemented for ", this.options.storage);
3737
3737
  });
3738
- I(this, "setWidget", async (o) => {
3738
+ P(this, "setWidget", async (o) => {
3739
3739
  const l = `widget.${o.widget}`;
3740
3740
  try {
3741
3741
  return sessionStorage.setObject(l, o), 201;
@@ -3748,7 +3748,7 @@ class Br {
3748
3748
  * @param query IQuery
3749
3749
  * @returns null
3750
3750
  */
3751
- I(this, "subscribe", (o) => (o = nt(o), o.type === K.MESSAGES && (o = vt(this.options, o)), this.subscribers.filter(
3751
+ P(this, "subscribe", (o) => (o = nt(o), o.type === K.MESSAGES && (o = vt(this.options, o)), this.subscribers.filter(
3752
3752
  (y) => y.widget === o.widget
3753
3753
  ).length || (console.debug(
3754
3754
  "%cstorage%c %csubscribe",
@@ -3762,7 +3762,7 @@ class Br {
3762
3762
  * Get current subscribers
3763
3763
  * @returns IQuery[]
3764
3764
  */
3765
- I(this, "getSubscribers", async () => await new Promise((o) => o(this.subscribers)));
3765
+ P(this, "getSubscribers", async () => await new Promise((o) => o(this.subscribers)));
3766
3766
  this.options = o, Storage.prototype.setObject = function(l, y) {
3767
3767
  this.setItem(l, JSON.stringify(y));
3768
3768
  }, Storage.prototype.getObject = function(l) {
@@ -3773,9 +3773,9 @@ class Br {
3773
3773
  }
3774
3774
  class Nr {
3775
3775
  constructor(o) {
3776
- I(this, "subscribers", []);
3777
- I(this, "options");
3778
- I(this, "getCloud", async (o) => {
3776
+ P(this, "subscribers", []);
3777
+ P(this, "options");
3778
+ P(this, "getCloud", async (o) => {
3779
3779
  const l = X(o);
3780
3780
  try {
3781
3781
  return window.BuzzCasting.WidgetData[l];
@@ -3783,7 +3783,7 @@ class Nr {
3783
3783
  return console.warn("%capi", x.API, K.CLOUD, o.slide, o.widget), { data: null, message: "Cloud Data error", success: !1 };
3784
3784
  }
3785
3785
  });
3786
- I(this, "getSeries", async (o) => {
3786
+ P(this, "getSeries", async (o) => {
3787
3787
  const l = X(o);
3788
3788
  try {
3789
3789
  return window.BuzzCasting.WidgetData[l];
@@ -3791,7 +3791,7 @@ class Nr {
3791
3791
  return console.warn("%capi", x.API, K.SERIES, o.slide, o.widget), { data: null, message: "Series Data error", success: !1 };
3792
3792
  }
3793
3793
  });
3794
- I(this, "getMessages", async (o) => {
3794
+ P(this, "getMessages", async (o) => {
3795
3795
  const l = X(o);
3796
3796
  try {
3797
3797
  return window.BuzzCasting.WidgetData[l];
@@ -3805,12 +3805,12 @@ class Nr {
3805
3805
  * @param data
3806
3806
  * @returns number
3807
3807
  */
3808
- I(this, "setCloud", async (o, l) => {
3808
+ P(this, "setCloud", async (o, l) => {
3809
3809
  const y = X(o);
3810
3810
  try {
3811
3811
  return window.BuzzCasting.WidgetData[y] = l, 201;
3812
- } catch (P) {
3813
- return console.error("%cstorage", x.STORAGE, "set", o, P), 400;
3812
+ } catch (I) {
3813
+ return console.error("%cstorage", x.STORAGE, "set", o, I), 400;
3814
3814
  }
3815
3815
  });
3816
3816
  /**
@@ -3819,12 +3819,12 @@ class Nr {
3819
3819
  * @param data
3820
3820
  * @returns number
3821
3821
  */
3822
- I(this, "setSeries", async (o, l) => {
3822
+ P(this, "setSeries", async (o, l) => {
3823
3823
  const y = X(o);
3824
3824
  try {
3825
3825
  return window.BuzzCasting.WidgetData[y] = l, 201;
3826
- } catch (P) {
3827
- return console.error("%cstorage", x.STORAGE, "set", o, P), 400;
3826
+ } catch (I) {
3827
+ return console.error("%cstorage", x.STORAGE, "set", o, I), 400;
3828
3828
  }
3829
3829
  });
3830
3830
  /**
@@ -3833,18 +3833,18 @@ class Nr {
3833
3833
  * @param data
3834
3834
  * @returns number
3835
3835
  */
3836
- I(this, "setMessages", async (o, l) => {
3836
+ P(this, "setMessages", async (o, l) => {
3837
3837
  const y = X(o);
3838
3838
  try {
3839
3839
  return window.BuzzCasting.WidgetData[y] = l, 201;
3840
- } catch (P) {
3841
- return console.error("%cstorage", x.STORAGE, "set", o, P), 400;
3840
+ } catch (I) {
3841
+ return console.error("%cstorage", x.STORAGE, "set", o, I), 400;
3842
3842
  }
3843
3843
  });
3844
- I(this, "cleanMessages", async (o) => {
3844
+ P(this, "cleanMessages", async (o) => {
3845
3845
  console.log("cleanMessages not implemented for ", this.options.storage);
3846
3846
  });
3847
- I(this, "setWidget", async (o) => {
3847
+ P(this, "setWidget", async (o) => {
3848
3848
  const l = `widget.${o.widget}`;
3849
3849
  try {
3850
3850
  return window.BuzzCasting.WidgetData[l] = o, 201;
@@ -3857,7 +3857,7 @@ class Nr {
3857
3857
  * @param query IQuery
3858
3858
  * @returns null
3859
3859
  */
3860
- I(this, "subscribe", (o) => (o = nt(o), o.type === K.MESSAGES && (o = vt(this.options, o)), this.subscribers.filter(
3860
+ P(this, "subscribe", (o) => (o = nt(o), o.type === K.MESSAGES && (o = vt(this.options, o)), this.subscribers.filter(
3861
3861
  (y) => y.widget === o.widget
3862
3862
  ).length || (console.debug(
3863
3863
  "%cstorage%c %csubscribe",
@@ -3871,18 +3871,15 @@ class Nr {
3871
3871
  * Get current subscribers
3872
3872
  * @returns IQuery[]
3873
3873
  */
3874
- I(this, "getSubscribers", async () => await new Promise((o) => o(this.subscribers)));
3874
+ P(this, "getSubscribers", async () => await new Promise((o) => o(this.subscribers)));
3875
3875
  this.options = o, window.BuzzCasting.WidgetData = /* @__PURE__ */ new Set();
3876
3876
  }
3877
3877
  }
3878
3878
  function Ii(v) {
3879
- const o = [];
3879
+ const o = {};
3880
3880
  for (let l = 0; l < v.length; l++) {
3881
3881
  const y = v.item(l);
3882
- if (y != null && y.name) {
3883
- const P = {};
3884
- P[y.name] = y.value, o.push(P);
3885
- }
3882
+ y != null && y.name && (o[y.name] = y.value);
3886
3883
  }
3887
3884
  return o;
3888
3885
  }
@@ -3906,30 +3903,30 @@ function Ci(v, o) {
3906
3903
  return v;
3907
3904
  }
3908
3905
  function Oe(v, o) {
3909
- let l, y, P;
3906
+ let l, y, I;
3910
3907
  if (o.length === 0)
3911
3908
  return v;
3912
- for (l = 0, P = o.length; l < P; l++)
3909
+ for (l = 0, I = o.length; l < I; l++)
3913
3910
  y = o.charCodeAt(l), v = (v << 5) - v + y, v |= 0;
3914
3911
  return v < 0 ? v * -2 : v;
3915
3912
  }
3916
3913
  function Ri(v, o, l) {
3917
3914
  return Object.keys(o).sort().reduce(y, v);
3918
- function y(P, M) {
3919
- return Gr(P, o[M], M, l);
3915
+ function y(I, M) {
3916
+ return Gr(I, o[M], M, l);
3920
3917
  }
3921
3918
  }
3922
3919
  function Gr(v, o, l, y) {
3923
- const P = Oe(Oe(Oe(v, l), Ti(o)), typeof o);
3920
+ const I = Oe(Oe(Oe(v, l), Ti(o)), typeof o);
3924
3921
  if (o === null)
3925
- return Oe(P, "null");
3922
+ return Oe(I, "null");
3926
3923
  if (o === void 0)
3927
- return Oe(P, "undefined");
3924
+ return Oe(I, "undefined");
3928
3925
  if (typeof o == "object" || typeof o == "function") {
3929
3926
  if (y.includes(o))
3930
- return Oe(P, `[Circular]${l}`);
3927
+ return Oe(I, `[Circular]${l}`);
3931
3928
  y.push(o);
3932
- const M = Ri(P, o, y);
3929
+ const M = Ri(I, o, y);
3933
3930
  if (!("valueOf" in o) || typeof o.valueOf != "function")
3934
3931
  return M;
3935
3932
  try {
@@ -3938,7 +3935,7 @@ function Gr(v, o, l, y) {
3938
3935
  return Oe(M, `[valueOf exception]${j.stack || j.message}`);
3939
3936
  }
3940
3937
  }
3941
- return Oe(P, o.toString());
3938
+ return Oe(I, o.toString());
3942
3939
  }
3943
3940
  function Ti(v) {
3944
3941
  return Object.prototype.toString.call(v);
@@ -3948,21 +3945,21 @@ function Fn(v) {
3948
3945
  }
3949
3946
  class Gi {
3950
3947
  constructor(o) {
3951
- I(this, "sm");
3952
- I(this, "api");
3953
- I(this, "bc");
3954
- I(this, "options");
3955
- I(this, "update", async (o) => {
3948
+ P(this, "sm");
3949
+ P(this, "api");
3950
+ P(this, "bc");
3951
+ P(this, "options");
3952
+ P(this, "update", async (o) => {
3956
3953
  if (this.sm === null)
3957
3954
  return;
3958
3955
  const l = await this.sm.getSubscribers();
3959
3956
  if (l.length === 0)
3960
3957
  return;
3961
3958
  const y = [];
3962
- o ? y.push(this.api.get(o)) : l == null || l.forEach((P) => {
3963
- y.push(this.api.get(P));
3959
+ o ? y.push(this.api.get(o)) : l == null || l.forEach((I) => {
3960
+ y.push(this.api.get(I));
3964
3961
  }), await Promise.allSettled(y).then(
3965
- (P) => P.forEach(async (M) => {
3962
+ (I) => I.forEach(async (M) => {
3966
3963
  let j = 400;
3967
3964
  if (M.status === "fulfilled") {
3968
3965
  const N = M.value;
@@ -4055,10 +4052,10 @@ class Gi {
4055
4052
  })
4056
4053
  );
4057
4054
  });
4058
- I(this, "hide", (o) => {
4055
+ P(this, "hide", (o) => {
4059
4056
  this.api.hideMessage(o);
4060
4057
  });
4061
- I(this, "actions", async (o) => {
4058
+ P(this, "actions", async (o) => {
4062
4059
  var l;
4063
4060
  switch (o.data.event) {
4064
4061
  case ue.SUBSCRIBE:
@@ -4076,7 +4073,7 @@ class Gi {
4076
4073
  break;
4077
4074
  }
4078
4075
  });
4079
- I(this, "cleanMessages", async () => {
4076
+ P(this, "cleanMessages", async () => {
4080
4077
  var l, y;
4081
4078
  const o = ((l = this.options) == null ? void 0 : l.retention) || 345600;
4082
4079
  return await ((y = this.sm) == null ? void 0 : y.cleanMessages(o));
@@ -4084,7 +4081,7 @@ class Gi {
4084
4081
  // TODO: add checksum to avoid broadcasting update
4085
4082
  // private setHash(widget: string) {
4086
4083
  // }
4087
- I(this, "getSubscribers", async () => {
4084
+ P(this, "getSubscribers", async () => {
4088
4085
  var o;
4089
4086
  return await ((o = this.sm) == null ? void 0 : o.getSubscribers());
4090
4087
  });
@@ -4128,13 +4125,13 @@ class Gi {
4128
4125
  }
4129
4126
  class ji {
4130
4127
  constructor(o) {
4131
- I(this, "sm");
4128
+ P(this, "sm");
4132
4129
  /**
4133
4130
  * Retieve Cloud Data
4134
4131
  * @param query Widgets parameters, type "cloud"
4135
4132
  * @returns IResponse
4136
4133
  */
4137
- I(this, "getCloud", async (o) => {
4134
+ P(this, "getCloud", async (o) => {
4138
4135
  var l;
4139
4136
  return o.type !== K.CLOUD ? (console.warn(
4140
4137
  "%capp%c %get",
@@ -4155,7 +4152,7 @@ class ji {
4155
4152
  * @param query Widgets parameters, type "messages"
4156
4153
  * @returns IResponse
4157
4154
  */
4158
- I(this, "getMessages", async (o) => {
4155
+ P(this, "getMessages", async (o) => {
4159
4156
  var l;
4160
4157
  return o.type !== K.MESSAGES ? (console.warn(
4161
4158
  "%capp%c %get",
@@ -4176,7 +4173,7 @@ class ji {
4176
4173
  * @param query Widgets parameters, type "series"
4177
4174
  * @returns IResponse
4178
4175
  */
4179
- I(this, "getSeries", async (o) => {
4176
+ P(this, "getSeries", async (o) => {
4180
4177
  var l;
4181
4178
  return o.type !== K.SERIES ? (console.warn(
4182
4179
  "%capp%c %get",
@@ -4221,17 +4218,17 @@ class Li {
4221
4218
  * @param selector container for the element - by default buzzcasting-slide (optional)
4222
4219
  */
4223
4220
  constructor(o, l, y) {
4224
- I(this, "storageReader");
4225
- I(this, "broadcastChannel");
4226
- I(this, "element");
4227
- I(this, "query");
4228
- I(this, "listeners");
4221
+ P(this, "storageReader");
4222
+ P(this, "broadcastChannel");
4223
+ P(this, "element");
4224
+ P(this, "query");
4225
+ P(this, "listeners");
4229
4226
  /**
4230
4227
  * Generic call to any query type
4231
4228
  *
4232
4229
  * @returns IResponse
4233
4230
  */
4234
- I(this, "getData", async () => {
4231
+ P(this, "getData", async () => {
4235
4232
  switch (this.query.type) {
4236
4233
  case K.CLOUD:
4237
4234
  return await this.getCloud();
@@ -4251,7 +4248,7 @@ class Li {
4251
4248
  *
4252
4249
  * @returns IResponse
4253
4250
  */
4254
- I(this, "getCloud", async () => this.query.type !== K.CLOUD ? (console.warn(
4251
+ P(this, "getCloud", async () => this.query.type !== K.CLOUD ? (console.warn(
4255
4252
  "%cstorage%c %cwidget",
4256
4253
  x.STORAGE,
4257
4254
  x.NONE,
@@ -4269,7 +4266,7 @@ class Li {
4269
4266
  *
4270
4267
  * @returns IResponse
4271
4268
  */
4272
- I(this, "getMessages", async () => this.query.type !== K.MESSAGES ? (console.warn(
4269
+ P(this, "getMessages", async () => this.query.type !== K.MESSAGES ? (console.warn(
4273
4270
  "%cstorage%c %cwidget",
4274
4271
  x.STORAGE,
4275
4272
  x.NONE,
@@ -4287,7 +4284,7 @@ class Li {
4287
4284
  *
4288
4285
  * @returns IResponse
4289
4286
  */
4290
- I(this, "getSeries", async () => this.query.type !== K.SERIES ? (console.warn(
4287
+ P(this, "getSeries", async () => this.query.type !== K.SERIES ? (console.warn(
4291
4288
  "%cstorage%c %cwidget",
4292
4289
  x.STORAGE,
4293
4290
  x.NONE,
@@ -4306,9 +4303,9 @@ class Li {
4306
4303
  *
4307
4304
  * @param modal IModal
4308
4305
  */
4309
- I(this, "showModal", (o) => {
4306
+ P(this, "showModal", (o) => {
4310
4307
  const l = Ii(this.element.attributes);
4311
- if (l.includes("data-topics")) {
4308
+ if (Object.prototype.hasOwnProperty.call(l, "data-topics")) {
4312
4309
  const M = l["data-topics"].split("-");
4313
4310
  l["data-widget"] = M[1], l["data-dashboard"] = M[0];
4314
4311
  }
@@ -4321,7 +4318,7 @@ class Li {
4321
4318
  // @ts-expect-error cannot get string type out of IFilteredAttributes props
4322
4319
  l["data-widget"]
4323
4320
  );
4324
- const P = new CustomEvent(ue.SHOW_MODAL, {
4321
+ const I = new CustomEvent(ue.SHOW_MODAL, {
4325
4322
  detail: {
4326
4323
  component: o.showComponent,
4327
4324
  props: y
@@ -4330,14 +4327,14 @@ class Li {
4330
4327
  cancelable: !0,
4331
4328
  composed: !0
4332
4329
  });
4333
- window.dispatchEvent(P);
4330
+ window.dispatchEvent(I);
4334
4331
  });
4335
4332
  var j;
4336
4333
  this.element = o, this.listeners = l, y = typeof y < "u" ? y : "buzzcasting-slide";
4337
- let P;
4338
- P = { ...o.dataset }, delete P.hmr, P.slide = ((j = o.closest(y.toUpperCase())) == null ? void 0 : j.id) ?? `${y} not found`, P = nt(P), this.query = P;
4334
+ let I;
4335
+ I = { ...o.dataset }, delete I.hmr, I.slide = ((j = o.closest(y.toUpperCase())) == null ? void 0 : j.id) ?? `${y} not found`, I = nt(I), this.query = I;
4339
4336
  const M = window.BuzzCasting.getOptions();
4340
- this.storageReader = new ji(M), this.broadcastChannel = new BroadcastChannel(P.slide), this.startListener();
4337
+ this.storageReader = new ji(M), this.broadcastChannel = new BroadcastChannel(I.slide), this.startListener();
4341
4338
  }
4342
4339
  addListener(o) {
4343
4340
  this.listeners.push(o);
@@ -4351,8 +4348,8 @@ class Li {
4351
4348
  const y = l.data.data;
4352
4349
  switch (l.data.event) {
4353
4350
  case ue.WIDGET_UPDATE:
4354
- y.query.slide === o.slide && y.query.widget === o.widget && this.listeners.forEach((P) => {
4355
- P(l.data.data);
4351
+ y.query.slide === o.slide && y.query.widget === o.widget && this.listeners.forEach((I) => {
4352
+ I(l.data.data);
4356
4353
  });
4357
4354
  break;
4358
4355
  case ue.SLIDE_READY:
@@ -4391,6 +4388,7 @@ export {
4391
4388
  Xt as MODERATION,
4392
4389
  he as STORAGE,
4393
4390
  Li as Widget,
4391
+ Ii as attrs,
4394
4392
  Ni as camelCase,
4395
4393
  Bi as camelize,
4396
4394
  Ki as filterAttributes,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "buzzcasting-storage",
3
3
  "type": "module",
4
- "version": "2.10.4",
4
+ "version": "2.10.6",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "Mark Tamis, TouchFlows SAS",
@@ -50,4 +50,4 @@
50
50
  "lint-staged": {
51
51
  "*.ts": "pnpm run lint"
52
52
  }
53
- }
53
+ }