@quantaroute/checkout 1.4.5 → 1.6.0
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/CHANGELOG.md +40 -0
- package/README.md +170 -132
- package/dist/lib/index.d.ts +61 -5
- package/dist/lib/quantaroute-checkout.es.js +137 -117
- package/dist/lib/quantaroute-checkout.umd.js +133 -113
- package/dist/style.css +1 -1
- package/package.json +2 -1
- package/src/components/AddressForm.native.tsx +11 -10
- package/src/components/AddressForm.tsx +41 -19
- package/src/components/CheckoutWidget.tsx +203 -56
- package/src/components/PaymentStep.tsx +11 -2
- package/src/components/SavedAddressStep.tsx +8 -4
- package/src/core/checkout-api.ts +64 -5
- package/src/core/locality.ts +74 -0
- package/src/core/types.ts +35 -2
- package/src/index.ts +4 -0
- package/src/styles/checkout.css +32 -0
package/dist/lib/index.d.ts
CHANGED
|
@@ -26,6 +26,17 @@ export declare interface AddressComponents {
|
|
|
26
26
|
|
|
27
27
|
export declare const AddressForm: default_2.FC<AddressFormProps>;
|
|
28
28
|
|
|
29
|
+
/** Pre-fill manual fields when verifying an imported saved address. */
|
|
30
|
+
export declare interface AddressFormInitialValues {
|
|
31
|
+
flatNumber?: string;
|
|
32
|
+
floorNumber?: string;
|
|
33
|
+
buildingName?: string;
|
|
34
|
+
streetName?: string;
|
|
35
|
+
locality?: string;
|
|
36
|
+
label?: AddressLabel;
|
|
37
|
+
labelText?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
29
40
|
export declare interface AddressFormProps {
|
|
30
41
|
digipin: string;
|
|
31
42
|
lat: number;
|
|
@@ -36,6 +47,10 @@ export declare interface AddressFormProps {
|
|
|
36
47
|
onBack: () => void;
|
|
37
48
|
onError?: (error: Error) => void;
|
|
38
49
|
theme?: 'light' | 'dark';
|
|
50
|
+
/** Pre-populate manual fields from a saved address row (lazy DigiPin verify). */
|
|
51
|
+
initialValues?: AddressFormInitialValues;
|
|
52
|
+
/** Override primary submit button label (default: "Save Address"). */
|
|
53
|
+
submitLabel?: string;
|
|
39
54
|
/** Checkout API config for merchant serviceability checks. */
|
|
40
55
|
checkoutConfig?: CheckoutApiConfig;
|
|
41
56
|
/** Buyer session token used by checkout-addresses serviceability_check. */
|
|
@@ -155,7 +170,7 @@ export declare interface CheckoutEvent {
|
|
|
155
170
|
}
|
|
156
171
|
|
|
157
172
|
/** All step-transition event types emitted by the widget. */
|
|
158
|
-
export declare type CheckoutEventType = 'phone_step_viewed' | 'otp_sent' | 'phone_verified' | 'email_step_viewed' | 'email_otp_sent' | 'email_verified' | 'auth_skipped' | 'saved_addresses_viewed' | 'saved_address_selected' | 'map_step_viewed' | 'location_confirmed' | 'form_step_viewed' | 'address_completed' | 'widget_reset' | 'payment_step_viewed' | 'payment_method_selected' | 'session_abandoned';
|
|
173
|
+
export declare type CheckoutEventType = 'phone_step_viewed' | 'otp_sent' | 'phone_verified' | 'email_step_viewed' | 'email_otp_sent' | 'email_verified' | 'auth_skipped' | 'saved_addresses_viewed' | 'saved_address_selected' | 'verify_address_step_viewed' | 'map_step_viewed' | 'location_confirmed' | 'form_step_viewed' | 'address_completed' | 'widget_reset' | 'payment_step_viewed' | 'payment_method_selected' | 'session_abandoned';
|
|
159
174
|
|
|
160
175
|
declare type CheckoutPlatform = 'web' | 'ios' | 'android';
|
|
161
176
|
|
|
@@ -318,7 +333,16 @@ export declare interface CheckoutWidgetProps {
|
|
|
318
333
|
onPaymentComplete?: (result: {
|
|
319
334
|
paymentMethod: string;
|
|
320
335
|
sessionId?: string;
|
|
336
|
+
razorpayOrderId?: string;
|
|
337
|
+
razorpayPaymentId?: string;
|
|
321
338
|
}) => void;
|
|
339
|
+
/**
|
|
340
|
+
* URL to redirect the buyer to after successful payment.
|
|
341
|
+
* Use `{{sessionId}}` as a placeholder — the widget replaces it before redirecting.
|
|
342
|
+
* Example: "https://yourstore.com/order/confirm?sid={{sessionId}}"
|
|
343
|
+
* When omitted, no redirect occurs and the host app handles navigation via onPaymentComplete.
|
|
344
|
+
*/
|
|
345
|
+
orderConfirmationUrl?: string;
|
|
322
346
|
/**
|
|
323
347
|
* Show prepaid conversion nudge when COD is eligible (merchant `prepaid_nudge_copy` or prop override).
|
|
324
348
|
*/
|
|
@@ -669,9 +693,14 @@ export declare interface PaymentStepProps {
|
|
|
669
693
|
enableCod?: boolean;
|
|
670
694
|
codAllowed?: boolean;
|
|
671
695
|
theme?: 'light' | 'dark';
|
|
672
|
-
onComplete: (
|
|
696
|
+
onComplete: (result: {
|
|
697
|
+
paymentMethod: string;
|
|
698
|
+
razorpayOrderId?: string;
|
|
699
|
+
razorpayPaymentId?: string;
|
|
700
|
+
}) => void;
|
|
673
701
|
onBack?: () => void;
|
|
674
702
|
onEvent?: (type: CheckoutEventType, paymentMethod?: string) => void;
|
|
703
|
+
orderConfirmationUrl?: string;
|
|
675
704
|
}
|
|
676
705
|
|
|
677
706
|
export declare const PhoneStep: default_2.FC<PhoneStepProps>;
|
|
@@ -755,9 +784,10 @@ export declare interface ReverseGeocodeResponse {
|
|
|
755
784
|
|
|
756
785
|
export declare interface SavedAddress {
|
|
757
786
|
id: string;
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
787
|
+
/** Null for imported addresses pending lazy map verification. */
|
|
788
|
+
digipin: string | null;
|
|
789
|
+
lat: number | null;
|
|
790
|
+
lng: number | null;
|
|
761
791
|
state: string;
|
|
762
792
|
district: string;
|
|
763
793
|
locality: string;
|
|
@@ -806,6 +836,9 @@ export declare interface SavedAddressStepProps {
|
|
|
806
836
|
onAddNew: () => void;
|
|
807
837
|
}
|
|
808
838
|
|
|
839
|
+
/** Record the buyer's address choice for the current checkout session. */
|
|
840
|
+
export declare function selectAddress(config: CheckoutApiConfig, sessionToken: string, addressId: string): Promise<void>;
|
|
841
|
+
|
|
809
842
|
/** Send a 6-digit OTP to the given email via Resend (Edge: `checkout-email-otp`). */
|
|
810
843
|
export declare function sendEmailOtp(config: CheckoutApiConfig, email: string): Promise<SendEmailOtpResult>;
|
|
811
844
|
|
|
@@ -890,6 +923,27 @@ export declare interface UtmParams {
|
|
|
890
923
|
*/
|
|
891
924
|
export declare function validatePincode(pincode: string, apiKey: string, baseUrl?: string): Promise<PincodeValidateData>;
|
|
892
925
|
|
|
926
|
+
/**
|
|
927
|
+
* Confirm map pin + form for an imported address missing DigiPin.
|
|
928
|
+
* Updates buyer_addresses and marks the session address as verified.
|
|
929
|
+
*/
|
|
930
|
+
export declare function verifyDigipin(config: CheckoutApiConfig, sessionToken: string, addressId: string, payload: VerifyDigipinPayload): Promise<SavedAddress>;
|
|
931
|
+
|
|
932
|
+
export declare interface VerifyDigipinPayload {
|
|
933
|
+
digipin: string;
|
|
934
|
+
lat: number;
|
|
935
|
+
lng: number;
|
|
936
|
+
state?: string;
|
|
937
|
+
district?: string;
|
|
938
|
+
locality?: string;
|
|
939
|
+
pincode?: string;
|
|
940
|
+
delivery_status?: string;
|
|
941
|
+
flat_number?: string;
|
|
942
|
+
floor_number?: string;
|
|
943
|
+
building_name?: string;
|
|
944
|
+
street_name?: string;
|
|
945
|
+
}
|
|
946
|
+
|
|
893
947
|
/** Verify a 6-digit email OTP. Returns a session token on success. */
|
|
894
948
|
export declare function verifyEmailOtp(config: CheckoutApiConfig, email: string, code: string, context?: SessionContextPayload): Promise<VerifyEmailOtpResult>;
|
|
895
949
|
|
|
@@ -917,6 +971,8 @@ export declare function verifyPayment(config: CheckoutApiConfig, sessionToken: s
|
|
|
917
971
|
payment_method?: string;
|
|
918
972
|
}): Promise<{
|
|
919
973
|
payment_method: string;
|
|
974
|
+
razorpay_order_id: string;
|
|
975
|
+
razorpay_payment_id: string;
|
|
920
976
|
}>;
|
|
921
977
|
|
|
922
978
|
export { }
|