keycloakify 11.3.9-rc.0 → 11.3.9

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 (32) hide show
  1. package/login/lib/getUserProfileApi/getUserProfileApi.d.ts +0 -1
  2. package/login/lib/getUserProfileApi/getUserProfileApi.js +1 -1
  3. package/login/lib/getUserProfileApi/getUserProfileApi.js.map +1 -1
  4. package/package.json +1 -1
  5. package/src/login/lib/getUserProfileApi/getUserProfileApi.ts +1 -3
  6. package/stories/account/pages/Account.stories.tsx +102 -0
  7. package/stories/account/pages/Applications.stories.tsx +148 -0
  8. package/stories/account/pages/FederatedIdentity.stories.tsx +58 -0
  9. package/stories/account/pages/Log.stories.tsx +104 -0
  10. package/stories/account/pages/Password.stories.tsx +76 -0
  11. package/stories/account/pages/Sessions.stories.tsx +94 -0
  12. package/stories/account/pages/Totp.stories.tsx +61 -0
  13. package/stories/login/pages/LoginIdpLinkConfirm.stories.tsx +38 -1
  14. package/stories/login/pages/LoginIdpLinkEmail.stories.tsx +54 -11
  15. package/stories/login/pages/LoginOauth2DeviceVerifyUserCode.stories.tsx +44 -0
  16. package/stories/login/pages/LoginOauthGrant.stories.tsx +69 -1
  17. package/stories/login/pages/LoginOtp.stories.tsx +110 -0
  18. package/stories/login/pages/LoginPageExpired.stories.tsx +23 -0
  19. package/stories/login/pages/LoginPassword.stories.tsx +51 -0
  20. package/stories/login/pages/LoginRecoveryAuthnCodeConfig.stories.tsx +22 -0
  21. package/stories/login/pages/LoginResetOtp.stories.tsx +79 -0
  22. package/stories/login/pages/LoginResetPassword.stories.tsx +30 -0
  23. package/stories/login/pages/LoginUpdatePassword.stories.tsx +46 -0
  24. package/stories/login/pages/LoginUpdateProfile.stories.tsx +23 -0
  25. package/stories/login/pages/LoginVerifyEmail.stories.tsx +75 -0
  26. package/stories/login/pages/LoginX509Info.stories.tsx +25 -0
  27. package/stories/login/pages/LogoutConfirm.stories.tsx +29 -0
  28. package/stories/login/pages/SelectAuthenticator.stories.tsx +21 -0
  29. package/stories/login/pages/UpdateEmail.stories.tsx +22 -0
  30. package/stories/login/pages/WebauthnAuthenticate.stories.tsx +141 -0
  31. package/stories/login/pages/WebauthnError.stories.tsx +69 -0
  32. package/stories/login/pages/WebauthnRegister.stories.tsx +44 -0
@@ -16,3 +16,54 @@ type Story = StoryObj<typeof meta>;
16
16
  export const Default: Story = {
17
17
  render: () => <KcPageStory />
18
18
  };
