mozrest-sdk-react-dev 0.2.18 → 0.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/mozrest-sdk.es.js +22 -30
  2. package/package.json +1 -1
package/mozrest-sdk.es.js CHANGED
@@ -43977,7 +43977,8 @@ const SuggestReviewReply = async ({
43977
43977
  };
43978
43978
  const ContextVenue = React__default.createContext([
43979
43979
  null,
43980
- null,
43980
+ (value2) => {
43981
+ },
43981
43982
  null,
43982
43983
  []
43983
43984
  ]);
@@ -44000,11 +44001,11 @@ const Review = ({
44000
44001
  multiVenue,
44001
44002
  setShowTemplate
44002
44003
  }) => {
44003
- const [venue, venueListingId, venueListing, issues] = useContext(ContextVenue);
44004
+ const [venueListingId, , venueListing, issues] = useContext(ContextVenue);
44004
44005
  const [, setTemplate] = useContext(ContextTemplate);
44005
44006
  const { execute, isExecuting, data: data2 } = useService(SuggestReviewReply);
44006
44007
  const onSuggestTemplate = () => {
44007
- const filteredIssues = issues.filter((i) => id2 !== i.id);
44008
+ const filteredIssues = issues.filter((i) => id2 !== i.id && i.comment && i.reply && i.reply.comment);
44008
44009
  const toSend = {
44009
44010
  reviewer_data: {
44010
44011
  reviewer_name: reviewer2.name,
@@ -44018,9 +44019,9 @@ const Review = ({
44018
44019
  Description: venueListing.descriptionLong ? venueListing.descriptionLong : venueListing.descriptionShort ? venueListing.descriptionShort : null,
44019
44020
  Price: "Moderate",
44020
44021
  Attributes: venueListing.attributesNames,
44021
- Address: venue.address,
44022
- City: venue.city,
44023
- Country: venue.countryCode
44022
+ Address: venueListing.address,
44023
+ City: venueListing.city,
44024
+ Country: venueListing.country && venueListing.country.id
44024
44025
  },
44025
44026
  example: {
44026
44027
  review_1: filteredIssues.length > 0 ? filteredIssues[0].comment : null,
@@ -44182,6 +44183,7 @@ const ContextReview = React__default.createContext([
44182
44183
  const Reviews = ({ reviews, isEmpty, onReload, multiVenue, setShowTemplate }) => {
44183
44184
  const { t: t2 } = useTranslation();
44184
44185
  const [, setReview] = useContext(ContextReview);
44186
+ const [, setVenueListingId, ,] = useContext(ContextVenue);
44185
44187
  const [reviewSelected, setReviewSelected] = useState();
44186
44188
  const handleToggleForm = (id2) => () => {
44187
44189
  setReviewSelected((current) => {
@@ -44193,6 +44195,7 @@ const Reviews = ({ reviews, isEmpty, onReload, multiVenue, setShowTemplate }) =>
44193
44195
  const selected = reviews.find((review) => review.id === id2);
44194
44196
  if (selected) {
44195
44197
  setReview(selected);
44198
+ setVenueListingId(selected.venueListingId);
44196
44199
  }
44197
44200
  };
44198
44201
  return /* @__PURE__ */ React__default.createElement(Card, {
@@ -50369,17 +50372,6 @@ var styles$1s = {
50369
50372
  grid,
50370
50373
  footer: footer$e
50371
50374
  };
50372
- const getVenue = async ({ venueId }) => {
50373
- const data2 = await instance$1.get(`/venues/${venueId}`);
50374
- return data2;
50375
- };
50376
- const GetVenueListingId = async ({
50377
- venueId,
50378
- externalId
50379
- }) => {
50380
- const data2 = await instance$1.get(`listing/venue-listing-id?venueId=${venueId || externalId}`);
50381
- return { id: data2.venueListingId };
50382
- };
50383
50375
  var lib$1 = {};
50384
50376
  var runtime = { exports: {} };
50385
50377
  (function(module2) {
@@ -51008,7 +51000,7 @@ const GetVenueListing = async ({
51008
51000
  venueListingId,
51009
51001
  accessToken
51010
51002
  }) => {
51011
- if (venueListingId && venueListingId !== null) {
51003
+ if (venueListingId && venueListingId !== null && venueListingId !== "") {
51012
51004
  const data2 = await instance$1.get(`/listing/venue-listing/${venueListingId}`, {
51013
51005
  headers: {
51014
51006
  Authorization: `Bearer ${accessToken}`
@@ -51159,6 +51151,7 @@ const ReviewsPage = ({
51159
51151
  const { t: t2 } = useTranslation();
51160
51152
  const [context, setContext] = useState("");
51161
51153
  const [review, setReview] = useState();
51154
+ const [venueListingId, setVenueListingId] = useState(null);
51162
51155
  const [showReplyTemplates, setShowReplyTemplates] = useState(false);
51163
51156
  const [filter2, setFilters] = useState({
51164
51157
  range: {
@@ -51172,17 +51165,9 @@ const ReviewsPage = ({
51172
51165
  const { data: data2 } = useFetch(GetVenueListingsOptions, {
51173
51166
  cacheId: `venueListing-options`
51174
51167
  });
51175
- const { data: venue } = useFetch(getVenue, {
51176
- cacheId: `venue-data`,
51177
- venueId
51178
- });
51179
- const { data: venueListingId } = useFetch(GetVenueListingId, {
51180
- cacheId: `venue-listing-${venueId}`,
51181
- venueId
51182
- });
51183
51168
  const { data: venueListing, reload: reloadVenueListing } = useFetch(GetVenueListing, {
51184
- cacheId: `venue-listing-${venueListingId ? venueListingId.id : null}`,
51185
- venueListingId: venueListingId ? venueListingId.id : null
51169
+ cacheId: `venue-listing-${venueListingId ? venueListingId : null}`,
51170
+ venueListingId: venueListingId ? venueListingId : ""
51186
51171
  });
51187
51172
  const multiVenue = (data2 == null ? void 0 : data2.total) > 1;
51188
51173
  const {
@@ -51199,7 +51184,7 @@ const ReviewsPage = ({
51199
51184
  params: filter2
51200
51185
  });
51201
51186
  useEffect(() => {
51202
- if (venueListingId && venueListingId.id) {
51187
+ if (venueListingId && venueListingId) {
51203
51188
  reloadVenueListing();
51204
51189
  }
51205
51190
  }, [venueListingId]);
@@ -51217,7 +51202,7 @@ const ReviewsPage = ({
51217
51202
  venueId
51218
51203
  })
51219
51204
  }, /* @__PURE__ */ React__default.createElement(ContextVenue.Provider, {
51220
- value: [venue, venueListingId ? venueListingId.id : null, venueListing, issues]
51205
+ value: [venueListingId, setVenueListingId, venueListing, issues]
51221
51206
  }, /* @__PURE__ */ React__default.createElement(ContextTemplate.Provider, {
51222
51207
  value: [context, setContext]
51223
51208
  }, /* @__PURE__ */ React__default.createElement(ContextReview.Provider, {
@@ -79735,6 +79720,13 @@ const WorkingPage = () => {
79735
79720
  allowFullScreen: true
79736
79721
  }));
79737
79722
  };
79723
+ const GetVenueListingId = async ({
79724
+ venueId,
79725
+ externalId
79726
+ }) => {
79727
+ const data2 = await instance$1.get(`listing/venue-listing-id?venueId=${venueId || externalId}`);
79728
+ return { id: data2.venueListingId };
79729
+ };
79738
79730
  const VenueListingIdProvider = ({
79739
79731
  children,
79740
79732
  venueId = "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mozrest-sdk-react-dev",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "main": "mozrest-sdk.es.js",
5
5
  "keywords": ["mozrest"],
6
6
  "author": {