taxtank-core 0.12.4 → 0.13.2

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 (471) hide show
  1. package/bundles/taxtank-core.umd.js +2491 -2277
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/account-setup-item.collection.js +3 -2
  4. package/esm2015/lib/collections/collection.js +42 -26
  5. package/esm2015/lib/collections/income-source.collection.js +1 -8
  6. package/esm2015/lib/collections/report/property/property-report-item-depreciation.collection.js +2 -2
  7. package/esm2015/lib/collections/report/property/property-report-item-transaction.collection.js +2 -2
  8. package/esm2015/lib/collections/subscription/service-subscription.collection.js +17 -0
  9. package/esm2015/lib/db/Enums/subscription/service-payment-status.enum.js +6 -0
  10. package/esm2015/lib/db/Enums/subscription/service-price-list.enum.js +5 -0
  11. package/esm2015/lib/db/Enums/{service-price-recurring-interval.enum.js → subscription/service-price-recurring-interval.enum.js} +1 -1
  12. package/esm2015/lib/db/Enums/subscription/service-price-type.enum.js +6 -0
  13. package/esm2015/lib/db/Enums/subscription/service-product-id.enum.js +10 -0
  14. package/esm2015/lib/db/Enums/subscription/service-product-status.enum.js +6 -0
  15. package/esm2015/lib/db/Enums/{service-subscription-status.enum.js → subscription/service-subscription-status.enum.js} +1 -1
  16. package/esm2015/lib/db/Models/abstract-model.js +7 -0
  17. package/esm2015/lib/db/Models/address.js +3 -2
  18. package/esm2015/lib/db/Models/bank/bank-account-balance.js +4 -0
  19. package/esm2015/lib/db/Models/bank/bank-account-property.js +4 -0
  20. package/esm2015/lib/db/Models/bank/bank-account.js +4 -0
  21. package/esm2015/lib/db/Models/bank/bank-connection.js +4 -0
  22. package/esm2015/lib/db/Models/bank/bank-transaction-import.js +4 -0
  23. package/esm2015/lib/db/Models/bank/bank-transaction.js +4 -0
  24. package/esm2015/lib/db/Models/bank/bank.js +4 -0
  25. package/esm2015/lib/db/Models/bank/basiq-job.js +4 -0
  26. package/esm2015/lib/db/Models/bank/financial-data-system.js +4 -0
  27. package/esm2015/lib/db/Models/chart-accounts/chart-accounts-depreciation.js +4 -0
  28. package/esm2015/lib/db/Models/chart-accounts/chart-accounts-heading.js +4 -0
  29. package/esm2015/lib/db/Models/chart-accounts/chart-accounts-metadata.js +4 -0
  30. package/esm2015/lib/db/Models/chart-accounts/chart-accounts-value.js +4 -0
  31. package/esm2015/lib/db/Models/chart-accounts/chart-accounts.js +4 -0
  32. package/esm2015/lib/db/Models/country.js +3 -2
  33. package/esm2015/lib/db/Models/depreciation/depreciation-capital-project.js +4 -0
  34. package/esm2015/lib/db/Models/depreciation/depreciation-forecast.js +4 -0
  35. package/esm2015/lib/db/Models/depreciation/depreciation-receipt.js +4 -0
  36. package/esm2015/lib/db/Models/depreciation/depreciation.js +4 -0
  37. package/esm2015/lib/db/Models/document/document-folder.js +4 -0
  38. package/esm2015/lib/db/Models/document/document.js +4 -0
  39. package/esm2015/lib/db/Models/document/property-document.js +10 -0
  40. package/esm2015/lib/db/Models/firm/accountant/tax-review.js +4 -0
  41. package/esm2015/lib/db/Models/firm/accountant/ticket.js +4 -0
  42. package/esm2015/lib/db/Models/firm/chat.js +4 -0
  43. package/esm2015/lib/db/Models/firm/client-invite.js +4 -0
  44. package/esm2015/lib/db/Models/firm/client-movement.js +4 -0
  45. package/esm2015/lib/db/Models/firm/employee-invite.js +4 -0
  46. package/esm2015/lib/db/Models/firm/firm.js +4 -0
  47. package/esm2015/lib/db/Models/firm/message-document.js +4 -0
  48. package/esm2015/lib/db/Models/firm/message.js +4 -0
  49. package/esm2015/lib/db/Models/incomeSource/income-source-forecast.js +4 -0
  50. package/esm2015/lib/db/Models/incomeSource/income-source-type.js +4 -0
  51. package/esm2015/lib/db/Models/incomeSource/income-source.js +4 -0
  52. package/esm2015/lib/db/Models/incomeSource/salary-forecast.js +4 -0
  53. package/esm2015/lib/db/Models/loan/borrowing-expense-loan.js +4 -0
  54. package/esm2015/lib/db/Models/loan/borrowing-expense.js +4 -0
  55. package/esm2015/lib/db/Models/loan/loan-payout.js +4 -0
  56. package/esm2015/lib/db/Models/loan/loan.js +4 -0
  57. package/esm2015/lib/db/Models/phone.js +3 -2
  58. package/esm2015/lib/db/Models/property/property-category-movement.js +3 -2
  59. package/esm2015/lib/db/Models/property/property-category.js +3 -2
  60. package/esm2015/lib/db/Models/property/property-forecast.js +3 -2
  61. package/esm2015/lib/db/Models/property/property-sale/property-sale-tax-exemption-metadata.js +3 -2
  62. package/esm2015/lib/db/Models/property/property-sale/property-sale.js +3 -2
  63. package/esm2015/lib/db/Models/property/property-sale/tax-exemption-metadata.js +3 -2
  64. package/esm2015/lib/db/Models/property/property-sale/tax-exemption.js +3 -2
  65. package/esm2015/lib/db/Models/property/property-share.js +3 -2
  66. package/esm2015/lib/db/Models/property/property-subscription.js +3 -2
  67. package/esm2015/lib/db/Models/property/property-valuation.js +3 -2
  68. package/esm2015/lib/db/Models/property/property.js +3 -2
  69. package/esm2015/lib/db/Models/service-notification.js +3 -2
  70. package/esm2015/lib/db/Models/sole/sole-forecast.js +4 -0
  71. package/esm2015/lib/db/Models/subscription/service-payment.js +4 -0
  72. package/esm2015/lib/db/Models/subscription/service-price.js +4 -0
  73. package/esm2015/lib/db/Models/subscription/service-product.js +4 -0
  74. package/esm2015/lib/db/Models/subscription/service-subscription-item.js +4 -0
  75. package/esm2015/lib/db/Models/subscription/service-subscription.js +4 -0
  76. package/esm2015/lib/db/Models/tax-return/tax-return-category.js +4 -0
  77. package/esm2015/lib/db/Models/tax-return/tax-return-item.js +4 -0
  78. package/esm2015/lib/db/Models/tax-return/tax-return.js +4 -0
  79. package/esm2015/lib/db/Models/transaction/transaction-allocation.js +4 -0
  80. package/esm2015/lib/db/Models/transaction/transaction-base.js +26 -0
  81. package/esm2015/lib/db/Models/transaction/transaction-metadata.js +4 -0
  82. package/esm2015/lib/db/Models/transaction/transaction-receipt.js +4 -0
  83. package/esm2015/lib/db/Models/transaction/transaction.js +4 -0
  84. package/esm2015/lib/db/Models/user/client-details.js +4 -0
  85. package/esm2015/lib/db/Models/user/client-income-types.js +4 -0
  86. package/esm2015/lib/db/Models/user/employee-details.js +4 -0
  87. package/esm2015/lib/db/Models/user/occupation.js +4 -0
  88. package/esm2015/lib/db/Models/user/registration-invite.js +4 -0
  89. package/esm2015/lib/db/Models/user/user-event-setting.js +4 -0
  90. package/esm2015/lib/db/Models/user/user-event-type-category.js +4 -0
  91. package/esm2015/lib/db/Models/user/user-event-type.js +4 -0
  92. package/esm2015/lib/db/Models/user/user-event.js +4 -0
  93. package/esm2015/lib/db/Models/user/user.js +4 -0
  94. package/esm2015/lib/db/Models/vehicle/vehicle-claim.js +4 -0
  95. package/esm2015/lib/db/Models/vehicle/vehicle-logbook.js +4 -0
  96. package/esm2015/lib/db/Models/vehicle/vehicle.js +4 -0
  97. package/esm2015/lib/interfaces/document.interface.js +1 -1
  98. package/esm2015/lib/models/account-setup/account-setup-item.js +4 -1
  99. package/esm2015/lib/models/account-setup/account-setup-items.const.js +12 -8
  100. package/esm2015/lib/models/bank/bank-account-property.js +2 -2
  101. package/esm2015/lib/models/bank/bank-account.js +3 -3
  102. package/esm2015/lib/models/bank/bank-connection.js +2 -2
  103. package/esm2015/lib/models/bank/bank-transaction.js +2 -2
  104. package/esm2015/lib/models/bank/bank.js +2 -2
  105. package/esm2015/lib/models/bank/basiq-job.js +2 -2
  106. package/esm2015/lib/models/borrowing-expense/borrowing-expense-loan.js +2 -2
  107. package/esm2015/lib/models/borrowing-expense/borrowing-expense.js +2 -2
  108. package/esm2015/lib/models/chart-accounts/chart-accounts-depreciation.js +2 -2
  109. package/esm2015/lib/models/chart-accounts/chart-accounts-heading.js +2 -2
  110. package/esm2015/lib/models/chart-accounts/chart-accounts-metadata.js +2 -2
  111. package/esm2015/lib/models/chart-accounts/chart-accounts-value.js +2 -2
  112. package/esm2015/lib/models/chart-accounts/chart-accounts.js +2 -2
  113. package/esm2015/lib/models/chat/chat.js +2 -2
  114. package/esm2015/lib/models/chat/message-document.js +2 -2
  115. package/esm2015/lib/models/chat/message.js +2 -2
  116. package/esm2015/lib/models/client/client-details.js +2 -2
  117. package/esm2015/lib/models/client/client-income-types.js +2 -2
  118. package/esm2015/lib/models/client/client-invite.js +2 -2
  119. package/esm2015/lib/models/client/client-movement.js +2 -2
  120. package/esm2015/lib/models/depreciation/depreciation-capital-project.js +2 -2
  121. package/esm2015/lib/models/depreciation/depreciation-forecast.js +2 -2
  122. package/esm2015/lib/models/depreciation/depreciation-receipt.js +2 -2
  123. package/esm2015/lib/models/depreciation/depreciation.js +2 -2
  124. package/esm2015/lib/models/document/document-folder.js +2 -2
  125. package/esm2015/lib/models/document/document.js +2 -2
  126. package/esm2015/lib/models/employee/employee-details.js +2 -2
  127. package/esm2015/lib/models/employee/employee-invite.js +2 -2
  128. package/esm2015/lib/models/firm/firm.js +2 -2
  129. package/esm2015/lib/models/income-source/income-source-forecast.js +2 -2
  130. package/esm2015/lib/models/income-source/income-source-type.js +2 -2
  131. package/esm2015/lib/models/income-source/income-source.js +2 -2
  132. package/esm2015/lib/models/income-source/salary-forecast.js +2 -2
  133. package/esm2015/lib/models/income-source/sole-forecast.js +2 -2
  134. package/esm2015/lib/models/loan/loan-payout.js +2 -2
  135. package/esm2015/lib/models/loan/loan.js +2 -2
  136. package/esm2015/lib/models/logbook/vehicle-claim.js +2 -2
  137. package/esm2015/lib/models/logbook/vehicle-logbook.js +2 -2
  138. package/esm2015/lib/models/logbook/vehicle.js +2 -2
  139. package/esm2015/lib/models/property/property-document.js +2 -2
  140. package/esm2015/lib/models/property/property.js +1 -1
  141. package/esm2015/lib/models/registration-invite/registration-invite.js +2 -2
  142. package/esm2015/lib/models/service-subscription/service-payment.js +2 -2
  143. package/esm2015/lib/models/service-subscription/service-price.js +2 -2
  144. package/esm2015/lib/models/service-subscription/service-product.js +14 -6
  145. package/esm2015/lib/models/service-subscription/service-subscription-item.js +12 -3
  146. package/esm2015/lib/models/service-subscription/service-subscription.js +29 -12
  147. package/esm2015/lib/models/tax-review/tax-review.js +2 -2
  148. package/esm2015/lib/models/tax-summary/report-item.js +1 -1
  149. package/esm2015/lib/models/transaction/transaction-allocation.js +2 -2
  150. package/esm2015/lib/models/transaction/transaction-metadata.js +2 -2
  151. package/esm2015/lib/models/transaction/transaction-receipt.js +2 -2
  152. package/esm2015/lib/models/transaction/transaction.js +2 -2
  153. package/esm2015/lib/models/user/occupation.js +2 -2
  154. package/esm2015/lib/models/user/user.js +2 -2
  155. package/esm2015/lib/models/user-event/user-event-setting.js +2 -2
  156. package/esm2015/lib/models/user-event/user-event-type-category.js +2 -2
  157. package/esm2015/lib/models/user-event/user-event-type.js +2 -2
  158. package/esm2015/lib/services/account-setup/account-setup.service.js +32 -5
  159. package/esm2015/lib/services/http/bank/bank-account/bank-account.service.js +1 -1
  160. package/esm2015/lib/services/http/bank/bank-connection/bank-connection.service.js +1 -1
  161. package/esm2015/lib/services/http/bank/bank-transaction/bank-transaction.service.js +1 -1
  162. package/esm2015/lib/services/http/bank/bank.service.js +1 -1
  163. package/esm2015/lib/services/http/bank/basiq/basiq.service.js +1 -1
  164. package/esm2015/lib/services/http/chart-accounts/chart-accounts-depreciations/chart-accounts-depreciations.service.js +1 -1
  165. package/esm2015/lib/services/http/chart-accounts/chart-accounts.service.js +1 -1
  166. package/esm2015/lib/services/http/chat/chat.service.js +1 -1
  167. package/esm2015/lib/services/http/chat/message/message.service.js +1 -1
  168. package/esm2015/lib/services/http/chat/message-document/message-document.service.js +1 -1
  169. package/esm2015/lib/services/http/depreciation/depreciation-capital-project/depreciation-capital-project.service.js +1 -1
  170. package/esm2015/lib/services/http/depreciation/depreciation.service.js +1 -1
  171. package/esm2015/lib/services/http/document/document-folder/document-folder.service.js +1 -1
  172. package/esm2015/lib/services/http/firm/client-income/client-income-types.service.js +1 -1
  173. package/esm2015/lib/services/http/firm/client-invite/client-invite.service.js +1 -1
  174. package/esm2015/lib/services/http/firm/client-movement/client-movement.service.js +1 -1
  175. package/esm2015/lib/services/http/firm/employee/employee.service.js +1 -1
  176. package/esm2015/lib/services/http/firm/employee-invite/employee-invite.service.js +1 -1
  177. package/esm2015/lib/services/http/firm/firm.service.js +1 -1
  178. package/esm2015/lib/services/http/income-source/income-source-forecast/income-source-forecast.service.js +1 -1
  179. package/esm2015/lib/services/http/income-source/income-source.service.js +1 -1
  180. package/esm2015/lib/services/http/income-source/salary-forecast/salary-forecast.service.js +1 -1
  181. package/esm2015/lib/services/http/income-source/sole-forecast/sole-forecast.service.js +1 -1
  182. package/esm2015/lib/services/http/loan/loan.service.js +1 -1
  183. package/esm2015/lib/services/http/property/property-document/property-document.service.js +1 -1
  184. package/esm2015/lib/services/http/rest/rest.service.js +2 -2
  185. package/esm2015/lib/services/http/subscription/service-price.service.js +24 -0
  186. package/esm2015/lib/services/http/subscription/subscription.service.js +5 -48
  187. package/esm2015/lib/services/http/tax-review/tax-review-history/tax-review-history.service.js +1 -1
  188. package/esm2015/lib/services/http/tax-review/tax-review.service.js +1 -1
  189. package/esm2015/lib/services/http/transaction/transaction-allocation/transaction-allocation.service.js +1 -1
  190. package/esm2015/lib/services/http/transaction/transaction.service.js +1 -1
  191. package/esm2015/lib/services/http/user/user-event-setting/user-event-setting.service.js +1 -1
  192. package/esm2015/lib/services/http/user/user-event-type/user-event-type.service.js +1 -1
  193. package/esm2015/lib/services/http/user/user.service.js +1 -1
  194. package/esm2015/lib/services/http/vehicle/vehicle-claim.service.js +1 -1
  195. package/esm2015/lib/services/http/vehicle/vehicle-logbook.service.js +1 -1
  196. package/esm2015/lib/services/http/vehicle/vehicle.service.js +1 -1
  197. package/esm2015/public-api.js +9 -8
  198. package/fesm2015/taxtank-core.js +1258 -1183
  199. package/fesm2015/taxtank-core.js.map +1 -1
  200. package/lib/collections/collection.d.ts +13 -10
  201. package/lib/collections/income-source.collection.d.ts +0 -5
  202. package/lib/collections/{service-subscription.collection.d.ts → subscription/service-subscription.collection.d.ts} +2 -2
  203. package/lib/db/Enums/{service-payment-status.enum.d.ts → subscription/service-payment-status.enum.d.ts} +0 -0
  204. package/lib/db/Enums/subscription/service-price-list.enum.d.ts +3 -0
  205. package/lib/db/Enums/{service-price-recurring-interval.enum.d.ts → subscription/service-price-recurring-interval.enum.d.ts} +0 -0
  206. package/lib/db/Enums/{service-price-type.enum.d.ts → subscription/service-price-type.enum.d.ts} +0 -0
  207. package/lib/db/Enums/subscription/service-product-id.enum.d.ts +8 -0
  208. package/lib/db/Enums/subscription/service-product-status.enum.d.ts +4 -0
  209. package/lib/db/Enums/{service-subscription-status.enum.d.ts → subscription/service-subscription-status.enum.d.ts} +0 -0
  210. package/lib/db/Models/abstract-model.d.ts +3 -0
  211. package/lib/db/Models/address.d.ts +2 -1
  212. package/lib/db/Models/{bank-account-balance.d.ts → bank/bank-account-balance.d.ts} +2 -1
  213. package/lib/db/Models/bank/bank-account-property.d.ts +9 -0
  214. package/lib/db/Models/{bank-account.d.ts → bank/bank-account.d.ts} +6 -5
  215. package/lib/db/Models/{bank-connection.d.ts → bank/bank-connection.d.ts} +4 -3
  216. package/lib/db/Models/{bank-transaction-import.d.ts → bank/bank-transaction-import.d.ts} +2 -1
  217. package/lib/db/Models/{bank-transaction.d.ts → bank/bank-transaction.d.ts} +4 -3
  218. package/lib/db/Models/{bank.d.ts → bank/bank.d.ts} +2 -1
  219. package/lib/db/Models/{basiq-job.d.ts → bank/basiq-job.d.ts} +2 -1
  220. package/lib/db/Models/{financial-data-system.d.ts → bank/financial-data-system.d.ts} +2 -1
  221. package/lib/db/Models/{chart-accounts-depreciation.d.ts → chart-accounts/chart-accounts-depreciation.d.ts} +2 -1
  222. package/lib/db/Models/{chart-accounts-heading.d.ts → chart-accounts/chart-accounts-heading.d.ts} +2 -1
  223. package/lib/db/Models/chart-accounts/chart-accounts-metadata.d.ts +12 -0
  224. package/lib/db/Models/{chart-accounts-value.d.ts → chart-accounts/chart-accounts-value.d.ts} +2 -1
  225. package/lib/db/Models/{chart-accounts.d.ts → chart-accounts/chart-accounts.d.ts} +5 -4
  226. package/lib/db/Models/country.d.ts +2 -1
  227. package/lib/db/Models/depreciation/depreciation-capital-project.d.ts +14 -0
  228. package/lib/db/Models/{depreciation-forecast.d.ts → depreciation/depreciation-forecast.d.ts} +3 -2
  229. package/lib/db/Models/{depreciation-receipt.d.ts → depreciation/depreciation-receipt.d.ts} +2 -1
  230. package/lib/db/Models/{depreciation.d.ts → depreciation/depreciation.d.ts} +9 -9
  231. package/lib/db/Models/{document-folder.d.ts → document/document-folder.d.ts} +3 -2
  232. package/lib/db/Models/{document.d.ts → document/document.d.ts} +2 -1
  233. package/lib/db/Models/document/property-document.d.ts +18 -0
  234. package/lib/db/Models/firm/accountant/tax-review.d.ts +14 -0
  235. package/lib/db/Models/firm/accountant/ticket.d.ts +20 -0
  236. package/lib/db/Models/{chat.d.ts → firm/chat.d.ts} +4 -3
  237. package/lib/db/Models/firm/client-invite.d.ts +17 -0
  238. package/lib/db/Models/firm/client-movement.d.ts +13 -0
  239. package/lib/db/Models/firm/employee-invite.d.ts +10 -0
  240. package/lib/db/Models/{firm.d.ts → firm/firm.d.ts} +7 -6
  241. package/lib/db/Models/{message-document.d.ts → firm/message-document.d.ts} +3 -2
  242. package/lib/db/Models/{message.d.ts → firm/message.d.ts} +4 -3
  243. package/lib/db/Models/{income-source-forecast.d.ts → incomeSource/income-source-forecast.d.ts} +2 -1
  244. package/lib/db/Models/{income-source-type.d.ts → incomeSource/income-source-type.d.ts} +3 -2
  245. package/lib/db/Models/{income-source.d.ts → incomeSource/income-source.d.ts} +5 -4
  246. package/lib/db/Models/{salary-forecast.d.ts → incomeSource/salary-forecast.d.ts} +3 -2
  247. package/lib/db/Models/{borrowing-expense-loan.d.ts → loan/borrowing-expense-loan.d.ts} +3 -2
  248. package/lib/db/Models/loan/borrowing-expense.d.ts +8 -0
  249. package/lib/db/Models/{loan-payout.d.ts → loan/loan-payout.d.ts} +3 -2
  250. package/lib/db/Models/{loan.d.ts → loan/loan.d.ts} +9 -8
  251. package/lib/db/Models/phone.d.ts +2 -1
  252. package/lib/db/Models/property/property-category-movement.d.ts +3 -2
  253. package/lib/db/Models/property/property-category.d.ts +3 -2
  254. package/lib/db/Models/property/property-forecast.d.ts +2 -1
  255. package/lib/db/Models/property/property-sale/property-sale-tax-exemption-metadata.d.ts +2 -1
  256. package/lib/db/Models/property/property-sale/property-sale.d.ts +2 -1
  257. package/lib/db/Models/property/property-sale/tax-exemption-metadata.d.ts +2 -1
  258. package/lib/db/Models/property/property-sale/tax-exemption.d.ts +2 -1
  259. package/lib/db/Models/property/property-share.d.ts +4 -3
  260. package/lib/db/Models/property/property-subscription.d.ts +3 -2
  261. package/lib/db/Models/property/property-valuation.d.ts +3 -2
  262. package/lib/db/Models/property/property.d.ts +6 -5
  263. package/lib/db/Models/service-notification.d.ts +4 -3
  264. package/lib/db/Models/sole/sole-forecast.d.ts +9 -0
  265. package/lib/db/Models/{service-payment.d.ts → subscription/service-payment.d.ts} +3 -2
  266. package/lib/db/Models/{service-price.d.ts → subscription/service-price.d.ts} +4 -3
  267. package/lib/db/Models/subscription/service-product.d.ts +19 -0
  268. package/lib/db/Models/{service-subscription-item.d.ts → subscription/service-subscription-item.d.ts} +2 -1
  269. package/lib/db/Models/{service-subscription.d.ts → subscription/service-subscription.d.ts} +4 -3
  270. package/lib/db/Models/{tax-return-category.d.ts → tax-return/tax-return-category.d.ts} +3 -2
  271. package/lib/db/Models/{tax-return-item.d.ts → tax-return/tax-return-item.d.ts} +2 -1
  272. package/lib/db/Models/{tax-return.d.ts → tax-return/tax-return.d.ts} +2 -1
  273. package/lib/db/Models/transaction/transaction-allocation.d.ts +9 -0
  274. package/lib/db/Models/{transaction-base.d.ts → transaction/transaction-base.d.ts} +4 -3
  275. package/lib/db/Models/{transaction-metadata.d.ts → transaction/transaction-metadata.d.ts} +3 -2
  276. package/lib/db/Models/{transaction-receipt.d.ts → transaction/transaction-receipt.d.ts} +2 -1
  277. package/lib/db/Models/{transaction.d.ts → transaction/transaction.d.ts} +9 -9
  278. package/lib/db/Models/{client-details.d.ts → user/client-details.d.ts} +7 -6
  279. package/lib/db/Models/{client-income-types.d.ts → user/client-income-types.d.ts} +2 -1
  280. package/lib/db/Models/user/employee-details.d.ts +8 -0
  281. package/lib/db/Models/user/occupation.d.ts +6 -0
  282. package/lib/db/Models/{registration-invite.d.ts → user/registration-invite.d.ts} +3 -2
  283. package/lib/db/Models/{user-event-setting.d.ts → user/user-event-setting.d.ts} +2 -1
  284. package/lib/db/Models/user/user-event-type-category.d.ts +5 -0
  285. package/lib/db/Models/{user-event-type.d.ts → user/user-event-type.d.ts} +3 -2
  286. package/lib/db/Models/{user-event.d.ts → user/user-event.d.ts} +3 -2
  287. package/lib/db/Models/{user.d.ts → user/user.d.ts} +14 -13
  288. package/lib/db/Models/vehicle/vehicle-claim.d.ts +14 -0
  289. package/lib/db/Models/{vehicle-logbook.d.ts → vehicle/vehicle-logbook.d.ts} +4 -3
  290. package/lib/db/Models/vehicle/vehicle.d.ts +11 -0
  291. package/lib/models/account-setup/account-setup-item.d.ts +1 -0
  292. package/lib/models/bank/bank-account-property.d.ts +1 -1
  293. package/lib/models/bank/bank-account.d.ts +2 -2
  294. package/lib/models/bank/bank-connection.d.ts +1 -1
  295. package/lib/models/bank/bank-transaction.d.ts +1 -1
  296. package/lib/models/bank/bank.d.ts +1 -1
  297. package/lib/models/bank/basiq-job.d.ts +1 -1
  298. package/lib/models/borrowing-expense/borrowing-expense-loan.d.ts +1 -1
  299. package/lib/models/borrowing-expense/borrowing-expense.d.ts +1 -1
  300. package/lib/models/chart-accounts/chart-accounts-depreciation.d.ts +1 -1
  301. package/lib/models/chart-accounts/chart-accounts-heading.d.ts +1 -1
  302. package/lib/models/chart-accounts/chart-accounts-metadata.d.ts +1 -1
  303. package/lib/models/chart-accounts/chart-accounts-value.d.ts +1 -1
  304. package/lib/models/chart-accounts/chart-accounts.d.ts +1 -1
  305. package/lib/models/chat/chat.d.ts +1 -1
  306. package/lib/models/chat/message-document.d.ts +1 -1
  307. package/lib/models/chat/message.d.ts +1 -1
  308. package/lib/models/client/client-details.d.ts +1 -1
  309. package/lib/models/client/client-income-types.d.ts +1 -1
  310. package/lib/models/client/client-invite.d.ts +1 -1
  311. package/lib/models/client/client-movement.d.ts +1 -1
  312. package/lib/models/depreciation/depreciation-capital-project.d.ts +1 -1
  313. package/lib/models/depreciation/depreciation-forecast.d.ts +1 -1
  314. package/lib/models/depreciation/depreciation-receipt.d.ts +1 -1
  315. package/lib/models/depreciation/depreciation.d.ts +3 -3
  316. package/lib/models/document/document-folder.d.ts +1 -1
  317. package/lib/models/document/document.d.ts +1 -1
  318. package/lib/models/employee/employee-details.d.ts +1 -1
  319. package/lib/models/employee/employee-invite.d.ts +1 -1
  320. package/lib/models/firm/firm.d.ts +1 -1
  321. package/lib/models/income-source/income-source-forecast.d.ts +1 -1
  322. package/lib/models/income-source/income-source-type.d.ts +1 -1
  323. package/lib/models/income-source/income-source.d.ts +1 -1
  324. package/lib/models/income-source/salary-forecast.d.ts +1 -1
  325. package/lib/models/income-source/sole-forecast.d.ts +1 -1
  326. package/lib/models/loan/loan-payout.d.ts +1 -1
  327. package/lib/models/loan/loan.d.ts +1 -1
  328. package/lib/models/logbook/vehicle-claim.d.ts +1 -1
  329. package/lib/models/logbook/vehicle-logbook.d.ts +1 -1
  330. package/lib/models/logbook/vehicle.d.ts +1 -1
  331. package/lib/models/property/property-document.d.ts +1 -1
  332. package/lib/models/property/property.d.ts +0 -2
  333. package/lib/models/registration-invite/registration-invite.d.ts +1 -1
  334. package/lib/models/service-subscription/service-payment.d.ts +1 -1
  335. package/lib/models/service-subscription/service-price.d.ts +1 -1
  336. package/lib/models/service-subscription/service-product.d.ts +5 -3
  337. package/lib/models/service-subscription/service-subscription-item.d.ts +1 -1
  338. package/lib/models/service-subscription/service-subscription.d.ts +13 -3
  339. package/lib/models/tax-review/tax-review.d.ts +1 -1
  340. package/lib/models/tax-summary/report-item.d.ts +1 -1
  341. package/lib/models/transaction/transaction-allocation.d.ts +1 -1
  342. package/lib/models/transaction/transaction-metadata.d.ts +1 -1
  343. package/lib/models/transaction/transaction-receipt.d.ts +1 -1
  344. package/lib/models/transaction/transaction.d.ts +1 -1
  345. package/lib/models/user/occupation.d.ts +1 -1
  346. package/lib/models/user/user.d.ts +1 -1
  347. package/lib/models/user-event/user-event-setting.d.ts +1 -1
  348. package/lib/models/user-event/user-event-type-category.d.ts +1 -1
  349. package/lib/models/user-event/user-event-type.d.ts +1 -1
  350. package/lib/services/account-setup/account-setup.service.d.ts +14 -1
  351. package/lib/services/http/bank/bank-account/bank-account.service.d.ts +1 -1
  352. package/lib/services/http/bank/bank-connection/bank-connection.service.d.ts +1 -1
  353. package/lib/services/http/bank/bank-transaction/bank-transaction.service.d.ts +1 -1
  354. package/lib/services/http/bank/bank.service.d.ts +1 -1
  355. package/lib/services/http/bank/basiq/basiq.service.d.ts +1 -1
  356. package/lib/services/http/chart-accounts/chart-accounts-depreciations/chart-accounts-depreciations.service.d.ts +1 -1
  357. package/lib/services/http/chat/chat.service.d.ts +1 -1
  358. package/lib/services/http/chat/message/message.service.d.ts +1 -1
  359. package/lib/services/http/depreciation/depreciation.service.d.ts +1 -1
  360. package/lib/services/http/document/document-folder/document-folder.service.d.ts +1 -1
  361. package/lib/services/http/firm/client-invite/client-invite.service.d.ts +1 -1
  362. package/lib/services/http/firm/client-movement/client-movement.service.d.ts +1 -1
  363. package/lib/services/http/firm/employee/employee.service.d.ts +1 -1
  364. package/lib/services/http/firm/employee-invite/employee-invite.service.d.ts +1 -1
  365. package/lib/services/http/income-source/income-source-forecast/income-source-forecast.service.d.ts +1 -1
  366. package/lib/services/http/income-source/income-source.service.d.ts +1 -1
  367. package/lib/services/http/income-source/salary-forecast/salary-forecast.service.d.ts +1 -1
  368. package/lib/services/http/income-source/sole-forecast/sole-forecast.service.d.ts +1 -1
  369. package/lib/services/http/loan/loan.service.d.ts +1 -1
  370. package/lib/services/http/property/property-document/property-document.service.d.ts +1 -1
  371. package/lib/services/http/rest/rest.service.d.ts +1 -1
  372. package/lib/services/http/subscription/service-price.service.d.ts +14 -0
  373. package/lib/services/http/subscription/subscription.service.d.ts +2 -9
  374. package/lib/services/http/tax-review/tax-review-history/tax-review-history.service.d.ts +1 -1
  375. package/lib/services/http/tax-review/tax-review.service.d.ts +1 -1
  376. package/lib/services/http/transaction/transaction-allocation/transaction-allocation.service.d.ts +1 -1
  377. package/lib/services/http/transaction/transaction.service.d.ts +1 -1
  378. package/lib/services/http/user/user-event-setting/user-event-setting.service.d.ts +1 -1
  379. package/lib/services/http/user/user-event-type/user-event-type.service.d.ts +1 -1
  380. package/lib/services/http/vehicle/vehicle-claim.service.d.ts +1 -1
  381. package/lib/services/http/vehicle/vehicle.service.d.ts +1 -1
  382. package/package.json +1 -1
  383. package/public-api.d.ts +8 -7
  384. package/esm2015/lib/collections/service-price.collection.js +0 -10
  385. package/esm2015/lib/collections/service-subscription.collection.js +0 -17
  386. package/esm2015/lib/db/Enums/service-payment-status.enum.js +0 -6
  387. package/esm2015/lib/db/Enums/service-price-type.enum.js +0 -6
  388. package/esm2015/lib/db/Models/bank-account-balance.js +0 -3
  389. package/esm2015/lib/db/Models/bank-account-property.js +0 -3
  390. package/esm2015/lib/db/Models/bank-account.js +0 -3
  391. package/esm2015/lib/db/Models/bank-connection.js +0 -3
  392. package/esm2015/lib/db/Models/bank-transaction-import.js +0 -3
  393. package/esm2015/lib/db/Models/bank-transaction.js +0 -3
  394. package/esm2015/lib/db/Models/bank.js +0 -3
  395. package/esm2015/lib/db/Models/basiq-job.js +0 -3
  396. package/esm2015/lib/db/Models/borrowing-expense-loan.js +0 -3
  397. package/esm2015/lib/db/Models/borrowing-expense.js +0 -3
  398. package/esm2015/lib/db/Models/chart-accounts-depreciation.js +0 -3
  399. package/esm2015/lib/db/Models/chart-accounts-heading.js +0 -3
  400. package/esm2015/lib/db/Models/chart-accounts-metadata.js +0 -3
  401. package/esm2015/lib/db/Models/chart-accounts-value.js +0 -3
  402. package/esm2015/lib/db/Models/chart-accounts.js +0 -3
  403. package/esm2015/lib/db/Models/chat.js +0 -3
  404. package/esm2015/lib/db/Models/client-details.js +0 -3
  405. package/esm2015/lib/db/Models/client-income-types.js +0 -3
  406. package/esm2015/lib/db/Models/client-invite.js +0 -3
  407. package/esm2015/lib/db/Models/client-movement.js +0 -3
  408. package/esm2015/lib/db/Models/depreciation-capital-project.js +0 -3
  409. package/esm2015/lib/db/Models/depreciation-forecast.js +0 -3
  410. package/esm2015/lib/db/Models/depreciation-receipt.js +0 -3
  411. package/esm2015/lib/db/Models/depreciation.js +0 -4
  412. package/esm2015/lib/db/Models/document-folder.js +0 -3
  413. package/esm2015/lib/db/Models/document.js +0 -3
  414. package/esm2015/lib/db/Models/employee-details.js +0 -3
  415. package/esm2015/lib/db/Models/employee-invite.js +0 -3
  416. package/esm2015/lib/db/Models/financial-data-system.js +0 -3
  417. package/esm2015/lib/db/Models/firm.js +0 -3
  418. package/esm2015/lib/db/Models/income-source-forecast.js +0 -3
  419. package/esm2015/lib/db/Models/income-source-type.js +0 -3
  420. package/esm2015/lib/db/Models/income-source.js +0 -3
  421. package/esm2015/lib/db/Models/loan-payout.js +0 -3
  422. package/esm2015/lib/db/Models/loan.js +0 -3
  423. package/esm2015/lib/db/Models/message-document.js +0 -3
  424. package/esm2015/lib/db/Models/message.js +0 -3
  425. package/esm2015/lib/db/Models/occupation.js +0 -3
  426. package/esm2015/lib/db/Models/property/property-document.js +0 -3
  427. package/esm2015/lib/db/Models/registration-invite.js +0 -3
  428. package/esm2015/lib/db/Models/salary-forecast.js +0 -3
  429. package/esm2015/lib/db/Models/service-payment.js +0 -3
  430. package/esm2015/lib/db/Models/service-price.js +0 -3
  431. package/esm2015/lib/db/Models/service-product.js +0 -3
  432. package/esm2015/lib/db/Models/service-subscription-item.js +0 -3
  433. package/esm2015/lib/db/Models/service-subscription.js +0 -3
  434. package/esm2015/lib/db/Models/sole-forecast.js +0 -3
  435. package/esm2015/lib/db/Models/tax-return-category.js +0 -3
  436. package/esm2015/lib/db/Models/tax-return-item.js +0 -3
  437. package/esm2015/lib/db/Models/tax-return.js +0 -3
  438. package/esm2015/lib/db/Models/tax-review.js +0 -3
  439. package/esm2015/lib/db/Models/ticket.js +0 -3
  440. package/esm2015/lib/db/Models/transaction-allocation.js +0 -3
  441. package/esm2015/lib/db/Models/transaction-base.js +0 -25
  442. package/esm2015/lib/db/Models/transaction-metadata.js +0 -3
  443. package/esm2015/lib/db/Models/transaction-receipt.js +0 -3
  444. package/esm2015/lib/db/Models/transaction.js +0 -4
  445. package/esm2015/lib/db/Models/user-event-setting.js +0 -3
  446. package/esm2015/lib/db/Models/user-event-type-category.js +0 -3
  447. package/esm2015/lib/db/Models/user-event-type.js +0 -3
  448. package/esm2015/lib/db/Models/user-event.js +0 -3
  449. package/esm2015/lib/db/Models/user.js +0 -3
  450. package/esm2015/lib/db/Models/vehicle-claim.js +0 -3
  451. package/esm2015/lib/db/Models/vehicle-logbook.js +0 -3
  452. package/esm2015/lib/db/Models/vehicle.js +0 -3
  453. package/lib/collections/service-price.collection.d.ts +0 -6
  454. package/lib/db/Models/bank-account-property.d.ts +0 -8
  455. package/lib/db/Models/borrowing-expense.d.ts +0 -7
  456. package/lib/db/Models/chart-accounts-metadata.d.ts +0 -11
  457. package/lib/db/Models/client-invite.d.ts +0 -16
  458. package/lib/db/Models/client-movement.d.ts +0 -12
  459. package/lib/db/Models/depreciation-capital-project.d.ts +0 -13
  460. package/lib/db/Models/employee-details.d.ts +0 -7
  461. package/lib/db/Models/employee-invite.d.ts +0 -9
  462. package/lib/db/Models/occupation.d.ts +0 -5
  463. package/lib/db/Models/property/property-document.d.ts +0 -13
  464. package/lib/db/Models/service-product.d.ts +0 -12
  465. package/lib/db/Models/sole-forecast.d.ts +0 -8
  466. package/lib/db/Models/tax-review.d.ts +0 -13
  467. package/lib/db/Models/ticket.d.ts +0 -19
  468. package/lib/db/Models/transaction-allocation.d.ts +0 -8
  469. package/lib/db/Models/user-event-type-category.d.ts +0 -4
  470. package/lib/db/Models/vehicle-claim.d.ts +0 -13
  471. package/lib/db/Models/vehicle.d.ts +0 -10
