dori-side-widget 1.4.54 → 1.4.56
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.
- package/dist/assets/{main-C6T53GJ8.js → main-DEaI-OHY.js} +1 -1
- package/dist/assets/main-DEaI-OHY.js.br +0 -0
- package/dist/assets/main-DEaI-OHY.js.gz +0 -0
- package/dist/widget.js +1 -1
- package/dist/widget.js.br +0 -0
- package/dist/widget.js.gz +0 -0
- package/package.json +1 -1
- package/dist/assets/main-C6T53GJ8.js.br +0 -0
- package/dist/assets/main-C6T53GJ8.js.gz +0 -0
|
Binary file
|
|
Binary file
|
package/dist/widget.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const t={},e={BOT_DATA:"dori_widget_bot_data",CHAT_STATE:"dori_widget_chat_state",MESSAGES:"dori_widget_messages",CURRENT_STEP:"dori_widget_current_step",SESSION_TIMESTAMP:"dori_widget_session_timestamp",FAB_ANIMATION_TIMESTAMP:"dori_widget_fab_animation_timestamp",DORI_THREAD_ID:"dori_thread_id",DORI_SESSION_KEY:"dori_session_key",LOADED_FROM_STORAGE:"dori_loaded_from_storage"};function r(){try{const t="__test__";return sessionStorage.setItem(t,t),sessionStorage.removeItem(t),!0}catch{return!1}}function n(){r()&&sessionStorage.setItem(e.LOADED_FROM_STORAGE,"true")}function o(){r()&&sessionStorage.removeItem(e.LOADED_FROM_STORAGE)}function s(){return!!r()&&"true"===sessionStorage.getItem(e.LOADED_FROM_STORAGE)}function i(){try{const t=sessionStorage.getItem(e.SESSION_TIMESTAMP);if(!t)return!1;const r=parseInt(t,10);return Date.now()-r<864e5}catch{return!1}}function a(){if(r())try{Object.values(e).forEach(t=>{sessionStorage.removeItem(t)})}catch(t){}}function c(t){if(r())try{t?sessionStorage.setItem(e.BOT_DATA,JSON.stringify(t)):sessionStorage.removeItem(e.BOT_DATA)}catch(n){}}function u(){if(!r()||!i())return null;try{const t=sessionStorage.getItem(e.BOT_DATA);return t?JSON.parse(t):null}catch(t){return null}}function l(t){if(r())try{sessionStorage.setItem(e.CHAT_STATE,JSON.stringify(t))}catch(n){}}function d(t){if(r())try{const r=t.map(t=>({...t,timestamp:t.timestamp instanceof Date?t.timestamp.toISOString():t.timestamp}));sessionStorage.setItem(e.MESSAGES,JSON.stringify(r))}catch(n){}}function m(){if(!r()||!i())return[];try{const t=sessionStorage.getItem(e.MESSAGES);return t?JSON.parse(t).map(t=>({...t,timestamp:new Date(t.timestamp)})):[]}catch(t){return[]}}function f(t){if(r())try{sessionStorage.setItem(e.CURRENT_STEP,t)}catch(n){}}function S(){if(!r()||!i())return null;try{const t=u(),n=function(){if(!r()||!i())return null;try{const t=sessionStorage.getItem(e.CHAT_STATE);return t?JSON.parse(t):null}catch(t){return null}}(),o=m(),s=function(){if(!r()||!i())return"welcome";try{return sessionStorage.getItem(e.CURRENT_STEP)||"welcome"}catch(t){return"welcome"}}();return t||o.length>0?{botData:t,chatState:n||{repliedProduct:null,threadId:null,isRequestInProgress:!1},messages:o,currentStep:s,sessionTimestamp:Date.now()}:null}catch(t){return null}}function _(){if(!r()||!i())return!1;try{const t=u(),e=m();return!!(t||e.length>0)}catch{return!1}}function g(){if(r())try{sessionStorage.setItem(e.SESSION_TIMESTAMP,Date.now().toString())}catch(t){}}function h(){if(r())try{sessionStorage.setItem(e.FAB_ANIMATION_TIMESTAMP,Date.now().toString())}catch(t){}}function I(){const t=function(){if(!r()||!i())return null;try{const t=sessionStorage.getItem(e.FAB_ANIMATION_TIMESTAMP);return t?parseInt(t,10):null}catch(t){return null}}();return!t||Date.now()-t>=18e4}function E(){if(!r())return"";try{let t=sessionStorage.getItem(e.DORI_SESSION_KEY);return t||(t="dori_session_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),sessionStorage.setItem(e.DORI_SESSION_KEY,t)),t}catch(t){return""}}function T(t){if(r()&&t)try{sessionStorage.setItem(e.DORI_THREAD_ID,t)}catch(n){}}function w(){if(!r())return null;try{return sessionStorage.getItem(e.DORI_THREAD_ID)}catch(t){return null}}function A(t){const e=window?.chatbotData;if("undefined"!=typeof window&&e?.ajaxurl){const r=E();fetch(e.ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"dori_store_thread_session",thread_id:t,session_key:r,nonce:e.nonce})}).catch(t=>{})}}!async function(){try{const t=document.querySelector("script#dori-side-widget"),e=t?.getAttribute("data-sharing-id");if(!e)return;if(_()){const t=u();if(t)return void(window.moriBotDataPromise=Promise.resolve(t))}window.moriBotDataPromise=(async()=>{const t=`https://standardapi.dori.tech/bot-sharing-data/${e}`,r=await fetch(t);if(200!==r.status)throw new Error(`Failed to fetch bot data: ${r.status}`);const n=await r.json();if(n.error)throw new Error(n.error);if(!n.data)throw new Error("No data received from bot sharing API");return n.data})()}catch(t){window.moriBotDataPromise=Promise.reject(t instanceof Error?t.message:String(t))}}(),async function(){try{const{initializeDoriWidget:e}=await function(e,r,n){let o=Promise.resolve();if(r&&r.length>0){let e=function(t){return Promise.all(t.map(t=>Promise.resolve(t).then(t=>({status:"fulfilled",value:t}),t=>({status:"rejected",reason:t}))))};const s=document.getElementsByTagName("link"),i=document.querySelector("meta[property=csp-nonce]"),a=i?.nonce||i?.getAttribute("nonce");o=e(r.map(e=>{if(e=function(t,e){return new URL(t,e).href}(e,n),e in t)return;t[e]=!0;const r=e.endsWith(".css"),o=r?'[rel="stylesheet"]':"";if(n)for(let t=s.length-1;t>=0;t--){const n=s[t];if(n.href===e&&(!r||"stylesheet"===n.rel))return}else if(document.querySelector(`link[href="${e}"]${o}`))return;const i=document.createElement("link");return i.rel=r?"stylesheet":"modulepreload",r||(i.as="script"),i.crossOrigin="",i.href=e,a&&i.setAttribute("nonce",a),document.head.appendChild(i),r?new Promise((t,r)=>{i.addEventListener("load",t),i.addEventListener("error",()=>r(new Error(`Unable to preload CSS for ${e}`)))}):void 0}))}function s(t){const e=new Event("vite:preloadError",{cancelable:!0});if(e.payload=t,window.dispatchEvent(e),!e.defaultPrevented)throw t}return o.then(t=>{for(const e of t||[])"rejected"===e.status&&s(e.reason);return e().catch(s)})}(async()=>{const{initializeDoriWidget:t}=await import("./assets/main-
|
|
1
|
+
const t={},e={BOT_DATA:"dori_widget_bot_data",CHAT_STATE:"dori_widget_chat_state",MESSAGES:"dori_widget_messages",CURRENT_STEP:"dori_widget_current_step",SESSION_TIMESTAMP:"dori_widget_session_timestamp",FAB_ANIMATION_TIMESTAMP:"dori_widget_fab_animation_timestamp",DORI_THREAD_ID:"dori_thread_id",DORI_SESSION_KEY:"dori_session_key",LOADED_FROM_STORAGE:"dori_loaded_from_storage"};function r(){try{const t="__test__";return sessionStorage.setItem(t,t),sessionStorage.removeItem(t),!0}catch{return!1}}function n(){r()&&sessionStorage.setItem(e.LOADED_FROM_STORAGE,"true")}function o(){r()&&sessionStorage.removeItem(e.LOADED_FROM_STORAGE)}function s(){return!!r()&&"true"===sessionStorage.getItem(e.LOADED_FROM_STORAGE)}function i(){try{const t=sessionStorage.getItem(e.SESSION_TIMESTAMP);if(!t)return!1;const r=parseInt(t,10);return Date.now()-r<864e5}catch{return!1}}function a(){if(r())try{Object.values(e).forEach(t=>{sessionStorage.removeItem(t)})}catch(t){}}function c(t){if(r())try{t?sessionStorage.setItem(e.BOT_DATA,JSON.stringify(t)):sessionStorage.removeItem(e.BOT_DATA)}catch(n){}}function u(){if(!r()||!i())return null;try{const t=sessionStorage.getItem(e.BOT_DATA);return t?JSON.parse(t):null}catch(t){return null}}function l(t){if(r())try{sessionStorage.setItem(e.CHAT_STATE,JSON.stringify(t))}catch(n){}}function d(t){if(r())try{const r=t.map(t=>({...t,timestamp:t.timestamp instanceof Date?t.timestamp.toISOString():t.timestamp}));sessionStorage.setItem(e.MESSAGES,JSON.stringify(r))}catch(n){}}function m(){if(!r()||!i())return[];try{const t=sessionStorage.getItem(e.MESSAGES);return t?JSON.parse(t).map(t=>({...t,timestamp:new Date(t.timestamp)})):[]}catch(t){return[]}}function f(t){if(r())try{sessionStorage.setItem(e.CURRENT_STEP,t)}catch(n){}}function S(){if(!r()||!i())return null;try{const t=u(),n=function(){if(!r()||!i())return null;try{const t=sessionStorage.getItem(e.CHAT_STATE);return t?JSON.parse(t):null}catch(t){return null}}(),o=m(),s=function(){if(!r()||!i())return"welcome";try{return sessionStorage.getItem(e.CURRENT_STEP)||"welcome"}catch(t){return"welcome"}}();return t||o.length>0?{botData:t,chatState:n||{repliedProduct:null,threadId:null,isRequestInProgress:!1},messages:o,currentStep:s,sessionTimestamp:Date.now()}:null}catch(t){return null}}function _(){if(!r()||!i())return!1;try{const t=u(),e=m();return!!(t||e.length>0)}catch{return!1}}function g(){if(r())try{sessionStorage.setItem(e.SESSION_TIMESTAMP,Date.now().toString())}catch(t){}}function h(){if(r())try{sessionStorage.setItem(e.FAB_ANIMATION_TIMESTAMP,Date.now().toString())}catch(t){}}function I(){const t=function(){if(!r()||!i())return null;try{const t=sessionStorage.getItem(e.FAB_ANIMATION_TIMESTAMP);return t?parseInt(t,10):null}catch(t){return null}}();return!t||Date.now()-t>=18e4}function E(){if(!r())return"";try{let t=sessionStorage.getItem(e.DORI_SESSION_KEY);return t||(t="dori_session_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),sessionStorage.setItem(e.DORI_SESSION_KEY,t)),t}catch(t){return""}}function T(t){if(r()&&t)try{sessionStorage.setItem(e.DORI_THREAD_ID,t)}catch(n){}}function w(){if(!r())return null;try{return sessionStorage.getItem(e.DORI_THREAD_ID)}catch(t){return null}}function A(t){const e=window?.chatbotData;if("undefined"!=typeof window&&e?.ajaxurl){const r=E();fetch(e.ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"dori_store_thread_session",thread_id:t,session_key:r,nonce:e.nonce})}).catch(t=>{})}}!async function(){try{const t=document.querySelector("script#dori-side-widget"),e=t?.getAttribute("data-sharing-id");if(!e)return;if(_()){const t=u();if(t)return void(window.moriBotDataPromise=Promise.resolve(t))}window.moriBotDataPromise=(async()=>{const t=`https://standardapi.dori.tech/bot-sharing-data/${e}`,r=await fetch(t);if(200!==r.status)throw new Error(`Failed to fetch bot data: ${r.status}`);const n=await r.json();if(n.error)throw new Error(n.error);if(!n.data)throw new Error("No data received from bot sharing API");return n.data})()}catch(t){window.moriBotDataPromise=Promise.reject(t instanceof Error?t.message:String(t))}}(),async function(){try{const{initializeDoriWidget:e}=await function(e,r,n){let o=Promise.resolve();if(r&&r.length>0){let e=function(t){return Promise.all(t.map(t=>Promise.resolve(t).then(t=>({status:"fulfilled",value:t}),t=>({status:"rejected",reason:t}))))};const s=document.getElementsByTagName("link"),i=document.querySelector("meta[property=csp-nonce]"),a=i?.nonce||i?.getAttribute("nonce");o=e(r.map(e=>{if(e=function(t,e){return new URL(t,e).href}(e,n),e in t)return;t[e]=!0;const r=e.endsWith(".css"),o=r?'[rel="stylesheet"]':"";if(n)for(let t=s.length-1;t>=0;t--){const n=s[t];if(n.href===e&&(!r||"stylesheet"===n.rel))return}else if(document.querySelector(`link[href="${e}"]${o}`))return;const i=document.createElement("link");return i.rel=r?"stylesheet":"modulepreload",r||(i.as="script"),i.crossOrigin="",i.href=e,a&&i.setAttribute("nonce",a),document.head.appendChild(i),r?new Promise((t,r)=>{i.addEventListener("load",t),i.addEventListener("error",()=>r(new Error(`Unable to preload CSS for ${e}`)))}):void 0}))}function s(t){const e=new Event("vite:preloadError",{cancelable:!0});if(e.payload=t,window.dispatchEvent(e),!e.defaultPrevented)throw t}return o.then(t=>{for(const e of t||[])"rejected"===e.status&&s(e.reason);return e().catch(s)})}(async()=>{const{initializeDoriWidget:t}=await import("./assets/main-DEaI-OHY.js");return{initializeDoriWidget:t}},[],import.meta.url);e()}catch(e){}}();export{l as a,d as b,f as c,S as d,a as e,o as f,w as g,_ as h,T as i,A as j,s as k,m as l,n as m,E as n,I as o,h as p,c as s,g as u};
|
package/dist/widget.js.br
CHANGED
|
Binary file
|
package/dist/widget.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|