@letscooee/web-sdk 12.2.21 → 13.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{e as D,f as A}from"./chunk-V7UGKYBN.js";var V=D((C,m)=>{"use strict";(function(r){"use strict";var e={};e.VERSION="1.6.1";var s,f={},E=function(o,t){return function(){return t.apply(o,arguments)}},h=function(){var o=arguments,t=o[0],u,n;for(n=1;n<o.length;n++)for(u in o[n])!(u in t)&&o[n].hasOwnProperty(u)&&(t[u]=o[n][u]);return t},g=function(o,t){return{value:o,name:t}};e.TRACE=g(1,"TRACE"),e.DEBUG=g(2,"DEBUG"),e.INFO=g(3,"INFO"),e.TIME=g(4,"TIME"),e.WARN=g(5,"WARN"),e.ERROR=g(8,"ERROR"),e.OFF=g(99,"OFF");var _=function(o){this.context=o,this.setLevel(o.filterLevel),this.log=this.info};_.prototype={setLevel:function(o){o&&"value"in o&&(this.context.filterLevel=o)},getLevel:function(){return this.context.filterLevel},enabledFor:function(o){var t=this.context.filterLevel;return o.value>=t.value},trace:function(){this.invoke(e.TRACE,arguments)},debug:function(){this.invoke(e.DEBUG,arguments)},info:function(){this.invoke(e.INFO,arguments)},warn:function(){this.invoke(e.WARN,arguments)},error:function(){this.invoke(e.ERROR,arguments)},time:function(o){typeof o=="string"&&o.length>0&&this.invoke(e.TIME,[o,"start"])},timeEnd:function(o){typeof o=="string"&&o.length>0&&this.invoke(e.TIME,[o,"end"])},invoke:function(o,t){s&&this.enabledFor(o)&&s(t,h({level:o},this.context))}};var i=new _({filterLevel:e.OFF});(function(){var o=e;o.enabledFor=E(i,i.enabledFor),o.trace=E(i,i.trace),o.debug=E(i,i.debug),o.time=E(i,i.time),o.timeEnd=E(i,i.timeEnd),o.info=E(i,i.info),o.warn=E(i,i.warn),o.error=E(i,i.error),o.log=o.info})(),e.setHandler=function(o){s=o},e.setLevel=function(o){i.setLevel(o);for(var t in f)f.hasOwnProperty(t)&&f[t].setLevel(o)},e.getLevel=function(){return i.getLevel()},e.get=function(o){return f[o]||(f[o]=new _(h({name:o},i.context)))},e.createDefaultHandler=function(o){o=o||{},o.formatter=o.formatter||function(l,c){c.name&&l.unshift("["+c.name+"]")};var t={},u=function(n,l){Function.prototype.apply.call(n,console,l)};return typeof console>"u"?function(){}:function(n,l){n=Array.prototype.slice.call(n);var c=console.log,d;l.level===e.TIME?(d=(l.name?"["+l.name+"] ":"")+n[0],n[1]==="start"?console.time?console.time(d):t[d]=new Date().getTime():console.timeEnd?console.timeEnd(d):u(c,[d+": "+(new Date().getTime()-t[d])+"ms"])):(l.level===e.WARN&&console.warn?c=console.warn:l.level===e.ERROR&&console.error?c=console.error:l.level===e.INFO&&console.info?c=console.info:l.level===e.DEBUG&&console.debug?c=console.debug:l.level===e.TRACE&&console.trace&&(c=console.trace),o.formatter(n,l),u(c,n))}},e.useDefaults=function(o){e.setLevel(o&&o.defaultLevel||e.DEBUG),e.setHandler(e.createDefaultHandler(o))},e.setDefaults=e.useDefaults,typeof define=="function"&&define.amd?define(e):typeof m<"u"&&m.exports?m.exports=e:(e._prevLogger=r.Logger,e.noConflict=function(){return r.Logger=e._prevLogger,e},r.Logger=e)})(C)});var I="12.2.21";var b=I.split("-")[0].split(".").slice(0,3).map(r=>r.padStart(2,"0")).join(""),S="WEB",N="CooeeSDK",p=I,M=parseInt(b,10);var P=["collection","product","cart"],U=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}],x=["View Item","View Cart","View Collection"],F=["CE Screen View","View Collection","View Item","View Cart"];var T=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${p}/dist`,L={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",baseURL:T,styleURL:`${T}/widget.min.css`,widgetURL:`${T}/widget.min.js`,swiperStyleURL:`${T}/swiper-bundle.min.css`};var a=A(V());var v=class{static debuggerEl;static infoLogs=[];static log(...e){a.default.info(...e)}static verbose(...e){a.default.debug(...e)}static error(...e){a.default.error(...e)}static warn(...e){a.default.warn(...e)}static info(...e){a.default.info(...e),this.infoLogs.push({time:new Date,message:e.join(" ")}),this.addToDebugger()}static trace(...e){a.default.trace(...e)}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector("cooee-debugger"),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]))}};function K(r=N){a.default.useDefaults({formatter:function(e){e.unshift(`${r} (v${p}):`)}}),w()&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?a.default.setLevel(a.default[localStorage.cooeeLogLevel]):a.default.setLevel(L.debug?a.default.TRACE:a.default.OFF)}function w(){let r=O();return r==="1"||r==="on"}function O(){return new URL(location.href).searchParams?.get("cooee-debug")}function $(){let r=["display: inline-block;","font-size: 14px;","background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);","color: white;","padding: 4px;","border-radius: 4px;"].join(" "),e=`
1
+ import{e as D,f as A}from"./chunk-V7UGKYBN.js";var V=D((C,m)=>{"use strict";(function(r){"use strict";var e={};e.VERSION="1.6.1";var s,f={},E=function(o,t){return function(){return t.apply(o,arguments)}},h=function(){var o=arguments,t=o[0],u,n;for(n=1;n<o.length;n++)for(u in o[n])!(u in t)&&o[n].hasOwnProperty(u)&&(t[u]=o[n][u]);return t},g=function(o,t){return{value:o,name:t}};e.TRACE=g(1,"TRACE"),e.DEBUG=g(2,"DEBUG"),e.INFO=g(3,"INFO"),e.TIME=g(4,"TIME"),e.WARN=g(5,"WARN"),e.ERROR=g(8,"ERROR"),e.OFF=g(99,"OFF");var _=function(o){this.context=o,this.setLevel(o.filterLevel),this.log=this.info};_.prototype={setLevel:function(o){o&&"value"in o&&(this.context.filterLevel=o)},getLevel:function(){return this.context.filterLevel},enabledFor:function(o){var t=this.context.filterLevel;return o.value>=t.value},trace:function(){this.invoke(e.TRACE,arguments)},debug:function(){this.invoke(e.DEBUG,arguments)},info:function(){this.invoke(e.INFO,arguments)},warn:function(){this.invoke(e.WARN,arguments)},error:function(){this.invoke(e.ERROR,arguments)},time:function(o){typeof o=="string"&&o.length>0&&this.invoke(e.TIME,[o,"start"])},timeEnd:function(o){typeof o=="string"&&o.length>0&&this.invoke(e.TIME,[o,"end"])},invoke:function(o,t){s&&this.enabledFor(o)&&s(t,h({level:o},this.context))}};var i=new _({filterLevel:e.OFF});(function(){var o=e;o.enabledFor=E(i,i.enabledFor),o.trace=E(i,i.trace),o.debug=E(i,i.debug),o.time=E(i,i.time),o.timeEnd=E(i,i.timeEnd),o.info=E(i,i.info),o.warn=E(i,i.warn),o.error=E(i,i.error),o.log=o.info})(),e.setHandler=function(o){s=o},e.setLevel=function(o){i.setLevel(o);for(var t in f)f.hasOwnProperty(t)&&f[t].setLevel(o)},e.getLevel=function(){return i.getLevel()},e.get=function(o){return f[o]||(f[o]=new _(h({name:o},i.context)))},e.createDefaultHandler=function(o){o=o||{},o.formatter=o.formatter||function(l,c){c.name&&l.unshift("["+c.name+"]")};var t={},u=function(n,l){Function.prototype.apply.call(n,console,l)};return typeof console>"u"?function(){}:function(n,l){n=Array.prototype.slice.call(n);var c=console.log,d;l.level===e.TIME?(d=(l.name?"["+l.name+"] ":"")+n[0],n[1]==="start"?console.time?console.time(d):t[d]=new Date().getTime():console.timeEnd?console.timeEnd(d):u(c,[d+": "+(new Date().getTime()-t[d])+"ms"])):(l.level===e.WARN&&console.warn?c=console.warn:l.level===e.ERROR&&console.error?c=console.error:l.level===e.INFO&&console.info?c=console.info:l.level===e.DEBUG&&console.debug?c=console.debug:l.level===e.TRACE&&console.trace&&(c=console.trace),o.formatter(n,l),u(c,n))}},e.useDefaults=function(o){e.setLevel(o&&o.defaultLevel||e.DEBUG),e.setHandler(e.createDefaultHandler(o))},e.setDefaults=e.useDefaults,typeof define=="function"&&define.amd?define(e):typeof m<"u"&&m.exports?m.exports=e:(e._prevLogger=r.Logger,e.noConflict=function(){return r.Logger=e._prevLogger,e},r.Logger=e)})(C)});var I="13.0.1";var b=I.split("-")[0].split(".").slice(0,3).map(r=>r.padStart(2,"0")).join(""),S="WEB",N="CooeeSDK",p=I,M=parseInt(b,10);var P=["collection","product","cart"],U=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}],x=["View Item","View Cart","View Collection"],F=["CE Screen View","View Collection","View Item","View Cart"];var T=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${p}/dist`,L={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",baseURL:T,styleURL:`${T}/widget.min.css`,widgetURL:`${T}/widget.min.js`,swiperStyleURL:`${T}/swiper-bundle.min.css`};var a=A(V());var v=class{static debuggerEl;static infoLogs=[];static log(...e){a.default.info(...e)}static verbose(...e){a.default.debug(...e)}static error(...e){a.default.error(...e)}static warn(...e){a.default.warn(...e)}static info(...e){a.default.info(...e),this.infoLogs.push({time:new Date,message:e.join(" ")}),this.addToDebugger()}static trace(...e){a.default.trace(...e)}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector("cooee-debugger"),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]))}};function K(r=N){a.default.useDefaults({formatter:function(e){e.unshift(`${r} (v${p}):`)}}),w()&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?a.default.setLevel(a.default[localStorage.cooeeLogLevel]):a.default.setLevel(L.debug?a.default.TRACE:a.default.OFF)}function w(){let r=O();return r==="1"||r==="on"}function O(){return new URL(location.href).searchParams?.get("cooee-debug")}function $(){let r=["display: inline-block;","font-size: 14px;","background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);","color: white;","padding: 4px;","border-radius: 4px;"].join(" "),e=`
2
2
  `;e+=`\u{1F4E3} Drive higher conversions with AI-powered onsite engagement