@@ -13,14 +13,15 @@ import flatten from 'lodash/flatten';
13
13
  import hasIn from 'lodash/hasIn';
14
14
  import first from 'lodash/first';
15
15
  import last from 'lodash/last';
16
+ import compact from 'lodash/compact';
16
17
  import uniqBy from 'lodash/uniqBy';
17
18
  import concat from 'lodash/concat';
18
- import compact from 'lodash/compact';
19
19
  import { __decorate, __awaiter } from 'tslib';
20
20
  import * as moment from 'moment';
21
21
  import { DateRange } from 'moment-range';
22
22
  import cloneDeep$1 from 'lodash/cloneDeep';
23
23
  import { Validators, FormGroup, FormControl } from '@angular/forms';
24
+ import fromPairs from 'lodash/fromPairs';
24
25
  import _ from 'lodash';
25
26
  import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource.min.js';
26
27
  import * as i1$1 from '@angular/router';
@@ -874,9 +875,44 @@ class Collection {
874
875
  create(items = []) {
875
876
  return new this.constructor(items);
876
877
  }
878
+ /**
879
+ * Iterator that allow to iterate collection items
880
+ */
881
+ [Symbol.iterator]() {
882
+ return this.items.values();
883
+ }
884
+ get first() {
885
+ return first(this.items);
886
+ }
887
+ get last() {
888
+ return last(this.items);
889
+ }
890
+ push(item) {
891
+ return this.items.push(item);
892
+ }
893
+ replaceBy(path, item) {
894
+ const index = this.findIndexBy(path, get(item, path));
895
+ if (index >= 0) {
896
+ this.items.splice(index, 1, item);
897
+ }
898
+ return this;
899
+ }
900
+ removeBy(path, item) {
901
+ const index = this.findIndexBy(path, get(item, path));
902
+ if (index >= 0) {
903
+ this.items.splice(index, 1);
904
+ }
905
+ return this;
906
+ }
907
+ toArray() {
908
+ return [...this.items];
909
+ }
877
910
  groupBy(path = '') {
878
911
  return new CollectionDictionary(this, path);
879
912
  }
913
+ /**
914
+ * @TODO remove and use dictionary instead
915
+ */
880
916
  indexBy(path) {
881
917
  // Create empty initial object for groups
882
918
  const result = {};
@@ -885,13 +921,6 @@ class Collection {
885
921
  });
886
922
  return result;
887
923
  }
888
- /**
889
- * Iterator that allow to iterate collection items
890
- */
891
- [Symbol.iterator]() {
892
- // .values() returns Iterator instance for array
893
- return this.items.values();
894
- }
895
924
  /**
896
925
  * get collection length
897
926
  */
