@ossy/booking 1.15.7 → 1.16.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 +26 -19
- package/package.json +7 -7
- package/src/AvailabilityEditor.jsx +22 -15
- package/src/Definition.js +1 -23
- package/src/SalesSection.jsx +9 -4
- package/src/availability-setup.page.jsx +94 -126
- package/src/booking-card.component.jsx +30 -33
- package/src/booking-detail.page.jsx +65 -204
- package/src/booking-resources.js +10 -0
- package/src/bookings.page.jsx +54 -56
- package/src/cancel-booking.action.js +1 -61
- package/src/cancel-booking.task.js +60 -0
- package/src/confirm-booking.action.js +1 -82
- package/src/confirm-booking.task.js +81 -0
- package/src/create-booking.action.js +1 -168
- package/src/create-booking.task.js +170 -0
- package/src/create-service.action.js +1 -0
- package/src/create-service.task.js +46 -0
- package/src/decline-booking.action.js +1 -68
- package/src/decline-booking.task.js +67 -0
- package/src/delete-service.action.js +1 -0
- package/src/delete-service.task.js +41 -0
- package/src/en.translations.json +246 -0
- package/src/get-availability.action.js +1 -52
- package/src/get-availability.task.js +51 -0
- package/src/get-available-slots.action.js +1 -89
- package/src/get-available-slots.task.js +99 -0
- package/src/get-services.action.js +1 -0
- package/src/get-services.task.js +37 -0
- package/src/home.page.jsx +48 -5
- package/src/index.js +20 -1
- package/src/invoke-error-message.js +10 -0
- package/src/list-bookings.action.js +1 -36
- package/src/list-bookings.task.js +35 -0
- package/src/locations.js +14 -0
- package/src/public-booking.page.jsx +200 -245
- package/src/save-availability.action.js +1 -73
- package/src/save-availability.task.js +74 -0
- package/src/send-booking-reminder.task.js +2 -2
- package/src/services.page.jsx +167 -46
- package/src/sv.translations.json +246 -0
- package/src/update-service.action.js +1 -0
- package/src/update-service.task.js +52 -0
- package/src/BookingForm.jsx +0 -82
- package/src/availability.page.jsx +0 -41
- package/src/booking-page.page.jsx +0 -42
package/src/BookingForm.jsx
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { View, Title, Text, Button, Input, Select } from '@ossy/design-system'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Public client-facing form.
|
|
6
|
-
*
|
|
7
|
-
* TODO:
|
|
8
|
-
* - Load services for workspaceId via booking.get-services
|
|
9
|
-
* - Load available slots for selected service via booking.get-available-slots
|
|
10
|
-
* - On submit: call booking.create-booking action, then redirect to Stripe Checkout
|
|
11
|
-
*/
|
|
12
|
-
export const BookingForm = ({ workspaceId }) => {
|
|
13
|
-
const [step, setStep] = useState('pick-service')
|
|
14
|
-
const [selectedService, setSelectedService] = useState(null)
|
|
15
|
-
const [selectedSlot, setSelectedSlot] = useState(null)
|
|
16
|
-
const [clientName, setClientName] = useState('')
|
|
17
|
-
const [clientEmail, setClientEmail] = useState('')
|
|
18
|
-
|
|
19
|
-
if (step === 'pick-service') {
|
|
20
|
-
return (
|
|
21
|
-
<View gap="m">
|
|
22
|
-
<Title variant="secondary">Choose a service</Title>
|
|
23
|
-
{/* TODO: replace with real services loaded from API */}
|
|
24
|
-
<Text color="secondary">Loading services for workspace {workspaceId}…</Text>
|
|
25
|
-
<Button variant="secondary" onClick={() => setStep('pick-slot')}>
|
|
26
|
-
Continue (placeholder)
|
|
27
|
-
</Button>
|
|
28
|
-
</View>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (step === 'pick-slot') {
|
|
33
|
-
return (
|
|
34
|
-
<View gap="m">
|
|
35
|
-
<Title variant="secondary">Pick a time</Title>
|
|
36
|
-
{/* TODO: render a slot grid derived from availability minus existing bookings */}
|
|
37
|
-
<Text color="secondary">Available slots will appear here.</Text>
|
|
38
|
-
<View layout="row" gap="s">
|
|
39
|
-
<Button variant="ghost" onClick={() => setStep('pick-service')}>Back</Button>
|
|
40
|
-
<Button variant="secondary" onClick={() => setStep('enter-details')}>
|
|
41
|
-
Continue (placeholder)
|
|
42
|
-
</Button>
|
|
43
|
-
</View>
|
|
44
|
-
</View>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (step === 'enter-details') {
|
|
49
|
-
return (
|
|
50
|
-
<View gap="m">
|
|
51
|
-
<Title variant="secondary">Your details</Title>
|
|
52
|
-
<Input
|
|
53
|
-
label="Name"
|
|
54
|
-
value={clientName}
|
|
55
|
-
onChange={setClientName}
|
|
56
|
-
placeholder="Jane Smith"
|
|
57
|
-
/>
|
|
58
|
-
<Input
|
|
59
|
-
label="Email"
|
|
60
|
-
type="email"
|
|
61
|
-
value={clientEmail}
|
|
62
|
-
onChange={setClientEmail}
|
|
63
|
-
placeholder="jane@example.com"
|
|
64
|
-
/>
|
|
65
|
-
<View layout="row" gap="s">
|
|
66
|
-
<Button variant="ghost" onClick={() => setStep('pick-slot')}>Back</Button>
|
|
67
|
-
{/* TODO: submit booking action then redirect to Stripe */}
|
|
68
|
-
<Button variant="primary" onClick={() => setStep('confirm')}>
|
|
69
|
-
Confirm & Pay
|
|
70
|
-
</Button>
|
|
71
|
-
</View>
|
|
72
|
-
</View>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<View gap="m">
|
|
78
|
-
<Title variant="secondary">Booking confirmed!</Title>
|
|
79
|
-
<Text>Check your email for a confirmation.</Text>
|
|
80
|
-
</View>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View, Title, Text, Tags } from '@ossy/design-system'
|
|
3
|
-
import { Definition } from './Definition.js'
|
|
4
|
-
import { moduleStatusTags } from './moduleStatus.js'
|
|
5
|
-
import { AvailabilityEditor } from './AvailabilityEditor.jsx'
|
|
6
|
-
|
|
7
|
-
export const metadata = {
|
|
8
|
-
id: 'booking/availability',
|
|
9
|
-
path: {
|
|
10
|
-
sv: '/tillganglighet',
|
|
11
|
-
en: '/availability',
|
|
12
|
-
},
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const AvailabilityPage = () => (
|
|
16
|
-
<View
|
|
17
|
-
gap="m"
|
|
18
|
-
surface="primary"
|
|
19
|
-
style={{ padding: 'var(--space-m) var(--space-l)', height: '100%', overflowY: 'auto' }}
|
|
20
|
-
>
|
|
21
|
-
<View inset="s" gap="s">
|
|
22
|
-
<View layout="row" gap="s" alignItems="center">
|
|
23
|
-
<Title>{Definition.title} — Availability</Title>
|
|
24
|
-
{moduleStatusTags(Definition).length > 0 && (
|
|
25
|
-
<Tags tags={moduleStatusTags(Definition)} size="s" />
|
|
26
|
-
)}
|
|
27
|
-
</View>
|
|
28
|
-
|
|
29
|
-
<Text style={{ maxWidth: '400px' }}>
|
|
30
|
-
Set your weekly availability. Clients can only book slots within these windows.
|
|
31
|
-
</Text>
|
|
32
|
-
</View>
|
|
33
|
-
|
|
34
|
-
<View inset="s">
|
|
35
|
-
{/* TODO: load existing availability via booking.get-availability, save via booking.set-availability */}
|
|
36
|
-
<AvailabilityEditor availability={[]} />
|
|
37
|
-
</View>
|
|
38
|
-
</View>
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
export default AvailabilityPage
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View, Title, Text } from '@ossy/design-system'
|
|
3
|
-
import { useRouter } from '@ossy/router-react'
|
|
4
|
-
import { BookingForm } from './BookingForm.jsx'
|
|
5
|
-
|
|
6
|
-
export const metadata = {
|
|
7
|
-
id: 'booking/book',
|
|
8
|
-
// Public-facing — no auth required
|
|
9
|
-
public: true,
|
|
10
|
-
path: {
|
|
11
|
-
sv: '/boka/:workspaceId',
|
|
12
|
-
en: '/book/:workspaceId',
|
|
13
|
-
},
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const BookingPage = () => {
|
|
17
|
-
const router = useRouter()
|
|
18
|
-
const { workspaceId } = router.params
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<View
|
|
22
|
-
surface="base"
|
|
23
|
-
layout="off-center-s"
|
|
24
|
-
inset="s"
|
|
25
|
-
style={{ minHeight: '100dvh' }}
|
|
26
|
-
>
|
|
27
|
-
<title>Book a session</title>
|
|
28
|
-
|
|
29
|
-
<View inset="m" roundness="l" surface="primary" slot="content" gap="m">
|
|
30
|
-
<View gap="xs">
|
|
31
|
-
<Title>Book a session</Title>
|
|
32
|
-
<Text>Pick a time that works for you and confirm your appointment.</Text>
|
|
33
|
-
</View>
|
|
34
|
-
|
|
35
|
-
{/* TODO: load services for workspaceId, let client pick one */}
|
|
36
|
-
<BookingForm workspaceId={workspaceId} />
|
|
37
|
-
</View>
|
|
38
|
-
</View>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export default BookingPage
|