@unimaze/billing 0.21.3 → 0.21.5

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 (230) hide show
  1. package/lib/common/components/CommonTranslations.d.ts +1 -29
  2. package/lib/common/components/CommonTranslations.js +4 -32
  3. package/lib/common/components/attachments/Attachment.d.ts +1 -1
  4. package/lib/common/components/attachments/AttachmentModal.d.ts +1 -1
  5. package/lib/common/components/attachments/index.d.ts +1 -1
  6. package/lib/common/components/base-information/AccountingCost.d.ts +1 -1
  7. package/lib/common/components/base-information/OrderReference.d.ts +1 -1
  8. package/lib/common/components/base-information/ProjectReference.d.ts +1 -1
  9. package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +2 -1
  10. package/lib/common/components/base-information/ReferenceIdentifiers.js +29 -11
  11. package/lib/common/components/base-information/index.d.ts +10 -1
  12. package/lib/common/components/base-information/index.js +9 -1
  13. package/lib/common/components/billing-lines/BillingCalculations.d.ts +1 -1
  14. package/lib/common/components/billing-lines/BillingLinePreview.d.ts +2 -1
  15. package/lib/common/components/billing-lines/BillingLinePreview.js +4 -2
  16. package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +1 -1
  17. package/lib/common/components/billing-lines/BillingTaxSummary.js +0 -1
  18. package/lib/common/components/billing-lines/CurrencySelector.d.ts +20 -0
  19. package/lib/common/components/billing-lines/CurrencySelector.js +17 -0
  20. package/lib/common/components/billing-lines/DiscountTypeSelector.d.ts +10 -0
  21. package/lib/common/components/billing-lines/DiscountTypeSelector.js +16 -0
  22. package/lib/common/components/billing-lines/NewBillingLines.d.ts +2 -1
  23. package/lib/common/components/billing-lines/NewBillingLines.js +37 -327
  24. package/lib/common/components/billing-lines/NewNewBillingLines.d.ts +15 -0
  25. package/lib/common/components/billing-lines/NewNewBillingLines.js +36 -0
  26. package/lib/common/components/billing-lines/SingleBillingLine.d.ts +19 -0
  27. package/lib/common/components/billing-lines/SingleBillingLine.js +275 -0
  28. package/lib/common/components/billing-lines/UnitOfMeasureSelector.d.ts +14 -0
  29. package/lib/common/components/billing-lines/UnitOfMeasureSelector.js +15 -0
  30. package/lib/common/components/billing-lines/cwdwdw.d.ts +1 -0
  31. package/lib/common/components/billing-lines/cwdwdw.js +14 -0
  32. package/lib/common/components/billing-lines/index.d.ts +3 -6
  33. package/lib/common/components/billing-lines/index.js +1 -1
  34. package/lib/common/components/customer/CostCenter.d.ts +1 -1
  35. package/lib/common/components/customer/CustomerContactName.d.ts +1 -1
  36. package/lib/common/components/customer/index.d.ts +1 -1
  37. package/lib/common/components/customer/index.js +6 -4
  38. package/lib/common/components/delivery-location/index.d.ts +1 -1
  39. package/lib/common/components/form-item/index.d.ts +1 -1
  40. package/lib/common/components/input/index.d.ts +1 -1
  41. package/lib/common/components/invoice/index.d.ts +3 -1
  42. package/lib/common/components/invoice/index.js +21 -14
  43. package/lib/common/components/invoice-preview/InvoicePreviewHeader.d.ts +1 -1
  44. package/lib/common/components/invoice-preview/InvoicePreviewHeader.js +7 -8
  45. package/lib/common/components/invoice-preview/index.d.ts +1 -1
  46. package/lib/common/components/invoice-preview/index.js +8 -2
  47. package/lib/common/components/payment-method/index.d.ts +1 -1
  48. package/lib/common/components/payment-method/index.js +22 -7
  49. package/lib/common/components/supplier/CityAutofill.d.ts +1 -1
  50. package/lib/common/components/supplier/index.d.ts +1 -1
  51. package/lib/common/components/welcome-modal/index.d.ts +1 -1
  52. package/lib/common/types/ReceiverRequirements.d.ts +2 -0
  53. package/lib/common/types/ReceiverRequirements.js +2 -0
  54. package/lib/create-invoice/index.d.ts +9 -1
  55. package/lib/create-invoice/index.js +87 -60
  56. package/lib/enums.d.ts +3 -0
  57. package/lib/translations/locales/en.json +7 -10
  58. package/lib/translations/locales/is.json +5 -8
  59. package/lib/translations/locales.d.ts +10 -16
  60. package/lib/unimaze-api-clients/src/mapi/api.d.ts +6664 -0
  61. package/lib/unimaze-api-clients/src/mapi/api.js +4743 -0
  62. package/lib/unimaze-api-clients/src/mapi/base.d.ts +55 -0
  63. package/lib/unimaze-api-clients/src/mapi/base.js +84 -0
  64. package/lib/unimaze-api-clients/src/mapi/configuration.d.ts +63 -0
  65. package/lib/unimaze-api-clients/src/mapi/configuration.js +28 -0
  66. package/lib/unimaze-api-clients/src/mapi/index.d.ts +13 -0
  67. package/lib/unimaze-api-clients/src/mapi/index.js +30 -0
  68. package/lib/unimaze-api-clients/src/rapi/api.d.ts +5015 -0
  69. package/lib/unimaze-api-clients/src/rapi/api.js +5582 -0
  70. package/lib/unimaze-api-clients/src/rapi/base.d.ts +55 -0
  71. package/lib/unimaze-api-clients/src/rapi/base.js +84 -0
  72. package/lib/unimaze-api-clients/src/rapi/configuration.d.ts +63 -0
  73. package/lib/unimaze-api-clients/src/rapi/configuration.js +28 -0
  74. package/lib/unimaze-api-clients/src/rapi/index.d.ts +13 -0
  75. package/lib/unimaze-api-clients/src/rapi/index.js +30 -0
  76. package/lib/unimaze-billing/src/common/components/CommonTranslations.d.ts +102 -0
  77. package/lib/unimaze-billing/src/common/components/CommonTranslations.js +106 -0
  78. package/lib/unimaze-billing/src/common/components/attachments/Attachment.d.ts +20 -0
  79. package/lib/unimaze-billing/src/common/components/attachments/Attachment.js +164 -0
  80. package/lib/unimaze-billing/src/common/components/attachments/AttachmentModal.d.ts +21 -0
  81. package/lib/unimaze-billing/src/common/components/attachments/AttachmentModal.js +203 -0
  82. package/lib/unimaze-billing/src/common/components/attachments/index.d.ts +27 -0
  83. package/lib/unimaze-billing/src/common/components/attachments/index.js +214 -0
  84. package/lib/unimaze-billing/src/common/components/base-information/AccountingCost.d.ts +17 -0
  85. package/lib/unimaze-billing/src/common/components/base-information/AccountingCost.js +61 -0
  86. package/lib/unimaze-billing/src/common/components/base-information/OrderReference.d.ts +16 -0
  87. package/lib/unimaze-billing/src/common/components/base-information/OrderReference.js +58 -0
  88. package/lib/unimaze-billing/src/common/components/base-information/ProjectReference.d.ts +14 -0
  89. package/lib/unimaze-billing/src/common/components/base-information/ProjectReference.js +30 -0
  90. package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.d.ts +48 -0
  91. package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.js +306 -0
  92. package/lib/unimaze-billing/src/common/components/base-information/index.d.ts +68 -0
  93. package/lib/unimaze-billing/src/common/components/base-information/index.js +178 -0
  94. package/lib/unimaze-billing/src/common/components/billing-lines/BillingCalculations.d.ts +14 -0
  95. package/lib/unimaze-billing/src/common/components/billing-lines/BillingCalculations.js +153 -0
  96. package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.d.ts +21 -0
  97. package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.js +41 -0
  98. package/lib/unimaze-billing/src/common/components/billing-lines/BillingTaxSummary.d.ts +13 -0
  99. package/lib/unimaze-billing/src/common/components/billing-lines/BillingTaxSummary.js +134 -0
  100. package/lib/unimaze-billing/src/common/components/billing-lines/CurrencySelector.d.ts +20 -0
  101. package/lib/unimaze-billing/src/common/components/billing-lines/CurrencySelector.js +17 -0
  102. package/lib/unimaze-billing/src/common/components/billing-lines/DiscountTypeSelector.d.ts +10 -0
  103. package/lib/unimaze-billing/src/common/components/billing-lines/DiscountTypeSelector.js +16 -0
  104. package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.d.ts +129 -0
  105. package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.js +495 -0
  106. package/lib/unimaze-billing/src/common/components/billing-lines/NewNewBillingLines.d.ts +15 -0
  107. package/lib/unimaze-billing/src/common/components/billing-lines/NewNewBillingLines.js +36 -0
  108. package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.d.ts +14 -0
  109. package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.js +199 -0
  110. package/lib/unimaze-billing/src/common/components/billing-lines/UnitOfMeasureSelector.d.ts +14 -0
  111. package/lib/unimaze-billing/src/common/components/billing-lines/UnitOfMeasureSelector.js +15 -0
  112. package/lib/unimaze-billing/src/common/components/billing-lines/index.d.ts +52 -0
  113. package/lib/unimaze-billing/src/common/components/billing-lines/index.js +104 -0
  114. package/lib/unimaze-billing/src/common/components/component-container/Content.d.ts +7 -0
  115. package/lib/unimaze-billing/src/common/components/component-container/Content.js +13 -0
  116. package/lib/unimaze-billing/src/common/components/component-container/Header.d.ts +9 -0
  117. package/lib/unimaze-billing/src/common/components/component-container/Header.js +28 -0
  118. package/lib/unimaze-billing/src/common/components/component-container/index.d.ts +12 -0
  119. package/lib/unimaze-billing/src/common/components/component-container/index.js +22 -0
  120. package/lib/unimaze-billing/src/common/components/customer/CostCenter.d.ts +17 -0
  121. package/lib/unimaze-billing/src/common/components/customer/CostCenter.js +163 -0
  122. package/lib/unimaze-billing/src/common/components/customer/CustomerContactName.d.ts +17 -0
  123. package/lib/unimaze-billing/src/common/components/customer/CustomerContactName.js +53 -0
  124. package/lib/unimaze-billing/src/common/components/customer/hardCoddedCustomer.d.ts +7 -0
  125. package/lib/unimaze-billing/src/common/components/customer/hardCoddedCustomer.js +41 -0
  126. package/lib/unimaze-billing/src/common/components/customer/index.d.ts +26 -0
  127. package/lib/unimaze-billing/src/common/components/customer/index.js +168 -0
  128. package/lib/unimaze-billing/src/common/components/date-picker/index.d.ts +21 -0
  129. package/lib/unimaze-billing/src/common/components/date-picker/index.js +23 -0
  130. package/lib/unimaze-billing/src/common/components/delivery-location/index.d.ts +12 -0
  131. package/lib/unimaze-billing/src/common/components/delivery-location/index.js +89 -0
  132. package/lib/unimaze-billing/src/common/components/editable-cell/index.d.ts +0 -0
  133. package/lib/unimaze-billing/src/common/components/editable-cell/index.js +295 -0
  134. package/lib/unimaze-billing/src/common/components/editable-row/index.d.ts +5 -0
  135. package/lib/unimaze-billing/src/common/components/editable-row/index.js +59 -0
  136. package/lib/unimaze-billing/src/common/components/form-item/index.d.ts +35 -0
  137. package/lib/unimaze-billing/src/common/components/form-item/index.js +60 -0
  138. package/lib/unimaze-billing/src/common/components/index.d.ts +18 -0
  139. package/lib/unimaze-billing/src/common/components/index.js +42 -0
  140. package/lib/unimaze-billing/src/common/components/input/index.d.ts +23 -0
  141. package/lib/unimaze-billing/src/common/components/input/index.js +37 -0
  142. package/lib/unimaze-billing/src/common/components/invoice/index.d.ts +40 -0
  143. package/lib/unimaze-billing/src/common/components/invoice/index.js +52 -0
  144. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewHeader.d.ts +12 -0
  145. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewHeader.js +105 -0
  146. package/lib/unimaze-billing/src/common/components/invoice-preview/index.d.ts +16 -0
  147. package/lib/unimaze-billing/src/common/components/invoice-preview/index.js +405 -0
  148. package/lib/unimaze-billing/src/common/components/locale-intl/index.d.ts +0 -0
  149. package/lib/unimaze-billing/src/common/components/locale-intl/index.js +51 -0
  150. package/lib/unimaze-billing/src/common/components/payment-method/index.d.ts +76 -0
  151. package/lib/unimaze-billing/src/common/components/payment-method/index.js +356 -0
  152. package/lib/unimaze-billing/src/common/components/payment-method/paymentMethodForConversion.d.ts +8 -0
  153. package/lib/unimaze-billing/src/common/components/payment-method/paymentMethodForConversion.js +37 -0
  154. package/lib/unimaze-billing/src/common/components/submit-confirmation/SubmitConfirmationSVG.d.ts +3 -0
  155. package/lib/unimaze-billing/src/common/components/submit-confirmation/SubmitConfirmationSVG.js +17 -0
  156. package/lib/unimaze-billing/src/common/components/submit-confirmation/index.d.ts +8 -0
  157. package/lib/unimaze-billing/src/common/components/submit-confirmation/index.js +34 -0
  158. package/lib/unimaze-billing/src/common/components/supplier/CityAutofill.d.ts +18 -0
  159. package/lib/unimaze-billing/src/common/components/supplier/CityAutofill.js +159 -0
  160. package/lib/unimaze-billing/src/common/components/supplier/index.d.ts +94 -0
  161. package/lib/unimaze-billing/src/common/components/supplier/index.js +334 -0
  162. package/lib/unimaze-billing/src/common/components/tooltip/index.d.ts +7 -0
  163. package/lib/unimaze-billing/src/common/components/tooltip/index.js +15 -0
  164. package/lib/unimaze-billing/src/common/components/welcome-modal/index.d.ts +15 -0
  165. package/lib/unimaze-billing/src/common/components/welcome-modal/index.js +26 -0
  166. package/lib/unimaze-billing/src/common/consts/formLayout.d.ts +74 -0
  167. package/lib/unimaze-billing/src/common/consts/formLayout.js +45 -0
  168. package/lib/unimaze-billing/src/common/consts/validationRules.d.ts +6 -0
  169. package/lib/unimaze-billing/src/common/consts/validationRules.js +69 -0
  170. package/lib/unimaze-billing/src/common/enums/DocumentTypeEnum.d.ts +5 -0
  171. package/lib/unimaze-billing/src/common/enums/DocumentTypeEnum.js +8 -0
  172. package/lib/unimaze-billing/src/common/enums/index.d.ts +1 -0
  173. package/lib/unimaze-billing/src/common/enums/index.js +8 -0
  174. package/lib/unimaze-billing/src/common/types/AppConfiguration.d.ts +23 -0
  175. package/lib/unimaze-billing/src/common/types/AppConfiguration.js +2 -0
  176. package/lib/unimaze-billing/src/common/types/BillingLineMetadataOverride.d.ts +10 -0
  177. package/lib/unimaze-billing/src/common/types/BillingLineMetadataOverride.js +2 -0
  178. package/lib/unimaze-billing/src/common/types/CommonProps.d.ts +33 -0
  179. package/lib/unimaze-billing/src/common/types/CommonProps.js +2 -0
  180. package/lib/unimaze-billing/src/common/types/DiscountType.d.ts +1 -0
  181. package/lib/unimaze-billing/src/common/types/DiscountType.js +2 -0
  182. package/lib/unimaze-billing/src/common/types/InvoiceFormFields.d.ts +1 -0
  183. package/lib/unimaze-billing/src/common/types/InvoiceFormFields.js +2 -0
  184. package/lib/unimaze-billing/src/common/types/NewReceiverRequirements.d.ts +27 -0
  185. package/lib/unimaze-billing/src/common/types/NewReceiverRequirements.js +2 -0
  186. package/lib/unimaze-billing/src/common/types/ReceiverRequirements.d.ts +81 -0
  187. package/lib/unimaze-billing/src/common/types/ReceiverRequirements.js +391 -0
  188. package/lib/unimaze-billing/src/common/types/SupplierInfo.d.ts +11 -0
  189. package/lib/unimaze-billing/src/common/types/SupplierInfo.js +2 -0
  190. package/lib/unimaze-billing/src/common/types/index.d.ts +1 -0
  191. package/lib/unimaze-billing/src/common/types/index.js +17 -0
  192. package/lib/unimaze-billing/src/create-credit-note/index.d.ts +9 -0
  193. package/lib/unimaze-billing/src/create-credit-note/index.js +62 -0
  194. package/lib/unimaze-billing/src/create-invoice/IntlLoader.d.ts +11 -0
  195. package/lib/unimaze-billing/src/create-invoice/IntlLoader.js +116 -0
  196. package/lib/unimaze-billing/src/create-invoice/index.d.ts +74 -0
  197. package/lib/unimaze-billing/src/create-invoice/index.js +680 -0
  198. package/lib/unimaze-billing/src/enums.d.ts +11 -0
  199. package/lib/unimaze-billing/src/enums.js +18 -0
  200. package/lib/unimaze-billing/src/index.d.ts +4 -0
  201. package/lib/unimaze-billing/src/index.js +28 -0
  202. package/lib/unimaze-billing/src/translations/locales/en.json +183 -0
  203. package/lib/unimaze-billing/src/translations/locales/is.json +183 -0
  204. package/lib/unimaze-billing/src/translations/locales.d.ts +369 -0
  205. package/lib/unimaze-billing/src/translations/locales.js +11 -0
  206. package/lib/unimaze-billing/src/utils/ApiUtility.d.ts +23 -0
  207. package/lib/unimaze-billing/src/utils/ApiUtility.js +115 -0
  208. package/lib/unimaze-billing/src/utils/BillingLineUtility.d.ts +22 -0
  209. package/lib/unimaze-billing/src/utils/BillingLineUtility.js +158 -0
  210. package/lib/unimaze-billing/src/utils/ConversionUtility.d.ts +9 -0
  211. package/lib/unimaze-billing/src/utils/ConversionUtility.js +223 -0
  212. package/lib/unimaze-billing/src/utils/FileUploadUtility.d.ts +9 -0
  213. package/lib/unimaze-billing/src/utils/FileUploadUtility.js +45 -0
  214. package/lib/unimaze-billing/src/utils/IntlUtility.d.ts +5 -0
  215. package/lib/unimaze-billing/src/utils/IntlUtility.js +55 -0
  216. package/lib/unimaze-billing/src/utils/LocationUtility.d.ts +1 -0
  217. package/lib/unimaze-billing/src/utils/LocationUtility.js +81 -0
  218. package/lib/unimaze-billing/src/utils/ReferenceIdentifierUtility.d.ts +7 -0
  219. package/lib/unimaze-billing/src/utils/ReferenceIdentifierUtility.js +26 -0
  220. package/lib/unimaze-billing/src/utils/RequirementsUtility.d.ts +19 -0
  221. package/lib/unimaze-billing/src/utils/RequirementsUtility.js +189 -0
  222. package/lib/unimaze-billing/src/utils/index.d.ts +2 -0
  223. package/lib/unimaze-billing/src/utils/index.js +8 -0
  224. package/lib/utils/ApiUtility.d.ts +9 -3
  225. package/lib/utils/ApiUtility.js +30 -2
  226. package/lib/utils/BillingLineUtility.d.ts +4 -1
  227. package/lib/utils/BillingLineUtility.js +36 -4
  228. package/lib/utils/RequirementsUtility.d.ts +4 -1
  229. package/lib/utils/RequirementsUtility.js +56 -1
  230. package/package.json +2 -2
