@braze/web-sdk 4.10.1 → 4.10.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.
Files changed (203) hide show
  1. package/index.d.ts +9 -9
  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 +34 -1
  6. package/shared-lib/guid.js +10 -1
  7. package/shared-lib/index.js +6 -0
  8. package/shared-lib/indexed-db-adapter.js +352 -1
  9. package/shared-lib/logger.js +38 -1
  10. package/shared-lib/supported-options.js +27 -1
  11. package/shared-lib/types.js +1 -1
  12. package/src/Card/card-manager-factory.js +14 -1
  13. package/src/Card/card-manager.js +78 -1
  14. package/src/Card/display/card-display.js +138 -1
  15. package/src/Card/index.js +6 -1
  16. package/src/Card/log-card-click.js +11 -1
  17. package/src/Card/log-card-dismissal.js +11 -1
  18. package/src/Card/log-card-impressions.js +13 -1
  19. package/src/Card/log-content-card-click.js +4 -1
  20. package/src/Card/log-content-card-impressions.js +4 -1
  21. package/src/Card/models/banner.js +31 -1
  22. package/src/Card/models/captioned-image.js +33 -1
  23. package/src/Card/models/card.js +196 -1
  24. package/src/Card/models/classic-card.js +32 -1
  25. package/src/Card/models/control-card.js +23 -1
  26. package/src/Card/models/image-only.js +32 -1
  27. package/src/Card/models/index.js +6 -1
  28. package/src/Card/types.js +1 -1
  29. package/src/Card/util/card-factory.js +104 -1
  30. package/src/ContentCards/content-cards-provider-factory.js +20 -1
  31. package/src/ContentCards/content-cards-provider.js +391 -1
  32. package/src/ContentCards/content-cards.js +24 -1
  33. package/src/ContentCards/get-cached-content-cards.js +5 -1
  34. package/src/ContentCards/index.js +8 -1
  35. package/src/ContentCards/log-content-cards-displayed.js +5 -1
  36. package/src/ContentCards/request-content-cards-refresh.js +5 -1
  37. package/src/ContentCards/subscribe-to-content-cards-updates.js +17 -1
  38. package/src/ContentCards/types.js +1 -1
  39. package/src/ContentCards/ui/hide-content-cards.js +8 -1
  40. package/src/ContentCards/ui/show-content-cards.js +77 -1
  41. package/src/ContentCards/ui/toggle-content-cards.js +8 -1
  42. package/src/Core/add-sdk-metadata.js +26 -1
  43. package/src/Core/braze-sdk-metadata.js +10 -1
  44. package/src/Core/change-user.js +17 -1
  45. package/src/Core/destroy.js +5 -1
  46. package/src/Core/device-properties.js +9 -1
  47. package/src/Core/disable-sdk.js +15 -1
  48. package/src/Core/enable-sdk.js +11 -1
  49. package/src/Core/get-device-id.js +13 -1
  50. package/src/Core/get-user.js +4 -1
  51. package/src/Core/handle-braze-action.js +87 -1
  52. package/src/Core/index.js +23 -1
  53. package/src/Core/initialize.js +4 -1
  54. package/src/Core/is-disabled.js +4 -1
  55. package/src/Core/log-custom-event.js +38 -1
  56. package/src/Core/log-purchase.js +245 -1
  57. package/src/Core/open-session.js +25 -1
  58. package/src/Core/remove-all-subscriptions.js +4 -1
  59. package/src/Core/remove-subscription.js +4 -1
  60. package/src/Core/request-immediate-data-flush.js +6 -1
  61. package/src/Core/set-logger.js +4 -1
  62. package/src/Core/set-sdk-authentication-signature.js +8 -1
  63. package/src/Core/subscribe-to-sdk-authentication-failures.js +6 -1
  64. package/src/Core/toggle-logging.js +4 -1
  65. package/src/Core/types.js +1 -1
  66. package/src/Core/wipe-data.js +16 -1
  67. package/src/FeatureFlags/feature-flag-factory.js +24 -1
  68. package/src/FeatureFlags/feature-flag.js +64 -1
  69. package/src/FeatureFlags/feature-flags-provider-factory.js +19 -1
  70. package/src/FeatureFlags/feature-flags-provider.js +145 -1
  71. package/src/FeatureFlags/get-all-feature-flags.js +12 -1
  72. package/src/FeatureFlags/get-feature-flag.js +12 -1
  73. package/src/FeatureFlags/index.js +6 -1
  74. package/src/FeatureFlags/log-feature-flag-impression.js +23 -1
  75. package/src/FeatureFlags/refresh-feature-flags.js +9 -1
  76. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +9 -1
  77. package/src/FeatureFlags/types.js +1 -1
  78. package/src/Feed/feed-provider-factory.js +18 -1
  79. package/src/Feed/feed-provider.js +90 -1
  80. package/src/Feed/feed.js +20 -1
  81. package/src/Feed/get-cached-feed.js +5 -1
  82. package/src/Feed/index.js +8 -1
  83. package/src/Feed/log-feed-displayed.js +7 -1
  84. package/src/Feed/request-feed-refresh.js +5 -1
  85. package/src/Feed/subscribe-to-feed-updates.js +5 -1
  86. package/src/Feed/types.js +1 -1
  87. package/src/Feed/ui/hide-feed.js +7 -1
  88. package/src/Feed/ui/show-feed.js +96 -1
  89. package/src/Feed/ui/toggle-feed.js +8 -1
  90. package/src/InAppMessage/defer-in-app-message.js +13 -1
  91. package/src/InAppMessage/display/get-animation-effect.js +19 -1
  92. package/src/InAppMessage/display/html-message-to-html.js +244 -1
  93. package/src/InAppMessage/display/in-app-message-to-html.js +188 -1
  94. package/src/InAppMessage/display/modal-utils.js +73 -1
  95. package/src/InAppMessage/get-deferred-in-app-message.js +5 -1
  96. package/src/InAppMessage/in-app-message-factory.js +166 -1
  97. package/src/InAppMessage/in-app-message-manager-factory.js +16 -1
  98. package/src/InAppMessage/in-app-message-manager.js +248 -1
  99. package/src/InAppMessage/index.js +16 -1
  100. package/src/InAppMessage/log-in-app-message-button-click.js +27 -1
  101. package/src/InAppMessage/log-in-app-message-click.js +19 -1
  102. package/src/InAppMessage/log-in-app-message-html-click.js +23 -1
  103. package/src/InAppMessage/log-in-app-message-impression.js +13 -1
  104. package/src/InAppMessage/models/control-message.js +11 -1
  105. package/src/InAppMessage/models/full-screen-message.js +105 -1
  106. package/src/InAppMessage/models/html-message.js +68 -1
  107. package/src/InAppMessage/models/in-app-message-button.js +47 -1
  108. package/src/InAppMessage/models/in-app-message.js +382 -1
  109. package/src/InAppMessage/models/modal-message.js +101 -1
  110. package/src/InAppMessage/models/slide-up-message.js +84 -1
  111. package/src/InAppMessage/models/templated-in-app-message.js +19 -1
  112. package/src/InAppMessage/subscribe-to-in-app-message.js +10 -1
  113. package/src/InAppMessage/types.js +1 -1
  114. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +15 -1
  115. package/src/InAppMessage/ui/show-in-app-message.js +181 -1
  116. package/src/InAppMessage/utils/in-app-message-utils.js +1 -1
  117. package/src/Push/index.js +5 -1
  118. package/src/Push/is-push-blocked.js +5 -1
  119. package/src/Push/is-push-permission-granted.js +5 -1
  120. package/src/Push/is-push-supported.js +5 -1
  121. package/src/Push/push-manager-factory.js +30 -1
  122. package/src/Push/push-manager.js +387 -1
  123. package/src/Push/request-push-permission.js +9 -1
  124. package/src/Push/types.js +1 -1
  125. package/src/Push/unregister-push.js +5 -1
  126. package/src/Push/utils/push-utils.js +36 -1
  127. package/src/User/index.js +1 -1
  128. package/src/User/types.js +1 -1
  129. package/src/User/user-manager.js +73 -1
  130. package/src/User/user.js +302 -1
  131. package/src/common/base-feed.js +28 -1
  132. package/src/common/base-provider.js +6 -1
  133. package/src/common/constants.js +14 -1
  134. package/src/common/event-logger.js +31 -1
  135. package/src/common/feed-display.js +210 -1
  136. package/src/common/translations.js +148 -1
  137. package/src/common/types.js +1 -1
  138. package/src/index.js +9 -1
  139. package/src/l10n/l10n-manager-factory.js +22 -1
  140. package/src/l10n/l10n-manager.js +25 -1
  141. package/src/l10n/types.js +1 -1
  142. package/src/managers/auth-manager.js +51 -1
  143. package/src/managers/braze-instance.js +331 -1
  144. package/src/managers/device-manager.js +85 -1
  145. package/src/managers/network-manager.js +256 -1
  146. package/src/managers/server-config-manager.js +108 -1
  147. package/src/managers/session-manager.js +75 -1
  148. package/src/managers/storage-manager-factory.js +42 -1
  149. package/src/managers/storage-manager.js +419 -1
  150. package/src/managers/subscription-manager.js +28 -1
  151. package/src/managers/types.js +1 -1
  152. package/src/models/backend-errors.js +8 -1
  153. package/src/models/braze-event.js +47 -1
  154. package/src/models/braze-sdk-metadata.js +10 -1
  155. package/src/models/device.js +18 -1
  156. package/src/models/identifier.js +19 -1
  157. package/src/models/push-token.js +27 -1
  158. package/src/models/request-result.js +8 -1
  159. package/src/models/server-config.js +48 -1
  160. package/src/models/types.js +1 -1
  161. package/src/request-controller.js +311 -1
  162. package/src/triggers/models/custom-event-data.js +14 -1
  163. package/src/triggers/models/custom-event-property-data.js +21 -1
  164. package/src/triggers/models/filter-set.js +55 -1
  165. package/src/triggers/models/filter.js +102 -1
  166. package/src/triggers/models/in-app-message-click-data.js +25 -1
  167. package/src/triggers/models/purchase-data.js +14 -1
  168. package/src/triggers/models/purchase-property-data.js +21 -1
  169. package/src/triggers/models/push-click-data.js +15 -1
  170. package/src/triggers/models/trigger-condition.js +105 -1
  171. package/src/triggers/models/trigger-events.js +8 -1
  172. package/src/triggers/models/trigger.js +122 -1
  173. package/src/triggers/triggers-provider-factory.js +34 -1
  174. package/src/triggers/triggers-provider.js +326 -1
  175. package/src/triggers/types.js +1 -1
  176. package/src/types.js +1 -1
  177. package/src/ui/js/attach-css.js +13 -1
  178. package/src/ui/js/feed-css.js +12 -1
  179. package/src/ui/js/iam-css.js +12 -1
  180. package/src/ui/js/index.js +3 -1
  181. package/src/ui/js/load-font-awesome.js +13 -1
  182. package/src/util/base-device-parser.js +14 -1
  183. package/src/util/braze-actions.js +84 -1
  184. package/src/util/browser-detector.js +84 -1
  185. package/src/util/client-hints-parser.js +66 -1
  186. package/src/util/code-utils.js +100 -1
  187. package/src/util/color-utils.js +29 -1
  188. package/src/util/component-utils.js +26 -1
  189. package/src/util/date-utils.js +28 -1
  190. package/src/util/deprecation-utils.js +5 -1
  191. package/src/util/device-constants.js +14 -1
  192. package/src/util/dom-utils.js +91 -1
  193. package/src/util/error-utils.js +2 -1
  194. package/src/util/key-codes.js +1 -1
  195. package/src/util/math.js +5 -1
  196. package/src/util/net.js +71 -1
  197. package/src/util/request-header-utils.js +46 -1
  198. package/src/util/string-utils.js +22 -1
  199. package/src/util/types.js +1 -1
  200. package/src/util/url-utils.js +20 -1
  201. package/src/util/user-agent-parser.js +85 -1
  202. package/src/util/validation-utils.js +217 -1
  203. package/src/util/window-utils.js +34 -1
