gotrip-fx-transaction-form 1.0.284-dev → 1.0.286-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 +26117 -25946
- package/package.json +1 -1
- package/types/components/Insurance/CreateInsuranceTransactionForm.d.ts +12 -2
- package/types/components/Insurance/FxInsuranceCouponBox.d.ts +10 -0
- package/types/components/Insurance/StepFourPayment.d.ts +2 -1
- package/types/components/TransactionList/PublicIdActionMenu.d.ts +3 -1
- package/types/constants/api-urls.d.ts +4 -0
- package/types/constants/env.d.ts +1 -0
- package/types/constants/tenant.d.ts +3 -0
- package/types/constants/transaction-status-labels.d.ts +3 -0
- package/types/hooks/traveller-confirmation/submit-confirmation.util.d.ts +1 -0
- package/types/hooks/traveller-confirmation/traveller-confirmation-flow.d.ts +4 -0
- package/types/hooks/traveller-confirmation/types.d.ts +22 -0
- package/types/hooks/traveller-confirmation/usePurchaseTravellerConfirmation.d.ts +12 -0
- package/types/hooks/traveller-confirmation/useTravellerConfirmationFetch.d.ts +2 -0
- package/types/hooks/useAutoSelectBankBranchAndDepartment.d.ts +19 -0
- package/types/hooks/useConfirmTransaction.d.ts +16 -31
- package/types/hooks/useFxPrefill.d.ts +19 -0
- package/types/pages/agency/traveller-confirmation/PurchaseTravellerConfirmation.d.ts +5 -0
- package/types/pages/agency/traveller-confirmation/TravellerPurchaseConfirmation.d.ts +2 -0
- package/types/types/enum.d.ts +1 -1
- package/types/types/insurance-transaction.dto.d.ts +1 -0
- package/types/utils/bank.d.ts +4 -0
- package/types/utils/transaction-confirmation-link.d.ts +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { TravelPlanFormValues, CoveragePlanPremium, BuyerFormValues, InsuredPerson } from './types';
|
|
3
|
-
import { ETravelScope } from '../../types/insurance';
|
|
3
|
+
import { EInsuranceProviderType, ETravelScope } from '../../types/insurance';
|
|
4
4
|
import { IUser } from '../../types/response.dto';
|
|
5
5
|
export type InsuranceFormInitialData = {
|
|
6
6
|
formValues: TravelPlanFormValues;
|
|
@@ -30,5 +30,15 @@ export interface CreateInsuranceTransactionFormProps {
|
|
|
30
30
|
initialData?: InsuranceFormInitialData | null;
|
|
31
31
|
mode?: 'create' | 'edit';
|
|
32
32
|
editingPublicId?: string;
|
|
33
|
+
initialProviders?: EInsuranceProviderType[];
|
|
34
|
+
prefillCouponCode?: string;
|
|
35
|
+
fxPrefillData?: {
|
|
36
|
+
startDate: Date | null;
|
|
37
|
+
endDate: Date | null;
|
|
38
|
+
destinationCountryId: number | null;
|
|
39
|
+
travellerFullName: string;
|
|
40
|
+
identityDocumentNumber: string | null;
|
|
41
|
+
travellerPhone: string | null;
|
|
42
|
+
};
|
|
33
43
|
}
|
|
34
|
-
export declare const CreateInsuranceTransactionForm: ({ storageKey, title, travelScope, onBack, onSuccess, scrollable, recommendBoxHeight, isAdminMode, selectedUser, onOpenUserSelector, initialData, mode, editingPublicId, }: CreateInsuranceTransactionFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export declare const CreateInsuranceTransactionForm: ({ storageKey, title, travelScope, onBack, onSuccess, scrollable, recommendBoxHeight, isAdminMode, selectedUser, onOpenUserSelector, initialData, mode, editingPublicId, initialProviders, prefillCouponCode, fxPrefillData, }: CreateInsuranceTransactionFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface FxInsuranceCouponBoxProps {
|
|
2
|
+
couponCode: string;
|
|
3
|
+
transactionPublicId: string;
|
|
4
|
+
countryCodeDes?: string | null;
|
|
5
|
+
countryNameDes?: string | null;
|
|
6
|
+
discountPercent?: number;
|
|
7
|
+
maxDiscountAmount?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const FxInsuranceCouponBox: ({ couponCode, transactionPublicId, countryCodeDes, countryNameDes, discountPercent, maxDiscountAmount, }: FxInsuranceCouponBoxProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -36,5 +36,6 @@ export interface StepFourPaymentProps {
|
|
|
36
36
|
finalAmount: number;
|
|
37
37
|
description?: string | null;
|
|
38
38
|
} | null;
|
|
39
|
+
prefillCouponCode?: string;
|
|
39
40
|
}
|
|
40
|
-
export declare const StepFourPayment: ({ travelScope, travelPlan, selectedPlan, buyerInfo, insuredPeople, onBack, onPayment, isProcessing, onPremiumUpdate, onCouponChange, paymentType: paymentTypeProp, isAdminMode, waitForApproval, onWaitForApprovalChange, hasSelectedUser, submitLabel, showApprovalToggle, mode, selectedUserTenantId, selectedUserId, initialCoupon, }: StepFourPaymentProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare const StepFourPayment: ({ travelScope, travelPlan, selectedPlan, buyerInfo, insuredPeople, onBack, onPayment, isProcessing, onPremiumUpdate, onCouponChange, paymentType: paymentTypeProp, isAdminMode, waitForApproval, onWaitForApprovalChange, hasSelectedUser, submitLabel, showApprovalToggle, mode, selectedUserTenantId, selectedUserId, initialCoupon, prefillCouponCode, }: StepFourPaymentProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { TransactionStatus } from '../../types/enum';
|
|
1
2
|
type Props = {
|
|
2
3
|
publicId: string;
|
|
4
|
+
status?: TransactionStatus;
|
|
3
5
|
};
|
|
4
|
-
export declare const PublicIdActionMenu: ({ publicId }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const PublicIdActionMenu: ({ publicId, status }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
5
7
|
export {};
|
|
@@ -24,6 +24,7 @@ export declare const ApiUrls: {
|
|
|
24
24
|
create: string;
|
|
25
25
|
createMany: string;
|
|
26
26
|
confirm: string;
|
|
27
|
+
purchaseConfirm: string;
|
|
27
28
|
sendBankTransaction: string;
|
|
28
29
|
checkTicketStatus: string;
|
|
29
30
|
getByBankTransactionId: (transactionId: string) => string;
|
|
@@ -38,6 +39,8 @@ export declare const ApiUrls: {
|
|
|
38
39
|
updateTransaction: string;
|
|
39
40
|
validateTransactionTiming: string;
|
|
40
41
|
calculateCommission: (publicId: string) => string;
|
|
42
|
+
getPublicInfo: (publicId: string) => string;
|
|
43
|
+
autoCoupon: (publicId: string) => string;
|
|
41
44
|
};
|
|
42
45
|
role: {
|
|
43
46
|
list: string;
|
|
@@ -89,6 +92,7 @@ export declare const ApiUrls: {
|
|
|
89
92
|
removeMembers: string;
|
|
90
93
|
organizationTree: string;
|
|
91
94
|
abbankList: string;
|
|
95
|
+
bankDepartmentList: (shortName: string) => string;
|
|
92
96
|
departmentsByTenantTypes: (types: string) => string;
|
|
93
97
|
usersByTenantTypes: (types: string) => string;
|
|
94
98
|
};
|
package/types/constants/env.d.ts
CHANGED
|
@@ -6,4 +6,7 @@ export declare const tenantTypeOptions: {
|
|
|
6
6
|
export declare const BANK_CODES: {
|
|
7
7
|
readonly TCB: "TCB";
|
|
8
8
|
readonly ABBANK: "ABBANK";
|
|
9
|
+
readonly VPBANK: "VPBANK";
|
|
9
10
|
};
|
|
11
|
+
/** Banks with department selection + ZNS confirmation (ABBANK, VPBANK) */
|
|
12
|
+
export declare const BANKS_WITH_DEPARTMENT_AND_ZNS_FLOW: readonly ["ABBANK", "VPBANK"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isConfirmationApiSuccess: (code?: string) => boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TransactionStatus } from '../../types/enum';
|
|
2
|
+
/** Luồng xác nhận mua — `/confirm-purchase/:id` */
|
|
3
|
+
export declare const PURCHASE_CONFIRMATION_STATUSES: TransactionStatus[];
|
|
4
|
+
export declare const PURCHASE_CONFIRMATION_PENDING_STATUS = TransactionStatus.CUSTOMER_PURCHASE_CONFIRMATION;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TransactionStatus } from '../../types/enum';
|
|
2
|
+
import { IAgent, ITransaction } from '../../types/response.dto';
|
|
3
|
+
export type TravellerConfirmationTransaction = {
|
|
4
|
+
id: number;
|
|
5
|
+
bankCode: string;
|
|
6
|
+
bankName: string;
|
|
7
|
+
bookerName?: string;
|
|
8
|
+
bookerEmail?: string;
|
|
9
|
+
ticketNumber: string;
|
|
10
|
+
travellerName: string;
|
|
11
|
+
confirmationToken: string;
|
|
12
|
+
status: TransactionStatus;
|
|
13
|
+
customerCode: string;
|
|
14
|
+
};
|
|
15
|
+
export type TravellerConfirmationContext = {
|
|
16
|
+
transaction: TravellerConfirmationTransaction | null;
|
|
17
|
+
agent: IAgent | null;
|
|
18
|
+
groupTransactions: ITransaction[];
|
|
19
|
+
isLoading: boolean;
|
|
20
|
+
fetchError: string | null;
|
|
21
|
+
refetch: () => Promise<void>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TravellerConfirmationTransaction } from './types';
|
|
2
|
+
type Params = {
|
|
3
|
+
transaction: TravellerConfirmationTransaction | null;
|
|
4
|
+
refetch: () => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
export declare const usePurchaseTravellerConfirmation: ({ transaction, refetch }: Params) => {
|
|
7
|
+
isPending: boolean;
|
|
8
|
+
isCompleted: boolean;
|
|
9
|
+
isSubmitting: boolean;
|
|
10
|
+
submitPurchaseConfirmation: () => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type BankDepartmentOption = {
|
|
2
|
+
id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
parentId?: number;
|
|
5
|
+
};
|
|
6
|
+
type Params = {
|
|
7
|
+
departmentOptions: BankDepartmentOption[];
|
|
8
|
+
selectedBranch: number | null;
|
|
9
|
+
setSelectedBranch: (id: number | null) => void;
|
|
10
|
+
selectedDepartment: number | null;
|
|
11
|
+
setSelectedDepartment: (id: number | null) => void;
|
|
12
|
+
onDepartmentSelected?: (id: number) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const useAutoSelectBankBranchAndDepartment: ({ departmentOptions, selectedBranch, setSelectedBranch, selectedDepartment, setSelectedDepartment, onDepartmentSelected, }: Params) => {
|
|
15
|
+
branches: BankDepartmentOption[];
|
|
16
|
+
departments: BankDepartmentOption[];
|
|
17
|
+
shouldShowBranchSelect: boolean;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -1,41 +1,26 @@
|
|
|
1
1
|
import { TransactionStatus } from '../types/enum';
|
|
2
|
-
import { IAgent, ITransaction
|
|
2
|
+
import { IAgent, ITransaction } from '../types/response.dto';
|
|
3
3
|
export type ConfirmTransactionData = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
agent?: IUser;
|
|
17
|
-
groupTransactions?: ITransaction[];
|
|
18
|
-
};
|
|
19
|
-
message: string;
|
|
4
|
+
id: number;
|
|
5
|
+
bankCode: string;
|
|
6
|
+
bankName: string;
|
|
7
|
+
bookerName?: string;
|
|
8
|
+
bookerEmail?: string;
|
|
9
|
+
ticketNumber: string;
|
|
10
|
+
travellerName: string;
|
|
11
|
+
confirmationToken: string;
|
|
12
|
+
status: TransactionStatus;
|
|
13
|
+
customerCode: string;
|
|
14
|
+
countryCodeDes: string;
|
|
15
|
+
countryNameDes: string;
|
|
20
16
|
};
|
|
21
17
|
export declare const useConfirmTransaction: () => {
|
|
22
|
-
transaction:
|
|
23
|
-
id: number;
|
|
24
|
-
bankCode: string;
|
|
25
|
-
bankName: string;
|
|
26
|
-
bookerName?: string;
|
|
27
|
-
bookerEmail?: string;
|
|
28
|
-
ticketNumber: string;
|
|
29
|
-
travellerName: string;
|
|
30
|
-
confirmationToken: string;
|
|
31
|
-
status: TransactionStatus;
|
|
32
|
-
customerCode: string;
|
|
33
|
-
agent?: IUser;
|
|
34
|
-
groupTransactions?: ITransaction[];
|
|
35
|
-
} | null;
|
|
18
|
+
transaction: ConfirmTransactionData | null;
|
|
36
19
|
agent: IAgent | null;
|
|
37
20
|
groupTransactions: ITransaction[];
|
|
38
21
|
isLoading: boolean;
|
|
39
22
|
confirmTransaction: () => Promise<void>;
|
|
40
23
|
customerCode: string | undefined;
|
|
24
|
+
transactionPublicId: string | undefined;
|
|
25
|
+
couponCode: string | null;
|
|
41
26
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EInsuranceProviderType } from '../types/insurance';
|
|
2
|
+
interface FxPrefillData {
|
|
3
|
+
startDate: Date | null;
|
|
4
|
+
endDate: Date | null;
|
|
5
|
+
destinationCountryId: number | null;
|
|
6
|
+
travellerFullName: string;
|
|
7
|
+
identityDocumentNumber: string | null;
|
|
8
|
+
travellerPhone: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare const useFxPrefill: (fxtranid: string | null) => {
|
|
11
|
+
fxPrefillData: FxPrefillData | null;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const useUrlParams: () => {
|
|
15
|
+
fxtranid: string | null;
|
|
16
|
+
couponCode: string | null;
|
|
17
|
+
initialProviders: EInsuranceProviderType[];
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TravellerConfirmationContext } from '../../../hooks/traveller-confirmation/types';
|
|
2
|
+
type Props = TravellerConfirmationContext;
|
|
3
|
+
/** Màn xác nhận mua — `/confirm-purchase/:id` */
|
|
4
|
+
export declare const PurchaseTravellerConfirmation: ({ transaction, agent, groupTransactions, refetch, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export {};
|
package/types/types/enum.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare enum TransactionStatus {
|
|
|
7
7
|
SENT_TO_BANK = "sent_to_bank",
|
|
8
8
|
SENT_CONFIRMATION = "sent_confirmation_to_customer",
|
|
9
9
|
CONFIRMED = "confirmed",// customer confirmed transaction request via zns
|
|
10
|
-
CUSTOMER_PURCHASE_CONFIRMATION = "customer_purchase_confirmation",// waiting for customer to confirm via ZNS (ABBANK
|
|
10
|
+
CUSTOMER_PURCHASE_CONFIRMATION = "customer_purchase_confirmation",// waiting for customer to confirm via ZNS (ABBANK, VPBANK)
|
|
11
11
|
CANCELED = "cancelled",
|
|
12
12
|
SUCCESS = "success",
|
|
13
13
|
PAID = "paid",
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BANK_CODES, BANKS_WITH_DEPARTMENT_AND_ZNS_FLOW } from '../constants/tenant';
|
|
2
|
+
export declare const getBankLogoUrl: (bankCodeOrShortName?: string | null) => string | null;
|
|
3
|
+
export declare const isBankWithDepartmentAndZnsFlow: (shortName?: string | null) => shortName is (typeof BANKS_WITH_DEPARTMENT_AND_ZNS_FLOW)[number];
|
|
4
|
+
export { BANK_CODES };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TransactionStatus } from '../types/enum';
|
|
2
|
+
/** Logic cũ — nút "Copy link xác nhận" (link `/confirm/`) */
|
|
3
|
+
export declare const CUSTOMER_CONFIRMATION_LINK_STATUS_VALUES: readonly [TransactionStatus.SENT_CONFIRMATION, TransactionStatus.CUSTOMER_PURCHASE_CONFIRMATION, "sent_confirmation_to_customer", "customer_purchase_confirmation"];
|
|
4
|
+
/** Chỉ nút "Copy link xác nhận mua" (link `/confirm-purchase/`) */
|
|
5
|
+
export declare const CUSTOMER_PURCHASE_CONFIRMATION_LINK_STATUS_VALUES: readonly [TransactionStatus.CUSTOMER_PURCHASE_CONFIRMATION, "customer_purchase_confirmation"];
|
|
6
|
+
export declare const canCopyCustomerConfirmationLink: (status?: TransactionStatus | string | null) => boolean;
|
|
7
|
+
export declare const canCopyCustomerPurchaseConfirmationLink: (status?: TransactionStatus | string | null) => boolean;
|
|
8
|
+
export declare const getCustomerConfirmationLink: (publicId: string) => string;
|
|
9
|
+
export declare const getCustomerPurchaseConfirmationLink: (publicId: string) => string;
|