@wexio/messenger-widget-angular 1.0.23 → 1.0.24

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.
@@ -0,0 +1,71 @@
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 { AfterViewInit, ElementRef, EventEmitter, OnChanges, OnDestroy, SimpleChanges } from "@angular/core";
24
+ import * as i0 from "@angular/core";
25
+ /** Known-user identity proof. Provide ONE of `googleIdToken`, `jwt`,
26
+ * or the legacy `userId` + `userHash` pair. */
27
+ export interface VisitorIdentity {
28
+ googleIdToken?: string;
29
+ jwt?: string;
30
+ userId?: string;
31
+ userHash?: string;
32
+ name?: string;
33
+ email?: string;
34
+ phone?: string;
35
+ attributes?: Record<string, unknown>;
36
+ }
37
+ interface WexioWidgetElement extends HTMLElement {
38
+ identify(user: VisitorIdentity | null): void;
39
+ }
40
+ export declare class WexioWidgetComponent implements AfterViewInit, OnChanges, OnDestroy {
41
+ /** Wexio integration public key (`pk_live_...`). Omit for demo mode. */
42
+ publicKey?: string;
43
+ /** UI locale (BCP-47). Overrides the operator's `localeStrategy`. */
44
+ locale?: string;
45
+ /** Force widget mode. Public consumers should not set this. */
46
+ mode?: "production" | "preview" | "demo";
47
+ /** Unverified prechat prefill. */
48
+ prefillName?: string;
49
+ /** Unverified prechat prefill. */
50
+ prefillEmail?: string;
51
+ /** Unverified prechat prefill. */
52
+ prefillPhone?: string;
53
+ /** Known-user identity proof. Pass `null` to log out. */
54
+ user?: VisitorIdentity | null;
55
+ /** Fires every time panel dimensions change (open ↔ closed). */
56
+ resize: EventEmitter<{
57
+ width: number;
58
+ height: number;
59
+ }>;
60
+ /** Fires when the visitor closes the panel. */
61
+ close: EventEmitter<void>;
62
+ elRef: ElementRef<WexioWidgetElement>;
63
+ private onResize;
64
+ private onClose;
65
+ ngAfterViewInit(): void;
66
+ ngOnChanges(changes: SimpleChanges): void;
67
+ ngOnDestroy(): void;
68
+ static ɵfac: i0.ɵɵFactoryDeclaration<WexioWidgetComponent, never>;
69
+ static ɵcmp: i0.ɵɵComponentDeclaration<WexioWidgetComponent, "wexio-widget-ng", never, { "publicKey": { "alias": "publicKey"; "required": false; }; "locale": { "alias": "locale"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "prefillName": { "alias": "prefillName"; "required": false; }; "prefillEmail": { "alias": "prefillEmail"; "required": false; }; "prefillPhone": { "alias": "prefillPhone"; "required": false; }; "user": { "alias": "user"; "required": false; }; }, { "resize": "resize"; "close": "close"; }, never, never, true, never>;
70
+ }
71
+ export {};
package/package.json CHANGED
@@ -1,22 +1,27 @@
1
1
  {
2
2
  "name": "@wexio/messenger-widget-angular",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "Angular standalone component embed for the Wexio web messenger. Thin wrapper around the <wexio-widget> custom element — same WidgetShell runtime, same Shadow-DOM isolation.",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "type": "module",
8
- "main": "./dist/index.js",
9
- "module": "./dist/index.js",
8
+ "main": "./dist/fesm2022/wexio-messenger-widget-angular.mjs",
9
+ "module": "./dist/fesm2022/wexio-messenger-widget-angular.mjs",
10
10
  "types": "./dist/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
13
  "types": "./dist/index.d.ts",
14
- "import": "./dist/index.js",
15
- "default": "./dist/index.js"
14
+ "default": "./dist/fesm2022/wexio-messenger-widget-angular.mjs"
15
+ },
16
+ "./package.json": {
17
+ "default": "./package.json"
16
18
  }
17
19
  },
18
20
  "files": [
19
- "dist",
21
+ "dist/fesm2022",
22
+ "dist/esm2022",
23
+ "dist/*.d.ts",
24
+ "dist/*.d.mts",
20
25
  "README.md",
21
26
  "LICENSE"
22
27
  ],
@@ -27,6 +32,16 @@
27
32
  "@angular/common": ">=16.0.0",
28
33
  "@angular/core": ">=16.0.0"
29
34
  },
