@ory/elements-react 1.0.0-rc.1 → 1.0.0-rc.2

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { UiNodeGroupEnum, isUiNodeInputAttributes, isUiNodeAnchorAttributes, isUiNodeImageAttributes, isUiNodeScriptAttributes, FlowType, isUiNodeTextAttributes, UiNodeInputAttributesTypeEnum, handleContinueWith, handleFlowError, settingsUrl, isResponseError, loginUrl, recoveryUrl, verificationUrl, registrationUrl, Configuration, FrontendApi, instanceOfContinueWithRecoveryUi } from '@ory/client-fetch';
1
+ import { UiNodeGroupEnum, isUiNodeInputAttributes, isUiNodeAnchorAttributes, isUiNodeImageAttributes, isUiNodeScriptAttributes, FlowType, getNodeId, isUiNodeTextAttributes, UiNodeInputAttributesTypeEnum, handleContinueWith, handleFlowError, settingsUrl, isResponseError, loginUrl, recoveryUrl, verificationUrl, registrationUrl, Configuration, FrontendApi, instanceOfContinueWithRecoveryUi } from '@ory/client-fetch';
2
2
  import { createContext, useContext, useState, useMemo, useReducer, useRef, useEffect } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useIntl, IntlProvider as IntlProvider$1 } from 'react-intl';
@@ -48,13 +48,18 @@ var defaultNodeOrder = [
48
48
  ];
49
49
  function defaultNodeSorter(a, b) {
50
50
  var _a, _b;
51
+ const aIsCaptcha = a.group === "captcha";
52
+ const bIsCaptcha = b.group === "captcha";
53
+ const aIsSubmit = isUiNodeInputAttributes(a.attributes) && a.attributes.type === "submit";
54
+ const bIsSubmit = isUiNodeInputAttributes(b.attributes) && b.attributes.type === "submit";
55
+ if (aIsCaptcha && bIsSubmit) {
56
+ return -1;
57
+ }
58
+ if (bIsCaptcha && aIsSubmit) {
59
+ return 1;
60
+ }
51
61
  const aGroupWeight = (_a = defaultNodeOrder.indexOf(a.group)) != null ? _a : 999;
52
62
  const bGroupWeight = (_b = defaultNodeOrder.indexOf(b.group)) != null ? _b : 999;
53
- if (b.group === "captcha" && isUiNodeInputAttributes(a.attributes) && a.attributes.type === "submit") {
54
- return aGroupWeight - (bGroupWeight - 2);
55
- } else if (a.group === "captcha" && isUiNodeInputAttributes(b.attributes) && b.attributes.type === "submit") {
56
- return aGroupWeight - 2 - bGroupWeight;
57
- }
58
63
  return aGroupWeight - bGroupWeight;
59
64
  }