@@ -904,30 +933,24 @@ class Collection {
904
933
  getIds() {
905
934
  return this.items.map((item) => item['id']);
906
935
  }
907
- findBy(path, value) {
908
- return this.items.find((item) => get(item, path) === value);
909
- }
910
936
  getBy(path, value) {
911
937
  return this.create(this.items.filter((item) => get(item, path) === value));
912
938
  }
913
- /**
914
- * Get single item by id
915
- */
916
- getById(id) {
917
- return this.items.find((item) => item['id'] === id);
918
- }
919
939
  getByIds(ids) {
920
940
  return this.items.filter((item) => ids.includes(item['id']));
921
941
  }
942
+ findBy(path, value) {
943
+ return this.items.find((item) => get(item, path) === value);
944
+ }
945
+ findIndexBy(path, value) {
946
+ return this.items.findIndex((item) => get(item, path) === value);
947
+ }
922
948
  /**
923
949
  * Get total sum of items by field
924
950
  */
925
951
  sumBy(path) {
926
952
  return +this.items.reduce((sum, item) => sum + Number(get(item, path)), 0).toFixed(2);
927
953
  }
928
- toArray() {
929
- return [...this.items];
930
- }
931
954
  /**
932
955
  * Filter items by specific provided callback
933
956
  */
@@ -940,12 +963,6 @@ class Collection {
940
963
  sortBy(field = 'id', isDesc = true) {
941
964
  sort(this.items, field, isDesc);
942
965
  }
943
- get first() {
944
- return first(this.items);
945
- }
946
- get last() {
947
- return last(this.items);
948
- }
949
966
  getByDateRange(from, to, dateField = 'date') {
950
967
  return this.create(this.items.filter((item) => item[dateField] >= from && item[dateField] <= to));
951
968
  }
@@ -953,7 +970,7 @@ class Collection {
953
970
 
954
971
  class AccountSetupItemCollection extends Collection {
955
972
  constructor(items) {
956
- super(items);
973
+ super(compact(items));
957
974
  this.sortBy('isCompleted', false);
958
975
  }
959
976
  isCompleted() {
@@ -1602,13 +1619,6 @@ class IncomeSourceCollection extends Collection {
1602
1619
  filterByTypes(types) {
1603
1620
  return this.items.filter((incomeSource) => types.includes(incomeSource.type));
1604
1621
  }
1605
- /**
1606
- * Get income source by provided Id
1607
- * @param id
1608
- */
1609
- getById(id) {
1610
- return this.items.find((incomeSource) => incomeSource.id === id);
1611
- }
1612
1622
  /**
1613
1623
  * Get income sources list of forecasts
1614
1624
  */
@@ -1909,7 +1919,13 @@ const CHART_ACCOUNTS_CATEGORIES = {
1909
1919
  ]
1910
1920
  };
1911
1921
 
1912
- class TransactionBase {
1922
+ class AbstractModel {
1923
+ hasValue(value, path = 'id') {
1924
+ return get(path) === value;
1925
+ }
1926
+ }
1927
+
1928
+ class TransactionBase extends AbstractModel {
1913
1929
  /**
1914
1930
  * Check if current tank is Property
1915
1931
  */
@@ -1983,7 +1999,7 @@ var ChartAccountsListEnum;
1983
1999
  ChartAccountsListEnum[ChartAccountsListEnum["TAX_OFFSETS_N_R_A_S"] = 571] = "TAX_OFFSETS_N_R_A_S";
1984
2000
  })(ChartAccountsListEnum || (ChartAccountsListEnum = {}));
1985
2001
 
1986
- class DepreciationCapitalProject$1 {
2002
+ class DepreciationCapitalProject$1 extends AbstractModel {
1987
2003
  }
1988
2004
 
1989
2005
  class DepreciationCapitalProject extends DepreciationCapitalProject$1 {
@@ -1992,7 +2008,7 @@ __decorate([
1992
2008
  Type(() => Date)
1993
2009
  ], DepreciationCapitalProject.prototype, "effectiveDate", void 0);
1994
2010
 
1995
- class DepreciationForecast$1 {
2011
+ class DepreciationForecast$1 extends AbstractModel {
1996
2012
  }
1997
2013
 
1998
2014
  class DepreciationForecast extends DepreciationForecast$1 {
@@ -2026,16 +2042,16 @@ class DepreciationForecast extends DepreciationForecast$1 {
2026
2042
  }
2027
2043
  }
2028
2044
 
2029
- class ChartAccounts$1 {
2045
+ class ChartAccounts$1 extends AbstractModel {
2030
2046
  }
2031
2047
 
2032
- class ChartAccountsHeading$1 {
2048
+ class ChartAccountsHeading$1 extends AbstractModel {
2033
2049
  }
2034
2050
 
2035
2051
  class ChartAccountsHeading extends ChartAccountsHeading$1 {
2036
2052
  }
2037
2053
 
2038
- class ChartAccountsMetadata$1 {
2054
+ class ChartAccountsMetadata$1 extends AbstractModel {
2039
2055
  }
2040
2056
 
2041
2057
  var ChartAccountsMetadataListEnum;
@@ -2212,7 +2228,7 @@ __decorate([
2212
2228
  Type(() => ChartAccountsMetadata)
2213
2229
  ], ChartAccounts.prototype, "metadata", void 0);
2214
2230
 
2215
- class BankTransaction$1 {
2231
+ class BankTransaction$1 extends AbstractModel {
2216
2232
  }
2217
2233
 
2218
2234
  var BankTransactionTypeEnum;
@@ -2236,13 +2252,13 @@ var TransactionTypeEnum;
2236
2252
  TransactionTypeEnum[TransactionTypeEnum["CREDIT"] = 2] = "CREDIT";
2237
2253
  })(TransactionTypeEnum || (TransactionTypeEnum = {}));
2238
2254
 
2239
- class Property$1 {
2255
+ class Property$1 extends AbstractModel {
2240
2256
  }
2241
2257
 
2242
- class PropertySubscription$1 {
2258
+ class PropertySubscription$1 extends AbstractModel {
2243
2259
  }
2244
2260
 
2245
- class User$1 {
2261
+ class User$1 extends AbstractModel {
2246
2262
  }
2247
2263
 
2248
2264
  var UserStatusEnum;
@@ -2268,10 +2284,10 @@ var UserRolesEnum;
2268
2284
  UserRolesEnum["SWITCH_USER"] = "ROLE_PREVIOUS_ADMIN";
2269
2285
  })(UserRolesEnum || (UserRolesEnum = {}));
2270
2286
 
2271
- class Address$1 {
2287
+ class Address$1 extends AbstractModel {
2272
2288
  }
2273
2289
 
2274
- class Country$1 {
2290
+ class Country$1 extends AbstractModel {
2275
2291
  }
2276
2292
 
2277
2293
  class Country extends Country$1 {
@@ -2320,19 +2336,19 @@ const USER_WORK_POSITION = {
2320
2336
  [UserRolesEnum.FIRM_OWNER]: 'Firm Owner'
2321
2337
  };
2322
2338
 
2323
- class ClientDetails$1 {
2339
+ class ClientDetails$1 extends AbstractModel {
2324
2340
  }
2325
2341
 
2326
2342
  class ClientDetails extends ClientDetails$1 {
2327
2343
  }
2328
2344
 
2329
- class EmployeeDetails$1 {
2345
+ class EmployeeDetails$1 extends AbstractModel {
2330
2346
  }
2331
2347
 
2332
- class Firm$1 {
2348
+ class Firm$1 extends AbstractModel {
2333
2349
  }
2334
2350
 
2335
- class Phone$1 {
2351
+ class Phone$1 extends AbstractModel {
2336
2352
  }
2337
2353
 
2338
2354
  var PhoneTypeEnum;
@@ -2381,24 +2397,46 @@ __decorate([
2381
2397
  Type(() => Firm)
2382
2398
  ], EmployeeDetails.prototype, "firm", void 0);
2383
2399
 
2384
- class ServiceSubscription$1 {
2400
+ class ServiceSubscription$1 extends AbstractModel {
2385
2401
  }
2386
2402
 
2387
- class ServiceSubscriptionItem$1 {
2403
+ class ServiceSubscriptionItem$1 extends AbstractModel {
2388
2404
  }
2389
2405
 
2390
- class ServicePrice$1 {
2406
+ class ServicePrice$1 extends AbstractModel {
2391
2407
  }
2392
2408
 
2393
- class ServiceProduct$1 {
2409
+ class ServiceProduct$1 extends AbstractModel {
2394
2410
  }
2395
2411
 
2412
+ var ServiceProductStatusEnum;
2413
+ (function (ServiceProductStatusEnum) {
2414
+ ServiceProductStatusEnum[ServiceProductStatusEnum["ARCHIVED"] = 0] = "ARCHIVED";
2415
+ ServiceProductStatusEnum[ServiceProductStatusEnum["ACTIVE"] = 1] = "ACTIVE";
2416
+ })(ServiceProductStatusEnum || (ServiceProductStatusEnum = {}));
2417
+
2418
+ var ServiceProductIdEnum;
2419
+ (function (ServiceProductIdEnum) {
2420
+ ServiceProductIdEnum[ServiceProductIdEnum["WORK_TANK_OLD"] = 1] = "WORK_TANK_OLD";
2421
+ ServiceProductIdEnum[ServiceProductIdEnum["PROPERTY_OLD"] = 2] = "PROPERTY_OLD";
2422
+ ServiceProductIdEnum[ServiceProductIdEnum["PROPERTY_TANK"] = 3] = "PROPERTY_TANK";
2423
+ ServiceProductIdEnum[ServiceProductIdEnum["WORK_TANK"] = 4] = "WORK_TANK";
2424
+ ServiceProductIdEnum[ServiceProductIdEnum["PROPERTIES"] = 5] = "PROPERTIES";
2425
+ ServiceProductIdEnum[ServiceProductIdEnum["SOLE_TANK"] = 6] = "SOLE_TANK";
2426
+ })(ServiceProductIdEnum || (ServiceProductIdEnum = {}));
2427
+
2396
2428
  class ServiceProduct extends ServiceProduct$1 {
2397
- isProperty() {
2398
- return this.title === 'Property';
2429
+ isProperties() {
2430
+ return [ServiceProductIdEnum.PROPERTY_OLD, ServiceProductIdEnum.PROPERTIES].includes(this.id);
2399
2431
  }
2400
- isWork() {
2401
- return this.title === 'Work Tank';
2432
+ isWorkTank() {
2433
+ return [ServiceProductIdEnum.WORK_TANK_OLD, ServiceProductIdEnum.WORK_TANK].includes(this.id);
2434
+ }
2435
+ isSoleTank() {
2436
+ return this.id === ServiceProductIdEnum.SOLE_TANK;
2437
+ }
2438
+ isArchived() {
2439
+ return this.status === ServiceProductStatusEnum.ARCHIVED;
2402
2440
  }
2403
2441
  }
2404
2442
 
@@ -2408,9 +2446,22 @@ __decorate([
2408
2446
  Type(() => ServiceProduct)
2409
2447
  ], ServicePrice.prototype, "product", void 0);
2410
2448
 
2449
+ var ServicePriceListEnum;
2450
+ (function (ServicePriceListEnum) {
2451
+ ServicePriceListEnum[ServicePriceListEnum["PROPERTIES"] = 5] = "PROPERTIES";
2452
+ })(ServicePriceListEnum || (ServicePriceListEnum = {}));
2453
+
2454
+ /**
2455
+ * backend bd doesn't support dynamic prices, as far as we have just one product like that we keep it hardcoded
2456
+ */
2457
+ const PROPERTY_TANK_PRICE = 9;
2411
2458
  class ServiceSubscriptionItem extends ServiceSubscriptionItem$1 {
2412
2459
  get total() {
2413
- return this.price.amount * this.quantity;
2460
+ let price = this.price.amount * this.quantity;
2461
+ if (this.price.id === ServicePriceListEnum.PROPERTIES) {
2462
+ price += PROPERTY_TANK_PRICE;
2463
+ }
2464
+ return price;
2414
2465
  }
2415
2466
  }
2416
2467
  __decorate([
@@ -2453,14 +2504,14 @@ class ServiceSubscription extends ServiceSubscription$1 {
2453
2504
  return this.items.reduce((sum, item) => sum + item.total, 0);
2454
2505
  }
2455
2506
  get propertyQuantity() {
2456
- return this.propertyTankItem ? this.propertyTankItem.quantity : 0;
2507
+ return this.propertiesItem ? this.propertiesItem.quantity : 0;
2457
2508
  }
2458
2509
  /**
2459
2510
  * get type of subscription
2460
2511
  */
2461
2512
  get type() {
2462
2513
  const workTankProduct = this.items.find((item) => {
2463
- return item.price.product.isWork();
2514
+ return item.price.product.isWorkTank();
2464
2515
  });
2465
2516
  if (!this.workTankItem || !this.isActive) {
2466
2517
  return SubscriptionTypeEnum.WITHOUT_SUBSCRIPTION;
@@ -2469,9 +2520,9 @@ class ServiceSubscription extends ServiceSubscription$1 {
2469
2520
  return SubscriptionTypeEnum.INDIVIDUAL;
2470
2521
  }
2471
2522
  const propertyTankProduct = this.items.find((item) => {
2472
- return item.price.product.isProperty();
2523
+ return item.price.product.isProperties();
2473
2524
  });
2474
- if (!!this.propertyTankItem && propertyTankProduct.quantity === PROPERTY_INVESTOR_MAX_PROPERTIES) {
2525
+ if (!!this.propertiesItem && propertyTankProduct.quantity === PROPERTY_INVESTOR_MAX_PROPERTIES) {
2475
2526
  return SubscriptionTypeEnum.INVESTOR;
2476
2527
  }
2477
2528
  return SubscriptionTypeEnum.INVESTOR_PLUS;
@@ -2488,12 +2539,6 @@ class ServiceSubscription extends ServiceSubscription$1 {
2488
2539
  get description() {
2489
2540
  return SUBSCRIPTION_DESCRIPTION[this.type];
2490
2541
  }
2491
- get workTankItem() {
2492
- return this.items.find((item) => item.price.product.isWork());
2493
- }
2494
- get propertyTankItem() {
2495
- return this.items.find((item) => item.price.product.isProperty());
2496
- }
2497
2542
  /**
2498
2543
  * This check on getIsActive need for firm. Accountant has a endDate, but user has not endDate
2499
2544
  * and for user we add check for endDate
@@ -2538,6 +2583,21 @@ class ServiceSubscription extends ServiceSubscription$1 {
2538
2583
  isTrialExpiring() {
2539
2584
  return this.daysRemain > 0 && this.daysRemain <= this.lastTrialDays;
2540
2585
  }
2586
+ isRenewable() {
2587
+ return !this.isTrial && !this.isArchived() && this.isActive;
2588
+ }
2589
+ /**
2590
+ * @TODO move to collection
2591
+ */
2592
+ get workTankItem() {
2593
+ return this.items.find((item) => item.price.product.isWorkTank());
2594
+ }
2595
+ get soleTankItem() {
2596
+ return this.items.find((item) => item.price.product.isSoleTank());
2597
+ }
2598
+ get propertiesItem() {
2599
+ return this.items.find((item) => item.price.product.isProperties());
2600
+ }
2541
2601
  hasPropertyTank() {
2542
2602
  return !!this.items.find((subscriptionItem) => {
2543
2603
  return subscriptionItem.price.product.role.includes(UserRolesEnum.PROPERTY_TANK);
@@ -2548,6 +2608,14 @@ class ServiceSubscription extends ServiceSubscription$1 {
2548
2608
  return subscriptionItem.price.product.role.includes(UserRolesEnum.WORK_TANK);
2549
2609
  });
2550
2610
  }
2611
+ /**
2612
+ * bought before price updates, active for some time to let customer select a new plan
2613
+ * impossible to update, only prolong or buy new
2614
+ */
2615
+ isArchived() {
2616
+ // subscription with at least one archived product considered as archived
2617
+ return !!this.items.map((item) => item.price.product.isArchived()).length;
2618
+ }
2551
2619
  }
2552
2620
  __decorate([
2553
2621
  Type(() => Date)
@@ -2695,7 +2763,7 @@ __decorate([
2695
2763
  Type(() => User)
2696
2764
  ], PropertySubscription.prototype, "user", void 0);
2697
2765
 
2698
- class PropertyCategory$1 {
2766
+ class PropertyCategory$1 extends AbstractModel {
2699
2767
  }
2700
2768
 
2701
2769
  class PropertyCategory extends PropertyCategory$1 {
@@ -2708,10 +2776,16 @@ class PropertyCategory extends PropertyCategory$1 {
2708
2776
  }
2709
2777
  }
2710
2778
 
2711
- class PropertyValuation$1 {
2779
+ class PropertyValuation$1 extends AbstractModel {
2712
2780
  }
2713
2781
 
2714
- class PropertyDocument$1 {
2782
+ class PropertyDocument$1 extends AbstractModel {
2783
+ getApiUrlPrefix() {
2784
+ return '';
2785
+ }
2786
+ getEntity() {
2787
+ return undefined;
2788
+ }
2715
2789
  }
2716
2790
 
2717
2791
  // @TODO this enum should come from backend
@@ -2769,7 +2843,7 @@ __decorate([
2769
2843
  Exclude()
2770
2844
  ], PropertyValuation.prototype, "documentFile", void 0);
2771
2845
 
2772
- class PropertyForecast$1 {
2846
+ class PropertyForecast$1 extends AbstractModel {
2773
2847
  }
2774
2848
 
2775
2849
  class PropertyForecast extends PropertyForecast$1 {
@@ -2820,7 +2894,7 @@ __decorate([
2820
2894
  Transform(({ value }) => +value)
2821
2895
  ], PropertyForecast.prototype, "marketValue", void 0);
2822
2896
 
2823
- class PropertyCategoryMovement$1 {
2897
+ class PropertyCategoryMovement$1 extends AbstractModel {
2824
2898
  }
2825
2899
 
2826
2900
  class PropertyCategoryMovement extends PropertyCategoryMovement$1 {
@@ -3086,7 +3160,7 @@ __decorate([
3086
3160
  Exclude()
3087
3161
  ], Property.prototype, "documentFile", void 0);
3088
3162
 
3089
- class TransactionReceipt$1 {
3163
+ class TransactionReceipt$1 extends AbstractModel {
3090
3164
  }
3091
3165
 
3092
3166
  class TransactionReceipt extends TransactionReceipt$1 {
@@ -3097,7 +3171,7 @@ class TransactionReceipt extends TransactionReceipt$1 {
3097
3171
  }
3098
3172
  }
3099
3173
 
3100
- class IncomeSource$1 {
3174
+ class IncomeSource$1 extends AbstractModel {
3101
3175
  }
3102
3176
 
3103
3177
  var IncomeSourceTypeEnum;
@@ -3108,7 +3182,7 @@ var IncomeSourceTypeEnum;
3108
3182
  IncomeSourceTypeEnum[IncomeSourceTypeEnum["SOLE"] = 4] = "SOLE";
3109
3183
  })(IncomeSourceTypeEnum || (IncomeSourceTypeEnum = {}));
3110
3184
 
3111
- class SalaryForecast$1 {
3185
+ class SalaryForecast$1 extends AbstractModel {
3112
3186
  }
3113
3187
 
3114
3188
  class SalaryForecast extends SalaryForecast$1 {
@@ -3121,7 +3195,7 @@ __decorate([
3121
3195
  Type(() => IncomeSource)
3122
3196
  ], SalaryForecast.prototype, "incomeSource", void 0);
3123
3197
 
3124
- class SoleForecast$1 {
3198
+ class SoleForecast$1 extends AbstractModel {
3125
3199
  }
3126
3200
 
3127
3201
  class SoleForecast extends SoleForecast$1 {
@@ -3134,7 +3208,7 @@ __decorate([
3134
3208
  Type(() => IncomeSource)
3135
3209
  ], SoleForecast.prototype, "incomeSource", void 0);
3136
3210
 
3137
- class IncomeSourceForecast$1 {
3211
+ class IncomeSourceForecast$1 extends AbstractModel {
3138
3212
  }
3139
3213
 
3140
3214
  var SalaryForecastFrequencyEnum;
@@ -3145,7 +3219,7 @@ var SalaryForecastFrequencyEnum;
3145
3219
  SalaryForecastFrequencyEnum[SalaryForecastFrequencyEnum["WEEKLY"] = 52] = "WEEKLY";
3146
3220
  })(SalaryForecastFrequencyEnum || (SalaryForecastFrequencyEnum = {}));
3147
3221
 
3148
- class IncomeSourceType$1 {
3222
+ class IncomeSourceType$1 extends AbstractModel {
3149
3223
  }
3150
3224
 
3151
3225
  var IncomeSourceTypeListSalaryEnum;
@@ -3273,7 +3347,7 @@ __decorate([
3273
3347
  Type(() => Date)
3274
3348
  ], IncomeSource.prototype, "dateTo", void 0);
3275
3349
 
3276
- class TransactionMetadata$1 {
3350
+ class TransactionMetadata$1 extends AbstractModel {
3277
3351
  }
3278
3352
 
3279
3353
  class TransactionMetadata extends TransactionMetadata$1 {
@@ -3282,7 +3356,7 @@ __decorate([
3282
3356
  Type(() => ChartAccountsMetadata)
3283
3357
  ], TransactionMetadata.prototype, "metadata", void 0);
3284
3358
 
3285
- class Loan$1 {
3359
+ class Loan$1 extends AbstractModel {
3286
3360
  }
3287
3361
 
3288
3362
  var LoanRepaymentTypeEnum;
@@ -3308,7 +3382,7 @@ __decorate([
3308
3382
  Type(() => Date)
3309
3383
  ], LoanPayment.prototype, "date", void 0);
3310
3384
 
3311
- class LoanPayout$1 {
3385
+ class LoanPayout$1 extends AbstractModel {
3312
3386
  }
3313
3387
 
3314
3388
  var LoanPayoutTypeEnum;
@@ -3356,7 +3430,7 @@ __decorate([
3356
3430
  Type(() => LoanPayout)
3357
3431
  ], Loan.prototype, "payout", void 0);
3358
3432
 
3359
- class TransactionAllocation$1 {
3433
+ class TransactionAllocation$1 extends AbstractModel {
3360
3434
  }
3361
3435
 
3362
3436
  class TransactionAllocation extends TransactionAllocation$1 {
@@ -3915,7 +3989,7 @@ class PropertyReportItemTransactionCollection extends PropertyReportItemCollecti
3915
3989
  properties.items.forEach((property) => {
3916
3990
  const transactionsDictionary = new CollectionDictionary(transactions.getByPropertiesIds([property.id]), 'chartAccounts.id');
3917
3991
  transactionsDictionary.keys.map((chartAccountId) => {
3918
- this.items.push(new PropertyReportItemTransaction(transactionsDictionary.get(chartAccountId), property, chartAccounts.getById(+chartAccountId)));
3992
+ this.items.push(new PropertyReportItemTransaction(transactionsDictionary.get(chartAccountId), property, chartAccounts.findBy('id', +chartAccountId)));
3919
3993
  });
3920
3994
  });
3921
3995
  }
@@ -3952,7 +4026,7 @@ class PropertyReportItemDepreciationCollection extends PropertyReportItemCollect
3952
4026
  properties.items.forEach((property) => {
3953
4027
  const depreciationsByType = new CollectionDictionary(depreciations, 'type');
3954
4028
  depreciationsByType.keys.map((type) => {
3955
- this.items.push(new PropertyReportItemDepreciation(depreciationsByType.get(type), property, chartAccounts.getById(depreciationsByType.get(type).first.chartAccounts.id)));
4029
+ this.items.push(new PropertyReportItemDepreciation(depreciationsByType.get(type), property, chartAccounts.findBy('id', depreciationsByType.get(type).first.chartAccounts.id)));
3956
4030
  });
3957
4031
  });
3958
4032
  }
@@ -3989,15 +4063,6 @@ class VehicleExpenseCollection extends Collection {
3989
4063
  }
3990
4064
  }
3991
4065
 
3992
- class ServicePriceCollection extends Collection {
3993
- get work() {
3994
- return this.items.filter((price) => price.product.isWork())[0];
3995
- }
3996
- get property() {
3997
- return this.items.filter((price) => price.product.isProperty())[0];
3998
- }
3999
- }
4000
-
4001
4066
  class ServiceSubscriptionCollection extends Collection {
4002
4067
  get individual() {
4003
4068
  return this.items.filter((subscription) => subscription.isIndividual())[0];
@@ -4833,9 +4898,12 @@ var VehicleLogbookPurposeEnum;
4833
4898
  * Account setup item instance is using for account setup checklist
4834
4899
  */
4835
4900
  class AccountSetupItem {
4901
+ constructor() {
4902
+ this.clientIncomeTypes = [];
4903
+ }
4836
4904
  }
4837
4905
 
4838
- class Bank$1 {
4906
+ class Bank$1 extends AbstractModel {
4839
4907
  }
4840
4908
 
4841
4909
  class Bank extends Bank$1 {
@@ -4850,13 +4918,13 @@ class Bank extends Bank$1 {
4850
4918
  }
4851
4919
  }
4852
4920
 
4853
- class BankAccount$1 {
4921
+ class BankAccount$1 extends AbstractModel {
4854
4922
  }
4855
4923
 
4856
- class BankAccountBalance {
4924
+ class BankAccountBalance extends AbstractModel {
4857
4925
  }
4858
4926
 
4859
- class BankAccountProperty$1 {
4927
+ class BankAccountProperty$1 extends AbstractModel {
4860
4928
  }
4861
4929
 
4862
4930
  class BankAccountProperty extends BankAccountProperty$1 {
@@ -4865,10 +4933,10 @@ __decorate([
4865
4933
  Type(() => Property)
4866
4934
  ], BankAccountProperty.prototype, "property", void 0);
4867
4935
 
4868
- class BankConnection$1 {
4936
+ class BankConnection$1 extends AbstractModel {
4869
4937
  }
4870
4938
 
4871
- class BasiqJob$1 {
4939
+ class BasiqJob$1 extends AbstractModel {
4872
4940
  }
4873
4941
 
4874
4942
  class BasiqJob extends BasiqJob$1 {
@@ -5224,13 +5292,13 @@ class BasiqToken {
5224
5292
  }
5225
5293
  }
5226
5294
 
5227
- class BorrowingExpense$1 {
5295
+ class BorrowingExpense$1 extends AbstractModel {
5228
5296
  }
5229
5297
 
5230
5298
  class BorrowingExpense extends BorrowingExpense$1 {
5231
5299
  }
5232
5300
 
5233
- class BorrowingExpenseLoan$1 {
5301
+ class BorrowingExpenseLoan$1 extends AbstractModel {
5234
5302
  }
5235
5303
 
5236
5304
  class BorrowingExpenseLoan extends BorrowingExpenseLoan$1 {
@@ -5253,7 +5321,7 @@ __decorate([
5253
5321
  Type(() => ChartSerie)
5254
5322
  ], ChartData.prototype, "data", void 0);
5255
5323
 
5256
- class ChartAccountsDepreciation$1 {
5324
+ class ChartAccountsDepreciation$1 extends AbstractModel {
5257
5325
  }
5258
5326
 
5259
5327
  class ChartAccountsDepreciation extends ChartAccountsDepreciation$1 {
@@ -5275,13 +5343,13 @@ var ChartAccountsTaxLabelsEnum;
5275
5343
  ChartAccountsTaxLabelsEnum["TAX_DEDUCTED"] = "Tax Deducted";
5276
5344
  })(ChartAccountsTaxLabelsEnum || (ChartAccountsTaxLabelsEnum = {}));
5277
5345
 
5278
- class ChartAccountsValue$1 {
5346
+ class ChartAccountsValue$1 extends AbstractModel {
5279
5347
  }
5280
5348
 
5281
5349
  class ChartAccountsValue extends ChartAccountsValue$1 {
5282
5350
  }
5283
5351
 
5284
- class Chat$1 {
5352
+ class Chat$1 extends AbstractModel {
5285
5353
  }
5286
5354
 
5287
5355
  class Chat extends Chat$1 {
@@ -5308,10 +5376,10 @@ var ChatViewTypeEnum;
5308
5376
  ChatViewTypeEnum[ChatViewTypeEnum["ATTACHMENTS"] = 1] = "ATTACHMENTS";
5309
5377
  })(ChatViewTypeEnum || (ChatViewTypeEnum = {}));
5310
5378
 
5311
- class Message$1 {
5379
+ class Message$1 extends AbstractModel {
5312
5380
  }
5313
5381
 
5314
- class MessageDocument$1 {
5382
+ class MessageDocument$1 extends AbstractModel {
5315
5383
  }
5316
5384
 
5317
5385
  class MessageDocument extends MessageDocument$1 {
@@ -5362,7 +5430,7 @@ __decorate([
5362
5430
  Expose()
5363
5431
  ], Message.prototype, "documents", void 0);
5364
5432
 
5365
- class ClientIncomeTypes$1 {
5433
+ class ClientIncomeTypes$1 extends AbstractModel {
5366
5434
  }
5367
5435
 
5368
5436
  class ClientIncomeTypes extends ClientIncomeTypes$1 {
@@ -5374,10 +5442,10 @@ class ClientIncomeTypes extends ClientIncomeTypes$1 {
5374
5442
  }
5375
5443
  }
5376
5444
 
5377
- class ClientInvite$1 {
5445
+ class ClientInvite$1 extends AbstractModel {
5378
5446
  }
5379
5447
 
5380
- class RegistrationInvite$1 {
5448
+ class RegistrationInvite$1 extends AbstractModel {
5381
5449
  }
5382
5450
 
5383
5451
  class RegistrationInvite extends RegistrationInvite$1 {
@@ -5448,7 +5516,7 @@ __decorate([
5448
5516
  Type(() => RegistrationInvite)
5449
5517
  ], ClientInvite.prototype, "registrationInvite", void 0);
5450
5518
 
5451
- class ClientMovement$1 {
5519
+ class ClientMovement$1 extends AbstractModel {
5452
5520
  }
5453
5521
 
5454
5522
  class ClientMovement extends ClientMovement$1 {
@@ -5628,7 +5696,7 @@ const DEPRECIATION_GROUPS = {
5628
5696
  }
5629
5697
  };
5630
5698
 
5631
- class DepreciationReceipt$1 {
5699
+ class DepreciationReceipt$1 extends AbstractModel {
5632
5700
  }
5633
5701
 
5634
5702
  class DepreciationReceipt extends DepreciationReceipt$1 {
@@ -5639,7 +5707,7 @@ class DepreciationReceipt extends DepreciationReceipt$1 {
5639
5707
  }
5640
5708
  }
5641
5709
 
5642
- class Document$1 {
5710
+ class Document$1 extends AbstractModel {
5643
5711
  }
5644
5712
 
5645
5713
  /**
@@ -5694,7 +5762,7 @@ const DOCUMENT_FILE_TYPES = {
5694
5762
  ]
5695
5763
  };
5696
5764
 
5697
- class DocumentFolder$1 {
5765
+ class DocumentFolder$1 extends AbstractModel {
5698
5766
  }
5699
5767
 
5700
5768
  class DocumentFolder extends DocumentFolder$1 {
@@ -5703,7 +5771,7 @@ __decorate([
5703
5771
  Type(() => Document)
5704
5772
  ], DocumentFolder.prototype, "documents", void 0);
5705
5773
 
5706
- class EmployeeInvite$1 {
5774
+ class EmployeeInvite$1 extends AbstractModel {
5707
5775
  }
5708
5776
 
5709
5777
  class EmployeeInvite extends EmployeeInvite$1 {
@@ -5870,10 +5938,10 @@ const WORK_TANK_LOGBOOK_PURPOSE_OPTIONS = [
5870
5938
  { label: 'Personal', value: VehicleLogbookPurposeEnum.PERSONAL }
5871
5939
  ];
5872
5940
 
5873
- class Vehicle$1 {
5941
+ class Vehicle$1 extends AbstractModel {
5874
5942
  }
5875
5943
 
5876
- class VehicleLogbook$1 {
5944
+ class VehicleLogbook$1 extends AbstractModel {
5877
5945
  }
5878
5946
 
5879
5947
  class VehicleLogbook extends VehicleLogbook$1 {
@@ -5906,7 +5974,7 @@ __decorate([
5906
5974
  Type(() => VehicleLogbook)
5907
5975
  ], Vehicle.prototype, "logbook", void 0);
5908
5976
 
5909
- class VehicleClaim$1 {
5977
+ class VehicleClaim$1 extends AbstractModel {
5910
5978
  }
5911
5979
 
5912
5980
  const WEEKS_IN_YEAR = 52;
@@ -5991,7 +6059,7 @@ class VehicleClaim extends VehicleClaim$1 {
5991
6059
  }
5992
6060
  }
5993
6061
 
5994
- class ServiceNotification {
6062
+ class ServiceNotification extends AbstractModel {
5995
6063
  }
5996
6064
 
5997
6065
  class Notification extends ServiceNotification {
@@ -6312,7 +6380,7 @@ class PropertyEquityChartData {
6312
6380
  }
6313
6381
  }
6314
6382
 
6315
- class PropertyShare$1 {
6383
+ class PropertyShare$1 extends AbstractModel {
6316
6384
  }
6317
6385
 
6318
6386
  class PropertyShare extends PropertyShare$1 {
@@ -6356,10 +6424,10 @@ __decorate([
6356
6424
  Transform(({ obj }) => obj.user ? obj.user.email : obj.invite.email)
6357
6425
  ], PropertyShare.prototype, "email", void 0);
6358
6426
 
6359
- class PropertySale$1 {
6427
+ class PropertySale$1 extends AbstractModel {
6360
6428
  }
6361
6429
 
6362
- class PropertySaleTaxExemptionMetadata$1 {
6430
+ class PropertySaleTaxExemptionMetadata$1 extends AbstractModel {
6363
6431
  }
6364
6432
 
6365
6433
  class PropertySale extends PropertySale$1 {
@@ -6377,13 +6445,13 @@ __decorate([
6377
6445
  Type(() => PropertySaleTaxExemptionMetadata$1)
6378
6446
  ], PropertySale.prototype, "taxExemptionMetadata", void 0);
6379
6447
 
6380
- class TaxExemption$1 {
6448
+ class TaxExemption$1 extends AbstractModel {
6381
6449
  }
6382
6450
 
6383
6451
  class TaxExemption extends TaxExemption$1 {
6384
6452
  }
6385
6453
 
6386
- class TaxExemptionMetadata$1 {
6454
+ class TaxExemptionMetadata$1 extends AbstractModel {
6387
6455
  }
6388
6456
 
6389
6457
  class TaxExemptionMetadata extends TaxExemptionMetadata$1 {
@@ -6404,7 +6472,7 @@ const MODULE_URL_LIST = {
6404
6472
  myAccount: '/client/my-account/subscription'
6405
6473
  };
6406
6474
 
6407
- class ServicePayment$1 {
6475
+ class ServicePayment$1 extends AbstractModel {
6408
6476
  }
6409
6477
 
6410
6478
  class ServicePayment extends ServicePayment$1 {
@@ -6413,7 +6481,7 @@ __decorate([
6413
6481
  Type(() => ServiceSubscription)
6414
6482
  ], ServicePayment.prototype, "subscription", void 0);
6415
6483
 
6416
- class TaxReview$1 {
6484
+ class TaxReview$1 extends AbstractModel {
6417
6485
  }
6418
6486
 
6419
6487
  class TaxReview extends TaxReview$1 {
@@ -6661,7 +6729,7 @@ var MyAccountHistoryTypeEnum;
6661
6729
  MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPLOAD_DOCUMENT"] = 2] = "UPLOAD_DOCUMENT";
6662
6730
  })(MyAccountHistoryTypeEnum || (MyAccountHistoryTypeEnum = {}));
6663
6731
 
6664
- class Occupation$1 {
6732
+ class Occupation$1 extends AbstractModel {
6665
6733
  }
6666
6734
 
6667
6735
  class Occupation extends Occupation$1 {
@@ -6686,16 +6754,16 @@ const USER_ROLES = {
6686
6754
  class UserToRegister {
6687
6755
  }
6688
6756
 
6689
- class UserEventTypeCategory$1 {
6757
+ class UserEventTypeCategory$1 extends AbstractModel {
6690
6758
  }
6691
6759
 
6692
6760
  class UserEventTypeCategory extends UserEventTypeCategory$1 {
6693
6761
  }
6694
6762
 
6695
- class UserEventSetting$1 {
6763
+ class UserEventSetting$1 extends AbstractModel {
6696
6764
  }
6697
6765
 
6698
- class UserEventType$1 {
6766
+ class UserEventType$1 extends AbstractModel {
6699
6767
  }
6700
6768
 
6701
6769
  class UserEventType extends UserEventType$1 {
@@ -6757,37 +6825,41 @@ const ACCOUNT_SETUP_ITEMS = {
6757
6825
  [AccountSetupItemsEnum.SALARY]: plainToClass(AccountSetupItem, {
6758
6826
  title: 'Add your work income forecast',
6759
6827
  description: 'One the most important steps is to add your salary or wage incomes so we can automatically calculate tax withheld and your forecasted tax position.',
6760
- url: '/client/work-tank/forecasting'
6828
+ url: '/client/work-tank/forecasting#salaryProductTour',
6829
+ clientIncomeTypes: ['salary']
6761
6830
  }),
6762
6831
  [AccountSetupItemsEnum.OTHER_INCOME]: plainToClass(AccountSetupItem, {
6763
6832
  title: 'Add any other expected incomes',
6764
6833
  description: 'To ensure an accurate tax position forecast, add estimates for any other income types, like dividends, interest, trusts, annuities, director payments etc.',
6765
- url: '/client/work-tank/forecasting'
6834
+ url: '/client/work-tank/forecasting#otherIncomeProductTour',
6835
+ clientIncomeTypes: ['dividends', 'other']
6766
6836
  }),
6767
6837
  [AccountSetupItemsEnum.PROPERTY]: plainToClass(AccountSetupItem, {
6768
6838
  title: 'Add your properties',
6769
6839
  description: 'Add your properties to seamlessly manage your rental incomes and expenses, whilst tracking your cash position, tax positions and equity forecasts in real time.',
6770
- url: '/client/property-tank'
6840
+ url: '/client/property-tank#productTour',
6841
+ clientIncomeTypes: ['property']
6771
6842
  }),
6772
6843
  [AccountSetupItemsEnum.BANK_FEEDS]: plainToClass(AccountSetupItem, {
6773
6844
  title: 'Link banks and select accounts',
6774
6845
  description: 'Link banks to automatically feed your account transactions to save you time and money. Allocating live transactions ensures nothing is missed, lost or forgotten!',
6775
- url: '/client/bank-feeds'
6846
+ url: '/client/bank-feeds#bankAccountProductTour'
6776
6847
  }),
6777
6848
  [AccountSetupItemsEnum.WORK_LOGBOOK]: plainToClass(AccountSetupItem, {
6778
6849
  title: 'Set up your logbook method',
6779
6850
  description: 'Do you use your vehicle for work? Select your method and the klms or logbook % to automate accurately all vehicle expenses throughout the year.',
6780
- url: '/client/work-tank/logbook'
6851
+ url: '/client/work-tank/logbook#productTour'
6781
6852
  }),
6782
6853
  [AccountSetupItemsEnum.SOLE_INCOME]: plainToClass(AccountSetupItem, {
6783
6854
  title: 'Add your business details',
6784
6855
  description: 'Add your business details, logo and payment terms to create invoice templates in minutes.',
6785
- url: '/client/sole-tank/forecasting'
6856
+ url: '/client/sole-tank/forecasting#productTour',
6857
+ clientIncomeTypes: ['sole']
6786
6858
  }),
6787
6859
  [AccountSetupItemsEnum.TRANSACTION]: plainToClass(AccountSetupItem, {
6788
6860
  title: 'Allocation transactions',
6789
6861
  description: 'Select one or multiple transactions, the category from the dropdown and attach your receipt. It’s that simple to capture every possible deduction, and keep organised all throughout the year.',
6790
- url: '/client/bank-feeds'
6862
+ url: '/client/bank-feeds#allocationProductTour'
6791
6863
  }),
6792
6864
  };
6793
6865
 
@@ -6942,7 +7014,7 @@ class RestService {
6942
7014
  * get instance by id from cache
6943
7015
  * @param id ID of required item
6944
7016
  */
6945
- getById(id) {
7017
+ findById(id) {
6946
7018
  return this.get()
6947
7019
  .pipe(map((items) => {
6948
7020
  return items.find((item) => item['id'] === id);
@@ -7522,112 +7594,458 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
7522
7594
  }]
7523
7595
  }] });
7524
7596
 
7597
+ function enumToList(data) {
7598
+ const list = [];
7599
+ for (const key in data) {
7600
+ if (Number(key) >= 0) {
7601
+ list.push({
7602
+ label: data[key],
7603
+ value: Number(key)
7604
+ });
7605
+ }
7606
+ }
7607
+ return list;
7608
+ }
7609
+
7610
+ var MessagesEnum;
7611
+ (function (MessagesEnum) {
7612
+ MessagesEnum["DELETED_MESSAGE"] = "Transaction deleted";
7613
+ MessagesEnum["UPDATED_MESSAGE"] = "Transaction updated";
7614
+ MessagesEnum["CREATED_MESSAGE"] = "Transaction(s) created";
7615
+ })(MessagesEnum || (MessagesEnum = {}));
7616
+
7525
7617
  /**
7526
- * Service handling user's account setup process.
7527
- * Checks required steps and their completion
7618
+ * Service for transactions business logic
7528
7619
  */
7529
- class AccountSetupService {
7530
- constructor(clientIncomeTypesService, propertyService, incomeSourceService, bankAccountsService, transactionAllocationService, vehicleClaimService) {
7531
- this.clientIncomeTypesService = clientIncomeTypesService;
7532
- this.propertyService = propertyService;
7533
- this.incomeSourceService = incomeSourceService;
7534
- this.bankAccountsService = bankAccountsService;
7535
- this.transactionAllocationService = transactionAllocationService;
7536
- this.vehicleClaimService = vehicleClaimService;
7537
- this.cacheSubject = new ReplaySubject(1);
7620
+ class TransactionService extends RestService {
7621
+ constructor() {
7622
+ super(...arguments);
7623
+ // url part for Transaction API
7624
+ this.url = 'transactions';
7625
+ this.modelClass = Transaction;
7626
+ this.transactionDeleted = new EventEmitter();
7538
7627
  }
7539
7628
  /**
7540
- * Get list of account setup items for current user
7629
+ * Listen events from Event Dispatcher services
7630
+ */
7631
+ listenEvents() {
7632
+ this.listenDepreciationChange();
7633
+ this.listenPropertyShareUpdate();
7634
+ }
7635
+ /**
7636
+ * get list of all user's TaxTank transactions
7541
7637
  */
7542
7638
  get() {
7543
7639
  if (!this.cache) {
7544
- this.clientIncomeTypesService.get().subscribe((incomeTypes) => {
7545
- combineLatest(this.createBatch(incomeTypes)).subscribe((items) => {
7546
- this.cache = new AccountSetupItemCollection(items);
7547
- this.cacheSubject.next(this.cache);
7548
- });
7640
+ // set cache as default empty array to avoid multiple backend requests
7641
+ this.cache = [];
7642
+ this.fetch()
7643
+ .subscribe((transactions) => {
7644
+ this.cache = transactions;
7645
+ this.updateCache();
7549
7646
  });
7550
7647
  }
7551
- return this.cacheSubject.asObservable();
7648
+ return this.cacheSubject.asObservable().pipe(
7649
+ // assign child transactions (fees) to parent transactions
7650
+ map((transactions) => {
7651
+ transactions.forEach((transaction) => {
7652
+ transaction.transactions = transactions
7653
+ // get list of child transactions
7654
+ .filter((t) => t.parentTransaction && t.parentTransaction.id === transaction.id);
7655
+ });
7656
+ sort(transactions, 'date', false);
7657
+ return transactions;
7658
+ }));
7552
7659
  }
7553
7660
  /**
7554
- * Get a single AccountSetupItem and check it's completion
7661
+ * Add single new transaction
7662
+ * @param model New Transaction instance for saving
7555
7663
  */
7556
- create(itemType, request) {
7557
- return request.pipe(map((result) => {
7558
- const item = ACCOUNT_SETUP_ITEMS[itemType];
7559
- if (result.length) {
7560
- item.isCompleted = true;
7561
- }
7562
- return item;
7664
+ add(model) {
7665
+ // we don't have POST API endpoint for single transaction
7666
+ return this.addBatch([model])
7667
+ .pipe(map((newTransactions) => {
7668
+ // @TODO alex
7669
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTION_CREATED, newTransactions[0]));
7670
+ return newTransactions[0];
7563
7671
  }));
7564
7672
  }
7565
7673
  /**
7566
- * Get batch of requests to get list of required AccountSetupItem's.
7567
- * Some items are optional and depends of user's client income types
7674
+ * get transactions related with property
7568
7675
  */
7569
- createBatch(incomeTypes) {
7570
- const batch = [];
7571
- // Salary item is completed when user added salary income source
7572
- if (incomeTypes.salary) {
7573
- batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSourcesByType(IncomeSourceTypeEnum.SALARY)));
7574
- }
7575
- // Other income item is completed when user added at least one other income source
7576
- if (incomeTypes.dividends || incomeTypes.other) {
7577
- batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSourcesByType(IncomeSourceTypeEnum.OTHER)));
7578
- }
7579
- // Rental income item is completed when user added at least one property
7580
- if (incomeTypes.property) {
7581
- batch.push(this.create(AccountSetupItemsEnum.PROPERTY, this.propertyService.get()));
7582
- }
7583
- // Bank feeds item is completed when user added at least one bank account (basiq or manual)
7584
- batch.push(this.create(AccountSetupItemsEnum.BANK_FEEDS, this.bankAccountsService.get()));
7585
- // Logbook item is completed when user has at least one vehicle claim with any method (klms or logbook)
7586
- batch.push(this.create(AccountSetupItemsEnum.WORK_LOGBOOK, this.vehicleClaimService.get()));
7587
- // @TODO waiting for sole tank forecast page
7588
- // Sole item is completed when user added at least one sole income source
7589
- // if (incomeTypes.soleTrader) {
7590
- // batch.push(
7591
- // this.prepareItem(
7592
- // AccountSetupItemsEnum.SOLE_INCOME,
7593
- // this.getIncomeSourcesByType(IncomeSourceTypeEnum.SOLE)
7594
- // )
7595
- // );
7596
- // }
7597
- // Allocation item is completed when user added at least one transaction allocation
7598
- batch.push(this.create(AccountSetupItemsEnum.TRANSACTION, this.transactionAllocationService.get()));
7599
- return batch;
7676
+ getByPropertyId(propertyId) {
7677
+ return this.get()
7678
+ .pipe(map((transactions) => {
7679
+ return transactions.filter((transaction) => {
7680
+ var _a;
7681
+ return ((_a = transaction.property) === null || _a === void 0 ? void 0 : _a.id) === propertyId;
7682
+ });
7683
+ }));
7600
7684
  }
7601
7685
  /**
7602
- * @TODO work with collection when services refactored
7686
+ * get list of transactions with tank type 'Work'
7603
7687
  */
7604
- getIncomeSourcesByType(type) {
7605
- return this.incomeSourceService.get().pipe(map((incomeSources) => {
7606
- return new IncomeSourceCollection(incomeSources).getBy('type', type).toArray();
7688
+ getWorkTransactions() {
7689
+ return this.get()
7690
+ .pipe(map((transactions) => {
7691
+ return transactions.filter((transaction) => transaction.isWorkTank());
7607
7692
  }));
7608
7693
  }
7609
- }
7610
- AccountSetupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, deps: [{ token: ClientIncomeTypesService }, { token: PropertyService }, { token: IncomeSourceService }, { token: BankAccountService }, { token: TransactionAllocationService }, { token: VehicleClaimService }], target: i0.ɵɵFactoryTarget.Injectable });
7611
- AccountSetupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, providedIn: 'root' });
7612
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, decorators: [{
7613
- type: Injectable,
7614
- args: [{
7615
- providedIn: 'root'
7616
- }]
7617
- }], ctorParameters: function () { return [{ type: ClientIncomeTypesService }, { type: PropertyService }, { type: IncomeSourceService }, { type: BankAccountService }, { type: TransactionAllocationService }, { type: VehicleClaimService }]; } });
7618
-
7619
- class AddressService {
7620
- constructor(http, environment) {
7621
- this.http = http;
7622
- this.environment = environment;
7623
- this.countriesSubject = new ReplaySubject(1);
7694
+ /**
7695
+ * Get list of property holding costs (transactions related to vacant land property)
7696
+ */
7697
+ getPropertyHoldingCosts(propertyId) {
7698
+ return this.http.get(`${this.environment.apiV2}/${this.url}?propertyId=${propertyId}&propertyCategoryId=${PropertyCategoryListEnum.VACANT_LAND}`)
7699
+ .pipe(map((transactionsBase) => {
7700
+ return transactionsBase.map((transactionBase) => plainToClass(Transaction, transactionBase));
7701
+ }));
7624
7702
  }
7625
- getCountries() {
7626
- if (!this._countries) {
7627
- this.http.get(`${this.environment.apiV2}/countries`)
7628
- .pipe(map((response) => {
7629
- return response['hydra:member'].map((item) => plainToClass(Country, item));
7630
- }))
7703
+ /**
7704
+ * get list of taxable transactions with tank type 'Work'
7705
+ */
7706
+ getTaxableWorkTransactions() {
7707
+ return this.getWorkTransactions()
7708
+ .pipe(map((transactions) => {
7709
+ return transactions.filter((transaction) => !!transaction.chartAccounts.taxReturnItem);
7710
+ }));
7711
+ }
7712
+ /**
7713
+ * add multiple transactions
7714
+ * @param transactions List of new Transaction instances for saving
7715
+ */
7716
+ addBatch(transactions) {
7717
+ transactions = _.cloneDeep(transactions);
7718
+ return this.http.post(`${this.environment.apiV2}/${this.url}`, transactions)
7719
+ .pipe(map((response) => {
7720
+ const addedTransactions = response.map((item) => plainToClass(Transaction, item));
7721
+ transactions.forEach((transaction, index) => {
7722
+ // @TODO backend: need to upload file in the same backend endpoint with transaction add/update
7723
+ // check if passed receipt and upload file
7724
+ if (transaction.file) {
7725
+ transaction.id = response[index].id;
7726
+ addedTransactions[index].file = transaction.file;
7727
+ this.uploadReceipt(addedTransactions[index]);
7728
+ }
7729
+ // @TODO Viktor: implement API for saving of nested transactions
7730
+ // add child transactions if exist
7731
+ if (transaction.transactions.length) {
7732
+ transaction.transactions.forEach((childTransaction) => {
7733
+ childTransaction.parentTransaction = plainToClass(Transaction, { id: addedTransactions[index].id });
7734
+ });
7735
+ this.addBatch(transaction.transactions).subscribe();
7736
+ }
7737
+ // add transfer transaction to cache
7738
+ if (transaction.operation === TransactionOperationEnum.TRANSFER) {
7739
+ addedTransactions.push(addedTransactions[0].transfer);
7740
+ }
7741
+ });
7742
+ if (this.cache) {
7743
+ this.cache.push(...addedTransactions);
7744
+ this.updateCache();
7745
+ }
7746
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTIONS_CREATED, addedTransactions));
7747
+ this.toastService.success(MessagesEnum.CREATED_MESSAGE);
7748
+ return addedTransactions;
7749
+ }));
7750
+ }
7751
+ /**
7752
+ * update existing transaction
7753
+ * @param transaction Transaction instance for updating
7754
+ */
7755
+ update(transaction) {
7756
+ return this.http.put(`${this.environment.apiV2}/${this.url}/${transaction.id}`, transaction)
7757
+ .pipe(map((response) => {
7758
+ const updatedTransaction = plainToClass(Transaction, response);
7759
+ // @TODO need to upload file in the same backend endpoint with transaction add/update
7760
+ // check if passed new receipt and upload file
7761
+ if (transaction.file) {
7762
+ updatedTransaction.file = transaction.file;
7763
+ this.uploadReceipt(updatedTransaction);
7764
+ }
7765
+ // @TODO Viktor: implement API for saving of nested transactions
7766
+ if (transaction.transactions.length) {
7767
+ // add parent transaction to child transactions
7768
+ transaction.transactions.forEach((childTransaction) => {
7769
+ childTransaction.parentTransaction = plainToClass(Transaction, { id: updatedTransaction.id });
7770
+ });
7771
+ // separate child transactions by id existing to define add or update action.
7772
+ const childTransactionsToUpdate = transaction.transactions.filter((t) => t.id);
7773
+ const childTransactionsToAdd = transaction.transactions.filter((t) => !t.id);
7774
+ // update child transactions
7775
+ if (childTransactionsToUpdate.length) {
7776
+ this.updateBatch(childTransactionsToUpdate).subscribe();
7777
+ }
7778
+ // add child transactions
7779
+ if (childTransactionsToAdd.length) {
7780
+ this.addBatch(childTransactionsToAdd).subscribe();
7781
+ }
7782
+ }
7783
+ this.toastService.success(MessagesEnum.UPDATED_MESSAGE);
7784
+ replace(this.cache, updatedTransaction);
7785
+ this.updateCache();
7786
+ return updatedTransaction;
7787
+ }));
7788
+ }
7789
+ /**
7790
+ * update multiple transactions
7791
+ * @param transactions list of transactions for updating
7792
+ */
7793
+ updateBatch(transactions) {
7794
+ return this.http.put(`${this.environment.apiV2}/${this.url}`, transactions)
7795
+ .pipe(map((response) => {
7796
+ const updatedTransactions = response.map((item) => plainToClass(Transaction, item));
7797
+ updatedTransactions.forEach((updatedTransaction) => {
7798
+ replace(this.cache, updatedTransaction);
7799
+ });
7800
+ this.updateCache();
7801
+ return updatedTransactions;
7802
+ }));
7803
+ }
7804
+ /**
7805
+ * delete transaction and related transactions
7806
+ * @param model
7807
+ */
7808
+ delete(model) {
7809
+ return this.http.delete(`${this.environment.apiV2}/${this.url}/${model.id}`)
7810
+ .pipe(map(() => {
7811
+ this.cache = this.cache.filter((transaction) => {
7812
+ var _a;
7813
+ // when delete transfer we delete actually 2 transactions
7814
+ if (model.isTransfer) {
7815
+ const ids = [model.id];
7816
+ // get id of related transfer transaction
7817
+ if (model.transfer) {
7818
+ // just take id if we delete source transaction
7819
+ ids.push(model.transfer.id);
7820
+ }
7821
+ else {
7822
+ // find source transaction id if we delete destination transaction
7823
+ ids.push(this.cache.find((t) => t.transfer.id === model.id).id);
7824
+ }
7825
+ return !ids.includes(transaction.id);
7826
+ }
7827
+ return transaction.id !== model.id && ((_a = transaction.parentTransaction) === null || _a === void 0 ? void 0 : _a.id) !== model.id;
7828
+ });
7829
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTION_DELETED, model));
7830
+ this.toastService.success(MessagesEnum.DELETED_MESSAGE);
7831
+ this.updateCache();
7832
+ this.transactionDeleted.emit(model);
7833
+ }));
7834
+ }
7835
+ /**
7836
+ * upload transaction receipt image
7837
+ * @param transaction Еhe transaction for which the receipt will be imported
7838
+ */
7839
+ uploadReceipt(transaction) {
7840
+ const formData = new FormData();
7841
+ formData.append('file', transaction.file);
7842
+ transaction.receipt = null;
7843
+ this.http.post(`${this.environment.apiV2}/${this.url}/${transaction.id}/receipts`, formData)
7844
+ .subscribe((receiptResponse) => {
7845
+ // we don't need to keep file after save
7846
+ transaction.file = null;
7847
+ transaction.receipt = plainToClass(TransactionReceipt, receiptResponse);
7848
+ replace(this.cache, transaction);
7849
+ this.updateCache();
7850
+ });
7851
+ }
7852
+ /**
7853
+ * calculate gross income amount based on transaction amount and taxes (fees)
7854
+ * @param transaction Transaction instance for calculation
7855
+ */
7856
+ calculateGrossAmount(transaction) {
7857
+ let amount = transaction.amount || 0;
7858
+ // gross income amount includes amount of fees for property tank and tax for work tank
7859
+ if (transaction.isPropertyTank()) {
7860
+ amount += transaction.transactions.reduce((sum, item) => sum + item.amount, 0);
7861
+ }
7862
+ else {
7863
+ // @TODO Alex: fix logic after TT-641 ready
7864
+ amount += (transaction.tax || 0);
7865
+ }
7866
+ return amount;
7867
+ }
7868
+ /**
7869
+ * get label for transaction tax field depended of selected chart account.
7870
+ * tax type depends of chart account heading or category.
7871
+ */
7872
+ getTaxLabel(chartAccounts) {
7873
+ var _a, _b;
7874
+ // get simple array of ids from enum with taxable chart accounts headings
7875
+ const taxableCAHeadingsIds = enumToList(ChartAccountsHeadingTaxableEnum)
7876
+ .map((item) => item.value);
7877
+ // get simple array of ids from enum with tax deductible chart accounts headings
7878
+ const deductibleCAHeadingsIds = enumToList(ChartAccountsHeadingTaxDeductibleEnum)
7879
+ .map((item) => item.value);
7880
+ // check if one of ids arrays includes current chart accounts heading id and set tax label
7881
+ // otherwise label is empty for this class
7882
+ switch (true) {
7883
+ case taxableCAHeadingsIds.includes((_a = chartAccounts.heading) === null || _a === void 0 ? void 0 : _a.id):
7884
+ return ChartAccountsTaxLabelsEnum.TAX_PAID;
7885
+ case deductibleCAHeadingsIds.includes((_b = chartAccounts.heading) === null || _b === void 0 ? void 0 : _b.id):
7886
+ return ChartAccountsTaxLabelsEnum.TAX_DEDUCTED;
7887
+ case CHART_ACCOUNTS_CATEGORIES.workIncome.includes(chartAccounts.category):
7888
+ return ChartAccountsTaxLabelsEnum.TAX_WITHHELD;
7889
+ default:
7890
+ return null;
7891
+ }
7892
+ }
7893
+ /**
7894
+ * Listen to EventDispatcherService event related to Depreciation changing
7895
+ */
7896
+ listenDepreciationChange() {
7897
+ this.eventDispatcherService.on(AppEventTypeEnum.DEPRECIATION_DELETED).subscribe(() => {
7898
+ this.fetch()
7899
+ .subscribe((transactions) => {
7900
+ this.cache = transactions;
7901
+ this.updateCache();
7902
+ });
7903
+ });
7904
+ }
7905
+ /**
7906
+ * Listen to EventDispatcherService event related to Property Share changing
7907
+ */
7908
+ listenPropertyShareUpdate() {
7909
+ this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(() => this.resetCache());
7910
+ }
7911
+ }
7912
+ TransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
7913
+ TransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, providedIn: 'root' });
7914
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, decorators: [{
7915
+ type: Injectable,
7916
+ args: [{
7917
+ providedIn: 'root'
7918
+ }]
7919
+ }] });
7920
+
7921
+ /**
7922
+ * Service handling user's account setup process.
7923
+ * Checks required steps and their completion
7924
+ */
7925
+ class AccountSetupService {
7926
+ constructor(clientIncomeTypesService, propertyService, incomeSourceService, bankAccountsService, transactionAllocationService, vehicleClaimService, transactionService) {
7927
+ this.clientIncomeTypesService = clientIncomeTypesService;
7928
+ this.propertyService = propertyService;
7929
+ this.incomeSourceService = incomeSourceService;
7930
+ this.bankAccountsService = bankAccountsService;
7931
+ this.transactionAllocationService = transactionAllocationService;
7932
+ this.vehicleClaimService = vehicleClaimService;
7933
+ this.transactionService = transactionService;
7934
+ this.cacheSubject = new ReplaySubject(1);
7935
+ }
7936
+ /**
7937
+ * Get list of account setup items for current user
7938
+ */
7939
+ get() {
7940
+ if (!this.cache) {
7941
+ this.clientIncomeTypesService.get().subscribe((incomeTypes) => {
7942
+ this.clientIncomeTypesId = incomeTypes.id;
7943
+ combineLatest(this.createBatch(incomeTypes)).subscribe((items) => {
7944
+ this.cache = new AccountSetupItemCollection(items);
7945
+ this.cacheSubject.next(this.cache);
7946
+ });
7947
+ });
7948
+ }
7949
+ return this.cacheSubject.asObservable();
7950
+ }
7951
+ /**
7952
+ * Prepare client income types to update to hide depended account setup items
7953
+ */
7954
+ prepareIncomeTypes(item) {
7955
+ return plainToClass(ClientIncomeTypes, Object.assign({ id: this.clientIncomeTypesId }, fromPairs(item.clientIncomeTypes.map((type) => [type, false]))));
7956
+ }
7957
+ /**
7958
+ * Get a single AccountSetupItem and check it's completion
7959
+ */
7960
+ create(itemType, request) {
7961
+ return request.pipe(map((result) => {
7962
+ const item = ACCOUNT_SETUP_ITEMS[itemType];
7963
+ if (result.length) {
7964
+ item.isCompleted = true;
7965
+ }
7966
+ return item;
7967
+ }));
7968
+ }
7969
+ /**
7970
+ * Get batch of requests to get list of required AccountSetupItem's.
7971
+ * Some items are optional and depends of user's client income types
7972
+ */
7973
+ createBatch(incomeTypes) {
7974
+ const batch = [];
7975
+ // Salary item is completed when user added salary income source
7976
+ if (incomeTypes.salary) {
7977
+ batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSourcesByType(IncomeSourceTypeEnum.SALARY)));
7978
+ }
7979
+ // Other income item is completed when user added at least one other income source
7980
+ if (incomeTypes.dividends || incomeTypes.other) {
7981
+ batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSourcesByType(IncomeSourceTypeEnum.OTHER)));
7982
+ }
7983
+ // Rental income item is completed when user added at least one property
7984
+ if (incomeTypes.property) {
7985
+ batch.push(this.create(AccountSetupItemsEnum.PROPERTY, this.propertyService.get()));
7986
+ }
7987
+ // Bank feeds item is completed when user added at least one bank account (basiq or manual)
7988
+ batch.push(this.create(AccountSetupItemsEnum.BANK_FEEDS, this.bankAccountsService.get()));
7989
+ // Logbook item is completed when user has at least one vehicle claim with any method (klms or logbook)
7990
+ batch.push(this.getLogbookItem());
7991
+ // @TODO waiting for sole tank forecast page
7992
+ // Sole item is completed when user added at least one sole income source
7993
+ // if (incomeTypes.soleTrader) {
7994
+ // batch.push(
7995
+ // this.prepareItem(
7996
+ // AccountSetupItemsEnum.SOLE_INCOME,
7997
+ // this.getIncomeSourcesByType(IncomeSourceTypeEnum.SOLE)
7998
+ // )
7999
+ // );
8000
+ // }
8001
+ // Allocation item is completed when user added at least one transaction allocation
8002
+ batch.push(this.create(AccountSetupItemsEnum.TRANSACTION, this.transactionAllocationService.get()));
8003
+ return batch;
8004
+ }
8005
+ /**
8006
+ * @TODO work with collection when services refactored
8007
+ */
8008
+ getIncomeSourcesByType(type) {
8009
+ return this.incomeSourceService.get().pipe(map((incomeSources) => {
8010
+ return new IncomeSourceCollection(incomeSources).getBy('type', type).toArray();
8011
+ }));
8012
+ }
8013
+ /**
8014
+ * Show logbook item when user has at least 1 vehicle transaction
8015
+ */
8016
+ getLogbookItem() {
8017
+ return combineLatest([
8018
+ this.transactionService.get(),
8019
+ this.create(AccountSetupItemsEnum.WORK_LOGBOOK, this.vehicleClaimService.get())
8020
+ ]).pipe(map(([transactions, item]) => {
8021
+ if (new TransactionCollection(transactions).getVehicleTransactions().length) {
8022
+ return item;
8023
+ }
8024
+ return null;
8025
+ }));
8026
+ }
8027
+ }
8028
+ AccountSetupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, deps: [{ token: ClientIncomeTypesService }, { token: PropertyService }, { token: IncomeSourceService }, { token: BankAccountService }, { token: TransactionAllocationService }, { token: VehicleClaimService }, { token: TransactionService }], target: i0.ɵɵFactoryTarget.Injectable });
8029
+ AccountSetupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, providedIn: 'root' });
8030
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, decorators: [{
8031
+ type: Injectable,
8032
+ args: [{
8033
+ providedIn: 'root'
8034
+ }]
8035
+ }], ctorParameters: function () { return [{ type: ClientIncomeTypesService }, { type: PropertyService }, { type: IncomeSourceService }, { type: BankAccountService }, { type: TransactionAllocationService }, { type: VehicleClaimService }, { type: TransactionService }]; } });
8036
+
8037
+ class AddressService {
8038
+ constructor(http, environment) {
8039
+ this.http = http;
8040
+ this.environment = environment;
8041
+ this.countriesSubject = new ReplaySubject(1);
8042
+ }
8043
+ getCountries() {
8044
+ if (!this._countries) {
8045
+ this.http.get(`${this.environment.apiV2}/countries`)
8046
+ .pipe(map((response) => {
8047
+ return response['hydra:member'].map((item) => plainToClass(Country, item));
8048
+ }))
7631
8049
  .subscribe((countries) => {
7632
8050
  this._countries = countries;
7633
8051
  this.countriesSubject.next(countries);
@@ -8826,612 +9244,279 @@ class DocumentFolderService extends RestService {
8826
9244
  * @param oldFolderId: id of old folder from which need to remove the document
8827
9245
  */
8828
9246
  updateDocument(editedDocument, selectedFolder, oldFolderId) {
8829
- return this.http.put(`${this.environment.apiV2}/folders/${selectedFolder.id}/documents/${editedDocument.id}`, editedDocument).pipe(map((response) => {
8830
- const oldFolder = this.cache.find((folder) => folder.id === oldFolderId);
8831
- // Remove document from old folder
8832
- oldFolder.documents = oldFolder.documents.filter((deletedDocument) => deletedDocument.id !== response.id);
8833
- // update old folder and replace it in cache
8834
- response.folder = plainToClass(DocumentFolder, { id: selectedFolder.id, name: selectedFolder.name });
8835
- replace(this.cache, plainToClass(DocumentFolder, oldFolder));
8836
- // update new document folder and replace it in cache
8837
- selectedFolder.documents.push(plainToClass(Document, response));
8838
- replace(this.cache, plainToClass(DocumentFolder, selectedFolder));
8839
- this.cacheSubject.next(this.cache);
8840
- }));
8841
- }
8842
- /**
8843
- * Delete document from folder
8844
- * @param document to remove
8845
- * @param folder from which document should be removed
8846
- */
8847
- deleteDocument(document, folder) {
8848
- return this.http.delete(`${this.environment.apiV2}/folders/${folder.id}/documents/${document.id}`).pipe(map(() => {
8849
- folder.documents = folder.documents
8850
- .filter((deletedDocument) => deletedDocument.id !== document.id);
8851
- replace(this.cache, plainToClass(DocumentFolder, folder));
8852
- this.cacheSubject.next(this.cache);
8853
- }));
8854
- }
8855
- }
8856
- DocumentFolderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
8857
- DocumentFolderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, providedIn: 'root' });
8858
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, decorators: [{
8859
- type: Injectable,
8860
- args: [{
8861
- providedIn: 'root'
8862
- }]
8863
- }] });
8864
-
8865
- class EmployeeService extends RestService {
8866
- constructor() {
8867
- super(...arguments);
8868
- this.url = 'employees';
8869
- this.modelClass = User;
8870
- }
8871
- /**
8872
- * Grant/Remove Manager role to employee
8873
- * @param employee
8874
- */
8875
- toggleManagerRole(employee) {
8876
- return this.http.put(`${this.environment.apiV2}/${this.url}/${employee.id}`, {})
8877
- .pipe(map((updatedEmployeeBase) => {
8878
- const tempCache = this.cache;
8879
- const updatedEmployee = plainToClass(User, updatedEmployeeBase);
8880
- replace(tempCache, updatedEmployee);
8881
- this.cache = _.cloneDeep(tempCache);
8882
- this.updateCache();
8883
- return updatedEmployee;
8884
- }));
8885
- }
8886
- }
8887
- EmployeeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EmployeeService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
8888
- EmployeeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EmployeeService, providedIn: 'root' });
8889
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EmployeeService, decorators: [{
8890
- type: Injectable,
8891
- args: [{
8892
- providedIn: 'root'
8893
- }]
8894
- }] });
8895
-
8896
- class EmployeeInviteService extends RestService {
8897
- constructor() {
8898
- super(...arguments);
8899
- this.url = 'employees/invites';
8900
- this.modelClass = EmployeeInvite;
8901
- }
8902
- /**
8903
- * Import employees for firm from CSV file
8904
- * @param file
8905
- */
8906
- import(file) {
8907
- const formData = new FormData();
8908
- formData.append('file', file);
8909
- return this.http.post(`${this.environment.apiV2}/${this.url}/import`, formData)
8910
- .pipe(map((employeeInvite) => {
8911
- return employeeInvite;
8912
- }));
8913
- }
8914
- /**
8915
- * Resend invitation from firm to client
8916
- * @param invite
8917
- */
8918
- resend(invite) {
8919
- return this.http.post(`${this.environment.apiV2}/${this.url}/${invite.id}/resend`, null)
8920
- .pipe(map((resentInviteBase) => {
8921
- const updatedInvite = plainToClass(EmployeeInvite, resentInviteBase);
8922
- // avoid cache changes
8923
- // @TODO make cache readonly
8924
- const tempCache = _.cloneDeep(this.cache);
8925
- replace(tempCache, plainToClass(EmployeeInvite, updatedInvite));
8926
- this.cache = tempCache;
8927
- this.updateCache();
8928
- return updatedInvite;
8929
- }));
8930
- }
8931
- }
8932
- EmployeeInviteService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EmployeeInviteService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
8933
- EmployeeInviteService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EmployeeInviteService, providedIn: 'root' });
8934
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EmployeeInviteService, decorators: [{
8935
- type: Injectable,
8936
- args: [{
8937
- providedIn: 'root'
8938
- }]
8939
- }] });
8940
-
8941
- // @TODO Alex: think about extend base rest service
8942
- class FirmService {
8943
- constructor(http, environment) {
8944
- this.http = http;
8945
- this.environment = environment;
8946
- this.firmSubject = new ReplaySubject(1);
8947
- }
8948
- /**
8949
- * Register new firm
8950
- * @param data: firm and firm owner data to register
8951
- */
8952
- register(data) {
8953
- return this.http.post(`${this.environment.apiV2}/firms/registration`, data)
8954
- .pipe(map((firm) => {
8955
- return plainToClass(Firm, firm);
8956
- }));
8957
- }
8958
- get() {
8959
- if (!this.firm) {
8960
- this.http.get(`${this.environment.apiV2}/firms/current`)
8961
- .pipe(map((firm) => {
8962
- return plainToClass(Firm, firm);
8963
- }))
8964
- .subscribe((firm) => {
8965
- this.firm = firm;
8966
- this.firmSubject.next(this.firm);
8967
- });
8968
- }
8969
- return this.firmSubject.asObservable();
8970
- }
8971
- update(firm) {
8972
- return this.http.put(`${this.environment.apiV2}/firms/current`, firm)
8973
- .pipe(map((updatedItem) => {
8974
- const updatedInstance = plainToClass(Firm, updatedItem);
8975
- this.firmSubject.next(updatedInstance);
8976
- }));
8977
- }
8978
- /**
8979
- * get list of all registered firms
8980
- */
8981
- getAll() {
8982
- return this.http.get(`${this.environment.apiV2}/firms`)
8983
- .pipe(map((response) => {
8984
- return response['hydra:member'].map((firmBase) => plainToClass(Firm, firmBase));
8985
- }));
8986
- }
8987
- getByType(type) {
8988
- return this.getAll().pipe(map((firms) => {
8989
- return firms.filter((firm) => firm.type === type);
8990
- }));
8991
- }
8992
- updatePhoto(firm, photo) {
8993
- return this.http.post(`${this.environment.apiV2}/firms/photo?_method=PUT`, photo)
8994
- .pipe(map((firmPhoto) => {
8995
- this.firm = plainToClass(Firm, Object.assign(firm, { photo: firmPhoto }));
8996
- this.firmSubject.next(this.firm);
8997
- return firm;
8998
- }));
8999
- }
9000
- }
9001
- FirmService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FirmService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
9002
- FirmService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FirmService, providedIn: 'root' });
9003
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FirmService, decorators: [{
9004
- type: Injectable,
9005
- args: [{
9006
- providedIn: 'root'
9007
- }]
9008
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
9009
- type: Inject,
9010
- args: ['environment']
9011
- }] }]; } });
9012
-
9013
- class HeaderTitleService {
9014
- constructor(router, activatedRoute) {
9015
- this.router = router;
9016
- this.activatedRoute = activatedRoute;
9017
- }
9018
- handleTitle() {
9019
- return this.router.events.pipe(filter((event) => event instanceof NavigationEnd), map(() => this.activatedRoute), map((route) => {
9020
- while (route.firstChild) {
9021
- route = route.firstChild;
9022
- }
9023
- return route;
9024
- }), filter((route) => route.outlet === 'primary'), mergeMap((route) => route.data));
9025
- }
9026
- }
9027
- HeaderTitleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: HeaderTitleService, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable });
9028
- HeaderTitleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: HeaderTitleService, providedIn: 'root' });
9029
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: HeaderTitleService, decorators: [{
9030
- type: Injectable,
9031
- args: [{
9032
- providedIn: 'root'
9033
- }]
9034
- }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }]; } });
9035
-
9036
- /**
9037
- * Service to work with Other Income Forecasts
9038
- */
9039
- class IncomeSourceForecastService extends RestService {
9040
- constructor() {
9041
- super(...arguments);
9042
- this.modelClass = IncomeSourceForecast;
9043
- this.url = 'income-source-forecasts';
9044
- }
9045
- /**
9046
- * Listen to Income Sources events
9047
- */
9048
- listenEvents() {
9049
- this.listenToAddedIncomeSources();
9050
- this.listenToUpdatedIncomeSources();
9051
- }
9052
- /**
9053
- * Listen to EventDispatcherService event related to added Income Sources
9054
- */
9055
- listenToAddedIncomeSources() {
9056
- this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_CREATED)
9057
- .pipe(map((incomeSources) => incomeSources
9058
- .filter((incomeSource) => !incomeSource.isSalaryIncome())))
9059
- .subscribe((incomeSources) => {
9060
- const incomeSourceForecasts = this.assignIncomeSourceForecasts(incomeSources);
9061
- if (incomeSourceForecasts.length) {
9062
- this.addBatch(incomeSourceForecasts).subscribe((createdIncomeSourceForecasts) => {
9063
- this.eventDispatcherService
9064
- .dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_CREATED, createdIncomeSourceForecasts));
9065
- });
9066
- }
9067
- });
9068
- }
9069
- /**
9070
- * Listen to EventDispatcherService event related to updated Income Sources
9071
- */
9072
- listenToUpdatedIncomeSources() {
9073
- this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_UPDATED)
9074
- .subscribe((incomeSources) => {
9075
- const incomeSourceForecasts = this.assignIncomeSourceForecasts(incomeSources);
9076
- if (incomeSourceForecasts.length) {
9077
- this.updateBatch(incomeSourceForecasts).subscribe((updatedIncomeSourceForecasts) => {
9078
- this.eventDispatcherService
9079
- .dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_UPDATED, updatedIncomeSourceForecasts));
9080
- });
9081
- }
9082
- });
9247
+ return this.http.put(`${this.environment.apiV2}/folders/${selectedFolder.id}/documents/${editedDocument.id}`, editedDocument).pipe(map((response) => {
9248
+ const oldFolder = this.cache.find((folder) => folder.id === oldFolderId);
9249
+ // Remove document from old folder
9250
+ oldFolder.documents = oldFolder.documents.filter((deletedDocument) => deletedDocument.id !== response.id);
9251
+ // update old folder and replace it in cache
9252
+ response.folder = plainToClass(DocumentFolder, { id: selectedFolder.id, name: selectedFolder.name });
9253
+ replace(this.cache, plainToClass(DocumentFolder, oldFolder));
9254
+ // update new document folder and replace it in cache
9255
+ selectedFolder.documents.push(plainToClass(Document, response));
9256
+ replace(this.cache, plainToClass(DocumentFolder, selectedFolder));
9257
+ this.cacheSubject.next(this.cache);
9258
+ }));
9083
9259
  }
9084
9260
  /**
9085
- * Assign other income forecasts based on provided income sources
9086
- * @param incomeSources by which other income forecasts will be assigned
9261
+ * Delete document from folder
9262
+ * @param document to remove
9263
+ * @param folder from which document should be removed
9087
9264
  */
9088
- assignIncomeSourceForecasts(incomeSources) {
9089
- return incomeSources.map((incomeSource) => {
9090
- incomeSource.incomeSourceForecasts = incomeSource.incomeSourceForecasts
9091
- .map((incomeSourceForecast) => {
9092
- incomeSourceForecast.incomeSource = plainToClass(IncomeSource, { id: incomeSource.id });
9093
- return incomeSourceForecast;
9094
- });
9095
- return incomeSource.incomeSourceForecasts;
9096
- }).flat();
9265
+ deleteDocument(document, folder) {
9266
+ return this.http.delete(`${this.environment.apiV2}/folders/${folder.id}/documents/${document.id}`).pipe(map(() => {
9267
+ folder.documents = folder.documents
9268
+ .filter((deletedDocument) => deletedDocument.id !== document.id);
9269
+ replace(this.cache, plainToClass(DocumentFolder, folder));
9270
+ this.cacheSubject.next(this.cache);
9271
+ }));
9097
9272
  }
9098
9273
  }
9099
- IncomeSourceForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9100
- IncomeSourceForecastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, providedIn: 'root' });
9101
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, decorators: [{
9274
+ DocumentFolderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9275
+ DocumentFolderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, providedIn: 'root' });
9276
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, decorators: [{
9102
9277
  type: Injectable,
9103
9278
  args: [{
9104
9279
  providedIn: 'root'
9105
9280
  }]
9106
9281
  }] });
9107
9282
 
9108
- /**
9109
- * Service to work with Salary Forecasts
9110
- */
9111
- class SalaryForecastService extends RestService {
9283
+ class EmployeeService extends RestService {
9112
9284
  constructor() {
9113
9285
  super(...arguments);
9114
- this.modelClass = SalaryForecast;
9115
- this.url = 'salary-forecasts';
9116
- }
9117
- /**
9118
- * Listen to Income Sources events
9119
- */
9120
- listenEvents() {
9121
- this.listenToAddedIncomeSources();
9122
- this.listenToUpdatedIncomeSources();
9123
- }
9124
- /**
9125
- * Listen to EventDispatcherService event related to added Income Sources
9126
- */
9127
- listenToAddedIncomeSources() {
9128
- this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_CREATED)
9129
- .pipe(map((incomeSources) => incomeSources
9130
- .filter((incomeSource) => incomeSource.isSalaryIncome())))
9131
- .subscribe((incomeSources) => {
9132
- const salaryForecasts = this.assignSalaryForecasts(incomeSources);
9133
- if (salaryForecasts.length) {
9134
- this.addBatch(salaryForecasts).subscribe((createdSalaryForecasts) => {
9135
- this.eventDispatcherService
9136
- .dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_CREATED, createdSalaryForecasts));
9137
- });
9138
- }
9139
- });
9140
- }
9141
- /**
9142
- * Listen to EventDispatcherService event related to updated Income Sources
9143
- */
9144
- listenToUpdatedIncomeSources() {
9145
- this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_UPDATED)
9146
- .subscribe((incomeSources) => {
9147
- const salaryForecasts = this.assignSalaryForecasts(incomeSources);
9148
- if (salaryForecasts.length) {
9149
- this.updateBatch(salaryForecasts).subscribe((updatedSalaryForecasts) => {
9150
- this.eventDispatcherService
9151
- .dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_UPDATED, updatedSalaryForecasts));
9152
- });
9153
- }
9154
- });
9286
+ this.url = 'employees';
9287
+ this.modelClass = User;
9155
9288
  }
9156
9289
  /**
9157
- * Assign salary forecasts based on provided income sources
9158
- * @param incomeSources by which salary forecasts will be assigned
9290
+ * Grant/Remove Manager role to employee
9291
+ * @param employee
9159
9292
  */
9160
- assignSalaryForecasts(incomeSources) {
9161
- return incomeSources.map((incomeSource) => {
9162
- incomeSource.salaryForecasts = incomeSource.salaryForecasts
9163
- .map((salaryForecast) => {
9164
- salaryForecast.incomeSource = plainToClass(IncomeSource, { id: incomeSource.id });
9165
- return salaryForecast;
9166
- });
9167
- return incomeSource.salaryForecasts;
9168
- }).flat();
9293
+ toggleManagerRole(employee) {
9294
+ return this.http.put(`${this.environment.apiV2}/${this.url}/${employee.id}`, {})
9295
+ .pipe(map((updatedEmployeeBase) => {
9296
+ const tempCache = this.cache;
9297
+ const updatedEmployee = plainToClass(User, updatedEmployeeBase);
9298
+ replace(tempCache, updatedEmployee);
9299
+ this.cache = _.cloneDeep(tempCache);
9300
+ this.updateCache();
9301
+ return updatedEmployee;
9302
+ }));
9169
9303
  }
9170
9304
  }
9171
- SalaryForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9172
- SalaryForecastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, providedIn: 'root' });
9173
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, decorators: [{
9305
+ EmployeeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EmployeeService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9306
+ EmployeeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EmployeeService, providedIn: 'root' });
9307
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EmployeeService, decorators: [{
9174
9308
  type: Injectable,
9175
9309
  args: [{
9176
9310
  providedIn: 'root'
9177
9311
  }]
9178
9312
  }] });
9179
9313
 
9180
- class SoleForecastService extends RestService {
9314
+ class EmployeeInviteService extends RestService {
9181
9315
  constructor() {
9182
9316
  super(...arguments);
9183
- this.modelClass = SoleForecast;
9184
- this.url = 'sole-forecasts';
9185
- }
9186
- /**
9187
- * Listen to Income Sources events
9188
- */
9189
- listenEvents() {
9190
- this.listenToAddedIncomeSources();
9191
- this.listenToUpdatedIncomeSources();
9192
- }
9193
- /**
9194
- * Listen to EventDispatcherService event related to added Income Sources
9195
- */
9196
- listenToAddedIncomeSources() {
9197
- this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_CREATED)
9198
- .pipe(map((incomeSources) => incomeSources
9199
- .filter((incomeSource) => incomeSource.isSoleIncome())))
9200
- .subscribe((incomeSources) => {
9201
- const soleForecasts = this.assignSoleForecasts(incomeSources);
9202
- if (soleForecasts.length) {
9203
- this.addBatch(soleForecasts).subscribe((createdSoleForecasts) => {
9204
- this.eventDispatcherService
9205
- .dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_CREATED, createdSoleForecasts));
9206
- });
9207
- }
9208
- });
9317
+ this.url = 'employees/invites';
9318
+ this.modelClass = EmployeeInvite;
9209
9319
  }
9210
9320
  /**
9211
- * Listen to EventDispatcherService event related to updated Income Sources
9321
+ * Import employees for firm from CSV file
9322
+ * @param file
9212
9323
  */
9213
- listenToUpdatedIncomeSources() {
9214
- this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_UPDATED)
9215
- .subscribe((incomeSources) => {
9216
- const soleForecasts = this.assignSoleForecasts(incomeSources);
9217
- if (soleForecasts.length) {
9218
- this.updateBatch(soleForecasts).subscribe((updatedSoleForecasts) => {
9219
- this.eventDispatcherService
9220
- .dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_UPDATED, updatedSoleForecasts));
9221
- });
9222
- }
9223
- });
9324
+ import(file) {
9325
+ const formData = new FormData();
9326
+ formData.append('file', file);
9327
+ return this.http.post(`${this.environment.apiV2}/${this.url}/import`, formData)
9328
+ .pipe(map((employeeInvite) => {
9329
+ return employeeInvite;
9330
+ }));
9224
9331
  }
9225
9332
  /**
9226
- * Assign sole forecasts based on provided income sources
9227
- * @param incomeSources by which sole forecasts will be assigned
9333
+ * Resend invitation from firm to client
9334
+ * @param invite
9228
9335
  */
9229
- assignSoleForecasts(incomeSources) {
9230
- return incomeSources.map((incomeSource) => {
9231
- incomeSource.soleForecasts = incomeSource.soleForecasts
9232
- .map((soleForecast) => {
9233
- soleForecast.incomeSource = plainToClass(IncomeSource, { id: incomeSource.id });
9234
- return soleForecast;
9235
- });
9236
- return incomeSource.soleForecasts;
9237
- }).flat();
9336
+ resend(invite) {
9337
+ return this.http.post(`${this.environment.apiV2}/${this.url}/${invite.id}/resend`, null)
9338
+ .pipe(map((resentInviteBase) => {
9339
+ const updatedInvite = plainToClass(EmployeeInvite, resentInviteBase);
9340
+ // avoid cache changes
9341
+ // @TODO make cache readonly
9342
+ const tempCache = _.cloneDeep(this.cache);
9343
+ replace(tempCache, plainToClass(EmployeeInvite, updatedInvite));
9344
+ this.cache = tempCache;
9345
+ this.updateCache();
9346
+ return updatedInvite;
9347
+ }));
9238
9348
  }
9239
9349
  }
9240
- SoleForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9241
- SoleForecastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, providedIn: 'root' });
9242
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, decorators: [{
9350
+ EmployeeInviteService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EmployeeInviteService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9351
+ EmployeeInviteService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EmployeeInviteService, providedIn: 'root' });
9352
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: EmployeeInviteService, decorators: [{
9243
9353
  type: Injectable,
9244
9354
  args: [{
9245
9355
  providedIn: 'root'
9246
9356
  }]
9247
9357
  }] });
9248
9358
 
9249
- /**
9250
- * Service to work with intercom
9251
- */
9252
- class IntercomService {
9253
- constructor(environment) {
9359
+ // @TODO Alex: think about extend base rest service
9360
+ class FirmService {
9361
+ constructor(http, environment) {
9362
+ this.http = http;
9254
9363
  this.environment = environment;
9364
+ this.firmSubject = new ReplaySubject(1);
9255
9365
  }
9256
9366
  /**
9257
- * Init object with user credentials
9258
- * @param user
9367
+ * Register new firm
9368
+ * @param data: firm and firm owner data to register
9259
9369
  */
9260
- initUser(user) {
9261
- return {
9262
- app_id: this.environment.intercomAppId,
9263
- email: user.email,
9264
- user_hash: user.hashedEmail
9265
- };
9370
+ register(data) {
9371
+ return this.http.post(`${this.environment.apiV2}/firms/registration`, data)
9372
+ .pipe(map((firm) => {
9373
+ return plainToClass(Firm, firm);
9374
+ }));
9375
+ }
9376
+ get() {
9377
+ if (!this.firm) {
9378
+ this.http.get(`${this.environment.apiV2}/firms/current`)
9379
+ .pipe(map((firm) => {
9380
+ return plainToClass(Firm, firm);
9381
+ }))
9382
+ .subscribe((firm) => {
9383
+ this.firm = firm;
9384
+ this.firmSubject.next(this.firm);
9385
+ });
9386
+ }
9387
+ return this.firmSubject.asObservable();
9388
+ }
9389
+ update(firm) {
9390
+ return this.http.put(`${this.environment.apiV2}/firms/current`, firm)
9391
+ .pipe(map((updatedItem) => {
9392
+ const updatedInstance = plainToClass(Firm, updatedItem);
9393
+ this.firmSubject.next(updatedInstance);
9394
+ }));
9266
9395
  }
9267
9396
  /**
9268
- * Init connection for provided data
9269
- * @param user
9397
+ * get list of all registered firms
9270
9398
  */
9271
- initConnection(user) {
9272
- const connectionCredentials = this.initUser(user);
9273
- window.Intercom('boot', connectionCredentials);
9399
+ getAll() {
9400
+ return this.http.get(`${this.environment.apiV2}/firms`)
9401
+ .pipe(map((response) => {
9402
+ return response['hydra:member'].map((firmBase) => plainToClass(Firm, firmBase));
9403
+ }));
9404
+ }
9405
+ getByType(type) {
9406
+ return this.getAll().pipe(map((firms) => {
9407
+ return firms.filter((firm) => firm.type === type);
9408
+ }));
9409
+ }
9410
+ updatePhoto(firm, photo) {
9411
+ return this.http.post(`${this.environment.apiV2}/firms/photo?_method=PUT`, photo)
9412
+ .pipe(map((firmPhoto) => {
9413
+ this.firm = plainToClass(Firm, Object.assign(firm, { photo: firmPhoto }));
9414
+ this.firmSubject.next(this.firm);
9415
+ return firm;
9416
+ }));
9274
9417
  }
9275
9418
  }
9276
- IntercomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IntercomService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
9277
- IntercomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IntercomService, providedIn: 'root' });
9278
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IntercomService, decorators: [{
9419
+ FirmService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FirmService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
9420
+ FirmService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FirmService, providedIn: 'root' });
9421
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FirmService, decorators: [{
9279
9422
  type: Injectable,
9280
9423
  args: [{
9281
9424
  providedIn: 'root'
9282
9425
  }]
9283
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
9426
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
9284
9427
  type: Inject,
9285
9428
  args: ['environment']
9286
9429
  }] }]; } });
9287
9430
 
9288
- /**
9289
- * Service listen and handle kompassify events
9290
- */
9291
- class KompassifyService {
9292
- constructor(
9293
- // router required for execution of js code from progressbar step
9294
- router) {
9431
+ class HeaderTitleService {
9432
+ constructor(router, activatedRoute) {
9295
9433
  this.router = router;
9434
+ this.activatedRoute = activatedRoute;
9296
9435
  }
9297
- listenEvents() {
9298
- window.addEventListener('message', (event) => {
9299
- // Execute js code from progressbar step
9300
- if (event.data.TYPE === 'KOMPASSIFY_EXECUTE_JS_CODE') {
9301
- eval(event.data.jsCode);
9436
+ handleTitle() {
9437
+ return this.router.events.pipe(filter((event) => event instanceof NavigationEnd), map(() => this.activatedRoute), map((route) => {
9438
+ while (route.firstChild) {
9439
+ route = route.firstChild;
9302
9440
  }
9303
- });
9441
+ return route;
9442
+ }), filter((route) => route.outlet === 'primary'), mergeMap((route) => route.data));
9304
9443
  }
9305
9444
  }
9306
- KompassifyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: KompassifyService, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
9307
- KompassifyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: KompassifyService, providedIn: 'root' });
9308
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: KompassifyService, decorators: [{
9445
+ HeaderTitleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: HeaderTitleService, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable });
9446
+ HeaderTitleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: HeaderTitleService, providedIn: 'root' });
9447
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: HeaderTitleService, decorators: [{
9309
9448
  type: Injectable,
9310
9449
  args: [{
9311
9450
  providedIn: 'root'
9312
9451
  }]
9313
- }], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
9452
+ }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }]; } });
9314
9453
 
