@oussemasahbeni/keycloakify-login-shadcn 250004.0.2 → 250004.0.7

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 (174) hide show
  1. package/keycloak-theme/components/ui/alert.tsx +4 -4
  2. package/keycloak-theme/components/ui/dropdown-menu.tsx +5 -5
  3. package/keycloak-theme/components/ui/input.tsx +1 -1
  4. package/keycloak-theme/components/ui/select.tsx +4 -4
  5. package/keycloak-theme/components/ui/separator.tsx +1 -1
  6. package/keycloak-theme/login/KcContext.ts +23 -19
  7. package/keycloak-theme/login/KcPage.tsx +47 -60
  8. package/keycloak-theme/login/assets/img/auth-logo.svg +100 -100
  9. package/keycloak-theme/login/assets/img/shape.svg +71 -71
  10. package/keycloak-theme/login/components/LogoutOtherSessions.tsx +26 -26
  11. package/keycloak-theme/login/components/PasswordWrapper.tsx +35 -35
  12. package/keycloak-theme/login/components/Template/Template.tsx +227 -226
  13. package/keycloak-theme/login/components/Template/index.ts +1 -1
  14. package/keycloak-theme/login/components/Template/useInitializeTemplate.ts +61 -61
  15. package/keycloak-theme/login/components/UserProfileFormFields/AddRemoveButtonsMultiValuedAttribute.tsx +61 -61
  16. package/keycloak-theme/login/components/UserProfileFormFields/DO_MAKE_USER_CONFIRM_PASSWORD.ts +2 -2
  17. package/keycloak-theme/login/components/UserProfileFormFields/FieldErrors.tsx +28 -28
  18. package/keycloak-theme/login/components/UserProfileFormFields/GroupLabel.tsx +70 -70
  19. package/keycloak-theme/login/components/UserProfileFormFields/InputFieldByType.tsx +58 -58
  20. package/keycloak-theme/login/components/UserProfileFormFields/InputTag.tsx +116 -116
  21. package/keycloak-theme/login/components/UserProfileFormFields/InputTagSelects.tsx +135 -135
  22. package/keycloak-theme/login/components/UserProfileFormFields/SelectTag.tsx +114 -114
  23. package/keycloak-theme/login/components/UserProfileFormFields/TextareaTag.tsx +42 -42
  24. package/keycloak-theme/login/components/UserProfileFormFields/UserProfileFormFields.tsx +127 -127
  25. package/keycloak-theme/login/components/UserProfileFormFields/index.ts +1 -1
  26. package/keycloak-theme/login/i18n.ts +47 -51
  27. package/keycloak-theme/login/mocks/getKcContextMock.ts +22 -18
  28. package/keycloak-theme/login/pages/PageIndex.tsx +134 -134
  29. package/keycloak-theme/login/pages/code/Page.stories.tsx +62 -78
  30. package/keycloak-theme/login/pages/code/Page.tsx +89 -89
  31. package/keycloak-theme/login/pages/code/index.ts +3 -3
  32. package/keycloak-theme/login/pages/delete-account-confirm/Page.stories.tsx +39 -46
  33. package/keycloak-theme/login/pages/delete-account-confirm/Page.tsx +63 -63
  34. package/keycloak-theme/login/pages/delete-account-confirm/index.ts +3 -3
  35. package/keycloak-theme/login/pages/delete-credential/Page.stories.tsx +26 -30
  36. package/keycloak-theme/login/pages/delete-credential/Page.tsx +51 -51
  37. package/keycloak-theme/login/pages/delete-credential/index.ts +3 -3
  38. package/keycloak-theme/login/pages/error/Page.stories.tsx +47 -58
  39. package/keycloak-theme/login/pages/error/Page.tsx +42 -42
  40. package/keycloak-theme/login/pages/error/index.ts +3 -3
  41. package/keycloak-theme/login/pages/frontchannel-logout/Page.stories.tsx +25 -32
  42. package/keycloak-theme/login/pages/frontchannel-logout/Page.tsx +84 -84
  43. package/keycloak-theme/login/pages/frontchannel-logout/index.ts +3 -3
  44. package/keycloak-theme/login/pages/idp-review-user-profile/Page.stories.tsx +46 -58
  45. package/keycloak-theme/login/pages/idp-review-user-profile/Page.tsx +52 -52
  46. package/keycloak-theme/login/pages/idp-review-user-profile/index.ts +3 -3
  47. package/keycloak-theme/login/pages/info/Page.stories.tsx +50 -60
  48. package/keycloak-theme/login/pages/info/Page.tsx +92 -92
  49. package/keycloak-theme/login/pages/link-idp-action/Page.stories.tsx +32 -16
  50. package/keycloak-theme/login/pages/link-idp-action/Page.tsx +43 -43
  51. package/keycloak-theme/login/pages/link-idp-action/index.ts +3 -3
  52. package/keycloak-theme/login/pages/login/Form.tsx +242 -242
  53. package/keycloak-theme/login/pages/login/Info.tsx +29 -29
  54. package/keycloak-theme/login/pages/login/Page.stories.tsx +345 -365
  55. package/keycloak-theme/login/pages/login/Page.tsx +44 -44
  56. package/keycloak-theme/login/pages/login/SocialProviders.tsx +107 -107
  57. package/keycloak-theme/login/pages/login/index.ts +3 -3
  58. package/keycloak-theme/login/pages/login/providers/apple.svg +3 -3
  59. package/keycloak-theme/login/pages/login/providers/bitbucket.svg +11 -11
  60. package/keycloak-theme/login/pages/login/providers/discord.svg +4 -4
  61. package/keycloak-theme/login/pages/login/providers/facebook.svg +5 -5
  62. package/keycloak-theme/login/pages/login/providers/github.svg +3 -3
  63. package/keycloak-theme/login/pages/login/providers/gitlab.svg +7 -7
  64. package/keycloak-theme/login/pages/login/providers/google.svg +7 -7
  65. package/keycloak-theme/login/pages/login/providers/instagram.svg +31 -31
  66. package/keycloak-theme/login/pages/login/providers/linkedin.svg +3 -3
  67. package/keycloak-theme/login/pages/login/providers/microsoft.svg +6 -6
  68. package/keycloak-theme/login/pages/login/providers/oidc.svg +5 -5
  69. package/keycloak-theme/login/pages/login/providers/openshift.svg +7 -7
  70. package/keycloak-theme/login/pages/login/providers/paypal.svg +6 -6
  71. package/keycloak-theme/login/pages/login/providers/slack.svg +11 -11
  72. package/keycloak-theme/login/pages/login/providers/stackoverflow.svg +5 -5
  73. package/keycloak-theme/login/pages/login/providers/x.svg +3 -3
  74. package/keycloak-theme/login/pages/login/useProviderLogos.tsx +39 -39
  75. package/keycloak-theme/login/pages/login/useScript.tsx +62 -62
  76. package/keycloak-theme/login/pages/login-config-totp/Page.stories.tsx +45 -59
  77. package/keycloak-theme/login/pages/login-config-totp/Page.tsx +240 -240
  78. package/keycloak-theme/login/pages/login-config-totp/index.ts +3 -3
  79. package/keycloak-theme/login/pages/login-idp-link-confirm/Page.stories.tsx +30 -34
  80. package/keycloak-theme/login/pages/login-idp-link-confirm/Page.tsx +43 -43
  81. package/keycloak-theme/login/pages/login-idp-link-confirm/index.ts +3 -3
  82. package/keycloak-theme/login/pages/login-idp-link-confirm-override/Page.stories.tsx +16 -22
  83. package/keycloak-theme/login/pages/login-idp-link-confirm-override/Page.tsx +47 -47
  84. package/keycloak-theme/login/pages/login-idp-link-confirm-override/index.ts +3 -3
  85. package/keycloak-theme/login/pages/login-idp-link-email/Page.stories.tsx +54 -62
  86. package/keycloak-theme/login/pages/login-idp-link-email/Page.tsx +54 -54
  87. package/keycloak-theme/login/pages/login-idp-link-email/index.ts +3 -3
  88. package/keycloak-theme/login/pages/login-oauth-grant/Page.stories.tsx +39 -45
  89. package/keycloak-theme/login/pages/login-oauth-grant/Page.tsx +126 -126
  90. package/keycloak-theme/login/pages/login-oauth-grant/index.ts +3 -3
  91. package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/Page.stories.tsx +38 -48
  92. package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/Page.tsx +58 -58
  93. package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/index.ts +3 -3
  94. package/keycloak-theme/login/pages/login-otp/Page.stories.tsx +82 -96
  95. package/keycloak-theme/login/pages/login-otp/Page.tsx +108 -108
  96. package/keycloak-theme/login/pages/login-otp/index.ts +3 -3
  97. package/keycloak-theme/login/pages/login-page-expired/Page.stories.tsx +28 -36
  98. package/keycloak-theme/login/pages/login-page-expired/Page.tsx +47 -47
  99. package/keycloak-theme/login/pages/login-page-expired/index.ts +3 -3
  100. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/Page.stories.tsx +20 -0
  101. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/Page.tsx +233 -233
  102. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/index.ts +3 -3
  103. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/useScript.tsx +63 -63
  104. package/keycloak-theme/login/pages/login-password/Page.stories.tsx +55 -56
  105. package/keycloak-theme/login/pages/login-password/Page.tsx +149 -149
  106. package/keycloak-theme/login/pages/login-password/index.ts +3 -3
  107. package/keycloak-theme/login/pages/login-password/useScript.tsx +63 -63
  108. package/keycloak-theme/login/pages/login-recovery-authn-code-config/Page.stories.tsx +28 -36
  109. package/keycloak-theme/login/pages/login-recovery-authn-code-config/Page.tsx +181 -181
  110. package/keycloak-theme/login/pages/login-recovery-authn-code-config/index.ts +3 -3
  111. package/keycloak-theme/login/pages/login-recovery-authn-code-config/useScript.tsx +145 -145
  112. package/keycloak-theme/login/pages/login-recovery-authn-code-input/Page.stories.tsx +16 -22
  113. package/keycloak-theme/login/pages/login-recovery-authn-code-input/Page.tsx +70 -70
  114. package/keycloak-theme/login/pages/login-recovery-authn-code-input/index.ts +3 -3
  115. package/keycloak-theme/login/pages/login-reset-otp/Page.stories.tsx +62 -74
  116. package/keycloak-theme/login/pages/login-reset-otp/Page.tsx +86 -86
  117. package/keycloak-theme/login/pages/login-reset-otp/index.ts +3 -3
  118. package/keycloak-theme/login/pages/login-reset-password/Form.tsx +68 -68
  119. package/keycloak-theme/login/pages/login-reset-password/Page.stories.tsx +44 -54
  120. package/keycloak-theme/login/pages/login-reset-password/Page.tsx +27 -27
  121. package/keycloak-theme/login/pages/login-reset-password/index.ts +3 -3
  122. package/keycloak-theme/login/pages/login-update-password/Page.stories.tsx +40 -50
  123. package/keycloak-theme/login/pages/login-update-password/Page.tsx +111 -111
  124. package/keycloak-theme/login/pages/login-update-password/index.ts +3 -3
  125. package/keycloak-theme/login/pages/login-update-profile/Page.stories.tsx +28 -36
  126. package/keycloak-theme/login/pages/login-update-profile/Page.tsx +68 -68
  127. package/keycloak-theme/login/pages/login-update-profile/index.ts +3 -3
  128. package/keycloak-theme/login/pages/login-username/Page.stories.tsx +32 -42
  129. package/keycloak-theme/login/pages/login-username/Page.tsx +246 -246
  130. package/keycloak-theme/login/pages/login-username/index.ts +3 -3
  131. package/keycloak-theme/login/pages/login-username/useScript.tsx +62 -62
  132. package/keycloak-theme/login/pages/login-verify-email/Page.stories.tsx +68 -80
  133. package/keycloak-theme/login/pages/login-verify-email/Page.tsx +38 -38
  134. package/keycloak-theme/login/pages/login-verify-email/index.ts +3 -3
  135. package/keycloak-theme/login/pages/login-x509-info/Page.stories.tsx +29 -37
  136. package/keycloak-theme/login/pages/login-x509-info/Page.tsx +75 -75
  137. package/keycloak-theme/login/pages/login-x509-info/index.ts +3 -3
  138. package/keycloak-theme/login/pages/logout-confirm/Page.stories.tsx +34 -42
  139. package/keycloak-theme/login/pages/logout-confirm/Page.tsx +53 -53
  140. package/keycloak-theme/login/pages/logout-confirm/index.ts +3 -3
  141. package/keycloak-theme/login/pages/register/Form.tsx +106 -106
  142. package/keycloak-theme/login/pages/register/Page.stories.tsx +23 -6
  143. package/keycloak-theme/login/pages/register/Page.tsx +26 -26
  144. package/keycloak-theme/login/pages/register/TermsAcceptance.tsx +56 -56
  145. package/keycloak-theme/login/pages/register/index.ts +3 -3
  146. package/keycloak-theme/login/pages/saml-post-form/Page.stories.tsx +16 -22
  147. package/keycloak-theme/login/pages/saml-post-form/Page.tsx +66 -66
  148. package/keycloak-theme/login/pages/saml-post-form/index.ts +3 -3
  149. package/keycloak-theme/login/pages/select-authenticator/Page.stories.tsx +83 -95
  150. package/keycloak-theme/login/pages/select-authenticator/Page.tsx +100 -100
  151. package/keycloak-theme/login/pages/select-authenticator/index.ts +3 -3
  152. package/keycloak-theme/login/pages/select-organization/Page.stories.tsx +62 -49
  153. package/keycloak-theme/login/pages/select-organization/Page.tsx +126 -126
  154. package/keycloak-theme/login/pages/select-organization/index.ts +3 -3
  155. package/keycloak-theme/login/pages/terms/Page.stories.tsx +15 -0
  156. package/keycloak-theme/login/pages/terms/Page.tsx +51 -51
  157. package/keycloak-theme/login/pages/terms/index.ts +3 -3
  158. package/keycloak-theme/login/pages/update-email/Page.stories.tsx +27 -35
  159. package/keycloak-theme/login/pages/update-email/Page.tsx +62 -62
  160. package/keycloak-theme/login/pages/update-email/index.ts +3 -3
  161. package/keycloak-theme/login/pages/webauthn-authenticate/Page.stories.tsx +112 -126
  162. package/keycloak-theme/login/pages/webauthn-authenticate/Page.tsx +202 -202
  163. package/keycloak-theme/login/pages/webauthn-authenticate/index.ts +3 -3
  164. package/keycloak-theme/login/pages/webauthn-authenticate/useScript.tsx +55 -55
  165. package/keycloak-theme/login/pages/webauthn-error/Page.stories.tsx +54 -66
  166. package/keycloak-theme/login/pages/webauthn-error/Page.tsx +73 -73
  167. package/keycloak-theme/login/pages/webauthn-error/index.ts +3 -3
  168. package/keycloak-theme/login/pages/webauthn-register/Page.stories.tsx +39 -49
  169. package/keycloak-theme/login/pages/webauthn-register/Page.tsx +78 -78
  170. package/keycloak-theme/login/pages/webauthn-register/index.ts +3 -3
  171. package/keycloak-theme/login/pages/webauthn-register/useScript.tsx +62 -62
  172. package/keycloak-theme/login/shared/getColorScheme.ts +45 -0
  173. package/keycloak-theme/login/styleLevelCustomization.tsx +36 -17
  174. package/package.json +6 -5
