analytica-frontend-lib 1.2.83 → 1.2.84

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 (37) hide show
  1. package/dist/ActivitiesHistory/index.js +156 -147
  2. package/dist/ActivitiesHistory/index.js.map +1 -1
  3. package/dist/ActivitiesHistory/index.mjs +155 -146
  4. package/dist/ActivitiesHistory/index.mjs.map +1 -1
  5. package/dist/ActivityCardQuestionBanks/index.d.ts +6 -4
  6. package/dist/ActivityCardQuestionBanks/index.d.ts.map +1 -1
  7. package/dist/ActivityCardQuestionBanks/index.js.map +1 -1
  8. package/dist/ActivityCardQuestionBanks/index.mjs.map +1 -1
  9. package/dist/RecommendedLessonsHistory/index.js +129 -127
  10. package/dist/RecommendedLessonsHistory/index.js.map +1 -1
  11. package/dist/RecommendedLessonsHistory/index.mjs +128 -126
  12. package/dist/RecommendedLessonsHistory/index.mjs.map +1 -1
  13. package/dist/hooks/useActivitiesHistory/index.js.map +1 -1
  14. package/dist/hooks/useActivitiesHistory/index.mjs.map +1 -1
  15. package/dist/hooks/useActivityModels/index.d.ts +1 -1
  16. package/dist/hooks/useActivityModels/index.d.ts.map +1 -1
  17. package/dist/hooks/useActivityModels/index.js +13 -2
  18. package/dist/hooks/useActivityModels/index.js.map +1 -1
  19. package/dist/hooks/useActivityModels/index.mjs +13 -2
  20. package/dist/hooks/useActivityModels/index.mjs.map +1 -1
  21. package/dist/hooks/useActivityModels.d.ts +1 -1
  22. package/dist/hooks/useActivityModels.d.ts.map +1 -1
  23. package/dist/index.d.ts +4 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +2045 -1057
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +1994 -1008
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/types/activitiesHistory/index.d.ts +11 -1
  30. package/dist/types/activitiesHistory/index.d.ts.map +1 -1
  31. package/dist/types/activitiesHistory/index.js.map +1 -1
  32. package/dist/types/activitiesHistory/index.mjs.map +1 -1
  33. package/dist/types/activitiesHistory.d.ts +11 -1
  34. package/dist/types/activitiesHistory.d.ts.map +1 -1
  35. package/dist/types/questions.d.ts +1 -0
  36. package/dist/types/questions.d.ts.map +1 -1
  37. package/package.json +3 -1
@@ -5514,6 +5514,120 @@ var getSubjectInfo = (subject) => {
5514
5514
  };
5515
5515
  };
5516
5516
 
