@ory/elements-react 1.0.0-next.29 → 1.0.0-next.30
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 +11 -0
- package/dist/index.d.mts +3 -6
- package/dist/index.d.ts +3 -6
- package/dist/index.js +253 -299
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +253 -299
- package/dist/index.mjs.map +1 -1
- package/dist/theme/default/index.js +258 -248
- package/dist/theme/default/index.js.map +1 -1
- package/dist/theme/default/index.mjs +215 -205
- package/dist/theme/default/index.mjs.map +1 -1
- package/package.json +3 -3
- package/.storybook/global.css +0 -7
- package/.storybook/main.ts +0 -50
- package/.storybook/preview-head.html +0 -15
- package/.storybook/preview.tsx +0 -68
- package/.storybook/public/InterVariable.woff2 +0 -0
- package/.storybook/public/inter.css +0 -8
- package/.stub-responses/login/1fa/all-methods/initial-form.json +0 -247
- package/.stub-responses/login/1fa/all-methods/missing-email.json +0 -265
- package/.stub-responses/login/1fa/all-methods/wrong-credentials.json +0 -254
- package/.stub-responses/login/1fa/code/code-input.json +0 -135
- package/.stub-responses/login/1fa/code/initial-form.json +0 -173
- package/.stub-responses/login/1fa/code/invalid-account.json +0 -182
- package/.stub-responses/login/1fa/code/missing-email.json +0 -182
- package/.stub-responses/login/1fa/code/wrong-credentials.json +0 -124
- package/.stub-responses/login/1fa/none/initial-form.json +0 -33
- package/.stub-responses/login/1fa/oidc/initial-form.json +0 -279
- package/.stub-responses/login/1fa/passkey/initial-form.json +0 -122
- package/.stub-responses/login/1fa/password/initial-form.json +0 -154
- package/.stub-responses/login/1fa/password/missing-email.json +0 -172
- package/.stub-responses/login/1fa/password/wrong-credentials.json +0 -163
- package/.stub-responses/login/1fa/webauthn/initial-form.json +0 -76
- package/.stub-responses/login/1fa/webauthn/invalid-account.json +0 -83
- package/.stub-responses/login/1fa/webauthn/show-trigger.json +0 -105
- package/.stub-responses/recovery/disabled/initial-form.json +0 -9
- package/.stub-responses/recovery/none/initial-form.json +0 -9
- package/.stub-responses/registration/one-step/all-methods/initial-form.json +0 -334
- package/.stub-responses/registration/one-step/all-methods/missing-fields.json +0 -343
- package/.stub-responses/registration/one-step/disabled/initial-form.json +0 -10
- package/.stub-responses/registration/one-step/none/initial-form.json +0 -14
- package/.stub-responses/registration/one-step/oidc/initial-form.json +0 -338
- package/.stub-responses/registration/one-step/passkey/initial-form.json +0 -177
- package/.stub-responses/registration/one-step/password/initial-form.json +0 -154
- package/.stub-responses/registration/one-step/password/missing-fields.json +0 -172
- package/.stub-responses/registration/one-step/password/second-step.json +0 -164
- package/.stub-responses/registration/one-step/webauthn/initial-form.json +0 -185
- package/.stub-responses/registration/two-step/all-methods/enter-password.json +0 -242
- package/.stub-responses/registration/two-step/all-methods/initial-form.json +0 -180
- package/.stub-responses/registration/two-step/all-methods/missing-fields.json +0 -189
- package/.stub-responses/registration/two-step/all-methods/password-validation-error.json +0 -244
- package/.stub-responses/registration/two-step/password/enter-password.json +0 -108
- package/.stub-responses/registration/two-step/password/initial-form.json +0 -134
- package/.stub-responses/registration/two-step/password/missing-fields.json +0 -143
- package/.stub-responses/registration/two-step/password/password-validation-error.json +0 -110
- package/.stub-responses/settings/all-methods/change-password.json +0 -381
- package/.stub-responses/settings/all-methods/change-trait.json +0 -377
- package/.stub-responses/settings/all-methods/initial-form.json +0 -368
- package/.stub-responses/settings/oidc/with-provider.json +0 -230
- package/.stub-responses/settings/passkey/initial-form.json +0 -256
- package/.stub-responses/settings/webauthn/initial-form.json +0 -263
- package/.stub-responses/verification/disabled/initial-form.json +0 -9
- package/.stub-responses/verification/none/initial-form.json +0 -9
- package/stories/components/login/1fa/all.stories.ts +0 -46
- package/stories/components/login/1fa/code.stories.ts +0 -64
- package/stories/components/login/1fa/custom.stories.tsx +0 -72
- package/stories/components/login/1fa/none.stories.tsx +0 -28
- package/stories/components/login/1fa/oidc.stories.tsx +0 -143
- package/stories/components/login/1fa/passkey.stories.ts +0 -28
- package/stories/components/login/1fa/password.stories.ts +0 -46
- package/stories/components/login/1fa/webauthn.stories.ts +0 -46
- package/stories/components/registration/one-step/all-methods.stories.ts +0 -37
- package/stories/components/registration/one-step/password.stories.ts +0 -37
- package/stories/components/registration/one-step/webauthn.stories.ts +0 -28
- package/stories/components/registration/two-step/all-methods.stories.ts +0 -55
- package/stories/components/registration/two-step/password.stories.ts +0 -55
- package/stories/components/settings/all.stories.ts +0 -46
- package/stories/components/settings/oidc.stories.ts +0 -28
- package/stories/components/settings/passkey.stories.ts +0 -28
- package/stories/components/settings/webauthn.stories.ts +0 -28
- package/stories/pages/error.tsx +0 -29
- package/stories/utils.ts +0 -20
- package/storybook-static/InterVariable.woff2 +0 -0
- package/storybook-static/assets/Color-ERTF36HU-BdkKyVuV.js +0 -1
- package/storybook-static/assets/DocsRenderer-CFRXHY34-YqKt61zP.js +0 -595
- package/storybook-static/assets/all-methods.stories-B-rqPBX2.js +0 -11
- package/storybook-static/assets/all-methods.stories-CmMlhzsx.js +0 -21
- package/storybook-static/assets/all.stories-CtQ0yCQi.js +0 -16
- package/storybook-static/assets/all.stories-DgIVCzcZ.js +0 -16
- package/storybook-static/assets/chunk-H6MOWX77-DTQOW814.js +0 -1
- package/storybook-static/assets/code.stories-BbEryDcA.js +0 -26
- package/storybook-static/assets/custom.stories-DH2zHar9.js +0 -6
- package/storybook-static/assets/entry-preview-CcFGVifh.js +0 -10
- package/storybook-static/assets/entry-preview-docs-CyY-8bLe.js +0 -54
- package/storybook-static/assets/iframe-C5GAfuxh.js +0 -2
- package/storybook-static/assets/index-BVoBHvaS.js +0 -8
- package/storybook-static/assets/index-CfOt2XX2.js +0 -24
- package/storybook-static/assets/index-DPRSEdy-.js +0 -1
- package/storybook-static/assets/index-DrFu-skq.js +0 -6
- package/storybook-static/assets/index-FeUjBnvO.js +0 -1
- package/storybook-static/assets/index-uubelm5h.js +0 -9
- package/storybook-static/assets/initial-form-DWp_1F-f.js +0 -1
- package/storybook-static/assets/jsx-runtime-QvZ8i92b.js +0 -9
- package/storybook-static/assets/none.stories-TAeRhzd5.js +0 -6
- package/storybook-static/assets/oidc.stories-CniWBy7t.js +0 -58
- package/storybook-static/assets/oidc.stories-jhWzAyoQ.js +0 -6
- package/storybook-static/assets/passkey.stories-CBtjoVSN.js +0 -6
- package/storybook-static/assets/passkey.stories-CQU2Xw_t.js +0 -6
- package/storybook-static/assets/password.stories-0s6cDl0o.js +0 -11
- package/storybook-static/assets/password.stories-B2Wtckz_.js +0 -16
- package/storybook-static/assets/password.stories-DX0gkWjH.js +0 -21
- package/storybook-static/assets/preview-BBWR9nbA.js +0 -1
- package/storybook-static/assets/preview-BPAmP-pY.js +0 -2
- package/storybook-static/assets/preview-BWzBA1C2.js +0 -396
- package/storybook-static/assets/preview-BXtF2ySE.js +0 -234
- package/storybook-static/assets/preview-Cur_8nCX.css +0 -1
- package/storybook-static/assets/preview-D77C14du.js +0 -34
- package/storybook-static/assets/preview-DCjDUH0w.js +0 -27
- package/storybook-static/assets/preview-DFmD0pui.js +0 -1
- package/storybook-static/assets/preview-DGUiP6tS.js +0 -7
- package/storybook-static/assets/preview-aVwhiz9X.js +0 -1
- package/storybook-static/assets/react-18-CtsMCmcS.js +0 -1
- package/storybook-static/assets/settings-BqEFC2-V.css +0 -1
- package/storybook-static/assets/settings-Bx4osEmB.js +0 -2304
- package/storybook-static/assets/webauthn.stories-BzodmV0c.js +0 -6
- package/storybook-static/assets/webauthn.stories-DglGm7Ys.js +0 -6
- package/storybook-static/assets/webauthn.stories-G9E76Wjj.js +0 -16
- package/storybook-static/favicon.svg +0 -1
- package/storybook-static/iframe.html +0 -654
- package/storybook-static/index.html +0 -173
- package/storybook-static/index.json +0 -1
- package/storybook-static/inter.css +0 -8
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/preview-stats.json +0 -2344
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js +0 -12
- package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +0 -394
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/interactions-8/manager-bundle.js +0 -211
- package/storybook-static/sb-addons/interactions-8/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +0 -3
- package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-common-assets/favicon.svg +0 -1
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +0 -1006
- package/storybook-static/sb-manager/globals-runtime.js +0 -54400
- package/storybook-static/sb-manager/globals.js +0 -48
- package/storybook-static/sb-manager/runtime.js +0 -12089
- package/storybook-static/sb-preview/globals.js +0 -33
- package/storybook-static/sb-preview/runtime.js +0 -9498
package/dist/index.mjs
CHANGED
|
@@ -90,7 +90,7 @@ function isChoosingMethod(uiNodes) {
|
|
|
90
90
|
(node) => node.group === UiNodeGroupEnum.IdentifierFirst && "name" in node.attributes && node.attributes.name === "identifier" && node.attributes.type === "hidden"
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function filterOidcOut(nodes) {
|
|
94
94
|
return nodes.filter((node) => node.group !== UiNodeGroupEnum.Oidc);
|
|
95
95
|
}
|
|
96
96
|
function getFinalNodes(uniqueGroups, selectedGroup) {
|
|
@@ -151,7 +151,7 @@ function triggerToFunction(trigger) {
|
|
|
151
151
|
}
|
|
152
152
|
return triggerFn;
|
|
153
153
|
}
|
|
154
|
-
function nodesToAuthMethodGroups(nodes, excludeAuthMethods = [
|
|
154
|
+
function nodesToAuthMethodGroups(nodes, excludeAuthMethods = []) {
|
|
155
155
|
var _a;
|
|
156
156
|
const groups = {};
|
|
157
157
|
for (const node of nodes) {
|
|
@@ -339,139 +339,6 @@ function OryCardHeader() {
|
|
|
339
339
|
const { Card } = useComponents();
|
|
340
340
|
return /* @__PURE__ */ jsx(Card.Header, {});
|
|
341
341
|
}
|
|
342
|
-
function OryCardFooter() {
|
|
343
|
-
const { Card } = useComponents();
|
|
344
|
-
return /* @__PURE__ */ jsx(Card.Footer, {});
|
|
345
|
-
}
|
|
346
|
-
var NodeInput = ({
|
|
347
|
-
node,
|
|
348
|
-
attributes
|
|
349
|
-
}) => {
|
|
350
|
-
var _a;
|
|
351
|
-
const { Node: Node2 } = useComponents();
|
|
352
|
-
const { setValue } = useFormContext();
|
|
353
|
-
const {
|
|
354
|
-
onloadTrigger,
|
|
355
|
-
onclickTrigger,
|
|
356
|
-
// These properties do not exist on input fields so we remove them (as we already have handled them).
|
|
357
|
-
onclick: _ignoredOnclick,
|
|
358
|
-
onload: _ignoredOnload,
|
|
359
|
-
//
|
|
360
|
-
...attrs
|
|
361
|
-
} = attributes;
|
|
362
|
-
const isResendNode = ((_a = node.meta.label) == null ? void 0 : _a.id) === 1070008;
|
|
363
|
-
const isScreenSelectionNode = "name" in node.attributes && node.attributes.name === "screen";
|
|
364
|
-
const setFormValue = () => {
|
|
365
|
-
if (attrs.value && !(isResendNode || isScreenSelectionNode)) {
|
|
366
|
-
setValue(attrs.name, attrs.value);
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
const hasRun = useRef(false);
|
|
370
|
-
useEffect(
|
|
371
|
-
() => {
|
|
372
|
-
setFormValue();
|
|
373
|
-
if (!hasRun.current && onloadTrigger) {
|
|
374
|
-
hasRun.current = true;
|
|
375
|
-
triggerToWindowCall(onloadTrigger);
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
// TODO(jonas): make sure onloadTrigger is stable
|
|
379
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- ignore onloadTrigger for now, until we make sure this is stable
|
|
380
|
-
[]
|
|
381
|
-
);
|
|
382
|
-
const handleClick = () => {
|
|
383
|
-
setFormValue();
|
|
384
|
-
if (onclickTrigger) {
|
|
385
|
-
triggerToWindowCall(onclickTrigger);
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
const isSocial = (attrs.name === "provider" || attrs.name === "link") && node.group === "oidc";
|
|
389
|
-
const isPinCodeInput = attrs.name === "code" && node.group === "code" || attrs.name === "totp_code" && node.group === "totp";
|
|
390
|
-
switch (attributes.type) {
|
|
391
|
-
case UiNodeInputAttributesTypeEnum.Submit:
|
|
392
|
-
case UiNodeInputAttributesTypeEnum.Button:
|
|
393
|
-
if (isSocial) {
|
|
394
|
-
return /* @__PURE__ */ jsx(Node2.OidcButton, { attributes: attrs, node });
|
|
395
|
-
}
|
|
396
|
-
if (isResendNode || isScreenSelectionNode) {
|
|
397
|
-
return null;
|
|
398
|
-
}
|
|
399
|
-
return /* @__PURE__ */ jsx(
|
|
400
|
-
Node2.Label,
|
|
401
|
-
{
|
|
402
|
-
attributes: { ...attrs, label: void 0 },
|
|
403
|
-
node: { ...node, meta: { ...node.meta, label: void 0 } },
|
|
404
|
-
children: /* @__PURE__ */ jsx(Node2.Button, { attributes: attrs, node, onClick: handleClick })
|
|
405
|
-
}
|
|
406
|
-
);
|
|
407
|
-
case UiNodeInputAttributesTypeEnum.DatetimeLocal:
|
|
408
|
-
throw new Error("Not implemented");
|
|
409
|
-
case UiNodeInputAttributesTypeEnum.Checkbox:
|
|
410
|
-
return /* @__PURE__ */ jsx(
|
|
411
|
-
Node2.Label,
|
|
412
|
-
{
|
|
413
|
-
attributes: { ...attrs, label: void 0 },
|
|
414
|
-
node: { ...node, meta: { ...node.meta, label: void 0 } },
|
|
415
|
-
children: /* @__PURE__ */ jsx(Node2.Checkbox, { attributes: attrs, node, onClick: handleClick })
|
|
416
|
-
}
|
|
417
|
-
);
|
|
418
|
-
case UiNodeInputAttributesTypeEnum.Hidden:
|
|
419
|
-
return /* @__PURE__ */ jsx(Node2.Input, { attributes: attrs, node, onClick: handleClick });
|
|
420
|
-
default:
|
|
421
|
-
if (isPinCodeInput) {
|
|
422
|
-
return /* @__PURE__ */ jsx(Node2.Label, { attributes: attrs, node, children: /* @__PURE__ */ jsx(
|
|
423
|
-
Node2.CodeInput,
|
|
424
|
-
{
|
|
425
|
-
attributes: attrs,
|
|
426
|
-
node,
|
|
427
|
-
onClick: handleClick
|
|
428
|
-
}
|
|
429
|
-
) });
|
|
430
|
-
}
|
|
431
|
-
return /* @__PURE__ */ jsx(Node2.Label, { attributes: attrs, node, children: /* @__PURE__ */ jsx(Node2.Input, { attributes: attrs, node, onClick: handleClick }) });
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
var Node = ({ node, onClick }) => {
|
|
435
|
-
const { Node: Node2 } = useComponents();
|
|
436
|
-
if (isUiNodeImageAttributes(node.attributes)) {
|
|
437
|
-
return /* @__PURE__ */ jsx(Node2.Image, { node, attributes: node.attributes });
|
|
438
|
-
} else if (isUiNodeTextAttributes(node.attributes)) {
|
|
439
|
-
const attrs = node.attributes;
|
|
440
|
-
return /* @__PURE__ */ jsx(Node2.Text, { attributes: attrs, node });
|
|
441
|
-
} else if (isUiNodeInputAttributes(node.attributes)) {
|
|
442
|
-
return /* @__PURE__ */ jsx(NodeInput, { node, attributes: node.attributes, onClick });
|
|
443
|
-
} else if (isUiNodeAnchorAttributes(node.attributes)) {
|
|
444
|
-
return /* @__PURE__ */ jsx(Node2.Anchor, { attributes: node.attributes, node });
|
|
445
|
-
} else if (isUiNodeScriptAttributes(node.attributes)) {
|
|
446
|
-
const {
|
|
447
|
-
crossorigin,
|
|
448
|
-
referrerpolicy,
|
|
449
|
-
node_type: _nodeType,
|
|
450
|
-
...attributes
|
|
451
|
-
} = node.attributes;
|
|
452
|
-
return /* @__PURE__ */ jsx(
|
|
453
|
-
"script",
|
|
454
|
-
{
|
|
455
|
-
crossOrigin: crossorigin,
|
|
456
|
-
referrerPolicy: referrerpolicy,
|
|
457
|
-
...attributes
|
|
458
|
-
}
|
|
459
|
-
);
|
|
460
|
-
}
|
|
461
|
-
return null;
|
|
462
|
-
};
|
|
463
|
-
function OryFormGroups({ children, groups }) {
|
|
464
|
-
const {
|
|
465
|
-
flow: { ui }
|
|
466
|
-
} = useOryFlow();
|
|
467
|
-
const nodeSorter = useNodeSorter();
|
|
468
|
-
const { flowType } = useOryFlow();
|
|
469
|
-
const { Form } = useComponents();
|
|
470
|
-
const nodes = ui.nodes.filter((node) => groups.indexOf(node.group) > -1).sort((a, b) => nodeSorter(a, b, { flowType }));
|
|
471
|
-
return /* @__PURE__ */ jsx(Form.Group, { children: children != null ? children : nodes.map((node, k) => {
|
|
472
|
-
return /* @__PURE__ */ jsx(Node, { node }, k);
|
|
473
|
-
}) });
|
|
474
|
-
}
|
|
475
342
|
function computeDefaultValues(nodes) {
|
|
476
343
|
return nodes.reduce((acc, node) => {
|
|
477
344
|
const attrs = node.attributes;
|
|
@@ -557,52 +424,22 @@ function OryFormProvider({
|
|
|
557
424
|
});
|
|
558
425
|
return /* @__PURE__ */ jsx(FormProvider, { ...methods, children });
|
|
559
426
|
}
|
|
560
|
-
function
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
}) {
|
|
564
|
-
const {
|
|
565
|
-
flow: { ui }
|
|
566
|
-
} = useOryFlow();
|
|
567
|
-
const { setValue } = useFormContext();
|
|
568
|
-
const filteredNodes = ui.nodes.filter((node) => node.group === "oidc");
|
|
569
|
-
const { Form, Card, Node: Node2 } = useComponents();
|
|
570
|
-
if (filteredNodes.length === 0) {
|
|
571
|
-
return null;
|
|
572
|
-
}
|
|
573
|
-
const otherNodes = ui.nodes.filter(
|
|
574
|
-
(node) => node.group !== "oidc" && node.group !== "default"
|
|
575
|
-
);
|
|
576
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
577
|
-
/* @__PURE__ */ jsx(Form.OidcRoot, { nodes: filteredNodes, children: children != null ? children : filteredNodes.map((node, k) => {
|
|
578
|
-
return /* @__PURE__ */ jsx(
|
|
579
|
-
Node2.OidcButton,
|
|
580
|
-
{
|
|
581
|
-
node,
|
|
582
|
-
attributes: node.attributes,
|
|
583
|
-
onClick: () => {
|
|
584
|
-
setValue(
|
|
585
|
-
"provider",
|
|
586
|
-
node.attributes.value
|
|
587
|
-
);
|
|
588
|
-
setValue("method", "oidc");
|
|
589
|
-
}
|
|
590
|
-
},
|
|
591
|
-
k
|
|
592
|
-
);
|
|
593
|
-
}) }),
|
|
594
|
-
!hideDivider && filteredNodes.length > 0 && otherNodes.length > 0 && /* @__PURE__ */ jsx(Card.Divider, {})
|
|
595
|
-
] });
|
|
427
|
+
function OryCard({ children }) {
|
|
428
|
+
const { Card } = useComponents();
|
|
429
|
+
return /* @__PURE__ */ jsx(Card.Root, { children: /* @__PURE__ */ jsx(OryFormProvider, { children }) });
|
|
596
430
|
}
|
|
597
|
-
function
|
|
598
|
-
const {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
431
|
+
function OryCardFooter() {
|
|
432
|
+
const { Card } = useComponents();
|
|
433
|
+
return /* @__PURE__ */ jsx(Card.Footer, {});
|
|
434
|
+
}
|
|
435
|
+
function OryCardContent({ children }) {
|
|
436
|
+
const { Card } = useComponents();
|
|
437
|
+
return /* @__PURE__ */ jsx(Card.Content, { children });
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// src/theme/default/utils/form.ts
|
|
441
|
+
function isGroupImmediateSubmit(group) {
|
|
442
|
+
return group === "code";
|
|
606
443
|
}
|
|
607
444
|
function frontendClient(sdkUrl, opts = {}) {
|
|
608
445
|
const config = new Configuration({
|
|
@@ -982,7 +819,7 @@ function OryForm({ children, onAfterSubmit }) {
|
|
|
982
819
|
const methods = useFormContext();
|
|
983
820
|
const intl = useIntl();
|
|
984
821
|
const onSubmit = useOryFormSubmit(onAfterSubmit);
|
|
985
|
-
const hasMethods = flowContainer.flow.ui.nodes.
|
|
822
|
+
const hasMethods = flowContainer.flow.ui.nodes.some((node) => {
|
|
986
823
|
if (isUiNodeInputAttributes(node.attributes)) {
|
|
987
824
|
return node.attributes.name !== "csrf_token";
|
|
988
825
|
} else if (isUiNodeAnchorAttributes(node.attributes)) {
|
|
@@ -993,7 +830,7 @@ function OryForm({ children, onAfterSubmit }) {
|
|
|
993
830
|
return true;
|
|
994
831
|
}
|
|
995
832
|
return false;
|
|
996
|
-
})
|
|
833
|
+
});
|
|
997
834
|
if (!hasMethods && ((_a = flowContainer.flow.ui.messages) != null ? _a : []).length === 0) {
|
|
998
835
|
return intl.formatMessage({
|
|
999
836
|
id: `identities.messages.${5000002}`,
|
|
@@ -1006,22 +843,7 @@ function OryForm({ children, onAfterSubmit }) {
|
|
|
1006
843
|
action: flowContainer.flow.ui.action,
|
|
1007
844
|
method: flowContainer.flow.ui.method,
|
|
1008
845
|
onSubmit: (e) => void methods.handleSubmit(onSubmit)(e),
|
|
1009
|
-
children
|
|
1010
|
-
/* @__PURE__ */ jsx(OryFormOidcButtons, {}),
|
|
1011
|
-
/* @__PURE__ */ jsx(
|
|
1012
|
-
OryFormGroups,
|
|
1013
|
-
{
|
|
1014
|
-
groups: [
|
|
1015
|
-
"default",
|
|
1016
|
-
"password",
|
|
1017
|
-
"code",
|
|
1018
|
-
"webauthn",
|
|
1019
|
-
"passkey",
|
|
1020
|
-
"identifier_first"
|
|
1021
|
-
]
|
|
1022
|
-
}
|
|
1023
|
-
)
|
|
1024
|
-
] })
|
|
846
|
+
children
|
|
1025
847
|
}
|
|
1026
848
|
);
|
|
1027
849
|
}
|
|
@@ -1038,88 +860,176 @@ function OryCardValidationMessages({ ...props }) {
|
|
|
1038
860
|
}
|
|
1039
861
|
return /* @__PURE__ */ jsx(Message.Root, { ...props, children: messages == null ? void 0 : messages.map((message) => /* @__PURE__ */ jsx(Message.Content, { message }, message.id)) });
|
|
1040
862
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
...rest,
|
|
1063
|
-
children
|
|
863
|
+
var NodeInput = ({
|
|
864
|
+
node,
|
|
865
|
+
attributes
|
|
866
|
+
}) => {
|
|
867
|
+
var _a;
|
|
868
|
+
const { Node: Node2 } = useComponents();
|
|
869
|
+
const { setValue } = useFormContext();
|
|
870
|
+
const {
|
|
871
|
+
onloadTrigger,
|
|
872
|
+
onclickTrigger,
|
|
873
|
+
// These properties do not exist on input fields so we remove them (as we already have handled them).
|
|
874
|
+
onclick: _ignoredOnclick,
|
|
875
|
+
onload: _ignoredOnload,
|
|
876
|
+
//
|
|
877
|
+
...attrs
|
|
878
|
+
} = attributes;
|
|
879
|
+
const isResendNode = ((_a = node.meta.label) == null ? void 0 : _a.id) === 1070008;
|
|
880
|
+
const isScreenSelectionNode = "name" in node.attributes && node.attributes.name === "screen";
|
|
881
|
+
const setFormValue = () => {
|
|
882
|
+
if (attrs.value && !(isResendNode || isScreenSelectionNode)) {
|
|
883
|
+
setValue(attrs.name, attrs.value);
|
|
1064
884
|
}
|
|
885
|
+
};
|
|
886
|
+
const hasRun = useRef(false);
|
|
887
|
+
useEffect(
|
|
888
|
+
() => {
|
|
889
|
+
setFormValue();
|
|
890
|
+
if (!hasRun.current && onloadTrigger) {
|
|
891
|
+
hasRun.current = true;
|
|
892
|
+
triggerToWindowCall(onloadTrigger);
|
|
893
|
+
}
|
|
894
|
+
},
|
|
895
|
+
// TODO(jonas): make sure onloadTrigger is stable
|
|
896
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- ignore onloadTrigger for now, until we make sure this is stable
|
|
897
|
+
[]
|
|
1065
898
|
);
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
899
|
+
const handleClick = () => {
|
|
900
|
+
setFormValue();
|
|
901
|
+
if (onclickTrigger) {
|
|
902
|
+
triggerToWindowCall(onclickTrigger);
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
const isSocial = (attrs.name === "provider" || attrs.name === "link") && node.group === "oidc";
|
|
906
|
+
const isPinCodeInput = attrs.name === "code" && node.group === "code" || attrs.name === "totp_code" && node.group === "totp";
|
|
907
|
+
switch (attributes.type) {
|
|
908
|
+
case UiNodeInputAttributesTypeEnum.Submit:
|
|
909
|
+
case UiNodeInputAttributesTypeEnum.Button:
|
|
910
|
+
if (isSocial) {
|
|
911
|
+
return null;
|
|
912
|
+
}
|
|
913
|
+
if (isResendNode || isScreenSelectionNode) {
|
|
914
|
+
return null;
|
|
915
|
+
}
|
|
916
|
+
return /* @__PURE__ */ jsx(
|
|
917
|
+
Node2.Label,
|
|
1078
918
|
{
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
"passkey",
|
|
1083
|
-
"code",
|
|
1084
|
-
"webauthn",
|
|
1085
|
-
"profile",
|
|
1086
|
-
"totp",
|
|
1087
|
-
"identifier_first"
|
|
1088
|
-
]
|
|
919
|
+
attributes: { ...attrs, label: void 0 },
|
|
920
|
+
node: { ...node, meta: { ...node.meta, label: void 0 } },
|
|
921
|
+
children: /* @__PURE__ */ jsx(Node2.Button, { attributes: attrs, node, onClick: handleClick })
|
|
1089
922
|
}
|
|
1090
|
-
)
|
|
1091
|
-
|
|
1092
|
-
|
|
923
|
+
);
|
|
924
|
+
case UiNodeInputAttributesTypeEnum.DatetimeLocal:
|
|
925
|
+
throw new Error("Not implemented");
|
|
926
|
+
case UiNodeInputAttributesTypeEnum.Checkbox:
|
|
927
|
+
return /* @__PURE__ */ jsx(
|
|
928
|
+
Node2.Label,
|
|
929
|
+
{
|
|
930
|
+
attributes: { ...attrs, label: void 0 },
|
|
931
|
+
node: { ...node, meta: { ...node.meta, label: void 0 } },
|
|
932
|
+
children: /* @__PURE__ */ jsx(Node2.Checkbox, { attributes: attrs, node, onClick: handleClick })
|
|
933
|
+
}
|
|
934
|
+
);
|
|
935
|
+
case UiNodeInputAttributesTypeEnum.Hidden:
|
|
936
|
+
return /* @__PURE__ */ jsx(Node2.Input, { attributes: attrs, node, onClick: handleClick });
|
|
937
|
+
default:
|
|
938
|
+
if (isPinCodeInput) {
|
|
939
|
+
return /* @__PURE__ */ jsx(Node2.Label, { attributes: attrs, node, children: /* @__PURE__ */ jsx(
|
|
940
|
+
Node2.CodeInput,
|
|
941
|
+
{
|
|
942
|
+
attributes: attrs,
|
|
943
|
+
node,
|
|
944
|
+
onClick: handleClick
|
|
945
|
+
}
|
|
946
|
+
) });
|
|
947
|
+
}
|
|
948
|
+
return /* @__PURE__ */ jsx(Node2.Label, { attributes: attrs, node, children: /* @__PURE__ */ jsx(Node2.Input, { attributes: attrs, node, onClick: handleClick }) });
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
var Node = ({ node, onClick }) => {
|
|
952
|
+
const { Node: Node2 } = useComponents();
|
|
953
|
+
if (isUiNodeImageAttributes(node.attributes)) {
|
|
954
|
+
return /* @__PURE__ */ jsx(Node2.Image, { node, attributes: node.attributes });
|
|
955
|
+
} else if (isUiNodeTextAttributes(node.attributes)) {
|
|
956
|
+
const attrs = node.attributes;
|
|
957
|
+
return /* @__PURE__ */ jsx(Node2.Text, { attributes: attrs, node });
|
|
958
|
+
} else if (isUiNodeInputAttributes(node.attributes)) {
|
|
959
|
+
return /* @__PURE__ */ jsx(NodeInput, { node, attributes: node.attributes, onClick });
|
|
960
|
+
} else if (isUiNodeAnchorAttributes(node.attributes)) {
|
|
961
|
+
return /* @__PURE__ */ jsx(Node2.Anchor, { attributes: node.attributes, node });
|
|
962
|
+
} else if (isUiNodeScriptAttributes(node.attributes)) {
|
|
963
|
+
const {
|
|
964
|
+
crossorigin,
|
|
965
|
+
referrerpolicy,
|
|
966
|
+
node_type: _nodeType,
|
|
967
|
+
...attributes
|
|
968
|
+
} = node.attributes;
|
|
969
|
+
return /* @__PURE__ */ jsx(
|
|
970
|
+
"script",
|
|
971
|
+
{
|
|
972
|
+
crossOrigin: crossorigin,
|
|
973
|
+
referrerPolicy: referrerpolicy,
|
|
974
|
+
...attributes
|
|
975
|
+
}
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
return null;
|
|
979
|
+
};
|
|
980
|
+
function OryFormOidcButtons() {
|
|
981
|
+
const {
|
|
982
|
+
flow: { ui }
|
|
983
|
+
} = useOryFlow();
|
|
984
|
+
const { setValue } = useFormContext();
|
|
985
|
+
const filteredNodes = ui.nodes.filter((node) => node.group === "oidc");
|
|
986
|
+
const { Form, Node: Node2 } = useComponents();
|
|
987
|
+
if (filteredNodes.length === 0) {
|
|
988
|
+
return null;
|
|
989
|
+
}
|
|
990
|
+
return /* @__PURE__ */ jsx(Form.OidcRoot, { nodes: filteredNodes, children: filteredNodes.map((node, k) => /* @__PURE__ */ jsx(
|
|
991
|
+
Node2.OidcButton,
|
|
992
|
+
{
|
|
993
|
+
node,
|
|
994
|
+
attributes: node.attributes,
|
|
995
|
+
onClick: () => {
|
|
996
|
+
setValue(
|
|
997
|
+
"provider",
|
|
998
|
+
node.attributes.value
|
|
999
|
+
);
|
|
1000
|
+
setValue("method", "oidc");
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
1003
|
+
k
|
|
1004
|
+
)) });
|
|
1093
1005
|
}
|
|
1094
|
-
function
|
|
1095
|
-
const {
|
|
1096
|
-
|
|
1097
|
-
|
|
1006
|
+
function OryFormSocialButtonsForm() {
|
|
1007
|
+
const {
|
|
1008
|
+
flow: { ui }
|
|
1009
|
+
} = useOryFlow();
|
|
1010
|
+
const filteredNodes = ui.nodes.filter((node) => node.group === "oidc");
|
|
1011
|
+
if (filteredNodes.length === 0) {
|
|
1012
|
+
return null;
|
|
1098
1013
|
}
|
|
1099
|
-
return /* @__PURE__ */ jsx(
|
|
1100
|
-
/* @__PURE__ */ jsx(OryCardHeader, {}),
|
|
1101
|
-
/* @__PURE__ */ jsx(OryCardContent, {}),
|
|
1102
|
-
/* @__PURE__ */ jsx(OryCardFooter, {})
|
|
1103
|
-
] }) });
|
|
1014
|
+
return /* @__PURE__ */ jsx(OryFormProvider, { children: /* @__PURE__ */ jsx(OryForm, { children: /* @__PURE__ */ jsx(OryFormOidcButtons, {}) }) });
|
|
1104
1015
|
}
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
function isGroupImmediateSubmit(group) {
|
|
1108
|
-
return group === "code";
|
|
1016
|
+
function isUINodeGroupEnum(method) {
|
|
1017
|
+
return Object.values(UiNodeGroupEnum).includes(method);
|
|
1109
1018
|
}
|
|
1110
1019
|
function OryTwoStepCard() {
|
|
1111
|
-
var _a;
|
|
1112
1020
|
const {
|
|
1113
|
-
flow: { ui }
|
|
1021
|
+
flow: { ui },
|
|
1022
|
+
flowType,
|
|
1023
|
+
formState,
|
|
1024
|
+
dispatchFormState
|
|
1114
1025
|
} = useOryFlow();
|
|
1115
1026
|
const { Form, Card } = useComponents();
|
|
1116
|
-
const { flowType, formState, dispatchFormState } = useOryFlow();
|
|
1117
1027
|
const nodeSorter = useNodeSorter();
|
|
1118
1028
|
const sortNodes = (a, b) => nodeSorter(a, b, { flowType });
|
|
1119
1029
|
const uniqueGroups = useNodesGroups(ui.nodes);
|
|
1120
1030
|
const options = Object.values(UiNodeGroupEnum).filter((group) => {
|
|
1121
|
-
var
|
|
1122
|
-
return (
|
|
1031
|
+
var _a;
|
|
1032
|
+
return (_a = uniqueGroups.groups[group]) == null ? void 0 : _a.length;
|
|
1123
1033
|
}).filter(
|
|
1124
1034
|
(group) => ![
|
|
1125
1035
|
UiNodeGroupEnum.Oidc,
|
|
@@ -1128,46 +1038,52 @@ function OryTwoStepCard() {
|
|
|
1128
1038
|
UiNodeGroupEnum.Profile
|
|
1129
1039
|
].includes(group)
|
|
1130
1040
|
);
|
|
1131
|
-
const
|
|
1132
|
-
const zeroStepGroups = filterZeroStepGroups(ui.nodes);
|
|
1041
|
+
const nonOidcNodes = filterOidcOut(ui.nodes);
|
|
1133
1042
|
const finalNodes = formState.current === "method_active" ? getFinalNodes(uniqueGroups.groups, formState.method) : [];
|
|
1043
|
+
const handleAfterFormSubmit = (method) => {
|
|
1044
|
+
if (typeof method !== "string" || !isUINodeGroupEnum(method)) {
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
if (isGroupImmediateSubmit(method)) {
|
|
1048
|
+
dispatchFormState({
|
|
1049
|
+
type: "action_select_method",
|
|
1050
|
+
method
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
const hasOidc = ui.nodes.some((node) => node.group === UiNodeGroupEnum.Oidc);
|
|
1055
|
+
const showOidc = !(formState.current === "method_active" && formState.method !== "oidc");
|
|
1134
1056
|
return /* @__PURE__ */ jsxs(OryCard, { children: [
|
|
1135
1057
|
/* @__PURE__ */ jsx(OryCardHeader, {}),
|
|
1136
1058
|
/* @__PURE__ */ jsxs(OryCardContent, { children: [
|
|
1137
1059
|
/* @__PURE__ */ jsx(OryCardValidationMessages, {}),
|
|
1138
|
-
|
|
1139
|
-
/* @__PURE__ */ jsxs(
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
/* @__PURE__ */
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
] })
|
|
1166
|
-
] }),
|
|
1167
|
-
/* @__PURE__ */ jsx(OryCardFooter, {})
|
|
1168
|
-
]
|
|
1169
|
-
}
|
|
1170
|
-
)
|
|
1060
|
+
showOidc && /* @__PURE__ */ jsx(OryFormSocialButtonsForm, {}),
|
|
1061
|
+
/* @__PURE__ */ jsxs(OryForm, { onAfterSubmit: handleAfterFormSubmit, children: [
|
|
1062
|
+
/* @__PURE__ */ jsxs(Form.Group, { children: [
|
|
1063
|
+
formState.current === "provide_identifier" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1064
|
+
hasOidc && /* @__PURE__ */ jsx(Card.Divider, {}),
|
|
1065
|
+
nonOidcNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
|
|
1066
|
+
] }),
|
|
1067
|
+
formState.current === "select_method" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1068
|
+
/* @__PURE__ */ jsx(Card.Divider, {}),
|
|
1069
|
+
/* @__PURE__ */ jsx(
|
|
1070
|
+
AuthMethodList,
|
|
1071
|
+
{
|
|
1072
|
+
options,
|
|
1073
|
+
setSelectedGroup: (group) => dispatchFormState({
|
|
1074
|
+
type: "action_select_method",
|
|
1075
|
+
method: group
|
|
1076
|
+
})
|
|
1077
|
+
}
|
|
1078
|
+
)
|
|
1079
|
+
] }),
|
|
1080
|
+
formState.current === "method_active" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1081
|
+
ui.nodes.filter((n) => n.type === "script").map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k)),
|
|
1082
|
+
finalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
|
|
1083
|
+
] })
|
|
1084
|
+
] }),
|
|
1085
|
+
/* @__PURE__ */ jsx(OryCardFooter, {})
|
|
1086
|
+
] })
|
|
1171
1087
|
] })
|
|
1172
1088
|
] });
|
|
1173
1089
|
}
|
|
@@ -1190,6 +1106,44 @@ function AuthMethodList({ options, setSelectedGroup }) {
|
|
|
1190
1106
|
option
|
|
1191
1107
|
)) });
|
|
1192
1108
|
}
|
|
1109
|
+
function OryFormGroups({ groups }) {
|
|
1110
|
+
const {
|
|
1111
|
+
flow: { ui }
|
|
1112
|
+
} = useOryFlow();
|
|
1113
|
+
const nodeSorter = useNodeSorter();
|
|
1114
|
+
const { flowType } = useOryFlow();
|
|
1115
|
+
const { Form } = useComponents();
|
|
1116
|
+
const nodes = ui.nodes.filter((node) => groups.indexOf(node.group) > -1).sort((a, b) => nodeSorter(a, b, { flowType }));
|
|
1117
|
+
return /* @__PURE__ */ jsx(Form.Group, { children: nodes.map((node, k) => {
|
|
1118
|
+
return /* @__PURE__ */ jsx(Node, { node }, k);
|
|
1119
|
+
}) });
|
|
1120
|
+
}
|
|
1121
|
+
function OryFormSection({
|
|
1122
|
+
children,
|
|
1123
|
+
nodes,
|
|
1124
|
+
...rest
|
|
1125
|
+
}) {
|
|
1126
|
+
return /* @__PURE__ */ jsx(OryFormProvider, { nodes, children: /* @__PURE__ */ jsx(OryFormSectionInner, { ...rest, children }) });
|
|
1127
|
+
}
|
|
1128
|
+
function OryFormSectionInner({
|
|
1129
|
+
children,
|
|
1130
|
+
...rest
|
|
1131
|
+
}) {
|
|
1132
|
+
const { Card } = useComponents();
|
|
1133
|
+
const flowContainer = useOryFlow();
|
|
1134
|
+
const onSubmit = useOryFormSubmit();
|
|
1135
|
+
const methods = useFormContext();
|
|
1136
|
+
return /* @__PURE__ */ jsx(
|
|
1137
|
+
Card.SettingsSection,
|
|
1138
|
+
{
|
|
1139
|
+
action: flowContainer.flow.ui.action,
|
|
1140
|
+
method: flowContainer.flow.ui.method,
|
|
1141
|
+
onSubmit: (e) => void methods.handleSubmit(onSubmit)(e),
|
|
1142
|
+
...rest,
|
|
1143
|
+
children
|
|
1144
|
+
}
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1193
1147
|
function OryFormGroupDivider() {
|
|
1194
1148
|
const { Card } = useComponents();
|
|
1195
1149
|
const {
|