// CodeB meet -- Angular button + iframe // Docs: https://www.aloaha.com/meet-embed-cookbook.html // European Digital Identity Wallet compatible. import { Component, Input } from "@angular/core"; import { DomSanitizer, SafeResourceUrl } from "@angular/platform-browser"; @Component({ selector: "codeb-meet-button", template: ` {{ label }} ` }) export class CodeBMeetButtonComponent { @Input() tenantOrigin = "https://phone.your-tenant.example"; @Input() room?: string; @Input() dial?: string; @Input() trunk?: string; @Input() relay = false; @Input() label = "Meet us now (video call)"; get url(): string { const room = (this.room || randomRoom()).toLowerCase().replace(/[^a-z0-9\-_]/g, "-"); let u = this.tenantOrigin.replace(/\/+$/, "") + "/room.html?room=" + encodeURIComponent(room); if (this.dial) u += "&dial=" + encodeURIComponent(this.dial); if (this.trunk) u += "&trunk=" + encodeURIComponent(this.trunk); if (this.relay) u += "&relay=1"; return u; } } @Component({ selector: "codeb-meet-iframe", template: ` ` }) export class CodeBMeetIframeComponent { @Input() tenantOrigin = "https://phone.your-tenant.example"; @Input() room = "sales-demo"; @Input() width = 1180; @Input() height = 720; safeSrc: SafeResourceUrl; constructor(private s: DomSanitizer) { this.safeSrc = this.s.bypassSecurityTrustResourceUrl( `${this.tenantOrigin}/room.html?room=${encodeURIComponent(this.room)}` ); } } function randomRoom(): string { const c = "abcdefghijklmnopqrstuvwxyz23456789"; let s = ""; for (let i = 0; i < 8; i++) s += c.charAt(Math.floor(Math.random() * c.length)); return s; }