@m4l/gclick 0.3.5 → 0.3.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"useReportSheetContentFetch.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/gclick/src/components/ReportsViewer/hooks/useReportSheetContentFetch/useReportSheetContentFetch.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,gCAAgC,CAiG/F"}
1
+ {"version":3,"file":"useReportSheetContentFetch.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/gclick/src/components/ReportsViewer/hooks/useReportSheetContentFetch/useReportSheetContentFetch.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,gCAAgC,CAiG/F"}
@@ -1,10 +1,10 @@
1
1
  import { useState as i, useRef as S, useEffect as d, useCallback as T } from "react";
2
2
  import { useNetwork as D } from "@m4l/core";
3
- import { useReportStructureData as h } from "../useReportStructureData/useReportStructureData.js";
4
- import { REPORT_SHEET_CONTENT_FETCH_ERROR_MESSAGE as N } from "../../constants.js";
5
- import { useReportsViewerContext as O, useReportsViewerStore as _ } from "../useReportsViewerStore/useReportsViewerStore.js";
3
+ import { useReportsViewerContext as h, useReportsViewerStore as N } from "../useReportsViewerStore/useReportsViewerStore.js";
4
+ import { useReportStructureData as O } from "../useReportStructureData/useReportStructureData.js";
5
+ import { REPORT_SHEET_CONTENT_FETCH_ERROR_MESSAGE as _ } from "../../constants.js";
6
6
  function H(t) {
7
- const { endpoint: f } = O(), { networkOperation: m } = D(), { structureData: p } = h(), C = _((r) => r.sheetQueue), [n, E] = i(null), [g, o] = i(!1), [R, s] = i(null), u = S(null), e = (C ?? []).includes(t), a = p && t >= 0 && t < p.sheets.length;
7
+ const { endpoint: f } = h(), { networkOperation: m } = D(), { structureData: p } = O(), C = N((r) => r.sheetQueue), [n, E] = i(null), [g, o] = i(!1), [R, s] = i(null), u = S(null), e = (C ?? []).includes(t), a = p && t >= 0 && t < p.sheets.length;
8
8
  d(() => {
9
9
  e || (E(null), o(!1), s(null));
10
10
  }, [e]);
@@ -30,7 +30,7 @@ function H(t) {
30
30
  } catch (l) {
31
31
  if (r.aborted)
32
32
  return;
33
- const c = l instanceof Error ? l : new Error(N);
33
+ const c = l instanceof Error ? l : new Error(_);
34
34
  o(!1), s(c);
35
35
  }
36
36
  }, [f, m, t, a]);
@@ -1,16 +1,16 @@
1
1
  import { useCallback as p } from "react";
2
- import { shallow as c } from "zustand/shallow";
3
- import { useReportsViewerStore as S } from "../useReportsViewerStore/useReportsViewerStore.js";
2
+ import { useReportsViewerStore as c } from "../useReportsViewerStore/useReportsViewerStore.js";
3
+ import { shallow as S } from "zustand/shallow";
4
4
  const F = { mapVisible: !1, mapFeatures: [] };
