gorombo-payload-appointments 1.0.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 (74) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +308 -0
  3. package/dist/collections/Appointments.d.ts +2 -0
  4. package/dist/collections/Appointments.js +165 -0
  5. package/dist/collections/Appointments.js.map +1 -0
  6. package/dist/collections/GuestCustomers.d.ts +2 -0
  7. package/dist/collections/GuestCustomers.js +106 -0
  8. package/dist/collections/GuestCustomers.js.map +1 -0
  9. package/dist/collections/Services.d.ts +2 -0
  10. package/dist/collections/Services.js +147 -0
  11. package/dist/collections/Services.js.map +1 -0
  12. package/dist/collections/TeamMembers.d.ts +2 -0
  13. package/dist/collections/TeamMembers.js +184 -0
  14. package/dist/collections/TeamMembers.js.map +1 -0
  15. package/dist/components/BeforeDashboardClient.d.ts +2 -0
  16. package/dist/components/BeforeDashboardClient.js +162 -0
  17. package/dist/components/BeforeDashboardClient.js.map +1 -0
  18. package/dist/components/BeforeDashboardServer.d.ts +2 -0
  19. package/dist/components/BeforeDashboardServer.js +22 -0
  20. package/dist/components/BeforeDashboardServer.js.map +1 -0
  21. package/dist/components/BeforeDashboardServer.module.css +5 -0
  22. package/dist/components/calendar/Calendar.module.css +506 -0
  23. package/dist/components/calendar/CalendarContainer.d.ts +3 -0
  24. package/dist/components/calendar/CalendarContainer.js +246 -0
  25. package/dist/components/calendar/CalendarContainer.js.map +1 -0
  26. package/dist/components/calendar/DayView.d.ts +3 -0
  27. package/dist/components/calendar/DayView.js +192 -0
  28. package/dist/components/calendar/DayView.js.map +1 -0
  29. package/dist/components/calendar/EventPopover.d.ts +3 -0
  30. package/dist/components/calendar/EventPopover.js +257 -0
  31. package/dist/components/calendar/EventPopover.js.map +1 -0
  32. package/dist/components/calendar/EventRenderer.d.ts +3 -0
  33. package/dist/components/calendar/EventRenderer.js +76 -0
  34. package/dist/components/calendar/EventRenderer.js.map +1 -0
  35. package/dist/components/calendar/WeekView.d.ts +3 -0
  36. package/dist/components/calendar/WeekView.js +203 -0
  37. package/dist/components/calendar/WeekView.js.map +1 -0
  38. package/dist/components/calendar/index.d.ts +6 -0
  39. package/dist/components/calendar/index.js +7 -0
  40. package/dist/components/calendar/index.js.map +1 -0
  41. package/dist/components/calendar/types.d.ts +69 -0
  42. package/dist/components/calendar/types.js +3 -0
  43. package/dist/components/calendar/types.js.map +1 -0
  44. package/dist/endpoints/customEndpointHandler.d.ts +2 -0
  45. package/dist/endpoints/customEndpointHandler.js +7 -0
  46. package/dist/endpoints/customEndpointHandler.js.map +1 -0
  47. package/dist/endpoints/getAvailableSlots.d.ts +12 -0
  48. package/dist/endpoints/getAvailableSlots.js +291 -0
  49. package/dist/endpoints/getAvailableSlots.js.map +1 -0
  50. package/dist/exports/client.d.ts +3 -0
  51. package/dist/exports/client.js +4 -0
  52. package/dist/exports/client.js.map +1 -0
  53. package/dist/exports/rsc.d.ts +1 -0
  54. package/dist/exports/rsc.js +3 -0
  55. package/dist/exports/rsc.js.map +1 -0
  56. package/dist/globals/OpeningTimes.d.ts +2 -0
  57. package/dist/globals/OpeningTimes.js +196 -0
  58. package/dist/globals/OpeningTimes.js.map +1 -0
  59. package/dist/hooks/addAdminTitle.d.ts +7 -0
  60. package/dist/hooks/addAdminTitle.js +86 -0
  61. package/dist/hooks/addAdminTitle.js.map +1 -0
  62. package/dist/hooks/sendCustomerEmail.d.ts +6 -0
  63. package/dist/hooks/sendCustomerEmail.js +351 -0
  64. package/dist/hooks/sendCustomerEmail.js.map +1 -0
  65. package/dist/hooks/setEndDateTime.d.ts +6 -0
  66. package/dist/hooks/setEndDateTime.js +44 -0
  67. package/dist/hooks/setEndDateTime.js.map +1 -0
  68. package/dist/hooks/validateCustomerOrGuest.d.ts +6 -0
  69. package/dist/hooks/validateCustomerOrGuest.js +21 -0
  70. package/dist/hooks/validateCustomerOrGuest.js.map +1 -0
  71. package/dist/index.d.ts +23 -0
  72. package/dist/index.js +183 -0
  73. package/dist/index.js.map +1 -0
  74. package/package.json +135 -0
