@quantaroute/checkout 1.4.4 → 1.5.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 +30 -0
- package/README.md +223 -122
- package/dist/lib/index.d.ts +72 -1
- package/dist/lib/quantaroute-checkout.es.js +158 -143
- package/dist/lib/quantaroute-checkout.umd.js +160 -145
- package/dist/style.css +1 -1
- package/package.json +2 -1
- package/src/components/AddressForm.native.tsx +126 -20
- package/src/components/AddressForm.tsx +113 -23
- package/src/components/CheckoutWidget.native.tsx +8 -0
- package/src/components/CheckoutWidget.tsx +28 -4
- package/src/components/PaymentStep.tsx +11 -2
- package/src/core/checkout-api.ts +59 -2
- package/src/core/locality.ts +74 -0
- package/src/core/types.ts +47 -3
- package/src/index.ts +2 -0
- package/src/styles/checkout.css +29 -0
- package/src/styles/checkout.native.ts +25 -0
package/dist/lib/index.d.ts
CHANGED
|
@@ -36,6 +36,18 @@ export declare interface AddressFormProps {
|
|
|
36
36
|
onBack: () => void;
|
|
37
37
|
onError?: (error: Error) => void;
|
|
38
38
|
theme?: 'light' | 'dark';
|
|
39
|
+
/** Checkout API config for merchant serviceability checks. */
|
|
40
|
+
checkoutConfig?: CheckoutApiConfig;
|
|
41
|
+
/** Buyer session token used by checkout-addresses serviceability_check. */
|
|
42
|
+
serviceabilitySessionToken?: string;
|
|
43
|
+
/** When true, calls the merchant courier serviceability endpoint after pincode validation. */
|
|
44
|
+
enableServiceabilityCheck?: boolean;
|
|
45
|
+
/** Shows a soft India Post home-delivery info banner when merchant check is absent/failed. */
|
|
46
|
+
showIndiaPostDeliveryWarning?: boolean;
|
|
47
|
+
/** Optional client override for blocking address save when merchant says not serviceable. */
|
|
48
|
+
serviceabilityBlockCheckout?: boolean;
|
|
49
|
+
/** Optional observer for the merchant serviceability result. */
|
|
50
|
+
onServiceabilityResult?: (result: ServiceabilityResult) => void;
|
|
39
51
|
}
|
|
40
52
|
|
|
41
53
|
/** Label for a saved buyer address — stored in checkout-addresses API. */
|
|
@@ -241,6 +253,21 @@ export declare interface CheckoutWidgetProps {
|
|
|
241
253
|
* `checkout.merchants.enable_cod` and optional D1/D2 columns.
|
|
242
254
|
*/
|
|
243
255
|
enableCod?: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Call the merchant's courier serviceability webhook for the resolved pincode.
|
|
258
|
+
* Requires `merchantId`, `supabaseFunctionBaseUrl`, and an authenticated checkout session.
|
|
259
|
+
*/
|
|
260
|
+
enableServiceabilityCheck?: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Opt-in fallback banner for India Post "Non Delivery" pincodes.
|
|
263
|
+
* Defaults off because courier partners may still deliver.
|
|
264
|
+
*/
|
|
265
|
+
showIndiaPostDeliveryWarning?: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* Client override: block address save when merchant serviceability says not deliverable.
|
|
268
|
+
* If omitted, the server result from checkout.merchants.serviceability_block_checkout is used.
|
|
269
|
+
*/
|
|
270
|
+
serviceabilityBlockCheckout?: boolean;
|
|
244
271
|
/**
|
|
245
272
|
* Cart total in paise for the COD cart cap (D2). Omit if the cart total is unknown.
|
|
246
273
|
*/
|
|
@@ -291,7 +318,16 @@ export declare interface CheckoutWidgetProps {
|
|
|
291
318
|
onPaymentComplete?: (result: {
|
|
292
319
|
paymentMethod: string;
|
|
293
320
|
sessionId?: string;
|
|
321
|
+
razorpayOrderId?: string;
|
|
322
|
+
razorpayPaymentId?: string;
|
|
294
323
|
}) => void;
|
|
324
|
+
/**
|
|
325
|
+
* URL to redirect the buyer to after successful payment.
|
|
326
|
+
* Use `{{sessionId}}` as a placeholder — the widget replaces it before redirecting.
|
|
327
|
+
* Example: "https://yourstore.com/order/confirm?sid={{sessionId}}"
|
|
328
|
+
* When omitted, no redirect occurs and the host app handles navigation via onPaymentComplete.
|
|
329
|
+
*/
|
|
330
|
+
orderConfirmationUrl?: string;
|
|
295
331
|
/**
|
|
296
332
|
* Show prepaid conversion nudge when COD is eligible (merchant `prepaid_nudge_copy` or prop override).
|
|
297
333
|
*/
|
|
@@ -307,6 +343,15 @@ export declare interface CheckoutWidgetProps {
|
|
|
307
343
|
registerController?: (controller: CheckoutWidgetController) => void;
|
|
308
344
|
}
|
|
309
345
|
|
|
346
|
+
/**
|
|
347
|
+
* Check merchant courier serviceability for a pincode.
|
|
348
|
+
* Uses the merchant's configured webhook on checkout.merchants and fails open.
|
|
349
|
+
*/
|
|
350
|
+
export declare function checkServiceability(config: CheckoutApiConfig, sessionToken: string, pincode: string, coords?: {
|
|
351
|
+
lat?: number;
|
|
352
|
+
lng?: number;
|
|
353
|
+
}): Promise<ServiceabilityResult>;
|
|
354
|
+
|
|
310
355
|
/**
|
|
311
356
|
* Shows COD availability after checkout using `cod_eligibility` (merchant `enable_cod` + D1/D2).
|
|
312
357
|
*/
|
|
@@ -633,9 +678,14 @@ export declare interface PaymentStepProps {
|
|
|
633
678
|
enableCod?: boolean;
|
|
634
679
|
codAllowed?: boolean;
|
|
635
680
|
theme?: 'light' | 'dark';
|
|
636
|
-
onComplete: (
|
|
681
|
+
onComplete: (result: {
|
|
682
|
+
paymentMethod: string;
|
|
683
|
+
razorpayOrderId?: string;
|
|
684
|
+
razorpayPaymentId?: string;
|
|
685
|
+
}) => void;
|
|
637
686
|
onBack?: () => void;
|
|
638
687
|
onEvent?: (type: CheckoutEventType, paymentMethod?: string) => void;
|
|
688
|
+
orderConfirmationUrl?: string;
|
|
639
689
|
}
|
|
640
690
|
|
|
641
691
|
export declare const PhoneStep: default_2.FC<PhoneStepProps>;
|
|
@@ -781,6 +831,25 @@ export declare interface SendEmailOtpResult {
|
|
|
781
831
|
/** Send OTP to the given mobile number. Throws on failure. */
|
|
782
832
|
export declare function sendOtp(config: CheckoutApiConfig, mobile: string): Promise<void>;
|
|
783
833
|
|
|
834
|
+
export declare interface ServiceabilityResult {
|
|
835
|
+
/** Whether a merchant serviceability endpoint was configured and enabled. */
|
|
836
|
+
enabled: boolean;
|
|
837
|
+
/** Whether the merchant endpoint returned a definitive response. */
|
|
838
|
+
checked: boolean;
|
|
839
|
+
/** true/false when checked, null when disabled or failed open. */
|
|
840
|
+
serviceable: boolean | null;
|
|
841
|
+
/** Normalized 6-digit pincode when valid; otherwise the trimmed input. */
|
|
842
|
+
pincode: string;
|
|
843
|
+
/** Buyer-facing merchant message, when supplied by the merchant endpoint. */
|
|
844
|
+
message?: string;
|
|
845
|
+
/** Whether the widget should block address submission when not serviceable. */
|
|
846
|
+
block_checkout: boolean;
|
|
847
|
+
/** Whether the merchant wants the soft India Post info banner as fallback. */
|
|
848
|
+
show_india_post_delivery_warning: boolean;
|
|
849
|
+
/** Present when the endpoint was skipped or failed open. */
|
|
850
|
+
reason?: 'not_configured' | 'invalid_pincode' | 'merchant_error' | 'merchant_unreachable' | 'invalid_response';
|
|
851
|
+
}
|
|
852
|
+
|
|
784
853
|
/** Device + UTM context sent with OTP verify to enrich checkout sessions. */
|
|
785
854
|
export declare interface SessionContextPayload {
|
|
786
855
|
utm_source?: string;
|
|
@@ -862,6 +931,8 @@ export declare function verifyPayment(config: CheckoutApiConfig, sessionToken: s
|
|
|
862
931
|
payment_method?: string;
|
|
863
932
|
}): Promise<{
|
|
864
933
|
payment_method: string;
|
|
934
|
+
razorpay_order_id: string;
|
|
935
|
+
razorpay_payment_id: string;
|
|
865
936
|
}>;
|
|
866
937
|
|
|
867
938
|
export { }
|