@quantaroute/checkout 1.4.1 → 1.4.3

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
@@ -5,6 +5,32 @@ All notable changes to `@quantaroute/checkout` are documented here.
5
5
  Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
  Release dates are from git history where available; earlier versions are estimated from the first public commit.
7
7
 
8
+ ## [1.4.3](https://github.com/quantaroute/checkout/compare/v1.4.2...v1.4.3) — 2026-06-16
9
+
10
+ ### Added
11
+
12
+ - `normalizeDigiPinInput`, `formatDigiPin`, and `isCompleteDigiPinInput` exports for flexible DigiPin parsing
13
+ - `CompleteAddress.addressId` — set when a buyer re-selects an existing saved address
14
+ - `CheckoutWidgetController` + `registerController` prop for host-page step navigation (e.g. Shopify pre-checkout shell)
15
+
16
+ ### Changed
17
+
18
+ - **Offline DigiPin search** accepts dashed, spaced, and compact input (`4P3-J68-637F`, `4P3 J68 637F`, `4P3J68637F`)
19
+ - `looksLikeDigiPin` and `isValidDigiPin` use normalised 10-character body instead of dashed-only regex
20
+ - `createAddress` skipped when re-selecting a saved row; new addresses no longer auto-set `is_default: true`
21
+
22
+ ## [1.4.2](https://github.com/quantaroute/checkout/compare/v1.4.1...v1.4.2) — 2026-06-16
23
+
24
+ ### Added
25
+
26
+ - **Home / Work / Other address label picker** on the address details step (web + native)
27
+ - `AddressLabel` type and `ADDRESS_LABELS` export (`'home' | 'work' | 'other'`)
28
+ - `CompleteAddress.label` — chosen label is passed to `createAddress()` instead of hardcoded `'home'`
29
+
30
+ ### Changed
31
+
32
+ - Saved addresses from the picker retain their stored label when re-selected
33
+
8
34
  ## [1.4.1](https://github.com/quantaroute/checkout/compare/v1.4.0...v1.4.1) — 2026-06-13
9
35
 
10
36
  ### Added
package/README.md CHANGED
@@ -326,6 +326,8 @@ As India Post promotes DigiPin nationally, buyers can paste their 10-character c
326
326
 
327
327
  When `enablePhoneAuth` is true the widget starts with a phone-entry step. Returning buyers can pick a previously saved address from any brand in the network instead of dropping the pin again.
328
328
 
329
+ On the address details step, buyers choose a **Home / Work / Other** label before saving. The label is stored in the checkout-addresses API and returned on `CompleteAddress.label`.
330
+
329
331
  **Requires:**
330
332
 
