analytica-frontend-lib 1.4.0 → 1.4.1

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,7 +1,7 @@
1
- import { type ComparatorTabType, type ComparatorApiClient, type UseComparatorReturn } from '../types/comparator';
1
+ import { type ComparatorApiClient, type UseComparatorReturn } from '../types/comparator';
2
2
  export interface UseComparatorConfig {
3
3
  apiClient: ComparatorApiClient;
4
- endpoints?: Partial<Record<ComparatorTabType, string>>;
4
+ endpoint?: string;
5
5
  defaultPeriod?: string;
6
6
  }
7
7
  export declare function createUseComparator(config: UseComparatorConfig): () => UseComparatorReturn;
@@ -1 +1 @@
1
- {"version":3,"file":"useComparator.d.ts","sourceRoot":"","sources":["../../src/hooks/useComparator.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,iBAAiB,EAMtB,KAAK,mBAAmB,EAKxB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAqG7B,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,SAK5B,mBAAmB,CAiErD;AAGD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,mBAAmB,SApE7B,mBAAmB,CAsErD"}
1
+ {"version":3,"file":"useComparator.d.ts","sourceRoot":"","sources":["../../src/hooks/useComparator.ts"],"names":[],"mappings":"AACA,OAAO,EASL,KAAK,mBAAmB,EAKxB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAiG7B,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,SAO5B,mBAAmB,CAgErD;AAGD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,mBAAmB,SAnE7B,mBAAmB,CAqErD"}
package/dist/index.js CHANGED
@@ -51483,15 +51483,13 @@ function transformNationalAverages(apiData) {
51483
51483
  };
51484
51484
  });
51485
51485
  }
51486
- var TAB_ENDPOINTS = {
51487
- "knowledge-areas": "/comparator/knowledge-areas",
51488
- "curricular-components": "/comparator/curricular-components",
51489
- competencies: "/comparator/competencies",
51490
- "national-averages": "/comparator/national-averages"
51491
- };
51486
+ var COMPARATOR_ENDPOINT = "/comparator";
51492
51487
  function createUseComparator(config) {
51493
- const { apiClient, endpoints = {}, defaultPeriod = "1_MONTH" } = config;
51494
- const resolvedEndpoints = { ...TAB_ENDPOINTS, ...endpoints };
51488
+ const {
51489
+ apiClient,
51490
+ endpoint = COMPARATOR_ENDPOINT,
51491
+ defaultPeriod = "1_MONTH" /* ONE_MONTH */
51492
+ } = config;
51495
51493
  return function useComparator() {
51496
51494
  const [data, setData] = (0, import_react198.useState)({
51497
51495
  knowledgeAreas: [],
@@ -51506,8 +51504,7 @@ function createUseComparator(config) {
51506
51504
  setLoading(true);
51507
51505
  setError(null);
51508
51506
  try {
51509
- const endpoint = resolvedEndpoints[tab];
51510
- const body = type === "school" ? { schoolIds: ids, period: defaultPeriod } : { schoolYearIds: ids, period: defaultPeriod };
51507
+ const body = type === "school" ? { type: tab, schoolIds: ids, period: defaultPeriod } : { type: tab, schoolYearIds: ids, period: defaultPeriod };
51511
51508
  const response = await apiClient.post(endpoint, body);
51512
51509
  const apiData = response.data.data;
51513
51510
  setData((prev) => {