9315
9454
  /**
9316
- * Service that handling loans logic
9455
+ * Service to work with Other Income Forecasts
9317
9456
  */
9318
- class LoanService extends RestService {
9457
+ class IncomeSourceForecastService extends RestService {
9319
9458
  constructor() {
9320
9459
  super(...arguments);
9321
- this.url = 'bank-accounts/loans';
9322
- this.modelClass = Loan;
9460
+ this.modelClass = IncomeSourceForecast;
9461
+ this.url = 'income-source-forecasts';
9323
9462
  }
9324
9463
  /**
9325
- * Listen to Loans events
9464
+ * Listen to Income Sources events
9326
9465
  */
9327
9466
  listenEvents() {
9328
- this.listenToAddedLoans();
9329
- this.listenToUpdatedBankAccounts();
9330
- }
9331
- listenToAddedLoans() {
9332
- this.eventDispatcherService.on(AppEventTypeEnum.BANK_ACCOUNT_CREATED)
9333
- .subscribe((bankAccounts) => {
9334
- // fetch loans when loan bank account created
9335
- if (bankAccounts.find(ba => !!ba.loan)) {
9336
- this.resetCache();
9337
- }
9338
- });
9339
- }
9340
- listenToUpdatedBankAccounts() {
9341
- this.eventDispatcherService.on(AppEventTypeEnum.BANK_ACCOUNT_UPDATED)
9342
- .subscribe((updatedBankAccount) => {
9343
- if (!!updatedBankAccount.loan) {
9344
- this.resetCache();
9345
- }
9346
- });
9347
- }
9348
- /**
9349
- * Create Loan
9350
- */
9351
- add(model) {
9352
- return this.addBatch([model])
9353
- .pipe(map((newLoan) => {
9354
- return newLoan[0];
9355
- }));
9467
+ this.listenToAddedIncomeSources();
9468
+ this.listenToUpdatedIncomeSources();
9356
9469
  }
9357
9470
  /**
9358
- * Updated loan
9359
- * @param loan
9471
+ * Listen to EventDispatcherService event related to added Income Sources
9360
9472
  */
9361
- update(loan) {
9362
- return this.http.put(`${this.environment.apiV2}/${this.url}/${loan.id}`, loan)
9363
- .pipe(map((updatedLoanBase) => {
9364
- const updatedLoan = plainToClass(Loan, updatedLoanBase);
9365
- // if loan type is NOT vehicle - fire EventDispatcher event
9366
- if (!updatedLoan.isVehicle()) {
9367
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.LOAN_UPDATED, null));
9473
+ listenToAddedIncomeSources() {
9474
+ this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_CREATED)
9475
+ .pipe(map((incomeSources) => incomeSources
9476
+ .filter((incomeSource) => !incomeSource.isSalaryIncome())))
9477
+ .subscribe((incomeSources) => {
9478
+ const incomeSourceForecasts = this.assignIncomeSourceForecasts(incomeSources);
9479
+ if (incomeSourceForecasts.length) {
9480
+ this.addBatch(incomeSourceForecasts).subscribe((createdIncomeSourceForecasts) => {
9481
+ this.eventDispatcherService
9482
+ .dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_CREATED, createdIncomeSourceForecasts));
9483
+ });
9368
9484
  }
9369
- replace(this.cache, updatedLoan);
9370
- this.updateCache();
9371
- return updatedLoan;
9372
- }));
9373
- }
9374
- /**
9375
- * Get list of vehicle loans
9376
- */
9377
- getVehicleLoans() {
9378
- return this.get()
9379
- .pipe(map((loans) => {
9380
- return loans.filter((loan) => loan.isVehicle());
9381
- }));
9382
- }
9383
- /**
9384
- * Calculate loan payments
9385
- * @param loan
9386
- */
9387
- calculateLoanPayments(loan) {
9388
- return this.http.post(`${this.environment.apiV2}/${this.url}/calculation`, loan).pipe(map((response) => {
9389
- return plainToClass(Loan, response);
9390
- }));
9391
- }
9392
- /**
9393
- * Add new loan payout
9394
- * @param loan
9395
- * @param paidOutLoan
9396
- */
9397
- addPayoutLoan(loan, paidOutLoan) {
9398
- return this.http.post(`${this.environment.apiV2}/loans/${loan.id}/payout`, paidOutLoan).pipe(map((response) => {
9399
- loan.payout = plainToClass(LoanPayout, response);
9400
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.LOAN_PAYOUT_UPDATED, null));
9401
- // reset cache to fetch loans with updated data
9402
- this.resetCache();
9403
- }));
9485
+ });
9404
9486
  }
