mozrest-sdk-react-dev 0.1.96 → 0.1.99

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/mozrest-sdk.es.js CHANGED
@@ -6347,6 +6347,13 @@ const EXPORTDATA = "Export data";
6347
6347
  const SELECTYOURRESTAURANTS = "Select your restaurants";
6348
6348
  const SelectXResturant = "Select {{value}} restaurant";
6349
6349
  const ComparedPeriod = "Compared period";
6350
+ const CLOSE = "Close";
6351
+ const NoChannelsConnected = "No channels connected";
6352
+ const NoChannelsConnectedDesc = "You do not have channels connected, as soon as you connect them the changes will be reflected in the channels.";
6353
+ const AddWalKin = "Add a walk-in";
6354
+ const ConfirmCreateWalkInReservation = "Please confirm that you want to create a walk-in reservation for {{value}}";
6355
+ const NoBookingAvailability = "No booking availability";
6356
+ const NoAvailabilityForPartySize = "Sorry we have not availability for this party size: {{value}}";
6350
6357
  var en = {
6351
6358
  errors,
6352
6359
  SPECIALCLOSINGDATES,
@@ -6651,7 +6658,14 @@ var en = {
6651
6658
  EXPORTDATA,
6652
6659
  SELECTYOURRESTAURANTS,
6653
6660
  SelectXResturant,
6654
- ComparedPeriod
6661
+ ComparedPeriod,
6662
+ CLOSE,
6663
+ NoChannelsConnected,
6664
+ NoChannelsConnectedDesc,
6665
+ AddWalKin,
6666
+ ConfirmCreateWalkInReservation,
6667
+ NoBookingAvailability,
6668
+ NoAvailabilityForPartySize
6655
6669
  };
6656
6670
  instance.use(initReactI18next).init({
6657
6671
  resources: {
@@ -7612,6 +7626,17 @@ const roundTable = () => /* @__PURE__ */ React__default.createElement("svg", {
7612
7626
  fill: "currentColor",
7613
7627
  transform: "translate(27,0)"
7614
7628
  }));
7629
+ const link$1 = () => /* @__PURE__ */ React__default.createElement("svg", {
7630
+ xmlns: "http://www.w3.org/2000/svg",
7631
+ width: "16",
7632
+ height: "16",
7633
+ fill: "currentColor",
7634
+ viewBox: "0 0 16 16"
7635
+ }, /* @__PURE__ */ React__default.createElement("path", {
7636
+ d: "M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1.002 1.002 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4.018 4.018 0 0 1-.128-1.287z"
7637
+ }), /* @__PURE__ */ React__default.createElement("path", {
7638
+ d: "M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243L6.586 4.672z"
7639
+ }));
7615
7640
  const linkedin = () => /* @__PURE__ */ React__default.createElement("svg", {
7616
7641
  viewBox: "0 0 24 24",
7617
7642
  fill: "none",
@@ -8802,6 +8827,7 @@ const clock = () => {
8802
8827
  var icons$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8803
8828
  __proto__: null,
8804
8829
  roundTable,
8830
+ link: link$1,
8805
8831
  linkedin,
8806
8832
  menu,
8807
8833
  close: close$4,
@@ -43414,9 +43440,6 @@ const NewSelect = ({
43414
43440
  }, label2), /* @__PURE__ */ React__default.createElement("div", {
43415
43441
  style: { position: "relative" }
43416
43442
  }, /* @__PURE__ */ React__default.createElement(Select$1, {
43417
- className: clsx([
43418
- heigth && heigth !== "md" ? "h-12" : "h-7"
43419
- ]),
43420
43443
  styles: customStyles,
43421
43444
  ...props,
43422
43445
  id: id2,
@@ -53328,6 +53351,9 @@ const ModalConfirmation = ({
53328
53351
  message: message2,
53329
53352
  title: title2,
53330
53353
  icon: icon2,
53354
+ showSubmitButton = true,
53355
+ submitButtonText = "ACCEPT",
53356
+ cancelButtonText = "CANCEL",
53331
53357
  ...props
53332
53358
  }) => {
53333
53359
  const { t: t2 } = useTranslation();
@@ -53348,11 +53374,11 @@ const ModalConfirmation = ({
53348
53374
  mode: "tertiary",
53349
53375
  onClick: props.onClose,
53350
53376
  disabled: isLoading
53351
- }, t2("CANCEL")), /* @__PURE__ */ React__default.createElement(Button$3, {
53377
+ }, t2(cancelButtonText)), showSubmitButton && /* @__PURE__ */ React__default.createElement(Button$3, {
53352
53378
  size: "small",
53353
53379
  onClick: onAccept,
53354
53380
  isLoading
53355
- }, t2("ACCEPT"))));
53381
+ }, t2(submitButtonText))));
53356
53382
  };
53357
53383
  const ReplyTemplates = ({
53358
53384
  venueId,
@@ -95069,6 +95095,9 @@ const VenueListingDetail = ({
95069
95095
  const clearModuleToDisconnect = () => setModuleToDisconnect(void 0);
95070
95096
  const clearModuleToConnect = () => setModuleToConnect(void 0);
95071
95097
  const [showAppleConnectModal, setShowAppleConnectModal] = useState(false);
95098
+ const [showNotConnectedChannelsModal, setShowNotConnectedChannelsModal] = useState(false);
95099
+ const onOpenNotConnectedChannelsModal = () => setShowNotConnectedChannelsModal(true);
95100
+ const onCloseNotConnectedChannelsModal = () => setShowNotConnectedChannelsModal(false);
95072
95101
  const [googlePublishing, setGooglePublishing] = useState();
95073
95102
  const [facebookPublishing, setFacebookPublishing] = useState();
95074
95103
  const [googleErrors, setGoogleErrors] = useState();
@@ -95079,7 +95108,7 @@ const VenueListingDetail = ({
95079
95108
  venueListingId
95080
95109
  });
95081
95110
  const venueId = data2 == null ? void 0 : data2.venueId;
95082
- const { reload: _reloadConnect } = useConnect({ venueId });
95111
+ const { FacebookConnected, GoogleConnected, BingConnected, AppleConnected, reload: _reloadConnect } = useConnect({ venueId });
95083
95112
  const { execute: publishGoogle, isExecuting: isPublishingGoogle, error: errorGoogle, data: rGoogle } = useService(PublishVenueListing);
95084
95113
  const { execute: publishFacebook, isExecuting: isPublishingFacebook, error: errorFacebook, data: responseFacebook } = useService(PublishVenueListing);
95085
95114
  const reloadConnect = () => {
@@ -95151,6 +95180,9 @@ const VenueListingDetail = ({
95151
95180
  } else {
95152
95181
  setFacebookPublishing("success");
95153
95182
  }
95183
+ if (!FacebookConnected && !GoogleConnected && !BingConnected && !AppleConnected) {
95184
+ onOpenNotConnectedChannelsModal();
95185
+ }
95154
95186
  await reload();
95155
95187
  };
95156
95188
  if (isLoading) {
@@ -95249,6 +95281,15 @@ const VenueListingDetail = ({
95249
95281
  onClose: clearTemporaryClosed,
95250
95282
  isLoading: isUpdating,
95251
95283
  width: 500
95284
+ }), /* @__PURE__ */ React__default.createElement(ModalConfirmation, {
95285
+ title: t$3("NoChannelsConnected"),
95286
+ message: t$3("NoChannelsConnectedDesc"),
95287
+ showSubmitButton: false,
95288
+ open: showNotConnectedChannelsModal,
95289
+ onClose: onCloseNotConnectedChannelsModal,
95290
+ cancelButtonText: "CLOSE",
95291
+ icon: "link",
95292
+ width: 500
95252
95293
  }), /* @__PURE__ */ React__default.createElement(ModalOnboarding, {
95253
95294
  onClose: () => setOpenOnboarding(false),
95254
95295
  venue: data2 && (data2 == null ? void 0 : data2.businessName),
@@ -97164,40 +97205,39 @@ const formatData = (data2) => {
97164
97205
  };
97165
97206
  });
97166
97207
  };
97167
- const mainConatiner = "_mainConatiner_3nkgk_1";
97168
- const btnDanger = "_btnDanger_3nkgk_5";
97169
- const btnWarning = "_btnWarning_3nkgk_10";
97170
- const btnSuccess = "_btnSuccess_3nkgk_15";
97171
- const container$3 = "_container_3nkgk_20";
97172
- const button$1 = "_button_3nkgk_52";
97173
- const skeleton$1 = "_skeleton_3nkgk_60";
97174
- const pulse$3 = "_pulse_3nkgk_1";
97175
- const item$4 = "_item_3nkgk_63";
97176
- const icons = "_icons_3nkgk_69";
97177
- const column = "_column_3nkgk_74";
97178
- const row = "_row_3nkgk_104";
97179
- const cards = "_cards_3nkgk_116";
97180
- const cardActive = "_cardActive_3nkgk_127";
97181
- const cards1 = "_cards1_3nkgk_132";
97182
- const dot$1 = "_dot_3nkgk_143";
97183
- const formInline = "_formInline_3nkgk_155";
97184
- const header = "_header_3nkgk_161";
97185
- const datesSectionContainer = "_datesSectionContainer_3nkgk_178";
97186
- const datesSectionActionButtons1 = "_datesSectionActionButtons1_3nkgk_189";
97187
- const datesSectionActionButtons2 = "_datesSectionActionButtons2_3nkgk_200";
97188
- const tableFiltersContainer = "_tableFiltersContainer_3nkgk_213";
97189
- const tableFiltersFilterButton = "_tableFiltersFilterButton_3nkgk_225";
97190
- const tableDesktopFilters = "_tableDesktopFilters_3nkgk_235";
97191
- const mainTableDesktop = "_mainTableDesktop_3nkgk_246";
97192
- const mainTableTablet = "_mainTableTablet_3nkgk_255";
97208
+ const mainConatiner = "_mainConatiner_1x9ia_1";
97209
+ const btnWarning = "_btnWarning_1x9ia_5";
97210
+ const btnSuccess = "_btnSuccess_1x9ia_10";
97211
+ const container$3 = "_container_1x9ia_15";
97212
+ const button$1 = "_button_1x9ia_47";
97213
+ const skeleton$1 = "_skeleton_1x9ia_55";
97214
+ const pulse$3 = "_pulse_1x9ia_1";
97215
+ const item$4 = "_item_1x9ia_58";
97216
+ const icons = "_icons_1x9ia_64";
97217
+ const column = "_column_1x9ia_69";
97218
+ const row = "_row_1x9ia_99";
97219
+ const cards = "_cards_1x9ia_111";
97220
+ const cardActive = "_cardActive_1x9ia_122";
97221
+ const cards1 = "_cards1_1x9ia_127";
97222
+ const dot$1 = "_dot_1x9ia_138";
97223
+ const formInline = "_formInline_1x9ia_150";
97224
+ const header = "_header_1x9ia_156";
97225
+ const datesSectionContainer = "_datesSectionContainer_1x9ia_173";
97226
+ const datesSectionActionButtons1 = "_datesSectionActionButtons1_1x9ia_184";
97227
+ const datesSectionActionButtons2 = "_datesSectionActionButtons2_1x9ia_195";
97228
+ const tableFiltersContainer = "_tableFiltersContainer_1x9ia_208";
97229
+ const tableFiltersFilterButton = "_tableFiltersFilterButton_1x9ia_220";
97230
+ const tableDesktopFilters = "_tableDesktopFilters_1x9ia_230";
97231
+ const mainTableDesktop = "_mainTableDesktop_1x9ia_241";
97232
+ const mainTableTablet = "_mainTableTablet_1x9ia_250";
97233
+ const walkingButton = "_walkingButton_1x9ia_260";
97193
97234
  var styles$f = {
97194
97235
  mainConatiner,
97195
- btnDanger,
97196
97236
  btnWarning,
97197
97237
  btnSuccess,
97198
97238
  container: container$3,
97199
97239
  button: button$1,
97200
- "button-disable": "_button-disable_3nkgk_55",
97240
+ "button-disable": "_button-disable_1x9ia_50",
97201
97241
  skeleton: skeleton$1,
97202
97242
  pulse: pulse$3,
97203
97243
  item: item$4,
@@ -97217,7 +97257,8 @@ var styles$f = {
97217
97257
  tableFiltersFilterButton,
97218
97258
  tableDesktopFilters,
97219
97259
  mainTableDesktop,
97220
- mainTableTablet
97260
+ mainTableTablet,
97261
+ walkingButton
97221
97262
  };
97222
97263
  const SelectedDateDisplay = ({ initialDate, selectedDate, onSelectDate, datesSummary }) => {
97223
97264
  const [summary, setSummary] = useState([]);
@@ -97540,82 +97581,6 @@ const FormFields = ({ onFilter: onFilter2, partyOptions, hoursOptions, currentDa
97540
97581
  partyOptions
97541
97582
  }));
97542
97583
  };
97543
- const GetCreateBookingSelectsData = async ({
97544
- venue_id
97545
- }) => {
97546
- const responseVenueData = await instance$1.get(`/v1/rms/venues/${venue_id}`);
97547
- const responseAreas = await instance$1.get(`/v1/rms/venues/${venue_id}/areas`);
97548
- const responseHours = await instance$1.get(`/resbook/venue/${venue_id}/opening-hours`);
97549
- const responseTables = await instance$1.get(`/resbook/venue/${venue_id}/tables?sortby[orderPriority]=ASC`);
97550
- const data2 = {
97551
- partySizes: formatPartySizeData(responseVenueData),
97552
- areas: formatAreasData(responseAreas),
97553
- hours: formatHoursData(responseHours),
97554
- tables: formatTableData(responseTables),
97555
- channels: formatChannelsData(responseVenueData),
97556
- timeZone: formatTimezone(responseVenueData)
97557
- };
97558
- return data2;
97559
- };
97560
- const formatAreasData = (data2) => {
97561
- return data2.data ? [{ id: null, label: "All" }, ...data2.data.map((d2) => ({ id: d2.id, label: d2.name }))] : [{ id: null, label: "All" }];
97562
- };
97563
- const formatPartySizeData = (data2) => {
97564
- const { minCovers, maxCovers } = data2;
97565
- const array4 = createObjectArray(minCovers, maxCovers);
97566
- return [{ id: null, label: "All" }, ...array4];
97567
- };
97568
- const formatTimezone = (data2) => {
97569
- const { timezone } = data2;
97570
- return timezone;
97571
- };
97572
- const formatChannelsData = (data2) => {
97573
- const { reservationPortals } = data2;
97574
- return [{ id: null, label: "All" }, ...reservationPortals.map((p2) => ({ id: p2.id, label: p2.name }))];
97575
- };
97576
- const formatHoursData = (data2) => {
97577
- if (!data2 || typeof data2 !== "object") {
97578
- console.error("Error fetching opening hours data: Invalid response data");
97579
- return [];
97580
- }
97581
- const formattedData = data2.data.map((d2) => {
97582
- const weekday2 = d2.weekday;
97583
- let hours2 = [{ id: null, label: "All" }];
97584
- if (d2.timeSlots && d2.timeSlots.length && d2.timeSlots.length > 0 && !d2.closed) {
97585
- d2.timeSlots.map((ts) => {
97586
- const startTime = hooks(ts.start, "HH:mm");
97587
- const endTime = hooks(ts.end, "HH:mm");
97588
- while (startTime.isSameOrBefore(endTime)) {
97589
- hours2.push({ id: startTime.format("HH:mm"), label: startTime.format("HH:mm") });
97590
- startTime.add(15, "minutes");
97591
- }
97592
- });
97593
- } else if (!d2.closed) {
97594
- const startTime = hooks().startOf("day");
97595
- while (startTime.isSameOrBefore(hooks().endOf("day"))) {
97596
- hours2.push({ id: startTime.format("HH:mm"), label: startTime.format("HH:mm") });
97597
- startTime.add(15, "minutes");
97598
- }
97599
- } else {
97600
- hours2.push({ label: "Closed", id: null });
97601
- }
97602
- return { weekday: weekday2, hours: hours2 };
97603
- });
97604
- return formattedData;
97605
- };
97606
- const formatTableData = (data2) => {
97607
- return data2.data ? [{ id: null, label: "All" }, ...data2.data.map((d2) => ({ id: d2.id, label: d2.name }))] : [{ id: null, label: "All" }];
97608
- };
97609
- const createObjectArray = (start, end) => {
97610
- if (start > end) {
97611
- return [];
97612
- }
97613
- const objectArray = [];
97614
- for (let i = start; i <= end; i++) {
97615
- objectArray.push({ id: i, label: i });
97616
- }
97617
- return objectArray;
97618
- };
97619
97584
  const pulse$2 = "_pulse_egqe1_1";
97620
97585
  const container$2 = "_container_egqe1_13";
97621
97586
  const item$3 = "_item_egqe1_19";
@@ -97636,15 +97601,7 @@ const SkeletonFilters = () => {
97636
97601
  className: styles$e.item
97637
97602
  })));
97638
97603
  };
97639
- const TableFilters$2 = ({ handleSearch, venueId, currentDate, setCurrentTimeZone }) => {
97640
- const {
97641
- data: data2,
97642
- isLoading,
97643
- error: error3
97644
- } = useFetch(GetCreateBookingSelectsData, {
97645
- cacheId: "venueCapacity",
97646
- venue_id: venueId
97647
- });
97604
+ const TableFilters$2 = ({ data: data2, isLoading, error: error3, handleSearch, venueId, currentDate }) => {
97648
97605
  if (error3) {
97649
97606
  return /* @__PURE__ */ React__default.createElement(Error$1, {
97650
97607
  error: error3
@@ -97653,7 +97610,6 @@ const TableFilters$2 = ({ handleSearch, venueId, currentDate, setCurrentTimeZone
97653
97610
  if (isLoading) {
97654
97611
  return /* @__PURE__ */ React__default.createElement(SkeletonFilters, null);
97655
97612
  }
97656
- setCurrentTimeZone(data2.timeZone);
97657
97613
  const initialState2 = {
97658
97614
  status: statusOptions ? statusOptions[0] : { label: t$3("ALL"), id: null },
97659
97615
  channel: data2.channels ? data2.channels[0] : { label: t$3("ALL"), id: null },
@@ -97877,6 +97833,82 @@ const FilterForm$1 = ({ partyOptions, areasOptions, hoursOptions, setBookingValu
97877
97833
  onClick: () => handleSubmit()
97878
97834
  }, "")));
97879
97835
  };
97836
+ const GetCreateBookingSelectsData = async ({
97837
+ venue_id
97838
+ }) => {
97839
+ const responseVenueData = await instance$1.get(`/v1/rms/venues/${venue_id}`);
97840
+ const responseAreas = await instance$1.get(`/v1/rms/venues/${venue_id}/areas`);
97841
+ const responseHours = await instance$1.get(`/resbook/venue/${venue_id}/opening-hours`);
97842
+ const responseTables = await instance$1.get(`/resbook/venue/${venue_id}/tables?sortby[orderPriority]=ASC`);
97843
+ const data2 = {
97844
+ partySizes: formatPartySizeData(responseVenueData),
97845
+ areas: formatAreasData(responseAreas),
97846
+ hours: formatHoursData(responseHours),
97847
+ tables: formatTableData(responseTables),
97848
+ channels: formatChannelsData(responseVenueData),
97849
+ timeZone: formatTimezone(responseVenueData)
97850
+ };
97851
+ return data2;
97852
+ };
97853
+ const formatAreasData = (data2) => {
97854
+ return data2.data ? [{ id: null, label: "All" }, ...data2.data.map((d2) => ({ id: d2.id, label: d2.name }))] : [{ id: null, label: "All" }];
97855
+ };
97856
+ const formatPartySizeData = (data2) => {
97857
+ const { minCovers, maxCovers } = data2;
97858
+ const array4 = createObjectArray(minCovers, maxCovers);
97859
+ return [{ id: null, label: "All" }, ...array4];
97860
+ };
97861
+ const formatTimezone = (data2) => {
97862
+ const { timezone } = data2;
97863
+ return timezone;
97864
+ };
97865
+ const formatChannelsData = (data2) => {
97866
+ const { reservationPortals } = data2;
97867
+ return [{ id: null, label: "All" }, ...reservationPortals.map((p2) => ({ id: p2.id, label: p2.name }))];
97868
+ };
97869
+ const formatHoursData = (data2) => {
97870
+ if (!data2 || typeof data2 !== "object") {
97871
+ console.error("Error fetching opening hours data: Invalid response data");
97872
+ return [];
97873
+ }
97874
+ const formattedData = data2.data.map((d2) => {
97875
+ const weekday2 = d2.weekday;
97876
+ let hours2 = [{ id: null, label: "All" }];
97877
+ if (d2.timeSlots && d2.timeSlots.length && d2.timeSlots.length > 0 && !d2.closed) {
97878
+ d2.timeSlots.map((ts) => {
97879
+ const startTime = hooks(ts.start, "HH:mm");
97880
+ const endTime = hooks(ts.end, "HH:mm");
97881
+ while (startTime.isSameOrBefore(endTime)) {
97882
+ hours2.push({ id: startTime.format("HH:mm"), label: startTime.format("HH:mm") });
97883
+ startTime.add(15, "minutes");
97884
+ }
97885
+ });
97886
+ } else if (!d2.closed) {
97887
+ const startTime = hooks().startOf("day");
97888
+ while (startTime.isSameOrBefore(hooks().endOf("day"))) {
97889
+ hours2.push({ id: startTime.format("HH:mm"), label: startTime.format("HH:mm") });
97890
+ startTime.add(15, "minutes");
97891
+ }
97892
+ } else {
97893
+ hours2.push({ label: "Closed", id: null });
97894
+ }
97895
+ return { weekday: weekday2, hours: hours2 };
97896
+ });
97897
+ return formattedData;
97898
+ };
97899
+ const formatTableData = (data2) => {
97900
+ return data2.data ? [{ id: null, label: "All" }, ...data2.data.map((d2) => ({ id: d2.id, label: d2.name }))] : [{ id: null, label: "All" }];
97901
+ };
97902
+ const createObjectArray = (start, end) => {
97903
+ if (start > end) {
97904
+ return [];
97905
+ }
97906
+ const objectArray = [];
97907
+ for (let i = start; i <= end; i++) {
97908
+ objectArray.push({ id: i, label: i });
97909
+ }
97910
+ return objectArray;
97911
+ };
97880
97912
  var momentTimezone$1 = { exports: {} };
97881
97913
  var momentTimezone = { exports: {} };
97882
97914
  var require$$0 = /* @__PURE__ */ getAugmentedNamespace(moment$2);
@@ -99362,6 +99394,19 @@ const GetTableAvailability = async ({
99362
99394
  }
99363
99395
  return [];
99364
99396
  };
99397
+ const GetTableWalkInAvailability = async ({
99398
+ venue_id,
99399
+ params
99400
+ }) => {
99401
+ if (params && params.startSec) {
99402
+ const responseData = await instance$1.get(`/resbook/venue/${venue_id}/table-availablity/walk-in`, {
99403
+ params: { ...params, limit: 100 }
99404
+ });
99405
+ const data2 = responseData != null ? responseData : [];
99406
+ return data2;
99407
+ }
99408
+ return [];
99409
+ };
99365
99410
  const TableAvailability = ({ venueId, setSelectedTable, setBookingValues, params, setParams, currentTimeZone, currentDate }) => {
99366
99411
  const { data: data2, reload } = useFetch(GetTableAvailability, { cacheId: "reservation0dashboard0table0availability", venue_id: venueId, params });
99367
99412
  const handleOnSelectTable = (row2) => {
@@ -99476,7 +99521,7 @@ const ContactDetailsForm = ({ venueId, selectedTable, setSelectedTable, setCreat
99476
99521
  lastname: values.lastname,
99477
99522
  email: values.email,
99478
99523
  telephone: values.telephone,
99479
- locale: "es"
99524
+ locale: "en"
99480
99525
  }
99481
99526
  };
99482
99527
  await execute({
@@ -99997,6 +100042,65 @@ const formatDateToYYYYMMDD = (date4) => {
99997
100042
  const day2 = String(date4.getDate()).padStart(2, "0");
99998
100043
  return `${year2}-${month2}-${day2}`;
99999
100044
  };
100045
+ const WalkinButton = ({ partyOptions, onOpenCreateWalkInReservation, walkInPartySize, setWalkInPartySize }) => {
100046
+ const { t: t2 } = useTranslation();
100047
+ return /* @__PURE__ */ React__default.createElement("select", {
100048
+ className: styles$f.walkingButton,
100049
+ value: walkInPartySize != null ? walkInPartySize : "",
100050
+ onChange: (e3) => {
100051
+ const selectedValue = e3.target.value;
100052
+ setWalkInPartySize(selectedValue);
100053
+ onOpenCreateWalkInReservation();
100054
+ }
100055
+ }, /* @__PURE__ */ React__default.createElement("option", {
100056
+ value: ""
100057
+ }, t2("AddWalKin")), partyOptions.filter((p2) => p2.id).map((p2, i) => /* @__PURE__ */ React__default.createElement("option", {
100058
+ key: i,
100059
+ value: p2.id
100060
+ }, p2.label)));
100061
+ };
100062
+ const CreateWalkInReservation = ({ open, onClose: onClose2, venueId, reloadMainTable, currentTimeZone, currentDate, partySize }) => {
100063
+ const { t: t2 } = useTranslation();
100064
+ const params = {
100065
+ partySize,
100066
+ startSec: moment$1.tz(`${currentDate} 12:00`, currentTimeZone ? currentTimeZone : "").valueOf() / 1e3
100067
+ };
100068
+ const { data: data2, isLoading, reload } = useFetch(GetTableWalkInAvailability, { cacheId: "walkIntableAvailability", venue_id: venueId, params });
100069
+ const { execute, isExecuting } = useService(AddBooking);
100070
+ const handleOnSubmit = async () => {
100071
+ const toSend = {
100072
+ partySize,
100073
+ table: data2.id,
100074
+ date: params.startSec,
100075
+ notes: "Walk-in reservation",
100076
+ contact: {
100077
+ firstname: "Walk-in",
100078
+ lastname: "reservation",
100079
+ email: "walkin@walkin.com",
100080
+ telephone: "Walk-in reservation",
100081
+ locale: "en"
100082
+ }
100083
+ };
100084
+ await execute({
100085
+ venueId,
100086
+ data: toSend
100087
+ });
100088
+ reloadMainTable();
100089
+ onClose2();
100090
+ };
100091
+ return /* @__PURE__ */ React__default.createElement(ModalConfirmation, {
100092
+ title: data2 && data2.id ? t2("AREYOUSURE?") : t2("NoBookingAvailability"),
100093
+ icon: data2 && data2.id ? "calendar" : "no",
100094
+ message: data2 && data2.id ? t2("ConfirmCreateWalkInReservation", { value: partySize }) : t2("NoAvailabilityForPartySize", { value: partySize }),
100095
+ showSubmitButton: data2 && data2.id ? true : false,
100096
+ cancelButtonText: data2 && data2.id ? void 0 : t2("CLOSE"),
100097
+ onAccept: () => handleOnSubmit(),
100098
+ open,
100099
+ onClose: onClose2,
100100
+ isLoading: isLoading || isExecuting,
100101
+ width: 500
100102
+ });
100103
+ };
100000
100104
  const ReservationDashboard = ({
100001
100105
  Header: Header2,
100002
100106
  classNameConatiner,
@@ -100013,12 +100117,21 @@ const ReservationDashboard = ({
100013
100117
  "filters[tillZ]": `${dateString}T23:59:59.999`
100014
100118
  };
100015
100119
  });
100016
- const [currentTimeZone, setCurrentTimeZone] = useState(null);
100120
+ const currentTimeZone = useRef(null);
100017
100121
  const [currentDate, setCurrentDate] = useState(hooks().format("YYYY-MM-DD"));
100018
100122
  const [initialDate, setInitialDate] = useState(hooks().format("YYYY-MM-DD"));
100019
100123
  const [openCreateReservation, setOpenCreateReservation] = useState(false);
100020
100124
  const onOpenCreateReservation = () => setOpenCreateReservation(true);
100021
100125
  const onCloseCreateReservation = () => setOpenCreateReservation(false);
100126
+ const [walkInPartySize, setWalkInPartySize] = useState("");
100127
+ const [openCreateWalkInReservation, setOpenCreateWalkInReservation] = useState(false);
100128
+ const onOpenCreateWalkInReservation = () => {
100129
+ setOpenCreateWalkInReservation(true);
100130
+ };
100131
+ const onCloseCreateWalkInReservation = () => {
100132
+ setWalkInPartySize("");
100133
+ setOpenCreateWalkInReservation(false);
100134
+ };
100022
100135
  const [openDetailReservation, setOpenDetailReservation] = useState(false);
100023
100136
  const onOpenDetailReservation = () => setOpenDetailReservation(true);
100024
100137
  const onCloseDetailReservation = () => setOpenDetailReservation(false);
@@ -100028,6 +100141,10 @@ const ReservationDashboard = ({
100028
100141
  const [selectedRow, setSelectedRow] = useState(null);
100029
100142
  const { data: data2, isLoading, error: error3, reload } = useFetch(GetBookings, { cacheId: "reservation0dashboard", venue_id: venueId, params });
100030
100143
  const { data: bookingSumary, isLoading: bookingSumaryLoading, error: bookingSumaryError, reload: bookingSumaryReload } = useFetch(GetBookingSummary, { cacheId: "bookingSummary", venue_id: venueId, date: initialDate });
100144
+ const { data: filtersData, isLoading: filtersLoading, error: filtersError } = useFetch(GetCreateBookingSelectsData, {
100145
+ cacheId: "venueCapacity",
100146
+ venue_id: venueId
100147
+ });
100031
100148
  if (error3 || bookingSumaryError) {
100032
100149
  return /* @__PURE__ */ React__default.createElement(Error$1, {
100033
100150
  error: error3
@@ -100043,8 +100160,8 @@ const ReservationDashboard = ({
100043
100160
  if (values && values.time && values.time.id) {
100044
100161
  const utcDate2 = hooks(currentDate).add(values.time.id, "hours").format("YYYY-MM-DDTHH:mm:ss");
100045
100162
  const timeZone = new Date(utcDate2).toLocaleTimeString([], {
100046
- ...currentTimeZone ? {
100047
- timeZone: currentTimeZone
100163
+ ...currentTimeZone.current ? {
100164
+ timeZone: currentTimeZone.current
100048
100165
  } : {},
100049
100166
  hour: "2-digit",
100050
100167
  minute: "2-digit",
@@ -100065,6 +100182,14 @@ const ReservationDashboard = ({
100065
100182
  useEffect(() => {
100066
100183
  bookingSumaryReload();
100067
100184
  }, [data2]);
100185
+ useEffect(() => {
100186
+ if (filtersData && filtersData.timeZone) {
100187
+ currentTimeZone.current = filtersData.timeZone;
100188
+ }
100189
+ }, [filtersData]);
100190
+ if (filtersLoading || !filtersData && !filtersData.timeZone) {
100191
+ return /* @__PURE__ */ React__default.createElement(SkeletonPage, null);
100192
+ }
100068
100193
  return /* @__PURE__ */ React__default.createElement(LayoutPage$1, {
100069
100194
  containerClassName: styles$f.mainConatiner
100070
100195
  }, /* @__PURE__ */ React__default.createElement("div", {
@@ -100081,24 +100206,27 @@ const ReservationDashboard = ({
100081
100206
  className: styles$f.datesSectionActionButtons2
100082
100207
  }, /* @__PURE__ */ React__default.createElement(Button$3, {
100083
100208
  size: "small",
100084
- className: styles$f.btnDanger,
100209
+ mode: "danger",
100085
100210
  onClick: () => onOpenCreateReservation()
100086
- }, "Add a reservation"), /* @__PURE__ */ React__default.createElement(Button$3, {
100087
- size: "small",
100088
- className: styles$f.btnDanger,
100089
- disabled: true
100090
- }, "Add a walk-in"))), /* @__PURE__ */ React__default.createElement("br", null), /* @__PURE__ */ React__default.createElement(Card, {
100211
+ }, "Add a reservation"), /* @__PURE__ */ React__default.createElement(WalkinButton, {
100212
+ walkInPartySize,
100213
+ setWalkInPartySize,
100214
+ onOpenCreateWalkInReservation,
100215
+ partyOptions: !filtersLoading && filtersData && filtersData.partySizes ? filtersData.partySizes : []
100216
+ }))), /* @__PURE__ */ React__default.createElement("br", null), /* @__PURE__ */ React__default.createElement(Card, {
100091
100217
  className: classNameConatiner,
100092
100218
  header: Header2
100093
100219
  }, /* @__PURE__ */ React__default.createElement("div", {
100094
100220
  style: { marginBottom: 40 }
100095
100221
  }, /* @__PURE__ */ React__default.createElement(TableFilters$2, {
100222
+ data: filtersData,
100223
+ error: filtersError,
100224
+ isLoading: filtersLoading,
100096
100225
  handleSearch: onFilter2,
100097
100226
  venueId,
100098
- currentDate,
100099
- setCurrentTimeZone
100227
+ currentDate
100100
100228
  })), isLoading ? /* @__PURE__ */ React__default.createElement(SkeletonPage, null) : /* @__PURE__ */ React__default.createElement(Table$2, {
100101
- currentTimeZone,
100229
+ currentTimeZone: currentTimeZone.current,
100102
100230
  data: data2,
100103
100231
  setSelectedRow: (row2) => {
100104
100232
  onOpenDetailReservation();
@@ -100107,22 +100235,30 @@ const ReservationDashboard = ({
100107
100235
  })), /* @__PURE__ */ React__default.createElement(HoursAvailability, {
100108
100236
  open: openHoursAvailability,
100109
100237
  onClose: onCloseHoursAvailability,
100110
- currentTimeZone,
100238
+ currentTimeZone: currentTimeZone.current,
100111
100239
  currentDate,
100112
100240
  venueId
100113
100241
  }), /* @__PURE__ */ React__default.createElement(CreateReservation, {
100114
100242
  open: openCreateReservation,
100115
100243
  onClose: onCloseCreateReservation,
100116
- currentTimeZone,
100244
+ currentTimeZone: currentTimeZone.current,
100117
100245
  currentDate,
100118
100246
  venueId,
100119
100247
  reloadMainTable: reload
100248
+ }), walkInPartySize && /* @__PURE__ */ React__default.createElement(CreateWalkInReservation, {
100249
+ open: openCreateWalkInReservation,
100250
+ onClose: onCloseCreateWalkInReservation,
100251
+ currentTimeZone: currentTimeZone.current,
100252
+ currentDate,
100253
+ venueId,
100254
+ reloadMainTable: reload,
100255
+ partySize: walkInPartySize
100120
100256
  }), /* @__PURE__ */ React__default.createElement(ReservationDetail, {
100121
100257
  open: openDetailReservation,
100122
100258
  onClose: onCloseDetailReservation,
100123
100259
  selectedRow,
100124
100260
  setSelectedRow,
100125
- currentTimeZone,
100261
+ currentTimeZone: currentTimeZone.current,
100126
100262
  venueId,
100127
100263
  reloadMainTable: reload
100128
100264
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mozrest-sdk-react-dev",
3
- "version": "0.1.96",
3
+ "version": "0.1.99",
4
4
  "main": "mozrest-sdk.es.js",
5
5
  "keywords": ["mozrest"],
6
6
  "author": {