@unimaze/billing 0.21.52 → 0.21.54

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.
Files changed (186) hide show
  1. package/lib/create-invoice/index.js +13 -5
  2. package/package.json +2 -10
  3. package/lib/common/components/billing-lines/NewNewBillingLines.d.ts +0 -15
  4. package/lib/common/components/billing-lines/NewNewBillingLines.js +0 -36
  5. package/lib/common/components/billing-lines/cwdwdw.d.ts +0 -1
  6. package/lib/common/components/billing-lines/cwdwdw.js +0 -14
  7. package/lib/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.d.ts +0 -0
  8. package/lib/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.js +0 -109
  9. package/lib/common/components/invoice-preview/InvoicePreviewPaymentInfo.d.ts +0 -0
  10. package/lib/common/components/invoice-preview/InvoicePreviewPaymentInfo.js +0 -110
  11. package/lib/unimaze-api-clients/src/mapi/api.d.ts +0 -6664
  12. package/lib/unimaze-api-clients/src/mapi/api.js +0 -4743
  13. package/lib/unimaze-api-clients/src/mapi/base.d.ts +0 -55
  14. package/lib/unimaze-api-clients/src/mapi/base.js +0 -84
  15. package/lib/unimaze-api-clients/src/mapi/configuration.d.ts +0 -63
  16. package/lib/unimaze-api-clients/src/mapi/configuration.js +0 -28
  17. package/lib/unimaze-api-clients/src/mapi/index.d.ts +0 -13
  18. package/lib/unimaze-api-clients/src/mapi/index.js +0 -30
  19. package/lib/unimaze-api-clients/src/rapi/api.d.ts +0 -5015
  20. package/lib/unimaze-api-clients/src/rapi/api.js +0 -5582
  21. package/lib/unimaze-api-clients/src/rapi/base.d.ts +0 -55
  22. package/lib/unimaze-api-clients/src/rapi/base.js +0 -84
  23. package/lib/unimaze-api-clients/src/rapi/configuration.d.ts +0 -63
  24. package/lib/unimaze-api-clients/src/rapi/configuration.js +0 -28
  25. package/lib/unimaze-api-clients/src/rapi/index.d.ts +0 -13
  26. package/lib/unimaze-api-clients/src/rapi/index.js +0 -30
  27. package/lib/unimaze-billing/src/common/components/CommonTranslations.d.ts +0 -74
  28. package/lib/unimaze-billing/src/common/components/CommonTranslations.js +0 -78
  29. package/lib/unimaze-billing/src/common/components/attachments/Attachment.d.ts +0 -20
  30. package/lib/unimaze-billing/src/common/components/attachments/Attachment.js +0 -164
  31. package/lib/unimaze-billing/src/common/components/attachments/AttachmentModal.d.ts +0 -21
  32. package/lib/unimaze-billing/src/common/components/attachments/AttachmentModal.js +0 -206
  33. package/lib/unimaze-billing/src/common/components/attachments/index.d.ts +0 -27
  34. package/lib/unimaze-billing/src/common/components/attachments/index.js +0 -214
  35. package/lib/unimaze-billing/src/common/components/base-information/AccountingCost.d.ts +0 -17
  36. package/lib/unimaze-billing/src/common/components/base-information/AccountingCost.js +0 -61
  37. package/lib/unimaze-billing/src/common/components/base-information/OrderReference.d.ts +0 -16
  38. package/lib/unimaze-billing/src/common/components/base-information/OrderReference.js +0 -58
  39. package/lib/unimaze-billing/src/common/components/base-information/ProjectReference.d.ts +0 -14
  40. package/lib/unimaze-billing/src/common/components/base-information/ProjectReference.js +0 -30
  41. package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.d.ts +0 -53
  42. package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.js +0 -328
  43. package/lib/unimaze-billing/src/common/components/base-information/index.d.ts +0 -77
  44. package/lib/unimaze-billing/src/common/components/base-information/index.js +0 -186
  45. package/lib/unimaze-billing/src/common/components/billing-lines/BillingCalculations.d.ts +0 -14
  46. package/lib/unimaze-billing/src/common/components/billing-lines/BillingCalculations.js +0 -151
  47. package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.d.ts +0 -24
  48. package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.js +0 -61
  49. package/lib/unimaze-billing/src/common/components/billing-lines/BillingTaxSummary.d.ts +0 -13
  50. package/lib/unimaze-billing/src/common/components/billing-lines/BillingTaxSummary.js +0 -133
  51. package/lib/unimaze-billing/src/common/components/billing-lines/CurrencySelector.d.ts +0 -20
  52. package/lib/unimaze-billing/src/common/components/billing-lines/CurrencySelector.js +0 -17
  53. package/lib/unimaze-billing/src/common/components/billing-lines/DiscountTypeSelector.d.ts +0 -10
  54. package/lib/unimaze-billing/src/common/components/billing-lines/DiscountTypeSelector.js +0 -16
  55. package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.d.ts +0 -134
  56. package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.js +0 -209
  57. package/lib/unimaze-billing/src/common/components/billing-lines/NewNewBillingLines.d.ts +0 -15
  58. package/lib/unimaze-billing/src/common/components/billing-lines/NewNewBillingLines.js +0 -36
  59. package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.d.ts +0 -19
  60. package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.js +0 -275
  61. package/lib/unimaze-billing/src/common/components/billing-lines/UnitOfMeasureSelector.d.ts +0 -14
  62. package/lib/unimaze-billing/src/common/components/billing-lines/UnitOfMeasureSelector.js +0 -15
  63. package/lib/unimaze-billing/src/common/components/billing-lines/index.d.ts +0 -49
  64. package/lib/unimaze-billing/src/common/components/billing-lines/index.js +0 -104
  65. package/lib/unimaze-billing/src/common/components/component-container/Content.d.ts +0 -7
  66. package/lib/unimaze-billing/src/common/components/component-container/Content.js +0 -13
  67. package/lib/unimaze-billing/src/common/components/component-container/Header.d.ts +0 -9
  68. package/lib/unimaze-billing/src/common/components/component-container/Header.js +0 -28
  69. package/lib/unimaze-billing/src/common/components/component-container/index.d.ts +0 -12
  70. package/lib/unimaze-billing/src/common/components/component-container/index.js +0 -22
  71. package/lib/unimaze-billing/src/common/components/customer/CostCenter.d.ts +0 -17
  72. package/lib/unimaze-billing/src/common/components/customer/CostCenter.js +0 -163
  73. package/lib/unimaze-billing/src/common/components/customer/CustomerContactName.d.ts +0 -17
  74. package/lib/unimaze-billing/src/common/components/customer/CustomerContactName.js +0 -53
  75. package/lib/unimaze-billing/src/common/components/customer/hardCoddedCustomer.d.ts +0 -7
  76. package/lib/unimaze-billing/src/common/components/customer/hardCoddedCustomer.js +0 -41
  77. package/lib/unimaze-billing/src/common/components/customer/index.d.ts +0 -26
  78. package/lib/unimaze-billing/src/common/components/customer/index.js +0 -166
  79. package/lib/unimaze-billing/src/common/components/date-picker/index.d.ts +0 -21
  80. package/lib/unimaze-billing/src/common/components/date-picker/index.js +0 -23
  81. package/lib/unimaze-billing/src/common/components/delivery-location/index.d.ts +0 -12
  82. package/lib/unimaze-billing/src/common/components/delivery-location/index.js +0 -89
  83. package/lib/unimaze-billing/src/common/components/editable-cell/index.d.ts +0 -0
  84. package/lib/unimaze-billing/src/common/components/editable-cell/index.js +0 -295
  85. package/lib/unimaze-billing/src/common/components/editable-row/index.d.ts +0 -5
  86. package/lib/unimaze-billing/src/common/components/editable-row/index.js +0 -59
  87. package/lib/unimaze-billing/src/common/components/form-item/index.d.ts +0 -35
  88. package/lib/unimaze-billing/src/common/components/form-item/index.js +0 -60
  89. package/lib/unimaze-billing/src/common/components/index.d.ts +0 -18
  90. package/lib/unimaze-billing/src/common/components/index.js +0 -42
  91. package/lib/unimaze-billing/src/common/components/input/index.d.ts +0 -23
  92. package/lib/unimaze-billing/src/common/components/input/index.js +0 -37
  93. package/lib/unimaze-billing/src/common/components/invoice/index.d.ts +0 -42
  94. package/lib/unimaze-billing/src/common/components/invoice/index.js +0 -59
  95. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.d.ts +0 -14
  96. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.js +0 -75
  97. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfoBox.d.ts +0 -14
  98. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfoBox.js +0 -73
  99. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewHeader.d.ts +0 -12
  100. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewHeader.js +0 -104
  101. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewInvoiceLines.d.ts +0 -12
  102. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewInvoiceLines.js +0 -93
  103. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfo.d.ts +0 -14
  104. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfo.js +0 -77
  105. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfoBox.d.ts +0 -14
  106. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfoBox.js +0 -58
  107. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewTotalAmountPreview.d.ts +0 -14
  108. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewTotalAmountPreview.js +0 -52
  109. package/lib/unimaze-billing/src/common/components/invoice-preview/index.d.ts +0 -102
  110. package/lib/unimaze-billing/src/common/components/invoice-preview/index.js +0 -196
  111. package/lib/unimaze-billing/src/common/components/locale-intl/index.d.ts +0 -0
  112. package/lib/unimaze-billing/src/common/components/locale-intl/index.js +0 -51
  113. package/lib/unimaze-billing/src/common/components/payment-method/index.d.ts +0 -76
  114. package/lib/unimaze-billing/src/common/components/payment-method/index.js +0 -356
  115. package/lib/unimaze-billing/src/common/components/payment-method/paymentMethodForConversion.d.ts +0 -8
  116. package/lib/unimaze-billing/src/common/components/payment-method/paymentMethodForConversion.js +0 -37
  117. package/lib/unimaze-billing/src/common/components/submit-confirmation/SubmitConfirmationSVG.d.ts +0 -3
  118. package/lib/unimaze-billing/src/common/components/submit-confirmation/SubmitConfirmationSVG.js +0 -17
  119. package/lib/unimaze-billing/src/common/components/submit-confirmation/index.d.ts +0 -8
  120. package/lib/unimaze-billing/src/common/components/submit-confirmation/index.js +0 -34
  121. package/lib/unimaze-billing/src/common/components/supplier/CityAutofill.d.ts +0 -18
  122. package/lib/unimaze-billing/src/common/components/supplier/CityAutofill.js +0 -159
  123. package/lib/unimaze-billing/src/common/components/supplier/index.d.ts +0 -94
  124. package/lib/unimaze-billing/src/common/components/supplier/index.js +0 -334
  125. package/lib/unimaze-billing/src/common/components/tooltip/index.d.ts +0 -7
  126. package/lib/unimaze-billing/src/common/components/tooltip/index.js +0 -15
  127. package/lib/unimaze-billing/src/common/components/welcome-modal/index.d.ts +0 -15
  128. package/lib/unimaze-billing/src/common/components/welcome-modal/index.js +0 -26
  129. package/lib/unimaze-billing/src/common/consts/formLayout.d.ts +0 -74
  130. package/lib/unimaze-billing/src/common/consts/formLayout.js +0 -45
  131. package/lib/unimaze-billing/src/common/consts/validationRules.d.ts +0 -6
  132. package/lib/unimaze-billing/src/common/consts/validationRules.js +0 -69
  133. package/lib/unimaze-billing/src/common/enums/DocumentTypeEnum.d.ts +0 -5
  134. package/lib/unimaze-billing/src/common/enums/DocumentTypeEnum.js +0 -8
  135. package/lib/unimaze-billing/src/common/enums/index.d.ts +0 -1
  136. package/lib/unimaze-billing/src/common/enums/index.js +0 -8
  137. package/lib/unimaze-billing/src/common/types/AppConfiguration.d.ts +0 -26
  138. package/lib/unimaze-billing/src/common/types/AppConfiguration.js +0 -2
  139. package/lib/unimaze-billing/src/common/types/BillingLineMetadataOverride.d.ts +0 -10
  140. package/lib/unimaze-billing/src/common/types/BillingLineMetadataOverride.js +0 -2
  141. package/lib/unimaze-billing/src/common/types/CommonProps.d.ts +0 -33
  142. package/lib/unimaze-billing/src/common/types/CommonProps.js +0 -2
  143. package/lib/unimaze-billing/src/common/types/DiscountType.d.ts +0 -1
  144. package/lib/unimaze-billing/src/common/types/DiscountType.js +0 -2
  145. package/lib/unimaze-billing/src/common/types/InvoiceFormFields.d.ts +0 -1
  146. package/lib/unimaze-billing/src/common/types/InvoiceFormFields.js +0 -2
  147. package/lib/unimaze-billing/src/common/types/NewReceiverRequirements.d.ts +0 -27
  148. package/lib/unimaze-billing/src/common/types/NewReceiverRequirements.js +0 -2
  149. package/lib/unimaze-billing/src/common/types/ReceiverRequirements.d.ts +0 -83
  150. package/lib/unimaze-billing/src/common/types/ReceiverRequirements.js +0 -393
  151. package/lib/unimaze-billing/src/common/types/SupplierInfo.d.ts +0 -11
  152. package/lib/unimaze-billing/src/common/types/SupplierInfo.js +0 -2
  153. package/lib/unimaze-billing/src/common/types/index.d.ts +0 -1
  154. package/lib/unimaze-billing/src/common/types/index.js +0 -17
  155. package/lib/unimaze-billing/src/create-credit-note/index.d.ts +0 -9
  156. package/lib/unimaze-billing/src/create-credit-note/index.js +0 -62
  157. package/lib/unimaze-billing/src/create-invoice/IntlLoader.d.ts +0 -11
  158. package/lib/unimaze-billing/src/create-invoice/IntlLoader.js +0 -116
  159. package/lib/unimaze-billing/src/create-invoice/index.d.ts +0 -82
  160. package/lib/unimaze-billing/src/create-invoice/index.js +0 -710
  161. package/lib/unimaze-billing/src/enums.d.ts +0 -14
  162. package/lib/unimaze-billing/src/enums.js +0 -18
  163. package/lib/unimaze-billing/src/index.d.ts +0 -4
  164. package/lib/unimaze-billing/src/index.js +0 -28
  165. package/lib/unimaze-billing/src/translations/locales/en.json +0 -183
  166. package/lib/unimaze-billing/src/translations/locales/is.json +0 -183
  167. package/lib/unimaze-billing/src/translations/locales.d.ts +0 -369
  168. package/lib/unimaze-billing/src/translations/locales.js +0 -11
  169. package/lib/unimaze-billing/src/utils/ApiUtility.d.ts +0 -29
  170. package/lib/unimaze-billing/src/utils/ApiUtility.js +0 -133
  171. package/lib/unimaze-billing/src/utils/BillingLineUtility.d.ts +0 -25
  172. package/lib/unimaze-billing/src/utils/BillingLineUtility.js +0 -190
  173. package/lib/unimaze-billing/src/utils/ConversionUtility.d.ts +0 -9
  174. package/lib/unimaze-billing/src/utils/ConversionUtility.js +0 -222
  175. package/lib/unimaze-billing/src/utils/FileUploadUtility.d.ts +0 -9
  176. package/lib/unimaze-billing/src/utils/FileUploadUtility.js +0 -45
  177. package/lib/unimaze-billing/src/utils/IntlUtility.d.ts +0 -6
  178. package/lib/unimaze-billing/src/utils/IntlUtility.js +0 -78
  179. package/lib/unimaze-billing/src/utils/LocationUtility.d.ts +0 -1
  180. package/lib/unimaze-billing/src/utils/LocationUtility.js +0 -81
  181. package/lib/unimaze-billing/src/utils/ReferenceIdentifierUtility.d.ts +0 -7
  182. package/lib/unimaze-billing/src/utils/ReferenceIdentifierUtility.js +0 -26
  183. package/lib/unimaze-billing/src/utils/RequirementsUtility.d.ts +0 -21
  184. package/lib/unimaze-billing/src/utils/RequirementsUtility.js +0 -237
  185. package/lib/unimaze-billing/src/utils/index.d.ts +0 -2
  186. package/lib/unimaze-billing/src/utils/index.js +0 -8
