@wix/headless-bookings 0.0.29 → 0.0.31
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 +193 -0
- package/cjs/dist/react/core/payment/Payment.js +202 -0
- package/cjs/dist/react/core/service/ServiceMediaCover.d.ts +43 -0
- package/cjs/dist/react/core/service/ServiceMediaCover.js +34 -0
- package/cjs/dist/react/core/service/ServiceMediaGallery.d.ts +50 -0
- package/cjs/dist/react/core/service/ServiceMediaGallery.js +37 -0
- package/cjs/dist/react/core/service/ServiceMediaMain.d.ts +42 -0
- package/cjs/dist/react/core/service/ServiceMediaMain.js +33 -0
- package/cjs/dist/react/index.d.ts +3 -0
- package/cjs/dist/react/index.js +3 -0
- package/cjs/dist/react/payment/Payment.d.ts +342 -0
- package/cjs/dist/react/payment/Payment.js +294 -0
- package/cjs/dist/react/payment/PaymentLineItem.d.ts +144 -0
- package/cjs/dist/react/payment/PaymentLineItem.js +141 -0
- package/cjs/dist/react/service/Service.d.ts +7 -154
- package/cjs/dist/react/service/Service.js +8 -148
- package/cjs/dist/react/service/ServiceMedia.d.ts +191 -0
- package/cjs/dist/react/service/ServiceMedia.js +175 -0
- package/cjs/dist/services/index.d.ts +1 -0
- package/cjs/dist/services/index.js +1 -0
- package/cjs/dist/services/payment/payment.d.ts +32 -0
- package/cjs/dist/services/payment/payment.def.d.ts +66 -0
- package/cjs/dist/services/payment/payment.def.js +9 -0
- package/cjs/dist/services/payment/payment.js +167 -0
- package/cjs/dist/utils/money.d.ts +11 -0
- package/cjs/dist/utils/money.js +16 -0
- package/dist/react/core/payment/Payment.d.ts +193 -0
- package/dist/react/core/payment/Payment.js +202 -0
- package/dist/react/core/service/ServiceMediaCover.d.ts +43 -0
- package/dist/react/core/service/ServiceMediaCover.js +34 -0
- package/dist/react/core/service/ServiceMediaGallery.d.ts +50 -0
- package/dist/react/core/service/ServiceMediaGallery.js +37 -0
- package/dist/react/core/service/ServiceMediaMain.d.ts +42 -0
- package/dist/react/core/service/ServiceMediaMain.js +33 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +3 -0
- package/dist/react/payment/Payment.d.ts +342 -0
- package/dist/react/payment/Payment.js +294 -0
- package/dist/react/payment/PaymentLineItem.d.ts +144 -0
- package/dist/react/payment/PaymentLineItem.js +141 -0
- package/dist/react/service/Service.d.ts +7 -154
- package/dist/react/service/Service.js +8 -148
- package/dist/react/service/ServiceMedia.d.ts +191 -0
- package/dist/react/service/ServiceMedia.js +175 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/payment/payment.d.ts +32 -0
- package/dist/services/payment/payment.def.d.ts +66 -0
- package/dist/services/payment/payment.def.js +9 -0
- package/dist/services/payment/payment.js +167 -0
- package/dist/utils/money.d.ts +11 -0
- package/dist/utils/money.js +16 -0
- package/package.json +2 -2
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PaymentLineItem - Component for displaying individual line item information
|
|
3
|
+
* Used within Payment.LineItemRepeater to display price, discount, deposit, etc.
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { AsChildChildren } from '@wix/headless-utils/react';
|
|
7
|
+
import { MoneyData } from '@wix/headless-components/react';
|
|
8
|
+
import type { CombinedLineItem } from '../core/payment/Payment.js';
|
|
9
|
+
/**
|
|
10
|
+
* Props for PaymentLineItem.Root component
|
|
11
|
+
*/
|
|
12
|
+
export interface RootProps {
|
|
13
|
+
lineItem: CombinedLineItem;
|
|
14
|
+
currency: string;
|
|
15
|
+
children?: React.ReactNode | AsChildChildren<{
|
|
16
|
+
lineItem: CombinedLineItem;
|
|
17
|
+
currency: string;
|
|
18
|
+
}>;
|
|
19
|
+
asChild?: boolean;
|
|
20
|
+
className?: string;
|
|
21
|
+
'data-testid'?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Root component for a single line item.
|
|
25
|
+
* Provides context for child components.
|
|
26
|
+
*
|
|
27
|
+
* @component
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <PaymentLineItem.Root lineItem={item} currency="USD">
|
|
31
|
+
* <PaymentLineItem.Price />
|
|
32
|
+
* <PaymentLineItem.Discount />
|
|
33
|
+
* </PaymentLineItem.Root>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare const Root: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLElement>>;
|
|
37
|
+
/**
|
|
38
|
+
* Props for PaymentLineItem.Price component
|
|
39
|
+
*/
|
|
40
|
+
export interface PriceProps {
|
|
41
|
+
asChild?: boolean;
|
|
42
|
+
children?: AsChildChildren<{
|
|
43
|
+
totalPrice: MoneyData | null;
|
|
44
|
+
subtotal: MoneyData | null;
|
|
45
|
+
tax: MoneyData | null;
|
|
46
|
+
discount: MoneyData | null;
|
|
47
|
+
deposit: MoneyData | null;
|
|
48
|
+
priceText: string | null;
|
|
49
|
+
}>;
|
|
50
|
+
className?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Displays the line item price with support for different price types.
|
|
54
|
+
* Uses data-attributes for conditional visibility.
|
|
55
|
+
*
|
|
56
|
+
* For CUSTOM rate type services, displays priceText instead of monetary value.
|
|
57
|
+
*
|
|
58
|
+
* @component
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* // Default usage - renders total price or price text
|
|
62
|
+
* <PaymentLineItem.Price className="text-lg font-bold" />
|
|
63
|
+
*
|
|
64
|
+
* // Custom rendering with full price data
|
|
65
|
+
* <PaymentLineItem.Price asChild>
|
|
66
|
+
* {({ totalPrice, subtotal, tax, discount, priceText }) => (
|
|
67
|
+
* <div>
|
|
68
|
+
* {priceText ? (
|
|
69
|
+
* <span>{priceText}</span>
|
|
70
|
+
* ) : (
|
|
71
|
+
* <>
|
|
72
|
+
* <span><Money money={totalPrice} /></span>
|
|
73
|
+
* <span data-has-discount={!!discount?.amount}><Money money={discount} /></span>
|
|
74
|
+
* </>
|
|
75
|
+
* )}
|
|
76
|
+
* </div>
|
|
77
|
+
* )}
|
|
78
|
+
* </PaymentLineItem.Price>
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export declare const Price: React.ForwardRefExoticComponent<PriceProps & React.RefAttributes<HTMLElement>>;
|
|
82
|
+
/**
|
|
83
|
+
* Props for PaymentLineItem.Discount component
|
|
84
|
+
*/
|
|
85
|
+
export interface DiscountProps {
|
|
86
|
+
asChild?: boolean;
|
|
87
|
+
children?: AsChildChildren<{
|
|
88
|
+
discount: MoneyData | null;
|
|
89
|
+
}>;
|
|
90
|
+
className?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Displays the line item discount.
|
|
94
|
+
* Uses data-has-discount attribute for conditional visibility.
|
|
95
|
+
*
|
|
96
|
+
* @component
|
|
97
|
+
* @example
|
|
98
|
+
* ```tsx
|
|
99
|
+
* <PaymentLineItem.Discount className="text-green-500" />
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare const Discount: React.ForwardRefExoticComponent<DiscountProps & React.RefAttributes<HTMLElement>>;
|
|
103
|
+
/**
|
|
104
|
+
* Props for PaymentLineItem.Deposit component
|
|
105
|
+
*/
|
|
106
|
+
export interface DepositProps {
|
|
107
|
+
asChild?: boolean;
|
|
108
|
+
children?: AsChildChildren<{
|
|
109
|
+
deposit: MoneyData | null;
|
|
110
|
+
}>;
|
|
111
|
+
className?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Displays the line item deposit amount.
|
|
115
|
+
* Uses data-has-deposit attribute for conditional visibility.
|
|
116
|
+
*
|
|
117
|
+
* @component
|
|
118
|
+
* @example
|
|
119
|
+
* ```tsx
|
|
120
|
+
* <PaymentLineItem.Deposit className="font-semibold" />
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export declare const Deposit: React.ForwardRefExoticComponent<DepositProps & React.RefAttributes<HTMLElement>>;
|
|
124
|
+
/**
|
|
125
|
+
* Props for PaymentLineItem.PriceText component
|
|
126
|
+
*/
|
|
127
|
+
export interface PriceTextProps {
|
|
128
|
+
asChild?: boolean;
|
|
129
|
+
children?: AsChildChildren<{
|
|
130
|
+
priceText: string | null;
|
|
131
|
+
}>;
|
|
132
|
+
className?: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Displays the custom price text (for CUSTOM rate type services).
|
|
136
|
+
* Uses data-has-price-text attribute for conditional visibility.
|
|
137
|
+
*
|
|
138
|
+
* @component
|
|
139
|
+
* @example
|
|
140
|
+
* ```tsx
|
|
141
|
+
* <PaymentLineItem.PriceText className="text-foreground" />
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export declare const PriceText: React.ForwardRefExoticComponent<PriceTextProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* PaymentLineItem - Component for displaying individual line item information
|
|
4
|
+
* Used within Payment.LineItemRepeater to display price, discount, deposit, etc.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import * as CorePayment from '../core/payment/Payment.js';
|
|
8
|
+
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
9
|
+
import { Money } from '@wix/headless-components/react';
|
|
10
|
+
var TestIds;
|
|
11
|
+
(function (TestIds) {
|
|
12
|
+
TestIds["paymentLineItemRoot"] = "payment-line-item-root";
|
|
13
|
+
TestIds["paymentLineItemPrice"] = "payment-line-item-price";
|
|
14
|
+
TestIds["paymentLineItemDiscount"] = "payment-line-item-discount";
|
|
15
|
+
TestIds["paymentLineItemDeposit"] = "payment-line-item-deposit";
|
|
16
|
+
TestIds["paymentLineItemPriceText"] = "payment-line-item-price-text";
|
|
17
|
+
})(TestIds || (TestIds = {}));
|
|
18
|
+
const PaymentLineItemContext = React.createContext(null);
|
|
19
|
+
/**
|
|
20
|
+
* Hook to access PaymentLineItem context
|
|
21
|
+
*/
|
|
22
|
+
function usePaymentLineItemContext() {
|
|
23
|
+
const context = React.useContext(PaymentLineItemContext);
|
|
24
|
+
if (!context) {
|
|
25
|
+
throw new Error('usePaymentLineItemContext must be used within a PaymentLineItem.Root component');
|
|
26
|
+
}
|
|
27
|
+
return context;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Root component for a single line item.
|
|
31
|
+
* Provides context for child components.
|
|
32
|
+
*
|
|
33
|
+
* @component
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <PaymentLineItem.Root lineItem={item} currency="USD">
|
|
37
|
+
* <PaymentLineItem.Price />
|
|
38
|
+
* <PaymentLineItem.Discount />
|
|
39
|
+
* </PaymentLineItem.Root>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export const Root = React.forwardRef((props, ref) => {
|
|
43
|
+
const { lineItem, currency, children, asChild, className, ...attrs } = props;
|
|
44
|
+
return (_jsx(PaymentLineItemContext.Provider, { value: { lineItem, currency }, children: _jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": attrs['data-testid'] || TestIds.paymentLineItemRoot, customElement: children, customElementProps: { lineItem, currency }, ...attrs, children: _jsx("div", { children: React.isValidElement(children) ? children : null }) }) }));
|
|
45
|
+
});
|
|
46
|
+
Root.displayName = 'PaymentLineItem.Root';
|
|
47
|
+
/**
|
|
48
|
+
* Displays the line item price with support for different price types.
|
|
49
|
+
* Uses data-attributes for conditional visibility.
|
|
50
|
+
*
|
|
51
|
+
* For CUSTOM rate type services, displays priceText instead of monetary value.
|
|
52
|
+
*
|
|
53
|
+
* @component
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* // Default usage - renders total price or price text
|
|
57
|
+
* <PaymentLineItem.Price className="text-lg font-bold" />
|
|
58
|
+
*
|
|
59
|
+
* // Custom rendering with full price data
|
|
60
|
+
* <PaymentLineItem.Price asChild>
|
|
61
|
+
* {({ totalPrice, subtotal, tax, discount, priceText }) => (
|
|
62
|
+
* <div>
|
|
63
|
+
* {priceText ? (
|
|
64
|
+
* <span>{priceText}</span>
|
|
65
|
+
* ) : (
|
|
66
|
+
* <>
|
|
67
|
+
* <span><Money money={totalPrice} /></span>
|
|
68
|
+
* <span data-has-discount={!!discount?.amount}><Money money={discount} /></span>
|
|
69
|
+
* </>
|
|
70
|
+
* )}
|
|
71
|
+
* </div>
|
|
72
|
+
* )}
|
|
73
|
+
* </PaymentLineItem.Price>
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export const Price = React.forwardRef((props, ref) => {
|
|
77
|
+
const { asChild, children, className } = props;
|
|
78
|
+
const { lineItem, currency } = usePaymentLineItemContext();
|
|
79
|
+
return (_jsx(CorePayment.LineItem, { lineItem: lineItem, currency: currency, children: (priceData) => {
|
|
80
|
+
const { totalPrice, discount, deposit, priceText } = priceData;
|
|
81
|
+
// Default rendering based on price type
|
|
82
|
+
const renderDefaultPrice = () => {
|
|
83
|
+
// If custom price text (CUSTOM rate type), show text
|
|
84
|
+
if (priceText) {
|
|
85
|
+
return (_jsx("span", { className: className, "data-testid": TestIds.paymentLineItemPrice, children: priceText }));
|
|
86
|
+
}
|
|
87
|
+
// Otherwise show monetary price
|
|
88
|
+
return totalPrice ? (_jsx(Money, { money: totalPrice, className: className })) : null;
|
|
89
|
+
};
|
|
90
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentLineItemPrice, "data-has-discount": discount !== null && discount.amount > 0, "data-has-deposit": deposit !== null && deposit.amount > 0, "data-has-price-text": !!priceText, customElement: children, customElementProps: priceData, children: renderDefaultPrice() }));
|
|
91
|
+
} }));
|
|
92
|
+
});
|
|
93
|
+
Price.displayName = 'PaymentLineItem.Price';
|
|
94
|
+
/**
|
|
95
|
+
* Displays the line item discount.
|
|
96
|
+
* Uses data-has-discount attribute for conditional visibility.
|
|
97
|
+
*
|
|
98
|
+
* @component
|
|
99
|
+
* @example
|
|
100
|
+
* ```tsx
|
|
101
|
+
* <PaymentLineItem.Discount className="text-green-500" />
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export const Discount = React.forwardRef((props, ref) => {
|
|
105
|
+
const { asChild, children, className } = props;
|
|
106
|
+
const { lineItem, currency } = usePaymentLineItemContext();
|
|
107
|
+
return (_jsx(CorePayment.LineItem, { lineItem: lineItem, currency: currency, children: ({ discount }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentLineItemDiscount, "data-has-discount": discount !== null && discount.amount > 0, customElement: children, customElementProps: { discount }, children: discount ? _jsx(Money, { money: discount }) : null })) }));
|
|
108
|
+
});
|
|
109
|
+
Discount.displayName = 'PaymentLineItem.Discount';
|
|
110
|
+
/**
|
|
111
|
+
* Displays the line item deposit amount.
|
|
112
|
+
* Uses data-has-deposit attribute for conditional visibility.
|
|
113
|
+
*
|
|
114
|
+
* @component
|
|
115
|
+
* @example
|
|
116
|
+
* ```tsx
|
|
117
|
+
* <PaymentLineItem.Deposit className="font-semibold" />
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export const Deposit = React.forwardRef((props, ref) => {
|
|
121
|
+
const { asChild, children, className } = props;
|
|
122
|
+
const { lineItem, currency } = usePaymentLineItemContext();
|
|
123
|
+
return (_jsx(CorePayment.LineItem, { lineItem: lineItem, currency: currency, children: ({ deposit }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentLineItemDeposit, "data-has-deposit": deposit !== null && deposit.amount > 0, customElement: children, customElementProps: { deposit }, children: deposit ? _jsx(Money, { money: deposit }) : null })) }));
|
|
124
|
+
});
|
|
125
|
+
Deposit.displayName = 'PaymentLineItem.Deposit';
|
|
126
|
+
/**
|
|
127
|
+
* Displays the custom price text (for CUSTOM rate type services).
|
|
128
|
+
* Uses data-has-price-text attribute for conditional visibility.
|
|
129
|
+
*
|
|
130
|
+
* @component
|
|
131
|
+
* @example
|
|
132
|
+
* ```tsx
|
|
133
|
+
* <PaymentLineItem.PriceText className="text-foreground" />
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export const PriceText = React.forwardRef((props, ref) => {
|
|
137
|
+
const { asChild, children, className } = props;
|
|
138
|
+
const { lineItem, currency } = usePaymentLineItemContext();
|
|
139
|
+
return (_jsx(CorePayment.LineItem, { lineItem: lineItem, currency: currency, children: ({ priceText }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.paymentLineItemPriceText, "data-has-price-text": !!priceText, customElement: children, customElementProps: { priceText }, children: priceText ? _jsx("span", { children: priceText }) : null })) }));
|
|
140
|
+
});
|
|
141
|
+
PriceText.displayName = 'PaymentLineItem.PriceText';
|
|
@@ -6,6 +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 Service, type Payment } from '@wix/auto_sdk_bookings_services';
|
|
9
|
+
import * as ServiceMediaModule from './ServiceMedia.js';
|
|
9
10
|
/**
|
|
10
11
|
* Props for Service.Root component
|
|
11
12
|
*/
|
|
@@ -558,159 +559,6 @@ export interface StaffMemberRepeaterProps {
|
|
|
558
559
|
* ```
|
|
559
560
|
*/
|
|
560
561
|
export declare const StaffMemberRepeater: React.ForwardRefExoticComponent<StaffMemberRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
561
|
-
/**
|
|
562
|
-
* Props for Service MainMedia component
|
|
563
|
-
*/
|
|
564
|
-
export interface MainMediaProps {
|
|
565
|
-
asChild?: boolean;
|
|
566
|
-
children?: AsChildChildren<{
|
|
567
|
-
media: {
|
|
568
|
-
image?: string;
|
|
569
|
-
};
|
|
570
|
-
}>;
|
|
571
|
-
className?: string;
|
|
572
|
-
}
|
|
573
|
-
/**
|
|
574
|
-
* Displays the service main media image using WixMediaImage.
|
|
575
|
-
*
|
|
576
|
-
* @component
|
|
577
|
-
* @example
|
|
578
|
-
* ```tsx
|
|
579
|
-
* // Default usage
|
|
580
|
-
* <Service.MainMedia className="w-full h-64 object-cover rounded-lg" />
|
|
581
|
-
* ```
|
|
582
|
-
*
|
|
583
|
-
* @example
|
|
584
|
-
* ```tsx
|
|
585
|
-
* // asChild with primitive img element
|
|
586
|
-
* <Service.MainMedia asChild>
|
|
587
|
-
* <img className="w-full h-64 object-cover shadow-lg" />
|
|
588
|
-
* </Service.MainMedia>
|
|
589
|
-
* ```
|
|
590
|
-
*
|
|
591
|
-
* @example
|
|
592
|
-
* ```tsx
|
|
593
|
-
* // asChild with custom component accessing media data
|
|
594
|
-
* <Service.MainMedia asChild>
|
|
595
|
-
* {React.forwardRef(({media, ...props}, ref) => (
|
|
596
|
-
* <div ref={ref} {...props} className="relative aspect-video">
|
|
597
|
-
* <WixMediaImage media={media} className="w-full h-full object-cover" />
|
|
598
|
-
* <div className="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/50 p-4">
|
|
599
|
-
* <Service.Name className="text-primary-foreground" />
|
|
600
|
-
* </div>
|
|
601
|
-
* </div>
|
|
602
|
-
* ))}
|
|
603
|
-
* </Service.MainMedia>
|
|
604
|
-
* ```
|
|
605
|
-
*/
|
|
606
|
-
export declare const MainMedia: React.ForwardRefExoticComponent<MainMediaProps & React.RefAttributes<HTMLImageElement>>;
|
|
607
|
-
/**
|
|
608
|
-
* Props for Service CoverMedia component
|
|
609
|
-
*/
|
|
610
|
-
export interface CoverMediaProps {
|
|
611
|
-
asChild?: boolean;
|
|
612
|
-
children?: AsChildChildren<{
|
|
613
|
-
media: {
|
|
614
|
-
image?: string;
|
|
615
|
-
};
|
|
616
|
-
}>;
|
|
617
|
-
className?: string;
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
* Displays the service cover media image using WixMediaImage.
|
|
621
|
-
* The cover media is typically used as a hero/banner image.
|
|
622
|
-
*
|
|
623
|
-
* @component
|
|
624
|
-
* @example
|
|
625
|
-
* ```tsx
|
|
626
|
-
* // Default usage
|
|
627
|
-
* <Service.CoverMedia className="w-full h-96 object-cover" />
|
|
628
|
-
* ```
|
|
629
|
-
*
|
|
630
|
-
* @example
|
|
631
|
-
* ```tsx
|
|
632
|
-
* // asChild as a background image container
|
|
633
|
-
* <Service.CoverMedia asChild>
|
|
634
|
-
* <div className="w-full h-96 bg-cover bg-center" />
|
|
635
|
-
* </Service.CoverMedia>
|
|
636
|
-
* ```
|
|
637
|
-
*
|
|
638
|
-
* @example
|
|
639
|
-
* ```tsx
|
|
640
|
-
* // asChild with custom component accessing media data
|
|
641
|
-
* <Service.CoverMedia asChild>
|
|
642
|
-
* {React.forwardRef(({media, ...props}, ref) => (
|
|
643
|
-
* <header ref={ref} {...props} className="relative h-96">
|
|
644
|
-
* <WixMediaImage media={media} className="w-full h-full object-cover" />
|
|
645
|
-
* <div className="absolute inset-0 bg-black/40 flex items-center justify-center">
|
|
646
|
-
* <h1 className="text-4xl font-bold text-primary-foreground">
|
|
647
|
-
* <Service.Name />
|
|
648
|
-
* </h1>
|
|
649
|
-
* </div>
|
|
650
|
-
* </header>
|
|
651
|
-
* ))}
|
|
652
|
-
* </Service.CoverMedia>
|
|
653
|
-
* ```
|
|
654
|
-
*/
|
|
655
|
-
export declare const CoverMedia: React.ForwardRefExoticComponent<CoverMediaProps & React.RefAttributes<HTMLImageElement>>;
|
|
656
|
-
/**
|
|
657
|
-
* Props for Service MediaItems component
|
|
658
|
-
*/
|
|
659
|
-
export interface MediaItemsProps {
|
|
660
|
-
children: React.ReactNode;
|
|
661
|
-
infinite?: boolean;
|
|
662
|
-
autoPlay?: {
|
|
663
|
-
direction?: 'forward' | 'backward';
|
|
664
|
-
intervalMs?: number;
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
/**
|
|
668
|
-
* Container for service media items gallery.
|
|
669
|
-
* Renders a MediaGallery.Root with the service media items.
|
|
670
|
-
* Supports autoPlay and infinite scroll options for carousel behavior.
|
|
671
|
-
*
|
|
672
|
-
* @component
|
|
673
|
-
* @example
|
|
674
|
-
* ```tsx
|
|
675
|
-
* // Basic usage with MediaGallery components
|
|
676
|
-
* <Service.MediaItems>
|
|
677
|
-
* <MediaGallery.Thumbnails>
|
|
678
|
-
* <MediaGallery.ThumbnailRepeater>
|
|
679
|
-
* {({ mediaItem, isActive }) => (
|
|
680
|
-
* <img
|
|
681
|
-
* src={mediaItem.url}
|
|
682
|
-
* alt={mediaItem.altText}
|
|
683
|
-
* className={isActive ? 'active' : ''}
|
|
684
|
-
* />
|
|
685
|
-
* )}
|
|
686
|
-
* </MediaGallery.ThumbnailRepeater>
|
|
687
|
-
* </MediaGallery.Thumbnails>
|
|
688
|
-
* </Service.MediaItems>
|
|
689
|
-
*
|
|
690
|
-
* // With autoPlay carousel
|
|
691
|
-
* <Service.MediaItems
|
|
692
|
-
* autoPlay={{ direction: 'forward', intervalMs: 3000 }}
|
|
693
|
-
* infinite
|
|
694
|
-
* >
|
|
695
|
-
* <MediaGallery.MainImage />
|
|
696
|
-
* <MediaGallery.Actions.Previous />
|
|
697
|
-
* <MediaGallery.Actions.Next />
|
|
698
|
-
* </Service.MediaItems>
|
|
699
|
-
*
|
|
700
|
-
* // Full gallery with thumbnails and navigation
|
|
701
|
-
* <Service.MediaItems infinite>
|
|
702
|
-
* <div className="gallery-container">
|
|
703
|
-
* <MediaGallery.MainImage className="main-image" />
|
|
704
|
-
* <div className="controls">
|
|
705
|
-
* <MediaGallery.Actions.Previous>Prev</MediaGallery.Actions.Previous>
|
|
706
|
-
* <MediaGallery.Actions.Next>Next</MediaGallery.Actions.Next>
|
|
707
|
-
* </div>
|
|
708
|
-
* <MediaGallery.Thumbnails className="thumbnails" />
|
|
709
|
-
* </div>
|
|
710
|
-
* </Service.MediaItems>
|
|
711
|
-
* ```
|
|
712
|
-
*/
|
|
713
|
-
export declare const MediaItems: React.ForwardRefExoticComponent<MediaItemsProps & React.RefAttributes<HTMLDivElement>>;
|
|
714
562
|
/**
|
|
715
563
|
* Props for Service Raw component
|
|
716
564
|
*/
|
|
@@ -1210,4 +1058,9 @@ export declare const StaffMembers: typeof StaffMembersBase & {
|
|
|
1210
1058
|
List: typeof StaffMembersList;
|
|
1211
1059
|
StaffMemberRepeater: typeof StaffMemberRepeater;
|
|
1212
1060
|
};
|
|
1213
|
-
export
|
|
1061
|
+
export declare const MainMedia: React.ForwardRefExoticComponent<ServiceMediaModule.MainProps & React.RefAttributes<HTMLImageElement>>;
|
|
1062
|
+
export declare const CoverMedia: React.ForwardRefExoticComponent<ServiceMediaModule.CoverProps & React.RefAttributes<HTMLImageElement>>;
|
|
1063
|
+
export declare const MediaGallery: React.FC<ServiceMediaModule.GalleryProps>;
|
|
1064
|
+
export type { MainProps as MainMediaProps } from './ServiceMedia.js';
|
|
1065
|
+
export type { CoverProps as CoverMediaProps } from './ServiceMedia.js';
|
|
1066
|
+
export type { GalleryProps as MediaGalleryProps } from './ServiceMedia.js';
|
|
@@ -7,10 +7,9 @@ import React from 'react';
|
|
|
7
7
|
import * as CoreService from '../core/service/Service.js';
|
|
8
8
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
9
9
|
import { Money, GenericList } from '@wix/headless-components/react';
|
|
10
|
-
import { WixMediaImage } from '@wix/headless-media/react';
|
|
11
|
-
import { MediaGallery } from '@wix/headless-media/react';
|
|
12
10
|
import { RateType, } from '@wix/auto_sdk_bookings_services';
|
|
13
11
|
import * as Location from '../location/Location.js';
|
|
12
|
+
import * as ServiceMediaModule from './ServiceMedia.js';
|
|
14
13
|
var TestIds;
|
|
15
14
|
(function (TestIds) {
|
|
16
15
|
TestIds["serviceRoot"] = "service-root";
|
|
@@ -27,10 +26,6 @@ var TestIds;
|
|
|
27
26
|
TestIds["locationRoot"] = "location-root";
|
|
28
27
|
TestIds["serviceStaffMembers"] = "service-staff-members";
|
|
29
28
|
TestIds["serviceStaffMemberRepeater"] = "service-staff-member-repeater";
|
|
30
|
-
TestIds["serviceMedia"] = "service-media";
|
|
31
|
-
TestIds["serviceMainMedia"] = "service-main-media";
|
|
32
|
-
TestIds["serviceCoverMedia"] = "service-cover-media";
|
|
33
|
-
TestIds["serviceMediaItems"] = "service-media-items";
|
|
34
29
|
TestIds["serviceSchedule"] = "service-schedule";
|
|
35
30
|
TestIds["serviceDefaultCapacity"] = "service-default-capacity";
|
|
36
31
|
TestIds["serviceRaw"] = "service-raw";
|
|
@@ -538,148 +533,6 @@ export const StaffMemberRepeater = React.forwardRef((props, ref) => {
|
|
|
538
533
|
return (_jsx(GenericList.Repeater, { ref: ref, itemWrapper: staffMemberItemWrapper, asChild: asChild, children: children }));
|
|
539
534
|
});
|
|
540
535
|
StaffMemberRepeater.displayName = 'Service.StaffMembers.StaffMemberRepeater';
|
|
541
|
-
/**
|
|
542
|
-
* Displays the service main media image using WixMediaImage.
|
|
543
|
-
*
|
|
544
|
-
* @component
|
|
545
|
-
* @example
|
|
546
|
-
* ```tsx
|
|
547
|
-
* // Default usage
|
|
548
|
-
* <Service.MainMedia className="w-full h-64 object-cover rounded-lg" />
|
|
549
|
-
* ```
|
|
550
|
-
*
|
|
551
|
-
* @example
|
|
552
|
-
* ```tsx
|
|
553
|
-
* // asChild with primitive img element
|
|
554
|
-
* <Service.MainMedia asChild>
|
|
555
|
-
* <img className="w-full h-64 object-cover shadow-lg" />
|
|
556
|
-
* </Service.MainMedia>
|
|
557
|
-
* ```
|
|
558
|
-
*
|
|
559
|
-
* @example
|
|
560
|
-
* ```tsx
|
|
561
|
-
* // asChild with custom component accessing media data
|
|
562
|
-
* <Service.MainMedia asChild>
|
|
563
|
-
* {React.forwardRef(({media, ...props}, ref) => (
|
|
564
|
-
* <div ref={ref} {...props} className="relative aspect-video">
|
|
565
|
-
* <WixMediaImage media={media} className="w-full h-full object-cover" />
|
|
566
|
-
* <div className="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/50 p-4">
|
|
567
|
-
* <Service.Name className="text-primary-foreground" />
|
|
568
|
-
* </div>
|
|
569
|
-
* </div>
|
|
570
|
-
* ))}
|
|
571
|
-
* </Service.MainMedia>
|
|
572
|
-
* ```
|
|
573
|
-
*/
|
|
574
|
-
export const MainMedia = React.forwardRef((props, ref) => {
|
|
575
|
-
const { asChild, children, className } = props;
|
|
576
|
-
return (_jsx(CoreService.Info, { children: ({ mainMedia }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceMainMedia, customElement: children, customElementProps: { media: mainMedia }, children: mainMedia?.image ? _jsx(WixMediaImage, { media: mainMedia }) : null })) }));
|
|
577
|
-
});
|
|
578
|
-
MainMedia.displayName = 'Service.MainMedia';
|
|
579
|
-
/**
|
|
580
|
-
* Displays the service cover media image using WixMediaImage.
|
|
581
|
-
* The cover media is typically used as a hero/banner image.
|
|
582
|
-
*
|
|
583
|
-
* @component
|
|
584
|
-
* @example
|
|
585
|
-
* ```tsx
|
|
586
|
-
* // Default usage
|
|
587
|
-
* <Service.CoverMedia className="w-full h-96 object-cover" />
|
|
588
|
-
* ```
|
|
589
|
-
*
|
|
590
|
-
* @example
|
|
591
|
-
* ```tsx
|
|
592
|
-
* // asChild as a background image container
|
|
593
|
-
* <Service.CoverMedia asChild>
|
|
594
|
-
* <div className="w-full h-96 bg-cover bg-center" />
|
|
595
|
-
* </Service.CoverMedia>
|
|
596
|
-
* ```
|
|
597
|
-
*
|
|
598
|
-
* @example
|
|
599
|
-
* ```tsx
|
|
600
|
-
* // asChild with custom component accessing media data
|
|
601
|
-
* <Service.CoverMedia asChild>
|
|
602
|
-
* {React.forwardRef(({media, ...props}, ref) => (
|
|
603
|
-
* <header ref={ref} {...props} className="relative h-96">
|
|
604
|
-
* <WixMediaImage media={media} className="w-full h-full object-cover" />
|
|
605
|
-
* <div className="absolute inset-0 bg-black/40 flex items-center justify-center">
|
|
606
|
-
* <h1 className="text-4xl font-bold text-primary-foreground">
|
|
607
|
-
* <Service.Name />
|
|
608
|
-
* </h1>
|
|
609
|
-
* </div>
|
|
610
|
-
* </header>
|
|
611
|
-
* ))}
|
|
612
|
-
* </Service.CoverMedia>
|
|
613
|
-
* ```
|
|
614
|
-
*/
|
|
615
|
-
export const CoverMedia = React.forwardRef((props, ref) => {
|
|
616
|
-
const { asChild, children, className } = props;
|
|
617
|
-
return (_jsx(CoreService.Info, { children: ({ coverMedia }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceCoverMedia, customElement: children, customElementProps: { media: coverMedia }, children: coverMedia?.image ? _jsx(WixMediaImage, { media: coverMedia }) : null })) }));
|
|
618
|
-
});
|
|
619
|
-
CoverMedia.displayName = 'Service.CoverMedia';
|
|
620
|
-
/**
|
|
621
|
-
* Container for service media items gallery.
|
|
622
|
-
* Renders a MediaGallery.Root with the service media items.
|
|
623
|
-
* Supports autoPlay and infinite scroll options for carousel behavior.
|
|
624
|
-
*
|
|
625
|
-
* @component
|
|
626
|
-
* @example
|
|
627
|
-
* ```tsx
|
|
628
|
-
* // Basic usage with MediaGallery components
|
|
629
|
-
* <Service.MediaItems>
|
|
630
|
-
* <MediaGallery.Thumbnails>
|
|
631
|
-
* <MediaGallery.ThumbnailRepeater>
|
|
632
|
-
* {({ mediaItem, isActive }) => (
|
|
633
|
-
* <img
|
|
634
|
-
* src={mediaItem.url}
|
|
635
|
-
* alt={mediaItem.altText}
|
|
636
|
-
* className={isActive ? 'active' : ''}
|
|
637
|
-
* />
|
|
638
|
-
* )}
|
|
639
|
-
* </MediaGallery.ThumbnailRepeater>
|
|
640
|
-
* </MediaGallery.Thumbnails>
|
|
641
|
-
* </Service.MediaItems>
|
|
642
|
-
*
|
|
643
|
-
* // With autoPlay carousel
|
|
644
|
-
* <Service.MediaItems
|
|
645
|
-
* autoPlay={{ direction: 'forward', intervalMs: 3000 }}
|
|
646
|
-
* infinite
|
|
647
|
-
* >
|
|
648
|
-
* <MediaGallery.MainImage />
|
|
649
|
-
* <MediaGallery.Actions.Previous />
|
|
650
|
-
* <MediaGallery.Actions.Next />
|
|
651
|
-
* </Service.MediaItems>
|
|
652
|
-
*
|
|
653
|
-
* // Full gallery with thumbnails and navigation
|
|
654
|
-
* <Service.MediaItems infinite>
|
|
655
|
-
* <div className="gallery-container">
|
|
656
|
-
* <MediaGallery.MainImage className="main-image" />
|
|
657
|
-
* <div className="controls">
|
|
658
|
-
* <MediaGallery.Actions.Previous>Prev</MediaGallery.Actions.Previous>
|
|
659
|
-
* <MediaGallery.Actions.Next>Next</MediaGallery.Actions.Next>
|
|
660
|
-
* </div>
|
|
661
|
-
* <MediaGallery.Thumbnails className="thumbnails" />
|
|
662
|
-
* </div>
|
|
663
|
-
* </Service.MediaItems>
|
|
664
|
-
* ```
|
|
665
|
-
*/
|
|
666
|
-
export const MediaItems = React.forwardRef((props, ref) => {
|
|
667
|
-
const { children, infinite, autoPlay } = props;
|
|
668
|
-
return (_jsx(CoreService.Info, { children: ({ mediaItems }) => {
|
|
669
|
-
if (!mediaItems || mediaItems.length === 0)
|
|
670
|
-
return null;
|
|
671
|
-
const mediaGalleryServiceConfig = {
|
|
672
|
-
media: mediaItems,
|
|
673
|
-
infinite,
|
|
674
|
-
autoPlay,
|
|
675
|
-
};
|
|
676
|
-
const attributes = {
|
|
677
|
-
'data-testid': TestIds.serviceMediaItems,
|
|
678
|
-
};
|
|
679
|
-
return (_jsx("div", { ...attributes, ref: ref, children: _jsx(MediaGallery.Root, { mediaGalleryServiceConfig: mediaGalleryServiceConfig, children: children }) }));
|
|
680
|
-
} }));
|
|
681
|
-
});
|
|
682
|
-
MediaItems.displayName = 'Service.MediaItems';
|
|
683
536
|
/**
|
|
684
537
|
* Provides direct access to service object. Should be used only in rare cases.
|
|
685
538
|
*
|
|
@@ -1203,3 +1056,10 @@ export const StaffMembers = Object.assign(StaffMembersBase, {
|
|
|
1203
1056
|
List: StaffMembersList,
|
|
1204
1057
|
StaffMemberRepeater,
|
|
1205
1058
|
});
|
|
1059
|
+
// Re-export media components under Service namespace
|
|
1060
|
+
export const MainMedia = ServiceMediaModule.Main;
|
|
1061
|
+
MainMedia.displayName = 'Service.MainMedia';
|
|
1062
|
+
export const CoverMedia = ServiceMediaModule.Cover;
|
|
1063
|
+
CoverMedia.displayName = 'Service.CoverMedia';
|
|
1064
|
+
export const MediaGallery = ServiceMediaModule.Gallery;
|
|
1065
|
+
MediaGallery.displayName = 'Service.MediaGallery';
|