@@ -0,0 +1,189 @@
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.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 lodash_1 = require("lodash");
29
+ var axios_1 = __importDefault(require("axios"));
30
+ var ApiUtility_1 = require("./ApiUtility");
31
+ var antd_1 = require("antd");
32
+ // export const getReceiverRequirements = (recRequirements: ReceiverRequirements, key: AvailableFields): FieldRequirement => {
33
+ // return recRequirements[key]!;
34
+ // };
35
+ //
36
+ // export const getReceiverRequirementsIsRequired = (recRequirements: ReceiverRequirements, key: AvailableFields, defaultIsRequired: boolean): boolean => {
37
+ // if (recRequirements.hasOwnProperty(key)) {
38
+ // const recRequirement = recRequirements[key];
39
+ // if (recRequirement) {
40
+ // return recRequirement.isRequired
41
+ // }
42
+ // }
43
+ // return defaultIsRequired;
44
+ // };
45
+ //
46
+ // export const getReceiverRequirementsLabelWithDefault = (recRequirements: ReceiverRequirements, key: AvailableFields, defaultLabel: React.ReactNode): React.ReactNode => {
47
+ // if (recRequirements.hasOwnProperty(key)) {
48
+ // const recRequirement = recRequirements[key];
49
+ // if (recRequirement && recRequirement.label) {
50
+ // return recRequirement.label
51
+ // }
52
+ // }
53
+ // return defaultLabel;
54
+ // };
55
+ var getFieldRequirements = function (receiverRequirements, key) {
56
+ return receiverRequirements ? receiverRequirements.fieldDefinitions.find(function (field) { return field.key === key; }) : undefined;
57
+ };
58
+ exports.getFieldRequirements = getFieldRequirements;
59
+ var getFieldLabelOverride = function (receiverRequirements, key, defaultLabel) {
60
+ var fieldRequirement = (0, exports.getFieldRequirements)(receiverRequirements, key);
61
+ return fieldRequirement && fieldRequirement.properties.hasOwnProperty("label") ? fieldRequirement.properties.label : defaultLabel;
62
+ };
63
+ exports.getFieldLabelOverride = getFieldLabelOverride;
64
+ var getFieldLabelTooltipOverride = function (receiverRequirements, key, defaultLabelTooltip) {
65
+ var fieldRequirement = (0, exports.getFieldRequirements)(receiverRequirements, key);
66
+ if (fieldRequirement && fieldRequirement.properties.hasOwnProperty("handling")) {
67
+ if (fieldRequirement.properties.handling) {
68
+ var handling = JSON.parse(fieldRequirement.properties.handling);
69
+ return handling.helpText ? handling.helpText : defaultLabelTooltip;
70
+ }
71
+ else
72
+ return defaultLabelTooltip;
73
+ }
74
+ else {
75
+ return defaultLabelTooltip;
76
+ }
77
+ };
78
+ exports.getFieldLabelTooltipOverride = getFieldLabelTooltipOverride;
79
+ var getFieldPlaceholderOverride = function (fieldRequirement, defaultPlaceholder) {
80
+ if (fieldRequirement.properties.handling) {
81
+ var handling = JSON.parse(fieldRequirement.properties.handling);
82
+ return handling.placeholder ? handling.placeholder : defaultPlaceholder;
83
+ }
84
+ return defaultPlaceholder ? defaultPlaceholder : "";
85
+ };
86
+ exports.getFieldPlaceholderOverride = getFieldPlaceholderOverride;
87
+ var getFieldIsRequired = function (receiverRequirements, key, defaultIsRequired) {
88
+ var fieldRequirement = (0, exports.getFieldRequirements)(receiverRequirements, key);
89
+ var fieldCardinality = fieldRequirement && fieldRequirement.properties.hasOwnProperty("cardinality") && fieldRequirement.properties.cardinality;
90
+ return fieldCardinality ? cardinalityToRequired(fieldCardinality) || defaultIsRequired : defaultIsRequired;
91
+ };
92
+ exports.getFieldIsRequired = getFieldIsRequired;
93
+ var cardinalityToRequired = function (cardinality) {
94
+ switch (cardinality) {
95
+ case "0..0":
96
+ case "0..1":
97
+ return false;
98
+ case "1..1":
99
+ return true;
100
+ default:
101
+ throw new Error("Cardinality \"".concat(cardinality, "\" is not supported"));
102
+ }
103
+ };
104
+ exports.handleValueValidation = (0, lodash_1.debounce)(function (isoNumber, fieldName, value, rapiBaseUrl, namePath, setValidationStatus, formInstance, callName) {
105
+ if (value.length === 0) {
106
+ setValidationStatus("");
107
+ formInstance.resetFields([namePath]);
108
+ }
109
+ else {
110
+ var searchUrl = rapiBaseUrl + "/api/v1/requirements/".concat(isoNumber, "/").concat(fieldName, "/values/validate?value=").concat(encodeURIComponent(value));
111
+ setValidationStatus("validating");
112
+ axios_1.default.get(searchUrl, { cancelToken: (0, ApiUtility_1.getCancelToken)(callName) })
113
+ .then(function (response) {
114
+ response.data ? setValidationStatus("success") : setValidationStatus("error");
115
+ })
116
+ .catch(function () {
117
+ setValidationStatus("error");
118
+ });
119
+ }
120
+ }, 500);
121
+ var handleValueSearch = function (searchValue, fieldDefinition, setLoadingValues, loadingValues, receiverRequirements, updateReceiverRequirementsProp, callName, rapiBaseUrl, overwrittenFieldDefinitionKey) {
122
+ if (fieldDefinition.properties.href) {
123
+ var searchUrl = rapiBaseUrl + fieldDefinition.properties.href.replace("%7BtextFilter%7D", encodeURIComponent(searchValue)).replace("%7Boffset%7D", "0").replace("%7Blimit%7D", "15");
124
+ if (!loadingValues) {
125
+ setLoadingValues(true);
126
+ }
127
+ axios_1.default.get(searchUrl, { cancelToken: (0, ApiUtility_1.getCancelToken)(callName) })
128
+ .then(function (response) {
129
+ setLoadingValues(false);
130
+ var updatedFieldDefinitions = __spreadArray([], receiverRequirements.fieldDefinitions, true);
131
+ var key = overwrittenFieldDefinitionKey ? overwrittenFieldDefinitionKey : fieldDefinition.key;
132
+ var index = updatedFieldDefinitions.findIndex(function (x) { return x.key === key; });
133
+ var updatedFieldDefinition = __assign(__assign({}, updatedFieldDefinitions[index]), { properties: __assign(__assign({}, updatedFieldDefinitions[index].properties), { values: response.data.value }) });
134
+ updatedFieldDefinitions.splice(index, 1, updatedFieldDefinition);
135
+ var newReceiverRequirements = __assign(__assign({}, receiverRequirements), { fieldDefinitions: updatedFieldDefinitions });
136
+ updateReceiverRequirementsProp(newReceiverRequirements);
137
+ })
138
+ .catch(function (error) {
139
+ setLoadingValues(false);
140
+ });
141
+ }
142
+ };
143
+ exports.debouncedHandleSearchValues = (0, lodash_1.debounce)(handleValueSearch, 500);
144
+ var getInput = function (fieldDefinition, namePath, validationCallName, legalIdentifier, formInstance, rapiBaseUrl, receiverRequirements, updateReceiverRequirementsProp, setAccountingCostFieldProps, accountingCostFieldProps, setLoadingAccountingCostValues, loadingAccountingCostValues, setHandlingValidationStatus, defaultPlaceholder, allowClearSelect) {
145
+ var handling = null;
146
+ if (fieldDefinition.properties.handling) {
147
+ handling = JSON.parse(fieldDefinition.properties.handling);
148
+ }
149
+ var placeholder = (0, exports.getFieldLabelOverride)(receiverRequirements, fieldDefinition.key, defaultPlaceholder);
150
+ if (handling && handling.shouldBeValidated) {
151
+ return (react_1.default.createElement(antd_1.Input, { onBlur: function (event) {
152
+ (0, exports.handleValueValidation)(legalIdentifier, fieldDefinition.name, event.currentTarget.value, rapiBaseUrl, namePath, setHandlingValidationStatus, formInstance, validationCallName);
153
+ }, placeholder: placeholder }));
154
+ }
155
+ else if (fieldDefinition.properties.values) {
156
+ var selectProps = fieldDefinition.properties.hasOwnProperty("href")
157
+ ? {
158
+ showSearch: true,
159
+ filterOption: false,
160
+ onSearch: function (searchValue) {
161
+ (0, exports.debouncedHandleSearchValues)(searchValue, fieldDefinition, setLoadingAccountingCostValues, loadingAccountingCostValues, receiverRequirements, updateReceiverRequirementsProp, "getAccountingCOstValues", rapiBaseUrl);
162
+ },
163
+ loading: loadingAccountingCostValues,
164
+ }
165
+ : {};
166
+ return (react_1.default.createElement(antd_1.Select, __assign({ popupMatchSelectWidth: false, allowClear: allowClearSelect }, selectProps, { placeholder: placeholder }), fieldDefinition.properties.values.map(function (op) {
167
+ return react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name);
168
+ })));
169
+ }
170
+ else {
171
+ return (react_1.default.createElement(antd_1.Input, { allowClear: allowClearSelect, placeholder: placeholder }));
172
+ }
173
+ };
174
+ exports.getInput = getInput;
175
+ var getRequiredTooltipMessage = function (title, fieldNames) {
176
+ return (react_1.default.createElement("div", null,
177
+ react_1.default.createElement(antd_1.Row, null, title),
178
+ react_1.default.createElement(antd_1.Row, { wrap: false },
179
+ react_1.default.createElement("div", { className: "flex_direction_column", style: { minWidth: "100px" } },
180
+ 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); }))))));
181
+ };
182
+ exports.getRequiredTooltipMessage = getRequiredTooltipMessage;
183
+ var paymentMeansTypeFieldHasValues = function (paymentMeansTypeFieldDefinition) {
184
+ return paymentMeansTypeFieldDefinition &&
185
+ paymentMeansTypeFieldDefinition.hasOwnProperty("properties") &&
186
+ paymentMeansTypeFieldDefinition.properties.hasOwnProperty("values") &&
187
+ paymentMeansTypeFieldDefinition.properties.values !== undefined;
188
+ };
189
+ exports.paymentMeansTypeFieldHasValues = paymentMeansTypeFieldHasValues;
@@ -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,7 +1,9 @@
1
- import { MessageOutput } from "@unimaze/api-clients/lib/mapi";
1
+ import { ImportDocumentValidationData, MessageOutput } from "@unimaze/api-clients/lib/mapi";
2
2
  import { InvoiceMetadataInput, TransactionProcessingMode } from "@unimaze/api-clients/lib/mapi/api";
