@ory/elements-react 0.0.0-pr.c124ca4 → 0.0.0-pr.c7aa6707

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/dist/index.js CHANGED
@@ -50,13 +50,18 @@ var defaultNodeOrder = [
50
50
  ];
51
51
  function defaultNodeSorter(a, b) {
52
52
  var _a, _b;
53
+ const aIsCaptcha = a.group === "captcha";
54
+ const bIsCaptcha = b.group === "captcha";
55
+ const aIsSubmit = clientFetch.isUiNodeInputAttributes(a.attributes) && a.attributes.type === "submit";
56
+ const bIsSubmit = clientFetch.isUiNodeInputAttributes(b.attributes) && b.attributes.type === "submit";
57
+ if (aIsCaptcha && bIsSubmit) {
58
+ return -1;
59
+ }
60
+ if (bIsCaptcha && aIsSubmit) {
61
+ return 1;
62
+ }
53
63
  const aGroupWeight = (_a = defaultNodeOrder.indexOf(a.group)) != null ? _a : 999;
54
64
  const bGroupWeight = (_b = defaultNodeOrder.indexOf(b.group)) != null ? _b : 999;
55
- if (b.group === "captcha" && clientFetch.isUiNodeInputAttributes(a.attributes) && a.attributes.type === "submit") {
56
- return aGroupWeight - (bGroupWeight - 2);
57
- } else if (a.group === "captcha" && clientFetch.isUiNodeInputAttributes(b.attributes) && b.attributes.type === "submit") {
58
- return aGroupWeight - 2 - bGroupWeight;
59
- }
60
65
  return aGroupWeight - bGroupWeight;
61
66
  }
62
67
  var defaultGroupOrder = [
@@ -94,28 +99,10 @@ function OryComponentProvider({
94
99
  }
95
100
  );
96
101
  }
