@ory/elements-react 1.0.0-next.41 → 1.0.0-next.44

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 CHANGED
@@ -1,3 +1,30 @@
1
+ ## 1.0.0-next.44 (2025-04-10)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - use currentColor in eye icons ([#433](https://github.com/ory/elements/pull/433))
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - Jonas Hungershausen
10
+
11
+ ## 1.0.0-next.43 (2025-04-10)
12
+
13
+ ### 🚀 Features
14
+
15
+ - add missing French translations ([#401](https://github.com/ory/elements/pull/401))
16
+
17
+ ### 🩹 Fixes
18
+
19
+ - two-step registration back button ([#428](https://github.com/ory/elements/pull/428))
20
+ - resolve wcag2aa color contrast issues ([#367](https://github.com/ory/elements/pull/367))
21
+
22
+ ### ❤️ Thank You
23
+
24
+ - hackerman @aeneasr
25
+ - Jonas Hungershausen
26
+ - Jordan Labrosse
27
+
1
28
  ## 1.0.0-next.41 (2025-04-07)
2
29
 
3
30
  ### 🩹 Fixes
package/dist/index.js CHANGED
@@ -189,13 +189,16 @@ function nodesToAuthMethodGroups(nodes, excludeAuthMethods = []) {
189
189
  ].includes(group)
190
190
  );
191
191
  }
192
- function useNodesGroups(nodes) {
192
+ function useNodesGroups(nodes, { omit } = {}) {
193
193
  const groupSorter = useGroupSorter();
194
194
  const groups = react.useMemo(() => {
195
195
  var _a;
196
196
  const groups2 = {};
197
197
  for (const node of nodes) {
198
- if (node.type === "script") {
198
+ if ((omit == null ? void 0 : omit.includes("script")) && clientFetch.isUiNodeScriptAttributes(node.attributes)) {
199
+ continue;
200
+ }
201
+ if ((omit == null ? void 0 : omit.includes("input_hidden")) && clientFetch.isUiNodeInputAttributes(node.attributes) && node.attributes.type === "hidden") {
199
202
  continue;
200
203
  }
201
204
  const groupNodes = (_a = groups2[node.group]) != null ? _a : [];
@@ -1141,11 +1144,14 @@ function OryTwoStepCard() {
1141
1144
  const { ui } = flow;
1142
1145
  const nodeSorter = useNodeSorter();
1143
1146
  const sortNodes = (a, b) => nodeSorter(a, b, { flowType });
1144
- const uniqueGroups = useNodesGroups(ui.nodes);
1147
+ const groupsToShow = useNodesGroups(ui.nodes, {
1148
+ // We only want to render groups that have visible elements.
1149
+ omit: ["script", "input_hidden"]
1150
+ });
1145
1151
  const options = Object.fromEntries(
1146
1152
  Object.values(clientFetch.UiNodeGroupEnum).filter((group) => {
1147
1153
  var _a2;
1148
- return (_a2 = uniqueGroups.groups[group]) == null ? void 0 : _a2.length;
1154
+ return (_a2 = groupsToShow.groups[group]) == null ? void 0 : _a2.length;
1149
1155
  }).filter(
1150
1156
  (group) => ![
1151
1157
  clientFetch.UiNodeGroupEnum.Oidc,
@@ -1178,7 +1184,7 @@ function OryTwoStepCard() {
1178
1184
  }
1179
1185
  }
1180
1186
  const nonSsoNodes = removeSsoNodes(ui.nodes);
1181
- const finalNodes = formState.current === "method_active" ? getFinalNodes(uniqueGroups.groups, formState.method) : [];
1187
+ const finalNodes = formState.current === "method_active" ? getFinalNodes(groupsToShow.groups, formState.method) : [];
1182
1188
  const handleAfterFormSubmit = (method) => {
1183
1189
  if (typeof method !== "string" || !isUINodeGroupEnum(method)) {
1184
1190
  return;
@@ -1202,35 +1208,36 @@ function OryTwoStepCard() {
1202
1208
  }
1203
1209
  return true;
1204
1210
  }).length > 0;
1211
+ const captchaNodes = ui.nodes.filter(
1212
+ (n) => n.group === clientFetch.UiNodeGroupEnum.Captcha
1213
+ );
1205
1214
  return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
1206
1215
  /* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
1207
1216
  /* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
1208
1217
  /* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
1209
1218
  showSso && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
1210
1219
  /* @__PURE__ */ jsxRuntime.jsxs(OryForm, { onAfterSubmit: handleAfterFormSubmit, children: [
1211
- /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
1212
- formState.current === "provide_identifier" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1213
- showSsoDivider && /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
1214
- nonSsoNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1215
- ] }),
1216
- formState.current === "select_method" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1217
- /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
1218
- /* @__PURE__ */ jsxRuntime.jsx(
1219
- AuthMethodList,
1220
- {
1221
- options,
1222
- setSelectedGroup: (group) => dispatchFormState({
1223
- type: "action_select_method",
1224
- method: group
1225
- })
1226
- }
1227
- ),
1228
- ui.nodes.filter((n) => n.group === clientFetch.UiNodeGroupEnum.Captcha).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1229
- ] }),
1230
- formState.current === "method_active" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1231
- ui.nodes.filter((n) => n.type === "script").map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)),
1232
- finalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1233
- ] })
1220
+ formState.current === "provide_identifier" && /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
1221
+ showSsoDivider && /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
1222
+ nonSsoNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1223
+ ] }),
1224
+ formState.current === "select_method" && /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
1225
+ Object.entries(options).length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
1226
+ Object.entries(options).length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1227
+ AuthMethodList,
1228
+ {
1229
+ options,
1230
+ setSelectedGroup: (group) => dispatchFormState({
1231
+ type: "action_select_method",
1232
+ method: group
1233
+ })
1234
+ }
1235
+ ),
1236
+ captchaNodes.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1237
+ ] }),
1238
+ formState.current === "method_active" && /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
1239
+ ui.nodes.filter((n) => n.type === "script").map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)),
1240
+ finalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1234
1241
  ] }),
1235
1242
  /* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
1236
1243
  ] })
@@ -1240,6 +1247,9 @@ function OryTwoStepCard() {
1240
1247
  function AuthMethodList({ options, setSelectedGroup }) {
1241
1248
  const { Card } = useComponents();
1242
1249
  const { setValue, getValues } = reactHookForm.useFormContext();
1250
+ if (Object.entries(options).length === 0) {
1251
+ return null;
1252
+ }
1243
1253
  const handleClick = (group, options2) => {
1244
1254
  var _a, _b, _c, _d;
1245
1255
  if (isGroupImmediateSubmit(group)) {
@@ -1665,16 +1675,19 @@ function SettingsSectionContent({ group, nodes }) {
1665
1675
  const { Card } = useComponents();
1666
1676
  const intl = reactIntl.useIntl();
1667
1677
  const { flow } = useOryFlow();
1668
- const uniqueGroups = useNodesGroups(flow.ui.nodes);
1678
+ const groupedNodes = useNodesGroups(flow.ui.nodes, {
1679
+ // Script nodes are already handled by the parent component.
1680
+ omit: ["script"]
1681
+ });
1669
1682
  if (group === clientFetch.UiNodeGroupEnum.Totp) {
1670
1683
  return /* @__PURE__ */ jsxRuntime.jsxs(
1671
1684
  OryFormSection,
1672
1685
  {
1673
- nodes: uniqueGroups.groups.totp,
1686
+ nodes: groupedNodes.groups.totp,
1674
1687
  "data-testid": "ory/screen/settings/group/totp",
1675
1688
  children: [
1676
- /* @__PURE__ */ jsxRuntime.jsx(OrySettingsTotp, { nodes: (_a = uniqueGroups.groups.totp) != null ? _a : [] }),
1677
- (_b = uniqueGroups.groups.default) == null ? void 0 : _b.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1689
+ /* @__PURE__ */ jsxRuntime.jsx(OrySettingsTotp, { nodes: (_a = groupedNodes.groups.totp) != null ? _a : [] }),
1690
+ (_b = groupedNodes.groups.default) == null ? void 0 : _b.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1678
1691
  ]
1679
1692
  }
1680
1693
  );
