taxtank-core 0.29.17 → 0.29.19

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 (65) hide show
  1. package/bundles/taxtank-core.umd.js +135 -32
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/subscription/index.js +4 -1
  4. package/esm2015/lib/collections/subscription/service-price.collection.js +7 -0
  5. package/esm2015/lib/collections/subscription/service-product.collection.js +8 -0
  6. package/esm2015/lib/collections/subscription/service-subscription.collection.js +17 -1
  7. package/esm2015/lib/collections/subscription/subscription-item.collection.js +4 -1
  8. package/esm2015/lib/models/endpoint/endpoints.const.js +3 -1
  9. package/esm2015/lib/models/index.js +2 -1
  10. package/esm2015/lib/models/service-subscription/index.js +6 -0
  11. package/esm2015/lib/models/service-subscription/service-product.js +6 -1
  12. package/esm2015/lib/models/service-subscription/service-subscription.js +12 -2
  13. package/esm2015/lib/services/http/subscription/index.js +2 -1
  14. package/esm2015/lib/services/http/subscription/service-price/service-price.service.js +8 -5
  15. package/esm2015/lib/services/http/subscription/service-product/service-product.service.js +24 -0
  16. package/esm2015/lib/services/http/subscription/service-subscription/subscription.service.js +14 -6
  17. package/fesm2015/taxtank-core.js +104 -28
  18. package/fesm2015/taxtank-core.js.map +1 -1
  19. package/lib/collections/subscription/index.d.ts +3 -0
  20. package/lib/collections/subscription/service-price.collection.d.ts +5 -0
  21. package/lib/collections/subscription/service-product.collection.d.ts +5 -0
  22. package/lib/collections/subscription/service-subscription.collection.d.ts +4 -0
  23. package/lib/collections/subscription/subscription-item.collection.d.ts +2 -1
  24. package/lib/forms/bank/bank-login.form.d.ts.map +1 -0
  25. package/lib/forms/client/client-income-types.form.d.ts.map +1 -0
  26. package/lib/forms/depreciation/depreciation.form.d.ts.map +1 -0
  27. package/lib/forms/depreciation/index.d.ts.map +1 -0
  28. package/lib/forms/form-validations.enum.d.ts.map +1 -0
  29. package/lib/forms/index.d.ts.map +1 -0
  30. package/lib/forms/login/login.form.d.ts.map +1 -0
  31. package/lib/forms/phone/index.d.ts.map +1 -0
  32. package/lib/forms/phone/phone.form.d.ts.map +1 -0
  33. package/lib/forms/property/index.d.ts.map +1 -0
  34. package/lib/forms/register/register-client.form.d.ts.map +1 -0
  35. package/lib/forms/register/register-firm.form.d.ts.map +1 -0
  36. package/lib/forms/sole/bas-report.form.d.ts.map +1 -0
  37. package/lib/forms/sole/index.d.ts.map +1 -0
  38. package/lib/forms/transaction/index.d.ts.map +1 -0
  39. package/lib/forms/transaction/messages.enum.d.ts.map +1 -0
  40. package/lib/forms/transaction/transaction-base.form.d.ts.map +1 -0
  41. package/lib/forms/transaction/transaction.form.d.ts.map +1 -0
  42. package/lib/forms/transaction/work-income.form.d.ts.map +1 -0
  43. package/lib/forms/user/index.d.ts.map +1 -0
  44. package/lib/forms/user/password.form.d.ts.map +1 -0
  45. package/lib/forms/user/reset-password.form.d.ts.map +1 -0
  46. package/lib/forms/user/user-invite.form.d.ts.map +1 -0
  47. package/lib/forms/vehicle/index.d.ts.map +1 -0
  48. package/lib/forms/vehicle/vehicle-claim-details.form.d.ts.map +1 -0
  49. package/lib/forms/vehicle/vehicle-claim.form.d.ts.map +1 -0
  50. package/lib/forms/vehicle/vehicle-logbook.form.d.ts.map +1 -0
  51. package/lib/forms/vehicle/vehicle.form.d.ts.map +1 -0
  52. package/lib/models/index.d.ts +1 -0
  53. package/lib/models/service-subscription/index.d.ts +5 -0
  54. package/lib/models/service-subscription/service-subscription.d.ts +4 -0
  55. package/lib/services/http/subscription/index.d.ts +1 -0
  56. package/lib/services/http/subscription/service-price/service-price.service.d.ts +9 -6
  57. package/lib/services/http/subscription/service-product/service-product.service.d.ts +14 -0
  58. package/lib/services/http/subscription/service-subscription/subscription.service.d.ts +3 -3
  59. package/lib/validators/at-least-one-enabled.validator.d.ts.map +1 -0
  60. package/lib/validators/date-range.validator.d.ts.map +1 -0
  61. package/lib/validators/phone-number.validator.d.ts.map +1 -0
  62. package/lib/validators/required-length.validator.d.ts.map +1 -0
  63. package/package.json +1 -1
  64. package/public-api.d.ts.map +1 -0
  65. package/taxtank-core.d.ts.map +1 -0