9405
9487
  /**
9406
- * Delete loan payout
9407
- * @param loan
9408
- * @param payout
9488
+ * Listen to EventDispatcherService event related to updated Income Sources
9409
9489
  */
9410
- deletePayoutLoan(loan, payout) {
9411
- return this.http.delete(`${this.environment.apiV2}/loans/${loan.id}/payout/${payout.id}`).pipe(map(() => {
9412
- loan.payout = null;
9413
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.LOAN_PAYOUT_UPDATED, null));
9414
- // reset cache to fetch loans with updated data
9415
- this.resetCache();
9416
- }));
9490
+ listenToUpdatedIncomeSources() {
9491
+ this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_UPDATED)
9492
+ .subscribe((incomeSources) => {
9493
+ const incomeSourceForecasts = this.assignIncomeSourceForecasts(incomeSources);
9494
+ if (incomeSourceForecasts.length) {
9495
+ this.updateBatch(incomeSourceForecasts).subscribe((updatedIncomeSourceForecasts) => {
9496
+ this.eventDispatcherService
9497
+ .dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_UPDATED, updatedIncomeSourceForecasts));
9498
+ });
9499
+ }
9500
+ });
9417
9501
  }
9418
9502
  /**
9419
- * Update loan payout
9420
- * @param loan
9421
- * @param paidOutLoan
9503
+ * Assign other income forecasts based on provided income sources
9504
+ * @param incomeSources by which other income forecasts will be assigned
9422
9505
  */