5517
+ // src/components/shared/ModelsTabBase/createModelsTableColumnsBase.tsx
5518
+ import { Trash, PencilSimple, PaperPlaneTilt } from "phosphor-react";
5519
+
5520
+ // src/utils/renderSubjectCell.tsx
5521
+ import { jsx as jsx33, jsxs as jsxs22 } from "react/jsx-runtime";
5522
+ var renderSubjectCell = (subjectName, mapSubjectNameToEnum, showEmptyDash = false) => {
5523
+ if (!subjectName) {
5524
+ return showEmptyDash ? /* @__PURE__ */ jsx33(Text_default, { size: "sm", color: "text-text-400", children: "-" }) : null;
5525
+ }
5526
+ const subjectEnum = mapSubjectNameToEnum?.(subjectName);
5527
+ if (!subjectEnum) {
5528
+ return /* @__PURE__ */ jsx33(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
5529
+ }
5530
+ const subjectInfo = getSubjectInfo(subjectEnum);
5531
+ return /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", title: subjectName, children: [
5532
+ /* @__PURE__ */ jsx33(
5533
+ "span",
5534
+ {
5535
+ className: cn(
5536
+ "w-[21px] h-[21px] flex items-center justify-center rounded-sm text-text-950 shrink-0",
5537
+ subjectInfo.colorClass
5538
+ ),
5539
+ children: subjectInfo.icon
5540
+ }
5541
+ ),
5542
+ /* @__PURE__ */ jsx33(Text_default, { size: "sm", className: "truncate", children: subjectName })
5543
+ ] });
5544
+ };
5545
+
5546
+ // src/components/shared/ModelsTabBase/createModelsTableColumnsBase.tsx
5547
+ import { jsx as jsx34, jsxs as jsxs23 } from "react/jsx-runtime";
5548
+ var createModelsTableColumnsBase = (mapSubjectNameToEnum, onSend, onEdit, onDelete, config) => [
5549
+ {
5550
+ key: "title",
5551
+ label: "T\xEDtulo",
5552
+ sortable: true,
5553
+ className: "max-w-[400px]",
5554
+ render: (value) => {
5555
+ const title = typeof value === "string" ? value : "";
5556
+ return /* @__PURE__ */ jsx34(Text_default, { size: "sm", title, className: "truncate block", children: title });
5557
+ }
5558
+ },
5559
+ {
5560
+ key: "savedAt",
5561
+ label: "Salvo em",
5562
+ sortable: true,
5563
+ className: "w-[120px]"
5564
+ },
5565
+ {
5566
+ key: "subject",
5567
+ label: "Mat\xE9ria",
5568
+ sortable: true,
5569
+ className: "max-w-[160px]",
5570
+ render: (value) => {
5571
+ const subjectName = typeof value === "string" ? value : "";
5572
+ return renderSubjectCell(subjectName, mapSubjectNameToEnum, true);
5573
+ }
5574
+ },
5575
+ {
5576
+ key: "actions",
5577
+ label: "",
5578
+ sortable: false,
5579
+ className: "w-[220px]",
5580
+ render: (_value, row) => {
5581
+ const handleSend = (e) => {
5582
+ e.stopPropagation();
5583
+ onSend?.(row);
5584
+ };
5585
+ const handleEdit = (e) => {
5586
+ e.stopPropagation();
5587
+ onEdit?.(row);
5588
+ };
5589
+ const handleDelete = (e) => {
5590
+ e.stopPropagation();
5591
+ onDelete(row);
5592
+ };
5593
+ return /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2 justify-end", children: [
5594
+ onSend && /* @__PURE__ */ jsx34(
5595
+ Button_default,
5596
+ {
5597
+ variant: "outline",
5598
+ action: "primary",
5599
+ size: "small",
5600
+ iconLeft: /* @__PURE__ */ jsx34(PaperPlaneTilt, { size: 16 }),
5601
+ onClick: handleSend,
5602
+ "aria-label": config.sendButtonAriaLabel,
5603
+ children: config.sendButtonLabel
5604
+ }
5605
+ ),
5606
+ /* @__PURE__ */ jsx34(
5607
+ IconButton_default,
5608
+ {
5609
+ icon: /* @__PURE__ */ jsx34(Trash, { size: 20 }),
5610
+ size: "md",
5611
+ onClick: handleDelete,
5612
+ "aria-label": config.deleteButtonAriaLabel,
5613
+ className: "text-text-600 hover:text-error-500 hover:bg-transparent"
5614
+ }
5615
+ ),
5616
+ onEdit && /* @__PURE__ */ jsx34(
5617
+ IconButton_default,
5618
+ {
5619
+ icon: /* @__PURE__ */ jsx34(PencilSimple, { size: 20 }),
5620
+ size: "md",
5621
+ onClick: handleEdit,
5622
+ "aria-label": config.editButtonAriaLabel,
5623
+ className: "text-text-600 hover:text-primary-700 hover:bg-transparent"
5624
+ }
5625
+ )
5626
+ ] });
5627
+ }
5628
+ }
5629
+ ];
5630
+
5517
5631
  // src/types/common.ts
