@road-labs/map-sdk 0.0.27 → 0.0.28-rc.10

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/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  type PublishingMode = "PUBLISHING_MODE_PUBLIC" | "PUBLISHING_MODE_PRIVATE";
2
+ export type MapKind = "roaming" | "cpo";
2
3
  export type FilterConfiguration = {
3
4
  showOperatorOnly?: string;
4
5
  preferredOperators: string[];
@@ -6,7 +7,35 @@ export type FilterConfiguration = {
6
7
  showPublishingModeFilter?: boolean;
7
8
  publishingMode?: PublishingMode[];
8
9
  showVehicleAvailabilityFilter?: boolean;
10
+ showSearchPhraseFilter?: boolean;
11
+ showExcludeOperatorFilter?: boolean;
12
+ showPaymentMethodFilter?: boolean;
9
13
  operators?: string[];
14
+ showAnalytics?: boolean;
15
+ showPriceFilter?: boolean;
16
+ };
17
+ export type EnergyPrice = {
18
+ amount: number;
19
+ currency: string;
20
+ };
21
+ export type AnalyticsBucket = {
22
+ name: string;
23
+ count: number;
24
+ };
25
+ export type Analytics = {
26
+ context: "cpo" | "msp";
27
+ locations: {
28
+ total: number;
29
+ };
30
+ evses: {
31
+ total: number;
32
+ byStatus?: AnalyticsBucket[];
33
+ };
34
+ connectors: {
35
+ total: number;
36
+ byPowerType: AnalyticsBucket[];
37
+ byOcppStatus?: AnalyticsBucket[];
38
+ };
10
39
  };
11
40
  export type RoadMapOptions = {
12
41
  gestureHandling: string;
@@ -15,13 +44,16 @@ export type RoadMapOptions = {
15
44
  enableZoomControls?: boolean;
16
45
  height: number;
17
46
  position?: Position;
47
+ zoomLevel?: number;
18
48
  useBrowserLocation?: boolean;
19
49
  sdkRoot?: string;
20
50
  apiRoot?: string;
21
51
  googleApiKey?: string;
22
52
  locationId?: string;
23
53
  locationBaseUrl?: string;
24
- version?: "v1" | "v2";
54
+ locationUrlTemplate?: string;
55
+ version?: "v1" | "v2" | "v3";
56
+ currency?: string;
25
57
  authorization: string;
26
58
  language?: string;
27
59
  shadowRoot?: any;
@@ -33,7 +65,12 @@ export type RoadMapOptions = {
33
65
  fontFamily: string;
34
66
  };
35
67
  limitToLocationIds?: string[];
36
- context: "cpo" | "msp";
68
+ infraProviderId?: string;
69
+ partyId?: string;
70
+ partyIds?: string[];
71
+ evseId?: string;
72
+ from?: string;
73
+ to?: string;
37
74
  onMarkerClicked?: ({ ids }: {
38
75
  ids: any;
39
76
  }) => {};
@@ -70,13 +107,12 @@ export type GeohashItem = {
70
107
  lat: number;
71
108
  lon: number;
72
109
  };
73
- statuses: [
74
- {
75
- name: string;
76
- count: number;
77
- }
78
- ];
110
+ statuses: Array<{
111
+ name: string;
112
+ count: number;
113
+ }>;
79
114
  count: number;
115
+ energyPrice?: EnergyPrice;
80
116
  };
81
117
  export type OcpiPriceComponent = {
82
118
  type: "FLAT" | "TIME" | "ENERGY" | "PARKING_TIME" | "CONGESTION_TIME";
@@ -253,6 +289,7 @@ export type OcpiLocation = {
253
289
  country_code: string;
254
290
  party_id: string;
255
291
  id: string;
292
+ externalId?: string;
256
293
  publish: boolean;
257
294
  publish_allowed_to?: Array<{
258
295
  uid: string;
@@ -0,0 +1,2 @@
1
+ import { GeohashItem } from '../types';
2
+ export declare function mergeBuckets(existing: GeohashItem[], incoming: GeohashItem[]): GeohashItem[];
@@ -0,0 +1 @@
1
+ export {};
@@ -9,5 +9,9 @@ export declare const defaultFilter: {
9
9
  powerType: any;
10
10
  operatorOnly: string;
11
11
  remoteStartStop: boolean;
12
+ searchPhrase: string;
13
+ excludeOperator: any[];
14
+ authMethodCapabilities: any[];
15
+ maxEnergyPrice: any;
12
16
  };
13
17
  export declare function hasFilters(filter: any): boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -17,4 +17,4 @@ export declare function getSocketText(connector: any): string;
17
17
  export declare function formatConnectorStandard(value: any): any;
18
18
  export declare function getStatusLabel(t: MapContextType["t"], status: any): string;
19
19
  export declare function getLocationLabel(t: MapContextType["t"], location: any): string;
20
- export declare function getStatusColorFromEvses(evses?: any[]): "#33AC19" | "#005CEE" | "#EB001B";
20
+ export declare function getStatusColorFromEvses(evses?: any[]): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- export declare function getColorForStatus(status: any): "#33AC19" | "#005CEE" | "#EB001B";
1
+ export declare function getColorForStatus(status: any): string;
@@ -16,6 +16,8 @@ export type OpeningTimes = {
16
16
  };
17
17
  type Translate = (key: keyof LabelsType, args?: Record<string, string>) => string;
18
18
  export declare function getWeekdayLabel(t: Translate, weekday: number): string;
19
+ export declare function getWeekdayFullLabel(language: string, weekday: number): string;
20
+ export declare function getTodayWeekday(now?: Date): number;
19
21
  export declare function groupRegularHoursByWeekday(regularHours: RegularHours[] | undefined): Record<number, RegularHours[]>;
20
22
  export declare function formatPeriod(begin: string, end: string): string;
21
23
  export type OpenStatus = {
@@ -23,9 +25,11 @@ export type OpenStatus = {
23
25
  nextChange?: {
24
26
  time: string;
25
27
  label: "opens" | "closes";
28
+ day?: number;
26
29
  };
27
30
  };
28
31
  export declare function isOpenNow(openingTimes: OpeningTimes | undefined, now?: Date): OpenStatus;
29
32
  export declare function getFutureExceptionalPeriods(periods: ExceptionalPeriod[] | undefined, now?: Date): ExceptionalPeriod[];
30
- export declare function formatExceptionalRange(p: ExceptionalPeriod): string;
33
+ export declare function formatExceptionalDate(language: string, dateStr: string): string;
34
+ export declare function formatExceptionalTime(p: ExceptionalPeriod): string;
31
35
  export {};
@@ -0,0 +1,43 @@
1
+ import { EnergyPrice, GeohashItem, MapKind } from '../types';
2
+ export type PinTone = "available" | "inUse" | "offline" | "fault" | "planned" | "unknown";
3
+ export type PinGlyph = "bolt" | "ratio" | "dash" | "plus" | "alert";
4
+ export type PinColours = {
5
+ ring: string;
6
+ text: string;
7
+ };
8
+ export type PinSlice = {
9
+ tone: PinTone;
10
+ ring: string;
11
+ fraction: number;
12
+ };
13
+ export type PinState = {
14
+ tone: PinTone;
15
+ colours: PinColours;
16
+ glyph: PinGlyph;
17
+ free: number;
18
+ total: number;
19
+ split: PinSlice[];
20
+ };
21
+ export type UnitCounts = {
22
+ free: number;
23
+ busy: number;
24
+ fault: number;
25
+ planned: number;
26
+ unknown: number;
27
+ offline: number;
28
+ total: number;
29
+ };
30
+ export declare function countUnits(statuses?: Array<{
31
+ name: string;
32
+ count: number;
33
+ }>): UnitCounts;
34
+ export declare function pinTone(counts: UnitCounts, kind: MapKind, cluster: boolean): PinTone;
35
+ export declare function pinGlyph(counts: UnitCounts, tone: PinTone): PinGlyph;
36
+ export declare function pinColours(tone: PinTone, kind: MapKind): PinColours;
37
+ export declare function pinSplit(counts: UnitCounts, kind: MapKind): PinSlice[];
38
+ export declare function describePin(statuses: Array<{
39
+ name: string;
40
+ count: number;
41
+ }> | undefined, kind?: MapKind, cluster?: boolean): PinState;
42
+ export declare function isCluster(data: Pick<GeohashItem, "count" | "ids">): boolean;
43
+ export declare function pinPrice(data: GeohashItem): EnergyPrice | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { EnergyPrice } from '../types';
2
+ export declare function usablePrice(price?: EnergyPrice): price is EnergyPrice;
3
+ export declare function formatEnergyPrice(language: string, price?: EnergyPrice): string | undefined;
4
+ export type PriceTick = {
5
+ value: number | undefined;
6
+ label: string;
7
+ };
8
+ export declare function priceTicks(language: string, currency: string, anyLabel: string): PriceTick[];
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { RemoteConfig } from '../types';
1
+ import { Analytics, MapKind, RemoteConfig } from '../types';
2
2
  type RequestOptionsType = {
3
3
  method?: string;
4
4
  body?: string;
@@ -9,11 +9,27 @@ type RequestOptionsType = {
9
9
  };
10
10
  };
11
11
  export declare function request(url: string, options?: RequestOptionsType): Promise<any>;
12
- export declare function _fetchGeohashes(apiRoot: any, version: any, authorization: any, limitToLocationIds: any, { precision, bbox, ...props }: {
12
+ export declare function buildSearchBody(limitToLocationIds: string[], props: Record<string, any>): {
13
+ chargingAccessibility: any;
14
+ searchPhrase: any;
15
+ excludeOperator: any;
16
+ authMethodCapabilities: any;
17
+ currency: any;
18
+ maxEnergyPrice: {
19
+ amount: number;
20
+ currency: any;
21
+ };
22
+ operator?: any[];
23
+ locationIds: string[];
24
+ };
25
+ export declare function mapSearchPath(apiRoot: string, kind: MapKind, endpoint: "search" | "analytics"): string;
26
+ export declare function _fetchGeohashes(apiRoot: any, version: any, authorization: any, limitToLocationIds: any, { precision, ...props }: {
13
27
  [x: string]: any;
14
28
  precision: any;
15
- bbox: any;
16
- }): Promise<any>;
29
+ }, kind?: MapKind): Promise<any>;
30
+ export declare function _fetchAnalytics(apiRoot: any, version: any, authorization: any, limitToLocationIds: any, props: any, kind?: MapKind): Promise<{
31
+ data: Analytics;
32
+ }>;
17
33
  export declare function _fetchTariffs(apiRoot: any, version: any, authorization: any, { origin, ids }: {
18
34
  origin: any;
19
35
  ids: any;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import { LabelsType } from '../i18n';
2
+ import { MapKind } from '../types';
3
+ export declare function normaliseStatus(status?: string): string;
4
+ export type Palette = {
5
+ green: string;
6
+ blue: string;
7
+ red: string;
8
+ amber: string;
9
+ grey: string;
10
+ };
11
+ export declare const classicPalette: Palette;
12
+ export declare const modernPalette: Palette;
13
+ export declare function paletteFor(version?: string): Palette;
14
+ export declare const inSessionStatuses: Set<string>;
15
+ export type StatusTone = "available" | "inSession" | "fault" | "unavailable" | "unknown" | "offline";
16
+ export declare function statusTone(status?: string, kind?: MapKind): StatusTone;
17
+ export declare function toneColour(tone: StatusTone, kind?: MapKind, version?: string): string;
18
+ export declare function getStatusColor(status?: string, kind?: MapKind, version?: string): string;
19
+ export declare function getStatusLabelKey(status?: string): keyof LabelsType;
20
+ export declare function pickMarkerColor(statuses?: Array<{
21
+ name: string;
22
+ count: number;
23
+ }>, kind?: MapKind, version?: string): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { LabelsType } from '../i18n';
2
+ import { MapKind } from '../types';
3
+ export type StatusFilterOption = {
4
+ id: string;
5
+ labelKey: keyof LabelsType;
6
+ values: string[];
7
+ color: string;
8
+ };
9
+ export declare function getStatusFilterOptions(kind?: MapKind, version?: string): StatusFilterOption[];
10
+ export declare function toggleOption(action: "remove" | "add", existing: string[], values: string[]): string[];
11
+ export declare function findStatusFilterOption(kind: MapKind | undefined, status: string): StatusFilterOption | undefined;
12
+ export declare function isStatusFilterActive(kind: MapKind | undefined, selected: string[], status: string): boolean;
13
+ export declare function toggleStatusFilter(kind: MapKind | undefined, selected: string[], status: string): string[] | undefined;
14
+ export declare function withoutStatusFilter(filters: Record<string, any> | undefined): Record<string, any>;
15
+ export declare function statusForLocations(kind: MapKind | undefined, status: string[] | undefined): string[] | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export type MapVersion = "v1" | "v2" | "v3";
2
+ export declare function versionRank(version?: string): number;
3
+ export declare function atLeast(version: string | undefined, min: MapVersion): boolean;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@road-labs/map-sdk",
3
- "version": "0.0.27",
3
+ "version": "0.0.28-rc.10",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",