@braze/web-sdk 3.4.1 → 3.5.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/appboy.min.js +246 -243
- package/index.d.ts +69 -17
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Type definitions for appboy-web-sdk v3.
|
|
2
|
+
* Type definitions for appboy-web-sdk v3.5.0
|
|
3
3
|
* Project: https://github.com/Appboy/appboy-web-sdk
|
|
4
|
-
* (c) Braze, Inc.
|
|
4
|
+
* (c) Braze, Inc. 2022 - http://braze.com
|
|
5
5
|
* License available at https://github.com/Appboy/appboy-web-sdk/blob/master/LICENSE
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -30,6 +30,29 @@ declare namespace appboy {
|
|
|
30
30
|
static readonly USER_AGENT: string;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Enum to represent the accepted SDK Metadata tags. See `appboy.addSdkMetadata` for more info.
|
|
35
|
+
*
|
|
36
|
+
* @readonly
|
|
37
|
+
* @enum {string}
|
|
38
|
+
*/
|
|
39
|
+
class BrazeSdkMetadata {
|
|
40
|
+
/** Use this tag if you have integrated the Braze Web SDK using Google Tag Manager */
|
|
41
|
+
static readonly GOOGLE_TAG_MANAGER: string;
|
|
42
|
+
/** Use this tag if you have integrated the Braze Web SDK using mParticle */
|
|
43
|
+
static readonly MPARTICLE: string;
|
|
44
|
+
/** Use this tag if you have integrated the Braze Web SDK using Segment */
|
|
45
|
+
static readonly SEGMENT: string;
|
|
46
|
+
/** Use this tag if you have integrated the Braze Web SDK using Tealium */
|
|
47
|
+
static readonly TEALIUM: string;
|
|
48
|
+
/** Use this tag if you have imported the Braze Web SDK using npm */
|
|
49
|
+
static readonly NPM: string;
|
|
50
|
+
/** Use this tag if you have loaded the Braze Web SDK using Braze's CDN (js.appboycdn.com) */
|
|
51
|
+
static readonly CDN: string;
|
|
52
|
+
/** Use this tag if you have integrated or loaded the Braze Web SDK using none of the other methods */
|
|
53
|
+
static readonly MANUAL: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
33
56
|
/**
|
|
34
57
|
* Abstract base for news feed cards. Use subclasses `ClassicCard`, `CaptionedImage`,
|
|
35
58
|
* `Banner`, and `ControlCard`.
|
|
@@ -37,8 +60,10 @@ declare namespace appboy {
|
|
|
37
60
|
class Card {
|
|
38
61
|
/**
|
|
39
62
|
* Call this method if you wish to programmatically remove the card from the feed and log a dismissal. This method
|
|
40
|
-
* is meant to be used with the Braze UI.
|
|
41
|
-
*
|
|
63
|
+
* is meant to be used with the Braze UI.
|
|
64
|
+
*
|
|
65
|
+
* If you are using your own UI, this method will have no effect. Instead, you should use `logCardDismissal` to
|
|
66
|
+
* log analytics and then remove the card from the DOM manually.
|
|
42
67
|
*/
|
|
43
68
|
dismissCard(): void;
|
|
44
69
|
|
|
@@ -94,6 +119,8 @@ declare namespace appboy {
|
|
|
94
119
|
|
|
95
120
|
/** Whether to pin this card to the top of the view. */
|
|
96
121
|
pinned: boolean;
|
|
122
|
+
|
|
123
|
+
static fromContentCardsJson(jsonData: Record<string, unknown>): Card | undefined;
|
|
97
124
|
}
|
|
98
125
|
|
|
99
126
|
class Banner extends Card {
|
|
@@ -111,7 +138,7 @@ declare namespace appboy {
|
|
|
111
138
|
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
112
139
|
* @param url - A url to open when this card is clicked.
|
|
113
140
|
* @param linkText - The display text for the url.
|
|
114
|
-
* @param aspectRatio - The aspect ratio for this card's image.
|
|
141
|
+
* @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances.
|
|
115
142
|
* @param extras - Object of string/string key/value pairs.
|
|
116
143
|
* @param pinned - Whether to pin this card to the top of the view.
|
|
117
144
|
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
@@ -152,7 +179,7 @@ declare namespace appboy {
|
|
|
152
179
|
/** The display text for the url. */
|
|
153
180
|
linkText?: string;
|
|
154
181
|
|
|
155
|
-
/** The aspect ratio for this card's image. */
|
|
182
|
+
/** The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances. */
|
|
156
183
|
aspectRatio: number | null;
|
|
157
184
|
|
|
158
185
|
/** Whether this card has been dismissed. */
|
|
@@ -182,7 +209,7 @@ declare namespace appboy {
|
|
|
182
209
|
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
183
210
|
* @param url - A url to open when this card is clicked.
|
|
184
211
|
* @param linkText - The display text for the url.
|
|
185
|
-
* @param aspectRatio - The aspect ratio for this card's image.
|
|
212
|
+
* @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances.
|
|
186
213
|
* @param extras - Object of string/string key/value pairs.
|
|
187
214
|
* @param pinned - Whether to pin this card to the top of the view.
|
|
188
215
|
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
@@ -231,7 +258,7 @@ declare namespace appboy {
|
|
|
231
258
|
/** The display text for the url. */
|
|
232
259
|
linkText?: string;
|
|
233
260
|
|
|
234
|
-
/** The aspect ratio for this card's image. */
|
|
261
|
+
/** The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances. */
|
|
235
262
|
aspectRatio: number | null;
|
|
236
263
|
|
|
237
264
|
/** Whether this card has been dismissed. */
|
|
@@ -262,7 +289,7 @@ declare namespace appboy {
|
|
|
262
289
|
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
263
290
|
* @param url - A url to open when this card is clicked.
|
|
264
291
|
* @param linkText - The display text for the url.
|
|
265
|
-
* @param aspectRatio - The aspect ratio for this card's image.
|
|
292
|
+
* @param aspectRatio - The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances.
|
|
266
293
|
* @param extras - Object of string/string key/value pairs.
|
|
267
294
|
* @param pinned - Whether to pin this card to the top of the view.
|
|
268
295
|
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
@@ -311,7 +338,7 @@ declare namespace appboy {
|
|
|
311
338
|
/** The display text for the url. */
|
|
312
339
|
linkText?: string;
|
|
313
340
|
|
|
314
|
-
/** The aspect ratio for this card's image. */
|
|
341
|
+
/** The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances. */
|
|
315
342
|
aspectRatio: number | null;
|
|
316
343
|
|
|
317
344
|
/** Whether this card has been dismissed. */
|
|
@@ -1472,8 +1499,8 @@ declare namespace appboy {
|
|
|
1472
1499
|
|
|
1473
1500
|
/**
|
|
1474
1501
|
* appboy.display is the public class for the UI portions of Braze's Web SDK. It is only available in
|
|
1475
|
-
* `https://js.appboycdn.com/web-sdk-develop/3.
|
|
1476
|
-
* `https://js.appboycdn.com/web-sdk-develop/3.
|
|
1502
|
+
* `https://js.appboycdn.com/web-sdk-develop/3.5/appboy.min.js` and is stripped from the more minimal
|
|
1503
|
+
* `https://js.appboycdn.com/web-sdk-develop/3.5/appboy.core.min.js`.
|
|
1477
1504
|
*/
|
|
1478
1505
|
namespace display {
|
|
1479
1506
|
/**
|
|
@@ -1629,6 +1656,7 @@ declare namespace appboy {
|
|
|
1629
1656
|
* to target while logged out and switching back to that user ID as part of your app's logout process.
|
|
1630
1657
|
*
|
|
1631
1658
|
* @param userId - A unique identifier for this user. Limit 997 bytes.
|
|
1659
|
+
* These User IDs should be private and not easily guessable (e.g. not a plain email address or username).
|
|
1632
1660
|
* @param signature - An encrypted signature to be used to authenticate the current user. You can update the signature
|
|
1633
1661
|
* using the `setSdkAuthenticationSignature` method. This signature will only have an effect if the `enableSdkAuthentication`
|
|
1634
1662
|
* initialization option is set to true.
|
|
@@ -1914,7 +1942,7 @@ declare namespace appboy {
|
|
|
1914
1942
|
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
1915
1943
|
*
|
|
1916
1944
|
* ```
|
|
1917
|
-
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/3.
|
|
1945
|
+
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/3.5/service-worker.js');
|
|
1918
1946
|
* ```
|
|
1919
1947
|
*
|
|
1920
1948
|
* For more details, see [Our Product Documentation](https://www.appboy.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
|
|
@@ -1983,11 +2011,21 @@ declare namespace appboy {
|
|
|
1983
2011
|
): void;
|
|
1984
2012
|
|
|
1985
2013
|
/**
|
|
1986
|
-
*
|
|
1987
|
-
* call `initialize` after calling this method before calling subsequent methods.
|
|
2014
|
+
* @deprecated This method has been deprecated in favor of `enableSDK`, which has the same functionality.
|
|
1988
2015
|
*/
|
|
1989
2016
|
function resumeWebTracking(): void;
|
|
1990
2017
|
|
|
2018
|
+
/**
|
|
2019
|
+
* Removes the cookie set by `disableSDK`, causing subsequent calls to the Braze Web SDK to function. You must
|
|
2020
|
+
* call `initialize` after calling this method before calling subsequent methods.
|
|
2021
|
+
*/
|
|
2022
|
+
function enableSDK(): void;
|
|
2023
|
+
|
|
2024
|
+
/**
|
|
2025
|
+
* Getter method to determine if the SDK is disabled based on whether the cookie set by `stopWebTracking` exists
|
|
2026
|
+
*/
|
|
2027
|
+
function isDisabled(): boolean;
|
|
2028
|
+
|
|
1991
2029
|
/**
|
|
1992
2030
|
* By default, Braze logs to the browser console. Call this method to set a custom log action and enable debug-level log statements.
|
|
1993
2031
|
*
|
|
@@ -2006,13 +2044,27 @@ declare namespace appboy {
|
|
|
2006
2044
|
*/
|
|
2007
2045
|
function setSdkAuthenticationSignature(signature: string): boolean;
|
|
2008
2046
|
|
|
2047
|
+
/**
|
|
2048
|
+
* Adds SDK Metadata, which you can use to self-report how you load and integrate the Braze SDK.
|
|
2049
|
+
*
|
|
2050
|
+
* @param sdkMetadata - An array of metadata values from `BrazeSdkMetadata`.
|
|
2051
|
+
*
|
|
2052
|
+
* @returns Whether or not the array of metadata is valid.
|
|
2053
|
+
*/
|
|
2054
|
+
function addSdkMetadata(sdkMetadata: string[]): boolean;
|
|
2055
|
+
|
|
2056
|
+
/**
|
|
2057
|
+
* @deprecated This method has been deprecated in favor of `disableSDK`, which has the same functionality.
|
|
2058
|
+
*/
|
|
2059
|
+
function stopWebTracking(): void;
|
|
2060
|
+
|
|
2009
2061
|
/**
|
|
2010
2062
|
* Sets a cookie that causes all subsequent calls to the Braze Web SDK to be ignored
|
|
2011
2063
|
* and all subsequent analytics to cease being sent to the Braze backend.
|
|
2012
2064
|
* If you have multiple subdomains, this method MUST be called from the same subdomain that push was registered from to work properly.
|
|
2013
2065
|
* This is useful for customer opt-outs. If the customer clears website data, tracking will resume.
|
|
2014
2066
|
*/
|
|
2015
|
-
function
|
|
2067
|
+
function disableSDK(): void;
|
|
2016
2068
|
|
|
2017
2069
|
/**
|
|
2018
2070
|
* Subscribe to content cards updates. The subscriber callback will be called whenever content cards are updated.
|
|
@@ -2245,7 +2297,7 @@ declare namespace appboy {
|
|
|
2245
2297
|
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2246
2298
|
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2247
2299
|
* `appboy.registerAppboyPushMessages`, and ensure that it contains Braze's service worker code, either with
|
|
2248
|
-
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/3.
|
|
2300
|
+
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/3.5/service-worker.js');` or by including the content
|
|
2249
2301
|
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2250
2302
|
*/
|
|
2251
2303
|
manageServiceWorkerExternally?: boolean;
|