60
65
  var defaultGroupOrder = [
@@ -563,6 +568,7 @@ function frontendClient(sdkUrl, opts = {}) {
563
568
  const config = new Configuration({
564
569
  ...opts,
565
570
  basePath: sdkUrl,
571
+ credentials: "include",
566
572
  headers: {
567
573
  Accept: "application/json",
568
574
  ...opts.headers
@@ -1178,7 +1184,7 @@ function OryFormOidcButtons() {
1178
1184
  if (filteredNodes.length === 0) {
1179
1185
  return null;
1180
1186
  }
1181
- return /* @__PURE__ */ jsx(Form.OidcRoot, { nodes: filteredNodes, children: filteredNodes.map((node, k) => /* @__PURE__ */ jsx(
1187
+ return /* @__PURE__ */ jsx(Form.OidcRoot, { nodes: filteredNodes, children: filteredNodes.map((node) => /* @__PURE__ */ jsx(
1182
1188
  Node2.OidcButton,
1183
1189
  {
1184
1190
  node,
@@ -1191,7 +1197,7 @@ function OryFormOidcButtons() {
1191
1197
  setValue("method", node.group);
1192
1198
  }
1193
1199
  },
1194
- k
1200
+ getNodeId(node)
1195
1201
  )) });
1196
1202
  }
1197
1203
  function OryFormSocialButtonsForm() {
@@ -1408,8 +1414,8 @@ function OryFormGroups({ groups }) {
1408
1414
  const { flowType } = useOryFlow();
1409
1415
  const { Form } = useComponents();
1410
1416
  const nodes = ui.nodes.filter((node) => groups.indexOf(node.group) > -1).sort((a, b) => nodeSorter(a, b, { flowType }));
1411
- return /* @__PURE__ */ jsx(Form.Group, { children: nodes.map((node, k) => {
1412
- return /* @__PURE__ */ jsx(Node, { node }, k);
1417
+ return /* @__PURE__ */ jsx(Form.Group, { children: nodes.map((node) => {
1418
+ return /* @__PURE__ */ jsx(Node, { node }, getNodeId(node));
1413
1419
  }) });
1414
1420
  }
1415
1421
  function OryFormSection({
@@ -1445,7 +1451,7 @@ function OryConsentCard() {
1445
1451
  /* @__PURE__ */ jsx(OryCardHeader, {}),
1446
1452
  /* @__PURE__ */ jsx(OryCardContent, { children: /* @__PURE__ */ jsxs(OryForm, { children: [
1447
1453
  /* @__PURE__ */ jsx(Card.Divider, {}),
1448
- /* @__PURE__ */ jsx(Form.Group, { children: flow.flow.ui.nodes.map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k)) }),
1454
+ /* @__PURE__ */ jsx(Form.Group, { children: flow.flow.ui.nodes.map((node) => /* @__PURE__ */ jsx(Node, { node }, getNodeId(node))) }),
1449
1455
  /* @__PURE__ */ jsx(Card.Divider, {}),
1450
1456
  /* @__PURE__ */ jsx(OryCardFooter, {})
1451
1457
  ] }) })
@@ -1816,7 +1822,7 @@ function SettingsSectionContent({ group, nodes }) {
1816
1822
  "data-testid": "ory/screen/settings/group/totp",
1817
1823
  children: [
1818
1824
  /* @__PURE__ */ jsx(OrySettingsTotp, { nodes: (_a = groupedNodes.groups.totp) != null ? _a : [] }),
1819
- (_b = groupedNodes.groups.default) == null ? void 0 : _b.map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
1825
+ (_b = groupedNodes.groups.default) == null ? void 0 : _b.map((node) => /* @__PURE__ */ jsx(Node, { node }, getNodeId(node)))
1820
1826
  ]
1821
1827
  }
1822
1828
  );
@@ -1834,7 +1840,7 @@ function SettingsSectionContent({ group, nodes }) {
1834
1840
  nodes: (_c = groupedNodes.groups.lookup_secret) != null ? _c : []
1835
1841
  }
1836
1842
  ),
1837
- (_d = groupedNodes.groups.default) == null ? void 0 : _d.map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
1843
+ (_d = groupedNodes.groups.default) == null ? void 0 : _d.map((node) => /* @__PURE__ */ jsx(Node, { node }, getNodeId(node)))
1838
1844
  ]
1839
1845
  }
1840
1846
  );
@@ -1847,7 +1853,7 @@ function SettingsSectionContent({ group, nodes }) {
1847
1853
  "data-testid": "ory/screen/settings/group/oidc",
1848
1854
  children: [
1849
1855
  /* @__PURE__ */ jsx(OrySettingsOidc, { nodes: (_e = groupedNodes.groups.oidc) != null ? _e : [] }),
1850
- (_f = groupedNodes.groups.default) == null ? void 0 : _f.map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
1856
+ (_f = groupedNodes.groups.default) == null ? void 0 : _f.map((node) => /* @__PURE__ */ jsx(Node, { node }, getNodeId(node)))
1851
1857
  ]
1852
1858
  }
1853
1859
  );
@@ -1860,7 +1866,7 @@ function SettingsSectionContent({ group, nodes }) {
1860
1866
  "data-testid": "ory/screen/settings/group/webauthn",
1861
1867
  children: [
1862
1868
  /* @__PURE__ */ jsx(OrySettingsWebauthn, { nodes: (_g = groupedNodes.groups.webauthn) != null ? _g : [] }),
1863
- (_h = groupedNodes.groups.default) == null ? void 0 : _h.map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
1869
+ (_h = groupedNodes.groups.default) == null ? void 0 : _h.map((node) => /* @__PURE__ */ jsx(Node, { node }, getNodeId(node)))
1864
1870
  ]
1865
1871
  }
1866
1872
  );
@@ -1873,7 +1879,7 @@ function SettingsSectionContent({ group, nodes }) {
1873
1879
  "data-testid": "ory/screen/settings/group/passkey",
1874
1880
  children: [
1875
1881
  /* @__PURE__ */ jsx(OrySettingsPasskey, { nodes: (_i = groupedNodes.groups.passkey) != null ? _i : [] }),
1876
- (_j = groupedNodes.groups.default) == null ? void 0 : _j.map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
1882
+ (_j = groupedNodes.groups.default) == null ? void 0 : _j.map((node) => /* @__PURE__ */ jsx(Node, { node }, getNodeId(node)))
1877
1883
  ]
1878
1884
  }
1879
1885
  );
@@ -1894,16 +1900,16 @@ function SettingsSectionContent({ group, nodes }) {
1894
1900
  id: `settings.${group}.description`
1895
1901
  }),
1896
1902
  children: [
1897
- (_k = groupedNodes.groups.default) == null ? void 0 : _k.map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k)),
1903
+ (_k = groupedNodes.groups.default) == null ? void 0 : _k.map((node) => /* @__PURE__ */ jsx(Node, { node }, getNodeId(node))),
1898
1904
  nodes.filter(
1899
1905
  (node) => "type" in node.attributes && node.attributes.type !== "submit"
1900
- ).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
1906
+ ).map((node) => /* @__PURE__ */ jsx(Node, { node }, getNodeId(node)))
1901
1907
  ]
1902
1908
  }
1903
1909
  ),
1904
1910
  /* @__PURE__ */ jsx(Card.SettingsSectionFooter, { children: nodes.filter(
1905
1911
  (node) => "type" in node.attributes && node.attributes.type === "submit"
1906
- ).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k)) })
1912
+ ).map((node) => /* @__PURE__ */ jsx(Node, { node }, getNodeId(node))) })
1907
1913
  ]
