mozrest-sdk-react-dev 0.1.18 → 0.1.20

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
@@ -3435,11 +3435,11 @@ const Container = ({
3435
3435
  };
3436
3436
  const container$t = "_container_zaez7_1";
3437
3437
  const header$7 = "_header_zaez7_5";
3438
- const content$a = "_content_zaez7_10";
3438
+ const content$9 = "_content_zaez7_10";
3439
3439
  var styles$1w = {
3440
3440
  container: container$t,
3441
3441
  header: header$7,
3442
- content: content$a
3442
+ content: content$9
3443
3443
  };
3444
3444
  const LayoutPage$1 = ({
3445
3445
  children,
@@ -7803,18 +7803,18 @@ function createMemoryHistory(options2) {
7803
7803
  }
7804
7804
  var _options3 = options2, _options3$initialEntr = _options3.initialEntries, initialEntries = _options3$initialEntr === void 0 ? ["/"] : _options3$initialEntr, initialIndex = _options3.initialIndex;
7805
7805
  var entries = initialEntries.map(function(entry) {
7806
- var location2 = readOnly(_extends$P({
7806
+ var location3 = readOnly(_extends$P({
7807
7807
  pathname: "/",
7808
7808
  search: "",
7809
7809
  hash: "",
7810
7810
  state: null,
7811
7811
  key: createKey()
7812
7812
  }, typeof entry === "string" ? parsePath(entry) : entry));
7813
- return location2;
7813
+ return location3;
7814
7814
  });
7815
7815
  var index2 = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);
7816
7816
  var action = Action.Pop;
7817
- var location = entries[index2];
7817
+ var location2 = entries[index2];
7818
7818
  var listeners = createEvents();
7819
7819
  var blockers = createEvents();
7820
7820
  function createHref(to2) {
@@ -7825,7 +7825,7 @@ function createMemoryHistory(options2) {
7825
7825
  state = null;
7826
7826
  }
7827
7827
  return readOnly(_extends$P({
7828
- pathname: location.pathname,
7828
+ pathname: location2.pathname,
7829
7829
  search: "",
7830
7830
  hash: ""
7831
7831
  }, typeof to2 === "string" ? parsePath(to2) : to2, {
@@ -7833,19 +7833,19 @@ function createMemoryHistory(options2) {
7833
7833
  key: createKey()
7834
7834
  }));
7835
7835
  }
7836
- function allowTx(action2, location2, retry) {
7836
+ function allowTx(action2, location3, retry) {
7837
7837
  return !blockers.length || (blockers.call({
7838
7838
  action: action2,
7839
- location: location2,
7839
+ location: location3,
7840
7840
  retry
7841
7841
  }), false);
7842
7842
  }
7843
7843
  function applyTx(nextAction, nextLocation) {
7844
7844
  action = nextAction;
7845
- location = nextLocation;
7845
+ location2 = nextLocation;
7846
7846
  listeners.call({
7847
7847
  action,
7848
- location
7848
+ location: location2
7849
7849
  });
7850
7850
  }
7851
7851
  function push2(to2, state) {
@@ -7891,7 +7891,7 @@ function createMemoryHistory(options2) {
7891
7891
  return action;
7892
7892
  },
7893
7893
  get location() {
7894
- return location;
7894
+ return location2;
7895
7895
  },
7896
7896
  createHref,
7897
7897
  push: push2,
@@ -7990,8 +7990,8 @@ function matchRoutes(routes2, locationArg, basename) {
7990
7990
  if (basename === void 0) {
7991
7991
  basename = "/";
7992
7992
  }
7993
- let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
7994
- let pathname = stripBasename(location.pathname || "/", basename);
7993
+ let location2 = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
7994
+ let pathname = stripBasename(location2.pathname || "/", basename);
7995
7995
  if (pathname == null) {
7996
7996
  return null;
7997
7997
  }
@@ -8285,16 +8285,16 @@ function useRoutes(routes2, locationArg) {
8285
8285
  let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
8286
8286
  routeMatch && routeMatch.route;
8287
8287
  let locationFromContext = useLocation();
8288
- let location;
8288
+ let location2;
8289
8289
  if (locationArg) {
8290
8290
  var _parsedLocationArg$pa;
8291
8291
  let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
8292
8292
  !(parentPathnameBase === "/" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? invariant$1(false) : void 0;
8293
- location = parsedLocationArg;
8293
+ location2 = parsedLocationArg;
8294
8294
  } else {
8295
- location = locationFromContext;
8295
+ location2 = locationFromContext;
8296
8296
  }
8297
- let pathname = location.pathname || "/";
8297
+ let pathname = location2.pathname || "/";
8298
8298
  let remainingPathname = parentPathnameBase === "/" ? pathname : pathname.slice(parentPathnameBase.length) || "/";
8299
8299
  let matches = matchRoutes(routes2, {
8300
8300
  pathname: remainingPathname
@@ -8378,7 +8378,7 @@ function Router(_ref3) {
8378
8378
  state = null,
8379
8379
  key: key2 = "default"
8380
8380
  } = locationProp;
8381
- let location = useMemo$1(() => {
8381
+ let location2 = useMemo$1(() => {
8382
8382
  let trailingPathname = stripBasename(pathname, basename);
8383
8383
  if (trailingPathname == null) {
8384
8384
  return null;
@@ -8391,7 +8391,7 @@ function Router(_ref3) {
8391
8391
  key: key2
8392
8392
  };
8393
8393
  }, [basename, pathname, search2, hash2, state, key2]);
8394
- if (location == null) {
8394
+ if (location2 == null) {
8395
8395
  return null;
8396
8396
  }
8397
8397
  return /* @__PURE__ */ createElement(NavigationContext.Provider, {
@@ -8399,7 +8399,7 @@ function Router(_ref3) {
8399
8399
  }, /* @__PURE__ */ createElement(LocationContext.Provider, {
8400
8400
  children,
8401
8401
  value: {
8402
- location,
8402
+ location: location2,
8403
8403
  navigationType
8404
8404
  }
8405
8405
  }));
@@ -8407,9 +8407,9 @@ function Router(_ref3) {
8407
8407
  function Routes(_ref4) {
8408
8408
  let {
8409
8409
  children,
8410
- location
8410
+ location: location2
8411
8411
  } = _ref4;
8412
- return useRoutes(createRoutesFromChildren(children), location);
8412
+ return useRoutes(createRoutesFromChildren(children), location2);
8413
8413
  }
8414
8414
  function createRoutesFromChildren(children) {
8415
8415
  let routes2 = [];
@@ -8447,9 +8447,9 @@ function createRoutesFromChildren(children) {
8447
8447
  */
8448
8448
  function useSearchParams(defaultInit) {
8449
8449
  let defaultSearchParamsRef = useRef(createSearchParams(defaultInit));
8450
- let location = useLocation();
8450
+ let location2 = useLocation();
8451
8451
  let searchParams = useMemo$1(() => {
8452
- let searchParams2 = createSearchParams(location.search);
8452
+ let searchParams2 = createSearchParams(location2.search);
8453
8453
  for (let key2 of defaultSearchParamsRef.current.keys()) {
8454
8454
  if (!searchParams2.has(key2)) {
8455
8455
  defaultSearchParamsRef.current.getAll(key2).forEach((value2) => {
@@ -8458,7 +8458,7 @@ function useSearchParams(defaultInit) {
8458
8458
  }
8459
8459
  }
8460
8460
  return searchParams2;
8461
- }, [location.search]);
8461
+ }, [location2.search]);
8462
8462
  let navigate = useNavigate();
8463
8463
  let setSearchParams = useCallback((nextInit, navigateOptions) => {
8464
8464
  navigate("?" + createSearchParams(nextInit), navigateOptions);
@@ -8557,11 +8557,9 @@ const Header$6 = ({ header: header2 }) => {
8557
8557
  className: styles$1u.icon
8558
8558
  }), typeof header2.icon !== "string" && header2.icon && header2.icon);
8559
8559
  };
8560
- const container$s = "_container_n9y0e_1";
8561
- const content$9 = "_content_n9y0e_8";
8560
+ const container$s = "_container_pd6ji_1";
8562
8561
  var styles$1t = {
8563
- container: container$s,
8564
- content: content$9
8562
+ container: container$s
8565
8563
  };
8566
8564
  const Card = ({
8567
8565
  header: header2,
@@ -8569,13 +8567,13 @@ const Card = ({
8569
8567
  className,
8570
8568
  classNameContent
8571
8569
  }) => {
8572
- return /* @__PURE__ */ React__default.createElement("div", {
8570
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
8573
8571
  className: classNames$3(styles$1t.container, className, "mz-card")
8574
8572
  }, /* @__PURE__ */ React__default.createElement(Header$6, {
8575
8573
  header: header2
8576
8574
  }), /* @__PURE__ */ React__default.createElement("div", {
8577
8575
  className: classNames$3(styles$1t.content, classNameContent)
8578
- }, children));
8576
+ }, children)));
8579
8577
  };
8580
8578
  var styles$1s = {
8581
8579
  "ui-list": "_ui-list_4zr5h_1",
@@ -8598,7 +8596,7 @@ function emptyFunctionWithReset() {
8598
8596
  }
8599
8597
  emptyFunctionWithReset.resetWarningCache = emptyFunction;
8600
8598
  var factoryWithThrowingShims = function() {
8601
- function shim(props, propName, componentName, location, propFullName, secret) {
8599
+ function shim(props, propName, componentName, location2, propFullName, secret) {
8602
8600
  if (secret === ReactPropTypesSecret) {
8603
8601
  return;
8604
8602
  }
@@ -41181,7 +41179,7 @@ const formarResult = (result) => {
41181
41179
  const id = result.place_id;
41182
41180
  const address = result.formatted_address;
41183
41181
  const components2 = result.address_components;
41184
- const location = result.geometry.location;
41182
+ const location2 = result.geometry.location;
41185
41183
  const city = ((_a2 = components2.find(({ types: types2 }) => types2.includes("locality"))) == null ? void 0 : _a2.long_name) || "";
41186
41184
  const state = ((_b = components2.find(({ types: types2 }) => types2.includes("administrative_area_level_1"))) == null ? void 0 : _b.long_name) || "";
41187
41185
  const countryId = ((_c = components2.find(({ types: types2 }) => types2.includes("country"))) == null ? void 0 : _c.short_name) || "";
@@ -41194,7 +41192,7 @@ const formarResult = (result) => {
41194
41192
  country,
41195
41193
  zipCode,
41196
41194
  address,
41197
- location
41195
+ location: location2
41198
41196
  };
41199
41197
  };
41200
41198
  const GetVenueListing = async ({
@@ -41207,9 +41205,9 @@ const GetVenueListing = async ({
41207
41205
  }
41208
41206
  });
41209
41207
  sessionStorage.setItem("sdk_venue_vertical", data2 == null ? void 0 : data2.vertical);
41210
- return formatData$c(data2);
41208
+ return formatData$d(data2);
41211
41209
  };
41212
- const formatData$c = async (values = {}) => {
41210
+ const formatData$d = async (values = {}) => {
41213
41211
  var _a2;
41214
41212
  const {
41215
41213
  country,
@@ -41230,7 +41228,7 @@ const formatData$c = async (values = {}) => {
41230
41228
  id: mainCategory == null ? void 0 : mainCategory.id,
41231
41229
  label: mainCategory == null ? void 0 : mainCategory.name
41232
41230
  } : void 0;
41233
- const location = await formatLocation(rest.address, latitude, longitude);
41231
+ const location2 = await formatLocation(rest.address, latitude, longitude);
41234
41232
  return {
41235
41233
  ...rest,
41236
41234
  mainCategory: _mainCategory,
@@ -41241,7 +41239,7 @@ const formatData$c = async (values = {}) => {
41241
41239
  regularHours: formarRegularHours$1(regularHours),
41242
41240
  specialHours: formarSpecialHours$1(specialHours),
41243
41241
  attributes: formatAttributes$1(attributes2),
41244
- ...location,
41242
+ ...location2,
41245
41243
  country: countryAux
41246
41244
  };
41247
41245
  };
@@ -41783,9 +41781,9 @@ const GetVenueListingModule = async ({
41783
41781
  Authorization: `Bearer ${accessToken}`
41784
41782
  }
41785
41783
  });
41786
- return formatData$b(data2);
41784
+ return formatData$c(data2);
41787
41785
  };
41788
- const formatData$b = (values = {}) => {
41786
+ const formatData$c = (values = {}) => {
41789
41787
  const { country, ...rest } = values;
41790
41788
  const _country = countries == null ? void 0 : countries.find(({ id }) => id === country);
41791
41789
  return {
@@ -41917,7 +41915,9 @@ const FormToolBar = ({
41917
41915
  className: styles$1c.toolbar
41918
41916
  }, /* @__PURE__ */ React__default.createElement("div", {
41919
41917
  className: styles$1c.buttonGroup
41920
- }, (GoogleConnected || FacebookConnected) && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(GoogleButtonContainer$1, {
41918
+ }, showBack && /* @__PURE__ */ React__default.createElement("div", {
41919
+ style: { paddingTop: ".5rem" }
41920
+ }, /* @__PURE__ */ React__default.createElement(BackButton, null)), (GoogleConnected || FacebookConnected) && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(GoogleButtonContainer$1, {
41921
41921
  onSuccess: setGoogleResponse,
41922
41922
  venueId,
41923
41923
  platform: platform2,
@@ -41947,9 +41947,7 @@ const FormToolBar = ({
41947
41947
  isLoading: isPublishingGoogle && isPublishingFacebook,
41948
41948
  disabled: data2.status === "published",
41949
41949
  type: "button"
41950
- }, t2("PUBLISH"))))), showBack && /* @__PURE__ */ React__default.createElement(Container, null, /* @__PURE__ */ React__default.createElement("div", {
41951
- style: { paddingTop: "1rem", marginBottom: -24 }
41952
- }, /* @__PURE__ */ React__default.createElement(BackButton, null))));
41950
+ }, t2("PUBLISH"))))));
41953
41951
  };
41954
41952
  const mapcontainer = "_mapcontainer_1eyjs_1";
41955
41953
  var styles$1a = {
@@ -42196,17 +42194,17 @@ function urlBuilder(property2, value2, separator) {
42196
42194
  }
42197
42195
  return null;
42198
42196
  }
42199
- function locationBuilder(location) {
42197
+ function locationBuilder(location2) {
42200
42198
  const urlParts = [];
42201
- if (Array.isArray(location)) {
42202
- const arrParts = location.map((val) => locationBuilder(val));
42199
+ if (Array.isArray(location2)) {
42200
+ const arrParts = location2.map((val) => locationBuilder(val));
42203
42201
  urlParts.push(...arrParts);
42204
42202
  }
42205
- if (typeof location === "string" || typeof location === "number") {
42206
- urlParts.push(location);
42203
+ if (typeof location2 === "string" || typeof location2 === "number") {
42204
+ urlParts.push(location2);
42207
42205
  }
42208
- if (typeof location === "object" && location.lat && location.lng) {
42209
- urlParts.push(`${location.lat},${location.lng}`);
42206
+ if (typeof location2 === "object" && location2.lat && location2.lng) {
42207
+ urlParts.push(`${location2.lat},${location2.lng}`);
42210
42208
  }
42211
42209
  return urlParts.join("%7C");
42212
42210
  }
@@ -42234,10 +42232,10 @@ const markerStrategy = ({
42234
42232
  label: label2,
42235
42233
  anchor,
42236
42234
  iconURL,
42237
- location,
42235
+ location: location2,
42238
42236
  scale
42239
42237
  } = props;
42240
- browser(location, "Marker expects a valid location prop");
42238
+ browser(location2, "Marker expects a valid location prop");
42241
42239
  let urlParts = [];
42242
42240
  urlParts.push(urlBuilder("size", size, ":"));
42243
42241
  urlParts.push(urlBuilder("color", color2, ":"));
@@ -42245,7 +42243,7 @@ const markerStrategy = ({
42245
42243
  urlParts.push(urlBuilder("anchor", anchor, ":"));
42246
42244
  urlParts.push(urlBuilder("scale", scale, ":"));
42247
42245
  urlParts.push(urlBuilder("icon", iconURL, ":"));
42248
- urlParts.push(urlBuilder("", locationBuilder(location), ""));
42246
+ urlParts.push(urlBuilder("", locationBuilder(location2), ""));
42249
42247
  const url2 = urlParts.filter((x2) => x2).join("%7C");
42250
42248
  return `markers=${url2}`;
42251
42249
  };
@@ -42287,7 +42285,7 @@ const markerGroupStrategy = ({
42287
42285
  children,
42288
42286
  scale
42289
42287
  } = props;
42290
- const location = Children.map(children, (child) => child.props.location);
42288
+ const location2 = Children.map(children, (child) => child.props.location);
42291
42289
  return markerStrategy({
42292
42290
  props: {
42293
42291
  size,
@@ -42295,7 +42293,7 @@ const markerGroupStrategy = ({
42295
42293
  label: label2,
42296
42294
  anchor,
42297
42295
  iconURL,
42298
- location,
42296
+ location: location2,
42299
42297
  scale
42300
42298
  },
42301
42299
  type: {
@@ -48750,9 +48748,9 @@ const GetListingAttributes = async ({
48750
48748
  Authorization: `Bearer ${accessToken}`
48751
48749
  }
48752
48750
  });
48753
- return formatData$a(data2.data);
48751
+ return formatData$b(data2.data);
48754
48752
  };
48755
- const formatData$a = (data2 = []) => {
48753
+ const formatData$b = (data2 = []) => {
48756
48754
  const dd = [...data2].sort((a2, b2) => {
48757
48755
  if (a2.position < b2.position) {
48758
48756
  return 1;
@@ -55291,7 +55289,7 @@ const GetReviews = async ({
55291
55289
  "sortby[createdAt]": "DESC"
55292
55290
  }
55293
55291
  });
55294
- return formatData$9(data2);
55292
+ return formatData$a(data2);
55295
55293
  };
55296
55294
  const formatParams$5 = (params) => {
55297
55295
  const all2 = {};
@@ -55316,7 +55314,7 @@ const formatParams$5 = (params) => {
55316
55314
  limit: 30
55317
55315
  };
55318
55316
  };
55319
- const formatData$9 = (data2) => {
55317
+ const formatData$a = (data2) => {
55320
55318
  return data2.map(({ reviewerProfilePhoto, reviewerName, reply: reply2, createdAt, ...item2 }) => ({
55321
55319
  ...item2,
55322
55320
  reviewer: {
@@ -56005,7 +56003,7 @@ const GetReplyTemplates = async ({
56005
56003
  offset: page * limit
56006
56004
  }
56007
56005
  });
56008
- return formatData$8(data2);
56006
+ return formatData$9(data2);
56009
56007
  };
56010
56008
  const formatParams$4 = (params = {}) => {
56011
56009
  let all2 = {};
@@ -56024,7 +56022,7 @@ const formatParams$4 = (params = {}) => {
56024
56022
  limit: 30
56025
56023
  };
56026
56024
  };
56027
- const formatData$8 = (data2) => {
56025
+ const formatData$9 = (data2) => {
56028
56026
  return data2.map((item2) => {
56029
56027
  return {
56030
56028
  id: item2.id,
@@ -56431,17 +56429,18 @@ const DetailDesktop = ({
56431
56429
  onSucess: onReload
56432
56430
  })));
56433
56431
  };
56434
- const container$c = "_container_1dp6q_1";
56435
- const light = "_light_1dp6q_4";
56436
- const active = "_active_1dp6q_7";
56437
- const resume = "_resume_1dp6q_11";
56438
- const resume__container = "_resume__container_1dp6q_14";
56439
- const left$1 = "_left_1dp6q_20";
56440
- const right = "_right_1dp6q_26";
56441
- const image = "_image_1dp6q_29";
56442
- const comment = "_comment_1dp6q_35";
56443
- const reviewer = "_reviewer_1dp6q_43";
56444
- const time$1 = "_time_1dp6q_55";
56432
+ const container$c = "_container_1rvtj_1";
56433
+ const light = "_light_1rvtj_4";
56434
+ const active = "_active_1rvtj_7";
56435
+ const resume = "_resume_1rvtj_11";
56436
+ const resume__container = "_resume__container_1rvtj_14";
56437
+ const left$1 = "_left_1rvtj_20";
56438
+ const right = "_right_1rvtj_26";
56439
+ const image = "_image_1rvtj_29";
56440
+ const comment = "_comment_1rvtj_35";
56441
+ const reviewer = "_reviewer_1rvtj_43";
56442
+ const location = "_location_1rvtj_48";
56443
+ const time$1 = "_time_1rvtj_53";
56445
56444
  var styles$x = {
56446
56445
  container: container$c,
56447
56446
  light,
@@ -56453,8 +56452,9 @@ var styles$x = {
56453
56452
  image,
56454
56453
  comment,
56455
56454
  reviewer,
56456
- "icon--center": "_icon--center_1dp6q_49",
56457
- time: time$1
56455
+ location,
56456
+ time: time$1,
56457
+ "icon--center": "_icon--center_1rvtj_60"
56458
56458
  };
56459
56459
  const Review = ({
56460
56460
  id,
@@ -56469,7 +56469,8 @@ const Review = ({
56469
56469
  onReload,
56470
56470
  openForm,
56471
56471
  onClick,
56472
- light: light2
56472
+ light: light2,
56473
+ multiVenue
56473
56474
  }) => {
56474
56475
  return /* @__PURE__ */ React__default.createElement("article", {
56475
56476
  className: classNames$3(styles$x.container, {
@@ -56505,11 +56506,13 @@ const Review = ({
56505
56506
  sm: 0
56506
56507
  }, /* @__PURE__ */ React__default.createElement(StartScore, {
56507
56508
  score: rating
56508
- }))))), /* @__PURE__ */ React__default.createElement("div", {
56509
+ }))))), multiVenue && /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", {
56510
+ className: styles$x.location
56511
+ }, locationName)), /* @__PURE__ */ React__default.createElement("div", {
56509
56512
  className: styles$x.right
56510
- }, /* @__PURE__ */ React__default.createElement("time", {
56513
+ }, /* @__PURE__ */ React__default.createElement("time", null, createdAt.substring(0, 10)), /* @__PURE__ */ React__default.createElement("time", {
56511
56514
  className: styles$x.time
56512
- }, createdAt.substring(0, 10)), /* @__PURE__ */ React__default.createElement("time", null, createdAt.substring(10))))), /* @__PURE__ */ React__default.createElement(DetailMobile, {
56515
+ }, createdAt.substring(10))))), /* @__PURE__ */ React__default.createElement(DetailMobile, {
56513
56516
  id,
56514
56517
  reply: reply2,
56515
56518
  reviewer: reviewer2,
@@ -56575,7 +56578,7 @@ const ContextReview = React__default.createContext([
56575
56578
  (value2) => {
56576
56579
  }
56577
56580
  ]);
56578
- const Reviews = ({ reviews, isEmpty, onReload }) => {
56581
+ const Reviews = ({ reviews, isEmpty, onReload, multiVenue }) => {
56579
56582
  const { t: t2 } = useTranslation();
56580
56583
  const [, setReview] = useContext(ContextReview);
56581
56584
  const [reviewSelected, setReviewSelected] = useState();
@@ -56606,7 +56609,8 @@ const Reviews = ({ reviews, isEmpty, onReload }) => {
56606
56609
  onReload,
56607
56610
  openForm: id === reviewSelected,
56608
56611
  onClick: handleToggleForm(id),
56609
- light: index2 % 2 === 1
56612
+ light: index2 % 2 === 1,
56613
+ multiVenue
56610
56614
  })));
56611
56615
  };
56612
56616
  const TemplateContent = ({ children }) => {
@@ -62231,9 +62235,9 @@ const GetVenueListingsOptions = async () => {
62231
62235
  limit: 1e3
62232
62236
  }
62233
62237
  });
62234
- return formatData$7(data2);
62238
+ return formatData$8(data2);
62235
62239
  };
62236
- const formatData$7 = (data2) => {
62240
+ const formatData$8 = (data2) => {
62237
62241
  return {
62238
62242
  data: data2.data.map(({ id, businessName }) => ({
62239
62243
  id,
@@ -62243,13 +62247,14 @@ const formatData$7 = (data2) => {
62243
62247
  };
62244
62248
  };
62245
62249
  const SelectVenueListing = ({
62246
- onChange: onChange3
62250
+ onChange: onChange3,
62251
+ multiVenue
62247
62252
  }) => {
62248
62253
  const { t: t2 } = useTranslation();
62249
62254
  const { data: data2, isLoading } = useFetch(GetVenueListingsOptions, {
62250
62255
  cacheId: `venueListing-options`
62251
62256
  });
62252
- if ((data2 == null ? void 0 : data2.total) === 1) {
62257
+ if (!multiVenue) {
62253
62258
  return null;
62254
62259
  }
62255
62260
  const options2 = [{ id: "", label: t2("ALL") }, ...(data2 == null ? void 0 : data2.data) || []];
@@ -62350,7 +62355,7 @@ const DatePicker = ({
62350
62355
  allowClear: false
62351
62356
  }));
62352
62357
  };
62353
- const Header$2 = ({ onChangeFilter, filters: filters2 }) => {
62358
+ const Header$2 = ({ onChangeFilter, filters: filters2, multiVenue }) => {
62354
62359
  const { t: t2 } = useTranslation();
62355
62360
  const handleChangeFilter = (id) => (value2) => {
62356
62361
  onChangeFilter({
@@ -62421,6 +62426,7 @@ const Header$2 = ({ onChangeFilter, filters: filters2 }) => {
62421
62426
  md: 6,
62422
62427
  lg: 4
62423
62428
  }, /* @__PURE__ */ React__default.createElement(SelectVenueListing, {
62429
+ multiVenue,
62424
62430
  onChange: handleChangeVenueListing
62425
62431
  })))));
62426
62432
  };
@@ -62445,6 +62451,10 @@ const ReviewsPage = () => {
62445
62451
  rating: "",
62446
62452
  reply: ""
62447
62453
  });
62454
+ const { data: data2 } = useFetch(GetVenueListingsOptions, {
62455
+ cacheId: `venueListing-options`
62456
+ });
62457
+ const multiVenue = (data2 == null ? void 0 : data2.total) > 1;
62448
62458
  const {
62449
62459
  issues,
62450
62460
  isLoadingInitialData,
@@ -62467,7 +62477,8 @@ const ReviewsPage = () => {
62467
62477
  contentClassName: styles$p.content,
62468
62478
  header: /* @__PURE__ */ React__default.createElement(Header$2, {
62469
62479
  onChangeFilter: setFilters,
62470
- filters: filter
62480
+ filters: filter,
62481
+ multiVenue
62471
62482
  })
62472
62483
  }, /* @__PURE__ */ React__default.createElement(ContextTemplate.Provider, {
62473
62484
  value: [context, setContext]
@@ -62480,7 +62491,8 @@ const ReviewsPage = () => {
62480
62491
  }, /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(Reviews, {
62481
62492
  reviews: issues,
62482
62493
  isEmpty,
62483
- onReload: reload
62494
+ onReload: reload,
62495
+ multiVenue
62484
62496
  }), !isReachingEnd && /* @__PURE__ */ React__default.createElement("div", {
62485
62497
  className: styles$p.footer
62486
62498
  }, /* @__PURE__ */ React__default.createElement(Button, {
@@ -63927,10 +63939,10 @@ const GetUserNotificationSettings = async ({}) => {
63927
63939
  const UpdateUserNotificationSettings = async ({
63928
63940
  data: data2
63929
63941
  }) => {
63930
- await instance$1.put(`listing/notification-settings`, formatData$6(data2));
63942
+ await instance$1.put(`listing/notification-settings`, formatData$7(data2));
63931
63943
  return { data: data2 };
63932
63944
  };
63933
- const formatData$6 = (data2) => {
63945
+ const formatData$7 = (data2) => {
63934
63946
  return {
63935
63947
  dailyReport: data2.dailyReport ? "true" : "false",
63936
63948
  weeklyReport: data2.weeklyReport ? "true" : "false",
@@ -64191,21 +64203,21 @@ const UpsertReplyTemplates = async ({
64191
64203
  accessToken
64192
64204
  }) => {
64193
64205
  if (data2.id) {
64194
- await instance$1.put(`/listing/review-reply-template/${data2.id}`, formatData$5(data2), {
64206
+ await instance$1.put(`/listing/review-reply-template/${data2.id}`, formatData$6(data2), {
64195
64207
  headers: {
64196
64208
  Authorization: `Bearer ${accessToken}`
64197
64209
  }
64198
64210
  });
64199
64211
  return { data: data2 };
64200
64212
  }
64201
- await instance$1.post(`/listing/review-reply-template`, formatData$5(data2), {
64213
+ await instance$1.post(`/listing/review-reply-template`, formatData$6(data2), {
64202
64214
  headers: {
64203
64215
  Authorization: `Bearer ${accessToken}`
64204
64216
  }
64205
64217
  });
64206
64218
  return { data: data2 };
64207
64219
  };
64208
- const formatData$5 = (data2) => {
64220
+ const formatData$6 = (data2) => {
64209
64221
  return {
64210
64222
  locale: data2.language.value === "gb" ? "en" : data2.language.value,
64211
64223
  comment: data2.reply,
@@ -64676,7 +64688,7 @@ const getCompareRange = (current, compareType) => {
64676
64688
  return handleCompareRangeYear(current);
64677
64689
  }
64678
64690
  };
64679
- const Header$1 = ({ value: value2, onChangeFilter }) => {
64691
+ const Header$1 = ({ value: value2, onChangeFilter, multiVenue }) => {
64680
64692
  const { t: t2 } = useTranslation();
64681
64693
  const handleChangePlatform = (change) => {
64682
64694
  onChangeFilter({
@@ -64740,55 +64752,56 @@ const Header$1 = ({ value: value2, onChangeFilter }) => {
64740
64752
  sm: 8,
64741
64753
  lg: 6
64742
64754
  }, /* @__PURE__ */ React__default.createElement(SelectVenueListing, {
64743
- onChange: handleChangeVenueListing
64755
+ onChange: handleChangeVenueListing,
64756
+ multiVenue
64744
64757
  })))));
64745
64758
  };
64746
- const formatData$4 = (dataToFormat) => {
64747
- const compare2 = groupByDate(dataToFormat.compare);
64748
- const inPeriod = groupByDate(dataToFormat.data);
64759
+ const formatData$5 = (dataToFormat) => {
64760
+ const compare2 = groupByDate$1(dataToFormat.compare);
64761
+ const inPeriod = groupByDate$1(dataToFormat.data);
64749
64762
  return {
64750
- reviews: formatReviews(inPeriod, compare2),
64751
- treatment: formatTreatment(inPeriod, compare2),
64752
- replyTime: formatAvgReplyTime(inPeriod, compare2),
64753
- average: formatAvgChart(inPeriod, compare2),
64754
- chart: formatChart(inPeriod)
64763
+ reviews: formatReviews$1(inPeriod, compare2),
64764
+ treatment: formatTreatment$1(inPeriod, compare2),
64765
+ replyTime: formatAvgReplyTime$1(inPeriod, compare2),
64766
+ average: formatAvgChart$1(inPeriod, compare2),
64767
+ chart: formatChart$1(inPeriod)
64755
64768
  };
64756
64769
  };
64757
- const sumReviews = (data2) => data2.reduce((acc, { positive: positive2, negative: negative2, neutral: neutral2 }) => acc + positive2 + negative2 + neutral2, 0);
64758
- const fixed = (value2) => {
64770
+ const sumReviews$1 = (data2) => data2.reduce((acc, { positive: positive2, negative: negative2, neutral: neutral2 }) => acc + positive2 + negative2 + neutral2, 0);
64771
+ const fixed$1 = (value2) => {
64759
64772
  return Number(value2.toFixed(2)) || 0;
64760
64773
  };
64761
- const getPercentageDiff = (inPeriod, compare2) => {
64774
+ const getPercentageDiff$1 = (inPeriod, compare2) => {
64762
64775
  if (compare2 === 0) {
64763
64776
  return 0;
64764
64777
  }
64765
- return fixed((inPeriod - compare2) * 100 / compare2);
64778
+ return fixed$1((inPeriod - compare2) * 100 / compare2);
64766
64779
  };
64767
- const formatReviews = (inPeriod, compare2) => {
64768
- const totalInPeriod = sumReviews(inPeriod);
64769
- const totalCompare = sumReviews(compare2);
64780
+ const formatReviews$1 = (inPeriod, compare2) => {
64781
+ const totalInPeriod = sumReviews$1(inPeriod);
64782
+ const totalCompare = sumReviews$1(compare2);
64770
64783
  return {
64771
64784
  value: totalInPeriod,
64772
- comparison: getPercentageDiff(totalInPeriod, totalCompare)
64785
+ comparison: getPercentageDiff$1(totalInPeriod, totalCompare)
64773
64786
  };
64774
64787
  };
64775
- const sumTreatment = (data2) => data2.reduce((acc, { treatment }) => acc + treatment, 0);
64776
- const getPercentage = (part, total) => {
64777
- return fixed(part * 100 / total);
64788
+ const sumTreatment$1 = (data2) => data2.reduce((acc, { treatment }) => acc + treatment, 0);
64789
+ const getPercentage$1 = (part, total) => {
64790
+ return fixed$1(part * 100 / total);
64778
64791
  };
64779
- const formatTreatment = (inPeriod, compare2) => {
64780
- const totalTreatmentInPeriod = sumTreatment(inPeriod);
64781
- const totalTreatmentCompare = sumTreatment(compare2);
64782
- const totalReviewsInPeriod = sumReviews(inPeriod);
64792
+ const formatTreatment$1 = (inPeriod, compare2) => {
64793
+ const totalTreatmentInPeriod = sumTreatment$1(inPeriod);
64794
+ const totalTreatmentCompare = sumTreatment$1(compare2);
64795
+ const totalReviewsInPeriod = sumReviews$1(inPeriod);
64783
64796
  return {
64784
64797
  value: {
64785
- value: getPercentage(totalTreatmentInPeriod, totalReviewsInPeriod),
64798
+ value: getPercentage$1(totalTreatmentInPeriod, totalReviewsInPeriod),
64786
64799
  units: "%"
64787
64800
  },
64788
- comparison: getPercentageDiff(totalTreatmentInPeriod, totalTreatmentCompare)
64801
+ comparison: getPercentageDiff$1(totalTreatmentInPeriod, totalTreatmentCompare)
64789
64802
  };
64790
64803
  };
64791
- const getAvgReplyTime = (data2) => {
64804
+ const getAvgReplyTime$1 = (data2) => {
64792
64805
  if (data2.length === 0) {
64793
64806
  return 0;
64794
64807
  }
@@ -64799,20 +64812,20 @@ const getAvgReplyTime = (data2) => {
64799
64812
  const totalReplyTime = data2.reduce((acc, { avgReplyTime, treatment }) => acc + avgReplyTime * treatment, 0);
64800
64813
  return Math.round(totalReplyTime / totalTreatment);
64801
64814
  };
64802
- const formatAvgReplyTime = (inPeriod, compare2) => {
64803
- const inPeriodReplyTime = getAvgReplyTime(inPeriod);
64804
- const compareReplyTime = getAvgReplyTime(compare2);
64815
+ const formatAvgReplyTime$1 = (inPeriod, compare2) => {
64816
+ const inPeriodReplyTime = getAvgReplyTime$1(inPeriod);
64817
+ const compareReplyTime = getAvgReplyTime$1(compare2);
64805
64818
  return {
64806
64819
  value: humanizeMinutes(inPeriodReplyTime),
64807
- comparison: getPercentageDiff(inPeriodReplyTime, compareReplyTime)
64820
+ comparison: getPercentageDiff$1(inPeriodReplyTime, compareReplyTime)
64808
64821
  };
64809
64822
  };
64810
- const getAvg = (data2) => {
64823
+ const getAvg$1 = (data2) => {
64811
64824
  const total = data2.reduce((acc, { positive: positive2, negative: negative2, neutral: neutral2 }) => acc + positive2 + negative2 + neutral2, 0);
64812
64825
  const rating = data2.reduce((acc, { positive: positive2, negative: negative2, neutral: neutral2, avg }) => acc + avg * (positive2 + negative2 + neutral2), 0);
64813
- return fixed(rating / total);
64826
+ return fixed$1(rating / total);
64814
64827
  };
64815
- const circleChart = (data2) => {
64828
+ const circleChart$1 = (data2) => {
64816
64829
  const value2 = data2.reduce((acc, { positive: positive2, negative: negative2, neutral: neutral2 }) => ({
64817
64830
  positive: positive2 + acc.positive,
64818
64831
  negative: negative2 + acc.negative,
@@ -64824,23 +64837,23 @@ const circleChart = (data2) => {
64824
64837
  { name: instance.t("NEUTRAL"), value: value2.neutral }
64825
64838
  ];
64826
64839
  };
64827
- const formatAvgChart = (inPeriod, compare2) => {
64840
+ const formatAvgChart$1 = (inPeriod, compare2) => {
64828
64841
  return {
64829
64842
  inPeriod: {
64830
- avg: getAvg(inPeriod),
64831
- chart: circleChart(inPeriod)
64843
+ avg: getAvg$1(inPeriod),
64844
+ chart: circleChart$1(inPeriod)
64832
64845
  },
64833
64846
  compare: {
64834
- avg: getAvg(compare2),
64835
- chart: circleChart(compare2)
64847
+ avg: getAvg$1(compare2),
64848
+ chart: circleChart$1(compare2)
64836
64849
  }
64837
64850
  };
64838
64851
  };
64839
- const formatChart = (inPeriod) => inPeriod.map((item2) => ({
64852
+ const formatChart$1 = (inPeriod) => inPeriod.map((item2) => ({
64840
64853
  ...item2,
64841
64854
  date: dateFromString(item2.date)
64842
64855
  }));
64843
- const groupByDate = (data2) => {
64856
+ const groupByDate$1 = (data2) => {
64844
64857
  const grouped = groupBy(data2, "date");
64845
64858
  return Object.values(grouped).map((items) => {
64846
64859
  const { total, ...rest } = items.reduce((acc, item2) => {
@@ -64866,8 +64879,8 @@ const groupByDate = (data2) => {
64866
64879
  });
64867
64880
  return {
64868
64881
  ...rest,
64869
- avg: fixed(rest.avg / total),
64870
- avgReplyTime: rest.treatment > 0 ? fixed(rest.avgReplyTime / rest.treatment) : 0
64882
+ avg: fixed$1(rest.avg / total),
64883
+ avgReplyTime: rest.treatment > 0 ? fixed$1(rest.avgReplyTime / rest.treatment) : 0
64871
64884
  };
64872
64885
  });
64873
64886
  };
@@ -87160,7 +87173,7 @@ const formatDateChart = (date4, mode) => {
87160
87173
  return formatDate(date4, "DD/MM/YYYY");
87161
87174
  }
87162
87175
  };
87163
- const formatData$3 = (data2, mode) => {
87176
+ const formatData$4 = (data2, mode) => {
87164
87177
  const formatedData = data2.reduce((acc, { date: _date, ...item2 }) => {
87165
87178
  var _a2, _b, _c;
87166
87179
  const date4 = formatDateChart(_date, mode);
@@ -87228,7 +87241,7 @@ const ReviewsChart = ({
87228
87241
  const handleChanDisplayBy = (ev) => {
87229
87242
  setDisplayBy(ev.target.value);
87230
87243
  };
87231
- const chartData = formatData$3(data2, displayBy);
87244
+ const chartData = formatData$4(data2, displayBy);
87232
87245
  const options2 = limitDisplaByOptions(days2);
87233
87246
  return /* @__PURE__ */ React__default.createElement(Card, {
87234
87247
  header: { title: t2("REVIEWSEVOLUTIION") }
@@ -87359,6 +87372,12 @@ const getCurrentRange = () => {
87359
87372
  till: subtractDate(void 0, 0, "day")
87360
87373
  };
87361
87374
  };
87375
+ const getTodaysRange = () => {
87376
+ return {
87377
+ from: subtractDate(void 0, 0, "day"),
87378
+ till: subtractDate(void 0, 0, "day")
87379
+ };
87380
+ };
87362
87381
  const COLORS$1 = ["#82ca9d", "#ffc658", "#8884d8"];
87363
87382
  const LabelsScoreChart = ({
87364
87383
  title: title2,
@@ -87520,7 +87539,7 @@ const formatComparedPeriod = (range4) => {
87520
87539
  return "";
87521
87540
  return `${formatDate(range4.from, dateFormat)} - ${formatDate(range4.till, dateFormat)}`;
87522
87541
  };
87523
- const Analytics$1 = ({ venueListingId }) => {
87542
+ const Analytics$2 = ({ venueListingId }) => {
87524
87543
  const { t: t2 } = useTranslation();
87525
87544
  const [filter, setFilters] = useState({
87526
87545
  range: getCurrentRange(),
@@ -87531,7 +87550,11 @@ const Analytics$1 = ({ venueListingId }) => {
87531
87550
  const { data: data2, isLoading, error: error3 } = useFetch(GetReviewAnalytics, {
87532
87551
  cacheId: `reviews-analytics-${venueListingId}`,
87533
87552
  params: filter
87534
- }, { formatData: formatData$4 });
87553
+ }, { formatData: formatData$5 });
87554
+ const { data: venues } = useFetch(GetVenueListingsOptions, {
87555
+ cacheId: `venueListing-options`
87556
+ });
87557
+ const multiVenue = (venues == null ? void 0 : venues.total) > 1;
87535
87558
  const comparedPeriod = formatComparedPeriod(filter.compare);
87536
87559
  const period = formatComparedPeriod(filter.range);
87537
87560
  if (error3) {
@@ -87542,7 +87565,8 @@ const Analytics$1 = ({ venueListingId }) => {
87542
87565
  return /* @__PURE__ */ React__default.createElement(LayoutPage$1, {
87543
87566
  header: /* @__PURE__ */ React__default.createElement(Header$1, {
87544
87567
  onChangeFilter: setFilters,
87545
- value: filter
87568
+ value: filter,
87569
+ multiVenue
87546
87570
  })
87547
87571
  }, /* @__PURE__ */ React__default.createElement("div", null, isLoading && /* @__PURE__ */ React__default.createElement(SkeletonPage, null), !isLoading && /* @__PURE__ */ React__default.createElement(Row$1, {
87548
87572
  gutter: [28, 28]
@@ -87782,7 +87806,7 @@ const formatStats = (stat) => {
87782
87806
  });
87783
87807
  return sum;
87784
87808
  };
87785
- const formatData$2 = (dataToFormat) => {
87809
+ const formatData$3 = (dataToFormat) => {
87786
87810
  return {
87787
87811
  totals: {
87788
87812
  queries: {
@@ -87856,7 +87880,7 @@ const singleVenue$1 = async () => {
87856
87880
  }
87857
87881
  });
87858
87882
  };
87859
- const Analytics = ({ venueListingId }) => {
87883
+ const Analytics$1 = ({ venueListingId }) => {
87860
87884
  const { t: t2 } = useTranslation();
87861
87885
  const [listingId, setListingId] = useState(venueListingId);
87862
87886
  const [formattedStats, setFormattedStats] = useState();
@@ -87881,7 +87905,7 @@ const Analytics = ({ venueListingId }) => {
87881
87905
  if (data2 && (data2 == null ? void 0 : data2.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH.error)) {
87882
87906
  setNotAuthorized(true);
87883
87907
  } else {
87884
- setFormattedStats(formatData$2(data2));
87908
+ setFormattedStats(formatData$3(data2));
87885
87909
  }
87886
87910
  }
87887
87911
  }, [data2]);
@@ -87964,6 +87988,191 @@ const Analytics = ({ venueListingId }) => {
87964
87988
  data: formattedStats == null ? void 0 : formattedStats.actions
87965
87989
  }))));
87966
87990
  };
87991
+ const formatData$2 = (dataToFormat) => {
87992
+ const compare2 = groupByDate(dataToFormat.compare);
87993
+ const inPeriod = groupByDate(dataToFormat.data);
87994
+ return {
87995
+ reviews: formatReviews(inPeriod, compare2),
87996
+ treatment: formatTreatment(inPeriod, compare2),
87997
+ replyTime: formatAvgReplyTime(inPeriod, compare2),
87998
+ average: formatAvgChart(inPeriod, compare2),
87999
+ chart: formatChart(inPeriod)
88000
+ };
88001
+ };
88002
+ const sumReviews = (data2) => data2.reduce((acc, { positive: positive2, negative: negative2, neutral: neutral2 }) => acc + positive2 + negative2 + neutral2, 0);
88003
+ const fixed = (value2) => {
88004
+ return Number(value2.toFixed(2)) || 0;
88005
+ };
88006
+ const getPercentageDiff = (inPeriod, compare2) => {
88007
+ if (compare2 === 0) {
88008
+ return 0;
88009
+ }
88010
+ return fixed((inPeriod - compare2) * 100 / compare2);
88011
+ };
88012
+ const formatReviews = (inPeriod, compare2) => {
88013
+ const totalInPeriod = sumReviews(inPeriod);
88014
+ const totalCompare = sumReviews(compare2);
88015
+ return {
88016
+ value: totalInPeriod,
88017
+ comparison: getPercentageDiff(totalInPeriod, totalCompare)
88018
+ };
88019
+ };
88020
+ const sumTreatment = (data2) => data2.reduce((acc, { treatment }) => acc + treatment, 0);
88021
+ const getPercentage = (part, total) => {
88022
+ return fixed(part * 100 / total);
88023
+ };
88024
+ const formatTreatment = (inPeriod, compare2) => {
88025
+ const totalTreatmentInPeriod = sumTreatment(inPeriod);
88026
+ const totalTreatmentCompare = sumTreatment(compare2);
88027
+ const totalReviewsInPeriod = sumReviews(inPeriod);
88028
+ return {
88029
+ value: {
88030
+ value: getPercentage(totalTreatmentInPeriod, totalReviewsInPeriod),
88031
+ units: "%"
88032
+ },
88033
+ comparison: getPercentageDiff(totalTreatmentInPeriod, totalTreatmentCompare)
88034
+ };
88035
+ };
88036
+ const getAvgReplyTime = (data2) => {
88037
+ if (data2.length === 0) {
88038
+ return 0;
88039
+ }
88040
+ const totalTreatment = data2.reduce((acc, { treatment }) => acc + treatment, 0);
88041
+ if (totalTreatment === 0) {
88042
+ return 0;
88043
+ }
88044
+ const totalReplyTime = data2.reduce((acc, { avgReplyTime, treatment }) => acc + avgReplyTime * treatment, 0);
88045
+ return Math.round(totalReplyTime / totalTreatment);
88046
+ };
88047
+ const formatAvgReplyTime = (inPeriod, compare2) => {
88048
+ const inPeriodReplyTime = getAvgReplyTime(inPeriod);
88049
+ const compareReplyTime = getAvgReplyTime(compare2);
88050
+ return {
88051
+ value: humanizeMinutes(inPeriodReplyTime),
88052
+ comparison: getPercentageDiff(inPeriodReplyTime, compareReplyTime)
88053
+ };
88054
+ };
88055
+ const getAvg = (data2) => {
88056
+ const total = data2.reduce((acc, { positive: positive2, negative: negative2, neutral: neutral2 }) => acc + positive2 + negative2 + neutral2, 0);
88057
+ const rating = data2.reduce((acc, { positive: positive2, negative: negative2, neutral: neutral2, avg }) => acc + avg * (positive2 + negative2 + neutral2), 0);
88058
+ return fixed(rating / total);
88059
+ };
88060
+ const circleChart = (data2) => {
88061
+ const value2 = data2.reduce((acc, { positive: positive2, negative: negative2, neutral: neutral2 }) => ({
88062
+ positive: positive2 + acc.positive,
88063
+ negative: negative2 + acc.negative,
88064
+ neutral: neutral2 + acc.neutral
88065
+ }), { positive: 0, negative: 0, neutral: 0 });
88066
+ return [
88067
+ { name: instance.t("SATISFIED"), value: value2.positive },
88068
+ { name: instance.t("DISSATISFIED"), value: value2.negative },
88069
+ { name: instance.t("NEUTRAL"), value: value2.neutral }
88070
+ ];
88071
+ };
88072
+ const formatAvgChart = (inPeriod, compare2) => {
88073
+ return {
88074
+ inPeriod: {
88075
+ avg: getAvg(inPeriod),
88076
+ chart: circleChart(inPeriod)
88077
+ },
88078
+ compare: {
88079
+ avg: getAvg(compare2),
88080
+ chart: circleChart(compare2)
88081
+ }
88082
+ };
88083
+ };
88084
+ const formatChart = (inPeriod) => inPeriod.map((item2) => ({
88085
+ ...item2,
88086
+ date: dateFromString(item2.date)
88087
+ }));
88088
+ const groupByDate = (data2) => {
88089
+ const grouped = groupBy(data2, "date");
88090
+ return Object.values(grouped).map((items) => {
88091
+ const { total, ...rest } = items.reduce((acc, item2) => {
88092
+ const total2 = item2.positive + item2.negative + item2.neutral;
88093
+ return {
88094
+ ...item2,
88095
+ positive: acc.positive + item2.positive,
88096
+ negative: acc.negative + item2.negative,
88097
+ neutral: acc.neutral + item2.neutral,
88098
+ treatment: acc.treatment + item2.treatment,
88099
+ avg: acc.avg + total2 * item2.avg,
88100
+ avgReplyTime: acc.avgReplyTime + item2.treatment * item2.avgReplyTime,
88101
+ total: acc.total + total2
88102
+ };
88103
+ }, {
88104
+ positive: 0,
88105
+ negative: 0,
88106
+ neutral: 0,
88107
+ treatment: 0,
88108
+ avg: 0,
88109
+ avgReplyTime: 0,
88110
+ total: 0
88111
+ });
88112
+ return {
88113
+ ...rest,
88114
+ avg: fixed(rest.avg / total),
88115
+ avgReplyTime: rest.treatment > 0 ? fixed(rest.avgReplyTime / rest.treatment) : 0
88116
+ };
88117
+ });
88118
+ };
88119
+ const Analytics = ({ venueListingId }) => {
88120
+ const { t: t2 } = useTranslation();
88121
+ const [filter, setFilters] = useState({
88122
+ range: getTodaysRange(),
88123
+ compare: getCompareRange(getTodaysRange(), "period"),
88124
+ platform: "",
88125
+ compareType: "period"
88126
+ });
88127
+ const { data: data2, isLoading, error: error3 } = useFetch(GetReviewAnalytics, {
88128
+ cacheId: `reviews-analytics-${venueListingId}`,
88129
+ params: filter
88130
+ }, { formatData: formatData$2 });
88131
+ const comparedPeriod = formatComparedPeriod(filter.compare);
88132
+ if (error3) {
88133
+ return /* @__PURE__ */ React__default.createElement(Error$1, {
88134
+ error: error3
88135
+ });
88136
+ }
88137
+ return /* @__PURE__ */ React__default.createElement(LayoutPage$1, null, /* @__PURE__ */ React__default.createElement("div", null, isLoading && /* @__PURE__ */ React__default.createElement(SkeletonPage, null), !isLoading && /* @__PURE__ */ React__default.createElement(Row$1, {
88138
+ gutter: [28, 28]
88139
+ }, /* @__PURE__ */ React__default.createElement(Col$1, {
88140
+ xs: 24,
88141
+ sm: 12,
88142
+ md: 8
88143
+ }, /* @__PURE__ */ React__default.createElement(StatsCard, {
88144
+ ...data2.reviews,
88145
+ comparedPeriod,
88146
+ title: t2("MYREVIEWS"),
88147
+ icon: /* @__PURE__ */ React__default.createElement(CircleIcon, {
88148
+ icon: MessageCircle$1
88149
+ })
88150
+ })), /* @__PURE__ */ React__default.createElement(Col$1, {
88151
+ xs: 24,
88152
+ sm: 12,
88153
+ md: 8
88154
+ }, /* @__PURE__ */ React__default.createElement(StatsCard, {
88155
+ ...data2.treatment,
88156
+ comparedPeriod,
88157
+ title: t2("TREATMENTRATE"),
88158
+ icon: /* @__PURE__ */ React__default.createElement(CircleIcon, {
88159
+ icon: Star$1,
88160
+ color: "blue"
88161
+ })
88162
+ })), /* @__PURE__ */ React__default.createElement(Col$1, {
88163
+ xs: 24,
88164
+ sm: 24,
88165
+ md: 8
88166
+ }, /* @__PURE__ */ React__default.createElement(StatsCard, {
88167
+ ...data2.replyTime,
88168
+ comparedPeriod,
88169
+ title: t2("AVERAGETIMEREPLY"),
88170
+ icon: /* @__PURE__ */ React__default.createElement(CircleIcon, {
88171
+ icon: Clock$1,
88172
+ color: "red"
88173
+ })
88174
+ })))));
88175
+ };
87967
88176
  const WorkingPage = () => {
87968
88177
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Heading, null, "Work in progress"), /* @__PURE__ */ React__default.createElement("iframe", {
87969
88178
  src: "https://giphy.com/embed/aNqEFrYVnsS52",
@@ -88024,6 +88233,113 @@ const MetricCard = ({ value: value2, title: title2 }) => /* @__PURE__ */ React__
88024
88233
  }, /* @__PURE__ */ React__default.createElement("span", {
88025
88234
  className: styles$6.value
88026
88235
  }, value2));
88236
+ const GetVenuesSummary = async ({
88237
+ filters: filters2,
88238
+ page = 1,
88239
+ limit = 10
88240
+ }) => {
88241
+ const data2 = await instance$1.get(`listing/venue-listing-summary/venues`, {
88242
+ params: {
88243
+ ...formatParams(filters2),
88244
+ limit,
88245
+ offset: (page - 1) * limit
88246
+ }
88247
+ });
88248
+ return formatData(data2);
88249
+ };
88250
+ const formatParams = (filters2 = {}) => {
88251
+ let all2 = {};
88252
+ if (filters2.connected) {
88253
+ Object.assign(all2, {
88254
+ "filters[platform]": filters2.platform
88255
+ });
88256
+ } else {
88257
+ Object.assign(all2, {
88258
+ "filters[notPlatform]": filters2.platform
88259
+ });
88260
+ }
88261
+ if (filters2.search) {
88262
+ Object.assign(all2, {
88263
+ "filters[name]": filters2.search
88264
+ });
88265
+ }
88266
+ return all2;
88267
+ };
88268
+ const formatData = (values) => {
88269
+ return values;
88270
+ };
88271
+ const ModalVenues = ({ onClose: onClose2, open, platform: platform2, connected: connected2 }) => {
88272
+ useTranslation();
88273
+ const [search2, setSearch] = useState("");
88274
+ const [page, updatePage] = useState(1);
88275
+ const navigate = useNavigate();
88276
+ const { data: data2, isLoading, error: error3, isValidating, reload } = useFetch(GetVenuesSummary, {
88277
+ cacheId: "venues-summary",
88278
+ filters: { platform: platform2, connected: connected2, search: search2 },
88279
+ page
88280
+ });
88281
+ if (error3) {
88282
+ return /* @__PURE__ */ React__default.createElement("div", null, error3);
88283
+ }
88284
+ const handleSearch = debounce_1((e3) => setSearch(e3.target.value || ""), 500);
88285
+ const handleNavigate = (id) => {
88286
+ navigate(`/venues/${id}?showBack='true'`);
88287
+ };
88288
+ return /* @__PURE__ */ React__default.createElement(ModalAntd, {
88289
+ title: `Select your venue ${connected2 ? "connected" : "to connect"} to ${platform2}`,
88290
+ open,
88291
+ onCancel: onClose2,
88292
+ width: 1e3,
88293
+ footer: null,
88294
+ closeIcon: /* @__PURE__ */ React__default.createElement(Icon$1, {
88295
+ icon: "close",
88296
+ size: "small"
88297
+ }),
88298
+ centered: true
88299
+ }, /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", {
88300
+ style: { display: "flex" }
88301
+ }, /* @__PURE__ */ React__default.createElement(Table, {
88302
+ isLoading: isLoading || isValidating,
88303
+ Header: /* @__PURE__ */ React__default.createElement("div", {
88304
+ style: { display: "flex", justifyContent: "flex-end", marginBottom: "20px" }
88305
+ }, /* @__PURE__ */ React__default.createElement(Input$1, {
88306
+ id: "search",
88307
+ placeholder: "Search",
88308
+ label: "",
88309
+ onChange: handleSearch
88310
+ })),
88311
+ header: [
88312
+ {
88313
+ label: `Name`,
88314
+ id: "name",
88315
+ render: (value2, item2) => {
88316
+ if (platform2) {
88317
+ return /* @__PURE__ */ React__default.createElement("div", {
88318
+ style: {
88319
+ cursor: "pointer",
88320
+ textDecorationLine: "underline"
88321
+ },
88322
+ onClick: () => handleNavigate(item2 == null ? void 0 : item2.id)
88323
+ }, value2);
88324
+ }
88325
+ return /* @__PURE__ */ React__default.createElement("div", null, value2);
88326
+ }
88327
+ },
88328
+ {
88329
+ label: `Address`,
88330
+ id: "address"
88331
+ },
88332
+ {
88333
+ label: `City`,
88334
+ id: "city"
88335
+ }
88336
+ ],
88337
+ page,
88338
+ data: (data2 == null ? void 0 : data2.data) || [],
88339
+ totalElements: data2 == null ? void 0 : data2.total,
88340
+ onChangePage: updatePage
88341
+ }))));
88342
+ };
88027
88343
  const singleVenue = async () => {
88028
88344
  return await instance$1.get(`listing/venue-listing-summary/venues`, {
88029
88345
  params: {
@@ -88035,6 +88351,9 @@ const singleVenue = async () => {
88035
88351
  const Summary = () => {
88036
88352
  const { t: t2 } = useTranslation();
88037
88353
  const navigate = useNavigate();
88354
+ const [openModal, setOpenModal] = useState(false);
88355
+ const [platform2, setPlatform] = useState("");
88356
+ const [showConnected, setShowConnected] = useState(false);
88038
88357
  const { data: data2, isLoading, error: error3 } = useFetch(GetVenueListingSummary, {
88039
88358
  cacheId: "sumary"
88040
88359
  });
@@ -88050,11 +88369,15 @@ const Summary = () => {
88050
88369
  if (error3) {
88051
88370
  return /* @__PURE__ */ React__default.createElement("div", null, error3);
88052
88371
  }
88053
- const handleNavigateConnected = (value2, platform2) => {
88054
- navigate(`/venues?platform=${platform2}`);
88372
+ const handleNavigateConnected = (value2, platform22) => {
88373
+ setShowConnected(true);
88374
+ setPlatform(platform22);
88375
+ setOpenModal(true);
88055
88376
  };
88056
- const handleNavigateToConnect = (value2, platform2) => {
88057
- navigate(`/venues?noPlatform=${platform2}`);
88377
+ const handleNavigateToConnect = (value2, platform22) => {
88378
+ setShowConnected(false);
88379
+ setPlatform(platform22);
88380
+ setOpenModal(true);
88058
88381
  };
88059
88382
  return /* @__PURE__ */ React__default.createElement(LayoutPage$1, null, /* @__PURE__ */ React__default.createElement("div", {
88060
88383
  style: { marginTop: "2rem" }
@@ -88135,43 +88458,12 @@ const Summary = () => {
88135
88458
  }
88136
88459
  ],
88137
88460
  data: (data2 == null ? void 0 : data2.data) || []
88138
- }))));
88139
- };
88140
- const GetVenuesSummary = async ({
88141
- filters: filters2,
88142
- page = 1,
88143
- limit = 10
88144
- }) => {
88145
- const data2 = await instance$1.get(`listing/venue-listing-summary/venues`, {
88146
- params: {
88147
- ...formatParams(filters2),
88148
- limit,
88149
- offset: (page - 1) * limit
88150
- }
88151
- });
88152
- return formatData(data2);
88153
- };
88154
- const formatParams = (filters2 = {}) => {
88155
- let all2 = {};
88156
- if (filters2.platform) {
88157
- Object.assign(all2, {
88158
- "filters[platform]": filters2.platform
88159
- });
88160
- }
88161
- if (filters2.noPlatform) {
88162
- Object.assign(all2, {
88163
- "filters[notPlatform]": filters2.noPlatform
88164
- });
88165
- }
88166
- if (filters2.search) {
88167
- Object.assign(all2, {
88168
- "filters[name]": filters2.search
88169
- });
88170
- }
88171
- return all2;
88172
- };
88173
- const formatData = (values) => {
88174
- return values;
88461
+ })), /* @__PURE__ */ React__default.createElement(ModalVenues, {
88462
+ open: openModal,
88463
+ onClose: () => setOpenModal(false),
88464
+ platform: platform2,
88465
+ connected: showConnected
88466
+ })));
88175
88467
  };
88176
88468
  const CreatetVenueListing = async ({ venueId }) => {
88177
88469
  const data2 = await instance$1.post(`/listing/venue-listing`, {
@@ -89034,12 +89326,12 @@ function App({
89034
89326
  element: /* @__PURE__ */ React__default.createElement(Permissions, null)
89035
89327
  }), /* @__PURE__ */ React__default.createElement(Route, {
89036
89328
  path: "/analytics/listing",
89037
- element: /* @__PURE__ */ React__default.createElement(Analytics, {
89329
+ element: /* @__PURE__ */ React__default.createElement(Analytics$1, {
89038
89330
  venueListingId
89039
89331
  })
89040
89332
  }), /* @__PURE__ */ React__default.createElement(Route, {
89041
89333
  path: "/analytics/review",
89042
- element: /* @__PURE__ */ React__default.createElement(Analytics$1, {
89334
+ element: /* @__PURE__ */ React__default.createElement(Analytics$2, {
89043
89335
  venueListingId
89044
89336
  })
89045
89337
  }), /* @__PURE__ */ React__default.createElement(Route, {
@@ -89054,8 +89346,9 @@ const pages = {
89054
89346
  Roles: App$1,
89055
89347
  Notifications,
89056
89348
  ReplyTemplates,
89057
- ReviewAnalytics: Analytics$1,
89058
- ListingAnalytics: Analytics,
89349
+ ReviewAnalytics: Analytics$2,
89350
+ ListingAnalytics: Analytics$1,
89351
+ DashboardAnalytics: Analytics,
89059
89352
  Users: App$2,
89060
89353
  ProfileManagement,
89061
89354
  App