@xcall/sdk 1.0.3 → 1.0.4

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.
@@ -82,21 +82,17 @@ type XCallIncomingMessage = {
82
82
  declare class XCall {
83
83
  private iframe;
84
84
  private origin;
85
- private listeners;
85
+ private emitter;
86
86
  private messageHandler;
87
87
  constructor(options: XCallOptions);
88
- private _createIframe;
89
- private _applyStyles;
90
- private _handleMessage;
91
88
  on<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this;
92
89
  off<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this;
93
90
  muteAudio(muted: boolean): void;
94
91
  muteVideo(muted: boolean): void;
95
92
  leave(): void;
96
- /** Remove o iframe e os listeners. Chame quando destruir o componente. */
97
93
  destroy(): void;
94
+ private _handleMessage;
98
95
  private _send;
99
- private _emit;
100
96
  }
101
97
 
102
98
  export { XCall, type XCallCommand, type XCallEventCallback, type XCallEventMap, type XCallEventName, type XCallIncomingMessage, type XCallOptions };
@@ -82,21 +82,17 @@ type XCallIncomingMessage = {
82
82
  declare class XCall {
83
83
  private iframe;
84
84
  private origin;
85
- private listeners;
85
+ private emitter;
86
86
  private messageHandler;
87
87
  constructor(options: XCallOptions);
88
- private _createIframe;
89
- private _applyStyles;
90
- private _handleMessage;
91
88
  on<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this;
92
89
  off<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this;
93
90
  muteAudio(muted: boolean): void;
94
91
  muteVideo(muted: boolean): void;
95
92
  leave(): void;
96
- /** Remove o iframe e os listeners. Chame quando destruir o componente. */
97
93
  destroy(): void;
94
+ private _handleMessage;
98
95
  private _send;
99
- private _emit;
100
96
  }
101
97
 
102
98
  export { XCall, type XCallCommand, type XCallEventCallback, type XCallEventMap, type XCallEventName, type XCallIncomingMessage, type XCallOptions };
@@ -1,2 +1,2 @@
1
- var s="https://room.xcall.com.br",r=class{constructor(e){this.listeners={};var l;let t=typeof e.container=="string"?document.querySelector(e.container):e.container;if(!t)throw new Error("[xCall] container not found");let a=(l=e.roomUrl)!=null?l:s;this.origin=new URL(a).origin,this.iframe=this._createIframe(a,e),this._applyStyles(this.iframe,e.iframeStyle),t.appendChild(this.iframe),this.messageHandler=i=>{i.origin===this.origin&&this._handleMessage(i.data,e.token)},window.addEventListener("message",this.messageHandler)}_createIframe(e,t){let a=document.createElement("iframe");return a.src=e.replace(/\/$/,""),a.allow="camera; microphone; display-capture; autoplay; clipboard-write; fullscreen",a.style.border="none",a.style.width="100%",a.style.height="100%",a}_applyStyles(e,t){if(t)for(let[a,l]of Object.entries(t))e.style[a]=l}_handleMessage(e,t){switch(e.type){case"xcall:ready":this._send({type:"xcall:token",token:t}),this._emit("ready",void 0);break;case"xcall:joined":this._emit("joined",{roomId:e.roomId,userId:e.userId});break;case"xcall:left":this._emit("left",{roomId:e.roomId,reason:e.reason});break;case"xcall:participant_joined":this._emit("participant_joined",{userId:e.userId,displayName:e.displayName});break;case"xcall:participant_left":this._emit("participant_left",{userId:e.userId});break;case"xcall:error":this._emit("error",{code:e.code,message:e.message});break}}on(e,t){return this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t),this}off(e,t){var a;return(a=this.listeners[e])==null||a.delete(t),this}muteAudio(e){this._send({type:"xcall:mute_audio",muted:e})}muteVideo(e){this._send({type:"xcall:mute_video",muted:e})}leave(){this._send({type:"xcall:leave"})}destroy(){window.removeEventListener("message",this.messageHandler),this.iframe.remove()}_send(e){var t;(t=this.iframe.contentWindow)==null||t.postMessage(e,this.origin)}_emit(e,t){let a=this.listeners[e];a==null||a.forEach(l=>l(t))}};export{r as XCall};
1
+ var c="camera; microphone; display-capture; autoplay; clipboard-write; fullscreen";function o(l,e){let t=document.createElement("iframe");if(t.src=l.replace(/\/$/,""),t.allow=c,t.style.border="none",t.style.width="100%",t.style.height="100%",e)for(let[a,r]of Object.entries(e))t.style[a]=r;return t}function m(l){let e=typeof l=="string"?document.querySelector(l):l;if(!e)throw new Error("[xCall] container not found");return e}var i=class{constructor(){this.listeners={}}on(e,t){return this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t),this}off(e,t){var a;return(a=this.listeners[e])==null||a.delete(t),this}emit(e,t){let a=this.listeners[e];a==null||a.forEach(r=>r(t))}};var d="https://room.xcall.com.br",n=class{constructor(e){this.emitter=new i;var r;let t=m(e.container),a=(r=e.roomUrl)!=null?r:d;this.origin=new URL(a).origin,this.iframe=o(a,e.iframeStyle),t.appendChild(this.iframe),this.messageHandler=s=>{s.origin===this.origin&&this._handleMessage(s.data,e.token)},window.addEventListener("message",this.messageHandler)}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}muteAudio(e){this._send({type:"xcall:mute_audio",muted:e})}muteVideo(e){this._send({type:"xcall:mute_video",muted:e})}leave(){this._send({type:"xcall:leave"})}destroy(){window.removeEventListener("message",this.messageHandler),this.iframe.remove()}_handleMessage(e,t){switch(e.type){case"xcall:ready":this._send({type:"xcall:token",token:t}),this.emitter.emit("ready",void 0);break;case"xcall:joined":this.emitter.emit("joined",{roomId:e.roomId,userId:e.userId});break;case"xcall:left":this.emitter.emit("left",{roomId:e.roomId,reason:e.reason});break;case"xcall:participant_joined":this.emitter.emit("participant_joined",{userId:e.userId,displayName:e.displayName});break;case"xcall:participant_left":this.emitter.emit("participant_left",{userId:e.userId});break;case"xcall:error":this.emitter.emit("error",{code:e.code,message:e.message});break}}_send(e){var t;(t=this.iframe.contentWindow)==null||t.postMessage(e,this.origin)}};export{n as XCall};
2
2
  //# sourceMappingURL=xcall.min.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {\n XCallOptions,\n XCallEventName,\n XCallEventCallback,\n XCallEventMap,\n XCallCommand,\n XCallIncomingMessage,\n} from './types'\n\nexport * from './types'\n\nconst DEFAULT_ROOM_URL = 'https://room.xcall.com.br'\n\nexport class XCall {\n private iframe: HTMLIFrameElement\n private origin: string\n private listeners: Partial<{\n [K in XCallEventName]: Set<XCallEventCallback<K>>\n }> = {}\n private messageHandler: (e: MessageEvent) => void\n\n constructor(options: XCallOptions) {\n const container =\n typeof options.container === 'string'\n ? (document.querySelector(options.container) as HTMLElement | null)\n : options.container\n\n if (!container) throw new Error('[xCall] container not found')\n\n const base = options.roomUrl ?? DEFAULT_ROOM_URL\n // Remove trailing slash para evitar URL duplo\n this.origin = new URL(base).origin\n\n this.iframe = this._createIframe(base, options)\n this._applyStyles(this.iframe, options.iframeStyle)\n\n container.appendChild(this.iframe)\n\n // ── Listener global de mensagens ──────────────────────────────────────\n this.messageHandler = (e: MessageEvent) => {\n if (e.origin !== this.origin) return\n this._handleMessage(e.data as XCallIncomingMessage, options.token)\n }\n window.addEventListener('message', this.messageHandler)\n }\n\n // ── Criar iframe limpo (sem token na URL) ─────────────────────────────────\n private _createIframe(\n base: string,\n options: XCallOptions\n ): HTMLIFrameElement {\n const el = document.createElement('iframe')\n // Sem ?token= na URL o token é enviado via postMessage após xcall:ready\n el.src = base.replace(/\\/$/, '')\n el.allow =\n 'camera; microphone; display-capture; autoplay; clipboard-write; fullscreen'\n el.style.border = 'none'\n el.style.width = '100%'\n el.style.height = '100%'\n return el\n }\n\n private _applyStyles(\n iframe: HTMLIFrameElement,\n style?: Partial<CSSStyleDeclaration>\n ) {\n if (!style) return\n for (const [key, value] of Object.entries(style)) {\n ;(iframe.style as unknown as Record<string, string>)[key] = value as string\n }\n }\n\n // ── Roteador de mensagens recebidas ──────────────────────────────────────\n private _handleMessage(msg: XCallIncomingMessage, token: string) {\n switch (msg.type) {\n case 'xcall:ready':\n // Envia o token de forma segura via postMessage\n this._send({ type: 'xcall:token', token })\n this._emit('ready', undefined as void)\n break\n case 'xcall:joined':\n this._emit('joined', { roomId: msg.roomId, userId: msg.userId })\n break\n case 'xcall:left':\n this._emit('left', { roomId: msg.roomId, reason: msg.reason })\n break\n case 'xcall:participant_joined':\n this._emit('participant_joined', {\n userId: msg.userId,\n displayName: msg.displayName,\n })\n break\n case 'xcall:participant_left':\n this._emit('participant_left', { userId: msg.userId })\n break\n case 'xcall:error':\n this._emit('error', { code: msg.code, message: msg.message })\n break\n }\n }\n\n // ── API pública ──────────────────────────────────────────────────────────\n\n on<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this {\n if (!this.listeners[event]) {\n this.listeners[event] = new Set() as never\n }\n ;(this.listeners[event] as Set<XCallEventCallback<K>>).add(cb)\n return this\n }\n\n off<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this {\n ;(this.listeners[event] as Set<XCallEventCallback<K>> | undefined)?.delete(cb)\n return this\n }\n\n muteAudio(muted: boolean) {\n this._send({ type: 'xcall:mute_audio', muted })\n }\n\n muteVideo(muted: boolean) {\n this._send({ type: 'xcall:mute_video', muted })\n }\n\n leave() {\n this._send({ type: 'xcall:leave' })\n }\n\n /** Remove o iframe e os listeners. Chame quando destruir o componente. */\n destroy() {\n window.removeEventListener('message', this.messageHandler)\n this.iframe.remove()\n }\n\n // ── Helpers privados ─────────────────────────────────────────────────────\n\n private _send(cmd: XCallCommand) {\n this.iframe.contentWindow?.postMessage(cmd, this.origin)\n }\n\n private _emit<K extends XCallEventName>(event: K, data: XCallEventMap[K]) {\n const handlers = this.listeners[event] as\n | Set<XCallEventCallback<K>>\n | undefined\n handlers?.forEach((cb) => cb(data))\n }\n}\n"],"mappings":"AAWA,IAAMA,EAAmB,4BAEZC,EAAN,KAAY,CAQjB,YAAYC,EAAuB,CALnC,KAAQ,UAEH,CAAC,EAlBR,IAAAC,EAsBI,IAAMC,EACJ,OAAOF,EAAQ,WAAc,SACxB,SAAS,cAAcA,EAAQ,SAAS,EACzCA,EAAQ,UAEd,GAAI,CAACE,EAAW,MAAM,IAAI,MAAM,6BAA6B,EAE7D,IAAMC,GAAOF,EAAAD,EAAQ,UAAR,KAAAC,EAAmBH,EAEhC,KAAK,OAAS,IAAI,IAAIK,CAAI,EAAE,OAE5B,KAAK,OAA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,CAIA,GAA6BE,EAAUC,EAAiC,CACtE,OAAK,KAAK,UAAUD,CAAK,IACvB,KAAK,UAAUA,CAAK,EAAI,IAAI,KAE5B,KAAK,UAAUA,CAAK,EAAiC,IAAIC,CAAE,EACtD,IACT,CAEA,IAA8BD,EAAUC,EAAiC,CA/G3E,IAAAZ,EAgHK,OAACA,EAAA,KAAK,UAAUW,CAAK,IAApB,MAAAX,EAAkE,OAAOY,GACpE,IACT,CAEA,UAAUC,EAAgB,CACxB,KAAK,MAAM,CAAE,KAAM,mBAAoB,MAAAA,CAAM,CAAC,CAChD,CAEA,UAAUA,EAAgB,CACxB,KAAK,MAAM,CAAE,KAAM,mBAAoB,MAAAA,CAAM,CAAC,CAChD,CAEA,OAAQ,CACN,KAAK,MAAM,CAAE,KAAM,aAAc,CAAC,CACpC,CAGA,SAAU,CACR,OAAO,oBAAoB,UAAW,KAAK,cAAc,EACzD,KAAK,OAAO,OAAO,CACrB,CAIQ,MAAMC,EAAmB,CAxInC,IAAAd,GAyIIA,EAAA,KAAK,OAAO,gBAAZ,MAAAA,EAA2B,YAAYc,EAAK,KAAK,OACnD,CAEQ,MAAgCH,EAAUI,EAAwB,CACxE,IAAMC,EAAW,KAAK,UAAUL,CAAK,EAGrCK,GAAA,MAAAA,EAAU,QAASJ,GAAOA,EAAGG,CAAI,EACnC,CACF","names":["DEFAULT_ROOM_URL","XCall","options","_a","container","base","e","el","iframe","style","key","value","msg","token","event","cb","muted","cmd","data","handlers"]}
