{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_custom_core/cartridge/client/default/js/sizebay.js","webpack:///./cartridges/app_custom_core/cartridge/client/default/js/components/sizebay.js","webpack:///../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","processInclude","$","document","ready","SIZEBAY_SESSION_ID_V4","host","masterSkuId","objectBody","URLSIZEBAY","tenantId","sizebaySettings","endPointProd","endPoints","endPointAddtoCart","endPointOrder","dataOrder","orderId","items","isWebView","window","navigator","standalone","getCurrentDevice","some","toMatchItem","userAgent","match","getSettingSizebay","length","JSON","parse","getElementById","endPoint_Prod","endPoint_Test","AddtoCart","Order","objectConstructorPOD","querySelector","orderNumber","arrayItemsOrder","map","item","masterSku","talle","variationAttributes","displayValue","masterSKU","masterId","location","hostname","permalink","toLowerCase","price","parseFloat","priceTotal","replace","quantity","size","feedProductId","sku","id","currency","country","postSizeBay","cookie","xhttp","XMLHttpRequest","onreadystatechange","this","readyState","status","alert","responseText","open","setRequestHeader","send","stringify","addtoCartSizeBay","on","val","content","split","pop","products","validationPage","onInitSizebay","include","keys","forEach"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EA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AAQjE,EAAaJ,GAAuB,GACvD6D,EAAMS,iBAAiB,eAAgB,oBACvCT,EAAMS,iBAAiB,SAAUpD,KACjC2C,EAAMU,KAAK9C,KAAK+C,UAAUrE,IAM9B,SAASsE,IACL5E,EAAE,gBAAgB6E,GAAG,SAAS,WAC1BnD,IAEI1B,EAAE,oBAAoB2B,SApC9BtB,EAAcL,EAAE,oBAAoB8E,MAC5B7E,SAASmC,cAAc,2BAA2B2C,QAAQC,MAAM,KAAKC,MAAMD,MAAM,SAAS,GAAG9B,cA/DrG9C,EAAOH,SAAS8C,SAASC,SAiBzBzC,EAAaK,EACbN,EAAa,CACT4E,SAAU,CACN,CACIjC,UApBA,WAAa7C,EAAO,IAAMC,IAuBlCG,YA8EIsD,QAmBZ,SAASqB,IAEe,QADElF,SAASmC,cAAc,oBAAoBpD,MACrC4F,KAZ5BlD,IACI1B,EAAE,oBAAoB2B,SACtBQ,IACA2B,MAiBRhG,EAAOD,QAAU,CACbuH,cANJ,WACID,O,+BCjOJrH,EAAOD,QAAU,SAAUwH,GACA,mBAAZA,EACPA,IAC0B,iBAAZA,GACd5G,OAAO6G,KAAKD,GAASE,SAAQ,SAAUjG,GACP,mBAAjB+F,EAAQ/F,IACf+F,EAAQ/F","file":"default/js/sizebay.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 = 153);\n","'use strict';\n\nvar processInclude = require('base/util');\n\n$(document).ready(function () {\n processInclude(require('./components/sizebay'));\n});\n","'use strict';\n\nvar SIZEBAY_SESSION_ID_V4;\nvar host;\nvar skuId;\nvar masterSkuId;\nvar objectBody;\nvar URLSIZEBAY;\nvar permalink;\nvar tenantId;\nvar sizebaySettings;\nvar endPointProd;\nvar endPointTest;\nvar endPoints;\nvar endPointAddtoCart;\nvar endPointOrder;\nvar dataOrder;\nvar orderId;\nvar resultHost;\nvar sandboxes;\nvar items;\n\nvar ARG_COUNTRYCODE = 'AR'; // se deja valor quemado ya que solo hay venta en el pais.\nvar ARG_CURRENCYCODE = 'ARS'; // se deja valores quemado ya que solo se maneja una moneda\n\n/* Track the device information */\nfunction isMobile() {\n const toMatch = [/Android/i, /webOS/i, /iPhone/i, /iPad/i, /iPod/i, /BlackBerry/i, /Windows Phone/i];\n\n return toMatch.some((toMatchItem) => navigator.userAgent.match(toMatchItem));\n}\n\nfunction isTablet() {\n const toMatch = [/iPad/i, /Tablet/i];\n\n return toMatch.some((toMatchItem) => navigator.userAgent.match(toMatchItem));\n}\n\nfunction isWebView() {\n return window.navigator.standalone === true;\n}\n\n/** This function returns the current device from the Window object. **/\nfunction getCurrentDevice() {\n if (isMobile() && !isWebView()) return 'mobile';\n if (isWebView()) return 'app';\n if (isTablet()) return 'tablet';\n return 'desktop';\n}\n\n\n/**\n* validateHost: This method checks the stage we are working on.\n**/\n\nfunction validateHost() {\n host = document.location.hostname;\n sandboxes = ['sandbox', 'dev', 'staging'];\n resultHost = sandboxes.some(hostName => host.toString().includes(hostName));\n return resultHost;\n}\n\n/**\n* getEndpoints: This method differenciates whether we are working on (Cart or PDP/ Prod or Test) and creates different Endpoints depending on that.\n**/\n\nfunction getEndpoints() {\n endPointProd = sizebaySettings.endPoint_Prod;\n endPointTest = sizebaySettings.endPoint_Test;\n endPoints = endPointProd; // validateHost() ? endPointTest : endPointProd;\n endPointAddtoCart = endPoints.AddtoCart;\n endPointOrder = endPoints.Order;\n}\n\n/**\n* getSettingSizebay: This method obtains contentSlot(sizebay-settings)'s data.\n* With this object data, we are able to access to the tenantId and endpoints.\n**/\nfunction getSettingSizebay() {\n if ($('#sizebaySettings').length) {\n sizebaySettings = JSON.parse(document.getElementById('sizebaySettings').value);\n tenantId = sizebaySettings.tenantId;\n getEndpoints();\n }\n}\n\n/**\n* deleteVariant: This method remove the product variant.\n**/\nfunction deleteVariant(masterSku) {\n let skuArray = [];\n skuArray = masterSku.split('_');\n skuId = skuArray[0] + '_' + skuArray[1];\n skuId = skuId.toLowerCase();\n}\n\n/**\n* getPermalink: This method obtains permalink URL.\n**/\nfunction getPermalink() {\n host = document.location.hostname;\n permalink = 'https://' + host + '/' + masterSkuId;\n}\n\n/**\n* getPermalink: This method obtains permalink URL.\n**/\nfunction getPermalinkMaster(masterSku) {\n host = document.location.hostname;\n permalink = 'https://' + host + '/' + masterSku.toLowerCase();\n}\n\n\n/**\n* objectConstructorPDP: This method obtains PDP object with data(site credentials)we have previously acessed .\n**/\nfunction objectConstructorPDP() {\n URLSIZEBAY = endPointAddtoCart;\n objectBody = {\n products: [\n {\n permalink\n }\n ],\n tenantId\n };\n}\n\nfunction objectConstructorPOD() {\n dataOrder = JSON.parse(document.querySelector('#orderInformations').value);\n URLSIZEBAY = endPointOrder;\n orderId = dataOrder.orderNumber;\n let arrayItemsOrder = dataOrder.items.items;\n items = arrayItemsOrder.map(item => {\n var talle = item.variationAttributes[0].displayValue;\n var masterSKU = item.masterId;\n getPermalinkMaster(masterSKU);\n return {\n permalink: permalink,\n price: parseFloat(item.priceTotal.price.replace('$', '')),\n quantity: item.quantity,\n size: talle,\n feedProductId: masterSKU,\n sku: item.id\n };\n });\n var currency = ARG_CURRENCYCODE;\n var country = ARG_COUNTRYCODE;\n\n objectBody = {\n orderId,\n items,\n tenantId,\n currency,\n country\n };\n}\n\n/**\n* getSku: This method obtains product's SKU (stock-keeping unit) unique code.\n**/\nfunction getSku() {\n masterSkuId = $('#masterProductId').val();\n skuId = document.querySelector('meta[property=\"og:url\"]').content.split('/').pop().split('.html')[0].toLowerCase();\n}\n\n/**\n* getCookieSizeBay: This method obtains the cookie from the site.\n**/\nfunction getCookieSizeBay() {\n SIZEBAY_SESSION_ID_V4 = document.cookie.replace(/(?:(?:^|.*;\\s*)SIZEBAY_SESSION_ID_V4\\s*\\=\\s*([^;]*).*$)|^.*$/, '$1');\n SIZEBAY_SESSION_ID_V4 = SIZEBAY_SESSION_ID_V4 || '12C3076B190B9328486bd3a74a4a9fec5a4f8cdb1f00';\n}\n\n/**\n* postSizeBay: This method sends data to sizebay.\n**/\nfunction postSizeBay() {\n getCookieSizeBay();\n let xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200) {\n alert(this.responseText);\n }\n };\n xhttp.open('POST', URLSIZEBAY + SIZEBAY_SESSION_ID_V4, true);\n xhttp.setRequestHeader('Content-type', 'application/json');\n xhttp.setRequestHeader('device', getCurrentDevice());\n xhttp.send(JSON.stringify(objectBody));\n}\n\n/**\n* postSizeBay: Depending on the siteCredentials (whether the data we obtain is true or false), this method sends data to the cart.\n**/\nfunction addtoCartSizeBay() {\n $('.add-to-cart').on('click', function () {\n getSettingSizebay();\n\n if ($('#sizebaySettings').length) {\n getSku();\n getPermalink();\n objectConstructorPDP();\n postSizeBay();\n }\n });\n}\n/**\n* postSizeBay: Depending on the siteCredentials (whether the data we obtain is true or false), this method executes\nobjectConstructorPOD() and postSizeBay()\n**/\nfunction OrderSizeBay() {\n getSettingSizebay();\n if ($('#sizebaySettings').length) {\n objectConstructorPOD();\n postSizeBay();\n }\n}\n\n/**\n* validationPage: Validates wether we are working on PDP or Cart.\n**/\nfunction validationPage() {\n let pageDescription = document.querySelector('#pageDescription').value;\n pageDescription === 'PDP' ? addtoCartSizeBay() : OrderSizeBay();\n}\n\nfunction onInitSizebay() {\n validationPage();\n}\n\n\nmodule.exports = {\n onInitSizebay: onInitSizebay\n};\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"],"sourceRoot":""}