3
3
  import { AxiosPromise, CancelToken } from "axios";
4
4
  import { LanguageProp } from "../common/types/CommonProps";
5
+ import { UploadFile } from "antd/es/upload/interface";
6
+ import { IntlShape } from "react-intl";
5
7
  interface CreateSubmitInvoice {
6
8
  messageId: string;
7
9
  more: boolean;
@@ -18,6 +20,10 @@ interface AttachDocument {
18
20
  }
19
21
  declare const submitDocument: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey?: string) => AxiosPromise<MessageOutput>;
20
22
  declare const submitDocumentFetch: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey: string) => Promise<Response>;
21
- declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey: string, callName?: string, language?: LanguageProp) => AxiosPromise<MessageOutput>;
23
+ declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey: string, callName?: string, language?: LanguageProp) => AxiosPromise<MessageOutput | ImportDocumentValidationData[]>;
22
24
  export declare const getCancelToken: (callName: string, showMessage?: boolean) => CancelToken;
23
- export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument, submitDocumentFetch };
25
+ declare const submitAttachmentIfAnyLeft: (_messageId: string, _attachments: {
26
+ description: string;
27
+ file: UploadFile;
28
+ }[], _mapiBaseUrl: string, _chosenCustomerApiKey: string, intl: IntlShape) => void;
29
+ export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument, submitDocumentFetch, submitAttachmentIfAnyLeft };
@@ -14,10 +14,12 @@ 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.submitDocumentFetch = exports.submitDocument = exports.submitInvoice = exports.getCancelToken = void 0;
17
+ exports.submitAttachmentIfAnyLeft = exports.submitDocumentFetch = exports.submitDocument = exports.submitInvoice = exports.getCancelToken = void 0;
18
18
  var api_clients_1 = require("@unimaze/api-clients");
