@braze/web-sdk 4.2.1 → 4.4.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.
Files changed (178) hide show
  1. package/index.d.ts +57 -6
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +8 -1
  4. package/shared-lib/encoding-utils.js +12 -1
  5. package/shared-lib/event-types.js +32 -1
  6. package/shared-lib/guid.js +10 -1
  7. package/shared-lib/indexed-db-adapter.js +315 -1
  8. package/shared-lib/logger.js +38 -1
  9. package/shared-lib/supported-options.js +26 -1
  10. package/src/Card/card-manager-factory.js +14 -1
  11. package/src/Card/card-manager.js +72 -1
  12. package/src/Card/display/card-display.js +134 -1
  13. package/src/Card/index.js +5 -1
  14. package/src/Card/log-card-click.js +11 -1
  15. package/src/Card/log-card-dismissal.js +11 -1
  16. package/src/Card/log-card-impressions.js +13 -1
  17. package/src/Card/log-content-card-impressions.js +4 -1
  18. package/src/Card/models/banner.js +30 -1
  19. package/src/Card/models/captioned-image.js +32 -1
  20. package/src/Card/models/card.js +174 -1
  21. package/src/Card/models/classic-card.js +32 -1
  22. package/src/Card/models/control-card.js +38 -1
  23. package/src/Card/models/index.js +5 -1
  24. package/src/Card/util/card-factory.js +104 -1
  25. package/src/ContentCards/content-cards-provider-factory.js +20 -1
  26. package/src/ContentCards/content-cards-provider.js +283 -1
  27. package/src/ContentCards/content-cards.js +24 -1
  28. package/src/ContentCards/get-cached-content-cards.js +5 -1
  29. package/src/ContentCards/index.js +8 -1
  30. package/src/ContentCards/log-content-cards-displayed.js +5 -1
  31. package/src/ContentCards/request-content-cards-refresh.js +5 -1
  32. package/src/ContentCards/subscribe-to-content-cards-updates.js +14 -1
  33. package/src/ContentCards/ui/hide-content-cards.js +8 -1
  34. package/src/ContentCards/ui/show-content-cards.js +72 -1
  35. package/src/ContentCards/ui/toggle-content-cards.js +8 -1
  36. package/src/Core/add-sdk-metadata.js +27 -1
  37. package/src/Core/braze-sdk-metadata.js +10 -1
  38. package/src/Core/change-user.js +19 -1
  39. package/src/Core/destroy.js +5 -1
  40. package/src/Core/device-properties.js +9 -1
  41. package/src/Core/disable-sdk.js +10 -1
  42. package/src/Core/enable-sdk.js +8 -1
  43. package/src/Core/get-device-id.js +10 -1
  44. package/src/Core/get-user.js +4 -1
  45. package/src/Core/handle-braze-action.js +64 -1
  46. package/src/Core/index.js +23 -1
  47. package/src/Core/initialize.js +4 -1
  48. package/src/Core/is-disabled.js +4 -1
  49. package/src/Core/log-custom-event.js +36 -1
  50. package/src/Core/log-purchase.js +245 -1
  51. package/src/Core/open-session.js +23 -1
  52. package/src/Core/remove-all-subscriptions.js +4 -1
  53. package/src/Core/remove-subscription.js +4 -1
  54. package/src/Core/request-immediate-data-flush.js +4 -1
  55. package/src/Core/set-logger.js +4 -1
  56. package/src/Core/set-sdk-authentication-signature.js +9 -1
  57. package/src/Core/subscribe-to-sdk-authentication-failures.js +4 -1
  58. package/src/Core/toggle-logging.js +4 -1
  59. package/src/Core/wipe-data.js +15 -1
  60. package/src/FeatureFlags/feature-flag-factory.js +14 -0
  61. package/src/FeatureFlags/feature-flag.js +16 -0
  62. package/src/FeatureFlags/feature-flags-provider-factory.js +19 -0
  63. package/src/FeatureFlags/feature-flags-provider.js +94 -0
  64. package/src/FeatureFlags/get-all-feature-flags.js +12 -0
  65. package/src/FeatureFlags/get-feature-flag.js +12 -0
  66. package/src/FeatureFlags/index.js +4 -0
  67. package/src/FeatureFlags/refresh-feature-flags.js +9 -0
  68. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +6 -0
  69. package/src/Feed/feed-provider-factory.js +18 -1
  70. package/src/Feed/feed-provider.js +79 -1
  71. package/src/Feed/feed.js +20 -1
  72. package/src/Feed/get-cached-feed.js +5 -1
  73. package/src/Feed/index.js +8 -1
  74. package/src/Feed/log-feed-displayed.js +5 -1
  75. package/src/Feed/request-feed-refresh.js +5 -1
  76. package/src/Feed/subscribe-to-feed-updates.js +5 -1
  77. package/src/Feed/ui/hide-feed.js +7 -1
  78. package/src/Feed/ui/show-feed.js +89 -1
  79. package/src/Feed/ui/toggle-feed.js +8 -1
  80. package/src/InAppMessage/display/get-animation-effect.js +19 -1
  81. package/src/InAppMessage/display/html-message-to-html.js +223 -1
  82. package/src/InAppMessage/display/in-app-message-to-html.js +152 -1
  83. package/src/InAppMessage/display/modal-utils.js +68 -1
  84. package/src/InAppMessage/in-app-message-factory.js +145 -1
  85. package/src/InAppMessage/in-app-message-manager-factory.js +16 -1
  86. package/src/InAppMessage/in-app-message-manager.js +189 -1
  87. package/src/InAppMessage/index.js +14 -1
  88. package/src/InAppMessage/log-in-app-message-button-click.js +19 -1
  89. package/src/InAppMessage/log-in-app-message-click.js +16 -1
  90. package/src/InAppMessage/log-in-app-message-html-click.js +23 -1
  91. package/src/InAppMessage/log-in-app-message-impression.js +13 -1
  92. package/src/InAppMessage/models/control-message.js +8 -1
  93. package/src/InAppMessage/models/full-screen-message.js +71 -1
  94. package/src/InAppMessage/models/html-message.js +54 -1
  95. package/src/InAppMessage/models/in-app-message-button.js +40 -1
  96. package/src/InAppMessage/models/in-app-message.js +267 -1
  97. package/src/InAppMessage/models/modal-message.js +68 -1
  98. package/src/InAppMessage/models/slide-up-message.js +58 -1
  99. package/src/InAppMessage/models/templated-in-app-message.js +14 -1
  100. package/src/InAppMessage/subscribe-to-in-app-message.js +10 -1
  101. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +15 -1
  102. package/src/InAppMessage/ui/show-in-app-message.js +170 -1
  103. package/src/Push/index.js +5 -1
  104. package/src/Push/is-push-blocked.js +5 -1
  105. package/src/Push/is-push-permission-granted.js +5 -1
  106. package/src/Push/is-push-supported.js +5 -1
  107. package/src/Push/push-manager-factory.js +30 -1
  108. package/src/Push/push-manager.js +360 -1
  109. package/src/Push/request-push-permission.js +8 -1
  110. package/src/Push/unregister-push.js +5 -1
  111. package/src/Push/utils/push-utils.js +34 -1
  112. package/src/User/index.js +1 -1
  113. package/src/User/user-manager.js +70 -1
  114. package/src/User/user.js +278 -1
  115. package/src/common/base-feed.js +25 -1
  116. package/src/common/base-provider.js +6 -1
  117. package/src/common/constants.js +5 -1
  118. package/src/common/event-logger.js +24 -1
  119. package/src/common/feed-display.js +200 -1
  120. package/src/common/translations.js +148 -1
  121. package/src/index.js +9 -1
  122. package/src/l10n/l10n-manager-factory.js +22 -1
  123. package/src/l10n/l10n-manager.js +21 -1
  124. package/src/managers/auth-manager.js +48 -1
  125. package/src/managers/braze-instance.js +307 -1
  126. package/src/managers/device-manager.js +80 -1
  127. package/src/managers/network-manager.js +219 -1
  128. package/src/managers/server-config-manager.js +88 -1
  129. package/src/managers/session-manager.js +68 -1
  130. package/src/managers/storage-manager-factory.js +35 -1
  131. package/src/managers/storage-manager.js +394 -1
  132. package/src/managers/subscription-manager.js +25 -1
  133. package/src/models/backend-errors.js +8 -1
  134. package/src/models/braze-event.js +41 -1
  135. package/src/models/braze-sdk-metadata.js +10 -1
  136. package/src/models/device.js +26 -1
  137. package/src/models/identifier.js +20 -1
  138. package/src/models/push-token.js +22 -1
  139. package/src/models/request-result.js +8 -1
  140. package/src/models/server-config.js +32 -1
  141. package/src/request-controller.js +288 -1
  142. package/src/triggers/models/custom-event-data.js +14 -1
  143. package/src/triggers/models/custom-event-property-data.js +21 -1
  144. package/src/triggers/models/filter-set.js +55 -1
  145. package/src/triggers/models/filter.js +98 -1
  146. package/src/triggers/models/in-app-message-click-data.js +25 -1
  147. package/src/triggers/models/purchase-data.js +14 -1
  148. package/src/triggers/models/purchase-property-data.js +21 -1
  149. package/src/triggers/models/push-click-data.js +15 -1
  150. package/src/triggers/models/trigger-condition.js +109 -1
  151. package/src/triggers/models/trigger-events.js +8 -1
  152. package/src/triggers/models/trigger.js +110 -1
  153. package/src/triggers/triggers-provider-factory.js +30 -1
  154. package/src/triggers/triggers-provider.js +307 -1
  155. package/src/ui/js/attach-css.js +12 -1
  156. package/src/ui/js/feed-css.js +12 -1
  157. package/src/ui/js/iam-css.js +12 -1
  158. package/src/ui/js/index.js +3 -1
  159. package/src/ui/js/load-font-awesome.js +13 -1
  160. package/src/util/base-device-parser.js +14 -1
  161. package/src/util/braze-actions.js +79 -1
  162. package/src/util/browser-detector.js +85 -1
  163. package/src/util/client-hints-parser.js +60 -1
  164. package/src/util/code-utils.js +92 -1
  165. package/src/util/color-utils.js +23 -1
  166. package/src/util/component-utils.js +26 -1
  167. package/src/util/date-utils.js +27 -1
  168. package/src/util/deprecation-utils.js +5 -1
  169. package/src/util/device-constants.js +14 -1
  170. package/src/util/dom-utils.js +87 -1
  171. package/src/util/key-codes.js +1 -1
  172. package/src/util/math.js +5 -1
  173. package/src/util/net.js +75 -1
  174. package/src/util/string-utils.js +22 -1
  175. package/src/util/url-utils.js +23 -1
  176. package/src/util/user-agent-parser.js +85 -1
  177. package/src/util/validation-utils.js +136 -1
  178. package/src/util/window-utils.js +35 -1
