@fayz-ai/plugin-agenda 0.9.0 → 0.10.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.
Files changed (196) hide show
  1. package/README.md +3 -3
  2. package/dist/bridges/create-financial-bridge.d.ts +1 -1
  3. package/dist/bridges/create-financial-bridge.d.ts.map +1 -1
  4. package/dist/bridges/financial-bridge.d.ts.map +1 -0
  5. package/dist/{chunk-Q2PAWBPR.js → chunk-ISLJXP7O.js} +7 -2
  6. package/dist/chunk-ISLJXP7O.js.map +1 -0
  7. package/dist/components/AppointmentModal.d.ts.map +1 -1
  8. package/dist/components/PaymentStatusBadge.d.ts +1 -1
  9. package/dist/components/PaymentStatusBadge.d.ts.map +1 -1
  10. package/dist/config.d.ts +2 -2
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/{AgendaContext.d.ts → context.d.ts} +1 -1
  13. package/dist/context.d.ts.map +1 -0
  14. package/dist/data/mock.d.ts.map +1 -1
  15. package/dist/data/realtime.test.d.ts +2 -0
  16. package/dist/data/realtime.test.d.ts.map +1 -0
  17. package/dist/data/registries.d.ts.map +1 -0
  18. package/dist/data/supabase.d.ts.map +1 -1
  19. package/dist/data/types.d.ts +7 -0
  20. package/dist/data/types.d.ts.map +1 -1
  21. package/dist/index.d.ts +2 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +2515 -187
  24. package/dist/index.js.map +1 -1
  25. package/dist/integrations/google-calendar/conflict.d.ts +25 -0
  26. package/dist/integrations/google-calendar/conflict.d.ts.map +1 -0
  27. package/dist/integrations/google-calendar/connectorDef.d.ts +12 -0
  28. package/dist/integrations/google-calendar/connectorDef.d.ts.map +1 -1
  29. package/dist/integrations/google-calendar/credentials.d.ts +27 -0
  30. package/dist/integrations/google-calendar/credentials.d.ts.map +1 -0
  31. package/dist/integrations/google-calendar/data/supabase.d.ts +10 -2
  32. package/dist/integrations/google-calendar/data/supabase.d.ts.map +1 -1
  33. package/dist/integrations/google-calendar/data/tables.d.ts +2 -0
  34. package/dist/integrations/google-calendar/data/tables.d.ts.map +1 -1
  35. package/dist/integrations/google-calendar/health.d.ts +23 -0
  36. package/dist/integrations/google-calendar/health.d.ts.map +1 -0
  37. package/dist/integrations/google-calendar/health.test.d.ts +2 -0
  38. package/dist/integrations/google-calendar/health.test.d.ts.map +1 -0
  39. package/dist/integrations/google-calendar/index.d.ts +6 -0
  40. package/dist/integrations/google-calendar/index.d.ts.map +1 -1
  41. package/dist/integrations/google-calendar/migrations/index.d.ts +12 -0
  42. package/dist/integrations/google-calendar/migrations/index.d.ts.map +1 -0
  43. package/dist/integrations/google-calendar/panel-data.d.ts +26 -0
  44. package/dist/integrations/google-calendar/panel-data.d.ts.map +1 -0
  45. package/dist/integrations/google-calendar/panel-data.test.d.ts +2 -0
  46. package/dist/integrations/google-calendar/panel-data.test.d.ts.map +1 -0
  47. package/dist/integrations/google-calendar/types.d.ts +17 -0
  48. package/dist/integrations/google-calendar/types.d.ts.map +1 -1
  49. package/dist/lib/booking-events.d.ts +5 -0
  50. package/dist/lib/booking-events.d.ts.map +1 -0
  51. package/dist/lib/calendar-events.d.ts +8 -0
  52. package/dist/lib/calendar-events.d.ts.map +1 -0
  53. package/dist/lib/calendar-events.test.d.ts +2 -0
  54. package/dist/lib/calendar-events.test.d.ts.map +1 -0
  55. package/dist/lib/message-events.d.ts +12 -0
  56. package/dist/lib/message-events.d.ts.map +1 -0
  57. package/dist/locales/en.d.ts.map +1 -1
  58. package/dist/locales/pt-BR.d.ts.map +1 -1
  59. package/dist/public/{data.d.ts → data/index.d.ts} +4 -4
  60. package/dist/public/data/index.d.ts.map +1 -0
  61. package/dist/public/{data.supabase.d.ts → data/supabase.d.ts} +2 -2
  62. package/dist/public/data/supabase.d.ts.map +1 -0
  63. package/dist/public/{hooks.d.ts → hooks/index.d.ts} +4 -4
  64. package/dist/public/hooks/index.d.ts.map +1 -0
  65. package/dist/public/index.d.ts +4 -4
  66. package/dist/public/index.d.ts.map +1 -1
  67. package/dist/public/index.js +3 -3
  68. package/dist/public/index.js.map +1 -1
  69. package/dist/public/{format.d.ts → lib/format.d.ts} +1 -1
  70. package/dist/public/lib/format.d.ts.map +1 -0
  71. package/dist/public/views/BookingWidget.d.ts.map +1 -0
  72. package/dist/public/{steps → views/steps}/ContactStep.d.ts +1 -1
  73. package/dist/public/views/steps/ContactStep.d.ts.map +1 -0
  74. package/dist/public/{steps → views/steps}/DateTimeStep.d.ts +3 -3
  75. package/dist/public/views/steps/DateTimeStep.d.ts.map +1 -0
  76. package/dist/public/{steps → views/steps}/OverviewStep.d.ts +1 -1
  77. package/dist/public/views/steps/OverviewStep.d.ts.map +1 -0
  78. package/dist/public/{steps → views/steps}/PaymentStep.d.ts +1 -1
  79. package/dist/public/views/steps/PaymentStep.d.ts.map +1 -0
  80. package/dist/store.d.ts +1 -1
  81. package/dist/store.d.ts.map +1 -1
  82. package/dist/styles/calendar-styles.d.ts.map +1 -0
  83. package/dist/types.d.ts +1 -1
  84. package/dist/types.d.ts.map +1 -1
  85. package/dist/{AgendaPage.d.ts → views/AgendaPage.d.ts} +3 -3
  86. package/dist/views/AgendaPage.d.ts.map +1 -0
  87. package/dist/views/CalendarView.d.ts.map +1 -1
  88. package/package.json +9 -11
  89. package/dist/AgendaContext.d.ts.map +0 -1
  90. package/dist/AgendaPage.d.ts.map +0 -1
  91. package/dist/calendar-styles.d.ts.map +0 -1
  92. package/dist/chunk-Q2PAWBPR.js.map +0 -1
  93. package/dist/financial-bridge.d.ts.map +0 -1
  94. package/dist/integrations/google-calendar/GoogleCalendarSettings.d.ts +0 -3
  95. package/dist/integrations/google-calendar/GoogleCalendarSettings.d.ts.map +0 -1
  96. package/dist/public/BookingWidget.d.ts.map +0 -1
  97. package/dist/public/data.d.ts.map +0 -1
  98. package/dist/public/data.supabase.d.ts.map +0 -1
  99. package/dist/public/format.d.ts.map +0 -1
  100. package/dist/public/hooks.d.ts.map +0 -1
  101. package/dist/public/steps/ContactStep.d.ts.map +0 -1
  102. package/dist/public/steps/DateTimeStep.d.ts.map +0 -1
  103. package/dist/public/steps/OverviewStep.d.ts.map +0 -1
  104. package/dist/public/steps/PaymentStep.d.ts.map +0 -1
  105. package/dist/registries.d.ts.map +0 -1
  106. package/src/AgendaContext.tsx +0 -11
  107. package/src/AgendaPage.tsx +0 -33
  108. package/src/bridges/create-financial-bridge.ts +0 -296
  109. package/src/calendar-styles.css +0 -245
  110. package/src/calendar-styles.ts +0 -285
  111. package/src/components/AgendaGeneralSettings.tsx +0 -86
  112. package/src/components/AgendaMobileList.tsx +0 -103
  113. package/src/components/AppointmentModal.tsx +0 -1050
  114. package/src/components/AppointmentPopover.tsx +0 -231
  115. package/src/components/BookingPaymentPanel.tsx +0 -394
  116. package/src/components/CalendarSidebar.tsx +0 -119
  117. package/src/components/CalendarToolbar.tsx +0 -86
  118. package/src/components/EventContextMenu.tsx +0 -125
  119. package/src/components/FloatingPanel.tsx +0 -123
  120. package/src/components/MiniCalendar.tsx +0 -120
  121. package/src/components/PaymentStatusBadge.tsx +0 -62
  122. package/src/components/StatusBadge.tsx +0 -23
  123. package/src/config.ts +0 -368
  124. package/src/data/index.ts +0 -4
  125. package/src/data/mock.ts +0 -344
  126. package/src/data/supabase.ts +0 -636
  127. package/src/data/types.ts +0 -37
  128. package/src/financial-bridge.ts +0 -96
  129. package/src/hooks/useAgendaSettings.ts +0 -17
  130. package/src/index.ts +0 -297
  131. package/src/integrations/google-calendar/GoogleCalendarSettings.tsx +0 -136
  132. package/src/integrations/google-calendar/components/CalendarColorDot.tsx +0 -23
  133. package/src/integrations/google-calendar/components/ChannelMappingList.tsx +0 -329
  134. package/src/integrations/google-calendar/components/ImportEventsWizard.tsx +0 -215
  135. package/src/integrations/google-calendar/components/useAgendaLookups.ts +0 -100
  136. package/src/integrations/google-calendar/connector.ts +0 -20
  137. package/src/integrations/google-calendar/connectorDef.tsx +0 -185
  138. package/src/integrations/google-calendar/data/supabase.ts +0 -170
  139. package/src/integrations/google-calendar/data/tables.ts +0 -12
  140. package/src/integrations/google-calendar/index.ts +0 -45
  141. package/src/integrations/google-calendar/integration.test.ts +0 -199
  142. package/src/integrations/google-calendar/mapping.ts +0 -183
  143. package/src/integrations/google-calendar/migrations/001_google_calendar.sql +0 -97
  144. package/src/integrations/google-calendar/migrations/002_smart_sync.sql +0 -517
  145. package/src/integrations/google-calendar/migrations/003_plg_rename.sql +0 -273
  146. package/src/integrations/google-calendar/types.ts +0 -142
  147. package/src/lib/tenant.ts +0 -3
  148. package/src/locales/en.ts +0 -220
  149. package/src/locales/index.ts +0 -7
  150. package/src/locales/pt-BR.ts +0 -220
  151. package/src/migrations/000b_v_bookings_rename.sql +0 -21
  152. package/src/migrations/000c_dedupe_customer_phones.sql +0 -43
  153. package/src/migrations/001_public_booking.sql +0 -296
  154. package/src/migrations/002_v_bookings_compat.sql +0 -14
  155. package/src/migrations/003_public_client_kind.sql +0 -175
  156. package/src/migrations/004_public_booking_assignee.sql +0 -176
  157. package/src/migrations/005_agent_rpcs.sql +0 -168
  158. package/src/migrations/006_agent_rpc_localtime.sql +0 -181
  159. package/src/migrations/007_schedule_exception_precedence.sql +0 -290
  160. package/src/migrations/008_agent_rpc_exception_precedence.sql +0 -172
  161. package/src/migrations/009_public_booking_location.sql +0 -162
  162. package/src/migrations/010_public_service_curation.sql +0 -31
  163. package/src/migrations/011_default_assignee.sql +0 -167
  164. package/src/migrations/012_drop_legacy_booking_overload.sql +0 -29
  165. package/src/migrations/013_normalize_v_appointments.sql +0 -199
  166. package/src/migrations/014_agent_rpc_update_appointment.sql +0 -199
  167. package/src/migrations/index.ts +0 -2377
  168. package/src/public/BookingWidget.tsx +0 -324
  169. package/src/public/components/BrandHeader.tsx +0 -27
  170. package/src/public/components/ServiceCard.tsx +0 -39
  171. package/src/public/components/SidebarExtras.tsx +0 -30
  172. package/src/public/components/StepRailItem.tsx +0 -27
  173. package/src/public/components/SuccessPanel.tsx +0 -27
  174. package/src/public/components/SummaryRail.tsx +0 -90
  175. package/src/public/components/defaults.ts +0 -14
  176. package/src/public/context.tsx +0 -103
  177. package/src/public/createPublicBookingPlugin.ts +0 -281
  178. package/src/public/data.supabase.ts +0 -97
  179. package/src/public/data.ts +0 -105
  180. package/src/public/format.ts +0 -96
  181. package/src/public/hooks.ts +0 -110
  182. package/src/public/index.ts +0 -69
  183. package/src/public/steps/ContactStep.tsx +0 -184
  184. package/src/public/steps/DateTimeStep.tsx +0 -138
  185. package/src/public/steps/OverviewStep.tsx +0 -81
  186. package/src/public/steps/PaymentStep.tsx +0 -180
  187. package/src/public/types.ts +0 -250
  188. package/src/registries.ts +0 -35
  189. package/src/store.ts +0 -311
  190. package/src/types.ts +0 -273
  191. package/src/views/CalendarView.tsx +0 -1112
  192. package/src/views/ConfirmationsView.tsx +0 -155
  193. /package/dist/{financial-bridge.d.ts → bridges/financial-bridge.d.ts} +0 -0
  194. /package/dist/{registries.d.ts → data/registries.d.ts} +0 -0
  195. /package/dist/public/{BookingWidget.d.ts → views/BookingWidget.d.ts} +0 -0
  196. /package/dist/{calendar-styles.d.ts → styles/calendar-styles.d.ts} +0 -0
