@unimaze/billing 0.21.14 → 0.21.15
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/base-information/OrderReference.js +2 -2
- package/lib/common/components/base-information/ReferenceIdentifiers.js +4 -4
- package/lib/common/components/customer/index.d.ts +2 -3
- package/lib/common/components/customer/index.js +0 -1
- package/lib/common/components/supplier/index.js +2 -2
- package/lib/common/types/AppConfiguration.d.ts +4 -7
- package/lib/create-credit-note/index.d.ts +2 -2
- package/lib/create-invoice/IntlLoader.d.ts +2 -2
- package/lib/create-invoice/index.d.ts +2 -2
- package/lib/create-invoice/index.js +105 -107
- package/lib/utils/ApiUtility.d.ts +7 -6
- package/lib/utils/ApiUtility.js +24 -11
- package/lib/utils/ConversionUtility.d.ts +2 -2
- package/lib/utils/ConversionUtility.js +14 -12
- package/lib/utils/ReferenceIdentifierUtility.js +3 -2
- package/lib/utils/RequirementsUtility.js +3 -2
- package/package.json +1 -1
|
@@ -42,8 +42,8 @@ var translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
44
|
var getOrderReferenceFieldDefinitions = function (receiverRequirements) {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
var _a;
|
|
46
|
+
return ((_a = receiverRequirements === null || receiverRequirements === void 0 ? void 0 : receiverRequirements.fieldDefinitions) === null || _a === void 0 ? void 0 : _a.find(function (fieldRequirement) { return fieldRequirement.key === "orderReference.documentNo"; }));
|
|
47
47
|
};
|
|
48
48
|
var OrderReference = function (props) {
|
|
49
49
|
if (getOrderReferenceFieldDefinitions(props.receiverRequirements)) {
|
|
@@ -102,7 +102,7 @@ var ReferenceIdentifiers = function (props) {
|
|
|
102
102
|
var referenceIdentifierOptions = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierOptions)(props.receiverRequirements);
|
|
103
103
|
var referenceIdentifiersHelpTextNode = (react_1.default.createElement("div", null,
|
|
104
104
|
react_1.default.createElement("p", null, referenceIdentifiersHelp),
|
|
105
|
-
react_1.default.createElement("ul", null, referenceIdentifierOptions.map(function (x) {
|
|
105
|
+
react_1.default.createElement("ul", null, referenceIdentifierOptions === null || referenceIdentifierOptions === void 0 ? void 0 : referenceIdentifierOptions.map(function (x) {
|
|
106
106
|
if (x.properties.hasOwnProperty("handling") && x.properties.handling) {
|
|
107
107
|
var handling = JSON.parse(x.properties.handling);
|
|
108
108
|
if (handling.hasOwnProperty("helpText") && handling.helpText.length > 0) {
|
|
@@ -112,7 +112,7 @@ var ReferenceIdentifiers = function (props) {
|
|
|
112
112
|
}))));
|
|
113
113
|
var getReferenceIdentifier = function (receiverRequirements) {
|
|
114
114
|
var options = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierOptions)(receiverRequirements);
|
|
115
|
-
if (options.length > 0) {
|
|
115
|
+
if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
|
|
116
116
|
return options.map(function (referenceIdentifierOption) {
|
|
117
117
|
return (react_1.default.createElement(antd_1.Select.Option, { key: referenceIdentifierOption.key, value: referenceIdentifierOption.key }, referenceIdentifierOption.properties.label));
|
|
118
118
|
});
|
|
@@ -276,10 +276,10 @@ var ReferenceIdentifiers = function (props) {
|
|
|
276
276
|
react_1.default.createElement(__1.UmzInput, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["referenceIdentifier.*"], defaultPlaceholder: singleReferenceIdentifierLabel })));
|
|
277
277
|
}
|
|
278
278
|
};
|
|
279
|
-
if (referenceIdentifiersDefinitions.length === 0) {
|
|
279
|
+
if ((referenceIdentifiersDefinitions === null || referenceIdentifiersDefinitions === void 0 ? void 0 : referenceIdentifiersDefinitions.length) === 0) {
|
|
280
280
|
return null;
|
|
281
281
|
}
|
|
282
|
-
else if (referenceIdentifiersDefinitions.length === 1) {
|
|
282
|
+
else if ((referenceIdentifiersDefinitions === null || referenceIdentifiersDefinitions === void 0 ? void 0 : referenceIdentifiersDefinitions.length) === 1) {
|
|
283
283
|
props.formInstance.setFieldsValue({
|
|
284
284
|
invoice: {
|
|
285
285
|
singleReferenceIdentifier: {
|
|
@@ -2,15 +2,14 @@ import React from "react";
|
|
|
2
2
|
import { WrappedComponentProps } from "react-intl";
|
|
3
3
|
import { FormInstance } from "antd/es/form";
|
|
4
4
|
import { PartyMetadata } from "@unimaze/api-clients/lib/mapi";
|
|
5
|
-
import {
|
|
5
|
+
import { PortalConfigurationCustomer } from "@unimaze/api-clients/lib/rapi";
|
|
6
6
|
import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
|
|
7
7
|
interface Props extends WrappedComponentProps {
|
|
8
8
|
receiverRequirements: NewReceiverRequirements;
|
|
9
|
-
customers:
|
|
9
|
+
customers: PortalConfigurationCustomer[];
|
|
10
10
|
formInstance: FormInstance;
|
|
11
11
|
chosenCustomer: PartyMetadata | undefined;
|
|
12
12
|
setChosenCustomer: (chosenCustomer: PartyMetadata) => void;
|
|
13
|
-
setChosenCustomerApiKey: (chosenCustomerApiKey: string) => void;
|
|
14
13
|
rapiBaseUrl: string;
|
|
15
14
|
updateReceiverRequirementsProp: (newReceiverRequirements: NewReceiverRequirements) => void;
|
|
16
15
|
validateFields: (fieldNames: string[][], validateOnly?: boolean | undefined) => void;
|
|
@@ -110,7 +110,6 @@ var Customer = function (props) {
|
|
|
110
110
|
var prevValues = props.formInstance.getFieldsValue();
|
|
111
111
|
var newFormValues = __assign(__assign({}, prevValues), { invoice: __assign(__assign({}, prevValues.invoice), { customer: __assign(__assign({}, prevValues.invoice.customer), customerPartyMetadata) }) });
|
|
112
112
|
setChosenCustomer(__assign(__assign({}, prevValues.invoice.customer), customerPartyMetadata));
|
|
113
|
-
props.setChosenCustomerApiKey(props.customers[customerIndex].apiKey);
|
|
114
113
|
props.formInstance.setFieldsValue(newFormValues);
|
|
115
114
|
};
|
|
116
115
|
var fieldPaths = [
|
|
@@ -224,8 +224,8 @@ var Supplier = function (props) {
|
|
|
224
224
|
}
|
|
225
225
|
}, 500);
|
|
226
226
|
var getSupplierTelephoneFieldDefinitions = function (receiverRequirements) {
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
var _a;
|
|
228
|
+
return ((_a = receiverRequirements === null || receiverRequirements === void 0 ? void 0 : receiverRequirements.fieldDefinitions) === null || _a === void 0 ? void 0 : _a.find(function (fieldRequirement) { return fieldRequirement.key === "supplier.contact.telephone"; }));
|
|
229
229
|
};
|
|
230
230
|
var formatIdentifierInput = function (value) {
|
|
231
231
|
var digitsOnly = value.replace(/\D/g, "");
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PortalConfigurationCustomer } from "@unimaze/api-clients/lib/rapi";
|
|
2
2
|
interface AppConfiguration {
|
|
3
3
|
mapiUrl: string;
|
|
4
4
|
rapiUrl: string;
|
|
5
5
|
env: HostConfiguration[];
|
|
6
6
|
}
|
|
7
|
-
interface ProfileOutputWithApiKey extends ProfileOutput {
|
|
8
|
-
apiKey: string;
|
|
9
|
-
}
|
|
10
7
|
interface HostConfiguration {
|
|
11
8
|
host: string;
|
|
12
9
|
legalIdentifier: string;
|
|
13
10
|
language: "en" | "is";
|
|
14
|
-
customers:
|
|
11
|
+
customers: PortalConfigurationCustomer[];
|
|
15
12
|
}
|
|
16
13
|
interface EnvironmentConfiguration {
|
|
17
14
|
mapiUrl: string;
|
|
@@ -20,7 +17,7 @@ interface EnvironmentConfiguration {
|
|
|
20
17
|
legalIdentifier: string;
|
|
21
18
|
infoText?: string;
|
|
22
19
|
supportEmail?: string;
|
|
23
|
-
customers:
|
|
20
|
+
customers: PortalConfigurationCustomer[];
|
|
24
21
|
language: "is" | "en";
|
|
25
22
|
}
|
|
26
|
-
export { AppConfiguration, HostConfiguration,
|
|
23
|
+
export { AppConfiguration, HostConfiguration, PortalConfigurationCustomer, EnvironmentConfiguration };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../style/index.css";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { CommonProps } from "../common/types/CommonProps";
|
|
4
|
-
import {
|
|
4
|
+
import { PortalConfigurationCustomer } from "@unimaze/api-clients/lib/rapi";
|
|
5
5
|
interface Props extends CommonProps {
|
|
6
|
-
customer:
|
|
6
|
+
customer: PortalConfigurationCustomer;
|
|
7
7
|
}
|
|
8
8
|
declare const CreateInvoice: React.FC<Props>;
|
|
9
9
|
export default CreateInvoice;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CommonProps } from "../common/types/CommonProps";
|
|
3
|
-
import { ProfileOutputWithApiKey } from "../common/types/AppConfiguration";
|
|
4
3
|
import "moment/locale/is";
|
|
4
|
+
import { PortalConfigurationCustomer } from "@unimaze/api-clients/lib/rapi";
|
|
5
5
|
interface Props extends CommonProps {
|
|
6
|
-
customers:
|
|
6
|
+
customers: PortalConfigurationCustomer[];
|
|
7
7
|
referenceIdentifiersHelpText?: string;
|
|
8
8
|
referenceIdentifiersLabelText?: string;
|
|
9
9
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ProfileOutputWithApiKey } from "../common/types/AppConfiguration";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { WrappedComponentProps } from "react-intl";
|
|
4
3
|
import { CommonProps } from "../common/types/CommonProps";
|
|
5
4
|
import "../common/style/index.css";
|
|
5
|
+
import { PortalConfigurationCustomer } from "@unimaze/api-clients/lib/rapi";
|
|
6
6
|
export declare const translationMessages: {
|
|
7
7
|
createInvoice_addDocumentLineMsg: {
|
|
8
8
|
id: string;
|
|
@@ -70,7 +70,7 @@ export declare const translationMessages: {
|
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
72
|
interface Props extends CommonProps, WrappedComponentProps {
|
|
73
|
-
customers:
|
|
73
|
+
customers: PortalConfigurationCustomer[];
|
|
74
74
|
referenceIdentifiersHelpText?: string;
|
|
75
75
|
referenceIdentifiersLabelText?: string;
|
|
76
76
|
}
|
|
@@ -179,12 +179,12 @@ exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
179
179
|
* @component
|
|
180
180
|
*/
|
|
181
181
|
var CreateInvoiceConstructor = function (props) {
|
|
182
|
-
var _a;
|
|
182
|
+
var _a, _b, _c, _d, _e;
|
|
183
183
|
var recaptchaRef = react_1.default.useRef(null);
|
|
184
184
|
var intl = props.intl;
|
|
185
185
|
var form = antd_1.Form.useForm()[0];
|
|
186
186
|
var width = (0, react_use_1.useWindowSize)().width;
|
|
187
|
-
var
|
|
187
|
+
var _f = (0, react_1.useState)(false), isMobile = _f[0], setIsMobile = _f[1];
|
|
188
188
|
(0, react_1.useEffect)(function () {
|
|
189
189
|
if (width < 768) {
|
|
190
190
|
setIsMobile(true);
|
|
@@ -193,29 +193,28 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
193
193
|
setIsMobile(false);
|
|
194
194
|
}
|
|
195
195
|
}, [width]);
|
|
196
|
-
var
|
|
197
|
-
var
|
|
198
|
-
var
|
|
199
|
-
var
|
|
200
|
-
var
|
|
201
|
-
var
|
|
202
|
-
var
|
|
203
|
-
var
|
|
204
|
-
var
|
|
205
|
-
var
|
|
206
|
-
var
|
|
207
|
-
var
|
|
208
|
-
var
|
|
209
|
-
var
|
|
210
|
-
var
|
|
211
|
-
var
|
|
212
|
-
var
|
|
213
|
-
var
|
|
214
|
-
var _w = (0, react_1.useState)(undefined), missingRequiredDataTooltip = _w[0], setMissingRequiredDataTooltip = _w[1];
|
|
196
|
+
var _g = (0, react_1.useState)(false), submitting = _g[0], setSubmitting = _g[1];
|
|
197
|
+
var _h = (0, react_1.useState)(true), isSubmitDisabled = _h[0], setIsSubmitDisabled = _h[1];
|
|
198
|
+
var _j = (0, react_1.useState)(false), isBackButtonVisible = _j[0], setIsBackButtonVisible = _j[1];
|
|
199
|
+
var _k = (0, react_1.useState)(true), isNextStepDisabled = _k[0], setIsNextStepDisabled = _k[1];
|
|
200
|
+
var _l = (0, react_1.useState)(false), isNextStepVisible = _l[0], setIsNextStepVisible = _l[1];
|
|
201
|
+
var _m = (0, react_1.useState)(0), activeStep = _m[0], setActiveStep = _m[1];
|
|
202
|
+
var _o = (0, react_1.useState)(true), isWelcomeModalOpen = _o[0], setIsWelcomeModalOpen = _o[1];
|
|
203
|
+
var _p = (0, react_1.useState)(""), supplierEmail = _p[0], setSupplierEmail = _p[1];
|
|
204
|
+
var _q = (0, react_1.useState)(false), isSaveFieldValuesSelected = _q[0], setIsSaveFieldValuesSelected = _q[1];
|
|
205
|
+
var _r = (0, react_1.useState)((0, ConversionUtility_1.profileOutputToPartyMetadata)(props.customers[0])), chosenCustomer = _r[0], setChosenCustomer = _r[1];
|
|
206
|
+
var _s = (0, react_1.useState)(true), sendCopyDisabled = _s[0], setSendCopyDisabled = _s[1];
|
|
207
|
+
var _t = (0, react_1.useState)(false), sendCopy = _t[0], setSendCopy = _t[1];
|
|
208
|
+
var _u = react_1.default.useState(""), referenceIdentifierValidateStatus = _u[0], setReferenceIdentifierValidateStatus = _u[1];
|
|
209
|
+
var _v = (0, react_1.useState)(true), referenceIdentifierIsMandatory = _v[0], setReferenceIdentifierIsMandatory = _v[1];
|
|
210
|
+
var _w = (0, react_1.useState)(false), outsideVatScope = _w[0], setOutsideVatScope = _w[1];
|
|
211
|
+
var _x = (0, react_1.useState)(false), captchaVerified = _x[0], setCaptchaVerified = _x[1];
|
|
212
|
+
var _y = (0, react_1.useState)({}), removedInvoiceLine = _y[0], setRemovedInvoiceLine = _y[1];
|
|
213
|
+
var _z = (0, react_1.useState)(undefined), missingRequiredDataTooltip = _z[0], setMissingRequiredDataTooltip = _z[1];
|
|
215
214
|
var getDefaultPaymentType = function (defaultPaymentType) {
|
|
216
215
|
return defaultPaymentType || mapi_1.PaymentMeansType.DomesticClaim;
|
|
217
216
|
};
|
|
218
|
-
var
|
|
217
|
+
var _0 = (0, react_1.useState)({
|
|
219
218
|
invoice: {
|
|
220
219
|
supplier: {
|
|
221
220
|
address: {
|
|
@@ -241,15 +240,15 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
241
240
|
},
|
|
242
241
|
issueDate: (0, dayjs_1.default)(),
|
|
243
242
|
},
|
|
244
|
-
}), formData =
|
|
243
|
+
}), formData = _0[0], setFormData = _0[1];
|
|
245
244
|
var validateFieldsForNextStep = function (fieldPaths, validateOnly) { return __awaiter(void 0, void 0, void 0, function () {
|
|
246
245
|
var referenceIdentifiersDefinitions, isSingleReferenceIdentifier, isMultipleReferenceIdentifier, someRequiredFieldsEmpty;
|
|
247
246
|
return __generator(this, function (_a) {
|
|
248
247
|
switch (_a.label) {
|
|
249
248
|
case 0:
|
|
250
249
|
referenceIdentifiersDefinitions = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierFieldDefinitions)(props.receiverRequirements);
|
|
251
|
-
isSingleReferenceIdentifier = referenceIdentifiersDefinitions.length === 1;
|
|
252
|
-
isMultipleReferenceIdentifier = referenceIdentifiersDefinitions.length > 1;
|
|
250
|
+
isSingleReferenceIdentifier = (referenceIdentifiersDefinitions === null || referenceIdentifiersDefinitions === void 0 ? void 0 : referenceIdentifiersDefinitions.length) === 1;
|
|
251
|
+
isMultipleReferenceIdentifier = (referenceIdentifiersDefinitions === null || referenceIdentifiersDefinitions === void 0 ? void 0 : referenceIdentifiersDefinitions.length) > 1;
|
|
253
252
|
someRequiredFieldsEmpty = function () {
|
|
254
253
|
var _a, _b;
|
|
255
254
|
var referenceIdentifierType = form.getFieldValue(["invoice", "referenceIdentifiers"]);
|
|
@@ -467,83 +466,83 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
467
466
|
processingMode: mapi_1.TransactionProcessingMode.Device,
|
|
468
467
|
services: services,
|
|
469
468
|
};
|
|
470
|
-
(0,
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
(
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
name: ["invoice", "supplier"],
|
|
491
|
-
value: values.invoice.supplier,
|
|
492
|
-
},
|
|
493
|
-
{
|
|
494
|
-
name: ["outsideVatScope"],
|
|
495
|
-
value: !values.invoice.supplier.vatNumber,
|
|
496
|
-
},
|
|
497
|
-
{
|
|
498
|
-
name: ["attachments"],
|
|
499
|
-
value: {
|
|
500
|
-
file1: { file: undefined, description: undefined },
|
|
501
|
-
file2: { file: undefined, description: undefined },
|
|
502
|
-
file3: { file: undefined, description: undefined },
|
|
469
|
+
(0, ApiUtility_1.getAuthToken)(props.rapiBaseUrl, chosenCustomer === null || chosenCustomer === void 0 ? void 0 : chosenCustomer.identifier).then(function (getAuthTokenResponse) {
|
|
470
|
+
var token = getAuthTokenResponse.data;
|
|
471
|
+
(0, utils_1.submitInvoice)(createSubmitInvoice, props.mapiBaseUrl, token, "submitInvoice", props.language)
|
|
472
|
+
.then(function (submitInvoiceResponse) {
|
|
473
|
+
var _a;
|
|
474
|
+
antd_1.message.success(intl.formatMessage(exports.translationMessages.createInvoice_successfullySubmittedInvoiceMsg));
|
|
475
|
+
if (submitInvoiceResponse.status === 200) {
|
|
476
|
+
var response = submitInvoiceResponse.data;
|
|
477
|
+
(0, ApiUtility_1.submitAttachmentIfAnyLeft)((_a = response === null || response === void 0 ? void 0 : response.uniqueId) !== null && _a !== void 0 ? _a : "", attachments, props.mapiBaseUrl, token, intl);
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
antd_1.message.error("Created invoice had validation errors");
|
|
481
|
+
}
|
|
482
|
+
setActiveStep(activeStep + 1);
|
|
483
|
+
setSubmitting(false);
|
|
484
|
+
form.resetFields();
|
|
485
|
+
form.setFields([
|
|
486
|
+
{
|
|
487
|
+
name: ["invoice", "invoiceLines"],
|
|
488
|
+
value: [{}],
|
|
503
489
|
},
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
490
|
+
{
|
|
491
|
+
name: ["invoice", "supplier"],
|
|
492
|
+
value: values.invoice.supplier,
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
name: ["outsideVatScope"],
|
|
496
|
+
value: !values.invoice.supplier.vatNumber,
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
name: ["attachments"],
|
|
500
|
+
value: {
|
|
501
|
+
file1: { file: undefined, description: undefined },
|
|
502
|
+
file2: { file: undefined, description: undefined },
|
|
503
|
+
file3: { file: undefined, description: undefined },
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
]);
|
|
507
|
+
// Clear the billing line dataSource
|
|
508
|
+
setChosenCustomer((0, ConversionUtility_1.profileOutputToPartyMetadata)(props.customers[0]));
|
|
509
|
+
// TODO: remove this as soon as possible
|
|
510
|
+
// location.reload();
|
|
511
|
+
})
|
|
512
|
+
.catch(function (error) {
|
|
513
|
+
setSubmitting(false);
|
|
514
|
+
if (error.response) {
|
|
515
|
+
// The request was made and the server responded with a status code
|
|
516
|
+
// that falls out of the range of 2xx
|
|
517
|
+
if (error.response.data) {
|
|
518
|
+
var errorData = error.response.data;
|
|
519
|
+
if (errorData.hasOwnProperty("message")) {
|
|
520
|
+
antd_1.message.error(errorData.message);
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
for (var errorMessageKey in errorData) {
|
|
524
|
+
if (errorData.hasOwnProperty(errorMessageKey)) {
|
|
525
|
+
antd_1.message.error(react_1.default.createElement(react_1.default.Fragment, null,
|
|
526
|
+
react_1.default.createElement("strong", null, errorMessageKey),
|
|
527
|
+
react_1.default.createElement("br", null),
|
|
528
|
+
errorData[errorMessageKey]));
|
|
529
|
+
}
|
|
531
530
|
}
|
|
532
531
|
}
|
|
533
532
|
}
|
|
534
533
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
}
|
|
534
|
+
else if (error.request) {
|
|
535
|
+
// The request was made but no response was received
|
|
536
|
+
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
|
537
|
+
// http.ClientRequest in node.js
|
|
538
|
+
var request = error.request;
|
|
539
|
+
antd_1.message.error(request.responseText);
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
// Something happened in setting up the request that triggered an Error
|
|
543
|
+
antd_1.message.error(error.message);
|
|
544
|
+
}
|
|
545
|
+
});
|
|
547
546
|
});
|
|
548
547
|
if (recaptchaRef) {
|
|
549
548
|
if (recaptchaRef.current) {
|
|
@@ -593,17 +592,16 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
593
592
|
telephone: defaultCustomer.phoneNumber,
|
|
594
593
|
},
|
|
595
594
|
address: {
|
|
596
|
-
countryCode: defaultCustomer.country,
|
|
597
|
-
city: defaultCustomer.
|
|
598
|
-
postalZone: defaultCustomer.
|
|
599
|
-
streetNameAndNumber: defaultCustomer.
|
|
595
|
+
countryCode: (_a = defaultCustomer === null || defaultCustomer === void 0 ? void 0 : defaultCustomer.address) === null || _a === void 0 ? void 0 : _a.country,
|
|
596
|
+
city: (_b = defaultCustomer === null || defaultCustomer === void 0 ? void 0 : defaultCustomer.address) === null || _b === void 0 ? void 0 : _b.city,
|
|
597
|
+
postalZone: (_c = defaultCustomer === null || defaultCustomer === void 0 ? void 0 : defaultCustomer.address) === null || _c === void 0 ? void 0 : _c.postalCode,
|
|
598
|
+
streetNameAndNumber: (_d = defaultCustomer === null || defaultCustomer === void 0 ? void 0 : defaultCustomer.address) === null || _d === void 0 ? void 0 : _d.street,
|
|
600
599
|
},
|
|
601
|
-
identifier: defaultCustomer.
|
|
600
|
+
identifier: defaultCustomer === null || defaultCustomer === void 0 ? void 0 : defaultCustomer.isoIdentifier,
|
|
602
601
|
name: defaultCustomer.name,
|
|
603
602
|
});
|
|
604
|
-
setChosenCustomerApiKey(props.customers[0].apiKey);
|
|
605
603
|
}
|
|
606
|
-
var
|
|
604
|
+
var _1 = (0, react_1.useState)(undefined), billingLinesMetadata = _1[0], setBillingLinesMetadata = _1[1];
|
|
607
605
|
var getBillingLines = function (changedValues, allValues) {
|
|
608
606
|
var invoiceLines = allValues.invoice.invoiceLines;
|
|
609
607
|
if (invoiceLines) {
|
|
@@ -667,7 +665,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
667
665
|
react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "currencyCode"], hidden: true }),
|
|
668
666
|
react_1.default.createElement(antd_1.Flex, { gap: "middle", vertical: true },
|
|
669
667
|
react_1.default.createElement(antd_1.Flex, { vertical: true, style: activeStep !== 0 ? { display: "none" } : {} },
|
|
670
|
-
react_1.default.createElement(components_1.Customer, { receiverRequirements: props.receiverRequirements, formInstance: form, customers: props.customers, chosenCustomer: chosenCustomer, setChosenCustomer: setChosenCustomer,
|
|
668
|
+
react_1.default.createElement(components_1.Customer, { receiverRequirements: props.receiverRequirements, formInstance: form, customers: props.customers, chosenCustomer: chosenCustomer, setChosenCustomer: setChosenCustomer, rapiBaseUrl: props.rapiBaseUrl, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, validateFields: validateFieldsForNextStep, isSaveFieldValuesSelected: isSaveFieldValuesSelected, onSaveFieldValuesChange: function () {
|
|
671
669
|
return setIsSaveFieldValuesSelected(!isSaveFieldValuesSelected);
|
|
672
670
|
}, isActiveStep: activeStep === 0 })),
|
|
673
671
|
react_1.default.createElement(antd_1.Flex, { vertical: true, style: activeStep !== 1 ? { display: "none" } : {} },
|
|
@@ -694,8 +692,8 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
694
692
|
react_1.default.createElement(antd_1.Flex, { justify: "center" },
|
|
695
693
|
react_1.default.createElement(antd_1.Flex, { gap: isMobile ? "middle" : 60, justify: "end", style: { width: "100%", maxWidth: "900px" } },
|
|
696
694
|
isBackButtonVisible && (react_1.default.createElement(antd_1.Button, { onClick: handlePrevStep, size: "large", block: true },
|
|
697
|
-
react_1.default.createElement(icons_1.ArrowLeftOutlined, null), (
|
|
698
|
-
|
|
695
|
+
react_1.default.createElement(icons_1.ArrowLeftOutlined, null), (_e = items[activeStep - 1]) === null || _e === void 0 ? void 0 :
|
|
696
|
+
_e.title)),
|
|
699
697
|
isNextStepVisible ? (react_1.default.createElement(antd_1.Tooltip, { title: missingRequiredDataTooltip },
|
|
700
698
|
react_1.default.createElement(antd_1.Button, { onClick: handleNextStep, type: "primary", size: "large", style: { maxWidth: "50%" }, disabled: isNextStepDisabled, block: true },
|
|
701
699
|
intl.formatMessage(exports.translationMessages.createInvoice_nextStep),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ImportDocumentValidationData, MessageOutput } from "@unimaze/api-clients/lib/mapi";
|
|
2
|
-
import { InvoiceMetadataInput, TransactionProcessingMode } from "@unimaze/api-clients/lib/mapi
|
|
2
|
+
import { InvoiceMetadataInput, TransactionProcessingMode } from "@unimaze/api-clients/lib/mapi";
|
|
3
3
|
import { AxiosPromise, CancelToken } from "axios";
|
|
4
4
|
import { LanguageProp } from "../common/types/CommonProps";
|
|
5
5
|
import { UploadFile } from "antd/es/upload/interface";
|
|
@@ -19,11 +19,12 @@ interface AttachDocument {
|
|
|
19
19
|
more: boolean;
|
|
20
20
|
}
|
|
21
21
|
declare const submitDocument: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey?: string) => AxiosPromise<MessageOutput>;
|
|
22
|
-
declare const submitDocumentFetch: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string,
|
|
23
|
-
declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string,
|
|
24
|
-
|
|
22
|
+
declare const submitDocumentFetch: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, token: string) => Promise<Response>;
|
|
23
|
+
declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, token: string, callName?: string, language?: LanguageProp) => AxiosPromise<ImportDocumentValidationData[] | MessageOutput>;
|
|
24
|
+
declare const getAuthToken: (rapiBaseUrl: string, entityIsoIdentifier: string) => AxiosPromise<string>;
|
|
25
|
+
declare const getCancelToken: (callName: string, showMessage?: boolean) => CancelToken;
|
|
25
26
|
declare const submitAttachmentIfAnyLeft: (_messageId: string, _attachments: {
|
|
26
27
|
description: string;
|
|
27
28
|
file: UploadFile;
|
|
28
|
-
}[], _mapiBaseUrl: string,
|
|
29
|
-
export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument, submitDocumentFetch, submitAttachmentIfAnyLeft };
|
|
29
|
+
}[], _mapiBaseUrl: string, token: string, intl: IntlShape) => void;
|
|
30
|
+
export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument, submitDocumentFetch, submitAttachmentIfAnyLeft, getAuthToken, getCancelToken };
|
package/lib/utils/ApiUtility.js
CHANGED
|
@@ -14,8 +14,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.getCancelToken = exports.getAuthToken = exports.submitAttachmentIfAnyLeft = exports.submitDocumentFetch = exports.submitDocument = exports.submitInvoice = void 0;
|
|
18
18
|
var api_clients_1 = require("@unimaze/api-clients");
|
|
19
|
+
var api_1 = require("@unimaze/api-clients/lib/rapi/api");
|
|
19
20
|
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
20
21
|
var axios_1 = __importDefault(require("axios"));
|
|
21
22
|
var antd_1 = require("antd");
|
|
@@ -34,6 +35,13 @@ var initialiseMessageApi = function (mapiBaseUrl) {
|
|
|
34
35
|
var initiatedConfig = new mapi_1.Configuration(apiConfig);
|
|
35
36
|
return new api_clients_1.mapi.MessageApi(initiatedConfig);
|
|
36
37
|
};
|
|
38
|
+
var initialiseRapiPortalApi = function (rapiBaseUrl) {
|
|
39
|
+
var apiConfig = {
|
|
40
|
+
basePath: rapiBaseUrl,
|
|
41
|
+
};
|
|
42
|
+
var initiatedConfig = new mapi_1.Configuration(apiConfig);
|
|
43
|
+
return new api_1.PortalApi(initiatedConfig);
|
|
44
|
+
};
|
|
37
45
|
var submitDocument = function (data, attachDocument, mapiBaseUrl, apiKey) {
|
|
38
46
|
var messageId = attachDocument.messageId, name = attachDocument.name, contentType = attachDocument.contentType, more = attachDocument.more;
|
|
39
47
|
var headers = __assign(__assign({}, (apiKey && { Authorization: "Bearer ".concat(window.btoa(apiKey)) })), { "Content-Type": "application/octet-stream", "X-test": "test" });
|
|
@@ -60,10 +68,10 @@ var submitDocument = function (data, attachDocument, mapiBaseUrl, apiKey) {
|
|
|
60
68
|
// )
|
|
61
69
|
};
|
|
62
70
|
exports.submitDocument = submitDocument;
|
|
63
|
-
var submitDocumentFetch = function (data, attachDocument, mapiBaseUrl,
|
|
71
|
+
var submitDocumentFetch = function (data, attachDocument, mapiBaseUrl, token) {
|
|
64
72
|
var messageId = attachDocument.messageId, name = attachDocument.name, contentType = attachDocument.contentType, more = attachDocument.more;
|
|
65
73
|
var headers = {
|
|
66
|
-
Authorization: "Bearer ".concat(
|
|
74
|
+
Authorization: "Bearer ".concat(token),
|
|
67
75
|
"Content-Type": "application/octet-stream",
|
|
68
76
|
"X-test": "test",
|
|
69
77
|
};
|
|
@@ -75,20 +83,25 @@ var submitDocumentFetch = function (data, attachDocument, mapiBaseUrl, apiKey) {
|
|
|
75
83
|
return responsePromise;
|
|
76
84
|
};
|
|
77
85
|
exports.submitDocumentFetch = submitDocumentFetch;
|
|
78
|
-
var submitInvoice = function (createSubmitInvoice, mapiBaseUrl,
|
|
86
|
+
var submitInvoice = function (createSubmitInvoice, mapiBaseUrl, token, callName, language) {
|
|
79
87
|
var transactionApi = initialiseTransactionApi(mapiBaseUrl);
|
|
80
88
|
var messageId = createSubmitInvoice.messageId, more = createSubmitInvoice.more, conversationIdentifier = createSubmitInvoice.conversationIdentifier, processingMode = createSubmitInvoice.processingMode, services = createSubmitInvoice.services, invoiceMetadataInput = createSubmitInvoice.invoiceMetadataInput;
|
|
81
|
-
return transactionApi.createSubmitInvoice(messageId, more, conversationIdentifier, processingMode, services, undefined, invoiceMetadataInput, createOptions(
|
|
89
|
+
return transactionApi.createSubmitInvoice(messageId, more, conversationIdentifier, processingMode, services, undefined, invoiceMetadataInput, createOptions(token, callName, language));
|
|
82
90
|
};
|
|
83
91
|
exports.submitInvoice = submitInvoice;
|
|
92
|
+
var getAuthToken = function (rapiBaseUrl, entityIsoIdentifier) {
|
|
93
|
+
var portalApi = initialiseRapiPortalApi(rapiBaseUrl);
|
|
94
|
+
return portalApi.supplierPortalAuthenticate(entityIsoIdentifier);
|
|
95
|
+
};
|
|
96
|
+
exports.getAuthToken = getAuthToken;
|
|
84
97
|
var createOptions = function (apiKey, callName, language) {
|
|
85
98
|
return __assign({ headers: {
|
|
86
99
|
"Accept-Language": language ? language : "en",
|
|
87
|
-
Authorization: "Bearer ".concat(
|
|
88
|
-
} }, (callName && { cancelToken:
|
|
100
|
+
Authorization: "Bearer ".concat(apiKey)
|
|
101
|
+
} }, (callName && { cancelToken: getCancelToken(callName) }));
|
|
89
102
|
};
|
|
90
103
|
var createOptionsData = function (data, apiKey, callName, language) {
|
|
91
|
-
var options = __assign(__assign({}, (callName && { cancelToken:
|
|
104
|
+
var options = __assign(__assign({}, (callName && { cancelToken: getCancelToken(callName) })), { data: data, headers: {
|
|
92
105
|
"Accept-Language": language ? language : "en",
|
|
93
106
|
Authorization: "Bearer ".concat(window.btoa(apiKey)),
|
|
94
107
|
"Content-Type": "application/octet-stream"
|
|
@@ -105,7 +118,7 @@ var getCancelToken = function (callName, showMessage) {
|
|
|
105
118
|
return window[callName].token;
|
|
106
119
|
};
|
|
107
120
|
exports.getCancelToken = getCancelToken;
|
|
108
|
-
var submitAttachmentIfAnyLeft = function (_messageId, _attachments, _mapiBaseUrl,
|
|
121
|
+
var submitAttachmentIfAnyLeft = function (_messageId, _attachments, _mapiBaseUrl, token, intl) {
|
|
109
122
|
if (_attachments && _attachments.length > 0) {
|
|
110
123
|
var nextFileArray = _attachments.splice(0, 1);
|
|
111
124
|
var nextFile = nextFileArray[0].file.originFileObj;
|
|
@@ -118,10 +131,10 @@ var submitAttachmentIfAnyLeft = function (_messageId, _attachments, _mapiBaseUrl
|
|
|
118
131
|
more: _attachments.length > 0,
|
|
119
132
|
name: nextFileDescription_1, // nextFile.name,
|
|
120
133
|
};
|
|
121
|
-
submitDocumentFetch(nextFile, createAttachDocument, _mapiBaseUrl,
|
|
134
|
+
submitDocumentFetch(nextFile, createAttachDocument, _mapiBaseUrl, token)
|
|
122
135
|
.then(function (submitDocumentResponse) {
|
|
123
136
|
antd_1.message.success(intl.formatMessage(create_invoice_1.translationMessages.createInvoice_successfullyUploadedAttachmentMsg, { attachment: nextFileDescription_1 }));
|
|
124
|
-
submitAttachmentIfAnyLeft(_messageId, _attachments, _mapiBaseUrl,
|
|
137
|
+
submitAttachmentIfAnyLeft(_messageId, _attachments, _mapiBaseUrl, token, intl);
|
|
125
138
|
})
|
|
126
139
|
.catch(function (documentSendingErrorMessage) {
|
|
127
140
|
antd_1.message.error("".concat(intl.formatMessage(create_invoice_1.translationMessages.createInvoice_ErrorUploadedAttachmentMsg, {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BillingLineMetadata, InvoiceMetadataInput, PartyMetadata } from "@unimaze/api-clients/lib/mapi";
|
|
2
2
|
import { Store } from "antd/es/form/interface";
|
|
3
|
-
import {
|
|
3
|
+
import { PortalConfigurationCustomer } from "@unimaze/api-clients/lib/rapi";
|
|
4
4
|
import { PaymentMeansMetadata } from "@unimaze/api-clients/lib/mapi/api";
|
|
5
5
|
export declare const removeEmpty: (obj: any) => any;
|
|
6
6
|
declare const convertToInvoiceMetadataInput: (formValues: Store, invoiceLinesWithCalculations: BillingLineMetadata[], paymentMethod: PaymentMeansMetadata, chosenCustomer: PartyMetadata) => InvoiceMetadataInput;
|
|
7
|
-
declare const profileOutputToPartyMetadata: (
|
|
7
|
+
declare const profileOutputToPartyMetadata: (customer: PortalConfigurationCustomer) => PartyMetadata;
|
|
8
8
|
declare const convertToReadableKennitala: (isoIdentifier: string) => string;
|
|
9
9
|
export { convertToInvoiceMetadataInput, profileOutputToPartyMetadata, convertToReadableKennitala };
|
|
@@ -63,6 +63,7 @@ var cleanIdentifier = function (identifier) {
|
|
|
63
63
|
return identifier.replace("-", ""); // remove the '-'
|
|
64
64
|
};
|
|
65
65
|
var convertToInvoiceMetadataInput = function (formValues, invoiceLinesWithCalculations, paymentMethod, chosenCustomer) {
|
|
66
|
+
var _a, _b, _c;
|
|
66
67
|
var issueDate = convertDates(formValues.invoice.issueDate);
|
|
67
68
|
var dueDate = convertDates(formValues.invoice.dueDate);
|
|
68
69
|
var referenceIdentifiersArray = formValues.invoice && formValues.invoice.singleReferenceIdentifier && formValues.invoice.singleReferenceIdentifier.code && formValues.invoice.singleReferenceIdentifier.value
|
|
@@ -144,9 +145,9 @@ var convertToInvoiceMetadataInput = function (formValues, invoiceLinesWithCalcul
|
|
|
144
145
|
contact: {
|
|
145
146
|
electronicMail: chosenCustomer.contact.electronicMail,
|
|
146
147
|
telephone: chosenCustomer.contact.telephone,
|
|
147
|
-
name: invoice
|
|
148
|
+
name: (_b = (_a = invoice === null || invoice === void 0 ? void 0 : invoice.customer) === null || _a === void 0 ? void 0 : _a.contact) === null || _b === void 0 ? void 0 : _b.name,
|
|
148
149
|
},
|
|
149
|
-
locationIdentifier: invoice.customer.locationIdentifier,
|
|
150
|
+
locationIdentifier: (_c = invoice === null || invoice === void 0 ? void 0 : invoice.customer) === null || _c === void 0 ? void 0 : _c.locationIdentifier,
|
|
150
151
|
},
|
|
151
152
|
supplier: {
|
|
152
153
|
identifier: getIdentifierWithPrefix(invoice.supplier.identifier),
|
|
@@ -194,24 +195,25 @@ var convertToInvoiceMetadataInput = function (formValues, invoiceLinesWithCalcul
|
|
|
194
195
|
return resp;
|
|
195
196
|
};
|
|
196
197
|
exports.convertToInvoiceMetadataInput = convertToInvoiceMetadataInput;
|
|
197
|
-
var profileOutputToPartyMetadata = function (
|
|
198
|
-
|
|
198
|
+
var profileOutputToPartyMetadata = function (customer) {
|
|
199
|
+
var _a, _b, _c, _d, _e, _f;
|
|
200
|
+
if (!(customer === null || customer === void 0 ? void 0 : customer.isoIdentifier) || !((_a = customer === null || customer === void 0 ? void 0 : customer.address) === null || _a === void 0 ? void 0 : _a.street) || !(customer === null || customer === void 0 ? void 0 : customer.name) || !((_b = customer === null || customer === void 0 ? void 0 : customer.address) === null || _b === void 0 ? void 0 : _b.country)) {
|
|
199
201
|
var errorMessage = "There was an error with the customer information, please check the application configuration";
|
|
200
202
|
antd_1.message.error(errorMessage);
|
|
201
203
|
throw new Error(errorMessage);
|
|
202
204
|
}
|
|
203
205
|
return {
|
|
204
|
-
identifier:
|
|
206
|
+
identifier: customer.isoIdentifier,
|
|
205
207
|
address: {
|
|
206
|
-
streetNameAndNumber:
|
|
207
|
-
city:
|
|
208
|
-
countryCode:
|
|
209
|
-
postalZone:
|
|
208
|
+
streetNameAndNumber: (_c = customer.address) === null || _c === void 0 ? void 0 : _c.street,
|
|
209
|
+
city: (_d = customer.address) === null || _d === void 0 ? void 0 : _d.city,
|
|
210
|
+
countryCode: (_e = customer.address) === null || _e === void 0 ? void 0 : _e.country,
|
|
211
|
+
postalZone: (_f = customer.address) === null || _f === void 0 ? void 0 : _f.postalCode
|
|
210
212
|
},
|
|
211
|
-
name:
|
|
213
|
+
name: customer.name,
|
|
212
214
|
contact: {
|
|
213
|
-
electronicMail:
|
|
214
|
-
telephone:
|
|
215
|
+
electronicMail: customer.email,
|
|
216
|
+
telephone: customer.phoneNumber
|
|
215
217
|
}
|
|
216
218
|
};
|
|
217
219
|
};
|
|
@@ -13,12 +13,13 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.getReferenceIdentifierFieldDefinitions = exports.getReferenceIdentifierOptions = void 0;
|
|
15
15
|
var getReferenceIdentifierFieldDefinitions = function (receiverRequirements) {
|
|
16
|
-
|
|
16
|
+
var _a;
|
|
17
|
+
return receiverRequirements ? (_a = receiverRequirements === null || receiverRequirements === void 0 ? void 0 : receiverRequirements.fieldDefinitions) === null || _a === void 0 ? void 0 : _a.filter(function (fieldRequirement) { return fieldRequirement.key.startsWith("referenceIdentifier"); }) : [];
|
|
17
18
|
};
|
|
18
19
|
exports.getReferenceIdentifierFieldDefinitions = getReferenceIdentifierFieldDefinitions;
|
|
19
20
|
var getReferenceIdentifierOptions = function (receiverRequirements) {
|
|
20
21
|
var referenceIdentifierFieldDefinitions = getReferenceIdentifierFieldDefinitions(receiverRequirements);
|
|
21
|
-
return referenceIdentifierFieldDefinitions.map(function (fieldDefinition) {
|
|
22
|
+
return referenceIdentifierFieldDefinitions === null || referenceIdentifierFieldDefinitions === void 0 ? void 0 : referenceIdentifierFieldDefinitions.map(function (fieldDefinition) {
|
|
22
23
|
var delimiterIndex = fieldDefinition.key.indexOf(".");
|
|
23
24
|
return __assign(__assign({}, fieldDefinition), { key: fieldDefinition.key.substring(delimiterIndex + 1), originalKey: fieldDefinition.key });
|
|
24
25
|
});
|
|
@@ -28,8 +28,8 @@ var react_1 = __importDefault(require("react"));
|
|
|
28
28
|
var ReceiverRequirements_1 = require("../common/types/ReceiverRequirements");
|
|
29
29
|
var lodash_1 = require("lodash");
|
|
30
30
|
var axios_1 = __importDefault(require("axios"));
|
|
31
|
-
var ApiUtility_1 = require("./ApiUtility");
|
|
32
31
|
var antd_1 = require("antd");
|
|
32
|
+
var ApiUtility_1 = require("./ApiUtility");
|
|
33
33
|
var NewBillingLines_1 = require("../common/components/billing-lines/NewBillingLines");
|
|
34
34
|
// export const getReceiverRequirements = (recRequirements: ReceiverRequirements, key: AvailableFields): FieldRequirement => {
|
|
35
35
|
// return recRequirements[key]!;
|
|
@@ -55,10 +55,11 @@ var NewBillingLines_1 = require("../common/components/billing-lines/NewBillingLi
|
|
|
55
55
|
// return defaultLabel;
|
|
56
56
|
// };
|
|
57
57
|
var getFieldRequirements = function (receiverRequirements, key) {
|
|
58
|
+
var _a;
|
|
58
59
|
if (key === ReceiverRequirements_1.AvailableFields["referenceIdentifier.*"]) {
|
|
59
60
|
return receiverRequirements ? receiverRequirements.fieldDefinitions.find(function (field) { return field.key.startsWith("referenceIdentifier."); }) : undefined;
|
|
60
61
|
}
|
|
61
|
-
return receiverRequirements ? receiverRequirements.fieldDefinitions.find(function (field) { return field.key === key; }) : undefined;
|
|
62
|
+
return (receiverRequirements === null || receiverRequirements === void 0 ? void 0 : receiverRequirements.fieldDefinitions) ? (_a = receiverRequirements === null || receiverRequirements === void 0 ? void 0 : receiverRequirements.fieldDefinitions) === null || _a === void 0 ? void 0 : _a.find(function (field) { return field.key === key; }) : undefined;
|
|
62
63
|
};
|
|
63
64
|
exports.getFieldRequirements = getFieldRequirements;
|
|
64
65
|
var getFieldLabelOverride = function (receiverRequirements, key, defaultLabel) {
|