@road-labs/map-sdk 0.0.28-rc.6 → 0.0.28-rc.7

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/README.md CHANGED
@@ -30,10 +30,9 @@ The `App` component accepts the following props:
30
30
  | :-------------------------- | :------- | :--------- | :------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------- |
31
31
  | `height` | Yes | Both | Both | Height of the map container in pixels. | `-` |
32
32
  | `gestureHandling` | Yes | Both | Both | Google Maps SDK parameter controlling how gestures (scroll, pinch, etc.) interact with the map. Allowed values: `greedy`, `cooperative`, `none`, `auto`. We suggest a default value of `greedy`. | `-` |
33
- | `authorization` | Yes | v2 | Both | The public authorization key to search for locations. | `-` |
34
- | `context` | Yes | Both | Both | Context type for the map. Allowed values: `"cpo"` or `"msp"`. | `-` |
33
+ | `authorization` | Yes | v2 | Both | The public map key. Besides granting access it decides what kind of map this is: its remote configuration carries the context (`cpo` or `msp`), the operators, publishing modes and Google Maps key. The context is never passed as a prop. On `cpo` maps the widget uses the `/1/map/cpo/*` endpoints, draws locations individually while the view holds at most 1000 of them, and colours pins and filters by the OCPP status the station reports (Faulted red, Unavailable amber, in-session blue, Available green, no report grey, a fault outranking everything else on a pin). `msp` maps keep the clustering, filters and colours the mobile apps use. | `-` |
35
34
  | `version` | No | Both | Both | Which version of the map SDK do you wish to use. | `v1` |
36
- | `language` | No | Both | Both | Language of the widget. Supported values: `en`. If nothing is set, it will use the browser language. | Browser language |
35
+ | `language` | No | Both | Both | Language of the widget. Supported values: `en`, `nl`, `de`, `fr`, `it`, `es` and their regional variants (e.g. `nl-NL`, `de-AT`), matched case-insensitively. Unsupported values fall back to `en`. If nothing is set, the browser language is used. | Browser language |
37
36
  | `position {lat,lng}` | No | Both | Both | Initial latitude/longitude to center the map on load. If not provided, defaults to visitor's IP-based location. | Visitor IP location |
38
37
  | `useBrowserLocation` | No | Both | Both | Use the browser location to center the map. | `false` |
39
38
  | `enableZoomControls` | No | Both | Both | Whether to display zoom (+/-) controls in the bottom-right corner. | `false` |
@@ -41,7 +40,7 @@ The `App` component accepts the following props:
41
40
  | `enablePlacesSearch` | No | Both | Both | Enables address search input at the top of the map. | `true` |
42
41
  | `locationId` | No | Both | Both | If provided, the map will zoom to the given `locationId` and open its sidebar (if enabled). Overrides `position`. | `-` |
43
42
  | `locationBaseUrl` | No | Both | Both | Base URL for location data. When set, the location name links to `locationBaseUrl/{locationId}`. | `-` |
44
- | `locationUrlTemplate` | No | v2 | cpo | URL template that makes the location name in the details view a clickable link, opening in a new tab. The `{{locationId}}` placeholder is replaced with the location id (e.g. `https://example.com/loc/{{locationId}}/details`). Applies only when `context` is `cpo`. Takes precedence over `locationBaseUrl`. | `-` |
43
+ | `locationUrlTemplate` | No | v2 | cpo | URL template that makes the location name in the details view a clickable link, opening in a new tab. The `{{locationId}}` placeholder is replaced with the location id (e.g. `https://example.com/loc/{{locationId}}/details`). Applies only when the map key's context is `cpo`. Takes precedence over `locationBaseUrl`. | `-` |
45
44
  | `apiRoot` | No | Both | Both | The root URL of the API. | `-` |
46
45
  | `googleApiKey` | No | Both | Both | Google Maps API key. If not provided, you can set your own Google API key. | `-` |
47
46
  | `theming {}` | No | Both | Both | Controls widget look and feel with keys: `brandColor`, `backgroundColor`, `textColor`, `borderColor`, `fontFamily`. Accepts HEX values (e.g. `#ff3d00`). If `backgroundColor` is provided without `shadowRoot`, a shadow root will be automatically created. | `-` |
@@ -49,11 +48,10 @@ The `App` component accepts the following props:
49
48
  | `sdkRoot` | No | Both | Both | Root URL for SDK CSS file. Required when using automatic shadow root creation with theming (when `theming` is provided without `shadowRoot`). The stylesheet will be loaded from `sdkRoot + "/styles.css"`. | `-` |
50
49
  | `limitToLocationIds` | No | v2 | Both | Constrains the map to only show the locations with the configured IDs. Provided that they exist in the dataset. | All available locations |
51
50
  | `preferredOperators` | No | v2 | Both | Array of operator names. Ensures that the selected operators appear at the top of the operator selector dropdown. | `[]` |
52
- | `operators` | No | v2 | Both | Array of available operators. | `-` |
53
- | `publishingMode` | No | v2 | Both | Array of available publishing modes. Allowed values: `"PUBLISHING_MODE_PUBLIC"`, `"PUBLISHING_MODE_PRIVATE"`. | `-` |
54
51
  | `showNoAdditionalFeeFilter` | No | v2 | msp | Used to configure whether we enable the user to filter out stations that come with additional fees. | `false` |
