@road-labs/map-sdk 0.0.16 → 0.0.17-rc.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.
@@ -1,6 +1,7 @@
1
1
  import { default as React } from 'react';
2
+ import { CurrentLocation } from '../../types';
2
3
  interface Props {
3
- currentLocation: any;
4
+ currentLocation: CurrentLocation;
4
5
  setView(view: string, args?: any): void;
5
6
  }
6
7
  declare const LocationDetailsV2: React.FC<Props>;
@@ -1,38 +1,7 @@
1
1
  import { default as React } from 'react';
2
- import { CdrAdditionalCharge, Tariff } from '../../../types';
3
- export declare function transformTariff(tariff: {
4
- currency: string;
5
- id: string;
6
- externalTariffId: string;
7
- origin: {
8
- countryCode: string;
9
- partyId: string;
10
- connectionId: string;
11
- networkId: string;
12
- };
13
- tariffElements: {
14
- restrictions?: {
15
- startTime: string;
16
- endTime: string;
17
- startDate: string;
18
- endDate: string;
19
- dayOfWeek: string[];
20
- };
21
- priceComponents: {
22
- type: string;
23
- price: string;
24
- stepSize: number;
25
- vatPercentage: number;
26
- }[];
27
- }[];
28
- }): Tariff;
2
+ import { CdrAdditionalCharge, OcpiTariff, Tariff } from '../../../types';
3
+ export declare function transformTariff(tariff: OcpiTariff): Tariff;
29
4
  interface Props {
30
- origin: {
31
- connectionId: string;
32
- networkId: string;
33
- countryCode: string;
34
- partyId: string;
35
- };
36
5
  tariff: any;
37
6
  additionalCharges: CdrAdditionalCharge[];
38
7
  }
package/dist/types.d.ts CHANGED
@@ -76,13 +76,34 @@ export type GeohashItem = {
76
76
  ];
77
77
  count: number;
78
78
  };
79
+ export type OcpiPriceComponent = {
80
+ type: "FLAT" | "TIME" | "ENERGY" | "PARKING_TIME";
81
+ price: number;
82
+ vat?: number;
83
+ step_size: number;
84
+ };
79
85
  export type PriceComponent = {
80
86
  type: "FLAT" | "TIME" | "ENERGY" | "PARKING_TIME";
81
87
  price: number;
82
88
  vat?: number;
83
- stepSize?: number;
84
89
  };
85
90
  export type DayOfWeek = "MONDAY" | "TUESDAY" | "WEDNESDAY" | "THURSDAY" | "FRIDAY" | "SATURDAY" | "SUNDAY";