97
- function isChoosingMethod(flow) {
98
- return flow.flow.ui.nodes.some(
99
- (node) => "name" in node.attributes && node.attributes.name === "screen" && "value" in node.attributes && node.attributes.value === "previous"
100
- ) || flow.flow.ui.nodes.some(
101
- (node) => node.group === clientFetch.UiNodeGroupEnum.IdentifierFirst && "name" in node.attributes && node.attributes.name === "identifier" && node.attributes.type === "hidden"
102
- ) || flow.flowType === clientFetch.FlowType.Login && flow.flow.requested_aal === "aal2";
103
- }
104
- function removeSsoNodes(nodes) {
105
- return nodes.filter(
106
- (node) => !(node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml)
107
- );
108
- }
109
- function getFinalNodes(uniqueGroups, selectedGroup) {
110
- var _a, _b, _c, _d;
111
- const selectedNodes = selectedGroup ? (_a = uniqueGroups[selectedGroup]) != null ? _a : [] : [];
112
- return [
113
- ...(_b = uniqueGroups == null ? void 0 : uniqueGroups.identifier_first) != null ? _b : [],
114
- ...(_c = uniqueGroups == null ? void 0 : uniqueGroups.default) != null ? _c : [],
115
- ...(_d = uniqueGroups == null ? void 0 : uniqueGroups.captcha) != null ? _d : []
116
- ].flat().filter(
117
- (node) => "type" in node.attributes && node.attributes.type === "hidden"
118
- ).concat(selectedNodes);
102
+
103
+ // src/theme/default/utils/form.ts
104
+ function isGroupImmediateSubmit(group) {
105
+ return group === "code";
119
106
  }
120
107
  function triggerToWindowCall(trigger) {
121
108
  if (!trigger) {
@@ -227,6 +214,93 @@ function useNodesGroups(nodes, { omit } = {}) {
227
214
  var findNode = (nodes, opt) => nodes.find((n) => {
228
215
  return n.attributes.node_type === opt.node_type && (opt.group instanceof RegExp ? n.group.match(opt.group) : n.group === opt.group) && (opt.name && n.attributes.node_type === "input" ? opt.name instanceof RegExp ? n.attributes.name.match(opt.name) : n.attributes.name === opt.name : !opt.name);
229
216
  });
217
+ function useFunctionalNodes(nodes) {
218
+ return nodes.filter(
219
+ ({ group }) => [
220
+ clientFetch.UiNodeGroupEnum.Default,
221
+ clientFetch.UiNodeGroupEnum.IdentifierFirst,
222
+ clientFetch.UiNodeGroupEnum.Profile,
223
+ clientFetch.UiNodeGroupEnum.Captcha
224
+ ].includes(group)
225
+ );
226
+ }
227
+ function isUiNodeGroupEnum(method) {
228
+ return Object.values(clientFetch.UiNodeGroupEnum).includes(method);
229
+ }
230
+ function isSingleSignOnNode(node) {
231
+ return node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml;
232
+ }
233
+ function hasSingleSignOnNodes(nodes) {
234
+ return nodes.some(isSingleSignOnNode);
235
+ }
236
+ function withoutSingleSignOnNodes(nodes) {
237
+ return nodes.filter((node) => !isSingleSignOnNode(node));
238
+ }
239
+ function isNodeVisible(node) {
240
+ if (clientFetch.isUiNodeScriptAttributes(node.attributes)) {
241
+ return false;
242
+ } else if (clientFetch.isUiNodeInputAttributes(node.attributes)) {
243
+ if (node.attributes.type === "hidden") {
244
+ return false;
245
+ }
246
+ }
247
+ return true;
248
+ }
249
+ function useNodeGroupsWithVisibleNodes(nodes) {
250
+ return react.useMemo(() => {
251
+ var _a, _b;
252
+ const groups = {};
253
+ const groupRetained = {};
254
+ for (const node of nodes) {
255
+ const groupNodes = (_a = groups[node.group]) != null ? _a : [];
256
+ const groupCount = (_b = groupRetained[node.group]) != null ? _b : 0;
257
+ groupNodes.push(node);
258
+ groups[node.group] = groupNodes;
259
+ if (!isNodeVisible(node)) {
260
+ continue;
261
+ }
262
+ groupRetained[node.group] = groupCount + 1;
263
+ }
264
+ const finalGroups = {};
265
+ for (const [group, count] of Object.entries(groupRetained)) {
266
+ if (count > 0) {
267
+ finalGroups[group] = groups[group];
268
+ }
269
+ }
270
+ return finalGroups;
271
+ }, [nodes]);
272
+ }
273
+
274
+ // src/components/card/two-step/utils.ts
275
+ function isChoosingMethod(flow) {
276
+ return flow.flow.ui.nodes.some(
277
+ (node) => "name" in node.attributes && node.attributes.name === "screen" && "value" in node.attributes && node.attributes.value === "previous"
278
+ ) || flow.flow.ui.nodes.some(
279
+ (node) => node.group === clientFetch.UiNodeGroupEnum.IdentifierFirst && "name" in node.attributes && node.attributes.name === "identifier" && node.attributes.type === "hidden"
280
+ ) || flow.flowType === clientFetch.FlowType.Login && flow.flow.requested_aal === "aal2";
281
+ }
282
+ function getFinalNodes(uniqueGroups, selectedGroup) {
283
+ var _a, _b, _c, _d;
284
+ const selectedNodes = selectedGroup ? (_a = uniqueGroups[selectedGroup]) != null ? _a : [] : [];
285
+ return [
286
+ ...(_b = uniqueGroups == null ? void 0 : uniqueGroups.identifier_first) != null ? _b : [],
287
+ ...(_c = uniqueGroups == null ? void 0 : uniqueGroups.default) != null ? _c : [],
288
+ ...(_d = uniqueGroups == null ? void 0 : uniqueGroups.captcha) != null ? _d : []
289
+ ].flat().filter(
290
+ (node) => "type" in node.attributes && node.attributes.type === "hidden"
291
+ ).concat(selectedNodes);
292
+ }
293
+ var handleAfterFormSubmit = (dispatchFormState) => (method) => {
294
+ if (typeof method !== "string" || !isUiNodeGroupEnum(method)) {
295
+ return;
296
+ }
297
+ if (isGroupImmediateSubmit(method)) {
298
+ dispatchFormState({
299
+ type: "action_select_method",
300
+ method
301
+ });
302
+ }
303
+ };
230
304
 
231
305
  // src/context/form-state.ts
232
306
  function findMethodWithMessage(nodes) {
@@ -492,15 +566,11 @@ function OryCardContent({ children }) {
492
566
  const { Card } = useComponents();
493
567
  return /* @__PURE__ */ jsxRuntime.jsx(Card.Content, { children });
494
568
  }
495
-
496
- // src/theme/default/utils/form.ts
497
- function isGroupImmediateSubmit(group) {
498
- return group === "code";
499
- }
500
569
  function frontendClient(sdkUrl, opts = {}) {
501
570
  const config = new clientFetch.Configuration({
502
571
  ...opts,
503
572
  basePath: sdkUrl,
573
+ credentials: "include",
504
574
  headers: {
505
575
  Accept: "application/json",
506
576
  ...opts.headers
@@ -918,7 +988,7 @@ function OryForm({
918
988
  };
919
989
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": dataTestId, children: /* @__PURE__ */ jsxRuntime.jsx(Message.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(Message.Content, { message: m }, m.id) }) });
920
990
  }
921
- if (flowContainer.flowType === clientFetch.FlowType.Login && flowContainer.formState.current === "method_active" && flowContainer.formState.method === "code") {
991
+ if ((flowContainer.flowType === clientFetch.FlowType.Login || flowContainer.flowType === clientFetch.FlowType.Registration) && flowContainer.formState.current === "method_active" && flowContainer.formState.method === "code") {
922
992
  methods.setValue("method", "code");
923
993
  }
924
994
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -1116,7 +1186,7 @@ function OryFormOidcButtons() {
1116
1186
  if (filteredNodes.length === 0) {
1117
1187
  return null;
1118
1188
  }
1119
- return /* @__PURE__ */ jsxRuntime.jsx(Form.OidcRoot, { nodes: filteredNodes, children: filteredNodes.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(
1189
+ return /* @__PURE__ */ jsxRuntime.jsx(Form.OidcRoot, { nodes: filteredNodes, children: filteredNodes.map((node) => /* @__PURE__ */ jsxRuntime.jsx(
1120
1190
  Node2.OidcButton,
1121
1191
  {
1122
1192
  node,
@@ -1129,7 +1199,7 @@ function OryFormOidcButtons() {
1129
1199
  setValue("method", node.group);
1130
1200
  }
1131
1201
  },
1132
- k
1202
+ clientFetch.getNodeId(node)
1133
1203
  )) });
1134
1204
  }
1135
1205
  function OryFormSocialButtonsForm() {
@@ -1144,25 +1214,104 @@ function OryFormSocialButtonsForm() {
1144
1214
  }
1145
1215
  return /* @__PURE__ */ jsxRuntime.jsx(OryFormProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(OryForm, { "data-testid": `ory/form/methods/oidc-saml`, children: /* @__PURE__ */ jsxRuntime.jsx(OryFormOidcButtons, {}) }) });
1146
1216
  }
1147
- function isUINodeGroupEnum(method) {
1148
- return Object.values(clientFetch.UiNodeGroupEnum).includes(method);
1149
- }
1150
- function OryTwoStepCard() {
1151
- var _a, _b, _c, _d;
1152
- const { Form, Card, Message } = useComponents();
1153
- const { flow, flowType, formState, dispatchFormState } = useOryFlow();
1217
+ function OryTwoStepCardStateMethodActive({
1218
+ formState
1219
+ }) {
1220
+ const { Form } = useComponents();
1221
+ const { flow, flowType, dispatchFormState } = useOryFlow();
1154
1222
  const { ui } = flow;
1155
- const intl = reactIntl.useIntl();
1156
1223
  const nodeSorter = useNodeSorter();
1157
1224
  const sortNodes = (a, b) => nodeSorter(a, b, { flowType });
1158
- const groupsToShow = useNodesGroups(ui.nodes, {
1159
- // We only want to render groups that have visible elements.
1160
- omit: ["script", "input_hidden"]
1161
- });
1162
- const authMethodBlocks = Object.fromEntries(
1225
+ const groupsToShow = useNodeGroupsWithVisibleNodes(ui.nodes);
1226
+ const finalNodes = getFinalNodes(groupsToShow, formState.method);
1227
+ const selectedMethodIsSocial = formState.method === clientFetch.UiNodeGroupEnum.Oidc || formState.method === clientFetch.UiNodeGroupEnum.Saml;
1228
+ return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
1229
+ /* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
1230
+ /* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
1231
+ /* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
1232
+ selectedMethodIsSocial && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
1233
+ /* @__PURE__ */ jsxRuntime.jsx(
1234
+ OryForm,
1235
+ {
1236
+ "data-testid": `ory/form/methods/local`,
1237
+ onAfterSubmit: handleAfterFormSubmit(dispatchFormState),
1238
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
1239
+ ui.nodes.filter(
1240
+ (n) => clientFetch.isUiNodeScriptAttributes(n.attributes) || n.group === clientFetch.UiNodeGroupEnum.Default || n.group === clientFetch.UiNodeGroupEnum.Profile
1241
+ ).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)),
1242
+ finalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1243
+ ] })
1244
+ }
1245
+ )
1246
+ ] }),
1247
+ /* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
1248
+ ] });
1249
+ }
1250
+ function OryTwoStepCardStateProvideIdentifier() {
1251
+ const { Form, Card } = useComponents();
1252
+ const { flowType, flow, dispatchFormState } = useOryFlow();
1253
+ const nodeSorter = useNodeSorter();
1254
+ const sortNodes = (a, b) => nodeSorter(a, b, { flowType });
1255
+ const nonSsoNodes = withoutSingleSignOnNodes(flow.ui.nodes).sort(sortNodes);
1256
+ const hasSso = flow.ui.nodes.filter(isNodeVisible).some(
1257
+ (node) => node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml
1258
+ );
1259
+ const showSsoDivider = hasSso && nonSsoNodes.some(isNodeVisible);
1260
+ return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
1261
+ /* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
1262
+ /* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
1263
+ /* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
1264
+ /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
1265
+ /* @__PURE__ */ jsxRuntime.jsx(
1266
+ OryForm,
1267
+ {
1268
+ "data-testid": `ory/form/methods/local`,
1269
+ onAfterSubmit: handleAfterFormSubmit(dispatchFormState),
1270
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
1271
+ showSsoDivider && /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
1272
+ nonSsoNodes.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1273
+ ] })
1274
+ }
1275
+ )
1276
+ ] }),
1277
+ /* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
1278
+ ] });
1279
+ }
1280
+ function AuthMethodList({
1281
+ options,
1282
+ setSelectedGroup
1283
+ }) {
1284
+ const { Card } = useComponents();
1285
+ const { setValue, getValues } = reactHookForm.useFormContext();
1286
+ if (Object.entries(options).length === 0) {
1287
+ return null;
1288
+ }
1289
+ const handleClick = (group, options2) => {
1290
+ var _a, _b, _c, _d;
1291
+ if (isGroupImmediateSubmit(group)) {
1292
+ if (group === "code" && !getValues("identifier") && ((_b = (_a = options2 == null ? void 0 : options2.title) == null ? void 0 : _a.values) == null ? void 0 : _b.address)) {
1293
+ setValue("identifier", (_d = (_c = options2 == null ? void 0 : options2.title) == null ? void 0 : _c.values) == null ? void 0 : _d.address);
1294
+ }
1295
+ setValue("method", group);
1296
+ } else {
1297
+ setSelectedGroup(group);
1298
+ }
1299
+ };
1300
+ return /* @__PURE__ */ jsxRuntime.jsx(Card.AuthMethodListContainer, { children: Object.entries(options).map(([group, options2]) => /* @__PURE__ */ jsxRuntime.jsx(
1301
+ Card.AuthMethodListItem,
1302
+ {
1303
+ group,
1304
+ title: options2.title,
1305
+ onClick: () => handleClick(group, options2)
1306
+ },
1307
+ group
1308
+ )) });
1309
+ }
1310
+ function toAuthMethodPickerOptions(visibleGroups) {
1311
+ return Object.fromEntries(
1163
1312
  Object.values(clientFetch.UiNodeGroupEnum).filter((group) => {
1164
- var _a2;
1165
- return (_a2 = groupsToShow.groups[group]) == null ? void 0 : _a2.length;
1313
+ var _a;
1314
+ return (_a = visibleGroups[group]) == null ? void 0 : _a.length;
1166
1315
  }).filter(
1167
1316
  (group) => ![
1168
1317
  clientFetch.UiNodeGroupEnum.Oidc,
@@ -1174,16 +1323,18 @@ function OryTwoStepCard() {
1174
1323
  ].includes(group)
1175
1324
  ).map((g) => [g, {}])
1176
1325
  );
1177
- const authMethodAdditionalNodes = ui.nodes.filter(
1178
- ({ group }) => [
1179
- clientFetch.UiNodeGroupEnum.Oidc,
1180
- clientFetch.UiNodeGroupEnum.Saml,
1181
- clientFetch.UiNodeGroupEnum.Default,
1182
- clientFetch.UiNodeGroupEnum.IdentifierFirst,
1183
- clientFetch.UiNodeGroupEnum.Profile,
1184
- clientFetch.UiNodeGroupEnum.Captcha
1185
- ].includes(group)
1186
- );
1326
+ }
1327
+ function OryTwoStepCardStateSelectMethod() {
1328
+ var _a, _b, _c, _d;
1329
+ const { Form, Card, Message } = useComponents();
1330
+ const { flow, flowType, dispatchFormState } = useOryFlow();
1331
+ const { ui } = flow;
1332
+ const intl = reactIntl.useIntl();
1333
+ const nodeSorter = useNodeSorter();
1334
+ const sortNodes = (a, b) => nodeSorter(a, b, { flowType });
1335
+ const visibleGroups = useNodeGroupsWithVisibleNodes(ui.nodes);
1336
+ const authMethodBlocks = toAuthMethodPickerOptions(visibleGroups);
1337
+ const authMethodAdditionalNodes = useFunctionalNodes(ui.nodes);
1187
1338
  if (clientFetch.UiNodeGroupEnum.Code in authMethodBlocks) {
1188
1339
  let identifier = (_b = (_a = findNode(ui.nodes, {
1189
1340
  group: "identifier_first",
@@ -1204,145 +1355,59 @@ function OryTwoStepCard() {
1204
1355
  };
1205
1356
  }
1206
1357
  }
1207
- const nonSsoNodes = removeSsoNodes(ui.nodes);
1208
- const finalNodes = formState.current === "method_active" ? getFinalNodes(groupsToShow.groups, formState.method) : [];
1209
- const handleAfterFormSubmit = (method) => {
1210
- if (typeof method !== "string" || !isUINodeGroupEnum(method)) {
1211
- return;
1212
- }
1213
- if (isGroupImmediateSubmit(method)) {
1214
- dispatchFormState({
1215
- type: "action_select_method",
1216
- method
1217
- });
1218
- }
1219
- };
1220
- const hasSso = ui.nodes.some(
1221
- (node) => node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml
1222
- );
1223
- const showSso = !(formState.current === "method_active" && !(formState.method === clientFetch.UiNodeGroupEnum.Oidc || formState.method === clientFetch.UiNodeGroupEnum.Saml));
1224
- const showSsoDivider = hasSso && nonSsoNodes.some((n) => {
1225
- if (clientFetch.isUiNodeInputAttributes(n.attributes)) {
1226
- return n.attributes.type !== clientFetch.UiNodeInputAttributesTypeEnum.Hidden;
1227
- } else if (clientFetch.isUiNodeScriptAttributes(n.attributes)) {
1228
- return false;
1229
- }
1230
- return true;
1231
- });
1232
1358
  const noMethods = {
1233
1359
  id: 5000002,
1234
1360
  text: intl.formatMessage({
1235
- id: `identities.messages.${5000002}`,
1361
+ id: `identities.messages.5000002`,
1236
1362
  defaultMessage: "No authentication methods are available for this request. Please contact the site or app owner."
1237
1363
  }),
1238
1364
  type: "error"
1239
1365
  };
1366
+ return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
1367
+ /* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
1368
+ /* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
1369
+ /* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
1370
+ /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
1371
+ Object.entries(authMethodBlocks).length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
1372
+ OryForm,
1373
+ {
1374
+ "data-testid": `ory/form/methods/local`,
1375
+ onAfterSubmit: handleAfterFormSubmit(dispatchFormState),
1376
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
1377
+ /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
1378
+ /* @__PURE__ */ jsxRuntime.jsx(
1379
+ AuthMethodList,
1380
+ {
1381
+ options: authMethodBlocks,
1382
+ setSelectedGroup: (group) => dispatchFormState({
1383
+ type: "action_select_method",
1384
+ method: group
1385
+ })
1386
+ }
1387
+ ),
1388
+ authMethodAdditionalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1389
+ ] })
1390
+ }
1391
+ ) : !hasSingleSignOnNodes(ui.nodes) && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": `ory/form/methods/local`, children: /* @__PURE__ */ jsxRuntime.jsx(Message.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(Message.Content, { message: noMethods }, noMethods.id) }) })
1392
+ ] }),
1393
+ /* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
1394
+ ] });
1395
+ }
1396
+ function OryTwoStepCard() {
1397
+ const { formState } = useOryFlow();
1240
1398
  switch (formState.current) {
1241
1399
  case "provide_identifier":
1242
- return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
1243
- /* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
1244
- /* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
1245
- /* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
1246
- showSso && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
1247
- /* @__PURE__ */ jsxRuntime.jsx(
1248
- OryForm,
1249
- {
1250
- "data-testid": `ory/form/methods/local`,
1251
- onAfterSubmit: handleAfterFormSubmit,
1252
- children: /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
1253
- showSsoDivider && /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
1254
- nonSsoNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1255
- ] })
1256
- }
1257
- )
1258
- ] }),
1259
- /* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
1260
- ] });
1400
+ return /* @__PURE__ */ jsxRuntime.jsx(OryTwoStepCardStateProvideIdentifier, {});
1261
1401
  case "select_method":