19
19
  var mapi_1 = require("@unimaze/api-clients/lib/mapi");
20
20
  var axios_1 = __importDefault(require("axios"));
21
+ var antd_1 = require("antd");
22
+ var create_invoice_1 = require("../create-invoice");
21
23
  var initialiseTransactionApi = function (mapiBaseUrl) {
22
24
  var apiConfig = {
23
25
  basePath: mapiBaseUrl,
@@ -76,7 +78,7 @@ exports.submitDocumentFetch = submitDocumentFetch;
76
78
  var submitInvoice = function (createSubmitInvoice, mapiBaseUrl, apiKey, callName, language) {
77
79
  var transactionApi = initialiseTransactionApi(mapiBaseUrl);
78
80
  var messageId = createSubmitInvoice.messageId, more = createSubmitInvoice.more, conversationIdentifier = createSubmitInvoice.conversationIdentifier, processingMode = createSubmitInvoice.processingMode, services = createSubmitInvoice.services, invoiceMetadataInput = createSubmitInvoice.invoiceMetadataInput;
79
- return transactionApi.createSubmitInvoice(messageId, more, conversationIdentifier, processingMode, services, invoiceMetadataInput, createOptions(apiKey, callName, language));
81
+ return transactionApi.createSubmitInvoice(messageId, more, conversationIdentifier, processingMode, services, undefined, invoiceMetadataInput, createOptions(apiKey, callName, language));
80
82
  };
81
83
  exports.submitInvoice = submitInvoice;
82
84
  var createOptions = function (apiKey, callName, language) {
@@ -103,3 +105,29 @@ var getCancelToken = function (callName, showMessage) {
103
105
  return window[callName].token;
104
106
  };
105
107
  exports.getCancelToken = getCancelToken;
108
+ var submitAttachmentIfAnyLeft = function (_messageId, _attachments, _mapiBaseUrl, _chosenCustomerApiKey, intl) {
109
+ if (_attachments && _attachments.length > 0) {
110
+ var nextFileArray = _attachments.splice(0, 1);
111
+ var nextFile = nextFileArray[0].file.originFileObj;
112
+ var nextFileDescription_1 = nextFileArray[0].description;
113
+ if (!nextFile)
114
+ throw new Error("NextFile is empty");
115
+ var createAttachDocument = {
116
+ messageId: _messageId,
117
+ contentType: nextFile.type,
118
+ more: _attachments.length > 0,
119
+ name: nextFileDescription_1, // nextFile.name,
120
+ };
121
+ submitDocumentFetch(nextFile, createAttachDocument, _mapiBaseUrl, _chosenCustomerApiKey)
122
+ .then(function (submitDocumentResponse) {
123
+ antd_1.message.success(intl.formatMessage(create_invoice_1.translationMessages.createInvoice_successfullyUploadedAttachmentMsg, { attachment: nextFileDescription_1 }));
124
+ submitAttachmentIfAnyLeft(_messageId, _attachments, _mapiBaseUrl, _chosenCustomerApiKey, intl);
125
+ })
126
+ .catch(function (documentSendingErrorMessage) {
127
+ antd_1.message.error("".concat(intl.formatMessage(create_invoice_1.translationMessages.createInvoice_ErrorUploadedAttachmentMsg, {
128
+ attachment: nextFileDescription_1,
129
+ }), " - ").concat(documentSendingErrorMessage.message));
130
+ });
131
+ }
132
+ };
133
+ exports.submitAttachmentIfAnyLeft = submitAttachmentIfAnyLeft;
@@ -5,6 +5,7 @@ import { BillingLineMetadataOverride } from "../common/types/BillingLineMetadata
5
5
  import React from "react";
6
6
  import { IntlShape } from "react-intl";
7
7
  import { DiscountType } from "../common/types/DiscountType";
8
+ import { AvailableTaxCategoryTypeEnum } from "../enums";
8
9
  export interface Totals {
9
10
  totalTaxableAmount: number;
10
11
  totalTaxAmount: number;
@@ -18,5 +19,7 @@ export declare const calculateTaxableAmount: (discountValue: string | null | und
18
19
  export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
19
20
  export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum | undefined) => number;
20
21
  export declare const generateTaxCategoryLabel: (taxCategoryType: TaxCategoryTypeEnum | undefined, taxCategoryTypeTranslated: string) => string;
21
- export declare const getCorrectInputNode: (dataIdx: keyof BillingLineMetadataOverride, intl: IntlShape, placeholder: string, required: boolean, addonAfter?: React.ReactNode, mobile?: boolean) => React.ReactChild;
22
+ export declare const getCorrectInputNode: (dataIdx: keyof BillingLineMetadataOverride, intl: IntlShape, placeholder: string, required: boolean, addonAfter?: React.ReactNode, mobile?: boolean, value?: any) => React.ReactChild;
22
23
  export declare const getTotals: (invoiceLines: BillingLineMetadataOverride[]) => Totals;
24
+ export declare const getTaxCategoryDisabled: (taxCategoryType: AvailableTaxCategoryTypeEnum, outsideVatScope: boolean) => boolean;
25
+ export declare const getFieldNames: (keys: string[], intl: IntlShape) => string[];
@@ -25,12 +25,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.getTotals = exports.getCorrectInputNode = exports.generateTaxCategoryLabel = exports.calculateTaxPercentage = exports.calculateTaxAmount = exports.calculateTaxableAmount = exports.calculateDiscountAmount = exports.billingLinesFieldsMetadata = void 0;
28
+ exports.getFieldNames = exports.getTaxCategoryDisabled = exports.getTotals = exports.getCorrectInputNode = exports.generateTaxCategoryLabel = exports.calculateTaxPercentage = exports.calculateTaxAmount = exports.calculateTaxableAmount = exports.calculateDiscountAmount = exports.billingLinesFieldsMetadata = void 0;
29
29
  var api_1 = require("@unimaze/api-clients/lib/mapi/api");
30
30
  var react_1 = __importDefault(require("react"));
31
31
  var antd_1 = require("antd");
32
32
  var CommonTranslations_1 = require("../common/components/CommonTranslations");
33
33
  var ConversionUtility_1 = require("./ConversionUtility");
34
+ var enums_1 = require("../enums");
35
+ var NewBillingLines_1 = require("../common/components/billing-lines/NewBillingLines");
36
+ var lodash_1 = require("lodash");
34
37
  var billingLinesFieldsMetadata = function (formInstance) {
35
38
  var billingLinesMetadata = formInstance.getFieldValue(["invoice", "invoiceLines"]);
36
39
  return billingLinesMetadata.map(function (billingLine) {
@@ -70,7 +73,7 @@ var calculateTaxableAmount = function (discountValue, quantity, unitPriceAmount,
70
73
  if (!quantity || !unitPriceAmount) {
71
74
  return 0;
72
75
  }
73
- if (discountValue) {
76
+ if ((0, lodash_1.isNaN)(discountValue)) {
74
77
  if (discountType === "PERCENTAGE") {
75
78
  return quantity * unitPriceAmount * ((100 - parseFloat(discountValue)) / 100);
76
79
  }
@@ -108,12 +111,12 @@ var generateTaxCategoryLabel = function (taxCategoryType, taxCategoryTypeTransla
108
111
  return taxCategoryType ? "".concat(taxCategoryTypeTranslated, " (").concat((0, exports.calculateTaxPercentage)(taxCategoryType), "%)") : "";
109
112
  };
110
113
  exports.generateTaxCategoryLabel = generateTaxCategoryLabel;
111
- var getCorrectInputNode = function (dataIdx, intl, placeholder, required, addonAfter, mobile) {
114
+ var getCorrectInputNode = function (dataIdx, intl, placeholder, required, addonAfter, mobile, value) {
112
115
  switch (dataIdx) {
113
116
  case "quantity":
114
117
  case "unitPriceAmount":
115
118
  case "discountValue":
116
- return (react_1.default.createElement(antd_1.InputNumber, { prefix: required ? react_1.default.createElement(antd_1.Typography.Text, { type: "danger" }, "*") : null, step: 1, style: { width: "100%" }, placeholder: placeholder, addonAfter: addonAfter }));
119
+ return (react_1.default.createElement(antd_1.InputNumber, { prefix: required ? react_1.default.createElement(antd_1.Typography.Text, { type: "danger" }, "*") : null, step: 1, style: { width: "100%" }, placeholder: placeholder, addonAfter: addonAfter, value: value }));
117
120
  case "unitOfMeasure":
118
121
  return (react_1.default.createElement(antd_1.Select, { popupMatchSelectWidth: false, placeholder: placeholder, style: { width: mobile ? 64 : "auto" } }, Object.keys(api_1.Units).map(function (unitOfMeasure) {
119
122
  if (unitOfMeasure !== "Rec20" && unitOfMeasure !== "Rec21")
@@ -156,3 +159,32 @@ var getTotals = function (invoiceLines) {
156
159
  return totals;
157
160
  };
158
161
  exports.getTotals = getTotals;
162
+ var getTaxCategoryDisabled = function (taxCategoryType, outsideVatScope) {
163
+ switch (taxCategoryType) {
164
+ case enums_1.AvailableTaxCategoryTypeEnum.StandardRated:
165
+ case enums_1.AvailableTaxCategoryTypeEnum.ReducedRated:
166
+ case enums_1.AvailableTaxCategoryTypeEnum.ZeroRated:
167
+ case enums_1.AvailableTaxCategoryTypeEnum.Exempt:
168
+ return outsideVatScope;
169
+ case enums_1.AvailableTaxCategoryTypeEnum.OutsideTaxScope:
170
+ return !outsideVatScope;
171
+ default:
172
+ return true;
173
+ }
174
+ };
175
+ exports.getTaxCategoryDisabled = getTaxCategoryDisabled;
176
+ var getFieldNames = function (keys, intl) {
177
+ return keys === null || keys === void 0 ? void 0 : keys.map(function (key) {
178
+ switch (key) {
179
+ case "name":
180
+ return intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_name);
181
+ case "quantity":
182
+ return intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_quantity);
183
+ case "unitPriceAmount":
184
+ return intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_unitPriceAmount);
185
+ default:
186
+ return "";
187
+ }
188
+ });
189
+ };
190
+ exports.getFieldNames = getFieldNames;
@@ -1,10 +1,11 @@
1
1
  /// <reference types="lodash" />
2
2
  import React from 'react';
3
3
  import { AvailableFields } from "../common/types/ReceiverRequirements";
4
- import { FieldDefinition, NewReceiverRequirements } from "../common/types/NewReceiverRequirements";
4
+ import { FieldDefinition, FieldValues, NewReceiverRequirements } from "../common/types/NewReceiverRequirements";
5
5
  import { FormItemProps, ValidateStatus } from "antd/lib/form/FormItem";
6
6
  import { NamePath } from "rc-field-form/es/interface";
7
7
  import { FormInstance } from "antd/es/form";
8
+ import { IntlShape } from "react-intl";
8
9
  export declare const getFieldRequirements: (receiverRequirements: NewReceiverRequirements, key: AvailableFields) => FieldDefinition | undefined;
9
10
  export declare const getFieldLabelOverride: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultLabel: string) => string | undefined;
10
11
  export declare const getFieldLabelTooltipOverride: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultLabelTooltip: React.ReactNode | string) => React.ReactNode | string | undefined;
@@ -16,3 +17,5 @@ export declare const handleValueValidation: import("lodash").DebouncedFunc<(isoN
16
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>;
17
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;
18
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[];
@@ -23,12 +23,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getRequiredTooltipMessage = exports.getInput = exports.debouncedHandleSearchValues = exports.handleValueValidation = exports.getFieldIsRequired = exports.getFieldPlaceholderOverride = exports.getFieldLabelTooltipOverride = exports.getFieldLabelOverride = exports.getFieldRequirements = void 0;
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
27
  var react_1 = __importDefault(require("react"));
28
+ var ReceiverRequirements_1 = require("../common/types/ReceiverRequirements");
28
29
  var lodash_1 = require("lodash");
29
30
  var axios_1 = __importDefault(require("axios"));
30
31
  var ApiUtility_1 = require("./ApiUtility");
31
32
  var antd_1 = require("antd");
33
+ var NewBillingLines_1 = require("../common/components/billing-lines/NewBillingLines");
32
34
  // export const getReceiverRequirements = (recRequirements: ReceiverRequirements, key: AvailableFields): FieldRequirement => {
33
35
  // return recRequirements[key]!;
34
36
  // };
@@ -53,6 +55,9 @@ var antd_1 = require("antd");
53
55
  // return defaultLabel;
54
56
  // };
55
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
+ }
56
61
  return receiverRequirements ? receiverRequirements.fieldDefinitions.find(function (field) { return field.key === key; }) : undefined;
57
62
  };
58
63
  exports.getFieldRequirements = getFieldRequirements;
@@ -180,3 +185,53 @@ var getRequiredTooltipMessage = function (title, fieldNames) {
180
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); }))))));
181
186
  };
182
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unimaze/billing",
3
- "version": "0.21.3",
3
+ "version": "0.21.5",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "dependencies": {
11
11
  "@ant-design/compatible": "latest",
12
- "@unimaze/api-clients": "3.1.1",
12
+ "@unimaze/api-clients": "3.2.0",
13
13
  "antd-mask-input": "^0.1.13",
14
14
  "dayjs": "^1.11.10",
15
15
  "lodash": "^4.17.21",