@braze/web-sdk 3.5.0 → 4.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 (169) hide show
  1. package/README.md +5 -11
  2. package/index.d.ts +472 -547
  3. package/package.json +9 -7
  4. package/shared-lib/braze-shared-lib.js +1 -0
  5. package/shared-lib/encoding-utils.js +1 -0
  6. package/shared-lib/event-types.js +1 -0
  7. package/shared-lib/guid.js +1 -0
  8. package/shared-lib/indexed-db-adapter.js +1 -0
  9. package/shared-lib/logger.js +1 -0
  10. package/shared-lib/supported-options.js +1 -0
  11. package/src/Card/card-manager-factory.js +1 -0
  12. package/src/Card/card-manager.js +1 -0
  13. package/src/Card/display/card-display.js +1 -0
  14. package/src/Card/index.js +1 -0
  15. package/src/Card/log-card-click.js +1 -0
  16. package/src/Card/log-card-dismissal.js +1 -0
  17. package/src/Card/log-card-impressions.js +1 -0
  18. package/src/Card/models/banner.js +1 -0
  19. package/src/Card/models/captioned-image.js +1 -0
  20. package/src/Card/models/card.js +1 -0
  21. package/src/Card/models/classic-card.js +1 -0
  22. package/src/Card/models/control-card.js +1 -0
  23. package/src/Card/models/index.js +1 -0
  24. package/src/Card/util/card-factory.js +1 -0
  25. package/src/ContentCards/content-cards-provider-factory.js +1 -0
  26. package/src/ContentCards/content-cards-provider.js +1 -0
  27. package/src/ContentCards/content-cards.js +1 -0
  28. package/src/ContentCards/get-cached-content-cards.js +1 -0
  29. package/src/ContentCards/index.js +1 -0
  30. package/src/ContentCards/log-content-cards-displayed.js +1 -0
  31. package/src/ContentCards/request-content-cards-refresh.js +1 -0
  32. package/src/ContentCards/subscribe-to-content-cards-updates.js +1 -0
  33. package/src/ContentCards/ui/hide-content-cards.js +1 -0
  34. package/src/ContentCards/ui/show-content-cards.js +1 -0
  35. package/src/ContentCards/ui/toggle-content-cards.js +1 -0
  36. package/src/Core/add-sdk-metadata.js +1 -0
  37. package/src/Core/braze-sdk-metadata.js +1 -0
  38. package/src/Core/change-user.js +1 -0
  39. package/src/Core/destroy.js +1 -0
  40. package/src/Core/device-properties.js +1 -0
  41. package/src/Core/disable-sdk.js +1 -0
  42. package/src/Core/enable-sdk.js +1 -0
  43. package/src/Core/get-device-id.js +1 -0
  44. package/src/Core/get-user.js +1 -0
  45. package/src/Core/handle-braze-action.js +1 -0
  46. package/src/Core/index.js +1 -0
  47. package/src/Core/initialize.js +1 -0
  48. package/src/Core/is-disabled.js +1 -0
  49. package/src/Core/log-custom-event.js +1 -0
  50. package/src/Core/log-purchase.js +1 -0
  51. package/src/Core/open-session.js +1 -0
  52. package/src/Core/remove-all-subscriptions.js +1 -0
  53. package/src/Core/remove-subscription.js +1 -0
  54. package/src/Core/request-immediate-data-flush.js +1 -0
  55. package/src/Core/set-logger.js +1 -0
  56. package/src/Core/set-sdk-authentication-signature.js +1 -0
  57. package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -0
  58. package/src/Core/toggle-logging.js +1 -0
  59. package/src/Core/wipe-data.js +1 -0
  60. package/src/Feed/feed-provider-factory.js +1 -0
  61. package/src/Feed/feed-provider.js +1 -0
  62. package/src/Feed/feed.js +1 -0
  63. package/src/Feed/get-cached-feed.js +1 -0
  64. package/src/Feed/index.js +1 -0
  65. package/src/Feed/log-feed-displayed.js +1 -0
  66. package/src/Feed/request-feed-refresh.js +1 -0
  67. package/src/Feed/subscribe-to-feed-updates.js +1 -0
  68. package/src/Feed/ui/hide-feed.js +1 -0
  69. package/src/Feed/ui/show-feed.js +1 -0
  70. package/src/Feed/ui/toggle-feed.js +1 -0
  71. package/src/InAppMessage/display/get-animation-effect.js +1 -0
  72. package/src/InAppMessage/display/html-message-to-html.js +1 -0
  73. package/src/InAppMessage/display/in-app-message-to-html.js +1 -0
  74. package/src/InAppMessage/display/modal-utils.js +1 -0
  75. package/src/InAppMessage/in-app-message-factory.js +1 -0
  76. package/src/InAppMessage/in-app-message-manager-factory.js +1 -0
  77. package/src/InAppMessage/in-app-message-manager.js +1 -0
  78. package/src/InAppMessage/index.js +1 -0
  79. package/src/InAppMessage/log-in-app-message-button-click.js +1 -0
  80. package/src/InAppMessage/log-in-app-message-click.js +1 -0
  81. package/src/InAppMessage/log-in-app-message-html-click.js +1 -0
  82. package/src/InAppMessage/log-in-app-message-impression.js +1 -0
  83. package/src/InAppMessage/models/control-message.js +1 -0
  84. package/src/InAppMessage/models/full-screen-message.js +1 -0
  85. package/src/InAppMessage/models/html-message.js +1 -0
  86. package/src/InAppMessage/models/in-app-message-button.js +1 -0
  87. package/src/InAppMessage/models/in-app-message.js +1 -0
  88. package/src/InAppMessage/models/modal-message.js +1 -0
  89. package/src/InAppMessage/models/slide-up-message.js +1 -0
  90. package/src/InAppMessage/models/templated-in-app-message.js +1 -0
  91. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -0
  92. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +1 -0
  93. package/src/InAppMessage/ui/show-in-app-message.js +1 -0
  94. package/src/Push/index.js +1 -0
  95. package/src/Push/is-push-blocked.js +1 -0
  96. package/src/Push/is-push-permission-granted.js +1 -0
  97. package/src/Push/is-push-supported.js +1 -0
  98. package/src/Push/push-manager-factory.js +1 -0
  99. package/src/Push/push-manager.js +1 -0
  100. package/src/Push/request-push-permission.js +1 -0
  101. package/src/Push/unregister-push.js +1 -0
  102. package/src/User/index.js +1 -0
  103. package/src/User/user-manager.js +1 -0
  104. package/src/User/user.js +1 -0
  105. package/src/common/base-feed.js +1 -0
  106. package/src/common/base-provider.js +1 -0
  107. package/src/common/constants.js +1 -0
  108. package/src/common/event-logger.js +1 -0
  109. package/src/common/feed-display.js +1 -0
  110. package/src/common/translations.js +1 -0
  111. package/src/index.js +1 -0
  112. package/src/l10n/l10n-manager-factory.js +1 -0
  113. package/src/l10n/l10n-manager.js +1 -0
  114. package/src/managers/auth-manager.js +1 -0
  115. package/src/managers/braze-instance.js +1 -0
  116. package/src/managers/device-manager.js +1 -0
  117. package/src/managers/network-manager.js +1 -0
  118. package/src/managers/server-config-manager.js +1 -0
  119. package/src/managers/session-manager.js +1 -0
  120. package/src/managers/storage-manager-factory.js +1 -0
  121. package/src/managers/storage-manager.js +1 -0
  122. package/src/managers/subscription-manager.js +1 -0
  123. package/src/models/backend-errors.js +1 -0
  124. package/src/models/braze-event.js +1 -0
  125. package/src/models/braze-sdk-metadata.js +1 -0
  126. package/src/models/device.js +1 -0
  127. package/src/models/identifier.js +1 -0
  128. package/src/models/push-token.js +1 -0
  129. package/src/models/request-result.js +1 -0
  130. package/src/models/server-config.js +1 -0
  131. package/src/request-controller.js +1 -0
  132. package/src/triggers/models/custom-event-data.js +1 -0
  133. package/src/triggers/models/custom-event-property-data.js +1 -0
  134. package/src/triggers/models/filter-set.js +1 -0
  135. package/src/triggers/models/filter.js +1 -0
  136. package/src/triggers/models/in-app-message-click-data.js +1 -0
  137. package/src/triggers/models/purchase-data.js +1 -0
  138. package/src/triggers/models/purchase-property-data.js +1 -0
  139. package/src/triggers/models/push-click-data.js +1 -0
  140. package/src/triggers/models/trigger-condition.js +1 -0
  141. package/src/triggers/models/trigger-events.js +1 -0
  142. package/src/triggers/models/trigger.js +1 -0
  143. package/src/triggers/triggers-provider-factory.js +1 -0
  144. package/src/triggers/triggers-provider.js +1 -0
  145. package/src/ui/js/attach-css.js +1 -0
  146. package/src/ui/js/feed-css.js +1 -0
  147. package/src/ui/js/iam-css.js +1 -0
  148. package/src/ui/js/index.js +1 -0
  149. package/src/ui/js/load-font-awesome.js +1 -0
  150. package/src/util/base-device-parser.js +1 -0
  151. package/src/util/braze-actions.js +1 -0
  152. package/src/util/browser-detector.js +1 -0
  153. package/src/util/client-hints-parser.js +1 -0
  154. package/src/util/code-utils.js +1 -0
  155. package/src/util/color-utils.js +1 -0
  156. package/src/util/component-utils.js +1 -0
  157. package/src/util/date-utils.js +1 -0
  158. package/src/util/deprecation-utils.js +1 -0
  159. package/src/util/device-constants.js +1 -0
  160. package/src/util/dom-utils.js +1 -0
  161. package/src/util/key-codes.js +1 -0
  162. package/src/util/math.js +1 -0
  163. package/src/util/net.js +1 -0
  164. package/src/util/string-utils.js +1 -0
  165. package/src/util/url-utils.js +1 -0
  166. package/src/util/user-agent-parser.js +1 -0
  167. package/src/util/validation-utils.js +1 -0
  168. package/src/util/window-utils.js +1 -0
  169. package/appboy.min.js +0 -278
package/index.d.ts CHANGED
@@ -1,19 +1,44 @@
1
1
  /*
2
- * Type definitions for appboy-web-sdk v3.5.0
3
- * Project: https://github.com/Appboy/appboy-web-sdk
2
+ * Type definitions for @braze/web-sdk v4.0.1
3
+ * Project: https://github.com/braze-inc/braze-web-sdk
4
4
  * (c) Braze, Inc. 2022 - http://braze.com
5
- * License available at https://github.com/Appboy/appboy-web-sdk/blob/master/LICENSE
5
+ * License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
6
6
  */
7
7
 
