taxtank-core 2.0.11 → 2.0.13
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/fesm2022/taxtank-core.mjs +30 -17
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/index.d.ts +7 -0
- package/package.json +1 -1
@@ -4652,6 +4652,15 @@ var ServicePromoCodeDurationEnum;
|
|
4652
4652
|
})(ServicePromoCodeDurationEnum || (ServicePromoCodeDurationEnum = {}));
|
4653
4653
|
|
4654
4654
|
class ServicePromoCode extends AbstractModel {
|
4655
|
+
getProductsIds() {
|
4656
|
+
return this.products.map(product => product.id);
|
4657
|
+
}
|
4658
|
+
hasProduct(product) {
|
4659
|
+
return this.products.length ? this.getProductsIds().includes(product.id) : true;
|
4660
|
+
}
|
4661
|
+
isProductPercentOff(product) {
|
4662
|
+
return !!(this.hasProduct(product) && this.percentOff);
|
4663
|
+
}
|
4655
4664
|
isDurationForever() {
|
4656
4665
|
return this.duration === ServicePromoCodeDurationEnum.FOREVER;
|
4657
4666
|
}
|
@@ -4678,6 +4687,9 @@ class ServicePromoCode extends AbstractModel {
|
|
4678
4687
|
return label;
|
4679
4688
|
}
|
4680
4689
|
}
|
4690
|
+
__decorate([
|
4691
|
+
Type(() => ServiceProduct)
|
4692
|
+
], ServicePromoCode.prototype, "products", void 0);
|
4681
4693
|
|
4682
4694
|
class ServiceSubscription extends ServiceSubscription$1 {
|
4683
4695
|
constructor() {
|
@@ -4700,20 +4712,20 @@ class ServiceSubscription extends ServiceSubscription$1 {
|
|
4700
4712
|
return this.items.reduce((sum, item) => sum + item.total, 0);
|
4701
4713
|
}
|
4702
4714
|
get discountAmount() {
|
4703
|
-
|
4715
|
+
if (!this.promoCode) {
|
4716
|
+
return 0;
|
4717
|
+
}
|
4718
|
+
const discountApplicable = this.items
|
4719
|
+
.map(item => item.price)
|
4720
|
+
.filter(price => this.promoCode.getProductsIds().includes(price.product.id))
|
4721
|
+
.reduce((sum, price) => sum + price.amount, 0) || this.initialPrice;
|
4722
|
+
if (this.promoCode.amountOff) {
|
4723
|
+
return Math.min(discountApplicable, this.promoCode.amountOff);
|
4724
|
+
}
|
4725
|
+
return discountApplicable * (this.promoCode.percentOff / 100);
|
4704
4726
|
}
|
4705
4727
|
get price() {
|
4706
|
-
|
4707
|
-
if (this.promoCode) {
|
4708
|
-
if (this.promoCode.amountOff) {
|
4709
|
-
price = price - this.promoCode.amountOff;
|
4710
|
-
}
|
4711
|
-
else {
|
4712
|
-
price = price - price * (this.promoCode.percentOff / 100);
|
4713
|
-
}
|
4714
|
-
}
|
4715
|
-
// promo code can't make price < 0
|
4716
|
-
return price > 0 ? price : 0;
|
4728
|
+
return this.initialPrice - this.discountAmount;
|
4717
4729
|
}
|
4718
4730
|
/**
|
4719
4731
|
* get title of subscription
|
@@ -13379,7 +13391,6 @@ var ClientInviteMessages;
|
|
13379
13391
|
})(ClientInviteMessages || (ClientInviteMessages = {}));
|
13380
13392
|
|
13381
13393
|
class ClientMovementService extends RestService$1 {
|
13382
|
-
// mercureTopic = 'clientMovements';
|
13383
13394
|
constructor(environment) {
|
13384
13395
|
super(environment);
|
13385
13396
|
this.environment = environment;
|
@@ -13387,6 +13398,7 @@ class ClientMovementService extends RestService$1 {
|
|
13387
13398
|
this.collectionClass = ClientMovementCollection;
|
13388
13399
|
this.modelClass = ClientMovement;
|
13389
13400
|
this.disabledMethods = ['postBatch', 'delete', 'deleteBatch'];
|
13401
|
+
this.mercureTopic = 'clientMovements';
|
13390
13402
|
this.listenEvents();
|
13391
13403
|
}
|
13392
13404
|
listenEvents() {
|
@@ -15229,13 +15241,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
|
|
15229
15241
|
}] });
|
15230
15242
|
|
15231
15243
|
class ServicePaymentMethodService extends RestService$1 {
|
15232
|
-
// mercureTopic = 'servicePaymentMethods';
|
15233
15244
|
constructor(environment) {
|
15234
15245
|
super(environment);
|
15235
15246
|
this.environment = environment;
|
15236
15247
|
this.endpointUri = 'service-payment-methods';
|
15237
15248
|
this.collectionClass = Collection;
|
15238
15249
|
this.modelClass = ServicePaymentMethod;
|
15250
|
+
this.mercureTopic = 'servicePaymentMethods';
|
15239
15251
|
this.listenEvents();
|
15240
15252
|
}
|
15241
15253
|
listenEvents() {
|
@@ -15301,7 +15313,6 @@ var SubscriptionMessagesEnum;
|
|
15301
15313
|
* @TODO Alex refactor
|
15302
15314
|
*/
|
15303
15315
|
class SubscriptionService extends RestService$1 {
|
15304
|
-
// mercureTopic = 'serviceSubscriptions';
|
15305
15316
|
constructor(http, environment) {
|
15306
15317
|
super(environment);
|
15307
15318
|
this.http = http;
|
@@ -15310,6 +15321,7 @@ class SubscriptionService extends RestService$1 {
|
|
15310
15321
|
this.modelClass = ServiceSubscription;
|
15311
15322
|
this.collectionClass = ServiceSubscriptionCollection;
|
15312
15323
|
this.disabledMethods = ['putBatch', 'delete', 'deleteBatch'];
|
15324
|
+
this.mercureTopic = 'serviceSubscriptions';
|
15313
15325
|
this.listenEvents();
|
15314
15326
|
}
|
15315
15327
|
listenEvents() {
|
@@ -22521,7 +22533,8 @@ var FormValidationsEnum;
|
|
22521
22533
|
class DocumentFolderForm extends AbstractForm {
|
22522
22534
|
constructor(folder) {
|
22523
22535
|
super({
|
22524
|
-
name: new
|
22536
|
+
name: new FormControl(folder.name, [Validators.required, Validators.maxLength(FormValidationsEnum.INPUT_MAX_LENGTH)]),
|
22537
|
+
parent: new FormControl({ value: folder.parent, disabled: true }),
|
22525
22538
|
}, folder);
|
22526
22539
|
}
|
22527
22540
|
}
|
@@ -22529,7 +22542,7 @@ class DocumentFolderForm extends AbstractForm {
|
|
22529
22542
|
class DocumentForm extends AbstractForm {
|
22530
22543
|
constructor(document) {
|
22531
22544
|
super({
|
22532
|
-
folder: new FormControl(document.folder, Validators.required),
|
22545
|
+
folder: new FormControl({ value: document.folder, disabled: true }, Validators.required),
|
22533
22546
|
file: new FormControl(document.file, Validators.required),
|
22534
22547
|
}, document);
|
22535
22548
|
}
|