@braze/web-sdk 4.10.1 → 5.0.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 (202) hide show
  1. package/index.d.ts +26 -111
  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/indexed-db-adapter.js +352 -1
  8. package/shared-lib/logger.js +38 -1
  9. package/shared-lib/supported-options.js +26 -1
  10. package/shared-lib/types.js +1 -1
  11. package/src/Card/card-manager-factory.js +14 -1
  12. package/src/Card/card-manager.js +78 -1
  13. package/src/Card/display/card-display.js +138 -1
  14. package/src/Card/index.js +6 -1
  15. package/src/Card/log-card-click.js +11 -1
  16. package/src/Card/log-card-dismissal.js +11 -1
  17. package/src/Card/log-card-impressions.js +13 -1
  18. package/src/Card/log-content-card-click.js +4 -1
  19. package/src/Card/log-content-card-impressions.js +4 -1
  20. package/src/Card/models/captioned-image.js +33 -1
  21. package/src/Card/models/card.js +197 -1
  22. package/src/Card/models/classic-card.js +32 -1
  23. package/src/Card/models/control-card.js +23 -1
  24. package/src/Card/models/image-only.js +31 -1
  25. package/src/Card/models/index.js +5 -1
  26. package/src/Card/types.js +1 -1
  27. package/src/Card/util/card-factory.js +104 -1
  28. package/src/ContentCards/content-cards-provider-factory.js +20 -1
  29. package/src/ContentCards/content-cards-provider.js +391 -1
  30. package/src/ContentCards/content-cards.js +24 -1
  31. package/src/ContentCards/get-cached-content-cards.js +5 -1
  32. package/src/ContentCards/index.js +7 -1
  33. package/src/ContentCards/request-content-cards-refresh.js +5 -1
  34. package/src/ContentCards/subscribe-to-content-cards-updates.js +17 -1
  35. package/src/ContentCards/types.js +1 -1
  36. package/src/ContentCards/ui/hide-content-cards.js +8 -1
  37. package/src/ContentCards/ui/show-content-cards.js +77 -1
  38. package/src/ContentCards/ui/toggle-content-cards.js +8 -1
  39. package/src/Core/add-sdk-metadata.js +26 -1
  40. package/src/Core/braze-sdk-metadata.js +10 -1
  41. package/src/Core/change-user.js +17 -1
  42. package/src/Core/destroy.js +5 -1
  43. package/src/Core/device-properties.js +9 -1
  44. package/src/Core/disable-sdk.js +15 -1
  45. package/src/Core/enable-sdk.js +11 -1
  46. package/src/Core/get-device-id.js +13 -1
  47. package/src/Core/get-user.js +4 -1
  48. package/src/Core/handle-braze-action.js +87 -1
  49. package/src/Core/index.js +23 -1
  50. package/src/Core/initialize.js +4 -1
  51. package/src/Core/is-disabled.js +4 -1
  52. package/src/Core/log-custom-event.js +38 -1
  53. package/src/Core/log-purchase.js +245 -1
  54. package/src/Core/open-session.js +25 -1
  55. package/src/Core/remove-all-subscriptions.js +4 -1
  56. package/src/Core/remove-subscription.js +4 -1
  57. package/src/Core/request-immediate-data-flush.js +6 -1
  58. package/src/Core/set-logger.js +4 -1
  59. package/src/Core/set-sdk-authentication-signature.js +8 -1
  60. package/src/Core/subscribe-to-sdk-authentication-failures.js +6 -1
  61. package/src/Core/toggle-logging.js +4 -1
  62. package/src/Core/types.js +1 -1
  63. package/src/Core/wipe-data.js +16 -1
  64. package/src/FeatureFlags/feature-flag-factory.js +24 -1
  65. package/src/FeatureFlags/feature-flag.js +64 -1
  66. package/src/FeatureFlags/feature-flags-provider-factory.js +19 -1
  67. package/src/FeatureFlags/feature-flags-provider.js +145 -1
  68. package/src/FeatureFlags/get-all-feature-flags.js +12 -1
  69. package/src/FeatureFlags/get-feature-flag.js +10 -1
  70. package/src/FeatureFlags/index.js +6 -1
  71. package/src/FeatureFlags/log-feature-flag-impression.js +23 -1
  72. package/src/FeatureFlags/refresh-feature-flags.js +9 -1
  73. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +9 -1
  74. package/src/FeatureFlags/types.js +1 -1
  75. package/src/Feed/feed-provider-factory.js +18 -1
  76. package/src/Feed/feed-provider.js +90 -1
  77. package/src/Feed/feed.js +20 -1
  78. package/src/Feed/get-cached-feed.js +5 -1
  79. package/src/Feed/index.js +8 -1
  80. package/src/Feed/log-feed-displayed.js +7 -1
  81. package/src/Feed/request-feed-refresh.js +5 -1
  82. package/src/Feed/subscribe-to-feed-updates.js +5 -1
  83. package/src/Feed/types.js +1 -1
  84. package/src/Feed/ui/hide-feed.js +7 -1
  85. package/src/Feed/ui/show-feed.js +96 -1
  86. package/src/Feed/ui/toggle-feed.js +8 -1
  87. package/src/InAppMessage/defer-in-app-message.js +13 -1
  88. package/src/InAppMessage/display/get-animation-effect.js +19 -1
  89. package/src/InAppMessage/display/html-message-to-html.js +243 -1
  90. package/src/InAppMessage/display/in-app-message-to-html.js +188 -1
  91. package/src/InAppMessage/display/modal-utils.js +73 -1
  92. package/src/InAppMessage/get-deferred-in-app-message.js +5 -1
  93. package/src/InAppMessage/in-app-message-factory.js +166 -1
  94. package/src/InAppMessage/in-app-message-manager-factory.js +16 -1
  95. package/src/InAppMessage/in-app-message-manager.js +248 -1
  96. package/src/InAppMessage/index.js +16 -1
  97. package/src/InAppMessage/log-in-app-message-button-click.js +27 -1
  98. package/src/InAppMessage/log-in-app-message-click.js +19 -1
  99. package/src/InAppMessage/log-in-app-message-html-click.js +23 -1
  100. package/src/InAppMessage/log-in-app-message-impression.js +13 -1
  101. package/src/InAppMessage/models/control-message.js +11 -1
  102. package/src/InAppMessage/models/full-screen-message.js +105 -1
  103. package/src/InAppMessage/models/html-message.js +68 -1
  104. package/src/InAppMessage/models/in-app-message-button.js +47 -1
  105. package/src/InAppMessage/models/in-app-message.js +382 -1
  106. package/src/InAppMessage/models/modal-message.js +101 -1
  107. package/src/InAppMessage/models/slide-up-message.js +84 -1
  108. package/src/InAppMessage/models/templated-in-app-message.js +19 -1
  109. package/src/InAppMessage/subscribe-to-in-app-message.js +10 -1
  110. package/src/InAppMessage/types.js +1 -1
  111. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +15 -1
  112. package/src/InAppMessage/ui/show-in-app-message.js +181 -1
  113. package/src/InAppMessage/utils/in-app-message-utils.js +1 -1
  114. package/src/Push/index.js +5 -1
  115. package/src/Push/is-push-blocked.js +5 -1
  116. package/src/Push/is-push-permission-granted.js +5 -1
  117. package/src/Push/is-push-supported.js +5 -1
  118. package/src/Push/push-manager-factory.js +30 -1
  119. package/src/Push/push-manager.js +387 -1
  120. package/src/Push/request-push-permission.js +9 -1
  121. package/src/Push/types.js +1 -1
  122. package/src/Push/unregister-push.js +5 -1
  123. package/src/Push/utils/push-utils.js +36 -1
  124. package/src/User/index.js +1 -1
  125. package/src/User/types.js +1 -1
  126. package/src/User/user-manager.js +73 -1
  127. package/src/User/user.js +302 -1
  128. package/src/common/base-feed.js +29 -1
  129. package/src/common/base-provider.js +6 -1
  130. package/src/common/constants.js +14 -1
  131. package/src/common/event-logger.js +31 -1
  132. package/src/common/feed-display.js +210 -1
  133. package/src/common/translations.js +148 -1
  134. package/src/common/types.js +1 -1
  135. package/src/index.js +9 -1
  136. package/src/l10n/l10n-manager-factory.js +22 -1
  137. package/src/l10n/l10n-manager.js +25 -1
  138. package/src/l10n/types.js +1 -1
  139. package/src/managers/auth-manager.js +51 -1
  140. package/src/managers/braze-instance.js +322 -1
  141. package/src/managers/device-manager.js +85 -1
  142. package/src/managers/network-manager.js +256 -1
  143. package/src/managers/server-config-manager.js +108 -1
  144. package/src/managers/session-manager.js +75 -1
  145. package/src/managers/storage-manager-factory.js +42 -1
  146. package/src/managers/storage-manager.js +426 -1
  147. package/src/managers/subscription-manager.js +28 -1
  148. package/src/managers/types.js +1 -1
  149. package/src/models/backend-errors.js +8 -1
  150. package/src/models/braze-event.js +47 -1
  151. package/src/models/braze-sdk-metadata.js +10 -1
  152. package/src/models/device.js +18 -1
  153. package/src/models/identifier.js +19 -1
  154. package/src/models/push-token.js +27 -1
  155. package/src/models/request-result.js +8 -1
  156. package/src/models/server-config.js +48 -1
  157. package/src/models/types.js +1 -1
  158. package/src/request-controller.js +311 -1
  159. package/src/triggers/models/custom-event-data.js +14 -1
  160. package/src/triggers/models/custom-event-property-data.js +21 -1
  161. package/src/triggers/models/filter-set.js +55 -1
  162. package/src/triggers/models/filter.js +102 -1
  163. package/src/triggers/models/in-app-message-click-data.js +25 -1
  164. package/src/triggers/models/purchase-data.js +14 -1
  165. package/src/triggers/models/purchase-property-data.js +21 -1
  166. package/src/triggers/models/push-click-data.js +15 -1
  167. package/src/triggers/models/trigger-condition.js +105 -1
  168. package/src/triggers/models/trigger-events.js +8 -1
  169. package/src/triggers/models/trigger.js +122 -1
  170. package/src/triggers/triggers-provider-factory.js +34 -1
  171. package/src/triggers/triggers-provider.js +326 -1
  172. package/src/triggers/types.js +1 -1
  173. package/src/types.js +1 -1
  174. package/src/ui/js/attach-css.js +13 -1
  175. package/src/ui/js/feed-css.js +12 -1
  176. package/src/ui/js/iam-css.js +12 -1
  177. package/src/ui/js/index.js +3 -1
  178. package/src/ui/js/load-font-awesome.js +13 -1
  179. package/src/util/base-device-parser.js +14 -1
  180. package/src/util/braze-actions.js +84 -1
  181. package/src/util/browser-detector.js +84 -1
  182. package/src/util/client-hints-parser.js +66 -1
  183. package/src/util/code-utils.js +100 -1
  184. package/src/util/color-utils.js +29 -1
  185. package/src/util/component-utils.js +26 -1
  186. package/src/util/date-utils.js +28 -1
  187. package/src/util/deprecation-utils.js +5 -1
  188. package/src/util/device-constants.js +13 -1
  189. package/src/util/dom-utils.js +91 -1
  190. package/src/util/error-utils.js +2 -1
  191. package/src/util/key-codes.js +1 -1
  192. package/src/util/math.js +5 -1
  193. package/src/util/net.js +71 -1
  194. package/src/util/request-header-utils.js +46 -1
  195. package/src/util/string-utils.js +22 -1
  196. package/src/util/types.js +1 -1
  197. package/src/util/url-utils.js +20 -1
  198. package/src/util/user-agent-parser.js +80 -1
  199. package/src/util/validation-utils.js +217 -1
  200. package/src/util/window-utils.js +34 -1
  201. package/src/Card/models/banner.js +0 -1
  202. package/src/ContentCards/log-content-cards-displayed.js +0 -1
