@_solaris/messenger-widget 0.6.29 → 0.6.30

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/messenger.js CHANGED
@@ -7213,7 +7213,7 @@ function yo(e, t, s, r, i, n) {
7213
7213
  ], 6)) : b("", !0)
7214
7214
  ], 6);
7215
7215
  }
7216
- const wo = /* @__PURE__ */ F(Ga, [["render", yo], ["__scopeId", "data-v-801581ca"]]), bo = "0.6.29";
7216
+ const wo = /* @__PURE__ */ F(Ga, [["render", yo], ["__scopeId", "data-v-801581ca"]]), bo = "0.6.30";
7217
7217
  export {
7218
7218
  me as AIAvatar,
7219
7219
  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 S(e){t&&b();const n=e.widgetId||"",h=e.baseUrl||"";l=e.widgetOrigin||h;const r=e.token||"";let c=null;e.variables&&typeof e.variables=="object"?c=e.variables:e.context&&typeof e.context=="object"&&(c=e.context);const o=e.displayMode||"floating",i=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)}`);o!=="floating"&&m.searchParams.set("display_mode",o),i&&m.searchParams.set("language",i),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,o,"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:c||null,allowUnauthenticated:f},l))};p=I=>{if(I.origin!==l)return;const s=I.data;!s||typeof s!="object"||(s.type==="READY"?O():s.type==="RESIZE"&&t&&(y(t,s.displayMode||o,s.state,{width:s.width,height:s.height}),a&&(s.state==="closed"&&s.launcherWidth&&s.launcherHeight?v(a,{width:s.launcherWidth,height:s.launcherHeight,hovered:!!s.launcherHovered}):v(a,{hidden:!0})),d&&(s.state==="closed"&&s.peek?x(d,{...s.peek,hovered:!!s.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 k(e){!t||!l||!e||typeof e!="object"||t.contentWindow.postMessage({type:"UPDATE",payload:e},l)}function T(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 h=n.width||50,r=n.height||50,c=Math.max(20,h-6),o=Math.max(20,r-6),i=8+(h-c)/2,f=8+(r-o)/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:${i}px`,`width:${c}px`,`height:${o}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 h=n.width||286,r=n.height||80,c=8+(n.rightOffset||0),o=8+(n.bottomOffset||0),i=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:${o}px`,`right:${c}px`,`width:${h}px`,`height:${r}px`,"border-radius:16px 16px 8px 16px","background:transparent",`box-shadow:${i}`,"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,h,r){w={displayMode:n,state:h,dims:r};const c=["position:fixed","border:0","z-index:2147483647","color-scheme:normal","background:transparent"];let o;if(n==="embedded")o=["inset:0","width:100%","height:100%"];else if(h!=="closed"&&j()){const i=M();i?o=[`top:${i.top}px`,"left:0","right:0","width:100vw",`height:${i.height}px`]:o=["inset:0","width:100vw","height:100dvh"]}else if(h==="closed"){const i=r&&r.width>0?r.width:80,f=r&&r.height>0?r.height:80;o=["bottom:0","right:0",`width:${i}px`,`height:${f}px`]}else if(n==="sheet"){const i=M();i?o=[`top:${i.top}px`,"right:0","width:min(470px, 100vw)",`height:${i.height}px`]:o=["top:0","bottom:0","right:0","width:min(470px, 100vw)","height:100dvh"]}else{const i=M();o=[`bottom:${i?i.bottom:0}px`,"right:0","width:460px","height:720px","max-width:100vw",`max-height:${i?`${i.height}px`:"100vh"}`]}e.style.cssText=c.concat(o).join(";")}function j(){return typeof window.matchMedia=="function"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches}function M(){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.29",A={init:S,destroy:b,update:k,context:T,version:$};return u.context=T,u.default=A,u.destroy=b,u.init=S,u.update=k,u.version=$,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),u}({});
1
+ var Messenger=function(u){"use strict";let t=null,a=null,d=null,l="",p=null,w=null,g=null;function S(e){t&&b();const n=e.widgetId||"",h=e.baseUrl||"";l=e.widgetOrigin||h;const r=e.token||"";let c=null;e.variables&&typeof e.variables=="object"?c=e.variables:e.context&&typeof e.context=="object"&&(c=e.context);const o=e.displayMode||"floating",i=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)}`);o!=="floating"&&m.searchParams.set("display_mode",o),i&&m.searchParams.set("language",i),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,o,"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:c||null,allowUnauthenticated:f},l))};p=I=>{if(I.origin!==l)return;const s=I.data;!s||typeof s!="object"||(s.type==="READY"?O():s.type==="RESIZE"&&t&&(y(t,s.displayMode||o,s.state,{width:s.width,height:s.height}),a&&(s.state==="closed"&&s.launcherWidth&&s.launcherHeight?v(a,{width:s.launcherWidth,height:s.launcherHeight,hovered:!!s.launcherHovered}):v(a,{hidden:!0})),d&&(s.state==="closed"&&s.peek?x(d,{...s.peek,hovered:!!s.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 k(e){!t||!l||!e||typeof e!="object"||t.contentWindow.postMessage({type:"UPDATE",payload:e},l)}function T(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 h=n.width||50,r=n.height||50,c=Math.max(20,h-6),o=Math.max(20,r-6),i=8+(h-c)/2,f=8+(r-o)/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:${i}px`,`width:${c}px`,`height:${o}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 h=n.width||286,r=n.height||80,c=8+(n.rightOffset||0),o=8+(n.bottomOffset||0),i=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:${o}px`,`right:${c}px`,`width:${h}px`,`height:${r}px`,"border-radius:16px 16px 8px 16px","background:transparent",`box-shadow:${i}`,"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,h,r){w={displayMode:n,state:h,dims:r};const c=["position:fixed","border:0","z-index:2147483647","color-scheme:normal","background:transparent"];let o;if(n==="embedded")o=["inset:0","width:100%","height:100%"];else if(h!=="closed"&&j()){const i=M();i?o=[`top:${i.top}px`,"left:0","right:0","width:100vw",`height:${i.height}px`]:o=["inset:0","width:100vw","height:100dvh"]}else if(h==="closed"){const i=r&&r.width>0?r.width:80,f=r&&r.height>0?r.height:80;o=["bottom:0","right:0",`width:${i}px`,`height:${f}px`]}else if(n==="sheet"){const i=M();i?o=[`top:${i.top}px`,"right:0","width:min(470px, 100vw)",`height:${i.height}px`]:o=["top:0","bottom:0","right:0","width:min(470px, 100vw)","height:100dvh"]}else{const i=M();o=[`bottom:${i?i.bottom:0}px`,"right:0","width:460px","height:720px","max-width:100vw",`max-height:${i?`${i.height}px`:"100vh"}`]}e.style.cssText=c.concat(o).join(";")}function j(){return typeof window.matchMedia=="function"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches}function M(){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.30",A={init:S,destroy:b,update:k,context:T,version:$};return u.context=T,u.default=A,u.destroy=b,u.init=S,u.update=k,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.29",
3
+ "version": "0.6.30",
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",