@mparticle/web-braze-kit 4.2.1 → 5.0.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/CHANGELOG.md CHANGED
@@ -2,8 +2,15 @@
2
2
 
3
3
  --
4
4
 
5
- ## 4.2.1 - 2024-10-24
6
- - fix: Declare reportEvent where previously undeclared [#55](https://github.com/mparticle-integrations/mparticle-javascript-integration-braze/pull/55)
5
+ ## 5.0.1 - 2024-11-13
6
+ - ci: Add esm support [#53](https://github.com/mparticle-integrations/mparticle-javascript-integration-braze/pull/53)
7
+ - fix: Update package.json to support esm, define missing variable declarations [#54](https://github.com/mparticle-integrations/mparticle-javascript-integration-braze/pull/54)
8
+
9
+ ## 5.0.0 - 2024-10-30
10
+
11
+ ⚠️ **Breaking** - The mParticle web Braze kit now supports Braze's Web SDK v5.5.0. Breaking changes cna be viewed at [Braze's changelog](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/changelog/#500). There may be API changes that affect you if you call `braze` directly from your code.
12
+ - feat: Support Braze Web SDK V5 [#52)](https://github.com/mparticle-integrations/mparticle-javascript-integration-braze/pull/52)
13
+ * Full details about the changes and recommended code changes can be found on mParticle's [Braze integration docs page](https://docs.mparticle.com/integrations/braze/event).
7
14
 
8
15
  ## 4.2.0 - 2024-10-24
9
16
 
@@ -10019,9 +10019,9 @@ window.braze = require$$0;
10019
10019
 
10020
10020
  // This should remain Appboy and not Braze until the core SDK is able to parse the moduleID and not the name (go.mparticle.com/work/SQDSDKS-4655)
10021
10021
  var name = 'Appboy',
10022
- suffix = 'v4',
10022
+ suffix = 'v5',
10023
10023
  moduleId = 28,
10024
- version = '4.2.1',
10024
+ version = '5.0.1',
10025
10025
  MessageType = {
10026
10026
  PageView: 3,
10027
10027
  PageEvent: 4,
@@ -10672,27 +10672,31 @@ var constructor = function () {
10672
10672
  function primeBrazeWebPush() {
10673
10673
  // The following code block is based on Braze's best practice for implementing
10674
10674
  // their push primer. We only modify it to include pushPrimer and register_inapp settings.
10675
- // https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration/#soft-push-prompts
10675
+ // https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/soft_push_prompt
10676
10676
  braze.subscribeToInAppMessage(function (inAppMessage) {
10677
10677
  var shouldDisplay = true;
10678
10678
  var pushPrimer = false;
10679
10679
  if (inAppMessage instanceof braze.InAppMessage) {
10680
- // Read the key-value pair for msg-id
10681
- var msgId = inAppMessage.extras['msg-id'];
10682
-
10683
- // If this is our push primer message
10684
- if (msgId == 'push-primer') {
10680
+ // access the key-value pairs, defined as `extras`
10681
+ const keyValuePairs = inAppMessage.extras || {};
10682
+ // check the value of our key `msg-id` defined in the Braze dashboard
10683
+ if (keyValuePairs['msg-id'] === 'push-primer') {
10685
10684
  pushPrimer = true;
10686
- // We don't want to display the soft push prompt to users on browsers that don't support push, or if the user
10687
- // has already granted/blocked permission
10685
+ // We don't want to display the soft push prompt to users on browsers
10686
+ // that don't support push, or if the user has already granted/blocked permission
10688
10687
  if (
10689
- !braze.isPushSupported() ||
10688
+ braze.isPushSupported() === false ||
10690
10689
  braze.isPushPermissionGranted() ||
10691
10690
  braze.isPushBlocked()
10692
10691
  ) {
10692
+ // do not call `showInAppMessage`
10693
10693
  shouldDisplay = false;
10694
+ return;
10694
10695
  }
10695
- if (inAppMessage.buttons[0] != null) {
10696
+
10697
+ // user is eligible to receive the native prompt
10698
+ // register a click handler on one of the two buttons
10699
+ if (inAppMessage.buttons[0]) {
10696
10700
  // Prompt the user when the first button is clicked
10697
10701
  inAppMessage.buttons[0].subscribeToClickedEvent(
10698
10702
  function() {
@@ -10704,6 +10708,7 @@ var constructor = function () {
10704
10708
  }
10705
10709
 
10706
10710
  // Display the message if it's a push primer message and shouldDisplay is true
10711
+ // If it is not a push primer, we should show the message if the setting for register_inapp === 'True'
10707
10712
  if (
10708
10713
  (pushPrimer && shouldDisplay) ||
10709
10714
  (!pushPrimer && forwarderSettings.register_inapp === 'True')
@@ -10860,7 +10865,7 @@ var constructor = function () {
10860
10865
  options.sessionTimeoutInSeconds =
10861
10866
  forwarderSettings.ABKSessionTimeoutKey || 1800;
10862
10867
  options.sdkFlavor = 'mparticle';
10863
- options.enableHtmlInAppMessages =
10868
+ options.allowUserSuppliedJavascript =
10864
10869
  forwarderSettings.enableHtmlInAppMessages == 'True';
10865
10870
  options.doNotLoadFontAwesome =
10866
10871
  forwarderSettings.doNotLoadFontAwesome == 'True';