@daeryun/dr_components 1.1.22 → 1.1.24

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.
Files changed (25) hide show
  1. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  2. package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.js +1 -1
  3. package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.ts +1 -1
  4. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +24 -16
  5. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +73 -70
  6. package/dist/components/common/integrate/index.d.ts +1 -1
  7. package/dist/components/page/Login/LoginShareCheckContainer.jsx +2 -2
  8. package/dist/components/page/Login/LoginShareCheckContainer.tsx +2 -2
  9. package/dist/components/page/Login/_hooks/useAppLoginDetect.js +1 -1
  10. package/dist/components/page/Login/_hooks/useAppLoginDetect.ts +3 -4
  11. package/dist/components/page/MapPage/MapPage.jsx +1 -1
  12. package/dist/components/page/MapPage/MapPage.tsx +1 -1
  13. package/dist/components/page/MyCase/[id]/_component/_document/Document.jsx +2 -2
  14. package/dist/components/page/MyCase/[id]/_component/_document/Document.tsx +2 -2
  15. package/dist/components/page/MyCase/[id]/_component/_document/FileUpload.js +3 -3
  16. package/dist/components/page/MyCase/[id]/_component/_document/FileUpload.ts +3 -4
  17. package/dist/components/page/MyCase/_actions/action.d.ts +12 -7
  18. package/dist/components/page/MyCase/_actions/action.js +5 -10
  19. package/dist/components/page/MyCase/_actions/action.ts +13 -16
  20. package/dist/components/page/MyCase/_fetchers/addMyFileUpload.d.ts +7 -2
  21. package/dist/components/page/MyCase/_fetchers/addMyFileUpload.js +36 -27
  22. package/dist/components/page/MyCase/_fetchers/addMyFileUpload.ts +41 -29
  23. package/dist/styles/globals.css +386 -386
  24. package/dist/tsconfig.tsbuildinfo +1 -1
  25. package/package.json +1 -1
@@ -20,51 +20,60 @@ const addMyFileUpload = (_a) => __awaiter(void 0, [_a], void 0, function* ({ id,
20
20
  target: 'legalCase',
21
21
  caseIdx: parseInt(id, 10),
22
22
  parentDir: null,
23
- fileNames: [file.name]
23
+ fileNames: file.map(file => file.name)
24
24
  })
25
25
  });
26
26
  if (!response.result) {
27
27
  throw new Error('Failed to get S3 presigned URL');
28
28
  }
29
29
  // 2단계: 받은 presigned URL로 실제 파일을 S3에 업로드
30
- const uploadData = response.data[0]; // 첫 번째 파일 정보
31
- const { url: presignedUrl, name: fileName } = uploadData;
32
- // 파일명과 일치하는 파일을 찾아 업로드 (현재는 하나만 업로드하므로 첫 번째 파일 사용)
33
- const uploadResponse = yield fetch(presignedUrl, {
34
- method: 'PUT',
35
- headers: {
36
- 'Content-Type': 'application/octet-stream'
37
- },
38
- body: file
39
- });
40
- if (!uploadResponse.ok) {
41
- throw new Error(`S3 upload failed: ${uploadResponse.statusText}`);
42
- }
30
+ const uploadData = response.data;
31
+ // 2단계: presigned URL 로 각각의 파일 업로드
32
+ const uploadResults = yield Promise.all(uploadData.map((_a) => __awaiter(void 0, [_a], void 0, function* ({ url: presignedUrl, name }) {
33
+ const targetFile = file.find(f => f.name === name);
34
+ if (!targetFile)
35
+ throw new Error(`File not found for ${name}`);
36
+ const uploadResponse = yield fetch(presignedUrl, {
37
+ method: 'PUT',
38
+ headers: { 'Content-Type': 'application/octet-stream' },
39
+ body: targetFile
40
+ });
41
+ if (!uploadResponse.ok) {
42
+ throw new Error(`S3 upload failed: ${uploadResponse.statusText}`);
43
+ }
44
+ // CloudFront 경로 변환
45
+ const urlObject = new URL(presignedUrl);
46
+ const s3Path = urlObject.pathname;
47
+ const cloudFrontPath = `https://d6robzfync7d.cloudfront.net${s3Path}`;
48
+ return {
49
+ name,
50
+ path: cloudFrontPath,
51
+ size: targetFile.size,
52
+ status: uploadResponse.status
53
+ };
54
+ })));
55
+ // if (!uploadResponse.ok) {
56
+ // throw new Error(`S3 upload failed: ${uploadResponse.statusText}`)
57
+ // }
43
58
  // 3단계: 서버에 업로드 완료 알림
44
- // presigned URL에서 실제 파일 경로 추출
45
- const urlObject = new URL(presignedUrl);
46
- const s3Path = urlObject.pathname;
47
- const cloudFrontPath = `https://d6robzfync7d.cloudfront.net${s3Path}`;
48
59
  const notifyResponse = yield Fetch(`/api/lawfirm/app/case/${id}/docs/upload`, {
49
60
  method: 'POST',
50
61
  headers: {
51
- // Authorization: `${jwt}`
62
+ // Authorization: `${jwt}`,
52
63
  },
53
64
  body: JSON.stringify({
54
65
  caseIdx: parseInt(id, 10),
55
- files: [
56
- {
57
- name: fileName,
58
- path: cloudFrontPath,
59
- size: file.size
60
- }
61
- ]
66
+ files: uploadResults.map(({ name, path, size }) => ({
67
+ name,
68
+ path,
69
+ size
70
+ }))
62
71
  })
63
72
  });
