@wexio/messenger-widget-angular 1.0.23 → 1.0.25

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Wexio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/README.md ADDED
@@ -0,0 +1,175 @@
1
+ # Welcome to @wexio/messenger-widget-angular 👋
2
+
3
+ [![Version](https://img.shields.io/npm/v/@wexio/messenger-widget-angular.svg)](https://www.npmjs.com/package/@wexio/messenger-widget-angular)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
5
+ [![Documentation](https://img.shields.io/badge/docs-wexio.io-blue.svg)](https://learn.wexio.io/docs/web-widget)
6
+
7
+ Native Angular standalone component for the [Wexio](https://wexio.io) web messenger. Thin wrapper around the underlying `<wexio-widget>` custom element — same `WidgetShell` runtime as the script-injected iframe and the React component. Same chat, same visitor identity, same backend; the only difference is **where the Angular tree mounts**.
8
+
9
+ 🏠 [Website](https://wexio.io)
10
+ 📚 [Developer Docs](https://learn.wexio.io/docs/web-widget)
11
+
12
+ ## 📂 Description
13
+
14
+ - [Installation](#installation)
15
+ - [Quick start](#quick-start)
16
+ - [Identifying users](#identifying-users)
17
+ - [Inputs](#inputs)
18
+ - [Outputs](#outputs)
19
+ - [Types](#types)
20
+ - [SSR (Angular Universal)](#ssr-angular-universal)
21
+ - [Browser support](#browser-support)
22
+ - [Author](#author)
23
+ - [License](#-license)
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ yarn add @wexio/messenger-widget-angular
29
+ ```
30
+
31
+ or
32
+
33
+ ```bash
34
+ npm install @wexio/messenger-widget-angular
35
+ ```
36
+
37
+ Peer dependencies: `@angular/core >= 16`, `@angular/common >= 16`. The widget uses the host's Angular runtime.
38
+
39
+ ## Quick start
40
+
41
+ ```ts
42
+ // app.component.ts
43
+ import { Component } from "@angular/core";
44
+ import { WexioWidgetComponent } from "@wexio/messenger-widget-angular";
45
+
46
+ @Component({
47
+ standalone: true,
48
+ imports: [WexioWidgetComponent],
49
+ selector: "app-root",
50
+ template: `
51
+ <main>
52
+ <!-- your app -->
53
+ <wexio-widget-ng publicKey="pk_live_..." />
54
+ </main>
55
+ `,
56
+ })
57
+ export class AppComponent {}
58
+ ```
59
+
60
+ That's it — the widget mounts a floating launcher, handles its own theme/locale/state, and the operator dashboard sees the visitor immediately.
61
+
62
+ > **Selector** — the component selector is `wexio-widget-ng` (suffixed to avoid clashing with the underlying `<wexio-widget>` custom element it renders).
63
+
64
+ ## Identifying users
65
+
66
+ Pass a verified `user` input to log a known visitor in. Provide ONE proof — a Google FedCM `id_token`, a host-signed `jwt`, or the legacy `userId` + `userHash` HMAC pair:
67
+
68
+ ```ts
69
+ import { Component } from "@angular/core";
70
+ import {
71
+ VisitorIdentity,
72
+ WexioWidgetComponent,
73
+ } from "@wexio/messenger-widget-angular";
74
+
75
+ @Component({
76
+ standalone: true,
77
+ imports: [WexioWidgetComponent],
78
+ selector: "app-root",
79
+ template: `<wexio-widget-ng publicKey="pk_live_..." [user]="user" />`,
80
+ })
81
+ export class AppComponent {
82
+ user: VisitorIdentity = {
83
+ jwt: serverSignedJwt, // host-signed identity token (recommended)
84
+ name: "Ada Lovelace",
85
+ email: "ada@example.com",
86
+ };
87
+ }
88
+ ```
89
+
90
+ > **Reactive identity** — assign a new object (or `null`) to `user` to re-fire the handshake / log out. The component's `ngOnChanges` watches it.
91
+
92
+ ## Inputs
93
+
94
+ | Input | Type | Description |
95
+ | -------------- | ----------------------------- | --------------------------------------------------------------------------------- |
96
+ | `publicKey` | `string` | Wexio integration public key (`pk_live_...`). Omit for demo mode. |
97
+ | `locale` | `string` | UI locale (BCP-47). Overrides the operator's `localeStrategy`. |
98
+ | `prefillName` | `string` | Unverified prechat prefill. |
99
+ | `prefillEmail` | `string` | Unverified prechat prefill. |
100
+ | `prefillPhone` | `string` | Unverified prechat prefill. |
101
+ | `user` | `VisitorIdentity \| null` | Known-user identity proof. Pass `null` to log out. |
102
+
103
+ ## Outputs
104
+
105
+ | Output | Payload | When |
106
+ | --------- | -------------------------------------- | --------------------------------------------------- |
107
+ | `resize` | `{ width: number; height: number }` | Panel dimensions changed (open ↔ closed). |
108
+ | `close` | `void` | Visitor closed the panel. |
109
+
110
+ ```ts
111
+ template: `
112
+ <wexio-widget-ng
113
+ publicKey="pk_live_..."
114
+ (resize)="onResize($event)"
115
+ (close)="onClose()"
116
+ />
117
+ `;
118
+
119
+ // ...
120
+ onResize(size: { width: number; height: number }) {
121
+ console.log(size.width, size.height);
122
+ }
123
+ onClose() {
124
+ console.log("visitor closed the panel");
125
+ }
126
+ ```
127
+
128
+ ## Types
129
+
130
+ ### VisitorIdentity
131
+
132
+ ```ts
133
+ interface VisitorIdentity {
134
+ googleIdToken?: string; // Google FedCM id_token (preferred)
135
+ jwt?: string; // Host-signed JWT
136
+ userId?: string; // Legacy HMAC pair…
137
+ userHash?: string; // …(HMAC-SHA256(userId, integrationSecret))
138
+ name?: string;
139
+ email?: string;
140
+ phone?: string;
141
+ attributes?: Record<string, unknown>;
142
+ }
143
+ ```
144
+
145
+ ## SSR (Angular Universal)
146
+
147
+ The wrapper renders an empty `<wexio-widget>` element on the server. The actual widget initialises on first client-side mount (`ngAfterViewInit`). No special handling is needed for Angular Universal — the custom element runs only in the browser.
148
+
149
+ ## Browser support
150
+
151
+ Modern evergreen browsers — anything that supports Shadow DOM and ES2020. Internet Explorer is not supported.
152
+
153
+ ## Use with other frameworks
154
+
155
+ The underlying widget runtime is a Web Component, so it works in any modern framework:
156
+
157
+ - [`@wexio/messenger-widget-react`](https://www.npmjs.com/package/@wexio/messenger-widget-react) — React
158
+ - [`@wexio/messenger-widget-vue`](https://www.npmjs.com/package/@wexio/messenger-widget-vue) — Vue 3
159
+ - [`@wexio/messenger-widget-ember`](https://www.npmjs.com/package/@wexio/messenger-widget-ember) — Ember
160
+
161
+ ## Author
162
+
163
+ 👤 **Wexio** ([https://wexio.io](https://wexio.io))
164
+
165
+ ## Show your support
166
+
167
+ Give a ⭐️ if this package helped you!
168
+
169
+ ## 📝 License
170
+
171
+ This project is [MIT](./LICENSE) licensed.
172
+
173
+ ---
174
+
175
+ _Created with ❤️ by [Wexio](https://wexio.io)_
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Public surface of `@wexio/messenger-widget-angular`. ng-packagr uses
3
+ * this file as the package entry point (see `ng-package.json`).
4
+ *
5
+ * The widget runtime (`widget.js`) is shipped alongside the compiled
6
+ * Angular library and is copied into `dist/` via `ng-package.json`'s
7
+ * `assets` block. Consumers don't import `widget.js` directly — the
8
+ * Angular component registers + uses the custom element at boot.
9
+ */
10
+ export { WexioWidgetComponent } from "./wexio-widget.component";
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7OztHQVFHO0FBRUgsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sMEJBQTBCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIFB1YmxpYyBzdXJmYWNlIG9mIGBAd2V4aW8vbWVzc2VuZ2VyLXdpZGdldC1hbmd1bGFyYC4gbmctcGFja2FnciB1c2VzXG4gKiB0aGlzIGZpbGUgYXMgdGhlIHBhY2thZ2UgZW50cnkgcG9pbnQgKHNlZSBgbmctcGFja2FnZS5qc29uYCkuXG4gKlxuICogVGhlIHdpZGdldCBydW50aW1lIChgd2lkZ2V0LmpzYCkgaXMgc2hpcHBlZCBhbG9uZ3NpZGUgdGhlIGNvbXBpbGVkXG4gKiBBbmd1bGFyIGxpYnJhcnkgYW5kIGlzIGNvcGllZCBpbnRvIGBkaXN0L2AgdmlhIGBuZy1wYWNrYWdlLmpzb25gJ3NcbiAqIGBhc3NldHNgIGJsb2NrLiBDb25zdW1lcnMgZG9uJ3QgaW1wb3J0IGB3aWRnZXQuanNgIGRpcmVjdGx5IOKAlCB0aGVcbiAqIEFuZ3VsYXIgY29tcG9uZW50IHJlZ2lzdGVycyArIHVzZXMgdGhlIGN1c3RvbSBlbGVtZW50IGF0IGJvb3QuXG4gKi9cblxuZXhwb3J0IHsgV2V4aW9XaWRnZXRDb21wb25lbnQgfSBmcm9tIFwiLi93ZXhpby13aWRnZXQuY29tcG9uZW50XCI7XG5leHBvcnQgdHlwZSB7IFZpc2l0b3JJZGVudGl0eSB9IGZyb20gXCIuL3dleGlvLXdpZGdldC5jb21wb25lbnRcIjtcbiJdfQ==
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2V4aW8tbWVzc2VuZ2VyLXdpZGdldC1hbmd1bGFyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3dleGlvLW1lc3Nlbmdlci13aWRnZXQtYW5ndWxhci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpYy1hcGknO1xuIl19
@@ -0,0 +1,141 @@
1
+ /**
2
+ * `@wexio/messenger-widget-angular` — Angular standalone component
3
+ * wrapping the `<wexio-widget>` custom element.
4
+ *
5
+ * Forwards `@Input()` properties to kebab-case attributes on the
6
+ * underlying custom element and re-emits its `wexio:resize` /
7
+ * `wexio:close` CustomEvents as Angular `@Output()` `EventEmitter`s.
8
+ *
9
+ * Importing this module side-effect registers `<wexio-widget>` as a
10
+ * custom element — no separate script tag needed.
11
+ *
12
+ * Standalone — drop into any Angular component's `imports`:
13
+ *
14
+ * import { WexioWidgetComponent } from "@wexio/messenger-widget-angular";
15
+ *
16
+ * @Component({
17
+ * standalone: true,
18
+ * imports: [WexioWidgetComponent],
19
+ * template: `<wexio-widget-ng [publicKey]="pk" (close)="onClose()" />`,
20
+ * })
21
+ * export class AppComponent { ... }
22
+ */
23
+ import { Component, CUSTOM_ELEMENTS_SCHEMA, EventEmitter, Input, Output, ViewChild, } from "@angular/core";
24
+ import * as i0 from "@angular/core";
25
+ export class WexioWidgetComponent {
26
+ /** Wexio integration public key (`pk_live_...`). Omit for demo mode. */
27
+ publicKey;
28
+ /** UI locale (BCP-47). Overrides the operator's `localeStrategy`. */
29
+ locale;
30
+ /** Force widget mode. Public consumers should not set this. */
31
+ mode;
32
+ /** Unverified prechat prefill. */
33
+ prefillName;
34
+ /** Unverified prechat prefill. */
35
+ prefillEmail;
36
+ /** Unverified prechat prefill. */
37
+ prefillPhone;
38
+ /** Known-user identity proof. Pass `null` to log out. */
39
+ user;
40
+ /** Fires every time panel dimensions change (open ↔ closed). */
41
+ resize = new EventEmitter();
42
+ /** Fires when the visitor closes the panel. */
43
+ close = new EventEmitter();
44
+ elRef;
45
+ onResize = (event) => {
46
+ const detail = event
47
+ .detail;
48
+ if (detail)
49
+ this.resize.emit(detail);
50
+ };
51
+ onClose = () => this.close.emit();
52
+ ngAfterViewInit() {
53
+ const el = this.elRef?.nativeElement;
54
+ if (!el)
55
+ return;
56
+ // Runtime-inject the widget runtime once. We can't `import` it at
57
+ // build time (ng-packagr's strict TS rejects bare-JS imports), so
58
+ // we inject a `<script type="module">` here on first mount. The
59
+ // browser caches the module after first load, so subsequent
60
+ // component instances skip the network request entirely. Custom
61
+ // element upgrades retroactively — the `<wexio-widget>` element
62
+ // we already rendered will "upgrade" once the script registers
63
+ // its class, with no re-render flicker.
64
+ if (typeof document !== "undefined" &&
65
+ typeof customElements !== "undefined" &&
66
+ !customElements.get("wexio-widget") &&
67
+ !document.querySelector("script[data-wexio-widget-runtime]")) {
68
+ const script = document.createElement("script");
69
+ script.type = "module";
70
+ script.src = "https://cdn.wexio.io/widget/widget.js";
71
+ script.setAttribute("data-wexio-widget-runtime", "");
72
+ script.async = true;
73
+ document.head.appendChild(script);
74
+ }
75
+ el.addEventListener("wexio:resize", this.onResize);
76
+ el.addEventListener("wexio:close", this.onClose);
77
+ if (this.user)
78
+ el.identify?.(this.user);
79
+ }
80
+ ngOnChanges(changes) {
81
+ if (changes["user"] && this.elRef?.nativeElement) {
82
+ this.elRef.nativeElement.identify?.(this.user ?? null);
83
+ }
84
+ }
85
+ ngOnDestroy() {
86
+ const el = this.elRef?.nativeElement;
87
+ if (!el)
88
+ return;
89
+ el.removeEventListener("wexio:resize", this.onResize);
90
+ el.removeEventListener("wexio:close", this.onClose);
91
+ }
92
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WexioWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
93
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: WexioWidgetComponent, isStandalone: true, selector: "wexio-widget-ng", inputs: { publicKey: "publicKey", locale: "locale", mode: "mode", prefillName: "prefillName", prefillEmail: "prefillEmail", prefillPhone: "prefillPhone", user: "user" }, outputs: { resize: "resize", close: "close" }, viewQueries: [{ propertyName: "elRef", first: true, predicate: ["el"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `<wexio-widget
94
+ #el
95
+ [attr.public-key]="publicKey ?? null"
96
+ [attr.locale]="locale ?? null"
97
+ [attr.mode]="mode ?? null"
98
+ [attr.prefill-name]="prefillName ?? null"
99
+ [attr.prefill-email]="prefillEmail ?? null"
100
+ [attr.prefill-phone]="prefillPhone ?? null"
101
+ ></wexio-widget>`, isInline: true });
102
+ }
103
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WexioWidgetComponent, decorators: [{
104
+ type: Component,
105
+ args: [{
106
+ standalone: true,
107
+ selector: "wexio-widget-ng",
108
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
109
+ template: `<wexio-widget
110
+ #el
111
+ [attr.public-key]="publicKey ?? null"
112
+ [attr.locale]="locale ?? null"
113
+ [attr.mode]="mode ?? null"
114
+ [attr.prefill-name]="prefillName ?? null"
115
+ [attr.prefill-email]="prefillEmail ?? null"
116
+ [attr.prefill-phone]="prefillPhone ?? null"
117
+ ></wexio-widget>`,
118
+ }]
119
+ }], propDecorators: { publicKey: [{
120
+ type: Input
121
+ }], locale: [{
122
+ type: Input
123
+ }], mode: [{
124
+ type: Input
125
+ }], prefillName: [{
126
+ type: Input
127
+ }], prefillEmail: [{
128
+ type: Input
129
+ }], prefillPhone: [{
130
+ type: Input
131
+ }], user: [{
132
+ type: Input
133
+ }], resize: [{
134
+ type: Output
135
+ }], close: [{
136
+ type: Output
137
+ }], elRef: [{
138
+ type: ViewChild,
139
+ args: ["el", { static: true }]
140
+ }] } });
141
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2V4aW8td2lkZ2V0LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy93ZXhpby13aWRnZXQuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FxQkc7QUFFSCxPQUFPLEVBRUwsU0FBUyxFQUNULHNCQUFzQixFQUV0QixZQUFZLEVBQ1osS0FBSyxFQUdMLE1BQU0sRUFFTixTQUFTLEdBQ1YsTUFBTSxlQUFlLENBQUM7O0FBaUN2QixNQUFNLE9BQU8sb0JBQW9CO0lBRy9CLHdFQUF3RTtJQUMvRCxTQUFTLENBQVU7SUFDNUIscUVBQXFFO0lBQzVELE1BQU0sQ0FBVTtJQUN6QiwrREFBK0Q7SUFDdEQsSUFBSSxDQUFxQztJQUNsRCxrQ0FBa0M7SUFDekIsV0FBVyxDQUFVO0lBQzlCLGtDQUFrQztJQUN6QixZQUFZLENBQVU7SUFDL0Isa0NBQWtDO0lBQ3pCLFlBQVksQ0FBVTtJQUMvQix5REFBeUQ7SUFDaEQsSUFBSSxDQUEwQjtJQUV2QyxnRUFBZ0U7SUFDdEQsTUFBTSxHQUFHLElBQUksWUFBWSxFQUFxQyxDQUFDO0lBQ3pFLCtDQUErQztJQUNyQyxLQUFLLEdBQUcsSUFBSSxZQUFZLEVBQVEsQ0FBQztJQUczQyxLQUFLLENBQWtDO0lBRS9CLFFBQVEsR0FBRyxDQUFDLEtBQVksRUFBRSxFQUFFO1FBQ2xDLE1BQU0sTUFBTSxHQUFJLEtBQXdEO2FBQ3JFLE1BQ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VwiLCB0aGlzLm9uQ2xvc2UpO1xuICAgIGlmICh0aGlzLnVzZXIpIGVsLmlkZW50aWZ5Py4odGhpcy51c2VyKTtcbiAgfVxuXG4gIG5nT25DaGFuZ2VzKGNoYW5nZXM6IFNpbXBsZUNoYW5nZXMpOiB2b2lkIHtcbiAgICBpZiAoY2hhbmdlc1tcInVzZXJcIl0gJiYgdGhpcy5lbFJlZj8ubmF0aXZlRWxlbWVudCkge1xuICAgICAgdGhpcy5lbFJlZi5uYXRpdmVFbGVtZW50LmlkZW50aWZ5Py4odGhpcy51c2VyID8/IG51bGwpO1xuICAgIH1cbiAgfVxuXG4gIG5nT25EZXN0cm95KCk6IHZvaWQge1xuICAgIGNvbnN0IGVsID0gdGhpcy5lbFJlZj8ubmF0aXZlRWxlbWVudDtcbiAgICBpZiAoIWVsKSByZXR1cm47XG4gICAgZWwucmVtb3ZlRXZlbnRMaXN0ZW5lcihcIndleGlvOnJlc2l6ZVwiLCB0aGlzLm9uUmVzaXplKTtcbiAgICBlbC5yZW1vdmVFdmVudExpc3RlbmVyKFwid2V4aW86Y2xvc2VcIiwgdGhpcy5vbkNsb3NlKTtcbiAgfVxufVxuIl19
@@ -0,0 +1,158 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, ViewChild, Output, Input, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
3
+
4
+ /**
5
+ * `@wexio/messenger-widget-angular` — Angular standalone component
6
+ * wrapping the `<wexio-widget>` custom element.
7
+ *
8
+ * Forwards `@Input()` properties to kebab-case attributes on the
9
+ * underlying custom element and re-emits its `wexio:resize` /
10
+ * `wexio:close` CustomEvents as Angular `@Output()` `EventEmitter`s.
11
+ *
12
+ * Importing this module side-effect registers `<wexio-widget>` as a
13
+ * custom element — no separate script tag needed.
14
+ *
15
+ * Standalone — drop into any Angular component's `imports`:
16
+ *
17
+ * import { WexioWidgetComponent } from "@wexio/messenger-widget-angular";
18
+ *
19
+ * @Component({
20
+ * standalone: true,
21
+ * imports: [WexioWidgetComponent],
22
+ * template: `<wexio-widget-ng [publicKey]="pk" (close)="onClose()" />`,
23
+ * })
24
+ * export class AppComponent { ... }
25
+ */
26
+ class WexioWidgetComponent {
27
+ /** Wexio integration public key (`pk_live_...`). Omit for demo mode. */
28
+ publicKey;
29
+ /** UI locale (BCP-47). Overrides the operator's `localeStrategy`. */
30
+ locale;
31
+ /** Force widget mode. Public consumers should not set this. */
32
+ mode;
33
+ /** Unverified prechat prefill. */
34
+ prefillName;
35
+ /** Unverified prechat prefill. */
36
+ prefillEmail;
37
+ /** Unverified prechat prefill. */
38
+ prefillPhone;
39
+ /** Known-user identity proof. Pass `null` to log out. */
40
+ user;
41
+ /** Fires every time panel dimensions change (open ↔ closed). */
42
+ resize = new EventEmitter();
43
+ /** Fires when the visitor closes the panel. */
44
+ close = new EventEmitter();
45
+ elRef;
46
+ onResize = (event) => {
47
+ const detail = event
48
+ .detail;
49
+ if (detail)
50
+ this.resize.emit(detail);
51
+ };
52
+ onClose = () => this.close.emit();
53
+ ngAfterViewInit() {
54
+ const el = this.elRef?.nativeElement;
55
+ if (!el)
56
+ return;
57
+ // Runtime-inject the widget runtime once. We can't `import` it at
58
+ // build time (ng-packagr's strict TS rejects bare-JS imports), so
59
+ // we inject a `<script type="module">` here on first mount. The
60
+ // browser caches the module after first load, so subsequent
61
+ // component instances skip the network request entirely. Custom
62
+ // element upgrades retroactively — the `<wexio-widget>` element
63
+ // we already rendered will "upgrade" once the script registers
64
+ // its class, with no re-render flicker.
65
+ if (typeof document !== "undefined" &&
66
+ typeof customElements !== "undefined" &&
67
+ !customElements.get("wexio-widget") &&
68
+ !document.querySelector("script[data-wexio-widget-runtime]")) {
69
+ const script = document.createElement("script");
70
+ script.type = "module";
71
+ script.src = "https://cdn.wexio.io/widget/widget.js";
72
+ script.setAttribute("data-wexio-widget-runtime", "");
73
+ script.async = true;
74
+ document.head.appendChild(script);
75
+ }
76
+ el.addEventListener("wexio:resize", this.onResize);
77
+ el.addEventListener("wexio:close", this.onClose);
78
+ if (this.user)
79
+ el.identify?.(this.user);
80
+ }
81
+ ngOnChanges(changes) {
82
+ if (changes["user"] && this.elRef?.nativeElement) {
83
+ this.elRef.nativeElement.identify?.(this.user ?? null);
84
+ }
85
+ }
86
+ ngOnDestroy() {
87
+ const el = this.elRef?.nativeElement;
88
+ if (!el)
89
+ return;
90
+ el.removeEventListener("wexio:resize", this.onResize);
91
+ el.removeEventListener("wexio:close", this.onClose);
92
+ }
93
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WexioWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
94
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: WexioWidgetComponent, isStandalone: true, selector: "wexio-widget-ng", inputs: { publicKey: "publicKey", locale: "locale", mode: "mode", prefillName: "prefillName", prefillEmail: "prefillEmail", prefillPhone: "prefillPhone", user: "user" }, outputs: { resize: "resize", close: "close" }, viewQueries: [{ propertyName: "elRef", first: true, predicate: ["el"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `<wexio-widget
95
+ #el
96
+ [attr.public-key]="publicKey ?? null"
97
+ [attr.locale]="locale ?? null"
98
+ [attr.mode]="mode ?? null"
99
+ [attr.prefill-name]="prefillName ?? null"
100
+ [attr.prefill-email]="prefillEmail ?? null"
101
+ [attr.prefill-phone]="prefillPhone ?? null"
102
+ ></wexio-widget>`, isInline: true });
103
+ }
104
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WexioWidgetComponent, decorators: [{
105
+ type: Component,
106
+ args: [{
107
+ standalone: true,
108
+ selector: "wexio-widget-ng",
109
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
110
+ template: `<wexio-widget
111
+ #el
112
+ [attr.public-key]="publicKey ?? null"
113
+ [attr.locale]="locale ?? null"
114
+ [attr.mode]="mode ?? null"
115
+ [attr.prefill-name]="prefillName ?? null"
116
+ [attr.prefill-email]="prefillEmail ?? null"
117
+ [attr.prefill-phone]="prefillPhone ?? null"
118
+ ></wexio-widget>`,
119
+ }]
120
+ }], propDecorators: { publicKey: [{
121
+ type: Input
122
+ }], locale: [{
123
+ type: Input
124
+ }], mode: [{
125
+ type: Input
126
+ }], prefillName: [{
127
+ type: Input
128
+ }], prefillEmail: [{
129
+ type: Input
130
+ }], prefillPhone: [{
131
+ type: Input
132
+ }], user: [{
133
+ type: Input
134
+ }], resize: [{
135
+ type: Output
136
+ }], close: [{
137
+ type: Output
138
+ }], elRef: [{
139
+ type: ViewChild,
140
+ args: ["el", { static: true }]
141
+ }] } });
142
+
143
+ /**
144
+ * Public surface of `@wexio/messenger-widget-angular`. ng-packagr uses
145
+ * this file as the package entry point (see `ng-package.json`).
146
+ *
147
+ * The widget runtime (`widget.js`) is shipped alongside the compiled
148
+ * Angular library and is copied into `dist/` via `ng-package.json`'s
149
+ * `assets` block. Consumers don't import `widget.js` directly — the
150
+ * Angular component registers + uses the custom element at boot.
151
+ */
152
+
153
+ /**
154
+ * Generated bundle index. Do not edit.
155
+ */
156
+
157
+ export { WexioWidgetComponent };
158
+ //# sourceMappingURL=wexio-messenger-widget-angular.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wexio-messenger-widget-angular.mjs","sources":["../../src/wexio-widget.component.ts","../../src/public-api.ts","../../src/wexio-messenger-widget-angular.ts"],"sourcesContent":["/**\n * `@wexio/messenger-widget-angular` — Angular standalone component\n * wrapping the `<wexio-widget>` custom element.\n *\n * Forwards `@Input()` properties to kebab-case attributes on the\n * underlying custom element and re-emits its `wexio:resize` /\n * `wexio:close` CustomEvents as Angular `@Output()` `EventEmitter`s.\n *\n * Importing this module side-effect registers `<wexio-widget>` as a\n * custom element — no separate script tag needed.\n *\n * Standalone — drop into any Angular component's `imports`:\n *\n * import { WexioWidgetComponent } from \"@wexio/messenger-widget-angular\";\n *\n * @Component({\n * standalone: true,\n * imports: [WexioWidgetComponent],\n * template: `<wexio-widget-ng [publicKey]=\"pk\" (close)=\"onClose()\" />`,\n * })\n * export class AppComponent { ... }\n */\n\nimport {\n AfterViewInit,\n Component,\n CUSTOM_ELEMENTS_SCHEMA,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n Output,\n SimpleChanges,\n ViewChild,\n} from \"@angular/core\";\n\n/** Known-user identity proof. Provide ONE of `googleIdToken`, `jwt`,\n * or the legacy `userId` + `userHash` pair. */\nexport interface VisitorIdentity {\n googleIdToken?: string;\n jwt?: string;\n userId?: string;\n userHash?: string;\n name?: string;\n email?: string;\n phone?: string;\n attributes?: Record<string, unknown>;\n}\n\ninterface WexioWidgetElement extends HTMLElement {\n identify(user: VisitorIdentity | null): void;\n}\n\n@Component({\n standalone: true,\n selector: \"wexio-widget-ng\",\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `<wexio-widget\n #el\n [attr.public-key]=\"publicKey ?? null\"\n [attr.locale]=\"locale ?? null\"\n [attr.mode]=\"mode ?? null\"\n [attr.prefill-name]=\"prefillName ?? null\"\n [attr.prefill-email]=\"prefillEmail ?? null\"\n [attr.prefill-phone]=\"prefillPhone ?? null\"\n ></wexio-widget>`,\n})\nexport class WexioWidgetComponent\n implements AfterViewInit, OnChanges, OnDestroy\n{\n /** Wexio integration public key (`pk_live_...`). Omit for demo mode. */\n @Input() publicKey?: string;\n /** UI locale (BCP-47). Overrides the operator's `localeStrategy`. */\n @Input() locale?: string;\n /** Force widget mode. Public consumers should not set this. */\n @Input() mode?: \"production\" | \"preview\" | \"demo\";\n /** Unverified prechat prefill. */\n @Input() prefillName?: string;\n /** Unverified prechat prefill. */\n @Input() prefillEmail?: string;\n /** Unverified prechat prefill. */\n @Input() prefillPhone?: string;\n /** Known-user identity proof. Pass `null` to log out. */\n @Input() user?: VisitorIdentity | null;\n\n /** Fires every time panel dimensions change (open ↔ closed). */\n @Output() resize = new EventEmitter<{ width: number; height: number }>();\n /** Fires when the visitor closes the panel. */\n @Output() close = new EventEmitter<void>();\n\n @ViewChild(\"el\", { static: true })\n elRef!: ElementRef<WexioWidgetElement>;\n\n private onResize = (event: Event) => {\n const detail = (event as CustomEvent<{ width: number; height: number }>)\n .detail;\n if (detail) this.resize.emit(detail);\n };\n\n private onClose = () => this.close.emit();\n\n ngAfterViewInit(): void {\n const el = this.elRef?.nativeElement;\n if (!el) return;\n // Runtime-inject the widget runtime once. We can't `import` it at\n // build time (ng-packagr's strict TS rejects bare-JS imports), so\n // we inject a `<script type=\"module\">` here on first mount. The\n // browser caches the module after first load, so subsequent\n // component instances skip the network request entirely. Custom\n // element upgrades retroactively — the `<wexio-widget>` element\n // we already rendered will \"upgrade\" once the script registers\n // its class, with no re-render flicker.\n if (\n typeof document !== \"undefined\" &&\n typeof customElements !== \"undefined\" &&\n !customElements.get(\"wexio-widget\") &&\n !document.querySelector(\"script[data-wexio-widget-runtime]\")\n ) {\n const script = document.createElement(\"script\");\n script.type = \"module\";\n script.src = \"https://cdn.wexio.io/widget/widget.js\";\n script.setAttribute(\"data-wexio-widget-runtime\", \"\");\n script.async = true;\n document.head.appendChild(script);\n }\n el.addEventListener(\"wexio:resize\", this.onResize);\n el.addEventListener(\"wexio:close\", this.onClose);\n if (this.user) el.identify?.(this.user);\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes[\"user\"] && this.elRef?.nativeElement) {\n this.elRef.nativeElement.identify?.(this.user ?? null);\n }\n }\n\n ngOnDestroy(): void {\n const el = this.elRef?.nativeElement;\n if (!el) return;\n el.removeEventListener(\"wexio:resize\", this.onResize);\n el.removeEventListener(\"wexio:close\", this.onClose);\n }\n}\n","/**\n * Public surface of `@wexio/messenger-widget-angular`. ng-packagr uses\n * this file as the package entry point (see `ng-package.json`).\n *\n * The widget runtime (`widget.js`) is shipped alongside the compiled\n * Angular library and is copied into `dist/` via `ng-package.json`'s\n * `assets` block. Consumers don't import `widget.js` directly — the\n * Angular component registers + uses the custom element at boot.\n */\n\nexport { WexioWidgetComponent } from \"./wexio-widget.component\";\nexport type { VisitorIdentity } from \"./wexio-widget.component\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBG;MA+CU,oBAAoB,CAAA;;AAItB,IAAA,SAAS;;AAET,IAAA,MAAM;;AAEN,IAAA,IAAI;;AAEJ,IAAA,WAAW;;AAEX,IAAA,YAAY;;AAEZ,IAAA,YAAY;;AAEZ,IAAA,IAAI;;AAGH,IAAA,MAAM,GAAG,IAAI,YAAY,EAAqC;;AAE9D,IAAA,KAAK,GAAG,IAAI,YAAY,EAAQ;AAG1C,IAAA,KAAK;AAEG,IAAA,QAAQ,GAAG,CAAC,KAAY,KAAI;QAClC,MAAM,MAAM,GAAI;AACb,aAAA,MAAM;AACT,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;AACtC,IAAA,CAAC;IAEO,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;IAEzC,eAAe,GAAA;AACb,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,aAAa;AACpC,QAAA,IAAI,CAAC,EAAE;YAAE;;;;;;;;;QAST,IACE,OAAO,QAAQ,KAAK,WAAW;YAC/B,OAAO,cAAc,KAAK,WAAW;AACrC,YAAA,CAAC,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC;AACnC,YAAA,CAAC,QAAQ,CAAC,aAAa,CAAC,mCAAmC,CAAC,EAC5D;YACA,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC;AAC/C,YAAA,MAAM,CAAC,IAAI,GAAG,QAAQ;AACtB,YAAA,MAAM,CAAC,GAAG,GAAG,uCAAuC;AACpD,YAAA,MAAM,CAAC,YAAY,CAAC,2BAA2B,EAAE,EAAE,CAAC;AACpD,YAAA,M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itter,
5
- OnChanges,
6
- OnDestroy,
7
- SimpleChanges,
8
- } from "@angular/core";
9
-
10
- /** Known-user identity proof. Provide ONE of `googleIdToken`, `jwt`,
11
- * or the legacy `userId` + `userHash` pair. */
12
- export interface VisitorIdentity {
13
- googleIdToken?: string;
14
- jwt?: string;
15
- userId?: string;
16
- userHash?: string;
17
- name?: string;
18
- email?: string;
19
- phone?: string;
20
- attributes?: Record<string, unknown>;
21
- }
22
-
23
1
  /**
24
- * Standalone Angular component wrapping the `<wexio-widget>` web
25
- * component. Drop into any component's `imports`:
26
- *
27
- * @Component({
28
- * standalone: true,
29
- * imports: [WexioWidgetComponent],
30
- * template: `<wexio-widget-ng [publicKey]="pk" (close)="onClose()" />`,
31
- * })
32
- * export class AppComponent { ... }
2
+ * Generated bundle index. Do not edit.
33
3
  */
34
- export declare class WexioWidgetComponent
35
- implements AfterViewInit, OnChanges, OnDestroy
36
- {
37
- /** Wexio integration public key (`pk_live_...`). Omit for demo mode. */
38
- publicKey?: string;
39
- /** UI locale (BCP-47). Overrides the operator's `localeStrategy`. */
40
- locale?: string;
41
- /** Force widget mode. Public consumers should not set this. */
42
- mode?: "production" | "preview" | "demo";
43
- /** Unverified prechat prefill. */
44
- prefillName?: string;
45
- /** Unverified prechat prefill. */
46
- prefillEmail?: string;
47
- /** Unverified prechat prefill. */
48
- prefillPhone?: string;
49
- /** Known-user identity proof. Pass `null` to log out. */
50
- user?: VisitorIdentity | null;
51
-
52
- /** Fires every time panel dimensions change (open ↔ closed). */
53
- resize: EventEmitter<{ width: number; height: number }>;
54
- /** Fires when the visitor closes the panel. */
55
- close: EventEmitter<void>;
56
-
57
- elRef: ElementRef<HTMLElement>;
58
-
59
- ngAfterViewInit(): void;
60
- ngOnChanges(changes: SimpleChanges): void;
61
- ngOnDestroy(): void;
62
- }
4
+ /// <amd-module name="@wexio/messenger-widget-angular" />
5
+ export * from './public-api';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Public surface of `@wexio/messenger-widget-angular`. ng-packagr uses
3
+ * this file as the package entry point (see `ng-package.json`).
4
+ *
5
+ * The widget runtime (`widget.js`) is shipped alongside the compiled
6
+ * Angular library and is copied into `dist/` via `ng-package.json`'s
7
+ * `assets` block. Consumers don't import `widget.js` directly — the
8
+ * Angular component registers + uses the custom element at boot.
9
+ */
10
+ export { WexioWidgetComponent } from "./wexio-widget.component";
11
+ export type { VisitorIdentity } from "./wexio-widget.component";