@ory/elements-react 1.0.0-next.30 → 1.0.0-next.31

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 CHANGED
@@ -1,3 +1,18 @@
1
+ ## 1.0.0-next.31 (2025-03-06)
2
+
3
+ ### 🚀 Features
4
+
5
+ - support captchas natively in new and old elements ([#372](https://github.com/ory/elements/pull/372))
6
+
7
+ ### 🩹 Fixes
8
+
9
+ - center text on OIDC buttons and debounce state update ([#366](https://github.com/ory/elements/pull/366))
10
+
11
+ ### ❤️ Thank You
12
+
13
+ - hackerman @aeneasr
14
+ - Jonas Hungershausen
15
+
1
16
  ## 1.0.0-next.30 (2025-03-05)
2
17
 
3
18
  ### 🩹 Fixes
package/DEVELOPMENT.md CHANGED
@@ -51,13 +51,13 @@ Each flow has its own story in the `packages/elements-react-stories` package. To
51
51
  run the storybook development environment, execute:
52
52
 
53
53
  ```bash
54
- npx nx storybook elements-react-stories
54
+ npx nx storybook @ory/elements-react
55
55
  ```
56
56
 
57
57
  You can also build the Storybook using:
58
58
 
59
59
  ```bash
60
- npx nx build elements-react-stories
60
+ npx nx build @ory/elements-react
61
61
  ```
62
62
 
63
63
  The stories use stub responses
@@ -66,14 +66,31 @@ The stories use stub responses
66
66
 
67
67
  @ory/elements-react and @ory/nextjs is released using nx releases.
68
68
 
69
- There is a helper script located in "./scripts/release.sh".
69
+ There is a helper script located in `./scripts/release.sh`.
70
70
 
71
71
  Usage:
72
72
 
73
73
  ```bash
74
- ./scripts/release.sh @ory/elements-react # or @ory/nextjs
74
+ ./scripts/release.sh <project> <tag>
75
+
76
+ ./scripts/release.sh @ory/elements-react next
75
77
  ```
76
78
 
77
79
  The script asks the user before executing each steps. Please double check
78
80
  CHANGELOG.md and dry run outputs. nx also creates git tags and commits, that
79
81
  should be commited. The script will do that automatically.
82
+
83
+ ### Pre-releasing unmerged changes
84
+
85
+ You can release a PR's changes to npm to test them in a different repository,
86
+ etc. These versions are released on the `pr` npm tag, and will have the version
87
+ `0.0.0-pr.<git hash>`. These releases wont be pushed to master, but you might
88
+ have to revert the `package.json` and `package-lock.json` files.
89
+
90
+ Usage:
91
+
92
+ ```bash
93
+ ./scripts/release.sh <project> <tag>
94
+
95
+ ./scripts/release.sh @ory/elements-react pr
96
+ ```
@@ -0,0 +1,10 @@
1
+ // Copyright © 2025 Ory Corp
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ module.exports = {
5
+ presets: [
6
+ "@babel/preset-env",
7
+ "@babel/preset-react",
8
+ "@babel/preset-typescript",
9
+ ],
10
+ }
package/dist/index.d.mts CHANGED
@@ -28,6 +28,9 @@ type OryNodeTextProps = {
28
28
  node: UiNode;
29
29
  };
30
30
  type OryCardLogoProps = Record<string, never>;
31
+ type OryNodeCaptchaProps = {
32
+ node: UiNode;
33
+ };
31
34
  /**
32
35
  * Props for the AuthMethodListItem component. This component is used
33
36
  * to render a single auth method in the AuthMethodList component.
@@ -237,6 +240,10 @@ type OryFlowComponents = {
237
240
  * The Text component is rendered whenever a "text" node is encountered.
238
241
  */
239
242
  Text: ComponentType<OryNodeTextProps>;
243
+ /**
244
+ * The Captcha component is rendered whenever a "captcha" group is encountered.
245
+ */
246
+ Captcha: ComponentType<OryNodeCaptchaProps>;
240
247
  };
241
248
  Card: {
242
249
  /**
@@ -582,4 +589,4 @@ type OryProviderProps = {
582
589
  } & OryFlowContainer & PropsWithChildren;
583
590
  declare function OryProvider({ children, components: Components, ...oryFlowProps }: OryProviderProps): react_jsx_runtime.JSX.Element;
584
591
 
585
- export { type ErrorFlowContainer, type FlowContainerSetter, type FlowContextValue, type FormState, type FormStateAction, type FormValues, HeadlessPageHeader, type IntlConfig, type LoginFlowContainer, type OnSubmitHandlerProps, OryCard, type OryCardAuthMethodListItemProps, OryCardContent, type OryCardContentProps, type OryCardDividerProps, OryCardFooter, type OryCardFooterProps, OryCardHeader, type OryCardHeaderProps, type OryCardLogoProps, type OryCardRootProps as OryCardProps, type OryCardSettingsSectionProps, OryCardValidationMessages, type OryClientConfiguration, type OryFlowComponentOverrides, type OryFlowComponents, type OryFlowContainer, OryForm, OryFormGroupDivider, type OryFormGroupProps, OryFormGroups, type OryFormGroupsProps, OryFormOidcButtons, type OryFormOidcRootProps, type OryFormProps, type OryFormRootProps, OryFormSection, type OryFormSectionContentProps, type OryFormSectionFooterProps, type OryFormSectionProps, OryFormSocialButtonsForm, OryLocales, type OryMessageContentProps, type OryMessageRootProps, type OryNodeAnchorProps, type OryNodeButtonProps, type OryNodeImageProps, type OryNodeInputProps, type OryNodeLabelProps, type OryNodeOidcButtonProps, type OryNodeTextProps, type OryPageHeaderProps, OryProvider, type OryProviderProps, OrySettingsCard, type OrySettingsOidcProps, type OrySettingsPasskeyProps, type OrySettingsRecoveryCodesProps, type OrySettingsTotpProps, type OrySettingsWebauthnProps, OryTwoStepCard, type RecoveryFlowContainer, type RegistrationFlowContainer, type SettingsFlowContainer, type VerificationFlowContainer, messageTestId, uiTextToFormattedMessage, useComponents, useNodeSorter, useOryFlow };
592
+ export { type ErrorFlowContainer, type FlowContainerSetter, type FlowContextValue, type FormState, type FormStateAction, type FormValues, HeadlessPageHeader, type IntlConfig, type LoginFlowContainer, type OnSubmitHandlerProps, OryCard, type OryCardAuthMethodListItemProps, OryCardContent, type OryCardContentProps, type OryCardDividerProps, OryCardFooter, type OryCardFooterProps, OryCardHeader, type OryCardHeaderProps, type OryCardLogoProps, type OryCardRootProps as OryCardProps, type OryCardSettingsSectionProps, OryCardValidationMessages, type OryClientConfiguration, type OryFlowComponentOverrides, type OryFlowComponents, type OryFlowContainer, OryForm, OryFormGroupDivider, type OryFormGroupProps, OryFormGroups, type OryFormGroupsProps, OryFormOidcButtons, type OryFormOidcRootProps, type OryFormProps, type OryFormRootProps, OryFormSection, type OryFormSectionContentProps, type OryFormSectionFooterProps, type OryFormSectionProps, OryFormSocialButtonsForm, OryLocales, type OryMessageContentProps, type OryMessageRootProps, type OryNodeAnchorProps, type OryNodeButtonProps, type OryNodeCaptchaProps, type OryNodeImageProps, type OryNodeInputProps, type OryNodeLabelProps, type OryNodeOidcButtonProps, type OryNodeTextProps, type OryPageHeaderProps, OryProvider, type OryProviderProps, OrySettingsCard, type OrySettingsOidcProps, type OrySettingsPasskeyProps, type OrySettingsRecoveryCodesProps, type OrySettingsTotpProps, type OrySettingsWebauthnProps, OryTwoStepCard, type RecoveryFlowContainer, type RegistrationFlowContainer, type SettingsFlowContainer, type VerificationFlowContainer, messageTestId, uiTextToFormattedMessage, useComponents, useNodeSorter, useOryFlow };
package/dist/index.d.ts CHANGED
@@ -28,6 +28,9 @@ type OryNodeTextProps = {
28
28
  node: UiNode;
29
29
  };
30
30
  type OryCardLogoProps = Record<string, never>;
31
+ type OryNodeCaptchaProps = {
32
+ node: UiNode;
33
+ };
31
34
  /**
32
35
  * Props for the AuthMethodListItem component. This component is used
33
36
  * to render a single auth method in the AuthMethodList component.
@@ -237,6 +240,10 @@ type OryFlowComponents = {
237
240
  * The Text component is rendered whenever a "text" node is encountered.
238
241
  */
239
242
  Text: ComponentType<OryNodeTextProps>;
243
+ /**
244
+ * The Captcha component is rendered whenever a "captcha" group is encountered.
245
+ */
246
+ Captcha: ComponentType<OryNodeCaptchaProps>;
240
247
  };
241
248
  Card: {
242
249
  /**
@@ -582,4 +589,4 @@ type OryProviderProps = {
582
589
  } & OryFlowContainer & PropsWithChildren;
583
590
  declare function OryProvider({ children, components: Components, ...oryFlowProps }: OryProviderProps): react_jsx_runtime.JSX.Element;
584
591
 
585
- export { type ErrorFlowContainer, type FlowContainerSetter, type FlowContextValue, type FormState, type FormStateAction, type FormValues, HeadlessPageHeader, type IntlConfig, type LoginFlowContainer, type OnSubmitHandlerProps, OryCard, type OryCardAuthMethodListItemProps, OryCardContent, type OryCardContentProps, type OryCardDividerProps, OryCardFooter, type OryCardFooterProps, OryCardHeader, type OryCardHeaderProps, type OryCardLogoProps, type OryCardRootProps as OryCardProps, type OryCardSettingsSectionProps, OryCardValidationMessages, type OryClientConfiguration, type OryFlowComponentOverrides, type OryFlowComponents, type OryFlowContainer, OryForm, OryFormGroupDivider, type OryFormGroupProps, OryFormGroups, type OryFormGroupsProps, OryFormOidcButtons, type OryFormOidcRootProps, type OryFormProps, type OryFormRootProps, OryFormSection, type OryFormSectionContentProps, type OryFormSectionFooterProps, type OryFormSectionProps, OryFormSocialButtonsForm, OryLocales, type OryMessageContentProps, type OryMessageRootProps, type OryNodeAnchorProps, type OryNodeButtonProps, type OryNodeImageProps, type OryNodeInputProps, type OryNodeLabelProps, type OryNodeOidcButtonProps, type OryNodeTextProps, type OryPageHeaderProps, OryProvider, type OryProviderProps, OrySettingsCard, type OrySettingsOidcProps, type OrySettingsPasskeyProps, type OrySettingsRecoveryCodesProps, type OrySettingsTotpProps, type OrySettingsWebauthnProps, OryTwoStepCard, type RecoveryFlowContainer, type RegistrationFlowContainer, type SettingsFlowContainer, type VerificationFlowContainer, messageTestId, uiTextToFormattedMessage, useComponents, useNodeSorter, useOryFlow };
592
+ export { type ErrorFlowContainer, type FlowContainerSetter, type FlowContextValue, type FormState, type FormStateAction, type FormValues, HeadlessPageHeader, type IntlConfig, type LoginFlowContainer, type OnSubmitHandlerProps, OryCard, type OryCardAuthMethodListItemProps, OryCardContent, type OryCardContentProps, type OryCardDividerProps, OryCardFooter, type OryCardFooterProps, OryCardHeader, type OryCardHeaderProps, type OryCardLogoProps, type OryCardRootProps as OryCardProps, type OryCardSettingsSectionProps, OryCardValidationMessages, type OryClientConfiguration, type OryFlowComponentOverrides, type OryFlowComponents, type OryFlowContainer, OryForm, OryFormGroupDivider, type OryFormGroupProps, OryFormGroups, type OryFormGroupsProps, OryFormOidcButtons, type OryFormOidcRootProps, type OryFormProps, type OryFormRootProps, OryFormSection, type OryFormSectionContentProps, type OryFormSectionFooterProps, type OryFormSectionProps, OryFormSocialButtonsForm, OryLocales, type OryMessageContentProps, type OryMessageRootProps, type OryNodeAnchorProps, type OryNodeButtonProps, type OryNodeCaptchaProps, type OryNodeImageProps, type OryNodeInputProps, type OryNodeLabelProps, type OryNodeOidcButtonProps, type OryNodeTextProps, type OryPageHeaderProps, OryProvider, type OryProviderProps, OrySettingsCard, type OrySettingsOidcProps, type OrySettingsPasskeyProps, type OrySettingsRecoveryCodesProps, type OrySettingsTotpProps, type OrySettingsWebauthnProps, OryTwoStepCard, type RecoveryFlowContainer, type RegistrationFlowContainer, type SettingsFlowContainer, type VerificationFlowContainer, messageTestId, uiTextToFormattedMessage, useComponents, useNodeSorter, useOryFlow };
package/dist/index.js CHANGED
@@ -40,6 +40,9 @@ var defaultNodeOrder = [
40
40
  "default",
41
41
  "profile",
42
42
  "password",
43
+ // CAPTCHA is below password because otherwise the password input field
44
+ // would be above the captcha. Somehow, we sort the password sign up button somewhere else to be always at the bottom.
45
+ "captcha",
43
46
  "passkey",
44
47
  "code",
45
48
  "webauthn"
@@ -48,6 +51,11 @@ function defaultNodeSorter(a, b) {
48
51
  var _a, _b;
49
52
  const aGroupWeight = (_a = defaultNodeOrder.indexOf(a.group)) != null ? _a : 999;
50
53
  const bGroupWeight = (_b = defaultNodeOrder.indexOf(b.group)) != null ? _b : 999;
54
+ if (b.group === "captcha" && clientFetch.isUiNodeInputAttributes(a.attributes) && a.attributes.type === "submit") {
55
+ return aGroupWeight - (bGroupWeight - 2);
56
+ } else if (a.group === "captcha" && clientFetch.isUiNodeInputAttributes(b.attributes) && b.attributes.type === "submit") {
57
+ return aGroupWeight - 2 - bGroupWeight;
58
+ }
51
59
  return aGroupWeight - bGroupWeight;
52
60
  }
53
61
  var defaultGroupOrder = [
@@ -96,11 +104,12 @@ function filterOidcOut(nodes) {
96
104
  return nodes.filter((node) => node.group !== clientFetch.UiNodeGroupEnum.Oidc);
97
105
  }
98
106
  function getFinalNodes(uniqueGroups, selectedGroup) {
99
- var _a, _b, _c;
107
+ var _a, _b, _c, _d;
100
108
  const selectedNodes = selectedGroup ? (_a = uniqueGroups[selectedGroup]) != null ? _a : [] : [];
101
109
  return [
102
110
  ...(_b = uniqueGroups == null ? void 0 : uniqueGroups.identifier_first) != null ? _b : [],
103
- ...(_c = uniqueGroups == null ? void 0 : uniqueGroups.default) != null ? _c : []
111
+ ...(_c = uniqueGroups == null ? void 0 : uniqueGroups.default) != null ? _c : [],
112
+ ...(_d = uniqueGroups == null ? void 0 : uniqueGroups.captcha) != null ? _d : []
104
113
  ].flat().filter(
105
114
  (node) => "type" in node.attributes && node.attributes.type === "hidden"
106
115
  ).concat(selectedNodes);
@@ -172,6 +181,7 @@ function nodesToAuthMethodGroups(nodes, excludeAuthMethods = []) {
172
181
  clientFetch.UiNodeGroupEnum.Default,
173
182
  clientFetch.UiNodeGroupEnum.IdentifierFirst,
174
183
  clientFetch.UiNodeGroupEnum.Profile,
184
+ clientFetch.UiNodeGroupEnum.Captcha,
175
185
  ...excludeAuthMethods
176
186
  ].includes(group)
177
187
  );
@@ -952,6 +962,9 @@ var NodeInput = ({
952
962
  };
953
963
  var Node = ({ node, onClick }) => {
954
964
  const { Node: Node2 } = useComponents();
965
+ if (node.group === clientFetch.UiNodeGroupEnum.Captcha) {
966
+ return /* @__PURE__ */ jsxRuntime.jsx(Node2.Captcha, { node });
967
+ }
955
968
  if (clientFetch.isUiNodeImageAttributes(node.attributes)) {
956
969
  return /* @__PURE__ */ jsxRuntime.jsx(Node2.Image, { node, attributes: node.attributes });
957
970
  } else if (clientFetch.isUiNodeTextAttributes(node.attributes)) {
@@ -1037,7 +1050,8 @@ function OryTwoStepCard() {
1037
1050
  clientFetch.UiNodeGroupEnum.Oidc,
1038
1051
  clientFetch.UiNodeGroupEnum.Default,
1039
1052
  clientFetch.UiNodeGroupEnum.IdentifierFirst,
1040
- clientFetch.UiNodeGroupEnum.Profile
1053
+ clientFetch.UiNodeGroupEnum.Profile,
1054
+ clientFetch.UiNodeGroupEnum.Captcha
1041
1055
  ].includes(group)
1042
1056
  );
1043
1057
  const nonOidcNodes = filterOidcOut(ui.nodes);
@@ -1077,7 +1091,8 @@ function OryTwoStepCard() {
1077
1091
  method: group
1078
1092
  })
1079
1093
  }
1080
- )
1094
+ ),
1095
+ ui.nodes.filter((n) => n.group === clientFetch.UiNodeGroupEnum.Captcha).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1081
1096
  ] }),
1082
1097
  formState.current === "method_active" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1083
1098
  ui.nodes.filter((n) => n.type === "script").map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k)),