64
73
  return {
65
74
  result: true,
66
75
  data: response.data,
67
- uploadStatus: uploadResponse.status,
76
+ uploads: uploadResults,
68
77
  notificationStatus: notifyResponse.result
69
78
  };
70
79
  }
@@ -1,6 +1,6 @@
1
1
  import Fetch from '../../Login/_fetch/fetch';
2
2
 
3
- const addMyFileUpload = async ({ id, file }: { id: string; file: File }) => {
3
+ const addMyFileUpload = async ({ id, file }: { id: string; file: File[] }) => {
4
4
  try {
5
5
  // 1단계: S3 presigned URL 요청
6
6
  const response = await Fetch(`/api/lawfirm/app/s3-upload`, {
@@ -12,7 +12,7 @@ const addMyFileUpload = async ({ id, file }: { id: string; file: File }) => {
12
12
  target: 'legalCase',
13
13
  caseIdx: parseInt(id, 10),
14
14
  parentDir: null,
15
- fileNames: [file.name]
15
+ fileNames: file.map(file => file.name)
16
16
  })
17
17
  });
18
18
 
@@ -21,49 +21,61 @@ const addMyFileUpload = async ({ id, file }: { id: string; file: File }) => {
21
21
  }
22
22
 
23
23
  // 2단계: 받은 presigned URL로 실제 파일을 S3에 업로드
24
- const uploadData = response.data[0]; // 첫 번째 파일 정보
25
- const { url: presignedUrl, name: fileName } = uploadData;
24
+ const uploadData: { url: string; name: string }[] = response.data;
25
+ // 2단계: presigned URL 로 각각의 파일 업로드
26
+ const uploadResults = await Promise.all(
27
+ uploadData.map(async ({ url: presignedUrl, name }) => {
28
+ const targetFile = file.find(f => f.name === name);
29
+ if (!targetFile) throw new Error(`File not found for ${name}`);
26
30
 
27
- // 파일명과 일치하는 파일을 찾아 업로드 (현재는 하나만 업로드하므로 첫 번째 파일 사용)
28
- const uploadResponse = await fetch(presignedUrl, {
29
- method: 'PUT',
30
- headers: {
31
- 'Content-Type': 'application/octet-stream'
32
- },
33
- body: file
34
- });
31
+ const uploadResponse = await fetch(presignedUrl, {
32
+ method: 'PUT',
33
+ headers: { 'Content-Type': 'application/octet-stream' },
34
+ body: targetFile
35
+ });
35
36
 
36
- if (!uploadResponse.ok) {
37
- throw new Error(`S3 upload failed: ${uploadResponse.statusText}`);
38
- }
37
+ if (!uploadResponse.ok) {
38
+ throw new Error(`S3 upload failed: ${uploadResponse.statusText}`);
39
+ }
39
40
 
40
- // 3단계: 서버에 업로드 완료 알림
41
- // presigned URL에서 실제 파일 경로 추출
42
- const urlObject = new URL(presignedUrl);
43
- const s3Path = urlObject.pathname;
44
- const cloudFrontPath = `https://d6robzfync7d.cloudfront.net${s3Path}`;
41
+ // CloudFront 경로 변환
42
+ const urlObject = new URL(presignedUrl);
43
+ const s3Path = urlObject.pathname;
44
+ const cloudFrontPath = `https://d6robzfync7d.cloudfront.net${s3Path}`;
45
45
 
46
+ return {
47
+ name,
48
+ path: cloudFrontPath,
49
+ size: targetFile.size,
50
+ status: uploadResponse.status
51
+ };
52
+ })
53
+ );
54
+
55
+ // if (!uploadResponse.ok) {
56
+ // throw new Error(`S3 upload failed: ${uploadResponse.statusText}`)
57
+ // }
58
+
59
+ // 3단계: 서버에 업로드 완료 알림
46
60
  const notifyResponse = await Fetch(`/api/lawfirm/app/case/${id}/docs/upload`, {
47
61
  method: 'POST',
48
62
  headers: {
49
- // Authorization: `${jwt}`
63
+ // Authorization: `${jwt}`,
50
64
  },
51
65
  body: JSON.stringify({
52
66
  caseIdx: parseInt(id, 10),
53
- files: [
54
- {
55
- name: fileName,
56
- path: cloudFrontPath,
57
- size: file.size
58
- }
59
- ]
67
+ files: uploadResults.map(({ name, path, size }) => ({
68
+ name,
69
+ path,
70
+ size
71
+ }))
60
72
  })
61
73
  });
62
74
 
63
75
  return {
64
76
  result: true,
65
77
  data: response.data,
66
- uploadStatus: uploadResponse.status,
78
+ uploads: uploadResults,
67
79
  notificationStatus: notifyResponse.result
68
80
  };
69
81
  } catch (error) {