taxtank-core 0.1.3 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/bundles/taxtank-core.umd.js +386 -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/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/firm/firm.service.js +2 -2
  28. package/esm2015/lib/services/pdf/pdf.service.js +55 -0
  29. package/esm2015/lib/services/xlsx/xlsx.service.js +54 -0
  30. package/esm2015/lib/tt-core.module.js +2 -1
  31. package/esm2015/public-api.js +9 -7
  32. package/fesm2015/taxtank-core.js +340 -264
  33. package/fesm2015/taxtank-core.js.map +1 -1
  34. package/lib/collections/abstract.collection.d.ts +4 -1
  35. package/lib/collections/collection-dictionary.d.ts +4 -1
  36. package/lib/collections/user-event-setting.collection.d.ts +1 -23
  37. package/lib/db/Enums/user-event-status.enum.d.ts +2 -1
  38. package/lib/db/Enums/user-event-type-client-type.enum.d.ts +27 -0
  39. package/lib/db/Enums/user-event-type-employee-type.enum.d.ts +15 -0
  40. package/lib/db/Enums/user-event-type-frequency.enum.d.ts +3 -4
  41. package/lib/db/Enums/user-event-type-user-type.enum.d.ts +5 -0
  42. package/lib/db/Models/user-event-setting.d.ts +1 -1
  43. package/lib/db/Models/user-event-type-category.d.ts +4 -0
  44. package/lib/db/Models/user-event-type.d.ts +5 -3
  45. package/lib/db/Models/user-event.d.ts +3 -1
  46. package/lib/models/bank/bank-connection.d.ts +4 -0
  47. package/lib/models/bank/bank.d.ts +0 -2
  48. package/lib/models/data-table/data-table-column.d.ts +20 -0
  49. package/lib/models/data-table/data-table.d.ts +24 -0
  50. package/lib/models/notification/notification.d.ts +4 -6
  51. package/lib/models/pdf/pdf-config.d.ts +8 -0
  52. package/lib/models/user-event/user-event-setting.d.ts +1 -1
  53. package/lib/models/user-event/user-event-type-category.d.ts +3 -0
  54. package/lib/models/user-event/user-event-type.d.ts +4 -2
  55. package/lib/services/bank/bank-account.service.d.ts +2 -2
  56. package/lib/services/firm/firm.service.d.ts +1 -1
  57. package/lib/services/pdf/pdf.service.d.ts +14 -0
  58. package/lib/services/xlsx/xlsx.service.d.ts +11 -0
  59. package/package.json +10 -6
  60. package/public-api.d.ts +8 -6
  61. package/esm2015/lib/db/Enums/user-event-type-reminder-type.enum.js +0 -8
  62. package/esm2015/lib/db/Enums/user-event-type-reminder.enum.js +0 -7
  63. package/esm2015/lib/db/Enums/user-event-type-type.enum.js +0 -35
  64. package/esm2015/lib/models/notification/notification-event-types.const.js +0 -43
  65. package/esm2015/lib/models/user-event/user-event-category.enum.js +0 -11
  66. package/esm2015/lib/models/user-event/user-event-category.js +0 -6
  67. package/lib/db/Enums/user-event-type-reminder-type.enum.d.ts +0 -6
  68. package/lib/db/Enums/user-event-type-reminder.enum.d.ts +0 -5
  69. package/lib/db/Enums/user-event-type-type.enum.d.ts +0 -33
  70. package/lib/models/notification/notification-event-types.const.d.ts +0 -7
  71. package/lib/models/user-event/user-event-category.d.ts +0 -8
  72. package/lib/models/user-event/user-event-category.enum.d.ts +0 -9
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { NgModule, Inject, Injectable, EventEmitter } from '@angular/core';
2
+ import { NgModule, Injectable, Inject, EventEmitter } from '@angular/core';
3
3
  import { CommonModule } from '@angular/common';
4
4
  import has from 'lodash/has';
5
5
  import get from 'lodash/get';
@@ -9,8 +9,8 @@ import last from 'lodash/last';
9
9
  import uniqBy from 'lodash/uniqBy';
10
10
  import concat from 'lodash/concat';
11
11
  import compact from 'lodash/compact';
12
- import { __decorate, __param, __awaiter } from 'tslib';
13
- import { Type, plainToClass, Expose, Transform, Exclude, classToPlain } from 'class-transformer';
12
+ import { __decorate, __awaiter } from 'tslib';
13
+ import { Type, plainToClass, Exclude, Transform, Expose, classToPlain } from 'class-transformer';
14
14
  import * as moment from 'moment';
15
15
  import { DateRange } from 'moment-range';
16
16
  import cloneDeep$1 from 'lodash/cloneDeep';
@@ -24,10 +24,15 @@ import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource.min.j
24
24
  import * as i1$1 from '@angular/router';
25
25
  import { NavigationEnd } from '@angular/router';
26
26
  import clone from 'lodash/clone';
27
+ import jsPDF from 'jspdf';
28
+ import autoTable from 'jspdf-autotable';
27
29
  import { loadStripe } from '@stripe/stripe-js';
30
+ import * as xlsx from 'xlsx';
31
+ import * as FileSaver from 'file-saver';
28
32
 
