@swan-io/shared-business 11.2.3 → 11.3.1

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": "11.2.3",
3
+ "version": "11.3.1",
4
4
  "engines": {
5
5
  "node": ">=20.9.0",
6
6
  "pnpm": "^9.13.0"
@@ -26,33 +26,32 @@
26
26
  ],
27
27
  "license": "MIT",
28
28
  "peerDependencies": {
29
- "@swan-io/lake": "11.2.3"
29
+ "@swan-io/lake": "11.3.1"
30
30
  },
31
31
  "dependencies": {
32
- "@formatjs/intl": "^2.10.9",
32
+ "@formatjs/intl": "^3.1.0",
33
33
  "@placekit/client-js": "^2.3.0",
34
- "@swan-io/boxed": "^3.0.0",
35
- "@swan-io/request": "^1.0.6",
34
+ "@swan-io/boxed": "^3.2.0",
35
+ "@swan-io/request": "^2.0.0",
36
36
  "@swan-io/use-form": "^3.1.0",
37
37
  "dayjs": "^1.11.13",
38
38
  "iban": "^0.0.14",
39
39
  "react": "^18.3.1",
40
40
  "react-atomic-state": "^2.0.0",
41
41
  "react-dom": "^18.3.1",
42
- "react-dropzone": "^14.2.10",
42
+ "react-dropzone": "^14.3.5",
43
43
  "react-native-web": "^0.19.13",
44
44
  "rifm": "^0.12.1",
45
- "ts-pattern": "^5.5.0",
46
- "uuid": "^10.0.0"
45
+ "ts-pattern": "^5.6.0",
46
+ "uuid": "^11.0.4"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/iban": "0.0.35",
50
- "@types/react": "^18.3.11",
50
+ "@types/react": "^18.3.12",
51
51
  "@types/react-dom": "^18.3.1",
52
52
  "@types/react-native": "^0.72.8",
53
- "@types/uuid": "^10.0.0",
54
53
  "jsdom": "^25.0.1",
55
- "vitest": "^2.1.3",
56
- "@swan-io/lake": "11.2.3"
54
+ "vitest": "^2.1.8",
55
+ "@swan-io/lake": "11.3.1"
57
56
  }
58
57
  }
@@ -120,7 +120,7 @@ export const FileInput = ({ icon = "document-regular", accept, value, disabled =
120
120
  disabled,
121
121
  maxSize,
122
122
  });
123
- return (_jsx(View, { style: commonStyles.fill, children: _jsx("div", { ...getRootProps(), onMouseEnter: setIsHovered.on, onMouseLeave: setIsHovered.off, children: _jsxs(View, { "aria-errormessage": error !== null && error !== void 0 ? error : (_a = fileRejections[0]) === null || _a === void 0 ? void 0 : _a.errors.join(", "), style: [
123
+ return (_jsx(View, { style: commonStyles.fill, children: _jsx("div", { ...getRootProps(), onMouseEnter: setIsHovered.on, onMouseLeave: setIsHovered.off, children: _jsxs(View, { "aria-errormessage": error !== null && error !== void 0 ? error : (_a = fileRejections[0]) === null || _a === void 0 ? void 0 : _a.errors.map(error => error.message).join(", "), style: [
124
124
  styles.container,
125
125
  disabled && styles.disabled,
126
126
  layout === "horizontal" && styles.horizontalContainer,
@@ -39,7 +39,7 @@ const styles = StyleSheet.create({
39
39
  progress: {
40
40
  height: 4,
41
41
  transitionProperty: "width",
42
- transitionDuration: "300ms",
42
+ transitionDuration: "1000ms",
43
43
  transitionTimingFunction: "ease-in-out",
44
44
  borderRadius: 2,
45
45
  backgroundColor: colors.current[500],
@@ -149,16 +149,16 @@ export const SupportingDocumentCollectionWithRef = ({ documents, generateUpload,
149
149
  status === "WaitingForDocument" &&
150
150
  !areAllDocumentsValidated, accept: ACCEPTED_FORMATS, maxSize: 20000000, icon: "document-regular", initialFiles: files, generateUpload: generateUpload, getUploadConfig: file => ({ fileName: file.name, purpose }), uploadFile: isNotNullish(uploadFile)
151
151
  ? uploadFile
152
- : ({ upload, file, onLoadStart, onProgress }) => {
152
+ : ({ upload, file, onProgress }) => {
153
153
  const body = new FormData();
154
154
  upload.fields.forEach(({ key, value }) => body.append(key, value));
155
155
  body.append("file", file);
156
+ setTimeout(() => onProgress(0.8), 100);
156
157
  return Request.make({
157
158
  url: upload.url,
158
159
  method: "POST",
159
- onLoadStart,
160
- onProgress,
161
160
  body,
161
+ type: "text",
162
162
  }).mapOkToResult(badStatusToError);
163
163
  }, formatAndSizeDescription: t("supportingDocuments.documentTypes", {
164
164
  maxSizeMB: 20000000 / 1000000,
@@ -4,8 +4,7 @@ export type UploadFileInput<UploadOutput> = {
4
4
  id: string;
5
5
  upload: UploadOutput;
6
6
  file: File;
7
- onLoadStart: (event: ProgressEvent<XMLHttpRequestEventTarget>) => void;
8
- onProgress: (event: ProgressEvent<XMLHttpRequestEventTarget>) => void;
7
+ onProgress: (progress: number) => void;
9
8
  };
10
9
  export type UploadOutputWithId<UploadOutput> = {
11
10
  id: string;
@@ -28,14 +28,14 @@ export const useFilesUploader = (config) => {
28
28
  name: file.name,
29
29
  },
30
30
  ]);
31
- const onProgress = (event) => {
31
+ const onProgress = (progress) => {
32
32
  setFiles(files => files.map(file => {
33
33
  if (file.id !== id) {
34
34
  return file;
35
35
  }
36
36
  return {
37
37
  ...file,
38
- statusInfo: { status: "Uploading", progress: event.loaded / event.total },
38
+ statusInfo: { status: "Uploading", progress },
39
39
  };
40
40
  }));
41
41
  };
@@ -44,7 +44,6 @@ export const useFilesUploader = (config) => {
44
44
  id,
45
45
  upload,
46
46
  file,
47
- onLoadStart: onProgress,
48
47
  onProgress,
49
48
  })
50
49
  .tapOk(() => {