taxtank-core 0.13.4 → 0.13.5
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 +13 -14
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/collection.js +3 -2
- package/esm2015/lib/models/service-subscription/service-price.js +6 -2
- package/esm2015/lib/models/service-subscription/service-subscription-item.js +3 -3
- package/esm2015/lib/models/service-subscription/service-subscription.js +3 -3
- package/esm2015/public-api.js +2 -1
- package/fesm2015/taxtank-core.js +9 -10
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/collection.d.ts +1 -1
- package/lib/models/service-subscription/service-price.d.ts +2 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/esm2015/lib/db/Enums/subscription/service-price-list.enum.js +0 -5
- package/lib/db/Enums/subscription/service-price-list.enum.d.ts +0 -3
|
@@ -1354,7 +1354,8 @@
|
|
|
1354
1354
|
return this.items.find(function (item) { return get__default["default"](item, path) === value; });
|
|
1355
1355
|
};
|
|
1356
1356
|
Collection.prototype.findIndexBy = function (path, value) {
|
|
1357
|
-
|
|
1357
|
+
var _a;
|
|
1358
|
+
return (_a = this.items.findIndex(function (item) { return get__default["default"](item, path) === value; })) !== null && _a !== void 0 ? _a : null;
|
|
1358
1359
|
};
|
|
1359
1360
|
/**
|
|
1360
1361
|
* Get total sum of items by field
|
|
@@ -3263,7 +3264,7 @@
|
|
|
3263
3264
|
ServiceProductStatusEnum[ServiceProductStatusEnum["ACTIVE"] = 1] = "ACTIVE";
|
|
3264
3265
|
})(exports.ServiceProductStatusEnum || (exports.ServiceProductStatusEnum = {}));
|
|
3265
3266
|
|
|
3266
|
-
|
|
3267
|
+
exports.ServiceProductIdEnum = void 0;
|
|
3267
3268
|
(function (ServiceProductIdEnum) {
|
|
3268
3269
|
ServiceProductIdEnum[ServiceProductIdEnum["WORK_TANK_OLD"] = 1] = "WORK_TANK_OLD";
|
|
3269
3270
|
ServiceProductIdEnum[ServiceProductIdEnum["PROPERTY_OLD"] = 2] = "PROPERTY_OLD";
|
|
@@ -3271,7 +3272,7 @@
|
|
|
3271
3272
|
ServiceProductIdEnum[ServiceProductIdEnum["WORK_TANK"] = 4] = "WORK_TANK";
|
|
3272
3273
|
ServiceProductIdEnum[ServiceProductIdEnum["PROPERTIES"] = 5] = "PROPERTIES";
|
|
3273
3274
|
ServiceProductIdEnum[ServiceProductIdEnum["SOLE_TANK"] = 6] = "SOLE_TANK";
|
|
3274
|
-
})(ServiceProductIdEnum || (ServiceProductIdEnum = {}));
|
|
3275
|
+
})(exports.ServiceProductIdEnum || (exports.ServiceProductIdEnum = {}));
|
|
3275
3276
|
|
|
3276
3277
|
var ServiceProduct = /** @class */ (function (_super) {
|
|
3277
3278
|
__extends(ServiceProduct, _super);
|
|
@@ -3279,13 +3280,13 @@
|
|
|
3279
3280
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3280
3281
|
}
|
|
3281
3282
|
ServiceProduct.prototype.isProperties = function () {
|
|
3282
|
-
return [ServiceProductIdEnum.PROPERTY_OLD, ServiceProductIdEnum.PROPERTIES].includes(this.id);
|
|
3283
|
+
return [exports.ServiceProductIdEnum.PROPERTY_OLD, exports.ServiceProductIdEnum.PROPERTIES].includes(this.id);
|
|
3283
3284
|
};
|
|
3284
3285
|
ServiceProduct.prototype.isWorkTank = function () {
|
|
3285
|
-
return [ServiceProductIdEnum.WORK_TANK_OLD, ServiceProductIdEnum.WORK_TANK].includes(this.id);
|
|
3286
|
+
return [exports.ServiceProductIdEnum.WORK_TANK_OLD, exports.ServiceProductIdEnum.WORK_TANK].includes(this.id);
|
|
3286
3287
|
};
|
|
3287
3288
|
ServiceProduct.prototype.isSoleTank = function () {
|
|
3288
|
-
return this.id === ServiceProductIdEnum.SOLE_TANK;
|
|
3289
|
+
return this.id === exports.ServiceProductIdEnum.SOLE_TANK;
|
|
3289
3290
|
};
|
|
3290
3291
|
ServiceProduct.prototype.isArchived = function () {
|
|
3291
3292
|
return this.status === exports.ServiceProductStatusEnum.ARCHIVED;
|
|
@@ -3298,17 +3299,15 @@
|
|
|
3298
3299
|
function ServicePrice() {
|
|
3299
3300
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3300
3301
|
}
|
|
3302
|
+
ServicePrice.prototype.toSubscriptionItem = function () {
|
|
3303
|
+
return classTransformer.plainToClass(ServiceSubscriptionItem, { price: this, quantity: this.product.minQty });
|
|
3304
|
+
};
|
|
3301
3305
|
return ServicePrice;
|
|
3302
3306
|
}(ServicePrice$1));
|
|
3303
3307
|
__decorate([
|
|
3304
3308
|
classTransformer.Type(function () { return ServiceProduct; })
|
|
3305
3309
|
], ServicePrice.prototype, "product", void 0);
|
|
3306
3310
|
|
|
3307
|
-
var ServicePriceListEnum;
|
|
3308
|
-
(function (ServicePriceListEnum) {
|
|
3309
|
-
ServicePriceListEnum[ServicePriceListEnum["PROPERTIES"] = 5] = "PROPERTIES";
|
|
3310
|
-
})(ServicePriceListEnum || (ServicePriceListEnum = {}));
|
|
3311
|
-
|
|
3312
3311
|
/**
|
|
3313
3312
|
* backend bd doesn't support dynamic prices, as far as we have just one product like that we keep it hardcoded
|
|
3314
3313
|
*/
|
|
@@ -3321,7 +3320,7 @@
|
|
|
3321
3320
|
Object.defineProperty(ServiceSubscriptionItem.prototype, "total", {
|
|
3322
3321
|
get: function () {
|
|
3323
3322
|
var price = this.price.amount * this.quantity;
|
|
3324
|
-
if (this.price.id ===
|
|
3323
|
+
if (this.price.product.id === exports.ServiceProductIdEnum.PROPERTIES) {
|
|
3325
3324
|
price += PROPERTY_TANK_PRICE;
|
|
3326
3325
|
}
|
|
3327
3326
|
return price;
|
|
@@ -3487,7 +3486,7 @@
|
|
|
3487
3486
|
return this.daysRemain > 0 && this.daysRemain <= this.lastTrialDays;
|
|
3488
3487
|
};
|
|
3489
3488
|
ServiceSubscription.prototype.isRenewable = function () {
|
|
3490
|
-
return !this.isTrial &&
|
|
3489
|
+
return !this.isTrial && this.isActive;
|
|
3491
3490
|
};
|
|
3492
3491
|
Object.defineProperty(ServiceSubscription.prototype, "workTankItem", {
|
|
3493
3492
|
/**
|
|
@@ -3529,7 +3528,7 @@
|
|
|
3529
3528
|
*/
|
|
3530
3529
|
ServiceSubscription.prototype.isArchived = function () {
|
|
3531
3530
|
// subscription with at least one archived product considered as archived
|
|
3532
|
-
return !!this.items.
|
|
3531
|
+
return !!this.items.filter(function (item) { return item.price.product.isArchived(); }).length;
|
|
3533
3532
|
};
|
|
3534
3533
|
return ServiceSubscription;
|
|
3535
3534
|
}(ServiceSubscription$1));
|