19
+
20
+ /**
21
+ * WithPasswordError:
22
+ * - Purpose: Tests the behavior when an error occurs in the password field (e.g., incorrect password).
23
+ * - Scenario: Simulates a scenario where an invalid password is entered, and an error message is displayed.
24
+ * - Key Aspect: Ensures that the password input field displays error messages correctly.
25
+ */
26
+ export const WithPasswordError: Story = {
27
+ render: () => (
28
+ <KcPageStory
29
+ kcContext={{
30
+ realm: {
31
+ resetPasswordAllowed: true
32
+ },
33
+ url: {
34
+ loginAction: "/mock-login",
35
+ loginResetCredentialsUrl: "/mock-reset-password"
36
+ },
37
+ messagesPerField: {
38
+ existsError: (field: string) => field === "password",
39
+ get: () => "Invalid password"
40
+ }
41
+ }}
42
+ />
43
+ )
44
+ };
45
+
46
+ /**
47
+ * WithoutResetPasswordOption:
48
+ * - Purpose: Tests the behavior when the reset password option is disabled.
49
+ * - Scenario: Simulates a scenario where the `resetPasswordAllowed` is set to `false`, and the "Forgot Password" link is not rendered.
50
+ * - Key Aspect: Ensures that the component handles cases where resetting the password is not allowed.
51
+ */
52
+ export const WithoutResetPasswordOption: Story = {
53
+ render: () => (
54
+ <KcPageStory
55
+ kcContext={{
56
+ realm: {
57
+ resetPasswordAllowed: false
58
+ },
59
+ url: {
60
+ loginAction: "/mock-login",
61
+ loginResetCredentialsUrl: "/mock-reset-password"
62
+ },
63
+ messagesPerField: {
64
+ existsError: () => false
65
+ }
66
+ }}
67
+ />
68
+ )
69
+ };
@@ -16,3 +16,25 @@ type Story = StoryObj<typeof meta>;
16
16
  export const Default: Story = {
17
17
  render: () => <KcPageStory />
18
18
  };
19
+
20
+ /**
21
+ * WithErrorDuringCodeGeneration:
22
+ * - Purpose: Tests when an error occurs while generating recovery authentication codes.
23
+ * - Scenario: The component renders an error message to inform the user of the failure during code generation.
24
+ * - Key Aspect: Ensures that error messages are properly displayed when recovery code generation fails.
25
+ */
26
+ export const WithErrorDuringCodeGeneration: Story = {
27
+ render: () => (
28
+ <KcPageStory
29
+ kcContext={{
30
+ url: {
31
+ loginAction: "/mock-login-action"
32
+ },
33
+ message: {
34
+ summary: "An error occurred during recovery code generation. Please try again.",
35
+ type: "error"
36
+ }
37
+ }}
38
+ />
39
+ )
40
+ };
@@ -16,3 +16,82 @@ type Story = StoryObj<typeof meta>;
16
16
  export const Default: Story = {
17
17
  render: () => <KcPageStory />
18
18
  };
19
+
20
+ /**
21
+ * WithoutOtpCredentials:
22
+ * - Purpose: Tests the behavior when no OTP credentials are available.
23
+ * - Scenario: The component renders without any OTP credentials, showing only the submit button.
24
+ * - Key Aspect: Ensures that the component handles the absence of OTP credentials correctly.
25
+ */
26
+ export const WithoutOtpCredentials: Story = {
27
+ render: () => (
28
+ <KcPageStory
29
+ kcContext={{
30
+ url: {
31
+ loginAction: "/mock-login"
32
+ },
33
+ configuredOtpCredentials: {
34
+ userOtpCredentials: [],
35
+ selectedCredentialId: undefined
36
+ },
37
+ messagesPerField: {
38
+ existsError: () => false
39
+ }
40
+ }}
41
+ />
42
+ )
43
+ };
44
+
45
+ /**
46
+ * WithOtpError:
47
+ * - Purpose: Tests the behavior when an error occurs with the OTP selection.
48
+ * - Scenario: Simulates a scenario where an error occurs (e.g., no OTP selected), and an error message is displayed.
49
+ * - Key Aspect: Ensures that error messages are displayed correctly for OTP-related errors.
50
+ */
51
+ export const WithOtpError: Story = {
52
+ render: () => (
53
+ <KcPageStory
54
+ kcContext={{
55
+ url: {
56
+ loginAction: "/mock-login"
57
+ },
58
+ configuredOtpCredentials: {
59
+ userOtpCredentials: [
60
+ { id: "otp1", userLabel: "Device 1" },
61
+ { id: "otp2", userLabel: "Device 2" }
62
+ ],
63
+ selectedCredentialId: "otp1"
64
+ },
65
+ messagesPerField: {
66
+ existsError: (field: string) => field === "totp",
67
+ get: () => "Invalid OTP selection"
68
+ }
69
+ }}
70
+ />
71
+ )
72
+ };
73
+
74
+ /**
75
+ * WithOnlyOneOtpCredential:
76
+ * - Purpose: Tests the behavior when there is only one OTP credential available.
77
+ * - Scenario: Simulates the case where the user has only one OTP credential, and it is pre-selected by default.
78
+ * - Key Aspect: Ensures that the component renders correctly with only one OTP credential pre-selected.
79
+ */
80
+ export const WithOnlyOneOtpCredential: Story = {
81
+ render: () => (
82
+ <KcPageStory
83
+ kcContext={{
84
+ url: {
85
+ loginAction: "/mock-login"
86
+ },
87
+ configuredOtpCredentials: {
88
+ userOtpCredentials: [{ id: "otp1", userLabel: "Device 1" }],
89
+ selectedCredentialId: "otp1"
90
+ },
91
+ messagesPerField: {
92
+ existsError: () => false
93
+ }
94
+ }}
95
+ />
96
+ )
97
+ };
@@ -29,3 +29,33 @@ export const WithEmailAsUsername: Story = {
29
29
  />
30
30
  )