@@ -12,32 +12,26 @@ export default meta;
12
12
 
13
13
  type Story = StoryObj<typeof meta>;
14
14
 
15
- export const Default: Story = {
16
- render: () => <KcPageStory />
17
- };
15
+ export const Default: Story = {};
18
16
 
19
17
  export const Arabic: Story = {
20
- render: () => (
21
- <KcPageStory
22
- kcContext={{
23
- locale: {
24
- currentLanguageTag: "ar",
25
- rtl: true
26
- }
27
- }}
28
- />
29
- )
18
+ args: {
19
+ kcContext: {
20
+ locale: {
21
+ currentLanguageTag: "ar",
22
+ rtl: true
23
+ }
24
+ }
25
+ }
30
26
  };
31
27
  export const French: Story = {
32
- render: () => (
33
- <KcPageStory
34
- kcContext={{
35
- locale: {
36
- currentLanguageTag: "fr"
37
- }
38
- }}
39
- />
40
- )
28
+ args: {
29
+ kcContext: {
30
+ locale: {
31
+ currentLanguageTag: "fr"
32
+ }
33
+ }
34
+ }
41
35
  };
42
36
 
43
37
  /**
@@ -47,20 +41,18 @@ export const French: Story = {
47
41
  * - Key Aspect: Ensures the retry button functionality is visible and the user can retry authentication.
48
42
  */
