{"sessionId":"55e437a57d9e42f0a80bf574d9a54697","tntId":"55e437a57d9e42f0a80bf574d9a54697.34_0","offers":[{"responseTokens":{"experience.id":"0","activity.name":"Affirm Test - December","activity.id":"310302","experience.name":"No Affirm","profile.marketingCloudVisitorId":"47553924632467616673837903849960819690","profile.activeActivities":"310302","activity.decisioningMethod":"server-side"},"html":"<script>\nfunction deferCheckoutTest(method) {\n  if (window.jQuery && typeof window.utag_data == 'object') {\n    method();\n  } else {\n    if (!window.utag_data || window.utag_data.page_type !== 'checkout') {\n      setTimeout(function() { deferCheckoutTest(method) }, 50);\n    }\n  }\n}\n\ndeferCheckoutTest(function() {\n  //Mini Cart: .checkout-continue .btn\n  //Add to Bag: .checkout-now\n  //Checkout: .checkout-btn\n\n  $(document).on('mousedown', '.checkout-continue .btn', function(event) {\n    utag_data.event_name = 'Checkout Redesign Test';\n    utag_data.event_label = 'Checkout Button Click';\n    utag_data.event_value = 'minicart';\n    var adobeDataLayerEvent = Object.assign({}, utag_data);\n    window.adobeDataLayer.push(adobeDataLayerEvent);\n  });\n\n  $(document).on('mousedown', '.checkout-now', function(event) {\n    utag_data.event_name = 'Checkout Redesign Test';\n    utag_data.event_label = 'Checkout Button Click';\n    utag_data.event_value = 'add_to_bag_overlay';\n    var adobeDataLayerEvent = Object.assign({}, utag_data);\n    window.adobeDataLayer.push(adobeDataLayerEvent);\n  });\n\n  $(document).on('mousedown', '.checkout-btn', function(event) {\n    utag_data.event_name = 'Checkout Redesign Test';\n    utag_data.event_label = 'Checkout Button Click';\n    utag_data.event_value = 'cart';\n    var adobeDataLayerEvent = Object.assign({}, utag_data);\n    window.adobeDataLayer.push(adobeDataLayerEvent);\n  });\n  \n  function setCookieForWWWDomain(cookieName, cookieValue) {\n    // Set the expiration date (e.g., 7 days from now)\n    const expirationDate = new Date();\n    expirationDate.setDate(expirationDate.getDate() + 30);\n   \n    // Get the current domain and add the \".www\" prefix\n    const currentDomain = document.domain.includes('www') ? `.`+document.domain : `.www.`+document.domain;\n\n    // Set the cookie with the specified domain\n    // document.cookie = `=; domain=`+currentDomain+`; path=/; expires=;`;\n    document.cookie = cookieName+'='+cookieValue+'; domain='+currentDomain+'; path=/; expires=$'+expirationDate.toUTCString();\n  \n  }\n\n  \n  function setCookie(name, value, days) {\n    var expires = \"\";\n    if (days) {\n      var date = new Date();\n      date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));\n      expires = \"; expires=\" + date.toUTCString();\n    }\n    document.cookie = name + \"=\" + (value || \"\") + expires + \"; path=/\";\n  }\n  \n  function readCookie(name) {\n    var nameEQ = name + \"=\";\n    var ca = document.cookie.split(';');\n    for (var i = 0; i < ca.length; i++) {\n      var c = ca[i];\n      while (c.charAt(0) == ' ') c = c.substring(1, c.length);\n      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);\n    }\n    return null;\n  }\n\n  function isJsonString(str) {\n    try {\n      JSON.parse(str);\n    } catch (e) {\n      return false;\n    }\n    return true;\n  }\n\n  function triggerMBOX(name) {\n    if (!name || typeof name !== 'string') {\n      return;\n    }\n    var mboxObj = {\n      \"mbox\": name, \n      \"success\": function(offers) {           \n        adobe.target.applyOffer( {  \n           \"mbox\": name, \n           \"offer\": offers  \n        } ); \n      },   \n      \"error\": function(status, error) {           \n        if (console && console.log) { \n          console.log(status); \n          console.log(error); \n        } \n      }, \n      \"timeout\": 5000 \n    }\n\n    var params = {\n      \"breakpoint\" : window.innerWidth,\n      \"browserWidth\" : window.innerWidth,\n    }\n    if(utag_data.hasOwnProperty('page_type')) {\n      params[\"page.type\"] = utag_data.page_type;\n    }\n    if(utag_data.hasOwnProperty('page_type')) {\n      params[\"page.name\"] = utag_data.page_name;\n    }\n    if(utag_data.hasOwnProperty('page_type')) {\n      params[\"site.branding\"] = utag_data.site_branding;\n    }\n    if(utag_data.hasOwnProperty('page_type')) {\n      params[\"entry.brand\"] = utag_data.entry_brand;\n    }\n    if(utag_data.hasOwnProperty('page_type')) {\n      params[\"user.country\"] = utag_data.user_currency_ge;\n    }\n    if(utag_data.hasOwnProperty('page_type')) {\n      params[\"user.currency\"] = utag_data.user_currency_ge;\n    }\n\n    mboxObj.params = params;\n\n    var deferCount = 0;\n    function deferMBOX(method) {\n      deferCount++;\n      if (typeof adobe !== 'undefined' && typeof adobe.target !== 'undefined') {\n        method();\n        return true;\n      }\n      if(deferCount < 50) {\n        setTimeout(function() { deferMBOX(method) }, 50);\n      }\n    }\n    deferMBOX(function(){\n      adobe.target.getOffer(mboxObj);      \n    }, 50);\n\n  }\n\n  var inCustomerGroup = false;\n  if(utag_data.hasOwnProperty('customAttributes') && typeof utag_data.customAttributes == 'object' && utag_data.customAttributes.hasOwnProperty('ctmgrp_newcheckout') && utag_data.customAttributes.ctmgrp_newcheckout == 'true') {\n    inCustomerGroup = true;\n  }\n\n  if(inCustomerGroup === false) {\n    $.ajax({\n      url: '/on/demandware.store/Sites-oss-Site/default/Home-SyncSession',\n      method: \"GET\",\n      data: {\"ctmgrp_newcheckout\": true},\n      success: function (e) {},\n      error: function () {},\n    });\n  }\n\n  var checkoutCookie = readCookie('_newCheckout');\n\n  if(checkoutCookie !== \"true\") {\n    setCookieForWWWDomain('_newCheckout', 'true');\n  }\n\n  var profile = {};\n  var atProfile = readCookie('at_profile');\n  if (atProfile && isJsonString(atProfile)) {\n    profile = JSON.parse(atProfile);\n  }\n\n  if(!profile.hasOwnProperty('checkoutRedesignTest') || (profile.hasOwnProperty('checkoutRedesignTest') && profile.checkoutRedesignTest !== \"true\")) {\n    profile.checkoutRedesignTest = \"true\";\n    setCookie('at_profile', JSON.stringify(profile), 365);\n  }\n\n  triggerMBOX('checkoutSmashGlass');\n\n});\n</script>\n\n<style type=\"text/css\">\n .affirm-promo-message-minicart {display: none !important;}\n #affirm-promo-message {display: none !important;}\n .AffirmPayment { display: none !important; }\n .affirm-as-low-as { display: none !important; }\n</style>"}]}