31
31
  };
32
+ /**
33
+ * WithUsernameError:
34
+ * - Purpose: Tests behavior when an error occurs with the username input (e.g., invalid username).
35
+ * - Scenario: The component displays an error message next to the username input field.
36
+ * - Key Aspect: Ensures the username input shows error messages when validation fails.
37
+ */
38
+ export const WithUsernameError: Story = {
39
+ render: () => (
40
+ <KcPageStory
41
+ kcContext={{
42
+ realm: {
43
+ loginWithEmailAllowed: false,
44
+ registrationEmailAsUsername: false,
45
+ duplicateEmailsAllowed: false
46
+ },
47
+ url: {
48
+ loginAction: "/mock-login-action",
49
+ loginUrl: "/mock-login-url"
50
+ },
51
+ messagesPerField: {
52
+ existsError: (field: string) => field === "username",
53
+ get: () => "Invalid username"
54
+ },
55
+ auth: {
56
+ attemptedUsername: "invalid_user"
57
+ }
58
+ }}
59
+ />
60
+ )
61
+ };
@@ -16,3 +16,49 @@ type Story = StoryObj<typeof meta>;
16
16
  export const Default: Story = {
17
17
  render: () => <KcPageStory />
18
18
  };
19
+
20
+ /**
21
+ * WithPasswordError:
22
+ * - Purpose: Tests when there is an error in the password input (e.g., invalid password).
23
+ * - Scenario: Simulates the case where the user enters an invalid password, and an error message is displayed.
24
+ * - Key Aspect: Ensures the password input field shows an error message when validation fails.
25
+ */
26
+ export const WithPasswordError: Story = {
27
+ render: () => (
28
+ <KcPageStory
29
+ kcContext={{
30
+ url: {
31
+ loginAction: "/mock-login-action"
32
+ },
33
+ messagesPerField: {
34
+ existsError: (field: string) => field === "password",
35
+ get: () => "Password must be at least 8 characters long."
36
+ },
37
+ isAppInitiatedAction: false
38
+ }}
39
+ />
40
+ )
41
+ };
42
+
43
+ /**
44
+ * WithPasswordConfirmError:
45
+ * - Purpose: Tests when there is an error in the password confirmation input (e.g., passwords do not match).
46
+ * - Scenario: Simulates the case where the user enters mismatching passwords, and an error message is displayed in the confirmation field.
47
+ * - Key Aspect: Ensures that the password confirmation field shows an error when passwords do not match.
48
+ */
49
+ export const WithPasswordConfirmError: Story = {
50
+ render: () => (
51
+ <KcPageStory
52
+ kcContext={{
53
+ url: {
54
+ loginAction: "/mock-login-action"
55
+ },
56
+ messagesPerField: {
57
+ existsError: (field: string) => field === "password-confirm",
58
+ get: () => "Passwords do not match."
59
+ },
60
+ isAppInitiatedAction: false
61
+ }}
62
+ />
63
+ )
64
+ };
@@ -16,3 +16,26 @@ type Story = StoryObj<typeof meta>;
16
16
  export const Default: Story = {
17
17
  render: () => <KcPageStory />
18
18
  };
