gotrip-fx-transaction-form 1.0.235-dev → 1.0.237-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 +33966 -30074
- package/package.json +1 -1
- package/types/components/Insurance/InsuranceDatePicker.d.ts +9 -0
- package/types/components/Insurance/{FormElements.d.ts → shared/FormElements.d.ts} +13 -3
- package/types/components/Insurance/shared/InfoBlockCard.d.ts +10 -0
- package/types/components/Insurance/shared/InsuranceRadioGroup.d.ts +14 -0
- package/types/components/Insurance/shared/PaymentMethodSelector.d.ts +8 -0
- package/types/components/Insurance/shared/SimpleSelect.d.ts +14 -0
- package/types/components/Insurance/shared/StepFooter.d.ts +8 -0
- package/types/components/Insurance/shared/index.d.ts +6 -0
- package/types/components/Modal/MotorInsurancePaymentModal.d.ts +11 -0
- package/types/components/MotorInsurance/Bike/BikePremiumSummary.d.ts +7 -0
- package/types/components/MotorInsurance/Bike/BikeStepOneForm.d.ts +10 -0
- package/types/components/MotorInsurance/Bike/BikeStepThreePayment.d.ts +17 -0
- package/types/components/MotorInsurance/Bike/BikeStepTwoVehicleInfo.d.ts +11 -0
- package/types/components/MotorInsurance/Bike/CreateBikeInsuranceForm.d.ts +8 -0
- package/types/components/MotorInsurance/Bike/index.d.ts +5 -0
- package/types/components/MotorInsurance/Car/CarPremiumSummary.d.ts +7 -0
- package/types/components/MotorInsurance/Car/CarStepFourPayment.d.ts +21 -0
- package/types/components/MotorInsurance/Car/CarStepOneForm.d.ts +8 -0
- package/types/components/MotorInsurance/Car/CarStepThreeInfo.d.ts +10 -0
- package/types/components/MotorInsurance/Car/CarStepTwoPlan.d.ts +10 -0
- package/types/components/MotorInsurance/Car/CreateCarInsuranceForm.d.ts +8 -0
- package/types/components/MotorInsurance/Car/car-form.constants.d.ts +23 -0
- package/types/components/MotorInsurance/Car/index.d.ts +6 -0
- package/types/components/MotorInsurance/CreateMotorInsuranceTransactionForm.d.ts +10 -0
- package/types/components/MotorInsurance/index.d.ts +4 -0
- package/types/components/MotorInsurance/motor-insurance.types.d.ts +322 -0
- package/types/constants/api-urls.d.ts +14 -0
- package/types/constants/regex.d.ts +4 -0
- package/types/hooks/useInsuranceData.d.ts +2 -11
- package/types/hooks/useLocationData.d.ts +22 -0
- package/types/hooks/useMotorInsurance.d.ts +16 -0
- package/types/hooks/useMotorInsuranceTransaction.d.ts +94 -0
- package/types/pages/agency/insurance/motor-transaction-create/CreateCarInsuranceTransactionPage.d.ts +1 -0
- package/types/pages/agency/insurance/motor-transaction-create/CreateMotorInsuranceTransactionPage.d.ts +1 -0
- package/types/pages/agency/insurance/motor-transaction-detail/MotorInsuranceTransactionDetailPage.d.ts +1 -0
- package/types/pages/agency/insurance/motor-transaction-list/MotorInsuranceTransactionListPage.d.ts +6 -0
- package/types/pages/guest/motor-insurance-create.d.ts +6 -0
- package/types/types/sdk.d.ts +2 -0
- package/types/util/transaction.util.d.ts +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as DatePicker } from 'react-datepicker';
|
|
2
|
+
export interface DatePickerInputProps {
|
|
3
|
+
value?: string;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Shared date picker input with calendar icon. Use as customInput for react-datepicker. */
|
|
8
|
+
export declare const DatePickerInput: import('react').ForwardRefExoticComponent<DatePickerInputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
9
|
+
export { DatePicker };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Control, FieldPath, FieldValues, RegisterOptions } from 'react-hook-form';
|
|
2
2
|
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
3
|
-
import { EDocumentType, DocumentScanResult } from '
|
|
3
|
+
import { EDocumentType, DocumentScanResult } from '../../../hooks/useDocumentScan';
|
|
4
4
|
export declare const FieldLabel: ({ label, tooltip }: {
|
|
5
|
-
label:
|
|
5
|
+
label: React.ReactNode;
|
|
6
6
|
tooltip?: string;
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export declare const InfoBanner: ({ children }: {
|
|
@@ -33,7 +33,7 @@ export declare enum InputType {
|
|
|
33
33
|
interface FormInputFieldProps<T extends FieldValues> {
|
|
34
34
|
name: FieldPath<T>;
|
|
35
35
|
control: Control<T>;
|
|
36
|
-
label:
|
|
36
|
+
label: React.ReactNode;
|
|
37
37
|
required?: boolean;
|
|
38
38
|
placeholder?: string;
|
|
39
39
|
type?: InputType;
|
|
@@ -49,6 +49,16 @@ interface FormInputFieldProps<T extends FieldValues> {
|
|
|
49
49
|
disabled?: boolean;
|
|
50
50
|
}
|
|
51
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;
|
|
52
|
+
interface FormTextareaFieldProps<T extends FieldValues> {
|
|
53
|
+
name: FieldPath<T>;
|
|
54
|
+
control: Control<T>;
|
|
55
|
+
label: string;
|
|
56
|
+
required?: boolean;
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
rules?: RegisterOptions<T>;
|
|
59
|
+
rows?: number;
|
|
60
|
+
}
|
|
61
|
+
export declare function FormTextareaField<T extends FieldValues>({ name, control, label, required, placeholder, rules, rows, }: FormTextareaFieldProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
52
62
|
interface CountryComboboxProps {
|
|
53
63
|
options: {
|
|
54
64
|
value: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
interface InfoBlockCardProps {
|
|
4
|
+
title: string;
|
|
5
|
+
icon?: IconDefinition;
|
|
6
|
+
onEdit?: () => void;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function InfoBlockCard({ title, icon, onEdit, children }: InfoBlockCardProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface InsuranceRadioGroupOption<T extends string> {
|
|
2
|
+
value: T;
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
interface InsuranceRadioGroupProps<T extends string> {
|
|
6
|
+
value: T;
|
|
7
|
+
onValueChange: (value: T) => void;
|
|
8
|
+
options: InsuranceRadioGroupOption<T>[];
|
|
9
|
+
direction?: 'row' | 'column';
|
|
10
|
+
gap?: number;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function InsuranceRadioGroup<T extends string>({ value, onValueChange, options, direction, gap, disabled, }: InsuranceRadioGroupProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EPaymentMethod } from '../../../types/enum';
|
|
2
|
+
interface PaymentMethodSelectorProps {
|
|
3
|
+
value: EPaymentMethod;
|
|
4
|
+
onChange: (value: EPaymentMethod) => void;
|
|
5
|
+
showTopupBalance?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function PaymentMethodSelector({ value, onChange, showTopupBalance, }: PaymentMethodSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface SimpleSelectOption<T> {
|
|
2
|
+
value: T;
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
interface SimpleSelectProps<T> {
|
|
6
|
+
value: T;
|
|
7
|
+
onChange: (value: T) => void;
|
|
8
|
+
options: SimpleSelectOption<T>[];
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
size?: 'sm' | 'md';
|
|
11
|
+
minWidth?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function SimpleSelect<T extends string | number>({ value, onChange, options, placeholder, size, minWidth, }: SimpleSelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface StepFooterProps {
|
|
2
|
+
onBack: () => void;
|
|
3
|
+
onNext?: () => void;
|
|
4
|
+
nextLabel?: string;
|
|
5
|
+
nextDisabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function StepFooter({ onBack, onNext, nextLabel, nextDisabled, }: StepFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { InsuranceRadioGroup } from './InsuranceRadioGroup';
|
|
2
|
+
export { PaymentMethodSelector } from './PaymentMethodSelector';
|
|
3
|
+
export { InfoBlockCard } from './InfoBlockCard';
|
|
4
|
+
export { StepFooter } from './StepFooter';
|
|
5
|
+
export { SimpleSelect } from './SimpleSelect';
|
|
6
|
+
export { FieldLabel, InfoBanner, OptionCard, DateInput, InputType, FormInputField, FormTextareaField, CountryCombobox, ProvinceCombobox, WardCombobox, } from './FormElements';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface MotorInsurancePaymentModalProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
qrCodeUrl: string;
|
|
6
|
+
transactionPublicId?: string;
|
|
7
|
+
amount: number;
|
|
8
|
+
onSuccess?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const MotorInsurancePaymentModal: React.FC<MotorInsurancePaymentModalProps>;
|
|
11
|
+
export default MotorInsurancePaymentModal;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MotorPremiumSummary as MotorPremiumSummaryType } from '../motor-insurance.types';
|
|
2
|
+
interface BikePremiumSummaryProps {
|
|
3
|
+
summary?: MotorPremiumSummaryType | null;
|
|
4
|
+
isLoading?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const BikePremiumSummary: ({ summary, isLoading }: BikePremiumSummaryProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MotorPlanFormValues, MotorPremiumSummary as MotorPremiumSummaryType } from '../motor-insurance.types';
|
|
2
|
+
import { Control, UseFormSetValue } from 'react-hook-form';
|
|
3
|
+
type BikeStepOneFormProps = {
|
|
4
|
+
control: Control<MotorPlanFormValues>;
|
|
5
|
+
setValue: UseFormSetValue<MotorPlanFormValues>;
|
|
6
|
+
premiumSummary?: MotorPremiumSummaryType | null;
|
|
7
|
+
isLoadingQuote?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const BikeStepOneForm: ({ control, setValue, premiumSummary, isLoadingQuote, }: BikeStepOneFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EPaymentMethod } from '../../../types/enum';
|
|
2
|
+
import { MotorPlanFormValues, MotorPremiumSummary, VehicleInfoFormValues } from '../motor-insurance.types';
|
|
3
|
+
export interface BikeStepThreePaymentProps {
|
|
4
|
+
planValues: MotorPlanFormValues;
|
|
5
|
+
premiumSummary: MotorPremiumSummary | null;
|
|
6
|
+
vehicleInfo: VehicleInfoFormValues | null;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
paymentMode: EPaymentMethod;
|
|
9
|
+
onPaymentModeChange: (mode: EPaymentMethod) => void;
|
|
10
|
+
isTermsAgreed: boolean;
|
|
11
|
+
onTermsAgreedChange: (agreed: boolean) => void;
|
|
12
|
+
onPayment: () => void;
|
|
13
|
+
isProcessing: boolean;
|
|
14
|
+
isGuest: boolean;
|
|
15
|
+
onBack: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const BikeStepThreePayment: ({ planValues, premiumSummary, vehicleInfo, isLoading, paymentMode, onPaymentModeChange, isTermsAgreed, onTermsAgreedChange, onPayment, isProcessing, isGuest, onBack, }: BikeStepThreePaymentProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VehicleInfoFormValues, MotorPremiumSummary as MotorPremiumSummaryType } from '../motor-insurance.types';
|
|
2
|
+
interface BikeStepTwoVehicleInfoProps {
|
|
3
|
+
initialValues?: Partial<VehicleInfoFormValues>;
|
|
4
|
+
premiumSummary?: MotorPremiumSummaryType | null;
|
|
5
|
+
isLoadingQuote?: boolean;
|
|
6
|
+
onSubmit: (values: VehicleInfoFormValues) => void;
|
|
7
|
+
onBack: () => void;
|
|
8
|
+
formRef?: (form: HTMLFormElement | null) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const BikeStepTwoVehicleInfo: ({ initialValues, premiumSummary, isLoadingQuote, onSubmit, formRef, }: BikeStepTwoVehicleInfoProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface CreateBikeInsuranceFormProps {
|
|
2
|
+
storageKey: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
onBack?: () => void;
|
|
5
|
+
onSuccess?: (transactionData: unknown) => void;
|
|
6
|
+
scrollable?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const CreateBikeInsuranceForm: ({ storageKey, title, onBack, onSuccess, scrollable, }: CreateBikeInsuranceFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { BikePremiumSummary } from './BikePremiumSummary';
|
|
2
|
+
export { BikeStepOneForm } from './BikeStepOneForm';
|
|
3
|
+
export { BikeStepTwoVehicleInfo } from './BikeStepTwoVehicleInfo';
|
|
4
|
+
export { BikeStepThreePayment } from './BikeStepThreePayment';
|
|
5
|
+
export { CreateBikeInsuranceForm } from './CreateBikeInsuranceForm';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MotorPremiumSummary as MotorPremiumSummaryType } from '../motor-insurance.types';
|
|
2
|
+
interface CarPremiumSummaryProps {
|
|
3
|
+
summary: MotorPremiumSummaryType | null | undefined;
|
|
4
|
+
isLoading?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const CarPremiumSummary: ({ summary, isLoading }: CarPremiumSummaryProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EPaymentMethod } from '../../../types/enum';
|
|
2
|
+
import { CarPlanFormValues, CarPremiumSummary, CarVehicleInfoFormValues } from '../motor-insurance.types';
|
|
3
|
+
interface CarStepFourPaymentProps {
|
|
4
|
+
planValues: CarPlanFormValues;
|
|
5
|
+
premiumSummary: CarPremiumSummary | null;
|
|
6
|
+
vehicleInfo: CarVehicleInfoFormValues | null;
|
|
7
|
+
buyerCertificateInfo: CarVehicleInfoFormValues | null;
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
paymentMode: EPaymentMethod;
|
|
10
|
+
onPaymentModeChange: (mode: EPaymentMethod) => void;
|
|
11
|
+
isTermsAgreed: boolean;
|
|
12
|
+
onTermsAgreedChange: (agreed: boolean) => void;
|
|
13
|
+
onPayment: () => void;
|
|
14
|
+
isProcessing: boolean;
|
|
15
|
+
isGuest: boolean;
|
|
16
|
+
onBack: () => void;
|
|
17
|
+
getProviderLogoUrl: (providerCode?: string | null) => string | undefined;
|
|
18
|
+
getTermsAgreeHtml: (providerCode?: string | null) => string | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare const CarStepFourPayment: ({ planValues, premiumSummary, vehicleInfo, buyerCertificateInfo, isLoading, paymentMode, onPaymentModeChange, isTermsAgreed, onTermsAgreedChange, onPayment, isProcessing, isGuest, onBack, getProviderLogoUrl, getTermsAgreeHtml, }: CarStepFourPaymentProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Control, UseFormSetValue } from 'react-hook-form';
|
|
2
|
+
import { CarPlanFormValues } from '../motor-insurance.types';
|
|
3
|
+
interface CarStepOneFormProps {
|
|
4
|
+
control: Control<CarPlanFormValues>;
|
|
5
|
+
setValue: UseFormSetValue<CarPlanFormValues>;
|
|
6
|
+
}
|
|
7
|
+
export declare const CarStepOneForm: ({ control, setValue }: CarStepOneFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CarVehicleInfoFormValues, MotorPremiumSummary as MotorPremiumSummaryType } from '../motor-insurance.types';
|
|
2
|
+
interface CarStepThreeInfoProps {
|
|
3
|
+
initialValues?: Partial<CarVehicleInfoFormValues>;
|
|
4
|
+
premiumSummary: MotorPremiumSummaryType | null;
|
|
5
|
+
isLoadingQuote?: boolean;
|
|
6
|
+
onSubmit: (values: CarVehicleInfoFormValues) => void;
|
|
7
|
+
formRef?: (form: HTMLFormElement | null) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const CarStepThreeInfo: ({ initialValues, premiumSummary, isLoadingQuote, onSubmit, formRef, }: CarStepThreeInfoProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Control, UseFormSetValue } from 'react-hook-form';
|
|
2
|
+
import { CarPlanFormValues, CarPremiumSummary } from '../motor-insurance.types';
|
|
3
|
+
interface CarStepTwoPlanProps {
|
|
4
|
+
control: Control<CarPlanFormValues>;
|
|
5
|
+
setValue: UseFormSetValue<CarPlanFormValues>;
|
|
6
|
+
premiumSummary: CarPremiumSummary | null;
|
|
7
|
+
isLoadingQuote?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const CarStepTwoPlan: ({ control, setValue, premiumSummary, isLoadingQuote, }: CarStepTwoPlanProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface CreateCarInsuranceFormProps {
|
|
2
|
+
storageKey: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
onBack?: () => void;
|
|
5
|
+
onSuccess?: (transactionData: unknown) => void;
|
|
6
|
+
scrollable?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const CreateCarInsuranceForm: ({ storageKey, title, onBack, onSuccess, scrollable, }: CreateCarInsuranceFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EVehicleTypeCode, EVehicleUsageType } from '../motor-insurance.types';
|
|
2
|
+
/** Manufacturing year range: from this year to current year. */
|
|
3
|
+
export declare const MANUFACTURING_YEAR_MIN = 2007;
|
|
4
|
+
export declare const SEAT_COUNT_OPTIONS: readonly [4, 5, 7, 9, 16, 24, 45];
|
|
5
|
+
/** Usage purpose options (mục đích sử dụng) – EVehicleUsageType. */
|
|
6
|
+
export declare const USAGE_PURPOSE_OPTIONS: {
|
|
7
|
+
value: EVehicleUsageType;
|
|
8
|
+
label: string;
|
|
9
|
+
}[];
|
|
10
|
+
/** Vehicle type code options (loại vận chuyển đặc biệt) by purpose + usage. */
|
|
11
|
+
export type VehicleTypeCodeOption = {
|
|
12
|
+
value: EVehicleTypeCode;
|
|
13
|
+
label: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function getVehicleTypeCodeOptions(isCommercialUse: boolean, usagePurposeCode: EVehicleUsageType | null): VehicleTypeCodeOption[];
|
|
16
|
+
/** Seat and load capacity bounds by usage + vehicle type (from business rules). */
|
|
17
|
+
export type SeatLoadBounds = {
|
|
18
|
+
seatMin: number;
|
|
19
|
+
seatMax: number;
|
|
20
|
+
loadMin?: number;
|
|
21
|
+
loadMax?: number;
|
|
22
|
+
};
|
|
23
|
+
export declare function getSeatAndLoadBounds(usagePurposeCode: EVehicleUsageType | null, vehicleTypeCode: EVehicleTypeCode | null): SeatLoadBounds;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { CarPremiumSummary } from './CarPremiumSummary';
|
|
2
|
+
export { CarStepOneForm } from './CarStepOneForm';
|
|
3
|
+
export { CarStepTwoPlan } from './CarStepTwoPlan';
|
|
4
|
+
export { CarStepThreeInfo } from './CarStepThreeInfo';
|
|
5
|
+
export { CarStepFourPayment } from './CarStepFourPayment';
|
|
6
|
+
export { CreateCarInsuranceForm } from './CreateCarInsuranceForm';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EMotorVehicleType } from './motor-insurance.types';
|
|
2
|
+
export interface CreateMotorInsuranceTransactionFormProps {
|
|
3
|
+
vehicleType: EMotorVehicleType;
|
|
4
|
+
storageKey: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
onBack?: () => void;
|
|
7
|
+
onSuccess?: (transactionData: unknown) => void;
|
|
8
|
+
scrollable?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const CreateMotorInsuranceTransactionForm: ({ vehicleType, storageKey, title, onBack, onSuccess, scrollable, }: CreateMotorInsuranceTransactionFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { BikePremiumSummary, BikeStepOneForm, BikeStepTwoVehicleInfo, CreateBikeInsuranceForm, } from './Bike';
|
|
2
|
+
export { CarPremiumSummary, CarStepOneForm, CreateCarInsuranceForm } from './Car';
|
|
3
|
+
export { CreateMotorInsuranceTransactionForm } from './CreateMotorInsuranceTransactionForm';
|
|
4
|
+
export * from './motor-insurance.types';
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { Control, UseFormSetValue } from 'react-hook-form';
|
|
2
|
+
import { EPaymentMethod } from '../../types/enum';
|
|
3
|
+
export declare enum EMotorVehicleType {
|
|
4
|
+
BIKE = "bike",
|
|
5
|
+
CAR = "car"
|
|
6
|
+
}
|
|
7
|
+
export declare enum EBikeVehicleType {
|
|
8
|
+
UNDER_50CC = "under_50cc",
|
|
9
|
+
OVER_50CC = "over_50cc",
|
|
10
|
+
THREE_WHEEL = "three_wheel"
|
|
11
|
+
}
|
|
12
|
+
export declare enum EBikeEngineCategory {
|
|
13
|
+
BELOW_50CC = "BL50",
|
|
14
|
+
ABOVE_50CC = "AB50",
|
|
15
|
+
ELECTRIC = "ELEC",
|
|
16
|
+
THREE_WHEEL = "3WHL",
|
|
17
|
+
SIMILAR_MOTOR = "SIM"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Purpose code.
|
|
21
|
+
*/
|
|
22
|
+
export declare enum EPurposeTypeCode {
|
|
23
|
+
BUSINESS = "BUSINESS",
|
|
24
|
+
NON_BUSINESS = "NON_BUSINESS"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Vehicle usage type enum.
|
|
28
|
+
*/
|
|
29
|
+
export declare enum EVehicleUsageType {
|
|
30
|
+
PASSENGER = "PASSENGER",
|
|
31
|
+
CARGO = "CARGO",
|
|
32
|
+
PASSENGER_CARGO = "PASSENGER_CARGO",
|
|
33
|
+
SPECIAL_PURPOSE = "SPECIAL_PURPOSE"
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* High-level vehicle type enum.
|
|
37
|
+
*/
|
|
38
|
+
export declare enum EVehicleTypeCode {
|
|
39
|
+
PASSENGER_STANDARD = "PASSENGER_STANDARD",
|
|
40
|
+
DRIVING_TRAINING = "DRIVING_TRAINING",
|
|
41
|
+
TRACTOR_HEAD = "TRACTOR_HEAD",
|
|
42
|
+
AMBULANCE = "AMBULANCE",
|
|
43
|
+
MONEY_TRUCK = "MONEY_TRUCK",
|
|
44
|
+
TRACTOR = "TRACTOR",
|
|
45
|
+
OTHER_SPECIAL_CAR = "OTHER_SPECIAL_CAR",
|
|
46
|
+
TAXI = "TAXI",
|
|
47
|
+
BUS = "BUS",
|
|
48
|
+
CARGO_STANDARD = "CARGO_STANDARD"
|
|
49
|
+
}
|
|
50
|
+
export type EMotorProvider = 'PVI' | 'DBV' | 'BAO_MINH';
|
|
51
|
+
export type MotorPlanFormValues = {
|
|
52
|
+
vehicleType: EBikeVehicleType;
|
|
53
|
+
durationYears: 1 | 2 | 3;
|
|
54
|
+
startDate: Date | null;
|
|
55
|
+
endDate: Date | null;
|
|
56
|
+
provider: EMotorProvider;
|
|
57
|
+
passengerAccidentEnabled: boolean;
|
|
58
|
+
passengerAccidentLevel: number;
|
|
59
|
+
passengerAccidentCount: number;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* DTO for bike quote API (aligned with backend BikeQuoteRequest).
|
|
63
|
+
*/
|
|
64
|
+
export interface BikeQuoteRequestDto {
|
|
65
|
+
/** Coverage start date, format yyyy-MM-dd */
|
|
66
|
+
startDate: string;
|
|
67
|
+
/** Coverage end date, format yyyy-MM-dd */
|
|
68
|
+
endDate: string;
|
|
69
|
+
vehicleTypeCode: EBikeEngineCategory;
|
|
70
|
+
occupantAccidentSumInsured?: number;
|
|
71
|
+
insuredOccupantCount?: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* DTO for bike quote response.
|
|
75
|
+
*/
|
|
76
|
+
export interface BikeQuoteResponseDto {
|
|
77
|
+
success: boolean;
|
|
78
|
+
totalPremium?: number;
|
|
79
|
+
mandatoryPremium?: number;
|
|
80
|
+
occupantAccidentPremium?: number;
|
|
81
|
+
error?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* DTO for creating bike policy/certificate (BikePolicyRequest).
|
|
85
|
+
*/
|
|
86
|
+
export interface BikePolicyRequestDto {
|
|
87
|
+
/** Start date, yyyy-MM-dd or dd/MM/yyyy depending on provider */
|
|
88
|
+
startDate: string;
|
|
89
|
+
endDate: string;
|
|
90
|
+
ownerName: string;
|
|
91
|
+
ownerAddress: string;
|
|
92
|
+
customerEmail: string;
|
|
93
|
+
phoneNumber?: string;
|
|
94
|
+
licensePlate: string;
|
|
95
|
+
engineNumber: string;
|
|
96
|
+
chassisNumber: string;
|
|
97
|
+
vehicleTypeCode: EBikeEngineCategory;
|
|
98
|
+
brand?: string;
|
|
99
|
+
manufacturingYear?: string;
|
|
100
|
+
occupantAccidentSumInsured?: number;
|
|
101
|
+
insuredOccupantCount?: number;
|
|
102
|
+
occupantAccidentPremium?: number;
|
|
103
|
+
totalPremium?: number;
|
|
104
|
+
paymentMode: EPaymentMethod;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* DTO for bike policy response (BikePolicyResponse).
|
|
108
|
+
* Includes extra info used for displaying result / QR code.
|
|
109
|
+
*/
|
|
110
|
+
export interface BikePolicyResponseDto {
|
|
111
|
+
policyId?: number | string;
|
|
112
|
+
policyNumber?: string;
|
|
113
|
+
transactionPublicId?: string;
|
|
114
|
+
orderId?: number;
|
|
115
|
+
qrCodeUrl?: string;
|
|
116
|
+
totalAmount?: number;
|
|
117
|
+
status?: string;
|
|
118
|
+
error?: string;
|
|
119
|
+
}
|
|
120
|
+
export type VehicleInfoFormValues = {
|
|
121
|
+
ownerFullName: string;
|
|
122
|
+
ownerAddress: string;
|
|
123
|
+
ownerIdNumber: string;
|
|
124
|
+
hasLicensePlate: boolean;
|
|
125
|
+
licensePlate: string;
|
|
126
|
+
chassisNumber: string;
|
|
127
|
+
engineNumber: string;
|
|
128
|
+
certificatePhone: string;
|
|
129
|
+
certificateEmail: string;
|
|
130
|
+
};
|
|
131
|
+
/** Insurance owner type: individual or company */
|
|
132
|
+
export declare enum EOwnerType {
|
|
133
|
+
INDIVIDUAL = "individual",
|
|
134
|
+
COMPANY = "company"
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Vehicle info for car policies extends the shared motor vehicle info
|
|
138
|
+
* with optional car-only attributes that may be required by providers.
|
|
139
|
+
*/
|
|
140
|
+
export type CarVehicleInfoFormValues = VehicleInfoFormValues & {
|
|
141
|
+
/** Manufacturing year as string (for exact provider mapping if needed) */
|
|
142
|
+
manufacturingYearText?: string;
|
|
143
|
+
/** Years in use */
|
|
144
|
+
yearInUse?: number | null;
|
|
145
|
+
/** Owner type: individual (name, idNumber) or company (companyName, taxNumber) */
|
|
146
|
+
ownerType?: EOwnerType | string;
|
|
147
|
+
/** Company name (when ownerType is company) */
|
|
148
|
+
companyName?: string;
|
|
149
|
+
/** Company tax number (when ownerType is company) */
|
|
150
|
+
companyTaxNumber?: string;
|
|
151
|
+
/** Province/state ID for address */
|
|
152
|
+
stateId?: number | null;
|
|
153
|
+
/** Ward/commune ID for address */
|
|
154
|
+
wardId?: number | null;
|
|
155
|
+
/** Whether user wants hard copy certificate */
|
|
156
|
+
hardCopyEnabled?: boolean;
|
|
157
|
+
/** Address to receive hard copy certificate (when hardCopyEnabled is true) */
|
|
158
|
+
receiveAddress?: string;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Car-specific plan values used across the car motor insurance wizard.
|
|
162
|
+
*
|
|
163
|
+
* Step 1 captures vehicle configuration (manufacturing year, purpose, seats, ...),
|
|
164
|
+
* Step 2 adds provider + duration + effective dates, and optional passenger accident cover.
|
|
165
|
+
*
|
|
166
|
+
* These fields are intentionally generic so they can be mapped to different
|
|
167
|
+
* provider DTOs on the backend (purpose codes, special transport flags, etc.).
|
|
168
|
+
*/
|
|
169
|
+
export type CarPlanFormValues = {
|
|
170
|
+
/** Manufacturing year */
|
|
171
|
+
manufacturingYear: number | null;
|
|
172
|
+
/** Whether the car is used for commercial transport */
|
|
173
|
+
isCommercialUse: boolean;
|
|
174
|
+
/** Usage purpose code (from API) */
|
|
175
|
+
usagePurposeCode: EVehicleUsageType | null;
|
|
176
|
+
/** Vehicle type code – sub of purpose + usage (EVehicleTypeCode). */
|
|
177
|
+
vehicleTypeCode: EVehicleTypeCode | null;
|
|
178
|
+
/** Number of seats (1–45) */
|
|
179
|
+
seatCount: number | null;
|
|
180
|
+
/** Load capacity in tons; required when usage is cargo (Chở hàng) */
|
|
181
|
+
loadCapacity: number | null;
|
|
182
|
+
/** Insurance duration in years */
|
|
183
|
+
durationYears: 1 | 2 | 3;
|
|
184
|
+
/** Coverage start date */
|
|
185
|
+
startDate: Date | null;
|
|
186
|
+
/** Coverage end date */
|
|
187
|
+
endDate: Date | null;
|
|
188
|
+
/** Insurance provider */
|
|
189
|
+
provider: EMotorProvider;
|
|
190
|
+
/** Enable/disable passenger accident coverage */
|
|
191
|
+
passengerAccidentEnabled: boolean;
|
|
192
|
+
/** Passenger accident sum insured per person per accident */
|
|
193
|
+
passengerAccidentLevel: number;
|
|
194
|
+
/** Number of passengers covered for accident */
|
|
195
|
+
passengerAccidentCount: number;
|
|
196
|
+
};
|
|
197
|
+
export type MotorPremiumSummary = {
|
|
198
|
+
mandatoryPremium: number;
|
|
199
|
+
tndsPersonCompensation: number;
|
|
200
|
+
tndsPropertyCompensation: number;
|
|
201
|
+
passengerAccidentPremium: number;
|
|
202
|
+
passengerAccidentLevel: number;
|
|
203
|
+
passengerAccidentPeopleCount: number;
|
|
204
|
+
totalPremium: number;
|
|
205
|
+
};
|
|
206
|
+
/** Alias for readability when working with car flows. */
|
|
207
|
+
export type CarPremiumSummary = MotorPremiumSummary;
|
|
208
|
+
/**
|
|
209
|
+
* DTO for car quote API (aligned with backend MotorCreateQuoteRequestCar / TESTING_MOTOR_INSURANCE.md).
|
|
210
|
+
*/
|
|
211
|
+
export interface CarQuoteRequestDto {
|
|
212
|
+
/** Coverage start date, format yyyy-MM-dd */
|
|
213
|
+
startDate: string;
|
|
214
|
+
/** Coverage end date, format yyyy-MM-dd */
|
|
215
|
+
endDate: string;
|
|
216
|
+
purposeTypeCode: EPurposeTypeCode;
|
|
217
|
+
vehicleUsageType: EVehicleUsageType;
|
|
218
|
+
vehicleTypeCode: EVehicleTypeCode;
|
|
219
|
+
/** Number of seats */
|
|
220
|
+
numberOfSeats: number;
|
|
221
|
+
/** Load capacity in tons */
|
|
222
|
+
loadCapacity?: number;
|
|
223
|
+
/** Passenger accident sum insured */
|
|
224
|
+
occupantAccidentSumInsured?: number;
|
|
225
|
+
/** Number of passengers covered for accident */
|
|
226
|
+
insuredOccupantCount?: number;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* DTO for car quote response (MotorCreateQuoteResponse).
|
|
230
|
+
*/
|
|
231
|
+
export interface CarQuoteResponseDto {
|
|
232
|
+
success: boolean;
|
|
233
|
+
totalPremium?: number;
|
|
234
|
+
mandatoryPremium?: number;
|
|
235
|
+
occupantAccidentPremium?: number;
|
|
236
|
+
vehicleTypeCode?: string;
|
|
237
|
+
error?: string;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* DTO for creating car policy/certificate (aligned with MotorCreatePolicyRequestCar).
|
|
241
|
+
*/
|
|
242
|
+
export interface CarPolicyRequestDto {
|
|
243
|
+
totalPremium: number;
|
|
244
|
+
/** Coverage start date, format yyyy-MM-dd */
|
|
245
|
+
startDate: string;
|
|
246
|
+
/** Coverage end date, format yyyy-MM-dd */
|
|
247
|
+
endDate: string;
|
|
248
|
+
ownerName: string;
|
|
249
|
+
ownerAddress: string;
|
|
250
|
+
/** Contact/buyer name: ownerName (individual) or companyName (company) */
|
|
251
|
+
customerName: string;
|
|
252
|
+
customerAddress?: string;
|
|
253
|
+
ownerType?: EOwnerType | string;
|
|
254
|
+
ownerIdNumber?: string;
|
|
255
|
+
companyName?: string;
|
|
256
|
+
companyTaxNumber?: string;
|
|
257
|
+
hardCopyEnabled?: boolean;
|
|
258
|
+
receiveAddress?: string;
|
|
259
|
+
stateId?: number | null;
|
|
260
|
+
wardId?: number | null;
|
|
261
|
+
customerEmail: string;
|
|
262
|
+
phoneNumber?: string;
|
|
263
|
+
purposeTypeCode: EPurposeTypeCode;
|
|
264
|
+
vehicleUsageType: EVehicleUsageType;
|
|
265
|
+
vehicleTypeCode: EVehicleTypeCode;
|
|
266
|
+
numberOfSeats: number;
|
|
267
|
+
/** Load capacity in tons */
|
|
268
|
+
loadCapacity?: number;
|
|
269
|
+
licensePlate: string;
|
|
270
|
+
chassisNumber: string;
|
|
271
|
+
engineNumber: string;
|
|
272
|
+
mandatoryPremium: number;
|
|
273
|
+
occupantAccidentSumInsured?: number;
|
|
274
|
+
insuredOccupantCount?: number;
|
|
275
|
+
occupantAccidentPremium?: number;
|
|
276
|
+
manufacturingYear?: string;
|
|
277
|
+
yearInUse?: string;
|
|
278
|
+
brand?: string;
|
|
279
|
+
model?: string;
|
|
280
|
+
hideLicensePlate?: boolean;
|
|
281
|
+
hidePremium?: boolean;
|
|
282
|
+
paymentMode: EPaymentMethod;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* DTO for car policy response (MotorCreatePolicyResponse).
|
|
286
|
+
*/
|
|
287
|
+
export interface CarPolicyResponseDto {
|
|
288
|
+
success?: boolean;
|
|
289
|
+
policyId?: number | string;
|
|
290
|
+
policyNumber?: string;
|
|
291
|
+
certificateUrl?: string;
|
|
292
|
+
transactionPublicId?: string;
|
|
293
|
+
qrCodeUrl?: string;
|
|
294
|
+
totalAmount?: number;
|
|
295
|
+
status?: string;
|
|
296
|
+
error?: string;
|
|
297
|
+
}
|
|
298
|
+
export declare const VEHICLE_TYPE_LABELS: Record<EBikeVehicleType, string>;
|
|
299
|
+
export declare const BIKE_VEHICLE_TYPE_CODE_LABELS: Record<string, string>;
|
|
300
|
+
export declare const getBikeVehicleTypeCodeLabel: (code?: string | null) => string;
|
|
301
|
+
/** Car vehicle type code labels (loại vận chuyển đặc biệt) for display. */
|
|
302
|
+
export declare const CAR_VEHICLE_TYPE_CODE_LABELS: Record<string, string>;
|
|
303
|
+
export declare const getVehicleTypeLabel: (vehicleType?: string) => string;
|
|
304
|
+
export declare const getPassengerAccidentLevelLabel: (value?: number | null) => string;
|
|
305
|
+
/** Usage purpose (mục đích sử dụng) labels for display. */
|
|
306
|
+
export declare const USAGE_PURPOSE_LABELS: Record<EVehicleUsageType, string>;
|
|
307
|
+
export declare const getCarUsagePurposeLabel: (code?: string | null) => string;
|
|
308
|
+
export declare const getCarVehicleTypeCodeLabel: (code?: string | null) => string;
|
|
309
|
+
export declare const getOwnerTypeLabel: (ownerType?: string | null) => string;
|
|
310
|
+
export declare const DURATION_LABELS: Record<1 | 1.5 | 2 | 2.5 | 3, string>;
|
|
311
|
+
export declare const PASSENGER_ACCIDENT_LEVELS: {
|
|
312
|
+
value: number;
|
|
313
|
+
label: string;
|
|
314
|
+
}[];
|
|
315
|
+
export type MotorStepOneFormProps = {
|
|
316
|
+
control: Control<MotorPlanFormValues>;
|
|
317
|
+
setValue: UseFormSetValue<MotorPlanFormValues>;
|
|
318
|
+
premiumSummary?: MotorPremiumSummary;
|
|
319
|
+
onNext: () => void;
|
|
320
|
+
onBack?: () => void;
|
|
321
|
+
isStepReady: boolean;
|
|
322
|
+
};
|