5
5
  function M(e) {
6
- const { mapVisible: o, mapFeatures: s, setSheetMapState: t } = S((a) => {
6
+ const { mapVisible: o, mapFeatures: s, setSheetMapState: t } = c((a) => {
7
7
  const i = a.hashSheets[e] ?? F;
8
8
  return {
9
9
  mapVisible: i.mapVisible,
10
10
  mapFeatures: i.mapFeatures ?? [],
11
11
  setSheetMapState: a.reportsViewerActions.setSheetMapState
12
12
  };
13
- }, c), m = p(
13
+ }, S), m = p(
14
14
  (a) => {
15
15
  const r = s ?? [];
16
16
  if (r.some((n) => String(n.id) === String(a.id))) {
@@ -1,9 +1,9 @@
1
1
  import { useState as u, useRef as S, useCallback as m, useEffect as w } from "react";
2
2
  import { useNetwork as C } from "@m4l/core";
3
- import { REPORT_STRUCTURE_FETCH_ERROR_MESSAGE as T } from "../../constants.js";
4
- import { useReportsViewerContext as g } from "../useReportsViewerStore/useReportsViewerStore.js";
3
+ import { useReportsViewerContext as T } from "../useReportsViewerStore/useReportsViewerStore.js";
4
+ import { REPORT_STRUCTURE_FETCH_ERROR_MESSAGE as g } from "../../constants.js";
5
5
  function k() {
6
- const { endpoint: n, onLoad: c, onError: l } = g(), { networkOperation: i } = C(), [d, s] = u("loading"), [p, t] = u(null), [E, R] = u(null), e = S(null), o = m(async () => {
6
+ const { endpoint: n, onLoad: c, onError: l } = T(), { networkOperation: i } = C(), [d, s] = u("loading"), [p, t] = u(null), [E, R] = u(null), e = S(null), o = m(async () => {
7
7
  e.current?.abort(), e.current = new AbortController();
8
8
  const a = e.current.signal;
9
9
  s("loading"), t(null);
@@ -23,7 +23,7 @@ function k() {
23
23
  } catch (r) {
24
24
  if (a.aborted)
25
25
  return;
26
- const f = r instanceof Error ? r : new Error(T);
26
+ const f = r instanceof Error ? r : new Error(g);
27
27
  s("error"), t(f), l?.(f);
28
28
  }
29
29
  }, [n, c, l, i]);
@@ -4,9 +4,9 @@ import { useModuleDictionary as S } from "@m4l/core";
4
4
  import { LoadingError as T } from "@m4l/components";
5
5
  import { TabContentStyled as g, SectionContainerStyled as O } from "../../slots/ReportsViewerSlots.js";
6
6
  import { REPORTS_VIEWER_DICTIONARY as c } from "../../dictionary.js";
7
- import { shallow as h } from "zustand/shallow";
8
- import { REPORTS_VIEWER_GOOGLE_MAPS_API_KEY as y, REPORT_SHEET_MAP_ANCHOR_ID_PREFIX as I } from "../../constants.js";
9
- import { useReportsViewerStore as M } from "../../hooks/useReportsViewerStore/useReportsViewerStore.js";
7
+ import { useReportsViewerStore as h } from "../../hooks/useReportsViewerStore/useReportsViewerStore.js";
8
+ import { shallow as y } from "zustand/shallow";
9
+ import { REPORTS_VIEWER_GOOGLE_MAPS_API_KEY as I, REPORT_SHEET_MAP_ANCHOR_ID_PREFIX as M } from "../../constants.js";
10
10
  import { useReportSheetContentFetch as C } from "../../hooks/useReportSheetContentFetch/useReportSheetContentFetch.js";
11
11
  import { MapProvider as L } from "../../../maps/components/GpsMap/contexts/MapContext/MapContext.js";
12
12
  import { getReportSheetMapInitialLayer as P } from "../../helpers/getReportSheetMapInitialLayer/getReportSheetMapInitialLayer.js";
@@ -16,19 +16,19 @@ import { ReportsViewerLoading as b } from "../ReportsViewerLoading/ReportsViewer
16
16
  import { SectionRenderer as N } from "../SectionRenderer/SectionRenderer.js";
17
17
  import { ReportsViewerMessage as V } from "../ReportsViewerMessage/ReportsViewerMessage.js";
18
18
  function Z({ sheetIndex: e, ownerState: o }) {
19
- const s = _().replace(/:/g, "-"), l = `report-sheet-map-${e}-${s}`, { getLabel: R } = S(), { selectedTabIndex: d, sheetQueue: u } = M(
19
+ const s = _().replace(/:/g, "-"), l = `report-sheet-map-${e}-${s}`, { getLabel: R } = S(), { selectedTabIndex: d, sheetQueue: u } = h(
20
20
  (t) => ({
21
21
  selectedTabIndex: t.selectedTabIndex,
22
22
  sheetQueue: t.sheetQueue
23
23
  }),
24
- h
24
+ y
25
25
  ), { status: i, contentData: n, error: p } = C(e), f = (u ?? []).includes(e), E = e === d;
26
26
  return f ? /* @__PURE__ */ a(g, { ownerState: { ...o, isSelected: E }, children: [
27
27
  /* @__PURE__ */ a(
28
28
  L,
29
29
  {
30
30
  storeId: l,
31
- googleMapsApiKey: y,
31
+ googleMapsApiKey: I,
32
32
  googleMapVersion: "weekly",
33
33
  initialLayers: P(),
34
34
  children: [
@@ -37,7 +37,7 @@ function Z({ sheetIndex: e, ownerState: o }) {
37
37
  $,
38
38
  {
39
39
  sheetIndex: e,
40
- anchorId: `${I}-${e}-${s}`
40
+ anchorId: `${M}-${e}-${s}`
41
41
  }
42
42
  )
43
43
  ]
@@ -1,22 +1,22 @@
1
1
  import { jsx as o, jsxs as b, Fragment as d } from "@emotion/react/jsx-runtime";
2
2
  import { Tabs as u, Tab as h } from "@m4l/components";
3
3
  import { TabsContainerStyled as T } from "../../slots/ReportsViewerSlots.js";
4
- import { useCallback as f, useMemo as l } from "react";
4
+ import { useReportsViewerStore as l } from "../../hooks/useReportsViewerStore/useReportsViewerStore.js";
5
+ import { useCallback as f, useMemo as c } from "react";
5
6
  import { useReportStructureData as C } from "../../hooks/useReportStructureData/useReportStructureData.js";
6
- import { useReportsViewerStore as c } from "../../hooks/useReportsViewerStore/useReportsViewerStore.js";
7
7
  import { ReportSheetTabPanel as v } from "../ReportSheetTabPanel/ReportSheetTabPanel.js";
8
8
  function x({ ownerState: r }) {
9
- const { structureData: n } = C(), i = c((e) => e.selectedTabIndex), s = c(
9
+ const { structureData: n } = C(), i = l((e) => e.selectedTabIndex), s = l(
10
10
  (e) => e.reportsViewerActions.setSelectedTabIndex
11
11
  ), m = f(
12
12
  (e, t) => {
13
13
  s(t);
14
14
  },
15
15
  [s]
16
- ), a = l(
16
+ ), a = c(
17
17
  () => n?.sheets ?? [],
18
18
  [n?.sheets]
19
- ), p = l(
19
+ ), p = c(
20
20
  () => a.map((e, t) => /* @__PURE__ */ o(
21
21
  v,
22
22
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/gclick",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },