taxtank-core 0.1.5 → 0.2.3

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 (72) hide show
  1. package/bundles/taxtank-core.umd.js +383 -282
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/abstract.collection.js +19 -3
  4. package/esm2015/lib/collections/collection-dictionary.js +4 -1
  5. package/esm2015/lib/collections/user-event-setting.collection.js +3 -55
  6. package/esm2015/lib/db/Enums/chart-accounts-metadata-list.enum.js +2 -3
  7. package/esm2015/lib/db/Enums/user-event-status.enum.js +2 -1
  8. package/esm2015/lib/db/Enums/user-event-type-client-type.enum.js +29 -0
  9. package/esm2015/lib/db/Enums/user-event-type-employee-type.enum.js +17 -0
  10. package/esm2015/lib/db/Enums/user-event-type-frequency.enum.js +4 -5
  11. package/esm2015/lib/db/Enums/user-event-type-user-type.enum.js +7 -0
  12. package/esm2015/lib/db/Models/user-event-setting.js +1 -1
  13. package/esm2015/lib/db/Models/user-event-type-category.js +3 -0
  14. package/esm2015/lib/db/Models/user-event-type.js +1 -1
  15. package/esm2015/lib/db/Models/user-event.js +1 -1
  16. package/esm2015/lib/models/data-table/data-table-column.js +13 -0
  17. package/esm2015/lib/models/data-table/data-table.js +40 -0
  18. package/esm2015/lib/models/endpoint/endpoints.const.js +3 -1
  19. package/esm2015/lib/models/notification/notification.js +13 -37
  20. package/esm2015/lib/models/pdf/pdf-config.js +24 -0
  21. package/esm2015/lib/models/transaction/transaction.js +5 -5
  22. package/esm2015/lib/models/user-event/user-event-setting.js +3 -3
  23. package/esm2015/lib/models/user-event/user-event-type-category.js +4 -0
  24. package/esm2015/lib/models/user-event/user-event-type.js +13 -18
  25. package/esm2015/lib/services/bank/bank-connection.service.js +10 -1
  26. package/esm2015/lib/services/bank/bank-transaction.service.js +3 -3
  27. package/esm2015/lib/services/bank/basiq.service.js +3 -3
  28. package/esm2015/lib/services/firm/firm.service.js +2 -2
  29. package/esm2015/lib/services/pdf/pdf.service.js +55 -0
  30. package/esm2015/lib/services/xlsx/xlsx.service.js +54 -0
  31. package/esm2015/public-api.js +9 -7
  32. package/fesm2015/taxtank-core.js +336 -254
  33. package/fesm2015/taxtank-core.js.map +1 -1
  34. package/lib/collections/abstract.collection.d.ts +4 -1
  35. package/lib/collections/collection-dictionary.d.ts +4 -1
  36. package/lib/collections/user-event-setting.collection.d.ts +1 -23
  37. package/lib/db/Enums/chart-accounts-metadata-list.enum.d.ts +1 -2
  38. package/lib/db/Enums/user-event-status.enum.d.ts +2 -1
  39. package/lib/db/Enums/user-event-type-client-type.enum.d.ts +27 -0
  40. package/lib/db/Enums/user-event-type-employee-type.enum.d.ts +15 -0
  41. package/lib/db/Enums/user-event-type-frequency.enum.d.ts +3 -4
  42. package/lib/db/Enums/user-event-type-user-type.enum.d.ts +5 -0
  43. package/lib/db/Models/user-event-setting.d.ts +1 -1
  44. package/lib/db/Models/user-event-type-category.d.ts +4 -0
  45. package/lib/db/Models/user-event-type.d.ts +5 -3
  46. package/lib/db/Models/user-event.d.ts +3 -1
  47. package/lib/models/data-table/data-table-column.d.ts +20 -0
  48. package/lib/models/data-table/data-table.d.ts +24 -0
  49. package/lib/models/notification/notification.d.ts +4 -6
  50. package/lib/models/pdf/pdf-config.d.ts +8 -0
  51. package/lib/models/transaction/transaction.d.ts +1 -3
  52. package/lib/models/user-event/user-event-setting.d.ts +1 -1
  53. package/lib/models/user-event/user-event-type-category.d.ts +3 -0
  54. package/lib/models/user-event/user-event-type.d.ts +4 -2
  55. package/lib/services/bank/bank-connection.service.d.ts +2 -0
  56. package/lib/services/firm/firm.service.d.ts +1 -1
  57. package/lib/services/pdf/pdf.service.d.ts +14 -0
  58. package/lib/services/xlsx/xlsx.service.d.ts +11 -0
  59. package/package.json +6 -2
  60. package/public-api.d.ts +8 -6
  61. package/esm2015/lib/db/Enums/user-event-type-reminder-type.enum.js +0 -8
  62. package/esm2015/lib/db/Enums/user-event-type-reminder.enum.js +0 -7
  63. package/esm2015/lib/db/Enums/user-event-type-type.enum.js +0 -35
  64. package/esm2015/lib/models/notification/notification-event-types.const.js +0 -43
  65. package/esm2015/lib/models/user-event/user-event-category.enum.js +0 -11
  66. package/esm2015/lib/models/user-event/user-event-category.js +0 -6
  67. package/lib/db/Enums/user-event-type-reminder-type.enum.d.ts +0 -6
  68. package/lib/db/Enums/user-event-type-reminder.enum.d.ts +0 -5
  69. package/lib/db/Enums/user-event-type-type.enum.d.ts +0 -33
  70. package/lib/models/notification/notification-event-types.const.d.ts +0 -7
  71. package/lib/models/user-event/user-event-category.d.ts +0 -8
  72. package/lib/models/user-event/user-event-category.enum.d.ts +0 -9
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('lodash/has'), require('lodash/get'), require('lodash/flatten'), require('lodash/first'), require('lodash/last'), require('lodash/uniqBy'), require('lodash/concat'), require('lodash/compact'), require('class-transformer'), require('moment'), require('moment-range'), require('lodash/cloneDeep'), require('@angular/forms'), require('rxjs'), require('rxjs/operators'), require('@angular/common/http'), require('@auth0/angular-jwt'), require('lodash'), require('event-source-polyfill/src/eventsource.min.js'), require('@angular/router'), require('lodash/clone'), require('@stripe/stripe-js')) :
3
- typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', 'lodash/has', 'lodash/get', 'lodash/flatten', 'lodash/first', 'lodash/last', 'lodash/uniqBy', 'lodash/concat', 'lodash/compact', 'class-transformer', 'moment', 'moment-range', 'lodash/cloneDeep', '@angular/forms', 'rxjs', 'rxjs/operators', '@angular/common/http', '@auth0/angular-jwt', 'lodash', 'event-source-polyfill/src/eventsource.min.js', '@angular/router', 'lodash/clone', '@stripe/stripe-js'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.has, global.get, global.flatten, global.first, global.last, global.uniqBy, global.concat, global.compact, global.classTransformer, global.moment, global.momentRange, global.cloneDeep$1, global.ng.forms, global.rxjs, global.rxjs.operators, global.ng.common.http, global.angularJwt, global._, global.eventsource_min_js, global.ng.router, global.clone, global.stripeJs));
5
- })(this, (function (exports, i0, common, has, get, flatten, first, last, uniqBy, concat, compact, classTransformer, moment, momentRange, cloneDeep$1, forms, rxjs, operators, i1, angularJwt, _, eventsource_min_js, i1$1, clone, stripeJs) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('lodash/has'), require('lodash/get'), require('lodash/flatten'), require('lodash/first'), require('lodash/last'), require('lodash/uniqBy'), require('lodash/concat'), require('lodash/compact'), require('class-transformer'), require('moment'), require('moment-range'), require('lodash/cloneDeep'), require('@angular/forms'), require('rxjs'), require('rxjs/operators'), require('@angular/common/http'), require('@auth0/angular-jwt'), require('lodash'), require('event-source-polyfill/src/eventsource.min.js'), require('@angular/router'), require('lodash/clone'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
3
+ typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', 'lodash/has', 'lodash/get', 'lodash/flatten', 'lodash/first', 'lodash/last', 'lodash/uniqBy', 'lodash/concat', 'lodash/compact', 'class-transformer', 'moment', 'moment-range', 'lodash/cloneDeep', '@angular/forms', 'rxjs', 'rxjs/operators', '@angular/common/http', '@auth0/angular-jwt', 'lodash', 'event-source-polyfill/src/eventsource.min.js', '@angular/router', 'lodash/clone', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.has, global.get, global.flatten, global.first, global.last, global.uniqBy, global.concat, global.compact, global.classTransformer, global.moment, global.momentRange, global.cloneDeep$1, global.ng.forms, global.rxjs, global.rxjs.operators, global.ng.common.http, global.angularJwt, global._, global.eventsource_min_js, global.ng.router, global.clone, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
5
+ })(this, (function (exports, i0, common, has, get, flatten, first, last, uniqBy, concat, compact, classTransformer, moment, momentRange, cloneDeep$1, forms, rxjs, operators, i1, angularJwt, _, eventsource_min_js, i1$1, clone, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -39,6 +39,10 @@
39
39
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
40
40
  var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
41
41
  var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone);
42
+ var jsPDF__default = /*#__PURE__*/_interopDefaultLegacy(jsPDF);
43
+ var autoTable__default = /*#__PURE__*/_interopDefaultLegacy(autoTable);
44
+ var xlsx__namespace = /*#__PURE__*/_interopNamespace(xlsx);
45
+ var FileSaver__namespace = /*#__PURE__*/_interopNamespace(FileSaver);
42
46
 
43
47
  var TtCoreModule = /** @class */ (function () {
44
48
  function TtCoreModule() {
@@ -453,6 +457,9 @@
453
457
  if (items === void 0) { items = []; }
454
458
  return new this.collectionConstructor(items);
455
459
  };
460
+ CollectionDictionary.prototype.length = function () {
461
+ return this.keys.length;
462
+ };
456
463
  /**
457
464
  * Group collection items by passed path into items object
458
465
  */
@@ -480,6 +487,7 @@
480
487
  return CollectionDictionary;
481
488
  }());
482
489
 
490
+ var DEFAULT_INDEX = 'other';
483
491
  /**
484
492
  * collection abstract class. Contains common properties and methods for all collections
485
493
  */
@@ -488,8 +496,24 @@
488
496
  if (items === void 0) { items = []; }
489
497
  this.items = items;
490
498
  }
491
- AbstractCollection.prototype.groupBy = function (prop) {
492
- return new CollectionDictionary(this, prop);
499
+ AbstractCollection.prototype.create = function (items) {
500
+ if (items === void 0) { items = []; }
501
+ return new this.constructor(items);
502
+ };
503
+ AbstractCollection.prototype.getBy = function (field, value) {
504
+ return this.create(this.items.filter(function (item) { return item[field] === value; }));
505
+ };
506
+ AbstractCollection.prototype.groupBy = function (path) {
507
+ if (path === void 0) { path = ''; }
508
+ return new CollectionDictionary(this, path);
509
+ };
510
+ AbstractCollection.prototype.indexBy = function (path) {
511
+ // Create empty initial object for groups
512
+ var result = {};
513
+ this.toArray().forEach(function (model) {
514
+ result[get__default["default"](model, path, DEFAULT_INDEX)] = model;
515
+ });
516
+ return result;
493
517
  };
494
518
  /**
495
519
  * Iterator that allow to iterate collection items
@@ -2078,143 +2102,16 @@
2078
2102
  return TransactionCollection;
2079
2103
  }(AbstractCollection));
2080
2104
 
2081
- var UserEventSetting$1 = /** @class */ (function () {
2082
- function UserEventSetting() {
2083
- }
2084
- return UserEventSetting;
2085
- }());
2086
-
2087
- var UserEventType$1 = /** @class */ (function () {
2088
- function UserEventType() {
2089
- }
2090
- return UserEventType;
2091
- }());
2092
-
2093
- /**
2094
- * Category of user event type
2095
- */
2096
- var UserEventCategory = /** @class */ (function () {
2097
- function UserEventCategory() {
2098
- }
2099
- return UserEventCategory;
2100
- }());
2101
-
2102
- /**
2103
- * Enum with user event categories
2104
- */
2105
- exports.UserEventCategoryEnum = void 0;
2106
- (function (UserEventCategoryEnum) {
2107
- UserEventCategoryEnum[UserEventCategoryEnum["USER"] = 1] = "USER";
2108
- UserEventCategoryEnum[UserEventCategoryEnum["CO_OWNER"] = 2] = "CO_OWNER";
2109
- UserEventCategoryEnum[UserEventCategoryEnum["FIRM"] = 3] = "FIRM";
2110
- UserEventCategoryEnum[UserEventCategoryEnum["BASIQ"] = 4] = "BASIQ";
2111
- })(exports.UserEventCategoryEnum || (exports.UserEventCategoryEnum = {}));
2112
-
2113
- var UserEventType = /** @class */ (function (_super) {
2114
- __extends(UserEventType, _super);
2115
- function UserEventType() {
2116
- return _super !== null && _super.apply(this, arguments) || this;
2117
- }
2118
- return UserEventType;
2119
- }(UserEventType$1));
2120
- __decorate([
2121
- classTransformer.Expose({ toClassOnly: true }),
2122
- classTransformer.Transform(function (_a) {
2123
- var obj = _a.obj;
2124
- switch (true) {
2125
- case String(obj.type).startsWith('1'):
2126
- return classTransformer.plainToClass(UserEventCategory, { name: 'User\'s events', type: exports.UserEventCategoryEnum.USER });
2127
- case String(obj.type).startsWith('2'):
2128
- return classTransformer.plainToClass(UserEventCategory, { name: 'Co-owner\'s events', type: exports.UserEventCategoryEnum.CO_OWNER });
2129
- case String(obj.type).startsWith('3'):
2130
- return classTransformer.plainToClass(UserEventCategory, { name: 'Firm\'s events', type: exports.UserEventCategoryEnum.FIRM });
2131
- default:
2132
- return classTransformer.plainToClass(UserEventCategory, { name: 'Basiq events', type: exports.UserEventCategoryEnum.BASIQ });
2133
- }
2134
- }),
2135
- classTransformer.Type(function () { return UserEventCategory; })
2136
- ], UserEventType.prototype, "category", void 0);
2137
-
2138
- var UserEventSetting = /** @class */ (function (_super) {
2139
- __extends(UserEventSetting, _super);
2140
- function UserEventSetting() {
2141
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
2142
- // flag indicates that the setting is updating now saved or not
2143
- _this.isUpdating = false;
2144
- return _this;
2145
- }
2146
- return UserEventSetting;
2147
- }(UserEventSetting$1));
2148
- __decorate([
2149
- classTransformer.Type(function () { return UserEventType; })
2150
- ], UserEventSetting.prototype, "userEventType", void 0);
2151
- __decorate([
2152
- classTransformer.Exclude({ toPlainOnly: true })
2153
- ], UserEventSetting.prototype, "isUpdating", void 0);
2154
-
2155
2105
  /**
2156
2106
  * Collection of user event settings
2157
2107
  */
2158
2108
  var UserEventSettingCollection = /** @class */ (function (_super) {
2159
2109
  __extends(UserEventSettingCollection, _super);
2160
- function UserEventSettingCollection(items, userEventTypes) {
2161
- var _this = _super.call(this, items) || this;
2162
- _this.setItems(userEventTypes);
2163
- return _this;
2110
+ function UserEventSettingCollection() {
2111
+ return _super !== null && _super.apply(this, arguments) || this;
2164
2112
  }
2165
- /**
2166
- * Flag that indicates if all settings are selected for provided field
2167
- */
2168
- UserEventSettingCollection.prototype.isAllSelected = function (field) {
2169
- return !this.items.find(function (item) { return !item[field]; });
2170
- };
2171
- /**
2172
- * Flag that indicates if all settings are deselected for provided field
2173
- */
2174
- UserEventSettingCollection.prototype.isAllDeselected = function (field) {
2175
- return !this.items.find(function (item) { return item[field]; });
2176
- };
2177
- /**
2178
- * Check is any setting is updating by 'isUpdating' flag
2179
- */
2180
- UserEventSettingCollection.prototype.isAnyUpdating = function () {
2181
- return this.items.some(function (item) { return item.isUpdating; });
2182
- };
2183
- Object.defineProperty(UserEventSettingCollection.prototype, "commonFrequencyType", {
2184
- /**
2185
- * Get frequency type based on each collection item 'frequency' field value
2186
- */
2187
- get: function () {
2188
- var _this = this;
2189
- var frequencyDictionary = new CollectionDictionary(this, '', 'frequency');
2190
- return +Object.keys(frequencyDictionary).find(function (key) { return frequencyDictionary[key].length === _this.length; }) || false;
2191
- },
2192
- enumerable: false,
2193
- configurable: true
2194
- });
2195
- /**
2196
- * Rewrite collection items with provided user event types
2197
- */
2198
- UserEventSettingCollection.prototype.setItems = function (userEventTypes) {
2199
- var _this = this;
2200
- if (!userEventTypes) {
2201
- return;
2202
- }
2203
- this.items = userEventTypes.map(function (userEventType) {
2204
- // find existing setting by user event type id
2205
- var existingSetting = _this.items.find(function (setting) { return setting.userEventType.id === userEventType.id; });
2206
- // if setting exist - return new UserEventSetting instance based on existing setting and default user event type
2207
- if (existingSetting) {
2208
- return classTransformer.plainToClass(UserEventSetting, Object.assign(existingSetting, { userEventType: userEventType }));
2209
- }
2210
- // ...or return new UserEventSetting instance based on default user event type
2211
- return classTransformer.plainToClass(UserEventSetting, {
2212
- byEmail: userEventType.byEmail,
2213
- byNotification: userEventType.byNotification,
2214
- frequency: userEventType.frequency,
2215
- userEventType: userEventType
2216
- });
2217
- });
2113
+ UserEventSettingCollection.prototype.getConfigurableBy = function (field) {
2114
+ return new UserEventSettingCollection(this.items.filter(function (setting) { return setting[field] !== null; }));
2218
2115
  };
2219
2116
  return UserEventSettingCollection;
2220
2117
  }(AbstractCollection));
@@ -2424,8 +2321,7 @@
2424
2321
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["TAX_OFFSETS"] = 8] = "TAX_OFFSETS";
2425
2322
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["HOURS"] = 11] = "HOURS";
2426
2323
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["TAX_PAID"] = 13] = "TAX_PAID";
2427
- ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["REDUNDANCY"] = 17] = "REDUNDANCY";
2428
- ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["NON_REDUNDANCY"] = 18] = "NON_REDUNDANCY";
2324
+ ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["TAX_FREE_COMPONENT"] = 18] = "TAX_FREE_COMPONENT";
2429
2325
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["YEARS_OF_SERVICE"] = 19] = "YEARS_OF_SERVICE";
2430
2326
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["UNTAXED_ELEMENT"] = 24] = "UNTAXED_ELEMENT";
2431
2327
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["FRANKED"] = 26] = "FRANKED";
@@ -2818,65 +2714,68 @@
2818
2714
  UserEventStatusEnum[UserEventStatusEnum["NEED_ACTION"] = 2] = "NEED_ACTION";
