@ory/elements-react 0.0.0-pr.5cdcf132 → 0.0.0-pr.6ecad3e0
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 +32 -0
- package/dist/index.d.mts +45 -18
- package/dist/index.d.ts +45 -18
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -6
- package/dist/index.mjs.map +1 -1
- package/dist/theme/default/index.js +138 -98
- package/dist/theme/default/index.js.map +1 -1
- package/dist/theme/default/index.mjs +123 -83
- package/dist/theme/default/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -241,6 +241,7 @@ function frontendClient(sdkUrl, opts = {}) {
|
|
|
241
241
|
const config = new Configuration({
|
|
242
242
|
...opts,
|
|
243
243
|
basePath: sdkUrl,
|
|
244
|
+
credentials: "include",
|
|
244
245
|
headers: {
|
|
245
246
|
Accept: "application/json",
|
|
246
247
|
...opts.headers
|
|
@@ -2902,6 +2903,19 @@ function LoginCardFooter() {
|
|
|
2902
2903
|
`${config.sdk.url}/self-service/${flowType}/browser`
|
|
2903
2904
|
);
|
|
2904
2905
|
}
|
|
2906
|
+
if (authMethods.length > 1 && formState.current === "method_active") {
|
|
2907
|
+
return /* @__PURE__ */ jsx34("span", { className: "font-normal leading-normal antialiased text-interface-foreground-default-primary", children: /* @__PURE__ */ jsx34(
|
|
2908
|
+
"a",
|
|
2909
|
+
{
|
|
2910
|
+
className: "text-button-link-brand-brand transition-colors hover:text-button-link-brand-brand-hover underline",
|
|
2911
|
+
href: "",
|
|
2912
|
+
"data-testid": "ory/screen/login/mfa/action/selectMethod",
|
|
2913
|
+
children: intl.formatMessage({
|
|
2914
|
+
id: "login.2fa.method.go-back"
|
|
2915
|
+
})
|
|
2916
|
+
}
|
|
2917
|
+
) });
|
|
2918
|
+
}
|
|
2905
2919
|
if (flow.refresh || flow.requested_aal === "aal2") {
|
|
2906
2920
|
return /* @__PURE__ */ jsxs15("span", { className: "font-normal leading-normal antialiased text-interface-foreground-default-primary", children: [
|
|
2907
2921
|
intl.formatMessage({
|
|
@@ -2944,17 +2958,6 @@ function LoginCardFooter() {
|
|
|
2944
2958
|
}
|
|
2945
2959
|
)
|
|
2946
2960
|
] }),
|
|
2947
|
-
authMethods.length > 1 && formState.current === "method_active" && /* @__PURE__ */ jsx34("span", { className: "font-normal leading-normal antialiased text-interface-foreground-default-primary", children: /* @__PURE__ */ jsx34(
|
|
2948
|
-
"a",
|
|
2949
|
-
{
|
|
2950
|
-
className: "text-button-link-brand-brand transition-colors hover:text-button-link-brand-brand-hover underline",
|
|
2951
|
-
href: "",
|
|
2952
|
-
"data-testid": "ory/screen/login/mfa/action/selectMethod",
|
|
2953
|
-
children: intl.formatMessage({
|
|
2954
|
-
id: "login.2fa.method.go-back"
|
|
2955
|
-
})
|
|
2956
|
-
}
|
|
2957
|
-
) }),
|
|
2958
2961
|
authMethods.length === 1 && authMethods[0] === "code" && formState.current === "method_active" && /* @__PURE__ */ jsx34("span", { className: "font-normal leading-normal antialiased text-interface-foreground-default-primary", children: /* @__PURE__ */ jsx34(
|
|
2959
2962
|
"a",
|
|
2960
2963
|
{
|
|
@@ -3324,6 +3327,9 @@ var SvgArrowLeft = (props) => {
|
|
|
3324
3327
|
};
|
|
3325
3328
|
var arrow_left_default = SvgArrowLeft;
|
|
3326
3329
|
|
|
3330
|
+
// src/theme/default/components/card/current-identifier-button.tsx
|
|
3331
|
+
import { useFormContext as useFormContext12 } from "react-hook-form";
|
|
3332
|
+
|
|
3327
3333
|
// src/theme/default/utils/attributes.ts
|
|
3328
3334
|
function omit(obj, keys) {
|
|
3329
3335
|
const ret = { ...obj };
|
|
@@ -3333,13 +3339,37 @@ function omit(obj, keys) {
|
|
|
3333
3339
|
return ret;
|
|
3334
3340
|
}
|
|
3335
3341
|
|
|
3342
|
+
// src/util/omitAttributes.ts
|
|
3343
|
+
function omitInputAttributes({
|
|
3344
|
+
...attrs
|
|
3345
|
+
}) {
|
|
3346
|
+
return omit(attrs, [
|
|
3347
|
+
"autocomplete",
|
|
3348
|
+
"label",
|
|
3349
|
+
"node_type",
|
|
3350
|
+
"maxlength",
|
|
3351
|
+
"onclick",
|
|
3352
|
+
"onclickTrigger",
|
|
3353
|
+
"onload",
|
|
3354
|
+
"onloadTrigger"
|
|
3355
|
+
]);
|
|
3356
|
+
}
|
|
3357
|
+
|
|
3336
3358
|
// src/theme/default/components/card/current-identifier-button.tsx
|
|
3337
|
-
import {
|
|
3359
|
+
import { useEffect as useEffect3, useState as useState4 } from "react";
|
|
3338
3360
|
import { jsx as jsx36, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3339
3361
|
function DefaultCurrentIdentifierButton() {
|
|
3362
|
+
var _a;
|
|
3340
3363
|
const { flow, flowType, config, formState } = useOryFlow4();
|
|
3341
|
-
const { setValue } = useFormContext12();
|
|
3364
|
+
const { setValue, getValues, watch } = useFormContext12();
|
|
3365
|
+
const [turnstileResponse, setTurnstileResponse] = useState4();
|
|
3342
3366
|
const ui = flow.ui;
|
|
3367
|
+
const captchaVerificationValue = (_a = watch("transient_payload")) == null ? void 0 : _a.captcha_turnstile_response;
|
|
3368
|
+
useEffect3(() => {
|
|
3369
|
+
if (captchaVerificationValue) {
|
|
3370
|
+
setTurnstileResponse(captchaVerificationValue);
|
|
3371
|
+
}
|
|
3372
|
+
}, [captchaVerificationValue]);
|
|
3343
3373
|
if (formState.current === "provide_identifier") {
|
|
3344
3374
|
return null;
|
|
3345
3375
|
}
|
|
@@ -3354,11 +3384,6 @@ function DefaultCurrentIdentifierButton() {
|
|
|
3354
3384
|
flow,
|
|
3355
3385
|
`${config.sdk.url}/self-service/${flowType}/browser`
|
|
3356
3386
|
);
|
|
3357
|
-
const attributes = omit(nodeBackButton, [
|
|
3358
|
-
"autocomplete",
|
|
3359
|
-
"node_type",
|
|
3360
|
-
"maxlength"
|
|
3361
|
-
]);
|
|
3362
3387
|
const screenSelectionNode = findScreenSelectionButton(flow.ui.nodes);
|
|
3363
3388
|
if (screenSelectionNode) {
|
|
3364
3389
|
return /* @__PURE__ */ jsxs16("form", { action: flow.ui.action, method: flow.ui.method, children: [
|
|
@@ -3369,12 +3394,16 @@ function DefaultCurrentIdentifierButton() {
|
|
|
3369
3394
|
return false;
|
|
3370
3395
|
}).map((n) => {
|
|
3371
3396
|
const attrs = n.attributes;
|
|
3397
|
+
let value = getValues(attrs.name) || attrs.value;
|
|
3398
|
+
if (attrs.name === "transient_payload.captcha_turnstile_response" && turnstileResponse) {
|
|
3399
|
+
value = turnstileResponse;
|
|
3400
|
+
}
|
|
3372
3401
|
return /* @__PURE__ */ jsx36(
|
|
3373
3402
|
"input",
|
|
3374
3403
|
{
|
|
3375
3404
|
type: "hidden",
|
|
3376
3405
|
name: attrs.name,
|
|
3377
|
-
value
|
|
3406
|
+
value
|
|
3378
3407
|
},
|
|
3379
3408
|
attrs.name
|
|
3380
3409
|
);
|
|
@@ -3383,7 +3412,7 @@ function DefaultCurrentIdentifierButton() {
|
|
|
3383
3412
|
"button",
|
|
3384
3413
|
{
|
|
3385
3414
|
className: "group inline-flex max-w-full cursor-pointer items-center gap-1 self-start rounded-identifier border px-[11px] py-[5px] transition-colors border-button-identifier-border-border-default bg-button-identifier-background-default hover:border-button-identifier-border-border-hover hover:bg-button-identifier-background-hover",
|
|
3386
|
-
...
|
|
3415
|
+
...omitInputAttributes(nodeBackButton),
|
|
3387
3416
|
type: "submit",
|
|
3388
3417
|
onClick: () => {
|
|
3389
3418
|
setValue(
|
|
@@ -3415,7 +3444,7 @@ function DefaultCurrentIdentifierButton() {
|
|
|
3415
3444
|
"a",
|
|
3416
3445
|
{
|
|
3417
3446
|
className: "group inline-flex max-w-full cursor-pointer items-center gap-1 self-start rounded-identifier border px-[11px] py-[5px] transition-colors border-button-identifier-border-border-default bg-button-identifier-background-default hover:border-button-identifier-border-border-hover hover:bg-button-identifier-background-hover",
|
|
3418
|
-
...
|
|
3447
|
+
...omitInputAttributes(nodeBackButton),
|
|
3419
3448
|
href: initFlowUrl2,
|
|
3420
3449
|
title: `Adjust ${nodeBackButton == null ? void 0 : nodeBackButton.value}`,
|
|
3421
3450
|
"data-testid": `ory/screen/${flowType}/action/restart`,
|
|
@@ -3506,11 +3535,23 @@ function DefaultCardHeader() {
|
|
|
3506
3535
|
import { useOryFlow as useOryFlow6 } from "@ory/elements-react";
|
|
3507
3536
|
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
3508
3537
|
function DefaultCardLogo() {
|
|
3538
|
+
var _a;
|
|
3509
3539
|
const flow = useOryFlow6();
|
|
3540
|
+
if (flow.config.project.logo_light_url) {
|
|
3541
|
+
return /* @__PURE__ */ jsx38(
|
|
3542
|
+
"img",
|
|
3543
|
+
{
|
|
3544
|
+
src: flow.config.project.logo_light_url,
|
|
3545
|
+
width: 100,
|
|
3546
|
+
height: 36,
|
|
3547
|
+
alt: "Logo"
|
|
3548
|
+
}
|
|
3549
|
+
);
|
|
3550
|
+
}
|
|
3510
3551
|
if (flow.config.logoUrl) {
|
|
3511
3552
|
return /* @__PURE__ */ jsx38("img", { src: flow.config.logoUrl, width: 100, height: 36, alt: "Logo" });
|
|
3512
3553
|
}
|
|
3513
|
-
return /* @__PURE__ */ jsx38("h1", { className: "text-xl font-semibold leading-normal text-interface-foreground-default-primary", children: flow.config.name });
|
|
3554
|
+
return /* @__PURE__ */ jsx38("h1", { className: "text-xl font-semibold leading-normal text-interface-foreground-default-primary", children: (_a = flow.config.project.name) != null ? _a : flow.config.name });
|
|
3514
3555
|
}
|
|
3515
3556
|
|
|
3516
3557
|
// src/theme/default/components/card/layout.tsx
|
|
@@ -3549,7 +3590,7 @@ import {
|
|
|
3549
3590
|
uiTextToFormattedMessage as uiTextToFormattedMessage2,
|
|
3550
3591
|
useOryFlow as useOryFlow7
|
|
3551
3592
|
} from "@ory/elements-react";
|
|
3552
|
-
import { useEffect as
|
|
3593
|
+
import { useEffect as useEffect4 } from "react";
|
|
3553
3594
|
import { useFormContext as useFormContext13 } from "react-hook-form";
|
|
3554
3595
|
import { useIntl as useIntl11 } from "react-intl";
|
|
3555
3596
|
import { useDebounceValue } from "usehooks-ts";
|
|
@@ -3769,24 +3810,6 @@ function Spinner({ className }) {
|
|
|
3769
3810
|
|
|
3770
3811
|
// src/theme/default/components/form/social.tsx
|
|
3771
3812
|
import { UiNodeGroupEnum as UiNodeGroupEnum16 } from "@ory/client-fetch";
|
|
3772
|
-
|
|
3773
|
-
// src/util/omitAttributes.ts
|
|
3774
|
-
function omitInputAttributes({
|
|
3775
|
-
...attrs
|
|
3776
|
-
}) {
|
|
3777
|
-
return omit(attrs, [
|
|
3778
|
-
"autocomplete",
|
|
3779
|
-
"label",
|
|
3780
|
-
"node_type",
|
|
3781
|
-
"maxlength",
|
|
3782
|
-
"onclick",
|
|
3783
|
-
"onclickTrigger",
|
|
3784
|
-
"onload",
|
|
3785
|
-
"onloadTrigger"
|
|
3786
|
-
]);
|
|
3787
|
-
}
|
|
3788
|
-
|
|
3789
|
-
// src/theme/default/components/form/social.tsx
|
|
3790
3813
|
import { Fragment as Fragment9, jsx as jsx55, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3791
3814
|
function extractProvider(context) {
|
|
3792
3815
|
if (context && typeof context === "object" && "provider" in context && typeof context.provider === "string") {
|
|
@@ -3822,7 +3845,7 @@ function DefaultButtonSocial({
|
|
|
3822
3845
|
onClick == null ? void 0 : onClick();
|
|
3823
3846
|
setClicked(true);
|
|
3824
3847
|
};
|
|
3825
|
-
|
|
3848
|
+
useEffect4(() => {
|
|
3826
3849
|
if (!isSubmitting) {
|
|
3827
3850
|
setClicked(false);
|
|
3828
3851
|
}
|
|
@@ -4063,7 +4086,7 @@ import {
|
|
|
4063
4086
|
import { cva } from "class-variance-authority";
|
|
4064
4087
|
import { useFormContext as useFormContext14 } from "react-hook-form";
|
|
4065
4088
|
import { useIntl as useIntl14 } from "react-intl";
|
|
4066
|
-
import { useEffect as
|
|
4089
|
+
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
4067
4090
|
import { jsx as jsx65, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
4068
4091
|
var buttonStyles = cva(
|
|
4069
4092
|
[
|
|
@@ -4104,14 +4127,14 @@ var DefaultButton = ({
|
|
|
4104
4127
|
}) => {
|
|
4105
4128
|
var _a;
|
|
4106
4129
|
const { type, name, value, ...rest } = attributes;
|
|
4107
|
-
const [clicked, setClicked] =
|
|
4130
|
+
const [clicked, setClicked] = useState5(false);
|
|
4108
4131
|
const intl = useIntl14();
|
|
4109
4132
|
const label = getNodeLabel(node);
|
|
4110
4133
|
const {
|
|
4111
4134
|
formState: { isSubmitting },
|
|
4112
4135
|
setValue
|
|
4113
4136
|
} = useFormContext14();
|
|
4114
|
-
|
|
4137
|
+
useEffect5(() => {
|
|
4115
4138
|
if (!isSubmitting) {
|
|
4116
4139
|
setClicked(false);
|
|
4117
4140
|
}
|
|
@@ -4327,7 +4350,7 @@ import {
|
|
|
4327
4350
|
uiTextToFormattedMessage as uiTextToFormattedMessage6,
|
|
4328
4351
|
useOryFlow as useOryFlow10
|
|
4329
4352
|
} from "@ory/elements-react";
|
|
4330
|
-
import { useRef as useRef2, useState as
|
|
4353
|
+
import { useRef as useRef2, useState as useState6 } from "react";
|
|
4331
4354
|
import { useFormContext as useFormContext16 } from "react-hook-form";
|
|
4332
4355
|
import { useIntl as useIntl17 } from "react-intl";
|
|
4333
4356
|
|
|
@@ -4386,7 +4409,7 @@ var DefaultInput = ({
|
|
|
4386
4409
|
return /* @__PURE__ */ jsx73(
|
|
4387
4410
|
"input",
|
|
4388
4411
|
{
|
|
4389
|
-
...rest,
|
|
4412
|
+
...omitInputAttributes(rest),
|
|
4390
4413
|
onClick,
|
|
4391
4414
|
maxLength: maxlength,
|
|
4392
4415
|
autoComplete: autocomplete,
|
|
@@ -4431,7 +4454,7 @@ var DefaultInput = ({
|
|
|
4431
4454
|
function PasswordToggle({
|
|
4432
4455
|
inputRef
|
|
4433
4456
|
}) {
|
|
4434
|
-
const [shown, setShown] =
|
|
4457
|
+
const [shown, setShown] = useState6(false);
|
|
4435
4458
|
const handleClick = () => {
|
|
4436
4459
|
setShown(!shown);
|
|
4437
4460
|
if (inputRef.current) {
|
|
@@ -4949,7 +4972,7 @@ var DefaultPageHeader = (_props) => {
|
|
|
4949
4972
|
};
|
|
4950
4973
|
|
|
4951
4974
|
// src/theme/default/components/settings/settings-oidc.tsx
|
|
4952
|
-
import { useEffect as
|
|
4975
|
+
import { useEffect as useEffect6 } from "react";
|
|
4953
4976
|
import { useFormContext as useFormContext19 } from "react-hook-form";
|
|
4954
4977
|
import { useDebounceValue as useDebounceValue2 } from "usehooks-ts";
|
|
4955
4978
|
|
|
@@ -5006,7 +5029,7 @@ function UnlinkRow({ button }) {
|
|
|
5006
5029
|
button.onClick();
|
|
5007
5030
|
setClicked(true);
|
|
5008
5031
|
};
|
|
5009
|
-
|
|
5032
|
+
useEffect6(() => {
|
|
5010
5033
|
if (!isSubmitting) {
|
|
5011
5034
|
setClicked(false);
|
|
5012
5035
|
}
|
|
@@ -5455,48 +5478,53 @@ function DefaultAuthMethodListContainer({
|
|
|
5455
5478
|
// src/theme/default/components/form/captcha.tsx
|
|
5456
5479
|
import { isUiNodeInputAttributes as isUiNodeInputAttributes9 } from "@ory/client-fetch";
|
|
5457
5480
|
import { Turnstile } from "@marsidev/react-turnstile";
|
|
5458
|
-
import { useRef as useRef3 } from "react";
|
|
5481
|
+
import { useEffect as useEffect7, useRef as useRef3 } from "react";
|
|
5459
5482
|
import { useFormContext as useFormContext24 } from "react-hook-form";
|
|
5460
5483
|
import { jsx as jsx98 } from "react/jsx-runtime";
|
|
5461
5484
|
var DefaultCaptcha = ({ node }) => {
|
|
5462
|
-
const { setValue } = useFormContext24();
|
|
5485
|
+
const { setValue, formState } = useFormContext24();
|
|
5463
5486
|
const ref = useRef3();
|
|
5464
|
-
const
|
|
5465
|
-
|
|
5466
|
-
if (
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5487
|
+
const prevSubmitCount = useRef3(formState.submitCount);
|
|
5488
|
+
useEffect7(() => {
|
|
5489
|
+
if (formState.submitCount > prevSubmitCount.current && formState.isSubmitSuccessful) {
|
|
5490
|
+
prevSubmitCount.current = formState.submitCount;
|
|
5491
|
+
setTimeout(() => {
|
|
5492
|
+
if (ref.current) {
|
|
5493
|
+
ref.current.reset();
|
|
5494
|
+
}
|
|
5495
|
+
}, 100);
|
|
5470
5496
|
}
|
|
5497
|
+
}, [formState.submitCount, formState.isSubmitSuccessful]);
|
|
5498
|
+
if (!isUiNodeInputAttributes9(node.attributes)) {
|
|
5499
|
+
return null;
|
|
5471
5500
|
}
|
|
5472
|
-
if (
|
|
5501
|
+
if (node.attributes.name === "transient_payload.captcha_turnstile_response") {
|
|
5502
|
+
return /* @__PURE__ */ jsx98(DefaultInput, { node, attributes: node.attributes }, 1);
|
|
5503
|
+
} else if (node.attributes.name === "captcha_turnstile_options") {
|
|
5473
5504
|
const options = JSON.parse(node.attributes.value);
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
responseFieldName: options.response_field_name
|
|
5486
|
-
},
|
|
5487
|
-
onExpire: () => {
|
|
5488
|
-
var _a;
|
|
5489
|
-
return (_a = ref.current) == null ? void 0 : _a.reset();
|
|
5490
|
-
},
|
|
5491
|
-
onSuccess: (token) => {
|
|
5492
|
-
setValue(options.response_field_name, token);
|
|
5493
|
-
}
|
|
5505
|
+
return /* @__PURE__ */ jsx98(
|
|
5506
|
+
Turnstile,
|
|
5507
|
+
{
|
|
5508
|
+
ref,
|
|
5509
|
+
siteKey: options.sitekey,
|
|
5510
|
+
options: {
|
|
5511
|
+
action: options.action,
|
|
5512
|
+
size: "flexible",
|
|
5513
|
+
theme: options.theme,
|
|
5514
|
+
responseField: false,
|
|
5515
|
+
responseFieldName: options.response_field_name
|
|
5494
5516
|
},
|
|
5495
|
-
|
|
5496
|
-
|
|
5517
|
+
onExpire: () => {
|
|
5518
|
+
var _a;
|
|
5519
|
+
return (_a = ref.current) == null ? void 0 : _a.reset();
|
|
5520
|
+
},
|
|
5521
|
+
onSuccess: (token) => {
|
|
5522
|
+
setValue(options.response_field_name, token);
|
|
5523
|
+
}
|
|
5524
|
+
}
|
|
5497
5525
|
);
|
|
5498
5526
|
}
|
|
5499
|
-
return
|
|
5527
|
+
return null;
|
|
5500
5528
|
};
|
|
5501
5529
|
|
|
5502
5530
|
// src/theme/default/assets/icons/personal.svg
|
|
@@ -5771,10 +5799,22 @@ function GoBackButton({ config }) {
|
|
|
5771
5799
|
return null;
|
|
5772
5800
|
}
|
|
5773
5801
|
function ErrorLogo({ config }) {
|
|
5802
|
+
var _a;
|
|
5803
|
+
if (config.project.logo_light_url) {
|
|
5804
|
+
return /* @__PURE__ */ jsx103(
|
|
5805
|
+
"img",
|
|
5806
|
+
{
|
|
5807
|
+
src: config.project.logo_light_url,
|
|
5808
|
+
width: 100,
|
|
5809
|
+
height: 36,
|
|
5810
|
+
alt: "Logo"
|
|
5811
|
+
}
|
|
5812
|
+
);
|
|
5813
|
+
}
|
|
5774
5814
|
if (config.logoUrl) {
|
|
5775
5815
|
return /* @__PURE__ */ jsx103("img", { src: config.logoUrl, width: 100, height: 36, alt: "Logo" });
|
|
5776
5816
|
}
|
|
5777
|
-
return /* @__PURE__ */ jsx103("h1", { className: "text-xl font-semibold leading-normal text-interface-foreground-default-primary", children: config.name });
|
|
5817
|
+
return /* @__PURE__ */ jsx103("h1", { className: "text-xl font-semibold leading-normal text-interface-foreground-default-primary", children: (_a = config.project.name) != null ? _a : config.name });
|
|
5778
5818
|
}
|
|
5779
5819
|
|
|
5780
5820
|
// src/theme/default/flows/login.tsx
|