package/src/config.ts DELETED
@@ -1,368 +0,0 @@
1
- import type { PluginRegistryDef, PluginScope, VerticalId } from '@fayz-ai/core'
2
- import type { EntityLookup } from '@fayz-ai/saas'
3
- import type { AgendaDataProvider } from './data/types'
4
- import type { StatusConfig, BookingTypeConfig } from './types'
5
- import type { AgendaFinancialBridge } from './financial-bridge'
6
- import type { EntityDef } from '@fayz-ai/core'
7
-
8
- // ---------------------------------------------------------------------------
9
- // Public options interface
10
- // ---------------------------------------------------------------------------
11
-
12
- export interface AgendaPluginLabels {
13
- pageTitle: string
14
- pageSubtitle: string
15
- calendar: string
16
- dayView: string
17
- weekView: string
18
- monthView: string
19
- listView: string
20
- workingHours: string
21
- confirmations: string
22
- newAppointment: string
23
- filters: string
24
- }
25
-
26
- export interface ConfirmationChannelOption {
27
- id: string
28
- label: string
29
- icon: string
30
- }
31
-
32
- export interface CancellationReasonOption {
33
- id: string
34
- label: string
35
- requiresNotes?: boolean
36
- }
37
-
38
- export interface CancellationDetailsProvider {
39
- listReasons(): Promise<CancellationReasonOption[]>
40
- saveCancellationDetails(input: {
41
- bookingId: string
42
- reasonId: string
43
- notes?: string
44
- cancelledAt?: string
45
- }): Promise<void>
46
- }
47
-
48
- export interface ExternalBookingSource {
49
- type: string
50
- id?: string
51
- [key: string]: unknown
52
- }
53
-
54
- export interface LocationOption {
55
- id: string
56
- name: string
57
- isHQ?: boolean
58
- }
59
-
60
- export interface AgendaPluginOptions {
61
- modules?: {
62
- workingHours?: boolean
63
- confirmations?: boolean
64
- conflictDetection?: boolean
65
- dragAndDrop?: boolean
66
- locationSelection?: boolean
67
- /** Enable financial integration (auto-enabled when financialBridge is provided) */
68
- financial?: boolean
69
- }
70
- labels?: Partial<AgendaPluginLabels>
71
- currency?: { code?: string; locale?: string; symbol?: string }
72
-
73
- /** Booking kind used in public.appointments.kind (default: 'appointment') */
74
- bookingKind?: string
75
-
76
- /** Order kind for financial records (default: 'service_order') */
77
- orderKind?: string
78
-
79
- /** Schedule kind in public.schedules.kind (default: 'working_hours') */
80
- scheduleKind?: string
81
-
82
- /** Booking type tabs shown in the appointment modal */
83
- bookingTypes?: BookingTypeConfig[]
84
-
85
- /**
86
- * Simplifies the agenda to Google-Calendar-style events (no client /
87
- * professional / service). When set to 'simple', the plugin exposes a single
88
- * "Evento" booking type whose modal shows only title / date-time / notes.
89
- * Ignored when an explicit `bookingTypes` override is provided.
90
- */
91
- eventMode?: 'simple'
92
-
93
- /** Booking status options */
94
- statuses?: StatusConfig[]
95
-
96
- /** Default calendar view (default: 'resourceTimeGridWeek'). Options: 'dayGridMonth', 'timeGridWeek', 'resourceTimeGridWeek', 'listWeek' */
97
- defaultCalendarView?: string
98
-
99
- /** Calendar visible time range (default: '07:00'-'21:00') */
100
- businessHours?: { startTime: string; endTime: string }
101
-
102
- /** Slot duration in minutes (default: 30) */
103
- slotDuration?: number
104
-
105
- /** Person kind for professionals (default: 'staff') */
106
- professionalKind?: string
107
-
108
- /** Person kind for clients (default: 'customer') */
109
- clientKind?: string
110
-
111
- /** Auto-create an order when creating a booking (default: true) */
112
- autoCreateOrder?: boolean
113
-
114
- /** Contact/client lookup */
115
- contactLookup?: EntityLookup
116
-
117
- /** Client entity definition for the Client tab in booking modal */
118
- clientEntityDef?: EntityDef
119
-
120
- /** Service lookup */
121
- serviceLookup?: EntityLookup
122
-
123
- /** Professional/staff lookup */
124
- professionalLookup?: EntityLookup
125
-
126
- /** Location lookup */
127
- locationLookup?: EntityLookup
128
-
129
- /** Called when user clicks a selected entity link (e.g. view client profile) */
130
- onEntityClick?: (type: 'client' | 'service' | 'professional', id: string) => void
131
-
132
- /** Business locations for unit filtering */
133
- locations?: LocationOption[]
134
-
135
- /** Confirmation channel options */
136
- confirmationChannels?: ConfirmationChannelOption[]
137
-
138
- /** Optional app/plugin bridge for cancel-time reason capture. */
139
- cancellationDetails?: CancellationDetailsProvider
140
-
141
- /** Called after a booking is created from an external operational source. */
142
- onBookingCreated?: (input: { bookingId: string; source?: ExternalBookingSource }) => void | Promise<void>
143
-
144
- /** App-owned registries shown under /settings/agenda Properties. */
145
- settingsRegistries?: PluginRegistryDef[]
146
-
147
- /** Financial bridge for agenda × financial cross-plugin integration */
148
- financialBridge?: AgendaFinancialBridge
149
-
150
- /** Data provider — defaults to Supabase, falls back to mock */
151
- dataProvider?: AgendaDataProvider
152
-
153
- /** Default values for schedule block advanced settings */
154
- scheduleBlockDefaults?: {
155
- bufferMinutes?: number
156
- maxConcurrent?: number
157
- minAdvanceHours?: number
158
- maxAdvanceDays?: number
159
- }
160
-
161
- navPosition?: number
162
- navSection?: 'main' | 'secondary'
163
- scope?: PluginScope
164
- verticalId?: VerticalId
165
- }
166
-
167
- // ---------------------------------------------------------------------------
168
- // Defaults
169
- // ---------------------------------------------------------------------------
170
-
171
- const DEFAULT_LABELS: AgendaPluginLabels = {
172
- pageTitle: 'Agenda',
173
- pageSubtitle: 'Calendar and appointment management',
174
- calendar: 'Calendar',
175
- dayView: 'Day',
176
- weekView: 'Week',
177
- monthView: 'Month',
178
- listView: 'Agenda',
179
- workingHours: 'Working Hours',
180
- confirmations: 'Confirmations',
181
- newAppointment: 'New Appointment',
182
- filters: 'Filters',
183
- }
184
-
185
- const DEFAULT_CURRENCY = { code: 'BRL', locale: 'pt-BR', symbol: 'R$' }
186
-
187
- const DEFAULT_STATUSES: StatusConfig[] = [
188
- { value: 'scheduled', label: 'Scheduled', color: '#6366f1' },
189
- { value: 'confirmed', label: 'Confirmed', color: '#3b82f6' },
190
- { value: 'in_progress', label: 'In Progress', color: '#f59e0b', availableWhen: 'today_only' },
191
- { value: 'completed', label: 'Completed', color: '#10b981', availableWhen: 'today_or_past' },
192
- { value: 'cancelled', label: 'Cancelled', color: '#ef4444' },
193
- { value: 'no_show', label: 'No Show', color: '#6b7280', availableWhen: 'today_or_past' },
194
- ]
195
-
196
- const DEFAULT_BOOKING_TYPES: BookingTypeConfig[] = [
197
- {
198
- id: 'appointment', label: 'Appointment', icon: 'Calendar', color: '#6366f1',
199
- fields: { client: true, professional: true, services: true, location: true, status: true },
200
- requiresServices: true, requiresClient: true,
201
- },
202
- {
203
- id: 'task', label: 'Task', icon: 'CheckSquare', color: '#f59e0b',
204
- fields: { client: false, professional: true, services: false, location: false, status: true },
205
- requiresServices: false, requiresClient: false,
206
- },
207
- {
208
- id: 'block', label: 'Block', icon: 'Ban', color: '#6b7280',
209
- fields: { client: false, professional: true, services: false, location: false, status: false },
210
- requiresServices: false, requiresClient: false,
211
- },
212
- ]
213
-
214
- // Simple / Google-Calendar-style event — a single "Evento" type with just a
215
- // free-text title, date-time and notes. No client / professional / service.
216
- // Used by personal-finance-style agendas (see eventMode: 'simple').
217
- const SIMPLE_EVENT_BOOKING_TYPES: BookingTypeConfig[] = [
218
- {
219
- id: 'event', label: 'Event', icon: 'Calendar', color: '#6366f1',
220
- fields: { title: true, client: false, professional: false, services: false, location: false, status: false },
221
- requiresServices: false, requiresClient: false,
222
- },
223
- ]
224
-
225
- // ---------------------------------------------------------------------------
226
- // Resolved config — fully merged, no optionals
227
- // ---------------------------------------------------------------------------
228
-
229
- export interface AgendaModules {
230
- workingHours: boolean
231
- confirmations: boolean
232
- conflictDetection: boolean
233
- dragAndDrop: boolean
234
- locationSelection: boolean
235
- financial: boolean
236
- }
237
-
238
- /**
239
- * Derived UI capabilities — computed ONCE in resolveConfig from the resolved
240
- * bookingTypes so no component ever re-derives "is this a simple event agenda?"
241
- * ad-hoc. A capability is enabled when ANY booking type uses that field. In
242
- * eventMode:'simple' the single "Evento" type disables
243
- * client/professional/services/location/status, so every consumer (popover,
244
- * filter rail, modal) hides the professional/service/status machinery in one
245
- * place instead of scattering `eventMode === 'simple'` checks.
246
- */
247
- export interface AgendaCapabilities {
248
- title: boolean
249
- client: boolean
250
- professional: boolean
251
- services: boolean
252
- location: boolean
253
- status: boolean
254
- }
255
-
256
- export interface AgendaCurrency {
257
- code: string
258
- locale: string
259
- symbol: string
260
- }
261
-
262
- export interface ResolvedAgendaConfig {
263
- modules: AgendaModules
264
- /** Whether this is a simple Google-Calendar-style event agenda (eventMode:'simple'). */
265
- simpleMode: boolean
266
- /** Derived once from bookingTypes — see AgendaCapabilities. */
267
- capabilities: AgendaCapabilities
268
- labels: AgendaPluginLabels
269
- currency: AgendaCurrency
270
- bookingKind: string
271
- orderKind: string
272
- scheduleKind: string
273
- statuses: StatusConfig[]
274
- bookingTypes: BookingTypeConfig[]
275
- businessHours: { startTime: string; endTime: string }
276
- slotDuration: number
277
- professionalKind: string
278
- clientKind: string
279
- autoCreateOrder: boolean
280
- locations: LocationOption[]
281
- confirmationChannels: ConfirmationChannelOption[]
282
- cancellationDetails?: CancellationDetailsProvider
283
- onBookingCreated?: (input: { bookingId: string; source?: ExternalBookingSource }) => void | Promise<void>
284
- contactLookup?: EntityLookup
285
- clientEntityDef?: EntityDef
286
- serviceLookup?: EntityLookup
287
- professionalLookup?: EntityLookup
288
- locationLookup?: EntityLookup
289
- onEntityClick?: (type: 'client' | 'service' | 'professional', id: string) => void
290
- financialBridge?: AgendaFinancialBridge
291
- scheduleBlockDefaults: {
292
- bufferMinutes: number
293
- maxConcurrent: number
294
- minAdvanceHours: number
295
- maxAdvanceDays: number
296
- }
297
- defaultCalendarView: string
298
- }
299
-
300
- // ---------------------------------------------------------------------------
301
- // Config resolver
302
- // ---------------------------------------------------------------------------
303
-
304
- export function resolveConfig(options?: AgendaPluginOptions): ResolvedAgendaConfig {
305
- // ── eventMode:'simple' derives ALL module + capability defaults ONCE, here. ──
306
- // Simple = Google-Calendar-style events (title/description + timestamp). It
307
- // flips professional/service machinery OFF by default: no working-hours /
308
- // schedule checks, no confirmations outreach, no conflict (double-booking)
309
- // detection, no location. Explicit `modules.*` re-enable individually. Full
310
- // mode (beauty) is unchanged — every default below matches the old behavior
311
- // when `simple` is false. Field-level machinery (client/professional/
312
- // services/location/status/title) is derived into `capabilities` from the
313
- // resolved bookingTypes, so components never test eventMode themselves.
314
- const simple = options?.eventMode === 'simple'
315
- const bookingTypes = options?.bookingTypes
316
- ?? (simple ? SIMPLE_EVENT_BOOKING_TYPES : DEFAULT_BOOKING_TYPES)
317
- const capabilities: AgendaCapabilities = {
318
- title: bookingTypes.some((bt) => bt.fields.title === true),
319
- client: bookingTypes.some((bt) => bt.fields.client),
320
- professional: bookingTypes.some((bt) => bt.fields.professional),
321
- services: bookingTypes.some((bt) => bt.fields.services),
322
- location: bookingTypes.some((bt) => bt.fields.location),
323
- status: bookingTypes.some((bt) => bt.fields.status),
324
- }
325
- return {
326
- modules: {
327
- // Off-unless-explicit in simple mode (`?? !simple`); default-on in full.
328
- workingHours: options?.modules?.workingHours ?? !simple,
329
- confirmations: options?.modules?.confirmations ?? !simple,
330
- conflictDetection: options?.modules?.conflictDetection ?? !simple,
331
- dragAndDrop: options?.modules?.dragAndDrop !== false,
332
- locationSelection: options?.modules?.locationSelection === true,
333
- financial: options?.modules?.financial ?? !!options?.financialBridge,
334
- },
335
- simpleMode: simple,
336
- capabilities,
337
- labels: { ...DEFAULT_LABELS, ...options?.labels },
338
- currency: { ...DEFAULT_CURRENCY, ...options?.currency },
339
- bookingKind: options?.bookingKind ?? 'appointment',
340
- orderKind: options?.orderKind ?? 'service_order',
341
- scheduleKind: options?.scheduleKind ?? 'working_hours',
342
- statuses: options?.statuses ?? DEFAULT_STATUSES,
343
- bookingTypes,
344
- businessHours: options?.businessHours ?? { startTime: '07:00', endTime: '21:00' },
345
- slotDuration: options?.slotDuration ?? 30,
346
- professionalKind: options?.professionalKind ?? 'staff',
347
- clientKind: options?.clientKind ?? 'customer',
348
- autoCreateOrder: options?.autoCreateOrder !== false,
349
- locations: options?.locations ?? [],
350
- confirmationChannels: options?.confirmationChannels ?? [],
351
- cancellationDetails: options?.cancellationDetails,
352
- onBookingCreated: options?.onBookingCreated,
353
- contactLookup: options?.contactLookup,
354
- clientEntityDef: options?.clientEntityDef,
355
- serviceLookup: options?.serviceLookup,
356
- professionalLookup: options?.professionalLookup,
357
- locationLookup: options?.locationLookup,
358
- onEntityClick: options?.onEntityClick,
359
- financialBridge: options?.financialBridge,
360
- scheduleBlockDefaults: {
361
- bufferMinutes: options?.scheduleBlockDefaults?.bufferMinutes ?? 0,
362
- maxConcurrent: options?.scheduleBlockDefaults?.maxConcurrent ?? 1,
363
- minAdvanceHours: options?.scheduleBlockDefaults?.minAdvanceHours ?? 0,
364
- maxAdvanceDays: options?.scheduleBlockDefaults?.maxAdvanceDays ?? 60,
365
- },
366
- defaultCalendarView: options?.defaultCalendarView ?? 'resourceTimeGridWeek',
367
- }
368
- }
package/src/data/index.ts DELETED
@@ -1,4 +0,0 @@
1
- export type { AgendaDataProvider } from './types'
2
- export { createMockAgendaProvider } from './mock'
3
- export type { MockAgendaSeed, MockAgendaProviderOptions } from './mock'
4
- export { createSupabaseAgendaProvider } from './supabase'