@swan-io/shared-business 7.4.6 → 8.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-io/shared-business",
3
- "version": "7.4.6",
3
+ "version": "8.0.0",
4
4
  "engines": {
5
5
  "node": ">=18.0.0",
6
6
  "yarn": "^1.22.0"
@@ -32,6 +32,7 @@
32
32
  "@formatjs/intl": "^2.10.1",
33
33
  "@placekit/client-js": "^2.3.0",
34
34
  "@swan-io/boxed": "^2.1.1",
35
+ "@swan-io/graphql-client": "^0.1.0",
35
36
  "@swan-io/request": "^1.0.2",
36
37
  "@swan-io/use-form": "^2.0.0",
37
38
  "dayjs": "^1.11.10",
@@ -43,7 +44,6 @@
43
44
  "react-native-web": "^0.19.10",
44
45
  "rifm": "^0.12.1",
45
46
  "ts-pattern": "^5.1.0",
46
- "urql": "^4.0.7",
47
47
  "uuid": "^9.0.1"
48
48
  },
49
49
  "devDependencies": {
package/src/utils/i18n.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { createIntl, createIntlCache } from "@formatjs/intl";
2
2
  import { getRifmProps } from "@swan-io/lake/src/utils/rifm";
3
+ import { BadStatusError } from "@swan-io/request";
3
4
  import dayjs from "dayjs";
4
5
  import dayjsLocaleDE from "dayjs/locale/de";
5
6
  import dayjsLocaleEN from "dayjs/locale/en";
@@ -15,7 +16,6 @@ import relativeTime from "dayjs/plugin/relativeTime";
15
16
  import utc from "dayjs/plugin/utc";
16
17
  import { cloneElement, isValidElement } from "react";
17
18
  import { P, match } from "ts-pattern";
18
- import { CombinedError } from "urql";
19
19
  import translationDE from "../locales/de.json";
20
20
  import translationEN from "../locales/en.json";
21
21
  import translationES from "../locales/es.json";
@@ -133,9 +133,7 @@ export const translateError = (error) => {
133
133
  .returnType()
134
134
  .with({ __typename: P.select(P.string) }, __typename => `rejection.${__typename}`)
135
135
  .with(P.string, __typename => `rejection.${__typename}`)
136
- .with(P.instanceOf(CombinedError), ({ response }) => match(response)
137
- .with({ response: { status: P.select(P.number) } }, status => `error.network.${status}`)
138
- .otherwise(() => "error.generic"))
136
+ .with(P.instanceOf(BadStatusError), ({ status }) => `error.network.${status}`)
139
137
  .with(P.instanceOf(Error), ({ message }) => `rejection.${message}`)
140
138
  .otherwise(() => "error.generic");
141
139
  return t(isTranslationKey(key) ? key : "error.generic");