@mparticle/web-braze-kit-5 3.0.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/README.md +59 -0
- package/dist/BrazeKit.common.js +11197 -0
- package/dist/BrazeKit.esm.js +11195 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
⚠️⚠️⚠️
|
|
4
|
+
# Notice! Opt in is now available for Braze Web SDK V5 - Action Required
|
|
5
|
+
|
|
6
|
+
You can now select what version of the Braze SDK you want to use when setting up a Braze connection in the mParticle UI. Braze occasionally makes breaking changes to their SDK, so if you call `appboy` directly in your code, you will have to update your code to ensure your website performs as expected when updating versions of Braze.
|
|
7
|
+
|
|
8
|
+
Please review the [Braze Changelog](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/changelog#500) and [V5 migration guide](https://github.com/braze-inc/braze-web-sdk/blob/master/UPGRADE_GUIDE.md) to learn about the differences between V4 and V5 and what changes you will need to make in your code. The most significant breaking changes are the removal of the deprecated `enableHtmlInAppMessages` initialization option (replaced by `allowUserSuppliedJavascript`), in addition to the removal and renaming of several APIs.
|
|
9
|
+
|
|
10
|
+
You can opt into the latest major version of the Braze Web SDK whether you implement mParticle's Web SDK using npm or our snippet/CDN.
|
|
11
|
+
* Customers who self-host mParticle via npm - You should add @mparticle/web-braze-kit version 5.0.0 or greater in your package.json. You must also select `Version 5` under `Braze Web SDK Version` in the Braze connection settings.
|
|
12
|
+
* Customers who load mParticle via snippet/CDN - You must select `Version 5` under `Braze Web SDK Version` in the Braze connection settings.
|
|
13
|
+
|
|
14
|
+
Note that the following is only one example of migrating from V3 to V5. Everywhere you manually call `appboy` needs to be updated similar to the below. If you are using NPM, you can skip to step 3. Please be sure to test your site fully in development prior to releasing.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
* Step 1: Legacy code sample. Find all the places where your code references the `appboy.display` namespace. Braze has removed all instances of the `display` namespace:
|
|
18
|
+
```javascript
|
|
19
|
+
window.appboy.display.destroyFeed();
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Step 2: Roll out code changes prior to opting in to V5
|
|
23
|
+
```javascript
|
|
24
|
+
if (window.appboy) {
|
|
25
|
+
window.appboy.display.destroyFeed();
|
|
26
|
+
} else if (window.braze) {
|
|
27
|
+
window.braze.destroyFeed();
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
Step 3: Whether you are using the snippet or self hosting, you need to navigate to your Braze connection settings and select `Version 5` from the `Braze Web SDK Version` drop down.
|
|
31
|
+
|
|
32
|
+
Step 4: After you opt in, you can simplify your code. We recommend testing and waiting at least 24 hours between opting in and removing previous instances of `appboy` and doing thorough testing of your application in a development environment to ensure everything is working:
|
|
33
|
+
```javascript
|
|
34
|
+
window.braze.destroyFeed();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Step 5: Push Notifications via service-worker.js
|
|
38
|
+
If you use Push Notifications, we have updated the `service-worker.js` file. In our testing, Braze’s push notifications work as expected regardless of what version of the service-worker is used, but we recommend updating this file to ensure future compatibility. In your `service-worker.js` file, update the code to reference `https://static.mparticle.com/sdk/js/braze/service-worker-5.5.0.js` instead of `https://static.mparticle.com/sdk/js/braze/service-worker-4.2.0.js`. Your `service-worker.js` file should now contain:
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
self.importScripts('https://static.mparticle.com/sdk/js/braze/service-worker-5.5.0.js')
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# License
|
|
46
|
+
|
|
47
|
+
Copyright 2022 mParticle, Inc.
|
|
48
|
+
|
|
49
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
50
|
+
you may not use this file except in compliance with the License.
|
|
51
|
+
You may obtain a copy of the License at
|
|
52
|
+
|
|
53
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
54
|
+
|
|
55
|
+
Unless required by applicable law or agreed to in writing, software
|
|
56
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
57
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
58
|
+
See the License for the specific language governing permissions and
|
|
59
|
+
limitations under the License.
|