@abihealth/goapp-react-native 1.27.0-beta → 1.29.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,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.29.0](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.28.0...goapp-react-native-v1.29.0) (2025-05-14)
4
+
5
+
6
+ ### Features
7
+
8
+ * add caret to axios dependency ([#192](https://github.com/abiglobalhealth/react-native-sdk/issues/192)) ([7088968](https://github.com/abiglobalhealth/react-native-sdk/commit/70889683a39d9e02447cb568bec2fb6009f7129b))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * handle consultation ended event with consultation object ([#195](https://github.com/abiglobalhealth/react-native-sdk/issues/195)) ([e582aaa](https://github.com/abiglobalhealth/react-native-sdk/commit/e582aaa5f257b5e2da36eeb5ba6f4910ff23b8b9))
14
+
15
+ ## [1.28.0](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.27.0-beta...goapp-react-native-v1.28.0) (2025-05-09)
16
+
17
+
18
+ ### Features
19
+
20
+ * remove auth from sdk ([#190](https://github.com/abiglobalhealth/react-native-sdk/issues/190)) ([76cea1f](https://github.com/abiglobalhealth/react-native-sdk/commit/76cea1f5f97128cf9c54b78f2cf62ed77bc0d733))
21
+
3
22
  ## [1.27.0-beta](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.26.0-beta...goapp-react-native-v1.27.0-beta) (2025-05-08)
4
23
 
5
24
 
@@ -1,7 +1,6 @@
1
1
  import { REGION } from './models/region';
2
2
  type BaseUrls = {
3
3
  ws: string;
4
- api: string;
5
4
  sdk: string;
6
5
  };
7
6
  export declare const getBaseUrl: (region: REGION) => BaseUrls;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBaseUrl = void 0;
4
4
  var getBaseUrl = function (region) { return ({
5
- api: "https://".concat(region, ".api.abi.ai"),
6
5
  sdk: "https://".concat(region, ".sdk.abi.ai"),
7
6
  ws: "wss://".concat(region, ".sdk-ws.abi.ai")
8
7
  }); };
@@ -1,3 +1,4 @@
1
+ import { ConsultationContextProps } from '../contexts/ConsultationContext';
1
2
  import { Consultation } from '../types/consultation';
2
3
  import { CONSULTATION_EVENT, EventCallback } from '../types/events';
3
4
  export interface EventHandlers {
@@ -13,4 +14,4 @@ export interface EventHandlers {
13
14
  onConsultationEnded?: EventCallback;
14
15
  }
15
16
  export declare const mapConsultationStatusToEvent: (consultation: Consultation) => CONSULTATION_EVENT;
16
- export declare const handleEvent: (consultation: Consultation, eventHandlers?: EventHandlers) => void;
17
+ export declare const handleEvent: (consultation: ConsultationContextProps["consultation"], eventHandlers?: EventHandlers) => void;
@@ -28,6 +28,8 @@ var handleEvent = function (consultation, eventHandlers) {
28
28
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
29
29
  if (!eventHandlers)
30
30
  return;
31
+ if (!consultation)
32
+ return console.warn('Skipping event handling -> no consultation found');
31
33
  var consultationEvent = (0, exports.mapConsultationStatusToEvent)(consultation);
32
34
  switch (consultationEvent) {
33
35
  case events_1.CONSULTATION_EVENT.CANCELED:
@@ -87,7 +87,7 @@ var RatingScreen = function (_a) {
87
87
  var t = (0, useTranslation_1.useTranslation)().t;
88
88
  var theme = (0, useTheme_1.useTheme)();
89
89
  var styles = getStyles(theme);
90
- var _b = (0, useConsultation_1.useConsultation)(), rate = _b.rate, updateConsultation = _b.updateConsultation;
90
+ var _b = (0, useConsultation_1.useConsultation)(), rate = _b.rate, consultation = _b.consultation, updateConsultation = _b.updateConsultation;
91
91
  var _c = (0, react_1.useState)(false), loading = _c[0], setLoading = _c[1];
92
92
  var _d = react_1.default.useState(null), selectedRating = _d[0], setSelectedRating = _d[1];
93
93
  var _e = (0, react_1.useState)(false), showError = _e[0], setShowError = _e[1];
@@ -107,6 +107,7 @@ var RatingScreen = function (_a) {
107
107
  startShake();
108
108
  }, [showError]);
109
109
  var handleRate = function () { return __awaiter(void 0, void 0, void 0, function () {
110
+ var updatedConsultation;
110
111
  return __generator(this, function (_a) {
111
112
  switch (_a.label) {
112
113
  case 0:
@@ -120,9 +121,9 @@ var RatingScreen = function (_a) {
120
121
  setLoading(true);
121
122
  return [4 /*yield*/, rate(selectedRating)];
122
123
  case 2:
123
- _a.sent();
124
+ updatedConsultation = _a.sent();
125
+ onConsultationEnded === null || onConsultationEnded === void 0 ? void 0 : onConsultationEnded(updatedConsultation);
124
126
  updateConsultation(null);
125
- onConsultationEnded === null || onConsultationEnded === void 0 ? void 0 : onConsultationEnded(null);
126
127
  return [3 /*break*/, 4];
127
128
  case 3:
128
129
  setLoading(false);
@@ -132,8 +133,8 @@ var RatingScreen = function (_a) {
132
133
  });
133
134
  }); };
134
135
  var handleSkip = function () {
136
+ onConsultationEnded === null || onConsultationEnded === void 0 ? void 0 : onConsultationEnded(consultation);
135
137
  updateConsultation(null);
136
- onConsultationEnded === null || onConsultationEnded === void 0 ? void 0 : onConsultationEnded(null);
137
138
  };
138
139
  return (<ScreenWrapper_1.ScreenWrapper header={<ConsultationHeader_1.ConsultationHeader />} containerStyle={styles.container}>
139
140
  <react_native_1.View style={styles.innerContainer}>
package/dist/index.d.ts CHANGED
@@ -3,7 +3,6 @@ import { FindingAnimation } from './common/animations/FindingAnimation/animation
3
3
  import { HorizontalLoadingAnimation } from './common/animations/HorizontalLoadingAnimation/animation';
4
4
  import { LoadingCircleAnimation } from './common/animations/LoadingCircleAnimation/animation';
5
5
  import { LoadingDotsAnimation } from './common/animations/LoadingDotsAnimation/animation';
6
- import { getToken } from './common/api/auth';
7
6
  import { BackgroundPattern } from './common/components/BackgroundPattern';
8
7
  import { Button } from './common/components/Button';
9
8
  import { CancelConsultationButton } from './common/components/CancelConsultationButton';
@@ -70,4 +69,4 @@ import { JoinVideoCallScreen } from './video-consultations/screens/JoinVideoCall
70
69
  import { ProcessingPrescriptionScreen } from './video-consultations/screens/ProcessingPrescriptionScreen';
71
70
  import VideoCallScreen from './video-consultations/screens/VideoCallScreen';
72
71
  export { AbiLogoIcon, AgoraWrapper, Animation, AnswerScreen, AttachmentPreviewModal, BackArrowIcon, BackgroundPattern, Button, CallingAnimation, CancelConsultationButton, CancelModal, Card, CASE_TYPE, Checkbox, CloseConsultationModal, CloseIcon, Consultation, CONSULTATION_STATUS, // TODO check this after last refactor
73
- ConsultationProvider, DateInput, DeliveryAddressScreen, DoctorIcon, DoctorProfileCard, DoctorProfileModal, EndingVideoScreen, EndVideoCallModal, FadeIn, FindingAnimation, FormPrescription, FormWrapper, getProfessionalLabel, getToken, Header, HKDeliveryAddressSchema, HorizontalLoadingAnimation, IndicationCategory, IndicationCategoryType, InfoIcon, Input, isAndroid, isIOS, JoinVideoCallScreen, License, LoadingCircleAnimation, LoadingDotsAnimation, MatchingScreen, MatchScreen, Modal, NoConsultationFoundScreen, PhoneInput, PlaneIcon, PreparingSummaryScreen, Prescription, PRESCRIPTION_STATUS, PrescriptionHomeScreen, ProcessingPrescriptionScreen, Professional, Question, QuestionType, RatingScreen, Reminder, requiredCheckbox, requiredString, ScreenWrapper, SearchableDropDown, Select, Slide, Text, TextConsultation, TextConsultationHomeScreen, TextConsultationIcon, Theme, TwoOptionsModal, useConsultation, useTheme, useTranslation, validPhone, VideoCallScreen, VideoConsultation, VideoConsultationIcon };
72
+ ConsultationProvider, DateInput, DeliveryAddressScreen, DoctorIcon, DoctorProfileCard, DoctorProfileModal, EndingVideoScreen, EndVideoCallModal, FadeIn, FindingAnimation, FormPrescription, FormWrapper, getProfessionalLabel, Header, HKDeliveryAddressSchema, HorizontalLoadingAnimation, IndicationCategory, IndicationCategoryType, InfoIcon, Input, isAndroid, isIOS, JoinVideoCallScreen, License, LoadingCircleAnimation, LoadingDotsAnimation, MatchingScreen, MatchScreen, Modal, NoConsultationFoundScreen, PhoneInput, PlaneIcon, PreparingSummaryScreen, Prescription, PRESCRIPTION_STATUS, PrescriptionHomeScreen, ProcessingPrescriptionScreen, Professional, Question, QuestionType, RatingScreen, Reminder, requiredCheckbox, requiredString, ScreenWrapper, SearchableDropDown, Select, Slide, Text, TextConsultation, TextConsultationHomeScreen, TextConsultationIcon, Theme, TwoOptionsModal, useConsultation, useTheme, useTranslation, validPhone, VideoCallScreen, VideoConsultation, VideoConsultationIcon };
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ 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.PRESCRIPTION_STATUS = exports.PreparingSummaryScreen = exports.PlaneIcon = exports.PhoneInput = exports.NoConsultationFoundScreen = exports.Modal = exports.MatchScreen = exports.MatchingScreen = exports.LoadingDotsAnimation = exports.LoadingCircleAnimation = exports.JoinVideoCallScreen = exports.isIOS = exports.isAndroid = exports.Input = exports.InfoIcon = exports.IndicationCategory = exports.HorizontalLoadingAnimation = exports.HKDeliveryAddressSchema = exports.Header = exports.getToken = exports.getProfessionalLabel = exports.FormWrapper = exports.FormPrescription = exports.FindingAnimation = exports.FadeIn = exports.EndVideoCallModal = exports.EndingVideoScreen = exports.DoctorProfileModal = exports.DoctorProfileCard = exports.DoctorIcon = exports.DeliveryAddressScreen = exports.DateInput = exports.ConsultationProvider = exports.CONSULTATION_STATUS = exports.CloseIcon = exports.CloseConsultationModal = exports.Checkbox = exports.CASE_TYPE = exports.Card = exports.CancelModal = exports.CancelConsultationButton = exports.CallingAnimation = exports.Button = exports.BackgroundPattern = exports.BackArrowIcon = exports.AttachmentPreviewModal = exports.AnswerScreen = exports.Animation = exports.AgoraWrapper = exports.AbiLogoIcon = void 0;
7
- exports.VideoConsultationIcon = exports.VideoConsultation = exports.VideoCallScreen = exports.validPhone = exports.useTranslation = exports.useTheme = exports.useConsultation = exports.TwoOptionsModal = exports.TextConsultationIcon = exports.TextConsultationHomeScreen = exports.TextConsultation = exports.Text = exports.Slide = exports.Select = exports.SearchableDropDown = exports.ScreenWrapper = exports.requiredString = exports.requiredCheckbox = exports.Reminder = exports.RatingScreen = exports.QuestionType = exports.ProcessingPrescriptionScreen = exports.PrescriptionHomeScreen = void 0;
6
+ exports.PrescriptionHomeScreen = exports.PRESCRIPTION_STATUS = exports.PreparingSummaryScreen = exports.PlaneIcon = exports.PhoneInput = exports.NoConsultationFoundScreen = exports.Modal = exports.MatchScreen = exports.MatchingScreen = exports.LoadingDotsAnimation = exports.LoadingCircleAnimation = exports.JoinVideoCallScreen = exports.isIOS = exports.isAndroid = exports.Input = exports.InfoIcon = exports.IndicationCategory = exports.HorizontalLoadingAnimation = exports.HKDeliveryAddressSchema = exports.Header = exports.getProfessionalLabel = exports.FormWrapper = exports.FormPrescription = exports.FindingAnimation = exports.FadeIn = exports.EndVideoCallModal = exports.EndingVideoScreen = exports.DoctorProfileModal = exports.DoctorProfileCard = exports.DoctorIcon = exports.DeliveryAddressScreen = exports.DateInput = exports.ConsultationProvider = exports.CONSULTATION_STATUS = exports.CloseIcon = exports.CloseConsultationModal = exports.Checkbox = exports.CASE_TYPE = exports.Card = exports.CancelModal = exports.CancelConsultationButton = exports.CallingAnimation = exports.Button = exports.BackgroundPattern = exports.BackArrowIcon = exports.AttachmentPreviewModal = exports.AnswerScreen = exports.Animation = exports.AgoraWrapper = exports.AbiLogoIcon = void 0;
7
+ exports.VideoConsultationIcon = exports.VideoConsultation = exports.VideoCallScreen = exports.validPhone = exports.useTranslation = exports.useTheme = exports.useConsultation = exports.TwoOptionsModal = exports.TextConsultationIcon = exports.TextConsultationHomeScreen = exports.TextConsultation = exports.Text = exports.Slide = exports.Select = exports.SearchableDropDown = exports.ScreenWrapper = exports.requiredString = exports.requiredCheckbox = exports.Reminder = exports.RatingScreen = exports.QuestionType = exports.ProcessingPrescriptionScreen = void 0;
8
8
  var Animation_1 = require("./common/animations/Animation");
9
9
  Object.defineProperty(exports, "Animation", { enumerable: true, get: function () { return Animation_1.Animation; } });
10
10
  var animation_1 = require("./common/animations/FindingAnimation/animation");
@@ -15,8 +15,6 @@ var animation_3 = require("./common/animations/LoadingCircleAnimation/animation"
15
15
  Object.defineProperty(exports, "LoadingCircleAnimation", { enumerable: true, get: function () { return animation_3.LoadingCircleAnimation; } });
16
16
  var animation_4 = require("./common/animations/LoadingDotsAnimation/animation");
17
17
  Object.defineProperty(exports, "LoadingDotsAnimation", { enumerable: true, get: function () { return animation_4.LoadingDotsAnimation; } });
18
- var auth_1 = require("./common/api/auth");
19
- Object.defineProperty(exports, "getToken", { enumerable: true, get: function () { return auth_1.getToken; } });
20
18
  var BackgroundPattern_1 = require("./common/components/BackgroundPattern");
21
19
  Object.defineProperty(exports, "BackgroundPattern", { enumerable: true, get: function () { return BackgroundPattern_1.BackgroundPattern; } });
22
20
  var Button_1 = require("./common/components/Button");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abihealth/goapp-react-native",
3
- "version": "1.27.0-beta",
3
+ "version": "1.29.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -15,7 +15,7 @@
15
15
  "main": "./dist/index.js",
16
16
  "types": "./dist/index.d.ts",
17
17
  "dependencies": {
18
- "axios": "1.7.9",
18
+ "axios": "^1.8.0",
19
19
  "i18next": "23.16.8",
20
20
  "phone": "3.1.58",
21
21
  "react-i18next": "14.1.3",
@@ -1,9 +0,0 @@
1
- import { REGION } from './models/region';
2
- interface GetTokenProps {
3
- region: REGION;
4
- clientKey: string;
5
- userId: string;
6
- subPartnerName?: string;
7
- }
8
- export declare const getToken: ({ region, clientKey, userId, subPartnerName }: GetTokenProps) => Promise<string>;
9
- export {};
@@ -1,92 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getToken = void 0;
40
- var config_1 = require("./config");
41
- var PARTNER_AUTH_URL = 'partner/authorization/token';
42
- var USER_AUTH_URL = 'user/authorization/token';
43
- // TODO: REMOVE and use ./base one when euw1.api.abi.ai is available
44
- var getBaseUrl = function (_) { return ({
45
- api: "https://client-api.abi.ai"
46
- }); };
47
- var getPartnerToken = function (_a) {
48
- var region = _a.region, clientKey = _a.clientKey, subPartnerName = _a.subPartnerName;
49
- return config_1.axios
50
- .post("".concat(getBaseUrl(region).api, "/").concat(PARTNER_AUTH_URL), {
51
- subPartnerName: subPartnerName
52
- }, {
53
- headers: {
54
- 'x-api-key': clientKey
55
- }
56
- })
57
- .then(function (response) { return response === null || response === void 0 ? void 0 : response.data; });
58
- };
59
- var getUserToken = function (_a) {
60
- var userId = _a.userId, region = _a.region, partnerToken = _a.partnerToken;
61
- return config_1.axios
62
- .post("".concat(getBaseUrl(region).api, "/").concat(USER_AUTH_URL), {
63
- userId: userId
64
- }, {
65
- headers: {
66
- Authorization: "Bearer ".concat(partnerToken)
67
- }
68
- })
69
- .then(function (response) { return response === null || response === void 0 ? void 0 : response.data; });
70
- };
71
- var getToken = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
72
- var partnerToken, userToken;
73
- var region = _b.region, clientKey = _b.clientKey, userId = _b.userId, subPartnerName = _b.subPartnerName;
74
- return __generator(this, function (_c) {
75
- switch (_c.label) {
76
- case 0: return [4 /*yield*/, getPartnerToken({ region: region, clientKey: clientKey, subPartnerName: subPartnerName }).catch(function (e) {
77
- console.error('Error getting partner token', e);
78
- throw e;
79
- })];
80
- case 1:
81
- partnerToken = (_c.sent()).access_token;
82
- return [4 /*yield*/, getUserToken({ userId: userId, region: region, partnerToken: partnerToken }).catch(function (e) {
83
- console.error('Error getting user token', e);
84
- throw e;
85
- })];
86
- case 2:
87
- userToken = (_c.sent()).access_token;
88
- return [2 /*return*/, userToken];
89
- }
90
- });
91
- }); };
92
- exports.getToken = getToken;
@@ -1,15 +0,0 @@
1
- import { REGION } from './region';
2
- export interface PartnerAuthorizationRequest {
3
- clientKey: string;
4
- region: REGION;
5
- subPartnerName?: string;
6
- }
7
- export interface UserAuthorizationRequest {
8
- userId: string;
9
- region: REGION;
10
- partnerToken: string;
11
- }
12
- export interface AuthorizationResponse {
13
- access_token: string;
14
- refresh_token: string;
15
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });