@wix/headless-restaurants-olo 0.0.33 → 0.0.35

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.
Files changed (59) hide show
  1. package/cjs/dist/react/FulfillmentDetails.d.ts +139 -15
  2. package/cjs/dist/react/FulfillmentDetails.js +128 -24
  3. package/cjs/dist/react/ItemDetails.d.ts +4 -4
  4. package/cjs/dist/react/ItemDetails.js +5 -6
  5. package/cjs/dist/react/Settings.d.ts +8 -0
  6. package/cjs/dist/react/Settings.js +18 -25
  7. package/cjs/dist/react/core/FulfillmentDetails.d.ts +73 -7
  8. package/cjs/dist/react/core/FulfillmentDetails.js +133 -86
  9. package/cjs/dist/react/core/ItemDetails.d.ts +1 -1
  10. package/cjs/dist/react/core/ItemDetails.js +5 -16
  11. package/cjs/dist/react/core/Settings.d.ts +19 -4
  12. package/cjs/dist/react/core/Settings.js +29 -20
  13. package/cjs/dist/services/fulfillment-details-service.d.ts +127 -0
  14. package/cjs/dist/services/fulfillment-details-service.js +351 -0
  15. package/cjs/dist/services/fulfillments-service.js +67 -43
  16. package/cjs/dist/services/index.d.ts +2 -0
  17. package/cjs/dist/services/index.js +1 -0
  18. package/cjs/dist/services/item-details-service.d.ts +1 -1
  19. package/cjs/dist/services/item-details-service.js +10 -16
  20. package/cjs/dist/services/olo-settings-service.d.ts +0 -1
  21. package/cjs/dist/services/olo-settings-service.js +1 -3
  22. package/cjs/dist/services/utils.d.ts +4 -0
  23. package/cjs/dist/services/utils.js +12 -0
  24. package/cjs/dist/types/fulfillments-types.d.ts +18 -1
  25. package/cjs/dist/types/fulfillments-types.js +9 -0
  26. package/cjs/dist/utils/date-utils.d.ts +164 -0
  27. package/cjs/dist/utils/date-utils.js +297 -0
  28. package/cjs/dist/utils/fulfillments-utils.d.ts +3 -2
  29. package/cjs/dist/utils/fulfillments-utils.js +13 -57
  30. package/dist/react/FulfillmentDetails.d.ts +139 -15
  31. package/dist/react/FulfillmentDetails.js +128 -24
  32. package/dist/react/ItemDetails.d.ts +4 -4
  33. package/dist/react/ItemDetails.js +5 -6
  34. package/dist/react/Settings.d.ts +8 -0
  35. package/dist/react/Settings.js +18 -25
  36. package/dist/react/core/FulfillmentDetails.d.ts +73 -7
  37. package/dist/react/core/FulfillmentDetails.js +133 -86
  38. package/dist/react/core/ItemDetails.d.ts +1 -1
  39. package/dist/react/core/ItemDetails.js +5 -16
  40. package/dist/react/core/Settings.d.ts +19 -4
  41. package/dist/react/core/Settings.js +29 -20
  42. package/dist/services/fulfillment-details-service.d.ts +127 -0
  43. package/dist/services/fulfillment-details-service.js +351 -0
  44. package/dist/services/fulfillments-service.js +67 -43
  45. package/dist/services/index.d.ts +2 -0
  46. package/dist/services/index.js +1 -0
  47. package/dist/services/item-details-service.d.ts +1 -1
  48. package/dist/services/item-details-service.js +10 -16
  49. package/dist/services/olo-settings-service.d.ts +0 -1
  50. package/dist/services/olo-settings-service.js +1 -3
  51. package/dist/services/utils.d.ts +4 -0
  52. package/dist/services/utils.js +12 -0
  53. package/dist/types/fulfillments-types.d.ts +18 -1
  54. package/dist/types/fulfillments-types.js +9 -0
  55. package/dist/utils/date-utils.d.ts +164 -0
  56. package/dist/utils/date-utils.js +297 -0
  57. package/dist/utils/fulfillments-utils.d.ts +3 -2
  58. package/dist/utils/fulfillments-utils.js +13 -57
  59. package/package.json +3 -2