1262
- return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
1263
- /* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
1264
- /* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
1265
- /* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
1266
- showSso && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
1267
- Object.entries(authMethodBlocks).length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
1268
- OryForm,
1269
- {
1270
- "data-testid": `ory/form/methods/local`,
1271
- onAfterSubmit: handleAfterFormSubmit,
1272
- children: /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
1273
- /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
1274
- /* @__PURE__ */ jsxRuntime.jsx(
1275
- AuthMethodList,
1276
- {
1277
- options: authMethodBlocks,
1278
- setSelectedGroup: (group) => dispatchFormState({
1279
- type: "action_select_method",
1280
- method: group
1281
- })
1282
- }
1283
- ),
1284
- authMethodAdditionalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1285
- ] })
1286
- }
1287
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": `ory/form/methods/local`, children: /* @__PURE__ */ jsxRuntime.jsx(Message.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(Message.Content, { message: noMethods }, noMethods.id) }) })
1288
- ] }),
1289
- /* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
1290
- ] });
1402
+ return /* @__PURE__ */ jsxRuntime.jsx(OryTwoStepCardStateSelectMethod, {});
1291
1403
  case "method_active":
1292
- return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
1293
- /* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
1294
- /* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
1295
- /* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
1296
- showSso && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
1297
- /* @__PURE__ */ jsxRuntime.jsx(
1298
- OryForm,
1299
- {
1300
- "data-testid": `ory/form/methods/local`,
1301
- onAfterSubmit: handleAfterFormSubmit,
1302
- children: /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
1303
- ui.nodes.filter(
1304
- (n) => clientFetch.isUiNodeScriptAttributes(n.attributes) || n.group === clientFetch.UiNodeGroupEnum.Captcha || n.group === clientFetch.UiNodeGroupEnum.Default || n.group === clientFetch.UiNodeGroupEnum.Profile
1305
- ).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)),
1306
- finalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1307
- ] })
1308
- }
1309
- )
1310
- ] }),
1311
- /* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
1312
- ] });
1404
+ return /* @__PURE__ */ jsxRuntime.jsx(OryTwoStepCardStateMethodActive, { formState });
1313
1405
  }
