@hmcts/opal-frontend-common 0.0.10 → 0.0.11

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 (134) hide show
  1. package/components/abstract/abstract-form-parent-base/abstract-form-parent-base.component.d.ts +7 -3
  2. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.mjs +3 -3
  3. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.mjs.map +1 -1
  4. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-base.mjs +3 -3
  5. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-base.mjs.map +1 -1
  6. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-removal-base.mjs +3 -3
  7. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-removal-base.mjs.map +1 -1
  8. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-base.mjs +3 -3
  9. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-base.mjs.map +1 -1
  10. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-parent-base.mjs +13 -9
  11. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-parent-base.mjs.map +1 -1
  12. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table-pagination.mjs +3 -3
  13. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table-pagination.mjs.map +1 -1
  14. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table.mjs +3 -3
  15. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table.mjs.map +1 -1
  16. package/fesm2022/hmcts-opal-frontend-common-components-alphagov-alphagov-accessible-autocomplete.mjs +3 -3
  17. package/fesm2022/hmcts-opal-frontend-common-components-alphagov-alphagov-accessible-autocomplete.mjs.map +1 -1
  18. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-accordion.mjs +3 -3
  19. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-accordion.mjs.map +1 -1
  20. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-back-link.mjs +3 -3
  21. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-back-link.mjs.map +1 -1
  22. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-button.mjs +3 -3
  23. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-button.mjs.map +1 -1
  24. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-cancel-link.mjs +3 -3
  25. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-cancel-link.mjs.map +1 -1
  26. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-checkboxes.mjs +12 -12
  27. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-checkboxes.mjs.map +1 -1
  28. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-date-input.mjs +3 -3
  29. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-date-input.mjs.map +1 -1
  30. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-details.mjs +3 -3
  31. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-details.mjs.map +1 -1
  32. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-error-summary.mjs +3 -3
  33. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-error-summary.mjs.map +1 -1
  34. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-footer.mjs +3 -3
  35. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-footer.mjs.map +1 -1
  36. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-header.mjs +6 -6
  37. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-header.mjs.map +1 -1
  38. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-heading-with-caption.mjs +3 -3
  39. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-heading-with-caption.mjs.map +1 -1
  40. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-inset-text.mjs +3 -3
  41. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-inset-text.mjs.map +1 -1
  42. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-notification-banner.mjs +3 -3
  43. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-notification-banner.mjs.map +1 -1
  44. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-pagination.mjs +3 -3
  45. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-pagination.mjs.map +1 -1
  46. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-panel.mjs +3 -3
  47. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-panel.mjs.map +1 -1
  48. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-radio.mjs +12 -12
  49. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-radio.mjs.map +1 -1
  50. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-select.mjs +3 -3
  51. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-select.mjs.map +1 -1
  52. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-summary-card-list.mjs +6 -6
  53. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-summary-card-list.mjs.map +1 -1
  54. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-summary-list.mjs +12 -12
  55. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-summary-list.mjs.map +1 -1
  56. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-table.mjs +12 -12
  57. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-table.mjs.map +1 -1
  58. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tabs.mjs +9 -9
  59. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tabs.mjs.map +1 -1
  60. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tag.mjs +3 -3
  61. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tag.mjs.map +1 -1
  62. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-task-list.mjs +6 -6
  63. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-task-list.mjs.map +1 -1
  64. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-area.mjs +3 -3
  65. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-area.mjs.map +1 -1
  66. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input-prefix-suffix.mjs +3 -3
  67. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input-prefix-suffix.mjs.map +1 -1
  68. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input.mjs +3 -3
  69. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input.mjs.map +1 -1
  70. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-badge.mjs +3 -3
  71. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-badge.mjs.map +1 -1
  72. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-banner.mjs +3 -3
  73. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-banner.mjs.map +1 -1
  74. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-button-menu.mjs +6 -6
  75. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-button-menu.mjs.map +1 -1
  76. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-date-picker.mjs +3 -3
  77. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-date-picker.mjs.map +1 -1
  78. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-header.mjs +6 -6
  79. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-header.mjs.map +1 -1
  80. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-notification-badge.mjs +3 -3
  81. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-notification-badge.mjs.map +1 -1
  82. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-page-header.mjs +3 -3
  83. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-page-header.mjs.map +1 -1
  84. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-pagination.mjs +12 -12
  85. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-pagination.mjs.map +1 -1
  86. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-primary-navigation.mjs +6 -6
  87. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-primary-navigation.mjs.map +1 -1
  88. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sortable-table.mjs +15 -15
  89. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sortable-table.mjs.map +1 -1
  90. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sub-navigation.mjs +6 -6
  91. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sub-navigation.mjs.map +1 -1
  92. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-ticket-panel.mjs +3 -3
  93. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-ticket-panel.mjs.map +1 -1
  94. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-timeline.mjs +6 -6
  95. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-timeline.mjs.map +1 -1
  96. package/fesm2022/hmcts-opal-frontend-common-directives-capitalisation.mjs +3 -3
  97. package/fesm2022/hmcts-opal-frontend-common-directives-capitalisation.mjs.map +1 -1
  98. package/fesm2022/{hmcts-opal-frontend-common-pages-access-denied.component-yc1BR0MD.mjs → hmcts-opal-frontend-common-pages-access-denied.component-CvFM-aDI.mjs} +4 -4
  99. package/fesm2022/{hmcts-opal-frontend-common-pages-access-denied.component-yc1BR0MD.mjs.map → hmcts-opal-frontend-common-pages-access-denied.component-CvFM-aDI.mjs.map} +1 -1
  100. package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in-stub.component-ZXo1inkD.mjs → hmcts-opal-frontend-common-pages-sign-in-stub.component-CyQTrDcH.mjs} +4 -4
  101. package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in-stub.component-ZXo1inkD.mjs.map → hmcts-opal-frontend-common-pages-sign-in-stub.component-CyQTrDcH.mjs.map} +1 -1
  102. package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in.component-CUKAHWHL.mjs → hmcts-opal-frontend-common-pages-sign-in.component-fCqzpifX.mjs} +4 -4
  103. package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in.component-CUKAHWHL.mjs.map → hmcts-opal-frontend-common-pages-sign-in.component-fCqzpifX.mjs.map} +1 -1
  104. package/fesm2022/hmcts-opal-frontend-common-pages.mjs +2 -2
  105. package/fesm2022/hmcts-opal-frontend-common-pipes-date-format.mjs +3 -3
  106. package/fesm2022/hmcts-opal-frontend-common-pipes-date-format.mjs.map +1 -1
  107. package/fesm2022/hmcts-opal-frontend-common-pipes-days-ago.mjs +3 -3
  108. package/fesm2022/hmcts-opal-frontend-common-pipes-days-ago.mjs.map +1 -1
  109. package/fesm2022/hmcts-opal-frontend-common-resolvers-title.mjs +3 -3
  110. package/fesm2022/hmcts-opal-frontend-common-resolvers-title.mjs.map +1 -1
  111. package/fesm2022/hmcts-opal-frontend-common-services-app-initializer-service.mjs +3 -3
  112. package/fesm2022/hmcts-opal-frontend-common-services-app-initializer-service.mjs.map +1 -1
  113. package/fesm2022/hmcts-opal-frontend-common-services-app-insights-service.mjs +3 -3
  114. package/fesm2022/hmcts-opal-frontend-common-services-app-insights-service.mjs.map +1 -1
  115. package/fesm2022/hmcts-opal-frontend-common-services-auth-service.mjs +3 -3
  116. package/fesm2022/hmcts-opal-frontend-common-services-auth-service.mjs.map +1 -1
  117. package/fesm2022/hmcts-opal-frontend-common-services-date-service.mjs +3 -3
  118. package/fesm2022/hmcts-opal-frontend-common-services-date-service.mjs.map +1 -1
  119. package/fesm2022/hmcts-opal-frontend-common-services-launch-darkly-service.mjs +3 -3
  120. package/fesm2022/hmcts-opal-frontend-common-services-launch-darkly-service.mjs.map +1 -1
  121. package/fesm2022/hmcts-opal-frontend-common-services-permissions-service.mjs +3 -3
  122. package/fesm2022/hmcts-opal-frontend-common-services-permissions-service.mjs.map +1 -1
  123. package/fesm2022/hmcts-opal-frontend-common-services-session-service.mjs +3 -3
  124. package/fesm2022/hmcts-opal-frontend-common-services-session-service.mjs.map +1 -1
  125. package/fesm2022/hmcts-opal-frontend-common-services-sort-service.mjs +3 -3
  126. package/fesm2022/hmcts-opal-frontend-common-services-sort-service.mjs.map +1 -1
  127. package/fesm2022/hmcts-opal-frontend-common-services-transfer-state-service.mjs +3 -3
  128. package/fesm2022/hmcts-opal-frontend-common-services-transfer-state-service.mjs.map +1 -1
  129. package/fesm2022/hmcts-opal-frontend-common-services-transformation-service.mjs +3 -3
  130. package/fesm2022/hmcts-opal-frontend-common-services-transformation-service.mjs.map +1 -1
  131. package/fesm2022/hmcts-opal-frontend-common-services-utils-service.mjs +34 -3
  132. package/fesm2022/hmcts-opal-frontend-common-services-utils-service.mjs.map +1 -1
  133. package/package.json +1 -1
  134. package/services/utils-service/utils.service.d.ts +21 -0
@@ -25,10 +25,10 @@ class AuthService {
25
25
  return throwError(() => error);
26
26
  }));
27
27
  }
28
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
29
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: AuthService, providedIn: 'root' });
28
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
29
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AuthService, providedIn: 'root' });
30
30
  }
