@authhero/widget 0.2.2 → 0.4.0

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.
Files changed (59) hide show
  1. package/dist/authhero-widget/authhero-widget.esm.js +1 -0
  2. package/dist/authhero-widget/index.esm.js +1 -0
  3. package/dist/authhero-widget/p-2e93c814.entry.js +1 -0
  4. package/dist/authhero-widget/p-539fc666.entry.js +1 -0
  5. package/dist/authhero-widget/p-DQuL1Twl.js +1 -0
  6. package/dist/authhero-widget/p-Doiemx6o.js +2 -0
  7. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  8. package/dist/cjs/authhero-node.cjs.entry.js +255 -0
  9. package/dist/cjs/authhero-widget.cjs.entry.js +577 -0
  10. package/dist/cjs/authhero-widget.cjs.js +25 -0
  11. package/dist/cjs/index-D0xitTOL.js +3788 -0
  12. package/dist/cjs/index.cjs.js +8123 -0
  13. package/dist/cjs/loader.cjs.js +13 -0
  14. package/dist/collection/collection-manifest.json +13 -0
  15. package/dist/collection/components/authhero-node/authhero-node.css +298 -0
  16. package/dist/collection/components/authhero-node/authhero-node.js +360 -0
  17. package/dist/collection/components/authhero-widget/authhero-widget.css +186 -0
  18. package/dist/collection/components/authhero-widget/authhero-widget.js +628 -0
  19. package/dist/collection/index.js +2 -0
  20. package/dist/collection/server/index.js +453 -0
  21. package/dist/collection/themes/index.js +71 -0
  22. package/dist/collection/types/components.js +8 -0
  23. package/dist/collection/utils/branding.js +248 -0
  24. package/dist/components/authhero-node.d.ts +11 -0
  25. package/dist/components/authhero-node.js +1 -0
  26. package/dist/components/authhero-widget.d.ts +11 -0
  27. package/dist/components/authhero-widget.js +1 -0
  28. package/dist/components/index.d.ts +35 -0
  29. package/dist/components/index.js +1 -0
  30. package/dist/components/p-086EZrPM.js +1 -0
  31. package/dist/components/p-DS6y_iDJ.js +1 -0
  32. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  33. package/dist/esm/authhero-node.entry.js +253 -0
  34. package/dist/esm/authhero-widget.entry.js +575 -0
  35. package/dist/esm/authhero-widget.js +21 -0
  36. package/dist/esm/index-Doiemx6o.js +3780 -0
  37. package/dist/esm/index.js +8122 -0
  38. package/dist/esm/loader.js +11 -0
  39. package/dist/index.cjs.js +1 -0
  40. package/dist/index.js +1 -0
  41. package/dist/types/components/authhero-node/authhero-node.d.ts +72 -0
  42. package/dist/types/components/authhero-widget/authhero-widget.d.ts +172 -0
  43. package/dist/types/components.d.ts +215 -0
  44. package/dist/types/index.d.ts +1 -0
  45. package/dist/types/server/index.d.ts +85 -0
  46. package/dist/types/stencil-public-runtime.d.ts +1839 -0
  47. package/dist/types/themes/index.d.ts +40 -0
  48. package/dist/types/types/components.d.ts +8 -0
  49. package/dist/types/utils/branding.d.ts +119 -0
  50. package/hydrate/index.d.ts +287 -0
  51. package/hydrate/index.js +23729 -0
  52. package/hydrate/index.mjs +23719 -0
  53. package/hydrate/package.json +12 -0
  54. package/loader/cdn.js +1 -0
  55. package/loader/index.cjs.js +1 -0
  56. package/loader/index.d.ts +24 -0
  57. package/loader/index.es2017.js +1 -0
  58. package/loader/index.js +2 -0
  59. package/package.json +1 -1