9423
- updatePayoutLoan(loan, paidOutLoan) {
9424
- return this.http.put(`${this.environment.apiV2}/loans/${loan.id}/payout/${paidOutLoan.id}`, paidOutLoan).pipe(map((response) => {
9425
- loan.payout = plainToClass(LoanPayout, response);
9426
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.LOAN_PAYOUT_UPDATED, null));
9427
- // reset cache to fetch loans with updated data
9428
- this.resetCache();
9429
- }));
9506
+ assignIncomeSourceForecasts(incomeSources) {
9507
+ return incomeSources.map((incomeSource) => {
9508
+ incomeSource.incomeSourceForecasts = incomeSource.incomeSourceForecasts
9509
+ .map((incomeSourceForecast) => {
9510
+ incomeSourceForecast.incomeSource = plainToClass(IncomeSource, { id: incomeSource.id });
9511
+ return incomeSourceForecast;
9512
+ });
9513
+ return incomeSource.incomeSourceForecasts;
9514
+ }).flat();
9430
9515
  }
9431
9516
  }
9432
- LoanService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9433
- LoanService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, providedIn: 'root' });
9434
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, decorators: [{
9517
+ IncomeSourceForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9518
+ IncomeSourceForecastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, providedIn: 'root' });
9519
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, decorators: [{
9435
9520
  type: Injectable,
9436
9521
  args: [{
9437
9522
  providedIn: 'root'
@@ -9439,503 +9524,512 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
9439
9524
  }] });
