gotrip-fx-transaction-form 1.0.150 → 1.0.186-dev
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/assets/index.css +1 -1
- package/index.js +41454 -31295
- package/package.json +1 -1
- package/types/components/Apps/EmbededIndividualApp.d.ts +3 -1
- package/types/components/Insurance/CountryWithFlag.d.ts +23 -0
- package/types/components/Insurance/CreateInsuranceTransactionForm.d.ts +10 -0
- package/types/components/Insurance/FormElements.d.ts +36 -3
- package/types/components/Insurance/InsurancePlans/BenefitDetailsModal.d.ts +11 -0
- package/types/components/Insurance/InsurancePlans/InsurancePlanCard.d.ts +28 -0
- package/types/components/Insurance/InsurancePlans/InsurancePlanList.d.ts +21 -0
- package/types/components/Insurance/InsurancePlans/index.d.ts +2 -0
- package/types/components/Insurance/RelationshipSelect.d.ts +22 -0
- package/types/components/Insurance/SimpleDetail.d.ts +2 -1
- package/types/components/Insurance/StepFourPayment.d.ts +14 -0
- package/types/components/Insurance/StepOneForm.d.ts +2 -1
- package/types/components/Insurance/StepOneFormV2.d.ts +10 -0
- package/types/components/Insurance/StepThreeBuyerInfo.d.ts +9 -0
- package/types/components/Insurance/StepThreeInsuredPeople.d.ts +17 -0
- package/types/components/Insurance/StepTwoPlansV2.d.ts +10 -0
- package/types/components/Insurance/countryUtils.d.ts +10 -0
- package/types/components/Insurance/types.d.ts +69 -2
- package/types/components/Insurance/validationRules.d.ts +4 -0
- package/types/components/Insurance/validationUtils.d.ts +12 -0
- package/types/components/Modal/InsurancePaymentModal.d.ts +11 -0
- package/types/components/StepIndicator/StepIndicatorCard.d.ts +11 -0
- package/types/components/StepIndicator/StepIndicatorHorizontal.d.ts +10 -0
- package/types/components/StepIndicator/index.d.ts +2 -0
- package/types/constants/api-urls.d.ts +5 -0
- package/types/constants/countries.d.ts +2 -0
- package/types/embeded-main.d.ts +2 -0
- package/types/hooks/useBookedSimGrouped.d.ts +38 -0
- package/types/hooks/useBookedTransactionGroupDetail.d.ts +40 -0
- package/types/hooks/useDocumentScan.d.ts +22 -0
- package/types/hooks/useInsuranceData.d.ts +4 -5
- package/types/hooks/useInsurancePlans.d.ts +10 -0
- package/types/hooks/useInsuranceTransaction.d.ts +39 -0
- package/types/hooks/useParseDocumentData.d.ts +10 -0
- package/types/pages/agency/booked-sim-list/BookedSimDescription.d.ts +6 -0
- package/types/pages/agency/booked-sim-list/BookedSimList.d.ts +6 -0
- package/types/pages/agency/booked-sim-transaction-detail/BookedGroupSimTransactionDetail.d.ts +1 -0
- package/types/pages/agency/insurance/transaction-create/CreateInsuranceTransactionPageV2.d.ts +1 -0
- package/types/pages/agency/role-list/RoleList.d.ts +2 -0
- package/types/pages/guest/insurance-create.d.ts +1 -0
- package/types/store/useAuthStore.d.ts +1 -0
- package/types/types/enum.d.ts +8 -1
- package/types/types/insurance-transaction.dto.d.ts +4 -1
- package/types/types/insurance.d.ts +13 -2
- package/types/types/sdk.d.ts +4 -0
- package/types/types/user.d.ts +5 -1
- package/types/util/insurance.util.d.ts +4 -0
- package/types/components/Insurance/StepIndicator.d.ts +0 -10
- package/types/pages/agency/group-sim-transaction-detail/GroupSimTransactionDetail.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { ESdkFormType } from '../../types/sdk';
|
|
1
2
|
export type EmbededIndividualAppProps = {
|
|
2
3
|
apiKey: string;
|
|
3
4
|
externalCssUrl?: string;
|
|
4
5
|
hide?: string[];
|
|
5
6
|
defaultBank?: string;
|
|
6
7
|
displayDefaultBankLogo?: boolean;
|
|
8
|
+
type?: ESdkFormType;
|
|
7
9
|
};
|
|
8
|
-
export declare const EmbededIndividualApp: ({ apiKey, externalCssUrl, hide, defaultBank, displayDefaultBankLogo, }: EmbededIndividualAppProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const EmbededIndividualApp: ({ apiKey, externalCssUrl, hide, defaultBank, displayDefaultBankLogo, type, }: EmbededIndividualAppProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface CountryWithFlagProps {
|
|
2
|
+
/**
|
|
3
|
+
* Country name in English or Vietnamese
|
|
4
|
+
*/
|
|
5
|
+
countryName: string | null | undefined;
|
|
6
|
+
fallback?: string;
|
|
7
|
+
flagSize?: {
|
|
8
|
+
width: string;
|
|
9
|
+
height: string;
|
|
10
|
+
};
|
|
11
|
+
textProps?: {
|
|
12
|
+
fontWeight?: string;
|
|
13
|
+
fontSize?: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
};
|
|
16
|
+
gap?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Reusable component to display country name with flag
|
|
20
|
+
* Automatically converts country name to Vietnamese and displays flag
|
|
21
|
+
*/
|
|
22
|
+
export declare const CountryWithFlag: ({ countryName, fallback, flagSize, textProps, gap, }: CountryWithFlagProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface CreateInsuranceTransactionFormProps {
|
|
2
|
+
storageKey: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
backButtonText?: string;
|
|
5
|
+
onBack?: () => void;
|
|
6
|
+
onSuccess?: (transactionData: any) => void;
|
|
7
|
+
containerMaxWidth?: string;
|
|
8
|
+
showBackButton?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const CreateInsuranceTransactionForm: ({ storageKey, title, backButtonText, onBack, onSuccess, containerMaxWidth, showBackButton, }: CreateInsuranceTransactionFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Control, FieldPath, FieldValues, RegisterOptions } from 'react-hook-form';
|
|
2
|
+
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
3
|
+
import { EDocumentType, DocumentScanResult } from '../../hooks/useDocumentScan';
|
|
1
4
|
export declare const FieldLabel: ({ label, tooltip }: {
|
|
2
5
|
label: string;
|
|
3
6
|
tooltip?: string;
|
|
@@ -22,6 +25,30 @@ interface DateInputProps {
|
|
|
22
25
|
placeholder?: string;
|
|
23
26
|
}
|
|
24
27
|
export declare const DateInput: import('react').ForwardRefExoticComponent<DateInputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
28
|
+
export declare enum InputType {
|
|
29
|
+
TEXT = "text",
|
|
30
|
+
EMAIL = "email",
|
|
31
|
+
PHONE = "phone"
|
|
32
|
+
}
|
|
33
|
+
interface FormInputFieldProps<T extends FieldValues> {
|
|
34
|
+
name: FieldPath<T>;
|
|
35
|
+
control: Control<T>;
|
|
36
|
+
label: string;
|
|
37
|
+
required?: boolean;
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
type?: InputType;
|
|
40
|
+
rules?: RegisterOptions<T>;
|
|
41
|
+
leftIcon?: IconDefinition;
|
|
42
|
+
rightIcon?: IconDefinition;
|
|
43
|
+
showScanButton?: boolean;
|
|
44
|
+
documentType?: EDocumentType;
|
|
45
|
+
onScanClick?: () => void;
|
|
46
|
+
onScanComplete?: (data: DocumentScanResult) => void;
|
|
47
|
+
showValidationState?: boolean;
|
|
48
|
+
isValid?: (value: any, fieldState: any) => boolean;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare function FormInputField<T extends FieldValues>({ name, control, label, required, placeholder, type, rules, leftIcon, rightIcon, showScanButton, documentType, onScanClick, onScanComplete, showValidationState, isValid, disabled, }: FormInputFieldProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
25
52
|
interface CountryComboboxProps {
|
|
26
53
|
options: {
|
|
27
54
|
value: string;
|
|
@@ -31,8 +58,12 @@ interface CountryComboboxProps {
|
|
|
31
58
|
loading?: boolean;
|
|
32
59
|
onChange: (value: string) => void;
|
|
33
60
|
placeholder?: string;
|
|
61
|
+
size?: 'sm' | 'md' | 'lg';
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
borderColor?: string;
|
|
64
|
+
hasError?: boolean;
|
|
34
65
|
}
|
|
35
|
-
export declare const CountryCombobox: ({ options, value, loading, onChange, placeholder, }: CountryComboboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
66
|
+
export declare const CountryCombobox: ({ options, value, loading, onChange, placeholder, size, disabled, borderColor, hasError, }: CountryComboboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
67
|
interface ProvinceComboboxProps {
|
|
37
68
|
options: {
|
|
38
69
|
value: string;
|
|
@@ -43,8 +74,9 @@ interface ProvinceComboboxProps {
|
|
|
43
74
|
onChange: (value: string) => void;
|
|
44
75
|
placeholder?: string;
|
|
45
76
|
disabled?: boolean;
|
|
77
|
+
size?: 'sm' | 'md' | 'lg';
|
|
46
78
|
}
|
|
47
|
-
export declare const ProvinceCombobox: ({ options, value, loading, onChange, placeholder, disabled, }: ProvinceComboboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
export declare const ProvinceCombobox: ({ options, value, loading, onChange, placeholder, disabled, size, }: ProvinceComboboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
48
80
|
interface WardComboboxProps {
|
|
49
81
|
options: {
|
|
50
82
|
value: string;
|
|
@@ -55,6 +87,7 @@ interface WardComboboxProps {
|
|
|
55
87
|
onChange: (value: string) => void;
|
|
56
88
|
placeholder?: string;
|
|
57
89
|
disabled?: boolean;
|
|
90
|
+
size?: 'sm' | 'md' | 'lg';
|
|
58
91
|
}
|
|
59
|
-
export declare const WardCombobox: ({ options, value, loading, onChange, placeholder, disabled, }: WardComboboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
92
|
+
export declare const WardCombobox: ({ options, value, loading, onChange, placeholder, disabled, size, }: WardComboboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
60
93
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CoveragePlanPremium, TravelPlanFormValues } from '../types';
|
|
2
|
+
interface BenefitDetailsModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
plan: CoveragePlanPremium | null;
|
|
6
|
+
travelInsuranceSettings?: Record<string, any>;
|
|
7
|
+
onPlanSelect?: (plan: CoveragePlanPremium) => void;
|
|
8
|
+
travelPlan?: TravelPlanFormValues | null;
|
|
9
|
+
}
|
|
10
|
+
export declare const BenefitDetailsModal: ({ isOpen, onClose, plan, travelInsuranceSettings, onPlanSelect, travelPlan, }: BenefitDetailsModalProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TravelPlanFormValues } from '../types';
|
|
2
|
+
export type PriceDisplayType = 'perPerson' | 'total' | 'custom';
|
|
3
|
+
export interface InsurancePlan {
|
|
4
|
+
id: string | number;
|
|
5
|
+
provider: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
totalPrice: number;
|
|
9
|
+
pricePerPerson?: number;
|
|
10
|
+
priceDisplayType?: PriceDisplayType;
|
|
11
|
+
priceLabel?: string;
|
|
12
|
+
originalPrice?: number;
|
|
13
|
+
discount?: number;
|
|
14
|
+
providerLogoUrl?: string;
|
|
15
|
+
metadata?: Record<string, any>;
|
|
16
|
+
}
|
|
17
|
+
interface InsurancePlanCardProps {
|
|
18
|
+
plan: InsurancePlan;
|
|
19
|
+
isSelected: boolean;
|
|
20
|
+
onSelect: (plan: InsurancePlan) => void;
|
|
21
|
+
variant?: 'default' | 'compact' | 'detailed';
|
|
22
|
+
showDiscount?: boolean;
|
|
23
|
+
actionButtonText?: string;
|
|
24
|
+
travelInsuranceSettings?: Record<string, any>;
|
|
25
|
+
travelPlan?: TravelPlanFormValues | null;
|
|
26
|
+
}
|
|
27
|
+
export declare const InsurancePlanCard: ({ plan, isSelected, onSelect, showDiscount, actionButtonText, travelInsuranceSettings, travelPlan, }: InsurancePlanCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InsurancePlan } from './InsurancePlanCard';
|
|
2
|
+
import { TravelPlanFormValues } from '../types';
|
|
3
|
+
interface InsurancePlanListProps {
|
|
4
|
+
plans: InsurancePlan[];
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
selectedPlanId?: string | number | null;
|
|
7
|
+
onPlanSelect: (plan: InsurancePlan) => void;
|
|
8
|
+
title?: string;
|
|
9
|
+
columns?: {
|
|
10
|
+
base?: number;
|
|
11
|
+
md?: number;
|
|
12
|
+
lg?: number;
|
|
13
|
+
};
|
|
14
|
+
emptyMessage?: string;
|
|
15
|
+
showDiscount?: boolean;
|
|
16
|
+
actionButtonText?: string;
|
|
17
|
+
travelInsuranceSettings?: Record<string, any>;
|
|
18
|
+
travelPlan?: TravelPlanFormValues | null;
|
|
19
|
+
}
|
|
20
|
+
export declare const InsurancePlanList: ({ plans, loading, selectedPlanId, onPlanSelect, title, columns, emptyMessage, showDiscount, actionButtonText, travelInsuranceSettings, travelPlan, }: InsurancePlanListProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Control, FieldValues, Path } from 'react-hook-form';
|
|
2
|
+
import { ERelationToPrimary } from '../../types/insurance';
|
|
3
|
+
interface RelationshipSelectProps<T extends FieldValues> {
|
|
4
|
+
name: Path<T>;
|
|
5
|
+
control: Control<T>;
|
|
6
|
+
providerCode?: string | null;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
errorMessage?: string;
|
|
9
|
+
formState?: {
|
|
10
|
+
isSubmitted?: boolean;
|
|
11
|
+
submitCount?: number;
|
|
12
|
+
};
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
disabledOptions?: ERelationToPrimary[];
|
|
15
|
+
allowedOptions?: ERelationToPrimary[];
|
|
16
|
+
}
|
|
17
|
+
export declare const getRelationshipOptionsByProvider: (providerCode?: string | null) => Array<{
|
|
18
|
+
label: string;
|
|
19
|
+
value: ERelationToPrimary;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const RelationshipSelect: <T extends FieldValues>({ name, control, providerCode, required, errorMessage, formState, disabled, disabledOptions, allowedOptions, }: RelationshipSelectProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
interface SimpleDetailProps {
|
|
2
3
|
label: string;
|
|
3
|
-
value?: string | null;
|
|
4
|
+
value?: string | ReactNode | null;
|
|
4
5
|
}
|
|
5
6
|
export declare const SimpleDetail: ({ label, value }: SimpleDetailProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TravelPlanFormValues, CoveragePlanPremium, BuyerFormValues, InsuredPerson } from './types';
|
|
2
|
+
import { EPaymentMethod } from '../../types/enum';
|
|
3
|
+
interface StepFourPaymentProps {
|
|
4
|
+
travelPlan: TravelPlanFormValues;
|
|
5
|
+
selectedPlan: CoveragePlanPremium | null;
|
|
6
|
+
buyerInfo: BuyerFormValues | null;
|
|
7
|
+
insuredPeople: InsuredPerson[];
|
|
8
|
+
onBack?: () => void;
|
|
9
|
+
onPayment?: (paymentMode: EPaymentMethod) => void;
|
|
10
|
+
isProcessing?: boolean;
|
|
11
|
+
onPremiumUpdate?: (premium: CoveragePlanPremium['premium'] | null) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const StepFourPayment: ({ travelPlan, selectedPlan, buyerInfo, insuredPeople, onBack, onPayment, isProcessing, onPremiumUpdate, }: StepFourPaymentProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -6,6 +6,7 @@ interface StepOneFormProps {
|
|
|
6
6
|
insuranceTypeValue: EInsuranceType;
|
|
7
7
|
isTMIVSelected: boolean;
|
|
8
8
|
isMSIGSelected: boolean;
|
|
9
|
+
isPVISelected?: boolean;
|
|
9
10
|
providerValue: string;
|
|
10
11
|
destinationIdValue: string;
|
|
11
12
|
updateDestinationId: (value: string | null) => void;
|
|
@@ -15,5 +16,5 @@ interface StepOneFormProps {
|
|
|
15
16
|
onSubmit: (event: React.FormEvent<HTMLFormElement>) => void;
|
|
16
17
|
formId?: string;
|
|
17
18
|
}
|
|
18
|
-
export declare const StepOneForm: ({ control, insuranceTypeValue, isTMIVSelected, isMSIGSelected, providerValue, destinationIdValue, updateDestinationId, tripStart, tripEnd, setValue, onSubmit, formId, }: StepOneFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const StepOneForm: ({ control, insuranceTypeValue, isTMIVSelected, isMSIGSelected, isPVISelected, providerValue, destinationIdValue, updateDestinationId, tripStart, tripEnd, setValue, onSubmit, formId, }: StepOneFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Control } from 'react-hook-form';
|
|
2
|
+
import { TravelPlanFormValues } from './types';
|
|
3
|
+
interface StepOneFormV2Props {
|
|
4
|
+
control: Control<TravelPlanFormValues>;
|
|
5
|
+
tripStart: Date | null;
|
|
6
|
+
tripEnd: Date | null;
|
|
7
|
+
setValue: (name: keyof TravelPlanFormValues, value: any) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const StepOneFormV2: ({ control, tripStart, tripEnd, setValue }: StepOneFormV2Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BuyerFormValues } from './types';
|
|
2
|
+
interface StepThreeBuyerInfoProps {
|
|
3
|
+
initialValues?: Partial<BuyerFormValues>;
|
|
4
|
+
onSubmit: (values: BuyerFormValues) => void;
|
|
5
|
+
onBack: () => void;
|
|
6
|
+
onFormRef?: (form: HTMLFormElement | null) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const StepThreeBuyerInfo: ({ initialValues, onSubmit, onBack: _onBack, onFormRef, }: StepThreeBuyerInfoProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EInsuranceType } from '../../types/insurance';
|
|
2
|
+
import { InsuredPerson } from './types';
|
|
3
|
+
interface StepThreeInsuredPeopleProps {
|
|
4
|
+
initialPeople: InsuredPerson[];
|
|
5
|
+
insuranceType: EInsuranceType;
|
|
6
|
+
adultsCount: number;
|
|
7
|
+
childrenCount: number;
|
|
8
|
+
providerCode?: string | null;
|
|
9
|
+
buyerInfo?: {
|
|
10
|
+
isInsuredPerson?: boolean;
|
|
11
|
+
} | null;
|
|
12
|
+
onSubmit: (people: InsuredPerson[]) => void;
|
|
13
|
+
onBack: () => void;
|
|
14
|
+
onFormRef?: (form: HTMLFormElement | null) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const StepThreeInsuredPeople: ({ initialPeople, insuranceType, providerCode, buyerInfo, onSubmit, onFormRef, }: StepThreeInsuredPeopleProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CoveragePlanPremium, CalculatePremiumRequest, TravelPlanFormValues } from './types';
|
|
2
|
+
interface StepTwoPlansV2Props {
|
|
3
|
+
requestPayload: CalculatePremiumRequest | null;
|
|
4
|
+
selectedPlanId?: number | null;
|
|
5
|
+
onPlanSelect: (plan: CoveragePlanPremium) => void;
|
|
6
|
+
insuranceType?: 'travel' | 'car' | 'motorcycle' | string;
|
|
7
|
+
travelPlan?: TravelPlanFormValues | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const StepTwoPlansV2: ({ requestPayload, selectedPlanId, onPlanSelect, insuranceType, travelPlan, }: StepTwoPlansV2Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface CountryInfo {
|
|
2
|
+
nameVi: string;
|
|
3
|
+
alpha2: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Get Vietnamese name and alpha2 code from country name
|
|
7
|
+
* @param countryName - Country name in English or Vietnamese
|
|
8
|
+
* @returns Country info with Vietnamese name and alpha2 code, or null if not found
|
|
9
|
+
*/
|
|
10
|
+
export declare const getCountryInfo: (countryName: string) => CountryInfo | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EDestination, EGender, EIdType, EInsuranceType, EPolicyType, ERelationToPrimary, ETravelType } from '../../types/insurance';
|
|
1
|
+
import { EDestination, EGender, EIdType, EInsuranceType, EPolicyType, ERelationToPrimary, ETravelType, EPersonType, EPersonValidationStatus } from '../../types/insurance';
|
|
2
2
|
export type InsuranceFormValues = {
|
|
3
3
|
provider: string;
|
|
4
4
|
type: EInsuranceType;
|
|
@@ -29,7 +29,7 @@ export type InsuredMember = {
|
|
|
29
29
|
fullName: string;
|
|
30
30
|
dob: string;
|
|
31
31
|
nationality: number | null;
|
|
32
|
-
|
|
32
|
+
idNumber: string;
|
|
33
33
|
gender?: EGender;
|
|
34
34
|
relationship?: ERelationToPrimary;
|
|
35
35
|
};
|
|
@@ -77,3 +77,70 @@ export type CoveragePlanQuote = {
|
|
|
77
77
|
currency?: string;
|
|
78
78
|
coverageDetails?: string;
|
|
79
79
|
};
|
|
80
|
+
export type TravelPlanFormValues = {
|
|
81
|
+
destinationCountryId: number | null;
|
|
82
|
+
startDate: Date | null;
|
|
83
|
+
endDate: Date | null;
|
|
84
|
+
insuranceType: EInsuranceType;
|
|
85
|
+
adultsCount: number;
|
|
86
|
+
childrenCount: number;
|
|
87
|
+
};
|
|
88
|
+
export type CalculatePremiumRequest = {
|
|
89
|
+
destinationCountryId: number;
|
|
90
|
+
startDate: string;
|
|
91
|
+
endDate: string;
|
|
92
|
+
adultsCount: number;
|
|
93
|
+
childrenCount: number;
|
|
94
|
+
};
|
|
95
|
+
export type CoveragePlanPremium = {
|
|
96
|
+
provider: string;
|
|
97
|
+
coveragePlan: {
|
|
98
|
+
id: number;
|
|
99
|
+
planCode: string;
|
|
100
|
+
planName: string;
|
|
101
|
+
coverageDetails: string;
|
|
102
|
+
};
|
|
103
|
+
premium: {
|
|
104
|
+
totalPremium: number;
|
|
105
|
+
premiumPerPerson: number;
|
|
106
|
+
days: number;
|
|
107
|
+
region: string;
|
|
108
|
+
} | null;
|
|
109
|
+
error: string | null;
|
|
110
|
+
};
|
|
111
|
+
export type CalculatePremiumResponse = {
|
|
112
|
+
destinationCountryId: number;
|
|
113
|
+
startDate: string;
|
|
114
|
+
endDate: string;
|
|
115
|
+
numberOfPeople: number;
|
|
116
|
+
plans: CoveragePlanPremium[];
|
|
117
|
+
};
|
|
118
|
+
export type BuyerFormValues = {
|
|
119
|
+
fullName: string;
|
|
120
|
+
gender?: EGender;
|
|
121
|
+
dateOfBirth: string;
|
|
122
|
+
nationality: number | null;
|
|
123
|
+
idType: EIdType;
|
|
124
|
+
idNumber: string;
|
|
125
|
+
phone: string;
|
|
126
|
+
email: string;
|
|
127
|
+
stateId: number | null;
|
|
128
|
+
wardId: number | null;
|
|
129
|
+
countryId: number | null;
|
|
130
|
+
address: string;
|
|
131
|
+
isInsuredPerson: boolean;
|
|
132
|
+
};
|
|
133
|
+
export type InsuredPersonFormValues = {
|
|
134
|
+
fullName: string;
|
|
135
|
+
dateOfBirth: string;
|
|
136
|
+
gender?: EGender;
|
|
137
|
+
idType: EIdType;
|
|
138
|
+
idNumber: string;
|
|
139
|
+
relationship: ERelationToPrimary;
|
|
140
|
+
nationality: number | null;
|
|
141
|
+
};
|
|
142
|
+
export type InsuredPerson = InsuredPersonFormValues & {
|
|
143
|
+
id: string;
|
|
144
|
+
status?: EPersonValidationStatus;
|
|
145
|
+
personType: EPersonType;
|
|
146
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RegisterOptions, FieldValues, Path } from 'react-hook-form';
|
|
2
|
+
export declare const createEmailRules: <TFieldValues extends FieldValues, TFieldName extends Path<TFieldValues> = Path<TFieldValues>>() => RegisterOptions<TFieldValues, TFieldName>;
|
|
3
|
+
export declare const createPhoneRules: <TFieldValues extends FieldValues, TFieldName extends Path<TFieldValues> = Path<TFieldValues>>() => RegisterOptions<TFieldValues, TFieldName>;
|
|
4
|
+
export declare const createIdNumberRules: <TFieldValues extends FieldValues, TFieldName extends Path<TFieldValues> = Path<TFieldValues>>() => RegisterOptions<TFieldValues, TFieldName>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EPersonValidationStatus } from '../../types/insurance';
|
|
2
|
+
import { InsuredPersonFormValues } from './types';
|
|
3
|
+
export type PersonValidationStatus = EPersonValidationStatus;
|
|
4
|
+
export declare const validatePerson: (person: InsuredPersonFormValues) => PersonValidationStatus;
|
|
5
|
+
export declare const hasPersonBeenInteracted: (person: InsuredPersonFormValues | undefined, isFormSubmitted: boolean) => boolean;
|
|
6
|
+
export declare const getFieldBorderColor: (fieldState: {
|
|
7
|
+
error?: {
|
|
8
|
+
message?: string;
|
|
9
|
+
};
|
|
10
|
+
isTouched?: boolean;
|
|
11
|
+
}, value: any, isValid?: boolean, isFormSubmitted?: boolean) => "gray.300" | "red.500" | "green.500";
|
|
12
|
+
export declare const isFieldValid: (fieldName: string, person: InsuredPersonFormValues | undefined, fieldState: any) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface InsurancePaymentModalProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
qrCodeUrl: string;
|
|
6
|
+
transactionPublicId?: string;
|
|
7
|
+
amount: number;
|
|
8
|
+
onSuccess?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const InsurancePaymentModal: React.FC<InsurancePaymentModalProps>;
|
|
11
|
+
export default InsurancePaymentModal;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type Step = {
|
|
2
|
+
id: number;
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
interface StepIndicatorCardProps {
|
|
6
|
+
currentStep: number;
|
|
7
|
+
steps: Step[];
|
|
8
|
+
onStepClick?: (stepNumber: number) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const StepIndicatorCard: ({ currentStep, steps, onStepClick }: StepIndicatorCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Step = {
|
|
2
|
+
id: number;
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
interface StepIndicatorHorizontalProps {
|
|
6
|
+
currentStep: number;
|
|
7
|
+
steps: Step[];
|
|
8
|
+
}
|
|
9
|
+
export declare const StepIndicatorHorizontal: ({ currentStep, steps }: StepIndicatorHorizontalProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -191,7 +191,9 @@ export declare const ApiUrls: {
|
|
|
191
191
|
orderList: string;
|
|
192
192
|
simList: string;
|
|
193
193
|
transactionGrouped: string;
|
|
194
|
+
bookedTransactionGrouped: string;
|
|
194
195
|
transactionGroupDetail: (groupPublicId: string) => string;
|
|
196
|
+
bookedTransactionGroupDetail: (groupPublicId: string) => string;
|
|
195
197
|
searchPackages: string;
|
|
196
198
|
searchDataPackages: string;
|
|
197
199
|
purchaseDataPackage: string;
|
|
@@ -220,6 +222,9 @@ export declare const ApiUrls: {
|
|
|
220
222
|
createPolicyFromQuote: (quoteId: number | string) => string;
|
|
221
223
|
coveragePlanQuotes: (provider: string) => string;
|
|
222
224
|
travelInsuranceSettings: string;
|
|
225
|
+
calculatePremium: string;
|
|
226
|
+
calculateSinglePlanPremium: string;
|
|
227
|
+
createTransaction: string;
|
|
223
228
|
};
|
|
224
229
|
insuranceLocation: {
|
|
225
230
|
countries: string;
|
|
@@ -3,10 +3,12 @@ export declare const COUNTRIES: {
|
|
|
3
3
|
nameVi: string;
|
|
4
4
|
alpha3: string;
|
|
5
5
|
alpha2: string;
|
|
6
|
+
aliases: string[];
|
|
6
7
|
}[];
|
|
7
8
|
export declare const countryMap: Map<string, {
|
|
8
9
|
name: string;
|
|
9
10
|
nameVi: string;
|
|
10
11
|
alpha3: string;
|
|
11
12
|
alpha2: string;
|
|
13
|
+
aliases: string[];
|
|
12
14
|
}>;
|
package/types/embeded-main.d.ts
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface IBookedSimGroupedItem {
|
|
2
|
+
id: number;
|
|
3
|
+
groupPublicId: string;
|
|
4
|
+
quantity: number;
|
|
5
|
+
status: string;
|
|
6
|
+
type: string;
|
|
7
|
+
provider: string;
|
|
8
|
+
simType?: string;
|
|
9
|
+
paymentType?: string;
|
|
10
|
+
totalAmount?: number;
|
|
11
|
+
createdAt: string | Date;
|
|
12
|
+
successful: number;
|
|
13
|
+
failed: number;
|
|
14
|
+
msisdn: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface GetBookedSimGroupedRespDto {
|
|
17
|
+
transactions: IBookedSimGroupedItem[];
|
|
18
|
+
total: number;
|
|
19
|
+
}
|
|
20
|
+
export interface GetBookedSimGroupedReqDto {
|
|
21
|
+
page?: number;
|
|
22
|
+
limit?: number;
|
|
23
|
+
}
|
|
24
|
+
type Props = {
|
|
25
|
+
defaultLimit?: number;
|
|
26
|
+
};
|
|
27
|
+
export declare const useBookedSimGrouped: ({ defaultLimit }: Props) => {
|
|
28
|
+
transactions: IBookedSimGroupedItem[];
|
|
29
|
+
total: number;
|
|
30
|
+
loading: boolean;
|
|
31
|
+
page: number;
|
|
32
|
+
limit: number;
|
|
33
|
+
refetchData: () => void;
|
|
34
|
+
setPage: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
35
|
+
setLimit: (limit: number) => void;
|
|
36
|
+
setLoading: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface IBookedTransactionGroupDetail {
|
|
2
|
+
groupPublicId: string;
|
|
3
|
+
phoneNumbers: string[];
|
|
4
|
+
quantity: number;
|
|
5
|
+
totalAmount: number;
|
|
6
|
+
packageInfo?: any;
|
|
7
|
+
customerInfo?: any;
|
|
8
|
+
deliveryInfo?: any;
|
|
9
|
+
simType?: string;
|
|
10
|
+
provider: string;
|
|
11
|
+
status: string;
|
|
12
|
+
notes: string;
|
|
13
|
+
type: string;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
transactions: Array<{
|
|
16
|
+
id: number;
|
|
17
|
+
msisdn: string;
|
|
18
|
+
status: string;
|
|
19
|
+
type: string;
|
|
20
|
+
provider: string;
|
|
21
|
+
providerBookingId?: string;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
errorMessage?: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export interface GetBookedTransactionGroupDetailRespDto {
|
|
27
|
+
success: boolean;
|
|
28
|
+
data?: IBookedTransactionGroupDetail;
|
|
29
|
+
error?: string;
|
|
30
|
+
}
|
|
31
|
+
type Props = {
|
|
32
|
+
groupPublicId: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const useBookedTransactionGroupDetail: ({ groupPublicId }: Props) => {
|
|
35
|
+
groupDetail: IBookedTransactionGroupDetail | null;
|
|
36
|
+
loading: boolean;
|
|
37
|
+
error: string | null;
|
|
38
|
+
refetchData: (silent?: boolean) => void;
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum EDocumentType {
|
|
2
|
+
CITIZEN_IDENTITY_CARD = "citizen-identity-card",
|
|
3
|
+
PASSPORT = "passport",
|
|
4
|
+
US_VISA = "us-visa"
|
|
5
|
+
}
|
|
6
|
+
export interface DocumentScanResult {
|
|
7
|
+
id_number?: string;
|
|
8
|
+
passport_id?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
date_of_birth?: string;
|
|
11
|
+
dob?: string;
|
|
12
|
+
gender?: string;
|
|
13
|
+
nationality?: string;
|
|
14
|
+
place_of_residence?: string;
|
|
15
|
+
place_of_origin?: string;
|
|
16
|
+
address?: string;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
export declare const useDocumentScan: () => {
|
|
20
|
+
scanDocument: (file: File | string, documentType: EDocumentType) => Promise<DocumentScanResult | null>;
|
|
21
|
+
isScanning: boolean;
|
|
22
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { CoveragePlanQuotesRequestPayload, CoveragePlanQuotesResponse } from '../components/Insurance/types';
|
|
3
|
-
import { EDestination, EGender, EInsuranceType, EPolicyType, ERelationToPrimary, ETravelType } from '../types/insurance';
|
|
3
|
+
import { EDestination, EGender, EInsuranceType, EPolicyType, ERelationToPrimary, ETravelType, EPersonType } from '../types/insurance';
|
|
4
4
|
interface Country {
|
|
5
5
|
id: number;
|
|
6
6
|
name: string;
|
|
@@ -61,10 +61,9 @@ type InsuranceDataContextValue = {
|
|
|
61
61
|
getDestinationLabelFromCode: (code?: string | null) => string;
|
|
62
62
|
getGenderLabel: (value?: EGender | null) => string;
|
|
63
63
|
getRelationLabel: (value?: ERelationToPrimary | null) => string;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}>>;
|
|
64
|
+
getPersonTypeLabel: (type: EPersonType, index: number, people: Array<{
|
|
65
|
+
personType?: EPersonType;
|
|
66
|
+
}>) => string;
|
|
68
67
|
getProviderLogoUrl: (providerCode?: string | null) => string | undefined;
|
|
69
68
|
};
|
|
70
69
|
export declare const InsuranceDataProvider: ({ children }: {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CoveragePlanPremium, CalculatePremiumRequest, InsuredPerson, TravelPlanFormValues } from '../components/Insurance/types';
|
|
2
|
+
interface UseInsurancePlansReturn {
|
|
3
|
+
plans: CoveragePlanPremium[];
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: string | null;
|
|
6
|
+
refetch: () => Promise<void>;
|
|
7
|
+
recalculatePremiumForPlan: (travelPlan: TravelPlanFormValues, insuredPeople: InsuredPerson[], planId: number, provider: string) => Promise<CoveragePlanPremium | null>;
|
|
8
|
+
}
|
|
9
|
+
export declare const useInsurancePlans: (requestPayload: CalculatePremiumRequest | null) => UseInsurancePlansReturn;
|
|
10
|
+
export {};
|