monkey-front-core 0.0.35 → 0.0.39

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 (257) hide show
  1. package/README.md +24 -24
  2. package/esm2020/lib/components/closed-to-maintenance/closed-to-maintenance.component.mjs +29 -0
  3. package/{esm2015/lib/components/closed-to-maintenance/closed-to-maintenance.module.js → esm2020/lib/components/closed-to-maintenance/closed-to-maintenance.module.mjs} +5 -5
  4. package/{esm2015/lib/components/closed-to-maintenance/index.js → esm2020/lib/components/closed-to-maintenance/index.mjs} +1 -1
  5. package/{esm2015/lib/components/index.js → esm2020/lib/components/index.mjs} +0 -0
  6. package/{esm2015/lib/components/progress-bar/index.js → esm2020/lib/components/progress-bar/index.mjs} +1 -1
  7. package/esm2020/lib/components/progress-bar/progress-bar.component.mjs +23 -0
  8. package/{esm2015/lib/components/progress-bar/progress-bar.module.js → esm2020/lib/components/progress-bar/progress-bar.module.mjs} +5 -5
  9. package/esm2020/lib/components/progress-bar/progress-bar.service.mjs +50 -0
  10. package/{esm2015/lib/components/version-changed/index.js → esm2020/lib/components/version-changed/index.mjs} +1 -1
  11. package/esm2020/lib/components/version-changed/version-changed.component.mjs +24 -0
  12. package/{esm2015/lib/components/version-changed/version-changed.module.js → esm2020/lib/components/version-changed/version-changed.module.mjs} +5 -5
  13. package/esm2020/lib/core/decorators/index.mjs +5 -0
  14. package/esm2020/lib/core/decorators/monkeyecx-charts-decorators.mjs +40 -0
  15. package/esm2020/lib/core/decorators/monkeyecx-decorators.mjs +113 -0
  16. package/esm2020/lib/core/decorators/monkeyecx-download-decorators.mjs +26 -0
  17. package/esm2020/lib/core/decorators/monkeyecx-upload-decorators.mjs +26 -0
  18. package/{esm2015/lib/core/directives/index.js → esm2020/lib/core/directives/index.mjs} +1 -1
  19. package/{esm2015/lib/core/directives/monkeyecx-directives-module.js → esm2020/lib/core/directives/monkeyecx-directives-module.mjs} +10 -10
  20. package/esm2020/lib/core/directives/monkeyecx-drag-drop.mjs +57 -0
  21. package/esm2020/lib/core/directives/monkeyecx-feature-directive.mjs +68 -0
  22. package/{esm2015/lib/core/directives/monkeyecx-format-currency.js → esm2020/lib/core/directives/monkeyecx-format-currency.mjs} +4 -4
  23. package/esm2020/lib/core/directives/monkeyecx-format-upper.mjs +67 -0
  24. package/{esm2015/lib/core/directives/monkeyecx-only-alpha-numeric-directive.js → esm2020/lib/core/directives/monkeyecx-only-alpha-numeric-directive.mjs} +4 -4
  25. package/{esm2015/lib/core/directives/monkeyecx-only-number-directive.js → esm2020/lib/core/directives/monkeyecx-only-number-directive.mjs} +4 -4
  26. package/esm2020/lib/core/directives/monkeyecx-security-directive.mjs +69 -0
  27. package/esm2020/lib/core/directives/monkeyecx-tooltip-directive.mjs +123 -0
  28. package/{esm2015/lib/core/index.js → esm2020/lib/core/index.mjs} +1 -1
  29. package/{esm2015/lib/core/interceptors/index.js → esm2020/lib/core/interceptors/index.mjs} +1 -1
  30. package/esm2020/lib/core/interceptors/monkeyecx-http-config-error.interceptor.mjs +39 -0
  31. package/esm2020/lib/core/interceptors/monkeyecx-http-config-header.interceptor.mjs +32 -0
  32. package/{esm2015/lib/core/interceptors/monkeyecx-http-config-interceptor.module.js → esm2020/lib/core/interceptors/monkeyecx-http-config-interceptor.module.mjs} +5 -5
  33. package/esm2020/lib/core/interceptors/monkeyecx-http-config-loading-in-progress.interceptor.mjs +43 -0
  34. package/esm2020/lib/core/interceptors/monkeyecx-http-config-queue.interceptor.mjs +37 -0
  35. package/{esm2015/lib/core/interfaces/index.js → esm2020/lib/core/interfaces/index.mjs} +1 -1
  36. package/esm2020/lib/core/interfaces/monkeyecx-auth-credentials.mjs +2 -0
  37. package/{esm2015/lib/core/interfaces/monkeyecx-company.js → esm2020/lib/core/interfaces/monkeyecx-company.mjs} +1 -1
  38. package/esm2020/lib/core/interfaces/monkeyecx-config-boostrap.mjs +2 -0
  39. package/esm2020/lib/core/interfaces/monkeyecx-config.mjs +2 -0
  40. package/{esm2015/lib/core/interfaces/monkeyecx-error-response.js → esm2020/lib/core/interfaces/monkeyecx-error-response.mjs} +1 -1
  41. package/{esm2015/lib/core/interfaces/monkeyecx-handled-error-response.js → esm2020/lib/core/interfaces/monkeyecx-handled-error-response.mjs} +1 -1
  42. package/{esm2015/lib/core/interfaces/monkeyecx-header-credentials.js → esm2020/lib/core/interfaces/monkeyecx-header-credentials.mjs} +1 -1
  43. package/{esm2015/lib/core/interfaces/monkeyecx-intercom-options.js → esm2020/lib/core/interfaces/monkeyecx-intercom-options.mjs} +1 -1
  44. package/esm2020/lib/core/interfaces/monkeyecx-me-credentials.mjs +2 -0
  45. package/esm2020/lib/core/interfaces/monkeyecx-navigation.mjs +2 -0
  46. package/{esm2015/lib/core/interfaces/monkeyecx-program.js → esm2020/lib/core/interfaces/monkeyecx-program.mjs} +1 -1
  47. package/{esm2015/lib/core/interfaces/monkeyecx-releases.js → esm2020/lib/core/interfaces/monkeyecx-releases.mjs} +1 -1
  48. package/{esm2015/lib/core/interfaces/monkeyecx-request-in-progress.js → esm2020/lib/core/interfaces/monkeyecx-request-in-progress.mjs} +1 -1
  49. package/esm2020/lib/core/interfaces/monkeyecx-request-paged.mjs +2 -0
  50. package/{esm2015/lib/core/interfaces/monkeyecx-response-paged.js → esm2020/lib/core/interfaces/monkeyecx-response-paged.mjs} +1 -1
  51. package/esm2020/lib/core/interfaces/monkeyecx-service-credentials.mjs +2 -0
  52. package/esm2020/lib/core/interfaces/monkeyecx-token-credentials.mjs +2 -0
  53. package/{esm2015/lib/core/interfaces/monkeyecx-translate-options.js → esm2020/lib/core/interfaces/monkeyecx-translate-options.mjs} +1 -1
  54. package/{esm2015/lib/core/interfaces/request-download/index.js → esm2020/lib/core/interfaces/request-download/index.mjs} +1 -1
  55. package/esm2020/lib/core/interfaces/request-download/monkeyecx-request-download.mjs +2 -0
  56. package/{esm2015/lib/core/interfaces/request-download/monkeyecx-request-downloaded.js → esm2020/lib/core/interfaces/request-download/monkeyecx-request-downloaded.mjs} +1 -1
  57. 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
  58. package/{esm2015/lib/core/interfaces/request-queue/index.js → esm2020/lib/core/interfaces/request-queue/index.mjs} +1 -1
  59. package/{esm2015/lib/core/interfaces/request-queue/monkeyecx-request-item-queue.js → esm2020/lib/core/interfaces/request-queue/monkeyecx-request-item-queue.mjs} +1 -1
  60. package/{esm2015/lib/core/interfaces/request-queue/monkeyecx-request-progress-queue.js → esm2020/lib/core/interfaces/request-queue/monkeyecx-request-progress-queue.mjs} +1 -1
  61. package/esm2020/lib/core/interfaces/request-queue/monkeyecx-request-queue.mjs +2 -0
  62. package/{esm2015/lib/core/interfaces/request-upload/index.js → esm2020/lib/core/interfaces/request-upload/index.mjs} +1 -1
  63. 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
  64. package/{esm2015/lib/core/interfaces/request-upload/monkeyecx-request-upload.js → esm2020/lib/core/interfaces/request-upload/monkeyecx-request-upload.mjs} +1 -1
  65. package/{esm2015/lib/core/interfaces/schedules/index.js → esm2020/lib/core/interfaces/schedules/index.mjs} +1 -1
  66. package/esm2020/lib/core/interfaces/schedules/monkeyecx-request-schedule.mjs +2 -0
  67. package/{esm2015/lib/core/model/index.js → esm2020/lib/core/model/index.mjs} +1 -1
  68. package/{esm2015/lib/core/model/monkeyecx-model.js → esm2020/lib/core/model/monkeyecx-model.mjs} +1 -1
  69. package/esm2020/lib/core/pipes/index.mjs +16 -0
  70. package/esm2020/lib/core/pipes/monkeyecx-display-first-name.mjs +19 -0
  71. package/esm2020/lib/core/pipes/monkeyecx-format-address.mjs +20 -0
  72. package/esm2020/lib/core/pipes/monkeyecx-format-currency.mjs +27 -0
  73. package/esm2020/lib/core/pipes/monkeyecx-format-date-timelapse.mjs +31 -0
  74. package/esm2020/lib/core/pipes/monkeyecx-format-date.mjs +29 -0
  75. package/esm2020/lib/core/pipes/monkeyecx-format-document.mjs +19 -0
  76. package/esm2020/lib/core/pipes/monkeyecx-format-number.mjs +20 -0
  77. package/esm2020/lib/core/pipes/monkeyecx-format-phone.mjs +42 -0
  78. package/esm2020/lib/core/pipes/monkeyecx-format-size.mjs +20 -0
  79. package/esm2020/lib/core/pipes/monkeyecx-format-type-document.mjs +19 -0
  80. package/esm2020/lib/core/pipes/monkeyecx-format-value.mjs +19 -0
  81. package/esm2020/lib/core/pipes/monkeyecx-format-zipcode.mjs +19 -0
  82. package/esm2020/lib/core/pipes/monkeyecx-pipes.module.mjs +87 -0
  83. package/esm2020/lib/core/pipes/monkeyecx-text-truncate.mjs +23 -0
  84. package/{esm2015/lib/core/pipes/monkeyecx-truncate-qtd.js → esm2020/lib/core/pipes/monkeyecx-truncate-qtd.mjs} +4 -4
  85. package/{esm2015/lib/core/services/auth/index.js → esm2020/lib/core/services/auth/index.mjs} +1 -1
  86. 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
  87. package/{esm2015/lib/core/services/auth/monkeyecx-auth-guard.service.js → esm2020/lib/core/services/auth/monkeyecx-auth-guard.service.mjs} +4 -4
  88. package/esm2020/lib/core/services/auth/monkeyecx-authentication.service.mjs +61 -0
  89. package/{esm2015/lib/core/services/commons/index.js → esm2020/lib/core/services/commons/index.mjs} +1 -1
  90. package/esm2020/lib/core/services/commons/monkeyecx-commons.service.mjs +269 -0
  91. package/{esm2015/lib/core/services/config/monkeyecx-config.module.js → esm2020/lib/core/services/config/monkeyecx-config.module.mjs} +5 -5
  92. package/esm2020/lib/core/services/config/monkeyecx-config.service.mjs +104 -0
  93. package/esm2020/lib/core/services/config/monkeyecx-error-config.service.mjs +85 -0
  94. package/esm2020/lib/core/services/config/monkeyecx-feature-toggle.service.mjs +65 -0
  95. package/esm2020/lib/core/services/config/monkeyecx-i18n-config.service.mjs +66 -0
  96. package/esm2020/lib/core/services/config/monkeyecx-logs-config.service.mjs +34 -0
  97. package/{esm2015/lib/core/services/config/monkeyecx-maintenance-config.service.js → esm2020/lib/core/services/config/monkeyecx-maintenance-config.service.mjs} +5 -5
  98. package/esm2020/lib/core/services/config/monkeyecx-security-console-config.service.mjs +42 -0
  99. package/esm2020/lib/core/services/config/monkeyecx-service-worker-config.service.mjs +53 -0
  100. package/{esm2015/lib/core/services/error/index.js → esm2020/lib/core/services/error/index.mjs} +1 -1
  101. package/{esm2015/lib/core/services/error/monkeyecx-error-handling.module.js → esm2020/lib/core/services/error/monkeyecx-error-handling.module.mjs} +5 -5
  102. package/esm2020/lib/core/services/error/monkeyecx-error-handling.service.mjs +43 -0
  103. package/esm2020/lib/core/services/error/monkeyecx-http-error-handling.service.mjs +127 -0
  104. 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
  105. package/esm2020/lib/core/services/index.mjs +24 -0
  106. package/{esm2015/lib/core/services/logged/index.js → esm2020/lib/core/services/logged/index.mjs} +1 -1
  107. package/{esm2015/lib/core/services/logged/monkeyecx-logged-handling.service.js → esm2020/lib/core/services/logged/monkeyecx-logged-handling.service.mjs} +4 -4
  108. package/esm2020/lib/core/services/monkeyecx-handling.service.mjs +50 -0
  109. package/esm2020/lib/core/services/monkeyecx-service.service.mjs +104 -0
  110. package/{esm2015/lib/core/services/request-download/index.js → esm2020/lib/core/services/request-download/index.mjs} +1 -1
  111. package/esm2020/lib/core/services/request-download/monkeyecx-request-download-handling.service.mjs +93 -0
  112. package/esm2020/lib/core/services/request-download/monkeyecx-request-downloaded-handling.service.mjs +61 -0
  113. package/{esm2015/lib/core/services/request-paged/index.js → esm2020/lib/core/services/request-paged/index.mjs} +1 -1
  114. package/esm2020/lib/core/services/request-paged/monkeyecx-request-request-paged-handling.mjs +30 -0
  115. package/{esm2015/lib/core/services/request-queue/index.js → esm2020/lib/core/services/request-queue/index.mjs} +1 -1
  116. package/esm2020/lib/core/services/request-queue/monkeyecx-request-queue-handling.service.mjs +114 -0
  117. package/esm2020/lib/core/services/request-queue/monkeyecx-request-queue-modal-handling.service.mjs +119 -0
  118. package/{esm2015/lib/core/services/routes/index.js → esm2020/lib/core/services/routes/index.mjs} +1 -1
  119. package/{esm2015/lib/core/services/routes/monkeyecx-dicovery-params.service.js → esm2020/lib/core/services/routes/monkeyecx-dicovery-params.service.mjs} +6 -6
  120. package/{esm2015/lib/core/services/schedules/index.js → esm2020/lib/core/services/schedules/index.mjs} +1 -1
  121. package/esm2020/lib/core/services/schedules/monkeyecx-request-schedule.service.mjs +127 -0
  122. package/{esm2015/lib/core/services/storage/index.js → esm2020/lib/core/services/storage/index.mjs} +1 -1
  123. package/{esm2015/lib/core/services/storage/monkeyecx-cookie-storage.service.js → esm2020/lib/core/services/storage/monkeyecx-cookie-storage.service.mjs} +5 -5
  124. package/esm2020/lib/core/services/storage/monkeyecx-token-storage.service.mjs +125 -0
  125. package/{esm2015/lib/core/specification-search/index.js → esm2020/lib/core/specification-search/index.mjs} +1 -1
  126. package/esm2020/lib/core/specification-search/monkeyecx-specification-search.mjs +97 -0
  127. package/esm2020/lib/core/utils/decorators-utils.mjs +40 -0
  128. package/{esm2015/lib/core/utils/index.js → esm2020/lib/core/utils/index.mjs} +1 -1
  129. package/{esm2015/lib/core/utils/statics.js → esm2020/lib/core/utils/statics.mjs} +1 -1
  130. package/esm2020/lib/core/utils/utils.mjs +218 -0
  131. package/esm2020/lib/core/utils/validate-utils.mjs +204 -0
  132. package/esm2020/lib/core/utils/validators.mjs +193 -0
  133. package/esm2020/lib/monkey-front-core.module.mjs +62 -0
  134. package/{esm2015/monkey-front-core.js → esm2020/monkey-front-core.mjs} +0 -0
  135. package/{esm2015/public-api.js → esm2020/public-api.mjs} +1 -1
  136. package/fesm2015/{monkey-front-core.js → monkey-front-core.mjs} +708 -517
  137. package/fesm2015/monkey-front-core.mjs.map +1 -0
  138. package/fesm2020/monkey-front-core.mjs +4219 -0
  139. package/fesm2020/monkey-front-core.mjs.map +1 -0
  140. package/lib/components/closed-to-maintenance/closed-to-maintenance.component.d.ts +2 -2
  141. package/lib/components/progress-bar/progress-bar.service.d.ts +1 -1
  142. package/lib/components/version-changed/version-changed.component.d.ts +1 -1
  143. package/lib/core/decorators/index.d.ts +1 -0
  144. package/lib/core/decorators/monkeyecx-charts-decorators.d.ts +1 -0
  145. package/lib/core/directives/monkeyecx-directives-module.d.ts +1 -1
  146. package/lib/core/directives/monkeyecx-feature-directive.d.ts +4 -4
  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 +5 -5
  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 +1 -1
  175. package/lib/core/services/config/monkeyecx-i18n-config.service.d.ts +0 -1
  176. package/lib/core/services/config/monkeyecx-maintenance-config.service.d.ts +1 -1
  177. package/lib/core/services/index.d.ts +13 -3
  178. package/lib/core/services/monkeyecx-handling.service.d.ts +8 -5
  179. package/lib/core/services/request-paged/monkeyecx-request-request-paged-handling.d.ts +1 -1
  180. package/lib/core/services/request-queue/monkeyecx-request-queue-handling.service.d.ts +2 -2
  181. package/lib/core/services/schedules/monkeyecx-request-schedule.service.d.ts +2 -2
  182. package/lib/core/utils/validate-utils.d.ts +13 -13
  183. package/monkey-front-core-0.0.39.tgz +0 -0
  184. package/package.json +22 -9
  185. package/bundles/monkey-front-core.umd.js +0 -4638
  186. package/bundles/monkey-front-core.umd.js.map +0 -1
  187. package/esm2015/lib/components/closed-to-maintenance/closed-to-maintenance.component.js +0 -32
  188. package/esm2015/lib/components/progress-bar/progress-bar.component.js +0 -28
  189. package/esm2015/lib/components/progress-bar/progress-bar.service.js +0 -49
  190. package/esm2015/lib/components/version-changed/version-changed.component.js +0 -25
  191. package/esm2015/lib/core/decorators/index.js +0 -4
  192. package/esm2015/lib/core/decorators/monkeyecx-decorators.js +0 -108
  193. package/esm2015/lib/core/decorators/monkeyecx-download-decorators.js +0 -24
  194. package/esm2015/lib/core/decorators/monkeyecx-upload-decorators.js +0 -24
  195. package/esm2015/lib/core/directives/monkeyecx-drag-drop.js +0 -57
  196. package/esm2015/lib/core/directives/monkeyecx-feature-directive.js +0 -66
  197. package/esm2015/lib/core/directives/monkeyecx-format-upper.js +0 -67
  198. package/esm2015/lib/core/directives/monkeyecx-security-directive.js +0 -67
  199. package/esm2015/lib/core/directives/monkeyecx-tooltip-directive.js +0 -120
  200. package/esm2015/lib/core/interceptors/monkeyecx-http-config-error.interceptor.js +0 -39
  201. package/esm2015/lib/core/interceptors/monkeyecx-http-config-header.interceptor.js +0 -32
  202. package/esm2015/lib/core/interceptors/monkeyecx-http-config-loading-in-progress.interceptor.js +0 -41
  203. package/esm2015/lib/core/interceptors/monkeyecx-http-config-queue.interceptor.js +0 -37
  204. package/esm2015/lib/core/interfaces/monkeyecx-auth-credentials.js +0 -2
  205. package/esm2015/lib/core/interfaces/monkeyecx-config-boostrap.js +0 -2
  206. package/esm2015/lib/core/interfaces/monkeyecx-config.js +0 -2
  207. package/esm2015/lib/core/interfaces/monkeyecx-me-credentials.js +0 -2
  208. package/esm2015/lib/core/interfaces/monkeyecx-navigation.js +0 -2
  209. package/esm2015/lib/core/interfaces/monkeyecx-request-paged.js +0 -2
  210. package/esm2015/lib/core/interfaces/monkeyecx-service-credentials.js +0 -2
  211. package/esm2015/lib/core/interfaces/monkeyecx-token-credentials.js +0 -2
  212. package/esm2015/lib/core/interfaces/request-download/monkeyecx-request-download.js +0 -2
  213. package/esm2015/lib/core/interfaces/request-queue/monkeyecx-request-queue.js +0 -2
  214. package/esm2015/lib/core/interfaces/schedules/monkeyecx-request-schedule.js +0 -2
  215. package/esm2015/lib/core/pipes/index.js +0 -13
  216. package/esm2015/lib/core/pipes/monkeyecx-display-first-name.js +0 -22
  217. package/esm2015/lib/core/pipes/monkeyecx-format-currency.js +0 -30
  218. package/esm2015/lib/core/pipes/monkeyecx-format-date-timelapse.js +0 -37
  219. package/esm2015/lib/core/pipes/monkeyecx-format-document.js +0 -22
  220. package/esm2015/lib/core/pipes/monkeyecx-format-number.js +0 -23
  221. package/esm2015/lib/core/pipes/monkeyecx-format-size.js +0 -23
  222. package/esm2015/lib/core/pipes/monkeyecx-format-type-document.js +0 -22
  223. package/esm2015/lib/core/pipes/monkeyecx-format-value.js +0 -22
  224. package/esm2015/lib/core/pipes/monkeyecx-format-zipcode.js +0 -22
  225. package/esm2015/lib/core/pipes/monkeyecx-pipes.module.js +0 -72
  226. package/esm2015/lib/core/pipes/monkeyecx-text-truncate.js +0 -26
  227. package/esm2015/lib/core/services/auth/monkeyecx-authentication.service.js +0 -61
  228. package/esm2015/lib/core/services/commons/monkeyecx-commons.service.js +0 -242
  229. package/esm2015/lib/core/services/config/index.js +0 -9
  230. package/esm2015/lib/core/services/config/monkeyecx-config.service.js +0 -104
  231. package/esm2015/lib/core/services/config/monkeyecx-error-config.service.js +0 -85
  232. package/esm2015/lib/core/services/config/monkeyecx-feature-toggle.service.js +0 -65
  233. package/esm2015/lib/core/services/config/monkeyecx-i18n-config.service.js +0 -72
  234. package/esm2015/lib/core/services/config/monkeyecx-logs-config.service.js +0 -34
  235. package/esm2015/lib/core/services/config/monkeyecx-security-console-config.service.js +0 -42
  236. package/esm2015/lib/core/services/config/monkeyecx-service-worker-config.service.js +0 -54
  237. package/esm2015/lib/core/services/error/monkeyecx-error-handling.service.js +0 -39
  238. package/esm2015/lib/core/services/error/monkeyecx-http-error-handling.service.js +0 -131
  239. package/esm2015/lib/core/services/index.js +0 -14
  240. package/esm2015/lib/core/services/monkeyecx-handling.service.js +0 -44
  241. package/esm2015/lib/core/services/monkeyecx-service.service.js +0 -102
  242. package/esm2015/lib/core/services/request-download/monkeyecx-request-download-handling.service.js +0 -81
  243. package/esm2015/lib/core/services/request-download/monkeyecx-request-downloaded-handling.service.js +0 -55
  244. package/esm2015/lib/core/services/request-paged/monkeyecx-request-request-paged-handling.js +0 -30
  245. package/esm2015/lib/core/services/request-queue/monkeyecx-request-queue-handling.service.js +0 -97
  246. package/esm2015/lib/core/services/request-queue/monkeyecx-request-queue-modal-handling.service.js +0 -106
  247. package/esm2015/lib/core/services/schedules/monkeyecx-request-schedule.service.js +0 -99
  248. package/esm2015/lib/core/services/storage/monkeyecx-token-storage.service.js +0 -117
  249. package/esm2015/lib/core/specification-search/monkeyecx-specification-search.js +0 -97
  250. package/esm2015/lib/core/utils/decorators-utils.js +0 -37
  251. package/esm2015/lib/core/utils/utils.js +0 -219
  252. package/esm2015/lib/core/utils/validate-utils.js +0 -204
  253. package/esm2015/lib/core/utils/validators.js +0 -193
  254. package/esm2015/lib/monkey-front-core.module.js +0 -60
  255. package/fesm2015/monkey-front-core.js.map +0 -1
  256. package/lib/core/services/config/index.d.ts +0 -8
  257. package/monkey-front-core-0.0.35.tgz +0 -0