@@ -2418,6 +2418,11 @@
2418
2418
  };
2419
2419
  return ServiceProduct;
2420
2420
  }(ServiceProduct$1));
2421
+ // const TestEnum = {
2422
+ // 4: 4,
2423
+ // 5: 7,
2424
+ // 6: 6
2425
+ // }
2421
2426
 
2422
2427
  var ServicePrice = /** @class */ (function (_super) {
2423
2428
  __extends(ServicePrice, _super);
@@ -2476,6 +2481,13 @@
2476
2481
  enumerable: false,
2477
2482
  configurable: true
2478
2483
  });
2484
+ Object.defineProperty(ServiceSubscription.prototype, "isPaid", {
2485
+ get: function () {
2486
+ return !!this.stripeId;
2487
+ },
2488
+ enumerable: false,
2489
+ configurable: true
2490
+ });
2479
2491
  Object.defineProperty(ServiceSubscription.prototype, "price", {
2480
2492
  get: function () {
2481
2493
  return this.items.reduce(function (sum, item) { return sum + item.total; }, 0);
@@ -2488,7 +2500,8 @@
2488
2500
  * get title of subscription
2489
2501
  */
2490
2502
  get: function () {
2491
- return this.isTrial ? 'Trial period' : this.items.map(function (item) { return item.price.product.title; }).join(' + ');
2503
+ return this.items.map(function (item) { return item.price.product.title; }).join(' + ');
2504
+ // return this.isTrial ? 'Trial period' : this.items.map((item) => item.price.product.title).join(' + ');
2492
2505
  },
2493
2506
  enumerable: false,
2494
2507
  configurable: true
@@ -2541,6 +2554,13 @@
2541
2554
  enumerable: false,
2542
2555
  configurable: true
2543
2556
  });
2557
+ Object.defineProperty(ServiceSubscription.prototype, "propertyTankItem", {
2558
+ get: function () {
2559
+ return this.items.find(function (item) { return item.price.product.isProperties(); });
2560
+ },
2561
+ enumerable: false,
2562
+ configurable: true
2563
+ });
2544
2564
  ServiceSubscription.prototype.hasPropertyTank = function () {
2545
2565
  return !!this.items.find(function (subscriptionItem) {
2546
2566
  return subscriptionItem.price.product.role.includes(exports.UserRolesEnum.PROPERTY_TANK);
@@ -2571,6 +2591,9 @@
2571
2591
  ServiceSubscription.prototype.hasItem = function (itemToCheck) {
2572
2592
  return !!this.items.find(function (item) { return item.price.id === itemToCheck.price.id; });
2573
2593
  };
2594
+ ServiceSubscription.prototype.hasProduct = function (product) {
2595
+ return !!this.items.find(function (item) { return item.price.product.id === product.id; });
2596
+ };
2574
2597
  /**
2575
2598
  * Recommended number of properties to buy,
2576
2599
  * based on the property service product and the number of properties the user has
@@ -5365,6 +5388,28 @@
5365
5388
  return SoleInvoiceCollection;
5366
5389
  }(Collection));
5367
5390
 
5391
+ var ServicePriceCollection = /** @class */ (function (_super) {
5392
+ __extends(ServicePriceCollection, _super);
5393
+ function ServicePriceCollection() {
5394
+ return _super !== null && _super.apply(this, arguments) || this;
5395
+ }
5396
+ ServicePriceCollection.prototype.getActive = function () {
5397
+ return this.filterBy('isActive', true);
5398
+ };
5399
+ return ServicePriceCollection;
5400
+ }(Collection));
5401
+
5402
+ var ServiceProductCollection = /** @class */ (function (_super) {
5403
+ __extends(ServiceProductCollection, _super);
5404
+ function ServiceProductCollection() {
5405
+ return _super !== null && _super.apply(this, arguments) || this;
5406
+ }
5407
+ ServiceProductCollection.prototype.getActive = function () {
5408
+ return this.filterBy('status', exports.ServiceProductStatusEnum.ACTIVE);
5409
+ };
5410
+ return ServiceProductCollection;
5411
+ }(Collection));
5412
+
5368
5413
  var SubscriptionItemCollection = /** @class */ (function (_super) {
5369
5414
  __extends(SubscriptionItemCollection, _super);
5370
5415
  function SubscriptionItemCollection() {
@@ -5384,6 +5429,9 @@
5384
5429
  enumerable: false,
5385
5430
  configurable: true
5386
5431
  });
5432
+ SubscriptionItemCollection.prototype.hasProduct = function (product) {
5433
+ return !!this.findBy('price.product.id', product.id);
5434
+ };
5387
5435
  return SubscriptionItemCollection;
5388
5436
  }(Collection));
5389
5437
 
@@ -5413,6 +5461,22 @@
5413
5461
  ServiceSubscriptionCollection.prototype.getItems = function () {
5414
5462
  return new SubscriptionItemCollection(flatten__default["default"](this.mapBy('items')));
5415
5463
  };
5464
+ ServiceSubscriptionCollection.prototype.groupByProduct = function (products) {
5465
+ var _this = this;
5466
+ var dictionary = new Dictionary([]);
5467
+ products.toArray().forEach(function (product) {
5468
+ dictionary.add(product.id, _this.findByProduct(product));
5469
+ });
5470
+ return dictionary;
5471
+ };
5472
+ ServiceSubscriptionCollection.prototype.findByProduct = function (product) {
5473
+ return this.find(function (subscription) {
5474
+ return !!subscription.items.find(function (item) { return item.price.product.id === product.id; });
5475
+ });
5476
+ };
5477
+ ServiceSubscriptionCollection.prototype.hasPropertyTank = function () {
5478
+ return !!this.getItems().propertiesItem;
5479
+ };
5416
5480
  return ServiceSubscriptionCollection;
5417
5481
  }(Collection));
5418
5482
 
@@ -8898,6 +8962,29 @@
8898
8962
  })