8
- declare namespace appboy {
9
- /**
10
- * Enum to represent the allowlistable set of device properties. By default, all properties are collected.
11
- * See the `devicePropertyAllowlist` option of `appboy.initialize` for more info.
12
8
 
9
+ /**
10
+ * Enum to represent the accepted SDK Metadata tags. See `addSdkMetadata` for more info.
11
+ *
13
12
  * @readonly
14
13
  * @enum {string}
15
14
  */
16
- class DeviceProperties {
15
+ export class BrazeSdkMetadata {
16
+ /** Automatically added when loading Braze via Google Tag Manager */
17
+ static readonly GOOGLE_TAG_MANAGER: string;
18
+ /** Automatically added when loading Braze via mParticle */
19
+ static readonly MPARTICLE: string;
20
+ /** Automatically added when loading Braze via Segment */
21
+ static readonly SEGMENT: string;
22
+ /** Automatically added when loading Braze via Tealium */
23
+ static readonly TEALIUM: string;
24
+ /** Automatically added when loading Braze via npm */
25
+ static readonly NPM: string;
26
+ /** Automatically added when loading Braze via Braze's CDN (js.appboycdn.com) */
27
+ static readonly CDN: string;
28
+ /** Automatically added when loading Braze via Shopify Integration */
29
+ static readonly SHOPIFY: string;
30
+ /** Use this tag if you have integrated or loaded the Braze Web SDK using none of the other methods */
31
+ static readonly MANUAL: string;
32
+ }
33
+
34
+ /**
35
+ * Enum to represent the allowlistable set of device properties. By default, all properties are collected.
36
+ * See the `devicePropertyAllowlist` option of `initialize` for more info.
37
+
38
+ * @readonly
39
+ * @enum {string}
40
+ */
41
+ export class DeviceProperties {
17
42
  /** The name of the browser - e.g. "Chrome" */
18
43
  static readonly BROWSER: string;
19
44
  /** The version of the browser - e.g. "59.234.1234" */
@@ -31,33 +56,10 @@ declare namespace appboy {
31
56
  }
32
57
 
33
58
  /**
34
- * Enum to represent the accepted SDK Metadata tags. See `appboy.addSdkMetadata` for more info.
35
- *
36
- * @readonly
37
- * @enum {string}
38
- */
39
- class BrazeSdkMetadata {
40
- /** Use this tag if you have integrated the Braze Web SDK using Google Tag Manager */
41
- static readonly GOOGLE_TAG_MANAGER: string;
42
- /** Use this tag if you have integrated the Braze Web SDK using mParticle */
43
- static readonly MPARTICLE: string;
44
- /** Use this tag if you have integrated the Braze Web SDK using Segment */
45
- static readonly SEGMENT: string;
46
- /** Use this tag if you have integrated the Braze Web SDK using Tealium */
47
- static readonly TEALIUM: string;
48
- /** Use this tag if you have imported the Braze Web SDK using npm */
49
- static readonly NPM: string;
50
- /** Use this tag if you have loaded the Braze Web SDK using Braze's CDN (js.appboycdn.com) */
51
- static readonly CDN: string;
52
- /** Use this tag if you have integrated or loaded the Braze Web SDK using none of the other methods */
53
- static readonly MANUAL: string;
54
- }
55
-
56
- /**
57
- * Abstract base for news feed cards. Use subclasses `ClassicCard`, `CaptionedImage`,
59
+ * Abstract base for news feed and Content Cards cards. Use subclasses `ClassicCard`, `CaptionedImage`,
58
60
  * `Banner`, and `ControlCard`.
59
61
  */
60
- class Card {
62
+ export class Card {
61
63
  /**
62
64
  * Call this method if you wish to programmatically remove the card from the feed and log a dismissal. This method
63
65
  * is meant to be used with the Braze UI.
@@ -120,13 +122,13 @@ declare namespace appboy {
120
122
  /** Whether to pin this card to the top of the view. */
121
123
  pinned: boolean;
122
124
 
123
- static fromContentCardsJson(jsonData: Record<string, unknown>): Card | undefined;
125
+
124
126
  }
125
127
 
126
- class Banner extends Card {
128
+ export class Banner extends Card {
127
129
  /**
128
- * A card with only an image, which can be passed to `display.showFeed` or handled manually.
129
- * Subscribe to receive new cards via `appboy.subscribeToFeedUpdates`
130
+ * A card with only an image, which can be passed to `showFeed` or handled manually.
131
+ * Subscribe to receive new cards via `subscribeToFeedUpdates`
130
132
  *
131
133
  * @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
132
134
  * @param viewed - Whether this card has been shown to the user.
@@ -138,7 +140,8 @@ declare namespace appboy {
138
140
  * @param expiresAt - When this card expires and should stop being shown to the user.
139
141
  * @param url - A url to open when this card is clicked.
140
142
  * @param linkText - The display text for the url.
141
- * @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances.
143
+ * @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before
144
+ * image loading completes. Note that the field may not be supplied in certain circumstances.
142
145
  * @param extras - Object of string/string key/value pairs.
143
146
  * @param pinned - Whether to pin this card to the top of the view.
144
147
  * @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
@@ -179,7 +182,10 @@ declare namespace appboy {
179
182
  /** The display text for the url. */
180
183
  linkText?: string;
181
184
 
182
- /** The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances. */
185
+ /**
186
+ * The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes.
187
+ * Note that the field may not be supplied in certain circumstances.
188
+ * */
183
189
  aspectRatio: number | null;
184
190
 
185
191
  /** Whether this card has been dismissed. */
@@ -192,10 +198,10 @@ declare namespace appboy {
192
198
  clicked: boolean;
193
199
  }
194
200
 
195
- class CaptionedImage extends Card {
201
+ export class CaptionedImage extends Card {
196
202
  /**
197
- * A card with a large image and descriptive text, which can be passed to `display.showFeed` or handled manually.
198
- * Subscribe to receive new cards via `appboy.subscribeToFeedUpdates`.
203
+ * A card with a large image and descriptive text, which can be passed to `showFeed` or handled manually.
204
+ * Subscribe to receive new cards via `subscribeToFeedUpdates`.
199
205
  *
200
206
  * @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
201
207
  * @param viewed - Whether this card has been shown to the user.
@@ -209,7 +215,8 @@ declare namespace appboy {
209
215
  * @param expiresAt - When this card expires and should stop being shown to the user.
210
216
  * @param url - A url to open when this card is clicked.
211
217
  * @param linkText - The display text for the url.
212
- * @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances.
218
+ * @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before
219
+ * image loading completes. Note that the field may not be supplied in certain circumstances.
213
220
  * @param extras - Object of string/string key/value pairs.
214
221
  * @param pinned - Whether to pin this card to the top of the view.
215
222
  * @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
@@ -258,7 +265,10 @@ declare namespace appboy {
258
265
  /** The display text for the url. */
259
266
  linkText?: string;
260
267
 
261
- /** The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances. */
268
+ /**
269
+ * The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes.
270
+ * Note that the field may not be supplied in certain circumstances.
271
+ */
262
272
  aspectRatio: number | null;
263
273
 
264
274
  /** Whether this card has been dismissed. */
@@ -271,11 +281,11 @@ declare namespace appboy {
271
281
  clicked: boolean;
272
282
  }
273
283
 
274
- class ClassicCard extends Card {
284
+ export class ClassicCard extends Card {
275
285
  /**
276
286
  * A card with a title, body, and optionally a small image, which can be passed to
277
- * `display.showFeed` or handled manually.
278
- * Subscribe to receive new cards via `appboy.subscribeToFeedUpdates`.
287
+ * `showFeed` or handled manually.
288
+ * Subscribe to receive new cards via `subscribeToFeedUpdates`.
279
289
  *
280
290
  * @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
281
291
  * @param viewed - Whether this card has been shown to the user.
@@ -289,7 +299,8 @@ declare namespace appboy {
289
299
  * @param expiresAt - When this card expires and should stop being shown to the user.
290
300
  * @param url - A url to open when this card is clicked.
291
301
  * @param linkText - The display text for the url.
292
- * @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances.
302
+ * @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before
303
+ * image loading completes. Note that the field may not be supplied in certain circumstances.
293
304
  * @param extras - Object of string/string key/value pairs.
294
305
  * @param pinned - Whether to pin this card to the top of the view.
295
306
  * @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
@@ -338,7 +349,10 @@ declare namespace appboy {
338
349
  /** The display text for the url. */
339
350
  linkText?: string;
340
351
 
341
- /** The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances. */
352
+ /**
353
+ * The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes.
354
+ * Note that the field may not be supplied in certain circumstances.
355
+ */
342
356
  aspectRatio: number | null;
343
357
 
344
358
  /** Whether this card has been dismissed. */
@@ -351,12 +365,12 @@ declare namespace appboy {
351
365
  clicked: boolean;
352
366
  }
353
367
 
354
- class ControlCard extends Card {
368
+ export class ControlCard extends Card {
355
369
  /**
356
370
  * A card with no display that logs impressions, which can be passed to
357
- * `display.showFeed` or handled manually.
371
+ * `showFeed` or handled manually.
358
372
  * Not supported in legacy news feed.
359
- * Subscribe to receive new cards via `appboy.subscribeToFeedUpdates`.
373
+ * Subscribe to receive new cards via `subscribeToFeedUpdates`.
360
374
  *
361
375
  * @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
362
376
  * @param viewed - Whether this card has been shown to the user.
@@ -375,15 +389,15 @@ declare namespace appboy {
375
389
  );
376
390
  }
377
391
 
378
- class ContentCards {
392
+ export class ContentCards {
379
393
  /**
380
394
  * A collection of `Card` descendents (`ClassicCard`, `CaptionedImage`, `Banner`).
381
- * If you use Appboy's display module to render content cards, you generally shouldn't need to
395
+ * If you use Braze's UI to render content cards, you generally shouldn't need to
382
396
  * interact with this class, but if you are building your own content cards class manually, use
383
- * `appboy.getCachedContentCards` to get the most recent ContentCards object.
397
+ * `getCachedContentCards` to get the most recent ContentCards object.
384
398
  *
385
399
  * @param cards - Array of `Card` descendents (`ClassicCard`, `CaptionedImage`, `Banner`).
386
- * @param lastUpdated - When this collection of cards was received from Appboy servers. If null, it means the
400
+ * @param lastUpdated - When this collection of cards was received from Braze servers. If null, it means the
387
401
  * content cards are still being fetched for this user.
388
402
  */
389
403
  constructor(cards: Card[], lastUpdated: Date | null);
@@ -392,7 +406,7 @@ declare namespace appboy {
392
406
  cards: Card[];
393
407
 
394
408
  /**
395
- * When this collection of cards was received from Appboy servers. If null, it means the
409
+ * When this collection of cards was received from Braze servers. If null, it means the
396
410
  * content cards are still being fetched for this user.
397
411
  */
398
412
  lastUpdated: Date | null;
@@ -404,14 +418,14 @@ declare namespace appboy {
404
418
  getUnviewedCardCount(): number;
405
419
  }
406
420
 
407
- class Feed {
421
+ export class Feed {
408
422
  /**
409
423
  * A collection of `Card` descendents (`ClassicCard`, `CaptionedImage`, `Banner`).
410
- * Subscribe to receive feed updates via `appboy.subscribeToFeedUpdates`,
411
- * or get the currently cached feed with `appboy.getCachedFeed`.
424
+ * Subscribe to receive feed updates via `subscribeToFeedUpdates`,
425
+ * or get the currently cached feed with `getCachedFeed`.
412
426
  *
413
427
  * @param cards - Array of `Card` descendents (`ClassicCard`, `CaptionedImage`,
414
- * `Banner`). Can be passed directly to `display.showFeed`.
428
+ * `Banner`). Can be passed directly to `showFeed`.
415
429
  * @param lastUpdated - When this collection of cards was received from Braze servers. If null, it means the
416
430
  * feed has never been fetched for this user.
417
431
  */
@@ -419,12 +433,12 @@ declare namespace appboy {
419
433
 
420
434
  /**
421
435
  * Array of `Card` descendents (`ClassicCard`, `CaptionedImage`, `Banner`).
422
- * Can be passed directly to `display.showFeed`.
436
+ * Can be passed directly to `showFeed`.
423
437
  */
424
438
  cards: Card[];
425
439
 
426
440
  /**
427
- * When this collection of cards was received from Appboy servers. If null, it means the
441
+ * When this collection of cards was received from Braze servers. If null, it means the
428
442
  * content cards are still being fetched for this user.
429
443
  */
430
444
  lastUpdated: Date | null;
@@ -432,16 +446,16 @@ declare namespace appboy {
432
446
  /**
433
447
  * Get the current unread card count. This is useful for powering badges on your control for showing the news feed.
434
448
  * Note that Braze will not refresh news feed cards on new page loads (and so this function will return 0) until you
435
- * call `display.showFeed` or `appboy.requestFeedRefresh`. `ControlCard` cards do not count towards the
449
+ * call `showFeed` or `requestFeedRefresh`. `ControlCard` cards do not count towards the
436
450
  * unread count.
437
451
  */
438
452
  getUnreadCardCount(): number;
439
453
  }
440
454
 
441
- class ControlMessage {
455
+ export class ControlMessage {
442
456
  /**
443
457
  * A non-showing message placeholder that represents this user receiving the the control for a multivariate
444
- * test. Can be passed to `display.showInAppMessage` to log the user's
458
+ * test. Can be passed to `showInAppMessage` to log the user's
445
459
  * entrollment in the control or handled manually.
446
460
  *
447
461
  * @param triggerId - The id of the trigger that created this message. The SDK will report back this to
@@ -456,29 +470,35 @@ declare namespace appboy {
456
470
  triggerId?: string;
457
471
  }
458
472
 
459
- namespace InAppMessage {
460
- type SlideFrom = "TOP" | "BOTTOM";
473
+
474
+ type SlideFrom = typeof InAppMessage.SlideFrom[keyof typeof InAppMessage.SlideFrom];
461
475
 
462
- type ClickAction = "NEWS_FEED" | "URI" | "NONE";
476
+
477
+ type ClickAction = typeof InAppMessage.ClickAction[keyof typeof InAppMessage.ClickAction];
463
478
 
464
- type DismissType = "AUTO_DISMISS" | "SWIPE";
479
+
480
+ type DismissType = typeof InAppMessage.DismissType[keyof typeof InAppMessage.DismissType];
465
481
 
466
- type OpenTarget = "NONE" | "BLANK";
482
+
483
+ type OpenTarget = typeof InAppMessage.OpenTarget[keyof typeof InAppMessage.OpenTarget];
467
484
 
468
- type ImageStyle = "TOP" | "GRAPHIC";
485
+
486
+ type ImageStyle = typeof InAppMessage.ImageStyle[keyof typeof InAppMessage.ImageStyle];
469
487
 
470
- type Orientation = "PORTRAIT" | "LANDSCAPE";
488
+
489
+ type Orientation = typeof InAppMessage.Orientation[keyof typeof InAppMessage.Orientation];
471
490
 
472
- type TextAlignment = "START" | "CENTER" | "END";
491
+
492
+ type TextAlignment = typeof InAppMessage.TextAlignment[keyof typeof InAppMessage.TextAlignment];
473
493
 
474
- type CropType = "CENTER_CROP" | "FIT_CENTER";
475
- }
494
+
495
+ type CropType = typeof InAppMessage.CropType[keyof typeof InAppMessage.CropType];
476
496
 
477
497
  /**
478
498
  * Abstract base for in-app messages. Use subclasses `SlideUpMessage`,
479
499
  * `ModalMessage`, `FullScreenMessage`, and `HtmlMessage`.
480
500
  */
481
- class InAppMessage {
501
+ export class InAppMessage {
482
502
  static SlideFrom: {
483
503
  TOP: "TOP";
484
504
  BOTTOM: "BOTTOM";
@@ -537,19 +557,19 @@ declare namespace appboy {
537
557
 
538
558
  /**
539
559
  * The id of the trigger that created this message. The SDK will report back this to
540
- * Appboy with in-app message analytics events.
560
+ * Braze with in-app message analytics events.
541
561
  */
542
562
  triggerId?: string;
543
563
 
544
564
  /**
545
565
  * How the message is dismissed, via a timer or requiring interaction from the user.
546
- * See the `InAppMessage.DismissType` enum.
566
+ * See the `DismissType` enum.
547
567
  */
548
- dismissType: InAppMessage.DismissType;
568
+ dismissType: DismissType;
549
569
 
550
570
  /**
551
571
  * Length of time in milliseconds until auto-dismiss should occur. Only used when
552
- * dismissType is `InAppMessage.DismissType.AUTO_DISMISS`
572
+ * dismissType is `DismissType`.AUTO_DISMISS
553
573
  */
554
574
  duration: number;
555
575
 
@@ -609,39 +629,35 @@ declare namespace appboy {
609
629
  */
610
630
  subscribeToDismissedEvent(subscriber: () => void): string;
611
631
 
612
- static fromJson(jsonData: Record<string, unknown>): InAppMessage | undefined;
632
+
613
633
  }
614
634
 
615
- class FullScreenMessage extends InAppMessage {
635
+ export class FullScreenMessage extends InAppMessage {
616
636
  /**
617
- * A modal in-app message object which can be passed to `display.showInAppMessage`
618
- * or handled manually. Subscribe to be notified when in-app messages are triggered via `appboy.subscribeToInAppMessage`.
637
+ * A modal in-app message object which can be passed to `showInAppMessage`
638
+ * or handled manually. Subscribe to be notified when in-app messages are triggered via `subscribeToInAppMessage`.
619
639
  *
620
640
  * @param message - The message to display to the user.
621
- * @param messageAlignment - How to align message text. See the `InAppMessage.TextAlignment` enum.
641
+ * @param messageAlignment - How to align message text. See the `TextAlignment` enum.
622
642
  * @param extras - Object of string/string key/value pairs.
623
- * @param campaignId - If the message comes with a campaign, this is the id of the campaign that the SDK
624
- * will report back to Appboy with in-app message analytics events.
625
- * @param cardId - If the message comes with a card, this is the id of the card that the SDK
626
- * will report back to Appboy with in-app message analytics events.
627
643
  * @param triggerId - The id of the trigger that created this message. The SDK will report back this to
628
- * Appboy with in-app message analytics events.
644
+ * Braze with in-app message analytics events.
629
645
  * @param clickAction - Where the user should be brought when clicking on this message. See the
630
- * `InAppMessage.ClickAction` enum.
631
- * @param uri - If ```clickAction``` is `InAppMessage.ClickAction.URI`, the URI to follow when the
646
+ * `ClickAction` enum.
647
+ * @param uri - If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
632
648
  * user clicks on this message.
633
- * @param openTarget - If ```clickAction``` is `InAppMessage.ClickAction.URI`, whether to open clicks
634
- * in a new tab/window. See the `InAppMessage.OpenTarget` enum.
649
+ * @param openTarget - If ```clickAction``` is `ClickAction`.URI, whether to open clicks
650
+ * in a new tab/window. See the `OpenTarget` enum.
635
651
  * @param dismissType - How the message is dismissed, via a timer or requiring interaction from the user.
636
- * See the `InAppMessage.DismissType` enum.
652
+ * See the `DismissType` enum.
637
653
  * @param duration - Length of time in milliseconds until auto-dismiss should occur. Only used when
638
- * dismissType is `InAppMessage.DismissType.AUTO_DISMISS`
654
+ * dismissType is `DismissType`.AUTO_DISMISS
639
655
  * @param icon - A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
640
656
  * [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
641
657
  * @param imageUrl - Url of an image to include in this message. The message will only display an image *or*
642
658
  * an icon, and will prioritize the image if present.
643
659
  * @param imageStyle - Whether the image should be shown as normal on the top of the in-app message or used
644
- * as the entire content of the message. See the `InAppMessage.ImageStyle` enum.
660
+ * as the entire content of the message. See the `ImageStyle` enum.
645
661
  * @param iconColor - Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green).
646
662
  * @param iconBackgroundColor - Background color of icon. Hex value with opacity (e.g. 0xff00ff00
647
663
  * is opaque green).
@@ -653,35 +669,33 @@ declare namespace appboy {
653
669
  * opaque green).
654
670
  * @param animateIn - Whether to animate the showing of this message.
655
671
  * @param animateOut - Whether to animate the hiding of this message.
656
- * @param header - Header text to display.
657
- * @param headerAlignment - How to align header text. See the `InAppMessage.TextAlignment` enum.
672
+ * @param header - Header text to
673
+ * @param headerAlignment - How to align header text. See the `TextAlignment` enum.
658
674
  * @param headerTextColor - Color of header text. Hex value with opacity (e.g. 0xff00ff00 is
659
675
  * opaque green).
660
676
  * @param frameColor - Color of the background frame which blocks page interaction while the
661
677
  * message is showing.
662
678
  * @param buttons - Array of up to two `InAppMessageButton` objects.
663
- * @param cropType - How to crop and fit images in the allowable space. See the `InAppMessage.CropType` enum.
679
+ * @param cropType - How to crop and fit images in the allowable space. See the `CropType` enum.
664
680
  * @param orientation - Whether to lay out this in-app message as a portrait or landscape. See the
665
- * `InAppMessage.Orientation` enum.
681
+ * `Orientation` enum.
666
682
  * @param htmlId - The ID to give the parent HTML element that this message is rendered into.
667
683
  * @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
668
684
  * to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
669
685
  */
670
686
  constructor(
671
687
  message?: string,
672
- messageAlignment?: InAppMessage.TextAlignment,
688
+ messageAlignment?: TextAlignment,
673
689
  extras?: Record<string, any>,
674
- campaignId?: string,
675
- cardId?: string,
676
690
  triggerId?: string,
677
- clickAction?: InAppMessage.ClickAction,
691
+ clickAction?: ClickAction,
678
692
  uri?: string,
679
- openTarget?: InAppMessage.OpenTarget,
680
- dismissType?: InAppMessage.DismissType,
693
+ openTarget?: OpenTarget,
694
+ dismissType?: DismissType,
681
695
  duration?: number,
682
696
  icon?: string,
683
697
  imageUrl?: string,
684
- imageStyle?: InAppMessage.ImageStyle,
698
+ imageStyle?: ImageStyle,
685
699
  iconColor?: number,
686
700
  iconBackgroundColor?: number,
687
701
  backgroundColor?: number,
@@ -690,36 +704,36 @@ declare namespace appboy {
690
704
  animateIn?: boolean,
691
705
  animateOut?: boolean,
692
706
  header?: string,
693
- headerAlignment?: InAppMessage.TextAlignment,
707
+ headerAlignment?: TextAlignment,
694
708
  headerTextColor?: number,
695
709
  frameColor?: number,
696
710
  buttons?: InAppMessageButton[],
697
- cropType?: InAppMessage.CropType,
698
- orientation?: InAppMessage.Orientation,
711
+ cropType?: CropType,
712
+ orientation?: Orientation,
699
713
  htmlId?: string,
700
714
  css?: string
701
715
  );
702
716
 
703
- /** How to align message text. See the `InAppMessage.TextAlignment` enum. */
704
- messageAlignment: InAppMessage.TextAlignment;
717
+ /** How to align message text. See the `TextAlignment` enum. */
718
+ messageAlignment: TextAlignment;
705
719
 
706
720
  /**
707
721
  * Where the user should be brought when clicking on this message. See the
708
- * `InAppMessage.ClickAction` enum.
722
+ * `ClickAction` enum.
709
723
  */
710
- clickAction: InAppMessage.ClickAction;
724
+ clickAction: ClickAction;
711
725
 
712
726
  /**
713
- * If ```clickAction``` is `InAppMessage.ClickAction.URI`, the URI to follow when the
727
+ * If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
714
728
  * user clicks on this message.
715
729
  */
716
730
  uri?: string;
717
731
 
718
732
  /**
719
- * If ```clickAction``` is `InAppMessage.ClickAction.URI`, whether to open clicks
720
- * in a new tab/window. See the `InAppMessage.OpenTarget` enum.
733
+ * If ```clickAction``` is `ClickAction`.URI, whether to open clicks
734
+ * in a new tab/window. See the `OpenTarget` enum.
721
735
  */
722
- openTarget: InAppMessage.OpenTarget;
736
+ openTarget: OpenTarget;
723
737
 
724
738
  /**
725
739
  * A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
@@ -735,9 +749,9 @@ declare namespace appboy {
735
749
 
736
750
  /**
737
751
  * Whether the image should be shown as normal on the top of the in-app message or used
738
- * as the entire content of the message. See the `InAppMessage.ImageStyle` enum.
752
+ * as the entire content of the message. See the `ImageStyle` enum.
739
753
  */
740
- imageStyle: InAppMessage.ImageStyle;
754
+ imageStyle: ImageStyle;
741
755
 
742
756
  /** Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
743
757
  iconColor: number;
@@ -754,11 +768,11 @@ declare namespace appboy {
754
768
  /** Color of close button. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
755
769
  closeButtonColor: number;
756
770
 
757
- /** Header text to display. */
771
+ /** Header text to */
758
772
  header?: string;
759
773
 
760
- /** How to align header text. See the `InAppMessage.TextAlignment` enum. */
761
- headerAlignment: InAppMessage.TextAlignment;
774
+ /** How to align header text. See the `TextAlignment` enum. */
775
+ headerAlignment: TextAlignment;
762
776
 
763
777
  /** Color of header text. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
764
778
  headerTextColor: number;
@@ -769,46 +783,42 @@ declare namespace appboy {
769
783
  /** Array of up to two `InAppMessageButton` objects. */
770
784
  buttons: InAppMessageButton[];
771
785
 
772
- /** How to crop and fit images in the allowable space. See the `InAppMessage.CropType` enum. */
773
- cropType: InAppMessage.CropType;
786
+ /** How to crop and fit images in the allowable space. See the `CropType` enum. */
787
+ cropType: CropType;
774
788
 
775
789
  /**
776
790
  * Whether to lay out this in-app message as a portrait or landscape. See the
777
- * `InAppMessage.Orientation` enum.
791
+ * `Orientation` enum.
778
792
  */
779
- orientation: InAppMessage.Orientation;
793
+ orientation: Orientation;
780
794
  }
781
795
 
782
- class ModalMessage extends InAppMessage {
796
+ export class ModalMessage extends InAppMessage {
783
797
  /**
784
- * A modal in-app message object which can be passed to `display.showInAppMessage`
785
- * or handled manually. Subscribe to be notified when in-app messages are triggered via `appboy.subscribeToInAppMessage`
798
+ * A modal in-app message object which can be passed to `showInAppMessage`
799
+ * or handled manually. Subscribe to be notified when in-app messages are triggered via `subscribeToInAppMessage`
786
800
  *
787
801
  * @param message - The message to display to the user.
788
- * @param messageAlignment - How to align message text. See the `InAppMessage.TextAlignment` enum.
802
+ * @param messageAlignment - How to align message text. See the `TextAlignment` enum.
789
803
  * @param extras - Object of string/string key/value pairs.
790
- * @param campaignId - If the message comes with a campaign, this is the id of the campaign that the SDK
791
- * will report back to Appboy with in-app message analytics events.
792
- * @param cardId - If the message comes with a card, this is the id of the card that the SDK
793
- * will report back to Appboy with in-app message analytics events.
794
804
  * @param triggerId - The id of the trigger that created this message. The SDK will report back this to
795
- * Appboy with in-app message analytics events.
805
+ * Braze with in-app message analytics events.
796
806
  * @param clickAction - Where the user should be brought when clicking on this message. See the
797
- * `InAppMessage.ClickAction` enum.
798
- * @param uri - If ```clickAction``` is `InAppMessage.ClickAction.URI`, the URI to follow when the
807
+ * `ClickAction` enum.
808
+ * @param uri - If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
799
809
  * user clicks on this message.
800
- * @param openTarget - If ```clickAction``` is `InAppMessage.ClickAction.URI`, whether to open clicks
801
- * in a new tab/window. See the `InAppMessage.OpenTarget` enum.
810
+ * @param openTarget - If ```clickAction``` is `ClickAction`.URI, whether to open clicks
811
+ * in a new tab/window. See the `OpenTarget` enum.
802
812
  * @param dismissType - How the message is dismissed, via a timer or requiring interaction from the user.
803
- * See the `InAppMessage.DismissType` enum.
813
+ * See the `DismissType` enum.
804
814
  * @param duration - Length of time in milliseconds until auto-dismiss should occur. Only used when
805
- * dismissType is `InAppMessage.DismissType.AUTO_DISMISS`
815
+ * dismissType is `DismissType`.AUTO_DISMISS
806
816
  * @param icon - A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
807
817
  * [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
808
818
  * @param imageUrl - Url of an image to include in this message. The message will only display an image *or*
809
819
  * an icon, and will prioritize the image if present.
810
820
  * @param imageStyle - Whether the image should be shown as normal on the top of the in-app message or used
811
- * as the entire content of the message. See the `InAppMessage.ImageStyle` enum.
821
+ * as the entire content of the message. See the `ImageStyle` enum.
812
822
  * @param iconColor - Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green).
813
823
  * @param iconBackgroundColor - Background color of icon. Hex value with opacity (e.g. 0xff00ff00
814
824
  * is opaque green).
@@ -820,33 +830,31 @@ declare namespace appboy {
820
830
  * opaque green).
821
831
  * @param animateIn - Whether to animate the showing of this message.
822
832
  * @param animateOut - Whether to animate the hiding of this message.
823
- * @param header - Header text to display.
824
- * @param headerAlignment - How to align header text. See the `InAppMessage.TextAlignment` enum.
833
+ * @param header - Header text to
834
+ * @param headerAlignment - How to align header text. See the `TextAlignment` enum.
825
835
  * @param headerTextColor - Color of header text. Hex value with opacity (e.g. 0xff00ff00 is
826
836
  * opaque green).
827
837
  * @param frameColor - Color of the background frame which blocks page interaction while the
828
838
  * message is showing.
829
839
  * @param buttons - Array of up to two`InAppMessageButton` objects.
830
- * @param cropType - How to crop and fit images in the allowable space. See the `InAppMessage.CropType` enum.
840
+ * @param cropType - How to crop and fit images in the allowable space. See the `CropType` enum.
831
841
  * @param htmlId - The ID to give the parent HTML element that this message is rendered into.
832
842
  * @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
833
843
  * to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
834
844
  */
835
845
  constructor(
836
846
  message?: string,
837
- messageAlignment?: InAppMessage.TextAlignment,
847
+ messageAlignment?: TextAlignment,
838
848
  extras?: Record<string, any>,
839
- campaignId?: string,
840
- cardId?: string,
841
849
  triggerId?: string,
842
- clickAction?: InAppMessage.ClickAction,
850
+ clickAction?: ClickAction,
843
851
  uri?: string,
844
- openTarget?: InAppMessage.OpenTarget,
845
- dismissType?: InAppMessage.DismissType,
852
+ openTarget?: OpenTarget,
853
+ dismissType?: DismissType,
846
854
  duration?: number,
847
855
  icon?: string,
848
856
  imageUrl?: string,
849
- imageStyle?: InAppMessage.ImageStyle,
857
+ imageStyle?: ImageStyle,
850
858
  iconColor?: number,
851
859
  iconBackgroundColor?: number,
852
860
  backgroundColor?: number,
@@ -855,35 +863,35 @@ declare namespace appboy {
855
863
  animateIn?: boolean,
856
864
  animateOut?: boolean,
857
865
  header?: string,
858
- headerAlignment?: InAppMessage.TextAlignment,
866
+ headerAlignment?: TextAlignment,
859
867
  headerTextColor?: number,
860
868
  frameColor?: number,
861
869
  buttons?: InAppMessageButton[],
862
- cropType?: InAppMessage.CropType,
870
+ cropType?: CropType,
863
871
  htmlId?: string,
864
872
  css?: string
865
873
  );
866
874
 
867
- /** How to align message text. See the `InAppMessage.TextAlignment` enum. */
868
- messageAlignment: InAppMessage.TextAlignment;
875
+ /** How to align message text. See the `TextAlignment` enum. */
876
+ messageAlignment: TextAlignment;
869
877
 
870
878
  /**
871
879
  * Where the user should be brought when clicking on this message. See the
872
- * `InAppMessage.ClickAction` enum.
880
+ * `ClickAction` enum.
873
881
  */
874
- clickAction: InAppMessage.ClickAction;
882
+ clickAction: ClickAction;
875
883
 
876
884
  /**
877
- * If ```clickAction``` is `InAppMessage.ClickAction.URI`, the URI to follow when the
885
+ * If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
878
886
  * user clicks on this message.
879
887
  */
880
888
  uri?: string;
881
889
 
882
890
  /**
883
- * If ```clickAction``` is `InAppMessage.ClickAction.URI`, whether to open clicks
884
- * in a new tab/window. See the `InAppMessage.OpenTarget` enum.
891
+ * If ```clickAction``` is `ClickAction`.URI, whether to open clicks
892
+ * in a new tab/window. See the `OpenTarget` enum.
885
893
  */
886
- openTarget: InAppMessage.OpenTarget;
894
+ openTarget: OpenTarget;
887
895
 
888
896
  /**
889
897
  * A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
@@ -899,9 +907,9 @@ declare namespace appboy {
899
907
 
900
908
  /**
901
909
  * Whether the image should be shown as normal on the top of the in-app message or used
902
- * as the entire content of the message. See the `InAppMessage.ImageStyle` enum.
910
+ * as the entire content of the message. See the `ImageStyle` enum.
903
911
  */
904
- imageStyle: InAppMessage.ImageStyle;
912
+ imageStyle: ImageStyle;
905
913
 
906
914
  /** Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
907
915
  iconColor: number;
@@ -918,11 +926,11 @@ declare namespace appboy {
918
926
  /** Color of close button. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
919
927
  closeButtonColor: number;
920
928
 
921
- /** Header text to display. */
929
+ /** Header text to */
922
930
  header?: string;
923
931
 
924
- /** How to align header text. See the `InAppMessage.TextAlignment` enum. */
925
- headerAlignment: InAppMessage.TextAlignment;
932
+ /** How to align header text. See the `TextAlignment` enum. */
933
+ headerAlignment: TextAlignment;
926
934
 
927
935
  /** Color of header text. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
928
936
  headerTextColor: number;
@@ -933,27 +941,23 @@ declare namespace appboy {
933
941
  /** Array of up to two`InAppMessageButton` objects. */
934
942
  buttons: InAppMessageButton[];
935
943
 
936
- /** How to crop and fit images in the allowable space. See the `InAppMessage.CropType` enum. */
937
- cropType: InAppMessage.CropType;
944
+ /** How to crop and fit images in the allowable space. See the `CropType` enum. */
945
+ cropType: CropType;
938
946
  }
939
947
 
940
- class HtmlMessage extends InAppMessage {
948
+ export class HtmlMessage extends InAppMessage {
941
949
  /**
942
- * An html-content in-app message object which can be passed to `display.showInAppMessage`
943
- * or handled manually. Subscribe to be notified when in-app messages are triggered via `appboy.subscribeToInAppMessage`
950
+ * An html-content in-app message object which can be passed to `showInAppMessage`
951
+ * or handled manually. Subscribe to be notified when in-app messages are triggered via `subscribeToInAppMessage`
944
952
  *
945
953
  * @param message - The html content to display to the user.
946
954
  * @param extras - Object of string/string key/value pairs.
947
- * @param campaignId - If the message comes with a campaign, this is the id of the campaign that the SDK
948
- * will report back to Appboy with in-app message analytics events.
949
- * @param cardId - If the message comes with a card, this is the id of the card that the SDK
950
- * will report back to Appboy with in-app message analytics events.
951
955
  * @param triggerId - The id of the trigger that created this message. The SDK will report back this to
952
- * Appboy with in-app message analytics events.
956
+ * Braze with in-app message analytics events.
953
957
  * @param dismissType - How the message is dismissed, via a timer or requiring interaction from the user.
954
- * See the `InAppMessage.TextAlignment` enum.
958
+ * See the `TextAlignment` enum.
955
959
  * @param duration - Length of time in milliseconds until auto-dismiss should occur. Only used when
956
- * dismissType is `InAppMessage.DismissType.AUTO_DISMISS`.
960
+ * dismissType is `DismissType`.AUTO_DISMISS.
957
961
  * @param animateIn - Whether to animate the showing of this message.
958
962
  * @param animateOut - Whether to animate the hiding of this message.
959
963
  * @param frameColor - Color of the background frame which blocks page interaction while the message is showing.
@@ -965,10 +969,8 @@ declare namespace appboy {
965
969
  constructor(
966
970
  message: string,
967
971
  extras?: Record<string, any>,
968
- campaignId?: string,
969
- cardId?: string,
970
972
  triggerId?: string,
971
- dismissType?: InAppMessage.DismissType,
973
+ dismissType?: DismissType,
972
974
  duration?: number,
973
975
  animateIn?: boolean,
974
976
  animateOut?: boolean,
@@ -986,34 +988,30 @@ declare namespace appboy {
986
988
  }
987
989
 
988
990
  /**
989
- * A slide-up in-app message object which can be passed to `display.showInAppMessage`
990
- * or handled manually. Subscribe to be notified when in-app messages are triggered via `appboy.subscribeToInAppMessage`
991
+ * A slide-up in-app message object which can be passed to `showInAppMessage`
992
+ * or handled manually. Subscribe to be notified when in-app messages are triggered via `subscribeToInAppMessage`
991
993
  */
992
- class SlideUpMessage extends InAppMessage {
994
+ export class SlideUpMessage extends InAppMessage {
993
995
  /**
994
- * A slide-up in-app message object which can be passed to `display.showInAppMessage`
995
- * or handled manually. Subscribe to be notified when in-app messages are triggered via `appboy.subscribeToInAppMessage`
996
+ * A slide-up in-app message object which can be passed to `showInAppMessage`
997
+ * or handled manually. Subscribe to be notified when in-app messages are triggered via `subscribeToInAppMessage`
996
998
  *
997
999
  * @param message - The message to display to the user.
998
- * @param messageAlignment - How to align message text. See the `InAppMessage.TextAlignment` enum.
999
- * @param slideFrom - Where the message should slide in from. See the `InAppMessage.SlideFrom` enum.
1000
+ * @param messageAlignment - How to align message text. See the `TextAlignment` enum.
1001
+ * @param slideFrom - Where the message should slide in from. See the `SlideFrom` enum.
1000
1002
  * @param extras - Object of string/string key/value pairs.
1001
- * @param campaignId - If the message comes with a campaign, this is the id of the campaign that the SDK
1002
- * will report back to Appboy with in-app message analytics events.
1003
- * @param cardId - If the message comes with a card, this is the id of the card that the SDK
1004
- * will report back to Appboy with in-app message analytics events.
1005
1003
  * @param triggerId - The id of the trigger that created this message. The SDK will report back this to
1006
- * Appboy with in-app message analytics events.
1004
+ * Braze with in-app message analytics events.
1007
1005
  * @param clickAction - Where the user should be brought when clicking on this message. See the
1008
- * `InAppMessage.ClickAction` enum.
1009
- * @param uri - If ```clickAction``` is `InAppMessage.ClickAction.URI`, the URI to follow when the
1006
+ * `ClickAction` enum.
1007
+ * @param uri - If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
1010
1008
  * user clicks on this message.
1011
- * @param openTarget - If ```clickAction``` is `InAppMessage.ClickAction.URI`, whether to open clicks
1012
- * in a new tab/window. See the `InAppMessage.OpenTarget` enum.
1009
+ * @param openTarget - If ```clickAction``` is `ClickAction`.URI, whether to open clicks
1010
+ * in a new tab/window. See the `OpenTarget` enum.
1013
1011
  * @param dismissType - How the message is dismissed, via a timer or requiring interaction from the user.
1014
- * See the `InAppMessage.DismissType` enum.
1012
+ * See the `DismissType` enum.
1015
1013
  * @param duration - Length of time in milliseconds until auto-dismiss should occur. Only used when
1016
- * dismissType is `InAppMessage.DismissType.AUTO_DISMISS`
1014
+ * dismissType is `DismissType`.AUTO_DISMISS
1017
1015
  * @param icon - A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
1018
1016
  * [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
1019
1017
  * @param imageUrl - Url of an image to include in this message. The message will only display an image *or*
@@ -1035,16 +1033,14 @@ declare namespace appboy {
1035
1033
  */
1036
1034
  constructor(
1037
1035
  message: string,
1038
- messageAlignment?: InAppMessage.TextAlignment,
1039
- slideFrom?: InAppMessage.SlideFrom,
1036
+ messageAlignment?: TextAlignment,
1037
+ slideFrom?: SlideFrom,
1040
1038
  extras?: Record<string, any>,
1041
- campaignId?: string,
1042
- cardId?: string,
1043
1039
  triggerId?: string,
1044
- clickAction?: InAppMessage.ClickAction,
1040
+ clickAction?: ClickAction,
1045
1041
  uri?: string,
1046
- openTarget?: InAppMessage.OpenTarget,
1047
- dismissType?: InAppMessage.DismissType,
1042
+ openTarget?: OpenTarget,
1043
+ dismissType?: DismissType,
1048
1044
  duration?: number,
1049
1045
  icon?: string,
1050
1046
  imageUrl?: string,
@@ -1059,29 +1055,29 @@ declare namespace appboy {
1059
1055
  css?: string
1060
1056
  );
1061
1057
 
1062
- /** How to align message text. See the `InAppMessage.TextAlignment` enum. */
1063
- messageAlignment: InAppMessage.TextAlignment;
1058
+ /** How to align message text. See the `TextAlignment` enum. */
1059
+ messageAlignment: TextAlignment;
1064
1060
 
1065
- /** Where the message should slide in from. See the `InAppMessage.SlideFrom` enum. */
1066
- slideFrom: InAppMessage.SlideFrom;
1061
+ /** Where the message should slide in from. See the `SlideFrom` enum. */
1062
+ slideFrom: SlideFrom;
1067
1063
 
1068
1064
  /**
1069
1065
  * Where the user should be brought when clicking on this message. See the
1070
- * `InAppMessage.ClickAction` enum.
1066
+ * `ClickAction` enum.
1071
1067
  */
1072
- clickAction: InAppMessage.ClickAction;
1068
+ clickAction: ClickAction;
1073
1069
 
1074
1070
  /**
1075
- * If ```clickAction``` is `InAppMessage.ClickAction.URI`, the URI to follow when the
1071
+ * If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
1076
1072
  * user clicks on this message.
1077
1073
  */
1078
1074
  uri?: string;
1079
1075
 
1080
1076
  /**
1081
- * If ```clickAction``` is `InAppMessage.ClickAction.URI`, whether to open clicks
1082
- * in a new tab/window. See the `InAppMessage.OpenTarget` enum.
1077
+ * If ```clickAction``` is `ClickAction`.URI, whether to open clicks
1078
+ * in a new tab/window. See the `OpenTarget` enum.
1083
1079
  */
1084
- openTarget: InAppMessage.OpenTarget;
1080
+ openTarget: OpenTarget;
1085
1081
 
1086
1082
  /**
1087
1083
  * A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
@@ -1111,20 +1107,21 @@ declare namespace appboy {
1111
1107
  closeButtonColor: number;
1112
1108
  }
1113
1109
 
1114
- namespace User {
1115
- type Genders = "m" | "f" | "o" | "u" | "n" | "p";
1116
- type NotificationSubscriptionTypes = "opted_in" | "subscribed" | "unsubscribed";
1117
- }
1110
+
1111
+ type Genders = typeof User.Genders[keyof typeof User.Genders];
1112
+
1113
+
1114
+ type NotificationSubscriptionTypes = typeof User.NotificationSubscriptionTypes[keyof typeof User.NotificationSubscriptionTypes];
1118
1115
 
1119
1116
  /**
1120
- * Do not construct directly - use `appboy.getUser` to get the user object.
1117
+ * Do not construct directly - use `getUser` to get the user object.
1121
1118
  * User provides an object which lets you update the attributes stored by Braze for your user.
1122
1119
  *
1123
1120
  * This class has been designed to provide fire and forget semantics and to not impact the performance or lifecycle of
1124
1121
  * calling code. As such, changes made to an User are enqueued locally and flushed to Braze's servers
1125
1122
  * asynchronously.
1126
1123
  */
1127
- class User {
1124
+ export class User {
1128
1125
  /** Enum to represent valid genders. */
1129
1126
  static Genders: {
1130
1127
  MALE: "m";
@@ -1180,7 +1177,7 @@ declare namespace appboy {
1180
1177
  * For example:
1181
1178
  *
1182
1179
  * ```
1183
- * appboy.getUser().getUserId(function(userId) {
1180
+ * braze.getUser().getUserId(function(userId) {
1184
1181
  * console.log('The user is ' + userId);
1185
1182
  * });
1186
1183
  * ```
@@ -1223,17 +1220,7 @@ declare namespace appboy {
1223
1220
  *
1224
1221
  * @returns Whether the update was successfully enqueued.
1225
1222
  */
1226
- removeFromSubscriptionGroup(subscriptionGroupId: string): boolean;
1227
-
1228
- /**
1229
- * Sets the url for the avatar image for the user, which will be displayed on the user profile
1230
- * and throughout the Braze dashboard.
1231
- *
1232
- * @param avatarImageUrl
1233
- *
1234
- * @returns Whether the update was successfully enqueued.
1235
- */
1236
- setAvatarImageUrl(avatarImageUrl: string): boolean;
1223
+ removeFromSubscriptionGroup(subscriptionGroupId: string): boolean;
1237
1224
 
1238
1225
  /**
1239
1226
  * Sets the country for the user.
@@ -1309,12 +1296,12 @@ declare namespace appboy {
1309
1296
  * Sets whether the user should be sent email campaigns.
1310
1297
  *
1311
1298
  * @param notificationSubscriptionType - Notification setting (explicitly opted-in, subscribed, or unsubscribed).
1312
- * See the `User.NotificationSubscriptionTypes` enum.
1299
+ * See the `NotificationSubscriptionTypes` enum.
1313
1300
  *
1314
1301
  * @returns Whether the update was successfully enqueued.
1315
1302
  */
1316
1303
  setEmailNotificationSubscriptionType(
1317
- notificationSubscriptionType: User.NotificationSubscriptionTypes
1304
+ notificationSubscriptionType: NotificationSubscriptionTypes
1318
1305
  ): boolean;
1319
1306
 
1320
1307
  /**
@@ -1329,12 +1316,12 @@ declare namespace appboy {
1329
1316
  /**
1330
1317
  * Sets the gender of the user.
1331
1318
  *
1332
- * @param gender - Generally 'm' or 'f'. Accepts an explicit null value to null out attribute. Use `User.Genders`
1319
+ * @param gender - Generally 'm' or 'f'. Accepts an explicit null value to null out attribute. Use `Genders`
1333
1320
  * enum when setting this value.
1334
1321
  *
1335
1322
  * @returns Whether the update was successfully enqueued.
1336
1323
  */
1337
- setGender(gender: User.Genders | null): boolean;
1324
+ setGender(gender: Genders | null): boolean;
1338
1325
 
1339
1326
  /**
1340
1327
  * Sets the home city for the user.
@@ -1401,16 +1388,16 @@ declare namespace appboy {
1401
1388
  * Sets whether the user should be sent push campaigns.
1402
1389
  *
1403
1390
  * @param notificationSubscriptionType - Notification setting (explicitly opted-in, subscribed, or unsubscribed).
1404
- * See the `User.NotificationSubscriptionTypes` enum.
1391
+ * See the `NotificationSubscriptionTypes` enum.
1405
1392
  *
1406
1393
  * @returns Whether the update was successfully enqueued.
1407
1394
  */
1408
1395
  setPushNotificationSubscriptionType(
1409
- notificationSubscriptionType: User.NotificationSubscriptionTypes
1396
+ notificationSubscriptionType: NotificationSubscriptionTypes
1410
1397
  ): boolean;
1411
1398
  }
1412
1399
 
1413
- class InAppMessageButton {
1400
+ export class InAppMessageButton {
1414
1401
  /**
1415
1402
  * Represents a button on an `ModalMessage` or `FullScreenMessage`.
1416
1403
  *
@@ -1422,8 +1409,8 @@ declare namespace appboy {
1422
1409
  * @param borderColor - The color for the border of this button. Hex value with opacity (e.g.
1423
1410
  * 0xff00ff00 is opaque green).
1424
1411
  * @param clickAction - Where the user should be brought when clicking on this button. See the
1425
- * `InAppMessage.ClickAction` enum.
1426
- * @param uri - If ```clickAction``` is `InAppMessage.ClickAction.URI`, the URI to follow when the
1412
+ * `ClickAction` enum.
1413
+ * @param uri - If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
1427
1414
  * user clicks on this button.
1428
1415
  * @param id - The id for this button. Used for analytics.
1429
1416
  */
@@ -1432,7 +1419,7 @@ declare namespace appboy {
1432
1419
  backgroundColor?: number,
1433
1420
  textColor?: number,
1434
1421
  borderColor?: number,
1435
- clickAction?: InAppMessage.ClickAction,
1422
+ clickAction?: ClickAction,
1436
1423
  uri?: string,
1437
1424
  id?: number
1438
1425
  );
@@ -1460,12 +1447,12 @@ declare namespace appboy {
1460
1447
 
1461
1448
  /**
1462
1449
  * Where the user should be brought when clicking on this button. See the
1463
- * `InAppMessage.ClickAction` enum.
1450
+ * `ClickAction` enum.
1464
1451
  */
1465
- clickAction: InAppMessage.ClickAction;
1452
+ clickAction: ClickAction;
1466
1453
 
1467
1454
  /**
1468
- * If ```clickAction``` is `InAppMessage.ClickAction.URI`, the URI to follow when the
1455
+ * If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
1469
1456
  * user clicks on this button.
1470
1457
  */
1471
1458
  uri?: string;
@@ -1498,131 +1485,125 @@ declare namespace appboy {
1498
1485
  }
1499
1486
 
1500
1487
  /**
1501
- * appboy.display is the public class for the UI portions of Braze's Web SDK. It is only available in
1502
- * `https://js.appboycdn.com/web-sdk-develop/3.5/appboy.min.js` and is stripped from the more minimal
1503
- * `https://js.appboycdn.com/web-sdk-develop/3.5/appboy.core.min.js`.
1488
+ * Automatically display in-app messages when they are triggered. This method should be called before
1489
+ * calling `openSession`.
1490
+ *
1491
+ * @returns The identifier of the subscription created. This can be passed to
1492
+ * `removeSubscription` to cancel the subscription.
1504
1493
  */
1505
- namespace display {
1506
- /**
1507
- * Automatically display new in-app messages when they come in from the server.
1508
- *
1509
- * @returns The identifier of the subscription created. This can be passed to
1510
- * 'appboy.removeSubscription` to cancel the subscription.
1511
- */
1512
- function automaticallyShowNewInAppMessages(): string;
1494
+ export function automaticallyShowInAppMessages(): string;
1513
1495
 
1514
- /**
1515
- * Destroy any Braze news feed currently showing. This method will appropriately clean up any retained resources
1516
- * and also display the hiding animation, and so should be used instead of manually removing feed html from the
1517
- * DOM.
1518
- */
1519
- function destroyFeed(): void;
1496
+ /**
1497
+ * Destroy any Braze news feed currently showing. This method will appropriately clean up any retained resources
1498
+ * and also display the hiding animation, and so should be used instead of manually removing feed html from the
1499
+ * DOM.
1500
+ */
1501
+ export function destroyFeed(): void;
1520
1502
 
1521
- /**
1522
- * Hide any Braze content cards currently showing in the parent node, or if none is provided, any content cards in the page.
1523
- * This method will appropriately clean up any retained resources and also display the hiding animation, and so should be
1524
- * used instead of manually removing content cards HTML from the DOM.
1525
- *
1526
- * @param parentNode - The HTML node that denotes the parent of the content cards to be hidden. If null/undefined, all content
1527
- * cards on the page will be hidden.
1528
- */
1529
- function hideContentCards(parentNode?: Element | null): void;
1503
+ /**
1504
+ * Hide any Braze content cards currently showing in the parent node, or if none is provided, any content cards in the page.
1505
+ * This method will appropriately clean up any retained resources and also display the hiding animation, and so should be
1506
+ * used instead of manually removing content cards HTML from the DOM.
1507
+ *
1508
+ * @param parentNode - The HTML node that denotes the parent of the content cards to be hidden. If null/undefined, all content
1509
+ * cards on the page will be hidden.
1510
+ */
1511
+ export function hideContentCards(parentNode?: Element | null): void;
1530
1512
 
1531
- /**
1532
- * Display the user's content cards.
1533
- *
1534
- * @param parentNode - The HTML node to render the content cards into. If null/undefined, the content
1535
- * cards will be rendered in fixed position over the right-hand side of the page and appended to the `<body>`
1536
- * node. If the parent node already has a Braze content cards view as a direct descendant, the existing content
1537
- * cards will be replaced.
1538
- * @param filterFunction - A filter/sort function for cards displayed in this view. Invoked with the
1539
- * array of `Card` objects, sorted by {pinned, date}. Expected to return an array of sorted
1540
- * `Card` objects to render for this user. If omitted, all cards will be displayed.
1541
- */
1542
- function showContentCards(
1543
- parentNode?: Element | null,
1544
- filterFunction?: (cards: appboy.Card[]) => appboy.Card[]
1545
- ): void;
1513
+ /**
1514
+ * Display the user's content cards.
1515
+ *
1516
+ * @param parentNode - The HTML node to render the content cards into. If null/undefined, the content
1517
+ * cards will be rendered in fixed position over the right-hand side of the page and appended to the `<body>`
1518
+ * node. If the parent node already has a Braze content cards view as a direct descendant, the existing content
1519
+ * cards will be replaced.
1520
+ * @param filterFunction - A filter/sort function for cards displayed in this view. Invoked with the
1521
+ * array of `Card` objects, sorted by {pinned, date}. Expected to return an array of sorted
1522
+ * `Card` objects to render for this user. If omitted, all cards will be displayed.
1523
+ */
1524
+ export function showContentCards(
1525
+ parentNode?: Element | null,
1526
+ filterFunction?: (cards: Card[]) => Card[]
1527
+ ): void;
1546
1528
 
1547
- /**
1548
- * Display the user's news feed.
1549
- *
1550
- * @param parentNode - The HTML node to render the news feed into. If null/undefined, the feed will be
1551
- * rendered in fixed position over the right-hand side of the page and appended to the `<body>` node. If the
1552
- * parent node already has an Braze news feed as a direct descendant, the existing feed will be replaced.
1553
- * @param cards - A static set of cards to display. Each item in this Array should be a `Card`
1554
- * descendant. If this parameter is null/undefined, all unexpired cards from the last news feed refresh will be
1555
- * used automatically, a feed refresh will be kicked off automatically if the cached cards are more than 1 minute
1556
- * old, and the feed will automatically update when new cards are received while it is still showing. If you
1557
- * provide an explicit set of cards by using this parameter, no action will be taken when new cards are received,
1558
- * and you must subscribe to feed updates yourself with `appboy.subscribeToFeedUpdates` and request updates with
1559
- * `appboy.requestFeedRefresh` if you want to update this feed with new cards.
1560
- * @param allowedCategories - A set of categories to filter cards to. Each item in this Array should be a
1561
- * card category as set in the Braze dashboard. If omitted, all cards will be displayed.
1562
- */
1563
- function showFeed(
1564
- parentNode?: Element | null,
1565
- cards?: appboy.Card[] | null,
1566
- allowedCategories?: string[]
1567
- ): void;
1529
+ /**
1530
+ * Display the user's news feed.
1531
+ *
1532
+ * @param parentNode - The HTML node to render the news feed into. If null/undefined, the feed will be
1533
+ * rendered in fixed position over the right-hand side of the page and appended to the `<body>` node. If the
1534
+ * parent node already has an Braze news feed as a direct descendant, the existing feed will be replaced.
1535
+ * @param cards - A static set of cards to Each item in this Array should be a `Card`
1536
+ * descendant. If this parameter is null/undefined, all unexpired cards from the last news feed refresh will be
1537
+ * used automatically, a feed refresh will be kicked off automatically if the cached cards are more than 1 minute
1538
+ * old, and the feed will automatically update when new cards are received while it is still showing. If you
1539
+ * provide an explicit set of cards by using this parameter, no action will be taken when new cards are received,
1540
+ * and you must subscribe to feed updates yourself with `subscribeToFeedUpdates` and request updates with
1541
+ * `requestFeedRefresh` if you want to update this feed with new cards.
1542
+ * @param allowedCategories - A set of categories to filter cards to. Each item in this Array should be a
1543
+ * card category as set in the Braze dashboard. If omitted, all cards will be displayed.
1544
+ */
1545
+ export function showFeed(
1546
+ parentNode?: Element | null,
1547
+ cards?: Card[] | null,
1548
+ allowedCategories?: string[]
1549
+ ): void;
1568
1550
 
1569
- /**
1570
- * Display a given in-app message.
1571
- *
1572
- * @param inAppMessage - The message to display.
1573
- * @param parentNode - The HTML node to render the in-app message into. If null/undefined, the message
1574
- * will be rendered appended within the `<body>` node.
1575
- * @param onDisplayCallback - Optional callback to invoke once the message is on the screen.
1576
- *
1577
- * @returns Whether or not the message was displayed (or, in the case of control messages, logged to
1578
- * Braze servers).
1579
- */
1580
- function showInAppMessage(
1581
- inAppMessage: appboy.InAppMessage | appboy.ControlMessage,
1582
- parentNode?: Element | null,
1583
- onDisplayCallback?: () => void
1584
- ): boolean;
1551
+ /**
1552
+ * Display a given in-app message.
1553
+ *
1554
+ * @param inAppMessage - The message to
1555
+ * @param parentNode - The HTML node to render the in-app message into. If null/undefined, the message
1556
+ * will be rendered appended within the `<body>` node.
1557
+ * @param onDisplayCallback - Optional callback to invoke once the message is on the screen.
1558
+ *
1559
+ * @returns Whether or not the message was displayed (or, in the case of control messages, logged to
1560
+ * Braze servers).
1561
+ */
1562
+ export function showInAppMessage(
1563
+ inAppMessage: InAppMessage | ControlMessage,
1564
+ parentNode?: Element | null,
1565
+ onDisplayCallback?: () => void
1566
+ ): boolean;
1585
1567
 
1586
- /**
1587
- * Toggle the display of Braze content cards, showing them if they are not shown, and hiding them if they are. If you
1588
- * wish to display multiple content cards feeds on a page simultaneously, you should use `showContentCards` and `hideContentCards`
1589
- * to show/hide each feed individually instead of this method.
1590
- *
1591
- * @param parentNode - The HTML node to render the content cards into. If null/undefined, the content
1592
- * cards will be rendered in fixed position over the right-hand side of the page and appended to the `<body>`
1593
- * node. If the parent node already has a Braze content cards view as a direct descendant, the existing content
1594
- * cards will be replaced.
1595
- * @param filterFunction - A filter/sort function for cards displayed in this view. Invoked with the
1596
- * array of `Card` objects, sorted by {pinned, date}. Expected to return an array of sorted
1597
- * `Card` objects to render for this user. If omitted, all cards will be displayed.
1598
- */
1599
- function toggleContentCards(
1600
- parentNode?: Element | null,
1601
- filterFunction?: (cards: appboy.Card[]) => appboy.Card[]
1602
- ): void;
1603
-
1604
- /**
1605
- * Toggle the Braze news feed, creating it if it does not exist, and destroying it if it does.
1606
- *
1607
- * @param parentNode - The HTML node to render the news feed into. If null/undefined, the feed will be
1608
- * rendered in fixed position over the right-hand side of the page and appended to the `<body>` node. If the
1609
- * parent node already has an Braze news feed as a direct descendant, the existing feed will be replaced.
1610
- * @param cards - A static set of cards to display. Each item in this Array should be a `Card`
1611
- * descendant. If this parameter is null/undefined, all unexpired cards from the last news feed refresh will be
1612
- * used automatically, a feed refresh will be kicked off automatically if the cached cards are more than 1 minute
1613
- * old, and the feed will automatically update when new cards are received while it is still showing. If you
1614
- * provide an explicit set of cards by using this parameter, no action will be taken when new cards are received,
1615
- * and you must subscribe to feed updates yourself with `appboy.subscribeToFeedUpdates` and request updates with
1616
- * `appboy.requestFeedRefresh` if you want to update this feed with new cards.
1617
- * @param allowedCategories - A set of categories to filter cards to. Each item in this Array should be a
1618
- * card category as set in the Braze dashboard. If omitted, all cards will be displayed.
1619
- */
1620
- function toggleFeed(
1621
- parentNode?: Element | null,
1622
- cards?: appboy.Card[] | null,
1623
- allowedCategories?: string[]
1624
- ): void;
1625
- }
1568
+ /**
1569
+ * Toggle the display of Braze content cards, showing them if they are not shown, and hiding them if they are. If you
1570
+ * wish to display multiple content cards feeds on a page simultaneously, you should use `showContentCards` and `hideContentCards`
1571
+ * to show/hide each feed individually instead of this method.
1572
+ *
1573
+ * @param parentNode - The HTML node to render the content cards into. If null/undefined, the content
1574
+ * cards will be rendered in fixed position over the right-hand side of the page and appended to the `<body>`
1575
+ * node. If the parent node already has a Braze content cards view as a direct descendant, the existing content
1576
+ * cards will be replaced.
1577
+ * @param filterFunction - A filter/sort function for cards displayed in this view. Invoked with the
1578
+ * array of `Card` objects, sorted by {pinned, date}. Expected to return an array of sorted
1579
+ * `Card` objects to render for this user. If omitted, all cards will be displayed.
1580
+ */
1581
+ export function toggleContentCards(
1582
+ parentNode?: Element | null,
1583
+ filterFunction?: (cards: Card[]) => Card[]
1584
+ ): void;
1585
+
1586
+ /**
1587
+ * Toggle the Braze news feed, creating it if it does not exist, and destroying it if it does.
1588
+ *
1589
+ * @param parentNode - The HTML node to render the news feed into. If null/undefined, the feed will be
1590
+ * rendered in fixed position over the right-hand side of the page and appended to the `<body>` node. If the
1591
+ * parent node already has an Braze news feed as a direct descendant, the existing feed will be replaced.
1592
+ * @param cards - A static set of cards to Each item in this Array should be a `Card`
1593
+ * descendant. If this parameter is null/undefined, all unexpired cards from the last news feed refresh will be
1594
+ * used automatically, a feed refresh will be kicked off automatically if the cached cards are more than 1 minute
1595
+ * old, and the feed will automatically update when new cards are received while it is still showing. If you
1596
+ * provide an explicit set of cards by using this parameter, no action will be taken when new cards are received,
1597
+ * and you must subscribe to feed updates yourself with `subscribeToFeedUpdates` and request updates with
1598
+ * `requestFeedRefresh` if you want to update this feed with new cards.
1599
+ * @param allowedCategories - A set of categories to filter cards to. Each item in this Array should be a
1600
+ * card category as set in the Braze dashboard. If omitted, all cards will be displayed.
1601
+ */
1602
+ export function toggleFeed(
1603
+ parentNode?: Element | null,
1604
+ cards?: Card[] | null,
1605
+ allowedCategories?: string[]
1606
+ ): void;
1626
1607
 
1627
1608
  /**
1628
1609
  * When a user first uses Braze on a device they are considered "anonymous". Use this method to identify a user
@@ -1661,13 +1642,13 @@ declare namespace appboy {
1661
1642
  * using the `setSdkAuthenticationSignature` method. This signature will only have an effect if the `enableSdkAuthentication`
1662
1643
  * initialization option is set to true.
1663
1644
  */
1664
- function changeUser(userId: string, signature?: string): void;
1645
+ export function changeUser(userId: string, signature?: string): void;
1665
1646
 
1666
1647
  /**
1667
- * Destroys this appboy instance, destroying all subscription callbacks and releasing member variables which
1648
+ * Destroys this `braze` instance, destroying all subscription callbacks and releasing member variables which
1668
1649
  * retain memory.
1669
1650
  */
1670
- function destroy(): void;
1651
+ export function destroy(): void;
1671
1652
 
1672
1653
  /**
1673
1654
  * Get all currently available cards from the last content cards refresh.
@@ -1675,7 +1656,7 @@ declare namespace appboy {
1675
1656
  * @returns - A `ContentCards` object which includes all currently available
1676
1657
  * `Card` objects from the last content cards refresh.
1677
1658
  */
1678
- function getCachedContentCards(): appboy.ContentCards;
1659
+ export function getCachedContentCards(): ContentCards;
1679
1660
 
1680
1661
  /**
1681
1662
  * Get all unexpired cards from the last news feed refresh.
@@ -1683,88 +1664,74 @@ declare namespace appboy {
1683
1664
  * @returns - A `Feed` object which includes all unexpired `Card` objects from the last
1684
1665
  * news feed refresh.
1685
1666
  */
1686
- function getCachedFeed(): appboy.Feed;
1667
+ export function getCachedFeed(): Feed;
1687
1668
 
1688
1669
  /**
1689
1670
  * Asynchronously retrieves the 'device id,' a randomly generated ID that is stored on the browser.
1690
1671
  * This ID resets for private browsing sessions and when website data is cleared. For example:
1691
1672
  *
1692
1673
  * ```
1693
- * appboy.getDeviceId(function(deviceId) {
1674
+ * braze.getDeviceId(function(deviceId) {
1694
1675
  * console.log('The device id is ' + deviceId);
1695
1676
  * });
1696
1677
  * ```
1697
1678
  *
1698
1679
  * @param callback - Asynchronous callback - this will be invoked with the deviceId.
1699
1680
  */
1700
- function getDeviceId(callback: (deviceId: string) => void): void;
1681
+ export function getDeviceId(callback: (deviceId: string) => void): void;
1701
1682
 
1702
1683
  /**
1703
1684
  * @returns The user currently being tracked by Braze, used for querying the tracked user id and setting
1704
- * user attributes. Should only be accessed via the `getUser` function.
1685
+ * user attributes. Should only be accessed via the `getUser` function. Returns undefined if the
1686
+ * SDK has not been initialized.
1705
1687
  */
1706
- function getUser(): appboy.User;
1688
+ export function getUser(): User | undefined;
1707
1689
 
1708
1690
  /**
1709
- * Initializes this `appboy` instance with your API key. This method must be called before other Braze methods are
1691
+ * Initializes this `braze` instance with your API key. This method must be called before other Braze methods are
1710
1692
  * invoked, and is part of the default loading snippets. Subsequent calls will be ignored until 'destroy`
1711
1693
  * is called.
1712
1694
  *
1713
1695
  * @param apiKey - Your app's Braze API Key. Your API keys can be found
1714
- * [here](https://dashboard.appboy.com/app_settings/app_settings).
1696
+ * [here](https://dashboard.braze.com/app_settings/app_settings).
1715
1697
  * @param options - Configuration options. See `InitializationOptions` for supported options.
1716
1698
  *
1717
- * @returns - Whether or not the `appboy` instance has been successfully initialized.
1699
+ * @returns - Whether or not the `braze` instance has been successfully initialized.
1718
1700
  * Reasons for returning false include a missing API key/base URL, user opt out, and ignored crawler bot activity.
1719
1701
  */
1720
- function initialize(apiKey: string, options: InitializationOptions): boolean;
1702
+ export function initialize(apiKey: string, options: InitializationOptions): boolean;
1721
1703
 
1722
1704
  /**
1723
1705
  * @returns Whether or not the user has blocked push. If the user has blocked push, they cannot be
1724
- * prompted to register again, and must manually remove the block in order to receive push.
1725
- */
1726
- function isPushBlocked(): boolean;
1727
-
1728
- /**
1729
- * DEPRECATED - Tests whether the user has given this browser push permission (they may still be unsubscribed from
1730
- * push via `User.setPushNotificationSubscriptionType`). A true value essentially means that
1731
- * `appboy.registerAppboyPushMessages` may be called without the user being prompted. Useful for migrating existing
1732
- * non-Braze push registrations to appboy.
1733
- *
1734
- * @deprecated This function inappropriately reports whether or not the browser *currently* has an active
1735
- * registered push subscription, and does not answer the intended permissions question of whether the user has
1736
- * granted the browser push permissions.
1737
- * Please use `appboy.isPushPermissionGranted` instead. This WILL BE REMOVED.
1738
- *
1739
- * @param yesCallback - Invoked if the user has granted push access on this browser
1740
- * @param noCallback - Invoked if the user has not granted push access on this browser
1706
+ * prompted to register again, and must manually remove the block in order to receive push.
1707
+ * Returns undefined if the SDK has not been initialized.
1741
1708
  */
1742
- function isPushGranted(yesCallback: () => void, noCallback: () => void): void;
1709
+ export function isPushBlocked(): boolean | undefined;
1743
1710
 
1744
1711
  /**
1745
1712
  * Tests whether the user has given this browser push permission (they may still be unsubscribed from push via
1746
1713
  * `User.setPushNotificationSubscriptionType`). A true value essentially means that
1747
- * `appboy.registerAppboyPushMessages` may be called without the
1748
- * user being prompted. Useful for migrating existing non-Braze push registrations to appboy.
1714
+ * `requestPushPermission` may be called without the user being prompted. Useful for migrating existing
1715
+ * non-Braze push registrations to Braze.
1749
1716
  *
1750
1717
  * @returns Whether or not the user has granted push permission. If this returns true,
1751
- * `appboy.registerAppboyPushMessages` may be called without the user being prompted. If this returns false,
1752
- * `appboy.registerAppboyPushMessages` may prompt the user (if `appboy.isPushSupported` returns true) or do
1753
- * nothing (if `appboy.isPushSupported` returns false)
1718
+ * `requestPushPermission` may be called without the user being prompted. If this returns false,
1719
+ * `requestPushPermission` may prompt the user (if `isPushSupported` returns true) or do
1720
+ * nothing (if `isPushSupported` returns false). Returns undefined if the SDK has not been initialized.
1754
1721
  */
1755
- function isPushPermissionGranted(): boolean;
1722
+ export function isPushPermissionGranted(): boolean | undefined;
1756
1723
 
1757
1724
  /**
1758
1725
  * The [W3C Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API) is partially supported
1759
1726
  * across the browser landscape. This method allows you to programmatically determine whether push is supported
1760
1727
  * in the current browser, and whether to show push-related user class elements to the user.
1761
1728
  *
1762
- * @returns Whether or not push is supported in this environment.
1729
+ * @returns Whether or not push is supported in this environment. Returns undefined if the SDK has not been initialized.
1763
1730
  */
1764
- function isPushSupported(): boolean;
1731
+ export function isPushSupported(): boolean | undefined;
1765
1732
 
1766
1733
  /**
1767
- * Logs that the user clicked the given card. This is done automatically when you use Appboy's display module
1734
+ * Logs that the user clicked the given card. This is done automatically when you use Braze's display module
1768
1735
  * and should only be called if you're bypassing that and manually building the DOM for displaying the cards in
1769
1736
  * your own code.
1770
1737
  *
@@ -1773,10 +1740,10 @@ declare namespace appboy {
1773
1740
  *
1774
1741
  * @returns Whether or not the event was successfully logged (to be flushed later).
1775
1742
  */
1776
- function logCardClick(card: appboy.Card, forContentCards?: boolean): boolean;
1743
+ export function logCardClick(card: Card, forContentCards?: boolean): boolean;
1777
1744
 
1778
1745
  /**
1779
- * Logs that the user dismissed the given card. This is done automatically when you use Appboy's display module
1746
+ * Logs that the user dismissed the given card. This is done automatically when you use Braze's display module
1780
1747
  * and should only be called if you're bypassing that and manually building the DOM for displaying the cards in
1781
1748
  * your own code.
1782
1749
  *
@@ -1784,10 +1751,10 @@ declare namespace appboy {
1784
1751
  *
1785
1752
  * @returns Whether or not the event was successfully logged (to be flushed later).
1786
1753
  */
1787
- function logCardDismissal(card: appboy.Card): boolean;
1754
+ export function logCardDismissal(card: Card): boolean;
1788
1755
 
1789
1756
  /**
1790
- * Logs that the user saw the given cards. This is done automatically when you use Appboy's display module
1757
+ * Logs that the user saw the given cards. This is done automatically when you use Braze's display module
1791
1758
  * and should only be called if you're bypassing that and manually building the DOM for displaying the cards in
1792
1759
  * your own code.
1793
1760
  *
@@ -1796,25 +1763,23 @@ declare namespace appboy {
1796
1763
  *
1797
1764
  * @returns Whether or not the event was successfully logged (to be flushed later).
1798
1765
  */
1799
- function logCardImpressions(
1800
- cards: appboy.Card[],
1766
+ export function logCardImpressions(
1767
+ cards: Card[],
1801
1768
  forContentCards?: boolean
1802
1769
  ): boolean;
1803
1770
 
1804
1771
  /**
1805
- * Logs that the content cards were displayed. This is done automatically when you use Appboy's
1806
- * display module and should only be called if you're bypassing that and manually building
1772
+ * Logs that the content cards were displayed. This is done automatically when you use Braze's
1773
+ * UI and should only be called if you're bypassing that and manually building
1807
1774
  * the class for displaying the cards in your own code.
1808
1775
  */
1809
- function logContentCardsDisplayed(): boolean;
1776
+ export function logContentCardsDisplayed(): boolean;
1810
1777
 
1811
1778
  /**
1812
1779
  * Reports that the current user performed a custom named event.
1813
1780
  *
1814
- * @param eventName - The identifier for the event to track. Best practice is to track generic events
1815
- * useful for segmenting, instead of specific user actions (i.e. track watched_sports_video instead of
1816
- * watched_video_adrian_peterson_td_mnf). Value is limited to 255 characters in length, cannot begin with a $,
1817
- * and can only contain alphanumeric characters and punctuation.
1781
+ * @param eventName - The identifier for the event to track. Value is limited to 255 characters in length,
1782
+ * cannot begin with a $, and can only contain alphanumeric characters and punctuation.
1818
1783
  * @param eventProperties - Hash of properties for this event. Keys are limited to 255 characters in length, cannot begin
1819
1784
  * with a $, and can only contain alphanumeric characters and punctuation. Values can be numeric, boolean, Date objects,
1820
1785
  * strings 255 characters or shorter, or nested objects whose values can be numeric, boolean, Date objects, arrays, strings,
@@ -1822,18 +1787,18 @@ declare namespace appboy {
1822
1787
  *
1823
1788
  * @returns Whether or not the event was successfully logged (to be flushed later).
1824
1789
  */
1825
- function logCustomEvent(eventName: string, eventProperties?: object): boolean;
1790
+ export function logCustomEvent(eventName: string, eventProperties?: object): boolean;
1826
1791
 
1827
1792
  /**
1828
- * Logs that the news feed was displayed. This is done automatically when you use Appboy's
1829
- * display module and should only be called if you're bypassing that and manually building
1793
+ * Logs that the news feed was displayed. This is done automatically when you use Braze's
1794
+ * UI and should only be called if you're bypassing that and manually building
1830
1795
  * the class for displaying the cards in your own code.
1831
1796
  */
1832
- function logFeedDisplayed(): void;
1797
+ export function logFeedDisplayed(): void;
1833
1798
 
1834
1799
  /**
1835
1800
  * Logs that the user clicked the given in-app message button. This is done automatically when the user clicks on
1836
- * a button in a message generated by `display.showInAppMessage`,
1801
+ * a button in a message generated by `showInAppMessage`,
1837
1802
  * and should only be called if you're bypassing that method and manually displaying the message in your own
1838
1803
  * code.
1839
1804
  *
@@ -1842,25 +1807,25 @@ declare namespace appboy {
1842
1807
  *
1843
1808
  * @returns Whether or not the event was successfully logged (to be flushed later).
1844
1809
  */
1845
- function logInAppMessageButtonClick(
1846
- button: appboy.InAppMessageButton,
1847
- inAppMessage: appboy.InAppMessage
1810
+ export function logInAppMessageButtonClick(
1811
+ button: InAppMessageButton,
1812
+ inAppMessage: InAppMessage
1848
1813
  ): boolean;
1849
1814
 
1850
1815
  /**
1851
1816
  * Logs that the user clicked the given in-app message. This is done automatically when the user clicks on a
1852
- * message generated by `display.showInAppMessage`, and should
1817
+ * message generated by `showInAppMessage`, and should
1853
1818
  * only be called if you're bypassing that method and manually displaying the message in your own code.
1854
1819
  *
1855
1820
  * @param inAppMessage
1856
1821
  *
1857
1822
  * @returns Whether or not the event was successfully logged (to be flushed later).
1858
1823
  */
1859
- function logInAppMessageClick(inAppMessage: appboy.InAppMessage): boolean;
1824
+ export function logInAppMessageClick(inAppMessage: InAppMessage): boolean;
1860
1825
 
1861
1826
  /**
1862
1827
  * Logs that the user clicked on a link in an html in-app message. This is done automatically when the user clicks
1863
- * on a message generated by `display.showInAppMessage`, and should
1828
+ * on a message generated by `showInAppMessage`, and should
1864
1829
  * only be called if you're bypassing that method and manually displaying the message in your own code.
1865
1830
  *
1866
1831
  * @param inAppMessage - The message that was clicked
@@ -1869,22 +1834,22 @@ declare namespace appboy {
1869
1834
  *
1870
1835
  * @returns Whether or not the event was successfully logged (to be flushed later).
1871
1836
  */
1872
- function logInAppMessageHtmlClick(
1873
- inAppMessage: appboy.HtmlMessage,
1837
+ export function logInAppMessageHtmlClick(
1838
+ inAppMessage: HtmlMessage,
1874
1839
  buttonId?: string,
1875
1840
  url?: string
1876
1841
  ): boolean;
1877
1842
 
1878
1843
  /**
1879
- * Logs that the user saw the given in-app message. This is performed automatically when you use `display.showInAppMessage`,
1844
+ * Logs that the user saw the given in-app message. This is performed automatically when you use `showInAppMessage`,
1880
1845
  * and should only be called if you're bypassing that method and manually displaying the message in your own code.
1881
1846
  *
1882
1847
  * @param inAppMessage
1883
1848
  *
1884
1849
  * @returns Whether or not the event was successfully logged (to be flushed later).
1885
1850
  */
1886
- function logInAppMessageImpression(
1887
- inAppMessage: appboy.InAppMessage | appboy.ControlMessage
1851
+ export function logInAppMessageImpression(
1852
+ inAppMessage: InAppMessage | ControlMessage
1888
1853
  ): boolean;
1889
1854
 
1890
1855
  /**
@@ -1915,7 +1880,7 @@ declare namespace appboy {
1915
1880
  *
1916
1881
  * @returns Whether or not the purchase was successfully attached to the session (to be flushed later).
1917
1882
  */
1918
- function logPurchase(
1883
+ export function logPurchase(
1919
1884
  productId: string,
1920
1885
  price: number,
1921
1886
  currencyCode?: string,
@@ -1928,12 +1893,12 @@ declare namespace appboy {
1928
1893
  * When a new session is opened, syncs triggered In-App Messages and Content Cards. If the user has previously
1929
1894
  * granted the site permission to send push, automatically sends the push registration to the Braze backend.
1930
1895
  */
1931
- function openSession(): void;
1896
+ export function openSession(): void;
1932
1897
 
1933
1898
  /**
1934
1899
  * Register this browser environment to receive web push for this user. Supports browsers which implement the
1935
1900
  * [W3C Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API) (browsers in which
1936
- * `appboy.isPushSupported` returns true). If push is supported and the user is not already subscribed,
1901
+ * `isPushSupported` returns true). If push is supported and the user is not already subscribed,
1937
1902
  * this method will cause the browser to immediately request push permission from the user.
1938
1903
  *
1939
1904
  * In order to properly use this feature, there are some integration steps required on your end:
@@ -1942,10 +1907,10 @@ declare namespace appboy {
1942
1907
  * - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
1943
1908
  *
1944
1909
  * ```
1945
- * self.importScripts('https://js.appboycdn.com/web-sdk-develop/3.5/service-worker.js');
1910
+ * self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.0/service-worker.js');
1946
1911
  * ```
1947
1912
  *
1948
- * For more details, see [Our Product Documentation](https://www.appboy.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
1913
+ * For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
1949
1914
  *
1950
1915
  * @param successCallback - When the user subscribes to push successfully this callback will be
1951
1916
  * invoked with the user's endpoint, public key, and user auth key (endpoint, publicKey, userAuth).
@@ -1953,7 +1918,7 @@ declare namespace appboy {
1953
1918
  * is temporary, it will be invoked with a parameter of `true` - otherwise it will be invoked with a parameter
1954
1919
  * of `false`.
1955
1920
  */
1956
- function registerAppboyPushMessages(
1921
+ export function requestPushPermission(
1957
1922
  successCallback?: (
1958
1923
  endpoint: string,
1959
1924
  publicKey: string,
@@ -1965,7 +1930,7 @@ declare namespace appboy {
1965
1930
  /**
1966
1931
  * Remove all event subscriptions.
1967
1932
  */
1968
- function removeAllSubscriptions(): void;
1933
+ export function removeAllSubscriptions(): void;
1969
1934
 
1970
1935
  /**
1971
1936
  * Remove an event subscription that you previously subscribed to.
@@ -1973,10 +1938,10 @@ declare namespace appboy {
1973
1938
  * @param subscriptionGuid - The identifier of the subscription you wish to remove, returned by the method
1974
1939
  * you initially used to create it.
1975
1940
  */
1976
- function removeSubscription(subscriptionGuid: string): void;
1941
+ export function removeSubscription(subscriptionGuid: string): void;
1977
1942
 
1978
1943
  /**
1979
- * Requests an immediate refresh of content cards from Appboy servers. By default, content cards are refreshed when
1944
+ * Requests an immediate refresh of content cards from Braze servers. By default, content cards are refreshed when
1980
1945
  * a new session opens (see 'openSession` for more details), and when the user refreshes content cards manually via
1981
1946
  * the refresh button. If you want to refresh content cards from the server at another time you must call this function.
1982
1947
  *
@@ -1985,16 +1950,16 @@ declare namespace appboy {
1985
1950
  * a request has completed regardless of whether new cards were returned.
1986
1951
  * @param errorCallback - Callback that is invoked when an error occurs during the refresh.
1987
1952
  */
1988
- function requestContentCardsRefresh(successCallback?: () => void, errorCallback?: () => void): void;
1953
+ export function requestContentCardsRefresh(successCallback?: () => void, errorCallback?: () => void): void;
1989
1954
 
1990
1955
  /**
1991
1956
  * Requests an immediate refresh of the news feed from Braze servers. By default, the news feed is refreshed on
1992
- * `display.showFeed` (when stale - see
1993
- * `display.showFeed` for details). If you want to refresh the feed from the
1957
+ * `showFeed` (when stale - see
1958
+ * `showFeed` for details). If you want to refresh the feed from the
1994
1959
  * server at another time you must call this function. Results of this refresh are reported asynchronously to
1995
1960
  * subscriptions created via 'subscribeToFeedUpdates` .
1996
1961
  */
1997
- function requestFeedRefresh(): void;
1962
+ export function requestFeedRefresh(): void;
1998
1963
 
1999
1964
  /**
2000
1965
  * By default, data logged to Braze through the SDK is queued locally (in HTML 5 localStorage when available, and
@@ -2006,25 +1971,20 @@ declare namespace appboy {
2006
1971
  * whether or not the flush was successful. If the flush is unsuccessful, pending data will be
2007
1972
  * flushed during the next successful flush.
2008
1973
  */
2009
- function requestImmediateDataFlush(
1974
+ export function requestImmediateDataFlush(
2010
1975
  callback?: (success: boolean) => void
2011
1976
  ): void;
2012
1977
 
2013
- /**
2014
- * @deprecated This method has been deprecated in favor of `enableSDK`, which has the same functionality.
2015
- */
2016
- function resumeWebTracking(): void;
2017
-
2018
1978
  /**
2019
1979
  * Removes the cookie set by `disableSDK`, causing subsequent calls to the Braze Web SDK to function. You must
2020
1980
  * call `initialize` after calling this method before calling subsequent methods.
2021
1981
  */
2022
- function enableSDK(): void;
1982
+ export function enableSDK(): void;
2023
1983
 
2024
1984
  /**
2025
- * Getter method to determine if the SDK is disabled based on whether the cookie set by `stopWebTracking` exists
1985
+ * Getter method to determine if the SDK is disabled based on whether the cookie set by `disableSdk` exists
2026
1986
  */
2027
- function isDisabled(): boolean;
1987
+ export function isDisabled(): boolean;
2028
1988
 
2029
1989
  /**
2030
1990
  * By default, Braze logs to the browser console. Call this method to set a custom log action and enable debug-level log statements.
@@ -2032,7 +1992,7 @@ declare namespace appboy {
2032
1992
  * @param loggerFunction - A function to invoke with log messages. Should accept a single string
2033
1993
  * parameter for message.
2034
1994
  */
2035
- function setLogger(loggerFunction: (message: string) => void): void;
1995
+ export function setLogger(loggerFunction: (message: string) => void): void;
2036
1996
 
2037
1997
  /**
2038
1998
  * Sets the signature to be used to authenticate the current user. You can also set the signature when calling `changeUser`.
@@ -2042,21 +2002,16 @@ declare namespace appboy {
2042
2002
  *
2043
2003
  * @returns Whether or not the signature is valid.
2044
2004
  */
2045
- function setSdkAuthenticationSignature(signature: string): boolean;
2005
+ export function setSdkAuthenticationSignature(signature: string): boolean;
2046
2006
 
2047
2007
  /**
2048
- * Adds SDK Metadata, which you can use to self-report how you load and integrate the Braze SDK.
2008
+ * Adds SDK Metadata. This method is automatically called based on the integration method.
2049
2009
  *
2050
2010
  * @param sdkMetadata - An array of metadata values from `BrazeSdkMetadata`.
2051
2011
  *
2052
2012
  * @returns Whether or not the array of metadata is valid.
2053
2013
  */
2054
- function addSdkMetadata(sdkMetadata: string[]): boolean;
2055
-
2056
- /**
2057
- * @deprecated This method has been deprecated in favor of `disableSDK`, which has the same functionality.
2058
- */
2059
- function stopWebTracking(): void;
2014
+ export function addSdkMetadata(sdkMetadata: string[]): boolean;
2060
2015
 
2061
2016
  /**
2062
2017
  * Sets a cookie that causes all subsequent calls to the Braze Web SDK to be ignored
@@ -2064,10 +2019,11 @@ declare namespace appboy {
2064
2019
  * If you have multiple subdomains, this method MUST be called from the same subdomain that push was registered from to work properly.
2065
2020
  * This is useful for customer opt-outs. If the customer clears website data, tracking will resume.
2066
2021
  */
2067
- function disableSDK(): void;
2022
+ export function disableSDK(): void;
2068
2023
 
2069
2024
  /**
2070
- * Subscribe to content cards updates. The subscriber callback will be called whenever content cards are updated.
2025
+ * Subscribe to content cards updates. The subscriber callback will be called whenever content cards are updated. This method
2026
+ * should be called before calling `openSession`.
2071
2027
  *
2072
2028
  * @param subscriber - The callback function to handle new cards. This function will be called with a `ContentCards`
2073
2029
  * object which includes all currently available `Card` objects. If you want to be notified when a refresh has completed
@@ -2075,8 +2031,8 @@ declare namespace appboy {
2075
2031
  *
2076
2032
  * @returns The identifier of the subscription created. This can be passed to `removeSubscription` to cancel the subscription.
2077
2033
  */
2078
- function subscribeToContentCardsUpdates(
2079
- subscriber: (cards: appboy.ContentCards) => void
2034
+ export function subscribeToContentCardsUpdates(
2035
+ subscriber: (cards: ContentCards) => void
2080
2036
  ): string;
2081
2037
 
2082
2038
  /**
@@ -2085,61 +2041,36 @@ declare namespace appboy {
2085
2041
  * @param subscriber - The callback function to handle new cards. This function will be
2086
2042
  * called with a `Feed`object which includes all `Card` objects currently in the feed.
2087
2043
  *
2088
- * @returns The identifier of the subscription created. This can be passed to
2089
- * `removeSubscription` to cancel the subscription.
2044
+ * @returns The identifier of the subscription created. This can be passed to `removeSubscription` to cancel
2045
+ * the subscription. Returns undefined if the SDK has not been initialized.
2090
2046
  */
2091
- function subscribeToFeedUpdates(
2092
- subscriber: (feed: appboy.Feed) => void
2093
- ): string;
2047
+ export function subscribeToFeedUpdates(
2048
+ subscriber: (feed: Feed) => void
2049
+ ): string | undefined;
2094
2050
 
2095
2051
  /**
2096
2052
  * Subscribe to receive in-app messages. The subscriber callback will be called whenever a new in-app message is
2097
- * triggered. If you are using the build of Braze's library with UI, the most basic usage of this would be
2053
+ * triggered. This method should be called before calling `openSession`. If you are using the build of Braze's
2054
+ * library with UI, the most basic usage of this would be
2055
+ *
2098
2056
  * ```
2099
- * appboy.subscribeToInAppMessage(function(inAppMessage) {
2100
- * appboy.display.showInAppMessage(inAppMessage);
2057
+ * braze.subscribeToInAppMessage(function(inAppMessage) {
2058
+ * braze.showInAppMessage(inAppMessage);
2101
2059
  * });
2102
2060
  * ```
2103
2061
  * @param callback - The callback function to handle the in-app message. This function will be
2104
2062
  * called with an `InAppMessage` or a `ControlMessage` object. If you are using the build
2105
- * of Braze's library with UI, you may wish to call `display.showInAppMessage`
2063
+ * of Braze's library with UI, you may wish to call `showInAppMessage`
2106
2064
  * with the provided message.
2107
2065
  *
2108
- * @returns The identifier of the subscription created. This can be passed to
2109
- * 'removeSubscription` to cancel the subscription.
2066
+ * @returns The identifier of the subscription created. This can be passed to 'removeSubscription` to cancel
2067
+ * the subscription. Returns undefined if the SDK has not been initialized.
2110
2068
  */
2111
- function subscribeToInAppMessage(
2069
+ export function subscribeToInAppMessage(
2112
2070
  callback: (
2113
- inAppMessage: appboy.InAppMessage | appboy.ControlMessage
2071
+ inAppMessage: InAppMessage | ControlMessage
2114
2072
  ) => void
2115
- ): string;
2116
-
2117
- /**
2118
- * DEPRECATED - Subscribe to receive in-app messages. The subscriber callback will be called whenever new in-app messages are
2119
- * triggered. If you are using the build of Braze's library with UI, the most basic usage of this would be
2120
- * ```
2121
- * appboy.subscribeToNewInAppMessages(function(inAppMessages) {
2122
- * appboy.display.showInAppMessage(inAppMessages[0]);
2123
- * return inAppMessages.slice(1);
2124
- * });
2125
- * ```
2126
- * @deprecated Since Web SDK 2.4.0, this function has been replaced by `appboy.subscribeToInAppMessage`,
2127
- * which has a simpler interface. This function will be removed in a future release.
2128
- *
2129
- * @param subscriber - The callback function to handle new in-app messages. This function will be
2130
- * called with an array of all currently unhandled `InAppMessage` or `ControlMessage` objects.
2131
- * If you are using the build of Braze's library with UI, you may wish to call `display.showInAppMessage`
2132
- * with one or more messages. This function should return an array of any messages that you wish to remain
2133
- * unhandled and retained until the next time subscriber is called.
2134
- *
2135
- * @returns The identifier of the subscription created. This can be passed to
2136
- * 'removeSubscription` to cancel the subscription.
2137
- */
2138
- function subscribeToNewInAppMessages(
2139
- callback: (
2140
- inAppMessage: Array<appboy.InAppMessage | appboy.ControlMessage>
2141
- ) => void
2142
- ): string;
2073
+ ): string | undefined;
2143
2074
 
2144
2075
  /**
2145
2076
  * Subscribe to be notified of network request failures that occured due to an SDK Authentication error. This
@@ -2150,33 +2081,23 @@ declare namespace appboy {
2150
2081
  * invoked with an object containing the `errorCode`, `reason` for the error, the `userId` of the request (if the
2151
2082
  * user is not anonymous), and the authentication `signature` that caused the error.
2152
2083
  *
2153
- * @returns The identifier of the subscription created. This can be passed to
2154
- * 'removeSubscription` to cancel the subscription.
2084
+ * @returns The identifier of the subscription created. This can be passed to 'removeSubscription` to cancel
2085
+ * the subscription. Returns undefined if the SDK has not been initialized.
2155
2086
  */
2156
- function subscribeToSdkAuthenticationFailures(subscriber: (
2087
+ export function subscribeToSdkAuthenticationFailures(subscriber: (
2157
2088
  error: {
2158
2089
  errorCode: string,
2159
2090
  reason?: string,
2160
2091
  userId?: string,
2161
2092
  signature?: string
2162
2093
  }
2163
- ) => void): string;
2094
+ ) => void): string | undefined;
2164
2095
 
2165
2096
  /**
2166
2097
  * By default, Braze silences its logging to prevent spamming production js consoles. Call this method to
2167
2098
  * toggle logging.
2168
2099
  */
2169
- function toggleAppboyLogging(): void;
2170
-
2171
- /**
2172
- * Causes the Braze Web SDK to begin continuously collecting the user's location while your website is visible in
2173
- * the foreground of their browser, for the duration of this page load. This will cause the browser to request
2174
- * permission from the user if they have not already granted or denied it.
2175
- *
2176
- * @deprecated This method has been deprecated in favor of using the native [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API)
2177
- * and passing the location data to `User.setLastKnownLocation`.
2178
- */
2179
- function trackLocation(): void;
2100
+ export function toggleLogging(): void;
2180
2101
 
2181
2102
  /**
2182
2103
  * Unregisters push notifications on this browser.
@@ -2187,7 +2108,7 @@ declare namespace appboy {
2187
2108
  * callback will be invoked.
2188
2109
  * @param errorCallback - If the unsubscribe fails for unknown reasons, this callback will be invoked.
2189
2110
  */
2190
- function unregisterAppboyPushMessages(
2111
+ export function unregisterPush(
2191
2112
  successCallback?: () => void,
2192
2113
  errorCallback?: () => void
2193
2114
  ): void;
@@ -2195,13 +2116,20 @@ declare namespace appboy {
2195
2116
  /**
2196
2117
  * Removes all locally stored SDK data, causing the user to be seen in subsequent calls as a new anonymous user on a new device.
2197
2118
  */
2198
- function wipeData(): void;
2119
+ export function wipeData(): void;
2120
+
2121
+ /**
2122
+ * Handle links from within a message. This method will redirect valid links, or will parse and handle valid Braze Click Actions (brazeActions://).
2123
+ * @param url - a valid URL, or a valid brazeActions URL with scheme brazeActions://v{versionInt}/{base64string}
2124
+ * @param openLinkInNewTab - Whether the URL should be opened in a new tab. Defaults to false.
2125
+ */
2126
+ export function handleBrazeAction(url: string, openLinkInNewTab?: boolean): void;
2199
2127
 
2200
2128
  /**
2201
2129
  * Supported initialization options
2202
2130
  *
2203
2131
  */
2204
- type InitializationOptions = {
2132
+ export type InitializationOptions = {
2205
2133
  /**
2206
2134
  * By default, the Braze Web SDK ignores activity from known spiders or web crawlers, such as Google, based
2207
2135
  * on the user agent string. This saves data points, makes analytics more accurate, and may improve page rank.
@@ -2223,7 +2151,7 @@ declare namespace appboy {
2223
2151
  /**
2224
2152
  * This option is required to configure the Braze Web SDK to use the appropriate endpoint for your integration - for example:
2225
2153
  * ```
2226
- * appboy.initialize('YOUR-API-KEY-HERE', { baseUrl: 'sdk.iad-03.appboy.com' })
2154
+ * braze.initialize('YOUR-API-KEY-HERE', { baseUrl: 'sdk.iad-03.braze.com' })
2227
2155
  * ```
2228
2156
  */
2229
2157
  baseUrl: string;
@@ -2242,11 +2170,7 @@ declare namespace appboy {
2242
2170
  */
2243
2171
  devicePropertyAllowlist?: string[];
2244
2172
  /**
2245
- * @deprecated This initialization option is deprecated in favor of `devicePropertyAllowlist`, which has the same functionality.
2246
- */
2247
- devicePropertyWhitelist?: string[];
2248
- /**
2249
- * By default, users who have already granted web push permission (e.g. through `appboy.registerAppboyPushMessages` or from
2173
+ * By default, users who have already granted web push permission (e.g. through `requestPushPermission` or from
2250
2174
  * a prior push provider) will sync their push token with the Braze backend automatically on new session to ensure deliverability.
2251
2175
  * To disable this behavior, set this option to true.
2252
2176
  */
@@ -2268,7 +2192,7 @@ declare namespace appboy {
2268
2192
  enableHtmlInAppMessages?: boolean;
2269
2193
  /**
2270
2194
  * Set to true to enable logging by default. Note that this will cause Braze to log to the javascript console, which is visible
2271
- * to all users! You should probably remove this or provide an alternate logger with `appboy.setLogger` before you release
2195
+ * to all users! You should probably remove this or provide an alternate logger with `setLogger` before you release
2272
2196
  * your page to production.
2273
2197
  */
2274
2198
  enableLogging?: boolean;
@@ -2278,8 +2202,8 @@ declare namespace appboy {
2278
2202
  */
2279
2203
  enableSdkAuthentication?: boolean
2280
2204
  /**
2281
- * By default, the Braze SDK will show In-App Messages with a z-index of 1040 for the screen overlay, 1050 for the actual in-app message,
2282
- * and 1060 for the message's close button. Provide a value for this option to override these default z-indexes. The value provided
2205
+ * By default, the Braze SDK will show In-App Messages with a z-index of 9001 for the screen overlay, 9011 for the actual in-app message,
2206
+ * and 9021 for the message's close button. Provide a value for this option to override these default z-indexes. The value provided
2283
2207
  * will be used for the backdrop, `value + 1` will be used for the in-app message, and `value + 2` will be used for the close button.
2284
2208
  */
2285
2209
  inAppMessageZIndex?: number
@@ -2292,12 +2216,12 @@ declare namespace appboy {
2292
2216
  */
2293
2217
  localization?: string;
2294
2218
  /**
2295
- * By default, `appboy.registerAppboyPushMessages`/`appboy.unregisterAppboyPushMessages` assume that they control and can
2219
+ * By default, `requestPushPermission`/`unregisterPush` assume that they control and can
2296
2220
  * register and unregister the site's service worker. If you have your own service worker that you register and control the
2297
2221
  * lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
2298
2222
  * option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
2299
- * `appboy.registerAppboyPushMessages`, and ensure that it contains Braze's service worker code, either with
2300
- * `self.importScripts('https://js.appboycdn.com/web-sdk-develop/3.5/service-worker.js');` or by including the content
2223
+ * `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
2224
+ * `self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.0/service-worker.js');` or by including the content
2301
2225
  * of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
2302
2226
  */
2303
2227
  manageServiceWorkerExternally?: boolean;
@@ -2340,7 +2264,7 @@ declare namespace appboy {
2340
2264
  * root directory of your web server at `/service-worker.js`. If you want to host your service worker at a different path
2341
2265
  * on that server, provide a value for this option that is the absolute path to the file, e.g. `/mycustompath/my-worker.js`.
2342
2266
  * VERY IMPORTANT: setting a value here limits the scope of push notifications on your site. For instance, in the above
2343
- * example, because the service worker file is located within the `/mycustompath/` directory, `appboy.registerAppboyPushMessages`
2267
+ * example, because the service worker file is located within the `/mycustompath/` directory, `requestPushPermission`
2344
2268
  * MAY ONLY BE CALLED from web pages that start with `http://yoursite.com/mycustompath/`.
2345
2269
  */
2346
2270
  serviceWorkerLocation?: string;
@@ -2350,6 +2274,7 @@ declare namespace appboy {
2350
2274
  */
2351
2275
  sessionTimeoutInSeconds?: number;
2352
2276
  };
2353
- }
2354
2277
 
2355
- export default appboy;
2278
+
2279
+
2280
+