@quantaroute/checkout 1.7.1 → 1.7.2

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,18 @@ Release dates are from git history where available; earlier versions are estimat
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.7.2](https://github.com/quantaroute/checkout/compare/v1.7.1...v1.7.2) — 2026-07-06
11
+
12
+ ### Added
13
+
14
+ - **`mapStyle` prop** on `MapPinSelector` and `CheckoutWidget` — override the MapLibre basemap URL (e.g. `OPENFREEMAP_POSITRON_STYLE_URL` when Carto credentials are unavailable)
15
+ - **`embedMode` prop** (`bundled` | `external`) — `external` waits for `window.maplibregl` from a CDN script before initialising the map (Shopify theme extensions, script-tag embeds)
16
+ - **`MapRuntime` interface** and helpers (`getExternalMapRuntime`, `waitForExternalMapRuntime`, `DEFAULT_MAP_STYLE_URL`, `OPENFREEMAP_POSITRON_STYLE_URL`) exported from the package
17
+
18
+ ### Changed
19
+
20
+ - **MapPinSelector (web)** — loading/unavailable/error states when MapLibre is slow or missing; confirm and locate buttons disabled until the map is ready
21
+
10
22
  ## [1.7.1](https://github.com/quantaroute/checkout/compare/v1.7.0...v1.7.1) — 2026-07-06
11
23
 
12
24
  ### Fixed
@@ -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[];
@@ -294,6 +299,16 @@ export declare interface CheckoutWidgetProps {
294
299
  * Example: indiaBoundaryUrl="/geojson/india.geojson"
295
300
  */
296
301
  indiaBoundaryUrl?: string;
302
+ /**
303
+ * MapLibre style URL for the map step. Defaults to Carto Positron.
304
+ * Pass `OPENFREEMAP_POSITRON_STYLE_URL` when Carto basemaps require credentials.
305
+ */
306
+ mapStyle?: string;
307
+ /**
308
+ * How MapLibre GL JS is loaded on web. `external` waits for `window.maplibregl`
309
+ * when the host loads MapLibre from a CDN (e.g. Shopify theme extensions).
310
+ */
311
+ embedMode?: MapEmbedMode;
297
312
  /**
298
313
  * Show the smart search bar on the map step (default: true).
299
314
  * Supports address search (API) and DigiPin lookup (100% offline).
@@ -530,6 +545,9 @@ export declare interface CreatePaymentOrderResult {
530
545
  currency: string;
531
546
  }
532
547
 
548
+ /** Carto Positron — default basemap for standard web embeds. */
549
+ export declare const DEFAULT_MAP_STYLE_URL = "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json";
550
+
533
551
  /** Soft-delete a saved address. */
534
552
  export declare function deleteAddress(config: CheckoutApiConfig, sessionToken: string, addressId: string): Promise<void>;
535
553
 
@@ -614,6 +632,8 @@ export declare interface FunnelEventPayload {
614
632
  */
615
633
  export declare function getDigiPin(lat: number, lon: number): string;
616
634
 
635
+ export declare function getExternalMapRuntime(): MapRuntime | null;
636
+
617
637
  /**
618
638
  * Decode a DigiPin code back to center-point coordinates.
619
639
  * @throws if the DigiPin format is invalid
@@ -688,6 +708,19 @@ export declare function looksLikeDigiPin(input: string): boolean;
688
708
  */
689
709
  export declare function lookupLocation(lat: number, lng: number, apiKey: string, baseUrl?: string): Promise<LocationLookupResponse>;
690
710
 
711
+ /**
712
+ * How the host provides MapLibre GL JS.
713
+ * - `bundled`: import from `maplibre-gl` (default — Next.js, Vite apps with the peer installed)
714
+ * - `external`: read from `window.maplibregl` (CDN script loaded before the widget, e.g. Shopify)
715
+ */
716
+ export declare type MapEmbedMode = 'bundled' | 'external';
717
+
718
+ export { MapLibreMap }
719
+
720
+ export { MapLibreMarker }
721
+
722
+ export { MapMouseEvent }
723
+
691
724
  export declare const MapPinSelector: default_2.FC<MapPinSelectorProps>;
692
725
 
693
726
  export declare interface MapPinSelectorProps {
@@ -721,6 +754,24 @@ export declare interface MapPinSelectorProps {
721
754
  * Brand accent colour (hex, e.g. `#7c3aed`). Sets map pin, buttons, focus rings via `--qr-primary` on web.
722
755
  */
723
756
  brandColor?: string;
757
+ /**
758
+ * MapLibre style URL for the basemap. Defaults to Carto Positron.
759
+ * Use `OPENFREEMAP_POSITRON_STYLE_URL` when Carto credentials are unavailable.
760
+ */
761
+ mapStyle?: string;
762
+ /**
763
+ * How MapLibre GL JS is loaded on web. `bundled` imports the peer dependency;
764
+ * `external` waits for `window.maplibregl` (CDN script loaded by the host).
765
+ */
766
+ embedMode?: MapEmbedMode;
767
+ }
768
+
769
+ /** Subset of maplibre-gl used by the web MapPinSelector. */
770
+ export declare interface MapRuntime {
771
+ Map: new (options: ConstructorParameters<MapLibreMap>[0]) => MapLibreMap;
772
+ Marker: new (options?: ConstructorParameters<MapLibreMarker>[0]) => MapLibreMarker;
773
+ AttributionControl?: new (options?: ConstructorParameters<NonNullable<AttributionControl>>[0]) => AttributionControl;
774
+ NavigationControl?: new (options?: ConstructorParameters<NonNullable<NavigationControl>>[0]) => NavigationControl;
724
775
  }
725
776
 
726
777
  /**
@@ -745,6 +796,9 @@ export declare function notifyAddressCompleted(config: CheckoutApiConfig, sessio
745
796
  /** Signal explicit session abandonment (page exit). */
746
797
  export declare function notifySessionAbandoned(config: CheckoutApiConfig, sessionToken: string, lastStep: string): Promise<void>;
747
798
 
799
+ /** OpenFreeMap Positron — free, no API key (used when Carto credentials are unavailable). */
800
+ export declare const OPENFREEMAP_POSITRON_STYLE_URL = "https://tiles.openfreemap.org/styles/positron";
801
+
748
802
  export declare const OtpStep: default_2.FC<OtpStepProps>;
749
803
 
750
804
  export declare interface OtpStepProps {
@@ -1051,4 +1105,10 @@ export declare function verifyPayment(config: CheckoutApiConfig, sessionToken: s
1051
1105
  razorpay_payment_id: string;
1052
1106
  }>;
1053
1107
 
1108
+ /**
1109
+ * Poll `window.maplibregl` until available or timeout (for async CDN loads).
1110
+ * Returns a cancel function for useEffect cleanup.
1111
+ */
1112
+ export declare function waitForExternalMapRuntime(onReady: (runtime: MapRuntime) => void, onUnavailable: () => void, waitMs?: number, retryMs?: number): () => void;
1113
+
1054
1114
  export { }