taxtank-core 0.29.22 → 0.29.25
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.
- package/bundles/taxtank-core.umd.js +42 -17
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/subscription/service-subscription.collection.js +10 -5
- package/esm2015/lib/collections/subscription/subscription-item.collection.js +5 -1
- package/esm2015/lib/db/Models/subscription/service-subscription.js +1 -1
- package/esm2015/lib/models/endpoint/endpoints.const.js +5 -6
- package/esm2015/lib/models/service-subscription/service-price.js +5 -1
- package/esm2015/lib/models/service-subscription/service-subscription.js +7 -1
- package/esm2015/lib/services/http/subscription/service-subscription/subscription.service.js +6 -1
- package/fesm2015/taxtank-core.js +38 -17
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/subscription/service-subscription.collection.d.ts +4 -3
- package/lib/collections/subscription/subscription-item.collection.d.ts +2 -0
- package/lib/db/Models/subscription/service-subscription.d.ts +1 -0
- package/lib/models/service-subscription/service-price.d.ts +1 -0
- package/lib/models/service-subscription/service-subscription.d.ts +2 -0
- package/lib/services/http/subscription/service-subscription/subscription.service.d.ts +3 -0
- package/package.json +1 -1
|
@@ -2425,6 +2425,15 @@
|
|
|
2425
2425
|
// 6: 6
|
|
2426
2426
|
// }
|
|
2427
2427
|
|
|
2428
|
+
exports.ServicePriceTypeEnum = void 0;
|
|
2429
|
+
(function (ServicePriceTypeEnum) {
|
|
2430
|
+
ServicePriceTypeEnum[ServicePriceTypeEnum["DEPRECATED"] = 0] = "DEPRECATED";
|
|
2431
|
+
ServicePriceTypeEnum[ServicePriceTypeEnum["MONTHLY"] = 1] = "MONTHLY";
|
|
2432
|
+
ServicePriceTypeEnum[ServicePriceTypeEnum["MONTHLY_PACKAGE"] = 2] = "MONTHLY_PACKAGE";
|
|
2433
|
+
ServicePriceTypeEnum[ServicePriceTypeEnum["YEARLY"] = 3] = "YEARLY";
|
|
2434
|
+
ServicePriceTypeEnum[ServicePriceTypeEnum["YEARLY_PACKAGE"] = 4] = "YEARLY_PACKAGE";
|
|
2435
|
+
})(exports.ServicePriceTypeEnum || (exports.ServicePriceTypeEnum = {}));
|
|
2436
|
+
|
|
2428
2437
|
var ServicePrice = /** @class */ (function (_super) {
|
|
2429
2438
|
__extends(ServicePrice, _super);
|
|
2430
2439
|
function ServicePrice() {
|
|
@@ -2433,6 +2442,9 @@
|
|
|
2433
2442
|
ServicePrice.prototype.toSubscriptionItem = function () {
|
|
2434
2443
|
return classTransformer.plainToClass(ServiceSubscriptionItem, { price: this, quantity: this.product.minQty });
|
|
2435
2444
|
};
|
|
2445
|
+
ServicePrice.prototype.isAnnual = function () {
|
|
2446
|
+
return [exports.ServicePriceTypeEnum.YEARLY, exports.ServicePriceTypeEnum.YEARLY_PACKAGE].includes(this.type);
|
|
2447
|
+
};
|
|
2436
2448
|
return ServicePrice;
|
|
2437
2449
|
}(ServicePrice$1));
|
|
2438
2450
|
__decorate([
|
|
@@ -5381,15 +5393,6 @@
|
|
|
5381
5393
|
return SoleInvoiceCollection;
|
|
5382
5394
|
}(Collection));
|
|
5383
5395
|
|
|
5384
|
-
exports.ServicePriceTypeEnum = void 0;
|
|
5385
|
-
(function (ServicePriceTypeEnum) {
|
|
5386
|
-
ServicePriceTypeEnum[ServicePriceTypeEnum["DEPRECATED"] = 0] = "DEPRECATED";
|
|
5387
|
-
ServicePriceTypeEnum[ServicePriceTypeEnum["MONTHLY"] = 1] = "MONTHLY";
|
|
5388
|
-
ServicePriceTypeEnum[ServicePriceTypeEnum["MONTHLY_PACKAGE"] = 2] = "MONTHLY_PACKAGE";
|
|
5389
|
-
ServicePriceTypeEnum[ServicePriceTypeEnum["YEARLY"] = 3] = "YEARLY";
|
|
5390
|
-
ServicePriceTypeEnum[ServicePriceTypeEnum["YEARLY_PACKAGE"] = 4] = "YEARLY_PACKAGE";
|
|
5391
|
-
})(exports.ServicePriceTypeEnum || (exports.ServicePriceTypeEnum = {}));
|
|
5392
|
-
|
|
5393
5396
|
/**
|
|
5394
5397
|
* @TODO vik refactor
|
|
5395
5398
|
*/
|
|
@@ -5493,6 +5496,9 @@
|
|
|
5493
5496
|
SubscriptionItemCollection.prototype.hasProduct = function (product) {
|
|
5494
5497
|
return !!this.findBy('price.product.id', product.id);
|
|
5495
5498
|
};
|
|
5499
|
+
SubscriptionItemCollection.prototype.getPrices = function () {
|
|
5500
|
+
return new ServicePriceCollection(this.mapBy('price'));
|
|
5501
|
+
};
|
|
5496
5502
|
return SubscriptionItemCollection;
|
|
5497
5503
|
}(Collection));
|
|
5498
5504
|
|
|
@@ -5524,17 +5530,22 @@
|
|
|
5524
5530
|
};
|
|
5525
5531
|
ServiceSubscriptionCollection.prototype.groupByProduct = function (products) {
|
|
5526
5532
|
var _this = this;
|
|
5527
|
-
var
|
|
5533
|
+
var collectionDictionary = new CollectionDictionary(new ServiceSubscriptionCollection([]));
|
|
5528
5534
|
products.toArray().forEach(function (product) {
|
|
5529
|
-
|
|
5535
|
+
collectionDictionary.add(product.id, _this.filterByProduct(product));
|
|
5530
5536
|
});
|
|
5531
|
-
return
|
|
5537
|
+
return collectionDictionary;
|
|
5532
5538
|
};
|
|
5533
5539
|
ServiceSubscriptionCollection.prototype.findByProduct = function (product) {
|
|
5534
5540
|
return this.find(function (subscription) {
|
|
5535
5541
|
return !!subscription.items.find(function (item) { return item.price.product.id === product.id; });
|
|
5536
5542
|
});
|
|
5537
5543
|
};
|
|
5544
|
+
ServiceSubscriptionCollection.prototype.filterByProduct = function (product) {
|
|
5545
|
+
return this.filter(function (subscription) {
|
|
5546
|
+
return !!subscription.items.find(function (item) { return item.price.product.id === product.id; });
|
|
5547
|
+
});
|
|
5548
|
+
};
|
|
5538
5549
|
ServiceSubscriptionCollection.prototype.hasPropertyTank = function () {
|
|
5539
5550
|
return !!this.getItems().propertiesItem;
|
|
5540
5551
|
};
|
|
@@ -6637,6 +6648,13 @@
|
|
|
6637
6648
|
_this.lastTrialDays = 4;
|
|
6638
6649
|
return _this;
|
|
6639
6650
|
}
|
|
6651
|
+
Object.defineProperty(ServiceSubscription.prototype, "frequency", {
|
|
6652
|
+
get: function () {
|
|
6653
|
+
return this.isAnnual() ? 'year' : 'month';
|
|
6654
|
+
},
|
|
6655
|
+
enumerable: false,
|
|
6656
|
+
configurable: true
|
|
6657
|
+
});
|
|
6640
6658
|
Object.defineProperty(ServiceSubscription.prototype, "isTrial", {
|
|
6641
6659
|
get: function () {
|
|
6642
6660
|
return !this.stripeId;
|
|
@@ -6763,6 +6781,9 @@
|
|
|
6763
6781
|
ServiceSubscription.prototype.isPackage = function () {
|
|
6764
6782
|
return this.items.length === ServiceProduct.quantity;
|
|
6765
6783
|
};
|
|
6784
|
+
ServiceSubscription.prototype.isAnnual = function () {
|
|
6785
|
+
return !!(this.getItems().getPrices().annual.length || this.getItems().getPrices().annualPackage.length);
|
|
6786
|
+
};
|
|
6766
6787
|
/**
|
|
6767
6788
|
* Recommended number of properties to buy,
|
|
6768
6789
|
* based on the property service product and the number of properties the user has
|
|
@@ -10102,7 +10123,8 @@
|
|
|
10102
10123
|
PROPERTIES_SALES_GET: new Endpoint('GET', '\\/properties\\/sales'),
|
|
10103
10124
|
PROPERTIES_SUGGESTIONS_GET: new Endpoint('GET', '/property\\/\\w+\\/v2\\/.*$'),
|
|
10104
10125
|
PROPERTIES_VALUATIONS_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/valuations\\/\\d+\\/documents'),
|
|
10105
|
-
|
|
10126
|
+
// @TODO rename
|
|
10127
|
+
PRORATION_COST_POST: new Endpoint('PUT', '\\/service-subscriptions\\/\\d+\\/proration-cost'),
|
|
10106
10128
|
SALARY_FORECAST_GET: new Endpoint('GET', '\\/salary-forecasts'),
|
|
10107
10129
|
SALARY_FORECAST_POST: new Endpoint('POST', '\\/salary-forecasts'),
|
|
10108
10130
|
SALARY_FORECAST_PUT: new Endpoint('PUT', '\\/salary-forecasts'),
|
|
@@ -10110,11 +10132,9 @@
|
|
|
10110
10132
|
SERVICE_PRODUCTS_GET: new Endpoint('GET', '\\/service-products'),
|
|
10111
10133
|
SERVICE_PAYMENTS_GET: new Endpoint('GET', '\\/service-payments'),
|
|
10112
10134
|
SERVICE_SUBSCRIPTIONS_GET: new Endpoint('GET', '\\/service-subscriptions'),
|
|
10135
|
+
SERVICE_SUBSCRIPTIONS_CANCEL: new Endpoint('PUT', '\\/service-subscriptions\\/\\d+\\/cancel'),
|
|
10113
10136
|
SERVICE_PAYMENT_INVOICE_URL_GET: new Endpoint('GET', '\\/service-payments\\/\\d+\\/invoice-url'),
|
|
10114
|
-
|
|
10115
|
-
STRIPE_CHECKOUT_SESSION_POST: new Endpoint('POST', '\\/stripe\\/checkout-session'),
|
|
10116
|
-
SUBSCRIPTION_LAST_GET: new Endpoint('GET', '\\/subscriptions\\/last'),
|
|
10117
|
-
SUBSCRIPTION_ITEMS_PUT: new Endpoint('PUT', '\\/subscriptions\\/items'),
|
|
10137
|
+
SUBSCRIPTION_ITEMS_PUT: new Endpoint('PUT', '\\/service-subscriptions\\/\\d+\\/items'),
|
|
10118
10138
|
SOLE_BUSINESSES_GET: new Endpoint('GET', '\\/sole-businesses'),
|
|
10119
10139
|
SOLE_BUSINESSES_POST: new Endpoint('POST', '\\/sole-businesses'),
|
|
10120
10140
|
SOLE_BUSINESSES_PUT: new Endpoint('PUT', '\\/sole-businesses\\/\\d+'),
|
|
@@ -16238,6 +16258,7 @@
|
|
|
16238
16258
|
return this.getActive().pipe(operators.map(function (subscriptions) { return subscriptions.getTrials(); }));
|
|
16239
16259
|
};
|
|
16240
16260
|
/**
|
|
16261
|
+
* @TODO remove
|
|
16241
16262
|
* redirect to stripe payment page
|
|
16242
16263
|
*/
|
|
16243
16264
|
SubscriptionService.prototype.checkoutRedirect = function (subscription) {
|
|
@@ -16263,6 +16284,7 @@
|
|
|
16263
16284
|
});
|
|
16264
16285
|
};
|
|
16265
16286
|
/**
|
|
16287
|
+
* @TODO remove
|
|
16266
16288
|
* redirect to stripe billing page
|
|
16267
16289
|
*/
|
|
16268
16290
|
SubscriptionService.prototype.billingRedirect = function (returnUrl) {
|
|
@@ -16286,6 +16308,9 @@
|
|
|
16286
16308
|
SubscriptionService.prototype.changeSubscription = function (subscription) {
|
|
16287
16309
|
return this.http.put(this.environment.apiV2 + "/service-subscriptions/" + subscription.id, subscription);
|
|
16288
16310
|
};
|
|
16311
|
+
SubscriptionService.prototype.cancel = function (subscription) {
|
|
16312
|
+
return this.http.put(this.environment.apiV2 + "/service-subscriptions/" + subscription.id + "/cancel", {});
|
|
16313
|
+
};
|
|
16289
16314
|
SubscriptionService.prototype.listenSubscriptions = function () {
|
|
16290
16315
|
var _this = this;
|
|
16291
16316
|
this.sseService.on("serviceSubscriptions")
|