@ory/elements-react 1.0.0-next.44 → 1.0.0-next.46
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 +23 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +73 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -42
- package/dist/index.mjs.map +1 -1
- package/dist/theme/default/index.d.mts +1 -1
- package/dist/theme/default/index.d.ts +1 -1
- package/dist/theme/default/index.js +13 -3
- package/dist/theme/default/index.js.map +1 -1
- package/dist/theme/default/index.mjs +15 -5
- package/dist/theme/default/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## 1.0.0-next.46 (2025-04-16)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- missing hidden field regression ([#439](https://github.com/ory/elements/pull/439))
|
|
6
|
+
- use correct testid ([#438](https://github.com/ory/elements/pull/438))
|
|
7
|
+
|
|
8
|
+
### ❤️ Thank You
|
|
9
|
+
|
|
10
|
+
- hackerman @aeneasr
|
|
11
|
+
|
|
12
|
+
## 1.0.0-next.45 (2025-04-15)
|
|
13
|
+
|
|
14
|
+
### 🩹 Fixes
|
|
15
|
+
|
|
16
|
+
- add missing test id to scope checkbox label ([#437](https://github.com/ory/elements/pull/437))
|
|
17
|
+
- add missing captcha group to all methods ([#432](https://github.com/ory/elements/pull/432))
|
|
18
|
+
|
|
19
|
+
### ❤️ Thank You
|
|
20
|
+
|
|
21
|
+
- hackerman @aeneasr
|
|
22
|
+
- Jonas Hungershausen
|
|
23
|
+
|
|
1
24
|
## 1.0.0-next.44 (2025-04-10)
|
|
2
25
|
|
|
3
26
|
### 🩹 Fixes
|
package/dist/index.d.mts
CHANGED
|
@@ -53,6 +53,7 @@ type OryNodeImageProps = {
|
|
|
53
53
|
type FormValues = Record<string, string | boolean | number | undefined>;
|
|
54
54
|
type OryFormRootProps = ComponentPropsWithoutRef<"form"> & {
|
|
55
55
|
onSubmit: FormEventHandler<HTMLFormElement>;
|
|
56
|
+
"data-testid"?: string;
|
|
56
57
|
};
|
|
57
58
|
type OryNodeInputProps = {
|
|
58
59
|
attributes: UiNodeInputAttributes;
|
|
@@ -374,8 +375,9 @@ type DeepPartialTwoLevels<T> = {
|
|
|
374
375
|
type OryFlowComponentOverrides = DeepPartialTwoLevels<OryFlowComponents>;
|
|
375
376
|
type OryFormProps = PropsWithChildren<{
|
|
376
377
|
onAfterSubmit?: (method: string | number | boolean | undefined) => void;
|
|
378
|
+
"data-testid"?: string;
|
|
377
379
|
}>;
|
|
378
|
-
declare function OryForm({ children, onAfterSubmit }: OryFormProps): react_jsx_runtime.JSX.Element;
|
|
380
|
+
declare function OryForm({ children, onAfterSubmit, "data-testid": dataTestId, }: OryFormProps): react_jsx_runtime.JSX.Element;
|
|
379
381
|
|
|
380
382
|
declare function useComponents(): OryFlowComponents;
|
|
381
383
|
declare function useNodeSorter(): (a: UiNode, b: UiNode, ctx: {
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ type OryNodeImageProps = {
|
|
|
53
53
|
type FormValues = Record<string, string | boolean | number | undefined>;
|
|
54
54
|
type OryFormRootProps = ComponentPropsWithoutRef<"form"> & {
|
|
55
55
|
onSubmit: FormEventHandler<HTMLFormElement>;
|
|
56
|
+
"data-testid"?: string;
|
|
56
57
|
};
|
|
57
58
|
type OryNodeInputProps = {
|
|
58
59
|
attributes: UiNodeInputAttributes;
|
|
@@ -374,8 +375,9 @@ type DeepPartialTwoLevels<T> = {
|
|
|
374
375
|
type OryFlowComponentOverrides = DeepPartialTwoLevels<OryFlowComponents>;
|
|
375
376
|
type OryFormProps = PropsWithChildren<{
|
|
376
377
|
onAfterSubmit?: (method: string | number | boolean | undefined) => void;
|
|
378
|
+
"data-testid"?: string;
|
|
377
379
|
}>;
|
|
378
|
-
declare function OryForm({ children, onAfterSubmit }: OryFormProps): react_jsx_runtime.JSX.Element;
|
|
380
|
+
declare function OryForm({ children, onAfterSubmit, "data-testid": dataTestId, }: OryFormProps): react_jsx_runtime.JSX.Element;
|
|
379
381
|
|
|
380
382
|
declare function useComponents(): OryFlowComponents;
|
|
381
383
|
declare function useNodeSorter(): (a: UiNode, b: UiNode, ctx: {
|
package/dist/index.js
CHANGED
|
@@ -192,21 +192,29 @@ function nodesToAuthMethodGroups(nodes, excludeAuthMethods = []) {
|
|
|
192
192
|
function useNodesGroups(nodes, { omit } = {}) {
|
|
193
193
|
const groupSorter = useGroupSorter();
|
|
194
194
|
const groups = react.useMemo(() => {
|
|
195
|
-
var _a;
|
|
195
|
+
var _a, _b;
|
|
196
196
|
const groups2 = {};
|
|
197
|
+
const groupRetained = {};
|
|
197
198
|
for (const node of nodes) {
|
|
199
|
+
const groupNodes = (_a = groups2[node.group]) != null ? _a : [];
|
|
200
|
+
groupNodes.push(node);
|
|
201
|
+
groups2[node.group] = groupNodes;
|
|
198
202
|
if ((omit == null ? void 0 : omit.includes("script")) && clientFetch.isUiNodeScriptAttributes(node.attributes)) {
|
|
199
203
|
continue;
|
|
200
204
|
}
|
|
201
205
|
if ((omit == null ? void 0 : omit.includes("input_hidden")) && clientFetch.isUiNodeInputAttributes(node.attributes) && node.attributes.type === "hidden") {
|
|
202
206
|
continue;
|
|
203
207
|
}
|
|
204
|
-
|
|
205
|
-
groupNodes.push(node);
|
|
206
|
-
groups2[node.group] = groupNodes;
|
|
208
|
+
groupRetained[node.group] = ((_b = groupRetained[node.group]) != null ? _b : 0) + 1;
|
|
207
209
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
+
const finalGroups = {};
|
|
211
|
+
for (const [group, count] of Object.entries(groupRetained)) {
|
|
212
|
+
if (count > 0) {
|
|
213
|
+
finalGroups[group] = groups2[group];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return finalGroups;
|
|
217
|
+
}, [nodes, omit]);
|
|
210
218
|
const entries = react.useMemo(
|
|
211
219
|
() => Object.entries(groups).sort(([a], [b]) => groupSorter(a, b)),
|
|
212
220
|
[groups, groupSorter]
|
|
@@ -873,7 +881,11 @@ function useOryFormSubmit(onAfterSubmit) {
|
|
|
873
881
|
};
|
|
874
882
|
return onSubmit;
|
|
875
883
|
}
|
|
876
|
-
function OryForm({
|
|
884
|
+
function OryForm({
|
|
885
|
+
children,
|
|
886
|
+
onAfterSubmit,
|
|
887
|
+
"data-testid": dataTestId
|
|
888
|
+
}) {
|
|
877
889
|
const { Form } = useComponents();
|
|
878
890
|
const flowContainer = useOryFlow();
|
|
879
891
|
const methods = reactHookForm.useFormContext();
|
|
@@ -901,7 +913,7 @@ function OryForm({ children, onAfterSubmit }) {
|
|
|
901
913
|
}),
|
|
902
914
|
type: "error"
|
|
903
915
|
};
|
|
904
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
916
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-8", "data-testid": dataTestId, children: [
|
|
905
917
|
/* @__PURE__ */ jsxRuntime.jsx(Message.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(Message.Content, { message: m }, m.id) }),
|
|
906
918
|
/* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
|
|
907
919
|
] });
|
|
@@ -912,6 +924,7 @@ function OryForm({ children, onAfterSubmit }) {
|
|
|
912
924
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
913
925
|
Form.Root,
|
|
914
926
|
{
|
|
927
|
+
"data-testid": dataTestId,
|
|
915
928
|
action: flowContainer.flow.ui.action,
|
|
916
929
|
method: flowContainer.flow.ui.method,
|
|
917
930
|
onSubmit: (e) => void methods.handleSubmit(onSubmit)(e),
|
|
@@ -1132,7 +1145,7 @@ function OryFormSocialButtonsForm() {
|
|
|
1132
1145
|
if (filteredNodes.length === 0) {
|
|
1133
1146
|
return null;
|
|
1134
1147
|
}
|
|
1135
|
-
return /* @__PURE__ */ jsxRuntime.jsx(OryFormProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(OryForm, { children: /* @__PURE__ */ jsxRuntime.jsx(OryFormOidcButtons, {}) }) });
|
|
1148
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OryFormProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(OryForm, { "data-testid": `ory/form/methods/oidc-saml`, children: /* @__PURE__ */ jsxRuntime.jsx(OryFormOidcButtons, {}) }) });
|
|
1136
1149
|
}
|
|
1137
1150
|
function isUINodeGroupEnum(method) {
|
|
1138
1151
|
return Object.values(clientFetch.UiNodeGroupEnum).includes(method);
|
|
@@ -1148,7 +1161,7 @@ function OryTwoStepCard() {
|
|
|
1148
1161
|
// We only want to render groups that have visible elements.
|
|
1149
1162
|
omit: ["script", "input_hidden"]
|
|
1150
1163
|
});
|
|
1151
|
-
const
|
|
1164
|
+
const authMethodBlocks = Object.fromEntries(
|
|
1152
1165
|
Object.values(clientFetch.UiNodeGroupEnum).filter((group) => {
|
|
1153
1166
|
var _a2;
|
|
1154
1167
|
return (_a2 = groupsToShow.groups[group]) == null ? void 0 : _a2.length;
|
|
@@ -1163,7 +1176,17 @@ function OryTwoStepCard() {
|
|
|
1163
1176
|
].includes(group)
|
|
1164
1177
|
).map((g) => [g, {}])
|
|
1165
1178
|
);
|
|
1166
|
-
|
|
1179
|
+
const authMethodAdditionalNodes = ui.nodes.filter(
|
|
1180
|
+
({ group }) => [
|
|
1181
|
+
clientFetch.UiNodeGroupEnum.Oidc,
|
|
1182
|
+
clientFetch.UiNodeGroupEnum.Saml,
|
|
1183
|
+
clientFetch.UiNodeGroupEnum.Default,
|
|
1184
|
+
clientFetch.UiNodeGroupEnum.IdentifierFirst,
|
|
1185
|
+
clientFetch.UiNodeGroupEnum.Profile,
|
|
1186
|
+
clientFetch.UiNodeGroupEnum.Captcha
|
|
1187
|
+
].includes(group)
|
|
1188
|
+
);
|
|
1189
|
+
if (clientFetch.UiNodeGroupEnum.Code in authMethodBlocks) {
|
|
1167
1190
|
let identifier = (_b = (_a = findNode(ui.nodes, {
|
|
1168
1191
|
group: "identifier_first",
|
|
1169
1192
|
node_type: "input",
|
|
@@ -1175,7 +1198,7 @@ function OryTwoStepCard() {
|
|
|
1175
1198
|
name: "address"
|
|
1176
1199
|
})) == null ? void 0 : _c.attributes) == null ? void 0 : _d.value);
|
|
1177
1200
|
if (identifier) {
|
|
1178
|
-
|
|
1201
|
+
authMethodBlocks[clientFetch.UiNodeGroupEnum.Code] = {
|
|
1179
1202
|
title: {
|
|
1180
1203
|
id: "identities.messages.1010023",
|
|
1181
1204
|
values: { address: identifier }
|
|
@@ -1200,47 +1223,55 @@ function OryTwoStepCard() {
|
|
|
1200
1223
|
(node) => node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml
|
|
1201
1224
|
);
|
|
1202
1225
|
const showSso = !(formState.current === "method_active" && !(formState.method === clientFetch.UiNodeGroupEnum.Oidc || formState.method === clientFetch.UiNodeGroupEnum.Saml));
|
|
1203
|
-
const showSsoDivider = hasSso && nonSsoNodes.
|
|
1226
|
+
const showSsoDivider = hasSso && nonSsoNodes.some((n) => {
|
|
1204
1227
|
if (clientFetch.isUiNodeInputAttributes(n.attributes)) {
|
|
1205
1228
|
return n.attributes.type !== clientFetch.UiNodeInputAttributesTypeEnum.Hidden;
|
|
1206
1229
|
} else if (clientFetch.isUiNodeScriptAttributes(n.attributes)) {
|
|
1207
1230
|
return false;
|
|
1208
1231
|
}
|
|
1209
1232
|
return true;
|
|
1210
|
-
})
|
|
1211
|
-
const captchaNodes = ui.nodes.filter(
|
|
1212
|
-
(n) => n.group === clientFetch.UiNodeGroupEnum.Captcha
|
|
1213
|
-
);
|
|
1233
|
+
});
|
|
1214
1234
|
return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
|
|
1215
1235
|
/* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
|
|
1216
1236
|
/* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
|
|
1217
1237
|
/* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
|
|
1218
1238
|
showSso && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
|
|
1219
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1239
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1240
|
+
OryForm,
|
|
1241
|
+
{
|
|
1242
|
+
"data-testid": `ory/form/methods/local`,
|
|
1243
|
+
onAfterSubmit: handleAfterFormSubmit,
|
|
1244
|
+
children: [
|
|
1245
|
+
formState.current === "provide_identifier" && /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
|
|
1246
|
+
showSsoDivider && /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
|
|
1247
|
+
nonSsoNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
|
|
1248
|
+
] }),
|
|
1249
|
+
formState.current === "select_method" && /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
|
|
1250
|
+
Object.entries(authMethodBlocks).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1251
|
+
/* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
|
|
1252
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1253
|
+
AuthMethodList,
|
|
1254
|
+
{
|
|
1255
|
+
options: authMethodBlocks,
|
|
1256
|
+
setSelectedGroup: (group) => dispatchFormState({
|
|
1257
|
+
type: "action_select_method",
|
|
1258
|
+
method: group
|
|
1259
|
+
})
|
|
1260
|
+
}
|
|
1261
|
+
)
|
|
1262
|
+
] }),
|
|
1263
|
+
authMethodAdditionalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
|
|
1264
|
+
] }),
|
|
1265
|
+
formState.current === "method_active" && /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
|
|
1266
|
+
ui.nodes.filter(
|
|
1267
|
+
(n) => clientFetch.isUiNodeScriptAttributes(n.attributes) || n.group === clientFetch.UiNodeGroupEnum.Captcha || n.group === clientFetch.UiNodeGroupEnum.Default || n.group === clientFetch.UiNodeGroupEnum.Profile
|
|
1268
|
+
).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)),
|
|
1269
|
+
finalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
|
|
1270
|
+
] }),
|
|
1271
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
|
|
1272
|
+
]
|
|
1273
|
+
}
|
|
1274
|
+
)
|
|
1244
1275
|
] })
|
|
1245
1276
|
] });
|
|
1246
1277
|
}
|