@ory/elements-react 1.0.0-next.6 → 1.0.0-next.8
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/.vscode/i18n-ally-reviews.yml +3 -0
- package/.vscode/settings.json +4 -0
- package/CHANGELOG.md +34 -2
- package/README.md +4 -3
- package/dist/index.d.mts +90 -17
- package/dist/index.d.ts +90 -17
- package/dist/index.js +263 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +259 -56
- package/dist/index.mjs.map +1 -1
- package/dist/theme/default/index.css +279 -245
- package/dist/theme/default/index.css.map +1 -1
- package/dist/theme/default/index.js +267 -195
- package/dist/theme/default/index.js.map +1 -1
- package/dist/theme/default/index.mjs +276 -204
- package/dist/theme/default/index.mjs.map +1 -1
- package/package.json +9 -9
- package/postcss.config.ts +1 -5
- package/tsconfig.json +4 -2
- package/test-results/.last-run.json +0 -4
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var reactHookForm = require('react-hook-form');
|
|
4
|
-
var reactIntl = require('react-intl');
|
|
5
3
|
var react = require('react');
|
|
6
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var reactIntl = require('react-intl');
|
|
6
|
+
var reactHookForm = require('react-hook-form');
|
|
7
7
|
var clientFetch = require('@ory/client-fetch');
|
|
8
8
|
|
|
9
9
|
var __defProp = Object.defineProperty;
|
|
@@ -32,8 +32,8 @@ function useNodeSorter() {
|
|
|
32
32
|
}
|
|
33
33
|
var defaultGroupOrder = [
|
|
34
34
|
"oidc",
|
|
35
|
-
"default",
|
|
36
35
|
"identifier_first",
|
|
36
|
+
"default",
|
|
37
37
|
"profile",
|
|
38
38
|
"password",
|
|
39
39
|
"passkey",
|
|
@@ -282,7 +282,15 @@ var de_default = {
|
|
|
282
282
|
"verification.registration-button": "Registrieren",
|
|
283
283
|
"verification.registration-label": "Sie haben noch kein Konto?",
|
|
284
284
|
"verification.title": "Verifizieren Sie ihr Konto",
|
|
285
|
-
"verification.back-button": "Zur\xFCck"
|
|
285
|
+
"verification.back-button": "Zur\xFCck",
|
|
286
|
+
"two-step.code.description": "Ein Best\xE4tigungscode wird an Ihre E-Mail gesendet.",
|
|
287
|
+
"two-step.code.title": "E-Mail-Code",
|
|
288
|
+
"two-step.passkey.description": "Verwenden Sie die Fingerabdruck- oder Gesichtserkennung Ihres Ger\xE4ts",
|
|
289
|
+
"two-step.passkey.title": "Passwort (empfohlen)",
|
|
290
|
+
"two-step.password.description": "Geben Sie Ihr Passwort ein, das mit Ihrem Konto verkn\xFCpft ist",
|
|
291
|
+
"two-step.password.title": "Passwort",
|
|
292
|
+
"two-step.webauthn.description": "Verwenden Sie Ihren Sicherheitsschl\xFCssel zur Authentifizierung",
|
|
293
|
+
"two-step.webauthn.title": "Sicherheitsschl\xFCssel"
|
|
286
294
|
};
|
|
287
295
|
|
|
288
296
|
// src/locales/en.json
|
|
@@ -460,7 +468,15 @@ var en_default = {
|
|
|
460
468
|
"verification.registration-button": "Sign up",
|
|
461
469
|
"verification.registration-label": "Don't have an account?",
|
|
462
470
|
"verification.title": "Verify your account",
|
|
463
|
-
"verification.back-button": "Back"
|
|
471
|
+
"verification.back-button": "Back",
|
|
472
|
+
"two-step.password.title": "Password",
|
|
473
|
+
"two-step.password.description": "Enter your password associated with your account",
|
|
474
|
+
"two-step.code.title": "Email code",
|
|
475
|
+
"two-step.code.description": "A verification code will be sent to your email",
|
|
476
|
+
"two-step.webauthn.title": "Security Key",
|
|
477
|
+
"two-step.webauthn.description": "Use your security key to authenticate",
|
|
478
|
+
"two-step.passkey.title": "Passkey (recommended)",
|
|
479
|
+
"two-step.passkey.description": "Use your device's for fingerprint or face recognition"
|
|
464
480
|
};
|
|
465
481
|
|
|
466
482
|
// src/locales/es.json
|
|
@@ -638,7 +654,15 @@ var es_default = {
|
|
|
638
654
|
"verification.registration-button": "Registrarse",
|
|
639
655
|
"verification.registration-label": "\xBFNo tiene una cuenta?",
|
|
640
656
|
"verification.title": "Verificar su cuenta",
|
|
641
|
-
"verification.back-button": "Regresar"
|
|
657
|
+
"verification.back-button": "Regresar",
|
|
658
|
+
"two-step.code.description": "Se enviar\xE1 un c\xF3digo de verificaci\xF3n a tu correo electr\xF3nico.",
|
|
659
|
+
"two-step.code.title": "C\xF3digo de correo electr\xF3nico",
|
|
660
|
+
"two-step.passkey.description": "Utiliza el reconocimiento de huellas dactilares o facial de tu dispositivo.",
|
|
661
|
+
"two-step.passkey.title": "Clave de acceso (recomendada)",
|
|
662
|
+
"two-step.password.description": "Ingrese la contrase\xF1a asociada con su cuenta",
|
|
663
|
+
"two-step.password.title": "Contrase\xF1a",
|
|
664
|
+
"two-step.webauthn.description": "Utiliza tu llave de seguridad para autenticarte",
|
|
665
|
+
"two-step.webauthn.title": "Clave de Seguridad"
|
|
642
666
|
};
|
|
643
667
|
|
|
644
668
|
// src/locales/fr.json
|
|
@@ -816,7 +840,15 @@ var fr_default = {
|
|
|
816
840
|
"verification.registration-button": "S'inscrire",
|
|
817
841
|
"verification.registration-label": "Vous n'avez pas de compte ?",
|
|
818
842
|
"verification.title": "V\xE9rifiez votre compte",
|
|
819
|
-
"verification.back-button": "Revenir en arri\xE8re"
|
|
843
|
+
"verification.back-button": "Revenir en arri\xE8re",
|
|
844
|
+
"two-step.code.description": "Un code de v\xE9rification sera envoy\xE9 \xE0 votre email",
|
|
845
|
+
"two-step.code.title": "Code de courrier \xE9lectronique",
|
|
846
|
+
"two-step.passkey.description": "Utilisez l'appareil pour la reconnaissance d'empreintes digitales ou de visage",
|
|
847
|
+
"two-step.passkey.title": "Cl\xE9 de passe (recommand\xE9e)",
|
|
848
|
+
"two-step.password.description": "Entrez votre mot de passe associ\xE9 \xE0 votre compte",
|
|
849
|
+
"two-step.password.title": "Mot de passe",
|
|
850
|
+
"two-step.webauthn.description": "Utilisez votre cl\xE9 de s\xE9curit\xE9 pour vous authentifier",
|
|
851
|
+
"two-step.webauthn.title": "Cl\xE9 de S\xE9curit\xE9"
|
|
820
852
|
};
|
|
821
853
|
|
|
822
854
|
// src/locales/nl.json
|
|
@@ -994,7 +1026,15 @@ var nl_default = {
|
|
|
994
1026
|
"verification.registration-button": "Registreren",
|
|
995
1027
|
"verification.registration-label": "Heb je nog geen account?",
|
|
996
1028
|
"verification.title": "Verifieer je account",
|
|
997
|
-
"verification.back-button": "Ga terug"
|
|
1029
|
+
"verification.back-button": "Ga terug",
|
|
1030
|
+
"two-step.code.description": "Een verificatiecode wordt naar uw e-mail gestuurd",
|
|
1031
|
+
"two-step.code.title": "E-mailcode",
|
|
1032
|
+
"two-step.passkey.description": "Gebruik de vingerafdruk- of gezichtsherkenning van uw apparaat",
|
|
1033
|
+
"two-step.passkey.title": "Toegangscode (aanbevolen)",
|
|
1034
|
+
"two-step.password.description": "Voer uw wachtwoord in dat is gekoppeld aan uw account",
|
|
1035
|
+
"two-step.password.title": "Wachtwoord",
|
|
1036
|
+
"two-step.webauthn.description": "Gebruik uw beveiligingssleutel om te verifi\xEBren",
|
|
1037
|
+
"two-step.webauthn.title": "Beveiligingssleutel"
|
|
998
1038
|
};
|
|
999
1039
|
|
|
1000
1040
|
// src/locales/pl.json
|
|
@@ -1172,7 +1212,15 @@ var pl_default = {
|
|
|
1172
1212
|
"verification.registration-button": "Zarejestruj si\u0119",
|
|
1173
1213
|
"verification.registration-label": "Nie posiadasz konta?",
|
|
1174
1214
|
"verification.title": "Zweryfikuj konto",
|
|
1175
|
-
"verification.back-button": "Cofnij"
|
|
1215
|
+
"verification.back-button": "Cofnij",
|
|
1216
|
+
"two-step.code.description": "Kod weryfikacyjny zostanie wys\u0142any na Tw\xF3j adres email.",
|
|
1217
|
+
"two-step.code.title": "Kod email",
|
|
1218
|
+
"two-step.passkey.description": "U\u017Cyj swojego urz\u0105dzenia lub funkcji rozpoznawania twarzy na swoim urz\u0105dzeniu.",
|
|
1219
|
+
"two-step.passkey.title": "Klucz dost\u0119pu (zalecany)",
|
|
1220
|
+
"two-step.password.description": "Wprowad\u017A has\u0142o powi\u0105zane z twoim kontem",
|
|
1221
|
+
"two-step.password.title": "Has\u0142o",
|
|
1222
|
+
"two-step.webauthn.description": "U\u017Cyj swojego klucza bezpiecze\u0144stwa do uwierzytelnienia",
|
|
1223
|
+
"two-step.webauthn.title": "Klucz bezpiecze\u0144stwa"
|
|
1176
1224
|
};
|
|
1177
1225
|
|
|
1178
1226
|
// src/locales/pt.json
|
|
@@ -1350,7 +1398,15 @@ var pt_default = {
|
|
|
1350
1398
|
"verification.registration-button": "Registar",
|
|
1351
1399
|
"verification.registration-label": "N\xE3o tem uma conta?",
|
|
1352
1400
|
"verification.title": "Verifique a sua conta",
|
|
1353
|
-
"verification.back-button": "Voltar"
|
|
1401
|
+
"verification.back-button": "Voltar",
|
|
1402
|
+
"two-step.code.description": "Um c\xF3digo de verifica\xE7\xE3o ser\xE1 enviado para o seu email",
|
|
1403
|
+
"two-step.code.title": "C\xF3digo de email",
|
|
1404
|
+
"two-step.passkey.description": "Use o seu dispositivo para reconhecimento de impress\xE3o digital ou facial.",
|
|
1405
|
+
"two-step.passkey.title": "Chave de acesso (recomendado)",
|
|
1406
|
+
"two-step.password.description": "Insira a sua senha associada \xE0 sua conta",
|
|
1407
|
+
"two-step.password.title": "Senha",
|
|
1408
|
+
"two-step.webauthn.description": "Use sua chave de seguran\xE7a para autenticar",
|
|
1409
|
+
"two-step.webauthn.title": "Chave de Seguran\xE7a"
|
|
1354
1410
|
};
|
|
1355
1411
|
|
|
1356
1412
|
// src/locales/sv.json
|
|
@@ -1384,8 +1440,8 @@ var sv_default = {
|
|
|
1384
1440
|
"identities.messages.1010013": "Forts\xE4tt",
|
|
1385
1441
|
"identities.messages.1010014": "Ett e-postmeddelande som inneh\xE5ller en kod har skickats till den e-postadress du angett. Om du inte har f\xE5tt ett mejl, kontrollera stavningen av adressen och f\xF6rs\xF6k logga in igen.",
|
|
1386
1442
|
"identities.messages.1010015": "Logga in med kod",
|
|
1387
|
-
"identities.messages.1040001": "
|
|
1388
|
-
"identities.messages.1040002": "
|
|
1443
|
+
"identities.messages.1040001": "Skapa konto",
|
|
1444
|
+
"identities.messages.1040002": "Registrera dig med {provider}",
|
|
1389
1445
|
"identities.messages.1040003": "Forts\xE4tt",
|
|
1390
1446
|
"identities.messages.1040004": "Registrera med s\xE4kerhetsnyckel",
|
|
1391
1447
|
"identities.messages.1040005": "Ett e-postmeddelande som inneh\xE5ller en kod har skickats till den e-postadress du angett. Om du inte har f\xE5tt ett e-postmeddelande, kontrollera stavningen av adressen och f\xF6rs\xF6k igen med registreringen.",
|
|
@@ -1528,7 +1584,15 @@ var sv_default = {
|
|
|
1528
1584
|
"verification.registration-button": "Skapa konto",
|
|
1529
1585
|
"verification.registration-label": "Har du inget konto?",
|
|
1530
1586
|
"verification.title": "Verifiera ditt konto",
|
|
1531
|
-
"verification.back-button": "Tillbaka"
|
|
1587
|
+
"verification.back-button": "Tillbaka",
|
|
1588
|
+
"two-step.code.description": "En verifieringskod kommer att skickas till din e-post",
|
|
1589
|
+
"two-step.code.title": "E-postkod",
|
|
1590
|
+
"two-step.passkey.description": "Anv\xE4nd din enhets fingeravtryck eller ansiktsigenk\xE4nning",
|
|
1591
|
+
"two-step.passkey.title": "Passerkod (rekommenderad)",
|
|
1592
|
+
"two-step.password.description": "Ange ditt l\xF6senord kopplat till ditt konto",
|
|
1593
|
+
"two-step.password.title": "L\xF6senord",
|
|
1594
|
+
"two-step.webauthn.description": "Anv\xE4nd din s\xE4kerhetsnyckel f\xF6r att autentisera",
|
|
1595
|
+
"two-step.webauthn.title": "S\xE4kerhetsnyckel"
|
|
1532
1596
|
};
|
|
1533
1597
|
var LanguageCodes = [
|
|
1534
1598
|
"ab",
|
|
@@ -1713,8 +1777,6 @@ function OryProvider({
|
|
|
1713
1777
|
const { locale, defaultLocale, ...oryFlowProps } = props;
|
|
1714
1778
|
return /* @__PURE__ */ jsxRuntime.jsx(IntlProvider, { locale: locale != null ? locale : "en", defaultLocale: defaultLocale != null ? defaultLocale : "en", children: /* @__PURE__ */ jsxRuntime.jsx(OryFlowProvider, { ...oryFlowProps, children: /* @__PURE__ */ jsxRuntime.jsx(OryComponentProvider, { components: Components, children }) }) });
|
|
1715
1779
|
}
|
|
1716
|
-
|
|
1717
|
-
// src/util/ui/index.ts
|
|
1718
1780
|
function triggerToWindowCall(trigger) {
|
|
1719
1781
|
if (!trigger) {
|
|
1720
1782
|
return;
|
|
@@ -1763,6 +1825,19 @@ function triggerToFunction(trigger) {
|
|
|
1763
1825
|
}
|
|
1764
1826
|
return triggerFn;
|
|
1765
1827
|
}
|
|
1828
|
+
function useNodesGroups(nodes) {
|
|
1829
|
+
const groups = react.useMemo(() => {
|
|
1830
|
+
var _a;
|
|
1831
|
+
const groups2 = {};
|
|
1832
|
+
for (const node of nodes) {
|
|
1833
|
+
const groupNodes = (_a = groups2[node.group]) != null ? _a : [];
|
|
1834
|
+
groupNodes.push(node);
|
|
1835
|
+
groups2[node.group] = groupNodes;
|
|
1836
|
+
}
|
|
1837
|
+
return groups2;
|
|
1838
|
+
}, [nodes]);
|
|
1839
|
+
return groups;
|
|
1840
|
+
}
|
|
1766
1841
|
var NodeInput = ({
|
|
1767
1842
|
node,
|
|
1768
1843
|
attributes
|
|
@@ -1797,7 +1872,6 @@ var NodeInput = ({
|
|
|
1797
1872
|
};
|
|
1798
1873
|
const isSocial = (attrs.name === "provider" || attrs.name === "link") && node.group === "oidc";
|
|
1799
1874
|
const isPinCodeInput = attrs.name === "code" && node.group === "code" || attrs.name === "totp_code" && node.group === "totp";
|
|
1800
|
-
const isCurrentIdentifier = attrs.name == "identifier" && node.group === "identifier_first" && attrs.type === "hidden";
|
|
1801
1875
|
const isResend = attrs.name === "resend" && node.group === "code";
|
|
1802
1876
|
switch (nodeType) {
|
|
1803
1877
|
case clientFetch.UiNodeInputAttributesTypeEnum.Submit:
|
|
@@ -1828,23 +1902,14 @@ var NodeInput = ({
|
|
|
1828
1902
|
}
|
|
1829
1903
|
);
|
|
1830
1904
|
case clientFetch.UiNodeInputAttributesTypeEnum.Hidden:
|
|
1831
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1840
|
-
Components.Input,
|
|
1841
|
-
{
|
|
1842
|
-
attributes: attrs,
|
|
1843
|
-
node,
|
|
1844
|
-
onClick: handleClick
|
|
1845
|
-
}
|
|
1846
|
-
)
|
|
1847
|
-
] });
|
|
1905
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1906
|
+
Components.Input,
|
|
1907
|
+
{
|
|
1908
|
+
attributes: attrs,
|
|
1909
|
+
node,
|
|
1910
|
+
onClick: handleClick
|
|
1911
|
+
}
|
|
1912
|
+
);
|
|
1848
1913
|
default:
|
|
1849
1914
|
if (isPinCodeInput) {
|
|
1850
1915
|
return /* @__PURE__ */ jsxRuntime.jsx(Components.Label, { attributes: attrs, node, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1914,8 +1979,9 @@ function OryFormSocialButtons({
|
|
|
1914
1979
|
const {
|
|
1915
1980
|
flow: { ui }
|
|
1916
1981
|
} = useOryFlow();
|
|
1982
|
+
const { setValue } = reactHookForm.useFormContext();
|
|
1917
1983
|
const filteredNodes = ui.nodes.filter((node) => node.group === "oidc");
|
|
1918
|
-
const { SocialButtonContainer, HorizontalDivider } = useComponents();
|
|
1984
|
+
const { SocialButtonContainer, HorizontalDivider, SocialButton } = useComponents();
|
|
1919
1985
|
if (filteredNodes.length === 0) {
|
|
1920
1986
|
return null;
|
|
1921
1987
|
}
|
|
@@ -1924,11 +1990,35 @@ function OryFormSocialButtons({
|
|
|
1924
1990
|
);
|
|
1925
1991
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1926
1992
|
/* @__PURE__ */ jsxRuntime.jsx(SocialButtonContainer, { nodes: filteredNodes, children: children != null ? children : filteredNodes.map((node, k) => {
|
|
1927
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1993
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1994
|
+
SocialButton,
|
|
1995
|
+
{
|
|
1996
|
+
node,
|
|
1997
|
+
attributes: node.attributes,
|
|
1998
|
+
onClick: () => {
|
|
1999
|
+
setValue(
|
|
2000
|
+
"provider",
|
|
2001
|
+
node.attributes.value
|
|
2002
|
+
);
|
|
2003
|
+
setValue("method", "oidc");
|
|
2004
|
+
}
|
|
2005
|
+
},
|
|
2006
|
+
k
|
|
2007
|
+
);
|
|
1928
2008
|
}) }),
|
|
1929
2009
|
!hideDivider && filteredNodes.length > 0 && otherNodes.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HorizontalDivider, {})
|
|
1930
2010
|
] });
|
|
1931
2011
|
}
|
|
2012
|
+
function OryFormSocialButtonsForm() {
|
|
2013
|
+
const {
|
|
2014
|
+
flow: { ui }
|
|
2015
|
+
} = useOryFlow();
|
|
2016
|
+
const filteredNodes = ui.nodes.filter((node) => node.group === "oidc");
|
|
2017
|
+
if (filteredNodes.length === 0) {
|
|
2018
|
+
return null;
|
|
2019
|
+
}
|
|
2020
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OryForm, { children: /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtons, {}) });
|
|
2021
|
+
}
|
|
1932
2022
|
|
|
1933
2023
|
// src/util/test-id.ts
|
|
1934
2024
|
function messageTestId(message) {
|
|
@@ -2000,6 +2090,19 @@ var uiTextToFormattedMessage = ({ id, context = {}, text }, intl) => {
|
|
|
2000
2090
|
contextInjectedMessage
|
|
2001
2091
|
);
|
|
2002
2092
|
};
|
|
2093
|
+
function frontendClient(sdkUrl, opts = {}) {
|
|
2094
|
+
const config = new clientFetch.Configuration({
|
|
2095
|
+
...opts,
|
|
2096
|
+
basePath: sdkUrl,
|
|
2097
|
+
headers: {
|
|
2098
|
+
Accept: "application/json",
|
|
2099
|
+
...opts.headers
|
|
2100
|
+
}
|
|
2101
|
+
});
|
|
2102
|
+
return new clientFetch.FrontendApi(config);
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
// src/util/onSubmitLogin.ts
|
|
2003
2106
|
async function onSubmitLogin({ config, flow }, {
|
|
2004
2107
|
setFlowContainer,
|
|
2005
2108
|
body,
|
|
@@ -2011,7 +2114,7 @@ async function onSubmitLogin({ config, flow }, {
|
|
|
2011
2114
|
`Please supply your Ory Network SDK url to the Ory Elements configuration.`
|
|
2012
2115
|
);
|
|
2013
2116
|
}
|
|
2014
|
-
await
|
|
2117
|
+
await frontendClient(config.sdk.url, (_a = config.sdk.options) != null ? _a : {}).updateLoginFlowRaw({
|
|
2015
2118
|
flow: flow.id,
|
|
2016
2119
|
updateLoginFlowBody: body
|
|
2017
2120
|
}).then(() => {
|
|
@@ -2044,7 +2147,7 @@ async function onSubmitSettings({ config, flow }, {
|
|
|
2044
2147
|
`Please supply your Ory Network SDK url to the Ory Elements configuration.`
|
|
2045
2148
|
);
|
|
2046
2149
|
}
|
|
2047
|
-
const client =
|
|
2150
|
+
const client = frontendClient(config.sdk.url, (_a = config.sdk.options) != null ? _a : {});
|
|
2048
2151
|
await client.updateSettingsFlowRaw({
|
|
2049
2152
|
flow: flow.id,
|
|
2050
2153
|
updateSettingsFlowBody: body
|
|
@@ -2084,7 +2187,7 @@ async function onSubmitRecovery({ config, flow }, {
|
|
|
2084
2187
|
`Please supply your Ory Network SDK url to the Ory Elements configuration.`
|
|
2085
2188
|
);
|
|
2086
2189
|
}
|
|
2087
|
-
await
|
|
2190
|
+
await frontendClient(config.sdk.url, (_a = config.sdk.options) != null ? _a : {}).updateRecoveryFlowRaw({
|
|
2088
2191
|
flow: flow.id,
|
|
2089
2192
|
updateRecoveryFlowBody: body
|
|
2090
2193
|
}).then(async (res) => {
|
|
@@ -2127,7 +2230,7 @@ async function onSubmitVerification({ config, flow }, {
|
|
|
2127
2230
|
`Please supply your Ory Network SDK URL to the Ory Elements configuration.`
|
|
2128
2231
|
);
|
|
2129
2232
|
}
|
|
2130
|
-
await
|
|
2233
|
+
await frontendClient(config.sdk.url, (_a = config.sdk.options) != null ? _a : {}).updateVerificationFlowRaw({
|
|
2131
2234
|
flow: flow.id,
|
|
2132
2235
|
updateVerificationFlowBody: body
|
|
2133
2236
|
}).then(
|
|
@@ -2163,7 +2266,7 @@ async function onSubmitRegistration({ config, flow }, {
|
|
|
2163
2266
|
`Please supply your Ory Network SDK url to the Ory Elements configuration.`
|
|
2164
2267
|
);
|
|
2165
2268
|
}
|
|
2166
|
-
const client =
|
|
2269
|
+
const client = frontendClient(config.sdk.url, (_a = config.sdk.options) != null ? _a : {});
|
|
2167
2270
|
await client.updateRegistrationFlowRaw({
|
|
2168
2271
|
flow: flow.id,
|
|
2169
2272
|
updateRegistrationFlowBody: body
|
|
@@ -2233,6 +2336,7 @@ function OryForm({ children }) {
|
|
|
2233
2336
|
if (submitData.method === "code" && data.code) {
|
|
2234
2337
|
submitData.resend = "";
|
|
2235
2338
|
}
|
|
2339
|
+
console.log(submitData);
|
|
2236
2340
|
await onSubmitLogin(flowContainer, {
|
|
2237
2341
|
onRedirect,
|
|
2238
2342
|
setFlowContainer: handleSuccess,
|
|
@@ -2344,6 +2448,108 @@ function OryCardHeader() {
|
|
|
2344
2448
|
const { CardHeader } = useComponents();
|
|
2345
2449
|
return /* @__PURE__ */ jsxRuntime.jsx(CardHeader, {});
|
|
2346
2450
|
}
|
|
2451
|
+
function isChoosingMethod(uiNodes) {
|
|
2452
|
+
return uiNodes.some(
|
|
2453
|
+
(node) => "value" in node.attributes && node.attributes.value === "profile:back"
|
|
2454
|
+
) || uiNodes.some(
|
|
2455
|
+
(node) => node.group === clientFetch.UiNodeGroupEnum.IdentifierFirst && "name" in node.attributes && node.attributes.name === "identifier" && node.attributes.type === "hidden"
|
|
2456
|
+
);
|
|
2457
|
+
}
|
|
2458
|
+
function filterZeroStepGroups(nodes) {
|
|
2459
|
+
return nodes.filter((node) => node.group !== clientFetch.UiNodeGroupEnum.Oidc);
|
|
2460
|
+
}
|
|
2461
|
+
function getFinalNodes(uniqueGroups, selectedGroup) {
|
|
2462
|
+
var _a, _b, _c;
|
|
2463
|
+
const selectedNodes = selectedGroup ? (_a = uniqueGroups[selectedGroup]) != null ? _a : [] : [];
|
|
2464
|
+
return [
|
|
2465
|
+
...(_b = uniqueGroups == null ? void 0 : uniqueGroups.identifier_first) != null ? _b : [],
|
|
2466
|
+
...(_c = uniqueGroups == null ? void 0 : uniqueGroups.default) != null ? _c : []
|
|
2467
|
+
].flat().filter(
|
|
2468
|
+
(node) => "type" in node.attributes && node.attributes.type === "hidden"
|
|
2469
|
+
).concat(selectedNodes);
|
|
2470
|
+
}
|
|
2471
|
+
function OryTwoStepCard() {
|
|
2472
|
+
var _a;
|
|
2473
|
+
const {
|
|
2474
|
+
flow: { ui },
|
|
2475
|
+
config
|
|
2476
|
+
} = useOryFlow();
|
|
2477
|
+
const choosingMethod = isChoosingMethod(ui.nodes);
|
|
2478
|
+
const [selectedGroup, setSelectedGroup] = react.useState();
|
|
2479
|
+
const Components = useComponents();
|
|
2480
|
+
const { FormGroup } = useComponents();
|
|
2481
|
+
const { flowType } = useOryFlow();
|
|
2482
|
+
const nodeSorter = useNodeSorter();
|
|
2483
|
+
const sortNodes = (a, b) => nodeSorter(a, b, { flowType });
|
|
2484
|
+
const uniqueGroups = useNodesGroups(ui.nodes);
|
|
2485
|
+
const options = Object.values(clientFetch.UiNodeGroupEnum).filter((group) => {
|
|
2486
|
+
var _a2;
|
|
2487
|
+
return (_a2 = uniqueGroups[group]) == null ? void 0 : _a2.length;
|
|
2488
|
+
}).filter(
|
|
2489
|
+
(group) => ![
|
|
2490
|
+
clientFetch.UiNodeGroupEnum.Oidc,
|
|
2491
|
+
clientFetch.UiNodeGroupEnum.Default,
|
|
2492
|
+
clientFetch.UiNodeGroupEnum.IdentifierFirst,
|
|
2493
|
+
clientFetch.UiNodeGroupEnum.Profile
|
|
2494
|
+
].includes(group)
|
|
2495
|
+
);
|
|
2496
|
+
const hasOIDC = Boolean((_a = uniqueGroups.oidc) == null ? void 0 : _a.length);
|
|
2497
|
+
const zeroStepGroups = filterZeroStepGroups(ui.nodes);
|
|
2498
|
+
const finalNodes = getFinalNodes(uniqueGroups, selectedGroup);
|
|
2499
|
+
const step = selectedGroup ? 2 /* ExecuteAuthMethod */ : choosingMethod ? 1 /* ChooseAuthMethod */ : 0 /* ProvideIdentifier */;
|
|
2500
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
|
|
2501
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
|
|
2502
|
+
/* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
|
|
2503
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
|
|
2504
|
+
step === 0 /* ProvideIdentifier */ && hasOIDC && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
|
|
2505
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryForm, { children: /* @__PURE__ */ jsxRuntime.jsxs(FormGroup, { children: [
|
|
2506
|
+
step === 0 /* ProvideIdentifier */ && zeroStepGroups.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)),
|
|
2507
|
+
step === 1 /* ChooseAuthMethod */ && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2508
|
+
flowType === clientFetch.FlowType.Login && /* @__PURE__ */ jsxRuntime.jsx(BackButton, { href: config.project.login_ui_url }),
|
|
2509
|
+
options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2510
|
+
Components.AuthMethodListItem,
|
|
2511
|
+
{
|
|
2512
|
+
group: option,
|
|
2513
|
+
onClick: () => setSelectedGroup(option)
|
|
2514
|
+
},
|
|
2515
|
+
option
|
|
2516
|
+
))
|
|
2517
|
+
] }),
|
|
2518
|
+
step === 2 /* ExecuteAuthMethod */ && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2519
|
+
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setSelectedGroup(void 0) }),
|
|
2520
|
+
finalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
|
|
2521
|
+
] })
|
|
2522
|
+
] }) })
|
|
2523
|
+
] }),
|
|
2524
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
|
|
2525
|
+
] });
|
|
2526
|
+
}
|
|
2527
|
+
var BackButton = ({ onClick, href }) => {
|
|
2528
|
+
const {
|
|
2529
|
+
flow: { ui }
|
|
2530
|
+
} = useOryFlow();
|
|
2531
|
+
const Components = useComponents();
|
|
2532
|
+
const nodeBackButton = ui.nodes.find(
|
|
2533
|
+
(node) => (
|
|
2534
|
+
// ("value" in node.attributes &&
|
|
2535
|
+
// node.attributes.value === "profile:back") ||
|
|
2536
|
+
"name" in node.attributes && node.attributes.name === "identifier" && node.group === "identifier_first"
|
|
2537
|
+
)
|
|
2538
|
+
);
|
|
2539
|
+
if (!nodeBackButton) {
|
|
2540
|
+
return null;
|
|
2541
|
+
}
|
|
2542
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2543
|
+
Components.CurrentIdentifierButton,
|
|
2544
|
+
{
|
|
2545
|
+
node: nodeBackButton,
|
|
2546
|
+
attributes: nodeBackButton.attributes,
|
|
2547
|
+
onClick,
|
|
2548
|
+
type: onClick ? "button" : void 0,
|
|
2549
|
+
href
|
|
2550
|
+
}
|
|
2551
|
+
);
|
|
2552
|
+
};
|
|
2347
2553
|
function OryCardContent({ children }) {
|
|
2348
2554
|
const { CardContent } = useComponents();
|
|
2349
2555
|
if (children) {
|
|
@@ -2351,24 +2557,21 @@ function OryCardContent({ children }) {
|
|
|
2351
2557
|
}
|
|
2352
2558
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardContent, { children: [
|
|
2353
2559
|
/* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
|
|
2354
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
}
|
|
2370
|
-
)
|
|
2371
|
-
] })
|
|
2560
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryForm, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2561
|
+
OryFormGroups,
|
|
2562
|
+
{
|
|
2563
|
+
groups: [
|
|
2564
|
+
"default",
|
|
2565
|
+
"password",
|
|
2566
|
+
"passkey",
|
|
2567
|
+
"code",
|
|
2568
|
+
"webauthn",
|
|
2569
|
+
"profile",
|
|
2570
|
+
"totp",
|
|
2571
|
+
"identifier_first"
|
|
2572
|
+
]
|
|
2573
|
+
}
|
|
2574
|
+
) })
|
|
2372
2575
|
] });
|
|
2373
2576
|
}
|
|
2374
2577
|
function OryCardFooter() {
|
|
@@ -2415,8 +2618,10 @@ exports.OryForm = OryForm;
|
|
|
2415
2618
|
exports.OryFormGroupDivider = OryFormGroupDivider;
|
|
2416
2619
|
exports.OryFormGroups = OryFormGroups;
|
|
2417
2620
|
exports.OryFormSocialButtons = OryFormSocialButtons;
|
|
2621
|
+
exports.OryFormSocialButtonsForm = OryFormSocialButtonsForm;
|
|
2418
2622
|
exports.OryLocales = locales_exports;
|
|
2419
2623
|
exports.OryProvider = OryProvider;
|
|
2624
|
+
exports.OryTwoStepCard = OryTwoStepCard;
|
|
2420
2625
|
exports.formElementId = formElementId;
|
|
2421
2626
|
exports.formLabelId = formLabelId;
|
|
2422
2627
|
exports.formatMessage = formatMessage;
|