@adv-ui/ij-braze-wrapper
Advanced tools
Comparing version 1.4.0 to 1.5.0
# CHANGELOG | ||
# 1.4.0 (2022-02-09) | ||
# 1.5.0 (2023-09-12) | ||
@@ -8,28 +8,5 @@ | ||
* **Root:** update logic to render push prompt only in prod ([56ebd5b](https://github.mpi-internal.com/scmspain/frontend-jobs--common/commit/56ebd5bffda0bc8174f68603a88ac3812eae59c9)) | ||
* **braze-wrapper:** rename prepare script to prepublishOnly ([f0c4eb0](https://github.mpi-internal.com/scmspain/frontend-jobs--common/commit/f0c4eb0447a986c70af92f457b037079a6cae138)) | ||
### Features | ||
* **braze-wrapper:** force release ([4b60b51](https://github.mpi-internal.com/scmspain/frontend-jobs--common/commit/4b60b5133b7c9a1702355557e9e5ee390f48664d)) | ||
# 1.2.0 (2022-02-01) | ||
### Bug Fixes | ||
* **braze-wrapper:** set correctly braze sdk ([83caf48](https://github.mpi-internal.com/scmspain/frontend-jobs--common/commit/83caf48bf0d9ba54d838caa0fe3727e9a1c468a0)) | ||
# 1.1.0 (2022-01-20) | ||
### Features | ||
* **braze-wrapper:** initial commit braze wrapper ([bed2ad7](https://github.mpi-internal.com/scmspain/frontend-jobs--common/commit/bed2ad79b6fb46fc3fa35d275a6241cda86b8edf)) | ||
import _classPrivateFieldLooseBase from "@babel/runtime/helpers/esm/classPrivateFieldLooseBase"; | ||
import _classPrivateFieldLooseKey from "@babel/runtime/helpers/esm/classPrivateFieldLooseKey"; | ||
var _class; | ||
var _analytics = /*#__PURE__*/_classPrivateFieldLooseKey("analytics"); | ||
var _sdk = /*#__PURE__*/_classPrivateFieldLooseKey("sdk"); | ||
var _isWebPushInApp = /*#__PURE__*/_classPrivateFieldLooseKey("isWebPushInApp"); | ||
var _sdkExists = /*#__PURE__*/_classPrivateFieldLooseKey("sdkExists"); | ||
var _analyticsExists = /*#__PURE__*/_classPrivateFieldLooseKey("analyticsExists"); | ||
/* eslint-disable no-console */ | ||
@@ -18,7 +13,6 @@ var Braze = /*#__PURE__*/function () { | ||
var _ref = _temp === void 0 ? {} : _temp, | ||
_ref$analytics = _ref.analytics, | ||
analytics = _ref$analytics === void 0 ? window.analytics : _ref$analytics, | ||
_ref$sdk = _ref.sdk, | ||
sdk = _ref$sdk === void 0 ? window.appboy : _ref$sdk; | ||
_ref$analytics = _ref.analytics, | ||
analytics = _ref$analytics === void 0 ? window.analytics : _ref$analytics, | ||
_ref$sdk = _ref.sdk, | ||
sdk = _ref$sdk === void 0 ? window.appboy : _ref$sdk; | ||
Object.defineProperty(this, _analyticsExists, { | ||
@@ -39,22 +33,17 @@ value: _analyticsExists2 | ||
_classPrivateFieldLooseBase(this, _analytics)[_analytics] = analytics; | ||
_classPrivateFieldLooseBase(this, _sdk)[_sdk] = sdk; // Init in-apps listener | ||
_classPrivateFieldLooseBase(this, _sdk)[_sdk] = sdk; | ||
// Init in-apps listener | ||
this.subscribeToInApp(); | ||
} | ||
var _proto = Braze.prototype; | ||
_proto.registerPushMessages = function registerPushMessages(_temp2) { | ||
var _this = this; | ||
var _ref2 = _temp2 === void 0 ? {} : _temp2, | ||
pageWhitelist = _ref2.pageWhitelist; | ||
pageWhitelist = _ref2.pageWhitelist; | ||
this.ready(function () { | ||
var isPageAllowed = true; | ||
if (pageWhitelist) { | ||
isPageAllowed = Braze.isCurrentPageAllowed(pageWhitelist); | ||
} | ||
if (isPageAllowed) { | ||
@@ -65,10 +54,7 @@ _classPrivateFieldLooseBase(_this, _sdk)[_sdk].logCustomEvent(Braze.inApps.WEB_PUSH.eventName); | ||
}; | ||
_proto.subscribeToInApp = function subscribeToInApp() { | ||
var _this2 = this; | ||
this.ready(function () { | ||
_classPrivateFieldLooseBase(_this2, _sdk)[_sdk].subscribeToInAppMessage(function (inAppMessage) { | ||
var shouldDisplay = true; | ||
if (inAppMessage instanceof _classPrivateFieldLooseBase(_this2, _sdk)[_sdk].InAppMessage) { | ||
@@ -81,5 +67,5 @@ // Read the key-value pair for msg-id | ||
} | ||
} // Display the message | ||
} | ||
// Display the message | ||
if (shouldDisplay) { | ||
@@ -91,12 +77,8 @@ _classPrivateFieldLooseBase(_this2, _sdk)[_sdk].display.showInAppMessage(inAppMessage); | ||
}; | ||
_proto.canEnablePushNotification = function canEnablePushNotification() { | ||
return Braze.isProductionEnv() && _classPrivateFieldLooseBase(this, _sdk)[_sdk].isPushSupported() && !_classPrivateFieldLooseBase(this, _sdk)[_sdk].isPushPermissionGranted() && !_classPrivateFieldLooseBase(this, _sdk)[_sdk].isPushBlocked(); | ||
}; | ||
_proto.ready = function ready(callback) { | ||
var _this3 = this; | ||
if (!_classPrivateFieldLooseBase(this, _analyticsExists)[_analyticsExists]()) return; | ||
_classPrivateFieldLooseBase(this, _analytics)[_analytics].ready(function () { | ||
@@ -107,3 +89,2 @@ if (!_classPrivateFieldLooseBase(_this3, _sdkExists)[_sdkExists]()) return; | ||
}; | ||
Braze.isProductionEnv = function isProductionEnv() { | ||
@@ -114,3 +95,2 @@ var match = window.location.href.match(/infojobs(\w*)\.(\w*)/) || [null, 'development']; | ||
}; | ||
Braze.isCurrentPageAllowed = function isCurrentPageAllowed(pageWhitelist) { | ||
@@ -121,32 +101,24 @@ return pageWhitelist.some(function (page) { | ||
}; | ||
return Braze; | ||
}(); | ||
_class = Braze; | ||
function _isWebPushInApp2(inAppMessage) { | ||
return inAppMessage.extras['msg-id'] === Braze.inApps.WEB_PUSH.msgId; | ||
return inAppMessage.extras['msg-id'] === _class.inApps.WEB_PUSH.msgId; | ||
} | ||
function _sdkExists2() { | ||
_classPrivateFieldLooseBase(this, _sdk)[_sdk] = window.appboy; | ||
var exists = typeof _classPrivateFieldLooseBase(this, _sdk)[_sdk] !== 'undefined'; | ||
if (!exists) { | ||
console.warn("[sdk] is not defined, it may be blocked by your browser."); | ||
} | ||
return exists; | ||
} | ||
function _analyticsExists2() { | ||
_classPrivateFieldLooseBase(this, _analytics)[_analytics] = window.analytics; | ||
var exists = typeof _classPrivateFieldLooseBase(this, _analytics)[_analytics] !== 'undefined'; | ||
if (!exists) { | ||
console.warn("[analytics] is not defined, it may be blocked by your browser."); | ||
} | ||
return exists; | ||
} | ||
Object.defineProperty(Braze, _isWebPushInApp, { | ||
@@ -153,0 +125,0 @@ value: _isWebPushInApp2 |
{ | ||
"name": "@adv-ui/ij-braze-wrapper", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "", | ||
@@ -9,3 +9,3 @@ "main": "lib/index.js", | ||
"lib": "npx rimraf ./lib && npx mkdirp ./lib && babel --presets sui ./src --out-dir ./lib", | ||
"prepare": "npm run lib", | ||
"prepublishOnly": "npm run lib", | ||
"test": "NODE_ENV=test sui-test browser", | ||
@@ -28,4 +28,4 @@ "test:ci": "npm run test -- --ci", | ||
"devDependencies": { | ||
"@s-ui/bundler": "7", | ||
"@s-ui/test": "6", | ||
"@s-ui/bundler": "9", | ||
"@s-ui/test": "8", | ||
"chai": "4.2.0", | ||
@@ -32,0 +32,0 @@ "sinon": "7.3.2" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
180
9458