31
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: AuthService, decorators: [{
31
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AuthService, decorators: [{
32
32
  type: Injectable,
33
33
  args: [{
34
34
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-services-auth-service.mjs","sources":["../../../projects/opal-frontend-common/services/auth-service/auth.service.ts","../../../projects/opal-frontend-common/services/auth-service/hmcts-opal-frontend-common-services-auth-service.ts"],"sourcesContent":["import { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { catchError, tap, throwError } from 'rxjs';\nimport { SSO_ENDPOINTS } from '@hmcts/opal-frontend-common/services/auth-service/constants';\nimport { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthService {\n private readonly http = inject(HttpClient);\n private readonly globalStore = inject(GlobalStore);\n\n public checkAuthenticated() {\n return this.http\n .get<boolean>(SSO_ENDPOINTS.authenticated, {\n headers: new HttpHeaders({\n 'Cache-Control': 'no-cache',\n Pragma: 'no-cache',\n Expires: '0',\n }),\n })\n .pipe(\n tap((resp) => {\n this.globalStore.setAuthenticated(resp);\n }),\n )\n .pipe(\n catchError((error) => {\n this.globalStore.setAuthenticated(false);\n return throwError(() => error);\n }),\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MASa,WAAW,CAAA;AACL,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AACzB,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IAE3C,kBAAkB,GAAA;QACvB,OAAO,IAAI,CAAC;AACT,aAAA,GAAG,CAAU,aAAa,CAAC,aAAa,EAAE;YACzC,OAAO,EAAE,IAAI,WAAW,CAAC;AACvB,gBAAA,eAAe,EAAE,UAAU;AAC3B,gBAAA,MAAM,EAAE,UAAU;AAClB,gBAAA,OAAO,EAAE,GAAG;aACb,CAAC;SACH;AACA,aAAA,IAAI,CACH,GAAG,CAAC,CAAC,IAAI,KAAI;AACX,YAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC;AACzC,SAAC,CAAC;AAEH,aAAA,IAAI,CACH,UAAU,CAAC,CAAC,KAAK,KAAI;AACnB,YAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,CAAC;AACxC,YAAA,OAAO,UAAU,CAAC,MAAM,KAAK,CAAC;SAC/B,CAAC,CACH;;uGAvBM,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAX,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,cAFV,MAAM,EAAA,CAAA;;2FAEP,WAAW,EAAA,UAAA,EAAA,CAAA;kBAHvB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACRD;;AAEG;;;;"}
1
+ {"version":3,"file":"hmcts-opal-frontend-common-services-auth-service.mjs","sources":["../../../projects/opal-frontend-common/services/auth-service/auth.service.ts","../../../projects/opal-frontend-common/services/auth-service/hmcts-opal-frontend-common-services-auth-service.ts"],"sourcesContent":["import { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { catchError, tap, throwError } from 'rxjs';\nimport { SSO_ENDPOINTS } from '@hmcts/opal-frontend-common/services/auth-service/constants';\nimport { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthService {\n private readonly http = inject(HttpClient);\n private readonly globalStore = inject(GlobalStore);\n\n public checkAuthenticated() {\n return this.http\n .get<boolean>(SSO_ENDPOINTS.authenticated, {\n headers: new HttpHeaders({\n 'Cache-Control': 'no-cache',\n Pragma: 'no-cache',\n Expires: '0',\n }),\n })\n .pipe(\n tap((resp) => {\n this.globalStore.setAuthenticated(resp);\n }),\n )\n .pipe(\n catchError((error) => {\n this.globalStore.setAuthenticated(false);\n return throwError(() => error);\n }),\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MASa,WAAW,CAAA;AACL,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AACzB,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IAE3C,kBAAkB,GAAA;QACvB,OAAO,IAAI,CAAC;AACT,aAAA,GAAG,CAAU,aAAa,CAAC,aAAa,EAAE;YACzC,OAAO,EAAE,IAAI,WAAW,CAAC;AACvB,gBAAA,eAAe,EAAE,UAAU;AAC3B,gBAAA,MAAM,EAAE,UAAU;AAClB,gBAAA,OAAO,EAAE,GAAG;aACb,CAAC;SACH;AACA,aAAA,IAAI,CACH,GAAG,CAAC,CAAC,IAAI,KAAI;AACX,YAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC;AACzC,SAAC,CAAC;AAEH,aAAA,IAAI,CACH,UAAU,CAAC,CAAC,KAAK,KAAI;AACnB,YAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,CAAC;AACxC,YAAA,OAAO,UAAU,CAAC,MAAM,KAAK,CAAC;SAC/B,CAAC,CACH;;wGAvBM,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAX,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,cAFV,MAAM,EAAA,CAAA;;4FAEP,WAAW,EAAA,UAAA,EAAA,CAAA;kBAHvB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACRD;;AAEG;;;;"}
@@ -183,10 +183,10 @@ class DateService {
183
183
  const now = this.getDateNow().startOf('day');
184
184
  return Math.round(now.diff(inputDate, 'days').days);
185
185
  }
186
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: DateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
187
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: DateService, providedIn: 'root' });
186
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: DateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
187
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: DateService, providedIn: 'root' });
188
188
  }
189
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: DateService, decorators: [{
189
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: DateService, decorators: [{
190
190
  type: Injectable,
191
191
  args: [{
192
192
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-services-date-service.mjs","sources":["../../../projects/opal-frontend-common/services/date-service/date.service.ts","../../../projects/opal-frontend-common/services/date-service/hmcts-opal-frontend-common-services-date-service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { DateTime, Duration, DurationLikeObject } from 'luxon';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DateService {\n /**\n * Calculates the difference in minutes between two DateTime objects.\n * @param startDate The start date and time.\n * @param endDate The end date and time.\n * @returns The difference in minutes between the start and end dates.\n */\n public calculateMinutesDifference(startDate: DateTime, endDate: DateTime): number {\n const minuteDifference = endDate.diff(startDate, 'minutes');\n return Math.max(0, Math.ceil(minuteDifference.minutes));\n }\n\n /**\n * Converts milliseconds to minutes.\n * @param milliseconds - The number of milliseconds to convert.\n * @returns The equivalent number of minutes.\n */\n public convertMillisecondsToMinutes(milliseconds: number): number {\n const minutes = Duration.fromMillis(milliseconds).as('minutes');\n return Math.max(0, Math.ceil(minutes));\n }\n\n /**\n * Calculates the age based on the given date of birth.\n * @param dateOfBirth - The date of birth to calculate the age from.\n * @param format - The format of the date of birth. Defaults to 'dd/MM/yyyy'.\n * @returns The calculated age.\n */\n public calculateAge(dateOfBirth: DateTime | string, format: string = 'dd/MM/yyyy'): number {\n const date = typeof dateOfBirth === 'string' ? this.getFromFormat(dateOfBirth, format) : dateOfBirth;\n\n return Math.floor(DateTime.now().diff(date, 'years').years);\n }\n\n /**\n * Checks if a given date is valid.\n * @param dateInput - The date to be checked. It can be a DateTime object, a string, or null.\n * @param format - The format of the date string (default: 'dd/MM/yyyy').\n * @returns A boolean indicating whether the date is valid or not.\n */\n public isValidDate(dateInput: DateTime | string | null, format: string = 'dd/MM/yyyy'): boolean {\n if (dateInput) {\n const date = typeof dateInput === 'string' ? this.getFromFormat(dateInput, format) : dateInput;\n return date.isValid;\n }\n return false;\n }\n\n /**\n * Returns a string representation of a date subtracted by the given duration.\n * @param duration A DurationLikeObject representing the amount of time to subtract from the current date.\n * @returns A string representing the subtracted date in the format specified by the current locale.\n */\n public getPreviousDate(duration: DurationLikeObject): string {\n return DateTime.now().minus(duration).setLocale('en-gb').toLocaleString();\n }\n\n /**\n * Parses a string value into a DateTime object based on the specified format.\n * @param value - The string value to parse.\n * @param format - The format of the string value.\n * @returns A DateTime object representing the parsed value.\n */\n public getFromFormat(value: string, format: string): DateTime<true> | DateTime<false> {\n return DateTime.fromFormat(value, format);\n }\n\n /**\n * Parses a string value into a native JavaScript Date object based on the specified format.\n * @param value - The string value to parse.\n * @param format - The format of the string value.\n * @returns A Date object representing the parsed value, or null if parsing fails.\n */\n public getDateFromFormat(value: string, format: string): Date | null {\n const dateTime = DateTime.fromFormat(value, format);\n return dateTime.isValid ? dateTime.toJSDate() : null;\n }\n\n /**\n * Converts a DateTime value to a formatted string.\n *\n * @param value - The DateTime value to format.\n * @param format - The format string to apply to the DateTime value.\n * @returns The formatted string representation of the DateTime value.\n */\n public toFormat(value: DateTime<true> | DateTime<false>, format: string): string {\n return value.toFormat(format);\n }\n\n /**\n * Converts a given Date object to a formatted string based on the specified format.\n *\n * @param value - The Date object to be formatted.\n * @param format - The string format to apply to the Date object.\n * @returns The formatted date string.\n */\n public toDateStringFormat(value: Date, format: string): string {\n return DateTime.fromJSDate(value).toFormat(format);\n }\n\n /**\n * Converts a string in ISO format to a DateTime object.\n * @param value - The string value in ISO format.\n * @returns A DateTime object representing the given value.\n */\n public getFromIso(value: string): DateTime {\n return DateTime.fromISO(value);\n }\n\n /**\n * Returns the current date and time.\n * @returns {DateTime} The current date and time.\n */\n public getDateNow(): DateTime {\n return DateTime.now();\n }\n\n /**\n * Adds a duration to a given date and returns the result in the specified format.\n * @param date - The date to which the duration will be added.\n * @param years - The number of years to add to the date (default: 0).\n * @param months - The number of months to add to the date (default: 0).\n * @param weeks - The number of weeks to add to the date (default: 0).\n * @param days - The number of days to add to the date (default: 0).\n * @param format - The format in which the resulting date will be returned (default: 'dd/MM/yyyy').\n * @returns The resulting date in the specified format.\n */\n public addDurationToDate(\n date: string,\n years: number = 0,\n months: number = 0,\n weeks: number = 0,\n days: number = 0,\n format: string = 'dd/MM/yyyy',\n ): string {\n const dateObj = this.getFromFormat(date, format);\n const newDate = dateObj.plus({ years, months, weeks, days });\n return newDate.toFormat(format);\n }\n\n /**\n * Calculates the number of days between two dates.\n * @param startDate - The start date in the specified format.\n * @param endDate - The end date in the specified format.\n * @param format - The format of the dates (default: 'dd/MM/yyyy').\n * @returns The number of days between the start and end dates.\n */\n public calculateDaysBetweenDates(startDate: string, endDate: string, format: string = 'dd/MM/yyyy'): number {\n const start = this.getFromFormat(startDate, format);\n const end = this.getFromFormat(endDate, format);\n const diff = end.diff(start, 'days');\n return diff.days;\n }\n\n /**\n * Checks if a given date is in the past.\n * @param date - The date to check.\n * @param format - The format of the date string. Defaults to 'dd/MM/yyyy'.\n * @returns True if the date is in the past, false otherwise.\n */\n public isDateInThePast(date: string, format: string = 'dd/MM/yyyy'): boolean {\n return this.getFromFormat(date, format) < DateTime.now();\n }\n\n /**\n * Checks if a given date is in the future.\n * @param date - The date to check.\n * @param yearsInTheFuture - Optional. The number of years in the future to compare against. If not provided, the current date is used.\n * @param format - Optional. The format of the input date. Defaults to 'dd/MM/yyyy'.\n * @returns True if the date is in the future, false otherwise.\n */\n public isDateInTheFuture(date: string, yearsInTheFuture?: number, format: string = 'dd/MM/yyyy'): boolean {\n const now = DateTime.now();\n const dateValue = this.getFromFormat(date, format);\n\n if (yearsInTheFuture) {\n const futureDate = now.plus({ years: yearsInTheFuture });\n return dateValue > futureDate;\n }\n\n return dateValue > now;\n }\n\n /**\n * Converts a date string from one format to another.\n *\n * @param date - The date string to be converted.\n * @param fromFormat - The format of the input date string.\n * @param toFormat - The desired format of the output date string.\n * @returns The date string in the desired format.\n */\n public getFromFormatToFormat(date: string, fromFormat: string, toFormat: string): string {\n return this.getFromFormat(date, fromFormat).toFormat(toFormat);\n }\n\n /**\n * Calculates the number of days between the current date and a given ISO date string.\n *\n * @param value - An ISO 8601 formatted date string representing the target date.\n * @returns The number of days between the current date and the input date.\n * Returns 0 if the input date is invalid.\n */\n public getDaysAgo(value: string): number {\n const inputDate = this.getFromIso(value).startOf('day');\n\n const now = this.getDateNow().startOf('day');\n return Math.round(now.diff(inputDate, 'days').days);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAMa,WAAW,CAAA;AACtB;;;;;AAKG;IACI,0BAA0B,CAAC,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C,KAAK,CAAC;QAEvD,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;AAC5C,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC;;uGA9M1C,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAX,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,cAFV,MAAM,EAAA,CAAA;;2FAEP,WAAW,EAAA,UAAA,EAAA,CAAA;kBAHvB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACLD;;AAEG;;;;"}
1
+ {"version":3,"file":"hmcts-opal-frontend-common-services-date-service.mjs","sources":["../../../projects/opal-frontend-common/services/date-service/date.service.ts","../../../projects/opal-frontend-common/services/date-service/hmcts-opal-frontend-common-services-date-service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { DateTime, Duration, DurationLikeObject } from 'luxon';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DateService {\n /**\n * Calculates the difference in minutes between two DateTime objects.\n * @param startDate The start date and time.\n * @param endDate The end date and time.\n * @returns The difference in minutes between the start and end dates.\n */\n public calculateMinutesDifference(startDate: DateTime, endDate: DateTime): number {\n const minuteDifference = endDate.diff(startDate, 'minutes');\n return Math.max(0, Math.ceil(minuteDifference.minutes));\n }\n\n /**\n * Converts milliseconds to minutes.\n * @param milliseconds - The number of milliseconds to convert.\n * @returns The equivalent number of minutes.\n */\n public convertMillisecondsToMinutes(milliseconds: number): number {\n const minutes = Duration.fromMillis(milliseconds).as('minutes');\n return Math.max(0, Math.ceil(minutes));\n }\n\n /**\n * Calculates the age based on the given date of birth.\n * @param dateOfBirth - The date of birth to calculate the age from.\n * @param format - The format of the date of birth. Defaults to 'dd/MM/yyyy'.\n * @returns The calculated age.\n */\n public calculateAge(dateOfBirth: DateTime | string, format: string = 'dd/MM/yyyy'): number {\n const date = typeof dateOfBirth === 'string' ? this.getFromFormat(dateOfBirth, format) : dateOfBirth;\n\n return Math.floor(DateTime.now().diff(date, 'years').years);\n }\n\n /**\n * Checks if a given date is valid.\n * @param dateInput - The date to be checked. It can be a DateTime object, a string, or null.\n * @param format - The format of the date string (default: 'dd/MM/yyyy').\n * @returns A boolean indicating whether the date is valid or not.\n */\n public isValidDate(dateInput: DateTime | string | null, format: string = 'dd/MM/yyyy'): boolean {\n if (dateInput) {\n const date = typeof dateInput === 'string' ? this.getFromFormat(dateInput, format) : dateInput;\n return date.isValid;\n }\n return false;\n }\n\n /**\n * Returns a string representation of a date subtracted by the given duration.\n * @param duration A DurationLikeObject representing the amount of time to subtract from the current date.\n * @returns A string representing the subtracted date in the format specified by the current locale.\n */\n public getPreviousDate(duration: DurationLikeObject): string {\n return DateTime.now().minus(duration).setLocale('en-gb').toLocaleString();\n }\n\n /**\n * Parses a string value into a DateTime object based on the specified format.\n * @param value - The string value to parse.\n * @param format - The format of the string value.\n * @returns A DateTime object representing the parsed value.\n */\n public getFromFormat(value: string, format: string): DateTime<true> | DateTime<false> {\n return DateTime.fromFormat(value, format);\n }\n\n /**\n * Parses a string value into a native JavaScript Date object based on the specified format.\n * @param value - The string value to parse.\n * @param format - The format of the string value.\n * @returns A Date object representing the parsed value, or null if parsing fails.\n */\n public getDateFromFormat(value: string, format: string): Date | null {\n const dateTime = DateTime.fromFormat(value, format);\n return dateTime.isValid ? dateTime.toJSDate() : null;\n }\n\n /**\n * Converts a DateTime value to a formatted string.\n *\n * @param value - The DateTime value to format.\n * @param format - The format string to apply to the DateTime value.\n * @returns The formatted string representation of the DateTime value.\n */\n public toFormat(value: DateTime<true> | DateTime<false>, format: string): string {\n return value.toFormat(format);\n }\n\n /**\n * Converts a given Date object to a formatted string based on the specified format.\n *\n * @param value - The Date object to be formatted.\n * @param format - The string format to apply to the Date object.\n * @returns The formatted date string.\n */\n public toDateStringFormat(value: Date, format: string): string {\n return DateTime.fromJSDate(value).toFormat(format);\n }\n\n /**\n * Converts a string in ISO format to a DateTime object.\n * @param value - The string value in ISO format.\n * @returns A DateTime object representing the given value.\n */\n public getFromIso(value: string): DateTime {\n return DateTime.fromISO(value);\n }\n\n /**\n * Returns the current date and time.\n * @returns {DateTime} The current date and time.\n */\n public getDateNow(): DateTime {\n return DateTime.now();\n }\n\n /**\n * Adds a duration to a given date and returns the result in the specified format.\n * @param date - The date to which the duration will be added.\n * @param years - The number of years to add to the date (default: 0).\n * @param months - The number of months to add to the date (default: 0).\n * @param weeks - The number of weeks to add to the date (default: 0).\n * @param days - The number of days to add to the date (default: 0).\n * @param format - The format in which the resulting date will be returned (default: 'dd/MM/yyyy').\n * @returns The resulting date in the specified format.\n */\n public addDurationToDate(\n date: string,\n years: number = 0,\n months: number = 0,\n weeks: number = 0,\n days: number = 0,\n format: string = 'dd/MM/yyyy',\n ): string {\n const dateObj = this.getFromFormat(date, format);\n const newDate = dateObj.plus({ years, months, weeks, days });\n return newDate.toFormat(format);\n }\n\n /**\n * Calculates the number of days between two dates.\n * @param startDate - The start date in the specified format.\n * @param endDate - The end date in the specified format.\n * @param format - The format of the dates (default: 'dd/MM/yyyy').\n * @returns The number of days between the start and end dates.\n */\n public calculateDaysBetweenDates(startDate: string, endDate: string, format: string = 'dd/MM/yyyy'): number {\n const start = this.getFromFormat(startDate, format);\n const end = this.getFromFormat(endDate, format);\n const diff = end.diff(start, 'days');\n return diff.days;\n }\n\n /**\n * Checks if a given date is in the past.\n * @param date - The date to check.\n * @param format - The format of the date string. Defaults to 'dd/MM/yyyy'.\n * @returns True if the date is in the past, false otherwise.\n */\n public isDateInThePast(date: string, format: string = 'dd/MM/yyyy'): boolean {\n return this.getFromFormat(date, format) < DateTime.now();\n }\n\n /**\n * Checks if a given date is in the future.\n * @param date - The date to check.\n * @param yearsInTheFuture - Optional. The number of years in the future to compare against. If not provided, the current date is used.\n * @param format - Optional. The format of the input date. Defaults to 'dd/MM/yyyy'.\n * @returns True if the date is in the future, false otherwise.\n */\n public isDateInTheFuture(date: string, yearsInTheFuture?: number, format: string = 'dd/MM/yyyy'): boolean {\n const now = DateTime.now();\n const dateValue = this.getFromFormat(date, format);\n\n if (yearsInTheFuture) {\n const futureDate = now.plus({ years: yearsInTheFuture });\n return dateValue > futureDate;\n }\n\n return dateValue > now;\n }\n\n /**\n * Converts a date string from one format to another.\n *\n * @param date - The date string to be converted.\n * @param fromFormat - The format of the input date string.\n * @param toFormat - The desired format of the output date string.\n * @returns The date string in the desired format.\n */\n public getFromFormatToFormat(date: string, fromFormat: string, toFormat: string): string {\n return this.getFromFormat(date, fromFormat).toFormat(toFormat);\n }\n\n /**\n * Calculates the number of days between the current date and a given ISO date string.\n *\n * @param value - An ISO 8601 formatted date string representing the target date.\n * @returns The number of days between the current date and the input date.\n * Returns 0 if the input date is invalid.\n */\n public getDaysAgo(value: string): number {\n const inputDate = this.getFromIso(value).startOf('day');\n\n const now = this.getDateNow().startOf('day');\n return Math.round(now.diff(inputDate, 'days').days);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAMa,WAAW,CAAA;AACtB;;;;;AAKG;IACI,0BAA0B,CAAC,SAAmB,EAAE,OAAiB,EAAA;QACtE,MAAM,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;AAC3D,QAAA,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;;AAGzD;;;;AAIG;AACI,IAAA,4BAA4B,CAAC,YAAoB,EAAA;AACtD,QAAA,MAAM,OAA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,EAAA,CAAA;AAAX,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,cAFV,MAAM,EAAA,CAAA;;4FAEP,WAAW,EAAA,UAAA,EAAA,CAAA;kBAHvB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACLD;;AAEG;;;;"}
@@ -80,10 +80,10 @@ class LaunchDarklyService {
80
80
  ngOnDestroy() {
81
81
  this.closeLaunchDarklyClient();
82
82
  }
83
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: LaunchDarklyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
84
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: LaunchDarklyService, providedIn: 'root' });
83
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LaunchDarklyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
84
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LaunchDarklyService, providedIn: 'root' });
85
85
  }
86
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: LaunchDarklyService, decorators: [{
86
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LaunchDarklyService, decorators: [{
87
87
  type: Injectable,
88
88
  args: [{
89
89
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-services-launch-darkly-service.mjs","sources":["../../../projects/opal-frontend-common/services/launch-darkly-service/launch-darkly.service.ts","../../../projects/opal-frontend-common/services/launch-darkly-service/hmcts-opal-frontend-common-services-launch-darkly-service.ts"],"sourcesContent":["import { inject, Injectable, OnDestroy } from '@angular/core';\nimport { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';\nimport { initialize, LDClient, LDFlagChangeset, LDFlagSet } from 'launchdarkly-js-client-sdk';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LaunchDarklyService implements OnDestroy {\n private readonly globalStore = inject(GlobalStore);\n private ldClient!: LDClient;\n\n /**\n * Sets the LaunchDarkly flags by updating the featureFlags in the state service.\n */\n private setLaunchDarklyFlags() {\n if (this.ldClient) {\n this.globalStore.setFeatureFlags(this.ldClient.allFlags());\n }\n }\n\n /**\n * Formats the LDFlagChangeset into an LDFlagSet.\n *\n * @param flags - The LDFlagChangeset to be formatted.\n * @returns The formatted LDFlagSet.\n */\n private formatChangeFlags(flags: LDFlagChangeset): LDFlagSet {\n return Object.keys(flags).reduce((flag: LDFlagSet, key) => {\n flag[key] = flags[key].current;\n return flag;\n }, {});\n }\n\n /**\n * Closes the LaunchDarkly client if it is open.\n */\n private closeLaunchDarklyClient(): void {\n if (this.ldClient) {\n this.ldClient.close();\n }\n }\n\n /**\n * Initializes the LaunchDarkly change listener.\n * This method listens for changes in feature flags and updates the state accordingly.\n */\n public initializeLaunchDarklyChangeListener() {\n if (this.ldClient && this.globalStore.launchDarklyConfig().stream) {\n this.ldClient.on('change', (flags: LDFlagChangeset) => {\n const updatedFlags = { ...this.globalStore.featureFlags(), ...this.formatChangeFlags(flags) };\n this.globalStore.setFeatureFlags(updatedFlags);\n });\n }\n }\n\n /**\n * Initializes the LaunchDarkly flags and sets them.\n * If the LD client is already initialized, it waits for initialization and then sets the flags.\n * If the LD client is not initialized, it returns a resolved promise.\n * @returns A promise that resolves when the flags are set.\n */\n public async initializeLaunchDarklyFlags(): Promise<void> {\n if (this.ldClient) {\n return this.ldClient\n .waitForInitialization(5)\n .then(() => this.setLaunchDarklyFlags())\n .catch((err) => {\n throw err;\n });\n }\n\n return Promise.resolve();\n }\n\n /**\n * Initializes the LaunchDarkly client.\n * If a stored LaunchDarkly client ID exists, it initializes the client with the ID and anonymous mode enabled.\n */\n public initializeLaunchDarklyClient(): void {\n if (this.globalStore.launchDarklyConfig()) {\n const { enabled, clientId } = this.globalStore.launchDarklyConfig();\n\n if (enabled && clientId) {\n this.ldClient = initialize(clientId, {\n anonymous: true,\n });\n }\n }\n }\n\n ngOnDestroy(): void {\n this.closeLaunchDarklyClient();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAOa,mBAAmB,CAAA;AACb,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AAC1C,IAAA,QAAQ;AAEhB;;AAEG;IACK,oBAAoB,GAAA;AAC1B,QAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;AACjB,YAAA,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;;;AAI9D;;;;;AAKG;AACK,IAAA,iBAAiB,CAAC,KAAsB,EAAA;AAC9C,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,IAAe,EAAE,GAAG,KAAI;YACxD,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO;AAC9B,YAAA,OAAO,IAAI;SACZ,EAAE,EAAE,CAAC;;AAGR;;AAEG;IACK,uBAAuB,GAAA;AAC7B,QAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;AACjB,YAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;;;AAIzB;;;AAGG;IACI,oCAAoC,GAAA;AACzC,QAAA,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE;YACjE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAsB,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;;2FAEP,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACND;;AAEG;;;;"}
1
+ {"version":3,"file":"hmcts-opal-frontend-common-services-launch-darkly-service.mjs","sources":["../../../projects/opal-frontend-common/services/launch-darkly-service/launch-darkly.service.ts","../../../projects/opal-frontend-common/services/launch-darkly-service/hmcts-opal-frontend-common-services-launch-darkly-service.ts"],"sourcesContent":["import { inject, Injectable, OnDestroy } from '@angular/core';\nimport { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';\nimport { initialize, LDClient, LDFlagChangeset, LDFlagSet } from 'launchdarkly-js-client-sdk';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LaunchDarklyService implements OnDestroy {\n private readonly globalStore = inject(GlobalStore);\n private ldClient!: LDClient;\n\n /**\n * Sets the LaunchDarkly flags by updating the featureFlags in the state service.\n */\n private setLaunchDarklyFlags() {\n if (this.ldClient) {\n this.globalStore.setFeatureFlags(this.ldClient.allFlags());\n }\n }\n\n /**\n * Formats the LDFlagChangeset into an LDFlagSet.\n *\n * @param flags - The LDFlagChangeset to be formatted.\n * @returns The formatted LDFlagSet.\n */\n private formatChangeFlags(flags: LDFlagChangeset): LDFlagSet {\n return Object.keys(flags).reduce((flag: LDFlagSet, key) => {\n flag[key] = flags[key].current;\n return flag;\n }, {});\n }\n\n /**\n * Closes the LaunchDarkly client if it is open.\n */\n private closeLaunchDarklyClient(): void {\n if (this.ldClient) {\n this.ldClient.close();\n }\n }\n\n /**\n * Initializes the LaunchDarkly change listener.\n * This method listens for changes in feature flags and updates the state accordingly.\n */\n public initializeLaunchDarklyChangeListener() {\n if (this.ldClient && this.globalStore.launchDarklyConfig().stream) {\n this.ldClient.on('change', (flags: LDFlagChangeset) => {\n const updatedFlags = { ...this.globalStore.featureFlags(), ...this.formatChangeFlags(flags) };\n this.globalStore.setFeatureFlags(updatedFlags);\n });\n }\n }\n\n /**\n * Initializes the LaunchDarkly flags and sets them.\n * If the LD client is already initialized, it waits for initialization and then sets the flags.\n * If the LD client is not initialized, it returns a resolved promise.\n * @returns A promise that resolves when the flags are set.\n */\n public async initializeLaunchDarklyFlags(): Promise<void> {\n if (this.ldClient) {\n return this.ldClient\n .waitForInitialization(5)\n .then(() => this.setLaunchDarklyFlags())\n .catch((err) => {\n throw err;\n });\n }\n\n return Promise.resolve();\n }\n\n /**\n * Initializes the LaunchDarkly client.\n * If a stored LaunchDarkly client ID exists, it initializes the client with the ID and anonymous mode enabled.\n */\n public initializeLaunchDarklyClient(): void {\n if (this.globalStore.launchDarklyConfig()) {\n const { enabled, clientId } = this.globalStore.launchDarklyConfig();\n\n if (enabled && clientId) {\n this.ldClient = initialize(clientId, {\n anonymous: true,\n });\n }\n }\n }\n\n ngOnDestroy(): void {\n this.closeLaunchDarklyClient();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAOa,mBAAmB,CAAA;AACb,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AAC1C,IAAA,QAAQ;AAEhB;;AAEG;IACK,oBAAoB,GAAA;AAC1B,QAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;AACjB,YAAA,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;;;AAI9D;;;;;AAKG;AACK,IAAA,iBAAiB,CAAC,KAAsB,EAAA;AAC9C,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,IAAe,EAAE,GAAG,KAAI;YACxD,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO;AAC9B,YAAA,OAAO,IAAI;SACZ,EAAE,EAAE,CAAC;;AAGR;;AAEG;IACK,uBAAuB,GAAA;AAC7B,QAAA,IAA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E;;wGApFrB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cAFlB,MAAM,EAAA,CAAA;;4FAEP,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACND;;AAEG;;;;"}
@@ -29,10 +29,10 @@ class PermissionsService {
29
29
  // if we don't have any roles, we can't have any permissions
30
30
  return true;
31
31
  }
32
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: PermissionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
33
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: PermissionsService, providedIn: 'root' });
32
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: PermissionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
33
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: PermissionsService, providedIn: 'root' });
34
34
  }
35
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: PermissionsService, decorators: [{
35
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: PermissionsService, decorators: [{
36
36
  type: Injectable,
37
37
  args: [{
38
38
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-services-permissions-service.mjs","sources":["../../../projects/opal-frontend-common/services/permissions-service/permissions.service.ts","../../../projects/opal-frontend-common/services/permissions-service/hmcts-opal-frontend-common-services-permissions-service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n ISessionUserState,\n ISessionUserStatePermission,\n ISessionUserStateRole,\n} from '@hmcts/opal-frontend-common/services/session-service/interfaces';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PermissionsService {\n private storedUniquePermissionIds: number[] = [];\n\n /**\n * Retrieves the unique permission IDs associated with the user.\n * If the unique permission IDs have not been stored yet, it calculates them based on the user's roles and permissions.\n * @returns An array of unique permission IDs.\n */\n public getUniquePermissions(userState: ISessionUserState | null): number[] {\n const roles = userState ? userState['business_unit_user'] : null;\n\n if (!this.storedUniquePermissionIds.length && roles) {\n const permissionIds = roles.flatMap((role) => {\n return role.permissions.map(({ permission_id: permissionId }) => permissionId);\n });\n\n this.storedUniquePermissionIds = [...new Set(permissionIds)];\n }\n\n return this.storedUniquePermissionIds;\n }\n\n public hasPermissionAccess(permissionId: number, businessUnitId: number, roles: ISessionUserStateRole[]): boolean {\n if (roles?.length) {\n // First we need to find the matching role\n const role = roles?.find((role) => role.business_unit_id === businessUnitId);\n\n // Then we need to find the matching permission\n const hasPermission = !!role?.permissions.find(\n (permission: ISessionUserStatePermission) => permission.permission_id === permissionId,\n );\n\n return hasPermission;\n }\n // if we don't have any roles, we can't have any permissions\n return true;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAUa,kBAAkB,CAAA;IACrB,yBAAyB,GAAa,EAAE;AAEhD;;;;AAIG;AACI,IAAA,oBAAoB,CAAC,SAAmC,EAAA;AAC7D,QAAA,MAAM,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC,oBAAoB,CAAC,GAAG,IAAI;QAEhE,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,MAAM,IAAI,KAAK,EAAE;YACnD,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;AAC3C,gBAAA,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,YAAY,CAAC;AAChF,aAAC,CAAC;YAEF,IAAI,CAAC,yBAAyB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;;QAG9D,OAAO,IAAI,CAAC,yBAAyB;;AAGhC,IAAA,mBAAmB,CAAC,YAAoB,EAAE,cAAsB,EAAE,KAA8B,EAAA;AACrG,QAAA,IAAI,KAAK,EAAE,MAAM,EAAE;;AAEjB,YAAA,MAAM,IAAI,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,gBAAgB,KAAK,cAAc,CAAC;;YAG5E,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAC5C,CAAC,UAAuC,KAAK,UAAU,CAAC,aAAa,KAAK,YAAY,CACvF;AAED,YAAA,OAAO,aAAa;;;AAGtB,QAAA,OAAO,IAAI;;uGAnCF,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAlB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,cAFjB,MAAM,EAAA,CAAA;;2FAEP,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAH9B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACTD;;AAEG;;;;"}
1
+ {"version":3,"file":"hmcts-opal-frontend-common-services-permissions-service.mjs","sources":["../../../projects/opal-frontend-common/services/permissions-service/permissions.service.ts","../../../projects/opal-frontend-common/services/permissions-service/hmcts-opal-frontend-common-services-permissions-service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n ISessionUserState,\n ISessionUserStatePermission,\n ISessionUserStateRole,\n} from '@hmcts/opal-frontend-common/services/session-service/interfaces';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PermissionsService {\n private storedUniquePermissionIds: number[] = [];\n\n /**\n * Retrieves the unique permission IDs associated with the user.\n * If the unique permission IDs have not been stored yet, it calculates them based on the user's roles and permissions.\n * @returns An array of unique permission IDs.\n */\n public getUniquePermissions(userState: ISessionUserState | null): number[] {\n const roles = userState ? userState['business_unit_user'] : null;\n\n if (!this.storedUniquePermissionIds.length && roles) {\n const permissionIds = roles.flatMap((role) => {\n return role.permissions.map(({ permission_id: permissionId }) => permissionId);\n });\n\n this.storedUniquePermissionIds = [...new Set(permissionIds)];\n }\n\n return this.storedUniquePermissionIds;\n }\n\n public hasPermissionAccess(permissionId: number, businessUnitId: number, roles: ISessionUserStateRole[]): boolean {\n if (roles?.length) {\n // First we need to find the matching role\n const role = roles?.find((role) => role.business_unit_id === businessUnitId);\n\n // Then we need to find the matching permission\n const hasPermission = !!role?.permissions.find(\n (permission: ISessionUserStatePermission) => permission.permission_id === permissionId,\n );\n\n return hasPermission;\n }\n // if we don't have any roles, we can't have any permissions\n return true;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAUa,kBAAkB,CAAA;IACrB,yBAAyB,GAAa,EAAE;AAEhD;;;;AAIG;AACI,IAAA,oBAAoB,CAAC,SAAmC,EAAA;AAC7D,QAAA,MAAM,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC,oBAAoB,CAAC,GAAG,IAAI;QAEhE,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,MAAM,IAAI,KAAK,EAAE;YACnD,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;AAC3C,gBAAA,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,YAAY,CAAC;AAChF,aAAC,CAAC;YAEF,IAAI,CAAC,yBAAyB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;;QAG9D,OAAO,IAAI,CAAC,yBAAyB;;AAGhC,IAAA,mBAAmB,CAAC,YAAoB,EAAE,cAAsB,EAAE,KAA8B,EAAA;AACrG,QAAA,IAAI,KAAK,EAAE,MAAM,EAAE;;AAEjB,YAAA,MAAM,IAAI,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,gBAAgB,KAAK,cAAc,CAAC;;YAG5E,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAC5C,CAAC,UAAuC,KAAK,UAAU,CAAC,aAAa,KAAK,YAAY,CACvF;AAED,YAAA,OAAO,aAAa;;;AAGtB,QAAA,OAAO,IAAI;;wGAnCF,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAlB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,cAFjB,MAAM,EAAA,CAAA;;4FAEP,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAH9B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACTD;;AAEG;;;;"}
@@ -51,10 +51,10 @@ class SessionService {
51
51
  }), shareReplay(1));
52
52
  return this.tokenExpiryCache$;
53
53
  }
54
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: SessionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
55
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: SessionService, providedIn: 'root' });
54
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: SessionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
55
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: SessionService, providedIn: 'root' });
56
56
  }
57
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: SessionService, decorators: [{
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: SessionService, decorators: [{
58
58
  type: Injectable,
59
59
  args: [{
60
60
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-services-session-service.mjs","sources":["../../../projects/opal-frontend-common/services/session-service/session.service.ts","../../../projects/opal-frontend-common/services/session-service/hmcts-opal-frontend-common-services-session-service.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { Observable, retry, shareReplay, tap, timer } from 'rxjs';\nimport { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';\nimport { SESSION_ENDPOINTS } from '@hmcts/opal-frontend-common/services/session-service/constants';\nimport {\n ISessionUserState,\n ISessionTokenExpiry,\n} from '@hmcts/opal-frontend-common/services/session-service/interfaces';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SessionService {\n private readonly http = inject(HttpClient);\n private readonly globalStore = inject(GlobalStore);\n private userStateCache$!: Observable<ISessionUserState>;\n private tokenExpiryCache$!: Observable<ISessionTokenExpiry>;\n\n private readonly MAX_RETRIES = 5;\n private readonly RETRY_DELAY_MS = 1000;\n\n /**\n * Retrieves the user state from the backend.\n * If the user state is not available or needs to be refreshed, it makes an HTTP request to fetch the user state.\n * The user state is then stored in the state service for future use.\n * The user state is cached using the `shareReplay` operator to avoid unnecessary HTTP requests.\n * @returns An observable that emits the user state.\n */\n public getUserState(): Observable<ISessionUserState> {\n // The backend can return an empty object so...\n // If we don't have a user state, then we need to refresh it...\n // And override the shareReplay cache...\n const refresh = !this.globalStore.userState()?.user_id;\n\n if (!this.userStateCache$ || refresh) {\n this.userStateCache$ = this.http\n .get<ISessionUserState>(SESSION_ENDPOINTS.userState)\n .pipe(shareReplay(1))\n .pipe(\n tap((userState) => {\n this.globalStore.setUserState(userState);\n }),\n );\n }\n\n return this.userStateCache$;\n }\n\n /**\n * Retrieves the token expiry information from the server.\n * If the token expiry information is already cached, it returns the cached value.\n * Otherwise, it makes an HTTP GET request to fetch the token expiry information,\n * retries the request up to a maximum number of times if it fails, and caches the result.\n *\n * @returns {Observable<ISessionTokenExpiry>} An observable that emits the token expiry information.\n */\n public getTokenExpiry(): Observable<ISessionTokenExpiry> {\n this.tokenExpiryCache$ ??= this.http.get<ISessionTokenExpiry>(SESSION_ENDPOINTS.expiry).pipe(\n retry({\n count: this.MAX_RETRIES,\n delay: () => timer(this.RETRY_DELAY_MS),\n }),\n tap((expiry) => {\n this.globalStore.setTokenExpiry(expiry);\n }),\n shareReplay(1),\n );\n return this.tokenExpiryCache$;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAaa,cAAc,CAAA;AACR,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AACzB,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AAC1C,IAAA,eAAe;AACf,IAAA,iBAAiB;IAER,WAAW,GAAG,CAAC;IACf,cAAc,GAAG,IAAI;AAEtC;;;;;;AAMG;IACI,YAAY,GAAA;;;;QAIjB,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,EAAE,OAAO;AAEtD,QAAA,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,OAAO,EAAE;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-session-service.mjs","sources":["../../../projects/opal-frontend-common/services/session-service/session.service.ts","../../../projects/opal-frontend-common/services/session-service/hmcts-opal-frontend-common-services-session-service.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { Observable, retry, shareReplay, tap, timer } from 'rxjs';\nimport { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';\nimport { SESSION_ENDPOINTS } from '@hmcts/opal-frontend-common/services/session-service/constants';\nimport {\n ISessionUserState,\n ISessionTokenExpiry,\n} from '@hmcts/opal-frontend-common/services/session-service/interfaces';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SessionService {\n private readonly http = inject(HttpClient);\n private readonly globalStore = inject(GlobalStore);\n private userStateCache$!: Observable<ISessionUserState>;\n private tokenExpiryCache$!: Observable<ISessionTokenExpiry>;\n\n private readonly MAX_RETRIES = 5;\n private readonly RETRY_DELAY_MS = 1000;\n\n /**\n * Retrieves the user state from the backend.\n * If the user state is not available or needs to be refreshed, it makes an HTTP request to fetch the user state.\n * The user state is then stored in the state service for future use.\n * The user state is cached using the `shareReplay` operator to avoid unnecessary HTTP requests.\n * @returns An observable that emits the user state.\n */\n public getUserState(): Observable<ISessionUserState> {\n // The backend can return an empty object so...\n // If we don't have a user state, then we need to refresh it...\n // And override the shareReplay cache...\n const refresh = !this.globalStore.userState()?.user_id;\n\n if (!this.userStateCache$ || refresh) {\n this.userStateCache$ = this.http\n .get<ISessionUserState>(SESSION_ENDPOINTS.userState)\n .pipe(shareReplay(1))\n .pipe(\n tap((userState) => {\n this.globalStore.setUserState(userState);\n }),\n );\n }\n\n return this.userStateCache$;\n }\n\n /**\n * Retrieves the token expiry information from the server.\n * If the token expiry information is already cached, it returns the cached value.\n * Otherwise, it makes an HTTP GET request to fetch the token expiry information,\n * retries the request up to a maximum number of times if it fails, and caches the result.\n *\n * @returns {Observable<ISessionTokenExpiry>} An observable that emits the token expiry information.\n */\n public getTokenExpiry(): Observable<ISessionTokenExpiry> {\n this.tokenExpiryCache$ ??= this.http.get<ISessionTokenExpiry>(SESSION_ENDPOINTS.expiry).pipe(\n retry({\n count: this.MAX_RETRIES,\n delay: () => timer(this.RETRY_DELAY_MS),\n }),\n tap((expiry) => {\n this.globalStore.setTokenExpiry(expiry);\n }),\n shareReplay(1),\n );\n return this.tokenExpiryCache$;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAaa,cAAc,CAAA;AACR,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AACzB,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AAC1C,IAAA,eAAe;AACf,IAAA,iBAAiB;IAER,WAAW,GAAG,CAAC;IACf,cAAc,GAAG,IAAI;AAEtC;;;;;;AAMG;IACI,YAAY,GAAA;;;;QAIjB,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,EAAE,OAAO;AAEtD,QAAA,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,OAAO,EAAE;AACpC,YAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;AACzB,iBAAA,GAAG,CAAoB,iBAAiB,CAAC,SAAS;AAClD,iBAAA,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;AACnB,iBAAA,IAAI,CACH,GAAG,CAAC,CAAC,SAAS,KAAI;AAChB,gBAAA,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC;aACzC,CAAC,CACH;;QAGL,OAAO,IAAI,CAAC,eAAe;;AAG7B;;;;;;;AAOG;IACI,cAAc,GAAA;AACnB,QAAA,IAAI,CAAC,iBAAiB,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAsB,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAC1F,KAAK,CAAC;YACJ,KAAK,EAAE,IAAI,CAAC,WAAW;YACvB,KAAK,EAAE,MAAM,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC;AACxC,SAAA,CAAC,EACF,GAAG,CAAC,CAAC,MAAM,KAAI;AACb,YAAA,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,MAAM,CAAC;AACzC,SAAC,CAAC,EACF,WAAW,CAAC,CAAC,CAAC,CACf;QACD,OAAO,IAAI,CAAC,iBAAiB;;wGAvDpB,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cAFb,MAAM,EAAA,CAAA;;4FAEP,cAAc,EAAA,UAAA,EAAA,CAAA;kBAH1B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACZD;;AAEG;;;;"}
@@ -79,10 +79,10 @@ class SortService {
79
79
  sortObjectArrayDesc(array, key) {
80
80
  return this.sortObjectArray(array, { key, sortType: 'descending' });
81
81
  }
82
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: SortService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
83
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: SortService, providedIn: 'root' });
82
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: SortService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
83
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: SortService, providedIn: 'root' });
84
84
  }
85
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: SortService, decorators: [{
85
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: SortService, decorators: [{
86
86
  type: Injectable,
87
87
  args: [{
88
88
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-services-sort-service.mjs","sources":["../../../projects/opal-frontend-common/services/sort-service/sort.service.ts","../../../projects/opal-frontend-common/services/sort-service/hmcts-opal-frontend-common-services-sort-service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { sort } from 'fast-sort';\nimport {\n ISortServiceConfig,\n ISortServiceValues,\n ISortServiceArrayValues,\n} from '@hmcts/opal-frontend-common/services/sort-service/interfaces';\nimport { SortableValuesType } from '@hmcts/opal-frontend-common/components/abstract/abstract-sortable-table/types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SortService {\n /**\n * Sorts an array of values in ascending order.\n *\n * @param array - The array of values to be sorted.\n * @returns The sorted array in ascending order.\n */\n public arraySortAsc(array: ISortServiceArrayValues): ISortServiceArrayValues {\n return sort(array).asc();\n }\n\n /**\n * Sorts an array of values in descending order.\n *\n * @param array - The array of values to be sorted.\n * @returns The sorted array in descending order.\n */\n public arraySortDesc(array: ISortServiceArrayValues): ISortServiceArrayValues {\n return sort(array).desc();\n }\n\n /**\n * Sorts an array of objects based on a specified key and sort type.\n *\n * @param array - The array of objects to be sorted. Each object should implement the `ISortServiceValues` interface.\n * @param config - The configuration object containing the key to sort by and the sort type (ascending or descending).\n * @returns The sorted array of objects.\n *\n * @remarks\n * - If the input array is not an array or the config key is not provided, the original array is returned.\n * - The `sortType` can be either 'ascending' or 'descending'.\n *\n * @example\n * ```typescript\n * const array = [\n * { name: 'Alice', age: 30 },\n * { name: 'Bob', age: 25 },\n * ];\n * const config = { key: 'age', sortType: 'ascending' };\n * const sortedArray = getObjects(array, config);\n * // sortedArray will be:\n * // [\n * // { name: 'Bob', age: 25 },\n * // { name: 'Alice', age: 30 },\n * // ]\n * ```\n */\n private sortObjectArray(\n array: ISortServiceValues<SortableValuesType>[] | null,\n config: ISortServiceConfig,\n ): ISortServiceValues<SortableValuesType>[] | null {\n if (!Array.isArray(array) || !config.key) {\n return array;\n }\n\n const { key, sortType } = config;\n\n if (sortType === 'ascending') {\n return sort(array).asc((obj) => obj[key]);\n } else {\n return sort(array).desc((obj) => obj[key]);\n }\n }\n\n /**\n * Sorts an array of objects in ascending order based on the specified key.\n *\n * @param array - The array of objects to be sorted.\n * @param key - The key of the object property to sort by.\n * @returns The sorted array of objects.\n */\n public sortObjectArrayAsc(\n array: ISortServiceValues<SortableValuesType>[] | null,\n key: string,\n ): ISortServiceValues<SortableValuesType>[] | null {\n return this.sortObjectArray(array, { key, sortType: 'ascending' });\n }\n\n /**\n * Sorts an array of objects in descending order based on the specified key.\n *\n * @param array - The array of objects to be sorted. Each object should implement the ISortServiceValues interface.\n * @param key - The key of the object property to sort by.\n * @returns The sorted array of objects in descending order.\n */\n public sortObjectArrayDesc(\n array: ISortServiceValues<SortableValuesType>[] | null,\n key: string,\n ): ISortServiceValues<SortableValuesType>[] | null {\n return this.sortObjectArray(array, { key, sortType: 'descending' });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAYa,WAAW,CAAA;AACtB;;;;;AAKG;AACI,IAAA,YAAY,CAAC,KAA8B,EAAA;AAChD,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE;;AAG1B;;;;;AAKG;AACI,IAAA,aAAa,CAAC,KAA8B,EAAA;AACjD,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE;;AAG3B;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;IACK,eAAe,CACrB,KAAsD,EACtD,MAA0B,EAAA;AAE1B,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;AACxC,YAAA,OAAO,KAAK;;AAGd,QAAA,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,MAAM;AAEhC,QAAA,IAAI,QAAQ,KAAK,WAAW,EAAE;AAC5B,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;;aACpC;AACL,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;;;AAI9C;;;;;;AAMG;IACI,kBAAkB,CACvB,KAAsD,EACtD,GAAW,EAAA;AAEX,QAAA,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;;AAGpE;;;;;;AAMG;IACI,mBAAmB,CACxB,KAAsD,EACtD,GAAW,EAAA;AAEX,QAAA,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;;uGAzF1D,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAX,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,cAFV,MAAM,EAAA,CAAA;;2FAEP,WAAW,EAAA,UAAA,EAAA,CAAA;kBAHvB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACXD;;AAEG;;;;"}
1
+ {"version":3,"file":"hmcts-opal-frontend-common-services-sort-service.mjs","sources":["../../../projects/opal-frontend-common/services/sort-service/sort.service.ts","../../../projects/opal-frontend-common/services/sort-service/hmcts-opal-frontend-common-services-sort-service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { sort } from 'fast-sort';\nimport {\n ISortServiceConfig,\n ISortServiceValues,\n ISortServiceArrayValues,\n} from '@hmcts/opal-frontend-common/services/sort-service/interfaces';\nimport { SortableValuesType } from '@hmcts/opal-frontend-common/components/abstract/abstract-sortable-table/types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SortService {\n /**\n * Sorts an array of values in ascending order.\n *\n * @param array - The array of values to be sorted.\n * @returns The sorted array in ascending order.\n */\n public arraySortAsc(array: ISortServiceArrayValues): ISortServiceArrayValues {\n return sort(array).asc();\n }\n\n /**\n * Sorts an array of values in descending order.\n *\n * @param array - The array of values to be sorted.\n * @returns The sorted array in descending order.\n */\n public arraySortDesc(array: ISortServiceArrayValues): ISortServiceArrayValues {\n return sort(array).desc();\n }\n\n /**\n * Sorts an array of objects based on a specified key and sort type.\n *\n * @param array - The array of objects to be sorted. Each object should implement the `ISortServiceValues` interface.\n * @param config - The configuration object containing the key to sort by and the sort type (ascending or descending).\n * @returns The sorted array of objects.\n *\n * @remarks\n * - If the input array is not an array or the config key is not provided, the original array is returned.\n * - The `sortType` can be either 'ascending' or 'descending'.\n *\n * @example\n * ```typescript\n * const array = [\n * { name: 'Alice', age: 30 },\n * { name: 'Bob', age: 25 },\n * ];\n * const config = { key: 'age', sortType: 'ascending' };\n * const sortedArray = getObjects(array, config);\n * // sortedArray will be:\n * // [\n * // { name: 'Bob', age: 25 },\n * // { name: 'Alice', age: 30 },\n * // ]\n * ```\n */\n private sortObjectArray(\n array: ISortServiceValues<SortableValuesType>[] | null,\n config: ISortServiceConfig,\n ): ISortServiceValues<SortableValuesType>[] | null {\n if (!Array.isArray(array) || !config.key) {\n return array;\n }\n\n const { key, sortType } = config;\n\n if (sortType === 'ascending') {\n return sort(array).asc((obj) => obj[key]);\n } else {\n return sort(array).desc((obj) => obj[key]);\n }\n }\n\n /**\n * Sorts an array of objects in ascending order based on the specified key.\n *\n * @param array - The array of objects to be sorted.\n * @param key - The key of the object property to sort by.\n * @returns The sorted array of objects.\n */\n public sortObjectArrayAsc(\n array: ISortServiceValues<SortableValuesType>[] | null,\n key: string,\n ): ISortServiceValues<SortableValuesType>[] | null {\n return this.sortObjectArray(array, { key, sortType: 'ascending' });\n }\n\n /**\n * Sorts an array of objects in descending order based on the specified key.\n *\n * @param array - The array of objects to be sorted. Each object should implement the ISortServiceValues interface.\n * @param key - The key of the object property to sort by.\n * @returns The sorted array of objects in descending order.\n */\n public sortObjectArrayDesc(\n array: ISortServiceValues<SortableValuesType>[] | null,\n key: string,\n ): ISortServiceValues<SortableValuesType>[] | null {\n return this.sortObjectArray(array, { key, sortType: 'descending' });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAYa,WAAW,CAAA;AACtB;;;;;AAKG;AACI,IAAA,YAAY,CAAC,KAA8B,EAAA;AAChD,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE;;AAG1B;;;;;AAKG;AACI,IAAA,aAAa,CAAC,KAA8B,EAAA;AACjD,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE;;AAG3B;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;IACK,eAAe,CACrB,KAAsD,EACtD,MAA0B,EAAA;AAE1B,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;AACxC,YAAA,OAAO,KAAK;;AAGd,QAAA,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,MAAM;AAEhC,QAAA,IAAI,QAAQ,KAAK,WAAW,EAAE;AAC5B,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;;aACpC;AACL,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;;;AAI9C;;;;;;AAMG;IACI,kBAAkB,CACvB,KAAsD,EACtD,GAAW,EAAA;AAEX,QAAA,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;;AAGpE;;;;;;AAMG;IACI,mBAAmB,CACxB,KAAsD,EACtD,GAAW,EAAA;AAEX,QAAA,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;;wGAzF1D,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAX,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,cAFV,MAAM,EAAA,CAAA;;4FAEP,WAAW,EAAA,UAAA,EAAA,CAAA;kBAHvB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACXD;;AAEG;;;;"}
@@ -47,10 +47,10 @@ class TransferStateService {
47
47
  initializeAppInsightsConfig() {
48
48
  this.globalStore.setAppInsightsConfig(this.storedServerTransferState?.appInsightsConfig);
49
49
  }
50
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: TransferStateService, deps: [{ token: PLATFORM_ID }, { token: 'serverTransferState', optional: true }, { token: i0.TransferState }], target: i0.ɵɵFactoryTarget.Injectable });
51
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: TransferStateService, providedIn: 'root' });
50
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: TransferStateService, deps: [{ token: PLATFORM_ID }, { token: 'serverTransferState', optional: true }, { token: i0.TransferState }], target: i0.ɵɵFactoryTarget.Injectable });
51
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: TransferStateService, providedIn: 'root' });
52
52
  }
53
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: TransferStateService, decorators: [{
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: TransferStateService, decorators: [{
54
54
  type: Injectable,
55
55
  args: [{
56
56
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-services-transfer-state-service.mjs","sources":["../../../projects/opal-frontend-common/services/transfer-state-service/transfer-state.service.ts","../../../projects/opal-frontend-common/services/transfer-state-service/hmcts-opal-frontend-common-services-transfer-state-service.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport { Inject, Injectable, Optional, PLATFORM_ID, TransferState, inject, makeStateKey } from '@angular/core';\nimport { ITransferStateServerState } from '@hmcts/opal-frontend-common/services/transfer-state-service/interfaces';\nimport { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TransferStateService {\n private readonly globalStore = inject(GlobalStore);\n private readonly storedServerTransferState!: ITransferStateServerState;\n\n constructor(\n @Inject(PLATFORM_ID) private readonly platformId: typeof PLATFORM_ID,\n @Optional()\n @Inject('serverTransferState')\n public readonly serverTransferState: ITransferStateServerState | null,\n private readonly transferState: TransferState,\n ) {\n const storeKeyTransferState = makeStateKey<ITransferStateServerState>('serverTransferState');\n\n if (isPlatformBrowser(this.platformId)) {\n // get user state from transfer state if browser side\n this.serverTransferState = this.transferState.get(storeKeyTransferState, null);\n\n if (this.serverTransferState) {\n this.storedServerTransferState = this.serverTransferState;\n }\n } else {\n // server side: store server transfer state\n this.transferState.set(storeKeyTransferState, this.serverTransferState);\n }\n }\n\n /**\n * Initializes the SSO (Single Sign-On) enabled state.\n * Sets the SSO enabled state based on the stored server transfer state.\n */\n public initializeSsoEnabled(): void {\n this.globalStore.setSsoEnabled(this.storedServerTransferState?.ssoEnabled);\n }\n\n /**\n * Initializes the LaunchDarkly configuration by assigning the stored server transfer state's\n * launchDarklyConfig value to the globalStore's launchDarklyConfig property.\n */\n public initializeLaunchDarklyConfig(): void {\n this.globalStore.setLaunchDarklyConfig(this.storedServerTransferState?.launchDarklyConfig);\n }\n\n /**\n * Initializes the Application Insights configuration by assigning the stored server transfer state's\n * appInsightsConfig value to the globalStore's appInsightsConfig property.\n */\n public initializeAppInsightsConfig(): void {\n this.globalStore.setAppInsightsConfig(this.storedServerTransferState?.appInsightsConfig);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAQa,oBAAoB,CAAA;AAKS,IAAA,UAAA;AAGtB,IAAA,mBAAA;AACC,IAAA,aAAA;AARF,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AACjC,IAAA,yBAAyB;AAE1C,IAAA,WAAA,CACwC,UAA8B,EAGpD,mBAAqD,EACpD,aAA4B,EAAA;QAJP,IAAU,CAAA,UAAA,GAAV,UAAU;QAGhC,IAAmB,CAAA,mBAAA,GAAnB,mBAAmB;QAClB,IAAa,CAAA,aAAA,GAAb,aAAa;AAE9B,QAAA,MAAM,qBAAqB,GAAG,YAAY,CAA4B,qBAAqB,CAAC;AAE5F,QAAA,IAAI,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;;AAEtC,YAAA,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,qBAAqB,EAAE,IAAI,CAAC;AAE9E,YAAA,IAAI,IAAI,CAAC,mBAAmB,EAAE;AAC5B,gBAAA,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC,mBAAmB;;;aAEtD;;YAEL,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,qBAAqB,EAAE,IAAI,CAAC,mBAAmB,CAAC;;;AAI3E;;;AAGG;IACI,oBAAoB,GAAA;QACzB,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,yBAAyB,EAAE,UAAU,CAAC;;AAG5E;;;AAGG;IACI,4BAA4B,GAAA;QACjC,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,IAAI,CAAC,yBAAyB,EAAE,kBAAkB,CAAC;;AAG5F;;;AAGG;IACI,2BAA2B,GAAA;QAChC,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,yBAAyB,EAAE,iBAAiB,CAAC;;uGA/C/E,oBAAoB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAKrB,WAAW,EAAA,EAAA,EAAA,KAAA,EAEX,qBAAqB,EAAA,QAAA,EAAA,IAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,aAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAPpB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cAFnB,MAAM,EAAA,CAAA;;2FAEP,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;0BAMI,MAAM;2BAAC,WAAW;;0BAClB;;0BACA,MAAM;2BAAC,qBAAqB;;;ACfjC;;AAEG;;;;"}
1
+ {"version":3,"file":"hmcts-opal-frontend-common-services-transfer-state-service.mjs","sources":["../../../projects/opal-frontend-common/services/transfer-state-service/transfer-state.service.ts","../../../projects/opal-frontend-common/services/transfer-state-service/hmcts-opal-frontend-common-services-transfer-state-service.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport { Inject, Injectable, Optional, PLATFORM_ID, TransferState, inject, makeStateKey } from '@angular/core';\nimport { ITransferStateServerState } from '@hmcts/opal-frontend-common/services/transfer-state-service/interfaces';\nimport { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TransferStateService {\n private readonly globalStore = inject(GlobalStore);\n private readonly storedServerTransferState!: ITransferStateServerState;\n\n constructor(\n @Inject(PLATFORM_ID) private readonly platformId: typeof PLATFORM_ID,\n @Optional()\n @Inject('serverTransferState')\n public readonly serverTransferState: ITransferStateServerState | null,\n private readonly transferState: TransferState,\n ) {\n const storeKeyTransferState = makeStateKey<ITransferStateServerState>('serverTransferState');\n\n if (isPlatformBrowser(this.platformId)) {\n // get user state from transfer state if browser side\n this.serverTransferState = this.transferState.get(storeKeyTransferState, null);\n\n if (this.serverTransferState) {\n this.storedServerTransferState = this.serverTransferState;\n }\n } else {\n // server side: store server transfer state\n this.transferState.set(storeKeyTransferState, this.serverTransferState);\n }\n }\n\n /**\n * Initializes the SSO (Single Sign-On) enabled state.\n * Sets the SSO enabled state based on the stored server transfer state.\n */\n public initializeSsoEnabled(): void {\n this.globalStore.setSsoEnabled(this.storedServerTransferState?.ssoEnabled);\n }\n\n /**\n * Initializes the LaunchDarkly configuration by assigning the stored server transfer state's\n * launchDarklyConfig value to the globalStore's launchDarklyConfig property.\n */\n public initializeLaunchDarklyConfig(): void {\n this.globalStore.setLaunchDarklyConfig(this.storedServerTransferState?.launchDarklyConfig);\n }\n\n /**\n * Initializes the Application Insights configuration by assigning the stored server transfer state's\n * appInsightsConfig value to the globalStore's appInsightsConfig property.\n */\n public initializeAppInsightsConfig(): void {\n this.globalStore.setAppInsightsConfig(this.storedServerTransferState?.appInsightsConfig);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\n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AAA,KAAA,EAEX,qBAAqB,EAAA,QAAA,EAAA,IAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,aAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAPpB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cAFnB,MAAM,EAAA,CAAA;;4FAEP,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;0BAMI,MAAM;2BAAC,WAAW;;0BAClB;;0BACA,MAAM;2BAAC,qBAAqB;;;ACfjC;;AAEG;;;;"}
@@ -58,10 +58,10 @@ class TransformationService {
58
58
  }
59
59
  return obj;
60
60
  }
61
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: TransformationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
62
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: TransformationService, providedIn: 'root' });
61
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: TransformationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
62
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: TransformationService, providedIn: 'root' });
63
63
  }
64
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: TransformationService, decorators: [{
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: TransformationService, decorators: [{
65
65
  type: Injectable,
66
66
  args: [{
67
67
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-services-transformation-service.mjs","sources":["../../../projects/opal-frontend-common/services/transformation-service/transformation.service.ts","../../../projects/opal-frontend-common/services/transformation-service/hmcts-opal-frontend-common-services-transformation-service.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { ITransformItem } from '@hmcts/opal-frontend-common/services/transformation-service/interfaces';\nimport { DateService } from '@hmcts/opal-frontend-common/services/date-service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TransformationService {\n private readonly dateService = inject(DateService);\n\n /**\n * Applies a transformation to the given value based on the specified transformation configuration.\n *\n * @param value - The value to be transformed.\n * @param transformItem - The configuration for the transformation, including the type of transformation and any necessary format details.\n * @returns The transformed value, or the original value if no transformation is applied.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private applyTransformation(value: any, transformItem: ITransformItem): any {\n if (!value) {\n return value;\n }\n\n if (transformItem.transformType === 'date') {\n if (transformItem.dateInputFormat !== null && transformItem.dateOutputFormat !== null) {\n const parsedDate = this.dateService.getFromFormat(value, transformItem.dateInputFormat);\n if (this.dateService.isValidDate(parsedDate)) {\n return this.dateService.toFormat(parsedDate, transformItem.dateOutputFormat);\n }\n }\n return value;\n }\n\n return value;\n }\n\n /**\n * Transforms the values of an object based on a given transformation configuration.\n *\n * @param obj - The object whose values need to be transformed. It should be a non-null object.\n * @param toTransform - An array of transformation configurations, where each configuration specifies\n * the key to transform and the transformation details.\n * @returns The transformed object with values modified according to the transformation configuration.\n *\n * @remarks\n * - If the input `obj` is not an object or is null, it returns the input as is.\n * - The function recursively processes nested objects.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public transformObjectValues(obj: { [key: string]: any }, toTransform: ITransformItem[]): any {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n for (const [key, value] of Object.entries(obj)) {\n const transformItem = toTransform.find((item) => item.key === key);\n\n if (transformItem) {\n obj[key] = this.applyTransformation(value, transformItem);\n } else if (Array.isArray(value)) {\n obj[key] = value.map((item) =>\n typeof item === 'object' ? this.transformObjectValues(item, toTransform) : item,\n );\n } else if (typeof value === 'object') {\n obj[key] = this.transformObjectValues(value, toTransform); // Recursive call\n }\n }\n return obj;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAOa,qBAAqB,CAAA;AACf,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AAElD;;;;;;AAMG;;IAEK,mBAAmB,CAAC,KAAU,EAAE,aAA6B,EAAA;QACnE,IAAI,CAAC,KAAK,EAAE;AACV,YAAA,OAAO,KAAK;;AAGd,QAAA,IAAI,aAAa,CAAC,aAAa,KAAK,MAAM,EAAE;AAC1C,YAAA,IAAI,aAAa,CAAC,eAAe,KAAK,IAAI,IAAI,aAAa,CAAC,gBAAgB,KAAK,IAAI,EAAE;AACrF,gBAAA,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC;gBACvF,IAAI,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE;AAC5C,oBAAA,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC;;;AAGhF,YAAA,OAAO,KAAK;;AAGd,QAAA,OAAO,KAAK;;AAGd;;;;;;;;;;;AAWG;;IAEI,qBAAqB,CAAC,GAA2B,EAAE,WAA6B,EAAA;QACrF,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE;AAC3C,YAAA,OAAO,GAAG;;AAGZ,QAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;AAC9C,YAAA,MAAM,aAAa,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC;YAElE,IAAI,aAAa,EAAE;AACjB,gBAAA,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,aAAa,CAAC;;AACpD,iBAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AAC/B,gBAAA,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KACxB,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,IAAI,CAChF;;AACI,iBAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACpC,gBAAA,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;;;AAG9D,QAAA,OAAO,GAAG;;uGA5DD,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAArB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,cAFpB,MAAM,EAAA,CAAA;;2FAEP,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACND;;AAEG;;;;"}
1
+ {"version":3,"file":"hmcts-opal-frontend-common-services-transformation-service.mjs","sources":["../../../projects/opal-frontend-common/services/transformation-service/transformation.service.ts","../../../projects/opal-frontend-common/services/transformation-service/hmcts-opal-frontend-common-services-transformation-service.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { ITransformItem } from '@hmcts/opal-frontend-common/services/transformation-service/interfaces';\nimport { DateService } from '@hmcts/opal-frontend-common/services/date-service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TransformationService {\n private readonly dateService = inject(DateService);\n\n /**\n * Applies a transformation to the given value based on the specified transformation configuration.\n *\n * @param value - The value to be transformed.\n * @param transformItem - The configuration for the transformation, including the type of transformation and any necessary format details.\n * @returns The transformed value, or the original value if no transformation is applied.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private applyTransformation(value: any, transformItem: ITransformItem): any {\n if (!value) {\n return value;\n }\n\n if (transformItem.transformType === 'date') {\n if (transformItem.dateInputFormat !== null && transformItem.dateOutputFormat !== null) {\n const parsedDate = this.dateService.getFromFormat(value, transformItem.dateInputFormat);\n if (this.dateService.isValidDate(parsedDate)) {\n return this.dateService.toFormat(parsedDate, transformItem.dateOutputFormat);\n }\n }\n return value;\n }\n\n return value;\n }\n\n /**\n * Transforms the values of an object based on a given transformation configuration.\n *\n * @param obj - The object whose values need to be transformed. It should be a non-null object.\n * @param toTransform - An array of transformation configurations, where each configuration specifies\n * the key to transform and the transformation details.\n * @returns The transformed object with values modified according to the transformation configuration.\n *\n * @remarks\n * - If the input `obj` is not an object or is null, it returns the input as is.\n * - The function recursively processes nested objects.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public transformObjectValues(obj: { [key: string]: any }, toTransform: ITransformItem[]): any {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n for (const [key, value] of Object.entries(obj)) {\n const transformItem = toTransform.find((item) => item.key === key);\n\n if (transformItem) {\n obj[key] = this.applyTransformation(value, transformItem);\n } else if (Array.isArray(value)) {\n obj[key] = value.map((item) =>\n typeof item === 'object' ? this.transformObjectValues(item, toTransform) : item,\n );\n } else if (typeof value === 'object') {\n obj[key] = this.transformObjectValues(value, toTransform); // Recursive call\n }\n }\n return obj;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],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,gBAAA,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KACxB,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,IAAI,CAChF;;AACI,iBAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACpC,gBAAA,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;;;AAG9D,QAAA,OAAO,GAAG;;wGA5DD,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAArB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,cAFpB,MAAM,EAAA,CAAA;;4FAEP,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACND;;AAEG;;;;"}
@@ -87,10 +87,41 @@ class UtilsService {
87
87
  copyToClipboard(value) {
88
88
  return navigator.clipboard.writeText(value);
89
89
  }
90
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
91
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: UtilsService, providedIn: 'root' });
90
+ /**
91
+ * Recursively filters out properties from an object where the value is `null` or `undefined`.
92
+ *
93
+ * @param obj - The object to filter. Can include nested objects.
94
+ * @returns A new object with only non-null and non-undefined values.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const input = {
99
+ * a: 1,
100
+ * b: null,
101
+ * c: undefined,
102
+ * d: 'hello',
103
+ * e: { x: null, y: 2 },
104
+ * f: { z: undefined },
105
+ * };
106
+ * const result = filterNullOrUndefined(input);
107
+ * console.log(result); // Output: { a: 1, d: 'hello', e: { y: 2 } }
108
+ * ```
109
+ */
110
+ filterNullOrUndefined(obj) {
111
+ return Object.fromEntries(Object.entries(obj)
112
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
113
+ .filter(([_, value]) => value !== null && value !== undefined)
114
+ .map(([key, value]) => {
115
+ if (typeof value === 'object' && !Array.isArray(value) && value !== null) {
116
+ return [key, this.filterNullOrUndefined(value)];
117
+ }
118
+ return [key, value];
119
+ }));
120
+ }
121
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
122
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: UtilsService, providedIn: 'root' });
92
123
  }
93
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: UtilsService, decorators: [{
124
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: UtilsService, decorators: [{
94
125
  type: Injectable,
95
126
  args: [{
96
127
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-services-utils-service.mjs","sources":["../../../projects/opal-frontend-common/services/utils-service/utils.service.ts","../../../projects/opal-frontend-common/services/utils-service/hmcts-opal-frontend-common-services-utils-service.ts"],"sourcesContent":["import { ViewportScroller } from '@angular/common';\nimport { inject, Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class UtilsService {\n private readonly viewportScroller = inject(ViewportScroller);\n\n /**\n * Converts the first letter of a string to uppercase.\n * @param str - The input string.\n * @returns The input string with the first letter capitalized.\n */\n public upperCaseFirstLetter(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n }\n\n /**\n * Converts the entire string to uppercase.\n * @param str - The input string.\n * @returns The input string in uppercase.\n */\n public upperCaseAllLetters(str: string): string {\n return str.toUpperCase();\n }\n\n /**\n * Converts a number to a monetary string representation.\n * @param amount - The number to convert.\n * @returns The monetary string representation of the number.\n */\n public convertToMonetaryString(amount: number | string): string {\n if (typeof amount === 'string') {\n amount = parseFloat(amount);\n }\n return `£${amount.toFixed(2)}`;\n }\n\n /**\n * Formats a 6-digit number or string as a sort code.\n * @param value - The 6-digit value to format.\n * @returns The formatted sort code string (xx-xx-xx).\n */\n public formatSortCode(value: string | number): string {\n const sortCode = value.toString();\n return `${sortCode.slice(0, 2)}-${sortCode.slice(2, 4)}-${sortCode.slice(4, 6)}`;\n }\n\n /**\n * Filters out null or empty strings from an array of address lines.\n *\n * @param address - An array of address lines which may contain strings or null values.\n * @returns A new array containing only non-empty strings from the input array.\n */\n public formatAddress(address: (string | null)[]): string[] {\n return address.filter((line): line is string => !!line?.trim());\n }\n\n /**\n * Scrolls the viewport to the top of the page.\n * Utilizes the `viewportScroller` service to scroll to the position [0, 0].\n */\n public scrollToTop(): void {\n this.viewportScroller.scrollToPosition([0, 0]);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public checkFormValues(form: { [key: string]: any }): boolean {\n return Object.values(form).some((value) => {\n return Array.isArray(value) ? value.length > 0 : Boolean(value);\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public checkFormArrayValues(forms: { [key: string]: any }[]): boolean {\n return forms.every((form) => this.checkFormValues(form));\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public getFormStatus(form: { [key: string]: any }, providedMessage: string, notProvidedMessage: string): string {\n return this.checkFormValues(form) ? providedMessage : notProvidedMessage;\n }\n\n public getArrayFormStatus(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n forms: { [key: string]: any }[],\n providedMessage: string,\n notProvidedMessage: string,\n ): string {\n return forms.every((form) => this.checkFormValues(form)) ? providedMessage : notProvidedMessage;\n }\n\n /**\n * Copies the provided string value to the clipboard.\n *\n * @param value - The string value to be copied to the clipboard.\n *\n * @remarks\n * This method uses the `navigator.clipboard.writeText` API to copy text to the clipboard.\n * Ensure that the browser supports the Clipboard API before using this method.\n */\n public copyToClipboard(value: string): Promise<void> {\n return navigator.clipboard.writeText(value);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAMa,YAAY,CAAA;AACN,IAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAE5D;;;;AAIG;AACI,IAAA,oBAAoB,CAAC,GAAW,EAAA;AACrC,QAAA,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;;AAGnD;;;;AAIG;AACI,IAAA,mBAAmB,CAAC,GAAW,EAAA;AACpC,QAAA,OAAO,GAAG,CAAC,WAAW,EAAE;;AAG1B;;;;AAIG;AACI,IAAA,uBAAuB,CAAC,MAAuB,EAAA;AACpD,QAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC9B,YAAA,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;;QAE7B,OAAO,CAAA,CAAA,EAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;;AAGhC;;;;AAIG;AACI,IAAA,cAAc,CAAC,KAAsB,EAAA;AAC1C,QAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE;AACjC,QAAA,OAAO,CAAG,EAAA,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,CAAA,EAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAI,CAAA,EAAA,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC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eAAA,CAAA,UAAA,EAAA,CAAA;AAAZ,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,cAFX,MAAM,EAAA,CAAA;;2FAEP,YAAY,EAAA,UAAA,EAAA,CAAA;kBAHxB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACLD;;AAEG;;;;"}
1
+ {"version":3,"file":"hmcts-opal-frontend-common-services-utils-service.mjs","sources":["../../../projects/opal-frontend-common/services/utils-service/utils.service.ts","../../../projects/opal-frontend-common/services/utils-service/hmcts-opal-frontend-common-services-utils-service.ts"],"sourcesContent":["import { ViewportScroller } from '@angular/common';\nimport { inject, Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class UtilsService {\n private readonly viewportScroller = inject(ViewportScroller);\n\n /**\n * Converts the first letter of a string to uppercase.\n * @param str - The input string.\n * @returns The input string with the first letter capitalized.\n */\n public upperCaseFirstLetter(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n }\n\n /**\n * Converts the entire string to uppercase.\n * @param str - The input string.\n * @returns The input string in uppercase.\n */\n public upperCaseAllLetters(str: string): string {\n return str.toUpperCase();\n }\n\n /**\n * Converts a number to a monetary string representation.\n * @param amount - The number to convert.\n * @returns The monetary string representation of the number.\n */\n public convertToMonetaryString(amount: number | string): string {\n if (typeof amount === 'string') {\n amount = parseFloat(amount);\n }\n return `£${amount.toFixed(2)}`;\n }\n\n /**\n * Formats a 6-digit number or string as a sort code.\n * @param value - The 6-digit value to format.\n * @returns The formatted sort code string (xx-xx-xx).\n */\n public formatSortCode(value: string | number): string {\n const sortCode = value.toString();\n return `${sortCode.slice(0, 2)}-${sortCode.slice(2, 4)}-${sortCode.slice(4, 6)}`;\n }\n\n /**\n * Filters out null or empty strings from an array of address lines.\n *\n * @param address - An array of address lines which may contain strings or null values.\n * @returns A new array containing only non-empty strings from the input array.\n */\n public formatAddress(address: (string | null)[]): string[] {\n return address.filter((line): line is string => !!line?.trim());\n }\n\n /**\n * Scrolls the viewport to the top of the page.\n * Utilizes the `viewportScroller` service to scroll to the position [0, 0].\n */\n public scrollToTop(): void {\n this.viewportScroller.scrollToPosition([0, 0]);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public checkFormValues(form: { [key: string]: any }): boolean {\n return Object.values(form).some((value) => {\n return Array.isArray(value) ? value.length > 0 : Boolean(value);\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public checkFormArrayValues(forms: { [key: string]: any }[]): boolean {\n return forms.every((form) => this.checkFormValues(form));\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public getFormStatus(form: { [key: string]: any }, providedMessage: string, notProvidedMessage: string): string {\n return this.checkFormValues(form) ? providedMessage : notProvidedMessage;\n }\n\n public getArrayFormStatus(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n forms: { [key: string]: any }[],\n providedMessage: string,\n notProvidedMessage: string,\n ): string {\n return forms.every((form) => this.checkFormValues(form)) ? providedMessage : notProvidedMessage;\n }\n\n /**\n * Copies the provided string value to the clipboard.\n *\n * @param value - The string value to be copied to the clipboard.\n *\n * @remarks\n * This method uses the `navigator.clipboard.writeText` API to copy text to the clipboard.\n * Ensure that the browser supports the Clipboard API before using this method.\n */\n public copyToClipboard(value: string): Promise<void> {\n return navigator.clipboard.writeText(value);\n }\n\n /**\n * Recursively filters out properties from an object where the value is `null` or `undefined`.\n *\n * @param obj - The object to filter. Can include nested objects.\n * @returns A new object with only non-null and non-undefined values.\n *\n * @example\n * ```ts\n * const input = {\n * a: 1,\n * b: null,\n * c: undefined,\n * d: 'hello',\n * e: { x: null, y: 2 },\n * f: { z: undefined },\n * };\n * const result = filterNullOrUndefined(input);\n * console.log(result); // Output: { a: 1, d: 'hello', e: { y: 2 } }\n * ```\n */\n public filterNullOrUndefined(obj: Record<string, unknown>): Record<string, unknown> {\n return Object.fromEntries(\n Object.entries(obj)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .filter(([_, value]) => value !== null && value !== undefined)\n .map(([key, value]) => {\n if (typeof value === 'object' && !Array.isArray(value) && value !== null) {\n return [key, this.filterNullOrUndefined(value as Record<string, unknown>)];\n }\n return [key, value];\n }),\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAMa,YAAY,CAAA;AACN,IAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAE5D;;;;AAIG;AACI,IAAA,oBAAoB,CAAC,GAAW,EAAA;AACrC,QAAA,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;;AAGnD;;;;AAIG;AACI,IAAA,mBAAmB,CAAC,GAAW,EAAA;AACpC,QAAA,OAAO,GAAG,CAAC,WAAW,EAAE;;AAG1B;;;;AAIG;AACI,IAAA,uBAAuB,CAAC,MAAuB,EAAA;AACpD,QAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC9B,YAAA,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;;QAE7B,OAAO,CAAA,CAAA,EAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;;AAGhC;;;;AAIG;AACI,IAAA,cAAc,CAAC,KAAsB,EAAA;AAC1C,QAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE;AACjC,QAAA,OAAO,CAAG,EAAA,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,CAAA,EAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAI,CAAA,EAAA,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC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AAA;QACvD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,GAAG;;AAEf,aAAA,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;aAC5D,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AACpB,YAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE;gBACxE,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,qBAAqB,CAAC,KAAgC,CAAC,CAAC;;AAE5E,YAAA,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC;SACpB,CAAC,CACL;;wGAnIQ,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAZ,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,cAFX,MAAM,EAAA,CAAA;;4FAEP,YAAY,EAAA,UAAA,EAAA,CAAA;kBAHxB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACLD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmcts/opal-frontend-common",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^18.2.0 || ^19.0.0",
@@ -59,6 +59,27 @@ export declare class UtilsService {
59
59
  * Ensure that the browser supports the Clipboard API before using this method.
60
60
  */
61
61
  copyToClipboard(value: string): Promise<void>;
62
+ /**
63
+ * Recursively filters out properties from an object where the value is `null` or `undefined`.
64
+ *
65
+ * @param obj - The object to filter. Can include nested objects.
66
+ * @returns A new object with only non-null and non-undefined values.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const input = {
71
+ * a: 1,
72
+ * b: null,
73
+ * c: undefined,
74
+ * d: 'hello',
75
+ * e: { x: null, y: 2 },
76
+ * f: { z: undefined },
77
+ * };
78
+ * const result = filterNullOrUndefined(input);
79
+ * console.log(result); // Output: { a: 1, d: 'hello', e: { y: 2 } }
80
+ * ```
81
+ */
82
+ filterNullOrUndefined(obj: Record<string, unknown>): Record<string, unknown>;
62
83
  static ɵfac: i0.ɵɵFactoryDeclaration<UtilsService, never>;
63
84
  static ɵprov: i0.ɵɵInjectableDeclaration<UtilsService>;
64
85
  }