@quantaroute/checkout 1.6.0 → 1.7.1

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 CHANGED
@@ -7,6 +7,35 @@ Release dates are from git history where available; earlier versions are estimat
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.7.1](https://github.com/quantaroute/checkout/compare/v1.7.0...v1.7.1) — 2026-07-06
11
+
12
+ ### Fixed
13
+
14
+ - **Map locate button** — stays in the top-right on mobile (no overlap with attribution toggle); matches MapLibre zoom control size (29×29px) and alignment on all viewports
15
+ - **Map attribution** — compact attribution starts collapsed (icon only); full credits expand on click
16
+
17
+ ### Added
18
+
19
+ - **Address Intelligence (opt-in)** — `enableAddressIntelligence` prop, `scoreAddressRisk()` helper, payment-step risk banner, and optional COD restriction for high-risk addresses (requires deployed `checkout-addresses` backend; defaults off)
20
+
21
+ ### Changed
22
+
23
+ - `CompleteAddress` now includes saved `addressId` after `createAddress` completes
24
+
25
+ ## [1.7.0](https://github.com/quantaroute/checkout/compare/v1.6.0...v1.7.0) — 2026-06-28
26
+
27
+ ### Added
28
+
29
+ - **Mobile-first checkout presentation** — new `mobilePresentation` prop (`auto`, `sheet`, `card`) for storefront modals and drawers
30
+ - **Mobile labeled stepper** — compact Mobile/Address/Pay progress on small screens while preserving desktop dot progress
31
+ - **`mobileStepLabels`** prop for merchant-specific step label copy
32
+
33
+ ### Changed
34
+
35
+ - Improved mobile shell styling: sticky branded header, safe-area-aware actions, larger touch targets, softer saved-address cards, compact lazy verification banner, and mobile payment option rows
36
+ - Demo app includes a mobile preview frame to inspect the sheet treatment
37
+ - README documents the host-app boundary: cart state, order summary, coupons, platform APIs, and checkout interception stay outside the npm package
38
+
10
39
  ## [1.6.0](https://github.com/quantaroute/checkout/compare/v1.5.0...v1.6.0) — 2026-06-23
11
40
 
12
41
  ### Added
package/README.md CHANGED
@@ -533,6 +533,8 @@ WHERE id = 'your-merchant-uuid';
533
533
  | `brandColor` | `string` (hex) | `#0ea5e9` | all |
534
534
  | `logoUrl` | `string` (URL) | – | all |
535
535
  | `headerBanner` | `ReactNode` | – | web only |
536
+ | `mobilePresentation` | `'auto' \| 'sheet' \| 'card'` | `'auto'` | web |
537
+ | `mobileStepLabels` | `{ auth?: string; address?: string; payment?: string }` | Mobile/Address/Pay | web |
536
538
 
537
539
 
538
540
  ```tsx
@@ -541,10 +543,35 @@ WHERE id = 'your-merchant-uuid';
541
543
  brandColor="#7c3aed"
542
544
  logoUrl="https://yourbrand.com/logo.png"
543
545
  headerBanner={<p>🚚 Free shipping on orders over ₹499</p>}
546
+ mobilePresentation="sheet"
547
+ mobileStepLabels={{ auth: 'Mobile', address: 'Address', payment: 'Pay' }}
544
548
  onComplete={...}
545
549
  />
546
550
  ```
547
551
 
552
+ ### Mobile-first storefront shells
553
+
554
+ Use `mobilePresentation="sheet"` when the widget is mounted inside a mobile drawer or storefront modal. It keeps the package focused on auth, saved addresses, DigiPin verification, and optional payment while your host app owns cart-specific UI.
555
+
556
+ ```tsx
557
+ <CheckoutWidget
558
+ apiKey={geocodingKey}
559
+ merchantId={merchantId}
560
+ supabaseFunctionBaseUrl={functionsUrl}
561
+ enablePhoneAuth
562
+ enablePayment={merchantPaymentMode === 'byo_razorpay'}
563
+ paymentAmountPaise={cartTotalPaiseAfterDiscounts}
564
+ codCartTotalPaise={cartTotalPaiseAfterDiscounts}
565
+ mobilePresentation="sheet"
566
+ mobileStepLabels={{ auth: 'Mobile', address: 'Address', payment: 'Pay' }}
567
+ onCheckoutEvent={(event) => syncHostShellStep(event.step)}
568
+ onComplete={(address) => saveDeliveryAddress(address)}
569
+ onPaymentComplete={(result) => completeOrder(result)}
570
+ />
571
+ ```
572
+
573
+ The host app should keep order summary, product lines, coupons, cart state, platform APIs, and checkout-button interception outside this package. Pass only the final totals and callbacks into the widget.
574
+
548
575
  ### Analytics (client-side)
549
576
 
550
577
 
@@ -24,6 +24,8 @@ export declare interface AddressComponents {
24
24
  [key: string]: string | undefined;
25
25
  }
26
26
 
27
+ export declare type AddressConfidenceState = 'new_source_collected' | 'buyer_reconfirmed' | 'merchant_successful' | 'courier_corrected' | 'rto_associated' | 'trusted_repeat';
28
+
27
29
  export declare const AddressForm: default_2.FC<AddressFormProps>;
28
30
 
29
31
  /** Pre-fill manual fields when verifying an imported saved address. */
@@ -65,9 +67,54 @@ export declare interface AddressFormProps {
65
67
  onServiceabilityResult?: (result: ServiceabilityResult) => void;
66
68
  }
67
69
 
70
+ export declare type AddressIntervention = 'none' | 'request_missing_details' | 'reconfirm_pin' | 'prepaid_nudge' | 'hide_cod' | 'manual_review' | 'delivery_instruction';
71
+
68
72
  /** Label for a saved buyer address — stored in checkout-addresses API. */
69
73
  export declare type AddressLabel = 'home' | 'work' | 'other';
70
74
 
75
+ export declare type AddressRiskLevel = 'low' | 'medium' | 'high';
76
+
77
+ export declare interface AddressRiskPayload {
78
+ address_id?: string;
79
+ digipin?: string;
80
+ lat?: number;
81
+ lng?: number;
82
+ pincode?: string;
83
+ state?: string;
84
+ district?: string;
85
+ locality?: string;
86
+ delivery_status?: string;
87
+ flat_number?: string;
88
+ floor_number?: string;
89
+ building_name?: string;
90
+ street_name?: string;
91
+ payment_method?: string;
92
+ }
93
+
94
+ export declare interface AddressRiskScore {
95
+ level: AddressRiskLevel;
96
+ score: number;
97
+ reasons: string[];
98
+ interventions: AddressIntervention[];
99
+ confidence_state: AddressConfidenceState;
100
+ signals: AddressRiskSignals;
101
+ scored_at: string;
102
+ }
103
+
104
+ declare interface AddressRiskSignals {
105
+ merchant_history_records: number;
106
+ buyer_successful_deliveries: number;
107
+ buyer_rto_orders: number;
108
+ pincode_successful_deliveries: number;
109
+ pincode_rto_orders: number;
110
+ digipin_cell_successful_deliveries: number;
111
+ digipin_cell_rto_orders: number;
112
+ repeat_verified_address: boolean;
113
+ imported_address_pending_digipin: boolean;
114
+ cod_requested: boolean;
115
+ address_edit_count: number;
116
+ }
117
+
71
118
  export declare interface AdministrativeInfo {
72
119
  country?: string;
73
120
  state: string;
@@ -165,12 +212,24 @@ export declare interface CheckoutEvent {
165
212
  experimentVariant?: string;
166
213
  /** DigiPin of the confirmed location. Available after `location_confirmed` and `address_completed`. */
167
214
  digipin?: string;
215
+ /** Address risk level when `address_risk_scored` fires. */
216
+ addressRiskLevel?: AddressRiskScore['level'];
217
+ /** Address risk score (0-100) when address intelligence is enabled. */
218
+ addressRiskScore?: number;
168
219
  /** ISO timestamp of when the event fired. */
169
220
  timestamp: string;
170
221
  }
171
222
 
172
223
  /** All step-transition event types emitted by the widget. */
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';
224
+ 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' | 'address_risk_scored' | 'widget_reset' | 'payment_step_viewed' | 'payment_method_selected' | 'session_abandoned';
225
+
226
+ export declare type CheckoutMobilePresentation = 'auto' | 'sheet' | 'card';
227
+
228
+ export declare interface CheckoutMobileStepLabels {
229
+ auth?: string;
230
+ address?: string;
231
+ payment?: string;
232
+ }
174
233
 
175
234
  declare type CheckoutPlatform = 'web' | 'ios' | 'android';
176
235
 
@@ -221,6 +280,13 @@ export declare interface CheckoutWidgetProps {
221
280
  mapHeight?: string | number;
222
281
  /** Widget header title. Defaults to 'Add Delivery Address'. */
223
282
  title?: string;
283
+ /**
284
+ * Mobile visual treatment. `auto` applies the improved mobile layout below 480px,
285
+ * `sheet` is for storefront drawers/modals, and `card` preserves the compact card feel.
286
+ */
287
+ mobilePresentation?: CheckoutMobilePresentation;
288
+ /** Override the compact mobile step labels (e.g. Mobile / Address / Pay). */
289
+ mobileStepLabels?: CheckoutMobileStepLabels;
224
290
  /**
225
291
  * URL to an India boundary GeoJSON file (FeatureCollection).
226
292
  * When provided, a thin grey outline is drawn on the map for legal compliance.
@@ -273,6 +339,11 @@ export declare interface CheckoutWidgetProps {
273
339
  * Requires `merchantId`, `supabaseFunctionBaseUrl`, and an authenticated checkout session.
274
340
  */
275
341
  enableServiceabilityCheck?: boolean;
342
+ /**
343
+ * Score address-discrepancy-led RTO risk after address completion.
344
+ * Requires `merchantId`, `supabaseFunctionBaseUrl`, and phone/email auth or `codSessionToken`.
345
+ */
346
+ enableAddressIntelligence?: boolean;
276
347
  /**
277
348
  * Opt-in fallback banner for India Post "Non Delivery" pincodes.
278
349
  * Defaults off because courier partners may still deliver.
@@ -432,6 +503,8 @@ export declare interface CompleteAddress {
432
503
  labelText?: string;
433
504
  /** Set when the buyer re-selected an existing saved row (skip createAddress). */
434
505
  addressId?: string;
506
+ /** Explainable checkout-time address discrepancy risk, when enabled. */
507
+ addressRisk?: AddressRiskScore;
435
508
  }
436
509
 
437
510
  export declare interface Coordinates {
@@ -692,6 +765,7 @@ export declare interface PaymentStepProps {
692
765
  amountPaise: number;
693
766
  enableCod?: boolean;
694
767
  codAllowed?: boolean;
768
+ addressRisk?: AddressRiskScore | null;
695
769
  theme?: 'light' | 'dark';
696
770
  onComplete: (result: {
697
771
  paymentMethod: string;
@@ -836,6 +910,8 @@ export declare interface SavedAddressStepProps {
836
910
  onAddNew: () => void;
837
911
  }
838
912
 
913
+ export declare function scoreAddressRisk(config: CheckoutApiConfig, sessionToken: string, payload: AddressRiskPayload): Promise<AddressRiskScore>;
914
+
839
915
  /** Record the buyer's address choice for the current checkout session. */
840
916
  export declare function selectAddress(config: CheckoutApiConfig, sessionToken: string, addressId: string): Promise<void>;
841
917