5518
5632
  var GenericApiStatus = /* @__PURE__ */ ((GenericApiStatus2) => {
5519
5633
  GenericApiStatus2["A_VENCER"] = "A_VENCER";
@@ -5538,16 +5652,30 @@ var mapApiStatusToDisplay = (apiStatus) => {
5538
5652
  return statusMap[apiStatus];
5539
5653
  };
5540
5654
 
5655
+ // src/types/activitiesHistory.ts
5656
+ var ActivityDraftType = /* @__PURE__ */ ((ActivityDraftType2) => {
5657
+ ActivityDraftType2["MODELO"] = "MODELO";
5658
+ ActivityDraftType2["RASCUNHO"] = "RASCUNHO";
5659
+ return ActivityDraftType2;
5660
+ })(ActivityDraftType || {});
5661
+ var getActivityStatusBadgeAction = (status) => getStatusBadgeAction(status);
5662
+ var ACTIVITY_FILTER_STATUS_OPTIONS = [
5663
+ { id: "A_VENCER" /* A_VENCER */, name: "A Vencer" },
5664
+ { id: "VENCIDA" /* VENCIDA */, name: "Vencida" },
5665
+ { id: "CONCLUIDA" /* CONCLUIDA */, name: "Conclu\xEDda" }
5666
+ ];
5667
+ var mapActivityStatusToDisplay = (apiStatus) => mapApiStatusToDisplay(apiStatus);
5668
+
5541
5669
  // src/components/shared/ModelsTabBase/ModelsTabBase.tsx
5542
5670
  import { useState as useState11, useCallback as useCallback2, useMemo as useMemo4, useRef as useRef6, useEffect as useEffect13 } from "react";
5543
5671
  import { Plus } from "phosphor-react";
5544
5672
 
5545
5673
  // src/components/ActivitiesHistory/components/ErrorDisplay.tsx
5546
- import { jsx as jsx33 } from "react/jsx-runtime";
5547
- var ErrorDisplay = ({ error }) => /* @__PURE__ */ jsx33("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ jsx33(Text_default, { size: "lg", color: "text-error-500", children: error }) });
5674
+ import { jsx as jsx35 } from "react/jsx-runtime";
5675
+ var ErrorDisplay = ({ error }) => /* @__PURE__ */ jsx35("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ jsx35(Text_default, { size: "lg", color: "text-error-500", children: error }) });
5548
5676
 
5549
5677
  // src/components/shared/ModelsTabBase/ModelsTabBase.tsx
5550
- import { Fragment as Fragment7, jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
5678
+ import { Fragment as Fragment7, jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
5551
5679
  var ModelsTabBase = ({
5552
5680
  fetchModels: fetchModelsProp,
5553
5681
  deleteModel: deleteModelProp,
@@ -5639,9 +5767,9 @@ var ModelsTabBase = ({
5639
5767
  setDeleteDialogOpen(false);
5640
5768
  setModelToDelete(null);
5641
5769
  }, []);
5642
- return /* @__PURE__ */ jsxs22(Fragment7, { children: [
5643
- /* @__PURE__ */ jsx34(Toaster_default, {}),
5644
- modelsError ? /* @__PURE__ */ jsx34(ErrorDisplay, { error: modelsError }) : /* @__PURE__ */ jsx34("div", { className: "w-full", "data-testid": config.testId, children: /* @__PURE__ */ jsx34(
5770
+ return /* @__PURE__ */ jsxs24(Fragment7, { children: [
5771
+ /* @__PURE__ */ jsx36(Toaster_default, {}),
5772
+ modelsError ? /* @__PURE__ */ jsx36(ErrorDisplay, { error: modelsError }) : /* @__PURE__ */ jsx36("div", { className: "w-full", "data-testid": config.testId, children: /* @__PURE__ */ jsx36(
5645
5773
  TableProvider,
5646
5774
  {
5647
5775
  data: models,
@@ -5665,14 +5793,14 @@ var ModelsTabBase = ({
5665
5793
  image: noSearchImage
5666
5794
  },
5667
5795
  emptyState: {
5668
- component: /* @__PURE__ */ jsx34(
5796
+ component: /* @__PURE__ */ jsx36(
5669
5797
  EmptyState_default,
5670
5798
  {
5671
5799
  image: emptyStateImage,
5672
5800
  title: config.emptyStateTitle,
5673
5801
  description: config.emptyStateDescription,
5674
5802
  buttonText: "Criar modelo",
5675
- buttonIcon: /* @__PURE__ */ jsx34(Plus, { size: 18 }),
5803
+ buttonIcon: /* @__PURE__ */ jsx36(Plus, { size: 18 }),
5676
5804
  buttonVariant: "outline",
5677
5805
  buttonAction: "primary",
5678
5806
  onButtonClick: onCreateModel
@@ -5686,22 +5814,22 @@ var ModelsTabBase = ({
5686
5814
  table,
5687
5815
  pagination: paginationComponent
5688
5816
  } = renderProps;
5689
- return /* @__PURE__ */ jsxs22("div", { className: "space-y-4", children: [
5690
- /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between gap-4", children: [
5691
- /* @__PURE__ */ jsx34(
5817
+ return /* @__PURE__ */ jsxs24("div", { className: "space-y-4", children: [
5818
+ /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between gap-4", children: [
5819
+ /* @__PURE__ */ jsx36(
5692
5820
  Button_default,
5693
5821
  {
5694
5822
  variant: "solid",
5695
5823
  action: "primary",
5696
5824
  size: "medium",
5697
5825
  onClick: onCreateModel,
5698
- iconLeft: /* @__PURE__ */ jsx34(Plus, { size: 18, weight: "bold" }),
5826
+ iconLeft: /* @__PURE__ */ jsx36(Plus, { size: 18, weight: "bold" }),
5699
5827
  children: "Criar modelo"
5700
5828
  }
5701
5829
  ),
5702
5830
  controls
5703
5831
  ] }),
5704
- /* @__PURE__ */ jsxs22("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
5832
+ /* @__PURE__ */ jsxs24("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
5705
5833
  table,
5706
5834
  paginationComponent
5707
5835
  ] })
@@ -5709,7 +5837,7 @@ var ModelsTabBase = ({
5709
5837
  }
5710
5838
  }
5711
5839
  ) }),
5712
- /* @__PURE__ */ jsx34(
5840
+ /* @__PURE__ */ jsx36(
5713
5841
  AlertDialog,
5714
5842
  {
5715
5843
  isOpen: deleteDialogOpen,
@@ -5725,120 +5853,6 @@ var ModelsTabBase = ({
5725
5853
  ] });
5726
5854
  };
5727
5855
 
5728
- // src/components/shared/ModelsTabBase/createModelsTableColumnsBase.tsx
5729
- import { Trash, PencilSimple, PaperPlaneTilt } from "phosphor-react";
5730
-
5731
- // src/utils/renderSubjectCell.tsx
5732
- import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
5733
- var renderSubjectCell = (subjectName, mapSubjectNameToEnum, showEmptyDash = false) => {
5734
- if (!subjectName) {
5735
- return showEmptyDash ? /* @__PURE__ */ jsx35(Text_default, { size: "sm", color: "text-text-400", children: "-" }) : null;
5736
- }
5737
- const subjectEnum = mapSubjectNameToEnum?.(subjectName);
5738
- if (!subjectEnum) {
5739
- return /* @__PURE__ */ jsx35(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
5740
- }
5741
- const subjectInfo = getSubjectInfo(subjectEnum);
5742
- return /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2", title: subjectName, children: [
5743
- /* @__PURE__ */ jsx35(
5744
- "span",
5745
- {
5746
- className: cn(
5747
- "w-[21px] h-[21px] flex items-center justify-center rounded-sm text-text-950 shrink-0",
5748
- subjectInfo.colorClass
5749
- ),
5750
- children: subjectInfo.icon
5751
- }
5752
- ),
5753
- /* @__PURE__ */ jsx35(Text_default, { size: "sm", className: "truncate", children: subjectName })
5754
- ] });
5755
- };
5756
-
5757
- // src/components/shared/ModelsTabBase/createModelsTableColumnsBase.tsx
5758
- import { jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
5759
- var createModelsTableColumnsBase = (mapSubjectNameToEnum, onSend, onEdit, onDelete, config) => [
5760
- {
5761
- key: "title",
5762
- label: "T\xEDtulo",
5763
- sortable: true,
5764
- className: "max-w-[400px]",
5765
- render: (value) => {
5766
- const title = typeof value === "string" ? value : "";
5767
- return /* @__PURE__ */ jsx36(Text_default, { size: "sm", title, className: "truncate block", children: title });
5768
- }
5769
- },
5770
- {
5771
- key: "savedAt",
5772
- label: "Salvo em",
5773
- sortable: true,
5774
- className: "w-[120px]"
5775
- },
5776
- {
5777
- key: "subject",
5778
- label: "Mat\xE9ria",
5779
- sortable: true,
5780
- className: "max-w-[160px]",
5781
- render: (value) => {
5782
- const subjectName = typeof value === "string" ? value : "";
5783
- return renderSubjectCell(subjectName, mapSubjectNameToEnum, true);
5784
- }
5785
- },
5786
- {
5787
- key: "actions",
5788
- label: "",
5789
- sortable: false,
5790
- className: "w-[220px]",
5791
- render: (_value, row) => {
5792
- const handleSend = (e) => {
5793
- e.stopPropagation();
5794
- onSend?.(row);
5795
- };
5796
- const handleEdit = (e) => {
5797
- e.stopPropagation();
5798
- onEdit?.(row);
5799
- };
5800
- const handleDelete = (e) => {
5801
- e.stopPropagation();
5802
- onDelete(row);
5803
- };
5804
- return /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 justify-end", children: [
5805
- onSend && /* @__PURE__ */ jsx36(
5806
- Button_default,
5807
- {
5808
- variant: "outline",
5809
- action: "primary",
5810
- size: "small",
5811
- iconLeft: /* @__PURE__ */ jsx36(PaperPlaneTilt, { size: 16 }),
5812
- onClick: handleSend,
5813
- "aria-label": config.sendButtonAriaLabel,
5814
- children: config.sendButtonLabel
5815
- }
5816
- ),
5817
- /* @__PURE__ */ jsx36(
5818
- IconButton_default,
5819
- {
5820
- icon: /* @__PURE__ */ jsx36(Trash, { size: 20 }),
5821
- size: "md",
5822
- onClick: handleDelete,
5823
- "aria-label": config.deleteButtonAriaLabel,
5824
- className: "text-text-600 hover:text-error-500 hover:bg-transparent"
5825
- }
5826
- ),
5827
- onEdit && /* @__PURE__ */ jsx36(
5828
- IconButton_default,
5829
- {
5830
- icon: /* @__PURE__ */ jsx36(PencilSimple, { size: 20 }),
5831
- size: "md",
5832
- onClick: handleEdit,
5833
- "aria-label": config.editButtonAriaLabel,
5834
- className: "text-text-600 hover:text-primary-700 hover:bg-transparent"
5835
- }
5836
- )
5837
- ] });
5838
- }
5839
- }
5840
- ];
5841
-
5842
5856
  // src/utils/hookErrorHandler.ts
5843
5857
  import { z } from "zod";
5844
5858
  var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (error) => {
@@ -5854,22 +5868,6 @@ var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (
5854
5868
  import { useState as useState12, useCallback as useCallback3 } from "react";
5855
5869
  import { z as z2 } from "zod";
5856
5870
  import dayjs from "dayjs";
5857
-
5858
- // src/types/activitiesHistory.ts
5859
- var ActivityDraftType = /* @__PURE__ */ ((ActivityDraftType2) => {
5860
- ActivityDraftType2["MODELO"] = "MODELO";
5861
- ActivityDraftType2["RASCUNHO"] = "RASCUNHO";
5862
- return ActivityDraftType2;
5863
- })(ActivityDraftType || {});
5864
- var getActivityStatusBadgeAction = (status) => getStatusBadgeAction(status);
5865
- var ACTIVITY_FILTER_STATUS_OPTIONS = [
5866
- { id: "A_VENCER" /* A_VENCER */, name: "A Vencer" },
5867
- { id: "VENCIDA" /* VENCIDA */, name: "Vencida" },
5868
- { id: "CONCLUIDA" /* CONCLUIDA */, name: "Conclu\xEDda" }
5869
- ];
5870
- var mapActivityStatusToDisplay = (apiStatus) => mapApiStatusToDisplay(apiStatus);
5871
-
5872
- // src/hooks/useActivitiesHistory.ts
5873
5871
  var activityHistoryResponseSchema = z2.object({
5874
5872
  id: z2.string().uuid(),
5875
5873
  title: z2.string(),
@@ -6001,12 +5999,23 @@ var DEFAULT_MODELS_PAGINATION = {
6001
5999
  totalPages: 0
6002
6000
  };
6003
6001
  var transformModelToTableItem = (model, subjectsMap) => {
6004
- const subjectName = model.subjectId ? subjectsMap?.get(model.subjectId) || "" : "";
6002
+ let subject = model.subject;
6003
+ if (!subject && model.subjectId && subjectsMap) {
6004
+ const subjectName = subjectsMap.get(model.subjectId);
6005
+ if (subjectName) {
6006
+ subject = {
6007
+ id: model.subjectId,
6008
+ subjectName,
6009
+ subjectIcon: "BookOpen",
6010
+ subjectColor: "#6B7280"
6011
+ };
6012
+ }
6013
+ }
6005
6014
  return {
6006
6015
  id: model.id,
6007
6016
  title: model.title || "Sem t\xEDtulo",
6008
6017
  savedAt: dayjs2(model.createdAt).format("DD/MM/YYYY"),
6009
- subject: subjectName,
6018
+ subject: subject || null,
6010
6019
  subjectId: model.subjectId
6011
6020
  };
6012
6021
  };