@edifice.io/react 2.2.5-develop-b2school.20250507154133 → 2.2.5-develop-b2school.20250512140510

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.
@@ -8,10 +8,19 @@ const useHttpErrorToast = (options) => {
8
8
  } = useTranslation();
9
9
  return useEffect(() => {
10
10
  const subscription = odeServices.notify().events().subscribe(LAYER_NAME.TRANSPORT, (event) => {
11
- var _a, _b;
12
- message.current = t(((_b = (_a = event == null ? void 0 : event.data) == null ? void 0 : _a.payload) == null ? void 0 : _b.error) || event.data.response.statusText), toast.error(/* @__PURE__ */ React.createElement("div", {
11
+ var _a;
12
+ if (!(event != null && event.data)) return;
13
+ const {
14
+ response
15
+ } = event.data, i18nKey = (
16
+ // The payload may include the i18n key of the error message to show,
17
+ ((_a = event.data.payload) == null ? void 0 : _a.error) || // otherwise, try showing the translation of some known HTTP error code.
18
+ ([400, 401, 403, 404, 408, 413, 500, 504].includes(response == null ? void 0 : response.status) ? `e${event.data.response.status}` : void 0) || // otherwise try showing the statusText (may be technical, in english),
19
+ (response == null ? void 0 : response.statusText)
20
+ );
21
+ typeof i18nKey == "string" && (message.current = t(i18nKey), toast.error(/* @__PURE__ */ React.createElement("div", {
13
22
  children: [message.current]
14
- }), options);
23
+ }), options));
15
24
  });
16
25
  return () => subscription.revoke();
17
26
  }, [t, toast]), message.current;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.2.5-develop-b2school.20250507154133",
3
+ "version": "2.2.5-develop-b2school.20250512140510",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -118,9 +118,9 @@
118
118
  "react-slugify": "^3.0.3",
119
119
  "swiper": "^10.1.0",
120
120
  "ua-parser-js": "^1.0.36",
121
- "@edifice.io/bootstrap": "2.2.5-develop-b2school.20250507154133",
122
- "@edifice.io/tiptap-extensions": "2.2.5-develop-b2school.20250507154133",
123
- "@edifice.io/utilities": "2.2.5-develop-b2school.20250507154133"
121
+ "@edifice.io/bootstrap": "2.2.5-develop-b2school.20250512140510",
122
+ "@edifice.io/tiptap-extensions": "2.2.5-develop-b2school.20250512140510",
123
+ "@edifice.io/utilities": "2.2.5-develop-b2school.20250512140510"
124
124
  },
125
125
  "devDependencies": {
126
126
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -151,8 +151,8 @@
151
151
  "vite": "^5.4.11",
152
152
  "vite-plugin-dts": "^4.1.0",
153
153
  "vite-tsconfig-paths": "^5.0.1",
154
- "@edifice.io/client": "2.2.5-develop-b2school.20250507154133",
155
- "@edifice.io/config": "2.2.5-develop-b2school.20250507154133"
154
+ "@edifice.io/client": "2.2.5-develop-b2school.20250512140510",
155
+ "@edifice.io/config": "2.2.5-develop-b2school.20250512140510"
156
156
  },
157
157
  "peerDependencies": {
158
158
  "@react-spring/web": "^9.7.5",