35
+ "devDependencies": {
36
+ "@angular/common": "^18.0.0",
37
+ "@angular/compiler": "^18.0.0",
38
+ "@angular/compiler-cli": "^18.0.0",
39
+ "@angular/core": "^18.0.0",
40
+ "ng-packagr": "^18.0.0",
41
+ "rxjs": "^7.8.0",
42
+ "typescript": "~5.4.0",
43
+ "zone.js": "~0.14.0"
44
+ },
30
45
  "repository": {
31
46
  "type": "git",
32
47
  "url": "https://github.com/wexiohub/messenger-widget-angular.git"
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- export { WexioWidgetComponent } from "./wexio-widget.component";
@@ -1,119 +0,0 @@
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
- var _a;
24
- import { __decorate, __metadata } from "tslib";
25
- import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, EventEmitter, Input, Output, ViewChild, } from "@angular/core";
26
- import "./widget.js";
27
- let WexioWidgetComponent = class WexioWidgetComponent {
28
- constructor() {
29
- /** Fires every time panel dimensions change (open ↔ closed). */
30
- this.resize = new EventEmitter();
31
- /** Fires when the visitor closes the panel. */
32
- this.close = new EventEmitter();
33
- this.onResize = (event) => {
34
- const detail = event
35
- .detail;
36
- if (detail)
37
- this.resize.emit(detail);
38
- };
39
- this.onClose = () => this.close.emit();
40
- }
41
- ngAfterViewInit() {
42
- const el = this.elRef?.nativeElement;
43
- if (!el)
44
- return;
45
- el.addEventListener("wexio:resize", this.onResize);
46
- el.addEventListener("wexio:close", this.onClose);
47
- if (this.user)
48
- el.identify?.(this.user);
49
- }
50
- ngOnChanges(changes) {
51
- if (changes["user"] && this.elRef?.nativeElement) {
52
- this.elRef.nativeElement.identify?.(this.user ?? null);
53
- }
54
- }
55
- ngOnDestroy() {
56
- const el = this.elRef?.nativeElement;
57
- if (!el)
58
- return;
59
- el.removeEventListener("wexio:resize", this.onResize);
60
- el.removeEventListener("wexio:close", this.onClose);
61
- }
62
- };
63
- __decorate([
64
- Input(),
65
- __metadata("design:type", String)
66
- ], WexioWidgetComponent.prototype, "publicKey", void 0);
67
- __decorate([
68
- Input(),
69
- __metadata("design:type", String)
70
- ], WexioWidgetComponent.prototype, "locale", void 0);
71
- __decorate([
72
- Input(),
73
- __metadata("design:type", String)
74
- ], WexioWidgetComponent.prototype, "mode", void 0);
75
- __decorate([
76
- Input(),
77
- __metadata("design:type", String)
78
- ], WexioWidgetComponent.prototype, "prefillName", void 0);
79
- __decorate([
80
- Input(),
81
- __metadata("design:type", String)
82
- ], WexioWidgetComponent.prototype, "prefillEmail", void 0);
83
- __decorate([
84
- Input(),
85
- __metadata("design:type", String)
86
- ], WexioWidgetComponent.prototype, "prefillPhone", void 0);
87
- __decorate([
88
- Input(),
89
- __metadata("design:type", Object)
90
- ], WexioWidgetComponent.prototype, "user", void 0);
91
- __decorate([
92
- Output(),
93
- __metadata("design:type", Object)
94
- ], WexioWidgetComponent.prototype, "resize", void 0);
95
- __decorate([
96
- Output(),
97
- __metadata("design:type", Object)
98
- ], WexioWidgetComponent.prototype, "close", void 0);
99
- __decorate([
100
- ViewChild("el", { static: true }),
101
- __metadata("design:type", typeof (_a = typeof ElementRef !== "undefined" && ElementRef) === "function" ? _a : Object)
102
- ], WexioWidgetComponent.prototype, "elRef", void 0);
103
- WexioWidgetComponent = __decorate([
104
- Component({
105
- standalone: true,
106
- selector: "wexio-widget-ng",
107
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
108
- template: `<wexio-widget
109
- #el
110
- [attr.public-key]="publicKey ?? null"
111
- [attr.locale]="locale ?? null"
112
- [attr.mode]="mode ?? null"
113
- [attr.prefill-name]="prefillName ?? null"
114
- [attr.prefill-email]="prefillEmail ?? null"
115
- [attr.prefill-phone]="prefillPhone ?? null"
116
- ></wexio-widget>`,
117
- })
118
- ], WexioWidgetComponent);
119
- export { WexioWidgetComponent };