8899
8963
  ], Notification.prototype, "redirectionLink", void 0);
8900
8964
 
8965
+ var ServicePayment = /** @class */ (function (_super) {
8966
+ __extends(ServicePayment, _super);
8967
+ function ServicePayment() {
8968
+ return _super !== null && _super.apply(this, arguments) || this;
8969
+ }
8970
+ /**
8971
+ * Stripe stores actual links to payment invoices for 30 days.
8972
+ * Link expires after 30 days
8973
+ */
8974
+ ServicePayment.prototype.isInvoiceLinkExpired = function () {
8975
+ var expirationDate = new Date(this.date.setDate(this.date.getDate() + ServicePayment.daysToInvoiceUrlExpired));
8976
+ return expirationDate.getTime() < new Date().getTime();
8977
+ };
8978
+ return ServicePayment;
8979
+ }(ServicePayment$1));
8980
+ ServicePayment.daysToInvoiceUrlExpired = 30;
8981
+ __decorate([
8982
+ classTransformer.Type(function () { return ServiceSubscription; })
8983
+ ], ServicePayment.prototype, "subscription", void 0);
8984
+ __decorate([
8985
+ classTransformer.Type(function () { return Date; })
8986
+ ], ServicePayment.prototype, "date", void 0);
8987
+
8901
8988
  /**
8902
8989
  * Enum with document types which used to API url prefix
8903
8990
  */
@@ -9945,7 +10032,9 @@
9945
10032
  SALARY_FORECAST_POST: new Endpoint('POST', '\\/salary-forecasts'),