1314
1406
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1315
1407
  "unknown form state: ",
1316
1408
  formState.current
1317
1409
  ] });
1318
1410
  }
1319
- function AuthMethodList({ options, setSelectedGroup }) {
1320
- const { Card } = useComponents();
1321
- const { setValue, getValues } = reactHookForm.useFormContext();
1322
- if (Object.entries(options).length === 0) {
1323
- return null;
1324
- }
1325
- const handleClick = (group, options2) => {
1326
- var _a, _b, _c, _d;
1327
- if (isGroupImmediateSubmit(group)) {
1328
- if (group === "code" && !getValues("identifier") && ((_b = (_a = options2 == null ? void 0 : options2.title) == null ? void 0 : _a.values) == null ? void 0 : _b.address)) {
1329
- setValue("identifier", (_d = (_c = options2 == null ? void 0 : options2.title) == null ? void 0 : _c.values) == null ? void 0 : _d.address);
1330
- }
1331
- setValue("method", group);
1332
- } else {
1333
- setSelectedGroup(group);
1334
- }
1335
- };
1336
- return /* @__PURE__ */ jsxRuntime.jsx(Card.AuthMethodListContainer, { children: Object.entries(options).map(([group, options2]) => /* @__PURE__ */ jsxRuntime.jsx(
1337
- Card.AuthMethodListItem,
1338
- {
1339
- group,
1340
- title: options2.title,
1341
- onClick: () => handleClick(group, options2)
1342
- },
1343
- group
1344
- )) });
1345
- }
1346
1411
  function OryFormGroups({ groups }) {
1347
1412
  const {
1348
1413
  flow: { ui }
@@ -1351,8 +1416,8 @@ function OryFormGroups({ groups }) {
1351
1416
  const { flowType } = useOryFlow();
1352
1417
  const { Form } = useComponents();
1353
1418
  const nodes = ui.nodes.filter((node) => groups.indexOf(node.group) > -1).sort((a, b) => nodeSorter(a, b, { flowType }));
1354
- return /* @__PURE__ */ jsxRuntime.jsx(Form.Group, { children: nodes.map((node, k) => {
1355
- return /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k);
1419
+ return /* @__PURE__ */ jsxRuntime.jsx(Form.Group, { children: nodes.map((node) => {
1420
+ return /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node));
1356
1421
  }) });
1357
1422
  }
1358
1423
  function OryFormSection({
@@ -1388,7 +1453,7 @@ function OryConsentCard() {
1388
1453
  /* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
1389
1454
  /* @__PURE__ */ jsxRuntime.jsx(OryCardContent, { children: /* @__PURE__ */ jsxRuntime.jsxs(OryForm, { children: [
1390
1455
  /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
1391
- /* @__PURE__ */ jsxRuntime.jsx(Form.Group, { children: flow.flow.ui.nodes.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)) }),
1456
+ /* @__PURE__ */ jsxRuntime.jsx(Form.Group, { children: flow.flow.ui.nodes.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node))) }),
1392
1457
  /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
1393
1458
  /* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
1394
1459
  ] }) })
@@ -1759,7 +1824,7 @@ function SettingsSectionContent({ group, nodes }) {
1759
1824
  "data-testid": "ory/screen/settings/group/totp",
1760
1825
  children: [
1761
1826
  /* @__PURE__ */ jsxRuntime.jsx(OrySettingsTotp, { nodes: (_a = groupedNodes.groups.totp) != null ? _a : [] }),
1762
- (_b = groupedNodes.groups.default) == null ? void 0 : _b.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1827
+ (_b = groupedNodes.groups.default) == null ? void 0 : _b.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node)))
1763
1828
  ]
1764
1829
  }
1765
1830
  );
