taxtank-core 0.1.4 → 0.2.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 (75) hide show
  1. package/bundles/taxtank-core.umd.js +398 -293
  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/user-event-status.enum.js +2 -1
  7. package/esm2015/lib/db/Enums/user-event-type-client-type.enum.js +29 -0
  8. package/esm2015/lib/db/Enums/user-event-type-employee-type.enum.js +17 -0
  9. package/esm2015/lib/db/Enums/user-event-type-frequency.enum.js +4 -5
  10. package/esm2015/lib/db/Enums/user-event-type-user-type.enum.js +7 -0
  11. package/esm2015/lib/db/Models/user-event-setting.js +1 -1
  12. package/esm2015/lib/db/Models/user-event-type-category.js +3 -0
  13. package/esm2015/lib/db/Models/user-event-type.js +1 -1
  14. package/esm2015/lib/db/Models/user-event.js +1 -1
  15. package/esm2015/lib/models/bank/bank-connection.js +8 -1
  16. package/esm2015/lib/models/bank/bank.js +4 -14
  17. package/esm2015/lib/models/data-table/data-table-column.js +13 -0
  18. package/esm2015/lib/models/data-table/data-table.js +40 -0
  19. package/esm2015/lib/models/endpoint/endpoints.const.js +3 -1
  20. package/esm2015/lib/models/notification/notification.js +13 -37
  21. package/esm2015/lib/models/pdf/pdf-config.js +24 -0
  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-account.service.js +9 -5
  26. package/esm2015/lib/services/bank/bank-connection.service.js +10 -1
  27. package/esm2015/lib/services/bank/bank-transaction.service.js +3 -3
  28. package/esm2015/lib/services/bank/basiq.service.js +3 -3
  29. package/esm2015/lib/services/firm/firm.service.js +2 -2
  30. package/esm2015/lib/services/pdf/pdf.service.js +55 -0
  31. package/esm2015/lib/services/xlsx/xlsx.service.js +54 -0
  32. package/esm2015/lib/tt-core.module.js +2 -1
  33. package/esm2015/public-api.js +9 -7
  34. package/fesm2015/taxtank-core.js +351 -264
  35. package/fesm2015/taxtank-core.js.map +1 -1
  36. package/lib/collections/abstract.collection.d.ts +4 -1
  37. package/lib/collections/collection-dictionary.d.ts +4 -1
  38. package/lib/collections/user-event-setting.collection.d.ts +1 -23
  39. package/lib/db/Enums/user-event-status.enum.d.ts +2 -1
  40. package/lib/db/Enums/user-event-type-client-type.enum.d.ts +27 -0
  41. package/lib/db/Enums/user-event-type-employee-type.enum.d.ts +15 -0
  42. package/lib/db/Enums/user-event-type-frequency.enum.d.ts +3 -4
  43. package/lib/db/Enums/user-event-type-user-type.enum.d.ts +5 -0
  44. package/lib/db/Models/user-event-setting.d.ts +1 -1
  45. package/lib/db/Models/user-event-type-category.d.ts +4 -0
  46. package/lib/db/Models/user-event-type.d.ts +5 -3
  47. package/lib/db/Models/user-event.d.ts +3 -1
  48. package/lib/models/bank/bank-connection.d.ts +4 -0
  49. package/lib/models/bank/bank.d.ts +0 -2
  50. package/lib/models/data-table/data-table-column.d.ts +20 -0
  51. package/lib/models/data-table/data-table.d.ts +24 -0
  52. package/lib/models/notification/notification.d.ts +4 -6
  53. package/lib/models/pdf/pdf-config.d.ts +8 -0
  54. package/lib/models/user-event/user-event-setting.d.ts +1 -1
  55. package/lib/models/user-event/user-event-type-category.d.ts +3 -0
  56. package/lib/models/user-event/user-event-type.d.ts +4 -2
  57. package/lib/services/bank/bank-account.service.d.ts +2 -2
  58. package/lib/services/bank/bank-connection.service.d.ts +2 -0
  59. package/lib/services/firm/firm.service.d.ts +1 -1
  60. package/lib/services/pdf/pdf.service.d.ts +14 -0
  61. package/lib/services/xlsx/xlsx.service.d.ts +11 -0
  62. package/package.json +6 -2
  63. package/public-api.d.ts +8 -6
  64. package/esm2015/lib/db/Enums/user-event-type-reminder-type.enum.js +0 -8
  65. package/esm2015/lib/db/Enums/user-event-type-reminder.enum.js +0 -7
  66. package/esm2015/lib/db/Enums/user-event-type-type.enum.js +0 -35
  67. package/esm2015/lib/models/notification/notification-event-types.const.js +0 -43
  68. package/esm2015/lib/models/user-event/user-event-category.enum.js +0 -11
  69. package/esm2015/lib/models/user-event/user-event-category.js +0 -6
  70. package/lib/db/Enums/user-event-type-reminder-type.enum.d.ts +0 -6
  71. package/lib/db/Enums/user-event-type-reminder.enum.d.ts +0 -5
  72. package/lib/db/Enums/user-event-type-type.enum.d.ts +0 -33
  73. package/lib/models/notification/notification-event-types.const.d.ts +0 -7
  74. package/lib/models/user-event/user-event-category.d.ts +0 -8
  75. 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,11 +39,16 @@
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() {
45
49
  }
46
50
  TtCoreModule.forRoot = function (environment) {
51
+ localStorage.setItem('api_uri', environment['api_uri']);
47
52
  return {
48
53
  ngModule: TtCoreModule,
49
54
  providers: [
@@ -452,6 +457,9 @@
452
457
  if (items === void 0) { items = []; }
453
458
  return new this.collectionConstructor(items);
454
459
  };
460
+ CollectionDictionary.prototype.length = function () {
461
+ return this.keys.length;
462
+ };
455
463
  /**
456
464
  * Group collection items by passed path into items object
457
465
  */
@@ -479,6 +487,7 @@
479
487
  return CollectionDictionary;
480
488
  }());
481
489
 
490
+ var DEFAULT_INDEX = 'other';
482
491
  /**
483
492
  * collection abstract class. Contains common properties and methods for all collections
484
493
  */
@@ -487,8 +496,24 @@
487
496
  if (items === void 0) { items = []; }
488
497
  this.items = items;
489
498
  }
490
- AbstractCollection.prototype.groupBy = function (prop) {
491
- 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;
492
517
  };
