@quantaroute/checkout 1.7.1 → 1.7.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 +18 -0
- package/README.md +1 -1
- package/dist/lib/index.d.ts +100 -2
- package/dist/lib/quantaroute-checkout.es.js +207 -193
- package/dist/lib/quantaroute-checkout.umd.js +137 -123
- package/dist/style.css +1 -1
- package/package.json +7 -3
- package/src/components/CheckoutWidget.tsx +9 -0
- package/src/components/MapPinSelector.native.tsx +2 -8
- package/src/components/MapPinSelector.tsx +257 -175
- package/src/core/map-runtime.ts +173 -0
- package/src/core/types.ts +36 -2
- package/src/index.ts +22 -0
- package/src/styles/checkout.css +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,24 @@ Release dates are from git history where available; earlier versions are estimat
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.7.3](https://github.com/quantaroute/checkout/compare/v1.7.2...v1.7.3) — 2026-11-09
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- 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.
|
|
15
|
+
|
|
16
|
+
## [1.7.2](https://github.com/quantaroute/checkout/compare/v1.7.1...v1.7.2) — 2026-07-06
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **`mapStyle` prop** on `MapPinSelector` and `CheckoutWidget` — override the MapLibre basemap URL (e.g. `OPENFREEMAP_POSITRON_STYLE_URL` when Carto credentials are unavailable)
|
|
21
|
+
- **`embedMode` prop** (`bundled` | `external`) — `external` waits for `window.maplibregl` from a CDN script before initialising the map (Shopify theme extensions, script-tag embeds)
|
|
22
|
+
- **`MapRuntime` interface** and helpers (`getExternalMapRuntime`, `waitForExternalMapRuntime`, `DEFAULT_MAP_STYLE_URL`, `OPENFREEMAP_POSITRON_STYLE_URL`) exported from the package
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **MapPinSelector (web)** — loading/unavailable/error states when MapLibre is slow or missing; confirm and locate buttons disabled until the map is ready
|
|
27
|
+
|
|
10
28
|
## [1.7.1](https://github.com/quantaroute/checkout/compare/v1.7.0...v1.7.1) — 2026-07-06
|
|
11
29
|
|
|
12
30
|
### Fixed
|
package/README.md
CHANGED
|
@@ -715,7 +715,7 @@ function MyCheckout() {
|
|
|
715
715
|
```tsx
|
|
716
716
|
<CheckoutWidget
|
|
717
717
|
apiKey="..."
|
|
718
|
-
indiaBoundaryUrl="/geojson/india.geojson"
|
|
718
|
+
indiaBoundaryUrl="https://maps.quantaroute.com/geojson/india.geojson"
|
|
719
719
|
onComplete={...}
|
|
720
720
|
/>
|
|
721
721
|
```
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import { AttributionControl } from 'maplibre-gl';
|
|
1
2
|
import { default as default_2 } from 'react';
|
|
3
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
4
|
+
import { Marker as MapLibreMarker } from 'maplibre-gl';
|
|
5
|
+
import { MapMouseEvent } from 'maplibre-gl';
|
|
6
|
+
import { NavigationControl } from 'maplibre-gl';
|
|
2
7
|
import { ReactNode } from 'react';
|
|
3
8
|
|
|
4
9
|
export declare const ADDRESS_LABELS: AddressLabel[];
|
|
@@ -169,6 +174,9 @@ export declare interface AutocompleteSuggestion {
|
|
|
169
174
|
/** Read UTM params from the current page URL (web). Returns {} on native or SSR. */
|
|
170
175
|
export declare function captureUtmFromUrl(href?: string): UtmParams;
|
|
171
176
|
|
|
177
|
+
/** Carto Positron — fallback if maps.quantaroute.com is unavailable. */
|
|
178
|
+
export declare const CARTO_POSITRON_STYLE_URL = "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json";
|
|
179
|
+
|
|
172
180
|
/**
|
|
173
181
|
* Check COD availability for a delivery pincode (Edge: `cod_eligibility`).
|
|
174
182
|
* Respects `checkout.merchants.enable_cod` (C4), `cod_blocked_pincodes` / `cod_max_cart_value_paise` (D1/D2).
|
|
@@ -291,9 +299,25 @@ export declare interface CheckoutWidgetProps {
|
|
|
291
299
|
* URL to an India boundary GeoJSON file (FeatureCollection).
|
|
292
300
|
* When provided, a thin grey outline is drawn on the map for legal compliance.
|
|
293
301
|
* Host the file in your app's public folder and pass its path here.
|
|
294
|
-
* Example: indiaBoundaryUrl="/geojson/india.geojson"
|
|
302
|
+
* Example: indiaBoundaryUrl="https://maps.quantaroute.com/geojson/india.geojson"
|
|
295
303
|
*/
|
|
296
304
|
indiaBoundaryUrl?: string;
|
|
305
|
+
/**
|
|
306
|
+
* MapLibre style URL for the map step. Defaults to QuantaRoute India.
|
|
307
|
+
* `CARTO_POSITRON_STYLE_URL` / `OPENFREEMAP_POSITRON_STYLE_URL` remain fallbacks.
|
|
308
|
+
* Wins over `mapTheme`.
|
|
309
|
+
*/
|
|
310
|
+
mapStyle?: string;
|
|
311
|
+
/**
|
|
312
|
+
* Named QuantaRoute Atlas theme when `mapStyle` is omitted:
|
|
313
|
+
* `pro` (default), `light`, or `dark`.
|
|
314
|
+
*/
|
|
315
|
+
mapTheme?: QuantaRouteMapTheme;
|
|
316
|
+
/**
|
|
317
|
+
* How MapLibre GL JS is loaded on web. `external` waits for `window.maplibregl`
|
|
318
|
+
* when the host loads MapLibre from a CDN (e.g. Shopify theme extensions).
|
|
319
|
+
*/
|
|
320
|
+
embedMode?: MapEmbedMode;
|
|
297
321
|
/**
|
|
298
322
|
* Show the smart search bar on the map step (default: true).
|
|
299
323
|
* Supports address search (API) and DigiPin lookup (100% offline).
|
|
@@ -530,6 +554,9 @@ export declare interface CreatePaymentOrderResult {
|
|
|
530
554
|
currency: string;
|
|
531
555
|
}
|
|
532
556
|
|
|
557
|
+
/** Default basemap for web embeds (Atlas Pro). */
|
|
558
|
+
export declare const DEFAULT_MAP_STYLE_URL = "https://maps.quantaroute.com/styles/quantaroute.json";
|
|
559
|
+
|
|
533
560
|
/** Soft-delete a saved address. */
|
|
534
561
|
export declare function deleteAddress(config: CheckoutApiConfig, sessionToken: string, addressId: string): Promise<void>;
|
|
535
562
|
|
|
@@ -614,6 +641,8 @@ export declare interface FunnelEventPayload {
|
|
|
614
641
|
*/
|
|
615
642
|
export declare function getDigiPin(lat: number, lon: number): string;
|
|
616
643
|
|
|
644
|
+
export declare function getExternalMapRuntime(): MapRuntime | null;
|
|
645
|
+
|
|
617
646
|
/**
|
|
618
647
|
* Decode a DigiPin code back to center-point coordinates.
|
|
619
648
|
* @throws if the DigiPin format is invalid
|
|
@@ -688,6 +717,19 @@ export declare function looksLikeDigiPin(input: string): boolean;
|
|
|
688
717
|
*/
|
|
689
718
|
export declare function lookupLocation(lat: number, lng: number, apiKey: string, baseUrl?: string): Promise<LocationLookupResponse>;
|
|
690
719
|
|
|
720
|
+
/**
|
|
721
|
+
* How the host provides MapLibre GL JS.
|
|
722
|
+
* - `bundled`: import from `maplibre-gl` (default — Next.js, Vite apps with the peer installed)
|
|
723
|
+
* - `external`: read from `window.maplibregl` (CDN script loaded before the widget, e.g. Shopify)
|
|
724
|
+
*/
|
|
725
|
+
export declare type MapEmbedMode = 'bundled' | 'external';
|
|
726
|
+
|
|
727
|
+
export { MapLibreMap }
|
|
728
|
+
|
|
729
|
+
export { MapLibreMarker }
|
|
730
|
+
|
|
731
|
+
export { MapMouseEvent }
|
|
732
|
+
|
|
691
733
|
export declare const MapPinSelector: default_2.FC<MapPinSelectorProps>;
|
|
692
734
|
|
|
693
735
|
export declare interface MapPinSelectorProps {
|
|
@@ -702,7 +744,7 @@ export declare interface MapPinSelectorProps {
|
|
|
702
744
|
* When provided, a thin grey outline of India's border is drawn on the map
|
|
703
745
|
* to satisfy Indian government map policy requirements.
|
|
704
746
|
* The file is fetched in parallel with map initialisation — no visible delay.
|
|
705
|
-
* Example: indiaBoundaryUrl="/geojson/india.geojson"
|
|
747
|
+
* Example: indiaBoundaryUrl="https://maps.quantaroute.com/geojson/india.geojson"
|
|
706
748
|
*/
|
|
707
749
|
indiaBoundaryUrl?: string;
|
|
708
750
|
/**
|
|
@@ -721,6 +763,31 @@ export declare interface MapPinSelectorProps {
|
|
|
721
763
|
* Brand accent colour (hex, e.g. `#7c3aed`). Sets map pin, buttons, focus rings via `--qr-primary` on web.
|
|
722
764
|
*/
|
|
723
765
|
brandColor?: string;
|
|
766
|
+
/**
|
|
767
|
+
* MapLibre style URL for the basemap. Defaults to QuantaRoute India
|
|
768
|
+
* (`QUANTAROUTE_MAP_STYLE_URL`). `CARTO_POSITRON_STYLE_URL` and
|
|
769
|
+
* `OPENFREEMAP_POSITRON_STYLE_URL` remain available as fallbacks.
|
|
770
|
+
* Wins over `mapTheme`.
|
|
771
|
+
*/
|
|
772
|
+
mapStyle?: string;
|
|
773
|
+
/**
|
|
774
|
+
* Named QuantaRoute Atlas theme when `mapStyle` is omitted:
|
|
775
|
+
* `pro` (default), `light`, or `dark`.
|
|
776
|
+
*/
|
|
777
|
+
mapTheme?: QuantaRouteMapTheme;
|
|
778
|
+
/**
|
|
779
|
+
* How MapLibre GL JS is loaded on web. `bundled` imports the peer dependency;
|
|
780
|
+
* `external` waits for `window.maplibregl` (CDN script loaded by the host).
|
|
781
|
+
*/
|
|
782
|
+
embedMode?: MapEmbedMode;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/** Subset of maplibre-gl used by the web MapPinSelector. */
|
|
786
|
+
export declare interface MapRuntime {
|
|
787
|
+
Map: new (options: ConstructorParameters<MapLibreMap>[0]) => MapLibreMap;
|
|
788
|
+
Marker: new (options?: ConstructorParameters<MapLibreMarker>[0]) => MapLibreMarker;
|
|
789
|
+
AttributionControl?: new (options?: ConstructorParameters<NonNullable<AttributionControl>>[0]) => AttributionControl;
|
|
790
|
+
NavigationControl?: new (options?: ConstructorParameters<NonNullable<NavigationControl>>[0]) => NavigationControl;
|
|
724
791
|
}
|
|
725
792
|
|
|
726
793
|
/**
|
|
@@ -745,6 +812,9 @@ export declare function notifyAddressCompleted(config: CheckoutApiConfig, sessio
|
|
|
745
812
|
/** Signal explicit session abandonment (page exit). */
|
|
746
813
|
export declare function notifySessionAbandoned(config: CheckoutApiConfig, sessionToken: string, lastStep: string): Promise<void>;
|
|
747
814
|
|
|
815
|
+
/** OpenFreeMap Positron — fallback used by some Shopify embeds historically. */
|
|
816
|
+
export declare const OPENFREEMAP_POSITRON_STYLE_URL = "https://tiles.openfreemap.org/styles/positron";
|
|
817
|
+
|
|
748
818
|
export declare const OtpStep: default_2.FC<OtpStepProps>;
|
|
749
819
|
|
|
750
820
|
export declare interface OtpStepProps {
|
|
@@ -826,10 +896,32 @@ export declare interface PrepaidNudgeProps {
|
|
|
826
896
|
theme?: 'light' | 'dark';
|
|
827
897
|
}
|
|
828
898
|
|
|
899
|
+
/** Official India outline GeoJSON (Survey of India / Datameet). Same file as the style overlay. */
|
|
900
|
+
export declare const QUANTAROUTE_INDIA_BOUNDARY_URL = "https://maps.quantaroute.com/geojson/india.geojson";
|
|
901
|
+
|
|
902
|
+
export declare const QUANTAROUTE_MAP_STYLE_DARK_URL = "https://maps.quantaroute.com/styles/quantaroute-pro-dark.json";
|
|
903
|
+
|
|
904
|
+
export declare const QUANTAROUTE_MAP_STYLE_LIGHT_URL = "https://maps.quantaroute.com/styles/quantaroute-pro-light.json";
|
|
905
|
+
|
|
906
|
+
/** QuantaRoute India basemap (Geofabrik PBF, Survey of India outline). */
|
|
907
|
+
export declare const QUANTAROUTE_MAP_STYLE_URL = "https://maps.quantaroute.com/styles/quantaroute.json";
|
|
908
|
+
|
|
909
|
+
export declare const QUANTAROUTE_MAP_STYLES: {
|
|
910
|
+
readonly pro: "https://maps.quantaroute.com/styles/quantaroute.json";
|
|
911
|
+
readonly light: "https://maps.quantaroute.com/styles/quantaroute-pro-light.json";
|
|
912
|
+
readonly dark: "https://maps.quantaroute.com/styles/quantaroute-pro-dark.json";
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
export declare const QUANTAROUTE_MAP_STYLES_CATALOG_URL = "https://maps.quantaroute.com/styles.json";
|
|
916
|
+
|
|
917
|
+
export declare type QuantaRouteMapTheme = keyof typeof QUANTAROUTE_MAP_STYLES;
|
|
918
|
+
|
|
829
919
|
export declare function recordCodPayment(config: CheckoutApiConfig, sessionToken: string): Promise<{
|
|
830
920
|
payment_method: string;
|
|
831
921
|
}>;
|
|
832
922
|
|
|
923
|
+
export declare function resolveQuantaRouteMapStyle(mapStyle?: string, mapTheme?: QuantaRouteMapTheme): string;
|
|
924
|
+
|
|
833
925
|
/**
|
|
834
926
|
* Call QuantaRoute's Reverse Geocoding API.
|
|
835
927
|
* Converts DigiPin → address components from Nominatim/OpenStreetMap.
|
|
@@ -1051,4 +1143,10 @@ export declare function verifyPayment(config: CheckoutApiConfig, sessionToken: s
|
|
|
1051
1143
|
razorpay_payment_id: string;
|
|
1052
1144
|
}>;
|
|
1053
1145
|
|
|
1146
|
+
/**
|
|
1147
|
+
* Poll `window.maplibregl` until available or timeout (for async CDN loads).
|
|
1148
|
+
* Returns a cancel function for useEffect cleanup.
|
|
1149
|
+
*/
|
|
1150
|
+
export declare function waitForExternalMapRuntime(onReady: (runtime: MapRuntime) => void, onUnavailable: () => void, waitMs?: number, retryMs?: number): () => void;
|
|
1151
|
+
|
|
1054
1152
|
export { }
|