taxtank-core 0.1.2 → 0.2.0

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 (70) hide show
  1. package/bundles/taxtank-core.umd.js +381 -288
  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/notification/notification.js +13 -37
  20. package/esm2015/lib/models/pdf/pdf-config.js +24 -0
  21. package/esm2015/lib/models/user-event/user-event-setting.js +3 -3
  22. package/esm2015/lib/models/user-event/user-event-type-category.js +4 -0
  23. package/esm2015/lib/models/user-event/user-event-type.js +13 -18
  24. package/esm2015/lib/services/bank/bank-account.service.js +9 -5
  25. package/esm2015/lib/services/bank/bank-transaction.service.js +3 -3
  26. package/esm2015/lib/services/bank/basiq.service.js +3 -3
  27. package/esm2015/lib/services/pdf/pdf.service.js +55 -0
  28. package/esm2015/lib/services/xlsx/xlsx.service.js +54 -0
  29. package/esm2015/lib/tt-core.module.js +2 -1
  30. package/esm2015/public-api.js +9 -7
  31. package/fesm2015/taxtank-core.js +335 -259
  32. package/fesm2015/taxtank-core.js.map +1 -1
  33. package/lib/collections/abstract.collection.d.ts +4 -1
  34. package/lib/collections/collection-dictionary.d.ts +4 -1
  35. package/lib/collections/user-event-setting.collection.d.ts +1 -23
  36. package/lib/db/Enums/user-event-status.enum.d.ts +2 -1
  37. package/lib/db/Enums/user-event-type-client-type.enum.d.ts +27 -0
  38. package/lib/db/Enums/user-event-type-employee-type.enum.d.ts +15 -0
  39. package/lib/db/Enums/user-event-type-frequency.enum.d.ts +3 -4
  40. package/lib/db/Enums/user-event-type-user-type.enum.d.ts +5 -0
  41. package/lib/db/Models/user-event-setting.d.ts +1 -1
  42. package/lib/db/Models/user-event-type-category.d.ts +4 -0
  43. package/lib/db/Models/user-event-type.d.ts +5 -3
  44. package/lib/db/Models/user-event.d.ts +3 -1
  45. package/lib/models/bank/bank-connection.d.ts +4 -0
  46. package/lib/models/bank/bank.d.ts +0 -2
  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/user-event/user-event-setting.d.ts +1 -1
  52. package/lib/models/user-event/user-event-type-category.d.ts +3 -0
  53. package/lib/models/user-event/user-event-type.d.ts +4 -2
  54. package/lib/services/bank/bank-account.service.d.ts +2 -2
  55. package/lib/services/pdf/pdf.service.d.ts +14 -0
  56. package/lib/services/xlsx/xlsx.service.d.ts +11 -0
  57. package/package.json +13 -9
  58. package/public-api.d.ts +8 -6
  59. package/esm2015/lib/db/Enums/user-event-type-reminder-type.enum.js +0 -8
  60. package/esm2015/lib/db/Enums/user-event-type-reminder.enum.js +0 -7
  61. package/esm2015/lib/db/Enums/user-event-type-type.enum.js +0 -35
  62. package/esm2015/lib/models/notification/notification-event-types.const.js +0 -43
  63. package/esm2015/lib/models/user-event/user-event-category.enum.js +0 -11
  64. package/esm2015/lib/models/user-event/user-event-category.js +0 -6
  65. package/lib/db/Enums/user-event-type-reminder-type.enum.d.ts +0 -6
  66. package/lib/db/Enums/user-event-type-reminder.enum.d.ts +0 -5
  67. package/lib/db/Enums/user-event-type-type.enum.d.ts +0 -33
  68. package/lib/models/notification/notification-event-types.const.d.ts +0 -7
  69. package/lib/models/user-event/user-event-category.d.ts +0 -8
  70. 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";
@@ -6378,48 +6336,6 @@
6378
6336
  return ServiceNotification;
6379
6337
  }());