@@ -1683,16 +1696,16 @@ function SettingsSectionContent({ group, nodes }) {
1683
1696
  return /* @__PURE__ */ jsxRuntime.jsxs(
1684
1697
  OryFormSection,
1685
1698
  {
1686
- nodes: uniqueGroups.groups.lookup_secret,
1699
+ nodes: groupedNodes.groups.lookup_secret,
1687
1700
  "data-testid": "ory/screen/settings/group/lookup_secret",
1688
1701
  children: [
1689
1702
  /* @__PURE__ */ jsxRuntime.jsx(
1690
1703
  OrySettingsRecoveryCodes,
1691
1704
  {
1692
- nodes: (_c = uniqueGroups.groups.lookup_secret) != null ? _c : []
1705
+ nodes: (_c = groupedNodes.groups.lookup_secret) != null ? _c : []
1693
1706
  }
1694
1707
  ),
1695
- (_d = uniqueGroups.groups.default) == null ? void 0 : _d.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1708
+ (_d = groupedNodes.groups.default) == null ? void 0 : _d.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1696
1709
  ]
1697
1710
  }
1698
1711
  );
@@ -1701,11 +1714,11 @@ function SettingsSectionContent({ group, nodes }) {
1701
1714
  return /* @__PURE__ */ jsxRuntime.jsxs(
1702
1715
  OryFormSection,
1703
1716
  {
1704
- nodes: uniqueGroups.groups.oidc,
1717
+ nodes: groupedNodes.groups.oidc,
1705
1718
  "data-testid": "ory/screen/settings/group/oidc",
1706
1719
  children: [
1707
- /* @__PURE__ */ jsxRuntime.jsx(OrySettingsOidc, { nodes: (_e = uniqueGroups.groups.oidc) != null ? _e : [] }),
1708
- (_f = uniqueGroups.groups.default) == null ? void 0 : _f.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1720
+ /* @__PURE__ */ jsxRuntime.jsx(OrySettingsOidc, { nodes: (_e = groupedNodes.groups.oidc) != null ? _e : [] }),
1721
+ (_f = groupedNodes.groups.default) == null ? void 0 : _f.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1709
1722
  ]
1710
1723
  }
1711
1724
  );
@@ -1714,11 +1727,11 @@ function SettingsSectionContent({ group, nodes }) {
1714
1727
  return /* @__PURE__ */ jsxRuntime.jsxs(
1715
1728
  OryFormSection,
1716
1729
  {
1717
- nodes: uniqueGroups.groups.webauthn,
1730
+ nodes: groupedNodes.groups.webauthn,
1718
1731
  "data-testid": "ory/screen/settings/group/webauthn",
1719
1732
  children: [
1720
- /* @__PURE__ */ jsxRuntime.jsx(OrySettingsWebauthn, { nodes: (_g = uniqueGroups.groups.webauthn) != null ? _g : [] }),
1721
- (_h = uniqueGroups.groups.default) == null ? void 0 : _h.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1733
+ /* @__PURE__ */ jsxRuntime.jsx(OrySettingsWebauthn, { nodes: (_g = groupedNodes.groups.webauthn) != null ? _g : [] }),
1734
+ (_h = groupedNodes.groups.default) == null ? void 0 : _h.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1722
1735
  ]
1723
1736
  }
1724
1737
  );
@@ -1727,11 +1740,11 @@ function SettingsSectionContent({ group, nodes }) {
1727
1740
  return /* @__PURE__ */ jsxRuntime.jsxs(
1728
1741
  OryFormSection,
1729
1742
  {
1730
- nodes: uniqueGroups.groups.passkey,
1743
+ nodes: groupedNodes.groups.passkey,
1731
1744
  "data-testid": "ory/screen/settings/group/passkey",
1732
1745
  children: [
1733
- /* @__PURE__ */ jsxRuntime.jsx(OrySettingsPasskey, { nodes: (_i = uniqueGroups.groups.passkey) != null ? _i : [] }),
1734
- (_j = uniqueGroups.groups.default) == null ? void 0 : _j.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1746
+ /* @__PURE__ */ jsxRuntime.jsx(OrySettingsPasskey, { nodes: (_i = groupedNodes.groups.passkey) != null ? _i : [] }),
1747
+ (_j = groupedNodes.groups.default) == null ? void 0 : _j.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1735
1748
  ]
1736
1749
  }
1737
1750
  );
@@ -1752,7 +1765,7 @@ function SettingsSectionContent({ group, nodes }) {
1752
1765
  id: `settings.${group}.description`
1753
1766
  }),
1754
1767
  children: [
1755
- (_k = uniqueGroups.groups.default) == null ? void 0 : _k.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)),
1768
+ (_k = groupedNodes.groups.default) == null ? void 0 : _k.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)),
1756
1769
  nodes.filter(
1757
1770
  (node) => "type" in node.attributes && node.attributes.type !== "submit"
1758
1771
  ).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