19
+
20
+ /**
21
+ * WithProfileError:
22
+ * - Purpose: Tests when an error occurs in one or more profile fields (e.g., invalid email format).
23
+ * - Scenario: The component displays error messages next to the affected fields.
24
+ * - Key Aspect: Ensures the profile fields show error messages when validation fails.
25
+ */
26
+ export const WithProfileError: Story = {
27
+ render: () => (
28
+ <KcPageStory
29
+ kcContext={{
30
+ url: {
31
+ loginAction: "/mock-login-action"
32
+ },
33
+ messagesPerField: {
34
+ existsError: (field: string) => field === "email",
35
+ get: () => "Invalid email format"
36
+ },
37
+ isAppInitiatedAction: false
38
+ }}
39
+ />
40
+ )
41
+ };
@@ -28,3 +28,78 @@ export const Default: Story = {
28
28
  />
29
29
  )
30
30
  };
31
+
32
+ /**
33
+ * WithSuccessMessage:
34
+ * - Purpose: Tests when the email verification is successful, and the user receives a confirmation message.
35
+ * - Scenario: The component renders a success message instead of a warning or error.
36
+ * - Key Aspect: Ensures the success message is displayed correctly when the email is successfully verified.
37
+ */
38
+ export const WithSuccessMessage: Story = {
39
+ render: () => (
40
+ <KcPageStory
41
+ kcContext={{
42
+ message: {
43
+ summary: "Your email has been successfully verified.",
44
+ type: "success"
45
+ },
46
+ user: {
47
+ email: "john.doe@gmail.com"
48
+ },
49
+ url: {
50
+ loginAction: "/mock-login-action"
51
+ }
52
+ }}
53
+ />
54
+ )
55
+ };
56
+
57
+ /**
58
+ * WithErrorMessage:
59
+ * - Purpose: Tests when there is an error during the email verification process.
60
+ * - Scenario: The component renders an error message indicating the email verification failed.
61
+ * - Key Aspect: Ensures the error message is shown correctly when the verification process encounters an issue.
62
+ */
63
+ export const WithErrorMessage: Story = {
64
+ render: () => (
65
+ <KcPageStory
66
+ kcContext={{
67
+ message: {
68
+ summary: "There was an error verifying your email. Please try again.",
69
+ type: "error"
70
+ },
71
+ user: {
72
+ email: "john.doe@gmail.com"
73
+ },
74
+ url: {
75
+ loginAction: "/mock-login-action"
76
+ }
77
+ }}
78
+ />
79
+ )
80
+ };
81
+
82
+ /**
83
+ * WithInfoMessage:
84
+ * - Purpose: Tests when the user is prompted to verify their email without any urgency.
85
+ * - Scenario: The component renders with an informational message for email verification.
86
+ * - Key Aspect: Ensures the informational message is displayed properly.
87
+ */
88
+ export const WithInfoMessage: Story = {
89
+ render: () => (
90
+ <KcPageStory
91
+ kcContext={{
92
+ message: {
93
+ summary: "Please verify your email to continue using our services.",
94
+ type: "info"
95
+ },
96
+ user: {
97
+ email: "john.doe@gmail.com"
98
+ },
99
+ url: {
100
+ loginAction: "/mock-login-action"
101
+ }
102
+ }}
103
+ />
104
+ )
105
+ };
@@ -16,3 +16,28 @@ type Story = StoryObj<typeof meta>;
16
16
  export const Default: Story = {
17
17
  render: () => <KcPageStory />
18
18
  };
