@hmcts/opal-frontend-common 0.0.8 → 0.0.10

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 (79) hide show
  1. package/components/moj/moj-sortable-table/moj-sortable-table.component.d.ts +6 -1
  2. package/directives/capitalisation/capitalisation.directive.d.ts +11 -11
  3. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.mjs +3 -3
  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-removal-base.mjs +3 -3
  6. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-base.mjs +3 -3
  7. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table-pagination.mjs +3 -3
  8. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table.mjs +3 -3
  9. package/fesm2022/hmcts-opal-frontend-common-components-alphagov-alphagov-accessible-autocomplete.mjs +3 -3
  10. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-accordion.mjs +3 -3
  11. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-back-link.mjs +3 -3
  12. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-button.mjs +3 -3
  13. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-cancel-link.mjs +3 -3
  14. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-checkboxes.mjs +12 -12
  15. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-date-input.mjs +3 -3
  16. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-details.mjs +3 -3
  17. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-error-summary.mjs +3 -3
  18. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-footer.mjs +3 -3
  19. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-header.mjs +6 -6
  20. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-heading-with-caption.mjs +3 -3
  21. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-inset-text.mjs +3 -3
  22. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-notification-banner.mjs +3 -3
  23. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-pagination.mjs +3 -3
  24. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-panel.mjs +3 -3
  25. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-radio.mjs +12 -12
  26. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-select.mjs +3 -3
  27. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-summary-card-list.mjs +6 -6
  28. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-summary-list.mjs +12 -12
  29. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-table.mjs +12 -12
  30. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tabs.mjs +9 -9
  31. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tag.mjs +3 -3
  32. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-task-list.mjs +6 -6
  33. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-area.mjs +3 -3
  34. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input-prefix-suffix.mjs +3 -3
  35. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input.mjs +3 -3
  36. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-badge.mjs +4 -4
  37. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-badge.mjs.map +1 -1
  38. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-banner.mjs +3 -3
  39. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-button-menu.mjs +6 -6
  40. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-date-picker.mjs +3 -3
  41. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-header.mjs +6 -6
  42. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-notification-badge.mjs +3 -3
  43. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-page-header.mjs +3 -3
  44. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-pagination.mjs +12 -12
  45. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-primary-navigation.mjs +6 -6
  46. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sortable-table.mjs +34 -18
  47. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sortable-table.mjs.map +1 -1
  48. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sub-navigation.mjs +6 -6
  49. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-ticket-panel.mjs +3 -3
  50. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-timeline.mjs +6 -6
  51. package/fesm2022/hmcts-opal-frontend-common-directives-capitalisation.mjs +30 -23
  52. package/fesm2022/hmcts-opal-frontend-common-directives-capitalisation.mjs.map +1 -1
  53. package/fesm2022/hmcts-opal-frontend-common-interceptors-http-error.mjs +8 -7
  54. package/fesm2022/hmcts-opal-frontend-common-interceptors-http-error.mjs.map +1 -1
  55. package/fesm2022/{hmcts-opal-frontend-common-pages-access-denied.component-lAGLpY0c.mjs → hmcts-opal-frontend-common-pages-access-denied.component-yc1BR0MD.mjs} +4 -4
  56. package/fesm2022/{hmcts-opal-frontend-common-pages-access-denied.component-lAGLpY0c.mjs.map → hmcts-opal-frontend-common-pages-access-denied.component-yc1BR0MD.mjs.map} +1 -1
  57. package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in-stub.component-N-tkNkj6.mjs → hmcts-opal-frontend-common-pages-sign-in-stub.component-ZXo1inkD.mjs} +4 -4
  58. package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in-stub.component-N-tkNkj6.mjs.map → hmcts-opal-frontend-common-pages-sign-in-stub.component-ZXo1inkD.mjs.map} +1 -1
  59. package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in.component-CtniiG6-.mjs → hmcts-opal-frontend-common-pages-sign-in.component-CUKAHWHL.mjs} +4 -4
  60. package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in.component-CtniiG6-.mjs.map → hmcts-opal-frontend-common-pages-sign-in.component-CUKAHWHL.mjs.map} +1 -1
  61. package/fesm2022/hmcts-opal-frontend-common-pages.mjs +2 -2
  62. package/fesm2022/hmcts-opal-frontend-common-pipes-date-format.mjs +3 -3
  63. package/fesm2022/hmcts-opal-frontend-common-pipes-days-ago.mjs +3 -3
  64. package/fesm2022/hmcts-opal-frontend-common-resolvers-title.mjs +3 -3
  65. package/fesm2022/hmcts-opal-frontend-common-services-app-initializer-service.mjs +3 -3
  66. package/fesm2022/hmcts-opal-frontend-common-services-app-insights-service.mjs +3 -3
  67. package/fesm2022/hmcts-opal-frontend-common-services-auth-service.mjs +3 -3
  68. package/fesm2022/hmcts-opal-frontend-common-services-date-service.mjs +3 -3
  69. package/fesm2022/hmcts-opal-frontend-common-services-launch-darkly-service.mjs +3 -3
  70. package/fesm2022/hmcts-opal-frontend-common-services-permissions-service.mjs +3 -3
  71. package/fesm2022/hmcts-opal-frontend-common-services-session-service.mjs +3 -3
  72. package/fesm2022/hmcts-opal-frontend-common-services-sort-service.mjs +3 -3
  73. package/fesm2022/hmcts-opal-frontend-common-services-transfer-state-service.mjs +3 -3
  74. package/fesm2022/hmcts-opal-frontend-common-services-transformation-service.mjs +3 -3
  75. package/fesm2022/hmcts-opal-frontend-common-services-utils-service.mjs +15 -3
  76. package/fesm2022/hmcts-opal-frontend-common-services-utils-service.mjs.map +1 -1
  77. package/interceptors/http-error/constants/http-error-message.constant.d.ts +1 -0
  78. package/package.json +1 -1
  79. package/services/utils-service/utils.service.d.ts +10 -0