1
+ {"version":3,"sources":["../src/internal/iframe.ts","../src/internal/events.ts","../src/core/XCall.ts"],"sourcesContent":["import type { XCallOptions } from '../types'\n\nconst PERMISSIONS = 'camera; microphone; display-capture; autoplay; clipboard-write; fullscreen'\n\nexport function createIframe(base: string, style?: Partial<CSSStyleDeclaration>): HTMLIFrameElement {\n const el = document.createElement('iframe')\n el.src = base.replace(/\\/$/, '')\n el.allow = PERMISSIONS\n el.style.border = 'none'\n el.style.width = '100%'\n el.style.height = '100%'\n\n if (style) {\n for (const [key, value] of Object.entries(style)) {\n ;(el.style as unknown as Record<string, string>)[key] = value as string\n }\n }\n\n return el\n}\n\nexport function resolveContainer(container: XCallOptions['container']): HTMLElement {\n const el =\n typeof container === 'string'\n ? (document.querySelector(container) as HTMLElement | null)\n : container\n if (!el) throw new Error('[xCall] container not found')\n return el\n}\n","import type { XCallEventName, XCallEventCallback, XCallEventMap } from '../types'\n\ntype ListenerMap = Partial<{\n [K in XCallEventName]: Set<XCallEventCallback<K>>\n}>\n\nexport class EventEmitter {\n private listeners: ListenerMap = {}\n\n on<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this {\n if (!this.listeners[event]) {\n this.listeners[event] = new Set() as never\n }\n ;(this.listeners[event] as Set<XCallEventCallback<K>>).add(cb)\n return this\n }\n\n off<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this {\n ;(this.listeners[event] as Set<XCallEventCallback<K>> | undefined)?.delete(cb)\n return this\n }\n\n emit<K extends XCallEventName>(event: K, data: XCallEventMap[K]): void {\n const handlers = this.listeners[event] as Set<XCallEventCallback<K>> | undefined\n handlers?.forEach((cb) => cb(data))\n }\n}\n","import type { XCallOptions, XCallEventName, XCallEventCallback, XCallCommand, XCallIncomingMessage } from '../types'\nimport { createIframe, resolveContainer } from '../internal/iframe'\nimport { EventEmitter } from '../internal/events'\n\nconst DEFAULT_ROOM_URL = 'https://room.xcall.com.br'\n\nexport class XCall {\n private iframe: HTMLIFrameElement\n private origin: string\n private emitter = new EventEmitter()\n private messageHandler: (e: MessageEvent) => void\n\n constructor(options: XCallOptions) {\n const container = resolveContainer(options.container)\n const base = options.roomUrl ?? DEFAULT_ROOM_URL\n\n this.origin = new URL(base).origin\n this.iframe = createIframe(base, options.iframeStyle)\n container.appendChild(this.iframe)\n\n this.messageHandler = (e: MessageEvent) => {\n if (e.origin !== this.origin) return\n this._handleMessage(e.data as XCallIncomingMessage, options.token)\n }\n window.addEventListener('message', this.messageHandler)\n }\n\n // ── Eventos ───────────────────────────────────────────────────────────────\n\n on<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this {\n this.emitter.on(event, cb)\n return this\n }\n\n off<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this {\n this.emitter.off(event, cb)\n return this\n }\n\n // ── Comandos ──────────────────────────────────────────────────────────────\n\n muteAudio(muted: boolean) { this._send({ type: 'xcall:mute_audio', muted }) }\n muteVideo(muted: boolean) { this._send({ type: 'xcall:mute_video', muted }) }\n leave() { this._send({ type: 'xcall:leave' }) }\n\n destroy() {\n window.removeEventListener('message', this.messageHandler)\n this.iframe.remove()\n }\n\n // ── Internals ─────────────────────────────────────────────────────────────\n\n private _handleMessage(msg: XCallIncomingMessage, token: string) {\n switch (msg.type) {\n case 'xcall:ready':\n this._send({ type: 'xcall:token', token })\n this.emitter.emit('ready', undefined as void)\n break\n case 'xcall:joined':\n this.emitter.emit('joined', { roomId: msg.roomId, userId: msg.userId })\n break\n case 'xcall:left':\n this.emitter.emit('left', { roomId: msg.roomId, reason: msg.reason })\n break\n case 'xcall:participant_joined':\n this.emitter.emit('participant_joined', { userId: msg.userId, displayName: msg.displayName })\n break\n case 'xcall:participant_left':\n this.emitter.emit('participant_left', { userId: msg.userId })\n break\n case 'xcall:error':\n this.emitter.emit('error', { code: msg.code, message: msg.message })\n break\n }\n }\n\n private _send(cmd: XCallCommand) {\n this.iframe.contentWindow?.postMessage(cmd, this.origin)\n }\n}\n"],"mappings":"AAEA,IAAMA,EAAc,6EAEb,SAASC,EAAaC,EAAcC,EAAyD,CAClG,IAAMC,EAAK,SAAS,cAAc,QAAQ,EAO1C,GANAA,EAAG,IAAMF,EAAK,QAAQ,MAAO,EAAE,EAC/BE,EAAG,MAAQJ,EACXI,EAAG,MAAM,OAAS,OAClBA,EAAG,MAAM,MAAQ,OACjBA,EAAG,MAAM,OAAS,OAEdD,EACF,OAAW,CAACE,EAAKC,CAAK,IAAK,OAAO,QAAQH,CAAK,EAC3CC,EAAG,MAA4CC,CAAG,EAA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iC,CACvE,YAAK,QAAQ,IAAID,EAAOC,CAAE,EACnB,IACT,CAIA,UAAUC,EAAgB,CAAE,KAAK,MAAM,CAAE,KAAM,mBAAoB,MAAAA,CAAM,CAAC,CAAE,CAC5E,UAAUA,EAAgB,CAAE,KAAK,MAAM,CAAE,KAAM,mBAAoB,MAAAA,CAAM,CAAC,CAAE,CAC5E,OAA0B,CAAE,KAAK,MAAM,CAAE,KAAM,aAAc,CAAC,CAAE,CAEhE,SAAU,CACR,OAAO,oBAAoB,UAAW,KAAK,cAAc,EACzD,KAAK,OAAO,OAAO,CACrB,CAIQ,eAAeC,EAA2BC,EAAe,CAC/D,OAAQD,EAAI,KAAM,CAChB,IAAK,cACH,KAAK,MAAM,CAAE,KAAM,cAAe,MAAAC,CAAM,CAAC,EACzC,KAAK,QAAQ,KAAK,QAAS,MAAiB,EAC5C,MACF,IAAK,eACH,KAAK,QAAQ,KAAK,SAAU,CAAE,OAAQD,EAAI,OAAQ,OAAQA,EAAI,MAAO,CAAC,EACtE,MACF,IAAK,aACH,KAAK,QAAQ,KAAK,OAAQ,CAAE,OAAQA,EAAI,OAAQ,OAAQA,EAAI,MAAO,CAAC,EACpE,MACF,IAAK,2BACH,KAAK,QAAQ,KAAK,qBAAsB,CAAE,OAAQA,EAAI,OAAQ,YAAaA,EAAI,WAAY,CAAC,EAC5F,MACF,IAAK,yBACH,KAAK,QAAQ,KAAK,mBAAoB,CAAE,OAAQA,EAAI,MAAO,CAAC,EAC5D,MACF,IAAK,cACH,KAAK,QAAQ,KAAK,QAAS,CAAE,KAAMA,EAAI,KAAM,QAASA,EAAI,OAAQ,CAAC,EACnE,KACJ,CACF,CAEQ,MAAME,EAAmB,CA5EnC,IAAAX,GA6EIA,EAAA,KAAK,OAAO,gBAAZ,MAAAA,EAA2B,YAAYW,EAAK,KAAK,OACnD,CACF","names":["PERMISSIONS","createIframe","base","style","el","key","value","resolveContainer","container","EventEmitter","event","cb","_a","data","handlers","DEFAULT_ROOM_URL","XCall","options","EventEmitter","_a","container","resolveContainer","base","createIframe","e","event","cb","muted","msg","token","cmd"]}
package/dist/xcall.min.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var m=(i,e)=>{for(var a in e)r(i,a,{get:e[a],enumerable:!0})},p=(i,e,a,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of c(e))!d.call(i,l)&&l!==a&&r(i,l,{get:()=>e[l],enumerable:!(t=o(e,l))||t.enumerable});return i};var h=i=>p(r({},"__esModule",{value:!0}),i);var C={};m(C,{XCall:()=>s});module.exports=h(C);var v="https://room.xcall.com.br",s=class{constructor(e){this.listeners={};var l;let a=typeof e.container=="string"?document.querySelector(e.container):e.container;if(!a)throw new Error("[xCall] container not found");let t=(l=e.roomUrl)!=null?l:v;this.origin=new URL(t).origin,this.iframe=this._createIframe(t,e),this._applyStyles(this.iframe,e.iframeStyle),a.appendChild(this.iframe),this.messageHandler=n=>{n.origin===this.origin&&this._handleMessage(n.data,e.token)},window.addEventListener("message",this.messageHandler)}_createIframe(e,a){let t=document.createElement("iframe");return t.src=e.replace(/\/$/,""),t.allow="camera; microphone; display-capture; autoplay; clipboard-write; fullscreen",t.style.border="none",t.style.width="100%",t.style.height="100%",t}_applyStyles(e,a){if(a)for(let[t,l]of Object.entries(a))e.style[t]=l}_handleMessage(e,a){switch(e.type){case"xcall:ready":this._send({type:"xcall:token",token:a}),this._emit("ready",void 0);break;case"xcall:joined":this._emit("joined",{roomId:e.roomId,userId:e.userId});break;case"xcall:left":this._emit("left",{roomId:e.roomId,reason:e.reason});break;case"xcall:participant_joined":this._emit("participant_joined",{userId:e.userId,displayName:e.displayName});break;case"xcall:participant_left":this._emit("participant_left",{userId:e.userId});break;case"xcall:error":this._emit("error",{code:e.code,message:e.message});break}}on(e,a){return this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(a),this}off(e,a){var t;return(t=this.listeners[e])==null||t.delete(a),this}muteAudio(e){this._send({type:"xcall:mute_audio",muted:e})}muteVideo(e){this._send({type:"xcall:mute_video",muted:e})}leave(){this._send({type:"xcall:leave"})}destroy(){window.removeEventListener("message",this.messageHandler),this.iframe.remove()}_send(e){var a;(a=this.iframe.contentWindow)==null||a.postMessage(e,this.origin)}_emit(e,a){let t=this.listeners[e];t==null||t.forEach(l=>l(a))}};0&&(module.exports={XCall});
1
+ "use strict";var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var C=(a,e)=>{for(var t in e)s(a,t,{get:e[t],enumerable:!0})},f=(a,e,t,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!h.call(a,r)&&r!==t&&s(a,r,{get:()=>e[r],enumerable:!(l=d(e,r))||l.enumerable});return a};var v=a=>f(s({},"__esModule",{value:!0}),a);var X={};C(X,{XCall:()=>n});module.exports=v(X);var u="camera; microphone; display-capture; autoplay; clipboard-write; fullscreen";function m(a,e){let t=document.createElement("iframe");if(t.src=a.replace(/\/$/,""),t.allow=u,t.style.border="none",t.style.width="100%",t.style.height="100%",e)for(let[l,r]of Object.entries(e))t.style[l]=r;return t}function c(a){let e=typeof a=="string"?document.querySelector(a):a;if(!e)throw new Error("[xCall] container not found");return e}var i=class{constructor(){this.listeners={}}on(e,t){return this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t),this}off(e,t){var l;return(l=this.listeners[e])==null||l.delete(t),this}emit(e,t){let l=this.listeners[e];l==null||l.forEach(r=>r(t))}};var E="https://room.xcall.com.br",n=class{constructor(e){this.emitter=new i;var r;let t=c(e.container),l=(r=e.roomUrl)!=null?r:E;this.origin=new URL(l).origin,this.iframe=m(l,e.iframeStyle),t.appendChild(this.iframe),this.messageHandler=o=>{o.origin===this.origin&&this._handleMessage(o.data,e.token)},window.addEventListener("message",this.messageHandler)}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}muteAudio(e){this._send({type:"xcall:mute_audio",muted:e})}muteVideo(e){this._send({type:"xcall:mute_video",muted:e})}leave(){this._send({type:"xcall:leave"})}destroy(){window.removeEventListener("message",this.messageHandler),this.iframe.remove()}_handleMessage(e,t){switch(e.type){case"xcall:ready":this._send({type:"xcall:token",token:t}),this.emitter.emit("ready",void 0);break;case"xcall:joined":this.emitter.emit("joined",{roomId:e.roomId,userId:e.userId});break;case"xcall:left":this.emitter.emit("left",{roomId:e.roomId,reason:e.reason});break;case"xcall:participant_joined":this.emitter.emit("participant_joined",{userId:e.userId,displayName:e.displayName});break;case"xcall:participant_left":this.emitter.emit("participant_left",{userId:e.userId});break;case"xcall:error":this.emitter.emit("error",{code:e.code,message:e.message});break}}_send(e){var t;(t=this.iframe.contentWindow)==null||t.postMessage(e,this.origin)}};0&&(module.exports={XCall});
2
2
  //# sourceMappingURL=xcall.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {\n XCallOptions,\n XCallEventName,\n XCallEventCallback,\n XCallEventMap,\n XCallCommand,\n XCallIncomingMessage,\n} from './types'\n\nexport * from './types'\n\nconst DEFAULT_ROOM_URL = 'https://room.xcall.com.br'\n\nexport class XCall {\n private iframe: HTMLIFrameElement\n private origin: string\n private listeners: Partial<{\n [K in XCallEventName]: Set<XCallEventCallback<K>>\n }> = {}\n private messageHandler: (e: MessageEvent) => void\n\n constructor(options: XCallOptions) {\n const container =\n typeof options.container === 'string'\n ? (document.querySelector(options.container) as HTMLElement | null)\n : options.container\n\n if (!container) throw new Error('[xCall] container not found')\n\n const base = options.roomUrl ?? DEFAULT_ROOM_URL\n // Remove trailing slash para evitar URL duplo\n this.origin = new URL(base).origin\n\n this.iframe = this._createIframe(base, options)\n this._applyStyles(this.iframe, options.iframeStyle)\n\n container.appendChild(this.iframe)\n\n // ── Listener global de mensagens ──────────────────────────────────────\n this.messageHandler = (e: MessageEvent) => {\n if (e.origin !== this.origin) return\n this._handleMessage(e.data as XCallIncomingMessage, options.token)\n }\n window.addEventListener('message', this.messageHandler)\n }\n\n // ── Criar iframe limpo (sem token na URL) ─────────────────────────────────\n private _createIframe(\n base: string,\n options: XCallOptions\n ): HTMLIFrameElement {\n const el = document.createElement('iframe')\n // Sem ?token= na URL o token é enviado via postMessage após xcall:ready\n el.src = base.replace(/\\/$/, '')\n el.allow =\n 'camera; microphone; display-capture; autoplay; clipboard-write; fullscreen'\n el.style.border = 'none'\n el.style.width = '100%'\n el.style.height = '100%'\n return el\n }\n\n private _applyStyles(\n iframe: HTMLIFrameElement,\n style?: Partial<CSSStyleDeclaration>\n ) {\n if (!style) return\n for (const [key, value] of Object.entries(style)) {\n ;(iframe.style as unknown as Record<string, string>)[key] = value as string\n }\n }\n\n // ── Roteador de mensagens recebidas ──────────────────────────────────────\n private _handleMessage(msg: XCallIncomingMessage, token: string) {\n switch (msg.type) {\n case 'xcall:ready':\n // Envia o token de forma segura via postMessage\n this._send({ type: 'xcall:token', token })\n this._emit('ready', undefined as void)\n break\n case 'xcall:joined':\n this._emit('joined', { roomId: msg.roomId, userId: msg.userId })\n break\n case 'xcall:left':\n this._emit('left', { roomId: msg.roomId, reason: msg.reason })\n break\n case 'xcall:participant_joined':\n this._emit('participant_joined', {\n userId: msg.userId,\n displayName: msg.displayName,\n })\n break\n case 'xcall:participant_left':\n this._emit('participant_left', { userId: msg.userId })\n break\n case 'xcall:error':\n this._emit('error', { code: msg.code, message: msg.message })\n break\n }\n }\n\n // ── API pública ──────────────────────────────────────────────────────────\n\n on<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this {\n if (!this.listeners[event]) {\n this.listeners[event] = new Set() as never\n }\n ;(this.listeners[event] as Set<XCallEventCallback<K>>).add(cb)\n return this\n }\n\n off<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this {\n ;(this.listeners[event] as Set<XCallEventCallback<K>> | undefined)?.delete(cb)\n return this\n }\n\n muteAudio(muted: boolean) {\n this._send({ type: 'xcall:mute_audio', muted })\n }\n\n muteVideo(muted: boolean) {\n this._send({ type: 'xcall:mute_video', muted })\n }\n\n leave() {\n this._send({ type: 'xcall:leave' })\n }\n\n /** Remove o iframe e os listeners. Chame quando destruir o componente. */\n destroy() {\n window.removeEventListener('message', this.messageHandler)\n this.iframe.remove()\n }\n\n // ── Helpers privados ─────────────────────────────────────────────────────\n\n private _send(cmd: XCallCommand) {\n this.iframe.contentWindow?.postMessage(cmd, this.origin)\n }\n\n private _emit<K extends XCallEventName>(event: K, data: XCallEventMap[K]) {\n const handlers = this.listeners[event] as\n | Set<XCallEventCallback<K>>\n | undefined\n handlers?.forEach((cb) => cb(data))\n }\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,IAAA,eAAAC,EAAAH,GAWA,IAAMI,EAAmB,4BAEZF,EAAN,KAAY,CAQjB,YAAYG,EAAuB,CALnC,KAAQ,UAEH,CAAC,EAlBR,IAAAC,EAsBI,IAAMC,EACJ,OAAOF,EAAQ,WAAc,SACxB,SAAS,cAAcA,EAAQ,SAAS,EACzCA,EAAQ,UAEd,GAAI,CAACE,EAAW,MAAM,IAAI,MAAM,6BAA6B,EAE7D,IAAMC,GAAOF,EAAAD,EAAQ,UAAR,KAAAC,EAAmBF,EAEhC,KAAK,OAAS,IAAI,IAAII,CAAI,EAAE,OAE5B,KAAK,OAAS,KAAK,cAAcA,EAAMH,CAAO,EAC9C,KAAK,aAAa,KAAK,OAAQA,EAAQ,WAAW,EAElDE,EAAU,YAAY,KAAK,MAAM,EAGjC,KAAK,eAAkBE,GAAoB,CACrCA,EAAE,SAAW,KAAK,QACtB,KAAK,eAAeA,EAAE,KAA8BJ,EAAQ,KAAK,CACnE,EACA,OAAO,iBAAiB,UAAW,KAAK,cAAc,CACxD,CAGQ,cACNG,EACAH,EACmB,CACnB,IAAMK,EAAK,SAAS,cAAc,QAAQ,EAE1C,OAAAA,EAAG,IAAMF,EAAK,QAAQ,M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CAEA,UAAUA,EAAgB,CACxB,KAAK,MAAM,CAAE,KAAM,mBAAoB,MAAAA,CAAM,CAAC,CAChD,CAEA,OAAQ,CACN,KAAK,MAAM,CAAE,KAAM,aAAc,CAAC,CACpC,CAGA,SAAU,CACR,OAAO,oBAAoB,UAAW,KAAK,cAAc,EACzD,KAAK,OAAO,OAAO,CACrB,CAIQ,MAAMC,EAAmB,CAxInC,IAAAd,GAyIIA,EAAA,KAAK,OAAO,gBAAZ,MAAAA,EAA2B,YAAYc,EAAK,KAAK,OACnD,CAEQ,MAAgCH,EAAUI,EAAwB,CACxE,IAAMC,EAAW,KAAK,UAAUL,CAAK,EAGrCK,GAAA,MAAAA,EAAU,QAASJ,GAAOA,EAAGG,CAAI,EACnC,CACF","names":["src_exports","__export","XCall","__toCommonJS","DEFAULT_ROOM_URL","options","_a","container","base","e","el","iframe","style","key","value","msg","token","event","cb","muted","cmd","data","handlers"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/internal/iframe.ts","../src/internal/events.ts","../src/core/XCall.ts"],"sourcesContent":["export { XCall } from './core/XCall'\nexport * from './types'\n","import type { XCallOptions } from '../types'\n\nconst PERMISSIONS = 'camera; microphone; display-capture; autoplay; clipboard-write; fullscreen'\n\nexport function createIframe(base: string, style?: Partial<CSSStyleDeclaration>): HTMLIFrameElement {\n const el = document.createElement('iframe')\n el.src = base.replace(/\\/$/, '')\n el.allow = PERMISSIONS\n el.style.border = 'none'\n el.style.width = '100%'\n el.style.height = '100%'\n\n if (style) {\n for (const [key, value] of Object.entries(style)) {\n ;(el.style as unknown as Record<string, string>)[key] = value as string\n }\n }\n\n return el\n}\n\nexport function resolveContainer(container: XCallOptions['container']): HTMLElement {\n const el =\n typeof container === 'string'\n ? (document.querySelector(container) as HTMLElement | null)\n : container\n if (!el) throw new Error('[xCall] container not found')\n return el\n}\n","import type { XCallEventName, XCallEventCallback, XCallEventMap } from '../types'\n\ntype ListenerMap = Partial<{\n [K in XCallEventName]: Set<XCallEventCallback<K>>\n}>\n\nexport class EventEmitter {\n private listeners: ListenerMap = {}\n\n on<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this {\n if (!this.listeners[event]) {\n this.listeners[event] = new Set() as never\n }\n ;(this.listeners[event] as Set<XCallEventCallback<K>>).add(cb)\n return this\n }\n\n off<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this {\n ;(this.listeners[event] as Set<XCallEventCallback<K>> | undefined)?.delete(cb)\n return this\n }\n\n emit<K extends XCallEventName>(event: K, data: XCallEventMap[K]): void {\n const handlers = this.listeners[event] as Set<XCallEventCallback<K>> | undefined\n handlers?.forEach((cb) => cb(data))\n }\n}\n","import type { XCallOptions, XCallEventName, XCallEventCallback, XCallCommand, XCallIncomingMessage } from '../types'\nimport { createIframe, resolveContainer } from '../internal/iframe'\nimport { EventEmitter } from '../internal/events'\n\nconst DEFAULT_ROOM_URL = 'https://room.xcall.com.br'\n\nexport class XCall {\n private iframe: HTMLIFrameElement\n private origin: string\n private emitter = new EventEmitter()\n private messageHandler: (e: MessageEvent) => void\n\n constructor(options: XCallOptions) {\n const container = resolveContainer(options.container)\n const base = options.roomUrl ?? DEFAULT_ROOM_URL\n\n this.origin = new URL(base).origin\n this.iframe = createIframe(base, options.iframeStyle)\n container.appendChild(this.iframe)\n\n this.messageHandler = (e: MessageEvent) => {\n if (e.origin !== this.origin) return\n this._handleMessage(e.data as XCallIncomingMessage, options.token)\n }\n window.addEventListener('message', this.messageHandler)\n }\n\n // ── Eventos ───────────────────────────────────────────────────────────────\n\n on<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this {\n this.emitter.on(event, cb)\n return this\n }\n\n off<K extends XCallEventName>(event: K, cb: XCallEventCallback<K>): this {\n this.emitter.off(event, cb)\n return this\n }\n\n // ── Comandos ──────────────────────────────────────────────────────────────\n\n muteAudio(muted: boolean) { this._send({ type: 'xcall:mute_audio', muted }) }\n muteVideo(muted: boolean) { this._send({ type: 'xcall:mute_video', muted }) }\n leave() { this._send({ type: 'xcall:leave' }) }\n\n destroy() {\n window.removeEventListener('message', this.messageHandler)\n this.iframe.remove()\n }\n\n // ── Internals ─────────────────────────────────────────────────────────────\n\n private _handleMessage(msg: XCallIncomingMessage, token: string) {\n switch (msg.type) {\n case 'xcall:ready':\n this._send({ type: 'xcall:token', token })\n this.emitter.emit('ready', undefined as void)\n break\n case 'xcall:joined':\n this.emitter.emit('joined', { roomId: msg.roomId, userId: msg.userId })\n break\n case 'xcall:left':\n this.emitter.emit('left', { roomId: msg.roomId, reason: msg.reason })\n break\n case 'xcall:participant_joined':\n this.emitter.emit('participant_joined', { userId: msg.userId, displayName: msg.displayName })\n break\n case 'xcall:participant_left':\n this.emitter.emit('participant_left', { userId: msg.userId })\n break\n case 'xcall:error':\n this.emitter.emit('error', { code: msg.code, message: msg.message })\n break\n }\n }\n\n private _send(cmd: XCallCommand) {\n this.iframe.contentWindow?.postMessage(cmd, this.origin)\n }\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,IAAA,eAAAC,EAAAH,GCEA,IAAMI,EAAc,6EAEb,SAASC,EAAaC,EAAcC,EAAyD,CAClG,IAAMC,EAAK,SAAS,cAAc,QAAQ,EAO1C,GANAA,EAAG,IAAMF,EAAK,QAAQ,MAAO,EAAE,EAC/BE,EAAG,MAAQJ,EACXI,EAAG,MAAM,OAAS,OAClBA,EAAG,MAAM,MAAQ,OACjBA,EAAG,MAAM,OAAS,OAEdD,EACF,OAAW,CAACE,EAAKC,CAAK,IAAK,OAAO,QAAQH,CAAK,EAC3CC,EAAG,MAA4CC,CAAG,EAAIC,EAI5D,OAAOF,CACT,CAEO,SAASG,EAAiBC,EAAmD,CAClF,IAAMJ,EACJ,OAAOI,GAAc,SAChB,SAAS,cAAcA,CAAS,EACjCA,EACN,GAAI,CAACJ,EAAI,MAAM,IAAI,MAAM,6BAA6B,EACtD,OAAOA,CACT,CCtBO,IAAMK,EAAN,KAAmB,CAAnB,cACL,KAAQ,UA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B,CAAE,KAAK,MAAM,CAAE,KAAM,aAAc,CAAC,CAAE,CAEhE,SAAU,CACR,OAAO,oBAAoB,UAAW,KAAK,cAAc,EACzD,KAAK,OAAO,OAAO,CACrB,CAIQ,eAAeC,EAA2BC,EAAe,CAC/D,OAAQD,EAAI,KAAM,CAChB,IAAK,cACH,KAAK,MAAM,CAAE,KAAM,cAAe,MAAAC,CAAM,CAAC,EACzC,KAAK,QAAQ,KAAK,QAAS,MAAiB,EAC5C,MACF,IAAK,eACH,KAAK,QAAQ,KAAK,SAAU,CAAE,OAAQD,EAAI,OAAQ,OAAQA,EAAI,MAAO,CAAC,EACtE,MACF,IAAK,aACH,KAAK,QAAQ,KAAK,OAAQ,CAAE,OAAQA,EAAI,OAAQ,OAAQA,EAAI,MAAO,CAAC,EACpE,MACF,IAAK,2BACH,KAAK,QAAQ,KAAK,qBAAsB,CAAE,OAAQA,EAAI,OAAQ,YAAaA,EAAI,WAAY,CAAC,EAC5F,MACF,IAAK,yBACH,KAAK,QAAQ,KAAK,mBAAoB,CAAE,OAAQA,EAAI,MAAO,CAAC,EAC5D,MACF,IAAK,cACH,KAAK,QAAQ,KAAK,QAAS,CAAE,KAAMA,EAAI,KAAM,QAASA,EAAI,OAAQ,CAAC,EACnE,KACJ,CACF,CAEQ,MAAME,EAAmB,CA5EnC,IAAAX,GA6EIA,EAAA,KAAK,OAAO,gBAAZ,MAAAA,EAA2B,YAAYW,EAAK,KAAK,OACnD,CACF","names":["src_exports","__export","XCall","__toCommonJS","PERMISSIONS","createIframe","base","style","el","key","value","resolveContainer","container","EventEmitter","event","cb","_a","data","handlers","DEFAULT_ROOM_URL","XCall","options","EventEmitter","_a","container","resolveContainer","base","createIframe","e","event","cb","muted","msg","token","cmd"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xcall/sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "xCall SDK — embed video calls in any website",
5
5
  "main": "dist/xcall.min.js",
6
6
  "module": "dist/xcall.min.esm.js",