9440
9525
 
9441
9526
  /**
9442
- * Service to handle service notifications logic
9527
+ * Service to work with Salary Forecasts
9443
9528
  */
9444
- class ServiceNotificationService extends RestService {
9445
- constructor(http, eventDispatcherService, environment, toastService, sseService) {
9446
- super(http, eventDispatcherService, environment, toastService);
9447
- this.http = http;
9448
- this.eventDispatcherService = eventDispatcherService;
9449
- this.environment = environment;
9450
- this.toastService = toastService;
9451
- this.sseService = sseService;
9452
- this.modelClass = Notification;
9453
- this.url = 'service-notifications';
9454
- this.isHydra = true;
9455
- this.listenNotifications();
9529
+ class SalaryForecastService extends RestService {
9530
+ constructor() {
9531
+ super(...arguments);
9532
+ this.modelClass = SalaryForecast;
9533
+ this.url = 'salary-forecasts';
9456
9534
  }
9457
9535
  /**
9458
- * subscribe to new chat messages
9536
+ * Listen to Income Sources events
9459
9537
  */
9460
- listenNotifications() {
9461
- this.sseService.on(`serviceNotification`).subscribe((notificationBase) => {
9462
- const notification = plainToClass(Notification, notificationBase);
9463
- const cache = clone(this.cache);
9464
- // update existing notification if read and add new notification if not read
9465
- if (notification.isRead) {
9466
- replace(cache, notification);
9538
+ listenEvents() {
9539
+ this.listenToAddedIncomeSources();
9540
+ this.listenToUpdatedIncomeSources();
9541
+ }
9542
+ /**
9543
+ * Listen to EventDispatcherService event related to added Income Sources
9544
+ */
9545
+ listenToAddedIncomeSources() {
9546
+ this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_CREATED)
9547
+ .pipe(map((incomeSources) => incomeSources
9548
+ .filter((incomeSource) => incomeSource.isSalaryIncome())))
9549
+ .subscribe((incomeSources) => {
9550
+ const salaryForecasts = this.assignSalaryForecasts(incomeSources);
9551
+ if (salaryForecasts.length) {
9552
+ this.addBatch(salaryForecasts).subscribe((createdSalaryForecasts) => {
9553
+ this.eventDispatcherService
9554
+ .dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_CREATED, createdSalaryForecasts));
9555
+ });
9467
9556
  }
9468
- else {
9469
- cache.unshift(notification);
9557
+ });
9558
+ }
9559
+ /**
9560
+ * Listen to EventDispatcherService event related to updated Income Sources
9561
+ */
9562
+ listenToUpdatedIncomeSources() {
9563
+ this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_UPDATED)
9564
+ .subscribe((incomeSources) => {
9565
+ const salaryForecasts = this.assignSalaryForecasts(incomeSources);
9566
+ if (salaryForecasts.length) {
9567
+ this.updateBatch(salaryForecasts).subscribe((updatedSalaryForecasts) => {
9568
+ this.eventDispatcherService
9569
+ .dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_UPDATED, updatedSalaryForecasts));
9570
+ });
9470
9571
  }
9471
- this.cache = cache;
9472
- this.cacheSubject.next(this.cache);
9473
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.NOTIFICATION_ADDED, notification));
9474
9572
  });
9475
9573
  }
9574
+ /**
9575
+ * Assign salary forecasts based on provided income sources
9576
+ * @param incomeSources by which salary forecasts will be assigned
9577
+ */
9578
+ assignSalaryForecasts(incomeSources) {
9579
+ return incomeSources.map((incomeSource) => {
9580
+ incomeSource.salaryForecasts = incomeSource.salaryForecasts
9581
+ .map((salaryForecast) => {
9582
+ salaryForecast.incomeSource = plainToClass(IncomeSource, { id: incomeSource.id });
9583
+ return salaryForecast;
9584
+ });
9585
+ return incomeSource.salaryForecasts;
9586
+ }).flat();
9587
+ }
9476
9588
  }
9477
- ServiceNotificationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServiceNotificationService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: SseService }], target: i0.ɵɵFactoryTarget.Injectable });
9478
- ServiceNotificationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServiceNotificationService, providedIn: 'root' });
9479
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServiceNotificationService, decorators: [{
9589
+ SalaryForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9590
+ SalaryForecastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, providedIn: 'root' });
9591
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, decorators: [{
9480
9592
  type: Injectable,
9481
9593
  args: [{
9482
9594
  providedIn: 'root'
9483
9595
  }]
9484
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
9485
- type: Inject,
9486
- args: ['environment']
9487
- }] }, { type: ToastService }, { type: SseService }]; } });
9596
+ }] });
9488
9597
 
9489
- /**
9490
- * Configuration file with the settings to generate PDF file
9491
- */
9492
- const PDF_CONFIG = {
9493
- text: {
9494
- fontSize: 12,
9495
- fontName: 'helvetica',
9496
- fontStyle: '',
9497
- fontWeight: 'bold',
9498
- positionX: 14,
9499
- positionY: 10,
9500
- colorWhite: '#ffffff',
9501
- colorBlack: '#000000',
9502
- colorPrimary: '#00b7f0'
9503
- },
9504
- logo: {
9505
- src: '/assets/img/icons/logo.png',
9506
- width: 30,
9507
- height: 7,
9508
- positionX: 42,
9509
- positionY: 6
9510
- },
9511
- // coords for file section title (group, table, e.t.c.)
9512
- contentTitleCoords: {
9513
- marginTop: 15
9514
- },
9515
- contentCoords: {
9516
- marginTop: 15,
9517
- marginLeft: 14
9518
- },
9519
- table: {
9520
- headStyles: {
9521
- fillColor: '#00b7f0',
9522
- lineWidth: .2,
9523
- halign: 'center'
9524
- },
9525
- footStyles: {
9526
- fillColor: '#ffffff',
9527
- textColor: '#000000'
9528
- },
9598
+ class SoleForecastService extends RestService {
9599
+ constructor() {
9600
+ super(...arguments);
9601
+ this.modelClass = SoleForecast;
9602
+ this.url = 'sole-forecasts';
9529
9603
  }
9530
- };
9531
-
9532
- /**
9533
- * Service to work with PDF (generate, download, e.t.c.)
9534
- */
9535
- class PdfService {
9536
9604
  /**
9537
- * Export file from provided HTML tables
9605
+ * Listen to Income Sources events
9538
9606
  */
9539
- exportTables(tables, fileSettings) {
9540
- const document = this.generateFromTables(tables, fileSettings);
9541
- document.save(`${fileSettings.filename}.pdf`);
9607
+ listenEvents() {
9608
+ this.listenToAddedIncomeSources();
9609
+ this.listenToUpdatedIncomeSources();
9542
9610
  }
9543
9611
  /**
9544
- * Export file from provided array-like table data
9612
+ * Listen to EventDispatcherService event related to added Income Sources
9545
9613
  */
9546
- exportFromDataTables(dataTables, fileSettings) {
9547
- const document = this.generateFromDataTables(dataTables, fileSettings.title);
9548
- document.save(`${fileSettings.filename}.pdf`);
9614
+ listenToAddedIncomeSources() {
9615
+ this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_CREATED)
9616
+ .pipe(map((incomeSources) => incomeSources
9617
+ .filter((incomeSource) => incomeSource.isSoleIncome())))
9618
+ .subscribe((incomeSources) => {
9619
+ const soleForecasts = this.assignSoleForecasts(incomeSources);
9620
+ if (soleForecasts.length) {
9621
+ this.addBatch(soleForecasts).subscribe((createdSoleForecasts) => {
9622
+ this.eventDispatcherService
9623
+ .dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_CREATED, createdSoleForecasts));
9624
+ });
9625
+ }
9626
+ });
9549
9627
  }
9550
9628
  /**
9551
- * Generate file from array-like table data
9629
+ * Listen to EventDispatcherService event related to updated Income Sources
9552
9630
  */
9553
- generateFromDataTables(dataTables, title) {
9554
- const pdf = new jsPDF();
9555
- this.setDocumentTitle(pdf, title);
9556
- this.setDocumentLogo(pdf);
9557
- dataTables.forEach((dataTable) => {
9558
- autoTable(pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer] }, this.setTableOptions(pdf, dataTable.caption)));
9559
- });
9560
- return pdf;
9561
- }
9562
- generateFromTables(tables, fileSettings) {
9563
- const pdf = new jsPDF(fileSettings.orientation);
9564
- this.setDocumentTitle(pdf, fileSettings.title);
9565
- this.setDocumentLogo(pdf);
9566
- tables.forEach((table) => {
9567
- // Add table caption if not provided
9568
- if (!table.caption) {
9569
- table.createCaption();
9570
- table.caption.innerText = '';
9631
+ listenToUpdatedIncomeSources() {
9632
+ this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_UPDATED)
9633
+ .subscribe((incomeSources) => {
9634
+ const soleForecasts = this.assignSoleForecasts(incomeSources);
9635
+ if (soleForecasts.length) {
9636
+ this.updateBatch(soleForecasts).subscribe((updatedSoleForecasts) => {
9637
+ this.eventDispatcherService
9638
+ .dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_UPDATED, updatedSoleForecasts));
9639
+ });
9571
9640
  }
9572
- autoTable(pdf, Object.assign({ html: table }, this.setTableOptions(pdf, table.caption.innerText)));
9573
9641
  });
9574
- return pdf;
9575
9642
  }
9576
9643
  /**
9577
- * Set basic options for PDF table
9644
+ * Assign sole forecasts based on provided income sources
9645
+ * @param incomeSources by which sole forecasts will be assigned
9578
9646
  */
9579
- setTableOptions(pdf, tableCaption = '') {
9580
- const lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
9581
- // get caption height based on caption content height
9582
- const captionHeight = pdf.getTextDimensions(pdf.splitTextToSize(tableCaption, pdf.internal.pageSize.width)).h;
9583
- pdf.text(tableCaption, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
9647
+ assignSoleForecasts(incomeSources) {
9648
+ return incomeSources.map((incomeSource) => {
9649
+ incomeSource.soleForecasts = incomeSource.soleForecasts
9650
+ .map((soleForecast) => {
9651
+ soleForecast.incomeSource = plainToClass(IncomeSource, { id: incomeSource.id });
9652
+ return soleForecast;
9653
+ });
9654
+ return incomeSource.soleForecasts;
9655
+ }).flat();
9656
+ }
9657
+ }
9658
+ SoleForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9659
+ SoleForecastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, providedIn: 'root' });
9660
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, decorators: [{
9661
+ type: Injectable,
9662
+ args: [{
9663
+ providedIn: 'root'
9664
+ }]
9665
+ }] });
9666
+
9667
+ /**
9668
+ * Service to work with intercom
9669
+ */
9670
+ class IntercomService {
9671
+ constructor(environment) {
9672
+ this.environment = environment;
9673
+ }
9674
+ /**
9675
+ * Init object with user credentials
9676
+ * @param user
9677
+ */
9678
+ initUser(user) {
9584
9679
  return {
9585
- headStyles: {
9586
- fillColor: PDF_CONFIG.text.colorPrimary,
9587
- },
9588
- footStyles: {
9589
- fillColor: PDF_CONFIG.text.colorWhite,
9590
- textColor: PDF_CONFIG.text.colorBlack
9591
- },
9592
- startY: lastTableCoords + captionHeight + PDF_CONFIG.contentTitleCoords.marginTop,
9593
- didParseCell: (data) => {
9594
- // Align last column content to right
9595
- if (data.table.columns.length > 1 && (data.column.index === data.table.columns.length - 1)) {
9596
- data.cell.styles.halign = 'right';
9597
- }
9598
- }
9680
+ app_id: this.environment.intercomAppId,
9681
+ email: user.email,
9682
+ user_hash: user.hashedEmail
9599
9683
  };
9600
9684
  }
9601
- setDocumentTitle(doc, title) {
9602
- doc.setFontSize(PDF_CONFIG.text.fontSize)
9603
- .setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
9604
- .text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
9605
- }
9606
- setDocumentLogo(doc) {
9607
- const logo = new Image();
9608
- logo.src = PDF_CONFIG.logo.src;
9609
- doc.addImage(logo, 'PNG', doc.internal.pageSize.width - PDF_CONFIG.logo.positionX, PDF_CONFIG.logo.positionY, PDF_CONFIG.logo.width, PDF_CONFIG.logo.height);
9685
+ /**
9686
+ * Init connection for provided data
9687
+ * @param user
9688
+ */
9689
+ initConnection(user) {
9690
+ const connectionCredentials = this.initUser(user);
9691
+ window.Intercom('boot', connectionCredentials);
9610
9692
  }
9611
9693
  }
9612
- PdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
9613
- PdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, providedIn: 'root' });
9614
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, decorators: [{
9694
+ IntercomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IntercomService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
9695
+ IntercomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IntercomService, providedIn: 'root' });
9696
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IntercomService, decorators: [{
9615
9697
  type: Injectable,
9616
9698
  args: [{
9617
9699
  providedIn: 'root'
9618
9700
  }]
9619
- }] });
9701
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
9702
+ type: Inject,
9703
+ args: ['environment']
9704
+ }] }]; } });
9620
9705
 
9621
- function enumToList(data) {
9622
- const list = [];
9623
- for (const key in data) {
9624
- if (Number(key) >= 0) {
9625
- list.push({
9626
- label: data[key],
9627
- value: Number(key)
9628
- });
9629
- }
9706
+ /**
9707
+ * Service listen and handle kompassify events
9708
+ */
9709
+ class KompassifyService {
9710
+ constructor(
9711
+ // router required for execution of js code from progressbar step
9712
+ router) {
9713
+ this.router = router;
9714
+ }
9715
+ listenEvents() {
9716
+ window.addEventListener('message', (event) => {
9717
+ // Execute js code from progressbar step
9718
+ if (event.data.TYPE === 'KOMPASSIFY_EXECUTE_JS_CODE') {
9719
+ eval(event.data.jsCode);
9720
+ }
9721
+ });
9630
9722
  }
9631
- return list;
9632
9723
  }
9633
-
9634
- var MessagesEnum;
9635
- (function (MessagesEnum) {
9636
- MessagesEnum["DELETED_MESSAGE"] = "Transaction deleted";
9637
- MessagesEnum["UPDATED_MESSAGE"] = "Transaction updated";
9638
- MessagesEnum["CREATED_MESSAGE"] = "Transaction(s) created";
9639
- })(MessagesEnum || (MessagesEnum = {}));
9724
+ KompassifyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: KompassifyService, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
9725
+ KompassifyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: KompassifyService, providedIn: 'root' });
9726
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: KompassifyService, decorators: [{
9727
+ type: Injectable,
9728
+ args: [{
9729
+ providedIn: 'root'
9730
+ }]
9731
+ }], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
9640
9732
 
9641
9733
  /**
9642
- * Service for transactions business logic
9734
+ * Service that handling loans logic
9643
9735
  */
