@@ -96,6 +96,18 @@ $jscomp.polyfill("Array.prototype.includes", function(a) {
96
96
return ! 1 ;
97
97
} ;
98
98
} , "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" ) ;
99
111
var COMPILED = ! 0 , goog = goog || { } ;
100
112
goog . global = this || self ;
101
113
goog . exportPath_ = function ( a , b , c , d ) {
@@ -1071,7 +1083,7 @@ goog.json.Serializer.prototype.serializeObject_ = function(a, b) {
1071
1083
b . push ( "}" ) ;
1072
1084
} ;
1073
1085
// 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" } ;
1075
1087
// Input 3
1076
1088
var safejson = { parse :function ( a ) {
1077
1089
a = String ( a ) ;
@@ -1102,6 +1114,7 @@ utils.timeSinceNavigationStart = function() {
1102
1114
return ( Date . now ( ) - window . performance . timing . navigationStart ) . toString ( ) ;
1103
1115
} ;
1104
1116
utils . currentRequestBrttTag = "" ;
1117
+ utils . allowDMAParamURLMap = { "/v1/open" :"" , "/v1/pageview" :"" , "/v2/event/standard" :"user_data" , "/v2/event/custom" :"user_data" } ;
1105
1118
utils . calculateBrtt = function ( a ) {
1106
1119
return a && "number" === typeof a ? ( Date . now ( ) - a ) . toString ( ) : null ;
1107
1120
} ;
@@ -1648,6 +1661,37 @@ utils.removeTrailingDotZeros = function(a) {
1648
1661
}
1649
1662
return a ;
1650
1663
} ;
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
+ } ;
1651
1695
// Input 5
1652
1696
var resources = { } , validationTypes = { OBJECT :0 , STRING :1 , NUMBER :2 , ARRAY :3 , BOOLEAN :4 } , _validator ;
1653
1697
function validator ( a , b ) {
@@ -1875,6 +1919,7 @@ Server.prototype.getUrl = function(a, b) {
1875
1919
utils . merge ( g , b ) , g . branch_requestMetadata && delete g . branch_requestMetadata ;
1876
1920
}
1877
1921
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 ) ;
1878
1923
if ( "POST" === a . method ) {
1879
1924
try {
1880
1925
var h = g ;
@@ -2405,12 +2450,21 @@ journeys_utils.addIframeOuterCSS = function(a, b) {
2405
2450
document . head . appendChild ( c ) ;
2406
2451
} ;
2407
2452
function generateIframeOuterCSS ( a ) {
2408
- var b = a = "" ;
2453
+ var b = "" ;
2454
+ a = "" ;
2409
2455
document . body . style . transition = "" ;
2410
2456
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 ;
2414
2468
}
2415
2469
journeys_utils . addIframeInnerCSS = function ( a , b ) {
2416
2470
var c = document . createElement ( "style" ) ;
@@ -2420,7 +2474,8 @@ journeys_utils.addIframeInnerCSS = function(a, b) {
2420
2474
utils . addNonceAttribute ( c ) ;
2421
2475
b = a . contentWindow . document ;
2422
2476
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 ) {
2424
2479
c = b . getElementsByClassName ( "branch-banner-dismiss-background" ) [ 0 ] ;
2425
2480
var d = b . getElementsByClassName ( "branch-banner-content" ) [ 0 ] ;
2426
2481
! c && d && ( d . style . height = journeys_utils . bannerHeight ) ;
@@ -2603,6 +2658,9 @@ journeys_utils.setJourneyLinkData = function(a) {
2603
2658
var b = { banner_id :journeys_utils . branchViewId } ;
2604
2659
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 ) ) ;
2605
2660
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 ;
2606
2664
} ;
2607
2665
journeys_utils . getValueForKeyInBranchViewData = function ( a ) {
2608
2666
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) {
2664
2722
journeys_utils . getJsAndAddToParent ( b ) ;
2665
2723
var h = journeys_utils . getIframeCss ( b ) ;
2666
2724
b = journeys_utils . removeScriptAndCss ( b ) ;
2725
+ a = document . createElement ( "div" ) ;
2726
+ a . id = "branch-banner-iframe-embed" ;
2667
2727
var k = journeys_utils . createIframe ( ) ;
2668
2728
k . onload = function ( ) {
2669
2729
journeys_utils . addHtmlToIframe ( k , b , utils . getPlatformByUserAgent ( ) ) ;
@@ -2674,7 +2734,7 @@ function renderHtmlBlob(a, b, c, d) {
2674
2734
journeys_utils . animateBannerEntrance ( k , h ) ;
2675
2735
d ( k ) ;
2676
2736
} ;
2677
- document . body . appendChild ( k ) ;
2737
+ journeys_utils . isDesktopJourney ? ( a . appendChild ( k ) , document . body . appendChild ( a ) ) : document . body . appendChild ( k ) ;
2678
2738
return k ;
2679
2739
}
2680
2740
function _areJourneysDismissedGlobally ( a ) {
@@ -2824,6 +2884,8 @@ Branch.prototype._api = function(a, b, c) {
2824
2884
this . requestMetadata . hasOwnProperty ( d ) && ( b . branch_requestMetadata || ( b . branch_requestMetadata = { } ) , b . branch_requestMetadata [ d ] = this . requestMetadata [ d ] ) ;
2825
2885
}
2826
2886
}
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 ) ;
2827
2889
return this . _server . request ( a , b , this . _storage , function ( e , f ) {
2828
2890
c ( e , f ) ;
2829
2891
} ) ;
@@ -3194,13 +3256,31 @@ Branch.prototype.setAPIResponseCallback = wrap(callback_params.NO_CALLBACK, func
3194
3256
Branch . prototype . referringLink = function ( a ) {
3195
3257
return this . _referringLink ( a ) ;
3196
3258
} ;
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 ) ;
3197
3271
Branch . prototype . setRequestMetaData = function ( a , b ) {
3198
3272
try {
3199
3273
"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 ) ) ;
3200
3274
} catch ( c ) {
3201
3275
console . error ( "An error occured while setting request metadata" , c ) ;
3202
3276
}
3203
3277
} ;
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
+ } ;
3204
3284
// Input 17
3205
3285
var branch_instance = new Branch ( ) ;
3206
3286
if ( window . branch && window . branch . _q ) {
0 commit comments