49
43
  export const WithRetryAvailable: Story = {
50
- render: () => (
51
- <KcPageStory
52
- kcContext={{
53
- url: {
54
- loginAction: "/mock-login-action"
55
- },
56
- isAppInitiatedAction: false,
57
- message: {
58
- summary: "WebAuthn authentication failed. Please try again.",
59
- type: "error"
60
- }
61
- }}
62
- />
63
- )
44
+ args: {
45
+ kcContext: {
46
+ url: {
47
+ loginAction: "/mock-login-action"
48
+ },
49
+ isAppInitiatedAction: false,
50
+ message: {
51
+ summary: "WebAuthn authentication failed. Please try again.",
52
+ type: "error"
53
+ }
54
+ }
55
+ }
64
56
  };
65
57
 
66
58
  /**
@@ -70,21 +62,19 @@ export const WithRetryAvailable: Story = {
70
62
  * - Key Aspect: Ensures the form renders correctly with both "Try Again" and "Cancel" options.
71
63
  */
72
64
  export const WithAppInitiatedAction: Story = {
73
- render: () => (
74
- <KcPageStory
75
- kcContext={{
76
- url: {
77
- loginAction: "/mock-login-action"
78
- },
79
- isAppInitiatedAction: true,
80
- message: {
81
- summary:
82
- "WebAuthn authentication failed. You can try again or cancel.",
83
- type: "error"
84
- }
85
- }}
86
- />
87
- )
65
+ args: {
66
+ kcContext: {
67
+ url: {
68
+ loginAction: "/mock-login-action"
69
+ },
70
+ isAppInitiatedAction: true,
71
+ message: {
72
+ summary:
73
+ "WebAuthn authentication failed. You can try again or cancel.",
74
+ type: "error"
75
+ }
76
+ }
77
+ }
88
78
  };
