@unimaze/billing 0.21.43 → 0.21.45

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 (201) hide show
  1. package/lib/common/components/billing-lines/NewNewBillingLines.d.ts +15 -0
  2. package/lib/common/components/billing-lines/NewNewBillingLines.js +36 -0
  3. package/lib/common/components/billing-lines/cwdwdw.d.ts +1 -0
  4. package/lib/common/components/billing-lines/cwdwdw.js +14 -0
  5. package/lib/common/components/customer/index.js +5 -1
  6. package/lib/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.d.ts +0 -0
  7. package/lib/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.js +109 -0
  8. package/lib/common/components/invoice-preview/InvoicePreviewInvoiceLines.js +3 -1
  9. package/lib/common/components/invoice-preview/InvoicePreviewPaymentInfo.d.ts +0 -0
  10. package/lib/common/components/invoice-preview/InvoicePreviewPaymentInfo.js +110 -0
  11. package/lib/common/components/invoice-preview/InvoicePreviewTotalAmountPreview.js +2 -1
  12. package/lib/common/components/invoice-preview/index.d.ts +8 -0
  13. package/lib/common/components/invoice-preview/index.js +8 -0
  14. package/lib/common/components/supplier/CityAutofill.js +5 -1
  15. package/lib/common/components/supplier/index.d.ts +4 -0
  16. package/lib/common/components/supplier/index.js +5 -1
  17. package/lib/create-invoice/index.d.ts +4 -0
  18. package/lib/create-invoice/index.js +5 -1
  19. package/lib/translations/locales/en.json +6 -0
  20. package/lib/translations/locales/is.json +28 -22
  21. package/lib/translations/locales.d.ts +12 -0
  22. package/lib/unimaze-api-clients/src/mapi/api.d.ts +6664 -0
  23. package/lib/unimaze-api-clients/src/mapi/api.js +4743 -0
  24. package/lib/unimaze-api-clients/src/mapi/base.d.ts +55 -0
  25. package/lib/unimaze-api-clients/src/mapi/base.js +84 -0
  26. package/lib/unimaze-api-clients/src/mapi/configuration.d.ts +63 -0
  27. package/lib/unimaze-api-clients/src/mapi/configuration.js +28 -0
  28. package/lib/unimaze-api-clients/src/mapi/index.d.ts +13 -0
  29. package/lib/unimaze-api-clients/src/mapi/index.js +30 -0
  30. package/lib/unimaze-api-clients/src/rapi/api.d.ts +5015 -0
  31. package/lib/unimaze-api-clients/src/rapi/api.js +5582 -0
  32. package/lib/unimaze-api-clients/src/rapi/base.d.ts +55 -0
  33. package/lib/unimaze-api-clients/src/rapi/base.js +84 -0
  34. package/lib/unimaze-api-clients/src/rapi/configuration.d.ts +63 -0
  35. package/lib/unimaze-api-clients/src/rapi/configuration.js +28 -0
  36. package/lib/unimaze-api-clients/src/rapi/index.d.ts +13 -0
  37. package/lib/unimaze-api-clients/src/rapi/index.js +30 -0
  38. package/lib/unimaze-billing/src/common/components/CommonTranslations.d.ts +74 -0
  39. package/lib/unimaze-billing/src/common/components/CommonTranslations.js +78 -0
  40. package/lib/unimaze-billing/src/common/components/attachments/Attachment.d.ts +20 -0
  41. package/lib/unimaze-billing/src/common/components/attachments/Attachment.js +164 -0
  42. package/lib/unimaze-billing/src/common/components/attachments/AttachmentModal.d.ts +21 -0
  43. package/lib/unimaze-billing/src/common/components/attachments/AttachmentModal.js +206 -0
  44. package/lib/unimaze-billing/src/common/components/attachments/index.d.ts +27 -0
  45. package/lib/unimaze-billing/src/common/components/attachments/index.js +214 -0
  46. package/lib/unimaze-billing/src/common/components/base-information/AccountingCost.d.ts +17 -0
  47. package/lib/unimaze-billing/src/common/components/base-information/AccountingCost.js +61 -0
  48. package/lib/unimaze-billing/src/common/components/base-information/OrderReference.d.ts +16 -0
  49. package/lib/unimaze-billing/src/common/components/base-information/OrderReference.js +58 -0
  50. package/lib/unimaze-billing/src/common/components/base-information/ProjectReference.d.ts +14 -0
  51. package/lib/unimaze-billing/src/common/components/base-information/ProjectReference.js +30 -0
  52. package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.d.ts +53 -0
  53. package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.js +328 -0
  54. package/lib/unimaze-billing/src/common/components/base-information/index.d.ts +77 -0
  55. package/lib/unimaze-billing/src/common/components/base-information/index.js +186 -0
  56. package/lib/unimaze-billing/src/common/components/billing-lines/BillingCalculations.d.ts +14 -0
  57. package/lib/unimaze-billing/src/common/components/billing-lines/BillingCalculations.js +151 -0
  58. package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.d.ts +24 -0
  59. package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.js +61 -0
  60. package/lib/unimaze-billing/src/common/components/billing-lines/BillingTaxSummary.d.ts +13 -0
  61. package/lib/unimaze-billing/src/common/components/billing-lines/BillingTaxSummary.js +133 -0
  62. package/lib/unimaze-billing/src/common/components/billing-lines/CurrencySelector.d.ts +20 -0
  63. package/lib/unimaze-billing/src/common/components/billing-lines/CurrencySelector.js +17 -0
  64. package/lib/unimaze-billing/src/common/components/billing-lines/DiscountTypeSelector.d.ts +10 -0
  65. package/lib/unimaze-billing/src/common/components/billing-lines/DiscountTypeSelector.js +16 -0
  66. package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.d.ts +134 -0
  67. package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.js +209 -0
  68. package/lib/unimaze-billing/src/common/components/billing-lines/NewNewBillingLines.d.ts +15 -0
  69. package/lib/unimaze-billing/src/common/components/billing-lines/NewNewBillingLines.js +36 -0
  70. package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.d.ts +19 -0
  71. package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.js +275 -0
  72. package/lib/unimaze-billing/src/common/components/billing-lines/UnitOfMeasureSelector.d.ts +14 -0
  73. package/lib/unimaze-billing/src/common/components/billing-lines/UnitOfMeasureSelector.js +15 -0
  74. package/lib/unimaze-billing/src/common/components/billing-lines/index.d.ts +49 -0
  75. package/lib/unimaze-billing/src/common/components/billing-lines/index.js +104 -0
  76. package/lib/unimaze-billing/src/common/components/component-container/Content.d.ts +7 -0
  77. package/lib/unimaze-billing/src/common/components/component-container/Content.js +13 -0
  78. package/lib/unimaze-billing/src/common/components/component-container/Header.d.ts +9 -0
  79. package/lib/unimaze-billing/src/common/components/component-container/Header.js +28 -0
  80. package/lib/unimaze-billing/src/common/components/component-container/index.d.ts +12 -0
  81. package/lib/unimaze-billing/src/common/components/component-container/index.js +22 -0
  82. package/lib/unimaze-billing/src/common/components/customer/CostCenter.d.ts +17 -0
  83. package/lib/unimaze-billing/src/common/components/customer/CostCenter.js +163 -0
  84. package/lib/unimaze-billing/src/common/components/customer/CustomerContactName.d.ts +17 -0
  85. package/lib/unimaze-billing/src/common/components/customer/CustomerContactName.js +53 -0
  86. package/lib/unimaze-billing/src/common/components/customer/hardCoddedCustomer.d.ts +7 -0
  87. package/lib/unimaze-billing/src/common/components/customer/hardCoddedCustomer.js +41 -0
  88. package/lib/unimaze-billing/src/common/components/customer/index.d.ts +26 -0
  89. package/lib/unimaze-billing/src/common/components/customer/index.js +166 -0
  90. package/lib/unimaze-billing/src/common/components/date-picker/index.d.ts +21 -0
  91. package/lib/unimaze-billing/src/common/components/date-picker/index.js +23 -0
  92. package/lib/unimaze-billing/src/common/components/delivery-location/index.d.ts +12 -0
  93. package/lib/unimaze-billing/src/common/components/delivery-location/index.js +89 -0
  94. package/lib/unimaze-billing/src/common/components/editable-cell/index.d.ts +0 -0
  95. package/lib/unimaze-billing/src/common/components/editable-cell/index.js +295 -0
  96. package/lib/unimaze-billing/src/common/components/editable-row/index.d.ts +5 -0
  97. package/lib/unimaze-billing/src/common/components/editable-row/index.js +59 -0
  98. package/lib/unimaze-billing/src/common/components/form-item/index.d.ts +35 -0
  99. package/lib/unimaze-billing/src/common/components/form-item/index.js +60 -0
  100. package/lib/unimaze-billing/src/common/components/index.d.ts +18 -0
  101. package/lib/unimaze-billing/src/common/components/index.js +42 -0
  102. package/lib/unimaze-billing/src/common/components/input/index.d.ts +23 -0
  103. package/lib/unimaze-billing/src/common/components/input/index.js +37 -0
  104. package/lib/unimaze-billing/src/common/components/invoice/index.d.ts +42 -0
  105. package/lib/unimaze-billing/src/common/components/invoice/index.js +59 -0
  106. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.d.ts +14 -0
  107. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.js +75 -0
  108. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfoBox.d.ts +14 -0
  109. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfoBox.js +73 -0
  110. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewHeader.d.ts +12 -0
  111. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewHeader.js +104 -0
  112. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewInvoiceLines.d.ts +12 -0
  113. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewInvoiceLines.js +93 -0
  114. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfo.d.ts +14 -0
  115. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfo.js +77 -0
  116. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfoBox.d.ts +14 -0
  117. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfoBox.js +58 -0
  118. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewTotalAmountPreview.d.ts +14 -0
  119. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewTotalAmountPreview.js +52 -0
  120. package/lib/unimaze-billing/src/common/components/invoice-preview/index.d.ts +102 -0
  121. package/lib/unimaze-billing/src/common/components/invoice-preview/index.js +196 -0
  122. package/lib/unimaze-billing/src/common/components/locale-intl/index.d.ts +0 -0
  123. package/lib/unimaze-billing/src/common/components/locale-intl/index.js +51 -0
  124. package/lib/unimaze-billing/src/common/components/payment-method/index.d.ts +76 -0
  125. package/lib/unimaze-billing/src/common/components/payment-method/index.js +356 -0
  126. package/lib/unimaze-billing/src/common/components/payment-method/paymentMethodForConversion.d.ts +8 -0
  127. package/lib/unimaze-billing/src/common/components/payment-method/paymentMethodForConversion.js +37 -0
  128. package/lib/unimaze-billing/src/common/components/submit-confirmation/SubmitConfirmationSVG.d.ts +3 -0
  129. package/lib/unimaze-billing/src/common/components/submit-confirmation/SubmitConfirmationSVG.js +17 -0
  130. package/lib/unimaze-billing/src/common/components/submit-confirmation/index.d.ts +8 -0
  131. package/lib/unimaze-billing/src/common/components/submit-confirmation/index.js +34 -0
  132. package/lib/unimaze-billing/src/common/components/supplier/CityAutofill.d.ts +18 -0
  133. package/lib/unimaze-billing/src/common/components/supplier/CityAutofill.js +159 -0
  134. package/lib/unimaze-billing/src/common/components/supplier/index.d.ts +94 -0
  135. package/lib/unimaze-billing/src/common/components/supplier/index.js +334 -0
  136. package/lib/unimaze-billing/src/common/components/tooltip/index.d.ts +7 -0
  137. package/lib/unimaze-billing/src/common/components/tooltip/index.js +15 -0
  138. package/lib/unimaze-billing/src/common/components/welcome-modal/index.d.ts +15 -0
  139. package/lib/unimaze-billing/src/common/components/welcome-modal/index.js +26 -0
  140. package/lib/unimaze-billing/src/common/consts/formLayout.d.ts +74 -0
  141. package/lib/unimaze-billing/src/common/consts/formLayout.js +45 -0
  142. package/lib/unimaze-billing/src/common/consts/validationRules.d.ts +6 -0
  143. package/lib/unimaze-billing/src/common/consts/validationRules.js +69 -0
  144. package/lib/unimaze-billing/src/common/enums/DocumentTypeEnum.d.ts +5 -0
  145. package/lib/unimaze-billing/src/common/enums/DocumentTypeEnum.js +8 -0
  146. package/lib/unimaze-billing/src/common/enums/index.d.ts +1 -0
  147. package/lib/unimaze-billing/src/common/enums/index.js +8 -0
  148. package/lib/unimaze-billing/src/common/types/AppConfiguration.d.ts +26 -0
  149. package/lib/unimaze-billing/src/common/types/AppConfiguration.js +2 -0
  150. package/lib/unimaze-billing/src/common/types/BillingLineMetadataOverride.d.ts +10 -0
  151. package/lib/unimaze-billing/src/common/types/BillingLineMetadataOverride.js +2 -0
  152. package/lib/unimaze-billing/src/common/types/CommonProps.d.ts +33 -0
  153. package/lib/unimaze-billing/src/common/types/CommonProps.js +2 -0
  154. package/lib/unimaze-billing/src/common/types/DiscountType.d.ts +1 -0
  155. package/lib/unimaze-billing/src/common/types/DiscountType.js +2 -0
  156. package/lib/unimaze-billing/src/common/types/InvoiceFormFields.d.ts +1 -0
  157. package/lib/unimaze-billing/src/common/types/InvoiceFormFields.js +2 -0
  158. package/lib/unimaze-billing/src/common/types/NewReceiverRequirements.d.ts +27 -0
  159. package/lib/unimaze-billing/src/common/types/NewReceiverRequirements.js +2 -0
  160. package/lib/unimaze-billing/src/common/types/ReceiverRequirements.d.ts +83 -0
  161. package/lib/unimaze-billing/src/common/types/ReceiverRequirements.js +393 -0
  162. package/lib/unimaze-billing/src/common/types/SupplierInfo.d.ts +11 -0
  163. package/lib/unimaze-billing/src/common/types/SupplierInfo.js +2 -0
  164. package/lib/unimaze-billing/src/common/types/index.d.ts +1 -0
  165. package/lib/unimaze-billing/src/common/types/index.js +17 -0
  166. package/lib/unimaze-billing/src/create-credit-note/index.d.ts +9 -0
  167. package/lib/unimaze-billing/src/create-credit-note/index.js +62 -0
  168. package/lib/unimaze-billing/src/create-invoice/IntlLoader.d.ts +11 -0
  169. package/lib/unimaze-billing/src/create-invoice/IntlLoader.js +116 -0
  170. package/lib/unimaze-billing/src/create-invoice/index.d.ts +82 -0
  171. package/lib/unimaze-billing/src/create-invoice/index.js +710 -0
  172. package/lib/unimaze-billing/src/enums.d.ts +14 -0
  173. package/lib/unimaze-billing/src/enums.js +18 -0
  174. package/lib/unimaze-billing/src/index.d.ts +4 -0
  175. package/lib/unimaze-billing/src/index.js +28 -0
  176. package/lib/unimaze-billing/src/translations/locales/en.json +183 -0
  177. package/lib/unimaze-billing/src/translations/locales/is.json +183 -0
  178. package/lib/unimaze-billing/src/translations/locales.d.ts +369 -0
  179. package/lib/unimaze-billing/src/translations/locales.js +11 -0
  180. package/lib/unimaze-billing/src/utils/ApiUtility.d.ts +29 -0
  181. package/lib/unimaze-billing/src/utils/ApiUtility.js +133 -0
  182. package/lib/unimaze-billing/src/utils/BillingLineUtility.d.ts +25 -0
  183. package/lib/unimaze-billing/src/utils/BillingLineUtility.js +190 -0
  184. package/lib/unimaze-billing/src/utils/ConversionUtility.d.ts +9 -0
  185. package/lib/unimaze-billing/src/utils/ConversionUtility.js +222 -0
  186. package/lib/unimaze-billing/src/utils/FileUploadUtility.d.ts +9 -0
  187. package/lib/unimaze-billing/src/utils/FileUploadUtility.js +45 -0
  188. package/lib/unimaze-billing/src/utils/IntlUtility.d.ts +6 -0
  189. package/lib/unimaze-billing/src/utils/IntlUtility.js +78 -0
  190. package/lib/unimaze-billing/src/utils/LocationUtility.d.ts +1 -0
  191. package/lib/unimaze-billing/src/utils/LocationUtility.js +81 -0
  192. package/lib/unimaze-billing/src/utils/ReferenceIdentifierUtility.d.ts +7 -0
  193. package/lib/unimaze-billing/src/utils/ReferenceIdentifierUtility.js +26 -0
  194. package/lib/unimaze-billing/src/utils/RequirementsUtility.d.ts +21 -0
  195. package/lib/unimaze-billing/src/utils/RequirementsUtility.js +237 -0
  196. package/lib/unimaze-billing/src/utils/index.d.ts +2 -0
  197. package/lib/unimaze-billing/src/utils/index.js +8 -0
  198. package/lib/utils/LocationUtility.d.ts +1 -1
  199. package/lib/utils/LocationUtility.js +2 -2
  200. package/package.json +1 -1
  201. package/lib/style/index.css +0 -51
