gotrip-fx-transaction-form 1.0.254-dev → 1.0.256-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.254-dev",
3
+ "version": "1.0.256-dev",
4
4
  "description": "FX Transaction Form ES6 module",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import { TravelPlanFormValues, CoveragePlanPremium, BuyerFormValues, InsuredPerson } from './types';
2
2
  import { ETravelScope } from '../../types/insurance';
3
- import { EPaymentMethod } from '../../types/enum';
3
+ import { EOrderPaymentType, EPaymentMethod } from '../../types/enum';
4
4
  export interface StepFourPaymentProps {
5
5
  travelScope: ETravelScope;
6
6
  travelPlan: TravelPlanFormValues;
@@ -8,7 +8,10 @@ export interface StepFourPaymentProps {
8
8
  buyerInfo: BuyerFormValues | null;
9
9
  insuredPeople: InsuredPerson[];
10
10
  onBack?: () => void;
11
- onPayment?: (paymentMode: EPaymentMethod) => void;
11
+ onPayment?: (args: {
12
+ paymentMode?: EPaymentMethod;
13
+ paymentType: EOrderPaymentType;
14
+ }) => void;
12
15
  isProcessing?: boolean;
13
16
  onPremiumUpdate?: (premium: CoveragePlanPremium['premium'] | null) => void;
14
17
  onCouponChange?: (coupon: {
@@ -17,5 +20,6 @@ export interface StepFourPaymentProps {
17
20
  finalAmount: number;
18
21
  description?: string | null;
19
22
  } | null) => void;
23
+ paymentType?: EOrderPaymentType;
20
24
  }
21
- export declare const StepFourPayment: ({ travelScope, travelPlan, selectedPlan, buyerInfo, insuredPeople, onBack, onPayment, isProcessing, onPremiumUpdate, onCouponChange, }: StepFourPaymentProps) => import("react/jsx-runtime").JSX.Element;
25
+ export declare const StepFourPayment: ({ travelScope, travelPlan, selectedPlan, buyerInfo, insuredPeople, onBack, onPayment, isProcessing, onPremiumUpdate, onCouponChange, paymentType: paymentTypeProp, }: StepFourPaymentProps) => import("react/jsx-runtime").JSX.Element;
@@ -8,6 +8,7 @@ type Props = {
8
8
  export declare enum CancelReason {
9
9
  CUSTOMER_CANCEL = "CUSTOMER_CANCEL",
10
10
  BAD_DATA = "BAD_DATA",
11
+ DUPLICATED = "DUPLICATED",
11
12
  OTHER = "OTHER"
12
13
  }
13
14
  export declare const CancelTransactionModal: ({ isOpen, onClose, transaction, onSuccess }: Props) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,11 +1,30 @@
1
1
  import { EMotorProvider, MotorPlanFormValues, MotorPremiumSummary as MotorPremiumSummaryType } from '../motor-insurance.types';
2
2
  import { Control, UseFormSetValue } from 'react-hook-form';
3
+ import { BikeRegistrationOcrData } from '../../../hooks/useVehicleRegistrationScan';
3
4
  type BikeStepOneFormProps = {
4
5
  control: Control<MotorPlanFormValues>;
5
6
  setValue: UseFormSetValue<MotorPlanFormValues>;
6
7
  premiumSummary?: MotorPremiumSummaryType | null;
7
8
  isLoadingQuote?: boolean;
8
9
  providers?: EMotorProvider[];
10
+ onOcrComplete?: (data: BikeRegistrationOcrData) => void;
11
+ onOcrReset?: () => void;
12
+ onIdCardComplete?: (data: {
13
+ ownerName: string;
14
+ ownerIdNumber: string;
15
+ }) => void;
16
+ onIdCardReset?: () => void;
17
+ vehicleRegImageUrl?: string | null;
18
+ idCardImageUrl?: string | null;
19
+ onVehicleRegImageCapture?: (imageData: {
20
+ dataUrl: string;
21
+ gcsUrl?: string;
22
+ }) => void;
23
+ onIdCardImageCapture?: (imageData: {
24
+ dataUrl: string;
25
+ gcsUrl?: string;
26
+ }) => void;
27
+ onScanningChange?: (scanning: boolean) => void;
9
28
  };
10
- export declare const BikeStepOneForm: ({ control, setValue, premiumSummary, isLoadingQuote, providers, }: BikeStepOneFormProps) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const BikeStepOneForm: ({ control, setValue, premiumSummary, isLoadingQuote, providers, onOcrComplete, onOcrReset, onIdCardComplete, onIdCardReset, vehicleRegImageUrl, idCardImageUrl, onVehicleRegImageCapture, onIdCardImageCapture, onScanningChange, }: BikeStepOneFormProps) => import("react/jsx-runtime").JSX.Element;
11
30
  export {};
@@ -1,4 +1,4 @@
1
- import { EPaymentMethod } from '../../../types/enum';
1
+ import { EOrderPaymentType, EPaymentMethod } from '../../../types/enum';
2
2
  import { MotorPlanFormValues, MotorPremiumSummary, VehicleInfoFormValues } from '../motor-insurance.types';
3
3
  export interface BikeStepThreePaymentProps {
4
4
  planValues: MotorPlanFormValues;
@@ -15,5 +15,6 @@ export interface BikeStepThreePaymentProps {
15
15
  isProcessing: boolean;
16
16
  isGuest: boolean;
17
17
  onBack: () => void;
18
+ paymentType?: EOrderPaymentType;
18
19
  }
19
- export declare const BikeStepThreePayment: ({ planValues, premiumSummary, vehicleInfo, isLoading, paymentMode, onPaymentModeChange, isTermsAgreed, onTermsAgreedChange, isPersonalDataConsentAgreed, onPersonalDataConsentChange, onPayment, isProcessing, isGuest, onBack, }: BikeStepThreePaymentProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const BikeStepThreePayment: ({ planValues, premiumSummary, vehicleInfo, isLoading, paymentMode, onPaymentModeChange, isTermsAgreed, onTermsAgreedChange, isPersonalDataConsentAgreed, onPersonalDataConsentChange, onPayment, isProcessing, isGuest, onBack, paymentType, }: BikeStepThreePaymentProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { EPaymentMethod } from '../../../types/enum';
1
+ import { EOrderPaymentType, EPaymentMethod } from '../../../types/enum';
2
2
  import { CarPlanFormValues, CarPremiumSummary, CarVehicleInfoFormValues } from '../motor-insurance.types';
3
3
  interface CarStepFourPaymentProps {
4
4
  planValues: CarPlanFormValues;
@@ -18,6 +18,7 @@ interface CarStepFourPaymentProps {
18
18
  onBack: () => void;
19
19
  getProviderLogoUrl: (providerCode?: string | null) => string | undefined;
20
20
  getTermsAgreeHtml: (providerCode?: string | null) => string | undefined;
21
+ paymentType?: EOrderPaymentType;
21
22
  }
22
- export declare const CarStepFourPayment: ({ planValues, premiumSummary, vehicleInfo, buyerCertificateInfo, isLoading, paymentMode, onPaymentModeChange, isTermsAgreed, onTermsAgreedChange, isPersonalDataConsentAgreed, onPersonalDataConsentChange, onPayment, isProcessing, isGuest, onBack, getProviderLogoUrl, getTermsAgreeHtml, }: CarStepFourPaymentProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const CarStepFourPayment: ({ planValues, premiumSummary, vehicleInfo, buyerCertificateInfo, isLoading, paymentMode, onPaymentModeChange, isTermsAgreed, onTermsAgreedChange, isPersonalDataConsentAgreed, onPersonalDataConsentChange, onPayment, isProcessing, isGuest, onBack, getProviderLogoUrl, getTermsAgreeHtml, paymentType, }: CarStepFourPaymentProps) => import("react/jsx-runtime").JSX.Element;
23
24
  export {};
@@ -1,8 +1,27 @@
1
1
  import { Control, UseFormSetValue } from 'react-hook-form';
2
2
  import { CarPlanFormValues } from '../motor-insurance.types';
3
+ import { CarRegistrationOcrData } from '../../../hooks/useVehicleRegistrationScan';
3
4
  interface CarStepOneFormProps {
4
5
  control: Control<CarPlanFormValues>;
5
6
  setValue: UseFormSetValue<CarPlanFormValues>;
7
+ onOcrComplete?: (data: CarRegistrationOcrData) => void;
8
+ onOcrReset?: () => void;
9
+ onIdCardComplete?: (data: {
10
+ ownerName: string;
11
+ ownerIdNumber: string;
12
+ }) => void;
13
+ onIdCardReset?: () => void;
14
+ vehicleRegImageUrl?: string | null;
15
+ idCardImageUrl?: string | null;
16
+ onVehicleRegImageCapture?: (imageData: {
17
+ dataUrl: string;
18
+ gcsUrl?: string;
19
+ }) => void;
20
+ onIdCardImageCapture?: (imageData: {
21
+ dataUrl: string;
22
+ gcsUrl?: string;
23
+ }) => void;
24
+ onScanningChange?: (scanning: boolean) => void;
6
25
  }
7
- export declare const CarStepOneForm: ({ control, setValue }: CarStepOneFormProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const CarStepOneForm: ({ control, setValue, onOcrComplete, onOcrReset, onIdCardComplete, onIdCardReset, vehicleRegImageUrl, idCardImageUrl, onVehicleRegImageCapture, onIdCardImageCapture, onScanningChange, }: CarStepOneFormProps) => import("react/jsx-runtime").JSX.Element;
8
27
  export {};
@@ -0,0 +1,14 @@
1
+ export interface DocumentUploadPreviewProps {
2
+ label: string;
3
+ scanningLabel?: string;
4
+ icon: React.ElementType;
5
+ isScanning: boolean;
6
+ file: File | null;
7
+ /** Data URL restored from storage when no File object is available (e.g. after page reload) */
8
+ persistedPreviewUrl?: string | null;
9
+ scanError?: string | null;
10
+ accept?: string;
11
+ onFileSelect: (file: File) => void;
12
+ onRemove: () => void;
13
+ }
14
+ export declare const DocumentUploadPreview: ({ label, scanningLabel, icon, isScanning, file, persistedPreviewUrl, scanError, accept, onFileSelect, onRemove, }: DocumentUploadPreviewProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ export type StoredImageData = {
2
+ dataUrl?: string | null;
3
+ gcsUrl?: string | null;
4
+ };
5
+ export type ImageCaptureData = {
6
+ dataUrl: string;
7
+ gcsUrl?: string;
8
+ };
9
+ export declare const normalizeStoredImageData: (value: unknown) => {
10
+ previewUrl: string | null;
11
+ gcsUrl: string | null;
12
+ };
13
+ export declare const buildStoredImageData: (imageData: ImageCaptureData) => StoredImageData;
14
+ export declare const buildPreviewDataUrlForStorage: (file: File, options?: {
15
+ maxDimension?: number;
16
+ jpegQuality?: number;
17
+ }) => Promise<string>;
18
+ export declare const resolveImageUrlForPayload: (gcsUrl: string | null, previewUrl: string | null) => string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { Control, UseFormSetValue } from 'react-hook-form';
2
- import { EPaymentMethod } from '../../types/enum';
2
+ import { EPaymentMethod, EOrderPaymentType } from '../../types/enum';
3
3
  import { EInsuranceProviderType } from '../../types/insurance';
4
4
  export declare enum EMotorVehicleType {
5
5
  BIKE = "bike",
@@ -104,7 +104,10 @@ export interface BikePolicyRequestDto {
104
104
  occupantAccidentPremium?: number;
105
105
  totalPremium?: number;
106
106
  tax?: number;
107
- paymentMode: EPaymentMethod;
107
+ paymentType: EOrderPaymentType;
108
+ paymentMode?: EPaymentMethod;
109
+ vehicleRegImageUrl?: string;
110
+ idCardImageUrl?: string;
108
111
  }
109
112
  /**
110
113
  * DTO for bike policy response (BikePolicyResponse).
@@ -283,7 +286,10 @@ export interface CarPolicyRequestDto {
283
286
  model?: string;
284
287
  hideLicensePlate?: boolean;
285
288
  hidePremium?: boolean;
286
- paymentMode: EPaymentMethod;
289
+ paymentType: EOrderPaymentType;
290
+ paymentMode?: EPaymentMethod;
291
+ vehicleRegImageUrl?: string;
292
+ idCardImageUrl?: string;
287
293
  }
288
294
  /**
289
295
  * DTO for car policy response (MotorCreatePolicyResponse).
@@ -0,0 +1,4 @@
1
+ import { EOrderPaymentType } from '../types/enum';
2
+ export declare function OrderPaymentTypeBadge({ paymentTypeApplied, }: {
3
+ paymentTypeApplied?: EOrderPaymentType;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -70,6 +70,10 @@ export declare const ApiUrls: {
70
70
  uploadIdentityDocuments: string;
71
71
  saveReaderHistory: string;
72
72
  getReaderHistories: string;
73
+ extractCarRegistration: string;
74
+ extractCarRegistrationFromBase64: string;
75
+ extractBikeRegistration: string;
76
+ extractBikeRegistrationFromBase64: string;
73
77
  };
74
78
  bid: {
75
79
  list: string;
@@ -0,0 +1,5 @@
1
+ export type BankOutsideWorkingHoursNotice = {
2
+ show: boolean;
3
+ detail?: string;
4
+ };
5
+ export declare const useBankOutsideWorkingHoursNotice: (bankCode: string | undefined, enabled: boolean) => BankOutsideWorkingHoursNotice;
@@ -1,5 +1,5 @@
1
1
  import { InsuranceTransaction } from '../types/insurance-transaction.dto';
2
- import { EPaymentMethod, TransactionStatus } from '../types/enum';
2
+ import { EPaymentMethod, EOrderPaymentType, TransactionStatus } from '../types/enum';
3
3
  import { ETravelScope } from '../types/insurance';
4
4
  export interface GetInsuranceTransactionListReqDto {
5
5
  page?: number;
@@ -54,6 +54,7 @@ export interface CreateTransactionPayload {
54
54
  }>;
55
55
  providerSpecific?: Record<string, any>;
56
56
  buyerInfo?: Record<string, any>;
57
+ paymentType?: EOrderPaymentType;
57
58
  paymentMode?: EPaymentMethod;
58
59
  premium?: {
59
60
  totalPremium: number;
@@ -1,4 +1,4 @@
1
- import { TransactionStatus } from '../types/enum';
1
+ import { EOrderPaymentType, TransactionStatus } from '../types/enum';
2
2
  import { EMotorProvider } from '../components/MotorInsurance/motor-insurance.types';
3
3
  export interface MotorInsuranceTransactionDetail {
4
4
  id: number;
@@ -22,6 +22,10 @@ export interface MotorInsuranceTransactionDetail {
22
22
  status: string;
23
23
  publicId: string;
24
24
  };
25
+ paymentTypeApplied?: EOrderPaymentType;
26
+ paidAmount?: number;
27
+ unpaidAmount?: number;
28
+ isBypassed?: boolean;
25
29
  }
26
30
  export interface MotorInsuranceTransactionListItem {
27
31
  id: number;
@@ -43,6 +47,10 @@ export interface MotorInsuranceTransactionListItem {
43
47
  status: string;
44
48
  publicId: string;
45
49
  };
50
+ paymentTypeApplied?: EOrderPaymentType;
51
+ paidAmount?: number;
52
+ unpaidAmount?: number;
53
+ isBypassed?: boolean;
46
54
  }
47
55
  export interface GetMotorInsuranceTransactionListReqDto {
48
56
  page?: number;
@@ -0,0 +1,15 @@
1
+ import { CarPlanFormValues, CarPremiumSummary, MotorPlanFormValues, MotorPremiumSummary, EMotorProvider } from '../components/MotorInsurance/motor-insurance.types';
2
+ interface UseCarQuoteResult {
3
+ quoteResult: CarPremiumSummary | null;
4
+ quoteResultRef: React.MutableRefObject<CarPremiumSummary | null>;
5
+ calculateQuote: (planValues: CarPlanFormValues, createQuoteCar: (provider: EMotorProvider, payload: any) => Promise<any>) => void;
6
+ resetQuote: () => void;
7
+ }
8
+ export declare const useCarQuote: () => UseCarQuoteResult;
9
+ interface UseBikeQuoteResult {
10
+ quoteResult: MotorPremiumSummary | null;
11
+ calculateQuote: (planValues: MotorPlanFormValues, createQuoteBike: (provider: EMotorProvider, payload: any) => Promise<any>) => void;
12
+ resetQuote: () => void;
13
+ }
14
+ export declare const useBikeQuote: () => UseBikeQuoteResult;
15
+ export {};
@@ -0,0 +1,39 @@
1
+ export interface CarRegistrationOcrData {
2
+ licensePlate: string;
3
+ chassisNumber: string;
4
+ engineNumber: string;
5
+ manufacturingYear: number | null;
6
+ seatCount: number | null;
7
+ ownerName: string;
8
+ brand: string;
9
+ model: string;
10
+ color: string;
11
+ registrationDate: string;
12
+ isCommercialTransport: boolean;
13
+ gcsUrl?: string;
14
+ filePath?: string;
15
+ }
16
+ export interface BikeRegistrationOcrData {
17
+ licensePlate: string;
18
+ chassisNumber: string;
19
+ engineNumber: string;
20
+ ownerName: string;
21
+ address: string;
22
+ brand: string;
23
+ model: string;
24
+ color: string;
25
+ engineCapacity: number | null;
26
+ registrationDate: string;
27
+ gcsUrl?: string;
28
+ filePath?: string;
29
+ }
30
+ export declare const useCarRegistrationScan: () => {
31
+ scanCarRegistration: (file: File) => Promise<CarRegistrationOcrData | null>;
32
+ isScanning: boolean;
33
+ scanError: string | null;
34
+ };
35
+ export declare const useBikeRegistrationScan: () => {
36
+ scanBikeRegistration: (file: File) => Promise<BikeRegistrationOcrData | null>;
37
+ isScanning: boolean;
38
+ scanError: string | null;
39
+ };
@@ -95,6 +95,10 @@ export declare enum EPaymentMethod {
95
95
  TOPUP_BALANCE = "topup_balance",
96
96
  BANK_TRANSFER = "bank_transfer"
97
97
  }
98
+ export declare enum EOrderPaymentType {
99
+ UP_FRONT = "up_front",
100
+ DEFERRED = "deferred"
101
+ }
98
102
  export declare enum EInsuranceTransactionStatus {
99
103
  PENDING = "pending",
100
104
  PAID = "paid",
@@ -1,4 +1,5 @@
1
1
  import { EGender, EIdType, EInsuranceType, EPersonType, EPolicyStatus, EPolicyType, EQuoteStatus, ERelationToPrimary, ETravelScope, ETravelType } from './insurance';
2
+ import { EOrderPaymentType } from './enum';
2
3
  import { ITransaction } from './response.dto';
3
4
  export interface InsuranceQuoteInsured {
4
5
  id: number;
@@ -101,6 +102,10 @@ export interface InsuranceTransaction {
101
102
  documents?: InsurancePolicyDocument[];
102
103
  userId?: number;
103
104
  tenantId?: number;
105
+ paymentTypeApplied?: EOrderPaymentType;
106
+ paidAmount?: number;
107
+ unpaidAmount?: number;
108
+ isBypassed?: boolean;
104
109
  createdAt: string;
105
110
  updatedAt: string;
106
111
  quote?: InsuranceQuote;
@@ -1,4 +1,4 @@
1
- import { ECommissionPolicyType, ESimDomesticServices, EsimTransactionStatus, ETenantType, EUseCaseses, TransactionStatus } from './enum';
1
+ import { ECommissionPolicyType, EOrderPaymentType, ESimDomesticServices, EsimTransactionStatus, ETenantType, EUseCaseses, TransactionStatus } from './enum';
2
2
  import { EPolicyActionType } from '../constants/policy-enums';
3
3
  import { EPermissionKey, EUserRole, EUserStatus } from './user';
4
4
  export type LoginRespDto = {
@@ -106,6 +106,20 @@ export type ITransaction = {
106
106
  fileUrls?: IFileUrls;
107
107
  cancelledAt?: string;
108
108
  cancelledResponse?: Record<string, any>;
109
+ cancelledBy?: string;
110
+ cancelledUser?: {
111
+ id: number;
112
+ email?: string;
113
+ firstName?: string;
114
+ lastName?: string;
115
+ };
116
+ approvedBy?: string;
117
+ approvedUser?: {
118
+ id: number;
119
+ email?: string;
120
+ firstName?: string;
121
+ lastName?: string;
122
+ };
109
123
  assignedUserId?: number;
110
124
  assignedUser?: {
111
125
  id: number;
@@ -243,6 +257,7 @@ export interface ITravelAgencyTenantSettings {
243
257
  motorInsurance: {
244
258
  providers: string[];
245
259
  };
260
+ paymentType?: EOrderPaymentType;
246
261
  }
247
262
  export interface IBankTenantSettings {
248
263
  availableCurrencies: string[];
@@ -0,0 +1,13 @@
1
+ import { EOrderPaymentType } from '../types/enum';
2
+ export declare function getOrderPaymentStatusShortLabel(params: {
3
+ paymentTypeApplied?: EOrderPaymentType;
4
+ paidAmount?: number;
5
+ unpaidAmount?: number;
6
+ isBypassed?: boolean;
7
+ }): string;
8
+ export declare function getOrderPaymentStatusDetailLabel(params: {
9
+ paymentTypeApplied?: EOrderPaymentType;
10
+ paidAmount?: number;
11
+ unpaidAmount?: number;
12
+ isBypassed?: boolean;
13
+ }): string;