@@ -1 +1,77 @@
1
- import e,{OPTIONS as L}from"../../managers/braze-instance.js";import{ContentCards,subscribeToContentCardsUpdates}from"../index.js";import g from"../content-cards-provider-factory.js";import{destroyFeedHtml as k,detectFeedImpressions as q,feedToHtml as I,LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as M,refreshFeed as $,registerFeedSubscriptionId as A,updateFeedCards as B}from"../../common/feed-display.js";import{setCardHeight as F}from"../../Card/display/card-display.js";import{setupFeedUI as G}from"../../ui/js/index.js";import r from"../../../shared-lib/braze-shared-lib.js";export function showContentCards(n,t){if(!e.rr())return;G();let o=!1;null==n&&(n=document.body,o=!0);const a=e.nn(L.tn)||e.nn(L.en)||!1,i=g.er().Us(!1);"function"==typeof t&&B(i,t(i.cards.slice()),i.lastUpdated,null,a);const s=I(i,a,o),l=g.er(),f=l.Qt();(null==i.lastUpdated||(new Date).valueOf()-i.lastUpdated.valueOf()>ContentCards.mr)&&(null==f||(new Date).valueOf()-f>ContentCards.mr)&&(r.j.info(`Cached content cards were older than max TTL of ${ContentCards.mr} ms, requesting an update from the server.`),$(i,s),l.Vt((new Date).valueOf()));const c=(new Date).valueOf(),u=subscribeToContentCardsUpdates((function(n){const e=s.querySelectorAll(".ab-refresh-button")[0];if(null!=e){let n=500,t=n-=(new Date).valueOf()-c;const o=s.getAttribute(M);o&&(t=parseInt(o),isNaN(t)||(n-=(new Date).valueOf()-t)),setTimeout((function(){e.className=e.className.replace(/fa-spin/g,"")}),Math.max(n,0))}let o=n.cards;"function"==typeof t&&(o=t(o.slice())),B(i,o,n.lastUpdated,s,a)}));A(u,s);const d=function(n){const t=n.querySelectorAll(".ab-feed");let e=null;for(let o=0;o<t.length;o++)t[o].parentNode===n&&(e=t[o]);null!=e?(k(e),null!=e.parentNode&&e.parentNode.replaceChild(s,e)):n.appendChild(s),setTimeout((function(){s.className=s.className.replace("ab-hide","ab-show")}),0),o&&s.focus(),q(i,s),F(i.cards,n)};var m;null!=n?d(n):window.onload=(m=window.onload,function(){"function"==typeof m&&m(new Event("oldLoad")),d(document.body)})}
1
+ import e, { OPTIONS as L } from "../../managers/braze-instance.js";
2
+ import { ContentCards, subscribeToContentCardsUpdates } from "../index.js";
3
+ import g from "../content-cards-provider-factory.js";
4
+ import {
5
+ destroyFeedHtml as k,
6
+ detectFeedImpressions as q,
7
+ feedToHtml as I,
8
+ LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as M,
9
+ refreshFeed as $,
10
+ registerFeedSubscriptionId as A,
11
+ updateFeedCards as B,
12
+ } from "../../common/feed-display.js";
13
+ import { setCardHeight as F } from "../../Card/display/card-display.js";
14
+ import { setupFeedUI as G } from "../../ui/js/index.js";
15
+ import r from "../../../shared-lib/braze-shared-lib.js";
16
+ export function showContentCards(n, t) {
17
+ if (!e.rr()) return;
18
+ G();
19
+ let o = !1;
20
+ null == n && ((n = document.body), (o = !0));
21
+ const a = e.nn(L.tn) || e.nn(L.en) || !1,
22
+ i = g.er().Us(!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.Qt();
27
+ (null == i.lastUpdated ||
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.`,
32
+ ),
33
+ $(i, s),
34
+ l.Vt(new Date().valueOf()));
35
+ const c = new Date().valueOf(),
36
+ u = subscribeToContentCardsUpdates(function (n) {
37
+ const e = s.querySelectorAll(".ab-refresh-button")[0];
38
+ if (null != e) {
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
+ setTimeout(
44
+ function () {
45
+ e.className = e.className.replace(/fa-spin/g, "");
46
+ },
47
+ Math.max(n, 0),
48
+ );
49
+ }
50
+ let o = n.cards;
51
+ "function" == typeof t && (o = t(o.slice())),
52
+ B(i, o, n.lastUpdated, s, a);
53
+ });
54
+ A(u, s);
55
+ const d = function (n) {
56
+ const t = n.querySelectorAll(".ab-feed");
57
+ let e = null;
58
+ for (let o = 0; o < t.length; o++) t[o].parentNode === n && (e = t[o]);
59
+ null != e
60
+ ? (k(e), null != e.parentNode && e.parentNode.replaceChild(s, e))
61
+ : n.appendChild(s),
62
+ setTimeout(function () {
63
+ s.className = s.className.replace("ab-hide", "ab-show");
64
+ }, 0),
65
+ o && s.focus(),
66
+ q(i, s),
67
+ F(i.cards, n);
68
+ };
69
+ var m;
70
+ null != n
71
+ ? d(n)
72
+ : (window.onload =
73
+ ((m = window.onload),
74
+ function () {
75
+ "function" == typeof m && m(new Event("oldLoad")), d(document.body);
76
+ }));
77
+ }
@@ -1 +1,8 @@
1
- import e from"../../managers/braze-instance.js";import{hideContentCards,showContentCards}from"../index.js";export function toggleContentCards(n,o){e.rr()&&(document.querySelectorAll(".ab-feed").length>0?hideContentCards():showContentCards(n,o))}
1
+ import e from "../../managers/braze-instance.js";
2
+ import { hideContentCards, showContentCards } from "../index.js";
3
+ export function toggleContentCards(n, o) {
4
+ e.rr() &&
5
+ (document.querySelectorAll(".ab-feed").length > 0
6
+ ? hideContentCards()
7
+ : showContentCards(n, o));
8
+ }
@@ -1 +1,26 @@
1
- import K from"../managers/braze-instance.js";import BrazeSdkMetadata from"./braze-sdk-metadata.js";import{isArray as p,validateValueIsFromEnum as H}from"../util/code-utils.js";import r from"../../shared-lib/braze-shared-lib.js";export function addSdkMetadata(a){if(!K.rr())return;if(!p(a))return r.j.error("Cannot set SDK metadata because metadata is not an array."),!1;for(const t of a)if(!H(BrazeSdkMetadata,t,"sdkMetadata contained an invalid value.","BrazeSdkMetadata"))return!1;const t=K.ar();return t&&t.addSdkMetadata(a),!0}
1
+ import K from "../managers/braze-instance.js";
2
+ import BrazeSdkMetadata from "./braze-sdk-metadata.js";
3
+ import {
4
+ isArray as p,
5
+ validateValueIsFromEnum as H,
6
+ } from "../util/code-utils.js";
7
+ import r from "../../shared-lib/braze-shared-lib.js";
8
+ export function addSdkMetadata(a) {
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",
21
+ )
22
+ )
23
+ return !1;
24
+ const t = K.ar();
25
+ return t && t.addSdkMetadata(a), !0;
26
+ }
@@ -1 +1,10 @@
1
- export default{GOOGLE_TAG_MANAGER:"gg",MPARTICLE:"mp",SEGMENT:"sg",TEALIUM:"tl",MANUAL:"manu",NPM:"npm",CDN:"wcd",SHOPIFY:"shp"};
1
+ export default {
2
+ GOOGLE_TAG_MANAGER: "gg",
3
+ MPARTICLE: "mp",
4
+ SEGMENT: "sg",
5
+ TEALIUM: "tl",
6
+ MANUAL: "manu",
7
+ NPM: "npm",
8
+ CDN: "wcd",
9
+ SHOPIFY: "shp",
10
+ };
@@ -1 +1,17 @@
1
- import e from"../managers/braze-instance.js";import{getByteLength as U}from"../util/string-utils.js";import r from"../../shared-lib/braze-shared-lib.js";import{User}from"../User/index.js";import{validateStandardString as J}from"../util/validation-utils.js";export function changeUser(i,t){if(!e.rr())return;if(null==i||0===i.length||i!=i)return void r.j.error("changeUser requires a non-empty userId.");if(U(i)>User.lr)return void r.j.error(`Rejected user id "${i}" because it is longer than ${User.lr} bytes.`);if(null!=t&&!J(t,"set signature for new user","signature"))return;const s=e.cr();s&&s.changeUser(i.toString(),e.gr(),t)}
1
+ import e from "../managers/braze-instance.js";
2
+ import { getByteLength as U } from "../util/string-utils.js";
3
+ import r from "../../shared-lib/braze-shared-lib.js";
4
+ import { User } from "../User/index.js";
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);
17
+ }
@@ -1 +1,5 @@
1
- import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";export function destroy(){r.j.info("Destroying Braze instance"),e.destroy(!0)}
1
+ import e from "../managers/braze-instance.js";
2
+ import r from "../../shared-lib/braze-shared-lib.js";
3
+ export function destroy() {
4
+ r.j.info("Destroying Braze instance"), e.destroy(!0);
5
+ }
@@ -1 +1,9 @@
1
- export default{BROWSER:"browser",BROWSER_VERSION:"browserVersion",OS:"os",RESOLUTION:"resolution",LANGUAGE:"language",TIME_ZONE:"timeZone",USER_AGENT:"userAgent"};
1
+ export default {
2
+ BROWSER: "browser",
3
+ BROWSER_VERSION: "browserVersion",
4
+ OS: "os",
5
+ RESOLUTION: "resolution",
6
+ LANGUAGE: "language",
7
+ TIME_ZONE: "timeZone",
8
+ USER_AGENT: "userAgent",
9
+ };
@@ -1 +1,15 @@
1
- import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";import O,{STORAGE_KEYS as i}from"../managers/storage-manager.js";export function disableSDK(){const a=e.cr();a&&a.requestImmediateDataFlush();const s=new O.ee(null,!0),n="This-cookie-will-expire-in-"+s.ae();s.store(i.re,n);const o=r.zt.Ft;new r.xt(o,r.j).setItem(o.Jt.se,o.ie,!0),r.j.info("disableSDK was called"),e.destroy(!1),e.ne(!0)}
1
+ import e from "../managers/braze-instance.js";
2
+ import r from "../../shared-lib/braze-shared-lib.js";
3
+ import O, { STORAGE_KEYS as i } from "../managers/storage-manager.js";
4
+ export function disableSDK() {
5
+ const a = e.cr();
6
+ a && a.requestImmediateDataFlush();
7
+ const s = new O.ee(null, !0),
8
+ n = "This-cookie-will-expire-in-" + s.ae();
9
+ s.store(i.re, n);
10
+ const o = r.zt.Ft;
11
+ new r.xt(o, r.j).setItem(o.Jt.se, o.ie, !0),
12
+ r.j.info("disableSDK was called"),
13
+ e.destroy(!1),
14
+ e.ne(!0);
15
+ }
@@ -1 +1,11 @@
1
- import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";import O,{STORAGE_KEYS as i}from"../managers/storage-manager.js";export function enableSDK(){new O.ee(null,!0).remove(i.re);const a=r.zt.Ft;new r.xt(a,r.j).oe(a.Jt.se,a.ie),r.j.info("enableSDK was called"),e.destroy(!1),e.ne(!1)}
1
+ import e from "../managers/braze-instance.js";
2
+ import r from "../../shared-lib/braze-shared-lib.js";
3
+ import O, { STORAGE_KEYS as i } from "../managers/storage-manager.js";
4
+ export function enableSDK() {
5
+ new O.ee(null, !0).remove(i.re);
6
+ const a = r.zt.Ft;
7
+ new r.xt(a, r.j).oe(a.Jt.se, a.ie),
8
+ r.j.info("enableSDK was called"),
9
+ e.destroy(!1),
10
+ e.ne(!1);
11
+ }
@@ -1 +1,13 @@
1
- import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";export function getDeviceId(t){if(!e.rr())return;const i=e.te();if(!i)return;const c=i.ce().id;if("function"!=typeof t)return c;r.j.warn("The callback for getDeviceId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getDeviceId()`)"),t(c)}
1
+ import e from "../managers/braze-instance.js";
2
+ import r from "../../shared-lib/braze-shared-lib.js";
3
+ export function getDeviceId(t) {
4
+ if (!e.rr()) return;
5
+ const i = e.te();
6
+ if (!i) return;
7
+ const c = i.ce().id;
8
+ if ("function" != typeof t) return c;
9
+ r.j.warn(
10
+ "The callback for getDeviceId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getDeviceId()`)",
11
+ ),
12
+ t(c);
13
+ }
@@ -1 +1,4 @@
1
- import e from"../managers/braze-instance.js";export function getUser(){if(e.rr())return e.br()}
1
+ import e from "../managers/braze-instance.js";
2
+ export function getUser() {
3
+ if (e.rr()) return e.br();
4
+ }
@@ -1 +1,87 @@
1
- import r from"../../shared-lib/braze-shared-lib.js";import{BRAZE_MUST_BE_INITIALIZED_ERROR as P}from"../common/constants.js";import e from"../managers/braze-instance.js";import{BRAZE_ACTIONS as _,getDecodedBrazeAction as Q}from"../util/braze-actions.js";import V from"../util/browser-detector.js";import{OperatingSystems as W}from"../util/device-constants.js";import{BRAZE_ACTION_URI_REGEX as X,isValidBrazeActionJson as Y}from"../util/validation-utils.js";import{WindowUtils as Z}from"../util/window-utils.js";import{getUser as ee}from"./get-user.js";export function _handleBrazeAction(o,s,t){if(e.rr())if(X.test(o)){const s=Q(o);if(!s)return;const t=o=>{if(!Y(o))return void r.j.error(`Decoded Braze Action json is invalid: ${JSON.stringify(o,null,2)}`);const s=_.properties.type,i=_.properties.me,n=_.properties.le,a=o[s];if(a===_.types.ue){const e=o[i];for(const o of e)t(o)}else{const s=o[n];let t,i;switch(a){case _.types.logCustomEvent:import("./log-custom-event.js").then((({logCustomEvent:logCustomEvent})=>{e.fe()?(i=Array.prototype.slice.call(s),logCustomEvent(...i)):r.j.error(P)}));break;case _.types.requestPushPermission:import("../Push/request-push-permission.js").then((({requestPushPermission:requestPushPermission})=>{e.fe()?"Safari"===V.browser&&V.OS===W.de?window.navigator.standalone&&requestPushPermission():requestPushPermission():r.j.error(P)}));break;case _.types.setEmailNotificationSubscriptionType:case _.types.setPushNotificationSubscriptionType:case _.types.setCustomUserAttribute:case _.types.addToSubscriptionGroup:case _.types.removeFromSubscriptionGroup:case _.types.addToCustomAttributeArray:case _.types.removeFromCustomAttributeArray:if(t=ee(),t){t[a](...Array.prototype.slice.call(s))}break;case _.types.pe:case _.types.je:i=Array.prototype.slice.call(s),Z.openUri(...i);break;default:r.j.info(`Ignoring unknown Braze Action: ${a}`)}}};t(s)}else Z.openUri(o,s,t)}export function handleBrazeAction(e,o){_handleBrazeAction(e,o)}
1
+ import r from "../../shared-lib/braze-shared-lib.js";
2
+ import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../common/constants.js";
3
+ import e from "../managers/braze-instance.js";
4
+ import {
5
+ BRAZE_ACTIONS as _,
6
+ getDecodedBrazeAction as Q,
7
+ } from "../util/braze-actions.js";
8
+ import V from "../util/browser-detector.js";
9
+ import { OperatingSystems as W } from "../util/device-constants.js";
10
+ import {
11
+ BRAZE_ACTION_URI_REGEX as X,
12
+ isValidBrazeActionJson as Y,
13
+ } from "../util/validation-utils.js";
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) {
17
+ if (e.rr())
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(
24
+ `Decoded Braze Action json is invalid: ${JSON.stringify(
25
+ o,
26
+ null,
27
+ 2,
28
+ )}`,
29
+ );
30
+ const s = _.properties.type,
31
+ i = _.properties.me,
32
+ n = _.properties.le,
33
+ a = o[s];
34
+ if (a === _.types.ue) {
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:
42
+ import("./log-custom-event.js").then(
43
+ ({ logCustomEvent: logCustomEvent }) => {
44
+ e.fe()
45
+ ? ((i = Array.prototype.slice.call(s)),
46
+ logCustomEvent(...i))
47
+ : r.j.error(P);
48
+ },
49
+ );
50
+ break;
51
+ case _.types.requestPushPermission:
52
+ import("../Push/request-push-permission.js").then(
53
+ ({ requestPushPermission: requestPushPermission }) => {
54
+ e.fe()
55
+ ? "Safari" === V.browser && V.OS === W.de
56
+ ? window.navigator.standalone && requestPushPermission()
57
+ : requestPushPermission()
58
+ : r.j.error(P);
59
+ },
60
+ );
61
+ break;
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
+ }
72
+ break;
73
+ case _.types.pe:
74
+ case _.types.je:
75
+ (i = Array.prototype.slice.call(s)), Z.openUri(...i);
76
+ break;
77
+ default:
78
+ r.j.info(`Ignoring unknown Braze Action: ${a}`);
79
+ }
80
+ }
81
+ };
82
+ t(s);
83
+ } else Z.openUri(o, s, t);
84
+ }
85
+ export function handleBrazeAction(e, o) {
86
+ _handleBrazeAction(e, o);
87
+ }
package/src/Core/index.js CHANGED
@@ -1 +1,23 @@
1
- export{addSdkMetadata}from"./add-sdk-metadata.js";export{changeUser}from"./change-user.js";export{destroy}from"./destroy.js";export{default as BrazeSdkMetadata}from"./braze-sdk-metadata.js";export{default as DeviceProperties}from"./device-properties.js";export{disableSDK}from"./disable-sdk.js";export{enableSDK}from"./enable-sdk.js";export{getDeviceId}from"./get-device-id.js";export{getUser}from"./get-user.js";export{initialize}from"./initialize.js";export{isDisabled}from"./is-disabled.js";export{logCustomEvent}from"./log-custom-event.js";export{logPurchase}from"./log-purchase.js";export{openSession}from"./open-session.js";export{removeAllSubscriptions}from"./remove-all-subscriptions.js";export{removeSubscription}from"./remove-subscription.js";export{requestImmediateDataFlush}from"./request-immediate-data-flush.js";export{setLogger}from"./set-logger.js";export{setSdkAuthenticationSignature}from"./set-sdk-authentication-signature.js";export{subscribeToSdkAuthenticationFailures}from"./subscribe-to-sdk-authentication-failures.js";export{toggleLogging}from"./toggle-logging.js";export{wipeData}from"./wipe-data.js";export{handleBrazeAction}from"./handle-braze-action.js";
1
+ export { addSdkMetadata } from "./add-sdk-metadata.js";
2
+ export { changeUser } from "./change-user.js";
3
+ export { destroy } from "./destroy.js";
4
+ export { default as BrazeSdkMetadata } from "./braze-sdk-metadata.js";
5
+ export { default as DeviceProperties } from "./device-properties.js";
6
+ export { disableSDK } from "./disable-sdk.js";
7
+ export { enableSDK } from "./enable-sdk.js";
8
+ export { getDeviceId } from "./get-device-id.js";
9
+ export { getUser } from "./get-user.js";
10
+ export { initialize } from "./initialize.js";
11
+ export { isDisabled } from "./is-disabled.js";
12
+ export { logCustomEvent } from "./log-custom-event.js";
13
+ export { logPurchase } from "./log-purchase.js";
14
+ export { openSession } from "./open-session.js";
15
+ export { removeAllSubscriptions } from "./remove-all-subscriptions.js";
16
+ export { removeSubscription } from "./remove-subscription.js";
17
+ export { requestImmediateDataFlush } from "./request-immediate-data-flush.js";
18
+ export { setLogger } from "./set-logger.js";
19
+ export { setSdkAuthenticationSignature } from "./set-sdk-authentication-signature.js";
20
+ export { subscribeToSdkAuthenticationFailures } from "./subscribe-to-sdk-authentication-failures.js";
21
+ export { toggleLogging } from "./toggle-logging.js";
22
+ export { wipeData } from "./wipe-data.js";
23
+ export { handleBrazeAction } from "./handle-braze-action.js";
@@ -1 +1,4 @@
1
- import e from"../managers/braze-instance.js";export function initialize(i,n){return e.initialize(i,n)}
1
+ import e from "../managers/braze-instance.js";
2
+ export function initialize(i, n) {
3
+ return e.initialize(i, n);
4
+ }
@@ -1 +1,4 @@
1
- import O,{STORAGE_KEYS as i}from"../managers/storage-manager.js";export function isDisabled(){return!!new O.ee(null,!0).jr(i.re)}
1
+ import O, { STORAGE_KEYS as i } from "../managers/storage-manager.js";
2
+ export function isDisabled() {
3
+ return !!new O.ee(null, !0).jr(i.re);
4
+ }
@@ -1 +1,38 @@
1
- import e from"../managers/braze-instance.js";import s from"../common/event-logger.js";import r from"../../shared-lib/braze-shared-lib.js";import tt from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as et}from"../triggers/triggers-provider-factory.js";import{validateCustomProperties as rt,validateCustomString as ot}from"../util/validation-utils.js";import{LOG_CUSTOM_EVENT_STRING as nt}from"../common/constants.js";export function logCustomEvent(t,o){if(!e.rr())return!1;if(null==t||t.length<=0)return r.j.error(`logCustomEvent requires a non-empty eventName, got "${t}". Ignoring event.`),!1;if(!ot(t,"log custom event","the event name"))return!1;const[n,i]=rt(o,nt,"eventProperties",`log custom event "${t}"`,"event");if(!n)return!1;const m=e.tr();if(m&&m.ge(t))return r.j.info(`Custom Event "${t}" is blocklisted, ignoring.`),!1;const g=s.N(r.q.CustomEvent,{n:t,p:i});if(g.O){r.j.info(`Logged custom event "${t}".`);for(const e of g.ve)et.er().be(tt.$e,[t,o],e)}return g.O}
1
+ import e from "../managers/braze-instance.js";
2
+ import s from "../common/event-logger.js";
3
+ import r from "../../shared-lib/braze-shared-lib.js";
4
+ import tt from "../triggers/models/trigger-events.js";
5
+ import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js";
6
+ import {
7
+ validateCustomProperties as rt,
8
+ validateCustomString as ot,
9
+ } from "../util/validation-utils.js";
10
+ import { LOG_CUSTOM_EVENT_STRING as nt } from "../common/constants.js";
11
+ export function logCustomEvent(t, o) {
12
+ if (!e.rr()) return !1;
13
+ if (null == t || t.length <= 0)
14
+ return (
15
+ r.j.error(
16
+ `logCustomEvent requires a non-empty eventName, got "${t}". Ignoring event.`,
17
+ ),
18
+ !1
19
+ );
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
+ );
28
+ if (!n) return !1;
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().be(tt.$e, [t, o], e);
36
+ }
37
+ return g.O;
38
+ }
@@ -1 +1,245 @@
1
- import e from"../managers/braze-instance.js";import{MAX_PURCHASE_QUANTITY as rr}from"../common/constants.js";import r from"../../shared-lib/braze-shared-lib.js";import tt from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as et}from"../triggers/triggers-provider-factory.js";import{validateCustomProperties as rt,validateCustomString as ot}from"../util/validation-utils.js";import s from"../common/event-logger.js";export function logPurchase(o,i,n,t,D){if(!e.rr())return!1;if(null==n&&(n="USD"),null==t&&(t=1),null==o||o.length<=0)return r.j.error(`logPurchase requires a non-empty productId, got "${o}", ignoring.`),!1;if(!ot(o,"log purchase","the purchase name"))return!1;if(null==i||isNaN(parseFloat(i.toString())))return r.j.error(`logPurchase requires a numeric price, got ${i}, ignoring.`),!1;const a=parseFloat(i.toString()).toFixed(2);if(null==t||isNaN(parseInt(t.toString())))return r.j.error(`logPurchase requires an integer quantity, got ${t}, ignoring.`),!1;const u=parseInt(t.toString());if(u<1||u>rr)return r.j.error(`logPurchase requires a quantity >1 and <${rr}, got ${u}, ignoring.`),!1;n=null!=n?n.toUpperCase():n;if(-1===["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BRL","BSD","BTC","BTN","BWP","BYR","BZD","CAD","CDF","CHF","CLF","CLP","CNY","COP","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EEK","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GGP","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","IMP","INR","IQD","IRR","ISK","JEP","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MTL","MUR","MVR","MWK","MXN","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VEF","VND","VUV","WST","XAF","XAG","XAU","XCD","XDR","XOF","XPD","XPF","XPT","YER","ZAR","ZMK","ZMW","ZWL"].indexOf(n))return r.j.error(`logPurchase requires a valid currencyCode, got ${n}, ignoring.`),!1;const[g,P]=rt(D,"logPurchase","purchaseProperties",`log purchase "${o}"`,"purchase");if(!g)return!1;const R=e.tr();if(R&&R.Dr(o))return r.j.info(`Purchase "${o}" is blocklisted, ignoring.`),!1;const c=s.N(r.q.Pr,{pid:o,c:n,p:a,q:u,pr:P});if(c.O){r.j.info(`Logged ${u} purchase${u>1?"s":""} of "${o}" for ${n} ${a}.`);for(const r of c.ve)et.er().be(tt.Rr,[o,D],r)}return c.O}
1
+ import e from "../managers/braze-instance.js";
2
+ import { MAX_PURCHASE_QUANTITY as rr } from "../common/constants.js";
3
+ import r from "../../shared-lib/braze-shared-lib.js";
4
+ import tt from "../triggers/models/trigger-events.js";
5
+ import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js";
6
+ import {
7
+ validateCustomProperties as rt,
8
+ validateCustomString as ot,
9
+ } from "../util/validation-utils.js";
10
+ import s from "../common/event-logger.js";
11
+ export function logPurchase(o, i, n, t, D) {
12
+ if (!e.rr()) return !1;
13
+ if (
14
+ (null == n && (n = "USD"), null == t && (t = 1), null == o || o.length <= 0)
15
+ )
16
+ return (
17
+ r.j.error(
18
+ `logPurchase requires a non-empty productId, got "${o}", ignoring.`,
19
+ ),
20
+ !1
21
+ );
22
+ if (!ot(o, "log purchase", "the purchase name")) return !1;
23
+ if (null == i || isNaN(parseFloat(i.toString())))
24
+ return (
25
+ r.j.error(`logPurchase requires a numeric price, got ${i}, ignoring.`), !1
26
+ );
27
+ const a = parseFloat(i.toString()).toFixed(2);
28
+ if (null == t || isNaN(parseInt(t.toString())))
29
+ return (
30
+ r.j.error(
31
+ `logPurchase requires an integer quantity, got ${t}, ignoring.`,
32
+ ),
33
+ !1
34
+ );
35
+ const u = parseInt(t.toString());
36
+ if (u < 1 || u > rr)
37
+ return (
38
+ r.j.error(
39
+ `logPurchase requires a quantity >1 and <${rr}, got ${u}, ignoring.`,
40
+ ),
41
+ !1
42
+ );
43
+ n = null != n ? n.toUpperCase() : n;
44
+ if (
45
+ -1 ===
46
+ [
47
+ "AED",
48
+ "AFN",
49
+ "ALL",
50
+ "AMD",
51
+ "ANG",
52
+ "AOA",
53
+ "ARS",
54
+ "AUD",
55
+ "AWG",
56
+ "AZN",
57
+ "BAM",
58
+ "BBD",
59
+ "BDT",
60
+ "BGN",
61
+ "BHD",
62
+ "BIF",
63
+ "BMD",
64
+ "BND",
65
+ "BOB",
66
+ "BRL",
67
+ "BSD",
68
+ "BTC",
69
+ "BTN",
70
+ "BWP",
71
+ "BYR",
72
+ "BZD",
73
+ "CAD",
74
+ "CDF",
75
+ "CHF",
76
+ "CLF",
77
+ "CLP",
78
+ "CNY",
79
+ "COP",
80
+ "CRC",
81
+ "CUC",
82
+ "CUP",
83
+ "CVE",
84
+ "CZK",
85
+ "DJF",
86
+ "DKK",
87
+ "DOP",
88
+ "DZD",
89
+ "EEK",
90
+ "EGP",
91
+ "ERN",
92
+ "ETB",
93
+ "EUR",
94
+ "FJD",
95
+ "FKP",
96
+ "GBP",
97
+ "GEL",
98
+ "GGP",
99
+ "GHS",
100
+ "GIP",
101
+ "GMD",
102
+ "GNF",
103
+ "GTQ",
104
+ "GYD",
105
+ "HKD",
106
+ "HNL",
107
+ "HRK",
108
+ "HTG",
109
+ "HUF",
110
+ "IDR",
111
+ "ILS",
112
+ "IMP",
113
+ "INR",
114
+ "IQD",
115
+ "IRR",
116
+ "ISK",
117
+ "JEP",
118
+ "JMD",
119
+ "JOD",
120
+ "JPY",
121
+ "KES",
122
+ "KGS",
123
+ "KHR",
124
+ "KMF",
125
+ "KPW",
126
+ "KRW",
127
+ "KWD",
128
+ "KYD",
129
+ "KZT",
130
+ "LAK",
131
+ "LBP",
132
+ "LKR",
133
+ "LRD",
134
+ "LSL",
135
+ "LTL",
136
+ "LVL",
137
+ "LYD",
138
+ "MAD",
139
+ "MDL",
140
+ "MGA",
141
+ "MKD",
142
+ "MMK",
143
+ "MNT",
144
+ "MOP",
145
+ "MRO",
146
+ "MTL",
147
+ "MUR",
148
+ "MVR",
149
+ "MWK",
150
+ "MXN",
151
+ "MYR",
152
+ "MZN",
153
+ "NAD",
154
+ "NGN",
155
+ "NIO",
156
+ "NOK",
157
+ "NPR",
158
+ "NZD",
159
+ "OMR",
160
+ "PAB",
161
+ "PEN",
162
+ "PGK",
163
+ "PHP",
164
+ "PKR",
165
+ "PLN",
166
+ "PYG",
167
+ "QAR",
168
+ "RON",
169
+ "RSD",
170
+ "RUB",
171
+ "RWF",
172
+ "SAR",
173
+ "SBD",
174
+ "SCR",
175
+ "SDG",
176
+ "SEK",
177
+ "SGD",
178
+ "SHP",
179
+ "SLL",
180
+ "SOS",
181
+ "SRD",
182
+ "STD",
183
+ "SVC",
184
+ "SYP",
185
+ "SZL",
186
+ "THB",
187
+ "TJS",
188
+ "TMT",
189
+ "TND",
190
+ "TOP",
191
+ "TRY",
192
+ "TTD",
193
+ "TWD",
194
+ "TZS",
195
+ "UAH",
196
+ "UGX",
197
+ "USD",
198
+ "UYU",
199
+ "UZS",
200
+ "VEF",
201
+ "VND",
202
+ "VUV",
203
+ "WST",
204
+ "XAF",
205
+ "XAG",
206
+ "XAU",
207
+ "XCD",
208
+ "XDR",
209
+ "XOF",
210
+ "XPD",
211
+ "XPF",
212
+ "XPT",
213
+ "YER",
214
+ "ZAR",
215
+ "ZMK",
216
+ "ZMW",
217
+ "ZWL",
218
+ ].indexOf(n)
219
+ )
220
+ return (
221
+ r.j.error(
222
+ `logPurchase requires a valid currencyCode, got ${n}, ignoring.`,
223
+ ),
224
+ !1
225
+ );
226
+ const [g, P] = rt(
227
+ D,
228
+ "logPurchase",
229
+ "purchaseProperties",
230
+ `log purchase "${o}"`,
231
+ "purchase",
232
+ );
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
+ );
242
+ for (const r of c.ve) et.er().be(tt.Rr, [o, D], r);
243
+ }
244
+ return c.O;
245
+ }