@_solaris/messenger-widget 0.5.21 → 0.5.23

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
@@ -50,7 +50,14 @@ function We(e) {
50
50
  function s() {
51
51
  return {
52
52
  "Content-Type": "application/json",
53
- "X-Widget-Id": t.widgetId
53
+ "X-Widget-Id": t.widgetId,
54
+ // Origine top-level du site marchand. Same-origin GET du browser
55
+ // n'envoie pas le header `Origin` natif, donc on le passe en custom
56
+ // pour que le serveur logge l'origine RÉELLE de chaque appel HTTP
57
+ // (pas celle figée de la session). state.origin est posée par
58
+ // Vue depuis event.origin du postMessage INIT du snippet —
59
+ // non-spoofable côté browser. (uniquement utilisé pour du logging)
60
+ ...t.origin ? { "X-Parent-Origin": t.origin } : {}
54
61
  };
55
62
  }
56
63
  async function a(d, f, _) {
@@ -6184,7 +6191,7 @@ function ja(e, t, n, i, r, s) {
6184
6191
  ], 6)) : b("", !0)
6185
6192
  ], 2);
6186
6193
  }
6187
- const Ha = /* @__PURE__ */ B(Ma, [["render", ja], ["__scopeId", "data-v-608c117b"]]), qa = "0.5.21";
6194
+ const Ha = /* @__PURE__ */ B(Ma, [["render", ja], ["__scopeId", "data-v-608c117b"]]), qa = "0.5.23";
6188
6195
  export {
6189
6196
  le as AIAvatar,
6190
6197
  ge as AVATAR_COLORS,
package/dist/snippet.js CHANGED
@@ -1 +1 @@
1
- var Messenger=function(l){"use strict";let n=null,d=null,r=null,c="",u=null;function y(e){n&&w();const i=e.widgetId||"",a=e.baseUrl||"";c=e.widgetOrigin||a;const o=e.token||"",h=e.context&&typeof e.context=="object"?e.context:null,s=e.displayMode||"floating",g=e.language||"",p=e.allowUnauthenticated===!0;if(!i||!c){console.warn("[messenger] init skipped — missing widgetId or widgetOrigin");return}const x=new URL(`${T(c)}/widget/${encodeURIComponent(i)}`);s!=="floating"&&x.searchParams.set("display_mode",s),g&&x.searchParams.set("language",g),n=document.createElement("iframe"),n.src=x.toString(),n.title="Messenger",n.setAttribute("aria-label","Messenger"),n.setAttribute("allow","clipboard-write; microphone"),n.setAttribute("data-messenger-widget",""),v(n,s,"closed"),document.body.appendChild(n),d=document.createElement("div"),d.setAttribute("data-messenger-shadow",""),m(d,{hidden:!0}),document.body.appendChild(d),r=document.createElement("div"),r.setAttribute("data-messenger-peek-shadow",""),f(r,{hidden:!0}),document.body.appendChild(r);let b=!1;const E=()=>{b||!n||(b=!0,n.contentWindow.postMessage({type:"INIT",origin:window.location.origin,token:o||null,context:h||null,allowUnauthenticated:p},c))};u=M=>{if(M.origin!==c)return;const t=M.data;!t||typeof t!="object"||(t.type==="READY"?E():t.type==="RESIZE"&&n&&(v(n,t.displayMode||s,t.state,{width:t.width,height:t.height}),d&&(t.state==="closed"&&t.launcherWidth&&t.launcherHeight?m(d,{width:t.launcherWidth,height:t.launcherHeight,hovered:!!t.launcherHovered}):m(d,{hidden:!0})),r&&(t.state==="closed"&&t.peek?f(r,{...t.peek,hovered:!!t.peekHovered}):f(r,{hidden:!0}))))},window.addEventListener("message",u),n.addEventListener("load",E),setTimeout(()=>{b||console.warn("[messenger] iframe did not boot after",1e4,"ms — check CSP frame-ancestors and network")},1e4)}function w(){u&&(window.removeEventListener("message",u),u=null),n&&(n.remove(),n=null),d&&(d.remove(),d=null),r&&(r.remove(),r=null),c=""}function m(e,i){if(i.hidden){e.style.cssText="display:none";return}const a=i.width||64,o=i.height||64,h=i.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:8px","right:8px",`width:${a}px`,`height:${o}px`,"border-radius:50%","background:transparent",`box-shadow:${h}`,"transition:box-shadow 100ms ease, width 100ms ease, height 100ms ease","z-index:2147483646"].join(";")}function f(e,i){if(i.hidden){e.style.cssText="display:none";return}const a=i.width||286,o=i.height||80,h=8+(i.rightOffset||0),s=8+(i.bottomOffset||0),g=i.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:${a}px`,`height:${o}px`,"border-radius:16px 16px 8px 16px","background:transparent",`box-shadow:${g}`,"transition:box-shadow 100ms ease, width 100ms ease, height 100ms ease, right 100ms ease, bottom 100ms ease","z-index:2147483646"].join(";")}function T(e){return e.endsWith("/")?e.slice(0,-1):e}function v(e,i,a,o){const h=["position:fixed","border:0","z-index:2147483647","color-scheme:normal","background:transparent"];let s;if(i==="embedded")s=["inset:0","width:100%","height:100%"];else if(a==="closed"){const g=o&&o.width>0?o.width:80,p=o&&o.height>0?o.height:80;s=["bottom:0","right:0",`width:${g}px`,`height:${p}px`]}else i==="sheet"?s=["top:0","bottom:0","right:0","width:min(470px, 100vw)","height:100vh"]:s=["bottom:0","right:0","width:460px","height:720px","max-width:100vw","max-height:100vh"];e.style.cssText=h.concat(s).join(";")}const S="0.5.21",k={init:y,destroy:w,version:S};return l.default=k,l.destroy=w,l.init=y,l.version=S,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),l}({});
1
+ var Messenger=function(l){"use strict";let n=null,d=null,r=null,c="",u=null;function y(e){n&&w();const i=e.widgetId||"",a=e.baseUrl||"";c=e.widgetOrigin||a;const o=e.token||"",h=e.context&&typeof e.context=="object"?e.context:null,s=e.displayMode||"floating",g=e.language||"",p=e.allowUnauthenticated===!0;if(!i||!c){console.warn("[messenger] init skipped — missing widgetId or widgetOrigin");return}const x=new URL(`${T(c)}/widget/${encodeURIComponent(i)}`);s!=="floating"&&x.searchParams.set("display_mode",s),g&&x.searchParams.set("language",g),n=document.createElement("iframe"),n.src=x.toString(),n.title="Messenger",n.setAttribute("aria-label","Messenger"),n.setAttribute("allow","clipboard-write; microphone; notifications"),n.setAttribute("data-messenger-widget",""),v(n,s,"closed"),document.body.appendChild(n),d=document.createElement("div"),d.setAttribute("data-messenger-shadow",""),m(d,{hidden:!0}),document.body.appendChild(d),r=document.createElement("div"),r.setAttribute("data-messenger-peek-shadow",""),f(r,{hidden:!0}),document.body.appendChild(r);let b=!1;const E=()=>{b||!n||(b=!0,n.contentWindow.postMessage({type:"INIT",origin:window.location.origin,token:o||null,context:h||null,allowUnauthenticated:p},c))};u=M=>{if(M.origin!==c)return;const t=M.data;!t||typeof t!="object"||(t.type==="READY"?E():t.type==="RESIZE"&&n&&(v(n,t.displayMode||s,t.state,{width:t.width,height:t.height}),d&&(t.state==="closed"&&t.launcherWidth&&t.launcherHeight?m(d,{width:t.launcherWidth,height:t.launcherHeight,hovered:!!t.launcherHovered}):m(d,{hidden:!0})),r&&(t.state==="closed"&&t.peek?f(r,{...t.peek,hovered:!!t.peekHovered}):f(r,{hidden:!0}))))},window.addEventListener("message",u),n.addEventListener("load",E),setTimeout(()=>{b||console.warn("[messenger] iframe did not boot after",1e4,"ms — check CSP frame-ancestors and network")},1e4)}function w(){u&&(window.removeEventListener("message",u),u=null),n&&(n.remove(),n=null),d&&(d.remove(),d=null),r&&(r.remove(),r=null),c=""}function m(e,i){if(i.hidden){e.style.cssText="display:none";return}const a=i.width||64,o=i.height||64,h=i.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:8px","right:8px",`width:${a}px`,`height:${o}px`,"border-radius:50%","background:transparent",`box-shadow:${h}`,"transition:box-shadow 100ms ease, width 100ms ease, height 100ms ease","z-index:2147483646"].join(";")}function f(e,i){if(i.hidden){e.style.cssText="display:none";return}const a=i.width||286,o=i.height||80,h=8+(i.rightOffset||0),s=8+(i.bottomOffset||0),g=i.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:${a}px`,`height:${o}px`,"border-radius:16px 16px 8px 16px","background:transparent",`box-shadow:${g}`,"transition:box-shadow 100ms ease, width 100ms ease, height 100ms ease, right 100ms ease, bottom 100ms ease","z-index:2147483646"].join(";")}function T(e){return e.endsWith("/")?e.slice(0,-1):e}function v(e,i,a,o){const h=["position:fixed","border:0","z-index:2147483647","color-scheme:normal","background:transparent"];let s;if(i==="embedded")s=["inset:0","width:100%","height:100%"];else if(a==="closed"){const g=o&&o.width>0?o.width:80,p=o&&o.height>0?o.height:80;s=["bottom:0","right:0",`width:${g}px`,`height:${p}px`]}else i==="sheet"?s=["top:0","bottom:0","right:0","width:min(470px, 100vw)","height:100vh"]:s=["bottom:0","right:0","width:460px","height:720px","max-width:100vw","max-height:100vh"];e.style.cssText=h.concat(s).join(";")}const S="0.5.23",k={init:y,destroy:w,version:S};return l.default=k,l.destroy=w,l.init=y,l.version=S,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),l}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_solaris/messenger-widget",
3
- "version": "0.5.21",
3
+ "version": "0.5.23",
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",