@wix/headless-restaurants-olo 0.0.41 → 0.0.43

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.
@@ -109,6 +109,7 @@ export interface SpecialRequestProps {
109
109
  children?: AsChildChildren<{
110
110
  value: string;
111
111
  onChange: (value: string) => void;
112
+ allowSpecialRequest: boolean;
112
113
  }>;
113
114
  /** Placeholder text for the textarea */
114
115
  placeholder?: string;
@@ -224,7 +224,14 @@ Quantity.displayName = 'Quantity';
224
224
  * ```
225
225
  */
226
226
  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) => {
227
- return (_jsx(CoreItemDetails.SpecialRequest, { children: ({ value, onChange, }) => (_jsxs(AsChildSlot, { ref: ref, asChild: asChild, className: className, onChange: onChange, "data-testid": TestIds.itemSpecialRequest, customElement: children, customElementProps: { label, value, onChange }, content: value, ...props, 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 })] })) }));
227
+ return (_jsx(CoreItemDetails.SpecialRequest, { children: ({ value, onChange, allowSpecialRequest, }) => {
228
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, onChange: onChange, "data-testid": TestIds.itemSpecialRequest, customElement: children, customElementProps: {
229
+ label,
230
+ value,
231
+ onChange,
232
+ allowSpecialRequest,
233
+ }, 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 })] })) }));
234
+ } }));
228
235
  });
229
236
  SpecialRequest.displayName = 'SpecialRequest';
230
237
  /**
@@ -14,6 +14,7 @@ interface ItemDetailsSpecialRequestProps {
14
14
  children: (props: {
15
15
  value: string;
16
16
  onChange: (value: string) => void;
17
+ allowSpecialRequest: boolean;
17
18
  }) => React.ReactNode;
18
19
  }
19
20
  export declare const SpecialRequest: React.FC<ItemDetailsSpecialRequestProps>;
@@ -11,6 +11,7 @@ export const Root = ({ children, itemDetailsServiceConfig, }) => {
11
11
  };
12
12
  export const SpecialRequest = ({ children, }) => {
13
13
  const service = useService(ItemServiceDefinition);
14
+ const allowSpecialRequest = service.allowSpecialRequest;
14
15
  const initialSpecialRequest = service.specialRequest?.get?.() ?? '';
15
16
  const [value, setValue] = useState(initialSpecialRequest);
16
17
  const onChange = (newValue) => {
@@ -22,6 +23,7 @@ export const SpecialRequest = ({ children, }) => {
22
23
  return children({
23
24
  value,
24
25
  onChange,
26
+ allowSpecialRequest,
25
27
  // placeholder: 'Any special requests or dietary restrictions?',
26
28
  // maxLength: 200
27
29
  });
@@ -15,6 +15,7 @@ export interface ItemServiceAPI {
15
15
  item?: Signal<EnhancedItem | undefined>;
16
16
  quantity: Signal<number>;
17
17
  specialRequest: Signal<string>;
18
+ allowSpecialRequest: boolean;
18
19
  lineItem: ReadOnlySignal<LineItem>;
19
20
  onHandleAddToCart: (onClick: (lineItem: LineItem) => void) => void;
20
21
  buttonState: ReadOnlySignal<AddToCartButtonState | undefined>;
@@ -67,6 +68,7 @@ export interface ItemServiceConfig {
67
68
  item?: EnhancedItem;
68
69
  operationId?: string;
69
70
  availabilityStatus?: AvailabilityStatus;
71
+ allowSpecialRequest?: boolean;
70
72
  editItemMode?: boolean;
71
73
  editingItemValues?: {
72
74
  quantity?: number;
@@ -50,6 +50,7 @@ export const ItemService = implementService.withConfig()(ItemServiceDefinition,
50
50
  endDate: undefined,
51
51
  weeklyAvailabilitySummary: undefined,
52
52
  };
53
+ const allowSpecialRequest = config.allowSpecialRequest ?? true;
53
54
  const signalsService = getService(SignalsServiceDefinition);
54
55
  const oloSettingsService = getService(OLOSettingsServiceDefinition);
55
56
  const availabilityStatus = signalsService.signal(config.availabilityStatus ?? AvailabilityStatus.AVAILABLE);
@@ -131,7 +132,7 @@ export const ItemService = implementService.withConfig()(ItemServiceDefinition,
131
132
  sectionId: config.sectionId ?? config.item?.sectionId,
132
133
  priceVariant: getPriceVariantOptions(selectedVariant.get(), formatCurrency),
133
134
  modifierGroups: getLineItemModifiers(selectedModifiers.get(), modifierGroups, formatCurrency),
134
- specialRequests: specialRequest.get(),
135
+ specialRequests: specialRequest?.get() || undefined,
135
136
  },
136
137
  },
137
138
  };
@@ -215,6 +216,7 @@ export const ItemService = implementService.withConfig()(ItemServiceDefinition,
215
216
  addToCartButtonDisabled,
216
217
  price,
217
218
  futureAvailability,
219
+ allowSpecialRequest,
218
220
  };
219
221
  });
220
222
  /**
@@ -109,6 +109,7 @@ export interface SpecialRequestProps {
109
109
  children?: AsChildChildren<{
110
110
  value: string;
111
111
  onChange: (value: string) => void;
112
+ allowSpecialRequest: boolean;
112
113
  }>;
113
114
  /** Placeholder text for the textarea */
114
115
  placeholder?: string;
@@ -224,7 +224,14 @@ Quantity.displayName = 'Quantity';
224
224
  * ```
225
225
  */
226
226
  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) => {
227
- return (_jsx(CoreItemDetails.SpecialRequest, { children: ({ value, onChange, }) => (_jsxs(AsChildSlot, { ref: ref, asChild: asChild, className: className, onChange: onChange, "data-testid": TestIds.itemSpecialRequest, customElement: children, customElementProps: { label, value, onChange }, content: value, ...props, 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 })] })) }));
227
+ return (_jsx(CoreItemDetails.SpecialRequest, { children: ({ value, onChange, allowSpecialRequest, }) => {
228
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, onChange: onChange, "data-testid": TestIds.itemSpecialRequest, customElement: children, customElementProps: {
229
+ label,
230
+ value,
231
+ onChange,
232
+ allowSpecialRequest,
233
+ }, 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 })] })) }));
234
+ } }));
228
235
  });