@@ -0,0 +1,297 @@
1
+ import { EntitiesDayOfWeek as DayOfWeek, } from '@wix/auto_sdk_restaurants_fulfillment-methods';
2
+ import { i18n, settings } from '@wix/essentials';
3
+ // Re-export types for convenience
4
+ export { DayOfWeek };
5
+ const dateConfig = {
6
+ timezone: settings.getTimezone(),
7
+ locale: i18n.getLocale(),
8
+ };
9
+ /**
10
+ * Get the current locale
11
+ * Uses the configured locale, falls back to i18n.getLocale()
12
+ *
13
+ * @returns The current locale string
14
+ */
15
+ export const getLocale = () => {
16
+ return dateConfig.locale;
17
+ };
18
+ /**
19
+ * Get the current timezone
20
+ * Uses the configured timezone, falls back to undefined (browser default)
21
+ *
22
+ * @returns The current timezone string or undefined
23
+ */
24
+ export const getTimezone = () => {
25
+ return dateConfig.timezone;
26
+ };
27
+ /**
28
+ * Mapping of day of week enum to numeric value (1-7, Monday-Sunday)
29
+ */
30
+ export const DAY_OF_WEEK = {
31
+ [DayOfWeek.MON]: 1,
32
+ [DayOfWeek.TUE]: 2,
33
+ [DayOfWeek.WED]: 3,
34
+ [DayOfWeek.THU]: 4,
35
+ [DayOfWeek.FRI]: 5,
36
+ [DayOfWeek.SAT]: 6,
37
+ [DayOfWeek.SUN]: 7,
38
+ };
39
+ /**
40
+ * Extract date/time parts from a Date in a specific timezone
41
+ * @param date - The source Date object
42
+ * @param timezone - The target timezone (e.g., 'America/New_York'). Defaults to configured timezone.
43
+ * @param locale - The locale for formatting (e.g., 'en-US'). Defaults to configured locale.
44
+ * @param includeTime - Whether to include time parts (hour, minute, second)
45
+ * @returns Object containing the extracted date/time parts
46
+ */
47
+ export const getDatePartsInTimezone = (date, timezone, locale, includeTime = false) => {
48
+ const tz = timezone ?? getTimezone();
49
+ const loc = locale ?? getLocale();
50
+ const options = {
51
+ timeZone: tz,
52
+ year: 'numeric',
53
+ month: '2-digit',
54
+ day: '2-digit',
55
+ ...(includeTime && {
56
+ hour: '2-digit',
57
+ minute: '2-digit',
58
+ second: '2-digit',
59
+ hour12: false,
60
+ }),
61
+ };
62
+ const parts = new Intl.DateTimeFormat(loc, options).formatToParts(date);
63
+ return {
64
+ year: parts.find((p) => p.type === 'year')?.value ?? '1970',
65
+ month: parts.find((p) => p.type === 'month')?.value ?? '01',
66
+ day: parts.find((p) => p.type === 'day')?.value ?? '01',
67
+ ...(includeTime && {
68
+ hour: parts.find((p) => p.type === 'hour')?.value ?? '00',
69
+ minute: parts.find((p) => p.type === 'minute')?.value ?? '00',
70
+ second: parts.find((p) => p.type === 'second')?.value ?? '00',
71
+ }),
72
+ };
73
+ };
74
+ /**
75
+ * Build a Date from date/time parts
76
+ * @param year - Year string
77
+ * @param month - Month string (2-digit)
78
+ * @param day - Day string (2-digit)
79
+ * @param hour - Hour string (2-digit, optional)
80
+ * @param minute - Minute string (2-digit, optional)
81
+ * @param second - Second string (2-digit, optional)
82
+ * @returns A new Date object
83
+ */
84
+ export const buildDateFromParts = (year, month, day, hour = '00', minute = '00', second = '00') => {
85
+ const isoString = `${year}-${month}-${day}T${hour}:${minute}:${second}.000`;
86
+ return new Date(isoString);
87
+ };
88
+ /**
89
+ * Convert a TimeOfDay object to a Date object
90
+ * Creates a Date for today with the specified time in the target timezone.
91
+ * Equivalent to: DateTime.fromObject({ hour, minute }).setZone(timezone, { keepLocalTime: true })
92
+ *
93
+ * @param time - TimeOfDay object with hours and minutes
94
+ * @param timezone - The target timezone (e.g., 'America/New_York'). Defaults to configured timezone.
95
+ * @returns A Date object representing the time in the specified timezone
96
+ */
97
+ export const convertTimeOfDayToDateTime = (time, timezone) => {
98
+ console.log('timezone', timezone);
99
+ // const tz = timezone ?? getTimezone();
100
+ // Create today's date with the specified time in local timezone
101
+ // This mimics DateTime.fromObject({ hour, minute }) which uses local timezone
102
+ const localDate = new Date();
103
+ localDate.setHours(time.hours ?? 0, time.minutes ?? 0, 0, 0);
104
+ // If no timezone specified, return local time (no zone conversion)
105
+ // if (!tz) {
106
+ return localDate;
107
+ // }
108
+ // Apply setZone(timezone, { keepLocalTime: true })
109
+ // This keeps the wall clock time (e.g., "10:30") but changes the timezone
110
+ // We need to find the UTC time that, when displayed in the target timezone, shows the same wall clock time
111
+ // Get what localDate looks like in the target timezone
112
+ // const parts = getDatePartsInTimezone(localDate, tz, undefined, true);
113
+ // const inTargetTz = buildDateFromParts(
114
+ // parts.year,
115
+ // parts.month,
116
+ // parts.day,
117
+ // parts.hour!,
118
+ // parts.minute!,
119
+ // parts.second!,
120
+ // );
121
+ // The offset between localDate and its representation in target timezone
122
+ // Adding this offset gives us a Date that shows the same wall clock time in target timezone
123
+ // const offsetMs = localDate.getTime() - inTargetTz.getTime();
124
+ // return new Date(localDate.getTime() + offsetMs);
125
+ };
126
+ /**
127
+ * Convert a Date to a Date adjusted for a specific timezone
128
+ * This is useful when you need to display or compare dates in a specific timezone
129
+ *
130
+ * @param date - The source Date object
131
+ * @param timezone - The target timezone (e.g., 'America/New_York'). Defaults to configured timezone.
132
+ * @param locale - The locale for formatting (e.g., 'en-US'). Defaults to configured locale.
133
+ * @returns A new Date object adjusted to represent the same moment in the target timezone
134
+ */
135
+ export const convertDateToTimezone = (date, timezone, locale) => {
136
+ const tz = timezone ?? getTimezone();
137
+ const loc = locale ?? getLocale();
138
+ if (!tz) {
139
+ return new Date(date);
140
+ }
141
+ const { year, month, day, hour, minute, second } = getDatePartsInTimezone(date, tz, loc, true);
142
+ return buildDateFromParts(year, month, day, hour, minute, second);
143
+ };
144
+ /**
145
+ * Format a Date as a localized string for a specific timezone and locale
146
+ *
147
+ * @param date - The source Date object
148
+ * @param timezone - The target timezone (e.g., 'America/New_York'). Defaults to configured timezone.
149
+ * @param locale - The locale for formatting (e.g., 'en-US'). Defaults to configured locale.
150
+ * @param options - Additional Intl.DateTimeFormatOptions
151
+ * @returns A formatted date string
152
+ */
153
+ export const formatDateInTimezone = (date, timezone, locale, options) => {
154
+ const tz = timezone ?? getTimezone();
155
+ const loc = locale ?? getLocale();
156
+ const formatOptions = {
157
+ ...options,
158
+ timeZone: tz,
159
+ };
160
+ return date.toLocaleString(loc, formatOptions);
161
+ };
162
+ /**
163
+ * Check if a time falls within a time range
164
+ *
165
+ * @param time - The time to check
166
+ * @param range - The time range to check against
167
+ * @param timeZone - The timezone for conversion. Defaults to configured timezone.
168
+ * @param locale - The locale for formatting. Defaults to configured locale.
169
+ * @returns True if the time is within the range
170
+ */
171
+ export const isInTimeRange = (time, range, timeZone) => {
172
+ const tz = timeZone ?? getTimezone();
173
+ const startTime = range.startTime
174
+ ? convertTimeOfDayToDateTime(range.startTime, tz)
175
+ : time;
176
+ const endTime = range.endTime
177
+ ? convertTimeOfDayToDateTime(range.endTime, tz)
178
+ : time;
179
+ return (time.getTime() >= startTime.getTime() && time.getTime() <= endTime.getTime());
180
+ };
181
+ /**
182
+ * Get the current day of week as a number (1-7, Monday-Sunday)
183
+ * JavaScript's getDay() returns 0 (Sunday) to 6 (Saturday),
184
+ * this function converts to 1 (Monday) to 7 (Sunday)
185
+ *
186
+ * @param date - The date to get the day of week from
187
+ * @returns The day of week as a number (1-7)
188
+ */
189
+ export const getDayOfWeekNumber = (date) => {
190
+ const jsDay = date.getDay();
191
+ return jsDay === 0 ? 7 : jsDay;
192
+ };
193
+ /**
194
+ * Format a date as time only (e.g., "10:30 AM")
195
+ * Uses configured locale and timezone
196
+ *
197
+ * @param date - The date to format
198
+ * @param options - Additional Intl.DateTimeFormatOptions (defaults to hour:numeric, minute:numeric)
199
+ * @returns A formatted time string, or empty string if date is undefined
200
+ */
201
+ export const formatTime = (date, options) => {
202
+ if (!date)
203
+ return '';
204
+ const tz = getTimezone();
205
+ const loc = getLocale();
206
+ const formatOptions = {
207
+ hour: 'numeric',
208
+ minute: 'numeric',
209
+ ...options,
210
+ timeZone: tz,
211
+ };
212
+ return date.toLocaleString(loc, formatOptions);
213
+ };
214
+ /**
215
+ * Format a time range as a localized string
216
+ * If start and end times are the same, returns just the time
217
+ * Otherwise returns "start - end" format
218
+ *
219
+ * @param startTime - The start time
220
+ * @param endTime - The end time
221
+ * @param options - Additional Intl.DateTimeFormatOptions (defaults to hour:numeric, minute:numeric, hour12:true)
222
+ * @returns A formatted time range string
223
+ */
224
+ export const formatTimeRange = (startTime, endTime, options) => {
225
+ const tz = getTimezone();
226
+ const loc = getLocale();
227
+ const formatOptions = {
228
+ hour: 'numeric',
229
+ minute: 'numeric',
230
+ hour12: true,
231
+ ...options,
232
+ timeZone: tz,
233
+ };
234
+ const start = startTime.toLocaleString(loc, formatOptions);
235
+ const end = endTime.toLocaleString(loc, formatOptions);
236
+ return start === end ? start : `${start} - ${end}`;
237
+ };
238
+ /**
239
+ * Check if two dates are on the same calendar day
240
+ * Compares year, month, and day components
241
+ *
242
+ * @param date1 - The first date to compare
243
+ * @param date2 - The second date to compare
244
+ * @returns True if both dates are on the same calendar day
245
+ */
246
+ export const isSameDay = (date1, date2) => {
247
+ return (date1.getFullYear() === date2.getFullYear() &&
248
+ date1.getMonth() === date2.getMonth() &&
249
+ date1.getDate() === date2.getDate());
250
+ };
251
+ /**
252
+ * Get today's date with time set to midnight (00:00:00.000)
253
+ *
254
+ * @returns A Date object representing the start of today
255
+ */
256
+ export const getToday = () => {
257
+ const today = new Date();
258
+ today.setHours(0, 0, 0, 0);
259
+ return today;
260
+ };
261
+ /**
262
+ * Get a future date with time set to 23:59:59.999
263
+ *
264
+ * @param days - The number of days to add to the current date
265
+ * @returns A Date object representing the end of the future date
266
+ */
267
+ export const getFutureDate = (days) => {
268
+ const future = new Date();
269
+ future.setDate(future.getDate() + days);
270
+ future.setHours(23, 59, 59, 999);
271
+ return future;
272
+ };
273
+ /**
274
+ * Create a Date object from year, month, and day numbers
275
+ * Adjusts for timezone offset to ensure the date represents the correct local date
276
+ *
277
+ * @param year - The year (e.g., 2024)
278
+ * @param month - The month (1-12, where 1 is January)
279
+ * @param day - The day of the month (1-31)
280
+ * @returns A Date object representing midnight on the specified date in local time
281
+ */
282
+ export const createDateFromYMD = (year, month, day) => {
283
+ const date = new Date(year, month - 1, day);
284
+ // Adjust for timezone offset to ensure the date is correct in local time
285
+ const timezoneOffset = date.getTimezoneOffset() * 60000;
286
+ return new Date(date.getTime() - timezoneOffset);
287
+ };
288
+ /**
289
+ * Format a Date as an ISO date string (YYYY-MM-DD)
290
+ * Useful for HTML date input values and attributes
291
+ *
292
+ * @param date - The date to format
293
+ * @returns A string in YYYY-MM-DD format
294
+ */
295
+ export const toISODateString = (date) => {
296
+ return date.toISOString().split('T')[0];
297
+ };
@@ -3,6 +3,7 @@ import { DispatchesInfo, TimeSlot } from '../types/fulfillments-types.js';
3
3
  import { Operation } from '../types/operation.js';
