@ory/elements-react 1.0.0-next.6 → 1.0.0-next.7
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 +19 -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 +36 -2
- package/dist/theme/default/index.css.map +1 -1
- package/dist/theme/default/index.js +265 -193
- package/dist/theme/default/index.js.map +1 -1
- package/dist/theme/default/index.mjs +274 -202
- package/dist/theme/default/index.mjs.map +1 -1
- package/package.json +10 -9
- package/tsconfig.json +4 -2
- package/test-results/.last-run.json +0 -4
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IntlContext, IntlProvider as IntlProvider$1, useIntl } from 'react-intl';
|
|
3
|
-
import { createContext, useContext, useState, useRef, useEffect } from 'react';
|
|
1
|
+
import { createContext, useContext, useState, useMemo, useRef, useEffect } from 'react';
|
|
4
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import {
|
|
3
|
+
import { IntlContext, IntlProvider as IntlProvider$1, useIntl } from 'react-intl';
|
|
4
|
+
import { useFormContext, useForm, FormProvider } from 'react-hook-form';
|
|
5
|
+
import { handleFlowError, loginUrl, FlowType, handleContinueWith, settingsUrl, recoveryUrl, verificationUrl, registrationUrl, isUiNodeInputAttributes, isUiNodeAnchorAttributes, isUiNodeImageAttributes, isUiNodeScriptAttributes, UiNodeGroupEnum, isUiNodeTextAttributes, Configuration, FrontendApi, UiNodeInputAttributesTypeEnum } from '@ory/client-fetch';
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __export = (target, all) => {
|
|
@@ -30,8 +30,8 @@ function useNodeSorter() {
|
|
|
30
30
|
}
|
|
31
31
|
var defaultGroupOrder = [
|
|
32
32
|
"oidc",
|
|
33
|
-
"default",
|
|
34
33
|
"identifier_first",
|
|
34
|
+
"default",
|
|
35
35
|
"profile",
|
|
36
36
|
"password",
|
|
37
37
|
"passkey",
|
|
@@ -280,7 +280,15 @@ var de_default = {
|
|
|
280
280
|
"verification.registration-button": "Registrieren",
|
|
281
281
|
"verification.registration-label": "Sie haben noch kein Konto?",
|
|
282
282
|
"verification.title": "Verifizieren Sie ihr Konto",
|
|
283
|
-
"verification.back-button": "Zur\xFCck"
|
|
283
|
+
"verification.back-button": "Zur\xFCck",
|
|
284
|
+
"two-step.code.description": "Ein Best\xE4tigungscode wird an Ihre E-Mail gesendet.",
|
|
285
|
+
"two-step.code.title": "E-Mail-Code",
|
|
286
|
+
"two-step.passkey.description": "Verwenden Sie die Fingerabdruck- oder Gesichtserkennung Ihres Ger\xE4ts",
|
|
287
|
+
"two-step.passkey.title": "Passwort (empfohlen)",
|
|
288
|
+
"two-step.password.description": "Geben Sie Ihr Passwort ein, das mit Ihrem Konto verkn\xFCpft ist",
|
|
289
|
+
"two-step.password.title": "Passwort",
|
|
290
|
+
"two-step.webauthn.description": "Verwenden Sie Ihren Sicherheitsschl\xFCssel zur Authentifizierung",
|
|
291
|
+
"two-step.webauthn.title": "Sicherheitsschl\xFCssel"
|
|
284
292
|
};
|
|
285
293
|
|
|
286
294
|
// src/locales/en.json
|
|
@@ -458,7 +466,15 @@ var en_default = {
|
|
|
458
466
|
"verification.registration-button": "Sign up",
|
|
459
467
|
"verification.registration-label": "Don't have an account?",
|
|
460
468
|
"verification.title": "Verify your account",
|
|
461
|
-
"verification.back-button": "Back"
|
|
469
|
+
"verification.back-button": "Back",
|
|
470
|
+
"two-step.password.title": "Password",
|
|
471
|
+
"two-step.password.description": "Enter your password associated with your account",
|
|
472
|
+
"two-step.code.title": "Email code",
|
|
473
|
+
"two-step.code.description": "A verification code will be sent to your email",
|
|
474
|
+
"two-step.webauthn.title": "Security Key",
|
|
475
|
+
"two-step.webauthn.description": "Use your security key to authenticate",
|
|
476
|
+
"two-step.passkey.title": "Passkey (recommended)",
|
|
477
|
+
"two-step.passkey.description": "Use your device's for fingerprint or face recognition"
|
|
462
478
|
};
|
|
463
479
|
|
|
464
480
|
// src/locales/es.json
|
|
@@ -636,7 +652,15 @@ var es_default = {
|
|
|
636
652
|
"verification.registration-button": "Registrarse",
|
|
637
653
|
"verification.registration-label": "\xBFNo tiene una cuenta?",
|
|
638
654
|
"verification.title": "Verificar su cuenta",
|
|
639
|
-
"verification.back-button": "Regresar"
|
|
655
|
+
"verification.back-button": "Regresar",
|
|
656
|
+
"two-step.code.description": "Se enviar\xE1 un c\xF3digo de verificaci\xF3n a tu correo electr\xF3nico.",
|
|
657
|
+
"two-step.code.title": "C\xF3digo de correo electr\xF3nico",
|
|
658
|
+
"two-step.passkey.description": "Utiliza el reconocimiento de huellas dactilares o facial de tu dispositivo.",
|
|
659
|
+
"two-step.passkey.title": "Clave de acceso (recomendada)",
|
|
660
|
+
"two-step.password.description": "Ingrese la contrase\xF1a asociada con su cuenta",
|
|
661
|
+
"two-step.password.title": "Contrase\xF1a",
|
|
662
|
+
"two-step.webauthn.description": "Utiliza tu llave de seguridad para autenticarte",
|
|
663
|
+
"two-step.webauthn.title": "Clave de Seguridad"
|
|
640
664
|
};
|
|
641
665
|
|
|
642
666
|
// src/locales/fr.json
|
|
@@ -814,7 +838,15 @@ var fr_default = {
|
|
|
814
838
|
"verification.registration-button": "S'inscrire",
|
|
815
839
|
"verification.registration-label": "Vous n'avez pas de compte ?",
|
|
816
840
|
"verification.title": "V\xE9rifiez votre compte",
|
|
817
|
-
"verification.back-button": "Revenir en arri\xE8re"
|
|
841
|
+
"verification.back-button": "Revenir en arri\xE8re",
|
|
842
|
+
"two-step.code.description": "Un code de v\xE9rification sera envoy\xE9 \xE0 votre email",
|
|
843
|
+
"two-step.code.title": "Code de courrier \xE9lectronique",
|
|
844
|
+
"two-step.passkey.description": "Utilisez l'appareil pour la reconnaissance d'empreintes digitales ou de visage",
|
|
845
|
+
"two-step.passkey.title": "Cl\xE9 de passe (recommand\xE9e)",
|
|
846
|
+
"two-step.password.description": "Entrez votre mot de passe associ\xE9 \xE0 votre compte",
|
|
847
|
+
"two-step.password.title": "Mot de passe",
|
|
848
|
+
"two-step.webauthn.description": "Utilisez votre cl\xE9 de s\xE9curit\xE9 pour vous authentifier",
|
|
849
|
+
"two-step.webauthn.title": "Cl\xE9 de S\xE9curit\xE9"
|
|
818
850
|
};
|
|
819
851
|
|
|
820
852
|
// src/locales/nl.json
|
|
@@ -992,7 +1024,15 @@ var nl_default = {
|
|
|
992
1024
|
"verification.registration-button": "Registreren",
|
|
993
1025
|
"verification.registration-label": "Heb je nog geen account?",
|
|
994
1026
|
"verification.title": "Verifieer je account",
|
|
995
|
-
"verification.back-button": "Ga terug"
|
|
1027
|
+
"verification.back-button": "Ga terug",
|
|
1028
|
+
"two-step.code.description": "Een verificatiecode wordt naar uw e-mail gestuurd",
|
|
1029
|
+
"two-step.code.title": "E-mailcode",
|
|
1030
|
+
"two-step.passkey.description": "Gebruik de vingerafdruk- of gezichtsherkenning van uw apparaat",
|
|
1031
|
+
"two-step.passkey.title": "Toegangscode (aanbevolen)",
|
|
1032
|
+
"two-step.password.description": "Voer uw wachtwoord in dat is gekoppeld aan uw account",
|
|
1033
|
+
"two-step.password.title": "Wachtwoord",
|
|
1034
|
+
"two-step.webauthn.description": "Gebruik uw beveiligingssleutel om te verifi\xEBren",
|
|
1035
|
+
"two-step.webauthn.title": "Beveiligingssleutel"
|
|
996
1036
|
};
|
|
997
1037
|
|
|
998
1038
|
// src/locales/pl.json
|
|
@@ -1170,7 +1210,15 @@ var pl_default = {
|
|
|
1170
1210
|
"verification.registration-button": "Zarejestruj si\u0119",
|
|
1171
1211
|
"verification.registration-label": "Nie posiadasz konta?",
|
|
1172
1212
|
"verification.title": "Zweryfikuj konto",
|
|
1173
|
-
"verification.back-button": "Cofnij"
|
|
1213
|
+
"verification.back-button": "Cofnij",
|
|
1214
|
+
"two-step.code.description": "Kod weryfikacyjny zostanie wys\u0142any na Tw\xF3j adres email.",
|
|
1215
|
+
"two-step.code.title": "Kod email",
|
|
1216
|
+
"two-step.passkey.description": "U\u017Cyj swojego urz\u0105dzenia lub funkcji rozpoznawania twarzy na swoim urz\u0105dzeniu.",
|
|
1217
|
+
"two-step.passkey.title": "Klucz dost\u0119pu (zalecany)",
|
|
1218
|
+
"two-step.password.description": "Wprowad\u017A has\u0142o powi\u0105zane z twoim kontem",
|
|
1219
|
+
"two-step.password.title": "Has\u0142o",
|
|
1220
|
+
"two-step.webauthn.description": "U\u017Cyj swojego klucza bezpiecze\u0144stwa do uwierzytelnienia",
|
|
1221
|
+
"two-step.webauthn.title": "Klucz bezpiecze\u0144stwa"
|
|
1174
1222
|
};
|
|
1175
1223
|
|
|
1176
1224
|
// src/locales/pt.json
|
|
@@ -1348,7 +1396,15 @@ var pt_default = {
|
|
|
1348
1396
|
"verification.registration-button": "Registar",
|
|
1349
1397
|
"verification.registration-label": "N\xE3o tem uma conta?",
|
|
1350
1398
|
"verification.title": "Verifique a sua conta",
|
|
1351
|
-
"verification.back-button": "Voltar"
|
|
1399
|
+
"verification.back-button": "Voltar",
|
|
1400
|
+
"two-step.code.description": "Um c\xF3digo de verifica\xE7\xE3o ser\xE1 enviado para o seu email",
|
|
1401
|
+
"two-step.code.title": "C\xF3digo de email",
|
|
1402
|
+
"two-step.passkey.description": "Use o seu dispositivo para reconhecimento de impress\xE3o digital ou facial.",
|
|
1403
|
+
"two-step.passkey.title": "Chave de acesso (recomendado)",
|
|
1404
|
+
"two-step.password.description": "Insira a sua senha associada \xE0 sua conta",
|
|
1405
|
+
"two-step.password.title": "Senha",
|
|
1406
|
+
"two-step.webauthn.description": "Use sua chave de seguran\xE7a para autenticar",
|
|
1407
|
+
"two-step.webauthn.title": "Chave de Seguran\xE7a"
|
|
1352
1408
|
};
|
|
1353
1409
|
|
|
1354
1410
|
// src/locales/sv.json
|
|
@@ -1382,8 +1438,8 @@ var sv_default = {
|
|
|
1382
1438
|
"identities.messages.1010013": "Forts\xE4tt",
|
|
1383
1439
|
"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.",
|
|
1384
1440
|
"identities.messages.1010015": "Logga in med kod",
|
|
1385
|
-
"identities.messages.1040001": "
|
|
1386
|
-
"identities.messages.1040002": "
|
|
1441
|
+
"identities.messages.1040001": "Skapa konto",
|
|
1442
|
+
"identities.messages.1040002": "Registrera dig med {provider}",
|
|
1387
1443
|
"identities.messages.1040003": "Forts\xE4tt",
|
|
1388
1444
|
"identities.messages.1040004": "Registrera med s\xE4kerhetsnyckel",
|
|
1389
1445
|
"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.",
|
|
@@ -1526,7 +1582,15 @@ var sv_default = {
|
|
|
1526
1582
|
"verification.registration-button": "Skapa konto",
|
|
1527
1583
|
"verification.registration-label": "Har du inget konto?",
|
|
1528
1584
|
"verification.title": "Verifiera ditt konto",
|
|
1529
|
-
"verification.back-button": "Tillbaka"
|
|
1585
|
+
"verification.back-button": "Tillbaka",
|
|
1586
|
+
"two-step.code.description": "En verifieringskod kommer att skickas till din e-post",
|
|
1587
|
+
"two-step.code.title": "E-postkod",
|
|
1588
|
+
"two-step.passkey.description": "Anv\xE4nd din enhets fingeravtryck eller ansiktsigenk\xE4nning",
|
|
1589
|
+
"two-step.passkey.title": "Passerkod (rekommenderad)",
|
|
1590
|
+
"two-step.password.description": "Ange ditt l\xF6senord kopplat till ditt konto",
|
|
1591
|
+
"two-step.password.title": "L\xF6senord",
|
|
1592
|
+
"two-step.webauthn.description": "Anv\xE4nd din s\xE4kerhetsnyckel f\xF6r att autentisera",
|
|
1593
|
+
"two-step.webauthn.title": "S\xE4kerhetsnyckel"
|
|
1530
1594
|
};
|
|
1531
1595
|
var LanguageCodes = [
|
|
1532
1596
|
"ab",
|
|
@@ -1711,8 +1775,6 @@ function OryProvider({
|
|
|
1711
1775
|
const { locale, defaultLocale, ...oryFlowProps } = props;
|
|
1712
1776
|
return /* @__PURE__ */ jsx(IntlProvider, { locale: locale != null ? locale : "en", defaultLocale: defaultLocale != null ? defaultLocale : "en", children: /* @__PURE__ */ jsx(OryFlowProvider, { ...oryFlowProps, children: /* @__PURE__ */ jsx(OryComponentProvider, { components: Components, children }) }) });
|
|
1713
1777
|
}
|
|
1714
|
-
|
|
1715
|
-
// src/util/ui/index.ts
|
|
1716
1778
|
function triggerToWindowCall(trigger) {
|
|
1717
1779
|
if (!trigger) {
|
|
1718
1780
|
return;
|
|
@@ -1761,6 +1823,19 @@ function triggerToFunction(trigger) {
|
|
|
1761
1823
|
}
|
|
1762
1824
|
return triggerFn;
|
|
1763
1825
|
}
|
|
1826
|
+
function useNodesGroups(nodes) {
|
|
1827
|
+
const groups = useMemo(() => {
|
|
1828
|
+
var _a;
|
|
1829
|
+
const groups2 = {};
|
|
1830
|
+
for (const node of nodes) {
|
|
1831
|
+
const groupNodes = (_a = groups2[node.group]) != null ? _a : [];
|
|
1832
|
+
groupNodes.push(node);
|
|
1833
|
+
groups2[node.group] = groupNodes;
|
|
1834
|
+
}
|
|
1835
|
+
return groups2;
|
|
1836
|
+
}, [nodes]);
|
|
1837
|
+
return groups;
|
|
1838
|
+
}
|
|
1764
1839
|
var NodeInput = ({
|
|
1765
1840
|
node,
|
|
1766
1841
|
attributes
|
|
@@ -1795,7 +1870,6 @@ var NodeInput = ({
|
|
|
1795
1870
|
};
|
|
1796
1871
|
const isSocial = (attrs.name === "provider" || attrs.name === "link") && node.group === "oidc";
|
|
1797
1872
|
const isPinCodeInput = attrs.name === "code" && node.group === "code" || attrs.name === "totp_code" && node.group === "totp";
|
|
1798
|
-
const isCurrentIdentifier = attrs.name == "identifier" && node.group === "identifier_first" && attrs.type === "hidden";
|
|
1799
1873
|
const isResend = attrs.name === "resend" && node.group === "code";
|
|
1800
1874
|
switch (nodeType) {
|
|
1801
1875
|
case UiNodeInputAttributesTypeEnum.Submit:
|
|
@@ -1826,23 +1900,14 @@ var NodeInput = ({
|
|
|
1826
1900
|
}
|
|
1827
1901
|
);
|
|
1828
1902
|
case UiNodeInputAttributesTypeEnum.Hidden:
|
|
1829
|
-
return /* @__PURE__ */
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
/* @__PURE__ */ jsx(
|
|
1838
|
-
Components.Input,
|
|
1839
|
-
{
|
|
1840
|
-
attributes: attrs,
|
|
1841
|
-
node,
|
|
1842
|
-
onClick: handleClick
|
|
1843
|
-
}
|
|
1844
|
-
)
|
|
1845
|
-
] });
|
|
1903
|
+
return /* @__PURE__ */ jsx(
|
|
1904
|
+
Components.Input,
|
|
1905
|
+
{
|
|
1906
|
+
attributes: attrs,
|
|
1907
|
+
node,
|
|
1908
|
+
onClick: handleClick
|
|
1909
|
+
}
|
|
1910
|
+
);
|
|
1846
1911
|
default:
|
|
1847
1912
|
if (isPinCodeInput) {
|
|
1848
1913
|
return /* @__PURE__ */ jsx(Components.Label, { attributes: attrs, node, children: /* @__PURE__ */ jsx(
|
|
@@ -1912,8 +1977,9 @@ function OryFormSocialButtons({
|
|
|
1912
1977
|
const {
|
|
1913
1978
|
flow: { ui }
|
|
1914
1979
|
} = useOryFlow();
|
|
1980
|
+
const { setValue } = useFormContext();
|
|
1915
1981
|
const filteredNodes = ui.nodes.filter((node) => node.group === "oidc");
|
|
1916
|
-
const { SocialButtonContainer, HorizontalDivider } = useComponents();
|
|
1982
|
+
const { SocialButtonContainer, HorizontalDivider, SocialButton } = useComponents();
|
|
1917
1983
|
if (filteredNodes.length === 0) {
|
|
1918
1984
|
return null;
|
|
1919
1985
|
}
|
|
@@ -1922,11 +1988,35 @@ function OryFormSocialButtons({
|
|
|
1922
1988
|
);
|
|
1923
1989
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1924
1990
|
/* @__PURE__ */ jsx(SocialButtonContainer, { nodes: filteredNodes, children: children != null ? children : filteredNodes.map((node, k) => {
|
|
1925
|
-
return /* @__PURE__ */ jsx(
|
|
1991
|
+
return /* @__PURE__ */ jsx(
|
|
1992
|
+
SocialButton,
|
|
1993
|
+
{
|
|
1994
|
+
node,
|
|
1995
|
+
attributes: node.attributes,
|
|
1996
|
+
onClick: () => {
|
|
1997
|
+
setValue(
|
|
1998
|
+
"provider",
|
|
1999
|
+
node.attributes.value
|
|
2000
|
+
);
|
|
2001
|
+
setValue("method", "oidc");
|
|
2002
|
+
}
|
|
2003
|
+
},
|
|
2004
|
+
k
|
|
2005
|
+
);
|
|
1926
2006
|
}) }),
|
|
1927
2007
|
!hideDivider && filteredNodes.length > 0 && otherNodes.length > 0 && /* @__PURE__ */ jsx(HorizontalDivider, {})
|
|
1928
2008
|
] });
|
|
1929
2009
|
}
|
|
2010
|
+
function OryFormSocialButtonsForm() {
|
|
2011
|
+
const {
|
|
2012
|
+
flow: { ui }
|
|
2013
|
+
} = useOryFlow();
|
|
2014
|
+
const filteredNodes = ui.nodes.filter((node) => node.group === "oidc");
|
|
2015
|
+
if (filteredNodes.length === 0) {
|
|
2016
|
+
return null;
|
|
2017
|
+
}
|
|
2018
|
+
return /* @__PURE__ */ jsx(OryForm, { children: /* @__PURE__ */ jsx(OryFormSocialButtons, {}) });
|
|
2019
|
+
}
|
|
1930
2020
|
|
|
1931
2021
|
// src/util/test-id.ts
|
|
1932
2022
|
function messageTestId(message) {
|
|
@@ -1998,6 +2088,19 @@ var uiTextToFormattedMessage = ({ id, context = {}, text }, intl) => {
|
|
|
1998
2088
|
contextInjectedMessage
|
|
1999
2089
|
);
|
|
2000
2090
|
};
|
|
2091
|
+
function frontendClient(sdkUrl, opts = {}) {
|
|
2092
|
+
const config = new Configuration({
|
|
2093
|
+
...opts,
|
|
2094
|
+
basePath: sdkUrl,
|
|
2095
|
+
headers: {
|
|
2096
|
+
Accept: "application/json",
|
|
2097
|
+
...opts.headers
|
|
2098
|
+
}
|
|
2099
|
+
});
|
|
2100
|
+
return new FrontendApi(config);
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
// src/util/onSubmitLogin.ts
|
|
2001
2104
|
async function onSubmitLogin({ config, flow }, {
|
|
2002
2105
|
setFlowContainer,
|
|
2003
2106
|
body,
|
|
@@ -2231,6 +2334,7 @@ function OryForm({ children }) {
|
|
|
2231
2334
|
if (submitData.method === "code" && data.code) {
|
|
2232
2335
|
submitData.resend = "";
|
|
2233
2336
|
}
|
|
2337
|
+
console.log(submitData);
|
|
2234
2338
|
await onSubmitLogin(flowContainer, {
|
|
2235
2339
|
onRedirect,
|
|
2236
2340
|
setFlowContainer: handleSuccess,
|
|
@@ -2342,6 +2446,108 @@ function OryCardHeader() {
|
|
|
2342
2446
|
const { CardHeader } = useComponents();
|
|
2343
2447
|
return /* @__PURE__ */ jsx(CardHeader, {});
|
|
2344
2448
|
}
|
|
2449
|
+
function isChoosingMethod(uiNodes) {
|
|
2450
|
+
return uiNodes.some(
|
|
2451
|
+
(node) => "value" in node.attributes && node.attributes.value === "profile:back"
|
|
2452
|
+
) || uiNodes.some(
|
|
2453
|
+
(node) => node.group === UiNodeGroupEnum.IdentifierFirst && "name" in node.attributes && node.attributes.name === "identifier" && node.attributes.type === "hidden"
|
|
2454
|
+
);
|
|
2455
|
+
}
|
|
2456
|
+
function filterZeroStepGroups(nodes) {
|
|
2457
|
+
return nodes.filter((node) => node.group !== UiNodeGroupEnum.Oidc);
|
|
2458
|
+
}
|
|
2459
|
+
function getFinalNodes(uniqueGroups, selectedGroup) {
|
|
2460
|
+
var _a, _b, _c;
|
|
2461
|
+
const selectedNodes = selectedGroup ? (_a = uniqueGroups[selectedGroup]) != null ? _a : [] : [];
|
|
2462
|
+
return [
|
|
2463
|
+
...(_b = uniqueGroups == null ? void 0 : uniqueGroups.identifier_first) != null ? _b : [],
|
|
2464
|
+
...(_c = uniqueGroups == null ? void 0 : uniqueGroups.default) != null ? _c : []
|
|
2465
|
+
].flat().filter(
|
|
2466
|
+
(node) => "type" in node.attributes && node.attributes.type === "hidden"
|
|
2467
|
+
).concat(selectedNodes);
|
|
2468
|
+
}
|
|
2469
|
+
function OryTwoStepCard() {
|
|
2470
|
+
var _a;
|
|
2471
|
+
const {
|
|
2472
|
+
flow: { ui },
|
|
2473
|
+
config
|
|
2474
|
+
} = useOryFlow();
|
|
2475
|
+
const choosingMethod = isChoosingMethod(ui.nodes);
|
|
2476
|
+
const [selectedGroup, setSelectedGroup] = useState();
|
|
2477
|
+
const Components = useComponents();
|
|
2478
|
+
const { FormGroup } = useComponents();
|
|
2479
|
+
const { flowType } = useOryFlow();
|
|
2480
|
+
const nodeSorter = useNodeSorter();
|
|
2481
|
+
const sortNodes = (a, b) => nodeSorter(a, b, { flowType });
|
|
2482
|
+
const uniqueGroups = useNodesGroups(ui.nodes);
|
|
2483
|
+
const options = Object.values(UiNodeGroupEnum).filter((group) => {
|
|
2484
|
+
var _a2;
|
|
2485
|
+
return (_a2 = uniqueGroups[group]) == null ? void 0 : _a2.length;
|
|
2486
|
+
}).filter(
|
|
2487
|
+
(group) => ![
|
|
2488
|
+
UiNodeGroupEnum.Oidc,
|
|
2489
|
+
UiNodeGroupEnum.Default,
|
|
2490
|
+
UiNodeGroupEnum.IdentifierFirst,
|
|
2491
|
+
UiNodeGroupEnum.Profile
|
|
2492
|
+
].includes(group)
|
|
2493
|
+
);
|
|
2494
|
+
const hasOIDC = Boolean((_a = uniqueGroups.oidc) == null ? void 0 : _a.length);
|
|
2495
|
+
const zeroStepGroups = filterZeroStepGroups(ui.nodes);
|
|
2496
|
+
const finalNodes = getFinalNodes(uniqueGroups, selectedGroup);
|
|
2497
|
+
const step = selectedGroup ? 2 /* ExecuteAuthMethod */ : choosingMethod ? 1 /* ChooseAuthMethod */ : 0 /* ProvideIdentifier */;
|
|
2498
|
+
return /* @__PURE__ */ jsxs(OryCard, { children: [
|
|
2499
|
+
/* @__PURE__ */ jsx(OryCardHeader, {}),
|
|
2500
|
+
/* @__PURE__ */ jsxs(OryCardContent, { children: [
|
|
2501
|
+
/* @__PURE__ */ jsx(OryCardValidationMessages, {}),
|
|
2502
|
+
step === 0 /* ProvideIdentifier */ && hasOIDC && /* @__PURE__ */ jsx(OryFormSocialButtonsForm, {}),
|
|
2503
|
+
/* @__PURE__ */ jsx(OryForm, { children: /* @__PURE__ */ jsxs(FormGroup, { children: [
|
|
2504
|
+
step === 0 /* ProvideIdentifier */ && zeroStepGroups.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k)),
|
|
2505
|
+
step === 1 /* ChooseAuthMethod */ && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2506
|
+
flowType === FlowType.Login && /* @__PURE__ */ jsx(BackButton, { href: config.project.login_ui_url }),
|
|
2507
|
+
options.map((option) => /* @__PURE__ */ jsx(
|
|
2508
|
+
Components.AuthMethodListItem,
|
|
2509
|
+
{
|
|
2510
|
+
group: option,
|
|
2511
|
+
onClick: () => setSelectedGroup(option)
|
|
2512
|
+
},
|
|
2513
|
+
option
|
|
2514
|
+
))
|
|
2515
|
+
] }),
|
|
2516
|
+
step === 2 /* ExecuteAuthMethod */ && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2517
|
+
/* @__PURE__ */ jsx(BackButton, { onClick: () => setSelectedGroup(void 0) }),
|
|
2518
|
+
finalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
|
|
2519
|
+
] })
|
|
2520
|
+
] }) })
|
|
2521
|
+
] }),
|
|
2522
|
+
/* @__PURE__ */ jsx(OryCardFooter, {})
|
|
2523
|
+
] });
|
|
2524
|
+
}
|
|
2525
|
+
var BackButton = ({ onClick, href }) => {
|
|
2526
|
+
const {
|
|
2527
|
+
flow: { ui }
|
|
2528
|
+
} = useOryFlow();
|
|
2529
|
+
const Components = useComponents();
|
|
2530
|
+
const nodeBackButton = ui.nodes.find(
|
|
2531
|
+
(node) => (
|
|
2532
|
+
// ("value" in node.attributes &&
|
|
2533
|
+
// node.attributes.value === "profile:back") ||
|
|
2534
|
+
"name" in node.attributes && node.attributes.name === "identifier" && node.group === "identifier_first"
|
|
2535
|
+
)
|
|
2536
|
+
);
|
|
2537
|
+
if (!nodeBackButton) {
|
|
2538
|
+
return null;
|
|
2539
|
+
}
|
|
2540
|
+
return /* @__PURE__ */ jsx(
|
|
2541
|
+
Components.CurrentIdentifierButton,
|
|
2542
|
+
{
|
|
2543
|
+
node: nodeBackButton,
|
|
2544
|
+
attributes: nodeBackButton.attributes,
|
|
2545
|
+
onClick,
|
|
2546
|
+
type: onClick ? "button" : void 0,
|
|
2547
|
+
href
|
|
2548
|
+
}
|
|
2549
|
+
);
|
|
2550
|
+
};
|
|
2345
2551
|
function OryCardContent({ children }) {
|
|
2346
2552
|
const { CardContent } = useComponents();
|
|
2347
2553
|
if (children) {
|
|
@@ -2349,24 +2555,21 @@ function OryCardContent({ children }) {
|
|
|
2349
2555
|
}
|
|
2350
2556
|
return /* @__PURE__ */ jsxs(CardContent, { children: [
|
|
2351
2557
|
/* @__PURE__ */ jsx(OryCardValidationMessages, {}),
|
|
2352
|
-
/* @__PURE__ */
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
}
|
|
2368
|
-
)
|
|
2369
|
-
] })
|
|
2558
|
+
/* @__PURE__ */ jsx(OryForm, { children: /* @__PURE__ */ jsx(
|
|
2559
|
+
OryFormGroups,
|
|
2560
|
+
{
|
|
2561
|
+
groups: [
|
|
2562
|
+
"default",
|
|
2563
|
+
"password",
|
|
2564
|
+
"passkey",
|
|
2565
|
+
"code",
|
|
2566
|
+
"webauthn",
|
|
2567
|
+
"profile",
|
|
2568
|
+
"totp",
|
|
2569
|
+
"identifier_first"
|
|
2570
|
+
]
|
|
2571
|
+
}
|
|
2572
|
+
) })
|
|
2370
2573
|
] });
|
|
2371
2574
|
}
|
|
2372
2575
|
function OryCardFooter() {
|
|
@@ -2399,6 +2602,6 @@ function OryFormGroupDivider() {
|
|
|
2399
2602
|
return null;
|
|
2400
2603
|
}
|
|
2401
2604
|
|
|
2402
|
-
export { HeadlessMessage, IntlProvider, LanguageCodes, OryCard, OryCardContent, OryCardFooter, OryCardHeader, OryCardValidationMessages, OryComponentProvider, OryFlowProvider, OryForm, OryFormGroupDivider, OryFormGroups, OryFormSocialButtons, locales_exports as OryLocales, OryProvider, formElementId, formLabelId, formatMessage, isCustomTranslations, messageTestId, onSubmitLogin, onSubmitRecovery, onSubmitRegistration, onSubmitSettings, onSubmitVerification, uiTextToFormattedMessage, useComponents, useNodeSorter, useOryFlow };
|
|
2605
|
+
export { HeadlessMessage, IntlProvider, LanguageCodes, OryCard, OryCardContent, OryCardFooter, OryCardHeader, OryCardValidationMessages, OryComponentProvider, OryFlowProvider, OryForm, OryFormGroupDivider, OryFormGroups, OryFormSocialButtons, OryFormSocialButtonsForm, locales_exports as OryLocales, OryProvider, OryTwoStepCard, formElementId, formLabelId, formatMessage, isCustomTranslations, messageTestId, onSubmitLogin, onSubmitRecovery, onSubmitRegistration, onSubmitSettings, onSubmitVerification, uiTextToFormattedMessage, useComponents, useNodeSorter, useOryFlow };
|
|
2403
2606
|
//# sourceMappingURL=index.mjs.map
|
|
2404
2607
|
//# sourceMappingURL=index.mjs.map
|