mozrest-sdk-react-dev 0.1.75 → 0.1.78

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
@@ -6312,6 +6312,12 @@ const ATMOSPHERE = "Atmosphere";
6312
6312
  const KITCHEN = "Kitchen";
6313
6313
  const SERVICE = "Service";
6314
6314
  const TABLEAVAILABILITY = "Table availability";
6315
+ const SYNC = "Sync";
6316
+ const SYNCKED = "Synced";
6317
+ const ERRORSYNC = "An error ocurred while syncing";
6318
+ const SYNCING = "Syncing ...";
6319
+ const LASTUPDATE = "Last Updated";
6320
+ const SEARCH = "Search";
6315
6321
  var en = {
6316
6322
  errors,
6317
6323
  SPECIALCLOSINGDATES,
@@ -6585,7 +6591,13 @@ var en = {
6585
6591
  ATMOSPHERE,
6586
6592
  KITCHEN,
6587
6593
  SERVICE,
6588
- TABLEAVAILABILITY
6594
+ TABLEAVAILABILITY,
6595
+ SYNC,
6596
+ SYNCKED,
6597
+ ERRORSYNC,
6598
+ SYNCING,
6599
+ LASTUPDATE,
6600
+ SEARCH
6589
6601
  };
6590
6602
  instance.use(initReactI18next).init({
6591
6603
  resources: {
@@ -7561,7 +7573,7 @@ const menu = () => /* @__PURE__ */ React__default.createElement("svg", {
7561
7573
  d: "M18.625 7.75H5.375C5.27083 7.75 5.17708 7.71875 5.09375 7.65625C5.03125 7.57292 5 7.47917 5 7.375V6.375C5 6.27083 5.03125 6.1875 5.09375 6.125C5.17708 6.04167 5.27083 6 5.375 6H18.625C18.7292 6 18.8125 6.04167 18.875 6.125C18.9583 6.1875 19 6.27083 19 6.375V7.375C19 7.47917 18.9583 7.57292 18.875 7.65625C18.8125 7.71875 18.7292 7.75 18.625 7.75ZM18.625 12.75H5.375C5.27083 12.75 5.17708 12.7188 5.09375 12.6562C5.03125 12.5729 5 12.4792 5 12.375V11.375C5 11.2708 5.03125 11.1875 5.09375 11.125C5.17708 11.0417 5.27083 11 5.375 11H18.625C18.7292 11 18.8125 11.0417 18.875 11.125C18.9583 11.1875 19 11.2708 19 11.375V12.375C19 12.4792 18.9583 12.5729 18.875 12.6562C18.8125 12.7188 18.7292 12.75 18.625 12.75ZM18.625 17.75H5.375C5.27083 17.75 5.17708 17.7188 5.09375 17.6562C5.03125 17.5729 5 17.4792 5 17.375V16.375C5 16.2708 5.03125 16.1875 5.09375 16.125C5.17708 16.0417 5.27083 16 5.375 16H18.625C18.7292 16 18.8125 16.0417 18.875 16.125C18.9583 16.1875 19 16.2708 19 16.375V17.375C19 17.4792 18.9583 17.5729 18.875 17.6562C18.8125 17.7188 18.7292 17.75 18.625 17.75Z",
7562
7574
  fill: "currentColor"
7563
7575
  }));
7564
- const close$3 = () => /* @__PURE__ */ React__default.createElement("svg", {
7576
+ const close$4 = () => /* @__PURE__ */ React__default.createElement("svg", {
7565
7577
  xmlns: "http://www.w3.org/2000/svg",
7566
7578
  viewBox: "0 0 18.121 18.121"
7567
7579
  }, /* @__PURE__ */ React__default.createElement("g", {
@@ -8728,7 +8740,7 @@ var icons$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
8728
8740
  roundTable,
8729
8741
  linkedin,
8730
8742
  menu,
8731
- close: close$3,
8743
+ close: close$4,
8732
8744
  home,
8733
8745
  chevronDown,
8734
8746
  chevronRight,
@@ -27712,7 +27724,7 @@ var now_1 = now$1;
27712
27724
  var isObject$c = isObject_1, now = now_1, toNumber = toNumber_1;
27713
27725
  var FUNC_ERROR_TEXT$3 = "Expected a function";
27714
27726
  var nativeMax$3 = Math.max, nativeMin = Math.min;
27715
- function debounce$2(func, wait, options2) {
27727
+ function debounce$1(func, wait, options2) {
27716
27728
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
27717
27729
  if (typeof func != "function") {
27718
27730
  throw new TypeError(FUNC_ERROR_TEXT$3);
@@ -27793,7 +27805,7 @@ function debounce$2(func, wait, options2) {
27793
27805
  debounced.flush = flush;
27794
27806
  return debounced;
27795
27807
  }
27796
- var debounce_1 = debounce$2;
27808
+ var debounce_1 = debounce$1;
27797
27809
  var RowContext = /* @__PURE__ */ createContext({});
27798
27810
  var RowContext$1 = RowContext;
27799
27811
  var __rest$7 = globalThis && globalThis.__rest || function(s2, e3) {
@@ -74873,7 +74885,7 @@ var findIndex_1 = findIndex$2;
74873
74885
  var createFind = _createFind, findIndex$1 = findIndex_1;
74874
74886
  var find2 = createFind(findIndex$1);
74875
74887
  var find_1 = find2;
74876
- var debounce$1 = debounce_1, isObject$1 = isObject_1;
74888
+ var debounce = debounce_1, isObject$1 = isObject_1;
74877
74889
  var FUNC_ERROR_TEXT = "Expected a function";
74878
74890
  function throttle(func, wait, options2) {
74879
74891
  var leading = true, trailing = true;
@@ -74884,7 +74896,7 @@ function throttle(func, wait, options2) {
74884
74896
  leading = "leading" in options2 ? !!options2.leading : leading;
74885
74897
  trailing = "trailing" in options2 ? !!options2.trailing : trailing;
74886
74898
  }
74887
- return debounce$1(func, wait, {
74899
+ return debounce(func, wait, {
74888
74900
  "leading": leading,
74889
74901
  "maxWait": wait,
74890
74902
  "trailing": trailing
@@ -78540,8 +78552,8 @@ const GetListingCategories = async () => {
78540
78552
  });
78541
78553
  return data2;
78542
78554
  };
78543
- const container$q = "_container_gdpqk_1";
78544
- const footer$8 = "_footer_gdpqk_5";
78555
+ const container$q = "_container_d8rq4_1";
78556
+ const footer$8 = "_footer_d8rq4_5";
78545
78557
  var styles$Y = {
78546
78558
  container: container$q,
78547
78559
  footer: footer$8
@@ -78561,8 +78573,8 @@ const Form$a = ({
78561
78573
  });
78562
78574
  const { isExecuting, execute } = useService(UpdateVenueListing, {
78563
78575
  onSuccess: async () => {
78564
- await reload();
78565
78576
  onCloseForm();
78577
+ await reload();
78566
78578
  }
78567
78579
  });
78568
78580
  const handleSubmit = (data2) => {
@@ -78620,10 +78632,15 @@ const Form$a = ({
78620
78632
  })))), /* @__PURE__ */ React__default.createElement("div", {
78621
78633
  className: styles$Y.footer
78622
78634
  }, /* @__PURE__ */ React__default.createElement(Button$3, {
78635
+ size: "small",
78636
+ type: "reset",
78637
+ disabled: isExecuting,
78638
+ onClick: onCloseForm
78639
+ }, t2("CANCEL")), /* @__PURE__ */ React__default.createElement(Button$3, {
78623
78640
  size: "small",
78624
78641
  type: "submit",
78625
- isLoading: isExecuting
78626
- }, t2("SAVE"))))));
78642
+ disabled: isExecuting
78643
+ }, t2("SYNC"))))));
78627
78644
  };
78628
78645
  const Description = ({
78629
78646
  values,
@@ -79612,11 +79629,10 @@ const FbButton$1 = ({
79612
79629
  style: {
79613
79630
  color: "gray",
79614
79631
  padding: ".5rem"
79615
- },
79616
- isLoading: isDisconnecting
79632
+ }
79617
79633
  }, /* @__PURE__ */ React__default.createElement("span", {
79618
79634
  className: styles$X.connectedText
79619
- }, t2("CONNECTED")), /* @__PURE__ */ React__default.createElement("span", {
79635
+ }, isDisconnecting ? t2("SYNCING") : t2("SYNCKED")), /* @__PURE__ */ React__default.createElement("span", {
79620
79636
  className: styles$X.connectedCheck
79621
79637
  }, /* @__PURE__ */ React__default.createElement("img", {
79622
79638
  src: Check,
@@ -84384,16 +84400,15 @@ const GoogleButton$1 = ({
84384
84400
  mode: "tertiary",
84385
84401
  type: "button",
84386
84402
  onClick: handleDisconect,
84387
- style: { color: "gray", padding: ".5rem" },
84388
- isLoading: isDisconnecting
84389
- }, /* @__PURE__ */ React__default.createElement("span", {
84403
+ style: { color: "gray", padding: ".5rem" }
84404
+ }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("span", {
84390
84405
  className: styles$W.connectedText
84391
- }, t2("CONNECTED")), /* @__PURE__ */ React__default.createElement("span", {
84406
+ }, isDisconnecting ? t2("SYNCING") : t2("SYNCKED")), /* @__PURE__ */ React__default.createElement("span", {
84392
84407
  className: styles$W.connectedCheck
84393
84408
  }, /* @__PURE__ */ React__default.createElement("img", {
84394
84409
  src: Check,
84395
84410
  alt: "Connected"
84396
- })));
84411
+ }))));
84397
84412
  }
84398
84413
  return /* @__PURE__ */ React__default.createElement(Button$3, {
84399
84414
  size: "small",
@@ -84451,7 +84466,7 @@ const BingButton$1 = ({
84451
84466
  width: "20"
84452
84467
  }), /* @__PURE__ */ React__default.createElement("span", {
84453
84468
  className: styles$V.connectedText
84454
- }, t2("CONNECTED")), /* @__PURE__ */ React__default.createElement("span", {
84469
+ }, t2("SYNCKED")), /* @__PURE__ */ React__default.createElement("span", {
84455
84470
  className: styles$V.connectedCheck
84456
84471
  }, /* @__PURE__ */ React__default.createElement("img", {
84457
84472
  src: Check,
@@ -84565,26 +84580,8 @@ var styles$U = {
84565
84580
  buttonGroup,
84566
84581
  venueSelector
84567
84582
  };
84568
- const PublishVenueListing = async ({
84569
- venueListingId,
84570
- accessToken,
84571
- platform: platform2
84572
- }) => {
84573
- const response = await instance$1.post(`/listing/venue-listing/${venueListingId}/publish/${platform2}`, {}, {
84574
- headers: {
84575
- Authorization: `Bearer ${accessToken}`
84576
- }
84577
- });
84578
- if ((response == null ? void 0 : response.published) !== "true") {
84579
- return { error: response };
84580
- } else {
84581
- return { data: response };
84582
- }
84583
- };
84584
84583
  const FormToolBar = ({
84585
84584
  venueId,
84586
- venueListingId,
84587
- onReload,
84588
84585
  singleVenue: singleVenue2,
84589
84586
  data: data2,
84590
84587
  setfbResponse,
@@ -84592,50 +84589,17 @@ const FormToolBar = ({
84592
84589
  onDisconnect,
84593
84590
  onConnect,
84594
84591
  onOnboarding,
84595
- onPublishing,
84596
84592
  onFreemium,
84597
84593
  onBingVerify,
84598
84594
  onBingConnect,
84599
- setGooglePublishing,
84600
- setFacebookPublishing,
84601
- setGoogleErrors,
84602
- setFacebookErrors,
84603
- onAppleConnectModal
84595
+ googlePublishing,
84596
+ facebookPublishing
84604
84597
  }) => {
84605
84598
  const { t: t2 } = useTranslation();
84606
84599
  const navigate = useNavigate();
84607
- const { showMessageError } = useMessage();
84608
84600
  const { FacebookConnected, GoogleConnected, BingConnected, AppleConnected, reload, isLoading: loadingConnections } = useConnect({
84609
84601
  venueId
84610
84602
  });
84611
- const { execute: publishGoogle, isExecuting: isPublishingGoogle, error: errorGoogle, data: rGoogle } = useService(PublishVenueListing);
84612
- const { execute: publishFacebook, isExecuting: isPublishingFacebook, error: errorFacebook, data: responseFacebook } = useService(PublishVenueListing);
84613
- const handlePublish = async () => {
84614
- var _a2;
84615
- onPublishing();
84616
- if (!((_a2 = data2 == null ? void 0 : data2.mainCategory) == null ? void 0 : _a2.id)) {
84617
- showMessageError("Main category is required");
84618
- return;
84619
- }
84620
- setGooglePublishing("in_progress");
84621
- setFacebookPublishing("waiting");
84622
- const googleResponse = await publishGoogle({ venueListingId, platform: "google" });
84623
- if (errorGoogle !== void 0 && googleResponse === void 0) {
84624
- setGooglePublishing("error");
84625
- setGoogleErrors(errorGoogle);
84626
- } else {
84627
- setGooglePublishing("success");
84628
- }
84629
- setFacebookPublishing("in_progress");
84630
- const facebookResponse = await publishFacebook({ venueListingId, platform: "facebook" });
84631
- if (errorFacebook !== void 0 && facebookResponse === void 0) {
84632
- setFacebookPublishing("error");
84633
- setFacebookErrors(errorFacebook);
84634
- } else {
84635
- setFacebookPublishing("success");
84636
- }
84637
- onReload();
84638
- };
84639
84603
  const reloadConnect = () => {
84640
84604
  reload();
84641
84605
  };
@@ -84658,24 +84622,15 @@ const FormToolBar = ({
84658
84622
  venueId,
84659
84623
  isConnected: GoogleConnected,
84660
84624
  reload: reloadConnect,
84661
- onDisconnect
84662
- }), /* @__PURE__ */ React__default.createElement(Button$3, {
84663
- size: "small",
84664
- icon: "apple",
84665
- mode: "tertiary",
84666
- type: "button",
84667
- onClick: () => onAppleConnectModal(),
84668
- style: {
84669
- padding: ".5rem"
84670
- }
84671
- }, /* @__PURE__ */ React__default.createElement("span", {
84672
- className: styles$U.connectedText
84673
- }, t2("CONNECT"))), /* @__PURE__ */ React__default.createElement(FbButton$1, {
84625
+ onDisconnect,
84626
+ isDisconnecting: googlePublishing === "in_progress"
84627
+ }), /* @__PURE__ */ React__default.createElement(FbButton$1, {
84674
84628
  onSuccess: setfbResponse,
84675
84629
  isConnected: FacebookConnected,
84676
84630
  reload: reloadConnect,
84677
84631
  venueId,
84678
- onDisconnect
84632
+ onDisconnect,
84633
+ isDisconnecting: facebookPublishing === "in_progress"
84679
84634
  }), /* @__PURE__ */ React__default.createElement(BingButton$1, {
84680
84635
  venueId,
84681
84636
  bingVerificationCode: data2.bingVerificationCode,
@@ -84690,13 +84645,11 @@ const FormToolBar = ({
84690
84645
  size: "small",
84691
84646
  onClick: () => data2.license ? onOnboarding() : onFreemium(),
84692
84647
  type: "button"
84693
- }, t2("CONNECT")), !singleVenue2 && (GoogleConnected || FacebookConnected || BingConnected) && data2.license && /* @__PURE__ */ React__default.createElement(Button$3, {
84694
- size: "small",
84695
- onClick: handlePublish,
84696
- isLoading: isPublishingGoogle && isPublishingFacebook,
84697
- disabled: data2.status === "published",
84698
- type: "button"
84699
- }, t2("PUBLISH"))), /* @__PURE__ */ React__default.createElement("div", {
84648
+ }, t2("CONNECT")), (GoogleConnected || FacebookConnected || BingConnected) && /* @__PURE__ */ React__default.createElement("div", {
84649
+ style: { display: "flex", flexDirection: "row", justifyContent: "center", alignItems: "center", color: "gray", gap: 3 }
84650
+ }, /* @__PURE__ */ React__default.createElement("div", {
84651
+ style: { fontWeight: "bolder" }
84652
+ }, t2("LASTUPDATE"), ":"), /* @__PURE__ */ React__default.createElement("div", null, hooks(data2.lastUpdate).fromNow()))), /* @__PURE__ */ React__default.createElement("div", {
84700
84653
  className: styles$U.buttonGroup
84701
84654
  }, !singleVenue2 && /* @__PURE__ */ React__default.createElement("div", {
84702
84655
  className: styles$U.buttonGroup
@@ -84706,13 +84659,7 @@ const FormToolBar = ({
84706
84659
  onChange: handleChangeVenue,
84707
84660
  selectedVenue: venueId,
84708
84661
  showLabel: false
84709
- }))), singleVenue2 && (GoogleConnected || FacebookConnected || BingConnected) && data2.license && /* @__PURE__ */ React__default.createElement(Button$3, {
84710
- size: "small",
84711
- onClick: handlePublish,
84712
- isLoading: isPublishingGoogle && isPublishingFacebook,
84713
- disabled: data2.status === "published",
84714
- type: "button"
84715
- }, t2("PUBLISH"))))));
84662
+ })))))));
84716
84663
  };
