@paro.io/expert-shared-components 1.12.3 → 1.12.4
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/lib/components/FileDownloader/index.d.ts +6 -0
- package/lib/components/FileDownloader/index.js +46 -0
- package/lib/components/Invoices/ClientDisputeProjectCard.js +2 -6
- package/lib/components/Invoices/DiscussionSection.js +1 -1
- package/lib/components/Invoices/index.d.ts +1 -0
- package/lib/components/Invoices/index.js +3 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.fileDownloader = void 0;
|
|
16
|
+
const DownloadClient_1 = __importDefault(require("../shared/DownloadClient"));
|
|
17
|
+
const utils_1 = require("../shared/utils");
|
|
18
|
+
const fileDownloader = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fileKey, downloadDocumentUrl, }) {
|
|
19
|
+
try {
|
|
20
|
+
(0, utils_1.showToast)("success", "Starting Document Download");
|
|
21
|
+
const downloadClient = new DownloadClient_1.default({
|
|
22
|
+
fileKey,
|
|
23
|
+
downloadDocumentUrl,
|
|
24
|
+
});
|
|
25
|
+
const result = yield downloadClient.downloadDocument();
|
|
26
|
+
if (result instanceof Blob) {
|
|
27
|
+
// Handle Blob (e.g., save to file or display)
|
|
28
|
+
(0, utils_1.showToast)("success", "Document Download Successful");
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
else if (typeof result === "string") {
|
|
32
|
+
// Handle text or JSON response
|
|
33
|
+
(0, utils_1.showToast)("success", "Document Download Successful");
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
throw new Error("Unexpected response type");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error(`Error Downloading File: ${error}`);
|
|
42
|
+
(0, utils_1.showToast)("warning", "Error downloading file. Please try again.");
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
exports.fileDownloader = fileDownloader;
|
|
@@ -31,9 +31,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
35
|
exports.ClientDisputeProjectCard = void 0;
|
|
39
36
|
const react_1 = __importStar(require("react"));
|
|
@@ -42,7 +39,7 @@ const base_ui_2 = require("@paro.io/base-ui");
|
|
|
42
39
|
const core_1 = require("@material-ui/core");
|
|
43
40
|
const base_icons_1 = require("@paro.io/base-icons");
|
|
44
41
|
const FileUploader_1 = require("../FileUploader");
|
|
45
|
-
const
|
|
42
|
+
const FileDownloader_1 = require("../FileDownloader");
|
|
46
43
|
const useStyles = (0, core_1.makeStyles)((theme) => ({
|
|
47
44
|
root: {
|
|
48
45
|
width: "100%",
|
|
@@ -134,8 +131,7 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
|
|
|
134
131
|
};
|
|
135
132
|
const handleDownloadDocument = (projectId, fileName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
136
133
|
const downloadFileName = `project-${projectId}/${fileName}`;
|
|
137
|
-
const
|
|
138
|
-
const downloadData = yield downloadClient.downloadDocument();
|
|
134
|
+
const downloadData = yield (0, FileDownloader_1.fileDownloader)({ downloadDocumentUrl: downloadDocumentUrl, fileKey: downloadFileName });
|
|
139
135
|
handleDownloadPdf({ fileData: downloadData, downloadFilename: fileName, streamData: true });
|
|
140
136
|
});
|
|
141
137
|
(0, react_1.useEffect)(() => {
|
|
@@ -61,7 +61,7 @@ const DiscussionSection = ({ disputeId, currentUser, messages, onCreateMessage,
|
|
|
61
61
|
disputeId,
|
|
62
62
|
messageText: newMessage,
|
|
63
63
|
visibility,
|
|
64
|
-
senderId: (_a = currentUser === null || currentUser === void 0 ? void 0 : currentUser.app_metadata) === null || _a === void 0 ? void 0 : _a.userId,
|
|
64
|
+
senderId: isInternal ? (_a = currentUser === null || currentUser === void 0 ? void 0 : currentUser.app_metadata) === null || _a === void 0 ? void 0 : _a.userId : currentUser === null || currentUser === void 0 ? void 0 : currentUser.userId,
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvoiceCard = void 0;
|
|
3
|
+
exports.DiscussionSection = exports.InvoiceCard = void 0;
|
|
4
4
|
var InvoiceCard_1 = require("./InvoiceCard");
|
|
5
5
|
Object.defineProperty(exports, "InvoiceCard", { enumerable: true, get: function () { return InvoiceCard_1.InvoiceCard; } });
|
|
6
|
+
var DiscussionSection_1 = require("./DiscussionSection");
|
|
7
|
+
Object.defineProperty(exports, "DiscussionSection", { enumerable: true, get: function () { return DiscussionSection_1.DiscussionSection; } });
|
package/lib/index.d.ts
CHANGED
|
@@ -13,3 +13,5 @@ export { ActiveProjectCard } from './components/ProjectCard/ActiveProjectCard';
|
|
|
13
13
|
export { InvoiceCard } from './components/Invoices/InvoiceCard';
|
|
14
14
|
export { DiscussionThread } from './components/DiscussionThread';
|
|
15
15
|
export { fileUploader } from './components/FileUploader';
|
|
16
|
+
export { DiscussionSection } from './components/Invoices/DiscussionSection';
|
|
17
|
+
export { fileDownloader } from './components/FileDownloader';
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fileUploader = exports.DiscussionThread = exports.InvoiceCard = exports.ActiveProjectCard = exports.sharedUtils = exports.ServiceLinesTemplate = exports.HeaderNavBar = exports.DocumentCenter = exports.ProfileCompletedPercentage = exports.ExpertProfileHeader = exports.OrganizationChart = exports.FirmEmployeeSection = exports.ClientReferenceSection = exports.Reviews = exports.ReviewsTab = void 0;
|
|
3
|
+
exports.fileDownloader = exports.DiscussionSection = exports.fileUploader = exports.DiscussionThread = exports.InvoiceCard = exports.ActiveProjectCard = exports.sharedUtils = exports.ServiceLinesTemplate = exports.HeaderNavBar = exports.DocumentCenter = exports.ProfileCompletedPercentage = exports.ExpertProfileHeader = exports.OrganizationChart = exports.FirmEmployeeSection = exports.ClientReferenceSection = exports.Reviews = exports.ReviewsTab = void 0;
|
|
4
4
|
var ReviewsTab_1 = require("./components/ReviewsTab");
|
|
5
5
|
Object.defineProperty(exports, "ReviewsTab", { enumerable: true, get: function () { return ReviewsTab_1.ReviewsTab; } });
|
|
6
6
|
var Reviews_1 = require("./components/Reviews");
|
|
@@ -31,3 +31,7 @@ var DiscussionThread_1 = require("./components/DiscussionThread");
|
|
|
31
31
|
Object.defineProperty(exports, "DiscussionThread", { enumerable: true, get: function () { return DiscussionThread_1.DiscussionThread; } });
|
|
32
32
|
var FileUploader_1 = require("./components/FileUploader");
|
|
33
33
|
Object.defineProperty(exports, "fileUploader", { enumerable: true, get: function () { return FileUploader_1.fileUploader; } });
|
|
34
|
+
var DiscussionSection_1 = require("./components/Invoices/DiscussionSection");
|
|
35
|
+
Object.defineProperty(exports, "DiscussionSection", { enumerable: true, get: function () { return DiscussionSection_1.DiscussionSection; } });
|
|
36
|
+
var FileDownloader_1 = require("./components/FileDownloader");
|
|
37
|
+
Object.defineProperty(exports, "fileDownloader", { enumerable: true, get: function () { return FileDownloader_1.fileDownloader; } });
|