229
236
  SpecialRequest.displayName = 'SpecialRequest';
230
237
  /**
@@ -14,6 +14,7 @@ interface ItemDetailsSpecialRequestProps {
14
14
  children: (props: {
15
15
  value: string;
16
16
  onChange: (value: string) => void;
17
+ allowSpecialRequest: boolean;
17
18
  }) => React.ReactNode;
18
19
  }
19
20
  export declare const SpecialRequest: React.FC<ItemDetailsSpecialRequestProps>;
@@ -11,6 +11,7 @@ export const Root = ({ children, itemDetailsServiceConfig, }) => {
11
11
  };
12
12
  export const SpecialRequest = ({ children, }) => {
13
13
  const service = useService(ItemServiceDefinition);
14
+ const allowSpecialRequest = service.allowSpecialRequest;
14
15
  const initialSpecialRequest = service.specialRequest?.get?.() ?? '';
15
16
  const [value, setValue] = useState(initialSpecialRequest);
16
17
  const onChange = (newValue) => {
@@ -22,6 +23,7 @@ export const SpecialRequest = ({ children, }) => {
22
23
  return children({
23
24
  value,
24
25
  onChange,
26
+ allowSpecialRequest,
25
27
  // placeholder: 'Any special requests or dietary restrictions?',
26
28
  // maxLength: 200
27
29
  });
@@ -15,6 +15,7 @@ export interface ItemServiceAPI {
15
15
  item?: Signal<EnhancedItem | undefined>;
16
16
  quantity: Signal<number>;
17
17
  specialRequest: Signal<string>;
18
+ allowSpecialRequest: boolean;
18
19
  lineItem: ReadOnlySignal<LineItem>;
19
20
  onHandleAddToCart: (onClick: (lineItem: LineItem) => void) => void;
20
21
  buttonState: ReadOnlySignal<AddToCartButtonState | undefined>;
@@ -67,6 +68,7 @@ export interface ItemServiceConfig {
67
68
  item?: EnhancedItem;
68
69
  operationId?: string;
69
70
  availabilityStatus?: AvailabilityStatus;
71
+ allowSpecialRequest?: boolean;
70
72
  editItemMode?: boolean;
71
73
  editingItemValues?: {
72
74
  quantity?: number;
@@ -50,6 +50,7 @@ export const ItemService = implementService.withConfig()(ItemServiceDefinition,
50
50
  endDate: undefined,
51
51
  weeklyAvailabilitySummary: undefined,
52
52
  };
53
+ const allowSpecialRequest = config.allowSpecialRequest ?? true;
53
54
  const signalsService = getService(SignalsServiceDefinition);
54
55
  const oloSettingsService = getService(OLOSettingsServiceDefinition);
55
56
  const availabilityStatus = signalsService.signal(config.availabilityStatus ?? AvailabilityStatus.AVAILABLE);
@@ -131,7 +132,7 @@ export const ItemService = implementService.withConfig()(ItemServiceDefinition,
131
132
  sectionId: config.sectionId ?? config.item?.sectionId,
132
133
  priceVariant: getPriceVariantOptions(selectedVariant.get(), formatCurrency),
133
134
  modifierGroups: getLineItemModifiers(selectedModifiers.get(), modifierGroups, formatCurrency),
134
- specialRequests: specialRequest.get(),
135
+ specialRequests: specialRequest?.get() || undefined,
135
136
  },
136
137
  },
137
138
  };
@@ -215,6 +216,7 @@ export const ItemService = implementService.withConfig()(ItemServiceDefinition,
215
216
  addToCartButtonDisabled,
216
217
  price,
217
218
  futureAvailability,
219
+ allowSpecialRequest,
218
220
  };
219
221
  });
220
222
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/headless-restaurants-olo",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -56,7 +56,7 @@
56
56
  "@radix-ui/react-slot": "^1.1.0",
57
57
  "@wix/atlas": "^1.0.33",
58
58
  "@wix/auto_sdk_restaurants_items": "^1.0.48",
59
- "@wix/ecom": "^1.0.1461",
59
+ "@wix/ecom": "^1.0.1560",
60
60
  "@wix/essentials": "^1.0.0",
61
61
  "@wix/headless-components": "0.0.35",
62
62
  "@wix/headless-media": "0.0.18",
@@ -78,5 +78,5 @@
78
78
  "groupId": "com.wixpress.headless-components"
79
79
  }
80
80
  },
81
- "falconPackageHash": "6f66175564e00a76ca5069b76e7d754e5c75d03c6dc4be5408c6ca4e"
81
+ "falconPackageHash": "25e56de1c5e1be8c65b00bd03ae07fb32f297114f752d75297741b66"
82
82
  }