buzzcasting-utils 1.6.0 → 1.6.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.
@@ -282,25 +282,26 @@ export declare interface IBrand {
282
282
  }
283
283
 
284
284
  export declare interface ICardAttributes {
285
- 'layout'?: 'base' | 'globe' | 'carousel';
286
- 'component': string;
287
- 'data-type': 'messages' | 'cloud' | 'series';
288
- 'data-order'?: string;
289
- 'data-dashboard': string;
290
- 'data-widget': string;
291
- 'css-body'?: string[];
292
- 'css-brand'?: string[];
293
- 'css-card'?: string[];
294
- 'css-date'?: string[];
295
- 'css-handle'?: string[];
296
- 'css-name'?: string[];
297
- 'date-format'?: string;
298
- 'time-format'?: string;
299
- 'show-brand'?: 'true' | 'false';
300
- 'show-kpi'?: 'true' | 'false';
301
- 'show-sender'?: 'true' | 'false';
302
- 'animation'?: string;
303
- 'interval'?: string;
285
+ layout?: "base" | "globe" | "carousel";
286
+ component: string;
287
+ "data-type": "messages" | "cloud" | "series";
288
+ "data-order"?: string;
289
+ "data-dashboard": string;
290
+ "data-widget": string;
291
+ "data-limit"?: string;
292
+ "css-body"?: string[];
293
+ "css-brand"?: string[];
294
+ "css-card"?: string[];
295
+ "css-date"?: string[];
296
+ "css-handle"?: string[];
297
+ "css-name"?: string[];
298
+ "date-format"?: string;
299
+ "time-format"?: string;
300
+ "show-brand"?: "true" | "false";
301
+ "show-kpi"?: "true" | "false";
302
+ "show-sender"?: "true" | "false";
303
+ animation?: string;
304
+ interval?: string;
304
305
  }
305
306
 