19
+
20
+ /**
21
+ * WithoutUserEnabled:
22
+ * - Purpose: Tests when the user is not enabled to log in via x509.
23
+ * - Scenario: The component renders the certificate details but does not provide the option to log in or cancel.
24
+ * - Key Aspect: Ensures that the login buttons are not displayed when the user is not enabled.
25
+ */
26
+ export const WithoutUserEnabled: Story = {
27
+ render: () => (
28
+ <KcPageStory
29
+ kcContext={{
30
+ url: {
31
+ loginAction: "/mock-login-action"
32
+ },
33
+ x509: {
34
+ formData: {
35
+ subjectDN: "CN=John Doe, OU=Example Org, O=Example Inc, C=US",
36
+ username: "johndoe",
37
+ isUserEnabled: false // User not enabled for login
38
+ }
39
+ }
40
+ }}
41
+ />
42
+ )
43
+ };
@@ -16,3 +16,32 @@ type Story = StoryObj<typeof meta>;
16
16
  export const Default: Story = {
17
17
  render: () => <KcPageStory />
18
18
  };
19
+
20
+ /**
21
+ * WithCustomLogoutMessage:
22
+ * - Purpose: Tests when a custom message is displayed for the logout confirmation.
23
+ * - Scenario: The component renders with a custom logout confirmation message instead of the default one.
24
+ * - Key Aspect: Ensures the custom logout message is displayed correctly.
25
+ */
26
+ export const WithCustomLogoutMessage: Story = {
27
+ render: () => (
28
+ <KcPageStory
29
+ kcContext={{
30
+ url: {
31
+ logoutConfirmAction: "/mock-logout-action"
32
+ },
33
+ client: {
34
+ baseUrl: "/mock-client-url"
35
+ },
36
+ logoutConfirm: {
37
+ code: "mock-session-code",
38
+ skipLink: false
39
+ },
40
+ message: {
41
+ summary: "Are you sure you want to log out from all sessions?",
42
+ type: "warning"
43
+ }
44
+ }}
45
+ />
46
+ )
47
+ };
@@ -82,3 +82,24 @@ export const WithRealmTranslations: Story = {
82
82
  />
83
83
  )
84
84
  };
85
+
86
+ /**
87
+ * WithoutAuthenticationSelections:
88
+ * - Purpose: Tests when no authentication methods are available for selection.
89
+ * - Scenario: The component renders without any authentication options, providing a default message or fallback.
90
+ * - Key Aspect: Ensures that the component gracefully handles the absence of available authentication methods.
91
+ */
92
+ export const WithoutAuthenticationSelections: Story = {
93
+ render: () => (
94
+ <KcPageStory
95
+ kcContext={{
96
+ url: {
97
+ loginAction: "/mock-login-action"
98
+ },
99
+ auth: {
100
+ authenticationSelections: [] // No authentication methods available
101
+ }
102
+ }}
103
+ />
104
+ )
105
+ };
@@ -16,3 +16,25 @@ type Story = StoryObj<typeof meta>;
16
16
  export const Default: Story = {
17
17
  render: () => <KcPageStory />
18
18
  };
19
+
20
+ /**
21
+ * WithAppInitiatedAction:
22
+ * - Purpose: Tests when the form is displayed as part of an application-initiated action.
23
+ * - Scenario: The component renders the form with additional buttons like "Cancel."
24
+ * - Key Aspect: Ensures the "Cancel" button is visible and functional during app-initiated actions.
25
+ */
26
+ export const WithAppInitiatedAction: Story = {
27
+ render: () => (
28
+ <KcPageStory
29
+ kcContext={{
30
+ url: {
31
+ loginAction: "/mock-login-action"
32
+ },
33
+ messagesPerField: {
34
+ exists: () => false
35
+ },
36
+ isAppInitiatedAction: true
37
+ }}
38
+ />
39
+ )
40
+ };
@@ -16,3 +16,144 @@ type Story = StoryObj<typeof meta>;
16
16
  export const Default: Story = {
17
17
  render: () => <KcPageStory />
18
18
  };
