@@ -47,6 +47,10 @@ var Appboy = (module.exports = integration('Appboy')
4747 . tag (
4848 'v2.7' ,
4949 '<script src="https://js.appboycdn.com/web-sdk/2.7/appboy.min.js">'
50+ )
51+ . tag (
52+ 'v3.1' ,
53+ '<script src="https://js.appboycdn.com/web-sdk/3.1/appboy.min.js">'
5054 ) ) ;
5155
5256Appboy . prototype . appboyInitialize = function ( userId , options , config ) {
@@ -60,7 +64,9 @@ Appboy.prototype.appboyInitialize = function(userId, options, config) {
6064} ;
6165
6266Appboy . prototype . initialize = function ( ) {
63- if ( appboyUtil . isMajorVersionTwo ( this . options ) ) {
67+ if ( appboyUtil . isMajorVersionThree ( this . options ) ) {
68+ this . initializeV3 ( ) ;
69+ } else if ( appboyUtil . isMajorVersionTwo ( this . options ) ) {
6470 this . initializeV2 ( ) ;
6571 } else {
6672 this . initializeV1 ( ) ;
@@ -168,6 +174,31 @@ Appboy.prototype.initializeV2 = function() {
168174 this . load ( versionTag , this . ready ) ;
169175} ;
170176
177+ Appboy . prototype . initializeV3 = function ( ) {
178+ var options = this . options ;
179+ var userId = this . analytics . user ( ) . id ( ) ;
180+
181+ /* eslint-disable */
182+ + function ( a , p , P , b , y ) {
183+ a . appboy = { } ;
184+ a . appboyQueue = [ ] ;
185+ 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}" ) ) ( ) }
186+ window . appboy . getCachedContentCards = function ( ) { return new window . appboy . ContentCards } ;
187+ window . appboy . getCachedFeed = function ( ) { return new window . appboy . Feed } ;
188+ window . appboy . getUser = function ( ) { return new window . appboy . User } ;
189+ } ( window , document , 'script' ) ;
190+ /* eslint-enable */
191+
192+ if ( appboyUtil . shouldOpenSession ( userId , options ) ) {
193+ this . hasBeenInitialized = true ;
194+ var config = appboyUtil . getConfig ( options ) ;
195+ this . initializeTester ( options . apiKey , config ) ;
196+ this . appboyInitialize ( userId , options , config ) ;
197+ }
198+
199+ this . load ( 'v3.1' , this . ready ) ;
200+ } ;
201+
171202/**
172203 * @returns {boolean } true if integration should handle event.
173204 */
0 commit comments