@@ -0,0 +1,26 @@
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;
@@ -0,0 +1,21 @@
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[];
@@ -0,0 +1,237 @@
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;
@@ -0,0 +1,2 @@
1
+ export { convertToInvoiceMetadataInput } from "./ConversionUtility";
2
+ export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument } from "./ApiUtility";
@@ -0,0 +1,8 @@
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; } });
@@ -1 +1 @@
1
- export declare const fetchCityAndPostcode: (query: string, country: string) => Promise<any>;
1
+ export declare const fetchCityAndPostcode: (query: string, country: string, errorMessage: string) => Promise<any>;
@@ -43,7 +43,7 @@ function capitalize(word) {
43
43
  return "";
44
44
  return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
45
45
  }
46
- var fetchCityAndPostcode = function (query, country) { return __awaiter(void 0, void 0, void 0, function () {
46
+ var fetchCityAndPostcode = function (query, country, errorMessage) { return __awaiter(void 0, void 0, void 0, function () {
47
47
  var baseUrl, selectFields, whereCondition, limit, apiUrl, response, data, results, error_1;
48
48
  return __generator(this, function (_a) {
49
49
  switch (_a.label) {
@@ -72,7 +72,7 @@ var fetchCityAndPostcode = function (query, country) { return __awaiter(void 0,
72
72
  return [2 /*return*/, results];
73
73
  case 4:
74
74
  error_1 = _a.sent();
75
- antd_1.message.error("Error fetching city and postcode data:".concat(error_1));
75
+ antd_1.message.error("".concat(errorMessage).concat(error_1));
76
76
  return [3 /*break*/, 5];
77
77
  case 5: return [2 /*return*/];
78
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unimaze/billing",
3
- "version": "0.21.43",
3
+ "version": "0.21.45",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,51 +0,0 @@
1
- .component_header {
2
- height: 3.3em;
3
- background-color: #fff;
4
- border-bottom: solid 1px #d9d9d9;
5
- border-radius: 4px 4px 0 0;
6
- display: flex;
7
- align-items: center;
8
- justify-content: space-between;
9
- padding: 1em 2em;
10
- }
11
- .component_header_title {
12
- font-size: 1.1em;
13
- }
14
- .component_header_title > span > i {
15
- font-size: 20px;
16
- }
17
- .header_icon {
18
- font-size: 1.5em;
19
- margin-right: 0.75em;
20
- color: #1890ff;
21
- }
22
- .header_right {
23
- display: flex;
24
- justify-content: flex-end;
25
- }
26
- @media screen and (max-width: 768px) {
27
- .header_right {
28
- justify-content: flex-start;
29
- }
30
- }
31
- .header_right > button {
32
- margin-bottom: unset !important;
33
- }
34
- .component_body {
35
- border-radius: 0 0 4px 4px;
36
- }
37
- .component_wrapper {
38
- align-self: stretch;
39
- height: 100%;
40
- background-color: #fff;
41
- border: solid 1px #d9d9d9;
42
- border-radius: 4px;
43
- }
44
- .component_wrapper_padding {
45
- padding: 1em;
46
- }
47
- .umz_noValidationMessage .ant-form-item-explain {
48
- height: 20px !important;
49
- visibility: hidden !important;
50
- }
51
- /*# sourceMappingURL=index.css.map */