493
518
  /**
494
519
  * Iterator that allow to iterate collection items
@@ -2077,143 +2102,16 @@
2077
2102
  return TransactionCollection;
2078
2103
  }(AbstractCollection));
2079
2104
 
2080
- var UserEventSetting$1 = /** @class */ (function () {
2081
- function UserEventSetting() {
2082
- }
2083
- return UserEventSetting;
2084
- }());
2085
-
2086
- var UserEventType$1 = /** @class */ (function () {
2087
- function UserEventType() {
2088
- }
2089
- return UserEventType;
2090
- }());
2091
-
2092
- /**
2093
- * Category of user event type
2094
- */
2095
- var UserEventCategory = /** @class */ (function () {
2096
- function UserEventCategory() {
2097
- }
2098
- return UserEventCategory;
2099
- }());
2100
-
2101
- /**
2102
- * Enum with user event categories
2103
- */
2104
- exports.UserEventCategoryEnum = void 0;
2105
- (function (UserEventCategoryEnum) {
2106
- UserEventCategoryEnum[UserEventCategoryEnum["USER"] = 1] = "USER";
2107
- UserEventCategoryEnum[UserEventCategoryEnum["CO_OWNER"] = 2] = "CO_OWNER";
2108
- UserEventCategoryEnum[UserEventCategoryEnum["FIRM"] = 3] = "FIRM";
2109
- UserEventCategoryEnum[UserEventCategoryEnum["BASIQ"] = 4] = "BASIQ";
2110
- })(exports.UserEventCategoryEnum || (exports.UserEventCategoryEnum = {}));
2111
-
2112
- var UserEventType = /** @class */ (function (_super) {
2113
- __extends(UserEventType, _super);
2114
- function UserEventType() {
2115
- return _super !== null && _super.apply(this, arguments) || this;
2116
- }
2117
- return UserEventType;
2118
- }(UserEventType$1));
2119
- __decorate([
2120
- classTransformer.Expose({ toClassOnly: true }),
2121
- classTransformer.Transform(function (_a) {
2122
- var obj = _a.obj;
2123
- switch (true) {
2124
- case String(obj.type).startsWith('1'):
2125
- return classTransformer.plainToClass(UserEventCategory, { name: 'User\'s events', type: exports.UserEventCategoryEnum.USER });
2126
- case String(obj.type).startsWith('2'):
2127
- return classTransformer.plainToClass(UserEventCategory, { name: 'Co-owner\'s events', type: exports.UserEventCategoryEnum.CO_OWNER });
2128
- case String(obj.type).startsWith('3'):
2129
- return classTransformer.plainToClass(UserEventCategory, { name: 'Firm\'s events', type: exports.UserEventCategoryEnum.FIRM });
2130
- default:
2131
- return classTransformer.plainToClass(UserEventCategory, { name: 'Basiq events', type: exports.UserEventCategoryEnum.BASIQ });
2132
- }
2133
- }),
2134
- classTransformer.Type(function () { return UserEventCategory; })
2135
- ], UserEventType.prototype, "category", void 0);
2136
-
2137
- var UserEventSetting = /** @class */ (function (_super) {
2138
- __extends(UserEventSetting, _super);
2139
- function UserEventSetting() {
2140
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
2141
- // flag indicates that the setting is updating now saved or not
2142
- _this.isUpdating = false;
2143
- return _this;
2144
- }
2145
- return UserEventSetting;
2146
- }(UserEventSetting$1));
2147
- __decorate([
2148
- classTransformer.Type(function () { return UserEventType; })
2149
- ], UserEventSetting.prototype, "userEventType", void 0);
2150
- __decorate([
2151
- classTransformer.Exclude({ toPlainOnly: true })
2152
- ], UserEventSetting.prototype, "isUpdating", void 0);
2153
-
2154
2105
  /**
2155
2106
  * Collection of user event settings
2156
2107
  */
2157
2108
  var UserEventSettingCollection = /** @class */ (function (_super) {
2158
2109
  __extends(UserEventSettingCollection, _super);
2159
- function UserEventSettingCollection(items, userEventTypes) {
2160
- var _this = _super.call(this, items) || this;
2161
- _this.setItems(userEventTypes);
2162
- return _this;
2110
+ function UserEventSettingCollection() {
2111
+ return _super !== null && _super.apply(this, arguments) || this;
2163
2112
  }
2164
- /**
2165
- * Flag that indicates if all settings are selected for provided field
2166
- */
2167
- UserEventSettingCollection.prototype.isAllSelected = function (field) {
2168
- return !this.items.find(function (item) { return !item[field]; });
2169
- };
2170
- /**
2171
- * Flag that indicates if all settings are deselected for provided field
2172
- */
2173
- UserEventSettingCollection.prototype.isAllDeselected = function (field) {
2174
- return !this.items.find(function (item) { return item[field]; });
2175
- };
2176
- /**
2177
- * Check is any setting is updating by 'isUpdating' flag
2178
- */
2179
- UserEventSettingCollection.prototype.isAnyUpdating = function () {
2180
- return this.items.some(function (item) { return item.isUpdating; });
2181
- };
2182
- Object.defineProperty(UserEventSettingCollection.prototype, "commonFrequencyType", {
2183
- /**
2184
- * Get frequency type based on each collection item 'frequency' field value
2185
- */
2186
- get: function () {
2187
- var _this = this;
2188
- var frequencyDictionary = new CollectionDictionary(this, '', 'frequency');
2189
- return +Object.keys(frequencyDictionary).find(function (key) { return frequencyDictionary[key].length === _this.length; }) || false;
2190
- },
2191
- enumerable: false,
2192
- configurable: true
2193
- });
2194
- /**
2195
- * Rewrite collection items with provided user event types
2196
- */
2197
- UserEventSettingCollection.prototype.setItems = function (userEventTypes) {
2198
- var _this = this;
2199
- if (!userEventTypes) {
2200
- return;
2201
- }
2202
- this.items = userEventTypes.map(function (userEventType) {
2203
- // find existing setting by user event type id
2204
- var existingSetting = _this.items.find(function (setting) { return setting.userEventType.id === userEventType.id; });
2205
- // if setting exist - return new UserEventSetting instance based on existing setting and default user event type
2206
- if (existingSetting) {
2207
- return classTransformer.plainToClass(UserEventSetting, Object.assign(existingSetting, { userEventType: userEventType }));
2208
- }
2209
- // ...or return new UserEventSetting instance based on default user event type
2210
- return classTransformer.plainToClass(UserEventSetting, {
2211
- byEmail: userEventType.byEmail,
2212
- byNotification: userEventType.byNotification,
2213
- frequency: userEventType.frequency,
2214
- userEventType: userEventType
2215
- });
2216
- });
2113
+ UserEventSettingCollection.prototype.getConfigurableBy = function (field) {
2114
+ return new UserEventSettingCollection(this.items.filter(function (setting) { return setting[field] !== null; }));
2217
2115
  };
2218
2116
  return UserEventSettingCollection;
2219
2117
  }(AbstractCollection));
@@ -2817,65 +2715,68 @@
2817
2715
  UserEventStatusEnum[UserEventStatusEnum["NEED_ACTION"] = 2] = "NEED_ACTION";
2818
2716
  UserEventStatusEnum[UserEventStatusEnum["DONE"] = 3] = "DONE";
2819
2717
  UserEventStatusEnum[UserEventStatusEnum["REFUSED"] = 4] = "REFUSED";
2718
+ UserEventStatusEnum[UserEventStatusEnum["OUTDATED"] = 5] = "OUTDATED";
2820
2719
  })(exports.UserEventStatusEnum || (exports.UserEventStatusEnum = {}));