84717
84664
  const mapcontainer = "_mapcontainer_1eyjs_1";
84718
84665
  var styles$T = {
@@ -90955,10 +90902,10 @@ const AddressAutoComplete = () => {
90955
90902
  onClickItem: onSelectSuggestion
90956
90903
  })));
90957
90904
  };
90958
- const form$3 = "_form_1r4wm_1";
90959
- const form__row1 = "_form__row1_1r4wm_8";
90960
- const form__row2 = "_form__row2_1r4wm_18";
90961
- const footer$7 = "_footer_1r4wm_29";
90905
+ const form$3 = "_form_7ju6w_1";
90906
+ const form__row1 = "_form__row1_7ju6w_8";
90907
+ const form__row2 = "_form__row2_7ju6w_18";
90908
+ const footer$7 = "_footer_7ju6w_29";
90962
90909
  var styles$Q = {
90963
90910
  form: form$3,
90964
90911
  form__row1,
@@ -90975,8 +90922,8 @@ const Form$9 = ({
90975
90922
  const { t: t2 } = useTranslation();
90976
90923
  const { isExecuting, execute } = useService(UpdateVenueListing, {
90977
90924
  onSuccess: async () => {
90978
- await reload();
90979
90925
  onCloseForm();
90926
+ await reload();
90980
90927
  }
90981
90928
  });
90982
90929
  const handleSubmit = (data2) => {
@@ -91015,10 +90962,15 @@ const Form$9 = ({
91015
90962
  }, t2("")), /* @__PURE__ */ React__default.createElement(MapField, null))), /* @__PURE__ */ React__default.createElement("div", {
91016
90963
  className: styles$Q.footer
91017
90964
  }, /* @__PURE__ */ React__default.createElement(Button$3, {
90965
+ size: "small",
90966
+ type: "reset",
90967
+ disabled: isExecuting,
90968
+ onClick: onCloseForm
90969
+ }, t2("CANCEL")), /* @__PURE__ */ React__default.createElement(Button$3, {
91018
90970
  size: "small",
91019
90971
  type: "submit",
91020
- isLoading: isExecuting
91021
- }, t2("SAVE"))))));
90972
+ disabled: isExecuting
90973
+ }, t2("SYNC"))))));
91022
90974
  };