@@ -1777,7 +1842,7 @@ function SettingsSectionContent({ group, nodes }) {
1777
1842
  nodes: (_c = groupedNodes.groups.lookup_secret) != null ? _c : []
1778
1843
  }
1779
1844
  ),
1780
- (_d = groupedNodes.groups.default) == null ? void 0 : _d.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1845
+ (_d = groupedNodes.groups.default) == null ? void 0 : _d.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node)))
1781
1846
  ]
1782
1847
  }
1783
1848
  );
@@ -1790,7 +1855,7 @@ function SettingsSectionContent({ group, nodes }) {
1790
1855
  "data-testid": "ory/screen/settings/group/oidc",
1791
1856
  children: [
1792
1857
  /* @__PURE__ */ jsxRuntime.jsx(OrySettingsOidc, { nodes: (_e = groupedNodes.groups.oidc) != null ? _e : [] }),
1793
- (_f = groupedNodes.groups.default) == null ? void 0 : _f.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1858
+ (_f = groupedNodes.groups.default) == null ? void 0 : _f.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node)))
1794
1859
  ]
1795
1860
  }
1796
1861
  );
@@ -1803,7 +1868,7 @@ function SettingsSectionContent({ group, nodes }) {
1803
1868
  "data-testid": "ory/screen/settings/group/webauthn",
1804
1869
  children: [
1805
1870
  /* @__PURE__ */ jsxRuntime.jsx(OrySettingsWebauthn, { nodes: (_g = groupedNodes.groups.webauthn) != null ? _g : [] }),
1806
- (_h = groupedNodes.groups.default) == null ? void 0 : _h.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1871
+ (_h = groupedNodes.groups.default) == null ? void 0 : _h.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node)))
1807
1872
  ]