19
+
20
+ /**
21
+ * WithMultipleAuthenticators:
22
+ * - Purpose: Tests when multiple WebAuthn authenticators are available for selection.
23
+ * - Scenario: The component renders multiple authenticators, allowing the user to choose between them.
24
+ * - Key Aspect: Ensures that the available authenticators are displayed, and the user can select one.
25
+ */
26
+ export const WithMultipleAuthenticators: Story = {
27
+ render: () => (
28
+ <KcPageStory
29
+ kcContext={{
30
+ url: {
31
+ loginAction: "/mock-login-action"
32
+ },
33
+ authenticators: {
34
+ authenticators: [
35
+ {
36
+ credentialId: "authenticator-1",
37
+ label: "Security Key 1",
38
+ transports: {
39
+ iconClass: "kcAuthenticatorUsbIcon",
40
+ displayNameProperties: ["USB"]
41
+ },
42
+ createdAt: "2023-01-01"
43
+ },
44
+ {
45
+ credentialId: "authenticator-2",
46
+ label: "Security Key 2",
47
+ transports: {
48
+ iconClass: "kcAuthenticatorNfcIcon",
49
+ displayNameProperties: ["NFC"]
50
+ },
51
+ createdAt: "2023-02-01"
52
+ }
53
+ ]
54
+ },
55
+ shouldDisplayAuthenticators: true
56
+ }}
57
+ />
58
+ )
59
+ };
60
+
61
+ /**
62
+ * WithSingleAuthenticator:
63
+ * - Purpose: Tests when only one WebAuthn authenticator is available.
64
+ * - Scenario: The component renders the WebAuthn form with a single available authenticator.
65
+ * - Key Aspect: Ensures the form renders correctly when there is only one authenticator available.
66
+ */
67
+ export const WithSingleAuthenticator: Story = {
68
+ render: () => (
69
+ <KcPageStory
70
+ kcContext={{
71
+ url: {
72
+ loginAction: "/mock-login-action"
73
+ },
74
+ authenticators: {
75
+ authenticators: [
76
+ {
77
+ credentialId: "authenticator-1",
78
+ label: "My Security Key",
79
+ transports: {
80
+ iconClass: "kcAuthenticatorUsbIcon",
81
+ displayNameProperties: ["USB"]
82
+ },
83
+ createdAt: "2023-01-01"
84
+ }
85
+ ]
86
+ },
87
+ shouldDisplayAuthenticators: true
88
+ }}
89
+ />
90
+ )
91
+ };
92
+
93
+ /**
94
+ * WithErrorDuringAuthentication:
95
+ * - Purpose: Tests the behavior when an error occurs during WebAuthn authentication.
96
+ * - Scenario: The component renders with an error message displayed to the user.
97
+ * - Key Aspect: Ensures the form handles authentication errors and displays a relevant message.
98
+ */
99
+ export const WithErrorDuringAuthentication: Story = {
100
+ render: () => (
101
+ <KcPageStory
102
+ kcContext={{
103
+ url: {
104
+ loginAction: "/mock-login-action"
105
+ },
106
+ authenticators: {
107
+ authenticators: [
108
+ {
109
+ credentialId: "authenticator-1",
110
+ label: "My Security Key",
111
+ transports: {
112
+ iconClass: "kcAuthenticatorUsbIcon",
113
+ displayNameProperties: ["USB"]
114
+ },
115
+ createdAt: "2023-01-01"
116
+ }
117
+ ]
118
+ },
119
+ shouldDisplayAuthenticators: true,
120
+ message: {
121
+ summary: "An error occurred during WebAuthn authentication.",
122
+ type: "error"
123
+ }
124
+ }}
125
+ />
126
+ )
127
+ };
128
+
129
+ /**
130
+ * WithJavaScriptDisabled:
131
+ * - Purpose: Tests the behavior when JavaScript is disabled or not functioning.
132
+ * - Scenario: The component renders a fallback message prompting the user to enable JavaScript for WebAuthn authentication.
133
+ * - Key Aspect: Ensures the form provides a clear message when JavaScript is required but unavailable.
134
+ */
135
+ export const WithJavaScriptDisabled: Story = {
136
+ render: () => (
137
+ <KcPageStory
138
+ kcContext={{
139
+ url: {
140
+ loginAction: "/mock-login-action"
141
+ },
142
+ authenticators: {
143
+ authenticators: [
144
+ {
145
+ credentialId: "authenticator-1",
146
+ label: "My Security Key",
147
+ transports: {
148
+ iconClass: "kcAuthenticatorUsbIcon",
149
+ displayNameProperties: ["USB"]
150
+ },
151
+ createdAt: "2023-01-01"
152
+ }
153
+ ]
154
+ },
155
+ shouldDisplayAuthenticators: true
156
+ }}
157
+ />
158
+ )
159
+ };
@@ -16,3 +16,72 @@ type Story = StoryObj<typeof meta>;
16
16
  export const Default: Story = {
17
17
  render: () => <KcPageStory />
18
18
  };