2821
2720
 
2822
2721
  exports.UserEventTypeFrequencyEnum = void 0;
2823
2722
  (function (UserEventTypeFrequencyEnum) {
2824
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["ONCE"] = 1] = "ONCE";
2825
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["DAILY"] = 2] = "DAILY";
2826
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["WEEKLY"] = 3] = "WEEKLY";
2827
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["MONTHLY"] = 4] = "MONTHLY";
2723
+ UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["DAILY"] = 1] = "DAILY";
2724
+ UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["WEEKLY"] = 2] = "WEEKLY";
2725
+ UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["MONTHLY"] = 3] = "MONTHLY";
2828
2726
  })(exports.UserEventTypeFrequencyEnum || (exports.UserEventTypeFrequencyEnum = {}));
2829
2727
 
2830
- exports.UserEventTypeReminderEnum = void 0;
2831
- (function (UserEventTypeReminderEnum) {
2832
- UserEventTypeReminderEnum[UserEventTypeReminderEnum["ONCE"] = 1] = "ONCE";
2833
- UserEventTypeReminderEnum[UserEventTypeReminderEnum["TWICE"] = 2] = "TWICE";
2834
- UserEventTypeReminderEnum[UserEventTypeReminderEnum["EVERY_DAY"] = 3] = "EVERY_DAY";
2835
- })(exports.UserEventTypeReminderEnum || (exports.UserEventTypeReminderEnum = {}));
2836
-
2837
- exports.UserEventTypeReminderTypeEnum = void 0;
2838
- (function (UserEventTypeReminderTypeEnum) {
2839
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["NEVER"] = 0] = "NEVER";
2840
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["ONCE"] = 1] = "ONCE";
2841
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["TWICE"] = 2] = "TWICE";
2842
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["EVERY_DAY"] = 3] = "EVERY_DAY";
2843
- })(exports.UserEventTypeReminderTypeEnum || (exports.UserEventTypeReminderTypeEnum = {}));
2844
-
2845
- exports.UserEventTypeTypeEnum = void 0;
2846
- (function (UserEventTypeTypeEnum) {
2847
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_INVITE"] = 101] = "USER_INVITE";
2848
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_CONFIRMATION"] = 102] = "USER_CONFIRMATION";
2849
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_RESET_PASSWORD"] = 103] = "USER_RESET_PASSWORD";
2850
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_SUBSCRIBED"] = 104] = "USER_SUBSCRIBED";
2851
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_UPGRADE_SUBSCRIPTION"] = 105] = "USER_UPGRADE_SUBSCRIPTION";
2852
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_DOWNGRADE_SUBSCRIPTION"] = 106] = "USER_DOWNGRADE_SUBSCRIPTION";
2853
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_CANCEL_SUBSCRIPTION"] = 107] = "USER_CANCEL_SUBSCRIPTION";
2854
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_INVITE_SEND"] = 201] = "CO_OWNER_INVITE_SEND";
2855
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_INVITE_ACCEPT"] = 202] = "CO_OWNER_INVITE_ACCEPT";
2856
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_INVITE_REJECT"] = 203] = "CO_OWNER_INVITE_REJECT";
2857
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_REGISTER"] = 204] = "CO_OWNER_REGISTER";
2858
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_CHANGES_OFFER"] = 210] = "CO_OWNER_CHANGES_OFFER";
2859
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_CHANGES_ACCEPT"] = 211] = "CO_OWNER_CHANGES_ACCEPT";
2860
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_CHANGES_REJECT"] = 212] = "CO_OWNER_CHANGES_REJECT";
2861
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_JOIN"] = 301] = "CLIENT_INVITE_TO_JOIN";
2862
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_JOIN_ACCEPTED"] = 302] = "CLIENT_INVITE_TO_JOIN_ACCEPTED";
2863
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_JOIN_REJECTED"] = 303] = "CLIENT_INVITE_TO_JOIN_REJECTED";
2864
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 304] = "CLIENT_INVITE_TO_REGISTER";
2865
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_LEFT_FIRM"] = 305] = "CLIENT_LEFT_FIRM";
2866
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_JOIN"] = 320] = "EMPLOYEE_INVITE_TO_JOIN";
2867
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_JOIN_ACCEPTED"] = 321] = "EMPLOYEE_INVITE_TO_JOIN_ACCEPTED";
2868
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_JOIN_REJECTED"] = 322] = "EMPLOYEE_INVITE_TO_JOIN_REJECTED";
2869
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_REGISTER"] = 325] = "EMPLOYEE_INVITE_TO_REGISTER";
2870
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED"] = 326] = "EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED";
2871
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 330] = "EMPLOYEE_LOST_CLIENT";
2872
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_RECEIVED_CLIENT"] = 331] = "EMPLOYEE_RECEIVED_CLIENT";
2873
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 340] = "FIRM_INVITE_TO_REGISTER";
2874
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER_ACCEPTED"] = 341] = "FIRM_INVITE_TO_REGISTER_ACCEPTED";
2875
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_NEW_ACCOUNTS"] = 501] = "BASIQ_NEW_ACCOUNTS";
2876
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 502] = "BASIQ_FIRST_IMPORT_COMPLETE";
2877
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 503] = "BASIQ_AUTHORIZATION_FAIL";
2878
- })(exports.UserEventTypeTypeEnum || (exports.UserEventTypeTypeEnum = {}));
2728
+ exports.UserEventTypeUserTypeEnum = void 0;
2729
+ (function (UserEventTypeUserTypeEnum) {
2730
+ UserEventTypeUserTypeEnum[UserEventTypeUserTypeEnum["REGISTERED"] = 1000] = "REGISTERED";
2731
+ UserEventTypeUserTypeEnum[UserEventTypeUserTypeEnum["PASSWORD_RESET"] = 1001] = "PASSWORD_RESET";
2732
+ UserEventTypeUserTypeEnum[UserEventTypeUserTypeEnum["APP_FEATURES"] = 1010] = "APP_FEATURES";
2733
+ })(exports.UserEventTypeUserTypeEnum || (exports.UserEventTypeUserTypeEnum = {}));
2734
+
2735
+ exports.UserEventTypeEmployeeTypeEnum = void 0;
2736
+ (function (UserEventTypeEmployeeTypeEnum) {
2737
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 3000] = "FIRM_INVITE_TO_REGISTER";
2738
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_INVITE"] = 3001] = "FIRM_INVITE";
2739
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["CLIENT_INVITE_ACCEPTED"] = 3002] = "CLIENT_INVITE_ACCEPTED";
2740
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["CLIENT_INVITE_REJECTED"] = 3003] = "CLIENT_INVITE_REJECTED";
2741
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["CLIENT_INVITE_REGISTERED"] = 3004] = "CLIENT_INVITE_REGISTERED";
2742
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_NEW_CLIENT"] = 3005] = "FIRM_NEW_CLIENT";
2743
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_LOST_CLIENT"] = 3006] = "FIRM_LOST_CLIENT";
2744
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_INVITE"] = 3010] = "EMPLOYEE_INVITE";
2745
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 3011] = "EMPLOYEE_LOST_CLIENT";
2746
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_NEW_CLIENT"] = 3012] = "EMPLOYEE_NEW_CLIENT";
2747
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_INVITE_ACCEPTED"] = 3013] = "EMPLOYEE_INVITE_ACCEPTED";
2748
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMAIL_CONFIRMED"] = 3020] = "EMAIL_CONFIRMED";
2749
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["TAX_REVIEW_REQUESTED"] = 3030] = "TAX_REVIEW_REQUESTED";
2750
+ })(exports.UserEventTypeEmployeeTypeEnum || (exports.UserEventTypeEmployeeTypeEnum = {}));
2751
+
2752
+ exports.UserEventTypeClientTypeEnum = void 0;
2753
+ (function (UserEventTypeClientTypeEnum) {
2754
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIBED"] = 2000] = "SUBSCRIBED";
2755
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["UNSUBSCRIBED"] = 2001] = "UNSUBSCRIBED";
2756
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIPTION_UPDATE"] = 2004] = "SUBSCRIPTION_UPDATE";
2757
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIPTION_TRIAL_UPDATE"] = 2005] = "SUBSCRIPTION_TRIAL_UPDATE";
2758
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CLIENT_INVITE"] = 2010] = "CLIENT_INVITE";
2759
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 2011] = "CLIENT_INVITE_TO_REGISTER";
2760
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
2761
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
2762
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
2763
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE"] = 2020] = "CO_OWNER_INVITE";
2764
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_TO_REGISTER"] = 2021] = "CO_OWNER_INVITE_TO_REGISTER";
2765
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_ACCEPTED"] = 2022] = "CO_OWNER_INVITE_ACCEPTED";
2766
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_REJECTED"] = 2023] = "CO_OWNER_INVITE_REJECTED";
2767
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_REGISTERED"] = 2024] = "CO_OWNER_INVITE_REGISTERED";
2768
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_CHANGE_REQUESTED"] = 2025] = "CO_OWNER_CHANGE_REQUESTED";
2769
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_CHANGE_ACCEPTED"] = 2026] = "CO_OWNER_CHANGE_ACCEPTED";
2770
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_CHANGE_REJECTED"] = 2027] = "CO_OWNER_CHANGE_REJECTED";
2771
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
2772
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
2773
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
2774
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["TRANSACTION_ALLOCATE_REMINDER"] = 2033] = "TRANSACTION_ALLOCATE_REMINDER";
2775
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["REGISTRATION_INVITE"] = 2040] = "REGISTRATION_INVITE";
2776
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["REGISTRATION_INVITE_ACCEPTED"] = 2041] = "REGISTRATION_INVITE_ACCEPTED";
2777
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["EMAIL_CONFIRMED"] = 2050] = "EMAIL_CONFIRMED";
2778
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["TAX_REVIEW_REQUESTED"] = 2060] = "TAX_REVIEW_REQUESTED";
2779
+ })(exports.UserEventTypeClientTypeEnum || (exports.UserEventTypeClientTypeEnum = {}));
2879
2780
 
