@diia-inhouse/utils 5.3.29 → 6.0.8

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 (85) hide show
  1. package/dist/address.d.ts +7 -0
  2. package/dist/address.js +38 -41
  3. package/dist/applicationUtils.d.ts +225 -0
  4. package/dist/applicationUtils.js +576 -678
  5. package/dist/asserts.d.ts +6 -0
  6. package/dist/asserts.js +12 -19
  7. package/dist/dictionaries/phoneCodes.js +2435 -2442
  8. package/dist/guards.d.ts +22 -0
  9. package/dist/guards.js +58 -74
  10. package/dist/index.d.ts +36 -0
  11. package/dist/index.js +34 -70
  12. package/dist/integration.d.ts +6 -0
  13. package/dist/integration.js +7 -10
  14. package/dist/interfaces/asserts.d.ts +9 -0
  15. package/dist/interfaces/publicService.d.ts +11 -0
  16. package/dist/interfaces/slack.d.ts +6 -0
  17. package/dist/network.d.ts +17 -0
  18. package/dist/network.js +64 -72
  19. package/dist/payment.d.ts +8 -0
  20. package/dist/payment.js +19 -22
  21. package/dist/pdfUtils.d.ts +6 -0
  22. package/dist/pdfUtils.js +7 -10
  23. package/dist/phoneticChecker/index.d.ts +9 -0
  24. package/dist/phoneticChecker/index.js +18 -23
  25. package/dist/phoneticChecker/metaphone.js +38 -41
  26. package/dist/publicService.d.ts +59 -0
  27. package/dist/publicService.js +137 -150
  28. package/dist/random.d.ts +7 -0
  29. package/dist/random.js +11 -10
  30. package/dist/session.d.ts +7 -0
  31. package/dist/session.js +10 -19
  32. package/dist/slackFormatting.d.ts +13 -0
  33. package/dist/slackFormatting.js +41 -24
  34. package/dist/typeUtils.d.ts +8 -0
  35. package/dist/typeUtils.js +13 -15
  36. package/package.json +42 -27
  37. package/dist/address.js.map +0 -1
  38. package/dist/applicationUtils.js.map +0 -1
  39. package/dist/asserts.js.map +0 -1
  40. package/dist/dictionaries/phoneCodes.js.map +0 -1
  41. package/dist/guards.js.map +0 -1
  42. package/dist/index.js.map +0 -1
  43. package/dist/integration.js.map +0 -1
  44. package/dist/interfaces/applicationUtils.js +0 -3
  45. package/dist/interfaces/applicationUtils.js.map +0 -1
  46. package/dist/interfaces/asserts.js +0 -3
  47. package/dist/interfaces/asserts.js.map +0 -1
  48. package/dist/interfaces/error.js +0 -3
  49. package/dist/interfaces/error.js.map +0 -1
  50. package/dist/interfaces/publicService.js +0 -12
  51. package/dist/interfaces/publicService.js.map +0 -1
  52. package/dist/interfaces/slack.js +0 -3
  53. package/dist/interfaces/slack.js.map +0 -1
  54. package/dist/network.js.map +0 -1
  55. package/dist/payment.js.map +0 -1
  56. package/dist/pdfUtils.js.map +0 -1
  57. package/dist/phoneticChecker/index.js.map +0 -1
  58. package/dist/phoneticChecker/metaphone.js.map +0 -1
  59. package/dist/publicService.js.map +0 -1
  60. package/dist/random.js.map +0 -1
  61. package/dist/session.js.map +0 -1
  62. package/dist/slackFormatting.js.map +0 -1
  63. package/dist/typeUtils.js.map +0 -1
  64. package/dist/types/address.d.ts +0 -4
  65. package/dist/types/applicationUtils.d.ts +0 -212
  66. package/dist/types/asserts.d.ts +0 -2
  67. package/dist/types/dictionaries/phoneCodes.d.ts +0 -2
  68. package/dist/types/guards.d.ts +0 -18
  69. package/dist/types/index.d.ts +0 -86
  70. package/dist/types/integration.d.ts +0 -3
  71. package/dist/types/interfaces/applicationUtils.d.ts +0 -1
  72. package/dist/types/interfaces/asserts.d.ts +0 -5
  73. package/dist/types/interfaces/error.d.ts +0 -7
  74. package/dist/types/interfaces/publicService.d.ts +0 -15
  75. package/dist/types/interfaces/slack.d.ts +0 -3
  76. package/dist/types/network.d.ts +0 -13
  77. package/dist/types/payment.d.ts +0 -5
  78. package/dist/types/pdfUtils.d.ts +0 -3
  79. package/dist/types/phoneticChecker/index.d.ts +0 -7
  80. package/dist/types/phoneticChecker/metaphone.d.ts +0 -6
  81. package/dist/types/publicService.d.ts +0 -55
  82. package/dist/types/random.d.ts +0 -5
  83. package/dist/types/session.d.ts +0 -3
  84. package/dist/types/slackFormatting.d.ts +0 -7
  85. package/dist/types/typeUtils.d.ts +0 -5