4
4
  import * as fulfillemtMethodsSDK from '@wix/auto_sdk_restaurants_fulfillment-methods';
5
5
  import { FulfillmentDetails } from '@wix/auto_sdk_restaurants_operations';
6
+ export { convertTimeOfDayToDateTime, convertDateToTimezone, formatDateInTimezone, formatTime, formatTimeRange, getDatePartsInTimezone, buildDateFromParts, isInTimeRange, DAY_OF_WEEK, DayOfWeek, getDayOfWeekNumber, TimeOfDay, TimeOfDayRange, getLocale, getTimezone, } from './date-utils.js';
6
7
  /**
7
8
  * Format a string with placeholders like {0}, {1}, etc.
8
9
  * Similar to C#'s String.Format
@@ -49,8 +50,8 @@ export declare const createTimeRange: (arr: FulfillmentDetails[]) => {
49
50
  };
50
51
  maxTimeOptions?: undefined;
51
52
  };
52
- export declare const processFulfillments: (fulfillments: fulfillemtMethodsSDK.FulfillmentMethod[], timeSlots: TimeSlot[], operation: Operation) => Promise<{
53
+ export declare const processFulfillments: (fulfillments: fulfillemtMethodsSDK.FulfillmentMethod[], timeSlots: TimeSlot[], operation: Operation) => {
53
54
  dispatchesInfo: DispatchesInfo;
54
55
  isPickupConfigured: boolean;
55
56
  isDeliveryConfigured: boolean;
56
- } | undefined>;
57
+ } | undefined;
@@ -1,7 +1,11 @@
1
1
  import * as operationsSDK from '@wix/auto_sdk_restaurants_operations';
2
2
  import { DispatchType, } from '../types/fulfillments-types.js';
3
- import { EntitiesDayOfWeek as DayOfWeek, } from '@wix/auto_sdk_restaurants_fulfillment-methods';
4
3
  import { FulfillmentTimeType, } from '@wix/auto_sdk_restaurants_operations';
4
+ import { DAY_OF_WEEK, isInTimeRange, getDayOfWeekNumber, getLocale, convertDateToTimezone, } from './date-utils.js';
5
+ // Re-export date utilities for convenience
6
+ export { convertTimeOfDayToDateTime, convertDateToTimezone, formatDateInTimezone, formatTime, formatTimeRange, getDatePartsInTimezone, buildDateFromParts, isInTimeRange, DAY_OF_WEEK, DayOfWeek, getDayOfWeekNumber,
7
+ // Locale & timezone utilities
8
+ getLocale, getTimezone, } from './date-utils.js';
5
9
  /**
6
10
  * Format a string with placeholders like {0}, {1}, etc.
7
11
  * Similar to C#'s String.Format
@@ -150,6 +154,8 @@ export const processFulfillmentTimeSlotByOperationList = (operationTimeSlot) =>
150
154
  durationRangeOptions: selectedFulfillmentInfo?.durationRange,
151
155
  ...selectedFulfillmentInfo,
152
156
  };
157
+ // const startTime = convertTimeOfDayToDateTime(startTime!, timezone);
158
+ // const endTime = convertTimeOfDayToDateTime(endTime!, timezone);
153
159
  return {
154
160
  id: createTimeSlotId(startTime, endTime),
155
161
  startTime: startTime,
@@ -163,71 +169,22 @@ export const processFulfillmentTimeSlotByOperationList = (operationTimeSlot) =>
163
169
  }),
164
170
  ];
165
171
  };
166
- const DAY_OF_WEEK = {
167
- [DayOfWeek.MON]: 1,
168
- [DayOfWeek.TUE]: 2,
169
- [DayOfWeek.WED]: 3,
170
- [DayOfWeek.THU]: 4,
171
- [DayOfWeek.FRI]: 5,
172
- [DayOfWeek.SAT]: 6,
173
- [DayOfWeek.SUN]: 7,
174
- };
175
- const convertTimeOfDayToDateTime = (time, timezone) => {
176
- const now = new Date();
177
- if (timezone) {
178
- // Get today's date components in the specified timezone
179
- const options = {
180
- timeZone: timezone,
181
- year: 'numeric',
182
- month: '2-digit',
183
- day: '2-digit',
184
- };
185
- const parts = new Intl.DateTimeFormat('en-US', options).formatToParts(now);
186
- const year = parts.find((p) => p.type === 'year')?.value;
187
- const month = parts.find((p) => p.type === 'month')?.value;
188
- const day = parts.find((p) => p.type === 'day')?.value;
189
- // Create an ISO string with the date in the timezone and the specified time
190
- const hours = String(time.hours ?? 0).padStart(2, '0');
191
- const minutes = String(time.minutes ?? 0).padStart(2, '0');
192
- const isoString = `${year}-${month}-${day}T${hours}:${minutes}:00.000`;
193
- // Convert to Date - this will be interpreted as local time
194
- const localDate = new Date(isoString);
195
- // Get what this time would be formatted as in the target timezone
196
- const formattedInTz = new Date(localDate.toLocaleString('en-US', { timeZone: timezone }));
197
- // Calculate the difference and adjust
198
- const offset = localDate.getTime() - formattedInTz.getTime();
199
- return new Date(localDate.getTime() + offset);
200
- }
201
- // If no timezone specified, use local time
202
- const date = new Date();
203
- date.setHours(time.hours ?? 0, time.minutes ?? 0, 0, 0);
204
- return date;
205
- };
206
- const isInTimeRange = (time, range, timeZone) => {
207
- const startTime = range.startTime
208
- ? convertTimeOfDayToDateTime(range.startTime, timeZone)
209
- : time;
210
- const endTime = range.endTime
211
- ? convertTimeOfDayToDateTime(range.endTime, timeZone)
212
- : time;
213
- return (time.getTime() >= startTime.getTime() && time.getTime() <= endTime.getTime());
214
- };
215
172
  const isFulfillmentAvailable = (fulfillment, operation) => {
216
173
  const { availability: { timeZone, availableTimes } = {} } = fulfillment;
217
174
  const { asapOptions: { maxInMinutes, rangeInMinutes } = {} } = operation;
218
175
  const deliveryTime = fulfillment.deliveryOptions?.deliveryTimeInMinutes ?? 0;
219
- const zone = timeZone;
220
- const timeNow = new Date();
176
+ const timezone = timeZone;
177
+ const locale = getLocale();
178
+ const timeNow = convertDateToTimezone(new Date(), timezone, locale);
221
179
  timeNow.setMinutes(timeNow.getMinutes() +
222
180
  (maxInMinutes ?? rangeInMinutes?.min ?? 0) +
223
181
  deliveryTime);
224
- // getDay() returns 0 (Sunday) to 6 (Saturday), but we need 1 (Monday) to 7 (Sunday)
225
- const currentDayOfWeek = timeNow.getDay() === 0 ? 7 : timeNow.getDay();
182
+ const currentDayOfWeek = getDayOfWeekNumber(timeNow);
226
183
  return !!availableTimes?.some((availableTime) => {
227
184
  const { dayOfWeek, timeRanges } = availableTime;
228
185
  const dayOfWeekNumber = DAY_OF_WEEK[dayOfWeek];
229
186
  const isAvailable = dayOfWeekNumber === currentDayOfWeek &&
230
- !!timeRanges?.some((range) => isInTimeRange(timeNow, range, zone));
187
+ !!timeRanges?.some((range) => isInTimeRange(timeNow, range, timezone));
231
188
  return isAvailable;
232
189
  });
233
190
  };
@@ -291,10 +248,9 @@ export const createTimeRange = (arr) => {
291
248
  return { durationRangeOptions: { minDuration, maxDuration } };
292
249
  }
293
250
  };
294
- export const processFulfillments = async (fulfillments, timeSlots, operation) => {
251
+ export const processFulfillments = (fulfillments, timeSlots, operation) => {
295
252
  const shouldConsiderAvailability = timeSlots.length > 0;
296
253
  try {
297
- console.log('fulfillments :>>', fulfillments);
298
254
  const pickupFulfillment = fulfillments.find((fulfillment) => fulfillment.type === 'PICKUP' && fulfillment.enabled);
299
255
  let deliveryFulfillments = fulfillments.filter((fulfillment) => fulfillment.type === 'DELIVERY' && fulfillment.enabled);
300
256
  const isPickupConfigured = !!pickupFulfillment;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/headless-restaurants-olo",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -56,6 +56,7 @@
56
56
  "@radix-ui/react-slot": "^1.1.0",
57
57
  "@wix/auto_sdk_restaurants_items": "^1.0.48",
58
58
  "@wix/ecom": "^1.0.1461",
59
+ "@wix/essentials": "^1.0.0",
59
60
  "@wix/headless-components": "0.0.33",
60
61
  "@wix/headless-media": "0.0.18",
61
62
  "@wix/headless-restaurants-menus": "0.0.22",
@@ -76,5 +77,5 @@
76
77
  "groupId": "com.wixpress.headless-components"
77
78
  }
78
79
  },
79
- "falconPackageHash": "97aa9b4b1d42245862576a697ea8caa770e137558f7c9de093e568de"
80
+ "falconPackageHash": "8fef913fc66b2bade48d7c257f0f51bb8b909775971887e2af22001c"
80
81
  }