29
33
  class TtCoreModule {
30
34
  static forRoot(environment) {
35
+ localStorage.setItem('api_uri', environment['api_uri']);
31
36
  return {
32
37
  ngModule: TtCoreModule,
33
38
  providers: [
@@ -109,6 +114,9 @@ class CollectionDictionary {
109
114
  createCollection(items = []) {
110
115
  return new this.collectionConstructor(items);
111
116
  }
117
+ length() {
118
+ return this.keys.length;
119
+ }
112
120
  /**
113
121
  * Group collection items by passed path into items object
114
122
  */
@@ -134,6 +142,7 @@ class CollectionDictionary {
134
142
  }
135
143
  }
136
144
 
145
+ const DEFAULT_INDEX = 'other';
137
146
  /**
138
147
  * collection abstract class. Contains common properties and methods for all collections
139
148
  */
@@ -141,8 +150,22 @@ class AbstractCollection {
141
150
  constructor(items = []) {
142
151
  this.items = items;
143
152
  }
144
- groupBy(prop) {
145
- return new CollectionDictionary(this, prop);
153
+ create(items = []) {
154
+ return new this.constructor(items);
155
+ }
156
+ getBy(field, value) {
157
+ return this.create(this.items.filter((item) => item[field] === value));
158
+ }
159
+ groupBy(path = '') {
160
+ return new CollectionDictionary(this, path);
161
+ }
162
+ indexBy(path) {
163
+ // Create empty initial object for groups
164
+ const result = {};
165
+ this.toArray().forEach((model) => {
166
+ result[get(model, path, DEFAULT_INDEX)] = model;
167
+ });
168
+ return result;
146
169
  }
147
170
  /**
148
171
  * Iterator that allow to iterate collection items
@@ -1347,117 +1370,12 @@ class TransactionCollection extends AbstractCollection {
1347
1370
  }
1348
1371
  }
1349
1372
 
1350
- class UserEventSetting$1 {
1351
- }
1352
-
1353
- class UserEventType$1 {
1354
- }
1355
-
1356
- /**
1357
- * Category of user event type
1358
- */
1359
- class UserEventCategory {
1360
- }
1361
-
1362
- /**
1363
- * Enum with user event categories
1364
- */
1365
- var UserEventCategoryEnum;
1366
- (function (UserEventCategoryEnum) {
1367
- UserEventCategoryEnum[UserEventCategoryEnum["USER"] = 1] = "USER";
1368
- UserEventCategoryEnum[UserEventCategoryEnum["CO_OWNER"] = 2] = "CO_OWNER";
1369
- UserEventCategoryEnum[UserEventCategoryEnum["FIRM"] = 3] = "FIRM";
1370
- UserEventCategoryEnum[UserEventCategoryEnum["BASIQ"] = 4] = "BASIQ";
1371
- })(UserEventCategoryEnum || (UserEventCategoryEnum = {}));
1372
-
1373
- class UserEventType extends UserEventType$1 {
1374
- }
1375
- __decorate([
1376
- Expose({ toClassOnly: true }),
1377
- Transform(({ obj }) => {
1378
- switch (true) {
1379
- case String(obj.type).startsWith('1'):
1380
- return plainToClass(UserEventCategory, { name: 'User\'s events', type: UserEventCategoryEnum.USER });
1381
- case String(obj.type).startsWith('2'):
1382
- return plainToClass(UserEventCategory, { name: 'Co-owner\'s events', type: UserEventCategoryEnum.CO_OWNER });
1383
- case String(obj.type).startsWith('3'):
1384
- return plainToClass(UserEventCategory, { name: 'Firm\'s events', type: UserEventCategoryEnum.FIRM });
1385
- default:
1386
- return plainToClass(UserEventCategory, { name: 'Basiq events', type: UserEventCategoryEnum.BASIQ });
1387
- }
1388
- }),
1389
- Type(() => UserEventCategory)
1390
- ], UserEventType.prototype, "category", void 0);
1391
-
1392
- class UserEventSetting extends UserEventSetting$1 {
1393
- constructor() {
1394
- super(...arguments);
1395
- // flag indicates that the setting is updating now saved or not
1396
- this.isUpdating = false;
1397
- }
1398
- }
1399
- __decorate([
1400
- Type(() => UserEventType)
1401
- ], UserEventSetting.prototype, "userEventType", void 0);
1402
- __decorate([
1403
- Exclude({ toPlainOnly: true })
1404
- ], UserEventSetting.prototype, "isUpdating", void 0);
1405
-
1406
1373
  /**
1407
1374
  * Collection of user event settings
1408
1375
  */
1409
1376
  class UserEventSettingCollection extends AbstractCollection {
1410
- constructor(items, userEventTypes) {
1411
- super(items);
1412
- this.setItems(userEventTypes);
1413
- }
1414
- /**
1415
- * Flag that indicates if all settings are selected for provided field
1416
- */
1417
- isAllSelected(field) {
1418
- return !this.items.find((item) => !item[field]);
1419
- }
1420
- /**
1421
- * Flag that indicates if all settings are deselected for provided field
1422
- */
1423
- isAllDeselected(field) {
1424
- return !this.items.find((item) => item[field]);
1425
- }
1426
- /**
1427
- * Check is any setting is updating by 'isUpdating' flag
1428
- */
1429
- isAnyUpdating() {
1430
- return this.items.some((item) => item.isUpdating);
1431
- }
1432
- /**
1433
- * Get frequency type based on each collection item 'frequency' field value
1434
- */
1435
- get commonFrequencyType() {
1436
- const frequencyDictionary = new CollectionDictionary(this, '', 'frequency');
1437
- return +Object.keys(frequencyDictionary).find((key) => frequencyDictionary[key].length === this.length) || false;
1438
- }
1439
- /**
1440
- * Rewrite collection items with provided user event types
1441
- */
1442
- setItems(userEventTypes) {
1443
- if (!userEventTypes) {
1444
- return;
1445
- }
1446
- this.items = userEventTypes.map((userEventType) => {
1447
- // find existing setting by user event type id
1448
- const existingSetting = this.items.find((setting) => setting.userEventType.id === userEventType.id);
1449
- // if setting exist - return new UserEventSetting instance based on existing setting and default user event type
1450
- if (existingSetting) {
1451
- return plainToClass(UserEventSetting, Object.assign(existingSetting, { userEventType }));
1452
- }
1453
- // ...or return new UserEventSetting instance based on default user event type
1454
- return plainToClass(UserEventSetting, {
1455
- byEmail: userEventType.byEmail,
1456
- byNotification: userEventType.byNotification,
1457
- frequency: userEventType.frequency,
1458
- userEventType
1459
- });
1460
- });
1377
+ getConfigurableBy(field) {
1378
+ return new UserEventSettingCollection(this.items.filter((setting) => setting[field] !== null));
1461
1379
  }
1462
1380
  }
1463
1381
 
@@ -2057,65 +1975,68 @@ var UserEventStatusEnum;
2057
1975
  UserEventStatusEnum[UserEventStatusEnum["NEED_ACTION"] = 2] = "NEED_ACTION";
2058
1976
  UserEventStatusEnum[UserEventStatusEnum["DONE"] = 3] = "DONE";
2059
1977
  UserEventStatusEnum[UserEventStatusEnum["REFUSED"] = 4] = "REFUSED";
1978
+ UserEventStatusEnum[UserEventStatusEnum["OUTDATED"] = 5] = "OUTDATED";
2060
1979
  })(UserEventStatusEnum || (UserEventStatusEnum = {}));
2061
1980
 
2062
1981
  var UserEventTypeFrequencyEnum;
2063
1982
  (function (UserEventTypeFrequencyEnum) {
2064
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["ONCE"] = 1] = "ONCE";
2065
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["DAILY"] = 2] = "DAILY";
2066
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["WEEKLY"] = 3] = "WEEKLY";
2067
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["MONTHLY"] = 4] = "MONTHLY";
1983
+ UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["DAILY"] = 1] = "DAILY";
1984
+ UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["WEEKLY"] = 2] = "WEEKLY";
1985
+ UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["MONTHLY"] = 3] = "MONTHLY";
2068
1986
  })(UserEventTypeFrequencyEnum || (UserEventTypeFrequencyEnum = {}));
