@braze/web-sdk 4.7.2 → 4.8.1

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 (164) hide show
  1. package/index.d.ts +32 -26
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +5 -5
  4. package/shared-lib/encoding-utils.js +1 -1
  5. package/shared-lib/event-types.js +25 -25
  6. package/shared-lib/guid.js +3 -3
  7. package/shared-lib/indexed-db-adapter.js +74 -74
  8. package/shared-lib/logger.js +18 -18
  9. package/shared-lib/supported-options.js +18 -18
  10. package/src/Card/card-manager-factory.js +2 -2
  11. package/src/Card/card-manager.js +48 -42
  12. package/src/Card/display/card-display.js +70 -67
  13. package/src/Card/log-card-click.js +1 -1
  14. package/src/Card/log-card-dismissal.js +1 -1
  15. package/src/Card/log-card-impressions.js +3 -3
  16. package/src/Card/models/banner.js +3 -2
  17. package/src/Card/models/captioned-image.js +6 -5
  18. package/src/Card/models/card.js +107 -87
  19. package/src/Card/models/classic-card.js +5 -5
  20. package/src/Card/models/control-card.js +5 -21
  21. package/src/Card/types.js +1 -0
  22. package/src/Card/util/card-factory.js +32 -32
  23. package/src/ContentCards/content-cards-provider-factory.js +3 -3
  24. package/src/ContentCards/content-cards-provider.js +283 -175
  25. package/src/ContentCards/content-cards.js +2 -2
  26. package/src/ContentCards/get-cached-content-cards.js +1 -1
  27. package/src/ContentCards/log-content-cards-displayed.js +2 -2
  28. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  29. package/src/ContentCards/subscribe-to-content-cards-updates.js +9 -6
  30. package/src/ContentCards/types.js +1 -0
  31. package/src/ContentCards/ui/hide-content-cards.js +2 -2
  32. package/src/ContentCards/ui/show-content-cards.js +36 -34
  33. package/src/Core/add-sdk-metadata.js +17 -18
  34. package/src/Core/change-user.js +12 -14
  35. package/src/Core/destroy.js +1 -1
  36. package/src/Core/disable-sdk.js +8 -6
  37. package/src/Core/enable-sdk.js +4 -4
  38. package/src/Core/get-device-id.js +7 -6
  39. package/src/Core/get-user.js +1 -1
  40. package/src/Core/handle-braze-action.js +57 -40
  41. package/src/Core/is-disabled.js +2 -2
  42. package/src/Core/log-custom-event.js +22 -15
  43. package/src/Core/log-purchase.js +33 -33
  44. package/src/Core/open-session.js +17 -15
  45. package/src/Core/request-immediate-data-flush.js +4 -2
  46. package/src/Core/set-logger.js +1 -1
  47. package/src/Core/set-sdk-authentication-signature.js +5 -6
  48. package/src/Core/subscribe-to-sdk-authentication-failures.js +3 -1
  49. package/src/Core/toggle-logging.js +1 -1
  50. package/src/Core/types.js +1 -0
  51. package/src/Core/wipe-data.js +11 -10
  52. package/src/FeatureFlags/feature-flag-factory.js +6 -6
  53. package/src/FeatureFlags/feature-flag.js +17 -17
  54. package/src/FeatureFlags/feature-flags-provider-factory.js +2 -2
  55. package/src/FeatureFlags/feature-flags-provider.js +67 -65
  56. package/src/FeatureFlags/get-all-feature-flags.js +3 -3
  57. package/src/FeatureFlags/get-feature-flag.js +4 -4
  58. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -1
  59. package/src/Feed/feed-provider-factory.js +8 -8
  60. package/src/Feed/feed-provider.js +57 -46
  61. package/src/Feed/feed.js +1 -1
  62. package/src/Feed/get-cached-feed.js +2 -2
  63. package/src/Feed/log-feed-displayed.js +3 -1
  64. package/src/Feed/request-feed-refresh.js +2 -2
  65. package/src/Feed/subscribe-to-feed-updates.js +2 -2
  66. package/src/Feed/types.js +1 -0
  67. package/src/Feed/ui/hide-feed.js +2 -2
  68. package/src/Feed/ui/show-feed.js +41 -37
  69. package/src/InAppMessage/display/html-message-to-html.js +125 -119
  70. package/src/InAppMessage/display/in-app-message-to-html.js +72 -69
  71. package/src/InAppMessage/display/modal-utils.js +18 -13
  72. package/src/InAppMessage/in-app-message-factory.js +9 -8
  73. package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
  74. package/src/InAppMessage/in-app-message-manager.js +130 -110
  75. package/src/InAppMessage/log-in-app-message-button-click.js +10 -10
  76. package/src/InAppMessage/log-in-app-message-click.js +9 -9
  77. package/src/InAppMessage/log-in-app-message-html-click.js +10 -10
  78. package/src/InAppMessage/log-in-app-message-impression.js +5 -5
  79. package/src/InAppMessage/models/control-message.js +4 -1
  80. package/src/InAppMessage/models/full-screen-message.js +35 -37
  81. package/src/InAppMessage/models/html-message.js +34 -33
  82. package/src/InAppMessage/models/in-app-message-button.js +23 -16
  83. package/src/InAppMessage/models/in-app-message.js +147 -105
  84. package/src/InAppMessage/models/modal-message.js +34 -36
  85. package/src/InAppMessage/models/slide-up-message.js +25 -27
  86. package/src/InAppMessage/models/templated-in-app-message.js +12 -7
  87. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  88. package/src/InAppMessage/types.js +1 -0
  89. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +4 -4
  90. package/src/InAppMessage/ui/show-in-app-message.js +95 -89
  91. package/src/InAppMessage/utils/in-app-message-utils.js +1 -0
  92. package/src/Push/is-push-blocked.js +2 -2
  93. package/src/Push/is-push-permission-granted.js +2 -2
  94. package/src/Push/is-push-supported.js +2 -2
  95. package/src/Push/push-manager-factory.js +20 -20
  96. package/src/Push/push-manager.js +193 -174
  97. package/src/Push/request-push-permission.js +4 -3
  98. package/src/Push/types.js +1 -0
  99. package/src/Push/unregister-push.js +2 -2
  100. package/src/Push/utils/push-utils.js +10 -10
  101. package/src/User/types.js +1 -0
  102. package/src/User/user-manager.js +24 -24
  103. package/src/User/user.js +117 -105
  104. package/src/common/base-feed.js +7 -7
  105. package/src/common/base-provider.js +2 -2
  106. package/src/common/constants.js +6 -0
  107. package/src/common/event-logger.js +6 -6
  108. package/src/common/feed-display.js +95 -85
  109. package/src/common/types.js +1 -0
  110. package/src/l10n/l10n-manager-factory.js +10 -10
  111. package/src/l10n/l10n-manager.js +1 -1
  112. package/src/managers/auth-manager.js +37 -34
  113. package/src/managers/braze-instance.js +209 -193
  114. package/src/managers/device-manager.js +43 -38
  115. package/src/managers/network-manager.js +119 -96
  116. package/src/managers/server-config-manager.js +68 -48
  117. package/src/managers/session-manager.js +52 -45
  118. package/src/managers/storage-manager-factory.js +29 -22
  119. package/src/managers/storage-manager.js +288 -273
  120. package/src/managers/subscription-manager.js +9 -6
  121. package/src/managers/types.js +1 -0
  122. package/src/models/backend-errors.js +5 -5
  123. package/src/models/braze-event.js +14 -8
  124. package/src/models/device.js +10 -18
  125. package/src/models/identifier.js +10 -11
  126. package/src/models/push-token.js +17 -12
  127. package/src/models/request-result.js +4 -4
  128. package/src/models/server-config.js +36 -20
  129. package/src/models/types.js +1 -0
  130. package/src/request-controller.js +176 -174
  131. package/src/triggers/models/custom-event-data.js +6 -6
  132. package/src/triggers/models/custom-event-property-data.js +9 -9
  133. package/src/triggers/models/filter-set.js +9 -9
  134. package/src/triggers/models/filter.js +64 -64
  135. package/src/triggers/models/in-app-message-click-data.js +12 -12
  136. package/src/triggers/models/purchase-data.js +3 -3
  137. package/src/triggers/models/purchase-property-data.js +9 -9
  138. package/src/triggers/models/push-click-data.js +7 -7
  139. package/src/triggers/models/trigger-condition.js +57 -57
  140. package/src/triggers/models/trigger-events.js +2 -2
  141. package/src/triggers/models/trigger.js +42 -42
  142. package/src/triggers/triggers-provider-factory.js +8 -8
  143. package/src/triggers/triggers-provider.js +173 -170
  144. package/src/types.js +1 -0
  145. package/src/ui/js/attach-css.js +3 -3
  146. package/src/ui/js/load-font-awesome.js +2 -2
  147. package/src/util/base-device-parser.js +2 -2
  148. package/src/util/braze-actions.js +20 -20
  149. package/src/util/browser-detector.js +22 -22
  150. package/src/util/client-hints-parser.js +7 -7
  151. package/src/util/code-utils.js +1 -1
  152. package/src/util/color-utils.js +2 -2
  153. package/src/util/component-utils.js +2 -2
  154. package/src/util/deprecation-utils.js +1 -1
  155. package/src/util/device-constants.js +3 -3
  156. package/src/util/dom-utils.js +7 -7
  157. package/src/util/error-utils.js +2 -0
  158. package/src/util/key-codes.js +1 -1
  159. package/src/util/net.js +11 -11
  160. package/src/util/request-header-utils.js +23 -0
  161. package/src/util/string-utils.js +1 -1
  162. package/src/util/user-agent-parser.js +21 -21
  163. package/src/util/validation-utils.js +44 -44
  164. package/src/util/window-utils.js +3 -3