2819
2715
  UserEventStatusEnum[UserEventStatusEnum["DONE"] = 3] = "DONE";
2820
2716
  UserEventStatusEnum[UserEventStatusEnum["REFUSED"] = 4] = "REFUSED";
2717
+ UserEventStatusEnum[UserEventStatusEnum["OUTDATED"] = 5] = "OUTDATED";
2821
2718
  })(exports.UserEventStatusEnum || (exports.UserEventStatusEnum = {}));
2822
2719
 
2823
2720
  exports.UserEventTypeFrequencyEnum = void 0;
2824
2721
  (function (UserEventTypeFrequencyEnum) {
2825
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["ONCE"] = 1] = "ONCE";
2826
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["DAILY"] = 2] = "DAILY";
2827
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["WEEKLY"] = 3] = "WEEKLY";
2828
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["MONTHLY"] = 4] = "MONTHLY";
2722
+ UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["DAILY"] = 1] = "DAILY";
2723
+ UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["WEEKLY"] = 2] = "WEEKLY";
2724
+ UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["MONTHLY"] = 3] = "MONTHLY";
2829
2725
  })(exports.UserEventTypeFrequencyEnum || (exports.UserEventTypeFrequencyEnum = {}));
2830
2726
 
2831
- exports.UserEventTypeReminderEnum = void 0;
2832
- (function (UserEventTypeReminderEnum) {
2833
- UserEventTypeReminderEnum[UserEventTypeReminderEnum["ONCE"] = 1] = "ONCE";
2834
- UserEventTypeReminderEnum[UserEventTypeReminderEnum["TWICE"] = 2] = "TWICE";
2835
- UserEventTypeReminderEnum[UserEventTypeReminderEnum["EVERY_DAY"] = 3] = "EVERY_DAY";
2836
- })(exports.UserEventTypeReminderEnum || (exports.UserEventTypeReminderEnum = {}));
2837
-
2838
- exports.UserEventTypeReminderTypeEnum = void 0;
2839
- (function (UserEventTypeReminderTypeEnum) {
2840
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["NEVER"] = 0] = "NEVER";
2841
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["ONCE"] = 1] = "ONCE";
2842
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["TWICE"] = 2] = "TWICE";
2843
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["EVERY_DAY"] = 3] = "EVERY_DAY";
2844
- })(exports.UserEventTypeReminderTypeEnum || (exports.UserEventTypeReminderTypeEnum = {}));
2845
-
2846
- exports.UserEventTypeTypeEnum = void 0;
2847
- (function (UserEventTypeTypeEnum) {
2848
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_INVITE"] = 101] = "USER_INVITE";
2849
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_CONFIRMATION"] = 102] = "USER_CONFIRMATION";
2850
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_RESET_PASSWORD"] = 103] = "USER_RESET_PASSWORD";
2851
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_SUBSCRIBED"] = 104] = "USER_SUBSCRIBED";
2852
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_UPGRADE_SUBSCRIPTION"] = 105] = "USER_UPGRADE_SUBSCRIPTION";
2853
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_DOWNGRADE_SUBSCRIPTION"] = 106] = "USER_DOWNGRADE_SUBSCRIPTION";
2854
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_CANCEL_SUBSCRIPTION"] = 107] = "USER_CANCEL_SUBSCRIPTION";
2855
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_INVITE_SEND"] = 201] = "CO_OWNER_INVITE_SEND";
2856
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_INVITE_ACCEPT"] = 202] = "CO_OWNER_INVITE_ACCEPT";
2857
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_INVITE_REJECT"] = 203] = "CO_OWNER_INVITE_REJECT";
2858
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_REGISTER"] = 204] = "CO_OWNER_REGISTER";
2859
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_CHANGES_OFFER"] = 210] = "CO_OWNER_CHANGES_OFFER";
2860
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_CHANGES_ACCEPT"] = 211] = "CO_OWNER_CHANGES_ACCEPT";
2861
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_CHANGES_REJECT"] = 212] = "CO_OWNER_CHANGES_REJECT";
2862
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_JOIN"] = 301] = "CLIENT_INVITE_TO_JOIN";
2863
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_JOIN_ACCEPTED"] = 302] = "CLIENT_INVITE_TO_JOIN_ACCEPTED";
2864
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_JOIN_REJECTED"] = 303] = "CLIENT_INVITE_TO_JOIN_REJECTED";
2865
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 304] = "CLIENT_INVITE_TO_REGISTER";
2866
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_LEFT_FIRM"] = 305] = "CLIENT_LEFT_FIRM";
2867
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_JOIN"] = 320] = "EMPLOYEE_INVITE_TO_JOIN";
2868
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_JOIN_ACCEPTED"] = 321] = "EMPLOYEE_INVITE_TO_JOIN_ACCEPTED";
2869
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_JOIN_REJECTED"] = 322] = "EMPLOYEE_INVITE_TO_JOIN_REJECTED";
2870
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_REGISTER"] = 325] = "EMPLOYEE_INVITE_TO_REGISTER";
2871
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED"] = 326] = "EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED";
2872
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 330] = "EMPLOYEE_LOST_CLIENT";
2873
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_RECEIVED_CLIENT"] = 331] = "EMPLOYEE_RECEIVED_CLIENT";
2874
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 340] = "FIRM_INVITE_TO_REGISTER";
2875
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER_ACCEPTED"] = 341] = "FIRM_INVITE_TO_REGISTER_ACCEPTED";
2876
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_NEW_ACCOUNTS"] = 501] = "BASIQ_NEW_ACCOUNTS";
2877
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 502] = "BASIQ_FIRST_IMPORT_COMPLETE";
2878
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 503] = "BASIQ_AUTHORIZATION_FAIL";
2879
- })(exports.UserEventTypeTypeEnum || (exports.UserEventTypeTypeEnum = {}));
2727
+ exports.UserEventTypeUserTypeEnum = void 0;
2728
+ (function (UserEventTypeUserTypeEnum) {
2729
+ UserEventTypeUserTypeEnum[UserEventTypeUserTypeEnum["REGISTERED"] = 1000] = "REGISTERED";
2730
+ UserEventTypeUserTypeEnum[UserEventTypeUserTypeEnum["PASSWORD_RESET"] = 1001] = "PASSWORD_RESET";
2731
+ UserEventTypeUserTypeEnum[UserEventTypeUserTypeEnum["APP_FEATURES"] = 1010] = "APP_FEATURES";
2732
+ })(exports.UserEventTypeUserTypeEnum || (exports.UserEventTypeUserTypeEnum = {}));
2733
+
2734
+ exports.UserEventTypeEmployeeTypeEnum = void 0;
2735
+ (function (UserEventTypeEmployeeTypeEnum) {
2736
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 3000] = "FIRM_INVITE_TO_REGISTER";
2737
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_INVITE"] = 3001] = "FIRM_INVITE";
2738
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["CLIENT_INVITE_ACCEPTED"] = 3002] = "CLIENT_INVITE_ACCEPTED";
2739
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["CLIENT_INVITE_REJECTED"] = 3003] = "CLIENT_INVITE_REJECTED";
2740
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["CLIENT_INVITE_REGISTERED"] = 3004] = "CLIENT_INVITE_REGISTERED";
2741
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_NEW_CLIENT"] = 3005] = "FIRM_NEW_CLIENT";
2742
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_LOST_CLIENT"] = 3006] = "FIRM_LOST_CLIENT";
2743
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_INVITE"] = 3010] = "EMPLOYEE_INVITE";
2744
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 3011] = "EMPLOYEE_LOST_CLIENT";
2745
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_NEW_CLIENT"] = 3012] = "EMPLOYEE_NEW_CLIENT";
2746
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_INVITE_ACCEPTED"] = 3013] = "EMPLOYEE_INVITE_ACCEPTED";
2747
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMAIL_CONFIRMED"] = 3020] = "EMAIL_CONFIRMED";
2748
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["TAX_REVIEW_REQUESTED"] = 3030] = "TAX_REVIEW_REQUESTED";
2749
+ })(exports.UserEventTypeEmployeeTypeEnum || (exports.UserEventTypeEmployeeTypeEnum = {}));
2750
+
2751
+ exports.UserEventTypeClientTypeEnum = void 0;
2752
+ (function (UserEventTypeClientTypeEnum) {
2753
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIBED"] = 2000] = "SUBSCRIBED";
2754
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["UNSUBSCRIBED"] = 2001] = "UNSUBSCRIBED";
2755
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIPTION_UPDATE"] = 2004] = "SUBSCRIPTION_UPDATE";
2756
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIPTION_TRIAL_UPDATE"] = 2005] = "SUBSCRIPTION_TRIAL_UPDATE";
2757
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CLIENT_INVITE"] = 2010] = "CLIENT_INVITE";
2758
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 2011] = "CLIENT_INVITE_TO_REGISTER";
2759
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
2760
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
2761
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
2762
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE"] = 2020] = "CO_OWNER_INVITE";
2763
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_TO_REGISTER"] = 2021] = "CO_OWNER_INVITE_TO_REGISTER";
2764
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_ACCEPTED"] = 2022] = "CO_OWNER_INVITE_ACCEPTED";
2765
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_REJECTED"] = 2023] = "CO_OWNER_INVITE_REJECTED";
2766
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_REGISTERED"] = 2024] = "CO_OWNER_INVITE_REGISTERED";
2767
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_CHANGE_REQUESTED"] = 2025] = "CO_OWNER_CHANGE_REQUESTED";
2768
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_CHANGE_ACCEPTED"] = 2026] = "CO_OWNER_CHANGE_ACCEPTED";
2769
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_CHANGE_REJECTED"] = 2027] = "CO_OWNER_CHANGE_REJECTED";
2770
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
2771
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
2772
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
2773
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["TRANSACTION_ALLOCATE_REMINDER"] = 2033] = "TRANSACTION_ALLOCATE_REMINDER";
2774
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["REGISTRATION_INVITE"] = 2040] = "REGISTRATION_INVITE";
2775
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["REGISTRATION_INVITE_ACCEPTED"] = 2041] = "REGISTRATION_INVITE_ACCEPTED";
2776
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["EMAIL_CONFIRMED"] = 2050] = "EMAIL_CONFIRMED";
2777
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["TAX_REVIEW_REQUESTED"] = 2060] = "TAX_REVIEW_REQUESTED";
2778
+ })(exports.UserEventTypeClientTypeEnum || (exports.UserEventTypeClientTypeEnum = {}));
2880
2779
 