@@ -0,0 +1,147 @@
1
+ export const Services = {
2
+ slug: 'services',
3
+ access: {
4
+ create: ({ req })=>!!req.user,
5
+ delete: ({ req })=>!!req.user,
6
+ read: ()=>true,
7
+ update: ({ req })=>!!req.user
8
+ },
9
+ admin: {
10
+ defaultColumns: [
11
+ 'name',
12
+ 'duration',
13
+ 'price',
14
+ 'isActive'
15
+ ],
16
+ group: 'Scheduling',
17
+ useAsTitle: 'name'
18
+ },
19
+ fields: [
20
+ {
21
+ name: 'name',
22
+ type: 'text',
23
+ admin: {
24
+ description: 'Name of the service (e.g., "30-Minute Consultation")'
25
+ },
26
+ required: true
27
+ },
28
+ {
29
+ name: 'slug',
30
+ type: 'text',
31
+ admin: {
32
+ description: 'URL-friendly identifier'
33
+ },
34
+ required: true,
35
+ unique: true
36
+ },
37
+ {
38
+ name: 'description',
39
+ type: 'textarea',
40
+ admin: {
41
+ description: 'Description shown to customers'
42
+ }
43
+ },
44
+ {
45
+ name: 'duration',
46
+ type: 'number',
47
+ admin: {
48
+ description: 'Duration in minutes',
49
+ step: 5
50
+ },
51
+ defaultValue: 30,
52
+ max: 480,
53
+ min: 5,
54
+ required: true
55
+ },
56
+ {
57
+ name: 'price',
58
+ type: 'number',
59
+ admin: {
60
+ description: 'Price in cents (e.g., 5000 = $50.00)'
61
+ },
62
+ defaultValue: 0,
63
+ min: 0,
64
+ required: true
65
+ },
66
+ {
67
+ name: 'color',
68
+ type: 'text',
69
+ admin: {
70
+ description: 'Color for calendar display (hex code)'
71
+ },
72
+ defaultValue: '#3b82f6'
73
+ },
74
+ {
75
+ name: 'isActive',
76
+ type: 'checkbox',
77
+ admin: {
78
+ description: 'Whether this service is available for booking',
79
+ position: 'sidebar'
80
+ },
81
+ defaultValue: true
82
+ },
83
+ {
84
+ name: 'requiresDeposit',
85
+ type: 'checkbox',
86
+ admin: {
87
+ description: 'Whether a deposit is required to book',
88
+ position: 'sidebar'
89
+ },
90
+ defaultValue: false
91
+ },
92
+ {
93
+ name: 'depositAmount',
94
+ type: 'number',
95
+ admin: {
96
+ condition: (data)=>data?.requiresDeposit === true,
97
+ description: 'Deposit amount in cents'
98
+ },
99
+ min: 0
100
+ },
101
+ {
102
+ name: 'bufferBefore',
103
+ type: 'number',
104
+ admin: {
105
+ description: 'Buffer time before appointment (minutes)',
106
+ step: 5
107
+ },
108
+ defaultValue: 0,
109
+ min: 0
110
+ },
111
+ {
112
+ name: 'bufferAfter',
113
+ type: 'number',
114
+ admin: {
115
+ description: 'Buffer time after appointment (minutes)',
116
+ step: 5
117
+ },
118
+ defaultValue: 0,
119
+ min: 0
120
+ },
121
+ {
122
+ name: 'maxAdvanceBooking',
123
+ type: 'number',
124
+ admin: {
125
+ description: 'How many days in advance can this be booked'
126
+ },
127
+ defaultValue: 30,
128
+ min: 1
129
+ },
130
+ {
131
+ name: 'minAdvanceBooking',
132
+ type: 'number',
133
+ admin: {
134
+ description: 'Minimum hours notice required to book'
135
+ },
136
+ defaultValue: 0,
137
+ min: 0
138
+ }
139
+ ],
140
+ labels: {
141
+ plural: 'Services',
142
+ singular: 'Service'
143
+ },
144
+ timestamps: true
145
+ };
146
+
147
+ //# sourceMappingURL=Services.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/Services.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nexport const Services: CollectionConfig = {\n slug: 'services',\n access: {\n create: ({ req }) => !!req.user,\n delete: ({ req }) => !!req.user,\n read: () => true,\n update: ({ req }) => !!req.user,\n },\n admin: {\n defaultColumns: ['name', 'duration', 'price', 'isActive'],\n group: 'Scheduling',\n useAsTitle: 'name',\n },\n fields: [\n {\n name: 'name',\n type: 'text',\n admin: {\n description: 'Name of the service (e.g., \"30-Minute Consultation\")',\n },\n required: true,\n },\n {\n name: 'slug',\n type: 'text',\n admin: {\n description: 'URL-friendly identifier',\n },\n required: true,\n unique: true,\n },\n {\n name: 'description',\n type: 'textarea',\n admin: {\n description: 'Description shown to customers',\n },\n },\n {\n name: 'duration',\n type: 'number',\n admin: {\n description: 'Duration in minutes',\n step: 5,\n },\n defaultValue: 30,\n max: 480,\n min: 5,\n required: true,\n },\n {\n name: 'price',\n type: 'number',\n admin: {\n description: 'Price in cents (e.g., 5000 = $50.00)',\n },\n defaultValue: 0,\n min: 0,\n required: true,\n },\n {\n name: 'color',\n type: 'text',\n admin: {\n description: 'Color for calendar display (hex code)',\n },\n defaultValue: '#3b82f6',\n },\n {\n name: 'isActive',\n type: 'checkbox',\n admin: {\n description: 'Whether this service is available for booking',\n position: 'sidebar',\n },\n defaultValue: true,\n },\n {\n name: 'requiresDeposit',\n type: 'checkbox',\n admin: {\n description: 'Whether a deposit is required to book',\n position: 'sidebar',\n },\n defaultValue: false,\n },\n {\n name: 'depositAmount',\n type: 'number',\n admin: {\n condition: (data) => data?.requiresDeposit === true,\n description: 'Deposit amount in cents',\n },\n min: 0,\n },\n {\n name: 'bufferBefore',\n type: 'number',\n admin: {\n description: 'Buffer time before appointment (minutes)',\n step: 5,\n },\n defaultValue: 0,\n min: 0,\n },\n {\n name: 'bufferAfter',\n type: 'number',\n admin: {\n description: 'Buffer time after appointment (minutes)',\n step: 5,\n },\n defaultValue: 0,\n min: 0,\n },\n {\n name: 'maxAdvanceBooking',\n type: 'number',\n admin: {\n description: 'How many days in advance can this be booked',\n },\n defaultValue: 30,\n min: 1,\n },\n {\n name: 'minAdvanceBooking',\n type: 'number',\n admin: {\n description: 'Minimum hours notice required to book',\n },\n defaultValue: 0,\n min: 0,\n },\n ],\n labels: {\n plural: 'Services',\n singular: 'Service',\n },\n timestamps: true,\n}\n"],"names":["Services","slug","access","create","req","user","delete","read","update","admin","defaultColumns","group","useAsTitle","fields","name","type","description","required","unique","step","defaultValue","max","min","position","condition","data","requiresDeposit","labels","plural","singular","timestamps"],"mappings":"AAEA,OAAO,MAAMA,WAA6B;IACxCC,MAAM;IACNC,QAAQ;QACNC,QAAQ,CAAC,EAAEC,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c;YACdE,KAAK;QACP;QACA;YACER,MAAM;YACNC,MAAM;YACNN,OAAO;gBACLO,aAAa;gBACbG,MAAM;YACR;YACAC,cAAc;YACdE,KAAK;QACP;QACA;YACER,MAAM;YACNC,MAAM;YACNN,OAAO;gBACLO,aAAa;YACf;YACAI,cAAc;YACdE,KAAK;QACP;QACA;YACER,MAAM;YACNC,MAAM;YACNN,OAAO;gBACLO,aAAa;YACf;YACAI,cAAc;YACdE,KAAK;QACP;KACD;IACDK,QAAQ;QACNC,QAAQ;QACRC,UAAU;IACZ;IACAC,YAAY;AACd,EAAC"}
@@ -0,0 +1,2 @@
1
+ import type { CollectionConfig } from 'payload';
2
+ export declare const TeamMembers: CollectionConfig;
@@ -0,0 +1,184 @@
1
+ export const TeamMembers = {
2
+ slug: 'team-members',
3
+ access: {
4
+ create: ({ req })=>!!req.user,
5
+ delete: ({ req })=>!!req.user,
6
+ read: ()=>true,
7
+ update: ({ req })=>!!req.user
8
+ },
9
+ admin: {
10
+ defaultColumns: [
11
+ 'name',
12
+ 'email',
13
+ 'role',
14
+ 'takingAppointments'
15
+ ],
16
+ group: 'Scheduling',
17
+ useAsTitle: 'name'
18
+ },
19
+ fields: [
20
+ {
21
+ name: 'name',
22
+ type: 'text',
23
+ admin: {
24
+ description: 'Full name of the team member'
25
+ },
26
+ required: true
27
+ },
28
+ {
29
+ name: 'email',
30
+ type: 'email',
31
+ required: true,
32
+ unique: true
33
+ },
34
+ {
35
+ name: 'phone',
36
+ type: 'text',
37
+ admin: {
38
+ description: 'Contact phone number'
39
+ }
40
+ },
41
+ {
42
+ name: 'role',
43
+ type: 'text',
44
+ admin: {
45
+ description: 'Job title or role (e.g., "Senior Consultant")'
46
+ }
47
+ },
48
+ {
49
+ name: 'bio',
50
+ type: 'textarea',
51
+ admin: {
52
+ description: 'Short bio shown to customers'
53
+ }
54
+ },
55
+ {
56
+ name: 'avatar',
57
+ type: 'upload',
58
+ admin: {
59
+ description: 'Profile photo'
60
+ },
61
+ relationTo: 'media'
62
+ },
63
+ {
64
+ name: 'takingAppointments',
65
+ type: 'checkbox',
66
+ admin: {
67
+ description: 'Whether this team member accepts appointments',
68
+ position: 'sidebar'
69
+ },
70
+ defaultValue: true
71
+ },
72
+ {
73
+ name: 'services',
74
+ type: 'relationship',
75
+ admin: {
76
+ description: 'Services this team member can provide'
77
+ },
78
+ hasMany: true,
79
+ relationTo: 'services'
80
+ },
81
+ {
82
+ name: 'availability',
83
+ type: 'array',
84
+ admin: {
85
+ description: 'Weekly availability schedule'
86
+ },
87
+ fields: [
88
+ {
89
+ name: 'day',
90
+ type: 'select',
91
+ options: [
92
+ {
93
+ label: 'Monday',
94
+ value: 'monday'
95
+ },
96
+ {
97
+ label: 'Tuesday',
98
+ value: 'tuesday'
99
+ },
100
+ {
101
+ label: 'Wednesday',
102
+ value: 'wednesday'
103
+ },
104
+ {
105
+ label: 'Thursday',
106
+ value: 'thursday'
107
+ },
108
+ {
109
+ label: 'Friday',
110
+ value: 'friday'
111
+ },
112
+ {
113
+ label: 'Saturday',
114
+ value: 'saturday'
115
+ },
116
+ {
117
+ label: 'Sunday',
118
+ value: 'sunday'
119
+ }
120
+ ],
121
+ required: true
122
+ },
123
+ {
124
+ name: 'isAvailable',
125
+ type: 'checkbox',
126
+ admin: {
127
+ description: 'Available on this day'
128
+ },
129
+ defaultValue: true
130
+ },
131
+ {
132
+ name: 'startTime',
133
+ type: 'text',
134
+ admin: {
135
+ condition: (data, siblingData)=>siblingData?.isAvailable === true,
136
+ description: 'Start time (HH:MM format)'
137
+ },
138
+ defaultValue: '09:00'
139
+ },
140
+ {
141
+ name: 'endTime',
142
+ type: 'text',
143
+ admin: {
144
+ condition: (data, siblingData)=>siblingData?.isAvailable === true,
145
+ description: 'End time (HH:MM format)'
146
+ },
147
+ defaultValue: '17:00'
148
+ },
149
+ {
150
+ name: 'breakStart',
151
+ type: 'text',
152
+ admin: {
153
+ condition: (data, siblingData)=>siblingData?.isAvailable === true,
154
+ description: 'Break start time (optional)'
155
+ }
156
+ },
157
+ {
158
+ name: 'breakEnd',
159
+ type: 'text',
160
+ admin: {
161
+ condition: (data, siblingData)=>siblingData?.isAvailable === true,
162
+ description: 'Break end time (optional)'
163
+ }
164
+ }
165
+ ]
166
+ },
167
+ {
168
+ name: 'color',
169
+ type: 'text',
170
+ admin: {
171
+ description: 'Color for calendar display (hex code)',
172
+ position: 'sidebar'
173
+ },
174
+ defaultValue: '#10b981'
175
+ }
176
+ ],
177
+ labels: {
178
+ plural: 'Team Members',
179
+ singular: 'Team Member'
180
+ },
181
+ timestamps: true
182
+ };
183
+
184
+ //# sourceMappingURL=TeamMembers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/TeamMembers.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nexport const TeamMembers: CollectionConfig = {\n slug: 'team-members',\n access: {\n create: ({ req }) => !!req.user,\n delete: ({ req }) => !!req.user,\n read: () => true,\n update: ({ req }) => !!req.user,\n },\n admin: {\n defaultColumns: ['name', 'email', 'role', 'takingAppointments'],\n group: 'Scheduling',\n useAsTitle: 'name',\n },\n fields: [\n {\n name: 'name',\n type: 'text',\n admin: {\n description: 'Full name of the team member',\n },\n required: true,\n },\n {\n name: 'email',\n type: 'email',\n required: true,\n unique: true,\n },\n {\n name: 'phone',\n type: 'text',\n admin: {\n description: 'Contact phone number',\n },\n },\n {\n name: 'role',\n type: 'text',\n admin: {\n description: 'Job title or role (e.g., \"Senior Consultant\")',\n },\n },\n {\n name: 'bio',\n type: 'textarea',\n admin: {\n description: 'Short bio shown to customers',\n },\n },\n {\n name: 'avatar',\n type: 'upload',\n admin: {\n description: 'Profile photo',\n },\n relationTo: 'media',\n },\n {\n name: 'takingAppointments',\n type: 'checkbox',\n admin: {\n description: 'Whether this team member accepts appointments',\n position: 'sidebar',\n },\n defaultValue: true,\n },\n {\n name: 'services',\n type: 'relationship',\n admin: {\n description: 'Services this team member can provide',\n },\n hasMany: true,\n relationTo: 'services',\n },\n {\n name: 'availability',\n type: 'array',\n admin: {\n description: 'Weekly availability schedule',\n },\n fields: [\n {\n name: 'day',\n type: 'select',\n options: [\n { label: 'Monday', value: 'monday' },\n { label: 'Tuesday', value: 'tuesday' },\n { label: 'Wednesday', value: 'wednesday' },\n { label: 'Thursday', value: 'thursday' },\n { label: 'Friday', value: 'friday' },\n { label: 'Saturday', value: 'saturday' },\n { label: 'Sunday', value: 'sunday' },\n ],\n required: true,\n },\n {\n name: 'isAvailable',\n type: 'checkbox',\n admin: {\n description: 'Available on this day',\n },\n defaultValue: true,\n },\n {\n name: 'startTime',\n type: 'text',\n admin: {\n condition: (data, siblingData) => siblingData?.isAvailable === true,\n description: 'Start time (HH:MM format)',\n },\n defaultValue: '09:00',\n },\n {\n name: 'endTime',\n type: 'text',\n admin: {\n condition: (data, siblingData) => siblingData?.isAvailable === true,\n description: 'End time (HH:MM format)',\n },\n defaultValue: '17:00',\n },\n {\n name: 'breakStart',\n type: 'text',\n admin: {\n condition: (data, siblingData) => siblingData?.isAvailable === true,\n description: 'Break start time (optional)',\n },\n },\n {\n name: 'breakEnd',\n type: 'text',\n admin: {\n condition: (data, siblingData) => siblingData?.isAvailable === true,\n description: 'Break end time (optional)',\n },\n },\n ],\n },\n {\n name: 'color',\n type: 'text',\n admin: {\n description: 'Color for calendar display (hex code)',\n position: 'sidebar',\n },\n defaultValue: '#10b981',\n },\n ],\n labels: {\n plural: 'Team Members',\n singular: 'Team Member',\n },\n timestamps: true,\n}\n"],"names":["TeamMembers","slug","access","create","req","user","delete","read","update","admin","defaultColumns","group","useAsTitle","fields","name","type","description","required","unique","relationTo","position","defaultValue","hasMany","options","label","value","condition","data","siblingData","isAvailable","labels","plural","singular","timestamps"],"mappings":"AAEA,OAAO,MAAMA,cAAgC;IAC3CC,MAAM;IACNC,QAAQ;QACNC,QAAQ,CAAC,EAAEC,GAAG,EAAE,GAAK,CAAC,CAACA,IAAIC,IAAI;QAC/BC,QAAQ,CAAC,EAAEF,GAAG,EAA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;qBACpC;oBACDR,UAAU;gBACZ;gBACA;oBACEH,MAAM;oBACNC,MAAM;oBACNN,OAAO;wBACLO,aAAa;oBACf;oBACAK,cAAc;gBAChB;gBACA;oBACEP,MAAM;oBACNC,MAAM;oBACNN,OAAO;wBACLiB,WAAW,CAACC,MAAMC,cAAgBA,aAAaC,gBAAgB;wBAC/Db,aAAa;oBACf;oBACAK,cAAc;gBAChB;gBACA;oBACEP,MAAM;oBACNC,MAAM;oBACNN,OAAO;wBACLiB,WAAW,CAACC,MAAMC,cAAgBA,aAAaC,gBAAgB;wBAC/Db,aAAa;oBACf;oBACAK,cAAc;gBAChB;gBACA;oBACEP,MAAM;oBACNC,MAAM;oBACNN,OAAO;wBACLiB,WAAW,CAACC,MAAMC,cAAgBA,aAAaC,gBAAgB;wBAC/Db,aAAa;oBACf;gBACF;gBACA;oBACEF,MAAM;oBACNC,MAAM;oBACNN,OAAO;wBACLiB,WAAW,CAACC,MAAMC,cAAgBA,aAAaC,gBAAgB;wBAC/Db,aAAa;oBACf;gBACF;aACD;QACH;QACA;YACEF,MAAM;YACNC,MAAM;YACNN,OAAO;gBACLO,aAAa;gBACbI,UAAU;YACZ;YACAC,cAAc;QAChB;KACD;IACDS,QAAQ;QACNC,QAAQ;QACRC,UAAU;IACZ;IACAC,YAAY;AACd,EAAC"}
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const BeforeDashboardClient: React.FC;
@@ -0,0 +1,162 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useConfig } from '@payloadcms/ui';
4
+ import React, { useCallback, useEffect, useState } from 'react';
5
+ import { CalendarContainer } from './calendar/index.js';
6
+ function transformAppointmentToEvent(doc) {
7
+ const service = typeof doc.service === 'object' ? doc.service : undefined;
8
+ const customer = typeof doc.customer === 'object' ? doc.customer : undefined;
9
+ const guest = typeof doc.guest === 'object' ? doc.guest : undefined;
10
+ const teamMember = typeof doc.teamMember === 'object' ? doc.teamMember : undefined;
11
+ // Calculate end time if not provided
12
+ let endDateTime = doc.endDateTime;
13
+ if (!endDateTime && service?.duration) {
14
+ const start = new Date(doc.startDateTime);
15
+ start.setMinutes(start.getMinutes() + service.duration);
16
+ endDateTime = start.toISOString();
17
+ } else if (!endDateTime) {
18
+ const start = new Date(doc.startDateTime);
19
+ start.setMinutes(start.getMinutes() + 30); // Default 30 min
20
+ endDateTime = start.toISOString();
21
+ }
22
+ return {
23
+ id: doc.id,
24
+ type: doc.type,
25
+ blockoutReason: doc.blockoutReason,
26
+ customerId: customer?.id,
27
+ customerName: customer?.name || customer?.firstName,
28
+ end: new Date(endDateTime),
29
+ guestId: guest?.id,
30
+ guestName: guest ? `${guest.firstName} ${guest.lastName}`.trim() : undefined,
31
+ notes: doc.notes,
32
+ serviceColor: service?.color || '#3b82f6',
33
+ serviceId: service?.id,
34
+ serviceName: service?.name,
35
+ start: new Date(doc.startDateTime),
36
+ status: doc.status,
37
+ teamMemberColor: teamMember?.color,
38
+ teamMemberId: teamMember?.id,
39
+ teamMemberName: teamMember?.name,
40
+ title: doc.title || service?.name || 'Appointment'
41
+ };
42
+ }
43
+ export const BeforeDashboardClient = ()=>{
44
+ const configContext = useConfig();
45
+ const [events, setEvents] = useState([]);
46
+ const [isLoading, setIsLoading] = useState(true);
47
+ const [error, setError] = useState(null);
48
+ // Handle case where config context is not yet available
49
+ const config = configContext?.config;
50
+ const apiPath = config?.routes?.api || '/api';
51
+ const adminPath = config?.routes?.admin || '/admin';
52
+ const fetchAppointments = useCallback(async ()=>{
53
+ setIsLoading(true);
54
+ setError(null);
55
+ try {
56
+ // Get appointments for the next 30 days and past 7 days
57
+ const now = new Date();
58
+ const startDate = new Date(now);
59
+ startDate.setDate(startDate.getDate() - 7);
60
+ const endDate = new Date(now);
61
+ endDate.setDate(endDate.getDate() + 30);
62
+ // Build API URL
63
+ const queryParams = new URLSearchParams({
64
+ depth: '1',
65
+ limit: '200',
66
+ 'where[startDateTime][greater_than_equal]': startDate.toISOString(),
67
+ 'where[startDateTime][less_than_equal]': endDate.toISOString()
68
+ });
69
+ const response = await fetch(`${apiPath}/appointments?${queryParams.toString()}`);
70
+ if (!response.ok) {
71
+ throw new Error('Failed to fetch appointments');
72
+ }
73
+ const result = await response.json();
74
+ const appointmentEvents = result.docs.map(transformAppointmentToEvent);
75
+ setEvents(appointmentEvents);
76
+ } catch (err) {
77
+ console.error('Error fetching appointments:', err);
78
+ setError('Failed to load appointments');
79
+ } finally{
80
+ setIsLoading(false);
81
+ }
82
+ }, [
83
+ apiPath
84
+ ]);
85
+ useEffect(()=>{
86
+ void fetchAppointments();
87
+ }, [
88
+ fetchAppointments
89
+ ]);
90
+ const handleSlotClick = useCallback((start, _end)=>{
91
+ // Navigate to create new appointment with pre-filled start time
92
+ const params = new URLSearchParams({
93
+ startDateTime: start.toISOString()
94
+ });
95
+ window.location.href = `${adminPath}/collections/appointments/create?${params.toString()}`;
96
+ }, [
97
+ adminPath
98
+ ]);
99
+ const handleEventClick = useCallback((_event)=>{
100
+ // Event click is handled by the calendar popover
101
+ // but we could add custom handling here if needed
102
+ }, []);
103
+ if (error) {
104
+ return /*#__PURE__*/ _jsxs("div", {
105
+ style: {
106
+ padding: '20px'
107
+ },
108
+ children: [
109
+ /*#__PURE__*/ _jsx("h2", {
110
+ style: {
111
+ fontSize: '18px',
112
+ fontWeight: 600,
113
+ marginBottom: '12px'
114
+ },
115
+ children: "Appointments Calendar"
116
+ }),
117
+ /*#__PURE__*/ _jsx("div", {
118
+ style: {
119
+ background: 'var(--theme-error-50)',
120
+ borderRadius: '8px',
121
+ color: 'var(--theme-error-700)',
122
+ padding: '20px'
123
+ },
124
+ children: error
125
+ })
126
+ ]
127
+ });
128
+ }
129
+ return /*#__PURE__*/ _jsxs("div", {
130
+ style: {
131
+ padding: '20px'
132
+ },
133
+ children: [
134
+ /*#__PURE__*/ _jsx("h2", {
135
+ style: {
136
+ fontSize: '18px',
137
+ fontWeight: 600,
138
+ marginBottom: '12px'
139
+ },
140
+ children: "Appointments Calendar"
141
+ }),
142
+ isLoading ? /*#__PURE__*/ _jsx("div", {
143
+ style: {
144
+ alignItems: 'center',
145
+ color: 'var(--theme-elevation-500)',
146
+ display: 'flex',
147
+ height: '400px',
148
+ justifyContent: 'center'
149
+ },
150
+ children: "Loading appointments..."
151
+ }) : /*#__PURE__*/ _jsx(CalendarContainer, {
152
+ endHour: 20,
153
+ events: events,
154
+ onEventClick: handleEventClick,
155
+ onSlotClick: handleSlotClick,
156
+ startHour: 8
157
+ })
158
+ ]
159
+ });
160
+ };
161
+
162
+ //# sourceMappingURL=BeforeDashboardClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/BeforeDashboardClient.tsx"],"sourcesContent":["'use client'\n\nimport { useConfig } from '@payloadcms/ui'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { CalendarEvent } from './calendar/index.js'\n\nimport { CalendarContainer } from './calendar/index.js'\n\ninterface AppointmentDoc {\n blockoutReason?: string\n customer?: {\n email?: string\n firstName?: string\n id: string\n name?: string\n } | string\n endDateTime?: string\n guest?: {\n email?: string\n firstName: string\n id: string\n lastName: string\n } | string\n id: string\n notes?: string\n service?: {\n color?: string\n duration?: number\n id: string\n name: string\n } | string\n startDateTime: string\n status?: string\n teamMember?: {\n color?: string\n id: string\n name: string\n } | string\n title?: string\n type: 'appointment' | 'blockout'\n}\n\nfunction transformAppointmentToEvent(doc: AppointmentDoc): CalendarEvent {\n const service = typeof doc.service === 'object' ? doc.service : undefined\n const customer = typeof doc.customer === 'object' ? doc.customer : undefined\n const guest = typeof doc.guest === 'object' ? doc.guest : undefined\n const teamMember = typeof doc.teamMember === 'object' ? doc.teamMember : undefined\n\n // Calculate end time if not provided\n let endDateTime = doc.endDateTime\n if (!endDateTime && service?.duration) {\n const start = new Date(doc.startDateTime)\n start.setMinutes(start.getMinutes() + service.duration)\n endDateTime = start.toISOString()\n } else if (!endDateTime) {\n const start = new Date(doc.startDateTime)\n start.setMinutes(start.getMinutes() + 30) // Default 30 min\n endDateTime = start.toISOString()\n }\n\n return {\n id: doc.id,\n type: doc.type,\n blockoutReason: doc.blockoutReason,\n customerId: customer?.id,\n customerName: customer?.name || customer?.firstName,\n end: new Date(endDateTime),\n guestId: guest?.id,\n guestName: guest ? `${guest.firstName} ${guest.lastName}`.trim() : undefined,\n notes: doc.notes,\n serviceColor: service?.color || '#3b82f6',\n serviceId: service?.id,\n serviceName: service?.name,\n start: new Date(doc.startDateTime),\n status: doc.status as CalendarEvent['status'],\n teamMemberColor: teamMember?.color,\n teamMemberId: teamMember?.id,\n teamMemberName: teamMember?.name,\n title: doc.title || service?.name || 'Appointment',\n }\n}\n\nexport const BeforeDashboardClient: React.FC = () => {\n const configContext = useConfig()\n const [events, setEvents] = useState<CalendarEvent[]>([])\n const [isLoading, setIsLoading] = useState(true)\n const [error, setError] = useState<null | string>(null)\n\n // Handle case where config context is not yet available\n const config = configContext?.config\n const apiPath = config?.routes?.api || '/api'\n const adminPath = config?.routes?.admin || '/admin'\n\n const fetchAppointments = useCallback(async () => {\n setIsLoading(true)\n setError(null)\n\n try {\n // Get appointments for the next 30 days and past 7 days\n const now = new Date()\n const startDate = new Date(now)\n startDate.setDate(startDate.getDate() - 7)\n const endDate = new Date(now)\n endDate.setDate(endDate.getDate() + 30)\n\n // Build API URL\n const queryParams = new URLSearchParams({\n depth: '1',\n limit: '200',\n 'where[startDateTime][greater_than_equal]': startDate.toISOString(),\n 'where[startDateTime][less_than_equal]': endDate.toISOString(),\n })\n\n const response = await fetch(`${apiPath}/appointments?${queryParams.toString()}`)\n\n if (!response.ok) {\n throw new Error('Failed to fetch appointments')\n }\n\n const result = await response.json()\n const appointmentEvents = result.docs.map(transformAppointmentToEvent)\n setEvents(appointmentEvents)\n } catch (err) {\n console.error('Error fetching appointments:', err)\n setError('Failed to load appointments')\n } finally {\n setIsLoading(false)\n }\n }, [apiPath])\n\n useEffect(() => {\n void fetchAppointments()\n }, [fetchAppointments])\n\n const handleSlotClick = useCallback(\n (start: Date, _end: Date) => {\n // Navigate to create new appointment with pre-filled start time\n const params = new URLSearchParams({\n startDateTime: start.toISOString(),\n })\n window.location.href = `${adminPath}/collections/appointments/create?${params.toString()}`\n },\n [adminPath]\n )\n\n const handleEventClick = useCallback((_event: CalendarEvent) => {\n // Event click is handled by the calendar popover\n // but we could add custom handling here if needed\n }, [])\n\n if (error) {\n return (\n <div style={{ padding: '20px' }}>\n <h2 style={{ fontSize: '18px', fontWeight: 600, marginBottom: '12px' }}>\n Appointments Calendar\n </h2>\n <div\n style={{\n background: 'var(--theme-error-50)',\n borderRadius: '8px',\n color: 'var(--theme-error-700)',\n padding: '20px',\n }}\n >\n {error}\n </div>\n </div>\n )\n }\n\n return (\n <div style={{ padding: '20px' }}>\n <h2 style={{ fontSize: '18px', fontWeight: 600, marginBottom: '12px' }}>\n Appointments Calendar\n </h2>\n {isLoading ? (\n <div\n style={{\n alignItems: 'center',\n color: 'var(--theme-elevation-500)',\n display: 'flex',\n height: '400px',\n justifyContent: 'center',\n }}\n >\n Loading appointments...\n </div>\n ) : (\n <CalendarContainer\n endHour={20}\n events={events}\n onEventClick={handleEventClick}\n onSlotClick={handleSlotClick}\n startHour={8}\n />\n )}\n </div>\n )\n}\n"],"names":["useConfig","React","useCallback","useEffect","useState","CalendarContainer","transformAppointmentToEvent","doc","service","undefined","customer","guest","teamMember","endDateTime","duration","start","Date","startDateTime","setMinutes","getMinutes","toISOString","id","type","blockoutReason","customerId","customerName","name","firstName","end","guestId","guestName","lastName","trim","notes","serviceColor","color","serviceId","serviceName","status","teamMemberColor","teamMemberId","teamMemberName","title","BeforeDashboardClient","configContext","events","setEvents","isLoading","setIsLoading","error","setError","config","apiPath","routes","api","adminPath","admin","fetchAppointments","now","startDate","setDate","getDate","endDate","queryParams","URLSearchParams","depth","limit","response","fetch","toString","ok","Error","result","json","appointmentEvents","docs","map","err","console","handleSlotClick","_end","params","window","location","href","handleEventClick","_event","div","style","padding","h2","fontSize","fontWeight","marginBottom","background","borderRadius","alignItems","display","height","justifyContent","endHour","onEventClick","onSlotClick","startHour"],"mappings":"AAAA;;AAEA,SAASA,SAAS,QAAQ,iBAAgB;AAC1C,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAI/D,SAASC,iBAAiB,QAAQ,sBAAqB;AAoCvD,SAASC,4BAA4BC,GAAmB;IACtD,MAAMC,UAAU,OAAOD,IAAIC,OAAO,KAAK,WAAWD,IAAIC,OAAO,GAAGC;IAChE,MAAMC,WAAW,OAAOH,IAAIG,QAAQ,KAAK,WAAWH,IAAIG,QAAQ,GAAGD;IACnE,MAAME,QAAQ,OAAOJ,IAAII,KAAK,KAAK,WAAWJ,IAAII,KAAK,GAAGF;IAC1D,MAAMG,aAAa,OAAOL,IAAIK,UAAU,KAAK,WAAWL,IAAIK,UAAU,GAAGH;IAEzE,qCAAqC;IACrC,IAAII,cAAcN,IAAIM,WAAW;IACjC,IAAI,CAACA,eAAeL,SAASM,UAAU;QACrC,MAAMC,QAAQ,IAAIC,KAAKT,IAAIU,aAAa;QACxCF,MAAMG,UAAU,CAACH,MAAMI,UAAU,KAAKX,QAAQM,QAAQ;QACtDD,cAAcE,MAAMK,WAAW;IACjC,OAAO,IAAI,CAACP,aAAa;QACvB,MAAME,QAAQ,IAAIC,KAAKT,IAAIU,aAAa;QACxCF,MAAMG,UAAU,CAACH,MAAMI,UAAU,KAAK,KAAI,iBAAiB;QAC3DN,cAAcE,MAAMK,WAAW;IACjC;IAEA,OAAO;QACLC,IAAId,IAAIc,EAAE;QACVC,MAAMf,IAAIe,IAAI;QACdC,gBAAgBhB,IAAIgB,cAAc;QAClCC,YAAYd,UAAUW;QACtBI,cAAcf,UAAUgB,QAAQhB,UAAUiB;QAC1CC,KAAK,IAAIZ,KAAKH;QACdgB,SAASlB,OAAOU;QAChBS,WAAWnB,QAAQ,GAAGA,MAAMgB,SAAS,CAAC,CAAC,EAAEhB,MAAMoB,QA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,QAAQA;gBACRwD,cAAchB;gBACdiB,aAAavB;gBACbwB,WAAW;;;;AAKrB,EAAC"}
@@ -0,0 +1,2 @@
1
+ import type { ServerComponentProps } from 'payload';
2
+ export declare const BeforeDashboardServer: (props: ServerComponentProps) => Promise<import("react").JSX.Element>;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styles from './BeforeDashboardServer.module.css';
3
+ export const BeforeDashboardServer = async (props)=>{
4
+ const { payload } = props;
5
+ const { docs } = await payload.find({
6
+ collection: 'plugin-collection'
7
+ });
8
+ return /*#__PURE__*/ _jsxs("div", {
9
+ className: styles.wrapper,
10
+ children: [
11
+ /*#__PURE__*/ _jsx("h1", {
12
+ children: "Added by the plugin: Before Dashboard Server"
13
+ }),
14
+ "Docs from Local API:",
15
+ docs.map((doc)=>/*#__PURE__*/ _jsx("div", {
16
+ children: doc.id
17
+ }, doc.id))
18
+ ]
19
+ });
20
+ };
21
+
22
+ //# sourceMappingURL=BeforeDashboardServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/BeforeDashboardServer.tsx"],"sourcesContent":["import type { ServerComponentProps } from 'payload'\n\nimport styles from './BeforeDashboardServer.module.css'\n\nexport const BeforeDashboardServer = async (props: ServerComponentProps) => {\n const { payload } = props\n\n const { docs } = await payload.find({ collection: 'plugin-collection' })\n\n return (\n <div className={styles.wrapper}>\n <h1>Added by the plugin: Before Dashboard Server</h1>\n Docs from Local API:\n {docs.map((doc) => (\n <div key={doc.id}>{doc.id}</div>\n ))}\n </div>\n )\n}\n"],"names":["styles","BeforeDashboardServer","props","payload","docs","find","collection","div","className","wrapper","h1","map","doc","id"],"mappings":";AAEA,OAAOA,YAAY,qCAAoC;AAEvD,OAAO,MAAMC,wBAAwB,OAAOC;IAC1C,MAAM,EAAEC,OAAO,EAAE,GAAGD;IAEpB,MAAM,EAAEE,IAAI,EAAE,GAAG,MAAMD,QAAQE,IAAI,CAAC;QAAEC,YAAY;IAAoB;IAEtE,qBACE,MAACC;QAAIC,WAAWR,OAAOS,OAAO;;0BAC5B,KAACC;0BAAG;;YAAiD;YAEpDN,KAAKO,GAAG,CAAC,CAACC,oBACT,KAACL;8BAAkBK,IAAIC,EAAE;mBAAfD,IAAIC,EAAE;;;AAIxB,EAAC"}
@@ -0,0 +1,5 @@
1
+ .wrapper {
2
+ display: flex;
3
+ gap: 5px;
4
+ flex-direction: column;
5
+ }