@abihealth/goapp-react-native 1.20.2 → 1.21.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 +15 -0
- package/dist/common/api/config.js +1 -2
- package/dist/common/api/websocket.js +1 -5
- package/dist/common/components/ConsultationContainer.d.ts +2 -0
- package/dist/common/components/ConsultationContainer.js +12 -0
- package/dist/common/contexts/ConsultationContext.d.ts +1 -0
- package/dist/common/contexts/ConsultationContext.js +13 -4
- package/dist/common/hooks/useConsultation.d.ts +1 -0
- package/dist/common/hooks/useConsultation.js +3 -2
- package/dist/form-prescriptions/components/FormPrescription.js +4 -6
- package/dist/text-consultations/components/TextConsultation.js +3 -6
- package/dist/video-consultations/components/VideoConsultation.js +3 -5
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.21.0](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.20.3...goapp-react-native-v1.21.0) (2025-04-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* create a styled ConsultationContainer component for cases ([#166](https://github.com/abiglobalhealth/react-native-sdk/issues/166)) ([528f6e5](https://github.com/abiglobalhealth/react-native-sdk/commit/528f6e5b9a96393a271100d0777463baa08281f9))
|
|
9
|
+
* use new domains ([#169](https://github.com/abiglobalhealth/react-native-sdk/issues/169)) ([ee64438](https://github.com/abiglobalhealth/react-native-sdk/commit/ee644381aa86b94344b0ca8a5f5126b16b7d8ea3))
|
|
10
|
+
|
|
11
|
+
## [1.20.3](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.20.2...goapp-react-native-v1.20.3) (2025-03-27)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* improve websocket error handling and reconnect logic ([#163](https://github.com/abiglobalhealth/react-native-sdk/issues/163)) ([d0b3ae6](https://github.com/abiglobalhealth/react-native-sdk/commit/d0b3ae606cba339550f3731d0ff89d924efbaae9))
|
|
17
|
+
|
|
3
18
|
## [1.20.2](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.20.1...goapp-react-native-v1.20.2) (2025-03-27)
|
|
4
19
|
|
|
5
20
|
|
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.axios = exports.configureAxios = void 0;
|
|
7
7
|
var axios_1 = __importDefault(require("axios"));
|
|
8
8
|
exports.axios = axios_1.default;
|
|
9
|
-
var BASE_URL = { ape1: 'https://m10bzqot97.execute-api.ap-east-1.amazonaws.com/prod' };
|
|
10
9
|
var configureAxios = function (_a) {
|
|
11
10
|
var token = _a.token, region = _a.region;
|
|
12
|
-
axios_1.default.defaults.baseURL =
|
|
11
|
+
axios_1.default.defaults.baseURL = "https://".concat(region, ".sdk.abi.ai");
|
|
13
12
|
axios_1.default.defaults.headers.common.Authorization = "Bearer ".concat(token);
|
|
14
13
|
};
|
|
15
14
|
exports.configureAxios = configureAxios;
|
|
@@ -37,14 +37,13 @@ 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 WS_URL = { ape1: 'wss://yrmfk5amqg.execute-api.ap-east-1.amazonaws.com/prod' };
|
|
41
40
|
var connectWebsocket = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
42
41
|
var token = _b.token, userId = _b.userId, region = _b.region;
|
|
43
42
|
return __generator(this, function (_c) {
|
|
44
43
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
45
44
|
console.log('❔ Connecting to WS...', { token: token, userId: userId, region: region });
|
|
46
45
|
try {
|
|
47
|
-
var websocket_1 = new WebSocket("".concat(
|
|
46
|
+
var websocket_1 = new WebSocket("wss://".concat(region, ".sdk-ws.abi.ai?eventType=CONNECT"), null);
|
|
48
47
|
websocket_1.onopen = function () {
|
|
49
48
|
console.log('🟢 WS connected');
|
|
50
49
|
websocket_1.send(JSON.stringify({ action: 'connect', payload: { userId: userId, token: "Bearer ".concat(token) } }));
|
|
@@ -53,9 +52,6 @@ var connectWebsocket = function (_a) { return __awaiter(void 0, [_a], void 0, fu
|
|
|
53
52
|
websocket_1.onerror = function (e) {
|
|
54
53
|
console.error('🔴 WS error', JSON.stringify(e, null, 2));
|
|
55
54
|
};
|
|
56
|
-
websocket_1.onclose = function (e) {
|
|
57
|
-
console.log('❌ WS closed', JSON.stringify(e, null, 2));
|
|
58
|
-
};
|
|
59
55
|
}
|
|
60
56
|
catch (e) {
|
|
61
57
|
reject(e);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConsultationContainer = void 0;
|
|
4
|
+
var react_native_1 = require("react-native");
|
|
5
|
+
var ConsultationContainer = function (_a) {
|
|
6
|
+
var children = _a.children;
|
|
7
|
+
return <react_native_1.View style={styles.container}>{children}</react_native_1.View>;
|
|
8
|
+
};
|
|
9
|
+
exports.ConsultationContainer = ConsultationContainer;
|
|
10
|
+
var styles = react_native_1.StyleSheet.create({
|
|
11
|
+
container: { flex: 1, width: '100%', minWidth: '100%' }
|
|
12
|
+
});
|
|
@@ -20,6 +20,7 @@ export type ConsultationContextProps = ConsultationProviderProps & {
|
|
|
20
20
|
user: User;
|
|
21
21
|
setUser: Dispatch<SetStateAction<User>>;
|
|
22
22
|
slug: string | null;
|
|
23
|
+
initialised: boolean;
|
|
23
24
|
};
|
|
24
25
|
export declare const ConsultationContext: import("react").Context<ConsultationContextProps>;
|
|
25
26
|
export declare const ConsultationProvider: ({ children, token, region, theme, components, onError }: PropsWithChildren<ConsultationProviderProps>) => import("react").JSX.Element;
|
|
@@ -62,7 +62,8 @@ exports.ConsultationContext = (0, react_1.createContext)({
|
|
|
62
62
|
userId: '',
|
|
63
63
|
setUserId: function () { },
|
|
64
64
|
components: function () { return ({}); },
|
|
65
|
-
slug: null
|
|
65
|
+
slug: null,
|
|
66
|
+
initialised: false
|
|
66
67
|
});
|
|
67
68
|
var ConsultationProvider = function (_a) {
|
|
68
69
|
var children = _a.children, token = _a.token, region = _a.region, theme = _a.theme, components = _a.components, _b = _a.onError, onError = _b === void 0 ? function () { } : _b;
|
|
@@ -71,6 +72,7 @@ var ConsultationProvider = function (_a) {
|
|
|
71
72
|
var _e = (0, react_1.useState)(null), user = _e[0], setUser = _e[1];
|
|
72
73
|
var _f = (0, react_1.useState)(null), websocket = _f[0], setWebsocket = _f[1];
|
|
73
74
|
var _g = (0, react_1.useState)(null), slug = _g[0], setSlug = _g[1];
|
|
75
|
+
var _h = (0, react_1.useState)(false), initialised = _h[0], setInitialised = _h[1];
|
|
74
76
|
var handleError = function (e) {
|
|
75
77
|
console.error('🚨 Error caught on handler', e);
|
|
76
78
|
onError(e);
|
|
@@ -124,7 +126,6 @@ var ConsultationProvider = function (_a) {
|
|
|
124
126
|
return [4 /*yield*/, (0, websocket_1.connectWebsocket)({ token: token, userId: userId, region: region })];
|
|
125
127
|
case 10:
|
|
126
128
|
ws = _a.sent();
|
|
127
|
-
console.log('🔗 Websocket connected');
|
|
128
129
|
setWebsocket(ws);
|
|
129
130
|
return [3 /*break*/, 12];
|
|
130
131
|
case 11:
|
|
@@ -178,8 +179,15 @@ var ConsultationProvider = function (_a) {
|
|
|
178
179
|
setConsultation(data.consultation);
|
|
179
180
|
if (data.event === 'websocketError')
|
|
180
181
|
handleError(new Error('Websocket error'));
|
|
181
|
-
if (data.event === 'websocketConnected')
|
|
182
|
+
if (data.event === 'websocketConnected') {
|
|
182
183
|
console.log('🟢🟢 Websocket connected');
|
|
184
|
+
setInitialised(true);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
websocket.onclose = function (e) {
|
|
188
|
+
console.log('❌ WS closed', JSON.stringify(e, null, 2));
|
|
189
|
+
console.log('🔄 Reconnecting...');
|
|
190
|
+
(0, websocket_1.connectWebsocket)({ token: token, userId: userId, region: region }).then(setWebsocket).catch(handleError);
|
|
183
191
|
};
|
|
184
192
|
}, [websocket]);
|
|
185
193
|
var value = {
|
|
@@ -193,7 +201,8 @@ var ConsultationProvider = function (_a) {
|
|
|
193
201
|
onError: handleError,
|
|
194
202
|
user: user,
|
|
195
203
|
setUser: setUser,
|
|
196
|
-
slug: slug
|
|
204
|
+
slug: slug,
|
|
205
|
+
initialised: initialised
|
|
197
206
|
};
|
|
198
207
|
return (<exports.ConsultationContext.Provider value={value}>
|
|
199
208
|
<react_i18next_1.I18nextProvider i18n={i18n_1.default}>
|
|
@@ -3,6 +3,7 @@ import { ConsultationContextProps } from '../contexts/ConsultationContext';
|
|
|
3
3
|
import { CASE_TYPE, Consultation } from '../types/consultation';
|
|
4
4
|
interface UseConsultationProps {
|
|
5
5
|
consultation: ConsultationContextProps['consultation'];
|
|
6
|
+
initialised: ConsultationContextProps['initialised'];
|
|
6
7
|
updateConsultation: (_: Consultation) => void;
|
|
7
8
|
start: (caseType: CASE_TYPE, payload: CreateConsultationRequest) => Promise<Consultation>;
|
|
8
9
|
cancel: () => Promise<Consultation>;
|
|
@@ -50,7 +50,7 @@ var react_1 = require("react");
|
|
|
50
50
|
var useUser_1 = require("./useUser");
|
|
51
51
|
var useConsultation = function () {
|
|
52
52
|
var _a;
|
|
53
|
-
var _b = (0, react_1.useContext)(ConsultationContext_1.ConsultationContext), consultation = _b.consultation, setConsultation = _b.setConsultation, onError = _b.onError;
|
|
53
|
+
var _b = (0, react_1.useContext)(ConsultationContext_1.ConsultationContext), consultation = _b.consultation, setConsultation = _b.setConsultation, onError = _b.onError, initialised = _b.initialised;
|
|
54
54
|
var user = (0, useUser_1.useUser)().user;
|
|
55
55
|
var minLength = (0, react_1.useMemo)(function () {
|
|
56
56
|
switch (user === null || user === void 0 ? void 0 : user.language) {
|
|
@@ -176,7 +176,8 @@ var useConsultation = function () {
|
|
|
176
176
|
start: start,
|
|
177
177
|
cancel: cancel,
|
|
178
178
|
close: close,
|
|
179
|
-
rate: rate
|
|
179
|
+
rate: rate,
|
|
180
|
+
initialised: initialised
|
|
180
181
|
};
|
|
181
182
|
};
|
|
182
183
|
exports.useConsultation = useConsultation;
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.FormPrescription = void 0;
|
|
5
|
+
var ConsultationContainer_1 = require("../../common/components/ConsultationContainer");
|
|
5
6
|
var eventHandler_1 = require("../../common/helpers/eventHandler");
|
|
6
7
|
var useConsultation_1 = require("../../common/hooks/useConsultation");
|
|
7
8
|
var useUser_1 = require("../../common/hooks/useUser");
|
|
8
|
-
var utils_1 = require("../../common/screens/utils");
|
|
9
9
|
var NotValidActiveTypeScreen_1 = require("../../common/screens/NotValidActiveTypeScreen");
|
|
10
|
+
var utils_1 = require("../../common/screens/utils");
|
|
10
11
|
var consultation_1 = require("../../common/types/consultation");
|
|
11
12
|
var valid_active_type_1 = require("../../common/utils/valid-active-type");
|
|
12
13
|
var IndicationSurveyContext_1 = require("../contexts/IndicationSurveyContext");
|
|
@@ -55,12 +56,9 @@ var FormPrescription = function (_a) {
|
|
|
55
56
|
setUserId(userId);
|
|
56
57
|
}, [userId]);
|
|
57
58
|
return (<IndicationSurveyContext_1.IndicationSurveyProvider>
|
|
58
|
-
<
|
|
59
|
+
<ConsultationContainer_1.ConsultationContainer>
|
|
59
60
|
<ConsultationScreen />
|
|
60
|
-
</
|
|
61
|
+
</ConsultationContainer_1.ConsultationContainer>
|
|
61
62
|
</IndicationSurveyContext_1.IndicationSurveyProvider>);
|
|
62
63
|
};
|
|
63
64
|
exports.FormPrescription = FormPrescription;
|
|
64
|
-
var styles = react_native_1.StyleSheet.create({
|
|
65
|
-
container: { flex: 1 }
|
|
66
|
-
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TextConsultation = void 0;
|
|
4
|
+
var ConsultationContainer_1 = require("../../common/components/ConsultationContainer");
|
|
4
5
|
var eventHandler_1 = require("../../common/helpers/eventHandler");
|
|
5
6
|
var useConsultation_1 = require("../../common/hooks/useConsultation");
|
|
6
7
|
var useUser_1 = require("../../common/hooks/useUser");
|
|
7
|
-
var utils_1 = require("../../common/screens/utils");
|
|
8
8
|
var NoConsultationFoundScreen_1 = require("../../common/screens/NoConsultationFoundScreen");
|
|
9
9
|
var NotValidActiveTypeScreen_1 = require("../../common/screens/NotValidActiveTypeScreen");
|
|
10
|
+
var utils_1 = require("../../common/screens/utils");
|
|
10
11
|
var consultation_1 = require("../../common/types/consultation");
|
|
11
12
|
var valid_active_type_1 = require("../../common/utils/valid-active-type");
|
|
12
13
|
var HomeScreen_1 = require("../screens/HomeScreen");
|
|
13
14
|
var react_1 = require("react");
|
|
14
|
-
var react_native_1 = require("react-native");
|
|
15
15
|
var TextConsultation = function (_a) {
|
|
16
16
|
var eventHandlers = _a.eventHandlers, userId = _a.userId;
|
|
17
17
|
var consultation = (0, useConsultation_1.useConsultation)().consultation;
|
|
@@ -33,9 +33,6 @@ var TextConsultation = function (_a) {
|
|
|
33
33
|
return <NoConsultationFoundScreen_1.NoConsultationFoundScreen />;
|
|
34
34
|
return <HomeScreen_1.HomeScreen />;
|
|
35
35
|
}, [consultation]);
|
|
36
|
-
return <
|
|
36
|
+
return <ConsultationContainer_1.ConsultationContainer>{getConsultationScreen(consultation)}</ConsultationContainer_1.ConsultationContainer>;
|
|
37
37
|
};
|
|
38
38
|
exports.TextConsultation = TextConsultation;
|
|
39
|
-
var styles = react_native_1.StyleSheet.create({
|
|
40
|
-
container: { flex: 1 }
|
|
41
|
-
});
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VideoConsultation = void 0;
|
|
4
|
+
var ConsultationContainer_1 = require("../../common/components/ConsultationContainer");
|
|
4
5
|
var eventHandler_1 = require("../../common/helpers/eventHandler");
|
|
5
6
|
var useConsultation_1 = require("../../common/hooks/useConsultation");
|
|
6
7
|
var useUser_1 = require("../../common/hooks/useUser");
|
|
7
|
-
var utils_1 = require("../../common/screens/utils");
|
|
8
8
|
var NoConsultationFoundScreen_1 = require("../../common/screens/NoConsultationFoundScreen");
|
|
9
9
|
var NotValidActiveTypeScreen_1 = require("../../common/screens/NotValidActiveTypeScreen");
|
|
10
10
|
var PreparingSummaryScreen_1 = require("../../common/screens/PreparingSummaryScreen");
|
|
11
|
+
var utils_1 = require("../../common/screens/utils");
|
|
11
12
|
var consultation_1 = require("../../common/types/consultation");
|
|
12
13
|
var valid_active_type_1 = require("../../common/utils/valid-active-type");
|
|
13
14
|
var DeliveryAddressScreen_1 = require("../screens/DeliveryAddressScreen");
|
|
@@ -49,9 +50,6 @@ var VideoConsultation = function (_a) {
|
|
|
49
50
|
throw new Error("Screen not found ".concat(status));
|
|
50
51
|
}
|
|
51
52
|
}, [consultation]);
|
|
52
|
-
return <
|
|
53
|
+
return <ConsultationContainer_1.ConsultationContainer>{getConsultationScreen(consultation)}</ConsultationContainer_1.ConsultationContainer>;
|
|
53
54
|
};
|
|
54
55
|
exports.VideoConsultation = VideoConsultation;
|
|
55
|
-
var styles = react_native_1.StyleSheet.create({
|
|
56
|
-
container: { flex: 1 }
|
|
57
|
-
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abihealth/goapp-react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -15,26 +15,26 @@
|
|
|
15
15
|
"main": "./dist/index.js",
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"axios": "
|
|
19
|
-
"i18next": "
|
|
20
|
-
"phone": "
|
|
21
|
-
"react-i18next": "
|
|
22
|
-
"react-native-agora": "
|
|
23
|
-
"react-native-bouncy-checkbox": "
|
|
18
|
+
"axios": "1.7.9",
|
|
19
|
+
"i18next": "23.16.8",
|
|
20
|
+
"phone": "3.1.58",
|
|
21
|
+
"react-i18next": "14.1.3",
|
|
22
|
+
"react-native-agora": "4.5.2",
|
|
23
|
+
"react-native-bouncy-checkbox": "4.1.2",
|
|
24
24
|
"react-native-date-picker": "5.0.1",
|
|
25
|
-
"react-native-phone-input": "
|
|
26
|
-
"react-native-svg": "
|
|
27
|
-
"zod": "
|
|
25
|
+
"react-native-phone-input": "1.3.7",
|
|
26
|
+
"react-native-svg": "15.11.1",
|
|
27
|
+
"zod": "3.24.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@abiglobalhealth/ts-config": "1.3.0",
|
|
31
|
-
"@tsconfig/react-native": "
|
|
32
|
-
"@types/jest": "
|
|
33
|
-
"@types/react": "
|
|
34
|
-
"@types/react-native": "
|
|
35
|
-
"concurrently": "
|
|
36
|
-
"tsc-alias": "
|
|
37
|
-
"typescript": "
|
|
31
|
+
"@tsconfig/react-native": "3.0.5",
|
|
32
|
+
"@types/jest": "29.5.12",
|
|
33
|
+
"@types/react": "18.3.12",
|
|
34
|
+
"@types/react-native": "0.73.0",
|
|
35
|
+
"concurrently": "9.1.2",
|
|
36
|
+
"tsc-alias": "1.8.10",
|
|
37
|
+
"typescript": "5.7.3"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": ">=18.0.0",
|