@ory/elements-react 1.0.0-rc.3 → 1.0.0-rc.4
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 +13 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +199 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +197 -47
- package/dist/index.mjs.map +1 -1
- package/dist/theme/default/index.js +153 -121
- package/dist/theme/default/index.js.map +1 -1
- package/dist/theme/default/index.mjs +62 -32
- package/dist/theme/default/index.mjs.map +1 -1
- package/package.json +6 -6
- package/tsconfig.json +1 -1
|
@@ -281,15 +281,22 @@ import { useFormContext } from "react-hook-form";
|
|
|
281
281
|
// src/util/onSubmitLogin.ts
|
|
282
282
|
import {
|
|
283
283
|
FlowType as FlowType3,
|
|
284
|
-
handleFlowError,
|
|
285
284
|
loginUrl
|
|
286
285
|
} from "@ory/client-fetch";
|
|
287
286
|
|
|
287
|
+
// src/util/sdk-helpers/error.ts
|
|
288
|
+
import {
|
|
289
|
+
ResponseError,
|
|
290
|
+
FetchError
|
|
291
|
+
} from "@ory/client-fetch";
|
|
292
|
+
|
|
293
|
+
// src/util/sdk-helpers/utils.ts
|
|
294
|
+
import { FetchError as FetchError2, ResponseError as ResponseError2 } from "@ory/client-fetch";
|
|
295
|
+
|
|
288
296
|
// src/util/onSubmitRecovery.ts
|
|
289
297
|
import {
|
|
290
298
|
FlowType as FlowType4,
|
|
291
299
|
handleContinueWith,
|
|
292
|
-
handleFlowError as handleFlowError2,
|
|
293
300
|
instanceOfContinueWithRecoveryUi,
|
|
294
301
|
recoveryUrl
|
|
295
302
|
} from "@ory/client-fetch";
|
|
@@ -298,7 +305,6 @@ import {
|
|
|
298
305
|
import {
|
|
299
306
|
FlowType as FlowType5,
|
|
300
307
|
handleContinueWith as handleContinueWith2,
|
|
301
|
-
handleFlowError as handleFlowError3,
|
|
302
308
|
registrationUrl
|
|
303
309
|
} from "@ory/client-fetch";
|
|
304
310
|
|
|
@@ -306,8 +312,7 @@ import {
|
|
|
306
312
|
import {
|
|
307
313
|
FlowType as FlowType6,
|
|
308
314
|
handleContinueWith as handleContinueWith3,
|
|
309
|
-
|
|
310
|
-
isResponseError,
|
|
315
|
+
isResponseError as isResponseError2,
|
|
311
316
|
loginUrl as loginUrl2,
|
|
312
317
|
settingsUrl
|
|
313
318
|
} from "@ory/client-fetch";
|
|
@@ -315,8 +320,7 @@ import {
|
|
|
315
320
|
// src/util/onSubmitVerification.ts
|
|
316
321
|
import {
|
|
317
322
|
FlowType as FlowType7,
|
|
318
|
-
|
|
319
|
-
verificationUrl
|
|
323
|
+
verificationUrl as verificationUrl2
|
|
320
324
|
} from "@ory/client-fetch";
|
|
321
325
|
|
|
322
326
|
// src/components/form/form-helpers.ts
|
|
@@ -2959,10 +2963,26 @@ function DefaultCardFooter() {
|
|
|
2959
2963
|
return null;
|
|
2960
2964
|
}
|
|
2961
2965
|
}
|
|
2966
|
+
function shouldShowLogoutButton(flow, formState, authMethods) {
|
|
2967
|
+
if (flow.refresh) {
|
|
2968
|
+
return true;
|
|
2969
|
+
}
|
|
2970
|
+
if (flow.requested_aal === "aal2") {
|
|
2971
|
+
if (formState.current === "select_method") {
|
|
2972
|
+
return true;
|
|
2973
|
+
}
|
|
2974
|
+
if (formState.current === "method_active" && flow.active === "code") {
|
|
2975
|
+
return true;
|
|
2976
|
+
}
|
|
2977
|
+
if (formState.current === "method_active" && authMethods.length === 1) {
|
|
2978
|
+
return true;
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
return false;
|
|
2982
|
+
}
|
|
2962
2983
|
function LoginCardFooter() {
|
|
2963
|
-
const { formState, flow, flowType } = useOryFlow3();
|
|
2984
|
+
const { formState, flow, flowType, dispatchFormState } = useOryFlow3();
|
|
2964
2985
|
const config = useOryConfiguration2();
|
|
2965
|
-
const { logoutFlow: logout, didLoad: didLoadLogout } = useClientLogout(config);
|
|
2966
2986
|
const intl = useIntl9();
|
|
2967
2987
|
if (flowType !== FlowType10.Login) {
|
|
2968
2988
|
return null;
|
|
@@ -2978,27 +2998,8 @@ function LoginCardFooter() {
|
|
|
2978
2998
|
`${config.sdk.url}/self-service/${flowType}/browser`
|
|
2979
2999
|
);
|
|
2980
3000
|
}
|
|
2981
|
-
if (flow
|
|
2982
|
-
return /* @__PURE__ */
|
|
2983
|
-
intl.formatMessage({
|
|
2984
|
-
id: "login.2fa.go-back"
|
|
2985
|
-
}),
|
|
2986
|
-
" ",
|
|
2987
|
-
/* @__PURE__ */ jsx35(
|
|
2988
|
-
"a",
|
|
2989
|
-
{
|
|
2990
|
-
className: "text-button-link-brand-brand transition-colors hover:text-button-link-brand-brand-hover underline",
|
|
2991
|
-
href: logout ? logout == null ? void 0 : logout.logout_url : returnTo,
|
|
2992
|
-
"data-testid": (
|
|
2993
|
-
// Only add the test-id when the logout link has loaded.
|
|
2994
|
-
didLoadLogout ? "ory/screen/login/action/logout" : void 0
|
|
2995
|
-
),
|
|
2996
|
-
children: intl.formatMessage({
|
|
2997
|
-
id: !didLoadLogout || logout ? "login.logout-button" : "login.2fa.go-back.link"
|
|
2998
|
-
})
|
|
2999
|
-
}
|
|
3000
|
-
)
|
|
3001
|
-
] });
|
|
3001
|
+
if (shouldShowLogoutButton(flow, formState, authMethods)) {
|
|
3002
|
+
return /* @__PURE__ */ jsx35(LogoutButton, { returnTo });
|
|
3002
3003
|
}
|
|
3003
3004
|
return /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
3004
3005
|
formState.current === "provide_identifier" && config.project.registration_enabled && /* @__PURE__ */ jsxs15("span", { className: "font-normal leading-normal antialiased text-interface-foreground-default-primary", children: [
|
|
@@ -3021,10 +3022,14 @@ function LoginCardFooter() {
|
|
|
3021
3022
|
)
|
|
3022
3023
|
] }),
|
|
3023
3024
|
authMethods.length > 1 && formState.current === "method_active" && /* @__PURE__ */ jsx35("span", { className: "font-normal leading-normal antialiased text-interface-foreground-default-primary", children: /* @__PURE__ */ jsx35(
|
|
3024
|
-
"
|
|
3025
|
+
"button",
|
|
3025
3026
|
{
|
|
3026
3027
|
className: "text-button-link-brand-brand transition-colors hover:text-button-link-brand-brand-hover underline",
|
|
3027
|
-
|
|
3028
|
+
onClick: () => {
|
|
3029
|
+
dispatchFormState({
|
|
3030
|
+
type: "action_clear_active_method"
|
|
3031
|
+
});
|
|
3032
|
+
},
|
|
3028
3033
|
"data-testid": "ory/screen/login/mfa/action/selectMethod",
|
|
3029
3034
|
children: intl.formatMessage({
|
|
3030
3035
|
id: "login.2fa.method.go-back"
|
|
@@ -3044,6 +3049,31 @@ function LoginCardFooter() {
|
|
|
3044
3049
|
) })
|
|
3045
3050
|
] });
|
|
3046
3051
|
}
|
|
3052
|
+
function LogoutButton({ returnTo }) {
|
|
3053
|
+
const config = useOryConfiguration2();
|
|
3054
|
+
const intl = useIntl9();
|
|
3055
|
+
const { logoutFlow: logout, didLoad: didLoadLogout } = useClientLogout(config);
|
|
3056
|
+
return /* @__PURE__ */ jsxs15("span", { className: "font-normal leading-normal antialiased text-interface-foreground-default-primary", children: [
|
|
3057
|
+
intl.formatMessage({
|
|
3058
|
+
id: "login.2fa.go-back"
|
|
3059
|
+
}),
|
|
3060
|
+
" ",
|
|
3061
|
+
/* @__PURE__ */ jsx35(
|
|
3062
|
+
"a",
|
|
3063
|
+
{
|
|
3064
|
+
className: "text-button-link-brand-brand transition-colors hover:text-button-link-brand-brand-hover underline",
|
|
3065
|
+
href: logout ? logout == null ? void 0 : logout.logout_url : returnTo,
|
|
3066
|
+
"data-testid": (
|
|
3067
|
+
// Only add the test-id when the logout link has loaded.
|
|
3068
|
+
didLoadLogout ? "ory/screen/login/action/logout" : void 0
|
|
3069
|
+
),
|
|
3070
|
+
children: intl.formatMessage({
|
|
3071
|
+
id: !didLoadLogout || logout ? "login.logout-button" : "login.2fa.go-back.link"
|
|
3072
|
+
})
|
|
3073
|
+
}
|
|
3074
|
+
)
|
|
3075
|
+
] });
|
|
3076
|
+
}
|
|
3047
3077
|
function RegistrationCardFooter() {
|
|
3048
3078
|
const intl = useIntl9();
|
|
3049
3079
|
const { flow, formState } = useOryFlow3();
|