2881
2780
  exports.UserMedicareExemptionEnum = void 0;
2882
2781
  (function (UserMedicareExemptionEnum) {
@@ -4984,10 +4883,14 @@
4984
4883
  // @TODO fix hack while transactions refactoring (use class-transformer)
4985
4884
  return +(Math.round(this.getIncomeAmountByType(exports.IncomeAmountTypeEnum.GROSS) * 100) / 100).toFixed(2);
4986
4885
  };
4886
+ Object.defineProperty(Transaction.prototype, "taxFreeComponent", {
4887
+ get: function () {
4888
+ return this.getMetadataFieldValue(exports.ChartAccountsMetadataListEnum.TAX_FREE_COMPONENT);
4889
+ },
4890
+ enumerable: false,
4891
+ configurable: true
4892
+ });
4987
4893
  Object.defineProperty(Transaction.prototype, "frankingCredit", {
4988
- /**
4989
- * find franking credits metadata and return value
4990
- */
4991
4894
  get: function () {
4992
4895
  return this.getMetadataFieldValue(exports.ChartAccountsMetadataListEnum.FRANKING_CREDIT);
4993
4896
  },
@@ -5035,7 +4938,7 @@
5035
4938
  (this.transactions
5036
4939
  .reduce(function (sum, transaction) { return sum + Math.abs(transaction.amount); }, 0) * modifier);
5037
4940
  case this.isWorkTank():
5038
- return this.amount + ((this.tax + this.frankingCredit) * modifier);
4941
+ return this.amount + ((this.tax + this.frankingCredit - this.taxFreeComponent) * modifier);
5039
4942
  default:
5040
4943
  return this.amount || 0;
5041
4944
  }
@@ -5742,6 +5645,62 @@
5742
5645
  return ClientPortfolioReport;
5743
5646
  }());
