@abihealth/goapp-react-native 1.32.0 → 1.33.0
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/CHANGELOG.md +7 -0
- package/dist/common/api/base.js +2 -0
- package/dist/common/api/logger.d.ts +2 -0
- package/dist/common/api/logger.js +18 -0
- package/dist/common/api/models/logger.d.ts +13 -0
- package/dist/common/api/models/logger.js +10 -0
- package/dist/common/api/sslPinning.js +3 -2
- package/dist/common/api/websocket.js +8 -4
- package/dist/common/contexts/ConsultationContext.js +19 -20
- package/dist/common/helpers/eventHandler.d.ts +1 -1
- package/dist/common/helpers/eventHandler.js +2 -1
- package/dist/common/hooks/useConsultation.js +2 -1
- package/dist/common/utils/logger.d.ts +3 -0
- package/dist/common/utils/logger.js +49 -0
- package/dist/form-prescriptions/screens/ReasonScreen.js +2 -3
- package/dist/video-consultations/components/agora/AgoraWrapper.js +35 -10
- package/dist/video-consultations/hooks/useInitRtcEngine.js +13 -5
- package/dist/video-consultations/screens/DeliveryAddressScreen.js +2 -1
- package/dist/video-consultations/screens/VideoCallScreen.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.33.0](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.32.0...goapp-react-native-v1.33.0) (2025-06-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* error tracking ([#207](https://github.com/abiglobalhealth/react-native-sdk/issues/207)) ([543a375](https://github.com/abiglobalhealth/react-native-sdk/commit/543a375e31c6bac75bcfafbdb2f8484e72378131))
|
|
9
|
+
|
|
3
10
|
## [1.32.0](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.31.1...goapp-react-native-v1.32.0) (2025-05-29)
|
|
4
11
|
|
|
5
12
|
|
package/dist/common/api/base.js
CHANGED
|
@@ -4,5 +4,7 @@ exports.getBaseUrl = void 0;
|
|
|
4
4
|
var getBaseUrl = function (region) { return ({
|
|
5
5
|
sdk: "https://".concat(region, ".sdk.abi.ai"),
|
|
6
6
|
ws: "wss://".concat(region, ".sdk-ws.abi.ai")
|
|
7
|
+
// sdk: `https://mwolts3h85.execute-api.eu-west-1.amazonaws.com/dev`, // Dev
|
|
8
|
+
// ws: `wss://g4lfnxt2hf.execute-api.eu-west-1.amazonaws.com/dev`, // Dev
|
|
7
9
|
}); };
|
|
8
10
|
exports.getBaseUrl = getBaseUrl;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.sendLog = void 0;
|
|
7
|
+
var axios_1 = __importDefault(require("axios"));
|
|
8
|
+
var LOGGER_URL = '/log';
|
|
9
|
+
var sendLog = function (log) {
|
|
10
|
+
return axios_1.default
|
|
11
|
+
.post(LOGGER_URL, log)
|
|
12
|
+
.then(function (response) { return response === null || response === void 0 ? void 0 : response.data; })
|
|
13
|
+
.catch(function (error) {
|
|
14
|
+
console.error('Error sending log', error);
|
|
15
|
+
throw error;
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
exports.sendLog = sendLog;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogLevel = void 0;
|
|
4
|
+
var LogLevel;
|
|
5
|
+
(function (LogLevel) {
|
|
6
|
+
LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
|
|
7
|
+
LogLevel[LogLevel["INFO"] = 1] = "INFO";
|
|
8
|
+
LogLevel[LogLevel["WARN"] = 2] = "WARN";
|
|
9
|
+
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
|
10
|
+
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
@@ -37,6 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.initializeSslPinning = void 0;
|
|
40
|
+
var logger_1 = require("../utils/logger");
|
|
40
41
|
var react_native_ssl_public_key_pinning_1 = require("react-native-ssl-public-key-pinning");
|
|
41
42
|
var initializeSslPinning = function (disableSslPinning) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
43
|
return __generator(this, function (_a) {
|
|
@@ -46,7 +47,7 @@ var initializeSslPinning = function (disableSslPinning) { return __awaiter(void
|
|
|
46
47
|
return [4 /*yield*/, (0, react_native_ssl_public_key_pinning_1.disableSslPinning)()];
|
|
47
48
|
case 1:
|
|
48
49
|
_a.sent();
|
|
49
|
-
return [2 /*return*/,
|
|
50
|
+
return [2 /*return*/, logger_1.Logger.log('🔒🚫 SSL pinning disabled')];
|
|
50
51
|
case 2: return [4 /*yield*/, (0, react_native_ssl_public_key_pinning_1.initializeSslPinning)({
|
|
51
52
|
'ape1.sdk.abi.ai': {
|
|
52
53
|
publicKeyHashes: ['95kHJrJXD1L/WORHTc5rh99KvZ10Ipd9m7eW0JUsLnA=', 'b+nnCNzPN8D2jN0srTRwMXqLUjmnZODZ0k28NZFFrkc=']
|
|
@@ -57,7 +58,7 @@ var initializeSslPinning = function (disableSslPinning) { return __awaiter(void
|
|
|
57
58
|
})];
|
|
58
59
|
case 3:
|
|
59
60
|
_a.sent();
|
|
60
|
-
return [2 /*return*/,
|
|
61
|
+
return [2 /*return*/, logger_1.Logger.log('🔒 SSL pinning initialized')];
|
|
61
62
|
}
|
|
62
63
|
});
|
|
63
64
|
}); };
|
|
@@ -37,21 +37,25 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.connectWebsocket = void 0;
|
|
40
|
+
var logger_1 = require("../utils/logger");
|
|
40
41
|
var base_1 = require("./base");
|
|
41
42
|
var connectWebsocket = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
42
43
|
var token = _b.token, region = _b.region;
|
|
43
44
|
return __generator(this, function (_c) {
|
|
44
45
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
45
|
-
|
|
46
|
+
logger_1.Logger.log('❔ Connecting to WS...', { token: token, region: region });
|
|
46
47
|
try {
|
|
47
48
|
var websocket_1 = new WebSocket("".concat((0, base_1.getBaseUrl)(region).ws, "?eventType=CONNECT"), null);
|
|
48
49
|
websocket_1.onopen = function () {
|
|
49
|
-
|
|
50
|
-
websocket_1.send(JSON.stringify({
|
|
50
|
+
logger_1.Logger.log('🟢 WS connected');
|
|
51
|
+
websocket_1.send(JSON.stringify({
|
|
52
|
+
action: 'connect',
|
|
53
|
+
payload: { token: "Bearer ".concat(token) }
|
|
54
|
+
}));
|
|
51
55
|
resolve(websocket_1);
|
|
52
56
|
};
|
|
53
57
|
websocket_1.onerror = function (e) {
|
|
54
|
-
|
|
58
|
+
logger_1.Logger.error('🔴 WS error', JSON.stringify(e, null, 2));
|
|
55
59
|
};
|
|
56
60
|
}
|
|
57
61
|
catch (e) {
|
|
@@ -47,6 +47,7 @@ var user_1 = require("../api/user");
|
|
|
47
47
|
var websocket_1 = require("../api/websocket");
|
|
48
48
|
var i18n_1 = __importDefault(require("../locale/i18n"));
|
|
49
49
|
var theme_1 = require("../types/theme");
|
|
50
|
+
var logger_1 = require("../utils/logger");
|
|
50
51
|
var axios_1 = require("axios");
|
|
51
52
|
var react_1 = require("react");
|
|
52
53
|
var react_i18next_1 = require("react-i18next");
|
|
@@ -73,7 +74,7 @@ var ConsultationProvider = function (_a) {
|
|
|
73
74
|
var _g = (0, react_1.useState)(null), slug = _g[0], setSlug = _g[1];
|
|
74
75
|
var _h = (0, react_1.useState)(false), initialised = _h[0], setInitialised = _h[1];
|
|
75
76
|
var handleError = function (e) {
|
|
76
|
-
|
|
77
|
+
logger_1.Logger.error('🚨 Error caught on handler', e);
|
|
77
78
|
onError(e);
|
|
78
79
|
};
|
|
79
80
|
var initialise = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -88,7 +89,7 @@ var ConsultationProvider = function (_a) {
|
|
|
88
89
|
return [3 /*break*/, 3];
|
|
89
90
|
case 2:
|
|
90
91
|
e_1 = _a.sent();
|
|
91
|
-
|
|
92
|
+
logger_1.Logger.error('Error initializing SSL pinning', e_1);
|
|
92
93
|
throw e_1;
|
|
93
94
|
case 3:
|
|
94
95
|
_a.trys.push([3, 5, , 6]);
|
|
@@ -99,7 +100,7 @@ var ConsultationProvider = function (_a) {
|
|
|
99
100
|
return [3 /*break*/, 6];
|
|
100
101
|
case 5:
|
|
101
102
|
e_2 = _a.sent();
|
|
102
|
-
|
|
103
|
+
logger_1.Logger.error('Error getting partner info', e_2);
|
|
103
104
|
throw e_2;
|
|
104
105
|
case 6:
|
|
105
106
|
_a.trys.push([6, 8, , 9]);
|
|
@@ -110,14 +111,14 @@ var ConsultationProvider = function (_a) {
|
|
|
110
111
|
return [3 /*break*/, 9];
|
|
111
112
|
case 8:
|
|
112
113
|
e_3 = _a.sent();
|
|
113
|
-
|
|
114
|
+
logger_1.Logger.error('Error getting user', e_3);
|
|
114
115
|
throw e_3;
|
|
115
116
|
case 9:
|
|
116
117
|
_a.trys.push([9, 11, , 12]);
|
|
117
118
|
return [4 /*yield*/, (0, user_1.getActiveConsultation)()];
|
|
118
119
|
case 10:
|
|
119
120
|
activeConsultation = _a.sent();
|
|
120
|
-
|
|
121
|
+
logger_1.Logger.log('⏮️ Active:', activeConsultation.consultation);
|
|
121
122
|
setConsultation(activeConsultation === null || activeConsultation === void 0 ? void 0 : activeConsultation.consultation);
|
|
122
123
|
return [3 /*break*/, 12];
|
|
123
124
|
case 11:
|
|
@@ -126,7 +127,7 @@ var ConsultationProvider = function (_a) {
|
|
|
126
127
|
setConsultation(null);
|
|
127
128
|
}
|
|
128
129
|
else {
|
|
129
|
-
|
|
130
|
+
logger_1.Logger.error('Error getting active consultation', e_4);
|
|
130
131
|
throw e_4;
|
|
131
132
|
}
|
|
132
133
|
return [3 /*break*/, 12];
|
|
@@ -139,7 +140,7 @@ var ConsultationProvider = function (_a) {
|
|
|
139
140
|
return [3 /*break*/, 15];
|
|
140
141
|
case 14:
|
|
141
142
|
e_5 = _a.sent();
|
|
142
|
-
|
|
143
|
+
logger_1.Logger.error('Error connecting to websocket', e_5);
|
|
143
144
|
throw e_5;
|
|
144
145
|
case 15: return [2 /*return*/];
|
|
145
146
|
}
|
|
@@ -152,56 +153,54 @@ var ConsultationProvider = function (_a) {
|
|
|
152
153
|
(0, config_1.configureAxios)({ token: token, region: region });
|
|
153
154
|
(_a = config_1.axios === null || config_1.axios === void 0 ? void 0 : config_1.axios.interceptors) === null || _a === void 0 ? void 0 : _a.request.use(function (config) {
|
|
154
155
|
var method = config.method, url = config.url, data = config.data;
|
|
155
|
-
|
|
156
|
-
service: 'API Rest',
|
|
156
|
+
logger_1.Logger.log('API Rest request', {
|
|
157
157
|
message: "".concat(method === null || method === void 0 ? void 0 : method.toUpperCase(), " ").concat(url, " ").concat(data !== undefined ? "- body: ".concat(JSON.stringify(data)) : ' '),
|
|
158
158
|
headers: config.headers
|
|
159
159
|
});
|
|
160
160
|
return config;
|
|
161
161
|
});
|
|
162
162
|
(_b = config_1.axios === null || config_1.axios === void 0 ? void 0 : config_1.axios.interceptors) === null || _b === void 0 ? void 0 : _b.response.use(function (response) {
|
|
163
|
-
|
|
164
|
-
service: 'API Rest Response',
|
|
163
|
+
logger_1.Logger.log('API Rest Response', {
|
|
165
164
|
message: JSON.stringify(response === null || response === void 0 ? void 0 : response.data)
|
|
166
165
|
});
|
|
167
166
|
return response;
|
|
168
167
|
});
|
|
169
168
|
initialise().catch(function (e) {
|
|
170
|
-
|
|
169
|
+
logger_1.Logger.error('Error initialising', e);
|
|
171
170
|
// Alert.alert('Error initialising', `${e.message}\n${JSON.stringify(e)}`)
|
|
172
171
|
handleError(e);
|
|
173
172
|
});
|
|
174
173
|
return function () {
|
|
175
|
-
|
|
174
|
+
logger_1.Logger.log('Authorization cleanup', { token: token });
|
|
176
175
|
delete config_1.axios.defaults.headers.common.Authorization;
|
|
177
176
|
websocket === null || websocket === void 0 ? void 0 : websocket.close();
|
|
178
177
|
};
|
|
179
178
|
}, [token, region]);
|
|
180
179
|
(0, react_1.useEffect)(function () {
|
|
181
|
-
|
|
180
|
+
logger_1.Logger.log('WS changed', websocket);
|
|
182
181
|
if (!websocket)
|
|
183
182
|
return;
|
|
184
|
-
|
|
183
|
+
logger_1.Logger.log('👂 Connecting onMessage...');
|
|
185
184
|
websocket.onmessage = function (event) {
|
|
186
185
|
var data = JSON.parse(event.data);
|
|
187
|
-
|
|
186
|
+
logger_1.Logger.log('👀 Websocket message', { eventData: event.data, data: data });
|
|
188
187
|
if (data.consultation)
|
|
189
188
|
setConsultation(data.consultation);
|
|
190
189
|
if (data.event === 'websocketError')
|
|
191
190
|
handleError(new Error('Websocket error'));
|
|
192
191
|
if (data.event === 'websocketConnected') {
|
|
193
|
-
|
|
192
|
+
logger_1.Logger.log('🟢🟢 Websocket connected');
|
|
194
193
|
setInitialised(true);
|
|
195
194
|
}
|
|
196
195
|
};
|
|
197
196
|
websocket.onclose = function (e) {
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
logger_1.Logger.log('❌ WS closed', JSON.stringify(e, null, 2));
|
|
198
|
+
logger_1.Logger.log('🔄 Reconnecting...');
|
|
200
199
|
(0, websocket_1.connectWebsocket)({ token: token, region: region }).then(setWebsocket).catch(handleError);
|
|
201
200
|
};
|
|
202
201
|
}, [websocket]);
|
|
203
202
|
(0, react_1.useEffect)(function () {
|
|
204
|
-
var subscription = (0, react_native_ssl_public_key_pinning_1.addSslPinningErrorListener)(
|
|
203
|
+
var subscription = (0, react_native_ssl_public_key_pinning_1.addSslPinningErrorListener)(function (e) { return logger_1.Logger.error('SSL Pinning error', e); });
|
|
205
204
|
return function () { return subscription.remove(); };
|
|
206
205
|
}, []);
|
|
207
206
|
var value = {
|
|
@@ -16,4 +16,4 @@ export interface EventHandlers {
|
|
|
16
16
|
onVideoCallLeft?: () => void;
|
|
17
17
|
}
|
|
18
18
|
export declare const mapConsultationStatusToEvent: (consultation: Consultation) => CONSULTATION_EVENT;
|
|
19
|
-
export declare const handleEvent: (consultation: ConsultationContextProps["consultation"], eventHandlers?: EventHandlers) => void
|
|
19
|
+
export declare const handleEvent: (consultation: ConsultationContextProps["consultation"], eventHandlers?: EventHandlers) => Promise<void>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.handleEvent = exports.mapConsultationStatusToEvent = void 0;
|
|
4
4
|
var consultation_1 = require("../types/consultation");
|
|
5
5
|
var events_1 = require("../types/events");
|
|
6
|
+
var logger_1 = require("../utils/logger");
|
|
6
7
|
var mapConsultationStatusToEvent = function (consultation) {
|
|
7
8
|
var status = consultation.status, professional = consultation.professional;
|
|
8
9
|
switch (status) {
|
|
@@ -29,7 +30,7 @@ var handleEvent = function (consultation, eventHandlers) {
|
|
|
29
30
|
if (!eventHandlers)
|
|
30
31
|
return;
|
|
31
32
|
if (!consultation)
|
|
32
|
-
return
|
|
33
|
+
return logger_1.Logger.warn('Skipping event handling -> no consultation found');
|
|
33
34
|
var consultationEvent = (0, exports.mapConsultationStatusToEvent)(consultation);
|
|
34
35
|
switch (consultationEvent) {
|
|
35
36
|
case events_1.CONSULTATION_EVENT.CANCELED:
|
|
@@ -45,6 +45,7 @@ var consultation_2 = require("../api/models/consultation");
|
|
|
45
45
|
var ConsultationContext_1 = require("../contexts/ConsultationContext");
|
|
46
46
|
var i18n_1 = __importDefault(require("../locale/i18n"));
|
|
47
47
|
var consultation_3 = require("../types/consultation");
|
|
48
|
+
var logger_1 = require("../utils/logger");
|
|
48
49
|
var video_1 = require("../../video-consultations/api/video");
|
|
49
50
|
var react_1 = require("react");
|
|
50
51
|
var useUser_1 = require("./useUser");
|
|
@@ -80,7 +81,7 @@ var useConsultation = function () {
|
|
|
80
81
|
return [2 /*return*/, response.consultation];
|
|
81
82
|
case 2:
|
|
82
83
|
e_1 = _a.sent();
|
|
83
|
-
|
|
84
|
+
logger_1.Logger.error('Error on consultation action', e_1);
|
|
84
85
|
onError(e_1);
|
|
85
86
|
throw e_1;
|
|
86
87
|
case 3: return [2 /*return*/];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logger = void 0;
|
|
4
|
+
var logger_1 = require("../api/logger");
|
|
5
|
+
var logger_2 = require("../api/models/logger");
|
|
6
|
+
var react_native_1 = require("react-native");
|
|
7
|
+
exports.Logger = {
|
|
8
|
+
debug: function (message, data) {
|
|
9
|
+
var log = {
|
|
10
|
+
level: logger_2.LogLevel.DEBUG,
|
|
11
|
+
message: message,
|
|
12
|
+
data: data,
|
|
13
|
+
platform: react_native_1.Platform
|
|
14
|
+
};
|
|
15
|
+
console.log('🟣', log);
|
|
16
|
+
return new Promise(function (resolve) { return resolve(); });
|
|
17
|
+
},
|
|
18
|
+
log: function (message, data) {
|
|
19
|
+
var log = {
|
|
20
|
+
level: logger_2.LogLevel.INFO,
|
|
21
|
+
message: message,
|
|
22
|
+
data: data,
|
|
23
|
+
platform: react_native_1.Platform
|
|
24
|
+
};
|
|
25
|
+
console.log('⚪', log);
|
|
26
|
+
// return sendLog(log)
|
|
27
|
+
return new Promise(function (resolve) { return resolve(); });
|
|
28
|
+
},
|
|
29
|
+
error: function (message, data) {
|
|
30
|
+
var log = {
|
|
31
|
+
level: logger_2.LogLevel.ERROR,
|
|
32
|
+
message: message,
|
|
33
|
+
data: data,
|
|
34
|
+
platform: react_native_1.Platform
|
|
35
|
+
};
|
|
36
|
+
console.error('🔴', log);
|
|
37
|
+
return (0, logger_1.sendLog)(log);
|
|
38
|
+
},
|
|
39
|
+
warn: function (message, data) {
|
|
40
|
+
var log = {
|
|
41
|
+
level: logger_2.LogLevel.WARN,
|
|
42
|
+
message: message,
|
|
43
|
+
data: data,
|
|
44
|
+
platform: react_native_1.Platform
|
|
45
|
+
};
|
|
46
|
+
console.warn('🟡', log);
|
|
47
|
+
return (0, logger_1.sendLog)(log);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
@@ -82,9 +82,9 @@ var Text_1 = require("../../common/components/Text");
|
|
|
82
82
|
var useConsultation_1 = require("../../common/hooks/useConsultation");
|
|
83
83
|
var useTheme_1 = require("../../common/hooks/useTheme");
|
|
84
84
|
var useTranslation_1 = require("../../common/hooks/useTranslation");
|
|
85
|
-
var useUser_1 = require("../../common/hooks/useUser");
|
|
86
85
|
var BackArrowIcon_1 = require("../../common/icons/BackArrowIcon");
|
|
87
86
|
var CloseIcon_1 = require("../../common/icons/CloseIcon");
|
|
87
|
+
var logger_1 = require("../../common/utils/logger");
|
|
88
88
|
var prescription_1 = require("../api/prescription");
|
|
89
89
|
var useIndicationSurvey_1 = require("../hooks/useIndicationSurvey");
|
|
90
90
|
var useIndicationSurveyAnswers_1 = require("../hooks/useIndicationSurveyAnswers");
|
|
@@ -100,7 +100,6 @@ var ReasonScreen = function () {
|
|
|
100
100
|
var resetIndicationSurvey = (0, useIndicationSurvey_1.useIndicationSurvey)().resetIndicationSurvey;
|
|
101
101
|
var previousScreen = (0, useScreens_1.useScreens)().previousScreen;
|
|
102
102
|
var indicationSurveyAnswers = (0, useIndicationSurveyAnswers_1.useIndicationSurveyAnswers)().indicationSurveyAnswers;
|
|
103
|
-
var user = (0, useUser_1.useUser)().user;
|
|
104
103
|
var updateConsultation = (0, useConsultation_1.useConsultation)().updateConsultation;
|
|
105
104
|
var theme = (0, useTheme_1.useTheme)();
|
|
106
105
|
var styles = getStyles(theme);
|
|
@@ -119,7 +118,7 @@ var ReasonScreen = function () {
|
|
|
119
118
|
updateConsultation(consultation);
|
|
120
119
|
})
|
|
121
120
|
.catch(function (error) {
|
|
122
|
-
|
|
121
|
+
logger_1.Logger.error('Failed to create prescription', error);
|
|
123
122
|
})
|
|
124
123
|
.finally(function () {
|
|
125
124
|
setLoading(false);
|
|
@@ -37,6 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.AgoraWrapper = void 0;
|
|
40
|
+
var logger_1 = require("../../../common/utils/logger");
|
|
40
41
|
var platform_1 = require("../../../common/utils/platform");
|
|
41
42
|
var useInitRtcEngine_1 = __importDefault(require("../../hooks/useInitRtcEngine"));
|
|
42
43
|
var react_1 = __importStar(require("react"));
|
|
@@ -53,11 +54,11 @@ var AgoraWrapper = function (_a) {
|
|
|
53
54
|
var _f = (0, useInitRtcEngine_1.default)(rtcProps, true), channelId = _f.channelId, token = _f.token, uid = _f.uid, joinChannelSuccess = _f.joinChannelSuccess, remoteUsers = _f.remoteUsers, startPreview = _f.startPreview, engine = _f.engine, setRemoteUsers = _f.setRemoteUsers;
|
|
54
55
|
var joinChannel = function () {
|
|
55
56
|
if (!channelId) {
|
|
56
|
-
|
|
57
|
+
logger_1.Logger.error('channelId is invalid');
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
60
|
if (uid < 0) {
|
|
60
|
-
|
|
61
|
+
logger_1.Logger.error('uid is invalid');
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
64
|
engine.current.joinChannel(token, channelId, uid, {
|
|
@@ -87,7 +88,11 @@ var AgoraWrapper = function (_a) {
|
|
|
87
88
|
engine.current.leaveChannel();
|
|
88
89
|
};
|
|
89
90
|
var onUserOffline = (0, react_1.useCallback)(function (connection, remoteUid, reason) {
|
|
90
|
-
|
|
91
|
+
logger_1.Logger.debug('AgoraWrapper:onUserOffline', {
|
|
92
|
+
connection: connection,
|
|
93
|
+
remoteUid: remoteUid,
|
|
94
|
+
reason: reason
|
|
95
|
+
});
|
|
91
96
|
setRemoteVideoMuted(true);
|
|
92
97
|
if (connection.channelId === channelId && (connection.localUid === uid || uid === 0)) {
|
|
93
98
|
setRemoteUsers(function (prev) {
|
|
@@ -99,20 +104,40 @@ var AgoraWrapper = function (_a) {
|
|
|
99
104
|
}, [channelId, uid]);
|
|
100
105
|
(0, react_1.useEffect)(function () {
|
|
101
106
|
engine.current.addListener('onVideoDeviceStateChanged', function (deviceId, deviceType, deviceState) {
|
|
102
|
-
|
|
107
|
+
logger_1.Logger.debug('AgoraWrapper:onVideoDeviceStateChanged', {
|
|
108
|
+
deviceId: deviceId,
|
|
109
|
+
deviceType: deviceType,
|
|
110
|
+
deviceState: deviceState
|
|
111
|
+
});
|
|
103
112
|
});
|
|
104
113
|
engine.current.addListener('onLocalVideoStateChanged', function (source, state, error) {
|
|
105
|
-
|
|
114
|
+
logger_1.Logger.debug('AgoraWrapper:onLocalVideoStateChanged', {
|
|
115
|
+
source: source,
|
|
116
|
+
state: state,
|
|
117
|
+
error: error
|
|
118
|
+
});
|
|
106
119
|
});
|
|
107
120
|
engine.current.addListener('onLocalAudioStateChanged', function (connection, state, error) {
|
|
108
|
-
|
|
121
|
+
logger_1.Logger.debug('AgoraWrapper:onLocalAudioStateChanged', {
|
|
122
|
+
connection: connection,
|
|
123
|
+
state: state,
|
|
124
|
+
error: error
|
|
125
|
+
});
|
|
109
126
|
});
|
|
110
127
|
engine.current.addListener('onUserMuteVideo', function (connection, remoteUid, muted) {
|
|
111
|
-
|
|
128
|
+
logger_1.Logger.debug('AgoraWrapper:onUserMuteVideo', {
|
|
129
|
+
connection: connection,
|
|
130
|
+
remoteUid: remoteUid,
|
|
131
|
+
muted: muted
|
|
132
|
+
});
|
|
112
133
|
setRemoteVideoMuted(muted);
|
|
113
134
|
});
|
|
114
135
|
engine.current.addListener('onUserMuteAudio', function (connection, remoteUid, muted) {
|
|
115
|
-
|
|
136
|
+
logger_1.Logger.debug('AgoraWrapper:onUserMuteAudio', {
|
|
137
|
+
connection: connection,
|
|
138
|
+
remoteUid: remoteUid,
|
|
139
|
+
muted: muted
|
|
140
|
+
});
|
|
116
141
|
setRemoteAudioMuted(muted);
|
|
117
142
|
});
|
|
118
143
|
engine.current.addListener('onUserJoined', function () {
|
|
@@ -126,9 +151,9 @@ var AgoraWrapper = function (_a) {
|
|
|
126
151
|
};
|
|
127
152
|
}, [engine, onUserOffline]);
|
|
128
153
|
(0, react_1.useEffect)(function () {
|
|
129
|
-
|
|
154
|
+
logger_1.Logger.debug('AgoraWrapper:startPreview', { startPreview: startPreview, channelId: channelId });
|
|
130
155
|
if (startPreview && channelId) {
|
|
131
|
-
|
|
156
|
+
logger_1.Logger.debug('AgoraWrapper:joinChannel');
|
|
132
157
|
joinChannel();
|
|
133
158
|
}
|
|
134
159
|
}, [startPreview, channelId]);
|
|
@@ -78,6 +78,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
78
78
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
79
79
|
};
|
|
80
80
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
81
|
+
var logger_1 = require("../../common/utils/logger");
|
|
81
82
|
var permission_1 = require("../utils/permission");
|
|
82
83
|
var react_1 = require("react");
|
|
83
84
|
var react_native_agora_1 = __importStar(require("react-native-agora"));
|
|
@@ -93,7 +94,7 @@ var useInitRtcEngine = function (rtcProps, enableVideo, listenUserJoinOrLeave) {
|
|
|
93
94
|
switch (_a.label) {
|
|
94
95
|
case 0:
|
|
95
96
|
if (!appId) {
|
|
96
|
-
|
|
97
|
+
logger_1.Logger.error("appId is invalid");
|
|
97
98
|
throw new Error('appId is invalid');
|
|
98
99
|
}
|
|
99
100
|
engine.current.initialize({
|
|
@@ -117,23 +118,30 @@ var useInitRtcEngine = function (rtcProps, enableVideo, listenUserJoinOrLeave) {
|
|
|
117
118
|
});
|
|
118
119
|
}); }, [appId, enableVideo]);
|
|
119
120
|
var onError = (0, react_1.useCallback)(function (err, msg) {
|
|
120
|
-
|
|
121
|
+
logger_1.Logger.debug('useInitRtcEngine:onError', { err: err, msg: msg });
|
|
121
122
|
}, []);
|
|
122
123
|
var onJoinChannelSuccess = (0, react_1.useCallback)(function (connection, elapsed) {
|
|
123
|
-
|
|
124
|
+
logger_1.Logger.debug('useInitRtcEngine:onJoinChannelSuccess', {
|
|
125
|
+
connection: connection,
|
|
126
|
+
elapsed: elapsed
|
|
127
|
+
});
|
|
124
128
|
if (connection.channelId === channelId && (connection.localUid === uid || uid === 0)) {
|
|
125
129
|
setJoinChannelSuccess(true);
|
|
126
130
|
}
|
|
127
131
|
}, [channelId, uid]);
|
|
128
132
|
var onLeaveChannel = (0, react_1.useCallback)(function (connection, stats) {
|
|
129
|
-
|
|
133
|
+
logger_1.Logger.debug('useInitRtcEngine:onLeaveChannel', { connection: connection, stats: stats });
|
|
130
134
|
if (connection.channelId === channelId && (connection.localUid === uid || uid === 0)) {
|
|
131
135
|
setJoinChannelSuccess(false);
|
|
132
136
|
setRemoteUsers([]);
|
|
133
137
|
}
|
|
134
138
|
}, [channelId, uid]);
|
|
135
139
|
var onUserJoined = (0, react_1.useCallback)(function (connection, remoteUid, elapsed) {
|
|
136
|
-
|
|
140
|
+
logger_1.Logger.debug('useInitRtcEngine:onUserJoined', {
|
|
141
|
+
connection: connection,
|
|
142
|
+
remoteUid: remoteUid,
|
|
143
|
+
elapsed: elapsed
|
|
144
|
+
});
|
|
137
145
|
if (connection.channelId === channelId && (connection.localUid === uid || uid === 0)) {
|
|
138
146
|
setRemoteUsers(function (prev) {
|
|
139
147
|
if (prev === undefined)
|
|
@@ -96,6 +96,7 @@ var useTheme_1 = require("../../common/hooks/useTheme");
|
|
|
96
96
|
var useTranslation_1 = require("../../common/hooks/useTranslation");
|
|
97
97
|
var WarningIcon_1 = __importDefault(require("../../common/icons/WarningIcon"));
|
|
98
98
|
var deliveryAddress_1 = require("../../common/types/deliveryAddress");
|
|
99
|
+
var logger_1 = require("../../common/utils/logger");
|
|
99
100
|
var video_1 = require("../api/video");
|
|
100
101
|
var VideoConsultationIcon_1 = require("../icons/VideoConsultationIcon");
|
|
101
102
|
var react_1 = __importStar(require("react"));
|
|
@@ -142,7 +143,7 @@ var DeliveryAddressScreen = function (_a) {
|
|
|
142
143
|
return [3 /*break*/, 3];
|
|
143
144
|
case 2:
|
|
144
145
|
e_1 = _a.sent();
|
|
145
|
-
|
|
146
|
+
logger_1.Logger.error('DeliveryAddressScreen:onSubmit', e_1);
|
|
146
147
|
setError(true);
|
|
147
148
|
setLoading(false);
|
|
148
149
|
return [3 /*break*/, 3];
|
|
@@ -80,6 +80,7 @@ var Text_1 = require("../../common/components/Text");
|
|
|
80
80
|
var useConsultation_1 = require("../../common/hooks/useConsultation");
|
|
81
81
|
var useTheme_1 = require("../../common/hooks/useTheme");
|
|
82
82
|
var useTranslation_1 = require("../../common/hooks/useTranslation");
|
|
83
|
+
var logger_1 = require("../../common/utils/logger");
|
|
83
84
|
var video_1 = require("../api/video");
|
|
84
85
|
var AgoraWrapper_1 = __importDefault(require("../components/agora/AgoraWrapper"));
|
|
85
86
|
var VideoConsultationIcon_1 = require("../icons/VideoConsultationIcon");
|
|
@@ -104,7 +105,7 @@ var VideoCallScreen = function (_a) {
|
|
|
104
105
|
setIsHangOut(true);
|
|
105
106
|
onVideoCallLeft === null || onVideoCallLeft === void 0 ? void 0 : onVideoCallLeft();
|
|
106
107
|
return [4 /*yield*/, (0, video_1.hangOutVideoCall)({ consultationId: consultation.id, room: room }).catch(function (error) {
|
|
107
|
-
|
|
108
|
+
logger_1.Logger.error('Error ending video call:', error);
|
|
108
109
|
setIsHangOut(false);
|
|
109
110
|
})];
|
|
110
111
|
case 1:
|