@fayz-ai/plugin-agenda 0.9.0 → 0.9.1
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 +3 -3
- package/dist/bridges/create-financial-bridge.d.ts +1 -1
- package/dist/bridges/create-financial-bridge.d.ts.map +1 -1
- package/dist/bridges/financial-bridge.d.ts.map +1 -0
- package/dist/{chunk-Q2PAWBPR.js → chunk-76ZOHRBM.js} +2 -2
- package/dist/{chunk-Q2PAWBPR.js.map → chunk-76ZOHRBM.js.map} +1 -1
- package/dist/components/PaymentStatusBadge.d.ts +1 -1
- package/dist/components/PaymentStatusBadge.d.ts.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/{AgendaContext.d.ts → context.d.ts} +1 -1
- package/dist/context.d.ts.map +1 -0
- package/dist/data/registries.d.ts.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +170 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/message-events.d.ts +12 -0
- package/dist/lib/message-events.d.ts.map +1 -0
- package/dist/public/{data.d.ts → data/index.d.ts} +4 -4
- package/dist/public/data/index.d.ts.map +1 -0
- package/dist/public/{data.supabase.d.ts → data/supabase.d.ts} +2 -2
- package/dist/public/data/supabase.d.ts.map +1 -0
- package/dist/public/{hooks.d.ts → hooks/index.d.ts} +4 -4
- package/dist/public/hooks/index.d.ts.map +1 -0
- package/dist/public/index.d.ts +4 -4
- package/dist/public/index.d.ts.map +1 -1
- package/dist/public/index.js +3 -3
- package/dist/public/index.js.map +1 -1
- package/dist/public/{format.d.ts → lib/format.d.ts} +1 -1
- package/dist/public/lib/format.d.ts.map +1 -0
- package/dist/public/views/BookingWidget.d.ts.map +1 -0
- package/dist/public/{steps → views/steps}/ContactStep.d.ts +1 -1
- package/dist/public/views/steps/ContactStep.d.ts.map +1 -0
- package/dist/public/{steps → views/steps}/DateTimeStep.d.ts +3 -3
- package/dist/public/views/steps/DateTimeStep.d.ts.map +1 -0
- package/dist/public/{steps → views/steps}/OverviewStep.d.ts +1 -1
- package/dist/public/views/steps/OverviewStep.d.ts.map +1 -0
- package/dist/public/{steps → views/steps}/PaymentStep.d.ts +1 -1
- package/dist/public/views/steps/PaymentStep.d.ts.map +1 -0
- package/dist/store.d.ts +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/styles/calendar-styles.d.ts.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/{AgendaPage.d.ts → views/AgendaPage.d.ts} +3 -3
- package/dist/views/AgendaPage.d.ts.map +1 -0
- package/package.json +6 -9
- package/dist/AgendaContext.d.ts.map +0 -1
- package/dist/AgendaPage.d.ts.map +0 -1
- package/dist/calendar-styles.d.ts.map +0 -1
- package/dist/financial-bridge.d.ts.map +0 -1
- package/dist/public/BookingWidget.d.ts.map +0 -1
- package/dist/public/data.d.ts.map +0 -1
- package/dist/public/data.supabase.d.ts.map +0 -1
- package/dist/public/format.d.ts.map +0 -1
- package/dist/public/hooks.d.ts.map +0 -1
- package/dist/public/steps/ContactStep.d.ts.map +0 -1
- package/dist/public/steps/DateTimeStep.d.ts.map +0 -1
- package/dist/public/steps/OverviewStep.d.ts.map +0 -1
- package/dist/public/steps/PaymentStep.d.ts.map +0 -1
- package/dist/registries.d.ts.map +0 -1
- package/src/AgendaContext.tsx +0 -11
- package/src/AgendaPage.tsx +0 -33
- package/src/bridges/create-financial-bridge.ts +0 -296
- package/src/calendar-styles.css +0 -245
- package/src/calendar-styles.ts +0 -285
- package/src/components/AgendaGeneralSettings.tsx +0 -86
- package/src/components/AgendaMobileList.tsx +0 -103
- package/src/components/AppointmentModal.tsx +0 -1050
- package/src/components/AppointmentPopover.tsx +0 -231
- package/src/components/BookingPaymentPanel.tsx +0 -394
- package/src/components/CalendarSidebar.tsx +0 -119
- package/src/components/CalendarToolbar.tsx +0 -86
- package/src/components/EventContextMenu.tsx +0 -125
- package/src/components/FloatingPanel.tsx +0 -123
- package/src/components/MiniCalendar.tsx +0 -120
- package/src/components/PaymentStatusBadge.tsx +0 -62
- package/src/components/StatusBadge.tsx +0 -23
- package/src/config.ts +0 -368
- package/src/data/index.ts +0 -4
- package/src/data/mock.ts +0 -344
- package/src/data/supabase.ts +0 -636
- package/src/data/types.ts +0 -37
- package/src/financial-bridge.ts +0 -96
- package/src/hooks/useAgendaSettings.ts +0 -17
- package/src/index.ts +0 -297
- package/src/integrations/google-calendar/GoogleCalendarSettings.tsx +0 -136
- package/src/integrations/google-calendar/components/CalendarColorDot.tsx +0 -23
- package/src/integrations/google-calendar/components/ChannelMappingList.tsx +0 -329
- package/src/integrations/google-calendar/components/ImportEventsWizard.tsx +0 -215
- package/src/integrations/google-calendar/components/useAgendaLookups.ts +0 -100
- package/src/integrations/google-calendar/connector.ts +0 -20
- package/src/integrations/google-calendar/connectorDef.tsx +0 -185
- package/src/integrations/google-calendar/data/supabase.ts +0 -170
- package/src/integrations/google-calendar/data/tables.ts +0 -12
- package/src/integrations/google-calendar/index.ts +0 -45
- package/src/integrations/google-calendar/integration.test.ts +0 -199
- package/src/integrations/google-calendar/mapping.ts +0 -183
- package/src/integrations/google-calendar/migrations/001_google_calendar.sql +0 -97
- package/src/integrations/google-calendar/migrations/002_smart_sync.sql +0 -517
- package/src/integrations/google-calendar/migrations/003_plg_rename.sql +0 -273
- package/src/integrations/google-calendar/types.ts +0 -142
- package/src/lib/tenant.ts +0 -3
- package/src/locales/en.ts +0 -220
- package/src/locales/index.ts +0 -7
- package/src/locales/pt-BR.ts +0 -220
- package/src/migrations/000b_v_bookings_rename.sql +0 -21
- package/src/migrations/000c_dedupe_customer_phones.sql +0 -43
- package/src/migrations/001_public_booking.sql +0 -296
- package/src/migrations/002_v_bookings_compat.sql +0 -14
- package/src/migrations/003_public_client_kind.sql +0 -175
- package/src/migrations/004_public_booking_assignee.sql +0 -176
- package/src/migrations/005_agent_rpcs.sql +0 -168
- package/src/migrations/006_agent_rpc_localtime.sql +0 -181
- package/src/migrations/007_schedule_exception_precedence.sql +0 -290
- package/src/migrations/008_agent_rpc_exception_precedence.sql +0 -172
- package/src/migrations/009_public_booking_location.sql +0 -162
- package/src/migrations/010_public_service_curation.sql +0 -31
- package/src/migrations/011_default_assignee.sql +0 -167
- package/src/migrations/012_drop_legacy_booking_overload.sql +0 -29
- package/src/migrations/013_normalize_v_appointments.sql +0 -199
- package/src/migrations/014_agent_rpc_update_appointment.sql +0 -199
- package/src/migrations/index.ts +0 -2377
- package/src/public/BookingWidget.tsx +0 -324
- package/src/public/components/BrandHeader.tsx +0 -27
- package/src/public/components/ServiceCard.tsx +0 -39
- package/src/public/components/SidebarExtras.tsx +0 -30
- package/src/public/components/StepRailItem.tsx +0 -27
- package/src/public/components/SuccessPanel.tsx +0 -27
- package/src/public/components/SummaryRail.tsx +0 -90
- package/src/public/components/defaults.ts +0 -14
- package/src/public/context.tsx +0 -103
- package/src/public/createPublicBookingPlugin.ts +0 -281
- package/src/public/data.supabase.ts +0 -97
- package/src/public/data.ts +0 -105
- package/src/public/format.ts +0 -96
- package/src/public/hooks.ts +0 -110
- package/src/public/index.ts +0 -69
- package/src/public/steps/ContactStep.tsx +0 -184
- package/src/public/steps/DateTimeStep.tsx +0 -138
- package/src/public/steps/OverviewStep.tsx +0 -81
- package/src/public/steps/PaymentStep.tsx +0 -180
- package/src/public/types.ts +0 -250
- package/src/registries.ts +0 -35
- package/src/store.ts +0 -311
- package/src/types.ts +0 -273
- package/src/views/CalendarView.tsx +0 -1112
- package/src/views/ConfirmationsView.tsx +0 -155
- /package/dist/{financial-bridge.d.ts → bridges/financial-bridge.d.ts} +0 -0
- /package/dist/{registries.d.ts → data/registries.d.ts} +0 -0
- /package/dist/public/{BookingWidget.d.ts → views/BookingWidget.d.ts} +0 -0
- /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