{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../codebase/link_globale/cartridges/int_globale_sfra/cartridge/client/default/js/geScriptLoader.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;AACA;AACa;;AAEb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gDAAgD,qDAAqD;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA,oCAAoC;AACpC,iBAAiB;AACjB;AACA,KAAK;AACL,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uDAAuD,qBAAqB;;AAE5E;AACA;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,uDAAuD,qBAAqB;AAC5E;AACA;AACA;AACA,KAAK;AACL,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA,qBAAqB;AACrB;AACA,wCAAwC;AACxC,qBAAqB;AACrB;AACA;AACA,KAAK;AACL,wBAAwB;AACxB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,iBAAiB;AACjB;AACA,oCAAoC;AACpC,iBAAiB;AACjB,SAAS,SAAS;AAClB,KAAK;AACL,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA,aAAa;AACb;AACA,gCAAgC;AAChC,aAAa;AACb,KAAK;AACL,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,kEAAkE;AAClE;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,KAAK;AACL,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,8GAA8G,QAAQ;AACtH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,oCAAoC;AACpC,iBAAiB;AACjB;AACA,KAAK;AACL,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA","file":"default/js/geScriptLoader.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/link_globale/cartridges/int_globale_sfra/cartridge/client/default/js/geScriptLoader.js\");\n","/* eslint new-cap: \"off\", no-param-reassign: \"off\" */\n/* globals GlobalE, Promise */\n'use strict';\n\n//--------------------------------------------------\n// Helpers\n//--------------------------------------------------\n\nvar Helpers = {\n makeJsonAjaxCall: function (url, type, data) {\n var promise = new Promise(function (resolve, reject) {\n var xhr = new XMLHttpRequest();\n xhr.open(type, url, true);\n xhr.setRequestHeader('Cache-Control', 'no-cache');\n xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');\n xhr.send(data || null);\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n if (xhr.status === 200) {\n resolve(xhr.responseText);\n } else {\n reject(xhr.status);\n }\n }\n };\n });\n return promise;\n },\n removeParametersFromQueryString: function (queryString, parameters) {\n var qsParams = queryString && (typeof queryString === 'string') && queryString.length > 0 ? queryString.split('&') : [];\n var removedParams = parameters && Array.isArray(parameters) && parameters.length > 0 ? parameters : [];\n removedParams.forEach(function (param) {\n var prefix = encodeURIComponent(param) + '=';\n for (var i = qsParams.length; i-- > 0;) {\n if (qsParams[i].lastIndexOf(prefix, 0) !== -1) {\n qsParams.splice(i, 1);\n }\n }\n });\n return qsParams.join('&');\n }\n};\n\n//--------------------------------------------------\n// Globale Script Loader\n//--------------------------------------------------\n\n/**\n * Represents Globale Script Loader Class\n * @constructor\n */\nfunction GeScriptLoader() {}\n\n/**\n * Init Globale Script Loader Data\n */\nGeScriptLoader.prototype.initScriptLoaderData = function () {\n try {\n window.geScriptLoaderData = JSON.parse(document.querySelector('#globale-script-loader-data').innerHTML);\n } catch (e) {\n window.geScriptLoaderData = null;\n console.warn(e); // eslint-disable-line no-console\n }\n};\n\n/**\n * Init Global-e Client SDK\n * @returns {Object} promise - Promise Object\n */\nGeScriptLoader.prototype.initClientSDK = function () {\n // check script loader data\n if (!window.geScriptLoaderData) {\n return Promise.reject();\n }\n\n return new Promise(function (resolve, reject) {\n window.globaleObject = 'gle';\n window.gle = window.gle || function () { (window.gle.q = window.gle.q || []).push(arguments); };\n window.gle.m = window.geScriptLoaderData.clientJsMerchantId;\n window.gle.v = window.geScriptLoaderData.apiVersion;\n var s = document.createElement('script');\n s.src = window.geScriptLoaderData.clientJsUrl + '?v=' + window.geScriptLoaderData.apiVersion;\n s.async = true;\n s.onerror = function (err) {\n reject(err, s);\n };\n var r = false;\n s.onload = s.onreadystatechange = function () {\n if (!r && (!this.readyState || this.readyState === 'complete')) {\n r = true;\n resolve();\n }\n };\n var t = document.querySelectorAll('script')[0];\n t.parentElement.insertBefore(s, t);\n });\n};\n\n/**\n * Init Content Price Conversion\n */\nGeScriptLoader.prototype.initContentPriceConversion = function () {\n // check script loader data\n if (!window.geScriptLoaderData) {\n return;\n }\n try {\n // find DOM price elements\n var priceElements = document.querySelectorAll('[data-original-price]');\n\n // set request data\n var requestData = {};\n priceElements.forEach(function (el) {\n var key = el.dataset.originalPrice + '_' + (el.dataset.isDiscount === 'true');\n if (!(key in requestData)) {\n requestData[key] = {\n originalPrice: el.dataset.originalPrice,\n isDiscount: el.dataset.isDiscount\n };\n }\n });\n\n // send the request and update DOM price elements\n if (Object.keys(requestData).length > 0) {\n Helpers.makeJsonAjaxCall(window.geScriptLoaderData.globaleConvertPriceUrl, 'POST', JSON.stringify(requestData))\n .then(function (response) {\n if (response) {\n response = JSON.parse(response);\n priceElements.forEach(function (el) {\n var key = el.dataset.originalPrice + '_' + (el.dataset.isDiscount === 'true');\n if (key in response) {\n el.innerHTML = response[key]; // eslint-disable-line no-param-reassign\n }\n });\n }\n })\n .catch(function (e) {\n console.warn(e); // eslint-disable-line no-console\n });\n }\n } catch (e) {\n console.warn(e); // eslint-disable-line no-console\n }\n};\n\n/**\n * Remove Global-e redirect parameters\n */\nGeScriptLoader.prototype.removeGeRedirectParams = function () {\n try {\n var updatedUrl = new URL(document.location);\n var urlParams = updatedUrl.searchParams;\n\n if (urlParams.get('glCountry') || urlParams.get('glCurrency')) {\n // set 'Welcome Popup' cookie with 'false' value\n // additional GE parameters are existed in URL only during redirect and 'Welcome Popup' should not be displayed\n GlobalE.SetCookie('GlobalE_Welcome_Data', { showWelcome: false }, GlobalE.GE_DATA_COOKIE_EXP, true);\n\n // remove GE parameters and relpace history state\n urlParams.delete('glCountry');\n urlParams.delete('glCurrency');\n window.history.replaceState({}, document.title, updatedUrl.toString());\n\n // remove GE parameters from 'data-querystring' in DOM\n var requestDataEl = document.querySelector('[data-action][data-querystring]');\n if (requestDataEl) {\n var queryString = requestDataEl.getAttribute('data-querystring');\n queryString = Helpers.removeParametersFromQueryString(queryString, ['glCountry', 'glCurrency']);\n requestDataEl.setAttribute('data-querystring', queryString);\n }\n }\n } catch (e) {\n console.warn(e); // eslint-disable-line no-console\n }\n};\n\n/**\n * Handler function of 'GlobalE.LoadShippingSwitcher' event\n */\nGeScriptLoader.prototype.loadShippingSwitcherHandler = function () {\n try {\n var links = document.querySelectorAll('.globale-selector');\n Array.prototype.map.call(links, function (link) {\n GlobalE.AttachEvent('click', link, function () {\n return GlobalE.ShippingSwitcher.Show();\n });\n });\n // show country switcher popup in blocking mode\n if (!window.geScriptLoaderData.allowedSite) {\n GlobalE.SetCookie('GlobalE_Welcome_Data', { showWelcome: false }, GlobalE.GE_DATA_COOKIE_EXP, true);\n GlobalE.ShippingSwitcher.ForceModal();\n GlobalE.ShippingSwitcher.Show();\n }\n } catch (e) {\n console.warn(e); // eslint-disable-line no-console\n }\n};\n\n/**\n * Handler function of 'GlobalE.OnShippingSwitcherClosed' event\n * @param {Object} event - Event object\n * @returns {boolean} - 'false' by default\n */\nGeScriptLoader.prototype.onShippingSwitcherClosedHandler = function (event) {\n try {\n if (\n (event.button === 'save')\n && (\n !window.geScriptLoaderData.allowedSite\n || (event.country !== window.geScriptLoaderData.country)\n || (event.currency !== window.geScriptLoaderData.currency)\n || (\n GlobalE.ShippingSwitcher.isLanguageDropDownShown &&\n GlobalE.ShippingSwitcher.selectedLanguage !== window.geScriptLoaderData.languageSwitcher.selectedLanguage\n )\n )\n ) {\n GlobalE.UpdateCustomerInfo(event.country, event.currency, false);\n if (!event.isRedirect) {\n window.location.reload();\n } else if (window.geScriptLoaderData.performFrontendSiteUrlRedirect) {\n var getSiteRedirectUrl = window.geScriptLoaderData.getSiteRedirectUrl;\n getSiteRedirectUrl += '?countryCode=' + encodeURIComponent(event.country);\n getSiteRedirectUrl += '¤cyCode=' + encodeURIComponent(event.currency);\n if (GlobalE.ShippingSwitcher.isLanguageDropDownShown) {\n getSiteRedirectUrl += '&localeCode=' + encodeURIComponent(GlobalE.ShippingSwitcher.selectedLanguage);\n }\n var requestDataEl = document.querySelector('[data-action][data-querystring]');\n if (requestDataEl) {\n getSiteRedirectUrl += '&action=' + encodeURIComponent(requestDataEl.dataset.action);\n getSiteRedirectUrl += '&querystring=' + encodeURIComponent(requestDataEl.dataset.querystring);\n }\n Helpers.makeJsonAjaxCall(getSiteRedirectUrl, 'GET')\n .then(function (response) {\n if (response) {\n response = JSON.parse(response);\n GlobalE.UpdateCustomerInfo(event.country, event.currency, false);\n if (!response.success) {\n window.location.reload();\n } else if (response.redirectUrl) {\n window.location.href = response.redirectUrl;\n }\n }\n })\n .catch(function (e) {\n console.warn(e); // eslint-disable-line no-console\n });\n }\n }\n } catch (e) {\n console.warn(e); // eslint-disable-line no-console\n }\n return false;\n};\n\n/**\n * Init 'KeepAlive' feature\n */\nGeScriptLoader.prototype.initKeepAlive = function () {\n var geIframe = document.querySelector('#gle_iframe');\n try {\n var requestData = {\n cartHash: geIframe.dataset.cartHash,\n sessionId: geIframe.dataset.sessionId\n };\n window.globaleKeepAlive = setInterval(function () {\n Helpers.makeJsonAjaxCall(geIframe.dataset.keepaliveUrl, 'POST', JSON.stringify(requestData))\n .then(function (response) {\n if (response) {\n response = JSON.parse(response);\n if (!response.success && response.refresh) {\n window.location.reload();\n } else if (!response.success && response.redirectUrl) {\n window.location.href = response.redirectUrl;\n }\n }\n })\n .catch(function (e) {\n console.warn(e); // eslint-disable-line no-console\n });\n }, 10000); // every 10 seconds\n } catch (e) {\n console.warn(e); // eslint-disable-line no-console\n }\n};\n\n/**\n * Handler function of 'GlobalE.OnCheckoutStepLoadedHandler' event\n * @param {Object} data - Event data\n */\nGeScriptLoader.prototype.onCheckoutStepLoadedHandler = function (data) {\n try {\n if (data.StepId === data.Steps.CONFIRMATION) {\n // stop sending keepAlive ajax call\n if (('globaleKeepAlive' in window) && window.globaleKeepAlive) {\n clearInterval(window.globaleKeepAlive);\n }\n }\n\n /**\n * If you need to implement the frontend analytics please put it here\n */\n\n /**\n * Only for Backend Analytics, like standard SFCC Merchant Tools / Analytics / Purchase Reports.\n * Should be handled in Globale-Analytics controller\n */\n var geIframe = document.querySelector('#gle_iframe');\n Helpers.makeJsonAjaxCall(geIframe.dataset.analyticsUrl, 'POST', JSON.stringify(data))\n .then(function (response) { // eslint-disable-line no-unused-vars\n // handle response\n })\n .catch(function (e) {\n console.warn(e); // eslint-disable-line no-console\n });\n } catch (e) {\n console.warn(e); // eslint-disable-line no-console\n }\n};\n\n/**\n * Handler function of 'GlobalE.OnClientEvent' event\n * Used for Extreme Analytic\n * @param {string} source - Event source\n * @param {Object} data - Event data\n */\nGeScriptLoader.prototype.onClientEvent = function (source, data) { // eslint-disable-line no-unused-vars\n try {\n switch (source) {\n case GEMerchantUtils.ClientEvents.INPUT_BLUR: // eslint-disable-line no-undef\n // your code\n break;\n case GEMerchantUtils.ClientEvents.STORE_SELECTION: // eslint-disable-line no-undef\n // your code\n break;\n case GEMerchantUtils.ClientEvents.SHIPPINGMETHOD_SELECTION: // eslint-disable-line no-undef\n // your code\n break;\n case GEMerchantUtils.ClientEvents.TAX_OPTION_SELECTED: // eslint-disable-line no-undef\n // your code\n break;\n case GEMerchantUtils.ClientEvents.PAYMENTMETHOD_CHANGED: // eslint-disable-line no-undef\n // your code\n break;\n case GEMerchantUtils.ClientEvents.BUTTON_CLICKED: // eslint-disable-line no-undef\n // your code\n break;\n case GEMerchantUtils.ClientEvents.COMBO_CHANGED: // eslint-disable-line no-undef\n // your code\n break;\n case GEMerchantUtils.ClientEvents.ADD_NEW_SHIPPING_ADDRESS: // eslint-disable-line no-undef\n // your code\n break;\n case GEMerchantUtils.ClientEvents.ON_PAGE_LOAD: // eslint-disable-line no-undef\n // your code\n break;\n case GEMerchantUtils.ClientEvents.ON_CLIENT_ERROR: // eslint-disable-line no-undef\n // your code\n break;\n case GEMerchantUtils.ClientEvents.ON_SERVER_ERROR: // eslint-disable-line no-undef\n // your code\n break;\n case GEMerchantUtils.ClientEvents.CHECKBOX_CHANGE: // eslint-disable-line no-undef\n // your code\n break;\n case GEMerchantUtils.ClientEvents.WINDOW_SHOWN: // eslint-disable-line no-undef\n // your code\n break;\n default:\n break;\n }\n } catch (e) {\n console.warn(e); // eslint-disable-line no-console\n }\n};\n\n/**\n * Customer registration post message handler\n * @param {Object} event - Event object\n */\nGeScriptLoader.prototype.registrationPostMessageHandler = function (event) {\n try {\n // check request is from legitimate source and message is expected or not\n if (!GlobalE || !GlobalE.CheckoutManager || !GlobalE.CheckoutManager.IsGlobaleMessage(event.origin)) { return; }\n var eventMessage = JSON.parse(event.data);\n var geIframe = document.querySelector('#gle_iframe');\n if (('Key' in eventMessage) && eventMessage.Key === 'CustomerRegistration') {\n Helpers.makeJsonAjaxCall(geIframe.dataset.registrationUrl, 'POST', JSON.stringify(eventMessage.Data))\n .then(function (response) {\n if (response) {\n response = JSON.parse(response);\n GlobalE.CheckoutManager.UpdateGlobalE('CustomerRegistration', response);\n }\n })\n .catch(function (e) {\n console.warn(e); // eslint-disable-line no-console\n });\n }\n } catch (e) {\n console.warn(e); // eslint-disable-line no-console\n }\n};\n\n/**\n * Init events\n */\nGeScriptLoader.prototype.initEvents = function () {\n // check script loader data\n if (!window.geScriptLoaderData) {\n return;\n }\n\n // ---------------------------GENERAL EVENTS--------------------------- //\n // 'GlobalE.SetMerchantParameters' event\n GlobalE.SetMerchantParameters(JSON.parse(window.geScriptLoaderData.clientSettings));\n\n // 'GlobalE.ScriptsURL' event\n GlobalE.ScriptsURL(window.geScriptLoaderData.clientJsDomain);\n\n // 'GlobalE.SetCookieDomain' event\n GlobalE.SetCookieDomain(window.geScriptLoaderData.cookieDomain);\n\n // Remove Global-e redirect parameters\n this.removeGeRedirectParams();\n\n // 'GlobalE.LoadWelcome' event\n if (window.geScriptLoaderData.globaleOperatedCountry && window.geScriptLoaderData.allowedSite) {\n GlobalE.LoadWelcome(window.geScriptLoaderData.country, window.geScriptLoaderData.culture, window.geScriptLoaderData.currency);\n }\n\n // 'GlobalE.LoadShippingSwitcher' event\n GlobalE.LoadShippingSwitcher(window.geScriptLoaderData.country, window.geScriptLoaderData.culture, window.geScriptLoaderData.currency, false, this.loadShippingSwitcherHandler);\n\n // 'GlobalE.OnShippingSwitcherClosed' event\n GlobalE.OnShippingSwitcherClosed(this.onShippingSwitcherClosedHandler);\n\n // ---------------------------CHECKOUT EVENTS--------------------------- //\n var geIframe = document.querySelector('#gle_iframe');\n if (geIframe) {\n // 'GlobalE.Checkout' event\n GlobalE.Checkout(geIframe.dataset.cartToken, 'gle_iframe');\n\n // 'KeepAlive' feature\n this.initKeepAlive();\n\n // 'GlobalE.OnCheckoutStepLoaded' event\n GlobalE.OnCheckoutStepLoaded(this.onCheckoutStepLoadedHandler);\n\n // 'GlobalE.OnClientEvent' event\n GlobalE.OnClientEvent(this.onClientEvent);\n\n // 'Customer registration' feature\n window.addEventListener('message', this.registrationPostMessageHandler, false);\n }\n};\n\nGeScriptLoader.prototype.init = function () {\n this.initScriptLoaderData();\n this.initContentPriceConversion();\n this.initClientSDK()\n .then(this.initEvents.bind(this))\n .catch(function (e) {\n console.warn(e); // eslint-disable-line no-console\n });\n};\n\n//--------------------------------------------------\n// Initialisation\n//--------------------------------------------------\n\n/**\n * General init function\n */\nfunction init() {\n var geScriptLoader = new GeScriptLoader();\n geScriptLoader.init();\n}\n\n/**\n * Run initialisation once document is loaded\n */\nif (/complete|interactive|loaded/.test(document.readyState)) {\n init();\n} else {\n document.addEventListener('DOMContentLoaded', init);\n}\n"],"sourceRoot":""}