@abihealth/goapp-react-native 1.16.0 → 1.17.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.17.0](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.16.0...goapp-react-native-v1.17.0) (2025-03-18)
4
+
5
+
6
+ ### Features
7
+
8
+ * include delivery address flow for prescriptions ([#143](https://github.com/abiglobalhealth/react-native-sdk/issues/143)) ([2472831](https://github.com/abiglobalhealth/react-native-sdk/commit/2472831f540bd07ba857457187643a43bd47bfdc))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * answer screen could be undefined ([#141](https://github.com/abiglobalhealth/react-native-sdk/issues/141)) ([3fed4b6](https://github.com/abiglobalhealth/react-native-sdk/commit/3fed4b660073a41ba171b148213a4b1b64b99630))
14
+
3
15
  ## [1.16.0](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.15.0...goapp-react-native-v1.16.0) (2025-03-14)
4
16
 
5
17
 
@@ -0,0 +1,3 @@
1
+ export interface SuccessResponse {
2
+ success: boolean;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const WarningIcon: () => React.JSX.Element;
3
+ export default WarningIcon;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ var useTheme_1 = require("../hooks/useTheme");
37
+ var React = __importStar(require("react"));
38
+ var react_native_svg_1 = __importStar(require("react-native-svg"));
39
+ var WarningIcon = function () {
40
+ var palette = (0, useTheme_1.useTheme)().palette;
41
+ return (<react_native_svg_1.default width={31} height={32} fill="none">
42
+ <react_native_svg_1.Path fill={palette.highlight} d="M11 5.5h9v20h-9z"/>
43
+ <react_native_svg_1.Path fill={palette.white} d="M15.5 8.25a1.5 1.5 0 0 0-1.104.446A1.5 1.5 0 0 0 13.95 9.8V16c0 .44.149.807.446 1.104a1.5 1.5 0 0 0 1.104.446 1.5 1.5 0 0 0 1.104-.446A1.5 1.5 0 0 0 17.05 16V9.8a1.5 1.5 0 0 0-.446-1.104A1.5 1.5 0 0 0 15.5 8.25Zm0 12.4a1.5 1.5 0 0 0-1.104.446 1.5 1.5 0 0 0-.446 1.104c0 .44.149.807.446 1.104a1.5 1.5 0 0 0 1.104.446 1.5 1.5 0 0 0 1.104-.446 1.5 1.5 0 0 0 .446-1.104 1.5 1.5 0 0 0-.446-1.104 1.5 1.5 0 0 0-1.104-.446ZM15.5.5c2.144 0 4.16.407 6.045 1.22 1.886.814 3.526 1.919 4.921 3.314 1.395 1.395 2.5 3.035 3.313 4.921C30.593 11.841 31 13.855 31 16c0 2.144-.407 4.16-1.22 6.045-.814 1.886-1.919 3.526-3.314 4.921-1.395 1.395-3.035 2.5-4.921 3.313-1.886.814-3.9 1.221-6.045 1.221-2.144 0-4.16-.407-6.045-1.22-1.886-.814-3.526-1.919-4.921-3.314-1.395-1.395-2.5-3.035-3.313-4.921C.407 20.159 0 18.145 0 16c0-2.144.407-4.16 1.22-6.045.814-1.886 1.919-3.526 3.314-4.921 1.395-1.395 3.035-2.5 4.921-3.313C11.341.907 13.355.5 15.5.5Z"/>
44
+ </react_native_svg_1.default>);
45
+ };
46
+ exports.default = WarningIcon;
@@ -400,6 +400,7 @@
400
400
  "download.summary_being_prepared": "Your summary is being prepared.",
401
401
  "download.summary_getting_ready": "The summary is getting ready.",
402
402
  "download.usually_takes": "This usually takes less than 1 min.",
403
+ "error.address": "There is a problem with your address. Please check it and try again.",
403
404
  "error.case_already_open": "You already have a case open in another location. Please complete the case there first.",
404
405
  "error.something_went_wrong": "Something went wrong, please try again later",
405
406
  "error.validation.attachment.duplicated": "Attachment is already added",
@@ -760,7 +761,10 @@
760
761
  "physician_title_female": "Dr. {{name}}",
761
762
  "physician_title_male": "Dr. {{name}}",
762
763
  "placeholder.text": "Ask a health question.",
764
+ "prescription.categories.no_results.description": "Please try different terms.",
765
+ "prescription.categories.no_results.title": "No results found.",
763
766
  "prescription.categories.searchbar": "Search for a condition or medicine",
767
+ "prescription.categories.title": "Search for a condition or medicine",
764
768
  "prescription.patient.address": "Please fill in your address, which is required to generate your prescription.",
765
769
  "prescription.request.approved": "Prescription issued.",
766
770
  "prescription.request.approved.delivery": "Your prescription will be delivered to the selected address.",
@@ -4,15 +4,18 @@ export declare const HKDeliveryAddressSchema: z.ZodObject<{
4
4
  building: z.ZodString;
5
5
  street: z.ZodString;
6
6
  district: z.ZodString;
7
+ country: z.ZodOptional<z.ZodString>;
7
8
  }, "strip", z.ZodTypeAny, {
8
9
  house?: string;
9
10
  building?: string;
10
11
  street?: string;
11
12
  district?: string;
13
+ country?: string;
12
14
  }, {
13
15
  house?: string;
14
16
  building?: string;
15
17
  street?: string;
16
18
  district?: string;
19
+ country?: string;
17
20
  }>;
18
21
  export type HKDeliveryAddress = z.infer<typeof HKDeliveryAddressSchema>;
@@ -7,5 +7,6 @@ exports.HKDeliveryAddressSchema = zod_2.z.object({
7
7
  house: zod_1.requiredString,
8
8
  building: zod_1.requiredString,
9
9
  street: zod_1.requiredString,
10
- district: zod_1.requiredString
10
+ district: zod_1.requiredString,
11
+ country: zod_2.z.string().optional()
11
12
  });
@@ -1,3 +1,6 @@
1
1
  import { ConsultationResponse } from '../../common/api/models/consultation';
2
+ import { Consultation } from '../../common/types/consultation';
3
+ import { HKDeliveryAddress } from '../../common/types/deliveryAddress';
2
4
  import { HangOutRequest } from './models/video';
3
5
  export declare const hangOutVideocall: (body: HangOutRequest) => Promise<ConsultationResponse>;
6
+ export declare const updateDeliveryAddress: (consultationId: string, address: HKDeliveryAddress) => Promise<Consultation>;
@@ -3,10 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.hangOutVideocall = void 0;
6
+ exports.updateDeliveryAddress = exports.hangOutVideocall = void 0;
7
7
  var axios_1 = __importDefault(require("axios"));
8
8
  var HANGOUT_URL = "/video-consultation/hangout";
9
+ var DELIVERY_ADDRESS_URL = function (consultationId) { return "/video-consultation/".concat(consultationId, "/update-delivery-address"); };
9
10
  var hangOutVideocall = function (body) {
10
11
  return axios_1.default.patch(HANGOUT_URL, body).then(function (response) { return response === null || response === void 0 ? void 0 : response.data; });
11
12
  };
12
13
  exports.hangOutVideocall = hangOutVideocall;
14
+ var updateDeliveryAddress = function (consultationId, address) {
15
+ return axios_1.default.post(DELIVERY_ADDRESS_URL(consultationId), { address: address }).then(function (response) { return response === null || response === void 0 ? void 0 : response.data; });
16
+ };
17
+ exports.updateDeliveryAddress = updateDeliveryAddress;
@@ -13,6 +13,7 @@ var consultation_1 = require("../../common/types/consultation");
13
13
  var valid_active_type_1 = require("../../common/utils/valid-active-type");
14
14
  var DeliveryAddressScreen_1 = require("../screens/DeliveryAddressScreen");
15
15
  var JoinVideoCallScreen_1 = require("../screens/JoinVideoCallScreen");
16
+ var ProcessingPrescriptionScreen_1 = require("../screens/ProcessingPrescriptionScreen");
16
17
  var react_1 = require("react");
17
18
  var react_native_1 = require("react-native");
18
19
  var VideoConsultation = function (_a) {
@@ -36,13 +37,15 @@ var VideoConsultation = function (_a) {
36
37
  return commonScreen;
37
38
  if (!consultation)
38
39
  return <NoConsultationFoundScreen_1.NoConsultationFoundScreen />;
39
- var status = consultation.status, professional = consultation.professional;
40
+ var status = consultation.status, professional = consultation.professional, prescription = consultation.prescription;
40
41
  switch (status) {
41
42
  case consultation_1.CONSULTATION_STATUS.ONGOING_VIDEO_CALL:
42
43
  return <JoinVideoCallScreen_1.JoinVideoCallScreen professional={professional}/>;
43
44
  case consultation_1.CONSULTATION_STATUS.VIDEO_CALL_ENDED:
44
45
  return <PreparingSummaryScreen_1.PreparingSummaryScreen professional={professional}/>;
45
46
  case consultation_1.CONSULTATION_STATUS.WAITING_FOR_INFO:
47
+ if (prescription === null || prescription === void 0 ? void 0 : prescription.deliveryAddress)
48
+ return <ProcessingPrescriptionScreen_1.ProcessingPrescriptionScreen />;
46
49
  return <DeliveryAddressScreen_1.DeliveryAddressScreen />;
47
50
  default:
48
51
  react_native_1.Alert.alert('Screen not found', status);
@@ -1,4 +1,48 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
2
46
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
47
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
48
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -46,17 +90,41 @@ var Header_1 = require("../../common/components/Header");
46
90
  var Input_1 = __importDefault(require("../../common/components/Input"));
47
91
  var ScreenWrapper_1 = require("../../common/components/ScreenWrapper");
48
92
  var Text_1 = require("../../common/components/Text");
93
+ var useConsultation_1 = require("../../common/hooks/useConsultation");
49
94
  var useTheme_1 = require("../../common/hooks/useTheme");
50
95
  var useTranslation_1 = require("../../common/hooks/useTranslation");
96
+ var WarningIcon_1 = __importDefault(require("../../common/icons/WarningIcon"));
51
97
  var deliveryAddress_1 = require("../../common/types/deliveryAddress");
98
+ var video_1 = require("../api/video");
52
99
  var VideoConsultationIcon_1 = require("../icons/VideoConsultationIcon");
53
- var react_1 = __importDefault(require("react"));
100
+ var react_1 = __importStar(require("react"));
54
101
  var react_native_1 = require("react-native");
55
102
  var DeliveryAddressScreen = function () {
56
103
  var t = (0, useTranslation_1.useTranslation)().t;
57
104
  var theme = (0, useTheme_1.useTheme)();
58
105
  var styles = getStyles(theme);
106
+ var _a = (0, useConsultation_1.useConsultation)(), consultation = _a.consultation, updateConsultation = _a.updateConsultation;
107
+ var _b = (0, react_1.useState)(false), loading = _b[0], setLoading = _b[1];
108
+ var _c = (0, react_1.useState)(null), error = _c[0], setError = _c[1];
109
+ var onSubmit = function (data) { return __awaiter(void 0, void 0, void 0, function () {
110
+ return __generator(this, function (_a) {
111
+ setError(false);
112
+ setLoading(true);
113
+ (0, video_1.updateDeliveryAddress)(consultation === null || consultation === void 0 ? void 0 : consultation.id, __assign(__assign({}, data), { country: t('country.hk') }))
114
+ .then(function (res) {
115
+ console.log('esta es la respuesta', res);
116
+ updateConsultation(res);
117
+ })
118
+ .catch(function () { return setError(true); })
119
+ .finally(function () { return setLoading(false); });
120
+ return [2 /*return*/];
121
+ });
122
+ }); };
59
123
  return (<ScreenWrapper_1.ScreenWrapper header={<Header_1.Header title={t('general.consultation.videoConsultation.title')} leftIcon={<VideoConsultationIcon_1.VideoConsultationIcon />}/>} containerStyle={styles.container}>
124
+ {error && (<react_native_1.View style={styles.error}>
125
+ <WarningIcon_1.default />
126
+ <Text_1.Text style={styles.warningText}>{t('error.address')}</Text_1.Text>
127
+ </react_native_1.View>)}
60
128
  <react_native_1.View>
61
129
  <Text_1.Text variant="h2" center>
62
130
  {t('delivery.address.title')}
@@ -65,16 +133,10 @@ var DeliveryAddressScreen = function () {
65
133
  </react_native_1.View>
66
134
 
67
135
  <FormWrapper_1.FormWrapper schema={deliveryAddress_1.HKDeliveryAddressSchema} onSubmit={{
68
- onSuccess: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
69
- return [2 /*return*/, react_native_1.Alert.alert('Screen:success')];
70
- }); }); },
71
- onError: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
72
- return [2 /*return*/, react_native_1.Alert.alert('Screen:error')];
73
- }); }); },
74
- onFinally: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
75
- return [2 /*return*/, react_native_1.Alert.alert('Screen:finally')];
76
- }); }); }
77
- }} submitButton={<Button_1.Button submit>{t('button.confirm')}</Button_1.Button>}>
136
+ onSuccess: onSubmit
137
+ }} submitButton={<Button_1.Button submit loading={loading}>
138
+ {t('button.confirm')}
139
+ </Button_1.Button>}>
78
140
  <Input_1.default id="house" label={t('delivery.address.number_and_floor')} placeholder={t('delivery.address.number_and_floor.placeholder')}/>
