@de./sdk-rn 1.0.1 → 1.0.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.
@@ -0,0 +1,7 @@
1
+ export type AccessOptions = {
2
+ env?: 'dev' | 'prod'
3
+ version?: number
4
+ workspace: string
5
+ accessToken: string
6
+ remoteOrigin?: string
7
+ }
@@ -0,0 +1,26 @@
1
+ export type AuthOptions = {
2
+ env?: 'dev' | 'prod'
3
+ version?: number
4
+ autorefresh?: boolean
5
+ }
6
+
7
+ export type AuthCredentials = {
8
+ workspace: string
9
+ remoteOrigin: string
10
+ cid: string
11
+ secret: string
12
+ }
13
+
14
+ export type SocketAuthCredentials = {
15
+ utype: string
16
+ id: string
17
+ remoteOrigin: string
18
+ accessToken: string
19
+ }
20
+
21
+ export type AuthRequestOptions = {
22
+ url: string
23
+ method: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE'
24
+ headers?: { [index: string]: string }
25
+ body?: any
26
+ }
@@ -0,0 +1,275 @@
1
+ export type HTTPRequestOptions = {
2
+ url: string
3
+ method: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE'
4
+ headers?: { [index: string]: string }
5
+ body?: any
6
+ }
7
+ export type HTTPResponse = {
8
+ error: boolean
9
+ message?: string
10
+ }
11
+
12
+ export type LngLat = [number, number]
13
+ export type Coordinates = {
14
+ lng: number
15
+ lat: number
16
+ }
17
+ export type PickedLocation = {
18
+ point: {
19
+ x: number,
20
+ y: number
21
+ }
22
+ coordinates: Coordinates
23
+ }
24
+ export type GPSLocation = Coordinates & {
25
+ heading?: number
26
+ }
27
+ export type ActivePosition = {
28
+ id: string
29
+ position: GPSLocation
30
+ caption?: Caption
31
+ }
32
+
33
+ /**
34
+ * Configuration options for AnimatedPolyline
35
+ */
36
+ export type AnimatedRouteNativePathType = 'dot' | 'solid'
37
+ export type AnimatedRouteNativeMethods = 'dot:flow'
38
+ | 'dot:fade'
39
+ | 'dot:pulse'
40
+ | 'dot:directional'
41
+ | 'solid:flow'
42
+ | 'solid:fade'
43
+ | 'solid:pulse'
44
+ | 'solid:directional'
45
+ export interface AnimatedRouteRules {
46
+ styles?: any;
47
+ speed?: number; // pixels per frame
48
+ fadeLength?: number; // length of fade effect in pixels
49
+ }
50
+ export interface AnimatedRoute {
51
+ key: number | null
52
+ currentOffset: number
53
+ rules: Required<AnimatedRouteRules>
54
+ startTime?: number;
55
+ polyline?: any
56
+ engine: any
57
+ path: Coordinates[]
58
+
59
+ /**
60
+ * Create the polyline
61
+ */
62
+ create( pathType?: AnimatedRouteNativePathType ): void;
63
+
64
+ /**
65
+ * Animation methods
66
+ */
67
+ apply: Record<string, () => void>;
68
+
69
+ /**
70
+ * Stop the current animation
71
+ */
72
+ stop(): void;
73
+
74
+ /**
75
+ * Remove the polyline from the map and stop animation
76
+ */
77
+ remove(): void;
78
+ }
79
+ export type AnimatedRouteOptions = AnimatedRouteNativeMethods | {
80
+ handler?: new (engine: Engine, path: Coordinates[], rules?: AnimatedRouteRules) => AnimatedRoute
81
+ method?: string
82
+ rules?: AnimatedRouteRules
83
+ }
84
+
85
+ export type Journey = {
86
+ routeId: string | number
87
+ origin?: MapWaypoint
88
+ destination?: MapWaypoint
89
+ waypoints?: MapWaypoint[]
90
+ options?: RouteOptions
91
+ }
92
+ export type ActiveDirection = {
93
+ routeId: string | number
94
+ profile: string
95
+ origin?: Coordinates
96
+ destination?: Coordinates
97
+ waypoints: Coordinates[]
98
+ route: any
99
+ }
100
+ export type RouteOptions = {
101
+ id?: string | number
102
+ mode?: 'default' | 'navigation'
103
+ profile?: 'driving-traffic' | 'driving' | 'cycling' | 'biking' | 'walking' | 'transit'
104
+ unit?: 'metric' | 'imperial',
105
+ preference?: 'TRAFFIC_AWARE' | 'TRAFFIC_UNAWARE'
106
+ pointless?: boolean
107
+ styles?: any
108
+ animation?: AnimatedRouteOptions
109
+ }
110
+
111
+ export type SearchPlace = {
112
+ name: string
113
+ location: Coordinates,
114
+ address: string
115
+ }
116
+
117
+ export type Waypoint = {
118
+ no: number
119
+ type: 'pickup' | 'dropoff'
120
+ description: string
121
+ coordinates: Coordinates
122
+ address?: string
123
+ contact: {
124
+ type: string
125
+ reference: string
126
+ phone?: string
127
+ email?: string
128
+ }
129
+ }
130
+ export type WaypointIndex = 'origin' | 'destination' | number
131
+ export type WaypointOptions = {
132
+ no?: number
133
+ type?: 'pickup' | 'dropoff'
134
+ description?: string
135
+ coordinates?: Coordinates
136
+ address?: string
137
+ 'contact.type'?: string
138
+ 'contact.reference'?: string
139
+ 'contact.phone'?: string
140
+ 'contact.email'?: string
141
+ }
142
+
143
+ export type Package = {
144
+ waypointNo: number
145
+ careLevel: number
146
+ category: string
147
+ weight: number
148
+ note?: string
149
+ }
150
+ export type PackageOptions = {
151
+ waypointNo?: number
152
+ careLevel?: number
153
+ category?: string
154
+ weight?: number
155
+ note?: string
156
+ }
157
+
158
+ export type PaymentMode = 'cash' | 'card' | 'momo' | 'wigo'
159
+ export type OrderService = {
160
+ fees: {
161
+ total: {
162
+ amount: number
163
+ currency: string
164
+ },
165
+ tax: number
166
+ discount: number
167
+ }
168
+ payment: {
169
+ mode: PaymentMode
170
+ paid: boolean
171
+ }
172
+ xpress: string
173
+ }
174
+ export type OrderServiceOptions = {
175
+ 'fees.total.amount'?: number
176
+ 'fees.total.currency'?: string
177
+ 'fees.tax'?: string
178
+ 'fees.discount'?: string
179
+ 'payment.mode'?: PaymentMode
180
+ 'payment.option'?: string
181
+ 'payment.paid'?: boolean
182
+ xpress?: string
183
+ }
184
+ export type OrderOperator = {}
185
+ export type OrderStage = {
186
+ current: string
187
+ status: string
188
+ }
189
+
190
+ export type Message = {
191
+ type: 'text' | 'location' | 'media'
192
+ sender: string
193
+ content: string
194
+ timestamp: string
195
+ }
196
+ export type Caption = {
197
+ duration?: number
198
+ unit?: string
199
+ label?: string
200
+ }
201
+ export type Peer = {
202
+ utype: string
203
+ id: string
204
+ }
205
+
206
+ export type MapOptions = {
207
+ element: string
208
+ accessToken: string
209
+ version?: number
210
+ env?: 'dev' | 'prod'
211
+ }
212
+ export type MapLayerStyle = 'streets' | 'outdoors' | 'light' | 'dark' | 'satellite'
213
+ export type MapWaypoint = {
214
+ index?: number
215
+ coords: Coordinates
216
+ caption?: Caption
217
+ }
218
+
219
+ export type Entity = {
220
+ id: string
221
+ status: 'ACTIVE' | 'BUSY'
222
+ grade: '1H' | '2H' | '3H'
223
+ currentLocation: GPSLocation
224
+ static?: boolean
225
+ type: 'moto' | 'car' | 'bike' | 'truck' | 'plane' | 'ship' | 'restaurant' | 'hotel' | 'store' | 'office' | 'warehouse'
226
+ }
227
+ export type EntitySpecs = {
228
+ id: string
229
+ status: 'ACTIVE' | 'BUSY'
230
+ grade: '1H' | '2H' | '3H'
231
+ currentLocation: GPSLocation
232
+ static?: boolean
233
+ type: 'moto' | 'car' | 'bike' | 'truck' | 'plane' | 'ship' | 'restaurant' | 'hotel' | 'store' | 'office' | 'warehouse'
234
+ }
235
+
236
+ export interface UserLocationOptions {
237
+ // Base point styling options
238
+ borderRadius?: number
239
+ borderColor?: string
240
+ borderOpacity?: number
241
+ dotColor?: string
242
+ showInnerDot?: boolean
243
+ noRing?: boolean
244
+
245
+ // User location specific options
246
+ showDirectionArrow?: boolean
247
+ arrowColor?: string
248
+ arrowSize?: number
249
+ pulseAnimation?: boolean
250
+ accuracyCircle?: boolean
251
+ accuracyColor?: string
252
+ accuracyOpacity?: number
253
+
254
+ // Callbacks
255
+ onLocationUpdate?: ( location: GPSLocation ) => void
256
+ onLocationError?: ( error: GeolocationPositionError ) => void
257
+ }
258
+ export type DragPickOptions = {
259
+ snapToRoad?: boolean
260
+ pinPoints?: boolean
261
+ pointOptions?: CustomPointOptions
262
+ }
263
+ export type DragPickContentType = 'duration' | 'distance' | 'preloader'
264
+ export type DragPickContent = {
265
+ time?: number
266
+ unit?: 'min' | 'sec' | 'hr' | 'km' | 'mi' | 'm'
267
+ distance?: number
268
+ preloader?: boolean
269
+ }
270
+ export type DragPickEvent = 'dragstart' | 'dragend' | 'zoom_changed' | 'idle'
271
+ export interface DragPickInterface {
272
+ enable( origin?: Coordinates ): void
273
+ disable(): void
274
+ content( type: DragPickContentType, content: DragPickContent ): void
275
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@de./sdk-rn",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Complete SDK pack for MSI React Native (Map Service Interface) and DClient services",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -12,14 +12,21 @@
12
12
  "exports": {
13
13
  ".": {
14
14
  "import": "./dist/index.js",
15
- "require": "./dist/index.js"
15
+ "require": "./dist/index.js",
16
+ "types": "./dist/index.d.ts"
17
+ },
18
+ "./types": {
19
+ "types": "./dist/types/index.d.ts",
20
+ "default": "./dist/types/index.d.ts"
16
21
  }
17
22
  },
18
23
  "author": "SCOREX Corporation",
19
24
  "private": false,
20
25
  "scripts": {
21
26
  "build:tsc": "rimraf ./dist && tsc",
22
- "compile": "yarn build:tsc",
27
+ "build:copy-types": "mkdir -p dist/types && cp -r src/types/* dist/types/",
28
+ "build": "yarn build:tsc && yarn build:copy-types",
29
+ "compile": "yarn build",
23
30
  "prepack": "yarn run compile",
24
31
  "test": "echo 'Error: No test specified' && exit 1",
25
32
  "test:msi": "yarn build:tsc && jest test/msi.test.js",