@@ -1,72 +1,74 @@
1
- import e, { OPTIONS as T } from "../../managers/braze-instance.js";
1
+ import e, { OPTIONS as L } from "../../managers/braze-instance.js";
2
2
  import { ContentCards, subscribeToContentCardsUpdates } from "../index.js";
3
3
  import g from "../content-cards-provider-factory.js";
4
4
  import {
5
- destroyFeedHtml as z,
5
+ destroyFeedHtml as k,
6
6
  detectFeedImpressions as q,
7
7
  feedToHtml as I,
8
- LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as L,
9
- refreshFeed as M,
10
- registerFeedSubscriptionId as $,
11
- updateFeedCards as k
8
+ LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as M,
9
+ refreshFeed as $,
10
+ registerFeedSubscriptionId as A,
11
+ updateFeedCards as B
12
12
  } from "../../common/feed-display.js";
13
- import { setCardHeight as A } from "../../Card/display/card-display.js";
14
- import { setupFeedUI as B } from "../../ui/js/index.js";
13
+ import { setCardHeight as F } from "../../Card/display/card-display.js";
14
+ import { setupFeedUI as G } from "../../ui/js/index.js";
15
15
  import r from "../../../shared-lib/braze-shared-lib.js";
16
16
  export function showContentCards(n, t) {
17
17
  if (!e.rr()) return;
18
- B();
18
+ G();
19
19
  let o = !1;
20
20
  null == n && ((n = document.body), (o = !0));
21
- const a = e.nn(T.tn) || e.nn(T.en) || !1;
22
- let i = g.er().Us(!1);
23
- "function" == typeof t && k(i, t(i.cards.slice()), i.lastUpdated, null, a);
24
- const s = I(i, a),
25
- f = g.er();
21
+ const a = e.nn(L.tn) || e.nn(L.en) || !1,
22
+ i = g.er().As(!1);
23
+ "function" == typeof t && B(i, t(i.cards.slice()), i.lastUpdated, null, a);
24
+ const s = I(i, a, o),
25
+ l = g.er(),
26
+ f = l.Vt();
26
27
  (null == i.lastUpdated ||
27
- new Date().valueOf() - i.lastUpdated.valueOf() > ContentCards.ur) &&
28
- (null == f.Ht() || new Date().valueOf() - f.Ht() > ContentCards.ur) &&
29
- (r.D.info(
30
- `Cached content cards were older than max TTL of ${ContentCards.ur} ms, requesting an update from the server.`
28
+ new Date().valueOf() - i.lastUpdated.valueOf() > ContentCards.mr) &&
29
+ (null == f || new Date().valueOf() - f > ContentCards.mr) &&
30
+ (r.j.info(
31
+ `Cached content cards were older than max TTL of ${ContentCards.mr} ms, requesting an update from the server.`
31
32
  ),
32
- M(i, s),
33
- f.Qt(new Date().valueOf()));
34
- const l = new Date().valueOf(),
35
- c = subscribeToContentCardsUpdates(function(n) {
33
+ $(i, s),
34
+ l.Wt(new Date().valueOf()));
35
+ const c = new Date().valueOf(),
36
+ u = subscribeToContentCardsUpdates(function(n) {
36
37
  const e = s.querySelectorAll(".ab-refresh-button")[0];
37
38
  if (null != e) {
38
- let n = 500;
39
- const t = parseInt(s.getAttribute(L));
40
- isNaN(t)
41
- ? (n -= new Date().valueOf() - l)
42
- : (n -= new Date().valueOf() - t),
39
+ let n = 500,
40
+ t = (n -= new Date().valueOf() - c);
41
+ const o = s.getAttribute(M);
42
+ o && ((t = parseInt(o)), isNaN(t) || (n -= new Date().valueOf() - t)),
43
43
  setTimeout(function() {
44
44
  e.className = e.className.replace(/fa-spin/g, "");
45
45
  }, Math.max(n, 0));
46
46
  }
47
47
  let o = n.cards;
48
48
  "function" == typeof t && (o = t(o.slice())),
49
- k(i, o, n.lastUpdated, s, a);
49
+ B(i, o, n.lastUpdated, s, a);
50
50
  });
51
- $(c, s);
52
- const u = function(n) {
51
+ A(u, s);
52
+ const d = function(n) {
53
53
  const t = n.querySelectorAll(".ab-feed");
54
54
  let e = null;
55
55
  for (let o = 0; o < t.length; o++) t[o].parentNode === n && (e = t[o]);
56
- null != e ? (z(e), e.parentNode.replaceChild(s, e)) : n.appendChild(s),
56
+ null != e
57
+ ? (k(e), null != e.parentNode && e.parentNode.replaceChild(s, e))
58
+ : n.appendChild(s),
57
59
  setTimeout(function() {
58
60
  s.className = s.className.replace("ab-hide", "ab-show");
59
61
  }, 0),
60
62
  o && s.focus(),
61
63
  q(i, s),
62
- A(i.cards, n);
64
+ F(i.cards, n);
63
65
  };
64
66
  var m;
65
67
  null != n
66
- ? u(n)
68
+ ? d(n)
67
69
  : (window.onload =
68
70
  ((m = window.onload),
69
71
  function() {
70
- "function" == typeof m && m(), u(document.body);
72
+ "function" == typeof m && m(new Event("oldLoad")), d(document.body);
71
73
  }));
72
74
  }
@@ -2,26 +2,25 @@ import K from "../managers/braze-instance.js";
2
2
  import BrazeSdkMetadata from "./braze-sdk-metadata.js";
3
3
  import {
4
4
  isArray as p,
5
- validateValueIsFromEnum as F
5
+ validateValueIsFromEnum as H
6
6
  } from "../util/code-utils.js";
7
7
  import r from "../../shared-lib/braze-shared-lib.js";
8
8
  export function addSdkMetadata(a) {
9
- if (K.rr()) {
10
- if (!p(a))
11
- return (
12
- r.D.error("Cannot set SDK metadata because metadata is not an array."),
13
- !1
14
- );
15
- for (const t of a)
16
- if (
17
- !F(
18
- BrazeSdkMetadata,
19
- t,
20
- "sdkMetadata contained an invalid value.",
21
- "BrazeSdkMetadata"
22
- )
9
+ if (!K.rr()) return;
10
+ if (!p(a))
11
+ return (
12
+ r.j.error("Cannot set SDK metadata because metadata is not an array."), !1
13
+ );
14
+ for (const t of a)
15
+ if (
16
+ !H(
17
+ BrazeSdkMetadata,
18
+ t,
19
+ "sdkMetadata contained an invalid value.",
20
+ "BrazeSdkMetadata"
23
21
  )
24
- return !1;
25
- return K.nr().addSdkMetadata(a), !0;
26
- }
22
+ )
23
+ return !1;
24
+ const t = K.ar();
25
+ return t && t.addSdkMetadata(a), !0;
27
26
  }
@@ -2,18 +2,16 @@ import e from "../managers/braze-instance.js";
2
2
  import { getByteLength as U } from "../util/string-utils.js";
3
3
  import r from "../../shared-lib/braze-shared-lib.js";
4
4
  import { User } from "../User/index.js";
5
- import { validateStandardString as R } from "../util/validation-utils.js";
6
- export function changeUser(s, i) {
7
- return (
8
- !!e.rr() &&
9
- (null == s || 0 === s.length || s != s
10
- ? (r.D.error("changeUser requires a non-empty userId."), !1)
11
- : U(s) > User.ee
12
- ? (r.D.error(
13
- `Rejected user id "${s}" because it is longer than ${User.ee} bytes.`
14
- ),
15
- !1)
16
- : !(null != i && !R(i, "set signature for new user", "signature")) &&
17
- void e.mr().changeUser(s.toString(), e.re(), i))
18
- );
5
+ import { validateStandardString as J } from "../util/validation-utils.js";
6
+ export function changeUser(i, t) {
7
+ if (!e.rr()) return;
8
+ if (null == i || 0 === i.length || i != i)
9
+ return void r.j.error("changeUser requires a non-empty userId.");
10
+ if (U(i) > User.lr)
11
+ return void r.j.error(
12
+ `Rejected user id "${i}" because it is longer than ${User.lr} bytes.`
13
+ );
14
+ if (null != t && !J(t, "set signature for new user", "signature")) return;
15
+ const s = e.cr();
16
+ s && s.changeUser(i.toString(), e.gr(), t);
19
17
  }
@@ -1,5 +1,5 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  import r from "../../shared-lib/braze-shared-lib.js";
3
3
  export function destroy() {
4
- r.D.info("Destroying Braze instance"), e.destroy(!0);
4
+ r.j.info("Destroying Braze instance"), e.destroy(!0);
5
5
  }
@@ -1,10 +1,12 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  import r from "../../shared-lib/braze-shared-lib.js";
3
- import G, { STORAGE_KEYS as o } from "../managers/storage-manager.js";
3
+ import O, { STORAGE_KEYS as i } from "../managers/storage-manager.js";
4
4
  export function disableSDK() {
5
- null != e.mr() && e.mr().requestImmediateDataFlush();
6
- const n = new G.ne(null, !0);
7
- n.store(o.ae, "This-cookie-will-expire-in-" + n.ie());
8
- const a = r.xt.Ft;
9
- new r.qt(a, r.D).setItem(a.$t.oe, a.se, !0), e.destroy(!1), e.le(!0);
5
+ const n = e.cr();
6
+ n && n.requestImmediateDataFlush();
7
+ const o = new O.ee(null, !0),
8
+ s = "This-cookie-will-expire-in-" + o.re();
9
+ o.store(i.ne, s);
10
+ const a = r.zt.Ft;
11
+ new r.xt(a, r.j).setItem(a.Jt.oe, a.se, !0), e.destroy(!1), e.ae(!0);
10
12
  }
@@ -1,8 +1,8 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  import r from "../../shared-lib/braze-shared-lib.js";
3
- import G, { STORAGE_KEYS as o } from "../managers/storage-manager.js";
3
+ import O, { STORAGE_KEYS as i } from "../managers/storage-manager.js";
4
4
  export function enableSDK() {
5
- new G.ne(null, !0).remove(o.ae);
6
- const a = r.xt.Ft;
7
- new r.qt(a, r.D).br(a.$t.oe, a.se), e.destroy(!1), e.le(!1);
5
+ new O.ee(null, !0).remove(i.ne);
6
+ const a = r.zt.Ft;
7
+ new r.xt(a, r.j).br(a.Jt.oe, a.se), e.destroy(!1), e.ae(!1);
8
8
  }
@@ -1,10 +1,11 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  import r from "../../shared-lib/braze-shared-lib.js";
3
3
  export function getDeviceId(i) {
4
- e.rr() &&
5
- (null == i &&
6
- r.D.error(
7
- "getDeviceId must be supplied with a callback. e.g., braze.getDeviceId(function(deviceId) {console.log('the device id is ' + deviceId)})"
8
- ),
9
- "function" == typeof i && i(e.ce().te().id));
4
+ if (!e.rr()) return;
5
+ null == i &&
6
+ r.j.error(
7
+ "getDeviceId must be supplied with a callback. e.g., braze.getDeviceId(function(deviceId) {console.log('the device id is ' + deviceId)})"
8
+ );
9
+ const t = e.ie();
10
+ "function" == typeof i && t && i(t.te().id);
10
11
  }
@@ -1,4 +1,4 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  export function getUser() {
3
- if (e.rr()) return e.gr();
3
+ if (e.rr()) return e.jr();
4
4
  }
@@ -1,70 +1,87 @@
1
1
  import r from "../../shared-lib/braze-shared-lib.js";
2
+ import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../common/constants.js";
2
3
  import e from "../managers/braze-instance.js";
3
4
  import {
4
- BRAZE_ACTIONS as P,
5
- getDecodedBrazeAction as _
5
+ BRAZE_ACTIONS as _,
6
+ getDecodedBrazeAction as Q
6
7
  } from "../util/braze-actions.js";
8
+ import V from "../util/browser-detector.js";
9
+ import { OperatingSystems as W } from "../util/device-constants.js";
7
10
  import {
8
- BRAZE_ACTION_URI_REGEX as J,
9
- isValidBrazeActionJson as O
11
+ BRAZE_ACTION_URI_REGEX as X,
12
+ isValidBrazeActionJson as Y
10
13
  } from "../util/validation-utils.js";
11
- import { WindowUtils as H } from "../util/window-utils.js";
12
- import { getUser as Q } from "./get-user.js";
13
- export function _handleBrazeAction(s, o, i) {
14
+ import { WindowUtils as Z } from "../util/window-utils.js";
15
+ import { getUser as ee } from "./get-user.js";
16
+ export function _handleBrazeAction(o, s, t) {
14
17
  if (e.rr())
15
- if (J.test(s)) {
16
- const e = _(s);
17
- if (!e) return;
18
- const o = e => {
19
- if (!O(e))
20
- return void r.D.error(
18
+ if (X.test(o)) {
19
+ const s = Q(o);
20
+ if (!s) return;
21
+ const t = o => {
22
+ if (!Y(o))
23
+ return void r.j.error(
21
24
  `Decoded Braze Action json is invalid: ${JSON.stringify(
22
- e,
25
+ o,
23
26
  null,
24
27
  2
25
28
  )}`
26
29
  );
27
- const s = e[P.properties.type];
28
- if (s === P.types.ue) for (const r of e[P.properties.me]) o(r);
29
- else {
30
- const o = e[P.properties.fe];
31
- let i;
32
- switch (s) {
33
- case P.types.logCustomEvent:
30
+ const s = _.properties.type,
31
+ i = _.properties.ce,
32
+ n = _.properties.me,
33
+ a = o[s];
34
+ if (a === _.types.le) {
35
+ const e = o[i];
36
+ for (const o of e) t(o);
37
+ } else {
38
+ const s = o[n];
39
+ let t, i;
40
+ switch (a) {
41
+ case _.types.logCustomEvent:
34
42
  import("./log-custom-event.js").then(
35
43
  ({ logCustomEvent: logCustomEvent }) => {
36
- logCustomEvent.apply(null, Array.prototype.slice.call(o));
44
+ e.ue()
45
+ ? ((i = Array.prototype.slice.call(s)),
46
+ logCustomEvent(...i))
47
+ : r.j.error(P);
37
48
  }
38
49
  );
39
50
  break;
40
- case P.types.requestPushPermission:
51
+ case _.types.requestPushPermission:
41
52
  import("../Push/request-push-permission.js").then(
42
53
  ({ requestPushPermission: requestPushPermission }) => {
43
- requestPushPermission();
54
+ e.ue()
55
+ ? "Safari" === V.browser && V.OS === W.fe
56
+ ? window.navigator.standalone && requestPushPermission()
57
+ : requestPushPermission()
58
+ : r.j.error(P);
44
59
  }
45
60
  );
46
61
  break;
47
- case P.types.setEmailNotificationSubscriptionType:
48
- case P.types.setPushNotificationSubscriptionType:
49
- case P.types.setCustomUserAttribute:
50
- case P.types.addToSubscriptionGroup:
51
- case P.types.removeFromSubscriptionGroup:
52
- case P.types.addToCustomAttributeArray:
53
- case P.types.removeFromCustomAttributeArray:
54
- (i = Q()), i[s].apply(i, Array.prototype.slice.call(o));
62
+ case _.types.setEmailNotificationSubscriptionType:
63
+ case _.types.setPushNotificationSubscriptionType:
64
+ case _.types.setCustomUserAttribute:
65
+ case _.types.addToSubscriptionGroup:
66
+ case _.types.removeFromSubscriptionGroup:
67
+ case _.types.addToCustomAttributeArray:
68
+ case _.types.removeFromCustomAttributeArray:
69
+ if (((t = ee()), t)) {
70
+ t[a](...Array.prototype.slice.call(s));
71
+ }
55
72
  break;
56
- case P.types.de:
57
- case P.types.pe:
58
- H.openUri.apply(null, Array.prototype.slice.call(o));
73
+ case _.types.de:
74
+ case _.types.pe:
75
+ (i = Array.prototype.slice.call(s)), Z.openUri(...i);
59
76
  break;
60
77
  default:
61
- r.D.info(`Ignoring unknown Braze Action: ${s}`);
78
+ r.j.info(`Ignoring unknown Braze Action: ${a}`);
62
79
  }
63
80
  }
64
81
  };
65
- o(e);
66
- } else H.openUri(s, i, o);
82
+ t(s);
83
+ } else Z.openUri(o, s, t);
67
84
  }
68
- export function handleBrazeAction(e, r) {
69
- _handleBrazeAction(e, r);
85
+ export function handleBrazeAction(e, o) {
86
+ _handleBrazeAction(e, o);
70
87
  }
@@ -1,4 +1,4 @@
1
- import G, { STORAGE_KEYS as o } from "../managers/storage-manager.js";
1
+ import O, { STORAGE_KEYS as i } from "../managers/storage-manager.js";
2
2
  export function isDisabled() {
3
- return !!new G.ne(null, !0).lr(o.ae);
3
+ return !!new O.ee(null, !0).wr(i.ne);
4
4
  }
@@ -1,31 +1,38 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  import s from "../common/event-logger.js";
3
3
  import r from "../../shared-lib/braze-shared-lib.js";
4
- import V from "../triggers/models/trigger-events.js";
5
- import { TriggersProviderFactory as W } from "../triggers/triggers-provider-factory.js";
4
+ import tt from "../triggers/models/trigger-events.js";
5
+ import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js";
6
6
  import {
7
- validateCustomProperties as X,
8
- validateCustomString as Y
7
+ validateCustomProperties as rt,
8
+ validateCustomString as ot
9
9
  } from "../util/validation-utils.js";
10
- import { LOG_CUSTOM_EVENT_STRING as Z } from "../common/constants.js";
10
+ import { LOG_CUSTOM_EVENT_STRING as nt } from "../common/constants.js";
11
11
  export function logCustomEvent(t, o) {
12
12
  if (!e.rr()) return !1;
13
13
  if (null == t || t.length <= 0)
14
14
  return (
15
- r.D.error(
15
+ r.j.error(
16
16
  `logCustomEvent requires a non-empty eventName, got "${t}". Ignoring event.`
17
17
  ),
18
18
  !1
19
19
  );
20
- if (!Y(t, "log custom event", "the event name")) return !1;
21
- const [n, i] = X(o, Z, "eventProperties", `log custom event "${t}"`, "event");
20
+ if (!ot(t, "log custom event", "the event name")) return !1;
21
+ const [n, i] = rt(
22
+ o,
23
+ nt,
24
+ "eventProperties",
25
+ `log custom event "${t}"`,
26
+ "event"
27
+ );
22
28
  if (!n) return !1;
23
- if (e.ir().ge(t))
24
- return r.D.info(`Custom Event "${t}" is blocklisted, ignoring.`), !1;
25
- const m = s.G(r.A.CustomEvent, { n: t, p: i });
26
- if (m.S) {
27
- r.D.info(`Logged custom event "${t}".`);
28
- for (const e of m.ve) W.er().je(V.be, [t, o], e);
29
+ const m = e.tr();
30
+ if (m && m.ge(t))
31
+ return r.j.info(`Custom Event "${t}" is blocklisted, ignoring.`), !1;
32
+ const g = s.N(r.q.CustomEvent, { n: t, p: i });
33
+ if (g.O) {
34
+ r.j.info(`Logged custom event "${t}".`);
35
+ for (const e of g.ve) et.er().je(tt.be, [t, o], e);
29
36
  }
30
- return m.S;
37
+ return g.O;
31
38
  }
@@ -1,47 +1,46 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  import { MAX_PURCHASE_QUANTITY as rr } from "../common/constants.js";
3
3
  import r from "../../shared-lib/braze-shared-lib.js";
4
- import V from "../triggers/models/trigger-events.js";
5
- import { TriggersProviderFactory as W } from "../triggers/triggers-provider-factory.js";
4
+ import tt from "../triggers/models/trigger-events.js";
5
+ import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js";
6
6
  import {
7
- validateCustomProperties as X,
8
- validateCustomString as Y
7
+ validateCustomProperties as rt,
8
+ validateCustomString as ot
9
9
  } from "../util/validation-utils.js";
10
10
  import s from "../common/event-logger.js";
11
- export function logPurchase(o, i, t, n, D) {
11
+ export function logPurchase(o, i, n, t, D) {
12
12
  if (!e.rr()) return !1;
13
13
  if (
14
- (null == t && (t = "USD"), null == n && (n = 1), null == o || o.length <= 0)
14
+ (null == n && (n = "USD"), null == t && (t = 1), null == o || o.length <= 0)
15
15
  )
16
16
  return (
17
- r.D.error(
17
+ r.j.error(
18
18
  `logPurchase requires a non-empty productId, got "${o}", ignoring.`
19
19
  ),
20
20
  !1
21
21
  );
22
- if (!Y(o, "log purchase", "the purchase name")) return !1;
23
- let a = parseFloat(i);
24
- if (isNaN(a))
22
+ if (!ot(o, "log purchase", "the purchase name")) return !1;
23
+ if (null == i || isNaN(parseFloat(i.toString())))
25
24
  return (
26
- r.D.error(`logPurchase requires a numeric price, got ${i}, ignoring.`), !1
25
+ r.j.error(`logPurchase requires a numeric price, got ${i}, ignoring.`), !1
27
26
  );
28
- a = a.toFixed(2);
29
- const g = parseInt(n);
30
- if (isNaN(g))
27
+ const a = parseFloat(i.toString()).toFixed(2);
28
+ if (null == t || isNaN(parseInt(t.toString())))
31
29
  return (
32
- r.D.error(
33
- `logPurchase requires an integer quantity, got ${n}, ignoring.`
30
+ r.j.error(
31
+ `logPurchase requires an integer quantity, got ${t}, ignoring.`
34
32
  ),
35
33
  !1
36
34
  );
37
- if (g < 1 || g > rr)
35
+ const u = parseInt(t.toString());
36
+ if (u < 1 || u > rr)
38
37
  return (
39
- r.D.error(
40
- `logPurchase requires a quantity >1 and <${rr}, got ${g}, ignoring.`
38
+ r.j.error(
39
+ `logPurchase requires a quantity >1 and <${rr}, got ${u}, ignoring.`
41
40
  ),
42
41
  !1
43
42
  );
44
- t = t.toUpperCase();
43
+ n = null != n ? n.toUpperCase() : n;
45
44
  if (
46
45
  -1 ===
47
46
  [
@@ -216,30 +215,31 @@ export function logPurchase(o, i, t, n, D) {
216
215
  "ZMK",
217
216
  "ZMW",
218
217
  "ZWL"
219
- ].indexOf(t)
218
+ ].indexOf(n)
220
219
  )
221
220
  return (
222
- r.D.error(
223
- `logPurchase requires a valid currencyCode, got ${t}, ignoring.`
221
+ r.j.error(
222
+ `logPurchase requires a valid currencyCode, got ${n}, ignoring.`
224
223
  ),
225
224
  !1
226
225
  );
227
- const [u, P] = X(
226
+ const [g, P] = rt(
228
227
  D,
229
228
  "logPurchase",
230
229
  "purchaseProperties",
231
230
  `log purchase "${o}"`,
232
231
  "purchase"
233
232
  );
234
- if (!u) return !1;
235
- if (e.ir().Dr(o))
236
- return r.D.info(`Purchase "${o}" is blocklisted, ignoring.`), !1;
237
- const R = s.G(r.A.Pr, { pid: o, c: t, p: a, q: g, pr: P });
238
- if (R.S) {
239
- r.D.info(
240
- `Logged ${g} purchase${g > 1 ? "s" : ""} of "${o}" for ${t} ${a}.`
233
+ if (!g) return !1;
234
+ const R = e.tr();
235
+ if (R && R.Dr(o))
236
+ return r.j.info(`Purchase "${o}" is blocklisted, ignoring.`), !1;
237
+ const c = s.N(r.q.Pr, { pid: o, c: n, p: a, q: u, pr: P });
238
+ if (c.O) {
239
+ r.j.info(
240
+ `Logged ${u} purchase${u > 1 ? "s" : ""} of "${o}" for ${n} ${a}.`
241
241
  );
242
- for (const r of R.ve) W.er().je(V.Rr, [o, D], r);
242
+ for (const r of c.ve) et.er().je(tt.Rr, [o, D], r);
243
243
  }
244
- return R.S;
244
+ return c.O;
245
245
  }
@@ -1,23 +1,25 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  import r from "../../shared-lib/braze-shared-lib.js";
3
- import V from "../triggers/models/trigger-events.js";
4
- import { TriggersProviderFactory as W } from "../triggers/triggers-provider-factory.js";
3
+ import tt from "../triggers/models/trigger-events.js";
4
+ import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js";
5
5
  export function openSession() {
6
6
  if (!e.rr()) return;
7
- e.mr().openSession();
8
- const i = r.xt.Ft,
9
- o = new r.qt(i, r.D);
10
- o.hr(i.$t.jr, function(t, n) {
11
- const s = n.lastClick,
12
- c = n.trackingString;
13
- r.D.info(`Firing push click trigger from ${c} push click at ${s}`);
14
- const g = e.mr().kr(s, c),
15
- f = function() {
16
- W.er().je(V.vr, [c], g);
7
+ const i = e.cr();
8
+ if (!i) return;
9
+ i.openSession();
10
+ const t = r.zt.Ft,
11
+ o = new r.xt(t, r.j);
12
+ o.hr(t.Jt.kr, function(n, e) {
13
+ const s = e.lastClick,
14
+ c = e.trackingString;
15
+ r.j.info(`Firing push click trigger from ${c} push click at ${s}`);
16
+ const f = i.vr(s, c),
17
+ g = function() {
18
+ et.er().je(tt.zr, [c], f);
17
19
  };
18
- e.mr().zr(f, f), o.br(i.$t.jr, t);
20
+ i.$r(g, g), o.br(t.Jt.kr, n);
19
21
  }),
20
- o.Jt(i.$t.$r, function(r) {
21
- e.mr().wr(r);
22
+ o.Mt(t.Jt.yr, function(r) {
23
+ i.Fr(r);
22
24
  });
23
25
  }
@@ -1,4 +1,6 @@
1
1
  import e from "../managers/braze-instance.js";
2
- export function requestImmediateDataFlush(a) {
3
- e.rr() && e.mr().requestImmediateDataFlush(a);
2
+ export function requestImmediateDataFlush(t) {
3
+ if (!e.rr()) return;
4
+ const r = e.cr();
5
+ r && r.requestImmediateDataFlush(t);
4
6
  }
@@ -1,4 +1,4 @@
1
1
  import r from "../../shared-lib/braze-shared-lib.js";
2
2
  export function setLogger(e) {
3
- r.D.setLogger(e);
3
+ r.j.setLogger(e);
4
4
  }
@@ -1,9 +1,8 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import { validateStandardString as R } from "../util/validation-utils.js";
2
+ import { validateStandardString as J } from "../util/validation-utils.js";
3
3
  export function setSdkAuthenticationSignature(t) {
4
- return (
5
- !!e.rr() &&
6
- !("" === t || !R(t, "set signature", "signature", !1)) &&
7
- (e.ii().setSdkAuthenticationSignature(t), !0)
8
- );
4
+ if (!e.rr()) return !1;
5
+ if ("" === t || !J(t, "set signature", "signature", !1)) return !1;
6
+ const r = e.Sr();
7
+ return !!r && (r.setSdkAuthenticationSignature(t), !0);
9
8
  }
@@ -1,4 +1,6 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  export function subscribeToSdkAuthenticationFailures(r) {
3
- if (e.rr()) return e.ii().subscribeToSdkAuthenticationFailures(r);
3
+ if (!e.rr()) return;
4
+ const n = e.Sr();
5
+ return n ? n.subscribeToSdkAuthenticationFailures(r) : void 0;
4
6
  }