@@ -1766,16 +1779,16 @@ function SettingsSectionContent({ group, nodes }) {
1766
1779
  }
1767
1780
  );
1768
1781
  }
1769
- var getScriptNode = (nodes) => nodes.find(
1770
- (node) => "id" in node.attributes && node.attributes.id === "webauthn_script"
1782
+ var onlyScriptNodes = (nodes) => nodes.filter(
1783
+ (node) => clientFetch.isUiNodeScriptAttributes(node.attributes) && node.attributes.id === "webauthn_script"
1771
1784
  );
1772
1785
  function OrySettingsCard() {
1773
1786
  const { flow } = useOryFlow();
1774
- const uniqueGroups = useNodesGroups(flow.ui.nodes);
1775
- const scriptNode = getScriptNode(flow.ui.nodes);
1787
+ const uniqueGroups = useNodesGroups(flow.ui.nodes, { omit: ["script"] });
1788
+ const scriptNodes = onlyScriptNodes(flow.ui.nodes);
1776
1789
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1777
1790
  /* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
1778
- scriptNode && /* @__PURE__ */ jsxRuntime.jsx(Node, { node: scriptNode }),
1791
+ scriptNodes.map((n) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node: n })),
1779
1792
  uniqueGroups.entries.map(([group, nodes]) => {
1780
1793
  if (group === clientFetch.UiNodeGroupEnum.Default) {
1781
1794
  return null;
@@ -2301,7 +2314,7 @@ var de_default = {
2301
2314
  "two-step.code.description": "Ein Best\xE4tigungscode wird an Ihre E-Mail gesendet.",
2302
2315
  "two-step.code.title": "E-Mail-Code",
2303
2316
  "two-step.passkey.description": "Verwenden Sie die Fingerabdruck- oder Gesichtserkennung Ihres Ger\xE4ts",
2304
- "two-step.passkey.title": "Passwort (empfohlen)",
2317
+ "two-step.passkey.title": "Passkey (empfohlen)",
2305
2318
  "two-step.password.description": "Geben Sie Ihr Passwort ein, das mit Ihrem Konto verkn\xFCpft ist",
2306
2319
  "two-step.password.title": "Passwort",
2307
2320
  "two-step.webauthn.title": "Sicherheitsschl\xFCssel",