91023
90975
  const Location = ({
91024
90976
  values,
@@ -91172,13 +91124,13 @@ const TimeSlotField = ({ id: id2, type: type4 = "time" }) => {
91172
91124
  };
91173
91125
  const container$n = "_container_191ph_1";
91174
91126
  const slot$6 = "_slot_191ph_8";
91175
- const close$2 = "_close_191ph_14";
91127
+ const close$3 = "_close_191ph_14";
91176
91128
  const add$2 = "_add_191ph_28";
91177
91129
  const plus$2 = "_plus_191ph_42";
91178
91130
  var styles$N = {
91179
91131
  container: container$n,
91180
91132
  slot: slot$6,
91181
- close: close$2,
91133
+ close: close$3,
91182
91134
  add: add$2,
91183
91135
  plus: plus$2
91184
91136
  };
@@ -91377,8 +91329,8 @@ const formarSpecialHours$1 = ({ specialHours }) => {
91377
91329
  specialHours: data2
91378
91330
  };
91379
91331
  };
91380
- const form$2 = "_form_1sml0_1";
91381
- const footer$6 = "_footer_1sml0_5";
91332
+ const form$2 = "_form_17xjl_1";
91333
+ const footer$6 = "_footer_17xjl_5";
91382
91334
  var styles$J = {
91383
91335
  form: form$2,
91384
91336
  footer: footer$6
@@ -91393,8 +91345,8 @@ const Form$8 = ({
91393
91345
  const { t: t2 } = useTranslation();
91394
91346
  const { isExecuting, execute } = useService(UpdateVenueListingHours, {
91395
91347
  onSuccess: async () => {
91396
- await reload();
91397
91348
  onCloseForm();
91349
+ await reload();
91398
91350
  }
91399
91351
  });
91400
91352
  const handleSubmit = (data2) => {
@@ -91416,10 +91368,15 @@ const Form$8 = ({
91416
91368
  }), /* @__PURE__ */ React__default.createElement("div", {
91417
91369
  className: styles$J.footer
91418
91370
  }, /* @__PURE__ */ React__default.createElement(Button$3, {
91371
+ size: "small",
91372
+ type: "reset",
91373
+ disabled: isExecuting,
91374
+ onClick: onCloseForm
91375
+ }, t2("CANCEL")), /* @__PURE__ */ React__default.createElement(Button$3, {
91419
91376
  size: "small",
91420
91377
  type: "submit",
91421
- isLoading: isExecuting
91422
- }, t2("SAVE"))))));
91378
+ disabled: isExecuting
91379
+ }, t2("SYNC"))))));
91423
91380
  };
