@@ -96,6 +96,18 @@ $jscomp.polyfill("Array.prototype.includes", function(a) {
9696 return ! 1 ;
9797 } ;
9898} , "es7" , "es3" ) ;
99+ $jscomp . owns = function ( a , b ) {
100+ return Object . prototype . hasOwnProperty . call ( a , b ) ;
101+ } ;
102+ $jscomp . polyfill ( "Object.entries" , function ( a ) {
103+ return a ? a : function ( b ) {
104+ var c = [ ] , d ;
105+ for ( d in b ) {
106+ $jscomp . owns ( b , d ) && c . push ( [ d , b [ d ] ] ) ;
107+ }
108+ return c ;
109+ } ;
110+ } , "es8" , "es3" ) ;
99111var COMPILED = ! 0 , goog = goog || { } ;
100112goog . global = this || self ;
101113goog . exportPath_ = function ( a , b , c , d ) {
@@ -1071,7 +1083,7 @@ goog.json.Serializer.prototype.serializeObject_ = function(a, b) {
10711083 b . push ( "}" ) ;
10721084} ;
10731085// Input 2
1074- var config = { app_service_endpoint :"https://app.link" , link_service_endpoint :"https://bnc.lt" , api_endpoint :"https://api2.branch.io" , version :"2.81 .0" } ;
1086+ var config = { app_service_endpoint :"https://app.link" , link_service_endpoint :"https://bnc.lt" , api_endpoint :"https://api2.branch.io" , version :"2.82 .0" } ;
10751087// Input 3
10761088var safejson = { parse :function ( a ) {
10771089 a = String ( a ) ;
@@ -1102,6 +1114,7 @@ utils.timeSinceNavigationStart = function() {
11021114 return ( Date . now ( ) - window . performance . timing . navigationStart ) . toString ( ) ;
11031115} ;
11041116utils . currentRequestBrttTag = "" ;
1117+ utils . allowDMAParamURLMap = { "/v1/open" :"" , "/v1/pageview" :"" , "/v2/event/standard" :"user_data" , "/v2/event/custom" :"user_data" } ;
11051118utils . calculateBrtt = function ( a ) {
11061119 return a && "number" === typeof a ? ( Date . now ( ) - a ) . toString ( ) : null ;
11071120} ;
@@ -1648,6 +1661,37 @@ utils.removeTrailingDotZeros = function(a) {
16481661 }
16491662 return a ;
16501663} ;
1664+ utils . shouldAddDMAParams = function ( a ) {
1665+ return utils . allowDMAParamURLMap . hasOwnProperty ( a ) ;
1666+ } ;
1667+ utils . setDMAParams = function ( a , b = { } , c ) {
1668+ b = { dma_eea :b . eeaRegion || ! 1 , dma_ad_personalization :b . adPersonalizationConsent || ! 1 , dma_ad_user_data :b . adUserDataUsageConsent || ! 1 } ;
1669+ const d = utils . allowDMAParamURLMap ;
1670+ for ( const [ e , f ] of Object . entries ( d ) ) {
1671+ if ( c . includes ( e ) ) {
1672+ if ( "" === f ) {
1673+ Object . assign ( a , b ) ;
1674+ } else {
1675+ let g ;
1676+ if ( f in a && "" !== a [ f ] ) {
1677+ try {
1678+ const h = JSON . parse ( a [ f ] ) , k = Object . assign ( { } , h , b ) ;
1679+ g = JSON . stringify ( k ) ;
1680+ } catch ( h ) {
1681+ console . error ( `setDMAParams:: ${ f } is not a valid JSON string` ) ;
1682+ }
1683+ } else {
1684+ g = JSON . stringify ( b ) ;
1685+ }
1686+ g && ( a [ f ] = g ) ;
1687+ }
1688+ break ;
1689+ }
1690+ }
1691+ } ;
1692+ utils . isValidURL = function ( a ) {
1693+ return a && "" !== a . trim ( ) ? RegExp ( "^(https?)://((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$" , "i" ) . test ( a ) : ! 1 ;
1694+ } ;
16511695// Input 5
16521696var resources = { } , validationTypes = { OBJECT :0 , STRING :1 , NUMBER :2 , ARRAY :3 , BOOLEAN :4 } , _validator ;
16531697function validator ( a , b ) {
@@ -1875,6 +1919,7 @@ Server.prototype.getUrl = function(a, b) {
18751919 utils . merge ( g , b ) , g . branch_requestMetadata && delete g . branch_requestMetadata ;
18761920 }
18771921 b . hasOwnProperty ( "branch_requestMetadata" ) && b . branch_requestMetadata && "/v1/pageview" !== a . endpoint && "/v1/dismiss" !== a . endpoint && ( g . metadata = safejson . stringify ( b . branch_requestMetadata ) ) ;
1922+ b . branch_dma_data && ( utils . setDMAParams ( g , b . branch_dma_data , a . endpoint ) , g . branch_dma_data && delete g . branch_dma_data ) ;
18781923 if ( "POST" === a . method ) {
18791924 try {
18801925 var h = g ;
@@ -2405,12 +2450,21 @@ journeys_utils.addIframeOuterCSS = function(a, b) {
24052450 document . head . appendChild ( c ) ;
24062451} ;
24072452function generateIframeOuterCSS ( a ) {
2408- var b = a = "" ;
2453+ var b = "" ;
2454+ a = "" ;
24092455 document . body . style . transition = "" ;
24102456 document . getElementById ( "branch-banner-iframe" ) && ( document . getElementById ( "branch-banner-iframe" ) . style . transition = "" ) ;
2411- journeys_utils . entryAnimationDisabled || ( a = "body { -webkit-transition: all " + 1.5 * journeys_utils . animationSpeed / 1000 + "s ease; }\n" , document . body . style . transition = "all 0" + 1.5 * journeys_utils . animationSpeed / 1000 + "s ease" , b = "-webkit-transition: all " + journeys_utils . animationSpeed / 1000 + "s ease; transition: all 0" + journeys_utils . animationSpeed / 1000 + "s ease;" ) ;
2412- return ( a ? a : "" ) + ( "#branch-banner-iframe { box-shadow: 0 0 5px rgba(0, 0, 0, .35); width: 1px; min-width:100%; left: 0; right: 0; border: 0; height: " + journeys_utils . bannerHeight + "; z-index: 99999; " + b + " }\n#branch-banner-iframe { position: " + journeys_utils . sticky + "; }\n@media only screen and (orientation: landscape) { body { " + ( "top" === journeys_utils . position ? "margin-top: " : "margin-bottom: " ) + ( journeys_utils . isFullPage ? journeys_utils . windowWidth + "px" : journeys_utils . bannerHeight ) +
2413- "; }\n#branch-banner-iframe { height: " + ( journeys_utils . isFullPage ? journeys_utils . windowWidth + "px" : journeys_utils . bannerHeight ) + "; }" ) ;
2457+ journeys_utils . entryAnimationDisabled || ( b = "body { -webkit-transition: all " + 1.5 * journeys_utils . animationSpeed / 1000 + "s ease; }\n" , document . body . style . transition = "all 0" + 1.5 * journeys_utils . animationSpeed / 1000 + "s ease" , a = "-webkit-transition: all " + journeys_utils . animationSpeed / 1000 + "s ease; transition: all 0" + journeys_utils . animationSpeed / 1000 + "s ease;" ) ;
2458+ b = "" + ( b || "" ) ;
2459+ if ( journeys_utils . isDesktopJourney ) {
2460+ var c = journeys_utils . bannerHeight , d = journeys_utils . bannerWidth , e = journeys_utils . sticky ;
2461+ "overlay" === journeys_utils . journeyVariant && ( d = c = "100%!important" , e = "fixed" ) ;
2462+ b = b + ( "#branch-banner-iframe-embed { z-index: 99999!important; height: " + c + "; width: " + d + "; padding: 0px!important; margin: 0px!important; ; position: " + e + "; }\n#branch-banner-iframe { box-shadow: 0 0 5px rgba(0, 0, 0, .35); width: 1px; min-width: 100%; left: 0; right: 0; border: 0; height: 100%!important; width: 100%!important; " ) + ( a + "; position: " + e + "; }\n" ) ;
2463+ } else {
2464+ b += "#branch-banner-iframe { box-shadow: 0 0 5px rgba(0, 0, 0, .35); width: 1px; min-width:100%; left: 0; right: 0; border: 0; height: " + journeys_utils . bannerHeight + "; z-index: 99999; " + a + " }\n#branch-banner-iframe { position: " + journeys_utils . sticky + "; }\n@media only screen and (orientation: landscape) { body { " + ( "top" === journeys_utils . position ? "margin-top: " : "margin-bottom: " ) + ( journeys_utils . isFullPage ? journeys_utils . windowWidth + "px" : journeys_utils . bannerHeight ) +
2465+ "; }\n#branch-banner-iframe { height: " + ( journeys_utils . isFullPage ? journeys_utils . windowWidth + "px" : journeys_utils . bannerHeight ) + "; }" ;
2466+ }
2467+ return b ;
24142468}
24152469journeys_utils . addIframeInnerCSS = function ( a , b ) {
24162470 var c = document . createElement ( "style" ) ;
@@ -2420,7 +2474,8 @@ journeys_utils.addIframeInnerCSS = function(a, b) {
24202474 utils . addNonceAttribute ( c ) ;
24212475 b = a . contentWindow . document ;
24222476 b . head . appendChild ( c ) ;
2423- if ( journeys_utils . isHalfPage || journeys_utils . isFullPage ) {
2477+ c = journeys_utils . isDesktopJourney && "overlay" === journeys_utils . journeyVariant ;
2478+ if ( ( journeys_utils . isHalfPage || journeys_utils . isFullPage ) && ! c ) {
24242479 c = b . getElementsByClassName ( "branch-banner-dismiss-background" ) [ 0 ] ;
24252480 var d = b . getElementsByClassName ( "branch-banner-content" ) [ 0 ] ;
24262481 ! c && d && ( d . style . height = journeys_utils . bannerHeight ) ;
@@ -2603,6 +2658,9 @@ journeys_utils.setJourneyLinkData = function(a) {
26032658 var b = { banner_id :journeys_utils . branchViewId } ;
26042659 a && "object" === typeof a && 0 < Object . keys ( a || { } ) . length && ( utils . removePropertiesFromObject ( a , [ "browser_fingerprint_id" , "app_id" , "source" , "open_app" , "link_click_id" ] ) , b . journey_link_data = { } , utils . merge ( b . journey_link_data , a ) ) ;
26052660 journeys_utils . journeyLinkData = b ;
2661+ journeys_utils . journeyType = b . journey_link_data . type || null ;
2662+ journeys_utils . isDesktopJourney = "desktop" === b . journey_link_data . type ;
2663+ journeys_utils . journeyVariant = b . journey_link_data . variant || null ;
26062664} ;
26072665journeys_utils . getValueForKeyInBranchViewData = function ( a ) {
26082666 return journeys_utils && journeys_utils . branch && journeys_utils . branch . _branchViewData && journeys_utils . branch . _branchViewData . data ? journeys_utils . branch . _branchViewData . data [ a ] : ! 1 ;
@@ -2664,6 +2722,8 @@ function renderHtmlBlob(a, b, c, d) {
26642722 journeys_utils . getJsAndAddToParent ( b ) ;
26652723 var h = journeys_utils . getIframeCss ( b ) ;
26662724 b = journeys_utils . removeScriptAndCss ( b ) ;
2725+ a = document . createElement ( "div" ) ;
2726+ a . id = "branch-banner-iframe-embed" ;
26672727 var k = journeys_utils . createIframe ( ) ;
26682728 k . onload = function ( ) {
26692729 journeys_utils . addHtmlToIframe ( k , b , utils . getPlatformByUserAgent ( ) ) ;
@@ -2674,7 +2734,7 @@ function renderHtmlBlob(a, b, c, d) {
26742734 journeys_utils . animateBannerEntrance ( k , h ) ;
26752735 d ( k ) ;
26762736 } ;
2677- document . body . appendChild ( k ) ;
2737+ journeys_utils . isDesktopJourney ? ( a . appendChild ( k ) , document . body . appendChild ( a ) ) : document . body . appendChild ( k ) ;
26782738 return k ;
26792739}
26802740function _areJourneysDismissedGlobally ( a ) {
@@ -2824,6 +2884,8 @@ Branch.prototype._api = function(a, b, c) {
28242884 this . requestMetadata . hasOwnProperty ( d ) && ( b . branch_requestMetadata || ( b . branch_requestMetadata = { } ) , b . branch_requestMetadata [ d ] = this . requestMetadata [ d ] ) ;
28252885 }
28262886 }
2887+ utils . shouldAddDMAParams ( a . endpoint ) && ( d = this . _storage . get ( "branch_dma_data" , ! 0 ) , b . branch_dma_data = d ? safejson . parse ( d ) : { } ) ;
2888+ "/_r" !== a . endpoint && ( a . destination = config . api_endpoint ) ;
28272889 return this . _server . request ( a , b , this . _storage , function ( e , f ) {
28282890 c ( e , f ) ;
28292891 } ) ;
@@ -3194,13 +3256,31 @@ Branch.prototype.setAPIResponseCallback = wrap(callback_params.NO_CALLBACK, func
31943256Branch . prototype . referringLink = function ( a ) {
31953257 return this . _referringLink ( a ) ;
31963258} ;
3259+ Branch . prototype . setDMAParamsForEEA = wrap ( callback_params . CALLBACK_ERR , function ( a , b , c , d ) {
3260+ try {
3261+ var e = { } ;
3262+ e . eeaRegion = b || ! 1 ;
3263+ e . adPersonalizationConsent = c || ! 1 ;
3264+ e . adUserDataUsageConsent = d || ! 1 ;
3265+ this . _storage . set ( "branch_dma_data" , safejson . stringify ( e ) , ! 0 ) ;
3266+ } catch ( f ) {
3267+ console . error ( "setDMAParamsForEEA::An error occured while setting DMA parameters for EEA" , f ) ;
3268+ }
3269+ a ( ) ;
3270+ } , ! 0 ) ;
31973271Branch . prototype . setRequestMetaData = function ( a , b ) {
31983272 try {
31993273 "undefined" !== typeof a && null !== a && 0 !== a . length && "undefined" !== typeof b && ( this . requestMetadata . hasOwnProperty ( a ) && null === b && delete this . requestMetadata [ a ] , this . requestMetadata = utils . addPropertyIfNotNull ( this . requestMetadata , a , b ) ) ;
32003274 } catch ( c ) {
32013275 console . error ( "An error occured while setting request metadata" , c ) ;
32023276 }
32033277} ;
3278+ Branch . prototype . setAPIUrl = function ( a ) {
3279+ utils . isValidURL ( a ) ? config . api_endpoint = a : console . error ( "setAPIUrl: Invalid URL format. Default URL will be set." ) ;
3280+ } ;
3281+ Branch . prototype . getAPIUrl = function ( ) {
3282+ return config . api_endpoint ;
3283+ } ;
32043284// Input 17
32053285var branch_instance = new Branch ( ) ;
32063286if ( window . branch && window . branch . _q ) {
0 commit comments