@quantaroute/checkout 1.7.2 → 1.7.4
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 +22 -0
- package/README.md +4 -1
- package/dist/lib/index.d.ts +67 -10
- package/dist/lib/quantaroute-checkout.es.js +159 -139
- package/dist/lib/quantaroute-checkout.umd.js +151 -131
- package/dist/style.css +1 -1
- package/package.json +7 -3
- package/src/components/AddressForm.native.tsx +3 -3
- package/src/components/AddressForm.tsx +3 -3
- package/src/components/CheckoutWidget.tsx +51 -14
- package/src/components/MapPinSelector.native.tsx +14 -9
- package/src/components/MapPinSelector.tsx +43 -15
- package/src/components/PaymentStep.tsx +36 -8
- package/src/core/map-runtime.ts +98 -3
- package/src/core/types.ts +33 -8
- package/src/index.ts +11 -0
- package/src/styles/checkout.css +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,28 @@ Release dates are from git history where available; earlier versions are estimat
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.7.4](https://github.com/quantaroute/checkout/compare/v1.7.3...v1.7.4) — 2026-11-14
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **`mapsKey` prop** on `MapPinSelector` and `CheckoutWidget`. When the style is on `maps.quantaroute.com`, MapLibre `transformRequest` attaches `?key=` to style, sprite, font and tile requests. Shopify and other third-party hosts need a public `dp_` key with the maps scope; first-party sites can omit it.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **Cash on Delivery at the payment step**: eligibility is now checked as soon as an address is chosen, so the COD option can appear before `done`; it resets when the address changes
|
|
19
|
+
- **Address form**: no duplicate address when Save is clicked twice; `onAddressComplete` may return a promise and the form stays in its submitting state until it settles (web and native)
|
|
20
|
+
- **Map search**: spinner no longer sticks after deleting characters or entering a DigiPin, and a slow older autocomplete response no longer overwrites newer results (web and native)
|
|
21
|
+
- **Saved address selection**: `session.address_completed` webhook, CRM relay and funnel event fire once instead of twice
|
|
22
|
+
- **Razorpay loader**: the pay button no longer hangs on "Processing..." when the script tag failed or stalled; it times out after 15 s and retries cleanly
|
|
23
|
+
- **Change Address**: a verified buyer returns to saved addresses instead of the OTP step; after a payment the finished session is dropped and the buyer signs in again
|
|
24
|
+
- **Edge functions**: `checkout-addresses`, `checkout-payment` and `checkout-session-expiry` no longer overwrite a `completed` or `expired` session
|
|
25
|
+
|
|
26
|
+
## [1.7.3](https://github.com/quantaroute/checkout/compare/v1.7.2...v1.7.3) — 2026-11-09
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Default web/native basemap is **QuantaRoute India** (`QUANTAROUTE_MAP_STYLE_URL` / `https://maps.quantaroute.com/styles/quantaroute.json`). The style hides OSM country borders and draws the Survey of India / Datameet outline. `CARTO_POSITRON_STYLE_URL` and `OPENFREEMAP_POSITRON_STYLE_URL` remain exported fallbacks. `QUANTAROUTE_INDIA_BOUNDARY_URL` is the hosted official GeoJSON.
|
|
31
|
+
|
|
10
32
|
## [1.7.2](https://github.com/quantaroute/checkout/compare/v1.7.1...v1.7.2) — 2026-07-06
|
|
11
33
|
|
|
12
34
|
### Added
|
package/README.md
CHANGED
|
@@ -92,6 +92,7 @@ export default function CheckoutPage() {
|
|
|
92
92
|
return (
|
|
93
93
|
<CheckoutWidget
|
|
94
94
|
apiKey={process.env.NEXT_PUBLIC_QUANTAROUTE_KEY!}
|
|
95
|
+
mapsKey={process.env.NEXT_PUBLIC_QUANTAROUTE_MAPS_KEY}
|
|
95
96
|
onComplete={(address) => {
|
|
96
97
|
console.log(address.digipin); // "39J-438-TJC7"
|
|
97
98
|
console.log(address.pincode); // "110011"
|
|
@@ -103,6 +104,8 @@ export default function CheckoutPage() {
|
|
|
103
104
|
}
|
|
104
105
|
```
|
|
105
106
|
|
|
107
|
+
Third-party hosts must pass `mapsKey` (a public `dp_` key with the maps scope). First-party QuantaRoute sites can omit it.
|
|
108
|
+
|
|
106
109
|
### Next.js (App Router)
|
|
107
110
|
|
|
108
111
|
```tsx
|
|
@@ -715,7 +718,7 @@ function MyCheckout() {
|
|
|
715
718
|
```tsx
|
|
716
719
|
<CheckoutWidget
|
|
717
720
|
apiKey="..."
|
|
718
|
-
indiaBoundaryUrl="/geojson/india.geojson"
|
|
721
|
+
indiaBoundaryUrl="https://maps.quantaroute.com/geojson/india.geojson"
|
|
719
722
|
onComplete={...}
|
|
720
723
|
/>
|
|
721
724
|
```
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -50,7 +50,8 @@ export declare interface AddressFormProps {
|
|
|
50
50
|
lng: number;
|
|
51
51
|
apiKey: string;
|
|
52
52
|
apiBaseUrl?: string;
|
|
53
|
-
|
|
53
|
+
/** May return a promise; the form stays in its submitting state until it settles. */
|
|
54
|
+
onAddressComplete: (address: CompleteAddress) => void | Promise<void>;
|
|
54
55
|
onBack: () => void;
|
|
55
56
|
onError?: (error: Error) => void;
|
|
56
57
|
theme?: 'light' | 'dark';
|
|
@@ -174,6 +175,9 @@ export declare interface AutocompleteSuggestion {
|
|
|
174
175
|
/** Read UTM params from the current page URL (web). Returns {} on native or SSR. */
|
|
175
176
|
export declare function captureUtmFromUrl(href?: string): UtmParams;
|
|
176
177
|
|
|
178
|
+
/** Carto Positron — fallback if maps.quantaroute.com is unavailable. */
|
|
179
|
+
export declare const CARTO_POSITRON_STYLE_URL = "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json";
|
|
180
|
+
|
|
177
181
|
/**
|
|
178
182
|
* Check COD availability for a delivery pincode (Edge: `cod_eligibility`).
|
|
179
183
|
* Respects `checkout.merchants.enable_cod` (C4), `cod_blocked_pincodes` / `cod_max_cart_value_paise` (D1/D2).
|
|
@@ -296,19 +300,30 @@ export declare interface CheckoutWidgetProps {
|
|
|
296
300
|
* URL to an India boundary GeoJSON file (FeatureCollection).
|
|
297
301
|
* When provided, a thin grey outline is drawn on the map for legal compliance.
|
|
298
302
|
* Host the file in your app's public folder and pass its path here.
|
|
299
|
-
* Example: indiaBoundaryUrl="/geojson/india.geojson"
|
|
303
|
+
* Example: indiaBoundaryUrl="https://maps.quantaroute.com/geojson/india.geojson"
|
|
300
304
|
*/
|
|
301
305
|
indiaBoundaryUrl?: string;
|
|
302
306
|
/**
|
|
303
|
-
* MapLibre style URL for the map step. Defaults to
|
|
304
|
-
*
|
|
307
|
+
* MapLibre style URL for the map step. Defaults to QuantaRoute India.
|
|
308
|
+
* `CARTO_POSITRON_STYLE_URL` / `OPENFREEMAP_POSITRON_STYLE_URL` remain fallbacks.
|
|
309
|
+
* Wins over `mapTheme`.
|
|
305
310
|
*/
|
|
306
311
|
mapStyle?: string;
|
|
312
|
+
/**
|
|
313
|
+
* Named QuantaRoute Atlas theme when `mapStyle` is omitted:
|
|
314
|
+
* `pro` (default), `light`, or `dark`.
|
|
315
|
+
*/
|
|
316
|
+
mapTheme?: QuantaRouteMapTheme;
|
|
307
317
|
/**
|
|
308
318
|
* How MapLibre GL JS is loaded on web. `external` waits for `window.maplibregl`
|
|
309
319
|
* when the host loads MapLibre from a CDN (e.g. Shopify theme extensions).
|
|
310
320
|
*/
|
|
311
321
|
embedMode?: MapEmbedMode;
|
|
322
|
+
/**
|
|
323
|
+
* Public `dp_` key with the maps scope. Passed through to the map step.
|
|
324
|
+
* Shopify and other third-party hosts must set this; first-party sites can omit it.
|
|
325
|
+
*/
|
|
326
|
+
mapsKey?: string;
|
|
312
327
|
/**
|
|
313
328
|
* Show the smart search bar on the map step (default: true).
|
|
314
329
|
* Supports address search (API) and DigiPin lookup (100% offline).
|
|
@@ -545,8 +560,8 @@ export declare interface CreatePaymentOrderResult {
|
|
|
545
560
|
currency: string;
|
|
546
561
|
}
|
|
547
562
|
|
|
548
|
-
/**
|
|
549
|
-
export declare const DEFAULT_MAP_STYLE_URL = "https://
|
|
563
|
+
/** Default basemap for web embeds (Atlas Pro). */
|
|
564
|
+
export declare const DEFAULT_MAP_STYLE_URL = "https://maps.quantaroute.com/styles/quantaroute.json";
|
|
550
565
|
|
|
551
566
|
/** Soft-delete a saved address. */
|
|
552
567
|
export declare function deleteAddress(config: CheckoutApiConfig, sessionToken: string, addressId: string): Promise<void>;
|
|
@@ -735,7 +750,7 @@ export declare interface MapPinSelectorProps {
|
|
|
735
750
|
* When provided, a thin grey outline of India's border is drawn on the map
|
|
736
751
|
* to satisfy Indian government map policy requirements.
|
|
737
752
|
* The file is fetched in parallel with map initialisation — no visible delay.
|
|
738
|
-
* Example: indiaBoundaryUrl="/geojson/india.geojson"
|
|
753
|
+
* Example: indiaBoundaryUrl="https://maps.quantaroute.com/geojson/india.geojson"
|
|
739
754
|
*/
|
|
740
755
|
indiaBoundaryUrl?: string;
|
|
741
756
|
/**
|
|
@@ -755,15 +770,28 @@ export declare interface MapPinSelectorProps {
|
|
|
755
770
|
*/
|
|
756
771
|
brandColor?: string;
|
|
757
772
|
/**
|
|
758
|
-
* MapLibre style URL for the basemap. Defaults to
|
|
759
|
-
*
|
|
773
|
+
* MapLibre style URL for the basemap. Defaults to QuantaRoute India
|
|
774
|
+
* (`QUANTAROUTE_MAP_STYLE_URL`). `CARTO_POSITRON_STYLE_URL` and
|
|
775
|
+
* `OPENFREEMAP_POSITRON_STYLE_URL` remain available as fallbacks.
|
|
776
|
+
* Wins over `mapTheme`.
|
|
760
777
|
*/
|
|
761
778
|
mapStyle?: string;
|
|
779
|
+
/**
|
|
780
|
+
* Named QuantaRoute Atlas theme when `mapStyle` is omitted:
|
|
781
|
+
* `pro` (default), `light`, or `dark`.
|
|
782
|
+
*/
|
|
783
|
+
mapTheme?: QuantaRouteMapTheme;
|
|
762
784
|
/**
|
|
763
785
|
* How MapLibre GL JS is loaded on web. `bundled` imports the peer dependency;
|
|
764
786
|
* `external` waits for `window.maplibregl` (CDN script loaded by the host).
|
|
765
787
|
*/
|
|
766
788
|
embedMode?: MapEmbedMode;
|
|
789
|
+
/**
|
|
790
|
+
* Public `dp_` key with the maps scope. Required when the style is on
|
|
791
|
+
* maps.quantaroute.com and the page is not a first-party origin. MapLibre
|
|
792
|
+
* `transformRequest` attaches it to the style, sprite, font and tile URLs.
|
|
793
|
+
*/
|
|
794
|
+
mapsKey?: string;
|
|
767
795
|
}
|
|
768
796
|
|
|
769
797
|
/** Subset of maplibre-gl used by the web MapPinSelector. */
|
|
@@ -774,6 +802,10 @@ export declare interface MapRuntime {
|
|
|
774
802
|
NavigationControl?: new (options?: ConstructorParameters<NonNullable<NavigationControl>>[0]) => NavigationControl;
|
|
775
803
|
}
|
|
776
804
|
|
|
805
|
+
export declare function mapsTransformRequest(key?: string): ((url: string) => {
|
|
806
|
+
url: string;
|
|
807
|
+
}) | undefined;
|
|
808
|
+
|
|
777
809
|
/**
|
|
778
810
|
* Normalise user input to a 10-character DigiPin body (no separators).
|
|
779
811
|
* Accepts dashed, spaced, or compact forms — e.g. `4P3-J68-637F`, `4P3 J68 637F`, `4P3J68637F`.
|
|
@@ -796,7 +828,7 @@ export declare function notifyAddressCompleted(config: CheckoutApiConfig, sessio
|
|
|
796
828
|
/** Signal explicit session abandonment (page exit). */
|
|
797
829
|
export declare function notifySessionAbandoned(config: CheckoutApiConfig, sessionToken: string, lastStep: string): Promise<void>;
|
|
798
830
|
|
|
799
|
-
/** OpenFreeMap Positron —
|
|
831
|
+
/** OpenFreeMap Positron — fallback used by some Shopify embeds historically. */
|
|
800
832
|
export declare const OPENFREEMAP_POSITRON_STYLE_URL = "https://tiles.openfreemap.org/styles/positron";
|
|
801
833
|
|
|
802
834
|
export declare const OtpStep: default_2.FC<OtpStepProps>;
|
|
@@ -880,10 +912,32 @@ export declare interface PrepaidNudgeProps {
|
|
|
880
912
|
theme?: 'light' | 'dark';
|
|
881
913
|
}
|
|
882
914
|
|
|
915
|
+
/** Official India outline GeoJSON (Survey of India / Datameet). Same file as the style overlay. */
|
|
916
|
+
export declare const QUANTAROUTE_INDIA_BOUNDARY_URL = "https://maps.quantaroute.com/geojson/india.geojson";
|
|
917
|
+
|
|
918
|
+
export declare const QUANTAROUTE_MAP_STYLE_DARK_URL = "https://maps.quantaroute.com/styles/quantaroute-pro-dark.json";
|
|
919
|
+
|
|
920
|
+
export declare const QUANTAROUTE_MAP_STYLE_LIGHT_URL = "https://maps.quantaroute.com/styles/quantaroute-pro-light.json";
|
|
921
|
+
|
|
922
|
+
/** QuantaRoute India basemap (Geofabrik PBF, Survey of India outline). */
|
|
923
|
+
export declare const QUANTAROUTE_MAP_STYLE_URL = "https://maps.quantaroute.com/styles/quantaroute.json";
|
|
924
|
+
|
|
925
|
+
export declare const QUANTAROUTE_MAP_STYLES: {
|
|
926
|
+
readonly pro: "https://maps.quantaroute.com/styles/quantaroute.json";
|
|
927
|
+
readonly light: "https://maps.quantaroute.com/styles/quantaroute-pro-light.json";
|
|
928
|
+
readonly dark: "https://maps.quantaroute.com/styles/quantaroute-pro-dark.json";
|
|
929
|
+
};
|
|
930
|
+
|
|
931
|
+
export declare const QUANTAROUTE_MAP_STYLES_CATALOG_URL = "https://maps.quantaroute.com/styles.json";
|
|
932
|
+
|
|
933
|
+
export declare type QuantaRouteMapTheme = keyof typeof QUANTAROUTE_MAP_STYLES;
|
|
934
|
+
|
|
883
935
|
export declare function recordCodPayment(config: CheckoutApiConfig, sessionToken: string): Promise<{
|
|
884
936
|
payment_method: string;
|
|
885
937
|
}>;
|
|
886
938
|
|
|
939
|
+
export declare function resolveQuantaRouteMapStyle(mapStyle?: string, mapTheme?: QuantaRouteMapTheme): string;
|
|
940
|
+
|
|
887
941
|
/**
|
|
888
942
|
* Call QuantaRoute's Reverse Geocoding API.
|
|
889
943
|
* Converts DigiPin → address components from Nominatim/OpenStreetMap.
|
|
@@ -1111,4 +1165,7 @@ export declare function verifyPayment(config: CheckoutApiConfig, sessionToken: s
|
|
|
1111
1165
|
*/
|
|
1112
1166
|
export declare function waitForExternalMapRuntime(onReady: (runtime: MapRuntime) => void, onUnavailable: () => void, waitMs?: number, retryMs?: number): () => void;
|
|
1113
1167
|
|
|
1168
|
+
/** Attach `?key=` for MapLibre requests to maps.quantaroute.com. No-op for other hosts or a missing key. */
|
|
1169
|
+
export declare function withMapsKey(url: string, key?: string): string;
|
|
1170
|
+
|
|
1114
1171
|
export { }
|