medos-sdk 1.1.4 → 1.1.6
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/dist/components/ContactPreferenceStep.js +1 -7
- package/dist/components/EnquiryForm.js +3 -3
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/services/EnquiryService.d.ts +1 -1
- package/dist/services/EnquiryService.js +17 -14
- package/dist/vanilla/constants/index.d.ts +1 -1
- package/dist/vanilla/enquiry-widget.js +18 -15
- package/dist/vanilla/services/EnquiryService.d.ts +1 -1
- package/dist/vanilla/widget.js +18 -15
- package/package.json +1 -1
|
@@ -6,11 +6,5 @@ export const ContactPreferenceStep = ({ preferredContactMethod, onContactMethodC
|
|
|
6
6
|
const PHONE_VERIFY_STYLES = getPhoneVerifyStyles(theme);
|
|
7
7
|
const BUTTON_STYLES = getButtonStyles(theme);
|
|
8
8
|
const CONTAINER_STYLES = getContainerStyles(theme);
|
|
9
|
-
return (_jsxs("div", { children: [_jsxs("div", { style: { marginBottom: "16px" }, children: [_jsx("label", { style: PHONE_VERIFY_STYLES.label, children: "Preferred Contact Method" }), _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [_jsxs("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [_jsx("input", { type: "radio", name: "contactMethod", value: "PHONE", checked: preferredContactMethod === "PHONE", onChange: (e) => onContactMethodChange(e.target.value) }), "Phone"] }), _jsxs("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [_jsx("input", { type: "radio", name: "contactMethod", value: "EMAIL", checked: preferredContactMethod === "EMAIL", onChange: (e) => onContactMethodChange(e.target.value) }), "Email"] }), _jsxs("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [_jsx("input", { type: "radio", name: "contactMethod", value: "BOTH", checked: preferredContactMethod === "BOTH", onChange: (e) => onContactMethodChange(e.target.value) }), "Both"] })] })] }), _jsxs("div", { style: CONTAINER_STYLES.actions, children: [_jsx("button", { onClick: onBack, style: BUTTON_STYLES.secondary, children: "Back" }), _jsx("button", { onClick: onSubmit,
|
|
10
|
-
...BUTTON_STYLES.primary,
|
|
11
|
-
backgroundColor: isLoading
|
|
12
|
-
? "#ccc"
|
|
13
|
-
: BUTTON_STYLES.primary.backgroundColor,
|
|
14
|
-
cursor: isLoading ? "not-allowed" : "pointer",
|
|
15
|
-
}, children: isLoading ? "Submitting..." : "Submit" })] })] }));
|
|
9
|
+
return (_jsxs("div", { children: [_jsxs("div", { style: { marginBottom: "16px" }, children: [_jsx("label", { style: PHONE_VERIFY_STYLES.label, children: "Preferred Contact Method" }), _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [_jsxs("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [_jsx("input", { type: "radio", name: "contactMethod", value: "PHONE", checked: preferredContactMethod === "PHONE", onChange: (e) => onContactMethodChange(e.target.value) }), "Phone"] }), _jsxs("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [_jsx("input", { type: "radio", name: "contactMethod", value: "EMAIL", checked: preferredContactMethod === "EMAIL", onChange: (e) => onContactMethodChange(e.target.value) }), "Email"] }), _jsxs("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [_jsx("input", { type: "radio", name: "contactMethod", value: "BOTH", checked: preferredContactMethod === "BOTH", onChange: (e) => onContactMethodChange(e.target.value) }), "Both"] })] })] }), _jsxs("div", { style: CONTAINER_STYLES.actions, children: [_jsx("button", { onClick: onBack, style: BUTTON_STYLES.secondary, children: "Back" }), _jsx("button", { onClick: onSubmit, style: BUTTON_STYLES.primary, children: isLoading ? "Submitting..." : "Submit" })] })] }));
|
|
16
10
|
};
|
|
@@ -120,6 +120,9 @@ export const EnquiryForm = ({ onSuccess, onError, }) => {
|
|
|
120
120
|
const goBack = useCallback(() => {
|
|
121
121
|
dispatch({ type: "SET_STEP", payload: Math.max(0, state.step - 1) });
|
|
122
122
|
}, [state.step]);
|
|
123
|
+
const resetForm = useCallback(() => {
|
|
124
|
+
dispatch({ type: "RESET_FORM" });
|
|
125
|
+
}, []);
|
|
123
126
|
const submitEnquiry = useCallback(async () => {
|
|
124
127
|
dispatch({ type: "SET_ERROR", payload: null });
|
|
125
128
|
if (!validateContactStep() || !validateInquiryStep()) {
|
|
@@ -149,9 +152,6 @@ export const EnquiryForm = ({ onSuccess, onError, }) => {
|
|
|
149
152
|
dispatch({ type: "SET_LOADING", payload: false });
|
|
150
153
|
}
|
|
151
154
|
}, [state, validateContactStep, validateInquiryStep, onSuccess, onError]);
|
|
152
|
-
const resetForm = useCallback(() => {
|
|
153
|
-
dispatch({ type: "RESET_FORM" });
|
|
154
|
-
}, []);
|
|
155
155
|
const theme = useTheme();
|
|
156
156
|
const styles = getStyles(theme);
|
|
157
157
|
return (_jsx("div", { style: styles.container, children: _jsxs("div", { style: styles.card, children: [_jsxs("div", { style: styles.header, children: [_jsx("h2", { style: styles.title, children: "Submit Inquiry" }), _jsxs("p", { style: styles.stepIndicator, children: ["Step ", state.step + 1, " of 4"] })] }), _jsxs("div", { style: styles.content, children: [state.loading && _jsx("div", { style: { marginBottom: 12 }, children: "Loading..." }), state.error && _jsx("div", { style: styles.errorMessage, children: state.error }), state.step === 0 && (_jsx(ContactInformationStep, { patientName: state.patientName, patientEmail: state.patientEmail, countryCode: state.countryCode, patientPhone: state.patientPhone, onNameChange: (value) => dispatch({ type: "SET_PATIENT_NAME", payload: value }), onEmailChange: (value) => dispatch({ type: "SET_PATIENT_EMAIL", payload: value }), onCountryCodeChange: (value) => dispatch({ type: "SET_COUNTRY_CODE", payload: value }), onPhoneChange: (value) => dispatch({ type: "SET_PATIENT_PHONE", payload: value }), onNext: goToNext })), state.step === 1 && (_jsx(InquiryDetailsStep, { inquirySubject: state.inquirySubject, inquiryMessage: state.inquiryMessage, onSubjectChange: (value) => dispatch({ type: "SET_INQUIRY_SUBJECT", payload: value }), onMessageChange: (value) => dispatch({ type: "SET_INQUIRY_MESSAGE", payload: value }), onBack: goBack, onNext: goToNext })), state.step === 2 && (_jsx(ContactPreferenceStep, { preferredContactMethod: state.preferredContactMethod, onContactMethodChange: (method) => dispatch({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const API_BASE_URL = "https://api.medos.one";
|
|
1
|
+
export declare const API_BASE_URL = "https://api.medos.one/v1";
|
package/dist/constants/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const API_BASE_URL = "https://api.medos.one";
|
|
1
|
+
export const API_BASE_URL = "https://api.medos.one/v1";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnquirySubmission } from "../enquiry-form/types";
|
|
2
2
|
declare const EnquiryService: {
|
|
3
|
-
submitEnquiry(payload: EnquirySubmission): Promise<any>;
|
|
3
|
+
submitEnquiry(payload: EnquirySubmission, workspaceId?: number, addressId?: number, doctorId?: number): Promise<any>;
|
|
4
4
|
};
|
|
5
5
|
export { EnquiryService };
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { MedosClient } from "../client/MedosClient";
|
|
2
2
|
const EnquiryService = {
|
|
3
|
-
async submitEnquiry(payload) {
|
|
3
|
+
async submitEnquiry(payload, workspaceId, addressId, doctorId) {
|
|
4
4
|
try {
|
|
5
5
|
const client = await MedosClient.ensureInitialized();
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
preferredContactMethod: payload.preferredContactMethod,
|
|
6
|
+
const enquiryPayload = {
|
|
7
|
+
type: "ENQUIRY",
|
|
8
|
+
subject: payload.inquirySubject,
|
|
9
|
+
description: payload.inquiryMessage,
|
|
10
|
+
senderName: payload.patientName,
|
|
11
|
+
senderEmail: payload.patientEmail,
|
|
12
|
+
senderPhone: `${payload.countryCode}${payload.patientPhone}`,
|
|
14
13
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (workspaceId !== undefined)
|
|
15
|
+
enquiryPayload.workspaceId = workspaceId;
|
|
16
|
+
if (addressId !== undefined)
|
|
17
|
+
enquiryPayload.addressId = addressId;
|
|
18
|
+
if (doctorId !== undefined)
|
|
19
|
+
enquiryPayload.doctorId = doctorId;
|
|
20
|
+
const formData = new FormData();
|
|
21
|
+
formData.append("payload", JSON.stringify(enquiryPayload));
|
|
22
|
+
const res = await client.post("/inbox/create", formData);
|
|
20
23
|
return res.data;
|
|
21
24
|
}
|
|
22
25
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const API_BASE_URL = "https://api.medos.one";
|
|
1
|
+
export declare const API_BASE_URL = "https://api.medos.one/v1";
|
|
@@ -3847,7 +3847,7 @@
|
|
|
3847
3847
|
mergeConfig
|
|
3848
3848
|
} = axios;
|
|
3849
3849
|
|
|
3850
|
-
const API_BASE_URL = "https://api.medos.one";
|
|
3850
|
+
const API_BASE_URL = "https://api.medos.one/v1";
|
|
3851
3851
|
|
|
3852
3852
|
let sessionToken = null;
|
|
3853
3853
|
const AuthService = {
|
|
@@ -4174,23 +4174,26 @@
|
|
|
4174
4174
|
MedosClient.initPromise = null;
|
|
4175
4175
|
|
|
4176
4176
|
const EnquiryService = {
|
|
4177
|
-
async submitEnquiry(payload) {
|
|
4177
|
+
async submitEnquiry(payload, workspaceId, addressId, doctorId) {
|
|
4178
4178
|
try {
|
|
4179
4179
|
const client = await MedosClient.ensureInitialized();
|
|
4180
|
-
const
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
preferredContactMethod: payload.preferredContactMethod,
|
|
4180
|
+
const enquiryPayload = {
|
|
4181
|
+
type: "ENQUIRY",
|
|
4182
|
+
subject: payload.inquirySubject,
|
|
4183
|
+
description: payload.inquiryMessage,
|
|
4184
|
+
senderName: payload.patientName,
|
|
4185
|
+
senderEmail: payload.patientEmail,
|
|
4186
|
+
senderPhone: `${payload.countryCode}${payload.patientPhone}`,
|
|
4188
4187
|
};
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4188
|
+
if (workspaceId !== undefined)
|
|
4189
|
+
enquiryPayload.workspaceId = workspaceId;
|
|
4190
|
+
if (addressId !== undefined)
|
|
4191
|
+
enquiryPayload.addressId = addressId;
|
|
4192
|
+
if (doctorId !== undefined)
|
|
4193
|
+
enquiryPayload.doctorId = doctorId;
|
|
4194
|
+
const formData = new FormData();
|
|
4195
|
+
formData.append("payload", JSON.stringify(enquiryPayload));
|
|
4196
|
+
const res = await client.post("/inbox/create", formData);
|
|
4194
4197
|
return res.data;
|
|
4195
4198
|
}
|
|
4196
4199
|
catch (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnquirySubmission } from "../enquiry-form/types";
|
|
2
2
|
declare const EnquiryService: {
|
|
3
|
-
submitEnquiry(payload: EnquirySubmission): Promise<any>;
|
|
3
|
+
submitEnquiry(payload: EnquirySubmission, workspaceId?: number, addressId?: number, doctorId?: number): Promise<any>;
|
|
4
4
|
};
|
|
5
5
|
export { EnquiryService };
|
package/dist/vanilla/widget.js
CHANGED
|
@@ -3847,7 +3847,7 @@
|
|
|
3847
3847
|
mergeConfig
|
|
3848
3848
|
} = axios;
|
|
3849
3849
|
|
|
3850
|
-
const API_BASE_URL = "https://api.medos.one";
|
|
3850
|
+
const API_BASE_URL = "https://api.medos.one/v1";
|
|
3851
3851
|
|
|
3852
3852
|
let sessionToken = null;
|
|
3853
3853
|
const AuthService = {
|
|
@@ -5072,23 +5072,26 @@
|
|
|
5072
5072
|
}
|
|
5073
5073
|
|
|
5074
5074
|
const EnquiryService = {
|
|
5075
|
-
async submitEnquiry(payload) {
|
|
5075
|
+
async submitEnquiry(payload, workspaceId, addressId, doctorId) {
|
|
5076
5076
|
try {
|
|
5077
5077
|
const client = await MedosClient.ensureInitialized();
|
|
5078
|
-
const
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
preferredContactMethod: payload.preferredContactMethod,
|
|
5078
|
+
const enquiryPayload = {
|
|
5079
|
+
type: "ENQUIRY",
|
|
5080
|
+
subject: payload.inquirySubject,
|
|
5081
|
+
description: payload.inquiryMessage,
|
|
5082
|
+
senderName: payload.patientName,
|
|
5083
|
+
senderEmail: payload.patientEmail,
|
|
5084
|
+
senderPhone: `${payload.countryCode}${payload.patientPhone}`,
|
|
5086
5085
|
};
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5086
|
+
if (workspaceId !== undefined)
|
|
5087
|
+
enquiryPayload.workspaceId = workspaceId;
|
|
5088
|
+
if (addressId !== undefined)
|
|
5089
|
+
enquiryPayload.addressId = addressId;
|
|
5090
|
+
if (doctorId !== undefined)
|
|
5091
|
+
enquiryPayload.doctorId = doctorId;
|
|
5092
|
+
const formData = new FormData();
|
|
5093
|
+
formData.append("payload", JSON.stringify(enquiryPayload));
|
|
5094
|
+
const res = await client.post("/inbox/create", formData);
|
|
5092
5095
|
return res.data;
|
|
5093
5096
|
}
|
|
5094
5097
|
catch (error) {
|
package/package.json
CHANGED