@braze/web-sdk 4.3.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/index.d.ts +56 -6
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +8 -1
  4. package/shared-lib/encoding-utils.js +12 -1
  5. package/shared-lib/event-types.js +32 -1
  6. package/shared-lib/guid.js +10 -1
  7. package/shared-lib/indexed-db-adapter.js +315 -1
  8. package/shared-lib/logger.js +38 -1
  9. package/shared-lib/supported-options.js +26 -1
  10. package/src/Card/card-manager-factory.js +14 -1
  11. package/src/Card/card-manager.js +72 -1
  12. package/src/Card/display/card-display.js +134 -1
  13. package/src/Card/index.js +5 -1
  14. package/src/Card/log-card-click.js +11 -1
  15. package/src/Card/log-card-dismissal.js +11 -1
  16. package/src/Card/log-card-impressions.js +13 -1
  17. package/src/Card/log-content-card-impressions.js +4 -1
  18. package/src/Card/models/banner.js +30 -1
  19. package/src/Card/models/captioned-image.js +32 -1
  20. package/src/Card/models/card.js +174 -1
  21. package/src/Card/models/classic-card.js +32 -1
  22. package/src/Card/models/control-card.js +38 -1
  23. package/src/Card/models/index.js +5 -1
  24. package/src/Card/util/card-factory.js +104 -1
  25. package/src/ContentCards/content-cards-provider-factory.js +20 -1
  26. package/src/ContentCards/content-cards-provider.js +283 -1
  27. package/src/ContentCards/content-cards.js +24 -1
  28. package/src/ContentCards/get-cached-content-cards.js +5 -1
  29. package/src/ContentCards/index.js +8 -1
  30. package/src/ContentCards/log-content-cards-displayed.js +5 -1
  31. package/src/ContentCards/request-content-cards-refresh.js +5 -1
  32. package/src/ContentCards/subscribe-to-content-cards-updates.js +14 -1
  33. package/src/ContentCards/ui/hide-content-cards.js +8 -1
  34. package/src/ContentCards/ui/show-content-cards.js +72 -1
  35. package/src/ContentCards/ui/toggle-content-cards.js +8 -1
  36. package/src/Core/add-sdk-metadata.js +27 -1
  37. package/src/Core/braze-sdk-metadata.js +10 -1
  38. package/src/Core/change-user.js +19 -1
  39. package/src/Core/destroy.js +5 -1
  40. package/src/Core/device-properties.js +9 -1
  41. package/src/Core/disable-sdk.js +10 -1
  42. package/src/Core/enable-sdk.js +8 -1
  43. package/src/Core/get-device-id.js +10 -1
  44. package/src/Core/get-user.js +4 -1
  45. package/src/Core/handle-braze-action.js +64 -1
  46. package/src/Core/index.js +23 -1
  47. package/src/Core/initialize.js +4 -1
  48. package/src/Core/is-disabled.js +4 -1
  49. package/src/Core/log-custom-event.js +36 -1
  50. package/src/Core/log-purchase.js +245 -1
  51. package/src/Core/open-session.js +23 -1
  52. package/src/Core/remove-all-subscriptions.js +4 -1
  53. package/src/Core/remove-subscription.js +4 -1
  54. package/src/Core/request-immediate-data-flush.js +4 -1
  55. package/src/Core/set-logger.js +4 -1
  56. package/src/Core/set-sdk-authentication-signature.js +9 -1
  57. package/src/Core/subscribe-to-sdk-authentication-failures.js +4 -1
  58. package/src/Core/toggle-logging.js +4 -1
  59. package/src/Core/wipe-data.js +15 -1
  60. package/src/FeatureFlags/feature-flag-factory.js +14 -0
  61. package/src/FeatureFlags/feature-flag.js +16 -0
  62. package/src/FeatureFlags/feature-flags-provider-factory.js +19 -0
  63. package/src/FeatureFlags/feature-flags-provider.js +94 -0
  64. package/src/FeatureFlags/get-all-feature-flags.js +12 -0
  65. package/src/FeatureFlags/get-feature-flag.js +12 -0
  66. package/src/FeatureFlags/index.js +4 -0
  67. package/src/FeatureFlags/refresh-feature-flags.js +9 -0
  68. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +6 -0
  69. package/src/Feed/feed-provider-factory.js +18 -1
  70. package/src/Feed/feed-provider.js +79 -1
  71. package/src/Feed/feed.js +20 -1
  72. package/src/Feed/get-cached-feed.js +5 -1
  73. package/src/Feed/index.js +8 -1
  74. package/src/Feed/log-feed-displayed.js +5 -1
  75. package/src/Feed/request-feed-refresh.js +5 -1
  76. package/src/Feed/subscribe-to-feed-updates.js +5 -1
  77. package/src/Feed/ui/hide-feed.js +7 -1
  78. package/src/Feed/ui/show-feed.js +89 -1
  79. package/src/Feed/ui/toggle-feed.js +8 -1
  80. package/src/InAppMessage/display/get-animation-effect.js +19 -1
  81. package/src/InAppMessage/display/html-message-to-html.js +223 -1
  82. package/src/InAppMessage/display/in-app-message-to-html.js +152 -1
  83. package/src/InAppMessage/display/modal-utils.js +68 -1
  84. package/src/InAppMessage/in-app-message-factory.js +145 -1
  85. package/src/InAppMessage/in-app-message-manager-factory.js +16 -1
  86. package/src/InAppMessage/in-app-message-manager.js +189 -1
  87. package/src/InAppMessage/index.js +14 -1
  88. package/src/InAppMessage/log-in-app-message-button-click.js +19 -1
  89. package/src/InAppMessage/log-in-app-message-click.js +16 -1
  90. package/src/InAppMessage/log-in-app-message-html-click.js +23 -1
  91. package/src/InAppMessage/log-in-app-message-impression.js +13 -1
  92. package/src/InAppMessage/models/control-message.js +8 -1
  93. package/src/InAppMessage/models/full-screen-message.js +71 -1
  94. package/src/InAppMessage/models/html-message.js +54 -1
  95. package/src/InAppMessage/models/in-app-message-button.js +40 -1
  96. package/src/InAppMessage/models/in-app-message.js +267 -1
  97. package/src/InAppMessage/models/modal-message.js +68 -1
  98. package/src/InAppMessage/models/slide-up-message.js +58 -1
  99. package/src/InAppMessage/models/templated-in-app-message.js +14 -1
  100. package/src/InAppMessage/subscribe-to-in-app-message.js +10 -1
  101. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +15 -1
  102. package/src/InAppMessage/ui/show-in-app-message.js +170 -1
  103. package/src/Push/index.js +5 -1
  104. package/src/Push/is-push-blocked.js +5 -1
  105. package/src/Push/is-push-permission-granted.js +5 -1
  106. package/src/Push/is-push-supported.js +5 -1
  107. package/src/Push/push-manager-factory.js +30 -1
  108. package/src/Push/push-manager.js +360 -1
  109. package/src/Push/request-push-permission.js +8 -1
  110. package/src/Push/unregister-push.js +5 -1
  111. package/src/Push/utils/push-utils.js +34 -1
  112. package/src/User/index.js +1 -1
  113. package/src/User/user-manager.js +70 -1
  114. package/src/User/user.js +278 -1
  115. package/src/common/base-feed.js +25 -1
  116. package/src/common/base-provider.js +6 -1
  117. package/src/common/constants.js +5 -1
  118. package/src/common/event-logger.js +24 -1
  119. package/src/common/feed-display.js +200 -1
  120. package/src/common/translations.js +148 -1
  121. package/src/index.js +9 -1
  122. package/src/l10n/l10n-manager-factory.js +22 -1
  123. package/src/l10n/l10n-manager.js +21 -1
  124. package/src/managers/auth-manager.js +48 -1
  125. package/src/managers/braze-instance.js +307 -1
  126. package/src/managers/device-manager.js +80 -1
  127. package/src/managers/network-manager.js +219 -1
  128. package/src/managers/server-config-manager.js +88 -1
  129. package/src/managers/session-manager.js +68 -1
  130. package/src/managers/storage-manager-factory.js +35 -1
  131. package/src/managers/storage-manager.js +394 -1
  132. package/src/managers/subscription-manager.js +25 -1
  133. package/src/models/backend-errors.js +8 -1
  134. package/src/models/braze-event.js +41 -1
  135. package/src/models/braze-sdk-metadata.js +10 -1
  136. package/src/models/device.js +26 -1
  137. package/src/models/identifier.js +20 -1
  138. package/src/models/push-token.js +22 -1
  139. package/src/models/request-result.js +8 -1
  140. package/src/models/server-config.js +32 -1
  141. package/src/request-controller.js +288 -1
  142. package/src/triggers/models/custom-event-data.js +14 -1
  143. package/src/triggers/models/custom-event-property-data.js +21 -1
  144. package/src/triggers/models/filter-set.js +55 -1
  145. package/src/triggers/models/filter.js +98 -1
  146. package/src/triggers/models/in-app-message-click-data.js +25 -1
  147. package/src/triggers/models/purchase-data.js +14 -1
  148. package/src/triggers/models/purchase-property-data.js +21 -1
  149. package/src/triggers/models/push-click-data.js +15 -1
  150. package/src/triggers/models/trigger-condition.js +109 -1
  151. package/src/triggers/models/trigger-events.js +8 -1
  152. package/src/triggers/models/trigger.js +110 -1
  153. package/src/triggers/triggers-provider-factory.js +30 -1
  154. package/src/triggers/triggers-provider.js +307 -1
  155. package/src/ui/js/attach-css.js +12 -1
  156. package/src/ui/js/feed-css.js +12 -1
  157. package/src/ui/js/iam-css.js +12 -1
  158. package/src/ui/js/index.js +3 -1
  159. package/src/ui/js/load-font-awesome.js +13 -1
  160. package/src/util/base-device-parser.js +14 -1
  161. package/src/util/braze-actions.js +79 -1
  162. package/src/util/browser-detector.js +85 -1
  163. package/src/util/client-hints-parser.js +60 -1
  164. package/src/util/code-utils.js +92 -1
  165. package/src/util/color-utils.js +23 -1
  166. package/src/util/component-utils.js +26 -1
  167. package/src/util/date-utils.js +27 -1
  168. package/src/util/deprecation-utils.js +5 -1
  169. package/src/util/device-constants.js +14 -1
  170. package/src/util/dom-utils.js +87 -1
  171. package/src/util/key-codes.js +1 -1
  172. package/src/util/math.js +5 -1
  173. package/src/util/net.js +75 -1
  174. package/src/util/string-utils.js +22 -1
  175. package/src/util/url-utils.js +23 -1
  176. package/src/util/user-agent-parser.js +85 -1
  177. package/src/util/validation-utils.js +136 -1
  178. package/src/util/window-utils.js +35 -1