3
3
  `,e+=`\u{1F50D} Track real-time visitor intent & optimize engagement
4
4
  `,e+=`\u{1F4CA} Improve Meta Ads ROAS with intent-driven campaigns
@@ -1 +1 @@
1
- import{j as e,l as D,o as a}from"./chunk-5PGZJPN4.js";import"./chunk-V7UGKYBN.js";function f(i){return i?new Date(i).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,hour12:!1,timeZoneName:"short"}):"N/A"}function T(i){if(i===0)return"0 B";let o=1024,t=["B","KB","MB","GB"],d=Math.floor(Math.log(i)/Math.log(o));return`${(i/Math.pow(o,d)).toFixed(2)} ${t[d]}`}function B(){let i=performance.getEntriesByType?.("resource");if(i)return i.find(o=>o.name.includes("@letscooee/web-sdk")&&o.name.includes("main.min.js"))}function P(i){window.cooeeSDKPreview||!D()||(document.readyState==="complete"?setTimeout(()=>L(i),100):window.addEventListener("load",()=>{setTimeout(()=>L(i),100)}))}function L(i){try{K(i)}catch(o){console.error("Failed to print debugging logs",o)}}function K(i){let o=performance.getEntriesByType?.("navigation")?.[0],t=window.CooeeSDK?.pageLoadTime,d=B(),c=performance.timeOrigin||0,n=o?.responseEnd?c+o.responseEnd:void 0,s=c,m=o?.domContentLoadedEventEnd||0,l=o?.loadEventEnd||0,u=n&&n>0?n:t?t.getTime():0,p=n&&n>0?"HTML download complete":"inline script execution",S=m>0?s+m:void 0,$=l>0?s+l:void 0;e.info("\u23F1\uFE0F \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Performance Timing Report \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"),e.info("\u{1F4C5} Absolute Timestamps (Local Time):"),e.info(" Note: Inline script can execute during HTML download (incremental parsing)"),e.info(""),e.info(` 1. Navigation started: ${f(s)}`);let r=t?t.getTime():0;if(n&&n>0&&r?r<n?(e.info(` 2. Inline script executed: ${f(r)} (during HTML parsing)`),e.info(` 3. HTML download complete: ${f(n)}`)):(e.info(` 2. HTML download complete: ${f(n)}`),e.info(` 3. Inline script executed: ${f(r)}`)):n&&n>0?e.info(` 2. HTML download complete: ${f(n)}`):r&&e.info(` 2. Inline script executed: ${f(r)}`),e.info(` 4. SDK module loaded: ${f(i.getTime())} (from CDN)`),S&&e.info(` 5. DOMContentLoaded: ${f(S)}`),$&&e.info(` 6. Page fully loaded: ${f($)}`),e.info(""),e.info("\u23F1\uFE0F Relative Timings:"),n&&n>0&&s){let g=n-s;e.info(` Shopify backend + HTML download: ${a(g)} (not Cooee SDK)`)}if(u){let g=i.getTime()-u;if(g<0){let w=r>0?r:s,M=r>0?"inline script execution":"navigation start",b=i.getTime()-w;e.info(` SDK module load time: ${a(b)} after ${M}`),e.info(` (Note: Using earlier baseline because SDK loaded before ${p})`)}else e.info(` SDK module load time: ${a(g)} after ${p}`),e.info(` (Baseline: ${p} at ${f(u)})`);let v=i.getTime()-s;e.info(` \u{1F3AF} Total SDK load time: ${a(v)} (from navigation start to SDK ready)`)}m&&m>0&&e.info(` DOMContentLoaded: ${a(m)} after navigation start`),l&&l>0&&e.info(` Page fully loaded: ${a(l)} after navigation start`),h(d),e.info("\u23F1\uFE0F \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550")}function h(i){if(!i){e.info(""),e.info("\u{1F4E6} SDK Resource Metrics: Not available");return}e.info(""),e.info("\u{1F4E6} SDK Resource Metrics:"),e.info(` URL: ${i.name}`),e.info(` Download duration: ${a(i.duration)}`);let o=i.transferSize===0;if(e.info(` Served from: ${o?"\u{1F4BE} Cache (disk/memory)":"\u{1F310} Network"}`),!o){e.info(` Transfer size: ${T(i.transferSize)}`),e.info(` Encoded size: ${T(i.encodedBodySize)}`),e.info(` Decoded size: ${T(i.decodedBodySize)}`);let t=(1-i.encodedBodySize/i.decodedBodySize)*100;t>0&&e.info(` Compression ratio: ${t.toFixed(1)}%`)}if(i.domainLookupEnd>0){let t=i.domainLookupEnd-i.domainLookupStart,d=i.connectEnd-i.connectStart,c=i.responseStart-i.requestStart,n=i.responseEnd-i.responseStart;e.info(" Timing breakdown:"),t>0&&e.info(` DNS lookup: ${a(t)}`),d>0&&e.info(` TCP connect: ${a(d)}`),c>0&&e.info(` Request: ${a(c)}`),n>0&&e.info(` Response: ${a(n)}`)}}export{P as printAllDebugLogs};
1
+ import{j as e,l as D,o as a}from"./chunk-ZKFNVFYE.js";import"./chunk-V7UGKYBN.js";function f(i){return i?new Date(i).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,hour12:!1,timeZoneName:"short"}):"N/A"}function T(i){if(i===0)return"0 B";let o=1024,t=["B","KB","MB","GB"],d=Math.floor(Math.log(i)/Math.log(o));return`${(i/Math.pow(o,d)).toFixed(2)} ${t[d]}`}function B(){let i=performance.getEntriesByType?.("resource");if(i)return i.find(o=>o.name.includes("@letscooee/web-sdk")&&o.name.includes("main.min.js"))}function P(i){window.cooeeSDKPreview||!D()||(document.readyState==="complete"?setTimeout(()=>L(i),100):window.addEventListener("load",()=>{setTimeout(()=>L(i),100)}))}function L(i){try{K(i)}catch(o){console.error("Failed to print debugging logs",o)}}function K(i){let o=performance.getEntriesByType?.("navigation")?.[0],t=window.CooeeSDK?.pageLoadTime,d=B(),c=performance.timeOrigin||0,n=o?.responseEnd?c+o.responseEnd:void 0,s=c,m=o?.domContentLoadedEventEnd||0,l=o?.loadEventEnd||0,u=n&&n>0?n:t?t.getTime():0,p=n&&n>0?"HTML download complete":"inline script execution",S=m>0?s+m:void 0,$=l>0?s+l:void 0;e.info("\u23F1\uFE0F \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Performance Timing Report \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"),e.info("\u{1F4C5} Absolute Timestamps (Local Time):"),e.info(" Note: Inline script can execute during HTML download (incremental parsing)"),e.info(""),e.info(` 1. Navigation started: ${f(s)}`);let r=t?t.getTime():0;if(n&&n>0&&r?r<n?(e.info(` 2. Inline script executed: ${f(r)} (during HTML parsing)`),e.info(` 3. HTML download complete: ${f(n)}`)):(e.info(` 2. HTML download complete: ${f(n)}`),e.info(` 3. Inline script executed: ${f(r)}`)):n&&n>0?e.info(` 2. HTML download complete: ${f(n)}`):r&&e.info(` 2. Inline script executed: ${f(r)}`),e.info(` 4. SDK module loaded: ${f(i.getTime())} (from CDN)`),S&&e.info(` 5. DOMContentLoaded: ${f(S)}`),$&&e.info(` 6. Page fully loaded: ${f($)}`),e.info(""),e.info("\u23F1\uFE0F Relative Timings:"),n&&n>0&&s){let g=n-s;e.info(` Shopify backend + HTML download: ${a(g)} (not Cooee SDK)`)}if(u){let g=i.getTime()-u;if(g<0){let w=r>0?r:s,M=r>0?"inline script execution":"navigation start",b=i.getTime()-w;e.info(` SDK module load time: ${a(b)} after ${M}`),e.info(` (Note: Using earlier baseline because SDK loaded before ${p})`)}else e.info(` SDK module load time: ${a(g)} after ${p}`),e.info(` (Baseline: ${p} at ${f(u)})`);let v=i.getTime()-s;e.info(` \u{1F3AF} Total SDK load time: ${a(v)} (from navigation start to SDK ready)`)}m&&m>0&&e.info(` DOMContentLoaded: ${a(m)} after navigation start`),l&&l>0&&e.info(` Page fully loaded: ${a(l)} after navigation start`),h(d),e.info("\u23F1\uFE0F \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550")}function h(i){if(!i){e.info(""),e.info("\u{1F4E6} SDK Resource Metrics: Not available");return}e.info(""),e.info("\u{1F4E6} SDK Resource Metrics:"),e.info(` URL: ${i.name}`),e.info(` Download duration: ${a(i.duration)}`);let o=i.transferSize===0;if(e.info(` Served from: ${o?"\u{1F4BE} Cache (disk/memory)":"\u{1F310} Network"}`),!o){e.info(` Transfer size: ${T(i.transferSize)}`),e.info(` Encoded size: ${T(i.encodedBodySize)}`),e.info(` Decoded size: ${T(i.decodedBodySize)}`);let t=(1-i.encodedBodySize/i.decodedBodySize)*100;t>0&&e.info(` Compression ratio: ${t.toFixed(1)}%`)}if(i.domainLookupEnd>0){let t=i.domainLookupEnd-i.domainLookupStart,d=i.connectEnd-i.connectStart,c=i.responseStart-i.requestStart,n=i.responseEnd-i.responseStart;e.info(" Timing breakdown:"),t>0&&e.info(` DNS lookup: ${a(t)}`),d>0&&e.info(` TCP connect: ${a(d)}`),c>0&&e.info(` Request: ${a(c)}`),n>0&&e.info(` Response: ${a(n)}`)}}export{P as printAllDebugLogs};