monkey-front-core 0.0.150 → 0.0.153
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/esm2020/lib/core/interfaces/schedules/monkeyecx-request-schedule.mjs +1 -1
- package/esm2020/lib/core/services/commons/monkeyecx-commons.service.mjs +23 -22
- package/esm2020/lib/core/services/logged/monkeyecx-logged-handling.service.mjs +12 -1
- package/esm2020/lib/core/services/schedules/monkeyecx-request-schedule.service.mjs +93 -22
- package/esm2020/lib/core/utils/utils.mjs +4 -1
- package/fesm2015/monkey-front-core.mjs +99 -29
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +127 -41
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/interfaces/schedules/monkeyecx-request-schedule.d.ts +2 -0
- package/lib/core/services/commons/monkeyecx-commons.service.d.ts +2 -2
- package/lib/core/services/logged/monkeyecx-logged-handling.service.d.ts +3 -0
- package/lib/core/services/schedules/monkeyecx-request-schedule.service.d.ts +21 -3
- package/monkey-front-core-0.0.153.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.150.tgz +0 -0
|
@@ -81,6 +81,9 @@ class MonkeyEcxUtils {
|
|
|
81
81
|
}
|
|
82
82
|
static isCPFCNPJValid(document) {
|
|
83
83
|
document = document.replace(/[^\d]/g, '');
|
|
84
|
+
const handled = document.replace(document.charAt(0), '');
|
|
85
|
+
if (!handled)
|
|
86
|
+
return false;
|
|
84
87
|
if (document.length === 11) {
|
|
85
88
|
let base = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0];
|
|
86
89
|
for (var i = 0, n = 0; i < 9; n += document[i] * base[i++])
|
|
@@ -2129,6 +2132,7 @@ class MonkeyEcxCommonsService {
|
|
|
2129
2132
|
this.__onSearchChanged$ = new BehaviorSubject(null);
|
|
2130
2133
|
this.__onDataChanged$ = new BehaviorSubject(null);
|
|
2131
2134
|
this.__onLoadingInProgress$ = new BehaviorSubject(false);
|
|
2135
|
+
this.__onUploadInProgress$ = new BehaviorSubject(false);
|
|
2132
2136
|
this.__onDataDeleted$ = new BehaviorSubject(null);
|
|
2133
2137
|
this.__onErrorChanged$ = new BehaviorSubject(null);
|
|
2134
2138
|
this.__onGovernmentIdDataChanged$ = new BehaviorSubject(null);
|
|
@@ -2149,7 +2153,7 @@ class MonkeyEcxCommonsService {
|
|
|
2149
2153
|
}
|
|
2150
2154
|
if (this.otherArgs?.router) {
|
|
2151
2155
|
const { clearOnChangeRoute } = this.otherArgs?.schedule?.options || {
|
|
2152
|
-
clearOnChangeRoute: false
|
|
2156
|
+
clearOnChangeRoute: false
|
|
2153
2157
|
};
|
|
2154
2158
|
this.otherArgs.router.events
|
|
2155
2159
|
.pipe(filter((event) => {
|
|
@@ -2165,7 +2169,7 @@ class MonkeyEcxCommonsService {
|
|
|
2165
2169
|
}
|
|
2166
2170
|
navigateToPendencyPage(arg, router) {
|
|
2167
2171
|
const { companyType } = this.__tokenCredentials || {
|
|
2168
|
-
companyType: ''
|
|
2172
|
+
companyType: ''
|
|
2169
2173
|
};
|
|
2170
2174
|
let route = '/app';
|
|
2171
2175
|
if (companyType) {
|
|
@@ -2181,9 +2185,9 @@ class MonkeyEcxCommonsService {
|
|
|
2181
2185
|
else {
|
|
2182
2186
|
router.navigate([`${route}/company-pendency`.toLowerCase()], {
|
|
2183
2187
|
state: {
|
|
2184
|
-
pendencyData: arg
|
|
2188
|
+
pendencyData: arg
|
|
2185
2189
|
},
|
|
2186
|
-
skipLocationChange: true
|
|
2190
|
+
skipLocationChange: true
|
|
2187
2191
|
});
|
|
2188
2192
|
}
|
|
2189
2193
|
}
|
|
@@ -2199,7 +2203,7 @@ class MonkeyEcxCommonsService {
|
|
|
2199
2203
|
allowedSecurityAccessByPendency(args) {
|
|
2200
2204
|
if (!args) {
|
|
2201
2205
|
return {
|
|
2202
|
-
hasPendencies: false
|
|
2206
|
+
hasPendencies: false
|
|
2203
2207
|
};
|
|
2204
2208
|
}
|
|
2205
2209
|
const { service, type } = args;
|
|
@@ -2239,21 +2243,21 @@ class MonkeyEcxCommonsService {
|
|
|
2239
2243
|
403: 'forbidden',
|
|
2240
2244
|
404: 'not-found',
|
|
2241
2245
|
500: 'service-problems',
|
|
2242
|
-
503: 'service-problems'
|
|
2246
|
+
503: 'service-problems'
|
|
2243
2247
|
};
|
|
2244
2248
|
if (!router) {
|
|
2245
2249
|
console.error('Router must be declared');
|
|
2246
2250
|
}
|
|
2247
2251
|
else {
|
|
2248
2252
|
router?.navigate([`/app/pages/${routes[statusCode]}`.toLowerCase()], {
|
|
2249
|
-
skipLocationChange: true
|
|
2253
|
+
skipLocationChange: true
|
|
2250
2254
|
});
|
|
2251
2255
|
}
|
|
2252
2256
|
}
|
|
2253
2257
|
setPage(requestPaged) {
|
|
2254
2258
|
this.__requestPaged = {
|
|
2255
2259
|
...this.__requestPaged,
|
|
2256
|
-
...requestPaged
|
|
2260
|
+
...requestPaged
|
|
2257
2261
|
};
|
|
2258
2262
|
return this;
|
|
2259
2263
|
}
|
|
@@ -2270,8 +2274,8 @@ class MonkeyEcxCommonsService {
|
|
|
2270
2274
|
...this.__requestPaged,
|
|
2271
2275
|
page: {
|
|
2272
2276
|
...page,
|
|
2273
|
-
number: number + 1
|
|
2274
|
-
}
|
|
2277
|
+
number: number + 1
|
|
2278
|
+
}
|
|
2275
2279
|
};
|
|
2276
2280
|
return true;
|
|
2277
2281
|
}
|
|
@@ -2328,8 +2332,8 @@ class MonkeyEcxCommonsService {
|
|
|
2328
2332
|
this.setPage({
|
|
2329
2333
|
page: {
|
|
2330
2334
|
number: 0,
|
|
2331
|
-
size: 10
|
|
2332
|
-
}
|
|
2335
|
+
size: 10
|
|
2336
|
+
}
|
|
2333
2337
|
});
|
|
2334
2338
|
}
|
|
2335
2339
|
if (otherArgs?.translateOptions) {
|
|
@@ -2372,7 +2376,7 @@ class MonkeyEcxCommonsService {
|
|
|
2372
2376
|
getHTTPHeaderApplicationPDF() {
|
|
2373
2377
|
return {
|
|
2374
2378
|
observe: 'response',
|
|
2375
|
-
responseType: 'blob'
|
|
2379
|
+
responseType: 'blob'
|
|
2376
2380
|
};
|
|
2377
2381
|
}
|
|
2378
2382
|
genericMethod(link, data, callback) {
|
|
@@ -2400,8 +2404,8 @@ class MonkeyEcxCommonsService {
|
|
|
2400
2404
|
if (!this.__onLoadingInProgress$.value) {
|
|
2401
2405
|
const hasMorePages = this.setPage({
|
|
2402
2406
|
page: {
|
|
2403
|
-
...this.__page
|
|
2404
|
-
}
|
|
2407
|
+
...this.__page
|
|
2408
|
+
}
|
|
2405
2409
|
}).nextPage();
|
|
2406
2410
|
if (hasMorePages && this.__callbackPagination) {
|
|
2407
2411
|
this.__callbackPagination();
|
|
@@ -2416,24 +2420,24 @@ class MonkeyEcxCommonsService {
|
|
|
2416
2420
|
router.navigate([url], {
|
|
2417
2421
|
queryParams: {
|
|
2418
2422
|
...search,
|
|
2419
|
-
r: MonkeyEcxUtils.getRandomString(30)
|
|
2423
|
+
r: MonkeyEcxUtils.getRandomString(30)
|
|
2420
2424
|
},
|
|
2421
2425
|
queryParamsHandling: 'merge',
|
|
2422
|
-
...extras
|
|
2426
|
+
...extras
|
|
2423
2427
|
});
|
|
2424
2428
|
}
|
|
2425
2429
|
saveState(state) {
|
|
2426
2430
|
this.__savedState = {
|
|
2427
2431
|
page: this.__page,
|
|
2428
|
-
...state
|
|
2432
|
+
...state
|
|
2429
2433
|
};
|
|
2430
2434
|
}
|
|
2431
2435
|
}
|
|
2432
2436
|
__decorate([
|
|
2433
2437
|
MonkeyEcxCoreService({
|
|
2434
2438
|
requestInProgress: {
|
|
2435
|
-
showProgress: true
|
|
2436
|
-
}
|
|
2439
|
+
showProgress: true
|
|
2440
|
+
}
|
|
2437
2441
|
})
|
|
2438
2442
|
], MonkeyEcxCommonsService.prototype, "genericMethod", null);
|
|
2439
2443
|
|
|
@@ -4227,6 +4231,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
4227
4231
|
class MonkeyEcxLoggedHandlingService {
|
|
4228
4232
|
constructor() {
|
|
4229
4233
|
this.schedules = [];
|
|
4234
|
+
this.genericSchedules = [];
|
|
4230
4235
|
// not to do
|
|
4231
4236
|
}
|
|
4232
4237
|
destroySchedule() {
|
|
@@ -4235,11 +4240,21 @@ class MonkeyEcxLoggedHandlingService {
|
|
|
4235
4240
|
});
|
|
4236
4241
|
this.schedules = [];
|
|
4237
4242
|
}
|
|
4243
|
+
destroyGenericSchedule() {
|
|
4244
|
+
this.genericSchedules.forEach((sch) => {
|
|
4245
|
+
clearInterval(sch.interval);
|
|
4246
|
+
});
|
|
4247
|
+
this.genericSchedules = [];
|
|
4248
|
+
}
|
|
4238
4249
|
addSchedule(sch) {
|
|
4239
4250
|
this.schedules = sch;
|
|
4240
4251
|
}
|
|
4252
|
+
addGenericSchedule(sch) {
|
|
4253
|
+
this.genericSchedules = sch;
|
|
4254
|
+
}
|
|
4241
4255
|
destroy() {
|
|
4242
4256
|
this.destroySchedule();
|
|
4257
|
+
this.destroyGenericSchedule();
|
|
4243
4258
|
}
|
|
4244
4259
|
}
|
|
4245
4260
|
MonkeyEcxLoggedHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLoggedHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -4446,15 +4461,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
4446
4461
|
}], ctorParameters: function () { return [{ type: i1$3.Router }]; } });
|
|
4447
4462
|
|
|
4448
4463
|
class MonkeyEcxRequestScheduleService {
|
|
4449
|
-
constructor(monkeyecxService,
|
|
4464
|
+
constructor(monkeyecxService, monkeyLoggedHandlingService) {
|
|
4450
4465
|
this.monkeyecxService = monkeyecxService;
|
|
4451
|
-
this.
|
|
4466
|
+
this.monkeyLoggedHandlingService = monkeyLoggedHandlingService;
|
|
4452
4467
|
this.schedule = [];
|
|
4468
|
+
this.genericSchedule = [];
|
|
4453
4469
|
// not to do
|
|
4454
4470
|
}
|
|
4455
4471
|
addToSchedule(q) {
|
|
4456
4472
|
this.schedule.push(q);
|
|
4457
|
-
this.
|
|
4473
|
+
this.monkeyLoggedHandlingService.addSchedule(this.schedule);
|
|
4474
|
+
}
|
|
4475
|
+
addToGenericSchedule(q) {
|
|
4476
|
+
this.genericSchedule.push(q);
|
|
4477
|
+
this.monkeyLoggedHandlingService.addGenericSchedule(this.genericSchedule);
|
|
4458
4478
|
}
|
|
4459
4479
|
removeFromSchedule(q) {
|
|
4460
4480
|
clearInterval(q.interval);
|
|
@@ -4462,66 +4482,121 @@ class MonkeyEcxRequestScheduleService {
|
|
|
4462
4482
|
this.schedule = [
|
|
4463
4483
|
...saved.map((sch) => {
|
|
4464
4484
|
const savedLocal = {
|
|
4465
|
-
...sch
|
|
4485
|
+
...sch
|
|
4466
4486
|
};
|
|
4467
4487
|
if (sch.id === q.id) {
|
|
4468
4488
|
return null;
|
|
4469
4489
|
}
|
|
4470
4490
|
return savedLocal;
|
|
4471
|
-
})
|
|
4491
|
+
})
|
|
4492
|
+
].filter((_) => {
|
|
4493
|
+
return _;
|
|
4494
|
+
});
|
|
4495
|
+
this.monkeyLoggedHandlingService.addSchedule(this.schedule);
|
|
4496
|
+
}
|
|
4497
|
+
removeFromGenericSchedule(q) {
|
|
4498
|
+
clearInterval(q.interval);
|
|
4499
|
+
const saved = [...this.genericSchedule];
|
|
4500
|
+
this.genericSchedule = [
|
|
4501
|
+
...saved.map((sch) => {
|
|
4502
|
+
const savedLocal = {
|
|
4503
|
+
...sch
|
|
4504
|
+
};
|
|
4505
|
+
if (sch.id === q.id) {
|
|
4506
|
+
return null;
|
|
4507
|
+
}
|
|
4508
|
+
return savedLocal;
|
|
4509
|
+
})
|
|
4472
4510
|
].filter((_) => {
|
|
4473
4511
|
return _;
|
|
4474
4512
|
});
|
|
4475
|
-
this.
|
|
4513
|
+
this.monkeyLoggedHandlingService.addGenericSchedule(this.genericSchedule);
|
|
4476
4514
|
}
|
|
4477
4515
|
removeFromScheduleById(id) {
|
|
4478
4516
|
const q = this.getScheduleById(id);
|
|
4479
|
-
clearInterval(q
|
|
4517
|
+
clearInterval(q?.interval);
|
|
4480
4518
|
const saved = [...this.schedule];
|
|
4481
4519
|
this.schedule = [
|
|
4482
4520
|
...saved.map((sch) => {
|
|
4483
4521
|
const savedLocal = {
|
|
4484
|
-
...sch
|
|
4522
|
+
...sch
|
|
4485
4523
|
};
|
|
4486
|
-
if (sch.id === q
|
|
4524
|
+
if (sch.id === q?.id) {
|
|
4487
4525
|
return null;
|
|
4488
4526
|
}
|
|
4489
4527
|
return savedLocal;
|
|
4490
|
-
})
|
|
4528
|
+
})
|
|
4491
4529
|
].filter((_) => {
|
|
4492
4530
|
return _;
|
|
4493
4531
|
});
|
|
4494
|
-
this.
|
|
4532
|
+
this.monkeyLoggedHandlingService.addSchedule(this.schedule);
|
|
4495
4533
|
}
|
|
4496
4534
|
doCall(sch) {
|
|
4497
|
-
const { url, method, params, data, action } = sch;
|
|
4535
|
+
const { url, method, params, data, action, errorAction } = sch;
|
|
4536
|
+
const errAction = errorAction || ((...args) => { });
|
|
4498
4537
|
this.monkeyecxService[method.toLowerCase()](`${url}`, params).subscribe((resp) => {
|
|
4499
4538
|
action({
|
|
4500
4539
|
...data,
|
|
4501
|
-
...resp
|
|
4540
|
+
...resp
|
|
4502
4541
|
}, sch);
|
|
4503
|
-
}, () => {
|
|
4542
|
+
}, (err) => {
|
|
4504
4543
|
this.removeFromSchedule(sch);
|
|
4544
|
+
errAction({
|
|
4545
|
+
...data
|
|
4546
|
+
}, sch, err);
|
|
4547
|
+
});
|
|
4548
|
+
}
|
|
4549
|
+
doGenericCall(sch) {
|
|
4550
|
+
const { url, method, params, data, action, errorAction } = sch;
|
|
4551
|
+
const errAction = errorAction || ((...args) => { });
|
|
4552
|
+
this.monkeyecxService[method.toLowerCase()](`${url}`, params).subscribe((resp) => {
|
|
4553
|
+
action({
|
|
4554
|
+
...data,
|
|
4555
|
+
...resp
|
|
4556
|
+
}, sch);
|
|
4557
|
+
}, (err) => {
|
|
4558
|
+
this.removeFromGenericSchedule(sch);
|
|
4559
|
+
errAction({
|
|
4560
|
+
...data
|
|
4561
|
+
}, sch, err);
|
|
4505
4562
|
});
|
|
4506
4563
|
}
|
|
4507
4564
|
setSchedule(q, delay = 3000) {
|
|
4508
4565
|
const interval = setInterval(() => {
|
|
4509
4566
|
this.doCall({
|
|
4510
4567
|
...q,
|
|
4511
|
-
interval
|
|
4568
|
+
interval
|
|
4512
4569
|
});
|
|
4513
4570
|
}, delay);
|
|
4514
4571
|
const sch = {
|
|
4515
4572
|
...q,
|
|
4516
4573
|
id: `${MonkeyEcxUtils.getRandomString(40)}`,
|
|
4517
|
-
interval
|
|
4574
|
+
interval
|
|
4518
4575
|
};
|
|
4519
4576
|
this.addToSchedule(sch);
|
|
4520
4577
|
return sch;
|
|
4521
4578
|
}
|
|
4579
|
+
setGenericSchedule(q, delay = 3000) {
|
|
4580
|
+
const interval = setInterval(() => {
|
|
4581
|
+
this.doGenericCall({
|
|
4582
|
+
...q,
|
|
4583
|
+
interval
|
|
4584
|
+
});
|
|
4585
|
+
}, delay);
|
|
4586
|
+
const sch = {
|
|
4587
|
+
...q,
|
|
4588
|
+
id: `${MonkeyEcxUtils.getRandomString(40)}`,
|
|
4589
|
+
interval
|
|
4590
|
+
};
|
|
4591
|
+
this.addToGenericSchedule(sch);
|
|
4592
|
+
return sch;
|
|
4593
|
+
}
|
|
4522
4594
|
removeSchedule(q) {
|
|
4523
4595
|
this.removeFromSchedule(q);
|
|
4524
4596
|
}
|
|
4597
|
+
removeGenericSchedule(q) {
|
|
4598
|
+
this.removeFromGenericSchedule(q);
|
|
4599
|
+
}
|
|
4525
4600
|
removeScheduleById(id) {
|
|
4526
4601
|
this.removeFromScheduleById(id);
|
|
4527
4602
|
}
|
|
@@ -4537,19 +4612,30 @@ MonkeyEcxRequestScheduleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion
|
|
|
4537
4612
|
__decorate([
|
|
4538
4613
|
MonkeyEcxCoreService({
|
|
4539
4614
|
httpResponse: {
|
|
4540
|
-
httpCodeIgnore: [400, 403, 404, 500, 503]
|
|
4615
|
+
httpCodeIgnore: [400, 403, 404, 500, 503]
|
|
4541
4616
|
},
|
|
4542
4617
|
requestInProgress: {
|
|
4543
|
-
showProgress: false
|
|
4544
|
-
}
|
|
4618
|
+
showProgress: false
|
|
4619
|
+
}
|
|
4545
4620
|
})
|
|
4546
4621
|
], MonkeyEcxRequestScheduleService.prototype, "doCall", null);
|
|
4622
|
+
__decorate([
|
|
4623
|
+
MonkeyEcxCoreService({
|
|
4624
|
+
httpResponse: {
|
|
4625
|
+
httpCodeIgnore: [400, 401, 403, 404, 500, 503],
|
|
4626
|
+
httpCodeIgnoreRedirect: [503]
|
|
4627
|
+
},
|
|
4628
|
+
requestInProgress: {
|
|
4629
|
+
showProgress: false
|
|
4630
|
+
}
|
|
4631
|
+
})
|
|
4632
|
+
], MonkeyEcxRequestScheduleService.prototype, "doGenericCall", null);
|
|
4547
4633
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestScheduleService, decorators: [{
|
|
4548
4634
|
type: Injectable,
|
|
4549
4635
|
args: [{
|
|
4550
|
-
providedIn: 'root'
|
|
4636
|
+
providedIn: 'root'
|
|
4551
4637
|
}]
|
|
4552
|
-
}], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxLoggedHandlingService }]; }, propDecorators: { doCall: [] } });
|
|
4638
|
+
}], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxLoggedHandlingService }]; }, propDecorators: { doCall: [], doGenericCall: [] } });
|
|
4553
4639
|
|
|
4554
4640
|
/* eslint-disable no-unused-vars */
|
|
4555
4641
|
var OpSearch;
|