@@ -1,26 +0,0 @@
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.getReferenceIdentifierFieldDefinitions = exports.getReferenceIdentifierOptions = void 0;
15
- var getReferenceIdentifierFieldDefinitions = function (receiverRequirements) {
16
- return receiverRequirements ? receiverRequirements.fieldDefinitions.filter(function (fieldRequirement) { return fieldRequirement.key.startsWith("referenceIdentifier"); }) : [];
17
- };
18
- exports.getReferenceIdentifierFieldDefinitions = getReferenceIdentifierFieldDefinitions;
19
- var getReferenceIdentifierOptions = function (receiverRequirements) {
20
- var referenceIdentifierFieldDefinitions = getReferenceIdentifierFieldDefinitions(receiverRequirements);
21
- return referenceIdentifierFieldDefinitions.map(function (fieldDefinition) {
22
- var delimiterIndex = fieldDefinition.key.indexOf(".");
23
- return __assign(__assign({}, fieldDefinition), { key: fieldDefinition.key.substring(delimiterIndex + 1), originalKey: fieldDefinition.key });
24
- });
25
- };
26
- exports.getReferenceIdentifierOptions = getReferenceIdentifierOptions;
@@ -1,21 +0,0 @@
1
- /// <reference types="lodash" />
2
- import React from 'react';
3
- import { AvailableFields } from "../common/types/ReceiverRequirements";
4
- import { FieldDefinition, FieldValues, NewReceiverRequirements } from "../common/types/NewReceiverRequirements";
5
- import { FormItemProps, ValidateStatus } from "antd/lib/form/FormItem";
6
- import { NamePath } from "rc-field-form/es/interface";
7
- import { FormInstance } from "antd/es/form";
8
- import { IntlShape } from "react-intl";
9
- export declare const getFieldRequirements: (receiverRequirements: NewReceiverRequirements, key: AvailableFields) => FieldDefinition | undefined;
10
- export declare const getFieldLabelOverride: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultLabel: string) => string | undefined;
11
- export declare const getFieldLabelTooltipOverride: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultLabelTooltip: React.ReactNode | string) => React.ReactNode | string | undefined;
12
- export declare const getFieldPlaceholderOverride: (fieldRequirement: FieldDefinition, defaultPlaceholder?: string) => string;
13
- export declare const getFieldIsRequired: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultIsRequired: boolean) => boolean;
14
- export interface FormItemPropsWithoutChildren extends Omit<FormItemProps, "children"> {
15
- }
16
- export declare const handleValueValidation: import("lodash").DebouncedFunc<(isoNumber: string, fieldName: string, value: string, rapiBaseUrl: string, namePath: NamePath, setValidationStatus: (validationStatus: ValidateStatus) => void, formInstance: FormInstance, callName: string) => void>;
17
- export declare const debouncedHandleSearchValues: import("lodash").DebouncedFunc<(searchValue: string, fieldDefinition: FieldDefinition, setLoadingValues: (loadingValues: boolean) => void, loadingValues: boolean, receiverRequirements: NewReceiverRequirements, updateReceiverRequirementsProp: (newReceiverRequirements: NewReceiverRequirements) => void, callName: string, rapiBaseUrl: string, overwrittenFieldDefinitionKey?: string) => void>;
18
- export declare const getInput: (fieldDefinition: FieldDefinition, namePath: NamePath, validationCallName: string, legalIdentifier: string, formInstance: FormInstance, rapiBaseUrl: string, receiverRequirements: NewReceiverRequirements, updateReceiverRequirementsProp: (receiverRequirements: NewReceiverRequirements) => void, setAccountingCostFieldProps: (accountingCostFiledProps: FormItemPropsWithoutChildren) => void, accountingCostFieldProps: FormItemPropsWithoutChildren, setLoadingAccountingCostValues: (loadingAccountingCostValues: boolean) => void, loadingAccountingCostValues: boolean, setHandlingValidationStatus: (handlingValidationStatus: ValidateStatus) => void, defaultPlaceholder: string, allowClearSelect?: boolean) => React.ReactNode;
19
- export declare const getRequiredTooltipMessage: (title: string, fieldNames: string[]) => React.ReactNode;
20
- export declare const paymentMeansTypeFieldHasValues: (paymentMeansTypeFieldDefinition: FieldDefinition | undefined) => boolean | undefined;
21
- export declare const getCurrencies: (recRequirements: NewReceiverRequirements, intl: IntlShape) => FieldValues[];
@@ -1,237 +0,0 @@
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
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
- if (ar || !(i in from)) {
16
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
- ar[i] = from[i];
18
- }
19
- }
20
- return to.concat(ar || Array.prototype.slice.call(from));
21
- };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getCurrencies = exports.paymentMeansTypeFieldHasValues = exports.getRequiredTooltipMessage = exports.getInput = exports.debouncedHandleSearchValues = exports.handleValueValidation = exports.getFieldIsRequired = exports.getFieldPlaceholderOverride = exports.getFieldLabelTooltipOverride = exports.getFieldLabelOverride = exports.getFieldRequirements = void 0;
27
- var react_1 = __importDefault(require("react"));
28
- var ReceiverRequirements_1 = require("../common/types/ReceiverRequirements");
29
- var lodash_1 = require("lodash");
30
- var axios_1 = __importDefault(require("axios"));
31
- var ApiUtility_1 = require("./ApiUtility");
32
- var antd_1 = require("antd");
33
- var NewBillingLines_1 = require("../common/components/billing-lines/NewBillingLines");
34
- // export const getReceiverRequirements = (recRequirements: ReceiverRequirements, key: AvailableFields): FieldRequirement => {
35
- // return recRequirements[key]!;
36
- // };
37
- //
38
- // export const getReceiverRequirementsIsRequired = (recRequirements: ReceiverRequirements, key: AvailableFields, defaultIsRequired: boolean): boolean => {
39
- // if (recRequirements.hasOwnProperty(key)) {
40
- // const recRequirement = recRequirements[key];
41
- // if (recRequirement) {
42
- // return recRequirement.isRequired
43
- // }
44
- // }
45
- // return defaultIsRequired;
46
- // };
47
- //
48
- // export const getReceiverRequirementsLabelWithDefault = (recRequirements: ReceiverRequirements, key: AvailableFields, defaultLabel: React.ReactNode): React.ReactNode => {
49
- // if (recRequirements.hasOwnProperty(key)) {
50
- // const recRequirement = recRequirements[key];
51
- // if (recRequirement && recRequirement.label) {
52
- // return recRequirement.label
53
- // }
54
- // }
55
- // return defaultLabel;
56
- // };
57
- var getFieldRequirements = function (receiverRequirements, key) {
58
- if (key === ReceiverRequirements_1.AvailableFields["referenceIdentifier.*"]) {
59
- return receiverRequirements ? receiverRequirements.fieldDefinitions.find(function (field) { return field.key.startsWith("referenceIdentifier."); }) : undefined;
60
- }
61
- return receiverRequirements ? receiverRequirements.fieldDefinitions.find(function (field) { return field.key === key; }) : undefined;
62
- };
63
- exports.getFieldRequirements = getFieldRequirements;
64
- var getFieldLabelOverride = function (receiverRequirements, key, defaultLabel) {
65
- var fieldRequirement = (0, exports.getFieldRequirements)(receiverRequirements, key);
66
- return fieldRequirement && fieldRequirement.properties.hasOwnProperty("label") ? fieldRequirement.properties.label : defaultLabel;
67
- };
68
- exports.getFieldLabelOverride = getFieldLabelOverride;
69
- var getFieldLabelTooltipOverride = function (receiverRequirements, key, defaultLabelTooltip) {
70
- var fieldRequirement = (0, exports.getFieldRequirements)(receiverRequirements, key);
71
- if (fieldRequirement && fieldRequirement.properties.hasOwnProperty("handling")) {
72
- if (fieldRequirement.properties.handling) {
73
- var handling = JSON.parse(fieldRequirement.properties.handling);
74
- return handling.helpText ? handling.helpText : defaultLabelTooltip;
75
- }
76
- else
77
- return defaultLabelTooltip;
78
- }
79
- else {
80
- return defaultLabelTooltip;
81
- }
82
- };
83
- exports.getFieldLabelTooltipOverride = getFieldLabelTooltipOverride;
84
- var getFieldPlaceholderOverride = function (fieldRequirement, defaultPlaceholder) {
85
- if (fieldRequirement.properties.handling) {
86
- var handling = JSON.parse(fieldRequirement.properties.handling);
87
- return handling.placeholder ? handling.placeholder : defaultPlaceholder;
88
- }
89
- return defaultPlaceholder ? defaultPlaceholder : "";
90
- };
91
- exports.getFieldPlaceholderOverride = getFieldPlaceholderOverride;
92
- var getFieldIsRequired = function (receiverRequirements, key, defaultIsRequired) {
93
- var fieldRequirement = (0, exports.getFieldRequirements)(receiverRequirements, key);
94
- var fieldCardinality = fieldRequirement && fieldRequirement.properties.hasOwnProperty("cardinality") && fieldRequirement.properties.cardinality;
95
- return fieldCardinality ? cardinalityToRequired(fieldCardinality) || defaultIsRequired : defaultIsRequired;
96
- };
97
- exports.getFieldIsRequired = getFieldIsRequired;
98
- var cardinalityToRequired = function (cardinality) {
99
- switch (cardinality) {
100
- case "0..0":
101
- case "0..1":
102
- return false;
103
- case "1..1":
104
- return true;
105
- default:
106
- throw new Error("Cardinality \"".concat(cardinality, "\" is not supported"));
107
- }
108
- };
109
- exports.handleValueValidation = (0, lodash_1.debounce)(function (isoNumber, fieldName, value, rapiBaseUrl, namePath, setValidationStatus, formInstance, callName) {
110
- if (value.length === 0) {
111
- setValidationStatus("");
112
- formInstance.resetFields([namePath]);
113
- }
114
- else {
115
- var searchUrl = rapiBaseUrl + "/api/v1/requirements/".concat(isoNumber, "/").concat(fieldName, "/values/validate?value=").concat(encodeURIComponent(value));
116
- setValidationStatus("validating");
117
- axios_1.default.get(searchUrl, { cancelToken: (0, ApiUtility_1.getCancelToken)(callName) })
118
- .then(function (response) {
119
- response.data ? setValidationStatus("success") : setValidationStatus("error");
120
- })
121
- .catch(function () {
122
- setValidationStatus("error");
123
- });
124
- }
125
- }, 500);
126
- var handleValueSearch = function (searchValue, fieldDefinition, setLoadingValues, loadingValues, receiverRequirements, updateReceiverRequirementsProp, callName, rapiBaseUrl, overwrittenFieldDefinitionKey) {
127
- if (fieldDefinition.properties.href) {
128
- var searchUrl = rapiBaseUrl + fieldDefinition.properties.href.replace("%7BtextFilter%7D", encodeURIComponent(searchValue)).replace("%7Boffset%7D", "0").replace("%7Blimit%7D", "15");
129
- if (!loadingValues) {
130
- setLoadingValues(true);
131
- }
132
- axios_1.default.get(searchUrl, { cancelToken: (0, ApiUtility_1.getCancelToken)(callName) })
133
- .then(function (response) {
134
- setLoadingValues(false);
135
- var updatedFieldDefinitions = __spreadArray([], receiverRequirements.fieldDefinitions, true);
136
- var key = overwrittenFieldDefinitionKey ? overwrittenFieldDefinitionKey : fieldDefinition.key;
137
- var index = updatedFieldDefinitions.findIndex(function (x) { return x.key === key; });
138
- var updatedFieldDefinition = __assign(__assign({}, updatedFieldDefinitions[index]), { properties: __assign(__assign({}, updatedFieldDefinitions[index].properties), { values: response.data.value }) });
139
- updatedFieldDefinitions.splice(index, 1, updatedFieldDefinition);
140
- var newReceiverRequirements = __assign(__assign({}, receiverRequirements), { fieldDefinitions: updatedFieldDefinitions });
141
- updateReceiverRequirementsProp(newReceiverRequirements);
142
- })
143
- .catch(function (error) {
144
- setLoadingValues(false);
145
- });
146
- }
147
- };
148
- exports.debouncedHandleSearchValues = (0, lodash_1.debounce)(handleValueSearch, 500);
149
- var getInput = function (fieldDefinition, namePath, validationCallName, legalIdentifier, formInstance, rapiBaseUrl, receiverRequirements, updateReceiverRequirementsProp, setAccountingCostFieldProps, accountingCostFieldProps, setLoadingAccountingCostValues, loadingAccountingCostValues, setHandlingValidationStatus, defaultPlaceholder, allowClearSelect) {
150
- var handling = null;
151
- if (fieldDefinition.properties.handling) {
152
- handling = JSON.parse(fieldDefinition.properties.handling);
153
- }
154
- var placeholder = (0, exports.getFieldLabelOverride)(receiverRequirements, fieldDefinition.key, defaultPlaceholder);
155
- if (handling && handling.shouldBeValidated) {
156
- return (react_1.default.createElement(antd_1.Input, { onBlur: function (event) {
157
- (0, exports.handleValueValidation)(legalIdentifier, fieldDefinition.name, event.currentTarget.value, rapiBaseUrl, namePath, setHandlingValidationStatus, formInstance, validationCallName);
158
- }, placeholder: placeholder }));
159
- }
160
- else if (fieldDefinition.properties.values) {
161
- var selectProps = fieldDefinition.properties.hasOwnProperty("href")
162
- ? {
163
- showSearch: true,
164
- filterOption: false,
165
- onSearch: function (searchValue) {
166
- (0, exports.debouncedHandleSearchValues)(searchValue, fieldDefinition, setLoadingAccountingCostValues, loadingAccountingCostValues, receiverRequirements, updateReceiverRequirementsProp, "getAccountingCOstValues", rapiBaseUrl);
167
- },
168
- loading: loadingAccountingCostValues,
169
- }
170
- : {};
171
- return (react_1.default.createElement(antd_1.Select, __assign({ popupMatchSelectWidth: false, allowClear: allowClearSelect }, selectProps, { placeholder: placeholder }), fieldDefinition.properties.values.map(function (op) {
172
- return react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name);
173
- })));
174
- }
175
- else {
176
- return (react_1.default.createElement(antd_1.Input, { allowClear: allowClearSelect, placeholder: placeholder }));
177
- }
178
- };
179
- exports.getInput = getInput;
180
- var getRequiredTooltipMessage = function (title, fieldNames) {
181
- return (react_1.default.createElement("div", null,
182
- react_1.default.createElement(antd_1.Row, null, title),
183
- react_1.default.createElement(antd_1.Row, { wrap: false },
184
- react_1.default.createElement("div", { className: "flex_direction_column", style: { minWidth: "100px" } },
185
- react_1.default.createElement("ul", { style: { paddingLeft: "20px" } }, fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.map(function (fieldName) { return react_1.default.createElement("li", null, fieldName); }))))));
186
- };
187
- exports.getRequiredTooltipMessage = getRequiredTooltipMessage;
188
- var paymentMeansTypeFieldHasValues = function (paymentMeansTypeFieldDefinition) {
189
- return paymentMeansTypeFieldDefinition &&
190
- paymentMeansTypeFieldDefinition.hasOwnProperty("properties") &&
191
- paymentMeansTypeFieldDefinition.properties.hasOwnProperty("values") &&
192
- paymentMeansTypeFieldDefinition.properties.values !== undefined;
193
- };
194
- exports.paymentMeansTypeFieldHasValues = paymentMeansTypeFieldHasValues;
195
- var getCurrencies = function (recRequirements, intl) {
196
- var currencies = [
197
- {
198
- key: "ISK",
199
- name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_ISK),
200
- },
201
- {
202
- key: "DKK",
203
- name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_DKK),
204
- },
205
- {
206
- key: "NOK",
207
- name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_NOK),
208
- },
209
- {
210
- key: "SEK",
211
- name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_SEK),
212
- },
213
- {
214
- key: "EUR",
215
- name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_EUR),
216
- },
217
- {
218
- key: "USD",
219
- name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_USD),
220
- },
221
- {
222
- key: "GBP",
223
- name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_GBP),
224
- },
225
- ];
226
- var currencyCodeRequirements = (0, exports.getFieldRequirements)(recRequirements, ReceiverRequirements_1.AvailableFields.currencyCode);
227
- if (currencyCodeRequirements &&
228
- currencyCodeRequirements.properties &&
229
- currencyCodeRequirements.properties.values &&
230
- currencyCodeRequirements.properties.values.length > 0) {
231
- return currencyCodeRequirements.properties.values;
232
- }
233
- else {
234
- return currencies;
235
- }
236
- };
237
- exports.getCurrencies = getCurrencies;
@@ -1,2 +0,0 @@
1
- export { convertToInvoiceMetadataInput } from "./ConversionUtility";
2
- export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument } from "./ApiUtility";
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.submitDocument = exports.submitInvoice = exports.convertToInvoiceMetadataInput = void 0;
4
- var ConversionUtility_1 = require("./ConversionUtility");
5
- Object.defineProperty(exports, "convertToInvoiceMetadataInput", { enumerable: true, get: function () { return ConversionUtility_1.convertToInvoiceMetadataInput; } }); /*, convertToCreditNoteMetadataInput*/
6
- var ApiUtility_1 = require("./ApiUtility");
7
- Object.defineProperty(exports, "submitInvoice", { enumerable: true, get: function () { return ApiUtility_1.submitInvoice; } });
8
- Object.defineProperty(exports, "submitDocument", { enumerable: true, get: function () { return ApiUtility_1.submitDocument; } });