medos-sdk 1.0.2 → 1.1.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/README.md +39 -0
- package/dist/client/MedosClient.d.ts +3 -5
- package/dist/client/MedosClient.js +4 -4
- package/dist/components/AppointmentCalender.d.ts +1 -4
- package/dist/components/AppointmentCalender.js +323 -530
- package/dist/components/AppointmentDateTimeModal.d.ts +14 -0
- package/dist/components/AppointmentDateTimeModal.js +220 -0
- package/dist/components/ConfigurableCard.d.ts +12 -0
- package/dist/components/ConfigurableCard.js +29 -0
- package/dist/components/ContactInformationStep.d.ts +13 -0
- package/dist/components/ContactInformationStep.js +14 -0
- package/dist/components/ContactPreferenceStep.d.ts +9 -0
- package/dist/components/ContactPreferenceStep.js +16 -0
- package/dist/components/DoctorSelectModal.d.ts +7 -0
- package/dist/components/DoctorSelectModal.js +93 -0
- package/dist/components/EnquiryForm.d.ts +7 -0
- package/dist/components/EnquiryForm.js +212 -0
- package/dist/components/Icons/Check.d.ts +6 -0
- package/dist/components/Icons/Check.js +2 -0
- package/dist/components/Icons/ChevronDownIcon.d.ts +4 -0
- package/dist/components/Icons/ChevronDownIcon.js +2 -0
- package/dist/components/Icons/ChevronLeft.d.ts +3 -0
- package/dist/components/Icons/ChevronLeft.js +3 -0
- package/dist/components/Icons/ChevronRight.d.ts +3 -0
- package/dist/components/Icons/ChevronRight.js +3 -0
- package/dist/components/Icons/ConfirmationCheck.d.ts +1 -0
- package/dist/components/Icons/ConfirmationCheck.js +9 -0
- package/dist/components/Icons/ConsultationType.d.ts +1 -0
- package/dist/components/Icons/ConsultationType.js +2 -0
- package/dist/components/Icons/Date&TimeIcon.d.ts +1 -0
- package/dist/components/Icons/Date&TimeIcon.js +2 -0
- package/dist/components/Icons/MapIcon.d.ts +1 -0
- package/dist/components/Icons/MapIcon.js +2 -0
- package/dist/components/Icons/PaymentMethodIcon.d.ts +1 -0
- package/dist/components/Icons/PaymentMethodIcon.js +2 -0
- package/dist/components/Icons/UserIcon.d.ts +1 -0
- package/dist/components/Icons/UserIcon.js +2 -0
- package/dist/components/InquiryDetailsStep.d.ts +10 -0
- package/dist/components/InquiryDetailsStep.js +15 -0
- package/dist/components/PatientDetailsStep.d.ts +3 -0
- package/dist/components/PatientDetailsStep.js +84 -0
- package/dist/components/PhoneVerificationStep.d.ts +3 -0
- package/dist/components/PhoneVerificationStep.js +49 -0
- package/dist/components/SuccessStep.d.ts +5 -0
- package/dist/components/SuccessStep.js +9 -0
- package/dist/components/custom-calendar.d.ts +5 -0
- package/dist/components/custom-calendar.js +171 -0
- package/dist/components/styles.d.ts +6 -0
- package/dist/components/styles.js +257 -0
- package/dist/components/theme-styles.d.ts +12 -0
- package/dist/components/theme-styles.js +319 -0
- package/dist/components/types.d.ts +181 -0
- package/dist/components/types.js +55 -0
- package/dist/components/ui/select.d.ts +10 -0
- package/dist/components/ui/select.js +21 -0
- package/dist/components/uiComponents/SelectDropdown.d.ts +41 -0
- package/dist/components/uiComponents/SelectDropdown.js +302 -0
- package/dist/components/utils.d.ts +5 -0
- package/dist/components/utils.js +15 -0
- package/dist/components/validation.d.ts +2 -0
- package/dist/components/validation.js +7 -0
- package/dist/context/TemplateContext.d.ts +12 -0
- package/dist/context/TemplateContext.js +19 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +4 -0
- package/dist/core/theme/index.d.ts +3 -0
- package/dist/core/theme/index.js +3 -0
- package/dist/core/theme/themes.d.ts +8 -0
- package/dist/core/theme/themes.js +178 -0
- package/dist/core/theme/types.d.ts +106 -0
- package/dist/core/theme/types.js +1 -0
- package/dist/core/theme/utils.d.ts +8 -0
- package/dist/core/theme/utils.js +135 -0
- package/dist/enquiry-form/index.d.ts +4 -0
- package/dist/enquiry-form/index.js +4 -0
- package/dist/enquiry-form/provider.d.ts +3 -0
- package/dist/enquiry-form/provider.js +9 -0
- package/dist/enquiry-form/serialization.d.ts +4 -0
- package/dist/enquiry-form/serialization.js +57 -0
- package/dist/enquiry-form/types.d.ts +38 -0
- package/dist/enquiry-form/types.js +1 -0
- package/dist/enquiry-form/validation.d.ts +6 -0
- package/dist/enquiry-form/validation.js +21 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +7 -0
- package/dist/lib/templateUtils.d.ts +3 -0
- package/dist/lib/templateUtils.js +28 -0
- package/dist/react/ThemeProvider.d.ts +18 -0
- package/dist/react/ThemeProvider.js +45 -0
- package/dist/react/hooks/useTheme.d.ts +1 -0
- package/dist/react/hooks/useTheme.js +1 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/index.js +3 -0
- package/dist/services/AppointmentService.d.ts +4 -5
- package/dist/services/AppointmentService.js +12 -10
- package/dist/services/EnquiryService.d.ts +5 -0
- package/dist/services/EnquiryService.js +30 -0
- package/dist/templates/registry.d.ts +12 -0
- package/dist/templates/registry.js +58 -0
- package/dist/vanilla/AppointmentCalendarWidget.d.ts +2 -34
- package/dist/vanilla/AppointmentCalendarWidget.js +264 -275
- package/dist/vanilla/EnquiryFormWidget.d.ts +35 -0
- package/dist/vanilla/EnquiryFormWidget.js +425 -0
- package/dist/vanilla/client/MedosClient.d.ts +3 -5
- package/dist/vanilla/components/AppointmentCalender.d.ts +1 -4
- package/dist/vanilla/components/AppointmentDateTimeModal.d.ts +14 -0
- package/dist/vanilla/components/ConfigurableCard.d.ts +12 -0
- package/dist/vanilla/components/ContactInformationStep.d.ts +13 -0
- package/dist/vanilla/components/ContactPreferenceStep.d.ts +9 -0
- package/dist/vanilla/components/DoctorSelectModal.d.ts +7 -0
- package/dist/vanilla/components/EnquiryForm.d.ts +7 -0
- package/dist/vanilla/components/Icons/Check.d.ts +6 -0
- package/dist/vanilla/components/Icons/ChevronDownIcon.d.ts +4 -0
- package/dist/vanilla/components/Icons/ChevronLeft.d.ts +3 -0
- package/dist/vanilla/components/Icons/ChevronRight.d.ts +3 -0
- package/dist/vanilla/components/Icons/ConfirmationCheck.d.ts +1 -0
- package/dist/vanilla/components/Icons/ConsultationType.d.ts +1 -0
- package/dist/vanilla/components/Icons/Date&TimeIcon.d.ts +1 -0
- package/dist/vanilla/components/Icons/MapIcon.d.ts +1 -0
- package/dist/vanilla/components/Icons/PaymentMethodIcon.d.ts +1 -0
- package/dist/vanilla/components/Icons/UserIcon.d.ts +1 -0
- package/dist/vanilla/components/InquiryDetailsStep.d.ts +10 -0
- package/dist/vanilla/components/PatientDetailsStep.d.ts +3 -0
- package/dist/vanilla/components/PhoneVerificationStep.d.ts +3 -0
- package/dist/vanilla/components/SuccessStep.d.ts +5 -0
- package/dist/vanilla/components/custom-calendar.d.ts +5 -0
- package/dist/vanilla/components/styles.d.ts +6 -0
- package/dist/vanilla/components/theme-styles.d.ts +12 -0
- package/dist/vanilla/components/types.d.ts +181 -0
- package/dist/vanilla/components/ui/select.d.ts +10 -0
- package/dist/vanilla/components/uiComponents/SelectDropdown.d.ts +41 -0
- package/dist/vanilla/components/utils.d.ts +5 -0
- package/dist/vanilla/components/validation.d.ts +2 -0
- package/dist/vanilla/context/TemplateContext.d.ts +12 -0
- package/dist/vanilla/core/index.d.ts +4 -0
- package/dist/vanilla/core/theme/index.d.ts +3 -0
- package/dist/vanilla/core/theme/themes.d.ts +8 -0
- package/dist/vanilla/core/theme/types.d.ts +106 -0
- package/dist/vanilla/core/theme/utils.d.ts +8 -0
- package/dist/vanilla/enquiry-form/index.d.ts +4 -0
- package/dist/vanilla/enquiry-form/provider.d.ts +3 -0
- package/dist/vanilla/enquiry-form/serialization.d.ts +4 -0
- package/dist/vanilla/enquiry-form/types.d.ts +38 -0
- package/dist/vanilla/enquiry-form/validation.d.ts +6 -0
- package/dist/vanilla/enquiry-widget.js +4650 -0
- package/dist/vanilla/index.d.ts +9 -0
- package/dist/vanilla/index.js +3 -1
- package/dist/vanilla/lib/templateUtils.d.ts +3 -0
- package/dist/vanilla/react/ThemeProvider.d.ts +18 -0
- package/dist/vanilla/react/hooks/useTheme.d.ts +1 -0
- package/dist/vanilla/react/index.d.ts +5 -0
- package/dist/vanilla/services/AppointmentService.d.ts +4 -5
- package/dist/vanilla/services/EnquiryService.d.ts +5 -0
- package/dist/vanilla/templates/alternative.css +13 -0
- package/dist/vanilla/templates/default.css +13 -0
- package/dist/vanilla/templates/registry.d.ts +12 -0
- package/dist/vanilla/theme-injector.d.ts +6 -0
- package/dist/vanilla/theme-injector.js +44 -0
- package/dist/vanilla/vanilla/AppointmentCalendarWidget.d.ts +2 -34
- package/dist/vanilla/vanilla/EnquiryFormWidget.d.ts +35 -0
- package/dist/vanilla/vanilla/index.d.ts +3 -1
- package/dist/vanilla/vanilla/theme-injector.d.ts +6 -0
- package/dist/vanilla/vanilla/widget.d.ts +6 -1
- package/dist/vanilla/widget.css +173 -0
- package/dist/vanilla/widget.d.ts +6 -1
- package/dist/vanilla/widget.js +813 -288
- package/package.json +9 -4
package/dist/vanilla/index.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
export { MedosClient } from "./client/MedosClient";
|
|
2
|
+
export * from "./core/theme";
|
|
3
|
+
export { MedosThemeProvider } from "./react/ThemeProvider";
|
|
4
|
+
export type { MedosThemeProviderProps } from "./react/ThemeProvider";
|
|
5
|
+
export { defaultTheme, modernTheme } from "./core/theme/themes";
|
|
6
|
+
export { useTheme, useThemeContext, useCssVar } from "./react/hooks/useTheme";
|
|
2
7
|
export { AppointmentCalender } from "./components/AppointmentCalender";
|
|
8
|
+
export { EnquiryForm } from "./components/EnquiryForm";
|
|
9
|
+
export type { EnquiryFormProps } from "./components/EnquiryForm";
|
|
3
10
|
export * from "./appointments/provider";
|
|
4
11
|
export * from "./appointments/types";
|
|
5
12
|
export * from "./appointment-calendar/provider";
|
|
6
13
|
export * from "./appointment-calendar/types";
|
|
14
|
+
export * from "./enquiry-form/provider";
|
|
15
|
+
export * from "./enquiry-form/types";
|
|
7
16
|
export { PatientService, SendPhoneVerificationOtpPayload, VerifyPhoneVerificationOtpPayload, } from "./services/PatientService";
|
package/dist/vanilla/index.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export * from "../core";
|
|
2
|
-
export
|
|
2
|
+
export * from "./theme-injector";
|
|
3
|
+
export { AppointmentCalendarWidget, initAppointmentCalendar, } from "./AppointmentCalendarWidget";
|
|
4
|
+
export { EnquiryFormWidget, initEnquiryForm } from "./EnquiryFormWidget";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MedosTheme, PartialTheme } from "../core/theme/types";
|
|
3
|
+
import { ThemeName } from "../core/theme/themes";
|
|
4
|
+
interface ThemeContextValue {
|
|
5
|
+
theme: MedosTheme;
|
|
6
|
+
cssVars: Record<string, string>;
|
|
7
|
+
prefix: string;
|
|
8
|
+
}
|
|
9
|
+
export interface MedosThemeProviderProps {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
theme?: ThemeName | MedosTheme | PartialTheme;
|
|
12
|
+
cssVariablePrefix?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function MedosThemeProvider({ children, theme, cssVariablePrefix, }: MedosThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function useThemeContext(): ThemeContextValue;
|
|
16
|
+
export declare function useTheme(): MedosTheme;
|
|
17
|
+
export declare function useCssVar(category: string, key: string, fallback?: string): string;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTheme, useThemeContext, useCssVar } from "../ThemeProvider";
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export * from "../core";
|
|
2
|
+
export { MedosThemeProvider } from "./ThemeProvider";
|
|
3
|
+
export type { MedosThemeProviderProps } from "./ThemeProvider";
|
|
4
|
+
export { useTheme, useThemeContext, useCssVar } from "./hooks/useTheme";
|
|
2
5
|
export { AppointmentCalender } from "../components/AppointmentCalender";
|
|
6
|
+
export { EnquiryForm } from "../components/EnquiryForm";
|
|
7
|
+
export type { EnquiryFormProps } from "../components/EnquiryForm";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type Doctor = {
|
|
2
|
-
id:
|
|
2
|
+
id: number;
|
|
3
3
|
name: string;
|
|
4
4
|
specialty?: string;
|
|
5
5
|
[key: string]: any;
|
|
@@ -58,7 +58,7 @@ type AppointmentPayload = {
|
|
|
58
58
|
attachments?: File[];
|
|
59
59
|
};
|
|
60
60
|
type AddressItem = {
|
|
61
|
-
id: number
|
|
61
|
+
id: number;
|
|
62
62
|
completeAddress?: string;
|
|
63
63
|
label?: string;
|
|
64
64
|
address?: string;
|
|
@@ -67,7 +67,6 @@ type AddressItem = {
|
|
|
67
67
|
doctorsCount?: number;
|
|
68
68
|
totalConfiguredAppointments?: number;
|
|
69
69
|
doctors?: Doctor[];
|
|
70
|
-
[key: string]: any;
|
|
71
70
|
};
|
|
72
71
|
type AddressesResponse = {
|
|
73
72
|
totalAddresses?: number;
|
|
@@ -75,12 +74,12 @@ type AddressesResponse = {
|
|
|
75
74
|
totalConfiguredAppointments?: number;
|
|
76
75
|
totalPartialConfiguredAppointments?: number;
|
|
77
76
|
totalNotConfiguredAppointments?: number;
|
|
78
|
-
workspaceId?: number
|
|
77
|
+
workspaceId?: number;
|
|
79
78
|
addresses: AddressItem[];
|
|
80
79
|
};
|
|
81
80
|
declare const AppointmentService: {
|
|
82
81
|
getAddresses(): Promise<AddressesResponse>;
|
|
83
|
-
fetchSlots(workspaceId:
|
|
82
|
+
fetchSlots(workspaceId: number, addressId: number, doctorId: number, appointmentDate: string): Promise<Slot[]>;
|
|
84
83
|
createAppointment(payload: BookAppointmentPayload): Promise<any>;
|
|
85
84
|
};
|
|
86
85
|
export { AppointmentService, AppointmentPayload, BookAppointmentPayload, PatientPayload, PatientAddressPayload, AddressesResponse, AddressItem, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* Alternative Green Template */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--medos-primary-color: #10b981;
|
|
5
|
+
--medos-secondary-color: #d1fae5;
|
|
6
|
+
--medos-accent-color: #059669;
|
|
7
|
+
--medos-background-color: #f0fdf4;
|
|
8
|
+
--medos-text-color: #1f2937;
|
|
9
|
+
--medos-border-color: #d1d5db;
|
|
10
|
+
--medos-muted-text: #6b7280;
|
|
11
|
+
--medos-success-color: #059669;
|
|
12
|
+
--medos-error-color: #dc2626;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* Default Blue Template */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--medos-primary-color: #0b79f7;
|
|
5
|
+
--medos-secondary-color: #eef2ff;
|
|
6
|
+
--medos-accent-color: #0b79f7;
|
|
7
|
+
--medos-background-color: #f6f8fa;
|
|
8
|
+
--medos-text-color: #333;
|
|
9
|
+
--medos-border-color: #e6e9ef;
|
|
10
|
+
--medos-muted-text: #6b7280;
|
|
11
|
+
--medos-success-color: #10b981;
|
|
12
|
+
--medos-error-color: #ef4444;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TemplateId, TemplateConfig } from "../core";
|
|
2
|
+
export declare class TemplateRegistry {
|
|
3
|
+
private static instance;
|
|
4
|
+
private readonly templates;
|
|
5
|
+
private constructor();
|
|
6
|
+
static getInstance(): TemplateRegistry;
|
|
7
|
+
getTemplate(id: TemplateId): TemplateConfig;
|
|
8
|
+
getAllTemplates(): Record<TemplateId, TemplateConfig>;
|
|
9
|
+
hasTemplate(id: TemplateId): boolean;
|
|
10
|
+
private initializeTemplates;
|
|
11
|
+
}
|
|
12
|
+
export declare const templateRegistry: TemplateRegistry;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MedosTheme, PartialTheme } from "../core/theme/types";
|
|
2
|
+
import { ThemeName } from "../core/theme/themes";
|
|
3
|
+
export declare function resolveTheme(theme?: ThemeName | MedosTheme | PartialTheme): MedosTheme;
|
|
4
|
+
export declare function injectThemeIntoContainer(container: HTMLElement, theme?: ThemeName | MedosTheme | PartialTheme, prefix?: string): void;
|
|
5
|
+
export declare function createWidgetStyleTag(containerId: string, theme?: ThemeName | MedosTheme | PartialTheme, prefix?: string): HTMLStyleElement;
|
|
6
|
+
export declare function updateWidgetTheme(container: HTMLElement, theme: ThemeName | MedosTheme | PartialTheme, prefix?: string): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defaultTheme, themes } from "../core/theme/themes";
|
|
2
|
+
import { mergeTheme, generateCssVariablesObject } from "../core/theme/utils";
|
|
3
|
+
export function resolveTheme(theme) {
|
|
4
|
+
if (!theme) {
|
|
5
|
+
return defaultTheme;
|
|
6
|
+
}
|
|
7
|
+
if (typeof theme === "string") {
|
|
8
|
+
return themes[theme] || defaultTheme;
|
|
9
|
+
}
|
|
10
|
+
if ("name" in theme && "colors" in theme && "typography" in theme) {
|
|
11
|
+
return theme;
|
|
12
|
+
}
|
|
13
|
+
return mergeTheme(theme);
|
|
14
|
+
}
|
|
15
|
+
export function injectThemeIntoContainer(container, theme, prefix = "medos") {
|
|
16
|
+
const resolvedTheme = resolveTheme(theme);
|
|
17
|
+
const cssVars = generateCssVariablesObject(resolvedTheme, prefix);
|
|
18
|
+
Object.entries(cssVars).forEach(([key, value]) => {
|
|
19
|
+
container.style.setProperty(key, value);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function createWidgetStyleTag(containerId, theme, prefix = "medos") {
|
|
23
|
+
const resolvedTheme = resolveTheme(theme);
|
|
24
|
+
const cssVars = generateCssVariablesObject(resolvedTheme, prefix);
|
|
25
|
+
const styleId = `${prefix}-widget-theme-${containerId}`;
|
|
26
|
+
const existingStyle = document.getElementById(styleId);
|
|
27
|
+
if (existingStyle) {
|
|
28
|
+
existingStyle.remove();
|
|
29
|
+
}
|
|
30
|
+
const styleElement = document.createElement("style");
|
|
31
|
+
styleElement.id = styleId;
|
|
32
|
+
const cssVarDeclarations = Object.entries(cssVars)
|
|
33
|
+
.map(([key, value]) => ` ${key}: ${value};`)
|
|
34
|
+
.join("\n");
|
|
35
|
+
styleElement.innerHTML = `
|
|
36
|
+
#${containerId} {
|
|
37
|
+
${cssVarDeclarations}
|
|
38
|
+
}
|
|
39
|
+
`.trim();
|
|
40
|
+
return styleElement;
|
|
41
|
+
}
|
|
42
|
+
export function updateWidgetTheme(container, theme, prefix = "medos") {
|
|
43
|
+
injectThemeIntoContainer(container, theme, prefix);
|
|
44
|
+
}
|
|
@@ -10,44 +10,13 @@ declare class AppointmentCalendarWidget {
|
|
|
10
10
|
private container;
|
|
11
11
|
private options;
|
|
12
12
|
private mounted;
|
|
13
|
-
private
|
|
14
|
-
private addresses;
|
|
15
|
-
private addressDoctorsMap;
|
|
16
|
-
private selectedAddress;
|
|
17
|
-
private workspaceId;
|
|
13
|
+
private state;
|
|
18
14
|
private doctors;
|
|
19
|
-
private selectedDoctor;
|
|
20
|
-
private date;
|
|
21
|
-
private slots;
|
|
22
|
-
private selectedSlot;
|
|
23
|
-
private loading;
|
|
24
|
-
private error;
|
|
25
|
-
private patientName;
|
|
26
|
-
private patientAge;
|
|
27
|
-
private patientAddress;
|
|
28
|
-
private patientCity;
|
|
29
|
-
private patientState;
|
|
30
|
-
private patientCountry;
|
|
31
|
-
private patientZipcode;
|
|
32
|
-
private patientLandmark;
|
|
33
|
-
private patientEmail;
|
|
34
|
-
private patientGender;
|
|
35
|
-
private problemFacing;
|
|
36
|
-
private consultationCharge;
|
|
37
|
-
private countryCode;
|
|
38
|
-
private patientPhone;
|
|
39
|
-
private otpCode;
|
|
40
|
-
private otpSent;
|
|
41
|
-
private otpVerified;
|
|
42
|
-
private otpSending;
|
|
43
|
-
private otpVerifying;
|
|
44
15
|
constructor(container: HTMLElement | string, options: AppointmentCalendarWidgetOptions);
|
|
45
16
|
private init;
|
|
46
17
|
private loadAddresses;
|
|
47
18
|
private handleAddressChange;
|
|
48
19
|
private loadSlots;
|
|
49
|
-
private validatePhoneNumber;
|
|
50
|
-
private validateCountryCode;
|
|
51
20
|
private canProceedFromMergedStep;
|
|
52
21
|
private sendOtp;
|
|
53
22
|
private verifyOtp;
|
|
@@ -55,8 +24,7 @@ declare class AppointmentCalendarWidget {
|
|
|
55
24
|
private goToNext;
|
|
56
25
|
private goBack;
|
|
57
26
|
private reset;
|
|
58
|
-
private
|
|
59
|
-
private setError;
|
|
27
|
+
private setState;
|
|
60
28
|
private render;
|
|
61
29
|
private renderStep;
|
|
62
30
|
private renderStep0;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EnquirySubmission } from "../enquiry-form/types";
|
|
2
|
+
interface EnquiryFormWidgetOptions {
|
|
3
|
+
containerId: string;
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
sessionToken?: string;
|
|
6
|
+
baseURL?: string;
|
|
7
|
+
onError?: (err: Error) => void;
|
|
8
|
+
onSuccess?: (enquiry: EnquirySubmission) => void;
|
|
9
|
+
}
|
|
10
|
+
declare class EnquiryFormWidget {
|
|
11
|
+
private container;
|
|
12
|
+
private options;
|
|
13
|
+
private mounted;
|
|
14
|
+
private state;
|
|
15
|
+
constructor(container: HTMLElement | string, options: EnquiryFormWidgetOptions);
|
|
16
|
+
private init;
|
|
17
|
+
private validateContactStep;
|
|
18
|
+
private validateInquiryStep;
|
|
19
|
+
private goToNext;
|
|
20
|
+
private goBack;
|
|
21
|
+
private submitEnquiry;
|
|
22
|
+
private resetForm;
|
|
23
|
+
private setState;
|
|
24
|
+
private render;
|
|
25
|
+
private renderStep;
|
|
26
|
+
private renderStep0;
|
|
27
|
+
private renderStep1;
|
|
28
|
+
private renderStep2;
|
|
29
|
+
private renderStep3;
|
|
30
|
+
private attachEventListeners;
|
|
31
|
+
private escapeHtml;
|
|
32
|
+
destroy(): void;
|
|
33
|
+
}
|
|
34
|
+
export declare function initEnquiryForm(options: EnquiryFormWidgetOptions): EnquiryFormWidget;
|
|
35
|
+
export { EnquiryFormWidget };
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export * from "../core";
|
|
2
|
-
export
|
|
2
|
+
export * from "./theme-injector";
|
|
3
|
+
export { AppointmentCalendarWidget, initAppointmentCalendar, } from "./AppointmentCalendarWidget";
|
|
4
|
+
export { EnquiryFormWidget, initEnquiryForm } from "./EnquiryFormWidget";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MedosTheme, PartialTheme } from "../core/theme/types";
|
|
2
|
+
import { ThemeName } from "../core/theme/themes";
|
|
3
|
+
export declare function resolveTheme(theme?: ThemeName | MedosTheme | PartialTheme): MedosTheme;
|
|
4
|
+
export declare function injectThemeIntoContainer(container: HTMLElement, theme?: ThemeName | MedosTheme | PartialTheme, prefix?: string): void;
|
|
5
|
+
export declare function createWidgetStyleTag(containerId: string, theme?: ThemeName | MedosTheme | PartialTheme, prefix?: string): HTMLStyleElement;
|
|
6
|
+
export declare function updateWidgetTheme(container: HTMLElement, theme: ThemeName | MedosTheme | PartialTheme, prefix?: string): void;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { initAppointmentCalendar, AppointmentCalendarWidget } from "./AppointmentCalendarWidget";
|
|
2
|
+
import { initEnquiryForm, EnquiryFormWidget } from "./EnquiryFormWidget";
|
|
2
3
|
declare global {
|
|
3
4
|
interface Window {
|
|
4
5
|
MedosAppointmentCalendar: {
|
|
5
6
|
init: typeof initAppointmentCalendar;
|
|
6
7
|
Widget: typeof AppointmentCalendarWidget;
|
|
7
8
|
};
|
|
9
|
+
MedosEnquiryForm: {
|
|
10
|
+
init: typeof initEnquiryForm;
|
|
11
|
+
Widget: typeof EnquiryFormWidget;
|
|
12
|
+
};
|
|
8
13
|
}
|
|
9
14
|
}
|
|
10
|
-
export { initAppointmentCalendar, AppointmentCalendarWidget };
|
|
15
|
+
export { initAppointmentCalendar, AppointmentCalendarWidget, initEnquiryForm, EnquiryFormWidget, };
|
package/dist/vanilla/widget.css
CHANGED
|
@@ -215,3 +215,176 @@
|
|
|
215
215
|
color: #6b7280;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
/* Medos Enquiry Form Widget Styles */
|
|
219
|
+
|
|
220
|
+
.medos-enquiry-container {
|
|
221
|
+
display: flex;
|
|
222
|
+
justify-content: center;
|
|
223
|
+
padding: 20px;
|
|
224
|
+
font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
|
|
225
|
+
background: #f6f8fa;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.medos-enquiry-card {
|
|
229
|
+
width: 100%;
|
|
230
|
+
max-width: 720px;
|
|
231
|
+
background: #fff;
|
|
232
|
+
border-radius: 12px;
|
|
233
|
+
box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
|
|
234
|
+
padding: 24px;
|
|
235
|
+
box-sizing: border-box;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.medos-enquiry-header {
|
|
239
|
+
display: flex;
|
|
240
|
+
align-items: center;
|
|
241
|
+
justify-content: space-between;
|
|
242
|
+
margin-bottom: 16px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.medos-enquiry-title {
|
|
246
|
+
margin: 0;
|
|
247
|
+
font-size: 20px;
|
|
248
|
+
font-weight: 600;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.medos-enquiry-step-indicator {
|
|
252
|
+
margin: 0;
|
|
253
|
+
font-size: 12px;
|
|
254
|
+
color: #6b7280;
|
|
255
|
+
font-weight: 500;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.medos-enquiry-section {
|
|
259
|
+
margin-top: 12px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.medos-enquiry-label {
|
|
263
|
+
display: block;
|
|
264
|
+
font-size: 13px;
|
|
265
|
+
margin-bottom: 6px;
|
|
266
|
+
color: #374151;
|
|
267
|
+
font-weight: 500;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.medos-enquiry-input,
|
|
271
|
+
.medos-enquiry-textarea {
|
|
272
|
+
width: 100%;
|
|
273
|
+
padding: 10px 12px;
|
|
274
|
+
border-radius: 8px;
|
|
275
|
+
border: 1px solid #e6e9ef;
|
|
276
|
+
outline: none;
|
|
277
|
+
font-size: 14px;
|
|
278
|
+
box-sizing: border-box;
|
|
279
|
+
font-family: inherit;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.medos-enquiry-textarea {
|
|
283
|
+
min-height: 100px;
|
|
284
|
+
resize: vertical;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.medos-enquiry-char-count {
|
|
288
|
+
margin-top: 4px;
|
|
289
|
+
font-size: 12px;
|
|
290
|
+
color: #6b7280;
|
|
291
|
+
text-align: right;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.medos-enquiry-radio-group {
|
|
295
|
+
display: flex;
|
|
296
|
+
flex-direction: column;
|
|
297
|
+
gap: 12px;
|
|
298
|
+
margin-top: 12px;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.medos-enquiry-radio-label {
|
|
302
|
+
display: flex;
|
|
303
|
+
align-items: center;
|
|
304
|
+
gap: 8px;
|
|
305
|
+
cursor: pointer;
|
|
306
|
+
font-size: 14px;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.medos-enquiry-radio-label input[type="radio"] {
|
|
310
|
+
cursor: pointer;
|
|
311
|
+
width: 16px;
|
|
312
|
+
height: 16px;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.medos-enquiry-actions {
|
|
316
|
+
display: flex;
|
|
317
|
+
gap: 8px;
|
|
318
|
+
margin-top: 16px;
|
|
319
|
+
justify-content: flex-end;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.medos-enquiry-btn {
|
|
323
|
+
padding: 10px 14px;
|
|
324
|
+
border-radius: 8px;
|
|
325
|
+
cursor: pointer;
|
|
326
|
+
font-weight: 600;
|
|
327
|
+
font-size: 14px;
|
|
328
|
+
border: none;
|
|
329
|
+
font-family: inherit;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.medos-enquiry-btn-primary {
|
|
333
|
+
background: #0b79f7;
|
|
334
|
+
color: #fff;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.medos-enquiry-btn-primary:disabled {
|
|
338
|
+
opacity: 0.6;
|
|
339
|
+
cursor: not-allowed;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.medos-enquiry-btn-secondary {
|
|
343
|
+
background: #fff;
|
|
344
|
+
color: #0b254a;
|
|
345
|
+
border: 1px solid #e6e9ef;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.medos-enquiry-loading {
|
|
349
|
+
margin-bottom: 12px;
|
|
350
|
+
padding: 12px;
|
|
351
|
+
border-radius: 8px;
|
|
352
|
+
background: #fef3c7;
|
|
353
|
+
color: #92400e;
|
|
354
|
+
font-weight: 600;
|
|
355
|
+
text-align: center;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.medos-enquiry-error {
|
|
359
|
+
margin-bottom: 12px;
|
|
360
|
+
padding: 12px;
|
|
361
|
+
border-radius: 8px;
|
|
362
|
+
background: #fee2e2;
|
|
363
|
+
color: #991b1b;
|
|
364
|
+
font-weight: 600;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.medos-enquiry-success-card {
|
|
368
|
+
padding: 20px;
|
|
369
|
+
border-radius: 12px;
|
|
370
|
+
background: linear-gradient(90deg, #ecfdf5, #eff6ff);
|
|
371
|
+
text-align: center;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.medos-enquiry-success-icon {
|
|
375
|
+
font-size: 32px;
|
|
376
|
+
color: #10b981;
|
|
377
|
+
margin-bottom: 8px;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.medos-enquiry-success-title {
|
|
381
|
+
font-weight: 700;
|
|
382
|
+
font-size: 16px;
|
|
383
|
+
margin-bottom: 6px;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.medos-enquiry-success-message {
|
|
387
|
+
font-size: 14px;
|
|
388
|
+
color: #374151;
|
|
389
|
+
}
|
|
390
|
+
|
package/dist/vanilla/widget.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { initAppointmentCalendar, AppointmentCalendarWidget } from "./AppointmentCalendarWidget";
|
|
2
|
+
import { initEnquiryForm, EnquiryFormWidget } from "./EnquiryFormWidget";
|
|
2
3
|
declare global {
|
|
3
4
|
interface Window {
|
|
4
5
|
MedosAppointmentCalendar: {
|
|
5
6
|
init: typeof initAppointmentCalendar;
|
|
6
7
|
Widget: typeof AppointmentCalendarWidget;
|
|
7
8
|
};
|
|
9
|
+
MedosEnquiryForm: {
|
|
10
|
+
init: typeof initEnquiryForm;
|
|
11
|
+
Widget: typeof EnquiryFormWidget;
|
|
12
|
+
};
|
|
8
13
|
}
|
|
9
14
|
}
|
|
10
|
-
export { initAppointmentCalendar, AppointmentCalendarWidget };
|
|
15
|
+
export { initAppointmentCalendar, AppointmentCalendarWidget, initEnquiryForm, EnquiryFormWidget, };
|