9644
- class TransactionService extends RestService {
9736
+ class LoanService extends RestService {
9645
9737
  constructor() {
9646
9738
  super(...arguments);
9647
- // url part for Transaction API
9648
- this.url = 'transactions';
9649
- this.modelClass = Transaction;
9650
- this.transactionDeleted = new EventEmitter();
9739
+ this.url = 'bank-accounts/loans';
9740
+ this.modelClass = Loan;
9651
9741
  }
9652
9742
  /**
9653
- * Listen events from Event Dispatcher services
9743
+ * Listen to Loans events
9654
9744
  */
9655
9745
  listenEvents() {
9656
- this.listenDepreciationChange();
9657
- this.listenPropertyShareUpdate();
9746
+ this.listenToAddedLoans();
9747
+ this.listenToUpdatedBankAccounts();
9658
9748
  }
9659
- /**
9660
- * get list of all user's TaxTank transactions
9661
- */
9662
- get() {
9663
- if (!this.cache) {
9664
- // set cache as default empty array to avoid multiple backend requests
9665
- this.cache = [];
9666
- this.fetch()
9667
- .subscribe((transactions) => {
9668
- this.cache = transactions;
9669
- this.updateCache();
9670
- });
9671
- }
9672
- return this.cacheSubject.asObservable().pipe(
9673
- // assign child transactions (fees) to parent transactions
9674
- map((transactions) => {
9675
- transactions.forEach((transaction) => {
9676
- transaction.transactions = transactions
9677
- // get list of child transactions
9678
- .filter((t) => t.parentTransaction && t.parentTransaction.id === transaction.id);
9679
- });
9680
- sort(transactions, 'date', false);
9681
- return transactions;
9682
- }));
9749
+ listenToAddedLoans() {
9750
+ this.eventDispatcherService.on(AppEventTypeEnum.BANK_ACCOUNT_CREATED)
9751
+ .subscribe((bankAccounts) => {
9752
+ // fetch loans when loan bank account created
9753
+ if (bankAccounts.find(ba => !!ba.loan)) {
9754
+ this.resetCache();
9755
+ }
9756
+ });
9757
+ }
9758
+ listenToUpdatedBankAccounts() {
9759
+ this.eventDispatcherService.on(AppEventTypeEnum.BANK_ACCOUNT_UPDATED)
9760
+ .subscribe((updatedBankAccount) => {
9761
+ if (!!updatedBankAccount.loan) {
9762
+ this.resetCache();
9763
+ }
9764
+ });
9683
9765
  }
9684
9766
  /**
9685
- * Add single new transaction
9686
- * @param model New Transaction instance for saving
9767
+ * Create Loan
9687
9768
  */
9688
9769
  add(model) {
9689
- // we don't have POST API endpoint for single transaction
9690
9770
  return this.addBatch([model])
9691
- .pipe(map((newTransactions) => {
9692
- // @TODO alex
9693
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTION_CREATED, newTransactions[0]));
9694
- return newTransactions[0];
9771
+ .pipe(map((newLoan) => {
9772
+ return newLoan[0];
9695
9773
  }));
9696
9774
  }
9697
9775
  /**
9698
- * get transactions related with property
9776
+ * Updated loan
9777
+ * @param loan
9699
9778
  */
9700
- getByPropertyId(propertyId) {
9701
- return this.get()
9702
- .pipe(map((transactions) => {
9703
- return transactions.filter((transaction) => {
9704
- var _a;
9705
- return ((_a = transaction.property) === null || _a === void 0 ? void 0 : _a.id) === propertyId;
9706
- });
9779
+ update(loan) {
9780
+ return this.http.put(`${this.environment.apiV2}/${this.url}/${loan.id}`, loan)
9781
+ .pipe(map((updatedLoanBase) => {
9782
+ const updatedLoan = plainToClass(Loan, updatedLoanBase);
9783
+ // if loan type is NOT vehicle - fire EventDispatcher event
9784
+ if (!updatedLoan.isVehicle()) {
9785
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.LOAN_UPDATED, null));
9786
+ }
9787
+ replace(this.cache, updatedLoan);
9788
+ this.updateCache();
9789
+ return updatedLoan;
9707
9790
  }));
9708
9791
  }
9709
9792
  /**
9710
- * get list of transactions with tank type 'Work'
9793
+ * Get list of vehicle loans
9711
9794
  */
9712
- getWorkTransactions() {
9795
+ getVehicleLoans() {
9713
9796
  return this.get()
9714
- .pipe(map((transactions) => {
9715
- return transactions.filter((transaction) => transaction.isWorkTank());
9716
- }));
9717
- }
9718
- /**
9719
- * Get list of property holding costs (transactions related to vacant land property)
9720
- */
9721
- getPropertyHoldingCosts(propertyId) {
9722
- return this.http.get(`${this.environment.apiV2}/${this.url}?propertyId=${propertyId}&propertyCategoryId=${PropertyCategoryListEnum.VACANT_LAND}`)
9723
- .pipe(map((transactionsBase) => {
9724
- return transactionsBase.map((transactionBase) => plainToClass(Transaction, transactionBase));
9725
- }));
9726
- }
9727
- /**
9728
- * get list of taxable transactions with tank type 'Work'
9729
- */
9730
- getTaxableWorkTransactions() {
9731
- return this.getWorkTransactions()
9732
- .pipe(map((transactions) => {
9733
- return transactions.filter((transaction) => !!transaction.chartAccounts.taxReturnItem);
9797
+ .pipe(map((loans) => {
9798
+ return loans.filter((loan) => loan.isVehicle());
9734
9799
  }));
9735
9800
  }
9736
9801
  /**
9737
- * add multiple transactions
9738
- * @param transactions List of new Transaction instances for saving
9802
+ * Calculate loan payments
9803
+ * @param loan
9739
9804
  */
9740
- addBatch(transactions) {
9741
- transactions = _.cloneDeep(transactions);
9742
- return this.http.post(`${this.environment.apiV2}/${this.url}`, transactions)
9743
- .pipe(map((response) => {
9744
- const addedTransactions = response.map((item) => plainToClass(Transaction, item));
9745
- transactions.forEach((transaction, index) => {
9746
- // @TODO backend: need to upload file in the same backend endpoint with transaction add/update
9747
- // check if passed receipt and upload file
9748
- if (transaction.file) {
9749
- transaction.id = response[index].id;
9750
- addedTransactions[index].file = transaction.file;
9751
- this.uploadReceipt(addedTransactions[index]);
9752
- }
9753
- // @TODO Viktor: implement API for saving of nested transactions
9754
- // add child transactions if exist
9755
- if (transaction.transactions.length) {
9756
- transaction.transactions.forEach((childTransaction) => {
9757
- childTransaction.parentTransaction = plainToClass(Transaction, { id: addedTransactions[index].id });
9758
- });
9759
- this.addBatch(transaction.transactions).subscribe();
9760
- }
9761
- // add transfer transaction to cache
9762
- if (transaction.operation === TransactionOperationEnum.TRANSFER) {
9763
- addedTransactions.push(addedTransactions[0].transfer);
9764
- }
9765
- });
9766
- if (this.cache) {
9767
- this.cache.push(...addedTransactions);
9768
- this.updateCache();
9769
- }
9770
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTIONS_CREATED, addedTransactions));
9771
- this.toastService.success(MessagesEnum.CREATED_MESSAGE);
9772
- return addedTransactions;
9805
+ calculateLoanPayments(loan) {
9806
+ return this.http.post(`${this.environment.apiV2}/${this.url}/calculation`, loan).pipe(map((response) => {
9807
+ return plainToClass(Loan, response);
9773
9808
  }));
9774
9809
  }
9775
9810
  /**
9776
- * update existing transaction
9777
- * @param transaction Transaction instance for updating
9811
+ * Add new loan payout
9812
+ * @param loan
9813
+ * @param paidOutLoan
9778
9814
  */
9779
- update(transaction) {
9780
- return this.http.put(`${this.environment.apiV2}/${this.url}/${transaction.id}`, transaction)
9781
- .pipe(map((response) => {
9782
- const updatedTransaction = plainToClass(Transaction, response);
9783
- // @TODO need to upload file in the same backend endpoint with transaction add/update
9784
- // check if passed new receipt and upload file
9785
- if (transaction.file) {
9786
- updatedTransaction.file = transaction.file;
9787
- this.uploadReceipt(updatedTransaction);
9788
- }
9789
- // @TODO Viktor: implement API for saving of nested transactions
9790
- if (transaction.transactions.length) {
9791
- // add parent transaction to child transactions
9792
- transaction.transactions.forEach((childTransaction) => {
9793
- childTransaction.parentTransaction = plainToClass(Transaction, { id: updatedTransaction.id });
9794
- });
9795
- // separate child transactions by id existing to define add or update action.
9796
- const childTransactionsToUpdate = transaction.transactions.filter((t) => t.id);
9797
- const childTransactionsToAdd = transaction.transactions.filter((t) => !t.id);
9798
- // update child transactions
9799
- if (childTransactionsToUpdate.length) {
9800
- this.updateBatch(childTransactionsToUpdate).subscribe();
9801
- }
9802
- // add child transactions
9803
- if (childTransactionsToAdd.length) {
9804
- this.addBatch(childTransactionsToAdd).subscribe();
9805
- }
9806
- }
9807
- this.toastService.success(MessagesEnum.UPDATED_MESSAGE);
9808
- replace(this.cache, updatedTransaction);
9809
- this.updateCache();
9810
- return updatedTransaction;
9815
+ addPayoutLoan(loan, paidOutLoan) {
9816
+ return this.http.post(`${this.environment.apiV2}/loans/${loan.id}/payout`, paidOutLoan).pipe(map((response) => {
9817
+ loan.payout = plainToClass(LoanPayout, response);
9818
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.LOAN_PAYOUT_UPDATED, null));
9819
+ // reset cache to fetch loans with updated data
9820
+ this.resetCache();
9811
9821
  }));
9812
9822
  }
9813
9823
  /**
9814
- * update multiple transactions
9815
- * @param transactions list of transactions for updating
9824
+ * Delete loan payout
9825
+ * @param loan
9826
+ * @param payout
9816
9827
  */
9817
- updateBatch(transactions) {
9818
- return this.http.put(`${this.environment.apiV2}/${this.url}`, transactions)
9819
- .pipe(map((response) => {
9820
- const updatedTransactions = response.map((item) => plainToClass(Transaction, item));
9821
- updatedTransactions.forEach((updatedTransaction) => {
9822
- replace(this.cache, updatedTransaction);
9823
- });
9824
- this.updateCache();
9825
- return updatedTransactions;
9828
+ deletePayoutLoan(loan, payout) {
9829
+ return this.http.delete(`${this.environment.apiV2}/loans/${loan.id}/payout/${payout.id}`).pipe(map(() => {
9830
+ loan.payout = null;
9831
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.LOAN_PAYOUT_UPDATED, null));
9832
+ // reset cache to fetch loans with updated data
9833
+ this.resetCache();
9826
9834
  }));
9827
9835
  }
9828
9836
  /**
9829
- * delete transaction and related transactions
9830
- * @param model
9837
+ * Update loan payout
9838
+ * @param loan
9839
+ * @param paidOutLoan
9831
9840
  */
9832
- delete(model) {
9833
- return this.http.delete(`${this.environment.apiV2}/${this.url}/${model.id}`)
9834
- .pipe(map(() => {
9835
- this.cache = this.cache.filter((transaction) => {
9836
- var _a;
9837
- // when delete transfer we delete actually 2 transactions
9838
- if (model.isTransfer) {
9839
- const ids = [model.id];
9840
- // get id of related transfer transaction
9841
- if (model.transfer) {
9842
- // just take id if we delete source transaction
9843
- ids.push(model.transfer.id);
9844
- }
9845
- else {
9846
- // find source transaction id if we delete destination transaction
9847
- ids.push(this.cache.find((t) => t.transfer.id === model.id).id);
9848
- }
9849
- return !ids.includes(transaction.id);
9850
- }
9851
- return transaction.id !== model.id && ((_a = transaction.parentTransaction) === null || _a === void 0 ? void 0 : _a.id) !== model.id;
9852
- });
9853
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTION_DELETED, model));
9854
- this.toastService.success(MessagesEnum.DELETED_MESSAGE);
9855
- this.updateCache();
9856
- this.transactionDeleted.emit(model);
9841
+ updatePayoutLoan(loan, paidOutLoan) {
9842
+ return this.http.put(`${this.environment.apiV2}/loans/${loan.id}/payout/${paidOutLoan.id}`, paidOutLoan).pipe(map((response) => {
9843
+ loan.payout = plainToClass(LoanPayout, response);
9844
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.LOAN_PAYOUT_UPDATED, null));
9845
+ // reset cache to fetch loans with updated data
9846
+ this.resetCache();
9857
9847
  }));
9858
9848
  }
9849
+ }
9850
+ LoanService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9851
+ LoanService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, providedIn: 'root' });
9852
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, decorators: [{
9853
+ type: Injectable,
9854
+ args: [{
9855
+ providedIn: 'root'
9856
+ }]
9857
+ }] });
9858
+
9859
+ /**
9860
+ * Service to handle service notifications logic
9861
+ */
9862
+ class ServiceNotificationService extends RestService {
9863
+ constructor(http, eventDispatcherService, environment, toastService, sseService) {
9864
+ super(http, eventDispatcherService, environment, toastService);
9865
+ this.http = http;
9866
+ this.eventDispatcherService = eventDispatcherService;
9867
+ this.environment = environment;
9868
+ this.toastService = toastService;
9869
+ this.sseService = sseService;
9870
+ this.modelClass = Notification;
9871
+ this.url = 'service-notifications';
9872
+ this.isHydra = true;
9873
+ this.listenNotifications();
9874
+ }
9859
9875
  /**
9860
- * upload transaction receipt image
9861
- * @param transaction Еhe transaction for which the receipt will be imported
9876
+ * subscribe to new chat messages
9862
9877
  */
9863
- uploadReceipt(transaction) {
9864
- const formData = new FormData();
9865
- formData.append('file', transaction.file);
9866
- transaction.receipt = null;
9867
- this.http.post(`${this.environment.apiV2}/${this.url}/${transaction.id}/receipts`, formData)
9868
- .subscribe((receiptResponse) => {
9869
- // we don't need to keep file after save
9870
- transaction.file = null;
9871
- transaction.receipt = plainToClass(TransactionReceipt, receiptResponse);
9872
- replace(this.cache, transaction);
9873
- this.updateCache();
9878
+ listenNotifications() {
9879
+ this.sseService.on(`serviceNotification`).subscribe((notificationBase) => {
9880
+ const notification = plainToClass(Notification, notificationBase);
9881
+ const cache = clone(this.cache);
9882
+ // update existing notification if read and add new notification if not read
9883
+ if (notification.isRead) {
9884
+ replace(cache, notification);
9885
+ }
9886
+ else {
9887
+ cache.unshift(notification);
9888
+ }
9889
+ this.cache = cache;
9890
+ this.cacheSubject.next(this.cache);
9891
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.NOTIFICATION_ADDED, notification));
9874
9892
  });
9875
9893
  }
9894
+ }
9895
+ ServiceNotificationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServiceNotificationService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: SseService }], target: i0.ɵɵFactoryTarget.Injectable });
9896
+ ServiceNotificationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServiceNotificationService, providedIn: 'root' });
9897
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServiceNotificationService, decorators: [{
9898
+ type: Injectable,
9899
+ args: [{
9900
+ providedIn: 'root'
9901
+ }]
9902
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
9903
+ type: Inject,
9904
+ args: ['environment']
9905
+ }] }, { type: ToastService }, { type: SseService }]; } });
9906
+
9907
+ /**
9908
+ * Configuration file with the settings to generate PDF file
9909
+ */
9910
+ const PDF_CONFIG = {
9911
+ text: {
9912
+ fontSize: 12,
9913
+ fontName: 'helvetica',
9914
+ fontStyle: '',
9915
+ fontWeight: 'bold',
9916
+ positionX: 14,
9917
+ positionY: 10,
9918
+ colorWhite: '#ffffff',
9919
+ colorBlack: '#000000',
9920
+ colorPrimary: '#00b7f0'
9921
+ },
9922
+ logo: {
9923
+ src: '/assets/img/icons/logo.png',
9924
+ width: 30,
9925
+ height: 7,
9926
+ positionX: 42,
9927
+ positionY: 6
9928
+ },
9929
+ // coords for file section title (group, table, e.t.c.)
9930
+ contentTitleCoords: {
9931
+ marginTop: 15
9932
+ },
9933
+ contentCoords: {
9934
+ marginTop: 15,
9935
+ marginLeft: 14
9936
+ },
9937
+ table: {
9938
+ headStyles: {
9939
+ fillColor: '#00b7f0',
9940
+ lineWidth: .2,
9941
+ halign: 'center'
9942
+ },
9943
+ footStyles: {
9944
+ fillColor: '#ffffff',
9945
+ textColor: '#000000'
9946
+ },
9947
+ }
9948
+ };
9949
+
9950
+ /**
9951
+ * Service to work with PDF (generate, download, e.t.c.)
9952
+ */
9953
+ class PdfService {
9876
9954
  /**
9877
- * calculate gross income amount based on transaction amount and taxes (fees)
9878
- * @param transaction Transaction instance for calculation
9955
+ * Export file from provided HTML tables
9879
9956
  */
9880
- calculateGrossAmount(transaction) {
9881
- let amount = transaction.amount || 0;
9882
- // gross income amount includes amount of fees for property tank and tax for work tank
9883
- if (transaction.isPropertyTank()) {
9884
- amount += transaction.transactions.reduce((sum, item) => sum + item.amount, 0);
9885
- }
9886
- else {
9887
- // @TODO Alex: fix logic after TT-641 ready
9888
- amount += (transaction.tax || 0);
9889
- }
9890
- return amount;
9957
+ exportTables(tables, fileSettings) {
9958
+ const document = this.generateFromTables(tables, fileSettings);
9959
+ document.save(`${fileSettings.filename}.pdf`);
9891
9960
  }
9892
9961
  /**
9893
- * get label for transaction tax field depended of selected chart account.
9894
- * tax type depends of chart account heading or category.
9962
+ * Export file from provided array-like table data
9895
9963
  */
9896
- getTaxLabel(chartAccounts) {
9897
- var _a, _b;
9898
- // get simple array of ids from enum with taxable chart accounts headings
9899
- const taxableCAHeadingsIds = enumToList(ChartAccountsHeadingTaxableEnum)
9900
- .map((item) => item.value);
9901
- // get simple array of ids from enum with tax deductible chart accounts headings
9902
- const deductibleCAHeadingsIds = enumToList(ChartAccountsHeadingTaxDeductibleEnum)
9903
- .map((item) => item.value);
9904
- // check if one of ids arrays includes current chart accounts heading id and set tax label
9905
- // otherwise label is empty for this class
9906
- switch (true) {
9907
- case taxableCAHeadingsIds.includes((_a = chartAccounts.heading) === null || _a === void 0 ? void 0 : _a.id):
9908
- return ChartAccountsTaxLabelsEnum.TAX_PAID;
9909
- case deductibleCAHeadingsIds.includes((_b = chartAccounts.heading) === null || _b === void 0 ? void 0 : _b.id):
9910
- return ChartAccountsTaxLabelsEnum.TAX_DEDUCTED;
9911
- case CHART_ACCOUNTS_CATEGORIES.workIncome.includes(chartAccounts.category):
9912
- return ChartAccountsTaxLabelsEnum.TAX_WITHHELD;
9913
- default:
9914
- return null;
9915
- }
9964
+ exportFromDataTables(dataTables, fileSettings) {
9965
+ const document = this.generateFromDataTables(dataTables, fileSettings.title);
9966
+ document.save(`${fileSettings.filename}.pdf`);
9916
9967
  }
9917
9968
  /**
9918
- * Listen to EventDispatcherService event related to Depreciation changing
9969
+ * Generate file from array-like table data
9919
9970
  */
9920
- listenDepreciationChange() {
9921
- this.eventDispatcherService.on(AppEventTypeEnum.DEPRECIATION_DELETED).subscribe(() => {
9922
- this.fetch()
9923
- .subscribe((transactions) => {
9924
- this.cache = transactions;
9925
- this.updateCache();
9926
- });
9971
+ generateFromDataTables(dataTables, title) {
9972
+ const pdf = new jsPDF();
9973
+ this.setDocumentTitle(pdf, title);
9974
+ this.setDocumentLogo(pdf);
9975
+ dataTables.forEach((dataTable) => {
9976
+ autoTable(pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer] }, this.setTableOptions(pdf, dataTable.caption)));
9977
+ });
9978
+ return pdf;
9979
+ }
9980
+ generateFromTables(tables, fileSettings) {
9981
+ const pdf = new jsPDF(fileSettings.orientation);
9982
+ this.setDocumentTitle(pdf, fileSettings.title);
9983
+ this.setDocumentLogo(pdf);
9984
+ tables.forEach((table) => {
9985
+ // Add table caption if not provided
9986
+ if (!table.caption) {
9987
+ table.createCaption();
9988
+ table.caption.innerText = '';
9989
+ }
9990
+ autoTable(pdf, Object.assign({ html: table }, this.setTableOptions(pdf, table.caption.innerText)));
9927
9991
  });
9992
+ return pdf;
9928
9993
  }
9929
9994
  /**
9930
- * Listen to EventDispatcherService event related to Property Share changing
9995
+ * Set basic options for PDF table
9931
9996
  */
9932
- listenPropertyShareUpdate() {
9933
- this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(() => this.resetCache());
9997
+ setTableOptions(pdf, tableCaption = '') {
9998
+ const lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
9999
+ // get caption height based on caption content height
10000
+ const captionHeight = pdf.getTextDimensions(pdf.splitTextToSize(tableCaption, pdf.internal.pageSize.width)).h;
10001
+ pdf.text(tableCaption, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
10002
+ return {
10003
+ headStyles: {
10004
+ fillColor: PDF_CONFIG.text.colorPrimary,
10005
+ },
10006
+ footStyles: {
10007
+ fillColor: PDF_CONFIG.text.colorWhite,
10008
+ textColor: PDF_CONFIG.text.colorBlack
10009
+ },
10010
+ startY: lastTableCoords + captionHeight + PDF_CONFIG.contentTitleCoords.marginTop,
10011
+ didParseCell: (data) => {
10012
+ // Align last column content to right
10013
+ if (data.table.columns.length > 1 && (data.column.index === data.table.columns.length - 1)) {
10014
+ data.cell.styles.halign = 'right';
10015
+ }
10016
+ }
10017
+ };
10018
+ }
10019
+ setDocumentTitle(doc, title) {
10020
+ doc.setFontSize(PDF_CONFIG.text.fontSize)
10021
+ .setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
10022
+ .text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
10023
+ }
10024
+ setDocumentLogo(doc) {
10025
+ const logo = new Image();
10026
+ logo.src = PDF_CONFIG.logo.src;
10027
+ doc.addImage(logo, 'PNG', doc.internal.pageSize.width - PDF_CONFIG.logo.positionX, PDF_CONFIG.logo.positionY, PDF_CONFIG.logo.width, PDF_CONFIG.logo.height);
9934
10028
  }
9935
10029
  }
9936
- TransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9937
- TransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, providedIn: 'root' });
9938
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, decorators: [{
10030
+ PdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
10031
+ PdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, providedIn: 'root' });
10032
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, decorators: [{
9939
10033
  type: Injectable,
9940
10034
  args: [{
9941
10035
  providedIn: 'root'
@@ -10453,55 +10547,16 @@ class SubscriptionService {
10453
10547
  }
10454
10548
  return this.serviceSubscriptionSubject.asObservable();
10455
10549
  }
10456
- /**
10457
- * @TODO right now we have only monthly prices, the function should be refactored to support other options in future
10458
- *
10459
- * create available subscription plans based on existing products
10460
- */
10461
- getSubscriptionPlans() {
10462
- if (!this._serviceSubscriptions) {
10463
- this.http.get(`${this.environment.apiV2}/service-prices`)
10464
- .pipe(map((response) => {
10465
- return new ServicePriceCollection(response['hydra:member'].map((item) => plainToClass(ServicePrice, item)));
10466
- }))
10467
- .subscribe((prices) => {
10468
- this._serviceSubscriptions = new ServiceSubscriptionCollection([
10469
- plainToClass(ServiceSubscription, { items: [] }),
10470
- plainToClass(ServiceSubscription, {
10471
- items: [plainToClass(ServiceSubscriptionItem, {
10472
- price: prices.property,
10473
- quantity: 2
10474
- })]
10475
- }),
10476
- plainToClass(ServiceSubscription, {
10477
- items: [plainToClass(ServiceSubscriptionItem, {
10478
- price: prices.property,
10479
- quantity: 3
10480
- })]
10481
- })
10482
- ]);
10483
- this._serviceSubscriptions.items.forEach((subscription) => {
10484
- subscription.items.push(plainToClass(ServiceSubscriptionItem, { price: prices.work, quantity: 1 }));
10485
- });
10486
- this.serviceSubscriptionsSubject.next(this._serviceSubscriptions);
10487
- });
10488
- }
10489
- return this.serviceSubscriptionsSubject.asObservable();
10490
- }
10491
10550
  /**
10492
10551
  * redirect to stripe payment page
10493
10552
  */
10494
- checkoutRedirect(subscription, successUrl, cancelUrl) {
10553
+ checkoutRedirect(subscription) {
10495
10554
  return __awaiter(this, void 0, void 0, function* () {
10496
10555
  const stripe = yield loadStripe(this.environment.stripePk);
10497
- // @TODO vik
10498
- const lineItems = subscription.items.map((item) => {
10499
- return { servicePriceId: item.price.id, quantity: item.quantity };
10500
- });
10501
10556
  this.http.post(`${this.environment.apiV2}/stripe/checkout-session`, {
10502
- lineItems,
10503
- successUrl: successUrl,
10504
- cancelUrl: cancelUrl
10557
+ items: subscription.items,
10558
+ successUrl: window.location.href,
10559
+ cancelUrl: window.location.href
10505
10560
  })
10506
10561
  .subscribe((session) => {
10507
10562
  // @Todo remove user TRIAL status
@@ -10564,6 +10619,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
10564
10619
  args: ['environment']
10565
10620
  }] }]; } });
10566
10621
 
10622
+ /**
10623
+ * Service that handling banks logic
10624
+ */
10625
+ class ServicePriceService extends RestService {
10626
+ constructor() {
10627
+ super(...arguments);
10628
+ this.modelClass = ServicePrice;
10629
+ this.url = 'service-prices';
10630
+ this.isHydra = true;
10631
+ }
10632
+ }
10633
+ ServicePriceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServicePriceService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
10634
+ ServicePriceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServicePriceService, providedIn: 'root' });
10635
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServicePriceService, decorators: [{
10636
+ type: Injectable,
10637
+ args: [{
10638
+ providedIn: 'root'
10639
+ }]
10640
+ }] });
10641
+
10567
10642
  /**
10568
10643
  * Service to work with tax review
10569
10644
  */
@@ -11487,5 +11562,5 @@ class VehicleClaimForm extends AbstractForm {
11487
11562
  * Generated bundle index. Do not edit.
11488
11563
  */
11489
11564
 
11490
- export { AbstractForm, AccountSetupItem, AccountSetupItemCollection, AccountSetupService, Address, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqConfig, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartAccountsValue, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientIncomeTypes, ClientIncomeTypesForm, ClientIncomeTypesService, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReceipt, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportDataTable, ExportFormatEnum, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, KompassifyService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookPeriod, LoginForm, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, Notification, Occupation, OccupationService, PasswordForm, PdfOrientationEnum, PdfService, PdfSettings, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyHoldingCostsService, PropertyReportItem, PropertyReportItemCollection, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleService, PropertySaleTaxExemptionMetadata, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceTypeEnum, ServiceProduct, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, ShareFilterOptionsEnum, SoleForecast, SoleForecastService, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetadata, TaxExemptionMetadataEnum, TaxExemptionService, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimForm, VehicleClaimMethodEnum, VehicleClaimService, VehicleCollection, VehicleExpense, VehicleExpenseCollection, VehicleForm, VehicleLogbook, VehicleLogbookCollection, VehicleLogbookPurposeEnum, VehicleLogbookService, VehicleService, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, XlsxService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
11565
+ export { AbstractForm, AccountSetupItem, AccountSetupItemCollection, AccountSetupService, Address, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqConfig, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartAccountsValue, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientIncomeTypes, ClientIncomeTypesForm, ClientIncomeTypesService, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReceipt, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportDataTable, ExportFormatEnum, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, KompassifyService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookPeriod, LoginForm, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, Notification, Occupation, OccupationService, PasswordForm, PdfOrientationEnum, PdfService, PdfSettings, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyHoldingCostsService, PropertyReportItem, PropertyReportItemCollection, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleService, PropertySaleTaxExemptionMetadata, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceRecurringIntervalEnum, ServicePriceService, ServicePriceTypeEnum, ServiceProduct, ServiceProductStatusEnum, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, ShareFilterOptionsEnum, SoleForecast, SoleForecastService, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetadata, TaxExemptionMetadataEnum, TaxExemptionService, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimForm, VehicleClaimMethodEnum, VehicleClaimService, VehicleCollection, VehicleExpense, VehicleExpenseCollection, VehicleForm, VehicleLogbook, VehicleLogbookCollection, VehicleLogbookPurposeEnum, VehicleLogbookService, VehicleService, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, XlsxService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
11491
11566
  //# sourceMappingURL=taxtank-core.js.map