You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
(function(e,t){for(var n in t)e[n]=t[n]})(this,function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=104)}({1:function(e,t){var n=["log","error","warn","info","debug"],r=["time","timeEnd","table","dir","group","groupEnd"],o=window.performance;e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"[LO]";if(!e)throw new Error("Debug namespace required.");var i=function(n){return"".concat(t,"[").concat(e,"] ").concat(n)},a={createBoilerplate:function(e){a[e]=function(){return a.run.apply(a,[e].concat(Array.prototype.slice.call(arguments)))}},shouldDebug:function(){if(window.localStorage){var t=window.localStorage.getItem("debug");if(t){var n=(t=t.replace(/\s/g,"")).split(",");if(n.indexOf("*")>-1)return!(n.indexOf("!"+e)>-1);if(n.indexOf(e)>-1)return!0}return!1}},run:function(){if(a.shouldDebug()){var t=Array.prototype.slice.call(arguments),r=t.shift();return n.includes(r)&&(t.unshift("color: ".concat("#ff9b38",";")),t.unshift("%c".concat("[LO]","[").concat(e,"]"))),console[r].apply&&console[r].apply(console,t),!0}return!1},mark:function(e){return e=i(e),a.shouldDebug()&&o&&o.mark(e)},measure:function(e,t,n){a.shouldDebug()&&o&&(e=i(e),t=i(t),n=i(n),o.measure(e,t,n),o.clearMarks(t),o.clearMarks(n))}};return n.forEach(a.createBoilerplate),r.forEach(a.createBoilerplate),a}},104:function(e,t,n){e.exports=n(143)},13:function(e,t,n){"use strict";var r=n(1),o=new(n.n(r).a)("External Scripts"),i=(Object({NODE_ENV:"production",LO_APP_ENV:"production"}).LO_CDN_PATH,Object({NODE_ENV:"production",LO_APP_ENV:"production"}).LO_CDN_PATH||"https://tools.luckyorange.com"),a={loaded:{},whitelist:{core:{legacy:"".concat(i,"/core/core.legacy.js"),modern:"".concat(i,"/core/core.js"),module:!1},heatmap:{legacy:"".concat(i,"/heatmaps/bootstrap.js"),module:!1},messenger:{legacy:"".concat(i,"/messenger/bootstrap.js"),module:!1},selector:{legacy:"".concat(i,"/core/selector.js"),module:!1},frame:{legacy:"".concat(i,"/core/frame.js"),module:!1},lo:{legacy:"".concat(i,"/core/lo.legacy.js")}},load:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!a.whitelist[e])throw new Error("Script [".concat(e,"] was not found in whitelist."));if(!a.loaded[e]||t.allowMultiple){var n=a.isModern()&&a.whitelist[e].modern?"modern":"legacy",r=null,i=window.localStorage&&window.localStorage.getItem("lo-debug-url:".concat(e)),c=window.localStorage&&window.localStorage.getItem("lo-debug-disable-script");if(c!==e){i?(o.log("Debug URL found for script [".concat(e,"] in localStorage.")),r=i,!1!==a.whitelist[e].module&&(t.module=!0)):r=a.whitelist[e][n],!1!==t.cacheControl&&(r="".concat(r,"?v=").concat("a13a5e4"));var u=null;t.iframe&&(u=!0!==t.iframe?t.iframe:a.createFrame(e)),a.waitForFrameLoad(u,(function(){var n=document;u&&(n=u.contentDocument),t.root&&(n=window.parent.document);var i=a.createScript(r,{name:e,doc:n,module:t.module});n.head.appendChild(i),o.log("Loading script from ".concat(r," ").concat(u?"in iframe":"")),a.loaded[e]=!0}),10)}else o.warn("Script [".concat(e,"] has been disabled by 'lo-debug-disable-script' in localStorage."))}else o.log("Script [".concat(e,"] has already been loaded."))},loadIntegration:function(e){return a.whitelist[e]={legacy:"".concat(i,"/integrations/integration-").concat(e,"/core/main.js")},a.load(e,{iframe:!1,cacheControl:!1})},loadIntegrationPrivacy:function(e){return a.whitelist["".concat(e,"-privacy")]={legacy:"".concat(i,"/integrations/integration-").concat(e,"/privacy/main.js")},a.load("".concat(e,"-privacy"),{iframe:!1,cacheControl:!1})},createScript:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.doc.createElement("script");return n.async=!0,n.charset="utf-8",n.src=e,n.crossOrigin="anonymous",t.name&&(n.id="lo-script-".concat(t.name)),t.module&&(n.type="module"),n},createFrame:function(e){var t=document.createElement("iframe");return t.id="lo-frame-".concat(e),t.src="about:blank",t.setAttribute("aria-hidden","true"),t.setAttribute("title","Lucky Orange: ".concat(e)),t.style.cssText="display: none !important;",document.body.appendChild(t),t},waitForFrameLoad:function(e,t,n){if(!e)return t();n<1?o.error("Frame never loaded."):("about:blank"===document.location.href?window.parent:window).requestAnimationFrame((function(){var n=e.contentDocument.readyState;"complete"===n||"interactive"===n?t():e.contentWindow.addEventListener("load",(function(e){t()}))}))},isModern:function(){return"noModule"in document.createElement("script")}};t.a=a},143:function(e,t,n){"use strict";n.r(t);var r=n(3),o=n(1),i=n.n(o),a=n(51),c=n(62);var u=function(e,t,n){if(!c(e)||"string"!=typeof t)return void 0===n?e:n;var r=function(e){for(var t=e.split("."),n=[],r=0;r<t.length;r++){for(var o=t[r];"\\"===o[o.length-1]&&void 0!==t[r+1];)o=o.slice(0,-1)+".",o+=t[++r];n.push(o)}return n}(t);if(0!==r.length){for(var o=0;o<r.length;o++){if(!Object.prototype.propertyIsEnumerable.call(e,r[o]))return n;if(null==(e=e[r[o]])){if(o!==r.length-1)return n;break}}return e}},l=new i.a("Settings"),s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e={contextWindow:window,endpoint:"https://settings.luckyorange.com"};var t=new r.a,n={state:{},serverTime:void 0,localTime:new Date,getSiteId:function(){var t=null,r="not-found";((t=n.get("site.id"))&&(r="settings"),t||(t=window.localStorage&&window.localStorage.getItem("lo-debug-site-id"))&&(r="debug-key"),t)||(t=Array.from(document.querySelectorAll('script[src*="lo.js"]')).map((function(e){return new URL(e.src).searchParams.get("site-id")})).find((function(e){return null!=e})))&&(r="query-param");return t||(t=e.contextWindow.LOSiteId)&&(r="modern-var"),t||(t=e.contextWindow.__lo_site_id||e.contextWindow.__wtw_lucky_site_id)&&(r="legacy-var"),!t&&e.contextWindow.Ecwid&&(t=e.contextWindow.Ecwid.getAppPublicConfig("lucky-orange"))&&(r="ecwid"),l.log("Got Site ID:",t,r),String(t)},getVisitorId:function(){var t=e.contextWindow.document.cookie.indexOf("lo-uid");if(t>-1){var n=e.contextWindow.document.cookie.substring(t+("lo-uid".length+1));return n=n.substring(0,n.indexOf(";"))}},get:function(e){return u(n.state,e)},getCurrentServerTime:function(){return n.serverTime+n.getElapsedTime()},getElapsedTime:function(){return(new Date).getTime()-this.localTime},getTimeData:function(){return{localTime:n.localTime,serverTime:n.serverTime}},updateServerTime:function(e){!isNaN(e)&&e>0?(n.localTime=(new Date).getTime(),n.serverTime=e):l.error("cannot update serverTime. [".concat(e,"] is invalid"))},load:function(t){return l.log("Loading settings for site:",t),(e.contextWindow.fetch||a.a)(e.endpoint+"/"+t,{method:"GET",headers:{"x-lucky-uid":n.getVisitorId(),"x-lucky-referrer":e.contextWindow.document.referrer}}).then((function(e){if(!e.ok)throw new Error("Unable to get settings: "+e.status);return e.json()})).then((function(e){return n.state=e,n.updateServerTime(new Date(n.get("serverTime")).getTime()),e}))}};return n.load(n.getSiteId()).then((function(){return t.$internal.expose("settings",n,{internal:!0}),n}))},d=n(13),f=new i.a("lo.js");!function(){f.log("Starting Lucky Orange..."),f.mark("start");var e=document.currentScript?document.currentScript.src:"";if(!d.a.isModern())return d.a.load("lo",{iframe:!1,currentScriptSrc:e});var t=new r.a({context:window,traverse:!1}),n={};(new s).then((function(e){return n.settings=e,t=0,new Promise((function(e,n){var r=window.localStorage&&window.localStorage.getItem("lo-debug-app-id"),o=null;window.parent!==window?o=window.parent:window.opener&&(o=window.opener),r?e(r):o?(window.addEventListener("message",(function(n){var r=n.data;("LO::APPID"===r.type||"getAppId"===r.name&&r.payload)&&(clearTimeout(t),e(r.appid||r.payload.appId))})),t=setTimeout((function(){return e("core")}),2500),o.postMessage({name:"getAppId",type:"LO::APPID"},"*")):e("core")}));var t})).then((function(r){return n.settings.get("error")&&"core"===r?(f.log("Unable to start:",n.settings.get()),t):(d.a.load(r,{iframe:"heatmap"!==r,currentScriptSrc:e}),f.mark("end"),f.measure("Starting","start","end"),t)})).catch(f.error)}()},3:function(e,t,n){"use strict";var r=function(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).slice().map((function(e){e(n)})),(e["*"]||[]).slice().map((function(e){e(t,n)}))}}},o=n(1);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=new(n.n(o).a)("Shared API"),c="API Exposed";function u(){for(var e=arguments[0],t=0;t<arguments.length;t++)for(var n in arguments[t])e[n]=arguments[t][n];return e}function l(e,t){for(;e!==e.top;){if(e[t])return e;e=e.parent}return e}t.a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=u({context:null,contextKey:"LO",traverse:!0},e);var t={},n=r(),o={on:n.on,emit:n.emit};n.emit=function(e,n){return t[e]=n,o.emit(e,n)},n.on=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.immediate&&t[e]&&n(t[e]),o.on(e,n)};var s={$internal:{expose:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(n=u({internal:!0},n)).internal?s.$internal:s;if(r[e])throw new Error("Namespace [".concat(e,"] already exposed."));r[e]=t,s.$internal.bus.emit(c,{namespace:e,apiToAdd:t}),a.log("".concat(e," namespace exposed ").concat(n.internal?"internally":"publicly","."))},ready:function(e){return new Promise((function(t,n){var r=s[e]||s.$internal[e];if(r&&"object"===i(r))return t(r);s.$internal.bus.on(c,(function(n){if(n.namespace===e)return t(n.apiToAdd)}))}))},bus:n}};return null===e.context&&e.traverse&&(e.context=l(window,e.contextKey)),e.context[e.contextKey]?e.context[e.contextKey]&&"object"===i(e.context[e.contextKey])&&!e.context[e.contextKey].$internal?(e.context[e.contextKey]=u(s,e.context[e.contextKey]),e.context[e.contextKey]):e.context[e.contextKey]:(e.context[e.contextKey]=s,s)}},51:function(e,t,n){"use strict";t.a=function(e,t){return t=t||{},new Promise((function(n,r){var o=new XMLHttpRequest,i=[],a=[],c={},u=function(){return{ok:2==(o.status/100|0),statusText:o.statusText,status:o.status,url:o.responseURL,text:function(){return Promise.resolve(o.responseText)},json:function(){return Promise.resolve(o.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([o.response]))},clone:u,headers:{keys:function(){return i},entries:function(){return a},get:function(e){return c[e.toLowerCase()]},has:function(e){return e.toLowerCase()in c}}}};for(var l in o.open(t.method||"get",e,!0),o.onload=function(){o.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){i.push(t=t.toLowerCase()),a.push([t,n]),c[t]=c[t]?c[t]+","+n:n})),n(u())},o.onerror=r,o.withCredentials="include"==t.credentials,t.headers)o.setRequestHeader(l,t.headers[l]);o.send(t.body||null)}))}},62:function(e,t,n){"use strict";e.exports=function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}}})); |