@swan-io/shared-business 11.3.0 → 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.3.
|
|
3
|
+
"version": "11.3.1",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20.9.0",
|
|
6
6
|
"pnpm": "^9.13.0"
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
],
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@swan-io/lake": "11.3.
|
|
29
|
+
"@swan-io/lake": "11.3.1"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@formatjs/intl": "^3.1.0",
|
|
33
33
|
"@placekit/client-js": "^2.3.0",
|
|
34
34
|
"@swan-io/boxed": "^3.2.0",
|
|
35
|
-
"@swan-io/request": "^
|
|
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",
|
|
@@ -52,6 +52,6 @@
|
|
|
52
52
|
"@types/react-native": "^0.72.8",
|
|
53
53
|
"jsdom": "^25.0.1",
|
|
54
54
|
"vitest": "^2.1.8",
|
|
55
|
-
"@swan-io/lake": "11.3.
|
|
55
|
+
"@swan-io/lake": "11.3.1"
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -39,7 +39,7 @@ const styles = StyleSheet.create({
|
|
|
39
39
|
progress: {
|
|
40
40
|
height: 4,
|
|
41
41
|
transitionProperty: "width",
|
|
42
|
-
transitionDuration: "
|
|
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,
|
|
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
|
-
|
|
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 = (
|
|
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
|
|
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(() => {
|