gotrip-fx-transaction-form 1.0.246-dev → 1.0.249-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/index.js +22453 -22305
- package/package.json +1 -1
- package/types/components/Common/MultiTagCombobox.d.ts +14 -0
- package/types/components/Common/PrimaryRadioGroup.d.ts +15 -0
- package/types/components/Common/TimeRangeSelect.d.ts +17 -0
- package/types/components/Insurance/InsuranceDatePicker.d.ts +1 -1
- package/types/components/Insurance/InsuranceSummaryOverview.d.ts +5 -0
- package/types/components/Insurance/StepFourPayment.d.ts +7 -1
- package/types/components/Insurance/shared/index.d.ts +0 -1
- package/types/constants/api-urls.d.ts +9 -0
- package/types/hooks/useCoupon.d.ts +43 -0
- package/types/hooks/useCouponValidation.d.ts +27 -0
- package/types/pages/admin/coupons/CouponFormPage.d.ts +1 -0
- package/types/pages/admin/coupons/CouponListPage.d.ts +1 -0
- package/types/types/coupon.d.ts +52 -0
- package/types/types/insurance-transaction.dto.d.ts +4 -0
- package/types/util/couponErrorMessages.d.ts +2 -0
- package/types/components/Insurance/shared/InsuranceRadioGroup.d.ts +0 -15
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
controlBorderRadius?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const MultiTagCombobox: ({ options, values, placeholder, emptyText, onChange, controlBorderRadius, }: MultiTagComboboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface PrimaryRadioGroupOption<T extends string> {
|
|
2
|
+
value: T;
|
|
3
|
+
label: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface PrimaryRadioGroupProps<T extends string> {
|
|
7
|
+
value: T;
|
|
8
|
+
onValueChange: (value: T) => void;
|
|
9
|
+
options: PrimaryRadioGroupOption<T>[];
|
|
10
|
+
direction?: 'row' | 'column';
|
|
11
|
+
gap?: number;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function PrimaryRadioGroup<T extends string>({ value, onValueChange, options, direction, gap, disabled, }: PrimaryRadioGroupProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
fieldBorderRadius?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const TimeRangeSelect: ({ startValue, endValue, options, onStartChange, onEndChange, error, startLabel, endLabel, fieldBorderRadius, }: TimeRangeSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -3,7 +3,7 @@ export interface DatePickerInputProps {
|
|
|
3
3
|
value?: string;
|
|
4
4
|
onClick?: () => void;
|
|
5
5
|
placeholder?: string;
|
|
6
|
+
borderRadius?: string;
|
|
6
7
|
}
|
|
7
|
-
/** Shared date picker input with calendar icon. Use as customInput for react-datepicker. */
|
|
8
8
|
export declare const DatePickerInput: import('react').ForwardRefExoticComponent<DatePickerInputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
9
9
|
export { DatePicker };
|
|
@@ -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,11 @@ 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
|
+
description?: string | null;
|
|
19
|
+
} | null) => void;
|
|
14
20
|
}
|
|
15
|
-
export declare const StepFourPayment: ({ travelScope, travelPlan, selectedPlan, buyerInfo, insuredPeople, onBack, onPayment, isProcessing, onPremiumUpdate, }: StepFourPaymentProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const StepFourPayment: ({ travelScope, travelPlan, selectedPlan, buyerInfo, insuredPeople, onBack, onPayment, isProcessing, onPremiumUpdate, onCouponChange, }: StepFourPaymentProps) => 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,43 @@
|
|
|
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
|
+
patchingStatus: boolean;
|
|
22
|
+
fetchCoupon: () => Promise<{
|
|
23
|
+
ok: true;
|
|
24
|
+
data: TCouponDetail | undefined;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
data: undefined;
|
|
28
|
+
}>;
|
|
29
|
+
saveCoupon: (payload: unknown) => Promise<{
|
|
30
|
+
ok: true;
|
|
31
|
+
error?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
ok: false;
|
|
34
|
+
error: unknown;
|
|
35
|
+
}>;
|
|
36
|
+
patchCouponStatus: (nextStatus: "active" | "inactive") => Promise<{
|
|
37
|
+
ok: true;
|
|
38
|
+
error?: undefined;
|
|
39
|
+
} | {
|
|
40
|
+
ok: false;
|
|
41
|
+
error: unknown;
|
|
42
|
+
}>;
|
|
43
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
description?: string | null;
|
|
14
|
+
};
|
|
15
|
+
export declare const useCouponValidation: () => {
|
|
16
|
+
isApplyingCoupon: boolean;
|
|
17
|
+
validateCoupon: (params: ValidateCouponParams) => Promise<{
|
|
18
|
+
ok: false;
|
|
19
|
+
message: string;
|
|
20
|
+
data?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
ok: true;
|
|
23
|
+
data: ValidateCouponResult;
|
|
24
|
+
message?: undefined;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
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;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
description?: string | null;
|
|
41
|
+
status?: TCouponStatus;
|
|
42
|
+
startAt: string;
|
|
43
|
+
expireAt: string;
|
|
44
|
+
totalUsageLimit: number | null;
|
|
45
|
+
tenantIds?: number[] | null;
|
|
46
|
+
discountType: string;
|
|
47
|
+
discountValue: number;
|
|
48
|
+
maxDiscountAmount: number | null;
|
|
49
|
+
conditions?: TCouponConditions;
|
|
50
|
+
productTypes: string[] | null;
|
|
51
|
+
providers: string[] | null;
|
|
52
|
+
};
|
|
@@ -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>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
interface InsuranceRadioGroupOption<T extends string> {
|
|
2
|
-
value: T;
|
|
3
|
-
label: string;
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
}
|
|
6
|
-
interface InsuranceRadioGroupProps<T extends string> {
|
|
7
|
-
value: T;
|
|
8
|
-
onValueChange: (value: T) => void;
|
|
9
|
-
options: InsuranceRadioGroupOption<T>[];
|
|
10
|
-
direction?: 'row' | 'column';
|
|
11
|
-
gap?: number;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare function InsuranceRadioGroup<T extends string>({ value, onValueChange, options, direction, gap, disabled, }: InsuranceRadioGroupProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|