91424
91381
  const OpeningHours = ({
91425
91382
  values,
@@ -91884,63 +91841,10 @@ const formatName = ({ name, onlyFor }) => {
91884
91841
  }
91885
91842
  return `${name}`;
91886
91843
  };
91887
- var functionDebounce = debounce;
91888
- function debounce(fn, wait, callFirst) {
91889
- var timeout = null;
91890
- var debouncedFn = null;
91891
- var clear = function() {
91892
- if (timeout) {
91893
- clearTimeout(timeout);
91894
- debouncedFn = null;
91895
- timeout = null;
91896
- }
91897
- };
91898
- var flush = function() {
91899
- var call2 = debouncedFn;
91900
- clear();
91901
- if (call2) {
91902
- call2();
91903
- }
91904
- };
91905
- var debounceWrapper = function() {
91906
- if (!wait) {
91907
- return fn.apply(this, arguments);
91908
- }
91909
- var context = this;
91910
- var args = arguments;
91911
- var callNow = callFirst && !timeout;
91912
- clear();
91913
- debouncedFn = function() {
91914
- fn.apply(context, args);
91915
- };
91916
- timeout = setTimeout(function() {
91917
- timeout = null;
91918
- if (!callNow) {
91919
- var call2 = debouncedFn;
91920
- debouncedFn = null;
91921
- return call2();
91922
- }
91923
- }, wait);
91924
- if (callNow) {
91925
- return debouncedFn();
91926
- }
91927
- };
91928
- debounceWrapper.cancel = clear;
91929
- debounceWrapper.flush = flush;
91930
- return debounceWrapper;
91931
- }
91932
91844
  const container$h = "_container_9ml9s_1";
91933
91845
  var styles$G = {
91934
91846
  container: container$h
91935
91847
  };
91936
- const AutoSave = ({ debounceMs }) => {
91937
- const formik = useFormikContext();
91938
- const debouncedSubmit = React__default.useCallback(functionDebounce(() => formik.submitForm(), debounceMs), [debounceMs, formik.submitForm]);
91939
- React__default.useEffect(() => {
91940
- debouncedSubmit();
91941
- }, [debouncedSubmit, formik.values]);
91942
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
91943
- };
91944
91848
  const Form$7 = ({
91945
91849
  open,
91946
91850
  onCloseForm,
@@ -91955,8 +91859,11 @@ const Form$7 = ({
91955
91859
  cacheId: "listingAttributes"
91956
91860
  });
91957
91861
  const cleanAttributes = attributes2 == null ? void 0 : attributes2.filter((a2) => a2.title !== "Place page URLs");
91958
- const { execute } = useService(UpdateVenueListing, {
91959
- onSuccess: reload
91862
+ const { execute, isExecuting } = useService(UpdateVenueListing, {
91863
+ onSuccess: async () => {
91864
+ onCloseForm();
91865
+ await reload();
91866
+ }
91960
91867
  });
91961
91868
  const handleSubmit = (data2) => {
91962
91869
  execute({ venueListingId, data: data2 });
@@ -91977,9 +91884,7 @@ const Form$7 = ({
91977
91884
  onSubmit: handleSubmit
91978
91885
  }, /* @__PURE__ */ React__default.createElement(Form$c, null, /* @__PURE__ */ React__default.createElement("div", {
91979
91886
  className: styles$G.container
91980
- }, /* @__PURE__ */ React__default.createElement(AutoSave, {
91981
- debounceMs: 600
91982
- }), /* @__PURE__ */ React__default.createElement("div", {
91887
+ }, /* @__PURE__ */ React__default.createElement("div", {
91983
91888
  style: {
91984
91889
  display: "flex",
91985
91890
  flexDirection: "column",
@@ -92001,7 +91906,24 @@ const Form$7 = ({
92001
91906
  attributes: extraFields
92002
91907
  }));
92003
91908
  }
92004
- }))))));
91909
+ })), /* @__PURE__ */ React__default.createElement("div", {
91910
+ style: {
91911
+ display: "flex",
91912
+ justifyContent: "flex-end",
91913
+ alignItems: "center",
91914
+ marginTop: "1rem",
91915
+ gap: 10
91916
+ }
91917
+ }, /* @__PURE__ */ React__default.createElement(Button$3, {
91918
+ size: "small",
91919
+ type: "reset",
91920
+ disabled: isExecuting,
91921
+ onClick: onCloseForm
91922
+ }, t2("CANCEL")), /* @__PURE__ */ React__default.createElement(Button$3, {
91923
+ size: "small",
91924
+ type: "submit",
91925
+ disabled: isExecuting
91926
+ }, t2("SYNC")))))));
92005
91927
  };