89
79
 
90
80
  /**
@@ -94,19 +84,17 @@ export const WithAppInitiatedAction: Story = {
94
84
  * - Key Aspect: Ensures the retry mechanism works properly when JavaScript is disabled or unavailable.
95
85
  */
96
86
  export const WithJavaScriptDisabled: Story = {
97
- render: () => (
98
- <KcPageStory
99
- kcContext={{
100
- url: {
101
- loginAction: "/mock-login-action"
102
- },
103
- isAppInitiatedAction: false,
104
- message: {
105
- summary:
106
- "JavaScript is disabled or not working. Please retry manually.",
107
- type: "warning"
108
- }
109
- }}
110
- />
111
- )
87
+ args: {
88
+ kcContext: {
89
+ url: {
90
+ loginAction: "/mock-login-action"
91
+ },
92
+ isAppInitiatedAction: false,
93
+ message: {
94
+ summary:
95
+ "JavaScript is disabled or not working. Please retry manually.",
96
+ type: "warning"
97
+ }
98
+ }
99
+ }
112
100
  };
@@ -1,73 +1,73 @@
1
- import { Button } from "@/components/ui/button";
2
- import { useI18n } from '@/login/i18n';
3
- import { useKcContext } from '@/login/KcContext';
4
- import { assert } from "tsafe/assert";
5
- import { Template } from "../../components/Template";
6
-
7
- export function Page() {
8
- const { kcContext } = useKcContext();
9
- assert(kcContext.pageId === "webauthn-error.ftl");
10
-
11
- const { url, isAppInitiatedAction } = kcContext;
12
-
13
- const { msg, msgStr } = useI18n();
14
-
15
- return (
16
- <Template
17
- displayMessage
18
- headerNode={msg("webauthn-error-title")}
19
- >
20
- <div className="space-y-4">
21
- <form
22
- id="kc-error-credential-form"
23
- action={url.loginAction}
24
- method="post"
25
- >
26
- <input
27
- type="hidden"
28
- id="executionValue"
29
- name="authenticationExecution"
30
- />
31
- <input type="hidden" id="isSetRetry" name="isSetRetry" />
32
- </form>
33
-
34
- <Button
35
- tabIndex={4}
36
- onClick={() => {
37
- // @ts-expect-error: Trusted Keycloak's code
38
- document.getElementById("isSetRetry").value = "retry";
39
- // @ts-expect-error: Trusted Keycloak's code
40
- document.getElementById("executionValue").value = "${execution}";
41
- // @ts-expect-error: Trusted Keycloak's code
42
- document.getElementById("kc-error-credential-form").submit();
43
- }}
44
- type="button"
45
- className="w-full"
46
- name="try-again"
47
- id="kc-try-again"
48
- >
49
- {msgStr("doTryAgain")}
50
- </Button>
51
-
52
- {isAppInitiatedAction && (
53
- <form
54
- action={url.loginAction}
55
- id="kc-webauthn-settings-form"
56
- method="post"
57
- >
58
- <Button
59
- type="submit"
60
- variant="outline"
61
- className="w-full"
62
- id="cancelWebAuthnAIA"
63
- name="cancel-aia"
64
- value="true"
65
- >
66
- {msgStr("doCancel")}
67
- </Button>
68
- </form>
69
- )}
70
- </div>
71
- </Template>
72
- );
73
- }
1
+ import { Button } from "@/components/ui/button";
2
+ import { useI18n } from '@/login/i18n';
3
+ import { useKcContext } from '@/login/KcContext';
4
+ import { assert } from "tsafe/assert";
5
+ import { Template } from "../../components/Template";
6
+
7
+ export function Page() {
8
+ const { kcContext } = useKcContext();
9
+ assert(kcContext.pageId === "webauthn-error.ftl");
10
+
11
+ const { url, isAppInitiatedAction } = kcContext;
12
+
13
+ const { msg, msgStr } = useI18n();
14
+
15
+ return (
16
+ <Template
17
+ displayMessage
18
+ headerNode={msg("webauthn-error-title")}
19
+ >
20
+ <div className="space-y-4">
21
+ <form
22
+ id="kc-error-credential-form"
23
+ action={url.loginAction}
24
+ method="post"
25
+ >
26
+ <input
27
+ type="hidden"
28
+ id="executionValue"
29
+ name="authenticationExecution"
30
+ />
31
+ <input type="hidden" id="isSetRetry" name="isSetRetry" />
32
+ </form>
33
+
34
+ <Button
35
+ tabIndex={4}
36
+ onClick={() => {
37
+ // @ts-expect-error: Trusted Keycloak's code
38
+ document.getElementById("isSetRetry").value = "retry";
39
+ // @ts-expect-error: Trusted Keycloak's code
40
+ document.getElementById("executionValue").value = "${execution}";
41
+ // @ts-expect-error: Trusted Keycloak's code
42
+ document.getElementById("kc-error-credential-form").submit();
43
+ }}
44
+ type="button"
45
+ className="w-full"
46
+ name="try-again"
47
+ id="kc-try-again"
48
+ >
49
+ {msgStr("doTryAgain")}
50
+ </Button>
51
+
52
+ {isAppInitiatedAction && (
53
+ <form
54
+ action={url.loginAction}
55
+ id="kc-webauthn-settings-form"
56
+ method="post"
57
+ >
58
+ <Button
59
+ type="submit"
60
+ variant="outline"
61
+ className="w-full"
62
+ id="cancelWebAuthnAIA"
63
+ name="cancel-aia"
64
+ value="true"
65
+ >
66
+ {msgStr("doCancel")}
67
+ </Button>
68
+ </form>
69
+ )}
70
+ </div>
71
+ </Template>
72
+ );
73
+ }
@@ -1,3 +1,3 @@
1
- import { Page } from "./Page";
2
-
3
- export default Page;
1
+ import { Page } from "./Page";
2
+
3
+ export default Page;
@@ -12,32 +12,26 @@ export default meta;
12
12
 