55
52
  | `showPublishingModeFilter` | No | v2 | cpo | Used to configure whether we enable the user to filter out public or private stations. | `false` |
56
53
  | `showOperatorOnly` | No | v2 | both | String value representing the operator name. Include a quick filter option to find a specific operator. | `-` |
54
+ | `showAnalytics` | No | v2 | Both | Shows status pills next to the filter toggle for the current view and filters: EVSEs by roaming status, and on `cpo` maps a second pill with connectors by the OCPP status the station reports. Clicking a status toggles the matching status filter (the OCPP pill on `cpo` maps, the roaming pill on `msp` maps) and the selected statuses are highlighted; the roaming pill on a `cpo` map is read-only because the CPO search filters on OCPP status. The counts ignore the status selection so every status in the view stays listed; all other filters apply. Fetched from `/1/map/analytics` (`/1/map/cpo/analytics` on `cpo` maps) whenever the view or filters change. Hidden on screens narrower than 768px. | `false` |
57
55
  | `onMarkerClicked` | No | Both | Both | Callback function that is called when a marker is clicked. Receives an object with `ids` property containing the location IDs. | `-` |
58
56
 
59
57
  ### Example
@@ -70,7 +68,6 @@ function MyMap() {
70
68
  <App
71
69
  height={600}
72
70
  authorization="your-authorization-key"
73
- context="cpo"
74
71
  gestureHandling="greedy"
75
72
  apiRoot="https://api.road.io"
76
73
  googleApiKey="your-google-maps-api-key"
@@ -85,7 +82,7 @@ function MyMap() {
85
82
  }
86
83
  ```
87
84
 
88
- **Note**: The `height`, `gestureHandling`, `authorization`, and `context` props are required. All other props are optional.
85
+ **Note**: The `height`, `gestureHandling` and `authorization` props are required. All other props are optional. The map context (`cpo` or `msp`) is not a prop; it comes from the map key's remote configuration.
89
86
 
90
87
  ### Theming with Shadow DOM
91
88
 
@@ -110,7 +107,6 @@ If you don't need custom theming, you can use the SDK without Shadow DOM (simply
110
107
  <App
111
108
  height={600}
112
109
  authorization="your-authorization-key"
113
- context="cpo"
114
110
  gestureHandling="greedy"
115
111
  apiRoot="https://api.road.io"
116
112
  // ... other props
@@ -0,0 +1 @@
1
+ export default function AnalyticsOverlay(): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,11 @@
1
1
  import { default as React } from 'react';
2
- import { GeohashItem } from '../../types';
2
+ import { GeohashItem, MapKind } from '../../types';
3
3
  interface Props {
4
4
  data: GeohashItem;
5
5
  map?: google.maps.Map;
6
6
  onClick: (payload: GeohashItem) => void;
7
7
  highlight?: boolean;
8
+ kind?: MapKind;
8
9
  }
9
10
  declare const CustomMarker: React.FC<Props>;
10
11
  export default CustomMarker;
@@ -1,6 +1,12 @@
1
1
  import { default as React } from 'react';
2
2
  import { LabelsType } from '../i18n';
3
- import { Location, Position, RoadMapOptions, Status, FilterConfiguration } from '../types';
3
+ import { Analytics, Location, MapKind, Position, RoadMapOptions, Status, FilterConfiguration } from '../types';
4
+ export type SearchBounds = {
5
+ nwLat: number;
6
+ nwLng: number;
7
+ seLat: number;
8
+ seLng: number;
9
+ };
4
10
  export type MapContextType = {
5
11
  t: (key: keyof LabelsType, props?: any) => string;
6
12
  isReady: boolean;
@@ -11,6 +17,15 @@ export type MapContextType = {
11
17
  precision: any;
12
18
  bbox: any;
13
19
  }) => Promise<any>;
20
+ fetchAnalytics?: (args: {
21
+ bbox: SearchBounds;
22
+ [filter: string]: any;
23
+ }) => Promise<{
24
+ data: Analytics;
25
+ }>;
26
+ searchBounds?: SearchBounds;
27
+ setSearchBounds?: (bounds: SearchBounds) => void;
28
+ mapKind: MapKind;
14
29
  fetchLocations?: ({ ids }: {
15
30
  ids: any;
16
31
  }) => Promise<any>;
package/dist/i18n.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare function getLanguage(lng: any): "nl" | "en" | "de" | "fr" | "it" | "es";
1
+ export declare function getLanguage(lng?: string): "nl" | "en" | "de" | "fr" | "it" | "es";
2
2
  export type LabelsType = {
3
3
  "search.placeholder": string;
4
4
  "cdrPrice.flatFee": string;
@@ -48,6 +48,15 @@ export type LabelsType = {
48
48
  "filters.clearAll": string;
49
49
  "filters.onlyShow": string;
50
50
  "filters.statusHeading": string;
51
+ "evse.statusBlocked": string;
52
+ "evse.statusClosed": string;
53
+ "ocpp.statusPreparing": string;
54
+ "ocpp.statusSuspendedEvse": string;
55
+ "ocpp.statusSuspendedEv": string;
56
+ "ocpp.statusFinishing": string;
57
+ "ocpp.statusFaulted": string;
58
+ "analytics.roaming": string;
59
+ "analytics.ocpp": string;
51
60
  "filters.chargingAccessibility": string;
52
61
  "filters.accessibilityAll": string;
53
62
  "filters.accessibilityTesla": string;