1808
1873
  }
1809
1874
  );
@@ -1816,7 +1881,7 @@ function SettingsSectionContent({ group, nodes }) {
1816
1881
  "data-testid": "ory/screen/settings/group/passkey",
1817
1882
  children: [
1818
1883
  /* @__PURE__ */ jsxRuntime.jsx(OrySettingsPasskey, { nodes: (_i = groupedNodes.groups.passkey) != null ? _i : [] }),
1819
- (_j = groupedNodes.groups.default) == null ? void 0 : _j.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1884
+ (_j = groupedNodes.groups.default) == null ? void 0 : _j.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node)))
1820
1885
  ]
1821
1886
  }
1822
1887
  );
@@ -1837,16 +1902,16 @@ function SettingsSectionContent({ group, nodes }) {
1837
1902
  id: `settings.${group}.description`
1838
1903
  }),
1839
1904
  children: [
1840
- (_k = groupedNodes.groups.default) == null ? void 0 : _k.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)),
1905
+ (_k = groupedNodes.groups.default) == null ? void 0 : _k.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node))),
1841
1906
  nodes.filter(
1842
1907
  (node) => "type" in node.attributes && node.attributes.type !== "submit"
1843
- ).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1908
+ ).map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node)))
1844
1909
  ]
1845
1910
  }
