@mparticle/web-braze-kit 3.0.3 → 3.0.4
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/dist/BrazeKit.common.js +28 -14
- package/package.json +1 -1
- package/CHANGELOG.md +0 -48
package/dist/BrazeKit.common.js
CHANGED
|
@@ -305,7 +305,7 @@ window.appboy = appboy_min;
|
|
|
305
305
|
|
|
306
306
|
var name = 'Appboy',
|
|
307
307
|
moduleId = 28,
|
|
308
|
-
version = '3.0.
|
|
308
|
+
version = '3.0.4',
|
|
309
309
|
MessageType = {
|
|
310
310
|
PageView: 3,
|
|
311
311
|
PageEvent: 4,
|
|
@@ -324,7 +324,7 @@ var clusterMapping = {
|
|
|
324
324
|
EU02: 'sdk.fra-02.braze.eu',
|
|
325
325
|
};
|
|
326
326
|
|
|
327
|
-
var constructor = function() {
|
|
327
|
+
var constructor = function () {
|
|
328
328
|
var self = this,
|
|
329
329
|
forwarderSettings,
|
|
330
330
|
options = {},
|
|
@@ -358,7 +358,7 @@ var constructor = function() {
|
|
|
358
358
|
function logPurchaseEvent(event) {
|
|
359
359
|
var reportEvent = false;
|
|
360
360
|
if (event.ProductAction.ProductList) {
|
|
361
|
-
event.ProductAction.ProductList.forEach(function(product) {
|
|
361
|
+
event.ProductAction.ProductList.forEach(function (product) {
|
|
362
362
|
if (product.Attributes == null) {
|
|
363
363
|
product.Attributes = {};
|
|
364
364
|
}
|
|
@@ -375,9 +375,12 @@ var constructor = function() {
|
|
|
375
375
|
);
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
var
|
|
379
|
-
|
|
380
|
-
);
|
|
378
|
+
var productAttributes = mergeObjects(product.Attributes, {
|
|
379
|
+
'Transaction Id': event.ProductAction.TransactionId,
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
var sanitizedProperties =
|
|
383
|
+
getSanitizedCustomProperties(productAttributes);
|
|
381
384
|
|
|
382
385
|
if (sanitizedProperties == null) {
|
|
383
386
|
return (
|
|
@@ -537,9 +540,8 @@ var constructor = function() {
|
|
|
537
540
|
) {
|
|
538
541
|
reportEvent = logPurchaseEvent(event);
|
|
539
542
|
} else if (event.EventDataType == MessageType.Commerce) {
|
|
540
|
-
var listOfPageEvents =
|
|
541
|
-
event
|
|
542
|
-
);
|
|
543
|
+
var listOfPageEvents =
|
|
544
|
+
mParticle.eCommerce.expandCommerceEvent(event);
|
|
543
545
|
if (listOfPageEvents != null) {
|
|
544
546
|
for (var i = 0; i < listOfPageEvents.length; i++) {
|
|
545
547
|
// finalLoopResult keeps track of if any logAppBoyEvent in this loop returns true or not
|
|
@@ -663,7 +665,7 @@ var constructor = function() {
|
|
|
663
665
|
// The following code block is based on Braze's best practice for implementing
|
|
664
666
|
// their push primer. We only modify it to include pushPrimer and register_inapp settings.
|
|
665
667
|
// https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration/#soft-push-prompts
|
|
666
|
-
appboy.subscribeToInAppMessage(function(inAppMessage) {
|
|
668
|
+
appboy.subscribeToInAppMessage(function (inAppMessage) {
|
|
667
669
|
var shouldDisplay = true;
|
|
668
670
|
var pushPrimer = false;
|
|
669
671
|
if (inAppMessage instanceof appboy.InAppMessage) {
|
|
@@ -685,7 +687,7 @@ var constructor = function() {
|
|
|
685
687
|
if (inAppMessage.buttons[0] != null) {
|
|
686
688
|
// Prompt the user when the first button is clicked
|
|
687
689
|
inAppMessage.buttons[0].subscribeToClickedEvent(
|
|
688
|
-
function() {
|
|
690
|
+
function () {
|
|
689
691
|
appboy.registerAppboyPushMessages();
|
|
690
692
|
}
|
|
691
693
|
);
|
|
@@ -730,7 +732,7 @@ var constructor = function() {
|
|
|
730
732
|
if (!self.logger) {
|
|
731
733
|
// create a logger
|
|
732
734
|
self.logger = {
|
|
733
|
-
verbose: function() {},
|
|
735
|
+
verbose: function () {},
|
|
734
736
|
};
|
|
735
737
|
}
|
|
736
738
|
// eslint-disable-line no-unused-vars
|
|
@@ -903,7 +905,7 @@ var constructor = function() {
|
|
|
903
905
|
var nonMethodArguments = Array.prototype.slice.call(arguments, 1);
|
|
904
906
|
msg += '\n' + method + ':\n';
|
|
905
907
|
|
|
906
|
-
nonMethodArguments.forEach(function(arg) {
|
|
908
|
+
nonMethodArguments.forEach(function (arg) {
|
|
907
909
|
if (isObject(arg) || Array.isArray(arg)) {
|
|
908
910
|
msg += JSON.stringify(arg);
|
|
909
911
|
} else {
|
|
@@ -958,6 +960,18 @@ if (window && window.mParticle && window.mParticle.addForwarder) {
|
|
|
958
960
|
});
|
|
959
961
|
}
|
|
960
962
|
|
|
963
|
+
function mergeObjects() {
|
|
964
|
+
var resObj = {};
|
|
965
|
+
for (var i = 0; i < arguments.length; i += 1) {
|
|
966
|
+
var obj = arguments[i],
|
|
967
|
+
keys = Object.keys(obj);
|
|
968
|
+
for (var j = 0; j < keys.length; j += 1) {
|
|
969
|
+
resObj[keys[j]] = obj[keys[j]];
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
return resObj;
|
|
973
|
+
}
|
|
974
|
+
|
|
961
975
|
function isObject(val) {
|
|
962
976
|
return (
|
|
963
977
|
val != null && typeof val === 'object' && Array.isArray(val) === false
|
|
@@ -966,7 +980,7 @@ function isObject(val) {
|
|
|
966
980
|
|
|
967
981
|
var BrazeKitDev = {
|
|
968
982
|
register: register,
|
|
969
|
-
getVersion: function() {
|
|
983
|
+
getVersion: function () {
|
|
970
984
|
return version;
|
|
971
985
|
},
|
|
972
986
|
};
|
package/package.json
CHANGED
package/CHANGELOG.md
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
## Releases
|
|
2
|
-
|
|
3
|
-
--
|
|
4
|
-
|
|
5
|
-
#### 3.0.3 - 2022-08-24
|
|
6
|
-
- feat: Add logging for debugging
|
|
7
|
-
|
|
8
|
-
#### 3.0.2 - 2022-06-16
|
|
9
|
-
- fix: add register_inapp and pushPrimer variables
|
|
10
|
-
|
|
11
|
-
#### 3.0.1 - 2022-05-18
|
|
12
|
-
|
|
13
|
-
- consume initOptions customFlags - this allows a customer to pass a callback to include additional options that mParticle doesn't support in the UI
|
|
14
|
-
|
|
15
|
-
#### 3.0.0 - 2022-03-28
|
|
16
|
-
|
|
17
|
-
⚠️ **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.
|
|
18
|
-
* 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.
|
|
19
|
-
* 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:
|
|
20
|
-
* The `appboy.ab` namespace has been removed and everything lives under the `appboy` namespace now.
|
|
21
|
-
* `InAppMessage.Button` has been renamed to `InAppMessageButton`
|
|
22
|
-
* Full details can be found in the README at our [AppBoy Repo](https://github.com/mparticle-integrations/mparticle-javascript-integration-appboy#readme).
|
|
23
|
-
|
|
24
|
-
#### 2.0.7 - 2022-02-09
|
|
25
|
-
|
|
26
|
-
- Feat - add new Braze clusters
|
|
27
|
-
|
|
28
|
-
#### 2.0.6 - 2020-12-10
|
|
29
|
-
|
|
30
|
-
- Feat - Add additional Braze clusters to URL mapping table
|
|
31
|
-
|
|
32
|
-
#### 2.0.5 - 2020-06-04
|
|
33
|
-
|
|
34
|
-
- Update Braze to 2.5.2
|
|
35
|
-
|
|
36
|
-
#### 2.0.4 - 2020-02-12
|
|
37
|
-
|
|
38
|
-
- Send SKU if forwardSkuAsProductName is set
|
|
39
|
-
|
|
40
|
-
#### 2.0.2 - 2020-01-23
|
|
41
|
-
|
|
42
|
-
- Feat - Set event name sent to Braze as user provided pageName
|
|
43
|
-
|
|
44
|
-
#### 2.0.1 - 2019-12-03
|
|
45
|
-
|
|
46
|
-
- Bugfix - Respect userId choice in mParticle UI dropdown
|
|
47
|
-
- Add version number
|
|
48
|
-
- Remove isObject dependency
|