{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/checkout/MaskPhoneNumber.js","webpack:///../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/checkout/MaskPhoneNumberBilling.js","webpack:///../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/phoneRegex.js"],"names":[],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFa;;AAEb;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,2CAA2C,aAAa;AACxD,KAAK;;AAEL;AACA;AACA;AACA;AACA,6CAA6C,aAAa;AAC1D;AACA;AACA,8CAA8C,aAAa;AAC3D;;AAEA,KAAK;AACL,0DAA0D,aAAa;AACvE;;AAEA;AACA,4CAA4C,aAAa,GAAG,gBAAgB;AAC5E;;AAEA;;AAEA,0CAA0C,aAAa,GAAG,gBAAgB;AAC1E;;AAEA,KAAK;AACL;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,uCAAuC,wBAAwB;AAC/D;AACA;AACA,GAAG;AACH,C;;;;;;;;;;;;AC7Ea;;AAEb;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,0CAA0C,aAAa;AACvD,KAAK;;AAEL;AACA;AACA;AACA;AACA,4CAA4C,aAAa;AACzD;AACA;AACA,6CAA6C,aAAa;AAC1D;;AAEA,KAAK;AACL,yDAAyD,aAAa;AACtE;;AAEA;AACA,2CAA2C,aAAa,GAAG,gBAAgB;AAC3E;;AAEA;;AAEA,0CAA0C,aAAa,GAAG,gBAAgB;AAC1E;;AAEA,KAAK;AACL;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,uCAAuC,wBAAwB;AAC/D;AACA;AACA;AACA,GAAG;AACH,C;;;;;;;;;;;;AC/Ea;;AAEb,mBAAO,CAAC,6IAA4B;AACpC,mBAAO,CAAC,2JAAmC;;AAE3C;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA","file":"default/js/phoneRegex.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 = \"../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/phoneRegex.js\");\n","'use strict';\n\n$('body').on('refreshRegex', function () {\n InitMask();\n});\n\nfunction InitMask() {\n var manualEdit = false;\n $('body').on('countryPhone:open', function () {\n manualEdit = true;\n });\n\n $('.shipping-form .select-phone-regex').on('change', function (e) {\n var phoneNumber = $('.shipping-phone-control').val();\n var diallingCode = $(this).children('option:selected').data('phone-indicative') || '';\n var validNumber = phoneNumber.replace(/\\s/g, '');\n diallingCode = diallingCode.toString();\n\n var mask = $(this).children('option:selected').data('phone-mask') || '';\n $('.shipping-phone-control').unmask();\n \n if (!validNumber && diallingCode) {\n $('.shipping-phone-control').val(`+${diallingCode} `);\n } else if (validNumber && diallingCode) {\n\n if (validNumber.startsWith('+' + diallingCode) || validNumber.startsWith('00' + diallingCode)) {\n $('.shipping-phone-control').val(phoneNumber);\n }\n else if (validNumber.startsWith('+')) {\n $('.shipping-phone-control').val(`+${diallingCode} `);\n }\n else if (validNumber.startsWith('00')) {\n $('.shipping-phone-control').val(`00${diallingCode} `);\n }\n\n } else if (manualEdit) {\n $('.shipping-phone-control').val(diallingCode ? `+${diallingCode} ` : '');\n }\n \n if (mask) {\n $('.shipping-phone-control').mask(`+${diallingCode} ${mask.toString()}`);\n }\n \n if (mask && diallingCode) {\n\n var InfoMaskDiallingCode =`+${diallingCode} ${mask.toString()}`;\n $('.skp-error-message-phone .mask-diallingCode').empty().append(Resources.LABEL_FORM_PHONE + InfoMaskDiallingCode);\n\n } else {\n $('.skp-error-message-phone .mask-diallingCode').empty();\n }\n });\n \n $('.shipping-phone-control').on('keydown', function (event) {\n var keyCode = event.keyCode || event.which;\n var inputValue = $(this).val();\n var diallingCode = $('.select-phone-regex option:selected').data('phone-indicative') || '';\n var diallingCodeLength = diallingCode ? diallingCode.toString().length + 2 : 0;\n\n if (keyCode === 8 && inputValue.length <= diallingCodeLength) {\n event.preventDefault();\n }\n });\n\n $('.shipping-phone-control').on('paste', function (e) {\n e.preventDefault();\n });\n\n $('.shipping-phone-control').on('input mouseup keyup keydown', function (event) {\n var selectedNumber = window.getSelection().toString();\n var diallingCode = $('.select-phone-regex option:selected').data('phone-indicative') || '';\n if (selectedNumber !== '') {\n if (event.keyCode == 8 || event.keyCode == 46) {\n $(this).val(diallingCode ? `+${diallingCode.toString()} ` : \"\");\n }\n }\n });\n}","'use strict';\n\n$('body').on('refreshRegexBilling', function () {\n InitMask();\n});\n\nfunction InitMask() {\n var manualEdit = false;\n $('body').on('countryPhone:open', function () {\n manualEdit = true;\n });\n\n $('.billing-address .select-phone-regex').on('change', function (e) {\n var phoneNumber = $('.billing-phone-control').val();\n var diallingCode = $(this).children('option:selected').data('phone-indicative') || '';\n var validNumber = phoneNumber.replace(/\\s/g, '');\n diallingCode = diallingCode.toString();\n\n var mask = $(this).children('option:selected').data('phone-mask') || '';\n $('.billing-phone-control').unmask();\n \n if (!validNumber && diallingCode) {\n $('.billing-phone-control').val(`+${diallingCode} `);\n } else if (validNumber && diallingCode) {\n\n if (validNumber.startsWith('+' + diallingCode) || validNumber.startsWith('00' + diallingCode)) {\n $('.billing-phone-control').val(phoneNumber);\n }\n else if (validNumber.startsWith('+')) {\n $('.billing-phone-control').val(`+${diallingCode} `);\n }\n else if (validNumber.startsWith('00')) {\n $('.billing-phone-control').val(`00${diallingCode} `);\n }\n\n } else if (manualEdit) {\n $('.billing-phone-control').val(diallingCode ? `+${diallingCode} ` : '');\n }\n \n if (mask) {\n $('.billing-phone-control').mask(`+${diallingCode} ${mask.toString()}`);\n }\n \n if (mask && diallingCode) {\n\n var InfoMaskDiallingCode =`+${diallingCode} ${mask.toString()}`;\n $('.billing-address .skp-error-message-phone .mask-diallingCode').empty().append(Resources.LABEL_FORM_PHONE + InfoMaskDiallingCode);\n\n } else {\n $('.billing-address .skp-error-message-phone .mask-diallingCode').empty();\n }\n });\n \n $('.billing-phone-control').on('keydown', function (event) {\n var keyCode = event.keyCode || event.which;\n var inputValue = $(this).val();\n var diallingCode = $('.billing-address .select-phone-regex option:selected').data('phone-indicative') || '';\n var diallingCodeLength = diallingCode ? diallingCode.toString().length + 2 : 0;\n\n if (keyCode === 8 && inputValue.length <= diallingCodeLength) {\n event.preventDefault();\n }\n $('.billing-address .invalid-feedback-phoneNumber-billing').removeClass('red-message');\n });\n\n $('.billing-phone-control').on('paste', function (e) {\n e.preventDefault();\n });\n\n $('.billing-phone-control').on('input mouseup keyup keydown', function (event) {\n var selectedNumber = window.getSelection().toString();\n var diallingCode = $('.billing-address .select-phone-regex option:selected').data('phone-indicative') || '';\n if (selectedNumber !== '') {\n if (event.keyCode == 8 || event.keyCode == 46) {\n $(this).val(diallingCode ? `+${diallingCode.toString()} ` : \"\");\n }\n }\n $('.billing-address .invalid-feedback-phoneNumber-billing').removeClass('red-message');\n });\n}","'use strict';\n\nrequire('./checkout/MaskPhoneNumber');\nrequire('./checkout/MaskPhoneNumberBilling');\n\nmodule.exports = {\n selectIso: function () {\n var phoneSelect = $(\".select-phone-regex\");\n\n if (phoneSelect.length < 1) return;\n\n function matchStart2(params, data) {\n params.term = params.term || '';\n if (data.text.toUpperCase().indexOf(params.term.toUpperCase()) == 0) {\n return data;\n }\n return false;\n }\n\n function formatState(state) {\n if (!state.id) {\n return state.text;\n }\n var $country = $(\n '' +\n '' + state.text + ''\n );\n return $country;\n };\n\n phoneSelect.select2({\n templateResult: formatState,\n templateSelection: formatState,\n matcher: function(params, data) {\n return matchStart2(params, data);\n }\n }).on('select2:open', () => {\n $(\"body\").addClass('select2-results');\n $('body').trigger('countryPhone:open');\n $('.select2-dropdown').addClass('select2Open');\n })\n\n $(document).on('select2:open', () => {\n setTimeout(() => document.querySelector('.select2-search__field').focus(), 200);\n });\n\n $(document).ready(function () {\n $(\".phone-control, .shipping-phone-control,.billing-phone-control\").keypress(function (event) {\n var regex = new RegExp($(this).attr('pattern'), 'g')\n if(event.which !=8 && !regex.test( String.fromCharCode(event.which))){\n event.preventDefault();\n }\n });\n $(\".select-phone-regex\").trigger('change');\n });\n\n $('.shipping-form .select-phone-regex').on('change', function (e) {\n var customerType = $('.data-checkout-stage').data('customer-type');\n var billingAddress = $('.billingAddressOne').val();\n var shippingAddress = $('.shippingAddressOne').val();\n var NumberShippingAdress = $('.shipping-phone-control').val();\n var NumberBillingAdress = $('.billing-phone-control').val();\n\n if (customerType === 'guest' || ((billingAddress === shippingAddress) && NumberShippingAdress === NumberBillingAdress)) {\n var selectedOption = $('.shipping-form .select-phone-regex').find('option:selected');\n var phoneIso = selectedOption.data('phone-iso');\n $('.billing-address .select-phone-regex option[data-phone-iso=\"' + phoneIso + '\"]').prop('selected', true);\n }\n });\n\n $('.select-phone-regex').on('change', function (e) {\n e.stopPropagation();\n var self = $(this);\n var iso = self.find(':selected').data('phone-iso'),\n inputShippingPhone = $('.shipping-phone-control'),\n inpuPhoneIso = $(\"input[name=phoneIso]\"),\n inputShippingPhoneIso = $(\"input[name=shippingAddressPhoneIso]\");\n if (inputShippingPhone && inputShippingPhoneIso && e.target.getAttribute('data-shipping-targeted') == 'true') {\n //inputShippingPhone.attr(\"placeholder\", placeholder);\n // inputShippingPhone.attr(\"pattern\", pattern);\n inputShippingPhoneIso.val(iso);\n } else {\n //inputPhone.attr(\"placeholder\", placeholder);\n //inputPhone.attr(\"pattern\", pattern);\n inpuPhoneIso.val(iso);\n }\n\n $('body').trigger('refreshRegex');\n\n $('body').trigger('refreshRegexBilling');\n });\n\n function deplaceErrorMessage(){\n $('.skp-address-form .skp-error-message-phone-country').insertAfter('.skp-phone-form.skp-address-form');\n }\n deplaceErrorMessage();\n }\n};\n"],"sourceRoot":""}