|
| 1 | +import type { Meta, StoryObj } from "@storybook/react"; |
| 2 | +import { createKcPageStory } from "../KcPageStory"; |
| 3 | + |
| 4 | +const { KcPageStory } = createKcPageStory({ pageId: "info.ftl" }); |
| 5 | + |
| 6 | +const meta = { |
| 7 | + title: "login/info.ftl", |
| 8 | + component: KcPageStory |
| 9 | +} satisfies Meta<typeof KcPageStory>; |
| 10 | + |
| 11 | +export default meta; |
| 12 | + |
| 13 | +type Story = StoryObj<typeof meta>; |
| 14 | + |
| 15 | +export const Default: Story = { |
| 16 | + render: () => ( |
| 17 | + <KcPageStory |
| 18 | + kcContext={{ |
| 19 | + message: { |
| 20 | + summary: "Your email has been verified successfully." |
| 21 | + }, |
| 22 | + pageRedirectUri: "https://hubee.com" |
| 23 | + }} |
| 24 | + /> |
| 25 | + ) |
| 26 | +}; |
| 27 | + |
| 28 | +/** |
| 29 | + * WithRequiredActions: |
| 30 | + * - Purpose: Tests the info page when certain actions are required from the user. |
| 31 | + * - Scenario: Simulates a scenario where the user needs to complete specific actions (e.g., verify email, update password). |
| 32 | + * - Key Aspect: Displays a list of required actions that the user must complete. |
| 33 | + */ |
| 34 | +export const WithRequiredActions: Story = { |
| 35 | + render: () => ( |
| 36 | + <KcPageStory |
| 37 | + kcContext={{ |
| 38 | + messageHeader: "Action Required", |
| 39 | + message: { |
| 40 | + summary: "Please complete the following actions to continue." |
| 41 | + }, |
| 42 | + requiredActions: ["VERIFY_EMAIL", "UPDATE_PASSWORD"], |
| 43 | + actionUri: "/auth/realms/hubee/login-actions/required-action" |
| 44 | + }} |
| 45 | + /> |
| 46 | + ) |
| 47 | +}; |
| 48 | + |
| 49 | +/** |
| 50 | + * WithActionUri: |
| 51 | + * - Purpose: Tests the page with an action URI link. |
| 52 | + * - Scenario: Simulates an info page that provides a link to proceed with a specific action. |
| 53 | + * - Key Aspect: Displays a "proceed with action" link instead of "back to application". |
| 54 | + */ |
| 55 | +export const WithActionUri: Story = { |
| 56 | + render: () => ( |
| 57 | + <KcPageStory |
| 58 | + kcContext={{ |
| 59 | + message: { |
| 60 | + summary: "Your profile has been updated." |
| 61 | + }, |
| 62 | + actionUri: "/auth/realms/hubee/account" |
| 63 | + }} |
| 64 | + /> |
| 65 | + ) |
| 66 | +}; |
| 67 | + |
| 68 | +/** |
| 69 | + * WithClientBaseUrl: |
| 70 | + * - Purpose: Tests the page with only a client base URL available. |
| 71 | + * - Scenario: Simulates when no specific redirect URI is provided, falling back to the client's base URL. |
| 72 | + * - Key Aspect: Uses the client base URL as the "back to application" link. |
| 73 | + */ |
| 74 | +export const WithClientBaseUrl: Story = { |
| 75 | + render: () => ( |
| 76 | + <KcPageStory |
| 77 | + kcContext={{ |
| 78 | + message: { |
| 79 | + summary: "Your settings have been saved." |
| 80 | + }, |
| 81 | + client: { |
| 82 | + baseUrl: "https://hubee.com" |
| 83 | + } |
| 84 | + }} |
| 85 | + /> |
| 86 | + ) |
| 87 | +}; |
| 88 | + |
| 89 | +/** |
| 90 | + * EmailVerificationSuccess: |
| 91 | + * - Purpose: Tests a typical email verification success message. |
| 92 | + * - Scenario: User clicks on email verification link and sees success message. |
| 93 | + * - Key Aspect: Shows success message with redirect to application. |
| 94 | + */ |
| 95 | +export const EmailVerificationSuccess: Story = { |
| 96 | + render: () => ( |
| 97 | + <KcPageStory |
| 98 | + kcContext={{ |
| 99 | + messageHeader: "Email verified", |
| 100 | + message: { |
| 101 | + summary: "Your email address has been verified successfully." |
| 102 | + }, |
| 103 | + pageRedirectUri: "https://hubee.com/dashboard" |
| 104 | + }} |
| 105 | + /> |
| 106 | + ) |
| 107 | +}; |
0 commit comments