79
141
  <Input_1.default id="street" label={t('delivery.address.street')} placeholder={t('delivery.address.street.placeholder')}/>
80
142
  <Input_1.default id="building" label={t('delivery.address.building_name_number')} placeholder={t('delivery.address.building_name_number.placeholder')}/>
@@ -84,10 +146,23 @@ var DeliveryAddressScreen = function () {
84
146
  };
85
147
  exports.DeliveryAddressScreen = DeliveryAddressScreen;
86
148
  var getStyles = function (_a) {
87
- var spacing = _a.spacing;
149
+ var spacing = _a.spacing, palette = _a.palette, borderRadius = _a.borderRadius;
88
150
  return react_native_1.StyleSheet.create({
89
151
  container: {
90
152
  rowGap: spacing.xl
153
+ },
154
+ error: {
155
+ backgroundColor: palette.highlight,
156
+ borderRadius: borderRadius.md,
157
+ width: '100%',
158
+ paddingVertical: spacing.sm,
159
+ paddingHorizontal: spacing.md,
160
+ flexDirection: 'row',
161
+ alignItems: 'center'
162
+ },
163
+ warningText: {
164
+ color: palette.white,
165
+ marginLeft: spacing.sm
91
166
  }
92
167
  });
93
168
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abihealth/goapp-react-native",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -14,6 +14,17 @@
14
14
  "main": "./dist/index.js",
15
15
  "types": "./dist/index.d.ts",
16
16
  "type": "module",
17
+ "scripts": {
18
+ "copy-assets:common": "mkdir -p dist/common/assets && cp -r src/common/assets dist/common || true",
19
+ "copy-assets:video-consultations": "mkdir -p dist/video-consultations/assets && cp -r src/video-consultations/assets dist/video-consultations || true",
20
+ "build": "rm -rf dist && pnpm copy-assets:common && pnpm copy-assets:video-consultations && tsc && tsc-alias",
21
+ "build:watch": "concurrently --kill-others \"tsc -w\" \"tsc-alias -w\"",
22
+ "start": "pnpm build:watch",
23
+ "start:ios": "pnpm start",
24
+ "type-check": "tsc --noEmit",
25
+ "lint": "eslint --fix",
26
+ "update-phrase": "npx -y phrase-cli pull"
27
+ },
17
28
  "dependencies": {
18
29
  "@sentry/react-native": "^6.7.0",
19
30
  "axios": "^1.7.9",
@@ -45,16 +56,5 @@
45
56
  },
46
57
  "exports": {
47
58
  ".": "./dist/index.js"
48
- },
49
- "scripts": {
50
- "copy-assets:common": "mkdir -p dist/common/assets && cp -r src/common/assets dist/common || true",
51
- "copy-assets:video-consultations": "mkdir -p dist/video-consultations/assets && cp -r src/video-consultations/assets dist/video-consultations || true",
52
- "build": "rm -rf dist && pnpm copy-assets:common && pnpm copy-assets:video-consultations && tsc && tsc-alias",
53
- "build:watch": "concurrently --kill-others \"tsc -w\" \"tsc-alias -w\"",
54
- "start": "pnpm build:watch",
55
- "start:ios": "pnpm start",
56
- "type-check": "tsc --noEmit",
57
- "lint": "eslint --fix",
58
- "update-phrase": "npx -y phrase-cli pull"
59
59
  }
60
- }
60
+ }