gotrip-fx-transaction-form 1.0.245-dev → 1.0.247-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.245-dev",
3
+ "version": "1.0.247-dev",
4
4
  "description": "FX Transaction Form ES6 module",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -0,0 +1,13 @@
1
+ export type TMultiTagOption = {
2
+ label: string;
3
+ value: string;
4
+ };
5
+ type MultiTagComboboxProps = {
6
+ options: TMultiTagOption[];
7
+ values: string[];
8
+ placeholder?: string;
9
+ emptyText?: string;
10
+ onChange: (nextValues: string[]) => void;
11
+ };
12
+ export declare const MultiTagCombobox: ({ options, values, placeholder, emptyText, onChange, }: MultiTagComboboxProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,16 @@
1
+ type TTimeOption = {
2
+ label: string;
3
+ value: string;
4
+ };
5
+ type TimeRangeSelectProps = {
6
+ startValue: string;
7
+ endValue: string;
8
+ options: TTimeOption[];
9
+ onStartChange: (value: string) => void;
10
+ onEndChange: (value: string) => void;
11
+ error?: string;
12
+ startLabel?: string;
13
+ endLabel?: string;
14
+ };
15
+ export declare const TimeRangeSelect: ({ startValue, endValue, options, onStartChange, onEndChange, error, startLabel, endLabel, }: TimeRangeSelectProps) => import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -1,6 +1,11 @@
1
1
  export type InsuranceSummaryOverviewProps = {
2
2
  summary: {
3
3
  totalPremium: number;
4
+ premiumBreakdown?: {
5
+ beforeDiscount: number;
6
+ couponCode: string;
7
+ discountAmount: number;
8
+ };
4
9
  providerLabel: string;
5
10
  providerLogoUrl?: string;
6
11
  planName?: string | null;
@@ -11,5 +11,10 @@ export interface StepFourPaymentProps {
11
11
  onPayment?: (paymentMode: EPaymentMethod) => void;
12
12
  isProcessing?: boolean;
13
13
  onPremiumUpdate?: (premium: CoveragePlanPremium['premium'] | null) => void;
14
+ onCouponChange?: (coupon: {
15
+ code: string;
16
+ discountAmount: number;
17
+ finalAmount: number;
18
+ } | null) => void;
14
19
  }
15
- export declare const StepFourPayment: ({ travelScope, travelPlan, selectedPlan, buyerInfo, insuredPeople, onBack, onPayment, isProcessing, onPremiumUpdate, }: StepFourPaymentProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const StepFourPayment: ({ travelScope, travelPlan, selectedPlan, buyerInfo, insuredPeople, onBack, onPayment, isProcessing, onPremiumUpdate, onCouponChange, }: StepFourPaymentProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,11 @@
1
- import { MotorPlanFormValues, MotorPremiumSummary as MotorPremiumSummaryType } from '../motor-insurance.types';
1
+ import { EMotorProvider, MotorPlanFormValues, MotorPremiumSummary as MotorPremiumSummaryType } from '../motor-insurance.types';
2
2
  import { Control, UseFormSetValue } from 'react-hook-form';
3
3
  type BikeStepOneFormProps = {
4
4
  control: Control<MotorPlanFormValues>;
5
5
  setValue: UseFormSetValue<MotorPlanFormValues>;
6
6
  premiumSummary?: MotorPremiumSummaryType | null;
7
7
  isLoadingQuote?: boolean;
8
+ providers?: EMotorProvider[];
8
9
  };
9
- export declare const BikeStepOneForm: ({ control, setValue, premiumSummary, isLoadingQuote, }: BikeStepOneFormProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const BikeStepOneForm: ({ control, setValue, premiumSummary, isLoadingQuote, providers, }: BikeStepOneFormProps) => import("react/jsx-runtime").JSX.Element;
10
11
  export {};
@@ -1,8 +1,10 @@
1
+ import { EMotorProvider } from '../motor-insurance.types';
1
2
  export interface CreateBikeInsuranceFormProps {
2
3
  storageKey: string;
3
4
  title?: string;
4
5
  onBack?: () => void;
5
6
  onSuccess?: (transactionData: unknown) => void;
6
7
  scrollable?: boolean;
8
+ allowedProviders?: EMotorProvider[];
7
9
  }
8
- export declare const CreateBikeInsuranceForm: ({ storageKey, title, onBack, onSuccess, scrollable, }: CreateBikeInsuranceFormProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const CreateBikeInsuranceForm: ({ storageKey, title, onBack, onSuccess, scrollable, allowedProviders, }: CreateBikeInsuranceFormProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,11 @@
1
1
  import { Control, UseFormSetValue } from 'react-hook-form';
2
- import { CarPlanFormValues, CarPremiumSummary } from '../motor-insurance.types';
2
+ import { CarPlanFormValues, CarPremiumSummary, EMotorProvider } from '../motor-insurance.types';
3
3
  interface CarStepTwoPlanProps {
4
4
  control: Control<CarPlanFormValues>;
5
5
  setValue: UseFormSetValue<CarPlanFormValues>;
6
6
  premiumSummary: CarPremiumSummary | null;
7
7
  isLoadingQuote?: boolean;
8
+ providers?: EMotorProvider[];
8
9
  }
9
- export declare const CarStepTwoPlan: ({ control, setValue, premiumSummary, isLoadingQuote, }: CarStepTwoPlanProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const CarStepTwoPlan: ({ control, setValue, premiumSummary, isLoadingQuote, providers, }: CarStepTwoPlanProps) => import("react/jsx-runtime").JSX.Element;
10
11
  export {};
@@ -1,8 +1,10 @@
1
+ import { EMotorProvider } from '../motor-insurance.types';
1
2
  export interface CreateCarInsuranceFormProps {
2
3
  storageKey: string;
3
4
  title?: string;
4
5
  onBack?: () => void;
5
6
  onSuccess?: (transactionData: unknown) => void;
6
7
  scrollable?: boolean;
8
+ allowedProviders?: EMotorProvider[];
7
9
  }
8
- export declare const CreateCarInsuranceForm: ({ storageKey, title, onBack, onSuccess, scrollable, }: CreateCarInsuranceFormProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const CreateCarInsuranceForm: ({ storageKey, title, onBack, onSuccess, scrollable, allowedProviders, }: CreateCarInsuranceFormProps) => import("react/jsx-runtime").JSX.Element;
@@ -248,6 +248,15 @@ export declare const ApiUrls: {
248
248
  quickRecommendations: string;
249
249
  quickRecommendationsByCountry: (countryId: number) => string;
250
250
  };
251
+ couponHandlers: {
252
+ validate: string;
253
+ list: string;
254
+ summary: string;
255
+ detail: (id: number) => string;
256
+ create: string;
257
+ update: (id: number) => string;
258
+ patchStatus: (id: number) => string;
259
+ };
251
260
  location: {
252
261
  provinces: string;
253
262
  wards: (stateId: number | string) => string;
@@ -0,0 +1,35 @@
1
+ import { TCouponDetail, TCouponRow } from '../types/coupon';
2
+ export type TCouponListParams = {
3
+ page?: number;
4
+ limit?: number;
5
+ status?: string;
6
+ search?: string;
7
+ productType?: string;
8
+ provider?: string;
9
+ };
10
+ export declare const useCoupon: (id?: string, isEdit?: boolean) => {
11
+ listingLoading: boolean;
12
+ rows: TCouponRow[];
13
+ listTotal: number;
14
+ fetchList: (params?: TCouponListParams) => Promise<{
15
+ ok: true;
16
+ } | {
17
+ ok: false;
18
+ }>;
19
+ formLoading: boolean;
20
+ saving: boolean;
21
+ fetchCoupon: () => Promise<{
22
+ ok: true;
23
+ data: TCouponDetail | undefined;
24
+ } | {
25
+ ok: false;
26
+ data: undefined;
27
+ }>;
28
+ saveCoupon: (payload: unknown) => Promise<{
29
+ ok: true;
30
+ error?: undefined;
31
+ } | {
32
+ ok: false;
33
+ error: unknown;
34
+ }>;
35
+ };
@@ -0,0 +1,26 @@
1
+ import { ECouponProductType } from '../types/coupon';
2
+ type ValidateCouponParams = {
3
+ code: string;
4
+ orderTotal: number;
5
+ productType: ECouponProductType;
6
+ provider: string;
7
+ };
8
+ type ValidateCouponResult = {
9
+ discountAmount: number;
10
+ finalAmount: number;
11
+ couponId: number;
12
+ couponCode: string;
13
+ };
14
+ export declare const useCouponValidation: () => {
15
+ isApplyingCoupon: boolean;
16
+ validateCoupon: (params: ValidateCouponParams) => Promise<{
17
+ ok: false;
18
+ message: string;
19
+ data?: undefined;
20
+ } | {
21
+ ok: true;
22
+ data: ValidateCouponResult;
23
+ message?: undefined;
24
+ }>;
25
+ };
26
+ export {};
@@ -0,0 +1 @@
1
+ export declare const CouponForm: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const CouponListing: () => import("react/jsx-runtime").JSX.Element;
@@ -16,6 +16,7 @@ type FeatureFlags = {
16
16
  vnptSim: ToggleFeatureFlag;
17
17
  vnptData: ToggleFeatureFlag;
18
18
  insurance: InsuranceFeatureFlag;
19
+ motorInsurance: InsuranceFeatureFlag;
19
20
  };
20
21
  type AppSettings = {
21
22
  featureFlags: FeatureFlags;
@@ -0,0 +1,51 @@
1
+ export declare enum ECouponProductType {
2
+ BIKE_COMPULSORY = "bike_compulsory",
3
+ CAR_COMPULSORY = "car_compulsory",
4
+ TRAVEL_DOMESTIC = "travel_domestic",
5
+ TRAVEL_INTERNATIONAL = "travel_international",
6
+ ESIM = "esim"
7
+ }
8
+ export type TCouponStatus = 'active' | 'inactive';
9
+ export type TCouponConditions = {
10
+ minOrderValue: number | null;
11
+ firstOrderOnly: boolean;
12
+ flashSaleStart: string | null;
13
+ flashSaleEnd: string | null;
14
+ };
15
+ export type TCouponRow = {
16
+ id: number;
17
+ code: string;
18
+ name: string;
19
+ status: string;
20
+ usedCount: number;
21
+ totalUsageLimit: number | null;
22
+ expireAt: string;
23
+ startAt?: string;
24
+ createdAt?: string;
25
+ discountType: string;
26
+ discountValue: number;
27
+ maxDiscountAmount?: number | null;
28
+ productTypes?: string[] | null;
29
+ providers?: string[] | null;
30
+ };
31
+ export type TCouponAdminSummary = {
32
+ totalCoupons: number;
33
+ activeCoupons: number;
34
+ usageToday: number;
35
+ totalDiscountAmountThisMonth: number;
36
+ };
37
+ export type TCouponDetail = {
38
+ code: string;
39
+ name: string;
40
+ status?: TCouponStatus;
41
+ startAt: string;
42
+ expireAt: string;
43
+ totalUsageLimit: number | null;
44
+ tenantIds?: number[] | null;
45
+ discountType: string;
46
+ discountValue: number;
47
+ maxDiscountAmount: number | null;
48
+ conditions?: TCouponConditions;
49
+ productTypes: string[] | null;
50
+ providers: string[] | null;
51
+ };
@@ -89,6 +89,10 @@ export interface InsuranceTransaction {
89
89
  travelScope: ETravelScope;
90
90
  status: EPolicyStatus;
91
91
  totalAmount: number;
92
+ premiumBeforeDiscount?: number;
93
+ couponId?: number;
94
+ couponCode?: string;
95
+ couponDiscountAmount?: number;
92
96
  providerPolicyId?: string;
93
97
  providerPolicyNumber?: string;
94
98
  providerData?: Record<string, any>;
@@ -227,6 +227,7 @@ export interface ITravelAgencyTenantSettings {
227
227
  esimInbound: boolean;
228
228
  simDomestic: boolean;
229
229
  insurance: boolean;
230
+ motorInsurance: boolean;
230
231
  };
231
232
  fx: {
232
233
  useCases: EUseCaseses[];
@@ -239,6 +240,9 @@ export interface ITravelAgencyTenantSettings {
239
240
  insurance: {
240
241
  providers: string[];
241
242
  };
243
+ motorInsurance: {
244
+ providers: string[];
245
+ };
242
246
  }
243
247
  export interface IBankTenantSettings {
244
248
  availableCurrencies: string[];
@@ -0,0 +1,2 @@
1
+ export declare function getBusinessMessageFromCode(code: string | undefined | null): string;
2
+ export declare function getCouponErrorCodeFromAxios(err: unknown): string | undefined;