5744
5647
 
5648
+ /**
5649
+ * Class to generate data-table structure based on provided collection.
5650
+ * Use to work with HTML/PDF/XLSX tables
5651
+ */
5652
+ var DataTable = /** @class */ (function () {
5653
+ function DataTable(collection, columns, caption, footerCaption) {
5654
+ this.caption = caption;
5655
+ this.columns = columns;
5656
+ this.setRows(collection);
5657
+ if (footerCaption) {
5658
+ this.setFooterRow(collection, footerCaption);
5659
+ }
5660
+ }
5661
+ DataTable.prototype.setRows = function (collection) {
5662
+ var _this = this;
5663
+ this.rows = collection.items.map(function (item) {
5664
+ // parse table columns to return items based on column properties
5665
+ return _this.columns.map(function (column) {
5666
+ // if the pipe is provided - transform the return value
5667
+ if (column.pipe) {
5668
+ return column.pipe.transform(item[column.key]);
5669
+ }
5670
+ return (item[column.key] ? item[column.key] : '-').toString();
5671
+ });
5672
+ });
5673
+ };
5674
+ DataTable.prototype.setFooterRow = function (collection, footerCaption) {
5675
+ this.footerRow = this.columns.map(function (column, index) {
5676
+ if (index === 0) {
5677
+ return footerCaption.toString();
5678
+ }
5679
+ if (!column.total) {
5680
+ return '';
5681
+ }
5682
+ return collection.items
5683
+ .reduce(function (sum, item) { return sum + Number(item[column.key]); }, 0)
5684
+ .toString();
5685
+ });
5686
+ };
5687
+ return DataTable;
5688
+ }());
5689
+
5690
+ var DataTableColumn = /** @class */ (function () {
5691
+ function DataTableColumn(name, key, total, pipe) {
5692
+ /**
5693
+ * Flag that shows should the column be in the total calculation or not
5694
+ */
5695
+ this.total = false;
5696
+ this.name = name;
5697
+ this.key = key;
5698
+ this.total = total;
5699
+ this.pipe = pipe;
5700
+ }
5701
+ return DataTableColumn;
5702
+ }());
5703
+
5745
5704
  exports.DepreciationGroupEnum = void 0;
