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.
@@ -293,98 +293,100 @@ class MonkeyEcxUtils {
293
293
  static isValidRFC(document) {
294
294
  const RFC_REGEXP = /^([A-ZÑ\x26]{3,4})([0-9]{6})([A-Z0-9]{3})$/;
295
295
  const SPECIAL_CASES = {
296
- 'XEXX010101000': 'foreign',
297
- 'XAXX010101000': 'generic'
296
+ XEXX010101000: 'foreign',
297
+ XAXX010101000: 'generic'
298
298
  };
299
299
  const FORBIDDEN_WORDS = [
300
- "BUEI",
301
- "BUEY",
302
- "CACA",
303
- "CACO",
304
- "CAGA",
305
- "CAGO",
306
- "CAKA",
307
- "CAKO",
308
- "COGE",
309
- "COJA",
310
- "COJE",
311
- "COJI",
312
- "COJO",
313
- "CULO",
314
- "FETO",
315
- "GUEY",
316
- "JOTO",
317
- "KACA",
318
- "KACO",
319
- "KAGA",
320
- "KAGO",
321
- "KOGE",
322
- "KOJO",
323
- "KAKA",
324
- "KULO",
325
- "MAME",
326
- "MAMO",
327
- "MEAR",
328
- "MEAS",
329
- "MEON",
330
- "MION",
331
- "MOCO",
332
- "MULA",
333
- "PEDA",
334
- "PEDO",
335
- "PENE",
336
- "PUTA",
337
- "PUTO",
338
- "QULO",
339
- "RATA",
340
- "RUIN"
300
+ 'BUEI',
301
+ 'BUEY',
302
+ 'CACA',
303
+ 'CACO',
304
+ 'CAGA',
305
+ 'CAGO',
306
+ 'CAKA',
307
+ 'CAKO',
308
+ 'COGE',
309
+ 'COJA',
310
+ 'COJE',
311
+ 'COJI',
312
+ 'COJO',
313
+ 'CULO',
314
+ 'FETO',
315
+ 'GUEY',
316
+ 'JOTO',
317
+ 'KACA',
318
+ 'KACO',
319
+ 'KAGA',
320
+ 'KAGO',
321
+ 'KOGE',
322
+ 'KOJO',
323
+ 'KAKA',
324
+ 'KULO',
325
+ 'MAME',
326
+ 'MAMO',
327
+ 'MEAR',
328
+ 'MEAS',
329
+ 'MEON',
330
+ 'MION',
331
+ 'MOCO',
332
+ 'MULA',
333
+ 'PEDA',
334
+ 'PEDO',
335
+ 'PENE',
336
+ 'PUTA',
337
+ 'PUTO',
338
+ 'QULO',
339
+ 'RATA',
340
+ 'RUIN'
341
341
  ];
342
342
  const VALUES_MAP = {
343
- '0': 0,
344
- '1': 1,
345
- '2': 2,
346
- '3': 3,
347
- '4': 4,
348
- '5': 5,
349
- '6': 6,
350
- '7': 7,
351
- '8': 8,
352
- '9': 9,
353
- 'A': 10,
354
- 'B': 11,
355
- 'C': 12,
356
- 'D': 13,
357
- 'E': 14,
358
- 'F': 15,
359
- 'G': 16,
360
- 'H': 17,
361
- 'I': 18,
362
- 'J': 19,
363
- 'K': 20,
364
- 'L': 21,
365
- 'M': 22,
366
- 'N': 23,
343
+ 0: 0,
344
+ 1: 1,
345
+ 2: 2,
346
+ 3: 3,
347
+ 4: 4,
348
+ 5: 5,
349
+ 6: 6,
350
+ 7: 7,
351
+ 8: 8,
352
+ 9: 9,
353
+ A: 10,
354
+ B: 11,
355
+ C: 12,
356
+ D: 13,
357
+ E: 14,
358
+ F: 15,
359
+ G: 16,
360
+ H: 17,
361
+ I: 18,
362
+ J: 19,
363
+ K: 20,
364
+ L: 21,
365
+ M: 22,
366
+ N: 23,
367
367
  '&': 24,
368
- 'O': 25,
369
- 'P': 26,
370
- 'Q': 27,
371
- 'R': 28,
372
- 'S': 29,
373
- 'T': 30,
374
- 'U': 31,
375
- 'V': 32,
376
- 'W': 33,
377
- 'X': 34,
378
- 'Y': 35,
379
- 'Z': 36,
368
+ O: 25,
369
+ P: 26,
370
+ Q: 27,
371
+ R: 28,
372
+ S: 29,
373
+ T: 30,
374
+ U: 31,
375
+ V: 32,
376
+ W: 33,
377
+ X: 34,
378
+ Y: 35,
379
+ Z: 36,
380
380
  ' ': 37,
381
- 'Ñ': 38
381
+ Ñ: 38
382
+ };
383
+ const getScore = (doc) => {
384
+ return doc.split('').reverse().reduce((sum, char, i) => {
385
+ const index = i + 2;
386
+ const value = VALUES_MAP[char] || 0;
387
+ return sum + value * index;
388
+ }, 0);
382
389
  };
383
- const getScore = (doc) => doc.split('').reverse().reduce((sum, char, i) => {
384
- const index = i + 2;
385
- const value = VALUES_MAP[char] || 0;
386
- return sum + value * index;
387
- }, 0);
388
390
  const parseInput = (doc) => {
389
391
  return String(doc)
390
392
  .trim()
@@ -406,12 +408,12 @@ class MonkeyEcxUtils {
406
408
  const score = getScore(base);
407
409
  const mod = (11000 - score) % 11;
408
410
  if (mod === 11)
409
- return '0' === digit;
411
+ return digit === '0';
410
412
  if (mod === 10)
411
- return 'A' === digit;
413
+ return digit === 'A';
412
414
  return String(mod) === digit;
413
415
  };
414
- const isSpecialCase = (doc) => doc in SPECIAL_CASES;
416
+ const isSpecialCase = (doc) => { return doc in SPECIAL_CASES; };
415
417
  const hasForbiddenWords = (doc) => {
416
418
  const prefix = (doc || '').slice(0, 4);
417
419
  return FORBIDDEN_WORDS.includes(prefix);
@@ -434,7 +436,7 @@ class MonkeyEcxUtils {
434
436
  return true;
435
437
  }
436
438
  catch (e) {
437
- //not to do
439
+ // not to do
438
440
  }
439
441
  return false;
440
442
  }
@@ -444,9 +446,9 @@ class MonkeyEcxUtils {
444
446
  }
445
447
  static isValidZipCode(zipCode, country) {
446
448
  const length = {
447
- 'br': 8,
448
- 'cl': 7,
449
- 'mx': 5
449
+ br: 8,
450
+ cl: 7,
451
+ mx: 5
450
452
  }[country || 'br'];
451
453
  return `${this.handleOnlyNumbers(zipCode)}`.length === length;
452
454
  }
@@ -564,6 +566,24 @@ class MonkeyEcxUtils {
564
566
  return ret;
565
567
  }
566
568
  }
569
+ function bufferToBase64(buffer) {
570
+ let binary = '';
571
+ const bytes = new Uint8Array(buffer);
572
+ const len = bytes.byteLength;
573
+ for (let i = 0; i < len; i++) {
574
+ binary += String.fromCharCode(bytes[i]);
575
+ }
576
+ return window.btoa(binary);
577
+ }
578
+ function base64ToBuffer(base64) {
579
+ const binaryString = window.atob(base64);
580
+ const len = binaryString.length;
581
+ const bytes = new Uint8Array(len);
582
+ for (let i = 0; i < len; i++) {
583
+ bytes[i] = binaryString.charCodeAt(i);
584
+ }
585
+ return bytes.buffer;
586
+ }
567
587
 
568
588
  const moment$6 = moment_;
569
589
  class MonkeyEcxFormatDateTimelapsePipe {
@@ -910,6 +930,8 @@ const MECX_TIMEZONEOFFSET = new InjectionToken('');
910
930
  const MECX_DATE_FORMAT = new InjectionToken('');
911
931
  const MECX_LANG = new InjectionToken('');
912
932
  const MECX_ENV = new InjectionToken('');
933
+ const MECX_ALPHA = new InjectionToken('');
934
+ const MECX_BETA = new InjectionToken('');
913
935
 
914
936
  class MonkeyEcxFormatCurrencyPipe {
915
937
  constructor(currencyPipe, defaultCurencyCode, lang) {
@@ -6391,6 +6413,47 @@ __decorate([
6391
6413
  })
6392
6414
  ], MonkeyEcxCommonsStoreService.prototype, "loadData", null);
6393
6415
 
6416
+ class MonkeyEcxLockerService {
6417
+ constructor(alpha, beta) {
6418
+ this.alpha = alpha;
6419
+ this.beta = beta;
6420
+ // not to do
6421
+ }
6422
+ async openMonkey(data) {
6423
+ if (!window.crypto || !window.crypto.subtle) {
6424
+ throw new Error('unsupported function');
6425
+ }
6426
+ const key = await this.importMonkey();
6427
+ const decrypted = await window.crypto.subtle.decrypt({
6428
+ name: 'AES-GCM',
6429
+ iv: base64ToBuffer(this.alpha.toString())
6430
+ }, key, base64ToBuffer(data));
6431
+ const decoder = new TextDecoder();
6432
+ return decoder.decode(decrypted);
6433
+ }
6434
+ async importMonkey() {
6435
+ const parsedKey = JSON.parse(atob(this.beta.toString()));
6436
+ return window.crypto.subtle.importKey('jwk', parsedKey, { name: 'AES-GCM' }, true, [
6437
+ 'encrypt',
6438
+ 'decrypt'
6439
+ ]);
6440
+ }
6441
+ }
6442
+ 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 });
6443
+ MonkeyEcxLockerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLockerService, providedIn: 'root' });
6444
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLockerService, decorators: [{
6445
+ type: Injectable,
6446
+ args: [{
6447
+ providedIn: 'root'
6448
+ }]
6449
+ }], ctorParameters: function () { return [{ type: i0.InjectionToken, decorators: [{
6450
+ type: Inject,
6451
+ args: [MECX_ALPHA]
6452
+ }] }, { type: i0.InjectionToken, decorators: [{
6453
+ type: Inject,
6454
+ args: [MECX_BETA]
6455
+ }] }]; } });
6456
+
6394
6457
  class MonkeyEcxFeatureByProgramDirective {
6395
6458
  constructor(cdr, elementRef, monkeyConfigService) {
6396
6459
  this.cdr = cdr;
@@ -6980,5 +7043,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
6980
7043
  * Generated bundle index. Do not edit.
6981
7044
  */
6982
7045
 
6983
- 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 };
7046
+ 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 };
6984
7047
  //# sourceMappingURL=monkey-front-core.mjs.map