91
+ export type OcpiTariffRestrictions = {
92
+ start_time?: string;
93
+ end_time?: string;
94
+ start_date?: string;
95
+ end_date?: string;
96
+ min_kwh?: number;
97
+ max_kwh?: number;
98
+ min_current?: number;
99
+ max_current?: number;
100
+ min_power?: number;
101
+ max_power?: number;
102
+ min_duration?: number;
103
+ max_duration?: number;
104
+ day_of_week?: DayOfWeek[];
105
+ reservation?: "RESERVATION" | "RESERVATION_EXPIRES";
106
+ };
86
107
  export type TariffRestrictions = {
87
108
  startTime?: string;
88
109
  endTime?: string;
@@ -96,11 +117,56 @@ export type PriceElement = {
96
117
  type: "PRICE_COMPONENT" | "FEE";
97
118
  price: number;
98
119
  };
120
+ export type OcpiTariffElement = {
121
+ price_components: OcpiPriceComponent[];
122
+ restrictions?: OcpiTariffRestrictions;
123
+ };
99
124
  export type TariffElement = {
100
125
  priceComponents: PriceComponent[];
101
126
  restrictions?: TariffRestrictions;
102
127
  };
128
+ export type OcpiPrice = {
129
+ excl_vat: number;
130
+ incl_vat: number;
131
+ };
132
+ export type EnergySourceCategory = "NUCLEAR" | "GENERAL_FOSSIL" | "COAL" | "GAS" | "GENERAL_GREEN" | "SOLAR" | "WIND" | "WATER";
133
+ export type EnvironmentalImpactCategory = "CARBON_DIOXIDE" | "NUCLEAR_WASTE";
134
+ export type OcpiEnergySource = {
135
+ source: EnergySourceCategory;
136
+ percentage: number;
137
+ };
138
+ export type OcpiEnvironmentalImpact = {
139
+ category: EnvironmentalImpactCategory;
140
+ amount: number;
141
+ };
142
+ export type OcpiEnergyMix = {
143
+ is_green_energy: boolean;
144
+ energy_sources?: OcpiEnergySource[];
145
+ environ_impact?: OcpiEnvironmentalImpact[];
146
+ supplier_name?: string;
147
+ energy_product_name?: string;
148
+ };
149
+ export type OcpiTariffType = "AD_HOC_PAYMENT" | "PROFILE_CHEAP" | "PROFILE_FAST" | "PROFILE_GREEN" | "REGULAR";
150
+ export type OcpiTariff = {
151
+ country_code: string;
152
+ party_id: string;
153
+ id: string;
154
+ currency: string;
155
+ type?: OcpiTariffType;
156
+ tariff_alt_text?: OcpiDisplayText[];
157
+ tariff_alt_url?: string;
158
+ min_price?: OcpiPrice;
159
+ max_price?: OcpiPrice;
160
+ elements: OcpiTariffElement[];
161
+ start_date_time?: string;
162
+ end_date_time?: string;
163
+ energy_mix?: OcpiEnergyMix;
164
+ last_updated: string;
165
+ };
103
166
  export type Tariff = {
167
+ id: string;
168
+ country_code: string;
169
+ party_id: string;
104
170
  currency: string;
105
171
  elements: TariffElement[];
106
172
  };
@@ -111,6 +177,165 @@ export type CdrAdditionalCharge = {
111
177
  vat?: number;
112
178
  type: "FLAT_FEE";
113
179
  };
180
+ export type OcpiLocationType = "ON_STREET" | "PARKING_GARAGE" | "UNDERGROUND_GARAGE" | "PARKING_LOT" | "OTHER" | "UNKNOWN" | "REST_AREA" | "PARKING_TYPE_UNKNOWN";
181
+ export type OcpiConnectorPowerType = "CONNECTOR_POWER_TYPE_UNSPECIFIED" | "CONNECTOR_POWER_TYPE_AC_1_PHASE" | "CONNECTOR_POWER_TYPE_AC_2_PHASE" | "CONNECTOR_POWER_TYPE_AC_2_PHASE_SPLIT" | "CONNECTOR_POWER_TYPE_AC_3_PHASE" | "CONNECTOR_POWER_TYPE_DC" | "CONNECTOR_POWER_TYPE_AC";
182
+ export type OcpiConnectorStandardType = "IEC_62196_T1" | "IEC_62196_T1_COMBO" | "IEC_62196_T2" | "IEC_62196_T2_COMBO" | "IEC_62196_T3A" | "IEC_62196_T3C" | "CHADEMO" | "DOMESTIC_F" | "DOMESTIC_E" | "DOMESTIC_B" | "CATARC";
183
+ export type OcpiConnector = {
184
+ id: string;
185
+ standard?: OcpiConnectorStandardType;
186
+ connectorStandardType?: OcpiConnectorStandardType;
187
+ format?: string;
188
+ powerType?: OcpiConnectorPowerType;
189
+ connectorPowerType?: OcpiConnectorPowerType;
190
+ voltage?: number;
191
+ amperage?: number;
192
+ tariff_ids?: string[];
193
+ power?: {
194
+ maxWatts: number;
195
+ maxVoltage: number;
196
+ maxAmperage: number;
197
+ };
198
+ };
199
+ export type OcpiEvseStatus = "AVAILABLE" | "BLOCKED" | "CHARGING" | "INOPERATIVE" | "OUTOFORDER" | "PLANNED" | "REMOVED" | "RESERVED" | "UNKNOWN" | "EVSE_STATUS_AVAILABLE" | "EVSE_STATUS_CHARGING" | "EVSE_STATUS_UNAVAILABLE" | "EVSE_STATUS_ERROR";
200
+ export type OcpiEvse = {
201
+ uid?: string;
202
+ evse_id?: string;
203
+ status?: OcpiEvseStatus;
204
+ connectors: OcpiConnector[];
205
+ capabilities?: string[];
206
+ floor_level?: string;
207
+ physical_reference?: string;
208
+ coordinates?: {
209
+ latitude: string;
210
+ longitude: string;
211
+ };
212
+ directions?: Array<{
213
+ language: string;
214
+ text: string;
215
+ }>;
216
+ parking_restrictions?: string[];
217
+ images?: Array<{
218
+ url: string;
219
+ thumbnail?: string;
220
+ category: string;
221
+ type: string;
222
+ width?: number;
223
+ height?: number;
224
+ }>;
225
+ last_updated: string;
226
+ };
227
+ export type OcpiLocationOrigin = {
228
+ connectionId: string;
229
+ networkId: string;
230
+ countryCode: string;
231
+ partyId: string;
232
+ };
233
+ export type OcpiDisplayText = {
234
+ language: string;
235
+ text: string;
236
+ };
237
+ export type OcpiSuboperator = {
238
+ name: string;
239
+ website?: string;
240
+ logo?: {
241
+ url: string;
242
+ thumbnail?: string;
243
+ category: string;
244
+ type: string;
245
+ width?: number;
246
+ height?: number;
247
+ };
248
+ };
249
+ export type OcpiLocation = {
250
+ tariffs?: Tariff[];
251
+ country_code: string;
252
+ party_id: string;
253
+ id: string;
254
+ publish: boolean;
255
+ publish_allowed_to?: Array<{
256
+ uid: string;
257
+ type: string;
258
+ }>;
259
+ name: string;
260
+ address: string;
261
+ city: string;
262
+ postal_code?: string;
263
+ state?: string;
264
+ country: string;
265
+ coordinates: {
266
+ latitude: string;
267
+ longitude: string;
268
+ };
269
+ related_locations?: Array<{
270
+ latitude: string;
271
+ longitude: string;
272
+ name?: OcpiDisplayText;
273
+ }>;
274
+ parking_type?: OcpiLocationType;
275
+ parkingType?: OcpiLocationType;
276
+ evses: OcpiEvse[];
277
+ directions?: Array<OcpiDisplayText>;
278
+ operator?: {
279
+ name: string;
280
+ website?: string;
281
+ logo?: {
282
+ url: string;
283
+ thumbnail?: string;
284
+ category: string;
285
+ type: string;
286
+ width?: number;
287
+ height?: number;
288
+ };
289
+ };
290
+ suboperator?: OcpiSuboperator;
291
+ subOperator?: OcpiSuboperator;
292
+ operator_name?: string;
293
+ operatorName?: string;
294
+ suboperator_name?: string;
295
+ suboperatorName?: string;
296
+ opening_times?: {
297
+ twentyfourseven: boolean;
298
+ regular_hours?: Array<{
299
+ weekday: number;
300
+ period_begin: string;
301
+ period_end: string;
302
+ }>;
303
+ exceptional_openings?: Array<{
304
+ period_begin: string;
305
+ period_end: string;
306
+ }>;
307
+ exceptional_closings?: Array<{
308
+ period_begin: string;
309
+ period_end: string;
310
+ }>;
311
+ };
312
+ charging_when_closed?: boolean;
313
+ images?: Array<{
314
+ url: string;
315
+ thumbnail?: string;
316
+ category: string;
317
+ type: string;
318
+ width?: number;
319
+ height?: number;
320
+ }>;
321
+ energy_mix?: {
322
+ is_green_energy: boolean;
323
+ energy_sources?: Array<{
324
+ source: string;
325
+ percentage: number;
326
+ }>;
327
+ environ_impact?: Array<{
328
+ category: string;
329
+ amount: number;
330
+ unit: string;
331
+ }>;
332
+ supplier_name?: string;
333
+ energy_product_name?: string;
334
+ };
335
+ last_updated: string;
336
+ cdrAdditionalCharges?: CdrAdditionalCharge[];
337
+ };
338
+ export type CurrentLocation = OcpiLocation;
114
339
  export type Location = {
115
340
  evses: any[];
116
341
  id: string;
@@ -1,2 +1,2 @@
1
- import { Location } from '../types';
2
- export declare function getNotes(t: any, location: Location, type: "dynamic" | "scheduled" | "base" | "none"): any[];
1
+ import { Location, OcpiLocation } from '../types';
2
+ export declare function getNotes(t: any, location: Location | OcpiLocation, type: "dynamic" | "scheduled" | "base" | "none"): any[];
@@ -1,4 +1,4 @@
1
- import { TariffElement, DayOfWeek, PriceComponent } from '../types';
1
+ import { TariffElement, DayOfWeek, PriceComponent, OcpiTariff, OcpiTariffElement } from '../types';
2
2
  export declare function convertTimeToMinutes(time: string): number;
3
3
  type Timeslot = {
4
4
  isActive?: boolean;
@@ -9,6 +9,7 @@ type Timeslot = {
9
9
  priceComponents: PriceComponent[];
10
10
  };
11
11
  export declare function getScheduleItems(items: Timeslot[], isDayActive: boolean, now: Date): Timeslot[];
12
+ export declare function isBaseTariffOCPI(tariffElement: OcpiTariffElement): boolean;
12
13
  export declare function isBaseTarif(tariffElement: TariffElement): boolean;
13
14
  type DynamicTariff = {
14
15
  date: Date;
@@ -19,6 +20,7 @@ type getDynamicTariffProps = {
19
20
  limit?: number;
20
21
  now: Date;
21
22
  };
23
+ export declare function getDynamicTariffOCPI(elements: OcpiTariffElement[], limit?: number, now?: Date): DynamicTariff[];
22
24
  export declare function getDynamicTariff({ elements, limit, now, }: getDynamicTariffProps): DynamicTariff[];
23
25
  export declare function getScheduledTariff(elements: TariffElement[], locationTimezone: string): {
24
26
  MONDAY: any[];
@@ -35,7 +37,7 @@ type Schedule = {
35
37
  items: Timeslot[];
36
38
  };
37
39
  export declare function getSchedule(elements: TariffElement[], locationTimezone: any, now: any): Schedule[];
38
- export declare function getConnectorTariffTypeV2(tariff: any): "none" | "base" | "dynamic" | "scheduled";
40
+ export declare function getConnectorTariffTypeV2(tariff: OcpiTariff): "none" | "base" | "dynamic" | "scheduled";
39
41
  export declare function getConnectorTariffType(connectorTarif: any): "none" | "base" | "dynamic" | "scheduled";
40
42
  export declare const ConnectorPowerType: {
41
43
  readonly CONNECTOR_POWER_TYPE_UNSPECIFIED: "CONNECTOR_POWER_TYPE_UNSPECIFIED";
@@ -18,8 +18,9 @@ export declare function _fetchTariffs(apiRoot: any, version: any, authorization:
18
18
  origin: any;
19
19
  ids: any;
20
20
  }): Promise<any>;
21
- export declare function _fetchLocations(apiRoot: any, version: any, authorization: any, { ids }: {
21
+ export declare function _fetchLocations(apiRoot: any, version: any, authorization: any, { ids, status }: {
22
22
  ids: any;
23
+ status: any;
23
24
  }): Promise<any>;
24
25
  export declare function loadRemoteConfig(apiRoot: string, version: string, authorization: string): Promise<RemoteConfig>;
25
26
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@road-labs/map-sdk",
3
- "version": "0.0.16",
3
+ "version": "0.0.17-rc.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",