@dori-ai/dori-pdp-widget 0.4.0 → 0.4.2

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
package/dist/widget.js CHANGED
@@ -1 +1 @@
1
- const e={};function t(){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 n={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",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 r(e){return e?n[e.toLowerCase()]??null:null}function a(e){if("undefined"==typeof window||"undefined"==typeof MutationObserver)return()=>{};const n=new MutationObserver(()=>{e(t())});return n.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]}),()=>n.disconnect()}!async function(){try{const e=document.querySelector("script#dori-react-widget"),n=e?.getAttribute("data-sharing-id"),r=e?.getAttribute("data-product-id");if(!n)return;const a="https://standardapi.dori.tech",i=t();window.doriPDPBotDataPromise=(async()=>{const e=new URLSearchParams;r&&e.set("product_id",r),i&&e.set("locale",i);const t=e.toString(),o=`${a}/bot-sharing-data/${n}${t?`?${t}`:""}`,s=await fetch(o);if(200!==s.status)throw new Error(`Failed to fetch bot data: ${s.status}`);const u=await s.json();if(u.error)throw new Error(u.error);if(!u.data)throw new Error("No data received from bot sharing API");return u.data})()}catch(e){window.doriPDPBotDataPromise=Promise.reject(e instanceof Error?e.message:String(e))}}(),async function(){try{const{initializeDoriWidget:t}=await function(t,n,r){let a=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"),o=document.querySelector("meta[property=csp-nonce]"),s=o?.nonce||o?.getAttribute("nonce");a=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"),a=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}"]${a}`))return;const o=document.createElement("link");return o.rel=n?"stylesheet":"modulepreload",n||(o.as="script"),o.crossOrigin="",o.href=t,s&&o.setAttribute("nonce",s),document.head.appendChild(o),n?new Promise((e,n)=>{o.addEventListener("load",e),o.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 a.then(e=>{for(const t of e||[])"rejected"===t.status&&i(t.reason);return t().catch(i)})}(async()=>{const{initializeDoriWidget:e}=await import("./assets/main-ELZb3Vk0.js");return{initializeDoriWidget:e}},[],import.meta.url);t()}catch(t){}}();export{t as d,r as l,a as o};
1
+ const e={};function t(){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 n={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",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 r(e){return e?n[e.toLowerCase()]??null:null}function a(e){if("undefined"==typeof window||"undefined"==typeof MutationObserver)return()=>{};const n=new MutationObserver(()=>{e(t())});return n.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]}),()=>n.disconnect()}!async function(){try{const e=document.querySelector("script#dori-react-widget"),n=e?.getAttribute("data-sharing-id"),r=e?.getAttribute("data-product-id");if(!n)return;const a="https://standardapi.dori.tech",i=t();window.doriPDPBotDataPromise=(async()=>{const e=new URLSearchParams;r&&e.set("product_id",r),i&&e.set("locale",i);const t=e.toString(),o=`${a}/bot-sharing-data/${n}${t?`?${t}`:""}`,s=await fetch(o);if(200!==s.status)throw new Error(`Failed to fetch bot data: ${s.status}`);const u=await s.json();if(u.error)throw new Error(u.error);if(!u.data)throw new Error("No data received from bot sharing API");return u.data})()}catch(e){window.doriPDPBotDataPromise=Promise.reject(e instanceof Error?e.message:String(e))}}(),async function(){try{const{initializeDoriWidget:t}=await function(t,n,r){let a=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"),o=document.querySelector("meta[property=csp-nonce]"),s=o?.nonce||o?.getAttribute("nonce");a=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"),a=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}"]${a}`))return;const o=document.createElement("link");return o.rel=n?"stylesheet":"modulepreload",n||(o.as="script"),o.crossOrigin="",o.href=t,s&&o.setAttribute("nonce",s),document.head.appendChild(o),n?new Promise((e,n)=>{o.addEventListener("load",e),o.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 a.then(e=>{for(const t of e||[])"rejected"===t.status&&i(t.reason);return t().catch(i)})}(async()=>{const{initializeDoriWidget:e}=await import("./assets/main-DD-6K8oT.js");return{initializeDoriWidget:e}},[],import.meta.url);t()}catch(t){}}();export{t as d,r as l,a as o};
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.4.0",
3
+ "version": "0.4.2",
4
4
  "main": "dist/widget.js",
5
5
  "unpkg": "dist/widget.js",
6
6
  "type": "module",
Binary file