@@ -0,0 +1,628 @@
1
+ import { h } from "@stencil/core";
2
+ import { mergeThemeVars, applyCssVars } from "../../utils/branding";
3
+ export class AuthheroWidget {
4
+ el;
5
+ /**
6
+ * The UI screen configuration from the server.
7
+ * Can be passed as a JSON string or object.
8
+ * Follows Auth0 Forms component schema.
9
+ */
10
+ screen;
11
+ /**
12
+ * API endpoint to fetch the initial screen from.
13
+ * If provided, the widget will fetch the screen on load.
14
+ */
15
+ apiUrl;
16
+ /**
17
+ * Branding configuration from AuthHero API.
18
+ * Controls logo, primary color, and page background.
19
+ * Can be passed as a JSON string or object.
20
+ */
21
+ branding;
22
+ /**
23
+ * Theme configuration from AuthHero API.
24
+ * Controls colors, borders, fonts, and layout.
25
+ * Can be passed as a JSON string or object.
26
+ */
27
+ theme;
28
+ /**
29
+ * Whether the widget is in a loading state.
30
+ */
31
+ loading = false;
32
+ /**
33
+ * Whether the widget should automatically submit forms to the action URL.
34
+ * When false (default), the widget only emits events and the consuming
35
+ * application handles all HTTP requests.
36
+ * When true, the widget handles form submission and screen updates.
37
+ * @default false
38
+ */
39
+ autoSubmit = false;
40
+ /**
41
+ * Internal parsed screen state.
42
+ */
43
+ _screen;
44
+ /**
45
+ * Internal parsed branding state.
46
+ */
47
+ _branding;
48
+ /**
49
+ * Internal parsed theme state.
50
+ */
51
+ _theme;
52
+ /**
53
+ * Form data collected from inputs.
54
+ */
55
+ formData = {};
56
+ /**
57
+ * Emitted when the form is submitted.
58
+ * The consuming application should handle the submission unless autoSubmit is true.
59
+ */
60
+ formSubmit;
61
+ /**
62
+ * Emitted when a non-submit button is clicked (social login, back, etc.).
63
+ * The consuming application decides what to do based on id/type/value.
64
+ */
65
+ buttonClick;
66
+ /**
67
+ * Emitted when a link is clicked.
68
+ * The consuming application decides how to handle navigation.
69
+ */
70
+ linkClick;
71
+ /**
72
+ * Emitted when the widget wants to navigate (e.g., after successful auth).
73
+ * The consuming application decides how to handle navigation.
74
+ */
75
+ navigate;
76
+ /**
77
+ * Emitted when auth flow completes with a redirect URL.
78
+ * The consuming application can redirect or extract the code.
79
+ */
80
+ flowComplete;
81
+ /**
82
+ * Emitted when an error occurs.
83
+ */
84
+ flowError;
85
+ /**
86
+ * Emitted when the screen changes.
87
+ */
88
+ screenChange;
89
+ watchScreen(newValue) {
90
+ if (typeof newValue === 'string') {
91
+ try {
92
+ this._screen = JSON.parse(newValue);
93
+ }
94
+ catch {
95
+ console.error('Failed to parse screen JSON');
96
+ }
97
+ }
98
+ else {
99
+ this._screen = newValue;
100
+ }
101
+ if (this._screen) {
102
+ this.screenChange.emit(this._screen);
103
+ }
104
+ }
105
+ watchBranding(newValue) {
106
+ if (typeof newValue === 'string') {
107
+ try {
108
+ this._branding = JSON.parse(newValue);
109
+ }
110
+ catch {
111
+ console.error('Failed to parse branding JSON');
112
+ }
113
+ }
114
+ else {
115
+ this._branding = newValue;
116
+ }
117
+ this.applyThemeStyles();
118
+ }
119
+ watchTheme(newValue) {
120
+ if (typeof newValue === 'string') {
121
+ try {
122
+ this._theme = JSON.parse(newValue);
123
+ }
124
+ catch {
125
+ console.error('Failed to parse theme JSON');
126
+ }
127
+ }
128
+ else {
129
+ this._theme = newValue;
130
+ }
131
+ this.applyThemeStyles();
132
+ }
133
+ /**
134
+ * Apply branding and theme as CSS custom properties
135
+ */
136
+ applyThemeStyles() {
137
+ const vars = mergeThemeVars(this._branding, this._theme);
138
+ applyCssVars(this.el, vars);
139
+ }
140
+ async componentWillLoad() {
141
+ // Parse initial props
142
+ this.watchScreen(this.screen);
143
+ this.watchBranding(this.branding);
144
+ this.watchTheme(this.theme);
145
+ // Fetch screen from API if URL provided and no screen prop
146
+ if (this.apiUrl && !this._screen) {
147
+ await this.fetchScreen();
148
+ }
149
+ }
150
+ async fetchScreen() {
151
+ if (!this.apiUrl)
152
+ return;
153
+ this.loading = true;
154
+ try {
155
+ const response = await fetch(this.apiUrl, {
156
+ credentials: 'include',
157
+ headers: {
158
+ Accept: 'application/json',
159
+ },
160
+ });
161
+ if (response.ok) {
162
+ this._screen = await response.json();
163
+ if (this._screen) {
164
+ this.screenChange.emit(this._screen);
165
+ }
166
+ }
167
+ }
168
+ catch (error) {
169
+ console.error('Failed to fetch screen:', error);
170
+ }
171
+ finally {
172
+ this.loading = false;
173
+ }
174
+ }
175
+ handleInputChange = (name, value) => {
176
+ this.formData = {
177
+ ...this.formData,
178
+ [name]: value,
179
+ };
180
+ };
181
+ handleSubmit = async (e) => {
182
+ e.preventDefault();
183
+ if (!this._screen)
184
+ return;
185
+ // Always emit the submit event
186
+ this.formSubmit.emit({
187
+ screen: this._screen,
188
+ data: this.formData,
189
+ });
190
+ // If autoSubmit is disabled, let the consuming app handle it
191
+ if (!this.autoSubmit) {
192
+ return;
193
+ }
194
+ // Submit to the server
195
+ this.loading = true;
196
+ try {
197
+ const response = await fetch(this._screen.action, {
198
+ method: this._screen.method,
199
+ credentials: 'include',
200
+ headers: {
201
+ 'Content-Type': 'application/json',
202
+ Accept: 'application/json',
203
+ },
204
+ body: JSON.stringify({ data: this.formData }),
205
+ });
206
+ const contentType = response.headers.get('content-type');
207
+ if (contentType?.includes('application/json')) {
208
+ const result = await response.json();
209
+ // Handle different response types
210
+ if (result.redirect) {
211
+ // Auth complete - emit complete event
212
+ this.flowComplete.emit({ redirectUrl: result.redirect });
213
+ // Also emit navigate for backwards compatibility
214
+ this.navigate.emit({ url: result.redirect });
215
+ }
216
+ else if (result.screen) {
217
+ // Next screen
218
+ this._screen = result.screen;
219
+ this.formData = {};
220
+ this.screenChange.emit(result.screen);
221
+ // Apply branding if included
222
+ if (result.branding) {
223
+ this._branding = result.branding;
224
+ this.applyThemeStyles();
225
+ }
226
+ }
227
+ else if (result.complete) {
228
+ // Flow complete without redirect
229
+ this.flowComplete.emit({});
230
+ }
231
+ // Handle validation errors (400 response)
232
+ if (!response.ok && result.screen) {
233
+ this._screen = result.screen;
234
+ this.screenChange.emit(result.screen);
235
+ }
236
+ }
237
+ }
238
+ catch (err) {
239
+ console.error('Form submission failed:', err);
240
+ this.flowError.emit({
241
+ message: err instanceof Error ? err.message : 'Form submission failed',
242
+ });
243
+ }
244
+ finally {
245
+ this.loading = false;
246
+ }
247
+ };
248
+ handleButtonClick = (detail) => {
249
+ this.buttonClick.emit(detail);
250
+ };
251
+ handleLinkClick = (e, link) => {
252
+ // Emit the event so the consuming app can handle it
253
+ this.linkClick.emit({
254
+ id: link.id,
255
+ href: link.href,
256
+ text: link.text,
257
+ });
258
+ // If autoSubmit is enabled, let the browser handle the navigation
259
+ // Otherwise, prevent default and let the app decide
260
+ if (!this.autoSubmit) {
261
+ e.preventDefault();
262
+ }
263
+ };
264
+ /**
265
+ * Get error messages from the screen-level messages array.
266
+ */
267
+ getScreenErrors() {
268
+ return this._screen?.messages?.filter((m) => m.type === 'error') || [];
269
+ }
270
+ /**
271
+ * Get success messages from the screen-level messages array.
272
+ */
273
+ getScreenSuccesses() {
274
+ return this._screen?.messages?.filter((m) => m.type === 'success') || [];
275
+ }
276
+ /**
277
+ * Sort components by order.
278
+ */
279
+ getOrderedComponents() {
280
+ if (!this._screen)
281
+ return [];
282
+ return [...this._screen.components]
283
+ .filter((c) => c.visible !== false)
284
+ .sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
285
+ }
286
+ render() {
287
+ if (this.loading && !this._screen) {
288
+ return (h("div", { class: "widget-container" }, h("div", { class: "loading-spinner" })));
289
+ }
290
+ if (!this._screen) {
291
+ return (h("div", { class: "widget-container" }, h("div", { class: "error-message" }, "No screen configuration provided")));
292
+ }
293
+ const screenErrors = this.getScreenErrors();
294
+ const screenSuccesses = this.getScreenSuccesses();
295
+ const components = this.getOrderedComponents();
296
+ // Get logo URL from branding props
297
+ const logoUrl = this._branding?.logo_url;
298
+ return (h("div", { class: "widget-container", part: "container" }, logoUrl && h("img", { class: "logo", part: "logo", src: logoUrl, alt: "Logo" }), this._screen.title && (h("h1", { class: "title", part: "title" }, this._screen.title)), this._screen.description && (h("p", { class: "description", part: "description" }, this._screen.description)), screenErrors.map((err) => (h("div", { class: "message message-error", part: "message message-error", key: err.id ?? err.text }, err.text))), screenSuccesses.map((msg) => (h("div", { class: "message message-success", part: "message message-success", key: msg.id ?? msg.text }, msg.text))), h("form", { onSubmit: this.handleSubmit, part: "form" }, components.map((component) => (h("authhero-node", { key: component.id, component: component, value: this.formData[component.id], onFieldChange: (e) => this.handleInputChange(e.detail.id, e.detail.value), onButtonClick: (e) => this.handleButtonClick(e.detail), disabled: this.loading })))), this._screen.links && this._screen.links.length > 0 && (h("div", { class: "links", part: "links" }, this._screen.links.map((link) => (h("span", { class: "link-wrapper", part: "link-wrapper", key: link.id ?? link.href }, link.linkText ? (h("span", null, link.text, ' ', h("a", { href: link.href, class: "link", part: "link", onClick: (e) => this.handleLinkClick(e, { id: link.id, href: link.href, text: link.linkText || link.text }) }, link.linkText))) : (h("a", { href: link.href, class: "link", part: "link", onClick: (e) => this.handleLinkClick(e, { id: link.id, href: link.href, text: link.text }) }, link.text)))))))));
299
+ }
300
+ static get is() { return "authhero-widget"; }
301
+ static get encapsulation() { return "shadow"; }
302
+ static get originalStyleUrls() {
303
+ return {
304
+ "$": ["authhero-widget.css"]
305
+ };
306
+ }
307
+ static get styleUrls() {
308
+ return {
309
+ "$": ["authhero-widget.css"]
310
+ };
311
+ }
312
+ static get properties() {
313
+ return {
314
+ "screen": {
315
+ "type": "string",
316
+ "mutable": false,
317
+ "complexType": {
318
+ "original": "UiScreen | string",
319
+ "resolved": "string | undefined | { action: string; components: ({ type: \"DIVIDER\"; id: string; visible: boolean; category?: \"BLOCK\" | undefined; config?: {} | undefined; order?: number | undefined; } | { type: \"HTML\"; id: string; visible: boolean; category?: \"BLOCK\" | undefined; config?: { content?: string | undefined; } | undefined; order?: number | undefined; } | { type: \"IMAGE\"; id: string; visible: boolean; category?: \"BLOCK\" | undefined; config?: { src?: string | undefined; alt?: string | undefined; width?: number | undefined; height?: number | undefined; } | undefined; order?: number | undefined; } | { type: \"JUMP_BUTTON\"; id: string; config: { text?: string | undefined; target_step?: string | undefined; }; visible: boolean; category?: \"BLOCK\" | undefined; order?: number | undefined; } | { type: \"RESEND_BUTTON\"; id: string; config: { text?: string | undefined; resend_action?: string | undefined; }; visible: boolean; category?: \"BLOCK\" | undefined; order?: number | undefined; } | { type: \"NEXT_BUTTON\"; id: string; config: { text?: string | undefined; }; visible: boolean; category?: \"BLOCK\" | undefined; order?: number | undefined; } | { type: \"PREVIOUS_BUTTON\"; id: string; config: { text?: string | undefined; }; visible: boolean; category?: \"BLOCK\" | undefined; order?: number | undefined; } | { type: \"RICH_TEXT\"; id: string; visible: boolean; category?: \"BLOCK\" | undefined; config?: { content?: string | undefined; } | undefined; order?: number | undefined; } | { type: \"AUTH0_VERIFIABLE_CREDENTIALS\"; id: string; config: { credential_type?: string | undefined; }; visible: boolean; required?: boolean | undefined; category?: \"WIDGET\" | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"GMAPS_ADDRESS\"; id: string; config: { api_key?: string | undefined; }; visible: boolean; required?: boolean | undefined; category?: \"WIDGET\" | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"RECAPTCHA\"; id: string; config: { site_key?: string | undefined; }; visible: boolean; required?: boolean | undefined; category?: \"WIDGET\" | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"BOOLEAN\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { default_value?: boolean | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"CARDS\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { options?: { value: string; label: string; description?: string | undefined; image?: string | undefined; }[] | undefined; multi_select?: boolean | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"CHOICE\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { options?: { value: string; label: string; }[] | undefined; display?: \"radio\" | \"checkbox\" | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"CUSTOM\"; id: string; config: { component?: string | undefined; props?: Record<string, any> | undefined; }; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"DATE\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { format?: string | undefined; min?: string | undefined; max?: string | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"DROPDOWN\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { options?: { value: string; label: string; }[] | undefined; placeholder?: string | undefined; searchable?: boolean | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"EMAIL\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { placeholder?: string | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"FILE\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { accept?: string | undefined; max_size?: number | undefined; multiple?: boolean | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"LEGAL\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { text: string; html?: boolean | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"NUMBER\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { placeholder?: string | undefined; min?: number | undefined; max?: number | undefined; step?: number | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"PASSWORD\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { placeholder?: string | undefined; min_length?: number | undefined; show_toggle?: boolean | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"PAYMENT\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { provider?: string | undefined; currency?: string | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"SOCIAL\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { providers?: string[] | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"TEL\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { placeholder?: string | undefined; default_country?: string | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"TEXT\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { placeholder?: string | undefined; multiline?: boolean | undefined; max_length?: number | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"URL\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { placeholder?: string | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; })[]; method: \"POST\" | \"GET\"; description?: string | undefined; title?: string | undefined; links?: { text: string; href: string; id?: string | undefined; linkText?: string | undefined; }[] | undefined; messages?: { type: \"info\" | \"error\" | \"success\" | \"warning\"; text: string; id?: number | undefined; }[] | undefined; }",
320
+ "references": {
321
+ "UiScreen": {
322
+ "location": "import",
323
+ "path": "../../types/components",
324
+ "id": "src/types/components.ts::UiScreen",
325
+ "referenceLocation": "UiScreen"
326
+ }
327
+ }
328
+ },
329
+ "required": false,
330
+ "optional": true,
331
+ "docs": {
332
+ "tags": [],
333
+ "text": "The UI screen configuration from the server.\nCan be passed as a JSON string or object.\nFollows Auth0 Forms component schema."
334
+ },
335
+ "getter": false,
336
+ "setter": false,
337
+ "reflect": false,
338
+ "attribute": "screen"
339
+ },
340
+ "apiUrl": {
341
+ "type": "string",
342
+ "mutable": false,
343
+ "complexType": {
344
+ "original": "string",
345
+ "resolved": "string | undefined",
346
+ "references": {}
347
+ },
348
+ "required": false,
349
+ "optional": true,
350
+ "docs": {
351
+ "tags": [],
352
+ "text": "API endpoint to fetch the initial screen from.\nIf provided, the widget will fetch the screen on load."
353
+ },
354
+ "getter": false,
355
+ "setter": false,
356
+ "reflect": false,
357
+ "attribute": "api-url"
358
+ },
359
+ "branding": {
360
+ "type": "string",
361
+ "mutable": false,
362
+ "complexType": {
363
+ "original": "WidgetBranding | string",
364
+ "resolved": "WidgetBranding | string | undefined",
365
+ "references": {
366
+ "WidgetBranding": {
367
+ "location": "import",
368
+ "path": "../../utils/branding",
369
+ "id": "src/utils/branding.ts::WidgetBranding",
370
+ "referenceLocation": "WidgetBranding"
371
+ }
372
+ }
373
+ },
374
+ "required": false,
375
+ "optional": true,
376
+ "docs": {
377
+ "tags": [],
378
+ "text": "Branding configuration from AuthHero API.\nControls logo, primary color, and page background.\nCan be passed as a JSON string or object."
379
+ },
380
+ "getter": false,
381
+ "setter": false,
382
+ "reflect": false,
383
+ "attribute": "branding"
384
+ },
385
+ "theme": {
386
+ "type": "string",
387
+ "mutable": false,
388
+ "complexType": {
389
+ "original": "WidgetTheme | string",
390
+ "resolved": "WidgetTheme | string | undefined",
391
+ "references": {
392
+ "WidgetTheme": {
393
+ "location": "import",
394
+ "path": "../../utils/branding",
395
+ "id": "src/utils/branding.ts::WidgetTheme",
396
+ "referenceLocation": "WidgetTheme"
397
+ }
398
+ }
399
+ },
400
+ "required": false,
401
+ "optional": true,
402
+ "docs": {
403
+ "tags": [],
404
+ "text": "Theme configuration from AuthHero API.\nControls colors, borders, fonts, and layout.\nCan be passed as a JSON string or object."
405
+ },
406
+ "getter": false,
407
+ "setter": false,
408
+ "reflect": false,
409
+ "attribute": "theme"
410
+ },
411
+ "loading": {
412
+ "type": "boolean",
413
+ "mutable": true,
414
+ "complexType": {
415
+ "original": "boolean",
416
+ "resolved": "boolean",
417
+ "references": {}
418
+ },
419
+ "required": false,
420
+ "optional": false,
421
+ "docs": {
422
+ "tags": [],
423
+ "text": "Whether the widget is in a loading state."
424
+ },
425
+ "getter": false,
426
+ "setter": false,
427
+ "reflect": false,
428
+ "attribute": "loading",
429
+ "defaultValue": "false"
430
+ },
431
+ "autoSubmit": {
432
+ "type": "boolean",
433
+ "mutable": false,
434
+ "complexType": {
435
+ "original": "boolean",
436
+ "resolved": "boolean",
437
+ "references": {}
438
+ },
439
+ "required": false,
440
+ "optional": false,
441
+ "docs": {
442
+ "tags": [{
443
+ "name": "default",
444
+ "text": "false"
445
+ }],
446
+ "text": "Whether the widget should automatically submit forms to the action URL.\nWhen false (default), the widget only emits events and the consuming\napplication handles all HTTP requests.\nWhen true, the widget handles form submission and screen updates."
447
+ },
448
+ "getter": false,
449
+ "setter": false,
450
+ "reflect": false,
451
+ "attribute": "auto-submit",
452
+ "defaultValue": "false"
453
+ }
454
+ };
455
+ }
456
+ static get states() {
457
+ return {
458
+ "_screen": {},
459
+ "_branding": {},
460
+ "_theme": {},
461
+ "formData": {}
462
+ };
463
+ }
464
+ static get events() {
465
+ return [{
466
+ "method": "formSubmit",
467
+ "name": "formSubmit",
468
+ "bubbles": true,
469
+ "cancelable": true,
470
+ "composed": true,
471
+ "docs": {
472
+ "tags": [],
473
+ "text": "Emitted when the form is submitted.\nThe consuming application should handle the submission unless autoSubmit is true."
474
+ },
475
+ "complexType": {
476
+ "original": "SubmitEventDetail",
477
+ "resolved": "SubmitEventDetail",
478
+ "references": {
479
+ "SubmitEventDetail": {
480
+ "location": "local",
481
+ "path": "/home/runner/work/authhero/authhero/packages/ui-widget/src/components/authhero-widget/authhero-widget.tsx",
482
+ "id": "src/components/authhero-widget/authhero-widget.tsx::SubmitEventDetail"
483
+ }
484
+ }
485
+ }
486
+ }, {
487
+ "method": "buttonClick",
488
+ "name": "buttonClick",
489
+ "bubbles": true,
490
+ "cancelable": true,
491
+ "composed": true,
492
+ "docs": {
493
+ "tags": [],
494
+ "text": "Emitted when a non-submit button is clicked (social login, back, etc.).\nThe consuming application decides what to do based on id/type/value."
495
+ },
496
+ "complexType": {
497
+ "original": "ButtonClickEventDetail",
498
+ "resolved": "ButtonClickEventDetail",
499
+ "references": {
500
+ "ButtonClickEventDetail": {
501
+ "location": "local",
502
+ "path": "/home/runner/work/authhero/authhero/packages/ui-widget/src/components/authhero-widget/authhero-widget.tsx",
503
+ "id": "src/components/authhero-widget/authhero-widget.tsx::ButtonClickEventDetail"
504
+ }
505
+ }
506
+ }
507
+ }, {
508
+ "method": "linkClick",
509
+ "name": "linkClick",
510
+ "bubbles": true,
511
+ "cancelable": true,
512
+ "composed": true,
513
+ "docs": {
514
+ "tags": [],
515
+ "text": "Emitted when a link is clicked.\nThe consuming application decides how to handle navigation."
516
+ },
517
+ "complexType": {
518
+ "original": "LinkClickEventDetail",
519
+ "resolved": "LinkClickEventDetail",
520
+ "references": {
521
+ "LinkClickEventDetail": {
522
+ "location": "local",
523
+ "path": "/home/runner/work/authhero/authhero/packages/ui-widget/src/components/authhero-widget/authhero-widget.tsx",
524
+ "id": "src/components/authhero-widget/authhero-widget.tsx::LinkClickEventDetail"
525
+ }
526
+ }
527
+ }
528
+ }, {
529
+ "method": "navigate",
530
+ "name": "navigate",
531
+ "bubbles": true,
532
+ "cancelable": true,
533
+ "composed": true,
534
+ "docs": {
535
+ "tags": [],
536
+ "text": "Emitted when the widget wants to navigate (e.g., after successful auth).\nThe consuming application decides how to handle navigation."
537
+ },
538
+ "complexType": {
539
+ "original": "NavigateEventDetail",
540
+ "resolved": "NavigateEventDetail",
541
+ "references": {
542
+ "NavigateEventDetail": {
543
+ "location": "local",
544
+ "path": "/home/runner/work/authhero/authhero/packages/ui-widget/src/components/authhero-widget/authhero-widget.tsx",
545
+ "id": "src/components/authhero-widget/authhero-widget.tsx::NavigateEventDetail"
546
+ }
547
+ }
548
+ }
549
+ }, {
550
+ "method": "flowComplete",
551
+ "name": "flowComplete",
552
+ "bubbles": true,
553
+ "cancelable": true,
554
+ "composed": true,
555
+ "docs": {
556
+ "tags": [],
557
+ "text": "Emitted when auth flow completes with a redirect URL.\nThe consuming application can redirect or extract the code."
558
+ },
559
+ "complexType": {
560
+ "original": "CompleteEventDetail",
561
+ "resolved": "CompleteEventDetail",
562
+ "references": {
563
+ "CompleteEventDetail": {
564
+ "location": "local",
565
+ "path": "/home/runner/work/authhero/authhero/packages/ui-widget/src/components/authhero-widget/authhero-widget.tsx",
566
+ "id": "src/components/authhero-widget/authhero-widget.tsx::CompleteEventDetail"
567
+ }
568
+ }
569
+ }
570
+ }, {
571
+ "method": "flowError",
572
+ "name": "flowError",
573
+ "bubbles": true,
574
+ "cancelable": true,
575
+ "composed": true,
576
+ "docs": {
577
+ "tags": [],
578
+ "text": "Emitted when an error occurs."
579
+ },
580
+ "complexType": {
581
+ "original": "ErrorEventDetail",
582
+ "resolved": "ErrorEventDetail",
583
+ "references": {
584
+ "ErrorEventDetail": {
585
+ "location": "local",
586
+ "path": "/home/runner/work/authhero/authhero/packages/ui-widget/src/components/authhero-widget/authhero-widget.tsx",
587
+ "id": "src/components/authhero-widget/authhero-widget.tsx::ErrorEventDetail"
588
+ }
589
+ }
590
+ }
591
+ }, {
592
+ "method": "screenChange",
593
+ "name": "screenChange",
594
+ "bubbles": true,
595
+ "cancelable": true,
596
+ "composed": true,
597
+ "docs": {
598
+ "tags": [],
599
+ "text": "Emitted when the screen changes."
600
+ },
601
+ "complexType": {
602
+ "original": "UiScreen",
603
+ "resolved": "{ action: string; components: ({ type: \"DIVIDER\"; id: string; visible: boolean; category?: \"BLOCK\" | undefined; config?: {} | undefined; order?: number | undefined; } | { type: \"HTML\"; id: string; visible: boolean; category?: \"BLOCK\" | undefined; config?: { content?: string | undefined; } | undefined; order?: number | undefined; } | { type: \"IMAGE\"; id: string; visible: boolean; category?: \"BLOCK\" | undefined; config?: { src?: string | undefined; alt?: string | undefined; width?: number | undefined; height?: number | undefined; } | undefined; order?: number | undefined; } | { type: \"JUMP_BUTTON\"; id: string; config: { text?: string | undefined; target_step?: string | undefined; }; visible: boolean; category?: \"BLOCK\" | undefined; order?: number | undefined; } | { type: \"RESEND_BUTTON\"; id: string; config: { text?: string | undefined; resend_action?: string | undefined; }; visible: boolean; category?: \"BLOCK\" | undefined; order?: number | undefined; } | { type: \"NEXT_BUTTON\"; id: string; config: { text?: string | undefined; }; visible: boolean; category?: \"BLOCK\" | undefined; order?: number | undefined; } | { type: \"PREVIOUS_BUTTON\"; id: string; config: { text?: string | undefined; }; visible: boolean; category?: \"BLOCK\" | undefined; order?: number | undefined; } | { type: \"RICH_TEXT\"; id: string; visible: boolean; category?: \"BLOCK\" | undefined; config?: { content?: string | undefined; } | undefined; order?: number | undefined; } | { type: \"AUTH0_VERIFIABLE_CREDENTIALS\"; id: string; config: { credential_type?: string | undefined; }; visible: boolean; required?: boolean | undefined; category?: \"WIDGET\" | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"GMAPS_ADDRESS\"; id: string; config: { api_key?: string | undefined; }; visible: boolean; required?: boolean | undefined; category?: \"WIDGET\" | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"RECAPTCHA\"; id: string; config: { site_key?: string | undefined; }; visible: boolean; required?: boolean | undefined; category?: \"WIDGET\" | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"BOOLEAN\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { default_value?: boolean | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"CARDS\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { options?: { value: string; label: string; description?: string | undefined; image?: string | undefined; }[] | undefined; multi_select?: boolean | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"CHOICE\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { options?: { value: string; label: string; }[] | undefined; display?: \"radio\" | \"checkbox\" | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"CUSTOM\"; id: string; config: { component?: string | undefined; props?: Record<string, any> | undefined; }; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"DATE\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { format?: string | undefined; min?: string | undefined; max?: string | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"DROPDOWN\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { options?: { value: string; label: string; }[] | undefined; placeholder?: string | undefined; searchable?: boolean | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"EMAIL\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { placeholder?: string | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"FILE\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { accept?: string | undefined; max_size?: number | undefined; multiple?: boolean | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"LEGAL\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { text: string; html?: boolean | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"NUMBER\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { placeholder?: string | undefined; min?: number | undefined; max?: number | undefined; step?: number | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"PASSWORD\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { placeholder?: string | undefined; min_length?: number | undefined; show_toggle?: boolean | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"PAYMENT\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { provider?: string | undefined; currency?: string | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"SOCIAL\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { providers?: string[] | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"TEL\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { placeholder?: string | undefined; default_country?: string | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"TEXT\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { placeholder?: string | undefined; multiline?: boolean | undefined; max_length?: number | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; } | { type: \"URL\"; id: string; visible: boolean; required?: boolean | undefined; category?: \"FIELD\" | undefined; config?: { placeholder?: string | undefined; } | undefined; sensitive?: boolean | undefined; label?: string | undefined; order?: number | undefined; hint?: string | undefined; })[]; method: \"POST\" | \"GET\"; description?: string | undefined; title?: string | undefined; links?: { text: string; href: string; id?: string | undefined; linkText?: string | undefined; }[] | undefined; messages?: { type: \"info\" | \"error\" | \"success\" | \"warning\"; text: string; id?: number | undefined; }[] | undefined; }",
604
+ "references": {
605
+ "UiScreen": {
606
+ "location": "import",
607
+ "path": "../../types/components",
608
+ "id": "src/types/components.ts::UiScreen",
609
+ "referenceLocation": "UiScreen"
610
+ }
611
+ }
612
+ }
613
+ }];
614
+ }
615
+ static get elementRef() { return "el"; }
616
+ static get watchers() {
617
+ return [{
618
+ "propName": "screen",
619
+ "methodName": "watchScreen"
620
+ }, {
621
+ "propName": "branding",
622
+ "methodName": "watchBranding"
623
+ }, {
624
+ "propName": "theme",
625
+ "methodName": "watchTheme"
626
+ }];
627
+ }
628
+ }
@@ -0,0 +1,2 @@
1
+ // Export types for consumers
2
+ export * from './types/components';