5746
5705
  (function (DepreciationGroupEnum) {
5747
5706
  DepreciationGroupEnum[DepreciationGroupEnum["BUILDING_IMPROVEMENTS"] = 0] = "BUILDING_IMPROVEMENTS";
@@ -6089,6 +6048,8 @@
6089
6048
  USER_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/users\\/photo\.\*'),
6090
6049
  USER_STATUS_PUT: new Endpoint('PUT', '\\/users\\/status'),
6091
6050
  VEHICLES_GET: new Endpoint('GET', '\\/vehicles'),
6051
+ VEHICLES_POST: new Endpoint('POST', '\\/vehicles'),
6052
+ VEHICLES_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+'),
6092
6053
  VEHICLE_CLAIMS_GET: new Endpoint('GET', '\\/vehicle-claims'),
6093
6054
  VEHICLE_CLAIMS_POST: new Endpoint('POST', '\\/vehicle-claims'),
6094
6055
  VEHICLE_LOGBOOK_POST: new Endpoint('POST', '\\/vehicles\\/\\d+\\/logbooks'),
@@ -6380,48 +6341,6 @@
6380
6341
  return ServiceNotification;
6381
6342
  }());
6382
6343
 
6383
- /**
6384
- * Notification events grouped by types
6385
- */
6386
- var NOTIFICATION_EVENT_TYPES = {
6387
- // events from employees to clients
6388
- employeeInvite: [
6389
- exports.UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED,
6390
- exports.UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN_ACCEPTED,
6391
- exports.UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN_REJECTED,
6392
- exports.UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_REGISTER,
6393
- exports.UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN,
6394
- ],
6395
- // events from clients to employee
6396
- employeeInviteFromClient: [
6397
- exports.UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN,
6398
- ],
6399
- bankConnection: [
6400
- exports.UserEventTypeTypeEnum.BASIQ_NEW_ACCOUNTS,
6401
- exports.UserEventTypeTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE,
6402
- exports.UserEventTypeTypeEnum.BASIQ_AUTHORIZATION_FAIL
6403
- ],
6404
- clientInvite: [
6405
- exports.UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN_ACCEPTED,
6406
- exports.UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN_REJECTED,
6407
- exports.UserEventTypeTypeEnum.CLIENT_INVITE_TO_REGISTER
6408
- ],
6409
- clientMovement: [
6410
- exports.UserEventTypeTypeEnum.CLIENT_LEFT_FIRM,
6411
- exports.UserEventTypeTypeEnum.EMPLOYEE_LOST_CLIENT,
6412
- exports.UserEventTypeTypeEnum.EMPLOYEE_RECEIVED_CLIENT
6413
- ],
6414
- propertyOwner: [
6415
- exports.UserEventTypeTypeEnum.CO_OWNER_INVITE_SEND,
6416
- exports.UserEventTypeTypeEnum.CO_OWNER_INVITE_ACCEPT,
6417
- exports.UserEventTypeTypeEnum.CO_OWNER_INVITE_REJECT,
6418
- exports.UserEventTypeTypeEnum.CO_OWNER_REGISTER,
6419
- exports.UserEventTypeTypeEnum.CO_OWNER_CHANGES_OFFER,
6420
- exports.UserEventTypeTypeEnum.CO_OWNER_CHANGES_ACCEPT,
6421
- exports.UserEventTypeTypeEnum.CO_OWNER_CHANGES_REJECT
6422
- ]
6423
- };
6424
-
6425
6344
  var Notification = /** @class */ (function (_super) {
6426
6345
  __extends(Notification, _super);
6427
6346
  function Notification() {
@@ -6429,35 +6348,11 @@
6429
6348
  }
6430
6349
  Object.defineProperty(Notification.prototype, "eventType", {
6431
6350
  get: function () {
6432
- return this.userEvent.userEventType.type;
6351
+ return this.userEvent.type.type;
6433
6352
  },
6434
6353
  enumerable: false,
6435
6354
  configurable: true
6436
6355
  });
6437
- /**
6438
- * Set redirection link based on current event type
6439
- */
6440
- Notification.prototype.setRedirectionLink = function () {
6441
- switch (true) {
6442
- case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(this.eventType):
6443
- this.redirectionLink = '/client/users/firms';
6444
- break;
6445
- case NOTIFICATION_EVENT_TYPES.bankConnection.includes(this.eventType):
6446
- this.redirectionLink = '/client/bank-feeds';
6447
- break;
6448
- case NOTIFICATION_EVENT_TYPES.clientInvite.includes(this.eventType):
6449
- this.redirectionLink = '/client/users/invitations';
6450
- break;
6451
- case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(this.eventType):
6452
- this.redirectionLink = '/client/users/co-owners';
6453
- break;
6454
- case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(this.eventType):
6455
- this.redirectionLink = '/firm/clients/invites';
6456
- break;
6457
- default:
6458
- this.redirectionLink = '';
6459
- }
6460
- };
6461
6356
  /**
6462
6357
  * Check if notification is from user or not
6463
6358
  */
@@ -6474,16 +6369,17 @@
6474
6369
  classTransformer.Transform(function (_a) {
6475
6370
  var obj = _a.obj;
6476
6371
  switch (true) {
6477
- case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(obj.eventType):
6478
- return '/client/users/firms';
6479
- case NOTIFICATION_EVENT_TYPES.bankConnection.includes(obj.eventType):
6480
- return '/client/bank-feeds';
6481
- case NOTIFICATION_EVENT_TYPES.clientInvite.includes(obj.eventType):
6482
- return '/client/users/invitations';
6483
- case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(obj.eventType):
6484
- return '/client/users/co-owners';
6485
- case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(obj.eventType):
6486
- return '/firm/clients/invites';
6372
+ // @TODO vik
6373
+ // case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(obj.eventType):
6374
+ // return '/client/users/firms';
6375
+ // case NOTIFICATION_EVENT_TYPES.bankConnection.includes(obj.eventType):
6376
+ // return '/client/bank-feeds';
6377
+ // case NOTIFICATION_EVENT_TYPES.clientInvite.includes(obj.eventType):
6378
+ // return '/client/users/invitations';
6379
+ // case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(obj.eventType):
6380
+ // return '/client/users/co-owners';
6381
+ // case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(obj.eventType):
6382
+ // return '/firm/clients/invites';
6487
6383
  default:
6488
6384
  return '';
6489
6385
  }
@@ -7231,6 +7127,68 @@
7231
7127
  return UserToRegister;
7232
7128
  }());
7233
7129
 
7130
+ var UserEventTypeCategory$1 = /** @class */ (function () {
7131
+ function UserEventTypeCategory() {
7132
+ }
7133
+ return UserEventTypeCategory;
7134
+ }());
7135
+
7136
+ var UserEventTypeCategory = /** @class */ (function (_super) {
7137
+ __extends(UserEventTypeCategory, _super);
7138
+ function UserEventTypeCategory() {
7139
+ return _super !== null && _super.apply(this, arguments) || this;
7140
+ }
7141
+ return UserEventTypeCategory;
7142
+ }(UserEventTypeCategory$1));
7143
+
7144
+ var UserEventSetting$1 = /** @class */ (function () {
7145
+ function UserEventSetting() {
7146
+ }
7147
+ return UserEventSetting;
7148
+ }());
7149
+
7150
+ var UserEventType$1 = /** @class */ (function () {
7151
+ function UserEventType() {
7152
+ }
7153
+ return UserEventType;
7154
+ }());
7155
+
7156
+ var UserEventType = /** @class */ (function (_super) {
7157
+ __extends(UserEventType, _super);
7158
+ function UserEventType() {
7159
+ return _super !== null && _super.apply(this, arguments) || this;
7160
+ }
7161
+ UserEventType.prototype.toSetting = function () {
7162
+ return classTransformer.plainToClass(UserEventSetting, {
7163
+ byEmail: this.byEmail,
7164
+ byNotification: this.byNotification,
7165
+ frequency: this.frequency,
7166
+ type: this
7167
+ });
7168
+ };
7169
+ return UserEventType;
7170
+ }(UserEventType$1));
7171
+ __decorate([
7172
+ classTransformer.Type(function () { return UserEventTypeCategory; })
7173
+ ], UserEventType.prototype, "category", void 0);
7174
+
7175
+ var UserEventSetting = /** @class */ (function (_super) {
7176
+ __extends(UserEventSetting, _super);
7177
+ function UserEventSetting() {
7178
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
7179
+ // flag indicates that the setting is updating now saved or not
7180
+ _this.isUpdating = false;
7181
+ return _this;
7182
+ }
7183
+ return UserEventSetting;
7184
+ }(UserEventSetting$1));
7185
+ __decorate([
7186
+ classTransformer.Type(function () { return UserEventType; })
7187
+ ], UserEventSetting.prototype, "type", void 0);
7188
+ __decorate([
7189
+ classTransformer.Exclude({ toPlainOnly: true })
7190
+ ], UserEventSetting.prototype, "isUpdating", void 0);
7191
+
7234
7192
  /**
7235
7193
  * Enum with user event setting fields
7236
7194
  */
@@ -7961,8 +7919,12 @@
7961
7919
  _this.environment = environment;
7962
7920
  _this.modelClass = BankConnection;
7963
7921
  _this.url = 'bank-connections';
7922
+ _this.listenEvents();
7964
7923
  return _this;
7965
7924
  }
7925
+ BankConnectionService.prototype.listenEvents = function () {
7926
+ this.listenToAddedBankAccounts();
7927
+ };
7966
7928
  BankConnectionService.prototype.post = function (bankConnection) {
7967
7929
  var _this = this;
7968
7930
  return this.http.post(this.environment.apiV2 + "/" + this.url, bankConnection)
@@ -7971,6 +7933,12 @@
7971
7933
  return classTransformer.plainToClass(BankConnection, bankConnectionBase);
7972
7934
  }));