306
307
  export declare interface ICardOptions {
@@ -815,6 +816,7 @@ export declare interface IQuery {
815
816
  topics?: string;
816
817
  presentation?: string;
817
818
  dashboard?: string;
819
+ limit?: number;
818
820
  labels?: string[];
819
821
  compare?: string;
820
822
  period?: number;
@@ -832,6 +834,7 @@ export declare interface IQuery {
832
834
  hash?: string;
833
835
  name?: string;
834
836
  data?: any;
837
+ locale: string;
835
838
  }
836
839
 
837
840
  /**
@@ -852,6 +855,8 @@ export declare interface IRotatingGlobe {
852
855
  arc: IArc;
853
856
  }
854
857
 
858
+ export declare const isEmpty: (obj: Object) => boolean;
859
+
855
860
  export declare interface ISender {
856
861
  id?: string;
857
862
  channel?: string;
@@ -1348,6 +1353,8 @@ export declare const typeCss: (query: IQuery | undefined) => string;
1348
1353
 
1349
1354
  export declare const uniq: (length?: number, existing?: never[]) => string;
1350
1355
 
1356
+ export declare const unique: (arr: any) => unknown[];
1357
+
1351
1358
  export declare const upDownColor: (change: number) => "text-down text-xs" | "text-up text-xs" | "text-white text-xs";
1352
1359
 
1353
1360
  export declare function widgetParams(query: IQuery): IQuery;
@@ -132,12 +132,12 @@ function P(e) {
132
132
  {}
133
133
  );
134
134
  }
135
- const de = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
136
- function ue(e, t = "font-bold") {
137
- return `${(e == null ? void 0 : e.title.length) > 0 ? `<div class="${t}">${e.title}</div>` : ""}${e != null && e.content ? e.content.replace(/\n\n/g, `
135
+ const de = (e) => [...new Set(e)], ue = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
136
+ function fe(e, t = "font-bold") {
137
+ return `${(e == null ? void 0 : e.title) !== null ? `<div class="${t}">${e.title}</div>` : ""}${e != null && e.content ? e.content.replace(/\n\n/g, `
138
138
  `).replace(/\n/g, "<br/>") : ""}`;
139
139
  }
140
- const fe = () => [b(2), b(1), b(1), b(1), b(3)].join("-"), b = (e) => {
140
+ const pe = () => [b(2), b(1), b(1), b(1), b(3)].join("-"), b = (e) => {
141
141
  let t = "";
142
142
  for (let r = 0; r < e; r++)
143
143
  t += ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
@@ -163,7 +163,7 @@ function S(e, t, r) {
163
163
  }
164
164
  }
165
165
  function L(e, t, r, n) {
166
- const o = f(f(f(e, r), M(t)), typeof t);
166
+ const o = f(f(f(e, r), y(t)), typeof t);
167
167
  if (t === null)
168
168
  return f(o, "null");
169
169
  if (t === void 0)
@@ -183,13 +183,13 @@ function L(e, t, r, n) {
183
183
  }
184
184
  return f(o, t.toString());
185
185
  }
186
- function M(e) {
186
+ function y(e) {
187
187
  return Object.prototype.toString.call(e);
188
188
  }
189
- function pe(e) {
189
+ function ge(e) {
190
190
  return k(L(0, e, "", []).toString(16), 8);
191
191
  }
192
- const ge = (e) => {
192
+ const be = (e) => {
193
193
  let t = "";
194
194
  return A(e, {
195
195
  start: function(r, n, o) {
@@ -208,7 +208,7 @@ const ge = (e) => {
208
208
  t += `<!-- ${r} -->`;
209
209
  }
210
210
  }), t;
211
- }, be = (e, t) => {
211
+ }, me = (e, t) => {
212
212
  const r = g("html,head,body,title"), n = { link: "head", base: "head" };
213
213
  t ? t = t.ownerDocument || t.getOwnerDocument && t.getOwnerDocument() || t : typeof t < "u" ? t = new Document() : typeof document < "u" && document.implementation && document.implementation.createDocument && (t = document.implementation.createDocument("", "", null));
214
214
  const o = [];
@@ -242,7 +242,7 @@ const ge = (e) => {
242
242
  let t = {}, r = e.split(",");
243
243
  for (let n = 0; n < r.length; n++) t[r[n]] = !0;
244
244
  return t;
245
- }, R = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, _ = /^<\/([-A-Za-z0-9_]+)[^>]*>/, $ = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g, y = g(
245
+ }, R = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, _ = /^<\/([-A-Za-z0-9_]+)[^>]*>/, M = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g, $ = g(
246
246
  "area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"
247
247
  ), C = g(
248
248
  "a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"
@@ -290,9 +290,9 @@ const ge = (e) => {
290
290
  if (s = s.toLowerCase(), C[s])
291
291
  for (; a.at(-1) && U[a.at(-1)]; )
292
292
  i("", a.at(-1));
293
- if (G[s] && a.at(-1) == s && i("", s), p = y[s] || !!p, p || a.push(s), t.start) {
293
+ if (G[s] && a.at(-1) == s && i("", s), p = $[s] || !!p, p || a.push(s), t.start) {
294
294
  const O = [];
295
- d.replace($, function(Q, D) {
295
+ d.replace(M, function(Q, D) {
296
296
  let w = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : B[D] ? D : "";
297
297
  O.push({
298
298
  name: D,
@@ -310,7 +310,7 @@ function H(e) {
310
310
  function W(e) {
311
311
  return e.replace(/<\?xml.*\?>\n/, "").replace(/<!doctype.*\>\n/, "").replace(/<!DOCTYPE.*\>\n/, "");
312
312
  }
313
- const me = (e) => {
313
+ const he = (e) => {
314
314
  e = W(e);
315
315
  const t = [], r = {
316
316
  node: "root",
@@ -400,13 +400,13 @@ const me = (e) => {
400
400
  return `<!-- ${e.text} -->`;
401
401
  if (e.node === "root")
402
402
  return r;
403
- }, he = () => {
403
+ }, xe = () => {
404
404
  const e = (t = !1) => {
405
405
  const n = document.createElement("canvas").getContext("2d", { willReadFrequently: t });
406
406
  return n !== null ? (n.moveTo(0, 0), n.lineTo(120, 121), n.stroke(), n.getImageData(0, 0, 200, 200).data.join()) : null;
407
407
  };
408
408
  return e(!0) !== e(!1);
409
- }, xe = (e, t = 0, r = !0, n = "en") => {
409
+ }, De = (e, t = 0, r = !0, n = "en") => {
410
410
  if (e = typeof e == "string" || e instanceof String ? parseFloat(e.replace(/[^0-9.]/g, "")) : e, r === !1)
411
411
  return e.toLocaleString(n);
412
412
  if (e < 1e3)
@@ -423,7 +423,7 @@ const me = (e) => {
423
423
  for (a = o.length - 1; a > 0 && !(e >= o[a].v); a--)
424
424
  ;
425
425
  return (e / o[a].v).toFixed(t).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, "$1") + o[a].s;
426
- }, De = (e = 0, t) => {
426
+ }, Ae = (e) => Object.keys(e).length === 0, Oe = (e = 0, t) => {
427
427
  switch (!0) {
428
428
  case e > 3:
429
429
  console.debug(...t);
@@ -438,12 +438,12 @@ const me = (e) => {
438
438
  console.error(...t);
439
439
  break;
440
440
  }
441
- }, Ae = (e) => e.replace(/\<\!--\s*?[^\s?\[][\s\S]*?--\>/g, "").replace(/\>\s*\</g, "><").replace(/\t/g, ""), Oe = (e) => e.replace(/\>\</g, `>
442
- <`), we = (e) => e.replace(/\/\*.*\*\/|\/\*[\s\S]*?\*\/|\n|\t|\v|\s{2,}/g, "").replace(/\s*\{\s*/g, "{").replace(/\s*\}\s*/g, "}").replace(/\s*\:\s*/g, ":").replace(/\s*\;\s*/g, ";").replace(/\s*\,\s*/g, ",").replace(/\s*\~\s*/g, "~").replace(/\s*\>\s*/g, ">").replace(/\s*\+\s*/g, "+").replace(/\s*\!\s*/g, "!"), Re = (e) => e.replace(/\,/g, ", ").replace(/\{/g, ` {
441
+ }, we = (e) => e.replace(/\<\!--\s*?[^\s?\[][\s\S]*?--\>/g, "").replace(/\>\s*\</g, "><").replace(/\t/g, ""), Re = (e) => e.replace(/\>\</g, `>
442
+ <`), _e = (e) => e.replace(/\/\*.*\*\/|\/\*[\s\S]*?\*\/|\n|\t|\v|\s{2,}/g, "").replace(/\s*\{\s*/g, "{").replace(/\s*\}\s*/g, "}").replace(/\s*\:\s*/g, ":").replace(/\s*\;\s*/g, ";").replace(/\s*\,\s*/g, ",").replace(/\s*\~\s*/g, "~").replace(/\s*\>\s*/g, ">").replace(/\s*\+\s*/g, "+").replace(/\s*\!\s*/g, "!"), Le = (e) => e.replace(/\,/g, ", ").replace(/\{/g, ` {
443
443
  `).replace(/\}/g, `}
444
444
  `).replace(/\;/g, `;
445
445
  `);
446
- function _e(e, t) {
446
+ function ve(e, t) {
447
447
  const r = [
448
448
  { value: 1, symbol: "" },
449
449
  { value: 1e3, symbol: "K" },
@@ -458,18 +458,18 @@ function _e(e, t) {
458
458
  ;
459
459
  return (e / r[o].value).toFixed(t).replace(n, "$1") + r[o].symbol;
460
460
  }
461
- function Le(e) {
461
+ function Ie(e) {
462
462
  const t = RegExp(`[?&]${e}=([^&]*)`).exec(window.location.search);
463
463
  return t && decodeURIComponent(t[1].replace(/\+/g, " ")) || null;
464
464
  }
465
- const ve = (e) => new Proxy(new URLSearchParams(window.location.search), {
465
+ const Ee = (e) => new Proxy(new URLSearchParams(window.location.search), {
466
466
  // @ts-ignore
467
467
  get: (r, n) => r.get(n)
468
468
  })[e];
469
- function Ie(e) {
469
+ function Pe(e) {
470
470
  return e[Math.floor(Math.random() * e.length)];
471
471
  }
472
- function Ee(e) {
472
+ function ke(e) {
473
473
  switch (e.language) {
474
474
  case "ar":
475
475
  return {
@@ -480,7 +480,7 @@ function Ee(e) {
480
480
  return {};
481
481
  }
482
482
  }
483
- function Pe(e) {
483
+ function Se(e) {
484
484
  const t = window.BuzzCasting.getOptions().suspended ?? !1;
485
485
  return e.forEach((r) => {
486
486
  var n;
@@ -521,13 +521,13 @@ function Pe(e) {
521
521
  }
522
522
  }), e;
523
523
  }
524
- function ke(e, t, r, n) {
524
+ function ye(e, t, r, n) {
525
525
  e.stopPropagation(), t.showModal({
526
526
  showComponent: "card-modal",
527
527
  props: { data: r, options: n }
528
528
  });
529
529
  }
530
- function Se(e) {
530
+ function Me(e) {
531
531
  const t = [...e];
532
532
  for (let r = t.length - 1; r > 0; r--) {
533
533
  const n = Math.floor(Math.random() * (r + 1));
@@ -535,13 +535,13 @@ function Se(e) {
535
535
  }
536
536
  return t;
537
537
  }
538
- function Me() {
538
+ function $e() {
539
539
  let e = "";
540
540
  const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
541
541
  for (let r = 0; r < 7; r++) e += t.charAt(Math.floor(Math.random() * t.length));
542
542
  return e;
543
543
  }
544
- const $e = (e) => {
544
+ const Ce = (e) => {
545
545
  switch (e == null ? void 0 : e.type) {
546
546
  case h.MESSAGES:
547
547
  return m.MESSAGES;
@@ -554,12 +554,12 @@ const $e = (e) => {
554
554
  }
555
555
  }, K = (e = 6) => Math.random().toString(36).substring(2, e + 2), Y = (e, t = []) => !t.find(function(n) {
556
556
  return n === e;
557
- }), ye = (e, t = []) => {
557
+ }), Ue = (e, t = []) => {
558
558
  let n = 0, o = "";
559
559
  for (; o == "" && n < 100; )
560
560
  o = K(e), Y(o, t) || (o = "", n++);
561
561
  return o;
562
- }, Ce = (e) => {
562
+ }, Ge = (e) => {
563
563
  switch (!0) {
564
564
  case e < 0:
565
565
  return "text-down text-xs";
@@ -568,12 +568,12 @@ const $e = (e) => {
568
568
  default:
569
569
  return "text-white text-xs";
570
570
  }
571
- }, Ue = (e, t, r) => Promise.race([e, Z(t, r)]), Z = (e, t) => new Promise((r, n) => setTimeout(() => t === void 0 ? r("ok") : n(t), e));
572
- function Ge(e) {
571
+ }, Be = (e, t, r) => Promise.race([e, Z(t, r)]), Z = (e, t) => new Promise((r, n) => setTimeout(() => t === void 0 ? r("ok") : n(t), e));
572
+ function Te(e) {
573
573
  let t = `${e.type}.${e.topics}`;
574
574
  return e.order && (t += `.${e.order}`), e.period && (t += `.${e.period}`), t;
575
575
  }
576
- function Be(e) {
576
+ function He(e) {
577
577
  var t;
578
578
  if (e.widget === void 0) {
579
579
  const r = (t = e.topics) == null ? void 0 : t.split("-");
@@ -581,7 +581,7 @@ function Be(e) {
581
581
  }
582
582
  return e;
583
583
  }
584
- function Te(e, t) {
584
+ function We(e, t) {
585
585
  var i;
586
586
  let r, n, o, a, l;
587
587
  switch (e.moderation) {
@@ -599,19 +599,19 @@ function Te(e, t) {
599
599
  }
600
600
  return t;
601
601
  }
602
- var X = /* @__PURE__ */ ((e) => (e.MultiPolygon = "MultiPolygon", e.Polygon = "Polygon", e))(X || {}), j = /* @__PURE__ */ ((e) => (e.MultiPolygon = "MultiPolygon", e.Polygon = "Polygon", e))(j || {});
602
+ var j = /* @__PURE__ */ ((e) => (e.MultiPolygon = "MultiPolygon", e.Polygon = "Polygon", e))(j || {}), X = /* @__PURE__ */ ((e) => (e.MultiPolygon = "MultiPolygon", e.Polygon = "Polygon", e))(X || {});
603
603
  export {
604
604
  h as API,
605
605
  m as CSS,
606
606
  v as EVENTS,
607
607
  A as HTMLParser,
608
- be as HTMLtoDOM,
609
- ge as HTMLtoXML,
608
+ me as HTMLtoDOM,
609
+ be as HTMLtoXML,
610
610
  x as MODERATION,
611
611
  ce as RGBAchangeA,
612
612
  I as STORAGE,
613
- j as ShapeType,
614
- X as Type,
613
+ X as ShapeType,
614
+ j as Type,
615
615
  J as anonymize,
616
616
  z as attachedMedia,
617
617
  q as attrs,
@@ -623,38 +623,40 @@ export {
623
623
  ne as capitalizeFirstLetter,
624
624
  oe as clearContents,
625
625
  P as deepMerge,
626
- de as escape,
626
+ ue as escape,
627
627
  N as filterAttributes,
628
- ue as formatContent,
629
- fe as getGuid,
630
- Ge as getKey,
631
- Le as getParameterByName,
632
- ve as getQueryParam,
633
- he as hasHWA,
634
- pe as hashSum,
635
- me as html2json,
636
- xe as intToString,
628
+ fe as formatContent,
629
+ pe as getGuid,
630
+ Te as getKey,
631
+ Ie as getParameterByName,
632
+ Ee as getQueryParam,
633
+ xe as hasHWA,
634
+ ge as hashSum,
635
+ he as html2json,
636
+ De as intToString,
637
+ Ae as isEmpty,
637
638
  F as json2html,
638
- De as log,
639
- Re as maxifyCss,
640
- Oe as maxifyHtml,
641
- we as minifyCss,
642
- Ae as minifyHtml,
643
- Te as moderation,
644
- _e as numberFormatter,
639
+ Oe as log,
640
+ Le as maxifyCss,
641
+ Re as maxifyHtml,
642
+ _e as minifyCss,
643
+ we as minifyHtml,
644
+ We as moderation,
645
+ ve as numberFormatter,
645
646
  ae as randomColor,
646
647
  le as randomRGB,
647
648
  se as randomRGBA,
648
649
  ie as randomRGBAfull,
649
- Ie as randomValue,
650
- Ee as rtl,
651
- Pe as sanitize,
652
- ke as showModal,
653
- Se as shuffleMessages,
654
- Me as stringGen,
655
- $e as typeCss,
656
- ye as uniq,
657
- Ce as upDownColor,
658
- Be as widgetParams,
659
- Ue as wrapPromise
650
+ Pe as randomValue,
651
+ ke as rtl,
652
+ Se as sanitize,
653
+ ye as showModal,
654
+ Me as shuffleMessages,
655
+ $e as stringGen,
656
+ Ce as typeCss,
657
+ Ue as uniq,
658
+ de as unique,
659
+ Ge as upDownColor,
660
+ He as widgetParams,
661
+ Be as wrapPromise
660
662
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "buzzcasting-utils",
3
3
  "type": "module",
4
- "version": "1.6.0",
4
+ "version": "1.6.2",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "Mark Tamis, TouchFlows SAS",
@@ -29,21 +29,21 @@
29
29
  },
30
30
  "dependencies": {},
31
31
  "devDependencies": {
32
- "@antfu/eslint-config": "^4.12.0",
33
- "@commitlint/cli": "^19.8.0",
34
- "@commitlint/config-conventional": "^19.8.0",
35
- "@types/node": "^22.15.3",
36
- "@typescript-eslint/eslint-plugin": "^8.31.1",
37
- "@typescript-eslint/parser": "^8.31.1",
38
- "@vitest/coverage-v8": "^3.1.2",
32
+ "@antfu/eslint-config": "^4.13.2",
33
+ "@commitlint/cli": "^19.8.1",
34
+ "@commitlint/config-conventional": "^19.8.1",
35
+ "@types/node": "^22.15.29",
36
+ "@typescript-eslint/eslint-plugin": "^8.33.0",
37
+ "@typescript-eslint/parser": "^8.33.0",
38
+ "@vitest/coverage-v8": "^3.2.0",
39
39
  "camelcase": "^8.0.0",
40
40
  "changelogen": "^0.6.1",
41
- "eslint": "^9.25.1",
41
+ "eslint": "^9.28.0",
42
42
  "lint-staged": "^16.0.0",
43
43
  "typescript": "^5.8.3",
44
- "vite": "^6.3.4",
45
- "vite-plugin-dts": "^4.5.3",
46
- "vitest": "^3.1.2"
44
+ "vite": "^6.3.5",
45
+ "vite-plugin-dts": "^4.5.4",
46
+ "vitest": "^3.2.0"
47
47
  },
48
48
  "lint-staged": {
49
49
  "*.ts": "npm run lint"