13
13
  type Story = StoryObj<typeof meta>;
14
14
 
15
- export const Default: Story = {
16
- render: () => <KcPageStory />
17
- };
15
+ export const Default: Story = {};
18
16
 
19
17
  export const Arabic: Story = {
20
- render: () => (
21
- <KcPageStory
22
- kcContext={{
23
- locale: {
24
- currentLanguageTag: "ar",
25
- rtl: true
26
- }
27
- }}
28
- />
29
- )
18
+ args: {
19
+ kcContext: {
20
+ locale: {
21
+ currentLanguageTag: "ar",
22
+ rtl: true
23
+ }
24
+ }
25
+ }
30
26
  };
31
27
  export const French: Story = {
32
- render: () => (
33
- <KcPageStory
34
- kcContext={{
35
- locale: {
36
- currentLanguageTag: "fr"
37
- }
38
- }}
39
- />
40
- )
28
+ args: {
29
+ kcContext: {
30
+ locale: {
31
+ currentLanguageTag: "fr"
32
+ }
33
+ }
34
+ }
41
35
  };
42
36
 
43
37
  /**
@@ -47,17 +41,15 @@ export const French: Story = {
47
41
  * - Key Aspect: Ensures the retry functionality is available and the form allows the user to retry.
48
42
  */
49
43
  export const WithRetryAvailable: Story = {
50
- render: () => (
51
- <KcPageStory
52
- kcContext={{
53
- url: {
54
- loginAction: "/mock-login-action"
55
- },
56
- isSetRetry: true,
57
- isAppInitiatedAction: false
58
- }}
59
- />
60
- )
44
+ args: {
45
+ kcContext: {
46
+ url: {
47
+ loginAction: "/mock-login-action"
48
+ },
49
+ isSetRetry: true,
50
+ isAppInitiatedAction: false
51
+ }
52
+ }
61
53
  };
62
54
 
63
55
  /**
@@ -67,20 +59,18 @@ export const WithRetryAvailable: Story = {
67
59
  * - Key Aspect: Ensures the error message is displayed correctly, informing the user of the registration failure.
68
60
  */
69
61
  export const WithErrorDuringRegistration: Story = {
70
- render: () => (
71
- <KcPageStory
72
- kcContext={{
73
- url: {
74
- loginAction: "/mock-login-action"
75
- },
76
- isSetRetry: false,
77
- isAppInitiatedAction: false,
78
- message: {
79
- summary:
80
- "An error occurred during WebAuthn registration. Please try again.",
81
- type: "error"
82
- }
83
- }}
84
- />
85
- )
62
+ args: {
63
+ kcContext: {
64
+ url: {
65
+ loginAction: "/mock-login-action"
66
+ },
67
+ isSetRetry: false,
68
+ isAppInitiatedAction: false,
69
+ message: {
70
+ summary:
71
+ "An error occurred during WebAuthn registration. Please try again.",
72
+ type: "error"
73
+ }
74
+ }
75
+ }
86
76
  };
