monkey-front-core 0.0.99 → 0.0.103

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.
Files changed (204) hide show
  1. package/README.md +24 -24
  2. package/esm2020/lib/components/closed-to-maintenance/closed-to-maintenance.component.mjs +29 -0
  3. package/{esm2015/lib/components/closed-to-maintenance/closed-to-maintenance.module.js → esm2020/lib/components/closed-to-maintenance/closed-to-maintenance.module.mjs} +5 -5
  4. package/{esm2015/lib/components/closed-to-maintenance/index.js → esm2020/lib/components/closed-to-maintenance/index.mjs} +1 -1
  5. package/{esm2015/lib/components/index.js → esm2020/lib/components/index.mjs} +0 -0
  6. package/{esm2015/lib/components/progress-bar/index.js → esm2020/lib/components/progress-bar/index.mjs} +1 -1
  7. package/esm2020/lib/components/progress-bar/progress-bar.component.mjs +23 -0
  8. package/{esm2015/lib/components/progress-bar/progress-bar.module.js → esm2020/lib/components/progress-bar/progress-bar.module.mjs} +5 -5
  9. package/esm2020/lib/components/progress-bar/progress-bar.service.mjs +50 -0
  10. package/{esm2015/lib/components/version-changed/index.js → esm2020/lib/components/version-changed/index.mjs} +1 -1
  11. package/esm2020/lib/components/version-changed/version-changed.component.mjs +24 -0
  12. package/{esm2015/lib/components/version-changed/version-changed.module.js → esm2020/lib/components/version-changed/version-changed.module.mjs} +5 -5
  13. package/{esm2015/lib/core/decorators/index.js → esm2020/lib/core/decorators/index.mjs} +1 -1
  14. package/{esm2015/lib/core/decorators/monkeyecx-charts-decorators.js → esm2020/lib/core/decorators/monkeyecx-charts-decorators.mjs} +1 -1
  15. package/esm2020/lib/core/decorators/monkeyecx-decorators.mjs +111 -0
  16. package/esm2020/lib/core/decorators/monkeyecx-download-decorators.mjs +26 -0
  17. package/esm2020/lib/core/decorators/monkeyecx-upload-decorators.mjs +26 -0
  18. package/{esm2015/lib/core/directives/index.js → esm2020/lib/core/directives/index.mjs} +1 -1
  19. package/{esm2015/lib/core/directives/monkeyecx-directives-module.js → esm2020/lib/core/directives/monkeyecx-directives-module.mjs} +5 -5
  20. package/esm2020/lib/core/directives/monkeyecx-drag-drop.mjs +57 -0
  21. package/esm2020/lib/core/directives/monkeyecx-feature-directive.mjs +68 -0
  22. package/{esm2015/lib/core/directives/monkeyecx-format-currency.js → esm2020/lib/core/directives/monkeyecx-format-currency.mjs} +4 -4
  23. package/esm2020/lib/core/directives/monkeyecx-format-upper.mjs +67 -0
  24. package/{esm2015/lib/core/directives/monkeyecx-only-alpha-numeric-directive.js → esm2020/lib/core/directives/monkeyecx-only-alpha-numeric-directive.mjs} +4 -4
  25. package/{esm2015/lib/core/directives/monkeyecx-only-number-directive.js → esm2020/lib/core/directives/monkeyecx-only-number-directive.mjs} +4 -4
  26. package/esm2020/lib/core/directives/monkeyecx-security-directive.mjs +69 -0
  27. package/esm2020/lib/core/directives/monkeyecx-tooltip-directive.mjs +123 -0
  28. package/{esm2015/lib/core/index.js → esm2020/lib/core/index.mjs} +1 -1
  29. package/{esm2015/lib/core/interceptors/index.js → esm2020/lib/core/interceptors/index.mjs} +1 -1
  30. package/esm2020/lib/core/interceptors/monkeyecx-http-config-error.interceptor.mjs +39 -0
  31. package/esm2020/lib/core/interceptors/monkeyecx-http-config-header.interceptor.mjs +32 -0
  32. package/{esm2015/lib/core/interceptors/monkeyecx-http-config-interceptor.module.js → esm2020/lib/core/interceptors/monkeyecx-http-config-interceptor.module.mjs} +5 -5
  33. package/esm2020/lib/core/interceptors/monkeyecx-http-config-loading-in-progress.interceptor.mjs +43 -0
  34. package/esm2020/lib/core/interceptors/monkeyecx-http-config-queue.interceptor.mjs +37 -0
  35. package/{esm2015/lib/core/interfaces/index.js → esm2020/lib/core/interfaces/index.mjs} +1 -1
  36. package/esm2020/lib/core/interfaces/monkeyecx-auth-credentials.mjs +2 -0
  37. package/{esm2015/lib/core/interfaces/monkeyecx-company.js → esm2020/lib/core/interfaces/monkeyecx-company.mjs} +1 -1
  38. package/esm2020/lib/core/interfaces/monkeyecx-config-boostrap.mjs +2 -0
  39. package/esm2020/lib/core/interfaces/monkeyecx-config.mjs +2 -0
  40. package/{esm2015/lib/core/interfaces/monkeyecx-error-response.js → esm2020/lib/core/interfaces/monkeyecx-error-response.mjs} +1 -1
  41. package/{esm2015/lib/core/interfaces/monkeyecx-handled-error-response.js → esm2020/lib/core/interfaces/monkeyecx-handled-error-response.mjs} +1 -1
  42. package/{esm2015/lib/core/interfaces/monkeyecx-header-credentials.js → esm2020/lib/core/interfaces/monkeyecx-header-credentials.mjs} +1 -1
  43. package/{esm2015/lib/core/interfaces/monkeyecx-intercom-options.js → esm2020/lib/core/interfaces/monkeyecx-intercom-options.mjs} +1 -1
  44. package/esm2020/lib/core/interfaces/monkeyecx-me-credentials.mjs +2 -0
  45. package/esm2020/lib/core/interfaces/monkeyecx-navigation.mjs +2 -0
  46. package/{esm2015/lib/core/interfaces/monkeyecx-program.js → esm2020/lib/core/interfaces/monkeyecx-program.mjs} +1 -1
  47. package/{esm2015/lib/core/interfaces/monkeyecx-releases.js → esm2020/lib/core/interfaces/monkeyecx-releases.mjs} +1 -1
  48. package/{esm2015/lib/core/interfaces/monkeyecx-request-in-progress.js → esm2020/lib/core/interfaces/monkeyecx-request-in-progress.mjs} +1 -1
  49. package/esm2020/lib/core/interfaces/monkeyecx-request-paged.mjs +2 -0
  50. package/{esm2015/lib/core/interfaces/monkeyecx-response-links.js → esm2020/lib/core/interfaces/monkeyecx-response-links.mjs} +1 -1
  51. package/{esm2015/lib/core/interfaces/monkeyecx-response-paged.js → esm2020/lib/core/interfaces/monkeyecx-response-paged.mjs} +1 -1
  52. package/{esm2015/lib/core/interfaces/monkeyecx-saved-state.js → esm2020/lib/core/interfaces/monkeyecx-saved-state.mjs} +1 -1
  53. package/{esm2015/lib/core/interfaces/monkeyecx-scroll-options.js → esm2020/lib/core/interfaces/monkeyecx-scroll-options.mjs} +1 -1
  54. package/esm2020/lib/core/interfaces/monkeyecx-service-credentials.mjs +2 -0
  55. package/{esm2015/lib/core/interfaces/monkeyecx-support-options.js → esm2020/lib/core/interfaces/monkeyecx-support-options.mjs} +1 -1
  56. package/esm2020/lib/core/interfaces/monkeyecx-token-credentials.mjs +2 -0
  57. package/{esm2015/lib/core/interfaces/monkeyecx-translate-options.js → esm2020/lib/core/interfaces/monkeyecx-translate-options.mjs} +1 -1
  58. package/{esm2015/lib/core/interfaces/request-download/index.js → esm2020/lib/core/interfaces/request-download/index.mjs} +1 -1
  59. package/{esm2015/lib/core/interfaces/request-download/monkeyecx-request-download.js → esm2020/lib/core/interfaces/request-download/monkeyecx-request-download.mjs} +1 -1
  60. package/{esm2015/lib/core/interfaces/request-download/monkeyecx-request-downloaded.js → esm2020/lib/core/interfaces/request-download/monkeyecx-request-downloaded.mjs} +1 -1
  61. package/{esm2015/lib/core/interfaces/request-download/monkeyecx-request-item-download.js → esm2020/lib/core/interfaces/request-download/monkeyecx-request-item-download.mjs} +1 -1
  62. package/{esm2015/lib/core/interfaces/request-queue/index.js → esm2020/lib/core/interfaces/request-queue/index.mjs} +1 -1
  63. package/{esm2015/lib/core/interfaces/request-queue/monkeyecx-request-item-queue.js → esm2020/lib/core/interfaces/request-queue/monkeyecx-request-item-queue.mjs} +1 -1
  64. package/{esm2015/lib/core/interfaces/request-queue/monkeyecx-request-progress-queue.js → esm2020/lib/core/interfaces/request-queue/monkeyecx-request-progress-queue.mjs} +1 -1
  65. package/{esm2015/lib/core/interfaces/request-queue/monkeyecx-request-queue.js → esm2020/lib/core/interfaces/request-queue/monkeyecx-request-queue.mjs} +1 -1
  66. package/{esm2015/lib/core/interfaces/request-upload/index.js → esm2020/lib/core/interfaces/request-upload/index.mjs} +1 -1
  67. package/{esm2015/lib/core/interfaces/request-upload/monkeyecx-request-item-upload.js → esm2020/lib/core/interfaces/request-upload/monkeyecx-request-item-upload.mjs} +1 -1
  68. package/{esm2015/lib/core/interfaces/request-upload/monkeyecx-request-upload.js → esm2020/lib/core/interfaces/request-upload/monkeyecx-request-upload.mjs} +1 -1
  69. package/{esm2015/lib/core/interfaces/schedules/index.js → esm2020/lib/core/interfaces/schedules/index.mjs} +1 -1
  70. package/esm2020/lib/core/interfaces/schedules/monkeyecx-request-schedule.mjs +2 -0
  71. package/{esm2015/lib/core/model/index.js → esm2020/lib/core/model/index.mjs} +1 -1
  72. package/{esm2015/lib/core/model/monkeyecx-model.js → esm2020/lib/core/model/monkeyecx-model.mjs} +1 -1
  73. package/{esm2015/lib/core/pipes/index.js → esm2020/lib/core/pipes/index.mjs} +0 -0
  74. package/{esm2015/lib/core/pipes/monkeyecx-display-first-name.js → esm2020/lib/core/pipes/monkeyecx-display-first-name.mjs} +4 -4
  75. package/{esm2015/lib/core/pipes/monkeyecx-format-address.js → esm2020/lib/core/pipes/monkeyecx-format-address.mjs} +4 -4
  76. package/{esm2015/lib/core/pipes/monkeyecx-format-currency.js → esm2020/lib/core/pipes/monkeyecx-format-currency.mjs} +4 -4
  77. package/esm2020/lib/core/pipes/monkeyecx-format-date-group.mjs +45 -0
  78. package/{esm2015/lib/core/pipes/monkeyecx-format-date-timelapse.js → esm2020/lib/core/pipes/monkeyecx-format-date-timelapse.mjs} +4 -4
  79. package/{esm2015/lib/core/pipes/monkeyecx-format-document.js → esm2020/lib/core/pipes/monkeyecx-format-document.mjs} +4 -4
  80. package/{esm2015/lib/core/pipes/monkeyecx-format-number.js → esm2020/lib/core/pipes/monkeyecx-format-number.mjs} +4 -4
  81. package/{esm2015/lib/core/pipes/monkeyecx-format-phone.js → esm2020/lib/core/pipes/monkeyecx-format-phone.mjs} +4 -4
  82. package/{esm2015/lib/core/pipes/monkeyecx-format-size.js → esm2020/lib/core/pipes/monkeyecx-format-size.mjs} +4 -4
  83. package/{esm2015/lib/core/pipes/monkeyecx-format-type-document.js → esm2020/lib/core/pipes/monkeyecx-format-type-document.mjs} +4 -4
  84. package/{esm2015/lib/core/pipes/monkeyecx-format-value.js → esm2020/lib/core/pipes/monkeyecx-format-value.mjs} +4 -4
  85. package/{esm2015/lib/core/pipes/monkeyecx-format-zipcode.js → esm2020/lib/core/pipes/monkeyecx-format-zipcode.mjs} +4 -4
  86. package/{esm2015/lib/core/pipes/monkeyecx-pipes.module.js → esm2020/lib/core/pipes/monkeyecx-pipes.module.mjs} +5 -5
  87. package/{esm2015/lib/core/pipes/monkeyecx-text-truncate.js → esm2020/lib/core/pipes/monkeyecx-text-truncate.mjs} +4 -4
  88. package/{esm2015/lib/core/pipes/monkeyecx-truncate-qtd.js → esm2020/lib/core/pipes/monkeyecx-truncate-qtd.mjs} +4 -4
  89. package/{esm2015/lib/core/services/auth/index.js → esm2020/lib/core/services/auth/index.mjs} +1 -1
  90. package/{esm2015/lib/core/services/auth/monkeyecx-auth-guard-login.service.js → esm2020/lib/core/services/auth/monkeyecx-auth-guard-login.service.mjs} +4 -4
  91. package/{esm2015/lib/core/services/auth/monkeyecx-auth-guard.service.js → esm2020/lib/core/services/auth/monkeyecx-auth-guard.service.mjs} +4 -4
  92. package/esm2020/lib/core/services/auth/monkeyecx-authentication.service.mjs +61 -0
  93. package/{esm2015/lib/core/services/commons/index.js → esm2020/lib/core/services/commons/index.mjs} +1 -1
  94. package/esm2020/lib/core/services/commons/monkeyecx-commons.service.mjs +288 -0
  95. package/{esm2015/lib/core/services/config/monkeyecx-config.module.js → esm2020/lib/core/services/config/monkeyecx-config.module.mjs} +5 -5
  96. package/{esm2015/lib/core/services/config/monkeyecx-config.service.js → esm2020/lib/core/services/config/monkeyecx-config.service.mjs} +11 -9
  97. package/esm2020/lib/core/services/config/monkeyecx-error-config.service.mjs +85 -0
  98. package/esm2020/lib/core/services/config/monkeyecx-feature-toggle.service.mjs +67 -0
  99. package/esm2020/lib/core/services/config/monkeyecx-i18n-config.service.mjs +74 -0
  100. package/esm2020/lib/core/services/config/monkeyecx-logs-config.service.mjs +34 -0
  101. package/{esm2015/lib/core/services/config/monkeyecx-maintenance-config.service.js → esm2020/lib/core/services/config/monkeyecx-maintenance-config.service.mjs} +4 -4
  102. package/esm2020/lib/core/services/config/monkeyecx-security-console-config.service.mjs +42 -0
  103. package/esm2020/lib/core/services/config/monkeyecx-service-worker-config.service.mjs +53 -0
  104. package/{esm2015/lib/core/services/error/index.js → esm2020/lib/core/services/error/index.mjs} +1 -1
  105. package/{esm2015/lib/core/services/error/monkeyecx-error-handling.module.js → esm2020/lib/core/services/error/monkeyecx-error-handling.module.mjs} +5 -5
  106. package/esm2020/lib/core/services/error/monkeyecx-error-handling.service.mjs +41 -0
  107. package/esm2020/lib/core/services/error/monkeyecx-http-error-handling.service.mjs +127 -0
  108. package/{esm2015/lib/core/services/error/monkeyecx-others-errors-handling.service.js → esm2020/lib/core/services/error/monkeyecx-others-errors-handling.service.mjs} +4 -4
  109. package/{esm2015/lib/core/services/index.js → esm2020/lib/core/services/index.mjs} +1 -1
  110. package/{esm2015/lib/core/services/logged/index.js → esm2020/lib/core/services/logged/index.mjs} +1 -1
  111. package/{esm2015/lib/core/services/logged/monkeyecx-logged-handling.service.js → esm2020/lib/core/services/logged/monkeyecx-logged-handling.service.mjs} +4 -4
  112. package/esm2020/lib/core/services/monkeyecx-handling.service.mjs +50 -0
  113. package/esm2020/lib/core/services/monkeyecx-service.service.mjs +104 -0
  114. package/{esm2015/lib/core/services/request-download/index.js → esm2020/lib/core/services/request-download/index.mjs} +1 -1
  115. package/esm2020/lib/core/services/request-download/monkeyecx-request-download-handling.service.mjs +93 -0
  116. package/esm2020/lib/core/services/request-download/monkeyecx-request-downloaded-handling.service.mjs +61 -0
  117. package/{esm2015/lib/core/services/request-paged/index.js → esm2020/lib/core/services/request-paged/index.mjs} +1 -1
  118. package/esm2020/lib/core/services/request-paged/monkeyecx-request-request-paged-handling.mjs +37 -0
  119. package/{esm2015/lib/core/services/request-queue/index.js → esm2020/lib/core/services/request-queue/index.mjs} +1 -1
  120. package/esm2020/lib/core/services/request-queue/monkeyecx-request-queue-handling.service.mjs +114 -0
  121. package/esm2020/lib/core/services/request-queue/monkeyecx-request-queue-modal-handling.service.mjs +119 -0
  122. package/{esm2015/lib/core/services/routes/index.js → esm2020/lib/core/services/routes/index.mjs} +1 -1
  123. package/esm2020/lib/core/services/routes/monkeyecx-dicovery-params.service.mjs +54 -0
  124. package/{esm2015/lib/core/services/schedules/index.js → esm2020/lib/core/services/schedules/index.mjs} +1 -1
  125. package/esm2020/lib/core/services/schedules/monkeyecx-request-schedule.service.mjs +113 -0
  126. package/{esm2015/lib/core/services/storage/index.js → esm2020/lib/core/services/storage/index.mjs} +1 -1
  127. package/{esm2015/lib/core/services/storage/monkeyecx-cookie-storage.service.js → esm2020/lib/core/services/storage/monkeyecx-cookie-storage.service.mjs} +4 -4
  128. package/esm2020/lib/core/services/storage/monkeyecx-token-storage.service.mjs +126 -0
  129. package/{esm2015/lib/core/specification-search/index.js → esm2020/lib/core/specification-search/index.mjs} +1 -1
  130. package/{esm2015/lib/core/specification-search/monkeyecx-specification-search.js → esm2020/lib/core/specification-search/monkeyecx-specification-search.mjs} +2 -3
  131. package/esm2020/lib/core/utils/decorators-utils.mjs +40 -0
  132. package/{esm2015/lib/core/utils/index.js → esm2020/lib/core/utils/index.mjs} +1 -1
  133. package/{esm2015/lib/core/utils/statics.js → esm2020/lib/core/utils/statics.mjs} +1 -1
  134. package/esm2020/lib/core/utils/utils.mjs +218 -0
  135. package/esm2020/lib/core/utils/validate-utils.mjs +206 -0
  136. package/esm2020/lib/core/utils/validators.mjs +208 -0
  137. package/{esm2015/lib/monkey-front-core.module.js → esm2020/lib/monkey-front-core.module.mjs} +5 -5
  138. package/{esm2015/monkey-front-core.js → esm2020/monkey-front-core.mjs} +0 -0
  139. package/{esm2015/public-api.js → esm2020/public-api.mjs} +1 -1
  140. package/fesm2015/{monkey-front-core.js → monkey-front-core.mjs} +226 -229
  141. package/fesm2015/monkey-front-core.mjs.map +1 -0
  142. package/fesm2020/monkey-front-core.mjs +4273 -0
  143. package/fesm2020/monkey-front-core.mjs.map +1 -0
  144. package/lib/core/pipes/monkeyecx-format-currency.d.ts +1 -1
  145. package/lib/core/services/auth/monkeyecx-authentication.service.d.ts +3 -3
  146. package/lib/core/services/commons/monkeyecx-commons.service.d.ts +15 -15
  147. package/lib/core/services/schedules/monkeyecx-request-schedule.service.d.ts +1 -1
  148. package/lib/core/utils/validate-utils.d.ts +13 -13
  149. package/monkey-front-core-0.0.103.tgz +0 -0
  150. package/package.json +20 -7
  151. package/bundles/monkey-front-core.umd.js +0 -4900
  152. package/bundles/monkey-front-core.umd.js.map +0 -1
  153. package/esm2015/lib/components/closed-to-maintenance/closed-to-maintenance.component.js +0 -35
  154. package/esm2015/lib/components/progress-bar/progress-bar.component.js +0 -29
  155. package/esm2015/lib/components/progress-bar/progress-bar.service.js +0 -53
  156. package/esm2015/lib/components/version-changed/version-changed.component.js +0 -29
  157. package/esm2015/lib/core/decorators/monkeyecx-decorators.js +0 -112
  158. package/esm2015/lib/core/decorators/monkeyecx-download-decorators.js +0 -25
  159. package/esm2015/lib/core/decorators/monkeyecx-upload-decorators.js +0 -25
  160. package/esm2015/lib/core/directives/monkeyecx-drag-drop.js +0 -57
  161. package/esm2015/lib/core/directives/monkeyecx-feature-directive.js +0 -68
  162. package/esm2015/lib/core/directives/monkeyecx-format-upper.js +0 -69
  163. package/esm2015/lib/core/directives/monkeyecx-security-directive.js +0 -69
  164. package/esm2015/lib/core/directives/monkeyecx-tooltip-directive.js +0 -124
  165. package/esm2015/lib/core/interceptors/monkeyecx-http-config-error.interceptor.js +0 -40
  166. package/esm2015/lib/core/interceptors/monkeyecx-http-config-header.interceptor.js +0 -33
  167. package/esm2015/lib/core/interceptors/monkeyecx-http-config-loading-in-progress.interceptor.js +0 -44
  168. package/esm2015/lib/core/interceptors/monkeyecx-http-config-queue.interceptor.js +0 -38
  169. package/esm2015/lib/core/interfaces/monkeyecx-auth-credentials.js +0 -2
  170. package/esm2015/lib/core/interfaces/monkeyecx-config-boostrap.js +0 -2
  171. package/esm2015/lib/core/interfaces/monkeyecx-config.js +0 -2
  172. package/esm2015/lib/core/interfaces/monkeyecx-me-credentials.js +0 -2
  173. package/esm2015/lib/core/interfaces/monkeyecx-navigation.js +0 -2
  174. package/esm2015/lib/core/interfaces/monkeyecx-request-paged.js +0 -2
  175. package/esm2015/lib/core/interfaces/monkeyecx-service-credentials.js +0 -2
  176. package/esm2015/lib/core/interfaces/monkeyecx-token-credentials.js +0 -2
  177. package/esm2015/lib/core/interfaces/schedules/monkeyecx-request-schedule.js +0 -2
  178. package/esm2015/lib/core/pipes/monkeyecx-format-date-group.js +0 -46
  179. package/esm2015/lib/core/services/auth/monkeyecx-authentication.service.js +0 -61
  180. package/esm2015/lib/core/services/commons/monkeyecx-commons.service.js +0 -265
  181. package/esm2015/lib/core/services/config/monkeyecx-error-config.service.js +0 -85
  182. package/esm2015/lib/core/services/config/monkeyecx-feature-toggle.service.js +0 -70
  183. package/esm2015/lib/core/services/config/monkeyecx-i18n-config.service.js +0 -72
  184. package/esm2015/lib/core/services/config/monkeyecx-logs-config.service.js +0 -34
  185. package/esm2015/lib/core/services/config/monkeyecx-security-console-config.service.js +0 -42
  186. package/esm2015/lib/core/services/config/monkeyecx-service-worker-config.service.js +0 -54
  187. package/esm2015/lib/core/services/error/monkeyecx-error-handling.service.js +0 -41
  188. package/esm2015/lib/core/services/error/monkeyecx-http-error-handling.service.js +0 -132
  189. package/esm2015/lib/core/services/monkeyecx-handling.service.js +0 -50
  190. package/esm2015/lib/core/services/monkeyecx-service.service.js +0 -102
  191. package/esm2015/lib/core/services/request-download/monkeyecx-request-download-handling.service.js +0 -81
  192. package/esm2015/lib/core/services/request-download/monkeyecx-request-downloaded-handling.service.js +0 -55
  193. package/esm2015/lib/core/services/request-paged/monkeyecx-request-request-paged-handling.js +0 -37
  194. package/esm2015/lib/core/services/request-queue/monkeyecx-request-queue-handling.service.js +0 -101
  195. package/esm2015/lib/core/services/request-queue/monkeyecx-request-queue-modal-handling.service.js +0 -106
  196. package/esm2015/lib/core/services/routes/monkeyecx-dicovery-params.service.js +0 -55
  197. package/esm2015/lib/core/services/schedules/monkeyecx-request-schedule.service.js +0 -99
  198. package/esm2015/lib/core/services/storage/monkeyecx-token-storage.service.js +0 -123
  199. package/esm2015/lib/core/utils/decorators-utils.js +0 -37
  200. package/esm2015/lib/core/utils/utils.js +0 -219
  201. package/esm2015/lib/core/utils/validate-utils.js +0 -210
  202. package/esm2015/lib/core/utils/validators.js +0 -211
  203. package/fesm2015/monkey-front-core.js.map +0 -1
  204. package/monkey-front-core-0.0.99.tgz +0 -0
