@blackcode_sa/metaestetics-api 1.13.5 → 1.13.8
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/admin/index.d.mts +20 -1
- package/dist/admin/index.d.ts +20 -1
- package/dist/admin/index.js +217 -1
- package/dist/admin/index.mjs +217 -1
- package/dist/index.d.mts +26 -3
- package/dist/index.d.ts +26 -3
- package/dist/index.js +168 -6
- package/dist/index.mjs +168 -6
- package/package.json +121 -121
- package/src/__mocks__/firstore.ts +10 -10
- package/src/admin/aggregation/README.md +79 -79
- package/src/admin/aggregation/appointment/README.md +128 -128
- package/src/admin/aggregation/appointment/appointment.aggregation.service.ts +1984 -1984
- package/src/admin/aggregation/appointment/index.ts +1 -1
- package/src/admin/aggregation/clinic/README.md +52 -52
- package/src/admin/aggregation/clinic/clinic.aggregation.service.ts +966 -703
- package/src/admin/aggregation/clinic/index.ts +1 -1
- package/src/admin/aggregation/forms/README.md +13 -13
- package/src/admin/aggregation/forms/filled-forms.aggregation.service.ts +322 -322
- package/src/admin/aggregation/forms/index.ts +1 -1
- package/src/admin/aggregation/index.ts +8 -8
- package/src/admin/aggregation/patient/README.md +27 -27
- package/src/admin/aggregation/patient/index.ts +1 -1
- package/src/admin/aggregation/patient/patient.aggregation.service.ts +141 -141
- package/src/admin/aggregation/practitioner/README.md +42 -42
- package/src/admin/aggregation/practitioner/index.ts +1 -1
- package/src/admin/aggregation/practitioner/practitioner.aggregation.service.ts +433 -433
- package/src/admin/aggregation/practitioner-invite/index.ts +1 -1
- package/src/admin/aggregation/practitioner-invite/practitioner-invite.aggregation.service.ts +961 -961
- package/src/admin/aggregation/procedure/README.md +43 -43
- package/src/admin/aggregation/procedure/index.ts +1 -1
- package/src/admin/aggregation/procedure/procedure.aggregation.service.ts +702 -702
- package/src/admin/aggregation/reviews/index.ts +1 -1
- package/src/admin/aggregation/reviews/reviews.aggregation.service.ts +689 -689
- package/src/admin/analytics/analytics.admin.service.ts +278 -278
- package/src/admin/analytics/index.ts +2 -2
- package/src/admin/booking/README.md +125 -125
- package/src/admin/booking/booking.admin.ts +1037 -1037
- package/src/admin/booking/booking.calculator.ts +712 -712
- package/src/admin/booking/booking.types.ts +59 -59
- package/src/admin/booking/index.ts +3 -3
- package/src/admin/booking/timezones-problem.md +185 -185
- package/src/admin/calendar/README.md +7 -7
- package/src/admin/calendar/calendar.admin.service.ts +345 -345
- package/src/admin/calendar/index.ts +1 -1
- package/src/admin/documentation-templates/document-manager.admin.ts +260 -260
- package/src/admin/documentation-templates/index.ts +1 -1
- package/src/admin/free-consultation/free-consultation-utils.admin.ts +148 -148
- package/src/admin/free-consultation/index.ts +1 -1
- package/src/admin/index.ts +81 -81
- package/src/admin/logger/index.ts +78 -78
- package/src/admin/mailing/README.md +95 -95
- package/src/admin/mailing/appointment/appointment.mailing.service.ts +732 -732
- package/src/admin/mailing/appointment/index.ts +1 -1
- package/src/admin/mailing/appointment/templates/patient/appointment-confirmed.html +40 -40
- package/src/admin/mailing/base.mailing.service.ts +208 -208
- package/src/admin/mailing/index.ts +3 -3
- package/src/admin/mailing/practitionerInvite/existing-practitioner-invite.mailing.ts +611 -611
- package/src/admin/mailing/practitionerInvite/index.ts +2 -2
- package/src/admin/mailing/practitionerInvite/practitionerInvite.mailing.ts +395 -395
- package/src/admin/mailing/practitionerInvite/templates/existing-practitioner-invitation.template.ts +155 -155
- package/src/admin/mailing/practitionerInvite/templates/invitation.template.ts +101 -101
- package/src/admin/mailing/practitionerInvite/templates/invite-accepted-notification.template.ts +228 -228
- package/src/admin/mailing/practitionerInvite/templates/invite-rejected-notification.template.ts +242 -242
- package/src/admin/notifications/index.ts +1 -1
- package/src/admin/notifications/notifications.admin.ts +710 -710
- package/src/admin/requirements/README.md +128 -128
- package/src/admin/requirements/index.ts +1 -1
- package/src/admin/requirements/patient-requirements.admin.service.ts +475 -475
- package/src/admin/users/index.ts +1 -1
- package/src/admin/users/user-profile.admin.ts +405 -405
- package/src/backoffice/constants/certification.constants.ts +13 -13
- package/src/backoffice/constants/index.ts +1 -1
- package/src/backoffice/errors/backoffice.errors.ts +181 -181
- package/src/backoffice/errors/index.ts +1 -1
- package/src/backoffice/expo-safe/README.md +26 -26
- package/src/backoffice/expo-safe/index.ts +41 -41
- package/src/backoffice/index.ts +5 -5
- package/src/backoffice/services/FIXES_README.md +102 -102
- package/src/backoffice/services/README.md +57 -57
- package/src/backoffice/services/analytics.service.proposal.md +863 -863
- package/src/backoffice/services/analytics.service.summary.md +143 -143
- package/src/backoffice/services/brand.service.ts +256 -256
- package/src/backoffice/services/category.service.ts +384 -384
- package/src/backoffice/services/constants.service.ts +385 -385
- package/src/backoffice/services/documentation-template.service.ts +202 -202
- package/src/backoffice/services/index.ts +10 -10
- package/src/backoffice/services/migrate-products.ts +116 -116
- package/src/backoffice/services/product.service.ts +553 -553
- package/src/backoffice/services/requirement.service.ts +235 -235
- package/src/backoffice/services/subcategory.service.ts +461 -461
- package/src/backoffice/services/technology.service.ts +1151 -1151
- package/src/backoffice/types/README.md +12 -12
- package/src/backoffice/types/admin-constants.types.ts +69 -69
- package/src/backoffice/types/brand.types.ts +29 -29
- package/src/backoffice/types/category.types.ts +67 -67
- package/src/backoffice/types/documentation-templates.types.ts +28 -28
- package/src/backoffice/types/index.ts +10 -10
- package/src/backoffice/types/procedure-product.types.ts +38 -38
- package/src/backoffice/types/product.types.ts +240 -240
- package/src/backoffice/types/requirement.types.ts +63 -63
- package/src/backoffice/types/static/README.md +18 -18
- package/src/backoffice/types/static/blocking-condition.types.ts +21 -21
- package/src/backoffice/types/static/certification.types.ts +37 -37
- package/src/backoffice/types/static/contraindication.types.ts +19 -19
- package/src/backoffice/types/static/index.ts +6 -6
- package/src/backoffice/types/static/pricing.types.ts +16 -16
- package/src/backoffice/types/static/procedure-family.types.ts +14 -14
- package/src/backoffice/types/static/treatment-benefit.types.ts +22 -22
- package/src/backoffice/types/subcategory.types.ts +34 -34
- package/src/backoffice/types/technology.types.ts +168 -168
- package/src/backoffice/validations/index.ts +1 -1
- package/src/backoffice/validations/schemas.ts +164 -164
- package/src/config/__mocks__/firebase.ts +99 -99
- package/src/config/firebase.ts +78 -78
- package/src/config/index.ts +9 -9
- package/src/errors/auth.error.ts +6 -6
- package/src/errors/auth.errors.ts +211 -200
- package/src/errors/clinic.errors.ts +32 -32
- package/src/errors/firebase.errors.ts +47 -47
- package/src/errors/user.errors.ts +99 -99
- package/src/index.backup.ts +407 -407
- package/src/index.ts +6 -6
- package/src/locales/en.ts +31 -31
- package/src/recommender/admin/index.ts +1 -1
- package/src/recommender/admin/services/recommender.service.admin.ts +5 -5
- package/src/recommender/front/index.ts +1 -1
- package/src/recommender/front/services/onboarding.service.ts +5 -5
- package/src/recommender/front/services/recommender.service.ts +3 -3
- package/src/recommender/index.ts +1 -1
- package/src/services/PATIENTAUTH.MD +197 -197
- package/src/services/README.md +106 -106
- package/src/services/__tests__/auth/auth.mock.test.ts +17 -17
- package/src/services/__tests__/auth/auth.setup.ts +293 -293
- package/src/services/__tests__/auth.service.test.ts +346 -346
- package/src/services/__tests__/base.service.test.ts +77 -77
- package/src/services/__tests__/user.service.test.ts +528 -528
- package/src/services/analytics/ARCHITECTURE.md +199 -199
- package/src/services/analytics/CLOUD_FUNCTIONS.md +225 -225
- package/src/services/analytics/GROUPED_ANALYTICS.md +501 -501
- package/src/services/analytics/QUICK_START.md +393 -393
- package/src/services/analytics/README.md +304 -304
- package/src/services/analytics/SUMMARY.md +141 -141
- package/src/services/analytics/TRENDS.md +380 -380
- package/src/services/analytics/USAGE_GUIDE.md +518 -518
- package/src/services/analytics/analytics-cloud.service.ts +222 -222
- package/src/services/analytics/analytics.service.ts +2142 -2142
- package/src/services/analytics/index.ts +4 -4
- package/src/services/analytics/review-analytics.service.ts +941 -941
- package/src/services/analytics/utils/appointment-filtering.utils.ts +138 -138
- package/src/services/analytics/utils/cost-calculation.utils.ts +182 -182
- package/src/services/analytics/utils/grouping.utils.ts +434 -434
- package/src/services/analytics/utils/stored-analytics.utils.ts +347 -347
- package/src/services/analytics/utils/time-calculation.utils.ts +186 -186
- package/src/services/analytics/utils/trend-calculation.utils.ts +200 -200
- package/src/services/appointment/README.md +17 -17
- package/src/services/appointment/appointment.service.ts +2558 -2558
- package/src/services/appointment/index.ts +1 -1
- package/src/services/appointment/utils/appointment.utils.ts +552 -552
- package/src/services/appointment/utils/extended-procedure.utils.ts +314 -314
- package/src/services/appointment/utils/form-initialization.utils.ts +225 -225
- package/src/services/appointment/utils/recommended-procedure.utils.ts +195 -195
- package/src/services/appointment/utils/zone-management.utils.ts +353 -353
- package/src/services/appointment/utils/zone-photo.utils.ts +152 -152
- package/src/services/auth/auth.service.ts +1043 -989
- package/src/services/auth/auth.v2.service.ts +961 -961
- package/src/services/auth/index.ts +7 -7
- package/src/services/auth/utils/error.utils.ts +90 -90
- package/src/services/auth/utils/firebase.utils.ts +49 -49
- package/src/services/auth/utils/index.ts +21 -21
- package/src/services/auth/utils/practitioner.utils.ts +125 -125
- package/src/services/base.service.ts +41 -41
- package/src/services/calendar/calendar.service.ts +1077 -1077
- package/src/services/calendar/calendar.v2.service.ts +1683 -1683
- package/src/services/calendar/calendar.v3.service.ts +313 -313
- package/src/services/calendar/externalCalendar.service.ts +178 -178
- package/src/services/calendar/index.ts +5 -5
- package/src/services/calendar/synced-calendars.service.ts +743 -743
- package/src/services/calendar/utils/appointment.utils.ts +265 -265
- package/src/services/calendar/utils/calendar-event.utils.ts +646 -646
- package/src/services/calendar/utils/clinic.utils.ts +237 -237
- package/src/services/calendar/utils/docs.utils.ts +157 -157
- package/src/services/calendar/utils/google-calendar.utils.ts +697 -697
- package/src/services/calendar/utils/index.ts +8 -8
- package/src/services/calendar/utils/patient.utils.ts +198 -198
- package/src/services/calendar/utils/practitioner.utils.ts +221 -221
- package/src/services/calendar/utils/synced-calendar.utils.ts +472 -472
- package/src/services/clinic/README.md +204 -204
- package/src/services/clinic/__tests__/clinic-admin.service.test.ts +287 -287
- package/src/services/clinic/__tests__/clinic-group.service.test.ts +352 -352
- package/src/services/clinic/__tests__/clinic.service.test.ts +354 -354
- package/src/services/clinic/billing-transactions.service.ts +217 -217
- package/src/services/clinic/clinic-admin.service.ts +202 -202
- package/src/services/clinic/clinic-group.service.ts +310 -310
- package/src/services/clinic/clinic.service.ts +708 -708
- package/src/services/clinic/index.ts +5 -5
- package/src/services/clinic/practitioner-invite.service.ts +519 -519
- package/src/services/clinic/utils/admin.utils.ts +551 -551
- package/src/services/clinic/utils/clinic-group.utils.ts +646 -646
- package/src/services/clinic/utils/clinic.utils.ts +949 -949
- package/src/services/clinic/utils/filter.utils.d.ts +23 -23
- package/src/services/clinic/utils/filter.utils.ts +446 -446
- package/src/services/clinic/utils/index.ts +11 -11
- package/src/services/clinic/utils/photos.utils.ts +188 -188
- package/src/services/clinic/utils/search.utils.ts +84 -84
- package/src/services/clinic/utils/tag.utils.ts +124 -124
- package/src/services/documentation-templates/documentation-template.service.ts +537 -537
- package/src/services/documentation-templates/filled-document.service.ts +587 -587
- package/src/services/documentation-templates/index.ts +2 -2
- package/src/services/index.ts +14 -14
- package/src/services/media/index.ts +1 -1
- package/src/services/media/media.service.ts +418 -418
- package/src/services/notifications/__tests__/notification.service.test.ts +242 -242
- package/src/services/notifications/index.ts +1 -1
- package/src/services/notifications/notification.service.ts +215 -215
- package/src/services/patient/README.md +48 -48
- package/src/services/patient/To-Do.md +43 -43
- package/src/services/patient/__tests__/patient.service.test.ts +294 -294
- package/src/services/patient/index.ts +2 -2
- package/src/services/patient/patient.service.ts +883 -883
- package/src/services/patient/patientRequirements.service.ts +285 -285
- package/src/services/patient/utils/aesthetic-analysis.utils.ts +176 -176
- package/src/services/patient/utils/clinic.utils.ts +80 -80
- package/src/services/patient/utils/docs.utils.ts +142 -142
- package/src/services/patient/utils/index.ts +9 -9
- package/src/services/patient/utils/location.utils.ts +126 -126
- package/src/services/patient/utils/medical-stuff.utils.ts +143 -143
- package/src/services/patient/utils/medical.utils.ts +458 -458
- package/src/services/patient/utils/practitioner.utils.ts +260 -260
- package/src/services/patient/utils/profile.utils.ts +510 -510
- package/src/services/patient/utils/sensitive.utils.ts +260 -260
- package/src/services/patient/utils/token.utils.ts +211 -211
- package/src/services/practitioner/README.md +145 -145
- package/src/services/practitioner/index.ts +1 -1
- package/src/services/practitioner/practitioner.service.ts +1799 -1742
- package/src/services/procedure/README.md +163 -163
- package/src/services/procedure/index.ts +1 -1
- package/src/services/procedure/procedure.service.ts +2307 -2200
- package/src/services/reviews/index.ts +1 -1
- package/src/services/reviews/reviews.service.ts +734 -734
- package/src/services/user/index.ts +1 -1
- package/src/services/user/user.service.ts +489 -489
- package/src/services/user/user.v2.service.ts +466 -466
- package/src/types/analytics/analytics.types.ts +597 -597
- package/src/types/analytics/grouped-analytics.types.ts +173 -173
- package/src/types/analytics/index.ts +4 -4
- package/src/types/analytics/stored-analytics.types.ts +137 -137
- package/src/types/appointment/index.ts +480 -480
- package/src/types/calendar/index.ts +258 -258
- package/src/types/calendar/synced-calendar.types.ts +66 -66
- package/src/types/clinic/index.ts +498 -498
- package/src/types/clinic/practitioner-invite.types.ts +91 -91
- package/src/types/clinic/preferences.types.ts +159 -159
- package/src/types/clinic/to-do +3 -3
- package/src/types/documentation-templates/index.ts +308 -308
- package/src/types/index.ts +47 -47
- package/src/types/notifications/README.md +77 -77
- package/src/types/notifications/index.ts +286 -286
- package/src/types/patient/aesthetic-analysis.types.ts +66 -66
- package/src/types/patient/allergies.ts +58 -58
- package/src/types/patient/index.ts +275 -275
- package/src/types/patient/medical-info.types.ts +152 -152
- package/src/types/patient/patient-requirements.ts +92 -92
- package/src/types/patient/token.types.ts +61 -61
- package/src/types/practitioner/index.ts +206 -206
- package/src/types/procedure/index.ts +181 -181
- package/src/types/profile/index.ts +39 -39
- package/src/types/reviews/index.ts +132 -132
- package/src/types/tz-lookup.d.ts +4 -4
- package/src/types/user/index.ts +38 -38
- package/src/utils/TIMESTAMPS.md +176 -176
- package/src/utils/TimestampUtils.ts +241 -241
- package/src/utils/index.ts +1 -1
- package/src/validations/appointment.schema.ts +574 -574
- package/src/validations/calendar.schema.ts +225 -225
- package/src/validations/clinic.schema.ts +494 -494
- package/src/validations/common.schema.ts +25 -25
- package/src/validations/documentation-templates/index.ts +1 -1
- package/src/validations/documentation-templates/template.schema.ts +220 -220
- package/src/validations/documentation-templates.schema.ts +10 -10
- package/src/validations/index.ts +20 -20
- package/src/validations/media.schema.ts +10 -10
- package/src/validations/notification.schema.ts +90 -90
- package/src/validations/patient/aesthetic-analysis.schema.ts +55 -55
- package/src/validations/patient/medical-info.schema.ts +125 -125
- package/src/validations/patient/patient-requirements.schema.ts +84 -84
- package/src/validations/patient/token.schema.ts +29 -29
- package/src/validations/patient.schema.ts +217 -217
- package/src/validations/practitioner.schema.ts +222 -222
- package/src/validations/procedure-product.schema.ts +41 -41
- package/src/validations/procedure.schema.ts +124 -124
- package/src/validations/profile-info.schema.ts +41 -41
- package/src/validations/reviews.schema.ts +195 -195
- package/src/validations/schemas.ts +104 -104
- package/src/validations/shared.schema.ts +78 -78
|
@@ -1,498 +1,498 @@
|
|
|
1
|
-
import { Timestamp, FieldValue } from 'firebase/firestore';
|
|
2
|
-
|
|
3
|
-
import type { ClinicInfo } from '../profile';
|
|
4
|
-
import { ClinicReviewInfo } from '../reviews';
|
|
5
|
-
import { ProcedureSummaryInfo } from '../procedure';
|
|
6
|
-
|
|
7
|
-
export const CLINIC_GROUPS_COLLECTION = 'clinic_groups';
|
|
8
|
-
export const CLINIC_ADMINS_COLLECTION = 'clinic_admins';
|
|
9
|
-
export const CLINICS_COLLECTION = 'clinics';
|
|
10
|
-
|
|
11
|
-
import { PracticeType, Language, ClinicTag, ClinicPhotoTag } from './preferences.types';
|
|
12
|
-
import type { MediaResource } from '../../services/media/media.service';
|
|
13
|
-
|
|
14
|
-
export * from './preferences.types';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Interface for clinic contact information
|
|
18
|
-
*/
|
|
19
|
-
export interface ClinicContactInfo {
|
|
20
|
-
email: string;
|
|
21
|
-
phoneNumber: string;
|
|
22
|
-
alternativePhoneNumber?: string | null;
|
|
23
|
-
website?: string | null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Interface for clinic location
|
|
28
|
-
*/
|
|
29
|
-
export interface ClinicLocation {
|
|
30
|
-
address: string;
|
|
31
|
-
city: string;
|
|
32
|
-
country: string;
|
|
33
|
-
postalCode: string;
|
|
34
|
-
latitude: number;
|
|
35
|
-
longitude: number;
|
|
36
|
-
geohash?: string | null;
|
|
37
|
-
tz?: string | null;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Interface for a break period during working hours
|
|
42
|
-
*/
|
|
43
|
-
export interface Break {
|
|
44
|
-
title?: string;
|
|
45
|
-
start: string;
|
|
46
|
-
end: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Interface for working hours
|
|
51
|
-
*/
|
|
52
|
-
export interface WorkingHours {
|
|
53
|
-
monday: {
|
|
54
|
-
open: string;
|
|
55
|
-
close: string;
|
|
56
|
-
breaks?: Break[];
|
|
57
|
-
} | null;
|
|
58
|
-
tuesday: {
|
|
59
|
-
open: string;
|
|
60
|
-
close: string;
|
|
61
|
-
breaks?: Break[];
|
|
62
|
-
} | null;
|
|
63
|
-
wednesday: {
|
|
64
|
-
open: string;
|
|
65
|
-
close: string;
|
|
66
|
-
breaks?: Break[];
|
|
67
|
-
} | null;
|
|
68
|
-
thursday: {
|
|
69
|
-
open: string;
|
|
70
|
-
close: string;
|
|
71
|
-
breaks?: Break[];
|
|
72
|
-
} | null;
|
|
73
|
-
friday: {
|
|
74
|
-
open: string;
|
|
75
|
-
close: string;
|
|
76
|
-
breaks?: Break[];
|
|
77
|
-
} | null;
|
|
78
|
-
saturday: {
|
|
79
|
-
open: string;
|
|
80
|
-
close: string;
|
|
81
|
-
breaks?: Break[];
|
|
82
|
-
} | null;
|
|
83
|
-
sunday: {
|
|
84
|
-
open: string;
|
|
85
|
-
close: string;
|
|
86
|
-
breaks?: Break[];
|
|
87
|
-
} | null;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Interface for contact person
|
|
92
|
-
*/
|
|
93
|
-
export interface ContactPerson {
|
|
94
|
-
firstName: string;
|
|
95
|
-
lastName: string;
|
|
96
|
-
title?: string | null;
|
|
97
|
-
email: string;
|
|
98
|
-
phoneNumber?: string | null;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Interface for clinic admin
|
|
103
|
-
*/
|
|
104
|
-
export interface ClinicAdmin {
|
|
105
|
-
id: string;
|
|
106
|
-
userRef: string;
|
|
107
|
-
clinicGroupId: string; // Can be empty string initially for owners
|
|
108
|
-
isGroupOwner: boolean;
|
|
109
|
-
clinicsManaged: string[];
|
|
110
|
-
clinicsManagedInfo: ClinicInfo[];
|
|
111
|
-
contactInfo: ContactPerson;
|
|
112
|
-
roleTitle: string;
|
|
113
|
-
createdAt: Timestamp;
|
|
114
|
-
updatedAt: Timestamp;
|
|
115
|
-
isActive: boolean;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Interface for creating a clinic admin
|
|
120
|
-
*/
|
|
121
|
-
export interface CreateClinicAdminData {
|
|
122
|
-
userRef: string;
|
|
123
|
-
clinicGroupId?: string;
|
|
124
|
-
isGroupOwner: boolean;
|
|
125
|
-
clinicsManaged: string[];
|
|
126
|
-
clinicsManagedInfo?: ClinicInfo[];
|
|
127
|
-
contactInfo: ContactPerson;
|
|
128
|
-
roleTitle: string;
|
|
129
|
-
isActive: boolean;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Interface for updating a clinic admin
|
|
134
|
-
*/
|
|
135
|
-
export interface UpdateClinicAdminData extends Partial<CreateClinicAdminData> {
|
|
136
|
-
updatedAt?: FieldValue;
|
|
137
|
-
clinicsManagedInfo?: ClinicInfo[];
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Enum for admin token status
|
|
142
|
-
*/
|
|
143
|
-
export enum AdminTokenStatus {
|
|
144
|
-
ACTIVE = 'active',
|
|
145
|
-
USED = 'used',
|
|
146
|
-
EXPIRED = 'expired',
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Interface for admin token
|
|
151
|
-
*/
|
|
152
|
-
export interface AdminToken {
|
|
153
|
-
id: string;
|
|
154
|
-
token: string;
|
|
155
|
-
email?: string | null;
|
|
156
|
-
status: AdminTokenStatus;
|
|
157
|
-
usedByUserRef?: string;
|
|
158
|
-
createdAt: Timestamp;
|
|
159
|
-
expiresAt: Timestamp;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Interface for admin information
|
|
164
|
-
*/
|
|
165
|
-
export interface AdminInfo {
|
|
166
|
-
id: string;
|
|
167
|
-
name: string;
|
|
168
|
-
email: string;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Enum for subscription models
|
|
173
|
-
*/
|
|
174
|
-
export enum SubscriptionModel {
|
|
175
|
-
NO_SUBSCRIPTION = 'no_subscription',
|
|
176
|
-
BASIC = 'basic',
|
|
177
|
-
PREMIUM = 'premium',
|
|
178
|
-
ENTERPRISE = 'enterprise',
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Enum for subscription status
|
|
183
|
-
*/
|
|
184
|
-
export enum SubscriptionStatus {
|
|
185
|
-
PENDING = 'pending',
|
|
186
|
-
ACTIVE = 'active',
|
|
187
|
-
PENDING_CANCELLATION = 'pending_cancellation',
|
|
188
|
-
CANCELED = 'canceled',
|
|
189
|
-
PAST_DUE = 'past_due',
|
|
190
|
-
TRIALING = 'trialing',
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Interface for billing information
|
|
195
|
-
*/
|
|
196
|
-
export interface BillingInfo {
|
|
197
|
-
stripeCustomerId: string;
|
|
198
|
-
subscriptionStatus: SubscriptionStatus;
|
|
199
|
-
planType: string;
|
|
200
|
-
stripeSubscriptionId: string | null;
|
|
201
|
-
stripePriceId: string | null;
|
|
202
|
-
currentPeriodStart: Timestamp | null;
|
|
203
|
-
currentPeriodEnd: Timestamp | null;
|
|
204
|
-
updatedAt: Timestamp;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Enum for billing transaction types
|
|
209
|
-
*/
|
|
210
|
-
export enum BillingTransactionType {
|
|
211
|
-
SUBSCRIPTION_CREATED = 'subscription_created',
|
|
212
|
-
SUBSCRIPTION_ACTIVATED = 'subscription_activated',
|
|
213
|
-
SUBSCRIPTION_RENEWED = 'subscription_renewed',
|
|
214
|
-
SUBSCRIPTION_UPDATED = 'subscription_updated',
|
|
215
|
-
SUBSCRIPTION_CANCELED = 'subscription_canceled',
|
|
216
|
-
SUBSCRIPTION_REACTIVATED = 'subscription_reactivated',
|
|
217
|
-
SUBSCRIPTION_DELETED = 'subscription_deleted',
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Interface for Stripe data in billing transactions
|
|
222
|
-
*/
|
|
223
|
-
export interface StripeTransactionData {
|
|
224
|
-
sessionId?: string;
|
|
225
|
-
subscriptionId?: string;
|
|
226
|
-
invoiceId?: string;
|
|
227
|
-
priceId: string;
|
|
228
|
-
customerId: string;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Interface for plan details in billing transactions
|
|
233
|
-
*/
|
|
234
|
-
export interface PlanDetails {
|
|
235
|
-
planName: string;
|
|
236
|
-
planPeriod: string;
|
|
237
|
-
planDisplayName: string;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Interface for billing transactions
|
|
242
|
-
*/
|
|
243
|
-
export interface BillingTransaction {
|
|
244
|
-
id: string;
|
|
245
|
-
clinicGroupId: string;
|
|
246
|
-
type: BillingTransactionType;
|
|
247
|
-
description: string;
|
|
248
|
-
amount: number;
|
|
249
|
-
currency: string;
|
|
250
|
-
stripeData: StripeTransactionData;
|
|
251
|
-
planDetails: PlanDetails;
|
|
252
|
-
metadata?: Record<string, any>;
|
|
253
|
-
timestamp: Timestamp;
|
|
254
|
-
createdAt: Timestamp;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Interface for creating a billing transaction
|
|
259
|
-
*/
|
|
260
|
-
export interface CreateBillingTransactionData {
|
|
261
|
-
type: BillingTransactionType;
|
|
262
|
-
description: string;
|
|
263
|
-
amount: number;
|
|
264
|
-
currency: string;
|
|
265
|
-
stripeData: StripeTransactionData;
|
|
266
|
-
planDetails: PlanDetails;
|
|
267
|
-
metadata?: Record<string, any>;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Interface for clinic group
|
|
272
|
-
*/
|
|
273
|
-
export interface ClinicGroup {
|
|
274
|
-
id: string;
|
|
275
|
-
name: string;
|
|
276
|
-
description?: string;
|
|
277
|
-
hqLocation: ClinicLocation;
|
|
278
|
-
contactInfo: ClinicContactInfo;
|
|
279
|
-
contactPerson: ContactPerson;
|
|
280
|
-
clinics: string[];
|
|
281
|
-
clinicsInfo: ClinicInfo[];
|
|
282
|
-
admins: string[];
|
|
283
|
-
adminsInfo: AdminInfo[];
|
|
284
|
-
adminTokens: AdminToken[];
|
|
285
|
-
ownerId: string | null;
|
|
286
|
-
createdAt: Timestamp;
|
|
287
|
-
updatedAt: Timestamp;
|
|
288
|
-
isActive: boolean;
|
|
289
|
-
logo?: MediaResource | null;
|
|
290
|
-
practiceType?: PracticeType;
|
|
291
|
-
languages?: Language[];
|
|
292
|
-
subscriptionModel: SubscriptionModel;
|
|
293
|
-
billing?: BillingInfo;
|
|
294
|
-
calendarSyncEnabled?: boolean;
|
|
295
|
-
autoConfirmAppointments?: boolean;
|
|
296
|
-
businessIdentificationNumber?: string | null;
|
|
297
|
-
onboarding?: {
|
|
298
|
-
completed?: boolean;
|
|
299
|
-
step?: number;
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Interface for creating a clinic group
|
|
305
|
-
*/
|
|
306
|
-
export interface CreateClinicGroupData {
|
|
307
|
-
name: string;
|
|
308
|
-
description?: string;
|
|
309
|
-
hqLocation: ClinicLocation;
|
|
310
|
-
contactInfo: ClinicContactInfo;
|
|
311
|
-
contactPerson: ContactPerson;
|
|
312
|
-
ownerId: string | null;
|
|
313
|
-
isActive: boolean;
|
|
314
|
-
logo?: MediaResource | null;
|
|
315
|
-
practiceType?: PracticeType;
|
|
316
|
-
languages?: Language[];
|
|
317
|
-
subscriptionModel?: SubscriptionModel;
|
|
318
|
-
billing?: BillingInfo;
|
|
319
|
-
calendarSyncEnabled?: boolean;
|
|
320
|
-
autoConfirmAppointments?: boolean;
|
|
321
|
-
businessIdentificationNumber?: string | null;
|
|
322
|
-
tz?: string | null;
|
|
323
|
-
onboarding?: {
|
|
324
|
-
completed?: boolean;
|
|
325
|
-
step?: number;
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Interface for updating a clinic group
|
|
331
|
-
*/
|
|
332
|
-
export interface UpdateClinicGroupData extends Partial<CreateClinicGroupData> {
|
|
333
|
-
updatedAt?: FieldValue;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Interface for creating an admin token
|
|
338
|
-
*/
|
|
339
|
-
export interface CreateAdminTokenData {
|
|
340
|
-
expiresInDays?: number; // How many days the token is valid, default 7
|
|
341
|
-
email?: string | null;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Interface for doctor information
|
|
346
|
-
*/
|
|
347
|
-
export interface DoctorInfo {
|
|
348
|
-
id: string;
|
|
349
|
-
name: string;
|
|
350
|
-
description?: string;
|
|
351
|
-
photo: string | null;
|
|
352
|
-
rating: number;
|
|
353
|
-
services: string[]; // Used for search and filtering
|
|
354
|
-
// TODO: Add aggregated fields, like rating, reviews, services this doctor provides in this clinic and similar
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* Interface for clinic
|
|
359
|
-
*/
|
|
360
|
-
export interface Clinic {
|
|
361
|
-
id: string;
|
|
362
|
-
clinicGroupId: string;
|
|
363
|
-
name: string;
|
|
364
|
-
nameLower: string; // Add this line
|
|
365
|
-
description?: string;
|
|
366
|
-
location: ClinicLocation;
|
|
367
|
-
contactInfo: ClinicContactInfo;
|
|
368
|
-
workingHours: WorkingHours;
|
|
369
|
-
tags: ClinicTag[];
|
|
370
|
-
featuredPhotos: MediaResource[];
|
|
371
|
-
coverPhoto: MediaResource | null;
|
|
372
|
-
photosWithTags?: { url: MediaResource; tag: string }[];
|
|
373
|
-
doctors: string[];
|
|
374
|
-
doctorsInfo: DoctorInfo[];
|
|
375
|
-
procedures: string[];
|
|
376
|
-
proceduresInfo: ProcedureSummaryInfo[];
|
|
377
|
-
reviewInfo: ClinicReviewInfo;
|
|
378
|
-
admins: string[];
|
|
379
|
-
createdAt: Timestamp;
|
|
380
|
-
updatedAt: Timestamp;
|
|
381
|
-
isActive: boolean;
|
|
382
|
-
isVerified: boolean;
|
|
383
|
-
logo?: MediaResource | null;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* Interface for creating a clinic
|
|
388
|
-
*/
|
|
389
|
-
export interface CreateClinicData {
|
|
390
|
-
clinicGroupId: string;
|
|
391
|
-
name: string;
|
|
392
|
-
description?: string;
|
|
393
|
-
location: ClinicLocation;
|
|
394
|
-
contactInfo: ClinicContactInfo;
|
|
395
|
-
workingHours: WorkingHours;
|
|
396
|
-
tags: ClinicTag[];
|
|
397
|
-
coverPhoto?: MediaResource | null;
|
|
398
|
-
photosWithTags?: { url: MediaResource; tag: string }[];
|
|
399
|
-
doctors?: string[];
|
|
400
|
-
procedures?: string[];
|
|
401
|
-
proceduresInfo?: ProcedureSummaryInfo[];
|
|
402
|
-
admins: string[];
|
|
403
|
-
isActive?: boolean;
|
|
404
|
-
isVerified?: boolean;
|
|
405
|
-
logo?: MediaResource | null;
|
|
406
|
-
featuredPhotos?: MediaResource[];
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Interface for updating a clinic
|
|
411
|
-
*/
|
|
412
|
-
export interface UpdateClinicData extends Partial<CreateClinicData> {
|
|
413
|
-
updatedAt?: FieldValue;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* Interface for creating a default clinic group
|
|
418
|
-
*/
|
|
419
|
-
export interface CreateDefaultClinicGroupData {
|
|
420
|
-
name: string;
|
|
421
|
-
ownerId: string | null;
|
|
422
|
-
contactPerson: ContactPerson;
|
|
423
|
-
contactInfo: ClinicContactInfo;
|
|
424
|
-
hqLocation: ClinicLocation;
|
|
425
|
-
isActive: boolean;
|
|
426
|
-
logo?: string | File | null;
|
|
427
|
-
practiceType?: PracticeType;
|
|
428
|
-
languages?: Language[];
|
|
429
|
-
subscriptionModel?: SubscriptionModel;
|
|
430
|
-
onboarding?: {
|
|
431
|
-
completed?: boolean;
|
|
432
|
-
step?: number;
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Interface for clinic admin signup data
|
|
438
|
-
*/
|
|
439
|
-
export interface ClinicAdminSignupData {
|
|
440
|
-
email: string;
|
|
441
|
-
password: string;
|
|
442
|
-
firstName: string;
|
|
443
|
-
lastName: string;
|
|
444
|
-
title: string;
|
|
445
|
-
phoneNumber: string;
|
|
446
|
-
isCreatingNewGroup: boolean;
|
|
447
|
-
inviteToken?: string;
|
|
448
|
-
clinicGroupData?: {
|
|
449
|
-
name: string;
|
|
450
|
-
hqLocation: ClinicLocation;
|
|
451
|
-
logo?: string | File | null;
|
|
452
|
-
contactInfo: ClinicContactInfo;
|
|
453
|
-
subscriptionModel?: SubscriptionModel;
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Interface for clinic group setup data
|
|
459
|
-
*/
|
|
460
|
-
export interface ClinicGroupSetupData {
|
|
461
|
-
languages: Language[];
|
|
462
|
-
practiceType: PracticeType;
|
|
463
|
-
description: string;
|
|
464
|
-
logo: string | File | null;
|
|
465
|
-
calendarSyncEnabled: boolean;
|
|
466
|
-
autoConfirmAppointments: boolean;
|
|
467
|
-
businessIdentificationNumber: string | null;
|
|
468
|
-
onboarding?: {
|
|
469
|
-
completed?: boolean;
|
|
470
|
-
step?: number;
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* Interface for clinic branch setup data
|
|
476
|
-
*/
|
|
477
|
-
export interface ClinicBranchSetupData {
|
|
478
|
-
name: string;
|
|
479
|
-
location: ClinicLocation;
|
|
480
|
-
description?: string;
|
|
481
|
-
contactInfo: ClinicContactInfo;
|
|
482
|
-
workingHours: WorkingHours;
|
|
483
|
-
tags: ClinicTag[];
|
|
484
|
-
logo?: MediaResource | null;
|
|
485
|
-
coverPhoto?: MediaResource | null;
|
|
486
|
-
photosWithTags?: { url: MediaResource; tag: string }[];
|
|
487
|
-
featuredPhotos?: MediaResource[];
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Interface for clinic tags
|
|
492
|
-
*/
|
|
493
|
-
export interface ClinicTags {
|
|
494
|
-
tags: ClinicTag[];
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
// Export practitioner invite types
|
|
498
|
-
export * from './practitioner-invite.types';
|
|
1
|
+
import { Timestamp, FieldValue } from 'firebase/firestore';
|
|
2
|
+
|
|
3
|
+
import type { ClinicInfo } from '../profile';
|
|
4
|
+
import { ClinicReviewInfo } from '../reviews';
|
|
5
|
+
import { ProcedureSummaryInfo } from '../procedure';
|
|
6
|
+
|
|
7
|
+
export const CLINIC_GROUPS_COLLECTION = 'clinic_groups';
|
|
8
|
+
export const CLINIC_ADMINS_COLLECTION = 'clinic_admins';
|
|
9
|
+
export const CLINICS_COLLECTION = 'clinics';
|
|
10
|
+
|
|
11
|
+
import { PracticeType, Language, ClinicTag, ClinicPhotoTag } from './preferences.types';
|
|
12
|
+
import type { MediaResource } from '../../services/media/media.service';
|
|
13
|
+
|
|
14
|
+
export * from './preferences.types';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Interface for clinic contact information
|
|
18
|
+
*/
|
|
19
|
+
export interface ClinicContactInfo {
|
|
20
|
+
email: string;
|
|
21
|
+
phoneNumber: string;
|
|
22
|
+
alternativePhoneNumber?: string | null;
|
|
23
|
+
website?: string | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Interface for clinic location
|
|
28
|
+
*/
|
|
29
|
+
export interface ClinicLocation {
|
|
30
|
+
address: string;
|
|
31
|
+
city: string;
|
|
32
|
+
country: string;
|
|
33
|
+
postalCode: string;
|
|
34
|
+
latitude: number;
|
|
35
|
+
longitude: number;
|
|
36
|
+
geohash?: string | null;
|
|
37
|
+
tz?: string | null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Interface for a break period during working hours
|
|
42
|
+
*/
|
|
43
|
+
export interface Break {
|
|
44
|
+
title?: string;
|
|
45
|
+
start: string;
|
|
46
|
+
end: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Interface for working hours
|
|
51
|
+
*/
|
|
52
|
+
export interface WorkingHours {
|
|
53
|
+
monday: {
|
|
54
|
+
open: string;
|
|
55
|
+
close: string;
|
|
56
|
+
breaks?: Break[];
|
|
57
|
+
} | null;
|
|
58
|
+
tuesday: {
|
|
59
|
+
open: string;
|
|
60
|
+
close: string;
|
|
61
|
+
breaks?: Break[];
|
|
62
|
+
} | null;
|
|
63
|
+
wednesday: {
|
|
64
|
+
open: string;
|
|
65
|
+
close: string;
|
|
66
|
+
breaks?: Break[];
|
|
67
|
+
} | null;
|
|
68
|
+
thursday: {
|
|
69
|
+
open: string;
|
|
70
|
+
close: string;
|
|
71
|
+
breaks?: Break[];
|
|
72
|
+
} | null;
|
|
73
|
+
friday: {
|
|
74
|
+
open: string;
|
|
75
|
+
close: string;
|
|
76
|
+
breaks?: Break[];
|
|
77
|
+
} | null;
|
|
78
|
+
saturday: {
|
|
79
|
+
open: string;
|
|
80
|
+
close: string;
|
|
81
|
+
breaks?: Break[];
|
|
82
|
+
} | null;
|
|
83
|
+
sunday: {
|
|
84
|
+
open: string;
|
|
85
|
+
close: string;
|
|
86
|
+
breaks?: Break[];
|
|
87
|
+
} | null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Interface for contact person
|
|
92
|
+
*/
|
|
93
|
+
export interface ContactPerson {
|
|
94
|
+
firstName: string;
|
|
95
|
+
lastName: string;
|
|
96
|
+
title?: string | null;
|
|
97
|
+
email: string;
|
|
98
|
+
phoneNumber?: string | null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Interface for clinic admin
|
|
103
|
+
*/
|
|
104
|
+
export interface ClinicAdmin {
|
|
105
|
+
id: string;
|
|
106
|
+
userRef: string;
|
|
107
|
+
clinicGroupId: string; // Can be empty string initially for owners
|
|
108
|
+
isGroupOwner: boolean;
|
|
109
|
+
clinicsManaged: string[];
|
|
110
|
+
clinicsManagedInfo: ClinicInfo[];
|
|
111
|
+
contactInfo: ContactPerson;
|
|
112
|
+
roleTitle: string;
|
|
113
|
+
createdAt: Timestamp;
|
|
114
|
+
updatedAt: Timestamp;
|
|
115
|
+
isActive: boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Interface for creating a clinic admin
|
|
120
|
+
*/
|
|
121
|
+
export interface CreateClinicAdminData {
|
|
122
|
+
userRef: string;
|
|
123
|
+
clinicGroupId?: string;
|
|
124
|
+
isGroupOwner: boolean;
|
|
125
|
+
clinicsManaged: string[];
|
|
126
|
+
clinicsManagedInfo?: ClinicInfo[];
|
|
127
|
+
contactInfo: ContactPerson;
|
|
128
|
+
roleTitle: string;
|
|
129
|
+
isActive: boolean;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Interface for updating a clinic admin
|
|
134
|
+
*/
|
|
135
|
+
export interface UpdateClinicAdminData extends Partial<CreateClinicAdminData> {
|
|
136
|
+
updatedAt?: FieldValue;
|
|
137
|
+
clinicsManagedInfo?: ClinicInfo[];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Enum for admin token status
|
|
142
|
+
*/
|
|
143
|
+
export enum AdminTokenStatus {
|
|
144
|
+
ACTIVE = 'active',
|
|
145
|
+
USED = 'used',
|
|
146
|
+
EXPIRED = 'expired',
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Interface for admin token
|
|
151
|
+
*/
|
|
152
|
+
export interface AdminToken {
|
|
153
|
+
id: string;
|
|
154
|
+
token: string;
|
|
155
|
+
email?: string | null;
|
|
156
|
+
status: AdminTokenStatus;
|
|
157
|
+
usedByUserRef?: string;
|
|
158
|
+
createdAt: Timestamp;
|
|
159
|
+
expiresAt: Timestamp;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Interface for admin information
|
|
164
|
+
*/
|
|
165
|
+
export interface AdminInfo {
|
|
166
|
+
id: string;
|
|
167
|
+
name: string;
|
|
168
|
+
email: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Enum for subscription models
|
|
173
|
+
*/
|
|
174
|
+
export enum SubscriptionModel {
|
|
175
|
+
NO_SUBSCRIPTION = 'no_subscription',
|
|
176
|
+
BASIC = 'basic',
|
|
177
|
+
PREMIUM = 'premium',
|
|
178
|
+
ENTERPRISE = 'enterprise',
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Enum for subscription status
|
|
183
|
+
*/
|
|
184
|
+
export enum SubscriptionStatus {
|
|
185
|
+
PENDING = 'pending',
|
|
186
|
+
ACTIVE = 'active',
|
|
187
|
+
PENDING_CANCELLATION = 'pending_cancellation',
|
|
188
|
+
CANCELED = 'canceled',
|
|
189
|
+
PAST_DUE = 'past_due',
|
|
190
|
+
TRIALING = 'trialing',
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Interface for billing information
|
|
195
|
+
*/
|
|
196
|
+
export interface BillingInfo {
|
|
197
|
+
stripeCustomerId: string;
|
|
198
|
+
subscriptionStatus: SubscriptionStatus;
|
|
199
|
+
planType: string;
|
|
200
|
+
stripeSubscriptionId: string | null;
|
|
201
|
+
stripePriceId: string | null;
|
|
202
|
+
currentPeriodStart: Timestamp | null;
|
|
203
|
+
currentPeriodEnd: Timestamp | null;
|
|
204
|
+
updatedAt: Timestamp;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Enum for billing transaction types
|
|
209
|
+
*/
|
|
210
|
+
export enum BillingTransactionType {
|
|
211
|
+
SUBSCRIPTION_CREATED = 'subscription_created',
|
|
212
|
+
SUBSCRIPTION_ACTIVATED = 'subscription_activated',
|
|
213
|
+
SUBSCRIPTION_RENEWED = 'subscription_renewed',
|
|
214
|
+
SUBSCRIPTION_UPDATED = 'subscription_updated',
|
|
215
|
+
SUBSCRIPTION_CANCELED = 'subscription_canceled',
|
|
216
|
+
SUBSCRIPTION_REACTIVATED = 'subscription_reactivated',
|
|
217
|
+
SUBSCRIPTION_DELETED = 'subscription_deleted',
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Interface for Stripe data in billing transactions
|
|
222
|
+
*/
|
|
223
|
+
export interface StripeTransactionData {
|
|
224
|
+
sessionId?: string;
|
|
225
|
+
subscriptionId?: string;
|
|
226
|
+
invoiceId?: string;
|
|
227
|
+
priceId: string;
|
|
228
|
+
customerId: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Interface for plan details in billing transactions
|
|
233
|
+
*/
|
|
234
|
+
export interface PlanDetails {
|
|
235
|
+
planName: string;
|
|
236
|
+
planPeriod: string;
|
|
237
|
+
planDisplayName: string;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Interface for billing transactions
|
|
242
|
+
*/
|
|
243
|
+
export interface BillingTransaction {
|
|
244
|
+
id: string;
|
|
245
|
+
clinicGroupId: string;
|
|
246
|
+
type: BillingTransactionType;
|
|
247
|
+
description: string;
|
|
248
|
+
amount: number;
|
|
249
|
+
currency: string;
|
|
250
|
+
stripeData: StripeTransactionData;
|
|
251
|
+
planDetails: PlanDetails;
|
|
252
|
+
metadata?: Record<string, any>;
|
|
253
|
+
timestamp: Timestamp;
|
|
254
|
+
createdAt: Timestamp;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Interface for creating a billing transaction
|
|
259
|
+
*/
|
|
260
|
+
export interface CreateBillingTransactionData {
|
|
261
|
+
type: BillingTransactionType;
|
|
262
|
+
description: string;
|
|
263
|
+
amount: number;
|
|
264
|
+
currency: string;
|
|
265
|
+
stripeData: StripeTransactionData;
|
|
266
|
+
planDetails: PlanDetails;
|
|
267
|
+
metadata?: Record<string, any>;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Interface for clinic group
|
|
272
|
+
*/
|
|
273
|
+
export interface ClinicGroup {
|
|
274
|
+
id: string;
|
|
275
|
+
name: string;
|
|
276
|
+
description?: string;
|
|
277
|
+
hqLocation: ClinicLocation;
|
|
278
|
+
contactInfo: ClinicContactInfo;
|
|
279
|
+
contactPerson: ContactPerson;
|
|
280
|
+
clinics: string[];
|
|
281
|
+
clinicsInfo: ClinicInfo[];
|
|
282
|
+
admins: string[];
|
|
283
|
+
adminsInfo: AdminInfo[];
|
|
284
|
+
adminTokens: AdminToken[];
|
|
285
|
+
ownerId: string | null;
|
|
286
|
+
createdAt: Timestamp;
|
|
287
|
+
updatedAt: Timestamp;
|
|
288
|
+
isActive: boolean;
|
|
289
|
+
logo?: MediaResource | null;
|
|
290
|
+
practiceType?: PracticeType;
|
|
291
|
+
languages?: Language[];
|
|
292
|
+
subscriptionModel: SubscriptionModel;
|
|
293
|
+
billing?: BillingInfo;
|
|
294
|
+
calendarSyncEnabled?: boolean;
|
|
295
|
+
autoConfirmAppointments?: boolean;
|
|
296
|
+
businessIdentificationNumber?: string | null;
|
|
297
|
+
onboarding?: {
|
|
298
|
+
completed?: boolean;
|
|
299
|
+
step?: number;
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Interface for creating a clinic group
|
|
305
|
+
*/
|
|
306
|
+
export interface CreateClinicGroupData {
|
|
307
|
+
name: string;
|
|
308
|
+
description?: string;
|
|
309
|
+
hqLocation: ClinicLocation;
|
|
310
|
+
contactInfo: ClinicContactInfo;
|
|
311
|
+
contactPerson: ContactPerson;
|
|
312
|
+
ownerId: string | null;
|
|
313
|
+
isActive: boolean;
|
|
314
|
+
logo?: MediaResource | null;
|
|
315
|
+
practiceType?: PracticeType;
|
|
316
|
+
languages?: Language[];
|
|
317
|
+
subscriptionModel?: SubscriptionModel;
|
|
318
|
+
billing?: BillingInfo;
|
|
319
|
+
calendarSyncEnabled?: boolean;
|
|
320
|
+
autoConfirmAppointments?: boolean;
|
|
321
|
+
businessIdentificationNumber?: string | null;
|
|
322
|
+
tz?: string | null;
|
|
323
|
+
onboarding?: {
|
|
324
|
+
completed?: boolean;
|
|
325
|
+
step?: number;
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Interface for updating a clinic group
|
|
331
|
+
*/
|
|
332
|
+
export interface UpdateClinicGroupData extends Partial<CreateClinicGroupData> {
|
|
333
|
+
updatedAt?: FieldValue;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Interface for creating an admin token
|
|
338
|
+
*/
|
|
339
|
+
export interface CreateAdminTokenData {
|
|
340
|
+
expiresInDays?: number; // How many days the token is valid, default 7
|
|
341
|
+
email?: string | null;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Interface for doctor information
|
|
346
|
+
*/
|
|
347
|
+
export interface DoctorInfo {
|
|
348
|
+
id: string;
|
|
349
|
+
name: string;
|
|
350
|
+
description?: string;
|
|
351
|
+
photo: string | null;
|
|
352
|
+
rating: number;
|
|
353
|
+
services: string[]; // Used for search and filtering
|
|
354
|
+
// TODO: Add aggregated fields, like rating, reviews, services this doctor provides in this clinic and similar
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Interface for clinic
|
|
359
|
+
*/
|
|
360
|
+
export interface Clinic {
|
|
361
|
+
id: string;
|
|
362
|
+
clinicGroupId: string;
|
|
363
|
+
name: string;
|
|
364
|
+
nameLower: string; // Add this line
|
|
365
|
+
description?: string;
|
|
366
|
+
location: ClinicLocation;
|
|
367
|
+
contactInfo: ClinicContactInfo;
|
|
368
|
+
workingHours: WorkingHours;
|
|
369
|
+
tags: ClinicTag[];
|
|
370
|
+
featuredPhotos: MediaResource[];
|
|
371
|
+
coverPhoto: MediaResource | null;
|
|
372
|
+
photosWithTags?: { url: MediaResource; tag: string }[];
|
|
373
|
+
doctors: string[];
|
|
374
|
+
doctorsInfo: DoctorInfo[];
|
|
375
|
+
procedures: string[];
|
|
376
|
+
proceduresInfo: ProcedureSummaryInfo[];
|
|
377
|
+
reviewInfo: ClinicReviewInfo;
|
|
378
|
+
admins: string[];
|
|
379
|
+
createdAt: Timestamp;
|
|
380
|
+
updatedAt: Timestamp;
|
|
381
|
+
isActive: boolean;
|
|
382
|
+
isVerified: boolean;
|
|
383
|
+
logo?: MediaResource | null;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Interface for creating a clinic
|
|
388
|
+
*/
|
|
389
|
+
export interface CreateClinicData {
|
|
390
|
+
clinicGroupId: string;
|
|
391
|
+
name: string;
|
|
392
|
+
description?: string;
|
|
393
|
+
location: ClinicLocation;
|
|
394
|
+
contactInfo: ClinicContactInfo;
|
|
395
|
+
workingHours: WorkingHours;
|
|
396
|
+
tags: ClinicTag[];
|
|
397
|
+
coverPhoto?: MediaResource | null;
|
|
398
|
+
photosWithTags?: { url: MediaResource; tag: string }[];
|
|
399
|
+
doctors?: string[];
|
|
400
|
+
procedures?: string[];
|
|
401
|
+
proceduresInfo?: ProcedureSummaryInfo[];
|
|
402
|
+
admins: string[];
|
|
403
|
+
isActive?: boolean;
|
|
404
|
+
isVerified?: boolean;
|
|
405
|
+
logo?: MediaResource | null;
|
|
406
|
+
featuredPhotos?: MediaResource[];
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Interface for updating a clinic
|
|
411
|
+
*/
|
|
412
|
+
export interface UpdateClinicData extends Partial<CreateClinicData> {
|
|
413
|
+
updatedAt?: FieldValue;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Interface for creating a default clinic group
|
|
418
|
+
*/
|
|
419
|
+
export interface CreateDefaultClinicGroupData {
|
|
420
|
+
name: string;
|
|
421
|
+
ownerId: string | null;
|
|
422
|
+
contactPerson: ContactPerson;
|
|
423
|
+
contactInfo: ClinicContactInfo;
|
|
424
|
+
hqLocation: ClinicLocation;
|
|
425
|
+
isActive: boolean;
|
|
426
|
+
logo?: string | File | null;
|
|
427
|
+
practiceType?: PracticeType;
|
|
428
|
+
languages?: Language[];
|
|
429
|
+
subscriptionModel?: SubscriptionModel;
|
|
430
|
+
onboarding?: {
|
|
431
|
+
completed?: boolean;
|
|
432
|
+
step?: number;
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Interface for clinic admin signup data
|
|
438
|
+
*/
|
|
439
|
+
export interface ClinicAdminSignupData {
|
|
440
|
+
email: string;
|
|
441
|
+
password: string;
|
|
442
|
+
firstName: string;
|
|
443
|
+
lastName: string;
|
|
444
|
+
title: string;
|
|
445
|
+
phoneNumber: string;
|
|
446
|
+
isCreatingNewGroup: boolean;
|
|
447
|
+
inviteToken?: string;
|
|
448
|
+
clinicGroupData?: {
|
|
449
|
+
name: string;
|
|
450
|
+
hqLocation: ClinicLocation;
|
|
451
|
+
logo?: string | File | null;
|
|
452
|
+
contactInfo: ClinicContactInfo;
|
|
453
|
+
subscriptionModel?: SubscriptionModel;
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Interface for clinic group setup data
|
|
459
|
+
*/
|
|
460
|
+
export interface ClinicGroupSetupData {
|
|
461
|
+
languages: Language[];
|
|
462
|
+
practiceType: PracticeType;
|
|
463
|
+
description: string;
|
|
464
|
+
logo: string | File | null;
|
|
465
|
+
calendarSyncEnabled: boolean;
|
|
466
|
+
autoConfirmAppointments: boolean;
|
|
467
|
+
businessIdentificationNumber: string | null;
|
|
468
|
+
onboarding?: {
|
|
469
|
+
completed?: boolean;
|
|
470
|
+
step?: number;
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Interface for clinic branch setup data
|
|
476
|
+
*/
|
|
477
|
+
export interface ClinicBranchSetupData {
|
|
478
|
+
name: string;
|
|
479
|
+
location: ClinicLocation;
|
|
480
|
+
description?: string;
|
|
481
|
+
contactInfo: ClinicContactInfo;
|
|
482
|
+
workingHours: WorkingHours;
|
|
483
|
+
tags: ClinicTag[];
|
|
484
|
+
logo?: MediaResource | null;
|
|
485
|
+
coverPhoto?: MediaResource | null;
|
|
486
|
+
photosWithTags?: { url: MediaResource; tag: string }[];
|
|
487
|
+
featuredPhotos?: MediaResource[];
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Interface for clinic tags
|
|
492
|
+
*/
|
|
493
|
+
export interface ClinicTags {
|
|
494
|
+
tags: ClinicTag[];
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// Export practitioner invite types
|
|
498
|
+
export * from './practitioner-invite.types';
|