1846
1911
  ),
1847
1912
  /* @__PURE__ */ jsxRuntime.jsx(Card.SettingsSectionFooter, { children: nodes.filter(
1848
1913
  (node) => "type" in node.attributes && node.attributes.type === "submit"
1849
- ).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)) })
1914
+ ).map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node))) })
1850
1915
  ]
1851
1916
  }
1852
1917
  );
@@ -1860,7 +1925,7 @@ function OrySettingsCard() {
1860
1925
  const scriptNodes = onlyScriptNodes(flow.ui.nodes);
1861
1926
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1862
1927
  /* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
1863
- scriptNodes.map((n) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node: n })),
1928
+ scriptNodes.map((n) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node: n }, clientFetch.getNodeId(n))),
1864
1929
  uniqueGroups.entries.map(([group, nodes]) => {
1865
1930
  if (group === clientFetch.UiNodeGroupEnum.Default) {
1866
1931
  return null;
@@ -2167,9 +2232,11 @@ var en_default = {
2167
2232
  "card.header.parts.oidc": "a social provider",
2168
2233
  "card.header.parts.password.registration": "your {identifierLabel} and a password",
2169
2234
  "card.header.parts.password.login": "your {identifierLabel} and password",
2170
- "card.header.parts.code": "a code sent to your email",
2235
+ "card.header.parts.code": "a code sent to you",
2171
2236
  "card.header.parts.passkey": "a Passkey",
2172
2237
  "card.header.parts.webauthn": "a security key",
2238
+ "card.header.parts.totp": "your authenticator app",
2239
+ "card.header.parts.lookup_secret": "a backup recovery code",
2173
2240
  "card.header.parts.identifier-first": "your {identifierLabel}",
2174
2241
  "card.header.description.login": "Sign in with {identifierLabel}",
2175
2242
  "card.header.description.registration": "Sign up with {identifierLabel}",
@@ -2417,13 +2484,15 @@ var de_default = {
2417
2484
  "identities.messages.4010009": "Die Authentifizierungsmethode stimmt nicht mit der vorherigen Authentifizierungsmethode \xFCberein. Bitte versuchen Sie es erneut.",
2418
2485
  "identities.messages.4010010": "Die eingegebene Adresse stimmt nicht mit der Adresse \xFCberein, die Sie bei der Registrierung angegeben haben. Bitte versuchen Sie es erneut.",
2419
2486
  "input.placeholder": "{placeholder} eingeben",
2420
- "card.header.parts.code": "einem Code per E-Mail",
2487
+ "card.header.parts.code": "ein an Sie gesendeter Code",
2421
2488
  "card.header.parts.identifier-first": "Ihr {identifierLabel}",
2422
2489
  "card.header.parts.oidc": "ein sozialer Anbieter",
2423
2490
  "card.header.parts.passkey": "ein Passkey",
2424
2491
  "card.header.parts.password.login": "Ihrer {identifierLabel} und Ihrem Passwort",
2425
2492
  "card.header.parts.password.registration": "Ihrer {identifierLabel} und einem Passwort",
2426
2493
  "card.header.parts.webauthn": "ein Sicherheitsschl\xFCssel",
2494
+ "card.header.parts.totp": "deine Authentifikator-App",
2495
+ "card.header.parts.lookup_secret": "ein Backup-Wiederherstellungscode",
2427
2496
  "recovery.subtitle": "Geben Sie die mit Ihrem Konto verkn\xFCpfte E-Mail-Adresse ein, um einen einmaligen Zugangscode zu erhalten",
2428
2497
  "verification.subtitle": "Geben Sie die mit Ihrem Konto verkn\xFCpfte E-Mail-Adresse ein, um es zu best\xE4tigen",
2429
2498
  "card.header.description.login": "Melden Sie sich mit {identifierLabel} an",
@@ -2762,6 +2831,8 @@ var es_default = {
2762
2831
  "card.header.parts.code": "un c\xF3digo enviado a tu correo electr\xF3nico",
2763
2832
  "card.header.parts.passkey": "una clave de acceso",
2764
2833
  "card.header.parts.webauthn": "una clave de seguridad",
2834
+ "card.header.parts.totp": "su aplicaci\xF3n de autenticaci\xF3n",
2835
+ "card.header.parts.lookup_secret": "un c\xF3digo de recuperaci\xF3n de copia de seguridad",
2765
2836
  "card.header.parts.identifier-first": "tu {identifierLabel}",
2766
2837
  "card.header.description.login": "Iniciar sesi\xF3n con {identifierLabel}",
2767
2838
  "card.header.description.registration": "Registrarse con {identifierLabel}",
@@ -3039,10 +3110,12 @@ var fr_default = {
3039
3110
  "card.header.parts.oidc": "un fournisseur de r\xE9seaux sociaux",
3040
3111
  "card.header.parts.password.registration": "votre {identifierLabel} et un mot de passe",
3041
3112
  "card.header.parts.password.login": "votre {identifierLabel} et votre mot de passe",
3042
- "card.header.parts.code": "un code envoy\xE9 \xE0 votre adresse e-mail",
3043
3113
  "card.header.parts.passkey": "une cl\xE9 d'acc\xE8s",
3044
3114
  "card.header.parts.webauthn": "une cl\xE9 de s\xE9curit\xE9",
3045
3115
  "card.header.parts.identifier-first": "votre {identifierLabel}",
3116
+ "card.header.parts.code": "un code qui vous a \xE9t\xE9 envoy\xE9",
3117
+ "card.header.parts.totp": "votre application d'authentification",
3118
+ "card.header.parts.lookup_secret": "un code de r\xE9cup\xE9ration de secours",
3046
3119
  "card.header.description.login": "Se connecter avec {identifierLabel}",
3047
3120
  "card.header.description.registration": "S'inscrire avec {identifierLabel}",
3048
3121
  "misc.or": "ou",
@@ -3285,7 +3358,9 @@ var nl_default = {
3285
3358
  "input.placeholder": "",
3286
3359
  "card.header.description.login": "",
3287
3360
  "card.header.description.registration": "",
3288
- "card.header.parts.code": "",
3361
+ "card.header.parts.code": "een code die naar je is verzonden",
3362
+ "card.header.parts.totp": "je authenticator-app",
3363
+ "card.header.parts.lookup_secret": "een backup herstelcode",
3289
3364
  "card.header.parts.identifier-first": "",
3290
3365
  "card.header.parts.oidc": "",
3291
3366
  "card.header.parts.passkey": "",
@@ -3570,13 +3645,15 @@ var pl_default = {
3570
3645
  "input.placeholder": "",
3571
3646
  "card.header.description.login": "",
3572
3647
  "card.header.description.registration": "",
3573
- "card.header.parts.code": "",
3574
3648
  "card.header.parts.identifier-first": "",
3575
3649
  "card.header.parts.oidc": "",
3576
3650
  "card.header.parts.passkey": "",
3577
3651
  "card.header.parts.password.login": "",
3578
3652
  "card.header.parts.password.registration": "",
3579
3653
  "card.header.parts.webauthn": "",
3654
+ "card.header.parts.code": "kod wys\u0142any do Ciebie",
3655
+ "card.header.parts.totp": "Twoja aplikacja uwierzytelniaj\u0105ca",
3656
+ "card.header.parts.lookup_secret": "kod odzyskiwania kopii zapasowej",
3580
3657
  "forms.label.forgot-password": "",
3581
3658
  "login.subtitle": "",
3582
3659
  "login.subtitle-refresh": "",
@@ -3855,7 +3932,9 @@ var pt_default = {
3855
3932
  "input.placeholder": "",
3856
3933
  "card.header.description.login": "",
3857
3934
  "card.header.description.registration": "",
3858
- "card.header.parts.code": "",
3935
+ "card.header.parts.code": "um c\xF3digo enviado para voc\xEA",
3936
+ "card.header.parts.totp": "seu aplicativo autenticador",
3937
+ "card.header.parts.lookup_secret": "um c\xF3digo de recupera\xE7\xE3o de backup",
3859
3938
  "card.header.parts.identifier-first": "",
3860
3939
  "card.header.parts.oidc": "",
3861
3940
  "card.header.parts.passkey": "",
@@ -4140,7 +4219,9 @@ var sv_default = {
4140
4219
  "input.placeholder": "Ange din {placeholder}",
4141
4220
  "card.header.description.login": "Logga in med {identifierLabel}",
4142
4221
  "card.header.description.registration": "Registrera dig med {identifierLabel}",
4143
- "card.header.parts.code": "en kod skickad till din e-post",
4222
+ "card.header.parts.code": "en kod skickad till dig",
4223
+ "card.header.parts.totp": "din autentiseringsapp",
4224
+ "card.header.parts.lookup_secret": "en s\xE4kerhetskopieringskod",
4144
4225
  "card.header.parts.identifier-first": "din {identifierLabel}",
4145
4226
  "card.header.parts.oidc": "en social leverant\xF6r",
4146
4227
  "card.header.parts.passkey": "en Passkey",