19
+
20
+ /**
21
+ * WithRetryAvailable:
22
+ * - Purpose: Tests when the user can retry the WebAuthn authentication after an error.
23
+ * - Scenario: The component renders with a "Try Again" button to allow retrying the authentication process.
24
+ * - Key Aspect: Ensures the retry button functionality is visible and the user can retry authentication.
25
+ */
26
+ export const WithRetryAvailable: Story = {
27
+ render: () => (
28
+ <KcPageStory
29
+ kcContext={{
30
+ url: {
31
+ loginAction: "/mock-login-action"
32
+ },
33
+ isAppInitiatedAction: false,
34
+ message: {
35
+ summary: "WebAuthn authentication failed. Please try again.",
36
+ type: "error"
37
+ }
38
+ }}
39
+ />
40
+ )
41
+ };
42
+
43
+ /**
44
+ * WithAppInitiatedAction:
45
+ * - Purpose: Tests when the WebAuthn error form is part of an application-initiated action.
46
+ * - Scenario: The component renders with both a "Try Again" button and a "Cancel" button for app-initiated actions.
47
+ * - Key Aspect: Ensures the form renders correctly with both "Try Again" and "Cancel" options.
48
+ */
49
+ export const WithAppInitiatedAction: Story = {
50
+ render: () => (
51
+ <KcPageStory
52
+ kcContext={{
53
+ url: {
54
+ loginAction: "/mock-login-action"
55
+ },
56
+ isAppInitiatedAction: true,
57
+ message: {
58
+ summary: "WebAuthn authentication failed. You can try again or cancel.",
59
+ type: "error"
60
+ }
61
+ }}
62
+ />
63
+ )
64
+ };
65
+
66
+ /**
67
+ * WithJavaScriptDisabled:
68
+ * - Purpose: Tests the behavior when JavaScript is disabled or not functioning.
69
+ * - Scenario: The component renders with a message prompting the user to retry manually without JavaScript.
70
+ * - Key Aspect: Ensures the retry mechanism works properly when JavaScript is disabled or unavailable.
71
+ */
72
+ export const WithJavaScriptDisabled: Story = {
73
+ render: () => (
74
+ <KcPageStory
75
+ kcContext={{
76
+ url: {
77
+ loginAction: "/mock-login-action"
78
+ },
79
+ isAppInitiatedAction: false,
80
+ message: {
81
+ summary: "JavaScript is disabled or not working. Please retry manually.",
82
+ type: "warning"
83
+ }
84
+ }}
85
+ />
86
+ )
87
+ };