@braze/web-sdk 4.8.3 → 4.10.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 +2247 -2071
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +7 -7
- package/shared-lib/encoding-utils.js +4 -4
- package/shared-lib/event-types.js +23 -22
- package/shared-lib/guid.js +7 -7
- package/shared-lib/indexed-db-adapter.js +172 -135
- package/shared-lib/logger.js +26 -26
- package/shared-lib/supported-options.js +14 -13
- package/shared-lib/types.js +1 -0
- package/src/Card/card-manager-factory.js +1 -1
- package/src/Card/card-manager.js +2 -2
- package/src/Card/display/card-display.js +5 -4
- package/src/Card/models/banner.js +10 -10
- package/src/Card/models/captioned-image.js +7 -7
- package/src/Card/models/card.js +37 -36
- package/src/Card/models/classic-card.js +7 -7
- package/src/Card/models/control-card.js +3 -3
- package/src/Card/models/image-only.js +32 -0
- package/src/Card/models/index.js +1 -0
- package/src/Card/util/card-factory.js +16 -16
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards-provider.js +102 -102
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +4 -4
- package/src/ContentCards/ui/show-content-cards.js +15 -12
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/braze-sdk-metadata.js +1 -1
- package/src/Core/change-user.js +1 -1
- package/src/Core/device-properties.js +1 -1
- package/src/Core/disable-sdk.js +10 -7
- package/src/Core/enable-sdk.js +5 -2
- package/src/Core/get-device-id.js +9 -7
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +14 -14
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +4 -4
- package/src/Core/log-purchase.js +9 -9
- package/src/Core/open-session.js +10 -10
- package/src/FeatureFlags/feature-flag-factory.js +5 -3
- package/src/FeatureFlags/feature-flag.js +17 -14
- package/src/FeatureFlags/feature-flags-provider-factory.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +56 -43
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/index.js +1 -0
- package/src/FeatureFlags/log-feature-flag-impression.js +23 -0
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/Feed/feed-provider-factory.js +1 -1
- package/src/Feed/feed-provider.js +20 -20
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +13 -10
- package/src/InAppMessage/defer-in-app-message.js +13 -0
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +47 -47
- package/src/InAppMessage/display/in-app-message-to-html.js +92 -91
- package/src/InAppMessage/display/modal-utils.js +16 -16
- package/src/InAppMessage/get-deferred-in-app-message.js +5 -0
- package/src/InAppMessage/in-app-message-factory.js +77 -57
- package/src/InAppMessage/in-app-message-manager-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +121 -82
- package/src/InAppMessage/index.js +2 -0
- package/src/InAppMessage/log-in-app-message-button-click.js +17 -9
- package/src/InAppMessage/log-in-app-message-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-html-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +65 -29
- package/src/InAppMessage/models/html-message.js +32 -13
- package/src/InAppMessage/models/in-app-message-button.js +7 -7
- package/src/InAppMessage/models/in-app-message.js +203 -134
- package/src/InAppMessage/models/modal-message.js +64 -29
- package/src/InAppMessage/models/slide-up-message.js +52 -24
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +6 -6
- package/src/InAppMessage/ui/show-in-app-message.js +49 -47
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -1
- 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 +19 -19
- package/src/Push/push-manager.js +131 -131
- package/src/Push/request-push-permission.js +2 -2
- package/src/Push/unregister-push.js +2 -2
- package/src/Push/utils/push-utils.js +12 -10
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +63 -62
- package/src/common/base-feed.js +1 -1
- package/src/common/constants.js +1 -0
- package/src/common/event-logger.js +6 -6
- package/src/common/feed-display.js +34 -34
- package/src/common/translations.js +33 -33
- package/src/l10n/l10n-manager-factory.js +8 -8
- package/src/l10n/l10n-manager.js +6 -2
- package/src/l10n/types.js +1 -0
- package/src/managers/auth-manager.js +29 -29
- package/src/managers/braze-instance.js +132 -130
- package/src/managers/device-manager.js +22 -22
- package/src/managers/network-manager.js +103 -98
- package/src/managers/server-config-manager.js +23 -23
- package/src/managers/session-manager.js +5 -5
- package/src/managers/storage-manager-factory.js +9 -9
- package/src/managers/storage-manager.js +134 -131
- package/src/managers/subscription-manager.js +7 -7
- package/src/models/backend-errors.js +6 -6
- package/src/models/braze-event.js +11 -11
- package/src/models/braze-sdk-metadata.js +1 -1
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +1 -1
- package/src/models/push-token.js +5 -5
- package/src/models/server-config.js +7 -7
- package/src/request-controller.js +197 -180
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +7 -7
- package/src/triggers/models/filter-set.js +5 -5
- package/src/triggers/models/filter.js +65 -61
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +4 -4
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +6 -6
- package/src/triggers/models/trigger-condition.js +52 -56
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +50 -38
- package/src/triggers/triggers-provider-factory.js +10 -6
- package/src/triggers/triggers-provider.js +204 -186
- package/src/triggers/types.js +1 -0
- package/src/ui/js/attach-css.js +5 -4
- package/src/ui/js/feed-css.js +5 -5
- package/src/ui/js/iam-css.js +5 -5
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +35 -30
- package/src/util/browser-detector.js +30 -31
- package/src/util/client-hints-parser.js +28 -22
- package/src/util/code-utils.js +22 -21
- package/src/util/color-utils.js +19 -13
- package/src/util/component-utils.js +4 -4
- package/src/util/date-utils.js +6 -5
- package/src/util/device-constants.js +10 -10
- package/src/util/dom-utils.js +28 -24
- package/src/util/error-utils.js +1 -1
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +53 -57
- package/src/util/request-header-utils.js +34 -11
- package/src/util/string-utils.js +14 -14
- package/src/util/types.js +1 -0
- package/src/util/url-utils.js +1 -4
- package/src/util/user-agent-parser.js +39 -39
- package/src/util/validation-utils.js +34 -34
- package/src/util/window-utils.js +11 -12
package/index.d.ts
CHANGED
|
@@ -1,2425 +1,2601 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Type definitions for @braze/web-sdk v4.
|
|
2
|
+
* Type definitions for @braze/web-sdk v4.10.0
|
|
3
3
|
* Project: https://github.com/braze-inc/braze-web-sdk
|
|
4
4
|
* (c) Braze, Inc. 2023 - http://braze.com
|
|
5
5
|
* License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
8
|
+
/* eslint-disable no-unused-vars, no-use-before-define */
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Enum to represent the accepted SDK Metadata tags. See `addSdkMetadata` for more info.
|
|
12
|
+
*
|
|
13
|
+
* @readonly
|
|
14
|
+
* @enum {string}
|
|
15
|
+
*/
|
|
16
|
+
export class BrazeSdkMetadata {
|
|
17
|
+
/** Automatically added when loading Braze via Google Tag Manager */
|
|
18
|
+
static readonly GOOGLE_TAG_MANAGER: string;
|
|
19
|
+
/** Automatically added when loading Braze via mParticle */
|
|
20
|
+
static readonly MPARTICLE: string;
|
|
21
|
+
/** Automatically added when loading Braze via Segment */
|
|
22
|
+
static readonly SEGMENT: string;
|
|
23
|
+
/** Automatically added when loading Braze via Tealium */
|
|
24
|
+
static readonly TEALIUM: string;
|
|
25
|
+
/** Automatically added when loading Braze via npm */
|
|
26
|
+
static readonly NPM: string;
|
|
27
|
+
/** Automatically added when loading Braze via Braze's CDN (js.appboycdn.com) */
|
|
28
|
+
static readonly CDN: string;
|
|
29
|
+
/** Automatically added when loading Braze via Shopify Integration */
|
|
30
|
+
static readonly SHOPIFY: string;
|
|
31
|
+
/** Use this tag if you have integrated or loaded the Braze Web SDK using none of the other methods */
|
|
32
|
+
static readonly MANUAL: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
35
36
|
* Enum to represent the allowlistable set of device properties. By default, all properties are collected.
|
|
36
37
|
* See the `devicePropertyAllowlist` option of `initialize` for more info.
|
|
37
38
|
|
|
38
39
|
* @readonly
|
|
39
40
|
* @enum {string}
|
|
40
41
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/** Remove all event subscriptions from this message. */
|
|
73
|
-
removeAllSubscriptions(): void;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Remove an event subscription that you previously subscribed to.
|
|
77
|
-
*
|
|
78
|
-
* @param subscriptionGuid - The identifier of the subscription you wish to remove, returned by the method
|
|
79
|
-
* you initially used to create it.
|
|
80
|
-
*/
|
|
81
|
-
removeSubscription(subscriptionGuid: string): void;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Subscribe to receive click events. The subscriber callback will be called whenever this card is clicked by the
|
|
85
|
-
* user.
|
|
86
|
-
*
|
|
87
|
-
* @param subscriber - The callback function to receive click events. This function will be invoked with
|
|
88
|
-
* no arguments when this card records a click.
|
|
89
|
-
*
|
|
90
|
-
* @returns The identifier of the subscription created. This can be passed to `Card.removeSubscription`
|
|
91
|
-
* to cancel the subscription. Returns null if the subscriber passed is not a function.
|
|
92
|
-
*/
|
|
93
|
-
subscribeToClickedEvent(subscriber: () => void): string | null;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Subscribe to receive dismissed events. The subscriber callback will be called whenever this card is dismissed by the
|
|
97
|
-
* user.
|
|
98
|
-
*
|
|
99
|
-
* @param subscriber - The callback function to receive dismissed events. This function will be invoked with
|
|
100
|
-
* no arguments when this card records a dismissal.
|
|
101
|
-
*
|
|
102
|
-
* @returns The identifier of the subscription created. This can be passed to `Card.removeSubscription`
|
|
103
|
-
* to cancel the subscription. Returns null if the subscriber passed is not a function.
|
|
104
|
-
*/
|
|
105
|
-
subscribeToDismissedEvent(subscriber: () => void): string | null;
|
|
106
|
-
|
|
107
|
-
/** The id of the card. This will be reported back to Braze with events for analytics purposes. */
|
|
108
|
-
id?: string;
|
|
42
|
+
export class DeviceProperties {
|
|
43
|
+
/** The name of the browser - e.g. "Chrome" */
|
|
44
|
+
static readonly BROWSER: string;
|
|
45
|
+
/** The version of the browser - e.g. "59.234.1234" */
|
|
46
|
+
static readonly BROWSER_VERSION: string;
|
|
47
|
+
/** The name of the operating system - e.g. "Android" */
|
|
48
|
+
static readonly OS: string;
|
|
49
|
+
/** The screen resolution of the device - e.g. "1024x768" */
|
|
50
|
+
static readonly RESOLUTION: string;
|
|
51
|
+
/** The language the browser is set to use - e.g. "en-us" */
|
|
52
|
+
static readonly LANGUAGE: string;
|
|
53
|
+
/** The time zone of the device - e.g. "America/New_York" */
|
|
54
|
+
static readonly TIME_ZONE: string;
|
|
55
|
+
/** The user agent string of the browser - see [this link](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent) for more info */
|
|
56
|
+
static readonly USER_AGENT: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Abstract base for news feed and Content Cards cards. Use subclasses `ClassicCard`, `CaptionedImage`,
|
|
61
|
+
* `ImageOnly`, and `ControlCard`.
|
|
62
|
+
*/
|
|
63
|
+
export class Card {
|
|
64
|
+
/**
|
|
65
|
+
* Call this method if you wish to programmatically remove the card from the feed and log a dismissal. This method
|
|
66
|
+
* is meant to be used with the Braze UI.
|
|
67
|
+
*
|
|
68
|
+
* If you are using your own UI, this method will have no effect. Instead, you should use `logCardDismissal` to
|
|
69
|
+
* log analytics and then remove the card from the DOM manually.
|
|
70
|
+
*/
|
|
71
|
+
dismissCard(): void;
|
|
109
72
|
|
|
110
|
-
|
|
111
|
-
|
|
73
|
+
/** Remove all event subscriptions from this message. */
|
|
74
|
+
removeAllSubscriptions(): void;
|
|
112
75
|
|
|
113
|
-
|
|
114
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Remove an event subscription that you previously subscribed to.
|
|
78
|
+
*
|
|
79
|
+
* @param subscriptionGuid - The identifier of the subscription you wish to remove, returned by the method
|
|
80
|
+
* you initially used to create it.
|
|
81
|
+
*/
|
|
82
|
+
removeSubscription(subscriptionGuid: string): void;
|
|
115
83
|
|
|
116
|
-
|
|
117
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Subscribe to receive click events. The subscriber callback will be called whenever this card is clicked by the
|
|
86
|
+
* user.
|
|
87
|
+
*
|
|
88
|
+
* @param subscriber - The callback function to receive click events. This function will be invoked with
|
|
89
|
+
* no arguments when this card records a click.
|
|
90
|
+
*
|
|
91
|
+
* @returns The identifier of the subscription created. This can be passed to `Card.removeSubscription`
|
|
92
|
+
* to cancel the subscription. Returns null if the subscriber passed is not a function.
|
|
93
|
+
*/
|
|
94
|
+
subscribeToClickedEvent(subscriber: () => void): string | null;
|
|
118
95
|
|
|
119
|
-
|
|
120
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Subscribe to receive dismissed events. The subscriber callback will be called whenever this card is dismissed by the
|
|
98
|
+
* user.
|
|
99
|
+
*
|
|
100
|
+
* @param subscriber - The callback function to receive dismissed events. This function will be invoked with
|
|
101
|
+
* no arguments when this card records a dismissal.
|
|
102
|
+
*
|
|
103
|
+
* @returns The identifier of the subscription created. This can be passed to `Card.removeSubscription`
|
|
104
|
+
* to cancel the subscription. Returns null if the subscriber passed is not a function.
|
|
105
|
+
*/
|
|
106
|
+
subscribeToDismissedEvent(subscriber: () => void): string | null;
|
|
121
107
|
|
|
122
|
-
|
|
123
|
-
|
|
108
|
+
/** The id of the card. This will be reported back to Braze with events for analytics purposes. */
|
|
109
|
+
id?: string;
|
|
124
110
|
|
|
125
|
-
|
|
126
|
-
|
|
111
|
+
/** Whether this card has been shown to the user. */
|
|
112
|
+
viewed: boolean;
|
|
127
113
|
|
|
114
|
+
/** When this card was last modified. */
|
|
115
|
+
updated: Date | null;
|
|
128
116
|
|
|
129
|
-
|
|
117
|
+
/** When this card expires and should stop being shown to the user. */
|
|
118
|
+
expiresAt: Date | null;
|
|
130
119
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
* A card with only an image, which can be passed to `showFeed` or handled manually.
|
|
134
|
-
* Subscribe to receive new cards via `subscribeToFeedUpdates`
|
|
135
|
-
*
|
|
136
|
-
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
137
|
-
* @param viewed - Whether this card has been shown to the user.
|
|
138
|
-
* @param imageUrl - The url for this card's image.
|
|
139
|
-
* @param created - When this card was created.
|
|
140
|
-
* @param updated - When this card was last modified.
|
|
141
|
-
* @param categories - Purely for organization in your custom implementation, these categories can be set in
|
|
142
|
-
* the dashboard composer.
|
|
143
|
-
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
144
|
-
* @param url - A url to open when this card is clicked.
|
|
145
|
-
* @param linkText - The display text for the url.
|
|
146
|
-
* @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before
|
|
147
|
-
* image loading completes. Note that the field may not be supplied in certain circumstances.
|
|
148
|
-
* @param extras - Object of string/string key/value pairs.
|
|
149
|
-
* @param pinned - Whether to pin this card to the top of the view.
|
|
150
|
-
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
151
|
-
* @param clicked - Whether this card has ever been clicked on this device.
|
|
152
|
-
*/
|
|
153
|
-
constructor(
|
|
154
|
-
id?: string,
|
|
155
|
-
viewed?: boolean,
|
|
156
|
-
imageUrl?: string,
|
|
157
|
-
created?: Date,
|
|
158
|
-
updated?: Date,
|
|
159
|
-
categories?: string[],
|
|
160
|
-
expiresAt?: Date,
|
|
161
|
-
url?: string,
|
|
162
|
-
linkText?: string,
|
|
163
|
-
aspectRatio?: number,
|
|
164
|
-
extras?: Record<string, string>,
|
|
165
|
-
pinned?: boolean,
|
|
166
|
-
dismissible?: boolean,
|
|
167
|
-
clicked?: boolean
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
/** The url for this card's image. */
|
|
171
|
-
imageUrl?: string;
|
|
172
|
-
|
|
173
|
-
/** When this card was created. */
|
|
174
|
-
created: Date | null;
|
|
120
|
+
/** Object of string/string key/value pairs. Defaults to empty object {}. */
|
|
121
|
+
extras: Record<string, string>;
|
|
175
122
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
* the dashboard composer.
|
|
179
|
-
*/
|
|
180
|
-
categories: string[];
|
|
123
|
+
/** Whether to pin this card to the top of the view. */
|
|
124
|
+
pinned: boolean;
|
|
181
125
|
|
|
182
|
-
|
|
183
|
-
|
|
126
|
+
/** Whether this card is a ControlCard. */
|
|
127
|
+
isControl: boolean;
|
|
184
128
|
|
|
185
|
-
/** The display text for the url. */
|
|
186
|
-
linkText?: string;
|
|
187
129
|
|
|
188
|
-
|
|
189
|
-
* The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes.
|
|
190
|
-
* Note that the field may not be supplied in certain circumstances.
|
|
191
|
-
* */
|
|
192
|
-
aspectRatio: number | null;
|
|
130
|
+
}
|
|
193
131
|
|
|
194
|
-
|
|
195
|
-
|
|
132
|
+
/**
|
|
133
|
+
* @deprecated This class has been deprecated in favor of `ImageOnly`.
|
|
134
|
+
*/
|
|
135
|
+
export class Banner extends Card {
|
|
136
|
+
/**
|
|
137
|
+
* A card with only an image, which can be passed to `showFeed` or handled manually.
|
|
138
|
+
* Subscribe to receive new cards via `subscribeToFeedUpdates`
|
|
139
|
+
*
|
|
140
|
+
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
141
|
+
* @param viewed - Whether this card has been shown to the user.
|
|
142
|
+
* @param imageUrl - The url for this card's image.
|
|
143
|
+
* @param created - When this card was created.
|
|
144
|
+
* @param updated - When this card was last modified.
|
|
145
|
+
* @param categories - Purely for organization in your custom implementation, these categories can be set in
|
|
146
|
+
* the dashboard composer.
|
|
147
|
+
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
148
|
+
* @param url - A url to open when this card is clicked.
|
|
149
|
+
* @param linkText - The display text for the url.
|
|
150
|
+
* @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before
|
|
151
|
+
* image loading completes. Note that the field may not be supplied in certain circumstances.
|
|
152
|
+
* @param extras - Object of string/string key/value pairs.
|
|
153
|
+
* @param pinned - Whether to pin this card to the top of the view.
|
|
154
|
+
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
155
|
+
* @param clicked - Whether this card has ever been clicked on this device.
|
|
156
|
+
*/
|
|
157
|
+
constructor(
|
|
158
|
+
id?: string,
|
|
159
|
+
viewed?: boolean,
|
|
160
|
+
imageUrl?: string,
|
|
161
|
+
created?: Date,
|
|
162
|
+
updated?: Date,
|
|
163
|
+
categories?: string[],
|
|
164
|
+
expiresAt?: Date,
|
|
165
|
+
url?: string,
|
|
166
|
+
linkText?: string,
|
|
167
|
+
aspectRatio?: number,
|
|
168
|
+
extras?: Record<string, string>,
|
|
169
|
+
pinned?: boolean,
|
|
170
|
+
dismissible?: boolean,
|
|
171
|
+
clicked?: boolean,
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
/** The url for this card's image. */
|
|
175
|
+
imageUrl?: string;
|
|
176
|
+
|
|
177
|
+
/** When this card was created. */
|
|
178
|
+
created: Date | null;
|
|
196
179
|
|
|
197
|
-
|
|
198
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Purely for organization in your custom implementation, these categories can be set in
|
|
182
|
+
* the dashboard composer.
|
|
183
|
+
*/
|
|
184
|
+
categories: string[];
|
|
199
185
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
186
|
+
/** A url to open when this card is clicked. */
|
|
187
|
+
url?: string;
|
|
203
188
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
* A card with a large image and descriptive text, which can be passed to `showFeed` or handled manually.
|
|
207
|
-
* Subscribe to receive new cards via `subscribeToFeedUpdates`.
|
|
208
|
-
*
|
|
209
|
-
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
210
|
-
* @param viewed - Whether this card has been shown to the user.
|
|
211
|
-
* @param title - The title text for this card.
|
|
212
|
-
* @param imageUrl - The url for this card's image.
|
|
213
|
-
* @param description - The body text for this card.
|
|
214
|
-
* @param created - When this card was created.
|
|
215
|
-
* @param updated - When this card was last modified.
|
|
216
|
-
* @param categories - Purely for organization in your custom implementation, these categories can be set in
|
|
217
|
-
* the dashboard composer.
|
|
218
|
-
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
219
|
-
* @param url - A url to open when this card is clicked.
|
|
220
|
-
* @param linkText - The display text for the url.
|
|
221
|
-
* @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before
|
|
222
|
-
* image loading completes. Note that the field may not be supplied in certain circumstances.
|
|
223
|
-
* @param extras - Object of string/string key/value pairs.
|
|
224
|
-
* @param pinned - Whether to pin this card to the top of the view.
|
|
225
|
-
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
226
|
-
* @param clicked - Whether this card has ever been clicked on this device.
|
|
227
|
-
*/
|
|
228
|
-
constructor(
|
|
229
|
-
id?: string,
|
|
230
|
-
viewed?: boolean,
|
|
231
|
-
title?: string,
|
|
232
|
-
imageUrl?: string,
|
|
233
|
-
description?: string,
|
|
234
|
-
created?: Date,
|
|
235
|
-
updated?: Date,
|
|
236
|
-
categories?: string[],
|
|
237
|
-
expiresAt?: Date,
|
|
238
|
-
url?: string,
|
|
239
|
-
linkText?: string,
|
|
240
|
-
aspectRatio?: number,
|
|
241
|
-
extras?: Record<string, string>,
|
|
242
|
-
pinned?: boolean,
|
|
243
|
-
dismissible?: boolean,
|
|
244
|
-
clicked?: boolean
|
|
245
|
-
);
|
|
246
|
-
|
|
247
|
-
/** The title text for this card. */
|
|
248
|
-
title: string;
|
|
249
|
-
|
|
250
|
-
/** The url for this card's image. */
|
|
251
|
-
imageUrl?: string;
|
|
252
|
-
|
|
253
|
-
/** The body text for this card. */
|
|
254
|
-
description: string;
|
|
255
|
-
|
|
256
|
-
/** When this card was created. */
|
|
257
|
-
created: Date | null;
|
|
189
|
+
/** The display text for the url. */
|
|
190
|
+
linkText?: string;
|
|
258
191
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
192
|
+
/**
|
|
193
|
+
* The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes.
|
|
194
|
+
* Note that the field may not be supplied in certain circumstances.
|
|
195
|
+
* */
|
|
196
|
+
aspectRatio: number | null;
|
|
264
197
|
|
|
265
|
-
|
|
266
|
-
|
|
198
|
+
/** Whether this card has been dismissed. */
|
|
199
|
+
dismissed: boolean;
|
|
267
200
|
|
|
268
|
-
|
|
269
|
-
|
|
201
|
+
/** Whether to allow the user to dismiss this card, removing it from the view. */
|
|
202
|
+
dismissible: boolean;
|
|
270
203
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
*/
|
|
275
|
-
aspectRatio: number | null;
|
|
204
|
+
/** Whether this card has ever been clicked on this device. */
|
|
205
|
+
clicked: boolean;
|
|
206
|
+
}
|
|
276
207
|
|
|
277
|
-
|
|
278
|
-
|
|
208
|
+
export class ImageOnly extends Card {
|
|
209
|
+
/**
|
|
210
|
+
* A card with only an image, which can be passed to `showFeed` or handled manually.
|
|
211
|
+
* Subscribe to receive new cards via `subscribeToFeedUpdates`
|
|
212
|
+
*
|
|
213
|
+
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
214
|
+
* @param viewed - Whether this card has been shown to the user.
|
|
215
|
+
* @param imageUrl - The url for this card's image.
|
|
216
|
+
* @param created - When this card was created.
|
|
217
|
+
* @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
|
+
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
221
|
+
* @param url - A url to open when this card is clicked.
|
|
222
|
+
* @param linkText - The display text for the url.
|
|
223
|
+
* @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before
|
|
224
|
+
* image loading completes. Note that the field may not be supplied in certain circumstances.
|
|
225
|
+
* @param extras - Object of string/string key/value pairs.
|
|
226
|
+
* @param pinned - Whether to pin this card to the top of the view.
|
|
227
|
+
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
228
|
+
* @param clicked - Whether this card has ever been clicked on this device.
|
|
229
|
+
*/
|
|
230
|
+
constructor(
|
|
231
|
+
id?: string,
|
|
232
|
+
viewed?: boolean,
|
|
233
|
+
imageUrl?: string,
|
|
234
|
+
created?: Date,
|
|
235
|
+
updated?: Date,
|
|
236
|
+
categories?: string[],
|
|
237
|
+
expiresAt?: Date,
|
|
238
|
+
url?: string,
|
|
239
|
+
linkText?: string,
|
|
240
|
+
aspectRatio?: number,
|
|
241
|
+
extras?: Record<string, string>,
|
|
242
|
+
pinned?: boolean,
|
|
243
|
+
dismissible?: boolean,
|
|
244
|
+
clicked?: boolean,
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
/** The url for this card's image. */
|
|
248
|
+
imageUrl?: string;
|
|
249
|
+
|
|
250
|
+
/** When this card was created. */
|
|
251
|
+
created: Date | null;
|
|
279
252
|
|
|
280
|
-
|
|
281
|
-
|
|
253
|
+
/**
|
|
254
|
+
* Purely for organization in your custom implementation, these categories can be set in
|
|
255
|
+
* the dashboard composer.
|
|
256
|
+
*/
|
|
257
|
+
categories: string[];
|
|
282
258
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
259
|
+
/** A url to open when this card is clicked. */
|
|
260
|
+
url?: string;
|
|
286
261
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
* A card with a title, body, and optionally a small image, which can be passed to
|
|
290
|
-
* `showFeed` or handled manually.
|
|
291
|
-
* Subscribe to receive new cards via `subscribeToFeedUpdates`.
|
|
292
|
-
*
|
|
293
|
-
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
294
|
-
* @param viewed - Whether this card has been shown to the user.
|
|
295
|
-
* @param title - The title text for this card.
|
|
296
|
-
* @param imageUrl - The url for this card's image.
|
|
297
|
-
* @param description - The body text for this card.
|
|
298
|
-
* @param created - When this card was created.
|
|
299
|
-
* @param updated - When this card was last modified.
|
|
300
|
-
* @param categories - Purely for organization in your custom implementation, these categories can be set in
|
|
301
|
-
* the dashboard composer.
|
|
302
|
-
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
303
|
-
* @param url - A url to open when this card is clicked.
|
|
304
|
-
* @param linkText - The display text for the url.
|
|
305
|
-
* @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before
|
|
306
|
-
* image loading completes. Note that the field may not be supplied in certain circumstances.
|
|
307
|
-
* @param extras - Object of string/string key/value pairs.
|
|
308
|
-
* @param pinned - Whether to pin this card to the top of the view.
|
|
309
|
-
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
310
|
-
* @param clicked - Whether this card has ever been clicked on this device.
|
|
311
|
-
*/
|
|
312
|
-
constructor(
|
|
313
|
-
id?: string,
|
|
314
|
-
viewed?: boolean,
|
|
315
|
-
title?: string,
|
|
316
|
-
imageUrl?: string,
|
|
317
|
-
description?: string,
|
|
318
|
-
created?: Date,
|
|
319
|
-
updated?: Date,
|
|
320
|
-
categories?: string[],
|
|
321
|
-
expiresAt?: Date,
|
|
322
|
-
url?: string,
|
|
323
|
-
linkText?: string,
|
|
324
|
-
aspectRatio?: number,
|
|
325
|
-
extras?: Record<string, string>,
|
|
326
|
-
pinned?: boolean,
|
|
327
|
-
dismissible?: boolean,
|
|
328
|
-
clicked?: boolean
|
|
329
|
-
);
|
|
330
|
-
|
|
331
|
-
/** The title text for this card. */
|
|
332
|
-
title: string;
|
|
333
|
-
|
|
334
|
-
/** The url for this card's image. */
|
|
335
|
-
imageUrl?: string;
|
|
336
|
-
|
|
337
|
-
/** The body text for this card. */
|
|
338
|
-
description: string;
|
|
339
|
-
|
|
340
|
-
/** When this card was created. */
|
|
341
|
-
created: Date | null;
|
|
262
|
+
/** The display text for the url. */
|
|
263
|
+
linkText?: string;
|
|
342
264
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
265
|
+
/**
|
|
266
|
+
* The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes.
|
|
267
|
+
* Note that the field may not be supplied in certain circumstances.
|
|
268
|
+
* */
|
|
269
|
+
aspectRatio: number | null;
|
|
348
270
|
|
|
349
|
-
|
|
350
|
-
|
|
271
|
+
/** Whether this card has been dismissed. */
|
|
272
|
+
dismissed: boolean;
|
|
351
273
|
|
|
352
|
-
|
|
353
|
-
|
|
274
|
+
/** Whether to allow the user to dismiss this card, removing it from the view. */
|
|
275
|
+
dismissible: boolean;
|
|
354
276
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
*/
|
|
359
|
-
aspectRatio: number | null;
|
|
277
|
+
/** Whether this card has ever been clicked on this device. */
|
|
278
|
+
clicked: boolean;
|
|
279
|
+
}
|
|
360
280
|
|
|
361
|
-
|
|
362
|
-
|
|
281
|
+
export class CaptionedImage extends Card {
|
|
282
|
+
/**
|
|
283
|
+
* A card with a large image and descriptive text, which can be passed to `showFeed` or handled manually.
|
|
284
|
+
* Subscribe to receive new cards via `subscribeToFeedUpdates`.
|
|
285
|
+
*
|
|
286
|
+
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
287
|
+
* @param viewed - Whether this card has been shown to the user.
|
|
288
|
+
* @param title - The title text for this card.
|
|
289
|
+
* @param imageUrl - The url for this card's image.
|
|
290
|
+
* @param description - The body text for this card.
|
|
291
|
+
* @param created - When this card was created.
|
|
292
|
+
* @param updated - When this card was last modified.
|
|
293
|
+
* @param categories - Purely for organization in your custom implementation, these categories can be set in
|
|
294
|
+
* the dashboard composer.
|
|
295
|
+
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
296
|
+
* @param url - A url to open when this card is clicked.
|
|
297
|
+
* @param linkText - The display text for the url.
|
|
298
|
+
* @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before
|
|
299
|
+
* image loading completes. Note that the field may not be supplied in certain circumstances.
|
|
300
|
+
* @param extras - Object of string/string key/value pairs.
|
|
301
|
+
* @param pinned - Whether to pin this card to the top of the view.
|
|
302
|
+
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
303
|
+
* @param clicked - Whether this card has ever been clicked on this device.
|
|
304
|
+
*/
|
|
305
|
+
constructor(
|
|
306
|
+
id?: string,
|
|
307
|
+
viewed?: boolean,
|
|
308
|
+
title?: string,
|
|
309
|
+
imageUrl?: string,
|
|
310
|
+
description?: string,
|
|
311
|
+
created?: Date,
|
|
312
|
+
updated?: Date,
|
|
313
|
+
categories?: string[],
|
|
314
|
+
expiresAt?: Date,
|
|
315
|
+
url?: string,
|
|
316
|
+
linkText?: string,
|
|
317
|
+
aspectRatio?: number,
|
|
318
|
+
extras?: Record<string, string>,
|
|
319
|
+
pinned?: boolean,
|
|
320
|
+
dismissible?: boolean,
|
|
321
|
+
clicked?: boolean,
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
/** The title text for this card. */
|
|
325
|
+
title: string;
|
|
326
|
+
|
|
327
|
+
/** The url for this card's image. */
|
|
328
|
+
imageUrl?: string;
|
|
329
|
+
|
|
330
|
+
/** The body text for this card. */
|
|
331
|
+
description: string;
|
|
332
|
+
|
|
333
|
+
/** When this card was created. */
|
|
334
|
+
created: Date | null;
|
|
363
335
|
|
|
364
|
-
|
|
365
|
-
|
|
336
|
+
/**
|
|
337
|
+
* Purely for organization in your custom implementation, these categories can be set in
|
|
338
|
+
* the dashboard composer.
|
|
339
|
+
*/
|
|
340
|
+
categories: string[];
|
|
366
341
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
342
|
+
/** A url to open when this card is clicked. */
|
|
343
|
+
url?: string;
|
|
370
344
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
* A card with no display that logs impressions, which can be passed to
|
|
374
|
-
* `showFeed` or handled manually.
|
|
375
|
-
* Not supported in legacy news feed.
|
|
376
|
-
* Subscribe to receive new cards via `subscribeToFeedUpdates`.
|
|
377
|
-
*
|
|
378
|
-
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
379
|
-
* @param viewed - Whether this card has been shown to the user.
|
|
380
|
-
* @param updated - When this card was last modified.
|
|
381
|
-
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
382
|
-
* @param extras - Object of string/string key/value pairs.
|
|
383
|
-
* @param pinned - Whether to pin this card to the top of the view.
|
|
384
|
-
*/
|
|
385
|
-
constructor(
|
|
386
|
-
id?: string,
|
|
387
|
-
viewed?: boolean,
|
|
388
|
-
updated?: Date,
|
|
389
|
-
expiresAt?: Date,
|
|
390
|
-
extras?: Record<string, string>,
|
|
391
|
-
pinned?: boolean
|
|
392
|
-
);
|
|
393
|
-
|
|
394
|
-
/** Whether this card is a ControlCard. */
|
|
395
|
-
isControl: true;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
export class ContentCards {
|
|
399
|
-
/**
|
|
400
|
-
* A collection of `Card` descendents (`ClassicCard`, `CaptionedImage`, `Banner`).
|
|
401
|
-
* If you use Braze's UI to render content cards, you generally shouldn't need to
|
|
402
|
-
* interact with this class, but if you are building your own content cards class manually, use
|
|
403
|
-
* `getCachedContentCards` to get the most recent ContentCards object.
|
|
404
|
-
*
|
|
405
|
-
* @param cards - Array of `Card` descendents (`ClassicCard`, `CaptionedImage`, `Banner`).
|
|
406
|
-
* @param lastUpdated - When this collection of cards was received from Braze servers. If null, it means the
|
|
407
|
-
* content cards are still being fetched for this user.
|
|
408
|
-
*/
|
|
409
|
-
constructor(cards: Card[], lastUpdated: Date | null);
|
|
345
|
+
/** The display text for the url. */
|
|
346
|
+
linkText?: string;
|
|
410
347
|
|
|
411
|
-
|
|
412
|
-
|
|
348
|
+
/**
|
|
349
|
+
* The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes.
|
|
350
|
+
* Note that the field may not be supplied in certain circumstances.
|
|
351
|
+
*/
|
|
352
|
+
aspectRatio: number | null;
|
|
413
353
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
* content cards are still being fetched for this user.
|
|
417
|
-
*/
|
|
418
|
-
lastUpdated: Date | null;
|
|
354
|
+
/** Whether this card has been dismissed. */
|
|
355
|
+
dismissed: boolean;
|
|
419
356
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
* `ControlCard` cards do not count towards the unviewed count.
|
|
423
|
-
*/
|
|
424
|
-
getUnviewedCardCount(): number;
|
|
425
|
-
}
|
|
357
|
+
/** Whether to allow the user to dismiss this card, removing it from the view. */
|
|
358
|
+
dismissible: boolean;
|
|
426
359
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
* Subscribe to receive feed updates via `subscribeToFeedUpdates`,
|
|
431
|
-
* or get the currently cached feed with `getCachedFeed`.
|
|
432
|
-
*
|
|
433
|
-
* @param cards - Array of `Card` descendents (`ClassicCard`, `CaptionedImage`,
|
|
434
|
-
* `Banner`). Can be passed directly to `showFeed`.
|
|
435
|
-
* @param lastUpdated - When this collection of cards was received from Braze servers. If null, it means the
|
|
436
|
-
* feed has never been fetched for this user.
|
|
437
|
-
*/
|
|
438
|
-
constructor(cards: Card[], lastUpdated: Date | null);
|
|
360
|
+
/** Whether this card has ever been clicked on this device. */
|
|
361
|
+
clicked: boolean;
|
|
362
|
+
}
|
|
439
363
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
cards
|
|
364
|
+
export class ClassicCard extends Card {
|
|
365
|
+
/**
|
|
366
|
+
* A card with a title, body, and optionally a small image, which can be passed to
|
|
367
|
+
* `showFeed` or handled manually.
|
|
368
|
+
* Subscribe to receive new cards via `subscribeToFeedUpdates`.
|
|
369
|
+
*
|
|
370
|
+
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
371
|
+
* @param viewed - Whether this card has been shown to the user.
|
|
372
|
+
* @param title - The title text for this card.
|
|
373
|
+
* @param imageUrl - The url for this card's image.
|
|
374
|
+
* @param description - The body text for this card.
|
|
375
|
+
* @param created - When this card was created.
|
|
376
|
+
* @param updated - When this card was last modified.
|
|
377
|
+
* @param categories - Purely for organization in your custom implementation, these categories can be set in
|
|
378
|
+
* the dashboard composer.
|
|
379
|
+
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
380
|
+
* @param url - A url to open when this card is clicked.
|
|
381
|
+
* @param linkText - The display text for the url.
|
|
382
|
+
* @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before
|
|
383
|
+
* image loading completes. Note that the field may not be supplied in certain circumstances.
|
|
384
|
+
* @param extras - Object of string/string key/value pairs.
|
|
385
|
+
* @param pinned - Whether to pin this card to the top of the view.
|
|
386
|
+
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
387
|
+
* @param clicked - Whether this card has ever been clicked on this device.
|
|
388
|
+
*/
|
|
389
|
+
constructor(
|
|
390
|
+
id?: string,
|
|
391
|
+
viewed?: boolean,
|
|
392
|
+
title?: string,
|
|
393
|
+
imageUrl?: string,
|
|
394
|
+
description?: string,
|
|
395
|
+
created?: Date,
|
|
396
|
+
updated?: Date,
|
|
397
|
+
categories?: string[],
|
|
398
|
+
expiresAt?: Date,
|
|
399
|
+
url?: string,
|
|
400
|
+
linkText?: string,
|
|
401
|
+
aspectRatio?: number,
|
|
402
|
+
extras?: Record<string, string>,
|
|
403
|
+
pinned?: boolean,
|
|
404
|
+
dismissible?: boolean,
|
|
405
|
+
clicked?: boolean,
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
/** The title text for this card. */
|
|
409
|
+
title: string;
|
|
410
|
+
|
|
411
|
+
/** The url for this card's image. */
|
|
412
|
+
imageUrl?: string;
|
|
413
|
+
|
|
414
|
+
/** The body text for this card. */
|
|
415
|
+
description: string;
|
|
416
|
+
|
|
417
|
+
/** When this card was created. */
|
|
418
|
+
created: Date | null;
|
|
445
419
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
420
|
+
/**
|
|
421
|
+
* Purely for organization in your custom implementation, these categories can be set in
|
|
422
|
+
* the dashboard composer.
|
|
423
|
+
*/
|
|
424
|
+
categories: string[];
|
|
451
425
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
* Note that Braze will not refresh news feed cards on new page loads (and so this function will return 0) until you
|
|
455
|
-
* call `showFeed` or `requestFeedRefresh`. `ControlCard` cards do not count towards the
|
|
456
|
-
* unread count.
|
|
457
|
-
*/
|
|
458
|
-
getUnreadCardCount(): number;
|
|
459
|
-
}
|
|
426
|
+
/** A url to open when this card is clicked. */
|
|
427
|
+
url?: string;
|
|
460
428
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
* A non-showing message placeholder that represents this user receiving the the control for a multivariate
|
|
464
|
-
* test. Can be passed to `showInAppMessage` to log the user's
|
|
465
|
-
* entrollment in the control or handled manually.
|
|
466
|
-
*
|
|
467
|
-
* @param triggerId - The id of the trigger that created this message. The SDK will report back this to
|
|
468
|
-
* Braze with in-app message analytics events.
|
|
469
|
-
*/
|
|
470
|
-
constructor(triggerId?: string);
|
|
429
|
+
/** The display text for the url. */
|
|
430
|
+
linkText?: string;
|
|
471
431
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
432
|
+
/**
|
|
433
|
+
* The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes.
|
|
434
|
+
* Note that the field may not be supplied in certain circumstances.
|
|
435
|
+
*/
|
|
436
|
+
aspectRatio: number | null;
|
|
477
437
|
|
|
478
|
-
|
|
479
|
-
|
|
438
|
+
/** Whether this card has been dismissed. */
|
|
439
|
+
dismissed: boolean;
|
|
480
440
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}
|
|
441
|
+
/** Whether to allow the user to dismiss this card, removing it from the view. */
|
|
442
|
+
dismissible: boolean;
|
|
484
443
|
|
|
485
|
-
|
|
486
|
-
|
|
444
|
+
/** Whether this card has ever been clicked on this device. */
|
|
445
|
+
clicked: boolean;
|
|
446
|
+
}
|
|
487
447
|
|
|
488
|
-
|
|
489
|
-
|
|
448
|
+
export class ControlCard extends Card {
|
|
449
|
+
/**
|
|
450
|
+
* A card with no display that logs impressions, which can be passed to
|
|
451
|
+
* `showFeed` or handled manually.
|
|
452
|
+
* Not supported in legacy news feed.
|
|
453
|
+
* Subscribe to receive new cards via `subscribeToFeedUpdates`.
|
|
454
|
+
*
|
|
455
|
+
* @param id - The id of the card. This will be reported back to Braze with events for analytics purposes.
|
|
456
|
+
* @param viewed - Whether this card has been shown to the user.
|
|
457
|
+
* @param updated - When this card was last modified.
|
|
458
|
+
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
459
|
+
* @param extras - Object of string/string key/value pairs.
|
|
460
|
+
* @param pinned - Whether to pin this card to the top of the view.
|
|
461
|
+
*/
|
|
462
|
+
constructor(
|
|
463
|
+
id?: string,
|
|
464
|
+
viewed?: boolean,
|
|
465
|
+
updated?: Date,
|
|
466
|
+
expiresAt?: Date,
|
|
467
|
+
extras?: Record<string, string>,
|
|
468
|
+
pinned?: boolean,
|
|
469
|
+
);
|
|
470
|
+
|
|
471
|
+
/** Whether this card is a ControlCard. */
|
|
472
|
+
isControl: true;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export class ContentCards {
|
|
476
|
+
/**
|
|
477
|
+
* A collection of `Card` descendents (`ClassicCard`, `CaptionedImage`, `Banner`).
|
|
478
|
+
* If you use Braze's UI to render content cards, you generally shouldn't need to
|
|
479
|
+
* interact with this class, but if you are building your own content cards class manually, use
|
|
480
|
+
* `getCachedContentCards` to get the most recent ContentCards object.
|
|
481
|
+
*
|
|
482
|
+
* @param cards - Array of `Card` descendents (`ClassicCard`, `CaptionedImage`, `Banner`).
|
|
483
|
+
* @param lastUpdated - When this collection of cards was received from Braze servers. If null, it means the
|
|
484
|
+
* content cards are still being fetched for this user.
|
|
485
|
+
*/
|
|
486
|
+
constructor(cards: Card[], lastUpdated: Date | null);
|
|
490
487
|
|
|
491
|
-
|
|
492
|
-
|
|
488
|
+
/** Array of `Card` descendents (`ClassicCard`, `CaptionedImage`, `Banner`). */
|
|
489
|
+
cards: Card[];
|
|
493
490
|
|
|
494
|
-
|
|
495
|
-
|
|
491
|
+
/**
|
|
492
|
+
* When this collection of cards was received from Braze servers. If null, it means the
|
|
493
|
+
* content cards are still being fetched for this user.
|
|
494
|
+
*/
|
|
495
|
+
lastUpdated: Date | null;
|
|
496
496
|
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
/**
|
|
498
|
+
* Get the current unviewed card count. This is useful for powering badges on your control for showing the content cards.
|
|
499
|
+
* `ControlCard` cards do not count towards the unviewed count.
|
|
500
|
+
*/
|
|
501
|
+
getUnviewedCardCount(): number;
|
|
502
|
+
}
|
|
499
503
|
|
|
500
|
-
|
|
501
|
-
|
|
504
|
+
export class Feed {
|
|
505
|
+
/**
|
|
506
|
+
* A collection of `Card` descendents (`ClassicCard`, `CaptionedImage`, `Banner`).
|
|
507
|
+
* Subscribe to receive feed updates via `subscribeToFeedUpdates`,
|
|
508
|
+
* or get the currently cached feed with `getCachedFeed`.
|
|
509
|
+
*
|
|
510
|
+
* @param cards - Array of `Card` descendents (`ClassicCard`, `CaptionedImage`,
|
|
511
|
+
* `Banner`). Can be passed directly to `showFeed`.
|
|
512
|
+
* @param lastUpdated - When this collection of cards was received from Braze servers. If null, it means the
|
|
513
|
+
* feed has never been fetched for this user.
|
|
514
|
+
*/
|
|
515
|
+
constructor(cards: Card[], lastUpdated: Date | null);
|
|
502
516
|
|
|
503
|
-
|
|
504
|
-
|
|
517
|
+
/**
|
|
518
|
+
* Array of `Card` descendents (`ClassicCard`, `CaptionedImage`, `Banner`).
|
|
519
|
+
* Can be passed directly to `showFeed`.
|
|
520
|
+
*/
|
|
521
|
+
cards: Card[];
|
|
505
522
|
|
|
506
|
-
|
|
507
|
-
|
|
523
|
+
/**
|
|
524
|
+
* When this collection of cards was received from Braze servers. If null, it means the
|
|
525
|
+
* content cards are still being fetched for this user.
|
|
526
|
+
*/
|
|
527
|
+
lastUpdated: Date | null;
|
|
508
528
|
|
|
509
529
|
/**
|
|
510
|
-
*
|
|
511
|
-
*
|
|
530
|
+
* Get the current unread card count. This is useful for powering badges on your control for showing the news feed.
|
|
531
|
+
* Note that Braze will not refresh news feed cards on new page loads (and so this function will return 0) until you
|
|
532
|
+
* call `showFeed` or `requestFeedRefresh`. `ControlCard` cards do not count towards the
|
|
533
|
+
* unread count.
|
|
512
534
|
*/
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
TOP: "TOP";
|
|
516
|
-
BOTTOM: "BOTTOM";
|
|
517
|
-
};
|
|
535
|
+
getUnreadCardCount(): number;
|
|
536
|
+
}
|
|
518
537
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
538
|
+
export class ControlMessage {
|
|
539
|
+
/**
|
|
540
|
+
* A non-showing message placeholder that represents this user receiving the the control for a multivariate
|
|
541
|
+
* test. Can be passed to `showInAppMessage` to log the user's
|
|
542
|
+
* entrollment in the control or handled manually.
|
|
543
|
+
*
|
|
544
|
+
* @param triggerId - The id of the trigger that created this message. The SDK will report back this to
|
|
545
|
+
* Braze with in-app message analytics events.
|
|
546
|
+
*/
|
|
547
|
+
constructor(triggerId?: string);
|
|
524
548
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
549
|
+
/**
|
|
550
|
+
* The id of the trigger that created this message. The SDK will report back this to
|
|
551
|
+
* Braze with in-app message analytics events.
|
|
552
|
+
*/
|
|
553
|
+
triggerId?: string;
|
|
529
554
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
BLANK: "BLANK";
|
|
533
|
-
};
|
|
555
|
+
/** Object of string/string key/value pairs. */
|
|
556
|
+
extras: Record<string, string>;
|
|
534
557
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
};
|
|
558
|
+
/** Whether this message is a ControlMessage. */
|
|
559
|
+
isControl: true;
|
|
560
|
+
}
|
|
539
561
|
|
|
540
|
-
static Orientation: {
|
|
541
|
-
PORTRAIT: "PORTRAIT";
|
|
542
|
-
LANDSCAPE: "LANDSCAPE";
|
|
543
|
-
};
|
|
544
562
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
CENTER: "CENTER";
|
|
548
|
-
END: "END";
|
|
549
|
-
};
|
|
563
|
+
type SlideFrom =
|
|
564
|
+
(typeof InAppMessage.SlideFrom)[keyof typeof InAppMessage.SlideFrom];
|
|
550
565
|
|
|
551
|
-
static CropType: {
|
|
552
|
-
/**
|
|
553
|
-
* Centers the image in the available space and crops any overflowing edges.
|
|
554
|
-
*/
|
|
555
|
-
CENTER_CROP: "CENTER_CROP";
|
|
556
566
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
* axis (e.g. tall images will have bars of blank space on the left/right)
|
|
560
|
-
*/
|
|
561
|
-
FIT_CENTER: "FIT_CENTER";
|
|
562
|
-
};
|
|
567
|
+
type ClickAction =
|
|
568
|
+
(typeof InAppMessage.ClickAction)[keyof typeof InAppMessage.ClickAction];
|
|
563
569
|
|
|
564
|
-
/** The message to display to the user. */
|
|
565
|
-
message?: string;
|
|
566
570
|
|
|
567
|
-
|
|
568
|
-
|
|
571
|
+
type DismissType =
|
|
572
|
+
(typeof InAppMessage.DismissType)[keyof typeof InAppMessage.DismissType];
|
|
569
573
|
|
|
570
|
-
/**
|
|
571
|
-
* The id of the trigger that created this message. The SDK will report back this to
|
|
572
|
-
* Braze with in-app message analytics events.
|
|
573
|
-
*/
|
|
574
|
-
triggerId?: string;
|
|
575
574
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
* See the `DismissType` enum.
|
|
579
|
-
*/
|
|
580
|
-
dismissType: DismissType;
|
|
575
|
+
type OpenTarget =
|
|
576
|
+
(typeof InAppMessage.OpenTarget)[keyof typeof InAppMessage.OpenTarget];
|
|
581
577
|
|
|
582
|
-
/**
|
|
583
|
-
* Length of time in milliseconds until auto-dismiss should occur. Only used when
|
|
584
|
-
* dismissType is `DismissType`.AUTO_DISMISS
|
|
585
|
-
*/
|
|
586
|
-
duration: number;
|
|
587
578
|
|
|
588
|
-
|
|
589
|
-
|
|
579
|
+
type ImageStyle =
|
|
580
|
+
(typeof InAppMessage.ImageStyle)[keyof typeof InAppMessage.ImageStyle];
|
|
590
581
|
|
|
591
|
-
/** Whether to animate the hiding of this message. */
|
|
592
|
-
animateOut: boolean;
|
|
593
582
|
|
|
594
|
-
|
|
595
|
-
|
|
583
|
+
type Orientation =
|
|
584
|
+
(typeof InAppMessage.Orientation)[keyof typeof InAppMessage.Orientation];
|
|
596
585
|
|
|
597
|
-
/**
|
|
598
|
-
* Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
599
|
-
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
600
|
-
*/
|
|
601
|
-
css?: string;
|
|
602
586
|
|
|
603
|
-
|
|
604
|
-
|
|
587
|
+
type TextAlignment =
|
|
588
|
+
(typeof InAppMessage.TextAlignment)[keyof typeof InAppMessage.TextAlignment];
|
|
605
589
|
|
|
606
|
-
/**
|
|
607
|
-
* Call this method if you wish to programmatically remove the message from the DOM. This method will only
|
|
608
|
-
* work with the Braze UI.
|
|
609
|
-
*/
|
|
610
|
-
closeMessage(): void;
|
|
611
590
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
/**
|
|
616
|
-
* Remove an event subscription that you previously subscribed to.
|
|
617
|
-
*
|
|
618
|
-
* @param subscriptionGuid - The identifier of the subscription you wish to remove, returned by the method
|
|
619
|
-
* you initially used to create it.
|
|
620
|
-
*/
|
|
621
|
-
removeSubscription(subscriptionGuid: string): void;
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* Subscribe to receive click events. The subscriber callback will be called whenever this message is clicked by the
|
|
625
|
-
* user.
|
|
626
|
-
*
|
|
627
|
-
* @param subscriber - The callback function to receive click events. This function will be invoked with
|
|
628
|
-
* no arguments when this message records a click.
|
|
629
|
-
*
|
|
630
|
-
* @returns The identifier of the subscription created. This can be passed to `removeSubscription`
|
|
631
|
-
* to cancel the subscription. Returns null if the subscriber passed is not a function.
|
|
632
|
-
*/
|
|
633
|
-
subscribeToClickedEvent(subscriber: () => void): string | null;
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* Subscribe to receive dismissed events. The subscriber callback will be called whenever this message is closed
|
|
637
|
-
* by the user, or when it's dismissed automatically (depending on the dismissType).
|
|
638
|
-
*
|
|
639
|
-
* @param subscriber - The callback function to receive dismissed events. This function will be invoked with
|
|
640
|
-
* no arguments when this message records a dismissal.
|
|
641
|
-
*
|
|
642
|
-
* @returns The identifier of the subscription created. This can be passed to `removeSubscription`
|
|
643
|
-
* to cancel the subscription. Returns null if the subscriber passed is not a function.
|
|
644
|
-
*/
|
|
645
|
-
subscribeToDismissedEvent(subscriber: () => void): string | null;
|
|
591
|
+
type CropType =
|
|
592
|
+
(typeof InAppMessage.CropType)[keyof typeof InAppMessage.CropType];
|
|
646
593
|
|
|
594
|
+
/**
|
|
595
|
+
* Abstract base for in-app messages. Use subclasses `SlideUpMessage`,
|
|
596
|
+
* `ModalMessage`, `FullScreenMessage`, and `HtmlMessage`.
|
|
597
|
+
*/
|
|
598
|
+
export class InAppMessage {
|
|
599
|
+
static SlideFrom: {
|
|
600
|
+
TOP: "TOP";
|
|
601
|
+
BOTTOM: "BOTTOM";
|
|
602
|
+
};
|
|
647
603
|
|
|
648
|
-
|
|
604
|
+
static ClickAction: {
|
|
605
|
+
NEWS_FEED: "NEWS_FEED";
|
|
606
|
+
URI: "URI";
|
|
607
|
+
NONE: "NONE";
|
|
608
|
+
};
|
|
649
609
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
*
|
|
655
|
-
* @param message - The message to display to the user.
|
|
656
|
-
* @param messageAlignment - How to align message text. See the `TextAlignment` enum.
|
|
657
|
-
* @param extras - Object of string/string key/value pairs.
|
|
658
|
-
* @param triggerId - The id of the trigger that created this message. The SDK will report back this to
|
|
659
|
-
* Braze with in-app message analytics events.
|
|
660
|
-
* @param clickAction - Where the user should be brought when clicking on this message. See the
|
|
661
|
-
* `ClickAction` enum.
|
|
662
|
-
* @param uri - If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
|
|
663
|
-
* user clicks on this message.
|
|
664
|
-
* @param openTarget - If ```clickAction``` is `ClickAction`.URI, whether to open clicks
|
|
665
|
-
* in a new tab/window. See the `OpenTarget` enum.
|
|
666
|
-
* @param dismissType - How the message is dismissed, via a timer or requiring interaction from the user.
|
|
667
|
-
* See the `DismissType` enum.
|
|
668
|
-
* @param duration - Length of time in milliseconds until auto-dismiss should occur. Only used when
|
|
669
|
-
* dismissType is `DismissType`.AUTO_DISMISS
|
|
670
|
-
* @param icon - A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
|
|
671
|
-
* [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
|
|
672
|
-
* @param imageUrl - Url of an image to include in this message. The message will only display an image *or*
|
|
673
|
-
* an icon, and will prioritize the image if present.
|
|
674
|
-
* @param imageStyle - Whether the image should be shown as normal on the top of the in-app message or used
|
|
675
|
-
* as the entire content of the message. See the `ImageStyle` enum.
|
|
676
|
-
* @param iconColor - Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green).
|
|
677
|
-
* @param iconBackgroundColor - Background color of icon. Hex value with opacity (e.g. 0xff00ff00
|
|
678
|
-
* is opaque green).
|
|
679
|
-
* @param backgroundColor - Background color of entire message. Hex value with opacity (e.g.
|
|
680
|
-
* 0xff00ff00 is opaque green).
|
|
681
|
-
* @param textColor - Text color of message. Hex value with opacity (e.g. 0xff00ff00 is opaque
|
|
682
|
-
* green).
|
|
683
|
-
* @param closeButtonColor - Color of close button. Hex value with opacity (e.g. 0xff00ff00 is
|
|
684
|
-
* opaque green).
|
|
685
|
-
* @param animateIn - Whether to animate the showing of this message.
|
|
686
|
-
* @param animateOut - Whether to animate the hiding of this message.
|
|
687
|
-
* @param header - Header text to
|
|
688
|
-
* @param headerAlignment - How to align header text. See the `TextAlignment` enum.
|
|
689
|
-
* @param headerTextColor - Color of header text. Hex value with opacity (e.g. 0xff00ff00 is
|
|
690
|
-
* opaque green).
|
|
691
|
-
* @param frameColor - Color of the background frame which blocks page interaction while the
|
|
692
|
-
* message is showing.
|
|
693
|
-
* @param buttons - Array of up to two `InAppMessageButton` objects.
|
|
694
|
-
* @param cropType - How to crop and fit images in the allowable space. See the `CropType` enum.
|
|
695
|
-
* @param orientation - Whether to lay out this in-app message as a portrait or landscape. See the
|
|
696
|
-
* `Orientation` enum.
|
|
697
|
-
* @param htmlId - The ID to give the parent HTML element that this message is rendered into.
|
|
698
|
-
* @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
699
|
-
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
700
|
-
*/
|
|
701
|
-
constructor(
|
|
702
|
-
message?: string,
|
|
703
|
-
messageAlignment?: TextAlignment,
|
|
704
|
-
extras?: Record<string, string>,
|
|
705
|
-
triggerId?: string,
|
|
706
|
-
clickAction?: ClickAction,
|
|
707
|
-
uri?: string,
|
|
708
|
-
openTarget?: OpenTarget,
|
|
709
|
-
dismissType?: DismissType,
|
|
710
|
-
duration?: number,
|
|
711
|
-
icon?: string,
|
|
712
|
-
imageUrl?: string,
|
|
713
|
-
imageStyle?: ImageStyle,
|
|
714
|
-
iconColor?: number,
|
|
715
|
-
iconBackgroundColor?: number,
|
|
716
|
-
backgroundColor?: number,
|
|
717
|
-
textColor?: number,
|
|
718
|
-
closeButtonColor?: number,
|
|
719
|
-
animateIn?: boolean,
|
|
720
|
-
animateOut?: boolean,
|
|
721
|
-
header?: string,
|
|
722
|
-
headerAlignment?: TextAlignment,
|
|
723
|
-
headerTextColor?: number,
|
|
724
|
-
frameColor?: number,
|
|
725
|
-
buttons?: InAppMessageButton[],
|
|
726
|
-
cropType?: CropType,
|
|
727
|
-
orientation?: Orientation,
|
|
728
|
-
htmlId?: string,
|
|
729
|
-
css?: string
|
|
730
|
-
);
|
|
731
|
-
|
|
732
|
-
/** How to align message text. See the `TextAlignment` enum. */
|
|
733
|
-
messageAlignment: TextAlignment;
|
|
610
|
+
static DismissType: {
|
|
611
|
+
AUTO_DISMISS: "AUTO_DISMISS";
|
|
612
|
+
MANUAL: "SWIPE";
|
|
613
|
+
};
|
|
734
614
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
clickAction: ClickAction;
|
|
615
|
+
static OpenTarget: {
|
|
616
|
+
NONE: "NONE";
|
|
617
|
+
BLANK: "BLANK";
|
|
618
|
+
};
|
|
740
619
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
uri?: string;
|
|
620
|
+
static ImageStyle: {
|
|
621
|
+
TOP: "TOP";
|
|
622
|
+
GRAPHIC: "GRAPHIC";
|
|
623
|
+
};
|
|
746
624
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
openTarget: OpenTarget;
|
|
625
|
+
static Orientation: {
|
|
626
|
+
PORTRAIT: "PORTRAIT";
|
|
627
|
+
LANDSCAPE: "LANDSCAPE";
|
|
628
|
+
};
|
|
752
629
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
630
|
+
static TextAlignment: {
|
|
631
|
+
START: "START";
|
|
632
|
+
CENTER: "CENTER";
|
|
633
|
+
END: "END";
|
|
634
|
+
};
|
|
758
635
|
|
|
636
|
+
static CropType: {
|
|
759
637
|
/**
|
|
760
|
-
*
|
|
761
|
-
* an icon, and will prioritize the image if present.
|
|
638
|
+
* Centers the image in the available space and crops any overflowing edges.
|
|
762
639
|
*/
|
|
763
|
-
|
|
640
|
+
CENTER_CROP: "CENTER_CROP";
|
|
764
641
|
|
|
765
642
|
/**
|
|
766
|
-
*
|
|
767
|
-
*
|
|
643
|
+
* Fits the image within the available space, causing blank space on the shorter
|
|
644
|
+
* axis (e.g. tall images will have bars of blank space on the left/right)
|
|
768
645
|
*/
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
/** Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
772
|
-
iconColor: number;
|
|
773
|
-
|
|
774
|
-
/** Background color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
775
|
-
iconBackgroundColor: number;
|
|
776
|
-
|
|
777
|
-
/** Background color of entire message. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
778
|
-
backgroundColor: number;
|
|
779
|
-
|
|
780
|
-
/** Text color of message. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
781
|
-
textColor: number;
|
|
782
|
-
|
|
783
|
-
/** Color of close button. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
784
|
-
closeButtonColor: number;
|
|
785
|
-
|
|
786
|
-
/** Header text to */
|
|
787
|
-
header?: string;
|
|
646
|
+
FIT_CENTER: "FIT_CENTER";
|
|
647
|
+
};
|
|
788
648
|
|
|
789
|
-
|
|
790
|
-
|
|
649
|
+
/** The message to display to the user. */
|
|
650
|
+
message?: string;
|
|
791
651
|
|
|
792
|
-
|
|
793
|
-
|
|
652
|
+
/** Object of string/string key/value pairs. */
|
|
653
|
+
extras: Record<string, string>;
|
|
794
654
|
|
|
795
|
-
|
|
796
|
-
|
|
655
|
+
/**
|
|
656
|
+
* The id of the trigger that created this message. The SDK will report back this to
|
|
657
|
+
* Braze with in-app message analytics events.
|
|
658
|
+
*/
|
|
659
|
+
triggerId?: string;
|
|
797
660
|
|
|
798
|
-
|
|
799
|
-
|
|
661
|
+
/**
|
|
662
|
+
* How the message is dismissed, via a timer or requiring interaction from the user.
|
|
663
|
+
* See the `DismissType` enum.
|
|
664
|
+
*/
|
|
665
|
+
dismissType: DismissType;
|
|
800
666
|
|
|
801
|
-
|
|
802
|
-
|
|
667
|
+
/**
|
|
668
|
+
* Length of time in milliseconds until auto-dismiss should occur. Only used when
|
|
669
|
+
* dismissType is `DismissType`.AUTO_DISMISS
|
|
670
|
+
*/
|
|
671
|
+
duration: number;
|
|
803
672
|
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
* `Orientation` enum.
|
|
807
|
-
*/
|
|
808
|
-
orientation: Orientation;
|
|
809
|
-
}
|
|
673
|
+
/** Whether to animate the showing of this message. */
|
|
674
|
+
animateIn: boolean;
|
|
810
675
|
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
* A modal in-app message object which can be passed to `showInAppMessage`
|
|
814
|
-
* or handled manually. Subscribe to be notified when in-app messages are triggered via `subscribeToInAppMessage`
|
|
815
|
-
*
|
|
816
|
-
* @param message - The message to display to the user.
|
|
817
|
-
* @param messageAlignment - How to align message text. See the `TextAlignment` enum.
|
|
818
|
-
* @param extras - Object of string/string key/value pairs.
|
|
819
|
-
* @param triggerId - The id of the trigger that created this message. The SDK will report back this to
|
|
820
|
-
* Braze with in-app message analytics events.
|
|
821
|
-
* @param clickAction - Where the user should be brought when clicking on this message. See the
|
|
822
|
-
* `ClickAction` enum.
|
|
823
|
-
* @param uri - If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
|
|
824
|
-
* user clicks on this message.
|
|
825
|
-
* @param openTarget - If ```clickAction``` is `ClickAction`.URI, whether to open clicks
|
|
826
|
-
* in a new tab/window. See the `OpenTarget` enum.
|
|
827
|
-
* @param dismissType - How the message is dismissed, via a timer or requiring interaction from the user.
|
|
828
|
-
* See the `DismissType` enum.
|
|
829
|
-
* @param duration - Length of time in milliseconds until auto-dismiss should occur. Only used when
|
|
830
|
-
* dismissType is `DismissType`.AUTO_DISMISS
|
|
831
|
-
* @param icon - A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
|
|
832
|
-
* [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
|
|
833
|
-
* @param imageUrl - Url of an image to include in this message. The message will only display an image *or*
|
|
834
|
-
* an icon, and will prioritize the image if present.
|
|
835
|
-
* @param imageStyle - Whether the image should be shown as normal on the top of the in-app message or used
|
|
836
|
-
* as the entire content of the message. See the `ImageStyle` enum.
|
|
837
|
-
* @param iconColor - Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green).
|
|
838
|
-
* @param iconBackgroundColor - Background color of icon. Hex value with opacity (e.g. 0xff00ff00
|
|
839
|
-
* is opaque green).
|
|
840
|
-
* @param backgroundColor - Background color of entire message. Hex value with opacity (e.g.
|
|
841
|
-
* 0xff00ff00 is opaque green).
|
|
842
|
-
* @param textColor - Text color of message. Hex value with opacity (e.g. 0xff00ff00 is opaque
|
|
843
|
-
* green).
|
|
844
|
-
* @param closeButtonColor - Color of close button. Hex value with opacity (e.g. 0xff00ff00 is
|
|
845
|
-
* opaque green).
|
|
846
|
-
* @param animateIn - Whether to animate the showing of this message.
|
|
847
|
-
* @param animateOut - Whether to animate the hiding of this message.
|
|
848
|
-
* @param header - Header text to
|
|
849
|
-
* @param headerAlignment - How to align header text. See the `TextAlignment` enum.
|
|
850
|
-
* @param headerTextColor - Color of header text. Hex value with opacity (e.g. 0xff00ff00 is
|
|
851
|
-
* opaque green).
|
|
852
|
-
* @param frameColor - Color of the background frame which blocks page interaction while the
|
|
853
|
-
* message is showing.
|
|
854
|
-
* @param buttons - Array of up to two`InAppMessageButton` objects.
|
|
855
|
-
* @param cropType - How to crop and fit images in the allowable space. See the `CropType` enum.
|
|
856
|
-
* @param htmlId - The ID to give the parent HTML element that this message is rendered into.
|
|
857
|
-
* @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
858
|
-
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
859
|
-
*/
|
|
860
|
-
constructor(
|
|
861
|
-
message?: string,
|
|
862
|
-
messageAlignment?: TextAlignment,
|
|
863
|
-
extras?: Record<string, string>,
|
|
864
|
-
triggerId?: string,
|
|
865
|
-
clickAction?: ClickAction,
|
|
866
|
-
uri?: string,
|
|
867
|
-
openTarget?: OpenTarget,
|
|
868
|
-
dismissType?: DismissType,
|
|
869
|
-
duration?: number,
|
|
870
|
-
icon?: string,
|
|
871
|
-
imageUrl?: string,
|
|
872
|
-
imageStyle?: ImageStyle,
|
|
873
|
-
iconColor?: number,
|
|
874
|
-
iconBackgroundColor?: number,
|
|
875
|
-
backgroundColor?: number,
|
|
876
|
-
textColor?: number,
|
|
877
|
-
closeButtonColor?: number,
|
|
878
|
-
animateIn?: boolean,
|
|
879
|
-
animateOut?: boolean,
|
|
880
|
-
header?: string,
|
|
881
|
-
headerAlignment?: TextAlignment,
|
|
882
|
-
headerTextColor?: number,
|
|
883
|
-
frameColor?: number,
|
|
884
|
-
buttons?: InAppMessageButton[],
|
|
885
|
-
cropType?: CropType,
|
|
886
|
-
htmlId?: string,
|
|
887
|
-
css?: string
|
|
888
|
-
);
|
|
889
|
-
|
|
890
|
-
/** How to align message text. See the `TextAlignment` enum. */
|
|
891
|
-
messageAlignment: TextAlignment;
|
|
676
|
+
/** Whether to animate the hiding of this message. */
|
|
677
|
+
animateOut: boolean;
|
|
892
678
|
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
* `ClickAction` enum.
|
|
896
|
-
*/
|
|
897
|
-
clickAction: ClickAction;
|
|
679
|
+
/** The ID to give the parent HTML element that this message is rendered into. */
|
|
680
|
+
htmlId?: string;
|
|
898
681
|
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
/**
|
|
906
|
-
* If ```clickAction``` is `ClickAction`.URI, whether to open clicks
|
|
907
|
-
* in a new tab/window. See the `OpenTarget` enum.
|
|
908
|
-
*/
|
|
909
|
-
openTarget: OpenTarget;
|
|
682
|
+
/**
|
|
683
|
+
* Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
684
|
+
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
685
|
+
*/
|
|
686
|
+
css?: string;
|
|
910
687
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
* [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
|
|
914
|
-
*/
|
|
915
|
-
icon?: string;
|
|
688
|
+
/** Whether this message is a ControlMessage. */
|
|
689
|
+
isControl: false;
|
|
916
690
|
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
/**
|
|
924
|
-
* Whether the image should be shown as normal on the top of the in-app message or used
|
|
925
|
-
* as the entire content of the message. See the `ImageStyle` enum.
|
|
926
|
-
*/
|
|
927
|
-
imageStyle: ImageStyle;
|
|
691
|
+
/**
|
|
692
|
+
* Call this method if you wish to programmatically remove the message from the DOM. This method will only
|
|
693
|
+
* work with the Braze UI.
|
|
694
|
+
*/
|
|
695
|
+
closeMessage(): void;
|
|
928
696
|
|
|
929
|
-
|
|
930
|
-
|
|
697
|
+
/** Remove all event subscriptions from this message. */
|
|
698
|
+
removeAllSubscriptions(): void;
|
|
931
699
|
|
|
932
|
-
|
|
933
|
-
|
|
700
|
+
/**
|
|
701
|
+
* Remove an event subscription that you previously subscribed to.
|
|
702
|
+
*
|
|
703
|
+
* @param subscriptionGuid - The identifier of the subscription you wish to remove, returned by the method
|
|
704
|
+
* you initially used to create it.
|
|
705
|
+
*/
|
|
706
|
+
removeSubscription(subscriptionGuid: string): void;
|
|
934
707
|
|
|
935
|
-
|
|
936
|
-
|
|
708
|
+
/**
|
|
709
|
+
* Subscribe to receive click events. The subscriber callback will be called whenever this message is clicked by the
|
|
710
|
+
* user.
|
|
711
|
+
*
|
|
712
|
+
* @param subscriber - The callback function to receive click events. This function will be invoked with
|
|
713
|
+
* no arguments when this message records a click.
|
|
714
|
+
*
|
|
715
|
+
* @returns The identifier of the subscription created. This can be passed to `removeSubscription`
|
|
716
|
+
* to cancel the subscription. Returns null if the subscriber passed is not a function.
|
|
717
|
+
*/
|
|
718
|
+
subscribeToClickedEvent(subscriber: () => void): string | null;
|
|
937
719
|
|
|
938
|
-
|
|
939
|
-
|
|
720
|
+
/**
|
|
721
|
+
* Subscribe to receive dismissed events. The subscriber callback will be called whenever this message is closed
|
|
722
|
+
* by the user, or when it's dismissed automatically (depending on the dismissType).
|
|
723
|
+
*
|
|
724
|
+
* @param subscriber - The callback function to receive dismissed events. This function will be invoked with
|
|
725
|
+
* no arguments when this message records a dismissal.
|
|
726
|
+
*
|
|
727
|
+
* @returns The identifier of the subscription created. This can be passed to `removeSubscription`
|
|
728
|
+
* to cancel the subscription. Returns null if the subscriber passed is not a function.
|
|
729
|
+
*/
|
|
730
|
+
subscribeToDismissedEvent(subscriber: () => void): string | null;
|
|
940
731
|
|
|
941
|
-
/** Color of close button. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
942
|
-
closeButtonColor: number;
|
|
943
732
|
|
|
944
|
-
|
|
945
|
-
header?: string;
|
|
733
|
+
}
|
|
946
734
|
|
|
947
|
-
|
|
948
|
-
|
|
735
|
+
export class FullScreenMessage extends InAppMessage {
|
|
736
|
+
/**
|
|
737
|
+
* A modal in-app message object which can be passed to `showInAppMessage`
|
|
738
|
+
* or handled manually. Subscribe to be notified when in-app messages are triggered via `subscribeToInAppMessage`.
|
|
739
|
+
*
|
|
740
|
+
* @param message - The message to display to the user.
|
|
741
|
+
* @param messageAlignment - How to align message text. See the `TextAlignment` enum.
|
|
742
|
+
* @param extras - Object of string/string key/value pairs.
|
|
743
|
+
* @param triggerId - The id of the trigger that created this message. The SDK will report back this to
|
|
744
|
+
* Braze with in-app message analytics events.
|
|
745
|
+
* @param clickAction - Where the user should be brought when clicking on this message. See the
|
|
746
|
+
* `ClickAction` enum.
|
|
747
|
+
* @param uri - If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
|
|
748
|
+
* user clicks on this message.
|
|
749
|
+
* @param openTarget - If ```clickAction``` is `ClickAction`.URI, whether to open clicks
|
|
750
|
+
* in a new tab/window. See the `OpenTarget` enum.
|
|
751
|
+
* @param dismissType - How the message is dismissed, via a timer or requiring interaction from the user.
|
|
752
|
+
* See the `DismissType` enum.
|
|
753
|
+
* @param duration - Length of time in milliseconds until auto-dismiss should occur. Only used when
|
|
754
|
+
* dismissType is `DismissType`.AUTO_DISMISS
|
|
755
|
+
* @param icon - A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
|
|
756
|
+
* [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
|
|
757
|
+
* @param imageUrl - Url of an image to include in this message. The message will only display an image *or*
|
|
758
|
+
* an icon, and will prioritize the image if present.
|
|
759
|
+
* @param imageStyle - Whether the image should be shown as normal on the top of the in-app message or used
|
|
760
|
+
* as the entire content of the message. See the `ImageStyle` enum.
|
|
761
|
+
* @param iconColor - Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green).
|
|
762
|
+
* @param iconBackgroundColor - Background color of icon. Hex value with opacity (e.g. 0xff00ff00
|
|
763
|
+
* is opaque green).
|
|
764
|
+
* @param backgroundColor - Background color of entire message. Hex value with opacity (e.g.
|
|
765
|
+
* 0xff00ff00 is opaque green).
|
|
766
|
+
* @param textColor - Text color of message. Hex value with opacity (e.g. 0xff00ff00 is opaque
|
|
767
|
+
* green).
|
|
768
|
+
* @param closeButtonColor - Color of close button. Hex value with opacity (e.g. 0xff00ff00 is
|
|
769
|
+
* opaque green).
|
|
770
|
+
* @param animateIn - Whether to animate the showing of this message.
|
|
771
|
+
* @param animateOut - Whether to animate the hiding of this message.
|
|
772
|
+
* @param header - Header text to
|
|
773
|
+
* @param headerAlignment - How to align header text. See the `TextAlignment` enum.
|
|
774
|
+
* @param headerTextColor - Color of header text. Hex value with opacity (e.g. 0xff00ff00 is
|
|
775
|
+
* opaque green).
|
|
776
|
+
* @param frameColor - Color of the background frame which blocks page interaction while the
|
|
777
|
+
* message is showing.
|
|
778
|
+
* @param buttons - Array of up to two `InAppMessageButton` objects.
|
|
779
|
+
* @param cropType - How to crop and fit images in the allowable space. See the `CropType` enum.
|
|
780
|
+
* @param orientation - Whether to lay out this in-app message as a portrait or landscape. See the
|
|
781
|
+
* `Orientation` enum.
|
|
782
|
+
* @param htmlId - The ID to give the parent HTML element that this message is rendered into.
|
|
783
|
+
* @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
784
|
+
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
785
|
+
*/
|
|
786
|
+
constructor(
|
|
787
|
+
message?: string,
|
|
788
|
+
messageAlignment?: TextAlignment,
|
|
789
|
+
extras?: Record<string, string>,
|
|
790
|
+
triggerId?: string,
|
|
791
|
+
clickAction?: ClickAction,
|
|
792
|
+
uri?: string,
|
|
793
|
+
openTarget?: OpenTarget,
|
|
794
|
+
dismissType?: DismissType,
|
|
795
|
+
duration?: number,
|
|
796
|
+
icon?: string,
|
|
797
|
+
imageUrl?: string,
|
|
798
|
+
imageStyle?: ImageStyle,
|
|
799
|
+
iconColor?: number,
|
|
800
|
+
iconBackgroundColor?: number,
|
|
801
|
+
backgroundColor?: number,
|
|
802
|
+
textColor?: number,
|
|
803
|
+
closeButtonColor?: number,
|
|
804
|
+
animateIn?: boolean,
|
|
805
|
+
animateOut?: boolean,
|
|
806
|
+
header?: string,
|
|
807
|
+
headerAlignment?: TextAlignment,
|
|
808
|
+
headerTextColor?: number,
|
|
809
|
+
frameColor?: number,
|
|
810
|
+
buttons?: InAppMessageButton[],
|
|
811
|
+
cropType?: CropType,
|
|
812
|
+
orientation?: Orientation,
|
|
813
|
+
htmlId?: string,
|
|
814
|
+
css?: string,
|
|
815
|
+
);
|
|
816
|
+
|
|
817
|
+
/** How to align message text. See the `TextAlignment` enum. */
|
|
818
|
+
messageAlignment: TextAlignment;
|
|
949
819
|
|
|
950
|
-
|
|
951
|
-
|
|
820
|
+
/**
|
|
821
|
+
* Where the user should be brought when clicking on this message. See the
|
|
822
|
+
* `ClickAction` enum.
|
|
823
|
+
*/
|
|
824
|
+
clickAction: ClickAction;
|
|
952
825
|
|
|
953
|
-
|
|
954
|
-
|
|
826
|
+
/**
|
|
827
|
+
* If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
|
|
828
|
+
* user clicks on this message.
|
|
829
|
+
*/
|
|
830
|
+
uri?: string;
|
|
955
831
|
|
|
956
|
-
|
|
957
|
-
|
|
832
|
+
/**
|
|
833
|
+
* If ```clickAction``` is `ClickAction`.URI, whether to open clicks
|
|
834
|
+
* in a new tab/window. See the `OpenTarget` enum.
|
|
835
|
+
*/
|
|
836
|
+
openTarget: OpenTarget;
|
|
958
837
|
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
838
|
+
/**
|
|
839
|
+
* A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
|
|
840
|
+
* [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
|
|
841
|
+
*/
|
|
842
|
+
icon?: string;
|
|
962
843
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
* @param message - The html content to display to the user.
|
|
969
|
-
* @param extras - Object of string/string key/value pairs.
|
|
970
|
-
* @param triggerId - The id of the trigger that created this message. The SDK will report back this to
|
|
971
|
-
* Braze with in-app message analytics events.
|
|
972
|
-
* @param dismissType - How the message is dismissed, via a timer or requiring interaction from the user.
|
|
973
|
-
* See the `TextAlignment` enum.
|
|
974
|
-
* @param duration - Length of time in milliseconds until auto-dismiss should occur. Only used when
|
|
975
|
-
* dismissType is `DismissType`.AUTO_DISMISS.
|
|
976
|
-
* @param animateIn - Whether to animate the showing of this message.
|
|
977
|
-
* @param animateOut - Whether to animate the hiding of this message.
|
|
978
|
-
* @param frameColor - Color of the background frame which blocks page interaction while the message is showing.
|
|
979
|
-
* @param htmlId - The ID to give the parent HTML element that this message is rendered into.
|
|
980
|
-
* @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
981
|
-
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
982
|
-
* @param messageFields - Structured data provided by the Braze backend.
|
|
983
|
-
*/
|
|
984
|
-
constructor(
|
|
985
|
-
message: string,
|
|
986
|
-
extras?: Record<string, string>,
|
|
987
|
-
triggerId?: string,
|
|
988
|
-
dismissType?: DismissType,
|
|
989
|
-
duration?: number,
|
|
990
|
-
animateIn?: boolean,
|
|
991
|
-
animateOut?: boolean,
|
|
992
|
-
frameColor?: number,
|
|
993
|
-
htmlId?: string,
|
|
994
|
-
css?: string,
|
|
995
|
-
messageFields?: Record<string, any>
|
|
996
|
-
);
|
|
997
|
-
|
|
998
|
-
/** Color of the background frame which blocks page interaction while the message is showing. */
|
|
999
|
-
frameColor: number;
|
|
1000
|
-
|
|
1001
|
-
/** Structured data provided by the Braze backend. */
|
|
1002
|
-
messageFields?: Record<string, any>;
|
|
1003
|
-
}
|
|
844
|
+
/**
|
|
845
|
+
* Url of an image to include in this message. The message will only display an image *or*
|
|
846
|
+
* an icon, and will prioritize the image if present.
|
|
847
|
+
*/
|
|
848
|
+
imageUrl?: string;
|
|
1004
849
|
|
|
1005
850
|
/**
|
|
1006
|
-
*
|
|
1007
|
-
*
|
|
851
|
+
* Whether the image should be shown as normal on the top of the in-app message or used
|
|
852
|
+
* as the entire content of the message. See the `ImageStyle` enum.
|
|
1008
853
|
*/
|
|
1009
|
-
|
|
1010
|
-
/**
|
|
1011
|
-
* A slide-up in-app message object which can be passed to `showInAppMessage`
|
|
1012
|
-
* or handled manually. Subscribe to be notified when in-app messages are triggered via `subscribeToInAppMessage`
|
|
1013
|
-
*
|
|
1014
|
-
* @param message - The message to display to the user.
|
|
1015
|
-
* @param messageAlignment - How to align message text. See the `TextAlignment` enum.
|
|
1016
|
-
* @param slideFrom - Where the message should slide in from. See the `SlideFrom` enum.
|
|
1017
|
-
* @param extras - Object of string/string key/value pairs.
|
|
1018
|
-
* @param triggerId - The id of the trigger that created this message. The SDK will report back this to
|
|
1019
|
-
* Braze with in-app message analytics events.
|
|
1020
|
-
* @param clickAction - Where the user should be brought when clicking on this message. See the
|
|
1021
|
-
* `ClickAction` enum.
|
|
1022
|
-
* @param uri - If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
|
|
1023
|
-
* user clicks on this message.
|
|
1024
|
-
* @param openTarget - If ```clickAction``` is `ClickAction`.URI, whether to open clicks
|
|
1025
|
-
* in a new tab/window. See the `OpenTarget` enum.
|
|
1026
|
-
* @param dismissType - How the message is dismissed, via a timer or requiring interaction from the user.
|
|
1027
|
-
* See the `DismissType` enum.
|
|
1028
|
-
* @param duration - Length of time in milliseconds until auto-dismiss should occur. Only used when
|
|
1029
|
-
* dismissType is `DismissType`.AUTO_DISMISS
|
|
1030
|
-
* @param icon - A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
|
|
1031
|
-
* [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
|
|
1032
|
-
* @param imageUrl - Url of an image to include in this message. The message will only display an image *or*
|
|
1033
|
-
* an icon, and will prioritize the image if present.
|
|
1034
|
-
* @param iconColor - Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green).
|
|
1035
|
-
* @param iconBackgroundColor - Background color of icon. Hex value with opacity (e.g. 0xff00ff00
|
|
1036
|
-
* is opaque green).
|
|
1037
|
-
* @param backgroundColor - Background color of entire message. Hex value with opacity (e.g.
|
|
1038
|
-
* 0xff00ff00 is opaque green).
|
|
1039
|
-
* @param textColor - Text color of message. Hex value with opacity (e.g. 0xff00ff00 is opaque
|
|
1040
|
-
* green).
|
|
1041
|
-
* @param closeButtonColor - Color of close button. Hex value with opacity (e.g. 0xff00ff00 is
|
|
1042
|
-
* opaque green).
|
|
1043
|
-
* @param animateIn - Whether to animate the showing of this message.
|
|
1044
|
-
* @param animateOut - Whether to animate the hiding of this message.
|
|
1045
|
-
* @param htmlId - The ID to give the parent HTML element that this message is rendered into.
|
|
1046
|
-
* @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
1047
|
-
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
1048
|
-
*/
|
|
1049
|
-
constructor(
|
|
1050
|
-
message: string,
|
|
1051
|
-
messageAlignment?: TextAlignment,
|
|
1052
|
-
slideFrom?: SlideFrom,
|
|
1053
|
-
extras?: Record<string, string>,
|
|
1054
|
-
triggerId?: string,
|
|
1055
|
-
clickAction?: ClickAction,
|
|
1056
|
-
uri?: string,
|
|
1057
|
-
openTarget?: OpenTarget,
|
|
1058
|
-
dismissType?: DismissType,
|
|
1059
|
-
duration?: number,
|
|
1060
|
-
icon?: string,
|
|
1061
|
-
imageUrl?: string,
|
|
1062
|
-
iconColor?: number,
|
|
1063
|
-
iconBackgroundColor?: number,
|
|
1064
|
-
backgroundColor?: number,
|
|
1065
|
-
textColor?: number,
|
|
1066
|
-
closeButtonColor?: number,
|
|
1067
|
-
animateIn?: boolean,
|
|
1068
|
-
animateOut?: boolean,
|
|
1069
|
-
htmlId?: string,
|
|
1070
|
-
css?: string
|
|
1071
|
-
);
|
|
1072
|
-
|
|
1073
|
-
/** How to align message text. See the `TextAlignment` enum. */
|
|
1074
|
-
messageAlignment: TextAlignment;
|
|
1075
|
-
|
|
1076
|
-
/** Where the message should slide in from. See the `SlideFrom` enum. */
|
|
1077
|
-
slideFrom: SlideFrom;
|
|
854
|
+
imageStyle: ImageStyle;
|
|
1078
855
|
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
* `ClickAction` enum.
|
|
1082
|
-
*/
|
|
1083
|
-
clickAction: ClickAction;
|
|
856
|
+
/** Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
857
|
+
iconColor: number;
|
|
1084
858
|
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
* user clicks on this message.
|
|
1088
|
-
*/
|
|
1089
|
-
uri?: string;
|
|
859
|
+
/** Background color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
860
|
+
iconBackgroundColor: number;
|
|
1090
861
|
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
* in a new tab/window. See the `OpenTarget` enum.
|
|
1094
|
-
*/
|
|
1095
|
-
openTarget: OpenTarget;
|
|
862
|
+
/** Background color of entire message. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
863
|
+
backgroundColor: number;
|
|
1096
864
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
* [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
|
|
1100
|
-
*/
|
|
1101
|
-
icon?: string;
|
|
865
|
+
/** Text color of message. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
866
|
+
textColor: number;
|
|
1102
867
|
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
* an icon, and will prioritize the image if present.
|
|
1106
|
-
*/
|
|
1107
|
-
imageUrl?: string;
|
|
868
|
+
/** Color of close button. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
869
|
+
closeButtonColor: number;
|
|
1108
870
|
|
|
1109
|
-
|
|
1110
|
-
|
|
871
|
+
/** Header text to */
|
|
872
|
+
header?: string;
|
|
1111
873
|
|
|
1112
|
-
|
|
1113
|
-
|
|
874
|
+
/** How to align header text. See the `TextAlignment` enum. */
|
|
875
|
+
headerAlignment: TextAlignment;
|
|
1114
876
|
|
|
1115
|
-
|
|
1116
|
-
|
|
877
|
+
/** Color of header text. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
878
|
+
headerTextColor: number;
|
|
1117
879
|
|
|
1118
|
-
|
|
1119
|
-
|
|
880
|
+
/** Color of the background frame which blocks page interaction while the message is showing. */
|
|
881
|
+
frameColor: number;
|
|
1120
882
|
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
}
|
|
883
|
+
/** Array of up to two `InAppMessageButton` objects. */
|
|
884
|
+
buttons: InAppMessageButton[];
|
|
1124
885
|
|
|
1125
|
-
|
|
1126
|
-
|
|
886
|
+
/** How to crop and fit images in the allowable space. See the `CropType` enum. */
|
|
887
|
+
cropType: CropType;
|
|
1127
888
|
|
|
1128
|
-
|
|
1129
|
-
|
|
889
|
+
/**
|
|
890
|
+
* Whether to lay out this in-app message as a portrait or landscape. See the
|
|
891
|
+
* `Orientation` enum.
|
|
892
|
+
*/
|
|
893
|
+
orientation: Orientation;
|
|
894
|
+
}
|
|
1130
895
|
|
|
896
|
+
export class ModalMessage extends InAppMessage {
|
|
1131
897
|
/**
|
|
1132
|
-
*
|
|
1133
|
-
*
|
|
898
|
+
* A modal in-app message object which can be passed to `showInAppMessage`
|
|
899
|
+
* or handled manually. Subscribe to be notified when in-app messages are triggered via `subscribeToInAppMessage`
|
|
1134
900
|
*
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
901
|
+
* @param message - The message to display to the user.
|
|
902
|
+
* @param messageAlignment - How to align message text. See the `TextAlignment` enum.
|
|
903
|
+
* @param extras - Object of string/string key/value pairs.
|
|
904
|
+
* @param triggerId - The id of the trigger that created this message. The SDK will report back this to
|
|
905
|
+
* Braze with in-app message analytics events.
|
|
906
|
+
* @param clickAction - Where the user should be brought when clicking on this message. See the
|
|
907
|
+
* `ClickAction` enum.
|
|
908
|
+
* @param uri - If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
|
|
909
|
+
* user clicks on this message.
|
|
910
|
+
* @param openTarget - If ```clickAction``` is `ClickAction`.URI, whether to open clicks
|
|
911
|
+
* in a new tab/window. See the `OpenTarget` enum.
|
|
912
|
+
* @param dismissType - How the message is dismissed, via a timer or requiring interaction from the user.
|
|
913
|
+
* See the `DismissType` enum.
|
|
914
|
+
* @param duration - Length of time in milliseconds until auto-dismiss should occur. Only used when
|
|
915
|
+
* dismissType is `DismissType`.AUTO_DISMISS
|
|
916
|
+
* @param icon - A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
|
|
917
|
+
* [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
|
|
918
|
+
* @param imageUrl - Url of an image to include in this message. The message will only display an image *or*
|
|
919
|
+
* an icon, and will prioritize the image if present.
|
|
920
|
+
* @param imageStyle - Whether the image should be shown as normal on the top of the in-app message or used
|
|
921
|
+
* as the entire content of the message. See the `ImageStyle` enum.
|
|
922
|
+
* @param iconColor - Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green).
|
|
923
|
+
* @param iconBackgroundColor - Background color of icon. Hex value with opacity (e.g. 0xff00ff00
|
|
924
|
+
* is opaque green).
|
|
925
|
+
* @param backgroundColor - Background color of entire message. Hex value with opacity (e.g.
|
|
926
|
+
* 0xff00ff00 is opaque green).
|
|
927
|
+
* @param textColor - Text color of message. Hex value with opacity (e.g. 0xff00ff00 is opaque
|
|
928
|
+
* green).
|
|
929
|
+
* @param closeButtonColor - Color of close button. Hex value with opacity (e.g. 0xff00ff00 is
|
|
930
|
+
* opaque green).
|
|
931
|
+
* @param animateIn - Whether to animate the showing of this message.
|
|
932
|
+
* @param animateOut - Whether to animate the hiding of this message.
|
|
933
|
+
* @param header - Header text to
|
|
934
|
+
* @param headerAlignment - How to align header text. See the `TextAlignment` enum.
|
|
935
|
+
* @param headerTextColor - Color of header text. Hex value with opacity (e.g. 0xff00ff00 is
|
|
936
|
+
* opaque green).
|
|
937
|
+
* @param frameColor - Color of the background frame which blocks page interaction while the
|
|
938
|
+
* message is showing.
|
|
939
|
+
* @param buttons - Array of up to two`InAppMessageButton` objects.
|
|
940
|
+
* @param cropType - How to crop and fit images in the allowable space. See the `CropType` enum.
|
|
941
|
+
* @param htmlId - The ID to give the parent HTML element that this message is rendered into.
|
|
942
|
+
* @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
943
|
+
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
1138
944
|
*/
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
*
|
|
1172
|
-
* @param key - The identifier of the custom attribute. Limited to 255 characters in length, cannot begin with
|
|
1173
|
-
* a $, and can only contain alphanumeric characters and punctuation.
|
|
1174
|
-
* @param value - The string to be added to the array. Strings are limited to 255 characters in length, cannot
|
|
1175
|
-
* begin with a $, and can only contain alphanumeric characters and punctuation.
|
|
1176
|
-
*
|
|
1177
|
-
* @returns Whether the update was successfully enqueued.
|
|
1178
|
-
*/
|
|
1179
|
-
addToCustomAttributeArray(key: string, value: string): boolean;
|
|
1180
|
-
|
|
1181
|
-
/**
|
|
1182
|
-
* Adds a user to an email or SMS subscription group.
|
|
1183
|
-
*
|
|
1184
|
-
* @param subscriptionGroupId - The unique identifier of the subscription group.
|
|
1185
|
-
*
|
|
1186
|
-
* @returns Whether the update was successfully enqueued.
|
|
1187
|
-
*/
|
|
1188
|
-
addToSubscriptionGroup(subscriptionGroupId: string): boolean;
|
|
1189
|
-
|
|
1190
|
-
/**
|
|
1191
|
-
* Asynchronously retrieves the current user's id, or null if the user is anonymous / has not been identified.
|
|
1192
|
-
* For example:
|
|
1193
|
-
*
|
|
1194
|
-
* ```
|
|
1195
|
-
* braze.getUser().getUserId(function(userId) {
|
|
1196
|
-
* console.log('The user is ' + userId);
|
|
1197
|
-
* });
|
|
1198
|
-
* ```
|
|
1199
|
-
*
|
|
1200
|
-
* @param callback - Asynchronous callback - this will be invoked with the userId.
|
|
1201
|
-
*/
|
|
1202
|
-
getUserId(callback: (userId: string | null) => void): void;
|
|
1203
|
-
|
|
1204
|
-
/**
|
|
1205
|
-
* Increment/decrement the value of a custom attribute. Only numeric custom attributes
|
|
1206
|
-
* can be incremented. Attempts to increment a custom attribute that is not numeric
|
|
1207
|
-
* will be ignored. If you increment a custom attribute that has not previously been
|
|
1208
|
-
* set, a custom attribute will be created and assigned the value of incrementValue.
|
|
1209
|
-
* To decrement the value of a custom attribute, use a negative incrementValue.
|
|
1210
|
-
*
|
|
1211
|
-
* @param key - The identifier of the custom attribute. Limited to 255 characters in length, cannot begin with
|
|
1212
|
-
* a $, and can only contain alphanumeric characters and punctuation.
|
|
1213
|
-
* @param incrementValue - Default 1. May be negative to decrement.
|
|
1214
|
-
*
|
|
1215
|
-
* @returns Whether the update was successfully enqueued.
|
|
1216
|
-
*/
|
|
1217
|
-
incrementCustomUserAttribute(key: string, incrementValue?: number): boolean;
|
|
1218
|
-
|
|
1219
|
-
/**
|
|
1220
|
-
* Removes a string from a custom attribute string array.
|
|
1221
|
-
*
|
|
1222
|
-
* @param key - The identifier of the custom attribute. Limited to 255 characters in length, cannot begin with
|
|
1223
|
-
* a $, and can only contain alphanumeric characters and punctuation.
|
|
1224
|
-
* @param value - The string to be removed from the array. Strings are limited to 255 characters in length,
|
|
1225
|
-
* cannot begin with a $, and can only contain alphanumeric characters and punctuation.
|
|
1226
|
-
*
|
|
1227
|
-
* @returns Whether the update was successfully enqueued.
|
|
1228
|
-
*/
|
|
1229
|
-
removeFromCustomAttributeArray(key: string, value: string): boolean;
|
|
945
|
+
constructor(
|
|
946
|
+
message?: string,
|
|
947
|
+
messageAlignment?: TextAlignment,
|
|
948
|
+
extras?: Record<string, string>,
|
|
949
|
+
triggerId?: string,
|
|
950
|
+
clickAction?: ClickAction,
|
|
951
|
+
uri?: string,
|
|
952
|
+
openTarget?: OpenTarget,
|
|
953
|
+
dismissType?: DismissType,
|
|
954
|
+
duration?: number,
|
|
955
|
+
icon?: string,
|
|
956
|
+
imageUrl?: string,
|
|
957
|
+
imageStyle?: ImageStyle,
|
|
958
|
+
iconColor?: number,
|
|
959
|
+
iconBackgroundColor?: number,
|
|
960
|
+
backgroundColor?: number,
|
|
961
|
+
textColor?: number,
|
|
962
|
+
closeButtonColor?: number,
|
|
963
|
+
animateIn?: boolean,
|
|
964
|
+
animateOut?: boolean,
|
|
965
|
+
header?: string,
|
|
966
|
+
headerAlignment?: TextAlignment,
|
|
967
|
+
headerTextColor?: number,
|
|
968
|
+
frameColor?: number,
|
|
969
|
+
buttons?: InAppMessageButton[],
|
|
970
|
+
cropType?: CropType,
|
|
971
|
+
htmlId?: string,
|
|
972
|
+
css?: string,
|
|
973
|
+
);
|
|
974
|
+
|
|
975
|
+
/** How to align message text. See the `TextAlignment` enum. */
|
|
976
|
+
messageAlignment: TextAlignment;
|
|
1230
977
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
* @returns Whether the update was successfully enqueued.
|
|
1237
|
-
*/
|
|
1238
|
-
removeFromSubscriptionGroup(subscriptionGroupId: string): boolean;
|
|
978
|
+
/**
|
|
979
|
+
* Where the user should be brought when clicking on this message. See the
|
|
980
|
+
* `ClickAction` enum.
|
|
981
|
+
*/
|
|
982
|
+
clickAction: ClickAction;
|
|
1239
983
|
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
* @returns Whether the update was successfully enqueued.
|
|
1246
|
-
*/
|
|
1247
|
-
setCountry(country: string | null): boolean;
|
|
984
|
+
/**
|
|
985
|
+
* If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
|
|
986
|
+
* user clicks on this message.
|
|
987
|
+
*/
|
|
988
|
+
uri?: string;
|
|
1248
989
|
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
* @param latitude - The latitude of the user's location in (valid values are between -90 to 90 degrees). Passing a null
|
|
1255
|
-
* value for both latitude and longitude will remove this custom attribute from the user.
|
|
1256
|
-
* @param longitude - The longitude of the user's location (valid values are between -180 to 180 degrees). Passing a null
|
|
1257
|
-
* value for both latitude and longitude will remove this custom attribute from the user.
|
|
1258
|
-
*
|
|
1259
|
-
* @returns Whether the update was successfully enqueued.
|
|
1260
|
-
*/
|
|
1261
|
-
setCustomLocationAttribute(
|
|
1262
|
-
key: string,
|
|
1263
|
-
latitude: number | null,
|
|
1264
|
-
longitude: number | null
|
|
1265
|
-
): boolean;
|
|
990
|
+
/**
|
|
991
|
+
* If ```clickAction``` is `ClickAction`.URI, whether to open clicks
|
|
992
|
+
* in a new tab/window. See the `OpenTarget` enum.
|
|
993
|
+
*/
|
|
994
|
+
openTarget: OpenTarget;
|
|
1266
995
|
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
* a $, and can only contain alphanumeric characters and punctuation.
|
|
1273
|
-
* @param value - Can be numeric, boolean, a Date object, a string, or an array of strings. Strings are limited to
|
|
1274
|
-
* 255 characters in length, cannot begin with a $, and can only contain alphanumeric characters and punctuation.
|
|
1275
|
-
* Passing a null value will remove this custom attribute from the user.
|
|
1276
|
-
* @param merge - Whether the value should be merged with the existing value on the backend. If `false` (default), any existing
|
|
1277
|
-
* attribute will be overwritten. If `true`, existing objects and arrays of objects will be merged. To update an array of objects,
|
|
1278
|
-
* follow the guidelines in our
|
|
1279
|
-
* [public docs](https://www.braze.com/docs/user_guide/data_and_analytics/custom_data/custom_attributes/array_of_objects/#usage-examples).
|
|
1280
|
-
*
|
|
1281
|
-
* @returns {boolean} Whether the update was successfully enqueued.
|
|
1282
|
-
*/
|
|
1283
|
-
setCustomUserAttribute(
|
|
1284
|
-
key: string,
|
|
1285
|
-
value: number | boolean | Date | string | string[] | object | object[] | null,
|
|
1286
|
-
merge?: boolean
|
|
1287
|
-
): boolean;
|
|
996
|
+
/**
|
|
997
|
+
* A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
|
|
998
|
+
* [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
|
|
999
|
+
*/
|
|
1000
|
+
icon?: string;
|
|
1288
1001
|
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
* @param month - 1-12
|
|
1295
|
-
* @param day
|
|
1296
|
-
*
|
|
1297
|
-
* @returns Whether the update was successfully enqueued.
|
|
1298
|
-
*/
|
|
1299
|
-
setDateOfBirth(
|
|
1300
|
-
year: number | null,
|
|
1301
|
-
month: number | null,
|
|
1302
|
-
day: number | null
|
|
1303
|
-
): boolean;
|
|
1002
|
+
/**
|
|
1003
|
+
* Url of an image to include in this message. The message will only display an image *or*
|
|
1004
|
+
* an icon, and will prioritize the image if present.
|
|
1005
|
+
*/
|
|
1006
|
+
imageUrl?: string;
|
|
1304
1007
|
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
*
|
|
1311
|
-
* @returns Whether the update was successfully enqueued.
|
|
1312
|
-
*/
|
|
1313
|
-
setEmail(email: string | null): boolean;
|
|
1008
|
+
/**
|
|
1009
|
+
* Whether the image should be shown as normal on the top of the in-app message or used
|
|
1010
|
+
* as the entire content of the message. See the `ImageStyle` enum.
|
|
1011
|
+
*/
|
|
1012
|
+
imageStyle: ImageStyle;
|
|
1314
1013
|
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
*
|
|
1318
|
-
* @param notificationSubscriptionType - Notification setting (explicitly opted-in, subscribed, or unsubscribed).
|
|
1319
|
-
* See the `NotificationSubscriptionTypes` enum.
|
|
1320
|
-
*
|
|
1321
|
-
* @returns Whether the update was successfully enqueued.
|
|
1322
|
-
*/
|
|
1323
|
-
setEmailNotificationSubscriptionType(
|
|
1324
|
-
notificationSubscriptionType: NotificationSubscriptionTypes
|
|
1325
|
-
): boolean;
|
|
1014
|
+
/** Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
1015
|
+
iconColor: number;
|
|
1326
1016
|
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
*
|
|
1330
|
-
* @param firstName - Limited to 255 characters in length. Accepts an explicit null value to null out attribute.
|
|
1331
|
-
*
|
|
1332
|
-
* @returns Whether the update was successfully enqueued.
|
|
1333
|
-
*/
|
|
1334
|
-
setFirstName(firstName: string | null): boolean;
|
|
1017
|
+
/** Background color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
1018
|
+
iconBackgroundColor: number;
|
|
1335
1019
|
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
*
|
|
1339
|
-
* @param gender - Generally 'm' or 'f'. Accepts an explicit null value to null out attribute. Use `Genders`
|
|
1340
|
-
* enum when setting this value.
|
|
1341
|
-
*
|
|
1342
|
-
* @returns Whether the update was successfully enqueued.
|
|
1343
|
-
*/
|
|
1344
|
-
setGender(gender: Genders | null): boolean;
|
|
1020
|
+
/** Background color of entire message. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
1021
|
+
backgroundColor: number;
|
|
1345
1022
|
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
*
|
|
1349
|
-
* @param homeCity - Limited to 255 characters in length. Accepts an explicit null value to null out attribute.
|
|
1350
|
-
*
|
|
1351
|
-
* @returns Whether the update was successfully enqueued.
|
|
1352
|
-
*/
|
|
1353
|
-
setHomeCity(homeCity: string | null): boolean;
|
|
1023
|
+
/** Text color of message. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
1024
|
+
textColor: number;
|
|
1354
1025
|
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
* from the browser. If you call this method, Braze will ignore the detected language and use
|
|
1358
|
-
* the language you have provided instead.
|
|
1359
|
-
*
|
|
1360
|
-
* @param language - An [ISO 639-1 Language Code](https://www.w3schools.com/tags/ref_language_codes.asp).
|
|
1361
|
-
* Accepts an explicit null value to null out attribute.
|
|
1362
|
-
*
|
|
1363
|
-
* @returns {boolean} Whether the update was successfully enqueued.
|
|
1364
|
-
*/
|
|
1365
|
-
setLanguage(language: string | null): boolean;
|
|
1026
|
+
/** Color of close button. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
1027
|
+
closeButtonColor: number;
|
|
1366
1028
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
*
|
|
1370
|
-
* @param latitude - The latitude of the user's location in (valid values are between -90 to 90 degrees)
|
|
1371
|
-
* @param longitude - The longitude of the user's location (valid values are between -180 to 180 degrees)
|
|
1372
|
-
* @param accuracy - The accuracy of the user's lat/long in meters.
|
|
1373
|
-
* @param altitude - The altitude of the user's location in meters above or below the WGS 84 reference
|
|
1374
|
-
* ellipsoid.
|
|
1375
|
-
* @param altitudeAccuracy - The accuracy of the user's altitude in meters.
|
|
1376
|
-
*
|
|
1377
|
-
* @returns Whether the update was successfully enqueued.
|
|
1378
|
-
*/
|
|
1379
|
-
setLastKnownLocation(
|
|
1380
|
-
latitude: number,
|
|
1381
|
-
longitude: number,
|
|
1382
|
-
accuracy?: number,
|
|
1383
|
-
altitude?: number,
|
|
1384
|
-
altitudeAccuracy?: number
|
|
1385
|
-
): boolean;
|
|
1029
|
+
/** Header text to */
|
|
1030
|
+
header?: string;
|
|
1386
1031
|
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
*
|
|
1390
|
-
* @param lastName - Limited to 255 characters in length. Accepts an explicit null value to null out attribute.
|
|
1391
|
-
*
|
|
1392
|
-
* @returns Whether the update was successfully enqueued.
|
|
1393
|
-
*/
|
|
1394
|
-
setLastName(lastName: string | null): boolean;
|
|
1032
|
+
/** How to align header text. See the `TextAlignment` enum. */
|
|
1033
|
+
headerAlignment: TextAlignment;
|
|
1395
1034
|
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
*
|
|
1399
|
-
* @param phoneNumber - A phone number is considered valid if it is no more than 255 characters in length and
|
|
1400
|
-
* contains only numbers, whitespace, and the following special characters +.-() Accepts an explicit null value to
|
|
1401
|
-
* null out attribute.
|
|
1402
|
-
*
|
|
1403
|
-
* @returns Whether the update was successfully enqueued.
|
|
1404
|
-
*/
|
|
1405
|
-
setPhoneNumber(phoneNumber: string | null): boolean;
|
|
1035
|
+
/** Color of header text. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
1036
|
+
headerTextColor: number;
|
|
1406
1037
|
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
*
|
|
1410
|
-
* @param notificationSubscriptionType - Notification setting (explicitly opted-in, subscribed, or unsubscribed).
|
|
1411
|
-
* See the `NotificationSubscriptionTypes` enum.
|
|
1412
|
-
*
|
|
1413
|
-
* @returns Whether the update was successfully enqueued.
|
|
1414
|
-
*/
|
|
1415
|
-
setPushNotificationSubscriptionType(
|
|
1416
|
-
notificationSubscriptionType: NotificationSubscriptionTypes
|
|
1417
|
-
): boolean;
|
|
1418
|
-
}
|
|
1038
|
+
/** Color of the background frame which blocks page interaction while the message is showing. */
|
|
1039
|
+
frameColor: number;
|
|
1419
1040
|
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
* Represents a button on an `ModalMessage` or `FullScreenMessage`.
|
|
1423
|
-
*
|
|
1424
|
-
* @param text - The text to display on this button
|
|
1425
|
-
* @param backgroundColor - The background color for this button. Hex value with opacity (e.g.
|
|
1426
|
-
* 0xff00ff00 is opaque green).
|
|
1427
|
-
* @param textColor - The color for the text of this button. Hex value with opacity (e.g.
|
|
1428
|
-
* 0xff00ff00 is opaque green).
|
|
1429
|
-
* @param borderColor - The color for the border of this button. Hex value with opacity (e.g.
|
|
1430
|
-
* 0xff00ff00 is opaque green).
|
|
1431
|
-
* @param clickAction - Where the user should be brought when clicking on this button. See the
|
|
1432
|
-
* `ClickAction` enum.
|
|
1433
|
-
* @param uri - If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
|
|
1434
|
-
* user clicks on this button.
|
|
1435
|
-
* @param id - The id for this button. Used for analytics.
|
|
1436
|
-
*/
|
|
1437
|
-
constructor(
|
|
1438
|
-
text: string,
|
|
1439
|
-
backgroundColor?: number,
|
|
1440
|
-
textColor?: number,
|
|
1441
|
-
borderColor?: number,
|
|
1442
|
-
clickAction?: ClickAction,
|
|
1443
|
-
uri?: string,
|
|
1444
|
-
id?: number
|
|
1445
|
-
);
|
|
1446
|
-
|
|
1447
|
-
/** The text to display on this button */
|
|
1448
|
-
text: string;
|
|
1041
|
+
/** Array of up to two`InAppMessageButton` objects. */
|
|
1042
|
+
buttons: InAppMessageButton[];
|
|
1449
1043
|
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
*/
|
|
1454
|
-
backgroundColor: number;
|
|
1044
|
+
/** How to crop and fit images in the allowable space. See the `CropType` enum. */
|
|
1045
|
+
cropType: CropType;
|
|
1046
|
+
}
|
|
1455
1047
|
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1048
|
+
export class HtmlMessage extends InAppMessage {
|
|
1049
|
+
/**
|
|
1050
|
+
* An html-content in-app message object which can be passed to `showInAppMessage`
|
|
1051
|
+
* or handled manually. Subscribe to be notified when in-app messages are triggered via `subscribeToInAppMessage`
|
|
1052
|
+
*
|
|
1053
|
+
* @param message - The html content to display to the user.
|
|
1054
|
+
* @param extras - Object of string/string key/value pairs.
|
|
1055
|
+
* @param triggerId - The id of the trigger that created this message. The SDK will report back this to
|
|
1056
|
+
* Braze with in-app message analytics events.
|
|
1057
|
+
* @param dismissType - How the message is dismissed, via a timer or requiring interaction from the user.
|
|
1058
|
+
* See the `TextAlignment` enum.
|
|
1059
|
+
* @param duration - Length of time in milliseconds until auto-dismiss should occur. Only used when
|
|
1060
|
+
* dismissType is `DismissType`.AUTO_DISMISS.
|
|
1061
|
+
* @param animateIn - Whether to animate the showing of this message.
|
|
1062
|
+
* @param animateOut - Whether to animate the hiding of this message.
|
|
1063
|
+
* @param frameColor - Color of the background frame which blocks page interaction while the message is showing.
|
|
1064
|
+
* @param htmlId - The ID to give the parent HTML element that this message is rendered into.
|
|
1065
|
+
* @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
1066
|
+
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
1067
|
+
* @param messageFields - Structured data provided by the Braze backend.
|
|
1068
|
+
*/
|
|
1069
|
+
constructor(
|
|
1070
|
+
message: string,
|
|
1071
|
+
extras?: Record<string, string>,
|
|
1072
|
+
triggerId?: string,
|
|
1073
|
+
dismissType?: DismissType,
|
|
1074
|
+
duration?: number,
|
|
1075
|
+
animateIn?: boolean,
|
|
1076
|
+
animateOut?: boolean,
|
|
1077
|
+
frameColor?: number,
|
|
1078
|
+
htmlId?: string,
|
|
1079
|
+
css?: string,
|
|
1080
|
+
messageFields?: Record<string, any>,
|
|
1081
|
+
);
|
|
1082
|
+
|
|
1083
|
+
/** Color of the background frame which blocks page interaction while the message is showing. */
|
|
1084
|
+
frameColor: number;
|
|
1085
|
+
|
|
1086
|
+
/** Structured data provided by the Braze backend. */
|
|
1087
|
+
messageFields?: Record<string, any>;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* A slide-up in-app message object which can be passed to `showInAppMessage`
|
|
1092
|
+
* or handled manually. Subscribe to be notified when in-app messages are triggered via `subscribeToInAppMessage`
|
|
1093
|
+
*/
|
|
1094
|
+
export class SlideUpMessage extends InAppMessage {
|
|
1095
|
+
/**
|
|
1096
|
+
* A slide-up in-app message object which can be passed to `showInAppMessage`
|
|
1097
|
+
* or handled manually. Subscribe to be notified when in-app messages are triggered via `subscribeToInAppMessage`
|
|
1098
|
+
*
|
|
1099
|
+
* @param message - The message to display to the user.
|
|
1100
|
+
* @param messageAlignment - How to align message text. See the `TextAlignment` enum.
|
|
1101
|
+
* @param slideFrom - Where the message should slide in from. See the `SlideFrom` enum.
|
|
1102
|
+
* @param extras - Object of string/string key/value pairs.
|
|
1103
|
+
* @param triggerId - The id of the trigger that created this message. The SDK will report back this to
|
|
1104
|
+
* Braze with in-app message analytics events.
|
|
1105
|
+
* @param clickAction - Where the user should be brought when clicking on this message. See the
|
|
1106
|
+
* `ClickAction` enum.
|
|
1107
|
+
* @param uri - If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
|
|
1108
|
+
* user clicks on this message.
|
|
1109
|
+
* @param openTarget - If ```clickAction``` is `ClickAction`.URI, whether to open clicks
|
|
1110
|
+
* in a new tab/window. See the `OpenTarget` enum.
|
|
1111
|
+
* @param dismissType - How the message is dismissed, via a timer or requiring interaction from the user.
|
|
1112
|
+
* See the `DismissType` enum.
|
|
1113
|
+
* @param duration - Length of time in milliseconds until auto-dismiss should occur. Only used when
|
|
1114
|
+
* dismissType is `DismissType`.AUTO_DISMISS
|
|
1115
|
+
* @param icon - A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
|
|
1116
|
+
* [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
|
|
1117
|
+
* @param imageUrl - Url of an image to include in this message. The message will only display an image *or*
|
|
1118
|
+
* an icon, and will prioritize the image if present.
|
|
1119
|
+
* @param iconColor - Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green).
|
|
1120
|
+
* @param iconBackgroundColor - Background color of icon. Hex value with opacity (e.g. 0xff00ff00
|
|
1121
|
+
* is opaque green).
|
|
1122
|
+
* @param backgroundColor - Background color of entire message. Hex value with opacity (e.g.
|
|
1123
|
+
* 0xff00ff00 is opaque green).
|
|
1124
|
+
* @param textColor - Text color of message. Hex value with opacity (e.g. 0xff00ff00 is opaque
|
|
1125
|
+
* green).
|
|
1126
|
+
* @param closeButtonColor - Color of close button. Hex value with opacity (e.g. 0xff00ff00 is
|
|
1127
|
+
* opaque green).
|
|
1128
|
+
* @param animateIn - Whether to animate the showing of this message.
|
|
1129
|
+
* @param animateOut - Whether to animate the hiding of this message.
|
|
1130
|
+
* @param htmlId - The ID to give the parent HTML element that this message is rendered into.
|
|
1131
|
+
* @param css - Custom CSS to apply to the page while this element is shown. All selectors should be scoped
|
|
1132
|
+
* to the htmlId of this message to prevent restyling elements outside of the message when it is shown.
|
|
1133
|
+
*/
|
|
1134
|
+
constructor(
|
|
1135
|
+
message: string,
|
|
1136
|
+
messageAlignment?: TextAlignment,
|
|
1137
|
+
slideFrom?: SlideFrom,
|
|
1138
|
+
extras?: Record<string, string>,
|
|
1139
|
+
triggerId?: string,
|
|
1140
|
+
clickAction?: ClickAction,
|
|
1141
|
+
uri?: string,
|
|
1142
|
+
openTarget?: OpenTarget,
|
|
1143
|
+
dismissType?: DismissType,
|
|
1144
|
+
duration?: number,
|
|
1145
|
+
icon?: string,
|
|
1146
|
+
imageUrl?: string,
|
|
1147
|
+
iconColor?: number,
|
|
1148
|
+
iconBackgroundColor?: number,
|
|
1149
|
+
backgroundColor?: number,
|
|
1150
|
+
textColor?: number,
|
|
1151
|
+
closeButtonColor?: number,
|
|
1152
|
+
animateIn?: boolean,
|
|
1153
|
+
animateOut?: boolean,
|
|
1154
|
+
htmlId?: string,
|
|
1155
|
+
css?: string,
|
|
1156
|
+
);
|
|
1157
|
+
|
|
1158
|
+
/** How to align message text. See the `TextAlignment` enum. */
|
|
1159
|
+
messageAlignment: TextAlignment;
|
|
1160
|
+
|
|
1161
|
+
/** Where the message should slide in from. See the `SlideFrom` enum. */
|
|
1162
|
+
slideFrom: SlideFrom;
|
|
1461
1163
|
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1164
|
+
/**
|
|
1165
|
+
* Where the user should be brought when clicking on this message. See the
|
|
1166
|
+
* `ClickAction` enum.
|
|
1167
|
+
*/
|
|
1168
|
+
clickAction: ClickAction;
|
|
1467
1169
|
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1170
|
+
/**
|
|
1171
|
+
* If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
|
|
1172
|
+
* user clicks on this message.
|
|
1173
|
+
*/
|
|
1174
|
+
uri?: string;
|
|
1473
1175
|
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1176
|
+
/**
|
|
1177
|
+
* If ```clickAction``` is `ClickAction`.URI, whether to open clicks
|
|
1178
|
+
* in a new tab/window. See the `OpenTarget` enum.
|
|
1179
|
+
*/
|
|
1180
|
+
openTarget: OpenTarget;
|
|
1479
1181
|
|
|
1480
|
-
|
|
1481
|
-
|
|
1182
|
+
/**
|
|
1183
|
+
* A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See
|
|
1184
|
+
* [the Font Awesome cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/) for details.
|
|
1185
|
+
*/
|
|
1186
|
+
icon?: string;
|
|
1482
1187
|
|
|
1483
|
-
|
|
1484
|
-
|
|
1188
|
+
/**
|
|
1189
|
+
* Url of an image to include in this message. The message will only display an image *or*
|
|
1190
|
+
* an icon, and will prioritize the image if present.
|
|
1191
|
+
*/
|
|
1192
|
+
imageUrl?: string;
|
|
1485
1193
|
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
*
|
|
1489
|
-
* @param subscriptionGuid - The identifier of the subscription you wish to remove, returned by the method
|
|
1490
|
-
* you initially used to create it.
|
|
1491
|
-
*/
|
|
1492
|
-
removeSubscription(subscriptionGuid: string): void;
|
|
1194
|
+
/** Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
1195
|
+
iconColor: number;
|
|
1493
1196
|
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
* clicked by the user.
|
|
1497
|
-
*
|
|
1498
|
-
* @param subscriber - The callback function to receive click events. This function will be invoked with
|
|
1499
|
-
* no arguments when this button records a click.
|
|
1500
|
-
*
|
|
1501
|
-
* @returns The identifier of the subscription created. This can be passed to `removeSubscription`
|
|
1502
|
-
* to cancel the subscription. Returns null if the subscriber passed is not a function.
|
|
1503
|
-
*/
|
|
1504
|
-
subscribeToClickedEvent(subscriber: () => void): string | null;
|
|
1505
|
-
}
|
|
1197
|
+
/** Background color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
1198
|
+
iconBackgroundColor: number;
|
|
1506
1199
|
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
value: string;
|
|
1510
|
-
}
|
|
1200
|
+
/** Background color of entire message. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
1201
|
+
backgroundColor: number;
|
|
1511
1202
|
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
value: number;
|
|
1515
|
-
}
|
|
1203
|
+
/** Text color of message. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
1204
|
+
textColor: number;
|
|
1516
1205
|
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
}
|
|
1206
|
+
/** Color of close button. Hex value with opacity (e.g. 0xff00ff00 is opaque green). */
|
|
1207
|
+
closeButtonColor: number;
|
|
1208
|
+
}
|
|
1521
1209
|
|
|
1522
|
-
export class FeatureFlag {
|
|
1523
|
-
/** Indicates whether or not this feature flag is enabled. */
|
|
1524
|
-
enabled: boolean;
|
|
1525
1210
|
|
|
1526
|
-
|
|
1527
|
-
properties: Partial<Record<string, FeatureFlagStringProperty | FeatureFlagNumberProperty | FeatureFlagBooleanProperty>>;
|
|
1211
|
+
type Genders = (typeof User.Genders)[keyof typeof User.Genders];
|
|
1528
1212
|
|
|
1529
|
-
/** The ID for this feature flag. */
|
|
1530
|
-
id: string;
|
|
1531
1213
|
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
*
|
|
1535
|
-
* @param key - The key of the property.
|
|
1536
|
-
*
|
|
1537
|
-
* @returns The value of the property if the key is found and is of type string.
|
|
1538
|
-
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1539
|
-
*/
|
|
1540
|
-
getStringProperty(key: string): string | null;
|
|
1214
|
+
type NotificationSubscriptionTypes =
|
|
1215
|
+
(typeof User.NotificationSubscriptionTypes)[keyof typeof User.NotificationSubscriptionTypes];
|
|
1541
1216
|
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1217
|
+
/**
|
|
1218
|
+
* Do not construct directly - use `getUser` to get the user object.
|
|
1219
|
+
* User provides an object which lets you update the attributes stored by Braze for your user.
|
|
1220
|
+
*
|
|
1221
|
+
* This class has been designed to provide fire and forget semantics and to not impact the performance or lifecycle of
|
|
1222
|
+
* calling code. As such, changes made to an User are enqueued locally and flushed to Braze's servers
|
|
1223
|
+
* asynchronously.
|
|
1224
|
+
*/
|
|
1225
|
+
export class User {
|
|
1226
|
+
/** Enum to represent valid genders. */
|
|
1227
|
+
static Genders: {
|
|
1228
|
+
MALE: "m";
|
|
1229
|
+
FEMALE: "f";
|
|
1230
|
+
OTHER: "o";
|
|
1231
|
+
UNKNOWN: "u";
|
|
1232
|
+
NOT_APPLICABLE: "n";
|
|
1233
|
+
PREFER_NOT_TO_SAY: "p";
|
|
1234
|
+
};
|
|
1551
1235
|
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1559
|
-
*/
|
|
1560
|
-
getBooleanProperty(key: string): boolean | null;
|
|
1561
|
-
}
|
|
1236
|
+
/** Enum to represent notification status for email and push notifications. */
|
|
1237
|
+
static NotificationSubscriptionTypes: {
|
|
1238
|
+
OPTED_IN: "opted_in";
|
|
1239
|
+
SUBSCRIBED: "subscribed";
|
|
1240
|
+
UNSUBSCRIBED: "unsubscribed";
|
|
1241
|
+
};
|
|
1562
1242
|
|
|
1563
1243
|
/**
|
|
1564
|
-
*
|
|
1565
|
-
*
|
|
1244
|
+
* Adds an an alias for the user. (alias, label) pairs can exist on one and only one user.
|
|
1245
|
+
* If a different user already has this alias or external user id, the alias attempt will be rejected
|
|
1246
|
+
* on the server.
|
|
1247
|
+
*
|
|
1248
|
+
* @param alias - An identifier for this user.
|
|
1249
|
+
* @param label - A label for the alias. e.g. the source of the alias, like "internal_id"
|
|
1566
1250
|
*
|
|
1567
|
-
* @returns
|
|
1568
|
-
* `removeSubscription` to cancel the subscription.
|
|
1251
|
+
* @returns Whether the update was successfully enqueued.
|
|
1569
1252
|
*/
|
|
1570
|
-
|
|
1253
|
+
addAlias(alias: string, label: string): boolean;
|
|
1571
1254
|
|
|
1572
1255
|
/**
|
|
1573
|
-
*
|
|
1574
|
-
*
|
|
1575
|
-
*
|
|
1256
|
+
* Adds a string to a custom attribute string array, or creates that array if one doesn't exist.
|
|
1257
|
+
*
|
|
1258
|
+
* @param key - The identifier of the custom attribute. Limited to 255 characters in length, cannot begin with
|
|
1259
|
+
* a $, and can only contain alphanumeric characters and punctuation.
|
|
1260
|
+
* @param value - The string to be added to the array. Strings are limited to 255 characters in length, cannot
|
|
1261
|
+
* begin with a $, and can only contain alphanumeric characters and punctuation.
|
|
1262
|
+
*
|
|
1263
|
+
* @returns Whether the update was successfully enqueued.
|
|
1576
1264
|
*/
|
|
1577
|
-
|
|
1265
|
+
addToCustomAttributeArray(key: string, value: string): boolean;
|
|
1578
1266
|
|
|
1579
1267
|
/**
|
|
1580
|
-
*
|
|
1581
|
-
* This method will appropriately clean up any retained resources and also display the hiding animation, and so should be
|
|
1582
|
-
* used instead of manually removing content cards HTML from the DOM.
|
|
1268
|
+
* Adds a user to an email or SMS subscription group.
|
|
1583
1269
|
*
|
|
1584
|
-
* @param
|
|
1585
|
-
*
|
|
1270
|
+
* @param subscriptionGroupId - The unique identifier of the subscription group.
|
|
1271
|
+
*
|
|
1272
|
+
* @returns Whether the update was successfully enqueued.
|
|
1586
1273
|
*/
|
|
1587
|
-
|
|
1274
|
+
addToSubscriptionGroup(subscriptionGroupId: string): boolean;
|
|
1588
1275
|
|
|
1589
1276
|
/**
|
|
1590
|
-
*
|
|
1277
|
+
* Asynchronously retrieves the current user's id, or null if the user is anonymous / has not been identified.
|
|
1278
|
+
* For example:
|
|
1591
1279
|
*
|
|
1592
|
-
*
|
|
1593
|
-
*
|
|
1594
|
-
*
|
|
1595
|
-
*
|
|
1596
|
-
*
|
|
1597
|
-
*
|
|
1598
|
-
*
|
|
1280
|
+
* ```
|
|
1281
|
+
* braze.getUser().getUserId(function(userId) {
|
|
1282
|
+
* console.log('The user is ' + userId);
|
|
1283
|
+
* });
|
|
1284
|
+
* ```
|
|
1285
|
+
* @deprecated - The getUserId callback is deprecated. Access the method's return value directly instead.
|
|
1286
|
+
* @param callback - Asynchronous callback - this will be invoked with the userId.
|
|
1599
1287
|
*/
|
|
1600
|
-
|
|
1601
|
-
parentNode?: Element | null,
|
|
1602
|
-
filterFunction?: (cards: Card[]) => Card[]
|
|
1603
|
-
): void;
|
|
1604
|
-
|
|
1288
|
+
getUserId(callback: (userId: string | null) => void): void;
|
|
1605
1289
|
/**
|
|
1606
|
-
*
|
|
1290
|
+
* Retrieves the current user's id, or null if the user is anonymous / has not been identified.
|
|
1291
|
+
* For example:
|
|
1607
1292
|
*
|
|
1608
|
-
*
|
|
1609
|
-
*
|
|
1610
|
-
*
|
|
1611
|
-
* @param cards - A static set of cards to Each item in this Array should be a `Card`
|
|
1612
|
-
* descendant. If this parameter is null/undefined, all unexpired cards from the last news feed refresh will be
|
|
1613
|
-
* used automatically, a feed refresh will be kicked off automatically if the cached cards are more than 1 minute
|
|
1614
|
-
* old, and the feed will automatically update when new cards are received while it is still showing. If you
|
|
1615
|
-
* provide an explicit set of cards by using this parameter, no action will be taken when new cards are received,
|
|
1616
|
-
* and you must subscribe to feed updates yourself with `subscribeToFeedUpdates` and request updates with
|
|
1617
|
-
* `requestFeedRefresh` if you want to update this feed with new cards.
|
|
1618
|
-
* @param allowedCategories - A set of categories to filter cards to. Each item in this Array should be a
|
|
1619
|
-
* card category as set in the Braze dashboard. If omitted, all cards will be displayed.
|
|
1293
|
+
* ```
|
|
1294
|
+
* console.log('The user is ' + braze.getUser().getUserId());
|
|
1295
|
+
* ```
|
|
1620
1296
|
*/
|
|
1621
|
-
|
|
1622
|
-
parentNode?: Element | null,
|
|
1623
|
-
cards?: Card[] | null,
|
|
1624
|
-
allowedCategories?: string[]
|
|
1625
|
-
): void;
|
|
1626
|
-
|
|
1297
|
+
getUserId(): string | null | undefined;
|
|
1627
1298
|
/**
|
|
1628
|
-
*
|
|
1299
|
+
* Increment/decrement the value of a custom attribute. Only numeric custom attributes
|
|
1300
|
+
* can be incremented. Attempts to increment a custom attribute that is not numeric
|
|
1301
|
+
* will be ignored. If you increment a custom attribute that has not previously been
|
|
1302
|
+
* set, a custom attribute will be created and assigned the value of incrementValue.
|
|
1303
|
+
* To decrement the value of a custom attribute, use a negative incrementValue.
|
|
1629
1304
|
*
|
|
1630
|
-
* @param
|
|
1631
|
-
*
|
|
1632
|
-
*
|
|
1633
|
-
* @param onDisplayCallback - Optional callback to invoke once the message is on the screen.
|
|
1305
|
+
* @param key - The identifier of the custom attribute. Limited to 255 characters in length, cannot begin with
|
|
1306
|
+
* a $, and can only contain alphanumeric characters and punctuation.
|
|
1307
|
+
* @param incrementValue - Default 1. May be negative to decrement.
|
|
1634
1308
|
*
|
|
1635
|
-
* @returns Whether
|
|
1636
|
-
* Braze servers).
|
|
1309
|
+
* @returns Whether the update was successfully enqueued.
|
|
1637
1310
|
*/
|
|
1638
|
-
|
|
1639
|
-
inAppMessage: InAppMessage | ControlMessage,
|
|
1640
|
-
parentNode?: Element | null,
|
|
1641
|
-
onDisplayCallback?: () => void
|
|
1642
|
-
): boolean;
|
|
1311
|
+
incrementCustomUserAttribute(key: string, incrementValue?: number): boolean;
|
|
1643
1312
|
|
|
1644
1313
|
/**
|
|
1645
|
-
*
|
|
1646
|
-
* wish to display multiple content cards feeds on a page simultaneously, you should use `showContentCards` and `hideContentCards`
|
|
1647
|
-
* to show/hide each feed individually instead of this method.
|
|
1314
|
+
* Removes a string from a custom attribute string array.
|
|
1648
1315
|
*
|
|
1649
|
-
* @param
|
|
1650
|
-
*
|
|
1651
|
-
*
|
|
1652
|
-
*
|
|
1653
|
-
*
|
|
1654
|
-
*
|
|
1655
|
-
* `Card` objects to render for this user. If omitted, all cards will be displayed.
|
|
1316
|
+
* @param key - The identifier of the custom attribute. Limited to 255 characters in length, cannot begin with
|
|
1317
|
+
* a $, and can only contain alphanumeric characters and punctuation.
|
|
1318
|
+
* @param value - The string to be removed from the array. Strings are limited to 255 characters in length,
|
|
1319
|
+
* cannot begin with a $, and can only contain alphanumeric characters and punctuation.
|
|
1320
|
+
*
|
|
1321
|
+
* @returns Whether the update was successfully enqueued.
|
|
1656
1322
|
*/
|
|
1657
|
-
|
|
1658
|
-
parentNode?: Element | null,
|
|
1659
|
-
filterFunction?: (cards: Card[]) => Card[]
|
|
1660
|
-
): void;
|
|
1323
|
+
removeFromCustomAttributeArray(key: string, value: string): boolean;
|
|
1661
1324
|
|
|
1662
1325
|
/**
|
|
1663
|
-
*
|
|
1326
|
+
* Removes a user from an email or SMS subscription group.
|
|
1327
|
+
*
|
|
1328
|
+
* @param subscriptionGroupId - The unique identifier of the subscription group.
|
|
1664
1329
|
*
|
|
1665
|
-
* @
|
|
1666
|
-
* rendered in fixed position over the right-hand side of the page and appended to the `<body>` node. If the
|
|
1667
|
-
* parent node already has an Braze news feed as a direct descendant, the existing feed will be replaced.
|
|
1668
|
-
* @param cards - A static set of cards to Each item in this Array should be a `Card`
|
|
1669
|
-
* descendant. If this parameter is null/undefined, all unexpired cards from the last news feed refresh will be
|
|
1670
|
-
* used automatically, a feed refresh will be kicked off automatically if the cached cards are more than 1 minute
|
|
1671
|
-
* old, and the feed will automatically update when new cards are received while it is still showing. If you
|
|
1672
|
-
* provide an explicit set of cards by using this parameter, no action will be taken when new cards are received,
|
|
1673
|
-
* and you must subscribe to feed updates yourself with `subscribeToFeedUpdates` and request updates with
|
|
1674
|
-
* `requestFeedRefresh` if you want to update this feed with new cards.
|
|
1675
|
-
* @param allowedCategories - A set of categories to filter cards to. Each item in this Array should be a
|
|
1676
|
-
* card category as set in the Braze dashboard. If omitted, all cards will be displayed.
|
|
1330
|
+
* @returns Whether the update was successfully enqueued.
|
|
1677
1331
|
*/
|
|
1678
|
-
|
|
1679
|
-
parentNode?: Element | null,
|
|
1680
|
-
cards?: Card[] | null,
|
|
1681
|
-
allowedCategories?: string[]
|
|
1682
|
-
): void;
|
|
1332
|
+
removeFromSubscriptionGroup(subscriptionGroupId: string): boolean;
|
|
1683
1333
|
|
|
1684
1334
|
/**
|
|
1685
|
-
*
|
|
1686
|
-
* with a unique ID, which enables the following:
|
|
1335
|
+
* Sets the country for the user.
|
|
1687
1336
|
*
|
|
1688
|
-
*
|
|
1689
|
-
* be shared across devices.
|
|
1690
|
-
* - If your app is used on the same browser by multiple people, you can assign each of them a unique identifier
|
|
1691
|
-
* to track them separately. Only the most recent user on a particular browser will receive push
|
|
1692
|
-
* notifications and in-app messages.
|
|
1337
|
+
* @param country - Limited to 255 characters in length. Accepts an explicit null value to null out attribute.
|
|
1693
1338
|
*
|
|
1694
|
-
*
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
*
|
|
1700
|
-
* Additionally, if you identify a user which has never been identified on another device, the entire history of
|
|
1701
|
-
* that user as an "anonymous" user on this device will be preserved and associated with the newly identified
|
|
1702
|
-
* user. However, if you identify a user which *has* been identified in another app, any history which was
|
|
1703
|
-
* already flushed to the server for the anonymous user on this device will become orphaned and will not be
|
|
1704
|
-
* associated with any future users. These orphaned users are not considered in your user counts and will not
|
|
1705
|
-
* be messaged.
|
|
1339
|
+
* @returns Whether the update was successfully enqueued.
|
|
1340
|
+
*/
|
|
1341
|
+
setCountry(country: string | null): boolean;
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Sets a custom user location attribute.
|
|
1706
1345
|
*
|
|
1707
|
-
*
|
|
1708
|
-
*
|
|
1709
|
-
*
|
|
1710
|
-
*
|
|
1711
|
-
*
|
|
1712
|
-
*
|
|
1713
|
-
* to target while logged out and switching back to that user ID as part of your app's logout process.
|
|
1346
|
+
* @param key - The identifier of the custom location attribute. Limited to 255 characters in length, cannot begin with
|
|
1347
|
+
* a $, and can only contain alphanumeric characters and punctuation.
|
|
1348
|
+
* @param latitude - The latitude of the user's location in (valid values are between -90 to 90 degrees). Passing a null
|
|
1349
|
+
* value for both latitude and longitude will remove this custom attribute from the user.
|
|
1350
|
+
* @param longitude - The longitude of the user's location (valid values are between -180 to 180 degrees). Passing a null
|
|
1351
|
+
* value for both latitude and longitude will remove this custom attribute from the user.
|
|
1714
1352
|
*
|
|
1715
|
-
* @
|
|
1716
|
-
* These User IDs should be private and not easily guessable (e.g. not a plain email address or username).
|
|
1717
|
-
* @param signature - An encrypted signature to be used to authenticate the current user. You can update the signature
|
|
1718
|
-
* using the `setSdkAuthenticationSignature` method. This signature will only have an effect if the `enableSdkAuthentication`
|
|
1719
|
-
* initialization option is set to true.
|
|
1353
|
+
* @returns Whether the update was successfully enqueued.
|
|
1720
1354
|
*/
|
|
1721
|
-
|
|
1355
|
+
setCustomLocationAttribute(
|
|
1356
|
+
key: string,
|
|
1357
|
+
latitude: number | null,
|
|
1358
|
+
longitude: number | null,
|
|
1359
|
+
): boolean;
|
|
1722
1360
|
|
|
1723
1361
|
/**
|
|
1724
|
-
*
|
|
1725
|
-
*
|
|
1362
|
+
* Sets a custom user attribute. This can be any key/value pair and is used to collect extra
|
|
1363
|
+
* information about the user.
|
|
1364
|
+
*
|
|
1365
|
+
* @param key - The identifier of the custom attribute. Limited to 255 characters in length, cannot begin with
|
|
1366
|
+
* a $, and can only contain alphanumeric characters and punctuation.
|
|
1367
|
+
* @param value - Can be numeric, boolean, a Date object, a string, or an array of strings. Strings are limited to
|
|
1368
|
+
* 255 characters in length, cannot begin with a $, and can only contain alphanumeric characters and punctuation.
|
|
1369
|
+
* Passing a null value will remove this custom attribute from the user.
|
|
1370
|
+
* @param merge - Whether the value should be merged with the existing value on the backend. If `false` (default), any existing
|
|
1371
|
+
* attribute will be overwritten. If `true`, existing objects and arrays of objects will be merged. To update an array of objects,
|
|
1372
|
+
* follow the guidelines in our
|
|
1373
|
+
* [public docs](https://www.braze.com/docs/user_guide/data_and_analytics/custom_data/custom_attributes/array_of_objects/#usage-examples).
|
|
1374
|
+
*
|
|
1375
|
+
* @returns {boolean} Whether the update was successfully enqueued.
|
|
1726
1376
|
*/
|
|
1727
|
-
|
|
1377
|
+
setCustomUserAttribute(
|
|
1378
|
+
key: string,
|
|
1379
|
+
value:
|
|
1380
|
+
| number
|
|
1381
|
+
| boolean
|
|
1382
|
+
| Date
|
|
1383
|
+
| string
|
|
1384
|
+
| string[]
|
|
1385
|
+
| object
|
|
1386
|
+
| object[]
|
|
1387
|
+
| null,
|
|
1388
|
+
merge?: boolean,
|
|
1389
|
+
): boolean;
|
|
1728
1390
|
|
|
1729
1391
|
/**
|
|
1730
|
-
*
|
|
1392
|
+
* Sets the date of birth of the user. Alternatively takes in null values for all parameters
|
|
1393
|
+
* to set date of birth to null.
|
|
1731
1394
|
*
|
|
1732
|
-
* @
|
|
1733
|
-
*
|
|
1395
|
+
* @param year
|
|
1396
|
+
* @param month - 1-12
|
|
1397
|
+
* @param day
|
|
1398
|
+
*
|
|
1399
|
+
* @returns Whether the update was successfully enqueued.
|
|
1734
1400
|
*/
|
|
1735
|
-
|
|
1401
|
+
setDateOfBirth(
|
|
1402
|
+
year: number | null,
|
|
1403
|
+
month: number | null,
|
|
1404
|
+
day: number | null,
|
|
1405
|
+
): boolean;
|
|
1736
1406
|
|
|
1737
1407
|
/**
|
|
1738
|
-
*
|
|
1408
|
+
* Sets the email address of the user.
|
|
1739
1409
|
*
|
|
1740
|
-
* @
|
|
1741
|
-
*
|
|
1410
|
+
* @param email - Must pass RFC-5322 email address validation. Accepts an explicit null value to
|
|
1411
|
+
* null out attribute.
|
|
1412
|
+
*
|
|
1413
|
+
* @returns Whether the update was successfully enqueued.
|
|
1742
1414
|
*/
|
|
1743
|
-
|
|
1415
|
+
setEmail(email: string | null): boolean;
|
|
1744
1416
|
|
|
1745
1417
|
/**
|
|
1746
|
-
*
|
|
1747
|
-
* This ID resets for private browsing sessions and when website data is cleared. For example:
|
|
1418
|
+
* Sets whether the user should be sent email campaigns.
|
|
1748
1419
|
*
|
|
1749
|
-
*
|
|
1750
|
-
*
|
|
1751
|
-
* console.log('The device id is ' + deviceId);
|
|
1752
|
-
* });
|
|
1753
|
-
* ```
|
|
1420
|
+
* @param notificationSubscriptionType - Notification setting (explicitly opted-in, subscribed, or unsubscribed).
|
|
1421
|
+
* See the `NotificationSubscriptionTypes` enum.
|
|
1754
1422
|
*
|
|
1755
|
-
* @
|
|
1423
|
+
* @returns Whether the update was successfully enqueued.
|
|
1756
1424
|
*/
|
|
1757
|
-
|
|
1425
|
+
setEmailNotificationSubscriptionType(
|
|
1426
|
+
notificationSubscriptionType: NotificationSubscriptionTypes,
|
|
1427
|
+
): boolean;
|
|
1758
1428
|
|
|
1759
1429
|
/**
|
|
1760
|
-
*
|
|
1761
|
-
*
|
|
1762
|
-
*
|
|
1430
|
+
* Sets the first name of the user.
|
|
1431
|
+
*
|
|
1432
|
+
* @param firstName - Limited to 255 characters in length. Accepts an explicit null value to null out attribute.
|
|
1433
|
+
*
|
|
1434
|
+
* @returns Whether the update was successfully enqueued.
|
|
1763
1435
|
*/
|
|
1764
|
-
|
|
1436
|
+
setFirstName(firstName: string | null): boolean;
|
|
1765
1437
|
|
|
1766
1438
|
/**
|
|
1767
|
-
*
|
|
1768
|
-
* invoked, and is part of the default loading snippets. Subsequent calls will be ignored until 'destroy`
|
|
1769
|
-
* is called.
|
|
1439
|
+
* Sets the gender of the user.
|
|
1770
1440
|
*
|
|
1771
|
-
* @param
|
|
1772
|
-
*
|
|
1773
|
-
* @param options - Configuration options. See `InitializationOptions` for supported options.
|
|
1441
|
+
* @param gender - Generally 'm' or 'f'. Accepts an explicit null value to null out attribute. Use `Genders`
|
|
1442
|
+
* enum when setting this value.
|
|
1774
1443
|
*
|
|
1775
|
-
* @returns
|
|
1776
|
-
* Reasons for returning false include a missing API key/base URL, user opt out, and ignored crawler bot activity.
|
|
1444
|
+
* @returns Whether the update was successfully enqueued.
|
|
1777
1445
|
*/
|
|
1778
|
-
|
|
1446
|
+
setGender(gender: Genders | null): boolean;
|
|
1779
1447
|
|
|
1780
1448
|
/**
|
|
1781
|
-
*
|
|
1782
|
-
*
|
|
1783
|
-
*
|
|
1449
|
+
* Sets the home city for the user.
|
|
1450
|
+
*
|
|
1451
|
+
* @param homeCity - Limited to 255 characters in length. Accepts an explicit null value to null out attribute.
|
|
1452
|
+
*
|
|
1453
|
+
* @returns Whether the update was successfully enqueued.
|
|
1784
1454
|
*/
|
|
1785
|
-
|
|
1455
|
+
setHomeCity(homeCity: string | null): boolean;
|
|
1786
1456
|
|
|
1787
1457
|
/**
|
|
1788
|
-
*
|
|
1789
|
-
*
|
|
1790
|
-
*
|
|
1791
|
-
*
|
|
1458
|
+
* Sets the language for this user. By default, the user's language is detected automatically
|
|
1459
|
+
* from the browser. If you call this method, Braze will ignore the detected language and use
|
|
1460
|
+
* the language you have provided instead.
|
|
1461
|
+
*
|
|
1462
|
+
* @param language - An [ISO 639-1 Language Code](https://www.w3schools.com/tags/ref_language_codes.asp).
|
|
1463
|
+
* Accepts an explicit null value to null out attribute.
|
|
1792
1464
|
*
|
|
1793
|
-
* @returns Whether
|
|
1794
|
-
* `requestPushPermission` may be called without the user being prompted. If this returns false,
|
|
1795
|
-
* `requestPushPermission` may prompt the user (if `isPushSupported` returns true) or do
|
|
1796
|
-
* nothing (if `isPushSupported` returns false). Returns undefined if the SDK has not been initialized.
|
|
1465
|
+
* @returns {boolean} Whether the update was successfully enqueued.
|
|
1797
1466
|
*/
|
|
1798
|
-
|
|
1467
|
+
setLanguage(language: string | null): boolean;
|
|
1799
1468
|
|
|
1800
1469
|
/**
|
|
1801
|
-
*
|
|
1802
|
-
* across the browser landscape. This method allows you to programmatically determine whether push is supported
|
|
1803
|
-
* in the current browser, and whether to show push-related user class elements to the user.
|
|
1470
|
+
* Sets the last known location for the user.
|
|
1804
1471
|
*
|
|
1805
|
-
* @
|
|
1472
|
+
* @param latitude - The latitude of the user's location in (valid values are between -90 to 90 degrees)
|
|
1473
|
+
* @param longitude - The longitude of the user's location (valid values are between -180 to 180 degrees)
|
|
1474
|
+
* @param accuracy - The accuracy of the user's lat/long in meters.
|
|
1475
|
+
* @param altitude - The altitude of the user's location in meters above or below the WGS 84 reference
|
|
1476
|
+
* ellipsoid.
|
|
1477
|
+
* @param altitudeAccuracy - The accuracy of the user's altitude in meters.
|
|
1478
|
+
*
|
|
1479
|
+
* @returns Whether the update was successfully enqueued.
|
|
1806
1480
|
*/
|
|
1807
|
-
|
|
1481
|
+
setLastKnownLocation(
|
|
1482
|
+
latitude: number,
|
|
1483
|
+
longitude: number,
|
|
1484
|
+
accuracy?: number,
|
|
1485
|
+
altitude?: number,
|
|
1486
|
+
altitudeAccuracy?: number,
|
|
1487
|
+
): boolean;
|
|
1808
1488
|
|
|
1809
1489
|
/**
|
|
1810
|
-
*
|
|
1811
|
-
* and should only be called if you're bypassing that and manually building the DOM for displaying the cards in
|
|
1812
|
-
* your own code.
|
|
1490
|
+
* Sets the last name of the user.
|
|
1813
1491
|
*
|
|
1814
|
-
* @param
|
|
1815
|
-
* @param forContentCards - whether to log this as a content cards event (as opposed to the legacy news feed)
|
|
1492
|
+
* @param lastName - Limited to 255 characters in length. Accepts an explicit null value to null out attribute.
|
|
1816
1493
|
*
|
|
1817
|
-
* @returns Whether
|
|
1494
|
+
* @returns Whether the update was successfully enqueued.
|
|
1818
1495
|
*/
|
|
1819
|
-
|
|
1496
|
+
setLastName(lastName: string | null): boolean;
|
|
1820
1497
|
|
|
1821
1498
|
/**
|
|
1822
|
-
*
|
|
1823
|
-
* and should only be called if you're bypassing that and manually building the DOM for displaying the cards in
|
|
1824
|
-
* your own code.
|
|
1499
|
+
* Sets the phone number of the user.
|
|
1825
1500
|
*
|
|
1826
|
-
* @param
|
|
1501
|
+
* @param phoneNumber - A phone number is considered valid if it is no more than 255 characters in length and
|
|
1502
|
+
* contains only numbers, whitespace, and the following special characters +.-() Accepts an explicit null value to
|
|
1503
|
+
* null out attribute.
|
|
1827
1504
|
*
|
|
1828
|
-
* @returns Whether
|
|
1505
|
+
* @returns Whether the update was successfully enqueued.
|
|
1829
1506
|
*/
|
|
1830
|
-
|
|
1507
|
+
setPhoneNumber(phoneNumber: string | null): boolean;
|
|
1831
1508
|
|
|
1832
1509
|
/**
|
|
1833
|
-
*
|
|
1834
|
-
* and should only be called if you're bypassing that and manually building the DOM for displaying the cards in
|
|
1835
|
-
* your own code.
|
|
1510
|
+
* Sets whether the user should be sent push campaigns.
|
|
1836
1511
|
*
|
|
1837
|
-
* @param
|
|
1838
|
-
*
|
|
1512
|
+
* @param notificationSubscriptionType - Notification setting (explicitly opted-in, subscribed, or unsubscribed).
|
|
1513
|
+
* See the `NotificationSubscriptionTypes` enum.
|
|
1839
1514
|
*
|
|
1840
|
-
* @returns Whether
|
|
1515
|
+
* @returns Whether the update was successfully enqueued.
|
|
1841
1516
|
*/
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
forContentCards?: boolean
|
|
1517
|
+
setPushNotificationSubscriptionType(
|
|
1518
|
+
notificationSubscriptionType: NotificationSubscriptionTypes,
|
|
1845
1519
|
): boolean;
|
|
1520
|
+
}
|
|
1846
1521
|
|
|
1522
|
+
export class InAppMessageButton {
|
|
1847
1523
|
/**
|
|
1848
|
-
*
|
|
1849
|
-
*
|
|
1850
|
-
*
|
|
1851
|
-
*
|
|
1852
|
-
*
|
|
1853
|
-
*
|
|
1854
|
-
*
|
|
1855
|
-
*
|
|
1856
|
-
*
|
|
1524
|
+
* Represents a button on an `ModalMessage` or `FullScreenMessage`.
|
|
1525
|
+
*
|
|
1526
|
+
* @param text - The text to display on this button
|
|
1527
|
+
* @param backgroundColor - The background color for this button. Hex value with opacity (e.g.
|
|
1528
|
+
* 0xff00ff00 is opaque green).
|
|
1529
|
+
* @param textColor - The color for the text of this button. Hex value with opacity (e.g.
|
|
1530
|
+
* 0xff00ff00 is opaque green).
|
|
1531
|
+
* @param borderColor - The color for the border of this button. Hex value with opacity (e.g.
|
|
1532
|
+
* 0xff00ff00 is opaque green).
|
|
1533
|
+
* @param clickAction - Where the user should be brought when clicking on this button. See the
|
|
1534
|
+
* `ClickAction` enum.
|
|
1535
|
+
* @param uri - If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
|
|
1536
|
+
* user clicks on this button.
|
|
1537
|
+
* @param id - The id for this button. Used for analytics.
|
|
1857
1538
|
*/
|
|
1858
|
-
|
|
1539
|
+
constructor(
|
|
1540
|
+
text: string,
|
|
1541
|
+
backgroundColor?: number,
|
|
1542
|
+
textColor?: number,
|
|
1543
|
+
borderColor?: number,
|
|
1544
|
+
clickAction?: ClickAction,
|
|
1545
|
+
uri?: string,
|
|
1546
|
+
id?: number,
|
|
1547
|
+
);
|
|
1548
|
+
|
|
1549
|
+
/** The text to display on this button */
|
|
1550
|
+
text: string;
|
|
1859
1551
|
|
|
1860
1552
|
/**
|
|
1861
|
-
*
|
|
1862
|
-
*
|
|
1863
|
-
* This is done automatically when you use Braze's display module and should only be called
|
|
1864
|
-
* if you're bypassing that and manually building the DOM for displaying content cards in
|
|
1865
|
-
* your own code.
|
|
1866
|
-
*
|
|
1867
|
-
* @param contentCard - the `Card` object that received a click
|
|
1868
|
-
*
|
|
1869
|
-
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
1553
|
+
* The background color for this button. Hex value with opacity (e.g.
|
|
1554
|
+
* 0xff00ff00 is opaque green).
|
|
1870
1555
|
*/
|
|
1871
|
-
|
|
1556
|
+
backgroundColor: number;
|
|
1872
1557
|
|
|
1873
1558
|
/**
|
|
1874
|
-
*
|
|
1559
|
+
* The color for the text of this button. Hex value with opacity (e.g.
|
|
1560
|
+
* 0xff00ff00 is opaque green).
|
|
1875
1561
|
*/
|
|
1876
|
-
|
|
1562
|
+
textColor: number;
|
|
1877
1563
|
|
|
1878
1564
|
/**
|
|
1879
|
-
*
|
|
1880
|
-
*
|
|
1881
|
-
* @param eventName - The identifier for the event to track. Value is limited to 255 characters in length,
|
|
1882
|
-
* cannot begin with a $, and can only contain alphanumeric characters and punctuation.
|
|
1883
|
-
* @param eventProperties - Hash of properties for this event. Keys are limited to 255 characters in length, cannot begin
|
|
1884
|
-
* with a $, and can only contain alphanumeric characters and punctuation. Values can be numeric, boolean, Date objects,
|
|
1885
|
-
* strings 255 characters or shorter, or nested objects whose values can be numeric, boolean, Date objects, arrays, strings,
|
|
1886
|
-
* or null. Total size of event properties cannot exceed 50KB.
|
|
1887
|
-
*
|
|
1888
|
-
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
1565
|
+
* The color for the border of this button. Hex value with opacity (e.g.
|
|
1566
|
+
* 0xff00ff00 is opaque green).
|
|
1889
1567
|
*/
|
|
1890
|
-
|
|
1568
|
+
borderColor: number;
|
|
1891
1569
|
|
|
1892
1570
|
/**
|
|
1893
|
-
*
|
|
1894
|
-
*
|
|
1895
|
-
* the class for displaying the cards in your own code.
|
|
1571
|
+
* Where the user should be brought when clicking on this button. See the
|
|
1572
|
+
* `ClickAction` enum.
|
|
1896
1573
|
*/
|
|
1897
|
-
|
|
1574
|
+
clickAction: ClickAction;
|
|
1898
1575
|
|
|
1899
1576
|
/**
|
|
1900
|
-
*
|
|
1901
|
-
*
|
|
1902
|
-
* and should only be called if you're bypassing that method and manually displaying the message in your own
|
|
1903
|
-
* code.
|
|
1904
|
-
*
|
|
1905
|
-
* @param button - The button clicked
|
|
1906
|
-
* @param inAppMessage - The message this button belongs to
|
|
1907
|
-
*
|
|
1908
|
-
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
1577
|
+
* If ```clickAction``` is `ClickAction`.URI, the URI to follow when the
|
|
1578
|
+
* user clicks on this button.
|
|
1909
1579
|
*/
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1580
|
+
uri?: string;
|
|
1581
|
+
|
|
1582
|
+
/** The id for this button. Used for analytics. */
|
|
1583
|
+
id?: number;
|
|
1584
|
+
|
|
1585
|
+
/** Remove all event subscriptions from this button. */
|
|
1586
|
+
removeAllSubscriptions(): void;
|
|
1914
1587
|
|
|
1915
1588
|
/**
|
|
1916
|
-
*
|
|
1917
|
-
* message generated by `showInAppMessage`, and should
|
|
1918
|
-
* only be called if you're bypassing that method and manually displaying the message in your own code.
|
|
1919
|
-
*
|
|
1920
|
-
* @param inAppMessage
|
|
1589
|
+
* Remove an event subscription that you previously subscribed to.
|
|
1921
1590
|
*
|
|
1922
|
-
* @
|
|
1591
|
+
* @param subscriptionGuid - The identifier of the subscription you wish to remove, returned by the method
|
|
1592
|
+
* you initially used to create it.
|
|
1923
1593
|
*/
|
|
1924
|
-
|
|
1594
|
+
removeSubscription(subscriptionGuid: string): void;
|
|
1925
1595
|
|
|
1926
1596
|
/**
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
1929
|
-
* only be called if you're bypassing that method and manually displaying the message in your own code.
|
|
1597
|
+
* Subscribe to receive click events on this button. The subscriber callback will be called whenever this button is
|
|
1598
|
+
* clicked by the user.
|
|
1930
1599
|
*
|
|
1931
|
-
* @param
|
|
1932
|
-
*
|
|
1933
|
-
* @param url - The url that was clicked
|
|
1600
|
+
* @param subscriber - The callback function to receive click events. This function will be invoked with
|
|
1601
|
+
* no arguments when this button records a click.
|
|
1934
1602
|
*
|
|
1935
|
-
* @returns
|
|
1603
|
+
* @returns The identifier of the subscription created. This can be passed to `removeSubscription`
|
|
1604
|
+
* to cancel the subscription. Returns null if the subscriber passed is not a function.
|
|
1936
1605
|
*/
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1606
|
+
subscribeToClickedEvent(subscriber: () => void): string | null;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
export interface FeatureFlagStringProperty {
|
|
1610
|
+
type: "string";
|
|
1611
|
+
value: string;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
export interface FeatureFlagNumberProperty {
|
|
1615
|
+
type: "number";
|
|
1616
|
+
value: number;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
export interface FeatureFlagBooleanProperty {
|
|
1620
|
+
type: "boolean";
|
|
1621
|
+
value: boolean;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
export class FeatureFlag {
|
|
1625
|
+
/** Indicates whether or not this feature flag is enabled. */
|
|
1626
|
+
enabled: boolean;
|
|
1627
|
+
|
|
1628
|
+
/** Properties of this feature flag, listed as key-value pairs. */
|
|
1629
|
+
properties: Partial<
|
|
1630
|
+
Record<
|
|
1631
|
+
string,
|
|
1632
|
+
| FeatureFlagStringProperty
|
|
1633
|
+
| FeatureFlagNumberProperty
|
|
1634
|
+
| FeatureFlagBooleanProperty
|
|
1635
|
+
>
|
|
1636
|
+
>;
|
|
1637
|
+
|
|
1638
|
+
/** The ID for this feature flag. */
|
|
1639
|
+
id: string;
|
|
1942
1640
|
|
|
1943
1641
|
/**
|
|
1944
|
-
*
|
|
1945
|
-
* and should only be called if you're bypassing that method and manually displaying the message in your own code.
|
|
1642
|
+
* Get value of a feature flag property of type string.
|
|
1946
1643
|
*
|
|
1947
|
-
* @param
|
|
1644
|
+
* @param key - The key of the property.
|
|
1948
1645
|
*
|
|
1949
|
-
* @returns
|
|
1646
|
+
* @returns The value of the property if the key is found and is of type string.
|
|
1647
|
+
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1950
1648
|
*/
|
|
1951
|
-
|
|
1952
|
-
inAppMessage: InAppMessage | ControlMessage
|
|
1953
|
-
): boolean;
|
|
1649
|
+
getStringProperty(key: string): string | null;
|
|
1954
1650
|
|
|
1955
1651
|
/**
|
|
1956
|
-
*
|
|
1957
|
-
*
|
|
1958
|
-
* @param
|
|
1959
|
-
*
|
|
1960
|
-
* @
|
|
1961
|
-
*
|
|
1962
|
-
* values will be rounded to two digits with toFixed(2)
|
|
1963
|
-
* @param currencyCode - Default USD. Currencies should be represented as an ISO 4217 currency code. Supported
|
|
1964
|
-
* currency symbols include: AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF,
|
|
1965
|
-
* BMD, BND, BOB, BRL, BSD, BTC, BTN, BWP, BYR, BZD, CAD, CDF, CHF, CLF, CLP, CNY, COP, CRC, CUC, CUP, CVE,
|
|
1966
|
-
* CZK, DJF, DKK, DOP, DZD, EEK, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD,
|
|
1967
|
-
* HKD, HNL, HRK, HTG, HUF, IDR, ILS, IMP, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW,
|
|
1968
|
-
* KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MTL,
|
|
1969
|
-
* MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR,
|
|
1970
|
-
* RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, STD, SVC, SYP, SZL, THB, TJS, TMT,
|
|
1971
|
-
* TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEF, VND, VUV, WST, XAF, XAG, XAU, XCD, XDR, XOF,
|
|
1972
|
-
* XPD, XPF, XPT, YER, ZAR, ZMK, ZMW, and ZWL. Any other provided currency symbol will result in a logged
|
|
1973
|
-
* warning and no other action taken by the SDK.
|
|
1974
|
-
* @param quantity - Default 1. The quantity of items purchased expressed as a whole number. Must be at least 1
|
|
1975
|
-
* and at most 100.
|
|
1976
|
-
* @param purchaseProperties - Hash of properties for this purchase. Keys are limited to 255
|
|
1977
|
-
* characters in length, cannot begin with a $, and can only contain alphanumeric characters and punctuation.
|
|
1978
|
-
* Values can be numeric, boolean, Date objects, strings 255 characters or shorter, or nested objects whose values
|
|
1979
|
-
* can be numeric, boolean, Date objects, arrays, strings, or null. Total size of purchase properties cannot exceed 50KB.
|
|
1980
|
-
*
|
|
1981
|
-
* @returns Whether or not the purchase was successfully attached to the session (to be flushed later).
|
|
1982
|
-
*/
|
|
1983
|
-
export function logPurchase(
|
|
1984
|
-
productId: string,
|
|
1985
|
-
price: number,
|
|
1986
|
-
currencyCode?: string,
|
|
1987
|
-
quantity?: number,
|
|
1988
|
-
purchaseProperties?: object
|
|
1989
|
-
): boolean;
|
|
1990
|
-
|
|
1991
|
-
/**
|
|
1992
|
-
* Opens a new session, or resumes the previous session if this browser had activity within the `sessionTimeoutInSeconds` value.
|
|
1993
|
-
* When a new session is opened, this refreshes In-App Messages. Content Cards are refreshed automatically if
|
|
1994
|
-
* the `subscribeToContentCardsUpdates` has been registered prior to `openSession`. If the user has previously
|
|
1995
|
-
* granted the site permission to send push, automatically sends the push registration to the Braze backend.
|
|
1996
|
-
*
|
|
1997
|
-
* Be sure to call `openSession` at the end of your initialization code section, after any calls to `changeUser` or subscribing to Content Cards,
|
|
1998
|
-
* In-App Message, and Feature Flag updates. Calling `openSession` before `changeUser` may result in a second session start event.
|
|
1652
|
+
* Get value of a feature flag property of type number.
|
|
1653
|
+
*
|
|
1654
|
+
* @param key - The key of the property.
|
|
1655
|
+
*
|
|
1656
|
+
* @returns The value of the property if the key is found and is of type number.
|
|
1657
|
+
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1999
1658
|
*/
|
|
2000
|
-
|
|
1659
|
+
getNumberProperty(key: string): number | null;
|
|
2001
1660
|
|
|
2002
1661
|
/**
|
|
2003
|
-
*
|
|
2004
|
-
* [W3C Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API) (browsers in which
|
|
2005
|
-
* `isPushSupported` returns true). If push is supported and the user is not already subscribed,
|
|
2006
|
-
* this method will cause the browser to immediately request push permission from the user.
|
|
2007
|
-
*
|
|
2008
|
-
* In order to properly use this feature, there are some integration steps required on your end:
|
|
2009
|
-
*
|
|
2010
|
-
* - Your site must be https
|
|
2011
|
-
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
2012
|
-
*
|
|
2013
|
-
* ```
|
|
2014
|
-
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.8/service-worker.js');
|
|
2015
|
-
* ```
|
|
1662
|
+
* Get value of a feature flag property of type boolean.
|
|
2016
1663
|
*
|
|
2017
|
-
*
|
|
1664
|
+
* @param key - The key of the property.
|
|
2018
1665
|
*
|
|
2019
|
-
* @
|
|
2020
|
-
*
|
|
2021
|
-
* @param deniedCallback - If push permission is denied or an error is encountered while registering, this callback will
|
|
2022
|
-
* be invoked. If the denial is temporary, it will be invoked with a parameter of `true` - otherwise it will be invoked
|
|
2023
|
-
* with a parameter of `false`.
|
|
1666
|
+
* @returns The value of the property if the key is found and is of type boolean.
|
|
1667
|
+
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
2024
1668
|
*/
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
1669
|
+
getBooleanProperty(key: string): boolean | null;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
/**
|
|
1673
|
+
* Automatically display in-app messages when they are triggered. This method should be called before
|
|
1674
|
+
* calling `openSession`.
|
|
1675
|
+
*
|
|
1676
|
+
* @returns The identifier of the subscription created. This can be passed to
|
|
1677
|
+
* `removeSubscription` to cancel the subscription.
|
|
1678
|
+
*/
|
|
1679
|
+
export function automaticallyShowInAppMessages(): string;
|
|
1680
|
+
|
|
1681
|
+
/**
|
|
1682
|
+
* Destroy any Braze news feed currently showing. This method will appropriately clean up any retained resources
|
|
1683
|
+
* and also display the hiding animation, and so should be used instead of manually removing feed html from the
|
|
1684
|
+
* DOM.
|
|
1685
|
+
*/
|
|
1686
|
+
export function destroyFeed(): void;
|
|
1687
|
+
|
|
1688
|
+
/**
|
|
1689
|
+
* Hide any Braze content cards currently showing in the parent node, or if none is provided, any content cards in the page.
|
|
1690
|
+
* This method will appropriately clean up any retained resources and also display the hiding animation, and so should be
|
|
1691
|
+
* used instead of manually removing content cards HTML from the DOM.
|
|
1692
|
+
*
|
|
1693
|
+
* @param parentNode - The HTML node that denotes the parent of the content cards to be hidden. If null/undefined, all content
|
|
1694
|
+
* cards on the page will be hidden.
|
|
1695
|
+
*/
|
|
1696
|
+
export function hideContentCards(parentNode?: Element | null): void;
|
|
1697
|
+
|
|
1698
|
+
/**
|
|
1699
|
+
* Display the user's content cards.
|
|
1700
|
+
*
|
|
1701
|
+
* @param parentNode - The HTML node to render the content cards into. If null/undefined, the content
|
|
1702
|
+
* cards will be rendered in fixed position over the right-hand side of the page and appended to the `<body>`
|
|
1703
|
+
* node. If the parent node already has a Braze content cards view as a direct descendant, the existing content
|
|
1704
|
+
* cards will be replaced.
|
|
1705
|
+
* @param filterFunction - A filter/sort function for cards displayed in this view. Invoked with the
|
|
1706
|
+
* array of `Card` objects, sorted by {pinned, date}. Expected to return an array of sorted
|
|
1707
|
+
* `Card` objects to render for this user. If omitted, all cards will be displayed.
|
|
1708
|
+
*/
|
|
1709
|
+
export function showContentCards(
|
|
1710
|
+
parentNode?: Element | null,
|
|
1711
|
+
filterFunction?: (cards: Card[]) => Card[],
|
|
1712
|
+
): void;
|
|
1713
|
+
|
|
1714
|
+
/**
|
|
1715
|
+
* Display the user's news feed.
|
|
1716
|
+
*
|
|
1717
|
+
* @param parentNode - The HTML node to render the news feed into. If null/undefined, the feed will be
|
|
1718
|
+
* rendered in fixed position over the right-hand side of the page and appended to the `<body>` node. If the
|
|
1719
|
+
* parent node already has an Braze news feed as a direct descendant, the existing feed will be replaced.
|
|
1720
|
+
* @param cards - A static set of cards to Each item in this Array should be a `Card`
|
|
1721
|
+
* descendant. If this parameter is null/undefined, all unexpired cards from the last news feed refresh will be
|
|
1722
|
+
* used automatically, a feed refresh will be kicked off automatically if the cached cards are more than 1 minute
|
|
1723
|
+
* old, and the feed will automatically update when new cards are received while it is still showing. If you
|
|
1724
|
+
* provide an explicit set of cards by using this parameter, no action will be taken when new cards are received,
|
|
1725
|
+
* and you must subscribe to feed updates yourself with `subscribeToFeedUpdates` and request updates with
|
|
1726
|
+
* `requestFeedRefresh` if you want to update this feed with new cards.
|
|
1727
|
+
* @param allowedCategories - A set of categories to filter cards to. Each item in this Array should be a
|
|
1728
|
+
* card category as set in the Braze dashboard. If omitted, all cards will be displayed.
|
|
1729
|
+
*/
|
|
1730
|
+
export function showFeed(
|
|
1731
|
+
parentNode?: Element | null,
|
|
1732
|
+
cards?: Card[] | null,
|
|
1733
|
+
allowedCategories?: string[],
|
|
1734
|
+
): void;
|
|
1735
|
+
|
|
1736
|
+
/**
|
|
1737
|
+
* Display a given in-app message.
|
|
1738
|
+
*
|
|
1739
|
+
* @param inAppMessage - The message to
|
|
1740
|
+
* @param parentNode - The HTML node to render the in-app message into. If null/undefined, the message
|
|
1741
|
+
* will be rendered appended within the `<body>` node.
|
|
1742
|
+
* @param onDisplayCallback - Optional callback to invoke once the message is on the screen.
|
|
1743
|
+
*
|
|
1744
|
+
* @returns Whether or not the message was displayed (or, in the case of control messages, logged to
|
|
1745
|
+
* Braze servers).
|
|
1746
|
+
*/
|
|
1747
|
+
export function showInAppMessage(
|
|
1748
|
+
inAppMessage: InAppMessage | ControlMessage,
|
|
1749
|
+
parentNode?: Element | null,
|
|
1750
|
+
onDisplayCallback?: () => void,
|
|
1751
|
+
): boolean;
|
|
1752
|
+
|
|
1753
|
+
/**
|
|
1754
|
+
* Defers the display of given in-app message for a future pageload.
|
|
1755
|
+
* The deferred in-app message can be retrieved by calling `getDeferredInAppMessage`,
|
|
1756
|
+
* and displayed using `showInAppMessage`.
|
|
1757
|
+
* Deferring an in-app message will overwrite any previously deferred in-app message.
|
|
1758
|
+
*
|
|
1759
|
+
* Note: Be sure to subscribe to clicked / dismissed events on this in-app message only after retrieving it using `getDeferredInAppMessage`.
|
|
1760
|
+
* Any subscriptions made before calling `deferInAppMessage` will not be persisted.
|
|
1761
|
+
* Also note that the in-app message deferred here will be cleared out when in-app message triggers have been refreshed from the Braze backend.
|
|
1762
|
+
*
|
|
1763
|
+
* @param inAppMessage - The message to defer for later display.
|
|
1764
|
+
*
|
|
1765
|
+
* @returns Whether or not the message was successfully deferred.
|
|
1766
|
+
* Returns undefined if the SDK has not been initialized.
|
|
1767
|
+
*/
|
|
1768
|
+
export function deferInAppMessage(
|
|
1769
|
+
inAppMessage: InAppMessage,
|
|
1770
|
+
): boolean | undefined;
|
|
1771
|
+
|
|
1772
|
+
/**
|
|
1773
|
+
* Retrieves the in-app message that was most recently deferred for display with `deferInAppMessage`.
|
|
1774
|
+
*
|
|
1775
|
+
* Note: Retrieving the deferred in-app message here will clear it from storage.
|
|
1776
|
+
*
|
|
1777
|
+
* @returns The deferred in-app message if it exists, or returns null.
|
|
1778
|
+
* Returns undefined if the SDK has not been initialized.
|
|
1779
|
+
*/
|
|
1780
|
+
export function getDeferredInAppMessage(): InAppMessage | null | undefined;
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* Toggle the display of Braze content cards, showing them if they are not shown, and hiding them if they are. If you
|
|
1784
|
+
* wish to display multiple content cards feeds on a page simultaneously, you should use `showContentCards` and `hideContentCards`
|
|
1785
|
+
* to show/hide each feed individually instead of this method.
|
|
1786
|
+
*
|
|
1787
|
+
* @param parentNode - The HTML node to render the content cards into. If null/undefined, the content
|
|
1788
|
+
* cards will be rendered in fixed position over the right-hand side of the page and appended to the `<body>`
|
|
1789
|
+
* node. If the parent node already has a Braze content cards view as a direct descendant, the existing content
|
|
1790
|
+
* cards will be replaced.
|
|
1791
|
+
* @param filterFunction - A filter/sort function for cards displayed in this view. Invoked with the
|
|
1792
|
+
* array of `Card` objects, sorted by {pinned, date}. Expected to return an array of sorted
|
|
1793
|
+
* `Card` objects to render for this user. If omitted, all cards will be displayed.
|
|
1794
|
+
*/
|
|
1795
|
+
export function toggleContentCards(
|
|
1796
|
+
parentNode?: Element | null,
|
|
1797
|
+
filterFunction?: (cards: Card[]) => Card[],
|
|
1798
|
+
): void;
|
|
1799
|
+
|
|
1800
|
+
/**
|
|
1801
|
+
* Toggle the Braze news feed, creating it if it does not exist, and destroying it if it does.
|
|
1802
|
+
*
|
|
1803
|
+
* @param parentNode - The HTML node to render the news feed into. If null/undefined, the feed will be
|
|
1804
|
+
* rendered in fixed position over the right-hand side of the page and appended to the `<body>` node. If the
|
|
1805
|
+
* parent node already has an Braze news feed as a direct descendant, the existing feed will be replaced.
|
|
1806
|
+
* @param cards - A static set of cards to Each item in this Array should be a `Card`
|
|
1807
|
+
* descendant. If this parameter is null/undefined, all unexpired cards from the last news feed refresh will be
|
|
1808
|
+
* used automatically, a feed refresh will be kicked off automatically if the cached cards are more than 1 minute
|
|
1809
|
+
* old, and the feed will automatically update when new cards are received while it is still showing. If you
|
|
1810
|
+
* provide an explicit set of cards by using this parameter, no action will be taken when new cards are received,
|
|
1811
|
+
* and you must subscribe to feed updates yourself with `subscribeToFeedUpdates` and request updates with
|
|
1812
|
+
* `requestFeedRefresh` if you want to update this feed with new cards.
|
|
1813
|
+
* @param allowedCategories - A set of categories to filter cards to. Each item in this Array should be a
|
|
1814
|
+
* card category as set in the Braze dashboard. If omitted, all cards will be displayed.
|
|
1815
|
+
*/
|
|
1816
|
+
export function toggleFeed(
|
|
1817
|
+
parentNode?: Element | null,
|
|
1818
|
+
cards?: Card[] | null,
|
|
1819
|
+
allowedCategories?: string[],
|
|
1820
|
+
): void;
|
|
1821
|
+
|
|
1822
|
+
/**
|
|
1823
|
+
* When a user first uses Braze on a device they are considered "anonymous". Use this method to identify a user
|
|
1824
|
+
* with a unique ID, which enables the following:
|
|
1825
|
+
*
|
|
1826
|
+
* - If the same user is identified on another device, their user profile, usage history and event history will
|
|
1827
|
+
* be shared across devices.
|
|
1828
|
+
* - If your app is used on the same browser by multiple people, you can assign each of them a unique identifier
|
|
1829
|
+
* to track them separately. Only the most recent user on a particular browser will receive push
|
|
1830
|
+
* notifications and in-app messages.
|
|
1831
|
+
*
|
|
1832
|
+
* When you request a user switch (which is any call to changeUser where the new user ID is not the same as the
|
|
1833
|
+
* existing user ID), the current session for the previous user (anonymous or not) is automatically ended and
|
|
1834
|
+
* a new session is started. Similarly, following a call to changeUser, any events which fire are guaranteed to
|
|
1835
|
+
* be for the new user -- if an in-flight server request completes for the old user after the user switch no
|
|
1836
|
+
* events will fire, so you do not need to worry about filtering out events from Braze for old users.
|
|
1837
|
+
*
|
|
1838
|
+
* Additionally, if you identify a user which has never been identified on another device, the entire history of
|
|
1839
|
+
* that user as an "anonymous" user on this device will be preserved and associated with the newly identified
|
|
1840
|
+
* user. However, if you identify a user which *has* been identified in another app, any history which was
|
|
1841
|
+
* already flushed to the server for the anonymous user on this device will become orphaned and will not be
|
|
1842
|
+
* associated with any future users. These orphaned users are not considered in your user counts and will not
|
|
1843
|
+
* be messaged.
|
|
1844
|
+
*
|
|
1845
|
+
* Note: Once you identify a user, you cannot revert to the "anonymous" user. The transition from anonymous to
|
|
1846
|
+
* identified tracking is only allowed once because the initial anonymous user receives special treatment to
|
|
1847
|
+
* allow for preservation of their history. As a result, we recommend against changing the user ID just because
|
|
1848
|
+
* your app has entered a "logged out" state because it makes you unable to target the previously logged out user
|
|
1849
|
+
* with re-engagement campaigns. If you anticipate multiple users on the same device, but only want to target one
|
|
1850
|
+
* of them when your app is in a logged out state, we recommend separately keeping track of the user ID you want
|
|
1851
|
+
* to target while logged out and switching back to that user ID as part of your app's logout process.
|
|
1852
|
+
*
|
|
1853
|
+
* @param userId - A unique identifier for this user. Limit 997 bytes.
|
|
1854
|
+
* These User IDs should be private and not easily guessable (e.g. not a plain email address or username).
|
|
1855
|
+
* @param signature - An encrypted signature to be used to authenticate the current user. You can update the signature
|
|
1856
|
+
* using the `setSdkAuthenticationSignature` method. This signature will only have an effect if the `enableSdkAuthentication`
|
|
1857
|
+
* initialization option is set to true.
|
|
1858
|
+
*/
|
|
1859
|
+
export function changeUser(userId: string, signature?: string): void;
|
|
1860
|
+
|
|
1861
|
+
/**
|
|
1862
|
+
* Destroys this `braze` instance, destroying all subscription callbacks and releasing member variables which
|
|
1863
|
+
* retain memory.
|
|
1864
|
+
*/
|
|
1865
|
+
export function destroy(): void;
|
|
1866
|
+
|
|
1867
|
+
/**
|
|
1868
|
+
* Get all currently available cards from the last content cards refresh.
|
|
1869
|
+
*
|
|
1870
|
+
* @returns - A `ContentCards` object which includes all currently available
|
|
1871
|
+
* `Card` objects from the last content cards refresh.
|
|
1872
|
+
*/
|
|
1873
|
+
export function getCachedContentCards(): ContentCards;
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* Get all unexpired cards from the last news feed refresh.
|
|
1877
|
+
*
|
|
1878
|
+
* @returns - A `Feed` object which includes all unexpired `Card` objects from the last
|
|
1879
|
+
* news feed refresh.
|
|
1880
|
+
*/
|
|
1881
|
+
export function getCachedFeed(): Feed;
|
|
1882
|
+
|
|
1883
|
+
/**
|
|
1884
|
+
* Retrieves the 'device id,' a randomly generated ID that is stored on the browser.
|
|
1885
|
+
* This ID resets for private browsing sessions and when website data is cleared. For example:
|
|
1886
|
+
*
|
|
1887
|
+
* ```
|
|
1888
|
+
* console.log('The device id is ' + braze.getDeviceId());
|
|
1889
|
+
* ```
|
|
1890
|
+
*/
|
|
1891
|
+
export function getDeviceId(): string | undefined;
|
|
1892
|
+
/**
|
|
1893
|
+
* Asynchronously retrieves the 'device id,' a randomly generated ID that is stored on the browser.
|
|
1894
|
+
* This ID resets for private browsing sessions and when website data is cleared. For example:
|
|
1895
|
+
*
|
|
1896
|
+
* ```
|
|
1897
|
+
* braze.getDeviceId(function(deviceId) {
|
|
1898
|
+
* console.log('The device id is ' + deviceId);
|
|
1899
|
+
* });
|
|
1900
|
+
* ```
|
|
1901
|
+
* @deprecated - The getDeviceId callback is deprecated. Access the method's return value directly instead.
|
|
1902
|
+
* @param callback - Asynchronous callback - this will be invoked with the deviceId.
|
|
1903
|
+
*/
|
|
1904
|
+
export function getDeviceId(callback: (deviceId: string) => void): void;
|
|
1905
|
+
|
|
1906
|
+
/**
|
|
1907
|
+
* @returns The user currently being tracked by Braze, used for querying the tracked user id and setting
|
|
1908
|
+
* user attributes. Should only be accessed via the `getUser` function. Returns undefined if the
|
|
1909
|
+
* SDK has not been initialized.
|
|
1910
|
+
*/
|
|
1911
|
+
export function getUser(): User | undefined;
|
|
1912
|
+
|
|
1913
|
+
/**
|
|
1914
|
+
* Initializes this `braze` instance with your API key. This method must be called before other Braze methods are
|
|
1915
|
+
* invoked, and is part of the default loading snippets. Subsequent calls will be ignored until 'destroy`
|
|
1916
|
+
* is called.
|
|
1917
|
+
*
|
|
1918
|
+
* @param apiKey - Your app's Braze API Key. Your API keys can be found
|
|
1919
|
+
* [here](https://dashboard.braze.com/app_settings/app_settings).
|
|
1920
|
+
* @param options - Configuration options. See `InitializationOptions` for supported options.
|
|
1921
|
+
*
|
|
1922
|
+
* @returns - Whether or not the `braze` instance has been successfully initialized.
|
|
1923
|
+
* Reasons for returning false include a missing API key/base URL, user opt out, and ignored crawler bot activity.
|
|
1924
|
+
*/
|
|
1925
|
+
export function initialize(
|
|
1926
|
+
apiKey: string,
|
|
1927
|
+
options: InitializationOptions,
|
|
1928
|
+
): boolean;
|
|
1929
|
+
|
|
1930
|
+
/**
|
|
1931
|
+
* @returns Whether or not the user has blocked push. If the user has blocked push, they cannot be
|
|
1932
|
+
* prompted to register again, and must manually remove the block in order to receive push.
|
|
1933
|
+
* Returns undefined if the SDK has not been initialized.
|
|
1934
|
+
*/
|
|
1935
|
+
export function isPushBlocked(): boolean | undefined;
|
|
1936
|
+
|
|
1937
|
+
/**
|
|
1938
|
+
* Tests whether the user has given this browser push permission (they may still be unsubscribed from push via
|
|
1939
|
+
* `User.setPushNotificationSubscriptionType`). A true value essentially means that
|
|
1940
|
+
* `requestPushPermission` may be called without the user being prompted. Useful for migrating existing
|
|
1941
|
+
* non-Braze push registrations to Braze.
|
|
1942
|
+
*
|
|
1943
|
+
* @returns Whether or not the user has granted push permission. If this returns true,
|
|
1944
|
+
* `requestPushPermission` may be called without the user being prompted. If this returns false,
|
|
1945
|
+
* `requestPushPermission` may prompt the user (if `isPushSupported` returns true) or do
|
|
1946
|
+
* nothing (if `isPushSupported` returns false). Returns undefined if the SDK has not been initialized.
|
|
1947
|
+
*/
|
|
1948
|
+
export function isPushPermissionGranted(): boolean | undefined;
|
|
1949
|
+
|
|
1950
|
+
/**
|
|
1951
|
+
* The [W3C Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API) is partially supported
|
|
1952
|
+
* across the browser landscape. This method allows you to programmatically determine whether push is supported
|
|
1953
|
+
* in the current browser, and whether to show push-related user class elements to the user.
|
|
1954
|
+
*
|
|
1955
|
+
* @returns Whether or not push is supported in this environment. Returns undefined if the SDK has not been initialized.
|
|
1956
|
+
*/
|
|
1957
|
+
export function isPushSupported(): boolean | undefined;
|
|
1958
|
+
|
|
1959
|
+
/**
|
|
1960
|
+
* Logs that the user clicked the given card. This is done automatically when you use Braze's display module
|
|
1961
|
+
* and should only be called if you're bypassing that and manually building the DOM for displaying the cards in
|
|
1962
|
+
* your own code.
|
|
1963
|
+
*
|
|
1964
|
+
* @param card - the `Card` object that received a click
|
|
1965
|
+
* @param forContentCards - whether to log this as a content cards event (as opposed to the legacy news feed)
|
|
1966
|
+
*
|
|
1967
|
+
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
1968
|
+
*/
|
|
1969
|
+
export function logCardClick(card: Card, forContentCards?: boolean): boolean;
|
|
1970
|
+
|
|
1971
|
+
/**
|
|
1972
|
+
* Logs that the user dismissed the given card. This is done automatically when you use Braze's display module
|
|
1973
|
+
* and should only be called if you're bypassing that and manually building the DOM for displaying the cards in
|
|
1974
|
+
* your own code.
|
|
1975
|
+
*
|
|
1976
|
+
* @param card - the `Card` object that received a dismissal
|
|
1977
|
+
*
|
|
1978
|
+
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
1979
|
+
*/
|
|
1980
|
+
export function logCardDismissal(card: Card): boolean;
|
|
1981
|
+
|
|
1982
|
+
/**
|
|
1983
|
+
* Logs that the user saw the given cards. This is done automatically when you use Braze's display module
|
|
1984
|
+
* and should only be called if you're bypassing that and manually building the DOM for displaying the cards in
|
|
1985
|
+
* your own code.
|
|
1986
|
+
*
|
|
1987
|
+
* @param cards - array of `Card` objects that received impressions
|
|
1988
|
+
* @param forContentCards - whether to log this as a content cards event (as opposed to the legacy news feed)
|
|
1989
|
+
*
|
|
1990
|
+
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
1991
|
+
*/
|
|
1992
|
+
export function logCardImpressions(
|
|
1993
|
+
cards: Card[],
|
|
1994
|
+
forContentCards?: boolean,
|
|
1995
|
+
): boolean;
|
|
1996
|
+
|
|
1997
|
+
/**
|
|
1998
|
+
* A convenient method to log that the user saw the given Content Cards. This method is equivalent to
|
|
1999
|
+
* calling [`logCardImpressions` method with `forContentCards` param set to true.
|
|
2000
|
+
* This is done automatically when you use Braze's display module and should only be called
|
|
2001
|
+
* if you're bypassing that and manually building the DOM for displaying content cards in
|
|
2002
|
+
* your own code.
|
|
2003
|
+
*
|
|
2004
|
+
* @param contentCards - array of `Card` objects that received impressions
|
|
2005
|
+
*
|
|
2006
|
+
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
2007
|
+
*/
|
|
2008
|
+
export function logContentCardImpressions(contentCards: Card[]): boolean;
|
|
2009
|
+
|
|
2010
|
+
/**
|
|
2011
|
+
* A convenient method to log when user clicks on a Content Card. This method is equivalent to
|
|
2012
|
+
* calling [`logCardClick` method with `forContentCards` param set to true.
|
|
2013
|
+
* This is done automatically when you use Braze's display module and should only be called
|
|
2014
|
+
* if you're bypassing that and manually building the DOM for displaying content cards in
|
|
2015
|
+
* your own code.
|
|
2016
|
+
*
|
|
2017
|
+
* @param contentCard - the `Card` object that received a click
|
|
2018
|
+
*
|
|
2019
|
+
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
2020
|
+
*/
|
|
2021
|
+
export function logContentCardClick(contentCard: Card): boolean;
|
|
2022
|
+
|
|
2023
|
+
/**
|
|
2024
|
+
* @deprecated This method has been deprecated and is currently a no-op.
|
|
2025
|
+
*/
|
|
2026
|
+
export function logContentCardsDisplayed(): boolean;
|
|
2027
|
+
|
|
2028
|
+
/**
|
|
2029
|
+
* Reports that the current user performed a custom named event.
|
|
2030
|
+
*
|
|
2031
|
+
* @param eventName - The identifier for the event to track. Value is limited to 255 characters in length,
|
|
2032
|
+
* cannot begin with a $, and can only contain alphanumeric characters and punctuation.
|
|
2033
|
+
* @param eventProperties - Hash of properties for this event. Keys are limited to 255 characters in length, cannot begin
|
|
2034
|
+
* with a $, and can only contain alphanumeric characters and punctuation. Values can be numeric, boolean, Date objects,
|
|
2035
|
+
* strings 255 characters or shorter, or nested objects whose values can be numeric, boolean, Date objects, arrays, strings,
|
|
2036
|
+
* or null. Total size of event properties cannot exceed 50KB.
|
|
2037
|
+
*
|
|
2038
|
+
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
2039
|
+
*/
|
|
2040
|
+
export function logCustomEvent(
|
|
2041
|
+
eventName: string,
|
|
2042
|
+
eventProperties?: object,
|
|
2043
|
+
): boolean;
|
|
2044
|
+
|
|
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
|
+
/**
|
|
2053
|
+
* Logs that the user clicked the given in-app message button. This is done automatically when the user clicks on
|
|
2054
|
+
* a button in a message generated by `showInAppMessage`,
|
|
2055
|
+
* and should only be called if you're bypassing that method and manually displaying the message in your own
|
|
2056
|
+
* code.
|
|
2057
|
+
*
|
|
2058
|
+
* @param button - The button clicked
|
|
2059
|
+
* @param inAppMessage - The message this button belongs to
|
|
2060
|
+
*
|
|
2061
|
+
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
2062
|
+
*/
|
|
2063
|
+
export function logInAppMessageButtonClick(
|
|
2064
|
+
button: InAppMessageButton,
|
|
2065
|
+
inAppMessage: InAppMessage,
|
|
2066
|
+
): boolean;
|
|
2067
|
+
|
|
2068
|
+
/**
|
|
2069
|
+
* Logs that the user clicked the given in-app message. This is done automatically when the user clicks on a
|
|
2070
|
+
* message generated by `showInAppMessage`, and should
|
|
2071
|
+
* only be called if you're bypassing that method and manually displaying the message in your own code.
|
|
2072
|
+
*
|
|
2073
|
+
* @param inAppMessage
|
|
2074
|
+
*
|
|
2075
|
+
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
2076
|
+
*/
|
|
2077
|
+
export function logInAppMessageClick(inAppMessage: InAppMessage): boolean;
|
|
2078
|
+
|
|
2079
|
+
/**
|
|
2080
|
+
* Logs that the user clicked on a link in an html in-app message. This is done automatically when the user clicks
|
|
2081
|
+
* on a message generated by `showInAppMessage`, and should
|
|
2082
|
+
* only be called if you're bypassing that method and manually displaying the message in your own code.
|
|
2083
|
+
*
|
|
2084
|
+
* @param inAppMessage - The message that was clicked
|
|
2085
|
+
* @param buttonId - A button id to associate this click with for analytics
|
|
2086
|
+
* @param url - The url that was clicked
|
|
2087
|
+
*
|
|
2088
|
+
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
2089
|
+
*/
|
|
2090
|
+
export function logInAppMessageHtmlClick(
|
|
2091
|
+
inAppMessage: HtmlMessage,
|
|
2092
|
+
buttonId?: string,
|
|
2093
|
+
url?: string,
|
|
2094
|
+
): boolean;
|
|
2095
|
+
|
|
2096
|
+
/**
|
|
2097
|
+
* Logs that the user saw the given in-app message. This is performed automatically when you use `showInAppMessage`,
|
|
2098
|
+
* and should only be called if you're bypassing that method and manually displaying the message in your own code.
|
|
2099
|
+
*
|
|
2100
|
+
* @param inAppMessage
|
|
2101
|
+
*
|
|
2102
|
+
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
2103
|
+
*/
|
|
2104
|
+
export function logInAppMessageImpression(
|
|
2105
|
+
inAppMessage: InAppMessage | ControlMessage,
|
|
2106
|
+
): boolean;
|
|
2107
|
+
|
|
2108
|
+
/**
|
|
2109
|
+
* Reports that the current user made an in-app purchase. Useful for tracking and segmenting users.
|
|
2110
|
+
*
|
|
2111
|
+
* @param productId - A string identifier for the product purchased, e.g. an SKU. Value is limited to
|
|
2112
|
+
* 255 characters in length, cannot begin with a $, and can only contain alphanumeric characters and punctuation.
|
|
2113
|
+
* @param price - The price paid. Base units depend on the currency. As an example, USD should be
|
|
2114
|
+
* reported as Dollars.Cents, whereas JPY should be reported as a whole number of Yen. All provided
|
|
2115
|
+
* values will be rounded to two digits with toFixed(2)
|
|
2116
|
+
* @param currencyCode - Default USD. Currencies should be represented as an ISO 4217 currency code. Supported
|
|
2117
|
+
* currency symbols include: AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF,
|
|
2118
|
+
* BMD, BND, BOB, BRL, BSD, BTC, BTN, BWP, BYR, BZD, CAD, CDF, CHF, CLF, CLP, CNY, COP, CRC, CUC, CUP, CVE,
|
|
2119
|
+
* CZK, DJF, DKK, DOP, DZD, EEK, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD,
|
|
2120
|
+
* HKD, HNL, HRK, HTG, HUF, IDR, ILS, IMP, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW,
|
|
2121
|
+
* KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MTL,
|
|
2122
|
+
* MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR,
|
|
2123
|
+
* RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, STD, SVC, SYP, SZL, THB, TJS, TMT,
|
|
2124
|
+
* TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEF, VND, VUV, WST, XAF, XAG, XAU, XCD, XDR, XOF,
|
|
2125
|
+
* XPD, XPF, XPT, YER, ZAR, ZMK, ZMW, and ZWL. Any other provided currency symbol will result in a logged
|
|
2126
|
+
* warning and no other action taken by the SDK.
|
|
2127
|
+
* @param quantity - Default 1. The quantity of items purchased expressed as a whole number. Must be at least 1
|
|
2128
|
+
* and at most 100.
|
|
2129
|
+
* @param purchaseProperties - Hash of properties for this purchase. Keys are limited to 255
|
|
2130
|
+
* characters in length, cannot begin with a $, and can only contain alphanumeric characters and punctuation.
|
|
2131
|
+
* Values can be numeric, boolean, Date objects, strings 255 characters or shorter, or nested objects whose values
|
|
2132
|
+
* can be numeric, boolean, Date objects, arrays, strings, or null. Total size of purchase properties cannot exceed 50KB.
|
|
2133
|
+
*
|
|
2134
|
+
* @returns Whether or not the purchase was successfully attached to the session (to be flushed later).
|
|
2135
|
+
*/
|
|
2136
|
+
export function logPurchase(
|
|
2137
|
+
productId: string,
|
|
2138
|
+
price: number,
|
|
2139
|
+
currencyCode?: string,
|
|
2140
|
+
quantity?: number,
|
|
2141
|
+
purchaseProperties?: object,
|
|
2142
|
+
): boolean;
|
|
2143
|
+
|
|
2144
|
+
/**
|
|
2145
|
+
* Opens a new session, or resumes the previous session if this browser had activity within the `sessionTimeoutInSeconds` value.
|
|
2146
|
+
* When a new session is opened, this refreshes In-App Messages. Content Cards are refreshed automatically if
|
|
2147
|
+
* the `subscribeToContentCardsUpdates` has been registered prior to `openSession`. If the user has previously
|
|
2148
|
+
* granted the site permission to send push, automatically sends the push registration to the Braze backend.
|
|
2149
|
+
*
|
|
2150
|
+
* Be sure to call `openSession` at the end of your initialization code section, after any calls to `changeUser` or subscribing to Content Cards,
|
|
2151
|
+
* In-App Message, and Feature Flag updates. Calling `openSession` before `changeUser` may result in a second session start event.
|
|
2152
|
+
*/
|
|
2153
|
+
export function openSession(): void;
|
|
2154
|
+
|
|
2155
|
+
/**
|
|
2156
|
+
* Register this browser environment to receive web push for this user. Supports browsers which implement the
|
|
2157
|
+
* [W3C Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API) (browsers in which
|
|
2158
|
+
* `isPushSupported` returns true). If push is supported and the user is not already subscribed,
|
|
2159
|
+
* this method will cause the browser to immediately request push permission from the user.
|
|
2160
|
+
*
|
|
2161
|
+
* In order to properly use this feature, there are some integration steps required on your end:
|
|
2162
|
+
*
|
|
2163
|
+
* - Your site must be https
|
|
2164
|
+
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
2165
|
+
*
|
|
2166
|
+
* ```
|
|
2167
|
+
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.10/service-worker.js');
|
|
2168
|
+
* ```
|
|
2169
|
+
*
|
|
2170
|
+
* For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
|
|
2171
|
+
*
|
|
2172
|
+
* @param successCallback - When the user subscribes to push successfully this callback will be
|
|
2173
|
+
* invoked with the user's endpoint, public key, and user auth key (endpoint, publicKey, userAuth).
|
|
2174
|
+
* @param deniedCallback - If push permission is denied or an error is encountered while registering, this callback will
|
|
2175
|
+
* be invoked. If the denial is temporary, it will be invoked with a parameter of `true` - otherwise it will be invoked
|
|
2176
|
+
* with a parameter of `false`.
|
|
2177
|
+
*/
|
|
2178
|
+
export function requestPushPermission(
|
|
2179
|
+
successCallback?: (
|
|
2180
|
+
endpoint: string,
|
|
2181
|
+
publicKey: string,
|
|
2182
|
+
userAuth: string,
|
|
2183
|
+
) => void,
|
|
2184
|
+
deniedCallback?: (temporaryDenial: boolean) => void,
|
|
2185
|
+
): void;
|
|
2186
|
+
|
|
2187
|
+
/**
|
|
2188
|
+
* Remove all event subscriptions.
|
|
2189
|
+
*/
|
|
2190
|
+
export function removeAllSubscriptions(): void;
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* Remove an event subscription that you previously subscribed to.
|
|
2194
|
+
*
|
|
2195
|
+
* @param subscriptionGuid - The identifier of the subscription you wish to remove, returned by the method
|
|
2196
|
+
* you initially used to create it.
|
|
2197
|
+
*/
|
|
2198
|
+
export function removeSubscription(subscriptionGuid: string): void;
|
|
2199
|
+
|
|
2200
|
+
/**
|
|
2201
|
+
* Requests an immediate refresh of content cards from Braze servers. By default, content cards are refreshed when
|
|
2202
|
+
* a new session opens (see 'openSession` for more details), and when the user refreshes content cards manually via
|
|
2203
|
+
* the refresh button. If you want to refresh content cards from the server at another time you must call this function.
|
|
2204
|
+
*
|
|
2205
|
+
* @param successCallback - Callback that is invoked when the content cards refresh request has been successfully completed.
|
|
2206
|
+
* You should use `subscribeToContentCardsUpdates` to be notified of new cards. This callback is useful for determining when
|
|
2207
|
+
* a request has completed regardless of whether new cards were returned.
|
|
2208
|
+
* @param errorCallback - Callback that is invoked when an error occurs during the refresh.
|
|
2209
|
+
*/
|
|
2210
|
+
export function requestContentCardsRefresh(
|
|
2211
|
+
successCallback?: () => void,
|
|
2212
|
+
errorCallback?: () => void,
|
|
2213
|
+
): void;
|
|
2214
|
+
|
|
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
|
+
/**
|
|
2225
|
+
* Requests an immediate refresh of feature flags from Braze servers. By default, feature flags are refreshed when
|
|
2226
|
+
* a new session starts. If you want to refresh feature flags from the server at another time you must call this function.
|
|
2227
|
+
*
|
|
2228
|
+
* @param successCallback - Callback that is invoked when the feature flags refresh request has been successfully completed.
|
|
2229
|
+
* This callback is useful for determining when a request has completed regardless of whether new feature flags were returned.
|
|
2230
|
+
* @param errorCallback - Callback that is invoked when an error occurs during the refresh.
|
|
2231
|
+
*/
|
|
2232
|
+
export function refreshFeatureFlags(
|
|
2233
|
+
successCallback?: () => void,
|
|
2234
|
+
errorCallback?: () => void,
|
|
2235
|
+
): void;
|
|
2236
|
+
|
|
2237
|
+
/**
|
|
2238
|
+
* By default, data logged to Braze through the SDK is queued locally (in HTML 5 localStorage when available, and
|
|
2239
|
+
* in memory otherwise) and sent to Braze's servers asynchronously on a regular interval (10 seconds when localStorage is available
|
|
2240
|
+
* and not routinely cleared due to browser privacy features, otherwise 3 seconds). This is done to optimize network usage and
|
|
2241
|
+
* provide resiliency against network or server outages. This method bypasses the interval and immediately flushes queued data.
|
|
2242
|
+
*
|
|
2243
|
+
* @param callback - Invoked when the flush completes with a boolean parameter that returns
|
|
2244
|
+
* whether or not the flush was successful. If the flush is unsuccessful, pending data will be
|
|
2245
|
+
* flushed during the next successful flush.
|
|
2246
|
+
*/
|
|
2247
|
+
export function requestImmediateDataFlush(
|
|
2248
|
+
callback?: (success: boolean) => void,
|
|
2249
|
+
): void;
|
|
2250
|
+
|
|
2251
|
+
/**
|
|
2252
|
+
* Removes the cookie set by `disableSDK`, causing subsequent calls to the Braze Web SDK to function. You must
|
|
2253
|
+
* call `initialize` after calling this method before calling subsequent methods.
|
|
2254
|
+
*/
|
|
2255
|
+
export function enableSDK(): void;
|
|
2256
|
+
|
|
2257
|
+
/**
|
|
2258
|
+
* Getter method to determine if the SDK is disabled based on whether the cookie set by `disableSdk` exists
|
|
2259
|
+
*/
|
|
2260
|
+
export function isDisabled(): boolean;
|
|
2261
|
+
|
|
2262
|
+
/**
|
|
2263
|
+
* By default, Braze logs to the browser console. Call this method to set a custom log action and enable debug-level log statements.
|
|
2264
|
+
*
|
|
2265
|
+
* @param loggerFunction - A function to invoke with log messages. Should accept a single string
|
|
2266
|
+
* parameter for message.
|
|
2267
|
+
*/
|
|
2268
|
+
export function setLogger(loggerFunction: (message: string) => void): void;
|
|
2269
|
+
|
|
2270
|
+
/**
|
|
2271
|
+
* Sets the signature to be used to authenticate the current user. You can also set the signature when calling `changeUser`.
|
|
2272
|
+
* This signature will only have an effect if the `enableSdkAuthentication` initialization option is set to true.
|
|
2273
|
+
*
|
|
2274
|
+
* @param signature - The signature to add to network requests to authenticate the current user.
|
|
2275
|
+
*
|
|
2276
|
+
* @returns Whether or not the signature is valid.
|
|
2277
|
+
*/
|
|
2278
|
+
export function setSdkAuthenticationSignature(signature: string): boolean;
|
|
2279
|
+
|
|
2280
|
+
/**
|
|
2281
|
+
* Adds SDK Metadata. This method is automatically called based on the integration method.
|
|
2282
|
+
*
|
|
2283
|
+
* @param sdkMetadata - An array of metadata values from `BrazeSdkMetadata`.
|
|
2284
|
+
*
|
|
2285
|
+
* @returns Whether or not the array of metadata is valid.
|
|
2286
|
+
*/
|
|
2287
|
+
export function addSdkMetadata(sdkMetadata: string[]): boolean;
|
|
2288
|
+
|
|
2289
|
+
/**
|
|
2290
|
+
* Sets a cookie that causes all subsequent calls to the Braze Web SDK to be ignored
|
|
2291
|
+
* and all subsequent analytics to cease being sent to the Braze backend.
|
|
2292
|
+
* If you have multiple subdomains, this method MUST be called from the same subdomain that push was registered from to work properly.
|
|
2293
|
+
* This is useful for customer opt-outs. If the customer clears website data, tracking will resume.
|
|
2294
|
+
*/
|
|
2295
|
+
export function disableSDK(): void;
|
|
2296
|
+
|
|
2297
|
+
/**
|
|
2298
|
+
* Subscribe to content cards updates. The subscriber callback will be called whenever content cards are updated. This method
|
|
2299
|
+
* should be called before calling `openSession`.
|
|
2300
|
+
*
|
|
2301
|
+
* @param subscriber - The callback function to handle new cards. This function will be called with a `ContentCards`
|
|
2302
|
+
* object which includes all currently available `Card` objects. If you want to be notified when a refresh has completed
|
|
2303
|
+
* regardless of whether new cards are available, you should use the `successCallback` of `requestContentCardsRefresh`.
|
|
2304
|
+
*
|
|
2305
|
+
* @returns The identifier of the subscription created. This can be passed to `removeSubscription` to cancel the subscription.
|
|
2306
|
+
* Returns undefined if the SDK has not been initialized.
|
|
2307
|
+
*/
|
|
2308
|
+
export function subscribeToContentCardsUpdates(
|
|
2309
|
+
subscriber: (cards: ContentCards) => void,
|
|
2310
|
+
): string | undefined;
|
|
2311
|
+
|
|
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
|
+
/**
|
|
2326
|
+
* Subscribe to receive in-app messages. The subscriber callback will be called whenever a new in-app message is
|
|
2327
|
+
* triggered. This method should be called before calling `openSession`. If you are using the build of Braze's
|
|
2328
|
+
* library with UI, the most basic usage of this would be
|
|
2329
|
+
*
|
|
2330
|
+
* ```
|
|
2331
|
+
* braze.subscribeToInAppMessage(function(inAppMessage) {
|
|
2332
|
+
* braze.showInAppMessage(inAppMessage);
|
|
2333
|
+
* });
|
|
2334
|
+
* ```
|
|
2335
|
+
* @param callback - The callback function to handle the in-app message. This function will be
|
|
2336
|
+
* called with an `InAppMessage` or a `ControlMessage` object. If you are using the build
|
|
2337
|
+
* of Braze's library with UI, you may wish to call `showInAppMessage`
|
|
2338
|
+
* with the provided message.
|
|
2339
|
+
*
|
|
2340
|
+
* @returns The identifier of the subscription created. This can be passed to 'removeSubscription` to cancel
|
|
2341
|
+
* the subscription. Returns undefined if the SDK has not been initialized.
|
|
2342
|
+
*/
|
|
2343
|
+
export function subscribeToInAppMessage(
|
|
2344
|
+
callback: (inAppMessage: InAppMessage | ControlMessage) => void,
|
|
2345
|
+
): string | undefined;
|
|
2346
|
+
|
|
2347
|
+
/**
|
|
2348
|
+
* Subscribe to be notified of network request failures that occured due to an SDK Authentication error. This
|
|
2349
|
+
* method can be used to determine when to call `setSdkAuthenticationSignature` to provide the SDK with a new signature.
|
|
2350
|
+
* If you do not have SDK Authentication enabled on the Braze dashboard, this subscription will never be invoked.
|
|
2351
|
+
*
|
|
2352
|
+
* @param subscriber - The subscriber function that is invoked whenever an SDK Authentication error occurs. It is
|
|
2353
|
+
* invoked with an object containing the `errorCode`, `reason` for the error, the `userId` of the request (if the
|
|
2354
|
+
* user is not anonymous), and the authentication `signature` that caused the error.
|
|
2355
|
+
*
|
|
2356
|
+
* @returns The identifier of the subscription created. This can be passed to 'removeSubscription` to cancel
|
|
2357
|
+
* the subscription. Returns undefined if the SDK has not been initialized.
|
|
2358
|
+
*/
|
|
2359
|
+
export function subscribeToSdkAuthenticationFailures(
|
|
2360
|
+
subscriber: (error: {
|
|
2361
|
+
errorCode: number;
|
|
2362
|
+
reason?: string;
|
|
2363
|
+
userId?: string;
|
|
2364
|
+
signature?: string;
|
|
2365
|
+
}) => void,
|
|
2366
|
+
): string | undefined;
|
|
2367
|
+
|
|
2368
|
+
/**
|
|
2369
|
+
* By default, Braze silences its logging to prevent spamming production js consoles. Call this method to
|
|
2370
|
+
* toggle logging.
|
|
2371
|
+
*/
|
|
2372
|
+
export function toggleLogging(): void;
|
|
2373
|
+
|
|
2374
|
+
/**
|
|
2375
|
+
* Unregisters push notifications on this browser.
|
|
2376
|
+
* Note that for Safari, Apple does not offer any unsubscribe mechanism, so on Safari this method leaves the user
|
|
2377
|
+
* with push permission granted and simply sets their subscription status to unsubscribed.
|
|
2378
|
+
*
|
|
2379
|
+
* @param successCallback - When the unsubscribe is successfully recorded and processed by Braze, this
|
|
2380
|
+
* callback will be invoked.
|
|
2381
|
+
* @param errorCallback - If the unsubscribe fails for unknown reasons, this callback will be invoked.
|
|
2382
|
+
*/
|
|
2383
|
+
export function unregisterPush(
|
|
2384
|
+
successCallback?: () => void,
|
|
2385
|
+
errorCallback?: () => void,
|
|
2386
|
+
): void;
|
|
2387
|
+
|
|
2388
|
+
/**
|
|
2389
|
+
* Removes all locally stored SDK data, causing the user to be seen in subsequent calls as a new anonymous user on a new device.
|
|
2390
|
+
*/
|
|
2391
|
+
export function wipeData(): void;
|
|
2392
|
+
|
|
2393
|
+
/**
|
|
2394
|
+
* Handle links from within a message. This method will redirect valid links, or will parse and handle valid Braze Click Actions (brazeActions://).
|
|
2395
|
+
* @param url - a valid URL, or a valid brazeActions URL with scheme brazeActions://v{versionInt}/{base64string}
|
|
2396
|
+
* @param openLinkInNewTab - Whether the URL should be opened in a new tab. Defaults to false.
|
|
2397
|
+
*/
|
|
2398
|
+
export function handleBrazeAction(
|
|
2399
|
+
url: string,
|
|
2400
|
+
openLinkInNewTab?: boolean,
|
|
2401
|
+
): void;
|
|
2402
|
+
|
|
2403
|
+
/**
|
|
2404
|
+
* Gets a feature flag by its ID.
|
|
2405
|
+
*
|
|
2406
|
+
* @param id - The ID of the feature flag.
|
|
2407
|
+
* @returns - An object of type `FeatureFlag`.
|
|
2408
|
+
*/
|
|
2409
|
+
export function getFeatureFlag(id: string): FeatureFlag;
|
|
2410
|
+
|
|
2411
|
+
/**
|
|
2412
|
+
* Subscribe to feature flag updates. The subscriber callback will be called whenever feature flags are updated. This method
|
|
2413
|
+
* should be called before calling `openSession`.
|
|
2414
|
+
*
|
|
2415
|
+
* @param subscriber - The callback function to handle new feature flags. This function is always called first with the
|
|
2416
|
+
* available cached list of `FeatureFlag` objects, and will also be called when feature flag updates are available.
|
|
2417
|
+
* If you want to be notified when a refresh has completed
|
|
2418
|
+
* regardless of whether new feature flags are available, you should use the `successCallback` of `refreshFeatureFlags`.
|
|
2419
|
+
*
|
|
2420
|
+
* @returns The identifier of the subscription created. This can be passed to `removeSubscription` to cancel the subscription.
|
|
2421
|
+
* Returns undefined if the SDK has not been initialized.
|
|
2422
|
+
*/
|
|
2423
|
+
export function subscribeToFeatureFlagsUpdates(
|
|
2424
|
+
subscriber: (featureFlags: FeatureFlag[]) => void,
|
|
2425
|
+
): string | undefined;
|
|
2426
|
+
|
|
2427
|
+
/**
|
|
2428
|
+
* Gets all available feature flags.
|
|
2429
|
+
*
|
|
2430
|
+
* @returns - A list of `FeatureFlag` objects.
|
|
2431
|
+
*/
|
|
2432
|
+
export function getAllFeatureFlags(): FeatureFlag[];
|
|
2433
|
+
|
|
2434
|
+
/**
|
|
2435
|
+
* Logs impression for a given feature flag.
|
|
2436
|
+
*
|
|
2437
|
+
* @param featureFlagId - ID of the feature flag that has received the impression.
|
|
2438
|
+
*
|
|
2439
|
+
* @returns - Whether or not the impression was successfully logged. Returns undefined if the SDK has not been initialized.
|
|
2440
|
+
*/
|
|
2441
|
+
export function logFeatureFlagImpression(
|
|
2442
|
+
featureFlagId: string,
|
|
2443
|
+
): boolean | undefined;
|
|
2444
|
+
|
|
2445
|
+
/**
|
|
2446
|
+
* Supported initialization options
|
|
2447
|
+
*
|
|
2448
|
+
*/
|
|
2449
|
+
export type InitializationOptions = {
|
|
2034
2450
|
/**
|
|
2035
|
-
*
|
|
2451
|
+
* By default, the Braze Web SDK ignores activity from known spiders or web crawlers, such as Google, based
|
|
2452
|
+
* on the user agent string. This saves data points, makes analytics more accurate, and may improve page rank.
|
|
2453
|
+
* However, if you want Braze to log activity from these crawlers instead, you may set this option to true.
|
|
2036
2454
|
*/
|
|
2037
|
-
|
|
2038
|
-
|
|
2455
|
+
allowCrawlerActivity?: boolean;
|
|
2039
2456
|
/**
|
|
2040
|
-
*
|
|
2041
|
-
*
|
|
2042
|
-
*
|
|
2043
|
-
*
|
|
2457
|
+
* By default, the Braze Web SDK does not allow user-supplied Javascript click actions, as it allows Braze dashboard
|
|
2458
|
+
* users to run Javascript on your site. To indicate that you trust the Braze dashboard users to write non-malicious
|
|
2459
|
+
* Javascript click actions, set this property to true. If `enableHtmlInAppMessages` is true, this option will also be
|
|
2460
|
+
* set to true.
|
|
2044
2461
|
*/
|
|
2045
|
-
|
|
2046
|
-
|
|
2462
|
+
allowUserSuppliedJavascript?: boolean;
|
|
2047
2463
|
/**
|
|
2048
|
-
*
|
|
2049
|
-
*
|
|
2050
|
-
* the refresh button. If you want to refresh content cards from the server at another time you must call this function.
|
|
2051
|
-
*
|
|
2052
|
-
* @param successCallback - Callback that is invoked when the content cards refresh request has been successfully completed.
|
|
2053
|
-
* You should use `subscribeToContentCardsUpdates` to be notified of new cards. This callback is useful for determining when
|
|
2054
|
-
* a request has completed regardless of whether new cards were returned.
|
|
2055
|
-
* @param errorCallback - Callback that is invoked when an error occurs during the refresh.
|
|
2464
|
+
* If you provide a value for this option, user events sent to Braze will be associated with the given version, which can be
|
|
2465
|
+
* used for user segmentation.
|
|
2056
2466
|
*/
|
|
2057
|
-
|
|
2058
|
-
|
|
2467
|
+
appVersion?: string;
|
|
2059
2468
|
/**
|
|
2060
|
-
*
|
|
2061
|
-
*
|
|
2062
|
-
* `showFeed` for details). If you want to refresh the feed from the
|
|
2063
|
-
* server at another time you must call this function. Results of this refresh are reported asynchronously to
|
|
2064
|
-
* subscriptions created via 'subscribeToFeedUpdates` .
|
|
2469
|
+
* A numerical app version value which can be used for user segmentation. This value must be sent with four fields, such as
|
|
2470
|
+
* "1.2.3.4", otherwise it will be ignored.
|
|
2065
2471
|
*/
|
|
2066
|
-
|
|
2067
|
-
|
|
2472
|
+
appVersionNumber?: string;
|
|
2068
2473
|
/**
|
|
2069
|
-
*
|
|
2070
|
-
*
|
|
2071
|
-
*
|
|
2072
|
-
*
|
|
2073
|
-
* This callback is useful for determining when a request has completed regardless of whether new feature flags were returned.
|
|
2074
|
-
* @param errorCallback - Callback that is invoked when an error occurs during the refresh.
|
|
2474
|
+
* This option is required to configure the Braze Web SDK to use the appropriate endpoint for your integration - for example:
|
|
2475
|
+
* ```
|
|
2476
|
+
* braze.initialize('YOUR-API-KEY-HERE', { baseUrl: 'sdk.iad-03.braze.com' })
|
|
2477
|
+
* ```
|
|
2075
2478
|
*/
|
|
2076
|
-
|
|
2077
|
-
|
|
2479
|
+
baseUrl: string;
|
|
2078
2480
|
/**
|
|
2079
|
-
*
|
|
2080
|
-
*
|
|
2081
|
-
*
|
|
2082
|
-
*
|
|
2083
|
-
*
|
|
2084
|
-
* @param callback - Invoked when the flush completes with a boolean parameter that returns
|
|
2085
|
-
* whether or not the flush was successful. If the flush is unsuccessful, pending data will be
|
|
2086
|
-
* flushed during the next successful flush.
|
|
2481
|
+
* If you provide a value for this option, the Braze SDK will add the nonce to any `<script>` and `<style>` elements created by
|
|
2482
|
+
* the SDK. This can be used to permit the Braze SDK to work with your website's [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP).
|
|
2483
|
+
* Note that in addition to setting this nonce, you may also need to allow FontAwesome to load, which you can do by either adding
|
|
2484
|
+
* `use.fontawesome.com` to your Content Security Policy allowlist or by using the `doNotLoadFontAwesome` option and loading it manually.
|
|
2087
2485
|
*/
|
|
2088
|
-
|
|
2089
|
-
callback?: (success: boolean) => void
|
|
2090
|
-
): void;
|
|
2091
|
-
|
|
2486
|
+
contentSecurityNonce?: string;
|
|
2092
2487
|
/**
|
|
2093
|
-
*
|
|
2094
|
-
*
|
|
2488
|
+
* By default, the Braze SDK automatically detects and collects all device properties in `DeviceProperties`. To override
|
|
2489
|
+
* this behavior, provide an array of `DeviceProperties`. To disable all properties being sent to Braze servers, provide
|
|
2490
|
+
* an empty array. Note that without some properties, not all features will function properly. For instance, without the time
|
|
2491
|
+
* zone, local timezone delivery will not function.
|
|
2095
2492
|
*/
|
|
2096
|
-
|
|
2097
|
-
|
|
2493
|
+
devicePropertyAllowlist?: string[];
|
|
2098
2494
|
/**
|
|
2099
|
-
*
|
|
2495
|
+
* By default, users who have already granted web push permission (e.g. through `requestPushPermission` or from
|
|
2496
|
+
* a prior push provider) will sync their push token with the Braze backend automatically on new session to ensure deliverability.
|
|
2497
|
+
* To disable this behavior, set this option to true.
|
|
2100
2498
|
*/
|
|
2101
|
-
|
|
2102
|
-
|
|
2499
|
+
disablePushTokenMaintenance?: boolean;
|
|
2103
2500
|
/**
|
|
2104
|
-
*
|
|
2105
|
-
*
|
|
2106
|
-
*
|
|
2107
|
-
*
|
|
2501
|
+
* Braze uses [Font Awesome](http://fontawesome.io) for in-app message icons. By default, Braze will automatically load
|
|
2502
|
+
* FontAwesome 4.7.0 from the FontAwesome CDN. To disable this behavior (e.g. because your site uses a customized version
|
|
2503
|
+
* of FontAwesome), set this option to `true`. Note that if you do this, you are responsible for ensuring that FontAwesome
|
|
2504
|
+
* is loaded on your site - otherwise in-app messages may not render correctly.
|
|
2108
2505
|
*/
|
|
2109
|
-
|
|
2110
|
-
|
|
2506
|
+
doNotLoadFontAwesome?: boolean;
|
|
2111
2507
|
/**
|
|
2112
|
-
*
|
|
2113
|
-
*
|
|
2114
|
-
*
|
|
2115
|
-
* @param signature - The signature to add to network requests to authenticate the current user.
|
|
2508
|
+
* By default, the Braze Web SDK does not enable HTML in-app messages, as they allow Braze dashboard users to run Javascript
|
|
2509
|
+
* on your site. To indicate that you trust the Braze dashboard users to write non-malicious HTML in-app messages, set this
|
|
2510
|
+
* property to true. If `allowUserSuppliedJavascript` is set to true, this option will also be set to true.
|
|
2116
2511
|
*
|
|
2117
|
-
* @
|
|
2512
|
+
* @deprecated This initialization option is deprecated in favor of `allowUserSuppliedJavascript`.
|
|
2118
2513
|
*/
|
|
2119
|
-
|
|
2120
|
-
|
|
2514
|
+
enableHtmlInAppMessages?: boolean;
|
|
2121
2515
|
/**
|
|
2122
|
-
*
|
|
2123
|
-
*
|
|
2124
|
-
*
|
|
2125
|
-
*
|
|
2126
|
-
* @returns Whether or not the array of metadata is valid.
|
|
2516
|
+
* Set to true to enable logging by default. Note that this will cause Braze to log to the javascript console, which is visible
|
|
2517
|
+
* to all users! You should probably remove this or provide an alternate logger with `setLogger` before you release
|
|
2518
|
+
* your page to production.
|
|
2127
2519
|
*/
|
|
2128
|
-
|
|
2129
|
-
|
|
2520
|
+
enableLogging?: boolean;
|
|
2130
2521
|
/**
|
|
2131
|
-
*
|
|
2132
|
-
*
|
|
2133
|
-
* If you have multiple subdomains, this method MUST be called from the same subdomain that push was registered from to work properly.
|
|
2134
|
-
* This is useful for customer opt-outs. If the customer clears website data, tracking will resume.
|
|
2522
|
+
* Set to true to enable the SDK Authentication feature. For more information about SDK Authentication, see our
|
|
2523
|
+
* [Product Documentation](https://www.braze.com/docs/developer_guide/platform_wide/sdk_authentication/).
|
|
2135
2524
|
*/
|
|
2136
|
-
|
|
2137
|
-
|
|
2525
|
+
enableSdkAuthentication?: boolean;
|
|
2138
2526
|
/**
|
|
2139
|
-
*
|
|
2140
|
-
*
|
|
2141
|
-
*
|
|
2142
|
-
* @param subscriber - The callback function to handle new cards. This function will be called with a `ContentCards`
|
|
2143
|
-
* object which includes all currently available `Card` objects. If you want to be notified when a refresh has completed
|
|
2144
|
-
* regardless of whether new cards are available, you should use the `successCallback` of `requestContentCardsRefresh`.
|
|
2145
|
-
*
|
|
2146
|
-
* @returns The identifier of the subscription created. This can be passed to `removeSubscription` to cancel the subscription.
|
|
2147
|
-
* Returns undefined if the SDK has not been initialized.
|
|
2527
|
+
* 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,
|
|
2528
|
+
* and 9021 for the message's close button. Provide a value for this option to override these default z-indexes. The value provided
|
|
2529
|
+
* 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.
|
|
2148
2530
|
*/
|
|
2149
|
-
|
|
2150
|
-
subscriber: (cards: ContentCards) => void
|
|
2151
|
-
): string | undefined;
|
|
2152
|
-
|
|
2531
|
+
inAppMessageZIndex?: number;
|
|
2153
2532
|
/**
|
|
2154
|
-
*
|
|
2155
|
-
*
|
|
2156
|
-
*
|
|
2157
|
-
*
|
|
2158
|
-
*
|
|
2159
|
-
* @returns The identifier of the subscription created. This can be passed to `removeSubscription` to cancel
|
|
2160
|
-
* the subscription. Returns undefined if the SDK has not been initialized.
|
|
2533
|
+
* By default, any SDK-generated user-visible messages will be displayed in the user's browser language. Provide a value for this
|
|
2534
|
+
* option to override that behavior and force a specific language. The value for this option should be a
|
|
2535
|
+
* [ISO 639-1 Language Code](https://www.w3schools.com/tags/ref_language_codes.asp). If a desired localization is not available,
|
|
2536
|
+
* the SDK will default to English. See also `User.setLanguage` for setting the language you use within the Braze dashboard to
|
|
2537
|
+
* localize your own messaging content.
|
|
2161
2538
|
*/
|
|
2162
|
-
|
|
2163
|
-
subscriber: (feed: Feed) => void
|
|
2164
|
-
): string | undefined;
|
|
2165
|
-
|
|
2539
|
+
localization?: string;
|
|
2166
2540
|
/**
|
|
2167
|
-
*
|
|
2168
|
-
*
|
|
2169
|
-
*
|
|
2170
|
-
*
|
|
2171
|
-
*
|
|
2172
|
-
*
|
|
2173
|
-
*
|
|
2174
|
-
* });
|
|
2175
|
-
* ```
|
|
2176
|
-
* @param callback - The callback function to handle the in-app message. This function will be
|
|
2177
|
-
* called with an `InAppMessage` or a `ControlMessage` object. If you are using the build
|
|
2178
|
-
* of Braze's library with UI, you may wish to call `showInAppMessage`
|
|
2179
|
-
* with the provided message.
|
|
2180
|
-
*
|
|
2181
|
-
* @returns The identifier of the subscription created. This can be passed to 'removeSubscription` to cancel
|
|
2182
|
-
* the subscription. Returns undefined if the SDK has not been initialized.
|
|
2541
|
+
* By default, `requestPushPermission`/`unregisterPush` assume that they control and can
|
|
2542
|
+
* register and unregister the site's service worker. If you have your own service worker that you register and control the
|
|
2543
|
+
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2544
|
+
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2545
|
+
* `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
|
|
2546
|
+
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.10/service-worker.js');` or by including the content
|
|
2547
|
+
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2183
2548
|
*/
|
|
2184
|
-
|
|
2185
|
-
callback: (
|
|
2186
|
-
inAppMessage: InAppMessage | ControlMessage
|
|
2187
|
-
) => void
|
|
2188
|
-
): string | undefined;
|
|
2189
|
-
|
|
2549
|
+
manageServiceWorkerExternally?: boolean;
|
|
2190
2550
|
/**
|
|
2191
|
-
*
|
|
2192
|
-
*
|
|
2193
|
-
*
|
|
2194
|
-
*
|
|
2195
|
-
* @param subscriber - The subscriber function that is invoked whenever an SDK Authentication error occurs. It is
|
|
2196
|
-
* invoked with an object containing the `errorCode`, `reason` for the error, the `userId` of the request (if the
|
|
2197
|
-
* user is not anonymous), and the authentication `signature` that caused the error.
|
|
2198
|
-
*
|
|
2199
|
-
* @returns The identifier of the subscription created. This can be passed to 'removeSubscription` to cancel
|
|
2200
|
-
* the subscription. Returns undefined if the SDK has not been initialized.
|
|
2551
|
+
* By default, a trigger action will only fire if at least 30 seconds have elapsed since the last trigger action. Provide a
|
|
2552
|
+
* value for this configuration option to override that default with a value of your own. We do not recommend making this
|
|
2553
|
+
* value any smaller than 10 to avoid spamming the user with notifications.
|
|
2201
2554
|
*/
|
|
2202
|
-
|
|
2203
|
-
error: {
|
|
2204
|
-
errorCode: number,
|
|
2205
|
-
reason?: string,
|
|
2206
|
-
userId?: string,
|
|
2207
|
-
signature?: string
|
|
2208
|
-
}
|
|
2209
|
-
) => void): string | undefined;
|
|
2210
|
-
|
|
2211
|
-
/**
|
|
2212
|
-
* By default, Braze silences its logging to prevent spamming production js consoles. Call this method to
|
|
2213
|
-
* toggle logging.
|
|
2214
|
-
*/
|
|
2215
|
-
export function toggleLogging(): void;
|
|
2216
|
-
|
|
2555
|
+
minimumIntervalBetweenTriggerActionsInSeconds?: number;
|
|
2217
2556
|
/**
|
|
2218
|
-
*
|
|
2219
|
-
*
|
|
2220
|
-
*
|
|
2221
|
-
*
|
|
2222
|
-
* @param successCallback - When the unsubscribe is successfully recorded and processed by Braze, this
|
|
2223
|
-
* callback will be invoked.
|
|
2224
|
-
* @param errorCallback - If the unsubscribe fails for unknown reasons, this callback will be invoked.
|
|
2557
|
+
* By default, the Braze SDK will store small amounts of data (user ids, session ids), in cookies. This is done to allow Braze
|
|
2558
|
+
* to recognize users and sessions across different subdomains of your site. If this presents a problem for you, pass `true`
|
|
2559
|
+
* for this option to disable cookie storage and rely entirely on HTML 5 localStorage to identify users and sessions. The downside
|
|
2560
|
+
* of this configuration is that you will be unable to recognize users across subdomains of your site.
|
|
2225
2561
|
*/
|
|
2226
|
-
|
|
2227
|
-
successCallback?: () => void,
|
|
2228
|
-
errorCallback?: () => void
|
|
2229
|
-
): void;
|
|
2230
|
-
|
|
2562
|
+
noCookies?: boolean;
|
|
2231
2563
|
/**
|
|
2232
|
-
*
|
|
2564
|
+
* By default, links from in-app message clicks load in the current tab or a new tab as specified in the dashboard on a
|
|
2565
|
+
* message-by-message basis. Set this option to `true` to force all links from in-app message clicks open in a new tab or window.
|
|
2233
2566
|
*/
|
|
2234
|
-
|
|
2235
|
-
|
|
2567
|
+
openInAppMessagesInNewTab?: boolean;
|
|
2236
2568
|
/**
|
|
2237
|
-
*
|
|
2238
|
-
*
|
|
2239
|
-
* @param openLinkInNewTab - Whether the URL should be opened in a new tab. Defaults to false.
|
|
2569
|
+
* By default, links from `Card` objects load in the current tab or window. Set this option to `true` to make links from
|
|
2570
|
+
* cards open in a new tab or window.
|
|
2240
2571
|
*/
|
|
2241
|
-
|
|
2242
|
-
|
|
2572
|
+
openCardsInNewTab?: boolean;
|
|
2243
2573
|
/**
|
|
2244
|
-
*
|
|
2245
|
-
*
|
|
2246
|
-
*
|
|
2247
|
-
* @returns - An object of type `FeatureFlag`.
|
|
2574
|
+
* By default, when an in-app message is showing, pressing the escape button or a click on the greyed-out background of the
|
|
2575
|
+
* page will dismiss the message. Set this option to `true` to prevent this behavior and require an explicit button click
|
|
2576
|
+
* to dismiss messages.
|
|
2248
2577
|
*/
|
|
2249
|
-
|
|
2250
|
-
|
|
2578
|
+
requireExplicitInAppMessageDismissal?: boolean;
|
|
2251
2579
|
/**
|
|
2252
|
-
*
|
|
2253
|
-
*
|
|
2254
|
-
*
|
|
2255
|
-
* @param subscriber - The callback function to handle new feature flags. This function is always called first with the
|
|
2256
|
-
* available cached list of `FeatureFlag` objects, and will also be called when feature flag updates are available.
|
|
2257
|
-
* If you want to be notified when a refresh has completed
|
|
2258
|
-
* regardless of whether new feature flags are available, you should use the `successCallback` of `refreshFeatureFlags`.
|
|
2259
|
-
*
|
|
2260
|
-
* @returns The identifier of the subscription created. This can be passed to `removeSubscription` to cancel the subscription.
|
|
2261
|
-
* Returns undefined if the SDK has not been initialized.
|
|
2580
|
+
* If you support Safari push, you must specify this option with the website push ID that you provided to Apple when creating
|
|
2581
|
+
* your Safari push certificate (starts with "web", e.g. "web.com.example.domain").
|
|
2262
2582
|
*/
|
|
2263
|
-
|
|
2264
|
-
subscriber: (featureFlags: FeatureFlag[]) => void
|
|
2265
|
-
): string | undefined;
|
|
2266
|
-
|
|
2583
|
+
safariWebsitePushId?: string;
|
|
2267
2584
|
/**
|
|
2268
|
-
*
|
|
2269
|
-
*
|
|
2270
|
-
*
|
|
2585
|
+
* By default, when registering users for web push notifications Braze will look for the required service worker file in the
|
|
2586
|
+
* root directory of your web server at `/service-worker.js`. If you want to host your service worker at a different path
|
|
2587
|
+
* on that server, provide a value for this option that is the absolute path to the file, e.g. `/mycustompath/my-worker.js`.
|
|
2588
|
+
* VERY IMPORTANT: setting a value here limits the scope of push notifications on your site. For instance, in the above
|
|
2589
|
+
* example, because the service worker file is located within the `/mycustompath/` directory, `requestPushPermission`
|
|
2590
|
+
* MAY ONLY BE CALLED from web pages that start with `http://yoursite.com/mycustompath/`.
|
|
2271
2591
|
*/
|
|
2272
|
-
|
|
2273
|
-
|
|
2592
|
+
serviceWorkerLocation?: string;
|
|
2274
2593
|
/**
|
|
2275
|
-
*
|
|
2276
|
-
*
|
|
2594
|
+
* By default, sessions time out after 30 minutes of inactivity. Provide a value for this configuration option to override that
|
|
2595
|
+
* default with a value of your own.
|
|
2277
2596
|
*/
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
* By default, the Braze Web SDK ignores activity from known spiders or web crawlers, such as Google, based
|
|
2281
|
-
* on the user agent string. This saves data points, makes analytics more accurate, and may improve page rank.
|
|
2282
|
-
* However, if you want Braze to log activity from these crawlers instead, you may set this option to true.
|
|
2283
|
-
*/
|
|
2284
|
-
allowCrawlerActivity?: boolean;
|
|
2285
|
-
/**
|
|
2286
|
-
* By default, the Braze Web SDK does not allow user-supplied Javascript click actions, as it allows Braze dashboard
|
|
2287
|
-
* users to run Javascript on your site. To indicate that you trust the Braze dashboard users to write non-malicious
|
|
2288
|
-
* Javascript click actions, set this property to true. If `enableHtmlInAppMessages` is true, this option will also be
|
|
2289
|
-
* set to true.
|
|
2290
|
-
*/
|
|
2291
|
-
allowUserSuppliedJavascript?: boolean;
|
|
2292
|
-
/**
|
|
2293
|
-
* If you provide a value for this option, user events sent to Braze will be associated with the given version, which can be
|
|
2294
|
-
* used for user segmentation.
|
|
2295
|
-
*/
|
|
2296
|
-
appVersion?: string;
|
|
2297
|
-
/**
|
|
2298
|
-
* This option is required to configure the Braze Web SDK to use the appropriate endpoint for your integration - for example:
|
|
2299
|
-
* ```
|
|
2300
|
-
* braze.initialize('YOUR-API-KEY-HERE', { baseUrl: 'sdk.iad-03.braze.com' })
|
|
2301
|
-
* ```
|
|
2302
|
-
*/
|
|
2303
|
-
baseUrl: string;
|
|
2304
|
-
/**
|
|
2305
|
-
* If you provide a value for this option, the Braze SDK will add the nonce to any `<script>` and `<style>` elements created by
|
|
2306
|
-
* the SDK. This can be used to permit the Braze SDK to work with your website's [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP).
|
|
2307
|
-
* Note that in addition to setting this nonce, you may also need to allow FontAwesome to load, which you can do by either adding
|
|
2308
|
-
* `use.fontawesome.com` to your Content Security Policy allowlist or by using the `doNotLoadFontAwesome` option and loading it manually.
|
|
2309
|
-
*/
|
|
2310
|
-
contentSecurityNonce?: string;
|
|
2311
|
-
/**
|
|
2312
|
-
* By default, the Braze SDK automatically detects and collects all device properties in `DeviceProperties`. To override
|
|
2313
|
-
* this behavior, provide an array of `DeviceProperties`. To disable all properties being sent to Braze servers, provide
|
|
2314
|
-
* an empty array. Note that without some properties, not all features will function properly. For instance, without the time
|
|
2315
|
-
* zone, local timezone delivery will not function.
|
|
2316
|
-
*/
|
|
2317
|
-
devicePropertyAllowlist?: string[];
|
|
2318
|
-
/**
|
|
2319
|
-
* By default, users who have already granted web push permission (e.g. through `requestPushPermission` or from
|
|
2320
|
-
* a prior push provider) will sync their push token with the Braze backend automatically on new session to ensure deliverability.
|
|
2321
|
-
* To disable this behavior, set this option to true.
|
|
2322
|
-
*/
|
|
2323
|
-
disablePushTokenMaintenance?: boolean;
|
|
2324
|
-
/**
|
|
2325
|
-
* Braze uses [Font Awesome](http://fontawesome.io) for in-app message icons. By default, Braze will automatically load
|
|
2326
|
-
* FontAwesome 4.7.0 from the FontAwesome CDN. To disable this behavior (e.g. because your site uses a customized version
|
|
2327
|
-
* of FontAwesome), set this option to `true`. Note that if you do this, you are responsible for ensuring that FontAwesome
|
|
2328
|
-
* is loaded on your site - otherwise in-app messages may not render correctly.
|
|
2329
|
-
*/
|
|
2330
|
-
doNotLoadFontAwesome?: boolean;
|
|
2331
|
-
/**
|
|
2332
|
-
* By default, the Braze Web SDK does not enable HTML in-app messages, as they allow Braze dashboard users to run Javascript
|
|
2333
|
-
* on your site. To indicate that you trust the Braze dashboard users to write non-malicious HTML in-app messages, set this
|
|
2334
|
-
* property to true. If `allowUserSuppliedJavascript` is set to true, this option will also be set to true.
|
|
2335
|
-
*
|
|
2336
|
-
* @deprecated This initialization option is deprecated in favor of `allowUserSuppliedJavascript`.
|
|
2337
|
-
*/
|
|
2338
|
-
enableHtmlInAppMessages?: boolean;
|
|
2339
|
-
/**
|
|
2340
|
-
* Set to true to enable logging by default. Note that this will cause Braze to log to the javascript console, which is visible
|
|
2341
|
-
* to all users! You should probably remove this or provide an alternate logger with `setLogger` before you release
|
|
2342
|
-
* your page to production.
|
|
2343
|
-
*/
|
|
2344
|
-
enableLogging?: boolean;
|
|
2345
|
-
/**
|
|
2346
|
-
* Set to true to enable the SDK Authentication feature. For more information about SDK Authentication, see our
|
|
2347
|
-
* [Product Documentation](https://www.braze.com/docs/developer_guide/platform_wide/sdk_authentication/).
|
|
2348
|
-
*/
|
|
2349
|
-
enableSdkAuthentication?: boolean
|
|
2350
|
-
/**
|
|
2351
|
-
* 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,
|
|
2352
|
-
* and 9021 for the message's close button. Provide a value for this option to override these default z-indexes. The value provided
|
|
2353
|
-
* 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.
|
|
2354
|
-
*/
|
|
2355
|
-
inAppMessageZIndex?: number
|
|
2356
|
-
/**
|
|
2357
|
-
* By default, any SDK-generated user-visible messages will be displayed in the user's browser language. Provide a value for this
|
|
2358
|
-
* option to override that behavior and force a specific language. The value for this option should be a
|
|
2359
|
-
* [ISO 639-1 Language Code](https://www.w3schools.com/tags/ref_language_codes.asp). If a desired localization is not available,
|
|
2360
|
-
* the SDK will default to English. See also `User.setLanguage` for setting the language you use within the Braze dashboard to
|
|
2361
|
-
* localize your own messaging content.
|
|
2362
|
-
*/
|
|
2363
|
-
localization?: string;
|
|
2364
|
-
/**
|
|
2365
|
-
* By default, `requestPushPermission`/`unregisterPush` assume that they control and can
|
|
2366
|
-
* register and unregister the site's service worker. If you have your own service worker that you register and control the
|
|
2367
|
-
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2368
|
-
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2369
|
-
* `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
|
|
2370
|
-
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.8/service-worker.js');` or by including the content
|
|
2371
|
-
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2372
|
-
*/
|
|
2373
|
-
manageServiceWorkerExternally?: boolean;
|
|
2374
|
-
/**
|
|
2375
|
-
* By default, a trigger action will only fire if at least 30 seconds have elapsed since the last trigger action. Provide a
|
|
2376
|
-
* value for this configuration option to override that default with a value of your own. We do not recommend making this
|
|
2377
|
-
* value any smaller than 10 to avoid spamming the user with notifications.
|
|
2378
|
-
*/
|
|
2379
|
-
minimumIntervalBetweenTriggerActionsInSeconds?: number;
|
|
2380
|
-
/**
|
|
2381
|
-
* By default, the Braze SDK will store small amounts of data (user ids, session ids), in cookies. This is done to allow Braze
|
|
2382
|
-
* to recognize users and sessions across different subdomains of your site. If this presents a problem for you, pass `true`
|
|
2383
|
-
* for this option to disable cookie storage and rely entirely on HTML 5 localStorage to identify users and sessions. The downside
|
|
2384
|
-
* of this configuration is that you will be unable to recognize users across subdomains of your site.
|
|
2385
|
-
*/
|
|
2386
|
-
noCookies?: boolean;
|
|
2387
|
-
/**
|
|
2388
|
-
* By default, links from in-app message clicks load in the current tab or a new tab as specified in the dashboard on a
|
|
2389
|
-
* message-by-message basis. Set this option to `true` to force all links from in-app message clicks open in a new tab or window.
|
|
2390
|
-
*/
|
|
2391
|
-
openInAppMessagesInNewTab?: boolean;
|
|
2392
|
-
/**
|
|
2393
|
-
* By default, links from `Card` objects load in the current tab or window. Set this option to `true` to make links from
|
|
2394
|
-
* cards open in a new tab or window.
|
|
2395
|
-
*/
|
|
2396
|
-
openCardsInNewTab?: boolean;
|
|
2397
|
-
/**
|
|
2398
|
-
* By default, when an in-app message is showing, pressing the escape button or a click on the greyed-out background of the
|
|
2399
|
-
* page will dismiss the message. Set this option to `true` to prevent this behavior and require an explicit button click
|
|
2400
|
-
* to dismiss messages.
|
|
2401
|
-
*/
|
|
2402
|
-
requireExplicitInAppMessageDismissal?: boolean;
|
|
2403
|
-
/**
|
|
2404
|
-
* If you support Safari push, you must specify this option with the website push ID that you provided to Apple when creating
|
|
2405
|
-
* your Safari push certificate (starts with "web", e.g. "web.com.example.domain").
|
|
2406
|
-
*/
|
|
2407
|
-
safariWebsitePushId?: string;
|
|
2408
|
-
/**
|
|
2409
|
-
* By default, when registering users for web push notifications Braze will look for the required service worker file in the
|
|
2410
|
-
* root directory of your web server at `/service-worker.js`. If you want to host your service worker at a different path
|
|
2411
|
-
* on that server, provide a value for this option that is the absolute path to the file, e.g. `/mycustompath/my-worker.js`.
|
|
2412
|
-
* VERY IMPORTANT: setting a value here limits the scope of push notifications on your site. For instance, in the above
|
|
2413
|
-
* example, because the service worker file is located within the `/mycustompath/` directory, `requestPushPermission`
|
|
2414
|
-
* MAY ONLY BE CALLED from web pages that start with `http://yoursite.com/mycustompath/`.
|
|
2415
|
-
*/
|
|
2416
|
-
serviceWorkerLocation?: string;
|
|
2417
|
-
/**
|
|
2418
|
-
* By default, sessions time out after 30 minutes of inactivity. Provide a value for this configuration option to override that
|
|
2419
|
-
* default with a value of your own.
|
|
2420
|
-
*/
|
|
2421
|
-
sessionTimeoutInSeconds?: number;
|
|
2422
|
-
};
|
|
2597
|
+
sessionTimeoutInSeconds?: number;
|
|
2598
|
+
};
|
|
2423
2599
|
|
|
2424
2600
|
|
|
2425
2601
|
|