@unimaze/billing 0.21.66 → 0.21.67
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/common/components/attachments/ListAttachments.d.ts +10 -0
- package/lib/common/components/attachments/ListAttachments.js +143 -0
- package/lib/common/components/submit-confirmation/index.d.ts +4 -0
- package/lib/common/components/submit-confirmation/index.js +9 -1
- package/lib/create-invoice/index.js +12 -4
- package/lib/translations/locales/en.json +1 -0
- package/lib/translations/locales/is.json +1 -0
- package/lib/translations/locales.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { AttachmentType } from "./index";
|
|
3
|
+
import { UploadFile } from "antd/es/upload/interface";
|
|
4
|
+
interface Props {
|
|
5
|
+
attachments: AttachmentType[];
|
|
6
|
+
setIsModalOpen: (isModalOpen: boolean) => void;
|
|
7
|
+
removeFile: (file: UploadFile) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const ListAttachments: React.FC<Props>;
|
|
10
|
+
export default ListAttachments;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
var React = __importStar(require("react"));
|
|
63
|
+
var antd_1 = require("antd");
|
|
64
|
+
var icons_1 = require("@ant-design/icons");
|
|
65
|
+
var index_1 = require("./index");
|
|
66
|
+
var react_intl_1 = require("react-intl");
|
|
67
|
+
var FileUploadUtility_1 = require("../../../utils/FileUploadUtility");
|
|
68
|
+
var ListAttachments = function (_a) {
|
|
69
|
+
var attachments = _a.attachments, setIsModalOpen = _a.setIsModalOpen, removeFile = _a.removeFile;
|
|
70
|
+
var _b = React.useState(false), previewOpen = _b[0], setPreviewOpen = _b[1];
|
|
71
|
+
var _c = React.useState(undefined), previewImage = _c[0], setPreviewImage = _c[1];
|
|
72
|
+
var _d = React.useState(""), previewDescription = _d[0], setPreviewDescription = _d[1];
|
|
73
|
+
var _e = React.useState(""), previewPDFUrl = _e[0], setPreviewPDFUrl = _e[1];
|
|
74
|
+
var intl = (0, react_intl_1.useIntl)();
|
|
75
|
+
var token = antd_1.theme.useToken().token;
|
|
76
|
+
var handlePreview = function (file, description) { return __awaiter(void 0, void 0, void 0, function () {
|
|
77
|
+
var reader, _a;
|
|
78
|
+
return __generator(this, function (_b) {
|
|
79
|
+
switch (_b.label) {
|
|
80
|
+
case 0:
|
|
81
|
+
if (!file.originFileObj)
|
|
82
|
+
return [2 /*return*/];
|
|
83
|
+
if (!(file.type === "application/pdf")) return [3 /*break*/, 1];
|
|
84
|
+
reader = new FileReader();
|
|
85
|
+
reader.onload = function (e) {
|
|
86
|
+
var blob = file.originFileObj ? new Blob([file.originFileObj], { type: "application/pdf" }) : null;
|
|
87
|
+
if (blob) {
|
|
88
|
+
var url = URL.createObjectURL(blob);
|
|
89
|
+
setPreviewPDFUrl(url);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
reader.readAsArrayBuffer(file.originFileObj);
|
|
93
|
+
return [3 /*break*/, 4];
|
|
94
|
+
case 1:
|
|
95
|
+
if (!(!file.url && !file.preview)) return [3 /*break*/, 3];
|
|
96
|
+
_a = file;
|
|
97
|
+
return [4 /*yield*/, (0, FileUploadUtility_1.getBase64)(file.originFileObj)];
|
|
98
|
+
case 2:
|
|
99
|
+
_a.preview = (_b.sent());
|
|
100
|
+
_b.label = 3;
|
|
101
|
+
case 3:
|
|
102
|
+
setPreviewImage(file.url || file.preview);
|
|
103
|
+
_b.label = 4;
|
|
104
|
+
case 4:
|
|
105
|
+
setPreviewDescription(description);
|
|
106
|
+
setPreviewOpen(true);
|
|
107
|
+
return [2 /*return*/];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}); };
|
|
111
|
+
var handleClosePreview = function () {
|
|
112
|
+
if (previewPDFUrl) {
|
|
113
|
+
URL.revokeObjectURL(previewPDFUrl);
|
|
114
|
+
setPreviewPDFUrl("");
|
|
115
|
+
}
|
|
116
|
+
if (previewImage) {
|
|
117
|
+
setPreviewImage("");
|
|
118
|
+
}
|
|
119
|
+
setPreviewDescription("");
|
|
120
|
+
setPreviewOpen(false);
|
|
121
|
+
};
|
|
122
|
+
return (React.createElement(React.Fragment, null,
|
|
123
|
+
React.createElement(antd_1.Flex, { vertical: true, gap: "small" },
|
|
124
|
+
React.createElement(antd_1.Flex, { vertical: true },
|
|
125
|
+
React.createElement(antd_1.Typography.Text, { disabled: true }, intl.formatMessage(index_1.translationMessages.attachment_title))),
|
|
126
|
+
React.createElement(antd_1.Divider, { style: { padding: 0, margin: 0 } }),
|
|
127
|
+
attachments.map(function (attachment) { return (React.createElement(antd_1.Flex, { key: attachment.uid, gap: "middle", justify: "space-between" },
|
|
128
|
+
React.createElement(antd_1.Button, { type: "link", onClick: function () { return handlePreview(attachment.file, attachment.description); }, style: { padding: 0 }, size: "small" },
|
|
129
|
+
React.createElement(icons_1.PaperClipOutlined, { style: { fontSize: token.fontSizeIcon } }),
|
|
130
|
+
attachment.file.name),
|
|
131
|
+
React.createElement(antd_1.Flex, { gap: "middle" },
|
|
132
|
+
React.createElement(icons_1.EditOutlined, { style: { fontSize: token.fontSizeHeading4 }, onClick: function () {
|
|
133
|
+
setIsModalOpen(true);
|
|
134
|
+
} }),
|
|
135
|
+
React.createElement(icons_1.DeleteOutlined, { style: { fontSize: token.fontSizeHeading4 }, onClick: function () {
|
|
136
|
+
removeFile(attachment.file);
|
|
137
|
+
} })))); })),
|
|
138
|
+
React.createElement(antd_1.Modal, { open: previewOpen, onCancel: handleClosePreview, footer: null },
|
|
139
|
+
previewPDFUrl && (React.createElement("iframe", { src: previewPDFUrl, style: { width: "100%", height: "700px", maxHeight: "75vh" } })),
|
|
140
|
+
previewImage && React.createElement(antd_1.Image, { src: previewImage, preview: false }),
|
|
141
|
+
React.createElement(antd_1.Typography.Text, null, previewDescription))));
|
|
142
|
+
};
|
|
143
|
+
exports.default = ListAttachments;
|
|
@@ -68,6 +68,10 @@ export declare const translationMessages: {
|
|
|
68
68
|
id: string;
|
|
69
69
|
defaultMessage: string;
|
|
70
70
|
};
|
|
71
|
+
submitConfirmation_createAnotherDocuments_buttonLabel: {
|
|
72
|
+
id: string;
|
|
73
|
+
defaultMessage: string;
|
|
74
|
+
};
|
|
71
75
|
};
|
|
72
76
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
73
77
|
forwardedRef?: React.Ref<any>;
|
|
@@ -34,6 +34,7 @@ var SubmitConfirmationSVG_1 = __importDefault(require("./SubmitConfirmationSVG")
|
|
|
34
34
|
var AttachmentUploadStatus_1 = __importStar(require("./AttachmentUploadStatus"));
|
|
35
35
|
var AttachmentsUtility_1 = require("../../../utils/AttachmentsUtility");
|
|
36
36
|
var SubmitConfirmationUtility_1 = require("../../../utils/SubmitConfirmationUtility");
|
|
37
|
+
var icons_1 = require("@ant-design/icons");
|
|
37
38
|
exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
38
39
|
submitConfirmation_title: {
|
|
39
40
|
id: "submitConfirmation_title",
|
|
@@ -91,6 +92,10 @@ exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
91
92
|
id: "submitConfirmation_submittingInvoice",
|
|
92
93
|
defaultMessage: "Submitting invoice...",
|
|
93
94
|
},
|
|
95
|
+
submitConfirmation_createAnotherDocuments_buttonLabel: {
|
|
96
|
+
id: "submitConfirmation_createAnotherDocuments_buttonLabel",
|
|
97
|
+
defaultMessage: "Create another document",
|
|
98
|
+
},
|
|
94
99
|
});
|
|
95
100
|
var SubmitConfirmation = function (props) {
|
|
96
101
|
var numberOfAttemptedCalls = props.numberOfAttemptedCalls, retryUploadingFailedAttachments = props.retryUploadingFailedAttachments, retrySubmittingInvoice = props.retrySubmittingInvoice, alreadyRetried = props.alreadyRetried, invoiceSubmittingStatus = props.invoiceSubmittingStatus, allAttachments = props.allAttachments, allAttachmentsWithStatuses = props.allAttachmentsWithStatuses;
|
|
@@ -166,6 +171,9 @@ var SubmitConfirmation = function (props) {
|
|
|
166
171
|
: react_1.default.createElement(react_1.default.Fragment, null, allAttachmentsUploadedSuccessfully &&
|
|
167
172
|
react_1.default.createElement(react_1.default.Fragment, null,
|
|
168
173
|
react_1.default.createElement(antd_1.Typography.Title, { level: 2 }, props.intl.formatMessage(exports.translationMessages.submitConfirmation_title)),
|
|
169
|
-
react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeHeading4, textAlign: "center" } }, props.intl.formatMessage(exports.translationMessages.submitConfirmation_text))
|
|
174
|
+
react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeHeading4, textAlign: "center" } }, props.intl.formatMessage(exports.translationMessages.submitConfirmation_text)),
|
|
175
|
+
react_1.default.createElement(antd_1.Button, { type: "link", size: "large", icon: react_1.default.createElement(icons_1.FileAddOutlined, null), onClick: function () {
|
|
176
|
+
window.location.href = "".concat(window.location.pathname, "?skipintro");
|
|
177
|
+
}, style: { marginTop: "60px" } }, props.intl.formatMessage(exports.translationMessages.submitConfirmation_createAnotherDocuments_buttonLabel))))))));
|
|
170
178
|
};
|
|
171
179
|
exports.default = (0, react_intl_1.injectIntl)(SubmitConfirmation);
|
|
@@ -200,10 +200,18 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
200
200
|
var _5 = (0, react_1.useState)(false), alreadyRetried = _5[0], setAlreadyRetried = _5[1];
|
|
201
201
|
var _6 = (0, react_1.useState)(AttachmentUploadStatus_1.SubmittingStatus.Pending), invoiceSubmittingStatus = _6[0], setInvoiceSubmittingStatus = _6[1];
|
|
202
202
|
var _7 = (0, react_1.useState)([]), allAttachmentsWithStatuses = _7[0], setAllAttachmentsWithStatuses = _7[1];
|
|
203
|
+
var _8 = (0, react_1.useState)(true), showWelcomeModal = _8[0], setShowWelcomeModal = _8[1];
|
|
204
|
+
var url = new URL(window.location.href);
|
|
205
|
+
var skipWelcomeModal = url.searchParams.has("skipintro");
|
|
206
|
+
if (skipWelcomeModal) {
|
|
207
|
+
setShowWelcomeModal(false);
|
|
208
|
+
url.searchParams.delete("skipintro");
|
|
209
|
+
window.history.replaceState({}, "", url.toString());
|
|
210
|
+
}
|
|
203
211
|
var getDefaultPaymentType = function (defaultPaymentType) {
|
|
204
212
|
return defaultPaymentType || mapi_1.PaymentMeansType.DomesticClaim;
|
|
205
213
|
};
|
|
206
|
-
var
|
|
214
|
+
var _9 = (0, react_1.useState)({
|
|
207
215
|
invoice: {
|
|
208
216
|
supplier: {
|
|
209
217
|
address: {
|
|
@@ -229,7 +237,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
229
237
|
},
|
|
230
238
|
issueDate: (0, dayjs_1.default)(),
|
|
231
239
|
},
|
|
232
|
-
}), formData =
|
|
240
|
+
}), formData = _9[0], setFormData = _9[1];
|
|
233
241
|
var values = antd_1.Form.useWatch([], form);
|
|
234
242
|
var validateBillingLinesAndRefIdentifierField = function (isMultipleReferenceIdentifier, isSingleReferenceIdentifier, someRequiredFieldsEmpty) {
|
|
235
243
|
var validationErrors = (0, ValidationUtility_1.validateInvoiceFieldsWithoutRules)(form, isMultipleReferenceIdentifier, isSingleReferenceIdentifier, someRequiredFieldsEmpty, setIsNextStepDisabled, referenceIdentifierIsMandatory, referenceIdentifierValidateStatus, intl);
|
|
@@ -595,7 +603,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
595
603
|
name: defaultCustomer.name,
|
|
596
604
|
});
|
|
597
605
|
}
|
|
598
|
-
var
|
|
606
|
+
var _10 = (0, react_1.useState)(undefined), billingLinesMetadata = _10[0], setBillingLinesMetadata = _10[1];
|
|
599
607
|
var getBillingLines = function (changedValues, allValues) {
|
|
600
608
|
var invoiceLines = allValues.invoice.invoiceLines;
|
|
601
609
|
if (invoiceLines) {
|
|
@@ -698,6 +706,6 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
698
706
|
react_1.default.createElement(icons_1.ArrowRightOutlined, null)))) : (activeStep === items.length && (react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit", size: "large", disabled: isSubmitDisabled, onClick: function () { return form.submit(); }, block: true },
|
|
699
707
|
intl.formatMessage(exports.translationMessages.createInvoice_Submit),
|
|
700
708
|
react_1.default.createElement(icons_1.ArrowRightOutlined, null))))))))))),
|
|
701
|
-
props.language && props.welcomeModalTitle && props.welcomeModalParagraph && (react_1.default.createElement(welcome_modal_1.default, { isOpen: isWelcomeModalOpen, onClose: function () { return setIsWelcomeModalOpen(false); }, title: props.welcomeModalTitle[props.language], paragraph: props.welcomeModalParagraph[props.language], imageUrl: props.welcomeModalImageUrl }))));
|
|
709
|
+
showWelcomeModal && props.language && props.welcomeModalTitle && props.welcomeModalParagraph && (react_1.default.createElement(welcome_modal_1.default, { isOpen: isWelcomeModalOpen, onClose: function () { return setIsWelcomeModalOpen(false); }, title: props.welcomeModalTitle[props.language], paragraph: props.welcomeModalParagraph[props.language], imageUrl: props.welcomeModalImageUrl }))));
|
|
702
710
|
};
|
|
703
711
|
exports.default = (0, react_intl_1.injectIntl)(CreateInvoiceConstructor);
|
|
@@ -155,6 +155,7 @@
|
|
|
155
155
|
"saveInformation_label": "Save information",
|
|
156
156
|
"submitConfirmation_SuccessfullyUploadedAttachment": "Successfully uploaded attachment:",
|
|
157
157
|
"submitConfirmation_attachmentFailedToUpload": "Attachment failed to upload:",
|
|
158
|
+
"submitConfirmation_createAnotherDocuments_buttonLabel": "Create another document",
|
|
158
159
|
"submitConfirmation_footer_text": "If any questions arise, please contact us at",
|
|
159
160
|
"submitConfirmation_retryButton": "Retry",
|
|
160
161
|
"submitConfirmation_retryFailedAttachments": "Retry failed attachments",
|
|
@@ -155,6 +155,7 @@
|
|
|
155
155
|
"saveInformation_label": "Vista upplýsingar",
|
|
156
156
|
"submitConfirmation_SuccessfullyUploadedAttachment": "Viðhengi sem hefur verið sent:",
|
|
157
157
|
"submitConfirmation_attachmentFailedToUpload": "Ekki tókst að hlaða upp viðhengi:",
|
|
158
|
+
"submitConfirmation_createAnotherDocuments_buttonLabel": "Búa til annað skjal",
|
|
158
159
|
"submitConfirmation_footer_text": "Ef spurningar vakna, hafið samband",
|
|
159
160
|
"submitConfirmation_retryButton": "Endurkeyra",
|
|
160
161
|
"submitConfirmation_retryFailedAttachments": "Endurkeyra viðhengi sem tókst ekki að senda",
|
|
@@ -156,6 +156,7 @@ declare const _default: {
|
|
|
156
156
|
saveInformation_label: string;
|
|
157
157
|
submitConfirmation_SuccessfullyUploadedAttachment: string;
|
|
158
158
|
submitConfirmation_attachmentFailedToUpload: string;
|
|
159
|
+
submitConfirmation_createAnotherDocuments_buttonLabel: string;
|
|
159
160
|
submitConfirmation_footer_text: string;
|
|
160
161
|
submitConfirmation_retryButton: string;
|
|
161
162
|
submitConfirmation_retryFailedAttachments: string;
|
|
@@ -364,6 +365,7 @@ declare const _default: {
|
|
|
364
365
|
saveInformation_label: string;
|
|
365
366
|
submitConfirmation_SuccessfullyUploadedAttachment: string;
|
|
366
367
|
submitConfirmation_attachmentFailedToUpload: string;
|
|
368
|
+
submitConfirmation_createAnotherDocuments_buttonLabel: string;
|
|
367
369
|
submitConfirmation_footer_text: string;
|
|
368
370
|
submitConfirmation_retryButton: string;
|
|
369
371
|
submitConfirmation_retryFailedAttachments: string;
|