6380
6338
 
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
6339
  var Notification = /** @class */ (function (_super) {
6424
6340
  __extends(Notification, _super);
6425
6341
  function Notification() {
@@ -6427,35 +6343,11 @@
6427
6343
  }
6428
6344
  Object.defineProperty(Notification.prototype, "eventType", {
6429
6345
  get: function () {
6430
- return this.userEvent.userEventType.type;
6346
+ return this.userEvent.type.type;
6431
6347
  },
6432
6348
  enumerable: false,
6433
6349
  configurable: true
6434
6350
  });
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
6351
  /**
6460
6352
  * Check if notification is from user or not
6461
6353
  */
@@ -6472,16 +6364,17 @@
6472
6364
  classTransformer.Transform(function (_a) {
6473
6365
  var obj = _a.obj;
6474
6366
  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';
6367
+ // @TODO vik
6368
+ // case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(obj.eventType):
6369
+ // return '/client/users/firms';
6370
+ // case NOTIFICATION_EVENT_TYPES.bankConnection.includes(obj.eventType):
6371
+ // return '/client/bank-feeds';
6372
+ // case NOTIFICATION_EVENT_TYPES.clientInvite.includes(obj.eventType):
6373
+ // return '/client/users/invitations';
6374
+ // case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(obj.eventType):
6375
+ // return '/client/users/co-owners';
6376
+ // case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(obj.eventType):
6377
+ // return '/firm/clients/invites';
6485
6378
  default:
6486
6379
  return '';
6487
6380
  }
@@ -7229,6 +7122,68 @@
7229
7122
  return UserToRegister;
7230
7123
  }());
7231
7124
 
7125
+ var UserEventTypeCategory$1 = /** @class */ (function () {
7126
+ function UserEventTypeCategory() {
7127
+ }
7128
+ return UserEventTypeCategory;
7129
+ }());
7130
+
7131
+ var UserEventTypeCategory = /** @class */ (function (_super) {
7132
+ __extends(UserEventTypeCategory, _super);
7133
+ function UserEventTypeCategory() {
7134
+ return _super !== null && _super.apply(this, arguments) || this;
7135
+ }
7136
+ return UserEventTypeCategory;
7137
+ }(UserEventTypeCategory$1));
7138
+
7139
+ var UserEventSetting$1 = /** @class */ (function () {
7140
+ function UserEventSetting() {
7141
+ }
7142
+ return UserEventSetting;
7143
+ }());
7144
+
7145
+ var UserEventType$1 = /** @class */ (function () {
7146
+ function UserEventType() {
7147
+ }
7148
+ return UserEventType;
7149
+ }());
7150
+
7151
+ var UserEventType = /** @class */ (function (_super) {
7152
+ __extends(UserEventType, _super);
7153
+ function UserEventType() {
7154
+ return _super !== null && _super.apply(this, arguments) || this;
7155
+ }
7156
+ UserEventType.prototype.toSetting = function () {
7157
+ return classTransformer.plainToClass(UserEventSetting, {
7158
+ byEmail: this.byEmail,
7159
+ byNotification: this.byNotification,
7160
+ frequency: this.frequency,
7161
+ type: this
7162
+ });
7163
+ };
7164
+ return UserEventType;
7165
+ }(UserEventType$1));
7166
+ __decorate([
7167
+ classTransformer.Type(function () { return UserEventTypeCategory; })
7168
+ ], UserEventType.prototype, "category", void 0);
7169
+
7170
+ var UserEventSetting = /** @class */ (function (_super) {
7171
+ __extends(UserEventSetting, _super);
7172
+ function UserEventSetting() {
7173
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
7174
+ // flag indicates that the setting is updating now saved or not
7175
+ _this.isUpdating = false;
7176
+ return _this;
7177
+ }
7178
+ return UserEventSetting;
7179
+ }(UserEventSetting$1));
7180
+ __decorate([
7181
+ classTransformer.Type(function () { return UserEventType; })
7182
+ ], UserEventSetting.prototype, "type", void 0);
7183
+ __decorate([
7184
+ classTransformer.Exclude({ toPlainOnly: true })
7185
+ ], UserEventSetting.prototype, "isUpdating", void 0);
7186
+
7232
7187
  /**
7233
7188
  * Enum with user event setting fields
7234
7189
  */
@@ -7724,7 +7679,7 @@
7724
7679
  __extends(BankService, _super);
7725
7680
  function BankService() {
7726
7681
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
7727
- _this.modelClass = exports.Bank;
7682
+ _this.modelClass = Bank;
7728
7683
  _this.url = 'banks';
7729
7684
  _this.isHydra = true;
7730
7685
  return _this;
@@ -7760,7 +7715,7 @@
7760
7715
  * Listen system notifications and update cache when got basiq notification received
7761
7716
  */
7762
7717
  BankAccountService.prototype.listenEvents = function () {
7763
- this.listenToPropertyOwnerUpdated();
7718
+ this.listenToEventDispatcherChanges();
7764
7719
  };
7765
7720
  /**
7766
7721
  * Created manual bank account
@@ -7820,11 +7775,15 @@
7820
7775
  }));
7821
7776
  };
7822
7777
  /**
7823
- * Listen to EventDispatcherService event related to updated Property Owner Updated
7778
+ * Listen to EventDispatcherService events
7824
7779
  */
7825
- BankAccountService.prototype.listenToPropertyOwnerUpdated = function () {
7780
+ BankAccountService.prototype.listenToEventDispatcherChanges = function () {
7826
7781
  var _this = this;
7827
- this.eventDispatcherService.on([exports.AppEventTypeEnum.PROPERTY_OWNER_UPDATED, exports.AppEventTypeEnum.LOAN_PAYOUT_UPDATED]).subscribe(function () {
7782
+ this.eventDispatcherService.on([
7783
+ exports.AppEventTypeEnum.PROPERTY_OWNER_UPDATED,
7784
+ exports.AppEventTypeEnum.LOAN_PAYOUT_UPDATED,
7785
+ exports.AppEventTypeEnum.BANK_CONNECTION_ADDED
7786
+ ]).subscribe(function () {
7828
7787
  _this.fetch().subscribe(function (bankAccounts) {
7829
7788
  _this.cache = bankAccounts;
7830
7789
  _this.updateCache();
@@ -8046,7 +8005,7 @@
8046
8005
  BankTransactionService.prototype.listenBankTransactionsImport = function () {
8047
8006
  var _this = this;
8048
8007
  this.eventDispatcherService.on(exports.AppEventTypeEnum.NOTIFICATION_ADDED).subscribe(function (notification) {
8049
- if (!notification.isRead && notification.eventType === exports.UserEventTypeTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE) {
8008
+ if (!notification.isRead && notification.eventType === exports.UserEventTypeClientTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE) {
8050
8009
  _this.resetCache();
8051
8010
  }
8052
8011
  });
@@ -8136,7 +8095,7 @@
8136
8095
  BasiqService.prototype.listenNotifications = function () {
8137
8096
  var _this = this;
8138
8097
  this.eventDispatcherService.on(exports.AppEventTypeEnum.NOTIFICATION_ADDED).subscribe(function (notification) {
8139
- if (!notification.isRead && notification.eventType === exports.UserEventTypeTypeEnum.BASIQ_NEW_ACCOUNTS) {
8098
+ if (!notification.isRead && notification.eventType === exports.UserEventTypeClientTypeEnum.BASIQ_NEW_ACCOUNTS) {
8140
8099
  _this.resetCache();
8141
8100
  _this.get().subscribe();
8142
8101
  }
@@ -9864,6 +9823,83 @@
9864
9823
  }] }, { type: SseService }];
9865
9824
  } });
9866
9825
 
9826
+ /**
9827
+ * Configuration file with the settings to generate PDF file
9828
+ */
9829
+ var PDF_CONFIG = {
9830
+ text: {
9831
+ fontSize: 18,
9832
+ fontName: 'helvetica',
9833
+ fontStyle: '',
9834
+ fontWeight: 'bold',
9835
+ positionX: 14,
9836
+ positionY: 10,
9837
+ fillColor: 255,
9838
+ textColor: 0
9839
+ },
9840
+ // coords for file section title (group, table, e.t.c.)
9841
+ contentTitleCoords: {
9842
+ marginTop: 20
9843
+ },
9844
+ contentCoords: {
9845
+ marginTop: 15,
9846
+ marginLeft: 14
9847
+ }
9848
+ };
9849
+
9850
+ /**
9851
+ * Service to work with PDF (generate, download, e.t.c.)
9852
+ */
9853
+ var PdfService = /** @class */ (function () {
9854
+ function PdfService() {
9855
+ }
9856
+ // @Todo remove 'any' type
9857
+ /**
9858
+ * Download generated PDF file
9859
+ */
9860
+ PdfService.prototype.download = function (tables, title, fileName) {
9861
+ var document = this.generatePdfFile(tables, title);
9862
+ document.save(fileName + ".pdf");
9863
+ };
9864
+ /**
9865
+ * Generate PDF file from provided data
9866
+ */
9867
+ PdfService.prototype.generatePdfFile = function (tables, title) {
9868
+ var pdf = new jsPDF__default["default"]();
9869
+ // set document title
9870
+ pdf.setFontSize(PDF_CONFIG.text.fontSize);
9871
+ pdf.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight);
9872
+ pdf.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
9873
+ tables.forEach(function (table) {
9874
+ // coords of last table
9875
+ var lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
9876
+ pdf.text(table.caption, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
9877
+ // table options
9878
+ var options = {
9879
+ startY: lastTableCoords + PDF_CONFIG.contentTitleCoords.marginTop,
9880
+ head: [table['columns'].map(function (column) { return column.name; })],
9881
+ body: table['rows'],
9882
+ foot: [table['footerRow']],
9883
+ footStyles: {
9884
+ fillColor: PDF_CONFIG.text.fillColor,
9885
+ textColor: PDF_CONFIG.text.textColor
9886
+ }
9887
+ };
9888
+ autoTable__default["default"](pdf, options);
9889
+ });
9890
+ return pdf;
9891
+ };
9892
+ return PdfService;
9893
+ }());
9894
+ PdfService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
9895
+ PdfService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, providedIn: 'root' });
9896
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, decorators: [{
9897
+ type: i0.Injectable,
9898
+ args: [{
9899
+ providedIn: 'root'
9900
+ }]
9901
+ }] });
9902
+
9867
9903
  var PreloaderService = /** @class */ (function () {
9868
9904
  function PreloaderService() {
9869
9905
  this.activePreloaders = new rxjs.BehaviorSubject([]);
@@ -11734,6 +11770,59 @@
11734
11770
  }] }];
11735
11771
  } });
11736
11772
 
11773
+ /**
11774
+ * Service to work with XLSX (generate, download, e.t.c.)
11775
+ */
11776
+ var XlsxService = /** @class */ (function () {
11777
+ function XlsxService() {
11778
+ }
11779
+ // @Todo remove 'any' type
11780
+ /**s
11781
+ * Download generated Excel file
11782
+ */
11783
+ XlsxService.prototype.download = function (tables, title, fileName) {
11784
+ var excelFile = this.generateFile(tables, title);
11785
+ var data = new Blob([excelFile], {
11786
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'
11787
+ });
11788
+ FileSaver__namespace.saveAs(data, fileName + ".xlsx");
11789
+ };
11790
+ XlsxService.prototype.generateFile = function (tables, title) {
11791
+ // create new workbook
11792
+ var workbook = xlsx__namespace.utils.book_new();
11793
+ // create empty worksheet
11794
+ var worksheet = {
11795
+ SheetNames: [],
11796
+ Sheets: {}
11797
+ };
11798
+ var sheetData = tables.map(function (table) {
11799
+ // add caption, columns, rows and footer rows
11800
+ return __spreadArray(__spreadArray([
11801
+ [table.caption],
11802
+ table.columns.map(function (column) { return column.name; })
11803
+ ], __read(table.rows)), [
11804
+ table.footerRow,
11805
+ ]);
11806
+ });
11807
+ sheetData.forEach(function (data) {
11808
+ xlsx__namespace.utils.sheet_add_json(worksheet, data, { origin: -1, skipHeader: true });
11809
+ // set empty row after each table
11810
+ xlsx__namespace.utils.sheet_add_json(worksheet, [], { origin: -1 });
11811
+ });
11812
+ xlsx__namespace.utils.book_append_sheet(workbook, worksheet);
11813
+ return xlsx__namespace.write(workbook, { bookType: 'xlsx', type: 'array' });
11814
+ };
11815
+ return XlsxService;
11816
+ }());
11817
+ XlsxService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: XlsxService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11818
+ XlsxService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: XlsxService, providedIn: 'root' });
11819
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: XlsxService, decorators: [{
11820
+ type: i0.Injectable,
11821
+ args: [{
11822
+ providedIn: 'root'
11823
+ }]
11824
+ }] });
11825
+
11737
11826
  // deep clone for entity
