2023-04-28 23:02:52 -05:00
|
|
|
export type CamelCase<T> = T extends `${infer A}_${infer B}`
|
|
|
|
? `${A}${Capitalize<CamelCase<B>>}`
|
|
|
|
: T;
|
|
|
|
|
2023-07-20 09:44:14 -05:00
|
|
|
export type StorageType =
|
|
|
|
| 'appearance_mode'
|
|
|
|
| 'linking_social_connector'
|
|
|
|
| 'checkout_session'
|
2023-09-10 21:05:19 -05:00
|
|
|
| 'redirect_after_sign_in'
|
2024-05-30 09:04:36 -05:00
|
|
|
| 'webhook_test_result'
|
|
|
|
| 'is_dev_features_enabled';
|
2023-04-28 23:02:52 -05:00
|
|
|
|
|
|
|
export const getStorageKey = <T extends StorageType>(forType: T) =>
|
|
|
|
`logto:admin_console:${forType}` as const;
|
|
|
|
|
|
|
|
export const storageKeys = Object.freeze({
|
|
|
|
appearanceMode: getStorageKey('appearance_mode'),
|
|
|
|
linkingSocialConnector: getStorageKey('linking_social_connector'),
|
2023-07-19 04:14:10 -05:00
|
|
|
checkoutSession: getStorageKey('checkout_session'),
|
2023-07-20 09:44:14 -05:00
|
|
|
/** The react-router redirect location after sign in. The value should be a stringified Location object. */
|
|
|
|
redirectAfterSignIn: getStorageKey('redirect_after_sign_in'),
|
2023-09-10 21:05:19 -05:00
|
|
|
webhookTestResult: getStorageKey('webhook_test_result'),
|
2024-05-30 09:04:36 -05:00
|
|
|
/** Whether the under-development features are enabled. */
|
|
|
|
isDevFeaturesEnabled: getStorageKey('is_dev_features_enabled'),
|
2023-04-28 23:02:52 -05:00
|
|
|
} satisfies Record<CamelCase<StorageType>, string>);
|