1908
1914
  }
1909
1915
  );
@@ -1917,7 +1923,7 @@ function OrySettingsCard() {
1917
1923
  const scriptNodes = onlyScriptNodes(flow.ui.nodes);
1918
1924
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1919
1925
  /* @__PURE__ */ jsx(OryCardValidationMessages, {}),
1920
- scriptNodes.map((n) => /* @__PURE__ */ jsx(Node, { node: n })),
1926
+ scriptNodes.map((n) => /* @__PURE__ */ jsx(Node, { node: n }, getNodeId(n))),
1921
1927
  uniqueGroups.entries.map(([group, nodes]) => {
1922
1928
  if (group === UiNodeGroupEnum.Default) {
1923
1929
  return null;
@@ -2224,9 +2230,11 @@ var en_default = {
2224
2230
  "card.header.parts.oidc": "a social provider",
2225
2231
  "card.header.parts.password.registration": "your {identifierLabel} and a password",
2226
2232
  "card.header.parts.password.login": "your {identifierLabel} and password",
2227
- "card.header.parts.code": "a code sent to your email",
2233
+ "card.header.parts.code": "a code sent to you",
2228
2234
  "card.header.parts.passkey": "a Passkey",
2229
2235
  "card.header.parts.webauthn": "a security key",
2236
+ "card.header.parts.totp": "your authenticator app",
2237
+ "card.header.parts.lookup_secret": "a backup recovery code",
2230
2238
  "card.header.parts.identifier-first": "your {identifierLabel}",
2231
2239
  "card.header.description.login": "Sign in with {identifierLabel}",
2232
2240
  "card.header.description.registration": "Sign up with {identifierLabel}",
@@ -2474,13 +2482,15 @@ var de_default = {
2474
2482
  "identities.messages.4010009": "Die Authentifizierungsmethode stimmt nicht mit der vorherigen Authentifizierungsmethode \xFCberein. Bitte versuchen Sie es erneut.",
2475
2483
  "identities.messages.4010010": "Die eingegebene Adresse stimmt nicht mit der Adresse \xFCberein, die Sie bei der Registrierung angegeben haben. Bitte versuchen Sie es erneut.",
2476
2484
  "input.placeholder": "{placeholder} eingeben",
2477
- "card.header.parts.code": "einem Code per E-Mail",
2485
+ "card.header.parts.code": "ein an Sie gesendeter Code",
2478
2486
  "card.header.parts.identifier-first": "Ihr {identifierLabel}",
2479
2487
  "card.header.parts.oidc": "ein sozialer Anbieter",
2480
2488
  "card.header.parts.passkey": "ein Passkey",
2481
2489
  "card.header.parts.password.login": "Ihrer {identifierLabel} und Ihrem Passwort",
2482
2490
  "card.header.parts.password.registration": "Ihrer {identifierLabel} und einem Passwort",
2483
2491
  "card.header.parts.webauthn": "ein Sicherheitsschl\xFCssel",
2492
+ "card.header.parts.totp": "deine Authentifikator-App",
2493
+ "card.header.parts.lookup_secret": "ein Backup-Wiederherstellungscode",
2484
2494
  "recovery.subtitle": "Geben Sie die mit Ihrem Konto verkn\xFCpfte E-Mail-Adresse ein, um einen einmaligen Zugangscode zu erhalten",
2485
2495
  "verification.subtitle": "Geben Sie die mit Ihrem Konto verkn\xFCpfte E-Mail-Adresse ein, um es zu best\xE4tigen",
2486
2496
  "card.header.description.login": "Melden Sie sich mit {identifierLabel} an",
@@ -2819,6 +2829,8 @@ var es_default = {
2819
2829
  "card.header.parts.code": "un c\xF3digo enviado a tu correo electr\xF3nico",
2820
2830
  "card.header.parts.passkey": "una clave de acceso",
2821
2831
  "card.header.parts.webauthn": "una clave de seguridad",
2832
+ "card.header.parts.totp": "su aplicaci\xF3n de autenticaci\xF3n",
2833
+ "card.header.parts.lookup_secret": "un c\xF3digo de recuperaci\xF3n de copia de seguridad",
2822
2834
  "card.header.parts.identifier-first": "tu {identifierLabel}",
2823
2835
  "card.header.description.login": "Iniciar sesi\xF3n con {identifierLabel}",
2824
2836
  "card.header.description.registration": "Registrarse con {identifierLabel}",
@@ -3096,10 +3108,12 @@ var fr_default = {
3096
3108
  "card.header.parts.oidc": "un fournisseur de r\xE9seaux sociaux",
3097
3109
  "card.header.parts.password.registration": "votre {identifierLabel} et un mot de passe",
3098
3110
  "card.header.parts.password.login": "votre {identifierLabel} et votre mot de passe",
3099
- "card.header.parts.code": "un code envoy\xE9 \xE0 votre adresse e-mail",
3100
3111
  "card.header.parts.passkey": "une cl\xE9 d'acc\xE8s",
3101
3112
  "card.header.parts.webauthn": "une cl\xE9 de s\xE9curit\xE9",
3102
3113
  "card.header.parts.identifier-first": "votre {identifierLabel}",
3114
+ "card.header.parts.code": "un code qui vous a \xE9t\xE9 envoy\xE9",
3115
+ "card.header.parts.totp": "votre application d'authentification",
3116
+ "card.header.parts.lookup_secret": "un code de r\xE9cup\xE9ration de secours",
3103
3117
  "card.header.description.login": "Se connecter avec {identifierLabel}",
3104
3118
  "card.header.description.registration": "S'inscrire avec {identifierLabel}",
3105
3119
  "misc.or": "ou",
@@ -3342,7 +3356,9 @@ var nl_default = {
3342
3356
  "input.placeholder": "",
3343
3357
  "card.header.description.login": "",
3344
3358
  "card.header.description.registration": "",
3345
- "card.header.parts.code": "",
3359
+ "card.header.parts.code": "een code die naar je is verzonden",
3360
+ "card.header.parts.totp": "je authenticator-app",
3361
+ "card.header.parts.lookup_secret": "een backup herstelcode",
3346
3362
  "card.header.parts.identifier-first": "",
3347
3363
  "card.header.parts.oidc": "",
3348
3364
  "card.header.parts.passkey": "",
@@ -3627,13 +3643,15 @@ var pl_default = {
3627
3643
  "input.placeholder": "",
3628
3644
  "card.header.description.login": "",
3629
3645
  "card.header.description.registration": "",
3630
- "card.header.parts.code": "",
3631
3646
  "card.header.parts.identifier-first": "",
3632
3647
  "card.header.parts.oidc": "",
3633
3648
  "card.header.parts.passkey": "",
3634
3649
  "card.header.parts.password.login": "",
3635
3650
  "card.header.parts.password.registration": "",
3636
3651
  "card.header.parts.webauthn": "",
3652
+ "card.header.parts.code": "kod wys\u0142any do Ciebie",
3653
+ "card.header.parts.totp": "Twoja aplikacja uwierzytelniaj\u0105ca",
3654
+ "card.header.parts.lookup_secret": "kod odzyskiwania kopii zapasowej",
3637
3655
  "forms.label.forgot-password": "",
3638
3656
  "login.subtitle": "",
3639
3657
  "login.subtitle-refresh": "",
@@ -3912,7 +3930,9 @@ var pt_default = {
3912
3930
  "input.placeholder": "",
3913
3931
  "card.header.description.login": "",
3914
3932
  "card.header.description.registration": "",
3915
- "card.header.parts.code": "",
3933
+ "card.header.parts.code": "um c\xF3digo enviado para voc\xEA",
3934
+ "card.header.parts.totp": "seu aplicativo autenticador",
3935
+ "card.header.parts.lookup_secret": "um c\xF3digo de recupera\xE7\xE3o de backup",
3916
3936
  "card.header.parts.identifier-first": "",
3917
3937
  "card.header.parts.oidc": "",
3918
3938
  "card.header.parts.passkey": "",
@@ -4197,7 +4217,9 @@ var sv_default = {
4197
4217
  "input.placeholder": "Ange din {placeholder}",
4198
4218
  "card.header.description.login": "Logga in med {identifierLabel}",
4199
4219
  "card.header.description.registration": "Registrera dig med {identifierLabel}",
4200
- "card.header.parts.code": "en kod skickad till din e-post",
4220
+ "card.header.parts.code": "en kod skickad till dig",
4221
+ "card.header.parts.totp": "din autentiseringsapp",
4222
+ "card.header.parts.lookup_secret": "en s\xE4kerhetskopieringskod",
4201
4223
  "card.header.parts.identifier-first": "din {identifierLabel}",
4202
4224
  "card.header.parts.oidc": "en social leverant\xF6r",
4203
4225
  "card.header.parts.passkey": "en Passkey",