{"version":3,"file":"default/js/cjclickidcookie.js","sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_storefront_base/cartridge/client/default/js/util.js","webpack:///./cartridges/int_cjaffiliate_sfra/cartridge/client/default/js/cjclickidcookie.js","webpack:///./cartridges/int_cjaffiliate_sfra/cartridge/client/default/js/cjclickidcookie/cjclickidcookie.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./cartridges/int_cjaffiliate_sfra/cartridge/client/default/js/cjclickidcookie.js\");\n","'use strict';\n\nmodule.exports = function (include) {\n if (typeof include === 'function') {\n include();\n } else if (typeof include === 'object') {\n Object.keys(include).forEach(function (key) {\n if (typeof include[key] === 'function') {\n include[key]();\n }\n });\n }\n};\n","'use strict';\n\nvar processInclude = require('base/util');\n\n$(document).ready(function () {\n processInclude(require('./cjclickidcookie/cjclickidcookie'));\n});\n","'use strict';\n\n/**\n * \n * @param {string} sParam \n * @returns param value if exists\n */\nfunction getUrlParameter(sParam) {\n var sPageURL = window.location.search.substring(1),\n sURLVariables = sPageURL.split('&'),\n sParameterName,\n i;\n\n for (i = 0; i < sURLVariables.length; i++) {\n sParameterName = sURLVariables[i].split('=');\n\n if (sParameterName[0] === sParam) {\n return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);\n }\n }\n return false;\n};\n\n/**\n * To get a cookie with click id value\n * @param {string} cname \n * @returns cookie\n */\n\nfunction getCookie(cname) {\n var name = cname + \"=\";\n var decodedCookie = decodeURIComponent(document.cookie);\n var ca = decodedCookie.split(';');\n for(var i = 0; i =0){\n domain = domain.replace('www.','.');\n }\n document.cookie = cname + '=' + cvalue + ';' + expires + ';domain='+domain+';path=/;secure';\n}\n/**\n * Function to detect a URL param and create a cookie with param value as cookie value\n */\nfunction initCookieCreate() {\n var clickId = getUrlParameter('cjevent');\n if(clickId !== false && clickId.length <= 50 ){\n //setCookie('cje', clickId, 395);\n }\n}\n\nfunction initS2SPost(){\n if($('.js-cj-orders2s').length>0 && $('.js-cj-orders2s').val() === 'true'){\n var clickID = getCookie('cje');\n var url = $('.js-cj-orders2s').data('s2surl');\n if(clickID !== false){\n url = url+'&clickid='+clickID;\n }else{\n url = url+'&clickid='+'false';\n }\n setTimeout(function() {\n $.ajax({\n url: url,\n type: 'get',\n dataType: 'json',\n success: function (data) {\n //No logging\n },\n error: function (err) {\n //No error Handling\n }\n });\n },4000);\n }\n}\n\nfunction intiConversionTag() {\n if ( $('.js-cj-conversiontag').length > 0 && $('.js-cj-conversiontag').val() !== 'false') {\n var orderData = JSON.parse( $('.js-cj-conversiontag').val() );\n var tagUrl = $('.js-cj-conversiontag').data('pixelurl');\n if(tagUrl){\n var clickID = getCookie('cje');\n tagUrl += 'CID=' + orderData.enterpriseId + '&TYPE=' + orderData.actionTrackerId + '&METHOD=IMG';\n if (clickID !== false) {\n tagUrl += '&CJEVENT=' + clickID;\n }\n tagUrl += '&OID=' + orderData.orderId + '&CURRENCY=' + orderData.currency + '&COUPON=' + orderData.coupon;\n\n var itemsArr = orderData.items;\n var eachItem;\n for (var i=0; i < itemsArr.length ; i++ ) {\n eachItem = itemsArr[i];\n tagUrl += '&ITEM' + (i+1) + '=' + eachItem.itemId + '&AMT' + (i+1) + '=' + eachItem.unitPrice + '&QTY' + (i+1) + '=' + eachItem.quantity + '&DCNT' + (i+1) + '=' + eachItem.discount;\n }\n tagUrl += '&DISCOUNT=' + orderData.discount + '&CUST_COUNTRY=' + orderData.customerCountry + '&BRAND=' + orderData.brand + '&CATEGORY=' + orderData.category + '&COUPON_DISCOUNT=' + orderData.couponDiscount + '&COUPON_TYPE=' + orderData.couponType + '&PROMOTION=' + orderData.promotion;\n $( \"body\" ).prepend( \"\" );\n }\n }\n}\n\nmodule.exports = {\n initCookieCreate: initCookieCreate,\n initS2SPost : initS2SPost,\n intiConversionTag : intiConversionTag\n};\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AClFA;AACA;AADA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACZA;AACA;AACA;AAEA;AACA;AACA;;;;;;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AAKA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AAAA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;;;;A","sourceRoot":""}