92006
91928
  const Attributes = ({
92007
91929
  values,
@@ -92053,8 +91975,8 @@ const Form$6 = ({
92053
91975
  const { t: t2 } = useTranslation();
92054
91976
  const { isExecuting, execute } = useService(UpdateVenueListing, {
92055
91977
  onSuccess: async () => {
92056
- await reload();
92057
91978
  onCloseForm();
91979
+ await reload();
92058
91980
  }
92059
91981
  });
92060
91982
  const handleSubmit = (data2) => {
@@ -92084,13 +92006,19 @@ const Form$6 = ({
92084
92006
  display: "flex",
92085
92007
  justifyContent: "flex-end",
92086
92008
  alignItems: "center",
92087
- marginTop: "1rem"
92009
+ marginTop: "1rem",
92010
+ gap: 10
92088
92011
  }
92089
92012
  }, /* @__PURE__ */ React__default.createElement(Button$3, {
92013
+ size: "small",
92014
+ type: "reset",
92015
+ disabled: isExecuting,
92016
+ onClick: onCloseForm
92017
+ }, t2("CANCEL")), /* @__PURE__ */ React__default.createElement(Button$3, {
92090
92018
  size: "small",
92091
92019
  type: "submit",
92092
- isLoading: isExecuting
92093
- }, t2("SAVE"))))));
92020
+ disabled: isExecuting
92021
+ }, t2("SYNC"))))));
92094
92022
  };