@@ -1 +1,88 @@
1
- import{STORAGE_KEYS as o}from"./storage-manager.js";import u from"./subscription-manager.js";import jt from"../models/server-config.js";export default class Ct{constructor(t){this.h=t,this.sh=new u,this.eh=new u,this.ih=null}rh(){if(null==this.ih){const t=this.h.I(o.q.nh);this.ih=null!=t?jt.yn(t):new jt}return this.ih}Zs(){return this.rh().hh}lh(t){if(null!=t&&null!=t.config){const s=t.config;if(s.time>this.rh().hh){const t=new jt(s.time,s.events_blacklist,s.attributes_blacklist,s.purchases_blacklist,s.messaging_session_timeout,s.vapid_public_key,s.content_cards);let e=!1;null!=t.oh&&this.fn()!==t.oh&&(e=!0);let i=!1;null!=t.uh.enabled&&this.Ys()!==t.uh.enabled&&(i=!0),this.ih=t,this.h.B(o.q.nh,t.ss()),e&&this.sh.St(),i&&this.eh.St()}}}dn(t){let s=this.sh.ut(t);return this.ah&&this.sh.removeSubscription(this.ah),this.ah=s,s}Ms(t){return this.eh.ut(t)}ge(t){return-1!==this.rh().gh.indexOf(t)}hu(t){return-1!==this.rh().mh.indexOf(t)}Dr(t){return-1!==this.rh().fh.indexOf(t)}dh(){return this.rh().ph}fn(){return this.rh().oh}Ys(){return this.rh().uh.enabled||!1}}
1
+ import { STORAGE_KEYS as o } from "./storage-manager.js";
2
+ import u from "./subscription-manager.js";
3
+ import Ft from "../models/server-config.js";
4
+ import s from "../common/event-logger.js";
5
+ import r from "../../shared-lib/braze-shared-lib.js";
6
+ export default class Pt {
7
+ constructor(t) {
8
+ (this.h = t),
9
+ (this.tl = new u()),
10
+ (this.sl = new u()),
11
+ (this.il = new u()),
12
+ (this.rl = null);
13
+ }
14
+ hl() {
15
+ if (null == this.rl) {
16
+ const t = this.h.I(o.q.ol);
17
+ this.rl = null != t ? Ft.Dn(t) : new Ft();
18
+ }
19
+ return this.rl;
20
+ }
21
+ Zs() {
22
+ return this.hl().ul;
23
+ }
24
+ al(t) {
25
+ if (null != t && null != t.config) {
26
+ const e = t.config;
27
+ if (e.time > this.hl().ul) {
28
+ const t = new Ft(
29
+ e.time,
30
+ e.events_blacklist,
31
+ e.attributes_blacklist,
32
+ e.purchases_blacklist,
33
+ e.messaging_session_timeout,
34
+ e.vapid_public_key,
35
+ e.content_cards,
36
+ e.feature_flags
37
+ );
38
+ let s = !1;
39
+ null != t.gl && this.gn() !== t.gl && (s = !0);
40
+ let i = !1;
41
+ null != t.ml.enabled && this.Ys() !== t.ml.enabled && (i = !0);
42
+ let r = !1;
43
+ null != t.cl.enabled && this.ye() !== t.cl.enabled && (r = !0),
44
+ (this.rl = t),
45
+ this.h.B(o.q.ol, t.ss()),
46
+ s && this.tl.St(),
47
+ i && this.sl.St(),
48
+ r && this.il.St();
49
+ }
50
+ }
51
+ }
52
+ wn(t) {
53
+ let e = this.tl.ut(t);
54
+ return this.fl && this.tl.removeSubscription(this.fl), (this.fl = e), e;
55
+ }
56
+ Ms(t) {
57
+ return this.sl.ut(t);
58
+ }
59
+ Te(t) {
60
+ return this.il.ut(t);
61
+ }
62
+ ge(t) {
63
+ return -1 !== this.hl().bl.indexOf(t);
64
+ }
65
+ hu(t) {
66
+ return -1 !== this.hl().dl.indexOf(t);
67
+ }
68
+ Dr(t) {
69
+ return -1 !== this.hl().vl.indexOf(t);
70
+ }
71
+ wl() {
72
+ return this.hl().Cl;
73
+ }
74
+ gn() {
75
+ return this.hl().gl;
76
+ }
77
+ Ys() {
78
+ return this.hl().ml.enabled || !1;
79
+ }
80
+ ye() {
81
+ return this.hl().cl.enabled && null == this.$e()
82
+ ? (s.G(r.A.qs, { e: "Missing feature flag refresh_rate_limit." }), !1)
83
+ : this.hl().cl.enabled || !1;
84
+ }
85
+ $e() {
86
+ return this.hl().cl.refresh_rate_limit;
87
+ }
88
+ }
@@ -1 +1,68 @@
1
- import{STORAGE_KEYS as o}from"../managers/storage-manager.js";import ue from"../models/braze-event.js";import _t from"../models/identifier.js";import{convertMsToSeconds as l}from"../util/date-utils.js";import r from"../../shared-lib/braze-shared-lib.js";export default class Lt{constructor(s,t,e,i){this.h=s,this.v=t,this.gt=e,this.wh=1e3,i=parseFloat(i),isNaN(i)&&(i=1800),i<this.wh/1e3&&(r.D.info("Specified session timeout of "+i+"s is too small, using the minimum session timeout of "+this.wh/1e3+"s instead."),i=this.wh/1e3),this.Sh=i}jh(s,t){return new ue(this.v.getUserId(),r.A.bh,s,t.eu,{d:l(s-t.xh)})}Vo(){const s=this.h.tu(o.iu.Dh);return null==s?null:s.eu}Eh(){const s=(new Date).valueOf(),t=this.gt.dh(),e=this.h.I(o.q.Ch);if(null!=e&&null==t)return!1;const i=null==e||s-e>1e3*t;return i&&this.h.B(o.q.Ch,s),i}Gh(s,t){return null==t||!(s-t.xh<this.wh)&&t.Nh<s}mo(){const s=(new Date).valueOf(),t=s+1e3*this.Sh,e=this.h.tu(o.iu.Dh);if(this.Gh(s,e)){let i="Generating session start event with time "+s;if(null!=e){let s=e._h;s-e.xh<this.wh&&(s=e.xh+this.Fh),this.h.Hh(this.jh(s,e)),i+=" (old session ended "+s+")"}i+=". Will expire "+t.valueOf(),r.D.info(i);const n=new _t(r.it.nt(),t);this.h.Hh(new ue(this.v.getUserId(),r.A.Wh,s,n.eu)),this.h.ru(o.iu.Dh,n);return null==this.h.I(o.q.Ch)&&this.h.B(o.q.Ch,s),n.eu}return e._h=s,e.Nh=t,this.h.ru(o.iu.Dh,e),e.eu}kh(){const s=this.h.tu(o.iu.Dh);null!=s&&(this.h.qh(o.iu.Dh),this.h.Hh(this.jh((new Date).valueOf(),s)))}}
1
+ import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
2
+ import ue from "../models/braze-event.js";
3
+ import _t from "../models/identifier.js";
4
+ import { convertMsToSeconds as l } from "../util/date-utils.js";
5
+ import r from "../../shared-lib/braze-shared-lib.js";
6
+ export default class Rt {
7
+ constructor(s, t, e, i) {
8
+ (this.h = s),
9
+ (this.v = t),
10
+ (this.gt = e),
11
+ (this.uh = 1e3),
12
+ (i = parseFloat(i)),
13
+ isNaN(i) && (i = 1800),
14
+ i < this.uh / 1e3 &&
15
+ (r.D.info(
16
+ "Specified session timeout of " +
17
+ i +
18
+ "s is too small, using the minimum session timeout of " +
19
+ this.uh / 1e3 +
20
+ "s instead."
21
+ ),
22
+ (i = this.uh / 1e3)),
23
+ (this.ah = i);
24
+ }
25
+ mh(s, t) {
26
+ return new ue(this.v.getUserId(), r.A.dh, s, t.iu, { d: l(s - t.fh) });
27
+ }
28
+ ha() {
29
+ const s = this.h.tu(o.eu.ph);
30
+ return null == s ? null : s.iu;
31
+ }
32
+ gh() {
33
+ const s = new Date().valueOf(),
34
+ t = this.gt.wl(),
35
+ e = this.h.I(o.q.wh);
36
+ if (null != e && null == t) return !1;
37
+ const i = null == e || s - e > 1e3 * t;
38
+ return i && this.h.B(o.q.wh, s), i;
39
+ }
40
+ Sh(s, t) {
41
+ return null == t || (!(s - t.fh < this.uh) && t.jh < s);
42
+ }
43
+ mo() {
44
+ const s = new Date().valueOf(),
45
+ t = s + 1e3 * this.ah,
46
+ e = this.h.tu(o.eu.ph);
47
+ if (this.Sh(s, e)) {
48
+ let i = "Generating session start event with time " + s;
49
+ if (null != e) {
50
+ let s = e.bh;
51
+ s - e.fh < this.uh && (s = e.fh + this.xh),
52
+ this.h.Dh(this.mh(s, e)),
53
+ (i += " (old session ended " + s + ")");
54
+ }
55
+ (i += ". Will expire " + t.valueOf()), r.D.info(i);
56
+ const n = new _t(r.it.nt(), t);
57
+ this.h.Dh(new ue(this.v.getUserId(), r.A.Ch, s, n.iu)),
58
+ this.h.ru(o.eu.ph, n);
59
+ return null == this.h.I(o.q.wh) && this.h.B(o.q.wh, s), n.iu;
60
+ }
61
+ return (e.bh = s), (e.jh = t), this.h.ru(o.eu.ph, e), e.iu;
62
+ }
63
+ Gh() {
64
+ const s = this.h.tu(o.eu.ph);
65
+ null != s &&
66
+ (this.h.Nh(o.eu.ph), this.h.Dh(this.mh(new Date().valueOf(), s)));
67
+ }
68
+ }
@@ -1 +1,35 @@
1
- import G,{STORAGE_KEYS as o}from"./storage-manager.js";import r from"../../shared-lib/braze-shared-lib.js";const Pt={jo:(e,t)=>{let a=!1;try{if(localStorage&&localStorage.getItem)try{localStorage.setItem(o.q.ga,!0),localStorage.getItem(o.q.ga)&&(localStorage.removeItem(o.q.ga),a=!0)}catch(e){if("QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||!(localStorage.length>0))throw e;a=!0}}catch(e){r.D.info("Local Storage not supported!")}const l=Pt.Sa(),c=new G.Ea(e,l&&!t,a);let n=null;return n=a?new G.wa(e):new G._a,new G(c,n)},Sa:()=>navigator.cookieEnabled||"cookie"in document&&(document.cookie.length>0||(document.cookie="test").indexOf.call(document.cookie,"test")>-1)};export default Pt;
1
+ import G, { STORAGE_KEYS as o } from "./storage-manager.js";
2
+ import r from "../../shared-lib/braze-shared-lib.js";
3
+ const Mt = {
4
+ Wo: (e, t) => {
5
+ let a = !1;
6
+ try {
7
+ if (localStorage && localStorage.getItem)
8
+ try {
9
+ localStorage.setItem(o.q.Sa, !0),
10
+ localStorage.getItem(o.q.Sa) &&
11
+ (localStorage.removeItem(o.q.Sa), (a = !0));
12
+ } catch (e) {
13
+ if (
14
+ ("QuotaExceededError" !== e.name &&
15
+ "NS_ERROR_DOM_QUOTA_REACHED" !== e.name) ||
16
+ !(localStorage.length > 0)
17
+ )
18
+ throw e;
19
+ a = !0;
20
+ }
21
+ } catch (e) {
22
+ r.D.info("Local Storage not supported!");
23
+ }
24
+ const l = Mt.Ea(),
25
+ c = new G.wa(e, l && !t, a);
26
+ let n = null;
27
+ return (n = a ? new G._a(e) : new G.Oa()), new G(c, n);
28
+ },
29
+ Ea: () =>
30
+ navigator.cookieEnabled ||
31
+ ("cookie" in document &&
32
+ (document.cookie.length > 0 ||
33
+ (document.cookie = "test").indexOf.call(document.cookie, "test") > -1))
34
+ };
35
+ export default Mt;
@@ -1 +1,394 @@
1
- import et from"../util/browser-detector.js";import ue from"../models/braze-event.js";import _t from"../models/identifier.js";import{isArray as p,keys as rr,validateValueIsFromEnum as F,values as At}from"../util/code-utils.js";import r from"../../shared-lib/braze-shared-lib.js";import{User}from"../User/index.js";export const STORAGE_KEYS={iu:{su:"ab.storage.userId",Go:"ab.storage.deviceId",Dh:"ab.storage.sessionId"},q:{ga:"ab.test",Ta:"ab.storage.events",Aa:"ab.storage.attributes",Oa:"ab.storage.attributes.anonymous_user",Ho:"ab.storage.device",Yo:"ab.storage.sdk_metadata",Zo:"ab.storage.session_id_for_cached_metadata",gn:"ab.storage.pushToken",ei:"ab.storage.newsFeed",hi:"ab.storage.lastNewsFeedRefresh",P:"ab.storage.cardImpressions",nh:"ab.storage.serverConfig",ba:"ab.storage.triggers",Ia:"ab.storage.triggers.ts",Ch:"ab.storage.messagingSessionStart",Yt:"ab.storage.cc",vs:"ab.storage.ccLastFullSync",ys:"ab.storage.ccLastCardUpdated",$:"ab.storage.ccClicks",O:"ab.storage.ccImpressions",K:"ab.storage.ccDismissals",Ka:"ab.storage.lastDisplayedTriggerTimesById",Ya:"ab.storage.lastDisplayedTriggerTime",Da:"ab.storage.triggerFireInstancesById",Jn:"ab.storage.signature",As:"ab.storage.brazeSyncRetryCount",_s:"ab.storage.sdkVersion"},ae:"ab.optOut"};export default class G{constructor(t,e){this.Ga=t,this.Na=e}ru(t,e){let s=e;null!=e&&e instanceof _t&&(s=e.ss()),this.Ga.store(t,s)}va(t){const e=this.tu(t);null!=e&&(e._h=(new Date).valueOf(),this.ru(t,e))}tu(t){return _t.yn(this.Ga.lr(t))}qh(t){this.Ga.remove(t)}bo(t){if(null==t||0===t.length)return!1;p(t)||(t=[t]);let e=this.Na.lr(STORAGE_KEYS.q.Ta);null!=e&&p(e)||(e=[]);for(let s=0;s<t.length;s++)e.push(t[s].ss());return this.Na.store(STORAGE_KEYS.q.Ta,e)}Hh(t){return null!=t&&this.bo([t])}Ca(){let t=this.Na.lr(STORAGE_KEYS.q.Ta);this.Na.remove(STORAGE_KEYS.q.Ta),null==t&&(t=[]);const e=[];let s=!1,o=null;if(p(t))for(let s=0;s<t.length;s++)ue.Ma(t[s])?e.push(ue.yn(t[s])):o=s;else s=!0;if(s||null!=o){let n="Stored events could not be deserialized as Events";s&&(n+=", was "+Object.prototype.toString.call(t)+" not an array"),null!=o&&(n+=", value at index "+o+" does not look like an event"),n+=", serialized values were of type "+typeof t+": "+JSON.stringify(t),e.push(new ue(null,r.A.qs,(new Date).valueOf(),null,{e:n}))}return e}B(t,e){return!!F(STORAGE_KEYS.q,t,"StorageManager cannot store object.","STORAGE_KEYS.OBJECTS")&&this.Na.store(t,e)}I(t){return!!F(STORAGE_KEYS.q,t,"StorageManager cannot retrieve object.","STORAGE_KEYS.OBJECTS")&&this.Na.lr(t)}Xs(t){return!!F(STORAGE_KEYS.q,t,"StorageManager cannot remove object.","STORAGE_KEYS.OBJECTS")&&(this.Na.remove(t),!0)}clearData(){const t=rr(STORAGE_KEYS.iu),e=rr(STORAGE_KEYS.q);for(let e=0;e<t.length;e++){const s=t[e];this.Ga.remove(STORAGE_KEYS.iu[s])}for(let t=0;t<e.length;t++){const s=e[t];this.Na.remove(STORAGE_KEYS.q[s])}}ya(t){return t||STORAGE_KEYS.q.Oa}pa(t){let e=this.Na.lr(STORAGE_KEYS.q.Aa);null==e&&(e={});const s=this.ya(t[User._n]);for(let r in t)r===User._n||null!=e[s]&&null!=e[s][r]||this.mu(t[User._n],r,t[r])}mu(t,e,s){let r=this.Na.lr(STORAGE_KEYS.q.Aa);null==r&&(r={});const o=this.ya(t);let n=r[o];if(null==n&&(n={},null!=t&&(n[User._n]=t)),e===User.lu){null==n[e]&&(n[e]={});for(let t in s)n[e][t]=s[t]}else n[e]=s;return r[o]=n,this.Na.store(STORAGE_KEYS.q.Aa,r)}Ua(){const t=this.Na.lr(STORAGE_KEYS.q.Aa);this.Na.remove(STORAGE_KEYS.q.Aa);const e=[];for(let s in t)null!=t[s]&&e.push(t[s]);return e}ou(t){const e=this.Na.lr(STORAGE_KEYS.q.Aa);if(null!=e){const s=this.ya(null),r=e[s];null!=r&&(e[s]=void 0,this.Na.store(STORAGE_KEYS.q.Aa,e),r[User._n]=t,this.pa(r))}const s=this.tu(STORAGE_KEYS.iu.Dh);let r=null;null!=s&&(r=s.eu);const o=this.Ca();if(null!=o)for(let e=0;e<o.length;e++){const s=o[e];null==s.userId&&s.sessionId==r&&(s.userId=t),this.Hh(s)}}Ba(){return this.Na.Fa}}G.wa=class{constructor(t){this.Ji=t,this.Fa=et.La()?3:10}Pa(t){return t+"."+this.Ji}store(t,e){const s={v:e};try{return localStorage.setItem(this.Pa(t),JSON.stringify(s)),!0}catch(t){return r.D.info("Storage failure: "+t.message),!1}}lr(t){try{const e=JSON.parse(localStorage.getItem(this.Pa(t)));return null==e?null:e.v}catch(t){return r.D.info("Storage retrieval failure: "+t.message),null}}remove(t){try{localStorage.removeItem(this.Pa(t))}catch(t){return r.D.info("Storage removal failure: "+t.message),!1}}};G.ne=class{constructor(t,e){this.Ji=t,this.xa=this.Ja(),this.ka=576e3,this.Va=!!e}Pa(t){return null!=this.Ji?t+"."+this.Ji:t}Ja(){let t=0,e=document.location.hostname;const s=e.split("."),r="ab._gd";for(;t<s.length-1&&-1===document.cookie.indexOf(r+"="+r);)t++,e="."+s.slice(-1-t).join("."),document.cookie=r+"="+r+";domain="+e+";";return document.cookie=r+"=;expires="+new Date(0).toGMTString()+";domain="+e+";",e}ie(){const t=new Date;return t.setTime(t.getTime()+60*this.ka*1e3),t.getFullYear()}za(){const t=At(STORAGE_KEYS.iu),e=document.cookie.split(";");for(let s=0;s<e.length;s++){let r=e[s];for(;" "===r.charAt(0);)r=r.substring(1);let o=!1;for(let e=0;e<t.length;e++)if(0===r.indexOf(t[e])){o=!0;break}if(o){const t=r.split("=")[0];-1===t.indexOf("."+this.Ji)&&this.Qa(t)}}}store(t,e){this.za();const s=new Date;s.setTime(s.getTime()+60*this.ka*1e3);const o="expires="+s.toUTCString(),n="domain="+this.xa;let i;i=this.Va?e:encodeURIComponent(JSON.stringify(e));const a=this.Pa(t)+"="+i+";"+o+";"+n+";path=/";return a.length>=4093?(r.D.info("Storage failure: string is "+a.length+" chars which is too large to store as a cookie."),!1):(document.cookie=a,!0)}lr(t){const e=[],s=this.Pa(t)+"=",o=document.cookie.split(";");for(let n=0;n<o.length;n++){let i=o[n];for(;" "===i.charAt(0);)i=i.substring(1);if(0===i.indexOf(s))try{let t;t=this.Va?i.substring(s.length,i.length):JSON.parse(decodeURIComponent(i.substring(s.length,i.length))),e.push(t)}catch(e){return r.D.info("Storage retrieval failure: "+e.message),this.remove(t),null}}return e.length>0?e[e.length-1]:null}remove(t){this.Qa(this.Pa(t))}Qa(t){const e=t+"=;expires="+new Date(0).toGMTString();document.cookie=e,document.cookie=e+";path=/";const s=e+";domain="+this.xa;document.cookie=s,document.cookie=s+";path=/"}};G._a=class{constructor(){this.Ha={},this.Wa=5242880,this.Fa=3}store(t,e){const s={value:e},o=this.Xa(e);return o>this.Wa?(r.D.info("Storage failure: object is ≈"+o+" bytes which is greater than the max of "+this.Wa),!1):(this.Ha[t]=s,!0)}Xa(t){const e=[],s=[t];let r=0;for(;s.length;){const t=s.pop();if("boolean"==typeof t)r+=4;else if("string"==typeof t)r+=2*t.length;else if("number"==typeof t)r+=8;else if("object"==typeof t&&-1===e.indexOf(t)){e.push(t);for(let e in t)s.push(t[e])}}return r}lr(t){const e=this.Ha[t];return null==e?null:e.value}remove(t){this.Ha[t]=null}};G.Ea=class{constructor(t,e,s){this.Za=[],e&&this.Za.push(new G.ne(t)),s&&this.Za.push(new G.wa(t)),this.Za.push(new G._a(t))}store(t,e){let s=!0;for(let r=0;r<this.Za.length;r++)s=this.Za[r].store(t,e)&&s;return s}lr(t){for(let e=0;e<this.Za.length;e++){const s=this.Za[e].lr(t);if(null!=s)return s}return null}remove(t){for(let e=0;e<this.Za.length;e++)this.Za[e].remove(t)}};
1
+ import ot from "../util/browser-detector.js";
2
+ import ue from "../models/braze-event.js";
3
+ import _t from "../models/identifier.js";
4
+ import {
5
+ isArray as p,
6
+ keys as rr,
7
+ validateValueIsFromEnum as F,
8
+ values as At
9
+ } from "../util/code-utils.js";
10
+ import r from "../../shared-lib/braze-shared-lib.js";
11
+ import { User } from "../User/index.js";
12
+ export const STORAGE_KEYS = {
13
+ eu: {
14
+ su: "ab.storage.userId",
15
+ Jo: "ab.storage.deviceId",
16
+ ph: "ab.storage.sessionId"
17
+ },
18
+ q: {
19
+ Sa: "ab.test",
20
+ Ta: "ab.storage.events",
21
+ Ia: "ab.storage.attributes",
22
+ Ka: "ab.storage.attributes.anonymous_user",
23
+ Xo: "ab.storage.device",
24
+ oa: "ab.storage.sdk_metadata",
25
+ ua: "ab.storage.session_id_for_cached_metadata",
26
+ kn: "ab.storage.pushToken",
27
+ ei: "ab.storage.newsFeed",
28
+ hi: "ab.storage.lastNewsFeedRefresh",
29
+ P: "ab.storage.cardImpressions",
30
+ ol: "ab.storage.serverConfig",
31
+ Ya: "ab.storage.triggers",
32
+ Da: "ab.storage.triggers.ts",
33
+ wh: "ab.storage.messagingSessionStart",
34
+ Yt: "ab.storage.cc",
35
+ vs: "ab.storage.ccLastFullSync",
36
+ ys: "ab.storage.ccLastCardUpdated",
37
+ $: "ab.storage.ccClicks",
38
+ O: "ab.storage.ccImpressions",
39
+ K: "ab.storage.ccDismissals",
40
+ Ga: "ab.storage.lastDisplayedTriggerTimesById",
41
+ Na: "ab.storage.lastDisplayedTriggerTime",
42
+ va: "ab.storage.triggerFireInstancesById",
43
+ Mn: "ab.storage.signature",
44
+ As: "ab.storage.brazeSyncRetryCount",
45
+ _s: "ab.storage.sdkVersion",
46
+ ze: "ab.storage.ff",
47
+ qe: "ab.storage.ffLastRefreshAt"
48
+ },
49
+ ae: "ab.optOut"
50
+ };
51
+ export default class G {
52
+ constructor(t, e) {
53
+ (this.Ma = t), (this.Ca = e);
54
+ }
55
+ ru(t, e) {
56
+ let s = e;
57
+ null != e && e instanceof _t && (s = e.ss()), this.Ma.store(t, s);
58
+ }
59
+ ya(t) {
60
+ const e = this.tu(t);
61
+ null != e && ((e.bh = new Date().valueOf()), this.ru(t, e));
62
+ }
63
+ tu(t) {
64
+ return _t.Dn(this.Ma.lr(t));
65
+ }
66
+ Nh(t) {
67
+ this.Ma.remove(t);
68
+ }
69
+ bo(t) {
70
+ if (null == t || 0 === t.length) return !1;
71
+ p(t) || (t = [t]);
72
+ let e = this.Ca.lr(STORAGE_KEYS.q.Ta);
73
+ (null != e && p(e)) || (e = []);
74
+ for (let s = 0; s < t.length; s++) e.push(t[s].ss());
75
+ return this.Ca.store(STORAGE_KEYS.q.Ta, e);
76
+ }
77
+ Dh(t) {
78
+ return null != t && this.bo([t]);
79
+ }
80
+ Ua() {
81
+ let t = this.Ca.lr(STORAGE_KEYS.q.Ta);
82
+ this.Ca.remove(STORAGE_KEYS.q.Ta), null == t && (t = []);
83
+ const e = [];
84
+ let s = !1,
85
+ o = null;
86
+ if (p(t))
87
+ for (let s = 0; s < t.length; s++)
88
+ ue.Fa(t[s]) ? e.push(ue.Dn(t[s])) : (o = s);
89
+ else s = !0;
90
+ if (s || null != o) {
91
+ let n = "Stored events could not be deserialized as Events";
92
+ s &&
93
+ (n += ", was " + Object.prototype.toString.call(t) + " not an array"),
94
+ null != o &&
95
+ (n += ", value at index " + o + " does not look like an event"),
96
+ (n +=
97
+ ", serialized values were of type " +
98
+ typeof t +
99
+ ": " +
100
+ JSON.stringify(t)),
101
+ e.push(new ue(null, r.A.qs, new Date().valueOf(), null, { e: n }));
102
+ }
103
+ return e;
104
+ }
105
+ B(t, e) {
106
+ return (
107
+ !!F(
108
+ STORAGE_KEYS.q,
109
+ t,
110
+ "StorageManager cannot store object.",
111
+ "STORAGE_KEYS.OBJECTS"
112
+ ) && this.Ca.store(t, e)
113
+ );
114
+ }
115
+ I(t) {
116
+ return (
117
+ !!F(
118
+ STORAGE_KEYS.q,
119
+ t,
120
+ "StorageManager cannot retrieve object.",
121
+ "STORAGE_KEYS.OBJECTS"
122
+ ) && this.Ca.lr(t)
123
+ );
124
+ }
125
+ Xs(t) {
126
+ return (
127
+ !!F(
128
+ STORAGE_KEYS.q,
129
+ t,
130
+ "StorageManager cannot remove object.",
131
+ "STORAGE_KEYS.OBJECTS"
132
+ ) && (this.Ca.remove(t), !0)
133
+ );
134
+ }
135
+ clearData() {
136
+ const t = rr(STORAGE_KEYS.eu),
137
+ e = rr(STORAGE_KEYS.q);
138
+ for (let e = 0; e < t.length; e++) {
139
+ const s = t[e];
140
+ this.Ma.remove(STORAGE_KEYS.eu[s]);
141
+ }
142
+ for (let t = 0; t < e.length; t++) {
143
+ const s = e[t];
144
+ this.Ca.remove(STORAGE_KEYS.q[s]);
145
+ }
146
+ }
147
+ La(t) {
148
+ return t || STORAGE_KEYS.q.Ka;
149
+ }
150
+ qa(t) {
151
+ let e = this.Ca.lr(STORAGE_KEYS.q.Ia);
152
+ null == e && (e = {});
153
+ const s = this.La(t[User.Ln]);
154
+ for (let r in t)
155
+ r === User.Ln ||
156
+ (null != e[s] && null != e[s][r]) ||
157
+ this.mu(t[User.Ln], r, t[r]);
158
+ }
159
+ mu(t, e, s) {
160
+ let r = this.Ca.lr(STORAGE_KEYS.q.Ia);
161
+ null == r && (r = {});
162
+ const o = this.La(t);
163
+ let n = r[o];
164
+ if (
165
+ (null == n && ((n = {}), null != t && (n[User.Ln] = t)), e === User.lu)
166
+ ) {
167
+ null == n[e] && (n[e] = {});
168
+ for (let t in s) n[e][t] = s[t];
169
+ } else n[e] = s;
170
+ return (r[o] = n), this.Ca.store(STORAGE_KEYS.q.Ia, r);
171
+ }
172
+ Ba() {
173
+ const t = this.Ca.lr(STORAGE_KEYS.q.Ia);
174
+ this.Ca.remove(STORAGE_KEYS.q.Ia);
175
+ const e = [];
176
+ for (let s in t) null != t[s] && e.push(t[s]);
177
+ return e;
178
+ }
179
+ ou(t) {
180
+ const e = this.Ca.lr(STORAGE_KEYS.q.Ia);
181
+ if (null != e) {
182
+ const s = this.La(null),
183
+ r = e[s];
184
+ null != r &&
185
+ ((e[s] = void 0),
186
+ this.Ca.store(STORAGE_KEYS.q.Ia, e),
187
+ (r[User.Ln] = t),
188
+ this.qa(r));
189
+ }
190
+ const s = this.tu(STORAGE_KEYS.eu.ph);
191
+ let r = null;
192
+ null != s && (r = s.iu);
193
+ const o = this.Ua();
194
+ if (null != o)
195
+ for (let e = 0; e < o.length; e++) {
196
+ const s = o[e];
197
+ null == s.userId && s.sessionId == r && (s.userId = t), this.Dh(s);
198
+ }
199
+ }
200
+ Pa() {
201
+ return this.Ca.xa;
202
+ }
203
+ }
204
+ G._a = class {
205
+ constructor(t) {
206
+ (this._r = t), (this.xa = ot.Ja() ? 3 : 10);
207
+ }
208
+ ka(t) {
209
+ return t + "." + this._r;
210
+ }
211
+ store(t, e) {
212
+ const s = { v: e };
213
+ try {
214
+ return localStorage.setItem(this.ka(t), JSON.stringify(s)), !0;
215
+ } catch (t) {
216
+ return r.D.info("Storage failure: " + t.message), !1;
217
+ }
218
+ }
219
+ lr(t) {
220
+ try {
221
+ const e = JSON.parse(localStorage.getItem(this.ka(t)));
222
+ return null == e ? null : e.v;
223
+ } catch (t) {
224
+ return r.D.info("Storage retrieval failure: " + t.message), null;
225
+ }
226
+ }
227
+ remove(t) {
228
+ try {
229
+ localStorage.removeItem(this.ka(t));
230
+ } catch (t) {
231
+ return r.D.info("Storage removal failure: " + t.message), !1;
232
+ }
233
+ }
234
+ };
235
+ G.ne = class {
236
+ constructor(t, e) {
237
+ (this._r = t), (this.Va = this.za()), (this.Qa = 576e3), (this.Ha = !!e);
238
+ }
239
+ ka(t) {
240
+ return null != this._r ? t + "." + this._r : t;
241
+ }
242
+ za() {
243
+ let t = 0,
244
+ e = document.location.hostname;
245
+ const s = e.split("."),
246
+ r = "ab._gd";
247
+ for (; t < s.length - 1 && -1 === document.cookie.indexOf(r + "=" + r); )
248
+ t++,
249
+ (e = "." + s.slice(-1 - t).join(".")),
250
+ (document.cookie = r + "=" + r + ";domain=" + e + ";");
251
+ return (
252
+ (document.cookie =
253
+ r + "=;expires=" + new Date(0).toGMTString() + ";domain=" + e + ";"),
254
+ e
255
+ );
256
+ }
257
+ ie() {
258
+ const t = new Date();
259
+ return t.setTime(t.getTime() + 60 * this.Qa * 1e3), t.getFullYear();
260
+ }
261
+ Wa() {
262
+ const t = At(STORAGE_KEYS.eu),
263
+ e = document.cookie.split(";");
264
+ for (let s = 0; s < e.length; s++) {
265
+ let r = e[s];
266
+ for (; " " === r.charAt(0); ) r = r.substring(1);
267
+ let o = !1;
268
+ for (let e = 0; e < t.length; e++)
269
+ if (0 === r.indexOf(t[e])) {
270
+ o = !0;
271
+ break;
272
+ }
273
+ if (o) {
274
+ const t = r.split("=")[0];
275
+ -1 === t.indexOf("." + this._r) && this.Xa(t);
276
+ }
277
+ }
278
+ }
279
+ store(t, e) {
280
+ this.Wa();
281
+ const s = new Date();
282
+ s.setTime(s.getTime() + 60 * this.Qa * 1e3);
283
+ const o = "expires=" + s.toUTCString(),
284
+ n = "domain=" + this.Va;
285
+ let i;
286
+ i = this.Ha ? e : encodeURIComponent(JSON.stringify(e));
287
+ const a = this.ka(t) + "=" + i + ";" + o + ";" + n + ";path=/";
288
+ return a.length >= 4093
289
+ ? (r.D.info(
290
+ "Storage failure: string is " +
291
+ a.length +
292
+ " chars which is too large to store as a cookie."
293
+ ),
294
+ !1)
295
+ : ((document.cookie = a), !0);
296
+ }
297
+ lr(t) {
298
+ const e = [],
299
+ s = this.ka(t) + "=",
300
+ o = document.cookie.split(";");
301
+ for (let n = 0; n < o.length; n++) {
302
+ let i = o[n];
303
+ for (; " " === i.charAt(0); ) i = i.substring(1);
304
+ if (0 === i.indexOf(s))
305
+ try {
306
+ let t;
307
+ (t = this.Ha
308
+ ? i.substring(s.length, i.length)
309
+ : JSON.parse(decodeURIComponent(i.substring(s.length, i.length)))),
310
+ e.push(t);
311
+ } catch (e) {
312
+ return (
313
+ r.D.info("Storage retrieval failure: " + e.message),
314
+ this.remove(t),
315
+ null
316
+ );
317
+ }
318
+ }
319
+ return e.length > 0 ? e[e.length - 1] : null;
320
+ }
321
+ remove(t) {
322
+ this.Xa(this.ka(t));
323
+ }
324
+ Xa(t) {
325
+ const e = t + "=;expires=" + new Date(0).toGMTString();
326
+ (document.cookie = e), (document.cookie = e + ";path=/");
327
+ const s = e + ";domain=" + this.Va;
328
+ (document.cookie = s), (document.cookie = s + ";path=/");
329
+ }
330
+ };
331
+ G.Oa = class {
332
+ constructor() {
333
+ (this.Za = {}), (this.$a = 5242880), (this.xa = 3);
334
+ }
335
+ store(t, e) {
336
+ const s = { value: e },
337
+ o = this.El(e);
338
+ return o > this.$a
339
+ ? (r.D.info(
340
+ "Storage failure: object is ≈" +
341
+ o +
342
+ " bytes which is greater than the max of " +
343
+ this.$a
344
+ ),
345
+ !1)
346
+ : ((this.Za[t] = s), !0);
347
+ }
348
+ El(t) {
349
+ const e = [],
350
+ s = [t];
351
+ let r = 0;
352
+ for (; s.length; ) {
353
+ const t = s.pop();
354
+ if ("boolean" == typeof t) r += 4;
355
+ else if ("string" == typeof t) r += 2 * t.length;
356
+ else if ("number" == typeof t) r += 8;
357
+ else if ("object" == typeof t && -1 === e.indexOf(t)) {
358
+ e.push(t);
359
+ for (let e in t) s.push(t[e]);
360
+ }
361
+ }
362
+ return r;
363
+ }
364
+ lr(t) {
365
+ const e = this.Za[t];
366
+ return null == e ? null : e.value;
367
+ }
368
+ remove(t) {
369
+ this.Za[t] = null;
370
+ }
371
+ };
372
+ G.wa = class {
373
+ constructor(t, e, s) {
374
+ (this.Sl = []),
375
+ e && this.Sl.push(new G.ne(t)),
376
+ s && this.Sl.push(new G._a(t)),
377
+ this.Sl.push(new G.Oa(t));
378
+ }
379
+ store(t, e) {
380
+ let s = !0;
381
+ for (let r = 0; r < this.Sl.length; r++) s = this.Sl[r].store(t, e) && s;
382
+ return s;
383
+ }
384
+ lr(t) {
385
+ for (let e = 0; e < this.Sl.length; e++) {
386
+ const s = this.Sl[e].lr(t);
387
+ if (null != s) return s;
388
+ }
389
+ return null;
390
+ }
391
+ remove(t) {
392
+ for (let e = 0; e < this.Sl.length; e++) this.Sl[e].remove(t);
393
+ }
394
+ };
@@ -1 +1,25 @@
1
- import r from"../../shared-lib/braze-shared-lib.js";export default class u{constructor(){this.De={}}ut(t){if("function"!=typeof t)return null;const i=r.it.nt();return this.De[i]=t,i}removeSubscription(t){delete this.De[t]}removeAllSubscriptions(){this.De={}}St(t){const i=[];for(let r in this.De)i.push(this.De[r](t));return i}}
1
+ import r from "../../shared-lib/braze-shared-lib.js";
2
+ export default class u {
3
+ constructor() {
4
+ this.Pe = {};
5
+ }
6
+ ut(t) {
7
+ if ("function" != typeof t) return null;
8
+ const i = r.it.nt();
9
+ return (this.Pe[i] = t), i;
10
+ }
11
+ removeSubscription(t) {
12
+ delete this.Pe[t];
13
+ }
14
+ removeAllSubscriptions() {
15
+ this.Pe = {};
16
+ }
17
+ bu() {
18
+ return Object.keys(this.Pe).length;
19
+ }
20
+ St(t) {
21
+ const i = [];
22
+ for (let r in this.Pe) i.push(this.Pe[r](t));
23
+ return i;
24
+ }
25
+ }
@@ -1 +1,8 @@
1
- export default{ua:"invalid_api_key",ca:"blacklisted",la:"no_device_identifier",ha:"invalid_json_response",oa:"empty_response",__:"sdk_auth_error"};
1
+ export default {
2
+ ma: "invalid_api_key",
3
+ pa: "blacklisted",
4
+ Ra: "no_device_identifier",
5
+ fa: "invalid_json_response",
6
+ la: "empty_response",
7
+ __: "sdk_auth_error"
8
+ };
@@ -1 +1,41 @@
1
- import{isObject as Jt}from"../util/code-utils.js";import{convertMsToSeconds as l,timestampOrNow as Vt}from"../util/date-utils.js";export default class ue{constructor(t,i,s,r,e){this.userId=t,this.type=i,this.time=Vt(s),this.sessionId=r,this.data=e}li(){const t={name:this.type,time:l(this.time),data:this.data||{},session_id:this.sessionId};return null!=this.userId&&(t.user_id=this.userId),t}ss(){return{u:this.userId,t:this.type,ts:this.time,s:this.sessionId,d:this.data}}static fromJson(t){return new ue(t.user_id,t.name,t.time,t.session_id,t.data)}static Ma(t){return null!=t&&Jt(t)&&null!=t.t&&""!==t.t}static yn(t){return new ue(t.u,t.t,t.ts,t.s,t.d)}}
1
+ import { isObject as Jt } from "../util/code-utils.js";
2
+ import {
3
+ convertMsToSeconds as l,
4
+ timestampOrNow as Vt
5
+ } from "../util/date-utils.js";
6
+ export default class ue {
7
+ constructor(t, i, s, r, e) {
8
+ (this.userId = t),
9
+ (this.type = i),
10
+ (this.time = Vt(s)),
11
+ (this.sessionId = r),
12
+ (this.data = e);
13
+ }
14
+ Mi() {
15
+ const t = {
16
+ name: this.type,
17
+ time: l(this.time),
18
+ data: this.data || {},
19
+ session_id: this.sessionId
20
+ };
21
+ return null != this.userId && (t.user_id = this.userId), t;
22
+ }
23
+ ss() {
24
+ return {
25
+ u: this.userId,
26
+ t: this.type,
27
+ ts: this.time,
28
+ s: this.sessionId,
29
+ d: this.data
30
+ };
31
+ }
32
+ static fromJson(t) {
33
+ return new ue(t.user_id, t.name, t.time, t.session_id, t.data);
34
+ }
35
+ static Fa(t) {
36
+ return null != t && Jt(t) && null != t.t && "" !== t.t;
37
+ }
38
+ static Dn(t) {
39
+ return new ue(t.u, t.t, t.ts, t.s, t.d);
40
+ }
41
+ }