umwd-components 0.1.780 → 0.1.782
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/dist/cjs/src/components/common/media/UploadBase64MediaForm.js +1 -1
- package/dist/cjs/src/components/common/media/UploadMediaForm.js +1 -1
- package/dist/cjs/src/components/common/media/minio/MinioDeleteFormButton.js +7 -0
- package/dist/cjs/src/components/common/media/minio/MinioDisplay.js +7 -0
- package/dist/cjs/src/components/common/media/minio/MinioDownloadButton.js +7 -0
- package/dist/cjs/src/components/common/media/minio/UploadMinioMediaForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/RmaForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualIPOItemUpdater.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/cjs/src/data/actions/media/minio/deleteMinioMediaAction.js +6 -0
- package/dist/cjs/src/data/actions/media/minio/uploadMinioMediaAction.js +1 -1
- package/dist/cjs/src/data/loaders/common/media/minio/downloadMinioItemClient.js +7 -0
- package/dist/cjs/src/data/loaders/common/media/minio/getMinioSignedUrl.js +7 -0
- package/dist/cjs/src/data/loaders/logistics/getSingleIpo.js +1 -1
- package/dist/cjs/src/data/services/common/media/minio/minioDeleteService.js +7 -0
- package/dist/cjs/src/data/services/common/media/minio/minioUploadService.js +7 -0
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/common/media/UploadBase64MediaForm.js +5 -7
- package/dist/esm/src/components/common/media/UploadMediaForm.js +1 -1
- package/dist/esm/src/components/common/media/minio/MinioDeleteFormButton.js +41 -0
- package/dist/esm/src/components/common/media/minio/MinioDisplay.js +17 -0
- package/dist/esm/src/components/common/media/minio/MinioDownloadButton.js +23 -0
- package/dist/esm/src/components/common/media/minio/UploadMinioMediaForm.js +34 -14
- package/dist/esm/src/components/e-commerce/iro/RmaForm.js +2 -1
- package/dist/esm/src/components/e-commerce/opo/TextualManageOpoForm.js +2 -1
- package/dist/esm/src/components/logistics/ipo/TextualIPOItemUpdater.js +6 -5
- package/dist/esm/src/components/logistics/ipo/TextualManageIPOForm.js +3 -7
- package/dist/esm/src/data/actions/media/minio/deleteMinioMediaAction.js +48 -0
- package/dist/esm/src/data/actions/media/minio/uploadMinioMediaAction.js +77 -27
- package/dist/esm/src/data/loaders/common/media/minio/downloadMinioItemClient.js +39 -0
- package/dist/esm/src/data/loaders/common/media/minio/getMinioSignedUrl.js +52 -0
- package/dist/esm/src/data/loaders/logistics/getSingleIpo.js +5 -2
- package/dist/esm/src/data/services/common/media/minio/minioDeleteService.js +34 -0
- package/dist/esm/src/data/services/common/media/minio/minioUploadService.js +41 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/components/common/media/minio/MinioDeleteButton.d.ts +7 -0
- package/dist/esm/types/components/common/media/minio/MinioDeleteFormButton.d.ts +7 -0
- package/dist/esm/types/components/common/media/minio/MinioDisplay.d.ts +9 -0
- package/dist/esm/types/components/common/media/minio/MinioDownloadButton.d.ts +6 -0
- package/dist/esm/types/components/common/media/minio/UploadMinioMediaForm.d.ts +1 -9
- package/dist/esm/types/data/actions/media/minio/deleteMinioMediaAction.d.ts +1 -0
- package/dist/esm/types/data/loaders/common/media/minio/downloadMinioItemClient.d.ts +13 -0
- package/dist/esm/types/data/loaders/common/media/minio/getAllMinioMedia.d.ts +1 -0
- package/dist/esm/types/data/loaders/common/media/minio/getMinioSignedUrl.d.ts +6 -0
- package/dist/esm/types/data/services/common/media/minio/minioDeleteService.d.ts +1 -0
- package/dist/esm/types/data/services/common/media/minio/minioUploadService.d.ts +1 -0
- package/dist/esm/types/types/common/media/types.d.ts +4 -4
- package/dist/esm/types/types/data/actions/types.d.ts +7 -0
- package/dist/esm/types/types/logistics/Ipo.d.ts +10 -0
- package/package.json +1 -1
- package/dist/cjs/src/data/services/common/media/minio/minio-service.js +0 -6
- package/dist/esm/src/data/services/common/media/minio/minio-service.js +0 -76
- package/dist/esm/types/data/services/common/media/minio/minio-service.d.ts +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface MinioDeleteButtonProps {
|
|
2
|
+
bucketName: string;
|
|
3
|
+
fileName: string;
|
|
4
|
+
revalidateCallback?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const MinioDeleteButton: ({ bucketName, fileName, revalidateCallback, }: MinioDeleteButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface MinioDeleteFormProps {
|
|
2
|
+
bucketName: string;
|
|
3
|
+
fileName: string;
|
|
4
|
+
revalidateCallback?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const MinioDeleteFormButton: ({ bucketName, fileName, revalidateCallback, }: MinioDeleteFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface MinioDisplayProps {
|
|
2
|
+
fileSize: number;
|
|
3
|
+
mimeType: string;
|
|
4
|
+
fileName: string;
|
|
5
|
+
bucketName: string;
|
|
6
|
+
revalidateCallback?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const MinioDisplay: ({ fileSize, mimeType, fileName, bucketName, revalidateCallback, }: MinioDisplayProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
import { MinioMediaFieldsProps } from "../../../../types/common/media/types";
|
|
2
|
-
export declare function UploadMinioMediaForm({
|
|
3
|
-
/**
|
|
4
|
-
* TODO, in this plugin the media uploaded
|
|
5
|
-
* to minio should be referenced by a customfield
|
|
6
|
-
* reference,
|
|
7
|
-
* refID,
|
|
8
|
-
* field,
|
|
9
|
-
*/
|
|
10
|
-
bucketName, fileName, multiple, accept, revalidateCallback, }: MinioMediaFieldsProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function UploadMinioMediaForm({ bucketName, multiple, accept, reference, refID, field, revalidateCallback, }: MinioMediaFieldsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function deleteMinioMediaAction(bucketName: string, fileName: string, prevState: any): Promise<any>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side utility to handle file downloads from a signed URL
|
|
3
|
+
* This function should be called from client components after getting the signed URL from downloadMinioItem
|
|
4
|
+
*/
|
|
5
|
+
export declare function downloadMinioItemClient(signedUrl: string, fileName: string): Promise<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
fileName: string;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Alternative approach: Simply redirect to the signed URL
|
|
11
|
+
* This will trigger the browser's default download behavior
|
|
12
|
+
*/
|
|
13
|
+
export declare function downloadMinioItemSimple(signedUrl: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getAllMinioMedia(bucketName?: string): Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function minioDeleteService(bucketName: string, fileName: string): Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function minioUploadService(bucketName: string, fileName: string, fileContent: string, reference?: string, refID?: string, field?: string): Promise<any>;
|
|
@@ -68,14 +68,14 @@ export type MediaFieldsProps = {
|
|
|
68
68
|
refID?: string;
|
|
69
69
|
field?: string;
|
|
70
70
|
multiple?: boolean;
|
|
71
|
-
accept?: string;
|
|
71
|
+
accept?: string | string[];
|
|
72
72
|
fileData?: MediaItemProps;
|
|
73
73
|
revalidateCallback?: () => void;
|
|
74
74
|
};
|
|
75
75
|
export interface MinioMediaFieldsProps extends MediaFieldsProps {
|
|
76
|
-
bucketName
|
|
77
|
-
fileName
|
|
78
|
-
fileContent
|
|
76
|
+
bucketName?: string;
|
|
77
|
+
fileName?: string;
|
|
78
|
+
fileContent?: FileList;
|
|
79
79
|
}
|
|
80
80
|
export interface Base64MediaFieldsProps extends MediaFieldsProps {
|
|
81
81
|
base64?: boolean;
|
|
@@ -3,6 +3,14 @@ import { Product } from "../e-commerce/product/types";
|
|
|
3
3
|
import { StrapiImageProps } from "../StrapiImageProps";
|
|
4
4
|
import { Note } from "./Note";
|
|
5
5
|
import { PreReport, Report as Report } from "./Report";
|
|
6
|
+
export type MinioFileReference = {
|
|
7
|
+
documentId: string;
|
|
8
|
+
fileName: string;
|
|
9
|
+
bucketName: string;
|
|
10
|
+
fileSize: number;
|
|
11
|
+
ext: string;
|
|
12
|
+
mimeType: string;
|
|
13
|
+
};
|
|
6
14
|
export type IpoStatus = "placed" | "ordered" | "logistics_operator_process" | "released_on_stock" | "done" | "cancelled" | null;
|
|
7
15
|
export type IpoItem = {
|
|
8
16
|
documentId: string;
|
|
@@ -31,6 +39,8 @@ export type Ipo = {
|
|
|
31
39
|
delivery_note: {
|
|
32
40
|
name: string;
|
|
33
41
|
};
|
|
42
|
+
minio_order_confirmation?: MinioFileReference;
|
|
43
|
+
minio_delivery_note?: MinioFileReference;
|
|
34
44
|
items: IpoItem[];
|
|
35
45
|
notes: Note[];
|
|
36
46
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* UMWD-Components
|
|
3
|
-
* @copyright Jelle Paulus
|
|
4
|
-
* @license MIT
|
|
5
|
-
*/
|
|
6
|
-
"use strict";var e=require("../../../get-token.js"),t=require("../../../../../lib/utils.js");exports.minioUploadService=async function(i,o,n){const r=await e.getAuthToken();if(!r)throw new Error("No auth token found");const a=t.getStrapiURL(),s=new URL("/api/minio-plugin/minio/upload",a);console.log("Sending to strapi minio-plugin:",{bucketName:i,fileName:o,fileContent:n});try{const e=await fetch(s,{headers:{Authorization:`Bearer ${r}`},method:"POST",body:JSON.stringify({data:{bucketName:i,fileName:o,fileContent:n}})});return await e.json()}catch(e){throw console.error("Error uploading image:",e),e}};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* UMWD-Components
|
|
3
|
-
* @copyright Jelle Paulus
|
|
4
|
-
* @license MIT
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { getAuthToken } from '../../../get-token.js';
|
|
8
|
-
import { getStrapiURL } from '../../../../../lib/utils.js';
|
|
9
|
-
|
|
10
|
-
/* export async function minioDeleteService(imageId: string) {
|
|
11
|
-
const authToken = await getAuthToken();
|
|
12
|
-
if (!authToken) throw new Error("No auth token found");
|
|
13
|
-
|
|
14
|
-
const data = await mutateData("DELETE", `/api/upload/files/${imageId}`);
|
|
15
|
-
const flattenedData = flattenAttributes(data);
|
|
16
|
-
|
|
17
|
-
return flattenedData;
|
|
18
|
-
} */
|
|
19
|
-
async function minioUploadService(bucketName, fileName, fileContent) {
|
|
20
|
-
const authToken = await getAuthToken();
|
|
21
|
-
if (!authToken)
|
|
22
|
-
throw new Error("No auth token found");
|
|
23
|
-
const baseUrl = getStrapiURL();
|
|
24
|
-
const url = new URL("/api/minio-plugin/minio/upload", baseUrl);
|
|
25
|
-
console.log("Sending to strapi minio-plugin:", {
|
|
26
|
-
bucketName,
|
|
27
|
-
fileName,
|
|
28
|
-
fileContent,
|
|
29
|
-
});
|
|
30
|
-
try {
|
|
31
|
-
const response = await fetch(url, {
|
|
32
|
-
headers: { Authorization: `Bearer ${authToken}` },
|
|
33
|
-
method: "POST",
|
|
34
|
-
body: JSON.stringify({
|
|
35
|
-
data: {
|
|
36
|
-
bucketName,
|
|
37
|
-
fileName,
|
|
38
|
-
fileContent,
|
|
39
|
-
},
|
|
40
|
-
}),
|
|
41
|
-
});
|
|
42
|
-
const dataResponse = await response.json();
|
|
43
|
-
return dataResponse;
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
console.error("Error uploading image:", error);
|
|
47
|
-
throw error;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/* export async function minioUpdateService(fileData: any, imageId: string) {
|
|
51
|
-
const authToken = await getAuthToken();
|
|
52
|
-
if (!authToken) throw new Error("No auth token found");
|
|
53
|
-
|
|
54
|
-
const baseUrl = getStrapiURL();
|
|
55
|
-
const url = new URL(`/api/upload?id=${imageId}`, baseUrl);
|
|
56
|
-
|
|
57
|
-
const formData = new FormData();
|
|
58
|
-
formData.append("fileInfo", JSON.stringify(fileData));
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const response = await fetch(url, {
|
|
62
|
-
method: "POST",
|
|
63
|
-
headers: { Authorization: `Bearer ${authToken}` },
|
|
64
|
-
body: formData,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
const dataResponse = await response.json();
|
|
68
|
-
|
|
69
|
-
return dataResponse;
|
|
70
|
-
} catch (error) {
|
|
71
|
-
console.error("Error updating image:", error);
|
|
72
|
-
throw error;
|
|
73
|
-
}
|
|
74
|
-
} */
|
|
75
|
-
|
|
76
|
-
export { minioUploadService };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function minioUploadService(bucketName: string, fileName: string, fileContent: Buffer): Promise<any>;
|