@ory/elements-react 0.0.0-pr.f1435f4 → 0.0.0-pr.f1d09ee2
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 +14 -0
- package/dist/index.d.mts +13 -7
- package/dist/index.d.ts +13 -7
- package/dist/index.js +263 -185
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +264 -186
- package/dist/index.mjs.map +1 -1
- package/dist/theme/default/index.css +12 -6
- package/dist/theme/default/index.css.map +1 -1
- package/dist/theme/default/index.js +3141 -3032
- package/dist/theme/default/index.js.map +1 -1
- package/dist/theme/default/index.mjs +3185 -3073
- package/dist/theme/default/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -94,28 +94,10 @@ function OryComponentProvider({
|
|
|
94
94
|
}
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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);
|
|
97
|
+
|
|
98
|
+
// src/theme/default/utils/form.ts
|
|
99
|
+
function isGroupImmediateSubmit(group) {
|
|
100
|
+
return group === "code";
|
|
119
101
|
}
|
|
120
102
|
function triggerToWindowCall(trigger) {
|
|
121
103
|
if (!trigger) {
|
|
@@ -227,6 +209,93 @@ function useNodesGroups(nodes, { omit } = {}) {
|
|
|
227
209
|
var findNode = (nodes, opt) => nodes.find((n) => {
|
|
228
210
|
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
211
|
});
|
|
212
|
+
function useFunctionalNodes(nodes) {
|
|
213
|
+
return nodes.filter(
|
|
214
|
+
({ group }) => [
|
|
215
|
+
clientFetch.UiNodeGroupEnum.Default,
|
|
216
|
+
clientFetch.UiNodeGroupEnum.IdentifierFirst,
|
|
217
|
+
clientFetch.UiNodeGroupEnum.Profile,
|
|
218
|
+
clientFetch.UiNodeGroupEnum.Captcha
|
|
219
|
+
].includes(group)
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
function isUiNodeGroupEnum(method) {
|
|
223
|
+
return Object.values(clientFetch.UiNodeGroupEnum).includes(method);
|
|
224
|
+
}
|
|
225
|
+
function isSingleSignOnNode(node) {
|
|
226
|
+
return node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml;
|
|
227
|
+
}
|
|
228
|
+
function hasSingleSignOnNodes(nodes) {
|
|
229
|
+
return nodes.some(isSingleSignOnNode);
|
|
230
|
+
}
|
|
231
|
+
function withoutSingleSignOnNodes(nodes) {
|
|
232
|
+
return nodes.filter((node) => !isSingleSignOnNode(node));
|
|
233
|
+
}
|
|
234
|
+
function isNodeVisible(node) {
|
|
235
|
+
if (clientFetch.isUiNodeScriptAttributes(node.attributes)) {
|
|
236
|
+
return false;
|
|
237
|
+
} else if (clientFetch.isUiNodeInputAttributes(node.attributes)) {
|
|
238
|
+
if (node.attributes.type === "hidden") {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
function useNodeGroupsWithVisibleNodes(nodes) {
|
|
245
|
+
return react.useMemo(() => {
|
|
246
|
+
var _a, _b;
|
|
247
|
+
const groups = {};
|
|
248
|
+
const groupRetained = {};
|
|
249
|
+
for (const node of nodes) {
|
|
250
|
+
const groupNodes = (_a = groups[node.group]) != null ? _a : [];
|
|
251
|
+
const groupCount = (_b = groupRetained[node.group]) != null ? _b : 0;
|
|
252
|
+
groupNodes.push(node);
|
|
253
|
+
groups[node.group] = groupNodes;
|
|
254
|
+
if (!isNodeVisible(node)) {
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
groupRetained[node.group] = groupCount + 1;
|
|
258
|
+
}
|
|
259
|
+
const finalGroups = {};
|
|
260
|
+
for (const [group, count] of Object.entries(groupRetained)) {
|
|
261
|
+
if (count > 0) {
|
|
262
|
+
finalGroups[group] = groups[group];
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return finalGroups;
|
|
266
|
+
}, [nodes]);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// src/components/card/two-step/utils.ts
|
|
270
|
+
function isChoosingMethod(flow) {
|
|
271
|
+
return flow.flow.ui.nodes.some(
|
|
272
|
+
(node) => "name" in node.attributes && node.attributes.name === "screen" && "value" in node.attributes && node.attributes.value === "previous"
|
|
273
|
+
) || flow.flow.ui.nodes.some(
|
|
274
|
+
(node) => node.group === clientFetch.UiNodeGroupEnum.IdentifierFirst && "name" in node.attributes && node.attributes.name === "identifier" && node.attributes.type === "hidden"
|
|
275
|
+
) || flow.flowType === clientFetch.FlowType.Login && flow.flow.requested_aal === "aal2";
|
|
276
|
+
}
|
|
277
|
+
function getFinalNodes(uniqueGroups, selectedGroup) {
|
|
278
|
+
var _a, _b, _c, _d;
|
|
279
|
+
const selectedNodes = selectedGroup ? (_a = uniqueGroups[selectedGroup]) != null ? _a : [] : [];
|
|
280
|
+
return [
|
|
281
|
+
...(_b = uniqueGroups == null ? void 0 : uniqueGroups.identifier_first) != null ? _b : [],
|
|
282
|
+
...(_c = uniqueGroups == null ? void 0 : uniqueGroups.default) != null ? _c : [],
|
|
283
|
+
...(_d = uniqueGroups == null ? void 0 : uniqueGroups.captcha) != null ? _d : []
|
|
284
|
+
].flat().filter(
|
|
285
|
+
(node) => "type" in node.attributes && node.attributes.type === "hidden"
|
|
286
|
+
).concat(selectedNodes);
|
|
287
|
+
}
|
|
288
|
+
var handleAfterFormSubmit = (dispatchFormState) => (method) => {
|
|
289
|
+
if (typeof method !== "string" || !isUiNodeGroupEnum(method)) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (isGroupImmediateSubmit(method)) {
|
|
293
|
+
dispatchFormState({
|
|
294
|
+
type: "action_select_method",
|
|
295
|
+
method
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
};
|
|
230
299
|
|
|
231
300
|
// src/context/form-state.ts
|
|
232
301
|
function findMethodWithMessage(nodes) {
|
|
@@ -492,11 +561,6 @@ function OryCardContent({ children }) {
|
|
|
492
561
|
const { Card } = useComponents();
|
|
493
562
|
return /* @__PURE__ */ jsxRuntime.jsx(Card.Content, { children });
|
|
494
563
|
}
|
|
495
|
-
|
|
496
|
-
// src/theme/default/utils/form.ts
|
|
497
|
-
function isGroupImmediateSubmit(group) {
|
|
498
|
-
return group === "code";
|
|
499
|
-
}
|
|
500
564
|
function frontendClient(sdkUrl, opts = {}) {
|
|
501
565
|
const config = new clientFetch.Configuration({
|
|
502
566
|
...opts,
|
|
@@ -894,6 +958,9 @@ function OryForm({
|
|
|
894
958
|
const onSubmit = useOryFormSubmit(onAfterSubmit);
|
|
895
959
|
const hasMethods = flowContainer.flow.ui.nodes.some((node) => {
|
|
896
960
|
if (clientFetch.isUiNodeInputAttributes(node.attributes)) {
|
|
961
|
+
if (node.attributes.type === "hidden") {
|
|
962
|
+
return false;
|
|
963
|
+
}
|
|
897
964
|
return node.attributes.name !== "csrf_token";
|
|
898
965
|
} else if (clientFetch.isUiNodeAnchorAttributes(node.attributes)) {
|
|
899
966
|
return true;
|
|
@@ -915,7 +982,7 @@ function OryForm({
|
|
|
915
982
|
};
|
|
916
983
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": dataTestId, children: /* @__PURE__ */ jsxRuntime.jsx(Message.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(Message.Content, { message: m }, m.id) }) });
|
|
917
984
|
}
|
|
918
|
-
if (flowContainer.flowType === clientFetch.FlowType.Login && flowContainer.formState.current === "method_active" && flowContainer.formState.method === "code") {
|
|
985
|
+
if ((flowContainer.flowType === clientFetch.FlowType.Login || flowContainer.flowType === clientFetch.FlowType.Registration) && flowContainer.formState.current === "method_active" && flowContainer.formState.method === "code") {
|
|
919
986
|
methods.setValue("method", "code");
|
|
920
987
|
}
|
|
921
988
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -968,9 +1035,15 @@ var NodeInput = ({
|
|
|
968
1035
|
} = attributes;
|
|
969
1036
|
const isResendNode = ((_a = node.meta.label) == null ? void 0 : _a.id) === 1070008;
|
|
970
1037
|
const isScreenSelectionNode = "name" in node.attributes && node.attributes.name === "screen";
|
|
1038
|
+
const setFormValue = () => {
|
|
1039
|
+
if (attrs.value && !(isResendNode || isScreenSelectionNode || node.group === clientFetch.UiNodeGroupEnum.Oauth2Consent)) {
|
|
1040
|
+
setValue(attrs.name, attrs.value);
|
|
1041
|
+
}
|
|
1042
|
+
};
|
|
971
1043
|
const hasRun = react.useRef(false);
|
|
972
1044
|
react.useEffect(
|
|
973
1045
|
() => {
|
|
1046
|
+
setFormValue();
|
|
974
1047
|
if (!hasRun.current && onloadTrigger) {
|
|
975
1048
|
hasRun.current = true;
|
|
976
1049
|
triggerToWindowCall(onloadTrigger);
|
|
@@ -981,6 +1054,7 @@ var NodeInput = ({
|
|
|
981
1054
|
[]
|
|
982
1055
|
);
|
|
983
1056
|
const handleClick = () => {
|
|
1057
|
+
setFormValue();
|
|
984
1058
|
if (onclickTrigger) {
|
|
985
1059
|
triggerToWindowCall(onclickTrigger);
|
|
986
1060
|
}
|
|
@@ -1106,7 +1180,7 @@ function OryFormOidcButtons() {
|
|
|
1106
1180
|
if (filteredNodes.length === 0) {
|
|
1107
1181
|
return null;
|
|
1108
1182
|
}
|
|
1109
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Form.OidcRoot, { nodes: filteredNodes, children: filteredNodes.map((node
|
|
1183
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Form.OidcRoot, { nodes: filteredNodes, children: filteredNodes.map((node) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1110
1184
|
Node2.OidcButton,
|
|
1111
1185
|
{
|
|
1112
1186
|
node,
|
|
@@ -1119,7 +1193,7 @@ function OryFormOidcButtons() {
|
|
|
1119
1193
|
setValue("method", node.group);
|
|
1120
1194
|
}
|
|
1121
1195
|
},
|
|
1122
|
-
|
|
1196
|
+
clientFetch.getNodeId(node)
|
|
1123
1197
|
)) });
|
|
1124
1198
|
}
|
|
1125
1199
|
function OryFormSocialButtonsForm() {
|
|
@@ -1134,24 +1208,104 @@ function OryFormSocialButtonsForm() {
|
|
|
1134
1208
|
}
|
|
1135
1209
|
return /* @__PURE__ */ jsxRuntime.jsx(OryFormProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(OryForm, { "data-testid": `ory/form/methods/oidc-saml`, children: /* @__PURE__ */ jsxRuntime.jsx(OryFormOidcButtons, {}) }) });
|
|
1136
1210
|
}
|
|
1137
|
-
function
|
|
1138
|
-
|
|
1211
|
+
function OryTwoStepCardStateMethodActive({
|
|
1212
|
+
formState
|
|
1213
|
+
}) {
|
|
1214
|
+
const { Form } = useComponents();
|
|
1215
|
+
const { flow, flowType, dispatchFormState } = useOryFlow();
|
|
1216
|
+
const { ui } = flow;
|
|
1217
|
+
const nodeSorter = useNodeSorter();
|
|
1218
|
+
const sortNodes = (a, b) => nodeSorter(a, b, { flowType });
|
|
1219
|
+
const groupsToShow = useNodeGroupsWithVisibleNodes(ui.nodes);
|
|
1220
|
+
const finalNodes = getFinalNodes(groupsToShow, formState.method);
|
|
1221
|
+
const selectedMethodIsSocial = formState.method === clientFetch.UiNodeGroupEnum.Oidc || formState.method === clientFetch.UiNodeGroupEnum.Saml;
|
|
1222
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
|
|
1223
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
|
|
1224
|
+
/* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
|
|
1225
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
|
|
1226
|
+
selectedMethodIsSocial && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
|
|
1227
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1228
|
+
OryForm,
|
|
1229
|
+
{
|
|
1230
|
+
"data-testid": `ory/form/methods/local`,
|
|
1231
|
+
onAfterSubmit: handleAfterFormSubmit(dispatchFormState),
|
|
1232
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
|
|
1233
|
+
ui.nodes.filter(
|
|
1234
|
+
(n) => clientFetch.isUiNodeScriptAttributes(n.attributes) || n.group === clientFetch.UiNodeGroupEnum.Captcha || n.group === clientFetch.UiNodeGroupEnum.Default || n.group === clientFetch.UiNodeGroupEnum.Profile
|
|
1235
|
+
).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)),
|
|
1236
|
+
finalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
|
|
1237
|
+
] })
|
|
1238
|
+
}
|
|
1239
|
+
)
|
|
1240
|
+
] }),
|
|
1241
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
|
|
1242
|
+
] });
|
|
1139
1243
|
}
|
|
1140
|
-
function
|
|
1141
|
-
var _a, _b, _c, _d;
|
|
1244
|
+
function OryTwoStepCardStateProvideIdentifier() {
|
|
1142
1245
|
const { Form, Card } = useComponents();
|
|
1143
|
-
const {
|
|
1144
|
-
const { ui } = flow;
|
|
1246
|
+
const { flowType, flow, dispatchFormState } = useOryFlow();
|
|
1145
1247
|
const nodeSorter = useNodeSorter();
|
|
1146
1248
|
const sortNodes = (a, b) => nodeSorter(a, b, { flowType });
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
const
|
|
1249
|
+
const nonSsoNodes = withoutSingleSignOnNodes(flow.ui.nodes).sort(sortNodes);
|
|
1250
|
+
const hasSso = flow.ui.nodes.filter(isNodeVisible).some(
|
|
1251
|
+
(node) => node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml
|
|
1252
|
+
);
|
|
1253
|
+
const showSsoDivider = hasSso && nonSsoNodes.some(isNodeVisible);
|
|
1254
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
|
|
1255
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
|
|
1256
|
+
/* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
|
|
1257
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
|
|
1258
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
|
|
1259
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1260
|
+
OryForm,
|
|
1261
|
+
{
|
|
1262
|
+
"data-testid": `ory/form/methods/local`,
|
|
1263
|
+
onAfterSubmit: handleAfterFormSubmit(dispatchFormState),
|
|
1264
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
|
|
1265
|
+
showSsoDivider && /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
|
|
1266
|
+
nonSsoNodes.map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
|
|
1267
|
+
] })
|
|
1268
|
+
}
|
|
1269
|
+
)
|
|
1270
|
+
] }),
|
|
1271
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
|
|
1272
|
+
] });
|
|
1273
|
+
}
|
|
1274
|
+
function AuthMethodList({
|
|
1275
|
+
options,
|
|
1276
|
+
setSelectedGroup
|
|
1277
|
+
}) {
|
|
1278
|
+
const { Card } = useComponents();
|
|
1279
|
+
const { setValue, getValues } = reactHookForm.useFormContext();
|
|
1280
|
+
if (Object.entries(options).length === 0) {
|
|
1281
|
+
return null;
|
|
1282
|
+
}
|
|
1283
|
+
const handleClick = (group, options2) => {
|
|
1284
|
+
var _a, _b, _c, _d;
|
|
1285
|
+
if (isGroupImmediateSubmit(group)) {
|
|
1286
|
+
if (group === "code" && !getValues("identifier") && ((_b = (_a = options2 == null ? void 0 : options2.title) == null ? void 0 : _a.values) == null ? void 0 : _b.address)) {
|
|
1287
|
+
setValue("identifier", (_d = (_c = options2 == null ? void 0 : options2.title) == null ? void 0 : _c.values) == null ? void 0 : _d.address);
|
|
1288
|
+
}
|
|
1289
|
+
setValue("method", group);
|
|
1290
|
+
} else {
|
|
1291
|
+
setSelectedGroup(group);
|
|
1292
|
+
}
|
|
1293
|
+
};
|
|
1294
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Card.AuthMethodListContainer, { children: Object.entries(options).map(([group, options2]) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1295
|
+
Card.AuthMethodListItem,
|
|
1296
|
+
{
|
|
1297
|
+
group,
|
|
1298
|
+
title: options2.title,
|
|
1299
|
+
onClick: () => handleClick(group, options2)
|
|
1300
|
+
},
|
|
1301
|
+
group
|
|
1302
|
+
)) });
|
|
1303
|
+
}
|
|
1304
|
+
function toAuthMethodPickerOptions(visibleGroups) {
|
|
1305
|
+
return Object.fromEntries(
|
|
1152
1306
|
Object.values(clientFetch.UiNodeGroupEnum).filter((group) => {
|
|
1153
|
-
var
|
|
1154
|
-
return (
|
|
1307
|
+
var _a;
|
|
1308
|
+
return (_a = visibleGroups[group]) == null ? void 0 : _a.length;
|
|
1155
1309
|
}).filter(
|
|
1156
1310
|
(group) => ![
|
|
1157
1311
|
clientFetch.UiNodeGroupEnum.Oidc,
|
|
@@ -1163,16 +1317,18 @@ function OryTwoStepCard() {
|
|
|
1163
1317
|
].includes(group)
|
|
1164
1318
|
).map((g) => [g, {}])
|
|
1165
1319
|
);
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
);
|
|
1320
|
+
}
|
|
1321
|
+
function OryTwoStepCardStateSelectMethod() {
|
|
1322
|
+
var _a, _b, _c, _d;
|
|
1323
|
+
const { Form, Card, Message } = useComponents();
|
|
1324
|
+
const { flow, flowType, dispatchFormState } = useOryFlow();
|
|
1325
|
+
const { ui } = flow;
|
|
1326
|
+
const intl = reactIntl.useIntl();
|
|
1327
|
+
const nodeSorter = useNodeSorter();
|
|
1328
|
+
const sortNodes = (a, b) => nodeSorter(a, b, { flowType });
|
|
1329
|
+
const visibleGroups = useNodeGroupsWithVisibleNodes(ui.nodes);
|
|
1330
|
+
const authMethodBlocks = toAuthMethodPickerOptions(visibleGroups);
|
|
1331
|
+
const authMethodAdditionalNodes = useFunctionalNodes(ui.nodes);
|
|
1176
1332
|
if (clientFetch.UiNodeGroupEnum.Code in authMethodBlocks) {
|
|
1177
1333
|
let identifier = (_b = (_a = findNode(ui.nodes, {
|
|
1178
1334
|
group: "identifier_first",
|
|
@@ -1193,137 +1349,59 @@ function OryTwoStepCard() {
|
|
|
1193
1349
|
};
|
|
1194
1350
|
}
|
|
1195
1351
|
}
|
|
1196
|
-
const
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
dispatchFormState({
|
|
1204
|
-
type: "action_select_method",
|
|
1205
|
-
method
|
|
1206
|
-
});
|
|
1207
|
-
}
|
|
1352
|
+
const noMethods = {
|
|
1353
|
+
id: 5000002,
|
|
1354
|
+
text: intl.formatMessage({
|
|
1355
|
+
id: `identities.messages.5000002`,
|
|
1356
|
+
defaultMessage: "No authentication methods are available for this request. Please contact the site or app owner."
|
|
1357
|
+
}),
|
|
1358
|
+
type: "error"
|
|
1208
1359
|
};
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1360
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
|
|
1361
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
|
|
1362
|
+
/* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
|
|
1363
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
|
|
1364
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
|
|
1365
|
+
Object.entries(authMethodBlocks).length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1366
|
+
OryForm,
|
|
1367
|
+
{
|
|
1368
|
+
"data-testid": `ory/form/methods/local`,
|
|
1369
|
+
onAfterSubmit: handleAfterFormSubmit(dispatchFormState),
|
|
1370
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
|
|
1371
|
+
/* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
|
|
1372
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1373
|
+
AuthMethodList,
|
|
1374
|
+
{
|
|
1375
|
+
options: authMethodBlocks,
|
|
1376
|
+
setSelectedGroup: (group) => dispatchFormState({
|
|
1377
|
+
type: "action_select_method",
|
|
1378
|
+
method: group
|
|
1379
|
+
})
|
|
1380
|
+
}
|
|
1381
|
+
),
|
|
1382
|
+
authMethodAdditionalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
|
|
1383
|
+
] })
|
|
1384
|
+
}
|
|
1385
|
+
) : !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) }) })
|
|
1386
|
+
] }),
|
|
1387
|
+
/* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
|
|
1388
|
+
] });
|
|
1389
|
+
}
|
|
1390
|
+
function OryTwoStepCard() {
|
|
1391
|
+
const { formState } = useOryFlow();
|
|
1221
1392
|
switch (formState.current) {
|
|
1222
1393
|
case "provide_identifier":
|
|
1223
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1224
|
-
/* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
|
|
1225
|
-
/* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
|
|
1226
|
-
/* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
|
|
1227
|
-
showSso && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
|
|
1228
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1229
|
-
OryForm,
|
|
1230
|
-
{
|
|
1231
|
-
"data-testid": `ory/form/methods/local`,
|
|
1232
|
-
onAfterSubmit: handleAfterFormSubmit,
|
|
1233
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
|
|
1234
|
-
showSsoDivider && /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
|
|
1235
|
-
nonSsoNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
|
|
1236
|
-
] })
|
|
1237
|
-
}
|
|
1238
|
-
)
|
|
1239
|
-
] }),
|
|
1240
|
-
/* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
|
|
1241
|
-
] });
|
|
1394
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OryTwoStepCardStateProvideIdentifier, {});
|
|
1242
1395
|
case "select_method":
|
|
1243
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1244
|
-
/* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
|
|
1245
|
-
/* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
|
|
1246
|
-
/* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
|
|
1247
|
-
showSso && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
|
|
1248
|
-
Object.entries(authMethodBlocks).length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1249
|
-
OryForm,
|
|
1250
|
-
{
|
|
1251
|
-
"data-testid": `ory/form/methods/local`,
|
|
1252
|
-
onAfterSubmit: handleAfterFormSubmit,
|
|
1253
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
|
|
1254
|
-
/* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
|
|
1255
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1256
|
-
AuthMethodList,
|
|
1257
|
-
{
|
|
1258
|
-
options: authMethodBlocks,
|
|
1259
|
-
setSelectedGroup: (group) => dispatchFormState({
|
|
1260
|
-
type: "action_select_method",
|
|
1261
|
-
method: group
|
|
1262
|
-
})
|
|
1263
|
-
}
|
|
1264
|
-
),
|
|
1265
|
-
authMethodAdditionalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
|
|
1266
|
-
] })
|
|
1267
|
-
}
|
|
1268
|
-
)
|
|
1269
|
-
] }),
|
|
1270
|
-
/* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
|
|
1271
|
-
] });
|
|
1396
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OryTwoStepCardStateSelectMethod, {});
|
|
1272
1397
|
case "method_active":
|
|
1273
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1274
|
-
/* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
|
|
1275
|
-
/* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
|
|
1276
|
-
/* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
|
|
1277
|
-
showSso && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
|
|
1278
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1279
|
-
OryForm,
|
|
1280
|
-
{
|
|
1281
|
-
"data-testid": `ory/form/methods/local`,
|
|
1282
|
-
onAfterSubmit: handleAfterFormSubmit,
|
|
1283
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
|
|
1284
|
-
ui.nodes.filter(
|
|
1285
|
-
(n) => clientFetch.isUiNodeScriptAttributes(n.attributes) || n.group === clientFetch.UiNodeGroupEnum.Captcha || n.group === clientFetch.UiNodeGroupEnum.Default || n.group === clientFetch.UiNodeGroupEnum.Profile
|
|
1286
|
-
).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)),
|
|
1287
|
-
finalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
|
|
1288
|
-
] })
|
|
1289
|
-
}
|
|
1290
|
-
)
|
|
1291
|
-
] }),
|
|
1292
|
-
/* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
|
|
1293
|
-
] });
|
|
1398
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OryTwoStepCardStateMethodActive, { formState });
|
|
1294
1399
|
}
|
|
1295
1400
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1296
1401
|
"unknown form state: ",
|
|
1297
1402
|
formState.current
|
|
1298
1403
|
] });
|
|
1299
1404
|
}
|
|
1300
|
-
function AuthMethodList({ options, setSelectedGroup }) {
|
|
1301
|
-
const { Card } = useComponents();
|
|
1302
|
-
const { setValue, getValues } = reactHookForm.useFormContext();
|
|
1303
|
-
if (Object.entries(options).length === 0) {
|
|
1304
|
-
return null;
|
|
1305
|
-
}
|
|
1306
|
-
const handleClick = (group, options2) => {
|
|
1307
|
-
var _a, _b, _c, _d;
|
|
1308
|
-
if (isGroupImmediateSubmit(group)) {
|
|
1309
|
-
if (group === "code" && !getValues("identifier") && ((_b = (_a = options2 == null ? void 0 : options2.title) == null ? void 0 : _a.values) == null ? void 0 : _b.address)) {
|
|
1310
|
-
setValue("identifier", (_d = (_c = options2 == null ? void 0 : options2.title) == null ? void 0 : _c.values) == null ? void 0 : _d.address);
|
|
1311
|
-
}
|
|
1312
|
-
setValue("method", group);
|
|
1313
|
-
} else {
|
|
1314
|
-
setSelectedGroup(group);
|
|
1315
|
-
}
|
|
1316
|
-
};
|
|
1317
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Card.AuthMethodListContainer, { children: Object.entries(options).map(([group, options2]) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1318
|
-
Card.AuthMethodListItem,
|
|
1319
|
-
{
|
|
1320
|
-
group,
|
|
1321
|
-
title: options2.title,
|
|
1322
|
-
onClick: () => handleClick(group, options2)
|
|
1323
|
-
},
|
|
1324
|
-
group
|
|
1325
|
-
)) });
|
|
1326
|
-
}
|
|
1327
1405
|
function OryFormGroups({ groups }) {
|
|
1328
1406
|
const {
|
|
1329
1407
|
flow: { ui }
|
|
@@ -1332,8 +1410,8 @@ function OryFormGroups({ groups }) {
|
|
|
1332
1410
|
const { flowType } = useOryFlow();
|
|
1333
1411
|
const { Form } = useComponents();
|
|
1334
1412
|
const nodes = ui.nodes.filter((node) => groups.indexOf(node.group) > -1).sort((a, b) => nodeSorter(a, b, { flowType }));
|
|
1335
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Form.Group, { children: nodes.map((node
|
|
1336
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Node, { node },
|
|
1413
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Form.Group, { children: nodes.map((node) => {
|
|
1414
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node));
|
|
1337
1415
|
}) });
|
|
1338
1416
|
}
|
|
1339
1417
|
function OryFormSection({
|
|
@@ -1369,7 +1447,7 @@ function OryConsentCard() {
|
|
|
1369
1447
|
/* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
|
|
1370
1448
|
/* @__PURE__ */ jsxRuntime.jsx(OryCardContent, { children: /* @__PURE__ */ jsxRuntime.jsxs(OryForm, { children: [
|
|
1371
1449
|
/* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
|
|
1372
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form.Group, { children: flow.flow.ui.nodes.map((node
|
|
1450
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form.Group, { children: flow.flow.ui.nodes.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node))) }),
|
|
1373
1451
|
/* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
|
|
1374
1452
|
/* @__PURE__ */ jsxRuntime.jsx(OryCardFooter, {})
|
|
1375
1453
|
] }) })
|
|
@@ -1740,7 +1818,7 @@ function SettingsSectionContent({ group, nodes }) {
|
|
|
1740
1818
|
"data-testid": "ory/screen/settings/group/totp",
|
|
1741
1819
|
children: [
|
|
1742
1820
|
/* @__PURE__ */ jsxRuntime.jsx(OrySettingsTotp, { nodes: (_a = groupedNodes.groups.totp) != null ? _a : [] }),
|
|
1743
|
-
(_b = groupedNodes.groups.default) == null ? void 0 : _b.map((node
|
|
1821
|
+
(_b = groupedNodes.groups.default) == null ? void 0 : _b.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node)))
|
|
1744
1822
|
]
|
|
1745
1823
|
}
|
|
1746
1824
|
);
|
|
@@ -1758,7 +1836,7 @@ function SettingsSectionContent({ group, nodes }) {
|
|
|
1758
1836
|
nodes: (_c = groupedNodes.groups.lookup_secret) != null ? _c : []
|
|
1759
1837
|
}
|
|
1760
1838
|
),
|
|
1761
|
-
(_d = groupedNodes.groups.default) == null ? void 0 : _d.map((node
|
|
1839
|
+
(_d = groupedNodes.groups.default) == null ? void 0 : _d.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node)))
|
|
1762
1840
|
]
|
|
1763
1841
|
}
|
|
1764
1842
|
);
|
|
@@ -1771,7 +1849,7 @@ function SettingsSectionContent({ group, nodes }) {
|
|
|
1771
1849
|
"data-testid": "ory/screen/settings/group/oidc",
|
|
1772
1850
|
children: [
|
|
1773
1851
|
/* @__PURE__ */ jsxRuntime.jsx(OrySettingsOidc, { nodes: (_e = groupedNodes.groups.oidc) != null ? _e : [] }),
|
|
1774
|
-
(_f = groupedNodes.groups.default) == null ? void 0 : _f.map((node
|
|
1852
|
+
(_f = groupedNodes.groups.default) == null ? void 0 : _f.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node)))
|
|
1775
1853
|
]
|
|
1776
1854
|
}
|
|
1777
1855
|
);
|
|
@@ -1784,7 +1862,7 @@ function SettingsSectionContent({ group, nodes }) {
|
|
|
1784
1862
|
"data-testid": "ory/screen/settings/group/webauthn",
|
|
1785
1863
|
children: [
|
|
1786
1864
|
/* @__PURE__ */ jsxRuntime.jsx(OrySettingsWebauthn, { nodes: (_g = groupedNodes.groups.webauthn) != null ? _g : [] }),
|
|
1787
|
-
(_h = groupedNodes.groups.default) == null ? void 0 : _h.map((node
|
|
1865
|
+
(_h = groupedNodes.groups.default) == null ? void 0 : _h.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node)))
|
|
1788
1866
|
]
|
|
1789
1867
|
}
|
|
1790
1868
|
);
|
|
@@ -1797,7 +1875,7 @@ function SettingsSectionContent({ group, nodes }) {
|
|
|
1797
1875
|
"data-testid": "ory/screen/settings/group/passkey",
|
|
1798
1876
|
children: [
|
|
1799
1877
|
/* @__PURE__ */ jsxRuntime.jsx(OrySettingsPasskey, { nodes: (_i = groupedNodes.groups.passkey) != null ? _i : [] }),
|
|
1800
|
-
(_j = groupedNodes.groups.default) == null ? void 0 : _j.map((node
|
|
1878
|
+
(_j = groupedNodes.groups.default) == null ? void 0 : _j.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node)))
|
|
1801
1879
|
]
|
|
1802
1880
|
}
|
|
1803
1881
|
);
|
|
@@ -1818,16 +1896,16 @@ function SettingsSectionContent({ group, nodes }) {
|
|
|
1818
1896
|
id: `settings.${group}.description`
|
|
1819
1897
|
}),
|
|
1820
1898
|
children: [
|
|
1821
|
-
(_k = groupedNodes.groups.default) == null ? void 0 : _k.map((node
|
|
1899
|
+
(_k = groupedNodes.groups.default) == null ? void 0 : _k.map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node))),
|
|
1822
1900
|
nodes.filter(
|
|
1823
1901
|
(node) => "type" in node.attributes && node.attributes.type !== "submit"
|
|
1824
|
-
).map((node
|
|
1902
|
+
).map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node)))
|
|
1825
1903
|
]
|
|
1826
1904
|
}
|
|
1827
1905
|
),
|
|
1828
1906
|
/* @__PURE__ */ jsxRuntime.jsx(Card.SettingsSectionFooter, { children: nodes.filter(
|
|
1829
1907
|
(node) => "type" in node.attributes && node.attributes.type === "submit"
|
|
1830
|
-
).map((node
|
|
1908
|
+
).map((node) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, clientFetch.getNodeId(node))) })
|
|
1831
1909
|
]
|
|
1832
1910
|
}
|
|
1833
1911
|
);
|
|
@@ -1841,7 +1919,7 @@ function OrySettingsCard() {
|
|
|
1841
1919
|
const scriptNodes = onlyScriptNodes(flow.ui.nodes);
|
|
1842
1920
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1843
1921
|
/* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
|
|
1844
|
-
scriptNodes.map((n) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node: n })),
|
|
1922
|
+
scriptNodes.map((n) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node: n }, clientFetch.getNodeId(n))),
|
|
1845
1923
|
uniqueGroups.entries.map(([group, nodes]) => {
|
|
1846
1924
|
if (group === clientFetch.UiNodeGroupEnum.Default) {
|
|
1847
1925
|
return null;
|