@dori-ai/dori-pdp-widget 0.6.21 → 0.6.22

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.
Binary file
Binary file
package/dist/widget.js CHANGED
@@ -1 +1 @@
1
- const e={},t=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let t=function(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))};const i=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),s=a?.nonce||a?.getAttribute("nonce");o=t(n.map(t=>{if(t=function(e,t){return new URL(e,t).href}(t,r),t in e)return;e[t]=!0;const n=t.endsWith(".css"),o=n?'[rel="stylesheet"]':"";if(r)for(let e=i.length-1;e>=0;e--){const r=i[e];if(r.href===t&&(!n||"stylesheet"===r.rel))return}else if(document.querySelector(`link[href="${t}"]${o}`))return;const a=document.createElement("link");return a.rel=n?"stylesheet":"modulepreload",n||(a.as="script"),a.crossOrigin="",a.href=t,s&&a.setAttribute("nonce",s),document.head.appendChild(a),n?new Promise((e,n)=>{a.addEventListener("load",e),a.addEventListener("error",()=>n(new Error(`Unable to preload CSS for ${t}`)))}):void 0}))}function i(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(e=>{for(const t of e||[])"rejected"===t.status&&i(t.reason);return t().catch(i)})};function n(){if("undefined"==typeof window)return null;const e=window.location.pathname.match(/^\/([a-z]{2})-[a-z]{2}\//i);if(e)return e[1].toLowerCase();const t=document.documentElement.lang;if(t){const e=t.split("-")[0]?.toLowerCase();if(e)return e}return null}const r={af:"Afrikaans",sq:"Albanian",am:"Amharic",ar:"Arabic",bn:"Bengali",bg:"Bulgarian",my:"Burmese",zh:"Chinese",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",fi:"Finnish",fr:"French",de:"German",el:"Greek",gu:"Gujarati",ha:"Hausa",he:"Hebrew",hi:"Hindi",hu:"Hungarian",ig:"Igbo",id:"Indonesian",it:"Italian",ja:"Japanese",kn:"Kannada",km:"Khmer",ko:"Korean",lo:"Lao",lv:"Latvian",lt:"Lithuanian",ms:"Malay",ml:"Malayalam",mr:"Marathi",mn:"Mongolian",ne:"Nepali",no:"Norwegian",ps:"Pashto",fa:"Persian",pl:"Polish",pt:"Portuguese",pa:"Punjabi",ro:"Romanian",ru:"Russian",si:"Sinhala",sk:"Slovak",so:"Somali",es:"Spanish",sw:"Swahili",sv:"Swedish",ta:"Tamil",te:"Telugu",th:"Thai",tr:"Turkish",uk:"Ukrainian",ur:"Urdu",vi:"Vietnamese",yo:"Yoruba",zu:"Zulu"};function o(e){return e?r[e.toLowerCase()]??null:null}function i(e){if("undefined"==typeof window||"undefined"==typeof MutationObserver)return()=>{};const t=new MutationObserver(()=>{e(n())});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]}),()=>t.disconnect()}const a=["pointerdown","keydown"],s=["pointermove","touchstart","wheel","scroll"],d=["pointerover","focusin","click"],c="data-dori-pdp-skeleton",u="dori-widget-container";function l(e){const t=document.createElement("div");return t.style.cssText=e+"background:linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.11) 50%, rgba(0,0,0,0.06) 75%);background-size:200% 100%;animation:dori-pdp-shimmer 1.4s ease-in-out infinite;",t}function m(e){const t=document.createElement("div");return t.style.cssText="box-sizing:border-box;width:100%;height:84px;padding:14px 16px;border:1px solid rgba(0,0,0,0.08);border-radius:16px;background:rgba(0,0,0,0.02);margin-bottom:10px;",t.appendChild(l(`width:${e};height:16px;border-radius:9999px;margin-bottom:14px;`)),t.appendChild(l("width:80%;height:14px;border-radius:9999px;")),t}function h(){try{const e=document.getElementById(u);return!!e?.querySelector(`[${c}]`)}catch{return!1}}function p(){try{const e=document.getElementById(u),t=e?.querySelector(`[${c}]`);t?.remove()}catch{}}!async function(){try{const e=document.querySelector("script#dori-react-widget"),t=e?.getAttribute("data-sharing-id"),r=e?.getAttribute("data-product-id");if(!t)return;const o="https://standardapi.dori.tech",i=n();window.doriPDPBotDataPromise=(async()=>{const e=new URLSearchParams;r&&e.set("product_id",r),i&&e.set("locale",i);const n=e.toString(),a=`${o}/bot-sharing-data/${t}${n?`?${n}`:""}`,s=await fetch(a);if(200!==s.status)throw new Error(`Failed to fetch bot data: ${s.status}`);const d=await s.json();if(d.error)throw new Error(d.error);if(!d.data)throw new Error("No data received from bot sharing API");return d.data})()}catch(e){console.error("[Mori Widget] Error setting up prefetch:",e),window.doriPDPBotDataPromise=Promise.reject(e instanceof Error?e.message:String(e))}}(),function(e,t={}){let n=!1;try{n=window.self!==window.top}catch{n=!0}if(n)return t.onLoadStart?.(),void e();let r=!1;const o=[],i=()=>{if(!r){r=!0;for(const e of o)e();t.onLoadStart?.(),e()}},c=(e,t)=>{"function"==typeof window.requestIdleCallback?window.requestIdleCallback(()=>e(),{timeout:t}):window.setTimeout(e,200)},u=(e,t,n)=>{e.addEventListener(t,n,{once:!0,passive:!0,capture:!0}),o.push(()=>e.removeEventListener(t,n,!0))};for(const s of a)u(window,s,i);let l=!1;const m=()=>{l||r||(l=!0,c(i,2e3))};for(const a of s)u(window,a,m);for(const a of t.immediateTargets??[])if(a)for(const e of d)u(a,e,i);const h=()=>{if(r)return;const e=window.setTimeout(()=>c(i,1e3),5e3);o.push(()=>window.clearTimeout(e))};"complete"===document.readyState?h():window.addEventListener("load",h,{once:!0})}(()=>{t(async()=>{const{initializeDoriWidget:e}=await import("./assets/main-B9vcjXLK.js").then(e=>e.e);return{initializeDoriWidget:e}},[],import.meta.url).then(({initializeDoriWidget:e})=>e()).catch(e=>{p(),console.error("[Mori Widget] Error initializing widget:",e)})},{immediateTargets:[document.getElementById("dori-widget-container")],onLoadStart:function(){try{const e=document.getElementById(u);if(!e)return;if(e.querySelector(`[${c}]`))return;if(document.getElementById("mori-react-widget-host"))return;e.style.minHeight||(e.style.minHeight="400px");const t=document.createElement("div");t.setAttribute(c,""),t.setAttribute("aria-hidden","true"),t.style.cssText="box-sizing:border-box;width:100%;padding:12px;",t.appendChild(m("34%")),t.appendChild(m("28%")),t.appendChild(m("30%")),t.appendChild(l("width:100%;height:44px;border-radius:24px;margin-top:4px;"));const n=document.createElement("style");n.textContent=`@keyframes dori-pdp-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}@media (prefers-reduced-motion: reduce){[${c}] div{animation:none !important}}`,t.appendChild(n),e.appendChild(t)}catch{}}});export{t as _,n as d,h,o as l,i as o,p as r};
1
+ const e={},t=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let t=function(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))};const i=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),s=a?.nonce||a?.getAttribute("nonce");o=t(n.map(t=>{if(t=function(e,t){return new URL(e,t).href}(t,r),t in e)return;e[t]=!0;const n=t.endsWith(".css"),o=n?'[rel="stylesheet"]':"";if(r)for(let e=i.length-1;e>=0;e--){const r=i[e];if(r.href===t&&(!n||"stylesheet"===r.rel))return}else if(document.querySelector(`link[href="${t}"]${o}`))return;const a=document.createElement("link");return a.rel=n?"stylesheet":"modulepreload",n||(a.as="script"),a.crossOrigin="",a.href=t,s&&a.setAttribute("nonce",s),document.head.appendChild(a),n?new Promise((e,n)=>{a.addEventListener("load",e),a.addEventListener("error",()=>n(new Error(`Unable to preload CSS for ${t}`)))}):void 0}))}function i(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(e=>{for(const t of e||[])"rejected"===t.status&&i(t.reason);return t().catch(i)})};function n(){if("undefined"==typeof window)return null;const e=window.location.pathname.match(/^\/([a-z]{2})-[a-z]{2}\//i);if(e)return e[1].toLowerCase();const t=document.documentElement.lang;if(t){const e=t.split("-")[0]?.toLowerCase();if(e)return e}return null}const r={af:"Afrikaans",sq:"Albanian",am:"Amharic",ar:"Arabic",bn:"Bengali",bg:"Bulgarian",my:"Burmese",zh:"Chinese",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",fi:"Finnish",fr:"French",de:"German",el:"Greek",gu:"Gujarati",ha:"Hausa",he:"Hebrew",hi:"Hindi",hu:"Hungarian",ig:"Igbo",id:"Indonesian",it:"Italian",ja:"Japanese",kn:"Kannada",km:"Khmer",ko:"Korean",lo:"Lao",lv:"Latvian",lt:"Lithuanian",ms:"Malay",ml:"Malayalam",mr:"Marathi",mn:"Mongolian",ne:"Nepali",no:"Norwegian",ps:"Pashto",fa:"Persian",pl:"Polish",pt:"Portuguese",pa:"Punjabi",ro:"Romanian",ru:"Russian",si:"Sinhala",sk:"Slovak",so:"Somali",es:"Spanish",sw:"Swahili",sv:"Swedish",ta:"Tamil",te:"Telugu",th:"Thai",tr:"Turkish",uk:"Ukrainian",ur:"Urdu",vi:"Vietnamese",yo:"Yoruba",zu:"Zulu"};function o(e){return e?r[e.toLowerCase()]??null:null}function i(e){if("undefined"==typeof window||"undefined"==typeof MutationObserver)return()=>{};const t=new MutationObserver(()=>{e(n())});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]}),()=>t.disconnect()}const a=["pointerdown","keydown"],s=["pointermove","touchstart","wheel","scroll"],d=["pointerover","focusin","click"],c="data-dori-pdp-skeleton",u="dori-widget-container";function l(e){const t=document.createElement("div");return t.style.cssText=e+"background:linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.11) 50%, rgba(0,0,0,0.06) 75%);background-size:200% 100%;animation:dori-pdp-shimmer 1.4s ease-in-out infinite;",t}function m(e){const t=document.createElement("div");return t.style.cssText="box-sizing:border-box;width:100%;height:84px;padding:14px 16px;border:1px solid rgba(0,0,0,0.08);border-radius:16px;background:rgba(0,0,0,0.02);margin-bottom:10px;",t.appendChild(l(`width:${e};height:16px;border-radius:9999px;margin-bottom:14px;`)),t.appendChild(l("width:80%;height:14px;border-radius:9999px;")),t}function h(){try{const e=document.getElementById(u);return!!e?.querySelector(`[${c}]`)}catch{return!1}}function p(){try{const e=document.getElementById(u),t=e?.querySelector(`[${c}]`);t?.remove()}catch{}}!async function(){try{const e=document.querySelector("script#dori-react-widget"),t=e?.getAttribute("data-sharing-id"),r=e?.getAttribute("data-product-id");if(!t)return;const o="https://standardapi.dori.tech",i=n();window.doriPDPBotDataPromise=(async()=>{const e=new URLSearchParams;r&&e.set("product_id",r),i&&e.set("locale",i);const n=e.toString(),a=`${o}/bot-sharing-data/${t}${n?`?${n}`:""}`,s=await fetch(a);if(200!==s.status)throw new Error(`Failed to fetch bot data: ${s.status}`);const d=await s.json();if(d.error)throw new Error(d.error);if(!d.data)throw new Error("No data received from bot sharing API");return d.data})()}catch(e){window.doriPDPBotDataPromise=Promise.reject(e instanceof Error?e.message:String(e))}}(),function(e,t={}){let n=!1;try{n=window.self!==window.top}catch{n=!0}if(n)return t.onLoadStart?.(),void e();let r=!1;const o=[],i=()=>{if(!r){r=!0;for(const e of o)e();t.onLoadStart?.(),e()}},c=(e,t)=>{"function"==typeof window.requestIdleCallback?window.requestIdleCallback(()=>e(),{timeout:t}):window.setTimeout(e,200)},u=(e,t,n)=>{e.addEventListener(t,n,{once:!0,passive:!0,capture:!0}),o.push(()=>e.removeEventListener(t,n,!0))};for(const s of a)u(window,s,i);let l=!1;const m=()=>{l||r||(l=!0,c(i,2e3))};for(const a of s)u(window,a,m);for(const a of t.immediateTargets??[])if(a)for(const e of d)u(a,e,i);const h=()=>{if(r)return;const e=window.setTimeout(()=>c(i,1e3),5e3);o.push(()=>window.clearTimeout(e))};"complete"===document.readyState?h():window.addEventListener("load",h,{once:!0})}(()=>{t(async()=>{const{initializeDoriWidget:e}=await import("./assets/main-C61TXPwL.js").then(e=>e.e);return{initializeDoriWidget:e}},[],import.meta.url).then(({initializeDoriWidget:e})=>e()).catch(e=>{p()})},{immediateTargets:[document.getElementById("dori-widget-container")],onLoadStart:function(){try{const e=document.getElementById(u);if(!e)return;if(e.querySelector(`[${c}]`))return;if(document.getElementById("mori-react-widget-host"))return;e.style.minHeight||(e.style.minHeight="400px");const t=document.createElement("div");t.setAttribute(c,""),t.setAttribute("aria-hidden","true"),t.style.cssText="box-sizing:border-box;width:100%;padding:12px;",t.appendChild(m("34%")),t.appendChild(m("28%")),t.appendChild(m("30%")),t.appendChild(l("width:100%;height:44px;border-radius:24px;margin-top:4px;"));const n=document.createElement("style");n.textContent=`@keyframes dori-pdp-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}@media (prefers-reduced-motion: reduce){[${c}] div{animation:none !important}}`,t.appendChild(n),e.appendChild(t)}catch{}}});export{t as _,n as d,h,o as l,i as o,p as r};
package/dist/widget.js.br CHANGED
Binary file
package/dist/widget.js.gz CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dori-ai/dori-pdp-widget",
3
- "version": "0.6.21",
3
+ "version": "0.6.22",
4
4
  "main": "dist/widget.js",
5
5
  "unpkg": "dist/widget.js",
6
6
  "type": "module",