92095
92023
  const Contact = ({
92096
92024
  values,
@@ -92111,8 +92039,8 @@ const Contact = ({
92111
92039
  reload
92112
92040
  }));
92113
92041
  };
92114
- const container$g = "_container_vau7j_1";
92115
- const footer$5 = "_footer_vau7j_6";
92042
+ const container$g = "_container_1q4zb_1";
92043
+ const footer$5 = "_footer_1q4zb_6";
92116
92044
  var styles$F = {
92117
92045
  container: container$g,
92118
92046
  footer: footer$5
@@ -93620,8 +93548,8 @@ const Form$5 = ({
93620
93548
  const { t: t2 } = useTranslation();
93621
93549
  const { isExecuting, execute } = useService(UpdateVenueListingMedia, {
93622
93550
  onSuccess: async () => {
93623
- await reload();
93624
93551
  onCloseForm();
93552
+ await reload();
93625
93553
  }
93626
93554
  });
93627
93555
  const handleSubmit = (data2) => {
@@ -93639,10 +93567,15 @@ const Form$5 = ({
93639
93567
  }, /* @__PURE__ */ React__default.createElement(MediaPage, null)), /* @__PURE__ */ React__default.createElement("div", {
93640
93568
  className: styles$F.footer
93641
93569
  }, /* @__PURE__ */ React__default.createElement(Button$3, {
93570
+ size: "small",
93571
+ type: "reset",
93572
+ disabled: isExecuting,
93573
+ onClick: onCloseForm
93574
+ }, t2("CANCEL")), /* @__PURE__ */ React__default.createElement(Button$3, {
93642
93575
  size: "small",
93643
93576
  type: "submit",
93644
- isLoading: isExecuting
93645
- }, t2("SAVE"))))));
93577
+ disabled: isExecuting
93578
+ }, t2("SYNC"))))));
93646
93579
  };
93647
93580
  const MediaCard = ({ values, onClickEdit }) => {
93648
93581
  var _a2;
@@ -93771,8 +93704,8 @@ const Form$4 = ({
93771
93704
  const attrLinks = (attributes2 == null ? void 0 : attributes2.length) > 0 ? (_a2 = attributes2.find((a2) => a2.title === "Place page URLs")) == null ? void 0 : _a2.openDefault : null;
93772
93705
  const { isExecuting, execute } = useService(UpdateVenueListing, {
93773
93706
  onSuccess: async () => {
93774
- await reload();
93775
93707
  onCloseForm();
93708
+ await reload();
93776
93709
  }
93777
93710
  });
93778
93711
  const handleSubmit = (data2) => {
@@ -93819,13 +93752,19 @@ const Form$4 = ({
93819
93752
  display: "flex",
93820
93753
  justifyContent: "flex-end",
93821
93754
  alignItems: "center",
93822
- marginTop: "1rem"
93755
+ marginTop: "1rem",
93756
+ gap: 10
93823
93757
  }
93824
93758
  }, /* @__PURE__ */ React__default.createElement(Button$3, {
93759
+ size: "small",
93760
+ type: "reset",
93761
+ disabled: isExecuting,
93762
+ onClick: onCloseForm
93763
+ }, t2("CANCEL")), /* @__PURE__ */ React__default.createElement(Button$3, {
93825
93764
  size: "small",
93826
93765
  type: "submit",
93827
- isLoading: isExecuting
93828
- }, t2("SAVE"))))));
93766
+ disabled: isExecuting
93767
+ }, t2("SYNC"))))));
93829
93768
  };
93830
93769
  const Links = ({ values, venueListingId, reload }) => {
93831
93770
  const [openForm, setOpenForm] = useState(false);
@@ -93878,14 +93817,16 @@ const Account = ({ name, onClick, selected }) => {
93878
93817
  onClick
93879
93818
  }, name);
93880
93819
  };
93881
- const selectAccount$1 = "_selectAccount_1jze1_1";
93882
- const selectAccount__title$1 = "_selectAccount__title_1jze1_7";
93883
- const account$1 = "_account_1jze1_12";
93820
+ const selectAccount$1 = "_selectAccount_1cl8x_1";
93821
+ const selectAccount__title$1 = "_selectAccount__title_1cl8x_7";
93822
+ const account$1 = "_account_1cl8x_12";
93823
+ const close$2 = "_close_1cl8x_27";
93884
93824
  var styles$w = {
93885
93825
  selectAccount: selectAccount$1,
93886
93826
  selectAccount__title: selectAccount__title$1,
93887
93827
  account: account$1,
93888
- "account--selected": "_account--selected_1jze1_23"
93828
+ "account--selected": "_account--selected_1cl8x_23",
93829
+ close: close$2
93889
93830
  };
