@react-pakistan/util-functions 1.25.40 → 1.25.42
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/api/stellar-solutions/type.d.ts +175 -4
- package/api/stellar-solutions/type.js +59 -6
- package/general/generic-cache.js +15 -17
- package/package.json +1 -1
|
@@ -21,10 +21,6 @@ export declare enum QUOTE_STATUS {
|
|
|
21
21
|
ACCEPTED = "ACCEPTED",
|
|
22
22
|
DECLINED = "DECLINED"
|
|
23
23
|
}
|
|
24
|
-
export declare enum QUOTE_INVOICE_MODE {
|
|
25
|
-
CUSTOMER = "CUSTOMER",
|
|
26
|
-
COMPANY = "COMPANY"
|
|
27
|
-
}
|
|
28
24
|
export declare enum PAYMENT_TYPE {
|
|
29
25
|
FULL_AMOUNT = "FULL_AMOUNT",
|
|
30
26
|
PARTIAL_AMOUNT = "PARTIAL_AMOUNT"
|
|
@@ -70,6 +66,52 @@ export declare enum LS_KEYS {
|
|
|
70
66
|
PRODUCTS = "stellar_products_cache",
|
|
71
67
|
TAXES = "stellar_taxes_cache"
|
|
72
68
|
}
|
|
69
|
+
export declare enum POS_ORDER_STATUS {
|
|
70
|
+
OPEN = "OPEN",
|
|
71
|
+
CLOSED = "CLOSED",
|
|
72
|
+
CANCELLED = "CANCELLED",
|
|
73
|
+
REFUNDED = "REFUNDED"
|
|
74
|
+
}
|
|
75
|
+
export declare enum POS_PAYMENT_STATUS {
|
|
76
|
+
PENDING = "PENDING",
|
|
77
|
+
PAID = "PAID",
|
|
78
|
+
FAILED = "FAILED",
|
|
79
|
+
REFUNDED = "REFUNDED"
|
|
80
|
+
}
|
|
81
|
+
export declare enum POS_PAYMENT_METHOD_TYPE {
|
|
82
|
+
CASH = "CASH",
|
|
83
|
+
CARD = "CARD",
|
|
84
|
+
GIFT_CARD = "GIFT_CARD",
|
|
85
|
+
MOBILE_WALLET = "MOBILE_WALLET",
|
|
86
|
+
OTHER = "OTHER"
|
|
87
|
+
}
|
|
88
|
+
export declare enum POS_REGISTER_STATUS {
|
|
89
|
+
ACTIVE = "ACTIVE",
|
|
90
|
+
INACTIVE = "INACTIVE"
|
|
91
|
+
}
|
|
92
|
+
export declare enum POS_TAX_TYPE {
|
|
93
|
+
EXCLUSIVE = "EXCLUSIVE",
|
|
94
|
+
INCLUSIVE = "INCLUSIVE"
|
|
95
|
+
}
|
|
96
|
+
export declare enum POS_TABLE_STATUS {
|
|
97
|
+
AVAILABLE = "AVAILABLE",
|
|
98
|
+
OCCUPIED = "OCCUPIED",
|
|
99
|
+
RESERVED = "RESERVED"
|
|
100
|
+
}
|
|
101
|
+
export declare enum POS_RESERVATION_STATUS {
|
|
102
|
+
PENDING = "PENDING",
|
|
103
|
+
CONFIRMED = "CONFIRMED",
|
|
104
|
+
CANCELLED = "CANCELLED",
|
|
105
|
+
COMPLETED = "COMPLETED"
|
|
106
|
+
}
|
|
107
|
+
export declare enum POS_SHIFT_STATUS {
|
|
108
|
+
OPEN = "OPEN",
|
|
109
|
+
CLOSED = "CLOSED"
|
|
110
|
+
}
|
|
111
|
+
export declare enum POS_DISCOUNT_TYPE {
|
|
112
|
+
FIXED = "FIXED",
|
|
113
|
+
PERCENTAGE = "PERCENTAGE"
|
|
114
|
+
}
|
|
73
115
|
/**
|
|
74
116
|
* Base entity interface with common audit fields and meta support
|
|
75
117
|
*/
|
|
@@ -323,3 +365,132 @@ export interface QuotesInvoicesOnStellarProducts {
|
|
|
323
365
|
quantity: number;
|
|
324
366
|
quoteInvoiceId: string;
|
|
325
367
|
}
|
|
368
|
+
export interface POSStoreBE extends BaseEntity {
|
|
369
|
+
name: string;
|
|
370
|
+
code?: string;
|
|
371
|
+
address?: string;
|
|
372
|
+
phone?: string;
|
|
373
|
+
email?: string;
|
|
374
|
+
currency: string;
|
|
375
|
+
meta?: any;
|
|
376
|
+
enabled: boolean;
|
|
377
|
+
}
|
|
378
|
+
export interface POSRegisterBE extends BaseEntity {
|
|
379
|
+
name: string;
|
|
380
|
+
storeId: string;
|
|
381
|
+
status: POS_REGISTER_STATUS;
|
|
382
|
+
meta?: any;
|
|
383
|
+
}
|
|
384
|
+
export interface POSShiftBE extends BaseEntity {
|
|
385
|
+
registerId: string;
|
|
386
|
+
openedByUserId?: string;
|
|
387
|
+
openedAt: Date;
|
|
388
|
+
closedAt?: Date;
|
|
389
|
+
openingAmount: number;
|
|
390
|
+
closingAmount?: number;
|
|
391
|
+
status: POS_SHIFT_STATUS;
|
|
392
|
+
meta?: any;
|
|
393
|
+
}
|
|
394
|
+
export interface POSCategoryBE extends BaseEntity {
|
|
395
|
+
name: string;
|
|
396
|
+
description?: string;
|
|
397
|
+
storeId: string;
|
|
398
|
+
parentId?: string;
|
|
399
|
+
meta?: any;
|
|
400
|
+
}
|
|
401
|
+
export interface POSProductBE extends BaseEntity {
|
|
402
|
+
sku?: string;
|
|
403
|
+
name: string;
|
|
404
|
+
description?: string;
|
|
405
|
+
price: number;
|
|
406
|
+
cost?: number;
|
|
407
|
+
stock: number;
|
|
408
|
+
storeId: string;
|
|
409
|
+
categoryId?: string;
|
|
410
|
+
meta?: any;
|
|
411
|
+
}
|
|
412
|
+
export interface POSProductVariantBE extends BaseEntity {
|
|
413
|
+
productId: string;
|
|
414
|
+
name: string;
|
|
415
|
+
sku?: string;
|
|
416
|
+
price: number;
|
|
417
|
+
stock: number;
|
|
418
|
+
meta?: any;
|
|
419
|
+
}
|
|
420
|
+
export interface POSCustomerBE extends BaseEntity {
|
|
421
|
+
name: string;
|
|
422
|
+
email?: string;
|
|
423
|
+
phone?: string;
|
|
424
|
+
storeId: string;
|
|
425
|
+
loyaltyPoints: number;
|
|
426
|
+
meta?: any;
|
|
427
|
+
}
|
|
428
|
+
export interface POSTableBE extends BaseEntity {
|
|
429
|
+
storeId: string;
|
|
430
|
+
name: string;
|
|
431
|
+
seats: number;
|
|
432
|
+
status: POS_TABLE_STATUS;
|
|
433
|
+
meta?: any;
|
|
434
|
+
}
|
|
435
|
+
export interface POSReservationBE extends BaseEntity {
|
|
436
|
+
tableId: string;
|
|
437
|
+
customerId: string;
|
|
438
|
+
startAt: Date;
|
|
439
|
+
endAt: Date;
|
|
440
|
+
partySize: number;
|
|
441
|
+
status: POS_RESERVATION_STATUS;
|
|
442
|
+
meta?: any;
|
|
443
|
+
}
|
|
444
|
+
export interface POSOrderBE extends BaseEntity {
|
|
445
|
+
orderNumber: string;
|
|
446
|
+
storeId: string;
|
|
447
|
+
registerId?: string;
|
|
448
|
+
customerId?: string;
|
|
449
|
+
tableId?: string;
|
|
450
|
+
status: POS_ORDER_STATUS;
|
|
451
|
+
paymentStatus: POS_PAYMENT_STATUS;
|
|
452
|
+
subTotal: number;
|
|
453
|
+
taxTotal: number;
|
|
454
|
+
discountTotal: number;
|
|
455
|
+
serviceCharge: number;
|
|
456
|
+
total: number;
|
|
457
|
+
note?: string;
|
|
458
|
+
meta?: any;
|
|
459
|
+
}
|
|
460
|
+
export interface POSOrderItemBE extends BaseEntity {
|
|
461
|
+
orderId: string;
|
|
462
|
+
productId?: string;
|
|
463
|
+
variantId?: string;
|
|
464
|
+
name: string;
|
|
465
|
+
quantity: number;
|
|
466
|
+
unitPrice: number;
|
|
467
|
+
total: number;
|
|
468
|
+
taxAmount: number;
|
|
469
|
+
discountAmount: number;
|
|
470
|
+
meta?: any;
|
|
471
|
+
}
|
|
472
|
+
export interface POSPaymentBE extends BaseEntity {
|
|
473
|
+
orderId: string;
|
|
474
|
+
amount: number;
|
|
475
|
+
method: POS_PAYMENT_METHOD_TYPE;
|
|
476
|
+
methodLabel?: string;
|
|
477
|
+
status: POS_PAYMENT_STATUS;
|
|
478
|
+
transactionRef?: string;
|
|
479
|
+
processedAt?: Date;
|
|
480
|
+
meta?: any;
|
|
481
|
+
}
|
|
482
|
+
export interface POSTaxBE extends BaseEntity {
|
|
483
|
+
name: string;
|
|
484
|
+
rate: number;
|
|
485
|
+
type: POS_TAX_TYPE;
|
|
486
|
+
isDefault: boolean;
|
|
487
|
+
storeId: string;
|
|
488
|
+
meta?: any;
|
|
489
|
+
}
|
|
490
|
+
export interface POSDiscountBE extends BaseEntity {
|
|
491
|
+
name: string;
|
|
492
|
+
type: POS_DISCOUNT_TYPE;
|
|
493
|
+
value: number;
|
|
494
|
+
storeId: string;
|
|
495
|
+
meta?: any;
|
|
496
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// ENUMS
|
|
4
4
|
// ============================================================================
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.LS_KEYS = exports.LEAD_STATUS = exports.LEAD_TYPE = exports.LEAD_SOURCE = exports.PAYMENT_TYPE = exports.
|
|
6
|
+
exports.POS_DISCOUNT_TYPE = exports.POS_SHIFT_STATUS = exports.POS_RESERVATION_STATUS = exports.POS_TABLE_STATUS = exports.POS_TAX_TYPE = exports.POS_REGISTER_STATUS = exports.POS_PAYMENT_METHOD_TYPE = exports.POS_PAYMENT_STATUS = exports.POS_ORDER_STATUS = exports.LS_KEYS = exports.LEAD_STATUS = exports.LEAD_TYPE = exports.LEAD_SOURCE = exports.PAYMENT_TYPE = exports.QUOTE_STATUS = exports.INVOICE_STATUS = exports.DISCOUNT_UNIT = exports.QUOTE_INVOICE_CATEGORY = exports.GENDER = void 0;
|
|
7
7
|
var GENDER;
|
|
8
8
|
(function (GENDER) {
|
|
9
9
|
GENDER["MALE"] = "MALE";
|
|
@@ -32,11 +32,6 @@ var QUOTE_STATUS;
|
|
|
32
32
|
QUOTE_STATUS["ACCEPTED"] = "ACCEPTED";
|
|
33
33
|
QUOTE_STATUS["DECLINED"] = "DECLINED";
|
|
34
34
|
})(QUOTE_STATUS || (exports.QUOTE_STATUS = QUOTE_STATUS = {}));
|
|
35
|
-
var QUOTE_INVOICE_MODE;
|
|
36
|
-
(function (QUOTE_INVOICE_MODE) {
|
|
37
|
-
QUOTE_INVOICE_MODE["CUSTOMER"] = "CUSTOMER";
|
|
38
|
-
QUOTE_INVOICE_MODE["COMPANY"] = "COMPANY";
|
|
39
|
-
})(QUOTE_INVOICE_MODE || (exports.QUOTE_INVOICE_MODE = QUOTE_INVOICE_MODE = {}));
|
|
40
35
|
var PAYMENT_TYPE;
|
|
41
36
|
(function (PAYMENT_TYPE) {
|
|
42
37
|
PAYMENT_TYPE["FULL_AMOUNT"] = "FULL_AMOUNT";
|
|
@@ -87,3 +82,61 @@ var LS_KEYS;
|
|
|
87
82
|
LS_KEYS["PRODUCTS"] = "stellar_products_cache";
|
|
88
83
|
LS_KEYS["TAXES"] = "stellar_taxes_cache";
|
|
89
84
|
})(LS_KEYS || (exports.LS_KEYS = LS_KEYS = {}));
|
|
85
|
+
// ============================================================================
|
|
86
|
+
// POS ENUMS
|
|
87
|
+
// ============================================================================
|
|
88
|
+
var POS_ORDER_STATUS;
|
|
89
|
+
(function (POS_ORDER_STATUS) {
|
|
90
|
+
POS_ORDER_STATUS["OPEN"] = "OPEN";
|
|
91
|
+
POS_ORDER_STATUS["CLOSED"] = "CLOSED";
|
|
92
|
+
POS_ORDER_STATUS["CANCELLED"] = "CANCELLED";
|
|
93
|
+
POS_ORDER_STATUS["REFUNDED"] = "REFUNDED";
|
|
94
|
+
})(POS_ORDER_STATUS || (exports.POS_ORDER_STATUS = POS_ORDER_STATUS = {}));
|
|
95
|
+
var POS_PAYMENT_STATUS;
|
|
96
|
+
(function (POS_PAYMENT_STATUS) {
|
|
97
|
+
POS_PAYMENT_STATUS["PENDING"] = "PENDING";
|
|
98
|
+
POS_PAYMENT_STATUS["PAID"] = "PAID";
|
|
99
|
+
POS_PAYMENT_STATUS["FAILED"] = "FAILED";
|
|
100
|
+
POS_PAYMENT_STATUS["REFUNDED"] = "REFUNDED";
|
|
101
|
+
})(POS_PAYMENT_STATUS || (exports.POS_PAYMENT_STATUS = POS_PAYMENT_STATUS = {}));
|
|
102
|
+
var POS_PAYMENT_METHOD_TYPE;
|
|
103
|
+
(function (POS_PAYMENT_METHOD_TYPE) {
|
|
104
|
+
POS_PAYMENT_METHOD_TYPE["CASH"] = "CASH";
|
|
105
|
+
POS_PAYMENT_METHOD_TYPE["CARD"] = "CARD";
|
|
106
|
+
POS_PAYMENT_METHOD_TYPE["GIFT_CARD"] = "GIFT_CARD";
|
|
107
|
+
POS_PAYMENT_METHOD_TYPE["MOBILE_WALLET"] = "MOBILE_WALLET";
|
|
108
|
+
POS_PAYMENT_METHOD_TYPE["OTHER"] = "OTHER";
|
|
109
|
+
})(POS_PAYMENT_METHOD_TYPE || (exports.POS_PAYMENT_METHOD_TYPE = POS_PAYMENT_METHOD_TYPE = {}));
|
|
110
|
+
var POS_REGISTER_STATUS;
|
|
111
|
+
(function (POS_REGISTER_STATUS) {
|
|
112
|
+
POS_REGISTER_STATUS["ACTIVE"] = "ACTIVE";
|
|
113
|
+
POS_REGISTER_STATUS["INACTIVE"] = "INACTIVE";
|
|
114
|
+
})(POS_REGISTER_STATUS || (exports.POS_REGISTER_STATUS = POS_REGISTER_STATUS = {}));
|
|
115
|
+
var POS_TAX_TYPE;
|
|
116
|
+
(function (POS_TAX_TYPE) {
|
|
117
|
+
POS_TAX_TYPE["EXCLUSIVE"] = "EXCLUSIVE";
|
|
118
|
+
POS_TAX_TYPE["INCLUSIVE"] = "INCLUSIVE";
|
|
119
|
+
})(POS_TAX_TYPE || (exports.POS_TAX_TYPE = POS_TAX_TYPE = {}));
|
|
120
|
+
var POS_TABLE_STATUS;
|
|
121
|
+
(function (POS_TABLE_STATUS) {
|
|
122
|
+
POS_TABLE_STATUS["AVAILABLE"] = "AVAILABLE";
|
|
123
|
+
POS_TABLE_STATUS["OCCUPIED"] = "OCCUPIED";
|
|
124
|
+
POS_TABLE_STATUS["RESERVED"] = "RESERVED";
|
|
125
|
+
})(POS_TABLE_STATUS || (exports.POS_TABLE_STATUS = POS_TABLE_STATUS = {}));
|
|
126
|
+
var POS_RESERVATION_STATUS;
|
|
127
|
+
(function (POS_RESERVATION_STATUS) {
|
|
128
|
+
POS_RESERVATION_STATUS["PENDING"] = "PENDING";
|
|
129
|
+
POS_RESERVATION_STATUS["CONFIRMED"] = "CONFIRMED";
|
|
130
|
+
POS_RESERVATION_STATUS["CANCELLED"] = "CANCELLED";
|
|
131
|
+
POS_RESERVATION_STATUS["COMPLETED"] = "COMPLETED";
|
|
132
|
+
})(POS_RESERVATION_STATUS || (exports.POS_RESERVATION_STATUS = POS_RESERVATION_STATUS = {}));
|
|
133
|
+
var POS_SHIFT_STATUS;
|
|
134
|
+
(function (POS_SHIFT_STATUS) {
|
|
135
|
+
POS_SHIFT_STATUS["OPEN"] = "OPEN";
|
|
136
|
+
POS_SHIFT_STATUS["CLOSED"] = "CLOSED";
|
|
137
|
+
})(POS_SHIFT_STATUS || (exports.POS_SHIFT_STATUS = POS_SHIFT_STATUS = {}));
|
|
138
|
+
var POS_DISCOUNT_TYPE;
|
|
139
|
+
(function (POS_DISCOUNT_TYPE) {
|
|
140
|
+
POS_DISCOUNT_TYPE["FIXED"] = "FIXED";
|
|
141
|
+
POS_DISCOUNT_TYPE["PERCENTAGE"] = "PERCENTAGE";
|
|
142
|
+
})(POS_DISCOUNT_TYPE || (exports.POS_DISCOUNT_TYPE = POS_DISCOUNT_TYPE = {}));
|
package/general/generic-cache.js
CHANGED
|
@@ -176,7 +176,7 @@ exports.getCachedDataSync = getCachedDataSync;
|
|
|
176
176
|
* const active = await getCachedData<UserBE>({ config, filters: { enabled: true }, pageLimit: 200 });
|
|
177
177
|
*/
|
|
178
178
|
var getCachedData = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
|
|
179
|
-
var config, params, headers, cacheKey, apiUrl, responseKey, expirationMs, fallBackPageLimit, fallBackCurrentPage, filters, searchQuery, paramsWithoutFilters_1, otherParams_1, queryObj_1, searchParams_1, response_1, items_1, respCurrentPageRaw_1, respCurrentPage_1, requestCurrentPage_1, raw, currentTime, cachedTime, ageInMs, cachedTime, ageInMs, itemsArray, storedCount, cachedCurrentPage, requestedCurrentPage, paramsWithoutFilters_2, otherParams_2, queryObj_2, searchParams_2, response_2,
|
|
179
|
+
var config, params, headers, cacheKey, apiUrl, responseKey, expirationMs, fallBackPageLimit, fallBackCurrentPage, filters, searchQuery, paramsWithoutFilters_1, otherParams_1, queryObj_1, searchParams_1, response_1, itemsRaw_1, items_1, respCurrentPageRaw_1, respCurrentPage_1, requestCurrentPage_1, raw, currentTime, cachedTime, ageInMs, cachedTime, ageInMs, itemsArray, storedCount, cachedCurrentPage, requestedCurrentPage, paramsWithoutFilters_2, otherParams_2, queryObj_2, searchParams_2, response_2, itemsRaw_2, fetchedItems, respCount, respCurrentPageRaw_2, respCurrentPage_2, newItemsMap, mergedItemsMap, mergedItemsArray, newCount, newCurrentPage, shouldCache_1, updatedCache, paramsWithoutFilters_3, otherParams, queryObj, searchParams, response, itemsRaw, items, count, respCurrentPageRaw, respCurrentPage, requestCurrentPage, shouldCache, itemsMap, updatedCache, error_1;
|
|
180
180
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
181
181
|
return __generator(this, function (_v) {
|
|
182
182
|
switch (_v.label) {
|
|
@@ -191,8 +191,7 @@ var getCachedData = function (opts) { return __awaiter(void 0, void 0, void 0, f
|
|
|
191
191
|
_v.label = 1;
|
|
192
192
|
case 1:
|
|
193
193
|
_v.trys.push([1, 8, , 9]);
|
|
194
|
-
if (!((searchQuery && searchQuery.trim()) ||
|
|
195
|
-
(filters && Object.keys(filters).length > 0))) return [3 /*break*/, 3];
|
|
194
|
+
if (!((searchQuery && searchQuery.trim()) || (params === null || params === void 0 ? void 0 : params.filters))) return [3 /*break*/, 3];
|
|
196
195
|
paramsWithoutFilters_1 = __assign({}, (params || {}));
|
|
197
196
|
if (paramsWithoutFilters_1.filters !== undefined) {
|
|
198
197
|
delete paramsWithoutFilters_1.filters;
|
|
@@ -215,9 +214,10 @@ var getCachedData = function (opts) { return __awaiter(void 0, void 0, void 0, f
|
|
|
215
214
|
})];
|
|
216
215
|
case 2:
|
|
217
216
|
response_1 = _v.sent();
|
|
218
|
-
|
|
219
|
-
? (
|
|
220
|
-
: ((_g = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _g === void 0 ? void 0 : _g.items) || (response_1 === null || response_1 === void 0 ? void 0 : response_1.data)
|
|
217
|
+
itemsRaw_1 = responseKey
|
|
218
|
+
? (_f = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _f === void 0 ? void 0 : _f[responseKey]
|
|
219
|
+
: ((_g = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _g === void 0 ? void 0 : _g.items) || (response_1 === null || response_1 === void 0 ? void 0 : response_1.data);
|
|
220
|
+
items_1 = Array.isArray(itemsRaw_1) ? itemsRaw_1 : [];
|
|
221
221
|
respCurrentPageRaw_1 = (_h = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _h === void 0 ? void 0 : _h.currentPage;
|
|
222
222
|
respCurrentPage_1 = respCurrentPageRaw_1 == null ? undefined : Number(respCurrentPageRaw_1);
|
|
223
223
|
requestCurrentPage_1 = (params === null || params === void 0 ? void 0 : params.currentPage)
|
|
@@ -271,12 +271,12 @@ var getCachedData = function (opts) { return __awaiter(void 0, void 0, void 0, f
|
|
|
271
271
|
})];
|
|
272
272
|
case 4:
|
|
273
273
|
response_2 = _v.sent();
|
|
274
|
-
|
|
274
|
+
itemsRaw_2 = (responseKey
|
|
275
275
|
? (_l = response_2 === null || response_2 === void 0 ? void 0 : response_2.data) === null || _l === void 0 ? void 0 : _l[responseKey]
|
|
276
|
-
: (_m = response_2 === null || response_2 === void 0 ? void 0 : response_2.data) === null || _m === void 0 ? void 0 : _m.items) ||
|
|
277
|
-
fetchedItems = Array.isArray(
|
|
278
|
-
?
|
|
279
|
-
: [
|
|
276
|
+
: (_m = response_2 === null || response_2 === void 0 ? void 0 : response_2.data) === null || _m === void 0 ? void 0 : _m.items) || (response_2 === null || response_2 === void 0 ? void 0 : response_2.data);
|
|
277
|
+
fetchedItems = Array.isArray(itemsRaw_2)
|
|
278
|
+
? itemsRaw_2
|
|
279
|
+
: [];
|
|
280
280
|
respCount = (_o = response_2 === null || response_2 === void 0 ? void 0 : response_2.data) === null || _o === void 0 ? void 0 : _o.count;
|
|
281
281
|
respCurrentPageRaw_2 = (_p = response_2 === null || response_2 === void 0 ? void 0 : response_2.data) === null || _p === void 0 ? void 0 : _p.currentPage;
|
|
282
282
|
respCurrentPage_2 = respCurrentPageRaw_2 == null ? undefined : Number(respCurrentPageRaw_2);
|
|
@@ -292,7 +292,7 @@ var getCachedData = function (opts) { return __awaiter(void 0, void 0, void 0, f
|
|
|
292
292
|
mergedItemsArray = Object.values(mergedItemsMap);
|
|
293
293
|
newCount = respCount !== null && respCount !== void 0 ? respCount : mergedItemsArray.length;
|
|
294
294
|
newCurrentPage = respCurrentPage_2 !== null && respCurrentPage_2 !== void 0 ? respCurrentPage_2 : requestedCurrentPage;
|
|
295
|
-
shouldCache_1 = Array.isArray(
|
|
295
|
+
shouldCache_1 = Array.isArray(itemsRaw_2) && typeof respCount === 'number';
|
|
296
296
|
if (shouldCache_1) {
|
|
297
297
|
updatedCache = {
|
|
298
298
|
items: mergedItemsMap,
|
|
@@ -331,17 +331,15 @@ var getCachedData = function (opts) { return __awaiter(void 0, void 0, void 0, f
|
|
|
331
331
|
case 7:
|
|
332
332
|
response = _v.sent();
|
|
333
333
|
itemsRaw = (responseKey ? (_r = response === null || response === void 0 ? void 0 : response.data) === null || _r === void 0 ? void 0 : _r[responseKey] : (_s = response === null || response === void 0 ? void 0 : response.data) === null || _s === void 0 ? void 0 : _s.items) ||
|
|
334
|
-
|
|
335
|
-
items = Array.isArray(itemsRaw)
|
|
336
|
-
? itemsRaw
|
|
337
|
-
: [itemsRaw];
|
|
334
|
+
(response === null || response === void 0 ? void 0 : response.data);
|
|
335
|
+
items = Array.isArray(itemsRaw) ? itemsRaw : [];
|
|
338
336
|
count = (_t = response === null || response === void 0 ? void 0 : response.data) === null || _t === void 0 ? void 0 : _t.count;
|
|
339
337
|
respCurrentPageRaw = (_u = response === null || response === void 0 ? void 0 : response.data) === null || _u === void 0 ? void 0 : _u.currentPage;
|
|
340
338
|
respCurrentPage = respCurrentPageRaw == null ? undefined : Number(respCurrentPageRaw);
|
|
341
339
|
requestCurrentPage = (params === null || params === void 0 ? void 0 : params.currentPage)
|
|
342
340
|
? Number(params.currentPage)
|
|
343
341
|
: undefined;
|
|
344
|
-
shouldCache = Array.isArray(itemsRaw) && count
|
|
342
|
+
shouldCache = Array.isArray(itemsRaw) && typeof count === 'number';
|
|
345
343
|
if (shouldCache) {
|
|
346
344
|
itemsMap = items.reduce(function (acc, item, idx) {
|
|
347
345
|
var _a, _b;
|