@@ -1 +1,23 @@
1
- import e from"../managers/braze-instance.js";import HtmlMessage from"./models/html-message.js";import pe from"./in-app-message-manager-factory.js";import r from"../../shared-lib/braze-shared-lib.js";import V from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as W}from"../triggers/triggers-provider-factory.js";export function logInAppMessageHtmlClick(s,t,o){if(!e.rr())return!1;if(!(s instanceof HtmlMessage))return r.D.error("inAppMessage argument to logInAppMessageHtmlClick must be an HtmlMessage object."),!1;let m=r.A.Re;null!=t&&(m=r.A.He);const i=pe.m().G(s,m,t,o);if(i.S)for(let r=0;r<i.ve.length;r++)W.er().je(V.Ar,[s.triggerId,t],i.ve[r]);return i.S}
1
+ import e from "../managers/braze-instance.js";
2
+ import HtmlMessage from "./models/html-message.js";
3
+ import pe from "./in-app-message-manager-factory.js";
4
+ import r from "../../shared-lib/braze-shared-lib.js";
5
+ import V from "../triggers/models/trigger-events.js";
6
+ import { TriggersProviderFactory as W } from "../triggers/triggers-provider-factory.js";
7
+ export function logInAppMessageHtmlClick(s, t, o) {
8
+ if (!e.rr()) return !1;
9
+ if (!(s instanceof HtmlMessage))
10
+ return (
11
+ r.D.error(
12
+ "inAppMessage argument to logInAppMessageHtmlClick must be an HtmlMessage object."
13
+ ),
14
+ !1
15
+ );
16
+ let m = r.A.pi;
17
+ null != t && (m = r.A.mi);
18
+ const i = pe.m().G(s, m, t, o);
19
+ if (i.S)
20
+ for (let r = 0; r < i.ve.length; r++)
21
+ W.er().je(V.Ar, [s.triggerId, t], i.ve[r]);
22
+ return i.S;
23
+ }
@@ -1 +1,13 @@
1
- import e from"../managers/braze-instance.js";import ControlMessage from"./models/control-message.js";import InAppMessage from"./models/in-app-message.js";import pe from"./in-app-message-manager-factory.js";import{MUST_BE_IN_APP_MESSAGE_WARNING as tr}from"../common/constants.js";import r from"../../shared-lib/braze-shared-lib.js";export function logInAppMessageImpression(o){if(!e.rr())return!1;if(!(o instanceof InAppMessage||o instanceof ControlMessage))return r.D.error(tr),!1;const s=o instanceof ControlMessage?r.A.ro:r.A.Je;return pe.m().G(o,s).S}
1
+ import e from "../managers/braze-instance.js";
2
+ import ControlMessage from "./models/control-message.js";
3
+ import InAppMessage from "./models/in-app-message.js";
4
+ import pe from "./in-app-message-manager-factory.js";
5
+ import { MUST_BE_IN_APP_MESSAGE_WARNING as or } from "../common/constants.js";
6
+ import r from "../../shared-lib/braze-shared-lib.js";
7
+ export function logInAppMessageImpression(o) {
8
+ if (!e.rr()) return !1;
9
+ if (!(o instanceof InAppMessage || o instanceof ControlMessage))
10
+ return r.D.error(or), !1;
11
+ const s = o instanceof ControlMessage ? r.A.ro : r.A.gi;
12
+ return pe.m().G(o, s).S;
13
+ }
@@ -1 +1,8 @@
1
- export default class ControlMessage{constructor(t){this.triggerId=t}static fromJson(t){return new ControlMessage(t.trigger_id)}}
1
+ export default class ControlMessage {
2
+ constructor(t) {
3
+ this.triggerId = t;
4
+ }
5
+ static fromJson(t) {
6
+ return new ControlMessage(t.trigger_id);
7
+ }
8
+ }
@@ -1 +1,71 @@
1
- import InAppMessage from"./in-app-message.js";export default class FullScreenMessage extends InAppMessage{constructor(e,t,r,s,n,l,u,a,o,p,m,c,d,f,g,i,x,j,A,T,b,h,k,q,v,w,y,z){a=a||InAppMessage.DismissType.MANUAL,w=w||InAppMessage.Orientation.PORTRAIT,super(e,t,null,r,s,n,l,u,a,o,p,m,c,d,f,g,i,x,j,A,T,b,h,k,q,v=v||InAppMessage.CropType.CENTER_CROP,w,y,z)}get ke(){return InAppMessage.TextAlignment.CENTER}}FullScreenMessage.es=InAppMessage.es.Tr;
1
+ import InAppMessage from "./in-app-message.js";
2
+ export default class FullScreenMessage extends InAppMessage {
3
+ constructor(
4
+ e,
5
+ t,
6
+ r,
7
+ s,
8
+ n,
9
+ l,
10
+ u,
11
+ a,
12
+ o,
13
+ p,
14
+ m,
15
+ c,
16
+ d,
17
+ f,
18
+ g,
19
+ i,
20
+ x,
21
+ j,
22
+ A,
23
+ T,
24
+ b,
25
+ h,
26
+ k,
27
+ q,
28
+ v,
29
+ w,
30
+ y,
31
+ z
32
+ ) {
33
+ (a = a || InAppMessage.DismissType.MANUAL),
34
+ (w = w || InAppMessage.Orientation.PORTRAIT),
35
+ super(
36
+ e,
37
+ t,
38
+ null,
39
+ r,
40
+ s,
41
+ n,
42
+ l,
43
+ u,
44
+ a,
45
+ o,
46
+ p,
47
+ m,
48
+ c,
49
+ d,
50
+ f,
51
+ g,
52
+ i,
53
+ x,
54
+ j,
55
+ A,
56
+ T,
57
+ b,
58
+ h,
59
+ k,
60
+ q,
61
+ (v = v || InAppMessage.CropType.CENTER_CROP),
62
+ w,
63
+ y,
64
+ z
65
+ );
66
+ }
67
+ get Ce() {
68
+ return InAppMessage.TextAlignment.CENTER;
69
+ }
70
+ }
71
+ FullScreenMessage.es = InAppMessage.es.Tr;
@@ -1 +1,54 @@
1
- import InAppMessage from"./in-app-message.js";export default class HtmlMessage extends InAppMessage{constructor(l,e,n,u,s,a,t,i,r,o,m){u=u||InAppMessage.DismissType.MANUAL,null!=l&&l.length>0&&l.indexOf('"ab-in-app-message ab-html-message ab-email-capture"')>0&&l.indexOf('"ab-in-app-message ab-show ab-modal ab-effect-modal"')>0&&(a=!0,t=!0),super(l,null,null,e,n,null,null,null,u,s,null,null,null,null,null,null,null,null,a,t,null,null,null,i,void 0,void 0,void 0,r,o),this.messageFields=m}ll(){return!1}k(l){if(this.un===InAppMessage.es.el){if(this.nl)return!1;this.nl=!0}return this.lt.St(l),!0}}HtmlMessage.es=InAppMessage.es.el;
1
+ import InAppMessage from "./in-app-message.js";
2
+ export default class HtmlMessage extends InAppMessage {
3
+ constructor(l, e, n, u, s, a, t, i, r, o, m) {
4
+ (u = u || InAppMessage.DismissType.MANUAL),
5
+ null != l &&
6
+ l.length > 0 &&
7
+ l.indexOf('"ab-in-app-message ab-html-message ab-email-capture"') > 0 &&
8
+ l.indexOf('"ab-in-app-message ab-show ab-modal ab-effect-modal"') > 0 &&
9
+ ((a = !0), (t = !0)),
10
+ super(
11
+ l,
12
+ null,
13
+ null,
14
+ e,
15
+ n,
16
+ null,
17
+ null,
18
+ null,
19
+ u,
20
+ s,
21
+ null,
22
+ null,
23
+ null,
24
+ null,
25
+ null,
26
+ null,
27
+ null,
28
+ null,
29
+ a,
30
+ t,
31
+ null,
32
+ null,
33
+ null,
34
+ i,
35
+ void 0,
36
+ void 0,
37
+ void 0,
38
+ r,
39
+ o
40
+ ),
41
+ (this.messageFields = m);
42
+ }
43
+ ll() {
44
+ return !1;
45
+ }
46
+ k(l) {
47
+ if (this.un === InAppMessage.es.el) {
48
+ if (this.nl) return !1;
49
+ this.nl = !0;
50
+ }
51
+ return this.lt.St(l), !0;
52
+ }
53
+ }
54
+ HtmlMessage.es = InAppMessage.es.el;
@@ -1 +1,40 @@
1
- import InAppMessage from"./in-app-message.js";import u from"../../managers/subscription-manager.js";export default class InAppMessageButton{constructor(s,t,i,r,e,h,n){this.text=s||"",this.backgroundColor=t||InAppMessage.ji.bi,this.textColor=i||InAppMessage.ji.ki,this.borderColor=r||this.backgroundColor,this.clickAction=e||InAppMessage.ClickAction.NONE,this.uri=h,null==n&&(n=InAppMessageButton.Ue),this.id=n,this.nl=!1,this.lt=new u}subscribeToClickedEvent(s){return this.lt.ut(s)}removeSubscription(s){this.lt.removeSubscription(s)}removeAllSubscriptions(){this.lt.removeAllSubscriptions()}k(){return!this.nl&&(this.nl=!0,this.lt.St(),!0)}static fromJson(s){return new InAppMessageButton(s.text,s.bg_color,s.text_color,s.border_color,s.click_action,s.uri,s.id)}}InAppMessageButton.Ue=-1;
1
+ import InAppMessage from "./in-app-message.js";
2
+ import u from "../../managers/subscription-manager.js";
3
+ export default class InAppMessageButton {
4
+ constructor(s, t, i, r, e, h, n) {
5
+ (this.text = s || ""),
6
+ (this.backgroundColor = t || InAppMessage.xi.Ci),
7
+ (this.textColor = i || InAppMessage.xi.Ei),
8
+ (this.borderColor = r || this.backgroundColor),
9
+ (this.clickAction = e || InAppMessage.ClickAction.NONE),
10
+ (this.uri = h),
11
+ null == n && (n = InAppMessageButton.di),
12
+ (this.id = n),
13
+ (this.nl = !1),
14
+ (this.lt = new u());
15
+ }
16
+ subscribeToClickedEvent(s) {
17
+ return this.lt.ut(s);
18
+ }
19
+ removeSubscription(s) {
20
+ this.lt.removeSubscription(s);
21
+ }
22
+ removeAllSubscriptions() {
23
+ this.lt.removeAllSubscriptions();
24
+ }
25
+ k() {
26
+ return !this.nl && ((this.nl = !0), this.lt.St(), !0);
27
+ }
28
+ static fromJson(s) {
29
+ return new InAppMessageButton(
30
+ s.text,
31
+ s.bg_color,
32
+ s.text_color,
33
+ s.border_color,
34
+ s.click_action,
35
+ s.uri,
36
+ s.id
37
+ );
38
+ }
39
+ }
40
+ InAppMessageButton.di = -1;
@@ -1 +1,267 @@
1
- import e,{OPTIONS as T}from"../../managers/braze-instance.js";import et from"../../util/browser-detector.js";import{clickElement as Et,supportsPassive as Tt}from"../../util/dom-utils.js";import{KeyCodes as at}from"../../util/key-codes.js";import u from"../../managers/subscription-manager.js";export default class InAppMessage{constructor(t,s,i,e,h,n,r,o,l,E,T,a,m,c,I,A,N,_,L,d,O,S,D,M,R,b,P,C,U){this.message=t,this.messageAlignment=s||InAppMessage.TextAlignment.CENTER,this.duration=E||5e3,this.slideFrom=i||InAppMessage.SlideFrom.BOTTOM,this.extras=e||{},this.triggerId=h,this.clickAction=n||InAppMessage.ClickAction.NONE,this.uri=r,this.openTarget=o||InAppMessage.OpenTarget.NONE,this.dismissType=l||InAppMessage.DismissType.AUTO_DISMISS,this.icon=T,this.imageUrl=a,this.imageStyle=m||InAppMessage.ImageStyle.TOP,this.iconColor=c||InAppMessage.ji.ki,this.iconBackgroundColor=I||InAppMessage.ji.bi,this.backgroundColor=A||InAppMessage.ji.ki,this.textColor=N||InAppMessage.ji.Ei,this.closeButtonColor=_||InAppMessage.ji.Ti,this.animateIn=L,null==this.animateIn&&(this.animateIn=!0),this.animateOut=d,null==this.animateOut&&(this.animateOut=!0),this.header=O,this.headerAlignment=S||InAppMessage.TextAlignment.CENTER,this.headerTextColor=D||InAppMessage.ji.Ei,this.frameColor=M||InAppMessage.ji.Ii,this.buttons=R||[],this.cropType=b||InAppMessage.CropType.FIT_CENTER,this.orientation=P,this.htmlId=C,this.css=U,this.Ai=!1,this.nl=!1,this.Ni=!1,this.lt=new u,this._i=new u}subscribeToClickedEvent(t){return this.lt.ut(t)}subscribeToDismissedEvent(t){return this._i.ut(t)}removeSubscription(t){this.lt.removeSubscription(t),this._i.removeSubscription(t)}removeAllSubscriptions(){this.lt.removeAllSubscriptions(),this._i.removeAllSubscriptions()}closeMessage(){this.on(this.mn)}we(){return!0}ll(){return this.we()}an(){return null!=this.htmlId&&this.htmlId.length>4}sn(){return this.an()&&null!=this.css&&this.css.length>0}rn(){if(this.an()&&this.sn())return this.htmlId+"-css"}R(){return!this.Ai&&(this.Ai=!0,!0)}k(){return!this.nl&&(this.nl=!0,this.lt.St(),!0)}J(){return!this.Ni&&(this.Ni=!0,this._i.St(),!0)}Li(t){if(t&&t.parentNode){let s=t.closest(".ab-iam-root");if(null==s&&(s=t),this.we()&&null!=s.parentNode){const t=s.parentNode.classList;t&&t.contains(InAppMessage.Oi)&&t.remove(InAppMessage.Oi),document.body.removeEventListener("touchmove",InAppMessage.Si)}s.className=s.className.replace(InAppMessage.Di,InAppMessage._)}return this.animateOut}on(t,s){if(null==t)return;let i;this.mn=null,i=-1===t.className.indexOf("ab-in-app-message")?t.getElementsByClassName("ab-in-app-message")[0]:t;let e=!1;i&&(e=this.Li(i));const h=document.body;if(null!=h)var n=h.scrollTop;const r=()=>{if(t&&t.parentNode){let s=t.closest(".ab-iam-root");null==s&&(s=t),s.parentNode&&s.parentNode.removeChild(s)}if(null!=this.rn()){const t=document.getElementById(this.rn());t&&t.parentNode&&t.parentNode.removeChild(t)}null!=h&&"Safari"===et.browser&&(h.scrollTop=n),s?s():this.J()};e?setTimeout(r,InAppMessage.Mi):r(),this.he&&this.he.focus()}Me(){return document.createTextNode(this.message)}xe(t){let s="";this.message||this.header||!this.we()||(s="Modal Image"),t.setAttribute("alt",s)}static Si(t){t.targetTouches&&t.targetTouches.length>1||t.target.classList&&t.target.classList.contains("ab-message-text")&&t.target.scrollHeight>t.target.clientHeight||document.querySelector(`.${InAppMessage.Oi}`)&&t.preventDefault()}Ri(t){this.we()&&null!=t.parentNode&&this.orientation!==InAppMessage.Orientation.LANDSCAPE&&(null!=t.parentNode.classList&&t.parentNode.classList.add(InAppMessage.Oi),document.body.addEventListener("touchmove",InAppMessage.Si,!!Tt()&&{passive:!1})),t.className+=" "+InAppMessage.Di}static Pi(t){if(t.keyCode===at.Ci&&!e.nn(T.Ui)&&document.querySelectorAll(".ab-modal-interactions").length>0){const t=document.getElementsByClassName("ab-html-message");let s=!1;for(let i=0;i<t.length;i++){const e=t[i].contentWindow.document.getElementsByClassName("ab-programmatic-close-button")[0];null!=e&&(Et(e),s=!0)}if(!s){const t=document.querySelectorAll(".ab-modal-interactions > .ab-close-button")[0];null!=t&&Et(t)}}}Hi(){this.Fi||e.nn(T.Ui)||(document.addEventListener("keydown",InAppMessage.Pi,!1),e.Bi((()=>{document.removeEventListener("keydown",InAppMessage.Pi)})),this.Fi=!0)}}InAppMessage.ji={Ei:4281545523,ki:4294967295,bi:4278219733,Gi:4293914607,Wi:4283782485,Ii:3224580915,Ti:4288387995},InAppMessage.Oe={wi:"hd",yi:"ias",xi:"of",Ki:"do",ci:"umt",ui:"tf",Yi:"te"},InAppMessage.SlideFrom={TOP:"TOP",BOTTOM:"BOTTOM"},InAppMessage.ClickAction={NEWS_FEED:"NEWS_FEED",URI:"URI",NONE:"NONE"},InAppMessage.DismissType={AUTO_DISMISS:"AUTO_DISMISS",MANUAL:"SWIPE"},InAppMessage.OpenTarget={NONE:"NONE",BLANK:"BLANK"},InAppMessage.ImageStyle={TOP:"TOP",GRAPHIC:"GRAPHIC"},InAppMessage.Orientation={PORTRAIT:"PORTRAIT",LANDSCAPE:"LANDSCAPE"},InAppMessage.TextAlignment={START:"START",CENTER:"CENTER",END:"END"},InAppMessage.CropType={CENTER_CROP:"CENTER_CROP",FIT_CENTER:"FIT_CENTER"},InAppMessage.es={Xi:"SLIDEUP",zi:"MODAL",ye:"MODAL_STYLED",Tr:"FULL",el:"WEB_HTML",cn:"HTML"},InAppMessage.Mi=500,InAppMessage.Vi=200,InAppMessage.Di="ab-show",InAppMessage.$i="ab-hide",InAppMessage.Oi="ab-pause-scrolling";
1
+ import e, { OPTIONS as T } from "../../managers/braze-instance.js";
2
+ import ot from "../../util/browser-detector.js";
3
+ import {
4
+ clickElement as Et,
5
+ supportsPassive as Tt
6
+ } from "../../util/dom-utils.js";
7
+ import { KeyCodes as at } from "../../util/key-codes.js";
8
+ import u from "../../managers/subscription-manager.js";
9
+ export default class InAppMessage {
10
+ constructor(
11
+ t,
12
+ s,
13
+ i,
14
+ e,
15
+ h,
16
+ n,
17
+ r,
18
+ o,
19
+ l,
20
+ E,
21
+ T,
22
+ a,
23
+ m,
24
+ c,
25
+ I,
26
+ A,
27
+ N,
28
+ _,
29
+ L,
30
+ d,
31
+ O,
32
+ S,
33
+ D,
34
+ M,
35
+ R,
36
+ b,
37
+ P,
38
+ C,
39
+ U
40
+ ) {
41
+ (this.message = t),
42
+ (this.messageAlignment = s || InAppMessage.TextAlignment.CENTER),
43
+ (this.duration = E || 5e3),
44
+ (this.slideFrom = i || InAppMessage.SlideFrom.BOTTOM),
45
+ (this.extras = e || {}),
46
+ (this.triggerId = h),
47
+ (this.clickAction = n || InAppMessage.ClickAction.NONE),
48
+ (this.uri = r),
49
+ (this.openTarget = o || InAppMessage.OpenTarget.NONE),
50
+ (this.dismissType = l || InAppMessage.DismissType.AUTO_DISMISS),
51
+ (this.icon = T),
52
+ (this.imageUrl = a),
53
+ (this.imageStyle = m || InAppMessage.ImageStyle.TOP),
54
+ (this.iconColor = c || InAppMessage.xi.Ei),
55
+ (this.iconBackgroundColor = I || InAppMessage.xi.Ci),
56
+ (this.backgroundColor = A || InAppMessage.xi.Ei),
57
+ (this.textColor = N || InAppMessage.xi.Ni),
58
+ (this.closeButtonColor = _ || InAppMessage.xi.Li),
59
+ (this.animateIn = L),
60
+ null == this.animateIn && (this.animateIn = !0),
61
+ (this.animateOut = d),
62
+ null == this.animateOut && (this.animateOut = !0),
63
+ (this.header = O),
64
+ (this.headerAlignment = S || InAppMessage.TextAlignment.CENTER),
65
+ (this.headerTextColor = D || InAppMessage.xi.Ni),
66
+ (this.frameColor = M || InAppMessage.xi.Oi),
67
+ (this.buttons = R || []),
68
+ (this.cropType = b || InAppMessage.CropType.FIT_CENTER),
69
+ (this.orientation = P),
70
+ (this.htmlId = C),
71
+ (this.css = U),
72
+ (this.Ri = !1),
73
+ (this.nl = !1),
74
+ (this.Pi = !1),
75
+ (this.lt = new u()),
76
+ (this.Ui = new u());
77
+ }
78
+ subscribeToClickedEvent(t) {
79
+ return this.lt.ut(t);
80
+ }
81
+ subscribeToDismissedEvent(t) {
82
+ return this.Ui.ut(t);
83
+ }
84
+ removeSubscription(t) {
85
+ this.lt.removeSubscription(t), this.Ui.removeSubscription(t);
86
+ }
87
+ removeAllSubscriptions() {
88
+ this.lt.removeAllSubscriptions(), this.Ui.removeAllSubscriptions();
89
+ }
90
+ closeMessage() {
91
+ this.on(this.mn);
92
+ }
93
+ Me() {
94
+ return !0;
95
+ }
96
+ ll() {
97
+ return this.Me();
98
+ }
99
+ an() {
100
+ return null != this.htmlId && this.htmlId.length > 4;
101
+ }
102
+ sn() {
103
+ return this.an() && null != this.css && this.css.length > 0;
104
+ }
105
+ rn() {
106
+ if (this.an() && this.sn()) return this.htmlId + "-css";
107
+ }
108
+ R() {
109
+ return !this.Ri && ((this.Ri = !0), !0);
110
+ }
111
+ k() {
112
+ return !this.nl && ((this.nl = !0), this.lt.St(), !0);
113
+ }
114
+ J() {
115
+ return !this.Pi && ((this.Pi = !0), this.Ui.St(), !0);
116
+ }
117
+ Hi(t) {
118
+ if (t && t.parentNode) {
119
+ let s = t.closest(".ab-iam-root");
120
+ if ((null == s && (s = t), this.Me() && null != s.parentNode)) {
121
+ const t = s.parentNode.classList;
122
+ t && t.contains(InAppMessage.Fi) && t.remove(InAppMessage.Fi),
123
+ document.body.removeEventListener("touchmove", InAppMessage.Bi);
124
+ }
125
+ s.className = s.className.replace(InAppMessage.Gi, InAppMessage.Wi);
126
+ }
127
+ return this.animateOut;
128
+ }
129
+ on(t, s) {
130
+ if (null == t) return;
131
+ let i;
132
+ (this.mn = null),
133
+ (i =
134
+ -1 === t.className.indexOf("ab-in-app-message")
135
+ ? t.getElementsByClassName("ab-in-app-message")[0]
136
+ : t);
137
+ let e = !1;
138
+ i && (e = this.Hi(i));
139
+ const h = document.body;
140
+ if (null != h) var n = h.scrollTop;
141
+ const r = () => {
142
+ if (t && t.parentNode) {
143
+ let s = t.closest(".ab-iam-root");
144
+ null == s && (s = t), s.parentNode && s.parentNode.removeChild(s);
145
+ }
146
+ if (null != this.rn()) {
147
+ const t = document.getElementById(this.rn());
148
+ t && t.parentNode && t.parentNode.removeChild(t);
149
+ }
150
+ null != h && "Safari" === ot.browser && (h.scrollTop = n),
151
+ s ? s() : this.J();
152
+ };
153
+ e ? setTimeout(r, InAppMessage.Ki) : r(), this.ke && this.ke.focus();
154
+ }
155
+ Ae() {
156
+ return document.createTextNode(this.message);
157
+ }
158
+ Le(t) {
159
+ let s = "";
160
+ this.message || this.header || !this.Me() || (s = "Modal Image"),
161
+ t.setAttribute("alt", s);
162
+ }
163
+ static Bi(t) {
164
+ (t.targetTouches && t.targetTouches.length > 1) ||
165
+ (t.target.classList &&
166
+ t.target.classList.contains("ab-message-text") &&
167
+ t.target.scrollHeight > t.target.clientHeight) ||
168
+ (document.querySelector(`.${InAppMessage.Fi}`) && t.preventDefault());
169
+ }
170
+ Yi(t) {
171
+ this.Me() &&
172
+ null != t.parentNode &&
173
+ this.orientation !== InAppMessage.Orientation.LANDSCAPE &&
174
+ (null != t.parentNode.classList &&
175
+ t.parentNode.classList.add(InAppMessage.Fi),
176
+ document.body.addEventListener(
177
+ "touchmove",
178
+ InAppMessage.Bi,
179
+ !!Tt() && { passive: !1 }
180
+ )),
181
+ (t.className += " " + InAppMessage.Gi);
182
+ }
183
+ static Xi(t) {
184
+ if (
185
+ t.keyCode === at.Vi &&
186
+ !e.nn(T.qi) &&
187
+ document.querySelectorAll(".ab-modal-interactions").length > 0
188
+ ) {
189
+ const t = document.getElementsByClassName("ab-html-message");
190
+ let s = !1;
191
+ for (let i = 0; i < t.length; i++) {
192
+ const e = t[i].contentWindow.document.getElementsByClassName(
193
+ "ab-programmatic-close-button"
194
+ )[0];
195
+ null != e && (Et(e), (s = !0));
196
+ }
197
+ if (!s) {
198
+ const t = document.querySelectorAll(
199
+ ".ab-modal-interactions > .ab-close-button"
200
+ )[0];
201
+ null != t && Et(t);
202
+ }
203
+ }
204
+ }
205
+ Ji() {
206
+ this.Qi ||
207
+ e.nn(T.qi) ||
208
+ (document.addEventListener("keydown", InAppMessage.Xi, !1),
209
+ e.Zi(() => {
210
+ document.removeEventListener("keydown", InAppMessage.Xi);
211
+ }),
212
+ (this.Qi = !0));
213
+ }
214
+ }
215
+ (InAppMessage.xi = {
216
+ Ni: 4281545523,
217
+ Ei: 4294967295,
218
+ Ci: 4278219733,
219
+ th: 4293914607,
220
+ sh: 4283782485,
221
+ Oi: 3224580915,
222
+ Li: 4288387995
223
+ }),
224
+ (InAppMessage.li = {
225
+ ih: "hd",
226
+ eh: "ias",
227
+ hh: "of",
228
+ nh: "do",
229
+ ki: "umt",
230
+ zi: "tf",
231
+ rh: "te"
232
+ }),
233
+ (InAppMessage.SlideFrom = { TOP: "TOP", BOTTOM: "BOTTOM" }),
234
+ (InAppMessage.ClickAction = {
235
+ NEWS_FEED: "NEWS_FEED",
236
+ URI: "URI",
237
+ NONE: "NONE"
238
+ }),
239
+ (InAppMessage.DismissType = {
240
+ AUTO_DISMISS: "AUTO_DISMISS",
241
+ MANUAL: "SWIPE"
242
+ }),
243
+ (InAppMessage.OpenTarget = { NONE: "NONE", BLANK: "BLANK" }),
244
+ (InAppMessage.ImageStyle = { TOP: "TOP", GRAPHIC: "GRAPHIC" }),
245
+ (InAppMessage.Orientation = { PORTRAIT: "PORTRAIT", LANDSCAPE: "LANDSCAPE" }),
246
+ (InAppMessage.TextAlignment = {
247
+ START: "START",
248
+ CENTER: "CENTER",
249
+ END: "END"
250
+ }),
251
+ (InAppMessage.CropType = {
252
+ CENTER_CROP: "CENTER_CROP",
253
+ FIT_CENTER: "FIT_CENTER"
254
+ }),
255
+ (InAppMessage.es = {
256
+ oh: "SLIDEUP",
257
+ lh: "MODAL",
258
+ Ke: "MODAL_STYLED",
259
+ Tr: "FULL",
260
+ el: "WEB_HTML",
261
+ cn: "HTML"
262
+ }),
263
+ (InAppMessage.Ki = 500),
264
+ (InAppMessage.Eh = 200),
265
+ (InAppMessage.Gi = "ab-show"),
266
+ (InAppMessage.Wi = "ab-hide"),
267
+ (InAppMessage.Fi = "ab-pause-scrolling");
@@ -1 +1,68 @@
1
- import InAppMessage from"./in-app-message.js";export default class ModalMessage extends InAppMessage{constructor(e,t,r,s,n,l,o,u,a,p,d,i,m,c,f,g,x,j,v,A,T,b,h,k,q,w,y){super(e,t,null,r,s,n,l,o,u=u||InAppMessage.DismissType.MANUAL,a,p,d,i,m,c,f,g,x,j,v,A,T,b,h,k,q=q||InAppMessage.CropType.FIT_CENTER,void 0,w,y)}get ke(){return InAppMessage.TextAlignment.CENTER}}ModalMessage.es=InAppMessage.es.zi;
1
+ import InAppMessage from "./in-app-message.js";
2
+ export default class ModalMessage extends InAppMessage {
3
+ constructor(
4
+ e,
5
+ t,
6
+ r,
7
+ s,
8
+ n,
9
+ l,
10
+ o,
11
+ u,
12
+ a,
13
+ p,
14
+ d,
15
+ i,
16
+ m,
17
+ c,
18
+ f,
19
+ g,
20
+ x,
21
+ j,
22
+ v,
23
+ A,
24
+ T,
25
+ b,
26
+ h,
27
+ k,
28
+ q,
29
+ w,
30
+ y
31
+ ) {
32
+ super(
33
+ e,
34
+ t,
35
+ null,
36
+ r,
37
+ s,
38
+ n,
39
+ l,
40
+ o,
41
+ (u = u || InAppMessage.DismissType.MANUAL),
42
+ a,
43
+ p,
44
+ d,
45
+ i,
46
+ m,
47
+ c,
48
+ f,
49
+ g,
50
+ x,
51
+ j,
52
+ v,
53
+ A,
54
+ T,
55
+ b,
56
+ h,
57
+ k,
58
+ (q = q || InAppMessage.CropType.FIT_CENTER),
59
+ void 0,
60
+ w,
61
+ y
62
+ );
63
+ }
64
+ get Ce() {
65
+ return InAppMessage.TextAlignment.CENTER;
66
+ }
67
+ }
68
+ ModalMessage.es = InAppMessage.es.lh;
@@ -1 +1,58 @@
1
- import InAppMessage from"./in-app-message.js";import{DOMUtils as dt}from"../../util/dom-utils.js";export default class SlideUpMessage extends InAppMessage{constructor(t,e,o,s,n,i,r,d,u,a,p,l,m,c,v,x,g,f,h,I,M){x=x||InAppMessage.ji.Wi,v=v||InAppMessage.ji.Gi,super(t,e=e||InAppMessage.TextAlignment.START,o,s,n,i,r,d,u,a,p,l,null,m,c,v,x,g,f,h,void 0,void 0,void 0,void 0,void 0,void 0,void 0,I,M)}we(){return!1}get ke(){return InAppMessage.TextAlignment.START}Me(){const t=document.createElement("span");return t.appendChild(document.createTextNode(this.message)),t}Ri(t){const e=t.getElementsByClassName("ab-in-app-message")[0];dt.eo(e,!0,!0)||(this.slideFrom===InAppMessage.SlideFrom.TOP?e.style.top="0px":e.style.bottom="0px"),super.Ri(t)}}SlideUpMessage.es=InAppMessage.es.Xi;
1
+ import InAppMessage from "./in-app-message.js";
2
+ import { DOMUtils as vt } from "../../util/dom-utils.js";
3
+ export default class SlideUpMessage extends InAppMessage {
4
+ constructor(t, e, o, s, n, i, r, d, u, a, p, l, m, c, v, x, g, f, h, I, M) {
5
+ (x = x || InAppMessage.xi.sh),
6
+ (v = v || InAppMessage.xi.th),
7
+ super(
8
+ t,
9
+ (e = e || InAppMessage.TextAlignment.START),
10
+ o,
11
+ s,
12
+ n,
13
+ i,
14
+ r,
15
+ d,
16
+ u,
17
+ a,
18
+ p,
19
+ l,
20
+ null,
21
+ m,
22
+ c,
23
+ v,
24
+ x,
25
+ g,
26
+ f,
27
+ h,
28
+ void 0,
29
+ void 0,
30
+ void 0,
31
+ void 0,
32
+ void 0,
33
+ void 0,
34
+ void 0,
35
+ I,
36
+ M
37
+ );
38
+ }
39
+ Me() {
40
+ return !1;
41
+ }
42
+ get Ce() {
43
+ return InAppMessage.TextAlignment.START;
44
+ }
45
+ Ae() {
46
+ const t = document.createElement("span");
47
+ return t.appendChild(document.createTextNode(this.message)), t;
48
+ }
49
+ Yi(t) {
50
+ const e = t.getElementsByClassName("ab-in-app-message")[0];
51
+ vt.eo(e, !0, !0) ||
52
+ (this.slideFrom === InAppMessage.SlideFrom.TOP
53
+ ? (e.style.top = "0px")
54
+ : (e.style.bottom = "0px")),
55
+ super.Yi(t);
56
+ }
57
+ }
58
+ SlideUpMessage.es = InAppMessage.es.oh;
@@ -1 +1,14 @@
1
- export default class ft{constructor(t,s,l,n,i){this.triggerId=t,this.fi=s,this.pi=l,this.di=n,this.vi=i}static fromJson(t,s,l,n,i){return null==t||null==t.trigger_id?null:new ft(t.trigger_id,s,l,n,i)}}
1
+ export default class wt {
2
+ constructor(t, s, l, n, i) {
3
+ (this.triggerId = t),
4
+ (this.wi = s),
5
+ (this.Di = l),
6
+ (this.Si = n),
7
+ (this.$i = i);
8
+ }
9
+ static fromJson(t, s, l, n, i) {
10
+ return null == t || null == t.trigger_id
11
+ ? null
12
+ : new wt(t.trigger_id, s, l, n, i);
13
+ }
14
+ }
@@ -1 +1,10 @@
1
- import e from"../managers/braze-instance.js";import pe from"./in-app-message-manager-factory.js";export function subscribeToInAppMessage(n){if(e.rr())return"function"!=typeof n?null:pe.m().Ee((function(r){return n(r[0]),r.slice(1)}))}
1
+ import e from "../managers/braze-instance.js";
2
+ import pe from "./in-app-message-manager-factory.js";
3
+ export function subscribeToInAppMessage(n) {
4
+ if (e.rr())
5
+ return "function" != typeof n
6
+ ? null
7
+ : pe.m().We(function(r) {
8
+ return n(r[0]), r.slice(1);
9
+ });
10
+ }
@@ -1 +1,15 @@
1
- import pe from"../in-app-message-manager-factory.js";import e from"../../managers/braze-instance.js";import{setupInAppMessageUI as ss}from"../../ui/js/index.js";import{showInAppMessage}from"./show-in-app-message.js";import{subscribeToInAppMessage}from"../subscribe-to-in-app-message.js";export function automaticallyShowInAppMessages(){if(!e.rr())return;ss();const s=pe.m();if(null==s.Fe()){const r=subscribeToInAppMessage((s=>showInAppMessage(s)));s.Ne(r)}return s.Fe()}
1
+ import pe from "../in-app-message-manager-factory.js";
2
+ import e from "../../managers/braze-instance.js";
3
+ import { setupInAppMessageUI as ss } from "../../ui/js/index.js";
4
+ import { showInAppMessage } from "./show-in-app-message.js";
5
+ import { subscribeToInAppMessage } from "../subscribe-to-in-app-message.js";
6
+ export function automaticallyShowInAppMessages() {
7
+ if (!e.rr()) return;
8
+ ss();
9
+ const s = pe.m();
10
+ if (null == s.Xe()) {
11
+ const r = subscribeToInAppMessage(s => showInAppMessage(s));
12
+ s.Ze(r);
13
+ }
14
+ return s.Xe();
15
+ }