taxtank-core 0.28.19 → 0.28.20
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 +113 -71
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/chat.collection.js +26 -0
- package/esm2015/lib/collections/message.collection.js +13 -1
- package/esm2015/lib/db/Enums/chat-status.enum.js +1 -1
- package/esm2015/lib/models/chat/message.js +5 -1
- package/esm2015/public-api.js +2 -1
- package/fesm2015/taxtank-core.js +95 -60
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/chat.collection.d.ts +10 -0
- package/lib/collections/message.collection.d.ts +5 -0
- package/lib/models/chat/message.d.ts +2 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/last'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('moment'), require('moment-range'), require('lodash/uniqBy'), require('lodash/concat'), require('rxjs/internal/observable/throwError'), require('lodash/cloneDeep'), require('event-source-polyfill/src/eventsource.min.js'), require('lodash/compact'), require('@angular/forms'), require('lodash/merge'), require('lodash/isEqual'), require('lodash/fromPairs'), require('lodash'), require('@angular/router'), require('lodash/clone'), require('html2pdf.js'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/last', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'moment', 'moment-range', 'lodash/uniqBy', 'lodash/concat', 'rxjs/internal/observable/throwError', 'lodash/cloneDeep', 'event-source-polyfill/src/eventsource.min.js', 'lodash/compact', '@angular/forms', 'lodash/merge', 'lodash/isEqual', 'lodash/fromPairs', 'lodash', '@angular/router', 'lodash/clone', 'html2pdf.js', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.get, global.last, global.flatten, global.hasIn, global.first, global.moment$1, global.momentRange, global.uniqBy, global.concat, global.rxjs["internal/observable/throwError"], global.cloneDeep$1, global.eventsource_min_js, global.compact, global.ng.forms, global.merge, global.isEqual, global.fromPairs, global._, global.ng.router, global.clone, global.html2pdf, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
|
|
5
|
-
})(this, (function (exports, i0, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, last, flatten, hasIn, first, moment$1, momentRange, uniqBy, concat, throwError, cloneDeep$1, eventsource_min_js, compact, forms, merge, isEqual, fromPairs, _, i1$2, clone, html2pdf, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/last'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('moment'), require('moment-range'), require('lodash/uniqBy'), require('lodash/concat'), require('rxjs/internal/observable/throwError'), require('lodash/cloneDeep'), require('event-source-polyfill/src/eventsource.min.js'), require('lodash/compact'), require('lodash/differenceBy'), require('@angular/forms'), require('lodash/merge'), require('lodash/isEqual'), require('lodash/fromPairs'), require('lodash'), require('@angular/router'), require('lodash/clone'), require('html2pdf.js'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/last', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'moment', 'moment-range', 'lodash/uniqBy', 'lodash/concat', 'rxjs/internal/observable/throwError', 'lodash/cloneDeep', 'event-source-polyfill/src/eventsource.min.js', 'lodash/compact', 'lodash/differenceBy', '@angular/forms', 'lodash/merge', 'lodash/isEqual', 'lodash/fromPairs', 'lodash', '@angular/router', 'lodash/clone', 'html2pdf.js', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.get, global.last, global.flatten, global.hasIn, global.first, global.moment$1, global.momentRange, global.uniqBy, global.concat, global.rxjs["internal/observable/throwError"], global.cloneDeep$1, global.eventsource_min_js, global.compact, global.differenceBy, global.ng.forms, global.merge, global.isEqual, global.fromPairs, global._, global.ng.router, global.clone, global.html2pdf, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
|
|
5
|
+
})(this, (function (exports, i0, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, last, flatten, hasIn, first, moment$1, momentRange, uniqBy, concat, throwError, cloneDeep$1, eventsource_min_js, compact, differenceBy, forms, merge, isEqual, fromPairs, _, i1$2, clone, html2pdf, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
var concat__default = /*#__PURE__*/_interopDefaultLegacy(concat);
|
|
38
38
|
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep$1);
|
|
39
39
|
var compact__default = /*#__PURE__*/_interopDefaultLegacy(compact);
|
|
40
|
+
var differenceBy__default = /*#__PURE__*/_interopDefaultLegacy(differenceBy);
|
|
40
41
|
var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
|
|
41
42
|
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
42
43
|
var fromPairs__default = /*#__PURE__*/_interopDefaultLegacy(fromPairs);
|
|
@@ -7078,6 +7079,110 @@
|
|
|
7078
7079
|
return ChartAccountsCollection;
|
|
7079
7080
|
}(Collection));
|
|
7080
7081
|
|
|
7082
|
+
var MessageCollection = /** @class */ (function (_super) {
|
|
7083
|
+
__extends(MessageCollection, _super);
|
|
7084
|
+
function MessageCollection() {
|
|
7085
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7086
|
+
}
|
|
7087
|
+
MessageCollection.prototype.getFirstUnreadMessage = function (user) {
|
|
7088
|
+
return this.items.find(function (message) {
|
|
7089
|
+
return !message.isRead() && message.isFromEmployee() !== user.isEmployee();
|
|
7090
|
+
});
|
|
7091
|
+
};
|
|
7092
|
+
/**
|
|
7093
|
+
* Get List of unread chats
|
|
7094
|
+
*/
|
|
7095
|
+
MessageCollection.prototype.getUnread = function () {
|
|
7096
|
+
return this.items.filter(function (message) { return !message.readAt; });
|
|
7097
|
+
};
|
|
7098
|
+
MessageCollection.prototype.getFromActiveChats = function () {
|
|
7099
|
+
return this.filter(function (message) { return message.chat.isActive(); });
|
|
7100
|
+
};
|
|
7101
|
+
/**
|
|
7102
|
+
* Get amount of chats that contains unread messages
|
|
7103
|
+
*/
|
|
7104
|
+
MessageCollection.prototype.getUnreadChatsAmount = function (isFromEmployee) {
|
|
7105
|
+
if (isFromEmployee === void 0) { isFromEmployee = false; }
|
|
7106
|
+
// filtered messages for client/employee
|
|
7107
|
+
var filteredMessages = this.filter(function (message) { return isFromEmployee ? message.isFromEmployee() : !message.isFromEmployee(); });
|
|
7108
|
+
return uniqBy__default["default"](filteredMessages.getFromActiveChats().getUnread(), 'chat.id').length;
|
|
7109
|
+
};
|
|
7110
|
+
/**
|
|
7111
|
+
* Check if chat has unread chats
|
|
7112
|
+
*/
|
|
7113
|
+
MessageCollection.prototype.hasUnread = function () {
|
|
7114
|
+
return !!this.getUnread().length;
|
|
7115
|
+
};
|
|
7116
|
+
return MessageCollection;
|
|
7117
|
+
}(Collection));
|
|
7118
|
+
|
|
7119
|
+
/**
|
|
7120
|
+
* List of objects grouped by passed property
|
|
7121
|
+
*/
|
|
7122
|
+
var Dictionary = /** @class */ (function () {
|
|
7123
|
+
function Dictionary(items, path) {
|
|
7124
|
+
if (path === void 0) { path = 'id'; }
|
|
7125
|
+
this.items = {};
|
|
7126
|
+
if (!items.length) {
|
|
7127
|
+
return;
|
|
7128
|
+
}
|
|
7129
|
+
// Do nothing if provided path was not found in the 1st item
|
|
7130
|
+
if (!hasIn__default["default"](items[0], path.split('.')[0])) {
|
|
7131
|
+
return;
|
|
7132
|
+
}
|
|
7133
|
+
this.groupItems(items, path);
|
|
7134
|
+
}
|
|
7135
|
+
Dictionary.prototype.add = function (key, value) {
|
|
7136
|
+
this.items[key] = value;
|
|
7137
|
+
};
|
|
7138
|
+
Dictionary.prototype.get = function (key) {
|
|
7139
|
+
return this.items[key] !== undefined ? this.items[key] : null;
|
|
7140
|
+
};
|
|
7141
|
+
Dictionary.prototype.groupItems = function (items, path) {
|
|
7142
|
+
var _this = this;
|
|
7143
|
+
items.forEach(function (item) {
|
|
7144
|
+
var key = get__default["default"](item, path);
|
|
7145
|
+
// if object does not have property for grouping it will be grouped as 'other'
|
|
7146
|
+
if (key === undefined) {
|
|
7147
|
+
key = 'other';
|
|
7148
|
+
}
|
|
7149
|
+
_this.items[key] = item;
|
|
7150
|
+
});
|
|
7151
|
+
};
|
|
7152
|
+
return Dictionary;
|
|
7153
|
+
}());
|
|
7154
|
+
|
|
7155
|
+
exports.ChatStatusEnum = void 0;
|
|
7156
|
+
(function (ChatStatusEnum) {
|
|
7157
|
+
ChatStatusEnum[ChatStatusEnum["ACTIVE"] = 1] = "ACTIVE";
|
|
7158
|
+
ChatStatusEnum[ChatStatusEnum["INACTIVE"] = 2] = "INACTIVE";
|
|
7159
|
+
})(exports.ChatStatusEnum || (exports.ChatStatusEnum = {}));
|
|
7160
|
+
|
|
7161
|
+
var ChatCollection = /** @class */ (function (_super) {
|
|
7162
|
+
__extends(ChatCollection, _super);
|
|
7163
|
+
function ChatCollection() {
|
|
7164
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7165
|
+
}
|
|
7166
|
+
/**
|
|
7167
|
+
* Sort chats by last messages (newest first) + empty chats in the end
|
|
7168
|
+
*/
|
|
7169
|
+
ChatCollection.prototype.getSortedByNewest = function (messages) {
|
|
7170
|
+
var chatsById = new Dictionary(this.toArray());
|
|
7171
|
+
// get chats array sorted from newest to oldest
|
|
7172
|
+
var chats = uniqBy__default["default"](new MessageCollection(messages)
|
|
7173
|
+
.filterBy('chat.id', this.getIds())
|
|
7174
|
+
.sortBy('createdAt', true)
|
|
7175
|
+
.toArray()
|
|
7176
|
+
.map(function (message) { return chatsById.get(message.chat.id); }), 'id');
|
|
7177
|
+
var emptyChats = differenceBy__default["default"](this.toArray(), chats, 'id');
|
|
7178
|
+
return this.create(__spreadArray(__spreadArray([], __read(chats)), __read(emptyChats)));
|
|
7179
|
+
};
|
|
7180
|
+
ChatCollection.prototype.getActive = function () {
|
|
7181
|
+
return this.filterBy('status', exports.ChatStatusEnum.ACTIVE);
|
|
7182
|
+
};
|
|
7183
|
+
return ChatCollection;
|
|
7184
|
+
}(Collection));
|
|
7185
|
+
|
|
7081
7186
|
var ClientCollection = /** @class */ (function (_super) {
|
|
7082
7187
|
__extends(ClientCollection, _super);
|
|
7083
7188
|
function ClientCollection() {
|
|
@@ -7740,31 +7845,6 @@
|
|
|
7740
7845
|
return LoanCollection;
|
|
7741
7846
|
}(Collection));
|
|
7742
7847
|
|
|
7743
|
-
var MessageCollection = /** @class */ (function (_super) {
|
|
7744
|
-
__extends(MessageCollection, _super);
|
|
7745
|
-
function MessageCollection() {
|
|
7746
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
7747
|
-
}
|
|
7748
|
-
MessageCollection.prototype.getFirstUnreadMessage = function (user) {
|
|
7749
|
-
return this.items.find(function (message) {
|
|
7750
|
-
return !message.isRead() && message.isFromEmployee() !== user.isEmployee();
|
|
7751
|
-
});
|
|
7752
|
-
};
|
|
7753
|
-
/**
|
|
7754
|
-
* Get List of unread chats
|
|
7755
|
-
*/
|
|
7756
|
-
MessageCollection.prototype.getUnread = function () {
|
|
7757
|
-
return this.items.filter(function (message) { return !message.readAt; });
|
|
7758
|
-
};
|
|
7759
|
-
/**
|
|
7760
|
-
* Check if chat has unread chats
|
|
7761
|
-
*/
|
|
7762
|
-
MessageCollection.prototype.hasUnread = function () {
|
|
7763
|
-
return !!this.getUnread().length;
|
|
7764
|
-
};
|
|
7765
|
-
return MessageCollection;
|
|
7766
|
-
}(Collection));
|
|
7767
|
-
|
|
7768
7848
|
/**
|
|
7769
7849
|
* Collection of MessageDocument instances
|
|
7770
7850
|
*/
|
|
@@ -8726,12 +8806,6 @@
|
|
|
8726
8806
|
ChartAccountsTypeEnum[ChartAccountsTypeEnum["EXPENSE"] = 2] = "EXPENSE";
|
|
8727
8807
|
})(exports.ChartAccountsTypeEnum || (exports.ChartAccountsTypeEnum = {}));
|
|
8728
8808
|
|
|
8729
|
-
exports.ChatStatusEnum = void 0;
|
|
8730
|
-
(function (ChatStatusEnum) {
|
|
8731
|
-
ChatStatusEnum[ChatStatusEnum["ACTIVE"] = 1] = "ACTIVE";
|
|
8732
|
-
ChatStatusEnum[ChatStatusEnum["INACTIVE"] = 2] = "INACTIVE";
|
|
8733
|
-
})(exports.ChatStatusEnum || (exports.ChatStatusEnum = {}));
|
|
8734
|
-
|
|
8735
8809
|
exports.ClientDetailsMedicareExemptionEnum = void 0;
|
|
8736
8810
|
(function (ClientDetailsMedicareExemptionEnum) {
|
|
8737
8811
|
ClientDetailsMedicareExemptionEnum[ClientDetailsMedicareExemptionEnum["NO"] = 0] = "NO";
|
|
@@ -9581,6 +9655,9 @@
|
|
|
9581
9655
|
__decorate([
|
|
9582
9656
|
classTransformer.Type(function () { return User; })
|
|
9583
9657
|
], Message.prototype, "employee", void 0);
|
|
9658
|
+
__decorate([
|
|
9659
|
+
classTransformer.Type(function () { return Chat; })
|
|
9660
|
+
], Message.prototype, "chat", void 0);
|
|
9584
9661
|
__decorate([
|
|
9585
9662
|
classTransformer.Type(function () { return MessageDocument; }),
|
|
9586
9663
|
classTransformer.Expose()
|
|
@@ -9842,42 +9919,6 @@
|
|
|
9842
9919
|
AlphabetColorsEnum["Z"] = "#E3C9CE";
|
|
9843
9920
|
})(exports.AlphabetColorsEnum || (exports.AlphabetColorsEnum = {}));
|
|
9844
9921
|
|
|
9845
|
-
/**
|
|
9846
|
-
* List of objects grouped by passed property
|
|
9847
|
-
*/
|
|
9848
|
-
var Dictionary = /** @class */ (function () {
|
|
9849
|
-
function Dictionary(items, path) {
|
|
9850
|
-
if (path === void 0) { path = 'id'; }
|
|
9851
|
-
this.items = {};
|
|
9852
|
-
if (!items.length) {
|
|
9853
|
-
return;
|
|
9854
|
-
}
|
|
9855
|
-
// Do nothing if provided path was not found in the 1st item
|
|
9856
|
-
if (!hasIn__default["default"](items[0], path.split('.')[0])) {
|
|
9857
|
-
return;
|
|
9858
|
-
}
|
|
9859
|
-
this.groupItems(items, path);
|
|
9860
|
-
}
|
|
9861
|
-
Dictionary.prototype.add = function (key, value) {
|
|
9862
|
-
this.items[key] = value;
|
|
9863
|
-
};
|
|
9864
|
-
Dictionary.prototype.get = function (key) {
|
|
9865
|
-
return this.items[key] !== undefined ? this.items[key] : null;
|
|
9866
|
-
};
|
|
9867
|
-
Dictionary.prototype.groupItems = function (items, path) {
|
|
9868
|
-
var _this = this;
|
|
9869
|
-
items.forEach(function (item) {
|
|
9870
|
-
var key = get__default["default"](item, path);
|
|
9871
|
-
// if object does not have property for grouping it will be grouped as 'other'
|
|
9872
|
-
if (key === undefined) {
|
|
9873
|
-
key = 'other';
|
|
9874
|
-
}
|
|
9875
|
-
_this.items[key] = item;
|
|
9876
|
-
});
|
|
9877
|
-
};
|
|
9878
|
-
return Dictionary;
|
|
9879
|
-
}());
|
|
9880
|
-
|
|
9881
9922
|
exports.DepreciationGroupEnum = void 0;
|
|
9882
9923
|
(function (DepreciationGroupEnum) {
|
|
9883
9924
|
DepreciationGroupEnum[DepreciationGroupEnum["BUILDING_IMPROVEMENTS"] = 0] = "BUILDING_IMPROVEMENTS";
|
|
@@ -18910,6 +18951,7 @@
|
|
|
18910
18951
|
exports.ChartData = ChartData;
|
|
18911
18952
|
exports.ChartSerie = ChartSerie;
|
|
18912
18953
|
exports.Chat = Chat;
|
|
18954
|
+
exports.ChatCollection = ChatCollection;
|
|
18913
18955
|
exports.ChatService = ChatService;
|
|
18914
18956
|
exports.ClientCollection = ClientCollection;
|
|
18915
18957
|
exports.ClientDetails = ClientDetails;
|