7973
7935
  };
7936
+ BankConnectionService.prototype.listenToAddedBankAccounts = function () {
7937
+ var _this = this;
7938
+ this.eventDispatcherService.on(exports.AppEventTypeEnum.BANK_ACCOUNT_CREATED).subscribe(function () {
7939
+ _this.resetCache();
7940
+ });
7941
+ };
7974
7942
  return BankConnectionService;
7975
7943
  }(BaseRestService));
7976
7944
  BankConnectionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankConnectionService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
@@ -8052,7 +8020,7 @@
8052
8020
  BankTransactionService.prototype.listenBankTransactionsImport = function () {
8053
8021
  var _this = this;
8054
8022
  this.eventDispatcherService.on(exports.AppEventTypeEnum.NOTIFICATION_ADDED).subscribe(function (notification) {
8055
- if (!notification.isRead && notification.eventType === exports.UserEventTypeTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE) {
8023
+ if (!notification.isRead && notification.eventType === exports.UserEventTypeClientTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE) {
8056
8024
  _this.resetCache();
8057
8025
  }
8058
8026
  });
@@ -8142,7 +8110,7 @@
8142
8110
  BasiqService.prototype.listenNotifications = function () {
8143
8111
  var _this = this;
8144
8112
  this.eventDispatcherService.on(exports.AppEventTypeEnum.NOTIFICATION_ADDED).subscribe(function (notification) {
8145
- if (!notification.isRead && notification.eventType === exports.UserEventTypeTypeEnum.BASIQ_NEW_ACCOUNTS) {
8113
+ if (!notification.isRead && notification.eventType === exports.UserEventTypeClientTypeEnum.BASIQ_NEW_ACCOUNTS) {
8146
8114
  _this.resetCache();
8147
8115
  _this.get().subscribe();
8148
8116
  }
@@ -9259,7 +9227,7 @@
9259
9227
  FirmService.prototype.register = function (data) {
9260
9228
  return this.http.post(this.environment.apiV2 + "/firms/registration", data)
9261
9229
  .pipe(operators.map(function (firm) {
9262
- return classTransformer.plainToClass(Firm$1, firm);
9230
+ return classTransformer.plainToClass(Firm, firm);
9263
9231
  }));
9264
9232
  };
9265
9233
  FirmService.prototype.get = function () {
@@ -9267,7 +9235,7 @@
9267
9235
  if (!this.firm) {
9268
9236
  this.http.get(this.environment.apiV2 + "/firms/current")
9269
9237
  .pipe(operators.map(function (firm) {
9270
- return classTransformer.plainToClass(Firm$1, firm);
9238
+ return classTransformer.plainToClass(Firm, firm);
9271
9239
  }))
9272
9240
  .subscribe(function (firm) {
9273
9241
  _this.firm = firm;
@@ -9280,7 +9248,7 @@
9280
9248
  var _this = this;
9281
9249
  return this.http.put(this.environment.apiV2 + "/firms/current", firm)
9282
9250
  .pipe(operators.map(function (updatedItem) {
9283
- var updatedInstance = classTransformer.plainToClass(Firm$1, updatedItem);
9251
+ var updatedInstance = classTransformer.plainToClass(Firm, updatedItem);
9284
9252
  _this.firmSubject.next(updatedInstance);
9285
9253
  }));
9286
9254
  };
@@ -9290,7 +9258,7 @@
9290
9258
  FirmService.prototype.getAll = function () {
9291
9259
  return this.http.get(this.environment.apiV2 + "/firms")
9292
9260
  .pipe(operators.map(function (response) {
9293
- return response['hydra:member'].map(function (firmBase) { return classTransformer.plainToClass(Firm$1, firmBase); });
9261
+ return response['hydra:member'].map(function (firmBase) { return classTransformer.plainToClass(Firm, firmBase); });
9294
9262
  }));
9295
9263
  };
9296
9264
  FirmService.prototype.getByType = function (type) {
@@ -9302,7 +9270,7 @@
9302
9270
  var _this = this;
9303
9271
  return this.http.post(this.environment.apiV2 + "/firms/photo?_method=PUT", photo)
9304
9272
  .pipe(operators.map(function (firmPhoto) {
9305
- _this.firm = classTransformer.plainToClass(Firm$1, Object.assign(firm, { photo: firmPhoto }));
9273
+ _this.firm = classTransformer.plainToClass(Firm, Object.assign(firm, { photo: firmPhoto }));
9306
9274
  _this.firmSubject.next(_this.firm);
9307
9275
  return firm;
9308
9276
  }));
@@ -9870,6 +9838,83 @@
9870
9838
  }] }, { type: SseService }];
9871
9839
  } });
9872
9840
 
9841
+ /**
9842
+ * Configuration file with the settings to generate PDF file
9843
+ */
9844
+ var PDF_CONFIG = {
9845
+ text: {
9846
+ fontSize: 18,
9847
+ fontName: 'helvetica',
9848
+ fontStyle: '',
9849
+ fontWeight: 'bold',
9850
+ positionX: 14,
9851
+ positionY: 10,
9852
+ fillColor: 255,
9853
+ textColor: 0
9854
+ },
9855
+ // coords for file section title (group, table, e.t.c.)
9856
+ contentTitleCoords: {
9857
+ marginTop: 20
9858
+ },
9859
+ contentCoords: {
9860
+ marginTop: 15,
9861
+ marginLeft: 14
9862
+ }
9863
+ };
9864
+
9865
+ /**
9866
+ * Service to work with PDF (generate, download, e.t.c.)
9867
+ */
9868
+ var PdfService = /** @class */ (function () {
9869
+ function PdfService() {
9870
+ }
9871
+ // @Todo remove 'any' type
9872
+ /**
9873
+ * Download generated PDF file
9874
+ */
9875
+ PdfService.prototype.download = function (tables, title, fileName) {
9876
+ var document = this.generatePdfFile(tables, title);
9877
+ document.save(fileName + ".pdf");
9878
+ };
9879
+ /**
9880
+ * Generate PDF file from provided data
9881
+ */
9882
+ PdfService.prototype.generatePdfFile = function (tables, title) {
9883
+ var pdf = new jsPDF__default["default"]();
9884
+ // set document title
9885
+ pdf.setFontSize(PDF_CONFIG.text.fontSize);
9886
+ pdf.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight);
9887
+ pdf.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
9888
+ tables.forEach(function (table) {
9889
+ // coords of last table
9890
+ var lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
9891
+ pdf.text(table.caption, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
9892
+ // table options
9893
+ var options = {
9894
+ startY: lastTableCoords + PDF_CONFIG.contentTitleCoords.marginTop,
9895
+ head: [table['columns'].map(function (column) { return column.name; })],
9896
+ body: table['rows'],
9897
+ foot: [table['footerRow']],
9898
+ footStyles: {
9899
+ fillColor: PDF_CONFIG.text.fillColor,
9900
+ textColor: PDF_CONFIG.text.textColor
9901
+ }
9902
+ };
9903
+ autoTable__default["default"](pdf, options);
9904
+ });
9905
+ return pdf;
9906
+ };
9907
+ return PdfService;
9908
+ }());
9909
+ PdfService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
9910
+ PdfService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, providedIn: 'root' });
9911
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, decorators: [{
9912
+ type: i0.Injectable,
9913
+ args: [{
9914
+ providedIn: 'root'
9915
+ }]
9916
+ }] });
9917
+
9873
9918
  var PreloaderService = /** @class */ (function () {
9874
9919
  function PreloaderService() {
9875
9920
  this.activePreloaders = new rxjs.BehaviorSubject([]);
@@ -11740,6 +11785,59 @@
11740
11785
  }] }];
