Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@segment/analytics.js-integration-appboy

Package Overview
Dependencies
Maintainers
135
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@segment/analytics.js-integration-appboy - npm Package Compare versions

Comparing version 1.15.1 to 1.16.0

5

HISTORY.md

@@ -0,1 +1,6 @@

1.16.0 / 2020-12-16
===================
* Adds support for Braze 3.1 via version option
1.15.1 / 2020-12-14

@@ -2,0 +7,0 @@ ===================

16

lib/appboyUtil.js

@@ -25,10 +25,18 @@ var appboyUtil = {

getMajorVersion: function(options) {
return Math.floor(Number(options.version));
},
isMajorVersionTwo: function(options) {
return Math.floor(Number(options.version)) === 2;
return appboyUtil.getMajorVersion(options) === 2;
},
isMajorVersionThree: function(options) {
return appboyUtil.getMajorVersion(options) === 3;
},
getConfig: function(options) {
var config = {};
if (appboyUtil.isMajorVersionTwo(options)) {
// https://js.appboycdn.com/web-sdk/2.0/doc/module-appboy.html#.initialize
if (
appboyUtil.isMajorVersionTwo(options) ||
appboyUtil.isMajorVersionThree(options)
) {
// https://js.appboycdn.com/web-sdk/3.1/doc/module-appboy.html#.initialize
config = {

@@ -35,0 +43,0 @@ safariWebsitePushId: options.safariWebsitePushId,

@@ -50,2 +50,6 @@ 'use strict';

'<script src="https://js.appboycdn.com/web-sdk/2.7/appboy.min.js">'
)
.tag(
'v3.1',
'<script src="https://js.appboycdn.com/web-sdk/3.1/appboy.min.js">'
));

@@ -64,3 +68,5 @@

Appboy.prototype.initialize = function() {
if (appboyUtil.isMajorVersionTwo(this.options)) {
if (appboyUtil.isMajorVersionThree(this.options)) {
this.initializeV3();
} else if (appboyUtil.isMajorVersionTwo(this.options)) {
this.initializeV2();

@@ -173,2 +179,27 @@ } else {

Appboy.prototype.initializeV3 = function() {
var options = this.options;
var userId = this.analytics.user().id();
/* eslint-disable */
+function(a,p,P,b,y){
a.appboy={};
a.appboyQueue=[];
for(var s="DeviceProperties Card Card.prototype.dismissCard Card.prototype.removeAllSubscriptions Card.prototype.removeSubscription Card.prototype.subscribeToClickedEvent Card.prototype.subscribeToDismissedEvent Banner CaptionedImage ClassicCard ControlCard ContentCards ContentCards.prototype.getUnviewedCardCount Feed Feed.prototype.getUnreadCardCount ControlMessage InAppMessage InAppMessage.SlideFrom InAppMessage.ClickAction InAppMessage.DismissType InAppMessage.OpenTarget InAppMessage.ImageStyle InAppMessage.Orientation InAppMessage.TextAlignment InAppMessage.CropType InAppMessage.prototype.closeMessage InAppMessage.prototype.removeAllSubscriptions InAppMessage.prototype.removeSubscription InAppMessage.prototype.subscribeToClickedEvent InAppMessage.prototype.subscribeToDismissedEvent FullScreenMessage ModalMessage HtmlMessage SlideUpMessage User User.Genders User.NotificationSubscriptionTypes User.prototype.addAlias User.prototype.addToCustomAttributeArray User.prototype.getUserId User.prototype.incrementCustomUserAttribute User.prototype.removeFromCustomAttributeArray User.prototype.setAvatarImageUrl User.prototype.setCountry User.prototype.setCustomLocationAttribute User.prototype.setCustomUserAttribute User.prototype.setDateOfBirth User.prototype.setEmail User.prototype.setEmailNotificationSubscriptionType User.prototype.setFirstName User.prototype.setGender User.prototype.setHomeCity User.prototype.setLanguage User.prototype.setLastKnownLocation User.prototype.setLastName User.prototype.setPhoneNumber User.prototype.setPushNotificationSubscriptionType InAppMessageButton InAppMessageButton.prototype.removeAllSubscriptions InAppMessageButton.prototype.removeSubscription InAppMessageButton.prototype.subscribeToClickedEvent display display.automaticallyShowNewInAppMessages display.destroyFeed display.hideContentCards display.showContentCards display.showFeed display.showInAppMessage display.toggleContentCards display.toggleFeed changeUser destroy getDeviceId initialize isPushBlocked isPushGranted isPushPermissionGranted isPushSupported logCardClick logCardDismissal logCardImpressions logContentCardsDisplayed logCustomEvent logFeedDisplayed logInAppMessageButtonClick logInAppMessageClick logInAppMessageHtmlClick logInAppMessageImpression logPurchase openSession registerAppboyPushMessages removeAllSubscriptions removeSubscription requestContentCardsRefresh requestFeedRefresh requestImmediateDataFlush resumeWebTracking setLogger stopWebTracking subscribeToContentCardsUpdates subscribeToFeedUpdates subscribeToInAppMessage subscribeToNewInAppMessages toggleAppboyLogging trackLocation unregisterAppboyPushMessages wipeData".split(" "),i=0;i<s.length;i++){for(var m=s[i],k=a.appboy,l=m.split("."),j=0;j<l.length-1;j++)k=k[l[j]];k[l[j]]=(new Function("return function "+m.replace(/\./g,"_")+"(){window.appboyQueue.push(arguments); return true}"))()}
window.appboy.getCachedContentCards=function(){return new window.appboy.ContentCards};
window.appboy.getCachedFeed=function(){return new window.appboy.Feed};
window.appboy.getUser=function(){return new window.appboy.User};
}(window,document,'script');
/* eslint-enable */
if (appboyUtil.shouldOpenSession(userId, options)) {
this.hasBeenInitialized = true;
var config = appboyUtil.getConfig(options);
this.initializeTester(options.apiKey, config);
this.appboyInitialize(userId, options, config);
}
this.load('v3.1', this.ready);
};
/**

@@ -175,0 +206,0 @@ * @returns {boolean} true if integration should handle event.

{
"name": "@segment/analytics.js-integration-appboy",
"description": "The Appboy analytics.js integration.",
"version": "1.15.1",
"version": "1.16.0",
"keywords": [

@@ -50,3 +50,3 @@ "analytics.js",

},
"gitHead": "77e6dc045abbf82cb26bc8a331063d2f16dc1a94"
"gitHead": "57163048381e6d941ec5983060504ba824adcb3d"
}

@@ -148,2 +148,20 @@ 'use strict';

it('should use initializeV3 if version is set to 3.1', function(done) {
var V1spy = sinon.spy(appboy, 'initializeV1');
var V2spy = sinon.spy(appboy, 'initializeV2');
var V3spy = sinon.spy(appboy, 'initializeV3');
appboy.options.version = 3.1;
analytics.once('ready', function() {
try {
assert(V3spy.called);
assert(!V2spy.called);
assert(!V1spy.called);
done();
} catch (e) {
done(e);
}
});
analytics.initialize();
});
it('should set the sdk endpoint to a custom URI if one is provided', function(done) {

@@ -150,0 +168,0 @@ appboy.options.customEndpoint = 'https://my.custom.endpoint.com';

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc