@indietabletop/appkit 6.1.5 → 7.0.0-0
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.
- package/dist/AppConfig/AppConfig.d.ts +29 -0
- package/dist/AuthCard/AuthCard.d.ts +10 -0
- package/dist/AuthCard/AuthCard.stories.d.ts +34 -0
- package/dist/AuthCard/style.css.d.ts +23 -0
- package/dist/DialogTrigger/index.d.ts +13 -0
- package/dist/DocumentTitle/DocumentTitle.d.ts +3 -0
- package/dist/EnumMapper.d.ts +25 -0
- package/dist/ExternalLink.d.ts +3 -0
- package/dist/FullscreenDismissBlocker.d.ts +5 -0
- package/{lib/HistoryState.ts → dist/HistoryState.d.ts} +2 -5
- package/dist/IndieTabletopClubLogo.d.ts +7 -0
- package/dist/IndieTabletopClubSymbol.d.ts +7 -0
- package/dist/InfoPage/index.d.ts +8 -0
- package/dist/InfoPage/pages.d.ts +2 -0
- package/dist/InfoPage/style.css.d.ts +5 -0
- package/dist/Letterhead/index.d.ts +19 -0
- package/dist/Letterhead/stories.d.ts +13 -0
- package/dist/Letterhead/style.css.d.ts +46 -0
- package/dist/LetterheadForm/LetterheadReadonlyTextField.stories.d.ts +17 -0
- package/dist/LetterheadForm/LetterheadSubmitError.stories.d.ts +11 -0
- package/dist/LetterheadForm/LetterheadTextField.stories.d.ts +336 -0
- package/dist/LetterheadForm/index.d.ts +44 -0
- package/dist/LetterheadForm/style.css.d.ts +8 -0
- package/dist/LoadingIndicator.d.ts +3 -0
- package/dist/MiddotSeparated/MiddotSeparated.d.ts +8 -0
- package/dist/MiddotSeparated/MiddotSeparated.stories.d.ts +586 -0
- package/dist/MiddotSeparated/style.css.d.ts +1 -0
- package/dist/ModalDialog/index.d.ts +12 -0
- package/dist/ModalDialog/style.css.d.ts +58 -0
- package/dist/ModernIDB/Cursor.d.ts +56 -0
- package/dist/ModernIDB/ModernIDB.d.ts +66 -0
- package/dist/ModernIDB/ModernIDBError.d.ts +3 -0
- package/dist/ModernIDB/ObjectStore.d.ts +112 -0
- package/dist/ModernIDB/ObjectStoreIndex.d.ts +53 -0
- package/dist/ModernIDB/Transaction.d.ts +16 -0
- package/dist/ModernIDB/VersionChangeManager.d.ts +30 -0
- package/dist/ModernIDB/bindings/factory.d.ts +12 -0
- package/dist/ModernIDB/bindings/index.d.ts +2 -0
- package/{lib/ModernIDB/bindings/types.ts → dist/ModernIDB/bindings/types.d.ts} +13 -32
- package/dist/ModernIDB/bindings/utils.d.ts +2 -0
- package/dist/ModernIDB/index.d.ts +10 -0
- package/dist/ModernIDB/types.d.ts +88 -0
- package/dist/ModernIDB/utils.d.ts +4 -0
- package/dist/QRCode/QRCode.d.ts +7 -0
- package/dist/QRCode/QRCode.stories.d.ts +33 -0
- package/dist/QRCode/style.css.d.ts +4 -0
- package/dist/ReleaseInfo/index.d.ts +5 -0
- package/dist/RulesetResolver.d.ts +87 -0
- package/dist/SafariCheck/SafariCheck.d.ts +23 -0
- package/dist/SafariCheck/SafariCheck.stories.d.ts +73 -0
- package/dist/SafariCheck/style.css.d.ts +17 -0
- package/dist/ServiceWorkerHandler.d.ts +11 -0
- package/dist/ShareButton/ShareButton.d.ts +57 -0
- package/dist/ShareButton/ShareButton.stories.d.ts +1577 -0
- package/dist/ShareButton/test.css.d.ts +1 -0
- package/dist/SubscribeCard/LetterheadInfoCard.d.ts +2 -0
- package/dist/SubscribeCard/SubscribeByEmailCard.d.ts +24 -0
- package/dist/SubscribeCard/SubscribeByEmailCard.stories.d.ts +10 -0
- package/dist/SubscribeCard/SubscribeByPledgeCard.d.ts +36 -0
- package/dist/SubscribeCard/SubscribeByPledgeCard.stories.d.ts +65 -0
- package/dist/SubscribeCard/style.css.d.ts +4 -0
- package/dist/account/AccountIssueView.d.ts +3 -0
- package/dist/account/AlreadyLoggedInView.d.ts +5 -0
- package/dist/account/CurrentUserFetcher.d.ts +20 -0
- package/dist/account/CurrentUserFetcher.stories.d.ts +136 -0
- package/dist/account/FailureFallbackView.d.ts +1 -0
- package/dist/account/JoinCard.d.ts +14 -0
- package/dist/account/JoinCard.stories.d.ts +143 -0
- package/dist/account/LoadingView.d.ts +1 -0
- package/dist/account/LoginCard.d.ts +39 -0
- package/dist/account/LoginCard.stories.d.ts +217 -0
- package/dist/account/LoginView.d.ts +10 -0
- package/dist/account/NoConnectionView.d.ts +4 -0
- package/dist/account/PasswordResetCard.d.ts +15 -0
- package/dist/account/PasswordResetCard.stories.d.ts +128 -0
- package/dist/account/UserMismatchView.d.ts +6 -0
- package/dist/account/VerifyPage.d.ts +13 -0
- package/dist/account/style.css.d.ts +10 -0
- package/{lib/account/types.ts → dist/account/types.d.ts} +3 -6
- package/dist/account/useFetchCurrentUser.d.ts +28 -0
- package/dist/account/useRedirectPath.d.ts +6 -0
- package/dist/animations.css.d.ts +3 -0
- package/dist/append-copy-to-text.d.ts +10 -0
- package/dist/append-copy-to-text.test.d.ts +1 -0
- package/dist/appkit.css +1 -0
- package/dist/appkit.js +10692 -0
- package/dist/async-op.d.ts +101 -0
- package/dist/atomic.css.d.ts +6 -0
- package/{lib/caught-value.ts → dist/caught-value.d.ts} +1 -11
- package/{lib/class-names.ts → dist/class-names.d.ts} +6 -17
- package/dist/client.d.ts +424 -0
- package/dist/common.css.d.ts +5 -0
- package/dist/copyrightRange.d.ts +1 -0
- package/dist/copyrightRange.test.d.ts +1 -0
- package/dist/createSafeStorage.d.ts +34 -0
- package/dist/failureMessages.d.ts +20 -0
- package/dist/failureMessages.test.d.ts +1 -0
- package/dist/form/FormSubmitButton.d.ts +17 -0
- package/dist/form/SubmitErrorAlert.d.ts +5 -0
- package/dist/form/style.css.d.ts +3 -0
- package/dist/globals.css.d.ts +0 -0
- package/dist/groupBy.d.ts +1 -0
- package/dist/groupBy.test.d.ts +1 -0
- package/dist/hrefs.d.ts +32 -0
- package/dist/hrefs.test.d.ts +1 -0
- package/dist/idToDate.d.ts +5 -0
- package/dist/idToDate.test.d.ts +1 -0
- package/dist/ids.d.ts +1 -0
- package/dist/ids.test.d.ts +1 -0
- package/dist/index.d.ts +64 -0
- package/dist/internal.css.d.ts +2 -0
- package/dist/mailto.d.ts +8 -0
- package/dist/mailto.test.d.ts +1 -0
- package/dist/media.d.ts +39 -0
- package/dist/random.d.ts +3 -0
- package/dist/result/swr.d.ts +4 -0
- package/{lib/sleep.ts → dist/sleep.d.ts} +1 -3
- package/dist/store/index.d.ts +237 -0
- package/dist/store/store.d.ts +144 -0
- package/dist/store/types.d.ts +49 -0
- package/dist/store/utils.d.ts +10 -0
- package/dist/storybook/decorators.d.ts +3 -0
- package/dist/structs.d.ts +1 -0
- package/{lib/typeguards.ts → dist/typeguards.d.ts} +1 -3
- package/dist/typeguards.test.d.ts +1 -0
- package/{lib/types.ts → dist/types.d.ts} +12 -23
- package/dist/unique.d.ts +10 -0
- package/dist/unique.test.d.ts +1 -0
- package/dist/use-async-op.d.ts +6 -0
- package/dist/use-document-background-color.d.ts +4 -0
- package/dist/use-form.d.ts +29 -0
- package/dist/use-is-installed.d.ts +8 -0
- package/dist/use-media-query.d.ts +1 -0
- package/dist/use-reverting-state.d.ts +5 -0
- package/dist/use-scroll-restoration.d.ts +25 -0
- package/dist/useEnsureValue.d.ts +6 -0
- package/dist/useInvokeClient.d.ts +25 -0
- package/dist/useIsVisible.d.ts +4 -0
- package/dist/utm.d.ts +58 -0
- package/dist/utm.test.d.ts +1 -0
- package/dist/validations.d.ts +3 -0
- package/dist/vars.css.d.ts +10 -0
- package/package.json +12 -5
- package/lib/AppConfig/AppConfig.tsx +0 -61
- package/lib/AuthCard/AuthCard.stories.ts +0 -34
- package/lib/AuthCard/AuthCard.tsx +0 -64
- package/lib/AuthCard/style.css.ts +0 -49
- package/lib/DialogTrigger/index.tsx +0 -36
- package/lib/DocumentTitle/DocumentTitle.tsx +0 -10
- package/lib/EnumMapper.ts +0 -50
- package/lib/ExternalLink.tsx +0 -10
- package/lib/FullscreenDismissBlocker.tsx +0 -23
- package/lib/IndieTabletopClubLogo.tsx +0 -44
- package/lib/IndieTabletopClubSymbol.tsx +0 -37
- package/lib/InfoPage/index.tsx +0 -46
- package/lib/InfoPage/pages.tsx +0 -36
- package/lib/InfoPage/style.css.ts +0 -36
- package/lib/Letterhead/index.tsx +0 -85
- package/lib/Letterhead/stories.tsx +0 -41
- package/lib/Letterhead/style.css.ts +0 -152
- package/lib/LetterheadForm/LetterheadReadonlyTextField.stories.tsx +0 -17
- package/lib/LetterheadForm/LetterheadSubmitError.stories.tsx +0 -19
- package/lib/LetterheadForm/LetterheadTextField.stories.tsx +0 -19
- package/lib/LetterheadForm/index.tsx +0 -137
- package/lib/LetterheadForm/style.css.ts +0 -89
- package/lib/LoadingIndicator.tsx +0 -40
- package/lib/MiddotSeparated/MiddotSeparated.stories.ts +0 -26
- package/lib/MiddotSeparated/MiddotSeparated.tsx +0 -24
- package/lib/MiddotSeparated/style.css.ts +0 -10
- package/lib/ModalDialog/index.tsx +0 -28
- package/lib/ModalDialog/style.css.ts +0 -88
- package/lib/ModernIDB/Cursor.ts +0 -91
- package/lib/ModernIDB/ModernIDB.ts +0 -337
- package/lib/ModernIDB/ModernIDBError.ts +0 -9
- package/lib/ModernIDB/ObjectStore.ts +0 -195
- package/lib/ModernIDB/ObjectStoreIndex.ts +0 -102
- package/lib/ModernIDB/README.md +0 -9
- package/lib/ModernIDB/Transaction.ts +0 -40
- package/lib/ModernIDB/VersionChangeManager.ts +0 -57
- package/lib/ModernIDB/bindings/factory.tsx +0 -165
- package/lib/ModernIDB/bindings/index.ts +0 -2
- package/lib/ModernIDB/bindings/utils.tsx +0 -32
- package/lib/ModernIDB/index.ts +0 -10
- package/lib/ModernIDB/types.ts +0 -120
- package/lib/ModernIDB/utils.ts +0 -51
- package/lib/QRCode/QRCode.stories.tsx +0 -41
- package/lib/QRCode/QRCode.tsx +0 -54
- package/lib/QRCode/style.css.ts +0 -23
- package/lib/ReleaseInfo/index.tsx +0 -29
- package/lib/RulesetResolver.ts +0 -214
- package/lib/SafariCheck/SafariCheck.stories.tsx +0 -99
- package/lib/SafariCheck/SafariCheck.tsx +0 -273
- package/lib/SafariCheck/addToDock.svg +0 -13
- package/lib/SafariCheck/addToHomeScreen.svg +0 -12
- package/lib/SafariCheck/safari.svg +0 -32
- package/lib/SafariCheck/shareIcon.svg +0 -11
- package/lib/SafariCheck/style.css.ts +0 -106
- package/lib/ServiceWorkerHandler.tsx +0 -53
- package/lib/ShareButton/ShareButton.stories.tsx +0 -58
- package/lib/ShareButton/ShareButton.tsx +0 -153
- package/lib/ShareButton/test.css.ts +0 -3
- package/lib/SubscribeCard/LetterheadInfoCard.tsx +0 -23
- package/lib/SubscribeCard/SubscribeByEmailCard.stories.tsx +0 -69
- package/lib/SubscribeCard/SubscribeByEmailCard.tsx +0 -183
- package/lib/SubscribeCard/SubscribeByPledgeCard.stories.tsx +0 -133
- package/lib/SubscribeCard/SubscribeByPledgeCard.tsx +0 -127
- package/lib/SubscribeCard/style.css.ts +0 -14
- package/lib/account/AccountIssueView.tsx +0 -44
- package/lib/account/AlreadyLoggedInView.tsx +0 -47
- package/lib/account/CurrentUserFetcher.stories.tsx +0 -292
- package/lib/account/CurrentUserFetcher.tsx +0 -118
- package/lib/account/FailureFallbackView.tsx +0 -36
- package/lib/account/JoinCard.stories.tsx +0 -257
- package/lib/account/JoinCard.tsx +0 -301
- package/lib/account/LoadingView.tsx +0 -14
- package/lib/account/LoginCard.stories.tsx +0 -288
- package/lib/account/LoginCard.tsx +0 -100
- package/lib/account/LoginView.tsx +0 -151
- package/lib/account/NoConnectionView.tsx +0 -34
- package/lib/account/PasswordResetCard.stories.tsx +0 -242
- package/lib/account/PasswordResetCard.tsx +0 -296
- package/lib/account/UserMismatchView.tsx +0 -62
- package/lib/account/VerifyPage.tsx +0 -195
- package/lib/account/style.css.ts +0 -57
- package/lib/account/useFetchCurrentUser.tsx +0 -63
- package/lib/account/useRedirectPath.ts +0 -21
- package/lib/animations.css.ts +0 -17
- package/lib/append-copy-to-text.ts +0 -35
- package/lib/async-op.ts +0 -286
- package/lib/atomic.css.ts +0 -11
- package/lib/client.ts +0 -662
- package/lib/common.css.ts +0 -48
- package/lib/copyrightRange.ts +0 -10
- package/lib/createSafeStorage.ts +0 -91
- package/lib/failureMessages.ts +0 -108
- package/lib/form/FormSubmitButton.tsx +0 -58
- package/lib/form/SubmitErrorAlert.tsx +0 -21
- package/lib/form/style.css.ts +0 -9
- package/lib/globals.css.ts +0 -62
- package/lib/groupBy.ts +0 -25
- package/lib/hrefs.ts +0 -48
- package/lib/idToDate.ts +0 -8
- package/lib/ids.ts +0 -6
- package/lib/index.ts +0 -71
- package/lib/internal.css.ts +0 -10
- package/lib/mailto.ts +0 -40
- package/lib/media.ts +0 -50
- package/lib/random.ts +0 -19
- package/lib/result/swr.ts +0 -18
- package/lib/store/index.tsx +0 -241
- package/lib/store/store.ts +0 -479
- package/lib/store/types.ts +0 -45
- package/lib/store/utils.ts +0 -54
- package/lib/storybook/decorators.tsx +0 -10
- package/lib/structs.ts +0 -3
- package/lib/unique.ts +0 -24
- package/lib/use-async-op.ts +0 -16
- package/lib/use-document-background-color.ts +0 -16
- package/lib/use-form.ts +0 -78
- package/lib/use-is-installed.ts +0 -17
- package/lib/use-media-query.ts +0 -21
- package/lib/use-reverting-state.ts +0 -32
- package/lib/use-scroll-restoration.ts +0 -99
- package/lib/useEnsureValue.ts +0 -31
- package/lib/useInvokeClient.ts +0 -54
- package/lib/useIsVisible.ts +0 -27
- package/lib/utm.ts +0 -92
- package/lib/validations.ts +0 -25
- package/lib/vars.css.ts +0 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const test: string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type SubscribeStep = {
|
|
3
|
+
type: "SUBSCRIBE";
|
|
4
|
+
} | {
|
|
5
|
+
type: "SUBMIT_CODE";
|
|
6
|
+
email: string;
|
|
7
|
+
tokenId: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: "SUBSCRIBE_SUCCESS";
|
|
10
|
+
};
|
|
11
|
+
type ViewContent = {
|
|
12
|
+
title: ReactNode;
|
|
13
|
+
description: ReactNode;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Allows users to sign up to the newsletter using an arbitrary email.
|
|
17
|
+
*
|
|
18
|
+
* Signups are verified using an one-time code, which is sent to the supplied
|
|
19
|
+
* email address.
|
|
20
|
+
*/
|
|
21
|
+
export declare function SubscribeByEmailCard(props: {
|
|
22
|
+
content: Record<Exclude<SubscribeStep["type"], "SUBMIT_CODE">, ViewContent>;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const Default: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
2
|
+
csf4: true;
|
|
3
|
+
} & {
|
|
4
|
+
args: {
|
|
5
|
+
content: Record<Exclude<"SUBMIT_CODE" | "SUBSCRIBE" | "SUBSCRIBE_SUCCESS", "SUBMIT_CODE">, {
|
|
6
|
+
title: import('react').ReactNode;
|
|
7
|
+
description: import('react').ReactNode;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
}, {}>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { RedeemedPledge } from '@indietabletop/types';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
type Pledge = Pick<RedeemedPledge, "id" | "email" | "contactSubscribed">;
|
|
4
|
+
type SubscribeStep = "PREVIOUSLY_SUBSCRIBED" | "SUBSCRIBE" | "SUBSCRIBE_SUCCESS";
|
|
5
|
+
export type ViewContent = {
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
description: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Allows users to sign up to the newsletter using the email associated with
|
|
11
|
+
* their pledge ID.
|
|
12
|
+
*
|
|
13
|
+
* Emails are not verified using a one-time code, as the user has just
|
|
14
|
+
* implicitly verified their address by navigating to the page with the unique
|
|
15
|
+
* pledge ID.
|
|
16
|
+
*/
|
|
17
|
+
export declare function SubscribeByPledgeCard(props: {
|
|
18
|
+
/**
|
|
19
|
+
* The pledge data that will be used to determine whether the user should
|
|
20
|
+
* be prompted for signup.
|
|
21
|
+
*/
|
|
22
|
+
pledge: Pledge;
|
|
23
|
+
/**
|
|
24
|
+
* Content for each of the subscribe steps. You probably want to customize it
|
|
25
|
+
* for each step, so it is left to be defined at point of usage.
|
|
26
|
+
*
|
|
27
|
+
* If the `description` is a string, it will be wrapped in
|
|
28
|
+
* `<LetterheadParagraph>`, otherwise it will be left as is.
|
|
29
|
+
*/
|
|
30
|
+
content: Record<SubscribeStep, ViewContent>;
|
|
31
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export {
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use {@link SubscribeByPledgeCard}
|
|
35
|
+
*/
|
|
36
|
+
SubscribeByPledgeCard as SubscribeCard, };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default case, in which the user is not yet subscribed to ITC's newsletter
|
|
3
|
+
* and the submission is successful.
|
|
4
|
+
*/
|
|
5
|
+
export declare const Default: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
6
|
+
csf4: true;
|
|
7
|
+
} & {
|
|
8
|
+
args: {
|
|
9
|
+
pledge: {
|
|
10
|
+
id: string;
|
|
11
|
+
email: string;
|
|
12
|
+
contactSubscribed: boolean;
|
|
13
|
+
};
|
|
14
|
+
content: Record<"PREVIOUSLY_SUBSCRIBED" | "SUBSCRIBE" | "SUBSCRIBE_SUCCESS", import('./SubscribeByPledgeCard.tsx').ViewContent>;
|
|
15
|
+
};
|
|
16
|
+
}, {}>;
|
|
17
|
+
/**
|
|
18
|
+
* Same like the default case, but the form submission fails. Errors are
|
|
19
|
+
* differentiated using the `getSubmitFailureMessage` helper, so all the basics
|
|
20
|
+
* should be covered, as this page doesn't have special cases.
|
|
21
|
+
*/
|
|
22
|
+
export declare const FailureOnSubmit: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
23
|
+
csf4: true;
|
|
24
|
+
} & {
|
|
25
|
+
args: {
|
|
26
|
+
pledge: {
|
|
27
|
+
id: string;
|
|
28
|
+
email: string;
|
|
29
|
+
contactSubscribed: boolean;
|
|
30
|
+
};
|
|
31
|
+
content: Record<"PREVIOUSLY_SUBSCRIBED" | "SUBSCRIBE" | "SUBSCRIBE_SUCCESS", import('./SubscribeByPledgeCard.tsx').ViewContent>;
|
|
32
|
+
};
|
|
33
|
+
}, {
|
|
34
|
+
parameters: {
|
|
35
|
+
msw: {
|
|
36
|
+
handlers: {
|
|
37
|
+
subscribeByPledgeId: import('msw').HttpHandler;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* In this case, the email address associated with this user account is
|
|
44
|
+
* already subscribed to our newsletter.
|
|
45
|
+
*/
|
|
46
|
+
export declare const AlreadySubscribed: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
47
|
+
csf4: true;
|
|
48
|
+
} & {
|
|
49
|
+
args: {
|
|
50
|
+
pledge: {
|
|
51
|
+
id: string;
|
|
52
|
+
email: string;
|
|
53
|
+
contactSubscribed: boolean;
|
|
54
|
+
};
|
|
55
|
+
content: Record<"PREVIOUSLY_SUBSCRIBED" | "SUBSCRIBE" | "SUBSCRIBE_SUCCESS", import('./SubscribeByPledgeCard.tsx').ViewContent>;
|
|
56
|
+
};
|
|
57
|
+
}, {
|
|
58
|
+
args: {
|
|
59
|
+
pledge: {
|
|
60
|
+
contactSubscribed: true;
|
|
61
|
+
id: string;
|
|
62
|
+
email: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type CurrentUserFetcherProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Fetches fresh current user data if a local user exists in the app store.
|
|
7
|
+
*
|
|
8
|
+
* This component uses the Indie Tabletop Client under the hood, so if new
|
|
9
|
+
* data is successfully fetched, the onCurrentUser callback will be invoked,
|
|
10
|
+
* and it is up to the configuration of the client to store the data.
|
|
11
|
+
*
|
|
12
|
+
* Importantly, this component also handles the various user account issues
|
|
13
|
+
* that we could run into: expired session, user mismatch and account deletion.
|
|
14
|
+
*
|
|
15
|
+
* All other errors are ignored. This allows users to use the app in offline
|
|
16
|
+
* mode, and doesn't interrupt their session if some unexpected error happens,
|
|
17
|
+
* which they cannot do anything about anyways.
|
|
18
|
+
*/
|
|
19
|
+
export declare function CurrentUserFetcher(props: CurrentUserFetcherProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default case, in which a local user is provided (so they have previously
|
|
3
|
+
* logged in), and the current user request returns the same user as is
|
|
4
|
+
* the local user (determined by the user id).
|
|
5
|
+
*/
|
|
6
|
+
export declare const Default: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
7
|
+
csf4: true;
|
|
8
|
+
} & {
|
|
9
|
+
args: {
|
|
10
|
+
children: import('react').ReactNode;
|
|
11
|
+
};
|
|
12
|
+
}, {
|
|
13
|
+
parameters: {
|
|
14
|
+
msw: {
|
|
15
|
+
handlers: {
|
|
16
|
+
getCurrentUser: import('msw').HttpHandler;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* In this case, no local user is provided and the component simply renders
|
|
23
|
+
* its children. There should be no network request in this case.
|
|
24
|
+
*/
|
|
25
|
+
export declare const NoLocalUser: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
26
|
+
csf4: true;
|
|
27
|
+
} & {
|
|
28
|
+
args: {
|
|
29
|
+
children: import('react').ReactNode;
|
|
30
|
+
};
|
|
31
|
+
}, {}>;
|
|
32
|
+
/**
|
|
33
|
+
* In this case, the local user is provided and the current user request returns
|
|
34
|
+
* error 401. The user should supply their credentials again.
|
|
35
|
+
*/
|
|
36
|
+
export declare const SessionExpired: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
37
|
+
csf4: true;
|
|
38
|
+
} & {
|
|
39
|
+
args: {
|
|
40
|
+
children: import('react').ReactNode;
|
|
41
|
+
};
|
|
42
|
+
}, {
|
|
43
|
+
parameters: {
|
|
44
|
+
msw: {
|
|
45
|
+
handlers: {
|
|
46
|
+
getCurrentUser: import('msw').HttpHandler;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* In this case, the local user is provided and the current user request returns
|
|
53
|
+
* a different user (determined by user ID).
|
|
54
|
+
*
|
|
55
|
+
* This case can happen when user A logs into app X, then user B logs into
|
|
56
|
+
* app Y. Returning to app X, user B will be logged into ITC with their account
|
|
57
|
+
* but local data belong to user A.
|
|
58
|
+
*
|
|
59
|
+
* In practice this should be a rare case, but with unpleasant circumstances
|
|
60
|
+
* if not handled correctly.
|
|
61
|
+
*/
|
|
62
|
+
export declare const UserMismatch: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
63
|
+
csf4: true;
|
|
64
|
+
} & {
|
|
65
|
+
args: {
|
|
66
|
+
children: import('react').ReactNode;
|
|
67
|
+
};
|
|
68
|
+
}, {
|
|
69
|
+
parameters: {
|
|
70
|
+
msw: {
|
|
71
|
+
handlers: {
|
|
72
|
+
getCurrentUser: import('msw').HttpHandler;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
}>;
|
|
77
|
+
/**
|
|
78
|
+
*/
|
|
79
|
+
export declare const UserUnverified: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
80
|
+
csf4: true;
|
|
81
|
+
} & {
|
|
82
|
+
args: {
|
|
83
|
+
children: import('react').ReactNode;
|
|
84
|
+
};
|
|
85
|
+
}, {
|
|
86
|
+
parameters: {
|
|
87
|
+
msw: {
|
|
88
|
+
handlers: {
|
|
89
|
+
getCurrentUser: import('msw').HttpHandler;
|
|
90
|
+
requestVerify: import('msw').HttpHandler;
|
|
91
|
+
verify: import('msw').HttpHandler;
|
|
92
|
+
refreshTokens: import('msw').HttpHandler;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* In this case, the local user is provided and the current user request returns
|
|
99
|
+
* 404, indicating that the current user no longer exists.
|
|
100
|
+
*
|
|
101
|
+
* This can happen if users delete their accounts but
|
|
102
|
+
*/
|
|
103
|
+
export declare const UserNotFound: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
104
|
+
csf4: true;
|
|
105
|
+
} & {
|
|
106
|
+
args: {
|
|
107
|
+
children: import('react').ReactNode;
|
|
108
|
+
};
|
|
109
|
+
}, {
|
|
110
|
+
parameters: {
|
|
111
|
+
msw: {
|
|
112
|
+
handlers: {
|
|
113
|
+
getCurrentUser: import('msw').HttpHandler;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* The proactive user session check has failed due to an error that doesn't
|
|
120
|
+
* carry any special meaning.
|
|
121
|
+
*/
|
|
122
|
+
export declare const UnknownFailure: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
123
|
+
csf4: true;
|
|
124
|
+
} & {
|
|
125
|
+
args: {
|
|
126
|
+
children: import('react').ReactNode;
|
|
127
|
+
};
|
|
128
|
+
}, {
|
|
129
|
+
parameters: {
|
|
130
|
+
msw: {
|
|
131
|
+
handlers: {
|
|
132
|
+
getCurrentUser: import('msw').HttpHandler;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function FailureFallbackView(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DefaultFormValues } from './types.ts';
|
|
2
|
+
export type JoinCardProps = {
|
|
3
|
+
defaultValues?: DefaultFormValues;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Allows the user to join Indie Tabletop Club.
|
|
7
|
+
*
|
|
8
|
+
* Will automatically use the `redirectTo` query param value as the redirect
|
|
9
|
+
* location once the user creates and verifies their account.
|
|
10
|
+
*
|
|
11
|
+
* Otherwise a success screen will be shown and the user will be directed to
|
|
12
|
+
* the dashboard.
|
|
13
|
+
*/
|
|
14
|
+
export declare function JoinCard(props: JoinCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default case in which all steps of the flow succeed.
|
|
3
|
+
*/
|
|
4
|
+
export declare const Success: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
5
|
+
csf4: true;
|
|
6
|
+
} & {
|
|
7
|
+
args: {
|
|
8
|
+
defaultValues?: import('./types.ts').DefaultFormValues | undefined;
|
|
9
|
+
};
|
|
10
|
+
}, {}>;
|
|
11
|
+
/**
|
|
12
|
+
* In this case, the initial step fails because the email address is associated
|
|
13
|
+
* with an existing user.
|
|
14
|
+
*/
|
|
15
|
+
export declare const EmailTakenOnJoin: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
16
|
+
csf4: true;
|
|
17
|
+
} & {
|
|
18
|
+
args: {
|
|
19
|
+
defaultValues?: import('./types.ts').DefaultFormValues | undefined;
|
|
20
|
+
};
|
|
21
|
+
}, {
|
|
22
|
+
parameters: {
|
|
23
|
+
msw: {
|
|
24
|
+
handlers: {
|
|
25
|
+
join: import('msw').HttpHandler;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* In this case, the initial step fails for a reason that doesn't have any
|
|
32
|
+
* special handling in this location. E.g. network error, server error, etc.
|
|
33
|
+
*/
|
|
34
|
+
export declare const UnknownFailureOnJoin: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
35
|
+
csf4: true;
|
|
36
|
+
} & {
|
|
37
|
+
args: {
|
|
38
|
+
defaultValues?: import('./types.ts').DefaultFormValues | undefined;
|
|
39
|
+
};
|
|
40
|
+
}, {
|
|
41
|
+
parameters: {
|
|
42
|
+
msw: {
|
|
43
|
+
handlers: {
|
|
44
|
+
join: import('msw').HttpHandler;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* In this case, the verify step fails because the token has expired,
|
|
51
|
+
* or is incorrect.
|
|
52
|
+
*/
|
|
53
|
+
export declare const NotFoundOrExpiredOnVerify: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
54
|
+
csf4: true;
|
|
55
|
+
} & {
|
|
56
|
+
args: {
|
|
57
|
+
defaultValues?: import('./types.ts').DefaultFormValues | undefined;
|
|
58
|
+
};
|
|
59
|
+
}, {
|
|
60
|
+
parameters: {
|
|
61
|
+
msw: {
|
|
62
|
+
handlers: {
|
|
63
|
+
verify: import('msw').HttpHandler;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* In this case, the verify step fails for a reason that doesn't have any
|
|
70
|
+
* special handling in this location. E.g. network error, server error, etc.
|
|
71
|
+
*/
|
|
72
|
+
export declare const UnknownFailureOnVerify: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
73
|
+
csf4: true;
|
|
74
|
+
} & {
|
|
75
|
+
args: {
|
|
76
|
+
defaultValues?: import('./types.ts').DefaultFormValues | undefined;
|
|
77
|
+
};
|
|
78
|
+
}, {
|
|
79
|
+
parameters: {
|
|
80
|
+
msw: {
|
|
81
|
+
handlers: {
|
|
82
|
+
verify: import('msw').HttpHandler;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* The proactive user-session check returns a user account.
|
|
89
|
+
*
|
|
90
|
+
* The user can continue to use the app, or log out.
|
|
91
|
+
*/
|
|
92
|
+
export declare const AlreadyLoggedIn: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
93
|
+
csf4: true;
|
|
94
|
+
} & {
|
|
95
|
+
args: {
|
|
96
|
+
defaultValues?: import('./types.ts').DefaultFormValues | undefined;
|
|
97
|
+
};
|
|
98
|
+
}, {
|
|
99
|
+
parameters: {
|
|
100
|
+
msw: {
|
|
101
|
+
handlers: {
|
|
102
|
+
currentUser: import('msw').HttpHandler;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* The proactive user session check has failed due to connection issues.
|
|
109
|
+
*/
|
|
110
|
+
export declare const NoConnection: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
111
|
+
csf4: true;
|
|
112
|
+
} & {
|
|
113
|
+
args: {
|
|
114
|
+
defaultValues?: import('./types.ts').DefaultFormValues | undefined;
|
|
115
|
+
};
|
|
116
|
+
}, {
|
|
117
|
+
parameters: {
|
|
118
|
+
msw: {
|
|
119
|
+
handlers: {
|
|
120
|
+
currentUser: import('msw').HttpHandler;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
}>;
|
|
125
|
+
/**
|
|
126
|
+
* The proactive user session check has failed due to an error that doesn't
|
|
127
|
+
* carry any special meaning.
|
|
128
|
+
*/
|
|
129
|
+
export declare const UnknownFailure: import('@storybook/react').ReactStory<import('@storybook/react').ReactTypes & import('@storybook/addon-docs').DocsTypes & {
|
|
130
|
+
csf4: true;
|
|
131
|
+
} & {
|
|
132
|
+
args: {
|
|
133
|
+
defaultValues?: import('./types.ts').DefaultFormValues | undefined;
|
|
134
|
+
};
|
|
135
|
+
}, {
|
|
136
|
+
parameters: {
|
|
137
|
+
msw: {
|
|
138
|
+
handlers: {
|
|
139
|
+
currentUser: import('msw').HttpHandler;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LoadingView(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AuthEventHandler, DefaultFormValues } from './types.ts';
|
|
3
|
+
export type LoginCardProps = {
|
|
4
|
+
/**
|
|
5
|
+
* A description that will appear in the default login case (i.e. when an
|
|
6
|
+
* unauthenticated user is prompted to log in).
|
|
7
|
+
*
|
|
8
|
+
* This should reinforce to the user the benefits that they are going to
|
|
9
|
+
* get by signing in. Every app has slightly different capabilities, so this
|
|
10
|
+
* should be tailored for each individual app.
|
|
11
|
+
*/
|
|
12
|
+
description: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Default values for the login form.
|
|
15
|
+
*
|
|
16
|
+
* You might want to provide a value from history state or query param, so
|
|
17
|
+
* that if a user jumps between multiple pages with email field, the email
|
|
18
|
+
* address is maintained across these locations.
|
|
19
|
+
*/
|
|
20
|
+
defaultValues?: DefaultFormValues;
|
|
21
|
+
/**
|
|
22
|
+
* Called when the login action succeeds.
|
|
23
|
+
*
|
|
24
|
+
* If no handler is provided, the component will will navigate to the
|
|
25
|
+
* dashboard (as determined by `appConfig.hrefs.dashboard()` return value),
|
|
26
|
+
* or a location provided in `redirectTo` query param if it is a valid
|
|
27
|
+
* local path.
|
|
28
|
+
*/
|
|
29
|
+
onLogin?: AuthEventHandler;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Allows the user to log into Indie Tabletop Club.
|
|
33
|
+
*
|
|
34
|
+
* Will automatically use the `redirectTo` query param value as the redirect
|
|
35
|
+
* location after successful login.
|
|
36
|
+
*
|
|
37
|
+
* Otherwise, the user will be redirected to the app's dashboard.
|
|
38
|
+
*/
|
|
39
|
+
export declare function LoginCard(props: LoginCardProps): import("react/jsx-runtime").JSX.Element;
|