mozrest-sdk-react-dev 0.3.51 → 0.3.53

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 +36 -30
  2. package/package.json +1 -1
package/mozrest-sdk.es.js CHANGED
@@ -17606,7 +17606,7 @@ const GetReviews = async ({
17606
17606
  "listing/venue-listing-reviews",
17607
17607
  {
17608
17608
  params: {
17609
- ...formatParams$5(params),
17609
+ ...formatParams$6(params),
17610
17610
  limit,
17611
17611
  offset: page * limit,
17612
17612
  "sortby[createdAt]": "DESC"
@@ -17615,7 +17615,7 @@ const GetReviews = async ({
17615
17615
  );
17616
17616
  return formatData$l(data2);
17617
17617
  };
17618
- const formatParams$5 = (params) => {
17618
+ const formatParams$6 = (params) => {
17619
17619
  const all = {};
17620
17620
  if (params) {
17621
17621
  Object.keys(params).forEach((key2) => {
@@ -49467,7 +49467,7 @@ const GetReplyTemplates = async ({
49467
49467
  `/listing/review-reply-template`,
49468
49468
  {
49469
49469
  params: {
49470
- ...formatParams$4(params),
49470
+ ...formatParams$5(params),
49471
49471
  limit,
49472
49472
  offset: page * limit
49473
49473
  }
@@ -49475,7 +49475,7 @@ const GetReplyTemplates = async ({
49475
49475
  );
49476
49476
  return formatData$k(data2);
49477
49477
  };
49478
- const formatParams$4 = (params = {}) => {
49478
+ const formatParams$5 = (params = {}) => {
49479
49479
  let all = {};
49480
49480
  if (params.locale) {
49481
49481
  Object.assign(all, {
@@ -86099,7 +86099,7 @@ const Header$3 = ({
86099
86099
  id: ((_a2 = platform2 == null ? void 0 : platform2.module) == null ? void 0 : _a2.id) ?? "",
86100
86100
  label: ((_b = platform2 == null ? void 0 : platform2.module) == null ? void 0 : _b.name) ?? ""
86101
86101
  };
86102
- })] : platforms,
86102
+ }).sort((a2, b2) => a2.label.localeCompare(b2.label))] : platforms,
86103
86103
  defaultValue: data2 && data2.data && data2.data.length ? [...[{
86104
86104
  id: "",
86105
86105
  label: t2("ALL")
@@ -86109,7 +86109,7 @@ const Header$3 = ({
86109
86109
  id: ((_a2 = platform2 == null ? void 0 : platform2.module) == null ? void 0 : _a2.id) ?? "",
86110
86110
  label: ((_b = platform2 == null ? void 0 : platform2.module) == null ? void 0 : _b.name) ?? ""
86111
86111
  };
86112
- })][0] : platforms[0],
86112
+ }).sort((a2, b2) => a2.label.localeCompare(b2.label))][0] : platforms[0],
86113
86113
  onChange: handleChangeFilter(data2 && data2.data && data2.data.length ? "module" : "platform"),
86114
86114
  getOptionValue: (item2) => item2.id
86115
86115
  })
@@ -88457,10 +88457,10 @@ const TableHeader = [{
88457
88457
  render: () => /* @__PURE__ */ jsx$1(Menu$1, {})
88458
88458
  }];
88459
88459
  const GetUsers = async (input2) => {
88460
- const data2 = await instance$1.get(`users`, formatParams$3(input2));
88460
+ const data2 = await instance$1.get(`users`, formatParams$4(input2));
88461
88461
  return data2;
88462
88462
  };
88463
- const formatParams$3 = ({ limit = 10, page = 1 }) => {
88463
+ const formatParams$4 = ({ limit = 10, page = 1 }) => {
88464
88464
  return {
88465
88465
  params: {
88466
88466
  limit,
@@ -116211,12 +116211,12 @@ const GetReviewAnalytics = async ({ params }) => {
116211
116211
  const data2 = await instance$1.get(
116212
116212
  `/listing/analytics/venue-listing-reviews`,
116213
116213
  {
116214
- params: formatParams$2(params)
116214
+ params: formatParams$3(params)
116215
116215
  }
116216
116216
  );
116217
116217
  return data2;
116218
116218
  };
116219
- const formatParams$2 = (params) => {
116219
+ const formatParams$3 = (params) => {
116220
116220
  const all = {};
116221
116221
  if (params == null ? void 0 : params.range) {
116222
116222
  Object.assign(all, {
@@ -116757,7 +116757,7 @@ const GetListingAnalytics = async ({ id: id2, params }) => {
116757
116757
  const data2 = await instance$1.get(
116758
116758
  `/listing/venue-listing/${id2}/google-analytics`,
116759
116759
  {
116760
- params: formatParams$1(params)
116760
+ params: formatParams$2(params)
116761
116761
  }
116762
116762
  );
116763
116763
  return data2;
@@ -116765,7 +116765,7 @@ const GetListingAnalytics = async ({ id: id2, params }) => {
116765
116765
  return { error: e.message };
116766
116766
  }
116767
116767
  };
116768
- const formatParams$1 = (params) => {
116768
+ const formatParams$2 = (params) => {
116769
116769
  const all = {};
116770
116770
  if (params == null ? void 0 : params.findBy) {
116771
116771
  Object.assign(all, {
@@ -148167,7 +148167,7 @@ const GetVenuesSummary = async ({
148167
148167
  `listing/venue-listing-summary/venues`,
148168
148168
  {
148169
148169
  params: {
148170
- ...formatParams(filters2),
148170
+ ...formatParams$1(filters2),
148171
148171
  limit,
148172
148172
  offset: (page - 1) * limit
148173
148173
  }
@@ -148175,7 +148175,7 @@ const GetVenuesSummary = async ({
148175
148175
  );
148176
148176
  return formatData$7(data2);
148177
148177
  };
148178
- const formatParams = (filters2 = {}) => {
148178
+ const formatParams$1 = (filters2 = {}) => {
148179
148179
  let all = {};
148180
148180
  if (filters2.connected) {
148181
148181
  Object.assign(all, {
@@ -194899,9 +194899,22 @@ function App({
194899
194899
  })
194900
194900
  });
194901
194901
  }
194902
+ const formatParams = (params) => {
194903
+ if (!params) return {};
194904
+ const formatted = { ...params };
194905
+ if (params.from) {
194906
+ delete formatted.from;
194907
+ formatted["filters[from]"] = formatDate$1(params.from, apiDateFormat);
194908
+ }
194909
+ if (params.till) {
194910
+ delete formatted.till;
194911
+ formatted["filters[till]"] = formatDate$1(params.till, apiDateFormat);
194912
+ }
194913
+ return formatted;
194914
+ };
194902
194915
  const GetPosNotifications = async ({ params }) => {
194903
194916
  const data2 = await instance$1.get(`/pos-notification`, {
194904
- params
194917
+ params: formatParams(params)
194905
194918
  });
194906
194919
  return data2;
194907
194920
  };
@@ -195279,10 +195292,13 @@ const PosNotificationHeader = ({
195279
195292
  id: "date-range",
195280
195293
  label: t2("DATE_RANGE"),
195281
195294
  mode: "range",
195282
- value: formValues.from && formValues.till ? [formValues.from, formValues.till] : void 0,
195295
+ value: formValues.from && formValues.till ? [new Date(formValues.from), new Date(formValues.till)] : void 0,
195283
195296
  onChange: (dates) => {
195284
- setValue("from", dates == null ? void 0 : dates[0]);
195285
- setValue("till", dates == null ? void 0 : dates[1]);
195297
+ if (!dates || dates.length < 2) return;
195298
+ const start = hooks(dates[0], "DD/MM/YYYY", true).format("YYYY/MM/DD");
195299
+ const end = hooks(dates[1], "DD/MM/YYYY", true).format("YYYY/MM/DD");
195300
+ setValue("from", start);
195301
+ setValue("till", end);
195286
195302
  },
195287
195303
  options: {
195288
195304
  format: "DD/MM/YYYY"
@@ -195351,16 +195367,6 @@ const PosNotifications = ({
195351
195367
  const [criteria, setCriteria] = useState("");
195352
195368
  const [selectedPayload, setSelectedPayload] = useState(null);
195353
195369
  const [isModalOpen, setIsModalOpen] = useState(false);
195354
- const getDefaultDateRange = () => {
195355
- const now2 = /* @__PURE__ */ new Date();
195356
- const firstDay = new Date(now2.getFullYear(), now2.getMonth(), 1);
195357
- const lastDay = new Date(now2.getFullYear(), now2.getMonth() + 1, 0);
195358
- return {
195359
- from: firstDay.toISOString().split("T")[0],
195360
- till: lastDay.toISOString().split("T")[0]
195361
- };
195362
- };
195363
- const defaultDates = getDefaultDateRange();
195364
195370
  const {
195365
195371
  control,
195366
195372
  watch,
@@ -195368,8 +195374,8 @@ const PosNotifications = ({
195368
195374
  } = useForm({
195369
195375
  defaultValues: {
195370
195376
  criteria: "",
195371
- from: defaultDates.from,
195372
- till: defaultDates.till,
195377
+ from: subtractDate(void 0, 1, "month"),
195378
+ till: subtractDate(void 0, 0, "day"),
195373
195379
  status: void 0,
195374
195380
  orderStatus: void 0,
195375
195381
  rms: "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mozrest-sdk-react-dev",
3
- "version": "0.3.51",
3
+ "version": "0.3.53",
4
4
  "main": "mozrest-sdk.es.js",
5
5
  "keywords": [
6
6
  "mozrest"