11741
11786
  } });
11742
11787
 
11788
+ /**
11789
+ * Service to work with XLSX (generate, download, e.t.c.)
11790
+ */
11791
+ var XlsxService = /** @class */ (function () {
11792
+ function XlsxService() {
11793
+ }
11794
+ // @Todo remove 'any' type
11795
+ /**s
11796
+ * Download generated Excel file
11797
+ */
11798
+ XlsxService.prototype.download = function (tables, title, fileName) {
11799
+ var excelFile = this.generateFile(tables, title);
11800
+ var data = new Blob([excelFile], {
11801
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'
11802
+ });
11803
+ FileSaver__namespace.saveAs(data, fileName + ".xlsx");
11804
+ };
11805
+ XlsxService.prototype.generateFile = function (tables, title) {
11806
+ // create new workbook
11807
+ var workbook = xlsx__namespace.utils.book_new();
11808
+ // create empty worksheet
11809
+ var worksheet = {
11810
+ SheetNames: [],
11811
+ Sheets: {}
11812
+ };
11813
+ var sheetData = tables.map(function (table) {
11814
+ // add caption, columns, rows and footer rows
11815
+ return __spreadArray(__spreadArray([
11816
+ [table.caption],
11817
+ table.columns.map(function (column) { return column.name; })
11818
+ ], __read(table.rows)), [
11819
+ table.footerRow,
11820
+ ]);
11821
+ });
11822
+ sheetData.forEach(function (data) {
11823
+ xlsx__namespace.utils.sheet_add_json(worksheet, data, { origin: -1, skipHeader: true });
11824
+ // set empty row after each table
11825
+ xlsx__namespace.utils.sheet_add_json(worksheet, [], { origin: -1 });
11826
+ });
11827
+ xlsx__namespace.utils.book_append_sheet(workbook, worksheet);
11828
+ return xlsx__namespace.write(workbook, { bookType: 'xlsx', type: 'array' });
11829
+ };
11830
+ return XlsxService;
11831
+ }());
11832
+ XlsxService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: XlsxService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11833
+ XlsxService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: XlsxService, providedIn: 'root' });
11834
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: XlsxService, decorators: [{
11835
+ type: i0.Injectable,
11836
+ args: [{
11837
+ providedIn: 'root'
11838
+ }]
11839
+ }] });
11840
+
11743
11841
  // deep clone for entity
