@braze/web-sdk 5.9.1 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +209 -283
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +27 -29
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +22 -22
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +22 -23
- package/src/Banner/banner-factory.js +2 -1
- package/src/Banner/banner-provider-factory.js +7 -7
- package/src/Banner/banner-provider.js +92 -98
- package/src/Banner/banner.js +21 -18
- package/src/Banner/display/banner-to-html.js +18 -30
- package/src/Banner/display/detect-banner-impressions.js +11 -11
- package/src/Banner/get-all-banners.js +5 -5
- package/src/Banner/get-banner.js +7 -7
- package/src/Banner/index.js +0 -1
- package/src/Banner/log-banner-click.js +7 -7
- package/src/Banner/log-banner-impressions.js +9 -9
- package/src/Banner/request-banners-refresh.js +23 -27
- package/src/Banner/subscribe-to-banners-updates.js +9 -9
- package/src/Banner/ui/insert-banner.js +10 -10
- package/src/Card/card-manager-factory.js +7 -7
- package/src/Card/card-manager.js +45 -47
- package/src/Card/display/card-display.js +76 -74
- package/src/Card/index.js +0 -2
- package/src/Card/log-card-dismissal.js +4 -4
- package/src/Card/log-content-card-click.js +9 -2
- package/src/Card/log-content-card-impressions.js +11 -2
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +116 -110
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +15 -15
- package/src/Card/models/image-only.js +20 -21
- package/src/Card/util/card-factory.js +58 -79
- package/src/ContentCards/content-cards-provider-factory.js +13 -13
- package/src/ContentCards/content-cards-provider.js +148 -148
- package/src/ContentCards/content-cards.js +21 -13
- package/src/ContentCards/get-cached-content-cards.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +2 -2
- package/src/ContentCards/subscribe-to-content-cards-updates.js +8 -8
- package/src/ContentCards/ui/hide-content-cards.js +5 -5
- package/src/ContentCards/ui/show-content-cards.js +35 -35
- package/src/Core/add-sdk-metadata.js +5 -5
- package/src/Core/change-user.js +7 -7
- package/src/Core/destroy.js +2 -2
- package/src/Core/disable-sdk.js +10 -10
- package/src/Core/enable-sdk.js +7 -7
- package/src/Core/get-device-id.js +4 -4
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +10 -10
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +18 -18
- package/src/Core/log-purchase.js +19 -19
- package/src/Core/open-session.js +13 -13
- package/src/Core/request-immediate-data-flush.js +1 -1
- package/src/Core/set-logger.js +2 -2
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +9 -9
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +20 -71
- package/src/FeatureFlags/feature-flags-provider-factory.js +7 -7
- package/src/FeatureFlags/feature-flags-provider.js +86 -86
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +3 -3
- package/src/FeatureFlags/log-feature-flag-impression.js +8 -8
- package/src/FeatureFlags/refresh-feature-flags.js +1 -1
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
- package/src/InAppMessage/defer-in-app-message.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +41 -41
- package/src/InAppMessage/display/in-app-message-to-html.js +145 -139
- package/src/InAppMessage/display/modal-utils.js +40 -42
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +24 -16
- package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
- package/src/InAppMessage/in-app-message-manager.js +124 -122
- package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
- package/src/InAppMessage/log-in-app-message-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-html-click.js +11 -11
- package/src/InAppMessage/log-in-app-message-impression.js +4 -4
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +41 -35
- package/src/InAppMessage/models/html-message.js +28 -26
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +156 -152
- package/src/InAppMessage/models/modal-message.js +40 -34
- package/src/InAppMessage/models/slide-up-message.js +38 -32
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +68 -74
- package/src/Push/is-push-blocked.js +2 -2
- package/src/Push/is-push-permission-granted.js +2 -2
- package/src/Push/is-push-supported.js +2 -2
- package/src/Push/push-manager-factory.js +17 -17
- package/src/Push/push-manager.js +127 -127
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/utils/push-utils.js +25 -15
- package/src/User/user-manager.js +20 -20
- package/src/User/user.js +60 -61
- package/src/common/base-provider.js +1 -1
- package/src/common/content-cards-display.js +211 -0
- package/src/common/event-logger.js +12 -12
- package/src/common/properties-base.js +56 -0
- package/src/index.js +0 -1
- package/src/l10n/l10n-manager-factory.js +10 -10
- package/src/l10n/l10n-manager.js +7 -7
- package/src/managers/auth-manager.js +36 -36
- package/src/managers/braze-instance.js +184 -185
- package/src/managers/device-manager.js +26 -26
- package/src/managers/network-manager.js +194 -193
- package/src/managers/server-config-manager.js +75 -75
- package/src/managers/session-manager.js +29 -29
- package/src/managers/storage-manager-factory.js +13 -13
- package/src/managers/storage-manager.js +162 -164
- package/src/managers/subscription-manager.js +12 -12
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +16 -16
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +8 -8
- package/src/models/push-token.js +10 -10
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +33 -33
- package/src/request-controller.js +193 -192
- package/src/triggers/models/custom-event-data.js +7 -7
- package/src/triggers/models/custom-event-property-data.js +8 -8
- package/src/triggers/models/filter-set.js +8 -8
- package/src/triggers/models/filter.js +43 -43
- package/src/triggers/models/in-app-message-click-data.js +4 -4
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +2 -2
- package/src/triggers/models/trigger-condition.js +52 -52
- package/src/triggers/models/trigger-events.js +4 -4
- package/src/triggers/models/trigger.js +19 -19
- package/src/triggers/triggers-provider-factory.js +14 -14
- package/src/triggers/triggers-provider.js +70 -70
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/banner-css.js +1 -1
- package/src/ui/js/iam-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +4 -4
- package/src/util/braze-actions.js +12 -18
- package/src/util/browser-detector.js +27 -20
- package/src/util/client-hints-parser.js +8 -8
- package/src/util/code-utils.js +2 -2
- package/src/util/component-utils.js +14 -14
- package/src/util/deprecation-utils.js +2 -2
- package/src/util/device-constants.js +5 -5
- package/src/util/dom-utils.js +9 -9
- package/src/util/html-display-utils.js +38 -38
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +12 -12
- package/src/util/request-header-utils.js +22 -22
- package/src/util/string-utils.js +2 -2
- package/src/util/user-agent-parser.js +17 -17
- package/src/util/validation-utils.js +28 -28
- package/src/util/window-utils.js +2 -2
- package/src/Card/log-card-click.js +0 -11
- package/src/Card/log-card-impressions.js +0 -13
- package/src/Feed/feed-provider-factory.js +0 -18
- package/src/Feed/feed-provider.js +0 -90
- package/src/Feed/feed.js +0 -20
- package/src/Feed/get-cached-feed.js +0 -5
- package/src/Feed/index.js +0 -8
- package/src/Feed/log-feed-displayed.js +0 -7
- package/src/Feed/request-feed-refresh.js +0 -5
- package/src/Feed/subscribe-to-feed-updates.js +0 -5
- package/src/Feed/types.js +0 -1
- package/src/Feed/ui/hide-feed.js +0 -7
- package/src/Feed/ui/show-feed.js +0 -96
- package/src/Feed/ui/toggle-feed.js +0 -8
- package/src/common/base-feed.js +0 -29
- package/src/common/feed-display.js +0 -211
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Type definitions for @braze/web-sdk
|
|
2
|
+
* Type definitions for @braze/web-sdk v6.1.0
|
|
3
3
|
* Project: https://github.com/braze-inc/braze-web-sdk
|
|
4
4
|
* (c) Braze, Inc. 2025 - http://braze.com
|
|
5
5
|
* License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
|
|
@@ -57,7 +57,7 @@ export class DeviceProperties {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* Abstract base for
|
|
60
|
+
* Abstract base for Content Cards. Use subclasses `ClassicCard`, `CaptionedImage`,
|
|
61
61
|
* `ImageOnly`, and `ControlCard`. For example, you can check `if (card instanceof ClassicCard)` to
|
|
62
62
|
* determine if the card is of the type `ClassicCard`.
|
|
63
63
|
*/
|
|
@@ -132,61 +132,46 @@ export class Card {
|
|
|
132
132
|
|
|
133
133
|
export class ImageOnly extends Card {
|
|
134
134
|
/**
|
|
135
|
-
* A card with only an image, which can be passed to `
|
|
136
|
-
* Subscribe to receive new cards via `
|
|
135
|
+
* A card with only an image, which can be passed to `showContentCards` or handled manually.
|
|
136
|
+
* Subscribe to receive new cards via `subscribeToContentCardsUpdates`
|
|
137
137
|
*
|
|
138
138
|
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
139
139
|
* @param viewed - Whether this card has been shown to the user.
|
|
140
140
|
* @param imageUrl - The url for this card's image.
|
|
141
|
-
* @param created - When this card was created.
|
|
142
141
|
* @param updated - When this card was last modified.
|
|
143
|
-
* @param categories - Purely for organization in your custom implementation, these categories can be set in
|
|
144
|
-
* the dashboard composer.
|
|
145
142
|
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
146
143
|
* @param url - A url to open when this card is clicked.
|
|
147
|
-
* @param linkText - The display text for the url.
|
|
148
144
|
* @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before
|
|
149
145
|
* image loading completes. Note that the field may not be supplied in certain circumstances.
|
|
150
146
|
* @param extras - Object of string/string key/value pairs.
|
|
151
147
|
* @param pinned - Whether to pin this card to the top of the view.
|
|
152
148
|
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
153
149
|
* @param clicked - Whether this card has ever been clicked on this device.
|
|
150
|
+
* @param language - The language of the card in BCP 47 format. This field is set in the campaign on the Braze dashboard.
|
|
151
|
+
* @param altImageText - The alternate text of the card's image to be announced when in accessibility mode.
|
|
154
152
|
*/
|
|
155
153
|
constructor(
|
|
156
154
|
id?: string,
|
|
157
155
|
viewed?: boolean,
|
|
158
156
|
imageUrl?: string,
|
|
159
|
-
created?: Date,
|
|
160
157
|
updated?: Date,
|
|
161
|
-
categories?: string[],
|
|
162
158
|
expiresAt?: Date,
|
|
163
159
|
url?: string,
|
|
164
|
-
linkText?: string,
|
|
165
160
|
aspectRatio?: number,
|
|
166
161
|
extras?: Record<string, string>,
|
|
167
162
|
pinned?: boolean,
|
|
168
163
|
dismissible?: boolean,
|
|
169
164
|
clicked?: boolean,
|
|
165
|
+
language?: string,
|
|
166
|
+
altImageText?: string,
|
|
170
167
|
);
|
|
171
168
|
|
|
172
169
|
/** The url for this card's image. */
|
|
173
170
|
imageUrl?: string;
|
|
174
171
|
|
|
175
|
-
/** When this card was created. */
|
|
176
|
-
created: Date | null;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Purely for organization in your custom implementation, these categories can be set in
|
|
180
|
-
* the dashboard composer.
|
|
181
|
-
*/
|
|
182
|
-
categories: string[];
|
|
183
|
-
|
|
184
172
|
/** A url to open when this card is clicked. */
|
|
185
173
|
url?: string;
|
|
186
174
|
|
|
187
|
-
/** The display text for the url. */
|
|
188
|
-
linkText?: string;
|
|
189
|
-
|
|
190
175
|
/**
|
|
191
176
|
* The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes.
|
|
192
177
|
* Note that the field may not be supplied in certain circumstances.
|
|
@@ -201,22 +186,25 @@ export class ImageOnly extends Card {
|
|
|
201
186
|
|
|
202
187
|
/** Whether this card has ever been clicked on this device. */
|
|
203
188
|
clicked: boolean;
|
|
189
|
+
|
|
190
|
+
/** The language of the card in BCP 47 format. This field is set in the campaign on the Braze dashboard. */
|
|
191
|
+
language?: string;
|
|
192
|
+
|
|
193
|
+
/** The alternate text of the card's image to be announced when in accessibility mode. */
|
|
194
|
+
altImageText?: string;
|
|
204
195
|
}
|
|
205
196
|
|
|
206
197
|
export class CaptionedImage extends Card {
|
|
207
198
|
/**
|
|
208
|
-
* A card with a large image and descriptive text, which can be passed to `
|
|
209
|
-
* Subscribe to receive new cards via `
|
|
199
|
+
* A card with a large image and descriptive text, which can be passed to `showContentCards` or handled manually.
|
|
200
|
+
* Subscribe to receive new cards via `subscribeToContentCardsUpdates`.
|
|
210
201
|
*
|
|
211
202
|
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
212
203
|
* @param viewed - Whether this card has been shown to the user.
|
|
213
204
|
* @param title - The title text for this card.
|
|
214
205
|
* @param imageUrl - The url for this card's image.
|
|
215
206
|
* @param description - The body text for this card.
|
|
216
|
-
* @param created - When this card was created.
|
|
217
207
|
* @param updated - When this card was last modified.
|
|
218
|
-
* @param categories - Purely for organization in your custom implementation, these categories can be set in
|
|
219
|
-
* the dashboard composer.
|
|
220
208
|
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
221
209
|
* @param url - A url to open when this card is clicked.
|
|
222
210
|
* @param linkText - The display text for the url.
|
|
@@ -226,6 +214,8 @@ export class CaptionedImage extends Card {
|
|
|
226
214
|
* @param pinned - Whether to pin this card to the top of the view.
|
|
227
215
|
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
228
216
|
* @param clicked - Whether this card has ever been clicked on this device.
|
|
217
|
+
* @param language - The language of the card in BCP 47 format. This field is set in the campaign on the Braze dashboard.
|
|
218
|
+
* @param altImageText - The alternate text of the card's image to be announced when in accessibility mode.
|
|
229
219
|
*/
|
|
230
220
|
constructor(
|
|
231
221
|
id?: string,
|
|
@@ -233,9 +223,7 @@ export class CaptionedImage extends Card {
|
|
|
233
223
|
title?: string,
|
|
234
224
|
imageUrl?: string,
|
|
235
225
|
description?: string,
|
|
236
|
-
created?: Date,
|
|
237
226
|
updated?: Date,
|
|
238
|
-
categories?: string[],
|
|
239
227
|
expiresAt?: Date,
|
|
240
228
|
url?: string,
|
|
241
229
|
linkText?: string,
|
|
@@ -244,6 +232,8 @@ export class CaptionedImage extends Card {
|
|
|
244
232
|
pinned?: boolean,
|
|
245
233
|
dismissible?: boolean,
|
|
246
234
|
clicked?: boolean,
|
|
235
|
+
language?: string,
|
|
236
|
+
altImageText?: string,
|
|
247
237
|
);
|
|
248
238
|
|
|
249
239
|
/** The title text for this card. */
|
|
@@ -255,15 +245,6 @@ export class CaptionedImage extends Card {
|
|
|
255
245
|
/** The body text for this card. */
|
|
256
246
|
description: string;
|
|
257
247
|
|
|
258
|
-
/** When this card was created. */
|
|
259
|
-
created: Date | null;
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Purely for organization in your custom implementation, these categories can be set in
|
|
263
|
-
* the dashboard composer.
|
|
264
|
-
*/
|
|
265
|
-
categories: string[];
|
|
266
|
-
|
|
267
248
|
/** A url to open when this card is clicked. */
|
|
268
249
|
url?: string;
|
|
269
250
|
|
|
@@ -284,23 +265,26 @@ export class CaptionedImage extends Card {
|
|
|
284
265
|
|
|
285
266
|
/** Whether this card has ever been clicked on this device. */
|
|
286
267
|
clicked: boolean;
|
|
268
|
+
|
|
269
|
+
/** The language of the card in BCP 47 format. This field is set in the campaign on the Braze dashboard. */
|
|
270
|
+
language?: string;
|
|
271
|
+
|
|
272
|
+
/** The alternate text of the card's image to be announced when in accessibility mode. */
|
|
273
|
+
altImageText?: string;
|
|
287
274
|
}
|
|
288
275
|
|
|
289
276
|
export class ClassicCard extends Card {
|
|
290
277
|
/**
|
|
291
278
|
* A card with a title, body, and optionally a small image, which can be passed to
|
|
292
|
-
* `
|
|
293
|
-
* Subscribe to receive new cards via `
|
|
279
|
+
* `showContentCards` or handled manually.
|
|
280
|
+
* Subscribe to receive new cards via `subscribeToContentCardsUpdates`.
|
|
294
281
|
*
|
|
295
282
|
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
296
283
|
* @param viewed - Whether this card has been shown to the user.
|
|
297
284
|
* @param title - The title text for this card.
|
|
298
285
|
* @param imageUrl - The url for this card's image.
|
|
299
286
|
* @param description - The body text for this card.
|
|
300
|
-
* @param created - When this card was created.
|
|
301
287
|
* @param updated - When this card was last modified.
|
|
302
|
-
* @param categories - Purely for organization in your custom implementation, these categories can be set in
|
|
303
|
-
* the dashboard composer.
|
|
304
288
|
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
305
289
|
* @param url - A url to open when this card is clicked.
|
|
306
290
|
* @param linkText - The display text for the url.
|
|
@@ -310,6 +294,8 @@ export class ClassicCard extends Card {
|
|
|
310
294
|
* @param pinned - Whether to pin this card to the top of the view.
|
|
311
295
|
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
312
296
|
* @param clicked - Whether this card has ever been clicked on this device.
|
|
297
|
+
* @param language - The language of the card in BCP 47 format. This field is set in the campaign on the Braze dashboard.
|
|
298
|
+
* @param altImageText - The alternate text of the card's image to be announced when in accessibility mode.
|
|
313
299
|
*/
|
|
314
300
|
constructor(
|
|
315
301
|
id?: string,
|
|
@@ -317,9 +303,7 @@ export class ClassicCard extends Card {
|
|
|
317
303
|
title?: string,
|
|
318
304
|
imageUrl?: string,
|
|
319
305
|
description?: string,
|
|
320
|
-
created?: Date,
|
|
321
306
|
updated?: Date,
|
|
322
|
-
categories?: string[],
|
|
323
307
|
expiresAt?: Date,
|
|
324
308
|
url?: string,
|
|
325
309
|
linkText?: string,
|
|
@@ -328,6 +312,8 @@ export class ClassicCard extends Card {
|
|
|
328
312
|
pinned?: boolean,
|
|
329
313
|
dismissible?: boolean,
|
|
330
314
|
clicked?: boolean,
|
|
315
|
+
language?: string,
|
|
316
|
+
altImageText?: string,
|
|
331
317
|
);
|
|
332
318
|
|
|
333
319
|
/** The title text for this card. */
|
|
@@ -339,15 +325,6 @@ export class ClassicCard extends Card {
|
|
|
339
325
|
/** The body text for this card. */
|
|
340
326
|
description: string;
|
|
341
327
|
|
|
342
|
-
/** When this card was created. */
|
|
343
|
-
created: Date | null;
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Purely for organization in your custom implementation, these categories can be set in
|
|
347
|
-
* the dashboard composer.
|
|
348
|
-
*/
|
|
349
|
-
categories: string[];
|
|
350
|
-
|
|
351
328
|
/** A url to open when this card is clicked. */
|
|
352
329
|
url?: string;
|
|
353
330
|
|
|
@@ -368,14 +345,19 @@ export class ClassicCard extends Card {
|
|
|
368
345
|
|
|
369
346
|
/** Whether this card has ever been clicked on this device. */
|
|
370
347
|
clicked: boolean;
|
|
348
|
+
|
|
349
|
+
/** The language of the card in BCP 47 format. This field is set in the campaign on the Braze dashboard. */
|
|
350
|
+
language?: string;
|
|
351
|
+
|
|
352
|
+
/** The alternate text of the card's image to be announced when in accessibility mode. */
|
|
353
|
+
altImageText?: string;
|
|
371
354
|
}
|
|
372
355
|
|
|
373
356
|
export class ControlCard extends Card {
|
|
374
357
|
/**
|
|
375
358
|
* A card with no display that logs impressions, which can be passed to
|
|
376
|
-
* `
|
|
377
|
-
*
|
|
378
|
-
* Subscribe to receive new cards via `subscribeToFeedUpdates`.
|
|
359
|
+
* `showContentCards` or handled manually.
|
|
360
|
+
* Subscribe to receive new cards via `subscribeToContentCardsUpdates`.
|
|
379
361
|
*
|
|
380
362
|
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
381
363
|
* @param viewed - Whether this card has been shown to the user.
|
|
@@ -426,40 +408,6 @@ export class ContentCards {
|
|
|
426
408
|
getUnviewedCardCount(): number;
|
|
427
409
|
}
|
|
428
410
|
|
|
429
|
-
export class Feed {
|
|
430
|
-
/**
|
|
431
|
-
* A collection of `Card` descendents (`ClassicCard`, `CaptionedImage`, `ImageOnly`).
|
|
432
|
-
* Subscribe to receive feed updates via `subscribeToFeedUpdates`,
|
|
433
|
-
* or get the currently cached feed with `getCachedFeed`.
|
|
434
|
-
*
|
|
435
|
-
* @param cards - Array of `Card` descendents (`ClassicCard`, `CaptionedImage`,
|
|
436
|
-
* `ImageOnly`). Can be passed directly to `showFeed`.
|
|
437
|
-
* @param lastUpdated - When this collection of cards was received from Braze servers. If null, it means the
|
|
438
|
-
* feed has never been fetched for this user.
|
|
439
|
-
*/
|
|
440
|
-
constructor(cards: Card[], lastUpdated: Date | null);
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Array of `Card` descendents (`ClassicCard`, `CaptionedImage`, `ImageOnly`).
|
|
444
|
-
* Can be passed directly to `showFeed`.
|
|
445
|
-
*/
|
|
446
|
-
cards: Card[];
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* When this collection of cards was received from Braze servers. If null, it means the
|
|
450
|
-
* content cards are still being fetched for this user.
|
|
451
|
-
*/
|
|
452
|
-
lastUpdated: Date | null;
|
|
453
|
-
|
|
454
|
-
/**
|
|
455
|
-
* Get the current unread card count. This is useful for powering badges on your control for showing the news feed.
|
|
456
|
-
* Note that Braze will not refresh news feed cards on new page loads (and so this function will return 0) until you
|
|
457
|
-
* call `showFeed` or `requestFeedRefresh`. `ControlCard` cards do not count towards the
|
|
458
|
-
* unread count.
|
|
459
|
-
*/
|
|
460
|
-
getUnreadCardCount(): number;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
411
|
export class ControlMessage {
|
|
464
412
|
/**
|
|
465
413
|
* A non-showing message placeholder that represents this user receiving the the control for a multivariate
|
|
@@ -528,7 +476,6 @@ export class InAppMessage {
|
|
|
528
476
|
};
|
|
529
477
|
|
|
530
478
|
static ClickAction: {
|
|
531
|
-
NEWS_FEED: "NEWS_FEED";
|
|
532
479
|
URI: "URI";
|
|
533
480
|
NONE: "NONE";
|
|
534
481
|
};
|
|
@@ -611,6 +558,9 @@ export class InAppMessage {
|
|
|
611
558
|
*/
|
|
612
559
|
css?: string;
|
|
613
560
|
|
|
561
|
+
/** Object of string/string key/value pairs. */
|
|
562
|
+
messageExtras?: Record<string, string>;
|
|
563
|
+
|
|
614
564
|
/** Whether this message is a ControlMessage. */
|
|
615
565
|
isControl: false;
|
|
616
566
|
|
|
@@ -708,6 +658,9 @@ export class FullScreenMessage extends InAppMessage {
|
|
|
708
658
|
* @param htmlId - The ID to give the parent HTML element that this message is rendered into.
|
|
709
659
|
* @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
710
660
|
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
661
|
+
* @param messageExtras - Object of string/string key/value pairs.
|
|
662
|
+
* @param language - The language of the message in BCP 47 format. This field is set in the campaign on the Braze dashboard.
|
|
663
|
+
* @param altImageText - The alternate text of the message's image to be announced when in accessibility mode.
|
|
711
664
|
*/
|
|
712
665
|
constructor(
|
|
713
666
|
message?: string,
|
|
@@ -738,6 +691,9 @@ export class FullScreenMessage extends InAppMessage {
|
|
|
738
691
|
orientation?: Orientation,
|
|
739
692
|
htmlId?: string,
|
|
740
693
|
css?: string,
|
|
694
|
+
messageExtras?: Record<string, string>,
|
|
695
|
+
language?: string,
|
|
696
|
+
altImageText?: string,
|
|
741
697
|
);
|
|
742
698
|
|
|
743
699
|
/** How to align message text. See the `TextAlignment` enum. */
|
|
@@ -817,6 +773,15 @@ export class FullScreenMessage extends InAppMessage {
|
|
|
817
773
|
* `Orientation` enum.
|
|
818
774
|
*/
|
|
819
775
|
orientation: Orientation;
|
|
776
|
+
|
|
777
|
+
/** Object of string/string key/value pairs. */
|
|
778
|
+
messageExtras?: Record<string, string>;
|
|
779
|
+
|
|
780
|
+
/** The language of the message in BCP 47 format. This field is set in the campaign on the Braze dashboard. */
|
|
781
|
+
language?: string;
|
|
782
|
+
|
|
783
|
+
/** The alternate text of the message's image to be announced when in accessibility mode. */
|
|
784
|
+
altImageText?: string;
|
|
820
785
|
}
|
|
821
786
|
|
|
822
787
|
export class ModalMessage extends InAppMessage {
|
|
@@ -867,6 +832,8 @@ export class ModalMessage extends InAppMessage {
|
|
|
867
832
|
* @param htmlId - The ID to give the parent HTML element that this message is rendered into.
|
|
868
833
|
* @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
869
834
|
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
835
|
+
* @param language - The language of the message in BCP 47 format. This field is set in the campaign on the Braze dashboard.
|
|
836
|
+
* @param altImageText - The alternate text of the message's image to be announced when in accessibility mode.
|
|
870
837
|
*/
|
|
871
838
|
constructor(
|
|
872
839
|
message?: string,
|
|
@@ -896,6 +863,9 @@ export class ModalMessage extends InAppMessage {
|
|
|
896
863
|
cropType?: CropType,
|
|
897
864
|
htmlId?: string,
|
|
898
865
|
css?: string,
|
|
866
|
+
messageExtras?: Record<string, string>,
|
|
867
|
+
language?: string,
|
|
868
|
+
altImageText?: string,
|
|
899
869
|
);
|
|
900
870
|
|
|
901
871
|
/** How to align message text. See the `TextAlignment` enum. */
|
|
@@ -969,6 +939,15 @@ export class ModalMessage extends InAppMessage {
|
|
|
969
939
|
|
|
970
940
|
/** How to crop and fit images in the allowable space. See the `CropType` enum. */
|
|
971
941
|
cropType: CropType;
|
|
942
|
+
|
|
943
|
+
/** Object of string/string key/value pairs. */
|
|
944
|
+
messageExtras?: Record<string, string>;
|
|
945
|
+
|
|
946
|
+
/** The language of the message in BCP 47 format. This field is set in the campaign on the Braze dashboard. */
|
|
947
|
+
language?: string;
|
|
948
|
+
|
|
949
|
+
/** The alternate text of the message's image to be announced when in accessibility mode. */
|
|
950
|
+
altImageText?: string;
|
|
972
951
|
}
|
|
973
952
|
|
|
974
953
|
export class HtmlMessage extends InAppMessage {
|
|
@@ -991,6 +970,7 @@ export class HtmlMessage extends InAppMessage {
|
|
|
991
970
|
* @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
992
971
|
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
993
972
|
* @param messageFields - Structured data provided by the Braze backend.
|
|
973
|
+
* @param messageExtras - Object of string/string key/value pairs.
|
|
994
974
|
*/
|
|
995
975
|
constructor(
|
|
996
976
|
message: string,
|
|
@@ -1004,6 +984,7 @@ export class HtmlMessage extends InAppMessage {
|
|
|
1004
984
|
htmlId?: string,
|
|
1005
985
|
css?: string,
|
|
1006
986
|
messageFields?: Record<string, any>,
|
|
987
|
+
messageExtras?: Record<string, string>,
|
|
1007
988
|
);
|
|
1008
989
|
|
|
1009
990
|
/** Color of the background frame which blocks page interaction while the message is showing. */
|
|
@@ -1011,6 +992,9 @@ export class HtmlMessage extends InAppMessage {
|
|
|
1011
992
|
|
|
1012
993
|
/** Structured data provided by the Braze backend. */
|
|
1013
994
|
messageFields?: Record<string, any>;
|
|
995
|
+
|
|
996
|
+
/** Object of string/string key/value pairs. */
|
|
997
|
+
messageExtras?: Record<string, string>;
|
|
1014
998
|
}
|
|
1015
999
|
|
|
1016
1000
|
/**
|
|
@@ -1056,6 +1040,9 @@ export class SlideUpMessage extends InAppMessage {
|
|
|
1056
1040
|
* @param htmlId - The ID to give the parent HTML element that this message is rendered into.
|
|
1057
1041
|
* @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
1058
1042
|
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
1043
|
+
* @param messageExtras - Object of string/string key/value pairs.
|
|
1044
|
+
* @param language - The language of the message in BCP 47 format. This field is set in the campaign on the Braze dashboard.
|
|
1045
|
+
* @param altImageText - The alternate text of the message's image to be announced when in accessibility mode.
|
|
1059
1046
|
*/
|
|
1060
1047
|
constructor(
|
|
1061
1048
|
message: string,
|
|
@@ -1079,6 +1066,9 @@ export class SlideUpMessage extends InAppMessage {
|
|
|
1079
1066
|
animateOut?: boolean,
|
|
1080
1067
|
htmlId?: string,
|
|
1081
1068
|
css?: string,
|
|
1069
|
+
messageExtras?: Record<string, string>,
|
|
1070
|
+
language?: string,
|
|
1071
|
+
altImageText?: string,
|
|
1082
1072
|
);
|
|
1083
1073
|
|
|
1084
1074
|
/** How to align message text. See the `TextAlignment` enum. */
|
|
@@ -1131,6 +1121,15 @@ export class SlideUpMessage extends InAppMessage {
|
|
|
1131
1121
|
|
|
1132
1122
|
/** Color of close button. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
1133
1123
|
closeButtonColor: number;
|
|
1124
|
+
|
|
1125
|
+
/** Object of string/string key/value pairs. */
|
|
1126
|
+
messageExtras?: Record<string, string>;
|
|
1127
|
+
|
|
1128
|
+
/** The language of the message in BCP 47 format. This field is set in the campaign on the Braze dashboard. */
|
|
1129
|
+
language?: string;
|
|
1130
|
+
|
|
1131
|
+
/** The alternate text of the message's image to be announced when in accessibility mode. */
|
|
1132
|
+
altImageText?: string;
|
|
1134
1133
|
}
|
|
1135
1134
|
|
|
1136
1135
|
|
|
@@ -1543,64 +1542,66 @@ export class InAppMessageButton {
|
|
|
1543
1542
|
subscribeToClickedEvent(subscriber: () => void): string | null;
|
|
1544
1543
|
}
|
|
1545
1544
|
|
|
1546
|
-
export interface
|
|
1545
|
+
export interface StringProperty {
|
|
1547
1546
|
type: "string";
|
|
1548
1547
|
value: string;
|
|
1549
1548
|
}
|
|
1550
1549
|
|
|
1551
|
-
export interface
|
|
1550
|
+
export interface NumberProperty {
|
|
1552
1551
|
type: "number";
|
|
1553
1552
|
value: number;
|
|
1554
1553
|
}
|
|
1555
1554
|
|
|
1556
|
-
export interface
|
|
1555
|
+
export interface BooleanProperty {
|
|
1557
1556
|
type: "boolean";
|
|
1558
1557
|
value: boolean;
|
|
1559
1558
|
}
|
|
1560
1559
|
|
|
1561
|
-
export interface
|
|
1560
|
+
export interface ImageProperty {
|
|
1562
1561
|
type: "image";
|
|
1563
1562
|
value: string;
|
|
1564
1563
|
}
|
|
1565
1564
|
|
|
1566
|
-
export interface
|
|
1565
|
+
export interface TimestampProperty {
|
|
1567
1566
|
type: "datetime";
|
|
1568
1567
|
value: number;
|
|
1569
1568
|
}
|
|
1570
1569
|
|
|
1571
|
-
export type
|
|
1572
|
-
export interface
|
|
1570
|
+
export type JsonPropertyValue = Partial<Record<string, any>>;
|
|
1571
|
+
export interface JsonProperty {
|
|
1573
1572
|
type: "jsonobject";
|
|
1574
|
-
value:
|
|
1573
|
+
value: JsonPropertyValue;
|
|
1575
1574
|
}
|
|
1576
1575
|
|
|
1576
|
+
export type PropertiesJson = Partial<
|
|
1577
|
+
Record<
|
|
1578
|
+
string,
|
|
1579
|
+
| StringProperty
|
|
1580
|
+
| NumberProperty
|
|
1581
|
+
| BooleanProperty
|
|
1582
|
+
| ImageProperty
|
|
1583
|
+
| JsonProperty
|
|
1584
|
+
| TimestampProperty
|
|
1585
|
+
>
|
|
1586
|
+
>;
|
|
1587
|
+
|
|
1577
1588
|
export class FeatureFlag {
|
|
1578
1589
|
/** Indicates whether or not this feature flag is enabled. */
|
|
1579
1590
|
enabled: boolean;
|
|
1580
1591
|
|
|
1592
|
+
/** The ID for this feature flag. */
|
|
1593
|
+
id: string;
|
|
1594
|
+
|
|
1581
1595
|
/**
|
|
1582
|
-
* Properties of this
|
|
1596
|
+
* Properties of this object.
|
|
1583
1597
|
*
|
|
1584
1598
|
* Avoid accessing these properties directly. Instead, prefer using the `getStringProperty`, `getBooleanProperty`, `getNumberProperty`,
|
|
1585
1599
|
* `getImageProperty` and `getJsonProperty` methods which ensure type safety and to avoid breaking changes in the future.
|
|
1586
1600
|
*/
|
|
1587
|
-
properties:
|
|
1588
|
-
Record<
|
|
1589
|
-
string,
|
|
1590
|
-
| FeatureFlagStringProperty
|
|
1591
|
-
| FeatureFlagNumberProperty
|
|
1592
|
-
| FeatureFlagBooleanProperty
|
|
1593
|
-
| FeatureFlagImageProperty
|
|
1594
|
-
| FeatureFlagJsonProperty
|
|
1595
|
-
| FeatureFlagTimestampProperty
|
|
1596
|
-
>
|
|
1597
|
-
>;
|
|
1598
|
-
|
|
1599
|
-
/** The ID for this feature flag. */
|
|
1600
|
-
id: string;
|
|
1601
|
+
properties: PropertiesJson;
|
|
1601
1602
|
|
|
1602
1603
|
/**
|
|
1603
|
-
* Get value of a
|
|
1604
|
+
* Get value of a property of type string.
|
|
1604
1605
|
*
|
|
1605
1606
|
* @param key - The key of the property.
|
|
1606
1607
|
*
|
|
@@ -1610,7 +1611,7 @@ export class FeatureFlag {
|
|
|
1610
1611
|
getStringProperty(key: string): string | null;
|
|
1611
1612
|
|
|
1612
1613
|
/**
|
|
1613
|
-
* Get value of a
|
|
1614
|
+
* Get value of a property of type number.
|
|
1614
1615
|
*
|
|
1615
1616
|
* @param key - The key of the property.
|
|
1616
1617
|
*
|
|
@@ -1620,7 +1621,7 @@ export class FeatureFlag {
|
|
|
1620
1621
|
getNumberProperty(key: string): number | null;
|
|
1621
1622
|
|
|
1622
1623
|
/**
|
|
1623
|
-
* Get value of a
|
|
1624
|
+
* Get value of a property of type boolean.
|
|
1624
1625
|
*
|
|
1625
1626
|
* @param key - The key of the property.
|
|
1626
1627
|
*
|
|
@@ -1630,7 +1631,7 @@ export class FeatureFlag {
|
|
|
1630
1631
|
getBooleanProperty(key: string): boolean | null;
|
|
1631
1632
|
|
|
1632
1633
|
/**
|
|
1633
|
-
* Get value of a
|
|
1634
|
+
* Get value of a property of type image.
|
|
1634
1635
|
*
|
|
1635
1636
|
* @param key - The key of the property.
|
|
1636
1637
|
*
|
|
@@ -1640,17 +1641,17 @@ export class FeatureFlag {
|
|
|
1640
1641
|
getImageProperty(key: string): string | null;
|
|
1641
1642
|
|
|
1642
1643
|
/**
|
|
1643
|
-
* Get value of a
|
|
1644
|
+
* Get value of a property of type JSON.
|
|
1644
1645
|
*
|
|
1645
1646
|
* @param key - The key of the property.
|
|
1646
1647
|
*
|
|
1647
1648
|
* @returns The value of the property if the key is found and is of type JSON.
|
|
1648
1649
|
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1649
1650
|
*/
|
|
1650
|
-
getJsonProperty(key: string):
|
|
1651
|
+
getJsonProperty(key: string): JsonPropertyValue | null;
|
|
1651
1652
|
|
|
1652
1653
|
/**
|
|
1653
|
-
* Get value of a
|
|
1654
|
+
* Get value of a property of type datetime as a Unix timestamp (milliseconds).
|
|
1654
1655
|
*
|
|
1655
1656
|
* @param key - The key of the property.
|
|
1656
1657
|
*
|
|
@@ -1667,11 +1668,78 @@ export class Banner {
|
|
|
1667
1668
|
/** The placement ID this banner is matched to. */
|
|
1668
1669
|
placementId: string;
|
|
1669
1670
|
|
|
1670
|
-
|
|
1671
|
-
html: string;
|
|
1671
|
+
// intentionally omitting `html` since it's not meant to be accessed by integrators directly.
|
|
1672
1672
|
|
|
1673
1673
|
/** Whether this banner is a control banner. */
|
|
1674
1674
|
isControl: boolean;
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* Properties of this object.
|
|
1678
|
+
*
|
|
1679
|
+
* Avoid accessing these properties directly. Instead, prefer using the `getStringProperty`, `getBooleanProperty`, `getNumberProperty`,
|
|
1680
|
+
* `getImageProperty` and `getJsonProperty` methods which ensure type safety and to avoid breaking changes in the future.
|
|
1681
|
+
*/
|
|
1682
|
+
properties: PropertiesJson;
|
|
1683
|
+
|
|
1684
|
+
/**
|
|
1685
|
+
* Get value of a property of type string.
|
|
1686
|
+
*
|
|
1687
|
+
* @param key - The key of the property.
|
|
1688
|
+
*
|
|
1689
|
+
* @returns The value of the property if the key is found and is of type string.
|
|
1690
|
+
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1691
|
+
*/
|
|
1692
|
+
getStringProperty(key: string): string | null;
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* Get value of a property of type number.
|
|
1696
|
+
*
|
|
1697
|
+
* @param key - The key of the property.
|
|
1698
|
+
*
|
|
1699
|
+
* @returns The value of the property if the key is found and is of type number.
|
|
1700
|
+
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1701
|
+
*/
|
|
1702
|
+
getNumberProperty(key: string): number | null;
|
|
1703
|
+
|
|
1704
|
+
/**
|
|
1705
|
+
* Get value of a property of type boolean.
|
|
1706
|
+
*
|
|
1707
|
+
* @param key - The key of the property.
|
|
1708
|
+
*
|
|
1709
|
+
* @returns The value of the property if the key is found and is of type boolean.
|
|
1710
|
+
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1711
|
+
*/
|
|
1712
|
+
getBooleanProperty(key: string): boolean | null;
|
|
1713
|
+
|
|
1714
|
+
/**
|
|
1715
|
+
* Get value of a property of type image.
|
|
1716
|
+
*
|
|
1717
|
+
* @param key - The key of the property.
|
|
1718
|
+
*
|
|
1719
|
+
* @returns The string value of the image url if the key is found and is of type image.
|
|
1720
|
+
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1721
|
+
*/
|
|
1722
|
+
getImageProperty(key: string): string | null;
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* Get value of a property of type JSON.
|
|
1726
|
+
*
|
|
1727
|
+
* @param key - The key of the property.
|
|
1728
|
+
*
|
|
1729
|
+
* @returns The value of the property if the key is found and is of type JSON.
|
|
1730
|
+
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1731
|
+
*/
|
|
1732
|
+
getJsonProperty(key: string): JsonPropertyValue | null;
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* Get value of a property of type datetime as a Unix timestamp (milliseconds).
|
|
1736
|
+
*
|
|
1737
|
+
* @param key - The key of the property.
|
|
1738
|
+
*
|
|
1739
|
+
* @returns The Unix timestamp (milliseconds) value of the property if the key is found and is of type datetime.
|
|
1740
|
+
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1741
|
+
*/
|
|
1742
|
+
getTimestampProperty(key: string): number | null;
|
|
1675
1743
|
}
|
|
1676
1744
|
|
|
1677
1745
|
/**
|
|
@@ -1679,16 +1747,9 @@ export class Banner {
|
|
|
1679
1747
|
* calling `openSession`.
|
|
1680
1748
|
*
|
|
1681
1749
|
* @returns The identifier of the subscription created. This can be passed to
|
|
1682
|
-
* `removeSubscription` to cancel the subscription.
|
|
1683
|
-
*/
|
|
1684
|
-
export function automaticallyShowInAppMessages(): string;
|
|
1685
|
-
|
|
1686
|
-
/**
|
|
1687
|
-
* Destroy any Braze news feed currently showing. This method will appropriately clean up any retained resources
|
|
1688
|
-
* and also display the hiding animation, and so should be used instead of manually removing feed html from the
|
|
1689
|
-
* DOM.
|
|
1750
|
+
* `removeSubscription` to cancel the subscription. Returns undefined if the SDK has not been initialized.
|
|
1690
1751
|
*/
|
|
1691
|
-
export function
|
|
1752
|
+
export function automaticallyShowInAppMessages(): string | undefined;
|
|
1692
1753
|
|
|
1693
1754
|
/**
|
|
1694
1755
|
* Hide any Braze content cards currently showing in the parent node, or if none is provided, any content cards in the page.
|
|
@@ -1716,28 +1777,6 @@ export function showContentCards(
|
|
|
1716
1777
|
filterFunction?: (cards: Card[]) => Card[],
|
|
1717
1778
|
): void;
|
|
1718
1779
|
|
|
1719
|
-
/**
|
|
1720
|
-
* Display the user's news feed.
|
|
1721
|
-
*
|
|
1722
|
-
* @param parentNode - The HTML node to render the news feed into. If null/undefined, the feed will be
|
|
1723
|
-
* rendered in fixed position over the right-hand side of the page and appended to the `<body>` node. If the
|
|
1724
|
-
* parent node already has an Braze news feed as a direct descendant, the existing feed will be replaced.
|
|
1725
|
-
* @param cards - A static set of cards to Each item in this Array should be a `Card`
|
|
1726
|
-
* descendant. If this parameter is null/undefined, all unexpired cards from the last news feed refresh will be
|
|
1727
|
-
* used automatically, a feed refresh will be kicked off automatically if the cached cards are more than 1 minute
|
|
1728
|
-
* old, and the feed will automatically update when new cards are received while it is still showing. If you
|
|
1729
|
-
* provide an explicit set of cards by using this parameter, no action will be taken when new cards are received,
|
|
1730
|
-
* and you must subscribe to feed updates yourself with `subscribeToFeedUpdates` and request updates with
|
|
1731
|
-
* `requestFeedRefresh` if you want to update this feed with new cards.
|
|
1732
|
-
* @param allowedCategories - A set of categories to filter cards to. Each item in this Array should be a
|
|
1733
|
-
* card category as set in the Braze dashboard. If omitted, all cards will be displayed.
|
|
1734
|
-
*/
|
|
1735
|
-
export function showFeed(
|
|
1736
|
-
parentNode?: Element | null,
|
|
1737
|
-
cards?: Card[] | null,
|
|
1738
|
-
allowedCategories?: string[],
|
|
1739
|
-
): void;
|
|
1740
|
-
|
|
1741
1780
|
/**
|
|
1742
1781
|
* Display a given in-app message.
|
|
1743
1782
|
*
|
|
@@ -1747,13 +1786,13 @@ export function showFeed(
|
|
|
1747
1786
|
* @param onDisplayCallback - Optional callback to invoke once the message is on the screen.
|
|
1748
1787
|
*
|
|
1749
1788
|
* @returns Whether or not the message was displayed (or, in the case of control messages, logged to
|
|
1750
|
-
* Braze servers).
|
|
1789
|
+
* Braze servers). Returns undefined if the SDK has not been initialized.
|
|
1751
1790
|
*/
|
|
1752
1791
|
export function showInAppMessage(
|
|
1753
1792
|
inAppMessage: InAppMessage | ControlMessage,
|
|
1754
1793
|
parentNode?: Element | null,
|
|
1755
1794
|
onDisplayCallback?: () => void,
|
|
1756
|
-
): boolean;
|
|
1795
|
+
): boolean | undefined;
|
|
1757
1796
|
|
|
1758
1797
|
/**
|
|
1759
1798
|
* Defers the display of given in-app message for a future pageload.
|
|
@@ -1802,28 +1841,6 @@ export function toggleContentCards(
|
|
|
1802
1841
|
filterFunction?: (cards: Card[]) => Card[],
|
|
1803
1842
|
): void;
|
|
1804
1843
|
|
|
1805
|
-
/**
|
|
1806
|
-
* Toggle the Braze news feed, creating it if it does not exist, and destroying it if it does.
|
|
1807
|
-
*
|
|
1808
|
-
* @param parentNode - The HTML node to render the news feed into. If null/undefined, the feed will be
|
|
1809
|
-
* rendered in fixed position over the right-hand side of the page and appended to the `<body>` node. If the
|
|
1810
|
-
* parent node already has an Braze news feed as a direct descendant, the existing feed will be replaced.
|
|
1811
|
-
* @param cards - A static set of cards to Each item in this Array should be a `Card`
|
|
1812
|
-
* descendant. If this parameter is null/undefined, all unexpired cards from the last news feed refresh will be
|
|
1813
|
-
* used automatically, a feed refresh will be kicked off automatically if the cached cards are more than 1 minute
|
|
1814
|
-
* old, and the feed will automatically update when new cards are received while it is still showing. If you
|
|
1815
|
-
* provide an explicit set of cards by using this parameter, no action will be taken when new cards are received,
|
|
1816
|
-
* and you must subscribe to feed updates yourself with `subscribeToFeedUpdates` and request updates with
|
|
1817
|
-
* `requestFeedRefresh` if you want to update this feed with new cards.
|
|
1818
|
-
* @param allowedCategories - A set of categories to filter cards to. Each item in this Array should be a
|
|
1819
|
-
* card category as set in the Braze dashboard. If omitted, all cards will be displayed.
|
|
1820
|
-
*/
|
|
1821
|
-
export function toggleFeed(
|
|
1822
|
-
parentNode?: Element | null,
|
|
1823
|
-
cards?: Card[] | null,
|
|
1824
|
-
allowedCategories?: string[],
|
|
1825
|
-
): void;
|
|
1826
|
-
|
|
1827
1844
|
/**
|
|
1828
1845
|
* When a user first uses Braze on a device they are considered "anonymous". Use this method to identify a user
|
|
1829
1846
|
* with a unique ID, which enables the following:
|
|
@@ -1873,17 +1890,10 @@ export function destroy(): void;
|
|
|
1873
1890
|
* Get all currently available cards from the last content cards refresh.
|
|
1874
1891
|
*
|
|
1875
1892
|
* @returns - A `ContentCards` object which includes all currently available
|
|
1876
|
-
* `Card` objects from the last content cards refresh.
|
|
1877
|
-
|
|
1878
|
-
export function getCachedContentCards(): ContentCards;
|
|
1879
|
-
|
|
1880
|
-
/**
|
|
1881
|
-
* Get all unexpired cards from the last news feed refresh.
|
|
1882
|
-
*
|
|
1883
|
-
* @returns - A `Feed` object which includes all unexpired `Card` objects from the last
|
|
1884
|
-
* news feed refresh.
|
|
1893
|
+
* `Card` objects from the last content cards refresh. Returns undefined if the
|
|
1894
|
+
* SDK has not been initialized.
|
|
1885
1895
|
*/
|
|
1886
|
-
export function
|
|
1896
|
+
export function getCachedContentCards(): ContentCards | undefined;
|
|
1887
1897
|
|
|
1888
1898
|
/**
|
|
1889
1899
|
* Retrieves the 'device id,' a randomly generated ID that is stored on the browser.
|
|
@@ -1961,18 +1971,6 @@ export function isPushPermissionGranted(): boolean | undefined;
|
|
|
1961
1971
|
*/
|
|
1962
1972
|
export function isPushSupported(): boolean | undefined;
|
|
1963
1973
|
|
|
1964
|
-
/**
|
|
1965
|
-
* Logs that the user clicked the given card. This is done automatically when you use Braze's display module
|
|
1966
|
-
* and should only be called if you're bypassing that and manually building the DOM for displaying the cards in
|
|
1967
|
-
* your own code.
|
|
1968
|
-
*
|
|
1969
|
-
* @param card - the `Card` object that received a click
|
|
1970
|
-
* @param forContentCards - whether to log this as a content cards event (as opposed to the legacy news feed)
|
|
1971
|
-
*
|
|
1972
|
-
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
1973
|
-
*/
|
|
1974
|
-
export function logCardClick(card: Card, forContentCards?: boolean): boolean;
|
|
1975
|
-
|
|
1976
1974
|
/**
|
|
1977
1975
|
* Logs that the user dismissed the given card. This is done automatically when you use Braze's display module
|
|
1978
1976
|
* and should only be called if you're bypassing that and manually building the DOM for displaying the cards in
|
|
@@ -1985,23 +1983,7 @@ export function logCardClick(card: Card, forContentCards?: boolean): boolean;
|
|
|
1985
1983
|
export function logCardDismissal(card: Card): boolean;
|
|
1986
1984
|
|
|
1987
1985
|
/**
|
|
1988
|
-
* Logs that the user saw the given
|
|
1989
|
-
* and should only be called if you're bypassing that and manually building the DOM for displaying the cards in
|
|
1990
|
-
* your own code.
|
|
1991
|
-
*
|
|
1992
|
-
* @param cards - array of `Card` objects that received impressions
|
|
1993
|
-
* @param forContentCards - whether to log this as a content cards event (as opposed to the legacy news feed)
|
|
1994
|
-
*
|
|
1995
|
-
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
1996
|
-
*/
|
|
1997
|
-
export function logCardImpressions(
|
|
1998
|
-
cards: Card[],
|
|
1999
|
-
forContentCards?: boolean,
|
|
2000
|
-
): boolean;
|
|
2001
|
-
|
|
2002
|
-
/**
|
|
2003
|
-
* A convenient method to log that the user saw the given Content Cards. This method is equivalent to
|
|
2004
|
-
* calling [`logCardImpressions` method with `forContentCards` param set to true.
|
|
1986
|
+
* Logs that the user saw the given Content Cards.
|
|
2005
1987
|
* This is done automatically when you use Braze's display module and should only be called
|
|
2006
1988
|
* if you're bypassing that and manually building the DOM for displaying content cards in
|
|
2007
1989
|
* your own code.
|
|
@@ -2013,8 +1995,7 @@ export function logCardImpressions(
|
|
|
2013
1995
|
export function logContentCardImpressions(contentCards: Card[]): boolean;
|
|
2014
1996
|
|
|
2015
1997
|
/**
|
|
2016
|
-
*
|
|
2017
|
-
* calling [`logCardClick` method with `forContentCards` param set to true.
|
|
1998
|
+
* Logs when user clicks on a Content Card.
|
|
2018
1999
|
* This is done automatically when you use Braze's display module and should only be called
|
|
2019
2000
|
* if you're bypassing that and manually building the DOM for displaying content cards in
|
|
2020
2001
|
* your own code.
|
|
@@ -2042,13 +2023,6 @@ export function logCustomEvent(
|
|
|
2042
2023
|
eventProperties?: object,
|
|
2043
2024
|
): boolean;
|
|
2044
2025
|
|
|
2045
|
-
/**
|
|
2046
|
-
* Logs that the news feed was displayed. This is done automatically when you use Braze's
|
|
2047
|
-
* UI and should only be called if you're bypassing that and manually building
|
|
2048
|
-
* the class for displaying the cards in your own code.
|
|
2049
|
-
*/
|
|
2050
|
-
export function logFeedDisplayed(): void;
|
|
2051
|
-
|
|
2052
2026
|
/**
|
|
2053
2027
|
* Logs that the user clicked the given in-app message button. This is done automatically when the user clicks on
|
|
2054
2028
|
* a button in a message generated by `showInAppMessage`,
|
|
@@ -2164,7 +2138,7 @@ export function openSession(): void;
|
|
|
2164
2138
|
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
2165
2139
|
*
|
|
2166
2140
|
* ```
|
|
2167
|
-
* self.importScripts('https://js.appboycdn.com/web-sdk
|
|
2141
|
+
* self.importScripts('https://js.appboycdn.com/web-sdk/6.1/service-worker.js');
|
|
2168
2142
|
* ```
|
|
2169
2143
|
*
|
|
2170
2144
|
* For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
|
|
@@ -2212,15 +2186,6 @@ export function requestContentCardsRefresh(
|
|
|
2212
2186
|
errorCallback?: () => void,
|
|
2213
2187
|
): void;
|
|
2214
2188
|
|
|
2215
|
-
/**
|
|
2216
|
-
* Requests an immediate refresh of the news feed from Braze servers. By default, the news feed is refreshed on
|
|
2217
|
-
* `showFeed` (when stale - see
|
|
2218
|
-
* `showFeed` for details). If you want to refresh the feed from the
|
|
2219
|
-
* server at another time you must call this function. Results of this refresh are reported asynchronously to
|
|
2220
|
-
* subscriptions created via 'subscribeToFeedUpdates` .
|
|
2221
|
-
*/
|
|
2222
|
-
export function requestFeedRefresh(): void;
|
|
2223
|
-
|
|
2224
2189
|
/**
|
|
2225
2190
|
* Requests an immediate refresh of feature flags from Braze servers. By default, feature flags are refreshed when
|
|
2226
2191
|
* a new session starts. If you want to refresh feature flags from the server at another time you must call this function.
|
|
@@ -2282,9 +2247,10 @@ export function setSdkAuthenticationSignature(signature: string): boolean;
|
|
|
2282
2247
|
*
|
|
2283
2248
|
* @param sdkMetadata - An array of metadata values from `BrazeSdkMetadata`.
|
|
2284
2249
|
*
|
|
2285
|
-
* @returns Whether or not the array of metadata is valid.
|
|
2250
|
+
* @returns Whether or not the array of metadata is valid. Returns undefined if
|
|
2251
|
+
* the SDK has not been initialized.
|
|
2286
2252
|
*/
|
|
2287
|
-
export function addSdkMetadata(sdkMetadata: string[]): boolean;
|
|
2253
|
+
export function addSdkMetadata(sdkMetadata: string[]): boolean | undefined;
|
|
2288
2254
|
|
|
2289
2255
|
/**
|
|
2290
2256
|
* Sets a cookie that causes all subsequent calls to the Braze Web SDK to be ignored
|
|
@@ -2309,19 +2275,6 @@ export function subscribeToContentCardsUpdates(
|
|
|
2309
2275
|
subscriber: (cards: ContentCards) => void,
|
|
2310
2276
|
): string | undefined;
|
|
2311
2277
|
|
|
2312
|
-
/**
|
|
2313
|
-
* Subscribe to news feed updates. The subscriber callback will be called whenever the news feed is updated.
|
|
2314
|
-
*
|
|
2315
|
-
* @param subscriber - The callback function to handle new cards. This function will be
|
|
2316
|
-
* called with a `Feed`object which includes all `Card` objects currently in the feed.
|
|
2317
|
-
*
|
|
2318
|
-
* @returns The identifier of the subscription created. This can be passed to `removeSubscription` to cancel
|
|
2319
|
-
* the subscription. Returns undefined if the SDK has not been initialized.
|
|
2320
|
-
*/
|
|
2321
|
-
export function subscribeToFeedUpdates(
|
|
2322
|
-
subscriber: (feed: Feed) => void,
|
|
2323
|
-
): string | undefined;
|
|
2324
|
-
|
|
2325
2278
|
/**
|
|
2326
2279
|
* Subscribe to receive in-app messages. The subscriber callback will be called whenever a new in-app message is
|
|
2327
2280
|
* triggered. This method should be called before calling `openSession`. If you are using the build of Braze's
|
|
@@ -2429,9 +2382,9 @@ export function subscribeToFeatureFlagsUpdates(
|
|
|
2429
2382
|
/**
|
|
2430
2383
|
* Gets all available feature flags.
|
|
2431
2384
|
*
|
|
2432
|
-
* @returns - A list of `FeatureFlag` objects.
|
|
2385
|
+
* @returns - A list of `FeatureFlag` objects. Returns undefined if the SDK has not been initialized.
|
|
2433
2386
|
*/
|
|
2434
|
-
export function getAllFeatureFlags(): FeatureFlag[];
|
|
2387
|
+
export function getAllFeatureFlags(): FeatureFlag[] | undefined;
|
|
2435
2388
|
|
|
2436
2389
|
/**
|
|
2437
2390
|
* Logs impression for a given feature flag. This is limited to one impression per session per feature flag ID.
|
|
@@ -2482,33 +2435,6 @@ export function insertBanner(
|
|
|
2482
2435
|
parentNode: HTMLElement,
|
|
2483
2436
|
): void;
|
|
2484
2437
|
|
|
2485
|
-
/**
|
|
2486
|
-
* Logs that the user clicked the given banner. This should generally be called through the Braze JavaScript bridge
|
|
2487
|
-
* inside the Banner's HTML as defined in the Braze dashboard.
|
|
2488
|
-
*
|
|
2489
|
-
* @param banner - The `Banner` object which received the click.
|
|
2490
|
-
* @param buttonId - An optional button ID to associate with this click for analytics.
|
|
2491
|
-
*
|
|
2492
|
-
* @returns - Whether the click was logged successfully, or undefined if the SDK is not intialized.
|
|
2493
|
-
*/
|
|
2494
|
-
export function logBannerClick(
|
|
2495
|
-
banner: Banner,
|
|
2496
|
-
buttonId?: string,
|
|
2497
|
-
): boolean | undefined;
|
|
2498
|
-
|
|
2499
|
-
/**
|
|
2500
|
-
* Logs that the user saw the given banners. This is done automatically when you use Braze's display module
|
|
2501
|
-
* and should only be called if you're bypassing that and manually building the DOM for displaying the banners in
|
|
2502
|
-
* your own code.
|
|
2503
|
-
*
|
|
2504
|
-
* @param placementIds - The placement IDs of the banners that received impressions.
|
|
2505
|
-
*
|
|
2506
|
-
* @returns - Whether the impressions were logged successfully, or undefiend if the SDK is not initialized.
|
|
2507
|
-
*/
|
|
2508
|
-
export function logBannerImpressions(
|
|
2509
|
-
placementIds: Array<string>,
|
|
2510
|
-
): boolean | undefined;
|
|
2511
|
-
|
|
2512
2438
|
/**
|
|
2513
2439
|
* Gets all available banners.
|
|
2514
2440
|
*
|
|
@@ -2635,7 +2561,7 @@ export type InitializationOptions = {
|
|
|
2635
2561
|
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2636
2562
|
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2637
2563
|
* `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
|
|
2638
|
-
* `self.importScripts('https://js.appboycdn.com/web-sdk
|
|
2564
|
+
* `self.importScripts('https://js.appboycdn.com/web-sdk/6.1/service-worker.js');` or by including the content
|
|
2639
2565
|
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2640
2566
|
*/
|
|
2641
2567
|
manageServiceWorkerExternally?: boolean;
|