2880
2781
  exports.UserMedicareExemptionEnum = void 0;
2881
2782
  (function (UserMedicareExemptionEnum) {
@@ -3007,18 +2908,16 @@
3007
2908
  classTransformer.Type((function () { return Country; }))
3008
2909
  ], Address.prototype, "country", void 0);
3009
2910
 
3010
- var Bank = /** @class */ (function () {
2911
+ var Bank$1 = /** @class */ (function () {
3011
2912
  function Bank() {
3012
2913
  }
3013
2914
  return Bank;
3014
2915
  }());
3015
2916
 
3016
- exports.Bank = /** @class */ (function (_super) {
2917
+ var Bank = /** @class */ (function (_super) {
3017
2918
  __extends(Bank, _super);
3018
- function Bank(environment) {
3019
- var _this = _super.call(this) || this;
3020
- _this.environment = environment;
3021
- return _this;
2919
+ function Bank() {
2920
+ return _super !== null && _super.apply(this, arguments) || this;
3022
2921
  }
3023
2922
  Bank.prototype.getInitials = function () {
3024
2923
  return this.name[0] + this.name[1];
@@ -3027,13 +2926,10 @@
3027
2926
  if (!this.logo) {
3028
2927
  return null;
3029
2928
  }
3030
- return this.logo.includes('http') ? "" + this.logo : this.environment.api_uri + "/" + this.logo;
2929
+ return this.logo.includes('http') ? "" + this.logo : localStorage.getItem('api_uri') + "/" + this.logo;
3031
2930
  };
3032
2931
  return Bank;
3033
- }(Bank));
3034
- exports.Bank = __decorate([
3035
- __param(0, i0.Inject('environment'))
3036
- ], exports.Bank);
2932
+ }(Bank$1));
3037
2933
 
3038
2934
  var BankAccount$1 = /** @class */ (function () {
3039
2935
  function BankAccount() {
@@ -4087,13 +3983,19 @@
4087
3983
  function BankConnection() {
4088
3984
  return _super !== null && _super.apply(this, arguments) || this;
4089
3985
  }
3986
+ /**
3987
+ * Check if status of connection is inactive (invalid)
3988
+ */
3989
+ BankConnection.prototype.isInactive = function () {
3990
+ return this.status === exports.BankConnectionStatusEnum.INVALID;
3991
+ };
4090
3992
  return BankConnection;
4091
3993
  }(BankConnection$1));
4092
3994
  __decorate([
4093
3995
  classTransformer.Type(function () { return BasiqJob; })
4094
3996
  ], BankConnection.prototype, "basiqJob", void 0);
4095
3997
  __decorate([
4096
- classTransformer.Type(function () { return exports.Bank; })
3998
+ classTransformer.Type(function () { return Bank; })
4097
3999
  ], BankConnection.prototype, "bank", void 0);
4098
4000
 
4099
4001
  var BankAccount = /** @class */ (function (_super) {
@@ -5740,6 +5642,62 @@
5740
5642
  return ClientPortfolioReport;
5741
5643
  }());
5742
5644
 
5645
+ /**
5646
+ * Class to generate data-table structure based on provided collection.
5647
+ * Use to work with HTML/PDF/XLSX tables
5648
+ */
5649
+ var DataTable = /** @class */ (function () {
5650
+ function DataTable(collection, columns, caption, footerCaption) {
5651
+ this.caption = caption;
5652
+ this.columns = columns;
5653
+ this.setRows(collection);
5654
+ if (footerCaption) {
5655
+ this.setFooterRow(collection, footerCaption);
5656
+ }
5657
+ }
5658
+ DataTable.prototype.setRows = function (collection) {
5659
+ var _this = this;
5660
+ this.rows = collection.items.map(function (item) {
5661
+ // parse table columns to return items based on column properties
5662
+ return _this.columns.map(function (column) {
5663
+ // if the pipe is provided - transform the return value
5664
+ if (column.pipe) {
5665
+ return column.pipe.transform(item[column.key]);
5666
+ }
5667
+ return (item[column.key] ? item[column.key] : '-').toString();
5668
+ });
5669
+ });
5670
+ };
5671
+ DataTable.prototype.setFooterRow = function (collection, footerCaption) {
5672
+ this.footerRow = this.columns.map(function (column, index) {
5673
+ if (index === 0) {
5674
+ return footerCaption.toString();
5675
+ }
5676
+ if (!column.total) {
5677
+ return '';
5678
+ }
5679
+ return collection.items
5680
+ .reduce(function (sum, item) { return sum + Number(item[column.key]); }, 0)
5681
+ .toString();
5682
+ });
5683
+ };
5684
+ return DataTable;
5685
+ }());
5686
+
5687
+ var DataTableColumn = /** @class */ (function () {
5688
+ function DataTableColumn(name, key, total, pipe) {
5689
+ /**
5690
+ * Flag that shows should the column be in the total calculation or not
5691
+ */
5692
+ this.total = false;
5693
+ this.name = name;
5694
+ this.key = key;
5695
+ this.total = total;
5696
+ this.pipe = pipe;
5697
+ }
5698
+ return DataTableColumn;
5699
+ }());
5700
+
5743
5701
  exports.DepreciationGroupEnum = void 0;
5744
5702
  (function (DepreciationGroupEnum) {
5745
5703
  DepreciationGroupEnum[DepreciationGroupEnum["BUILDING_IMPROVEMENTS"] = 0] = "BUILDING_IMPROVEMENTS";
@@ -6087,6 +6045,8 @@
6087
6045
  USER_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/users\\/photo\.\*'),
6088
6046
  USER_STATUS_PUT: new Endpoint('PUT', '\\/users\\/status'),
6089
6047
  VEHICLES_GET: new Endpoint('GET', '\\/vehicles'),
6048
+ VEHICLES_POST: new Endpoint('POST', '\\/vehicles'),
6049
+ VEHICLES_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+'),
6090
6050
  VEHICLE_CLAIMS_GET: new Endpoint('GET', '\\/vehicle-claims'),
6091
6051
  VEHICLE_CLAIMS_POST: new Endpoint('POST', '\\/vehicle-claims'),
6092
6052
  VEHICLE_LOGBOOK_POST: new Endpoint('POST', '\\/vehicles\\/\\d+\\/logbooks'),
@@ -6378,48 +6338,6 @@
6378
6338
  return ServiceNotification;
6379
6339
  }());
6380
6340
 
6381
- /**
6382
- * Notification events grouped by types
6383
- */
6384
- var NOTIFICATION_EVENT_TYPES = {
6385
- // events from employees to clients
6386
- employeeInvite: [
6387
- exports.UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED,
6388
- exports.UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN_ACCEPTED,
6389
- exports.UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN_REJECTED,
6390
- exports.UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_REGISTER,
6391
- exports.UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN,
6392
- ],
6393
- // events from clients to employee
6394
- employeeInviteFromClient: [
6395
- exports.UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN,
6396
- ],
6397
- bankConnection: [
6398
- exports.UserEventTypeTypeEnum.BASIQ_NEW_ACCOUNTS,
6399
- exports.UserEventTypeTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE,
6400
- exports.UserEventTypeTypeEnum.BASIQ_AUTHORIZATION_FAIL
6401
- ],
6402
- clientInvite: [
6403
- exports.UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN_ACCEPTED,
6404
- exports.UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN_REJECTED,
6405
- exports.UserEventTypeTypeEnum.CLIENT_INVITE_TO_REGISTER
6406
- ],
6407
- clientMovement: [
6408
- exports.UserEventTypeTypeEnum.CLIENT_LEFT_FIRM,
6409
- exports.UserEventTypeTypeEnum.EMPLOYEE_LOST_CLIENT,
6410
- exports.UserEventTypeTypeEnum.EMPLOYEE_RECEIVED_CLIENT
6411
- ],
6412
- propertyOwner: [
6413
- exports.UserEventTypeTypeEnum.CO_OWNER_INVITE_SEND,
6414
- exports.UserEventTypeTypeEnum.CO_OWNER_INVITE_ACCEPT,
6415
- exports.UserEventTypeTypeEnum.CO_OWNER_INVITE_REJECT,
6416
- exports.UserEventTypeTypeEnum.CO_OWNER_REGISTER,
6417
- exports.UserEventTypeTypeEnum.CO_OWNER_CHANGES_OFFER,
6418
- exports.UserEventTypeTypeEnum.CO_OWNER_CHANGES_ACCEPT,
6419
- exports.UserEventTypeTypeEnum.CO_OWNER_CHANGES_REJECT
6420
- ]
6421
- };
6422
-
6423
6341
  var Notification = /** @class */ (function (_super) {
6424
6342
  __extends(Notification, _super);
6425
6343
  function Notification() {
@@ -6427,35 +6345,11 @@
6427
6345
  }
6428
6346
  Object.defineProperty(Notification.prototype, "eventType", {
6429
6347
  get: function () {
6430
- return this.userEvent.userEventType.type;
6348
+ return this.userEvent.type.type;
6431
6349
  },
6432
6350
  enumerable: false,
6433
6351
  configurable: true
6434
6352
  });
6435
- /**
6436
- * Set redirection link based on current event type
6437
- */
6438
- Notification.prototype.setRedirectionLink = function () {
6439
- switch (true) {
6440
- case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(this.eventType):
6441
- this.redirectionLink = '/client/users/firms';
6442
- break;
6443
- case NOTIFICATION_EVENT_TYPES.bankConnection.includes(this.eventType):
6444
- this.redirectionLink = '/client/bank-feeds';
6445
- break;
6446
- case NOTIFICATION_EVENT_TYPES.clientInvite.includes(this.eventType):
6447
- this.redirectionLink = '/client/users/invitations';
6448
- break;
6449
- case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(this.eventType):
6450
- this.redirectionLink = '/client/users/co-owners';
6451
- break;
6452
- case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(this.eventType):
6453
- this.redirectionLink = '/firm/clients/invites';
6454
- break;
6455
- default:
6456
- this.redirectionLink = '';
6457
- }
6458
- };
6459
6353
  /**
6460
6354
  * Check if notification is from user or not
6461
6355
  */
@@ -6472,16 +6366,17 @@
6472
6366
  classTransformer.Transform(function (_a) {
6473
6367
  var obj = _a.obj;
6474
6368
  switch (true) {
6475
- case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(obj.eventType):
6476
- return '/client/users/firms';
6477
- case NOTIFICATION_EVENT_TYPES.bankConnection.includes(obj.eventType):
6478
- return '/client/bank-feeds';
6479
- case NOTIFICATION_EVENT_TYPES.clientInvite.includes(obj.eventType):
6480
- return '/client/users/invitations';
6481
- case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(obj.eventType):
6482
- return '/client/users/co-owners';
6483
- case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(obj.eventType):
6484
- return '/firm/clients/invites';
6369
+ // @TODO vik
6370
+ // case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(obj.eventType):
6371
+ // return '/client/users/firms';
6372
+ // case NOTIFICATION_EVENT_TYPES.bankConnection.includes(obj.eventType):
6373
+ // return '/client/bank-feeds';
6374
+ // case NOTIFICATION_EVENT_TYPES.clientInvite.includes(obj.eventType):
6375
+ // return '/client/users/invitations';
6376
+ // case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(obj.eventType):
6377
+ // return '/client/users/co-owners';
6378
+ // case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(obj.eventType):
6379
+ // return '/firm/clients/invites';
6485
6380
  default:
6486
6381
  return '';
6487
6382
  }
@@ -7229,6 +7124,68 @@
7229
7124
  return UserToRegister;
7230
7125
  }());
7231
7126
 
7127
+ var UserEventTypeCategory$1 = /** @class */ (function () {
7128
+ function UserEventTypeCategory() {
7129
+ }
7130
+ return UserEventTypeCategory;
7131
+ }());
7132
+
7133
+ var UserEventTypeCategory = /** @class */ (function (_super) {
7134
+ __extends(UserEventTypeCategory, _super);
7135
+ function UserEventTypeCategory() {
7136
+ return _super !== null && _super.apply(this, arguments) || this;
7137
+ }
7138
+ return UserEventTypeCategory;
7139
+ }(UserEventTypeCategory$1));
7140
+
7141
+ var UserEventSetting$1 = /** @class */ (function () {
7142
+ function UserEventSetting() {
7143
+ }
7144
+ return UserEventSetting;
7145
+ }());
7146
+
7147
+ var UserEventType$1 = /** @class */ (function () {
7148
+ function UserEventType() {
7149
+ }
7150
+ return UserEventType;
7151
+ }());
7152
+
7153
+ var UserEventType = /** @class */ (function (_super) {
7154
+ __extends(UserEventType, _super);
7155
+ function UserEventType() {
7156
+ return _super !== null && _super.apply(this, arguments) || this;
7157
+ }
7158
+ UserEventType.prototype.toSetting = function () {
7159
+ return classTransformer.plainToClass(UserEventSetting, {
7160
+ byEmail: this.byEmail,
7161
+ byNotification: this.byNotification,
7162
+ frequency: this.frequency,
7163
+ type: this
7164
+ });
7165
+ };
7166
+ return UserEventType;
7167
+ }(UserEventType$1));
7168
+ __decorate([
7169
+ classTransformer.Type(function () { return UserEventTypeCategory; })
7170
+ ], UserEventType.prototype, "category", void 0);
7171
+
7172
+ var UserEventSetting = /** @class */ (function (_super) {
7173
+ __extends(UserEventSetting, _super);
7174
+ function UserEventSetting() {
7175
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
7176
+ // flag indicates that the setting is updating now saved or not
7177
+ _this.isUpdating = false;
7178
+ return _this;
7179
+ }
7180
+ return UserEventSetting;
7181
+ }(UserEventSetting$1));
7182
+ __decorate([
7183
+ classTransformer.Type(function () { return UserEventType; })
7184
+ ], UserEventSetting.prototype, "type", void 0);
7185
+ __decorate([
7186
+ classTransformer.Exclude({ toPlainOnly: true })
7187
+ ], UserEventSetting.prototype, "isUpdating", void 0);
7188
+
7232
7189
  /**
7233
7190
  * Enum with user event setting fields
7234
7191
  */
@@ -7724,7 +7681,7 @@
7724
7681
  __extends(BankService, _super);
7725
7682
  function BankService() {
7726
7683
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
7727
- _this.modelClass = exports.Bank;
7684
+ _this.modelClass = Bank;
7728
7685
  _this.url = 'banks';
7729
7686
  _this.isHydra = true;
7730
7687
  return _this;
@@ -7760,7 +7717,7 @@
7760
7717
  * Listen system notifications and update cache when got basiq notification received
7761
7718
  */
7762
7719
  BankAccountService.prototype.listenEvents = function () {
7763
- this.listenToPropertyOwnerUpdated();
7720
+ this.listenToEventDispatcherChanges();
7764
7721
  };
7765
7722
  /**
7766
7723
  * Created manual bank account
@@ -7820,11 +7777,15 @@
7820
7777
  }));
7821
7778
  };
7822
7779
  /**
7823
- * Listen to EventDispatcherService event related to updated Property Owner Updated
7780
+ * Listen to EventDispatcherService events
7824
7781
  */
7825
- BankAccountService.prototype.listenToPropertyOwnerUpdated = function () {
7782
+ BankAccountService.prototype.listenToEventDispatcherChanges = function () {
7826
7783
  var _this = this;
7827
- this.eventDispatcherService.on([exports.AppEventTypeEnum.PROPERTY_OWNER_UPDATED, exports.AppEventTypeEnum.LOAN_PAYOUT_UPDATED]).subscribe(function () {
7784
+ this.eventDispatcherService.on([
7785
+ exports.AppEventTypeEnum.PROPERTY_OWNER_UPDATED,
7786
+ exports.AppEventTypeEnum.LOAN_PAYOUT_UPDATED,
7787
+ exports.AppEventTypeEnum.BANK_CONNECTION_ADDED
7788
+ ]).subscribe(function () {
7828
7789
  _this.fetch().subscribe(function (bankAccounts) {
7829
7790
  _this.cache = bankAccounts;
7830
7791
  _this.updateCache();
@@ -7955,8 +7916,12 @@
7955
7916
  _this.environment = environment;
7956
7917
  _this.modelClass = BankConnection;
7957
7918
  _this.url = 'bank-connections';
7919
+ _this.listenEvents();
7958
7920
  return _this;
7959
7921
  }
7922
+ BankConnectionService.prototype.listenEvents = function () {
7923
+ this.listenToAddedBankAccounts();
7924
+ };
7960
7925
  BankConnectionService.prototype.post = function (bankConnection) {
7961
7926
  var _this = this;
7962
7927
  return this.http.post(this.environment.apiV2 + "/" + this.url, bankConnection)
@@ -7965,6 +7930,12 @@
7965
7930
  return classTransformer.plainToClass(BankConnection, bankConnectionBase);
7966
7931
  }));
7967
7932
  };
7933
+ BankConnectionService.prototype.listenToAddedBankAccounts = function () {
7934
+ var _this = this;
7935
+ this.eventDispatcherService.on(exports.AppEventTypeEnum.BANK_ACCOUNT_CREATED).subscribe(function () {
7936
+ _this.resetCache();
7937
+ });
7938
+ };
7968
7939
  return BankConnectionService;
7969
7940
  }(BaseRestService));
7970
7941
  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 });
@@ -8046,7 +8017,7 @@
8046
8017
  BankTransactionService.prototype.listenBankTransactionsImport = function () {
8047
8018
  var _this = this;
8048
8019
  this.eventDispatcherService.on(exports.AppEventTypeEnum.NOTIFICATION_ADDED).subscribe(function (notification) {
8049
- if (!notification.isRead && notification.eventType === exports.UserEventTypeTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE) {
8020
+ if (!notification.isRead && notification.eventType === exports.UserEventTypeClientTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE) {
8050
8021
  _this.resetCache();
8051
8022
  }
8052
8023
  });
@@ -8136,7 +8107,7 @@
8136
8107
  BasiqService.prototype.listenNotifications = function () {
8137
8108
  var _this = this;
8138
8109
  this.eventDispatcherService.on(exports.AppEventTypeEnum.NOTIFICATION_ADDED).subscribe(function (notification) {
8139
- if (!notification.isRead && notification.eventType === exports.UserEventTypeTypeEnum.BASIQ_NEW_ACCOUNTS) {
8110
+ if (!notification.isRead && notification.eventType === exports.UserEventTypeClientTypeEnum.BASIQ_NEW_ACCOUNTS) {
8140
8111
  _this.resetCache();
8141
8112
  _this.get().subscribe();
8142
8113
  }
@@ -9253,7 +9224,7 @@
9253
9224
  FirmService.prototype.register = function (data) {
9254
9225
  return this.http.post(this.environment.apiV2 + "/firms/registration", data)
9255
9226
  .pipe(operators.map(function (firm) {
9256
- return classTransformer.plainToClass(Firm$1, firm);
9227
+ return classTransformer.plainToClass(Firm, firm);
9257
9228
  }));
9258
9229
  };
9259
9230
  FirmService.prototype.get = function () {
@@ -9261,7 +9232,7 @@
9261
9232
  if (!this.firm) {
9262
9233
  this.http.get(this.environment.apiV2 + "/firms/current")
9263
9234
  .pipe(operators.map(function (firm) {
9264
- return classTransformer.plainToClass(Firm$1, firm);
9235
+ return classTransformer.plainToClass(Firm, firm);
9265
9236
  }))
9266
9237
  .subscribe(function (firm) {
9267
9238
  _this.firm = firm;
@@ -9274,7 +9245,7 @@
9274
9245
  var _this = this;
9275
9246
  return this.http.put(this.environment.apiV2 + "/firms/current", firm)
9276
9247
  .pipe(operators.map(function (updatedItem) {
9277
- var updatedInstance = classTransformer.plainToClass(Firm$1, updatedItem);
9248
+ var updatedInstance = classTransformer.plainToClass(Firm, updatedItem);
9278
9249
  _this.firmSubject.next(updatedInstance);
9279
9250
  }));
9280
9251
  };
@@ -9284,7 +9255,7 @@
9284
9255
  FirmService.prototype.getAll = function () {
9285
9256
  return this.http.get(this.environment.apiV2 + "/firms")
9286
9257
  .pipe(operators.map(function (response) {
9287
- return response['hydra:member'].map(function (firmBase) { return classTransformer.plainToClass(Firm$1, firmBase); });
9258
+ return response['hydra:member'].map(function (firmBase) { return classTransformer.plainToClass(Firm, firmBase); });
9288
9259
  }));
9289
9260
  };
9290
9261
  FirmService.prototype.getByType = function (type) {
@@ -9296,7 +9267,7 @@
9296
9267
  var _this = this;
9297
9268
  return this.http.post(this.environment.apiV2 + "/firms/photo?_method=PUT", photo)
9298
9269
  .pipe(operators.map(function (firmPhoto) {
9299
- _this.firm = classTransformer.plainToClass(Firm$1, Object.assign(firm, { photo: firmPhoto }));
9270
+ _this.firm = classTransformer.plainToClass(Firm, Object.assign(firm, { photo: firmPhoto }));
9300
9271
  _this.firmSubject.next(_this.firm);
9301
9272
  return firm;
9302
9273
  }));
@@ -9864,6 +9835,83 @@
9864
9835
  }] }, { type: SseService }];
9865
9836
  } });
9866
9837
 
9838
+ /**
9839
+ * Configuration file with the settings to generate PDF file
9840
+ */
9841
+ var PDF_CONFIG = {
9842
+ text: {
9843
+ fontSize: 18,
9844
+ fontName: 'helvetica',
9845
+ fontStyle: '',
9846
+ fontWeight: 'bold',
9847
+ positionX: 14,
9848
+ positionY: 10,
9849
+ fillColor: 255,
9850
+ textColor: 0
9851
+ },
9852
+ // coords for file section title (group, table, e.t.c.)
9853
+ contentTitleCoords: {
9854
+ marginTop: 20
9855
+ },
9856
+ contentCoords: {
9857
+ marginTop: 15,
9858
+ marginLeft: 14
9859
+ }
9860
+ };
9861
+
9862
+ /**
9863
+ * Service to work with PDF (generate, download, e.t.c.)
9864
+ */
9865
+ var PdfService = /** @class */ (function () {
9866
+ function PdfService() {
9867
+ }
9868
+ // @Todo remove 'any' type
9869
+ /**
9870
+ * Download generated PDF file
9871
+ */
9872
+ PdfService.prototype.download = function (tables, title, fileName) {
9873
+ var document = this.generatePdfFile(tables, title);
9874
+ document.save(fileName + ".pdf");
9875
+ };
9876
+ /**
9877
+ * Generate PDF file from provided data
9878
+ */
9879
+ PdfService.prototype.generatePdfFile = function (tables, title) {
9880
+ var pdf = new jsPDF__default["default"]();
9881
+ // set document title
9882
+ pdf.setFontSize(PDF_CONFIG.text.fontSize);
9883
+ pdf.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight);
9884
+ pdf.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
9885
+ tables.forEach(function (table) {
9886
+ // coords of last table
9887
+ var lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
9888
+ pdf.text(table.caption, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
9889
+ // table options
9890
+ var options = {
9891
+ startY: lastTableCoords + PDF_CONFIG.contentTitleCoords.marginTop,
9892
+ head: [table['columns'].map(function (column) { return column.name; })],
9893
+ body: table['rows'],
9894
+ foot: [table['footerRow']],
9895
+ footStyles: {
9896
+ fillColor: PDF_CONFIG.text.fillColor,
9897
+ textColor: PDF_CONFIG.text.textColor
9898
+ }
9899
+ };
9900
+ autoTable__default["default"](pdf, options);
9901
+ });
9902
+ return pdf;
9903
+ };
9904
+ return PdfService;
9905
+ }());
9906
+ PdfService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
9907
+ PdfService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, providedIn: 'root' });
9908
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, decorators: [{
9909
+ type: i0.Injectable,
9910
+ args: [{
9911
+ providedIn: 'root'
9912
+ }]
9913
+ }] });
9914
+
9867
9915
  var PreloaderService = /** @class */ (function () {
9868
9916
  function PreloaderService() {
9869
9917
  this.activePreloaders = new rxjs.BehaviorSubject([]);
@@ -11734,6 +11782,59 @@
11734
11782
  }] }];
11735
11783
  } });
11736
11784
 
11785
+ /**
11786
+ * Service to work with XLSX (generate, download, e.t.c.)
11787
+ */
11788
+ var XlsxService = /** @class */ (function () {
11789
+ function XlsxService() {
11790
+ }
11791
+ // @Todo remove 'any' type
11792
+ /**s
11793
+ * Download generated Excel file
11794
+ */
11795
+ XlsxService.prototype.download = function (tables, title, fileName) {
11796
+ var excelFile = this.generateFile(tables, title);
11797
+ var data = new Blob([excelFile], {
11798
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'
11799
+ });
11800
+ FileSaver__namespace.saveAs(data, fileName + ".xlsx");
11801
+ };
11802
+ XlsxService.prototype.generateFile = function (tables, title) {
11803
+ // create new workbook
11804
+ var workbook = xlsx__namespace.utils.book_new();
11805
+ // create empty worksheet
11806
+ var worksheet = {
11807
+ SheetNames: [],
11808
+ Sheets: {}
11809
+ };
11810
+ var sheetData = tables.map(function (table) {
11811
+ // add caption, columns, rows and footer rows
11812
+ return __spreadArray(__spreadArray([
11813
+ [table.caption],
11814
+ table.columns.map(function (column) { return column.name; })
11815
+ ], __read(table.rows)), [
11816
+ table.footerRow,
11817
+ ]);
11818
+ });
11819
+ sheetData.forEach(function (data) {
11820
+ xlsx__namespace.utils.sheet_add_json(worksheet, data, { origin: -1, skipHeader: true });
11821
+ // set empty row after each table
11822
+ xlsx__namespace.utils.sheet_add_json(worksheet, [], { origin: -1 });
11823
+ });
11824
+ xlsx__namespace.utils.book_append_sheet(workbook, worksheet);
11825
+ return xlsx__namespace.write(workbook, { bookType: 'xlsx', type: 'array' });
11826
+ };
11827
+ return XlsxService;
11828
+ }());
11829
+ XlsxService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: XlsxService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11830
+ XlsxService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: XlsxService, providedIn: 'root' });
11831
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: XlsxService, decorators: [{
11832
+ type: i0.Injectable,
11833
+ args: [{
11834
+ providedIn: 'root'
11835
+ }]
11836
+ }] });
11837
+
11737
11838
  // deep clone for entity