2069
1987
 
2070
- var UserEventTypeReminderEnum;
2071
- (function (UserEventTypeReminderEnum) {
2072
- UserEventTypeReminderEnum[UserEventTypeReminderEnum["ONCE"] = 1] = "ONCE";
2073
- UserEventTypeReminderEnum[UserEventTypeReminderEnum["TWICE"] = 2] = "TWICE";
2074
- UserEventTypeReminderEnum[UserEventTypeReminderEnum["EVERY_DAY"] = 3] = "EVERY_DAY";
2075
- })(UserEventTypeReminderEnum || (UserEventTypeReminderEnum = {}));
2076
-
2077
- var UserEventTypeReminderTypeEnum;
2078
- (function (UserEventTypeReminderTypeEnum) {
2079
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["NEVER"] = 0] = "NEVER";
2080
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["ONCE"] = 1] = "ONCE";
2081
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["TWICE"] = 2] = "TWICE";
2082
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["EVERY_DAY"] = 3] = "EVERY_DAY";
2083
- })(UserEventTypeReminderTypeEnum || (UserEventTypeReminderTypeEnum = {}));
2084
-
2085
- var UserEventTypeTypeEnum;
2086
- (function (UserEventTypeTypeEnum) {
2087
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_INVITE"] = 101] = "USER_INVITE";
2088
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_CONFIRMATION"] = 102] = "USER_CONFIRMATION";
2089
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_RESET_PASSWORD"] = 103] = "USER_RESET_PASSWORD";
2090
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_SUBSCRIBED"] = 104] = "USER_SUBSCRIBED";
2091
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_UPGRADE_SUBSCRIPTION"] = 105] = "USER_UPGRADE_SUBSCRIPTION";
2092
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_DOWNGRADE_SUBSCRIPTION"] = 106] = "USER_DOWNGRADE_SUBSCRIPTION";
2093
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_CANCEL_SUBSCRIPTION"] = 107] = "USER_CANCEL_SUBSCRIPTION";
2094
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_INVITE_SEND"] = 201] = "CO_OWNER_INVITE_SEND";
2095
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_INVITE_ACCEPT"] = 202] = "CO_OWNER_INVITE_ACCEPT";
2096
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_INVITE_REJECT"] = 203] = "CO_OWNER_INVITE_REJECT";
2097
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_REGISTER"] = 204] = "CO_OWNER_REGISTER";
2098
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_CHANGES_OFFER"] = 210] = "CO_OWNER_CHANGES_OFFER";
2099
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_CHANGES_ACCEPT"] = 211] = "CO_OWNER_CHANGES_ACCEPT";
2100
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_CHANGES_REJECT"] = 212] = "CO_OWNER_CHANGES_REJECT";
2101
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_JOIN"] = 301] = "CLIENT_INVITE_TO_JOIN";
2102
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_JOIN_ACCEPTED"] = 302] = "CLIENT_INVITE_TO_JOIN_ACCEPTED";
2103
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_JOIN_REJECTED"] = 303] = "CLIENT_INVITE_TO_JOIN_REJECTED";
2104
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 304] = "CLIENT_INVITE_TO_REGISTER";
2105
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_LEFT_FIRM"] = 305] = "CLIENT_LEFT_FIRM";
2106
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_JOIN"] = 320] = "EMPLOYEE_INVITE_TO_JOIN";
2107
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_JOIN_ACCEPTED"] = 321] = "EMPLOYEE_INVITE_TO_JOIN_ACCEPTED";
2108
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_JOIN_REJECTED"] = 322] = "EMPLOYEE_INVITE_TO_JOIN_REJECTED";
2109
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_REGISTER"] = 325] = "EMPLOYEE_INVITE_TO_REGISTER";
2110
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED"] = 326] = "EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED";
2111
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 330] = "EMPLOYEE_LOST_CLIENT";
2112
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_RECEIVED_CLIENT"] = 331] = "EMPLOYEE_RECEIVED_CLIENT";
2113
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 340] = "FIRM_INVITE_TO_REGISTER";
2114
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER_ACCEPTED"] = 341] = "FIRM_INVITE_TO_REGISTER_ACCEPTED";
2115
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_NEW_ACCOUNTS"] = 501] = "BASIQ_NEW_ACCOUNTS";
2116
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 502] = "BASIQ_FIRST_IMPORT_COMPLETE";
2117
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 503] = "BASIQ_AUTHORIZATION_FAIL";
2118
- })(UserEventTypeTypeEnum || (UserEventTypeTypeEnum = {}));
1988
+ var UserEventTypeUserTypeEnum;
1989
+ (function (UserEventTypeUserTypeEnum) {
1990
+ UserEventTypeUserTypeEnum[UserEventTypeUserTypeEnum["REGISTERED"] = 1000] = "REGISTERED";
1991
+ UserEventTypeUserTypeEnum[UserEventTypeUserTypeEnum["PASSWORD_RESET"] = 1001] = "PASSWORD_RESET";
1992
+ UserEventTypeUserTypeEnum[UserEventTypeUserTypeEnum["APP_FEATURES"] = 1010] = "APP_FEATURES";
1993
+ })(UserEventTypeUserTypeEnum || (UserEventTypeUserTypeEnum = {}));
1994
+
1995
+ var UserEventTypeEmployeeTypeEnum;
1996
+ (function (UserEventTypeEmployeeTypeEnum) {
1997
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 3000] = "FIRM_INVITE_TO_REGISTER";
1998
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_INVITE"] = 3001] = "FIRM_INVITE";
1999
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["CLIENT_INVITE_ACCEPTED"] = 3002] = "CLIENT_INVITE_ACCEPTED";
2000
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["CLIENT_INVITE_REJECTED"] = 3003] = "CLIENT_INVITE_REJECTED";
2001
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["CLIENT_INVITE_REGISTERED"] = 3004] = "CLIENT_INVITE_REGISTERED";
2002
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_NEW_CLIENT"] = 3005] = "FIRM_NEW_CLIENT";
2003
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_LOST_CLIENT"] = 3006] = "FIRM_LOST_CLIENT";
2004
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_INVITE"] = 3010] = "EMPLOYEE_INVITE";
2005
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 3011] = "EMPLOYEE_LOST_CLIENT";
2006
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_NEW_CLIENT"] = 3012] = "EMPLOYEE_NEW_CLIENT";
2007
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_INVITE_ACCEPTED"] = 3013] = "EMPLOYEE_INVITE_ACCEPTED";
2008
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMAIL_CONFIRMED"] = 3020] = "EMAIL_CONFIRMED";
2009
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["TAX_REVIEW_REQUESTED"] = 3030] = "TAX_REVIEW_REQUESTED";
2010
+ })(UserEventTypeEmployeeTypeEnum || (UserEventTypeEmployeeTypeEnum = {}));
2011
+
2012
+ var UserEventTypeClientTypeEnum;
2013
+ (function (UserEventTypeClientTypeEnum) {
2014
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIBED"] = 2000] = "SUBSCRIBED";
2015
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["UNSUBSCRIBED"] = 2001] = "UNSUBSCRIBED";
2016
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIPTION_UPDATE"] = 2004] = "SUBSCRIPTION_UPDATE";
2017
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIPTION_TRIAL_UPDATE"] = 2005] = "SUBSCRIPTION_TRIAL_UPDATE";
2018
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CLIENT_INVITE"] = 2010] = "CLIENT_INVITE";
2019
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 2011] = "CLIENT_INVITE_TO_REGISTER";
2020
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
2021
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
2022
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
2023
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE"] = 2020] = "CO_OWNER_INVITE";
2024
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_TO_REGISTER"] = 2021] = "CO_OWNER_INVITE_TO_REGISTER";
2025
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_ACCEPTED"] = 2022] = "CO_OWNER_INVITE_ACCEPTED";
2026
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_REJECTED"] = 2023] = "CO_OWNER_INVITE_REJECTED";
2027
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_REGISTERED"] = 2024] = "CO_OWNER_INVITE_REGISTERED";
2028
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_CHANGE_REQUESTED"] = 2025] = "CO_OWNER_CHANGE_REQUESTED";
2029
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_CHANGE_ACCEPTED"] = 2026] = "CO_OWNER_CHANGE_ACCEPTED";
2030
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_CHANGE_REJECTED"] = 2027] = "CO_OWNER_CHANGE_REJECTED";
2031
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
2032
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
2033
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
2034
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["TRANSACTION_ALLOCATE_REMINDER"] = 2033] = "TRANSACTION_ALLOCATE_REMINDER";
2035
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["REGISTRATION_INVITE"] = 2040] = "REGISTRATION_INVITE";
2036
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["REGISTRATION_INVITE_ACCEPTED"] = 2041] = "REGISTRATION_INVITE_ACCEPTED";
2037
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["EMAIL_CONFIRMED"] = 2050] = "EMAIL_CONFIRMED";
2038
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["TAX_REVIEW_REQUESTED"] = 2060] = "TAX_REVIEW_REQUESTED";
2039
+ })(UserEventTypeClientTypeEnum || (UserEventTypeClientTypeEnum = {}));
2119
2040
 
