@wix/headless-bookings 0.0.38 → 0.0.40
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/cjs/dist/react/core/payment/Payment.d.ts +36 -104
- package/cjs/dist/react/core/payment/Payment.js +29 -111
- package/cjs/dist/react/core/time-slot-list/TimeSlot.d.ts +14 -22
- package/cjs/dist/react/core/time-slot-list/TimeSlot.js +30 -34
- package/cjs/dist/react/index.d.ts +0 -1
- package/cjs/dist/react/index.js +0 -1
- package/cjs/dist/react/payment/Payment.d.ts +119 -82
- package/cjs/dist/react/payment/Payment.js +126 -81
- package/cjs/dist/react/time-slot-list/TimeSlot.d.ts +24 -2
- package/cjs/dist/react/time-slot-list/TimeSlot.js +18 -2
- package/cjs/dist/react/time-slot-list/TimeSlotList.js +3 -5
- package/cjs/dist/services/index.d.ts +1 -1
- package/cjs/dist/services/index.js +1 -1
- package/cjs/dist/services/payment/payment.def.d.ts +2 -1
- package/cjs/dist/services/payment/payment.js +8 -2
- package/cjs/dist/services/time-slot-list/index.d.ts +1 -0
- package/cjs/dist/services/time-slot-list/index.js +1 -0
- package/cjs/dist/services/time-slot-list/time-slot.d.ts +35 -0
- package/cjs/dist/services/time-slot-list/time-slot.js +20 -0
- package/cjs/dist/utils/guid.d.ts +7 -0
- package/cjs/dist/utils/guid.js +12 -0
- package/dist/react/core/payment/Payment.d.ts +36 -104
- package/dist/react/core/payment/Payment.js +29 -111
- package/dist/react/core/time-slot-list/TimeSlot.d.ts +14 -22
- package/dist/react/core/time-slot-list/TimeSlot.js +30 -34
- package/dist/react/index.d.ts +0 -1
- package/dist/react/index.js +0 -1
- package/dist/react/payment/Payment.d.ts +119 -82
- package/dist/react/payment/Payment.js +126 -81
- package/dist/react/time-slot-list/TimeSlot.d.ts +24 -2
- package/dist/react/time-slot-list/TimeSlot.js +18 -2
- package/dist/react/time-slot-list/TimeSlotList.js +3 -5
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/payment/payment.def.d.ts +2 -1
- package/dist/services/payment/payment.js +8 -2
- package/dist/services/time-slot-list/index.d.ts +1 -0
- package/dist/services/time-slot-list/index.js +1 -0
- package/dist/services/time-slot-list/time-slot.d.ts +35 -0
- package/dist/services/time-slot-list/time-slot.js +20 -0
- package/dist/utils/guid.d.ts +7 -0
- package/dist/utils/guid.js +12 -0
- package/package.json +2 -2
- package/cjs/dist/react/payment/PaymentLineItem.d.ts +0 -144
- package/cjs/dist/react/payment/PaymentLineItem.js +0 -141
- package/dist/react/payment/PaymentLineItem.d.ts +0 -144
- package/dist/react/payment/PaymentLineItem.js +0 -141
|
@@ -7,34 +7,26 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import type { TimeSlot as TimeSlotType } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
10
|
+
import { type TimeSlotServiceConfig } from '../../../services/time-slot-list/time-slot.js';
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* Props for TimeSlot.Root component
|
|
12
13
|
*/
|
|
13
|
-
export interface
|
|
14
|
-
/** The current time slot data */
|
|
15
|
-
timeSlot: TimeSlotType;
|
|
16
|
-
/** Whether this time slot is currently selected */
|
|
17
|
-
isSelected: boolean;
|
|
18
|
-
/** Action to select this time slot */
|
|
19
|
-
selectTimeSlot: () => void;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Hook to access TimeSlot context
|
|
23
|
-
* @throws Error if used outside of TimeSlotProvider
|
|
24
|
-
*/
|
|
25
|
-
export declare function useTimeSlotContext(): TimeSlotContextValue;
|
|
26
|
-
/**
|
|
27
|
-
* Props for TimeSlotProvider
|
|
28
|
-
*/
|
|
29
|
-
export interface TimeSlotProviderProps {
|
|
14
|
+
export interface RootProps {
|
|
30
15
|
children: React.ReactNode;
|
|
31
|
-
|
|
16
|
+
config: TimeSlotServiceConfig;
|
|
32
17
|
}
|
|
33
18
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
19
|
+
* Root component that provides TimeSlot context.
|
|
20
|
+
*
|
|
21
|
+
* @component
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <TimeSlot.Root config={{ timeSlot }}>
|
|
25
|
+
* {children}
|
|
26
|
+
* </TimeSlot.Root>
|
|
27
|
+
* ```
|
|
36
28
|
*/
|
|
37
|
-
export declare function
|
|
29
|
+
export declare function Root(props: RootProps): React.ReactNode;
|
|
38
30
|
/**
|
|
39
31
|
* Context value for StaffMember components
|
|
40
32
|
*/
|
|
@@ -7,41 +7,24 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
7
|
* which provides the TimeSlotProvider context.
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { useService } from '@wix/services-manager-react';
|
|
10
|
+
import { useService, WixServices } from '@wix/services-manager-react';
|
|
11
|
+
import { createServicesMap } from '@wix/services-manager';
|
|
11
12
|
import { TimeSlotListServiceDefinition } from '../../../services/time-slot-list/time-slot-list.def.js';
|
|
12
13
|
import { ANY_STAFF_MEMBER_ID, BookingServiceDefinition, } from '../../../services/booking/booking.js';
|
|
13
|
-
|
|
14
|
+
import { TimeSlotServiceDefinition, TimeSlotService, } from '../../../services/time-slot-list/time-slot.js';
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Provider component used by TimeSlotRepeater to provide context.
|
|
27
|
-
* Not used directly by consumers - only by TimeSlotList.TimeSlotRepeater.
|
|
16
|
+
* Root component that provides TimeSlot context.
|
|
17
|
+
*
|
|
18
|
+
* @component
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <TimeSlot.Root config={{ timeSlot }}>
|
|
22
|
+
* {children}
|
|
23
|
+
* </TimeSlot.Root>
|
|
24
|
+
* ```
|
|
28
25
|
*/
|
|
29
|
-
export function
|
|
30
|
-
|
|
31
|
-
const service = useService(TimeSlotListServiceDefinition);
|
|
32
|
-
const bookingService = useService(BookingServiceDefinition);
|
|
33
|
-
const selectedTimeSlot = bookingService.serviceSelections.get()[0]?.timeSlot;
|
|
34
|
-
const isSelected = selectedTimeSlot?.startDate === timeSlot.localStartDate &&
|
|
35
|
-
selectedTimeSlot?.location?._id === timeSlot.location?._id;
|
|
36
|
-
const selectTimeSlot = () => {
|
|
37
|
-
service.actions.selectSlot(timeSlot);
|
|
38
|
-
};
|
|
39
|
-
const contextValue = {
|
|
40
|
-
timeSlot,
|
|
41
|
-
isSelected,
|
|
42
|
-
selectTimeSlot,
|
|
43
|
-
};
|
|
44
|
-
return (_jsx(TimeSlotContext.Provider, { value: contextValue, children: children }));
|
|
26
|
+
export function Root(props) {
|
|
27
|
+
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(TimeSlotServiceDefinition, TimeSlotService, props.config), children: props.children }));
|
|
45
28
|
}
|
|
46
29
|
const StaffMemberContext = React.createContext(null);
|
|
47
30
|
/**
|
|
@@ -89,7 +72,12 @@ export function StaffMemberProvider(props) {
|
|
|
89
72
|
* ```
|
|
90
73
|
*/
|
|
91
74
|
export function Info(props) {
|
|
92
|
-
const
|
|
75
|
+
const timeSlotService = useService(TimeSlotServiceDefinition);
|
|
76
|
+
const timeSlot = timeSlotService.timeSlotSignal.get();
|
|
77
|
+
const bookingService = useService(BookingServiceDefinition);
|
|
78
|
+
const selectedTimeSlot = bookingService.serviceSelections.get()[0]?.timeSlot;
|
|
79
|
+
const isSelected = selectedTimeSlot?.startDate === timeSlot.localStartDate &&
|
|
80
|
+
selectedTimeSlot?.location?._id === timeSlot.location?._id;
|
|
93
81
|
const startDate = new Date(timeSlot.localStartDate);
|
|
94
82
|
const endDate = new Date(timeSlot.localEndDate);
|
|
95
83
|
const locationName = timeSlot.location?.name ?? '';
|
|
@@ -127,9 +115,16 @@ export function Info(props) {
|
|
|
127
115
|
* ```
|
|
128
116
|
*/
|
|
129
117
|
export function Actions(props) {
|
|
130
|
-
const
|
|
118
|
+
const timeSlotService = useService(TimeSlotServiceDefinition);
|
|
119
|
+
const timeSlot = timeSlotService.timeSlotSignal.get();
|
|
131
120
|
const service = useService(TimeSlotListServiceDefinition);
|
|
132
121
|
const bookingService = useService(BookingServiceDefinition);
|
|
122
|
+
const selectedTimeSlot = bookingService.serviceSelections.get()[0]?.timeSlot;
|
|
123
|
+
const isSelected = selectedTimeSlot?.startDate === timeSlot.localStartDate &&
|
|
124
|
+
selectedTimeSlot?.location?._id === timeSlot.location?._id;
|
|
125
|
+
const selectTimeSlot = () => {
|
|
126
|
+
service.actions.selectSlot(timeSlot);
|
|
127
|
+
};
|
|
133
128
|
const bookable = timeSlot.bookable ?? false;
|
|
134
129
|
const selectedStaffMemberId = bookingService.serviceSelections.get()[0]?.timeSlot?.resources?.[0]?._id;
|
|
135
130
|
const staffFromSlot = timeSlot.availableResources[0].resources.map((r) => r._id);
|
|
@@ -165,7 +160,8 @@ export function Actions(props) {
|
|
|
165
160
|
* ```
|
|
166
161
|
*/
|
|
167
162
|
export function StaffMembers(props) {
|
|
168
|
-
const
|
|
163
|
+
const timeSlotService = useService(TimeSlotServiceDefinition);
|
|
164
|
+
const timeSlot = timeSlotService.timeSlotSignal.get();
|
|
169
165
|
const service = useService(TimeSlotListServiceDefinition);
|
|
170
166
|
const bookingService = useService(BookingServiceDefinition);
|
|
171
167
|
const selectedStaffMemberId = bookingService.serviceSelections.get()[0]?.timeSlot?.resources?.[0]?._id;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -6,4 +6,3 @@ export * as TimeSlotList from './time-slot-list/TimeSlotList.js';
|
|
|
6
6
|
export * as ServiceList from './service-list/ServiceList.js';
|
|
7
7
|
export * as Location from './location/Location.js';
|
|
8
8
|
export * as Payment from './payment/Payment.js';
|
|
9
|
-
export * as PaymentLineItem from './payment/PaymentLineItem.js';
|
package/dist/react/index.js
CHANGED
|
@@ -6,4 +6,3 @@ export * as TimeSlotList from './time-slot-list/TimeSlotList.js';
|
|
|
6
6
|
export * as ServiceList from './service-list/ServiceList.js';
|
|
7
7
|
export * as Location from './location/Location.js';
|
|
8
8
|
export * as Payment from './payment/Payment.js';
|
|
9
|
-
export * as PaymentLineItem from './payment/PaymentLineItem.js';
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
import { AsChildChildren } from '@wix/headless-utils/react';
|
|
7
7
|
import { MoneyData } from '@wix/headless-components/react';
|
|
8
8
|
import type { PaymentServiceConfig, SlotService } from '../../services/payment/payment.js';
|
|
9
|
-
import type {
|
|
9
|
+
import type { LineItem as CoreLineItem } from '../core/payment/Payment.js';
|
|
10
10
|
/**
|
|
11
11
|
* Props for Payment.Root component
|
|
12
12
|
*/
|
|
@@ -35,13 +35,13 @@ export interface RootProps {
|
|
|
35
35
|
* @component
|
|
36
36
|
* @example
|
|
37
37
|
* ```tsx
|
|
38
|
-
* import { Payment
|
|
38
|
+
* import { Payment } from '@wix/bookings/components';
|
|
39
39
|
*
|
|
40
40
|
* // SSR mode
|
|
41
41
|
* function PaymentPage({ paymentDetails }) {
|
|
42
42
|
* return (
|
|
43
43
|
* <Payment.Root paymentServiceConfig={{ paymentDetails }}>
|
|
44
|
-
* <Payment.
|
|
44
|
+
* <Payment.Total />
|
|
45
45
|
* </Payment.Root>
|
|
46
46
|
* );
|
|
47
47
|
* }
|
|
@@ -50,57 +50,13 @@ export interface RootProps {
|
|
|
50
50
|
* function LazyPayment({ slotServices }) {
|
|
51
51
|
* return (
|
|
52
52
|
* <Payment.Root slotServices={slotServices} numberOfParticipants={2}>
|
|
53
|
-
* {({ isLoading }) => isLoading ? <div>Loading...</div> : <Payment.
|
|
53
|
+
* {({ isLoading }) => isLoading ? <div>Loading...</div> : <Payment.Total />}
|
|
54
54
|
* </Payment.Root>
|
|
55
55
|
* );
|
|
56
56
|
* }
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
export declare const Root: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLElement>>;
|
|
60
|
-
/**
|
|
61
|
-
* Props for Payment.Summary component
|
|
62
|
-
*/
|
|
63
|
-
export interface SummaryProps {
|
|
64
|
-
asChild?: boolean;
|
|
65
|
-
children?: AsChildChildren<{
|
|
66
|
-
subtotal: MoneyData | null;
|
|
67
|
-
total: MoneyData | null;
|
|
68
|
-
currency: string;
|
|
69
|
-
tax: MoneyData | null;
|
|
70
|
-
hasTax: boolean;
|
|
71
|
-
discount: MoneyData | null;
|
|
72
|
-
hasDiscount: boolean;
|
|
73
|
-
payNow: MoneyData | null;
|
|
74
|
-
payLater: MoneyData | null;
|
|
75
|
-
isDeposit: boolean;
|
|
76
|
-
}>;
|
|
77
|
-
className?: string;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Displays the payment summary with totals.
|
|
81
|
-
* Uses data-attributes for conditional visibility via CSS.
|
|
82
|
-
*
|
|
83
|
-
* @component
|
|
84
|
-
* @example
|
|
85
|
-
* ```tsx
|
|
86
|
-
* // Default usage - renders subtotal, tax, discount, total
|
|
87
|
-
* <Payment.Summary className="space-y-2" />
|
|
88
|
-
*
|
|
89
|
-
* // Custom rendering with full summary data
|
|
90
|
-
* <Payment.Summary asChild>
|
|
91
|
-
* {({ subtotal, tax, hasTax, discount, hasDiscount, total, payNow, isDeposit }) => (
|
|
92
|
-
* <div>
|
|
93
|
-
* <div>Subtotal: <Money money={subtotal} /></div>
|
|
94
|
-
* <div data-has-tax={hasTax}>Tax: <Money money={tax} /></div>
|
|
95
|
-
* <div data-has-discount={hasDiscount}>Discount: <Money money={discount} /></div>
|
|
96
|
-
* <div>Total: <Money money={total} /></div>
|
|
97
|
-
* <div data-has-deposit={isDeposit}>Pay Now: <Money money={payNow} /></div>
|
|
98
|
-
* </div>
|
|
99
|
-
* )}
|
|
100
|
-
* </Payment.Summary>
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
export declare const Summary: React.ForwardRefExoticComponent<SummaryProps & React.RefAttributes<HTMLElement>>;
|
|
104
60
|
/**
|
|
105
61
|
* Props for Payment.Subtotal component
|
|
106
62
|
*/
|
|
@@ -128,7 +84,6 @@ export interface TaxProps {
|
|
|
128
84
|
asChild?: boolean;
|
|
129
85
|
children?: AsChildChildren<{
|
|
130
86
|
tax: MoneyData | null;
|
|
131
|
-
hasTax: boolean;
|
|
132
87
|
}>;
|
|
133
88
|
className?: string;
|
|
134
89
|
}
|
|
@@ -150,7 +105,6 @@ export interface DiscountProps {
|
|
|
150
105
|
asChild?: boolean;
|
|
151
106
|
children?: AsChildChildren<{
|
|
152
107
|
discount: MoneyData | null;
|
|
153
|
-
hasDiscount: boolean;
|
|
154
108
|
}>;
|
|
155
109
|
className?: string;
|
|
156
110
|
}
|
|
@@ -192,7 +146,6 @@ export interface PayNowProps {
|
|
|
192
146
|
asChild?: boolean;
|
|
193
147
|
children?: AsChildChildren<{
|
|
194
148
|
payNow: MoneyData | null;
|
|
195
|
-
isDeposit: boolean;
|
|
196
149
|
}>;
|
|
197
150
|
className?: string;
|
|
198
151
|
}
|
|
@@ -214,7 +167,6 @@ export interface PayLaterProps {
|
|
|
214
167
|
asChild?: boolean;
|
|
215
168
|
children?: AsChildChildren<{
|
|
216
169
|
payLater: MoneyData | null;
|
|
217
|
-
isDeposit: boolean;
|
|
218
170
|
}>;
|
|
219
171
|
className?: string;
|
|
220
172
|
}
|
|
@@ -229,12 +181,6 @@ export interface PayLaterProps {
|
|
|
229
181
|
* ```
|
|
230
182
|
*/
|
|
231
183
|
export declare const PayLater: React.ForwardRefExoticComponent<PayLaterProps & React.RefAttributes<HTMLElement>>;
|
|
232
|
-
/**
|
|
233
|
-
* Type for line item with required id field for GenericList
|
|
234
|
-
*/
|
|
235
|
-
type LineItemType = CombinedLineItem & {
|
|
236
|
-
id: string;
|
|
237
|
-
};
|
|
238
184
|
/**
|
|
239
185
|
* Props for Payment.LineItems component (Container Level)
|
|
240
186
|
*/
|
|
@@ -246,31 +192,22 @@ export interface LineItemsProps {
|
|
|
246
192
|
/**
|
|
247
193
|
* Container component for line items.
|
|
248
194
|
* Follows the 3-level List/Options/Repeater pattern.
|
|
249
|
-
* Provides context and
|
|
195
|
+
* Provides context and handles loading/error states via GenericList.
|
|
250
196
|
*
|
|
251
197
|
* @component
|
|
252
198
|
* @example
|
|
253
199
|
* ```tsx
|
|
254
200
|
* <Payment.LineItems>
|
|
255
|
-
* <Payment.LineItemsList
|
|
201
|
+
* <Payment.LineItemsList
|
|
202
|
+
* emptyState={<div>No items</div>}
|
|
203
|
+
* loadingState={<div>Loading...</div>}
|
|
204
|
+
* errorState={<div>Failed to load</div>}
|
|
205
|
+
* >
|
|
256
206
|
* <Payment.LineItemRepeater>
|
|
257
|
-
* <
|
|
207
|
+
* <Payment.LineItemPrice />
|
|
258
208
|
* </Payment.LineItemRepeater>
|
|
259
209
|
* </Payment.LineItemsList>
|
|
260
210
|
* </Payment.LineItems>
|
|
261
|
-
*
|
|
262
|
-
* // With asChild pattern for custom container
|
|
263
|
-
* <Payment.LineItems asChild>
|
|
264
|
-
* {({ lineItems, currency }) => (
|
|
265
|
-
* <div className="border rounded p-4">
|
|
266
|
-
* <Payment.LineItemsList>
|
|
267
|
-
* <Payment.LineItemRepeater>
|
|
268
|
-
* <LineItem.Price />
|
|
269
|
-
* </Payment.LineItemRepeater>
|
|
270
|
-
* </Payment.LineItemsList>
|
|
271
|
-
* </div>
|
|
272
|
-
* )}
|
|
273
|
-
* </Payment.LineItems>
|
|
274
211
|
* ```
|
|
275
212
|
*/
|
|
276
213
|
export declare const LineItems: React.ForwardRefExoticComponent<LineItemsProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -279,16 +216,25 @@ export declare const LineItems: React.ForwardRefExoticComponent<LineItemsProps &
|
|
|
279
216
|
*/
|
|
280
217
|
export interface LineItemsListProps {
|
|
281
218
|
children?: React.ReactNode;
|
|
219
|
+
/** Content to display when no items are available */
|
|
282
220
|
emptyState?: React.ReactNode;
|
|
221
|
+
/** Content to display when loading */
|
|
222
|
+
loadingState?: React.ReactNode;
|
|
223
|
+
/** Content to display when there's an error */
|
|
224
|
+
errorState?: React.ReactNode;
|
|
283
225
|
className?: string;
|
|
284
226
|
}
|
|
285
227
|
/**
|
|
286
|
-
* List container for line items with empty state support.
|
|
228
|
+
* List container for line items with empty/loading/error state support.
|
|
287
229
|
*
|
|
288
230
|
* @component
|
|
289
231
|
* @example
|
|
290
232
|
* ```tsx
|
|
291
|
-
* <Payment.LineItemsList
|
|
233
|
+
* <Payment.LineItemsList
|
|
234
|
+
* emptyState={<div>No items</div>}
|
|
235
|
+
* loadingState={<div>Loading...</div>}
|
|
236
|
+
* errorState={<div>Failed to load payment details</div>}
|
|
237
|
+
* >
|
|
292
238
|
* <Payment.LineItemRepeater />
|
|
293
239
|
* </Payment.LineItemsList>
|
|
294
240
|
* ```
|
|
@@ -298,9 +244,9 @@ export declare const LineItemsList: React.ForwardRefExoticComponent<LineItemsLis
|
|
|
298
244
|
* Render props for LineItemRepeater asChild pattern
|
|
299
245
|
*/
|
|
300
246
|
export interface LineItemRepeaterRenderProps {
|
|
301
|
-
items:
|
|
247
|
+
items: CoreLineItem[];
|
|
302
248
|
itemWrapper: (props: {
|
|
303
|
-
item:
|
|
249
|
+
item: CoreLineItem;
|
|
304
250
|
index: number;
|
|
305
251
|
children: React.ReactNode;
|
|
306
252
|
}) => React.ReactNode;
|
|
@@ -313,7 +259,7 @@ export interface LineItemRepeaterProps {
|
|
|
313
259
|
asChild?: boolean;
|
|
314
260
|
}
|
|
315
261
|
/**
|
|
316
|
-
* Repeater component that renders
|
|
262
|
+
* Repeater component that renders LineItemRoot for each line item.
|
|
317
263
|
* Supports asChild pattern for custom rendering.
|
|
318
264
|
*
|
|
319
265
|
* @component
|
|
@@ -321,7 +267,7 @@ export interface LineItemRepeaterProps {
|
|
|
321
267
|
* ```tsx
|
|
322
268
|
* // Standard usage
|
|
323
269
|
* <Payment.LineItemRepeater>
|
|
324
|
-
* <
|
|
270
|
+
* <Payment.LineItemPrice />
|
|
325
271
|
* </Payment.LineItemRepeater>
|
|
326
272
|
*
|
|
327
273
|
* // AsChild usage with custom list
|
|
@@ -330,7 +276,7 @@ export interface LineItemRepeaterProps {
|
|
|
330
276
|
* <ol>
|
|
331
277
|
* {items.map((item, index) => (
|
|
332
278
|
* <li key={item.id}>
|
|
333
|
-
* {itemWrapper({ item, index, children: <
|
|
279
|
+
* {itemWrapper({ item, index, children: <Payment.LineItemPrice /> })}
|
|
334
280
|
* </li>
|
|
335
281
|
* ))}
|
|
336
282
|
* </ol>
|
|
@@ -339,4 +285,95 @@ export interface LineItemRepeaterProps {
|
|
|
339
285
|
* ```
|
|
340
286
|
*/
|
|
341
287
|
export declare const LineItemRepeater: React.ForwardRefExoticComponent<LineItemRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
342
|
-
|
|
288
|
+
/**
|
|
289
|
+
* Props for Payment.LineItemRoot component
|
|
290
|
+
*/
|
|
291
|
+
export interface LineItemRootProps {
|
|
292
|
+
lineItem: CoreLineItem;
|
|
293
|
+
currency: string;
|
|
294
|
+
children?: React.ReactNode | AsChildChildren<{
|
|
295
|
+
lineItem: CoreLineItem;
|
|
296
|
+
currency: string;
|
|
297
|
+
}>;
|
|
298
|
+
asChild?: boolean;
|
|
299
|
+
className?: string;
|
|
300
|
+
'data-testid'?: string;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Root component for a single line item.
|
|
304
|
+
* Provides context for child components.
|
|
305
|
+
*
|
|
306
|
+
* @component
|
|
307
|
+
* @example
|
|
308
|
+
* ```tsx
|
|
309
|
+
* <Payment.LineItemRoot lineItem={item} currency="USD">
|
|
310
|
+
* <Payment.LineItemPrice />
|
|
311
|
+
* <Payment.LineItemDiscount />
|
|
312
|
+
* </Payment.LineItemRoot>
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
export declare const LineItemRoot: React.ForwardRefExoticComponent<LineItemRootProps & React.RefAttributes<HTMLElement>>;
|
|
316
|
+
/**
|
|
317
|
+
* Props for Payment.LineItemPrice component
|
|
318
|
+
*/
|
|
319
|
+
export interface LineItemPriceProps {
|
|
320
|
+
asChild?: boolean;
|
|
321
|
+
children?: AsChildChildren<{
|
|
322
|
+
totalPrice: MoneyData | null;
|
|
323
|
+
priceText: string | null;
|
|
324
|
+
}>;
|
|
325
|
+
className?: string;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Displays the line item price.
|
|
329
|
+
* Shows priceText for CUSTOM rate type services, otherwise shows totalPrice.
|
|
330
|
+
*
|
|
331
|
+
* @component
|
|
332
|
+
* @example
|
|
333
|
+
* ```tsx
|
|
334
|
+
* <Payment.LineItemPrice className="text-lg font-bold" />
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
export declare const LineItemPrice: React.ForwardRefExoticComponent<LineItemPriceProps & React.RefAttributes<HTMLElement>>;
|
|
338
|
+
/**
|
|
339
|
+
* Props for Payment.LineItemDiscount component
|
|
340
|
+
*/
|
|
341
|
+
export interface LineItemDiscountProps {
|
|
342
|
+
asChild?: boolean;
|
|
343
|
+
children?: AsChildChildren<{
|
|
344
|
+
discount: MoneyData | null;
|
|
345
|
+
}>;
|
|
346
|
+
className?: string;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Displays the line item discount.
|
|
350
|
+
* Uses data-has-discount attribute for conditional visibility.
|
|
351
|
+
*
|
|
352
|
+
* @component
|
|
353
|
+
* @example
|
|
354
|
+
* ```tsx
|
|
355
|
+
* <Payment.LineItemDiscount className="text-green-500" />
|
|
356
|
+
* ```
|
|
357
|
+
*/
|
|
358
|
+
export declare const LineItemDiscount: React.ForwardRefExoticComponent<LineItemDiscountProps & React.RefAttributes<HTMLElement>>;
|
|
359
|
+
/**
|
|
360
|
+
* Props for Payment.LineItemDeposit component
|
|
361
|
+
*/
|
|
362
|
+
export interface LineItemDepositProps {
|
|
363
|
+
asChild?: boolean;
|
|
364
|
+
children?: AsChildChildren<{
|
|
365
|
+
deposit: MoneyData | null;
|
|
366
|
+
}>;
|
|
367
|
+
className?: string;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Displays the line item deposit amount.
|
|
371
|
+
* Uses data-has-deposit attribute for conditional visibility.
|
|
372
|
+
*
|
|
373
|
+
* @component
|
|
374
|
+
* @example
|
|
375
|
+
* ```tsx
|
|
376
|
+
* <Payment.LineItemDeposit className="font-semibold" />
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
export declare const LineItemDeposit: React.ForwardRefExoticComponent<LineItemDepositProps & React.RefAttributes<HTMLElement>>;
|