@unimaze/billing 0.21.27 → 0.21.29
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/Attachment.js +1 -0
- package/lib/common/components/attachments/AttachmentModal.js +6 -2
- package/lib/common/components/form-item/index.js +2 -2
- package/lib/common/components/payment-method/index.js +55 -55
- package/lib/utils/LocalStorageUtility.d.ts +2 -0
- package/lib/utils/LocalStorageUtility.js +35 -0
- package/package.json +1 -1
|
@@ -82,6 +82,7 @@ var translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
82
82
|
defaultMessage: "File failed to upload",
|
|
83
83
|
},
|
|
84
84
|
});
|
|
85
|
+
// TODO consider removing this component (not used)
|
|
85
86
|
var Attachment = function (props) {
|
|
86
87
|
var fieldName = props.fieldName;
|
|
87
88
|
var handleRemoveFile = function () {
|
|
@@ -50,6 +50,7 @@ var icons_1 = require("@ant-design/icons");
|
|
|
50
50
|
var FileUploadUtility_1 = require("../../../utils/FileUploadUtility");
|
|
51
51
|
var lib_1 = require("antd/lib");
|
|
52
52
|
var formLayout_1 = require("../../consts/formLayout");
|
|
53
|
+
var validationRules_1 = require("../../consts/validationRules");
|
|
53
54
|
var translationMessages = (0, react_intl_1.defineMessages)({
|
|
54
55
|
attachment_title: {
|
|
55
56
|
id: "attachment_title",
|
|
@@ -115,7 +116,7 @@ var AttachmentModal = function (props) {
|
|
|
115
116
|
}
|
|
116
117
|
};
|
|
117
118
|
React.useEffect(function () {
|
|
118
|
-
var _isSaveAttachmentsDisabled = props.attachments.length > 0 ? props.attachments.some(function (attachment) { return attachment.fieldValidation !== "success" || !attachment.description; }) : true;
|
|
119
|
+
var _isSaveAttachmentsDisabled = props.attachments.length > 0 ? props.attachments.some(function (attachment) { return attachment.fieldValidation !== "success" || (!attachment.description.trim()); }) : true;
|
|
119
120
|
setIsSaveAttachmentsDisabled(_isSaveAttachmentsDisabled);
|
|
120
121
|
}, [props.attachments]);
|
|
121
122
|
var verifyAttachment = function (info, uploadSizeLimit, formInstance) {
|
|
@@ -184,7 +185,7 @@ var AttachmentModal = function (props) {
|
|
|
184
185
|
props.attachments.length > 0 && (React.createElement(antd_1.Flex, { vertical: true },
|
|
185
186
|
React.createElement(antd_1.Typography.Text, null, props.intl.formatMessage(translationMessages.attachment_title)),
|
|
186
187
|
React.createElement("hr", null),
|
|
187
|
-
props.attachments.map(function (attachment, index) { return (React.createElement(antd_1.Flex, { gap: "middle", vertical: true },
|
|
188
|
+
props.attachments.map(function (attachment, index) { return (React.createElement(antd_1.Flex, { gap: "middle", vertical: true, key: attachment.uid + index },
|
|
188
189
|
React.createElement(antd_1.Flex, { gap: "middle", justify: "space-between" },
|
|
189
190
|
React.createElement(antd_1.Typography.Text, { type: attachment.file.status === "error" ? "danger" : undefined },
|
|
190
191
|
React.createElement(icons_1.PaperClipOutlined, null)),
|
|
@@ -200,6 +201,9 @@ var AttachmentModal = function (props) {
|
|
|
200
201
|
required: true,
|
|
201
202
|
message: props.intl.formatMessage(translationMessages.attachment_labels_Description_requiredMessage),
|
|
202
203
|
},
|
|
204
|
+
{
|
|
205
|
+
validator: (0, validationRules_1.noWhitespaceValidator)(props.intl)
|
|
206
|
+
}
|
|
203
207
|
], name: ["attachments", "file".concat(index + 1), "description"] }),
|
|
204
208
|
React.createElement(antd_1.Input, { prefix: React.createElement(antd_1.Typography.Text, { type: "danger" }, "*"), placeholder: props.intl.formatMessage(translationMessages.attachment_labels_Description), onChange: function (e) { return updateFile(attachment.file, { description: e.target.value }); } }))))); })))));
|
|
205
209
|
};
|
|
@@ -55,9 +55,9 @@ var UmzFormItem = function (props) {
|
|
|
55
55
|
required: isRequired,
|
|
56
56
|
message: intl.formatMessage(exports.translationMessages.formItem_required_errorMessage),
|
|
57
57
|
},
|
|
58
|
-
|
|
58
|
+
{
|
|
59
59
|
validator: (0, validationRules_1.noWhitespaceValidator)(props.intl)
|
|
60
|
-
}
|
|
60
|
+
}
|
|
61
61
|
], (additionalRules || []) // if the array is undefined
|
|
62
62
|
, true), style: style, initialValue: initialValue }, rest), children));
|
|
63
63
|
};
|
|
@@ -105,20 +105,21 @@ var PaymentMethod = function (props) {
|
|
|
105
105
|
setIsMobile(false);
|
|
106
106
|
}
|
|
107
107
|
}, [width]);
|
|
108
|
-
var
|
|
109
|
-
"invoice",
|
|
110
|
-
"paymentMeans",
|
|
111
|
-
"type",
|
|
112
|
-
])
|
|
113
|
-
? props.formInstance.getFieldValue(["invoice", "paymentMeans", "type"])
|
|
114
|
-
: "NotSpecified";
|
|
115
|
-
var initialPaymentMeansType = mapi_1.PaymentMeansType[paymentMeansType];
|
|
116
|
-
var _b = (0, react_1.useState)(initialPaymentMeansType), paymentMethod = _b[0], setPaymentMethod = _b[1]; // PaymentMeansType.DomesticClaim);
|
|
108
|
+
var _b = (0, react_1.useState)(mapi_1.PaymentMeansType.DomesticClaim), paymentMethod = _b[0], setPaymentMethod = _b[1];
|
|
117
109
|
(0, react_1.useEffect)(function () {
|
|
118
|
-
if (!props.formInstance.getFieldValue(["invoice", "paymentMeans", "domesticTransfer", "accountTypeNumber"])) {
|
|
110
|
+
if (props.formInstance.getFieldValue(["invoice", "paymentMeans", "type"]) === mapi_1.PaymentMeansType.DomesticTransfer && !props.formInstance.getFieldValue(["invoice", "paymentMeans", "domesticTransfer", "accountTypeNumber"])) {
|
|
119
111
|
props.formInstance.setFieldValue(["invoice", "paymentMeans", "domesticTransfer", "accountTypeNumber"], "04");
|
|
120
112
|
}
|
|
121
113
|
}, [props.formInstance.getFieldValue(["invoice", "paymentMeans", "type"])]);
|
|
114
|
+
(0, react_1.useEffect)(function () {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
var localStorageRawData = localStorage.getItem("formData");
|
|
117
|
+
var formFromLocalStorage = localStorageRawData ? JSON.parse(localStorageRawData) : null;
|
|
118
|
+
var paymentTypeFromLocalStorage = (_b = (_a = formFromLocalStorage === null || formFromLocalStorage === void 0 ? void 0 : formFromLocalStorage.invoice) === null || _a === void 0 ? void 0 : _a.paymentMeans) === null || _b === void 0 ? void 0 : _b.type;
|
|
119
|
+
var paymentFromFormInitialValue = props.formInstance.getFieldValue(["invoice", "paymentMeans", "type"]);
|
|
120
|
+
var initialType = paymentTypeFromLocalStorage ? mapi_1.PaymentMeansType[paymentTypeFromLocalStorage] : mapi_1.PaymentMeansType[paymentFromFormInitialValue];
|
|
121
|
+
setPaymentMethod(initialType);
|
|
122
|
+
}, []);
|
|
122
123
|
var domesticTransferFormFields = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
123
124
|
react_1.default.createElement(antd_1.Form.Item, null,
|
|
124
125
|
react_1.default.createElement(antd_1.Row, { gutter: [8, 0] },
|
|
@@ -197,55 +198,54 @@ var PaymentMethod = function (props) {
|
|
|
197
198
|
"domesticTransfer",
|
|
198
199
|
"paymentIdentifier",
|
|
199
200
|
]) }))));
|
|
200
|
-
var icelandicClaimFormFields = (react_1.default.createElement(
|
|
201
|
-
react_1.default.createElement(antd_1.
|
|
202
|
-
react_1.default.createElement(antd_1.
|
|
203
|
-
react_1.default.createElement(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
201
|
+
var icelandicClaimFormFields = (react_1.default.createElement(antd_1.Form.Item, null,
|
|
202
|
+
react_1.default.createElement(antd_1.Row, { gutter: [8, 0] },
|
|
203
|
+
react_1.default.createElement(antd_1.Col, { span: 6 },
|
|
204
|
+
react_1.default.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["paymentMeans.domesticClaim.bankNumber"], defaultLabel: props.intl.formatMessage(exports.translationMessages.paymentMethod_labels_icelandicClaim_bankNo), defaultIsRequired: true, fieldName: ["invoice", "paymentMeans", "domesticClaim", "bankNumber"], additionalRules: [
|
|
205
|
+
{
|
|
206
|
+
pattern: new RegExp("^[0-9]*$"),
|
|
207
|
+
message: props.intl.formatMessage(exports.translationMessages.paymentMethod_rules_number),
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
min: 1,
|
|
211
|
+
max: 4,
|
|
212
|
+
message: props.intl.formatMessage(exports.translationMessages.paymentMethod_rules_Length, {
|
|
213
|
+
fieldName: props.intl.formatMessage(exports.translationMessages.paymentMethod_labels_icelandicClaim_bankNo),
|
|
210
214
|
min: 1,
|
|
211
215
|
max: 4,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
216
|
+
}),
|
|
217
|
+
},
|
|
218
|
+
] },
|
|
219
|
+
react_1.default.createElement(components_1.UmzInput, { defaultIsRequired: true, defaultPlaceholder: props.intl.formatMessage(exports.translationMessages.paymentMethod_labels_icelandicClaim_bankNo), defaultValue: props.formInstance.getFieldValue([
|
|
220
|
+
"invoice",
|
|
221
|
+
"paymentMeans",
|
|
222
|
+
"domesticClaim",
|
|
223
|
+
"bankNumber",
|
|
224
|
+
]) }))),
|
|
225
|
+
react_1.default.createElement(antd_1.Col, { span: 6 },
|
|
226
|
+
react_1.default.createElement(antd_1.Input, { disabled: true, value: 66 })),
|
|
227
|
+
react_1.default.createElement(antd_1.Col, { span: 12 },
|
|
228
|
+
react_1.default.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["paymentMeans.domesticClaim.accountNumber"], defaultLabel: props.intl.formatMessage(exports.translationMessages.paymentMethod_labels_icelandicClaim_claimNo), defaultIsRequired: true, fieldName: ["invoice", "paymentMeans", "domesticClaim", "accountNumber"], additionalRules: [
|
|
229
|
+
{
|
|
230
|
+
pattern: new RegExp("^[0-9]*$"),
|
|
231
|
+
message: props.intl.formatMessage(exports.translationMessages.paymentMethod_rules_number),
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
min: 1,
|
|
235
|
+
max: 6,
|
|
236
|
+
message: props.intl.formatMessage(exports.translationMessages.paymentMethod_rules_Length, {
|
|
237
|
+
fieldName: props.intl.formatMessage(exports.translationMessages.paymentMethod_labels_icelandicClaim_claimNo),
|
|
234
238
|
min: 1,
|
|
235
239
|
max: 6,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
"paymentMeans",
|
|
246
|
-
"domesticClaim",
|
|
247
|
-
"accountNumber",
|
|
248
|
-
]) })))))));
|
|
240
|
+
}),
|
|
241
|
+
},
|
|
242
|
+
] },
|
|
243
|
+
react_1.default.createElement(components_1.UmzInput, { defaultPlaceholder: props.intl.formatMessage(exports.translationMessages.paymentMethod_labels_icelandicClaim_claimNo), defaultIsRequired: true, defaultValue: props.formInstance.getFieldValue([
|
|
244
|
+
"invoice",
|
|
245
|
+
"paymentMeans",
|
|
246
|
+
"domesticClaim",
|
|
247
|
+
"accountNumber",
|
|
248
|
+
]) }))))));
|
|
249
249
|
var renderFormFields = function (payMthd) {
|
|
250
250
|
switch (payMthd) {
|
|
251
251
|
case mapi_1.PaymentMeansType.NotSpecified:
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.setFormToLocalStorage = exports.getFormFromLocalStorage = void 0;
|
|
15
|
+
var getFormFromLocalStorage = function (localStorageFormDataVersion) {
|
|
16
|
+
var rawValuesFromLocalStorage = localStorage.getItem("formData");
|
|
17
|
+
var valuesFromLocalStorageObject = rawValuesFromLocalStorage ? JSON.parse(rawValuesFromLocalStorage) : null;
|
|
18
|
+
if (valuesFromLocalStorageObject) {
|
|
19
|
+
if ((valuesFromLocalStorageObject === null || valuesFromLocalStorageObject === void 0 ? void 0 : valuesFromLocalStorageObject.localStorageFormDataVersion) === localStorageFormDataVersion) {
|
|
20
|
+
return valuesFromLocalStorageObject;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
localStorage.removeItem("formData");
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
localStorage.removeItem("formData");
|
|
28
|
+
return null;
|
|
29
|
+
};
|
|
30
|
+
exports.getFormFromLocalStorage = getFormFromLocalStorage;
|
|
31
|
+
var setFormToLocalStorage = function (formData, localStorageFormDataVersion) {
|
|
32
|
+
var objectForLocalStorage = __assign(__assign({}, formData), { localStorageFormDataVersion: localStorageFormDataVersion });
|
|
33
|
+
localStorage.setItem("formData", JSON.stringify(objectForLocalStorage));
|
|
34
|
+
};
|
|
35
|
+
exports.setFormToLocalStorage = setFormToLocalStorage;
|