@quantaroute/checkout 1.4.4 → 1.4.5
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 +11 -0
- package/README.md +70 -2
- package/dist/lib/index.d.ts +55 -0
- package/dist/lib/quantaroute-checkout.es.js +133 -128
- package/dist/lib/quantaroute-checkout.umd.js +136 -131
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/AddressForm.native.tsx +115 -10
- package/src/components/AddressForm.tsx +101 -9
- package/src/components/CheckoutWidget.native.tsx +8 -0
- package/src/components/CheckoutWidget.tsx +8 -0
- package/src/core/checkout-api.ts +53 -0
- package/src/core/types.ts +28 -1
- package/src/index.ts +2 -0
- package/src/styles/checkout.css +29 -0
- package/src/styles/checkout.native.ts +25 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ Release dates are from git history where available; earlier versions are estimat
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.4.5](https://github.com/quantaroute/checkout/compare/v1.4.4...v1.4.5) — 2026-06-13
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Merchant courier serviceability checks via `checkout-addresses` `serviceability_check`, signed webhook configuration on `checkout.merchants`, and `checkServiceability()` client helper
|
|
15
|
+
- `enableServiceabilityCheck`, `showIndiaPostDeliveryWarning`, and `serviceabilityBlockCheckout` widget props
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- India Post "Non Delivery" is now an opt-in informational fallback instead of the default buyer-facing warning; merchant courier serviceability takes precedence
|
|
20
|
+
|
|
10
21
|
## [1.4.4](https://github.com/quantaroute/checkout/compare/v1.4.3...v1.4.4) — 2026-06-16
|
|
11
22
|
|
|
12
23
|
### Added
|
package/README.md
CHANGED
|
@@ -380,6 +380,74 @@ When `enableEmailAuth` is true the widget starts with an email-entry step. The b
|
|
|
380
380
|
|
|
381
381
|
---
|
|
382
382
|
|
|
383
|
+
### Merchant courier serviceability
|
|
384
|
+
|
|
385
|
+
QuantaRoute still validates that a pincode exists in the India Post database, but India Post "Non Delivery" is treated as **reference data**, not the final merchant delivery decision. Most D2C stores ship through Shiprocket, Delhivery, ClickPost, or direct courier contracts, so the buyer-facing serviceability check should come from the merchant.
|
|
386
|
+
|
|
387
|
+
| Prop | Type | Default | Platform |
|
|
388
|
+
|---|---|---|---|
|
|
389
|
+
| `enableServiceabilityCheck` | `boolean` | `false` | all |
|
|
390
|
+
| `showIndiaPostDeliveryWarning` | `boolean` | `false` | all |
|
|
391
|
+
| `serviceabilityBlockCheckout` | `boolean` | merchant setting | all |
|
|
392
|
+
|
|
393
|
+
When `enableServiceabilityCheck` is true and the buyer has a checkout session, the widget calls `checkout-addresses` with `action: "serviceability_check"`. The Edge Function calls the merchant's configured courier endpoint server-side and fails open if that endpoint is unavailable.
|
|
394
|
+
|
|
395
|
+
```tsx
|
|
396
|
+
<CheckoutWidget
|
|
397
|
+
apiKey={process.env.NEXT_PUBLIC_QUANTAROUTE_KEY!}
|
|
398
|
+
merchantId={process.env.NEXT_PUBLIC_MERCHANT_ID!}
|
|
399
|
+
supabaseFunctionBaseUrl={process.env.NEXT_PUBLIC_SUPABASE_FUNCTION_URL!}
|
|
400
|
+
enableEmailAuth={true}
|
|
401
|
+
enableServiceabilityCheck={true}
|
|
402
|
+
onComplete={(addr) => console.log(addr)}
|
|
403
|
+
/>
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
Merchant configuration lives on `checkout.merchants`:
|
|
407
|
+
|
|
408
|
+
| Column | Meaning |
|
|
409
|
+
|---|---|
|
|
410
|
+
| `serviceability_enabled` | Enables the merchant courier check |
|
|
411
|
+
| `serviceability_webhook_url` | Merchant endpoint called by QuantaRoute |
|
|
412
|
+
| `serviceability_webhook_secret` | Shared HMAC secret for outbound calls |
|
|
413
|
+
| `serviceability_block_checkout` | If true, `serviceable: false` blocks address save |
|
|
414
|
+
| `show_india_post_delivery_warning` | Optional soft India Post info banner fallback |
|
|
415
|
+
|
|
416
|
+
Merchant endpoint contract:
|
|
417
|
+
|
|
418
|
+
```http
|
|
419
|
+
POST /checkout/serviceability
|
|
420
|
+
Content-Type: application/json
|
|
421
|
+
X-QuantaRoute-Timestamp: 1782000000000
|
|
422
|
+
X-QuantaRoute-Signature: v1=<hmac_sha256(timestamp + "." + body)>
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
```json
|
|
426
|
+
{
|
|
427
|
+
"merchant_id": "merchant-uuid",
|
|
428
|
+
"pincode": "110011",
|
|
429
|
+
"lat": 28.6139,
|
|
430
|
+
"lng": 77.209,
|
|
431
|
+
"requested_at": "2026-06-21T00:00:00.000Z"
|
|
432
|
+
}
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Expected response:
|
|
436
|
+
|
|
437
|
+
```json
|
|
438
|
+
{ "serviceable": true, "message": "Delivery available in 3-5 days" }
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
or:
|
|
442
|
+
|
|
443
|
+
```json
|
|
444
|
+
{ "serviceable": false, "message": "We do not currently ship to this pincode" }
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
If the merchant endpoint errors, times out, or returns an invalid response, checkout **fails open** and the buyer can continue. `showIndiaPostDeliveryWarning` is opt-in and only shows a soft informational banner: "Courier partners may still deliver to this pincode."
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
383
451
|
#### Setting up Resend (required for `enableEmailAuth`)
|
|
384
452
|
|
|
385
453
|
> **Hosted merchants (recommended):** If you onboarded at [developers.quantaroute.com](https://developers.quantaroute.com), QuantaRoute already runs Resend on shared infrastructure. Skip steps 1–5 below — just set `enableEmailAuth={true}` and register your domain in the portal. The steps below apply only when **self-hosting** the `checkout-email-otp` Edge Function in your own Supabase project.
|
|
@@ -845,7 +913,7 @@ When publishing a new version to npm (maintainers only):
|
|
|
845
913
|
2. Run `npm run type-check && npm run build:lib && npm pack --dry-run` — confirm tarball contents.
|
|
846
914
|
3. Confirm no `.env`, `.pem`, or `supabase/` paths in the pack list.
|
|
847
915
|
4. Publish from a **clean git tag** with provenance: `npm publish --provenance --access public`.
|
|
848
|
-
5. Do **not** bump version in the same change unless releasing; current version is `1.4.
|
|
916
|
+
5. Do **not** bump version in the same change unless releasing; current version is `1.4.5`.
|
|
849
917
|
|
|
850
918
|
---
|
|
851
919
|
|
|
@@ -881,7 +949,7 @@ npx expo run:android # requires Android Studio
|
|
|
881
949
|
|
|
882
950
|
## Changelog
|
|
883
951
|
|
|
884
|
-
See [CHANGELOG.md](./CHANGELOG.md) for version history. Current release: **v1.4.
|
|
952
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history. Current release: **v1.4.5**.
|
|
885
953
|
|
|
886
954
|
---
|
|
887
955
|
|
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
|
*/
|
|
@@ -307,6 +334,15 @@ export declare interface CheckoutWidgetProps {
|
|
|
307
334
|
registerController?: (controller: CheckoutWidgetController) => void;
|
|
308
335
|
}
|
|
309
336
|
|
|
337
|
+
/**
|
|
338
|
+
* Check merchant courier serviceability for a pincode.
|
|
339
|
+
* Uses the merchant's configured webhook on checkout.merchants and fails open.
|
|
340
|
+
*/
|
|
341
|
+
export declare function checkServiceability(config: CheckoutApiConfig, sessionToken: string, pincode: string, coords?: {
|
|
342
|
+
lat?: number;
|
|
343
|
+
lng?: number;
|
|
344
|
+
}): Promise<ServiceabilityResult>;
|
|
345
|
+
|
|
310
346
|
/**
|
|
311
347
|
* Shows COD availability after checkout using `cod_eligibility` (merchant `enable_cod` + D1/D2).
|
|
312
348
|
*/
|
|
@@ -781,6 +817,25 @@ export declare interface SendEmailOtpResult {
|
|
|
781
817
|
/** Send OTP to the given mobile number. Throws on failure. */
|
|
782
818
|
export declare function sendOtp(config: CheckoutApiConfig, mobile: string): Promise<void>;
|
|
783
819
|
|
|
820
|
+
export declare interface ServiceabilityResult {
|
|
821
|
+
/** Whether a merchant serviceability endpoint was configured and enabled. */
|
|
822
|
+
enabled: boolean;
|
|
823
|
+
/** Whether the merchant endpoint returned a definitive response. */
|
|
824
|
+
checked: boolean;
|
|
825
|
+
/** true/false when checked, null when disabled or failed open. */
|
|
826
|
+
serviceable: boolean | null;
|
|
827
|
+
/** Normalized 6-digit pincode when valid; otherwise the trimmed input. */
|
|
828
|
+
pincode: string;
|
|
829
|
+
/** Buyer-facing merchant message, when supplied by the merchant endpoint. */
|
|
830
|
+
message?: string;
|
|
831
|
+
/** Whether the widget should block address submission when not serviceable. */
|
|
832
|
+
block_checkout: boolean;
|
|
833
|
+
/** Whether the merchant wants the soft India Post info banner as fallback. */
|
|
834
|
+
show_india_post_delivery_warning: boolean;
|
|
835
|
+
/** Present when the endpoint was skipped or failed open. */
|
|
836
|
+
reason?: 'not_configured' | 'invalid_pincode' | 'merchant_error' | 'merchant_unreachable' | 'invalid_response';
|
|
837
|
+
}
|
|
838
|
+
|
|
784
839
|
/** Device + UTM context sent with OTP verify to enrich checkout sessions. */
|
|
785
840
|
export declare interface SessionContextPayload {
|
|
786
841
|
utm_source?: string;
|