@stytch/vanilla-js 4.12.2 → 4.13.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/CHANGELOG.md +10 -0
- package/b2b/adminPortal/package.json +6 -0
- package/dist/APINetworkClient.d.ts +6 -0
- package/dist/BootstrapDataManager.d.ts +38 -0
- package/dist/CaptchaProvider.d.ts +7 -0
- package/dist/ClientsideServicesProvider.d.ts +16 -0
- package/dist/HeadlessOAuthClient.d.ts +68 -0
- package/dist/NetworkClient.d.ts +25 -0
- package/dist/PKCEManager.d.ts +12 -0
- package/dist/StytchHeadlessClient.d.ts +45 -0
- package/dist/StytchUIClient.d.ts +86 -0
- package/dist/SubscriptionService.d.ts +111 -0
- package/dist/adminPortal/AdminPortalStyleConfig.d.ts +166 -0
- package/dist/adminPortal/AdminPortalWrapper.d.ts +6 -0
- package/dist/adminPortal/MainContainer.d.ts +4 -0
- package/dist/adminPortal/Router.d.ts +44 -0
- package/dist/adminPortal/StytchClientContext.d.ts +3 -0
- package/dist/adminPortal/components/Accordion.d.ts +6 -0
- package/dist/adminPortal/components/ActionMenu.d.ts +22 -0
- package/dist/adminPortal/components/Alert.d.ts +4 -0
- package/dist/adminPortal/components/Button.d.ts +6 -0
- package/dist/adminPortal/components/Code.d.ts +7 -0
- package/dist/adminPortal/components/CopyableText.d.ts +7 -0
- package/dist/adminPortal/components/DeleteConnection.d.ts +21 -0
- package/dist/adminPortal/components/EmbeddedTable.d.ts +3 -0
- package/dist/adminPortal/components/FlexBox.d.ts +1 -0
- package/dist/adminPortal/components/InfoIcon.d.ts +3 -0
- package/dist/adminPortal/components/Input.d.ts +5 -0
- package/dist/adminPortal/components/Label.d.ts +4 -0
- package/dist/adminPortal/components/ListEditor.d.ts +4 -0
- package/dist/adminPortal/components/MenuItem.d.ts +4 -0
- package/dist/adminPortal/components/Modal.d.ts +16 -0
- package/dist/adminPortal/components/PageLoadingIndicator.d.ts +2 -0
- package/dist/adminPortal/components/PaginatedTable.d.ts +4 -0
- package/dist/adminPortal/components/SearchBar.d.ts +3 -0
- package/dist/adminPortal/components/Select.d.ts +12 -0
- package/dist/adminPortal/components/SetDefaultConnection.d.ts +29 -0
- package/dist/adminPortal/components/SettingsContainer.d.ts +24 -0
- package/dist/adminPortal/components/SettingsList.d.ts +4 -0
- package/dist/adminPortal/components/SettingsListItem.d.ts +5 -0
- package/dist/adminPortal/components/SettingsSection.d.ts +6 -0
- package/dist/adminPortal/components/Table.d.ts +3 -0
- package/dist/adminPortal/components/TableActions.d.ts +5 -0
- package/dist/adminPortal/components/Tag.d.ts +5 -0
- package/dist/adminPortal/components/TagList.d.ts +4 -0
- package/dist/adminPortal/components/Toast.d.ts +5 -0
- package/dist/adminPortal/components/Tooltip.d.ts +2 -0
- package/dist/adminPortal/components/Typography.d.ts +4 -0
- package/dist/adminPortal/index.d.ts +3 -0
- package/dist/adminPortal/index.esm.js +5 -0
- package/dist/adminPortal/index.js +5 -0
- package/dist/adminPortal/makeAdminPortalComponentMountFn.d.ts +19 -0
- package/dist/adminPortal/shared/components/Accordion.d.ts +15 -0
- package/dist/adminPortal/shared/components/Button.d.ts +25 -0
- package/dist/adminPortal/shared/components/Code.d.ts +14 -0
- package/dist/adminPortal/shared/components/ContentSpacing.d.ts +6 -0
- package/dist/adminPortal/shared/components/CopyableText.d.ts +16 -0
- package/dist/adminPortal/shared/components/EmbeddedTable.d.ts +16 -0
- package/dist/adminPortal/shared/components/FlexBox.d.ts +11 -0
- package/dist/adminPortal/shared/components/InfoIcon.d.ts +7 -0
- package/dist/adminPortal/shared/components/Input.d.ts +28 -0
- package/dist/adminPortal/shared/components/Label.d.ts +10 -0
- package/dist/adminPortal/shared/components/ListEditor.d.ts +27 -0
- package/dist/adminPortal/shared/components/MenuItem.d.ts +14 -0
- package/dist/adminPortal/shared/components/Modal.d.ts +20 -0
- package/dist/adminPortal/shared/components/PaginatedTable.d.ts +30 -0
- package/dist/adminPortal/shared/components/SearchBar.d.ts +6 -0
- package/dist/adminPortal/shared/components/Select.d.ts +30 -0
- package/dist/adminPortal/shared/components/Table.d.ts +17 -0
- package/dist/adminPortal/shared/components/TableActions.d.ts +15 -0
- package/dist/adminPortal/shared/components/Tag.d.ts +4 -0
- package/dist/adminPortal/shared/components/Toast.d.ts +18 -0
- package/dist/adminPortal/shared/components/Tooltip.d.ts +12 -0
- package/dist/adminPortal/shared/components/Typography.d.ts +15 -0
- package/dist/adminPortal/shared/components/componentInjection.d.ts +48 -0
- package/dist/adminPortal/shared/components/constants.d.ts +3 -0
- package/dist/adminPortal/shared/components/types.d.ts +13 -0
- package/dist/adminPortal/shared/utils/clickToCopyUtils.d.ts +15 -0
- package/dist/adminPortal/shared/utils/composeStyles.d.ts +60 -0
- package/dist/adminPortal/shared/utils/keys.d.ts +74 -0
- package/dist/adminPortal/shared/utils/noop.d.ts +1 -0
- package/dist/adminPortal/shared/utils/tableUtils.d.ts +3 -0
- package/dist/adminPortal/shared/utils/uniqueIds.d.ts +2 -0
- package/dist/adminPortal/shared/utils/useToggleState.d.ts +7 -0
- package/dist/adminPortal/sso/AdminPortalSSO.d.ts +18 -0
- package/dist/adminPortal/sso/AppDetails.d.ts +5 -0
- package/dist/adminPortal/sso/AttributeMappingTable.d.ts +22 -0
- package/dist/adminPortal/sso/DetailsSection.d.ts +6 -0
- package/dist/adminPortal/sso/IdpInfo.d.ts +147 -0
- package/dist/adminPortal/sso/IdpSelect.d.ts +126 -0
- package/dist/adminPortal/sso/OrganizationUpdatesSection.d.ts +7 -0
- package/dist/adminPortal/sso/RoleAssignmentsSection.d.ts +6 -0
- package/dist/adminPortal/sso/SSOConnectionDetailsScreen.d.ts +4 -0
- package/dist/adminPortal/sso/SSOConnectionsScreen.d.ts +2 -0
- package/dist/adminPortal/sso/SSONewConnectionConfigureScreen.d.ts +5 -0
- package/dist/adminPortal/sso/SSONewConnectionScreen.d.ts +2 -0
- package/dist/adminPortal/sso/SSORouter.d.ts +44 -0
- package/dist/adminPortal/sso/TaggedConnection.d.ts +8 -0
- package/dist/adminPortal/sso/mountAdminPortalSSO.d.ts +15 -0
- package/dist/adminPortal/sso/useDisplayPagination.d.ts +14 -0
- package/dist/adminPortal/utils/Connection.d.ts +9 -0
- package/dist/adminPortal/utils/ConnectionType.d.ts +1 -0
- package/dist/adminPortal/utils/clickToCopyUtils.d.ts +5 -0
- package/dist/adminPortal/utils/collator.d.ts +1 -0
- package/dist/adminPortal/utils/organizationGetKey.d.ts +1 -0
- package/dist/adminPortal/utils/theme.d.ts +6 -0
- package/dist/adminPortal/utils/useAdminPortalConfig.d.ts +10 -0
- package/dist/adminPortal/utils/useApiNetworkClient.d.ts +2 -0
- package/dist/adminPortal/utils/useB2BInternals.d.ts +1 -0
- package/dist/adminPortal/utils/useFormState.d.ts +13 -0
- package/dist/adminPortal/utils/useMutateOrganization.d.ts +4 -0
- package/dist/adminPortal/utils/useMutateSsoConnection.d.ts +19 -0
- package/dist/adminPortal/utils/useMutateWithToast.d.ts +7 -0
- package/dist/adminPortal/utils/useNavigateAwayWarning.d.ts +1 -0
- package/dist/adminPortal/utils/useOrgInfo.d.ts +1 -0
- package/dist/adminPortal/utils/useRbac.d.ts +51 -0
- package/dist/adminPortal/utils/useRevalidateConnectionList.d.ts +1 -0
- package/dist/adminPortal/utils/useSsoConnections.d.ts +2 -0
- package/dist/adminPortal/utils/useStateSliceSetter.d.ts +2 -0
- package/dist/adminPortal/utils/useStytchClient.d.ts +1 -0
- package/dist/assets/CreateIcon.d.ts +6 -0
- package/dist/assets/amazon.d.ts +3 -0
- package/dist/assets/apple.d.ts +3 -0
- package/dist/assets/backArrow.d.ts +5 -0
- package/dist/assets/binance.d.ts +3 -0
- package/dist/assets/bitbucket.d.ts +3 -0
- package/dist/assets/check.d.ts +2 -0
- package/dist/assets/checkmark.d.ts +2 -0
- package/dist/assets/chevron.d.ts +3 -0
- package/dist/assets/coinbase.d.ts +4 -0
- package/dist/assets/confirmation.d.ts +2 -0
- package/dist/assets/copy.d.ts +3 -0
- package/dist/assets/cross.d.ts +2 -0
- package/dist/assets/discord.d.ts +3 -0
- package/dist/assets/errorIcon.d.ts +3 -0
- package/dist/assets/facebook.d.ts +3 -0
- package/dist/assets/figma.d.ts +3 -0
- package/dist/assets/genericWallet.d.ts +4 -0
- package/dist/assets/github.d.ts +3 -0
- package/dist/assets/gitlab.d.ts +3 -0
- package/dist/assets/gmail.d.ts +3 -0
- package/dist/assets/google.d.ts +3 -0
- package/dist/assets/linkedin.d.ts +3 -0
- package/dist/assets/metamask.d.ts +4 -0
- package/dist/assets/microsoft.d.ts +3 -0
- package/dist/assets/outlook.d.ts +3 -0
- package/dist/assets/passkeyAdded.d.ts +2 -0
- package/dist/assets/passkeys.d.ts +3 -0
- package/dist/assets/passkeysCollage.d.ts +2 -0
- package/dist/assets/passwordIcon.d.ts +5 -0
- package/dist/assets/pencil.d.ts +2 -0
- package/dist/assets/phantom.d.ts +3 -0
- package/dist/assets/salesforce.d.ts +3 -0
- package/dist/assets/slack.d.ts +3 -0
- package/dist/assets/snackbarError.d.ts +2 -0
- package/dist/assets/snackbarSuccess.d.ts +2 -0
- package/dist/assets/snapchat.d.ts +3 -0
- package/dist/assets/successIcon.d.ts +3 -0
- package/dist/assets/tiktok.d.ts +3 -0
- package/dist/assets/trash.d.ts +2 -0
- package/dist/assets/twitch.d.ts +3 -0
- package/dist/assets/twitter.d.ts +3 -0
- package/dist/assets/vessel.d.ts +4 -0
- package/dist/assets/warningIcon.d.ts +3 -0
- package/dist/assets/yahoo.d.ts +3 -0
- package/dist/assets/yahooLogo.d.ts +3 -0
- package/dist/b2b/HeadlessB2BOAuthClient.d.ts +100 -0
- package/dist/b2b/StytchB2BHeadlessClient.d.ts +51 -0
- package/dist/b2b/StytchB2BUIClient.d.ts +40 -0
- package/dist/b2b/index.d.ts +1 -189
- package/dist/b2b/index.esm.js +5598 -13879
- package/dist/b2b/index.headless.d.ts +1 -148
- package/dist/b2b/index.headless.esm.js +2 -5269
- package/dist/b2b/index.headless.js +98 -5253
- package/dist/b2b/index.js +5722 -13890
- package/dist/b2b/oneTap/B2BOneTapProvider.d.ts +39 -0
- package/dist/extractErrorMessage-BhKRYH2d.js +4493 -0
- package/dist/extractErrorMessage-DGmS9sVj.js +4534 -0
- package/dist/index.d.ts +1 -187
- package/dist/index.esm.js +1 -14827
- package/dist/index.headless-CULr-Rz6.js +1691 -0
- package/dist/index.headless-DTGN4xYi.js +1695 -0
- package/dist/index.headless.d.ts +1 -103
- package/dist/index.headless.esm.js +5086 -3920
- package/dist/index.headless.js +5135 -3907
- package/dist/index.js +1 -14807
- package/dist/internal-DA-B7n9p.js +5097 -0
- package/dist/internal-FLRZPR0F.js +5187 -0
- package/dist/oneTap/OneTapClient.d.ts +22 -0
- package/dist/oneTap/OneTapProvider.d.ts +36 -0
- package/dist/oneTap/navigatorSupportsFedCM.d.ts +1 -0
- package/dist/oneTap/positionModes.d.ts +6 -0
- package/dist/types.d.ts +18 -0
- package/dist/ui/CreateWebComponent.d.ts +20 -0
- package/dist/ui/b2b/App.d.ts +5 -0
- package/dist/ui/b2b/Container.d.ts +2 -0
- package/dist/ui/b2b/GlobalContextProvider.d.ts +82 -0
- package/dist/ui/b2b/MfaState.d.ts +50 -0
- package/dist/ui/b2b/clearStytchSearchParams.d.ts +1 -0
- package/dist/ui/b2b/generateProductComponentsOrdering.d.ts +13 -0
- package/dist/ui/b2b/getEnabledMethods.d.ts +5 -0
- package/dist/ui/b2b/hooks/useIsOnlyFloatingOneTap.d.ts +1 -0
- package/dist/ui/b2b/mfa.d.ts +70 -0
- package/dist/ui/b2b/reducer.d.ts +25 -0
- package/dist/ui/b2b/screens/Discovery.d.ts +2 -0
- package/dist/ui/b2b/screens/EmailConfirmation.d.ts +2 -0
- package/dist/ui/b2b/screens/MFAEnrollmentSelectionScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/MagicLinkForm.d.ts +3 -0
- package/dist/ui/b2b/screens/Main.d.ts +2 -0
- package/dist/ui/b2b/screens/OAuthButtons.d.ts +15 -0
- package/dist/ui/b2b/screens/PasswordAuthenticate.d.ts +7 -0
- package/dist/ui/b2b/screens/PasswordEmailForm.d.ts +2 -0
- package/dist/ui/b2b/screens/PasswordForgotForm.d.ts +2 -0
- package/dist/ui/b2b/screens/PasswordResetConfirmation.d.ts +2 -0
- package/dist/ui/b2b/screens/PasswordResetForm.d.ts +2 -0
- package/dist/ui/b2b/screens/PasswordSetNew.d.ts +2 -0
- package/dist/ui/b2b/screens/PasswordUseButton.d.ts +2 -0
- package/dist/ui/b2b/screens/RecoveryCodeEntryScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/RecoveryCodeSaveScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/SMSOTPEnrollScreen.d.ts +3 -0
- package/dist/ui/b2b/screens/SMSOTPEntryScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/SSOButtons.d.ts +6 -0
- package/dist/ui/b2b/screens/TOTPEnrollManualScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/TOTPEnrollQRScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/TOTPEntryScreen.d.ts +2 -0
- package/dist/ui/b2b/utils.d.ts +34 -0
- package/dist/ui/b2c/App.d.ts +11 -0
- package/dist/ui/b2c/Container.d.ts +2 -0
- package/dist/ui/b2c/GlobalContextProvider.d.ts +83 -0
- package/dist/ui/b2c/reducer.d.ts +23 -0
- package/dist/ui/b2c/screens/Crypto/ConnectWallet.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/Error.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/OtherWallets.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/PasskeyConfirmation.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/SetupNewWallet.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/SignMessage.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/Success.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/WalletButtons.d.ts +4 -0
- package/dist/ui/b2c/screens/Main/LoginForm/MagicLinkForm.d.ts +2 -0
- package/dist/ui/b2c/screens/Main/LoginForm/OTPForm.d.ts +16 -0
- package/dist/ui/b2c/screens/Main/LoginForm/PasskeyButton.d.ts +2 -0
- package/dist/ui/b2c/screens/Main/LoginForm/PasswordForm.d.ts +2 -0
- package/dist/ui/b2c/screens/Main/LoginForm/index.d.ts +2 -0
- package/dist/ui/b2c/screens/Main/OAuthButtons.d.ts +2 -0
- package/dist/ui/b2c/screens/Main/index.d.ts +2 -0
- package/dist/ui/b2c/screens/Passkey/PasskeyRegistrationStart.d.ts +2 -0
- package/dist/ui/b2c/screens/Passkey/PasskeyRegistrationSuccess.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/MagicLinkOption.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordAuthenticate.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordBreached.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordDedupe.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordForgot.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordNewUser.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordSecondaryMethod.d.ts +4 -0
- package/dist/ui/b2c/screens/Password/PasswordSetNew.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordlessCreate.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/ResetPassword.d.ts +2 -0
- package/dist/ui/b2c/screens/Secondary/EmailConfirmation.d.ts +6 -0
- package/dist/ui/b2c/screens/Secondary/OTPAuthenticate.d.ts +4 -0
- package/dist/ui/b2c/screens/Secondary/OTPConfirmation.d.ts +2 -0
- package/dist/ui/b2c/screens/Secondary/PasswordCreateAuthenticate.d.ts +2 -0
- package/dist/ui/b2c/utils.d.ts +1 -0
- package/dist/ui/components/AlertBox.d.ts +8 -0
- package/dist/ui/components/AnimatedContainer.d.ts +5 -0
- package/dist/ui/components/B2BOneTap.d.ts +2 -0
- package/dist/ui/components/Button.d.ts +5 -0
- package/dist/ui/components/CircularProgress.d.ts +12 -0
- package/dist/ui/components/Confirmation.d.ts +2 -0
- package/dist/ui/components/CountrySelector.d.ts +7 -0
- package/dist/ui/components/Divider.d.ts +2 -0
- package/dist/ui/components/EditableRow.d.ts +15 -0
- package/dist/ui/components/EmailConfirmation.d.ts +11 -0
- package/dist/ui/components/EmailInput.d.ts +7 -0
- package/dist/ui/components/ErrorScreen.d.ts +2 -0
- package/dist/ui/components/ErrorText.d.ts +4 -0
- package/dist/ui/components/Flex.d.ts +40 -0
- package/dist/ui/components/InlineButton.d.ts +7 -0
- package/dist/ui/components/Input.d.ts +1 -0
- package/dist/ui/components/InsetContainer.d.ts +1 -0
- package/dist/ui/components/Loading.d.ts +3 -0
- package/dist/ui/components/LoadingBar.d.ts +4 -0
- package/dist/ui/components/MainContainer.d.ts +3 -0
- package/dist/ui/components/OAuthB2BButton.d.ts +14 -0
- package/dist/ui/components/OAuthButton.d.ts +14 -0
- package/dist/ui/components/OTPControl.d.ts +8 -0
- package/dist/ui/components/OTPEntry.d.ts +11 -0
- package/dist/ui/components/OTPInput.d.ts +6 -0
- package/dist/ui/components/OneTap.d.ts +18 -0
- package/dist/ui/components/OneTapErrorMessages.d.ts +7 -0
- package/dist/ui/components/PasswordError.d.ts +17 -0
- package/dist/ui/components/PasswordInput.d.ts +6 -0
- package/dist/ui/components/PasswordStrengthCheck.d.ts +4 -0
- package/dist/ui/components/PhoneInput.d.ts +10 -0
- package/dist/ui/components/SentOTPEntry.d.ts +10 -0
- package/dist/ui/components/Snackbar.d.ts +2 -0
- package/dist/ui/components/SubmitButton.d.ts +8 -0
- package/dist/ui/components/TOTPEntry.d.ts +8 -0
- package/dist/ui/components/Text.d.ts +9 -0
- package/dist/ui/components/VerifyEmailConfirmation.d.ts +10 -0
- package/dist/ui/components/WalletButton.d.ts +8 -0
- package/dist/ui/hooks/useIsMounted.d.ts +3 -0
- package/dist/ui/hooks/useIsOnlyFloatingOneTap.d.ts +1 -0
- package/dist/ui/hooks/usePromptPasskey.d.ts +7 -0
- package/dist/ui/theme.d.ts +112 -0
- package/dist/utils/Optional.d.ts +3 -0
- package/dist/utils/assertUnreachable.d.ts +1 -0
- package/dist/utils/crypto.d.ts +60 -0
- package/dist/utils/deepEqual.d.ts +1 -0
- package/dist/utils/extractErrorMessage.d.ts +1 -0
- package/dist/utils/extractErrorType.d.ts +1 -0
- package/dist/utils/index.d.ts +28 -0
- package/dist/utils/internal.d.ts +34 -0
- package/dist/utils/isTruthy.d.ts +3 -0
- package/dist/utils/oauthProviderType.d.ts +7 -0
- package/dist/utils/passkeys.d.ts +8 -0
- package/package.json +18 -16
- package/dist/b2b/index.esm.d.ts +0 -190
- package/dist/b2b/index.headless.esm.d.ts +0 -149
- package/dist/index.esm.d.ts +0 -188
- package/dist/index.headless.esm.d.ts +0 -104
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @stytch/vanilla-js
|
|
2
2
|
|
|
3
|
+
## 4.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a99f21b8: Add Admin Portal SSO UI. The Admin Portal SSO UI can be rendered using the `mountAdminPortalSSO` function from `@stytch/vanilla-js/b2b/adminPortal`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 0f448e7e: Improve error messages when entering phone number.
|
|
12
|
+
|
|
3
13
|
## 4.12.2
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NetworkClient } from './NetworkClient';
|
|
2
|
+
import { B2BSubscriptionDataLayer, ConsumerSubscriptionDataLayer } from './SubscriptionService';
|
|
3
|
+
import { AdditionalTelemetryData } from '@stytch/core';
|
|
4
|
+
export declare class APINetworkClient extends NetworkClient {
|
|
5
|
+
constructor(_publicToken: string, _subscriptionDataLayer: ConsumerSubscriptionDataLayer | B2BSubscriptionDataLayer, _liveAPIURL: string, _testAPIURL: string, _additionalTelemetryDataFn: () => AdditionalTelemetryData);
|
|
6
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BootstrapData, RBACPolicyRaw, DFPProtectedAuthMode, INetworkClient } from '@stytch/core';
|
|
2
|
+
import { B2BSubscriptionDataLayer, ConsumerSubscriptionDataLayer } from './SubscriptionService';
|
|
3
|
+
export interface IBootstrapData {
|
|
4
|
+
getSync: () => BootstrapData;
|
|
5
|
+
getAsync: () => Promise<BootstrapData>;
|
|
6
|
+
}
|
|
7
|
+
interface RawBootstrapData {
|
|
8
|
+
request_id: string;
|
|
9
|
+
status_code: number;
|
|
10
|
+
disable_sdk_watermark: boolean;
|
|
11
|
+
cname_domain: string | null;
|
|
12
|
+
email_domains: string[];
|
|
13
|
+
captcha_settings: BootstrapData['captchaSettings'];
|
|
14
|
+
pkce_required_for_email_magic_links: boolean;
|
|
15
|
+
pkce_required_for_password_resets: boolean;
|
|
16
|
+
pkce_required_for_oauth: boolean;
|
|
17
|
+
pkce_required_for_sso: boolean;
|
|
18
|
+
slug_pattern: string | null;
|
|
19
|
+
create_organization_enabled: boolean;
|
|
20
|
+
password_config: {
|
|
21
|
+
luds_complexity: number;
|
|
22
|
+
luds_minimum_count: number;
|
|
23
|
+
} | null;
|
|
24
|
+
dfp_protected_auth_enabled?: boolean;
|
|
25
|
+
dfp_protected_auth_mode?: DFPProtectedAuthMode;
|
|
26
|
+
rbac_policy?: RBACPolicyRaw;
|
|
27
|
+
}
|
|
28
|
+
export declare class BootstrapDataManager implements IBootstrapData {
|
|
29
|
+
private _publicToken;
|
|
30
|
+
private _networkClient;
|
|
31
|
+
private _dataLayer;
|
|
32
|
+
private readonly _bootstrapDataPromise;
|
|
33
|
+
constructor(_publicToken: string, _networkClient: INetworkClient, _dataLayer: ConsumerSubscriptionDataLayer | B2BSubscriptionDataLayer);
|
|
34
|
+
static mapBootstrapData(response: RawBootstrapData): BootstrapData;
|
|
35
|
+
getSync(): BootstrapData;
|
|
36
|
+
getAsync(): Promise<BootstrapData>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RPCManifest } from '@stytch/core';
|
|
2
|
+
export declare class ClientsideServicesProvider implements RPCManifest {
|
|
3
|
+
private iframeURL;
|
|
4
|
+
private _frameClient;
|
|
5
|
+
constructor(iframeURL: string);
|
|
6
|
+
/**
|
|
7
|
+
* The frameClient is lazily initialized - we don't want to force users
|
|
8
|
+
* that don't use any of its features to still download the bundle!
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
private get frameClient();
|
|
12
|
+
private call;
|
|
13
|
+
oneTapStart: RPCManifest['oneTapStart'];
|
|
14
|
+
oneTapSubmit: RPCManifest['oneTapSubmit'];
|
|
15
|
+
parsedPhoneNumber: RPCManifest['parsedPhoneNumber'];
|
|
16
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { IHeadlessOAuthClient } from '@stytch/core/public';
|
|
2
|
+
import { HeadlessOAuthClient as BaseHeadlessOAuthClient, INetworkClient, IPKCEManager, IConsumerSubscriptionService } from '@stytch/core';
|
|
3
|
+
import { OneTapProvider } from './oneTap/OneTapProvider';
|
|
4
|
+
import { OneTapRenderResult } from './oneTap/OneTapClient';
|
|
5
|
+
export type GoogleOneTapOAuthOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* The URL that Stytch redirects to after the OAuth flow is completed for a user that already exists.
|
|
8
|
+
* This URL should be an endpoint in the backend server that verifies the request by querying Stytch's /oauth/authenticate endpoint and finishes the login.
|
|
9
|
+
* The URL should be configured as a Login URL in the Stytch Dashboard's Redirect URL page.
|
|
10
|
+
* If the field is not specified, the default in the Dashboard is used.
|
|
11
|
+
*/
|
|
12
|
+
login_redirect_url?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The URL that Stytch redirects to after the OAuth flow is completed for a user that does not yet exist.
|
|
15
|
+
* This URL should be an endpoint in the backend server that verifies the request by querying Stytch's /oauth/authenticate endpoint and finishes the login.
|
|
16
|
+
* The URL should be configured as a Sign Up URL in the Stytch Dashboard's Redirect URL page.
|
|
17
|
+
* If the field is not specified, the default in the Dashboard is used.
|
|
18
|
+
*/
|
|
19
|
+
signup_redirect_url?: string;
|
|
20
|
+
/**
|
|
21
|
+
* An optional callback function that runs when a user explicitly cancels out of the one tap flow.
|
|
22
|
+
* This callback may not be invoked immediately or at all depending on the behavior of the browser and Google's SDK.
|
|
23
|
+
*/
|
|
24
|
+
onOneTapCancelled?: () => void;
|
|
25
|
+
};
|
|
26
|
+
interface IGoogleOneTapOAuthProvider {
|
|
27
|
+
/**
|
|
28
|
+
* Start an OAuth flow by showing the Google one tap prompt in the top right corner of the user's browser.
|
|
29
|
+
* You can configure this to be started by a user action (i.e Button click) or on load/render.
|
|
30
|
+
* @example
|
|
31
|
+
* const showGoogleOneTap = useCallback(()=> {
|
|
32
|
+
* stytch.oauth.googleOneTap.start({
|
|
33
|
+
* login_redirect_url: 'https://example.com/oauth/callback',
|
|
34
|
+
* signup_redirect_url: 'https://example.com/oauth/callback',
|
|
35
|
+
* })
|
|
36
|
+
* }, [stytch]);
|
|
37
|
+
* return (
|
|
38
|
+
* <Button onClick={showGoogleOneTap}> Show Google one tap </Button>
|
|
39
|
+
* );
|
|
40
|
+
*
|
|
41
|
+
* @param options - An {@link GoogleOneTapOAuthOptions} object
|
|
42
|
+
*
|
|
43
|
+
* @returns A {@link OneTapRenderResult} object. The result object includes if the one-tap prompt
|
|
44
|
+
* was rendered, and a reason if it couldn't be rendered.
|
|
45
|
+
*
|
|
46
|
+
* @throws An Error if the one tap client cannot be created.
|
|
47
|
+
*/
|
|
48
|
+
start(options?: GoogleOneTapOAuthOptions): Promise<OneTapRenderResult>;
|
|
49
|
+
}
|
|
50
|
+
type DynamicConfig = Promise<{
|
|
51
|
+
cnameDomain: null | string;
|
|
52
|
+
pkceRequiredForOAuth: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
type Config = {
|
|
55
|
+
publicToken: string;
|
|
56
|
+
testAPIURL: string;
|
|
57
|
+
liveAPIURL: string;
|
|
58
|
+
};
|
|
59
|
+
export interface IWebOAuthClient extends IHeadlessOAuthClient {
|
|
60
|
+
googleOneTap: IGoogleOneTapOAuthProvider;
|
|
61
|
+
}
|
|
62
|
+
export declare class HeadlessOAuthClient extends BaseHeadlessOAuthClient implements IWebOAuthClient {
|
|
63
|
+
private _oneTap;
|
|
64
|
+
constructor(_networkClient: INetworkClient, _subscriptionService: IConsumerSubscriptionService, _pkceManager: IPKCEManager, _dynamicConfig: DynamicConfig, _config: Config, _oneTap: OneTapProvider);
|
|
65
|
+
private startOneTap;
|
|
66
|
+
googleOneTap: IGoogleOneTapOAuthProvider;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AdditionalTelemetryData, INetworkClient, RetriableSDKRequestInfo, SDKRequestInfo, SDKTelemetry } from '@stytch/core';
|
|
2
|
+
import { ResponseCommon } from '@stytch/core/public';
|
|
3
|
+
import { B2BSubscriptionDataLayer, ConsumerSubscriptionDataLayer } from './SubscriptionService';
|
|
4
|
+
export declare class NetworkClient implements INetworkClient {
|
|
5
|
+
private _publicToken;
|
|
6
|
+
private _subscriptionDataLayer;
|
|
7
|
+
private baseURL;
|
|
8
|
+
private additionalTelemetryDataFn;
|
|
9
|
+
private eventLogger;
|
|
10
|
+
constructor(_publicToken: string, _subscriptionDataLayer: ConsumerSubscriptionDataLayer | B2BSubscriptionDataLayer, baseURL: string, additionalTelemetryDataFn: () => AdditionalTelemetryData);
|
|
11
|
+
updateSessionToken: () => null;
|
|
12
|
+
logEvent({ name, details, error, }: {
|
|
13
|
+
name: string;
|
|
14
|
+
details: Record<string, unknown>;
|
|
15
|
+
error?: {
|
|
16
|
+
error_code?: string;
|
|
17
|
+
error_description?: string;
|
|
18
|
+
http_status_code?: string;
|
|
19
|
+
};
|
|
20
|
+
}): void;
|
|
21
|
+
createTelemetryBlob(): SDKTelemetry;
|
|
22
|
+
fetchSDK<T extends ResponseCommon>({ url, body, errorMessage, method }: SDKRequestInfo): Promise<T>;
|
|
23
|
+
retriableFetchSDK<T extends ResponseCommon>({ url, body, errorMessage, method, retryCallback, }: RetriableSDKRequestInfo): Promise<T>;
|
|
24
|
+
buildSDKUrl(url: string): string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ISyncPKCEManager, ProofkeyPair } from '@stytch/core';
|
|
2
|
+
import { B2BSubscriptionDataLayer, ConsumerSubscriptionDataLayer } from './SubscriptionService';
|
|
3
|
+
export declare class PKCEManager implements ISyncPKCEManager {
|
|
4
|
+
private _dataLayer;
|
|
5
|
+
private namespace;
|
|
6
|
+
constructor(_dataLayer: ConsumerSubscriptionDataLayer | B2BSubscriptionDataLayer, namespace: string);
|
|
7
|
+
private key;
|
|
8
|
+
startPKCETransaction(): Promise<ProofkeyPair>;
|
|
9
|
+
getPKPair(): ProofkeyPair | undefined;
|
|
10
|
+
clearPKPair(): void;
|
|
11
|
+
static createProofkeyPair(): Promise<ProofkeyPair>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { StateChangeRegisterFunction } from '@stytch/core';
|
|
2
|
+
import { ConsumerState, IHeadlessCryptoWalletClient, IHeadlessMagicLinksClient, IHeadlessOTPsClient, IHeadlessPasswordClient, IHeadlessSessionClient, IHeadlessTOTPClient, IHeadlessUserClient, IHeadlessWebAuthnClient, StytchClientOptions } from '@stytch/core/public';
|
|
3
|
+
import { IWebOAuthClient } from './HeadlessOAuthClient';
|
|
4
|
+
/**
|
|
5
|
+
* A headless client used for invoking the Stytch API.
|
|
6
|
+
* The Stytch Headless Client can be used as a drop-in solution for authentication and session management.
|
|
7
|
+
* Full documentation can be found {@link https://stytch.com/docs/sdks/javascript-sdk online}.
|
|
8
|
+
* @example
|
|
9
|
+
* const stytch = new StytchHeadlessClient('public-token-<find yours in the stytch dashboard>');
|
|
10
|
+
* stytch.magicLinks.email.loginOrCreate('sandbox@stytch.com', {
|
|
11
|
+
* login_magic_link_url: 'https://example.com/authenticate',
|
|
12
|
+
* login_expiration_minutes: 60,
|
|
13
|
+
* signup_magic_link_url: 'https://example.com/authenticate',
|
|
14
|
+
* signup_expiration_minutes: 60,
|
|
15
|
+
* });
|
|
16
|
+
*/
|
|
17
|
+
export declare class StytchHeadlessClient {
|
|
18
|
+
private readonly _subscriptionService;
|
|
19
|
+
private readonly _sessionManager;
|
|
20
|
+
private readonly _networkClient;
|
|
21
|
+
private readonly _dataLayer;
|
|
22
|
+
private readonly _stateChangeClient;
|
|
23
|
+
user: IHeadlessUserClient;
|
|
24
|
+
magicLinks: IHeadlessMagicLinksClient;
|
|
25
|
+
session: IHeadlessSessionClient;
|
|
26
|
+
otps: IHeadlessOTPsClient;
|
|
27
|
+
oauth: IWebOAuthClient;
|
|
28
|
+
cryptoWallets: IHeadlessCryptoWalletClient;
|
|
29
|
+
totps: IHeadlessTOTPClient;
|
|
30
|
+
webauthn: IHeadlessWebAuthnClient;
|
|
31
|
+
passwords: IHeadlessPasswordClient;
|
|
32
|
+
/**
|
|
33
|
+
* Register a callback function to be invoked whenever certain state changes
|
|
34
|
+
* occur, like a user or session object being updated.
|
|
35
|
+
*
|
|
36
|
+
* This is an alternative to more specific methods like `user.onChange` and
|
|
37
|
+
* `session.onChange`. It can be helpful if you want to be notified of related
|
|
38
|
+
* changes to different parts of state at once.
|
|
39
|
+
*
|
|
40
|
+
* If you are only interested in specific state changes, consider using more
|
|
41
|
+
* specific methods like `user.onChange` and `session.onChange` instead.
|
|
42
|
+
*/
|
|
43
|
+
onStateChange: StateChangeRegisterFunction<ConsumerState>;
|
|
44
|
+
constructor(_PUBLIC_TOKEN: string, options?: StytchClientOptions);
|
|
45
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { StytchHeadlessClient } from './StytchHeadlessClient';
|
|
2
|
+
import { Callbacks, StytchLoginConfig, StyleConfig } from '@stytch/core/public';
|
|
3
|
+
/**
|
|
4
|
+
* A client used for invoking the Stytch API an.
|
|
5
|
+
* The Stytch UI Client can be used as a drop-in solution for authentication and session management.
|
|
6
|
+
* The Stytch UI client also can be used to render various UI elements for managing users.
|
|
7
|
+
* Full documentation can be found {@link https://stytch.com/docs/sdks/javascript-sdk online.}
|
|
8
|
+
* @example
|
|
9
|
+
* const stytch = new StytchUIClient('public-token-<find yours in the stytch dashboard>');
|
|
10
|
+
* stytch.magicLinks.email.loginOrCreate('sandbox@stytch.com', {
|
|
11
|
+
* login_magic_link_url: 'https://example.com/authenticate',
|
|
12
|
+
* login_expiration_minutes: 60,
|
|
13
|
+
* signup_magic_link_url: 'https://example.com/authenticate',
|
|
14
|
+
* signup_expiration_minutes: 60,
|
|
15
|
+
* });
|
|
16
|
+
*/
|
|
17
|
+
export declare class StytchUIClient extends StytchHeadlessClient {
|
|
18
|
+
constructor(...args: ConstructorParameters<typeof StytchHeadlessClient>);
|
|
19
|
+
/**
|
|
20
|
+
* Mounts a login screen inside the element provided.
|
|
21
|
+
* If a login screen has already been rendered inside the element,
|
|
22
|
+
* it will be updated to use the new config, style, and callback options passed in.
|
|
23
|
+
* @example
|
|
24
|
+
* stytchClient.mountLogin({
|
|
25
|
+
* elementId: '#login-container',
|
|
26
|
+
* config: {...}
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* @param elementId - A string containing the id of the element that should contain the login screen.
|
|
30
|
+
* @param config - A {@link StytchLoginConfig} object containing the products that should be registered
|
|
31
|
+
* @param styles - A {@link StyleConfig} object containing custom styling info
|
|
32
|
+
* @param callbacks - Optional {@link Callbacks} triggered by various events in the Stytch SDK.
|
|
33
|
+
* @throws An error when the element specified by elementId cannot be found.
|
|
34
|
+
*/
|
|
35
|
+
mountLogin({ elementId, config, styles, callbacks, }: {
|
|
36
|
+
elementId: string;
|
|
37
|
+
config: StytchLoginConfig;
|
|
38
|
+
styles?: StyleConfig;
|
|
39
|
+
callbacks?: Callbacks;
|
|
40
|
+
}): void;
|
|
41
|
+
/**
|
|
42
|
+
* Mounts a reset password screen inside the element provided.
|
|
43
|
+
* If a reset password screen has already been rendered inside the element,
|
|
44
|
+
* it will be updated to use the new config, style, and callback options passed in.
|
|
45
|
+
* @example
|
|
46
|
+
* stytchClient.mountResetPassword({
|
|
47
|
+
* elementId: '#login-container',
|
|
48
|
+
* config: {...}
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* @param elementId - A string containing the id of the element that should contain the login screen.
|
|
52
|
+
* @param config - A {@link StytchLoginConfig} object containing the products that should be registered
|
|
53
|
+
* @param styles - A {@link StyleConfig} object containing custom styling info
|
|
54
|
+
* @param callbacks - Optional {@link Callbacks} triggered by various events in the Stytch SDK.
|
|
55
|
+
* @throws An error when the element specified by elementId cannot be found.
|
|
56
|
+
*/
|
|
57
|
+
mountResetPassword({ elementId, config, styles, callbacks, passwordResetToken, }: {
|
|
58
|
+
elementId: string;
|
|
59
|
+
config: StytchLoginConfig;
|
|
60
|
+
styles?: StyleConfig;
|
|
61
|
+
callbacks?: Callbacks;
|
|
62
|
+
passwordResetToken: string;
|
|
63
|
+
}): void;
|
|
64
|
+
/**
|
|
65
|
+
* Mounts a Passkey registration screen inside the element provided.
|
|
66
|
+
* If a passkey registration screen has already been rendered inside the element,
|
|
67
|
+
* it will be updated to use the new config, style, and callback options passed in.
|
|
68
|
+
* @example
|
|
69
|
+
* stytchClient.mountPasskeyRegistration({
|
|
70
|
+
* elementId: '#login-container',
|
|
71
|
+
* config: {...}
|
|
72
|
+
* });
|
|
73
|
+
*
|
|
74
|
+
* @param elementId - A string containing the id of the element that should contain the login screen.
|
|
75
|
+
* @param config - A {@link StytchLoginConfig} object containing the products that should be registered
|
|
76
|
+
* @param styles - A {@link StyleConfig} object containing custom styling info
|
|
77
|
+
* @param callbacks - Optional {@link Callbacks} triggered by various events in the Stytch SDK.
|
|
78
|
+
* @throws An error when the element specified by elementId cannot be found.
|
|
79
|
+
*/
|
|
80
|
+
mountPasskeyRegistration({ elementId, config, styles, callbacks, }: {
|
|
81
|
+
elementId: string;
|
|
82
|
+
config: StytchLoginConfig;
|
|
83
|
+
styles?: StyleConfig;
|
|
84
|
+
callbacks?: Callbacks;
|
|
85
|
+
}): void;
|
|
86
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { StytchClientOptions, SessionTokens, UnsubscribeFunction, ConsumerState, B2BState, User, Member, SessionTokensUpdate, Organization } from '@stytch/core/public';
|
|
2
|
+
import { IConsumerSubscriptionService, IB2BSubscriptionService, ISubscriptionService } from '@stytch/core';
|
|
3
|
+
import Cookies from 'js-cookie';
|
|
4
|
+
type SubscriberFunction<T> = (value: T | null) => void;
|
|
5
|
+
type Subscribers<T> = Record<string, SubscriberFunction<T>>;
|
|
6
|
+
export declare const getLocalStorageKey: (publicToken: string, key?: string) => string;
|
|
7
|
+
export declare class SubscriptionDataLayer<T extends ConsumerState | B2BState> {
|
|
8
|
+
publicToken: string;
|
|
9
|
+
state: T | null;
|
|
10
|
+
private readonly stateKeysUpdated;
|
|
11
|
+
private readonly _opaqueTokenCookieName;
|
|
12
|
+
private readonly _jwtCookieName;
|
|
13
|
+
private readonly _cookiePath;
|
|
14
|
+
private readonly _domain;
|
|
15
|
+
private readonly _cookieAvailableToSubdomains;
|
|
16
|
+
private readonly _istCookieName;
|
|
17
|
+
subscriptions: Subscribers<T>;
|
|
18
|
+
constructor(publicToken: string, options?: StytchClientOptions);
|
|
19
|
+
protected get opaqueTokenCookieName(): string;
|
|
20
|
+
protected get jwtCookieName(): string;
|
|
21
|
+
protected get istCookieName(): string;
|
|
22
|
+
readSessionCookie(): {
|
|
23
|
+
session_token: string | undefined;
|
|
24
|
+
session_jwt: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
readIntermediateSessionTokenCookie(): string | undefined;
|
|
27
|
+
writeSessionCookie(stateDiff: StateWithTokensLoggedIn<T>): void;
|
|
28
|
+
writeIntermediateSessionTokenCookie(IST: string): void;
|
|
29
|
+
removeSessionCookie(): void;
|
|
30
|
+
removeISTCookie(): void;
|
|
31
|
+
removeCookies(cookiesToRemove: string[]): void;
|
|
32
|
+
syncToLocalStorage(): void;
|
|
33
|
+
getItem(key: string): string | null;
|
|
34
|
+
setItem(key: string, value: string): void;
|
|
35
|
+
removeItem(key: string): void;
|
|
36
|
+
browserSessionStorage: {
|
|
37
|
+
getItem: (key: string) => string | null;
|
|
38
|
+
setItem: (key: string, value: string) => void;
|
|
39
|
+
removeItem: (key: string) => void;
|
|
40
|
+
};
|
|
41
|
+
static generateCookieOpts({ path, domain, availableToSubdomains, expiresAt, }: {
|
|
42
|
+
path: string | null;
|
|
43
|
+
domain: string | null;
|
|
44
|
+
availableToSubdomains: boolean;
|
|
45
|
+
expiresAt: string;
|
|
46
|
+
}): Cookies.CookieAttributes;
|
|
47
|
+
}
|
|
48
|
+
export declare class ConsumerSubscriptionDataLayer extends SubscriptionDataLayer<ConsumerState> {
|
|
49
|
+
}
|
|
50
|
+
export declare class B2BSubscriptionDataLayer extends SubscriptionDataLayer<B2BState> {
|
|
51
|
+
}
|
|
52
|
+
export declare const __clearConsumerDataLayerCache: () => void;
|
|
53
|
+
export declare const __clearB2BDataLayerCache: () => void;
|
|
54
|
+
export declare const getConsumerDataLayer: (publicToken: string, options?: StytchClientOptions) => ConsumerSubscriptionDataLayer;
|
|
55
|
+
export declare const getB2BDataLayer: (publicToken: string, options?: StytchClientOptions) => B2BSubscriptionDataLayer;
|
|
56
|
+
type StateWithTokensLoggedIn<T> = {
|
|
57
|
+
state: T | null;
|
|
58
|
+
session_token: string;
|
|
59
|
+
session_jwt: string;
|
|
60
|
+
intermediate_session_token: null;
|
|
61
|
+
};
|
|
62
|
+
type StateWithTokensLoggedOut = {
|
|
63
|
+
state: null;
|
|
64
|
+
session_token: null;
|
|
65
|
+
session_jwt: null;
|
|
66
|
+
intermediate_session_token: null;
|
|
67
|
+
};
|
|
68
|
+
type StateWithIntermediateSessionToken = {
|
|
69
|
+
state: null;
|
|
70
|
+
session_token: null;
|
|
71
|
+
session_jwt: null;
|
|
72
|
+
intermediate_session_token: string;
|
|
73
|
+
};
|
|
74
|
+
type StateWithTokensDiff<T> = StateWithTokensLoggedIn<T> | StateWithTokensLoggedOut | StateWithIntermediateSessionToken;
|
|
75
|
+
export declare class BaseSubscriptionService<T extends ConsumerState | B2BState> implements ISubscriptionService<T> {
|
|
76
|
+
private _publicToken;
|
|
77
|
+
private _datalayer;
|
|
78
|
+
/**
|
|
79
|
+
* Whether the state was retrieved from the cache and is awaiting a refresh
|
|
80
|
+
*/
|
|
81
|
+
private fromCache;
|
|
82
|
+
constructor(_publicToken: string, _datalayer: SubscriptionDataLayer<T>);
|
|
83
|
+
private _listen;
|
|
84
|
+
getTokens(): SessionTokens | null;
|
|
85
|
+
getIntermediateSessionToken(): string | null;
|
|
86
|
+
destroyState(): void;
|
|
87
|
+
destroySession(): void;
|
|
88
|
+
_updateStateAndTokensInternal(stateDiff: StateWithTokensDiff<T>): void;
|
|
89
|
+
updateStateAndTokens(stateDiff: StateWithTokensDiff<T>): void;
|
|
90
|
+
updateState(state: T | null, fromExternalSource?: boolean): void;
|
|
91
|
+
updateTokens(tokens: SessionTokensUpdate): void;
|
|
92
|
+
subscribeToState(callback: SubscriberFunction<T>): UnsubscribeFunction;
|
|
93
|
+
getState(): T | null;
|
|
94
|
+
destroy(): void;
|
|
95
|
+
syncFromDeviceStorage(): null;
|
|
96
|
+
getFromCache(): boolean;
|
|
97
|
+
setCacheRefreshed(): void;
|
|
98
|
+
}
|
|
99
|
+
export declare class ConsumerSubscriptionService extends BaseSubscriptionService<ConsumerState> implements IConsumerSubscriptionService {
|
|
100
|
+
updateUser: (user: User) => void;
|
|
101
|
+
getUser: () => User | null;
|
|
102
|
+
getSession: () => import("@stytch/core/public").Session | null;
|
|
103
|
+
}
|
|
104
|
+
export declare class B2BSubscriptionService extends BaseSubscriptionService<B2BState> implements IB2BSubscriptionService {
|
|
105
|
+
updateMember: (member: Member) => void;
|
|
106
|
+
getMember: () => Member | null;
|
|
107
|
+
updateOrganization: (organization: Organization) => void;
|
|
108
|
+
getOrganization: () => Organization | null;
|
|
109
|
+
getSession: () => import("@stytch/core/public").MemberSession | null;
|
|
110
|
+
}
|
|
111
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The style configuration allows you to customize the look of the Admin Portal.
|
|
3
|
+
* You can specify some of them or none at all.
|
|
4
|
+
*/
|
|
5
|
+
export interface AdminPortalStyleConfig {
|
|
6
|
+
/**
|
|
7
|
+
* The configuration object for the Admin Portal container.
|
|
8
|
+
*/
|
|
9
|
+
container: {
|
|
10
|
+
/**
|
|
11
|
+
* The background color of the Admin Portal container.
|
|
12
|
+
*/
|
|
13
|
+
backgroundColor: string;
|
|
14
|
+
/**
|
|
15
|
+
* The border color of the Admin Portal container.
|
|
16
|
+
*/
|
|
17
|
+
borderColor: string;
|
|
18
|
+
/**
|
|
19
|
+
* The border radius of the Admin Portal container.
|
|
20
|
+
*/
|
|
21
|
+
borderRadius: string;
|
|
22
|
+
/**
|
|
23
|
+
* The width of the Admin Portal container.
|
|
24
|
+
*/
|
|
25
|
+
width: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The configuration object for colors used in the Admin Portal.
|
|
29
|
+
*/
|
|
30
|
+
colors: {
|
|
31
|
+
/**
|
|
32
|
+
* Your primary brand color. This will be applied to most of the text in the
|
|
33
|
+
* Admin Portal.
|
|
34
|
+
*/
|
|
35
|
+
primary: string;
|
|
36
|
+
/**
|
|
37
|
+
* Your secondary brand color. This will be applied to text disclaimers and
|
|
38
|
+
* other visual elements.
|
|
39
|
+
*/
|
|
40
|
+
secondary: string;
|
|
41
|
+
/**
|
|
42
|
+
* A success color to be used in visual elements.
|
|
43
|
+
*/
|
|
44
|
+
success: string;
|
|
45
|
+
/**
|
|
46
|
+
* An error color to be used in visual elements.
|
|
47
|
+
*/
|
|
48
|
+
error: string;
|
|
49
|
+
/**
|
|
50
|
+
* The text color for accent elements. This will be used for tags and select
|
|
51
|
+
* chips in the Admin Portal.
|
|
52
|
+
*/
|
|
53
|
+
accentText: string;
|
|
54
|
+
/**
|
|
55
|
+
* An accent color to be used in visual elements. This will be applied to
|
|
56
|
+
* the background of tags and select chips in the Admin Portal.
|
|
57
|
+
*/
|
|
58
|
+
accent: string;
|
|
59
|
+
/**
|
|
60
|
+
* The color used for miscellaneous elements that don't require visual
|
|
61
|
+
* elements, like dividers and table, popover menu, and accordion borders.
|
|
62
|
+
*/
|
|
63
|
+
subtle: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The configuration object for buttons in the Admin Portal.
|
|
67
|
+
*/
|
|
68
|
+
buttons: {
|
|
69
|
+
/**
|
|
70
|
+
* The configuration object for primary buttons.
|
|
71
|
+
*/
|
|
72
|
+
primary: {
|
|
73
|
+
/**
|
|
74
|
+
* The background color of the primary button.
|
|
75
|
+
*/
|
|
76
|
+
backgroundColor: string;
|
|
77
|
+
/**
|
|
78
|
+
* The text color of the primary button.
|
|
79
|
+
*/
|
|
80
|
+
textColor: string;
|
|
81
|
+
/**
|
|
82
|
+
* The border color of the primary button.
|
|
83
|
+
*/
|
|
84
|
+
borderColor: string;
|
|
85
|
+
/**
|
|
86
|
+
* The border radius of the primary button.
|
|
87
|
+
*/
|
|
88
|
+
borderRadius: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The configuration object for secondary buttons.
|
|
92
|
+
*/
|
|
93
|
+
secondary: {
|
|
94
|
+
/**
|
|
95
|
+
* The background color of the secondary button.
|
|
96
|
+
*/
|
|
97
|
+
backgroundColor: string;
|
|
98
|
+
/**
|
|
99
|
+
* The text color of the secondary button.
|
|
100
|
+
*/
|
|
101
|
+
textColor: string;
|
|
102
|
+
/**
|
|
103
|
+
* The border color of the secondary button.
|
|
104
|
+
*/
|
|
105
|
+
borderColor: string;
|
|
106
|
+
/**
|
|
107
|
+
* The border radius of the secondary button.
|
|
108
|
+
*/
|
|
109
|
+
borderRadius: string;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* The configuration object for disabled buttons.
|
|
113
|
+
*/
|
|
114
|
+
disabled: {
|
|
115
|
+
/**
|
|
116
|
+
* The background color of the disabled button.
|
|
117
|
+
*/
|
|
118
|
+
backgroundColor: string;
|
|
119
|
+
/**
|
|
120
|
+
* The text color of the disabled button.
|
|
121
|
+
*/
|
|
122
|
+
textColor: string;
|
|
123
|
+
/**
|
|
124
|
+
* The border color of the disabled button.
|
|
125
|
+
*/
|
|
126
|
+
borderColor: string;
|
|
127
|
+
/**
|
|
128
|
+
* The border radius of the disabled button.
|
|
129
|
+
*/
|
|
130
|
+
borderRadius: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* The configuration object for text inputs in the Admin Portal.
|
|
135
|
+
*/
|
|
136
|
+
inputs: {
|
|
137
|
+
/**
|
|
138
|
+
* The background color of the text inputs.
|
|
139
|
+
*/
|
|
140
|
+
backgroundColor: string;
|
|
141
|
+
/**
|
|
142
|
+
* The text color of the text inputs.
|
|
143
|
+
*/
|
|
144
|
+
textColor: string;
|
|
145
|
+
/**
|
|
146
|
+
* The color of the placeholder text in the text inputs.
|
|
147
|
+
*/
|
|
148
|
+
placeholderColor: string;
|
|
149
|
+
/**
|
|
150
|
+
* The border color of the text inputs.
|
|
151
|
+
*/
|
|
152
|
+
borderColor: string;
|
|
153
|
+
/**
|
|
154
|
+
* The border radius of the text inputs.
|
|
155
|
+
*/
|
|
156
|
+
borderRadius: string;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* The font family that will apply to text in the Admin Portal.
|
|
160
|
+
*/
|
|
161
|
+
fontFamily: string;
|
|
162
|
+
/**
|
|
163
|
+
* The default border radius for elements in the Admin Portal.
|
|
164
|
+
*/
|
|
165
|
+
borderRadius: string;
|
|
166
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AdminPortalComponentMountOptions } from './makeAdminPortalComponentMountFn';
|
|
3
|
+
export declare const AdminPortalWrapper: ({ children, options, }: {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
options: AdminPortalComponentMountOptions;
|
|
6
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type RouterStateEntry<TScreenMap> = {
|
|
3
|
+
[K in keyof TScreenMap]: TScreenMap[K] extends never ? {
|
|
4
|
+
screen: K;
|
|
5
|
+
params?: undefined;
|
|
6
|
+
} : {
|
|
7
|
+
screen: K;
|
|
8
|
+
params: TScreenMap[K];
|
|
9
|
+
};
|
|
10
|
+
}[keyof TScreenMap];
|
|
11
|
+
export type MappedPropsFromRouteMap<TRouteMap extends Record<string, React.ComponentType<any>>> = {
|
|
12
|
+
[K in keyof TRouteMap]: unknown extends React.ComponentProps<TRouteMap[K]> ? never : React.ComponentProps<TRouteMap[K]>;
|
|
13
|
+
};
|
|
14
|
+
interface RouterState<TScreenMap> {
|
|
15
|
+
currentRoute: RouterStateEntry<TScreenMap>;
|
|
16
|
+
pendingRoute?: RouterStateEntry<TScreenMap> | undefined;
|
|
17
|
+
blockersActive: Set<EnableBlock>;
|
|
18
|
+
}
|
|
19
|
+
type RouterContextState<TScreenMap> = Pick<RouterState<TScreenMap>, 'currentRoute'>;
|
|
20
|
+
type EnableBlock = boolean | (() => boolean);
|
|
21
|
+
export type UseBlockNavigation = (enableBlock: EnableBlock) => {
|
|
22
|
+
blocked: boolean;
|
|
23
|
+
allowNavigation: () => void;
|
|
24
|
+
cancelNavigation: () => void;
|
|
25
|
+
};
|
|
26
|
+
export interface RouterController<TScreenMap> {
|
|
27
|
+
navigate: (destination: RouterStateEntry<TScreenMap>) => void;
|
|
28
|
+
useBlockNavigation: UseBlockNavigation;
|
|
29
|
+
}
|
|
30
|
+
type RouteMap<TScreenMap> = {
|
|
31
|
+
[K in keyof TScreenMap]: React.ComponentType<TScreenMap[K]>;
|
|
32
|
+
};
|
|
33
|
+
export declare const createRouter: <TScreenMap extends Record<string, object>>() => {
|
|
34
|
+
RouterProvider: ({ children, initialRoute, }: {
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
initialRoute: RouterStateEntry<TScreenMap>;
|
|
37
|
+
}) => React.JSX.Element;
|
|
38
|
+
Router: ({ routeMap }: {
|
|
39
|
+
routeMap: RouteMap<TScreenMap>;
|
|
40
|
+
}) => React.JSX.Element | null;
|
|
41
|
+
useRouterController: () => RouterController<TScreenMap>;
|
|
42
|
+
useRouterState: () => RouterContextState<TScreenMap>;
|
|
43
|
+
};
|
|
44
|
+
export {};
|