@de./sdk-rn 1.0.0 → 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.
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/access.d.ts +7 -0
- package/dist/types/auth.d.ts +26 -0
- package/dist/types/index.d.ts +275 -0
- package/package.json +10 -3
- package/src/index.ts +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Utils from './utils';
|
|
2
|
-
import MSI from './allend/MSI';
|
|
2
|
+
import MSI, { type MSIInterface, type MSIProps, type MSIRef } from './allend/MSI';
|
|
3
3
|
import Auth from './backend/Auth';
|
|
4
4
|
import Order from './allend/DClient/Order';
|
|
5
5
|
import Event from './allend/DClient/Event';
|
|
@@ -9,5 +9,5 @@ declare const DClient: {
|
|
|
9
9
|
Order: typeof Order;
|
|
10
10
|
Event: typeof Event;
|
|
11
11
|
};
|
|
12
|
-
export { Auth, MSI, Utils, DClient };
|
|
12
|
+
export { Auth, MSI, type MSIInterface, type MSIProps, type MSIRef, Utils, DClient };
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,GAAG,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,GAAG,EAAE,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAA;AACjF,OAAO,IAAI,MAAM,gBAAgB,CAAA;AACjC,OAAO,KAAK,MAAM,wBAAwB,CAAA;AAC1C,OAAO,KAAK,MAAM,wBAAwB,CAAA;AAC1C,OAAO,MAAM,MAAM,yBAAyB,CAAA;AAK5C,QAAA,MAAM,OAAO;;;;CAA2B,CAAA;AAExC,OAAO,EACL,IAAI,EACJ,GAAG,EACH,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,EACL,OAAO,EACR,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,GAAsD,MAAM,cAAc,CAAA;AACjF,OAAO,IAAI,MAAM,gBAAgB,CAAA;AACjC,OAAO,KAAK,MAAM,wBAAwB,CAAA;AAC1C,OAAO,KAAK,MAAM,wBAAwB,CAAA;AAC1C,OAAO,MAAM,MAAM,yBAAyB,CAAA;AAE5C,4BAA4B;AAC5B,0BAA0B;AAC1B,8BAA8B;AAC9B,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAExC,OAAO,EACL,IAAI,EACJ,GAAG,EAIH,KAAK,EACL,OAAO,EACR,CAAA"}
|
|
@@ -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.
|
|
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
|
-
"
|
|
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",
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Utils from './utils'
|
|
2
|
-
import MSI from './allend/MSI'
|
|
2
|
+
import MSI, { type MSIInterface, type MSIProps, type MSIRef } from './allend/MSI'
|
|
3
3
|
import Auth from './backend/Auth'
|
|
4
4
|
import Order from './allend/DClient/Order'
|
|
5
5
|
import Event from './allend/DClient/Event'
|
|
@@ -13,6 +13,9 @@ const DClient = { Client, Order, Event }
|
|
|
13
13
|
export {
|
|
14
14
|
Auth,
|
|
15
15
|
MSI,
|
|
16
|
+
type MSIInterface,
|
|
17
|
+
type MSIProps,
|
|
18
|
+
type MSIRef,
|
|
16
19
|
Utils,
|
|
17
20
|
DClient
|
|
18
21
|
}
|