@braze/web-sdk 3.4.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/appboy.min.js +252 -248
- package/index.d.ts +71 -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.1
|
|
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,31 @@ 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
|
+
/** Automatically added when loading Braze via 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
|
+
/** Automatically added when loading Braze via Shopify Integration */
|
|
53
|
+
static readonly SHOPIFY: string;
|
|
54
|
+
/** Use this tag if you have integrated or loaded the Braze Web SDK using none of the other methods */
|
|
55
|
+
static readonly MANUAL: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
33
58
|
/**
|
|
34
59
|
* Abstract base for news feed cards. Use subclasses `ClassicCard`, `CaptionedImage`,
|
|
35
60
|
* `Banner`, and `ControlCard`.
|
|
@@ -37,8 +62,10 @@ declare namespace appboy {
|
|
|
37
62
|
class Card {
|
|
38
63
|
/**
|
|
39
64
|
* 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
|
-
*
|
|
65
|
+
* is meant to be used with the Braze UI.
|
|
66
|
+
*
|
|
67
|
+
* If you are using your own UI, this method will have no effect. Instead, you should use `logCardDismissal` to
|
|
68
|
+
* log analytics and then remove the card from the DOM manually.
|
|
42
69
|
*/
|
|
43
70
|
dismissCard(): void;
|
|
44
71
|
|
|
@@ -94,6 +121,8 @@ declare namespace appboy {
|
|
|
94
121
|
|
|
95
122
|
/** Whether to pin this card to the top of the view. */
|
|
96
123
|
pinned: boolean;
|
|
124
|
+
|
|
125
|
+
static fromContentCardsJson(jsonData: Record<string, unknown>): Card | undefined;
|
|
97
126
|
}
|
|
98
127
|
|
|
99
128
|
class Banner extends Card {
|
|
@@ -111,7 +140,7 @@ declare namespace appboy {
|
|
|
111
140
|
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
112
141
|
* @param url - A url to open when this card is clicked.
|
|
113
142
|
* @param linkText - The display text for the url.
|
|
114
|
-
* @param aspectRatio - The aspect ratio for this card's image.
|
|
143
|
+
* @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
144
|
* @param extras - Object of string/string key/value pairs.
|
|
116
145
|
* @param pinned - Whether to pin this card to the top of the view.
|
|
117
146
|
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
@@ -152,7 +181,7 @@ declare namespace appboy {
|
|
|
152
181
|
/** The display text for the url. */
|
|
153
182
|
linkText?: string;
|
|
154
183
|
|
|
155
|
-
/** The aspect ratio for this card's image. */
|
|
184
|
+
/** 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
185
|
aspectRatio: number | null;
|
|
157
186
|
|
|
158
187
|
/** Whether this card has been dismissed. */
|
|
@@ -182,7 +211,7 @@ declare namespace appboy {
|
|
|
182
211
|
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
183
212
|
* @param url - A url to open when this card is clicked.
|
|
184
213
|
* @param linkText - The display text for the url.
|
|
185
|
-
* @param aspectRatio - The aspect ratio for this card's image.
|
|
214
|
+
* @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
215
|
* @param extras - Object of string/string key/value pairs.
|
|
187
216
|
* @param pinned - Whether to pin this card to the top of the view.
|
|
188
217
|
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
@@ -231,7 +260,7 @@ declare namespace appboy {
|
|
|
231
260
|
/** The display text for the url. */
|
|
232
261
|
linkText?: string;
|
|
233
262
|
|
|
234
|
-
/** The aspect ratio for this card's image. */
|
|
263
|
+
/** 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
264
|
aspectRatio: number | null;
|
|
236
265
|
|
|
237
266
|
/** Whether this card has been dismissed. */
|
|
@@ -262,7 +291,7 @@ declare namespace appboy {
|
|
|
262
291
|
* @param expiresAt - When this card expires and should stop being shown to the user.
|
|
263
292
|
* @param url - A url to open when this card is clicked.
|
|
264
293
|
* @param linkText - The display text for the url.
|
|
265
|
-
* @param aspectRatio - The aspect ratio for this card's image.
|
|
294
|
+
* @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
295
|
* @param extras - Object of string/string key/value pairs.
|
|
267
296
|
* @param pinned - Whether to pin this card to the top of the view.
|
|
268
297
|
* @param dismissible - Whether to allow the user to dismiss this card, removing it from the view.
|
|
@@ -311,7 +340,7 @@ declare namespace appboy {
|
|
|
311
340
|
/** The display text for the url. */
|
|
312
341
|
linkText?: string;
|
|
313
342
|
|
|
314
|
-
/** The aspect ratio for this card's image. */
|
|
343
|
+
/** 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
344
|
aspectRatio: number | null;
|
|
316
345
|
|
|
317
346
|
/** Whether this card has been dismissed. */
|
|
@@ -1472,8 +1501,8 @@ declare namespace appboy {
|
|
|
1472
1501
|
|
|
1473
1502
|
/**
|
|
1474
1503
|
* 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.
|
|
1504
|
+
* `https://js.appboycdn.com/web-sdk-develop/3.5/appboy.min.js` and is stripped from the more minimal
|
|
1505
|
+
* `https://js.appboycdn.com/web-sdk-develop/3.5/appboy.core.min.js`.
|
|
1477
1506
|
*/
|
|
1478
1507
|
namespace display {
|
|
1479
1508
|
/**
|
|
@@ -1629,6 +1658,7 @@ declare namespace appboy {
|
|
|
1629
1658
|
* to target while logged out and switching back to that user ID as part of your app's logout process.
|
|
1630
1659
|
*
|
|
1631
1660
|
* @param userId - A unique identifier for this user. Limit 997 bytes.
|
|
1661
|
+
* These User IDs should be private and not easily guessable (e.g. not a plain email address or username).
|
|
1632
1662
|
* @param signature - An encrypted signature to be used to authenticate the current user. You can update the signature
|
|
1633
1663
|
* using the `setSdkAuthenticationSignature` method. This signature will only have an effect if the `enableSdkAuthentication`
|
|
1634
1664
|
* initialization option is set to true.
|
|
@@ -1914,7 +1944,7 @@ declare namespace appboy {
|
|
|
1914
1944
|
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
1915
1945
|
*
|
|
1916
1946
|
* ```
|
|
1917
|
-
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/3.
|
|
1947
|
+
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/3.5/service-worker.js');
|
|
1918
1948
|
* ```
|
|
1919
1949
|
*
|
|
1920
1950
|
* For more details, see [Our Product Documentation](https://www.appboy.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
|
|
@@ -1983,11 +2013,21 @@ declare namespace appboy {
|
|
|
1983
2013
|
): void;
|
|
1984
2014
|
|
|
1985
2015
|
/**
|
|
1986
|
-
*
|
|
1987
|
-
* call `initialize` after calling this method before calling subsequent methods.
|
|
2016
|
+
* @deprecated This method has been deprecated in favor of `enableSDK`, which has the same functionality.
|
|
1988
2017
|
*/
|
|
1989
2018
|
function resumeWebTracking(): void;
|
|
1990
2019
|
|
|
2020
|
+
/**
|
|
2021
|
+
* Removes the cookie set by `disableSDK`, causing subsequent calls to the Braze Web SDK to function. You must
|
|
2022
|
+
* call `initialize` after calling this method before calling subsequent methods.
|
|
2023
|
+
*/
|
|
2024
|
+
function enableSDK(): void;
|
|
2025
|
+
|
|
2026
|
+
/**
|
|
2027
|
+
* Getter method to determine if the SDK is disabled based on whether the cookie set by `stopWebTracking` exists
|
|
2028
|
+
*/
|
|
2029
|
+
function isDisabled(): boolean;
|
|
2030
|
+
|
|
1991
2031
|
/**
|
|
1992
2032
|
* By default, Braze logs to the browser console. Call this method to set a custom log action and enable debug-level log statements.
|
|
1993
2033
|
*
|
|
@@ -2006,13 +2046,27 @@ declare namespace appboy {
|
|
|
2006
2046
|
*/
|
|
2007
2047
|
function setSdkAuthenticationSignature(signature: string): boolean;
|
|
2008
2048
|
|
|
2049
|
+
/**
|
|
2050
|
+
* Adds SDK Metadata, which you can use to self-report how you load and integrate the Braze SDK.
|
|
2051
|
+
*
|
|
2052
|
+
* @param sdkMetadata - An array of metadata values from `BrazeSdkMetadata`.
|
|
2053
|
+
*
|
|
2054
|
+
* @returns Whether or not the array of metadata is valid.
|
|
2055
|
+
*/
|
|
2056
|
+
function addSdkMetadata(sdkMetadata: string[]): boolean;
|
|
2057
|
+
|
|
2058
|
+
/**
|
|
2059
|
+
* @deprecated This method has been deprecated in favor of `disableSDK`, which has the same functionality.
|
|
2060
|
+
*/
|
|
2061
|
+
function stopWebTracking(): void;
|
|
2062
|
+
|
|
2009
2063
|
/**
|
|
2010
2064
|
* Sets a cookie that causes all subsequent calls to the Braze Web SDK to be ignored
|
|
2011
2065
|
* and all subsequent analytics to cease being sent to the Braze backend.
|
|
2012
2066
|
* If you have multiple subdomains, this method MUST be called from the same subdomain that push was registered from to work properly.
|
|
2013
2067
|
* This is useful for customer opt-outs. If the customer clears website data, tracking will resume.
|
|
2014
2068
|
*/
|
|
2015
|
-
function
|
|
2069
|
+
function disableSDK(): void;
|
|
2016
2070
|
|
|
2017
2071
|
/**
|
|
2018
2072
|
* Subscribe to content cards updates. The subscriber callback will be called whenever content cards are updated.
|
|
@@ -2245,7 +2299,7 @@ declare namespace appboy {
|
|
|
2245
2299
|
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2246
2300
|
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2247
2301
|
* `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.
|
|
2302
|
+
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/3.5/service-worker.js');` or by including the content
|
|
2249
2303
|
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2250
2304
|
*/
|
|
2251
2305
|
manageServiceWorkerExternally?: boolean;
|