monkey-front-core 0.0.33 → 0.0.37

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