@@ -0,0 +1,4219 @@
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
+ console.log('context');
1405
+ console.log(context);
1406
+ if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
1407
+ context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
1408
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxServiceCredentials(params);
1409
+ }
1410
+ const result = method.apply(context, args);
1411
+ return result;
1412
+ };
1413
+ return propertyDescriptor;
1414
+ };
1415
+ }
1416
+ function MonkeyEcxCoreServicePaged(params) {
1417
+ return function (target, propertyName, propertyDescriptor) {
1418
+ const method = propertyDescriptor.value;
1419
+ propertyDescriptor.value = function (...args) {
1420
+ const context = this;
1421
+ if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
1422
+ const credentials = context?.monkeyecxService?.monkeyecxHandlingService?.getMonkeyEcxServiceCredentials();
1423
+ let requestPaged = null;
1424
+ if (credentials) {
1425
+ requestPaged = credentials.requestPaged;
1426
+ }
1427
+ context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
1428
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxServiceCredentials({
1429
+ ...params,
1430
+ ...(requestPaged || null)
1431
+ });
1432
+ }
1433
+ const result = method.apply(context, args);
1434
+ return result;
1435
+ };
1436
+ return propertyDescriptor;
1437
+ };
1438
+ }
1439
+ function MonkeyEcxCoreServiceQueue(name, description, params) {
1440
+ return function (target, propertyName, propertyDescriptor) {
1441
+ const method = propertyDescriptor.value;
1442
+ propertyDescriptor.value = function (...args) {
1443
+ const context = this;
1444
+ if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
1445
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(params)) {
1446
+ context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
1447
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxServiceCredentials(params);
1448
+ }
1449
+ context?.monkeyecxService.monkeyecxHandlingService.setMonkeyEcxRequestQueue(buildQueuePropertys({
1450
+ name,
1451
+ description
1452
+ }));
1453
+ }
1454
+ const result = method.apply(context, args);
1455
+ return result;
1456
+ };
1457
+ return propertyDescriptor;
1458
+ };
1459
+ }
1460
+
1461
+ /* eslint-disable space-before-function-paren */
1462
+ function MonkeyEcxServiceDownload(name, description, params) {
1463
+ return function (target, propertyName, propertyDescriptor) {
1464
+ const method = propertyDescriptor.value;
1465
+ propertyDescriptor.value = function (...args) {
1466
+ const context = this;
1467
+ if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
1468
+ if (MonkeyUtils.persistNullEmptyUndefined(params)) {
1469
+ context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
1470
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxServiceCredentials(params);
1471
+ }
1472
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxRequestDownload({
1473
+ ...buildDownloadPropertys(name, description),
1474
+ });
1475
+ }
1476
+ const result = method.apply(context, args);
1477
+ return result;
1478
+ };
1479
+ return propertyDescriptor;
1480
+ };
1481
+ }
1482
+
1483
+ /* eslint-disable space-before-function-paren */
1484
+ function MonkeyEcxServiceUpload(name, description, params) {
1485
+ return function (target, propertyName, propertyDescriptor) {
1486
+ const method = propertyDescriptor.value;
1487
+ propertyDescriptor.value = function (...args) {
1488
+ const context = this;
1489
+ if (hasMonkeyEcxServiceAndHandlingProperties(context)) {
1490
+ if (MonkeyUtils.persistNullEmptyUndefined(params)) {
1491
+ context?.monkeyecxService?.monkeyecxHandlingService?.clearAll();
1492
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxServiceCredentials(params);
1493
+ }
1494
+ context?.monkeyecxService?.monkeyecxHandlingService?.setMonkeyEcxRequestUpload({
1495
+ ...buildUploadPropertys(name, description),
1496
+ });
1497
+ }
1498
+ const result = method.apply(context, args);
1499
+ return result;
1500
+ };
1501
+ return propertyDescriptor;
1502
+ };
1503
+ }
1504
+
1505
+ class MonkeyEcxDragDropDirective {
1506
+ constructor() {
1507
+ this.onFileDropped = new EventEmitter();
1508
+ this.background = '#f5fcff';
1509
+ this.opacity = '1';
1510
+ }
1511
+ onDragOver(evt) {
1512
+ evt?.preventDefault();
1513
+ evt?.stopPropagation();
1514
+ this.background = '#9ecbec';
1515
+ this.opacity = '0.8';
1516
+ }
1517
+ onDragLeave(evt) {
1518
+ evt?.preventDefault();
1519
+ evt?.stopPropagation();
1520
+ this.background = '#f5fcff';
1521
+ this.opacity = '1';
1522
+ }
1523
+ ondrop(evt) {
1524
+ evt?.preventDefault();
1525
+ evt?.stopPropagation();
1526
+ this.background = '#f5fcff';
1527
+ this.opacity = '1';
1528
+ const { files } = evt?.dataTransfer;
1529
+ if (files.length > 0) {
1530
+ this.onFileDropped.emit(files);
1531
+ }
1532
+ }
1533
+ }
1534
+ MonkeyEcxDragDropDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDragDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1535
+ 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 });
1536
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDragDropDirective, decorators: [{
1537
+ type: Directive,
1538
+ args: [{
1539
+ selector: '[monkeyecxDragDrop]',
1540
+ }]
1541
+ }], propDecorators: { onFileDropped: [{
1542
+ type: Output
1543
+ }], background: [{
1544
+ type: HostBinding,
1545
+ args: ['style.background-color']
1546
+ }], opacity: [{
1547
+ type: HostBinding,
1548
+ args: ['style.opacity']
1549
+ }], onDragOver: [{
1550
+ type: HostListener,
1551
+ args: ['dragover', ['$event']]
1552
+ }], onDragLeave: [{
1553
+ type: HostListener,
1554
+ args: ['dragleave', ['$event']]
1555
+ }], ondrop: [{
1556
+ type: HostListener,
1557
+ args: ['drop', ['$event']]
1558
+ }] } });
1559
+
1560
+ class MonkeyEcxFormatCurrency {
1561
+ constructor(elementRef, injector) {
1562
+ this.elementRef = elementRef;
1563
+ this.injector = injector;
1564
+ this.currencyCode = 'BRL';
1565
+ this.currentLocale = 'pt-BR';
1566
+ this.el = this.elementRef.nativeElement;
1567
+ this.currency = this.injector.get(CurrencyPipe);
1568
+ const translateService = this.injector.get(TranslateService);
1569
+ translateService.get('MONKEY-CURRENCY-CODE').subscribe((_) => {
1570
+ this.currencyCode = _;
1571
+ this.currentLocale = translateService.getDefaultLang();
1572
+ });
1573
+ }
1574
+ handle(value) {
1575
+ const { currencyCode, currentLocale } = this;
1576
+ const newValue = MonkeyEcxUtils.handleOnlyNumbers(value);
1577
+ return this.currency.transform(newValue / 100, currencyCode, 'symbol', '', currentLocale);
1578
+ }
1579
+ ngOnInit() {
1580
+ this.el.value = this.handle(this.el.value);
1581
+ }
1582
+ onInput(value) {
1583
+ this.el.value = this.handle(value);
1584
+ }
1585
+ }
1586
+ 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 });
1587
+ 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 });
1588
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFormatCurrency, decorators: [{
1589
+ type: Directive,
1590
+ args: [{
1591
+ selector: '[monkeyecxFormatCurrency]',
1592
+ providers: [CurrencyPipe]
1593
+ }]
1594
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }]; }, propDecorators: { onInput: [{
1595
+ type: HostListener,
1596
+ args: ['input', ['$event.target.value']]
1597
+ }] } });
1598
+
1599
+ class MonkeyEcxFormatUpper {
1600
+ constructor(_el, _renderer) {
1601
+ this._el = _el;
1602
+ this._renderer = _renderer;
1603
+ // not to do
1604
+ }
1605
+ onKeyDown(evt) {
1606
+ const value = this._el.nativeElement.value.toUpperCase();
1607
+ this._renderer.setProperty(this._el.nativeElement, 'value', value);
1608
+ this._onChange?.(value);
1609
+ evt.preventDefault();
1610
+ }
1611
+ onBlur() {
1612
+ this._touched?.();
1613
+ }
1614
+ writeValue(value) {
1615
+ this._renderer.setProperty(this._el.nativeElement, 'value', value);
1616
+ }
1617
+ registerOnChange(fn) {
1618
+ this._onChange = fn;
1619
+ }
1620
+ registerOnTouched(fn) {
1621
+ this._touched = fn;
1622
+ }
1623
+ setDisabledState(isDisabled) {
1624
+ this._renderer.setProperty(this._el.nativeElement, 'disabled', isDisabled);
1625
+ }
1626
+ }
1627
+ 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 });
1628
+ 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: [
1629
+ {
1630
+ provide: NG_VALUE_ACCESSOR,
1631
+ useExisting: forwardRef(() => {
1632
+ // eslint-disable-next-line no-use-before-define
1633
+ return MonkeyEcxFormatUpper;
1634
+ }),
1635
+ multi: true,
1636
+ },
1637
+ ], ngImport: i0 });
1638
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFormatUpper, decorators: [{
1639
+ type: Directive,
1640
+ args: [{
1641
+ selector: '[monkeyecxFormatUpper]',
1642
+ providers: [
1643
+ {
1644
+ provide: NG_VALUE_ACCESSOR,
1645
+ useExisting: forwardRef(() => {
1646
+ // eslint-disable-next-line no-use-before-define
1647
+ return MonkeyEcxFormatUpper;
1648
+ }),
1649
+ multi: true,
1650
+ },
1651
+ ],
1652
+ }]
1653
+ }], ctorParameters: function () { return [{ type: i0.ElementRef, decorators: [{
1654
+ type: Self
1655
+ }] }, { type: i0.Renderer2 }]; }, propDecorators: { onKeyDown: [{
1656
+ type: HostListener,
1657
+ args: ['keyup', ['$event']]
1658
+ }], onBlur: [{
1659
+ type: HostListener,
1660
+ args: ['blur', ['$event']]
1661
+ }] } });
1662
+
1663
+ class MonkeyEcxOnlyAlphaNumericDirective {
1664
+ constructor(elementRef) {
1665
+ this.elementRef = elementRef;
1666
+ // not to do
1667
+ }
1668
+ onInputChange(event) {
1669
+ const initalValue = this.elementRef.nativeElement.value;
1670
+ this.elementRef.nativeElement.value = MonkeyEcxUtils.handleOnlyAlphaNumeric(initalValue);
1671
+ if (initalValue !== this.elementRef.nativeElement.value) {
1672
+ event.stopPropagation();
1673
+ }
1674
+ }
1675
+ }
1676
+ MonkeyEcxOnlyAlphaNumericDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxOnlyAlphaNumericDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1677
+ MonkeyEcxOnlyAlphaNumericDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: MonkeyEcxOnlyAlphaNumericDirective, selector: "[monkeyecxOnlyAlphaNumeric]", host: { listeners: { "input": "onInputChange($event)" } }, ngImport: i0 });
1678
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxOnlyAlphaNumericDirective, decorators: [{
1679
+ type: Directive,
1680
+ args: [{
1681
+ selector: '[monkeyecxOnlyAlphaNumeric]'
1682
+ }]
1683
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onInputChange: [{
1684
+ type: HostListener,
1685
+ args: ['input', ['$event']]
1686
+ }] } });
1687
+
1688
+ class MonkeyEcxOnlyNumbersDirective {
1689
+ constructor(elementRef) {
1690
+ this.elementRef = elementRef;
1691
+ // not to do
1692
+ }
1693
+ onInputChange(event) {
1694
+ const initalValue = this.elementRef.nativeElement.value;
1695
+ this.elementRef.nativeElement.value = MonkeyEcxUtils.handleOnlyNumbers(initalValue);
1696
+ if (initalValue !== this.elementRef.nativeElement.value) {
1697
+ event.stopPropagation();
1698
+ }
1699
+ }
1700
+ }
1701
+ MonkeyEcxOnlyNumbersDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxOnlyNumbersDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1702
+ MonkeyEcxOnlyNumbersDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: MonkeyEcxOnlyNumbersDirective, selector: "[monkeyecxOnlyNumbers]", host: { listeners: { "input": "onInputChange($event)" } }, ngImport: i0 });
1703
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxOnlyNumbersDirective, decorators: [{
1704
+ type: Directive,
1705
+ args: [{
1706
+ selector: '[monkeyecxOnlyNumbers]'
1707
+ }]
1708
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onInputChange: [{
1709
+ type: HostListener,
1710
+ args: ['input', ['$event']]
1711
+ }] } });
1712
+
1713
+ class MonkeyEcxRequestPagedHandling {
1714
+ constructor(_url, _pagedParams) {
1715
+ this.url = _url;
1716
+ this.pagedParams = _pagedParams || {
1717
+ page: {}
1718
+ };
1719
+ }
1720
+ handlePagedValuesFromApi(url = '') {
1721
+ if (url.search('\\?') < 0)
1722
+ return url;
1723
+ const params = url.substring(url.search('\\?') + 1, url.length);
1724
+ url = url.substring(0, url.search('\\?'));
1725
+ return `${url}?${new HttpParams({
1726
+ fromString: params
1727
+ }).delete('size').delete('page').toString()}`;
1728
+ }
1729
+ getUrlParams(url) {
1730
+ const { pagedParams } = this;
1731
+ const { number, size } = pagedParams?.page || {};
1732
+ const hasInitialQueryParams = url.search('\\?') > 0;
1733
+ return `${!hasInitialQueryParams ? '?' : '&'}page=${number || 0}&size=${size || 20}`;
1734
+ }
1735
+ getRequestWithPagedParams() {
1736
+ const { url } = this;
1737
+ const handled = this.handlePagedValuesFromApi(url);
1738
+ return `${handled}${this.getUrlParams(handled)}`;
1739
+ }
1740
+ }
1741
+
1742
+ class MonkeyEcxCommonsService {
1743
+ constructor(monkeyecxService, tokenStorage, otherArgs) {
1744
+ this.monkeyecxService = monkeyecxService;
1745
+ this.tokenStorage = tokenStorage;
1746
+ this.otherArgs = otherArgs;
1747
+ this.flagValidator = true;
1748
+ this.__error = null;
1749
+ this.__handledError = null;
1750
+ this.__page = null;
1751
+ this.__requestPaged = null;
1752
+ this.__onSearchChanged$ = new BehaviorSubject(null);
1753
+ this.__onDataChanged$ = new BehaviorSubject(null);
1754
+ this.__onLoadingInProgress$ = new BehaviorSubject(false);
1755
+ this.__onDataDeleted$ = new BehaviorSubject(null);
1756
+ this.__onErrorChanged$ = new BehaviorSubject(null);
1757
+ this.__onGovernmentIdDataChanged$ = new BehaviorSubject(null);
1758
+ this.__onZipCodeDataChanged$ = new BehaviorSubject(null);
1759
+ this.__oni18nDataChanged$ = new BehaviorSubject(null);
1760
+ this.__onDoSearch$ = new BehaviorSubject({});
1761
+ this.__onDoPagination$ = new BehaviorSubject(null);
1762
+ this.__tokenCredentials = null;
1763
+ this.__schedule = null;
1764
+ this.handleInit();
1765
+ }
1766
+ handleInit() {
1767
+ if (this.tokenStorage) {
1768
+ this.__tokenCredentials = this.tokenStorage.getToken();
1769
+ }
1770
+ if (this.otherArgs?.router) {
1771
+ const { clearOnChangeRoute } = this.otherArgs?.schedule?.options || {
1772
+ clearOnChangeRoute: false
1773
+ };
1774
+ this.otherArgs.router.events
1775
+ .pipe(filter((event) => {
1776
+ return event instanceof NavigationStart;
1777
+ }), take(1))
1778
+ .subscribe(() => {
1779
+ if (this.__schedule && clearOnChangeRoute) {
1780
+ this.otherArgs?.schedule?.service?.removeSchedule(this.__schedule);
1781
+ this.__schedule = null;
1782
+ }
1783
+ });
1784
+ }
1785
+ }
1786
+ getRole() {
1787
+ const { __tokenCredentials } = this;
1788
+ if (!__tokenCredentials)
1789
+ return '';
1790
+ if (__tokenCredentials?.programAdmin === 'true') {
1791
+ return 'PROGRAM_ADMIN';
1792
+ }
1793
+ return __tokenCredentials?.role || '';
1794
+ }
1795
+ allowedSecurityAccess(args) {
1796
+ if (!args)
1797
+ return true;
1798
+ const roles = args?.roles;
1799
+ const byExclusion = args?.byExclusion;
1800
+ const found = roles?.indexOf(this.getRole());
1801
+ let ret = false;
1802
+ if (byExclusion) {
1803
+ ret = true;
1804
+ if (found > -1) {
1805
+ ret = false;
1806
+ }
1807
+ }
1808
+ else {
1809
+ ret = false;
1810
+ if (found > -1) {
1811
+ ret = true;
1812
+ }
1813
+ }
1814
+ if (!roles || roles.length === 0 || this.getRole() === 'PROGRAM_ADMIN') {
1815
+ ret = true;
1816
+ }
1817
+ return ret;
1818
+ }
1819
+ navigateToErrorPage(statusCode, router) {
1820
+ const routes = {
1821
+ 403: 'forbidden',
1822
+ 404: 'not-found',
1823
+ 500: 'service-problems',
1824
+ 503: 'service-problems'
1825
+ };
1826
+ if (!router) {
1827
+ console.error('Router must be declared');
1828
+ }
1829
+ else {
1830
+ router?.navigate([`/app/pages/${routes[statusCode]}`.toLowerCase()], {
1831
+ skipLocationChange: true
1832
+ });
1833
+ }
1834
+ }
1835
+ setPage(requestPaged) {
1836
+ this.__requestPaged = {
1837
+ ...this.__requestPaged,
1838
+ ...requestPaged
1839
+ };
1840
+ return this;
1841
+ }
1842
+ nextPage() {
1843
+ if (!this.__requestPaged)
1844
+ return false;
1845
+ const { page } = this.__requestPaged;
1846
+ const { number, totalPages } = page;
1847
+ if (number < totalPages) {
1848
+ this.__requestPaged = {
1849
+ ...this.__requestPaged,
1850
+ page: {
1851
+ ...page,
1852
+ number: number + 1
1853
+ }
1854
+ };
1855
+ return true;
1856
+ }
1857
+ return false;
1858
+ }
1859
+ getEmbeddedData(data, field) {
1860
+ const { _embedded } = data;
1861
+ return _embedded ? _embedded[field] : null;
1862
+ }
1863
+ getNormalizedUrl(url) {
1864
+ const { __requestPaged } = this;
1865
+ return new MonkeyEcxRequestPagedHandling(url, __requestPaged || {}).getRequestWithPagedParams();
1866
+ }
1867
+ clear(clearData) {
1868
+ if (clearData) {
1869
+ this.__data = null;
1870
+ this.__requestPaged = null;
1871
+ this.__params = null;
1872
+ this.__page = null;
1873
+ if (this.__schedule) {
1874
+ const { queue } = this.__schedule;
1875
+ if (queue) {
1876
+ this.otherArgs?.queue?.service?.removeQueueItem(queue);
1877
+ }
1878
+ this.otherArgs?.schedule?.service?.removeSchedule(this.__schedule);
1879
+ this.__schedule = null;
1880
+ }
1881
+ }
1882
+ this.__error = null;
1883
+ this.__handledError = null;
1884
+ this.flagValidator = false;
1885
+ }
1886
+ resolve(route, state, otherArgs) {
1887
+ this.__data = null;
1888
+ this.__page = null;
1889
+ this.__requestPaged = null;
1890
+ this.flagValidator = true;
1891
+ if (this.tokenStorage) {
1892
+ this.__tokenCredentials = this.tokenStorage.getToken();
1893
+ }
1894
+ if (this.allowedSecurityAccess(otherArgs?.security)) {
1895
+ //Object.entries(this).forEach(([key, value]) => {
1896
+ // if (value instanceof BehaviorSubject) {
1897
+ // Object.defineProperty(this, key, new BehaviorSubject(null));
1898
+ // }
1899
+ //});
1900
+ if (this.__schedule) {
1901
+ this.otherArgs?.schedule?.service?.removeSchedule(this.__schedule);
1902
+ this.__schedule = null;
1903
+ }
1904
+ const { __requestPaged } = this;
1905
+ if (!__requestPaged) {
1906
+ this.setPage({
1907
+ page: {
1908
+ number: 0,
1909
+ size: 10
1910
+ }
1911
+ });
1912
+ }
1913
+ if (otherArgs?.callbackPagination) {
1914
+ this.__onDoPagination$.subscribe(() => {
1915
+ if (!this.__onLoadingInProgress$.value) {
1916
+ const hasMorePages = this.setPage({
1917
+ page: {
1918
+ ...this.__page
1919
+ }
1920
+ }).nextPage();
1921
+ if (hasMorePages && otherArgs?.callbackPagination) {
1922
+ otherArgs.callbackPagination();
1923
+ }
1924
+ }
1925
+ });
1926
+ }
1927
+ if (otherArgs?.translateOptions) {
1928
+ const { service, keys } = otherArgs?.translateOptions;
1929
+ this.geti18n(service, keys || '');
1930
+ }
1931
+ if (otherArgs?.feature) {
1932
+ const { flag, service } = otherArgs.feature;
1933
+ service.onFlags
1934
+ .pipe(takeWhile(() => {
1935
+ return this.flagValidator;
1936
+ }))
1937
+ .subscribe((val) => {
1938
+ if (val) {
1939
+ const hasFlag = service.getFlag(flag);
1940
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(hasFlag)) {
1941
+ if (!hasFlag) {
1942
+ this.navigateToErrorPage(404, otherArgs?.router);
1943
+ return;
1944
+ }
1945
+ }
1946
+ otherArgs?.callbackMain();
1947
+ }
1948
+ });
1949
+ }
1950
+ else {
1951
+ otherArgs?.callbackMain();
1952
+ }
1953
+ }
1954
+ else {
1955
+ this.navigateToErrorPage(403, otherArgs?.router);
1956
+ }
1957
+ }
1958
+ getHTTPHeaderApplicationPDF() {
1959
+ return {
1960
+ observe: 'response',
1961
+ responseType: 'blob'
1962
+ };
1963
+ }
1964
+ genericMethod(link, data, callback) {
1965
+ const { href, type = 'get' } = link;
1966
+ let func = null;
1967
+ const tp = `${type}`.toLowerCase();
1968
+ if (tp === 'get') {
1969
+ func = this.monkeyecxService?.get;
1970
+ }
1971
+ else if (tp === 'post') {
1972
+ func = this.monkeyecxService?.post;
1973
+ }
1974
+ else if (tp === 'put') {
1975
+ func = this.monkeyecxService?.put;
1976
+ }
1977
+ else if (tp === 'delete') {
1978
+ func = this.monkeyecxService?.delete;
1979
+ }
1980
+ func?.(`${href}`, data)?.subscribe((resp) => {
1981
+ if (callback)
1982
+ callback();
1983
+ }, (err) => {
1984
+ throwError(err);
1985
+ });
1986
+ }
1987
+ geti18n(translateService, keys) {
1988
+ translateService
1989
+ .getStreamOnTranslationChange(keys)
1990
+ .subscribe((translations) => {
1991
+ this.__i18n = translations;
1992
+ this.__oni18nDataChanged$.next(null);
1993
+ });
1994
+ }
1995
+ }
1996
+ __decorate([
1997
+ MonkeyEcxCoreService({
1998
+ requestInProgress: {
1999
+ showProgress: true
2000
+ }
2001
+ })
2002
+ ], MonkeyEcxCommonsService.prototype, "genericMethod", null);
2003
+
2004
+ /* eslint-disable max-len */
2005
+ class MonkeyEcxHandlingService {
2006
+ constructor() {
2007
+ this.monkeyecxServiceCredentials = null;
2008
+ this.monkeyecxRequestQueue = null;
2009
+ this.monkeyecxRequestDownload = null;
2010
+ this.monkeyecxRequestUpload = null;
2011
+ }
2012
+ clearAll() {
2013
+ this.monkeyecxServiceCredentials = null;
2014
+ this.monkeyecxRequestQueue = null;
2015
+ this.monkeyecxRequestDownload = null;
2016
+ this.monkeyecxRequestUpload = null;
2017
+ }
2018
+ setMonkeyEcxServiceCredentials(param) {
2019
+ this.monkeyecxServiceCredentials = param;
2020
+ }
2021
+ getMonkeyEcxServiceCredentials() {
2022
+ return this.monkeyecxServiceCredentials;
2023
+ }
2024
+ setMonkeyEcxRequestQueue(queue) {
2025
+ this.monkeyecxRequestQueue = queue;
2026
+ }
2027
+ getMonkeyEcxRequestQueue() {
2028
+ return this.monkeyecxRequestQueue;
2029
+ }
2030
+ setMonkeyEcxRequestDownload(download) {
2031
+ this.monkeyecxRequestDownload = download;
2032
+ }
2033
+ getMonkeyEcxRequestDownload() {
2034
+ return this.monkeyecxRequestDownload;
2035
+ }
2036
+ setMonkeyEcxRequestUpload(upload) {
2037
+ this.monkeyecxRequestUpload = upload;
2038
+ }
2039
+ getMonkeyEcxRequestUpload() {
2040
+ return this.monkeyecxRequestUpload;
2041
+ }
2042
+ }
2043
+ MonkeyEcxHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2044
+ MonkeyEcxHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHandlingService, providedIn: 'root' });
2045
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHandlingService, decorators: [{
2046
+ type: Injectable,
2047
+ args: [{
2048
+ providedIn: 'root'
2049
+ }]
2050
+ }] });
2051
+
2052
+ class MonkeyEcxService {
2053
+ constructor(http, monkeyecxHandlingService) {
2054
+ this.http = http;
2055
+ this.monkeyecxHandlingService = monkeyecxHandlingService;
2056
+ // not to do
2057
+ }
2058
+ handlelize(params) {
2059
+ if (!params) {
2060
+ return params;
2061
+ }
2062
+ // eslint-disable-next-line no-restricted-syntax
2063
+ for (const field of [
2064
+ 'createdAt',
2065
+ 'createUserId',
2066
+ 'updatedAt',
2067
+ 'lastUserId',
2068
+ '_links',
2069
+ 'governmentIdType',
2070
+ 'governmentIdMask',
2071
+ 'screenType',
2072
+ 'screenTab'
2073
+ ]) {
2074
+ delete params[field];
2075
+ }
2076
+ return params;
2077
+ }
2078
+ get(url, options) {
2079
+ return this.http.get(url, options);
2080
+ }
2081
+ post(url, params, options) {
2082
+ return this.http.post(url, params, options);
2083
+ }
2084
+ put(url, params) {
2085
+ return this.http.put(url, this.handlelize({
2086
+ ...params
2087
+ }));
2088
+ }
2089
+ delete(url, params) {
2090
+ return this.http.delete(url, params);
2091
+ }
2092
+ download(url, options, filename) {
2093
+ this.http.get(url, options).subscribe((resp) => {
2094
+ const { headers, body } = resp;
2095
+ const contentType = headers.get('Content-Type');
2096
+ const contentDisposition = headers.get('Content-Disposition');
2097
+ if (contentDisposition) {
2098
+ filename = contentDisposition
2099
+ .split(';')[1]
2100
+ .split('filename')[1]
2101
+ .split('=')[1]
2102
+ .trim()
2103
+ .replace(new RegExp(/"/g), '');
2104
+ }
2105
+ const blob = new Blob([body], {
2106
+ type: `${contentType}`
2107
+ });
2108
+ return {
2109
+ filename,
2110
+ blob
2111
+ };
2112
+ }, (err) => {
2113
+ throwError(err);
2114
+ });
2115
+ }
2116
+ downloadOb(url, options, filename) {
2117
+ return this.http.get(url, options).pipe(map((resp) => {
2118
+ const { headers, body } = resp;
2119
+ const contentType = headers.get('Content-Type');
2120
+ const contentDisposition = headers.get('Content-Disposition');
2121
+ if (contentDisposition) {
2122
+ filename = contentDisposition
2123
+ .split(';')[1]
2124
+ .split('filename')[1]
2125
+ .split('=')[1]
2126
+ .trim()
2127
+ .replace(new RegExp(/"/g), '');
2128
+ }
2129
+ const blob = new Blob([body], {
2130
+ type: `${contentType}`
2131
+ });
2132
+ return {
2133
+ filename,
2134
+ blob
2135
+ };
2136
+ }), catchError((err) => {
2137
+ return throwError(err);
2138
+ }));
2139
+ }
2140
+ }
2141
+ 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 });
2142
+ MonkeyEcxService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxService, providedIn: 'root' });
2143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxService, decorators: [{
2144
+ type: Injectable,
2145
+ args: [{
2146
+ providedIn: 'root'
2147
+ }]
2148
+ }], ctorParameters: function () { return [{ type: i1$4.HttpClient }, { type: MonkeyEcxHandlingService }]; } });
2149
+
2150
+ let window$1;
2151
+ const text = {
2152
+ i18n: {
2153
+ title: 'We have an quick update for you',
2154
+ message: 'Click anywhere here to reload your locale',
2155
+ },
2156
+ theme: {
2157
+ title: 'We have an quick update for you',
2158
+ message: 'Click anywhere here to reload your theme',
2159
+ },
2160
+ };
2161
+ class MonkeyEcxErrorConfigService {
2162
+ constructor() {
2163
+ // not to do
2164
+ }
2165
+ enableSupport() {
2166
+ window$1.zE('webWidget', 'updateSettings', {
2167
+ webWidget: {
2168
+ color: {
2169
+ theme: '#0273E8',
2170
+ launcherText: '#fff',
2171
+ header: '#0273E8',
2172
+ button: '#0273E8',
2173
+ },
2174
+ zIndex: 99,
2175
+ offset: {
2176
+ horizontal: '1px',
2177
+ vertical: '20px',
2178
+ },
2179
+ mobile: {
2180
+ labelVisible: true,
2181
+ },
2182
+ launcher: {
2183
+ mobile: {
2184
+ labelVisible: true,
2185
+ },
2186
+ },
2187
+ },
2188
+ });
2189
+ window$1.zE('webWidget', 'setLocale', 'en-US');
2190
+ window$1.zE('webWidget', 'show');
2191
+ }
2192
+ apply(type) {
2193
+ const { title, message } = text?.[type];
2194
+ const element = document.createElement('div');
2195
+ element.id = 'monkeyecx-information';
2196
+ const elementImg = document.createElement('img');
2197
+ elementImg.width = 128;
2198
+ elementImg.src = 'assets/images/monkey.svg';
2199
+ elementImg.style.marginBottom = '50px';
2200
+ const elementTitle = document.createElement('span');
2201
+ elementTitle.id = 'title';
2202
+ elementTitle.innerText = title;
2203
+ elementTitle.style.marginBottom = '20px';
2204
+ const elementMessage = document.createElement('span');
2205
+ elementMessage.id = 'message';
2206
+ elementMessage.innerText = message;
2207
+ elementMessage.style.marginBottom = '20px';
2208
+ const elementChat = document.createElement('span');
2209
+ elementChat.id = 'message';
2210
+ elementChat.innerText =
2211
+ "If you're having trouble to update, please use the support icon bellow";
2212
+ element.appendChild(elementImg);
2213
+ element.appendChild(elementTitle);
2214
+ element.appendChild(elementMessage);
2215
+ element.appendChild(elementChat);
2216
+ element.addEventListener('click', () => {
2217
+ document.location.reload();
2218
+ });
2219
+ document.body.appendChild(element);
2220
+ document.body.getElementsByTagName('app-root')[0].remove();
2221
+ this.enableSupport();
2222
+ }
2223
+ }
2224
+ MonkeyEcxErrorConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxErrorConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2225
+ MonkeyEcxErrorConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxErrorConfigService, providedIn: 'root' });
2226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxErrorConfigService, decorators: [{
2227
+ type: Injectable,
2228
+ args: [{
2229
+ providedIn: 'root',
2230
+ }]
2231
+ }], ctorParameters: function () { return []; } });
2232
+
2233
+ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
2234
+ constructor(monkeyecxService, translateService, monkeyecxCookieStorageService, monkeyecxErrorConfigService) {
2235
+ super(monkeyecxService);
2236
+ this.translateService = translateService;
2237
+ this.monkeyecxCookieStorageService = monkeyecxCookieStorageService;
2238
+ this.monkeyecxErrorConfigService = monkeyecxErrorConfigService;
2239
+ this.translateService.addLangs(['pt-BR', 'en-US']);
2240
+ this.translateService.setDefaultLang('pt-BR');
2241
+ this.translateService.use('pt-BR');
2242
+ }
2243
+ apply(params, environment, change = false) {
2244
+ const { monkeyecxService, monkeyecxCookieStorageService, monkeyecxErrorConfigService } = this;
2245
+ let { i18n } = params;
2246
+ const cookie = monkeyecxCookieStorageService.getCookie('monkey-app-locale');
2247
+ if (cookie && !change) {
2248
+ i18n = JSON.parse(atob(cookie));
2249
+ }
2250
+ else {
2251
+ monkeyecxCookieStorageService.setCookie('monkey-app-locale', btoa(JSON.stringify(i18n)));
2252
+ if (!cookie)
2253
+ change = true;
2254
+ }
2255
+ monkeyecxService?.get(`${environment.localAssets}/i18n/${i18n?.lang}.json`)?.subscribe((config) => {
2256
+ const { lang, data } = config;
2257
+ this.translateService.setTranslation(lang, data, true);
2258
+ this.translateService.use(lang);
2259
+ if (change)
2260
+ document.location.reload();
2261
+ }, (err) => {
2262
+ console.error(`i18n ${i18n?.lang} not found!`);
2263
+ monkeyecxErrorConfigService.apply('i18n');
2264
+ throwError(err);
2265
+ });
2266
+ }
2267
+ }
2268
+ 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 });
2269
+ MonkeyEcxi18nConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxi18nConfigService, providedIn: 'root' });
2270
+ __decorate([
2271
+ MonkeyEcxCoreService({
2272
+ httpResponse: {
2273
+ httpCodeIgnore: [404]
2274
+ },
2275
+ requestInProgress: {
2276
+ showProgress: false
2277
+ }
2278
+ })
2279
+ ], MonkeyEcxi18nConfigService.prototype, "apply", null);
2280
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxi18nConfigService, decorators: [{
2281
+ type: Injectable,
2282
+ args: [{
2283
+ providedIn: 'root'
2284
+ }]
2285
+ }], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: i1$1.TranslateService }, { type: MonkeyEcxCookieStorageService }, { type: MonkeyEcxErrorConfigService }]; }, propDecorators: { apply: [] } });
2286
+
2287
+ class MonkeyEcxLogsConfigService {
2288
+ apply(params, configBoostrap, environment, identifyCode) {
2289
+ const { program, logs } = params;
2290
+ if (logs?.enabled && environment.environment !== 'dev') {
2291
+ datadogRum.init({
2292
+ applicationId: environment?.dataDogApplicationId,
2293
+ clientToken: environment?.dataDogClientToken,
2294
+ service: program?.token,
2295
+ site: 'datadoghq.com',
2296
+ sampleRate: 100,
2297
+ replaySampleRate: 100,
2298
+ env: `monkey-front-${identifyCode}-${environment.environment}`,
2299
+ version: configBoostrap?.version,
2300
+ trackInteractions: true,
2301
+ trackSessionAcrossSubdomains: true,
2302
+ useSecureSessionCookie: true,
2303
+ useCrossSiteSessionCookie: true
2304
+ });
2305
+ datadogRum.startSessionReplayRecording();
2306
+ }
2307
+ }
2308
+ }
2309
+ MonkeyEcxLogsConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLogsConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2310
+ MonkeyEcxLogsConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLogsConfigService, providedIn: 'root' });
2311
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLogsConfigService, decorators: [{
2312
+ type: Injectable,
2313
+ args: [{
2314
+ providedIn: 'root'
2315
+ }]
2316
+ }] });
2317
+
2318
+ class MonkeyEcxServiceWorkerConfigService {
2319
+ constructor(appRef, updates, modalService) {
2320
+ this.appRef = appRef;
2321
+ this.updates = updates;
2322
+ this.modalService = modalService;
2323
+ // not to do
2324
+ }
2325
+ handleValidation(config) {
2326
+ const { updates, modalService } = this;
2327
+ updates?.versionUpdates?.subscribe(() => {
2328
+ if (!config.showNewVersion || config.maintenance.closed) {
2329
+ document.location.reload();
2330
+ }
2331
+ else {
2332
+ modalService.open(VersionChangedComponent, {
2333
+ color: 'theme',
2334
+ size: 'md'
2335
+ });
2336
+ }
2337
+ });
2338
+ }
2339
+ verify() {
2340
+ const { appRef, updates } = this;
2341
+ const appIsStable$ = appRef.isStable
2342
+ .pipe(first((isStable) => { return isStable === true; }));
2343
+ const everyHour$ = interval(1 * 60 * 60 * 1000);
2344
+ const everyHourOnceAppIsStable$ = concat(appIsStable$, everyHour$);
2345
+ everyHourOnceAppIsStable$.subscribe(() => {
2346
+ updates.checkForUpdate();
2347
+ });
2348
+ updates.checkForUpdate();
2349
+ }
2350
+ apply(config) {
2351
+ this.handleValidation(config);
2352
+ this.verify();
2353
+ }
2354
+ }
2355
+ 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 });
2356
+ MonkeyEcxServiceWorkerConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxServiceWorkerConfigService, providedIn: 'root' });
2357
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxServiceWorkerConfigService, decorators: [{
2358
+ type: Injectable,
2359
+ args: [{
2360
+ providedIn: 'root'
2361
+ }]
2362
+ }], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: i1$5.SwUpdate }, { type: i1.MonkeyStyleGuideModalService }]; } });
2363
+
2364
+ /* eslint-disable no-console */
2365
+ class MonkeyEcxSecurityConsoleConfigService extends MonkeyEcxCommonsService {
2366
+ constructor(translateService) {
2367
+ super();
2368
+ this.translateService = translateService;
2369
+ this.geti18n(this.translateService, 'SERVICES.WARNING.CONSOLE');
2370
+ }
2371
+ handleValidation() {
2372
+ this.__oni18nDataChanged$.subscribe(() => {
2373
+ const { __i18n } = this;
2374
+ const title = __i18n?.TITLE;
2375
+ const message = __i18n?.MESSAGE;
2376
+ if (title) {
2377
+ console.log(`%c${title}`, 'background: #f2f061; color: #ff0000; font-size: x-large');
2378
+ console.log(`%c${message}`, 'font-size: x-large');
2379
+ console.log('%c __ __ _ ______ \n ' +
2380
+ '| \\/ | ___ _ __ | | _____ _ _\\ \\ \\ \\ \n ' +
2381
+ "| |\\/| |/ _ \\| '_ \\| |/ / _ \\ | | |\\ \\ \\ \\ \n " +
2382
+ '| | | | (_) | | | | < __/ |_| |/ / / / \n ' +
2383
+ '|_| |_|\\___/|_| |_|_|\\_\\___|\\__, /_/_/_/ \n ' +
2384
+ ' |___/ \n ' +
2385
+ 'Join us: https://monkeyecx.gupy.io', 'background: #1976d2; color: #fff');
2386
+ }
2387
+ });
2388
+ }
2389
+ apply() {
2390
+ this.handleValidation();
2391
+ }
2392
+ }
2393
+ 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 });
2394
+ MonkeyEcxSecurityConsoleConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxSecurityConsoleConfigService, providedIn: 'root' });
2395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxSecurityConsoleConfigService, decorators: [{
2396
+ type: Injectable,
2397
+ args: [{
2398
+ providedIn: 'root'
2399
+ }]
2400
+ }], ctorParameters: function () { return [{ type: i1$1.TranslateService }]; } });
2401
+
2402
+ class MonkeyEcxMaintenanceConfigService {
2403
+ constructor(modalService, router) {
2404
+ this.modalService = modalService;
2405
+ this.router = router;
2406
+ // not to do
2407
+ }
2408
+ handleValidation(config) {
2409
+ if (config.maintenance.closed) {
2410
+ localStorage.clear();
2411
+ this.router.navigate(['']);
2412
+ setTimeout(() => {
2413
+ this.modalService.open(ClosedToMaintenanceComponent, {
2414
+ color: 'theme',
2415
+ size: 'md',
2416
+ data: config
2417
+ });
2418
+ }, 200);
2419
+ }
2420
+ }
2421
+ apply(config) {
2422
+ this.handleValidation(config);
2423
+ }
2424
+ }
2425
+ 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 });
2426
+ MonkeyEcxMaintenanceConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxMaintenanceConfigService, providedIn: 'root' });
2427
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxMaintenanceConfigService, decorators: [{
2428
+ type: Injectable,
2429
+ args: [{
2430
+ providedIn: 'root'
2431
+ }]
2432
+ }], ctorParameters: function () { return [{ type: i1.MonkeyStyleGuideModalService }, { type: i1$3.Router }]; } });
2433
+
2434
+ class MonkeyEcxFeatureToggleService {
2435
+ constructor() {
2436
+ this.flagSubject$ = new BehaviorSubject(null);
2437
+ this.flags = undefined;
2438
+ this.ldClient = undefined;
2439
+ // not to do
2440
+ }
2441
+ getAllFlags() {
2442
+ this.flags = this.ldClient?.allFlags();
2443
+ this.flagSubject$.next(true);
2444
+ }
2445
+ identify(config, environment) {
2446
+ if (config) {
2447
+ const email = 'monkey@monkey.exchange';
2448
+ const user = {
2449
+ email,
2450
+ key: `${config.program?.token}#${email}`
2451
+ };
2452
+ if (!this.ldClient) {
2453
+ this.ldClient = initialize(environment.launchDarklyClientSideID, user, {
2454
+ streaming: true,
2455
+ disableSyncEventPost: true,
2456
+ sendEvents: false,
2457
+ diagnosticOptOut: true
2458
+ });
2459
+ this.ldClient.on('change', this.getAllFlags.bind(this));
2460
+ this.ldClient.on('ready', this.getAllFlags.bind(this));
2461
+ }
2462
+ else {
2463
+ this.ldClient.identify(user, undefined, this.getAllFlags);
2464
+ }
2465
+ }
2466
+ }
2467
+ apply(configSubject$, environment) {
2468
+ if (environment.launchDarklyClientSideID) {
2469
+ configSubject$.subscribe((config) => {
2470
+ this.identify(config, environment);
2471
+ });
2472
+ }
2473
+ else {
2474
+ this.flagSubject$.next(true);
2475
+ }
2476
+ }
2477
+ get onFlags() {
2478
+ return this.flagSubject$.asObservable();
2479
+ }
2480
+ getFlag(flag) {
2481
+ const flagValue = this.flags?.[flag];
2482
+ return MonkeyUtils.persistNullEmptyUndefined(flagValue) ? flagValue : null;
2483
+ }
2484
+ }
2485
+ MonkeyEcxFeatureToggleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFeatureToggleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2486
+ MonkeyEcxFeatureToggleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFeatureToggleService, providedIn: 'root' });
2487
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFeatureToggleService, decorators: [{
2488
+ type: Injectable,
2489
+ args: [{
2490
+ providedIn: 'root'
2491
+ }]
2492
+ }], ctorParameters: function () { return []; } });
2493
+
2494
+ class MonkeyEcxConfigService extends MonkeyEcxCommonsService {
2495
+ constructor(monkeyecxService, monkeyecxi18nConfigService, monkeyecxLogsConfigService, monkeyStyleGuideSettingsService, monkeyecxServiceWorkerConfigService, monkeyecxSecurityConsoleConfigService, monkeyecxMaintenanceConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService) {
2496
+ super(monkeyecxService);
2497
+ this.monkeyecxi18nConfigService = monkeyecxi18nConfigService;
2498
+ this.monkeyecxLogsConfigService = monkeyecxLogsConfigService;
2499
+ this.monkeyStyleGuideSettingsService = monkeyStyleGuideSettingsService;
2500
+ this.monkeyecxServiceWorkerConfigService = monkeyecxServiceWorkerConfigService;
2501
+ this.monkeyecxSecurityConsoleConfigService = monkeyecxSecurityConsoleConfigService;
2502
+ this.monkeyecxMaintenanceConfigService = monkeyecxMaintenanceConfigService;
2503
+ this.monkeyecxErrorConfigService = monkeyecxErrorConfigService;
2504
+ this.monkeyEcxFeatureToggleService = monkeyEcxFeatureToggleService;
2505
+ this.configSubject$ = new BehaviorSubject({});
2506
+ this.configBoostrapSubject$ = new BehaviorSubject({});
2507
+ }
2508
+ internalValidations(...args) {
2509
+ const { monkeyecxServiceWorkerConfigService, monkeyecxSecurityConsoleConfigService, monkeyecxMaintenanceConfigService } = this;
2510
+ const configBoostrap = args[0];
2511
+ const callback = args[1];
2512
+ monkeyecxSecurityConsoleConfigService.apply();
2513
+ monkeyecxServiceWorkerConfigService.apply(configBoostrap);
2514
+ monkeyecxMaintenanceConfigService.apply(configBoostrap);
2515
+ console.log('configBoostrap');
2516
+ console.log(configBoostrap);
2517
+ callback(configBoostrap);
2518
+ }
2519
+ getWhiteLabelSettings(monkeyecxCode, configBoostrap, callback, environment, identifyCode) {
2520
+ const { monkeyecxService, monkeyecxi18nConfigService, configSubject$, monkeyStyleGuideSettingsService, monkeyecxLogsConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService, internalValidations } = this;
2521
+ const url = `${environment.urlAssets}`;
2522
+ monkeyecxService?.get(`${url}/${monkeyecxCode.toLowerCase()}/white-label.json`)?.subscribe((config) => {
2523
+ monkeyecxi18nConfigService.apply(config, environment);
2524
+ monkeyecxLogsConfigService.apply(config, configBoostrap, environment, identifyCode);
2525
+ monkeyEcxFeatureToggleService.apply(configSubject$, environment);
2526
+ monkeyStyleGuideSettingsService.boostrap(`${url}/${monkeyecxCode.toLowerCase()}/monkey-style-guide-settings.json`, internalValidations.bind(this, configBoostrap, callback, environment));
2527
+ configSubject$.next(config);
2528
+ }, (err) => {
2529
+ monkeyecxErrorConfigService.apply('theme');
2530
+ console.error('Program Configuration not found!');
2531
+ throwError(err);
2532
+ });
2533
+ }
2534
+ init(callback, environment, identifyCode, monkeyecxCode) {
2535
+ const { monkeyecxService, configBoostrapSubject$, monkeyecxErrorConfigService } = this;
2536
+ monkeyecxService?.get(`${environment.boostrapAssets}?t=${MonkeyUtils.getRandomString(30)}`, {
2537
+ observe: 'response'
2538
+ })?.subscribe((resp) => {
2539
+ const { headers, body } = resp;
2540
+ const monkeyCode = headers.get('monkey-code') || monkeyecxCode;
2541
+ if (monkeyCode) {
2542
+ this.getWhiteLabelSettings(monkeyCode, body, callback, environment, identifyCode);
2543
+ configBoostrapSubject$.next(body);
2544
+ }
2545
+ else {
2546
+ monkeyecxErrorConfigService.apply('theme');
2547
+ console.error(`Boostrap ${monkeyCode} Configuration not found!`);
2548
+ }
2549
+ }, (err) => {
2550
+ monkeyecxErrorConfigService.apply('theme');
2551
+ console.error('Boostrap Configuration not found!');
2552
+ throwError(err);
2553
+ });
2554
+ }
2555
+ config() {
2556
+ return this.configSubject$.asObservable();
2557
+ }
2558
+ boostrapConfig() {
2559
+ return this.configBoostrapSubject$.asObservable();
2560
+ }
2561
+ }
2562
+ 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 });
2563
+ MonkeyEcxConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigService, providedIn: 'root' });
2564
+ __decorate([
2565
+ MonkeyEcxCoreService({
2566
+ httpResponse: {
2567
+ httpCodeIgnore: [404]
2568
+ },
2569
+ requestInProgress: {
2570
+ showProgress: false
2571
+ }
2572
+ })
2573
+ ], MonkeyEcxConfigService.prototype, "init", null);
2574
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigService, decorators: [{
2575
+ type: Injectable,
2576
+ args: [{
2577
+ providedIn: 'root'
2578
+ }]
2579
+ }], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxi18nConfigService }, { type: MonkeyEcxLogsConfigService }, { type: i1.MonkeyStyleGuideSettingsService }, { type: MonkeyEcxServiceWorkerConfigService }, { type: MonkeyEcxSecurityConsoleConfigService }, { type: MonkeyEcxMaintenanceConfigService }, { type: MonkeyEcxErrorConfigService }, { type: MonkeyEcxFeatureToggleService }]; }, propDecorators: { init: [] } });
2580
+
2581
+ class MonkeyEcxTokenStorageService {
2582
+ constructor(monkeyecxConfigService) {
2583
+ this.monkeyecxConfigService = monkeyecxConfigService;
2584
+ this.config = null;
2585
+ this.token = {
2586
+ username: '',
2587
+ program: '',
2588
+ accessToken: '',
2589
+ refreshToken: '',
2590
+ companyId: '',
2591
+ governmentId: '',
2592
+ companyTypeUrl: '',
2593
+ companyType: '',
2594
+ programAdmin: false,
2595
+ programType: '',
2596
+ role: '',
2597
+ _clearIgnore: {
2598
+ ignore: ['username', 'program']
2599
+ }
2600
+ };
2601
+ this.token$ = new BehaviorSubject(null);
2602
+ this.me$ = new BehaviorSubject(null);
2603
+ this.monkeyecxConfigService.config().subscribe((_) => {
2604
+ this.config = _;
2605
+ });
2606
+ }
2607
+ setAllTokens(token) {
2608
+ const { token$ } = this;
2609
+ Object.entries(token).forEach(([key, value]) => {
2610
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(value)) {
2611
+ localStorage.setItem(key, value);
2612
+ }
2613
+ });
2614
+ token$.next(token);
2615
+ }
2616
+ getAllTokens() {
2617
+ const { token, config } = this;
2618
+ const handledToken = {
2619
+ ...token
2620
+ };
2621
+ Object.entries(token || {}).forEach(([key, value]) => {
2622
+ handledToken[key] = localStorage.getItem(key);
2623
+ });
2624
+ if (config?.program) {
2625
+ handledToken.program = config?.program?.token;
2626
+ }
2627
+ return handledToken;
2628
+ }
2629
+ setAllMe(me) {
2630
+ const { me$ } = this;
2631
+ let previousMe = JSON.parse(localStorage?.getItem('me') || '');
2632
+ Object.entries(me).forEach(([key, value]) => {
2633
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(value)) {
2634
+ previousMe = {
2635
+ ...previousMe,
2636
+ [key]: value
2637
+ };
2638
+ }
2639
+ });
2640
+ localStorage.setItem('me', JSON.stringify(previousMe));
2641
+ me$.next(previousMe);
2642
+ }
2643
+ getAllMe() {
2644
+ const me = localStorage.getItem('me');
2645
+ return JSON.parse(me || '');
2646
+ }
2647
+ tokenHasChanged() {
2648
+ return this.token$.asObservable();
2649
+ }
2650
+ meHasChanged() {
2651
+ return this.me$.asObservable() || null;
2652
+ }
2653
+ getToken() {
2654
+ return this.getAllTokens();
2655
+ }
2656
+ getMe() {
2657
+ return this.getAllMe();
2658
+ }
2659
+ setToken(token) {
2660
+ this.setAllTokens(token);
2661
+ }
2662
+ setMe(me) {
2663
+ this.setAllMe(me);
2664
+ }
2665
+ clear(force) {
2666
+ const { token } = this;
2667
+ try {
2668
+ Object.entries(token || {}).forEach(([key, value]) => {
2669
+ if ((token?._clearIgnore?.ignore || []).filter((val) => {
2670
+ return val === key;
2671
+ }).length <= 0 ||
2672
+ force === true) {
2673
+ localStorage.removeItem(key);
2674
+ }
2675
+ });
2676
+ localStorage.removeItem('me');
2677
+ }
2678
+ catch (error) {
2679
+ return of(false);
2680
+ }
2681
+ return of(true);
2682
+ }
2683
+ /**
2684
+ * @param fields (the name of fields you want to clear. ie: ['companyId', 'role', ...])
2685
+ */
2686
+ clearCredentials(fields = ['companyId', 'governmentId', 'companyType', 'programAdmin', 'role']) {
2687
+ fields?.forEach((key) => {
2688
+ localStorage.removeItem(key);
2689
+ });
2690
+ }
2691
+ }
2692
+ MonkeyEcxTokenStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxTokenStorageService, deps: [{ token: MonkeyEcxConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
2693
+ MonkeyEcxTokenStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxTokenStorageService, providedIn: 'root' });
2694
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxTokenStorageService, decorators: [{
2695
+ type: Injectable,
2696
+ args: [{
2697
+ providedIn: 'root'
2698
+ }]
2699
+ }], ctorParameters: function () { return [{ type: MonkeyEcxConfigService }]; } });
2700
+
2701
+ class MonkeyEcxSecurityDirective {
2702
+ constructor(elementRef, tokenStorageService, cdr) {
2703
+ this.elementRef = elementRef;
2704
+ this.tokenStorageService = tokenStorageService;
2705
+ this.cdr = cdr;
2706
+ this.roles = null;
2707
+ this.byExclusion = false;
2708
+ this.tokenCredentials = null;
2709
+ // not to do
2710
+ }
2711
+ getRole() {
2712
+ const { tokenCredentials } = this;
2713
+ if (!tokenCredentials)
2714
+ return '';
2715
+ if (tokenCredentials?.programAdmin === 'true') {
2716
+ return 'PROGRAM_ADMIN';
2717
+ }
2718
+ return tokenCredentials?.role || '';
2719
+ }
2720
+ handleAccess() {
2721
+ const { roles, byExclusion } = this;
2722
+ let display = 'none';
2723
+ const found = roles?.indexOf(this.getRole()) || -1;
2724
+ if (byExclusion) {
2725
+ display = 'block';
2726
+ if (found > -1) {
2727
+ display = 'none';
2728
+ }
2729
+ }
2730
+ else {
2731
+ display = 'none';
2732
+ if (found > -1) {
2733
+ display = 'block';
2734
+ }
2735
+ }
2736
+ if (!roles || roles.length === 0 || this.getRole() === 'PROGRAM_ADMIN')
2737
+ display = 'block';
2738
+ this.elementRef.nativeElement.style.display = display;
2739
+ this.cdr.detectChanges();
2740
+ }
2741
+ ngOnInit() {
2742
+ this.elementRef.nativeElement.style.display = 'none';
2743
+ this.cdr.detectChanges();
2744
+ this.tokenStorageService.tokenHasChanged().subscribe(() => {
2745
+ this.tokenCredentials = this.tokenStorageService.getToken();
2746
+ this.handleAccess();
2747
+ });
2748
+ this.tokenCredentials = this.tokenStorageService.getToken();
2749
+ this.handleAccess();
2750
+ }
2751
+ }
2752
+ 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 });
2753
+ 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 });
2754
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxSecurityDirective, decorators: [{
2755
+ type: Directive,
2756
+ args: [{
2757
+ selector: '[monkeyecxSecurity]',
2758
+ }]
2759
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MonkeyEcxTokenStorageService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { roles: [{
2760
+ type: Input,
2761
+ args: ['securityRoles']
2762
+ }], byExclusion: [{
2763
+ type: Input,
2764
+ args: ['securityByExclusion']
2765
+ }] } });
2766
+
2767
+ class MonkeyEcxTooltipDirective {
2768
+ constructor(el, renderer) {
2769
+ this.el = el;
2770
+ this.renderer = renderer;
2771
+ this.enableToShow = true;
2772
+ this.offset = 10;
2773
+ this.tooltip = null;
2774
+ // not to do
2775
+ }
2776
+ onMouseEnter() {
2777
+ if (!this.tooltip) {
2778
+ this.show();
2779
+ }
2780
+ }
2781
+ onMouseLeave() {
2782
+ if (this.tooltip) {
2783
+ this.hide();
2784
+ }
2785
+ }
2786
+ clickout() {
2787
+ if (this.tooltip) {
2788
+ this.hide();
2789
+ }
2790
+ }
2791
+ show() {
2792
+ if (this.enableToShow) {
2793
+ this.create();
2794
+ this.setPosition();
2795
+ this.renderer.addClass(this.tooltip, 'monkeyecx-tooltip-show');
2796
+ setTimeout(() => {
2797
+ this.hide();
2798
+ }, 5000);
2799
+ }
2800
+ }
2801
+ hide() {
2802
+ if (!this.tooltip)
2803
+ return;
2804
+ this.renderer.removeClass(this.tooltip, 'monkeyecx-tooltip-show');
2805
+ this.renderer.removeChild(document.body, this.tooltip);
2806
+ this.tooltip = null;
2807
+ }
2808
+ create() {
2809
+ const tooltipElement = document.createElement('div');
2810
+ this.tooltip = this.renderer.createElement('span');
2811
+ if (this.tooltipTitle) {
2812
+ const tooltipTitleElement = document.createElement('span');
2813
+ tooltipTitleElement.innerText = `${this.tooltipTitle}`;
2814
+ tooltipTitleElement.className = 'monkeyecx-tooltip-title';
2815
+ tooltipElement.appendChild(tooltipTitleElement);
2816
+ }
2817
+ if (this.tooltipText) {
2818
+ const tooltipTextElement = document.createElement('span');
2819
+ tooltipTextElement.innerText = `${this.tooltipText}`;
2820
+ tooltipTextElement.className = 'monkeyecx-tooltip-description';
2821
+ tooltipElement.appendChild(tooltipTextElement);
2822
+ }
2823
+ this.renderer.appendChild(this.tooltip, tooltipElement);
2824
+ this.renderer.appendChild(document.body, this.tooltip);
2825
+ this.renderer.addClass(this.tooltip, 'monkeyecx-tooltip');
2826
+ this.renderer.addClass(this.tooltip, `monkeyecx-tooltip-${this.tooltipPosition}`);
2827
+ this.renderer.setStyle(this.tooltip, '-webkit-transition', `opacity ${this.tooltipDelay}ms`);
2828
+ this.renderer.setStyle(this.tooltip, '-moz-transition', `opacity ${this.tooltipDelay}ms`);
2829
+ this.renderer.setStyle(this.tooltip, '-o-transition', `opacity ${this.tooltipDelay}ms`);
2830
+ this.renderer.setStyle(this.tooltip, 'transition', `opacity ${this.tooltipDelay}ms`);
2831
+ }
2832
+ setPosition() {
2833
+ const hostPos = this.el.nativeElement.getBoundingClientRect();
2834
+ const tooltipPos = this.tooltip?.getBoundingClientRect();
2835
+ if (!tooltipPos)
2836
+ return;
2837
+ const scrollPos = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
2838
+ let top = 0;
2839
+ let left = 0;
2840
+ if (this.tooltipPosition === 'top') {
2841
+ top = hostPos.top - tooltipPos.height - this.offset;
2842
+ left = hostPos.left + (hostPos.width - tooltipPos.width) / 2;
2843
+ }
2844
+ if (this.tooltipPosition === 'bottom') {
2845
+ top = hostPos.bottom + this.offset;
2846
+ left = hostPos.left + (hostPos.width - tooltipPos.width) / 2;
2847
+ }
2848
+ if (this.tooltipPosition === 'left') {
2849
+ top = hostPos.top + (hostPos.height - tooltipPos.height) / 2;
2850
+ left = hostPos.left - tooltipPos.width - this.offset;
2851
+ }
2852
+ if (this.tooltipPosition === 'right') {
2853
+ top = hostPos.top + (hostPos.height - tooltipPos.height) / 2;
2854
+ left = hostPos.right + this.offset;
2855
+ }
2856
+ this.renderer.setStyle(this.tooltip, 'top', `${top + scrollPos}px`);
2857
+ this.renderer.setStyle(this.tooltip, 'left', `${left}px`);
2858
+ }
2859
+ }
2860
+ 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 });
2861
+ 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 });
2862
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxTooltipDirective, decorators: [{
2863
+ type: Directive,
2864
+ args: [{
2865
+ selector: '[monkeyecxTooltip]',
2866
+ }]
2867
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { tooltipDelay: [{
2868
+ type: Input
2869
+ }], tooltipPosition: [{
2870
+ type: Input
2871
+ }], tooltipText: [{
2872
+ type: Input
2873
+ }], tooltipTitle: [{
2874
+ type: Input
2875
+ }], enableToShow: [{
2876
+ type: Input
2877
+ }], onMouseEnter: [{
2878
+ type: HostListener,
2879
+ args: ['mouseenter']
2880
+ }], onMouseLeave: [{
2881
+ type: HostListener,
2882
+ args: ['mouseleave']
2883
+ }], clickout: [{
2884
+ type: HostListener,
2885
+ args: ['click']
2886
+ }] } });
2887
+
2888
+ class MonkeyEcxFeatureDirective {
2889
+ constructor(cdr, elementRef, monkeyecxFeatureToggleService) {
2890
+ this.cdr = cdr;
2891
+ this.elementRef = elementRef;
2892
+ this.monkeyecxFeatureToggleService = monkeyecxFeatureToggleService;
2893
+ this.unsubscribeAll = new Subject();
2894
+ // not to do
2895
+ }
2896
+ getFeature(feature) {
2897
+ const { monkeyecxFeatureToggleService } = this;
2898
+ if (!monkeyecxFeatureToggleService) {
2899
+ return false;
2900
+ }
2901
+ return monkeyecxFeatureToggleService?.getFlag(feature) || false;
2902
+ }
2903
+ handleDisplay() {
2904
+ if (!this.feature)
2905
+ return;
2906
+ const flag = this.getFeature(this.feature);
2907
+ let display = 'none';
2908
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(flag)) {
2909
+ return;
2910
+ }
2911
+ if (flag) {
2912
+ display = 'block';
2913
+ }
2914
+ if (display === 'none') {
2915
+ this.elementRef.nativeElement.remove();
2916
+ }
2917
+ this.elementRef.nativeElement.style.display = display;
2918
+ this.cdr.detectChanges();
2919
+ }
2920
+ ngOnDestroy() {
2921
+ this.unsubscribeAll.next();
2922
+ this.unsubscribeAll.complete();
2923
+ }
2924
+ ngOnInit() {
2925
+ if (!this.feature)
2926
+ return;
2927
+ this.elementRef.nativeElement.style.display = 'none';
2928
+ this.cdr.detectChanges();
2929
+ this.monkeyecxFeatureToggleService.onFlags
2930
+ .pipe(takeUntil(this.unsubscribeAll))
2931
+ .subscribe((val) => {
2932
+ if (val) {
2933
+ this.handleDisplay();
2934
+ }
2935
+ });
2936
+ }
2937
+ }
2938
+ 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 });
2939
+ MonkeyEcxFeatureDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: MonkeyEcxFeatureDirective, selector: "[monkeyecxFeature]", inputs: { feature: ["featureName", "feature"] }, ngImport: i0 });
2940
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFeatureDirective, decorators: [{
2941
+ type: Directive,
2942
+ args: [{
2943
+ selector: '[monkeyecxFeature]',
2944
+ }]
2945
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: MonkeyEcxFeatureToggleService }]; }, propDecorators: { feature: [{
2946
+ type: Input,
2947
+ args: ['featureName']
2948
+ }] } });
2949
+
2950
+ class MonkeyEcxDirectivesModule {
2951
+ }
2952
+ MonkeyEcxDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2953
+ MonkeyEcxDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDirectivesModule, declarations: [MonkeyEcxDragDropDirective,
2954
+ MonkeyEcxFormatCurrency,
2955
+ MonkeyEcxFeatureDirective,
2956
+ MonkeyEcxFormatUpper,
2957
+ MonkeyEcxOnlyAlphaNumericDirective,
2958
+ MonkeyEcxOnlyNumbersDirective,
2959
+ MonkeyEcxSecurityDirective,
2960
+ MonkeyEcxTooltipDirective], exports: [MonkeyEcxDragDropDirective,
2961
+ MonkeyEcxFormatCurrency,
2962
+ MonkeyEcxFeatureDirective,
2963
+ MonkeyEcxFormatUpper,
2964
+ MonkeyEcxOnlyAlphaNumericDirective,
2965
+ MonkeyEcxOnlyNumbersDirective,
2966
+ MonkeyEcxSecurityDirective,
2967
+ MonkeyEcxTooltipDirective] });
2968
+ MonkeyEcxDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDirectivesModule });
2969
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDirectivesModule, decorators: [{
2970
+ type: NgModule,
2971
+ args: [{
2972
+ declarations: [
2973
+ MonkeyEcxDragDropDirective,
2974
+ MonkeyEcxFormatCurrency,
2975
+ MonkeyEcxFeatureDirective,
2976
+ MonkeyEcxFormatUpper,
2977
+ MonkeyEcxOnlyAlphaNumericDirective,
2978
+ MonkeyEcxOnlyNumbersDirective,
2979
+ MonkeyEcxSecurityDirective,
2980
+ MonkeyEcxTooltipDirective
2981
+ ],
2982
+ exports: [
2983
+ MonkeyEcxDragDropDirective,
2984
+ MonkeyEcxFormatCurrency,
2985
+ MonkeyEcxFeatureDirective,
2986
+ MonkeyEcxFormatUpper,
2987
+ MonkeyEcxOnlyAlphaNumericDirective,
2988
+ MonkeyEcxOnlyNumbersDirective,
2989
+ MonkeyEcxSecurityDirective,
2990
+ MonkeyEcxTooltipDirective
2991
+ ]
2992
+ }]
2993
+ }] });
2994
+
2995
+ /* eslint-disable no-console */
2996
+ class MonkeyEcxAuthenticationService {
2997
+ constructor() {
2998
+ this.hadAtLeastOneLogin = () => {
2999
+ console.error('hadAtLeastOneLogin needs to be declared!');
3000
+ return null;
3001
+ };
3002
+ this.redirectApp = () => {
3003
+ console.error('redirectApp needs to be declared!');
3004
+ return null;
3005
+ };
3006
+ this.redirectLoginWelcomeBack = () => {
3007
+ console.error('redirectLoginWelcomeBack needs to be declared!');
3008
+ return null;
3009
+ };
3010
+ this.isAuthorized = () => {
3011
+ console.error('isAuthorized needs to be declared!');
3012
+ return false;
3013
+ };
3014
+ this.getRequestWithHeaders = (request) => {
3015
+ console.error('getRequestWithHeaders needs to be declared!');
3016
+ return null;
3017
+ };
3018
+ this.getRequestWithHeadersOb = (request) => {
3019
+ console.error('getRequestWithHeadersOb needs to be declared!');
3020
+ return null;
3021
+ };
3022
+ this.refreshShouldHappen = (response) => {
3023
+ console.error('refreshShouldHappen needs to be declared!');
3024
+ return false;
3025
+ };
3026
+ this.refreshToken = () => {
3027
+ console.error('refreshToken needs to be declared!');
3028
+ return null;
3029
+ };
3030
+ // not to do
3031
+ }
3032
+ init(args) {
3033
+ this.hadAtLeastOneLogin = args?.hadAtLeastOneLogin || this.hadAtLeastOneLogin.bind(this);
3034
+ this.redirectApp = args?.redirectApp || this.redirectApp.bind(this);
3035
+ this.redirectLoginWelcomeBack = args?.redirectLoginWelcomeBack ||
3036
+ this.redirectLoginWelcomeBack.bind(this);
3037
+ this.isAuthorized = args?.isAuthorized || this.isAuthorized.bind(this);
3038
+ this.getRequestWithHeaders = args?.getRequestWithHeaders ||
3039
+ this.getRequestWithHeaders.bind(this);
3040
+ this.getRequestWithHeadersOb = args?.getRequestWithHeadersOb.bind(this);
3041
+ this.refreshShouldHappen = args?.refreshShouldHappen || this.refreshShouldHappen.bind(this);
3042
+ this.refreshToken = args?.refreshToken || this.refreshToken.bind(this);
3043
+ }
3044
+ }
3045
+ MonkeyEcxAuthenticationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxAuthenticationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3046
+ MonkeyEcxAuthenticationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxAuthenticationService, providedIn: 'root' });
3047
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxAuthenticationService, decorators: [{
3048
+ type: Injectable,
3049
+ args: [{
3050
+ providedIn: 'root'
3051
+ }]
3052
+ }], ctorParameters: function () { return []; } });
3053
+
3054
+ class MonkeyEcxAuthGuardLogin {
3055
+ constructor(monkeyecxAuthenticationService) {
3056
+ this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
3057
+ // not to do
3058
+ }
3059
+ canActivate() {
3060
+ if (this.monkeyecxAuthenticationService.isAuthorized()) {
3061
+ this.monkeyecxAuthenticationService.redirectApp();
3062
+ return false;
3063
+ }
3064
+ if (this.monkeyecxAuthenticationService.hadAtLeastOneLogin()) {
3065
+ this.monkeyecxAuthenticationService.redirectLoginWelcomeBack();
3066
+ return false;
3067
+ }
3068
+ return true;
3069
+ }
3070
+ }
3071
+ MonkeyEcxAuthGuardLogin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxAuthGuardLogin, deps: [{ token: MonkeyEcxAuthenticationService }], target: i0.ɵɵFactoryTarget.Injectable });
3072
+ MonkeyEcxAuthGuardLogin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxAuthGuardLogin, providedIn: 'root' });
3073
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxAuthGuardLogin, decorators: [{
3074
+ type: Injectable,
3075
+ args: [{
3076
+ providedIn: 'root'
3077
+ }]
3078
+ }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }]; } });
3079
+
3080
+ class MonkeyEcxAuthGuard {
3081
+ constructor(monkeyecxAuthenticationService) {
3082
+ this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
3083
+ // not to do
3084
+ }
3085
+ canActivate() {
3086
+ const { monkeyecxAuthenticationService } = this;
3087
+ if (monkeyecxAuthenticationService.isAuthorized()) {
3088
+ return true;
3089
+ }
3090
+ monkeyecxAuthenticationService.redirectLoginWelcomeBack();
3091
+ return false;
3092
+ }
3093
+ }
3094
+ MonkeyEcxAuthGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxAuthGuard, deps: [{ token: MonkeyEcxAuthenticationService }], target: i0.ɵɵFactoryTarget.Injectable });
3095
+ MonkeyEcxAuthGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxAuthGuard, providedIn: 'root' });
3096
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxAuthGuard, decorators: [{
3097
+ type: Injectable,
3098
+ args: [{
3099
+ providedIn: 'root'
3100
+ }]
3101
+ }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }]; } });
3102
+
3103
+ class MonkeyEcxHttpErrorHandlingService extends MonkeyEcxCommonsService {
3104
+ constructor(monkeyecxService, tokenStorage, monkeyecxAuthenticationService, router, snackbarService, translateService) {
3105
+ super(monkeyecxService, tokenStorage);
3106
+ this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
3107
+ this.router = router;
3108
+ this.snackbarService = snackbarService;
3109
+ this.translateService = translateService;
3110
+ super.resolve(null, null);
3111
+ this.geti18n(this.translateService, 'SERVICES.WARNING');
3112
+ }
3113
+ isHttpCodeIgnoreMessage(tp, httpCode) {
3114
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(tp) && !tp?.httpResponse) {
3115
+ return false;
3116
+ }
3117
+ const found = (tp?.httpResponse?.httpCodeIgnore || [])?.indexOf(httpCode) > -1;
3118
+ return found;
3119
+ }
3120
+ isHttpCodeIgnoreRedirect(tp, httpCode) {
3121
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(tp) && !tp?.httpResponse) {
3122
+ return false;
3123
+ }
3124
+ const found = (tp?.httpResponse?.httpCodeIgnoreRedirect || [])?.indexOf(httpCode) > -1;
3125
+ return found;
3126
+ }
3127
+ getMessageType(status) {
3128
+ if (status === 409 || status === 400) {
3129
+ return 'warning';
3130
+ }
3131
+ return 'error';
3132
+ }
3133
+ showMessage(message, error, mkc) {
3134
+ const { snackbarService } = this;
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
+ console.log('sCredentials');
3260
+ console.log(sCredentials);
3261
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(type) && type === 'refresh_token') {
3262
+ httpErrorHandlingService.handleErrorRefreshToken(error, sCredentials);
3263
+ }
3264
+ else
3265
+ httpErrorHandlingService.handleError(error, sCredentials);
3266
+ }
3267
+ else {
3268
+ othersErrorsHandlingService.handleError(error);
3269
+ }
3270
+ }
3271
+ }
3272
+ MonkeyEcxErrorHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxErrorHandlingService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
3273
+ MonkeyEcxErrorHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxErrorHandlingService, providedIn: 'root' });
3274
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxErrorHandlingService, decorators: [{
3275
+ type: Injectable,
3276
+ args: [{
3277
+ providedIn: 'root'
3278
+ }]
3279
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
3280
+
3281
+ class MonkeyEcxErrorHandlingModule {
3282
+ static forRoot() {
3283
+ return {
3284
+ ngModule: MonkeyEcxErrorHandlingModule,
3285
+ providers: [
3286
+ {
3287
+ provide: ErrorHandler,
3288
+ useClass: MonkeyEcxErrorHandlingService
3289
+ }
3290
+ ]
3291
+ };
3292
+ }
3293
+ }
3294
+ MonkeyEcxErrorHandlingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxErrorHandlingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3295
+ MonkeyEcxErrorHandlingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxErrorHandlingModule, imports: [CommonModule] });
3296
+ MonkeyEcxErrorHandlingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxErrorHandlingModule, imports: [[CommonModule]] });
3297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxErrorHandlingModule, decorators: [{
3298
+ type: NgModule,
3299
+ args: [{
3300
+ imports: [CommonModule]
3301
+ }]
3302
+ }] });
3303
+
3304
+ class MonkeyEcxHttpConfigErrorInterceptor {
3305
+ constructor(monkeyecxAuthenticationService, monkeyecxErrorHandlingService) {
3306
+ this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
3307
+ this.monkeyecxErrorHandlingService = monkeyecxErrorHandlingService;
3308
+ // no to do
3309
+ }
3310
+ intercept(request, next) {
3311
+ return next.handle(request).pipe(map((event) => {
3312
+ return event;
3313
+ }), catchError((error) => {
3314
+ if (this.monkeyecxAuthenticationService.refreshShouldHappen(error)) {
3315
+ return this.monkeyecxAuthenticationService?.refreshToken()?.pipe(take(1), map(() => {
3316
+ return this.monkeyecxAuthenticationService.getRequestWithHeaders(request);
3317
+ }), mergeMap((resp) => {
3318
+ return next.handle(resp).pipe(catchError((error) => {
3319
+ this.monkeyecxErrorHandlingService.handleError(error, 'refresh_token');
3320
+ return throwError(null);
3321
+ }));
3322
+ }), catchError((error) => {
3323
+ this.monkeyecxErrorHandlingService.handleError(error, 'refresh_token');
3324
+ return throwError(null);
3325
+ })) || throwError(error);
3326
+ }
3327
+ return throwError(error);
3328
+ }));
3329
+ }
3330
+ }
3331
+ 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 });
3332
+ MonkeyEcxHttpConfigErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigErrorInterceptor });
3333
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigErrorInterceptor, decorators: [{
3334
+ type: Injectable
3335
+ }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }, { type: MonkeyEcxErrorHandlingService }]; } });
3336
+
3337
+ class MonkeyEcxHttpConfigHeaderInterceptor {
3338
+ constructor(monkeyecxAuthenticationService, monkeyecxErrorHandlingService) {
3339
+ this.monkeyecxAuthenticationService = monkeyecxAuthenticationService;
3340
+ this.monkeyecxErrorHandlingService = monkeyecxErrorHandlingService;
3341
+ // not to do
3342
+ }
3343
+ intercept(request, next) {
3344
+ return this.monkeyecxAuthenticationService?.getRequestWithHeadersOb(request)?.pipe(take(1), map((event) => {
3345
+ return event;
3346
+ }), mergeMap((resp) => {
3347
+ request = request.clone({
3348
+ setHeaders: resp
3349
+ });
3350
+ return next.handle(request);
3351
+ }), catchError((error) => {
3352
+ this.monkeyecxErrorHandlingService.handleError(error);
3353
+ return throwError(error);
3354
+ })) || throwError('getRequestWithHeadersOb undefined');
3355
+ }
3356
+ }
3357
+ 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 });
3358
+ MonkeyEcxHttpConfigHeaderInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor });
3359
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor, decorators: [{
3360
+ type: Injectable
3361
+ }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }, { type: MonkeyEcxErrorHandlingService }]; } });
3362
+
3363
+ class MonkeyEcxRequestQueueHandlingService {
3364
+ constructor() {
3365
+ this.queue = [];
3366
+ this.newQueue = new BehaviorSubject(false);
3367
+ this.queues$ = new BehaviorSubject([]);
3368
+ }
3369
+ addToQueue(q) {
3370
+ this.queue.push(q);
3371
+ this.queues$.next(this.queue);
3372
+ this.newQueue.next(true);
3373
+ }
3374
+ markQueueItemAsFinish(q, status, action) {
3375
+ const saved = [...this.queue];
3376
+ this.queue = [
3377
+ ...saved.map((val) => {
3378
+ const valSaved = {
3379
+ ...val
3380
+ };
3381
+ if (val.status === MonkeyEcxQueueEvents.OnGoing) {
3382
+ if (valSaved.item.id === q.item.id) {
3383
+ return {
3384
+ ...valSaved,
3385
+ status: status || MonkeyEcxQueueEvents.Finished,
3386
+ action
3387
+ };
3388
+ }
3389
+ }
3390
+ return valSaved;
3391
+ })
3392
+ ];
3393
+ this.queues$.next(this.queue);
3394
+ }
3395
+ updateQueue(q, progress) {
3396
+ const saved = [...this.queue];
3397
+ this.queue = [
3398
+ ...saved.map((val) => {
3399
+ const valSaved = {
3400
+ ...val
3401
+ };
3402
+ const { total, loaded } = progress;
3403
+ const currentPecentage = Math.floor(((loaded || 0) / (total || 0)) * 100);
3404
+ const totalPercentage = 100;
3405
+ if (valSaved.item.id === q.item.id) {
3406
+ return {
3407
+ ...valSaved,
3408
+ progress: {
3409
+ loaded,
3410
+ total,
3411
+ currentPercentage: currentPecentage,
3412
+ totalPercentage
3413
+ }
3414
+ };
3415
+ }
3416
+ return valSaved;
3417
+ })
3418
+ ];
3419
+ this.queues$.next(this.queue);
3420
+ }
3421
+ deleteQueue(q) {
3422
+ const saved = [...this.queue];
3423
+ this.queue = [
3424
+ ...saved.map((val) => {
3425
+ const valSaved = {
3426
+ ...val
3427
+ };
3428
+ if (valSaved.item.id === q.item.id) {
3429
+ return null;
3430
+ }
3431
+ return valSaved;
3432
+ })
3433
+ ].filter((_) => {
3434
+ return _;
3435
+ });
3436
+ this.queues$.next(this.queue);
3437
+ }
3438
+ setQueue(q) {
3439
+ if (!q)
3440
+ return;
3441
+ this.addToQueue(q);
3442
+ }
3443
+ getQueue() {
3444
+ return this.queues$.asObservable();
3445
+ }
3446
+ finishQueueItem(q, action, status) {
3447
+ if (!q)
3448
+ return;
3449
+ this.markQueueItemAsFinish(q, status, action);
3450
+ }
3451
+ removeQueueItem(q) {
3452
+ this.deleteQueue(q);
3453
+ }
3454
+ updateQueueItem(q, progress) {
3455
+ this.updateQueue(q, progress);
3456
+ }
3457
+ hasNewQueue() {
3458
+ return this.newQueue.pipe(map((_) => {
3459
+ return _;
3460
+ }));
3461
+ }
3462
+ }
3463
+ MonkeyEcxRequestQueueHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestQueueHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3464
+ MonkeyEcxRequestQueueHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestQueueHandlingService, providedIn: 'root' });
3465
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestQueueHandlingService, decorators: [{
3466
+ type: Injectable,
3467
+ args: [{
3468
+ providedIn: 'root'
3469
+ }]
3470
+ }], ctorParameters: function () { return []; } });
3471
+
3472
+ class MonkeyEcxRequestQueueModalHandlingService {
3473
+ constructor() {
3474
+ this.queue = [];
3475
+ this.newQueue$ = new BehaviorSubject(false);
3476
+ this.allQueueFinished$ = new BehaviorSubject(false);
3477
+ this.queues$ = new BehaviorSubject([]);
3478
+ }
3479
+ addToQueue(q) {
3480
+ this.queue.push(q);
3481
+ this.queues$.next(this.queue);
3482
+ this.newQueue$.next(true);
3483
+ }
3484
+ markQueueItemAsFinish(q, status, action) {
3485
+ const saved = [...this.queue];
3486
+ this.queue = [
3487
+ ...saved.map((val) => {
3488
+ const valSaved = {
3489
+ ...val
3490
+ };
3491
+ if (val.status === MonkeyEcxQueueEvents.OnGoing) {
3492
+ if (valSaved.item.id === q.item.id) {
3493
+ return {
3494
+ ...valSaved,
3495
+ status: status || MonkeyEcxQueueEvents.Finished,
3496
+ action
3497
+ };
3498
+ }
3499
+ }
3500
+ return valSaved;
3501
+ })
3502
+ ];
3503
+ this.queues$.next(this.queue);
3504
+ }
3505
+ updateQueue(q, progress) {
3506
+ const saved = [...this.queue];
3507
+ this.queue = [
3508
+ ...saved.map((val) => {
3509
+ const valSaved = {
3510
+ ...val
3511
+ };
3512
+ const { total, loaded } = progress;
3513
+ const currentPecentage = Math.floor(((loaded || 0) / (total || 0)) * 100);
3514
+ const totalPercentage = 100;
3515
+ if (valSaved.item.id === q.item.id) {
3516
+ return {
3517
+ ...valSaved,
3518
+ progress: {
3519
+ loaded,
3520
+ total,
3521
+ currentPercentage: currentPecentage,
3522
+ totalPercentage
3523
+ }
3524
+ };
3525
+ }
3526
+ return valSaved;
3527
+ })
3528
+ ];
3529
+ this.queues$.next(this.queue);
3530
+ }
3531
+ deleteQueue(q) {
3532
+ const saved = [...this.queue];
3533
+ this.queue = [
3534
+ ...saved.map((val) => {
3535
+ const valSaved = {
3536
+ ...val
3537
+ };
3538
+ if (valSaved.item.id === q.item.id) {
3539
+ return null;
3540
+ }
3541
+ return valSaved;
3542
+ })
3543
+ ].filter((_) => {
3544
+ return _;
3545
+ });
3546
+ this.queues$.next(this.queue);
3547
+ if (this.queue.length <= 0) {
3548
+ this.allQueueFinished$.next(true);
3549
+ }
3550
+ }
3551
+ setQueue(q) {
3552
+ this.addToQueue(q);
3553
+ }
3554
+ getQueue() {
3555
+ return this.queues$.asObservable();
3556
+ }
3557
+ finishQueueItem(q, action, status) {
3558
+ this.markQueueItemAsFinish(q, status, action);
3559
+ }
3560
+ removeQueueItem(q) {
3561
+ this.deleteQueue(q);
3562
+ }
3563
+ updateQueueItem(q, progress) {
3564
+ this.updateQueue(q, progress);
3565
+ }
3566
+ hasNewQueue() {
3567
+ return this.newQueue$.pipe(map((_) => {
3568
+ return _;
3569
+ }));
3570
+ }
3571
+ hasAllQueueFinished() {
3572
+ return this.allQueueFinished$.pipe(map((_) => {
3573
+ return _;
3574
+ }));
3575
+ }
3576
+ }
3577
+ MonkeyEcxRequestQueueModalHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestQueueModalHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3578
+ MonkeyEcxRequestQueueModalHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestQueueModalHandlingService, providedIn: 'root' });
3579
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestQueueModalHandlingService, decorators: [{
3580
+ type: Injectable,
3581
+ args: [{
3582
+ providedIn: 'root'
3583
+ }]
3584
+ }], ctorParameters: function () { return []; } });
3585
+
3586
+ /* eslint-disable max-len */
3587
+ class MonkeyEcxHttpConfigQueueInterceptor {
3588
+ constructor(injector, monkeyecxRequestQueueHandlingService) {
3589
+ this.injector = injector;
3590
+ this.monkeyecxRequestQueueHandlingService = monkeyecxRequestQueueHandlingService;
3591
+ // not to do
3592
+ }
3593
+ intercept(request, next) {
3594
+ const { injector, isQueueProperty } = this;
3595
+ const monkeyecxHandlingService = injector.get(MonkeyEcxHandlingService);
3596
+ const monkeyecxRequestQueue = monkeyecxHandlingService?.getMonkeyEcxRequestQueue();
3597
+ if (isQueueProperty(monkeyecxRequestQueue)) {
3598
+ this.monkeyecxRequestQueueHandlingService.setQueue(monkeyecxRequestQueue);
3599
+ }
3600
+ return next.handle(request).pipe(finalize(() => {
3601
+ if (isQueueProperty(monkeyecxRequestQueue)) {
3602
+ this.monkeyecxRequestQueueHandlingService.finishQueueItem(monkeyecxRequestQueue);
3603
+ }
3604
+ }));
3605
+ }
3606
+ isQueueProperty(mrq) {
3607
+ return (MonkeyEcxUtils.persistNullEmptyUndefined(mrq) &&
3608
+ MonkeyEcxUtils.persistNullEmptyUndefined(mrq?.item?.name));
3609
+ }
3610
+ }
3611
+ 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 });
3612
+ MonkeyEcxHttpConfigQueueInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigQueueInterceptor });
3613
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigQueueInterceptor, decorators: [{
3614
+ type: Injectable
3615
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: MonkeyEcxRequestQueueHandlingService }]; } });
3616
+
3617
+ /* eslint-disable max-len */
3618
+ class MonkeyEcxHttpConfigLoadingInProgressInterceptor {
3619
+ constructor(injector) {
3620
+ this.injector = injector;
3621
+ // no to do
3622
+ }
3623
+ intercept(request, next) {
3624
+ const { injector, isLoadingInProgressProperty } = this;
3625
+ const handlingService = injector.get(MonkeyEcxHandlingService);
3626
+ const progressBarService = injector.get(MonkeyEcxProgressBarService);
3627
+ const inProgress = handlingService?.getMonkeyEcxServiceCredentials()
3628
+ ? handlingService?.getMonkeyEcxServiceCredentials()?.requestInProgress || null
3629
+ : null;
3630
+ if (isLoadingInProgressProperty(inProgress)) {
3631
+ progressBarService.show();
3632
+ }
3633
+ return next.handle(request).pipe(finalize(() => {
3634
+ if (isLoadingInProgressProperty(inProgress)) {
3635
+ progressBarService.hide();
3636
+ }
3637
+ }));
3638
+ }
3639
+ isLoadingInProgressProperty(mlp) {
3640
+ if (!mlp)
3641
+ return false;
3642
+ return MonkeyEcxUtils.persistNullEmptyUndefined(mlp) &&
3643
+ MonkeyEcxUtils.persistNullEmptyUndefined(mlp.showProgress)
3644
+ ? mlp.showProgress
3645
+ : true;
3646
+ }
3647
+ }
3648
+ MonkeyEcxHttpConfigLoadingInProgressInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigLoadingInProgressInterceptor, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
3649
+ MonkeyEcxHttpConfigLoadingInProgressInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigLoadingInProgressInterceptor });
3650
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigLoadingInProgressInterceptor, decorators: [{
3651
+ type: Injectable
3652
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
3653
+
3654
+ class MonkeyEcxHttpConfigInterceptorModule {
3655
+ static forRoot() {
3656
+ return {
3657
+ ngModule: MonkeyEcxHttpConfigInterceptorModule,
3658
+ providers: [
3659
+ {
3660
+ provide: HTTP_INTERCEPTORS,
3661
+ useClass: MonkeyEcxHttpConfigHeaderInterceptor,
3662
+ multi: true
3663
+ },
3664
+ {
3665
+ provide: HTTP_INTERCEPTORS,
3666
+ useClass: MonkeyEcxHttpConfigErrorInterceptor,
3667
+ multi: true
3668
+ },
3669
+ {
3670
+ provide: HTTP_INTERCEPTORS,
3671
+ useClass: MonkeyEcxHttpConfigQueueInterceptor,
3672
+ multi: true
3673
+ },
3674
+ {
3675
+ provide: HTTP_INTERCEPTORS,
3676
+ useClass: MonkeyEcxHttpConfigLoadingInProgressInterceptor,
3677
+ multi: true
3678
+ }
3679
+ ]
3680
+ };
3681
+ }
3682
+ }
3683
+ MonkeyEcxHttpConfigInterceptorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3684
+ MonkeyEcxHttpConfigInterceptorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, imports: [CommonModule] });
3685
+ MonkeyEcxHttpConfigInterceptorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, imports: [[CommonModule]] });
3686
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigInterceptorModule, decorators: [{
3687
+ type: NgModule,
3688
+ args: [{
3689
+ imports: [CommonModule]
3690
+ }]
3691
+ }] });
3692
+
3693
+ class MonkeyEcxModel {
3694
+ getAction(type) {
3695
+ const { _links } = this;
3696
+ if (!_links)
3697
+ return null;
3698
+ const link = _links[type.toLowerCase()];
3699
+ return link;
3700
+ }
3701
+ }
3702
+
3703
+ /* eslint-disable indent */
3704
+ class MonkeyEcxConfigModule {
3705
+ constructor(parentModule) {
3706
+ if (parentModule) {
3707
+ throw new Error('MonkeyEcxConfigModule is already loaded. Import it in the AppModule only!');
3708
+ }
3709
+ }
3710
+ static forRoot() {
3711
+ return {
3712
+ ngModule: MonkeyEcxConfigModule,
3713
+ providers: [MonkeyEcxConfigService]
3714
+ };
3715
+ }
3716
+ }
3717
+ 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 });
3718
+ MonkeyEcxConfigModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigModule });
3719
+ MonkeyEcxConfigModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigModule });
3720
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigModule, decorators: [{
3721
+ type: NgModule
3722
+ }], ctorParameters: function () { return [{ type: MonkeyEcxConfigModule, decorators: [{
3723
+ type: Optional
3724
+ }, {
3725
+ type: SkipSelf
3726
+ }] }]; } });
3727
+
3728
+ class MonkeyEcxLoggedHandlingService {
3729
+ constructor() {
3730
+ this.schedules = [];
3731
+ // not to do
3732
+ }
3733
+ destroySchedule() {
3734
+ this.schedules.forEach((sch) => {
3735
+ clearInterval(sch.interval);
3736
+ });
3737
+ this.schedules = [];
3738
+ }
3739
+ addSchedule(sch) {
3740
+ this.schedules = sch;
3741
+ }
3742
+ destroy() {
3743
+ this.destroySchedule();
3744
+ }
3745
+ }
3746
+ MonkeyEcxLoggedHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLoggedHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3747
+ MonkeyEcxLoggedHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLoggedHandlingService, providedIn: 'root' });
3748
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLoggedHandlingService, decorators: [{
3749
+ type: Injectable,
3750
+ args: [{
3751
+ providedIn: 'root'
3752
+ }]
3753
+ }], ctorParameters: function () { return []; } });
3754
+
3755
+ class MonkeyEcxRequestDownloadHandlingService {
3756
+ constructor() {
3757
+ this.download = [];
3758
+ this.download$ = new BehaviorSubject([]);
3759
+ }
3760
+ addTo(q) {
3761
+ this.download.push(q);
3762
+ this.download$.next(this.download);
3763
+ }
3764
+ markItemAsFinish(q, status) {
3765
+ const saved = [...this.download];
3766
+ this.download = [
3767
+ ...saved
3768
+ .map((val) => {
3769
+ if (val.status === MonkeyEcxDownloadEvents.OnGoing) {
3770
+ const valSaved = {
3771
+ ...val
3772
+ };
3773
+ if (valSaved.item.id === q.item.id) {
3774
+ return {
3775
+ ...valSaved,
3776
+ status: status || MonkeyEcxDownloadEvents.Finished
3777
+ };
3778
+ }
3779
+ return valSaved;
3780
+ }
3781
+ return null;
3782
+ })
3783
+ .filter((_) => {
3784
+ return _;
3785
+ })
3786
+ ];
3787
+ this.download = this.download.filter((_) => {
3788
+ return _.status === MonkeyEcxDownloadEvents.OnGoing;
3789
+ });
3790
+ this.download$.next(this.download);
3791
+ }
3792
+ updateItem(q, loaded, total) {
3793
+ const saved = [...this.download];
3794
+ this.download = [
3795
+ ...saved.map((val) => {
3796
+ const valSaved = {
3797
+ ...val
3798
+ };
3799
+ const currentPecentage = Math.floor(((loaded || 0) / (total || 0)) * 100);
3800
+ const totalPercentage = 100;
3801
+ if (valSaved.item.id === q.item.id) {
3802
+ return {
3803
+ ...valSaved,
3804
+ loaded,
3805
+ total,
3806
+ currentPercentage: currentPecentage,
3807
+ totalPercentage
3808
+ };
3809
+ }
3810
+ return valSaved;
3811
+ })
3812
+ ];
3813
+ this.download$.next(this.download);
3814
+ }
3815
+ set(q) {
3816
+ this.addTo(q);
3817
+ }
3818
+ get() {
3819
+ return this.download$.asObservable();
3820
+ }
3821
+ update(q, loaded, total) {
3822
+ this.updateItem(q, loaded, total);
3823
+ }
3824
+ finishItem(q, status) {
3825
+ this.markItemAsFinish(q, status);
3826
+ }
3827
+ hasDownloadOnGoing() {
3828
+ const found = this.download.find((_) => {
3829
+ return _.status === MonkeyEcxDownloadEvents.OnGoing;
3830
+ });
3831
+ return MonkeyEcxUtils.persistNullEmptyUndefined(found);
3832
+ }
3833
+ }
3834
+ MonkeyEcxRequestDownloadHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3835
+ MonkeyEcxRequestDownloadHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadHandlingService, providedIn: 'root' });
3836
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadHandlingService, decorators: [{
3837
+ type: Injectable,
3838
+ args: [{
3839
+ providedIn: 'root'
3840
+ }]
3841
+ }], ctorParameters: function () { return []; } });
3842
+
3843
+ class MonkeyEcxRequestDownloadedHandlingService {
3844
+ constructor() {
3845
+ this.downloaded = [];
3846
+ this.downloaded$ = new BehaviorSubject([]);
3847
+ }
3848
+ addTo(q) {
3849
+ this.downloaded.push(q);
3850
+ this.downloaded$.next(this.downloaded);
3851
+ }
3852
+ markItemAsFinish(q, status) {
3853
+ const saved = [...this.downloaded];
3854
+ this.downloaded = [
3855
+ ...saved.map((val) => {
3856
+ if (val.status === MonkeyEcxDownloadEvents.OnGoing) {
3857
+ const valSaved = {
3858
+ ...val
3859
+ };
3860
+ if (valSaved.item.id === q.item.id) {
3861
+ return {
3862
+ ...valSaved,
3863
+ status: status || MonkeyEcxDownloadEvents.Finished,
3864
+ action: q.action
3865
+ };
3866
+ }
3867
+ return valSaved;
3868
+ }
3869
+ return val;
3870
+ })
3871
+ ];
3872
+ this.downloaded$.next(this.downloaded);
3873
+ }
3874
+ set(q) {
3875
+ this.addTo(q);
3876
+ }
3877
+ get() {
3878
+ return this.downloaded$.asObservable();
3879
+ }
3880
+ finishItem(q, status) {
3881
+ this.markItemAsFinish(q, status);
3882
+ }
3883
+ hasDownloadOnGoing() {
3884
+ const found = this.downloaded.find((_) => {
3885
+ return _.status === MonkeyEcxDownloadEvents.OnGoing;
3886
+ });
3887
+ return MonkeyEcxUtils.persistNullEmptyUndefined(found);
3888
+ }
3889
+ }
3890
+ MonkeyEcxRequestDownloadedHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadedHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3891
+ MonkeyEcxRequestDownloadedHandlingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadedHandlingService, providedIn: 'root' });
3892
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestDownloadedHandlingService, decorators: [{
3893
+ type: Injectable,
3894
+ args: [{
3895
+ providedIn: 'root'
3896
+ }]
3897
+ }], ctorParameters: function () { return []; } });
3898
+
3899
+ class MonkeyEcxDiscoveryParamsService {
3900
+ constructor(router) {
3901
+ this.router = router;
3902
+ // not to do
3903
+ }
3904
+ getLastChild(route) {
3905
+ if (route.firstChild) {
3906
+ return this.getLastChild(route.firstChild);
3907
+ }
3908
+ return route;
3909
+ }
3910
+ setData(field, value) {
3911
+ const { root } = this.router.routerState.snapshot;
3912
+ const route = this.getLastChild(root);
3913
+ route.data[field] = value;
3914
+ }
3915
+ getData(field) {
3916
+ const { root } = this.router.routerState.snapshot;
3917
+ const route = this.getLastChild(root);
3918
+ const found = MonkeyEcxUtils.persistNullEmptyUndefined(route) ? route.data[field] : null;
3919
+ return found;
3920
+ }
3921
+ getDataFromCurrentNavigation(field) {
3922
+ const navigation = this.router.getCurrentNavigation();
3923
+ let state = null;
3924
+ if (MonkeyEcxUtils.persistNullEmptyUndefined(navigation)) {
3925
+ state = navigation?.extras.state;
3926
+ }
3927
+ return state ? state[field] : null;
3928
+ }
3929
+ getParam(param) {
3930
+ const { root } = this.router.routerState.snapshot;
3931
+ const route = this.getLastChild(root);
3932
+ let found = MonkeyEcxUtils.persistNullEmptyUndefined(route)
3933
+ ? route?.paramMap?.get(param) || ''
3934
+ : '';
3935
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(found))
3936
+ found = this.getData(param);
3937
+ return found;
3938
+ }
3939
+ }
3940
+ 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 });
3941
+ MonkeyEcxDiscoveryParamsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDiscoveryParamsService, providedIn: 'root' });
3942
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDiscoveryParamsService, decorators: [{
3943
+ type: Injectable,
3944
+ args: [{
3945
+ providedIn: 'root'
3946
+ }]
3947
+ }], ctorParameters: function () { return [{ type: i1$3.Router }]; } });
3948
+
3949
+ class MonkeyEcxRequestScheduleService {
3950
+ constructor(monkeyecxService, monkeyecxLoggedHandlingService) {
3951
+ this.monkeyecxService = monkeyecxService;
3952
+ this.monkeyecxLoggedHandlingService = monkeyecxLoggedHandlingService;
3953
+ this.schedule = [];
3954
+ // not to do
3955
+ }
3956
+ addToSchedule(q) {
3957
+ this.schedule.push(q);
3958
+ this.monkeyecxLoggedHandlingService.addSchedule(this.schedule);
3959
+ }
3960
+ removeFromSchedule(q) {
3961
+ clearInterval(q.interval);
3962
+ const saved = [...this.schedule];
3963
+ this.schedule = [
3964
+ ...saved.map((sch) => {
3965
+ const savedLocal = {
3966
+ ...sch
3967
+ };
3968
+ if (sch.id === q.id) {
3969
+ return null;
3970
+ }
3971
+ return savedLocal;
3972
+ })
3973
+ ].filter((_) => {
3974
+ return _;
3975
+ });
3976
+ this.monkeyecxLoggedHandlingService.addSchedule(this.schedule);
3977
+ }
3978
+ removeFromScheduleById(id) {
3979
+ const q = this.getScheduleById(id);
3980
+ clearInterval(q.interval);
3981
+ const saved = [...this.schedule];
3982
+ this.schedule = [
3983
+ ...saved.map((sch) => {
3984
+ const savedLocal = {
3985
+ ...sch
3986
+ };
3987
+ if (sch.id === q.id) {
3988
+ return null;
3989
+ }
3990
+ return savedLocal;
3991
+ })
3992
+ ].filter((_) => {
3993
+ return _;
3994
+ });
3995
+ this.monkeyecxLoggedHandlingService.addSchedule(this.schedule);
3996
+ }
3997
+ doCall(sch) {
3998
+ const { url, method, params, data, action } = sch;
3999
+ let func = null;
4000
+ const tp = `${method}`.toLowerCase();
4001
+ if (tp === 'get') {
4002
+ func = this.monkeyecxService?.get;
4003
+ }
4004
+ else if (tp === 'post') {
4005
+ func = this.monkeyecxService?.post;
4006
+ }
4007
+ else if (tp === 'put') {
4008
+ func = this.monkeyecxService?.put;
4009
+ }
4010
+ else if (tp === 'delete') {
4011
+ func = this.monkeyecxService?.delete;
4012
+ }
4013
+ func?.(`${url}`, params)?.subscribe((resp) => {
4014
+ action({
4015
+ ...data,
4016
+ ...resp
4017
+ }, sch);
4018
+ }, () => {
4019
+ this.removeFromSchedule(sch);
4020
+ });
4021
+ }
4022
+ setSchedule(q, delay = 3000) {
4023
+ const interval = setInterval(() => {
4024
+ this.doCall({
4025
+ ...q,
4026
+ interval
4027
+ });
4028
+ }, delay);
4029
+ const sch = {
4030
+ ...q,
4031
+ id: `${MonkeyEcxUtils.getRandomString(40)}`,
4032
+ interval
4033
+ };
4034
+ this.addToSchedule(sch);
4035
+ return sch;
4036
+ }
4037
+ removeSchedule(q) {
4038
+ this.removeFromSchedule(q);
4039
+ }
4040
+ removeScheduleById(id) {
4041
+ this.removeFromScheduleById(id);
4042
+ }
4043
+ getScheduleById(id) {
4044
+ const q = this.schedule.find((sch) => {
4045
+ return sch.id === id;
4046
+ });
4047
+ return q;
4048
+ }
4049
+ }
4050
+ 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 });
4051
+ MonkeyEcxRequestScheduleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestScheduleService, providedIn: 'root' });
4052
+ __decorate([
4053
+ MonkeyEcxCoreService({
4054
+ httpResponse: {
4055
+ httpCodeIgnore: [400, 403, 404, 500, 503]
4056
+ },
4057
+ requestInProgress: {
4058
+ showProgress: false
4059
+ }
4060
+ })
4061
+ ], MonkeyEcxRequestScheduleService.prototype, "doCall", null);
4062
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestScheduleService, decorators: [{
4063
+ type: Injectable,
4064
+ args: [{
4065
+ providedIn: 'root'
4066
+ }]
4067
+ }], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxLoggedHandlingService }]; }, propDecorators: { doCall: [] } });
4068
+
4069
+ /* eslint-disable no-unused-vars */
4070
+ var OpSearch;
4071
+ (function (OpSearch) {
4072
+ OpSearch["LIKE"] = ":*:value*";
4073
+ OpSearch["BETWEEN"] = ":first AND :last";
4074
+ OpSearch["OR"] = "OR";
4075
+ OpSearch["AND"] = "AND";
4076
+ OpSearch["GT"] = ">:value";
4077
+ OpSearch["LT"] = "<:value";
4078
+ OpSearch["EQUAL"] = "::value";
4079
+ })(OpSearch || (OpSearch = {}));
4080
+ class MonkeyEcxSpecificationSearch {
4081
+ constructor() {
4082
+ // not to do
4083
+ }
4084
+ handleValue(value) {
4085
+ return Object.entries(value).map(([key, value1]) => {
4086
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(value1)) {
4087
+ return null;
4088
+ }
4089
+ if (Array.isArray(value1)) {
4090
+ if (key === OpSearch.BETWEEN) {
4091
+ return `${key}`.replace(':first', value1[0]).replace(':last', value1[1]);
4092
+ }
4093
+ }
4094
+ return `${key}`.replace(':value', `${value1}`);
4095
+ })[0];
4096
+ }
4097
+ queryVisitor(value) {
4098
+ const okay = Object.entries(value).map(([key1, value1]) => {
4099
+ if (key1 === OpSearch.OR || key1 === OpSearch.AND) {
4100
+ const join = value1
4101
+ .map((_) => {
4102
+ return Object.entries(_).map(([key2, value2]) => {
4103
+ if (value2 instanceof Object) {
4104
+ value2 = this.handleValue(value2);
4105
+ }
4106
+ return this.criteriaParser(key2, value2);
4107
+ })[0];
4108
+ })
4109
+ .filter((_) => {
4110
+ return _;
4111
+ })
4112
+ .join(` ${key1} `);
4113
+ return `${join ? `(${join})` : ''}`;
4114
+ }
4115
+ if (value1 instanceof Object) {
4116
+ value1 = this.handleValue(value1);
4117
+ }
4118
+ return this.criteriaParser(key1, value1);
4119
+ });
4120
+ return okay
4121
+ .filter((_) => {
4122
+ return _;
4123
+ })
4124
+ .join(' AND ');
4125
+ }
4126
+ criteriaParser(key, value) {
4127
+ if (!MonkeyEcxUtils.persistNullEmptyUndefined(value)) {
4128
+ return '';
4129
+ }
4130
+ if (value instanceof Object) {
4131
+ return this.queryVisitor(value);
4132
+ }
4133
+ return `${key}${value}`;
4134
+ }
4135
+ build(spec) {
4136
+ try {
4137
+ return this.queryVisitor(spec);
4138
+ }
4139
+ catch (e) {
4140
+ throw new Error(`MonkeyEcxSpecificationSearch Error ${e}`);
4141
+ }
4142
+ }
4143
+ buildMoreThanOne(field, op = OpSearch.EQUAL) {
4144
+ let self = this;
4145
+ try {
4146
+ if (!self[field])
4147
+ return [];
4148
+ const filters = self[field]?.split(',')?.map((filter) => {
4149
+ if (!filter)
4150
+ return null;
4151
+ return {
4152
+ [field]: {
4153
+ [op]: `${filter}`
4154
+ }
4155
+ };
4156
+ }).filter((val) => { return val; });
4157
+ return filters || [];
4158
+ }
4159
+ catch (e) {
4160
+ throw new Error(`MonkeyEcxSpecificationSearch Error ${e}`);
4161
+ }
4162
+ }
4163
+ }
4164
+
4165
+ class MonkeyFrontCoreModuleModule {
4166
+ }
4167
+ MonkeyFrontCoreModuleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyFrontCoreModuleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4168
+ MonkeyFrontCoreModuleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyFrontCoreModuleModule, imports: [CommonModule,
4169
+ HttpClientModule, i1$1.TranslateModule, MonkeyEcxConfigModule, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxErrorHandlingModule, MonkeyStyleGuideModule, i1$5.ServiceWorkerModule, ClosedToMaintenanceModule,
4170
+ VersionChangedModule] });
4171
+ MonkeyFrontCoreModuleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyFrontCoreModuleModule, providers: [
4172
+ MonkeyStyleGuideModalService,
4173
+ MonkeyStyleGuideSettingsService,
4174
+ MonkeyStyleGuideSnackbarService
4175
+ ], imports: [[
4176
+ CommonModule,
4177
+ HttpClientModule,
4178
+ TranslateModule.forRoot(),
4179
+ MonkeyEcxConfigModule.forRoot(),
4180
+ MonkeyEcxHttpConfigInterceptorModule.forRoot(),
4181
+ MonkeyEcxErrorHandlingModule.forRoot(),
4182
+ MonkeyStyleGuideModule,
4183
+ ServiceWorkerModule.register('ngsw-worker.js'),
4184
+ ClosedToMaintenanceModule,
4185
+ VersionChangedModule
4186
+ ]] });
4187
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyFrontCoreModuleModule, decorators: [{
4188
+ type: NgModule,
4189
+ args: [{
4190
+ imports: [
4191
+ CommonModule,
4192
+ HttpClientModule,
4193
+ TranslateModule.forRoot(),
4194
+ MonkeyEcxConfigModule.forRoot(),
4195
+ MonkeyEcxHttpConfigInterceptorModule.forRoot(),
4196
+ MonkeyEcxErrorHandlingModule.forRoot(),
4197
+ MonkeyStyleGuideModule,
4198
+ ServiceWorkerModule.register('ngsw-worker.js'),
4199
+ ClosedToMaintenanceModule,
4200
+ VersionChangedModule
4201
+ ],
4202
+ providers: [
4203
+ MonkeyStyleGuideModalService,
4204
+ MonkeyStyleGuideSettingsService,
4205
+ MonkeyStyleGuideSnackbarService
4206
+ ]
4207
+ }]
4208
+ }] });
4209
+
4210
+ /*
4211
+ * Public API Surface of monkey-front-core
4212
+ */
4213
+
4214
+ /**
4215
+ * Generated bundle index. Do not edit.
4216
+ */
4217
+
4218
+ 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 };
4219
+ //# sourceMappingURL=monkey-front-core.mjs.map