@databrainhq/plugin 0.8.3 → 0.8.5

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.
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React$6 from "react";
2
- import React__default, { useEffect, useLayoutEffect, useRef, useState, forwardRef, Fragment as Fragment$1, isValidElement, cloneElement as cloneElement$1, createElement as createElement$1, createContext, useContext, useReducer, createRef, useMemo, PureComponent, memo as memo$1 } from "react";
2
+ import React__default, { useEffect, useLayoutEffect, useRef, useState, forwardRef, Fragment as Fragment$1, isValidElement, cloneElement as cloneElement$1, createElement as createElement$1, createContext, useContext, useReducer, createRef, useMemo, useCallback, PureComponent, memo as memo$1 } from "react";
3
3
  import ReactDOM from "react-dom";
4
4
  function _setPrototypeOf$7(o2, p2) {
5
5
  _setPrototypeOf$7 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
@@ -2641,17 +2641,17 @@ var classnames$1 = { exports: {} };
2641
2641
  })(classnames$1);
2642
2642
  var classnames = classnames$1.exports;
2643
2643
  var styles$E = {
2644
- "btn-primary": "_btn-primary_u81u9_1",
2645
- "btn-secondary": "_btn-secondary_u81u9_9",
2646
- "btn-reject": "_btn-reject_u81u9_17",
2647
- "btn-outlined": "_btn-outlined_u81u9_27",
2648
- "btn-tertiary": "_btn-tertiary_u81u9_35",
2649
- "btn-default": "_btn-default_u81u9_43",
2650
- "btn-large": "_btn-large_u81u9_49",
2651
- "btn-small": "_btn-small_u81u9_55",
2652
- "btn-xs": "_btn-xs_u81u9_61",
2653
- "btn-medium": "_btn-medium_u81u9_67",
2654
- "btn-11rem": "_btn-11rem_u81u9_75"
2644
+ "btn-primary": "_btn-primary_17kvk_1",
2645
+ "btn-secondary": "_btn-secondary_17kvk_5",
2646
+ "btn-reject": "_btn-reject_17kvk_9",
2647
+ "btn-outlined": "_btn-outlined_17kvk_14",
2648
+ "btn-tertiary": "_btn-tertiary_17kvk_18",
2649
+ "btn-default": "_btn-default_17kvk_22",
2650
+ "btn-large": "_btn-large_17kvk_25",
2651
+ "btn-small": "_btn-small_17kvk_28",
2652
+ "btn-xs": "_btn-xs_17kvk_31",
2653
+ "btn-medium": "_btn-medium_17kvk_34",
2654
+ "btn-11rem": "_btn-11rem_17kvk_38"
2655
2655
  };
2656
2656
  var jsxRuntime = { exports: {} };
2657
2657
  var reactJsxRuntime_production_min = {};
@@ -4940,37 +4940,37 @@ let xe = "div", ne = S.RenderStrategy, re = C$2(function(e2, s2) {
4940
4940
  let n2 = useContext(F) !== null, m2 = s() !== null;
4941
4941
  return React__default.createElement(React__default.Fragment, null, !n2 && m2 ? React__default.createElement(q, { ref: s$12, ...e2 }) : React__default.createElement(re, { ref: s$12, ...e2 }));
4942
4942
  }), We = Object.assign(q, { Child: Pe, Root: q });