@@ -1,78 +1,78 @@
1
- import { Button } from "@/components/ui/button";
2
- import { LogoutOtherSessions } from '@/login/components/LogoutOtherSessions';
3
- import { useI18n } from '@/login/i18n';
4
- import { useKcContext } from '@/login/KcContext';
5
- import { assert } from "tsafe/assert";
6
- import { Template } from "../../components/Template";
7
- import { useScript } from './useScript';
8
-
9
- export function Page() {
10
- const { kcContext } = useKcContext();
11
- assert(kcContext.pageId === "webauthn-register.ftl");
12
-
13
- const { msg, msgStr } = useI18n();
14
-
15
- const webAuthnButtonId = "authenticateWebAuthnButton";
16
-
17
- useScript({ webAuthnButtonId });
18
-
19
- return (
20
- <Template
21
- headerNode={
22
- <div className="flex items-center justify-center gap-2">
23
- <span>{msg("webauthn-registration-title")}</span>
24
- </div>
25
- }
26
- >
27
- <div className="space-y-6">
28
- <form id="register" action={kcContext.url.loginAction} method="post">
29
- <input type="hidden" id="clientDataJSON" name="clientDataJSON" />
30
- <input
31
- type="hidden"
32
- id="attestationObject"
33
- name="attestationObject"
34
- />
35
- <input
36
- type="hidden"
37
- id="publicKeyCredentialId"
38
- name="publicKeyCredentialId"
39
- />
40
- <input
41
- type="hidden"
42
- id="authenticatorLabel"
43
- name="authenticatorLabel"
44
- />
45
- <input type="hidden" id="transports" name="transports" />
46
- <input type="hidden" id="error" name="error" />
47
- </form>
48
-
49
- <LogoutOtherSessions />
50
-
51
- <div className="space-y-3">
52
- <Button type="button" className="w-full" id={webAuthnButtonId}>
53
- {msgStr("doRegisterSecurityKey")}
54
- </Button>
55
-
56
- {!kcContext.isSetRetry && kcContext.isAppInitiatedAction && (
57
- <form
58
- action={kcContext.url.loginAction}
59
- id="kc-webauthn-settings-form"
60
- method="post"
61
- >
62
- <Button
63
- type="submit"
64
- variant="outline"
65
- className="w-full"
66
- id="cancelWebAuthnAIA"
67
- name="cancel-aia"
68
- value="true"
69
- >
70
- {msgStr("doCancel")}
71
- </Button>
72
- </form>
73
- )}
74
- </div>
75
- </div>
76
- </Template>
77
- );
78
- }
1
+ import { Button } from "@/components/ui/button";
2
+ import { LogoutOtherSessions } from '@/login/components/LogoutOtherSessions';
3
+ import { useI18n } from '@/login/i18n';
4
+ import { useKcContext } from '@/login/KcContext';
5
+ import { assert } from "tsafe/assert";
6
+ import { Template } from "../../components/Template";
7
+ import { useScript } from './useScript';
8
+
9
+ export function Page() {
10
+ const { kcContext } = useKcContext();
11
+ assert(kcContext.pageId === "webauthn-register.ftl");
12
+
13
+ const { msg, msgStr } = useI18n();
14
+
15
+ const webAuthnButtonId = "authenticateWebAuthnButton";
16
+
17
+ useScript({ webAuthnButtonId });
18
+
19
+ return (
20
+ <Template
21
+ headerNode={
22
+ <div className="flex items-center justify-center gap-2">
23
+ <span>{msg("webauthn-registration-title")}</span>
24
+ </div>
25
+ }
26
+ >
27
+ <div className="space-y-6">
28
+ <form id="register" action={kcContext.url.loginAction} method="post">
29
+ <input type="hidden" id="clientDataJSON" name="clientDataJSON" />
30
+ <input
31
+ type="hidden"
32
+ id="attestationObject"
33
+ name="attestationObject"
34
+ />
35
+ <input
36
+ type="hidden"
37
+ id="publicKeyCredentialId"
38
+ name="publicKeyCredentialId"
39
+ />
40
+ <input
41
+ type="hidden"
42
+ id="authenticatorLabel"
43
+ name="authenticatorLabel"
44
+ />
45
+ <input type="hidden" id="transports" name="transports" />
46
+ <input type="hidden" id="error" name="error" />
47
+ </form>
48
+
49
+ <LogoutOtherSessions />
50
+
51
+ <div className="space-y-3">
52
+ <Button type="button" className="w-full" id={webAuthnButtonId}>
53
+ {msgStr("doRegisterSecurityKey")}
54
+ </Button>
55
+
56
+ {!kcContext.isSetRetry && kcContext.isAppInitiatedAction && (
57
+ <form
58
+ action={kcContext.url.loginAction}
59
+ id="kc-webauthn-settings-form"
60
+ method="post"
61
+ >
62
+ <Button
63
+ type="submit"
64
+ variant="outline"
65
+ className="w-full"
66
+ id="cancelWebAuthnAIA"
67
+ name="cancel-aia"
68
+ value="true"
69
+ >
70
+ {msgStr("doCancel")}
71
+ </Button>
72
+ </form>
73
+ )}
74
+ </div>
75
+ </div>
76
+ </Template>
77
+ );
78
+ }
@@ -1,3 +1,3 @@
1
- import { Page } from "./Page";
2
-
3
- export default Page;
1
+ import { Page } from "./Page";
2
+
3
+ export default Page;