@@ -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.7", ngImport: i0, type: SessionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
55
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SessionService, providedIn: 'root' });
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' });
56
56
  }
57
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SessionService, decorators: [{
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: SessionService, decorators: [{
58
58
  type: Injectable,
59
59
  args: [{
60
60
  providedIn: 'root',
@@ -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.7", ngImport: i0, type: SortService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
83
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SortService, providedIn: 'root' });
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' });
84
84
  }
85
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SortService, decorators: [{
85
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: SortService, decorators: [{
86
86
  type: Injectable,
87
87
  args: [{
88
88
  providedIn: 'root',
@@ -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.7", 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.7", ngImport: i0, type: TransferStateService, providedIn: 'root' });
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' });
52
52
  }
53
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: TransferStateService, decorators: [{
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: TransferStateService, decorators: [{
54
54
  type: Injectable,
55
55
  args: [{
56
56
  providedIn: 'root',
@@ -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.7", ngImport: i0, type: TransformationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
62
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: TransformationService, providedIn: 'root' });
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' });
63
63
  }
64
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: TransformationService, decorators: [{
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: TransformationService, decorators: [{
65
65
  type: Injectable,
66
66
  args: [{
67
67
  providedIn: 'root',
@@ -75,10 +75,22 @@ class UtilsService {
75
75
  forms, providedMessage, notProvidedMessage) {
76
76
  return forms.every((form) => this.checkFormValues(form)) ? providedMessage : notProvidedMessage;
77
77
  }
78
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
79
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: UtilsService, providedIn: 'root' });
78
+ /**
79
+ * Copies the provided string value to the clipboard.
80
+ *
81
+ * @param value - The string value to be copied to the clipboard.
82
+ *
83
+ * @remarks
84
+ * This method uses the `navigator.clipboard.writeText` API to copy text to the clipboard.
85
+ * Ensure that the browser supports the Clipboard API before using this method.
86
+ */
87
+ copyToClipboard(value) {
88
+ return navigator.clipboard.writeText(value);
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' });
80
92
  }
81
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: UtilsService, decorators: [{
93
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: UtilsService, decorators: [{
82
94
  type: Injectable,
83
95
  args: [{
84
96
  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 * 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;;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1B,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,GAAG,eAAe,GAAG,kBAAkB;;uGApFtF,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,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 * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";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AEG;;;;"}
@@ -0,0 +1 @@
1
+ export declare const GENERIC_HTTP_ERROR_MESSAGE = "An error has occurred. Please try again, if this problem persists, contact the help desk.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmcts/opal-frontend-common",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^18.2.0 || ^19.0.0",
@@ -49,6 +49,16 @@ export declare class UtilsService {
49
49
  getArrayFormStatus(forms: {
50
50
  [key: string]: any;
51
51
  }[], providedMessage: string, notProvidedMessage: string): string;
52
+ /**
53
+ * Copies the provided string value to the clipboard.
54
+ *
55
+ * @param value - The string value to be copied to the clipboard.
56
+ *
57
+ * @remarks
58
+ * This method uses the `navigator.clipboard.writeText` API to copy text to the clipboard.
59
+ * Ensure that the browser supports the Clipboard API before using this method.
60
+ */
61
+ copyToClipboard(value: string): Promise<void>;
52
62
  static ɵfac: i0.ɵɵFactoryDeclaration<UtilsService, never>;
53
63
  static ɵprov: i0.ɵɵInjectableDeclaration<UtilsService>;
54
64
  }