taxtank-core 0.29.34 → 0.29.36
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 +38 -10
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/collection.js +18 -5
- package/esm2015/lib/collections/property/property.collection.js +2 -2
- package/esm2015/lib/collections/subscription/service-product.collection.js +4 -1
- package/esm2015/lib/collections/subscription/service-subscription.collection.js +4 -1
- package/esm2015/lib/forms/client/client-income-types.form.js +5 -5
- package/esm2015/lib/services/http/user/user.service.js +2 -2
- package/fesm2015/taxtank-core.js +29 -10
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/collection.d.ts +6 -2
- package/lib/collections/subscription/service-product.collection.d.ts +1 -0
- package/lib/collections/subscription/service-subscription.collection.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2166,6 +2166,27 @@
|
|
|
2166
2166
|
(_b = this.items).push.apply(_b, __spreadArray([], __read(items)));
|
|
2167
2167
|
return this.create(this.items);
|
|
2168
2168
|
};
|
|
2169
|
+
Collection.prototype.remove = function () {
|
|
2170
|
+
var _this = this;
|
|
2171
|
+
var items = [];
|
|
2172
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2173
|
+
items[_i] = arguments[_i];
|
|
2174
|
+
}
|
|
2175
|
+
items.forEach(function (item) {
|
|
2176
|
+
var index = _this.findIndexBy('id', item.id);
|
|
2177
|
+
if (index < 0) {
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
_this.items.splice(index, 1);
|
|
2181
|
+
});
|
|
2182
|
+
return this;
|
|
2183
|
+
};
|
|
2184
|
+
/**
|
|
2185
|
+
* @TODO it's filter, not remove
|
|
2186
|
+
*/
|
|
2187
|
+
Collection.prototype.removeBy = function (path, values) {
|
|
2188
|
+
return this.filter(function (item) { return !(Array.isArray(values) ? values : [values]).includes(get__default["default"](item, path)); });
|
|
2189
|
+
};
|
|
2169
2190
|
Collection.prototype.replaceBy = function (path, value, item) {
|
|
2170
2191
|
var index = this.findIndexBy(path, value);
|
|
2171
2192
|
if (index >= 0) {
|
|
@@ -2173,12 +2194,9 @@
|
|
|
2173
2194
|
}
|
|
2174
2195
|
return this;
|
|
2175
2196
|
};
|
|
2176
|
-
Collection.prototype.
|
|
2197
|
+
Collection.prototype.diff = function (items) {
|
|
2177
2198
|
return this.filter(function (model) { return !items.map(function (item) { return item.id; }).includes(model.id); });
|
|
2178
2199
|
};
|
|
2179
|
-
Collection.prototype.removeBy = function (path, values) {
|
|
2180
|
-
return this.filter(function (item) { return !(Array.isArray(values) ? values : [values]).includes(get__default["default"](item, path)); });
|
|
2181
|
-
};
|
|
2182
2200
|
Collection.prototype.minBy = function (path) {
|
|
2183
2201
|
return this.items.reduce(function (prev, current) { return (get__default["default"](prev, path) < get__default["default"](current, path) ? prev : current); });
|
|
2184
2202
|
};
|
|
@@ -2858,7 +2876,7 @@
|
|
|
2858
2876
|
activeProperties.getBestPerformanceGrowthProperty(),
|
|
2859
2877
|
activeProperties.getBestPerformanceTaxProperty(transactions, depreciations)
|
|
2860
2878
|
]).toArray(), 'id');
|
|
2861
|
-
var newItems = this.
|
|
2879
|
+
var newItems = this.diff(bestProperties).toArray();
|
|
2862
2880
|
newItems.unshift.apply(newItems, __spreadArray([], __read(bestProperties)));
|
|
2863
2881
|
return this.create(newItems);
|
|
2864
2882
|
};
|
|
@@ -6206,6 +6224,13 @@
|
|
|
6206
6224
|
function ServiceProductCollection() {
|
|
6207
6225
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
6208
6226
|
}
|
|
6227
|
+
Object.defineProperty(ServiceProductCollection.prototype, "title", {
|
|
6228
|
+
get: function () {
|
|
6229
|
+
return this.mapBy('title').join(', ');
|
|
6230
|
+
},
|
|
6231
|
+
enumerable: false,
|
|
6232
|
+
configurable: true
|
|
6233
|
+
});
|
|
6209
6234
|
ServiceProductCollection.prototype.getActive = function () {
|
|
6210
6235
|
return this.filterBy('status', exports.ServiceProductStatusEnum.ACTIVE);
|
|
6211
6236
|
};
|
|
@@ -6342,6 +6367,9 @@
|
|
|
6342
6367
|
// @TODO vik remove paid products
|
|
6343
6368
|
return this.getInactive().getTrials();
|
|
6344
6369
|
};
|
|
6370
|
+
ServiceSubscriptionCollection.prototype.getExpiredAfter = function (date) {
|
|
6371
|
+
return this.filter(function (item) { return !date || item.endDate >= date; });
|
|
6372
|
+
};
|
|
6345
6373
|
ServiceSubscriptionCollection.prototype.getPaid = function () {
|
|
6346
6374
|
return this.filter(function (subscription) { return !!subscription.stripeId; });
|
|
6347
6375
|
};
|
|
@@ -11105,8 +11133,8 @@
|
|
|
11105
11133
|
return this.http.get(this.environment.apiV2 + "/users/current")
|
|
11106
11134
|
.pipe(operators.map(function (userBase) {
|
|
11107
11135
|
var user = classTransformer.plainToClass(User, userBase);
|
|
11136
|
+
// @TODO Vik remove
|
|
11108
11137
|
localStorage.setItem('userId', user.id.toString());
|
|
11109
|
-
// @TODO remove
|
|
11110
11138
|
localStorage.setItem('financialYear', user.financialYear.toString());
|
|
11111
11139
|
_this.cache = user;
|
|
11112
11140
|
_this.cacheSubject.next(_this.cache);
|
|
@@ -20077,10 +20105,10 @@
|
|
|
20077
20105
|
function ClientIncomeTypesForm(clientIncomeTypes) {
|
|
20078
20106
|
if (clientIncomeTypes === void 0) { clientIncomeTypes = classTransformer.plainToClass(ClientIncomeTypes, {}); }
|
|
20079
20107
|
var _this = _super.call(this, {
|
|
20080
|
-
work: new forms.FormControl(clientIncomeTypes.work),
|
|
20081
|
-
property: new forms.FormControl(clientIncomeTypes.property),
|
|
20082
|
-
sole: new forms.FormControl(clientIncomeTypes.sole),
|
|
20083
|
-
holdings: new forms.FormControl({ value: clientIncomeTypes.holdings, disabled: true })
|
|
20108
|
+
work: new forms.FormControl(clientIncomeTypes.work || false),
|
|
20109
|
+
property: new forms.FormControl(clientIncomeTypes.property || false),
|
|
20110
|
+
sole: new forms.FormControl(clientIncomeTypes.sole || false),
|
|
20111
|
+
holdings: new forms.FormControl({ value: clientIncomeTypes.holdings || false, disabled: true })
|
|
20084
20112
|
}, clientIncomeTypes, atLeastOneCheckedValidator()) || this;
|
|
20085
20113
|
_this.clientIncomeTypes = clientIncomeTypes;
|
|
20086
20114
|
return _this;
|