@_solaris/messenger-widget 0.6.7 → 0.6.8
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/iframe/iframe.js +1 -1
- package/dist/messenger.cjs +1 -1
- package/dist/messenger.js +1 -1
- package/dist/snippet.js +1 -1
- package/package.json +1 -1
package/dist/messenger.js
CHANGED
|
@@ -7047,7 +7047,7 @@ function go(e, t, s, r, i, n) {
|
|
|
7047
7047
|
], 6)) : b("", !0)
|
|
7048
7048
|
], 6);
|
|
7049
7049
|
}
|
|
7050
|
-
const po = /* @__PURE__ */ U($a, [["render", go], ["__scopeId", "data-v-11fad0d2"]]), wo = "0.6.
|
|
7050
|
+
const po = /* @__PURE__ */ U($a, [["render", go], ["__scopeId", "data-v-11fad0d2"]]), wo = "0.6.8";
|
|
7051
7051
|
export {
|
|
7052
7052
|
he as AIAvatar,
|
|
7053
7053
|
be as AVATAR_COLORS,
|
package/dist/snippet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Messenger=function(u){"use strict";let t=null,a=null,d=null,l="",p=null,w=null,g=null;function M(e){t&&b();const n=e.widgetId||"",c=e.baseUrl||"";l=e.widgetOrigin||c;const r=e.token||"";let h=null;e.variables&&typeof e.variables=="object"?h=e.variables:e.context&&typeof e.context=="object"&&(h=e.context);const s=e.displayMode||"floating",o=e.language||"",f=e.allowUnauthenticated===!0;if(!n||!l){console.warn("[messenger] init skipped — missing widgetId or widgetOrigin");return}!f&&!r&&console.warn("[messenger] init: allowUnauthenticated=false but no token provided. In app mode you must pass a `token` (JWT linked) at every init() call. See messenger-back /auth/jwt to generate one server-side. Without a token, /session will return 403.");const m=new URL(`${U(l)}/widget/${encodeURIComponent(n)}`);s!=="floating"&&m.searchParams.set("display_mode",s),o&&m.searchParams.set("language",o),t=document.createElement("iframe"),t.src=m.toString(),t.title="Messenger",t.setAttribute("aria-label","Messenger"),t.setAttribute("allow","clipboard-write; microphone; notifications; display-capture"),t.setAttribute("data-messenger-widget",""),y(t,s,"closed"),document.body.appendChild(t),window.visualViewport&&(g=()=>{t&&w&&w.state!=="closed"&&y(t,w.displayMode,w.state,w.dims)},window.visualViewport.addEventListener("resize",g),window.visualViewport.addEventListener("scroll",g)),a=document.createElement("div"),a.setAttribute("data-messenger-shadow",""),v(a,{hidden:!0}),document.body.appendChild(a),d=document.createElement("div"),d.setAttribute("data-messenger-peek-shadow",""),x(d,{hidden:!0}),document.body.appendChild(d);let E=!1;const O=()=>{E||!t||(E=!0,t.contentWindow.postMessage({type:"INIT",origin:window.location.origin,token:r||null,variables:h||null,allowUnauthenticated:f},l))};p=I=>{if(I.origin!==l)return;const i=I.data;!i||typeof i!="object"||(i.type==="READY"?O():i.type==="RESIZE"&&t&&(y(t,i.displayMode||s,i.state,{width:i.width,height:i.height}),a&&(i.state==="closed"&&i.launcherWidth&&i.launcherHeight?v(a,{width:i.launcherWidth,height:i.launcherHeight,hovered:!!i.launcherHovered}):v(a,{hidden:!0})),d&&(i.state==="closed"&&i.peek?x(d,{...i.peek,hovered:!!i.peekHovered}):x(d,{hidden:!0}))))},window.addEventListener("message",p),t.addEventListener("load",O),setTimeout(()=>{E||console.warn("[messenger] iframe did not boot after",1e4,"ms — check CSP frame-ancestors and network")},1e4)}function b(){p&&(window.removeEventListener("message",p),p=null),g&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",g),window.visualViewport.removeEventListener("scroll",g),g=null),w=null,t&&(t.remove(),t=null),a&&(a.remove(),a=null),d&&(d.remove(),d=null),l=""}function S(e){!t||!l||!e||typeof e!="object"||t.contentWindow.postMessage({type:"UPDATE",payload:e},l)}function k(e){!t||!l||!e||typeof e!="object"||t.contentWindow.postMessage({type:"CONTEXT",payload:e},l)}function v(e,n){if(n.hidden){e.style.cssText="display:none";return}const c=n.width||50,r=n.height||50,h=Math.max(20,c-6),s=Math.max(20,r-6),o=8+(c-h)/2,f=8+(r-s)/2,m=n.hovered?"0 8px 22px rgba(0, 0, 0, 0.26)":"0 4px 14px rgba(0, 0, 0, 0.18)";e.style.cssText=["position:fixed","pointer-events:none",`bottom:${f}px`,`right:${o}px`,`width:${h}px`,`height:${s}px`,"border-radius:50%","background:transparent",`box-shadow:${m}`,"transition:box-shadow 100ms ease","z-index:2147483646"].join(";")}function x(e,n){if(n.hidden){e.style.cssText="display:none";return}const c=n.width||286,r=n.height||80,h=8+(n.rightOffset||0),s=8+(n.bottomOffset||0),o=n.hovered?"0 6px 18px rgba(0, 0, 0, 0.16)":"0 3px 10px rgba(0, 0, 0, 0.10)";e.style.cssText=["position:fixed","pointer-events:none",`bottom:${s}px`,`right:${h}px`,`width:${c}px`,`height:${r}px`,"border-radius:16px 16px 8px 16px","background:transparent",`box-shadow:${o}`,"transition:box-shadow 100ms ease, width 100ms ease, height 100ms ease, right 100ms ease, bottom 100ms ease","z-index:2147483646"].join(";")}function U(e){return e.endsWith("/")?e.slice(0,-1):e}function y(e,n,c,r){w={displayMode:n,state:c,dims:r};const h=["position:fixed","border:0","z-index:2147483647","color-scheme:normal","background:transparent"];let s;if(n==="embedded")s=["inset:0","width:100%","height:100%"];else if(c==="closed"){const o=r&&r.width>0?r.width:80,f=r&&r.height>0?r.height:80;s=["bottom:0","right:0",`width:${o}px`,`height:${f}px`]}else if(n==="sheet"){const o=T();o?s=[`top:${o.top}px`,"right:0","width:min(470px, 100vw)",`height:${o.height}px`]:s=["top:0","bottom:0","right:0","width:min(470px, 100vw)","height:100dvh"]}else{const o=T();s=[`bottom:${o?o.bottom:0}px`,"right:0","width:460px","height:720px","max-width:100vw",`max-height:${o?`${o.height}px`:"100vh"}`]}e.style.cssText=h.concat(s).join(";")}function T(){const e=window.visualViewport;if(!e)return null;const n=Math.max(0,Math.round(window.innerHeight-e.height-e.offsetTop));return n<80?null:{top:Math.round(e.offsetTop),height:Math.round(e.height),bottom:n}}const $="0.6.
|
|
1
|
+
var Messenger=function(u){"use strict";let t=null,a=null,d=null,l="",p=null,w=null,g=null;function M(e){t&&b();const n=e.widgetId||"",c=e.baseUrl||"";l=e.widgetOrigin||c;const r=e.token||"";let h=null;e.variables&&typeof e.variables=="object"?h=e.variables:e.context&&typeof e.context=="object"&&(h=e.context);const s=e.displayMode||"floating",o=e.language||"",f=e.allowUnauthenticated===!0;if(!n||!l){console.warn("[messenger] init skipped — missing widgetId or widgetOrigin");return}!f&&!r&&console.warn("[messenger] init: allowUnauthenticated=false but no token provided. In app mode you must pass a `token` (JWT linked) at every init() call. See messenger-back /auth/jwt to generate one server-side. Without a token, /session will return 403.");const m=new URL(`${U(l)}/widget/${encodeURIComponent(n)}`);s!=="floating"&&m.searchParams.set("display_mode",s),o&&m.searchParams.set("language",o),t=document.createElement("iframe"),t.src=m.toString(),t.title="Messenger",t.setAttribute("aria-label","Messenger"),t.setAttribute("allow","clipboard-write; microphone; notifications; display-capture"),t.setAttribute("data-messenger-widget",""),y(t,s,"closed"),document.body.appendChild(t),window.visualViewport&&(g=()=>{t&&w&&w.state!=="closed"&&y(t,w.displayMode,w.state,w.dims)},window.visualViewport.addEventListener("resize",g),window.visualViewport.addEventListener("scroll",g)),a=document.createElement("div"),a.setAttribute("data-messenger-shadow",""),v(a,{hidden:!0}),document.body.appendChild(a),d=document.createElement("div"),d.setAttribute("data-messenger-peek-shadow",""),x(d,{hidden:!0}),document.body.appendChild(d);let E=!1;const O=()=>{E||!t||(E=!0,t.contentWindow.postMessage({type:"INIT",origin:window.location.origin,token:r||null,variables:h||null,allowUnauthenticated:f},l))};p=I=>{if(I.origin!==l)return;const i=I.data;!i||typeof i!="object"||(i.type==="READY"?O():i.type==="RESIZE"&&t&&(y(t,i.displayMode||s,i.state,{width:i.width,height:i.height}),a&&(i.state==="closed"&&i.launcherWidth&&i.launcherHeight?v(a,{width:i.launcherWidth,height:i.launcherHeight,hovered:!!i.launcherHovered}):v(a,{hidden:!0})),d&&(i.state==="closed"&&i.peek?x(d,{...i.peek,hovered:!!i.peekHovered}):x(d,{hidden:!0}))))},window.addEventListener("message",p),t.addEventListener("load",O),setTimeout(()=>{E||console.warn("[messenger] iframe did not boot after",1e4,"ms — check CSP frame-ancestors and network")},1e4)}function b(){p&&(window.removeEventListener("message",p),p=null),g&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",g),window.visualViewport.removeEventListener("scroll",g),g=null),w=null,t&&(t.remove(),t=null),a&&(a.remove(),a=null),d&&(d.remove(),d=null),l=""}function S(e){!t||!l||!e||typeof e!="object"||t.contentWindow.postMessage({type:"UPDATE",payload:e},l)}function k(e){!t||!l||!e||typeof e!="object"||t.contentWindow.postMessage({type:"CONTEXT",payload:e},l)}function v(e,n){if(n.hidden){e.style.cssText="display:none";return}const c=n.width||50,r=n.height||50,h=Math.max(20,c-6),s=Math.max(20,r-6),o=8+(c-h)/2,f=8+(r-s)/2,m=n.hovered?"0 8px 22px rgba(0, 0, 0, 0.26)":"0 4px 14px rgba(0, 0, 0, 0.18)";e.style.cssText=["position:fixed","pointer-events:none",`bottom:${f}px`,`right:${o}px`,`width:${h}px`,`height:${s}px`,"border-radius:50%","background:transparent",`box-shadow:${m}`,"transition:box-shadow 100ms ease","z-index:2147483646"].join(";")}function x(e,n){if(n.hidden){e.style.cssText="display:none";return}const c=n.width||286,r=n.height||80,h=8+(n.rightOffset||0),s=8+(n.bottomOffset||0),o=n.hovered?"0 6px 18px rgba(0, 0, 0, 0.16)":"0 3px 10px rgba(0, 0, 0, 0.10)";e.style.cssText=["position:fixed","pointer-events:none",`bottom:${s}px`,`right:${h}px`,`width:${c}px`,`height:${r}px`,"border-radius:16px 16px 8px 16px","background:transparent",`box-shadow:${o}`,"transition:box-shadow 100ms ease, width 100ms ease, height 100ms ease, right 100ms ease, bottom 100ms ease","z-index:2147483646"].join(";")}function U(e){return e.endsWith("/")?e.slice(0,-1):e}function y(e,n,c,r){w={displayMode:n,state:c,dims:r};const h=["position:fixed","border:0","z-index:2147483647","color-scheme:normal","background:transparent"];let s;if(n==="embedded")s=["inset:0","width:100%","height:100%"];else if(c==="closed"){const o=r&&r.width>0?r.width:80,f=r&&r.height>0?r.height:80;s=["bottom:0","right:0",`width:${o}px`,`height:${f}px`]}else if(n==="sheet"){const o=T();o?s=[`top:${o.top}px`,"right:0","width:min(470px, 100vw)",`height:${o.height}px`]:s=["top:0","bottom:0","right:0","width:min(470px, 100vw)","height:100dvh"]}else{const o=T();s=[`bottom:${o?o.bottom:0}px`,"right:0","width:460px","height:720px","max-width:100vw",`max-height:${o?`${o.height}px`:"100vh"}`]}e.style.cssText=h.concat(s).join(";")}function T(){const e=window.visualViewport;if(!e)return null;const n=Math.max(0,Math.round(window.innerHeight-e.height-e.offsetTop));return n<80?null:{top:Math.round(e.offsetTop),height:Math.round(e.height),bottom:n}}const $="0.6.8",j={init:M,destroy:b,update:S,context:k,version:$};return u.context=k,u.default=j,u.destroy=b,u.init=M,u.update=S,u.version=$,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),u}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@_solaris/messenger-widget",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "Embeddable chat messenger widget — Vue 3 library + iframe-hosted UI + snippet drop-in. Wired to messenger-server (cookie-based session).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|