@cranberry-money/shared-utils 8.23.253 → 8.23.255
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.
- package/dist/date.d.ts +55 -0
- package/dist/date.d.ts.map +1 -1
- package/dist/date.js +112 -0
- package/dist/date.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/user-verification.d.ts +40 -0
- package/dist/user-verification.d.ts.map +1 -0
- package/dist/user-verification.js +60 -0
- package/dist/user-verification.js.map +1 -0
- package/package.json +3 -3
package/dist/date.d.ts
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date formatting utilities for consistent date display across applications
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Formats a date string with a fallback
|
|
6
|
+
* @param dateString - ISO date string or null
|
|
7
|
+
* @param fallback - Fallback string if date is null (default: 'No expiry')
|
|
8
|
+
* @returns Formatted date string or fallback
|
|
9
|
+
*/
|
|
1
10
|
export declare function formatDate(dateString: string | null, fallback?: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Formats a date string to a full date format (e.g., "15 January 2025")
|
|
13
|
+
* @param dateString - ISO date string or null
|
|
14
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
15
|
+
* @returns Formatted date string or fallback message
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatFullDate(dateString: string | null, locale?: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Formats a date string to short format with month and day only (e.g., "Jan 15")
|
|
20
|
+
* @param dateString - ISO date string
|
|
21
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
22
|
+
* @returns Formatted short date string
|
|
23
|
+
*/
|
|
2
24
|
export declare function formatShortDate(dateString: string, locale?: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Formats a date string to numeric short format (e.g., "15/01/2025")
|
|
27
|
+
* @param dateString - ISO date string or null
|
|
28
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
29
|
+
* @returns Formatted numeric date string or fallback message
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatNumericDate(dateString: string | null, locale?: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Formats a time string (e.g., "14:30")
|
|
34
|
+
* @param dateString - ISO date string
|
|
35
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
36
|
+
* @returns Formatted time string
|
|
37
|
+
*/
|
|
3
38
|
export declare function formatTime(dateString: string, locale?: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Formats a date and time string (e.g., "Jan 15 14:30")
|
|
41
|
+
* @param dateString - ISO date string
|
|
42
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
43
|
+
* @returns Formatted date and time string
|
|
44
|
+
*/
|
|
4
45
|
export declare function formatDateTime(dateString: string, locale?: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Formats a date and time string with year (e.g., "15 Jan 2025, 14:30")
|
|
48
|
+
* @param dateString - ISO date string or null
|
|
49
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
50
|
+
* @returns Formatted date and time string or fallback message
|
|
51
|
+
*/
|
|
52
|
+
export declare function formatFullDateTime(dateString: string | null, locale?: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Formats a date string for member since display (e.g., "January 2025")
|
|
55
|
+
* @param dateString - ISO date string or null
|
|
56
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
57
|
+
* @returns Formatted month and year string
|
|
58
|
+
*/
|
|
59
|
+
export declare function formatMemberSince(dateString: string | null, locale?: string): string;
|
|
5
60
|
//# sourceMappingURL=date.d.ts.map
|
package/dist/date.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../src/date.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,EAA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M,GAAG,IAAI,EAAE,MAAM,GAAE,MAAgB,GAAG,MAAM,CAY7F"}
|
package/dist/date.js
CHANGED
|
@@ -1,8 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date formatting utilities for consistent date display across applications
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Formats a date string with a fallback
|
|
6
|
+
* @param dateString - ISO date string or null
|
|
7
|
+
* @param fallback - Fallback string if date is null (default: 'No expiry')
|
|
8
|
+
* @returns Formatted date string or fallback
|
|
9
|
+
*/
|
|
1
10
|
export function formatDate(dateString, fallback = 'No expiry') {
|
|
2
11
|
if (!dateString)
|
|
3
12
|
return fallback;
|
|
4
13
|
return new Date(dateString).toLocaleDateString();
|
|
5
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Formats a date string to a full date format (e.g., "15 January 2025")
|
|
17
|
+
* @param dateString - ISO date string or null
|
|
18
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
19
|
+
* @returns Formatted date string or fallback message
|
|
20
|
+
*/
|
|
21
|
+
export function formatFullDate(dateString, locale = 'en-AU') {
|
|
22
|
+
if (!dateString)
|
|
23
|
+
return 'Not available';
|
|
24
|
+
try {
|
|
25
|
+
const date = new Date(dateString);
|
|
26
|
+
return date.toLocaleDateString(locale, {
|
|
27
|
+
year: 'numeric',
|
|
28
|
+
month: 'long',
|
|
29
|
+
day: 'numeric',
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return dateString;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Formats a date string to short format with month and day only (e.g., "Jan 15")
|
|
38
|
+
* @param dateString - ISO date string
|
|
39
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
40
|
+
* @returns Formatted short date string
|
|
41
|
+
*/
|
|
6
42
|
export function formatShortDate(dateString, locale = 'en-AU') {
|
|
7
43
|
const date = new Date(dateString);
|
|
8
44
|
return date.toLocaleDateString(locale, {
|
|
@@ -10,6 +46,33 @@ export function formatShortDate(dateString, locale = 'en-AU') {
|
|
|
10
46
|
day: 'numeric',
|
|
11
47
|
});
|
|
12
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Formats a date string to numeric short format (e.g., "15/01/2025")
|
|
51
|
+
* @param dateString - ISO date string or null
|
|
52
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
53
|
+
* @returns Formatted numeric date string or fallback message
|
|
54
|
+
*/
|
|
55
|
+
export function formatNumericDate(dateString, locale = 'en-AU') {
|
|
56
|
+
if (!dateString)
|
|
57
|
+
return 'Not available';
|
|
58
|
+
try {
|
|
59
|
+
const date = new Date(dateString);
|
|
60
|
+
return date.toLocaleDateString(locale, {
|
|
61
|
+
year: 'numeric',
|
|
62
|
+
month: '2-digit',
|
|
63
|
+
day: '2-digit',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return dateString;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Formats a time string (e.g., "14:30")
|
|
72
|
+
* @param dateString - ISO date string
|
|
73
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
74
|
+
* @returns Formatted time string
|
|
75
|
+
*/
|
|
13
76
|
export function formatTime(dateString, locale = 'en-AU') {
|
|
14
77
|
return new Date(dateString).toLocaleTimeString(locale, {
|
|
15
78
|
hour: '2-digit',
|
|
@@ -17,6 +80,12 @@ export function formatTime(dateString, locale = 'en-AU') {
|
|
|
17
80
|
hour12: false,
|
|
18
81
|
});
|
|
19
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Formats a date and time string (e.g., "Jan 15 14:30")
|
|
85
|
+
* @param dateString - ISO date string
|
|
86
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
87
|
+
* @returns Formatted date and time string
|
|
88
|
+
*/
|
|
20
89
|
export function formatDateTime(dateString, locale = 'en-AU') {
|
|
21
90
|
const date = new Date(dateString);
|
|
22
91
|
const shortDate = date.toLocaleDateString(locale, {
|
|
@@ -30,4 +99,47 @@ export function formatDateTime(dateString, locale = 'en-AU') {
|
|
|
30
99
|
});
|
|
31
100
|
return `${shortDate} ${time}`;
|
|
32
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Formats a date and time string with year (e.g., "15 Jan 2025, 14:30")
|
|
104
|
+
* @param dateString - ISO date string or null
|
|
105
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
106
|
+
* @returns Formatted date and time string or fallback message
|
|
107
|
+
*/
|
|
108
|
+
export function formatFullDateTime(dateString, locale = 'en-AU') {
|
|
109
|
+
if (!dateString)
|
|
110
|
+
return 'Never';
|
|
111
|
+
try {
|
|
112
|
+
const date = new Date(dateString);
|
|
113
|
+
return date.toLocaleDateString(locale, {
|
|
114
|
+
year: 'numeric',
|
|
115
|
+
month: 'short',
|
|
116
|
+
day: 'numeric',
|
|
117
|
+
hour: '2-digit',
|
|
118
|
+
minute: '2-digit',
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return dateString;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Formats a date string for member since display (e.g., "January 2025")
|
|
127
|
+
* @param dateString - ISO date string or null
|
|
128
|
+
* @param locale - Locale for formatting (default: 'en-AU')
|
|
129
|
+
* @returns Formatted month and year string
|
|
130
|
+
*/
|
|
131
|
+
export function formatMemberSince(dateString, locale = 'en-AU') {
|
|
132
|
+
if (!dateString)
|
|
133
|
+
return 'Not available';
|
|
134
|
+
try {
|
|
135
|
+
const date = new Date(dateString);
|
|
136
|
+
return date.toLocaleDateString(locale, {
|
|
137
|
+
year: 'numeric',
|
|
138
|
+
month: 'long',
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
return dateString;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
33
145
|
//# sourceMappingURL=date.js.map
|
package/dist/date.js.map
CHANGED
|
@@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AC;IACpB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAyB,EAAE,SAAiB,OAAO;IACnF,IAAI,CAAC,UAAU;QAAE,OAAO,eAAe,CAAC;IAExC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE;YACrC,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { truncateText } from './formatting';
|
|
2
2
|
export { parseAddress, getAddressDisplayLines } from './address';
|
|
3
|
-
export { formatDate, formatShortDate, formatTime, formatDateTime } from './date';
|
|
3
|
+
export { formatDate, formatFullDate, formatShortDate, formatNumericDate, formatTime, formatDateTime, formatFullDateTime, formatMemberSince, } from './date';
|
|
4
4
|
export { NUMBER_FORMAT_OPTIONS_CURRENCY, NUMBER_FORMAT_OPTIONS_CURRENCY_SIGNED, parseCurrencyInput, formatCurrencyWithCode, formatDefaultCurrency, formatCurrency, formatCurrencyWithOptions, formatQuantityWithSuffix, formatTransactionAmount, getTransactionTypeLabel, formatBSB, formatAccountNumber, } from './formatting';
|
|
5
5
|
export { getTradeStatusBadge, getOrderStatusBadge, getTargetTradeStatusBadge } from './badges';
|
|
6
6
|
export { formatPortfolioValue, calculateTotalValue, getMarketAllocation, getCashAllocation, validateAllocations, } from './portfolio';
|
|
@@ -13,4 +13,5 @@ export { validatePortfolioSelection } from './portfolio-validation';
|
|
|
13
13
|
export { validateUserPreferences, hasUserPreferences, getUserPreferencesSummary, formatUserPreferencesForDisplay, getAvailablePortfoliosForAccount, isValidUserPreferencesUpdate, getUserPreferencesCacheKey, sanitizeUserPreferencesInput, } from './user-preferences';
|
|
14
14
|
export { formatPhoneForDisplay, cleanPhoneNumber, getExpectedPhoneLength } from './phoneFormatting';
|
|
15
15
|
export { getInstrumentType, getInstrumentTypeVariant, getAssetType, getAssetTypeVariant, INSTRUMENT_TYPE_ETF, INSTRUMENT_TYPE_FUND, INSTRUMENT_TYPE_STOCK, ASSET_TYPE_CRYPTO, ASSET_TYPE_STABLECOIN, type InstrumentType, type AllAssetTypes, } from './instruments';
|
|
16
|
+
export { getUserVerificationStatus, isUserVerified, isVerificationPending, isVerificationRejected, type VerificationStatusType, type VerificationStatus, } from './user-verification';
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,EACL,UAAU,EACV,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACL,8BAA8B,EAC9B,qCAAqC,EACrC,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,SAAS,EACT,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,M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EACrB,iBAAiB,EACjB,qBAAqB,EAErB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,GACxB,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { truncateText } from './formatting';
|
|
|
3
3
|
// Address utilities
|
|
4
4
|
export { parseAddress, getAddressDisplayLines } from './address';
|
|
5
5
|
// Date formatting utilities
|
|
6
|
-
export { formatDate, formatShortDate, formatTime, formatDateTime } from './date';
|
|
6
|
+
export { formatDate, formatFullDate, formatShortDate, formatNumericDate, formatTime, formatDateTime, formatFullDateTime, formatMemberSince, } from './date';
|
|
7
7
|
// Currency and number formatting utilities
|
|
8
8
|
export { NUMBER_FORMAT_OPTIONS_CURRENCY, NUMBER_FORMAT_OPTIONS_CURRENCY_SIGNED, parseCurrencyInput, formatCurrencyWithCode, formatDefaultCurrency, formatCurrency, formatCurrencyWithOptions, formatQuantityWithSuffix, formatTransactionAmount, getTransactionTypeLabel, formatBSB, formatAccountNumber, } from './formatting';
|
|
9
9
|
// Badge utilities
|
|
@@ -34,5 +34,7 @@ getInstrumentType, getInstrumentTypeVariant,
|
|
|
34
34
|
getAssetType, getAssetTypeVariant,
|
|
35
35
|
// Constants
|
|
36
36
|
INSTRUMENT_TYPE_ETF, INSTRUMENT_TYPE_FUND, INSTRUMENT_TYPE_STOCK, ASSET_TYPE_CRYPTO, ASSET_TYPE_STABLECOIN, } from './instruments';
|
|
37
|
+
// User verification utilities
|
|
38
|
+
export { getUserVerificationStatus, isUserVerified, isVerificationPending, isVerificationRejected, } from './user-verification';
|
|
37
39
|
// No re-exports - consumers should import directly from @cranberry-money/shared-types
|
|
38
40
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEjE,4BAA4B;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEjE,4BAA4B;AAC5B,OAAO,EACL,UAAU,EACV,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,QAAQ,CAAC;AAEhB,2CAA2C;AAC3C,OAAO,EACL,8BAA8B,EAC9B,qCAAqC,EACrC,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,SAAS,EACT,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAE/F,sBAAsB;AACtB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,uBAAuB;AACvB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,8BAA8B;AAC9B,OAAO,EACL,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;AAE7B,sFAAsF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User verification status utilities for consistent verification status display
|
|
3
|
+
*/
|
|
4
|
+
import type { UserProfile } from '@cranberry-money/shared-types';
|
|
5
|
+
/**
|
|
6
|
+
* Verification status types
|
|
7
|
+
*/
|
|
8
|
+
export type VerificationStatusType = 'verified' | 'pending' | 'rejected' | 'not_verified' | 'unknown';
|
|
9
|
+
/**
|
|
10
|
+
* Verification status with type and display label
|
|
11
|
+
*/
|
|
12
|
+
export interface VerificationStatus {
|
|
13
|
+
type: VerificationStatusType;
|
|
14
|
+
label: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Gets the verification status for a user profile
|
|
18
|
+
* @param userProfile - User profile object or null
|
|
19
|
+
* @returns Verification status with type and label
|
|
20
|
+
*/
|
|
21
|
+
export declare function getUserVerificationStatus(userProfile: UserProfile | null | undefined): VerificationStatus;
|
|
22
|
+
/**
|
|
23
|
+
* Checks if a user profile is verified
|
|
24
|
+
* @param userProfile - User profile object or null
|
|
25
|
+
* @returns True if user is verified
|
|
26
|
+
*/
|
|
27
|
+
export declare function isUserVerified(userProfile: UserProfile | null | undefined): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Checks if a user profile has pending verification
|
|
30
|
+
* @param userProfile - User profile object or null
|
|
31
|
+
* @returns True if verification is pending
|
|
32
|
+
*/
|
|
33
|
+
export declare function isVerificationPending(userProfile: UserProfile | null | undefined): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Checks if a user profile verification was rejected
|
|
36
|
+
* @param userProfile - User profile object or null
|
|
37
|
+
* @returns True if verification was rejected
|
|
38
|
+
*/
|
|
39
|
+
export declare function isVerificationRejected(userProfile: UserProfile | null | undefined): boolean;
|
|
40
|
+
//# sourceMappingURL=user-verification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-verification.d.ts","sourceRoot":"","sources":["../src/user-verification.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,CAAC;AAEtG;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,kBAAkB,CA0BzG;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEnF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAQ1F;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAI3F"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User verification status utilities for consistent verification status display
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Gets the verification status for a user profile
|
|
6
|
+
* @param userProfile - User profile object or null
|
|
7
|
+
* @returns Verification status with type and label
|
|
8
|
+
*/
|
|
9
|
+
export function getUserVerificationStatus(userProfile) {
|
|
10
|
+
if (!userProfile) {
|
|
11
|
+
return { type: 'unknown', label: 'Unknown' };
|
|
12
|
+
}
|
|
13
|
+
// User is verified through SumSub
|
|
14
|
+
if (userProfile.isIdVerified) {
|
|
15
|
+
return { type: 'verified', label: 'Verified ✓' };
|
|
16
|
+
}
|
|
17
|
+
// Verification is in progress
|
|
18
|
+
if (userProfile.sumsubVerificationStatus === 'pending' ||
|
|
19
|
+
userProfile.sumsubVerificationStatus === 'queued' ||
|
|
20
|
+
userProfile.sumsubVerificationStatus === 'init') {
|
|
21
|
+
return { type: 'pending', label: 'Pending' };
|
|
22
|
+
}
|
|
23
|
+
// Verification was rejected
|
|
24
|
+
if (userProfile.sumsubVerificationStatus === 'completed' && userProfile.sumsubReviewAnswer === 'RED') {
|
|
25
|
+
return { type: 'rejected', label: 'Rejected' };
|
|
26
|
+
}
|
|
27
|
+
// Not yet verified
|
|
28
|
+
return { type: 'not_verified', label: 'Not Verified' };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Checks if a user profile is verified
|
|
32
|
+
* @param userProfile - User profile object or null
|
|
33
|
+
* @returns True if user is verified
|
|
34
|
+
*/
|
|
35
|
+
export function isUserVerified(userProfile) {
|
|
36
|
+
return userProfile?.isIdVerified === true;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Checks if a user profile has pending verification
|
|
40
|
+
* @param userProfile - User profile object or null
|
|
41
|
+
* @returns True if verification is pending
|
|
42
|
+
*/
|
|
43
|
+
export function isVerificationPending(userProfile) {
|
|
44
|
+
if (!userProfile)
|
|
45
|
+
return false;
|
|
46
|
+
return (userProfile.sumsubVerificationStatus === 'pending' ||
|
|
47
|
+
userProfile.sumsubVerificationStatus === 'queued' ||
|
|
48
|
+
userProfile.sumsubVerificationStatus === 'init');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Checks if a user profile verification was rejected
|
|
52
|
+
* @param userProfile - User profile object or null
|
|
53
|
+
* @returns True if verification was rejected
|
|
54
|
+
*/
|
|
55
|
+
export function isVerificationRejected(userProfile) {
|
|
56
|
+
if (!userProfile)
|
|
57
|
+
return false;
|
|
58
|
+
return userProfile.sumsubVerificationStatus === 'completed' && userProfile.sumsubReviewAnswer === 'RED';
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=user-verification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-verification.js","sourceRoot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M,CAChD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,WAA2C;IAChF,IAAI,CAAC,WAAW;QAAE,OAAO,KAAK,CAAC;IAE/B,OAAO,WAAW,CAAC,wBAAwB,KAAK,WAAW,IAAI,WAAW,CAAC,kBAAkB,KAAK,KAAK,CAAC;AAC1G,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cranberry-money/shared-utils",
|
|
3
|
-
"version": "8.23.
|
|
3
|
+
"version": "8.23.255",
|
|
4
4
|
"description": "Shared utility functions for Blueberry platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"prepublishOnly": "npm run clean && npm run typecheck && npm test && npm run build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cranberry-money/shared-constants": "^8.15.
|
|
33
|
-
"@cranberry-money/shared-types": "^8.22.
|
|
32
|
+
"@cranberry-money/shared-constants": "^8.15.280",
|
|
33
|
+
"@cranberry-money/shared-types": "^8.22.255"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/jest": "^30.0.0",
|