monkey-front-core 0.0.538 → 0.0.540

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.
@@ -297,98 +297,100 @@ class MonkeyEcxUtils {
297
297
  static isValidRFC(document) {
298
298
  const RFC_REGEXP = /^([A-ZÑ\x26]{3,4})([0-9]{6})([A-Z0-9]{3})$/;
299
299
  const SPECIAL_CASES = {
300
- 'XEXX010101000': 'foreign',
301
- 'XAXX010101000': 'generic'
300
+ XEXX010101000: 'foreign',
301
+ XAXX010101000: 'generic'
302
302
  };
303
303
  const FORBIDDEN_WORDS = [
304
- "BUEI",
305
- "BUEY",
306
- "CACA",
307
- "CACO",
308
- "CAGA",
309
- "CAGO",
310
- "CAKA",
311
- "CAKO",
312
- "COGE",
313
- "COJA",
314
- "COJE",
315
- "COJI",
316
- "COJO",
317
- "CULO",
318
- "FETO",
319
- "GUEY",
320
- "JOTO",
321
- "KACA",
322
- "KACO",
323
- "KAGA",
324
- "KAGO",
325
- "KOGE",
326
- "KOJO",
327
- "KAKA",
328
- "KULO",
329
- "MAME",
330
- "MAMO",
331
- "MEAR",
332
- "MEAS",
333
- "MEON",
334
- "MION",
335
- "MOCO",
336
- "MULA",
337
- "PEDA",
338
- "PEDO",
339
- "PENE",
340
- "PUTA",
341
- "PUTO",
342
- "QULO",
343
- "RATA",
344
- "RUIN"
304
+ 'BUEI',
305
+ 'BUEY',
306
+ 'CACA',
307
+ 'CACO',
308
+ 'CAGA',
309
+ 'CAGO',
310
+ 'CAKA',
311
+ 'CAKO',
312
+ 'COGE',
313
+ 'COJA',
314
+ 'COJE',
315
+ 'COJI',
316
+ 'COJO',
317
+ 'CULO',
318
+ 'FETO',
319
+ 'GUEY',
320
+ 'JOTO',
321
+ 'KACA',
322
+ 'KACO',
323
+ 'KAGA',
324
+ 'KAGO',
325
+ 'KOGE',
326
+ 'KOJO',
327
+ 'KAKA',
328
+ 'KULO',
329
+ 'MAME',
330
+ 'MAMO',
331
+ 'MEAR',
332
+ 'MEAS',
333
+ 'MEON',
334
+ 'MION',
335
+ 'MOCO',
336
+ 'MULA',
337
+ 'PEDA',
338
+ 'PEDO',
339
+ 'PENE',
340
+ 'PUTA',
341
+ 'PUTO',
342
+ 'QULO',
343
+ 'RATA',
344
+ 'RUIN'
345
345
  ];
346
346
  const VALUES_MAP = {
347
- '0': 0,
348
- '1': 1,
349
- '2': 2,
350
- '3': 3,
351
- '4': 4,
352
- '5': 5,
353
- '6': 6,
354
- '7': 7,
355
- '8': 8,
356
- '9': 9,
357
- 'A': 10,
358
- 'B': 11,
359
- 'C': 12,
360
- 'D': 13,
361
- 'E': 14,
362
- 'F': 15,
363
- 'G': 16,
364
- 'H': 17,
365
- 'I': 18,
366
- 'J': 19,
367
- 'K': 20,
368
- 'L': 21,
369
- 'M': 22,
370
- 'N': 23,
347
+ 0: 0,
348
+ 1: 1,
349
+ 2: 2,
350
+ 3: 3,
351
+ 4: 4,
352
+ 5: 5,
353
+ 6: 6,
354
+ 7: 7,
355
+ 8: 8,
356
+ 9: 9,
357
+ A: 10,
358
+ B: 11,
359
+ C: 12,
360
+ D: 13,
361
+ E: 14,
362
+ F: 15,
363
+ G: 16,
364
+ H: 17,
365
+ I: 18,
366
+ J: 19,
367
+ K: 20,
368
+ L: 21,
369
+ M: 22,
370
+ N: 23,
371
371
  '&': 24,
372
- 'O': 25,
373
- 'P': 26,
374
- 'Q': 27,
375
- 'R': 28,
376
- 'S': 29,
377
- 'T': 30,
378
- 'U': 31,
379
- 'V': 32,
380
- 'W': 33,
381
- 'X': 34,
382
- 'Y': 35,
383
- 'Z': 36,
372
+ O: 25,
373
+ P: 26,
374
+ Q: 27,
375
+ R: 28,
376
+ S: 29,
377
+ T: 30,
378
+ U: 31,
379
+ V: 32,
380
+ W: 33,
381
+ X: 34,
382
+ Y: 35,
383
+ Z: 36,
384
384
  ' ': 37,
385
- 'Ñ': 38
385
+ Ñ: 38
386
+ };
387
+ const getScore = (doc) => {
388
+ return doc.split('').reverse().reduce((sum, char, i) => {
389
+ const index = i + 2;
390
+ const value = VALUES_MAP[char] || 0;
391
+ return sum + value * index;
392
+ }, 0);
386
393
  };
387
- const getScore = (doc) => doc.split('').reverse().reduce((sum, char, i) => {
388
- const index = i + 2;
389
- const value = VALUES_MAP[char] || 0;
390
- return sum + value * index;
391
- }, 0);
392
394
  const parseInput = (doc) => {
393
395
  return String(doc)
394
396
  .trim()
@@ -410,12 +412,12 @@ class MonkeyEcxUtils {
410
412
  const score = getScore(base);
411
413
  const mod = (11000 - score) % 11;
412
414
  if (mod === 11)
413
- return '0' === digit;
415
+ return digit === '0';
414
416
  if (mod === 10)
415
- return 'A' === digit;
417
+ return digit === 'A';
416
418
  return String(mod) === digit;
417
419
  };
418
- const isSpecialCase = (doc) => doc in SPECIAL_CASES;
420
+ const isSpecialCase = (doc) => { return doc in SPECIAL_CASES; };
419
421
  const hasForbiddenWords = (doc) => {
420
422
  const prefix = (doc || '').slice(0, 4);
421
423
  return FORBIDDEN_WORDS.includes(prefix);
@@ -438,7 +440,7 @@ class MonkeyEcxUtils {
438
440
  return true;
439
441
  }
440
442
  catch (e) {
441
- //not to do
443
+ // not to do
442
444
  }
443
445
  return false;
444
446
  }
@@ -448,9 +450,9 @@ class MonkeyEcxUtils {
448
450
  }
449
451
  static isValidZipCode(zipCode, country) {
450
452
  const length = {
451
- 'br': 8,
452
- 'cl': 7,
453
- 'mx': 5
453
+ br: 8,
454
+ cl: 7,
455
+ mx: 5
454
456
  }[country || 'br'];
455
457
  return `${this.handleOnlyNumbers(zipCode)}`.length === length;
456
458
  }
@@ -565,6 +567,24 @@ class MonkeyEcxUtils {
565
567
  return ret;
566
568
  }
567
569
  }
570
+ function bufferToBase64(buffer) {
571
+ let binary = '';
572
+ const bytes = new Uint8Array(buffer);
573
+ const len = bytes.byteLength;
574
+ for (let i = 0; i < len; i++) {
575
+ binary += String.fromCharCode(bytes[i]);
576
+ }
577
+ return window.btoa(binary);
578
+ }
579
+ function base64ToBuffer(base64) {
580
+ const binaryString = window.atob(base64);
581
+ const len = binaryString.length;
582
+ const bytes = new Uint8Array(len);
583
+ for (let i = 0; i < len; i++) {
584
+ bytes[i] = binaryString.charCodeAt(i);
585
+ }
586
+ return bytes.buffer;
587
+ }
568
588
 
569
589
  const moment$6 = moment_;
570
590
  class MonkeyEcxFormatDateTimelapsePipe {
@@ -904,6 +924,8 @@ const MECX_TIMEZONEOFFSET = new InjectionToken('');
904
924
  const MECX_DATE_FORMAT = new InjectionToken('');
905
925
  const MECX_LANG = new InjectionToken('');
906
926
  const MECX_ENV = new InjectionToken('');
927
+ const MECX_ALPHA = new InjectionToken('');
928
+ const MECX_BETA = new InjectionToken('');
907
929
 
908
930
  class MonkeyEcxFormatCurrencyPipe {
909
931
  constructor(currencyPipe, defaultCurencyCode, lang) {
@@ -6360,6 +6382,53 @@ __decorate([
6360
6382
  })
6361
6383
  ], MonkeyEcxCommonsStoreService.prototype, "loadData", null);
6362
6384
 
6385
+ class MonkeyEcxLockerService {
6386
+ constructor(alpha, beta) {
6387
+ this.alpha = alpha;
6388
+ this.beta = beta;
6389
+ // not to do
6390
+ }
6391
+ openMonkey(data) {
6392
+ return __awaiter(this, void 0, void 0, function* () {
6393
+ if (!window.crypto || !window.crypto.subtle) {
6394
+ throw new Error('unsupported function');
6395
+ }
6396
+ const key = yield this.importMonkey();
6397
+ const decrypted = yield window.crypto.subtle.decrypt({
6398
+ name: 'AES-GCM',
6399
+ iv: base64ToBuffer(this.alpha.toString())
6400
+ }, key, base64ToBuffer(data));
6401
+ const decoder = new TextDecoder();
6402
+ return decoder.decode(decrypted);
6403
+ });
6404
+ }
6405
+ importMonkey() {
6406
+ return __awaiter(this, void 0, void 0, function* () {
6407
+ const parsedKey = JSON.parse(atob(this.beta.toString()));
6408
+ return window.crypto.subtle.importKey('jwk', parsedKey, { name: 'AES-GCM' }, true, [
6409
+ 'encrypt',
6410
+ 'decrypt'
6411
+ ]);
6412
+ });
6413
+ }
6414
+ }
6415
+ MonkeyEcxLockerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLockerService, deps: [{ token: MECX_ALPHA }, { token: MECX_BETA }], target: i0.ɵɵFactoryTarget.Injectable });
6416
+ MonkeyEcxLockerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLockerService, providedIn: 'root' });
6417
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLockerService, decorators: [{
6418
+ type: Injectable,
6419
+ args: [{
6420
+ providedIn: 'root'
6421
+ }]
6422
+ }], ctorParameters: function () {
6423
+ return [{ type: i0.InjectionToken, decorators: [{
6424
+ type: Inject,
6425
+ args: [MECX_ALPHA]
6426
+ }] }, { type: i0.InjectionToken, decorators: [{
6427
+ type: Inject,
6428
+ args: [MECX_BETA]
6429
+ }] }];
6430
+ } });
6431
+
6363
6432
  class MonkeyEcxFeatureByProgramDirective {
6364
6433
  constructor(cdr, elementRef, monkeyConfigService) {
6365
6434
  this.cdr = cdr;
@@ -6959,5 +7028,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
6959
7028
  * Generated bundle index. Do not edit.
6960
7029
  */
6961
7030
 
6962
- export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MECX_DATE_FORMAT, MECX_ENV, MECX_LANG, MECX_TIMEZONEOFFSET, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardByRole, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxBlobSecurePipe, MonkeyEcxCommonsActions, MonkeyEcxCommonsResolveBaseService, MonkeyEcxCommonsResolveService, MonkeyEcxCommonsSelectors, MonkeyEcxCommonsService, MonkeyEcxCommonsStoreBaseService, 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, MonkeyEcxFormatDatePipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDateUnixTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatTaxPipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLinksModel, MonkeyEcxLoadingDirective, 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, documentValidatorByType, emailValidator, passwordConfirmValidator, registerValidator, requiredWithTrimValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
7031
+ export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MECX_ALPHA, MECX_BETA, MECX_DATE_FORMAT, MECX_ENV, MECX_LANG, MECX_TIMEZONEOFFSET, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardByRole, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxBlobSecurePipe, MonkeyEcxCommonsActions, MonkeyEcxCommonsResolveBaseService, MonkeyEcxCommonsResolveService, MonkeyEcxCommonsSelectors, MonkeyEcxCommonsService, MonkeyEcxCommonsStoreBaseService, 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, MonkeyEcxFormatDatePipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDateUnixTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatTaxPipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLinksModel, MonkeyEcxLoadingDirective, MonkeyEcxLockerService, 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, documentValidatorByType, emailValidator, passwordConfirmValidator, registerValidator, requiredWithTrimValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
6963
7032
  //# sourceMappingURL=monkey-front-core.mjs.map