@@ -14129,15 +14129,56 @@ dependencyScope.jQuery = $;;
1412914129 assignedGroup : { } ,
1413014130 browserId : null ,
1413114131 sessionId : null ,
14132+ splitTestData : null ,
14133+
14134+ getSplitTestData : function ( ) {
14135+ if ( $ . isPlainObject ( this . splitTestData ) ) {
14136+ return this . splitTestData ;
14137+ }
14138+
14139+ // make sure the instance is initialized
14140+ Breinify . UTL . storage . init ( { } ) ;
14141+
14142+ // get the information from it
14143+ this . splitTestData = Breinify . UTL . storage . get ( 'split-test-data' ) ;
14144+ if ( this . splitTestData === null || ! $ . isPlainObject ( this . splitTestData ) ) {
14145+ this . splitTestData = { } ;
14146+
14147+ return this . splitTestData ;
14148+ }
14149+
14150+ // clean-up old split-test information (older than 7 days)
14151+ var testExpiration = new Date ( ) . getTime ( ) - 60 * 1000 ; // (7 * 24 * 60 * 1000);
14152+ for ( var key in this . splitTestData ) {
14153+ if ( ! this . splitTestData . hasOwnProperty ( key ) ) {
14154+ continue ;
14155+ }
14156+
14157+ var lastUpdated = this . splitTestData [ key ] . lastUpdated ;
14158+ if ( typeof lastUpdated !== 'number' || lastUpdated < testExpiration ) {
14159+ delete this . splitTestData [ key ] ;
14160+ }
14161+ }
14162+
14163+ return this . splitTestData ;
14164+ } ,
1413214165
1413314166 create : function ( user ) {
14167+ var splitTestData ;
14168+ try {
14169+ splitTestData = this . getSplitTestData ( ) ;
14170+ } catch ( e ) {
14171+ splitTestData = null ;
14172+ }
14173+ splitTestData = $ . isEmptyObject ( splitTestData ) ? null : splitTestData ;
1413414174
1413514175 // get the default user
1413614176 var defaultUser = {
14137- sessionId : this . getSessionId ( ) ,
14177+ ' sessionId' : this . getSessionId ( ) ,
1413814178 'additional' : {
14139- identifiers : {
14140- browserId : this . getBrowserId ( )
14179+ 'splitTests' : splitTestData ,
14180+ 'identifiers' : {
14181+ 'browserId' : this . getBrowserId ( )
1414114182 }
1414214183 }
1414314184 } ;
@@ -14199,7 +14240,7 @@ dependencyScope.jQuery = $;;
1419914240 return this . sessionId ;
1420014241 } ,
1420114242
14202- getMarkerSessionId : function ( ) {
14243+ getMarkerSessionId : function ( ) {
1420314244 var markerSessionId = BreinifyUtil . loc . param ( 'br-msid' ) ;
1420414245 if ( typeof markerSessionId === 'string' && markerSessionId . trim ( ) !== '' ) {
1420514246 return markerSessionId ;
@@ -15712,37 +15753,6 @@ dependencyScope.jQuery = $;;
1571215753
1571315754 var _privates = {
1571415755 ready : false ,
15715- splitTestData : null ,
15716-
15717- getSplitTestData : function ( ) {
15718- if ( this . splitTestData !== null ) {
15719- return this . splitTestData ;
15720- }
15721-
15722- // make sure the instance is initialized
15723- Breinify . UTL . storage . init ( { } ) ;
15724-
15725- // get the information from it
15726- this . splitTestData = Breinify . UTL . storage . get ( 'splitTestData' ) ;
15727- if ( this . splitTestData === null || ! $ . isPlainObject ( this . splitTestData ) ) {
15728- this . splitTestData = { } ;
15729- return this . splitTestData ;
15730- }
15731-
15732- // clean-up old split-test information (older than 7 days)
15733- var testExpiration = new Date ( ) . getTime ( ) - 60 * 1000 ; // (7 * 24 * 60 * 1000);
15734- for ( var key in this . splitTestData ) {
15735- if ( ! this . splitTestData . hasOwnProperty ( key ) ) {
15736- continue ;
15737- }
15738-
15739- var lastUpdated = this . splitTestData [ key ] . lastUpdated ;
15740- if ( typeof lastUpdated !== 'number' || lastUpdated < testExpiration ) {
15741- delete this . splitTestData [ key ] ;
15742- }
15743- }
15744- return this . splitTestData ;
15745- } ,
1574615756
1574715757 storeAdditionalData : function ( data ) {
1574815758 var additionalData ;
@@ -15763,7 +15773,7 @@ dependencyScope.jQuery = $;;
1576315773 }
1576415774
1576515775 // iterate over the additionalData instances and collect the split-test information
15766- var splitTestData = this . getSplitTestData ( ) ;
15776+ var splitTestData = Breinify . UTL . user . getSplitTestData ( ) ;
1576715777 if ( ! $ . isPlainObject ( splitTestData ) ) {
1576815778 splitTestData = { } ;
1576915779 }
@@ -15789,7 +15799,7 @@ dependencyScope.jQuery = $;;
1578915799 * must be initialized we called `getSplitTestData` previously.
1579015800 */
1579115801 Breinify . UTL . storage . update ( 'splitTestData' , 30 * 24 * 60 , splitTestData ) ;
15792- this . splitTestData = splitTestData ;
15802+ Breinify . UTL . user . splitTestData = splitTestData ;
1579315803 } ,
1579415804
1579515805 handleRecommendationResponse : function ( data , errorText , callback ) {
0 commit comments