@bigbinary/neeto-pdf-frontend 1.0.1 → 1.0.3
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/README.md +1 -1
- package/dist/.ready +1 -1
- package/dist/AttachmentCard-Blp45MKz.js +64 -0
- package/dist/AttachmentCard-Blp45MKz.js.map +1 -0
- package/dist/AttachmentCard-CbDrjY7P.js +67 -0
- package/dist/AttachmentCard-CbDrjY7P.js.map +1 -0
- package/dist/FilenameUtilities-DFEKeP7n.js +150 -0
- package/dist/FilenameUtilities-DFEKeP7n.js.map +1 -0
- package/dist/{FilenameUtilities-Cw9Tvd6k.js → FilenameUtilities-Di7TmEIR.js} +9 -188
- package/dist/FilenameUtilities-Di7TmEIR.js.map +1 -0
- package/dist/FilenameUtilities-SpduImYz.js +139 -0
- package/dist/FilenameUtilities-SpduImYz.js.map +1 -0
- package/dist/{FilenameUtilities-De2k_NXh.js → FilenameUtilities-Xttn7r8R.js} +2 -181
- package/dist/FilenameUtilities-Xttn7r8R.js.map +1 -0
- package/dist/IconBlock-BZvD1k7W.js +17 -0
- package/dist/IconBlock-BZvD1k7W.js.map +1 -0
- package/dist/IconBlock-Cte1G732.js +15 -0
- package/dist/IconBlock-Cte1G732.js.map +1 -0
- package/dist/PdfDocumentsPage.js +2 -1
- package/dist/PdfDocumentsPage.js.map +1 -1
- package/dist/PdfEditorPage.js +3 -146
- package/dist/PdfEditorPage.js.map +1 -1
- package/dist/cjs/PdfDocumentsPage.js +2 -1
- package/dist/cjs/PdfDocumentsPage.js.map +1 -1
- package/dist/cjs/PdfEditorPage.js +12 -155
- package/dist/cjs/PdfEditorPage.js.map +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/v2/PdfAttachmentSelector.js +95 -0
- package/dist/cjs/v2/PdfAttachmentSelector.js.map +1 -0
- package/dist/cjs/v2/PdfAttachmentsPreview.js +45 -0
- package/dist/cjs/v2/PdfAttachmentsPreview.js.map +1 -0
- package/dist/cjs/v2/PdfDocumentsPage.js +555 -0
- package/dist/cjs/v2/PdfDocumentsPage.js.map +1 -0
- package/dist/cjs/v2/PdfEditorPage.js +1920 -0
- package/dist/cjs/v2/PdfEditorPage.js.map +1 -0
- package/dist/cjs/v2/index.js +67 -0
- package/dist/cjs/v2/index.js.map +1 -0
- package/dist/constants-DDj0SAA-.js +8 -0
- package/dist/constants-DDj0SAA-.js.map +1 -0
- package/dist/constants-MHmmvZDo.js +5 -0
- package/dist/constants-MHmmvZDo.js.map +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/pdf_documents-PKt4xiTc.js +181 -0
- package/dist/pdf_documents-PKt4xiTc.js.map +1 -0
- package/dist/pdf_documents-j2CBlJrR.js +179 -0
- package/dist/pdf_documents-j2CBlJrR.js.map +1 -0
- package/dist/pdf_mapping_schema-CS6f9Kug.js +149 -0
- package/dist/pdf_mapping_schema-CS6f9Kug.js.map +1 -0
- package/dist/pdf_mapping_schema-Co4FN4KU.js +147 -0
- package/dist/pdf_mapping_schema-Co4FN4KU.js.map +1 -0
- package/dist/v2/PdfAttachmentSelector.js +93 -0
- package/dist/v2/PdfAttachmentSelector.js.map +1 -0
- package/dist/v2/PdfAttachmentsPreview.js +43 -0
- package/dist/v2/PdfAttachmentsPreview.js.map +1 -0
- package/dist/v2/PdfDocumentsPage.js +553 -0
- package/dist/v2/PdfDocumentsPage.js.map +1 -0
- package/dist/v2/PdfEditorPage.js +1899 -0
- package/dist/v2/PdfEditorPage.js.map +1 -0
- package/dist/v2/index.js +58 -0
- package/dist/v2/index.js.map +1 -0
- package/package.json +13 -1
- package/dist/FilenameUtilities-Cw9Tvd6k.js.map +0 -1
- package/dist/FilenameUtilities-De2k_NXh.js.map +0 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
+
import { useQuery } from '@tanstack/react-query';
|
|
4
|
+
import { useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/v2/react-utils';
|
|
5
|
+
import { p as pdfDocumentsApi } from './pdf_documents-j2CBlJrR.js';
|
|
6
|
+
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
+
var documentKeys = function documentKeys(ownerId, apiBaseUrl) {
|
|
10
|
+
return ["neeto-pdf-documents", apiBaseUrl, ownerId];
|
|
11
|
+
};
|
|
12
|
+
var useInvalidatingMutation = function useInvalidatingMutation(mutationFn, ownerId, apiBaseUrl) {
|
|
13
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
14
|
+
return useMutationWithInvalidation(mutationFn, _objectSpread({
|
|
15
|
+
keysToInvalidate: [documentKeys(ownerId, apiBaseUrl)]
|
|
16
|
+
}, options));
|
|
17
|
+
};
|
|
18
|
+
var getPdfDocumentApiErrorMessage = function getPdfDocumentApiErrorMessage(error, fallback) {
|
|
19
|
+
var _error$response;
|
|
20
|
+
return (error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 || (_error$response = _error$response.data) === null || _error$response === void 0 ? void 0 : _error$response.error) || fallback;
|
|
21
|
+
};
|
|
22
|
+
var useFetchPdfDocuments = function useFetchPdfDocuments(_ref) {
|
|
23
|
+
var apiBaseUrl = _ref.apiBaseUrl,
|
|
24
|
+
ownerId = _ref.ownerId,
|
|
25
|
+
_ref$options = _ref.options,
|
|
26
|
+
options = _ref$options === void 0 ? {} : _ref$options;
|
|
27
|
+
return useQuery(_objectSpread({
|
|
28
|
+
queryKey: documentKeys(ownerId, apiBaseUrl),
|
|
29
|
+
queryFn: function queryFn() {
|
|
30
|
+
return pdfDocumentsApi.list({
|
|
31
|
+
apiBaseUrl: apiBaseUrl,
|
|
32
|
+
ownerId: ownerId
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
enabled: Boolean(apiBaseUrl && ownerId)
|
|
36
|
+
}, options));
|
|
37
|
+
};
|
|
38
|
+
var useFetchPdfDocument = function useFetchPdfDocument(_ref2) {
|
|
39
|
+
var apiBaseUrl = _ref2.apiBaseUrl,
|
|
40
|
+
ownerId = _ref2.ownerId,
|
|
41
|
+
documentId = _ref2.documentId,
|
|
42
|
+
_ref2$options = _ref2.options,
|
|
43
|
+
options = _ref2$options === void 0 ? {} : _ref2$options;
|
|
44
|
+
return useQuery(_objectSpread({
|
|
45
|
+
queryKey: [].concat(_toConsumableArray(documentKeys(ownerId, apiBaseUrl)), [documentId]),
|
|
46
|
+
queryFn: function queryFn() {
|
|
47
|
+
return pdfDocumentsApi.show({
|
|
48
|
+
apiBaseUrl: apiBaseUrl,
|
|
49
|
+
ownerId: ownerId,
|
|
50
|
+
documentId: documentId
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
enabled: Boolean(apiBaseUrl && ownerId && documentId)
|
|
54
|
+
}, options));
|
|
55
|
+
};
|
|
56
|
+
var useCreatePdfDocument = function useCreatePdfDocument(_ref3) {
|
|
57
|
+
var apiBaseUrl = _ref3.apiBaseUrl,
|
|
58
|
+
ownerId = _ref3.ownerId,
|
|
59
|
+
_ref3$options = _ref3.options,
|
|
60
|
+
options = _ref3$options === void 0 ? {} : _ref3$options;
|
|
61
|
+
return useInvalidatingMutation(function (file) {
|
|
62
|
+
return pdfDocumentsApi.create({
|
|
63
|
+
apiBaseUrl: apiBaseUrl,
|
|
64
|
+
ownerId: ownerId,
|
|
65
|
+
file: file
|
|
66
|
+
});
|
|
67
|
+
}, ownerId, apiBaseUrl, options);
|
|
68
|
+
};
|
|
69
|
+
var useUpdatePdfDocument = function useUpdatePdfDocument(_ref4) {
|
|
70
|
+
var apiBaseUrl = _ref4.apiBaseUrl,
|
|
71
|
+
ownerId = _ref4.ownerId,
|
|
72
|
+
_ref4$options = _ref4.options,
|
|
73
|
+
options = _ref4$options === void 0 ? {} : _ref4$options;
|
|
74
|
+
return useInvalidatingMutation(function (_ref5) {
|
|
75
|
+
var documentId = _ref5.documentId,
|
|
76
|
+
payload = _ref5.payload;
|
|
77
|
+
return pdfDocumentsApi.update({
|
|
78
|
+
apiBaseUrl: apiBaseUrl,
|
|
79
|
+
ownerId: ownerId,
|
|
80
|
+
documentId: documentId,
|
|
81
|
+
payload: payload
|
|
82
|
+
});
|
|
83
|
+
}, ownerId, apiBaseUrl, options);
|
|
84
|
+
};
|
|
85
|
+
var useUpdatePdfDocumentTemplateFile = function useUpdatePdfDocumentTemplateFile(_ref6) {
|
|
86
|
+
var apiBaseUrl = _ref6.apiBaseUrl,
|
|
87
|
+
ownerId = _ref6.ownerId,
|
|
88
|
+
_ref6$options = _ref6.options,
|
|
89
|
+
options = _ref6$options === void 0 ? {} : _ref6$options;
|
|
90
|
+
return useInvalidatingMutation(function (_ref7) {
|
|
91
|
+
var documentId = _ref7.documentId,
|
|
92
|
+
file = _ref7.file;
|
|
93
|
+
return pdfDocumentsApi.updateTemplateFile({
|
|
94
|
+
apiBaseUrl: apiBaseUrl,
|
|
95
|
+
ownerId: ownerId,
|
|
96
|
+
documentId: documentId,
|
|
97
|
+
file: file
|
|
98
|
+
});
|
|
99
|
+
}, ownerId, apiBaseUrl, options);
|
|
100
|
+
};
|
|
101
|
+
var useClonePdfDocument = function useClonePdfDocument(_ref8) {
|
|
102
|
+
var apiBaseUrl = _ref8.apiBaseUrl,
|
|
103
|
+
ownerId = _ref8.ownerId,
|
|
104
|
+
_ref8$options = _ref8.options,
|
|
105
|
+
options = _ref8$options === void 0 ? {} : _ref8$options;
|
|
106
|
+
return useInvalidatingMutation(function (documentId) {
|
|
107
|
+
return pdfDocumentsApi.clone({
|
|
108
|
+
apiBaseUrl: apiBaseUrl,
|
|
109
|
+
ownerId: ownerId,
|
|
110
|
+
documentId: documentId
|
|
111
|
+
});
|
|
112
|
+
}, ownerId, apiBaseUrl, options);
|
|
113
|
+
};
|
|
114
|
+
var useDeletePdfDocument = function useDeletePdfDocument(_ref9) {
|
|
115
|
+
var apiBaseUrl = _ref9.apiBaseUrl,
|
|
116
|
+
ownerId = _ref9.ownerId,
|
|
117
|
+
_ref9$options = _ref9.options,
|
|
118
|
+
options = _ref9$options === void 0 ? {} : _ref9$options;
|
|
119
|
+
return useInvalidatingMutation(function (documentId) {
|
|
120
|
+
return pdfDocumentsApi.destroy({
|
|
121
|
+
apiBaseUrl: apiBaseUrl,
|
|
122
|
+
ownerId: ownerId,
|
|
123
|
+
documentId: documentId
|
|
124
|
+
});
|
|
125
|
+
}, ownerId, apiBaseUrl, options);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
var buildOutputFilenameTemplate = function buildOutputFilenameTemplate(name) {
|
|
129
|
+
var parameterizedName = (name || "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
130
|
+
return "".concat(parameterizedName || "document", "-{{id}}.pdf");
|
|
131
|
+
};
|
|
132
|
+
var buildOutputFilename = function buildOutputFilename(pdfDocument, submission) {
|
|
133
|
+
var base = (pdfDocument === null || pdfDocument === void 0 ? void 0 : pdfDocument.outputFilename) || "".concat((pdfDocument === null || pdfDocument === void 0 ? void 0 : pdfDocument.name) || "document", ".pdf");
|
|
134
|
+
var withId = base.replace(/\{\{\s*id\s*\}\}/g, (submission === null || submission === void 0 ? void 0 : submission.id) || "");
|
|
135
|
+
return withId.endsWith(".pdf") ? withId : "".concat(withId, ".pdf");
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export { useDeletePdfDocument as a, useUpdatePdfDocumentTemplateFile as b, useClonePdfDocument as c, buildOutputFilenameTemplate as d, useFetchPdfDocuments as e, useCreatePdfDocument as f, getPdfDocumentApiErrorMessage as g, buildOutputFilename as h, useFetchPdfDocument as i, useUpdatePdfDocument as u };
|
|
139
|
+
//# sourceMappingURL=FilenameUtilities-SpduImYz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilenameUtilities-SpduImYz.js","sources":["../app/javascript/src/v2/hooks/usePdfDocumentsApi.js","../app/javascript/src/v2/components/PdfDocuments/FilenameUtilities.js"],"sourcesContent":["import { useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/v2/react-utils\";\n\nimport pdfDocumentsApi from \"src/apis/pdf_documents\";\n\nconst documentKeys = (ownerId, apiBaseUrl) => [\n \"neeto-pdf-documents\",\n apiBaseUrl,\n ownerId,\n];\n\nconst useInvalidatingMutation = (\n mutationFn,\n ownerId,\n apiBaseUrl,\n options = {}\n) =>\n useMutationWithInvalidation(mutationFn, {\n keysToInvalidate: [documentKeys(ownerId, apiBaseUrl)],\n ...options,\n });\n\nexport const getPdfDocumentApiErrorMessage = (error, fallback) =>\n error?.response?.data?.error || fallback;\n\nexport const useFetchPdfDocuments = ({ apiBaseUrl, ownerId, options = {} }) =>\n useQuery({\n queryKey: documentKeys(ownerId, apiBaseUrl),\n queryFn: () => pdfDocumentsApi.list({ apiBaseUrl, ownerId }),\n enabled: Boolean(apiBaseUrl && ownerId),\n ...options,\n });\n\nexport const useFetchPdfDocument = ({\n apiBaseUrl,\n ownerId,\n documentId,\n options = {},\n}) =>\n useQuery({\n queryKey: [...documentKeys(ownerId, apiBaseUrl), documentId],\n queryFn: () => pdfDocumentsApi.show({ apiBaseUrl, ownerId, documentId }),\n enabled: Boolean(apiBaseUrl && ownerId && documentId),\n ...options,\n });\n\nexport const useCreatePdfDocument = ({ apiBaseUrl, ownerId, options = {} }) =>\n useInvalidatingMutation(\n file => pdfDocumentsApi.create({ apiBaseUrl, ownerId, file }),\n ownerId,\n apiBaseUrl,\n options\n );\n\nexport const useUpdatePdfDocument = ({ apiBaseUrl, ownerId, options = {} }) =>\n useInvalidatingMutation(\n ({ documentId, payload }) =>\n pdfDocumentsApi.update({ apiBaseUrl, ownerId, documentId, payload }),\n ownerId,\n apiBaseUrl,\n options\n );\n\nexport const useUpdatePdfDocumentTemplateFile = ({\n apiBaseUrl,\n ownerId,\n options = {},\n}) =>\n useInvalidatingMutation(\n ({ documentId, file }) =>\n pdfDocumentsApi.updateTemplateFile({\n apiBaseUrl,\n ownerId,\n documentId,\n file,\n }),\n ownerId,\n apiBaseUrl,\n options\n );\n\nexport const useClonePdfDocument = ({ apiBaseUrl, ownerId, options = {} }) =>\n useInvalidatingMutation(\n documentId => pdfDocumentsApi.clone({ apiBaseUrl, ownerId, documentId }),\n ownerId,\n apiBaseUrl,\n options\n );\n\nexport const useDeletePdfDocument = ({ apiBaseUrl, ownerId, options = {} }) =>\n useInvalidatingMutation(\n documentId => pdfDocumentsApi.destroy({ apiBaseUrl, ownerId, documentId }),\n ownerId,\n apiBaseUrl,\n options\n );\n","export const buildOutputFilenameTemplate = name => {\n const parameterizedName = (name || \"\")\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n\n return `${parameterizedName || \"document\"}-{{id}}.pdf`;\n};\n\nexport const buildOutputFilename = (pdfDocument, submission) => {\n const base =\n pdfDocument?.outputFilename || `${pdfDocument?.name || \"document\"}.pdf`;\n const withId = base.replace(/\\{\\{\\s*id\\s*\\}\\}/g, submission?.id || \"\");\n\n return withId.endsWith(\".pdf\") ? withId : `${withId}.pdf`;\n};\n"],"names":["documentKeys","ownerId","apiBaseUrl","useInvalidatingMutation","mutationFn","options","arguments","length","undefined","useMutationWithInvalidation","_objectSpread","keysToInvalidate","getPdfDocumentApiErrorMessage","error","fallback","_error$response","response","data","useFetchPdfDocuments","_ref","_ref$options","useQuery","queryKey","queryFn","pdfDocumentsApi","list","enabled","Boolean","useFetchPdfDocument","_ref2","documentId","_ref2$options","concat","_toConsumableArray","show","useCreatePdfDocument","_ref3","_ref3$options","file","create","useUpdatePdfDocument","_ref4","_ref4$options","_ref5","payload","update","useUpdatePdfDocumentTemplateFile","_ref6","_ref6$options","_ref7","updateTemplateFile","useClonePdfDocument","_ref8","_ref8$options","clone","useDeletePdfDocument","_ref9","_ref9$options","destroy","buildOutputFilenameTemplate","name","parameterizedName","trim","toLowerCase","replace","buildOutputFilename","pdfDocument","submission","base","outputFilename","withId","id","endsWith"],"mappings":";;;;;;;;AAKA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAIC,OAAO,EAAEC,UAAU,EAAA;AAAA,EAAA,OAAK,CAC5C,qBAAqB,EACrBA,UAAU,EACVD,OAAO,CACR;AAAA,CAAA;AAED,IAAME,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAC3BC,UAAU,EACVH,OAAO,EACPC,UAAU,EAAA;AAAA,EAAA,IACVG,OAAO,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE;AAAA,EAAA,OAEZG,2BAA2B,CAACL,UAAU,EAAAM,aAAA,CAAA;AACpCC,IAAAA,gBAAgB,EAAE,CAACX,YAAY,CAACC,OAAO,EAAEC,UAAU,CAAC;GAAC,EAClDG,OAAO,CACX,CAAC;AAAA,CAAA;AAEG,IAAMO,6BAA6B,GAAG,SAAhCA,6BAA6BA,CAAIC,KAAK,EAAEC,QAAQ,EAAA;AAAA,EAAA,IAAAC,eAAA;EAAA,OAC3D,CAAAF,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,MAAA,IAAA,CAAAE,eAAA,GAALF,KAAK,CAAE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IAAMI,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,WAAW,EAAEC,UAAU,EAAK;EAC9D,IAAMC,IAAI,GACR,CAAAF,WAAW,aAAXA,WAAW,KAAA,MAAA,GAAA,MAAA,GAAXA,WAAW,CAAEG,cAAc,KAAA,EAAA,CAAArC,MAAA,CAAO,CAAAkC,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAA,MAAA,GAAA,MAAA,GAAXA,WAAW,CAAEN,IAAI,KAAI,UAAU,EAAA,MAAA,CAAM;AACzE,EAAA,IAAMU,MAAM,GAAGF,IAAI,CAACJ,OAAO,CAAC,mBAAmB,EAAE,CAAAG,UAAU,KAAA,IAAA,IAAVA,UAAU,KAAA,MAAA,GAAA,MAAA,GAAVA,UAAU,CAAEI,EAAE,KAAI,EAAE,CAAC;AAEtE,EAAA,OAAOD,MAAM,CAACE,QAAQ,CAAC,MAAM,CAAC,GAAGF,MAAM,GAAA,EAAA,CAAAtC,MAAA,CAAMsC,MAAM,EAAA,MAAA,CAAM;AAC3D;;;;"}
|
|
@@ -2,186 +2,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import { useQuery } from '@tanstack/react-query';
|
|
4
4
|
import { useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
5
|
-
import
|
|
6
|
-
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
7
|
-
import axios from 'axios';
|
|
8
|
-
|
|
9
|
-
var trimTrailingSlash = function trimTrailingSlash(value) {
|
|
10
|
-
return (value === null || value === void 0 ? void 0 : value.replace(/\/+$/, "")) || "";
|
|
11
|
-
};
|
|
12
|
-
var documentsUrl = function documentsUrl(apiBaseUrl) {
|
|
13
|
-
return "".concat(trimTrailingSlash(apiBaseUrl), "/documents");
|
|
14
|
-
};
|
|
15
|
-
var documentUrl = function documentUrl(_ref) {
|
|
16
|
-
var apiBaseUrl = _ref.apiBaseUrl,
|
|
17
|
-
documentId = _ref.documentId;
|
|
18
|
-
return "".concat(documentsUrl(apiBaseUrl), "/").concat(documentId);
|
|
19
|
-
};
|
|
20
|
-
var documentActionUrl = function documentActionUrl(_ref2) {
|
|
21
|
-
var apiBaseUrl = _ref2.apiBaseUrl,
|
|
22
|
-
documentId = _ref2.documentId,
|
|
23
|
-
_ref2$suffix = _ref2.suffix,
|
|
24
|
-
suffix = _ref2$suffix === void 0 ? "" : _ref2$suffix;
|
|
25
|
-
return "".concat(documentUrl({
|
|
26
|
-
apiBaseUrl: apiBaseUrl,
|
|
27
|
-
documentId: documentId
|
|
28
|
-
})).concat(suffix);
|
|
29
|
-
};
|
|
30
|
-
var normalizeResponse = /*#__PURE__*/function () {
|
|
31
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(request) {
|
|
32
|
-
var _response$data;
|
|
33
|
-
var response;
|
|
34
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35
|
-
while (1) switch (_context.prev = _context.next) {
|
|
36
|
-
case 0:
|
|
37
|
-
_context.next = 2;
|
|
38
|
-
return request;
|
|
39
|
-
case 2:
|
|
40
|
-
response = _context.sent;
|
|
41
|
-
return _context.abrupt("return", (_response$data = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data !== void 0 ? _response$data : response);
|
|
42
|
-
case 4:
|
|
43
|
-
case "end":
|
|
44
|
-
return _context.stop();
|
|
45
|
-
}
|
|
46
|
-
}, _callee);
|
|
47
|
-
}));
|
|
48
|
-
return function normalizeResponse(_x) {
|
|
49
|
-
return _ref3.apply(this, arguments);
|
|
50
|
-
};
|
|
51
|
-
}();
|
|
52
|
-
var list = function list(_ref4) {
|
|
53
|
-
var apiBaseUrl = _ref4.apiBaseUrl,
|
|
54
|
-
ownerId = _ref4.ownerId;
|
|
55
|
-
return normalizeResponse(axios.get(documentsUrl(apiBaseUrl), {
|
|
56
|
-
params: {
|
|
57
|
-
ownerId: ownerId
|
|
58
|
-
}
|
|
59
|
-
}));
|
|
60
|
-
};
|
|
61
|
-
var show = function show(_ref5) {
|
|
62
|
-
var apiBaseUrl = _ref5.apiBaseUrl,
|
|
63
|
-
ownerId = _ref5.ownerId,
|
|
64
|
-
documentId = _ref5.documentId;
|
|
65
|
-
return normalizeResponse(axios.get(documentUrl({
|
|
66
|
-
apiBaseUrl: apiBaseUrl,
|
|
67
|
-
documentId: documentId
|
|
68
|
-
}), {
|
|
69
|
-
params: {
|
|
70
|
-
ownerId: ownerId
|
|
71
|
-
}
|
|
72
|
-
}));
|
|
73
|
-
};
|
|
74
|
-
var create = function create(_ref6) {
|
|
75
|
-
var _file$name2, _file$name2$trim;
|
|
76
|
-
var apiBaseUrl = _ref6.apiBaseUrl,
|
|
77
|
-
ownerId = _ref6.ownerId,
|
|
78
|
-
file = _ref6.file;
|
|
79
|
-
if (file !== null && file !== void 0 && file.signedId) {
|
|
80
|
-
var _file$name;
|
|
81
|
-
return normalizeResponse(axios.post(documentsUrl(apiBaseUrl), {
|
|
82
|
-
template_file: file.signedId,
|
|
83
|
-
name: (_file$name = file.name) === null || _file$name === void 0 ? void 0 : _file$name.replace(/\.[^/.]+$/, "")
|
|
84
|
-
}, {
|
|
85
|
-
params: {
|
|
86
|
-
ownerId: ownerId
|
|
87
|
-
},
|
|
88
|
-
transformRequestCase: false
|
|
89
|
-
}));
|
|
90
|
-
}
|
|
91
|
-
var formData = new FormData();
|
|
92
|
-
var sanitizedName = file === null || file === void 0 || (_file$name2 = file.name) === null || _file$name2 === void 0 || (_file$name2$trim = _file$name2.trim) === null || _file$name2$trim === void 0 ? void 0 : _file$name2$trim.call(_file$name2).replace(/\.[^/.]+$/, "");
|
|
93
|
-
var baseName = sanitizedName || "";
|
|
94
|
-
formData.append("template_file", file);
|
|
95
|
-
formData.append("name", baseName);
|
|
96
|
-
return normalizeResponse(axios.post(documentsUrl(apiBaseUrl), formData, {
|
|
97
|
-
params: {
|
|
98
|
-
ownerId: ownerId
|
|
99
|
-
},
|
|
100
|
-
transformRequestCase: false
|
|
101
|
-
}));
|
|
102
|
-
};
|
|
103
|
-
var update = function update(_ref7) {
|
|
104
|
-
var apiBaseUrl = _ref7.apiBaseUrl,
|
|
105
|
-
ownerId = _ref7.ownerId,
|
|
106
|
-
documentId = _ref7.documentId,
|
|
107
|
-
payload = _ref7.payload;
|
|
108
|
-
return normalizeResponse(axios.put(documentUrl({
|
|
109
|
-
apiBaseUrl: apiBaseUrl,
|
|
110
|
-
documentId: documentId
|
|
111
|
-
}), payload, {
|
|
112
|
-
params: {
|
|
113
|
-
ownerId: ownerId
|
|
114
|
-
}
|
|
115
|
-
}));
|
|
116
|
-
};
|
|
117
|
-
var updateTemplateFile = function updateTemplateFile(_ref8) {
|
|
118
|
-
var apiBaseUrl = _ref8.apiBaseUrl,
|
|
119
|
-
ownerId = _ref8.ownerId,
|
|
120
|
-
documentId = _ref8.documentId,
|
|
121
|
-
file = _ref8.file;
|
|
122
|
-
if (file !== null && file !== void 0 && file.signedId) {
|
|
123
|
-
return normalizeResponse(axios.patch(documentActionUrl({
|
|
124
|
-
apiBaseUrl: apiBaseUrl,
|
|
125
|
-
documentId: documentId,
|
|
126
|
-
suffix: "/template_file"
|
|
127
|
-
}), {
|
|
128
|
-
template_file: file.signedId
|
|
129
|
-
}, {
|
|
130
|
-
params: {
|
|
131
|
-
ownerId: ownerId
|
|
132
|
-
},
|
|
133
|
-
transformRequestCase: false
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
var formData = new FormData();
|
|
137
|
-
formData.append("template_file", file);
|
|
138
|
-
return normalizeResponse(axios.patch(documentActionUrl({
|
|
139
|
-
apiBaseUrl: apiBaseUrl,
|
|
140
|
-
documentId: documentId,
|
|
141
|
-
suffix: "/template_file"
|
|
142
|
-
}), formData, {
|
|
143
|
-
params: {
|
|
144
|
-
ownerId: ownerId
|
|
145
|
-
},
|
|
146
|
-
transformRequestCase: false
|
|
147
|
-
}));
|
|
148
|
-
};
|
|
149
|
-
var clone = function clone(_ref9) {
|
|
150
|
-
var apiBaseUrl = _ref9.apiBaseUrl,
|
|
151
|
-
ownerId = _ref9.ownerId,
|
|
152
|
-
documentId = _ref9.documentId;
|
|
153
|
-
return normalizeResponse(axios.post(documentActionUrl({
|
|
154
|
-
apiBaseUrl: apiBaseUrl,
|
|
155
|
-
documentId: documentId,
|
|
156
|
-
suffix: "/clone"
|
|
157
|
-
}), null, {
|
|
158
|
-
params: {
|
|
159
|
-
ownerId: ownerId
|
|
160
|
-
}
|
|
161
|
-
}));
|
|
162
|
-
};
|
|
163
|
-
var destroy = function destroy(_ref0) {
|
|
164
|
-
var apiBaseUrl = _ref0.apiBaseUrl,
|
|
165
|
-
ownerId = _ref0.ownerId,
|
|
166
|
-
documentId = _ref0.documentId;
|
|
167
|
-
return normalizeResponse(axios["delete"](documentUrl({
|
|
168
|
-
apiBaseUrl: apiBaseUrl,
|
|
169
|
-
documentId: documentId
|
|
170
|
-
}), {
|
|
171
|
-
params: {
|
|
172
|
-
ownerId: ownerId
|
|
173
|
-
}
|
|
174
|
-
}));
|
|
175
|
-
};
|
|
176
|
-
var pdfDocumentsApi = {
|
|
177
|
-
clone: clone,
|
|
178
|
-
create: create,
|
|
179
|
-
update: update,
|
|
180
|
-
updateTemplateFile: updateTemplateFile,
|
|
181
|
-
destroy: destroy,
|
|
182
|
-
list: list,
|
|
183
|
-
show: show
|
|
184
|
-
};
|
|
5
|
+
import { p as pdfDocumentsApi } from './pdf_documents-j2CBlJrR.js';
|
|
185
6
|
|
|
186
7
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
187
8
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -315,4 +136,4 @@ var buildOutputFilename = function buildOutputFilename(pdfDocument, submission)
|
|
|
315
136
|
};
|
|
316
137
|
|
|
317
138
|
export { useDeletePdfDocument as a, useUpdatePdfDocumentTemplateFile as b, useClonePdfDocument as c, buildOutputFilenameTemplate as d, useFetchPdfDocuments as e, useCreatePdfDocument as f, getPdfDocumentApiErrorMessage as g, buildOutputFilename as h, useFetchPdfDocument as i, useUpdatePdfDocument as u };
|
|
318
|
-
//# sourceMappingURL=FilenameUtilities-
|
|
139
|
+
//# sourceMappingURL=FilenameUtilities-Xttn7r8R.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilenameUtilities-Xttn7r8R.js","sources":["../app/javascript/src/hooks/usePdfDocumentsApi.js","../app/javascript/src/components/PdfDocuments/FilenameUtilities.js"],"sourcesContent":["import { useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport pdfDocumentsApi from \"src/apis/pdf_documents\";\n\nconst documentKeys = (ownerId, apiBaseUrl) => [\n \"neeto-pdf-documents\",\n apiBaseUrl,\n ownerId,\n];\n\nconst useInvalidatingMutation = (\n mutationFn,\n ownerId,\n apiBaseUrl,\n options = {}\n) =>\n useMutationWithInvalidation(mutationFn, {\n keysToInvalidate: [documentKeys(ownerId, apiBaseUrl)],\n ...options,\n });\n\nexport const getPdfDocumentApiErrorMessage = (error, fallback) =>\n error?.response?.data?.error || fallback;\n\nexport const useFetchPdfDocuments = ({ apiBaseUrl, ownerId, options = {} }) =>\n useQuery({\n queryKey: documentKeys(ownerId, apiBaseUrl),\n queryFn: () => pdfDocumentsApi.list({ apiBaseUrl, ownerId }),\n enabled: Boolean(apiBaseUrl && ownerId),\n ...options,\n });\n\nexport const useFetchPdfDocument = ({\n apiBaseUrl,\n ownerId,\n documentId,\n options = {},\n}) =>\n useQuery({\n queryKey: [...documentKeys(ownerId, apiBaseUrl), documentId],\n queryFn: () => pdfDocumentsApi.show({ apiBaseUrl, ownerId, documentId }),\n enabled: Boolean(apiBaseUrl && ownerId && documentId),\n ...options,\n });\n\nexport const useCreatePdfDocument = ({ apiBaseUrl, ownerId, options = {} }) =>\n useInvalidatingMutation(\n file => pdfDocumentsApi.create({ apiBaseUrl, ownerId, file }),\n ownerId,\n apiBaseUrl,\n options\n );\n\nexport const useUpdatePdfDocument = ({ apiBaseUrl, ownerId, options = {} }) =>\n useInvalidatingMutation(\n ({ documentId, payload }) =>\n pdfDocumentsApi.update({ apiBaseUrl, ownerId, documentId, payload }),\n ownerId,\n apiBaseUrl,\n options\n );\n\nexport const useUpdatePdfDocumentTemplateFile = ({\n apiBaseUrl,\n ownerId,\n options = {},\n}) =>\n useInvalidatingMutation(\n ({ documentId, file }) =>\n pdfDocumentsApi.updateTemplateFile({\n apiBaseUrl,\n ownerId,\n documentId,\n file,\n }),\n ownerId,\n apiBaseUrl,\n options\n );\n\nexport const useClonePdfDocument = ({ apiBaseUrl, ownerId, options = {} }) =>\n useInvalidatingMutation(\n documentId => pdfDocumentsApi.clone({ apiBaseUrl, ownerId, documentId }),\n ownerId,\n apiBaseUrl,\n options\n );\n\nexport const useDeletePdfDocument = ({ apiBaseUrl, ownerId, options = {} }) =>\n useInvalidatingMutation(\n documentId => pdfDocumentsApi.destroy({ apiBaseUrl, ownerId, documentId }),\n ownerId,\n apiBaseUrl,\n options\n );\n","export const buildOutputFilenameTemplate = name => {\n const parameterizedName = (name || \"\")\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n\n return `${parameterizedName || \"document\"}-{{id}}.pdf`;\n};\n\nexport const buildOutputFilename = (pdfDocument, submission) => {\n const base =\n pdfDocument?.outputFilename || `${pdfDocument?.name || \"document\"}.pdf`;\n const withId = base.replace(/\\{\\{\\s*id\\s*\\}\\}/g, submission?.id || \"\");\n\n return withId.endsWith(\".pdf\") ? withId : `${withId}.pdf`;\n};\n"],"names":["documentKeys","ownerId","apiBaseUrl","useInvalidatingMutation","mutationFn","options","arguments","length","undefined","useMutationWithInvalidation","_objectSpread","keysToInvalidate","getPdfDocumentApiErrorMessage","error","fallback","_error$response","response","data","useFetchPdfDocuments","_ref","_ref$options","useQuery","queryKey","queryFn","pdfDocumentsApi","list","enabled","Boolean","useFetchPdfDocument","_ref2","documentId","_ref2$options","concat","_toConsumableArray","show","useCreatePdfDocument","_ref3","_ref3$options","file","create","useUpdatePdfDocument","_ref4","_ref4$options","_ref5","payload","update","useUpdatePdfDocumentTemplateFile","_ref6","_ref6$options","_ref7","updateTemplateFile","useClonePdfDocument","_ref8","_ref8$options","clone","useDeletePdfDocument","_ref9","_ref9$options","destroy","buildOutputFilenameTemplate","name","parameterizedName","trim","toLowerCase","replace","buildOutputFilename","pdfDocument","submission","base","outputFilename","withId","id","endsWith"],"mappings":";;;;;;;;AAKA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAIC,OAAO,EAAEC,UAAU,EAAA;AAAA,EAAA,OAAK,CAC5C,qBAAqB,EACrBA,UAAU,EACVD,OAAO,CACR;AAAA,CAAA;AAED,IAAME,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAC3BC,UAAU,EACVH,OAAO,EACPC,UAAU,EAAA;AAAA,EAAA,IACVG,OAAO,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE;AAAA,EAAA,OAEZG,2BAA2B,CAACL,UAAU,EAAAM,aAAA,CAAA;AACpCC,IAAAA,gBAAgB,EAAE,CAACX,YAAY,CAACC,OAAO,EAAEC,UAAU,CAAC;GAAC,EAClDG,OAAO,CAC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EAClCE,IAAI,EAAE,CACNC,WAAW,EAAE,CACbC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAC3BA,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;AAE1B,EAAA,OAAA,EAAA,CAAAhC,MAAA,CAAU6B,iBAAiB,IAAI,UAAU,EAAA,aAAA,CAAA;AAC3C;AAEO,IAAMI,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,WAAW,EAAEC,UAAU,EAAK;EAC9D,IAAMC,IAAI,GACR,CAAAF,WAAW,aAAXA,WAAW,KAAA,MAAA,GAAA,MAAA,GAAXA,WAAW,CAAEG,cAAc,KAAA,EAAA,CAAArC,MAAA,CAAO,CAAAkC,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAA,MAAA,GAAA,MAAA,GAAXA,WAAW,CAAEN,IAAI,KAAI,UAAU,EAAA,MAAA,CAAM;AACzE,EAAA,IAAMU,MAAM,GAAGF,IAAI,CAACJ,OAAO,CAAC,mBAAmB,EAAE,CAAAG,UAAU,KAAA,IAAA,IAAVA,UAAU,KAAA,MAAA,GAAA,MAAA,GAAVA,UAAU,CAAEI,EAAE,KAAI,EAAE,CAAC;AAEtE,EAAA,OAAOD,MAAM,CAACE,QAAQ,CAAC,MAAM,CAAC,GAAGF,MAAM,GAAA,EAAA,CAAAtC,MAAA,CAAMsC,MAAM,EAAA,MAAA,CAAM;AAC3D;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
var IconBlock = function IconBlock(_ref) {
|
|
6
|
+
var Icon = _ref.icon;
|
|
7
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
8
|
+
className: "bg-success rounded-lg flex h-10 w-10 shrink-0 items-center justify-center",
|
|
9
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
10
|
+
className: "text-success-foreground",
|
|
11
|
+
size: 20
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.IconBlock = IconBlock;
|
|
17
|
+
//# sourceMappingURL=IconBlock-BZvD1k7W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconBlock-BZvD1k7W.js","sources":["../app/javascript/src/v2/components/PdfDocuments/IconBlock.jsx"],"sourcesContent":["const IconBlock = ({ icon: Icon }) => (\n <div className=\"bg-success rounded-lg flex h-10 w-10 shrink-0 items-center justify-center\">\n <Icon className=\"text-success-foreground\" size={20} />\n </div>\n);\n\nexport default IconBlock;\n"],"names":["IconBlock","_ref","Icon","icon","_jsx","className","children","size"],"mappings":";;;;AAAA,IAAMA,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAYC,IAAI,GAAAD,IAAA,CAAVE,IAAI;AAAA,EAAA,oBACvBC,cAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,2EAA2E;IAAAC,QAAA,eACxFF,cAAA,CAACF,IAAI,EAAA;AAACG,MAAAA,SAAS,EAAC,yBAAyB;AAACE,MAAAA,IAAI,EAAE;KAAK;AAAC,GACnD,CAAC;AAAA;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
var IconBlock = function IconBlock(_ref) {
|
|
4
|
+
var Icon = _ref.icon;
|
|
5
|
+
return /*#__PURE__*/jsx("div", {
|
|
6
|
+
className: "bg-success rounded-lg flex h-10 w-10 shrink-0 items-center justify-center",
|
|
7
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
8
|
+
className: "text-success-foreground",
|
|
9
|
+
size: 20
|
|
10
|
+
})
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { IconBlock as I };
|
|
15
|
+
//# sourceMappingURL=IconBlock-Cte1G732.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconBlock-Cte1G732.js","sources":["../app/javascript/src/v2/components/PdfDocuments/IconBlock.jsx"],"sourcesContent":["const IconBlock = ({ icon: Icon }) => (\n <div className=\"bg-success rounded-lg flex h-10 w-10 shrink-0 items-center justify-center\">\n <Icon className=\"text-success-foreground\" size={20} />\n </div>\n);\n\nexport default IconBlock;\n"],"names":["IconBlock","_ref","Icon","icon","_jsx","className","children","size"],"mappings":";;AAAA,IAAMA,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAYC,IAAI,GAAAD,IAAA,CAAVE,IAAI;AAAA,EAAA,oBACvBC,GAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,2EAA2E;IAAAC,QAAA,eACxFF,GAAA,CAACF,IAAI,EAAA;AAACG,MAAAA,SAAS,EAAC,yBAAyB;AAACE,MAAAA,IAAI,EAAE;KAAK;AAAC,GACnD,CAAC;AAAA;;;;"}
|
package/dist/PdfDocumentsPage.js
CHANGED
|
@@ -7,7 +7,7 @@ import Spinner from '@bigbinary/neetoui/Spinner';
|
|
|
7
7
|
import Toastr from '@bigbinary/neetoui/Toastr';
|
|
8
8
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
9
9
|
import { useTranslation } from 'react-i18next';
|
|
10
|
-
import { u as useUpdatePdfDocument, a as useDeletePdfDocument, b as useUpdatePdfDocumentTemplateFile, c as useClonePdfDocument, g as getPdfDocumentApiErrorMessage, d as buildOutputFilenameTemplate, e as useFetchPdfDocuments, f as useCreatePdfDocument } from './FilenameUtilities-
|
|
10
|
+
import { u as useUpdatePdfDocument, a as useDeletePdfDocument, b as useUpdatePdfDocumentTemplateFile, c as useClonePdfDocument, g as getPdfDocumentApiErrorMessage, d as buildOutputFilenameTemplate, e as useFetchPdfDocuments, f as useCreatePdfDocument } from './FilenameUtilities-Xttn7r8R.js';
|
|
11
11
|
import Copy from '@bigbinary/neeto-icons/Copy';
|
|
12
12
|
import Delete from '@bigbinary/neeto-icons/Delete';
|
|
13
13
|
import Edit from '@bigbinary/neeto-icons/Edit';
|
|
@@ -29,6 +29,7 @@ import '@babel/runtime/helpers/toConsumableArray';
|
|
|
29
29
|
import '@babel/runtime/helpers/defineProperty';
|
|
30
30
|
import '@tanstack/react-query';
|
|
31
31
|
import '@bigbinary/neeto-commons-frontend/react-utils';
|
|
32
|
+
import './pdf_documents-j2CBlJrR.js';
|
|
32
33
|
import '@babel/runtime/helpers/asyncToGenerator';
|
|
33
34
|
import '@babel/runtime/regenerator';
|
|
34
35
|
import 'axios';
|