@stytch/vanilla-js 5.7.0 → 5.8.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 +14 -0
- package/README.md +1 -1
- package/dist/adminPortal/index.esm.js +2 -2
- package/dist/adminPortal/index.js +2 -2
- package/dist/adminPortal/settings/AdminPortalOrgSettings.d.ts +1 -0
- package/dist/b2b/index.esm.js +2628 -2186
- package/dist/b2b/index.headless.esm.js +3 -3
- package/dist/b2b/index.headless.js +2 -2
- package/dist/b2b/index.js +2633 -2191
- package/dist/{extractErrorMessage-ZR2dlrSk.js → extractErrorMessage-C0TeBTBa.js} +4 -4
- package/dist/{extractErrorMessage-DK-YyUyE.js → extractErrorMessage-CYXucHbA.js} +5 -5
- package/dist/index.esm.js +1 -1
- package/dist/index.headless.esm.js +2 -1
- package/dist/index.headless.js +2 -1
- package/dist/index.js +1 -1
- package/dist/{internal-yKvEN9N6.js → internal-BeiYVaO7.js} +2 -1
- package/dist/{internal-DB9djgAd.js → internal-HC6WhS3G.js} +3 -2
- package/dist/ui/b2b/GlobalContextProvider.d.ts +11 -4
- package/dist/ui/b2b/generateProductComponentsOrdering.d.ts +4 -4
- package/dist/ui/b2b/getOtpCodeExpiration.d.ts +1 -0
- package/dist/ui/b2b/hooks/useEmailOtpDiscoverySend.d.ts +5 -0
- package/dist/ui/b2b/hooks/useEmailOtpLoginOrSignup.d.ts +6 -0
- package/dist/ui/b2b/hooks/useEmlDiscoverySend.d.ts +5 -0
- package/dist/ui/b2b/hooks/useEmlLoginOrSignup.d.ts +6 -0
- package/dist/ui/b2b/reducer.d.ts +7 -1
- package/dist/ui/b2b/screens/EmailForm.d.ts +3 -0
- package/dist/ui/b2b/screens/EmailMethodSelectionScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/EmailOTPEntryScreen.d.ts +2 -0
- package/dist/ui/b2b/utils.d.ts +2 -1
- package/dist/ui/components/LoadingButton.d.ts +8 -0
- package/dist/ui/components/MenuButton.d.ts +6 -0
- package/dist/ui/components/SubmitButton.d.ts +1 -1
- package/dist/utils/StyledComponentProps.d.ts +2 -0
- package/package.json +2 -2
- package/dist/ui/b2b/screens/MagicLinkForm.d.ts +0 -3
|
@@ -694,6 +694,7 @@ function errorToStytchError(error) {
|
|
|
694
694
|
exports.B2BProducts = void 0;
|
|
695
695
|
(function (B2BProducts) {
|
|
696
696
|
B2BProducts["emailMagicLinks"] = "emailMagicLinks";
|
|
697
|
+
B2BProducts["emailOtp"] = "emailOtp";
|
|
697
698
|
B2BProducts["sso"] = "sso";
|
|
698
699
|
B2BProducts["passwords"] = "passwords";
|
|
699
700
|
B2BProducts["oauth"] = "oauth";
|
|
@@ -4946,7 +4947,7 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4946
4947
|
return _regeneratorRuntime().wrap(function _callee132$(_context132) {
|
|
4947
4948
|
while (1) switch (_context132.prev = _context132.next) {
|
|
4948
4949
|
case 0:
|
|
4949
|
-
validate('stytch.otps.email.authenticate').isString('code', data.code).isString('
|
|
4950
|
+
validate('stytch.otps.email.authenticate').isString('code', data.code).isString('email_address', data.email_address).isString('organization_id', data.organization_id).isNumber('session_duration_minutes', data.session_duration_minutes).isOptionalString('locale', data.locale);
|
|
4950
4951
|
_context132.next = 3;
|
|
4951
4952
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4952
4953
|
case 3:
|
|
@@ -692,6 +692,7 @@ function errorToStytchError(error) {
|
|
|
692
692
|
var B2BProducts;
|
|
693
693
|
(function (B2BProducts) {
|
|
694
694
|
B2BProducts["emailMagicLinks"] = "emailMagicLinks";
|
|
695
|
+
B2BProducts["emailOtp"] = "emailOtp";
|
|
695
696
|
B2BProducts["sso"] = "sso";
|
|
696
697
|
B2BProducts["passwords"] = "passwords";
|
|
697
698
|
B2BProducts["oauth"] = "oauth";
|
|
@@ -4944,7 +4945,7 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4944
4945
|
return _regeneratorRuntime().wrap(function _callee132$(_context132) {
|
|
4945
4946
|
while (1) switch (_context132.prev = _context132.next) {
|
|
4946
4947
|
case 0:
|
|
4947
|
-
validate('stytch.otps.email.authenticate').isString('code', data.code).isString('
|
|
4948
|
+
validate('stytch.otps.email.authenticate').isString('code', data.code).isString('email_address', data.email_address).isString('organization_id', data.organization_id).isNumber('session_duration_minutes', data.session_duration_minutes).isOptionalString('locale', data.locale);
|
|
4948
4949
|
_context132.next = 3;
|
|
4949
4950
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4950
4951
|
case 3:
|
|
@@ -5767,4 +5768,4 @@ var readB2BInternals = function readB2BInternals(obj) {
|
|
|
5767
5768
|
}
|
|
5768
5769
|
return casted[internalSymB2B];
|
|
5769
5770
|
};
|
|
5770
|
-
export {
|
|
5771
|
+
export { SignInWithAppleMisconfigured as $, AuthFlowType as A, B2BMFAProducts as B, COUNTRIES_LIST as C, DEFAULT_SESSION_DURATION_MINUTES as D, EMAIL_REGEX as E, FailedCodeChallengeError as F, MissingUrlError as G, NoBiometricsRegistrationError as H, InternalError as I, JSONDataNotConvertibleToStringError as J, KeyInvalidatedError as K, NoCredentialsPresentError as L, MissingAttestationObjectError as M, NoBiometricsEnrolledError as N, OAuthProviders as O, Products as P, NoCurrentSessionError as Q, PasskeysInvalidEncoding as R, StytchEventType as S, PasskeysMisconfigured as T, PasskeysUnsupportedError as U, RNUIProducts as V, Wallets as W, RandomNumberGenerationFailed as X, SDKAPIUnreachableError as Y, SDKNotConfiguredError as Z, __rest as _, B2BProducts as a, StytchAPISchemaError as a0, StytchAPIUnreachableError as a1, StytchError as a2, StytchSDKAPIError as a3, StytchSDKSchemaError as a4, StytchSDKUsageError as a5, UNRECOVERABLE_ERROR_TYPES as a6, UserCancellationError as a7, UserLockedOutError as a8, errorToStytchError as a9, HeadlessB2BMagicLinksClient as aA, HeadlessB2BSSOClient as aB, HeadlessB2BDiscoveryClient as aC, HeadlessB2BPasswordsClient as aD, HeadlessB2BOTPsClient as aE, HeadlessB2BTOTPsClient as aF, HeadlessB2BRecoveryCodesClient as aG, HeadlessB2BRBACClient as aH, HeadlessB2BSCIMClient as aI, SessionManager as aJ, SearchDataManager as aK, writeB2BInternals as aL, createDeepEqual as aa, getPersistentStorageKey as ab, HeadlessB2BOAuthClient$1 as ac, loadESModule as ad, IframeHostClient as ae, validate as af, hasMultipleCookies as ag, isLocalhost as ah, GOOGLE_ONE_TAP_HOST as ai, GOOGLE_ONE_TAP_SCRIPT_URL as aj, EventLogger as ak, DEFAULT_MAX_BATCH_SIZE as al, DEFAULT_INTERVAL_DURATION_MS as am, createEventId as an, createAppSessionId as ao, createPersistentId as ap, baseFetchSDK as aq, retriableFetchSDK as ar, checkB2BNotSSR as as, checkPublicToken as at, buildFinalConfig as au, StateChangeClient as av, DFPProtectedAuthProvider as aw, HeadlessB2BOrganizationClient as ax, HeadlessB2BSelfClient as ay, HeadlessB2BSessionClient as az, OTPMethods as b, B2BOAuthProviders as c, __awaiter as d, StytchAPIError as e, OneTapPositions as f, debounce as g, StytchSDKError as h, isTestPublicToken as i, checkNotSSR as j, BiometricsFailedError as k, logger as l, BiometricsUnavailableError as m, ChallengeSigningFailedError as n, DeviceCredentialsNotAllowedError as o, FailedToDecryptDataError as p, InvalidAuthorizationCredentialError as q, readB2BInternals as r, InvalidCredentialTypeError as s, InvalidRedirectSchemeError as t, InvalidStartUrlError as u, KeystoreUnavailableError as v, MissingAuthorizationCredentialIDTokenError as w, MissingGoogleClientIDError as x, MissingPKCEError as y, MissingPublicKeyError as z };
|
|
@@ -23,7 +23,9 @@ export declare enum AppScreens {
|
|
|
23
23
|
SMSOTPEntry = "SMS OTP Entry",
|
|
24
24
|
TOTPEnrollmentManual = "TOTP Enrollment Manual",
|
|
25
25
|
TOTPEnrollmentQRCode = "TOTP Enrollment QR Code",
|
|
26
|
-
TOTPEntry = "TOTP Entry"
|
|
26
|
+
TOTPEntry = "TOTP Entry",
|
|
27
|
+
EmailMethodSelection = "Email Method Selection",
|
|
28
|
+
EmailOTPEntry = "Email OTP Entry"
|
|
27
29
|
}
|
|
28
30
|
export declare enum ErrorType {
|
|
29
31
|
Default = 0,
|
|
@@ -32,8 +34,8 @@ export declare enum ErrorType {
|
|
|
32
34
|
CannotJoinOrgDueToAuthPolicy = 3,
|
|
33
35
|
AdBlockerDetected = 4
|
|
34
36
|
}
|
|
35
|
-
export type
|
|
36
|
-
|
|
37
|
+
export type EmailState = {
|
|
38
|
+
userSuppliedEmail: string;
|
|
37
39
|
};
|
|
38
40
|
export type DiscoveryState = {
|
|
39
41
|
email: string;
|
|
@@ -43,10 +45,14 @@ export type DiscoveryState = {
|
|
|
43
45
|
export type PasswordState = {
|
|
44
46
|
email: string;
|
|
45
47
|
};
|
|
48
|
+
export type OtpState = {
|
|
49
|
+
codeExpiration: Date | null;
|
|
50
|
+
};
|
|
46
51
|
export type FormState = {
|
|
47
|
-
|
|
52
|
+
emailState: EmailState;
|
|
48
53
|
discoveryState: DiscoveryState;
|
|
49
54
|
passwordState: PasswordState;
|
|
55
|
+
otpState: OtpState;
|
|
50
56
|
};
|
|
51
57
|
export type FlowState = {
|
|
52
58
|
type: StringLiteralFromEnum<AuthFlowType>;
|
|
@@ -59,6 +65,7 @@ type PrimaryAuthState = {
|
|
|
59
65
|
};
|
|
60
66
|
export type AppState = {
|
|
61
67
|
screen: AppScreens;
|
|
68
|
+
screenHistory: AppScreens[];
|
|
62
69
|
formState: FormState;
|
|
63
70
|
flowState: FlowState;
|
|
64
71
|
mfa: MfaState;
|
|
@@ -2,13 +2,13 @@ import { StringLiteralFromEnum } from '@stytch/core';
|
|
|
2
2
|
import { B2BProducts } from '@stytch/core/public';
|
|
3
3
|
import { FlowState } from './GlobalContextProvider';
|
|
4
4
|
export declare enum Component {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
EmailForm = "EmailForm",
|
|
6
|
+
EmailDiscoveryForm = "EmailDiscoveryForm",
|
|
7
7
|
OAuthButtons = "OAuthButtons",
|
|
8
8
|
SSOButtons = "SSOButtons",
|
|
9
9
|
PasswordsEmailForm = "PasswordsEmailForm",
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
PasswordEmailCombined = "PasswordEmailCombined",
|
|
11
|
+
PasswordEmailCombinedDiscovery = "PasswordEmailCombinedDiscovery",
|
|
12
12
|
Divider = "Divider"
|
|
13
13
|
}
|
|
14
14
|
export declare const generateProductComponentsOrdering: (products: StringLiteralFromEnum<B2BProducts>[], flowState: FlowState) => Component[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getOtpCodeExpiration: () => Date;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StytchAPIError } from '@stytch/core/public';
|
|
2
|
+
import { Key } from 'swr';
|
|
3
|
+
export declare const useEmailOtpLoginOrSignup: () => import("swr/mutation").SWRMutationResponse<import("@stytch/core/public").ResponseCommon, StytchAPIError, {
|
|
4
|
+
email: string;
|
|
5
|
+
organization_id: string;
|
|
6
|
+
}, Key>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ResponseCommon, StytchAPIError } from '@stytch/core/public';
|
|
2
|
+
import { Key } from 'swr';
|
|
3
|
+
export declare const useEmlLoginOrSignup: () => import("swr/mutation").SWRMutationResponse<ResponseCommon, StytchAPIError, {
|
|
4
|
+
email: string;
|
|
5
|
+
organization_id: string;
|
|
6
|
+
}, Key>;
|
package/dist/ui/b2b/reducer.d.ts
CHANGED
|
@@ -4,11 +4,14 @@ import { MfaAction } from './mfa';
|
|
|
4
4
|
export type Action = {
|
|
5
5
|
type: 'transition';
|
|
6
6
|
screen: AppScreens;
|
|
7
|
+
history?: 'push' | 'reset';
|
|
8
|
+
} | {
|
|
9
|
+
type: 'navigate_back';
|
|
7
10
|
} | {
|
|
8
11
|
type: 'set_error_message_and_transition';
|
|
9
12
|
errorType: ErrorType;
|
|
10
13
|
} | {
|
|
11
|
-
type: '
|
|
14
|
+
type: 'set_user_supplied_email';
|
|
12
15
|
email: string;
|
|
13
16
|
} | {
|
|
14
17
|
type: 'set_organization';
|
|
@@ -24,5 +27,8 @@ export type Action = {
|
|
|
24
27
|
} | {
|
|
25
28
|
type: 'select_discovered_organization';
|
|
26
29
|
discoveredOrganization: DiscoveredOrganization;
|
|
30
|
+
} | {
|
|
31
|
+
type: 'send_email_otp';
|
|
32
|
+
codeExpiration: Date;
|
|
27
33
|
} | MfaAction;
|
|
28
34
|
export declare const reducer: (state: AppState, action: Action) => AppState;
|
package/dist/ui/b2b/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SWRMutationHook } from 'swr/mutation';
|
|
3
|
-
import { B2BAuthenticateResponseWithMFA, StytchB2BUIConfig } from '@stytch/core/public';
|
|
3
|
+
import { B2BAuthenticateResponseWithMFA, B2BDiscoveryAuthenticateResponse, B2BMagicLinksDiscoveryAuthenticateResponse, StytchB2BUIConfig } from '@stytch/core/public';
|
|
4
4
|
import { OrganizationBySlugMatch } from '@stytch/core/public';
|
|
5
5
|
import { Action } from './reducer';
|
|
6
6
|
export declare const useMutate: SWRMutationHook;
|
|
@@ -18,6 +18,7 @@ export declare const useExtractSlug: () => {
|
|
|
18
18
|
};
|
|
19
19
|
export declare const useBootstrap: () => import("@stytch/core").BootstrapData;
|
|
20
20
|
export declare const onAuthenticateSuccess: (data: B2BAuthenticateResponseWithMFA, dispatch: React.Dispatch<Action>, config: StytchB2BUIConfig) => void;
|
|
21
|
+
export declare const onDiscoveryAuthenticateSuccess: (data: B2BDiscoveryAuthenticateResponse | B2BMagicLinksDiscoveryAuthenticateResponse, dispatch: React.Dispatch<Action>) => void;
|
|
21
22
|
export declare const usePasswordInput: () => {
|
|
22
23
|
stytch: import("../../b2b").StytchB2BUIClient;
|
|
23
24
|
onError: (error: import("@stytch/core/public").StytchSDKUIError) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyledComponentProps } from '../../utils/StyledComponentProps';
|
|
3
|
+
import Button from './Button';
|
|
4
|
+
interface LoadingButtonProps extends StyledComponentProps<typeof Button> {
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const LoadingButton: ({ children, isLoading, ...buttonProps }: LoadingButtonProps) => React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -5,4 +5,4 @@ export type SubmitButtonProps = {
|
|
|
5
5
|
text: string;
|
|
6
6
|
variant?: 'primary' | 'outlined' | 'text';
|
|
7
7
|
};
|
|
8
|
-
export declare const SubmitButton: (
|
|
8
|
+
export declare const SubmitButton: ({ isSubmitting, disabled, text, variant }: SubmitButtonProps) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stytch/vanilla-js",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"description": "Stytch's official Javascript Client Library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"hoistingLimits": "workspaces"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@stytch/core": "2.
|
|
42
|
+
"@stytch/core": "2.34.0",
|
|
43
43
|
"@types/google-one-tap": "^1.2.0",
|
|
44
44
|
"type-fest": "4.15.0"
|
|
45
45
|
},
|