4943
- const listBoxButton = "_listBoxButton_1uwmw_9";
4944
- const selectedOptionText = "_selectedOptionText_1uwmw_33";
4945
- const transitionDiv = "_transitionDiv_1uwmw_41";
4946
- const listboxButtonWrapper = "_listboxButtonWrapper_1uwmw_49";
4947
- const arrowicon = "_arrowicon_1uwmw_55";
4948
- const leave$2 = "_leave_1uwmw_61";
4949
- const leaveFrom$2 = "_leaveFrom_1uwmw_67";
4950
- const leaveTo$2 = "_leaveTo_1uwmw_73";
4951
- const notAvailable = "_notAvailable_1uwmw_79";
4952
- const option$1 = "_option_1uwmw_85";
4953
- const activeOption = "_activeOption_1uwmw_91";
4954
- const optionSelected = "_optionSelected_1uwmw_97";
4955
- const inactiveOption = "_inactiveOption_1uwmw_103";
4956
- const optionLabel = "_optionLabel_1uwmw_109";
4957
- const optionSubLabel = "_optionSubLabel_1uwmw_115";
4958
- const selectedLabel = "_selectedLabel_1uwmw_121";
4959
- const nonselectedLabel = "_nonselectedLabel_1uwmw_127";
4960
- const check = "_check_1uwmw_133";
4961
- const checkActive = "_checkActive_1uwmw_139";
4962
- const checkInactive = "_checkInactive_1uwmw_145";
4963
- const checkIcon$1 = "_checkIcon_1uwmw_151";
4964
- const checkIconSelected = "_checkIconSelected_1uwmw_157";
4965
- const checkIconUnselected = "_checkIconUnselected_1uwmw_163";
4966
- const loadMore$1 = "_loadMore_1uwmw_169";
4967
- const selectedList = "_selectedList_1uwmw_175";
4968
- const selectedListItem = "_selectedListItem_1uwmw_181";
4943
+ const listBoxButton = "_listBoxButton_1xd0l_5";
4944
+ const selectedOptionText = "_selectedOptionText_1xd0l_17";
4945
+ const transitionDiv = "_transitionDiv_1xd0l_21";
4946
+ const listboxButtonWrapper = "_listboxButtonWrapper_1xd0l_25";
4947
+ const arrowicon = "_arrowicon_1xd0l_28";
4948
+ const leave$2 = "_leave_1xd0l_31";
4949
+ const leaveFrom$2 = "_leaveFrom_1xd0l_34";
4950
+ const leaveTo$2 = "_leaveTo_1xd0l_37";
4951
+ const notAvailable = "_notAvailable_1xd0l_40";
4952
+ const option$1 = "_option_1xd0l_43";
4953
+ const activeOption = "_activeOption_1xd0l_46";
4954
+ const optionSelected = "_optionSelected_1xd0l_49";
4955
+ const inactiveOption = "_inactiveOption_1xd0l_52";
4956
+ const optionLabel = "_optionLabel_1xd0l_55";
4957
+ const optionSubLabel = "_optionSubLabel_1xd0l_58";
4958
+ const selectedLabel = "_selectedLabel_1xd0l_61";
4959
+ const nonselectedLabel = "_nonselectedLabel_1xd0l_64";
4960
+ const check = "_check_1xd0l_67";
4961
+ const checkActive = "_checkActive_1xd0l_70";
4962
+ const checkInactive = "_checkInactive_1xd0l_73";
4963
+ const checkIcon$1 = "_checkIcon_1xd0l_76";
4964
+ const checkIconSelected = "_checkIconSelected_1xd0l_79";
4965
+ const checkIconUnselected = "_checkIconUnselected_1xd0l_82";
4966
+ const loadMore$1 = "_loadMore_1xd0l_85";
4967
+ const selectedList = "_selectedList_1xd0l_88";
4968
+ const selectedListItem = "_selectedListItem_1xd0l_91";
4969
4969
  var style = {
4970
- "listBox-label": "_listBox-label_1uwmw_1",
4971
- "listBoxButton-container": "_listBoxButton-container_1uwmw_9",
4970
+ "listBox-label": "_listBox-label_1xd0l_1",
4971
+ "listBoxButton-container": "_listBoxButton-container_1xd0l_5",
4972
4972
  listBoxButton,
4973
- "listBox-option": "_listBox-option_1uwmw_25",
4973
+ "listBox-option": "_listBox-option_1xd0l_13",
4974
4974
  selectedOptionText,
4975
4975
  transitionDiv,
4976
4976
  listboxButtonWrapper,
@@ -4997,22 +4997,22 @@ var style = {
4997
4997
  selectedList,
4998
4998
  selectedListItem
4999
4999
  };
5000
- const primary = "_primary_1ipyg_1";
5001
- const secondary = "_secondary_1ipyg_9";
5002
- const tertiary = "_tertiary_1ipyg_19";
5000
+ const primary = "_primary_18yak_1";
5001
+ const secondary = "_secondary_18yak_5";
5002
+ const tertiary = "_tertiary_18yak_10";
5003
5003
  var styles$C = {
5004
5004
  primary,
5005
5005
  secondary,
5006
5006
  tertiary,
5007
- "font-18": "_font-18_1ipyg_27",
5008
- "font-20": "_font-20_1ipyg_35",
5009
- "font-14": "_font-14_1ipyg_43",
5010
- "font-14a": "_font-14a_1ipyg_51",
5011
- "font-14b": "_font-14b_1ipyg_59",
5012
- "font-14c": "_font-14c_1ipyg_67",
5013
- "font-14d": "_font-14d_1ipyg_75",
5014
- "font-15": "_font-15_1ipyg_83",
5015
- "font-34": "_font-34_1ipyg_89"
5007
+ "font-18": "_font-18_18yak_14",
5008
+ "font-20": "_font-20_18yak_18",
5009
+ "font-14": "_font-14_18yak_22",
5010
+ "font-14a": "_font-14a_18yak_26",
5011
+ "font-14b": "_font-14b_18yak_30",
5012
+ "font-14c": "_font-14c_18yak_34",
5013
+ "font-14d": "_font-14d_18yak_38",
5014
+ "font-15": "_font-15_18yak_42",
5015
+ "font-34": "_font-34_18yak_45"
5016
5016
  };
5017
5017
  const variants = {
5018
5018
  h1: "h1",
@@ -5040,10 +5040,10 @@ const Text = ({
5040
5040
  children: children2
5041
5041
  });
5042
5042
  };
5043
- const search$1 = "_search_qirxg_1";
5043
+ const search$1 = "_search_1klck_1";
5044
5044
  var styles$B = {
5045
- "searchTab-container": "_searchTab-container_qirxg_1",
5046
- "searchTab-input": "_searchTab-input_qirxg_9",
5045
+ "searchTab-container": "_searchTab-container_1klck_1",
5046
+ "searchTab-input": "_searchTab-input_1klck_5",
5047
5047
  search: search$1
5048
5048
  };
5049
5049
  const iconoirSearch = (props) => /* @__PURE__ */ jsx("svg", {
@@ -6661,6 +6661,22 @@ const useGenerateEmbeddedMeticMutation = (options2) => useMutation(
6661
6661
  (variables) => fetcher(GenerateEmbeddedMeticDocument, variables)(),
6662
6662
  options2
6663
6663
  );
6664
+ const GetClientDashboardLayoutDocument = `
6665
+ query GetClientDashboardLayout($clientId: String!, $externalDashboardId: uuid!) {
6666
+ clientDashboardMetrics_by_pk(
6667
+ clientId: $clientId
6668
+ externalDashboardId: $externalDashboardId
6669
+ ) {
6670
+ clientId
6671
+ externalDashboardId
6672
+ }
6673
+ }
6674
+ `;
6675
+ const useGetClientDashboardLayoutQuery = (variables, options2) => useQuery(
6676
+ ["GetClientDashboardLayout", variables],
6677
+ fetcher(GetClientDashboardLayoutDocument, variables),
6678
+ options2
6679
+ );
6664
6680
  const CompanySubsetTableDataDocument = `
6665
6681
  mutation CompanySubsetTableData($clientId: String = "", $companyId: String = "") {
6666
6682
  companySubsetTableData(input: {clientId: $clientId, companyId: $companyId}) {
@@ -6819,14 +6835,35 @@ const useUnderlyingDataMutation = (options2) => useMutation(
6819
6835
  (variables) => fetcher(UnderlyingDataDocument, variables)(),
6820
6836
  options2
6821
6837
  );
6838
+ const MarkClientDashboardLayoutChangeDocument = `
6839
+ mutation MarkClientDashboardLayoutChange($clientId: String!, $externalDashboardId: uuid!) {
6840
+ insert_clientDashboardMetrics_one(
6841
+ object: {clientId: $clientId, externalDashboardId: $externalDashboardId}
6842
+ ) {
6843
+ clientId
6844
+ externalDashboardId
6845
+ }
6846
+ }
6847
+ `;
6848
+ const useMarkClientDashboardLayoutChangeMutation = (options2) => useMutation(
6849
+ ["MarkClientDashboardLayoutChange"],
6850
+ (variables) => fetcher(MarkClientDashboardLayoutChangeDocument, variables)(),
6851
+ options2
6852
+ );
6822
6853
  const MarkDeleteMetricDocument = `
6823
- mutation MarkDeleteMetric($id: uuid! = "") {
6854
+ mutation MarkDeleteMetric($id: uuid! = "", $clientId: String! = "") {
6824
6855
  update_externalMetrics_by_pk(
6825
6856
  pk_columns: {id: $id}
6826
6857
  _set: {isMarkedDeleted: true}
6827
6858
  ) {
6828
6859
  id
6829
6860
  }
6861
+ insert_clientDeletedMetrics_one(
6862
+ object: {externalMetricId: $id, clientId: $clientId}
6863
+ ) {
6864
+ clientId
6865
+ externalMetricId
6866
+ }
6830
6867
  }
6831
6868
  `;
6832
6869
  const useMarkDeleteMetricMutation = (options2) => useMutation(
@@ -6887,6 +6924,21 @@ const useRawCsvMutation = (options2) => useMutation(
6887
6924
  (variables) => fetcher(RawCsvDocument, variables)(),
6888
6925
  options2
6889
6926
  );
6927
+ const ResizeExternalMetricDocument = `
6928
+ mutation resizeExternalMetric($id: uuid!, $resizeAttributes: jsonb!) {
6929
+ update_externalMetrics_by_pk(
6930
+ pk_columns: {id: $id}
6931
+ _set: {resizeAttributes: $resizeAttributes}
6932
+ ) {
6933
+ resizeAttributes
6934
+ }
6935
+ }
6936
+ `;
6937
+ const useResizeExternalMetricMutation = (options2) => useMutation(
6938
+ ["resizeExternalMetric"],
6939
+ (variables) => fetcher(ResizeExternalMetricDocument, variables)(),
6940
+ options2
6941
+ );
6890
6942
  const ExternalMetricForm = ({
6891
6943
  onSubmit,
6892
6944
  defaultValues,
@@ -6996,22 +7048,22 @@ const ExternalMetricForm = ({
6996
7048
  })]
6997
7049
  });
6998
7050
  };
6999
- const container$d = "_container_1b6ua_1";
7000
- const wrapper$3 = "_wrapper_1b6ua_9";
7001
- const label$3 = "_label_1b6ua_17";
7002
- const floatingLabel = "_floatingLabel_1b6ua_25";
7003
- const clientText = "_clientText_1b6ua_33";
7004
- const normalText = "_normalText_1b6ua_41";
7005
- const dropdown$1 = "_dropdown_1b6ua_49";
7006
- const options = "_options_1b6ua_57";
7007
- const checkedOption = "_checkedOption_1b6ua_65";
7008
- const option = "_option_1b6ua_57";
7009
- const icon$1 = "_icon_1b6ua_81";
7010
- const text$2 = "_text_1b6ua_89";
7011
- const floatingText = "_floatingText_1b6ua_97";
7012
- const search = "_search_1b6ua_105";
7013
- const loadMore = "_loadMore_1b6ua_113";
7014
- const loadMoreIcon = "_loadMoreIcon_1b6ua_121";
7051
+ const container$d = "_container_q0qrl_1";
7052
+ const wrapper$3 = "_wrapper_q0qrl_5";
7053
+ const label$3 = "_label_q0qrl_9";
7054
+ const floatingLabel = "_floatingLabel_q0qrl_13";
7055
+ const clientText = "_clientText_q0qrl_17";
7056
+ const normalText = "_normalText_q0qrl_21";
7057
+ const dropdown$1 = "_dropdown_q0qrl_25";
7058
+ const options = "_options_q0qrl_29";
7059
+ const checkedOption = "_checkedOption_q0qrl_33";
7060
+ const option = "_option_q0qrl_29";
7061
+ const icon$1 = "_icon_q0qrl_41";
7062
+ const text$2 = "_text_q0qrl_45";
7063
+ const floatingText = "_floatingText_q0qrl_49";
7064
+ const search = "_search_q0qrl_53";
7065
+ const loadMore = "_loadMore_q0qrl_57";
7066
+ const loadMoreIcon = "_loadMoreIcon_q0qrl_61";
7015
7067
  var styles$s = {
7016
7068
  container: container$d,
7017
7069
  wrapper: wrapper$3,
@@ -7417,6 +7469,73 @@ const useApplyAdminTheme = (adminTheme) => {
7417
7469
  document.head.appendChild(adminStyles);
7418
7470
  }, [adminTheme]);
7419
7471
  };
7472
+ const useClientDashboardLayout = ({
7473
+ externalDashboardId,
7474
+ clientId
7475
+ }) => {
7476
+ const queryClient2 = useQueryClient();
7477
+ const { data: clientLayoutData } = useGetClientDashboardLayoutQuery(
7478
+ {
7479
+ clientId,
7480
+ externalDashboardId
7481
+ },
7482
+ { enabled: Boolean(externalDashboardId && clientId) }
7483
+ );
7484
+ const isLayoutChanged = useMemo(
7485
+ () => !!(clientLayoutData == null ? void 0 : clientLayoutData.clientDashboardMetrics_by_pk),
7486
+ [clientLayoutData == null ? void 0 : clientLayoutData.clientDashboardMetrics_by_pk]
7487
+ );
7488
+ const { mutateAsync: markClientLayoutChangeMutation } = useMarkClientDashboardLayoutChangeMutation();
7489
+ const markClientLayoutChange = useCallback(async () => {
7490
+ if (!clientId || !externalDashboardId || isLayoutChanged)
7491
+ return;
7492
+ await markClientLayoutChangeMutation(
7493
+ {
7494
+ clientId,
7495
+ externalDashboardId
7496
+ },
7497
+ {
7498
+ onSuccess: (res) => {
7499
+ if (!res.insert_clientDashboardMetrics_one)
7500
+ return;
7501
+ queryClient2.setQueryData(
7502
+ ["GetClientDashboardLayout", { clientId, externalDashboardId }],
7503
+ (prev) => {
7504
+ return {
7505
+ ...prev,
7506
+ clientDashboardMetrics_by_pk: res.insert_clientDashboardMetrics_one
7507
+ };
7508
+ }
7509
+ );
7510
+ }
7511
+ }
7512
+ );
7513
+ }, [
7514
+ markClientLayoutChangeMutation,
7515
+ isLayoutChanged,
7516
+ clientId,
7517
+ externalDashboardId
7518
+ ]);
7519
+ const { mutateAsync: resizeMetricCard } = useResizeExternalMetricMutation();
7520
+ const handleLayoutChange = useCallback(
7521
+ async (_layout, _oldItem, newItem) => {
7522
+ await Promise.all([
7523
+ resizeMetricCard({
7524
+ id: newItem.i,
7525
+ resizeAttributes: {
7526
+ width: newItem.w,
7527
+ height: newItem.h,
7528
+ xAxis: newItem.x,
7529
+ yAxis: newItem.y
7530
+ }
7531
+ }),
7532
+ markClientLayoutChange()
7533
+ ]);
7534
+ },
7535
+ [resizeMetricCard, markClientLayoutChange]
7536
+ );
7537
+ return { handleLayoutChange, markClientLayoutChange, isLayoutChanged };
7538
+ };
7420
7539
  var index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7421
7540
  __proto__: null,
7422
7541
  useEmbeddedDashboard,
@@ -7424,7 +7543,8 @@ var index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
7424
7543
  useGenerateDatasetMetrics,
7425
7544
  useGenerateEmbeddedMetric,
7426
7545
  useOutsideAlerter,
7427
- useApplyAdminTheme
7546
+ useApplyAdminTheme,
7547
+ useClientDashboardLayout
7428
7548
  }, Symbol.toStringTag, { value: "Module" }));
7429
7549
  const materialSymbolsKeyboardArrowDown = (props) => /* @__PURE__ */ jsx("svg", {
7430
7550
  viewBox: "0 0 24 24",
@@ -86385,12 +86505,12 @@ const InfoTooltip = ({
86385
86505
  });
86386
86506
  };
86387
86507
  var styles$j = {
86388
- "header-container": "_header-container_1pbz4_1",
86389
- "btn-container": "_btn-container_1pbz4_9",
86390
- "back-btn": "_back-btn_1pbz4_17",
86391
- "sql-btn": "_sql-btn_1pbz4_25",
86392
- "save-btn": "_save-btn_1pbz4_33",
86393
- "save-btn-icon": "_save-btn-icon_1pbz4_41"
86508
+ "header-container": "_header-container_t2r6v_1",
86509
+ "btn-container": "_btn-container_t2r6v_5",
86510
+ "back-btn": "_back-btn_t2r6v_9",
86511
+ "sql-btn": "_sql-btn_t2r6v_13",
86512
+ "save-btn": "_save-btn_t2r6v_17",
86513
+ "save-btn-icon": "_save-btn-icon_t2r6v_21"
86394
86514
  };
86395
86515
  const Header = ({
86396
86516
  setShowMetricCreateModal,
@@ -86442,25 +86562,25 @@ const Header = ({
86442
86562
  })]
86443
86563
  });
86444
86564
  };
86445
- const floatingCreateButton = "_floatingCreateButton_jfq7q_25";
86446
- const floatingCreateButtonIcon = "_floatingCreateButtonIcon_jfq7q_33";
86565
+ const floatingCreateButton = "_floatingCreateButton_6ovk2_13";
86566
+ const floatingCreateButtonIcon = "_floatingCreateButtonIcon_6ovk2_17";
86447
86567
  var styles$i = {
86448
- "create-btn": "_create-btn_jfq7q_1",
86449
- "modal-container": "_modal-container_jfq7q_9",
86450
- "query-modal": "_query-modal_jfq7q_17",
86568
+ "create-btn": "_create-btn_6ovk2_1",
86569
+ "modal-container": "_modal-container_6ovk2_5",
86570
+ "query-modal": "_query-modal_6ovk2_9",
86451
86571
  floatingCreateButton,
86452
86572
  floatingCreateButtonIcon
86453
86573
  };
86454
- const container$7 = "_container_u2z1d_1";
86455
- const header$3 = "_header_u2z1d_9";
86456
- const wrapper$2 = "_wrapper_u2z1d_17";
86457
- const column = "_column_u2z1d_33";
86458
- const columnText$1 = "_columnText_u2z1d_41";
86574
+ const container$7 = "_container_1q2ss_1";
86575
+ const header$3 = "_header_1q2ss_5";
86576
+ const wrapper$2 = "_wrapper_1q2ss_9";
86577
+ const column = "_column_1q2ss_17";
86578
+ const columnText$1 = "_columnText_1q2ss_21";
86459
86579
  var styles$h = {
86460
86580
  container: container$7,
86461
86581
  header: header$3,
86462
86582
  wrapper: wrapper$2,
86463
- "col-container": "_col-container_u2z1d_25",
86583
+ "col-container": "_col-container_1q2ss_13",
86464
86584
  column,
86465
86585
  columnText: columnText$1
86466
86586
  };
@@ -87813,10 +87933,10 @@ const ChartTab = ({
87813
87933
  })]
87814
87934
  });
87815
87935
  };
87816
- const container$5 = "_container_wjdaz_1";
87817
- const wrapper$1 = "_wrapper_wjdaz_9";
87818
- const text = "_text_wjdaz_17";
87819
- const table$2 = "_table_wjdaz_23";
87936
+ const container$5 = "_container_yjeiv_1";
87937
+ const wrapper$1 = "_wrapper_yjeiv_5";
87938
+ const text = "_text_yjeiv_9";
87939
+ const table$2 = "_table_yjeiv_12";
87820
87940
  var styles$c = {
87821
87941
  container: container$5,
87822
87942
  wrapper: wrapper$1,
@@ -87849,16 +87969,16 @@ const InputTables = ({
87849
87969
  })
87850
87970
  });
87851
87971
  };
87852
- const container$4 = "_container_127xg_1";
87853
- const header$1 = "_header_127xg_9";
87854
- const tabButton$1 = "_tabButton_127xg_31";
87855
- const selectedTab = "_selectedTab_127xg_37";
87856
- const table$1 = "_table_127xg_43";
87972
+ const container$4 = "_container_38zl3_1";
87973
+ const header$1 = "_header_38zl3_5";
87974
+ const tabButton$1 = "_tabButton_38zl3_16";
87975
+ const selectedTab = "_selectedTab_38zl3_19";
87976
+ const table$1 = "_table_38zl3_22";
87857
87977
  var styles$b = {
87858
87978
  container: container$4,
87859
87979
  header: header$1,
87860
- "text-container": "_text-container_127xg_17",
87861
- "btn-container": "_btn-container_127xg_25",
87980
+ "text-container": "_text-container_38zl3_9",
87981
+ "btn-container": "_btn-container_38zl3_13",
87862
87982
  tabButton: tabButton$1,
87863
87983
  selectedTab,
87864
87984
  table: table$1
@@ -87929,13 +88049,13 @@ const TableTab = ({
87929
88049
  })]
87930
88050
  });
87931
88051
  };
87932
- const wrapper = "_wrapper_49kql_17";
87933
- const searchCommand = "_searchCommand_49kql_23";
87934
- const tabButton = "_tabButton_49kql_29";
87935
- const tabActive = "_tabActive_49kql_35";
88052
+ const wrapper = "_wrapper_wy97p_9";
88053
+ const searchCommand = "_searchCommand_wy97p_12";
88054
+ const tabButton = "_tabButton_wy97p_15";
88055
+ const tabActive = "_tabActive_wy97p_18";
87936
88056
  var styles$a = {
87937
- "main-container": "_main-container_49kql_1",
87938
- "outputTab-header": "_outputTab-header_49kql_9",
88057
+ "main-container": "_main-container_wy97p_1",
88058
+ "outputTab-header": "_outputTab-header_wy97p_5",
87939
88059
  wrapper,
87940
88060
  searchCommand,
87941
88061
  tabButton,
@@ -88066,30 +88186,30 @@ const MetricOutput = ({
88066
88186
  })]
88067
88187
  });
88068
88188
  };
88069
- const fieldValueIcon = "_fieldValueIcon_fl6kw_49";
88070
- const fieldAddBtnIcon = "_fieldAddBtnIcon_fl6kw_65";
88071
- const group = "_group_fl6kw_1";
88072
- const tooltipWrapper = "_tooltipWrapper_fl6kw_89";
88073
- const tooltip = "_tooltip_fl6kw_89";
88074
- const dropdown = "_dropdown_fl6kw_113";
88075
- const filterDropdown = "_filterDropdown_fl6kw_121";
88076
- const filterValues = "_filterValues_fl6kw_129";
88077
- const columnText = "_columnText_fl6kw_137";
88078
- const disabled = "_disabled_fl6kw_145";
88079
- const checkIcon = "_checkIcon_fl6kw_153";
88080
- const generateButton = "_generateButton_fl6kw_161";
88189
+ const fieldValueIcon = "_fieldValueIcon_z8ldj_25";
88190
+ const fieldAddBtnIcon = "_fieldAddBtnIcon_z8ldj_33";
88191
+ const group = "_group_z8ldj_1";
88192
+ const tooltipWrapper = "_tooltipWrapper_z8ldj_45";
88193
+ const tooltip = "_tooltip_z8ldj_45";
88194
+ const dropdown = "_dropdown_z8ldj_57";
88195
+ const filterDropdown = "_filterDropdown_z8ldj_61";
88196
+ const filterValues = "_filterValues_z8ldj_65";
88197
+ const columnText = "_columnText_z8ldj_69";
88198
+ const disabled = "_disabled_z8ldj_73";
88199
+ const checkIcon = "_checkIcon_z8ldj_77";
88200
+ const generateButton = "_generateButton_z8ldj_81";
88081
88201
  var styles$9 = {
88082
- "form-container": "_form-container_fl6kw_1",
88083
- "field-container": "_field-container_fl6kw_9",
88084
- "field-label": "_field-label_fl6kw_17",
88085
- "field-wrapper": "_field-wrapper_fl6kw_25",
88086
- "field-inner-container": "_field-inner-container_fl6kw_33",
88087
- "field-value": "_field-value_fl6kw_41",
88202
+ "form-container": "_form-container_z8ldj_1",
88203
+ "field-container": "_field-container_z8ldj_5",
88204
+ "field-label": "_field-label_z8ldj_9",
88205
+ "field-wrapper": "_field-wrapper_z8ldj_13",
88206
+ "field-inner-container": "_field-inner-container_z8ldj_17",
88207
+ "field-value": "_field-value_z8ldj_21",
88088
88208
  fieldValueIcon,
88089
- "field-add-btn": "_field-add-btn_fl6kw_57",
88209
+ "field-add-btn": "_field-add-btn_z8ldj_29",
88090
88210
  fieldAddBtnIcon,
88091
- "field-value-container": "_field-value-container_fl6kw_73",
88092
- "field-prompt": "_field-prompt_fl6kw_81",
88211
+ "field-value-container": "_field-value-container_z8ldj_37",
88212
+ "field-prompt": "_field-prompt_z8ldj_41",
88093
88213
  group,
88094
88214
  tooltipWrapper,
88095
88215
  tooltip,
@@ -89240,10 +89360,10 @@ const MetricForm = ({
89240
89360
  })]
89241
89361
  });
89242
89362
  };
89243
- const container$2 = "_container_1v000_1";
89244
- const header = "_header_1v000_9";
89245
- const enableGroupBy = "_enableGroupBy_1v000_15";
89246
- const enableGroupButton = "_enableGroupButton_1v000_21";
89363
+ const container$2 = "_container_rofqe_1";
89364
+ const header = "_header_rofqe_5";
89365
+ const enableGroupBy = "_enableGroupBy_rofqe_8";
89366
+ const enableGroupButton = "_enableGroupButton_rofqe_11";
89247
89367
  var styles$7 = {
89248
89368
  container: container$2,
89249
89369
  header,
@@ -94926,11 +95046,11 @@ function WidthProvideRGL(ComposedComponent) {
94926
95046
  })(reactGridLayout);
94927
95047
  var styles$6 = "";
94928
95048
  var styles$5 = {
94929
- "MetricList-container": "_MetricList-container_1b506_1",
94930
- "MetricList-wrapper": "_MetricList-wrapper_1b506_9",
94931
- "noMetric-container": "_noMetric-container_1b506_17",
94932
- "noMetric-wrapper": "_noMetric-wrapper_1b506_25",
94933
- "alt-container": "_alt-container_1b506_33"
95049
+ "MetricList-container": "_MetricList-container_1jw09_1",
95050
+ "MetricList-wrapper": "_MetricList-wrapper_1jw09_9",
95051
+ "noMetric-container": "_noMetric-container_1jw09_17",
95052
+ "noMetric-wrapper": "_noMetric-wrapper_1jw09_25",
95053
+ "alt-container": "_alt-container_1jw09_33"
94934
95054
  };
94935
95055
  const cardContainer = "_cardContainer_1wz4e_1";
94936
95056
  const listHeader = "_listHeader_1wz4e_9";
@@ -95053,8 +95173,8 @@ const ChartImageDownloadButton = ({
95053
95173
  }), text2]
95054
95174
  });
95055
95175
  };
95056
- const metricFilter = "_metricFilter_1xge8_1";
95057
- const customContainer = "_customContainer_1xge8_7";
95176
+ const metricFilter = "_metricFilter_k2gef_1";
95177
+ const customContainer = "_customContainer_k2gef_4";
95058
95178
  var styles$3 = {
95059
95179
  metricFilter,
95060
95180
  customContainer
@@ -95121,24 +95241,24 @@ const MetricFilterDropDown = ({
95121
95241
  }) : void 0
95122
95242
  });
95123
95243
  };
95124
- const container$1 = "_container_1hc1e_1";
95125
- const popover = "_popover_1hc1e_9";
95126
- const button = "_button_1hc1e_17";
95127
- const buttonOpen = "_buttonOpen_1hc1e_25";
95128
- const menu = "_menu_1hc1e_33";
95129
- const enter = "_enter_1hc1e_41";
95130
- const enterFrom = "_enterFrom_1hc1e_49";
95131
- const enterTo = "_enterTo_1hc1e_57";
95132
- const leave = "_leave_1hc1e_65";
95133
- const leaveFrom = "_leaveFrom_1hc1e_73";
95134
- const leaveTo = "_leaveTo_1hc1e_81";
95135
- const center = "_center_1hc1e_89";
95136
- const top = "_top_1hc1e_97";
95137
- const bottom = "_bottom_1hc1e_105";
95138
- const left = "_left_1hc1e_113";
95139
- const right = "_right_1hc1e_121";
95140
- const chartOptionBtn = "_chartOptionBtn_1hc1e_225";
95141
- const chartpopup = "_chartpopup_1hc1e_233";
95244
+ const container$1 = "_container_1h8m9_1";
95245
+ const popover = "_popover_1h8m9_5";
95246
+ const button = "_button_1h8m9_9";
95247
+ const buttonOpen = "_buttonOpen_1h8m9_13";
95248
+ const menu = "_menu_1h8m9_17";
95249
+ const enter = "_enter_1h8m9_21";
95250
+ const enterFrom = "_enterFrom_1h8m9_25";
95251
+ const enterTo = "_enterTo_1h8m9_29";
95252
+ const leave = "_leave_1h8m9_33";
95253
+ const leaveFrom = "_leaveFrom_1h8m9_37";
95254
+ const leaveTo = "_leaveTo_1h8m9_41";
95255
+ const center = "_center_1h8m9_45";
95256
+ const top = "_top_1h8m9_49";
95257
+ const bottom = "_bottom_1h8m9_53";
95258
+ const left = "_left_1h8m9_57";
95259
+ const right = "_right_1h8m9_61";
95260
+ const chartOptionBtn = "_chartOptionBtn_1h8m9_113";
95261
+ const chartpopup = "_chartpopup_1h8m9_117";
95142
95262
  var styles$2 = {
95143
95263
  container: container$1,
95144
95264
  popover,
@@ -95156,23 +95276,23 @@ var styles$2 = {
95156
95276
  bottom,
95157
95277
  left,
95158
95278
  right,
95159
- "left-top-end": "_left-top-end_1hc1e_129",
95160
- "right-top-end": "_right-top-end_1hc1e_137",
95161
- "left-bottom-end": "_left-bottom-end_1hc1e_145",
95162
- "right-bottom-end": "_right-bottom-end_1hc1e_153",
95163
- "top-left": "_top-left_1hc1e_161",
95164
- "top-right": "_top-right_1hc1e_169",
95165
- "bottom-left": "_bottom-left_1hc1e_177",
95166
- "bottom-right": "_bottom-right_1hc1e_185",
95167
- "left-top": "_left-top_1hc1e_129",
95168
- "left-bottom": "_left-bottom_1hc1e_145",
95169
- "right-top": "_right-top_1hc1e_137",
95170
- "right-bottom": "_right-bottom_1hc1e_153",
95279
+ "left-top-end": "_left-top-end_1h8m9_65",
95280
+ "right-top-end": "_right-top-end_1h8m9_69",
95281
+ "left-bottom-end": "_left-bottom-end_1h8m9_73",
95282
+ "right-bottom-end": "_right-bottom-end_1h8m9_77",
95283
+ "top-left": "_top-left_1h8m9_81",
95284
+ "top-right": "_top-right_1h8m9_85",
95285
+ "bottom-left": "_bottom-left_1h8m9_89",
95286
+ "bottom-right": "_bottom-right_1h8m9_93",
95287
+ "left-top": "_left-top_1h8m9_65",
95288
+ "left-bottom": "_left-bottom_1h8m9_73",
95289
+ "right-top": "_right-top_1h8m9_69",
95290
+ "right-bottom": "_right-bottom_1h8m9_77",
95171
95291
  chartOptionBtn,
95172
95292
  chartpopup
95173
95293
  };
95174
- const fullscreen = "_fullscreen_19jec_1";
95175
- const loading = "_loading_19jec_9";
95294
+ const fullscreen = "_fullscreen_1gpy3_1";
95295
+ const loading = "_loading_1gpy3_5";
95176
95296
  var styles$1 = {
95177
95297
  fullscreen,
95178
95298
  loading
@@ -95923,6 +96043,9 @@ const MetricCard = ({
95923
96043
  })]
95924
96044
  }), chartType2 && /* @__PURE__ */ jsxs("div", {
95925
96045
  className: styles$4.metricData,
96046
+ onContextMenu: (e2) => {
96047
+ e2.preventDefault();
96048
+ },
95926
96049
  children: [!isQueryLoading && !dataDb.length ? /* @__PURE__ */ jsx("div", {
95927
96050
  className: styles$4.noData,
95928
96051
  children: /* @__PURE__ */ jsxs("div", {
@@ -96342,7 +96465,8 @@ const DeleteMetricModal = ({
96342
96465
  onClose,
96343
96466
  onSuccess,
96344
96467
  metricId,
96345
- dashboardId
96468
+ dashboardId,
96469
+ clientId
96346
96470
  }) => {
96347
96471
  const queryClient2 = useQueryClient();
96348
96472
  const {
@@ -96350,14 +96474,17 @@ const DeleteMetricModal = ({
96350
96474
  isLoading
96351
96475
  } = useMarkDeleteMetricMutation();
96352
96476
  const handleDeleteMetric = async () => {
96353
- if (!metricId || !dashboardId)
96477
+ if (!metricId || !dashboardId || !clientId)
96354
96478
  return;
96355
96479
  await deleteMetric({
96356
- id: metricId
96480
+ id: metricId,
96481
+ clientId
96357
96482
  }, {
96358
- onSuccess: () => {
96483
+ onSuccess: (res) => {
96484
+ if (!res.update_externalMetrics_by_pk)
96485
+ return;
96359
96486
  queryClient2.setQueryData(["EmbeddedDashboardMetrics", {
96360
- dashboardId
96487
+ externalDashboardId: dashboardId
96361
96488
  }], (prev) => {
96362
96489
  var _a2;
96363
96490
  const externalDashboardMetrics = (_a2 = prev == null ? void 0 : prev.externalDashboardMetrics) == null ? void 0 : _a2.filter((exDm) => exDm.externalMetricId !== metricId);
@@ -96415,7 +96542,8 @@ const ExternalMetricList = ({
96415
96542
  layoutCols,
96416
96543
  params,
96417
96544
  companyTenancyType = "TABLE",
96418
- externalDashboardId
96545
+ externalDashboardId,
96546
+ externalDashboardPk
96419
96547
  }) => {
96420
96548
  const [isFullScreen, setFullScreen] = useState(false);
96421
96549
  const [deleteModal2, setDeleteModal] = useState({
@@ -96423,6 +96551,12 @@ const ExternalMetricList = ({
96423
96551
  show: false
96424
96552
  });
96425
96553
  const [fullScreenChart, setFullScreenChart] = useState();
96554
+ const {
96555
+ handleLayoutChange
96556
+ } = useClientDashboardLayout({
96557
+ clientId: client,
96558
+ externalDashboardId: externalDashboardPk
96559
+ });
96426
96560
  const metricListData = externalDashboardMetrics == null ? void 0 : externalDashboardMetrics.map((data) => data.externalMetric);
96427
96561
  const adminMetrics = metricListData == null ? void 0 : metricListData.filter((data) => !data.isCreatedByClient);
96428
96562
  const clientMetrics = metricListData == null ? void 0 : metricListData.filter((data) => data.isCreatedByClient && data.clientId === client);
@@ -96452,9 +96586,8 @@ const ExternalMetricList = ({
96452
96586
  maxH: 15
96453
96587
  }))
96454
96588
  },
96455
- isResizable: false,
96456
- isDraggable: false,
96457
- isDroppable: false,
96589
+ onResizeStop: handleLayoutChange,
96590
+ onDragStop: handleLayoutChange,
96458
96591
  rowHeight: 30,
96459
96592
  width: 1200,
96460
96593
  breakpoints: breakpoint != null ? breakpoint : {
@@ -96508,6 +96641,7 @@ const ExternalMetricList = ({
96508
96641
  }), isAllowedToDeleteMetrics ? /* @__PURE__ */ jsx(DeleteMetricModal, {
96509
96642
  metricId: deleteModal2.id,
96510
96643
  isOpen: deleteModal2.show,
96644
+ clientId: client,
96511
96645
  onSuccess: () => setDeleteModal({
96512
96646
  id: "",
96513
96647
  show: false
@@ -96752,6 +96886,7 @@ const EmbeddedDashboard = React__default.memo(({
96752
96886
  client: data.clientId,
96753
96887
  isLiveMode: data.mode,
96754
96888
  externalDashboardId: data.externalDashboardId,
96889
+ externalDashboardPk: data.externalDashboard.id,
96755
96890
  isAllowedToDeleteMetrics: data.isAllowedToDeleteMetrics,
96756
96891
  externalDashboardMetrics: data.externalDashboardMetrics,
96757
96892
  isMetricListLoading: isLoading,