monkey-front-core 0.0.416 → 0.0.418
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/monkeyecx-store.mjs +1 -1
- package/esm2020/lib/core/services/store/monkeyecx-store.service.mjs +9 -9
- package/esm2020/lib/core/utils/utils.mjs +5 -1
- package/esm2020/lib/core/utils/validators.mjs +2 -2
- package/fesm2015/monkey-front-core.mjs +267 -264
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +264 -261
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/interfaces/monkeyecx-store.d.ts +2 -2
- package/lib/core/services/store/monkeyecx-store.service.d.ts +3 -4
- package/lib/core/utils/utils.d.ts +1 -0
- package/lib/core/utils/validators.d.ts +1 -0
- package/monkey-front-core-0.0.418.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.416.tgz +0 -0
|
@@ -137,6 +137,244 @@ var statics = /*#__PURE__*/Object.freeze({
|
|
|
137
137
|
get CountryMasks () { return CountryMasks; }
|
|
138
138
|
});
|
|
139
139
|
|
|
140
|
+
const moment$6 = moment_;
|
|
141
|
+
const EMAIL_REGEXP = /^[\w-.]+@([\w-]+\.)+[\w-]{1,64}$/;
|
|
142
|
+
function isEmptyInputValue(value) {
|
|
143
|
+
return value == null || value.length === 0;
|
|
144
|
+
}
|
|
145
|
+
function emailValidator(control) {
|
|
146
|
+
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
const test = EMAIL_REGEXP.test(control.value);
|
|
150
|
+
if (test)
|
|
151
|
+
return null;
|
|
152
|
+
return {
|
|
153
|
+
email: true
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function dateRangeValidator(control) {
|
|
157
|
+
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
const dates = control?.parent?.get('dates')?.value;
|
|
161
|
+
if (dates &&
|
|
162
|
+
(!MonkeyEcxUtils.persistNullEmptyUndefined(dates?.startDate) ||
|
|
163
|
+
!MonkeyEcxUtils.persistNullEmptyUndefined(dates?.endDate))) {
|
|
164
|
+
return {
|
|
165
|
+
dateRange: true
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
function registerValidator(control, type) {
|
|
171
|
+
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
if (control && control.value !== `#MONKEY${type}`.toUpperCase()) {
|
|
175
|
+
return {
|
|
176
|
+
invalidUnlockRegister: true
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
function dateStartEndValidator(control) {
|
|
182
|
+
if (!control.parent || !control) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
const { parent } = control;
|
|
186
|
+
const valueStart = parent?.get('dateStart')?.value;
|
|
187
|
+
const valueEnd = parent?.get('dateEnd')?.value;
|
|
188
|
+
let dateStart = null;
|
|
189
|
+
let dateEnd = null;
|
|
190
|
+
if (valueStart) {
|
|
191
|
+
dateStart = new Date(valueStart);
|
|
192
|
+
}
|
|
193
|
+
if (valueEnd) {
|
|
194
|
+
dateEnd = new Date(valueEnd);
|
|
195
|
+
}
|
|
196
|
+
if (!dateEnd || !dateStart)
|
|
197
|
+
return null;
|
|
198
|
+
if (dateStart > dateEnd) {
|
|
199
|
+
return {
|
|
200
|
+
dateStartMustBeLessThanAnd: true
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
function urlValidator(control) {
|
|
206
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
207
|
+
return null;
|
|
208
|
+
if (!MonkeyEcxUtils.isValidUrl(control.value)) {
|
|
209
|
+
return {
|
|
210
|
+
url: true
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
function passwordConfirmValidator(control) {
|
|
216
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
217
|
+
return null;
|
|
218
|
+
const { parent } = control;
|
|
219
|
+
const password = parent?.get('password')?.value;
|
|
220
|
+
const passwordConfirm = parent?.get('passwordConfirm')?.value;
|
|
221
|
+
if (!password || !passwordConfirm)
|
|
222
|
+
return null;
|
|
223
|
+
if (password === passwordConfirm)
|
|
224
|
+
return null;
|
|
225
|
+
return {
|
|
226
|
+
passwordsNotMatching: true
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
function trueValidator(control) {
|
|
230
|
+
if (!control.parent || !control)
|
|
231
|
+
return null;
|
|
232
|
+
if (control && control.value !== false)
|
|
233
|
+
return null;
|
|
234
|
+
return {
|
|
235
|
+
invalidTrue: true
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function comboValidator(control) {
|
|
239
|
+
if (!control.parent || !control)
|
|
240
|
+
return null;
|
|
241
|
+
if (control && control.value !== '0')
|
|
242
|
+
return null;
|
|
243
|
+
return {
|
|
244
|
+
invalidCombo: true
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
function zipCodeValidator(control, country) {
|
|
248
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
249
|
+
return null;
|
|
250
|
+
if (control && control.value) {
|
|
251
|
+
if (!MonkeyEcxUtils.isValidZipCode(control.value, country)) {
|
|
252
|
+
return {
|
|
253
|
+
invalidZipCode: true
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
function documentValidator(control, country) {
|
|
260
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
261
|
+
return null;
|
|
262
|
+
if (country === 'BR') {
|
|
263
|
+
if (!MonkeyEcxUtils.isCPFCNPJValid(control.value)) {
|
|
264
|
+
return {
|
|
265
|
+
invalidCpfCnpj: true
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
else if (country === 'CL') {
|
|
270
|
+
if (!MonkeyEcxUtils.isValidRUT(control.value)) {
|
|
271
|
+
return {
|
|
272
|
+
invalidCpfCnpj: true
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
function dateValidator(control) {
|
|
279
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
280
|
+
return null;
|
|
281
|
+
const dateFormat = 'MM-DD-YYYY';
|
|
282
|
+
if (!moment$6
|
|
283
|
+
.default(moment$6.default(control.value).format(dateFormat), ['DD/MM/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD'], true)
|
|
284
|
+
.isValid()) {
|
|
285
|
+
return {
|
|
286
|
+
invalidDate: true
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
function valueGreaterThanZero(control) {
|
|
292
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
293
|
+
return null;
|
|
294
|
+
if (control && `${control?.value}` === '0') {
|
|
295
|
+
return {
|
|
296
|
+
invalidValueGreaterThanZero: true
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
function requiredWithTrimValidator(control) {
|
|
302
|
+
if (!control.parent || !control)
|
|
303
|
+
return null;
|
|
304
|
+
if (control && !`${control?.value}`.trim()) {
|
|
305
|
+
return {
|
|
306
|
+
required: true
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
function differentFromZero(control) {
|
|
312
|
+
if (!control.parent || !control)
|
|
313
|
+
return null;
|
|
314
|
+
const handled = `${control?.value}`.trim().replace(/0/g, '');
|
|
315
|
+
if (control && !handled) {
|
|
316
|
+
return {
|
|
317
|
+
differentFromZero: true
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
class Validators {
|
|
323
|
+
static email(control) {
|
|
324
|
+
return emailValidator(control);
|
|
325
|
+
}
|
|
326
|
+
static dateRange(control) {
|
|
327
|
+
return dateRangeValidator(control);
|
|
328
|
+
}
|
|
329
|
+
static unlockSponsorRegister(control) {
|
|
330
|
+
return registerValidator(control, 'sponsor');
|
|
331
|
+
}
|
|
332
|
+
static unlockBuyerRegister(control) {
|
|
333
|
+
return registerValidator(control, 'buyer');
|
|
334
|
+
}
|
|
335
|
+
static dateStartEnd(control) {
|
|
336
|
+
return dateStartEndValidator(control);
|
|
337
|
+
}
|
|
338
|
+
static url(control) {
|
|
339
|
+
return urlValidator(control);
|
|
340
|
+
}
|
|
341
|
+
static passwordConfirm(control) {
|
|
342
|
+
return passwordConfirmValidator(control);
|
|
343
|
+
}
|
|
344
|
+
static true(control) {
|
|
345
|
+
return trueValidator(control);
|
|
346
|
+
}
|
|
347
|
+
static combo(control) {
|
|
348
|
+
return comboValidator(control);
|
|
349
|
+
}
|
|
350
|
+
static zipCode(control) {
|
|
351
|
+
return zipCodeValidator(control);
|
|
352
|
+
}
|
|
353
|
+
static zipCodeByCountry(country) {
|
|
354
|
+
return (control) => {
|
|
355
|
+
return zipCodeValidator(control, country);
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
static documentBR(control) {
|
|
359
|
+
return documentValidator(control, 'BR');
|
|
360
|
+
}
|
|
361
|
+
static documentCL(control) {
|
|
362
|
+
return documentValidator(control, 'CL');
|
|
363
|
+
}
|
|
364
|
+
static date(control) {
|
|
365
|
+
return dateValidator(control);
|
|
366
|
+
}
|
|
367
|
+
static greaterThanZero(control) {
|
|
368
|
+
return valueGreaterThanZero(control);
|
|
369
|
+
}
|
|
370
|
+
static required(control) {
|
|
371
|
+
return requiredWithTrimValidator(control);
|
|
372
|
+
}
|
|
373
|
+
static differentFromZero(control) {
|
|
374
|
+
return differentFromZero(control);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
140
378
|
/* eslint-disable comma-dangle */
|
|
141
379
|
/* eslint-disable block-scoped-var */
|
|
142
380
|
class MonkeyEcxUtils {
|
|
@@ -281,6 +519,9 @@ class MonkeyEcxUtils {
|
|
|
281
519
|
const length = (country === 'cl') ? 7 : 8;
|
|
282
520
|
return `${this.handleOnlyNumbers(zipCode)}`.length === length;
|
|
283
521
|
}
|
|
522
|
+
static isValidEmail(email) {
|
|
523
|
+
return EMAIL_REGEXP.test(email || '');
|
|
524
|
+
}
|
|
284
525
|
static getRandomString(len, charSet) {
|
|
285
526
|
charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
286
527
|
const randomString = new Array(len)
|
|
@@ -379,14 +620,14 @@ class MonkeyEcxUtils {
|
|
|
379
620
|
}
|
|
380
621
|
}
|
|
381
622
|
|
|
382
|
-
const moment$
|
|
623
|
+
const moment$5 = moment_;
|
|
383
624
|
class MonkeyEcxFormatDateTimelapsePipe {
|
|
384
625
|
transform(date, showTime = false, useUtc = true, format = '- HH:mm') {
|
|
385
626
|
if (!MonkeyEcxUtils.persistNullEmptyUndefined(date))
|
|
386
627
|
return '';
|
|
387
|
-
let stillUtc = moment$
|
|
628
|
+
let stillUtc = moment$5.default.utc(date).toDate();
|
|
388
629
|
if (!useUtc)
|
|
389
|
-
stillUtc = moment$
|
|
630
|
+
stillUtc = moment$5.default(date).toDate();
|
|
390
631
|
if (date.toString().indexOf(':') <= -1) {
|
|
391
632
|
if (typeof date === 'string') {
|
|
392
633
|
stillUtc = date;
|
|
@@ -395,7 +636,7 @@ class MonkeyEcxFormatDateTimelapsePipe {
|
|
|
395
636
|
}
|
|
396
637
|
const formatFrom = `YYYY/MM/DD${showTime ? ` ${format}` : ''}`;
|
|
397
638
|
const formatTo = `DD/MM/YYYY${showTime ? ` ${format}` : ''}`;
|
|
398
|
-
return `${moment$
|
|
639
|
+
return `${moment$5.default(stillUtc, formatFrom).format(formatTo)}`;
|
|
399
640
|
}
|
|
400
641
|
}
|
|
401
642
|
MonkeyEcxFormatDateTimelapsePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFormatDateTimelapsePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -631,7 +872,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
631
872
|
}]
|
|
632
873
|
}] });
|
|
633
874
|
|
|
634
|
-
const moment$
|
|
875
|
+
const moment$4 = moment_;
|
|
635
876
|
class MonkeyEcxDisplaySupportPhone {
|
|
636
877
|
constructor() {
|
|
637
878
|
// not to do
|
|
@@ -647,9 +888,9 @@ class MonkeyEcxDisplaySupportPhone {
|
|
|
647
888
|
});
|
|
648
889
|
}
|
|
649
890
|
isPhoneOnline(phone) {
|
|
650
|
-
const start = moment$
|
|
651
|
-
const end = moment$
|
|
652
|
-
return moment$
|
|
891
|
+
const start = moment$4.default().startOf('day').add(phone?.startHour, 'hours').format('YYYY-MM-DD HH:mm');
|
|
892
|
+
const end = moment$4.default().startOf('day').add(phone?.endHour, 'hours').format('YYYY-MM-DD HH:mm');
|
|
893
|
+
return moment$4.default().isSameOrAfter(start) && moment$4.default().isSameOrBefore(end);
|
|
653
894
|
}
|
|
654
895
|
}
|
|
655
896
|
MonkeyEcxDisplaySupportPhone.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDisplaySupportPhone, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -767,7 +1008,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
767
1008
|
}]
|
|
768
1009
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i2.CurrencyPipe }]; } });
|
|
769
1010
|
|
|
770
|
-
const moment$
|
|
1011
|
+
const moment$3 = moment_;
|
|
771
1012
|
class MonkeyEcxFormatDateGroupPipe {
|
|
772
1013
|
constructor(injector) {
|
|
773
1014
|
this.injector = injector;
|
|
@@ -778,12 +1019,12 @@ class MonkeyEcxFormatDateGroupPipe {
|
|
|
778
1019
|
format(date) {
|
|
779
1020
|
if (!MonkeyEcxUtils.persistNullEmptyUndefined(date))
|
|
780
1021
|
return '';
|
|
781
|
-
let stillUtc = moment$
|
|
1022
|
+
let stillUtc = moment$3.default.utc(date).toDate();
|
|
782
1023
|
if (date.toString()?.indexOf(':') <= -1) {
|
|
783
1024
|
stillUtc = date;
|
|
784
1025
|
}
|
|
785
1026
|
const formatFrom = 'YYYY/MM/DD';
|
|
786
|
-
const fmt = moment$
|
|
1027
|
+
const fmt = moment$3.default(stillUtc, formatFrom).locale(this.lang);
|
|
787
1028
|
const dayFormated = fmt.format('DD/');
|
|
788
1029
|
const monthFormated = MonkeyEcxUtils.capitalize(fmt.format('MMMM'));
|
|
789
1030
|
const yearFormated = fmt.format('YYYY');
|
|
@@ -807,15 +1048,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
807
1048
|
}]
|
|
808
1049
|
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
809
1050
|
|
|
810
|
-
const moment$
|
|
1051
|
+
const moment$2 = moment_;
|
|
811
1052
|
class DateValidator {
|
|
812
1053
|
static do(control) {
|
|
813
1054
|
if (!control.parent || !control)
|
|
814
1055
|
return null;
|
|
815
1056
|
if (control && control.value) {
|
|
816
1057
|
const dateFormat = 'MM-DD-YYYY';
|
|
817
|
-
if (!moment$
|
|
818
|
-
.default(moment$
|
|
1058
|
+
if (!moment$2
|
|
1059
|
+
.default(moment$2.default(control.value).format(dateFormat), ['DD/MM/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD'], true)
|
|
819
1060
|
.isValid()) {
|
|
820
1061
|
return {
|
|
821
1062
|
invalidDate: true
|
|
@@ -1073,244 +1314,6 @@ var decoratorsUtils = /*#__PURE__*/Object.freeze({
|
|
|
1073
1314
|
hasMonkeyEcxServiceAndHandlingProperties: hasMonkeyEcxServiceAndHandlingProperties
|
|
1074
1315
|
});
|
|
1075
1316
|
|
|
1076
|
-
const moment$2 = moment_;
|
|
1077
|
-
const EMAIL_REGEXP = /^[\w-.]+@([\w-]+\.)+[\w-]{1,64}$/;
|
|
1078
|
-
function isEmptyInputValue(value) {
|
|
1079
|
-
return value == null || value.length === 0;
|
|
1080
|
-
}
|
|
1081
|
-
function emailValidator(control) {
|
|
1082
|
-
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
1083
|
-
return null;
|
|
1084
|
-
}
|
|
1085
|
-
const test = EMAIL_REGEXP.test(control.value);
|
|
1086
|
-
if (test)
|
|
1087
|
-
return null;
|
|
1088
|
-
return {
|
|
1089
|
-
email: true
|
|
1090
|
-
};
|
|
1091
|
-
}
|
|
1092
|
-
function dateRangeValidator(control) {
|
|
1093
|
-
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
1094
|
-
return null;
|
|
1095
|
-
}
|
|
1096
|
-
const dates = control?.parent?.get('dates')?.value;
|
|
1097
|
-
if (dates &&
|
|
1098
|
-
(!MonkeyEcxUtils.persistNullEmptyUndefined(dates?.startDate) ||
|
|
1099
|
-
!MonkeyEcxUtils.persistNullEmptyUndefined(dates?.endDate))) {
|
|
1100
|
-
return {
|
|
1101
|
-
dateRange: true
|
|
1102
|
-
};
|
|
1103
|
-
}
|
|
1104
|
-
return null;
|
|
1105
|
-
}
|
|
1106
|
-
function registerValidator(control, type) {
|
|
1107
|
-
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
1108
|
-
return null;
|
|
1109
|
-
}
|
|
1110
|
-
if (control && control.value !== `#MONKEY${type}`.toUpperCase()) {
|
|
1111
|
-
return {
|
|
1112
|
-
invalidUnlockRegister: true
|
|
1113
|
-
};
|
|
1114
|
-
}
|
|
1115
|
-
return null;
|
|
1116
|
-
}
|
|
1117
|
-
function dateStartEndValidator(control) {
|
|
1118
|
-
if (!control.parent || !control) {
|
|
1119
|
-
return null;
|
|
1120
|
-
}
|
|
1121
|
-
const { parent } = control;
|
|
1122
|
-
const valueStart = parent?.get('dateStart')?.value;
|
|
1123
|
-
const valueEnd = parent?.get('dateEnd')?.value;
|
|
1124
|
-
let dateStart = null;
|
|
1125
|
-
let dateEnd = null;
|
|
1126
|
-
if (valueStart) {
|
|
1127
|
-
dateStart = new Date(valueStart);
|
|
1128
|
-
}
|
|
1129
|
-
if (valueEnd) {
|
|
1130
|
-
dateEnd = new Date(valueEnd);
|
|
1131
|
-
}
|
|
1132
|
-
if (!dateEnd || !dateStart)
|
|
1133
|
-
return null;
|
|
1134
|
-
if (dateStart > dateEnd) {
|
|
1135
|
-
return {
|
|
1136
|
-
dateStartMustBeLessThanAnd: true
|
|
1137
|
-
};
|
|
1138
|
-
}
|
|
1139
|
-
return null;
|
|
1140
|
-
}
|
|
1141
|
-
function urlValidator(control) {
|
|
1142
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1143
|
-
return null;
|
|
1144
|
-
if (!MonkeyEcxUtils.isValidUrl(control.value)) {
|
|
1145
|
-
return {
|
|
1146
|
-
url: true
|
|
1147
|
-
};
|
|
1148
|
-
}
|
|
1149
|
-
return null;
|
|
1150
|
-
}
|
|
1151
|
-
function passwordConfirmValidator(control) {
|
|
1152
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1153
|
-
return null;
|
|
1154
|
-
const { parent } = control;
|
|
1155
|
-
const password = parent?.get('password')?.value;
|
|
1156
|
-
const passwordConfirm = parent?.get('passwordConfirm')?.value;
|
|
1157
|
-
if (!password || !passwordConfirm)
|
|
1158
|
-
return null;
|
|
1159
|
-
if (password === passwordConfirm)
|
|
1160
|
-
return null;
|
|
1161
|
-
return {
|
|
1162
|
-
passwordsNotMatching: true
|
|
1163
|
-
};
|
|
1164
|
-
}
|
|
1165
|
-
function trueValidator(control) {
|
|
1166
|
-
if (!control.parent || !control)
|
|
1167
|
-
return null;
|
|
1168
|
-
if (control && control.value !== false)
|
|
1169
|
-
return null;
|
|
1170
|
-
return {
|
|
1171
|
-
invalidTrue: true
|
|
1172
|
-
};
|
|
1173
|
-
}
|
|
1174
|
-
function comboValidator(control) {
|
|
1175
|
-
if (!control.parent || !control)
|
|
1176
|
-
return null;
|
|
1177
|
-
if (control && control.value !== '0')
|
|
1178
|
-
return null;
|
|
1179
|
-
return {
|
|
1180
|
-
invalidCombo: true
|
|
1181
|
-
};
|
|
1182
|
-
}
|
|
1183
|
-
function zipCodeValidator(control, country) {
|
|
1184
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1185
|
-
return null;
|
|
1186
|
-
if (control && control.value) {
|
|
1187
|
-
if (!MonkeyEcxUtils.isValidZipCode(control.value, country)) {
|
|
1188
|
-
return {
|
|
1189
|
-
invalidZipCode: true
|
|
1190
|
-
};
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
return null;
|
|
1194
|
-
}
|
|
1195
|
-
function documentValidator(control, country) {
|
|
1196
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1197
|
-
return null;
|
|
1198
|
-
if (country === 'BR') {
|
|
1199
|
-
if (!MonkeyEcxUtils.isCPFCNPJValid(control.value)) {
|
|
1200
|
-
return {
|
|
1201
|
-
invalidCpfCnpj: true
|
|
1202
|
-
};
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
else if (country === 'CL') {
|
|
1206
|
-
if (!MonkeyEcxUtils.isValidRUT(control.value)) {
|
|
1207
|
-
return {
|
|
1208
|
-
invalidCpfCnpj: true
|
|
1209
|
-
};
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
return null;
|
|
1213
|
-
}
|
|
1214
|
-
function dateValidator(control) {
|
|
1215
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1216
|
-
return null;
|
|
1217
|
-
const dateFormat = 'MM-DD-YYYY';
|
|
1218
|
-
if (!moment$2
|
|
1219
|
-
.default(moment$2.default(control.value).format(dateFormat), ['DD/MM/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD'], true)
|
|
1220
|
-
.isValid()) {
|
|
1221
|
-
return {
|
|
1222
|
-
invalidDate: true
|
|
1223
|
-
};
|
|
1224
|
-
}
|
|
1225
|
-
return null;
|
|
1226
|
-
}
|
|
1227
|
-
function valueGreaterThanZero(control) {
|
|
1228
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1229
|
-
return null;
|
|
1230
|
-
if (control && `${control?.value}` === '0') {
|
|
1231
|
-
return {
|
|
1232
|
-
invalidValueGreaterThanZero: true
|
|
1233
|
-
};
|
|
1234
|
-
}
|
|
1235
|
-
return null;
|
|
1236
|
-
}
|
|
1237
|
-
function requiredWithTrimValidator(control) {
|
|
1238
|
-
if (!control.parent || !control)
|
|
1239
|
-
return null;
|
|
1240
|
-
if (control && !`${control?.value}`.trim()) {
|
|
1241
|
-
return {
|
|
1242
|
-
required: true
|
|
1243
|
-
};
|
|
1244
|
-
}
|
|
1245
|
-
return null;
|
|
1246
|
-
}
|
|
1247
|
-
function differentFromZero(control) {
|
|
1248
|
-
if (!control.parent || !control)
|
|
1249
|
-
return null;
|
|
1250
|
-
const handled = `${control?.value}`.trim().replace(/0/g, '');
|
|
1251
|
-
if (control && !handled) {
|
|
1252
|
-
return {
|
|
1253
|
-
differentFromZero: true
|
|
1254
|
-
};
|
|
1255
|
-
}
|
|
1256
|
-
return null;
|
|
1257
|
-
}
|
|
1258
|
-
class Validators {
|
|
1259
|
-
static email(control) {
|
|
1260
|
-
return emailValidator(control);
|
|
1261
|
-
}
|
|
1262
|
-
static dateRange(control) {
|
|
1263
|
-
return dateRangeValidator(control);
|
|
1264
|
-
}
|
|
1265
|
-
static unlockSponsorRegister(control) {
|
|
1266
|
-
return registerValidator(control, 'sponsor');
|
|
1267
|
-
}
|
|
1268
|
-
static unlockBuyerRegister(control) {
|
|
1269
|
-
return registerValidator(control, 'buyer');
|
|
1270
|
-
}
|
|
1271
|
-
static dateStartEnd(control) {
|
|
1272
|
-
return dateStartEndValidator(control);
|
|
1273
|
-
}
|
|
1274
|
-
static url(control) {
|
|
1275
|
-
return urlValidator(control);
|
|
1276
|
-
}
|
|
1277
|
-
static passwordConfirm(control) {
|
|
1278
|
-
return passwordConfirmValidator(control);
|
|
1279
|
-
}
|
|
1280
|
-
static true(control) {
|
|
1281
|
-
return trueValidator(control);
|
|
1282
|
-
}
|
|
1283
|
-
static combo(control) {
|
|
1284
|
-
return comboValidator(control);
|
|
1285
|
-
}
|
|
1286
|
-
static zipCode(control) {
|
|
1287
|
-
return zipCodeValidator(control);
|
|
1288
|
-
}
|
|
1289
|
-
static zipCodeByCountry(country) {
|
|
1290
|
-
return (control) => {
|
|
1291
|
-
return zipCodeValidator(control, country);
|
|
1292
|
-
};
|
|
1293
|
-
}
|
|
1294
|
-
static documentBR(control) {
|
|
1295
|
-
return documentValidator(control, 'BR');
|
|
1296
|
-
}
|
|
1297
|
-
static documentCL(control) {
|
|
1298
|
-
return documentValidator(control, 'CL');
|
|
1299
|
-
}
|
|
1300
|
-
static date(control) {
|
|
1301
|
-
return dateValidator(control);
|
|
1302
|
-
}
|
|
1303
|
-
static greaterThanZero(control) {
|
|
1304
|
-
return valueGreaterThanZero(control);
|
|
1305
|
-
}
|
|
1306
|
-
static required(control) {
|
|
1307
|
-
return requiredWithTrimValidator(control);
|
|
1308
|
-
}
|
|
1309
|
-
static differentFromZero(control) {
|
|
1310
|
-
return differentFromZero(control);
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
1317
|
/* eslint-disable object-curly-newline */
|
|
1315
1318
|
|
|
1316
1319
|
const moment$1 = moment_;
|
|
@@ -5327,14 +5330,14 @@ class MonkeyEcxCommonsStoreService extends MonkeyEcxCommonsService {
|
|
|
5327
5330
|
this.action = actions;
|
|
5328
5331
|
this.selector = selectors;
|
|
5329
5332
|
}
|
|
5330
|
-
handleResponseData(resp, identifier,
|
|
5333
|
+
handleResponseData(resp, identifier, updateLinks = true) {
|
|
5331
5334
|
try {
|
|
5332
5335
|
let data;
|
|
5333
5336
|
if (resp?._embedded) {
|
|
5334
5337
|
const { _embedded, _links, page } = resp;
|
|
5335
5338
|
const key = Object.keys(_embedded)[0];
|
|
5336
5339
|
data = _embedded[key];
|
|
5337
|
-
if (
|
|
5340
|
+
if (updateLinks) {
|
|
5338
5341
|
this.updateLinks?.(_links, identifier);
|
|
5339
5342
|
}
|
|
5340
5343
|
this.updatePage?.(page, identifier);
|
|
@@ -5347,11 +5350,11 @@ class MonkeyEcxCommonsStoreService extends MonkeyEcxCommonsService {
|
|
|
5347
5350
|
throw new Error(`MECX Core - Method handleResponseData -> ${e}`);
|
|
5348
5351
|
}
|
|
5349
5352
|
}
|
|
5350
|
-
async
|
|
5353
|
+
async linksHasDifference(url, identifier) {
|
|
5351
5354
|
try {
|
|
5352
5355
|
const { action, store, selector } = this;
|
|
5353
5356
|
const { hasDifference, hasField } = (await store
|
|
5354
|
-
.select(selector.
|
|
5357
|
+
.select(selector.linksHasDifference({ identifier, url }))
|
|
5355
5358
|
.pipe(take(1))
|
|
5356
5359
|
.toPromise());
|
|
5357
5360
|
if (hasDifference && hasField) {
|
|
@@ -5360,7 +5363,7 @@ class MonkeyEcxCommonsStoreService extends MonkeyEcxCommonsService {
|
|
|
5360
5363
|
return { hasDifference };
|
|
5361
5364
|
}
|
|
5362
5365
|
catch (e) {
|
|
5363
|
-
throw new Error(`MECX Core - Method
|
|
5366
|
+
throw new Error(`MECX Core - Method linksHasDifference -> ${e}`);
|
|
5364
5367
|
}
|
|
5365
5368
|
}
|
|
5366
5369
|
updateControl(data) {
|
|
@@ -5438,11 +5441,11 @@ class MonkeyEcxCommonsStoreService extends MonkeyEcxCommonsService {
|
|
|
5438
5441
|
throw new Error(`MECX Core - Method updateLinks -> ${e}`);
|
|
5439
5442
|
}
|
|
5440
5443
|
}
|
|
5441
|
-
async loadData(url, identifier,
|
|
5444
|
+
async loadData(url, identifier, updateLinks = true) {
|
|
5442
5445
|
this.updateControl({ isLoading: true });
|
|
5443
5446
|
try {
|
|
5444
5447
|
const data = await this.monkeyecxService?.get(url).toPromise();
|
|
5445
|
-
this.handleResponseData(data, identifier,
|
|
5448
|
+
this.handleResponseData(data, identifier, updateLinks);
|
|
5446
5449
|
}
|
|
5447
5450
|
catch (e) {
|
|
5448
5451
|
throw new Error(`${e?.message}`);
|
|
@@ -5452,7 +5455,7 @@ class MonkeyEcxCommonsStoreService extends MonkeyEcxCommonsService {
|
|
|
5452
5455
|
async loadPageData(pagination, identifier) {
|
|
5453
5456
|
const { store, selector } = this;
|
|
5454
5457
|
const data = await store
|
|
5455
|
-
.select(selector.
|
|
5458
|
+
.select(selector.selectLinks({ identifier }))
|
|
5456
5459
|
.pipe(take(1))
|
|
5457
5460
|
.toPromise();
|
|
5458
5461
|
const { action } = pagination;
|
|
@@ -6032,5 +6035,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
6032
6035
|
* Generated bundle index. Do not edit.
|
|
6033
6036
|
*/
|
|
6034
6037
|
|
|
6035
|
-
export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardByRole, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxBlobSecurePipe, MonkeyEcxCommonsService, MonkeyEcxCommonsStoreService, MonkeyEcxConfigModule, MonkeyEcxConfigService, MonkeyEcxCookieStorageService, MonkeyEcxCoreCharts, MonkeyEcxCoreClearDecorators, MonkeyEcxCoreLog, MonkeyEcxCoreService, MonkeyEcxCoreServiceConstructor, MonkeyEcxCoreServicePaged, MonkeyEcxCoreServiceQueue, MonkeyEcxCurrencyConfigService, MonkeyEcxDirectivesModule, MonkeyEcxDiscoveryParamsService, MonkeyEcxDisplayFirstNamePipe, MonkeyEcxDisplayInitialsPipe, MonkeyEcxDisplaySupportPhone, MonkeyEcxDragDropDirective, MonkeyEcxErrorConfigService, MonkeyEcxErrorHandlingModule, MonkeyEcxErrorHandlingService, MonkeyEcxFeatureByProgramDirective, MonkeyEcxFeatureDirective, MonkeyEcxFeatureToggleService, MonkeyEcxFormatAddressPipe, MonkeyEcxFormatBeaufityJSONPipe, MonkeyEcxFormatCurrency, MonkeyEcxFormatCurrencyPipe, MonkeyEcxFormatDateGroupPipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDateUnixTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatTaxPipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLinksModel, MonkeyEcxLoggedHandlingService, MonkeyEcxLogsConfigService, MonkeyEcxMaintenanceConfigService, MonkeyEcxModel, MonkeyEcxOnlyAlphaNumericDirective, MonkeyEcxOnlyNumbersDirective, MonkeyEcxOthersErrorsHandlingService, MonkeyEcxPaginationService, MonkeyEcxPipesModule, MonkeyEcxPopoverDirective, MonkeyEcxPopoverOptionsDirective, MonkeyEcxProgressBarComponent, MonkeyEcxProgressBarModule, MonkeyEcxProgressBarService, MonkeyEcxRequestDownloadHandlingService, MonkeyEcxRequestDownloadedHandlingService, MonkeyEcxRequestPagedHandling, MonkeyEcxRequestQueueHandlingService, MonkeyEcxRequestQueueModalHandlingService, MonkeyEcxRequestScheduleService, MonkeyEcxSecurityConsoleConfigService, MonkeyEcxSecurityDirective, MonkeyEcxService, MonkeyEcxServiceDownload, MonkeyEcxServiceUpload, MonkeyEcxServiceWorkerConfigService, MonkeyEcxSpecificationSearch, MonkeyEcxTextTruncatePipe, MonkeyEcxTokenStorageService, MonkeyEcxTooltipDirective, MonkeyEcxTruncateQtdPipe, MonkeyEcxUtils, MonkeyEcxi18nConfigService, MonkeyFrontCoreModule, OpSearch, POPOVER_OPTIONS, statics as Statics, validateUtils as ValidateUtils, Validators, VersionChangedComponent, VersionChangedModule, comboValidator, dateRangeValidator, dateStartEndValidator, dateValidator, differentFromZero, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, requiredWithTrimValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
|
|
6038
|
+
export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, EMAIL_REGEXP, Link, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardByRole, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxBlobSecurePipe, MonkeyEcxCommonsService, MonkeyEcxCommonsStoreService, MonkeyEcxConfigModule, MonkeyEcxConfigService, MonkeyEcxCookieStorageService, MonkeyEcxCoreCharts, MonkeyEcxCoreClearDecorators, MonkeyEcxCoreLog, MonkeyEcxCoreService, MonkeyEcxCoreServiceConstructor, MonkeyEcxCoreServicePaged, MonkeyEcxCoreServiceQueue, MonkeyEcxCurrencyConfigService, MonkeyEcxDirectivesModule, MonkeyEcxDiscoveryParamsService, MonkeyEcxDisplayFirstNamePipe, MonkeyEcxDisplayInitialsPipe, MonkeyEcxDisplaySupportPhone, MonkeyEcxDragDropDirective, MonkeyEcxErrorConfigService, MonkeyEcxErrorHandlingModule, MonkeyEcxErrorHandlingService, MonkeyEcxFeatureByProgramDirective, MonkeyEcxFeatureDirective, MonkeyEcxFeatureToggleService, MonkeyEcxFormatAddressPipe, MonkeyEcxFormatBeaufityJSONPipe, MonkeyEcxFormatCurrency, MonkeyEcxFormatCurrencyPipe, MonkeyEcxFormatDateGroupPipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDateUnixTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatTaxPipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLinksModel, MonkeyEcxLoggedHandlingService, MonkeyEcxLogsConfigService, MonkeyEcxMaintenanceConfigService, MonkeyEcxModel, MonkeyEcxOnlyAlphaNumericDirective, MonkeyEcxOnlyNumbersDirective, MonkeyEcxOthersErrorsHandlingService, MonkeyEcxPaginationService, MonkeyEcxPipesModule, MonkeyEcxPopoverDirective, MonkeyEcxPopoverOptionsDirective, MonkeyEcxProgressBarComponent, MonkeyEcxProgressBarModule, MonkeyEcxProgressBarService, MonkeyEcxRequestDownloadHandlingService, MonkeyEcxRequestDownloadedHandlingService, MonkeyEcxRequestPagedHandling, MonkeyEcxRequestQueueHandlingService, MonkeyEcxRequestQueueModalHandlingService, MonkeyEcxRequestScheduleService, MonkeyEcxSecurityConsoleConfigService, MonkeyEcxSecurityDirective, MonkeyEcxService, MonkeyEcxServiceDownload, MonkeyEcxServiceUpload, MonkeyEcxServiceWorkerConfigService, MonkeyEcxSpecificationSearch, MonkeyEcxTextTruncatePipe, MonkeyEcxTokenStorageService, MonkeyEcxTooltipDirective, MonkeyEcxTruncateQtdPipe, MonkeyEcxUtils, MonkeyEcxi18nConfigService, MonkeyFrontCoreModule, OpSearch, POPOVER_OPTIONS, statics as Statics, validateUtils as ValidateUtils, Validators, VersionChangedComponent, VersionChangedModule, comboValidator, dateRangeValidator, dateStartEndValidator, dateValidator, differentFromZero, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, requiredWithTrimValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
|
|
6036
6039
|
//# sourceMappingURL=monkey-front-core.mjs.map
|