93890
93831
  const SelectAccount$1 = ({
93891
93832
  accounts,
@@ -93893,15 +93834,42 @@ const SelectAccount$1 = ({
93893
93834
  isLoading
93894
93835
  }) => {
93895
93836
  const { t: t2 } = useTranslation();
93837
+ const [searchValue, setSearchValue] = useState("");
93896
93838
  const [selectedAccount, setSelectedAccount] = useState();
93839
+ const [filteredAccounts, setFilteredAccounts] = useState([]);
93897
93840
  const onSelectAccount = (value2) => {
93898
93841
  setSelectedAccount(value2);
93899
93842
  };
93843
+ const handleSearchAccount = (e3) => {
93844
+ setSearchValue(e3.target.value);
93845
+ setFilteredAccounts(accounts.filter((a2) => a2.title.toLowerCase().includes(e3.target.value)));
93846
+ };
93847
+ useEffect(() => {
93848
+ setFilteredAccounts(accounts);
93849
+ }, [accounts]);
93900
93850
  return /* @__PURE__ */ React__default.createElement("div", {
93901
93851
  className: styles$w.selectAccount
93902
93852
  }, /* @__PURE__ */ React__default.createElement("div", {
93903
93853
  className: styles$w.selectAccount__title
93904
- }, "Select an account"), /* @__PURE__ */ React__default.createElement("div", null, "Please select an accout that you want to connect to Google"), /* @__PURE__ */ React__default.createElement("br", null), accounts.map((account2) => {
93854
+ }, "Select an account"), /* @__PURE__ */ React__default.createElement("div", null, "Please select an accout that you want to connect to Google"), /* @__PURE__ */ React__default.createElement("div", {
93855
+ style: { display: "flex", gap: 30, alignItems: "center" }
93856
+ }, /* @__PURE__ */ React__default.createElement("div", {
93857
+ style: { flex: 1 }
93858
+ }, /* @__PURE__ */ React__default.createElement(Input$1, {
93859
+ id: "table-name",
93860
+ label: t2("SEARCH"),
93861
+ type: "text",
93862
+ value: searchValue,
93863
+ placeholder: "Search ....",
93864
+ onChange: (e3) => handleSearchAccount(e3)
93865
+ })), searchValue && searchValue.length > 0 && /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("button", {
93866
+ className: styles$w.close,
93867
+ type: "button",
93868
+ onClick: () => {
93869
+ setSearchValue("");
93870
+ setFilteredAccounts(accounts);
93871
+ }
93872
+ }, "X"))), /* @__PURE__ */ React__default.createElement("br", null), filteredAccounts.map((account2) => {
93905
93873
  return /* @__PURE__ */ React__default.createElement(Account, {
93906
93874
  key: account2.name,
93907
93875
  name: account2.title,
@@ -94454,7 +94422,7 @@ const ModalPublish = ({
94454
94422
  facebookPublishing,
94455
94423
  facebookErrors = null
94456
94424
  }) => {
94457
- useTranslation();
94425
+ const { t: t2 } = useTranslation();
94458
94426
  const { FacebookConnected, GoogleConnected, BingConnected } = useConnect({
94459
94427
  venueId
94460
94428
  });
@@ -94467,7 +94435,7 @@ const ModalPublish = ({
94467
94435
  centered: true,
94468
94436
  zIndex: 1e3,
94469
94437
  className: "moz"
94470
- }, /* @__PURE__ */ React__default.createElement("h2", null, "Submitting information"), /* @__PURE__ */ React__default.createElement("ul", {
94438
+ }, /* @__PURE__ */ React__default.createElement("h2", null, t2("ERRORSYNC")), /* @__PURE__ */ React__default.createElement("ul", {
94471
94439
  className: styles$p.channels
94472
94440
  }, GoogleConnected && /* @__PURE__ */ React__default.createElement("li", {
94473
94441
  className: styles$p.channelsLi
@@ -94662,6 +94630,22 @@ const ModalAppleConnect = ({ onClose: onClose2, open }) => {
94662
94630
  zIndex: 1032
94663
94631
  }, /* @__PURE__ */ React__default.createElement("h2", null, "Getting Started"), /* @__PURE__ */ React__default.createElement("p", null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vitae consectetur arcu. Aliquam bibendum eget ex vel feugiat. Morbi ullamcorper lacinia tincidunt. Mauris elementum et nunc vel gravida. Aliquam erat volutpat."));
94664
94632
  };
94633
+ const PublishVenueListing = async ({
94634
+ venueListingId,
94635
+ accessToken,
94636
+ platform: platform2
94637
+ }) => {
94638
+ const response = await instance$1.post(`/listing/venue-listing/${venueListingId}/publish/${platform2}`, {}, {
94639
+ headers: {
94640
+ Authorization: `Bearer ${accessToken}`
94641
+ }
94642
+ });
94643
+ if ((response == null ? void 0 : response.published) !== "true") {
94644
+ return { error: response };
94645
+ } else {
94646
+ return { data: response };
94647
+ }
94648
+ };
94665
94649
  const VenueListingDetail = ({
94666
94650
  venueListingId,
94667
94651
  singleVenue: singleVenue2
@@ -94678,17 +94662,19 @@ const VenueListingDetail = ({
94678
94662
  const clearModuleToDisconnect = () => setModuleToDisconnect(void 0);
94679
94663
  const clearModuleToConnect = () => setModuleToConnect(void 0);
94680
94664
  const [showAppleConnectModal, setShowAppleConnectModal] = useState(false);
94681
- const onAppleConnectModal = () => setShowAppleConnectModal(true);
94682
94665
  const [googlePublishing, setGooglePublishing] = useState();
94683
94666
  const [facebookPublishing, setFacebookPublishing] = useState();
94684
94667
  const [googleErrors, setGoogleErrors] = useState();
94685
94668
  const [facebookErrors, setFacebookErrors] = useState();
94669
+ const { showMessageError } = useMessage();
94686
94670
  const { data: data2, isLoading, error: error3, reload } = useFetch(GetVenueListing, {
94687
94671
  cacheId: `venue-listing-${venueListingId}`,
94688
94672
  venueListingId
94689
94673
  });
94690
94674
  const venueId = data2 == null ? void 0 : data2.venueId;
94691
94675
  const { reload: _reloadConnect } = useConnect({ venueId });
94676
+ const { execute: publishGoogle, isExecuting: isPublishingGoogle, error: errorGoogle, data: rGoogle } = useService(PublishVenueListing);
94677
+ const { execute: publishFacebook, isExecuting: isPublishingFacebook, error: errorFacebook, data: responseFacebook } = useService(PublishVenueListing);
94692
94678
  const reloadConnect = () => {
94693
94679
  handlePopulate();
94694
94680
  _reloadConnect();
@@ -94734,6 +94720,32 @@ const VenueListingDetail = ({
94734
94720
  }
94735
94721
  });
94736
94722
  };
94723
+ const handleOnPublish = async () => {
94724
+ var _a2;
94725
+ setOpenPublishModal(true);
94726
+ if (!((_a2 = data2 == null ? void 0 : data2.mainCategory) == null ? void 0 : _a2.id)) {
94727
+ showMessageError("Main category is required");
94728
+ return;
94729
+ }
94730
+ setGooglePublishing("in_progress");
94731
+ setFacebookPublishing("waiting");
94732
+ const googleResponse2 = await publishGoogle({ venueListingId, platform: "google" });
94733
+ if (errorGoogle !== void 0 && googleResponse2 === void 0) {
94734
+ setGooglePublishing("error");
94735
+ setGoogleErrors(errorGoogle);
94736
+ } else {
94737
+ setGooglePublishing("success");
94738
+ }
94739
+ setFacebookPublishing("in_progress");
94740
+ const facebookResponse = await publishFacebook({ venueListingId, platform: "facebook" });
94741
+ if (errorFacebook !== void 0 && facebookResponse === void 0) {
94742
+ setFacebookPublishing("error");
94743
+ setFacebookErrors(errorFacebook);
94744
+ } else {
94745
+ setFacebookPublishing("success");
94746
+ }
94747
+ await reload();
94748
+ };
94737
94749
  if (isLoading) {
94738
94750
  return /* @__PURE__ */ React__default.createElement(SkeletonPage, null);
94739
94751
  }
@@ -94756,8 +94768,6 @@ const VenueListingDetail = ({
94756
94768
  return /* @__PURE__ */ React__default.createElement(LayoutPage$1, {
94757
94769
  header: /* @__PURE__ */ React__default.createElement(FormToolBar, {
94758
94770
  venueId,
94759
- venueListingId,
94760
- onReload: reload,
94761
94771
  singleVenue: singleVenue2,
94762
94772
  data: data2,
94763
94773
  setfbResponse,
@@ -94765,15 +94775,11 @@ const VenueListingDetail = ({
94765
94775
  onDisconnect: setModuleToDisconnect,
94766
94776
  onConnect: setModuleToConnect,
94767
94777
  onOnboarding: () => setOpenOnboarding(true),
94768
- onPublishing: () => setOpenPublishModal(true),
94769
94778
  onFreemium: () => setOpenFreemiumModal(true),
94770
94779
  onBingVerify: () => setOpenBingModal(true),
94771
94780
  onBingConnect: () => setOpenBingConnectModal(true),
94772
- setGooglePublishing,
94773
- setFacebookPublishing,
94774
- setGoogleErrors,
94775
- setFacebookErrors,
94776
- onAppleConnectModal
94781
+ googlePublishing,
94782
+ facebookPublishing
94777
94783
  })
94778
94784
  }, /* @__PURE__ */ React__default.createElement(Masonry, {
94779
94785
  breakpointCols: {
@@ -94785,35 +94791,35 @@ const VenueListingDetail = ({
94785
94791
  columnClassName: styles$y["my-masonry-grid_column"]
94786
94792
  }, /* @__PURE__ */ React__default.createElement(Description, {
94787
94793
  values: data2,
94788
- reload,
94794
+ reload: handleOnPublish,
94789
94795
  venueListingId
94790
94796
  }), /* @__PURE__ */ React__default.createElement(Location, {
94791
94797
  values: data2,
94792
- reload,
94798
+ reload: handleOnPublish,
94793
94799
  venueListingId
94794
94800
  }), /* @__PURE__ */ React__default.createElement(OpeningHours, {
94795
94801
  values: data2,
94796
- reload,
94802
+ reload: handleOnPublish,
94797
94803
  venueListingId,
94798
94804
  handleOpenForBussiness,
94799
94805
  temporarilyClosed: data2.openForBusiness === "CLOSED_TEMPORARILY"
94800
94806
  }), /* @__PURE__ */ React__default.createElement(Attributes, {
94801
94807
  values: data2,
94802
- reload,
94808
+ reload: handleOnPublish,
94803
94809
  venueListingId
94804
94810
  }), /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(Contact, {
94805
94811
  values: data2,
94806
- reload,
94812
+ reload: handleOnPublish,
94807
94813
  venueListingId
94808
94814
  }), /* @__PURE__ */ React__default.createElement("div", {
94809
94815
  style: { height: 40 }
94810
94816
  }), /* @__PURE__ */ React__default.createElement(Links, {
94811
94817
  values: data2,
94812
- reload,
94818
+ reload: handleOnPublish,
94813
94819
  venueListingId
94814
94820
  })), /* @__PURE__ */ React__default.createElement(Media, {
94815
94821
  values: data2,
94816
- reload,
94822
+ reload: handleOnPublish,
94817
94823
  venueListingId
94818
94824
  })), /* @__PURE__ */ React__default.createElement(ModalConfirmation, {
94819
94825
  message: getAction(moduleToDisconnect),
@@ -94850,7 +94856,7 @@ const VenueListingDetail = ({
94850
94856
  open: showAppleConnectModal
94851
94857
  }), /* @__PURE__ */ React__default.createElement(ModalPublish, {
94852
94858
  onClose: closePublishModal,
94853
- open: Boolean(openPublishModal),
94859
+ open: Boolean(googleErrors || facebookErrors),
94854
94860
  venueId,
94855
94861
  googlePublishing,
94856
94862
  googleErrors,