/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 7); /******/ }) /************************************************************************/ /******/ ({ /***/ 7: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addFeatureSettings", function() { return addFeatureSettings; }); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; function addFeatureSettings(feature, settings, app) { if (app === void 0) { app = "modeMagic"; } var settingsPath = "".concat(app, "Settings"); if (typeof window[settingsPath] === "undefined") { window[settingsPath] = {}; } if (typeof settings !== "undefined") { window[settingsPath][feature] = settings; } } function loadScripts(scripts) { scripts.forEach(function (_a) { var name = _a.name, src = _a.src, data = _a.data; addFeatureSettings(name, data, "modeMagic"); var script = document.createElement("script"); script.type = "text/javascript"; script.src = src; document.body.appendChild(script); }); } function onFeaturesLoaded(req) { try { var responseJSON = JSON.parse(req.responseText); var scripts = responseJSON.data; loadScripts(scripts); } catch (ex) { console.debug(ex); } } function getDataset() { var appElements = document.querySelectorAll("[data-app='mm']"); var dataset = {}; appElements.forEach(function (el) { dataset = __assign(__assign({}, dataset), el.dataset); }); return dataset; } function createParams(obj) { return Object.entries(obj) .reduce(function (acc, _a) { var key = _a[0], value = _a[1]; if (value) { return __spreadArray(__spreadArray([], acc, true), [ "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)), ], false); } return acc; }, []) .join("&"); } (function init() { var url = "https://app.getmodemagic.com/api/features"; var http = new XMLHttpRequest(); var dataset = getDataset(); var shopName = window.Shopify.shop.split(".")[0]; var paramsJson = __assign(__assign({ shop: shopName, path: window.location.pathname, domain: window.location.host }, dataset), { app: "modemagic" }); var params = createParams(paramsJson); http.addEventListener("load", onFeaturesLoaded.bind(null, http)); http.open("GET", url); http.open("GET", "".concat(url, "?").concat(params), true); http.send(); })(); /***/ }) /******/ });