9946
10033
  SALARY_FORECAST_PUT: new Endpoint('PUT', '\\/salary-forecasts'),
9947
10034
  SERVICE_PRICES_GET: new Endpoint('GET', '\\/service-prices'),
10035
+ SERVICE_PRODUCTS_GET: new Endpoint('GET', '\\/service-products'),
9948
10036
  SERVICE_PAYMENTS_GET: new Endpoint('GET', '\\/service-payments'),
10037
+ SERVICE_SUBSCRIPTIONS_GET: new Endpoint('GET', '\\/service-subscriptions'),
9949
10038
  SERVICE_PAYMENT_INVOICE_URL_GET: new Endpoint('GET', '\\/service-payments\\/\\d+\\/invoice-url'),
9950
10039
  STRIPE_BILLING_PORTAL_GET: new Endpoint('GET', '\\/stripe\\/billing-portal-session'),
9951
10040
  STRIPE_CHECKOUT_SESSION_POST: new Endpoint('POST', '\\/stripe\\/checkout-session'),
@@ -12640,29 +12729,6 @@
12640
12729
  myAccount: '/client/my-account/subscription'
12641
12730
  };
12642
12731
 
12643
- var ServicePayment = /** @class */ (function (_super) {
12644
- __extends(ServicePayment, _super);
12645
- function ServicePayment() {
12646
- return _super !== null && _super.apply(this, arguments) || this;
12647
- }
12648
- /**
12649
- * Stripe stores actual links to payment invoices for 30 days.
12650
- * Link expires after 30 days
12651
- */
12652
- ServicePayment.prototype.isInvoiceLinkExpired = function () {
12653
- var expirationDate = new Date(this.date.setDate(this.date.getDate() + ServicePayment.daysToInvoiceUrlExpired));
12654
- return expirationDate.getTime() < new Date().getTime();
12655
- };
12656
- return ServicePayment;
12657
- }(ServicePayment$1));
12658
- ServicePayment.daysToInvoiceUrlExpired = 30;
12659
- __decorate([
12660
- classTransformer.Type(function () { return ServiceSubscription; })
12661
- ], ServicePayment.prototype, "subscription", void 0);
12662
- __decorate([
12663
- classTransformer.Type(function () { return Date; })
12664
- ], ServicePayment.prototype, "date", void 0);
12665
-
12666
12732
  var TaxReview = /** @class */ (function (_super) {
12667
12733
  __extends(TaxReview, _super);
12668
12734
  function TaxReview() {
@@ -16012,13 +16078,15 @@
16012
16078
  __extends(ServicePriceService, _super);
16013
16079
  function ServicePriceService() {
16014
16080
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
16081
+ _this.endpointUri = 'service-prices';
16015
16082
  _this.modelClass = ServicePrice;
16016
- _this.url = 'service-prices';
16017
- _this.isHydra = true;
16083
+ _this.isApiPlatform = true;
16084
+ _this.collectionClass = ServicePriceCollection;
16085
+ _this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
16018
16086
  return _this;
16019
16087
  }
16020
16088
  return ServicePriceService;
16021
- }(RestService));
16089
+ }(RestService$1));
16022
16090
  ServicePriceService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ServicePriceService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
16023
16091
  ServicePriceService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ServicePriceService, providedIn: 'root' });