11738
11827
  function cloneDeep(array) {
11739
11828
  return JSON.parse(JSON.stringify(array));
@@ -11820,6 +11909,7 @@
11820
11909
  exports.AssetsService = AssetsService;
11821
11910
  exports.AuthService = AuthService;
11822
11911
  exports.BANK_ACCOUNT_TYPES = BANK_ACCOUNT_TYPES;
11912
+ exports.Bank = Bank;
11823
11913
  exports.BankAccount = BankAccount;
11824
11914
  exports.BankAccountCalculationService = BankAccountCalculationService;
11825
11915
  exports.BankAccountChartData = BankAccountChartData;
@@ -11872,6 +11962,8 @@
11872
11962
  exports.DEFAULT_VEHICLE_EXPENSE = DEFAULT_VEHICLE_EXPENSE;
11873
11963
  exports.DEPRECIATION_GROUPS = DEPRECIATION_GROUPS;
11874
11964
  exports.DOCUMENT_FILE_TYPES = DOCUMENT_FILE_TYPES;
11965
+ exports.DataTable = DataTable;
11966
+ exports.DataTableColumn = DataTableColumn;
11875
11967
  exports.Depreciation = Depreciation;
11876
11968
  exports.DepreciationCapitalProject = DepreciationCapitalProject;
11877
11969
  exports.DepreciationCollection = DepreciationCollection;
@@ -11922,11 +12014,11 @@
11922
12014
  exports.MessageDocumentService = MessageDocumentService;
11923
12015
  exports.MessageService = MessageService;
11924
12016
  exports.MyAccountHistory = MyAccountHistory;
11925
- exports.NOTIFICATION_EVENT_TYPES = NOTIFICATION_EVENT_TYPES;
11926
12017
  exports.Notification = Notification;
11927
12018
  exports.NotificationService = NotificationService;
11928
12019
  exports.Occupation = Occupation;
11929
12020
  exports.OccupationService = OccupationService;
12021
+ exports.PdfService = PdfService;
11930
12022
  exports.Phone = Phone;
11931
12023
  exports.PreloaderService = PreloaderService;
11932
12024
  exports.Property = Property;
@@ -11988,11 +12080,11 @@
11988
12080
  exports.USER_ROLES = USER_ROLES;
11989
12081
  exports.USER_WORK_POSITION = USER_WORK_POSITION;
11990
12082
  exports.User = User;
11991
- exports.UserEventCategory = UserEventCategory;
11992
12083
  exports.UserEventSetting = UserEventSetting;
11993
12084
  exports.UserEventSettingCollection = UserEventSettingCollection;
11994
12085
  exports.UserEventSettingService = UserEventSettingService;
11995
12086
  exports.UserEventType = UserEventType;
12087
+ exports.UserEventTypeCategory = UserEventTypeCategory;
11996
12088
  exports.UserEventTypeService = UserEventTypeService;
11997
12089
  exports.UserService = UserService;
11998
12090
  exports.UserSwitcherService = UserSwitcherService;
@@ -12002,6 +12094,7 @@
12002
12094
  exports.VehicleLogbook = VehicleLogbook;
12003
12095
  exports.WORK_TANK_LOGBOOK_PURPOSE_OPTIONS = WORK_TANK_LOGBOOK_PURPOSE_OPTIONS;
12004
12096
  exports.WorkTankService = WorkTankService;
12097
+ exports.XlsxService = XlsxService;
12005
12098
  exports.cloneDeep = cloneDeep;
12006
12099
  exports.compare = compare;
12007
12100
  exports.compareMatOptions = compareMatOptions;