@@ -1,212 +0,0 @@
1
- import { ToRelativeUnit } from 'luxon';
2
- import { ApiError } from '@diia-inhouse/errors';
3
- import { ActHeaders, ActionSession, ActionVersion, AppVersions, Gender, HashedFile, HashedFileWithSignature, PlatformType, SignedItem, TokenData, UserTokenData, WithAppVersions } from '@diia-inhouse/types';
4
- export declare class ApplicationUtils {
5
- private static documentTypeToCamelCaseExceptions;
6
- private static camelCaseToDocumentTypeExceptions;
7
- private static defaultItnDate;
8
- private static defaultFormat;
9
- private static readonly cyrillicToLatin;
10
- private static readonly nameComponentsToLowerCase;
11
- static documentTypeToCamelCase(documentType: string): string;
12
- static camelCaseToDocumentType(camelCaseDocumentType: string): string;
13
- static isItnChecksumValid(itn: string): boolean;
14
- static getBirthDayFromItn(itn: string): string;
15
- static getGenderFromItn(itn: string): Gender;
16
- static isItnFormatValid(itn: string): boolean;
17
- static capitalizeName(name: string | undefined | null): string;
18
- static capitalizeFirstLetter(str: string): string;
19
- static lowerFirstLetter(str: string): string;
20
- static mapCyrillic(value: string): string;
21
- static mapLatin(value: string): string;
22
- /**
23
- * Validates the Ukrainian IBAN number by format and checksum.
24
- */
25
- static isIbanNumberValid(iban: string): boolean;
26
- /**
27
- * Extracts the bank code (МФО) from Ukrainian IBAN (4-10 digits). Does not validate the IBAN.
28
- *
29
- * @link https://en.wikipedia.org/wiki/International_Bank_Account_Number#IBAN_formats_by_country
30
- * @example
31
- * ```typescript
32
- * const bankCode = extractBankCodeFromIban('UA833052991234567890123456789') // '305299'
33
- * ```
34
- */
35
- static extractBankCodeFromIban(iban: string): string;
36
- static getStreetName(street: string, streetType: string): string;
37
- static toHashedFilesWithSignatures(hashedFiles: HashedFile[], signedItems: SignedItem[]): [HashedFileWithSignature[], string[]];
38
- static handleError<T = never>(err: unknown, cb: (err: ApiError) => T): T;
39
- static makeSession(data: TokenData): ActionSession;
40
- static getActionNameWithVersion(actionName: string, actionVersion?: ActionVersion): string;
41
- static getGreeting(fName: string, skipEmogi?: boolean): string;
42
- /**
43
- * Get age from birth date. Powered by {@link https://moment.github.io/luxon/#/ luxon}
44
- *
45
- * @param birthDay Input birth date.
46
- * @param params Additional parameters. Default: `{ format: 'dd.MM.yyyy', unitOfTime: 'years' }`
47
- * @param params.format Input date format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens). Default - 'dd.MM.yyyy'
48
- * @param params.unitOfTime Unit of time to get the difference in. Default - 'years'
49
- * @param params.relativeTo Date to compare the input date to. Default - current date
50
- *
51
- * @returns Age in years if other `unitOfTime` is not specified
52
- * @throws If input date is invalid
53
- */
54
- static getAge(birthDay: string, params?: {
55
- format?: string;
56
- unitOfTime?: ToRelativeUnit;
57
- relativeTo?: string;
58
- }): number;
59
- static getFullName(lastName: string, firstName: string, middleName?: string, separator?: string): string;
60
- static getShortName(lastName: string, firstName: string, middleName?: string): string;
61
- static getUserFullName(user: UserTokenData): string;
62
- static getPassportFullName({ lastNameUA, firstNameUA, middleNameUA, }: {
63
- lastNameUA: string;
64
- firstNameUA: string;
65
- middleNameUA?: string;
66
- }): string;
67
- static getChildFullName({ child: { lastName, firstName, middleName }, }: {
68
- child: {
69
- lastName: string;
70
- firstName: string;
71
- middleName?: string;
72
- };
73
- }): string;
74
- static encodeObjectToBase64<T>(object: T): string;
75
- static decodeObjectFromBase64<T>(encodedObject: string): T;
76
- /**
77
- * Format string or Date to the specified string format. Powered by {@link https://moment.github.io/luxon/#/ luxon}
78
- *
79
- * @param date Input date
80
- * @param format Output date format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens)
81
- * @param fromFormat Input date format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens). Used for string `date`. Default - 'dd.MM.yyyy'
82
- *
83
- * @throws If input date is invalid
84
- */
85
- static formatDate(date: string | Date, format: string, fromFormat?: string): string;
86
- /**
87
- * Check if the input date is valid. Powered by {@link https://moment.github.io/luxon/#/ luxon}
88
- *
89
- * @param date Input date.
90
- * @param format `date` format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens). Default - 'yyyy-MM-dd'
91
- *
92
- * @throws If input date is invalid
93
- */
94
- static validateDate(date: string, format?: string): void | never;
95
- static formatPhoneNumber(rawPhone: string, separator?: string, prefix?: string): string;
96
- /**
97
- * Format number as: "XX XXX,XX {units}".
98
- *
99
- * @param amount Input number
100
- * @param units Unit to be append at the end of the formatted number
101
- * @param minimumFractionDigits Minimum number of fraction digits
102
- */
103
- static formatAmountWithThousandsSeparator(amount: number, units?: string, minimumFractionDigits?: number): string;
104
- static convertToPennies(amount: number): number;
105
- static convertFromPennies(amount: number): number;
106
- static multiplySum(amount: number, multiplier: number, decimalPlaces?: number): number;
107
- static toDecimalPlaces(amount: number, decimalPlaces?: number): number;
108
- static filterByAppVersions<T extends WithAppVersions>(items: T[], headers: Pick<ActHeaders, 'appVersion' | 'platformType'> | undefined): T[];
109
- static isAppVersionMatch(appVersion: string, platformType: PlatformType, appVersions: AppVersions): boolean;
110
- static getFileName(name: string, id: string, requestDateTime?: string, postFix?: string): string;
111
- static sanitizeString(input: string): string;
112
- /**
113
- * Returns the appropriate plural form of a string based on the specified numeric value and locale.
114
- * Uses the pluralization rules for the provided locale to determine the correct form among the options.
115
- *
116
- * @param value - The number used to determine the plural form.
117
- * @param one - The form for singular (e.g., "one item").
118
- * @param few - The form for a few items (e.g., "few items").
119
- * @param many - The form for many items (e.g., "many items").
120
- * @param other - Optional. The fallback form if none of the specific plural rules match.
121
- * Defaults to the 'many' form if not provided.
122
- * @param locale - The locale used for pluralization rules. Defaults to 'uk' (Ukrainian).
123
- * @returns The appropriate pluralized string based on the value.
124
- *
125
- * @example
126
- * getPluralForm(1, 'яблуко', 'яблука', 'яблук'); // 'яблуко'
127
- * getPluralForm(2, 'яблуко', 'яблука', 'яблук'); // 'яблука'
128
- * getPluralForm(0, 'яблуко', 'яблука', 'яблук', 'плоди'); // 'плоди'
129
- * getPluralForm(0, 'яблуко', 'яблука', 'яблук'); // 'яблук' (uses 'many' as default fallback)
130
- */
131
- static pluralizeString(value: number, one: string, few: string, many: string, other?: string, locale?: string): string;
132
- /**
133
- * Returns the name of a service from a package.json in the current working directory (process.cwd()) converted to PascalCase.
134
- * If the name is scoped, it will be returned without the scope.
135
- * If the name is not found, an empty string is returned. Also, all whitespace characters are removed.
136
- *
137
- * @returns The name of the service in PascalCase.
138
- *
139
- * @example
140
- * getServiceName() // 'my-service' -> 'MyService'
141
- * getServiceName() // '@scope/my-service' -> 'MyService'
142
- */
143
- static getServiceName(): string;
144
- /**
145
- * Returns the version of a service from a package.json in the current working directory (process.cwd()).
146
- * If the version is not found, an empty string is returned.
147
- *
148
- * @returns The version of the service.
149
- *
150
- * @example
151
- * getServiceVersion() // '1.143.0-rc.2'
152
- */
153
- static getServiceVersion(): string;
154
- /**
155
- * Format string according to mask pattern
156
- *
157
- * Basic Examples:
158
- * '12345' with '##-###' -> '12-345'
159
- * 'AB345' with '##-###' -> 'AB-345'
160
- * '123456' with '##.####' -> '12.3456'
161
- * '12345' with '### ##' -> '123 45'
162
- * 'ABCDEF' with '##-##-##' -> 'AB-CD-EF'
163
- */
164
- static formatMask(rawData: string, mask: string): string;
165
- /**
166
- * Memoize a function.
167
- * The function is memoized by the arguments (`JSON.stringify(args)`) and the result is cached for the specified time to live in milliseconds.
168
- * If the function is called with the same arguments again, the cached result is returned.
169
- * If the function is called with the same arguments again after the time to live has expired, the function is called again and the result is cached again.
170
- *
171
- * @param fn - The function to memoize.
172
- * @param ttl - The time to live for the cached value in milliseconds.
173
- * @returns The memoized function.
174
- */
175
- static memoize<T extends (...args: Parameters<T>) => ReturnType<T>>(fn: T, ttl?: number): T;
176
- /**
177
- * Recursively encodes all string values in an object or string using encodeURIComponent.
178
- * For objects, it creates a deep clone and processes all string values.
179
- * For strings, it directly applies the encoding.
180
- *
181
- * @param data Input data to encode - can be an object or string
182
- * @returns Deep cloned object with encoded string values, or encoded string if input was string
183
- * @example
184
- * ```typescript
185
- * const data = { name: 'John Doe', email: 'john@example.com' }
186
- * const encoded = ApplicationUtils.encodeValuesWithIterator(data)
187
- * // Result: { name: 'John%20Doe', email: 'john%40example.com' }
188
- * ```
189
- */
190
- static encodeValuesWithIterator(data: object | string): object | string;
191
- /**
192
- * Recursively decodes all string values in an object or string using decodeURIComponent.
193
- * For objects, it creates a deep clone and processes all string values.
194
- * For strings, it directly applies the decoding.
195
- *
196
- * @param data Input data to decode - can be an object or string
197
- * @returns Deep cloned object with decoded string values, or decoded string if input was string
198
- * @example
199
- * ```typescript
200
- * const data = { name: 'John%20Doe', email: 'john%40example.com' }
201
- * const decoded = ApplicationUtils.decodeValuesWithIterator(data)
202
- * // Result: { name: 'John Doe', email: 'john@example.com' }
203
- * ```
204
- */
205
- static decodeValuesWithIterator(data: object | string): object | string;
206
- static removeUnderscoreFields<T>(value: T): T;
207
- private static mod97;
208
- private static toApiError;
209
- private static getPackageJson;
210
- private static processObject;
211
- private static processValues;
212
- }
@@ -1,2 +0,0 @@
1
- import { AssertsContainer } from './interfaces/asserts';
2
- export declare const Asserts: AssertsContainer;
@@ -1,2 +0,0 @@
1
- import { InputPhoneCodeItem } from '@diia-inhouse/design-system';
2
- export declare const phoneCodes: InputPhoneCodeItem[];
@@ -1,18 +0,0 @@
1
- import { ApiError } from '@diia-inhouse/errors';
2
- import { AcquirerSession, ActionSession, AppUser, EResidentSession, EResidentTokenData, OnBeforeApplicationShutdown, OnDestroy, OnHealthCheck, OnInit, OnRegistrationsFinished, ServiceEntranceSession, UserSession, UserTokenData } from '@diia-inhouse/types';
3
- export declare const Guards: {
4
- isError(value: unknown): value is Error;
5
- apiError(err: Error): err is ApiError;
6
- isUserSession(session: ActionSession | undefined): session is UserSession;
7
- isUser(user: AppUser | undefined): user is UserTokenData;
8
- isEResidentSession(session: ActionSession | undefined): session is EResidentSession;
9
- isEResident(user: AppUser | undefined): user is EResidentTokenData;
10
- isAcquirerSession(session: ActionSession | undefined): session is AcquirerSession;
11
- isServiceEntranceSession(session: ActionSession | undefined): session is ServiceEntranceSession;
12
- hasOnInitHook(instance: unknown): instance is OnInit;
13
- hasOnHealthCheckHook(instance: unknown): instance is OnHealthCheck;
14
- hasOnDestroyHook(instance: unknown): instance is OnDestroy;
15
- hasOnRegistrationsFinishedHook(instance: unknown): instance is OnRegistrationsFinished;
16
- hasOnBeforeApplicationShutdownHook(instance: unknown): instance is OnBeforeApplicationShutdown;
17
- isSettledError(value: PromiseSettledResult<unknown>): value is PromiseRejectedResult;
18
- };
@@ -1,86 +0,0 @@
1
- import { AddressUtils } from './address';
2
- import { ApplicationUtils } from './applicationUtils';
3
- import { NetworkUtils } from './network';
4
- import { PaymentUtils } from './payment';
5
- import { SlackFormattingUtils } from './slackFormatting';
6
- declare const asserts: import("./interfaces/asserts").AssertsContainer;
7
- declare const guards: {
8
- isError(value: unknown): value is Error;
9
- apiError(err: Error): err is import("@diia-inhouse/errors").ApiError;
10
- isUserSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").UserSession;
11
- isUser(user: import("@diia-inhouse/types").AppUser | undefined): user is import("@diia-inhouse/types").UserTokenData;
12
- isEResidentSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").EResidentSession;
13
- isEResident(user: import("@diia-inhouse/types").AppUser | undefined): user is import("@diia-inhouse/types").EResidentTokenData;
14
- isAcquirerSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").AcquirerSession;
15
- isServiceEntranceSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").ServiceEntranceSession;
16
- hasOnInitHook(instance: unknown): instance is import("@diia-inhouse/types").OnInit;
17
- hasOnHealthCheckHook(instance: unknown): instance is import("@diia-inhouse/types").OnHealthCheck;
18
- hasOnDestroyHook(instance: unknown): instance is import("@diia-inhouse/types").OnDestroy;
19
- hasOnRegistrationsFinishedHook(instance: unknown): instance is import("@diia-inhouse/types").OnRegistrationsFinished;
20
- hasOnBeforeApplicationShutdownHook(instance: unknown): instance is import("@diia-inhouse/types").OnBeforeApplicationShutdown;
21
- isSettledError(value: PromiseSettledResult<unknown>): value is PromiseRejectedResult;
22
- };
23
- declare const utils: typeof ApplicationUtils;
24
- declare const pdfUtils: {
25
- getPdfFileName(name: string, id: string, requestDateTime?: string): string;
26
- };
27
- export { asserts, guards, utils, pdfUtils };
28
- export { TypeUtils } from './typeUtils';
29
- export { PaymentUtils } from './payment';
30
- export { PublicServiceUtils } from './publicService';
31
- export { phoneticChecker } from './phoneticChecker';
32
- export { NetworkUtils } from './network';
33
- export { IntegrationUtils } from './integration';
34
- export { RandomUtils } from './random';
35
- export { AddressUtils } from './address';
36
- export * from './session';
37
- export * from './slackFormatting';
38
- export declare class Utils {
39
- address: typeof AddressUtils;
40
- application: typeof ApplicationUtils;
41
- network: typeof NetworkUtils;
42
- payment: typeof PaymentUtils;
43
- slackFormatting: typeof SlackFormattingUtils;
44
- asserts: import("./interfaces/asserts").AssertsContainer;
45
- guards: {
46
- isError(value: unknown): value is Error;
47
- apiError(err: Error): err is import("@diia-inhouse/errors").ApiError;
48
- isUserSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").UserSession;
49
- isUser(user: import("@diia-inhouse/types").AppUser | undefined): user is import("@diia-inhouse/types").UserTokenData;
50
- isEResidentSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").EResidentSession;
51
- isEResident(user: import("@diia-inhouse/types").AppUser | undefined): user is import("@diia-inhouse/types").EResidentTokenData;
52
- isAcquirerSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").AcquirerSession;
53
- isServiceEntranceSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").ServiceEntranceSession;
54
- hasOnInitHook(instance: unknown): instance is import("@diia-inhouse/types").OnInit;
55
- hasOnHealthCheckHook(instance: unknown): instance is import("@diia-inhouse/types").OnHealthCheck;
56
- hasOnDestroyHook(instance: unknown): instance is import("@diia-inhouse/types").OnDestroy;
57
- hasOnRegistrationsFinishedHook(instance: unknown): instance is import("@diia-inhouse/types").OnRegistrationsFinished;
58
- hasOnBeforeApplicationShutdownHook(instance: unknown): instance is import("@diia-inhouse/types").OnBeforeApplicationShutdown;
59
- isSettledError(value: PromiseSettledResult<unknown>): value is PromiseRejectedResult;
60
- };
61
- integration: {
62
- getRetryDelay(retry: number, timeLeft: number, initDelay: number, maxDelay: number, multiplier: number): number;
63
- };
64
- pdf: {
65
- getPdfFileName(name: string, id: string, requestDateTime?: string): string;
66
- };
67
- publicService: {
68
- getContacts(user: import("@diia-inhouse/types").UserTokenData): import("@diia-inhouse/design-system").ContactsResponse;
69
- getContactsText(user: import("@diia-inhouse/types").UserTokenData): string;
70
- getContactsComponent(user: import("@diia-inhouse/types").UserTokenData, inputCode?: string): import("@diia-inhouse/design-system").DSBodyItem;
71
- getInputPhoneCodeOrg(params: import("./interfaces/publicService").InputPhoneCodeOrgParams): import("@diia-inhouse/design-system").InputPhoneCodeOrg;
72
- getInputPhoneCodeItems(filter?: string[]): import("@diia-inhouse/design-system").InputPhoneCodeItem[];
73
- getEmailInputTextMlc(emailValue: string, inputCode?: string): import("@diia-inhouse/design-system").InputTextMlc;
74
- getContactsComponentTextLabel(user: import("@diia-inhouse/types").UserTokenData, phoneNumber: string): import("@diia-inhouse/design-system").TextLabelMlc | undefined;
75
- extractPhoneNumber(phoneNumber: string, phoneCodeValue: string): string | never;
76
- };
77
- random: {
78
- generateUUID: typeof import("node:crypto").randomUUID;
79
- getRandomIntsString(length?: number): string;
80
- };
81
- type: {
82
- isObject(value: any): boolean;
83
- isArray(value: any): boolean;
84
- isBuffer(value: any): boolean;
85
- };
86
- }
@@ -1,3 +0,0 @@
1
- export declare const IntegrationUtils: {
2
- getRetryDelay(retry: number, timeLeft: number, initDelay: number, maxDelay: number, multiplier: number): number;
3
- };
@@ -1 +0,0 @@
1
- export type ProcessObjectCallback = (value: string) => string;
@@ -1,5 +0,0 @@
1
- import { TokenData, VerifiedBaseTokenData } from '@diia-inhouse/types';
2
- export interface AssertsContainer {
3
- isRefreshTokenExists(tokenData: TokenData): asserts tokenData is VerifiedBaseTokenData<TokenData>;
4
- assertObjectHasOnlyOneOf<T extends object>(object: T, ...keys: (keyof T)[]): void | never;
5
- }
@@ -1,7 +0,0 @@
1
- import { ErrorData, ErrorType } from '@diia-inhouse/errors';
2
- export type OriginError = Error & {
3
- code?: number;
4
- data?: ErrorData;
5
- type?: ErrorType;
6
- keyValue?: unknown;
7
- };
@@ -1,15 +0,0 @@
1
- export declare enum AuthProviderName {
2
- Monobank = "monobank",
3
- PrivatBank = "privatbank",
4
- PhotoId = "photoid",
5
- BankId = "bankid",
6
- Nfc = "nfc"
7
- }
8
- export interface InputPhoneCodeOrgParams {
9
- inputCode?: string;
10
- phoneValue?: string;
11
- codeValueId?: string;
12
- codeIds?: string[];
13
- hint?: string;
14
- codeValueIsEditable?: boolean;
15
- }
@@ -1,3 +0,0 @@
1
- export interface GetListValueOptions {
2
- isError?: boolean;
3
- }
@@ -1,13 +0,0 @@
1
- import { GrpcStatusCode } from '@diia-inhouse/types';
2
- export declare class NetworkUtils {
3
- private static readonly grpcStatusCodes;
4
- private static readonly httpStatusCodeToGrpcCode;
5
- /**
6
- * @see https://gist.github.com/hamakn/708b9802ca845eb59f3975dbb3ae2a01
7
- */
8
- private static readonly grpcCodeToHttpStatusCode;
9
- static isHttpCode(code: number | undefined): boolean;
10
- static isGrpcCode(code: number | undefined): boolean;
11
- static getHttpStatusCodeByGrpcCode(code: GrpcStatusCode): number;
12
- static getGrpcCodeByHttpStatusCode(code: number): GrpcStatusCode;
13
- }
@@ -1,5 +0,0 @@
1
- export declare class PaymentUtils {
2
- private static readonly config;
3
- static getPaymentPayCommission(amount: number): number;
4
- static getPaymentTotalAmount(amount: number, commission: number): number;
5
- }
@@ -1,3 +0,0 @@
1
- export declare const PdfUtils: {
2
- getPdfFileName(name: string, id: string, requestDateTime?: string): string;
3
- };
@@ -1,7 +0,0 @@
1
- declare class PhoneticChecker {
2
- private equalityCoefficientThreshold;
3
- arePhoneticallySimilar(etalonValue: string, slaveValue: string, threshold?: number): boolean;
4
- private getEqualityCoefficient;
5
- }
6
- export declare const phoneticChecker: PhoneticChecker;
7
- export {};
@@ -1,6 +0,0 @@
1
- declare class Metaphone {
2
- process(word: string): string;
3
- private modifyOperation;
4
- }
5
- export declare const metaphone: Metaphone;
6
- export {};
@@ -1,55 +0,0 @@
1
- import { ContactsResponse, DSBodyItem, InputPhoneCodeItem, InputPhoneCodeOrg, InputTextMlc, TextLabelMlc } from '@diia-inhouse/design-system';
2
- import { UserTokenData } from '@diia-inhouse/types';
3
- import { InputPhoneCodeOrgParams } from './interfaces/publicService';
4
- export declare const PublicServiceUtils: {
5
- getContacts(user: UserTokenData): ContactsResponse;
6
- getContactsText(user: UserTokenData): string;
7
- getContactsComponent(user: UserTokenData, inputCode?: string): DSBodyItem;
8
- /**
9
- * Creates an InputPhoneCodeOrg with specified parameters
10
- * @param params.codeIds - Optional array of allowed country code IDs
11
- * @returns InputPhoneCodeOrg
12
- * @example
13
- * // Create a phone input with Ukrainian code
14
- * const phoneInput = getInputPhoneCodeOrg({
15
- * inputCode: 'phone',
16
- * phoneValue: '501234567',
17
- * codeValueId: 'ua',
18
- * codeIds: ['ua', 'pl'],
19
- * hint: 'Enter your phone number'
20
- * });
21
- */
22
- getInputPhoneCodeOrg(params: InputPhoneCodeOrgParams): InputPhoneCodeOrg;
23
- /**
24
- * Returns an array of phone code items, optionally filtered by provided code IDs
25
- * @param filter - Optional array of phone code IDs to filter by
26
- * @returns Array of phone code items matching the filter criteria, or all phone codes if no filter is provided
27
- * @example
28
- * // Get all phone codes
29
- * const allCodes = getInputPhoneCodeItems();
30
- *
31
- * @example
32
- * // Get only Ukrainian and Polish phone codes
33
- * const filteredCodes = getInputPhoneCodeItems(['ua', 'pl']);
34
- */
35
- getInputPhoneCodeItems(filter?: string[]): InputPhoneCodeItem[];
36
- getEmailInputTextMlc(emailValue: string, inputCode?: string): InputTextMlc;
37
- getContactsComponentTextLabel(user: UserTokenData, phoneNumber: string): TextLabelMlc | undefined;
38
- /**
39
- * Extracts the phone number from the phone number string
40
- *
41
- * @param phoneNumber - Phone number to extract the number from
42
- * @param phoneCodeValue - Phone country code in ISO 3166-1 alpha-2 format
43
- * @returns Extracted phone number (without country code)
44
- *
45
- * @example
46
- * extractPhoneNumber('+380123456789', 'ua') // 123456789
47
- *
48
- * @example
49
- * extractPhoneNumber('123456789', 'ua') // throws Error(`Phone number must start with country code 380`)
50
- *
51
- * @example
52
- * extractPhoneNumber('380123456789', 'invalid') // throws Error(`Invalid country code`)
53
- */
54
- extractPhoneNumber(phoneNumber: string, phoneCodeValue: string): string | never;
55
- };
@@ -1,5 +0,0 @@
1
- import { randomUUID } from 'node:crypto';
2
- export declare const RandomUtils: {
3
- generateUUID: typeof randomUUID;
4
- getRandomIntsString(length?: number): string;
5
- };
@@ -1,3 +0,0 @@
1
- import { EResidentSession, ProfileFeature, UserFeatures, UserSession } from '@diia-inhouse/types';
2
- export declare function profileFeaturesToList(features: UserFeatures): ProfileFeature[];
3
- export declare function extractProfileFeatures(session: UserSession | EResidentSession): ProfileFeature[];
@@ -1,7 +0,0 @@
1
- import type { RichTextElement, RichTextEmoji } from '@slack/types';
2
- import { GetListValueOptions } from './interfaces/slack';
3
- export declare class SlackFormattingUtils {
4
- readonly greenCircleEmoji: RichTextEmoji;
5
- readonly redCircleEmoji: RichTextEmoji;
6
- getValue(name: string, value: string | number | undefined, { isError }?: GetListValueOptions): RichTextElement[];
7
- }
@@ -1,5 +0,0 @@
1
- export declare const TypeUtils: {
2
- isObject(value: any): boolean;
3
- isArray(value: any): boolean;
4
- isBuffer(value: any): boolean;
5
- };