16024
16092
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ServicePriceService, decorators: [{
@@ -16075,10 +16143,19 @@
16075
16143
  _this.endpointUri = 'service-subscriptions';
16076
16144
  _this.modelClass = ServiceSubscription;
16077
16145
  _this.collectionClass = ServiceSubscriptionCollection;
16078
- _this.disabledMethods = ['post', 'put', 'putBatch', 'delete', 'deleteBatch'];
16146
+ _this.disabledMethods = ['putBatch', 'delete', 'deleteBatch'];
16079
16147
  _this.listenSubscriptions();
16080
16148
  return _this;
16081
16149
  }
16150
+ SubscriptionService.prototype.startTrial = function (subscription) {
16151
+ var _this = this;
16152
+ return this.http.post(this.apiUrl + "/trial", subscription)
16153
+ .pipe(operators.map(function (response) {
16154
+ var newSubscription = classTransformer.plainToClass(ServiceSubscription, response);
16155
+ _this.handleResponse([newSubscription], 'post');
16156
+ return newSubscription;
16157
+ }));
16158
+ };
16082
16159
  SubscriptionService.prototype.getActive = function () {
16083
16160
  return this.get().pipe(operators.map(function (subscriptions) { return subscriptions.getActive(); }));
16084
16161
  };
@@ -16126,16 +16203,16 @@
16126
16203
  /**
16127
16204
  * Get difference between current subscription and selected new subscription
16128
16205
  */
16129
- SubscriptionService.prototype.getProrationCost = function (items) {
16130
- return this.http.post(this.environment.apiV2 + "/service-subscriptions/proration-cost", items).pipe(operators.map(function (prorationCost) {
16206
+ SubscriptionService.prototype.getProrationCost = function (subscription) {
16207
+ return this.http.put(this.environment.apiV2 + "/service-subscriptions/" + subscription.id + "/proration-cost", subscription).pipe(operators.map(function (prorationCost) {
16131
16208
  return prorationCost;
16132
16209
  }));
16133
16210
  };
16134
16211
  /**
16135
16212
  * Change subscription plan
16136
16213
  */
16137
- SubscriptionService.prototype.changeSubscription = function (items) {
16138
- return this.http.post(this.environment.apiV2 + "/service-subscriptions/items", items);
16214
+ SubscriptionService.prototype.changeSubscription = function (subscription) {
16215
+ return this.http.put(this.environment.apiV2 + "/service-subscriptions/" + subscription.id, subscription);
16139
16216
  };
16140
16217
  SubscriptionService.prototype.listenSubscriptions = function () {
16141
16218
  var _this = this;
@@ -16172,6 +16249,28 @@
16172
16249
  }] }];
16173
16250
  } });
16174
16251
 
16252
+ var ServiceProductService = /** @class */ (function (_super) {
16253
+ __extends(ServiceProductService, _super);
16254
+ function ServiceProductService() {
16255
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
16256
+ _this.collectionClass = ServiceProductCollection;
16257
+ _this.modelClass = ServiceProduct;
16258
+ _this.endpointUri = 'service-products';
16259
+ _this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
16260
+ _this.isApiPlatform = true;
16261
+ return _this;
16262
+ }
16263
+ return ServiceProductService;
16264
+ }(RestService$1));
16265
+ ServiceProductService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ServiceProductService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
16266
+ ServiceProductService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ServiceProductService, providedIn: 'root' });
16267
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ServiceProductService, decorators: [{
16268
+ type: i0.Injectable,
16269
+ args: [{
16270
+ providedIn: 'root'
16271
+ }]
16272
+ }] });
16273
+
16175
16274
  /**
16176
16275
  * Service to work with tax review history
16177
16276
  */
@@ -21459,8 +21558,11 @@
21459
21558
  exports.ServicePayment = ServicePayment;
21460
21559
  exports.ServicePaymentService = ServicePaymentService;
21461
21560
  exports.ServicePrice = ServicePrice;
21561
+ exports.ServicePriceCollection = ServicePriceCollection;
21462
21562
  exports.ServicePriceService = ServicePriceService;
21463
21563
  exports.ServiceProduct = ServiceProduct;
21564
+ exports.ServiceProductCollection = ServiceProductCollection;
21565
+ exports.ServiceProductService = ServiceProductService;
21464
21566
  exports.ServiceSubscription = ServiceSubscription;
21465
21567
  exports.ServiceSubscriptionCollection = ServiceSubscriptionCollection;
21466
21568
  exports.ServiceSubscriptionItem = ServiceSubscriptionItem;
@@ -21500,6 +21602,7 @@
21500
21602
  exports.SoleInvoiceTemplateForm = SoleInvoiceTemplateForm;
21501
21603
  exports.SoleInvoiceTemplateService = SoleInvoiceTemplateService;
21502
21604
  exports.SseService = SseService;
21605
+ exports.SubscriptionItemCollection = SubscriptionItemCollection;
21503
21606
  exports.SubscriptionService = SubscriptionService;
21504
21607
  exports.TAX_RETURN_CATEGORIES = TAX_RETURN_CATEGORIES;
21505
21608
  exports.TYPE_LOAN = TYPE_LOAN;