11744
11842
  function cloneDeep(array) {
11745
11843
  return JSON.parse(JSON.stringify(array));
@@ -11879,6 +11977,8 @@
11879
11977
  exports.DEFAULT_VEHICLE_EXPENSE = DEFAULT_VEHICLE_EXPENSE;
11880
11978
  exports.DEPRECIATION_GROUPS = DEPRECIATION_GROUPS;
11881
11979
  exports.DOCUMENT_FILE_TYPES = DOCUMENT_FILE_TYPES;
11980
+ exports.DataTable = DataTable;
11981
+ exports.DataTableColumn = DataTableColumn;
11882
11982
  exports.Depreciation = Depreciation;
11883
11983
  exports.DepreciationCapitalProject = DepreciationCapitalProject;
11884
11984
  exports.DepreciationCollection = DepreciationCollection;
@@ -11929,11 +12029,11 @@
11929
12029
  exports.MessageDocumentService = MessageDocumentService;
11930
12030
  exports.MessageService = MessageService;
11931
12031
  exports.MyAccountHistory = MyAccountHistory;
11932
- exports.NOTIFICATION_EVENT_TYPES = NOTIFICATION_EVENT_TYPES;
11933
12032
  exports.Notification = Notification;
11934
12033
  exports.NotificationService = NotificationService;
11935
12034
  exports.Occupation = Occupation;
11936
12035
  exports.OccupationService = OccupationService;
12036
+ exports.PdfService = PdfService;
11937
12037
  exports.Phone = Phone;
11938
12038
  exports.PreloaderService = PreloaderService;
11939
12039
  exports.Property = Property;
@@ -11995,11 +12095,11 @@
11995
12095
  exports.USER_ROLES = USER_ROLES;
11996
12096
  exports.USER_WORK_POSITION = USER_WORK_POSITION;
11997
12097
  exports.User = User;
11998
- exports.UserEventCategory = UserEventCategory;
11999
12098
  exports.UserEventSetting = UserEventSetting;
12000
12099
  exports.UserEventSettingCollection = UserEventSettingCollection;
12001
12100
  exports.UserEventSettingService = UserEventSettingService;
12002
12101
  exports.UserEventType = UserEventType;
12102
+ exports.UserEventTypeCategory = UserEventTypeCategory;
12003
12103
  exports.UserEventTypeService = UserEventTypeService;
12004
12104
  exports.UserService = UserService;
12005
12105
  exports.UserSwitcherService = UserSwitcherService;
@@ -12009,6 +12109,7 @@
12009
12109
  exports.VehicleLogbook = VehicleLogbook;
12010
12110
  exports.WORK_TANK_LOGBOOK_PURPOSE_OPTIONS = WORK_TANK_LOGBOOK_PURPOSE_OPTIONS;
12011
12111
  exports.WorkTankService = WorkTankService;
12112
+ exports.XlsxService = XlsxService;
12012
12113
  exports.cloneDeep = cloneDeep;
12013
12114
  exports.compare = compare;
12014
12115
  exports.compareMatOptions = compareMatOptions;