@wix/headless-restaurants-olo 0.0.61 → 0.0.62
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/ItemDetails.d.ts +7 -0
- package/cjs/dist/react/ItemDetails.js +2 -1
- package/cjs/dist/react/core/ItemDetails.d.ts +1 -0
- package/cjs/dist/react/core/ItemDetails.js +2 -0
- package/cjs/dist/services/item-details-service.d.ts +2 -0
- package/cjs/dist/services/item-details-service.js +2 -0
- package/dist/react/ItemDetails.d.ts +7 -0
- package/dist/react/ItemDetails.js +2 -1
- package/dist/react/core/ItemDetails.d.ts +1 -0
- package/dist/react/core/ItemDetails.js +2 -0
- package/dist/services/item-details-service.d.ts +2 -0
- package/dist/services/item-details-service.js +2 -0
- package/package.json +2 -2
|
@@ -116,6 +116,13 @@ export interface SpecialRequestProps {
|
|
|
116
116
|
value: string;
|
|
117
117
|
onChange: (value: string) => void;
|
|
118
118
|
allowSpecialRequest: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Owner-configured placeholder text for the special-request textarea.
|
|
121
|
+
* `undefined` → consumers should use their default placeholder.
|
|
122
|
+
* `""` → consumers should render NO placeholder.
|
|
123
|
+
* `"..."` → consumers should use the string as-is.
|
|
124
|
+
*/
|
|
125
|
+
specialRequestInstructions?: string;
|
|
119
126
|
}>;
|
|
120
127
|
/** Placeholder text for the textarea */
|
|
121
128
|
placeholder?: string;
|
|
@@ -266,12 +266,13 @@ exports.Quantity.displayName = 'Quantity';
|
|
|
266
266
|
* ```
|
|
267
267
|
*/
|
|
268
268
|
exports.SpecialRequest = react_1.default.forwardRef(({ className, labelClassName, placeholder = 'Any special requests or dietary restrictions?', maxLength = 200, rows = 3, label = 'Special Requests', asChild, children, ...props }, ref) => {
|
|
269
|
-
return ((0, jsx_runtime_1.jsx)(CoreItemDetails.SpecialRequest, { children: ({ value, onChange, allowSpecialRequest, }) => {
|
|
269
|
+
return ((0, jsx_runtime_1.jsx)(CoreItemDetails.SpecialRequest, { children: ({ value, onChange, allowSpecialRequest, specialRequestInstructions, }) => {
|
|
270
270
|
return ((0, jsx_runtime_1.jsx)(react_2.AsChildSlot, { ref: ref, asChild: asChild, className: className, onChange: onChange, "data-testid": TestIds.itemSpecialRequest, customElement: children, customElementProps: {
|
|
271
271
|
label,
|
|
272
272
|
value,
|
|
273
273
|
onChange,
|
|
274
274
|
allowSpecialRequest,
|
|
275
|
+
specialRequestInstructions,
|
|
275
276
|
}, content: value, ...props, children: allowSpecialRequest && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [label && (0, jsx_runtime_1.jsx)("label", { className: labelClassName, children: label }), (0, jsx_runtime_1.jsx)("textarea", { value: value, onChange: (e) => onChange(e.target.value), placeholder: placeholder, maxLength: maxLength, rows: rows, className: className, children: value })] })) }));
|
|
276
277
|
} }));
|
|
277
278
|
});
|
|
@@ -15,6 +15,7 @@ interface ItemDetailsSpecialRequestProps {
|
|
|
15
15
|
value: string;
|
|
16
16
|
onChange: (value: string) => void;
|
|
17
17
|
allowSpecialRequest: boolean;
|
|
18
|
+
specialRequestInstructions?: string;
|
|
18
19
|
}) => React.ReactNode;
|
|
19
20
|
}
|
|
20
21
|
export declare const SpecialRequest: React.FC<ItemDetailsSpecialRequestProps>;
|
|
@@ -16,6 +16,7 @@ exports.Root = Root;
|
|
|
16
16
|
const SpecialRequest = ({ children, }) => {
|
|
17
17
|
const service = (0, services_manager_react_1.useService)(item_details_service_js_1.ItemServiceDefinition);
|
|
18
18
|
const allowSpecialRequest = service.allowSpecialRequest;
|
|
19
|
+
const specialRequestInstructions = service.specialRequestInstructions;
|
|
19
20
|
const initialSpecialRequest = service.specialRequest?.get?.() ?? '';
|
|
20
21
|
const [value, setValue] = (0, react_1.useState)(initialSpecialRequest);
|
|
21
22
|
const onChange = (newValue) => {
|
|
@@ -28,6 +29,7 @@ const SpecialRequest = ({ children, }) => {
|
|
|
28
29
|
value,
|
|
29
30
|
onChange,
|
|
30
31
|
allowSpecialRequest,
|
|
32
|
+
specialRequestInstructions,
|
|
31
33
|
// placeholder: 'Any special requests or dietary restrictions?',
|
|
32
34
|
// maxLength: 200
|
|
33
35
|
});
|
|
@@ -16,6 +16,7 @@ export interface ItemServiceAPI {
|
|
|
16
16
|
quantity: Signal<number>;
|
|
17
17
|
specialRequest: Signal<string>;
|
|
18
18
|
allowSpecialRequest: boolean;
|
|
19
|
+
specialRequestInstructions?: string;
|
|
19
20
|
lineItem: ReadOnlySignal<LineItem>;
|
|
20
21
|
onHandleAddToCart: (onClick: (lineItem: LineItem) => void) => void;
|
|
21
22
|
buttonState: ReadOnlySignal<AddToCartButtonState | undefined>;
|
|
@@ -69,6 +70,7 @@ export interface ItemServiceConfig {
|
|
|
69
70
|
operationId?: string;
|
|
70
71
|
availabilityStatus?: AvailabilityStatus;
|
|
71
72
|
allowSpecialRequest?: boolean;
|
|
73
|
+
specialRequestInstructions?: string;
|
|
72
74
|
editItemMode?: boolean;
|
|
73
75
|
editingItemValues?: {
|
|
74
76
|
quantity?: number;
|
|
@@ -55,6 +55,7 @@ exports.ItemService = services_definitions_1.implementService.withConfig()(expor
|
|
|
55
55
|
weeklyAvailabilitySummary: undefined,
|
|
56
56
|
};
|
|
57
57
|
const allowSpecialRequest = config.allowSpecialRequest ?? true;
|
|
58
|
+
const specialRequestInstructions = config.specialRequestInstructions;
|
|
58
59
|
const signalsService = getService(signals_1.SignalsServiceDefinition);
|
|
59
60
|
const oloSettingsService = getService(olo_settings_service_js_1.OLOSettingsServiceDefinition);
|
|
60
61
|
const availabilityStatus = signalsService.signal(config.availabilityStatus ?? common_types_js_1.AvailabilityStatus.AVAILABLE);
|
|
@@ -221,6 +222,7 @@ exports.ItemService = services_definitions_1.implementService.withConfig()(expor
|
|
|
221
222
|
price,
|
|
222
223
|
futureAvailability,
|
|
223
224
|
allowSpecialRequest,
|
|
225
|
+
specialRequestInstructions,
|
|
224
226
|
};
|
|
225
227
|
});
|
|
226
228
|
/**
|
|
@@ -116,6 +116,13 @@ export interface SpecialRequestProps {
|
|
|
116
116
|
value: string;
|
|
117
117
|
onChange: (value: string) => void;
|
|
118
118
|
allowSpecialRequest: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Owner-configured placeholder text for the special-request textarea.
|
|
121
|
+
* `undefined` → consumers should use their default placeholder.
|
|
122
|
+
* `""` → consumers should render NO placeholder.
|
|
123
|
+
* `"..."` → consumers should use the string as-is.
|
|
124
|
+
*/
|
|
125
|
+
specialRequestInstructions?: string;
|
|
119
126
|
}>;
|
|
120
127
|
/** Placeholder text for the textarea */
|
|
121
128
|
placeholder?: string;
|
|
@@ -225,12 +225,13 @@ Quantity.displayName = 'Quantity';
|
|
|
225
225
|
* ```
|
|
226
226
|
*/
|
|
227
227
|
export const SpecialRequest = React.forwardRef(({ className, labelClassName, placeholder = 'Any special requests or dietary restrictions?', maxLength = 200, rows = 3, label = 'Special Requests', asChild, children, ...props }, ref) => {
|
|
228
|
-
return (_jsx(CoreItemDetails.SpecialRequest, { children: ({ value, onChange, allowSpecialRequest, }) => {
|
|
228
|
+
return (_jsx(CoreItemDetails.SpecialRequest, { children: ({ value, onChange, allowSpecialRequest, specialRequestInstructions, }) => {
|
|
229
229
|
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, onChange: onChange, "data-testid": TestIds.itemSpecialRequest, customElement: children, customElementProps: {
|
|
230
230
|
label,
|
|
231
231
|
value,
|
|
232
232
|
onChange,
|
|
233
233
|
allowSpecialRequest,
|
|
234
|
+
specialRequestInstructions,
|
|
234
235
|
}, content: value, ...props, children: allowSpecialRequest && (_jsxs(_Fragment, { children: [label && _jsx("label", { className: labelClassName, children: label }), _jsx("textarea", { value: value, onChange: (e) => onChange(e.target.value), placeholder: placeholder, maxLength: maxLength, rows: rows, className: className, children: value })] })) }));
|
|
235
236
|
} }));
|
|
236
237
|
});
|
|
@@ -15,6 +15,7 @@ interface ItemDetailsSpecialRequestProps {
|
|
|
15
15
|
value: string;
|
|
16
16
|
onChange: (value: string) => void;
|
|
17
17
|
allowSpecialRequest: boolean;
|
|
18
|
+
specialRequestInstructions?: string;
|
|
18
19
|
}) => React.ReactNode;
|
|
19
20
|
}
|
|
20
21
|
export declare const SpecialRequest: React.FC<ItemDetailsSpecialRequestProps>;
|
|
@@ -12,6 +12,7 @@ export const Root = ({ children, itemDetailsServiceConfig, }) => {
|
|
|
12
12
|
export const SpecialRequest = ({ children, }) => {
|
|
13
13
|
const service = useService(ItemServiceDefinition);
|
|
14
14
|
const allowSpecialRequest = service.allowSpecialRequest;
|
|
15
|
+
const specialRequestInstructions = service.specialRequestInstructions;
|
|
15
16
|
const initialSpecialRequest = service.specialRequest?.get?.() ?? '';
|
|
16
17
|
const [value, setValue] = useState(initialSpecialRequest);
|
|
17
18
|
const onChange = (newValue) => {
|
|
@@ -24,6 +25,7 @@ export const SpecialRequest = ({ children, }) => {
|
|
|
24
25
|
value,
|
|
25
26
|
onChange,
|
|
26
27
|
allowSpecialRequest,
|
|
28
|
+
specialRequestInstructions,
|
|
27
29
|
// placeholder: 'Any special requests or dietary restrictions?',
|
|
28
30
|
// maxLength: 200
|
|
29
31
|
});
|
|
@@ -16,6 +16,7 @@ export interface ItemServiceAPI {
|
|
|
16
16
|
quantity: Signal<number>;
|
|
17
17
|
specialRequest: Signal<string>;
|
|
18
18
|
allowSpecialRequest: boolean;
|
|
19
|
+
specialRequestInstructions?: string;
|
|
19
20
|
lineItem: ReadOnlySignal<LineItem>;
|
|
20
21
|
onHandleAddToCart: (onClick: (lineItem: LineItem) => void) => void;
|
|
21
22
|
buttonState: ReadOnlySignal<AddToCartButtonState | undefined>;
|
|
@@ -69,6 +70,7 @@ export interface ItemServiceConfig {
|
|
|
69
70
|
operationId?: string;
|
|
70
71
|
availabilityStatus?: AvailabilityStatus;
|
|
71
72
|
allowSpecialRequest?: boolean;
|
|
73
|
+
specialRequestInstructions?: string;
|
|
72
74
|
editItemMode?: boolean;
|
|
73
75
|
editingItemValues?: {
|
|
74
76
|
quantity?: number;
|
|
@@ -51,6 +51,7 @@ export const ItemService = implementService.withConfig()(ItemServiceDefinition,
|
|
|
51
51
|
weeklyAvailabilitySummary: undefined,
|
|
52
52
|
};
|
|
53
53
|
const allowSpecialRequest = config.allowSpecialRequest ?? true;
|
|
54
|
+
const specialRequestInstructions = config.specialRequestInstructions;
|
|
54
55
|
const signalsService = getService(SignalsServiceDefinition);
|
|
55
56
|
const oloSettingsService = getService(OLOSettingsServiceDefinition);
|
|
56
57
|
const availabilityStatus = signalsService.signal(config.availabilityStatus ?? AvailabilityStatus.AVAILABLE);
|
|
@@ -217,6 +218,7 @@ export const ItemService = implementService.withConfig()(ItemServiceDefinition,
|
|
|
217
218
|
price,
|
|
218
219
|
futureAvailability,
|
|
219
220
|
allowSpecialRequest,
|
|
221
|
+
specialRequestInstructions,
|
|
220
222
|
};
|
|
221
223
|
});
|
|
222
224
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-restaurants-olo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.62",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"groupId": "com.wixpress.headless-components"
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
|
-
"falconPackageHash": "
|
|
84
|
+
"falconPackageHash": "805d8c5ecc7ef21b65074cd1880f383b6ded0ac85c3c8752fad83840"
|
|
85
85
|
}
|