@anarchitects/auth-angular 0.4.0 → 0.5.1

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.
@@ -1,22 +1,210 @@
1
1
  import { AnarchitectsUiForm } from '@anarchitects/forms-angular/ui';
2
2
  import * as i0 from '@angular/core';
3
- import { input, output, signal, ChangeDetectionStrategy, Component, computed } from '@angular/core';
3
+ import { input, output, computed, ChangeDetectionStrategy, Component } from '@angular/core';
4
4
 
5
- class AnarchitectsAuthUiLoginForm {
6
- layout = input(null, ...(ngDevMode ? [{ debugName: "layout" }] : []));
7
- layoutOptions = input({}, ...(ngDevMode ? [{ debugName: "layoutOptions" }] : []));
8
- submitted = output();
9
- formConfig = signal({
10
- id: 'login',
5
+ const readPayloadString = (input, key) => input.payload[key];
6
+ const readStoredString = (key) => localStorage.getItem(key) || undefined;
7
+ const matchFieldsRule = (sourceField, targetField) => ({
8
+ kind: 'matchFields',
9
+ sourceField,
10
+ targetField,
11
+ message: 'Passwords must match.',
12
+ });
13
+ const LOGIN_FORM_CONFIG = {
14
+ id: 'login',
15
+ version: 1,
16
+ fields: [
17
+ {
18
+ name: 'credential',
19
+ kind: 'string',
20
+ required: true,
21
+ minLength: 2,
22
+ maxLength: 100,
23
+ ui: { label: 'Email or Username' },
24
+ },
25
+ {
26
+ name: 'password',
27
+ kind: 'password',
28
+ required: true,
29
+ minLength: 6,
30
+ ui: { label: 'Password' },
31
+ },
32
+ ],
33
+ };
34
+ const REGISTER_FORM_CONFIG = {
35
+ id: 'register',
36
+ version: 1,
37
+ fields: [
38
+ {
39
+ name: 'userName',
40
+ kind: 'string',
41
+ ui: { label: 'Username' },
42
+ required: false,
43
+ },
44
+ { name: 'email', kind: 'email', ui: { label: 'Email' }, required: true },
45
+ {
46
+ name: 'password',
47
+ kind: 'password',
48
+ ui: { label: 'Password' },
49
+ required: true,
50
+ },
51
+ {
52
+ name: 'confirmPassword',
53
+ kind: 'password',
54
+ ui: { label: 'Confirm Password' },
55
+ required: true,
56
+ },
57
+ ],
58
+ validationRules: [matchFieldsRule('password', 'confirmPassword')],
59
+ };
60
+ const CHANGE_PASSWORD_FORM_CONFIG = {
61
+ id: 'change-password',
62
+ version: 1,
63
+ fields: [
64
+ {
65
+ name: 'currentPassword',
66
+ kind: 'password',
67
+ required: true,
68
+ minLength: 6,
69
+ ui: { label: 'Current Password' },
70
+ },
71
+ {
72
+ name: 'newPassword',
73
+ kind: 'password',
74
+ required: true,
75
+ minLength: 6,
76
+ ui: { label: 'New Password' },
77
+ },
78
+ {
79
+ name: 'confirmPassword',
80
+ kind: 'password',
81
+ required: true,
82
+ minLength: 6,
83
+ ui: { label: 'Confirm Password' },
84
+ },
85
+ ],
86
+ validationRules: [matchFieldsRule('newPassword', 'confirmPassword')],
87
+ };
88
+ const FORGOT_PASSWORD_FORM_CONFIG = {
89
+ id: 'forgot-password',
90
+ version: 1,
91
+ fields: [
92
+ {
93
+ name: 'email',
94
+ kind: 'email',
95
+ required: true,
96
+ ui: { label: 'Email' },
97
+ },
98
+ ],
99
+ };
100
+ const UPDATE_EMAIL_FORM_CONFIG = {
101
+ id: 'update-email',
102
+ version: 1,
103
+ fields: [
104
+ {
105
+ name: 'newEmail',
106
+ kind: 'email',
107
+ required: true,
108
+ ui: { label: 'New Email' },
109
+ },
110
+ {
111
+ name: 'password',
112
+ kind: 'password',
113
+ required: true,
114
+ minLength: 6,
115
+ ui: { label: 'Password' },
116
+ },
117
+ ],
118
+ };
119
+ const LOGOUT_FORM_CONFIG = {
120
+ id: 'logout',
121
+ version: 1,
122
+ fields: [
123
+ {
124
+ name: 'refreshToken',
125
+ kind: 'string',
126
+ required: false,
127
+ minLength: 1,
128
+ ui: { label: 'Refresh Token' },
129
+ },
130
+ {
131
+ name: 'accessToken',
132
+ kind: 'string',
133
+ required: false,
134
+ minLength: 1,
135
+ ui: { label: 'Access Token (optional)' },
136
+ },
137
+ ],
138
+ };
139
+ const REFRESH_TOKENS_FORM_CONFIG = {
140
+ id: 'refresh-tokens',
141
+ version: 1,
142
+ fields: [
143
+ {
144
+ name: 'refreshToken',
145
+ kind: 'string',
146
+ required: false,
147
+ minLength: 1,
148
+ ui: { label: 'Refresh Token' },
149
+ },
150
+ ],
151
+ };
152
+ const resolveToken = (input, fallbackToken) => readPayloadString(input, 'token') || fallbackToken;
153
+ const loginFormBridge = {
154
+ resolveFormConfig: () => LOGIN_FORM_CONFIG,
155
+ mapSubmission: (input) => ({
156
+ credential: readPayloadString(input, 'credential'),
157
+ password: readPayloadString(input, 'password'),
158
+ }),
159
+ };
160
+ const registerFormBridge = {
161
+ resolveFormConfig: () => REGISTER_FORM_CONFIG,
162
+ mapSubmission: (input) => ({
163
+ userName: readPayloadString(input, 'userName'),
164
+ email: readPayloadString(input, 'email'),
165
+ password: readPayloadString(input, 'password'),
166
+ confirmPassword: readPayloadString(input, 'confirmPassword'),
167
+ }),
168
+ };
169
+ const activateUserFormBridge = {
170
+ resolveFormConfig: (context) => ({
171
+ id: 'activate-user',
11
172
  version: 1,
12
173
  fields: [
13
174
  {
14
- name: 'credential',
175
+ name: 'token',
15
176
  kind: 'string',
16
- required: true,
17
- minLength: 2,
18
- maxLength: 100,
19
- ui: { label: 'Email or Username' },
177
+ required: !context?.token,
178
+ minLength: 1,
179
+ ui: { label: 'Activation Token' },
180
+ },
181
+ ],
182
+ }),
183
+ mapSubmission: (input, context) => {
184
+ const token = resolveToken(input, context?.token);
185
+ if (!token) {
186
+ return undefined;
187
+ }
188
+ return { token };
189
+ },
190
+ };
191
+ const forgotPasswordFormBridge = {
192
+ resolveFormConfig: () => FORGOT_PASSWORD_FORM_CONFIG,
193
+ mapSubmission: (input) => ({
194
+ email: readPayloadString(input, 'email'),
195
+ }),
196
+ };
197
+ const resetPasswordFormBridge = {
198
+ resolveFormConfig: (context) => ({
199
+ id: 'reset-password',
200
+ version: 1,
201
+ fields: [
202
+ {
203
+ name: 'token',
204
+ kind: 'string',
205
+ required: !context?.token,
206
+ minLength: 1,
207
+ ui: { label: 'Reset Token' },
20
208
  },
21
209
  {
22
210
  name: 'password',
@@ -25,13 +213,100 @@ class AnarchitectsAuthUiLoginForm {
25
213
  minLength: 6,
26
214
  ui: { label: 'Password' },
27
215
  },
216
+ {
217
+ name: 'confirmPassword',
218
+ kind: 'password',
219
+ required: true,
220
+ minLength: 6,
221
+ ui: { label: 'Confirm Password' },
222
+ },
223
+ ],
224
+ validationRules: [matchFieldsRule('password', 'confirmPassword')],
225
+ }),
226
+ mapSubmission: (input, context) => {
227
+ const token = resolveToken(input, context?.token);
228
+ if (!token) {
229
+ return undefined;
230
+ }
231
+ return {
232
+ token,
233
+ password: readPayloadString(input, 'password'),
234
+ confirmPassword: readPayloadString(input, 'confirmPassword'),
235
+ };
236
+ },
237
+ };
238
+ const verifyEmailFormBridge = {
239
+ resolveFormConfig: (context) => ({
240
+ id: 'verify-email',
241
+ version: 1,
242
+ fields: [
243
+ {
244
+ name: 'token',
245
+ kind: 'string',
246
+ required: !context?.token,
247
+ minLength: 1,
248
+ ui: { label: 'Verification Token' },
249
+ },
28
250
  ],
29
- }, ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
251
+ }),
252
+ mapSubmission: (input, context) => {
253
+ const token = resolveToken(input, context?.token);
254
+ if (!token) {
255
+ return undefined;
256
+ }
257
+ return { token };
258
+ },
259
+ };
260
+ const changePasswordFormBridge = {
261
+ resolveFormConfig: () => CHANGE_PASSWORD_FORM_CONFIG,
262
+ mapSubmission: (input) => ({
263
+ currentPassword: readPayloadString(input, 'currentPassword'),
264
+ newPassword: readPayloadString(input, 'newPassword'),
265
+ confirmPassword: readPayloadString(input, 'confirmPassword'),
266
+ }),
267
+ };
268
+ const updateEmailFormBridge = {
269
+ resolveFormConfig: () => UPDATE_EMAIL_FORM_CONFIG,
270
+ mapSubmission: (input) => ({
271
+ newEmail: readPayloadString(input, 'newEmail'),
272
+ password: readPayloadString(input, 'password'),
273
+ }),
274
+ };
275
+ const logoutFormBridge = {
276
+ resolveFormConfig: () => LOGOUT_FORM_CONFIG,
277
+ mapSubmission: (input) => {
278
+ const refreshToken = readPayloadString(input, 'refreshToken') || readStoredString('refreshToken');
279
+ const accessToken = readPayloadString(input, 'accessToken') || readStoredString('accessToken');
280
+ if (!refreshToken) {
281
+ return undefined;
282
+ }
283
+ return {
284
+ refreshToken,
285
+ ...(accessToken ? { accessToken } : {}),
286
+ };
287
+ },
288
+ };
289
+ const refreshTokensFormBridge = {
290
+ resolveFormConfig: () => REFRESH_TOKENS_FORM_CONFIG,
291
+ mapSubmission: (input) => {
292
+ const refreshToken = readPayloadString(input, 'refreshToken') || readStoredString('refreshToken');
293
+ if (!refreshToken) {
294
+ return undefined;
295
+ }
296
+ return { refreshToken };
297
+ },
298
+ };
299
+
300
+ class AnarchitectsAuthUiLoginForm {
301
+ layout = input(null, ...(ngDevMode ? [{ debugName: "layout" }] : []));
302
+ layoutOptions = input({}, ...(ngDevMode ? [{ debugName: "layoutOptions" }] : []));
303
+ submitted = output();
304
+ formConfig = computed(() => loginFormBridge.resolveFormConfig(), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
30
305
  onSubmitted(input) {
31
- this.submitted.emit({
32
- credential: input.payload['credential'],
33
- password: input.payload['password'],
34
- });
306
+ const dto = loginFormBridge.mapSubmission(input);
307
+ if (dto) {
308
+ this.submitted.emit(dto);
309
+ }
35
310
  }
36
311
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AnarchitectsAuthUiLoginForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
37
312
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.6", type: AnarchitectsAuthUiLoginForm, isStandalone: true, selector: "anarchitects-auth-ui-login-form", inputs: { layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, layoutOptions: { classPropertyName: "layoutOptions", publicName: "layoutOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitted: "submitted" }, host: { attributes: { "attr.data-anx-component": "\"auth-ui-login-form\"" }, classAttribute: "anx-domain-component anx-auth-ui-login-form anx-stack" }, ngImport: i0, template: "<anarchitects-forms-ui-form\n [config]=\"formConfig()\"\n [layout]=\"layout()\"\n [layoutOptions]=\"layoutOptions()\"\n (submitted)=\"onSubmitted($event)\"\n>\n <ng-content select=\"ng-template[anxTemplate]\"></ng-content>\n <ng-content select=\"[anxSlot]\"></ng-content>\n</anarchitects-forms-ui-form>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: AnarchitectsUiForm, selector: "anarchitects-forms-ui-form", inputs: ["config", "runtimeValidators", "layout", "layoutOptions"], outputs: ["submitted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -48,46 +323,12 @@ class AnarchitectsAuthUiRegisterForm {
48
323
  layout = input(null, ...(ngDevMode ? [{ debugName: "layout" }] : []));
49
324
  layoutOptions = input({}, ...(ngDevMode ? [{ debugName: "layoutOptions" }] : []));
50
325
  submitted = output();
51
- formConfig = signal({
52
- id: 'register',
53
- version: 1,
54
- fields: [
55
- {
56
- name: 'userName',
57
- kind: 'string',
58
- ui: { label: 'Username' },
59
- required: false,
60
- },
61
- { name: 'email', kind: 'email', ui: { label: 'Email' }, required: true },
62
- {
63
- name: 'password',
64
- kind: 'password',
65
- ui: { label: 'Password' },
66
- required: true,
67
- },
68
- {
69
- name: 'confirmPassword',
70
- kind: 'password',
71
- ui: { label: 'Confirm Password' },
72
- required: true,
73
- },
74
- ],
75
- validationRules: [
76
- {
77
- kind: 'matchFields',
78
- sourceField: 'password',
79
- targetField: 'confirmPassword',
80
- message: 'Passwords must match.',
81
- },
82
- ],
83
- }, ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
326
+ formConfig = computed(() => registerFormBridge.resolveFormConfig(), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
84
327
  onSubmitted(input) {
85
- this.submitted.emit({
86
- userName: input.payload['userName'],
87
- email: input.payload['email'],
88
- password: input.payload['password'],
89
- confirmPassword: input.payload['confirmPassword'],
90
- });
328
+ const dto = registerFormBridge.mapSubmission(input);
329
+ if (dto) {
330
+ this.submitted.emit(dto);
331
+ }
91
332
  }
92
333
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AnarchitectsAuthUiRegisterForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
93
334
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.6", type: AnarchitectsAuthUiRegisterForm, isStandalone: true, selector: "anarchitects-auth-ui-register-form", inputs: { layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, layoutOptions: { classPropertyName: "layoutOptions", publicName: "layoutOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitted: "submitted" }, host: { attributes: { "attr.data-anx-component": "\"auth-ui-register-form\"" }, classAttribute: "anx-domain-component anx-auth-ui-register-form anx-stack" }, ngImport: i0, template: "<anarchitects-forms-ui-form\n [config]=\"formConfig()\"\n [layout]=\"layout()\"\n [layoutOptions]=\"layoutOptions()\"\n (submitted)=\"onSubmitted($event)\"\n>\n <ng-content select=\"ng-template[anxTemplate]\"></ng-content>\n <ng-content select=\"[anxSlot]\"></ng-content>\n</anarchitects-forms-ui-form>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: AnarchitectsUiForm, selector: "anarchitects-forms-ui-form", inputs: ["config", "runtimeValidators", "layout", "layoutOptions"], outputs: ["submitted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -105,25 +346,14 @@ class AnarchitectsAuthUiActivateUserForm {
105
346
  layout = input(null, ...(ngDevMode ? [{ debugName: "layout" }] : []));
106
347
  layoutOptions = input({}, ...(ngDevMode ? [{ debugName: "layoutOptions" }] : []));
107
348
  submitted = output();
108
- formConfig = computed(() => ({
109
- id: 'activate-user',
110
- version: 1,
111
- fields: [
112
- {
113
- name: 'token',
114
- kind: 'string',
115
- required: !this.token(),
116
- minLength: 1,
117
- ui: { label: 'Activation Token' },
118
- },
119
- ],
120
- }), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
349
+ formConfig = computed(() => activateUserFormBridge.resolveFormConfig({ token: this.token() }), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
121
350
  onSubmitted(input) {
122
- const token = input.payload['token'] || this.token();
123
- if (!token) {
124
- return;
351
+ const dto = activateUserFormBridge.mapSubmission(input, {
352
+ token: this.token(),
353
+ });
354
+ if (dto) {
355
+ this.submitted.emit(dto);
125
356
  }
126
- this.submitted.emit({ token });
127
357
  }
128
358
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AnarchitectsAuthUiActivateUserForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
129
359
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.6", type: AnarchitectsAuthUiActivateUserForm, isStandalone: true, selector: "anarchitects-auth-ui-activate-user-form", inputs: { token: { classPropertyName: "token", publicName: "token", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, layoutOptions: { classPropertyName: "layoutOptions", publicName: "layoutOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitted: "submitted" }, host: { attributes: { "attr.data-anx-component": "\"auth-ui-activate-user-form\"" }, classAttribute: "anx-domain-component anx-auth-ui-activate-user-form anx-stack" }, ngImport: i0, template: "<anarchitects-forms-ui-form\n [config]=\"formConfig()\"\n [layout]=\"layout()\"\n [layoutOptions]=\"layoutOptions()\"\n (submitted)=\"onSubmitted($event)\"\n>\n <ng-content select=\"ng-template[anxTemplate]\"></ng-content>\n <ng-content select=\"[anxSlot]\"></ng-content>\n</anarchitects-forms-ui-form>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: AnarchitectsUiForm, selector: "anarchitects-forms-ui-form", inputs: ["config", "runtimeValidators", "layout", "layoutOptions"], outputs: ["submitted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -140,22 +370,12 @@ class AnarchitectsAuthUiForgotPasswordForm {
140
370
  layout = input(null, ...(ngDevMode ? [{ debugName: "layout" }] : []));
141
371
  layoutOptions = input({}, ...(ngDevMode ? [{ debugName: "layoutOptions" }] : []));
142
372
  submitted = output();
143
- formConfig = signal({
144
- id: 'forgot-password',
145
- version: 1,
146
- fields: [
147
- {
148
- name: 'email',
149
- kind: 'email',
150
- required: true,
151
- ui: { label: 'Email' },
152
- },
153
- ],
154
- }, ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
373
+ formConfig = computed(() => forgotPasswordFormBridge.resolveFormConfig(), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
155
374
  onSubmitted(input) {
156
- this.submitted.emit({
157
- email: input.payload['email'],
158
- });
375
+ const dto = forgotPasswordFormBridge.mapSubmission(input);
376
+ if (dto) {
377
+ this.submitted.emit(dto);
378
+ }
159
379
  }
160
380
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AnarchitectsAuthUiForgotPasswordForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
161
381
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.6", type: AnarchitectsAuthUiForgotPasswordForm, isStandalone: true, selector: "anarchitects-auth-ui-forgot-password-form", inputs: { layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, layoutOptions: { classPropertyName: "layoutOptions", publicName: "layoutOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitted: "submitted" }, host: { attributes: { "attr.data-anx-component": "\"auth-ui-forgot-password-form\"" }, classAttribute: "anx-domain-component anx-auth-ui-forgot-password-form anx-stack" }, ngImport: i0, template: "<anarchitects-forms-ui-form\n [config]=\"formConfig()\"\n [layout]=\"layout()\"\n [layoutOptions]=\"layoutOptions()\"\n (submitted)=\"onSubmitted($event)\"\n>\n <ng-content select=\"ng-template[anxTemplate]\"></ng-content>\n <ng-content select=\"[anxSlot]\"></ng-content>\n</anarchitects-forms-ui-form>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: AnarchitectsUiForm, selector: "anarchitects-forms-ui-form", inputs: ["config", "runtimeValidators", "layout", "layoutOptions"], outputs: ["submitted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -173,51 +393,14 @@ class AnarchitectsAuthUiResetPasswordForm {
173
393
  layout = input(null, ...(ngDevMode ? [{ debugName: "layout" }] : []));
174
394
  layoutOptions = input({}, ...(ngDevMode ? [{ debugName: "layoutOptions" }] : []));
175
395
  submitted = output();
176
- formConfig = computed(() => ({
177
- id: 'reset-password',
178
- version: 1,
179
- fields: [
180
- {
181
- name: 'token',
182
- kind: 'string',
183
- required: !this.token(),
184
- minLength: 1,
185
- ui: { label: 'Reset Token' },
186
- },
187
- {
188
- name: 'password',
189
- kind: 'password',
190
- required: true,
191
- minLength: 6,
192
- ui: { label: 'Password' },
193
- },
194
- {
195
- name: 'confirmPassword',
196
- kind: 'password',
197
- required: true,
198
- minLength: 6,
199
- ui: { label: 'Confirm Password' },
200
- },
201
- ],
202
- validationRules: [
203
- {
204
- kind: 'matchFields',
205
- sourceField: 'password',
206
- targetField: 'confirmPassword',
207
- message: 'Passwords must match.',
208
- },
209
- ],
210
- }), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
396
+ formConfig = computed(() => resetPasswordFormBridge.resolveFormConfig({ token: this.token() }), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
211
397
  onSubmitted(input) {
212
- const token = input.payload['token'] || this.token();
213
- if (!token) {
214
- return;
215
- }
216
- this.submitted.emit({
217
- token,
218
- password: input.payload['password'],
219
- confirmPassword: input.payload['confirmPassword'],
398
+ const dto = resetPasswordFormBridge.mapSubmission(input, {
399
+ token: this.token(),
220
400
  });
401
+ if (dto) {
402
+ this.submitted.emit(dto);
403
+ }
221
404
  }
222
405
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AnarchitectsAuthUiResetPasswordForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
223
406
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.6", type: AnarchitectsAuthUiResetPasswordForm, isStandalone: true, selector: "anarchitects-auth-ui-reset-password-form", inputs: { token: { classPropertyName: "token", publicName: "token", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, layoutOptions: { classPropertyName: "layoutOptions", publicName: "layoutOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitted: "submitted" }, host: { attributes: { "attr.data-anx-component": "\"auth-ui-reset-password-form\"" }, classAttribute: "anx-domain-component anx-auth-ui-reset-password-form anx-stack" }, ngImport: i0, template: "<anarchitects-forms-ui-form\n [config]=\"formConfig()\"\n [layout]=\"layout()\"\n [layoutOptions]=\"layoutOptions()\"\n (submitted)=\"onSubmitted($event)\"\n>\n <ng-content select=\"ng-template[anxTemplate]\"></ng-content>\n <ng-content select=\"[anxSlot]\"></ng-content>\n</anarchitects-forms-ui-form>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: AnarchitectsUiForm, selector: "anarchitects-forms-ui-form", inputs: ["config", "runtimeValidators", "layout", "layoutOptions"], outputs: ["submitted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -235,25 +418,14 @@ class AnarchitectsAuthUiVerifyEmailForm {
235
418
  layout = input(null, ...(ngDevMode ? [{ debugName: "layout" }] : []));
236
419
  layoutOptions = input({}, ...(ngDevMode ? [{ debugName: "layoutOptions" }] : []));
237
420
  submitted = output();
238
- formConfig = computed(() => ({
239
- id: 'verify-email',
240
- version: 1,
241
- fields: [
242
- {
243
- name: 'token',
244
- kind: 'string',
245
- required: !this.token(),
246
- minLength: 1,
247
- ui: { label: 'Verification Token' },
248
- },
249
- ],
250
- }), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
421
+ formConfig = computed(() => verifyEmailFormBridge.resolveFormConfig({ token: this.token() }), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
251
422
  onSubmitted(input) {
252
- const token = input.payload['token'] || this.token();
253
- if (!token) {
254
- return;
423
+ const dto = verifyEmailFormBridge.mapSubmission(input, {
424
+ token: this.token(),
425
+ });
426
+ if (dto) {
427
+ this.submitted.emit(dto);
255
428
  }
256
- this.submitted.emit({ token });
257
429
  }
258
430
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AnarchitectsAuthUiVerifyEmailForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
259
431
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.6", type: AnarchitectsAuthUiVerifyEmailForm, isStandalone: true, selector: "anarchitects-auth-ui-verify-email-form", inputs: { token: { classPropertyName: "token", publicName: "token", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, layoutOptions: { classPropertyName: "layoutOptions", publicName: "layoutOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitted: "submitted" }, host: { attributes: { "attr.data-anx-component": "\"auth-ui-verify-email-form\"" }, classAttribute: "anx-domain-component anx-auth-ui-verify-email-form anx-stack" }, ngImport: i0, template: "<anarchitects-forms-ui-form\n [config]=\"formConfig()\"\n [layout]=\"layout()\"\n [layoutOptions]=\"layoutOptions()\"\n (submitted)=\"onSubmitted($event)\"\n>\n <ng-content select=\"ng-template[anxTemplate]\"></ng-content>\n <ng-content select=\"[anxSlot]\"></ng-content>\n</anarchitects-forms-ui-form>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: AnarchitectsUiForm, selector: "anarchitects-forms-ui-form", inputs: ["config", "runtimeValidators", "layout", "layoutOptions"], outputs: ["submitted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -270,47 +442,12 @@ class AnarchitectsAuthUiChangePasswordForm {
270
442
  layout = input(null, ...(ngDevMode ? [{ debugName: "layout" }] : []));
271
443
  layoutOptions = input({}, ...(ngDevMode ? [{ debugName: "layoutOptions" }] : []));
272
444
  submitted = output();
273
- formConfig = signal({
274
- id: 'change-password',
275
- version: 1,
276
- fields: [
277
- {
278
- name: 'currentPassword',
279
- kind: 'password',
280
- required: true,
281
- minLength: 6,
282
- ui: { label: 'Current Password' },
283
- },
284
- {
285
- name: 'newPassword',
286
- kind: 'password',
287
- required: true,
288
- minLength: 6,
289
- ui: { label: 'New Password' },
290
- },
291
- {
292
- name: 'confirmPassword',
293
- kind: 'password',
294
- required: true,
295
- minLength: 6,
296
- ui: { label: 'Confirm Password' },
297
- },
298
- ],
299
- validationRules: [
300
- {
301
- kind: 'matchFields',
302
- sourceField: 'newPassword',
303
- targetField: 'confirmPassword',
304
- message: 'Passwords must match.',
305
- },
306
- ],
307
- }, ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
445
+ formConfig = computed(() => changePasswordFormBridge.resolveFormConfig(), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
308
446
  onSubmitted(input) {
309
- this.submitted.emit({
310
- currentPassword: input.payload['currentPassword'],
311
- newPassword: input.payload['newPassword'],
312
- confirmPassword: input.payload['confirmPassword'],
313
- });
447
+ const dto = changePasswordFormBridge.mapSubmission(input);
448
+ if (dto) {
449
+ this.submitted.emit(dto);
450
+ }
314
451
  }
315
452
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AnarchitectsAuthUiChangePasswordForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
316
453
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.6", type: AnarchitectsAuthUiChangePasswordForm, isStandalone: true, selector: "anarchitects-auth-ui-change-password-form", inputs: { layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, layoutOptions: { classPropertyName: "layoutOptions", publicName: "layoutOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitted: "submitted" }, host: { attributes: { "attr.data-anx-component": "\"auth-ui-change-password-form\"" }, classAttribute: "anx-domain-component anx-auth-ui-change-password-form anx-stack" }, ngImport: i0, template: "<anarchitects-forms-ui-form\n [config]=\"formConfig()\"\n [layout]=\"layout()\"\n [layoutOptions]=\"layoutOptions()\"\n (submitted)=\"onSubmitted($event)\"\n>\n <ng-content select=\"ng-template[anxTemplate]\"></ng-content>\n <ng-content select=\"[anxSlot]\"></ng-content>\n</anarchitects-forms-ui-form>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: AnarchitectsUiForm, selector: "anarchitects-forms-ui-form", inputs: ["config", "runtimeValidators", "layout", "layoutOptions"], outputs: ["submitted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -327,30 +464,12 @@ class AnarchitectsAuthUiUpdateEmailForm {
327
464
  layout = input(null, ...(ngDevMode ? [{ debugName: "layout" }] : []));
328
465
  layoutOptions = input({}, ...(ngDevMode ? [{ debugName: "layoutOptions" }] : []));
329
466
  submitted = output();
330
- formConfig = signal({
331
- id: 'update-email',
332
- version: 1,
333
- fields: [
334
- {
335
- name: 'newEmail',
336
- kind: 'email',
337
- required: true,
338
- ui: { label: 'New Email' },
339
- },
340
- {
341
- name: 'password',
342
- kind: 'password',
343
- required: true,
344
- minLength: 6,
345
- ui: { label: 'Password' },
346
- },
347
- ],
348
- }, ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
467
+ formConfig = computed(() => updateEmailFormBridge.resolveFormConfig(), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
349
468
  onSubmitted(input) {
350
- this.submitted.emit({
351
- newEmail: input.payload['newEmail'],
352
- password: input.payload['password'],
353
- });
469
+ const dto = updateEmailFormBridge.mapSubmission(input);
470
+ if (dto) {
471
+ this.submitted.emit(dto);
472
+ }
354
473
  }
355
474
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AnarchitectsAuthUiUpdateEmailForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
356
475
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.6", type: AnarchitectsAuthUiUpdateEmailForm, isStandalone: true, selector: "anarchitects-auth-ui-update-email-form", inputs: { layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, layoutOptions: { classPropertyName: "layoutOptions", publicName: "layoutOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitted: "submitted" }, host: { attributes: { "attr.data-anx-component": "\"auth-ui-update-email-form\"" }, classAttribute: "anx-domain-component anx-auth-ui-update-email-form anx-stack" }, ngImport: i0, template: "<anarchitects-forms-ui-form\n [config]=\"formConfig()\"\n [layout]=\"layout()\"\n [layoutOptions]=\"layoutOptions()\"\n (submitted)=\"onSubmitted($event)\"\n>\n <ng-content select=\"ng-template[anxTemplate]\"></ng-content>\n <ng-content select=\"[anxSlot]\"></ng-content>\n</anarchitects-forms-ui-form>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: AnarchitectsUiForm, selector: "anarchitects-forms-ui-form", inputs: ["config", "runtimeValidators", "layout", "layoutOptions"], outputs: ["submitted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -367,40 +486,12 @@ class AnarchitectsAuthUiLogoutForm {
367
486
  layout = input(null, ...(ngDevMode ? [{ debugName: "layout" }] : []));
368
487
  layoutOptions = input({}, ...(ngDevMode ? [{ debugName: "layoutOptions" }] : []));
369
488
  submitted = output();
370
- formConfig = signal({
371
- id: 'logout',
372
- version: 1,
373
- fields: [
374
- {
375
- name: 'refreshToken',
376
- kind: 'string',
377
- required: false,
378
- minLength: 1,
379
- ui: { label: 'Refresh Token' },
380
- },
381
- {
382
- name: 'accessToken',
383
- kind: 'string',
384
- required: false,
385
- minLength: 1,
386
- ui: { label: 'Access Token (optional)' },
387
- },
388
- ],
389
- }, ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
489
+ formConfig = computed(() => logoutFormBridge.resolveFormConfig(), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
390
490
  onSubmitted(input) {
391
- const refreshToken = input.payload['refreshToken'] ||
392
- localStorage.getItem('refreshToken') ||
393
- undefined;
394
- const accessToken = input.payload['accessToken'] ||
395
- localStorage.getItem('accessToken') ||
396
- undefined;
397
- if (!refreshToken) {
398
- return;
491
+ const dto = logoutFormBridge.mapSubmission(input);
492
+ if (dto) {
493
+ this.submitted.emit(dto);
399
494
  }
400
- this.submitted.emit({
401
- refreshToken,
402
- ...(accessToken ? { accessToken } : {}),
403
- });
404
495
  }
405
496
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AnarchitectsAuthUiLogoutForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
406
497
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.6", type: AnarchitectsAuthUiLogoutForm, isStandalone: true, selector: "anarchitects-auth-ui-logout-form", inputs: { layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, layoutOptions: { classPropertyName: "layoutOptions", publicName: "layoutOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitted: "submitted" }, host: { attributes: { "attr.data-anx-component": "\"auth-ui-logout-form\"" }, classAttribute: "anx-domain-component anx-auth-ui-logout-form anx-stack" }, ngImport: i0, template: "<anarchitects-forms-ui-form\n [config]=\"formConfig()\"\n [layout]=\"layout()\"\n [layoutOptions]=\"layoutOptions()\"\n (submitted)=\"onSubmitted($event)\"\n>\n <ng-content select=\"ng-template[anxTemplate]\"></ng-content>\n <ng-content select=\"[anxSlot]\"></ng-content>\n</anarchitects-forms-ui-form>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: AnarchitectsUiForm, selector: "anarchitects-forms-ui-form", inputs: ["config", "runtimeValidators", "layout", "layoutOptions"], outputs: ["submitted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -417,27 +508,12 @@ class AnarchitectsAuthUiRefreshTokensForm {
417
508
  layout = input(null, ...(ngDevMode ? [{ debugName: "layout" }] : []));
418
509
  layoutOptions = input({}, ...(ngDevMode ? [{ debugName: "layoutOptions" }] : []));
419
510
  submitted = output();
420
- formConfig = signal({
421
- id: 'refresh-tokens',
422
- version: 1,
423
- fields: [
424
- {
425
- name: 'refreshToken',
426
- kind: 'string',
427
- required: false,
428
- minLength: 1,
429
- ui: { label: 'Refresh Token' },
430
- },
431
- ],
432
- }, ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
511
+ formConfig = computed(() => refreshTokensFormBridge.resolveFormConfig(), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
433
512
  onSubmitted(input) {
434
- const refreshToken = input.payload['refreshToken'] ||
435
- localStorage.getItem('refreshToken') ||
436
- undefined;
437
- if (!refreshToken) {
438
- return;
513
+ const dto = refreshTokensFormBridge.mapSubmission(input);
514
+ if (dto) {
515
+ this.submitted.emit(dto);
439
516
  }
440
- this.submitted.emit({ refreshToken });
441
517
  }
442
518
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AnarchitectsAuthUiRefreshTokensForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
443
519
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.6", type: AnarchitectsAuthUiRefreshTokensForm, isStandalone: true, selector: "anarchitects-auth-ui-refresh-tokens-form", inputs: { layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, layoutOptions: { classPropertyName: "layoutOptions", publicName: "layoutOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitted: "submitted" }, host: { attributes: { "attr.data-anx-component": "\"auth-ui-refresh-tokens-form\"" }, classAttribute: "anx-domain-component anx-auth-ui-refresh-tokens-form anx-stack" }, ngImport: i0, template: "<anarchitects-forms-ui-form\n [config]=\"formConfig()\"\n [layout]=\"layout()\"\n [layoutOptions]=\"layoutOptions()\"\n (submitted)=\"onSubmitted($event)\"\n>\n <ng-content select=\"ng-template[anxTemplate]\"></ng-content>\n <ng-content select=\"[anxSlot]\"></ng-content>\n</anarchitects-forms-ui-form>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: AnarchitectsUiForm, selector: "anarchitects-forms-ui-form", inputs: ["config", "runtimeValidators", "layout", "layoutOptions"], outputs: ["submitted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });