@keycloakify/angular 0.0.11 → 0.1.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.
Files changed (61) hide show
  1. package/bin/108.index.js +242 -0
  2. package/bin/338.index.js +104 -54
  3. package/bin/402.index.js +1250 -0
  4. package/bin/758.index.js +777 -53
  5. package/bin/{925.index.js → 84.index.js} +124 -624
  6. package/bin/main.js +59 -4
  7. package/package.json +1 -1
  8. package/src/bin/add-story.ts +126 -0
  9. package/src/bin/eject-page.ts +49 -11
  10. package/src/bin/initialize-account-theme/boilerplate/KcContextMock.ts +47 -1
  11. package/src/bin/main.ts +2 -4
  12. package/src/bin/tools/nodeModulesBinDirPath.ts +38 -0
  13. package/src/bin/tools/runPrettier.ts +89 -0
  14. package/src/bin/tools/transformCodebase_async.ts +89 -0
  15. package/src/bin/update-kc-gen.ts +20 -15
  16. package/stories/account/pages/account.stories.ts +133 -0
  17. package/stories/account/pages/applications.stories.ts +196 -0
  18. package/stories/account/pages/federated-identity.stories.ts +78 -0
  19. package/stories/account/pages/log.stories.ts +147 -0
  20. package/stories/account/pages/password.stories.ts +104 -0
  21. package/stories/account/pages/sessions.stories.ts +143 -0
  22. package/stories/account/pages/totp.stories.ts +100 -0
  23. package/stories/login/pages/code.stories.ts +51 -0
  24. package/stories/login/pages/delete-account-confirm.stories.ts +43 -0
  25. package/stories/login/pages/delete-credential.stories.ts +56 -0
  26. package/stories/login/pages/error.stories.ts +56 -0
  27. package/stories/login/pages/frontchannel-logout.stories.ts +26 -0
  28. package/stories/login/pages/idp-review-user-profile.stories.ts +60 -0
  29. package/stories/login/pages/info.stories.ts +94 -0
  30. package/stories/login/pages/login-config-totp.stories.ts +57 -0
  31. package/stories/login/pages/login-device-verify-user-code.stories.ts +14 -0
  32. package/stories/login/pages/login-idp-link-confirm-override.stories.ts +17 -0
  33. package/stories/login/pages/login-idp-link-confirm.stories.ts +103 -0
  34. package/stories/login/pages/login-idp-link-email.stories.ts +102 -0
  35. package/stories/login/pages/login-oauth-grant.stories.ts +68 -0
  36. package/stories/login/pages/login-oauth2-device-verify-user-code.stories.ts +15 -0
  37. package/stories/login/pages/login-otp.stories.ts +94 -0
  38. package/stories/login/pages/login-page-expired.stories.ts +31 -0
  39. package/stories/login/pages/login-passkeys-conditional-authenticate.stories.ts +16 -0
  40. package/stories/login/pages/login-password.stories.ts +52 -0
  41. package/stories/login/pages/login-recovery-authn-code-config.stories.ts +31 -0
  42. package/stories/login/pages/login-recovery-authn-code-input.stories.ts +16 -0
  43. package/stories/login/pages/login-reset-otp.stories.ts +71 -0
  44. package/stories/login/pages/login-reset-password.stories.ts +50 -0
  45. package/stories/login/pages/login-update-password.stories.ts +46 -0
  46. package/stories/login/pages/login-update-profile.stories.ts +31 -0
  47. package/stories/login/pages/login-username.stories.ts +28 -0
  48. package/stories/login/pages/login-verify-email.stories.ts +98 -0
  49. package/stories/login/pages/login-x509-info.stories.ts +40 -0
  50. package/stories/login/pages/login.stories.ts +260 -0
  51. package/stories/login/pages/logout-confirm.stories.ts +44 -0
  52. package/stories/login/pages/register.stories.ts +230 -0
  53. package/stories/login/pages/saml-post-form.stories.ts +17 -0
  54. package/stories/login/pages/select-authenticator.stories.ts +95 -0
  55. package/stories/login/pages/terms.stories.ts +79 -0
  56. package/stories/login/pages/update-email.stories.ts +31 -0
  57. package/stories/login/pages/webauthn-authenticate.stories.ts +126 -0
  58. package/stories/login/pages/webauthn-error.stories.ts +62 -0
  59. package/stories/login/pages/webauthn-register.stories.ts +46 -0
  60. package/src/bin/tools/runFormat.ts +0 -71
  61. package/src/stories/login/pages/login/login.stories.ts +0 -146
@@ -0,0 +1,46 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { decorators, KcPageStory } from '../KcPageStory';
3
+
4
+ const meta: Meta<KcPageStory> = {
5
+ title: 'login/login-update-password.ftl',
6
+ component: KcPageStory,
7
+ decorators: decorators,
8
+ globals: {
9
+ pageId: 'login-update-password.ftl'
10
+ }
11
+ };
12
+
13
+ export default meta;
14
+ type Story = StoryObj<KcPageStory>;
15
+
16
+ export const Default: Story = {};
17
+
18
+ export const WithPasswordError: Story = {
19
+ globals: {
20
+ overrides: {
21
+ url: {
22
+ loginAction: '/mock-login-action'
23
+ },
24
+ messagesPerField: {
25
+ existsError: (field: string) => field === 'password',
26
+ get: () => 'Password must be at least 8 characters long.'
27
+ },
28
+ isAppInitiatedAction: false
29
+ }
30
+ }
31
+ };
32
+
33
+ export const WithPasswordConfirmError: Story = {
34
+ globals: {
35
+ overrides: {
36
+ url: {
37
+ loginAction: '/mock-login-action'
38
+ },
39
+ messagesPerField: {
40
+ existsError: (field: string) => field === 'password-confirm',
41
+ get: () => 'Passwords do not match.'
42
+ },
43
+ isAppInitiatedAction: false
44
+ }
45
+ }
46
+ };
@@ -0,0 +1,31 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { decorators, KcPageStory } from '../KcPageStory';
3
+
4
+ const meta: Meta<KcPageStory> = {
5
+ title: 'login/login-update-profile.ftl',
6
+ component: KcPageStory,
7
+ decorators: decorators,
8
+ globals: {
9
+ pageId: 'login-update-profile.ftl'
10
+ }
11
+ };
12
+
13
+ export default meta;
14
+ type Story = StoryObj<KcPageStory>;
15
+
16
+ export const Default: Story = {};
17
+
18
+ export const WithProfileError: Story = {
19
+ globals: {
20
+ overrides: {
21
+ url: {
22
+ loginAction: '/mock-login-action'
23
+ },
24
+ messagesPerField: {
25
+ existsError: (field: string) => field === 'email',
26
+ get: () => 'Invalid email format'
27
+ },
28
+ isAppInitiatedAction: false
29
+ }
30
+ }
31
+ };
@@ -0,0 +1,28 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { decorators, KcPageStory } from '../KcPageStory';
3
+
4
+ const meta: Meta<KcPageStory> = {
5
+ title: 'login/login-username.ftl',
6
+ component: KcPageStory,
7
+ decorators: decorators,
8
+ globals: {
9
+ pageId: 'login-username.ftl'
10
+ }
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<KcPageStory>;
16
+
17
+ export const Default: Story = {};
18
+
19
+ export const WithEmailAsUsername: Story = {
20
+ globals: {
21
+ overrides: {
22
+ realm: {
23
+ loginWithEmailAllowed: true,
24
+ registrationEmailAsUsername: true
25
+ }
26
+ }
27
+ }
28
+ };
@@ -0,0 +1,98 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { decorators, KcPageStory } from '../KcPageStory';
3
+
4
+ const meta: Meta<KcPageStory> = {
5
+ title: 'login/login-verify-email.ftl',
6
+ component: KcPageStory,
7
+ decorators: decorators,
8
+ globals: {
9
+ pageId: 'login-verify-email.ftl'
10
+ }
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<KcPageStory>;
16
+
17
+ export const Default: Story = {
18
+ globals: {
19
+ overrides: {
20
+ message: {
21
+ summary: 'You need to verify your email to activate your account.',
22
+ type: 'warning'
23
+ },
24
+ user: {
25
+ email: 'john.doe@gmail.com'
26
+ }
27
+ }
28
+ }
29
+ };
30
+
31
+ /**
32
+ * WithSuccessMessage:
33
+ * - Purpose: Tests when the email verification is successful, and the user receives a confirmation message.
34
+ * - Scenario: The component renders a success message instead of a warning or error.
35
+ * - Key Aspect: Ensures the success message is displayed correctly when the email is successfully verified.
36
+ */
37
+ export const WithSuccessMessage: Story = {
38
+ globals: {
39
+ overrides: {
40
+ message: {
41
+ summary: 'Your email has been successfully verified.',
42
+ type: 'success'
43
+ },
44
+ user: {
45
+ email: 'john.doe@gmail.com'
46
+ },
47
+ url: {
48
+ loginAction: '/mock-login-action'
49
+ }
50
+ }
51
+ }
52
+ };
53
+
54
+ /**
55
+ * WithErrorMessage:
56
+ * - Purpose: Tests when there is an error during the email verification process.
57
+ * - Scenario: The component renders an error message indicating the email verification failed.
58
+ * - Key Aspect: Ensures the error message is shown correctly when the verification process encounters an issue.
59
+ */
60
+ export const WithErrorMessage: Story = {
61
+ globals: {
62
+ overrides: {
63
+ message: {
64
+ summary: 'There was an error verifying your email. Please try again.',
65
+ type: 'error'
66
+ },
67
+ user: {
68
+ email: 'john.doe@gmail.com'
69
+ },
70
+ url: {
71
+ loginAction: '/mock-login-action'
72
+ }
73
+ }
74
+ }
75
+ };
76
+
77
+ /**
78
+ * WithInfoMessage:
79
+ * - Purpose: Tests when the user is prompted to verify their email without any urgency.
80
+ * - Scenario: The component renders with an informational message for email verification.
81
+ * - Key Aspect: Ensures the informational message is displayed properly.
82
+ */
83
+ export const WithInfoMessage: Story = {
84
+ globals: {
85
+ overrides: {
86
+ message: {
87
+ summary: 'Please verify your email to continue using our services.',
88
+ type: 'info'
89
+ },
90
+ user: {
91
+ email: 'john.doe@gmail.com'
92
+ },
93
+ url: {
94
+ loginAction: '/mock-login-action'
95
+ }
96
+ }
97
+ }
98
+ };
@@ -0,0 +1,40 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { decorators, KcPageStory } from '../KcPageStory';
3
+
4
+ const meta: Meta<KcPageStory> = {
5
+ title: 'login/login-x509-info.ftl',
6
+ component: KcPageStory,
7
+ decorators: decorators,
8
+ globals: {
9
+ pageId: 'login-x509-info.ftl'
10
+ }
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<KcPageStory>;
16
+
17
+ export const Default: Story = {};
18
+
19
+ /**
20
+ * WithoutUserEnabled:
21
+ * - Purpose: Tests when the user is not enabled to log in via x509.
22
+ * - Scenario: The component renders the certificate details but does not provide the option to log in or cancel.
23
+ * - Key Aspect: Ensures that the login buttons are not displayed when the user is not enabled.
24
+ */
25
+ export const WithoutUserEnabled: Story = {
26
+ globals: {
27
+ overrides: {
28
+ url: {
29
+ loginAction: '/mock-login-action'
30
+ },
31
+ x509: {
32
+ formData: {
33
+ subjectDN: 'CN=John Doe, OU=Example Org, O=Example Inc, C=US',
34
+ username: 'johndoe',
35
+ isUserEnabled: false // User not enabled for login
36
+ }
37
+ }
38
+ }
39
+ }
40
+ };
@@ -0,0 +1,260 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { decorators, KcPageStory } from '../KcPageStory';
3
+
4
+ const meta: Meta<KcPageStory> = {
5
+ title: 'login/login.ftl',
6
+ component: KcPageStory,
7
+ decorators: decorators,
8
+ globals: {
9
+ pageId: 'login.ftl'
10
+ }
11
+ };
12
+
13
+ export default meta;
14
+ type Story = StoryObj<KcPageStory>;
15
+
16
+ export const Default: Story = {};
17
+
18
+ export const WithInvalidCredential: Story = {
19
+ globals: {
20
+ overrides: {
21
+ login: {
22
+ username: 'johndoe'
23
+ },
24
+ messagesPerField: {
25
+ existsError: (fieldName: string, ...otherFieldNames: string[]) => {
26
+ const fieldNames = [fieldName, ...otherFieldNames];
27
+ return (
28
+ fieldNames.includes('username') || fieldNames.includes('password')
29
+ );
30
+ },
31
+ get: (fieldName: string) => {
32
+ return fieldName === 'username' || fieldName === 'password'
33
+ ? 'Invalid username or password.'
34
+ : '';
35
+ }
36
+ }
37
+ }
38
+ }
39
+ };
40
+
41
+ export const WithoutRegistration: Story = {
42
+ globals: {
43
+ overrides: {
44
+ realm: { registrationAllowed: false }
45
+ }
46
+ }
47
+ };
48
+
49
+ export const WithoutRememberMe: Story = {
50
+ globals: {
51
+ overrides: {
52
+ realm: { rememberMe: false }
53
+ }
54
+ }
55
+ };
56
+
57
+ export const WithoutPasswordReset: Story = {
58
+ globals: {
59
+ overrides: {
60
+ realm: { resetPasswordAllowed: false }
61
+ }
62
+ }
63
+ };
64
+
65
+ export const WithEmailAsUsername: Story = {
66
+ globals: {
67
+ overrides: {
68
+ realm: { loginWithEmailAllowed: false }
69
+ }
70
+ }
71
+ };
72
+
73
+ export const WithPresetUsername: Story = {
74
+ globals: {
75
+ overrides: {
76
+ login: { username: 'max.mustermann@mail.com' }
77
+ }
78
+ }
79
+ };
80
+
81
+ export const WithImmutablePresetUsername: Story = {
82
+ globals: {
83
+ overrides: {
84
+ auth: {
85
+ attemptedUsername: 'max.mustermann@mail.com',
86
+ showUsername: true
87
+ },
88
+ usernameHidden: true,
89
+ message: {
90
+ type: 'info',
91
+ summary: 'Please re-authenticate to continue'
92
+ }
93
+ }
94
+ }
95
+ };
96
+
97
+ export const WithSocialProviders: Story = {
98
+ globals: {
99
+ overrides: {
100
+ social: {
101
+ displayInfo: true,
102
+ providers: [
103
+ {
104
+ loginUrl: 'google',
105
+ alias: 'google',
106
+ providerId: 'google',
107
+ displayName: 'Google',
108
+ iconClasses: 'fa fa-google'
109
+ },
110
+ {
111
+ loginUrl: 'microsoft',
112
+ alias: 'microsoft',
113
+ providerId: 'microsoft',
114
+ displayName: 'Microsoft',
115
+ iconClasses: 'fa fa-windows'
116
+ },
117
+ {
118
+ loginUrl: 'facebook',
119
+ alias: 'facebook',
120
+ providerId: 'facebook',
121
+ displayName: 'Facebook',
122
+ iconClasses: 'fa fa-facebook'
123
+ },
124
+ {
125
+ loginUrl: 'github',
126
+ alias: 'github',
127
+ providerId: 'github',
128
+ displayName: 'Github',
129
+ iconClasses: 'fa fa-github'
130
+ }
131
+ ]
132
+ }
133
+ }
134
+ }
135
+ };
136
+
137
+ export const WithoutPasswordField: Story = {
138
+ globals: {
139
+ overrides: {
140
+ realm: { password: false }
141
+ }
142
+ }
143
+ };
144
+
145
+ export const WithErrorMessage: Story = {
146
+ globals: {
147
+ overrides: {
148
+ message: {
149
+ summary:
150
+ 'The time allotted for the connection has elapsed.<br/>The login process will restart from the beginning.',
151
+ type: 'error'
152
+ }
153
+ }
154
+ }
155
+ };
156
+
157
+ export const WithOneSocialProvider: Story = {
158
+ globals: {
159
+ overrides: {
160
+ social: {
161
+ displayInfo: true,
162
+ providers: [
163
+ {
164
+ loginUrl: 'google',
165
+ alias: 'google',
166
+ providerId: 'google',
167
+ displayName: 'Google',
168
+ iconClasses: 'fa fa-google'
169
+ }
170
+ ]
171
+ }
172
+ }
173
+ }
174
+ };
175
+
176
+ export const WithTwoSocialProviders: Story = {
177
+ globals: {
178
+ overrides: {
179
+ social: {
180
+ displayInfo: true,
181
+ providers: [
182
+ {
183
+ loginUrl: 'google',
184
+ alias: 'google',
185
+ providerId: 'google',
186
+ displayName: 'Google',
187
+ iconClasses: 'fa fa-google'
188
+ },
189
+ {
190
+ loginUrl: 'microsoft',
191
+ alias: 'microsoft',
192
+ providerId: 'microsoft',
193
+ displayName: 'Microsoft',
194
+ iconClasses: 'fa fa-windows'
195
+ }
196
+ ]
197
+ }
198
+ }
199
+ }
200
+ };
201
+
202
+ export const WithMoreThanTwoSocialProviders: Story = {
203
+ globals: {
204
+ overrides: {
205
+ social: {
206
+ displayInfo: true,
207
+ providers: [
208
+ {
209
+ loginUrl: 'google',
210
+ alias: 'google',
211
+ providerId: 'google',
212
+ displayName: 'Google',
213
+ iconClasses: 'fa fa-google'
214
+ },
215
+ {
216
+ loginUrl: 'microsoft',
217
+ alias: 'microsoft',
218
+ providerId: 'microsoft',
219
+ displayName: 'Microsoft',
220
+ iconClasses: 'fa fa-windows'
221
+ },
222
+ {
223
+ loginUrl: 'facebook',
224
+ alias: 'facebook',
225
+ providerId: 'facebook',
226
+ displayName: 'Facebook',
227
+ iconClasses: 'fa fa-facebook'
228
+ },
229
+ {
230
+ loginUrl: 'twitter',
231
+ alias: 'twitter',
232
+ providerId: 'twitter',
233
+ displayName: 'Twitter',
234
+ iconClasses: 'fa fa-twitter'
235
+ }
236
+ ]
237
+ }
238
+ }
239
+ }
240
+ };
241
+
242
+ export const WithSocialProvidersAndWithoutRememberMe: Story = {
243
+ globals: {
244
+ overrides: {
245
+ social: {
246
+ displayInfo: true,
247
+ providers: [
248
+ {
249
+ loginUrl: 'google',
250
+ alias: 'google',
251
+ providerId: 'google',
252
+ displayName: 'Google',
253
+ iconClasses: 'fa fa-google'
254
+ }
255
+ ]
256
+ },
257
+ realm: { rememberMe: false }
258
+ }
259
+ }
260
+ };
@@ -0,0 +1,44 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { decorators, KcPageStory } from '../KcPageStory';
3
+
4
+ const meta: Meta<KcPageStory> = {
5
+ title: 'login/logout-confirm.ftl',
6
+ component: KcPageStory,
7
+ decorators: decorators,
8
+ globals: {
9
+ pageId: 'logout-confirm.ftl'
10
+ }
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<KcPageStory>;
16
+
17
+ export const Default: Story = {};
18
+
19
+ /**
20
+ * WithCustomLogoutMessage:
21
+ * - Purpose: Tests when a custom message is displayed for the logout confirmation.
22
+ * - Scenario: The component renders with a custom logout confirmation message instead of the default one.
23
+ * - Key Aspect: Ensures the custom logout message is displayed correctly.
24
+ */
25
+ export const WithCustomLogoutMessage: Story = {
26
+ globals: {
27
+ overrides: {
28
+ url: {
29
+ logoutConfirmAction: '/mock-logout-action'
30
+ },
31
+ client: {
32
+ baseUrl: '/mock-client-url'
33
+ },
34
+ logoutConfirm: {
35
+ code: 'mock-session-code',
36
+ skipLink: false
37
+ },
38
+ message: {
39
+ summary: 'Are you sure you want to log out from all sessions?',
40
+ type: 'warning'
41
+ }
42
+ }
43
+ }
44
+ };