331
333
  1. A merchant account — sign up at [developers.quantaroute.com/onboarding](https://developers.quantaroute.com/onboarding/merchant) to get your `merchantId` and `supabaseFunctionBaseUrl`.
@@ -534,9 +536,16 @@ interface CompleteAddress {
534
536
  streetName: string; // "MG Road, Action Area" (OSM pre-filled)
535
537
 
536
538
  formattedAddress: string; // "4B, 3rd Floor, Sunshine Apartments, MG Road, ..."
539
+ label?: 'home' | 'work' | 'other'; // chosen on address form; defaults to home
537
540
  }
538
541
  ```
539
542
 
543
+ When `enablePhoneAuth` or `enableEmailAuth` is on, the widget persists the address via `createAddress()` using this label.
544
+
545
+ ```ts
546
+ type AddressLabel = 'home' | 'work' | 'other';
547
+ ```
548
+
540
549
  ---
541
550
 
542
551
  ## Advanced usage
@@ -1,6 +1,8 @@
1
1
  import { default as default_2 } from 'react';
2
2
  import { ReactNode } from 'react';
3
3
 
4
+ export declare const ADDRESS_LABELS: AddressLabel[];
5
+
4
6
  /**
5
7
  * Address components from Nominatim/OpenStreetMap (via reverse geocoding).
6
8
  */
@@ -36,6 +38,9 @@ export declare interface AddressFormProps {
36
38
  theme?: 'light' | 'dark';
37
39
  }
38
40
 
41
+ /** Label for a saved buyer address — stored in checkout-addresses API. */
42
+ export declare type AddressLabel = 'home' | 'work' | 'other';
43
+
39
44
  export declare interface AdministrativeInfo {
40
45
  country?: string;
41
46
  state: string;
@@ -156,6 +161,13 @@ declare const CheckoutWidget: default_2.FC<CheckoutWidgetProps>;
156
161
  export { CheckoutWidget }
157
162
  export default CheckoutWidget;
158
163
 
164
+ /** Imperative hooks for host pages (e.g. Shopify pre-checkout shell). */
165
+ declare interface CheckoutWidgetController {
166
+ /** Navigate one step back within the widget. Returns true if handled. */
167
+ goBack: () => boolean;
168
+ getStep: () => string;
169
+ }
170
+
159
171
  export declare interface CheckoutWidgetProps {
160
172
  /**
161
173
  * Your QuantaRoute API key.
@@ -288,6 +300,11 @@ export declare interface CheckoutWidgetProps {
288
300
  prepaidNudgeCopy?: string;
289
301
  /** Override merchant prepaid nudge CTA URL. */
290
302
  prepaidNudgeCtaUrl?: string;
303
+ /**
304
+ * Called once on mount with imperative navigation helpers for host shells
305
+ * (step-aware back button, etc.).
306
+ */
307
+ registerController?: (controller: CheckoutWidgetController) => void;
291
308
  }
292
309
 
293
310
  /**
@@ -349,6 +366,10 @@ export declare interface CompleteAddress {
349
366
  streetName: string;
350
367
  /** Combined formatted address string */
351
368
  formattedAddress: string;
369
+ /** Buyer-chosen label for saved-address book (defaults to home) */
370
+ label?: AddressLabel;
371
+ /** Set when the buyer re-selected an existing saved row (skip createAddress). */
372
+ addressId?: string;
352
373
  }
353
374
 
354
375
  export declare interface Coordinates {
@@ -430,6 +451,9 @@ export declare function fetchPrepaidNudgeConfig(functionBaseUrl: string, adminAp
430
451
  /** Fetch UTM-matched offer banner for the current session. */
431
452
  export declare function fetchSessionOffer(config: CheckoutApiConfig, sessionToken: string): Promise<SessionOffer | null>;
432
453
 
454
+ /** Canonical display format: XXX-XXX-XXXX */
455
+ export declare function formatDigiPin(input: string): string;
456
+
433
457
  export declare interface FunnelEventPayload {
434
458
  event_type: string;
435
459
  step?: string;
@@ -461,6 +485,9 @@ export declare function getWebDeviceContext(): DeviceContext;
461
485
  /** True when at least one UTM field is set. */
462
486
  export declare function hasUtmParams(utm: UtmParams): boolean;
463
487
 
488
+ /** True when input is a complete 10-character DigiPin (any common separator style). */
489
+ export declare function isCompleteDigiPinInput(input: string): boolean;
490
+
464
491
  /**
465
492
  * Validate a DigiPin string (format + character check).
466
493
  */
@@ -552,6 +579,12 @@ export declare interface MapPinSelectorProps {
552
579
  brandColor?: string;
553
580
  }
554
581
 
582
+ /**
583
+ * Normalise user input to a 10-character DigiPin body (no separators).
584
+ * Accepts dashed, spaced, or compact forms — e.g. `4P3-J68-637F`, `4P3 J68 637F`, `4P3J68637F`.
585
+ */
586
+ export declare function normalizeDigiPinInput(input: string): string;
587
+
555
588
  /**
556
589
  * Notify the server that the buyer has confirmed their delivery address.
557
590
  * Triggers `session.address_completed` webhook on the merchant's configured URL.