11738
11839
  function cloneDeep(array) {
11739
11840
  return JSON.parse(JSON.stringify(array));
@@ -11820,6 +11921,7 @@
11820
11921
  exports.AssetsService = AssetsService;
11821
11922
  exports.AuthService = AuthService;
11822
11923
  exports.BANK_ACCOUNT_TYPES = BANK_ACCOUNT_TYPES;
11924
+ exports.Bank = Bank;
11823
11925
  exports.BankAccount = BankAccount;
11824
11926
  exports.BankAccountCalculationService = BankAccountCalculationService;
11825
11927
  exports.BankAccountChartData = BankAccountChartData;
@@ -11872,6 +11974,8 @@
11872
11974
  exports.DEFAULT_VEHICLE_EXPENSE = DEFAULT_VEHICLE_EXPENSE;
11873
11975
  exports.DEPRECIATION_GROUPS = DEPRECIATION_GROUPS;
11874
11976
  exports.DOCUMENT_FILE_TYPES = DOCUMENT_FILE_TYPES;
11977
+ exports.DataTable = DataTable;
11978
+ exports.DataTableColumn = DataTableColumn;
11875
11979
  exports.Depreciation = Depreciation;
11876
11980
  exports.DepreciationCapitalProject = DepreciationCapitalProject;
11877
11981
  exports.DepreciationCollection = DepreciationCollection;
@@ -11922,11 +12026,11 @@
11922
12026
  exports.MessageDocumentService = MessageDocumentService;
11923
12027
  exports.MessageService = MessageService;
11924
12028
  exports.MyAccountHistory = MyAccountHistory;
11925
- exports.NOTIFICATION_EVENT_TYPES = NOTIFICATION_EVENT_TYPES;
11926
12029
  exports.Notification = Notification;
11927
12030
  exports.NotificationService = NotificationService;
11928
12031
  exports.Occupation = Occupation;
11929
12032
  exports.OccupationService = OccupationService;
12033
+ exports.PdfService = PdfService;
11930
12034
  exports.Phone = Phone;
11931
12035
  exports.PreloaderService = PreloaderService;
11932
12036
  exports.Property = Property;
@@ -11988,11 +12092,11 @@
11988
12092
  exports.USER_ROLES = USER_ROLES;
11989
12093
  exports.USER_WORK_POSITION = USER_WORK_POSITION;
11990
12094
  exports.User = User;
11991
- exports.UserEventCategory = UserEventCategory;
11992
12095
  exports.UserEventSetting = UserEventSetting;
11993
12096
  exports.UserEventSettingCollection = UserEventSettingCollection;
11994
12097
  exports.UserEventSettingService = UserEventSettingService;
11995
12098
  exports.UserEventType = UserEventType;
12099
+ exports.UserEventTypeCategory = UserEventTypeCategory;
11996
12100
  exports.UserEventTypeService = UserEventTypeService;
11997
12101
  exports.UserService = UserService;
11998
12102
  exports.UserSwitcherService = UserSwitcherService;
@@ -12002,6 +12106,7 @@
12002
12106
  exports.VehicleLogbook = VehicleLogbook;
12003
12107
  exports.WORK_TANK_LOGBOOK_PURPOSE_OPTIONS = WORK_TANK_LOGBOOK_PURPOSE_OPTIONS;
12004
12108
  exports.WorkTankService = WorkTankService;
12109
+ exports.XlsxService = XlsxService;
12005
12110
  exports.cloneDeep = cloneDeep;
12006
12111
  exports.compare = compare;
12007
12112
  exports.compareMatOptions = compareMatOptions;