monkey-front-core 0.0.237 → 0.0.238
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/karma.conf.js +44 -0
- package/monkey-front-core-0.0.238.tgz +0 -0
- package/ng-package.json +8 -0
- package/package.json +4 -24
- package/src/lib/components/alerts/alerts.component.html +18 -0
- package/src/lib/components/alerts/alerts.component.scss +71 -0
- package/src/lib/components/alerts/alerts.component.ts +36 -0
- package/src/lib/components/alerts/alerts.module.ts +12 -0
- package/{lib/components/alerts/index.d.ts → src/lib/components/alerts/index.ts} +2 -2
- package/src/lib/components/closed-to-maintenance/closed-to-maintenance.component.html +25 -0
- package/src/lib/components/closed-to-maintenance/closed-to-maintenance.component.scss +51 -0
- package/src/lib/components/closed-to-maintenance/closed-to-maintenance.component.ts +25 -0
- package/src/lib/components/closed-to-maintenance/closed-to-maintenance.module.ts +26 -0
- package/{lib/components/closed-to-maintenance/index.d.ts → src/lib/components/closed-to-maintenance/index.ts} +2 -2
- package/{lib/components/index.d.ts → src/lib/components/index.ts} +4 -4
- package/{lib/components/progress-bar/index.d.ts → src/lib/components/progress-bar/index.ts} +3 -3
- package/src/lib/components/progress-bar/progress-bar.component.html +3 -0
- package/src/lib/components/progress-bar/progress-bar.component.scss +6 -0
- package/src/lib/components/progress-bar/progress-bar.component.ts +22 -0
- package/src/lib/components/progress-bar/progress-bar.module.ts +10 -0
- package/src/lib/components/progress-bar/progress-bar.service.ts +61 -0
- package/{lib/components/version-changed/index.d.ts → src/lib/components/version-changed/index.ts} +2 -2
- package/src/lib/components/version-changed/version-changed.component.html +18 -0
- package/src/lib/components/version-changed/version-changed.component.scss +52 -0
- package/src/lib/components/version-changed/version-changed.component.ts +18 -0
- package/src/lib/components/version-changed/version-changed.module.ts +24 -0
- package/{lib/core/decorators/index.d.ts → src/lib/core/decorators/index.ts} +4 -4
- package/src/lib/core/decorators/monkeyecx-charts-decorators.ts +46 -0
- package/src/lib/core/decorators/monkeyecx-decorators.ts +159 -0
- package/src/lib/core/decorators/monkeyecx-download-decorators.ts +39 -0
- package/src/lib/core/decorators/monkeyecx-upload-decorators.ts +39 -0
- package/{lib/core/directives/index.d.ts → src/lib/core/directives/index.ts} +12 -12
- package/src/lib/core/directives/monkeyecx-directives-module.ts +45 -0
- package/src/lib/core/directives/monkeyecx-drag-drop.ts +40 -0
- package/src/lib/core/directives/monkeyecx-feature-by-program-directive.ts +53 -0
- package/src/lib/core/directives/monkeyecx-feature-directive.ts +72 -0
- package/src/lib/core/directives/monkeyecx-format-currency.ts +44 -0
- package/src/lib/core/directives/monkeyecx-format-upper.ts +54 -0
- package/src/lib/core/directives/monkeyecx-only-alpha-numeric-directive.ts +21 -0
- package/src/lib/core/directives/monkeyecx-only-number-directive.ts +21 -0
- package/src/lib/core/directives/monkeyecx-popover-options.directive.ts +52 -0
- package/src/lib/core/directives/monkeyecx-popover.directive.ts +235 -0
- package/src/lib/core/directives/monkeyecx-security-directive.ts +68 -0
- package/src/lib/core/directives/monkeyecx-tooltip-directive.ts +131 -0
- package/{lib/core/index.d.ts → src/lib/core/index.ts} +9 -9
- package/{lib/core/interceptors/index.d.ts → src/lib/core/interceptors/index.ts} +5 -5
- package/src/lib/core/interceptors/monkeyecx-http-config-error.interceptor.ts +58 -0
- package/src/lib/core/interceptors/monkeyecx-http-config-header.interceptor.ts +78 -0
- package/src/lib/core/interceptors/monkeyecx-http-config-interceptor.module.ts +40 -0
- package/src/lib/core/interceptors/monkeyecx-http-config-loading-in-progress.interceptor.ts +47 -0
- package/src/lib/core/interceptors/monkeyecx-http-config-queue.interceptor.ts +44 -0
- package/{lib/core/interfaces/index.d.ts → src/lib/core/interfaces/index.ts} +29 -29
- package/src/lib/core/interfaces/monkeyecx-auth-credentials.ts +16 -0
- package/{lib/core/interfaces/monkeyecx-company-pendencies.d.ts → src/lib/core/interfaces/monkeyecx-company-pendencies.ts} +16 -14
- package/src/lib/core/interfaces/monkeyecx-company.ts +10 -0
- package/src/lib/core/interfaces/monkeyecx-config-boostrap.ts +14 -0
- package/src/lib/core/interfaces/monkeyecx-config.ts +139 -0
- package/src/lib/core/interfaces/monkeyecx-country-security.ts +4 -0
- package/src/lib/core/interfaces/monkeyecx-error-response.ts +5 -0
- package/src/lib/core/interfaces/monkeyecx-filter.ts +26 -0
- package/src/lib/core/interfaces/monkeyecx-handled-error-response.ts +11 -0
- package/src/lib/core/interfaces/monkeyecx-header-credentials.ts +4 -0
- package/{lib/core/interfaces/monkeyecx-intercom-options.d.ts → src/lib/core/interfaces/monkeyecx-intercom-options.ts} +4 -4
- package/src/lib/core/interfaces/monkeyecx-me-credentials.ts +23 -0
- package/src/lib/core/interfaces/monkeyecx-navigation.ts +28 -0
- package/src/lib/core/interfaces/monkeyecx-program.ts +10 -0
- package/src/lib/core/interfaces/monkeyecx-releases.ts +9 -0
- package/{lib/core/interfaces/monkeyecx-request-in-progress.d.ts → src/lib/core/interfaces/monkeyecx-request-in-progress.ts} +3 -3
- package/src/lib/core/interfaces/monkeyecx-request-paged.ts +27 -0
- package/src/lib/core/interfaces/monkeyecx-response-links.ts +11 -0
- package/src/lib/core/interfaces/monkeyecx-response-paged.ts +6 -0
- package/src/lib/core/interfaces/monkeyecx-saved-state.ts +5 -0
- package/{lib/core/interfaces/monkeyecx-scroll-options.d.ts → src/lib/core/interfaces/monkeyecx-scroll-options.ts} +6 -5
- package/{lib/core/interfaces/monkeyecx-service-credentials.d.ts → src/lib/core/interfaces/monkeyecx-service-credentials.ts} +13 -12
- package/{lib/core/interfaces/monkeyecx-support-options.d.ts → src/lib/core/interfaces/monkeyecx-support-options.ts} +4 -4
- package/src/lib/core/interfaces/monkeyecx-token-credentials.ts +20 -0
- package/src/lib/core/interfaces/monkeyecx-translate-options.ts +4 -0
- package/{lib/core/interfaces/request-download/index.d.ts → src/lib/core/interfaces/request-download/index.ts} +3 -3
- package/src/lib/core/interfaces/request-download/monkeyecx-request-download.ts +11 -0
- package/src/lib/core/interfaces/request-download/monkeyecx-request-downloaded.ts +8 -0
- package/src/lib/core/interfaces/request-download/monkeyecx-request-item-download.ts +7 -0
- package/{lib/core/interfaces/request-queue/index.d.ts → src/lib/core/interfaces/request-queue/index.ts} +3 -3
- package/src/lib/core/interfaces/request-queue/monkeyecx-request-item-queue.ts +7 -0
- package/src/lib/core/interfaces/request-queue/monkeyecx-request-progress-queue.ts +6 -0
- package/{lib/core/interfaces/request-queue/monkeyecx-request-queue.d.ts → src/lib/core/interfaces/request-queue/monkeyecx-request-queue.ts} +9 -8
- package/{lib/core/interfaces/request-upload/index.d.ts → src/lib/core/interfaces/request-upload/index.ts} +2 -2
- package/src/lib/core/interfaces/request-upload/monkeyecx-request-item-upload.ts +5 -0
- package/src/lib/core/interfaces/request-upload/monkeyecx-request-upload.ts +11 -0
- package/{lib/core/interfaces/schedules/index.d.ts → src/lib/core/interfaces/schedules/index.ts} +1 -1
- package/src/lib/core/interfaces/schedules/monkeyecx-request-schedule.ts +14 -0
- package/{lib/core/model/index.d.ts → src/lib/core/model/index.ts} +1 -1
- package/src/lib/core/model/monkeyecx-model.ts +38 -0
- package/{lib/core/pipes/index.d.ts → src/lib/core/pipes/index.ts} +19 -19
- package/src/lib/core/pipes/monkeyecx-display-first-name.ts +12 -0
- package/src/lib/core/pipes/monkeyecx-display-initials.ts +14 -0
- package/src/lib/core/pipes/monkeyecx-display-support-phone.ts +31 -0
- package/src/lib/core/pipes/monkeyecx-format-address.ts +27 -0
- package/src/lib/core/pipes/monkeyecx-format-beautify-json.ts +35 -0
- package/src/lib/core/pipes/monkeyecx-format-currency.ts +20 -0
- package/src/lib/core/pipes/monkeyecx-format-date-group.ts +40 -0
- package/src/lib/core/pipes/monkeyecx-format-date-timelapse.ts +25 -0
- package/src/lib/core/pipes/monkeyecx-format-date-unix-timelapse.ts +31 -0
- package/src/lib/core/pipes/monkeyecx-format-document.ts +12 -0
- package/src/lib/core/pipes/monkeyecx-format-number.ts +14 -0
- package/src/lib/core/pipes/monkeyecx-format-phone.ts +32 -0
- package/src/lib/core/pipes/monkeyecx-format-size.ts +13 -0
- package/src/lib/core/pipes/monkeyecx-format-tax.ts +16 -0
- package/src/lib/core/pipes/monkeyecx-format-type-document.ts +12 -0
- package/src/lib/core/pipes/monkeyecx-format-value.ts +12 -0
- package/src/lib/core/pipes/monkeyecx-format-zipcode.ts +12 -0
- package/src/lib/core/pipes/monkeyecx-pipes.module.ts +65 -0
- package/src/lib/core/pipes/monkeyecx-text-truncate.ts +17 -0
- package/src/lib/core/pipes/monkeyecx-truncate-qtd.ts +10 -0
- package/{lib/core/services/auth/index.d.ts → src/lib/core/services/auth/index.ts} +4 -4
- package/src/lib/core/services/auth/monkeyecx-auth-guard-company.service.ts +27 -0
- package/src/lib/core/services/auth/monkeyecx-auth-guard-login.service.ts +23 -0
- package/src/lib/core/services/auth/monkeyecx-auth-guard.service.ts +25 -0
- package/src/lib/core/services/auth/monkeyecx-authentication.service.ts +87 -0
- package/{lib/core/services/commons/index.d.ts → src/lib/core/services/commons/index.ts} +1 -1
- package/src/lib/core/services/commons/monkeyecx-commons.service.ts +557 -0
- package/src/lib/core/services/config/index.ts +9 -0
- package/src/lib/core/services/config/monkeyecx-alerts-config.service.ts +37 -0
- package/src/lib/core/services/config/monkeyecx-config.module.ts +23 -0
- package/src/lib/core/services/config/monkeyecx-config.service.ts +151 -0
- package/src/lib/core/services/config/monkeyecx-error-config.service.ts +92 -0
- package/src/lib/core/services/config/monkeyecx-feature-toggle.service.ts +71 -0
- package/src/lib/core/services/config/monkeyecx-ga-config.service.ts +56 -0
- package/src/lib/core/services/config/monkeyecx-i18n-config.service.ts +95 -0
- package/src/lib/core/services/config/monkeyecx-logs-config.service.ts +34 -0
- package/src/lib/core/services/config/monkeyecx-maintenance-config.service.ts +33 -0
- package/src/lib/core/services/config/monkeyecx-security-console-config.service.ts +40 -0
- package/src/lib/core/services/config/monkeyecx-service-worker-config.service.ts +50 -0
- package/{lib/core/services/error/index.d.ts → src/lib/core/services/error/index.ts} +4 -4
- package/src/lib/core/services/error/monkeyecx-error-handling.module.ts +20 -0
- package/src/lib/core/services/error/monkeyecx-error-handling.service.ts +33 -0
- package/src/lib/core/services/error/monkeyecx-http-error-handling.service.ts +160 -0
- package/src/lib/core/services/error/monkeyecx-others-errors-handling.service.ts +24 -0
- package/{lib/core/services/index.d.ts → src/lib/core/services/index.ts} +22 -22
- package/{lib/core/services/logged/index.d.ts → src/lib/core/services/logged/index.ts} +1 -1
- package/src/lib/core/services/logged/monkeyecx-logged-handling.service.ts +42 -0
- package/src/lib/core/services/monkeyecx-handling.service.ts +58 -0
- package/src/lib/core/services/monkeyecx-service.service.ts +116 -0
- package/{lib/core/services/pagination/index.d.ts → src/lib/core/services/pagination/index.ts} +1 -1
- package/src/lib/core/services/pagination/monkeyecx-pagination.service.ts +27 -0
- package/{lib/core/services/request-download/index.d.ts → src/lib/core/services/request-download/index.ts} +2 -2
- package/src/lib/core/services/request-download/monkeyecx-request-download-handling.service.ts +100 -0
- package/src/lib/core/services/request-download/monkeyecx-request-downloaded-handling.service.ts +65 -0
- package/{lib/core/services/request-paged/index.d.ts → src/lib/core/services/request-paged/index.ts} +1 -1
- package/src/lib/core/services/request-paged/monkeyecx-request-request-paged-handling.ts +58 -0
- package/{lib/core/services/request-queue/index.d.ts → src/lib/core/services/request-queue/index.ts} +2 -2
- package/src/lib/core/services/request-queue/monkeyecx-request-queue-handling.service.ts +125 -0
- package/src/lib/core/services/request-queue/monkeyecx-request-queue-modal-handling.service.ts +136 -0
- package/{lib/core/services/routes/index.d.ts → src/lib/core/services/routes/index.ts} +1 -1
- package/src/lib/core/services/routes/monkeyecx-dicovery-params.service.ts +54 -0
- package/{lib/core/services/schedules/index.d.ts → src/lib/core/services/schedules/index.ts} +1 -1
- package/src/lib/core/services/schedules/monkeyecx-request-schedule.service.ts +224 -0
- package/{lib/core/services/storage/index.d.ts → src/lib/core/services/storage/index.ts} +2 -2
- package/src/lib/core/services/storage/monkeyecx-cookie-storage.service.ts +28 -0
- package/src/lib/core/services/storage/monkeyecx-token-storage.service.ts +151 -0
- package/{lib/core/specification-search/index.d.ts → src/lib/core/specification-search/index.ts} +1 -1
- package/src/lib/core/specification-search/monkeyecx-specification-search.ts +111 -0
- package/src/lib/core/utils/decorators-utils.ts +56 -0
- package/{lib/core/utils/index.d.ts → src/lib/core/utils/index.ts} +8 -6
- package/src/lib/core/utils/statics.ts +36 -0
- package/src/lib/core/utils/utils.ts +237 -0
- package/src/lib/core/utils/validate-utils.ts +221 -0
- package/src/lib/core/utils/validators.ts +251 -0
- package/src/lib/monkey-front-core.module.ts +37 -0
- package/{public-api.d.ts → src/public-api.ts} +6 -3
- package/src/test.ts +26 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/esm2020/lib/components/alerts/alerts.component.mjs +0 -35
- package/esm2020/lib/components/alerts/alerts.module.mjs +0 -21
- package/esm2020/lib/components/alerts/index.mjs +0 -3
- package/esm2020/lib/components/closed-to-maintenance/closed-to-maintenance.component.mjs +0 -29
- package/esm2020/lib/components/closed-to-maintenance/closed-to-maintenance.module.mjs +0 -43
- package/esm2020/lib/components/closed-to-maintenance/index.mjs +0 -3
- package/esm2020/lib/components/index.mjs +0 -5
- package/esm2020/lib/components/progress-bar/index.mjs +0 -4
- package/esm2020/lib/components/progress-bar/progress-bar.component.mjs +0 -23
- package/esm2020/lib/components/progress-bar/progress-bar.module.mjs +0 -18
- package/esm2020/lib/components/progress-bar/progress-bar.service.mjs +0 -50
- package/esm2020/lib/components/version-changed/index.mjs +0 -3
- package/esm2020/lib/components/version-changed/version-changed.component.mjs +0 -24
- package/esm2020/lib/components/version-changed/version-changed.module.mjs +0 -39
- package/esm2020/lib/core/decorators/index.mjs +0 -5
- package/esm2020/lib/core/decorators/monkeyecx-charts-decorators.mjs +0 -40
- package/esm2020/lib/core/decorators/monkeyecx-decorators.mjs +0 -111
- package/esm2020/lib/core/decorators/monkeyecx-download-decorators.mjs +0 -26
- package/esm2020/lib/core/decorators/monkeyecx-upload-decorators.mjs +0 -26
- package/esm2020/lib/core/directives/index.mjs +0 -13
- package/esm2020/lib/core/directives/monkeyecx-directives-module.mjs +0 -73
- package/esm2020/lib/core/directives/monkeyecx-drag-drop.mjs +0 -57
- package/esm2020/lib/core/directives/monkeyecx-feature-by-program-directive.mjs +0 -50
- package/esm2020/lib/core/directives/monkeyecx-feature-directive.mjs +0 -68
- package/esm2020/lib/core/directives/monkeyecx-format-currency.mjs +0 -44
- package/esm2020/lib/core/directives/monkeyecx-format-upper.mjs +0 -67
- package/esm2020/lib/core/directives/monkeyecx-only-alpha-numeric-directive.mjs +0 -28
- package/esm2020/lib/core/directives/monkeyecx-only-number-directive.mjs +0 -28
- package/esm2020/lib/core/directives/monkeyecx-popover-options.directive.mjs +0 -39
- package/esm2020/lib/core/directives/monkeyecx-popover.directive.mjs +0 -212
- package/esm2020/lib/core/directives/monkeyecx-security-directive.mjs +0 -69
- package/esm2020/lib/core/directives/monkeyecx-tooltip-directive.mjs +0 -123
- package/esm2020/lib/core/index.mjs +0 -10
- package/esm2020/lib/core/interceptors/index.mjs +0 -6
- package/esm2020/lib/core/interceptors/monkeyecx-http-config-error.interceptor.mjs +0 -39
- package/esm2020/lib/core/interceptors/monkeyecx-http-config-header.interceptor.mjs +0 -60
- package/esm2020/lib/core/interceptors/monkeyecx-http-config-interceptor.module.mjs +0 -47
- package/esm2020/lib/core/interceptors/monkeyecx-http-config-loading-in-progress.interceptor.mjs +0 -43
- package/esm2020/lib/core/interceptors/monkeyecx-http-config-queue.interceptor.mjs +0 -37
- package/esm2020/lib/core/interfaces/index.mjs +0 -30
- package/esm2020/lib/core/interfaces/monkeyecx-auth-credentials.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-company-pendencies.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-company.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-config-boostrap.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-config.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-country-security.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-error-response.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-filter.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-handled-error-response.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-header-credentials.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-intercom-options.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-me-credentials.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-navigation.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-program.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-releases.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-request-in-progress.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-request-paged.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-response-links.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-response-paged.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-saved-state.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-scroll-options.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-service-credentials.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-support-options.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-token-credentials.mjs +0 -2
- package/esm2020/lib/core/interfaces/monkeyecx-translate-options.mjs +0 -2
- package/esm2020/lib/core/interfaces/request-download/index.mjs +0 -4
- package/esm2020/lib/core/interfaces/request-download/monkeyecx-request-download.mjs +0 -2
- package/esm2020/lib/core/interfaces/request-download/monkeyecx-request-downloaded.mjs +0 -2
- package/esm2020/lib/core/interfaces/request-download/monkeyecx-request-item-download.mjs +0 -2
- package/esm2020/lib/core/interfaces/request-queue/index.mjs +0 -4
- package/esm2020/lib/core/interfaces/request-queue/monkeyecx-request-item-queue.mjs +0 -2
- package/esm2020/lib/core/interfaces/request-queue/monkeyecx-request-progress-queue.mjs +0 -2
- package/esm2020/lib/core/interfaces/request-queue/monkeyecx-request-queue.mjs +0 -2
- package/esm2020/lib/core/interfaces/request-upload/index.mjs +0 -3
- package/esm2020/lib/core/interfaces/request-upload/monkeyecx-request-item-upload.mjs +0 -2
- package/esm2020/lib/core/interfaces/request-upload/monkeyecx-request-upload.mjs +0 -2
- package/esm2020/lib/core/interfaces/schedules/index.mjs +0 -2
- package/esm2020/lib/core/interfaces/schedules/monkeyecx-request-schedule.mjs +0 -2
- package/esm2020/lib/core/model/index.mjs +0 -2
- package/esm2020/lib/core/model/monkeyecx-model.mjs +0 -25
- package/esm2020/lib/core/pipes/index.mjs +0 -20
- package/esm2020/lib/core/pipes/monkeyecx-display-first-name.mjs +0 -19
- package/esm2020/lib/core/pipes/monkeyecx-display-initials.mjs +0 -21
- package/esm2020/lib/core/pipes/monkeyecx-format-address.mjs +0 -20
- package/esm2020/lib/core/pipes/monkeyecx-format-beautify-json.mjs +0 -38
- package/esm2020/lib/core/pipes/monkeyecx-format-currency.mjs +0 -27
- package/esm2020/lib/core/pipes/monkeyecx-format-date-group.mjs +0 -45
- package/esm2020/lib/core/pipes/monkeyecx-format-date-timelapse.mjs +0 -32
- package/esm2020/lib/core/pipes/monkeyecx-format-date-unix-timelapse.mjs +0 -36
- package/esm2020/lib/core/pipes/monkeyecx-format-document.mjs +0 -19
- package/esm2020/lib/core/pipes/monkeyecx-format-number.mjs +0 -20
- package/esm2020/lib/core/pipes/monkeyecx-format-phone.mjs +0 -42
- package/esm2020/lib/core/pipes/monkeyecx-format-size.mjs +0 -20
- package/esm2020/lib/core/pipes/monkeyecx-format-tax.mjs +0 -23
- package/esm2020/lib/core/pipes/monkeyecx-format-type-document.mjs +0 -19
- package/esm2020/lib/core/pipes/monkeyecx-format-value.mjs +0 -19
- package/esm2020/lib/core/pipes/monkeyecx-format-zipcode.mjs +0 -19
- package/esm2020/lib/core/pipes/monkeyecx-pipes.module.mjs +0 -107
- package/esm2020/lib/core/pipes/monkeyecx-text-truncate.mjs +0 -23
- package/esm2020/lib/core/pipes/monkeyecx-truncate-qtd.mjs +0 -16
- package/esm2020/lib/core/services/auth/index.mjs +0 -5
- package/esm2020/lib/core/services/auth/monkeyecx-auth-guard-company.service.mjs +0 -28
- package/esm2020/lib/core/services/auth/monkeyecx-auth-guard-login.service.mjs +0 -27
- package/esm2020/lib/core/services/auth/monkeyecx-auth-guard.service.mjs +0 -26
- package/esm2020/lib/core/services/auth/monkeyecx-authentication.service.mjs +0 -69
- package/esm2020/lib/core/services/commons/index.mjs +0 -2
- package/esm2020/lib/core/services/commons/monkeyecx-commons.service.mjs +0 -405
- package/esm2020/lib/core/services/config/monkeyecx-alerts-config.service.mjs +0 -40
- package/esm2020/lib/core/services/config/monkeyecx-config.module.mjs +0 -28
- package/esm2020/lib/core/services/config/monkeyecx-config.service.mjs +0 -111
- package/esm2020/lib/core/services/config/monkeyecx-error-config.service.mjs +0 -85
- package/esm2020/lib/core/services/config/monkeyecx-feature-toggle.service.mjs +0 -67
- package/esm2020/lib/core/services/config/monkeyecx-ga-config.service.mjs +0 -57
- package/esm2020/lib/core/services/config/monkeyecx-i18n-config.service.mjs +0 -92
- package/esm2020/lib/core/services/config/monkeyecx-logs-config.service.mjs +0 -34
- package/esm2020/lib/core/services/config/monkeyecx-maintenance-config.service.mjs +0 -37
- package/esm2020/lib/core/services/config/monkeyecx-security-console-config.service.mjs +0 -42
- package/esm2020/lib/core/services/config/monkeyecx-service-worker-config.service.mjs +0 -53
- package/esm2020/lib/core/services/error/index.mjs +0 -5
- package/esm2020/lib/core/services/error/monkeyecx-error-handling.module.mjs +0 -27
- package/esm2020/lib/core/services/error/monkeyecx-error-handling.service.mjs +0 -37
- package/esm2020/lib/core/services/error/monkeyecx-http-error-handling.service.mjs +0 -135
- package/esm2020/lib/core/services/error/monkeyecx-others-errors-handling.service.mjs +0 -29
- package/esm2020/lib/core/services/index.mjs +0 -23
- package/esm2020/lib/core/services/logged/index.mjs +0 -2
- package/esm2020/lib/core/services/logged/monkeyecx-logged-handling.service.mjs +0 -40
- package/esm2020/lib/core/services/monkeyecx-handling.service.mjs +0 -50
- package/esm2020/lib/core/services/monkeyecx-service.service.mjs +0 -104
- package/esm2020/lib/core/services/pagination/index.mjs +0 -2
- package/esm2020/lib/core/services/pagination/monkeyecx-pagination.service.mjs +0 -29
- package/esm2020/lib/core/services/request-download/index.mjs +0 -3
- package/esm2020/lib/core/services/request-download/monkeyecx-request-download-handling.service.mjs +0 -93
- package/esm2020/lib/core/services/request-download/monkeyecx-request-downloaded-handling.service.mjs +0 -61
- package/esm2020/lib/core/services/request-paged/index.mjs +0 -2
- package/esm2020/lib/core/services/request-paged/monkeyecx-request-request-paged-handling.mjs +0 -42
- package/esm2020/lib/core/services/request-queue/index.mjs +0 -3
- package/esm2020/lib/core/services/request-queue/monkeyecx-request-queue-handling.service.mjs +0 -114
- package/esm2020/lib/core/services/request-queue/monkeyecx-request-queue-modal-handling.service.mjs +0 -119
- package/esm2020/lib/core/services/routes/index.mjs +0 -2
- package/esm2020/lib/core/services/routes/monkeyecx-dicovery-params.service.mjs +0 -54
- package/esm2020/lib/core/services/schedules/index.mjs +0 -2
- package/esm2020/lib/core/services/schedules/monkeyecx-request-schedule.service.mjs +0 -188
- package/esm2020/lib/core/services/storage/index.mjs +0 -3
- package/esm2020/lib/core/services/storage/monkeyecx-cookie-storage.service.mjs +0 -32
- package/esm2020/lib/core/services/storage/monkeyecx-token-storage.service.mjs +0 -127
- package/esm2020/lib/core/specification-search/index.mjs +0 -2
- package/esm2020/lib/core/specification-search/monkeyecx-specification-search.mjs +0 -108
- package/esm2020/lib/core/utils/decorators-utils.mjs +0 -40
- package/esm2020/lib/core/utils/index.mjs +0 -8
- package/esm2020/lib/core/utils/statics.mjs +0 -38
- package/esm2020/lib/core/utils/utils.mjs +0 -221
- package/esm2020/lib/core/utils/validate-utils.mjs +0 -206
- package/esm2020/lib/core/utils/validators.mjs +0 -208
- package/esm2020/lib/monkey-front-core.module.mjs +0 -64
- package/esm2020/monkey-front-core.mjs +0 -5
- package/esm2020/public-api.mjs +0 -7
- package/fesm2015/monkey-front-core.mjs +0 -5123
- package/fesm2015/monkey-front-core.mjs.map +0 -1
- package/fesm2020/monkey-front-core.mjs +0 -5182
- package/fesm2020/monkey-front-core.mjs.map +0 -1
- package/lib/components/alerts/alerts.component.d.ts +0 -16
- package/lib/components/alerts/alerts.module.d.ts +0 -10
- package/lib/components/closed-to-maintenance/closed-to-maintenance.component.d.ts +0 -13
- package/lib/components/closed-to-maintenance/closed-to-maintenance.module.d.ts +0 -11
- package/lib/components/progress-bar/progress-bar.component.d.ts +0 -11
- package/lib/components/progress-bar/progress-bar.module.d.ts +0 -8
- package/lib/components/progress-bar/progress-bar.service.d.ts +0 -14
- package/lib/components/version-changed/version-changed.component.d.ts +0 -9
- package/lib/components/version-changed/version-changed.module.d.ts +0 -10
- package/lib/core/decorators/monkeyecx-charts-decorators.d.ts +0 -1
- package/lib/core/decorators/monkeyecx-decorators.d.ts +0 -7
- package/lib/core/decorators/monkeyecx-download-decorators.d.ts +0 -2
- package/lib/core/decorators/monkeyecx-upload-decorators.d.ts +0 -2
- package/lib/core/directives/monkeyecx-directives-module.d.ts +0 -19
- package/lib/core/directives/monkeyecx-drag-drop.d.ts +0 -12
- package/lib/core/directives/monkeyecx-feature-by-program-directive.d.ts +0 -15
- package/lib/core/directives/monkeyecx-feature-directive.d.ts +0 -17
- package/lib/core/directives/monkeyecx-format-currency.d.ts +0 -16
- package/lib/core/directives/monkeyecx-format-upper.d.ts +0 -18
- package/lib/core/directives/monkeyecx-only-alpha-numeric-directive.d.ts +0 -9
- package/lib/core/directives/monkeyecx-only-number-directive.d.ts +0 -9
- package/lib/core/directives/monkeyecx-popover-options.directive.d.ts +0 -19
- package/lib/core/directives/monkeyecx-popover.directive.d.ts +0 -43
- package/lib/core/directives/monkeyecx-security-directive.d.ts +0 -17
- package/lib/core/directives/monkeyecx-tooltip-directive.d.ts +0 -23
- package/lib/core/interceptors/monkeyecx-http-config-error.interceptor.d.ts +0 -17
- package/lib/core/interceptors/monkeyecx-http-config-header.interceptor.d.ts +0 -16
- package/lib/core/interceptors/monkeyecx-http-config-interceptor.module.d.ts +0 -9
- package/lib/core/interceptors/monkeyecx-http-config-loading-in-progress.interceptor.d.ts +0 -12
- package/lib/core/interceptors/monkeyecx-http-config-queue.interceptor.d.ts +0 -14
- package/lib/core/interfaces/monkeyecx-auth-credentials.d.ts +0 -15
- package/lib/core/interfaces/monkeyecx-company.d.ts +0 -10
- package/lib/core/interfaces/monkeyecx-config-boostrap.d.ts +0 -14
- package/lib/core/interfaces/monkeyecx-config.d.ts +0 -125
- package/lib/core/interfaces/monkeyecx-country-security.d.ts +0 -4
- package/lib/core/interfaces/monkeyecx-error-response.d.ts +0 -5
- package/lib/core/interfaces/monkeyecx-filter.d.ts +0 -24
- package/lib/core/interfaces/monkeyecx-handled-error-response.d.ts +0 -10
- package/lib/core/interfaces/monkeyecx-header-credentials.d.ts +0 -4
- package/lib/core/interfaces/monkeyecx-me-credentials.d.ts +0 -22
- package/lib/core/interfaces/monkeyecx-navigation.d.ts +0 -27
- package/lib/core/interfaces/monkeyecx-program.d.ts +0 -10
- package/lib/core/interfaces/monkeyecx-releases.d.ts +0 -9
- package/lib/core/interfaces/monkeyecx-request-paged.d.ts +0 -23
- package/lib/core/interfaces/monkeyecx-response-links.d.ts +0 -11
- package/lib/core/interfaces/monkeyecx-response-paged.d.ts +0 -6
- package/lib/core/interfaces/monkeyecx-saved-state.d.ts +0 -5
- package/lib/core/interfaces/monkeyecx-token-credentials.d.ts +0 -20
- package/lib/core/interfaces/monkeyecx-translate-options.d.ts +0 -4
- package/lib/core/interfaces/request-download/monkeyecx-request-download.d.ts +0 -10
- package/lib/core/interfaces/request-download/monkeyecx-request-downloaded.d.ts +0 -7
- package/lib/core/interfaces/request-download/monkeyecx-request-item-download.d.ts +0 -7
- package/lib/core/interfaces/request-queue/monkeyecx-request-item-queue.d.ts +0 -7
- package/lib/core/interfaces/request-queue/monkeyecx-request-progress-queue.d.ts +0 -6
- package/lib/core/interfaces/request-upload/monkeyecx-request-item-upload.d.ts +0 -5
- package/lib/core/interfaces/request-upload/monkeyecx-request-upload.d.ts +0 -10
- package/lib/core/interfaces/schedules/monkeyecx-request-schedule.d.ts +0 -13
- package/lib/core/model/monkeyecx-model.d.ts +0 -13
- package/lib/core/pipes/monkeyecx-display-first-name.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-display-initials.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-format-address.d.ts +0 -14
- package/lib/core/pipes/monkeyecx-format-beautify-json.d.ts +0 -8
- package/lib/core/pipes/monkeyecx-format-currency.d.ts +0 -11
- package/lib/core/pipes/monkeyecx-format-date-group.d.ts +0 -11
- package/lib/core/pipes/monkeyecx-format-date-timelapse.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-format-date-unix-timelapse.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-format-document.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-format-number.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-format-phone.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-format-size.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-format-tax.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-format-type-document.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-format-value.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-format-zipcode.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-pipes.module.d.ts +0 -24
- package/lib/core/pipes/monkeyecx-text-truncate.d.ts +0 -7
- package/lib/core/pipes/monkeyecx-truncate-qtd.d.ts +0 -7
- package/lib/core/services/auth/monkeyecx-auth-guard-company.service.d.ts +0 -11
- package/lib/core/services/auth/monkeyecx-auth-guard-login.service.d.ts +0 -11
- package/lib/core/services/auth/monkeyecx-auth-guard.service.d.ts +0 -11
- package/lib/core/services/auth/monkeyecx-authentication.service.d.ts +0 -30
- package/lib/core/services/commons/monkeyecx-commons.service.d.ts +0 -124
- package/lib/core/services/config/monkeyecx-alerts-config.service.d.ts +0 -11
- package/lib/core/services/config/monkeyecx-config.module.d.ts +0 -9
- package/lib/core/services/config/monkeyecx-config.service.d.ts +0 -36
- package/lib/core/services/config/monkeyecx-error-config.service.d.ts +0 -8
- package/lib/core/services/config/monkeyecx-feature-toggle.service.d.ts +0 -16
- package/lib/core/services/config/monkeyecx-ga-config.service.d.ts +0 -10
- package/lib/core/services/config/monkeyecx-i18n-config.service.d.ts +0 -16
- package/lib/core/services/config/monkeyecx-logs-config.service.d.ts +0 -7
- package/lib/core/services/config/monkeyecx-maintenance-config.service.d.ts +0 -13
- package/lib/core/services/config/monkeyecx-security-console-config.service.d.ts +0 -11
- package/lib/core/services/config/monkeyecx-service-worker-config.service.d.ts +0 -16
- package/lib/core/services/error/monkeyecx-error-handling.module.d.ts +0 -9
- package/lib/core/services/error/monkeyecx-error-handling.service.d.ts +0 -9
- package/lib/core/services/error/monkeyecx-http-error-handling.service.d.ts +0 -26
- package/lib/core/services/error/monkeyecx-others-errors-handling.service.d.ts +0 -9
- package/lib/core/services/logged/monkeyecx-logged-handling.service.d.ts +0 -14
- package/lib/core/services/monkeyecx-handling.service.d.ts +0 -22
- package/lib/core/services/monkeyecx-service.service.d.ts +0 -18
- package/lib/core/services/pagination/monkeyecx-pagination.service.d.ts +0 -9
- package/lib/core/services/request-download/monkeyecx-request-download-handling.service.d.ts +0 -18
- package/lib/core/services/request-download/monkeyecx-request-downloaded-handling.service.d.ts +0 -16
- package/lib/core/services/request-paged/monkeyecx-request-request-paged-handling.d.ts +0 -11
- package/lib/core/services/request-queue/monkeyecx-request-queue-handling.service.d.ts +0 -21
- package/lib/core/services/request-queue/monkeyecx-request-queue-modal-handling.service.d.ts +0 -23
- package/lib/core/services/routes/monkeyecx-dicovery-params.service.d.ts +0 -13
- package/lib/core/services/schedules/monkeyecx-request-schedule.service.d.ts +0 -47
- package/lib/core/services/storage/monkeyecx-cookie-storage.service.d.ts +0 -11
- package/lib/core/services/storage/monkeyecx-token-storage.service.d.ts +0 -29
- package/lib/core/specification-search/monkeyecx-specification-search.d.ts +0 -20
- package/lib/core/utils/decorators-utils.d.ts +0 -5
- package/lib/core/utils/statics.d.ts +0 -28
- package/lib/core/utils/utils.d.ts +0 -22
- package/lib/core/utils/validate-utils.d.ts +0 -66
- package/lib/core/utils/validators.d.ts +0 -29
- package/lib/monkey-front-core.module.d.ts +0 -17
- package/monkey-front-core-0.0.237.tgz +0 -0
- package/monkey-front-core.d.ts +0 -5
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Injectable, Injector, ErrorHandler
|
|
3
|
+
} from '@angular/core';
|
|
4
|
+
import { HttpErrorResponse } from '@angular/common/http';
|
|
5
|
+
import { MonkeyEcxHttpErrorHandlingService } from './monkeyecx-http-error-handling.service';
|
|
6
|
+
import { MonkeyEcxHandlingService } from '../monkeyecx-handling.service';
|
|
7
|
+
import { MonkeyEcxOthersErrorsHandlingService } from './monkeyecx-others-errors-handling.service';
|
|
8
|
+
import { MonkeyEcxUtils } from '../../utils/utils';
|
|
9
|
+
import { MonkeyEcxServiceCredentials } from '../../interfaces';
|
|
10
|
+
|
|
11
|
+
@Injectable({ providedIn: 'root' })
|
|
12
|
+
export class MonkeyEcxErrorHandlingService implements ErrorHandler {
|
|
13
|
+
constructor(private injector: Injector) {
|
|
14
|
+
// not to do
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
handleError(error: any, type?: string) {
|
|
18
|
+
const { injector } = this;
|
|
19
|
+
const handlingService = injector.get(MonkeyEcxHandlingService);
|
|
20
|
+
const httpErrorHandlingService = injector.get(MonkeyEcxHttpErrorHandlingService);
|
|
21
|
+
const othersErrorsHandlingService = injector.get(MonkeyEcxOthersErrorsHandlingService);
|
|
22
|
+
|
|
23
|
+
if (error instanceof HttpErrorResponse) {
|
|
24
|
+
const sCredentials: MonkeyEcxServiceCredentials =
|
|
25
|
+
handlingService?.getMonkeyEcxServiceCredentials() || {};
|
|
26
|
+
if (MonkeyEcxUtils.persistNullEmptyUndefined(type) && type === 'refresh_token') {
|
|
27
|
+
httpErrorHandlingService.handleErrorRefreshToken(error, sCredentials);
|
|
28
|
+
} else httpErrorHandlingService.handleError(error, sCredentials);
|
|
29
|
+
} else {
|
|
30
|
+
othersErrorsHandlingService.handleError(error);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { Injectable, NgZone } from '@angular/core';
|
|
2
|
+
import { Router } from '@angular/router';
|
|
3
|
+
import { HttpErrorResponse } from '@angular/common/http';
|
|
4
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
5
|
+
import { MonkeyStyleGuideSnackbarService } from 'monkey-style-guide';
|
|
6
|
+
import { MonkeyEcxAuthenticationService } from '../auth';
|
|
7
|
+
import { MonkeyEcxService } from '../monkeyecx-service.service';
|
|
8
|
+
import { MonkeyEcxTokenStorageService } from '../storage';
|
|
9
|
+
import { MonkeyEcxCommonsService } from '../commons';
|
|
10
|
+
import { MonkeyEcxServiceCredentials } from '../../interfaces';
|
|
11
|
+
import { MonkeyEcxUtils } from '../../utils/utils';
|
|
12
|
+
|
|
13
|
+
@Injectable({
|
|
14
|
+
providedIn: 'root'
|
|
15
|
+
})
|
|
16
|
+
export class MonkeyEcxHttpErrorHandlingService extends MonkeyEcxCommonsService {
|
|
17
|
+
constructor(
|
|
18
|
+
monkeyecxService: MonkeyEcxService,
|
|
19
|
+
tokenStorage: MonkeyEcxTokenStorageService,
|
|
20
|
+
private monkeyecxAuthenticationService: MonkeyEcxAuthenticationService,
|
|
21
|
+
private router: Router,
|
|
22
|
+
private snackbarService: MonkeyStyleGuideSnackbarService,
|
|
23
|
+
private translateService: TranslateService
|
|
24
|
+
) {
|
|
25
|
+
super(monkeyecxService, tokenStorage);
|
|
26
|
+
|
|
27
|
+
super.resolve(null, null);
|
|
28
|
+
|
|
29
|
+
this.geti18n(this.translateService, 'SERVICES.WARNING');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private isHttpCodeIgnoreMessage(tp: MonkeyEcxServiceCredentials, httpCode: number): boolean {
|
|
33
|
+
if (!MonkeyEcxUtils.persistNullEmptyUndefined(tp) && !tp?.httpResponse) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const found = (tp?.httpResponse?.httpCodeIgnore || [])?.indexOf(httpCode) > -1;
|
|
38
|
+
|
|
39
|
+
return found;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private isHttpCodeIgnoreRedirect(
|
|
43
|
+
tp: MonkeyEcxServiceCredentials,
|
|
44
|
+
httpCode: number
|
|
45
|
+
): boolean {
|
|
46
|
+
if (!MonkeyEcxUtils.persistNullEmptyUndefined(tp) && !tp?.httpResponse) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const found = (tp?.httpResponse?.httpCodeIgnoreRedirect || [])?.indexOf(httpCode) > -1;
|
|
51
|
+
|
|
52
|
+
return found;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private getMessageType(status: number): 'theme' | 'warning' | 'success' | 'error' | 'question' {
|
|
56
|
+
if (status === 409 || status === 400) {
|
|
57
|
+
return 'warning';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return 'error';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private showMessage(
|
|
64
|
+
message: string,
|
|
65
|
+
error: HttpErrorResponse,
|
|
66
|
+
mkc: MonkeyEcxServiceCredentials
|
|
67
|
+
) {
|
|
68
|
+
const { snackbarService } = this;
|
|
69
|
+
if (!this.isHttpCodeIgnoreMessage(mkc, error.status)) {
|
|
70
|
+
snackbarService.show({
|
|
71
|
+
title: this.__i18n?.TITLE,
|
|
72
|
+
message,
|
|
73
|
+
type: this.getMessageType(error.status),
|
|
74
|
+
duration: 4000,
|
|
75
|
+
horizontalPosition: 'center',
|
|
76
|
+
verticalPosition: 'top'
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private handleMessage(error: HttpErrorResponse, mkc: MonkeyEcxServiceCredentials) {
|
|
82
|
+
// eslint-disable-next-line camelcase
|
|
83
|
+
const { notifications, error_description, message } = error.error;
|
|
84
|
+
let customMessage = '';
|
|
85
|
+
|
|
86
|
+
if (message) {
|
|
87
|
+
customMessage = message;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// eslint-disable-next-line camelcase
|
|
91
|
+
if (error_description) {
|
|
92
|
+
// eslint-disable-next-line camelcase
|
|
93
|
+
customMessage = error_description;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (notifications) {
|
|
97
|
+
customMessage = notifications;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (!customMessage) {
|
|
101
|
+
if (error.error instanceof Blob) {
|
|
102
|
+
const blob = new Blob([error.error], {
|
|
103
|
+
type: 'application/json'
|
|
104
|
+
});
|
|
105
|
+
const reader = new FileReader();
|
|
106
|
+
reader.addEventListener('loadend', (e) => {
|
|
107
|
+
const text = e?.target?.result;
|
|
108
|
+
const jsonResp = JSON.parse(text as string);
|
|
109
|
+
customMessage = jsonResp.notifications;
|
|
110
|
+
this.showMessage(customMessage, error, mkc);
|
|
111
|
+
});
|
|
112
|
+
reader.readAsText(blob);
|
|
113
|
+
} else {
|
|
114
|
+
this.showMessage(this.__i18n['ERROR-HANDLING']?.ERROR, error, mkc);
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
this.showMessage(customMessage, error, mkc);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
public handleError(error: HttpErrorResponse, mkc: MonkeyEcxServiceCredentials) {
|
|
122
|
+
const { router, tokenStorage } = this;
|
|
123
|
+
const { status } = error;
|
|
124
|
+
const { companyType } = tokenStorage?.getToken() || { companyType: '' };
|
|
125
|
+
|
|
126
|
+
const routes: any = {
|
|
127
|
+
403: 'forbidden',
|
|
128
|
+
500: 'service-problems',
|
|
129
|
+
503: 'service-problems'
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
let route = '/app';
|
|
133
|
+
if (companyType) {
|
|
134
|
+
route = `${route}/${companyType}/pages`;
|
|
135
|
+
} else {
|
|
136
|
+
route = `${route}/pages`;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const found = routes[status];
|
|
140
|
+
let timeout = 0;
|
|
141
|
+
|
|
142
|
+
if (found && !this.isHttpCodeIgnoreRedirect(mkc, error?.status)) {
|
|
143
|
+
route = `${route}/${found}`.toLowerCase();
|
|
144
|
+
timeout = 800;
|
|
145
|
+
router.navigate([route]);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
setTimeout(() => {
|
|
149
|
+
this.handleMessage(error, mkc);
|
|
150
|
+
}, timeout);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
public handleErrorRefreshToken(error: HttpErrorResponse, mkc: MonkeyEcxServiceCredentials) {
|
|
154
|
+
if (error.status === 401 || error.status === 400) {
|
|
155
|
+
NgZone.call(this.monkeyecxAuthenticationService.redirectLoginWelcomeBack(), {});
|
|
156
|
+
} else if (!this.isHttpCodeIgnoreMessage(mkc, error.status)) {
|
|
157
|
+
this.handleMessage(error, mkc);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { MonkeyStyleGuideModalService } from 'monkey-style-guide';
|
|
3
|
+
import { VersionChangedComponent } from '../../../components/version-changed';
|
|
4
|
+
|
|
5
|
+
@Injectable({
|
|
6
|
+
providedIn: 'root'
|
|
7
|
+
})
|
|
8
|
+
export class MonkeyEcxOthersErrorsHandlingService {
|
|
9
|
+
constructor(private modalService: MonkeyStyleGuideModalService) {
|
|
10
|
+
// not to do
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public handleError(error: any) {
|
|
14
|
+
const { modalService } = this;
|
|
15
|
+
const { message } = error;
|
|
16
|
+
|
|
17
|
+
if (new RegExp(/Loading chunk [\d]+ failed/).test(message)) {
|
|
18
|
+
modalService.open(VersionChangedComponent, {
|
|
19
|
+
color: 'theme',
|
|
20
|
+
size: 'md'
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export * from './auth';
|
|
2
|
-
export * from './commons/monkeyecx-commons.service';
|
|
3
|
-
export * from './config/monkeyecx-config.module';
|
|
4
|
-
export * from './config/monkeyecx-config.service';
|
|
5
|
-
export * from './config/monkeyecx-error-config.service';
|
|
6
|
-
export * from './config/monkeyecx-feature-toggle.service';
|
|
7
|
-
export * from './config/monkeyecx-i18n-config.service';
|
|
8
|
-
export * from './config/monkeyecx-logs-config.service';
|
|
9
|
-
export * from './config/monkeyecx-maintenance-config.service';
|
|
10
|
-
export * from './config/monkeyecx-security-console-config.service';
|
|
11
|
-
export * from './config/monkeyecx-service-worker-config.service';
|
|
12
|
-
export * from './error';
|
|
13
|
-
export * from './logged';
|
|
14
|
-
export * from './pagination';
|
|
15
|
-
export * from './monkeyecx-service.service';
|
|
16
|
-
export * from './monkeyecx-handling.service';
|
|
17
|
-
export * from './request-download';
|
|
18
|
-
export * from './request-paged';
|
|
19
|
-
export * from './request-queue';
|
|
20
|
-
export * from './routes';
|
|
21
|
-
export * from './schedules';
|
|
22
|
-
export * from './storage';
|
|
1
|
+
export * from './auth';
|
|
2
|
+
export * from './commons/monkeyecx-commons.service';
|
|
3
|
+
export * from './config/monkeyecx-config.module';
|
|
4
|
+
export * from './config/monkeyecx-config.service';
|
|
5
|
+
export * from './config/monkeyecx-error-config.service';
|
|
6
|
+
export * from './config/monkeyecx-feature-toggle.service';
|
|
7
|
+
export * from './config/monkeyecx-i18n-config.service';
|
|
8
|
+
export * from './config/monkeyecx-logs-config.service';
|
|
9
|
+
export * from './config/monkeyecx-maintenance-config.service';
|
|
10
|
+
export * from './config/monkeyecx-security-console-config.service';
|
|
11
|
+
export * from './config/monkeyecx-service-worker-config.service';
|
|
12
|
+
export * from './error';
|
|
13
|
+
export * from './logged';
|
|
14
|
+
export * from './pagination';
|
|
15
|
+
export * from './monkeyecx-service.service';
|
|
16
|
+
export * from './monkeyecx-handling.service';
|
|
17
|
+
export * from './request-download';
|
|
18
|
+
export * from './request-paged';
|
|
19
|
+
export * from './request-queue';
|
|
20
|
+
export * from './routes';
|
|
21
|
+
export * from './schedules';
|
|
22
|
+
export * from './storage';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './monkeyecx-logged-handling.service';
|
|
1
|
+
export * from './monkeyecx-logged-handling.service';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { MonkeyEcxRequestSchedule } from '../../interfaces';
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root'
|
|
6
|
+
})
|
|
7
|
+
export class MonkeyEcxLoggedHandlingService {
|
|
8
|
+
private schedules: MonkeyEcxRequestSchedule[] = [];
|
|
9
|
+
|
|
10
|
+
private genericSchedules: MonkeyEcxRequestSchedule[] = [];
|
|
11
|
+
|
|
12
|
+
constructor() {
|
|
13
|
+
// not to do
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
private destroySchedule() {
|
|
17
|
+
this.schedules.forEach((sch: MonkeyEcxRequestSchedule) => {
|
|
18
|
+
clearInterval(sch.interval);
|
|
19
|
+
});
|
|
20
|
+
this.schedules = [];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private destroyGenericSchedule() {
|
|
24
|
+
this.genericSchedules.forEach((sch: MonkeyEcxRequestSchedule) => {
|
|
25
|
+
clearInterval(sch.interval);
|
|
26
|
+
});
|
|
27
|
+
this.genericSchedules = [];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public addSchedule(sch: MonkeyEcxRequestSchedule[]) {
|
|
31
|
+
this.schedules = sch;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public addGenericSchedule(sch: MonkeyEcxRequestSchedule[]) {
|
|
35
|
+
this.genericSchedules = sch;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public destroy() {
|
|
39
|
+
this.destroySchedule();
|
|
40
|
+
this.destroyGenericSchedule();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
import { Injectable } from '@angular/core';
|
|
3
|
+
import { MonkeyEcxRequestDownload } from '../interfaces/request-download/monkeyecx-request-download';
|
|
4
|
+
import { MonkeyEcxRequestQueue } from '../interfaces/request-queue/monkeyecx-request-queue';
|
|
5
|
+
import { MonkeyEcxRequestUpload } from '../interfaces/request-upload/monkeyecx-request-upload';
|
|
6
|
+
import { MonkeyEcxServiceCredentials } from '../interfaces/monkeyecx-service-credentials';
|
|
7
|
+
|
|
8
|
+
@Injectable({
|
|
9
|
+
providedIn: 'root'
|
|
10
|
+
})
|
|
11
|
+
export abstract class MonkeyEcxHandlingService {
|
|
12
|
+
private monkeyecxServiceCredentials: MonkeyEcxServiceCredentials | null = null;
|
|
13
|
+
|
|
14
|
+
private monkeyecxRequestQueue: MonkeyEcxRequestQueue | null = null;
|
|
15
|
+
|
|
16
|
+
private monkeyecxRequestDownload: MonkeyEcxRequestDownload | null = null;
|
|
17
|
+
|
|
18
|
+
private monkeyecxRequestUpload: MonkeyEcxRequestUpload | null = null;
|
|
19
|
+
|
|
20
|
+
public clearAll() {
|
|
21
|
+
this.monkeyecxServiceCredentials = null;
|
|
22
|
+
this.monkeyecxRequestQueue = null;
|
|
23
|
+
this.monkeyecxRequestDownload = null;
|
|
24
|
+
this.monkeyecxRequestUpload = null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public setMonkeyEcxServiceCredentials(param: MonkeyEcxServiceCredentials) {
|
|
28
|
+
this.monkeyecxServiceCredentials = param;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public getMonkeyEcxServiceCredentials(): MonkeyEcxServiceCredentials | null {
|
|
32
|
+
return this.monkeyecxServiceCredentials;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public setMonkeyEcxRequestQueue(queue: MonkeyEcxRequestQueue) {
|
|
36
|
+
this.monkeyecxRequestQueue = queue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public getMonkeyEcxRequestQueue(): MonkeyEcxRequestQueue | null {
|
|
40
|
+
return this.monkeyecxRequestQueue;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public setMonkeyEcxRequestDownload(download: MonkeyEcxRequestDownload) {
|
|
44
|
+
this.monkeyecxRequestDownload = download;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public getMonkeyEcxRequestDownload(): MonkeyEcxRequestDownload | null {
|
|
48
|
+
return this.monkeyecxRequestDownload;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public setMonkeyEcxRequestUpload(upload: MonkeyEcxRequestUpload) {
|
|
52
|
+
this.monkeyecxRequestUpload = upload;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public getMonkeyEcxRequestUpload(): MonkeyEcxRequestUpload | null {
|
|
56
|
+
return this.monkeyecxRequestUpload;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
|
|
3
|
+
import { Observable, throwError } from 'rxjs';
|
|
4
|
+
import { catchError, map } from 'rxjs/operators';
|
|
5
|
+
import { MonkeyEcxHandlingService } from './monkeyecx-handling.service';
|
|
6
|
+
|
|
7
|
+
@Injectable({
|
|
8
|
+
providedIn: 'root',
|
|
9
|
+
})
|
|
10
|
+
export class MonkeyEcxService {
|
|
11
|
+
constructor(
|
|
12
|
+
protected http: HttpClient,
|
|
13
|
+
public monkeyecxHandlingService: MonkeyEcxHandlingService
|
|
14
|
+
) {
|
|
15
|
+
// not to do
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private handlelize(params: any): any {
|
|
19
|
+
if (!params) {
|
|
20
|
+
return params;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
24
|
+
for (const field of [
|
|
25
|
+
'createdAt',
|
|
26
|
+
'createUserId',
|
|
27
|
+
'updatedAt',
|
|
28
|
+
'lastUserId',
|
|
29
|
+
'_links',
|
|
30
|
+
'governmentIdType',
|
|
31
|
+
'governmentIdMask',
|
|
32
|
+
'screenType',
|
|
33
|
+
'screenTab',
|
|
34
|
+
]) {
|
|
35
|
+
delete params[field];
|
|
36
|
+
}
|
|
37
|
+
return params;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public get<T>(url: string, options?: T): Observable<T> {
|
|
41
|
+
return this.http.get<T>(url, options);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public post<T>(url: string, params: T, options?: T): Observable<T> {
|
|
45
|
+
return this.http.post<T>(url, params, options);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public put<T>(url: string, params: T): Observable<T> {
|
|
49
|
+
return this.http.put<T>(
|
|
50
|
+
url,
|
|
51
|
+
this.handlelize({
|
|
52
|
+
...params,
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public delete<T>(url: string, params?: T): Observable<T> {
|
|
58
|
+
return this.http.delete<T>(url, params);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public download<T>(url: string, options?: T, filename?: string) {
|
|
62
|
+
this.http.get<T>(url, options).subscribe(
|
|
63
|
+
(resp: any) => {
|
|
64
|
+
const { headers, body } = resp;
|
|
65
|
+
const contentType = headers.get('Content-Type');
|
|
66
|
+
const contentDisposition = headers.get('Content-Disposition');
|
|
67
|
+
if (contentDisposition) {
|
|
68
|
+
filename = contentDisposition
|
|
69
|
+
.split(';')[1]
|
|
70
|
+
.split('filename')[1]
|
|
71
|
+
.split('=')[1]
|
|
72
|
+
.trim()
|
|
73
|
+
.replace(new RegExp(/"/g), '');
|
|
74
|
+
}
|
|
75
|
+
const blob = new Blob([body], {
|
|
76
|
+
type: `${contentType}`,
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
filename,
|
|
80
|
+
blob,
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
(err: HttpErrorResponse) => {
|
|
84
|
+
throwError(err);
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public downloadOb<T>(url: string, options?: T, filename?: string): Observable<any> {
|
|
90
|
+
return this.http.get<any>(url, options).pipe(
|
|
91
|
+
map((resp: any) => {
|
|
92
|
+
const { headers, body } = resp;
|
|
93
|
+
const contentType = headers.get('Content-Type');
|
|
94
|
+
const contentDisposition = headers.get('Content-Disposition');
|
|
95
|
+
if (contentDisposition) {
|
|
96
|
+
filename = contentDisposition
|
|
97
|
+
.split(';')[1]
|
|
98
|
+
.split('filename')[1]
|
|
99
|
+
.split('=')[1]
|
|
100
|
+
.trim()
|
|
101
|
+
.replace(new RegExp(/"/g), '');
|
|
102
|
+
}
|
|
103
|
+
const blob = new Blob([body], {
|
|
104
|
+
type: `${contentType}`,
|
|
105
|
+
});
|
|
106
|
+
return {
|
|
107
|
+
filename,
|
|
108
|
+
blob,
|
|
109
|
+
};
|
|
110
|
+
}),
|
|
111
|
+
catchError((err: any) => {
|
|
112
|
+
return throwError(err);
|
|
113
|
+
})
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
package/{lib/core/services/pagination/index.d.ts → src/lib/core/services/pagination/index.ts}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './monkeyecx-pagination.service';
|
|
1
|
+
export * from './monkeyecx-pagination.service';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Injectable({
|
|
4
|
+
providedIn: 'root'
|
|
5
|
+
})
|
|
6
|
+
export class MonkeyEcxPaginationService {
|
|
7
|
+
private callbacks: {
|
|
8
|
+
[key: string]: Function;
|
|
9
|
+
} = {};
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
// not to do
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public setCallback(callback: Function, name: string = 'main') {
|
|
16
|
+
this.callbacks = {
|
|
17
|
+
...this.callbacks,
|
|
18
|
+
[name]: callback
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public execute(type: string, name: string = 'main') {
|
|
23
|
+
const { callbacks } = this;
|
|
24
|
+
const callback = callbacks?.[name];
|
|
25
|
+
if (callback) callback(type);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './monkeyecx-request-download-handling.service';
|
|
2
|
-
export * from './monkeyecx-request-downloaded-handling.service';
|
|
1
|
+
export * from './monkeyecx-request-download-handling.service';
|
|
2
|
+
export * from './monkeyecx-request-downloaded-handling.service';
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
|
+
import { MonkeyEcxUtils } from '../../utils/utils';
|
|
4
|
+
import { MonkeyEcxRequestDownload } from '../../interfaces';
|
|
5
|
+
import { MonkeyEcxDownloadEvents } from '../../utils/statics';
|
|
6
|
+
|
|
7
|
+
@Injectable({
|
|
8
|
+
providedIn: 'root'
|
|
9
|
+
})
|
|
10
|
+
export class MonkeyEcxRequestDownloadHandlingService {
|
|
11
|
+
private download: MonkeyEcxRequestDownload[] = [];
|
|
12
|
+
|
|
13
|
+
private download$: BehaviorSubject<MonkeyEcxRequestDownload[] | any>;
|
|
14
|
+
|
|
15
|
+
constructor() {
|
|
16
|
+
this.download$ = new BehaviorSubject([]);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private addTo(q: MonkeyEcxRequestDownload) {
|
|
20
|
+
this.download.push(q);
|
|
21
|
+
this.download$.next(this.download);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private markItemAsFinish(q: MonkeyEcxRequestDownload, status?: number) {
|
|
25
|
+
const saved = [...this.download];
|
|
26
|
+
this.download = [
|
|
27
|
+
...saved
|
|
28
|
+
.map((val: any) => {
|
|
29
|
+
if (val.status === MonkeyEcxDownloadEvents.OnGoing) {
|
|
30
|
+
const valSaved = {
|
|
31
|
+
...val
|
|
32
|
+
};
|
|
33
|
+
if (valSaved.item.id === q.item.id) {
|
|
34
|
+
return {
|
|
35
|
+
...valSaved,
|
|
36
|
+
status: status || MonkeyEcxDownloadEvents.Finished
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return valSaved;
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
})
|
|
43
|
+
.filter((_: any) => {
|
|
44
|
+
return _;
|
|
45
|
+
})
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
this.download = this.download.filter((_: any) => {
|
|
49
|
+
return _.status === MonkeyEcxDownloadEvents.OnGoing;
|
|
50
|
+
});
|
|
51
|
+
this.download$.next(this.download);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private updateItem(q: MonkeyEcxRequestDownload, loaded?: number, total?: number) {
|
|
55
|
+
const saved = [...this.download];
|
|
56
|
+
this.download = [
|
|
57
|
+
...saved.map((val: any) => {
|
|
58
|
+
const valSaved = {
|
|
59
|
+
...val
|
|
60
|
+
};
|
|
61
|
+
const currentPecentage = Math.floor(((loaded || 0) / (total || 0)) * 100);
|
|
62
|
+
const totalPercentage = 100;
|
|
63
|
+
if (valSaved.item.id === q.item.id) {
|
|
64
|
+
return {
|
|
65
|
+
...valSaved,
|
|
66
|
+
loaded,
|
|
67
|
+
total,
|
|
68
|
+
currentPercentage: currentPecentage,
|
|
69
|
+
totalPercentage
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return valSaved;
|
|
73
|
+
})
|
|
74
|
+
];
|
|
75
|
+
this.download$.next(this.download);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public set(q: MonkeyEcxRequestDownload) {
|
|
79
|
+
this.addTo(q);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public get(): Observable<MonkeyEcxRequestDownload[]> {
|
|
83
|
+
return this.download$.asObservable();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public update(q: MonkeyEcxRequestDownload, loaded?: number, total?: number) {
|
|
87
|
+
this.updateItem(q, loaded, total);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public finishItem(q: MonkeyEcxRequestDownload, status?: number) {
|
|
91
|
+
this.markItemAsFinish(q, status);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public hasDownloadOnGoing(): boolean {
|
|
95
|
+
const found = this.download.find((_: any) => {
|
|
96
|
+
return _.status === MonkeyEcxDownloadEvents.OnGoing;
|
|
97
|
+
});
|
|
98
|
+
return MonkeyEcxUtils.persistNullEmptyUndefined(found);
|
|
99
|
+
}
|
|
100
|
+
}
|
package/src/lib/core/services/request-download/monkeyecx-request-downloaded-handling.service.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
|
+
import { MonkeyEcxUtils } from '../../utils/utils';
|
|
4
|
+
import { Statics } from '../../utils';
|
|
5
|
+
import { MonkeyEcxRequestDownloaded } from '../../interfaces';
|
|
6
|
+
|
|
7
|
+
@Injectable({
|
|
8
|
+
providedIn: 'root'
|
|
9
|
+
})
|
|
10
|
+
export class MonkeyEcxRequestDownloadedHandlingService {
|
|
11
|
+
private downloaded: MonkeyEcxRequestDownloaded[] = [];
|
|
12
|
+
|
|
13
|
+
private downloaded$: BehaviorSubject<MonkeyEcxRequestDownloaded[] | any>;
|
|
14
|
+
|
|
15
|
+
constructor() {
|
|
16
|
+
this.downloaded$ = new BehaviorSubject([]);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private addTo(q: MonkeyEcxRequestDownloaded) {
|
|
20
|
+
this.downloaded.push(q);
|
|
21
|
+
this.downloaded$.next(this.downloaded);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private markItemAsFinish(q: MonkeyEcxRequestDownloaded, status?: number) {
|
|
25
|
+
const saved = [...this.downloaded];
|
|
26
|
+
this.downloaded = [
|
|
27
|
+
...saved.map((val: any) => {
|
|
28
|
+
if (val.status === Statics.MonkeyEcxDownloadEvents.OnGoing) {
|
|
29
|
+
const valSaved = {
|
|
30
|
+
...val
|
|
31
|
+
};
|
|
32
|
+
if (valSaved.item.id === q.item.id) {
|
|
33
|
+
return {
|
|
34
|
+
...valSaved,
|
|
35
|
+
status: status || Statics.MonkeyEcxDownloadEvents.Finished,
|
|
36
|
+
action: q.action
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return valSaved;
|
|
40
|
+
}
|
|
41
|
+
return val;
|
|
42
|
+
})
|
|
43
|
+
];
|
|
44
|
+
this.downloaded$.next(this.downloaded);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public set(q: MonkeyEcxRequestDownloaded) {
|
|
48
|
+
this.addTo(q);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public get(): Observable<MonkeyEcxRequestDownloaded[]> {
|
|
52
|
+
return this.downloaded$.asObservable();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public finishItem(q: MonkeyEcxRequestDownloaded, status?: number) {
|
|
56
|
+
this.markItemAsFinish(q, status);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public hasDownloadOnGoing(): boolean {
|
|
60
|
+
const found = this.downloaded.find((_: any) => {
|
|
61
|
+
return _.status === Statics.MonkeyEcxDownloadEvents.OnGoing;
|
|
62
|
+
});
|
|
63
|
+
return MonkeyEcxUtils.persistNullEmptyUndefined(found);
|
|
64
|
+
}
|
|
65
|
+
}
|