@mparticle/web-braze-kit 3.0.4 → 3.0.6

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/CHANGELOG.md ADDED
@@ -0,0 +1,57 @@
1
+ ## Releases
2
+
3
+ --
4
+
5
+ #### 3.0.5 - 2023-02-15
6
+ - refactor: Update console warning and readme to reflect new rollout plans (#19)
7
+
8
+ #### 3.0.5 - 2022-10-20
9
+ - docs: Update README to alert developers about v4 kit upgrade date, add console warning to current CDN users (#15)
10
+
11
+ #### 3.0.4 - 2022-09-06
12
+ - fix: Add Transaction Id to Purchase Commerce Events
13
+
14
+ #### 3.0.3 - 2022-08-24
15
+ - feat: Add logging for debugging
16
+
17
+ #### 3.0.2 - 2022-06-16
18
+ - fix: add register_inapp and pushPrimer variables
19
+
20
+ #### 3.0.1 - 2022-05-18
21
+
22
+ - consume initOptions customFlags - this allows a customer to pass a callback to include additional options that mParticle doesn't support in the UI
23
+
24
+ #### 3.0.0 - 2022-03-28
25
+
26
+ ⚠️ **Breaking** - If you reference any of the below deprecations and implement mParticle via snippet, you will have to make changes to your codebase before June 8, 2022 to be compatible with both version 2 and version 3 of the Braze SDK to ensure your code continues to work.
27
+ * Our partner, Braze, has made a few significant changes to their web SDK. As a result, we are also updating our mParticle Braze web kit to support Braze’s Web SDK version 3.5.0, which includes breaking changes to the Braze SDK behavior. The updated mParticle Braze Web kit will be available via CDN on June 8, 2022 and is currently available on NPM at @mparticle/web-braze-kit v3.0.0. Also note that we have updated the name of our npm package from @mparticle/web-appboy-kit to @mparticle/web-braze-kit.
28
+ * We highly recommend that you review the changes between version 2 and 3 of the Braze Web SDK to understand these changes, which can be found here. To summarize:
29
+ * The `appboy.ab` namespace has been removed and everything lives under the `appboy` namespace now.
30
+ * `InAppMessage.Button` has been renamed to `InAppMessageButton`
31
+ * Full details can be found in the README at our [AppBoy Repo](https://github.com/mparticle-integrations/mparticle-javascript-integration-appboy#readme).
32
+
33
+ #### 2.0.7 - 2022-02-09
34
+
35
+ - Feat - add new Braze clusters
36
+
37
+ #### 2.0.6 - 2020-12-10
38
+
39
+ - Feat - Add additional Braze clusters to URL mapping table
40
+
41
+ #### 2.0.5 - 2020-06-04
42
+
43
+ - Update Braze to 2.5.2
44
+
45
+ #### 2.0.4 - 2020-02-12
46
+
47
+ - Send SKU if forwardSkuAsProductName is set
48
+
49
+ #### 2.0.2 - 2020-01-23
50
+
51
+ - Feat - Set event name sent to Braze as user provided pageName
52
+
53
+ #### 2.0.1 - 2019-12-03
54
+
55
+ - Bugfix - Respect userId choice in mParticle UI dropdown
56
+ - Add version number
57
+ - Remove isObject dependency
package/README.md CHANGED
@@ -1,50 +1,59 @@
1
1
  ![Braze Logo](https://github.com/mparticle-integrations/mparticle-javascript-integration-appboy/blob/master/braze-logo.png)
2
2
 
3
3
  ⚠️⚠️⚠️
4
- # Notice! Timeline for Breaking Changes for mParticle Web Braze Kit- 3/28/2022 - 6/14/2022
5
- This repository renames and replaces our [mParticle Appboy Web Kit](https://github.com/mparticle-integrations/mparticle-javascript-integration-appboy), which will be archived in the future.
4
+ # 2/14/2023 Notice! Opt in for Breaking Changes to mParticle Web Braze Kit coming soon
5
+ mParticle's Braze Kit currently uses Braze's V3 web SDK, and Braze has made significant changes to their newest V4 web SDK. Previously, mParticle planned to release an update on 2/15/2023 for all of our CDN users which upgraded to the Brave V4 web SDK. Now, rather than migrate all CDN users to V4 at the same time, you must opt in to get the latest update. This will allow you to decide when you want to upgrade to V4 and make the appropriate code changes. Opting in to V4 will be done via a connection setting in the mParticle UI that will be available shortly.
6
6
 
7
- Braze has breaking changes between version 2.5.2 and 3.5.0 of their SDK. As a result, we too are updating our [mParticle Braze web kit](https://github.com/mparticle-integrations/mparticle-javascript-integration-appboy) to support Braze’s Web SDK version 3.5.0. The updated mParticle Braze Web kit will be available via CDN on June 14, 2022 and is currently available on NPM as [@mparticle/web-braze-kit](https://www.npmjs.com/package/@mparticle/web-braze-kit) v3.0.1.
7
+ For now, no code changes are needed, but if you implemented the code examples outlined in our docs and earlier communications, you can continue to use the V3 code until you opt in to V4 manually. More details on that are coming soon.
8
8
 
9
- **How do you know if your code is affected?**
9
+ If you self-host mParticle and the Braze Web Kit via npm, you can update sooner. Follow the instructions below for if you self-host or if you are on CDN and getting ready to opt in.
10
10
 
11
- You may notice errors on your site if you load mParticle [via snippet](https://docs.mparticle.com/developers/sdk/web/getting-started/#add-the-sdk-snippet) (as most of our clients do), and you reference any deprecated Braze APIs starting 6/14/2022.
11
+ * <b>Note that if you are here looking at source code, the `master` branch will continue to contain Braze Web Kit version 3.X until the opt in option is available. The `braze-v4-npm-master` branch currently contains the source code for v4.X.</b>
12
+ * If you are using version 2 of the @mparticle/web-appboy-kit, you will need to <a href="#transition-from-mparticleweb-appboy-kit-to-mparticleweb-braze-kit">transition to @mparticle/web-braze-kit per the instructions here</a> before following the below instructions as well.
12
13
 
13
- We highly recommend that you review the changes between version 2 and 3 of the Braze Web SDK to understand these changes, which can be found [here](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/changelog/#300). To summarize:
14
- * The `appboy.ab` namespace has been removed and everything lives under the `appboy` namespace now.
15
- * `InAppMessage.Button` has been renamed to `InAppMessageButton`
14
+ ## Braze Web Kit Citical Updates and Timelines
16
15
 
17
- If you reference any of the above deprecations, you will have to makes changes to your codebase before June 14, 2022 to be compatible with both version 2 and version 3 of the Braze SDK to ensure your code continues to work. We recommend a 3 step approach. Here are some code samples of what this code could look like today (step 1), preparing for the update (step 2) and after the change is live (step 3).
16
+ Braze occasionally makes breaking changes to their SDK, so if you call Braze directly in your code, you will have to update your code to ensure your website performs as expected when updating versions of Braze.
18
17
 
19
- The below recommendations apply only to customers who load mParticle [via snippet](https://docs.mparticle.com/developers/sdk/web/getting-started/#add-the-sdk-snippet). Customers who [self host via NPM](https://docs.mparticle.com/developers/sdk/web/self-hosting/) can ignore step 1 and jump straight to step 3 after updating their mParticle Braze kit to v3.0.1.
18
+ Please review [Braze’s Changelog notes](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/changelog#400) as well as Braze’s [migration guide](https://github.com/braze-inc/braze-web-sdk/blob/master/UPGRADE_GUIDE.md) between version 3 and 4 to understand these changes and what code updates are needed from your side. The largest change is the move from class name `appboy` to `braze`. Braze also removed and renamed some APIs. As a result, we are also updating our mParticle Braze web kit from 3.0.X to 4.0.X in order to support Braze’s Web SDK version 4.2.1.
20
19
 
21
- Step 1: Legacy code sample. If your code references the `ab` namespace (like below) or `InAppMessage.Button`, you should change it following Step 2’s example:
20
+ Customers will be able to opt in to using the latest version of Braze's Web SDK both via npm and via snippet/CDN
21
+ * Customers who self-host mParticle via npm - You can use @mparticle/web-braze-kit version 4.0.0 in your package.json now! This has been available since 10/15/2022.
22
+ * Customers who load mParticle via snippet/CDN - Opting in will be available soon via the mParticle UI in your Braze connection settings.
23
+
24
+ Note that the following is only one example. Everywhere you manually call `appboy` needs to be updated similar to the below.
25
+
26
+ * 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:
22
27
  ```javascript
23
- let banner = new appboy.ab.Banner(‘test’);
28
+ window.appboy.display.destroyFeed();
24
29
  ```
25
30
 
26
- Step 2: Rollout code sample to be used before June 14, 2022:
31
+ Step 2: Roll out code changes to be used before you opt in to using Version 4 of the Braze Web SDK so that it works under both versions:
27
32
  ```javascript
28
- let banner;
29
- if (appboy.hasOwnProperty(‘ab’)) {
30
- banner = new appboy.ab.Banner(‘test’);
31
- } else {
32
- banner = new appboy.Banner(‘test’);
33
- }
33
+ if (window.appboy) {
34
+ window.appboy.display.destroyFeed();
35
+ } else if (window.braze) {
36
+ window.braze.destroyFeed();
37
+ }
34
38
  ```
35
- Step 3: After June 14, 2022, you can simplify your code to the following once the mParticle Braze Web kit has been released to our CDN:
39
+ Step 3: After opting in to Version 4 of the Braze Web SDK, you can simplify your code:
36
40
  ```javascript
37
- let banner = new appboy.Banner(‘test’);
41
+ window.braze.destroyFeed();
38
42
  ```
39
43
 
40
- **Push Notifications via service-worker.js**
41
-
42
- Additionally, if you are using 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 to ensure future compatibility. In your `service-worker.js` file, update the code to reference `https://static.mparticle.com/sdk/js/braze/service-worker-3.5.0.js` instead of `https://static.mparticle.com/sdk/js/braze/service-worker.js`, ie:
44
+ Step 4: Push Notifications via service-worker.js
45
+ 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-4.2.0.js` instead of `https://static.mparticle.com/sdk/js/braze/service-worker-3.5.0.js`. Your `service-worker.js` file should now contain:
43
46
 
44
47
  ```javascript
45
- self.importScripts('https://static.mparticle.com/sdk/js/braze/service-worker-3.5.0.js');
48
+ self.imports('https://static.mparticle.com/sdk/js/braze/service-worker-4.2.0.js')
46
49
  ```
47
50
 
51
+ ### Transition from @mparticle/web-appboy-kit to @mparticle/web-braze-kit
52
+
53
+ The legacy @mparticle/web-appboy-kit from npm includes version 2 of the Braze Web SDK. As part of this update, we've created a new [Braze web kit repo](https://github.com/mparticle-integrations/mparticle-javascript-integration-braze) to replace our deprecated [Appboy web kit repo](https://github.com/mparticle-integrations/mparticle-javascript-integration-appboy). If you are still using `@mparticle/web-appboy-kit`, you will need to consider the breaking changes Braze made between V2 and V3 of the Braze SDK (found [here](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/changelog/#300)) as well as the instructions above to get from V2 to V4 of the Braze SDK.
54
+
55
+
56
+
48
57
  # License
49
58
 
50
59
  Copyright 2022 mParticle, Inc.
@@ -59,4 +68,4 @@ Unless required by applicable law or agreed to in writing, software
59
68
  distributed under the License is distributed on an "AS IS" BASIS,
60
69
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
61
70
  See the License for the specific language governing permissions and
62
- limitations under the License.
71
+ limitations under the License.
@@ -305,7 +305,7 @@ window.appboy = appboy_min;
305
305
 
306
306
  var name = 'Appboy',
307
307
  moduleId = 28,
308
- version = '3.0.4',
308
+ version = '3.0.6',
309
309
  MessageType = {
310
310
  PageView: 3,
311
311
  PageEvent: 4,
@@ -728,6 +728,9 @@ var constructor = function () {
728
728
  appName,
729
729
  customFlags
730
730
  ) {
731
+ console.warn(
732
+ 'mParticle will soon update the Braze web kit and upgrade the Braze SDK that you are currently using from V3 to V4. This will be an opt-in update, but we recommend you opt in when the update is available to get the latest bug fixes and features from Braze. Please see https://docs.mparticle.com/integrations/braze/event for more information and necessary upgrade steps when you decide to opt in.'
733
+ );
731
734
  // check to see if there is a logger for backwards compatibility, and if not, mock one to avoid errors
732
735
  if (!self.logger) {
733
736
  // create a logger
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-braze-kit",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "author": "mParticle Developers <developers@mparticle.com> (https://www.mparticle.com)",
5
5
  "description": "mParticle integration sdk for Braze",
6
6
  "main": "dist/BrazeKit.common.js",