react-native-altibbi 0.1.0 → 0.1.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/README.md +220 -60
- package/package.json +2 -3
- package/src/connection.ts +160 -64
- package/src/data.ts +7 -1
- package/src/index.tsx +27 -6
- package/src/service.ts +7 -8
- package/src/types.ts +178 -15
- package/lib/commonjs/connection.js +0 -200
- package/lib/commonjs/connection.js.map +0 -1
- package/lib/commonjs/data.js +0 -12
- package/lib/commonjs/data.js.map +0 -1
- package/lib/commonjs/index.js +0 -275
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/scoket.js +0 -245
- package/lib/commonjs/scoket.js.map +0 -1
- package/lib/commonjs/service.js +0 -21
- package/lib/commonjs/service.js.map +0 -1
- package/lib/commonjs/types.js +0 -2
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/video/OT.js +0 -57
- package/lib/commonjs/video/OT.js.map +0 -1
- package/lib/commonjs/video/OTError.js +0 -17
- package/lib/commonjs/video/OTError.js.map +0 -1
- package/lib/commonjs/video/OTPublisher.js +0 -171
- package/lib/commonjs/video/OTPublisher.js.map +0 -1
- package/lib/commonjs/video/OTSession.js +0 -205
- package/lib/commonjs/video/OTSession.js.map +0 -1
- package/lib/commonjs/video/OTSubscriber.js +0 -185
- package/lib/commonjs/video/OTSubscriber.js.map +0 -1
- package/lib/commonjs/video/contexts/OTContext.js +0 -11
- package/lib/commonjs/video/contexts/OTContext.js.map +0 -1
- package/lib/commonjs/video/helpers/OTHelper.js +0 -92
- package/lib/commonjs/video/helpers/OTHelper.js.map +0 -1
- package/lib/commonjs/video/helpers/OTPublisherHelper.js +0 -117
- package/lib/commonjs/video/helpers/OTPublisherHelper.js.map +0 -1
- package/lib/commonjs/video/helpers/OTSessionHelper.js +0 -206
- package/lib/commonjs/video/helpers/OTSessionHelper.js.map +0 -1
- package/lib/commonjs/video/helpers/OTSubscriberHelper.js +0 -121
- package/lib/commonjs/video/helpers/OTSubscriberHelper.js.map +0 -1
- package/lib/commonjs/video/index.js +0 -42
- package/lib/commonjs/video/index.js.map +0 -1
- package/lib/commonjs/video/views/OTPublisherView.js +0 -26
- package/lib/commonjs/video/views/OTPublisherView.js.map +0 -1
- package/lib/commonjs/video/views/OTSubscriberView.js +0 -25
- package/lib/commonjs/video/views/OTSubscriberView.js.map +0 -1
- package/lib/module/connection.js +0 -180
- package/lib/module/connection.js.map +0 -1
- package/lib/module/data.js +0 -6
- package/lib/module/data.js.map +0 -1
- package/lib/module/index.js +0 -12
- package/lib/module/index.js.map +0 -1
- package/lib/module/scoket.js +0 -235
- package/lib/module/scoket.js.map +0 -1
- package/lib/module/service.js +0 -14
- package/lib/module/service.js.map +0 -1
- package/lib/module/types.js +0 -2
- package/lib/module/types.js.map +0 -1
- package/lib/module/video/OT.js +0 -49
- package/lib/module/video/OT.js.map +0 -1
- package/lib/module/video/OTError.js +0 -10
- package/lib/module/video/OTError.js.map +0 -1
- package/lib/module/video/OTPublisher.js +0 -162
- package/lib/module/video/OTPublisher.js.map +0 -1
- package/lib/module/video/OTSession.js +0 -195
- package/lib/module/video/OTSession.js.map +0 -1
- package/lib/module/video/OTSubscriber.js +0 -175
- package/lib/module/video/OTSubscriber.js.map +0 -1
- package/lib/module/video/contexts/OTContext.js +0 -4
- package/lib/module/video/contexts/OTContext.js.map +0 -1
- package/lib/module/video/helpers/OTHelper.js +0 -82
- package/lib/module/video/helpers/OTHelper.js.map +0 -1
- package/lib/module/video/helpers/OTPublisherHelper.js +0 -110
- package/lib/module/video/helpers/OTPublisherHelper.js.map +0 -1
- package/lib/module/video/helpers/OTSessionHelper.js +0 -195
- package/lib/module/video/helpers/OTSessionHelper.js.map +0 -1
- package/lib/module/video/helpers/OTSubscriberHelper.js +0 -112
- package/lib/module/video/helpers/OTSubscriberHelper.js.map +0 -1
- package/lib/module/video/index.js +0 -7
- package/lib/module/video/index.js.map +0 -1
- package/lib/module/video/views/OTPublisherView.js +0 -18
- package/lib/module/video/views/OTPublisherView.js.map +0 -1
- package/lib/module/video/views/OTSubscriberView.js +0 -17
- package/lib/module/video/views/OTSubscriberView.js.map +0 -1
- package/lib/typescript/src/connection.d.ts +0 -40
- package/lib/typescript/src/connection.d.ts.map +0 -1
- package/lib/typescript/src/data.d.ts +0 -7
- package/lib/typescript/src/data.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts +0 -12
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/scoket.d.ts +0 -100
- package/lib/typescript/src/scoket.d.ts.map +0 -1
- package/lib/typescript/src/service.d.ts +0 -9
- package/lib/typescript/src/service.d.ts.map +0 -1
- package/lib/typescript/src/types.d.ts +0 -22
- package/lib/typescript/src/types.d.ts.map +0 -1
package/src/connection.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TBIConstants } from './service';
|
|
2
|
-
import { UserType } from './types';
|
|
2
|
+
import { ConsultationType, MediaType, ResponseType, UserType } from './types';
|
|
3
3
|
|
|
4
4
|
interface MethodsObject {
|
|
5
5
|
get: string;
|
|
@@ -11,10 +11,27 @@ interface MethodsObject {
|
|
|
11
11
|
interface ConsultationObject {
|
|
12
12
|
question: string;
|
|
13
13
|
medium: string;
|
|
14
|
-
|
|
14
|
+
user_id: number;
|
|
15
15
|
mediaIds?: string[];
|
|
16
16
|
followUpId?: string;
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
interface RequestParamsInterface {
|
|
20
|
+
method: string;
|
|
21
|
+
data?: Record<any, any>;
|
|
22
|
+
endPoint: string;
|
|
23
|
+
path?: string;
|
|
24
|
+
type?: string;
|
|
25
|
+
fileName?: string;
|
|
26
|
+
download?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface RequestInterface {
|
|
30
|
+
method: string;
|
|
31
|
+
headers: Record<string, string>;
|
|
32
|
+
body: string | FormData | undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
18
35
|
export const Methods: MethodsObject = {
|
|
19
36
|
get: 'GET',
|
|
20
37
|
post: 'POST',
|
|
@@ -38,22 +55,6 @@ const fetchData = (
|
|
|
38
55
|
throw Error(`Fetch Error : ${e}`);
|
|
39
56
|
});
|
|
40
57
|
|
|
41
|
-
interface RequestParamsInterface {
|
|
42
|
-
method: string;
|
|
43
|
-
data?: Record<any, any>;
|
|
44
|
-
endPoint: string;
|
|
45
|
-
path?: string;
|
|
46
|
-
type?: string;
|
|
47
|
-
fileName?: string;
|
|
48
|
-
download?: boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
interface RequestInterface {
|
|
52
|
-
method: string;
|
|
53
|
-
headers: Record<string, string>;
|
|
54
|
-
body: string | FormData | undefined;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
58
|
export const request = async ({
|
|
58
59
|
method,
|
|
59
60
|
data,
|
|
@@ -63,9 +64,9 @@ export const request = async ({
|
|
|
63
64
|
fileName,
|
|
64
65
|
download,
|
|
65
66
|
}: RequestParamsInterface) => {
|
|
66
|
-
if (!TBIConstants.
|
|
67
|
+
if (!TBIConstants.baseURL) {
|
|
67
68
|
return {
|
|
68
|
-
message: 'Add your
|
|
69
|
+
message: 'Add your baseURL to Init',
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -75,7 +76,7 @@ export const request = async ({
|
|
|
75
76
|
'accept-language': TBIConstants.language,
|
|
76
77
|
};
|
|
77
78
|
|
|
78
|
-
let url = `${TBIConstants.
|
|
79
|
+
let url = `${TBIConstants.baseURL}/v1/${endPoint}`;
|
|
79
80
|
let body;
|
|
80
81
|
if (method === Methods.get) {
|
|
81
82
|
url = url + '?' + new URLSearchParams(data).toString();
|
|
@@ -114,81 +115,138 @@ export const request = async ({
|
|
|
114
115
|
};
|
|
115
116
|
};
|
|
116
117
|
|
|
117
|
-
export const getUser = (
|
|
118
|
-
|
|
118
|
+
export const getUser = async (
|
|
119
|
+
user_id: string
|
|
120
|
+
): Promise<ResponseType<UserType>> => {
|
|
121
|
+
const response: ResponseType<UserType> = await request({
|
|
119
122
|
method: Methods.get,
|
|
120
123
|
data: {},
|
|
121
|
-
endPoint: `users/${
|
|
124
|
+
endPoint: `users/${user_id}`,
|
|
122
125
|
});
|
|
126
|
+
if (response.status === 200) {
|
|
127
|
+
return response;
|
|
128
|
+
}
|
|
129
|
+
throw Error(JSON.stringify(response));
|
|
130
|
+
};
|
|
123
131
|
|
|
124
|
-
export const getUsers = (
|
|
125
|
-
|
|
132
|
+
export const getUsers = async (
|
|
133
|
+
page: number = 1,
|
|
134
|
+
perPage: number = 20
|
|
135
|
+
): Promise<ResponseType<UserType[]>> => {
|
|
136
|
+
const response: ResponseType<UserType[]> = await request({
|
|
126
137
|
method: Methods.get,
|
|
127
138
|
data: { page, 'per-page': perPage },
|
|
128
139
|
endPoint: `users`,
|
|
129
140
|
});
|
|
141
|
+
if (response.status === 200) {
|
|
142
|
+
return response;
|
|
143
|
+
}
|
|
144
|
+
throw Error(JSON.stringify(response));
|
|
145
|
+
};
|
|
130
146
|
|
|
131
|
-
export const createUser = (
|
|
132
|
-
|
|
147
|
+
export const createUser = async (
|
|
148
|
+
user: UserType
|
|
149
|
+
): Promise<ResponseType<UserType>> => {
|
|
150
|
+
const response: ResponseType<UserType> = await request({
|
|
133
151
|
method: Methods.post,
|
|
134
152
|
data: user,
|
|
135
153
|
endPoint: `users`,
|
|
136
154
|
});
|
|
137
|
-
|
|
138
|
-
|
|
155
|
+
if (response.status === 201) {
|
|
156
|
+
return response;
|
|
157
|
+
}
|
|
158
|
+
throw Error(JSON.stringify(response));
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const updateUser = async (
|
|
162
|
+
user: UserType,
|
|
163
|
+
user_id: string
|
|
164
|
+
): Promise<ResponseType<UserType>> => {
|
|
165
|
+
const response: ResponseType<UserType> = await request({
|
|
139
166
|
method: Methods.put,
|
|
140
167
|
data: user,
|
|
141
|
-
endPoint: `users/${
|
|
168
|
+
endPoint: `users/${user_id}`,
|
|
142
169
|
});
|
|
170
|
+
if (response.status === 201) {
|
|
171
|
+
return response;
|
|
172
|
+
}
|
|
173
|
+
throw Error(JSON.stringify(response));
|
|
174
|
+
};
|
|
143
175
|
|
|
144
|
-
export const deleteUser = (
|
|
145
|
-
|
|
176
|
+
export const deleteUser = async (
|
|
177
|
+
user_id: string
|
|
178
|
+
): Promise<ResponseType<string>> => {
|
|
179
|
+
const response: ResponseType<string> = await request({
|
|
146
180
|
method: Methods.delete,
|
|
147
181
|
data: {},
|
|
148
|
-
endPoint: `users/${
|
|
182
|
+
endPoint: `users/${user_id}`,
|
|
149
183
|
});
|
|
184
|
+
if (response.status === 204) {
|
|
185
|
+
return response;
|
|
186
|
+
}
|
|
187
|
+
throw Error(JSON.stringify(response));
|
|
188
|
+
};
|
|
150
189
|
|
|
151
190
|
export const createConsultation = async ({
|
|
152
191
|
question,
|
|
153
192
|
medium,
|
|
154
|
-
|
|
193
|
+
user_id,
|
|
155
194
|
mediaIds,
|
|
156
195
|
followUpId,
|
|
157
|
-
}: ConsultationObject) => {
|
|
158
|
-
if (!question || !medium || !
|
|
159
|
-
|
|
196
|
+
}: ConsultationObject): Promise<ResponseType<ConsultationType>> => {
|
|
197
|
+
if (!question || !medium || !user_id) {
|
|
198
|
+
throw Error('missing field');
|
|
160
199
|
}
|
|
161
200
|
|
|
162
201
|
const data = {
|
|
163
202
|
question,
|
|
164
203
|
medium,
|
|
165
|
-
user_id
|
|
204
|
+
user_id,
|
|
166
205
|
media_ids: mediaIds,
|
|
167
206
|
expand:
|
|
168
207
|
'pusherAppKey,parentConsultation,consultations,user,media,pusherChannel,' +
|
|
169
208
|
'chatConfig,chatHistory,voipConfig,videoConfig,recommendation',
|
|
170
209
|
followUpId,
|
|
171
210
|
};
|
|
172
|
-
|
|
211
|
+
const response: ResponseType<ConsultationType> = await request({
|
|
173
212
|
method: Methods.post,
|
|
174
213
|
data,
|
|
175
214
|
endPoint: `consultations`,
|
|
176
215
|
});
|
|
216
|
+
|
|
217
|
+
if (response.status === 201) {
|
|
218
|
+
return response;
|
|
219
|
+
}
|
|
220
|
+
throw Error(JSON.stringify(response));
|
|
177
221
|
};
|
|
178
222
|
|
|
179
|
-
export const getConsultationInfo = (
|
|
180
|
-
|
|
223
|
+
export const getConsultationInfo = async (
|
|
224
|
+
consultation_id: number
|
|
225
|
+
): Promise<ResponseType<ConsultationType>> => {
|
|
226
|
+
const response: ResponseType<ConsultationType> = await request({
|
|
181
227
|
method: Methods.get,
|
|
182
228
|
data: {
|
|
183
229
|
expand:
|
|
184
230
|
'pusherAppKey,parentConsultation,consultations,user,media,pusherChannel,' +
|
|
185
231
|
'chatConfig,chatHistory,voipConfig,videoConfig,recommendation',
|
|
186
232
|
},
|
|
187
|
-
endPoint: `consultations/${
|
|
233
|
+
endPoint: `consultations/${consultation_id}`,
|
|
188
234
|
});
|
|
235
|
+
if (response.status === 200) {
|
|
236
|
+
response.data.socketParams = {
|
|
237
|
+
apiKey: response?.data?.[0]?.pusherAppKey,
|
|
238
|
+
cluster: 'eu',
|
|
239
|
+
authEndpoint: `${TBIConstants.baseURL}/v1/auth/pusher?access-token=${TBIConstants.token}`,
|
|
240
|
+
};
|
|
241
|
+
return response;
|
|
242
|
+
}
|
|
243
|
+
throw Error(JSON.stringify(response));
|
|
244
|
+
};
|
|
189
245
|
|
|
190
|
-
export const getLastConsultation = ()
|
|
191
|
-
|
|
246
|
+
export const getLastConsultation = async (): Promise<
|
|
247
|
+
ResponseType<ConsultationType[]>
|
|
248
|
+
> => {
|
|
249
|
+
const response: ResponseType<ConsultationType[]> = await request({
|
|
192
250
|
method: Methods.get,
|
|
193
251
|
data: {
|
|
194
252
|
'per-page': 1,
|
|
@@ -199,46 +257,79 @@ export const getLastConsultation = () =>
|
|
|
199
257
|
},
|
|
200
258
|
endPoint: `consultations`,
|
|
201
259
|
});
|
|
260
|
+
if (response.status === 200) {
|
|
261
|
+
response.data[0].socketParams = {
|
|
262
|
+
apiKey: response.data[0].pusherAppKey,
|
|
263
|
+
cluster: 'eu',
|
|
264
|
+
authEndpoint: `${TBIConstants.baseURL}/v1/auth/pusher?access-token=${TBIConstants.token}`,
|
|
265
|
+
};
|
|
266
|
+
return response;
|
|
267
|
+
}
|
|
268
|
+
throw Error(JSON.stringify(response));
|
|
269
|
+
};
|
|
202
270
|
|
|
203
271
|
export const getConsultationList = async (
|
|
204
|
-
|
|
272
|
+
user_id: number,
|
|
205
273
|
page: number = 1,
|
|
206
274
|
perPage = 20
|
|
207
|
-
) => {
|
|
208
|
-
if (!
|
|
209
|
-
|
|
275
|
+
): Promise<ResponseType<ConsultationType[]>> => {
|
|
276
|
+
if (!user_id) {
|
|
277
|
+
throw Error('missing user id');
|
|
210
278
|
}
|
|
211
279
|
|
|
212
|
-
|
|
280
|
+
const response = await request({
|
|
213
281
|
method: Methods.get,
|
|
214
282
|
data: {
|
|
215
283
|
page,
|
|
216
284
|
'per-page': perPage,
|
|
217
|
-
'filter[user_id]':
|
|
285
|
+
'filter[user_id]': user_id,
|
|
218
286
|
'expand':
|
|
219
287
|
'pusherAppKey,parentConsultation,consultations,user,media,pusherChannel,' +
|
|
220
288
|
'chatConfig,chatHistory,voipConfig,videoConfig,recommendation',
|
|
221
289
|
},
|
|
222
290
|
endPoint: `consultations`,
|
|
223
291
|
});
|
|
292
|
+
if (response.status === 200) {
|
|
293
|
+
return response;
|
|
294
|
+
}
|
|
295
|
+
throw Error(JSON.stringify(response));
|
|
224
296
|
};
|
|
225
297
|
|
|
226
|
-
export const deleteConsultation = (
|
|
227
|
-
|
|
298
|
+
export const deleteConsultation = async (
|
|
299
|
+
consultation_id: number
|
|
300
|
+
): Promise<ResponseType<string>> => {
|
|
301
|
+
const response: ResponseType<string> = await request({
|
|
228
302
|
method: Methods.delete,
|
|
229
303
|
data: {},
|
|
230
|
-
endPoint: `consultations/${
|
|
304
|
+
endPoint: `consultations/${consultation_id}`,
|
|
231
305
|
});
|
|
306
|
+
if (response.status === 204) {
|
|
307
|
+
return response;
|
|
308
|
+
}
|
|
309
|
+
throw Error(JSON.stringify(response));
|
|
310
|
+
};
|
|
232
311
|
|
|
233
|
-
export const cancelConsultation = (
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
312
|
+
export const cancelConsultation = async (
|
|
313
|
+
consultation_id: number
|
|
314
|
+
): Promise<ResponseType<{ consultation_id: number; status: string }>> => {
|
|
315
|
+
const response: ResponseType<{ consultation_id: number; status: string }> =
|
|
316
|
+
await request({
|
|
317
|
+
method: Methods.post,
|
|
318
|
+
data: {},
|
|
319
|
+
endPoint: `consultations/${consultation_id}/cancel`,
|
|
320
|
+
});
|
|
321
|
+
if (response.status === 200) {
|
|
322
|
+
return response;
|
|
323
|
+
}
|
|
324
|
+
throw Error(JSON.stringify(response));
|
|
325
|
+
};
|
|
239
326
|
|
|
240
|
-
export const uploadMedia = (
|
|
241
|
-
|
|
327
|
+
export const uploadMedia = async (
|
|
328
|
+
path: string,
|
|
329
|
+
type: string,
|
|
330
|
+
fileName: string
|
|
331
|
+
): Promise<ResponseType<MediaType>> => {
|
|
332
|
+
const response: ResponseType<MediaType> = await request({
|
|
242
333
|
method: Methods.post,
|
|
243
334
|
endPoint: `media`,
|
|
244
335
|
data: {},
|
|
@@ -246,10 +337,15 @@ export const uploadMedia = (path: string, type: string, fileName: string) =>
|
|
|
246
337
|
type,
|
|
247
338
|
fileName,
|
|
248
339
|
});
|
|
340
|
+
if (response.status === 200) {
|
|
341
|
+
return response;
|
|
342
|
+
}
|
|
343
|
+
throw Error(JSON.stringify(response));
|
|
344
|
+
};
|
|
249
345
|
|
|
250
|
-
export const getPrescription = (
|
|
346
|
+
export const getPrescription = (consultation_id: number) =>
|
|
251
347
|
request({
|
|
252
348
|
method: Methods.get,
|
|
253
|
-
endPoint: `consultations/${
|
|
349
|
+
endPoint: `consultations/${consultation_id}/download-prescription`,
|
|
254
350
|
download: true,
|
|
255
351
|
});
|
package/src/data.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BloodType,
|
|
3
|
+
BoolString,
|
|
4
|
+
GenderType,
|
|
5
|
+
MaritalStatus,
|
|
6
|
+
MediumType,
|
|
7
|
+
} from './types';
|
|
2
8
|
|
|
3
9
|
export const materialStatusArray: MaritalStatus[] = [
|
|
4
10
|
'single',
|
package/src/index.tsx
CHANGED
|
@@ -63,13 +63,32 @@ export {
|
|
|
63
63
|
type TBISocketAuthorizerResult,
|
|
64
64
|
} from './scoket';
|
|
65
65
|
|
|
66
|
-
export {
|
|
66
|
+
export type {
|
|
67
|
+
ResponseType,
|
|
68
|
+
MediumType,
|
|
69
|
+
BloodType,
|
|
70
|
+
MaritalStatus,
|
|
71
|
+
BoolString,
|
|
72
|
+
GenderType,
|
|
67
73
|
UserType,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
MediaType,
|
|
75
|
+
ChatData,
|
|
76
|
+
ChatHistory,
|
|
77
|
+
ChatConfig,
|
|
78
|
+
VoipConfig,
|
|
79
|
+
Recommendation,
|
|
80
|
+
RecommendationData,
|
|
81
|
+
RecommendationLab,
|
|
82
|
+
RecommendationLabItem,
|
|
83
|
+
RecommendationDrug,
|
|
84
|
+
RecommendationFdaDrug,
|
|
85
|
+
RecommendationICD10,
|
|
86
|
+
RecommendationSymptom,
|
|
87
|
+
RecommendationDiagnosis,
|
|
88
|
+
RecommendationFollowUp,
|
|
89
|
+
RecommendationDoctorReferral,
|
|
90
|
+
RecommendationPostCallAnswer,
|
|
91
|
+
ConsultationType,
|
|
73
92
|
} from './types';
|
|
74
93
|
export {
|
|
75
94
|
materialStatusArray,
|
|
@@ -78,3 +97,5 @@ export {
|
|
|
78
97
|
genderTypeArray,
|
|
79
98
|
MediumArray,
|
|
80
99
|
} from './data';
|
|
100
|
+
|
|
101
|
+
|
package/src/service.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
interface ConstantObject {
|
|
2
|
-
domain: string;
|
|
3
|
-
language: string;
|
|
4
2
|
token: string;
|
|
3
|
+
baseURL: string;
|
|
4
|
+
language: string;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export let TBIConstants: ConstantObject = {
|
|
8
|
-
domain: '',
|
|
9
|
-
language: 'ar',
|
|
10
8
|
token: '',
|
|
9
|
+
baseURL: '',
|
|
10
|
+
language: 'ar',
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export const init = (
|
|
14
|
-
console.log("init", domain, language, token);
|
|
13
|
+
export const init = (token: string, baseURL: string, language: string) => {
|
|
15
14
|
TBIConstants = {
|
|
16
|
-
domain,
|
|
17
|
-
language,
|
|
18
15
|
token,
|
|
16
|
+
baseURL,
|
|
17
|
+
language,
|
|
19
18
|
};
|
|
20
19
|
};
|
package/src/types.ts
CHANGED
|
@@ -1,22 +1,185 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
type MediumType = 'chat' | 'gsm' | 'voip' | 'video';
|
|
2
|
+
type BloodType = 'A+' | 'B+' | 'AB+' | 'O+' | 'A-' | 'B-' | 'AB-' | 'O-';
|
|
3
|
+
type MaritalStatus = 'single' | 'married' | 'divorced' | 'widow';
|
|
4
|
+
type BoolString = 'yes' | 'no';
|
|
5
|
+
type GenderType = 'male' | 'female';
|
|
6
|
+
interface UserType {
|
|
7
|
+
id?: number;
|
|
8
|
+
name?: string;
|
|
9
|
+
phone_number?: string;
|
|
9
10
|
email?: string;
|
|
10
|
-
|
|
11
|
+
date_of_birth?: string;
|
|
11
12
|
gender?: GenderType;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
insurance_id?: string;
|
|
14
|
+
policy_number?: string;
|
|
15
|
+
nationality_number?: string;
|
|
15
16
|
height?: string;
|
|
16
17
|
weight?: string;
|
|
17
|
-
|
|
18
|
+
blood_type?: BloodType;
|
|
18
19
|
smoker?: BoolString;
|
|
19
20
|
alcoholic?: BoolString;
|
|
20
|
-
|
|
21
|
+
marital_status?: MaritalStatus;
|
|
22
|
+
created_at?: string;
|
|
23
|
+
updated_at?: string;
|
|
24
|
+
}
|
|
25
|
+
interface MediaType {
|
|
26
|
+
id?: string;
|
|
27
|
+
type?: string;
|
|
28
|
+
name?: string;
|
|
29
|
+
path?: string;
|
|
30
|
+
extension?: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
size?: number;
|
|
33
|
+
}
|
|
34
|
+
interface SocketParams {
|
|
35
|
+
apiKey?: string;
|
|
36
|
+
cluster?: string;
|
|
37
|
+
authEndpoint?: string;
|
|
38
|
+
}
|
|
39
|
+
interface ResponseType<T> {
|
|
40
|
+
status: number;
|
|
41
|
+
data: T;
|
|
42
|
+
}
|
|
43
|
+
interface ChatData {
|
|
44
|
+
id?: string;
|
|
45
|
+
message?: string;
|
|
46
|
+
sent_at?: string;
|
|
47
|
+
chat_user_id?: string;
|
|
48
|
+
}
|
|
49
|
+
interface ChatHistory {
|
|
50
|
+
id?: number;
|
|
51
|
+
consultation_id?: number;
|
|
52
|
+
data?: ChatData[];
|
|
53
|
+
created_at?: string;
|
|
54
|
+
updated_at?: string;
|
|
55
|
+
}
|
|
56
|
+
interface ChatConfig {
|
|
57
|
+
id?: number;
|
|
58
|
+
consultation_id?: number;
|
|
59
|
+
group_id?: String;
|
|
60
|
+
chat_user_id?: String;
|
|
61
|
+
app_id?: String;
|
|
62
|
+
chat_user_token?: String;
|
|
63
|
+
}
|
|
64
|
+
interface VoipConfig {
|
|
65
|
+
id?: number;
|
|
66
|
+
consultation_id?: number;
|
|
67
|
+
apiKey?: string;
|
|
68
|
+
callId?: string;
|
|
69
|
+
token?: string;
|
|
70
|
+
}
|
|
71
|
+
interface Recommendation {
|
|
72
|
+
id?: number;
|
|
73
|
+
consultation_id?: number;
|
|
74
|
+
data?: RecommendationData;
|
|
75
|
+
created_at?: string;
|
|
76
|
+
updated_at?: string;
|
|
77
|
+
}
|
|
78
|
+
interface RecommendationData {
|
|
79
|
+
lab?: RecommendationLab;
|
|
80
|
+
drug?: RecommendationDrug;
|
|
81
|
+
icd10?: RecommendationICD10;
|
|
82
|
+
followUp?: RecommendationFollowUp[] | null;
|
|
83
|
+
doctorReferral?: RecommendationDoctorReferral;
|
|
84
|
+
postCallAnswer?: RecommendationPostCallAnswer[] | null;
|
|
85
|
+
}
|
|
86
|
+
interface RecommendationLab {
|
|
87
|
+
lab?: RecommendationLabItem[] | null;
|
|
88
|
+
panel?: RecommendationLabItem[] | null;
|
|
89
|
+
}
|
|
90
|
+
interface RecommendationLabItem {
|
|
91
|
+
name?: string;
|
|
92
|
+
}
|
|
93
|
+
interface RecommendationDrug {
|
|
94
|
+
fdaDrug?: RecommendationFdaDrug[] | null;
|
|
95
|
+
}
|
|
96
|
+
interface RecommendationFdaDrug {
|
|
97
|
+
name?: string;
|
|
98
|
+
dosage?: string;
|
|
99
|
+
duration?: number;
|
|
100
|
+
howToUse?: string;
|
|
101
|
+
frequency?: string;
|
|
102
|
+
tradeName?: string;
|
|
103
|
+
dosageForm?: string;
|
|
104
|
+
dosageUnit?: string;
|
|
105
|
+
packageSize?: string;
|
|
106
|
+
packageType?: string;
|
|
107
|
+
strengthValue?: string;
|
|
108
|
+
relationWithFood?: string;
|
|
109
|
+
specialInstructions?: string;
|
|
110
|
+
routeOfAdministration?: string;
|
|
111
|
+
}
|
|
112
|
+
interface RecommendationICD10 {
|
|
113
|
+
symptom?: RecommendationSymptom[] | null;
|
|
114
|
+
diagnosis?: RecommendationDiagnosis[] | null;
|
|
115
|
+
}
|
|
116
|
+
interface RecommendationSymptom {
|
|
117
|
+
code?: string;
|
|
118
|
+
name?: string;
|
|
119
|
+
}
|
|
120
|
+
interface RecommendationDiagnosis {
|
|
121
|
+
code?: string;
|
|
122
|
+
name?: string;
|
|
123
|
+
}
|
|
124
|
+
interface RecommendationFollowUp {
|
|
125
|
+
name?: string;
|
|
126
|
+
}
|
|
127
|
+
interface RecommendationDoctorReferral {
|
|
128
|
+
name?: string;
|
|
129
|
+
}
|
|
130
|
+
interface RecommendationPostCallAnswer {
|
|
131
|
+
answer?: string;
|
|
132
|
+
question?: string;
|
|
133
|
+
}
|
|
134
|
+
interface ConsultationType {
|
|
135
|
+
id?: number;
|
|
136
|
+
userId?: number;
|
|
137
|
+
question?: string;
|
|
138
|
+
doctorName?: string;
|
|
139
|
+
doctorAvatar?: string;
|
|
140
|
+
medium?: string;
|
|
141
|
+
status?: string;
|
|
142
|
+
isFulfilled?: number;
|
|
143
|
+
parentConsultationId?: number;
|
|
144
|
+
createdAt?: string;
|
|
145
|
+
updatedAt?: string;
|
|
146
|
+
user?: UserType;
|
|
147
|
+
parentConsultation?: ConsultationType;
|
|
148
|
+
media?: MediaType[];
|
|
149
|
+
consultations?: ConsultationType[];
|
|
150
|
+
pusherChannel?: string;
|
|
151
|
+
pusherAppKey?: string;
|
|
152
|
+
chatConfig?: ChatConfig;
|
|
153
|
+
voipConfig?: VoipConfig;
|
|
154
|
+
videoConfig?: VoipConfig;
|
|
155
|
+
chatHistory: ChatHistory;
|
|
156
|
+
recommendation?: Recommendation;
|
|
157
|
+
socketParams?: SocketParams;
|
|
21
158
|
}
|
|
22
|
-
|
|
159
|
+
export type {
|
|
160
|
+
ResponseType,
|
|
161
|
+
MediumType,
|
|
162
|
+
BloodType,
|
|
163
|
+
MaritalStatus,
|
|
164
|
+
BoolString,
|
|
165
|
+
GenderType,
|
|
166
|
+
UserType,
|
|
167
|
+
MediaType,
|
|
168
|
+
ChatData,
|
|
169
|
+
ChatHistory,
|
|
170
|
+
ChatConfig,
|
|
171
|
+
VoipConfig,
|
|
172
|
+
Recommendation,
|
|
173
|
+
RecommendationData,
|
|
174
|
+
RecommendationLab,
|
|
175
|
+
RecommendationLabItem,
|
|
176
|
+
RecommendationDrug,
|
|
177
|
+
RecommendationFdaDrug,
|
|
178
|
+
RecommendationICD10,
|
|
179
|
+
RecommendationSymptom,
|
|
180
|
+
RecommendationDiagnosis,
|
|
181
|
+
RecommendationFollowUp,
|
|
182
|
+
RecommendationDoctorReferral,
|
|
183
|
+
RecommendationPostCallAnswer,
|
|
184
|
+
ConsultationType,
|
|
185
|
+
};
|