@@ -0,0 +1,4273 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Pipe, Component, ViewEncapsulation, Input, Injectable, NgModule, EventEmitter, Directive, Output, HostBinding, HostListener, forwardRef, Self, NgZone, ErrorHandler, Optional, SkipSelf } from '@angular/core';
3
+ import * as i1 from 'monkey-style-guide';
4
+ import { MonkeyButtonModule, MonkeyIconModule, MonkeyInputModule, MonkeyModalModule, MonkeyUtils, MonkeyStyleGuideModule, MonkeyStyleGuideModalService, MonkeyStyleGuideSettingsService, MonkeyStyleGuideSnackbarService } from 'monkey-style-guide';
5
+ import * as i2 from '@angular/common';
6
+ import { formatNumber, CurrencyPipe, CommonModule } from '@angular/common';
7
+ import * as i1$1 from '@ngx-translate/core';
8
+ import { TranslateService, TranslateModule } from '@ngx-translate/core';
9
+ import * as moment_ from 'moment';
10
+ import * as i1$2 from 'ngx-cookie-service';
11
+ import * as i1$3 from '@angular/router';
12
+ import { NavigationStart, NavigationEnd, NavigationError, NavigationCancel } from '@angular/router';
13
+ import { BehaviorSubject, throwError, combineLatest, interval, concat, of, Subject } from 'rxjs';
14
+ import { filter, take, takeWhile, map, catchError, first, takeUntil, mergeMap, finalize } from 'rxjs/operators';
15
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
16
+ import { __decorate } from 'tslib';
17
+ import * as i1$4 from '@angular/common/http';
18
+ import { HttpParams, HttpErrorResponse, HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
19
+ import { datadogRum } from '@datadog/browser-rum';
20
+ import * as i1$5 from '@angular/service-worker';
21
+ import { ServiceWorkerModule } from '@angular/service-worker';
22
+ import { initialize } from 'launchdarkly-js-client-sdk';
23
+
24
+ /* eslint-disable comma-dangle */
25
+ /* eslint-disable max-len */
26
+ /* eslint-disable no-useless-escape */
27
+ /* eslint-disable no-plusplus */
28
+ /* eslint-disable no-cond-assign */
29
+ /* eslint-disable eqeqeq */
30
+ /* eslint-disable no-redeclare */
31
+ /* eslint-disable vars-on-top */
32
+ /* eslint-disable no-var */
33
+ /* eslint-disable block-scoped-var */
34
+ class MonkeyEcxUtils {
35
+ static persistNullEmptyUndefined(tp) {
36
+ return tp !== null && tp !== undefined && tp !== '';
37
+ }
38
+ static getDocumentType(doc, country) {
39
+ if (!doc)
40
+ return '';
41
+ if (country === 'cl')
42
+ return 'RUT';
43
+ return doc.length <= 11 ? 'CPF' : 'CNPJ';
44
+ }
45
+ static getDocumentMask(type) {
46
+ if (type === 'CPF')
47
+ return '000.000.000-00';
48
+ return '00.000.000/0000-00';
49
+ }
50
+ static formatDocumentWithMask(doc, withType, country) {
51
+ if (!doc)
52
+ return doc;
53
+ let formated = '';
54
+ if (country === 'cl') {
55
+ formated = doc.replace(/^(\d{1,2})(\d{3})(\d{3})(\w{1})$/, '$1.$2.$3-$4');
56
+ return `${formated}`;
57
+ }
58
+ if (doc.length === 14) {
59
+ formated = doc
60
+ .replace(/^(\d{2})(\d)/, '$1.$2')
61
+ .replace(/^(\d{2})\.(\d{3})(\d)/, '$1.$2.$3')
62
+ .replace(/\.(\d{3})(\d)/, '.$1/$2')
63
+ .replace(/(\d{4})(\d)/, '$1-$2');
64
+ }
65
+ else {
66
+ formated = doc
67
+ .replace(/^(\d{3})(\d)/, '$1.$2')
68
+ .replace(/^(\d{3})\.(\d{3})(\d)/, '$1.$2.$3')
69
+ .replace(/\.(\d{3})(\d)/, '.$1-$2');
70
+ }
71
+ return `${withType ? `${this.getDocumentType(doc)}:` : ''} ${formated}`;
72
+ }
73
+ static cutFirstLastName(value, tp = 'first') {
74
+ const split = value?.trim()?.split(' ');
75
+ if (tp === 'first')
76
+ return split[0];
77
+ return split?.splice(1, split.length)?.join(' ');
78
+ }
79
+ static isCPFCNPJValid(document) {
80
+ document = document.replace(/[^\d]/g, '');
81
+ if (document.length === 11) {
82
+ let base = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0];
83
+ for (var i = 0, n = 0; i < 9; n += document[i] * base[i++])
84
+ ;
85
+ if (document[9] != ((n %= 11) <= 1 ? 0 : 11 - n)) {
86
+ return false;
87
+ }
88
+ base = [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0];
89
+ for (var i = 0, n = 0; i <= 9; n += document[i] * base[i++])
90
+ ;
91
+ if (document[10] != ((n %= 11) <= 1 ? 0 : 11 - n)) {
92
+ return false;
93
+ }
94
+ return true;
95
+ }
96
+ if (document.length === 14 || /0{14}/.test(document)) {
97
+ const base = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
98
+ for (var i = 0, n = 0; i < 12; n += document[i] * base[++i])
99
+ ;
100
+ if (document[12] != ((n %= 11) < 2 ? 0 : 11 - n)) {
101
+ return false;
102
+ }
103
+ for (var i = 0, n = 0; i <= 12; n += document[i] * base[i++])
104
+ ;
105
+ if (document[13] != ((n %= 11) < 2 ? 0 : 11 - n)) {
106
+ return false;
107
+ }
108
+ return true;
109
+ }
110
+ return false;
111
+ }
112
+ static isValidRUT(document) {
113
+ if (!document || document.trim().length < 3)
114
+ return false;
115
+ const documentHandled = document.replace(/[^0-9kK]/g, '');
116
+ if (documentHandled.length < 3)
117
+ return false;
118
+ const calcDv = (rut) => {
119
+ const value = `${rut}`;
120
+ let sum = 0;
121
+ let mult = 2;
122
+ for (let i = 1; i <= value.length; i++) {
123
+ const index = mult * Number(value.charAt(value.length - i));
124
+ sum += index;
125
+ if (mult < 7) {
126
+ mult += 1;
127
+ }
128
+ else {
129
+ mult = 2;
130
+ }
131
+ }
132
+ const dvEsperado = 11 - (sum % 11);
133
+ if (dvEsperado === 10)
134
+ return 'K';
135
+ if (dvEsperado === 11)
136
+ return '0';
137
+ return `${dvEsperado}`;
138
+ };
139
+ const num = documentHandled.slice(0, -1);
140
+ const dgv = documentHandled.slice(-1).toUpperCase();
141
+ const dvCalc = calcDv(num);
142
+ return dvCalc === dgv;
143
+ }
144
+ static isValidUrl(txt) {
145
+ const regex = new RegExp(/^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)+[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,10}(:[0-9]{1,5})?(\/.*)?$/gm);
146
+ return regex.test(txt);
147
+ }
148
+ static isValidZipCode(zipCode) {
149
+ return `${this.handleOnlyNumbers(zipCode)}`.length === 8;
150
+ }
151
+ static getRandomString(len, charSet) {
152
+ charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
153
+ const randomString = new Array(len)
154
+ .fill('1')
155
+ .map(() => {
156
+ return charSet?.charAt(Math.floor(Math.random() * charSet?.length));
157
+ })
158
+ .join('');
159
+ return randomString;
160
+ }
161
+ static handleOnlyNumbers(value) {
162
+ if (!value)
163
+ return null;
164
+ return value.replace(new RegExp(/[^0-9]/g), '');
165
+ }
166
+ static handleOnlyAlphaNumeric(value) {
167
+ if (!value)
168
+ return '';
169
+ return value.replace(new RegExp(/[^0-9A-Za-z]/, 'g'), '');
170
+ }
171
+ static capitalize(value) {
172
+ return `${value.charAt(0).toUpperCase()}${value.slice(1)}`;
173
+ }
174
+ static formatZipCode(zipCode) {
175
+ if (!zipCode)
176
+ return zipCode;
177
+ const formated = zipCode
178
+ .replace(/^(\d{5})(\d)/, '$1-$2')
179
+ .replace(/\.(\d{3})(\d)/, '.$1-$2');
180
+ return `${formated}`;
181
+ }
182
+ static formatFileSize(size) {
183
+ const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
184
+ let l = 0;
185
+ while (size >= 1024 && ++l) {
186
+ size /= 1024;
187
+ }
188
+ return `${size.toFixed(size < 10 && l > 0 ? 1 : 0)} ${units[l]}`;
189
+ }
190
+ static sufflue(data) {
191
+ for (let i = data.length - 1; i > 0; i--) {
192
+ const j = Math.floor(Math.random() * i);
193
+ const temp = data[i];
194
+ data[i] = data[j];
195
+ data[j] = temp;
196
+ }
197
+ return data;
198
+ }
199
+ static handleBlobFile(theBlob, fileName, fileType) {
200
+ function blobToFile(theBlob, fileName) {
201
+ const b = theBlob;
202
+ b.lastModifiedDate = new Date();
203
+ b.name = fileName;
204
+ return b;
205
+ }
206
+ let file;
207
+ if (!navigator.msSaveBlob) {
208
+ file = new File([theBlob], fileName, {
209
+ type: fileType,
210
+ });
211
+ }
212
+ else {
213
+ file = new Blob([theBlob], {
214
+ type: fileType,
215
+ });
216
+ file = blobToFile(file, fileName);
217
+ }
218
+ return file;
219
+ }
220
+ static truncate(text, maxLength = 25) {
221
+ const midChar = '...';
222
+ if (!text)
223
+ return midChar;
224
+ if (text && text.length <= maxLength)
225
+ return text;
226
+ const left = Math.ceil(maxLength / 2);
227
+ const right = text.length - left + 1;
228
+ return `${text.substr(0, left)} ${midChar} ${text.substring(right)}`;
229
+ }
230
+ static isLocalhost() {
231
+ const { href } = window?.location;
232
+ if (!href)
233
+ return false;
234
+ return href?.search('localhost') >= 0;
235
+ }
236
+ static isSameOrigin(frontend) {
237
+ const initialPath = window.location.origin;
238
+ return (initialPath || '') === frontend;
239
+ }
240
+ }
241
+
242
+ const moment$3 = moment_;
243
+ class MonkeyEcxFormatDateTimelapsePipe {
244
+ transform(date, showTime = false, useUtc = true, format = '- HH:mm') {
245
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(date))
246
+ return '';
247
+ let stillUtc = moment$3.default.utc(date).toDate();
248
+ if (!useUtc)
249
+ stillUtc = moment$3.default(date).toDate();
250
+ if (date.toString().indexOf(':') <= -1) {
251
+ if (typeof date === 'string') {
252
+ stillUtc = date;
253
+ showTime = false;
254
+ }
255
+ }
256
+ const formatFrom = `YYYY/MM/DD${showTime ? ` ${format}` : ''}`;
257
+ const formatTo = `DD/MM/YYYY${showTime ? ` ${format}` : ''}`;
258
+ return `${moment$3.default(stillUtc, formatFrom).format(formatTo)}`;
259
+ }
260
+ }
261
+ MonkeyEcxFormatDateTimelapsePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatDateTimelapsePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
262
+ MonkeyEcxFormatDateTimelapsePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatDateTimelapsePipe, name: "monkeyecxFormatDateTimelapse" });
263
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatDateTimelapsePipe, decorators: [{
264
+ type: Pipe,
265
+ args: [{
266
+ name: 'monkeyecxFormatDateTimelapse',
267
+ }]
268
+ }] });
269
+
270
+ class ClosedToMaintenanceComponent {
271
+ constructor() {
272
+ this.config = null;
273
+ this._configBoostrap = null;
274
+ }
275
+ ngOnInit() {
276
+ this._configBoostrap = this.config?.data;
277
+ }
278
+ onClose() {
279
+ document.location.reload();
280
+ }
281
+ }
282
+ ClosedToMaintenanceComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ClosedToMaintenanceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
283
+ ClosedToMaintenanceComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: ClosedToMaintenanceComponent, selector: "monkeyecx-closed-to-maintenance", inputs: { config: "config", modalRef: "modalRef" }, ngImport: i0, template: "<monkey-modal [config]=\"config\" [modalRef]=\"modalRef\" *ngIf=\"config\">\n <div class=\"d-flex flex-column justify-content-center align-items-center\">\n <span class=\"h2\">\n {{ 'SCREENS.CLOSED-TO-MAINTENANCE.TITLE' | translate }}\n </span>\n <span class=\"information-title mt-4\">\n {{ 'SCREENS.CLOSED-TO-MAINTENANCE.INFORMATION-1' | translate }}\n </span>\n <span class=\"information-title mt-4\">\n {{ 'SCREENS.CLOSED-TO-MAINTENANCE.INFORMATION-2' | translate }}\n </span>\n <span class=\"information mt-3\">\n {{ 'SCREENS.CLOSED-TO-MAINTENANCE.INFORMATION-3' | translate }}\n {{ _configBoostrap?.maintenance?.endDate | monkeyecxFormatDateTimelapse: true }}\n </span>\n <span class=\"information-title mt-4\">\n {{ 'SCREENS.CLOSED-TO-MAINTENANCE.INFORMATION-4' | translate }}\n </span>\n </div>\n <div class=\"d-flex flex-column justify-content-center align-items-center mt-5\">\n <monkey-button type=\"primary\" color=\"theme\" (click)=\"onClose()\">\n {{ 'SCREENS.CLOSED-TO-MAINTENANCE.BUTTONS.UPDATE-MAINTENANCE' | translate }}\n </monkey-button>\n </div>\n</monkey-modal>", styles: ["monkeyecx-closed-to-maintenance .body{padding:24px;width:100%}monkeyecx-closed-to-maintenance .information-title{font-style:normal;font-weight:600;font-size:25px;line-height:32px;display:flex;align-items:center;text-align:center;color:#4b4a53}monkeyecx-closed-to-maintenance .information{font-style:normal;font-weight:400;font-size:20px;line-height:24px;display:flex;align-items:center;text-align:center;color:#4b4a53;max-width:600px}monkeyecx-closed-to-maintenance .browser-name{font-style:normal;font-weight:400;font-size:16px;line-height:24px;text-align:center;color:#9c9ca6}monkeyecx-closed-to-maintenance .option{text-decoration:none;padding:4px;background:#eee;border:1px solid #d6d6d6;box-sizing:border-box;border-radius:16px}monkeyecx-closed-to-maintenance monkey-modal mecx-monkey-modal .body{margin-bottom:0!important}\n"], components: [{ type: i1.MonkeyModalComponent, selector: "monkey-modal", inputs: ["config", "modalRef", "onHandleConfirm"] }, { type: i1.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i1$1.TranslatePipe, "monkeyecxFormatDateTimelapse": MonkeyEcxFormatDateTimelapsePipe }, encapsulation: i0.ViewEncapsulation.None });
284
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ClosedToMaintenanceComponent, decorators: [{
285
+ type: Component,
286
+ args: [{ selector: 'monkeyecx-closed-to-maintenance', encapsulation: ViewEncapsulation.None, template: "<monkey-modal [config]=\"config\" [modalRef]=\"modalRef\" *ngIf=\"config\">\n <div class=\"d-flex flex-column justify-content-center align-items-center\">\n <span class=\"h2\">\n {{ 'SCREENS.CLOSED-TO-MAINTENANCE.TITLE' | translate }}\n </span>\n <span class=\"information-title mt-4\">\n {{ 'SCREENS.CLOSED-TO-MAINTENANCE.INFORMATION-1' | translate }}\n </span>\n <span class=\"information-title mt-4\">\n {{ 'SCREENS.CLOSED-TO-MAINTENANCE.INFORMATION-2' | translate }}\n </span>\n <span class=\"information mt-3\">\n {{ 'SCREENS.CLOSED-TO-MAINTENANCE.INFORMATION-3' | translate }}\n {{ _configBoostrap?.maintenance?.endDate | monkeyecxFormatDateTimelapse: true }}\n </span>\n <span class=\"information-title mt-4\">\n {{ 'SCREENS.CLOSED-TO-MAINTENANCE.INFORMATION-4' | translate }}\n </span>\n </div>\n <div class=\"d-flex flex-column justify-content-center align-items-center mt-5\">\n <monkey-button type=\"primary\" color=\"theme\" (click)=\"onClose()\">\n {{ 'SCREENS.CLOSED-TO-MAINTENANCE.BUTTONS.UPDATE-MAINTENANCE' | translate }}\n </monkey-button>\n </div>\n</monkey-modal>", styles: ["monkeyecx-closed-to-maintenance .body{padding:24px;width:100%}monkeyecx-closed-to-maintenance .information-title{font-style:normal;font-weight:600;font-size:25px;line-height:32px;display:flex;align-items:center;text-align:center;color:#4b4a53}monkeyecx-closed-to-maintenance .information{font-style:normal;font-weight:400;font-size:20px;line-height:24px;display:flex;align-items:center;text-align:center;color:#4b4a53;max-width:600px}monkeyecx-closed-to-maintenance .browser-name{font-style:normal;font-weight:400;font-size:16px;line-height:24px;text-align:center;color:#9c9ca6}monkeyecx-closed-to-maintenance .option{text-decoration:none;padding:4px;background:#eee;border:1px solid #d6d6d6;box-sizing:border-box;border-radius:16px}monkeyecx-closed-to-maintenance monkey-modal mecx-monkey-modal .body{margin-bottom:0!important}\n"] }]
287
+ }], propDecorators: { config: [{
288
+ type: Input
289
+ }], modalRef: [{
290
+ type: Input
291
+ }] } });
292
+
293
+ class MonkeyEcxDisplayFirstNamePipe {
294
+ transform(name) {
295
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(name))
296
+ return '';
297
+ return MonkeyEcxUtils.cutFirstLastName(name);
298
+ }
299
+ }
300
+ MonkeyEcxDisplayFirstNamePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxDisplayFirstNamePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
301
+ MonkeyEcxDisplayFirstNamePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxDisplayFirstNamePipe, name: "monkeyecxDisplayFirstName" });
302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxDisplayFirstNamePipe, decorators: [{
303
+ type: Pipe,
304
+ args: [{
305
+ name: 'monkeyecxDisplayFirstName'
306
+ }]
307
+ }] });
308
+
309
+ class MonkeyEcxFormatAddressPipe {
310
+ transform({ zipCode, address, neighborhood, city, state, }) {
311
+ return [address, neighborhood, zipCode, city, state]
312
+ .filter((_) => {
313
+ return _;
314
+ })
315
+ .join(', ');
316
+ }
317
+ }
318
+ MonkeyEcxFormatAddressPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatAddressPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
319
+ MonkeyEcxFormatAddressPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatAddressPipe, name: "monkeyecxFormatAddress" });
320
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatAddressPipe, decorators: [{
321
+ type: Pipe,
322
+ args: [{
323
+ name: 'monkeyecxFormatAddress',
324
+ }]
325
+ }] });
326
+
327
+ /* eslint-disable object-curly-newline */
328
+ class MonkeyEcxCookieStorageService {
329
+ constructor(cookieService) {
330
+ this.cookieService = cookieService;
331
+ // not to do
332
+ }
333
+ setCookie(name, value) {
334
+ this.removeCookie(name);
335
+ this.cookieService.set(name, value, undefined, '/', '', true, 'None');
336
+ }
337
+ getCookie(name) {
338
+ return this.cookieService.get(name);
339
+ }
340
+ removeCookie(name) {
341
+ this.cookieService.delete(name, '/');
342
+ }
343
+ }
344
+ MonkeyEcxCookieStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxCookieStorageService, deps: [{ token: i1$2.CookieService }], target: i0.ɵɵFactoryTarget.Injectable });
345
+ MonkeyEcxCookieStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxCookieStorageService, providedIn: 'root' });
346
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxCookieStorageService, decorators: [{
347
+ type: Injectable,
348
+ args: [{
349
+ providedIn: 'root'
350
+ }]
351
+ }], ctorParameters: function () { return [{ type: i1$2.CookieService }]; } });
352
+
353
+ class MonkeyEcxFormatCurrencyPipe {
354
+ constructor(injector, currencyPipe) {
355
+ this.injector = injector;
356
+ this.currencyPipe = currencyPipe;
357
+ // not to do
358
+ }
359
+ transform(value) {
360
+ const cookieStorageService = this.injector.get(MonkeyEcxCookieStorageService);
361
+ const cookie = cookieStorageService.getCookie('monkey-app-locale');
362
+ const i18n = JSON.parse(atob(cookie));
363
+ const { currency } = i18n;
364
+ return this.currencyPipe.transform(value, currency, 'symbol');
365
+ }
366
+ }
367
+ MonkeyEcxFormatCurrencyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatCurrencyPipe, deps: [{ token: i0.Injector }, { token: i2.CurrencyPipe }], target: i0.ɵɵFactoryTarget.Pipe });
368
+ MonkeyEcxFormatCurrencyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatCurrencyPipe, name: "monkeyecxFormatCurrency" });
369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatCurrencyPipe, decorators: [{
370
+ type: Pipe,
371
+ args: [{
372
+ name: 'monkeyecxFormatCurrency'
373
+ }]
374
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i2.CurrencyPipe }]; } });
375
+
376
+ class MonkeyEcxFormatDocumentPipe {
377
+ transform(document, withType) {
378
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(document))
379
+ return '';
380
+ return MonkeyEcxUtils.formatDocumentWithMask(document, withType);
381
+ }
382
+ }
383
+ MonkeyEcxFormatDocumentPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatDocumentPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
384
+ MonkeyEcxFormatDocumentPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatDocumentPipe, name: "monkeyecxFormatDocument" });
385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatDocumentPipe, decorators: [{
386
+ type: Pipe,
387
+ args: [{
388
+ name: 'monkeyecxFormatDocument'
389
+ }]
390
+ }] });
391
+
392
+ class MonkeyEcxFormatNumberPipe {
393
+ transform(number) {
394
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(number))
395
+ return '';
396
+ return formatNumber(Number(number), 'ptbr');
397
+ }
398
+ }
399
+ MonkeyEcxFormatNumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatNumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
400
+ MonkeyEcxFormatNumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatNumberPipe, name: "monkeyecxFormatNumber" });
401
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatNumberPipe, decorators: [{
402
+ type: Pipe,
403
+ args: [{
404
+ name: 'monkeyecxFormatNumber'
405
+ }]
406
+ }] });
407
+
408
+ class MonkeyEcxFormatPhonePipe {
409
+ transform(phone) {
410
+ if (phone) {
411
+ const value = `${phone || ''}`.replace(/\D/g, '');
412
+ let formated = '';
413
+ if (value.length > 12) {
414
+ formated = value.replace(/(\d{2})?(\d{2})?(\d{5})?(\d{4})/, '+$1 ($2) $3-$4');
415
+ }
416
+ else if (value.length > 11) {
417
+ formated = value.replace(/(\d{2})?(\d{2})?(\d{4})?(\d{4})/, '+$1 ($2) $3-$4');
418
+ }
419
+ else if (value.length > 10) {
420
+ formated = value.replace(/(\d{2})?(\d{5})?(\d{4})/, '($1) $2-$3');
421
+ }
422
+ else if (value.length > 9) {
423
+ formated = value.replace(/(\d{2})?(\d{4})?(\d{4})/, '($1) $2-$3');
424
+ }
425
+ else if (value.length > 5) {
426
+ formated = value.replace(/^(\d{2})?(\d{4})?(\d{0,4})/, '($1) $2-$3');
427
+ }
428
+ else if (value.length > 1) {
429
+ formated = value.replace(/^(\d{2})?(\d{0,5})/, '($1) $2');
430
+ }
431
+ else if (phone !== '') {
432
+ formated = value.replace(/^(\d*)/, '($1');
433
+ }
434
+ return formated;
435
+ }
436
+ return '';
437
+ }
438
+ }
439
+ MonkeyEcxFormatPhonePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatPhonePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
440
+ MonkeyEcxFormatPhonePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatPhonePipe, name: "monkeyecxFormatPhone" });
441
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatPhonePipe, decorators: [{
442
+ type: Pipe,
443
+ args: [{
444
+ name: 'monkeyecxFormatPhone'
445
+ }]
446
+ }] });
447
+
448
+ class MonkeyEcxFormatSizePipe {
449
+ transform(size) {
450
+ if (!size)
451
+ return '0 B';
452
+ const sizeNum = Number(size);
453
+ return MonkeyEcxUtils.formatFileSize(sizeNum);
454
+ }
455
+ }
456
+ MonkeyEcxFormatSizePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatSizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
457
+ MonkeyEcxFormatSizePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatSizePipe, name: "monkeyecxFormatSize" });
458
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatSizePipe, decorators: [{
459
+ type: Pipe,
460
+ args: [{
461
+ name: 'monkeyecxFormatSize'
462
+ }]
463
+ }] });
464
+
465
+ class MonkeyEcxFormatDocumentTypePipe {
466
+ transform(document) {
467
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(document))
468
+ return '';
469
+ return MonkeyEcxUtils.getDocumentType(document);
470
+ }
471
+ }
472
+ MonkeyEcxFormatDocumentTypePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatDocumentTypePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
473
+ MonkeyEcxFormatDocumentTypePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatDocumentTypePipe, name: "monkeyecxFormatDocumentType" });
474
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatDocumentTypePipe, decorators: [{
475
+ type: Pipe,
476
+ args: [{
477
+ name: 'monkeyecxFormatDocumentType'
478
+ }]
479
+ }] });
480
+
481
+ class MonkeyEcxFormatValue {
482
+ transform(number) {
483
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(number))
484
+ return '';
485
+ return number;
486
+ }
487
+ }
488
+ MonkeyEcxFormatValue.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatValue, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
489
+ MonkeyEcxFormatValue.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatValue, name: "monkeyecxFormatValue" });
490
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatValue, decorators: [{
491
+ type: Pipe,
492
+ args: [{
493
+ name: 'monkeyecxFormatValue'
494
+ }]
495
+ }] });
496
+
497
+ class MonkeyEcxFormatZipCodePipe {
498
+ transform(zipCode) {
499
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(zipCode))
500
+ return '';
501
+ return MonkeyEcxUtils.formatZipCode(zipCode);
502
+ }
503
+ }
504
+ MonkeyEcxFormatZipCodePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatZipCodePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
505
+ MonkeyEcxFormatZipCodePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatZipCodePipe, name: "monkeyecxFormatZipCode" });
506
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatZipCodePipe, decorators: [{
507
+ type: Pipe,
508
+ args: [{
509
+ name: 'monkeyecxFormatZipCode'
510
+ }]
511
+ }] });
512
+
513
+ class MonkeyEcxTextTruncatePipe {
514
+ transform(text, maxLength = 25) {
515
+ const midChar = '...';
516
+ if (!text)
517
+ return midChar;
518
+ if (text && text.length <= maxLength)
519
+ return text;
520
+ const left = Math.ceil(maxLength / 2);
521
+ const right = text.length - left + 1;
522
+ return `${text.substr(0, left)} ${midChar} ${text.substring(right)}`;
523
+ }
524
+ }
525
+ MonkeyEcxTextTruncatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxTextTruncatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
526
+ MonkeyEcxTextTruncatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxTextTruncatePipe, name: "monkeyecxTextTruncate" });
527
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxTextTruncatePipe, decorators: [{
528
+ type: Pipe,
529
+ args: [{
530
+ name: 'monkeyecxTextTruncate'
531
+ }]
532
+ }] });
533
+
534
+ class MonkeyEcxTruncateQtdPipe {
535
+ transform(number, threshold) {
536
+ return `${number > threshold ? `${threshold}+` : number}`;
537
+ }
538
+ }
539
+ MonkeyEcxTruncateQtdPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxTruncateQtdPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
540
+ MonkeyEcxTruncateQtdPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxTruncateQtdPipe, name: "monkeyecxTruncateQtd" });
541
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxTruncateQtdPipe, decorators: [{
542
+ type: Pipe,
543
+ args: [{
544
+ name: 'monkeyecxTruncateQtd'
545
+ }]
546
+ }] });
547
+
548
+ const moment$2 = moment_;
549
+ class MonkeyEcxFormatDateGroupPipe {
550
+ constructor(injector) {
551
+ this.injector = injector;
552
+ this.lang = 'pt-BR';
553
+ const translateService = this.injector.get(TranslateService);
554
+ this.lang = translateService.getDefaultLang();
555
+ }
556
+ format(date) {
557
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(date))
558
+ return '';
559
+ let stillUtc = moment$2.default.utc(date).toDate();
560
+ if (date.toString()?.indexOf(':') <= -1) {
561
+ stillUtc = date;
562
+ }
563
+ const formatFrom = 'YYYY/MM/DD';
564
+ const fmt = moment$2.default(stillUtc, formatFrom).locale(this.lang);
565
+ const dayFormated = fmt.format('DD/');
566
+ const monthFormated = MonkeyEcxUtils.capitalize(fmt.format('MMMM'));
567
+ const yearFormated = fmt.format('YYYY');
568
+ return `${`${dayFormated}${monthFormated}`.substring(0, 6)}, ${yearFormated}`;
569
+ }
570
+ transform(obj) {
571
+ if (!obj || !obj?.start || !obj?.end)
572
+ return '';
573
+ const { start, end } = obj;
574
+ const formatedStart = this.format(start);
575
+ const formatedEnd = this.format(end);
576
+ return `${formatedStart} - ${formatedEnd}`;
577
+ }
578
+ }
579
+ MonkeyEcxFormatDateGroupPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatDateGroupPipe, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Pipe });
580
+ MonkeyEcxFormatDateGroupPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatDateGroupPipe, name: "monkeyecxFormatDateGroup" });
581
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatDateGroupPipe, decorators: [{
582
+ type: Pipe,
583
+ args: [{
584
+ name: 'monkeyecxFormatDateGroup',
585
+ }]
586
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
587
+
588
+ class MonkeyEcxPipesModule {
589
+ }
590
+ MonkeyEcxPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
591
+ MonkeyEcxPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxPipesModule, declarations: [MonkeyEcxDisplayFirstNamePipe,
592
+ MonkeyEcxFormatAddressPipe,
593
+ MonkeyEcxFormatCurrencyPipe,
594
+ MonkeyEcxFormatDateTimelapsePipe,
595
+ MonkeyEcxFormatDateGroupPipe,
596
+ MonkeyEcxFormatDocumentPipe,
597
+ MonkeyEcxFormatNumberPipe,
598
+ MonkeyEcxFormatPhonePipe,
599
+ MonkeyEcxFormatSizePipe,
600
+ MonkeyEcxFormatDocumentTypePipe,
601
+ MonkeyEcxFormatValue,
602
+ MonkeyEcxFormatZipCodePipe,
603
+ MonkeyEcxTextTruncatePipe,
604
+ MonkeyEcxTruncateQtdPipe], exports: [MonkeyEcxDisplayFirstNamePipe,
605
+ MonkeyEcxFormatAddressPipe,
606
+ MonkeyEcxFormatCurrencyPipe,
607
+ MonkeyEcxFormatDateTimelapsePipe,
608
+ MonkeyEcxFormatDateGroupPipe,
609
+ MonkeyEcxFormatDocumentPipe,
610
+ MonkeyEcxFormatNumberPipe,
611
+ MonkeyEcxFormatPhonePipe,
612
+ MonkeyEcxFormatSizePipe,
613
+ MonkeyEcxFormatDocumentTypePipe,
614
+ MonkeyEcxFormatValue,
615
+ MonkeyEcxFormatZipCodePipe,
616
+ MonkeyEcxTextTruncatePipe,
617
+ MonkeyEcxTruncateQtdPipe] });
618
+ MonkeyEcxPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxPipesModule, providers: [CurrencyPipe] });
619
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxPipesModule, decorators: [{
620
+ type: NgModule,
621
+ args: [{
622
+ declarations: [
623
+ MonkeyEcxDisplayFirstNamePipe,
624
+ MonkeyEcxFormatAddressPipe,
625
+ MonkeyEcxFormatCurrencyPipe,
626
+ MonkeyEcxFormatDateTimelapsePipe,
627
+ MonkeyEcxFormatDateGroupPipe,
628
+ MonkeyEcxFormatDocumentPipe,
629
+ MonkeyEcxFormatNumberPipe,
630
+ MonkeyEcxFormatPhonePipe,
631
+ MonkeyEcxFormatSizePipe,
632
+ MonkeyEcxFormatDocumentTypePipe,
633
+ MonkeyEcxFormatValue,
634
+ MonkeyEcxFormatZipCodePipe,
635
+ MonkeyEcxTextTruncatePipe,
636
+ MonkeyEcxTruncateQtdPipe,
637
+ ],
638
+ exports: [
639
+ MonkeyEcxDisplayFirstNamePipe,
640
+ MonkeyEcxFormatAddressPipe,
641
+ MonkeyEcxFormatCurrencyPipe,
642
+ MonkeyEcxFormatDateTimelapsePipe,
643
+ MonkeyEcxFormatDateGroupPipe,
644
+ MonkeyEcxFormatDocumentPipe,
645
+ MonkeyEcxFormatNumberPipe,
646
+ MonkeyEcxFormatPhonePipe,
647
+ MonkeyEcxFormatSizePipe,
648
+ MonkeyEcxFormatDocumentTypePipe,
649
+ MonkeyEcxFormatValue,
650
+ MonkeyEcxFormatZipCodePipe,
651
+ MonkeyEcxTextTruncatePipe,
652
+ MonkeyEcxTruncateQtdPipe,
653
+ ],
654
+ providers: [CurrencyPipe],
655
+ }]
656
+ }] });
657
+
658
+ class ClosedToMaintenanceModule {
659
+ }
660
+ ClosedToMaintenanceModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ClosedToMaintenanceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
661
+ ClosedToMaintenanceModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ClosedToMaintenanceModule, declarations: [ClosedToMaintenanceComponent], imports: [CommonModule,
662
+ MonkeyButtonModule,
663
+ MonkeyIconModule,
664
+ MonkeyInputModule,
665
+ MonkeyModalModule,
666
+ MonkeyEcxPipesModule, i1$1.TranslateModule], exports: [ClosedToMaintenanceComponent] });
667
+ ClosedToMaintenanceModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ClosedToMaintenanceModule, imports: [[
668
+ CommonModule,
669
+ MonkeyButtonModule,
670
+ MonkeyIconModule,
671
+ MonkeyInputModule,
672
+ MonkeyModalModule,
673
+ MonkeyEcxPipesModule,
674
+ TranslateModule.forChild()
675
+ ]] });
676
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ClosedToMaintenanceModule, decorators: [{
677
+ type: NgModule,
678
+ args: [{
679
+ declarations: [ClosedToMaintenanceComponent],
680
+ imports: [
681
+ CommonModule,
682
+ MonkeyButtonModule,
683
+ MonkeyIconModule,
684
+ MonkeyInputModule,
685
+ MonkeyModalModule,
686
+ MonkeyEcxPipesModule,
687
+ TranslateModule.forChild()
688
+ ],
689
+ exports: [ClosedToMaintenanceComponent]
690
+ }]
691
+ }] });
692
+
693
+ class MonkeyEcxProgressBarService {
694
+ constructor(router) {
695
+ this.router = router;
696
+ this.visible = null;
697
+ this.init();
698
+ }
699
+ init() {
700
+ this.visible = new BehaviorSubject(false);
701
+ this.router.events
702
+ .pipe(filter((event) => {
703
+ return event instanceof NavigationStart;
704
+ }))
705
+ .subscribe(() => {
706
+ this.show();
707
+ });
708
+ this.router.events
709
+ .pipe(filter((event) => {
710
+ return (event instanceof NavigationEnd ||
711
+ event instanceof NavigationError ||
712
+ event instanceof NavigationCancel);
713
+ }))
714
+ .subscribe(() => {
715
+ this.hide();
716
+ });
717
+ }
718
+ show() {
719
+ this.visible?.next(true);
720
+ }
721
+ hide() {
722
+ this.visible?.next(false);
723
+ }
724
+ visibleConfig() {
725
+ return this.visible?.asObservable() || null;
726
+ }
727
+ }
728
+ MonkeyEcxProgressBarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxProgressBarService, deps: [{ token: i1$3.Router }], target: i0.ɵɵFactoryTarget.Injectable });
729
+ MonkeyEcxProgressBarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxProgressBarService, providedIn: 'root' });
730
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxProgressBarService, decorators: [{
731
+ type: Injectable,
732
+ args: [{
733
+ providedIn: 'root'
734
+ }]
735
+ }], ctorParameters: function () { return [{ type: i1$3.Router }]; } });
736
+
737
+ class MonkeyEcxProgressBarComponent {
738
+ constructor(progressBarService) {
739
+ this.progressBarService = progressBarService;
740
+ this.visible = false;
741
+ //not to do
742
+ }
743
+ ngOnInit() {
744
+ this.progressBarService?.visibleConfig()?.subscribe((visible) => {
745
+ this.visible = visible;
746
+ });
747
+ }
748
+ }
749
+ MonkeyEcxProgressBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxProgressBarComponent, deps: [{ token: MonkeyEcxProgressBarService }], target: i0.ɵɵFactoryTarget.Component });
750
+ MonkeyEcxProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MonkeyEcxProgressBarComponent, selector: "monkeyecx-progress-bar", ngImport: i0, template: "<ng-container *ngIf=\"visible\">\n <progress class=\"monkey-progress monkey-progress__theme\"></progress>\n</ng-container>\n", styles: ["monkeyecx-progress-bar{position:absolute;width:100%;margin-top:-9.5px;z-index:99998}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None });
751
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxProgressBarComponent, decorators: [{
752
+ type: Component,
753
+ args: [{ selector: 'monkeyecx-progress-bar', encapsulation: ViewEncapsulation.None, template: "<ng-container *ngIf=\"visible\">\n <progress class=\"monkey-progress monkey-progress__theme\"></progress>\n</ng-container>\n", styles: ["monkeyecx-progress-bar{position:absolute;width:100%;margin-top:-9.5px;z-index:99998}\n"] }]
754
+ }], ctorParameters: function () { return [{ type: MonkeyEcxProgressBarService }]; } });
755
+
756
+ class MonkeyEcxProgressBarModule {
757
+ }
758
+ MonkeyEcxProgressBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
759
+ MonkeyEcxProgressBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxProgressBarModule, declarations: [MonkeyEcxProgressBarComponent], imports: [CommonModule], exports: [MonkeyEcxProgressBarComponent] });
760
+ MonkeyEcxProgressBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxProgressBarModule, imports: [[CommonModule]] });
761
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxProgressBarModule, decorators: [{
762
+ type: NgModule,
763
+ args: [{
764
+ declarations: [MonkeyEcxProgressBarComponent],
765
+ imports: [CommonModule],
766
+ exports: [MonkeyEcxProgressBarComponent]
767
+ }]
768
+ }] });
769
+
770
+ class VersionChangedComponent {
771
+ constructor() {
772
+ this.config = null;
773
+ }
774
+ onClose() {
775
+ document.location.reload();
776
+ }
777
+ }
778
+ VersionChangedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: VersionChangedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
779
+ VersionChangedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: VersionChangedComponent, selector: "monkeyecx-version-changed", inputs: { config: "config", modalRef: "modalRef" }, ngImport: i0, template: "<monkey-modal [config]=\"config\" [modalRef]=\"modalRef\" *ngIf=\"config\">\n <div class=\"d-flex flex-column justify-content-center align-items-center\">\n <span class=\"h2\">\n {{ 'SCREENS.VERSION-CHANGED.TITLE' | translate }}\n </span>\n <span class=\"information-title mt-4\">\n {{ 'SCREENS.VERSION-CHANGED.INFORMATION-1' | translate }}\n </span>\n <span class=\"information mt-3\">\n {{ 'SCREENS.VERSION-CHANGED.INFORMATION-2' | translate }}\n </span>\n </div>\n <div class=\"d-flex flex-column justify-content-center align-items-center mt-5\">\n <monkey-button type=\"primary\" color=\"theme\" (click)=\"onClose()\">\n {{ 'SCREENS.VERSION-CHANGED.BUTTONS.UPDATE-VERSION' | translate }}\n </monkey-button>\n </div>\n</monkey-modal>", styles: ["monkeyecx-version-changed .body{padding:24px;width:100%}monkeyecx-version-changed .information-title{font-style:normal;font-weight:600;font-size:25px;line-height:32px;display:flex;align-items:center;text-align:center;color:#4b4a53;max-width:600px}monkeyecx-version-changed .information{font-style:normal;font-weight:400;font-size:20px;line-height:24px;display:flex;align-items:center;text-align:center;color:#4b4a53;max-width:600px}monkeyecx-version-changed .browser-name{font-style:normal;font-weight:400;font-size:16px;line-height:24px;text-align:center;color:#9c9ca6}monkeyecx-version-changed .option{text-decoration:none;padding:4px;background:#eee;border:1px solid #d6d6d6;box-sizing:border-box;border-radius:16px}monkeyecx-version-changed monkey-modal mecx-monkey-modal .body{margin-bottom:0!important}\n"], components: [{ type: i1.MonkeyModalComponent, selector: "monkey-modal", inputs: ["config", "modalRef", "onHandleConfirm"] }, { type: i1.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i1$1.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
780
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: VersionChangedComponent, decorators: [{
781
+ type: Component,
782
+ args: [{ selector: 'monkeyecx-version-changed', encapsulation: ViewEncapsulation.None, template: "<monkey-modal [config]=\"config\" [modalRef]=\"modalRef\" *ngIf=\"config\">\n <div class=\"d-flex flex-column justify-content-center align-items-center\">\n <span class=\"h2\">\n {{ 'SCREENS.VERSION-CHANGED.TITLE' | translate }}\n </span>\n <span class=\"information-title mt-4\">\n {{ 'SCREENS.VERSION-CHANGED.INFORMATION-1' | translate }}\n </span>\n <span class=\"information mt-3\">\n {{ 'SCREENS.VERSION-CHANGED.INFORMATION-2' | translate }}\n </span>\n </div>\n <div class=\"d-flex flex-column justify-content-center align-items-center mt-5\">\n <monkey-button type=\"primary\" color=\"theme\" (click)=\"onClose()\">\n {{ 'SCREENS.VERSION-CHANGED.BUTTONS.UPDATE-VERSION' | translate }}\n </monkey-button>\n </div>\n</monkey-modal>", styles: ["monkeyecx-version-changed .body{padding:24px;width:100%}monkeyecx-version-changed .information-title{font-style:normal;font-weight:600;font-size:25px;line-height:32px;display:flex;align-items:center;text-align:center;color:#4b4a53;max-width:600px}monkeyecx-version-changed .information{font-style:normal;font-weight:400;font-size:20px;line-height:24px;display:flex;align-items:center;text-align:center;color:#4b4a53;max-width:600px}monkeyecx-version-changed .browser-name{font-style:normal;font-weight:400;font-size:16px;line-height:24px;text-align:center;color:#9c9ca6}monkeyecx-version-changed .option{text-decoration:none;padding:4px;background:#eee;border:1px solid #d6d6d6;box-sizing:border-box;border-radius:16px}monkeyecx-version-changed monkey-modal mecx-monkey-modal .body{margin-bottom:0!important}\n"] }]
783
+ }], propDecorators: { config: [{
784
+ type: Input
785
+ }], modalRef: [{
786
+ type: Input
787
+ }] } });
788
+
789
+ class VersionChangedModule {
790
+ }
791
+ VersionChangedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: VersionChangedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
792
+ VersionChangedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: VersionChangedModule, declarations: [VersionChangedComponent], imports: [CommonModule,
793
+ MonkeyButtonModule,
794
+ MonkeyIconModule,
795
+ MonkeyInputModule,
796
+ MonkeyModalModule, i1$1.TranslateModule], exports: [VersionChangedComponent] });
797
+ VersionChangedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: VersionChangedModule, imports: [[
798
+ CommonModule,
799
+ MonkeyButtonModule,
800
+ MonkeyIconModule,
801
+ MonkeyInputModule,
802
+ MonkeyModalModule,
803
+ TranslateModule.forChild()
804
+ ]] });
805
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: VersionChangedModule, decorators: [{
806
+ type: NgModule,
807
+ args: [{
808
+ declarations: [VersionChangedComponent],
809
+ imports: [
810
+ CommonModule,
811
+ MonkeyButtonModule,
812
+ MonkeyIconModule,
813
+ MonkeyInputModule,
814
+ MonkeyModalModule,
815
+ TranslateModule.forChild()
816
+ ],
817
+ exports: [VersionChangedComponent]
818
+ }]
819
+ }] });
820
+
821
+ /* eslint-disable space-before-function-paren */
822
+ /* eslint-disable func-names */
823
+ function MonkeyEcxCoreCharts(render = true) {
824
+ return (target, propertyName, propertyDescriptor) => {
825
+ const method = propertyDescriptor.value;
826
+ propertyDescriptor.value = function (...args) {
827
+ const context = this;
828
+ if (render) {
829
+ const scriptsLoaded = Array.from(document.scripts);
830
+ scriptsLoaded.forEach((script) => {
831
+ const { src } = script;
832
+ if (src.search('www.gstatic.com/charts') > 0) {
833
+ document.getElementsByTagName('head')[0].removeChild(script);
834
+ }
835
+ });
836
+ const node = document.createElement('script');
837
+ node.src = 'https://www.gstatic.com/charts/loader.js';
838
+ node.type = 'text/javascript';
839
+ node.async = true;
840
+ node.id = 'monkeyecx-charts-settings';
841
+ node.onload = () => {
842
+ method.apply(context, args);
843
+ };
844
+ document.getElementsByTagName('head')[0].appendChild(node);
845
+ }
846
+ else {
847
+ const scriptsLoaded = Array.from(document.scripts);
848
+ scriptsLoaded.forEach((script) => {
849
+ const { src } = script;
850
+ if (src.search('www.gstatic.com/charts') > 0) {
851
+ document.getElementsByTagName('head')[0].removeChild(script);
852
+ }
853
+ });
854
+ method.apply(context, args);
855
+ }
856
+ };
857
+ return propertyDescriptor;
858
+ };
859
+ }
860
+
861
+ /* eslint-disable max-classes-per-file */
862
+ const moment$1 = moment_;
863
+ class DateValidator {
864
+ static do(control) {
865
+ if (!control.parent || !control)
866
+ return null;
867
+ if (control && control.value) {
868
+ const dateFormat = 'MM-DD-YYYY';
869
+ if (!moment$1
870
+ .default(moment$1.default(control.value).format(dateFormat), ['DD/MM/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD'], true)
871
+ .isValid()) {
872
+ return {
873
+ invalidDate: true,
874
+ };
875
+ }
876
+ }
877
+ return null;
878
+ }
879
+ }
880
+ class DocumentValidator {
881
+ static do(control) {
882
+ if (!control.parent || !control)
883
+ return null;
884
+ if (control && control.value) {
885
+ if (!MonkeyEcxUtils.isCPFCNPJValid(control.value)) {
886
+ return {
887
+ invalidCpfCnpj: true,
888
+ };
889
+ }
890
+ }
891
+ return null;
892
+ }
893
+ }
894
+ class DocumentRutValidator {
895
+ static do(control) {
896
+ if (!control.parent || !control)
897
+ return null;
898
+ if (control && control.value) {
899
+ if (!MonkeyEcxUtils.isValidRUT(control.value)) {
900
+ return {
901
+ invalidRut: true,
902
+ };
903
+ }
904
+ }
905
+ return null;
906
+ }
907
+ }
908
+ class ZipCodeValidator {
909
+ static do(control) {
910
+ if (!control.parent || !control)
911
+ return null;
912
+ if (control && control.value) {
913
+ if (!MonkeyEcxUtils.isValidZipCode(control.value)) {
914
+ return {
915
+ invalidZipCode: true,
916
+ };
917
+ }
918
+ }
919
+ return null;
920
+ }
921
+ }
922
+ class ComboValidator {
923
+ static do(control) {
924
+ if (!control.parent || !control)
925
+ return null;
926
+ if (control && control.value !== '0')
927
+ return null;
928
+ return {
929
+ invalidCombo: true,
930
+ };
931
+ }
932
+ }
933
+ class isTrueValidator {
934
+ static do(control) {
935
+ if (!control.parent || !control)
936
+ return null;
937
+ if (control && control.value !== false)
938
+ return null;
939
+ return {
940
+ invalidTrue: true,
941
+ };
942
+ }
943
+ }
944
+ class PasswordMatchValidation {
945
+ static do(control) {
946
+ if (!control.parent || !control)
947
+ return null;
948
+ const { parent } = control;
949
+ const password = parent?.get('password')?.value;
950
+ const passwordConfirm = parent?.get('passwordConfirm')?.value;
951
+ if (!password || !passwordConfirm)
952
+ return null;
953
+ if (password === passwordConfirm)
954
+ return null;
955
+ return {
956
+ passwordsNotMatching: true,
957
+ };
958
+ }
959
+ }
960
+ class UrlValidator {
961
+ static do(control) {
962
+ if (!control.parent || !control)
963
+ return null;
964
+ if (control && control.value) {
965
+ if (!MonkeyEcxUtils.isValidUrl(control.value)) {
966
+ return {
967
+ invalidUrl: true,
968
+ };
969
+ }
970
+ }
971
+ return null;
972
+ }
973
+ }
974
+ class CustomDatesStartValidator {
975
+ static do(control) {
976
+ if (!control.parent || !control)
977
+ return null;
978
+ const { parent } = control;
979
+ const valueStart = parent?.get('dateStart')?.value;
980
+ const valueEnd = parent?.get('dateEnd')?.value;
981
+ let dateStart = null;
982
+ let dateEnd = null;
983
+ if (valueStart) {
984
+ dateStart = new Date(valueStart);
985
+ }
986
+ if (valueEnd) {
987
+ dateEnd = new Date(valueEnd);
988
+ }
989
+ if (!dateStart || !dateEnd)
990
+ return null;
991
+ if (dateStart > dateEnd) {
992
+ return {
993
+ dateStartMustBeLessThanAnd: true,
994
+ };
995
+ }
996
+ return null;
997
+ }
998
+ }
999
+ class CustomDatesEndValidator {
1000
+ static do(control) {
1001
+ if (!control.parent || !control)
1002
+ return null;
1003
+ const { parent } = control;
1004
+ const valueStart = parent?.get('dateStart')?.value;
1005
+ const valueEnd = parent?.get('dateEnd')?.value;
1006
+ let dateStart = null;
1007
+ let dateEnd = null;
1008
+ if (valueStart) {
1009
+ dateStart = new Date(valueStart);
1010
+ }
1011
+ if (valueEnd) {
1012
+ dateEnd = new Date(valueEnd);
1013
+ }
1014
+ if (!dateEnd || !dateStart)
1015
+ return null;
1016
+ if (dateEnd < dateStart) {
1017
+ return {
1018
+ dateEndMustBeGreaterThanStart: true,
1019
+ };
1020
+ }
1021
+ return null;
1022
+ }
1023
+ }
1024
+ class UnlockRegisterBuyerValidator {
1025
+ static do(control) {
1026
+ if (!control.parent || !control)
1027
+ return null;
1028
+ if (control && control.value !== '#MONKEYBUYER') {
1029
+ return {
1030
+ invalidUnlockRegister: true,
1031
+ };
1032
+ }
1033
+ return null;
1034
+ }
1035
+ }
1036
+ class UnlockRegisterSponsorValidator {
1037
+ static do(control) {
1038
+ if (!control.parent || !control)
1039
+ return null;
1040
+ if (control && control.value !== '#MONKEYSPONSOR') {
1041
+ return {
1042
+ invalidUnlockRegister: true,
1043
+ };
1044
+ }
1045
+ return null;
1046
+ }
1047
+ }
1048
+ class DateRangeValidator {
1049
+ static do(control) {
1050
+ if (!control.parent || !control) {
1051
+ return null;
1052
+ }
1053
+ const dates = control?.parent?.get('dates')?.value;
1054
+ if (dates &&
1055
+ (!MonkeyEcxUtils.persistNullEmptyUndefined(dates.startDate) ||
1056
+ !MonkeyEcxUtils.persistNullEmptyUndefined(dates.endDate))) {
1057
+ return {
1058
+ invalidDateRange: true,
1059
+ };
1060
+ }
1061
+ return null;
1062
+ }
1063
+ }
1064
+
1065
+ var validateUtils = /*#__PURE__*/Object.freeze({
1066
+ __proto__: null,
1067
+ DateValidator: DateValidator,
1068
+ DocumentValidator: DocumentValidator,
1069
+ DocumentRutValidator: DocumentRutValidator,
1070
+ ZipCodeValidator: ZipCodeValidator,
1071
+ ComboValidator: ComboValidator,
1072
+ isTrueValidator: isTrueValidator,
1073
+ PasswordMatchValidation: PasswordMatchValidation,
1074
+ UrlValidator: UrlValidator,
1075
+ CustomDatesStartValidator: CustomDatesStartValidator,
1076
+ CustomDatesEndValidator: CustomDatesEndValidator,
1077
+ UnlockRegisterBuyerValidator: UnlockRegisterBuyerValidator,
1078
+ UnlockRegisterSponsorValidator: UnlockRegisterSponsorValidator,
1079
+ DateRangeValidator: DateRangeValidator
1080
+ });
1081
+
1082
+ /* eslint-disable no-unused-vars */
1083
+ /* eslint-disable no-shadow */
1084
+ var MonkeyEcxQueueEvents;
1085
+ (function (MonkeyEcxQueueEvents) {
1086
+ MonkeyEcxQueueEvents[MonkeyEcxQueueEvents["OnGoing"] = 0] = "OnGoing";
1087
+ MonkeyEcxQueueEvents[MonkeyEcxQueueEvents["Finished"] = 1] = "Finished";
1088
+ MonkeyEcxQueueEvents[MonkeyEcxQueueEvents["FinishedWithError"] = 2] = "FinishedWithError";
1089
+ })(MonkeyEcxQueueEvents || (MonkeyEcxQueueEvents = {}));
1090
+ var MonkeyEcxDownloadEvents;
1091
+ (function (MonkeyEcxDownloadEvents) {
1092
+ MonkeyEcxDownloadEvents[MonkeyEcxDownloadEvents["OnGoing"] = 0] = "OnGoing";
1093
+ MonkeyEcxDownloadEvents[MonkeyEcxDownloadEvents["Finished"] = 1] = "Finished";
1094
+ MonkeyEcxDownloadEvents[MonkeyEcxDownloadEvents["FinishedWithError"] = 2] = "FinishedWithError";
1095
+ })(MonkeyEcxDownloadEvents || (MonkeyEcxDownloadEvents = {}));
1096
+ var MonkeyEcxUploadEvents;
1097
+ (function (MonkeyEcxUploadEvents) {
1098
+ MonkeyEcxUploadEvents[MonkeyEcxUploadEvents["OnGoing"] = 0] = "OnGoing";
1099
+ MonkeyEcxUploadEvents[MonkeyEcxUploadEvents["Finished"] = 1] = "Finished";
1100
+ MonkeyEcxUploadEvents[MonkeyEcxUploadEvents["FinishedWithError"] = 2] = "FinishedWithError";
1101
+ })(MonkeyEcxUploadEvents || (MonkeyEcxUploadEvents = {}));
1102
+ // TODO pegar do json de config
1103
+ var ApiEndPointsTokenNotMandatory;
1104
+ (function (ApiEndPointsTokenNotMandatory) {
1105
+ ApiEndPointsTokenNotMandatory["Assets"] = "assets/";
1106
+ ApiEndPointsTokenNotMandatory["MonkeyEcx"] = "/monkeyecx";
1107
+ ApiEndPointsTokenNotMandatory["ViaCep"] = "viacep.com.br/";
1108
+ })(ApiEndPointsTokenNotMandatory || (ApiEndPointsTokenNotMandatory = {}));
1109
+ // TODO pegar do json de config
1110
+ var ApiEndPointsHeaderNotMandatory;
1111
+ (function (ApiEndPointsHeaderNotMandatory) {
1112
+ ApiEndPointsHeaderNotMandatory["Assets"] = "/assets";
1113
+ ApiEndPointsHeaderNotMandatory["PayablesUpload"] = "payables-upload";
1114
+ ApiEndPointsHeaderNotMandatory["PictureUser"] = "/user-pictures";
1115
+ ApiEndPointsHeaderNotMandatory["Documents"] = "documents/";
1116
+ ApiEndPointsHeaderNotMandatory["BuyerTaxFile"] = "/buyer-tax-file";
1117
+ ApiEndPointsHeaderNotMandatory["ViaCep"] = "viacep.com.br/";
1118
+ })(ApiEndPointsHeaderNotMandatory || (ApiEndPointsHeaderNotMandatory = {}));
1119
+
1120
+ var statics = /*#__PURE__*/Object.freeze({
1121
+ __proto__: null,
1122
+ get MonkeyEcxQueueEvents () { return MonkeyEcxQueueEvents; },
1123
+ get MonkeyEcxDownloadEvents () { return MonkeyEcxDownloadEvents; },
1124
+ get MonkeyEcxUploadEvents () { return MonkeyEcxUploadEvents; },
1125
+ get ApiEndPointsTokenNotMandatory () { return ApiEndPointsTokenNotMandatory; },
1126
+ get ApiEndPointsHeaderNotMandatory () { return ApiEndPointsHeaderNotMandatory; }
1127
+ });
1128
+
1129
+ function buildQueuePropertys(queue) {
1130
+ const params = {
1131
+ item: {
1132
+ ...queue,
1133
+ id: MonkeyEcxUtils.getRandomString(40)
1134
+ },
1135
+ status: MonkeyEcxQueueEvents.OnGoing
1136
+ };
1137
+ return params;
1138
+ }
1139
+ function buildDownloadPropertys(name, description, size) {
1140
+ const params = {
1141
+ item: {
1142
+ name,
1143
+ description,
1144
+ id: `${MonkeyEcxUtils.getRandomString(40)}`,
1145
+ size,
1146
+ createdAt: new Date()
1147
+ },
1148
+ status: MonkeyEcxQueueEvents.OnGoing
1149
+ };
1150
+ return params;
1151
+ }
1152
+ function buildUploadPropertys(name, description) {
1153
+ const params = {
1154
+ item: {
1155
+ name,
1156
+ description,
1157
+ id: `${MonkeyEcxUtils.getRandomString(40)}`
1158
+ },
1159
+ status: MonkeyEcxUploadEvents.OnGoing
1160
+ };
1161
+ return params;
1162
+ }
1163
+ function hasMonkeyEcxServiceAndHandlingProperties(context) {
1164
+ return Object.prototype.hasOwnProperty.call(context, 'monkeyecxService');
1165
+ }
1166
+
1167
+ var decoratorsUtils = /*#__PURE__*/Object.freeze({
1168
+ __proto__: null,
1169
+ buildQueuePropertys: buildQueuePropertys,
1170
+ buildDownloadPropertys: buildDownloadPropertys,
1171
+ buildUploadPropertys: buildUploadPropertys,
1172
+ hasMonkeyEcxServiceAndHandlingProperties: hasMonkeyEcxServiceAndHandlingProperties
1173
+ });
1174
+
1175
+ const moment = moment_;
1176
+ const EMAIL_REGEXP = /^[\w-.]+@([\w-]+\.)+[\w-]{1,64}$/;
1177
+ function isEmptyInputValue(value) {
1178
+ return value == null || value.length === 0;
1179
+ }
1180
+ function emailValidator(control) {
1181
+ if (!control.parent || !control || isEmptyInputValue(control.value)) {
1182
+ return null;
1183
+ }
1184
+ const test = EMAIL_REGEXP.test(control.value);
1185
+ if (test)
1186
+ return null;
1187
+ return {
1188
+ email: true,
1189
+ };
1190
+ }
1191
+ function dateRangeValidator(control) {
1192
+ if (!control.parent || !control || isEmptyInputValue(control.value)) {
1193
+ return null;
1194
+ }
1195
+ const dates = control?.parent?.get('dates')?.value;
1196
+ if (dates &&
1197
+ (!MonkeyEcxUtils.persistNullEmptyUndefined(dates?.startDate) ||
1198
+ !MonkeyEcxUtils.persistNullEmptyUndefined(dates?.endDate))) {
1199
+ return {
1200
+ dateRange: true,
1201
+ };
1202
+ }
1203
+ return null;
1204
+ }
1205
+ function registerValidator(control, type) {
1206
+ if (!control.parent || !control || isEmptyInputValue(control.value)) {
1207
+ return null;
1208
+ }
1209
+ if (control && control.value !== `#MONKEY${type}`.toUpperCase()) {
1210
+ return {
1211
+ invalidUnlockRegister: true,
1212
+ };
1213
+ }
1214
+ return null;
1215
+ }
1216
+ function dateStartEndValidator(control) {
1217
+ if (!control.parent || !control) {
1218
+ return null;
1219
+ }
1220
+ const { parent } = control;
1221
+ const valueStart = parent?.get('dateStart')?.value;
1222
+ const valueEnd = parent?.get('dateEnd')?.value;
1223
+ let dateStart = null;
1224
+ let dateEnd = null;
1225
+ if (valueStart) {
1226
+ dateStart = new Date(valueStart);
1227
+ }
1228
+ if (valueEnd) {
1229
+ dateEnd = new Date(valueEnd);
1230
+ }
1231
+ if (!dateEnd || !dateStart)
1232
+ return null;
1233
+ if (dateStart > dateEnd) {
1234
+ return {
1235
+ dateStartMustBeLessThanAnd: true,
1236
+ };
1237
+ }
1238
+ return null;
1239
+ }
1240
+ function urlValidator(control) {
1241
+ if (!control.parent || !control || isEmptyInputValue(control.value))
1242
+ return null;
1243
+ if (!MonkeyEcxUtils.isValidUrl(control.value)) {
1244
+ return {
1245
+ url: true,
1246
+ };
1247
+ }
1248
+ return null;
1249
+ }
1250
+ function passwordConfirmValidator(control) {
1251
+ if (!control.parent || !control || isEmptyInputValue(control.value))
1252
+ return null;
1253
+ const { parent } = control;
1254
+ const password = parent?.get('password')?.value;
1255
+ const passwordConfirm = parent?.get('passwordConfirm')?.value;
1256
+ if (!password || !passwordConfirm)
1257
+ return null;
1258
+ if (password === passwordConfirm)
1259
+ return null;
1260
+ return {
1261
+ passwordsNotMatching: true,
1262
+ };
1263
+ }
1264
+ function trueValidator(control) {
1265
+ if (!control.parent || !control)
1266
+ return null;
1267
+ if (control && control.value !== false)
1268
+ return null;
1269
+ return {
1270
+ invalidTrue: true,
1271
+ };
1272
+ }
1273
+ function comboValidator(control) {
1274
+ if (!control.parent || !control)
1275
+ return null;
1276
+ if (control && control.value !== '0')
1277
+ return null;
1278
+ return {
1279
+ invalidCombo: true,
1280
+ };
1281
+ }
1282
+ function zipCodeValidator(control) {
1283
+ if (!control.parent || !control || isEmptyInputValue(control.value))
1284
+ return null;
1285
+ if (control && control.value) {
1286
+ if (!MonkeyEcxUtils.isValidZipCode(control.value)) {
1287
+ return {
1288
+ invalidZipCode: true,
1289
+ };
1290
+ }
1291
+ }
1292
+ return null;
1293
+ }
1294
+ function documentValidator(control, country) {
1295
+ if (!control.parent || !control || isEmptyInputValue(control.value))
1296
+ return null;
1297
+ if (country === 'BR') {
1298
+ if (!MonkeyEcxUtils.isCPFCNPJValid(control.value)) {
1299
+ return {
1300
+ invalidCpfCnpj: true,
1301
+ };
1302
+ }
1303
+ }
1304
+ else if (country === 'CL') {
1305
+ if (!MonkeyEcxUtils.isValidRUT(control.value)) {
1306
+ return {
1307
+ invalidCpfCnpj: true,
1308
+ };
1309
+ }
1310
+ }
1311
+ return null;
1312
+ }
1313
+ function dateValidator(control) {
1314
+ if (!control.parent || !control || isEmptyInputValue(control.value))
1315
+ return null;
1316
+ const dateFormat = 'MM-DD-YYYY';
1317
+ if (!moment
1318
+ .default(moment.default(control.value).format(dateFormat), ['DD/MM/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD'], true)
1319
+ .isValid()) {
1320
+ return {
1321
+ invalidDate: true,
1322
+ };
1323
+ }
1324
+ return null;
1325
+ }
1326
+ function valueGreaterThanZero(control) {
1327
+ if (!control.parent || !control || isEmptyInputValue(control.value))
1328
+ return null;
1329
+ if (control && `${control?.value}` === '0') {
1330
+ return {
1331
+ invalidValueGreaterThanZero: true,
1332
+ };
1333
+ }
1334
+ return null;
1335
+ }
1336
+ class Validators {
1337
+ static email(control) {
1338
+ return emailValidator(control);
1339
+ }
1340
+ static dateRange(control) {
1341
+ return dateRangeValidator(control);
1342
+ }
1343
+ static unlockSponsorRegister(control) {
1344
+ return registerValidator(control, 'sponsor');
1345
+ }
1346
+ static unlockBuyerRegister(control) {
1347
+ return registerValidator(control, 'buyer');
1348
+ }
1349
+ static dateStartEnd(control) {
1350
+ return dateStartEndValidator(control);
1351
+ }
1352
+ static url(control) {
1353
+ return urlValidator(control);
1354
+ }
1355
+ static passwordConfirm(control) {
1356
+ return passwordConfirmValidator(control);
1357
+ }
1358
+ static true(control) {
1359
+ return trueValidator(control);
1360
+ }
1361
+ static combo(control) {
1362
+ return comboValidator(control);
1363
+ }
1364
+ static zipCode(control) {
1365
+ return zipCodeValidator(control);
1366
+ }
1367
+ static documentBR(control) {
1368
+ return documentValidator(control, 'BR');
1369
+ }
1370
+ static documentCL(control) {
1371
+ return documentValidator(control, 'CL');
1372
+ }
1373
+ static date(control) {
1374
+ return dateValidator(control);
1375
+ }
1376
+ static greaterThanZero(control) {
1377
+ return valueGreaterThanZero(control);
1378
+ }
1379
+ }
1380
+
1381
+ /* eslint-disable object-curly-newline */
1382
+
1383
+ function MonkeyEcxCoreServiceConstructor() {
1384
+ return (target) => {
1385
+ Object.entries(target.prototype).forEach(([key, value]) => {
1386
+ const method = target.prototype[key];
1387
+ if (key !== 'constructor') {
1388
+ target.prototype[key] = function (...args) {
1389
+ const context = this;
1390
+ if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
1391
+ context.monkeyecxService.monkeyecxHandlingService.clearAll();
1392
+ }
1393
+ const result = method.apply(context, args);
1394
+ return result;
1395
+ };
1396
+ }
1397
+ });
1398
+ return target;
1399
+ };
1400
+ }
1401
+ function MonkeyEcxCoreLog(tp) {
1402
+ return function (target, propertyName, propertyDescriptor) {
1403
+ const method = propertyDescriptor.value;
1404
+ propertyDescriptor.value = function (...args) {
1405
+ const params = args
1406
+ .map((a) => {
1407
+ return JSON.stringify(a);
1408
+ })
1409
+ .join();
1410
+ const result = method.apply(this, args);
1411
+ const r = JSON.stringify(result);
1412
+ console.log(`Call: ${propertyName}(${params}) => ${r}`);
1413
+ return result;
1414
+ };
1415
+ return propertyDescriptor;
1416
+ };
1417
+ }
1418
+ function MonkeyEcxCoreClearDecorators() {
1419
+ return function (target, propertyName, propertyDescriptor) {
1420
+ const method = propertyDescriptor.value;
1421
+ propertyDescriptor.value = function (...args) {
1422
+ const context = this;
1423
+ if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
1424
+ context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
1425
+ }
1426
+ const result = method.apply(context, args);
1427
+ return result;
1428
+ };
1429
+ return propertyDescriptor;
1430
+ };
1431
+ }
1432
+ function MonkeyEcxCoreService(params) {
1433
+ return function (target, propertyName, propertyDescriptor) {
1434
+ const method = propertyDescriptor.value;
1435
+ propertyDescriptor.value = function (...args) {
1436
+ const context = this;
1437
+ if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
1438
+ context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
1439
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxServiceCredentials(params);
1440
+ }
1441
+ const result = method.apply(context, args);
1442
+ return result;
1443
+ };
1444
+ return propertyDescriptor;
1445
+ };
1446
+ }
1447
+ function MonkeyEcxCoreServicePaged(params) {
1448
+ return function (target, propertyName, propertyDescriptor) {
1449
+ const method = propertyDescriptor.value;
1450
+ propertyDescriptor.value = function (...args) {
1451
+ const context = this;
1452
+ if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
1453
+ const credentials = context?.monkeyecxService?.monkeyecxHandlingService?.getMonkeyEcxServiceCredentials();
1454
+ let requestPaged = null;
1455
+ if (credentials) {
1456
+ requestPaged = credentials.requestPaged;
1457
+ }
1458
+ context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
1459
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxServiceCredentials({
1460
+ ...params,
1461
+ ...(requestPaged || {}),
1462
+ });
1463
+ }
1464
+ const result = method.apply(context, args);
1465
+ return result;
1466
+ };
1467
+ return propertyDescriptor;
1468
+ };
1469
+ }
1470
+ function MonkeyEcxCoreServiceQueue(name, description, params) {
1471
+ return function (target, propertyName, propertyDescriptor) {
1472
+ const method = propertyDescriptor.value;
1473
+ propertyDescriptor.value = function (...args) {
1474
+ const context = this;
1475
+ if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
1476
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(params)) {
1477
+ context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
1478
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxServiceCredentials(params);
1479
+ }
1480
+ context?.monkeyecxService.monkeyecxHandlingService.setMonkeyEcxRequestQueue(buildQueuePropertys({
1481
+ name,
1482
+ description,
1483
+ }));
1484
+ }
1485
+ const result = method.apply(context, args);
1486
+ return result;
1487
+ };
1488
+ return propertyDescriptor;
1489
+ };
1490
+ }
1491
+
1492
+ /* eslint-disable space-before-function-paren */
1493
+ function MonkeyEcxServiceDownload(name, description, params) {
1494
+ return function (target, propertyName, propertyDescriptor) {
1495
+ const method = propertyDescriptor.value;
1496
+ propertyDescriptor.value = function (...args) {
1497
+ const context = this;
1498
+ if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
1499
+ if (MonkeyUtils.persistNullEmptyUndefined(params)) {
1500
+ context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
1501
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxServiceCredentials(params);
1502
+ }
1503
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxRequestDownload({
1504
+ ...buildDownloadPropertys(name, description),
1505
+ });
1506
+ }
1507
+ const result = method.apply(context, args);
1508
+ return result;
1509
+ };
1510
+ return propertyDescriptor;
1511
+ };
1512
+ }
1513
+
1514
+ /* eslint-disable space-before-function-paren */
1515
+ function MonkeyEcxServiceUpload(name, description, params) {
1516
+ return function (target, propertyName, propertyDescriptor) {
1517
+ const method = propertyDescriptor.value;
1518
+ propertyDescriptor.value = function (...args) {
1519
+ const context = this;
1520
+ if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
1521
+ if (MonkeyUtils.persistNullEmptyUndefined(params)) {
1522
+ context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
1523
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxServiceCredentials(params);
1524
+ }
1525
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxRequestUpload({
1526
+ ...buildUploadPropertys(name, description),
1527
+ });
1528
+ }
1529
+ const result = method.apply(context, args);
1530
+ return result;
1531
+ };
1532
+ return propertyDescriptor;
1533
+ };
1534
+ }
1535
+
1536
+ class MonkeyEcxDragDropDirective {
1537
+ constructor() {
1538
+ this.onFileDropped = new EventEmitter();
1539
+ this.background = '#f5fcff';
1540
+ this.opacity = '1';
1541
+ }
1542
+ onDragOver(evt) {
1543
+ evt?.preventDefault();
1544
+ evt?.stopPropagation();
1545
+ this.background = '#9ecbec';
1546
+ this.opacity = '0.8';
1547
+ }
1548
+ onDragLeave(evt) {
1549
+ evt?.preventDefault();
1550
+ evt?.stopPropagation();
1551
+ this.background = '#f5fcff';
1552
+ this.opacity = '1';
1553
+ }
1554
+ ondrop(evt) {
1555
+ evt?.preventDefault();
1556
+ evt?.stopPropagation();
1557
+ this.background = '#f5fcff';
1558
+ this.opacity = '1';
1559
+ const { files } = evt?.dataTransfer;
1560
+ if (files.length > 0) {
1561
+ this.onFileDropped.emit(files);
1562
+ }
1563
+ }
1564
+ }
1565
+ MonkeyEcxDragDropDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxDragDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1566
+ MonkeyEcxDragDropDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: MonkeyEcxDragDropDirective, selector: "[monkeyecxDragDrop]", outputs: { onFileDropped: "onFileDropped" }, host: { listeners: { "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "ondrop($event)" }, properties: { "style.background-color": "this.background", "style.opacity": "this.opacity" } }, ngImport: i0 });
1567
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxDragDropDirective, decorators: [{
1568
+ type: Directive,
1569
+ args: [{
1570
+ selector: '[monkeyecxDragDrop]',
1571
+ }]
1572
+ }], propDecorators: { onFileDropped: [{
1573
+ type: Output
1574
+ }], background: [{
1575
+ type: HostBinding,
1576
+ args: ['style.background-color']
1577
+ }], opacity: [{
1578
+ type: HostBinding,
1579
+ args: ['style.opacity']
1580
+ }], onDragOver: [{
1581
+ type: HostListener,
1582
+ args: ['dragover', ['$event']]
1583
+ }], onDragLeave: [{
1584
+ type: HostListener,
1585
+ args: ['dragleave', ['$event']]
1586
+ }], ondrop: [{
1587
+ type: HostListener,
1588
+ args: ['drop', ['$event']]
1589
+ }] } });
1590
+
1591
+ class MonkeyEcxFormatCurrency {
1592
+ constructor(elementRef, injector) {
1593
+ this.elementRef = elementRef;
1594
+ this.injector = injector;
1595
+ this.currencyCode = 'BRL';
1596
+ this.currentLocale = 'pt-BR';
1597
+ this.el = this.elementRef.nativeElement;
1598
+ this.currency = this.injector.get(CurrencyPipe);
1599
+ const translateService = this.injector.get(TranslateService);
1600
+ translateService.get('MONKEY-CURRENCY-CODE').subscribe((_) => {
1601
+ this.currencyCode = _;
1602
+ this.currentLocale = translateService.getDefaultLang();
1603
+ });
1604
+ }
1605
+ handle(value) {
1606
+ const { currencyCode, currentLocale } = this;
1607
+ const newValue = MonkeyEcxUtils.handleOnlyNumbers(value);
1608
+ return this.currency.transform(newValue / 100, currencyCode, 'symbol', '', currentLocale);
1609
+ }
1610
+ ngOnInit() {
1611
+ this.el.value = this.handle(this.el.value);
1612
+ }
1613
+ onInput(value) {
1614
+ this.el.value = this.handle(value);
1615
+ }
1616
+ }
1617
+ MonkeyEcxFormatCurrency.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatCurrency, deps: [{ token: i0.ElementRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive });
1618
+ MonkeyEcxFormatCurrency.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: MonkeyEcxFormatCurrency, selector: "[monkeyecxFormatCurrency]", host: { listeners: { "input": "onInput($event.target.value)" } }, providers: [CurrencyPipe], ngImport: i0 });
1619
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatCurrency, decorators: [{
1620
+ type: Directive,
1621
+ args: [{
1622
+ selector: '[monkeyecxFormatCurrency]',
1623
+ providers: [CurrencyPipe]
1624
+ }]
1625
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }]; }, propDecorators: { onInput: [{
1626
+ type: HostListener,
1627
+ args: ['input', ['$event.target.value']]
1628
+ }] } });
1629
+
1630
+ class MonkeyEcxFormatUpper {
1631
+ constructor(_el, _renderer) {
1632
+ this._el = _el;
1633
+ this._renderer = _renderer;
1634
+ // not to do
1635
+ }
1636
+ onKeyDown(evt) {
1637
+ const value = this._el.nativeElement.value.toUpperCase();
1638
+ this._renderer.setProperty(this._el.nativeElement, 'value', value);
1639
+ this._onChange?.(value);
1640
+ evt.preventDefault();
1641
+ }
1642
+ onBlur() {
1643
+ this._touched?.();
1644
+ }
1645
+ writeValue(value) {
1646
+ this._renderer.setProperty(this._el.nativeElement, 'value', value);
1647
+ }
1648
+ registerOnChange(fn) {
1649
+ this._onChange = fn;
1650
+ }
1651
+ registerOnTouched(fn) {
1652
+ this._touched = fn;
1653
+ }
1654
+ setDisabledState(isDisabled) {
1655
+ this._renderer.setProperty(this._el.nativeElement, 'disabled', isDisabled);
1656
+ }
1657
+ }
1658
+ MonkeyEcxFormatUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatUpper, deps: [{ token: i0.ElementRef, self: true }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
1659
+ MonkeyEcxFormatUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: MonkeyEcxFormatUpper, selector: "[monkeyecxFormatUpper]", host: { listeners: { "keyup": "onKeyDown($event)", "blur": "onBlur($event)" } }, providers: [
1660
+ {
1661
+ provide: NG_VALUE_ACCESSOR,
1662
+ useExisting: forwardRef(() => {
1663
+ // eslint-disable-next-line no-use-before-define
1664
+ return MonkeyEcxFormatUpper;
1665
+ }),
1666
+ multi: true,
1667
+ },
1668
+ ], ngImport: i0 });
1669
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFormatUpper, decorators: [{
1670
+ type: Directive,
1671
+ args: [{
1672
+ selector: '[monkeyecxFormatUpper]',
1673
+ providers: [
1674
+ {
1675
+ provide: NG_VALUE_ACCESSOR,
1676
+ useExisting: forwardRef(() => {
1677
+ // eslint-disable-next-line no-use-before-define
1678
+ return MonkeyEcxFormatUpper;
1679
+ }),
1680
+ multi: true,
1681
+ },
1682
+ ],
1683
+ }]
1684
+ }], ctorParameters: function () { return [{ type: i0.ElementRef, decorators: [{
1685
+ type: Self
1686
+ }] }, { type: i0.Renderer2 }]; }, propDecorators: { onKeyDown: [{
1687
+ type: HostListener,
1688
+ args: ['keyup', ['$event']]
1689
+ }], onBlur: [{
1690
+ type: HostListener,
1691
+ args: ['blur', ['$event']]
1692
+ }] } });
1693
+
1694
+ class MonkeyEcxOnlyAlphaNumericDirective {
1695
+ constructor(elementRef) {
1696
+ this.elementRef = elementRef;
1697
+ // not to do
1698
+ }
1699
+ onInputChange(event) {
1700
+ const initalValue = this.elementRef.nativeElement.value;
1701
+ this.elementRef.nativeElement.value = MonkeyEcxUtils.handleOnlyAlphaNumeric(initalValue);
1702
+ if (initalValue !== this.elementRef.nativeElement.value) {
1703
+ event.stopPropagation();
1704
+ }
1705
+ }
1706
+ }
1707
+ MonkeyEcxOnlyAlphaNumericDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxOnlyAlphaNumericDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1708
+ MonkeyEcxOnlyAlphaNumericDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: MonkeyEcxOnlyAlphaNumericDirective, selector: "[monkeyecxOnlyAlphaNumeric]", host: { listeners: { "input": "onInputChange($event)" } }, ngImport: i0 });
1709
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxOnlyAlphaNumericDirective, decorators: [{
1710
+ type: Directive,
1711
+ args: [{
1712
+ selector: '[monkeyecxOnlyAlphaNumeric]'
1713
+ }]
1714
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onInputChange: [{
1715
+ type: HostListener,
1716
+ args: ['input', ['$event']]
1717
+ }] } });
1718
+
1719
+ class MonkeyEcxOnlyNumbersDirective {
1720
+ constructor(elementRef) {
1721
+ this.elementRef = elementRef;
1722
+ // not to do
1723
+ }
1724
+ onInputChange(event) {
1725
+ const initalValue = this.elementRef.nativeElement.value;
1726
+ this.elementRef.nativeElement.value = MonkeyEcxUtils.handleOnlyNumbers(initalValue);
1727
+ if (initalValue !== this.elementRef.nativeElement.value) {
1728
+ event.stopPropagation();
1729
+ }
1730
+ }
1731
+ }
1732
+ MonkeyEcxOnlyNumbersDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxOnlyNumbersDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1733
+ MonkeyEcxOnlyNumbersDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: MonkeyEcxOnlyNumbersDirective, selector: "[monkeyecxOnlyNumbers]", host: { listeners: { "input": "onInputChange($event)" } }, ngImport: i0 });
1734
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxOnlyNumbersDirective, decorators: [{
1735
+ type: Directive,
1736
+ args: [{
1737
+ selector: '[monkeyecxOnlyNumbers]'
1738
+ }]
1739
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onInputChange: [{
1740
+ type: HostListener,
1741
+ args: ['input', ['$event']]
1742
+ }] } });
1743
+
1744
+ class MonkeyEcxRequestPagedHandling {
1745
+ constructor(_url, _pagedParams, _links) {
1746
+ this.url = _url;
1747
+ this.pagedParams = _pagedParams || {
1748
+ page: {},
1749
+ };
1750
+ this.links = _links;
1751
+ }
1752
+ handlePagedValuesFromApi(url = '') {
1753
+ if (url.search('\\?') < 0)
1754
+ return url;
1755
+ const params = url.substring(url.search('\\?') + 1, url.length);
1756
+ url = url.substring(0, url.search('\\?'));
1757
+ return `${url}?${new HttpParams({
1758
+ fromString: params,
1759
+ })
1760
+ .delete('size')
1761
+ .delete('page')
1762
+ .toString()}`;
1763
+ }
1764
+ getUrlParams(url) {
1765
+ const { pagedParams } = this;
1766
+ const { number, size } = pagedParams?.page || {};
1767
+ const hasInitialQueryParams = url.search('\\?') > 0;
1768
+ return `${!hasInitialQueryParams ? '?' : '&'}page=${number || 0}&size=${size || 20}`;
1769
+ }
1770
+ getRequestWithPagedParams() {
1771
+ const { url, links } = this;
1772
+ if (links && links.next) {
1773
+ return links.next.href;
1774
+ }
1775
+ const handled = this.handlePagedValuesFromApi(url);
1776
+ return `${handled}${this.getUrlParams(handled)}`;
1777
+ }
1778
+ }
1779
+
1780
+ class MonkeyEcxCommonsService {
1781
+ constructor(monkeyecxService, tokenStorage, otherArgs) {
1782
+ this.monkeyecxService = monkeyecxService;
1783
+ this.tokenStorage = tokenStorage;
1784
+ this.otherArgs = otherArgs;
1785
+ this.flagValidator = true;
1786
+ this.__savedState = null;
1787
+ this.__error = null;
1788
+ this.__handledError = null;
1789
+ this.__page = null;
1790
+ this.__links = null;
1791
+ this.__requestPaged = null;
1792
+ this.__onSearchChanged$ = new BehaviorSubject(null);
1793
+ this.__onDataChanged$ = new BehaviorSubject(null);
1794
+ this.__onLoadingInProgress$ = new BehaviorSubject(false);
1795
+ this.__onDataDeleted$ = new BehaviorSubject(null);
1796
+ this.__onErrorChanged$ = new BehaviorSubject(null);
1797
+ this.__onGovernmentIdDataChanged$ = new BehaviorSubject(null);
1798
+ this.__onZipCodeDataChanged$ = new BehaviorSubject(null);
1799
+ this.__oni18nDataChanged$ = new BehaviorSubject(null);
1800
+ this.__onDoSearch$ = new BehaviorSubject({});
1801
+ this.__tokenCredentials = null;
1802
+ this.__schedule = null;
1803
+ this.__callbackPagination = () => {
1804
+ // eslint-disable-next-line no-console
1805
+ return console.error('Method callbackPagination needs to be declared');
1806
+ };
1807
+ this.handleInit();
1808
+ }
1809
+ handleInit() {
1810
+ if (this.tokenStorage) {
1811
+ this.__tokenCredentials = this.tokenStorage.getToken();
1812
+ }
1813
+ if (this.otherArgs?.router) {
1814
+ const { clearOnChangeRoute } = this.otherArgs?.schedule?.options || {
1815
+ clearOnChangeRoute: false,
1816
+ };
1817
+ this.otherArgs.router.events
1818
+ .pipe(filter((event) => {
1819
+ return event instanceof NavigationStart;
1820
+ }), take(1))
1821
+ .subscribe(() => {
1822
+ if (this.__schedule && clearOnChangeRoute) {
1823
+ this.otherArgs?.schedule?.service?.removeSchedule(this.__schedule);
1824
+ this.__schedule = null;
1825
+ }
1826
+ });
1827
+ }
1828
+ }
1829
+ getRole() {
1830
+ const { __tokenCredentials } = this;
1831
+ if (!__tokenCredentials)
1832
+ return '';
1833
+ if (__tokenCredentials?.programAdmin === 'true') {
1834
+ return 'PROGRAM_ADMIN';
1835
+ }
1836
+ return __tokenCredentials?.role || '';
1837
+ }
1838
+ allowedSecurityAccess(args) {
1839
+ if (!args)
1840
+ return true;
1841
+ const roles = args?.roles;
1842
+ const byExclusion = args?.byExclusion;
1843
+ const found = roles?.indexOf(this.getRole());
1844
+ let ret = false;
1845
+ if (byExclusion) {
1846
+ ret = true;
1847
+ if (found > -1) {
1848
+ ret = false;
1849
+ }
1850
+ }
1851
+ else {
1852
+ ret = false;
1853
+ if (found > -1) {
1854
+ ret = true;
1855
+ }
1856
+ }
1857
+ if (!roles || roles.length === 0 || this.getRole() === 'PROGRAM_ADMIN') {
1858
+ ret = true;
1859
+ }
1860
+ return ret;
1861
+ }
1862
+ navigateToErrorPage(statusCode, router) {
1863
+ const routes = {
1864
+ 403: 'forbidden',
1865
+ 404: 'not-found',
1866
+ 500: 'service-problems',
1867
+ 503: 'service-problems',
1868
+ };
1869
+ if (!router) {
1870
+ console.error('Router must be declared');
1871
+ }
1872
+ else {
1873
+ router?.navigate([`/app/pages/${routes[statusCode]}`.toLowerCase()], {
1874
+ skipLocationChange: true,
1875
+ });
1876
+ }
1877
+ }
1878
+ setPage(requestPaged) {
1879
+ this.__requestPaged = {
1880
+ ...this.__requestPaged,
1881
+ ...requestPaged,
1882
+ };
1883
+ return this;
1884
+ }
1885
+ nextPage() {
1886
+ if (this.__links) {
1887
+ return !!this.__links?.next;
1888
+ }
1889
+ if (!this.__requestPaged)
1890
+ return false;
1891
+ const { page } = this.__requestPaged;
1892
+ const { number, totalPages } = page;
1893
+ if (number < totalPages) {
1894
+ this.__requestPaged = {
1895
+ ...this.__requestPaged,
1896
+ page: {
1897
+ ...page,
1898
+ number: number + 1,
1899
+ },
1900
+ };
1901
+ return true;
1902
+ }
1903
+ return false;
1904
+ }
1905
+ getEmbeddedData(data, field) {
1906
+ const { _embedded } = data;
1907
+ return _embedded ? _embedded[field] : null;
1908
+ }
1909
+ getNormalizedUrl(url) {
1910
+ const { __requestPaged, __links } = this;
1911
+ return new MonkeyEcxRequestPagedHandling(url, __requestPaged || {}, __links).getRequestWithPagedParams();
1912
+ }
1913
+ clear(clearData) {
1914
+ if (clearData) {
1915
+ this.__data = null;
1916
+ this.__requestPaged = null;
1917
+ this.__params = null;
1918
+ this.__page = null;
1919
+ this.__links = null;
1920
+ if (this.__schedule) {
1921
+ const { queue } = this.__schedule;
1922
+ if (queue) {
1923
+ this.otherArgs?.queue?.service?.removeQueueItem(queue);
1924
+ }
1925
+ this.otherArgs?.schedule?.service?.removeSchedule(this.__schedule);
1926
+ this.__schedule = null;
1927
+ }
1928
+ }
1929
+ this.__error = null;
1930
+ this.__handledError = null;
1931
+ this.flagValidator = false;
1932
+ }
1933
+ resolve(route, state, otherArgs) {
1934
+ if (JSON.stringify(route?.queryParams) === '{}') {
1935
+ this.__data = null;
1936
+ this.__page = null;
1937
+ }
1938
+ this.__requestPaged = null;
1939
+ this.flagValidator = true;
1940
+ if (this.tokenStorage) {
1941
+ this.__tokenCredentials = this.tokenStorage.getToken();
1942
+ }
1943
+ if (this.allowedSecurityAccess(otherArgs?.security)) {
1944
+ if (this.__schedule) {
1945
+ this.otherArgs?.schedule?.service?.removeSchedule(this.__schedule);
1946
+ this.__schedule = null;
1947
+ }
1948
+ const { __requestPaged } = this;
1949
+ if (!__requestPaged) {
1950
+ this.setPage({
1951
+ page: {
1952
+ number: 0,
1953
+ size: 10,
1954
+ },
1955
+ });
1956
+ }
1957
+ if (otherArgs?.translateOptions) {
1958
+ const { service, keys } = otherArgs?.translateOptions;
1959
+ this.geti18n(service, keys || '');
1960
+ }
1961
+ if (otherArgs?.callbackPagination) {
1962
+ this.__callbackPagination = otherArgs.callbackPagination;
1963
+ }
1964
+ if (otherArgs?.feature) {
1965
+ const { flag, service } = otherArgs.feature;
1966
+ service.onFlags
1967
+ .pipe(takeWhile(() => {
1968
+ return this.flagValidator;
1969
+ }))
1970
+ .subscribe((val) => {
1971
+ if (val) {
1972
+ const hasFlag = service.getFlag(flag);
1973
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(hasFlag)) {
1974
+ if (!hasFlag) {
1975
+ this.navigateToErrorPage(404, otherArgs?.router);
1976
+ return;
1977
+ }
1978
+ }
1979
+ otherArgs?.callbackMain();
1980
+ }
1981
+ });
1982
+ }
1983
+ else {
1984
+ otherArgs?.callbackMain();
1985
+ }
1986
+ }
1987
+ else {
1988
+ this.navigateToErrorPage(403, otherArgs?.router);
1989
+ }
1990
+ }
1991
+ getHTTPHeaderApplicationPDF() {
1992
+ return {
1993
+ observe: 'response',
1994
+ responseType: 'blob',
1995
+ };
1996
+ }
1997
+ genericMethod(link, data, callback) {
1998
+ const { href, type = 'get' } = link;
1999
+ this.monkeyecxService?.[type.toLowerCase()](`${href}`, data)?.subscribe(() => {
2000
+ if (callback)
2001
+ callback();
2002
+ }, (err) => {
2003
+ throwError(err);
2004
+ });
2005
+ }
2006
+ geti18n(translateService, keys) {
2007
+ combineLatest([
2008
+ translateService.onDefaultLangChange,
2009
+ translateService.getStreamOnTranslationChange(keys),
2010
+ ]).subscribe(([x, y]) => {
2011
+ console.log('get i18n veio aqui');
2012
+ console.log(x);
2013
+ console.log(y);
2014
+ });
2015
+ translateService.getStreamOnTranslationChange(keys).subscribe((translations) => {
2016
+ this.__i18n = translations;
2017
+ this.__oni18nDataChanged$.next(null);
2018
+ });
2019
+ }
2020
+ doPagination() {
2021
+ if (!this.__onLoadingInProgress$.value) {
2022
+ const hasMorePages = this.setPage({
2023
+ page: {
2024
+ ...this.__page,
2025
+ },
2026
+ }).nextPage();
2027
+ if (hasMorePages && this.__callbackPagination) {
2028
+ this.__callbackPagination();
2029
+ }
2030
+ }
2031
+ }
2032
+ setSearchByUrl(router, url, search, extras) {
2033
+ this.__data = null;
2034
+ this.__page = null;
2035
+ this.__onDataChanged$.next(null);
2036
+ this.__onLoadingInProgress$.next(false);
2037
+ router.navigate([url], {
2038
+ queryParams: {
2039
+ ...search,
2040
+ r: MonkeyEcxUtils.getRandomString(30),
2041
+ },
2042
+ queryParamsHandling: 'merge',
2043
+ ...extras,
2044
+ });
2045
+ }
2046
+ saveState(state) {
2047
+ this.__savedState = {
2048
+ page: this.__page,
2049
+ ...state,
2050
+ };
2051
+ }
2052
+ }
2053
+ __decorate([
2054
+ MonkeyEcxCoreService({
2055
+ requestInProgress: {
2056
+ showProgress: true,
2057
+ },
2058
+ })
2059
+ ], MonkeyEcxCommonsService.prototype, "genericMethod", null);
2060
+
2061
+ /* eslint-disable max-len */
2062
+ class MonkeyEcxHandlingService {
2063
+ constructor() {
2064
+ this.monkeyecxServiceCredentials = null;
2065
+ this.monkeyecxRequestQueue = null;
2066
+ this.monkeyecxRequestDownload = null;
2067
+ this.monkeyecxRequestUpload = null;
2068
+ }
2069
+ clearAll() {
2070
+ this.monkeyecxServiceCredentials = null;
2071
+ this.monkeyecxRequestQueue = null;
2072
+ this.monkeyecxRequestDownload = null;
2073
+ this.monkeyecxRequestUpload = null;
2074
+ }
2075
+ setMonkeyEcxServiceCredentials(param) {
2076
+ this.monkeyecxServiceCredentials = param;
2077
+ }
2078
+ getMonkeyEcxServiceCredentials() {
2079
+ return this.monkeyecxServiceCredentials;
2080
+ }
2081
+ setMonkeyEcxRequestQueue(queue) {
2082
+ this.monkeyecxRequestQueue = queue;
2083
+ }
2084
+ getMonkeyEcxRequestQueue() {
2085
+ return this.monkeyecxRequestQueue;
2086
+ }
2087
+ setMonkeyEcxRequestDownload(download) {
2088
+ this.monkeyecxRequestDownload = download;
2089
+ }
2090
+ getMonkeyEcxRequestDownload() {
2091
+ return this.monkeyecxRequestDownload;
2092
+ }
2093
+ setMonkeyEcxRequestUpload(upload) {
2094
+ this.monkeyecxRequestUpload = upload;
2095
+ }
2096
+ getMonkeyEcxRequestUpload() {
2097
+ return this.monkeyecxRequestUpload;
2098
+ }
2099
+ }
2100
+ MonkeyEcxHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2101
+ MonkeyEcxHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHandlingService, providedIn: 'root' });
2102
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHandlingService, decorators: [{
2103
+ type: Injectable,
2104
+ args: [{
2105
+ providedIn: 'root'
2106
+ }]
2107
+ }] });
2108
+
2109
+ class MonkeyEcxService {
2110
+ constructor(http, monkeyecxHandlingService) {
2111
+ this.http = http;
2112
+ this.monkeyecxHandlingService = monkeyecxHandlingService;
2113
+ // not to do
2114
+ }
2115
+ handlelize(params) {
2116
+ if (!params) {
2117
+ return params;
2118
+ }
2119
+ // eslint-disable-next-line no-restricted-syntax
2120
+ for (const field of [
2121
+ 'createdAt',
2122
+ 'createUserId',
2123
+ 'updatedAt',
2124
+ 'lastUserId',
2125
+ '_links',
2126
+ 'governmentIdType',
2127
+ 'governmentIdMask',
2128
+ 'screenType',
2129
+ 'screenTab',
2130
+ ]) {
2131
+ delete params[field];
2132
+ }
2133
+ return params;
2134
+ }
2135
+ get(url, options) {
2136
+ return this.http.get(url, options);
2137
+ }
2138
+ post(url, params, options) {
2139
+ return this.http.post(url, params, options);
2140
+ }
2141
+ put(url, params) {
2142
+ return this.http.put(url, this.handlelize({
2143
+ ...params,
2144
+ }));
2145
+ }
2146
+ delete(url, params) {
2147
+ return this.http.delete(url, params);
2148
+ }
2149
+ download(url, options, filename) {
2150
+ this.http.get(url, options).subscribe((resp) => {
2151
+ const { headers, body } = resp;
2152
+ const contentType = headers.get('Content-Type');
2153
+ const contentDisposition = headers.get('Content-Disposition');
2154
+ if (contentDisposition) {
2155
+ filename = contentDisposition
2156
+ .split(';')[1]
2157
+ .split('filename')[1]
2158
+ .split('=')[1]
2159
+ .trim()
2160
+ .replace(new RegExp(/"/g), '');
2161
+ }
2162
+ const blob = new Blob([body], {
2163
+ type: `${contentType}`,
2164
+ });
2165
+ return {
2166
+ filename,
2167
+ blob,
2168
+ };
2169
+ }, (err) => {
2170
+ throwError(err);
2171
+ });
2172
+ }
2173
+ downloadOb(url, options, filename) {
2174
+ return this.http.get(url, options).pipe(map((resp) => {
2175
+ const { headers, body } = resp;
2176
+ const contentType = headers.get('Content-Type');
2177
+ const contentDisposition = headers.get('Content-Disposition');
2178
+ if (contentDisposition) {
2179
+ filename = contentDisposition
2180
+ .split(';')[1]
2181
+ .split('filename')[1]
2182
+ .split('=')[1]
2183
+ .trim()
2184
+ .replace(new RegExp(/"/g), '');
2185
+ }
2186
+ const blob = new Blob([body], {
2187
+ type: `${contentType}`,
2188
+ });
2189
+ return {
2190
+ filename,
2191
+ blob,
2192
+ };
2193
+ }), catchError((err) => {
2194
+ return throwError(err);
2195
+ }));
2196
+ }
2197
+ }
2198
+ MonkeyEcxService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxService, deps: [{ token: i1$4.HttpClient }, { token: MonkeyEcxHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
2199
+ MonkeyEcxService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxService, providedIn: 'root' });
2200
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxService, decorators: [{
2201
+ type: Injectable,
2202
+ args: [{
2203
+ providedIn: 'root',
2204
+ }]
2205
+ }], ctorParameters: function () { return [{ type: i1$4.HttpClient }, { type: MonkeyEcxHandlingService }]; } });
2206
+
2207
+ let window$1;
2208
+ const text = {
2209
+ i18n: {
2210
+ title: 'We have an quick update for you',
2211
+ message: 'Click anywhere here to reload your locale',
2212
+ },
2213
+ theme: {
2214
+ title: 'We have an quick update for you',
2215
+ message: 'Click anywhere here to reload your theme',
2216
+ },
2217
+ };
2218
+ class MonkeyEcxErrorConfigService {
2219
+ constructor() {
2220
+ // not to do
2221
+ }
2222
+ enableSupport() {
2223
+ window$1.zE('webWidget', 'updateSettings', {
2224
+ webWidget: {
2225
+ color: {
2226
+ theme: '#0273E8',
2227
+ launcherText: '#fff',
2228
+ header: '#0273E8',
2229
+ button: '#0273E8',
2230
+ },
2231
+ zIndex: 99,
2232
+ offset: {
2233
+ horizontal: '1px',
2234
+ vertical: '20px',
2235
+ },
2236
+ mobile: {
2237
+ labelVisible: true,
2238
+ },
2239
+ launcher: {
2240
+ mobile: {
2241
+ labelVisible: true,
2242
+ },
2243
+ },
2244
+ },
2245
+ });
2246
+ window$1.zE('webWidget', 'setLocale', 'en-US');
2247
+ window$1.zE('webWidget', 'show');
2248
+ }
2249
+ apply(type) {
2250
+ const { title, message } = text?.[type];
2251
+ const element = document.createElement('div');
2252
+ element.id = 'monkeyecx-information';
2253
+ const elementImg = document.createElement('img');
2254
+ elementImg.width = 128;
2255
+ elementImg.src = 'assets/images/monkey.svg';
2256
+ elementImg.style.marginBottom = '50px';
2257
+ const elementTitle = document.createElement('span');
2258
+ elementTitle.id = 'title';
2259
+ elementTitle.innerText = title;
2260
+ elementTitle.style.marginBottom = '20px';
2261
+ const elementMessage = document.createElement('span');
2262
+ elementMessage.id = 'message';
2263
+ elementMessage.innerText = message;
2264
+ elementMessage.style.marginBottom = '20px';
2265
+ const elementChat = document.createElement('span');
2266
+ elementChat.id = 'message';
2267
+ elementChat.innerText =
2268
+ "If you're having trouble to update, please use the support icon bellow";
2269
+ element.appendChild(elementImg);
2270
+ element.appendChild(elementTitle);
2271
+ element.appendChild(elementMessage);
2272
+ element.appendChild(elementChat);
2273
+ element.addEventListener('click', () => {
2274
+ document.location.reload();
2275
+ });
2276
+ document.body.appendChild(element);
2277
+ document.body.getElementsByTagName('app-root')[0].remove();
2278
+ this.enableSupport();
2279
+ }
2280
+ }
2281
+ MonkeyEcxErrorConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxErrorConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2282
+ MonkeyEcxErrorConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxErrorConfigService, providedIn: 'root' });
2283
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxErrorConfigService, decorators: [{
2284
+ type: Injectable,
2285
+ args: [{
2286
+ providedIn: 'root',
2287
+ }]
2288
+ }], ctorParameters: function () { return []; } });
2289
+
2290
+ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
2291
+ constructor(monkeyecxService, translateService, monkeyecxCookieStorageService, monkeyecxErrorConfigService) {
2292
+ super(monkeyecxService);
2293
+ this.translateService = translateService;
2294
+ this.monkeyecxCookieStorageService = monkeyecxCookieStorageService;
2295
+ this.monkeyecxErrorConfigService = monkeyecxErrorConfigService;
2296
+ this.translateService.addLangs(['pt-BR', 'en-US']);
2297
+ this.translateService.setDefaultLang('pt-BR');
2298
+ this.translateService.use('pt-BR');
2299
+ }
2300
+ apply(params, environment, change = false) {
2301
+ const { monkeyecxService, monkeyecxCookieStorageService, monkeyecxErrorConfigService } = this;
2302
+ let { i18n } = params;
2303
+ const externali18n = params?.externali18n?.[`${i18n?.lang || 'pt-BR'}`];
2304
+ const cookie = monkeyecxCookieStorageService.getCookie('monkey-app-locale');
2305
+ if (cookie && !change) {
2306
+ i18n = JSON.parse(atob(cookie));
2307
+ }
2308
+ else {
2309
+ monkeyecxCookieStorageService.setCookie('monkey-app-locale', btoa(JSON.stringify(i18n)));
2310
+ if (!cookie)
2311
+ change = true;
2312
+ }
2313
+ monkeyecxService?.get(`${environment.localAssets}/i18n/${i18n?.lang}.json`)?.subscribe((config) => {
2314
+ const { lang } = config;
2315
+ let { data } = config;
2316
+ if (externali18n) {
2317
+ data = {
2318
+ ...data,
2319
+ EXTERNAL: externali18n,
2320
+ };
2321
+ }
2322
+ this.translateService.setTranslation(lang, data, true);
2323
+ this.translateService.use(lang);
2324
+ if (change)
2325
+ document.location.reload();
2326
+ }, (err) => {
2327
+ console.error(`i18n ${i18n?.lang} not found!`);
2328
+ monkeyecxErrorConfigService.apply('i18n');
2329
+ throwError(err);
2330
+ });
2331
+ }
2332
+ }
2333
+ MonkeyEcxi18nConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxi18nConfigService, deps: [{ token: MonkeyEcxService }, { token: i1$1.TranslateService }, { token: MonkeyEcxCookieStorageService }, { token: MonkeyEcxErrorConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
2334
+ MonkeyEcxi18nConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxi18nConfigService, providedIn: 'root' });
2335
+ __decorate([
2336
+ MonkeyEcxCoreService({
2337
+ httpResponse: {
2338
+ httpCodeIgnore: [404],
2339
+ },
2340
+ requestInProgress: {
2341
+ showProgress: false,
2342
+ },
2343
+ })
2344
+ ], MonkeyEcxi18nConfigService.prototype, "apply", null);
2345
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxi18nConfigService, decorators: [{
2346
+ type: Injectable,
2347
+ args: [{
2348
+ providedIn: 'root',
2349
+ }]
2350
+ }], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: i1$1.TranslateService }, { type: MonkeyEcxCookieStorageService }, { type: MonkeyEcxErrorConfigService }]; }, propDecorators: { apply: [] } });
2351
+
2352
+ class MonkeyEcxLogsConfigService {
2353
+ apply(params, configBoostrap, environment, identifyCode) {
2354
+ const { program, logs } = params;
2355
+ if (logs?.enabled && environment.environment !== 'dev') {
2356
+ datadogRum.init({
2357
+ applicationId: environment?.dataDogApplicationId,
2358
+ clientToken: environment?.dataDogClientToken,
2359
+ service: program?.token,
2360
+ site: 'datadoghq.com',
2361
+ sampleRate: 100,
2362
+ replaySampleRate: 100,
2363
+ env: `monkey-front-${identifyCode}-${environment.environment}`,
2364
+ version: configBoostrap?.version,
2365
+ trackInteractions: true,
2366
+ trackSessionAcrossSubdomains: true,
2367
+ useSecureSessionCookie: true,
2368
+ useCrossSiteSessionCookie: true
2369
+ });
2370
+ datadogRum.startSessionReplayRecording();
2371
+ }
2372
+ }
2373
+ }
2374
+ MonkeyEcxLogsConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxLogsConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2375
+ MonkeyEcxLogsConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxLogsConfigService, providedIn: 'root' });
2376
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxLogsConfigService, decorators: [{
2377
+ type: Injectable,
2378
+ args: [{
2379
+ providedIn: 'root'
2380
+ }]
2381
+ }] });
2382
+
2383
+ class MonkeyEcxServiceWorkerConfigService {
2384
+ constructor(appRef, updates, modalService) {
2385
+ this.appRef = appRef;
2386
+ this.updates = updates;
2387
+ this.modalService = modalService;
2388
+ // not to do
2389
+ }
2390
+ handleValidation(config) {
2391
+ const { updates, modalService } = this;
2392
+ updates?.available?.subscribe(() => {
2393
+ if (!config.showNewVersion || config.maintenance.closed) {
2394
+ document.location.reload();
2395
+ }
2396
+ else {
2397
+ modalService.open(VersionChangedComponent, {
2398
+ color: 'theme',
2399
+ size: 'md'
2400
+ });
2401
+ }
2402
+ });
2403
+ }
2404
+ verify() {
2405
+ const { appRef, updates } = this;
2406
+ const appIsStable$ = appRef.isStable
2407
+ .pipe(first((isStable) => { return isStable === true; }));
2408
+ const everyHour$ = interval(1 * 60 * 60 * 1000);
2409
+ const everyHourOnceAppIsStable$ = concat(appIsStable$, everyHour$);
2410
+ everyHourOnceAppIsStable$.subscribe(() => {
2411
+ updates.checkForUpdate();
2412
+ });
2413
+ updates.checkForUpdate();
2414
+ }
2415
+ apply(config) {
2416
+ this.handleValidation(config);
2417
+ this.verify();
2418
+ }
2419
+ }
2420
+ MonkeyEcxServiceWorkerConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxServiceWorkerConfigService, deps: [{ token: i0.ApplicationRef }, { token: i1$5.SwUpdate }, { token: i1.MonkeyStyleGuideModalService }], target: i0.ɵɵFactoryTarget.Injectable });
2421
+ MonkeyEcxServiceWorkerConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxServiceWorkerConfigService, providedIn: 'root' });
2422
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxServiceWorkerConfigService, decorators: [{
2423
+ type: Injectable,
2424
+ args: [{
2425
+ providedIn: 'root'
2426
+ }]
2427
+ }], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: i1$5.SwUpdate }, { type: i1.MonkeyStyleGuideModalService }]; } });
2428
+
2429
+ /* eslint-disable no-console */
2430
+ class MonkeyEcxSecurityConsoleConfigService extends MonkeyEcxCommonsService {
2431
+ constructor(translateService) {
2432
+ super();
2433
+ this.translateService = translateService;
2434
+ this.geti18n(this.translateService, 'SERVICES.WARNING.CONSOLE');
2435
+ }
2436
+ handleValidation() {
2437
+ this.__oni18nDataChanged$.subscribe(() => {
2438
+ const { __i18n } = this;
2439
+ const title = __i18n?.TITLE;
2440
+ const message = __i18n?.MESSAGE;
2441
+ if (title) {
2442
+ console.log(`%c${title}`, 'background: #f2f061; color: #ff0000; font-size: x-large');
2443
+ console.log(`%c${message}`, 'font-size: x-large');
2444
+ console.log('%c __ __ _ ______ \n ' +
2445
+ '| \\/ | ___ _ __ | | _____ _ _\\ \\ \\ \\ \n ' +
2446
+ "| |\\/| |/ _ \\| '_ \\| |/ / _ \\ | | |\\ \\ \\ \\ \n " +
2447
+ '| | | | (_) | | | | < __/ |_| |/ / / / \n ' +
2448
+ '|_| |_|\\___/|_| |_|_|\\_\\___|\\__, /_/_/_/ \n ' +
2449
+ ' |___/ \n ' +
2450
+ 'Join us: https://monkeyecx.gupy.io', 'background: #1976d2; color: #fff');
2451
+ }
2452
+ });
2453
+ }
2454
+ apply() {
2455
+ this.handleValidation();
2456
+ }
2457
+ }
2458
+ MonkeyEcxSecurityConsoleConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxSecurityConsoleConfigService, deps: [{ token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
2459
+ MonkeyEcxSecurityConsoleConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxSecurityConsoleConfigService, providedIn: 'root' });
2460
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxSecurityConsoleConfigService, decorators: [{
2461
+ type: Injectable,
2462
+ args: [{
2463
+ providedIn: 'root'
2464
+ }]
2465
+ }], ctorParameters: function () { return [{ type: i1$1.TranslateService }]; } });
2466
+
2467
+ class MonkeyEcxMaintenanceConfigService {
2468
+ constructor(modalService, router) {
2469
+ this.modalService = modalService;
2470
+ this.router = router;
2471
+ // not to do
2472
+ }
2473
+ handleValidation(config) {
2474
+ if (config.maintenance.closed) {
2475
+ localStorage.clear();
2476
+ this.router.navigate(['']);
2477
+ setTimeout(() => {
2478
+ this.modalService.open(ClosedToMaintenanceComponent, {
2479
+ color: 'theme',
2480
+ size: 'md',
2481
+ data: config
2482
+ });
2483
+ }, 200);
2484
+ }
2485
+ }
2486
+ apply(config) {
2487
+ this.handleValidation(config);
2488
+ }
2489
+ }
2490
+ MonkeyEcxMaintenanceConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxMaintenanceConfigService, deps: [{ token: i1.MonkeyStyleGuideModalService }, { token: i1$3.Router }], target: i0.ɵɵFactoryTarget.Injectable });
2491
+ MonkeyEcxMaintenanceConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxMaintenanceConfigService, providedIn: 'root' });
2492
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxMaintenanceConfigService, decorators: [{
2493
+ type: Injectable,
2494
+ args: [{
2495
+ providedIn: 'root'
2496
+ }]
2497
+ }], ctorParameters: function () { return [{ type: i1.MonkeyStyleGuideModalService }, { type: i1$3.Router }]; } });
2498
+
2499
+ class MonkeyEcxFeatureToggleService {
2500
+ constructor() {
2501
+ this.flagSubject$ = new BehaviorSubject(null);
2502
+ this.flags = undefined;
2503
+ this.ldClient = undefined;
2504
+ // not to do
2505
+ }
2506
+ getAllFlags() {
2507
+ if (!this)
2508
+ return;
2509
+ this.flags = this.ldClient?.allFlags();
2510
+ this.flagSubject$.next(true);
2511
+ }
2512
+ identify(config, environment) {
2513
+ if (config) {
2514
+ const email = 'monkey@monkey.exchange';
2515
+ const user = {
2516
+ email,
2517
+ key: `${config.program?.token}#${email}`,
2518
+ };
2519
+ if (!this.ldClient) {
2520
+ this.ldClient = initialize(environment.launchDarklyClientSideID, user, {
2521
+ streaming: true,
2522
+ disableSyncEventPost: true,
2523
+ sendEvents: false,
2524
+ diagnosticOptOut: true,
2525
+ });
2526
+ this.ldClient.on('change', this.getAllFlags.bind(this));
2527
+ this.ldClient.on('ready', this.getAllFlags.bind(this));
2528
+ }
2529
+ else {
2530
+ this.ldClient.identify(user, undefined, this.getAllFlags);
2531
+ }
2532
+ }
2533
+ }
2534
+ apply(configSubject$, environment) {
2535
+ if (environment.launchDarklyClientSideID) {
2536
+ configSubject$.subscribe((config) => {
2537
+ this.identify(config, environment);
2538
+ });
2539
+ }
2540
+ else {
2541
+ this.flagSubject$.next(true);
2542
+ }
2543
+ }
2544
+ get onFlags() {
2545
+ return this.flagSubject$.asObservable();
2546
+ }
2547
+ getFlag(flag) {
2548
+ const flagValue = this.flags?.[flag];
2549
+ return MonkeyUtils.persistNullEmptyUndefined(flagValue) ? flagValue : null;
2550
+ }
2551
+ }
2552
+ MonkeyEcxFeatureToggleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFeatureToggleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2553
+ MonkeyEcxFeatureToggleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFeatureToggleService, providedIn: 'root' });
2554
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFeatureToggleService, decorators: [{
2555
+ type: Injectable,
2556
+ args: [{
2557
+ providedIn: 'root',
2558
+ }]
2559
+ }], ctorParameters: function () { return []; } });
2560
+
2561
+ class MonkeyEcxConfigService extends MonkeyEcxCommonsService {
2562
+ constructor(monkeyecxService, monkeyecxi18nConfigService, monkeyecxLogsConfigService, monkeyStyleGuideSettingsService, monkeyecxServiceWorkerConfigService, monkeyecxSecurityConsoleConfigService, monkeyecxMaintenanceConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService) {
2563
+ super(monkeyecxService);
2564
+ this.monkeyecxi18nConfigService = monkeyecxi18nConfigService;
2565
+ this.monkeyecxLogsConfigService = monkeyecxLogsConfigService;
2566
+ this.monkeyStyleGuideSettingsService = monkeyStyleGuideSettingsService;
2567
+ this.monkeyecxServiceWorkerConfigService = monkeyecxServiceWorkerConfigService;
2568
+ this.monkeyecxSecurityConsoleConfigService = monkeyecxSecurityConsoleConfigService;
2569
+ this.monkeyecxMaintenanceConfigService = monkeyecxMaintenanceConfigService;
2570
+ this.monkeyecxErrorConfigService = monkeyecxErrorConfigService;
2571
+ this.monkeyEcxFeatureToggleService = monkeyEcxFeatureToggleService;
2572
+ this.configSubject$ = new BehaviorSubject({});
2573
+ this.configBoostrapSubject$ = new BehaviorSubject({});
2574
+ }
2575
+ internalValidations(...args) {
2576
+ const { monkeyecxServiceWorkerConfigService, monkeyecxSecurityConsoleConfigService, monkeyecxMaintenanceConfigService, } = this;
2577
+ const configBoostrap = args[0];
2578
+ const callback = args[1];
2579
+ monkeyecxSecurityConsoleConfigService.apply();
2580
+ monkeyecxServiceWorkerConfigService.apply(configBoostrap);
2581
+ monkeyecxMaintenanceConfigService.apply(configBoostrap);
2582
+ callback(configBoostrap);
2583
+ }
2584
+ getWhiteLabelSettings(monkeyecxCode, configBoostrap, callback, environment, identifyCode) {
2585
+ const { monkeyecxService, monkeyecxi18nConfigService, configSubject$, monkeyStyleGuideSettingsService, monkeyecxLogsConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService, internalValidations, } = this;
2586
+ const url = `${environment.urlAssets}`;
2587
+ monkeyecxService
2588
+ ?.get(`${url}/${monkeyecxCode.toLowerCase()}/white-label.json?t=${MonkeyUtils.getRandomString(30)}`)
2589
+ ?.subscribe((config) => {
2590
+ monkeyecxi18nConfigService.apply(config, environment);
2591
+ monkeyecxLogsConfigService.apply(config, configBoostrap, environment, identifyCode);
2592
+ monkeyEcxFeatureToggleService.apply(configSubject$, environment);
2593
+ monkeyStyleGuideSettingsService.boostrap(`${url}/${monkeyecxCode.toLowerCase()}/monkey-style-guide-settings.json?t=${MonkeyUtils.getRandomString(30)}`, internalValidations.bind(this, configBoostrap, callback, environment));
2594
+ configSubject$.next(config);
2595
+ }, (err) => {
2596
+ monkeyecxErrorConfigService.apply('theme');
2597
+ console.error('Program Configuration not found!');
2598
+ throwError(err);
2599
+ });
2600
+ }
2601
+ init(callback, environment, identifyCode, monkeyecxCode) {
2602
+ const { monkeyecxService, configBoostrapSubject$, monkeyecxErrorConfigService } = this;
2603
+ monkeyecxService
2604
+ ?.get(`${environment.boostrapAssets}?t=${MonkeyUtils.getRandomString(30)}`, {
2605
+ observe: 'response',
2606
+ })
2607
+ ?.subscribe((resp) => {
2608
+ const { headers, body } = resp;
2609
+ const monkeyCode = headers.get('monkey-code') || monkeyecxCode;
2610
+ if (monkeyCode) {
2611
+ this.getWhiteLabelSettings(monkeyCode, body, callback, environment, identifyCode);
2612
+ configBoostrapSubject$.next(body);
2613
+ }
2614
+ else {
2615
+ monkeyecxErrorConfigService.apply('theme');
2616
+ console.error(`Boostrap ${monkeyCode} Configuration not found!`);
2617
+ }
2618
+ }, (err) => {
2619
+ monkeyecxErrorConfigService.apply('theme');
2620
+ console.error('Boostrap Configuration not found!');
2621
+ throwError(err);
2622
+ });
2623
+ }
2624
+ config() {
2625
+ return this.configSubject$.asObservable();
2626
+ }
2627
+ boostrapConfig() {
2628
+ return this.configBoostrapSubject$.asObservable();
2629
+ }
2630
+ }
2631
+ MonkeyEcxConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxConfigService, deps: [{ token: MonkeyEcxService }, { token: MonkeyEcxi18nConfigService }, { token: MonkeyEcxLogsConfigService }, { token: i1.MonkeyStyleGuideSettingsService }, { token: MonkeyEcxServiceWorkerConfigService }, { token: MonkeyEcxSecurityConsoleConfigService }, { token: MonkeyEcxMaintenanceConfigService }, { token: MonkeyEcxErrorConfigService }, { token: MonkeyEcxFeatureToggleService }], target: i0.ɵɵFactoryTarget.Injectable });
2632
+ MonkeyEcxConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxConfigService, providedIn: 'root' });
2633
+ __decorate([
2634
+ MonkeyEcxCoreService({
2635
+ httpResponse: {
2636
+ httpCodeIgnore: [404],
2637
+ },
2638
+ requestInProgress: {
2639
+ showProgress: false,
2640
+ },
2641
+ })
2642
+ ], MonkeyEcxConfigService.prototype, "init", null);
2643
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxConfigService, decorators: [{
2644
+ type: Injectable,
2645
+ args: [{
2646
+ providedIn: 'root',
2647
+ }]
2648
+ }], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxi18nConfigService }, { type: MonkeyEcxLogsConfigService }, { type: i1.MonkeyStyleGuideSettingsService }, { type: MonkeyEcxServiceWorkerConfigService }, { type: MonkeyEcxSecurityConsoleConfigService }, { type: MonkeyEcxMaintenanceConfigService }, { type: MonkeyEcxErrorConfigService }, { type: MonkeyEcxFeatureToggleService }]; }, propDecorators: { init: [] } });
2649
+
2650
+ class MonkeyEcxTokenStorageService {
2651
+ constructor(monkeyecxConfigService) {
2652
+ this.monkeyecxConfigService = monkeyecxConfigService;
2653
+ this.config = null;
2654
+ this.token = {
2655
+ username: '',
2656
+ program: '',
2657
+ accessToken: '',
2658
+ refreshToken: '',
2659
+ companyId: '',
2660
+ governmentId: '',
2661
+ companyTypeUrl: '',
2662
+ companyType: '',
2663
+ programAdmin: false,
2664
+ programType: '',
2665
+ accessType: '',
2666
+ role: '',
2667
+ _clearIgnore: {
2668
+ ignore: ['username', 'program', 'accessType'],
2669
+ },
2670
+ };
2671
+ this.token$ = new BehaviorSubject(null);
2672
+ this.me$ = new BehaviorSubject(null);
2673
+ this.monkeyecxConfigService.config().subscribe((_) => {
2674
+ this.config = _;
2675
+ });
2676
+ }
2677
+ setAllTokens(token) {
2678
+ const { token$ } = this;
2679
+ Object.entries(token).forEach(([key, value]) => {
2680
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(value)) {
2681
+ localStorage.setItem(key, value);
2682
+ }
2683
+ });
2684
+ token$.next(token);
2685
+ }
2686
+ getAllTokens() {
2687
+ const { token, config } = this;
2688
+ const handledToken = {
2689
+ ...token,
2690
+ };
2691
+ Object.entries(token || {}).forEach(([key, value]) => {
2692
+ handledToken[key] = localStorage.getItem(key);
2693
+ });
2694
+ if (!handledToken?.program && config?.program) {
2695
+ handledToken.program = config?.program?.token;
2696
+ }
2697
+ return handledToken;
2698
+ }
2699
+ setAllMe(me) {
2700
+ const { me$ } = this;
2701
+ let previousMe = JSON.parse(localStorage?.getItem('me') || '{}');
2702
+ Object.entries(me).forEach(([key, value]) => {
2703
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(value)) {
2704
+ previousMe = {
2705
+ ...previousMe,
2706
+ [key]: value,
2707
+ };
2708
+ }
2709
+ });
2710
+ localStorage.setItem('me', JSON.stringify(previousMe));
2711
+ me$.next(previousMe);
2712
+ }
2713
+ getAllMe() {
2714
+ const me = localStorage.getItem('me');
2715
+ return JSON.parse(me || '{}');
2716
+ }
2717
+ tokenHasChanged() {
2718
+ return this.token$.asObservable();
2719
+ }
2720
+ meHasChanged() {
2721
+ return this.me$.asObservable() || null;
2722
+ }
2723
+ getToken() {
2724
+ return this.getAllTokens();
2725
+ }
2726
+ getMe() {
2727
+ return this.getAllMe();
2728
+ }
2729
+ setToken(token) {
2730
+ this.setAllTokens(token);
2731
+ }
2732
+ setMe(me) {
2733
+ this.setAllMe(me);
2734
+ }
2735
+ clear(force) {
2736
+ const { token } = this;
2737
+ try {
2738
+ Object.entries(token || {}).forEach(([key, value]) => {
2739
+ if ((token?._clearIgnore?.ignore || []).filter((val) => {
2740
+ return val === key;
2741
+ }).length <= 0 ||
2742
+ force === true) {
2743
+ localStorage.removeItem(key);
2744
+ }
2745
+ });
2746
+ localStorage.removeItem('me');
2747
+ }
2748
+ catch (error) {
2749
+ return of(false);
2750
+ }
2751
+ return of(true);
2752
+ }
2753
+ /**
2754
+ * @param fields (the name of fields you want to clear. ie: ['companyId', 'role', ...])
2755
+ */
2756
+ clearCredentials(fields = ['companyId', 'governmentId', 'companyType', 'programAdmin', 'role']) {
2757
+ fields?.forEach((key) => {
2758
+ localStorage.removeItem(key);
2759
+ });
2760
+ }
2761
+ }
2762
+ MonkeyEcxTokenStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxTokenStorageService, deps: [{ token: MonkeyEcxConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
2763
+ MonkeyEcxTokenStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxTokenStorageService, providedIn: 'root' });
2764
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxTokenStorageService, decorators: [{
2765
+ type: Injectable,
2766
+ args: [{
2767
+ providedIn: 'root',
2768
+ }]
2769
+ }], ctorParameters: function () { return [{ type: MonkeyEcxConfigService }]; } });
2770
+
2771
+ class MonkeyEcxSecurityDirective {
2772
+ constructor(elementRef, tokenStorageService, cdr) {
2773
+ this.elementRef = elementRef;
2774
+ this.tokenStorageService = tokenStorageService;
2775
+ this.cdr = cdr;
2776
+ this.roles = [];
2777
+ this.byExclusion = false;
2778
+ this.tokenCredentials = null;
2779
+ // not to do
2780
+ }
2781
+ getRole() {
2782
+ const { tokenCredentials } = this;
2783
+ if (!tokenCredentials)
2784
+ return '';
2785
+ if (tokenCredentials?.programAdmin === 'true') {
2786
+ return 'PROGRAM_ADMIN';
2787
+ }
2788
+ return tokenCredentials?.role || '';
2789
+ }
2790
+ handleAccess() {
2791
+ const { roles, byExclusion } = this;
2792
+ let display = 'none';
2793
+ const found = roles?.indexOf(this.getRole());
2794
+ if (byExclusion) {
2795
+ display = 'block';
2796
+ if (found > -1) {
2797
+ display = 'none';
2798
+ }
2799
+ }
2800
+ else {
2801
+ display = 'none';
2802
+ if (found > -1) {
2803
+ display = 'block';
2804
+ }
2805
+ }
2806
+ if (!roles || roles.length === 0 || this.getRole() === 'PROGRAM_ADMIN')
2807
+ display = 'block';
2808
+ this.elementRef.nativeElement.style.display = display;
2809
+ this.cdr.detectChanges();
2810
+ }
2811
+ ngOnInit() {
2812
+ this.elementRef.nativeElement.style.display = 'none';
2813
+ this.cdr.detectChanges();
2814
+ this.tokenStorageService.tokenHasChanged().subscribe(() => {
2815
+ this.tokenCredentials = this.tokenStorageService.getToken();
2816
+ this.handleAccess();
2817
+ });
2818
+ this.tokenCredentials = this.tokenStorageService.getToken();
2819
+ this.handleAccess();
2820
+ }
2821
+ }
2822
+ MonkeyEcxSecurityDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxSecurityDirective, deps: [{ token: i0.ElementRef }, { token: MonkeyEcxTokenStorageService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
2823
+ MonkeyEcxSecurityDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: MonkeyEcxSecurityDirective, selector: "[monkeyecxSecurity]", inputs: { roles: ["securityRoles", "roles"], byExclusion: ["securityByExclusion", "byExclusion"] }, ngImport: i0 });
2824
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxSecurityDirective, decorators: [{
2825
+ type: Directive,
2826
+ args: [{
2827
+ selector: '[monkeyecxSecurity]',
2828
+ }]
2829
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MonkeyEcxTokenStorageService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { roles: [{
2830
+ type: Input,
2831
+ args: ['securityRoles']
2832
+ }], byExclusion: [{
2833
+ type: Input,
2834
+ args: ['securityByExclusion']
2835
+ }] } });
2836
+
2837
+ class MonkeyEcxTooltipDirective {
2838
+ constructor(el, renderer) {
2839
+ this.el = el;
2840
+ this.renderer = renderer;
2841
+ this.enableToShow = true;
2842
+ this.offset = 10;
2843
+ this.tooltip = null;
2844
+ // not to do
2845
+ }
2846
+ onMouseEnter() {
2847
+ if (!this.tooltip) {
2848
+ this.show();
2849
+ }
2850
+ }
2851
+ onMouseLeave() {
2852
+ if (this.tooltip) {
2853
+ this.hide();
2854
+ }
2855
+ }
2856
+ clickout() {
2857
+ if (this.tooltip) {
2858
+ this.hide();
2859
+ }
2860
+ }
2861
+ show() {
2862
+ if (this.enableToShow) {
2863
+ this.create();
2864
+ this.setPosition();
2865
+ this.renderer.addClass(this.tooltip, 'monkeyecx-tooltip-show');
2866
+ setTimeout(() => {
2867
+ this.hide();
2868
+ }, 5000);
2869
+ }
2870
+ }
2871
+ hide() {
2872
+ if (!this.tooltip)
2873
+ return;
2874
+ this.renderer.removeClass(this.tooltip, 'monkeyecx-tooltip-show');
2875
+ this.renderer.removeChild(document.body, this.tooltip);
2876
+ this.tooltip = null;
2877
+ }
2878
+ create() {
2879
+ const tooltipElement = document.createElement('div');
2880
+ this.tooltip = this.renderer.createElement('span');
2881
+ if (this.tooltipTitle) {
2882
+ const tooltipTitleElement = document.createElement('span');
2883
+ tooltipTitleElement.innerText = `${this.tooltipTitle}`;
2884
+ tooltipTitleElement.className = 'monkeyecx-tooltip-title';
2885
+ tooltipElement.appendChild(tooltipTitleElement);
2886
+ }
2887
+ if (this.tooltipText) {
2888
+ const tooltipTextElement = document.createElement('span');
2889
+ tooltipTextElement.innerText = `${this.tooltipText}`;
2890
+ tooltipTextElement.className = 'monkeyecx-tooltip-description';
2891
+ tooltipElement.appendChild(tooltipTextElement);
2892
+ }
2893
+ this.renderer.appendChild(this.tooltip, tooltipElement);
2894
+ this.renderer.appendChild(document.body, this.tooltip);
2895
+ this.renderer.addClass(this.tooltip, 'monkeyecx-tooltip');
2896
+ this.renderer.addClass(this.tooltip, `monkeyecx-tooltip-${this.tooltipPosition}`);
2897
+ this.renderer.setStyle(this.tooltip, '-webkit-transition', `opacity ${this.tooltipDelay}ms`);
2898
+ this.renderer.setStyle(this.tooltip, '-moz-transition', `opacity ${this.tooltipDelay}ms`);
2899
+ this.renderer.setStyle(this.tooltip, '-o-transition', `opacity ${this.tooltipDelay}ms`);
2900
+ this.renderer.setStyle(this.tooltip, 'transition', `opacity ${this.tooltipDelay}ms`);
2901
+ }
2902
+ setPosition() {
2903
+ const hostPos = this.el.nativeElement.getBoundingClientRect();
2904
+ const tooltipPos = this.tooltip?.getBoundingClientRect();
2905
+ if (!tooltipPos)
2906
+ return;
2907
+ const scrollPos = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
2908
+ let top = 0;
2909
+ let left = 0;
2910
+ if (this.tooltipPosition === 'top') {
2911
+ top = hostPos.top - tooltipPos.height - this.offset;
2912
+ left = hostPos.left + (hostPos.width - tooltipPos.width) / 2;
2913
+ }
2914
+ if (this.tooltipPosition === 'bottom') {
2915
+ top = hostPos.bottom + this.offset;
2916
+ left = hostPos.left + (hostPos.width - tooltipPos.width) / 2;
2917
+ }
2918
+ if (this.tooltipPosition === 'left') {
2919
+ top = hostPos.top + (hostPos.height - tooltipPos.height) / 2;
2920
+ left = hostPos.left - tooltipPos.width - this.offset;
2921
+ }
2922
+ if (this.tooltipPosition === 'right') {
2923
+ top = hostPos.top + (hostPos.height - tooltipPos.height) / 2;
2924
+ left = hostPos.right + this.offset;
2925
+ }
2926
+ this.renderer.setStyle(this.tooltip, 'top', `${top + scrollPos}px`);
2927
+ this.renderer.setStyle(this.tooltip, 'left', `${left}px`);
2928
+ }
2929
+ }
2930
+ MonkeyEcxTooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxTooltipDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
2931
+ MonkeyEcxTooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: MonkeyEcxTooltipDirective, selector: "[monkeyecxTooltip]", inputs: { tooltipDelay: "tooltipDelay", tooltipPosition: "tooltipPosition", tooltipText: "tooltipText", tooltipTitle: "tooltipTitle", enableToShow: "enableToShow" }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "click": "clickout()" } }, ngImport: i0 });
2932
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxTooltipDirective, decorators: [{
2933
+ type: Directive,
2934
+ args: [{
2935
+ selector: '[monkeyecxTooltip]',
2936
+ }]
2937
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { tooltipDelay: [{
2938
+ type: Input
2939
+ }], tooltipPosition: [{
2940
+ type: Input
2941
+ }], tooltipText: [{
2942
+ type: Input
2943
+ }], tooltipTitle: [{
2944
+ type: Input
2945
+ }], enableToShow: [{
2946
+ type: Input
2947
+ }], onMouseEnter: [{
2948
+ type: HostListener,
2949
+ args: ['mouseenter']
2950
+ }], onMouseLeave: [{
2951
+ type: HostListener,
2952
+ args: ['mouseleave']
2953
+ }], clickout: [{
2954
+ type: HostListener,
2955
+ args: ['click']
2956
+ }] } });
2957
+
2958
+ class MonkeyEcxFeatureDirective {
2959
+ constructor(cdr, elementRef, monkeyecxFeatureToggleService) {
2960
+ this.cdr = cdr;
2961
+ this.elementRef = elementRef;
2962
+ this.monkeyecxFeatureToggleService = monkeyecxFeatureToggleService;
2963
+ this.unsubscribeAll = new Subject();
2964
+ // not to do
2965
+ }
2966
+ getFeature(feature) {
2967
+ const { monkeyecxFeatureToggleService } = this;
2968
+ if (!monkeyecxFeatureToggleService) {
2969
+ return false;
2970
+ }
2971
+ return monkeyecxFeatureToggleService?.getFlag(feature) || false;
2972
+ }
2973
+ handleDisplay() {
2974
+ if (!this.feature)
2975
+ return;
2976
+ const flag = this.getFeature(this.feature);
2977
+ let display = 'none';
2978
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(flag)) {
2979
+ return;
2980
+ }
2981
+ if (flag) {
2982
+ display = 'block';
2983
+ }
2984
+ if (display === 'none') {
2985
+ this.elementRef.nativeElement.remove();
2986
+ }
2987
+ this.elementRef.nativeElement.style.display = display;
2988
+ this.cdr.detectChanges();
2989
+ }
2990
+ ngOnDestroy() {
2991
+ this.unsubscribeAll.next();
2992
+ this.unsubscribeAll.complete();
2993
+ }
2994
+ ngOnInit() {
2995
+ if (!this.feature)
2996
+ return;
2997
+ this.elementRef.nativeElement.style.display = 'none';
2998
+ this.cdr.detectChanges();
2999
+ this.monkeyecxFeatureToggleService.onFlags
3000
+ .pipe(takeUntil(this.unsubscribeAll))
3001
+ .subscribe((val) => {
3002
+ if (val) {
3003
+ this.handleDisplay();
3004
+ }
3005
+ });
3006
+ }
3007
+ }
3008
+ MonkeyEcxFeatureDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFeatureDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: MonkeyEcxFeatureToggleService }], target: i0.ɵɵFactoryTarget.Directive });
3009
+ MonkeyEcxFeatureDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: MonkeyEcxFeatureDirective, selector: "[monkeyecxFeature]", inputs: { feature: ["featureName", "feature"] }, ngImport: i0 });
3010
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxFeatureDirective, decorators: [{
3011
+ type: Directive,
3012
+ args: [{
3013
+ selector: '[monkeyecxFeature]',
3014
+ }]
3015
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: MonkeyEcxFeatureToggleService }]; }, propDecorators: { feature: [{
3016
+ type: Input,
3017
+ args: ['featureName']
3018
+ }] } });
3019
+
3020
+ class MonkeyEcxDirectivesModule {
3021
+ }
3022
+ MonkeyEcxDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3023
+ MonkeyEcxDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxDirectivesModule, declarations: [MonkeyEcxDragDropDirective,
3024
+ MonkeyEcxFormatCurrency,
3025
+ MonkeyEcxFeatureDirective,
3026
+ MonkeyEcxFormatUpper,
3027
+ MonkeyEcxOnlyAlphaNumericDirective,
3028
+ MonkeyEcxOnlyNumbersDirective,
3029
+ MonkeyEcxSecurityDirective,
3030
+ MonkeyEcxTooltipDirective], exports: [MonkeyEcxDragDropDirective,
3031
+ MonkeyEcxFormatCurrency,
3032
+ MonkeyEcxFeatureDirective,
3033
+ MonkeyEcxFormatUpper,
3034
+ MonkeyEcxOnlyAlphaNumericDirective,
3035
+ MonkeyEcxOnlyNumbersDirective,
3036
+ MonkeyEcxSecurityDirective,
3037
+ MonkeyEcxTooltipDirective] });
3038
+ MonkeyEcxDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxDirectivesModule });
3039
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxDirectivesModule, decorators: [{
3040
+ type: NgModule,
3041
+ args: [{
3042
+ declarations: [
3043
+ MonkeyEcxDragDropDirective,
3044
+ MonkeyEcxFormatCurrency,
3045
+ MonkeyEcxFeatureDirective,
3046
+ MonkeyEcxFormatUpper,
3047
+ MonkeyEcxOnlyAlphaNumericDirective,
3048
+ MonkeyEcxOnlyNumbersDirective,
3049
+ MonkeyEcxSecurityDirective,
3050
+ MonkeyEcxTooltipDirective
3051
+ ],
3052
+ exports: [
3053
+ MonkeyEcxDragDropDirective,
3054
+ MonkeyEcxFormatCurrency,
3055
+ MonkeyEcxFeatureDirective,
3056
+ MonkeyEcxFormatUpper,
3057
+ MonkeyEcxOnlyAlphaNumericDirective,
3058
+ MonkeyEcxOnlyNumbersDirective,
3059
+ MonkeyEcxSecurityDirective,
3060
+ MonkeyEcxTooltipDirective
3061
+ ]
3062
+ }]
3063
+ }] });
3064
+
3065
+ /* eslint-disable no-console */
3066
+ class MonkeyEcxAuthenticationService {
3067
+ constructor() {
3068
+ this.hadAtLeastOneLogin = () => {
3069
+ console.error('hadAtLeastOneLogin needs to be declared!');
3070
+ return null;
3071
+ };
3072
+ this.redirectApp = () => {
3073
+ console.error('redirectApp needs to be declared!');
3074
+ return null;
3075
+ };
3076
+ this.redirectLoginWelcomeBack = () => {
3077
+ console.error('redirectLoginWelcomeBack needs to be declared!');
3078
+ return null;
3079
+ };
3080
+ this.isAuthorized = () => {
3081
+ console.error('isAuthorized needs to be declared!');
3082
+ return false;
3083
+ };
3084
+ this.getRequestWithHeaders = (request) => {
3085
+ console.error('getRequestWithHeaders needs to be declared!');
3086
+ return null;
3087
+ };
3088
+ this.getRequestWithHeadersOb = (request) => {
3089
+ console.error('getRequestWithHeadersOb needs to be declared!');
3090
+ return null;
3091
+ };
3092
+ this.refreshShouldHappen = (response) => {
3093
+ console.error('refreshShouldHappen needs to be declared!');
3094
+ return false;
3095
+ };
3096
+ this.refreshToken = () => {
3097
+ console.error('refreshToken needs to be declared!');
3098
+ return null;
3099
+ };
3100
+ // not to do
3101
+ }
3102
+ init(args) {
3103
+ this.hadAtLeastOneLogin = args?.hadAtLeastOneLogin || this.hadAtLeastOneLogin.bind(this);
3104
+ this.redirectApp = args?.redirectApp || this.redirectApp.bind(this);
3105
+ this.redirectLoginWelcomeBack = args?.redirectLoginWelcomeBack ||
3106
+ this.redirectLoginWelcomeBack.bind(this);
3107
+ this.isAuthorized = args?.isAuthorized || this.isAuthorized.bind(this);
3108
+ this.getRequestWithHeaders = args?.getRequestWithHeaders ||
3109
+ this.getRequestWithHeaders.bind(this);
3110
+ this.getRequestWithHeadersOb = args?.getRequestWithHeadersOb.bind(this);
3111
+ this.refreshShouldHappen = args?.refreshShouldHappen || this.refreshShouldHappen.bind(this);
3112
+ this.refreshToken = args?.refreshToken || this.refreshToken.bind(this);
3113
+ }
3114
+ }
3115
+ MonkeyEcxAuthenticationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxAuthenticationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3116
+ MonkeyEcxAuthenticationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxAuthenticationService, providedIn: 'root' });
3117
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxAuthenticationService, decorators: [{
3118
+ type: Injectable,
3119
+ args: [{
3120
+ providedIn: 'root'
3121
+ }]
3122
+ }], ctorParameters: function () { return []; } });
3123
+
3124
+ class MonkeyEcxAuthGuardLogin {
3125
+ constructor(monkeyecxAuthenticationService) {
3126
+ this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
3127
+ // not to do
3128
+ }
3129
+ canActivate() {
3130
+ if (this.monkeyecxAuthenticationService.isAuthorized()) {
3131
+ this.monkeyecxAuthenticationService.redirectApp();
3132
+ return false;
3133
+ }
3134
+ if (this.monkeyecxAuthenticationService.hadAtLeastOneLogin()) {
3135
+ this.monkeyecxAuthenticationService.redirectLoginWelcomeBack();
3136
+ return false;
3137
+ }
3138
+ return true;
3139
+ }
3140
+ }
3141
+ MonkeyEcxAuthGuardLogin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxAuthGuardLogin, deps: [{ token: MonkeyEcxAuthenticationService }], target: i0.ɵɵFactoryTarget.Injectable });
3142
+ MonkeyEcxAuthGuardLogin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxAuthGuardLogin, providedIn: 'root' });
3143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxAuthGuardLogin, decorators: [{
3144
+ type: Injectable,
3145
+ args: [{
3146
+ providedIn: 'root'
3147
+ }]
3148
+ }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }]; } });
3149
+
3150
+ class MonkeyEcxAuthGuard {
3151
+ constructor(monkeyecxAuthenticationService) {
3152
+ this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
3153
+ // not to do
3154
+ }
3155
+ canActivate() {
3156
+ const { monkeyecxAuthenticationService } = this;
3157
+ if (monkeyecxAuthenticationService.isAuthorized()) {
3158
+ return true;
3159
+ }
3160
+ monkeyecxAuthenticationService.redirectLoginWelcomeBack();
3161
+ return false;
3162
+ }
3163
+ }
3164
+ MonkeyEcxAuthGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxAuthGuard, deps: [{ token: MonkeyEcxAuthenticationService }], target: i0.ɵɵFactoryTarget.Injectable });
3165
+ MonkeyEcxAuthGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxAuthGuard, providedIn: 'root' });
3166
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxAuthGuard, decorators: [{
3167
+ type: Injectable,
3168
+ args: [{
3169
+ providedIn: 'root'
3170
+ }]
3171
+ }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }]; } });
3172
+
3173
+ class MonkeyEcxHttpErrorHandlingService extends MonkeyEcxCommonsService {
3174
+ constructor(monkeyecxService, tokenStorage, monkeyecxAuthenticationService, router, snackbarService, translateService) {
3175
+ super(monkeyecxService, tokenStorage);
3176
+ this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
3177
+ this.router = router;
3178
+ this.snackbarService = snackbarService;
3179
+ this.translateService = translateService;
3180
+ super.resolve(null, null);
3181
+ this.geti18n(this.translateService, 'SERVICES.WARNING');
3182
+ }
3183
+ isHttpCodeIgnoreMessage(tp, httpCode) {
3184
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(tp) && !tp?.httpResponse) {
3185
+ return false;
3186
+ }
3187
+ const found = (tp?.httpResponse?.httpCodeIgnore || [])?.indexOf(httpCode) > -1;
3188
+ return found;
3189
+ }
3190
+ isHttpCodeIgnoreRedirect(tp, httpCode) {
3191
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(tp) && !tp?.httpResponse) {
3192
+ return false;
3193
+ }
3194
+ const found = (tp?.httpResponse?.httpCodeIgnoreRedirect || [])?.indexOf(httpCode) > -1;
3195
+ return found;
3196
+ }
3197
+ getMessageType(status) {
3198
+ if (status === 409 || status === 400) {
3199
+ return 'warning';
3200
+ }
3201
+ return 'error';
3202
+ }
3203
+ showMessage(message, error, mkc) {
3204
+ const { snackbarService } = this;
3205
+ if (!this.isHttpCodeIgnoreMessage(mkc, error.status)) {
3206
+ snackbarService.show({
3207
+ title: this.__i18n?.TITLE,
3208
+ message,
3209
+ type: this.getMessageType(error.status),
3210
+ duration: 4000,
3211
+ horizontalPosition: 'center',
3212
+ verticalPosition: 'top'
3213
+ });
3214
+ }
3215
+ }
3216
+ handleMessage(error, mkc) {
3217
+ // eslint-disable-next-line camelcase
3218
+ const { notifications, error_description, message } = error.error;
3219
+ let customMessage = '';
3220
+ if (message) {
3221
+ customMessage = message;
3222
+ }
3223
+ // eslint-disable-next-line camelcase
3224
+ if (error_description) {
3225
+ // eslint-disable-next-line camelcase
3226
+ customMessage = error_description;
3227
+ }
3228
+ if (notifications) {
3229
+ customMessage = notifications;
3230
+ }
3231
+ if (!customMessage) {
3232
+ if (error.error instanceof Blob) {
3233
+ const blob = new Blob([error.error], {
3234
+ type: 'application/json'
3235
+ });
3236
+ const reader = new FileReader();
3237
+ reader.addEventListener('loadend', (e) => {
3238
+ const text = e?.target?.result;
3239
+ const jsonResp = JSON.parse(text);
3240
+ customMessage = jsonResp.notifications;
3241
+ this.showMessage(customMessage, error, mkc);
3242
+ });
3243
+ reader.readAsText(blob);
3244
+ }
3245
+ else {
3246
+ this.showMessage(this.__i18n['ERROR-HANDLING']?.ERROR, error, mkc);
3247
+ }
3248
+ }
3249
+ else {
3250
+ this.showMessage(customMessage, error, mkc);
3251
+ }
3252
+ }
3253
+ handleError(error, mkc) {
3254
+ const { router } = this;
3255
+ const { status } = error;
3256
+ const routes = {
3257
+ 403: 'forbidden',
3258
+ 500: 'service-problems',
3259
+ 503: 'service-problems'
3260
+ };
3261
+ const found = routes[status];
3262
+ let timeout = 0;
3263
+ if (found && !this.isHttpCodeIgnoreRedirect(mkc, error?.status)) {
3264
+ const route = `/app/pages/${found}`.toLowerCase();
3265
+ timeout = 800;
3266
+ router.navigate([route]);
3267
+ }
3268
+ setTimeout(() => {
3269
+ this.handleMessage(error, mkc);
3270
+ }, timeout);
3271
+ }
3272
+ handleErrorRefreshToken(error, mkc) {
3273
+ if (error.status === 401 || error.status === 400) {
3274
+ NgZone.call(this.monkeyecxAuthenticationService.redirectLoginWelcomeBack(), {});
3275
+ }
3276
+ else if (!this.isHttpCodeIgnoreMessage(mkc, error.status)) {
3277
+ this.handleMessage(error, mkc);
3278
+ }
3279
+ }
3280
+ }
3281
+ MonkeyEcxHttpErrorHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpErrorHandlingService, deps: [{ token: MonkeyEcxService }, { token: MonkeyEcxTokenStorageService }, { token: MonkeyEcxAuthenticationService }, { token: i1$3.Router }, { token: i1.MonkeyStyleGuideSnackbarService }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
3282
+ MonkeyEcxHttpErrorHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpErrorHandlingService, providedIn: 'root' });
3283
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpErrorHandlingService, decorators: [{
3284
+ type: Injectable,
3285
+ args: [{
3286
+ providedIn: 'root'
3287
+ }]
3288
+ }], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxTokenStorageService }, { type: MonkeyEcxAuthenticationService }, { type: i1$3.Router }, { type: i1.MonkeyStyleGuideSnackbarService }, { type: i1$1.TranslateService }]; } });
3289
+
3290
+ class MonkeyEcxOthersErrorsHandlingService {
3291
+ constructor(modalService) {
3292
+ this.modalService = modalService;
3293
+ // not to do
3294
+ }
3295
+ handleError(error) {
3296
+ const { modalService } = this;
3297
+ const { message } = error;
3298
+ if (new RegExp(/Loading chunk [\d]+ failed/).test(message)) {
3299
+ modalService.open(VersionChangedComponent, {
3300
+ color: 'theme',
3301
+ size: 'md'
3302
+ });
3303
+ }
3304
+ }
3305
+ }
3306
+ MonkeyEcxOthersErrorsHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxOthersErrorsHandlingService, deps: [{ token: i1.MonkeyStyleGuideModalService }], target: i0.ɵɵFactoryTarget.Injectable });
3307
+ MonkeyEcxOthersErrorsHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxOthersErrorsHandlingService, providedIn: 'root' });
3308
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxOthersErrorsHandlingService, decorators: [{
3309
+ type: Injectable,
3310
+ args: [{
3311
+ providedIn: 'root'
3312
+ }]
3313
+ }], ctorParameters: function () { return [{ type: i1.MonkeyStyleGuideModalService }]; } });
3314
+
3315
+ class MonkeyEcxErrorHandlingService {
3316
+ constructor(injector) {
3317
+ this.injector = injector;
3318
+ // not to do
3319
+ }
3320
+ handleError(error, type) {
3321
+ const { injector } = this;
3322
+ const handlingService = injector.get(MonkeyEcxHandlingService);
3323
+ const httpErrorHandlingService = injector.get(MonkeyEcxHttpErrorHandlingService);
3324
+ const othersErrorsHandlingService = injector.get(MonkeyEcxOthersErrorsHandlingService);
3325
+ console.log('======error');
3326
+ console.log(error);
3327
+ if (error instanceof HttpErrorResponse) {
3328
+ const sCredentials = handlingService?.getMonkeyEcxServiceCredentials() || {};
3329
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(type) && type === 'refresh_token') {
3330
+ httpErrorHandlingService.handleErrorRefreshToken(error, sCredentials);
3331
+ }
3332
+ else
3333
+ httpErrorHandlingService.handleError(error, sCredentials);
3334
+ }
3335
+ else {
3336
+ othersErrorsHandlingService.handleError(error);
3337
+ }
3338
+ }
3339
+ }
3340
+ MonkeyEcxErrorHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxErrorHandlingService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
3341
+ MonkeyEcxErrorHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxErrorHandlingService, providedIn: 'root' });
3342
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxErrorHandlingService, decorators: [{
3343
+ type: Injectable,
3344
+ args: [{
3345
+ providedIn: 'root',
3346
+ }]
3347
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
3348
+
3349
+ class MonkeyEcxErrorHandlingModule {
3350
+ static forRoot() {
3351
+ return {
3352
+ ngModule: MonkeyEcxErrorHandlingModule,
3353
+ providers: [
3354
+ {
3355
+ provide: ErrorHandler,
3356
+ useClass: MonkeyEcxErrorHandlingService,
3357
+ },
3358
+ ],
3359
+ };
3360
+ }
3361
+ }
3362
+ MonkeyEcxErrorHandlingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxErrorHandlingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3363
+ MonkeyEcxErrorHandlingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxErrorHandlingModule, imports: [CommonModule] });
3364
+ MonkeyEcxErrorHandlingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxErrorHandlingModule, imports: [[CommonModule]] });
3365
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxErrorHandlingModule, decorators: [{
3366
+ type: NgModule,
3367
+ args: [{
3368
+ imports: [CommonModule],
3369
+ }]
3370
+ }] });
3371
+
3372
+ class MonkeyEcxHttpConfigErrorInterceptor {
3373
+ constructor(monkeyecxAuthenticationService, monkeyecxErrorHandlingService) {
3374
+ this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
3375
+ this.monkeyecxErrorHandlingService = monkeyecxErrorHandlingService;
3376
+ // no to do
3377
+ }
3378
+ intercept(request, next) {
3379
+ return next.handle(request).pipe(map((event) => {
3380
+ return event;
3381
+ }), catchError((error) => {
3382
+ if (this.monkeyecxAuthenticationService.refreshShouldHappen(error)) {
3383
+ return this.monkeyecxAuthenticationService?.refreshToken()?.pipe(take(1), map(() => {
3384
+ return this.monkeyecxAuthenticationService.getRequestWithHeaders(request);
3385
+ }), mergeMap((resp) => {
3386
+ return next.handle(resp).pipe(catchError((error) => {
3387
+ this.monkeyecxErrorHandlingService.handleError(error, 'refresh_token');
3388
+ return throwError(null);
3389
+ }));
3390
+ }), catchError((error) => {
3391
+ this.monkeyecxErrorHandlingService.handleError(error, 'refresh_token');
3392
+ return throwError(null);
3393
+ })) || throwError(error);
3394
+ }
3395
+ return throwError(error);
3396
+ }));
3397
+ }
3398
+ }
3399
+ MonkeyEcxHttpConfigErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigErrorInterceptor, deps: [{ token: MonkeyEcxAuthenticationService }, { token: MonkeyEcxErrorHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
3400
+ MonkeyEcxHttpConfigErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigErrorInterceptor });
3401
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigErrorInterceptor, decorators: [{
3402
+ type: Injectable
3403
+ }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }, { type: MonkeyEcxErrorHandlingService }]; } });
3404
+
3405
+ class MonkeyEcxHttpConfigHeaderInterceptor {
3406
+ constructor(monkeyecxAuthenticationService, monkeyecxErrorHandlingService) {
3407
+ this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
3408
+ this.monkeyecxErrorHandlingService = monkeyecxErrorHandlingService;
3409
+ // not to do
3410
+ }
3411
+ intercept(request, next) {
3412
+ return this.monkeyecxAuthenticationService?.getRequestWithHeadersOb(request)?.pipe(take(1), map((event) => {
3413
+ return event;
3414
+ }), mergeMap((resp) => {
3415
+ request = request.clone({
3416
+ setHeaders: resp
3417
+ });
3418
+ return next.handle(request);
3419
+ }), catchError((error) => {
3420
+ this.monkeyecxErrorHandlingService.handleError(error);
3421
+ return throwError(error);
3422
+ })) || throwError('getRequestWithHeadersOb undefined');
3423
+ }
3424
+ }
3425
+ MonkeyEcxHttpConfigHeaderInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor, deps: [{ token: MonkeyEcxAuthenticationService }, { token: MonkeyEcxErrorHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
3426
+ MonkeyEcxHttpConfigHeaderInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor });
3427
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor, decorators: [{
3428
+ type: Injectable
3429
+ }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }, { type: MonkeyEcxErrorHandlingService }]; } });
3430
+
3431
+ class MonkeyEcxRequestQueueHandlingService {
3432
+ constructor() {
3433
+ this.queue = [];
3434
+ this.newQueue = new BehaviorSubject(false);
3435
+ this.queues$ = new BehaviorSubject([]);
3436
+ }
3437
+ addToQueue(q) {
3438
+ this.queue.push(q);
3439
+ this.queues$.next(this.queue);
3440
+ this.newQueue.next(true);
3441
+ }
3442
+ markQueueItemAsFinish(q, status, action) {
3443
+ const saved = [...this.queue];
3444
+ this.queue = [
3445
+ ...saved.map((val) => {
3446
+ const valSaved = {
3447
+ ...val
3448
+ };
3449
+ if (val.status === MonkeyEcxQueueEvents.OnGoing) {
3450
+ if (valSaved.item.id === q.item.id) {
3451
+ return {
3452
+ ...valSaved,
3453
+ status: status || MonkeyEcxQueueEvents.Finished,
3454
+ action
3455
+ };
3456
+ }
3457
+ }
3458
+ return valSaved;
3459
+ })
3460
+ ];
3461
+ this.queues$.next(this.queue);
3462
+ }
3463
+ updateQueue(q, progress) {
3464
+ const saved = [...this.queue];
3465
+ this.queue = [
3466
+ ...saved.map((val) => {
3467
+ const valSaved = {
3468
+ ...val
3469
+ };
3470
+ const { total, loaded } = progress;
3471
+ const currentPecentage = Math.floor(((loaded || 0) / (total || 0)) * 100);
3472
+ const totalPercentage = 100;
3473
+ if (valSaved.item.id === q.item.id) {
3474
+ return {
3475
+ ...valSaved,
3476
+ progress: {
3477
+ loaded,
3478
+ total,
3479
+ currentPercentage: currentPecentage,
3480
+ totalPercentage
3481
+ }
3482
+ };
3483
+ }
3484
+ return valSaved;
3485
+ })
3486
+ ];
3487
+ this.queues$.next(this.queue);
3488
+ }
3489
+ deleteQueue(q) {
3490
+ const saved = [...this.queue];
3491
+ this.queue = [
3492
+ ...saved.map((val) => {
3493
+ const valSaved = {
3494
+ ...val
3495
+ };
3496
+ if (valSaved.item.id === q.item.id) {
3497
+ return null;
3498
+ }
3499
+ return valSaved;
3500
+ })
3501
+ ].filter((_) => {
3502
+ return _;
3503
+ });
3504
+ this.queues$.next(this.queue);
3505
+ }
3506
+ setQueue(q) {
3507
+ if (!q)
3508
+ return;
3509
+ this.addToQueue(q);
3510
+ }
3511
+ getQueue() {
3512
+ return this.queues$.asObservable();
3513
+ }
3514
+ finishQueueItem(q, action, status) {
3515
+ if (!q)
3516
+ return;
3517
+ this.markQueueItemAsFinish(q, status, action);
3518
+ }
3519
+ removeQueueItem(q) {
3520
+ this.deleteQueue(q);
3521
+ }
3522
+ updateQueueItem(q, progress) {
3523
+ this.updateQueue(q, progress);
3524
+ }
3525
+ hasNewQueue() {
3526
+ return this.newQueue.pipe(map((_) => {
3527
+ return _;
3528
+ }));
3529
+ }
3530
+ }
3531
+ MonkeyEcxRequestQueueHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestQueueHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3532
+ MonkeyEcxRequestQueueHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestQueueHandlingService, providedIn: 'root' });
3533
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestQueueHandlingService, decorators: [{
3534
+ type: Injectable,
3535
+ args: [{
3536
+ providedIn: 'root'
3537
+ }]
3538
+ }], ctorParameters: function () { return []; } });
3539
+
3540
+ class MonkeyEcxRequestQueueModalHandlingService {
3541
+ constructor() {
3542
+ this.queue = [];
3543
+ this.newQueue$ = new BehaviorSubject(false);
3544
+ this.allQueueFinished$ = new BehaviorSubject(false);
3545
+ this.queues$ = new BehaviorSubject([]);
3546
+ }
3547
+ addToQueue(q) {
3548
+ this.queue.push(q);
3549
+ this.queues$.next(this.queue);
3550
+ this.newQueue$.next(true);
3551
+ }
3552
+ markQueueItemAsFinish(q, status, action) {
3553
+ const saved = [...this.queue];
3554
+ this.queue = [
3555
+ ...saved.map((val) => {
3556
+ const valSaved = {
3557
+ ...val
3558
+ };
3559
+ if (val.status === MonkeyEcxQueueEvents.OnGoing) {
3560
+ if (valSaved.item.id === q.item.id) {
3561
+ return {
3562
+ ...valSaved,
3563
+ status: status || MonkeyEcxQueueEvents.Finished,
3564
+ action
3565
+ };
3566
+ }
3567
+ }
3568
+ return valSaved;
3569
+ })
3570
+ ];
3571
+ this.queues$.next(this.queue);
3572
+ }
3573
+ updateQueue(q, progress) {
3574
+ const saved = [...this.queue];
3575
+ this.queue = [
3576
+ ...saved.map((val) => {
3577
+ const valSaved = {
3578
+ ...val
3579
+ };
3580
+ const { total, loaded } = progress;
3581
+ const currentPecentage = Math.floor(((loaded || 0) / (total || 0)) * 100);
3582
+ const totalPercentage = 100;
3583
+ if (valSaved.item.id === q.item.id) {
3584
+ return {
3585
+ ...valSaved,
3586
+ progress: {
3587
+ loaded,
3588
+ total,
3589
+ currentPercentage: currentPecentage,
3590
+ totalPercentage
3591
+ }
3592
+ };
3593
+ }
3594
+ return valSaved;
3595
+ })
3596
+ ];
3597
+ this.queues$.next(this.queue);
3598
+ }
3599
+ deleteQueue(q) {
3600
+ const saved = [...this.queue];
3601
+ this.queue = [
3602
+ ...saved.map((val) => {
3603
+ const valSaved = {
3604
+ ...val
3605
+ };
3606
+ if (valSaved.item.id === q.item.id) {
3607
+ return null;
3608
+ }
3609
+ return valSaved;
3610
+ })
3611
+ ].filter((_) => {
3612
+ return _;
3613
+ });
3614
+ this.queues$.next(this.queue);
3615
+ if (this.queue.length <= 0) {
3616
+ this.allQueueFinished$.next(true);
3617
+ }
3618
+ }
3619
+ setQueue(q) {
3620
+ this.addToQueue(q);
3621
+ }
3622
+ getQueue() {
3623
+ return this.queues$.asObservable();
3624
+ }
3625
+ finishQueueItem(q, action, status) {
3626
+ this.markQueueItemAsFinish(q, status, action);
3627
+ }
3628
+ removeQueueItem(q) {
3629
+ this.deleteQueue(q);
3630
+ }
3631
+ updateQueueItem(q, progress) {
3632
+ this.updateQueue(q, progress);
3633
+ }
3634
+ hasNewQueue() {
3635
+ return this.newQueue$.pipe(map((_) => {
3636
+ return _;
3637
+ }));
3638
+ }
3639
+ hasAllQueueFinished() {
3640
+ return this.allQueueFinished$.pipe(map((_) => {
3641
+ return _;
3642
+ }));
3643
+ }
3644
+ }
3645
+ MonkeyEcxRequestQueueModalHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestQueueModalHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3646
+ MonkeyEcxRequestQueueModalHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestQueueModalHandlingService, providedIn: 'root' });
3647
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestQueueModalHandlingService, decorators: [{
3648
+ type: Injectable,
3649
+ args: [{
3650
+ providedIn: 'root'
3651
+ }]
3652
+ }], ctorParameters: function () { return []; } });
3653
+
3654
+ /* eslint-disable max-len */
3655
+ class MonkeyEcxHttpConfigQueueInterceptor {
3656
+ constructor(injector, monkeyecxRequestQueueHandlingService) {
3657
+ this.injector = injector;
3658
+ this.monkeyecxRequestQueueHandlingService = monkeyecxRequestQueueHandlingService;
3659
+ // not to do
3660
+ }
3661
+ intercept(request, next) {
3662
+ const { injector, isQueueProperty } = this;
3663
+ const monkeyecxHandlingService = injector.get(MonkeyEcxHandlingService);
3664
+ const monkeyecxRequestQueue = monkeyecxHandlingService?.getMonkeyEcxRequestQueue();
3665
+ if (isQueueProperty(monkeyecxRequestQueue)) {
3666
+ this.monkeyecxRequestQueueHandlingService.setQueue(monkeyecxRequestQueue);
3667
+ }
3668
+ return next.handle(request).pipe(finalize(() => {
3669
+ if (isQueueProperty(monkeyecxRequestQueue)) {
3670
+ this.monkeyecxRequestQueueHandlingService.finishQueueItem(monkeyecxRequestQueue);
3671
+ }
3672
+ }));
3673
+ }
3674
+ isQueueProperty(mrq) {
3675
+ return (MonkeyEcxUtils.persistNullEmptyUndefined(mrq) &&
3676
+ MonkeyEcxUtils.persistNullEmptyUndefined(mrq?.item?.name));
3677
+ }
3678
+ }
3679
+ MonkeyEcxHttpConfigQueueInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigQueueInterceptor, deps: [{ token: i0.Injector }, { token: MonkeyEcxRequestQueueHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
3680
+ MonkeyEcxHttpConfigQueueInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigQueueInterceptor });
3681
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigQueueInterceptor, decorators: [{
3682
+ type: Injectable
3683
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: MonkeyEcxRequestQueueHandlingService }]; } });
3684
+
3685
+ /* eslint-disable max-len */
3686
+ class MonkeyEcxHttpConfigLoadingInProgressInterceptor {
3687
+ constructor(injector) {
3688
+ this.injector = injector;
3689
+ // no to do
3690
+ }
3691
+ intercept(request, next) {
3692
+ const { injector, isLoadingInProgressProperty } = this;
3693
+ const handlingService = injector.get(MonkeyEcxHandlingService);
3694
+ const progressBarService = injector.get(MonkeyEcxProgressBarService);
3695
+ const inProgress = handlingService?.getMonkeyEcxServiceCredentials()
3696
+ ? handlingService?.getMonkeyEcxServiceCredentials()?.requestInProgress || null
3697
+ : null;
3698
+ if (isLoadingInProgressProperty(inProgress)) {
3699
+ progressBarService.show();
3700
+ }
3701
+ return next.handle(request).pipe(finalize(() => {
3702
+ if (isLoadingInProgressProperty(inProgress)) {
3703
+ progressBarService.hide();
3704
+ }
3705
+ }));
3706
+ }
3707
+ isLoadingInProgressProperty(mlp) {
3708
+ if (!mlp)
3709
+ return false;
3710
+ return MonkeyEcxUtils.persistNullEmptyUndefined(mlp) &&
3711
+ MonkeyEcxUtils.persistNullEmptyUndefined(mlp.showProgress)
3712
+ ? mlp.showProgress
3713
+ : true;
3714
+ }
3715
+ }
3716
+ MonkeyEcxHttpConfigLoadingInProgressInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigLoadingInProgressInterceptor, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
3717
+ MonkeyEcxHttpConfigLoadingInProgressInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigLoadingInProgressInterceptor });
3718
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigLoadingInProgressInterceptor, decorators: [{
3719
+ type: Injectable
3720
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
3721
+
3722
+ class MonkeyEcxHttpConfigInterceptorModule {
3723
+ static forRoot() {
3724
+ return {
3725
+ ngModule: MonkeyEcxHttpConfigInterceptorModule,
3726
+ providers: [
3727
+ {
3728
+ provide: HTTP_INTERCEPTORS,
3729
+ useClass: MonkeyEcxHttpConfigHeaderInterceptor,
3730
+ multi: true,
3731
+ },
3732
+ {
3733
+ provide: HTTP_INTERCEPTORS,
3734
+ useClass: MonkeyEcxHttpConfigErrorInterceptor,
3735
+ multi: true,
3736
+ },
3737
+ {
3738
+ provide: HTTP_INTERCEPTORS,
3739
+ useClass: MonkeyEcxHttpConfigQueueInterceptor,
3740
+ multi: true,
3741
+ },
3742
+ {
3743
+ provide: HTTP_INTERCEPTORS,
3744
+ useClass: MonkeyEcxHttpConfigLoadingInProgressInterceptor,
3745
+ multi: true,
3746
+ },
3747
+ ],
3748
+ };
3749
+ }
3750
+ }
3751
+ MonkeyEcxHttpConfigInterceptorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3752
+ MonkeyEcxHttpConfigInterceptorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, imports: [CommonModule] });
3753
+ MonkeyEcxHttpConfigInterceptorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, imports: [[CommonModule]] });
3754
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, decorators: [{
3755
+ type: NgModule,
3756
+ args: [{
3757
+ imports: [CommonModule],
3758
+ }]
3759
+ }] });
3760
+
3761
+ class MonkeyEcxModel {
3762
+ getAction(type) {
3763
+ const { _links } = this;
3764
+ if (!_links)
3765
+ return null;
3766
+ const link = _links[type.toLowerCase()];
3767
+ return link;
3768
+ }
3769
+ }
3770
+
3771
+ /* eslint-disable indent */
3772
+ class MonkeyEcxConfigModule {
3773
+ constructor(parentModule) {
3774
+ if (parentModule) {
3775
+ throw new Error('MonkeyEcxConfigModule is already loaded. Import it in the AppModule only!');
3776
+ }
3777
+ }
3778
+ static forRoot() {
3779
+ return {
3780
+ ngModule: MonkeyEcxConfigModule,
3781
+ providers: [MonkeyEcxConfigService]
3782
+ };
3783
+ }
3784
+ }
3785
+ MonkeyEcxConfigModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxConfigModule, deps: [{ token: MonkeyEcxConfigModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
3786
+ MonkeyEcxConfigModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxConfigModule });
3787
+ MonkeyEcxConfigModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxConfigModule });
3788
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxConfigModule, decorators: [{
3789
+ type: NgModule
3790
+ }], ctorParameters: function () { return [{ type: MonkeyEcxConfigModule, decorators: [{
3791
+ type: Optional
3792
+ }, {
3793
+ type: SkipSelf
3794
+ }] }]; } });
3795
+
3796
+ class MonkeyEcxLoggedHandlingService {
3797
+ constructor() {
3798
+ this.schedules = [];
3799
+ // not to do
3800
+ }
3801
+ destroySchedule() {
3802
+ this.schedules.forEach((sch) => {
3803
+ clearInterval(sch.interval);
3804
+ });
3805
+ this.schedules = [];
3806
+ }
3807
+ addSchedule(sch) {
3808
+ this.schedules = sch;
3809
+ }
3810
+ destroy() {
3811
+ this.destroySchedule();
3812
+ }
3813
+ }
3814
+ MonkeyEcxLoggedHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxLoggedHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3815
+ MonkeyEcxLoggedHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxLoggedHandlingService, providedIn: 'root' });
3816
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxLoggedHandlingService, decorators: [{
3817
+ type: Injectable,
3818
+ args: [{
3819
+ providedIn: 'root'
3820
+ }]
3821
+ }], ctorParameters: function () { return []; } });
3822
+
3823
+ class MonkeyEcxRequestDownloadHandlingService {
3824
+ constructor() {
3825
+ this.download = [];
3826
+ this.download$ = new BehaviorSubject([]);
3827
+ }
3828
+ addTo(q) {
3829
+ this.download.push(q);
3830
+ this.download$.next(this.download);
3831
+ }
3832
+ markItemAsFinish(q, status) {
3833
+ const saved = [...this.download];
3834
+ this.download = [
3835
+ ...saved
3836
+ .map((val) => {
3837
+ if (val.status === MonkeyEcxDownloadEvents.OnGoing) {
3838
+ const valSaved = {
3839
+ ...val
3840
+ };
3841
+ if (valSaved.item.id === q.item.id) {
3842
+ return {
3843
+ ...valSaved,
3844
+ status: status || MonkeyEcxDownloadEvents.Finished
3845
+ };
3846
+ }
3847
+ return valSaved;
3848
+ }
3849
+ return null;
3850
+ })
3851
+ .filter((_) => {
3852
+ return _;
3853
+ })
3854
+ ];
3855
+ this.download = this.download.filter((_) => {
3856
+ return _.status === MonkeyEcxDownloadEvents.OnGoing;
3857
+ });
3858
+ this.download$.next(this.download);
3859
+ }
3860
+ updateItem(q, loaded, total) {
3861
+ const saved = [...this.download];
3862
+ this.download = [
3863
+ ...saved.map((val) => {
3864
+ const valSaved = {
3865
+ ...val
3866
+ };
3867
+ const currentPecentage = Math.floor(((loaded || 0) / (total || 0)) * 100);
3868
+ const totalPercentage = 100;
3869
+ if (valSaved.item.id === q.item.id) {
3870
+ return {
3871
+ ...valSaved,
3872
+ loaded,
3873
+ total,
3874
+ currentPercentage: currentPecentage,
3875
+ totalPercentage
3876
+ };
3877
+ }
3878
+ return valSaved;
3879
+ })
3880
+ ];
3881
+ this.download$.next(this.download);
3882
+ }
3883
+ set(q) {
3884
+ this.addTo(q);
3885
+ }
3886
+ get() {
3887
+ return this.download$.asObservable();
3888
+ }
3889
+ update(q, loaded, total) {
3890
+ this.updateItem(q, loaded, total);
3891
+ }
3892
+ finishItem(q, status) {
3893
+ this.markItemAsFinish(q, status);
3894
+ }
3895
+ hasDownloadOnGoing() {
3896
+ const found = this.download.find((_) => {
3897
+ return _.status === MonkeyEcxDownloadEvents.OnGoing;
3898
+ });
3899
+ return MonkeyEcxUtils.persistNullEmptyUndefined(found);
3900
+ }
3901
+ }
3902
+ MonkeyEcxRequestDownloadHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestDownloadHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3903
+ MonkeyEcxRequestDownloadHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestDownloadHandlingService, providedIn: 'root' });
3904
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestDownloadHandlingService, decorators: [{
3905
+ type: Injectable,
3906
+ args: [{
3907
+ providedIn: 'root'
3908
+ }]
3909
+ }], ctorParameters: function () { return []; } });
3910
+
3911
+ class MonkeyEcxRequestDownloadedHandlingService {
3912
+ constructor() {
3913
+ this.downloaded = [];
3914
+ this.downloaded$ = new BehaviorSubject([]);
3915
+ }
3916
+ addTo(q) {
3917
+ this.downloaded.push(q);
3918
+ this.downloaded$.next(this.downloaded);
3919
+ }
3920
+ markItemAsFinish(q, status) {
3921
+ const saved = [...this.downloaded];
3922
+ this.downloaded = [
3923
+ ...saved.map((val) => {
3924
+ if (val.status === MonkeyEcxDownloadEvents.OnGoing) {
3925
+ const valSaved = {
3926
+ ...val
3927
+ };
3928
+ if (valSaved.item.id === q.item.id) {
3929
+ return {
3930
+ ...valSaved,
3931
+ status: status || MonkeyEcxDownloadEvents.Finished,
3932
+ action: q.action
3933
+ };
3934
+ }
3935
+ return valSaved;
3936
+ }
3937
+ return val;
3938
+ })
3939
+ ];
3940
+ this.downloaded$.next(this.downloaded);
3941
+ }
3942
+ set(q) {
3943
+ this.addTo(q);
3944
+ }
3945
+ get() {
3946
+ return this.downloaded$.asObservable();
3947
+ }
3948
+ finishItem(q, status) {
3949
+ this.markItemAsFinish(q, status);
3950
+ }
3951
+ hasDownloadOnGoing() {
3952
+ const found = this.downloaded.find((_) => {
3953
+ return _.status === MonkeyEcxDownloadEvents.OnGoing;
3954
+ });
3955
+ return MonkeyEcxUtils.persistNullEmptyUndefined(found);
3956
+ }
3957
+ }
3958
+ MonkeyEcxRequestDownloadedHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestDownloadedHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3959
+ MonkeyEcxRequestDownloadedHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestDownloadedHandlingService, providedIn: 'root' });
3960
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestDownloadedHandlingService, decorators: [{
3961
+ type: Injectable,
3962
+ args: [{
3963
+ providedIn: 'root'
3964
+ }]
3965
+ }], ctorParameters: function () { return []; } });
3966
+
3967
+ class MonkeyEcxDiscoveryParamsService {
3968
+ constructor(router) {
3969
+ this.router = router;
3970
+ // not to do
3971
+ }
3972
+ getLastChild(route) {
3973
+ if (route.firstChild) {
3974
+ return this.getLastChild(route.firstChild);
3975
+ }
3976
+ return route;
3977
+ }
3978
+ setData(field, value) {
3979
+ const { root } = this.router.routerState.snapshot;
3980
+ const route = this.getLastChild(root);
3981
+ route.data[field] = value;
3982
+ }
3983
+ getData(field) {
3984
+ const { root } = this.router.routerState.snapshot;
3985
+ const route = this.getLastChild(root);
3986
+ const found = MonkeyEcxUtils.persistNullEmptyUndefined(route) ? route.data[field] : null;
3987
+ return found;
3988
+ }
3989
+ getDataFromCurrentNavigation(field) {
3990
+ const navigation = this.router.getCurrentNavigation();
3991
+ let state = null;
3992
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(navigation)) {
3993
+ state = navigation?.extras.state;
3994
+ }
3995
+ return state ? state[field] : null;
3996
+ }
3997
+ getParam(param) {
3998
+ const { root } = this.router.routerState.snapshot;
3999
+ const route = this.getLastChild(root);
4000
+ let found = MonkeyEcxUtils.persistNullEmptyUndefined(route)
4001
+ ? route?.paramMap?.get(param) || ''
4002
+ : '';
4003
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(found))
4004
+ found = this.getData(param);
4005
+ return found;
4006
+ }
4007
+ }
4008
+ MonkeyEcxDiscoveryParamsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxDiscoveryParamsService, deps: [{ token: i1$3.Router }], target: i0.ɵɵFactoryTarget.Injectable });
4009
+ MonkeyEcxDiscoveryParamsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxDiscoveryParamsService, providedIn: 'root' });
4010
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxDiscoveryParamsService, decorators: [{
4011
+ type: Injectable,
4012
+ args: [{
4013
+ providedIn: 'root'
4014
+ }]
4015
+ }], ctorParameters: function () { return [{ type: i1$3.Router }]; } });
4016
+
4017
+ class MonkeyEcxRequestScheduleService {
4018
+ constructor(monkeyecxService, monkeyecxLoggedHandlingService) {
4019
+ this.monkeyecxService = monkeyecxService;
4020
+ this.monkeyecxLoggedHandlingService = monkeyecxLoggedHandlingService;
4021
+ this.schedule = [];
4022
+ // not to do
4023
+ }
4024
+ addToSchedule(q) {
4025
+ this.schedule.push(q);
4026
+ this.monkeyecxLoggedHandlingService.addSchedule(this.schedule);
4027
+ }
4028
+ removeFromSchedule(q) {
4029
+ clearInterval(q.interval);
4030
+ const saved = [...this.schedule];
4031
+ this.schedule = [
4032
+ ...saved.map((sch) => {
4033
+ const savedLocal = {
4034
+ ...sch,
4035
+ };
4036
+ if (sch.id === q.id) {
4037
+ return null;
4038
+ }
4039
+ return savedLocal;
4040
+ }),
4041
+ ].filter((_) => {
4042
+ return _;
4043
+ });
4044
+ this.monkeyecxLoggedHandlingService.addSchedule(this.schedule);
4045
+ }
4046
+ removeFromScheduleById(id) {
4047
+ const q = this.getScheduleById(id);
4048
+ clearInterval(q.interval);
4049
+ const saved = [...this.schedule];
4050
+ this.schedule = [
4051
+ ...saved.map((sch) => {
4052
+ const savedLocal = {
4053
+ ...sch,
4054
+ };
4055
+ if (sch.id === q.id) {
4056
+ return null;
4057
+ }
4058
+ return savedLocal;
4059
+ }),
4060
+ ].filter((_) => {
4061
+ return _;
4062
+ });
4063
+ this.monkeyecxLoggedHandlingService.addSchedule(this.schedule);
4064
+ }
4065
+ doCall(sch) {
4066
+ const { url, method, params, data, action } = sch;
4067
+ this.monkeyecxService[method.toLowerCase()](`${url}`, params).subscribe((resp) => {
4068
+ action({
4069
+ ...data,
4070
+ ...resp,
4071
+ }, sch);
4072
+ }, () => {
4073
+ this.removeFromSchedule(sch);
4074
+ });
4075
+ }
4076
+ setSchedule(q, delay = 3000) {
4077
+ const interval = setInterval(() => {
4078
+ this.doCall({
4079
+ ...q,
4080
+ interval,
4081
+ });
4082
+ }, delay);
4083
+ const sch = {
4084
+ ...q,
4085
+ id: `${MonkeyEcxUtils.getRandomString(40)}`,
4086
+ interval,
4087
+ };
4088
+ this.addToSchedule(sch);
4089
+ return sch;
4090
+ }
4091
+ removeSchedule(q) {
4092
+ this.removeFromSchedule(q);
4093
+ }
4094
+ removeScheduleById(id) {
4095
+ this.removeFromScheduleById(id);
4096
+ }
4097
+ getScheduleById(id) {
4098
+ const q = this.schedule.find((sch) => {
4099
+ return sch.id === id;
4100
+ });
4101
+ return q;
4102
+ }
4103
+ }
4104
+ MonkeyEcxRequestScheduleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestScheduleService, deps: [{ token: MonkeyEcxService }, { token: MonkeyEcxLoggedHandlingService }], target: i0.ɵɵFactoryTarget.Injectable });
4105
+ MonkeyEcxRequestScheduleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestScheduleService, providedIn: 'root' });
4106
+ __decorate([
4107
+ MonkeyEcxCoreService({
4108
+ httpResponse: {
4109
+ httpCodeIgnore: [400, 403, 404, 500, 503],
4110
+ },
4111
+ requestInProgress: {
4112
+ showProgress: false,
4113
+ },
4114
+ })
4115
+ ], MonkeyEcxRequestScheduleService.prototype, "doCall", null);
4116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyEcxRequestScheduleService, decorators: [{
4117
+ type: Injectable,
4118
+ args: [{
4119
+ providedIn: 'root',
4120
+ }]
4121
+ }], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxLoggedHandlingService }]; }, propDecorators: { doCall: [] } });
4122
+
4123
+ /* eslint-disable no-unused-vars */
4124
+ var OpSearch;
4125
+ (function (OpSearch) {
4126
+ OpSearch["LIKE"] = ":*:value*";
4127
+ OpSearch["BETWEEN"] = ":first AND :last";
4128
+ OpSearch["OR"] = "OR";
4129
+ OpSearch["AND"] = "AND";
4130
+ OpSearch["GT"] = ">:value";
4131
+ OpSearch["LT"] = "<:value";
4132
+ OpSearch["EQUAL"] = "::value";
4133
+ })(OpSearch || (OpSearch = {}));
4134
+ class MonkeyEcxSpecificationSearch {
4135
+ constructor() {
4136
+ // not to do
4137
+ }
4138
+ handleValue(value) {
4139
+ return Object.entries(value).map(([key, value1]) => {
4140
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(value1)) {
4141
+ return null;
4142
+ }
4143
+ if (Array.isArray(value1)) {
4144
+ if (key === OpSearch.BETWEEN) {
4145
+ return `${key}`.replace(':first', value1[0]).replace(':last', value1[1]);
4146
+ }
4147
+ }
4148
+ return `${key}`.replace(':value', `${value1}`);
4149
+ })[0];
4150
+ }
4151
+ queryVisitor(value) {
4152
+ const okay = Object.entries(value).map(([key1, value1]) => {
4153
+ if (key1 === OpSearch.OR || key1 === OpSearch.AND) {
4154
+ const join = value1
4155
+ .map((_) => {
4156
+ return Object.entries(_).map(([key2, value2]) => {
4157
+ if (value2 instanceof Object) {
4158
+ value2 = this.handleValue(value2);
4159
+ }
4160
+ return this.criteriaParser(key2, value2);
4161
+ })[0];
4162
+ })
4163
+ .filter((_) => {
4164
+ return _;
4165
+ })
4166
+ .join(` ${key1} `);
4167
+ return `${join ? `(${join})` : ''}`;
4168
+ }
4169
+ if (value1 instanceof Object) {
4170
+ value1 = this.handleValue(value1);
4171
+ }
4172
+ return this.criteriaParser(key1, value1);
4173
+ });
4174
+ return okay
4175
+ .filter((_) => {
4176
+ return _;
4177
+ })
4178
+ .join(' AND ');
4179
+ }
4180
+ criteriaParser(key, value) {
4181
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(value)) {
4182
+ return '';
4183
+ }
4184
+ if (value instanceof Object) {
4185
+ return this.queryVisitor(value);
4186
+ }
4187
+ return `${key}${value}`;
4188
+ }
4189
+ build(spec) {
4190
+ try {
4191
+ return this.queryVisitor(spec);
4192
+ }
4193
+ catch (e) {
4194
+ throw new Error(`MonkeyEcxSpecificationSearch Error ${e}`);
4195
+ }
4196
+ }
4197
+ buildMoreThanOne(field, op = OpSearch.EQUAL) {
4198
+ let self = this;
4199
+ try {
4200
+ if (!self[field])
4201
+ return [];
4202
+ const filters = self[field]?.split(',')?.map((filter) => {
4203
+ if (!filter)
4204
+ return null;
4205
+ return {
4206
+ [field]: {
4207
+ [op]: `${filter}`
4208
+ }
4209
+ };
4210
+ }).filter((val) => { return val; });
4211
+ return filters || [];
4212
+ }
4213
+ catch (e) {
4214
+ throw new Error(`MonkeyEcxSpecificationSearch Error ${e}`);
4215
+ }
4216
+ }
4217
+ }
4218
+
4219
+ class MonkeyFrontCoreModuleModule {
4220
+ }
4221
+ MonkeyFrontCoreModuleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyFrontCoreModuleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4222
+ MonkeyFrontCoreModuleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyFrontCoreModuleModule, imports: [CommonModule,
4223
+ HttpClientModule, i1$1.TranslateModule, MonkeyEcxConfigModule, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxErrorHandlingModule, MonkeyStyleGuideModule, i1$5.ServiceWorkerModule, ClosedToMaintenanceModule,
4224
+ VersionChangedModule] });
4225
+ MonkeyFrontCoreModuleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyFrontCoreModuleModule, providers: [
4226
+ MonkeyStyleGuideModalService,
4227
+ MonkeyStyleGuideSettingsService,
4228
+ MonkeyStyleGuideSnackbarService
4229
+ ], imports: [[
4230
+ CommonModule,
4231
+ HttpClientModule,
4232
+ TranslateModule.forRoot(),
4233
+ MonkeyEcxConfigModule.forRoot(),
4234
+ MonkeyEcxHttpConfigInterceptorModule.forRoot(),
4235
+ MonkeyEcxErrorHandlingModule.forRoot(),
4236
+ MonkeyStyleGuideModule,
4237
+ ServiceWorkerModule.register('ngsw-worker.js'),
4238
+ ClosedToMaintenanceModule,
4239
+ VersionChangedModule
4240
+ ]] });
4241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MonkeyFrontCoreModuleModule, decorators: [{
4242
+ type: NgModule,
4243
+ args: [{
4244
+ imports: [
4245
+ CommonModule,
4246
+ HttpClientModule,
4247
+ TranslateModule.forRoot(),
4248
+ MonkeyEcxConfigModule.forRoot(),
4249
+ MonkeyEcxHttpConfigInterceptorModule.forRoot(),
4250
+ MonkeyEcxErrorHandlingModule.forRoot(),
4251
+ MonkeyStyleGuideModule,
4252
+ ServiceWorkerModule.register('ngsw-worker.js'),
4253
+ ClosedToMaintenanceModule,
4254
+ VersionChangedModule
4255
+ ],
4256
+ providers: [
4257
+ MonkeyStyleGuideModalService,
4258
+ MonkeyStyleGuideSettingsService,
4259
+ MonkeyStyleGuideSnackbarService
4260
+ ]
4261
+ }]
4262
+ }] });
4263
+
4264
+ /*
4265
+ * Public API Surface of monkey-front-core
4266
+ */
4267
+
4268
+ /**
4269
+ * Generated bundle index. Do not edit.
4270
+ */
4271
+
4272
+ export { ClosedToMaintenanceComponent, ClosedToMaintenanceModule, decoratorsUtils as DecoratorsUtils, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxCommonsService, MonkeyEcxConfigModule, MonkeyEcxConfigService, MonkeyEcxCookieStorageService, MonkeyEcxCoreCharts, MonkeyEcxCoreClearDecorators, MonkeyEcxCoreLog, MonkeyEcxCoreService, MonkeyEcxCoreServiceConstructor, MonkeyEcxCoreServicePaged, MonkeyEcxCoreServiceQueue, MonkeyEcxDirectivesModule, MonkeyEcxDiscoveryParamsService, MonkeyEcxDisplayFirstNamePipe, MonkeyEcxDragDropDirective, MonkeyEcxErrorConfigService, MonkeyEcxErrorHandlingModule, MonkeyEcxErrorHandlingService, MonkeyEcxFeatureDirective, MonkeyEcxFeatureToggleService, MonkeyEcxFormatAddressPipe, MonkeyEcxFormatCurrency, MonkeyEcxFormatCurrencyPipe, MonkeyEcxFormatDateGroupPipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLoggedHandlingService, MonkeyEcxLogsConfigService, MonkeyEcxMaintenanceConfigService, MonkeyEcxModel, MonkeyEcxOnlyAlphaNumericDirective, MonkeyEcxOnlyNumbersDirective, MonkeyEcxOthersErrorsHandlingService, MonkeyEcxPipesModule, MonkeyEcxProgressBarComponent, MonkeyEcxProgressBarModule, MonkeyEcxProgressBarService, MonkeyEcxRequestDownloadHandlingService, MonkeyEcxRequestDownloadedHandlingService, MonkeyEcxRequestPagedHandling, MonkeyEcxRequestQueueHandlingService, MonkeyEcxRequestQueueModalHandlingService, MonkeyEcxRequestScheduleService, MonkeyEcxSecurityConsoleConfigService, MonkeyEcxSecurityDirective, MonkeyEcxService, MonkeyEcxServiceDownload, MonkeyEcxServiceUpload, MonkeyEcxServiceWorkerConfigService, MonkeyEcxSpecificationSearch, MonkeyEcxTextTruncatePipe, MonkeyEcxTokenStorageService, MonkeyEcxTooltipDirective, MonkeyEcxTruncateQtdPipe, MonkeyEcxUtils, MonkeyEcxi18nConfigService, MonkeyFrontCoreModuleModule, OpSearch, statics as Statics, validateUtils as ValidateUtils, Validators, VersionChangedComponent, VersionChangedModule, comboValidator, dateRangeValidator, dateStartEndValidator, dateValidator, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
4273
+ //# sourceMappingURL=monkey-front-core.mjs.map