2120
2041
  var UserMedicareExemptionEnum;
2121
2042
  (function (UserMedicareExemptionEnum) {
@@ -2224,11 +2145,7 @@ __decorate([
2224
2145
  class Bank$1 {
2225
2146
  }
2226
2147
 
2227
- let Bank = class Bank extends Bank$1 {
2228
- constructor(environment) {
2229
- super();
2230
- this.environment = environment;
2231
- }
2148
+ class Bank extends Bank$1 {
2232
2149
  getInitials() {
2233
2150
  return this.name[0] + this.name[1];
2234
2151
  }
@@ -2236,12 +2153,9 @@ let Bank = class Bank extends Bank$1 {
2236
2153
  if (!this.logo) {
2237
2154
  return null;
2238
2155
  }
2239
- return this.logo.includes('http') ? `${this.logo}` : `${this.environment.api_uri}/${this.logo}`;
2156
+ return this.logo.includes('http') ? `${this.logo}` : `${localStorage.getItem('api_uri')}/${this.logo}`;
2240
2157
  }
2241
- };
2242
- Bank = __decorate([
2243
- __param(0, Inject('environment'))
2244
- ], Bank);
2158
+ }
2245
2159
 
2246
2160
  class BankAccount$1 {
2247
2161
  }
@@ -2966,6 +2880,12 @@ class BasiqJob extends BasiqJob$1 {
2966
2880
  }
2967
2881
 
2968
2882
  class BankConnection extends BankConnection$1 {
2883
+ /**
2884
+ * Check if status of connection is inactive (invalid)
2885
+ */
2886
+ isInactive() {
2887
+ return this.status === BankConnectionStatusEnum.INVALID;
2888
+ }
2969
2889
  }
2970
2890
  __decorate([
2971
2891
  Type(() => BasiqJob)
@@ -4326,6 +4246,59 @@ class ClientPortfolioChartData {
4326
4246
  class ClientPortfolioReport {
4327
4247
  }
4328
4248
 
4249
+ /**
4250
+ * Class to generate data-table structure based on provided collection.
4251
+ * Use to work with HTML/PDF/XLSX tables
4252
+ */
4253
+ class DataTable {
4254
+ constructor(collection, columns, caption, footerCaption) {
4255
+ this.caption = caption;
4256
+ this.columns = columns;
4257
+ this.setRows(collection);
4258
+ if (footerCaption) {
4259
+ this.setFooterRow(collection, footerCaption);
4260
+ }
4261
+ }
4262
+ setRows(collection) {
4263
+ this.rows = collection.items.map((item) => {
4264
+ // parse table columns to return items based on column properties
4265
+ return this.columns.map((column) => {
4266
+ // if the pipe is provided - transform the return value
4267
+ if (column.pipe) {
4268
+ return column.pipe.transform(item[column.key]);
4269
+ }
4270
+ return (item[column.key] ? item[column.key] : '-').toString();
4271
+ });
4272
+ });
4273
+ }
4274
+ setFooterRow(collection, footerCaption) {
4275
+ this.footerRow = this.columns.map((column, index) => {
4276
+ if (index === 0) {
4277
+ return footerCaption.toString();
4278
+ }
4279
+ if (!column.total) {
4280
+ return '';
4281
+ }
4282
+ return collection.items
4283
+ .reduce((sum, item) => sum + Number(item[column.key]), 0)
4284
+ .toString();
4285
+ });
4286
+ }
4287
+ }
4288
+
4289
+ class DataTableColumn {
4290
+ constructor(name, key, total, pipe) {
4291
+ /**
4292
+ * Flag that shows should the column be in the total calculation or not
4293
+ */
4294
+ this.total = false;
4295
+ this.name = name;
4296
+ this.key = key;
4297
+ this.total = total;
4298
+ this.pipe = pipe;
4299
+ }
4300
+ }
4301
+
4329
4302
  var DepreciationGroupEnum;
4330
4303
  (function (DepreciationGroupEnum) {
4331
4304
  DepreciationGroupEnum[DepreciationGroupEnum["BUILDING_IMPROVEMENTS"] = 0] = "BUILDING_IMPROVEMENTS";
@@ -4860,75 +4833,9 @@ class VehicleClaim extends VehicleClaim$1 {
4860
4833
  class ServiceNotification {
4861
4834
  }
4862
4835
 
4863
- /**
4864
- * Notification events grouped by types
4865
- */
4866
- const NOTIFICATION_EVENT_TYPES = {
4867
- // events from employees to clients
4868
- employeeInvite: [
4869
- UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED,
4870
- UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN_ACCEPTED,
4871
- UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN_REJECTED,
4872
- UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_REGISTER,
4873
- UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN,
4874
- ],
4875
- // events from clients to employee
4876
- employeeInviteFromClient: [
4877
- UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN,
4878
- ],
4879
- bankConnection: [
4880
- UserEventTypeTypeEnum.BASIQ_NEW_ACCOUNTS,
4881
- UserEventTypeTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE,
4882
- UserEventTypeTypeEnum.BASIQ_AUTHORIZATION_FAIL
4883
- ],
4884
- clientInvite: [
4885
- UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN_ACCEPTED,
4886
- UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN_REJECTED,
4887
- UserEventTypeTypeEnum.CLIENT_INVITE_TO_REGISTER
4888
- ],
4889
- clientMovement: [
4890
- UserEventTypeTypeEnum.CLIENT_LEFT_FIRM,
4891
- UserEventTypeTypeEnum.EMPLOYEE_LOST_CLIENT,
4892
- UserEventTypeTypeEnum.EMPLOYEE_RECEIVED_CLIENT
4893
- ],
4894
- propertyOwner: [
4895
- UserEventTypeTypeEnum.CO_OWNER_INVITE_SEND,
4896
- UserEventTypeTypeEnum.CO_OWNER_INVITE_ACCEPT,
4897
- UserEventTypeTypeEnum.CO_OWNER_INVITE_REJECT,
4898
- UserEventTypeTypeEnum.CO_OWNER_REGISTER,
4899
- UserEventTypeTypeEnum.CO_OWNER_CHANGES_OFFER,
4900
- UserEventTypeTypeEnum.CO_OWNER_CHANGES_ACCEPT,
4901
- UserEventTypeTypeEnum.CO_OWNER_CHANGES_REJECT
4902
- ]
4903
- };
4904
-
4905
4836
  class Notification extends ServiceNotification {
4906
4837
  get eventType() {
4907
- return this.userEvent.userEventType.type;
4908
- }
4909
- /**
4910
- * Set redirection link based on current event type
4911
- */
4912
- setRedirectionLink() {
4913
- switch (true) {
4914
- case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(this.eventType):
4915
- this.redirectionLink = '/client/users/firms';
4916
- break;
4917
- case NOTIFICATION_EVENT_TYPES.bankConnection.includes(this.eventType):
4918
- this.redirectionLink = '/client/bank-feeds';
4919
- break;
4920
- case NOTIFICATION_EVENT_TYPES.clientInvite.includes(this.eventType):
4921
- this.redirectionLink = '/client/users/invitations';
4922
- break;
4923
- case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(this.eventType):
4924
- this.redirectionLink = '/client/users/co-owners';
4925
- break;
4926
- case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(this.eventType):
4927
- this.redirectionLink = '/firm/clients/invites';
4928
- break;
4929
- default:
4930
- this.redirectionLink = '';
4931
- }
4838
+ return this.userEvent.type.type;
4932
4839
  }
4933
4840
  /**
4934
4841
  * Check if notification is from user or not
@@ -4944,16 +4851,17 @@ __decorate([
4944
4851
  Expose({ toClassOnly: true }),
4945
4852
  Transform(({ obj }) => {
4946
4853
  switch (true) {
4947
- case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(obj.eventType):
4948
- return '/client/users/firms';
4949
- case NOTIFICATION_EVENT_TYPES.bankConnection.includes(obj.eventType):
4950
- return '/client/bank-feeds';
4951
- case NOTIFICATION_EVENT_TYPES.clientInvite.includes(obj.eventType):
4952
- return '/client/users/invitations';
4953
- case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(obj.eventType):
4954
- return '/client/users/co-owners';
4955
- case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(obj.eventType):
4956
- return '/firm/clients/invites';
4854
+ // @TODO vik
4855
+ // case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(obj.eventType):
4856
+ // return '/client/users/firms';
4857
+ // case NOTIFICATION_EVENT_TYPES.bankConnection.includes(obj.eventType):
4858
+ // return '/client/bank-feeds';
4859
+ // case NOTIFICATION_EVENT_TYPES.clientInvite.includes(obj.eventType):
4860
+ // return '/client/users/invitations';
4861
+ // case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(obj.eventType):
4862
+ // return '/client/users/co-owners';
4863
+ // case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(obj.eventType):
4864
+ // return '/firm/clients/invites';
4957
4865
  default:
4958
4866
  return '';
4959
4867
  }
@@ -5572,6 +5480,46 @@ const USER_ROLES = {
5572
5480
  class UserToRegister {
5573
5481
  }
5574
5482
 
5483
+ class UserEventTypeCategory$1 {
5484
+ }
5485
+
5486
+ class UserEventTypeCategory extends UserEventTypeCategory$1 {
5487
+ }
5488
+
5489
+ class UserEventSetting$1 {
5490
+ }
5491
+
5492
+ class UserEventType$1 {
5493
+ }
5494
+
5495
+ class UserEventType extends UserEventType$1 {
5496
+ toSetting() {
5497
+ return plainToClass(UserEventSetting, {
5498
+ byEmail: this.byEmail,
5499
+ byNotification: this.byNotification,
5500
+ frequency: this.frequency,
5501
+ type: this
5502
+ });
5503
+ }
5504
+ }
5505
+ __decorate([
5506
+ Type(() => UserEventTypeCategory)
5507
+ ], UserEventType.prototype, "category", void 0);
5508
+
5509
+ class UserEventSetting extends UserEventSetting$1 {
5510
+ constructor() {
5511
+ super(...arguments);
5512
+ // flag indicates that the setting is updating now saved or not
5513
+ this.isUpdating = false;
5514
+ }
5515
+ }
5516
+ __decorate([
5517
+ Type(() => UserEventType)
5518
+ ], UserEventSetting.prototype, "type", void 0);
5519
+ __decorate([
5520
+ Exclude({ toPlainOnly: true })
5521
+ ], UserEventSetting.prototype, "isUpdating", void 0);
5522
+
5575
5523
  /**
5576
5524
  * Enum with user event setting fields
5577
5525
  */
@@ -6056,7 +6004,7 @@ class BankAccountService extends BaseRestService {
6056
6004
  * Listen system notifications and update cache when got basiq notification received
6057
6005
  */
6058
6006
  listenEvents() {
6059
- this.listenToPropertyOwnerUpdated();
6007
+ this.listenToEventDispatcherChanges();
6060
6008
  }
6061
6009
  /**
6062
6010
  * Created manual bank account
@@ -6111,10 +6059,14 @@ class BankAccountService extends BaseRestService {
6111
6059
  }));
6112
6060
  }
6113
6061
  /**
6114
- * Listen to EventDispatcherService event related to updated Property Owner Updated
6062
+ * Listen to EventDispatcherService events
6115
6063
  */
6116
- listenToPropertyOwnerUpdated() {
6117
- this.eventDispatcherService.on([AppEventTypeEnum.PROPERTY_OWNER_UPDATED, AppEventTypeEnum.LOAN_PAYOUT_UPDATED]).subscribe(() => {
6064
+ listenToEventDispatcherChanges() {
6065
+ this.eventDispatcherService.on([
6066
+ AppEventTypeEnum.PROPERTY_OWNER_UPDATED,
6067
+ AppEventTypeEnum.LOAN_PAYOUT_UPDATED,
6068
+ AppEventTypeEnum.BANK_CONNECTION_ADDED
6069
+ ]).subscribe(() => {
6118
6070
  this.fetch().subscribe((bankAccounts) => {
6119
6071
  this.cache = bankAccounts;
6120
6072
  this.updateCache();
@@ -6316,7 +6268,7 @@ class BankTransactionService extends BaseRestService {
6316
6268
  }
6317
6269
  listenBankTransactionsImport() {
6318
6270
  this.eventDispatcherService.on(AppEventTypeEnum.NOTIFICATION_ADDED).subscribe((notification) => {
6319
- if (!notification.isRead && notification.eventType === UserEventTypeTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE) {
6271
+ if (!notification.isRead && notification.eventType === UserEventTypeClientTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE) {
6320
6272
  this.resetCache();
6321
6273
  }
6322
6274
  });
@@ -6398,7 +6350,7 @@ class BasiqService extends BaseRestService {
6398
6350
  */
6399
6351
  listenNotifications() {
6400
6352
  this.eventDispatcherService.on(AppEventTypeEnum.NOTIFICATION_ADDED).subscribe((notification) => {
6401
- if (!notification.isRead && notification.eventType === UserEventTypeTypeEnum.BASIQ_NEW_ACCOUNTS) {
6353
+ if (!notification.isRead && notification.eventType === UserEventTypeClientTypeEnum.BASIQ_NEW_ACCOUNTS) {
6402
6354
  this.resetCache();
6403
6355
  this.get().subscribe();
6404
6356
  }
@@ -7421,14 +7373,14 @@ class FirmService {
7421
7373
  register(data) {
7422
7374
  return this.http.post(`${this.environment.apiV2}/firms/registration`, data)
7423
7375
  .pipe(map((firm) => {
7424
- return plainToClass(Firm$1, firm);
7376
+ return plainToClass(Firm, firm);
7425
7377
  }));
7426
7378
  }
7427
7379
  get() {
7428
7380
  if (!this.firm) {
7429
7381
  this.http.get(`${this.environment.apiV2}/firms/current`)
7430
7382
  .pipe(map((firm) => {
7431
- return plainToClass(Firm$1, firm);
7383
+ return plainToClass(Firm, firm);
7432
7384
  }))
7433
7385
  .subscribe((firm) => {
7434
7386
  this.firm = firm;
@@ -7440,7 +7392,7 @@ class FirmService {
7440
7392
  update(firm) {
7441
7393
  return this.http.put(`${this.environment.apiV2}/firms/current`, firm)
7442
7394
  .pipe(map((updatedItem) => {
7443
- const updatedInstance = plainToClass(Firm$1, updatedItem);
7395
+ const updatedInstance = plainToClass(Firm, updatedItem);
7444
7396
  this.firmSubject.next(updatedInstance);
7445
7397
  }));
7446
7398
  }
@@ -7450,7 +7402,7 @@ class FirmService {
7450
7402
  getAll() {
7451
7403
  return this.http.get(`${this.environment.apiV2}/firms`)
7452
7404
  .pipe(map((response) => {
7453
- return response['hydra:member'].map((firmBase) => plainToClass(Firm$1, firmBase));
7405
+ return response['hydra:member'].map((firmBase) => plainToClass(Firm, firmBase));
7454
7406
  }));
7455
7407
  }
7456
7408
  getByType(type) {
@@ -7461,7 +7413,7 @@ class FirmService {
7461
7413
  updatePhoto(firm, photo) {
7462
7414
  return this.http.post(`${this.environment.apiV2}/firms/photo?_method=PUT`, photo)
7463
7415
  .pipe(map((firmPhoto) => {
7464
- this.firm = plainToClass(Firm$1, Object.assign(firm, { photo: firmPhoto }));
7416
+ this.firm = plainToClass(Firm, Object.assign(firm, { photo: firmPhoto }));
7465
7417
  this.firmSubject.next(this.firm);
7466
7418
  return firm;
7467
7419
  }));
@@ -7980,6 +7932,80 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
7980
7932
  args: ['environment']
7981
7933
  }] }, { type: SseService }]; } });
7982
7934
 
7935
+ /**
7936
+ * Configuration file with the settings to generate PDF file
7937
+ */
7938
+ const PDF_CONFIG = {
7939
+ text: {
7940
+ fontSize: 18,
7941
+ fontName: 'helvetica',
7942
+ fontStyle: '',
7943
+ fontWeight: 'bold',
7944
+ positionX: 14,
7945
+ positionY: 10,
7946
+ fillColor: 255,
7947
+ textColor: 0
7948
+ },
7949
+ // coords for file section title (group, table, e.t.c.)
7950
+ contentTitleCoords: {
7951
+ marginTop: 20
7952
+ },
7953
+ contentCoords: {
7954
+ marginTop: 15,
7955
+ marginLeft: 14
7956
+ }
7957
+ };
7958
+
7959
+ /**
7960
+ * Service to work with PDF (generate, download, e.t.c.)
7961
+ */
7962
+ class PdfService {
7963
+ // @Todo remove 'any' type
7964
+ /**
7965
+ * Download generated PDF file
7966
+ */
7967
+ download(tables, title, fileName) {
7968
+ const document = this.generatePdfFile(tables, title);
7969
+ document.save(`${fileName}.pdf`);
7970
+ }
7971
+ /**
7972
+ * Generate PDF file from provided data
7973
+ */
7974
+ generatePdfFile(tables, title) {
7975
+ const pdf = new jsPDF();
7976
+ // set document title
7977
+ pdf.setFontSize(PDF_CONFIG.text.fontSize);
7978
+ pdf.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight);
7979
+ pdf.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
7980
+ tables.forEach((table) => {
7981
+ // coords of last table
7982
+ const lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
7983
+ pdf.text(table.caption, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
7984
+ // table options
7985
+ const options = {
7986
+ startY: lastTableCoords + PDF_CONFIG.contentTitleCoords.marginTop,
7987
+ head: [table['columns'].map((column) => column.name)],
7988
+ body: table['rows'],
7989
+ foot: [table['footerRow']],
7990
+ footStyles: {
7991
+ fillColor: PDF_CONFIG.text.fillColor,
7992
+ textColor: PDF_CONFIG.text.textColor
7993
+ }
7994
+ };
7995
+ autoTable(pdf, options);
7996
+ });
7997
+ return pdf;
7998
+ }
7999
+ }
8000
+ PdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
8001
+ PdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, providedIn: 'root' });
8002
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, decorators: [{
8003
+ type: Injectable,
8004
+ args: [{
8005
+ providedIn: 'root'
8006
+ }]
8007
+ }] });
8008
+
7983
8009
  class PreloaderService {
7984
8010
  constructor() {
7985
8011
  this.activePreloaders = new BehaviorSubject([]);
@@ -9695,6 +9721,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
9695
9721
  args: ['environment']
9696
9722
  }] }]; } });
9697
9723
 
9724
+ /**
9725
+ * Service to work with XLSX (generate, download, e.t.c.)
9726
+ */
9727
+ class XlsxService {
9728
+ // @Todo remove 'any' type
9729
+ /**s
9730
+ * Download generated Excel file
9731
+ */
9732
+ download(tables, title, fileName) {
9733
+ const excelFile = this.generateFile(tables, title);
9734
+ const data = new Blob([excelFile], {
9735
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'
9736
+ });
9737
+ FileSaver.saveAs(data, `${fileName}.xlsx`);
9738
+ }
9739
+ generateFile(tables, title) {
9740
+ // create new workbook
9741
+ const workbook = xlsx.utils.book_new();
9742
+ // create empty worksheet
9743
+ const worksheet = {
9744
+ SheetNames: [],
9745
+ Sheets: {}
9746
+ };
9747
+ const sheetData = tables.map((table) => {
9748
+ // add caption, columns, rows and footer rows
9749
+ return [
9750
+ [table.caption],
9751
+ table.columns.map((column) => column.name),
9752
+ ...table.rows,
9753
+ table.footerRow,
9754
+ ];
9755
+ });
9756
+ sheetData.forEach((data) => {
9757
+ xlsx.utils.sheet_add_json(worksheet, data, { origin: -1, skipHeader: true });
9758
+ // set empty row after each table
9759
+ xlsx.utils.sheet_add_json(worksheet, [], { origin: -1 });
9760
+ });
9761
+ xlsx.utils.book_append_sheet(workbook, worksheet);
9762
+ return xlsx.write(workbook, { bookType: 'xlsx', type: 'array' });
9763
+ }
9764
+ }
9765
+ XlsxService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: XlsxService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
9766
+ XlsxService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: XlsxService, providedIn: 'root' });
9767
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: XlsxService, decorators: [{
9768
+ type: Injectable,
9769
+ args: [{
9770
+ providedIn: 'root'
9771
+ }]
9772
+ }] });
9773
+
9698
9774
  // deep clone for entity
9699
9775
  function cloneDeep(array) {
9700
9776
  return JSON.parse(JSON.stringify(array));
@@ -9773,5 +9849,5 @@ function taxReviewFilterPredicate(data, filter) {
9773
9849
  * Generated bundle index. Do not edit.
9774
9850
  */
9775
9851
 
9776
- export { AbstractCollection, Address, AddressService, AddressTypeEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, CapitalProjectService, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationReceipt, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EventDispatcherService, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, IntercomService, InviteStatusEnum, JwtService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookCollection, LogbookPeriod, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, NOTIFICATION_EVENT_TYPES, Notification, NotificationService, Occupation, OccupationService, OwnershipFilterOptionsEnum, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCapitalCost, PropertyCapitalCostService, PropertyCategory, PropertyCategoryMovement, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyOwner, PropertyOwnerAccessEnum, PropertyOwnerService, PropertyOwnerStatusEnum, PropertyService, PropertySold, PropertySoldService, PropertySubscription, PropertyValuation, RegistrationInvite, RegistrationInviteStatusEnum, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceTypeEnum, ServiceProduct, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxReturnCategoryItem, TaxReturnCategoryItemCollection, TaxReturnCategoryItemDetails, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventCategory, UserEventCategoryEnum, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeFrequencyEnum, UserEventTypeReminderEnum, UserEventTypeReminderTypeEnum, UserEventTypeService, UserEventTypeTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimMethodEnum, VehicleLogbook, VehicleLogbookPurposeEnum, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, WorkTankService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
9852
+ export { AbstractCollection, Address, AddressService, AddressTypeEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, CapitalProjectService, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, DataTable, DataTableColumn, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationReceipt, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EventDispatcherService, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, IntercomService, InviteStatusEnum, JwtService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookCollection, LogbookPeriod, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, Notification, NotificationService, Occupation, OccupationService, OwnershipFilterOptionsEnum, PdfService, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCapitalCost, PropertyCapitalCostService, PropertyCategory, PropertyCategoryMovement, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyOwner, PropertyOwnerAccessEnum, PropertyOwnerService, PropertyOwnerStatusEnum, PropertyService, PropertySold, PropertySoldService, PropertySubscription, PropertyValuation, RegistrationInvite, RegistrationInviteStatusEnum, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceTypeEnum, ServiceProduct, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxReturnCategoryItem, TaxReturnCategoryItemCollection, TaxReturnCategoryItemDetails, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimMethodEnum, VehicleLogbook, VehicleLogbookPurposeEnum, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, WorkTankService, XlsxService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
9777
9853
  //# sourceMappingURL=taxtank-core.js.map