@ory/elements-react 0.0.0-pr.3a98de9 → 0.0.0-pr.4a28a8f

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,63 @@
1
+ ## 1.0.0-next.39 (2025-03-25)
2
+
3
+ ### 🚀 Features
4
+
5
+ - add SAML group handling ([#390](https://github.com/ory/elements/pull/390))
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - hackerman @aeneasr
10
+
11
+ ## 1.0.0-next.38 (2025-03-24)
12
+
13
+ ### 🩹 Fixes
14
+
15
+ - hide registration link again ([#387](https://github.com/ory/elements/pull/387))
16
+
17
+ ### ❤️ Thank You
18
+
19
+ - hackerman @aeneasr
20
+
21
+ ## 1.0.0-next.37 (2025-03-12)
22
+
23
+ ### 🩹 Fixes
24
+
25
+ - correctly render test id for error card ([#386](https://github.com/ory/elements/pull/386))
26
+
27
+ ### ❤️ Thank You
28
+
29
+ - Jonas Hungershausen
30
+
31
+ ## 1.0.0-next.36 (2025-03-12)
32
+
33
+ ### 🩹 Fixes
34
+
35
+ - handle error messages for selected methods ([#385](https://github.com/ory/elements/pull/385))
36
+
37
+ ### ❤️ Thank You
38
+
39
+ - Pierre Caillaud @pcaillaudm
40
+
41
+ ## 1.0.0-next.35 (2025-03-12)
42
+
43
+ ### 🚀 Features
44
+
45
+ - add more intelligent error screen ([#383](https://github.com/ory/elements/pull/383))
46
+
47
+ ### ❤️ Thank You
48
+
49
+ - Jonas Hungershausen
50
+
51
+ ## 1.0.0-next.34 (2025-03-12)
52
+
53
+ ### 🩹 Fixes
54
+
55
+ - use correct import paths ([#384](https://github.com/ory/elements/pull/384))
56
+
57
+ ### ❤️ Thank You
58
+
59
+ - hackerman @aeneasr
60
+
1
61
  ## 1.0.0-next.33 (2025-03-07)
2
62
 
3
63
  ### 🚀 Features
package/dist/index.d.mts CHANGED
@@ -404,6 +404,7 @@ type OryClientConfiguration = {
404
404
  registration_ui_url: string;
405
405
  verification_ui_url: string;
406
406
  login_ui_url: string;
407
+ default_redirect_url?: string;
407
408
  };
408
409
  intl?: IntlConfig;
409
410
  };
package/dist/index.d.ts CHANGED
@@ -404,6 +404,7 @@ type OryClientConfiguration = {
404
404
  registration_ui_url: string;
405
405
  verification_ui_url: string;
406
406
  login_ui_url: string;
407
+ default_redirect_url?: string;
407
408
  };
408
409
  intl?: IntlConfig;
409
410
  };
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ function useGroupSorter() {
36
36
  }
37
37
  var defaultNodeOrder = [
38
38
  "oidc",
39
+ "saml",
39
40
  "identifier_first",
40
41
  "default",
41
42
  "profile",
@@ -100,8 +101,10 @@ function isChoosingMethod(flow) {
100
101
  (node) => node.group === clientFetch.UiNodeGroupEnum.IdentifierFirst && "name" in node.attributes && node.attributes.name === "identifier" && node.attributes.type === "hidden"
101
102
  ) || flow.flowType === clientFetch.FlowType.Login && flow.flow.requested_aal === "aal2";
102
103
  }
103
- function filterOidcOut(nodes) {
104
- return nodes.filter((node) => node.group !== clientFetch.UiNodeGroupEnum.Oidc);
104
+ function removeSsoNodes(nodes) {
105
+ return nodes.filter(
106
+ (node) => !(node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml)
107
+ );
105
108
  }
106
109
  function getFinalNodes(uniqueGroups, selectedGroup) {
107
110
  var _a, _b, _c, _d;
@@ -234,7 +237,9 @@ function parseStateFromFlow(flow) {
234
237
  return { current: "method_active", method: "code" };
235
238
  } else if (methodWithMessage) {
236
239
  return { current: "method_active", method: methodWithMessage.group };
237
- } else if (flow.flow.active && !["default", "identifier_first", "oidc"].includes(flow.flow.active)) {
240
+ } else if (flow.flow.active && !["default", "identifier_first", "oidc", "saml"].includes(
241
+ flow.flow.active
242
+ )) {
238
243
  return { current: "method_active", method: flow.flow.active };
239
244
  } else if (isChoosingMethod(flow)) {
240
245
  const authMethods = nodesToAuthMethodGroups(flow.flow.ui.nodes);
@@ -264,17 +269,24 @@ function parseStateFromFlow(flow) {
264
269
  );
265
270
  throw new Error("Unknown form state");
266
271
  }
267
- function formStateReducer(state, action) {
268
- switch (action.type) {
269
- case "action_flow_update":
270
- return parseStateFromFlow(action.flow);
271
- case "action_select_method":
272
- return { current: "method_active", method: action.method };
273
- }
274
- return state;
275
- }
276
272
  function useFormStateReducer(flow) {
277
- return react.useReducer(formStateReducer, parseStateFromFlow(flow));
273
+ const action = parseStateFromFlow(flow);
274
+ const [selectedMethod, setSelectedMethod] = react.useState();
275
+ const formStateReducer = (state, action2) => {
276
+ switch (action2.type) {
277
+ case "action_flow_update": {
278
+ if (selectedMethod)
279
+ return { current: "method_active", method: selectedMethod };
280
+ return parseStateFromFlow(action2.flow);
281
+ }
282
+ case "action_select_method": {
283
+ setSelectedMethod(action2.method);
284
+ return { current: "method_active", method: action2.method };
285
+ }
286
+ }
287
+ return state;
288
+ };
289
+ return react.useReducer(formStateReducer, action);
278
290
  }
279
291
  function useOryFlow() {
280
292
  const ctx = react.useContext(OryFlowContext);
@@ -795,7 +807,7 @@ function useOryFormSubmit(onAfterSubmit) {
795
807
  if ("lookup_secret_confirm" in submitData || "lookup_secret_reveal" in submitData || "lookup_secret_regenerate" in submitData || "lookup_secret_disable" in submitData) {
796
808
  submitData.method = "lookup_secret";
797
809
  }
798
- if (submitData.method === "oidc" && submitData.link && supportsSelectAccountPrompt.includes(submitData.link)) {
810
+ if (submitData.method === clientFetch.UiNodeGroupEnum.Oidc && submitData.link && supportsSelectAccountPrompt.includes(submitData.link)) {
799
811
  submitData.upstream_parameters = {
800
812
  prompt: "select_account"
801
813
  };
@@ -936,7 +948,7 @@ var NodeInput = ({
936
948
  triggerToWindowCall(onclickTrigger);
937
949
  }
938
950
  };
939
- const isSocial = (attrs.name === "provider" || attrs.name === "link") && node.group === "oidc";
951
+ const isSocial = (attrs.name === "provider" || attrs.name === "link") && (node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml);
940
952
  const isPinCodeInput = attrs.name === "code" && node.group === "code" || attrs.name === "totp_code" && node.group === "totp";
941
953
  switch (attributes.type) {
942
954
  case clientFetch.UiNodeInputAttributesTypeEnum.Submit:
@@ -1019,7 +1031,9 @@ function OryFormOidcButtons() {
1019
1031
  flow: { ui }
1020
1032
  } = useOryFlow();
1021
1033
  const { setValue } = reactHookForm.useFormContext();
1022
- const filteredNodes = ui.nodes.filter((node) => node.group === "oidc");
1034
+ const filteredNodes = ui.nodes.filter(
1035
+ (node) => node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml
1036
+ );
1023
1037
  const { Form, Node: Node2 } = useComponents();
1024
1038
  if (filteredNodes.length === 0) {
1025
1039
  return null;
@@ -1034,7 +1048,7 @@ function OryFormOidcButtons() {
1034
1048
  "provider",
1035
1049
  node.attributes.value
1036
1050
  );
1037
- setValue("method", "oidc");
1051
+ setValue("method", node.group);
1038
1052
  }
1039
1053
  },
1040
1054
  k
@@ -1044,7 +1058,7 @@ function OryFormSocialButtonsForm() {
1044
1058
  const {
1045
1059
  flow: { ui }
1046
1060
  } = useOryFlow();
1047
- const filteredNodes = ui.nodes.filter((node) => node.group === "oidc");
1061
+ const filteredNodes = ui.nodes.filter((node) => node.group === clientFetch.UiNodeGroupEnum.Saml || node.group === clientFetch.UiNodeGroupEnum.Oidc);
1048
1062
  if (filteredNodes.length === 0) {
1049
1063
  return null;
1050
1064
  }
@@ -1068,6 +1082,7 @@ function OryTwoStepCard() {
1068
1082
  }).filter(
1069
1083
  (group) => ![
1070
1084
  clientFetch.UiNodeGroupEnum.Oidc,
1085
+ clientFetch.UiNodeGroupEnum.Saml,
1071
1086
  clientFetch.UiNodeGroupEnum.Default,
1072
1087
  clientFetch.UiNodeGroupEnum.IdentifierFirst,
1073
1088
  clientFetch.UiNodeGroupEnum.Profile,
@@ -1095,7 +1110,7 @@ function OryTwoStepCard() {
1095
1110
  };
1096
1111
  }
1097
1112
  }
1098
- const nonOidcNodes = filterOidcOut(ui.nodes);
1113
+ const nonSsoNodes = removeSsoNodes(ui.nodes);
1099
1114
  const finalNodes = formState.current === "method_active" ? getFinalNodes(uniqueGroups.groups, formState.method) : [];
1100
1115
  const handleAfterFormSubmit = (method) => {
1101
1116
  if (typeof method !== "string" || !isUINodeGroupEnum(method)) {
@@ -1108,18 +1123,28 @@ function OryTwoStepCard() {
1108
1123
  });
1109
1124
  }
1110
1125
  };
1111
- const hasOidc = ui.nodes.some((node) => node.group === clientFetch.UiNodeGroupEnum.Oidc);
1112
- const showOidc = !(formState.current === "method_active" && formState.method !== "oidc");
1126
+ const hasSso = ui.nodes.some(
1127
+ (node) => node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml
1128
+ );
1129
+ const showSso = !(formState.current === "method_active" && !(formState.method === clientFetch.UiNodeGroupEnum.Oidc || formState.method === clientFetch.UiNodeGroupEnum.Saml));
1130
+ const showSsoDivider = hasSso && nonSsoNodes.filter((n) => {
1131
+ if (clientFetch.isUiNodeInputAttributes(n.attributes)) {
1132
+ return n.attributes.type !== clientFetch.UiNodeInputAttributesTypeEnum.Hidden;
1133
+ } else if (clientFetch.isUiNodeScriptAttributes(n.attributes)) {
1134
+ return false;
1135
+ }
1136
+ return true;
1137
+ }).length > 0;
1113
1138
  return /* @__PURE__ */ jsxRuntime.jsxs(OryCard, { children: [
1114
1139
  /* @__PURE__ */ jsxRuntime.jsx(OryCardHeader, {}),
1115
1140
  /* @__PURE__ */ jsxRuntime.jsxs(OryCardContent, { children: [
1116
1141
  /* @__PURE__ */ jsxRuntime.jsx(OryCardValidationMessages, {}),
1117
- showOidc && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
1142
+ showSso && /* @__PURE__ */ jsxRuntime.jsx(OryFormSocialButtonsForm, {}),
1118
1143
  /* @__PURE__ */ jsxRuntime.jsxs(OryForm, { onAfterSubmit: handleAfterFormSubmit, children: [
1119
1144
  /* @__PURE__ */ jsxRuntime.jsxs(Form.Group, { children: [
1120
1145
  formState.current === "provide_identifier" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1121
- hasOidc && /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
1122
- nonOidcNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1146
+ showSsoDivider && /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
1147
+ nonSsoNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k))
1123
1148
  ] }),
1124
1149
  formState.current === "select_method" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1125
1150
  /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {}),
@@ -1212,9 +1237,11 @@ function OryFormGroupDivider() {
1212
1237
  const {
1213
1238
  flow: { ui }
1214
1239
  } = useOryFlow();
1215
- const filteredNodes = ui.nodes.filter((node) => node.group === "oidc");
1240
+ const filteredNodes = ui.nodes.filter(
1241
+ (node) => node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml
1242
+ );
1216
1243
  const otherNodes = ui.nodes.filter(
1217
- (node) => node.group !== "oidc" && node.group !== "default"
1244
+ (node) => !(node.group === clientFetch.UiNodeGroupEnum.Oidc || node.group === clientFetch.UiNodeGroupEnum.Saml) && node.group !== "default"
1218
1245
  );
1219
1246
  if (filteredNodes.length > 0 && otherNodes.length > 0) {
1220
1247
  return /* @__PURE__ */ jsxRuntime.jsx(Card.Divider, {});
@@ -1240,7 +1267,7 @@ function OrySettingsOidc({ nodes }) {
1240
1267
  onClick: () => {
1241
1268
  if (node.attributes.node_type === "input") {
1242
1269
  setValue("link", node.attributes.value);
1243
- setValue("method", "oidc");
1270
+ setValue("method", node.group);
1244
1271
  }
1245
1272
  }
1246
1273
  }));
@@ -1249,7 +1276,7 @@ function OrySettingsOidc({ nodes }) {
1249
1276
  onClick: () => {
1250
1277
  if (node.attributes.node_type === "input") {
1251
1278
  setValue("unlink", node.attributes.value);
1252
- setValue("method", "oidc");
1279
+ setValue("method", node.group);
1253
1280
  }
1254
1281
  }
1255
1282
  }));
@@ -2003,7 +2030,13 @@ var en_default = {
2003
2030
  "property.phone": "phone",
2004
2031
  "property.username": "username",
2005
2032
  "property.identifier": "identifier",
2006
- "property.code": "code"
2033
+ "property.code": "code",
2034
+ "error.title.what-happened": "What happened?",
2035
+ "error.title.what-can-i-do": "What can I do?",
2036
+ "error.instructions": "Please try again in a few minutes or contact the website operator.",
2037
+ "error.footer.text": "When reporting this error, please include the following information:",
2038
+ "error.footer.copy": "Copy",
2039
+ "error.action.go-back": "Go back"
2007
2040
  };
2008
2041
 
2009
2042
  // src/locales/de.json
@@ -2268,7 +2301,13 @@ var de_default = {
2268
2301
  "property.password": "Passwort",
2269
2302
  "property.phone": "Telefon",
2270
2303
  "property.code": "Code",
2271
- "property.username": "Benutzername"
2304
+ "property.username": "Benutzername",
2305
+ "error.title.what-happened": "Was ist passiert?",
2306
+ "error.footer.copy": "Kopieren",
2307
+ "error.footer.text": "Bitte f\xFCgen Sie bei der Meldung dieses Fehlers die folgenden Informationen hinzu:",
2308
+ "error.instructions": "Bitte versuchen Sie es in wenigen Minuten erneut oder wenden Sie sich an den Website-Betreiber.",
2309
+ "error.title.what-can-i-do": "Was kann ich tun?",
2310
+ "error.action.go-back": "Zur\xFCck"
2272
2311
  };
2273
2312
 
2274
2313
  // src/locales/es.json
@@ -2284,7 +2323,7 @@ var es_default = {
2284
2323
  "error.back-button": "Regresar",
2285
2324
  "error.description": "Ocurri\xF3 un error con el siguiente mensaje:",
2286
2325
  "error.support-email-link": "Si el problema persiste, por favor contacte a <a>{contactSupportEmail}</a>",
2287
- "error.title": "Ocurri\xF3 un error",
2326
+ "error.title": "",
2288
2327
  "error.title-internal-server-error": "Error Interno del Servidor",
2289
2328
  "error.title-not-found": "404 - P\xE1gina no encontrada",
2290
2329
  "identities.messages.1010001": "Iniciar sesi\xF3n",
@@ -2533,7 +2572,13 @@ var es_default = {
2533
2572
  "property.identifier": "",
2534
2573
  "property.password": "",
2535
2574
  "property.phone": "",
2536
- "property.username": ""
2575
+ "property.username": "",
2576
+ "error.action.go-back": "",
2577
+ "error.footer.copy": "",
2578
+ "error.footer.text": "",
2579
+ "error.instructions": "",
2580
+ "error.title.what-can-i-do": "",
2581
+ "error.title.what-happened": ""
2537
2582
  };
2538
2583
 
2539
2584
  // src/locales/fr.json
@@ -2798,7 +2843,13 @@ var fr_default = {
2798
2843
  "property.identifier": "",
2799
2844
  "property.password": "",
2800
2845
  "property.phone": "",
2801
- "property.username": ""
2846
+ "property.username": "",
2847
+ "error.action.go-back": "",
2848
+ "error.footer.copy": "",
2849
+ "error.footer.text": "",
2850
+ "error.title.what-can-i-do": "",
2851
+ "error.title.what-happened": "",
2852
+ "error.instructions": ""
2802
2853
  };
2803
2854
 
2804
2855
  // src/locales/nl.json
@@ -3063,7 +3114,13 @@ var nl_default = {
3063
3114
  "property.identifier": "",
3064
3115
  "property.password": "",
3065
3116
  "property.phone": "",
3066
- "property.username": ""
3117
+ "property.username": "",
3118
+ "error.action.go-back": "",
3119
+ "error.footer.copy": "",
3120
+ "error.footer.text": "",
3121
+ "error.title.what-can-i-do": "",
3122
+ "error.title.what-happened": "",
3123
+ "error.instructions": ""
3067
3124
  };
3068
3125
 
3069
3126
  // src/locales/pl.json
@@ -3328,7 +3385,13 @@ var pl_default = {
3328
3385
  "property.password": "",
3329
3386
  "property.phone": "",
3330
3387
  "property.username": "",
3331
- "property.identifier": ""
3388
+ "property.identifier": "",
3389
+ "error.action.go-back": "",
3390
+ "error.footer.copy": "",
3391
+ "error.footer.text": "",
3392
+ "error.title.what-can-i-do": "",
3393
+ "error.title.what-happened": "",
3394
+ "error.instructions": ""
3332
3395
  };
3333
3396
 
3334
3397
  // src/locales/pt.json
@@ -3593,7 +3656,13 @@ var pt_default = {
3593
3656
  "property.identifier": "",
3594
3657
  "property.password": "",
3595
3658
  "property.phone": "",
3596
- "property.username": ""
3659
+ "property.username": "",
3660
+ "error.action.go-back": "",
3661
+ "error.footer.copy": "",
3662
+ "error.footer.text": "",
3663
+ "error.title.what-can-i-do": "",
3664
+ "error.title.what-happened": "",
3665
+ "error.instructions": ""
3597
3666
  };
3598
3667
 
3599
3668
  // src/locales/sv.json
@@ -3858,7 +3927,13 @@ var sv_default = {
3858
3927
  "property.phone": "telefon",
3859
3928
  "property.username": "anv\xE4ndarnamn",
3860
3929
  "property.identifier": "identifier",
3861
- "property.code": "kod"
3930
+ "property.code": "kod",
3931
+ "error.action.go-back": "",
3932
+ "error.footer.copy": "",
3933
+ "error.footer.text": "",
3934
+ "error.title.what-can-i-do": "",
3935
+ "error.title.what-happened": "",
3936
+ "error.instructions": ""
3862
3937
  };
3863
3938
 
3864
3939
  // src/locales/index.ts