gotrip-fx-transaction-form 1.0.95 → 1.0.96
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/index.js +21005 -21026
- package/package.json +1 -1
- package/types/components/Modal/SendEmailModal.d.ts +8 -0
- package/types/constants/api-urls.d.ts +4 -0
- package/types/constants/regex.d.ts +2 -0
- package/types/design-systems/Input/PhoneInput.d.ts +9 -0
- package/types/hooks/useEmailHistory.d.ts +25 -0
- package/types/hooks/usePhoneValidation.d.ts +15 -0
- package/types/pages/admin/email-history-listing/EmailHistoryListing.d.ts +6 -0
- package/types/types/response.dto.d.ts +10 -0
- package/types/util/phone.d.ts +37 -7
package/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SendEmailData } from '../../hooks/useEmailHistory';
|
|
2
|
+
interface SendEmailModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onSendEmail: (data: SendEmailData) => Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare const SendEmailModal: ({ isOpen, onClose, onSendEmail }: SendEmailModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PhoneValidationOptions } from '../../hooks/usePhoneValidation';
|
|
3
|
+
export interface PhoneInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
validationOptions?: PhoneValidationOptions;
|
|
5
|
+
onPhoneChange?: (phone: string, isValid: boolean, errorMessage?: string) => void;
|
|
6
|
+
formatOnBlur?: boolean;
|
|
7
|
+
normalizeOnChange?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IEmailHistory } from '../types/response.dto';
|
|
2
|
+
export interface SendEmailData {
|
|
3
|
+
title: string;
|
|
4
|
+
content: string;
|
|
5
|
+
sendMethod: 'group' | 'email';
|
|
6
|
+
groupType?: string;
|
|
7
|
+
to: string;
|
|
8
|
+
cc?: string;
|
|
9
|
+
bcc?: string;
|
|
10
|
+
}
|
|
11
|
+
type Props = {
|
|
12
|
+
defaultLimit?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const useEmailHistory: ({ defaultLimit }?: Props) => {
|
|
15
|
+
emailHistories: IEmailHistory[];
|
|
16
|
+
total: number;
|
|
17
|
+
loading: boolean;
|
|
18
|
+
page: number;
|
|
19
|
+
limit: number;
|
|
20
|
+
refetchData: () => void;
|
|
21
|
+
sendEmail: (data: SendEmailData) => Promise<void>;
|
|
22
|
+
setPage: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
23
|
+
setLimit: (newLimit: number) => void;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface PhoneValidationOptions {
|
|
2
|
+
allowInternational?: boolean;
|
|
3
|
+
allowLocal?: boolean;
|
|
4
|
+
allow84Format?: boolean;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
customMessage?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const usePhoneValidation: (options?: PhoneValidationOptions) => {
|
|
9
|
+
validatePhone: (phone: string) => string | undefined;
|
|
10
|
+
normalizePhone: (phone: string, format?: "local" | "international") => string;
|
|
11
|
+
formatPhone: (phone: string) => string;
|
|
12
|
+
isValidVietnamesePhone: (phone: string) => boolean;
|
|
13
|
+
isValidVietnameseLocalPhone: (phone: string) => boolean;
|
|
14
|
+
isValidVietnameseInternationalPhone: (phone: string) => boolean;
|
|
15
|
+
};
|
|
@@ -394,4 +394,14 @@ export declare enum EDepartmentType {
|
|
|
394
394
|
DEPARTMENT = "department",
|
|
395
395
|
AGENT = "agent"
|
|
396
396
|
}
|
|
397
|
+
export interface IEmailHistory {
|
|
398
|
+
id: number;
|
|
399
|
+
email: string;
|
|
400
|
+
title: string;
|
|
401
|
+
content: string;
|
|
402
|
+
settings: Record<string, any>;
|
|
403
|
+
response: Record<string, any>;
|
|
404
|
+
createdAt: string;
|
|
405
|
+
updatedAt: string;
|
|
406
|
+
}
|
|
397
407
|
export {};
|
package/types/util/phone.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes all special characters and spaces except digits and + from phone number
|
|
3
|
+
* @param phone The phone number to clean
|
|
4
|
+
* @returns The cleaned phone number
|
|
5
|
+
*/
|
|
6
|
+
export declare const cleanPhoneNumber: (phone: string) => string;
|
|
1
7
|
/**
|
|
2
8
|
* Converts a phone number to Vietnamese local format (starting with 0)
|
|
3
9
|
* Examples:
|
|
4
|
-
* - "+
|
|
5
|
-
* - "
|
|
6
|
-
* - "
|
|
10
|
+
* - "+84 912 345 678" -> "0912 345 678"
|
|
11
|
+
* - "84 912 345 678" -> "0912 345 678"
|
|
12
|
+
* - "0912 345 678" -> "0912 345 678" (remains unchanged)
|
|
7
13
|
* @param phone The phone number to convert
|
|
8
14
|
* @returns The converted phone number in local format
|
|
9
15
|
*/
|
|
@@ -11,11 +17,35 @@ export declare const toLocalPhoneNumber: (phone: string) => string;
|
|
|
11
17
|
/**
|
|
12
18
|
* Converts a phone number to international format (starting with +84)
|
|
13
19
|
* Examples:
|
|
14
|
-
* - "
|
|
15
|
-
* - "
|
|
16
|
-
* - "+
|
|
17
|
-
* - "
|
|
20
|
+
* - "0912 345 678" -> "+84 912 345 678"
|
|
21
|
+
* - "912 345 678" -> "+84 912 345 678"
|
|
22
|
+
* - "+84 912 345 678" -> "+84 912 345 678" (remains unchanged)
|
|
23
|
+
* - "84 912 345 678" -> "+84 912 345 678"
|
|
18
24
|
* @param phone The phone number to convert
|
|
19
25
|
* @returns The converted phone number in international format
|
|
20
26
|
*/
|
|
21
27
|
export declare const toInternationalPhoneNumber: (phone: string) => string;
|
|
28
|
+
/**
|
|
29
|
+
* Validates if a phone number is a valid Vietnamese phone number
|
|
30
|
+
* @param phone The phone number to validate
|
|
31
|
+
* @returns true if valid, false otherwise
|
|
32
|
+
*/
|
|
33
|
+
export declare const isValidVietnamesePhone: (phone: string) => boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Validates if a phone number is a valid Vietnamese local phone number (starts with 0)
|
|
36
|
+
* @param phone The phone number to validate
|
|
37
|
+
* @returns true if valid, false otherwise
|
|
38
|
+
*/
|
|
39
|
+
export declare const isValidVietnameseLocalPhone: (phone: string) => boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Validates if a phone number is a valid Vietnamese international phone number (starts with +84)
|
|
42
|
+
* @param phone The phone number to validate
|
|
43
|
+
* @returns true if valid, false otherwise
|
|
44
|
+
*/
|
|
45
|
+
export declare const isValidVietnameseInternationalPhone: (phone: string) => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Formats a phone number for display (adds spaces for better readability)
|
|
48
|
+
* @param phone The phone number to format
|
|
49
|
+
* @returns The formatted phone number
|
|
50
|
+
*/
|
|
51
|
+
export declare const formatPhoneForDisplay: (phone: string) => string;
|