gotrip-fx-transaction-form 1.0.216-dev → 1.0.217-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gotrip-fx-transaction-form",
3
- "version": "1.0.216-dev",
3
+ "version": "1.0.217-dev",
4
4
  "description": "FX Transaction Form ES6 module",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -1,4 +1,4 @@
1
- import { CoveragePlanPremium, TravelPlanFormValues } from '../types';
1
+ import { CoveragePlanPremium, TravelPlanFormValues, InsuranceTypeAndPeopleCountValues } from '../types';
2
2
  export interface QuickCoveragePlan {
3
3
  countryId: number;
4
4
  provider: string;
@@ -7,7 +7,7 @@ export interface QuickCoveragePlan {
7
7
  interface QuickCoveragePlanCardProps {
8
8
  quickPlan: QuickCoveragePlan;
9
9
  countryName: string;
10
- onBuyNow: (plan: CoveragePlanPremium, adultsCount: number) => void;
10
+ onBuyNow: (plan: CoveragePlanPremium, countryId: number, values: InsuranceTypeAndPeopleCountValues) => void;
11
11
  travelInsuranceSettings?: Record<string, any>;
12
12
  travelPlan?: TravelPlanFormValues | null;
13
13
  }
@@ -0,0 +1,10 @@
1
+ import { Control } from 'react-hook-form';
2
+ import { InsuranceTypeAndPeopleCountValues } from './types';
3
+ /** Props: control must have fields insuranceType, adultsCount, teenagerCount, childrenCount. */
4
+ interface InsuranceTypeAndPeopleCountFieldsProps {
5
+ control: Control<InsuranceTypeAndPeopleCountValues>;
6
+ setValue?: (name: keyof InsuranceTypeAndPeopleCountValues, value: number) => void;
7
+ showFamilyNote?: boolean;
8
+ }
9
+ export declare const InsuranceTypeAndPeopleCountFields: ({ control, setValue, showFamilyNote, }: InsuranceTypeAndPeopleCountFieldsProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -1,11 +1,11 @@
1
1
  import { Control } from 'react-hook-form';
2
- import { TravelPlanFormValues, CoveragePlanPremium } from './types';
2
+ import { TravelPlanFormValues, CoveragePlanPremium, InsuranceTypeAndPeopleCountValues } from './types';
3
3
  interface StepOneFormProps {
4
4
  control: Control<TravelPlanFormValues>;
5
5
  tripStart: Date | null;
6
6
  tripEnd: Date | null;
7
7
  setValue: (name: keyof TravelPlanFormValues, value: any) => void;
8
- onQuickPlanSelect?: (plan: CoveragePlanPremium, adultsCount: number, countryId: number) => void;
8
+ onQuickPlanSelect?: (plan: CoveragePlanPremium, countryId: number, values: InsuranceTypeAndPeopleCountValues) => void;
9
9
  recommendBoxHeight?: string;
10
10
  onBack?: () => void;
11
11
  onNext?: () => void;
@@ -12,6 +12,7 @@ interface StepThreeProps {
12
12
  insuredPeople: InsuredPerson[];
13
13
  insuranceType: EInsuranceType;
14
14
  adultsCount: number | null;
15
+ teenagersCount: number | null;
15
16
  childrenCount: number | null;
16
17
  onBuyerInfoSubmit: (data: BuyerFormValues) => void;
17
18
  onInsuredPeopleSubmit: (people: InsuredPerson[]) => void;
@@ -20,5 +21,5 @@ interface StepThreeProps {
20
21
  buyerInfoFormRef: React.RefObject<HTMLFormElement | null>;
21
22
  insuredPeopleFormRef: React.RefObject<HTMLFormElement | null>;
22
23
  }
23
- export declare const StepThree: ({ control, tripStart, tripEnd, stepThreeChildStep, onStepThreeChildStepClick, selectedPlan, buyerInfo, insuredPeople, insuranceType, adultsCount, childrenCount, onBuyerInfoSubmit, onInsuredPeopleSubmit, onStepThreeBack, onDatesChange, buyerInfoFormRef, insuredPeopleFormRef, }: StepThreeProps) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const StepThree: ({ control, tripStart, tripEnd, stepThreeChildStep, onStepThreeChildStepClick, selectedPlan, buyerInfo, insuredPeople, insuranceType, adultsCount, teenagersCount, childrenCount, onBuyerInfoSubmit, onInsuredPeopleSubmit, onStepThreeBack, onDatesChange, buyerInfoFormRef, insuredPeopleFormRef, }: StepThreeProps) => import("react/jsx-runtime").JSX.Element;
24
25
  export {};
@@ -4,6 +4,7 @@ interface StepThreeInsuredPeopleProps {
4
4
  initialPeople: InsuredPerson[];
5
5
  insuranceType: EInsuranceType;
6
6
  adultsCount: number;
7
+ teenagersCount: number;
7
8
  childrenCount: number;
8
9
  providerCode?: string | null;
9
10
  buyerInfo?: {
@@ -83,13 +83,17 @@ export type TravelPlanFormValues = {
83
83
  endDate: Date | null;
84
84
  insuranceType: EInsuranceType;
85
85
  adultsCount: number;
86
+ teenagerCount: number;
86
87
  childrenCount: number;
87
88
  };
89
+ export type InsuranceTypeAndPeopleCountValues = Pick<TravelPlanFormValues, 'insuranceType' | 'adultsCount' | 'teenagerCount' | 'childrenCount'>;
88
90
  export type CalculatePremiumRequest = {
89
91
  destinationCountryId: number;
90
92
  startDate: string;
91
93
  endDate: string;
94
+ insuranceType?: EInsuranceType;
92
95
  adultsCount: number;
96
+ teenagerCount: number;
93
97
  childrenCount: number;
94
98
  providers?: string[];
95
99
  sortOrder?: 'asc' | 'desc';
@@ -107,6 +111,10 @@ export type CoveragePlanPremium = {
107
111
  premiumPerPerson: number;
108
112
  days: number;
109
113
  region: string;
114
+ freeTeenagerCount?: number;
115
+ paidTeenagerCount?: number;
116
+ freeChildrenCount?: number;
117
+ paidChildrenCount?: number;
110
118
  } | null;
111
119
  error: string | null;
112
120
  };
@@ -1,6 +1,10 @@
1
- import { EPersonValidationStatus } from '../../types/insurance';
1
+ import { EPersonValidationStatus, EPersonType } from '../../types/insurance';
2
2
  import { InsuredPersonFormValues } from './types';
3
3
  export type PersonValidationStatus = EPersonValidationStatus;
4
+ /** Calculate age in full years from date of birth (YYYY-MM-DD). Returns null if invalid. */
5
+ export declare const calculateAge: (dateOfBirth: string) => number | null;
6
+ /** Validate date of birth by person type (adult/teenager/children). Same rules for all providers. */
7
+ export declare const validateDateOfBirthByPersonType: (personType: EPersonType, dateOfBirth: string) => string | true;
4
8
  export declare const validatePerson: (person: InsuredPersonFormValues) => PersonValidationStatus;
5
9
  export declare const hasPersonBeenInteracted: (person: InsuredPersonFormValues | undefined, isFormSubmitted: boolean) => boolean;
6
10
  export declare const getFieldBorderColor: (fieldState: {
@@ -20,6 +20,7 @@ export interface Ward {
20
20
  type InsuranceDataContextValue = {
21
21
  providers: string[];
22
22
  countries: Country[];
23
+ vietnamCountryId: number | null;
23
24
  provinces: Province[];
24
25
  wardsByState: Record<number, Ward[]>;
25
26
  loadingProviders: boolean;
@@ -62,6 +62,7 @@ export declare enum EDestination {
62
62
  }
63
63
  export declare enum EPersonType {
64
64
  ADULT = "adult",
65
+ TEENAGER = "teenager",
65
66
  CHILDREN = "children"
66
67
  }
67
68
  export declare enum EPersonValidationStatus {