@@ -1 +1,64 @@
1
- import r from"../../shared-lib/braze-shared-lib.js";export default class FeatureFlag{constructor(t,r=!1,e={},s){this.id=t,this.enabled=r,this.properties=e,this.trackingString=s,this.id=t,this.enabled=r,this.properties=e,this.trackingString=s}getStringProperty(t){const r=this.properties[t];return null==r?(this.Er(t),null):this.Ir(r)?r.value:(this.Nr("string"),null)}getNumberProperty(t){const r=this.properties[t];return null==r?(this.Er(t),null):this.Tr(r)?r.value:(this.Nr("number"),null)}getBooleanProperty(t){const r=this.properties[t];return null==r?(this.Er(t),null):this.Ar(r)?r.value:(this.Nr("boolean"),null)}ss(){const t={};return t[FeatureFlag.hs.ns]=this.id,t[FeatureFlag.hs.Fe]=this.enabled,t[FeatureFlag.hs.we]=this.properties,t[FeatureFlag.hs.ze]=this.trackingString,t}Nr(t){r.j.info(`Property is not of type ${t}.`)}Er(t){r.j.info(`${t} not found in feature flag properties.`)}Ir(t){return"string"===t.type&&"string"==typeof t.value}Tr(t){return"number"===t.type&&"number"==typeof t.value}Ar(t){return"boolean"===t.type&&"boolean"==typeof t.value}}FeatureFlag.hs={ns:"id",Fe:"e",we:"pr",ze:"fts"},FeatureFlag.Tt={ns:"id",Fe:"enabled",we:"properties",ze:"fts"};
1
+ import r from "../../shared-lib/braze-shared-lib.js";
2
+ export default class FeatureFlag {
3
+ constructor(t, r = !1, e = {}, s) {
4
+ (this.id = t),
5
+ (this.enabled = r),
6
+ (this.properties = e),
7
+ (this.trackingString = s),
8
+ (this.id = t),
9
+ (this.enabled = r),
10
+ (this.properties = e),
11
+ (this.trackingString = s);
12
+ }
13
+ getStringProperty(t) {
14
+ const r = this.properties[t];
15
+ return null == r
16
+ ? (this.Er(t), null)
17
+ : this.Ir(r)
18
+ ? r.value
19
+ : (this.Nr("string"), null);
20
+ }
21
+ getNumberProperty(t) {
22
+ const r = this.properties[t];
23
+ return null == r
24
+ ? (this.Er(t), null)
25
+ : this.Tr(r)
26
+ ? r.value
27
+ : (this.Nr("number"), null);
28
+ }
29
+ getBooleanProperty(t) {
30
+ const r = this.properties[t];
31
+ return null == r
32
+ ? (this.Er(t), null)
33
+ : this.Ar(r)
34
+ ? r.value
35
+ : (this.Nr("boolean"), null);
36
+ }
37
+ tt() {
38
+ const t = {};
39
+ return (
40
+ (t[FeatureFlag.it.rt] = this.id),
41
+ (t[FeatureFlag.it.Fe] = this.enabled),
42
+ (t[FeatureFlag.it.we] = this.properties),
43
+ (t[FeatureFlag.it.ze] = this.trackingString),
44
+ t
45
+ );
46
+ }
47
+ Nr(t) {
48
+ r.j.info(`Property is not of type ${t}.`);
49
+ }
50
+ Er(t) {
51
+ r.j.info(`${t} not found in feature flag properties.`);
52
+ }
53
+ Ir(t) {
54
+ return "string" === t.type && "string" == typeof t.value;
55
+ }
56
+ Tr(t) {
57
+ return "number" === t.type && "number" == typeof t.value;
58
+ }
59
+ Ar(t) {
60
+ return "boolean" === t.type && "boolean" == typeof t.value;
61
+ }
62
+ }
63
+ (FeatureFlag.it = { rt: "id", Fe: "e", we: "pr", ze: "fts" }),
64
+ (FeatureFlag.Rt = { rt: "id", Fe: "enabled", we: "properties", ze: "fts" });
@@ -1 +1,19 @@
1
- import e from"../managers/braze-instance.js";import er from"./feature-flags-provider.js";const ir={t:!1,provider:null,er:()=>(ir.o(),ir.provider||(ir.provider=new er(e.tr(),e.ar(),e.l()),e.dr(ir.provider)),ir.provider),o:()=>{ir.t||(e.g(ir),ir.t=!0)},destroy:()=>{ir.provider=null,ir.t=!1}};export default ir;
1
+ import e from "../managers/braze-instance.js";
2
+ import er from "./feature-flags-provider.js";
3
+ const ir = {
4
+ t: !1,
5
+ provider: null,
6
+ er: () => (
7
+ ir.o(),
8
+ ir.provider ||
9
+ ((ir.provider = new er(e.tr(), e.ar(), e.l())), e.dr(ir.provider)),
10
+ ir.provider
11
+ ),
12
+ o: () => {
13
+ ir.t || (e.g(ir), (ir.t = !0));
14
+ },
15
+ destroy: () => {
16
+ (ir.provider = null), (ir.t = !1);
17
+ },
18
+ };
19
+ export default ir;
@@ -1 +1,145 @@
1
- import r from"../../shared-lib/braze-shared-lib.js";import y from"../common/base-provider.js";import e from"../managers/braze-instance.js";import{STORAGE_KEYS as i}from"../managers/storage-manager.js";import E from"../managers/subscription-manager.js";import{randomInclusive as D}from"../util/math.js";import C from"../util/net.js";import{newFeatureFlagFromJson as st,newFeatureFlagFromSerializedValue as it}from"./feature-flag-factory.js";import T from"../util/request-header-utils.js";export default class er extends y{constructor(t,s,i){super(),this.wt=t,this.gt=s,this.u=i,this.pi=[],this.gi=0,this.wt=t,this.gt=s,this.u=i,this.Fi=null,this.wi=new E,this.yi=10,this.ji=null,this.bi=null,e.jt(this.wi)}Ts(t){if((!this.wt||this.wt.vi())&&null!=t&&t.feature_flags){this.pi=[];for(const s of t.feature_flags){const t=st(s);t&&this.pi.push(t)}this.gi=(new Date).getTime(),this.Ti(),this.wi.Et(this.pi)}}Di(){let t={};this.u&&(t=this.u.v(i.k.Ri));const s={};for(const i in t){const e=it(t[i]);e&&(s[e.id]=e)}return s}Ni(){var t;return(null===(t=this.u)||void 0===t?void 0:t.v(i.k.qi))||{}}xi(t){this.u&&this.u.D(i.k.qi,t)}ri(t){return this.wi.lt(t)}refreshFeatureFlags(t,s,i=!1,e=!0){if(!this.zi(i))return!this.Fi&&this.wt&&(this.Fi=this.wt.Ci((()=>{this.refreshFeatureFlags(t,s)}))),void("function"==typeof s&&s());if(e&&this.Ii(),!this.gt)return void("function"==typeof s&&s());const r=this.gt.Bs({},!0),h=this.gt.Hs(r,T.Os.Si);let o=!1;this.gt.Qs(r,(()=>{this.gt?(T.Ws(this.u,T.Os.Si,(new Date).valueOf()),C.Xs({url:`${this.gt.Ys()}/feature_flags/sync`,headers:h,data:r,O:i=>{if(!this.gt.Zs(r,i,h))return o=!0,void("function"==typeof s&&s());this.gt.ti(),this.Ts(i),o=!1,T.si(this.u,T.Os.Si,1),"function"==typeof t&&t()},error:t=>{this.gt.ii(t,"retrieving feature flags"),o=!0,"function"==typeof s&&s()},ei:()=>{if(e&&o&&!this.bi){T.hi(this.u,T.Os.Si);let e=this.ji;(null==e||e<1e3*this.yi)&&(e=1e3*this.yi),this.$i(Math.min(3e5,D(1e3*this.yi,3*e)),t,s,i)}}})):"function"==typeof s&&s()}))}Ii(){null!=this.bi&&(clearTimeout(this.bi),this.bi=null)}$i(t=1e3*this.yi,s,i,e=!1){this.Ii(),this.bi=window.setTimeout((()=>{this.refreshFeatureFlags(s,i,e)}),t),this.ji=t}zi(t){if(!this.wt)return!1;if(!t){const t=this.wt.Mi();if(null==t)return!1;let s=!1;if(!isNaN(t)){if(-1===t)return r.j.info("Feature flag refreshes not allowed"),!1;s=(new Date).getTime()>=(this.gi||0)+1e3*t}if(!s)return r.j.info(`Feature flag refreshes were rate limited to ${t} seconds`),!1}return this.wt.vi()}Ti(){if(!this.u)return;const t={};for(const s of this.pi){const i=s.ss();t[s.id]=i}this.u.D(i.k.Ri,t),this.u.D(i.k.Ui,this.gi)}}
1
+ import r from "../../shared-lib/braze-shared-lib.js";
2
+ import y from "../common/base-provider.js";
3
+ import e from "../managers/braze-instance.js";
4
+ import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
5
+ import E from "../managers/subscription-manager.js";
6
+ import { randomInclusive as D } from "../util/math.js";
7
+ import C from "../util/net.js";
8
+ import {
9
+ newFeatureFlagFromJson as st,
10
+ newFeatureFlagFromSerializedValue as it,
11
+ } from "./feature-flag-factory.js";
12
+ import T from "../util/request-header-utils.js";
13
+ export default class er extends y {
14
+ constructor(t, s, i) {
15
+ super(),
16
+ (this.yt = t),
17
+ (this.$t = s),
18
+ (this.u = i),
19
+ (this.gi = []),
20
+ (this.pi = 0),
21
+ (this.yt = t),
22
+ (this.$t = s),
23
+ (this.u = i),
24
+ (this.Fi = null),
25
+ (this.wi = new E()),
26
+ (this.ji = 10),
27
+ (this.bi = null),
28
+ (this.vi = null),
29
+ e.Ht(this.wi);
30
+ }
31
+ Ss(t) {
32
+ if ((!this.yt || this.yt.yi()) && null != t && t.feature_flags) {
33
+ this.gi = [];
34
+ for (const s of t.feature_flags) {
35
+ const t = st(s);
36
+ t && this.gi.push(t);
37
+ }
38
+ (this.pi = new Date().getTime()), this.Ti(), this.wi.Dt(this.gi);
39
+ }
40
+ }
41
+ Di() {
42
+ let t = {};
43
+ this.u && (t = this.u.v(i.k.Ri));
44
+ const s = {};
45
+ for (const i in t) {
46
+ const e = it(t[i]);
47
+ e && (s[e.id] = e);
48
+ }
49
+ return s;
50
+ }
51
+ Ni() {
52
+ var t;
53
+ return (null === (t = this.u) || void 0 === t ? void 0 : t.v(i.k.qi)) || {};
54
+ }
55
+ xi(t) {
56
+ this.u && this.u.D(i.k.qi, t);
57
+ }
58
+ ri(t) {
59
+ return this.wi.It(t);
60
+ }
61
+ refreshFeatureFlags(t, s, i = !1, e = !0) {
62
+ const r = () => {
63
+ "function" == typeof s && s(), this.wi.Dt(this.gi);
64
+ };
65
+ if (!this.zi(i))
66
+ return (
67
+ !this.Fi &&
68
+ this.yt &&
69
+ (this.Fi = this.yt.Ci(() => {
70
+ this.refreshFeatureFlags(t, s);
71
+ })),
72
+ void r()
73
+ );
74
+ if ((e && this.Ii(), !this.$t)) return void r();
75
+ const h = this.$t.Bs({}, !0),
76
+ a = this.$t.Hs(h, T.Os.Si);
77
+ let o = !1;
78
+ this.$t.Qs(h, () => {
79
+ this.$t
80
+ ? (T.Ws(this.u, T.Os.Si, new Date().valueOf()),
81
+ C.Xs({
82
+ url: `${this.$t.Ys()}/feature_flags/sync`,
83
+ headers: a,
84
+ data: h,
85
+ O: (s) => {
86
+ if (!this.$t.Zs(h, s, a)) return (o = !0), void r();
87
+ this.$t.ti(),
88
+ this.Ss(s),
89
+ (o = !1),
90
+ T.si(this.u, T.Os.Si, 1),
91
+ "function" == typeof t && t();
92
+ },
93
+ error: (t) => {
94
+ this.$t.ii(t, "retrieving feature flags"), (o = !0), r();
95
+ },
96
+ ei: () => {
97
+ if (e && o && !this.vi) {
98
+ T.hi(this.u, T.Os.Si);
99
+ let e = this.bi;
100
+ (null == e || e < 1e3 * this.ji) && (e = 1e3 * this.ji),
101
+ this.$i(Math.min(3e5, D(1e3 * this.ji, 3 * e)), t, s, i);
102
+ }
103
+ },
104
+ }))
105
+ : r();
106
+ });
107
+ }
108
+ Ii() {
109
+ null != this.vi && (clearTimeout(this.vi), (this.vi = null));
110
+ }
111
+ $i(t = 1e3 * this.ji, s, i, e = !1) {
112
+ this.Ii(),
113
+ (this.vi = window.setTimeout(() => {
114
+ this.refreshFeatureFlags(s, i, e);
115
+ }, t)),
116
+ (this.bi = t);
117
+ }
118
+ zi(t) {
119
+ if (!this.yt) return !1;
120
+ if (!t) {
121
+ const t = this.yt.Mi();
122
+ if (null == t) return !1;
123
+ let s = !1;
124
+ if (!isNaN(t)) {
125
+ if (-1 === t) return r.j.info("Feature flag refreshes not allowed"), !1;
126
+ s = new Date().getTime() >= (this.pi || 0) + 1e3 * t;
127
+ }
128
+ if (!s)
129
+ return (
130
+ r.j.info(`Feature flag refreshes were rate limited to ${t} seconds`),
131
+ !1
132
+ );
133
+ }
134
+ return this.yt.yi();
135
+ }
136
+ Ti() {
137
+ if (!this.u) return;
138
+ const t = {};
139
+ for (const s of this.gi) {
140
+ const i = s.tt();
141
+ t[s.id] = i;
142
+ }
143
+ this.u.D(i.k.Ri, t), this.u.D(i.k.Ui, this.pi);
144
+ }
145
+ }
@@ -1 +1,12 @@
1
- import r from"../../shared-lib/braze-shared-lib.js";import e from"../managers/braze-instance.js";import ir from"./feature-flags-provider-factory.js";export function getAllFeatureFlags(){if(!e.rr())return;const t=[],a=e.tr();if(a&&!a.vi())return r.j.info("Feature flags are not enabled."),t;const o=ir.er().Di();for(const r in o)t.push(o[r]);return t}
1
+ import r from "../../shared-lib/braze-shared-lib.js";
2
+ import e from "../managers/braze-instance.js";
3
+ import ir from "./feature-flags-provider-factory.js";
4
+ export function getAllFeatureFlags() {
5
+ if (!e.rr()) return;
6
+ const t = [],
7
+ a = e.tr();
8
+ if (a && !a.yi()) return r.j.info("Feature flags are not enabled."), t;
9
+ const o = ir.er().Di();
10
+ for (const r in o) t.push(o[r]);
11
+ return t;
12
+ }
@@ -1 +1,10 @@
1
- import r from"../../shared-lib/braze-shared-lib.js";import e from"../managers/braze-instance.js";import FeatureFlag from"./feature-flag.js";import ir from"./feature-flags-provider-factory.js";export function getFeatureFlag(t){if(!e.rr())return;const a=e.tr();if(a&&!a.vi())return r.j.info("Feature flags are not enabled."),new FeatureFlag(t);const o=ir.er().Di();return o[t]?o[t]:new FeatureFlag(t)}
1
+ import r from "../../shared-lib/braze-shared-lib.js";
2
+ import e from "../managers/braze-instance.js";
3
+ import ir from "./feature-flags-provider-factory.js";
4
+ export function getFeatureFlag(t) {
5
+ if (!e.rr()) return;
6
+ const a = e.tr();
7
+ if (a && !a.yi()) return r.j.info("Feature flags are not enabled."), null;
8
+ const n = ir.er().Di();
9
+ return n[t] ? n[t] : null;
10
+ }
@@ -1 +1,6 @@
1
- export{default as FeatureFlag}from"./feature-flag.js";export{refreshFeatureFlags}from"./refresh-feature-flags.js";export{getFeatureFlag}from"./get-feature-flag.js";export{subscribeToFeatureFlagsUpdates}from"./subscribe-to-feature-flags-updates.js";export{getAllFeatureFlags}from"./get-all-feature-flags.js";export{logFeatureFlagImpression}from"./log-feature-flag-impression.js";
1
+ export { default as FeatureFlag } from "./feature-flag.js";
2
+ export { refreshFeatureFlags } from "./refresh-feature-flags.js";
3
+ export { getFeatureFlag } from "./get-feature-flag.js";
4
+ export { subscribeToFeatureFlagsUpdates } from "./subscribe-to-feature-flags-updates.js";
5
+ export { getAllFeatureFlags } from "./get-all-feature-flags.js";
6
+ export { logFeatureFlagImpression } from "./log-feature-flag-impression.js";
@@ -1 +1,23 @@
1
- import r from"../../shared-lib/braze-shared-lib.js";import s from"../common/event-logger.js";import e from"../managers/braze-instance.js";import ir from"./feature-flags-provider-factory.js";export function logFeatureFlagImpression(t){if(!e.rr())return;if(!t)return!1;const o=ir.er().Di();if(!o[t])return!1;const n=o[t].trackingString;if(!n)return r.j.info("Not logging a feature flag impression. The feature flag was not part of any matching campaign."),!1;const a=ir.er().Ni();if(a[n])return!1;a[n]=!0,ir.er().xi(a);const i={fid:t,fts:n};return s.N(r.q.Fr,i).O}
1
+ import r from "../../shared-lib/braze-shared-lib.js";
2
+ import s from "../common/event-logger.js";
3
+ import e from "../managers/braze-instance.js";
4
+ import ir from "./feature-flags-provider-factory.js";
5
+ export function logFeatureFlagImpression(t) {
6
+ if (!e.rr()) return;
7
+ if (!t) return !1;
8
+ const o = ir.er().Di();
9
+ if (!o[t]) return !1;
10
+ const n = o[t].trackingString;
11
+ if (!n)
12
+ return (
13
+ r.j.info(
14
+ "Not logging a feature flag impression. The feature flag was not part of any matching campaign.",
15
+ ),
16
+ !1
17
+ );
18
+ const a = ir.er().Ni();
19
+ if (a[n]) return !1;
20
+ (a[n] = !0), ir.er().xi(a);
21
+ const i = { fid: t, fts: n };
22
+ return s.N(r.q.Fr, i).O;
23
+ }
@@ -1 +1,9 @@
1
- import e from"../managers/braze-instance.js";import ir from"./feature-flags-provider-factory.js";function tr(r,t,a=!1){if(e.rr())return ir.er().refreshFeatureFlags(r,t,a)}export function refreshFeatureFlags(r,e){tr(r,e)}export default tr;
1
+ import e from "../managers/braze-instance.js";
2
+ import ir from "./feature-flags-provider-factory.js";
3
+ function tr(r, t, a = !1) {
4
+ if (e.rr()) return ir.er().refreshFeatureFlags(r, t, a);
5
+ }
6
+ export function refreshFeatureFlags(r, e) {
7
+ tr(r, e);
8
+ }
9
+ export default tr;
@@ -1 +1,9 @@
1
- import e from"../managers/braze-instance.js";import ir from"./feature-flags-provider-factory.js";import{getAllFeatureFlags}from"./get-all-feature-flags.js";export function subscribeToFeatureFlagsUpdates(r){if(!e.rr())return;const t=getAllFeatureFlags();t&&"function"==typeof r&&r(t);return ir.er().ri(r)}
1
+ import e from "../managers/braze-instance.js";
2
+ import ir from "./feature-flags-provider-factory.js";
3
+ import { getAllFeatureFlags } from "./get-all-feature-flags.js";
4
+ export function subscribeToFeatureFlagsUpdates(r) {
5
+ if (!e.rr()) return;
6
+ const t = getAllFeatureFlags();
7
+ t && "function" == typeof r && r(t);
8
+ return ir.er().ri(r);
9
+ }
@@ -1 +1 @@
1
- export{};
1
+ export {};
@@ -1 +1,18 @@
1
- import e from"../managers/braze-instance.js";import re from"./feed-provider.js";const ie={t:!1,provider:null,er:()=>(ie.o(),ie.provider||(ie.provider=new re(e.l(),e.cr()),e.dr(ie.provider)),ie.provider),o:()=>{ie.t||(e.g(ie),ie.t=!0)},destroy:()=>{ie.provider=null,ie.t=!1}};export default ie;
1
+ import e from "../managers/braze-instance.js";
2
+ import ee from "./feed-provider.js";
3
+ const re = {
4
+ t: !1,
5
+ provider: null,
6
+ er: () => (
7
+ re.o(),
8
+ re.provider || ((re.provider = new ee(e.l(), e.cr())), e.dr(re.provider)),
9
+ re.provider
10
+ ),
11
+ o: () => {
12
+ re.t || (e.g(re), (re.t = !0));
13
+ },
14
+ destroy: () => {
15
+ (re.provider = null), (re.t = !1);
16
+ },
17
+ };
18
+ export default re;
@@ -1 +1,90 @@
1
- import y from"../common/base-provider.js";import e from"../managers/braze-instance.js";import Feed from"./feed.js";import{newCardFromFeedJson as ht,newCardFromSerializedValue as R}from"../Card/util/card-factory.js";import{rehydrateDateAfterJsonization as w}from"../util/date-utils.js";import{STORAGE_KEYS as i}from"../managers/storage-manager.js";import E from"../managers/subscription-manager.js";export default class re extends y{constructor(t,s){super(),this.u=t,this.ki=s,this.cards=[],this.Ai=null,this.u=t,this.ki=s,this.yt=new E,e.jt(this.yt),this.Lt()}Lt(){let t=[];this.u&&(t=this.u.v(i.k.Bi)||[]);const s=[];for(let i=0;i<t.length;i++){const e=R(t[i]);null!=e&&s.push(e)}this.cards=s,this.u&&(this.Ai=w(this.u.v(i.k.Ei)))}Gi(t){const s=[];let e=null,r={};this.u&&(r=this.u.v(i.k.L)||{});const h={};for(let i=0;i<t.length;i++){e=t[i];const o=ht(e);if(null!=o){const t=o.id;t&&r[t]&&(o.viewed=!0,h[t]=!0),s.push(o)}}this.cards=s,this.Rs(),this.Ai=new Date,this.u&&(this.u.D(i.k.L,h),this.u.D(i.k.Ei,this.Ai))}Rs(){if(!this.u)return;const t=[];for(let s=0;s<this.cards.length;s++)t.push(this.cards[s].ss());this.u.D(i.k.Bi,t)}Ts(t){null!=t&&t.feed&&(this.Lt(),this.Gi(t.feed),this.yt.Et(new Feed(this.cards.slice(),this.Ai)))}Hi(){this.Lt();const t=[],s=new Date;for(let i=0;i<this.cards.length;i++){const e=this.cards[i].expiresAt;let r=!0;null!=e&&(r=e>=s),r&&t.push(this.cards[i])}return new Feed(t,this.Ai)}Ms(){this.ki&&this.ki.requestFeedRefresh()}ri(t){return this.yt.lt(t)}clearData(t){null==t&&(t=!1),this.cards=[],this.Ai=null,t&&this.u&&(this.u.ni(i.k.Bi),this.u.ni(i.k.Ei)),this.yt.Et(new Feed(this.cards.slice(),this.Ai))}}
1
+ import y from "../common/base-provider.js";
2
+ import e from "../managers/braze-instance.js";
3
+ import Feed from "./feed.js";
4
+ import {
5
+ newCardFromFeedJson as ht,
6
+ newCardFromSerializedValue as R,
7
+ } from "../Card/util/card-factory.js";
8
+ import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";
9
+ import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
10
+ import E from "../managers/subscription-manager.js";
11
+ export default class ee extends y {
12
+ constructor(t, s) {
13
+ super(),
14
+ (this.u = t),
15
+ (this.ki = s),
16
+ (this.cards = []),
17
+ (this.Ai = null),
18
+ (this.u = t),
19
+ (this.ki = s),
20
+ (this.Bt = new E()),
21
+ e.Ht(this.Bt),
22
+ this.Yt();
23
+ }
24
+ Yt() {
25
+ let t = [];
26
+ this.u && (t = this.u.v(i.k.Bi) || []);
27
+ const s = [];
28
+ for (let i = 0; i < t.length; i++) {
29
+ const e = R(t[i]);
30
+ null != e && s.push(e);
31
+ }
32
+ (this.cards = s), this.u && (this.Ai = w(this.u.v(i.k.Ei)));
33
+ }
34
+ Gi(t) {
35
+ const s = [];
36
+ let e = null,
37
+ r = {};
38
+ this.u && (r = this.u.v(i.k.L) || {});
39
+ const h = {};
40
+ for (let i = 0; i < t.length; i++) {
41
+ e = t[i];
42
+ const o = ht(e);
43
+ if (null != o) {
44
+ const t = o.id;
45
+ t && r[t] && ((o.viewed = !0), (h[t] = !0)), s.push(o);
46
+ }
47
+ }
48
+ (this.cards = s),
49
+ this.Ds(),
50
+ (this.Ai = new Date()),
51
+ this.u && (this.u.D(i.k.L, h), this.u.D(i.k.Ei, this.Ai));
52
+ }
53
+ Ds() {
54
+ if (!this.u) return;
55
+ const t = [];
56
+ for (let s = 0; s < this.cards.length; s++) t.push(this.cards[s].tt());
57
+ this.u.D(i.k.Bi, t);
58
+ }
59
+ Ss(t) {
60
+ null != t &&
61
+ t.feed &&
62
+ (this.Yt(),
63
+ this.Gi(t.feed),
64
+ this.Bt.Dt(new Feed(this.cards.slice(), this.Ai)));
65
+ }
66
+ Hi() {
67
+ this.Yt();
68
+ const t = [],
69
+ s = new Date();
70
+ for (let i = 0; i < this.cards.length; i++) {
71
+ const e = this.cards[i].expiresAt;
72
+ let r = !0;
73
+ null != e && (r = e >= s), r && t.push(this.cards[i]);
74
+ }
75
+ return new Feed(t, this.Ai);
76
+ }
77
+ xs() {
78
+ this.ki && this.ki.requestFeedRefresh();
79
+ }
80
+ ri(t) {
81
+ return this.Bt.It(t);
82
+ }
83
+ clearData(t) {
84
+ null == t && (t = !1),
85
+ (this.cards = []),
86
+ (this.Ai = null),
87
+ t && this.u && (this.u.ni(i.k.Bi), this.u.ni(i.k.Ei)),
88
+ this.Bt.Dt(new Feed(this.cards.slice(), this.Ai));
89
+ }
90
+ }
package/src/Feed/feed.js CHANGED
@@ -1 +1,20 @@
1
- import x from"../common/base-feed.js";import{logCardClick,logCardImpressions}from"../Card/index.js";import{requestFeedRefresh}from"./request-feed-refresh.js";export default class Feed extends x{constructor(r,e){super(r,e)}logCardImpressions(r){logCardImpressions(r,!1)}logCardClick(r){return logCardClick(r,!1)}sr(){requestFeedRefresh()}ur(){return!1}}
1
+ import x from "../common/base-feed.js";
2
+ import { logCardClick, logCardImpressions } from "../Card/index.js";
3
+ import { requestFeedRefresh } from "./request-feed-refresh.js";
4
+ export default class Feed extends x {
5
+ constructor(r, e) {
6
+ super(r, e);
7
+ }
8
+ logCardImpressions(r) {
9
+ logCardImpressions(r, !1);
10
+ }
11
+ logCardClick(r) {
12
+ return logCardClick(r, !1);
13
+ }
14
+ sr() {
15
+ requestFeedRefresh();
16
+ }
17
+ ur() {
18
+ return !1;
19
+ }
20
+ }
@@ -1 +1,5 @@
1
- import e from"../managers/braze-instance.js";import ie from"./feed-provider-factory.js";export function getCachedFeed(){if(e.rr())return ie.er().Hi()}
1
+ import e from "../managers/braze-instance.js";
2
+ import re from "./feed-provider-factory.js";
3
+ export function getCachedFeed() {
4
+ if (e.rr()) return re.er().Hi();
5
+ }
package/src/Feed/index.js CHANGED
@@ -1 +1,8 @@
1
- export{default as Feed}from"./feed.js";export{getCachedFeed}from"./get-cached-feed.js";export{destroyFeed}from"./ui/hide-feed.js";export{logFeedDisplayed}from"./log-feed-displayed.js";export{requestFeedRefresh}from"./request-feed-refresh.js";export{showFeed}from"./ui/show-feed.js";export{subscribeToFeedUpdates}from"./subscribe-to-feed-updates.js";export{toggleFeed}from"./ui/toggle-feed.js";
1
+ export { default as Feed } from "./feed.js";
2
+ export { getCachedFeed } from "./get-cached-feed.js";
3
+ export { destroyFeed } from "./ui/hide-feed.js";
4
+ export { logFeedDisplayed } from "./log-feed-displayed.js";
5
+ export { requestFeedRefresh } from "./request-feed-refresh.js";
6
+ export { showFeed } from "./ui/show-feed.js";
7
+ export { subscribeToFeedUpdates } from "./subscribe-to-feed-updates.js";
8
+ export { toggleFeed } from "./ui/toggle-feed.js";
@@ -1 +1,7 @@
1
- import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";export function logFeedDisplayed(){if(!e.rr())return;const i=e.ar();return i?i.qr(r.Cr.Br).O:void 0}
1
+ import e from "../managers/braze-instance.js";
2
+ import r from "../../shared-lib/braze-shared-lib.js";
3
+ export function logFeedDisplayed() {
4
+ if (!e.rr()) return;
5
+ const i = e.ar();
6
+ return i ? i.qr(r.Cr.Br).O : void 0;
7
+ }
@@ -1 +1,5 @@
1
- import e from"../managers/braze-instance.js";import ie from"./feed-provider-factory.js";export function requestFeedRefresh(){if(e.rr())return ie.er().Ms()}
1
+ import e from "../managers/braze-instance.js";
2
+ import re from "./feed-provider-factory.js";
3
+ export function requestFeedRefresh() {
4
+ if (e.rr()) return re.er().xs();
5
+ }
@@ -1 +1,5 @@
1
- import e from"../managers/braze-instance.js";import ie from"./feed-provider-factory.js";export function subscribeToFeedUpdates(r){if(e.rr())return ie.er().ri(r)}
1
+ import e from "../managers/braze-instance.js";
2
+ import re from "./feed-provider-factory.js";
3
+ export function subscribeToFeedUpdates(r) {
4
+ if (e.rr()) return re.er().ri(r);
5
+ }
package/src/Feed/types.js CHANGED
@@ -1 +1 @@
1
- export{};
1
+ export {};
@@ -1 +1,7 @@
1
- import e from"../../managers/braze-instance.js";import{destroyFeedHtml as k}from"../../common/feed-display.js";export function destroyFeed(){if(!e.rr())return;const o=document.querySelectorAll(".ab-feed");for(let e=0;e<o.length;e++)k(o[e])}
1
+ import e from "../../managers/braze-instance.js";
2
+ import { destroyFeedHtml as z } from "../../common/feed-display.js";
3
+ export function destroyFeed() {
4
+ if (!e.rr()) return;
5
+ const o = document.querySelectorAll(".ab-feed");
6
+ for (let e = 0; e < o.length; e++) z(o[e]);
7
+ }
@@ -1 +1,96 @@
1
- import e,{OPTIONS as L}from"../../managers/braze-instance.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{Feed,logFeedDisplayed,subscribeToFeedUpdates}from"../index.js";import ie from"../feed-provider-factory.js";import{intersection as te}from"../../util/code-utils.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 showFeed(t,n,o){if(!e.rr())return;G();const s=(e,t)=>{if(null==t)return e;const n=[];for(let e=0;e<t.length;e++)n.push(t[e].toLowerCase());const o=[];for(let t=0;t<e.length;t++){const r=[],s=e[t].categories||[];for(let e=0;e<s.length;e++)r.push(s[e].toLowerCase());te(r,n).length>0&&o.push(e[t])}return o},i=e.nn(L.tn)||e.nn(L.en)||!1;let l=!1;null==t&&(t=document.body,l=!0);let a,f=!1;null==n?(a=ie.er().Hi(),B(a,s(a.cards,o),a.lastUpdated,null,i),f=!0):a=new Feed(s(n,o),new Date);const u=I(a,i,l);if(f){(null==a.lastUpdated||(new Date).valueOf()-a.lastUpdated.valueOf()>Feed.mr)&&(r.j.info(`Cached feed was older than max TTL of ${Feed.mr} ms, requesting an update from the server.`),$(a,u));const e=(new Date).valueOf(),t=subscribeToFeedUpdates((function(t){const n=u.querySelectorAll(".ab-refresh-button")[0];if(null!=n){let t=500;t-=(new Date).valueOf()-e;const o=u.getAttribute(M);if(o){const e=parseInt(o);isNaN(e)||(t-=(new Date).valueOf()-e)}setTimeout((function(){n.className=n.className.replace(/fa-spin/g,"")}),Math.max(t,0))}B(a,s(t.cards,o),t.lastUpdated,u,i)}));A(t,u)}const d=e=>{const t=e.querySelectorAll(".ab-feed");let n=null;for(let o=0;o<t.length;o++)t[o].parentNode===e&&(n=t[o]);null!=n?(k(n),n.parentNode&&n.parentNode.replaceChild(u,n)):e.appendChild(u),setTimeout((function(){u.className=u.className.replace("ab-hide","ab-show")}),0),l&&u.focus(),logFeedDisplayed(),q(a,u),a&&F(a.cards,e)};var m;null!=t?d(t):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 {
3
+ destroyFeedHtml as z,
4
+ detectFeedImpressions as q,
5
+ feedToHtml as I,
6
+ LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as M,
7
+ refreshFeed as $,
8
+ registerFeedSubscriptionId as k,
9
+ updateFeedCards as A,
10
+ } from "../../common/feed-display.js";
11
+ import { Feed, logFeedDisplayed, subscribeToFeedUpdates } from "../index.js";
12
+ import re from "../feed-provider-factory.js";
13
+ import { intersection as te } from "../../util/code-utils.js";
14
+ import { setCardHeight as B } from "../../Card/display/card-display.js";
15
+ import { setupFeedUI as F } from "../../ui/js/index.js";
16
+ import r from "../../../shared-lib/braze-shared-lib.js";
17
+ export function showFeed(t, n, o) {
18
+ if (!e.rr()) return;
19
+ F();
20
+ const s = (e, t) => {
21
+ if (null == t) return e;
22
+ const n = [];
23
+ for (let e = 0; e < t.length; e++) n.push(t[e].toLowerCase());
24
+ const o = [];
25
+ for (let t = 0; t < e.length; t++) {
26
+ const r = [],
27
+ s = e[t].categories || [];
28
+ for (let e = 0; e < s.length; e++) r.push(s[e].toLowerCase());
29
+ te(r, n).length > 0 && o.push(e[t]);
30
+ }
31
+ return o;
32
+ },
33
+ i = e.nn(L.tn) || e.nn(L.en) || !1;
34
+ let l = !1;
35
+ null == t && ((t = document.body), (l = !0));
36
+ let a,
37
+ f = !1;
38
+ null == n
39
+ ? ((a = re.er().Hi()),
40
+ A(a, s(a.cards, o), a.lastUpdated, null, i),
41
+ (f = !0))
42
+ : (a = new Feed(s(n, o), new Date()));
43
+ const u = I(a, i, l);
44
+ if (f) {
45
+ (null == a.lastUpdated ||
46
+ new Date().valueOf() - a.lastUpdated.valueOf() > Feed.mr) &&
47
+ (r.j.info(
48
+ `Cached feed was older than max TTL of ${Feed.mr} ms, requesting an update from the server.`,
49
+ ),
50
+ $(a, u));
51
+ const e = new Date().valueOf(),
52
+ t = subscribeToFeedUpdates(function (t) {
53
+ const n = u.querySelectorAll(".ab-refresh-button")[0];
54
+ if (null != n) {
55
+ let t = 500;
56
+ t -= new Date().valueOf() - e;
57
+ const o = u.getAttribute(M);
58
+ if (o) {
59
+ const e = parseInt(o);
60
+ isNaN(e) || (t -= new Date().valueOf() - e);
61
+ }
62
+ setTimeout(
63
+ function () {
64
+ n.className = n.className.replace(/fa-spin/g, "");
65
+ },
66
+ Math.max(t, 0),
67
+ );
68
+ }
69
+ A(a, s(t.cards, o), t.lastUpdated, u, i);
70
+ });
71
+ k(t, u);
72
+ }
73
+ const d = (e) => {
74
+ const t = e.querySelectorAll(".ab-feed");
75
+ let n = null;
76
+ for (let o = 0; o < t.length; o++) t[o].parentNode === e && (n = t[o]);
77
+ null != n
78
+ ? (z(n), n.parentNode && n.parentNode.replaceChild(u, n))
79
+ : e.appendChild(u),
80
+ setTimeout(function () {
81
+ u.className = u.className.replace("ab-hide", "ab-show");
82
+ }, 0),
83
+ l && u.focus(),
84
+ logFeedDisplayed(),
85
+ q(a, u),
86
+ a && B(a.cards, e);
87
+ };
88
+ var m;
89
+ null != t
90
+ ? d(t)
91
+ : (window.onload =
92
+ ((m = window.onload),
93
+ function () {
94
+ "function" == typeof m && m(new Event("oldLoad")), d(document.body);
95
+ }));
96
+ }
@@ -1 +1,8 @@
1
- import e from"../../managers/braze-instance.js";import{destroyFeed,showFeed}from"../index.js";export function toggleFeed(o,n,r){e.rr()&&(document.querySelectorAll(".ab-feed").length>0?destroyFeed():showFeed(o,n,r))}
1
+ import e from "../../managers/braze-instance.js";
2
+ import { destroyFeed, showFeed } from "../index.js";
3
+ export function toggleFeed(o, n, r) {
4
+ e.rr() &&
5
+ (document.querySelectorAll(".ab-feed").length > 0
6
+ ? destroyFeed()
7
+ : showFeed(o, n, r));
8
+ }
@@ -1 +1,13 @@
1
- import InAppMessage from"./models/in-app-message.js";import e from"../managers/braze-instance.js";import ControlMessage from"./models/control-message.js";import r from"../../shared-lib/braze-shared-lib.js";import se from"./in-app-message-manager-factory.js";export function deferInAppMessage(s){if(e.rr())return s instanceof ControlMessage?(r.j.info("Not deferring since this is a ControlMessage."),!1):s instanceof InAppMessage?se.m().he(s):(r.j.info("Not an instance of InAppMessage, ignoring."),!1)}
1
+ import InAppMessage from "./models/in-app-message.js";
2
+ import e from "../managers/braze-instance.js";
3
+ import ControlMessage from "./models/control-message.js";
4
+ import r from "../../shared-lib/braze-shared-lib.js";
5
+ import se from "./in-app-message-manager-factory.js";
6
+ export function deferInAppMessage(s) {
7
+ if (e.rr())
8
+ return s instanceof ControlMessage
9
+ ? (r.j.info("Not deferring since this is a ControlMessage."), !1)
10
+ : s instanceof InAppMessage
11
+ ? se.m().he(s)
12
+ : (r.j.info("Not an instance of InAppMessage, ignoring."), !1);
13
+ }