@delicious-ai/bidlens-angular 0.1.1-beta.446 → 0.1.1-beta.741
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/README.md +121 -22
- package/bidlens-widget.component.d.ts +57 -0
- package/bidlens-widget.module.d.ts +8 -0
- package/fesm2022/delicious-ai-bidlens-angular.mjs +119 -40
- package/index.d.ts +3 -43
- package/package.json +4 -4
- package/public-api.d.ts +3 -0
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# @delicious-ai/bidlens-angular
|
|
2
2
|
|
|
3
3
|
Angular wrapper for the [`<bidlens-widget>`](https://www.npmjs.com/package/@delicious-ai/bidlens-widget)
|
|
4
|
-
custom element: typed inputs
|
|
5
|
-
Works with Angular
|
|
4
|
+
custom element (the live voice quote agent): typed inputs, and no `CUSTOM_ELEMENTS_SCHEMA`.
|
|
5
|
+
Works with Angular 19 and later, standalone or NgModule. It's browser-only:
|
|
6
6
|
importing it registers a custom element, so it won't load under server-side
|
|
7
7
|
rendering.
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
import { BidlensWidgetComponent
|
|
10
|
+
import { BidlensWidgetComponent } from "@delicious-ai/bidlens-angular";
|
|
11
11
|
|
|
12
12
|
@Component({
|
|
13
13
|
imports: [BidlensWidgetComponent],
|
|
@@ -16,39 +16,138 @@ import { BidlensWidgetComponent, type CompleteEventDetail } from "@delicious-ai/
|
|
|
16
16
|
[widgetKey]="widgetKey"
|
|
17
17
|
apiBaseUrl="https://api.example.com"
|
|
18
18
|
theme="light"
|
|
19
|
-
(photo)="onPhoto($event)"
|
|
20
|
-
(complete)="onComplete($event)"
|
|
21
19
|
style="height: 100%"
|
|
22
20
|
/>
|
|
23
21
|
`,
|
|
24
22
|
})
|
|
23
|
+
export class QuotePage {}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
NgModule apps import `BidlensWidgetModule` instead.
|
|
27
|
+
|
|
28
|
+
## Inputs
|
|
29
|
+
|
|
30
|
+
| Input | Notes |
|
|
31
|
+
| -------------------------- | ----------------------------------------------------------- |
|
|
32
|
+
| `widgetKey` | Public widget key. |
|
|
33
|
+
| `sessionToken` | Your own signed token (see below); updates the live widget. |
|
|
34
|
+
| `apiBaseUrl` | BidLens backend URL. Required. |
|
|
35
|
+
| `theme` | `"light"` or `"dark"`; updates the live widget. |
|
|
36
|
+
| `colors` | Optional `WidgetColors`: your colors; updates the live widget. |
|
|
37
|
+
| `fontFamily` | Optional CSS font-family; updates the live widget. |
|
|
38
|
+
| `fontUrl` | Google Fonts / Bunny Fonts stylesheet loading `fontFamily`. |
|
|
39
|
+
| `buttonRadius` | Optional CSS border-radius for buttons; replaces our pills. |
|
|
40
|
+
| `initialData` | Optional `IntakeInput`: what you already know (see below). |
|
|
41
|
+
| `shouldConfirmInitialData` | Read `initialData` back for a yes. Defaults to `false`. |
|
|
42
|
+
| `partnerContext` | Optional `PartnerContext` for your partner integration (see below). |
|
|
43
|
+
|
|
44
|
+
The element reads `widgetKey` and `apiBaseUrl` only when it's created, so
|
|
45
|
+
changing either replaces it with a new widget (and a new session).
|
|
46
|
+
|
|
47
|
+
## Outputs
|
|
48
|
+
|
|
49
|
+
| Output | Notes |
|
|
50
|
+
| -------------- | -------------------------------------------------------------------------------------------- |
|
|
51
|
+
| `dataUpdated` | `IntakeRecord`: the call's whole record, each time it changes. |
|
|
52
|
+
| `complete` | `IntakeRecord`: once, when the homeowner sends their request. |
|
|
53
|
+
| `photoAdded` | `PhotoAddedDetail` (`{ photoId, file }`): right after the `dataUpdated` that first holds it. |
|
|
54
|
+
| `authRequired` | `AuthRequiredDetail`: `sessionToken` was rejected or is about to expire. |
|
|
55
|
+
|
|
56
|
+
Outputs are emitted inside Angular's zone, so handlers need no `NgZone.run`.
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
@Component({
|
|
60
|
+
imports: [BidlensWidgetComponent],
|
|
61
|
+
template: `
|
|
62
|
+
<bidlens-widget-ng
|
|
63
|
+
[widgetKey]="widgetKey"
|
|
64
|
+
apiBaseUrl="https://api.example.com"
|
|
65
|
+
(photoAdded)="photos.set($event.photoId, $event.file)"
|
|
66
|
+
(complete)="save($event)"
|
|
67
|
+
/>
|
|
68
|
+
`,
|
|
69
|
+
})
|
|
25
70
|
export class QuotePage {
|
|
26
|
-
|
|
27
|
-
|
|
71
|
+
readonly photos = new Map<string, File>();
|
|
72
|
+
|
|
73
|
+
save(record: IntakeRecord) {
|
|
74
|
+
// record.contact, record.concerns, ... plus this.photos
|
|
28
75
|
}
|
|
29
76
|
}
|
|
30
77
|
```
|
|
31
78
|
|
|
32
|
-
|
|
79
|
+
## Initial data
|
|
33
80
|
|
|
34
|
-
|
|
81
|
+
Pass what you already know about the homeowner as `initialData`: any part of an
|
|
82
|
+
`IntakeRecord`, typed as `IntakeInput`. It's sent when they start the call, which
|
|
83
|
+
then asks only for what's missing, so it can change any time before then.
|
|
35
84
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
85
|
+
```ts
|
|
86
|
+
readonly initialData: IntakeInput = {
|
|
87
|
+
contact: { name: "Dana Smith", phone: "8015550134", confirmed: true },
|
|
88
|
+
houseDetails: { yearBuilt: 1994 },
|
|
89
|
+
};
|
|
90
|
+
```
|
|
42
91
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
92
|
+
```html
|
|
93
|
+
<bidlens-widget-ng [widgetKey]="widgetKey" [initialData]="initialData" … />
|
|
94
|
+
```
|
|
46
95
|
|
|
47
|
-
|
|
96
|
+
By default the call skips every step `initialData` fills in full and opens on the
|
|
97
|
+
first one it doesn't. Set `[shouldConfirmInitialData]="true"` to have each step read back to the
|
|
98
|
+
homeowner for a yes instead. Skipping needs your own `sessionToken`; without one,
|
|
99
|
+
everything you send is read back.
|
|
100
|
+
|
|
101
|
+
## Partner context
|
|
102
|
+
|
|
103
|
+
If your account sends requests on to your own system (a partner integration, such as
|
|
104
|
+
Enzy), pass what that integration needs to know about the call as `partnerContext`: a
|
|
105
|
+
plain object, typed as `PartnerContext`, whose keys depend on your integration.
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<bidlens-widget-ng [sessionToken]="token" [partnerContext]="{ proposalId: proposalId }" … />
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
It's sent when the homeowner starts the call, and only counts with your own
|
|
112
|
+
`sessionToken`. The backend drops the whole object if anything in it doesn't fit what
|
|
113
|
+
your integration takes. It's kept apart from the intake record, so `dataUpdated` and
|
|
114
|
+
`complete` never hand it back.
|
|
48
115
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
116
|
+
## Session tokens
|
|
117
|
+
|
|
118
|
+
In a native app, pass a signed JWT token as `sessionToken`.
|
|
119
|
+
The widget sends it, as an `X-Session-Token` header, each time it asks for a BidLens session
|
|
120
|
+
(a 30-minute session, renewed while the call goes on) and when it loads your
|
|
121
|
+
widget's config.
|
|
122
|
+
|
|
123
|
+
The token must have an `exp` no more than an hour away (with a few minutes'
|
|
124
|
+
leeway for clock skew); one without, or that expires later, is rejected. When
|
|
125
|
+
it's turned down (`reason` is `"expired"`, or `"rejected"` for anything else
|
|
126
|
+
wrong with it), or within a minute of its `exp` (`"expiring"`), `authRequired`
|
|
127
|
+
fires. Pass a fresh `sessionToken` and the call goes on where it was; a request
|
|
128
|
+
the old token held up waits 30 seconds for it. Errors a new token can't fix,
|
|
129
|
+
such as a bad `widgetKey`, fail at once without the event.
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
@Component({
|
|
133
|
+
imports: [BidlensWidgetComponent],
|
|
134
|
+
template: `
|
|
135
|
+
<bidlens-widget-ng
|
|
136
|
+
[widgetKey]="widgetKey"
|
|
137
|
+
[sessionToken]="sessionToken()"
|
|
138
|
+
apiBaseUrl="https://api.example.com"
|
|
139
|
+
(authRequired)="refreshToken()"
|
|
140
|
+
/>
|
|
141
|
+
`,
|
|
142
|
+
})
|
|
143
|
+
export class QuotePage {
|
|
144
|
+
readonly sessionToken = signal<string | null>(null);
|
|
145
|
+
|
|
146
|
+
async refreshToken() {
|
|
147
|
+
this.sessionToken.set(await myIdp.getFreshToken());
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
52
151
|
|
|
53
152
|
`element` gives you the underlying `<bidlens-widget>` if you need it.
|
|
54
153
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type InputSignal, type OutputEmitterRef } from "@angular/core";
|
|
2
|
+
import type { AuthRequiredDetail, BidlensWidgetElement, IntakeInput, IntakeRecord, PartnerContext, PhotoAddedDetail, WidgetColors, WidgetTheme } from "@delicious-ai/bidlens-widget";
|
|
3
|
+
import "@delicious-ai/bidlens-widget";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Angular wrapper for <bidlens-widget>, the live (voice) quote agent. Renders
|
|
7
|
+
* the custom element inside itself:
|
|
8
|
+
*
|
|
9
|
+
* ```html
|
|
10
|
+
* <bidlens-widget-ng [widgetKey]="key" [apiBaseUrl]="apiUrl" theme="light" />
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* The element reads `widget-key` and `api-base-url` only once, when it is
|
|
14
|
+
* connected, so a change to either input replaces the element (starting a
|
|
15
|
+
* fresh session). `sessionToken`, `theme`, `colors`, `fontFamily`, `fontUrl`, `buttonRadius`, `initialData`, `shouldConfirmInitialData` and `partnerContext` update the live
|
|
16
|
+
* element; set a fresh `sessionToken` on `(authRequired)` to keep the call going.
|
|
17
|
+
*
|
|
18
|
+
* Each of the element's events is an output carrying its `detail`, emitted
|
|
19
|
+
* inside Angular's zone.
|
|
20
|
+
*/
|
|
21
|
+
export declare class BidlensWidgetComponent {
|
|
22
|
+
#private;
|
|
23
|
+
readonly widgetKey: InputSignal<string | null>;
|
|
24
|
+
readonly sessionToken: InputSignal<string | null>;
|
|
25
|
+
readonly apiBaseUrl: InputSignal<string | null>;
|
|
26
|
+
readonly theme: InputSignal<WidgetTheme | null>;
|
|
27
|
+
/** Your colors in place of the widget's; any left out keep its own. */
|
|
28
|
+
readonly colors: InputSignal<WidgetColors | null>;
|
|
29
|
+
/** A CSS font-family in place of the widget's; give `fontUrl` unless your page loads it. */
|
|
30
|
+
readonly fontFamily: InputSignal<string | null>;
|
|
31
|
+
/** A Google Fonts or Bunny Fonts stylesheet (https) that loads `fontFamily`. */
|
|
32
|
+
readonly fontUrl: InputSignal<string | null>;
|
|
33
|
+
/** A CSS border-radius for the buttons with a label, in place of the widget's pills. */
|
|
34
|
+
readonly buttonRadius: InputSignal<string | null>;
|
|
35
|
+
/** What you already know (any part of an `IntakeRecord`), sent when the call starts. */
|
|
36
|
+
readonly initialData: InputSignal<IntakeInput | null>;
|
|
37
|
+
/** Read `initialData` back for a yes, step by step, instead of skipping what it fills. */
|
|
38
|
+
readonly shouldConfirmInitialData: InputSignal<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* What you tell your partner integration about the call, read when the
|
|
41
|
+
* homeowner starts it. Taken only with your own `sessionToken`.
|
|
42
|
+
*/
|
|
43
|
+
readonly partnerContext: InputSignal<PartnerContext | null>;
|
|
44
|
+
/** The call's whole intake record, each time it changes. */
|
|
45
|
+
readonly dataUpdated: OutputEmitterRef<IntakeRecord>;
|
|
46
|
+
/** Once, with the record, when the homeowner sends their request. */
|
|
47
|
+
readonly complete: OutputEmitterRef<IntakeRecord>;
|
|
48
|
+
/** A photo the homeowner took, right after the `dataUpdated` whose record first holds it. */
|
|
49
|
+
readonly photoAdded: OutputEmitterRef<PhotoAddedDetail>;
|
|
50
|
+
/** The `session-token` was rejected or is about to expire; pass a fresh one. */
|
|
51
|
+
readonly authRequired: OutputEmitterRef<AuthRequiredDetail>;
|
|
52
|
+
/** The <bidlens-widget> element currently rendered, if any. */
|
|
53
|
+
get element(): BidlensWidgetElement | null;
|
|
54
|
+
constructor();
|
|
55
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BidlensWidgetComponent, never>;
|
|
56
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BidlensWidgetComponent, "bidlens-widget-ng", never, { "widgetKey": { "alias": "widgetKey"; "required": false; "isSignal": true; }; "sessionToken": { "alias": "sessionToken"; "required": false; "isSignal": true; }; "apiBaseUrl": { "alias": "apiBaseUrl"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "colors": { "alias": "colors"; "required": false; "isSignal": true; }; "fontFamily": { "alias": "fontFamily"; "required": false; "isSignal": true; }; "fontUrl": { "alias": "fontUrl"; "required": false; "isSignal": true; }; "buttonRadius": { "alias": "buttonRadius"; "required": false; "isSignal": true; }; "initialData": { "alias": "initialData"; "required": false; "isSignal": true; }; "shouldConfirmInitialData": { "alias": "shouldConfirmInitialData"; "required": false; "isSignal": true; }; "partnerContext": { "alias": "partnerContext"; "required": false; "isSignal": true; }; }, { "dataUpdated": "dataUpdated"; "complete": "complete"; "photoAdded": "photoAdded"; "authRequired": "authRequired"; }, never, never, true, never>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./bidlens-widget.component";
|
|
3
|
+
/** For NgModule-based apps; standalone components import BidlensWidgetComponent directly. */
|
|
4
|
+
export declare class BidlensWidgetModule {
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BidlensWidgetModule, never>;
|
|
6
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<BidlensWidgetModule, never, [typeof i1.BidlensWidgetComponent], [typeof i1.BidlensWidgetComponent]>;
|
|
7
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<BidlensWidgetModule>;
|
|
8
|
+
}
|
|
@@ -1,32 +1,63 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, inject, ElementRef, effect, untracked, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
2
|
+
import { input, output, inject, ElementRef, NgZone, effect, untracked, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
3
3
|
import '@delicious-ai/bidlens-widget';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Angular wrapper for <bidlens-widget
|
|
7
|
-
*
|
|
6
|
+
* Angular wrapper for <bidlens-widget>, the live (voice) quote agent. Renders
|
|
7
|
+
* the custom element inside itself:
|
|
8
8
|
*
|
|
9
9
|
* ```html
|
|
10
|
-
* <bidlens-widget-ng [widgetKey]="key" [apiBaseUrl]="apiUrl" theme="light"
|
|
10
|
+
* <bidlens-widget-ng [widgetKey]="key" [apiBaseUrl]="apiUrl" theme="light" />
|
|
11
11
|
* ```
|
|
12
12
|
*
|
|
13
|
-
* The element reads `widget-key
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* The element reads `widget-key` and `api-base-url` only once, when it is
|
|
14
|
+
* connected, so a change to either input replaces the element (starting a
|
|
15
|
+
* fresh session). `sessionToken`, `theme`, `colors`, `fontFamily`, `fontUrl`, `buttonRadius`, `initialData`, `shouldConfirmInitialData` and `partnerContext` update the live
|
|
16
|
+
* element; set a fresh `sessionToken` on `(authRequired)` to keep the call going.
|
|
17
|
+
*
|
|
18
|
+
* Each of the element's events is an output carrying its `detail`, emitted
|
|
19
|
+
* inside Angular's zone.
|
|
16
20
|
*/
|
|
17
21
|
class BidlensWidgetComponent {
|
|
18
|
-
widgetKey = input(null
|
|
19
|
-
sessionToken = input(null
|
|
20
|
-
apiBaseUrl = input(null
|
|
21
|
-
theme = input(null
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
widgetKey = input(null);
|
|
23
|
+
sessionToken = input(null);
|
|
24
|
+
apiBaseUrl = input(null);
|
|
25
|
+
theme = input(null);
|
|
26
|
+
/** Your colors in place of the widget's; any left out keep its own. */
|
|
27
|
+
colors = input(null);
|
|
28
|
+
/** A CSS font-family in place of the widget's; give `fontUrl` unless your page loads it. */
|
|
29
|
+
fontFamily = input(null);
|
|
30
|
+
/** A Google Fonts or Bunny Fonts stylesheet (https) that loads `fontFamily`. */
|
|
31
|
+
fontUrl = input(null);
|
|
32
|
+
/** A CSS border-radius for the buttons with a label, in place of the widget's pills. */
|
|
33
|
+
buttonRadius = input(null);
|
|
34
|
+
/** What you already know (any part of an `IntakeRecord`), sent when the call starts. */
|
|
35
|
+
// Annotated so the published typings name `IntakeInput` / `IntakeRecord`
|
|
36
|
+
// instead of spelling out the types they alias.
|
|
37
|
+
initialData = input(null);
|
|
38
|
+
/** Read `initialData` back for a yes, step by step, instead of skipping what it fills. */
|
|
39
|
+
shouldConfirmInitialData = input(false);
|
|
40
|
+
/**
|
|
41
|
+
* What you tell your partner integration about the call, read when the
|
|
42
|
+
* homeowner starts it. Taken only with your own `sessionToken`.
|
|
43
|
+
*/
|
|
44
|
+
partnerContext = input(null);
|
|
45
|
+
/** The call's whole intake record, each time it changes. */
|
|
46
|
+
dataUpdated = output();
|
|
47
|
+
/** Once, with the record, when the homeowner sends their request. */
|
|
28
48
|
complete = output();
|
|
49
|
+
/** A photo the homeowner took, right after the `dataUpdated` whose record first holds it. */
|
|
50
|
+
photoAdded = output();
|
|
51
|
+
/** The `session-token` was rejected or is about to expire; pass a fresh one. */
|
|
52
|
+
authRequired = output();
|
|
53
|
+
#outputs = {
|
|
54
|
+
"bidlens:data-updated": this.dataUpdated,
|
|
55
|
+
"bidlens:complete": this.complete,
|
|
56
|
+
"bidlens:photo-added": this.photoAdded,
|
|
57
|
+
"bidlens:auth-required": this.authRequired,
|
|
58
|
+
};
|
|
29
59
|
#host = inject(ElementRef);
|
|
60
|
+
#zone = inject(NgZone);
|
|
30
61
|
#element = null;
|
|
31
62
|
/** The <bidlens-widget> element currently rendered, if any. */
|
|
32
63
|
get element() {
|
|
@@ -35,48 +66,96 @@ class BidlensWidgetComponent {
|
|
|
35
66
|
constructor() {
|
|
36
67
|
effect((onCleanup) => {
|
|
37
68
|
const widgetKey = this.widgetKey();
|
|
38
|
-
const sessionToken = this.sessionToken();
|
|
39
69
|
const apiBaseUrl = this.apiBaseUrl();
|
|
40
|
-
const element = untracked(() => this.#mount(widgetKey,
|
|
70
|
+
const element = untracked(() => this.#mount(widgetKey, apiBaseUrl));
|
|
71
|
+
// The widget's own callbacks (its socket, its camera) can run outside
|
|
72
|
+
// Angular's zone, so emit inside it.
|
|
73
|
+
const forward = (event) => {
|
|
74
|
+
const emitter = this.#outputs[event.type];
|
|
75
|
+
const { detail } = event;
|
|
76
|
+
this.#zone.run(() => emitter.emit(detail));
|
|
77
|
+
};
|
|
78
|
+
const types = Object.keys(this.#outputs);
|
|
79
|
+
for (const type of types)
|
|
80
|
+
element.addEventListener(type, forward);
|
|
41
81
|
onCleanup(() => {
|
|
82
|
+
for (const type of types)
|
|
83
|
+
element.removeEventListener(type, forward);
|
|
42
84
|
element.remove();
|
|
43
85
|
if (this.#element === element)
|
|
44
86
|
this.#element = null;
|
|
45
87
|
});
|
|
46
88
|
});
|
|
89
|
+
effect(() => {
|
|
90
|
+
const sessionToken = this.sessionToken();
|
|
91
|
+
if (this.#element)
|
|
92
|
+
setOptionalAttribute(this.#element, "session-token", sessionToken);
|
|
93
|
+
});
|
|
47
94
|
effect(() => {
|
|
48
95
|
const theme = this.theme();
|
|
49
96
|
if (this.#element)
|
|
50
97
|
setOptionalAttribute(this.#element, "theme", theme);
|
|
51
98
|
});
|
|
99
|
+
effect(() => {
|
|
100
|
+
const colors = this.colors();
|
|
101
|
+
if (this.#element)
|
|
102
|
+
this.#element.colors = colors;
|
|
103
|
+
});
|
|
104
|
+
effect(() => {
|
|
105
|
+
const fontFamily = this.fontFamily();
|
|
106
|
+
if (this.#element)
|
|
107
|
+
setOptionalAttribute(this.#element, "font-family", fontFamily);
|
|
108
|
+
});
|
|
109
|
+
effect(() => {
|
|
110
|
+
const fontUrl = this.fontUrl();
|
|
111
|
+
if (this.#element)
|
|
112
|
+
setOptionalAttribute(this.#element, "font-url", fontUrl);
|
|
113
|
+
});
|
|
114
|
+
effect(() => {
|
|
115
|
+
const buttonRadius = this.buttonRadius();
|
|
116
|
+
if (this.#element)
|
|
117
|
+
setOptionalAttribute(this.#element, "button-radius", buttonRadius);
|
|
118
|
+
});
|
|
119
|
+
effect(() => {
|
|
120
|
+
const initialData = this.initialData();
|
|
121
|
+
if (this.#element)
|
|
122
|
+
this.#element.initialData = initialData;
|
|
123
|
+
});
|
|
124
|
+
effect(() => {
|
|
125
|
+
const shouldConfirmInitialData = this.shouldConfirmInitialData();
|
|
126
|
+
if (this.#element)
|
|
127
|
+
this.#element.shouldConfirmInitialData = shouldConfirmInitialData;
|
|
128
|
+
});
|
|
129
|
+
effect(() => {
|
|
130
|
+
const partnerContext = this.partnerContext();
|
|
131
|
+
if (this.#element)
|
|
132
|
+
this.#element.partnerContext = partnerContext;
|
|
133
|
+
});
|
|
52
134
|
}
|
|
53
|
-
#mount(widgetKey,
|
|
135
|
+
#mount(widgetKey, apiBaseUrl) {
|
|
54
136
|
const element = document.createElement("bidlens-widget");
|
|
55
137
|
element.style.cssText = "display:block;width:100%;height:100%";
|
|
56
138
|
// Attributes go on before the element is connected, which is the only
|
|
57
|
-
// time it reads widget-key /
|
|
139
|
+
// time it reads widget-key / api-base-url.
|
|
58
140
|
setOptionalAttribute(element, "widget-key", widgetKey);
|
|
59
|
-
setOptionalAttribute(element, "session-token", sessionToken);
|
|
141
|
+
setOptionalAttribute(element, "session-token", this.sessionToken());
|
|
60
142
|
setOptionalAttribute(element, "api-base-url", apiBaseUrl);
|
|
61
143
|
setOptionalAttribute(element, "theme", this.theme());
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
144
|
+
element.colors = this.colors();
|
|
145
|
+
setOptionalAttribute(element, "font-family", this.fontFamily());
|
|
146
|
+
setOptionalAttribute(element, "font-url", this.fontUrl());
|
|
147
|
+
setOptionalAttribute(element, "button-radius", this.buttonRadius());
|
|
148
|
+
element.initialData = this.initialData();
|
|
149
|
+
element.shouldConfirmInitialData = this.shouldConfirmInitialData();
|
|
150
|
+
element.partnerContext = this.partnerContext();
|
|
69
151
|
this.#host.nativeElement.appendChild(element);
|
|
70
152
|
this.#element = element;
|
|
71
153
|
return element;
|
|
72
154
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: BidlensWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
77
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.33", type: BidlensWidgetComponent, isStandalone: true, selector: "bidlens-widget-ng", inputs: { widgetKey: { classPropertyName: "widgetKey", publicName: "widgetKey", isSignal: true, isRequired: false, transformFunction: null }, sessionToken: { classPropertyName: "sessionToken", publicName: "sessionToken", isSignal: true, isRequired: false, transformFunction: null }, apiBaseUrl: { classPropertyName: "apiBaseUrl", publicName: "apiBaseUrl", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { message: "message", photo: "photo", contact: "contact", houseDetails: "houseDetails", choice: "choice", windowDirections: "windowDirections", complete: "complete" }, host: { styleAttribute: "display: block" }, ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
155
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: BidlensWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
156
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.25", type: BidlensWidgetComponent, isStandalone: true, selector: "bidlens-widget-ng", inputs: { widgetKey: { classPropertyName: "widgetKey", publicName: "widgetKey", isSignal: true, isRequired: false, transformFunction: null }, sessionToken: { classPropertyName: "sessionToken", publicName: "sessionToken", isSignal: true, isRequired: false, transformFunction: null }, apiBaseUrl: { classPropertyName: "apiBaseUrl", publicName: "apiBaseUrl", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null }, fontFamily: { classPropertyName: "fontFamily", publicName: "fontFamily", isSignal: true, isRequired: false, transformFunction: null }, fontUrl: { classPropertyName: "fontUrl", publicName: "fontUrl", isSignal: true, isRequired: false, transformFunction: null }, buttonRadius: { classPropertyName: "buttonRadius", publicName: "buttonRadius", isSignal: true, isRequired: false, transformFunction: null }, initialData: { classPropertyName: "initialData", publicName: "initialData", isSignal: true, isRequired: false, transformFunction: null }, shouldConfirmInitialData: { classPropertyName: "shouldConfirmInitialData", publicName: "shouldConfirmInitialData", isSignal: true, isRequired: false, transformFunction: null }, partnerContext: { classPropertyName: "partnerContext", publicName: "partnerContext", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dataUpdated: "dataUpdated", complete: "complete", photoAdded: "photoAdded", authRequired: "authRequired" }, host: { styleAttribute: "display: block" }, ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
78
157
|
}
|
|
79
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
158
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: BidlensWidgetComponent, decorators: [{
|
|
80
159
|
type: Component,
|
|
81
160
|
args: [{
|
|
82
161
|
selector: "bidlens-widget-ng",
|
|
@@ -84,7 +163,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
84
163
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
85
164
|
host: { style: "display: block" },
|
|
86
165
|
}]
|
|
87
|
-
}], ctorParameters: () => []
|
|
166
|
+
}], ctorParameters: () => [] });
|
|
88
167
|
function setOptionalAttribute(element, name, value) {
|
|
89
168
|
if (value)
|
|
90
169
|
element.setAttribute(name, value);
|
|
@@ -94,11 +173,11 @@ function setOptionalAttribute(element, name, value) {
|
|
|
94
173
|
|
|
95
174
|
/** For NgModule-based apps; standalone components import BidlensWidgetComponent directly. */
|
|
96
175
|
class BidlensWidgetModule {
|
|
97
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
98
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
99
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
176
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: BidlensWidgetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
177
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.25", ngImport: i0, type: BidlensWidgetModule, imports: [BidlensWidgetComponent], exports: [BidlensWidgetComponent] });
|
|
178
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: BidlensWidgetModule });
|
|
100
179
|
}
|
|
101
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
180
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: BidlensWidgetModule, decorators: [{
|
|
102
181
|
type: NgModule,
|
|
103
182
|
args: [{
|
|
104
183
|
imports: [BidlensWidgetComponent],
|
package/index.d.ts
CHANGED
|
@@ -1,45 +1,5 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { OutputEmitterRef } from '@angular/core';
|
|
3
|
-
import { WidgetTheme, MessageEventDetail, PhotoEventDetail, ContactEventDetail, HouseDetailsEventDetail, ChoiceEventDetail, WindowDirectionsEventDetail, CompleteEventDetail, BidlensWidgetElement } from '@delicious-ai/bidlens-widget';
|
|
4
|
-
export * from '@delicious-ai/bidlens-widget';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
|
-
*
|
|
8
|
-
* itself and turns its DOM events into typed outputs:
|
|
9
|
-
*
|
|
10
|
-
* ```html
|
|
11
|
-
* <bidlens-widget-ng [widgetKey]="key" [apiBaseUrl]="apiUrl" theme="light" (complete)="onDone($event)" />
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* The element reads `widget-key`, `session-token` and `api-base-url` only
|
|
15
|
-
* once, when it is connected, so a change to any of those inputs replaces the
|
|
16
|
-
* element (starting a fresh session). `theme` updates the live element.
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
17
3
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
readonly widgetKey: i0.InputSignal<string>;
|
|
21
|
-
readonly sessionToken: i0.InputSignal<string>;
|
|
22
|
-
readonly apiBaseUrl: i0.InputSignal<string>;
|
|
23
|
-
readonly theme: i0.InputSignal<WidgetTheme>;
|
|
24
|
-
readonly message: OutputEmitterRef<MessageEventDetail>;
|
|
25
|
-
readonly photo: OutputEmitterRef<PhotoEventDetail>;
|
|
26
|
-
readonly contact: OutputEmitterRef<ContactEventDetail>;
|
|
27
|
-
readonly houseDetails: OutputEmitterRef<HouseDetailsEventDetail>;
|
|
28
|
-
readonly choice: OutputEmitterRef<ChoiceEventDetail>;
|
|
29
|
-
readonly windowDirections: OutputEmitterRef<WindowDirectionsEventDetail>;
|
|
30
|
-
readonly complete: OutputEmitterRef<CompleteEventDetail>;
|
|
31
|
-
/** The <bidlens-widget> element currently rendered, if any. */
|
|
32
|
-
get element(): BidlensWidgetElement | null;
|
|
33
|
-
constructor();
|
|
34
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BidlensWidgetComponent, never>;
|
|
35
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<BidlensWidgetComponent, "bidlens-widget-ng", never, { "widgetKey": { "alias": "widgetKey"; "required": false; "isSignal": true; }; "sessionToken": { "alias": "sessionToken"; "required": false; "isSignal": true; }; "apiBaseUrl": { "alias": "apiBaseUrl"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; }, { "message": "message"; "photo": "photo"; "contact": "contact"; "houseDetails": "houseDetails"; "choice": "choice"; "windowDirections": "windowDirections"; "complete": "complete"; }, never, never, true, never>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** For NgModule-based apps; standalone components import BidlensWidgetComponent directly. */
|
|
39
|
-
declare class BidlensWidgetModule {
|
|
40
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BidlensWidgetModule, never>;
|
|
41
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<BidlensWidgetModule, never, [typeof BidlensWidgetComponent], [typeof BidlensWidgetComponent]>;
|
|
42
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<BidlensWidgetModule>;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export { BidlensWidgetComponent, BidlensWidgetModule };
|
|
4
|
+
/// <amd-module name="@delicious-ai/bidlens-angular" />
|
|
5
|
+
export * from './public-api';
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delicious-ai/bidlens-angular",
|
|
3
|
-
"version": "0.1.1-beta.
|
|
3
|
+
"version": "0.1.1-beta.741",
|
|
4
4
|
"description": "Angular wrapper for the <bidlens-widget> custom element: typed inputs and outputs, no CUSTOM_ELEMENTS_SCHEMA needed.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@delicious-ai/bidlens-widget": "0.1.1-beta.
|
|
7
|
+
"@delicious-ai/bidlens-widget": "0.1.1-beta.741",
|
|
8
8
|
"tslib": "^2.3.0"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@angular/core": ">=
|
|
11
|
+
"@angular/core": ">=19.0.0"
|
|
12
12
|
},
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"default": "./fesm2022/delicious-ai-bidlens-angular.mjs"
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "f9b728f67c19215170cd79c50b6fcf753e6f680c"
|
|
29
29
|
}
|
package/public-api.d.ts
ADDED