@quillsql/admin 1.3.2 → 1.3.4

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 (150) hide show
  1. package/dist/Admin.d.ts +0 -1
  2. package/dist/Admin.d.ts.map +1 -1
  3. package/dist/Admin.js +248 -196
  4. package/dist/Admin.js.map +1 -0
  5. package/dist/AdminProvider.d.ts +0 -1
  6. package/dist/AdminProvider.js +26 -21
  7. package/dist/AdminProvider.js.map +1 -0
  8. package/dist/api/ConnectionClient.d.ts +3 -7
  9. package/dist/api/ConnectionClient.d.ts.map +1 -1
  10. package/dist/api/ConnectionClient.js +56 -44
  11. package/dist/api/ConnectionClient.js.map +1 -0
  12. package/dist/components/Banner/index.d.ts +0 -1
  13. package/dist/components/Banner/index.js +16 -9
  14. package/dist/components/Banner/index.js.map +1 -0
  15. package/dist/components/CardSection.d.ts +0 -1
  16. package/dist/components/CardSection.js +7 -3
  17. package/dist/components/CardSection.js.map +1 -0
  18. package/dist/components/CardTitle.d.ts +0 -1
  19. package/dist/components/CardTitle.js +7 -3
  20. package/dist/components/CardTitle.js.map +1 -0
  21. package/dist/components/DashboardSelectPopover.d.ts +0 -1
  22. package/dist/components/DashboardSelectPopover.js +21 -17
  23. package/dist/components/DashboardSelectPopover.js.map +1 -0
  24. package/dist/components/DatabaseSelector.d.ts +0 -1
  25. package/dist/components/DatabaseSelector.js +8 -4
  26. package/dist/components/DatabaseSelector.js.map +1 -0
  27. package/dist/components/DeleteButton.d.ts +0 -1
  28. package/dist/components/DeleteButton.js +8 -4
  29. package/dist/components/DeleteButton.js.map +1 -0
  30. package/dist/components/DropDownMenu.d.ts +0 -1
  31. package/dist/components/DropDownMenu.js +10 -6
  32. package/dist/components/DropDownMenu.js.map +1 -0
  33. package/dist/components/DropDownMenuWithLabel.d.ts +0 -1
  34. package/dist/components/DropDownMenuWithLabel.js +11 -7
  35. package/dist/components/DropDownMenuWithLabel.js.map +1 -0
  36. package/dist/components/EnvSelectPopover.d.ts +0 -1
  37. package/dist/components/EnvSelectPopover.js +24 -20
  38. package/dist/components/EnvSelectPopover.js.map +1 -0
  39. package/dist/components/InputLabel.d.ts +0 -1
  40. package/dist/components/InputLabel.js +7 -3
  41. package/dist/components/InputLabel.js.map +1 -0
  42. package/dist/components/OrgSelect.d.ts +0 -1
  43. package/dist/components/OrgSelect.js +26 -22
  44. package/dist/components/OrgSelect.js.map +1 -0
  45. package/dist/components/SqlViewTile.d.ts +0 -1
  46. package/dist/components/SqlViewTile.js +39 -9
  47. package/dist/components/SqlViewTile.js.map +1 -0
  48. package/dist/components/StepDisplay.d.ts +0 -1
  49. package/dist/components/StepDisplay.js +8 -4
  50. package/dist/components/StepDisplay.js.map +1 -0
  51. package/dist/components/index.d.ts +0 -1
  52. package/dist/components/index.js +17 -5
  53. package/dist/components/index.js.map +1 -0
  54. package/dist/forms/client_onboard/ConnectDatabase.d.ts +0 -1
  55. package/dist/forms/client_onboard/ConnectDatabase.js +41 -34
  56. package/dist/forms/client_onboard/ConnectDatabase.js.map +1 -0
  57. package/dist/forms/client_onboard/ConnectSchema.d.ts +0 -1
  58. package/dist/forms/client_onboard/ConnectSchema.js +35 -28
  59. package/dist/forms/client_onboard/ConnectSchema.js.map +1 -0
  60. package/dist/forms/client_onboard/CreateSqlViews.d.ts +0 -1
  61. package/dist/forms/client_onboard/CreateSqlViews.d.ts.map +1 -1
  62. package/dist/forms/client_onboard/CreateSqlViews.js +59 -52
  63. package/dist/forms/client_onboard/CreateSqlViews.js.map +1 -0
  64. package/dist/hooks/useItemBeingEdited.d.ts +0 -1
  65. package/dist/hooks/useItemBeingEdited.js +14 -8
  66. package/dist/hooks/useItemBeingEdited.js.map +1 -0
  67. package/dist/icons/ArrowDownHeadIcon.d.ts +0 -1
  68. package/dist/icons/ArrowDownHeadIcon.js +6 -3
  69. package/dist/icons/ArrowDownHeadIcon.js.map +1 -0
  70. package/dist/icons/XMarkIcon.d.ts +0 -1
  71. package/dist/icons/XMarkIcon.js +8 -4
  72. package/dist/icons/XMarkIcon.js.map +1 -0
  73. package/dist/icons/index.d.ts +0 -1
  74. package/dist/icons/index.js +9 -1
  75. package/dist/icons/index.js.map +1 -0
  76. package/dist/index.d.ts +0 -1
  77. package/dist/index.js +19 -6
  78. package/dist/index.js.map +1 -0
  79. package/dist/modals/EditDashboardsModal.d.ts +0 -1
  80. package/dist/modals/EditDashboardsModal.js +21 -17
  81. package/dist/modals/EditDashboardsModal.js.map +1 -0
  82. package/dist/modals/NewDashboardModal.d.ts +0 -1
  83. package/dist/modals/NewDashboardModal.js +64 -56
  84. package/dist/modals/NewDashboardModal.js.map +1 -0
  85. package/dist/modals/PromoteDashModal.d.ts +0 -1
  86. package/dist/modals/PromoteDashModal.js +19 -15
  87. package/dist/modals/PromoteDashModal.js.map +1 -0
  88. package/dist/modals/PromoteViewModal.d.ts +0 -1
  89. package/dist/modals/PromoteViewModal.js +17 -13
  90. package/dist/modals/PromoteViewModal.js.map +1 -0
  91. package/dist/modals/ReorderDashboardModal.d.ts +0 -1
  92. package/dist/modals/ReorderDashboardModal.js +29 -25
  93. package/dist/modals/ReorderDashboardModal.js.map +1 -0
  94. package/dist/modals/index.d.ts +0 -1
  95. package/dist/modals/index.js +15 -4
  96. package/dist/modals/index.js.map +1 -0
  97. package/dist/primitives/ButtonPrimitive.d.ts +0 -1
  98. package/dist/primitives/ButtonPrimitive.js +11 -8
  99. package/dist/primitives/ButtonPrimitive.js.map +1 -0
  100. package/dist/primitives/HeaderPrimitive.d.ts +0 -1
  101. package/dist/primitives/HeaderPrimitive.js +7 -4
  102. package/dist/primitives/HeaderPrimitive.js.map +1 -0
  103. package/dist/primitives/ModalPrimitive.d.ts +0 -1
  104. package/dist/primitives/ModalPrimitive.js +11 -8
  105. package/dist/primitives/ModalPrimitive.js.map +1 -0
  106. package/dist/primitives/SecondaryButtonPrimitive.d.ts +0 -1
  107. package/dist/primitives/SecondaryButtonPrimitive.js +8 -5
  108. package/dist/primitives/SecondaryButtonPrimitive.js.map +1 -0
  109. package/dist/primitives/SelectPrimitive.d.ts +0 -1
  110. package/dist/primitives/SelectPrimitive.js +11 -8
  111. package/dist/primitives/SelectPrimitive.js.map +1 -0
  112. package/dist/primitives/TextInputPrimitive.d.ts +0 -1
  113. package/dist/primitives/TextInputPrimitive.js +8 -5
  114. package/dist/primitives/TextInputPrimitive.js.map +1 -0
  115. package/dist/primitives/TogglePrimitive.d.ts +0 -1
  116. package/dist/primitives/TogglePrimitive.js +7 -4
  117. package/dist/primitives/TogglePrimitive.js.map +1 -0
  118. package/dist/primitives/index.d.ts +0 -1
  119. package/dist/primitives/index.js +19 -6
  120. package/dist/primitives/index.js.map +1 -0
  121. package/dist/public_components/CreateEnvironment.d.ts +0 -1
  122. package/dist/public_components/CreateEnvironment.d.ts.map +1 -1
  123. package/dist/public_components/CreateEnvironment.js +38 -25
  124. package/dist/public_components/CreateEnvironment.js.map +1 -0
  125. package/dist/public_components/DashboardBuilder.d.ts +0 -1
  126. package/dist/public_components/DashboardBuilder.js +51 -44
  127. package/dist/public_components/DashboardBuilder.js.map +1 -0
  128. package/dist/public_components/DashboardManager.d.ts +0 -1
  129. package/dist/public_components/DashboardManager.js +55 -51
  130. package/dist/public_components/DashboardManager.js.map +1 -0
  131. package/dist/public_components/SQLViewManager.d.ts +0 -1
  132. package/dist/public_components/SQLViewManager.js +59 -52
  133. package/dist/public_components/SQLViewManager.js.map +1 -0
  134. package/dist/utils/constants.d.ts +0 -1
  135. package/dist/utils/constants.js +7 -3
  136. package/dist/utils/constants.js.map +1 -0
  137. package/dist/utils/databases.d.ts +0 -1
  138. package/dist/utils/databases.js +9 -3
  139. package/dist/utils/databases.js.map +1 -0
  140. package/dist/utils/delay.d.ts +0 -1
  141. package/dist/utils/delay.js +6 -1
  142. package/dist/utils/delay.js.map +1 -0
  143. package/dist/utils/schema.d.ts +0 -1
  144. package/dist/utils/schema.js +3 -1
  145. package/dist/utils/schema.js.map +1 -0
  146. package/dist/utils/table.d.ts +7 -1
  147. package/dist/utils/table.d.ts.map +1 -1
  148. package/dist/utils/table.js +3 -1
  149. package/dist/utils/table.js.map +1 -0
  150. package/package.json +6 -1
package/dist/Admin.js CHANGED
@@ -1,21 +1,50 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ReorderableList = exports.ReportWrapper = exports.formatDateBuckets = exports.isArrayOfValidDates = exports.isValidDate = exports.setEditorTheme = exports.defineEditorTheme = exports.SQLEditorComponent = exports.TableCell = exports.AddDashboardModal = exports.classNames = exports.getPostgresBasicType = exports.convertPostgresColumn = exports.theme = exports.AddFilterModal = exports.EditFiltersModal = void 0;
30
+ const jsx_runtime_1 = require("react/jsx-runtime");
2
31
  // @ts-nocheck
3
- import { useState, useEffect } from 'react';
4
- import { QuillProvider, useQuill, Chart, Table, SQLEditor, AddToDashboardModal, ChartEditor, useDashboard, } from '@quillsql/react';
5
- import prismTheme from 'prism-react-renderer/themes/nightOwlLight';
6
- import Highlight, { defaultProps } from 'prism-react-renderer';
7
- import { DndContext, closestCenter, KeyboardSensor, PointerSensor, useSensor, useSensors, MeasuringStrategy, TouchSensor, } from '@dnd-kit/core';
8
- import InputLabel from './components/InputLabel';
9
- import CardSection from './components/CardSection';
10
- import { arrayMove, SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy, useSortable, defaultAnimateLayoutChanges, } from '@dnd-kit/sortable';
11
- import { CSS } from '@dnd-kit/utilities';
12
- import { OrgSelect, DashboardManager } from './components';
13
- import { AdminProvider, useAdmin } from './AdminProvider';
14
- import { ButtonPrimitive, HeaderPrimitive, ModalPrimitive, SecondaryButtonPrimitive, SelectPrimitive, TextInputPrimitive, } from './primitives';
15
- import DashboardBuilder from './public_components/DashboardBuilder';
16
- import SQLViewManager from './public_components/SQLViewManager';
17
- import { InitialDateRangeOptions, QUILL_SERVER, defaultDateRange, } from './utils/constants';
18
- import TogglePrimitive from './primitives/TogglePrimitive';
32
+ const react_1 = require("react");
33
+ const react_2 = require("@quillsql/react");
34
+ const nightOwlLight_1 = __importDefault(require("prism-react-renderer/themes/nightOwlLight"));
35
+ const prism_react_renderer_1 = __importStar(require("prism-react-renderer"));
36
+ const core_1 = require("@dnd-kit/core");
37
+ const InputLabel_1 = __importDefault(require("./components/InputLabel"));
38
+ const CardSection_1 = __importDefault(require("./components/CardSection"));
39
+ const sortable_1 = require("@dnd-kit/sortable");
40
+ const utilities_1 = require("@dnd-kit/utilities");
41
+ const components_1 = require("./components");
42
+ const AdminProvider_1 = require("./AdminProvider");
43
+ const primitives_1 = require("./primitives");
44
+ const DashboardBuilder_1 = __importDefault(require("./public_components/DashboardBuilder"));
45
+ const SQLViewManager_1 = __importDefault(require("./public_components/SQLViewManager"));
46
+ const constants_1 = require("./utils/constants");
47
+ const TogglePrimitive_1 = __importDefault(require("./primitives/TogglePrimitive"));
19
48
  const defaultTheme = {
20
49
  fontFamily: 'Inter; Helvetica',
21
50
  backgroundColor: '#FFFFFF',
@@ -31,21 +60,21 @@ const defaultTheme = {
31
60
  labelFontWeight: '500',
32
61
  fontSize: 14,
33
62
  };
34
- export function EditFiltersModal({ isOpen, dashboardData, selectedDashboard, client, setIsOpen, onSave, ModalComponent, TextInputComponent, ButtonComponent, HeaderComponent, SelectComponent, dashNames, setSelectedEditDashboard, SecondaryButtonComponent, openAddFilterModal, openEditOrderModal, }) {
35
- const { state, dispatch } = useAdmin();
36
- const [selectedDashboardName, setSelectedDashboardName] = useState(selectedDashboard);
37
- useEffect(() => {
63
+ function EditFiltersModal({ isOpen, dashboardData, selectedDashboard, client, setIsOpen, onSave, ModalComponent, TextInputComponent, ButtonComponent, HeaderComponent, SelectComponent, dashNames, setSelectedEditDashboard, SecondaryButtonComponent, openAddFilterModal, openEditOrderModal, }) {
64
+ const { state, dispatch } = (0, AdminProvider_1.useAdmin)();
65
+ const [selectedDashboardName, setSelectedDashboardName] = (0, react_1.useState)(selectedDashboard);
66
+ (0, react_1.useEffect)(() => {
38
67
  setSelectedDashboardName(selectedDashboard);
39
68
  }, [selectedDashboard]);
40
- const { data } = useDashboard(selectedDashboard);
41
- const [newFilters, setNewFilters] = useState([]);
42
- const [isDateComparison, setIsDateComparison] = useState(state.dateFilter.comparison);
43
- const [initialRange, setInitialRange] = useState(defaultDateRange);
44
- const [showDateFilter, setShowDateFilter] = useState(true);
45
- const [newDateFilter, setNewDateFilter] = useState(null);
46
- const [selectedTable, setSelectedTable] = useState(null);
47
- const [field, setField] = useState('');
48
- useEffect(() => {
69
+ const { data } = (0, react_2.useDashboard)(selectedDashboard);
70
+ const [newFilters, setNewFilters] = (0, react_1.useState)([]);
71
+ const [isDateComparison, setIsDateComparison] = (0, react_1.useState)(state.dateFilter.comparison);
72
+ const [initialRange, setInitialRange] = (0, react_1.useState)(constants_1.defaultDateRange);
73
+ const [showDateFilter, setShowDateFilter] = (0, react_1.useState)(true);
74
+ const [newDateFilter, setNewDateFilter] = (0, react_1.useState)(null);
75
+ const [selectedTable, setSelectedTable] = (0, react_1.useState)(null);
76
+ const [field, setField] = (0, react_1.useState)('');
77
+ (0, react_1.useEffect)(() => {
49
78
  if (data && data.dateFilter) {
50
79
  dispatch('SET_DATE_FILTER', {
51
80
  ...state.dateFilter,
@@ -53,16 +82,19 @@ export function EditFiltersModal({ isOpen, dashboardData, selectedDashboard, cli
53
82
  });
54
83
  }
55
84
  }, [state.dateFilter, data]);
56
- useEffect(() => {
85
+ (0, react_1.useEffect)(() => {
57
86
  setIsDateComparison(!!state.dateFilter.comparison);
58
87
  }, [state.dateFilter]);
59
- useEffect(() => {
88
+ (0, react_1.useEffect)(() => {
60
89
  if (state.tables.length) {
61
- setSelectedTable(state.tables[0]);
62
- setField(state.tables[0].columns.map((elem) => elem.name)[0]);
90
+ const defaultTable = state.tables[0];
91
+ const name = state.editDashboardData?.filters[0]?.table;
92
+ const table = state.tables.find((t) => t.name === name) ?? defaultTable;
93
+ setSelectedTable(table);
94
+ setField(table.columns.map((elem) => elem.name)[0]);
63
95
  }
64
- }, [state.tables]);
65
- useEffect(() => {
96
+ }, [state.tables, state.editDashboardData]);
97
+ (0, react_1.useEffect)(() => {
66
98
  if (dashboardData && dashboardData.filters) {
67
99
  setNewFilters(dashboardData.filters);
68
100
  }
@@ -130,7 +162,7 @@ export function EditFiltersModal({ isOpen, dashboardData, selectedDashboard, cli
130
162
  alert('We only support string and filters.');
131
163
  return;
132
164
  }
133
- const url = `${QUILL_SERVER}/dashfilter/${client._id}/`;
165
+ const url = `${constants_1.QUILL_SERVER}/dashfilter/${client._id}/`;
134
166
  const body = {
135
167
  newDashboardName: selectedDashboardName,
136
168
  filters: updatedFilters,
@@ -175,7 +207,7 @@ export function EditFiltersModal({ isOpen, dashboardData, selectedDashboard, cli
175
207
  };
176
208
  const handleDeleteDashboard = async () => {
177
209
  if (confirm('Are you sure? This action cannot be undone.')) {
178
- const URL = `${QUILL_SERVER}/dashboard/${selectedDashboard}`;
210
+ const URL = `${constants_1.QUILL_SERVER}/dashboard/${selectedDashboard}`;
179
211
  const res = await fetch(URL, {
180
212
  method: 'DELETE',
181
213
  headers: { 'Content-Type': 'application/json' },
@@ -184,51 +216,54 @@ export function EditFiltersModal({ isOpen, dashboardData, selectedDashboard, cli
184
216
  alert(JSON.stringify(res));
185
217
  }
186
218
  };
187
- return (_jsx(ModalComponent, { isOpen: isOpen, close: () => {
219
+ return ((0, jsx_runtime_1.jsx)(ModalComponent, { isOpen: isOpen, close: () => {
188
220
  setIsOpen(false);
189
221
  setNewFilters([]);
190
222
  setIsDateComparison(state.dateFilter.comparison);
191
223
  }, style: {
192
224
  minWidth: '814px',
193
225
  maxWidth: '814px',
194
- }, children: _jsxs("div", { style: {
226
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
195
227
  display: 'flex',
196
228
  gap: 16,
197
229
  flexDirection: 'column',
198
230
  width: '100%',
199
- }, children: [_jsx(HeaderComponent, { label: "Manage dashboard" }), _jsxs("div", { children: [_jsx(InputLabel, { children: "Name" }), _jsx("div", { style: { maxWidth: 230 }, children: _jsx(TextInputComponent, { value: selectedDashboardName, onChange: (e) => setSelectedDashboardName(e.target.value) }) })] }), _jsxs("div", { children: [_jsxs("div", { style: {
231
+ height: '100%',
232
+ maxHeight: '100%',
233
+ overflowY: 'auto'
234
+ }, children: [(0, jsx_runtime_1.jsx)(HeaderComponent, { label: "Manage dashboard" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(InputLabel_1.default, { children: "Name" }), (0, jsx_runtime_1.jsx)("div", { style: { maxWidth: 230 }, children: (0, jsx_runtime_1.jsx)(TextInputComponent, { value: selectedDashboardName, onChange: (e) => setSelectedDashboardName(e.target.value) }) })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { style: {
200
235
  display: 'flex',
201
236
  flexDirection: 'column',
202
237
  gap: '10px',
203
- }, children: [_jsx(CardSection, { children: "Date Filter" }), showDateFilter && (_jsx(_Fragment, { children: _jsxs("div", { style: {
238
+ }, children: [(0, jsx_runtime_1.jsx)(CardSection_1.default, { children: "Date Filter" }), showDateFilter && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { style: {
204
239
  display: 'flex',
205
240
  flexDirection: 'row',
206
241
  gap: '10px',
207
- }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx(InputLabel, { children: "Label" }), _jsx("div", { style: {
242
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(InputLabel_1.default, { children: "Label" }), (0, jsx_runtime_1.jsx)("div", { style: {
208
243
  display: 'flex',
209
244
  flexDirection: 'row',
210
245
  alignItems: 'center',
211
- }, children: _jsx(TextInputComponent, { value: newDateFilter?.label, onChange: (e) => {
246
+ }, children: (0, jsx_runtime_1.jsx)(TextInputComponent, { value: newDateFilter?.label, onChange: (e) => {
212
247
  setNewDateFilter({
213
248
  ...newDateFilter,
214
249
  label: e.target.value,
215
250
  });
216
- } }) })] }), _jsx("div", { style: {
251
+ } }) })] }), (0, jsx_runtime_1.jsx)("div", { style: {
217
252
  display: 'flex',
218
253
  flexDirection: 'row',
219
254
  gap: '10px',
220
- }, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx(InputLabel, { children: "Initial Range" }), _jsx(SelectComponent, { value: initialRange.label, onChange: (e) => {
221
- setInitialRange(InitialDateRangeOptions.find((table) => table.label === e) ?? initialRange);
222
- }, options: InitialDateRangeOptions.map((table) => {
255
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(InputLabel_1.default, { children: "Initial Range" }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: initialRange.label, onChange: (e) => {
256
+ setInitialRange(constants_1.InitialDateRangeOptions.find((table) => table.label === e) ?? initialRange);
257
+ }, options: constants_1.InitialDateRangeOptions.map((table) => {
223
258
  return { label: table.label, value: table.label };
224
- }) })] }) }), _jsx("div", { style: {
259
+ }) })] }) }), (0, jsx_runtime_1.jsx)("div", { style: {
225
260
  display: 'flex',
226
261
  flexDirection: 'row',
227
262
  gap: '10px',
228
- }, children: _jsxs("div", { style: {
263
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
229
264
  display: 'flex',
230
265
  flexDirection: 'column',
231
- }, children: [_jsx(InputLabel, { children: "Date Comparison" }), _jsx("div", { style: {
266
+ }, children: [(0, jsx_runtime_1.jsx)(InputLabel_1.default, { children: "Date Comparison" }), (0, jsx_runtime_1.jsx)("div", { style: {
232
267
  display: 'flex',
233
268
  flexDirection: 'column',
234
269
  justifyContent: 'center',
@@ -237,65 +272,65 @@ export function EditFiltersModal({ isOpen, dashboardData, selectedDashboard, cli
237
272
  minWidth: 230,
238
273
  maxWidth: 230,
239
274
  width: 230,
240
- }, children: _jsx(TogglePrimitive, { value: isDateComparison, onClick: () => {
275
+ }, children: (0, jsx_runtime_1.jsx)(TogglePrimitive_1.default, { value: isDateComparison, onClick: () => {
241
276
  setIsDateComparison((isDateComparison) => !isDateComparison);
242
- } }) })] }) }), _jsx("div", { style: {
277
+ } }) })] }) }), (0, jsx_runtime_1.jsx)("div", { style: {
243
278
  display: 'flex',
244
279
  flexGrow: 1,
245
280
  flexDirection: 'row',
246
281
  alignItems: 'end',
247
282
  justifyContent: 'end',
248
283
  gap: '10px',
249
- }, children: _jsx("div", { style: {
284
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
250
285
  display: 'flex',
251
286
  flexDirection: 'column',
252
287
  justifyContent: 'center',
253
- }, children: _jsx("div", { onClick: () => handleDeleteDateFilter(), style: {
288
+ }, children: (0, jsx_runtime_1.jsx)("div", { onClick: () => handleDeleteDateFilter(), style: {
254
289
  height: 38,
255
290
  width: 42,
256
291
  alignItems: 'center',
257
292
  justifyContent: 'center',
258
293
  display: 'flex',
259
294
  cursor: 'pointer',
260
- }, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#4C5462", width: "20", height: "20", children: _jsx("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }) }) }) })] }) })), !showDateFilter && (_jsx("div", { style: { maxWidth: 230 }, children: _jsx(SecondaryButtonComponent, { onClick: handleAddDateFilter, label: "Add date filter +" }) }))] }), _jsx("div", { style: {
295
+ }, children: (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#4C5462", width: "20", height: "20", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }) }) }) })] }) })), !showDateFilter && ((0, jsx_runtime_1.jsx)("div", { style: { maxWidth: 230 }, children: (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: handleAddDateFilter, label: "Add date filter +" }) }))] }), (0, jsx_runtime_1.jsx)("div", { style: {
261
296
  display: 'flex',
262
297
  flexDirection: 'row',
263
298
  alignItems: 'center',
264
299
  justifyContent: 'space-between',
265
300
  marginTop: 20,
266
- }, children: _jsx(CardSection, { children: "Filters" }) }), newFilters.length > 0 && (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '6px' }, children: newFilters.map((filter, index) => {
267
- return (_jsxs("div", { style: {
301
+ }, children: (0, jsx_runtime_1.jsx)(CardSection_1.default, { children: "Filters" }) }), newFilters.length > 0 && ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column', gap: '6px' }, children: newFilters.map((filter, index) => {
302
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
268
303
  display: 'flex',
269
304
  flexDirection: 'row',
270
305
  gap: '10px',
271
- }, children: [_jsxs("div", { style: {
306
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
272
307
  display: 'flex',
273
308
  flexDirection: 'column',
274
309
  maxWidth: 300,
275
- }, children: [index === 0 && _jsx(InputLabel, { children: "Label" }), _jsx(TextInputComponent, { value: filter.label, onChange: (e) => {
310
+ }, children: [index === 0 && (0, jsx_runtime_1.jsx)(InputLabel_1.default, { children: "Label" }), (0, jsx_runtime_1.jsx)(TextInputComponent, { value: filter.label, onChange: (e) => {
276
311
  const updatedFilters = newFilters.map((otherFilter, i) => index === i
277
312
  ? { ...otherFilter, label: e.target.value }
278
313
  : otherFilter);
279
314
  setNewFilters(updatedFilters);
280
- } })] }), _jsxs("div", { style: {
315
+ } })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
281
316
  display: 'flex',
282
317
  flexDirection: 'column',
283
318
  maxWidth: 300,
284
- }, children: [index === 0 && _jsx(InputLabel, { children: "Table" }), _jsx(SelectComponent, { defaultValue: "", value: selectedTable ? selectedTable.name : '', onChange: (e) => setSelectedTable(state.tables.find((table) => table.name === e)), options: state.tables.map((table) => {
319
+ }, children: [index === 0 && (0, jsx_runtime_1.jsx)(InputLabel_1.default, { children: "Table" }), (0, jsx_runtime_1.jsx)(SelectComponent, { defaultValue: "", value: selectedTable ? selectedTable.name : '', onChange: (e) => setSelectedTable(state.tables.find((table) => table.name === e)), options: state.tables.map((table) => {
285
320
  return { label: table.name, value: table.name };
286
- }) })] }), _jsxs("div", { style: {
321
+ }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
287
322
  display: 'flex',
288
323
  flexDirection: 'column',
289
324
  maxWidth: 300,
290
- }, children: [index === 0 && _jsx(InputLabel, { children: "Field" }), _jsx("div", { style: {
325
+ }, children: [index === 0 && (0, jsx_runtime_1.jsx)(InputLabel_1.default, { children: "Field" }), (0, jsx_runtime_1.jsx)("div", { style: {
291
326
  display: 'flex',
292
327
  flexDirection: 'column',
293
328
  alignItems: 'center',
294
- }, children: _jsxs("div", { style: {
329
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
295
330
  display: 'flex',
296
331
  flexDirection: 'row',
297
332
  alignItems: 'center',
298
- }, children: [_jsx(SelectComponent, { defaultValue: "", value: filter && filter.field ? filter.field : '', options: selectedTable?.columns.map((column) => {
333
+ }, children: [(0, jsx_runtime_1.jsx)(SelectComponent, { defaultValue: "", value: filter && filter.field ? filter.field : '', options: selectedTable?.columns.map((column) => {
299
334
  return {
300
335
  label: column.name,
301
336
  value: column.name,
@@ -305,24 +340,25 @@ export function EditFiltersModal({ isOpen, dashboardData, selectedDashboard, cli
305
340
  ? { ...otherFilter, field: e }
306
341
  : otherFilter);
307
342
  setNewFilters(updatedFilters);
308
- } }), _jsx("div", { onClick: () => handleDeleteFilter(filter), style: {
343
+ } }), (0, jsx_runtime_1.jsx)("div", { onClick: () => handleDeleteFilter(filter), style: {
309
344
  height: 38,
310
345
  width: 42,
311
346
  alignItems: 'center',
312
347
  justifyContent: 'center',
313
348
  display: 'flex',
314
349
  cursor: 'pointer',
315
- }, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#4C5462", width: "20", height: "20", children: _jsx("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }) })] }) })] })] }));
316
- }) })), _jsx("div", { style: { height: 12 } }), _jsx(SecondaryButtonComponent, { onClick: handleAddFilter, label: "Add filter +" })] }), _jsx(CardSection, { children: "Chart order" }), _jsx("div", { style: { maxWidth: 230 }, children: _jsx(SecondaryButtonComponent, { onClick: () => openEditOrderModal(selectedDashboardName), label: "Edit chart order" }) }), _jsx(CardSection, { children: "Danger Zone" }), _jsx("div", { style: { maxWidth: 230 }, children: _jsx(SecondaryButtonComponent, { onClick: handleDeleteDashboard, label: "Delete Dashboard" }) }), _jsx("div", { style: { height: 18 } }), _jsx("div", { style: { maxWidth: 230 }, children: _jsx(ButtonComponent, { onClick: handleSubmitDashboardChanges, label: "Save changes" }) })] }) }));
350
+ }, children: (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#4C5462", width: "20", height: "20", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }) })] }) })] })] }));
351
+ }) })), (0, jsx_runtime_1.jsx)("div", { style: { height: 12 } }), (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: handleAddFilter, label: "Add filter +" })] }), (0, jsx_runtime_1.jsx)(CardSection_1.default, { children: "Chart order" }), (0, jsx_runtime_1.jsx)("div", { style: { maxWidth: 230 }, children: (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => openEditOrderModal(selectedDashboardName), label: "Edit chart order" }) }), (0, jsx_runtime_1.jsx)(CardSection_1.default, { children: "Danger Zone" }), (0, jsx_runtime_1.jsx)("div", { style: { maxWidth: 230 }, children: (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: handleDeleteDashboard, label: "Delete Dashboard" }) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 18 } }), (0, jsx_runtime_1.jsx)("div", { style: { maxWidth: 230 }, children: (0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: handleSubmitDashboardChanges, label: "Save changes" }) })] }) }));
317
352
  }
318
- export function AddFilterModal({ isOpen, selectedDashboard, client, setIsOpen, ModalComponent, TextInputComponent, SelectComponent, HeaderComponent, ButtonComponent, openAddDashboardModal, }) {
319
- const [selectedTable, setSelectedTable] = useState(null);
320
- const [name, setName] = useState('');
321
- const [field, setField] = useState('');
322
- const [filterType, setFilterType] = useState('string');
323
- const [dateRange, setDateRange] = useState([new Date(), new Date()]);
324
- const { state, dispatch } = useAdmin();
325
- useEffect(() => {
353
+ exports.EditFiltersModal = EditFiltersModal;
354
+ function AddFilterModal({ isOpen, selectedDashboard, client, setIsOpen, ModalComponent, TextInputComponent, SelectComponent, HeaderComponent, ButtonComponent, openAddDashboardModal, }) {
355
+ const [selectedTable, setSelectedTable] = (0, react_1.useState)(null);
356
+ const [name, setName] = (0, react_1.useState)('');
357
+ const [field, setField] = (0, react_1.useState)('');
358
+ const [filterType, setFilterType] = (0, react_1.useState)('string');
359
+ const [dateRange, setDateRange] = (0, react_1.useState)([new Date(), new Date()]);
360
+ const { state, dispatch } = (0, AdminProvider_1.useAdmin)();
361
+ (0, react_1.useEffect)(() => {
326
362
  if (state.tables.length) {
327
363
  setSelectedTable(state.tables[0]);
328
364
  // setField(tables[0].columns.map((elem) => elem.name));
@@ -339,7 +375,7 @@ export function AddFilterModal({ isOpen, selectedDashboard, client, setIsOpen, M
339
375
  return;
340
376
  }
341
377
  let responseData;
342
- const url = `${QUILL_SERVER}/dashfilter/${client._id}/`;
378
+ const url = `${constants_1.QUILL_SERVER}/dashfilter/${client._id}/`;
343
379
  const body = {
344
380
  name: selectedDashboard,
345
381
  filter: {
@@ -378,19 +414,21 @@ export function AddFilterModal({ isOpen, selectedDashboard, client, setIsOpen, M
378
414
  if (!selectedTable) {
379
415
  return null;
380
416
  }
381
- return (_jsx(ModalComponent, { isOpen: isOpen, close: () => setIsOpen(false), children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx(HeaderComponent, { label: "Add filter" }), _jsx("div", { children: "Label" }), _jsx(TextInputComponent, { value: name, onChange: (e) => setName(e.target.value) }), _jsx("div", { children: "Table" }), _jsx(SelectComponent, { defaultValue: "", value: selectedTable ? selectedTable : '', onChange: (e) => setSelectedTable(e.target.value), QuillOptions: state.tables.map((table) => {
417
+ return ((0, jsx_runtime_1.jsx)(ModalComponent, { isOpen: isOpen, close: () => setIsOpen(false), children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(HeaderComponent, { label: "Add filter" }), (0, jsx_runtime_1.jsx)("div", { children: "Label" }), (0, jsx_runtime_1.jsx)(TextInputComponent, { value: name, onChange: (e) => setName(e.target.value) }), (0, jsx_runtime_1.jsx)("div", { children: "Table" }), (0, jsx_runtime_1.jsx)(SelectComponent, { defaultValue: "", value: selectedTable ? selectedTable : '', onChange: (e) => setSelectedTable(e.target.value), QuillOptions: state.tables.map((table) => {
382
418
  return { label: table.name, value: table.name };
383
- }) }), _jsx("div", { children: "Field" }), _jsx(SelectComponent, { defaultValue: "", value: field ? field : '', QuillOptions: selectedTable.columns.map((column) => {
419
+ }) }), (0, jsx_runtime_1.jsx)("div", { children: "Field" }), (0, jsx_runtime_1.jsx)(SelectComponent, { defaultValue: "", value: field ? field : '', QuillOptions: selectedTable.columns.map((column) => {
384
420
  return { label: column.name, value: column.name };
385
421
  }), onChange: (e) => {
386
422
  setField(e);
387
- } }), _jsx(ButtonComponent, { label: "Add filter", onClick: handleAddFilter })] }) }));
423
+ } }), (0, jsx_runtime_1.jsx)(ButtonComponent, { label: "Add filter", onClick: handleAddFilter })] }) }));
388
424
  }
389
- export default function Portal({ publicKey, queryEndpoint, theme = defaultTheme, queryHeaders, withCredentials, environment, organizationId, TextInputComponent, ButtonComponent, SecondaryButtonComponent, ModalComponent, SelectComponent, OrganizationSelectComponent, UserManagementComponent, HeaderComponent, }) {
390
- return (_jsx(AdminProvider, { publicKey: publicKey, children: _jsx(Navigation, { theme: theme, publicKey: publicKey, queryEndpoint: queryEndpoint, queryHeaders: queryHeaders, withCredentials: withCredentials, TextInputComponent: TextInputComponent || TextInputPrimitive, ButtonComponent: ButtonComponent || ButtonPrimitive, HeaderComponent: HeaderComponent || HeaderPrimitive, SecondaryButtonComponent: SecondaryButtonComponent || SecondaryButtonPrimitive, ModalComponent: ModalComponent || ModalPrimitive, environment: environment, OrganizationSelectComponent: OrganizationSelectComponent, UserManagementComponent: UserManagementComponent, SelectComponent: SelectComponent || SelectPrimitive }) }));
425
+ exports.AddFilterModal = AddFilterModal;
426
+ function Portal({ publicKey, queryEndpoint, theme = defaultTheme, queryHeaders, withCredentials, environment, organizationId, TextInputComponent, ButtonComponent, SecondaryButtonComponent, ModalComponent, SelectComponent, OrganizationSelectComponent, UserManagementComponent, HeaderComponent, }) {
427
+ return ((0, jsx_runtime_1.jsx)(AdminProvider_1.AdminProvider, { publicKey: publicKey, children: (0, jsx_runtime_1.jsx)(Navigation, { theme: theme, publicKey: publicKey, queryEndpoint: queryEndpoint, queryHeaders: queryHeaders, withCredentials: withCredentials, TextInputComponent: TextInputComponent || primitives_1.TextInputPrimitive, ButtonComponent: ButtonComponent || primitives_1.ButtonPrimitive, HeaderComponent: HeaderComponent || primitives_1.HeaderPrimitive, SecondaryButtonComponent: SecondaryButtonComponent || primitives_1.SecondaryButtonPrimitive, ModalComponent: ModalComponent || primitives_1.ModalPrimitive, environment: environment, OrganizationSelectComponent: OrganizationSelectComponent, UserManagementComponent: UserManagementComponent, SelectComponent: SelectComponent || primitives_1.SelectPrimitive }) }));
391
428
  }
429
+ exports.default = Portal;
392
430
  function Navigation({ TextInputComponent, ButtonComponent, SecondaryButtonComponent, ModalComponent, SelectComponent, OrganizationSelectComponent, UserManagementComponent, HeaderComponent, publicKey, queryEndpoint, queryHeaders, environment, withCredentials, }) {
393
- const { state, dispatch } = useAdmin();
431
+ const { state, dispatch } = (0, AdminProvider_1.useAdmin)();
394
432
  // MMTODO: Idk if this is needed
395
433
  // useEffect(() => {
396
434
  // setEnvironmentContext(environment);
@@ -401,23 +439,23 @@ function Navigation({ TextInputComponent, ButtonComponent, SecondaryButtonCompon
401
439
  const renderComponentBasedOnName = () => {
402
440
  switch (state.activeComponent) {
403
441
  case 'Dashboards':
404
- return (_jsx(DashboardManager, { TextInputComponent: TextInputComponent, ButtonComponent: ButtonComponent, SecondaryButtonComponent: SecondaryButtonComponent, ModalComponent: ModalComponent, SelectComponent: SelectComponent, HeaderComponent: HeaderComponent, setReportId: (id) => dispatch({ type: 'SET_REPORT_ID', payload: id }), queryEndpoint: queryEndpoint, queryHeaders: queryHeaders, withCredentials: withCredentials }));
442
+ return ((0, jsx_runtime_1.jsx)(components_1.DashboardManager, { TextInputComponent: TextInputComponent, ButtonComponent: ButtonComponent, SecondaryButtonComponent: SecondaryButtonComponent, ModalComponent: ModalComponent, SelectComponent: SelectComponent, HeaderComponent: HeaderComponent, setReportId: (id) => dispatch({ type: 'SET_REPORT_ID', payload: id }), queryEndpoint: queryEndpoint, queryHeaders: queryHeaders, withCredentials: withCredentials }));
405
443
  case 'SQL editor':
406
- return _jsx(DashboardBuilder, {});
444
+ return (0, jsx_runtime_1.jsx)(DashboardBuilder_1.default, {});
407
445
  case 'Report':
408
- return (_jsx(ReportWrapper, { TextInputComponent: TextInputComponent, ButtonComponent: ButtonComponent, SecondaryButtonComponent: SecondaryButtonComponent, ModalComponent: ModalComponent, SelectComponent: SelectComponent, OrganizationSelectComponent: OrganizationSelectComponent, organizationId: state.organizationId, queryEndpoint: queryEndpoint, queryHeaders: queryHeaders, withCredentials: withCredentials }));
446
+ return ((0, jsx_runtime_1.jsx)(ReportWrapper, { TextInputComponent: TextInputComponent, ButtonComponent: ButtonComponent, SecondaryButtonComponent: SecondaryButtonComponent, ModalComponent: ModalComponent, SelectComponent: SelectComponent, OrganizationSelectComponent: OrganizationSelectComponent, organizationId: state.organizationId, queryEndpoint: queryEndpoint, queryHeaders: queryHeaders, withCredentials: withCredentials }));
409
447
  case 'SQL views':
410
- return _jsx(SQLViewManager, {});
448
+ return (0, jsx_runtime_1.jsx)(SQLViewManager_1.default, {});
411
449
  default:
412
- return (_jsx(Dashboards, { TextInputComponent: TextInputComponent, ButtonComponent: ButtonComponent, SecondaryButtonComponent: SecondaryButtonComponent, OrganizationSelectComponent: OrganizationSelectComponent, ModalComponent: ModalComponent, SelectComponent: SelectComponent, HeaderComponent: HeaderComponent, setReportId: (id) => dispatch({ type: 'SET_REPORT_ID', payload: id }), queryEndpoint: queryEndpoint, organizationId: state.organizationId, queryHeaders: queryHeaders, withCredentials: withCredentials }));
450
+ return ((0, jsx_runtime_1.jsx)(Dashboards, { TextInputComponent: TextInputComponent, ButtonComponent: ButtonComponent, SecondaryButtonComponent: SecondaryButtonComponent, OrganizationSelectComponent: OrganizationSelectComponent, ModalComponent: ModalComponent, SelectComponent: SelectComponent, HeaderComponent: HeaderComponent, setReportId: (id) => dispatch({ type: 'SET_REPORT_ID', payload: id }), queryEndpoint: queryEndpoint, organizationId: state.organizationId, queryHeaders: queryHeaders, withCredentials: withCredentials }));
413
451
  }
414
452
  };
415
- return (_jsxs("div", { style: {
453
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
416
454
  display: 'flex',
417
455
  flexDirection: 'column',
418
456
  height: '100vh',
419
457
  width: '100vw',
420
- }, children: [_jsxs("nav", { style: {
458
+ }, children: [(0, jsx_runtime_1.jsxs)("nav", { style: {
421
459
  zIndex: 2,
422
460
  height: '70px',
423
461
  width: '100%',
@@ -436,13 +474,13 @@ function Navigation({ TextInputComponent, ButtonComponent, SecondaryButtonCompon
436
474
  borderLeftWidth: 0,
437
475
  borderRightWidth: 0,
438
476
  borderStyle: 'solid',
439
- borderColor: theme.borderColor,
440
- }, children: [_jsx("div", { style: {
477
+ borderColor: exports.theme.borderColor,
478
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
441
479
  paddingTop: '18px',
442
480
  paddingLeft: '14px',
443
481
  paddingBottom: '18px',
444
482
  width: 230,
445
- }, children: _jsxs("svg", { width: "45", height: "18", viewBox: "0 0 45 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("g", { clipPath: "url(#clip0_2489_282)", children: _jsx("path", { d: "M18.634 17.3008H9.196C7.97867 17.3008 6.84933 17.1248 5.808 16.7728C4.78133 16.4061 3.894 15.8781 3.146 15.1888C2.398 14.4994 1.81133 13.6634 1.386 12.6808C0.960667 11.6981 0.748 10.5761 0.748 9.31478C0.748 8.14145 0.960667 7.06345 1.386 6.08078C1.826 5.09811 2.42 4.25478 3.168 3.55078C3.916 2.84678 4.796 2.30411 5.808 1.92278C6.82 1.52678 7.90533 1.32878 9.064 1.32878C10.2227 1.32878 11.308 1.52678 12.32 1.92278C13.332 2.31878 14.212 2.86878 14.96 3.57278C15.708 4.27678 16.2947 5.12011 16.72 6.10278C17.16 7.07078 17.38 8.14145 17.38 9.31478C17.38 9.87211 17.314 10.4148 17.182 10.9428C17.0647 11.4708 16.8813 11.9694 16.632 12.4388C16.3827 12.9081 16.06 13.3334 15.664 13.7148C15.268 14.0814 14.806 14.3821 14.278 14.6168V14.6608H18.634V17.3008ZM4.312 9.31478C4.312 9.98945 4.43667 10.6201 4.686 11.2068C4.93533 11.7934 5.27267 12.3068 5.698 12.7468C6.138 13.1721 6.644 13.5094 7.216 13.7588C7.788 14.0081 8.404 14.1328 9.064 14.1328C9.724 14.1328 10.34 14.0081 10.912 13.7588C11.484 13.5094 11.9827 13.1721 12.408 12.7468C12.848 12.3068 13.1927 11.7934 13.442 11.2068C13.6913 10.6201 13.816 9.98945 13.816 9.31478C13.816 8.64011 13.6913 8.00945 13.442 7.42278C13.1927 6.83611 12.848 6.33011 12.408 5.90478C11.9827 5.46478 11.484 5.12011 10.912 4.87078C10.34 4.62145 9.724 4.49678 9.064 4.49678C8.404 4.49678 7.788 4.62145 7.216 4.87078C6.644 5.12011 6.138 5.46478 5.698 5.90478C5.27267 6.33011 4.93533 6.83611 4.686 7.42278C4.43667 8.00945 4.312 8.64011 4.312 9.31478ZM29.3164 17.3008H26.1484V15.8488H26.1044C25.987 16.0541 25.833 16.2594 25.6424 16.4648C25.4664 16.6701 25.2464 16.8534 24.9824 17.0148C24.7184 17.1761 24.4177 17.3081 24.0804 17.4108C23.743 17.5134 23.3764 17.5648 22.9804 17.5648C22.1444 17.5648 21.4624 17.4401 20.9344 17.1908C20.421 16.9268 20.0177 16.5674 19.7244 16.1128C19.4457 15.6581 19.255 15.1228 19.1524 14.5068C19.0644 13.8908 19.0204 13.2234 19.0204 12.5048V6.60878H22.3204V11.8448C22.3204 12.1528 22.3277 12.4754 22.3424 12.8128C22.3717 13.1354 22.4377 13.4361 22.5404 13.7148C22.6577 13.9934 22.8264 14.2208 23.0464 14.3968C23.281 14.5728 23.611 14.6608 24.0364 14.6608C24.4617 14.6608 24.8064 14.5874 25.0704 14.4408C25.3344 14.2794 25.5324 14.0741 25.6644 13.8248C25.811 13.5608 25.9064 13.2674 25.9504 12.9448C25.9944 12.6221 26.0164 12.2848 26.0164 11.9328V6.60878H29.3164V17.3008ZM30.8172 6.60878H34.1172V17.3008H30.8172V6.60878ZM30.5532 3.24278C30.5532 2.71478 30.7365 2.26745 31.1032 1.90078C31.4845 1.51945 31.9392 1.32878 32.4672 1.32878C32.9952 1.32878 33.4425 1.51945 33.8092 1.90078C34.1905 2.26745 34.3812 2.71478 34.3812 3.24278C34.3812 3.77078 34.1905 4.22545 33.8092 4.60678C33.4425 4.97345 32.9952 5.15678 32.4672 5.15678C31.9392 5.15678 31.4845 4.97345 31.1032 4.60678C30.7365 4.22545 30.5532 3.77078 30.5532 3.24278ZM35.652 0.66878H38.952V17.3008H35.652V0.66878ZM40.4869 0.66878H43.7869V17.3008H40.4869V0.66878Z", fill: "#212121" }) }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_2489_282", children: _jsx("rect", { width: "45", height: "18", fill: "white" }) }) })] }) }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row' }, children: [_jsx("button", { style: {
483
+ }, children: (0, jsx_runtime_1.jsxs)("svg", { width: "45", height: "18", viewBox: "0 0 45 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("g", { clipPath: "url(#clip0_2489_282)", children: (0, jsx_runtime_1.jsx)("path", { d: "M18.634 17.3008H9.196C7.97867 17.3008 6.84933 17.1248 5.808 16.7728C4.78133 16.4061 3.894 15.8781 3.146 15.1888C2.398 14.4994 1.81133 13.6634 1.386 12.6808C0.960667 11.6981 0.748 10.5761 0.748 9.31478C0.748 8.14145 0.960667 7.06345 1.386 6.08078C1.826 5.09811 2.42 4.25478 3.168 3.55078C3.916 2.84678 4.796 2.30411 5.808 1.92278C6.82 1.52678 7.90533 1.32878 9.064 1.32878C10.2227 1.32878 11.308 1.52678 12.32 1.92278C13.332 2.31878 14.212 2.86878 14.96 3.57278C15.708 4.27678 16.2947 5.12011 16.72 6.10278C17.16 7.07078 17.38 8.14145 17.38 9.31478C17.38 9.87211 17.314 10.4148 17.182 10.9428C17.0647 11.4708 16.8813 11.9694 16.632 12.4388C16.3827 12.9081 16.06 13.3334 15.664 13.7148C15.268 14.0814 14.806 14.3821 14.278 14.6168V14.6608H18.634V17.3008ZM4.312 9.31478C4.312 9.98945 4.43667 10.6201 4.686 11.2068C4.93533 11.7934 5.27267 12.3068 5.698 12.7468C6.138 13.1721 6.644 13.5094 7.216 13.7588C7.788 14.0081 8.404 14.1328 9.064 14.1328C9.724 14.1328 10.34 14.0081 10.912 13.7588C11.484 13.5094 11.9827 13.1721 12.408 12.7468C12.848 12.3068 13.1927 11.7934 13.442 11.2068C13.6913 10.6201 13.816 9.98945 13.816 9.31478C13.816 8.64011 13.6913 8.00945 13.442 7.42278C13.1927 6.83611 12.848 6.33011 12.408 5.90478C11.9827 5.46478 11.484 5.12011 10.912 4.87078C10.34 4.62145 9.724 4.49678 9.064 4.49678C8.404 4.49678 7.788 4.62145 7.216 4.87078C6.644 5.12011 6.138 5.46478 5.698 5.90478C5.27267 6.33011 4.93533 6.83611 4.686 7.42278C4.43667 8.00945 4.312 8.64011 4.312 9.31478ZM29.3164 17.3008H26.1484V15.8488H26.1044C25.987 16.0541 25.833 16.2594 25.6424 16.4648C25.4664 16.6701 25.2464 16.8534 24.9824 17.0148C24.7184 17.1761 24.4177 17.3081 24.0804 17.4108C23.743 17.5134 23.3764 17.5648 22.9804 17.5648C22.1444 17.5648 21.4624 17.4401 20.9344 17.1908C20.421 16.9268 20.0177 16.5674 19.7244 16.1128C19.4457 15.6581 19.255 15.1228 19.1524 14.5068C19.0644 13.8908 19.0204 13.2234 19.0204 12.5048V6.60878H22.3204V11.8448C22.3204 12.1528 22.3277 12.4754 22.3424 12.8128C22.3717 13.1354 22.4377 13.4361 22.5404 13.7148C22.6577 13.9934 22.8264 14.2208 23.0464 14.3968C23.281 14.5728 23.611 14.6608 24.0364 14.6608C24.4617 14.6608 24.8064 14.5874 25.0704 14.4408C25.3344 14.2794 25.5324 14.0741 25.6644 13.8248C25.811 13.5608 25.9064 13.2674 25.9504 12.9448C25.9944 12.6221 26.0164 12.2848 26.0164 11.9328V6.60878H29.3164V17.3008ZM30.8172 6.60878H34.1172V17.3008H30.8172V6.60878ZM30.5532 3.24278C30.5532 2.71478 30.7365 2.26745 31.1032 1.90078C31.4845 1.51945 31.9392 1.32878 32.4672 1.32878C32.9952 1.32878 33.4425 1.51945 33.8092 1.90078C34.1905 2.26745 34.3812 2.71478 34.3812 3.24278C34.3812 3.77078 34.1905 4.22545 33.8092 4.60678C33.4425 4.97345 32.9952 5.15678 32.4672 5.15678C31.9392 5.15678 31.4845 4.97345 31.1032 4.60678C30.7365 4.22545 30.5532 3.77078 30.5532 3.24278ZM35.652 0.66878H38.952V17.3008H35.652V0.66878ZM40.4869 0.66878H43.7869V17.3008H40.4869V0.66878Z", fill: "#212121" }) }), (0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: "clip0_2489_282", children: (0, jsx_runtime_1.jsx)("rect", { width: "45", height: "18", fill: "white" }) }) })] }) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'row' }, children: [(0, jsx_runtime_1.jsx)("button", { style: {
446
484
  color: '#212121',
447
485
  backgroundColor: state.activeComponent === 'Dashboards'
448
486
  ? '#2121210A'
@@ -458,7 +496,7 @@ function Navigation({ TextInputComponent, ButtonComponent, SecondaryButtonCompon
458
496
  outline: 'none',
459
497
  },
460
498
  // onClick={() => setActiveComponent("Dashboards")}
461
- onClick: () => dispatch({ type: 'SET_ACTIVE_COMPONENT', payload: 'Dashboards' }), children: "Dashboards" }), _jsx("button", { style: {
499
+ onClick: () => dispatch({ type: 'SET_ACTIVE_COMPONENT', payload: 'Dashboards' }), children: "Dashboards" }), (0, jsx_runtime_1.jsx)("button", { style: {
462
500
  color: '#212121',
463
501
  backgroundColor: state.activeComponent === 'SQL editor'
464
502
  ? '#2121210A'
@@ -474,7 +512,7 @@ function Navigation({ TextInputComponent, ButtonComponent, SecondaryButtonCompon
474
512
  outline: 'none',
475
513
  },
476
514
  // onClick={() => setActiveComponent("SQL editor")}
477
- onClick: () => dispatch({ type: 'SET_ACTIVE_COMPONENT', payload: 'SQL editor' }), children: "SQL editor" }), _jsx("button", { style: {
515
+ onClick: () => dispatch({ type: 'SET_ACTIVE_COMPONENT', payload: 'SQL editor' }), children: "SQL editor" }), (0, jsx_runtime_1.jsx)("button", { style: {
478
516
  color: '#212121',
479
517
  backgroundColor: state.activeComponent === 'SQL views'
480
518
  ? '#2121210A'
@@ -490,7 +528,7 @@ function Navigation({ TextInputComponent, ButtonComponent, SecondaryButtonCompon
490
528
  outline: 'none',
491
529
  },
492
530
  // onClick={() => setActiveComponent("SQL views")}
493
- onClick: () => dispatch({ type: 'SET_ACTIVE_COMPONENT', payload: 'SQL views' }), children: "SQL views" })] }), _jsx("div", { style: {
531
+ onClick: () => dispatch({ type: 'SET_ACTIVE_COMPONENT', payload: 'SQL views' }), children: "SQL views" })] }), (0, jsx_runtime_1.jsx)("div", { style: {
494
532
  display: 'flex',
495
533
  flexDirection: 'row',
496
534
  minHeight: '50px',
@@ -498,21 +536,21 @@ function Navigation({ TextInputComponent, ButtonComponent, SecondaryButtonCompon
498
536
  alignItems: 'center',
499
537
  paddingRight: '8px',
500
538
  width: 230,
501
- }, children: UserManagementComponent && _jsx(UserManagementComponent, {}) })] }), _jsx("div", { style: {
539
+ }, children: UserManagementComponent && (0, jsx_runtime_1.jsx)(UserManagementComponent, {}) })] }), (0, jsx_runtime_1.jsx)("div", { style: {
502
540
  display: 'flex',
503
541
  flexDirection: 'column',
504
542
  height: '100%',
505
543
  width: '100%',
506
544
  // marginTop: activeComponent !== 'Report' ? '70px' : undefined
507
- }, children: _jsx(QuillProvider
545
+ }, children: (0, jsx_runtime_1.jsx)(react_2.QuillProvider
508
546
  // organizationId={'2'}
509
547
  // publicKey={client?._id}
510
548
  , {
511
549
  // organizationId={'2'}
512
550
  // publicKey={client?._id}
513
- organizationId: state.organizationId, queryEndpoint: queryEndpoint, withCredentials: withCredentials, queryHeaders: queryHeaders, publicKey: state.client._id, environment: state.environment, theme: theme, children: renderComponentBasedOnName() }) })] }));
551
+ organizationId: state.organizationId, queryEndpoint: queryEndpoint, withCredentials: withCredentials, queryHeaders: queryHeaders, publicKey: state.client._id, environment: state.environment, theme: exports.theme, children: renderComponentBasedOnName() }) })] }));
514
552
  }
515
- export const theme = {
553
+ exports.theme = {
516
554
  fontFamily: 'Inter; Helvetica',
517
555
  backgroundColor: '#FFFFFF',
518
556
  primaryTextColor: '#364153',
@@ -528,7 +566,7 @@ export const theme = {
528
566
  primaryButtonColor: '#212121',
529
567
  primaryButtonTextColor: '#FFFFFF',
530
568
  };
531
- export function convertPostgresColumn(column) {
569
+ function convertPostgresColumn(column) {
532
570
  let format;
533
571
  switch (column.dataTypeID) {
534
572
  case 20: // int8
@@ -557,7 +595,8 @@ export function convertPostgresColumn(column) {
557
595
  format: format,
558
596
  };
559
597
  }
560
- export function getPostgresBasicType(column) {
598
+ exports.convertPostgresColumn = convertPostgresColumn;
599
+ function getPostgresBasicType(column) {
561
600
  let format;
562
601
  // first check if column.dataTypeID exists
563
602
  if (column.dataTypeID) {
@@ -605,21 +644,23 @@ export function getPostgresBasicType(column) {
605
644
  }
606
645
  return format;
607
646
  }
608
- export function classNames(...classes) {
647
+ exports.getPostgresBasicType = getPostgresBasicType;
648
+ function classNames(...classes) {
609
649
  return classes.filter(Boolean).join(' ');
610
650
  }
611
- export function AddDashboardModal({ selectedDashboard, isOpen, setIsOpen, client, ModalComponent, TextInputComponent, SelectComponent, HeaderComponent, ButtonComponent, dashNames, getDashNames, organizationId, }) {
612
- const { state, dispatch } = useAdmin();
613
- const [selectedDashboardName, setSelectedDashboardName] = useState(selectedDashboard?.name);
651
+ exports.classNames = classNames;
652
+ function AddDashboardModal({ selectedDashboard, isOpen, setIsOpen, client, ModalComponent, TextInputComponent, SelectComponent, HeaderComponent, ButtonComponent, dashNames, getDashNames, organizationId, }) {
653
+ const { state, dispatch } = (0, AdminProvider_1.useAdmin)();
654
+ const [selectedDashboardName, setSelectedDashboardName] = (0, react_1.useState)(selectedDashboard?.name);
614
655
  // const [tables] = useContext(TablesContext);
615
- const [selectedTable, setSelectedTable] = useState(null);
616
- const [name, setName] = useState('');
617
- const [field, setField] = useState('');
618
- const [filterType, setFilterType] = useState('string');
619
- const [dateRange, setDateRange] = useState([new Date(), new Date()]);
620
- const [newFilters, setNewFilters] = useState([]);
621
- const [newDateFilter, setNewDateFilter] = useState(null);
622
- useEffect(() => {
656
+ const [selectedTable, setSelectedTable] = (0, react_1.useState)(null);
657
+ const [name, setName] = (0, react_1.useState)('');
658
+ const [field, setField] = (0, react_1.useState)('');
659
+ const [filterType, setFilterType] = (0, react_1.useState)('string');
660
+ const [dateRange, setDateRange] = (0, react_1.useState)([new Date(), new Date()]);
661
+ const [newFilters, setNewFilters] = (0, react_1.useState)([]);
662
+ const [newDateFilter, setNewDateFilter] = (0, react_1.useState)(null);
663
+ (0, react_1.useEffect)(() => {
623
664
  if (state.tables.length) {
624
665
  setSelectedTable(state.tables[0]);
625
666
  // setField(tables[0].columns.map((elem) => elem.name));
@@ -689,7 +730,7 @@ export function AddDashboardModal({ selectedDashboard, isOpen, setIsOpen, client
689
730
  return;
690
731
  }
691
732
  let responseData;
692
- const url = `${QUILL_SERVER}/newdash/${client._id}/`;
733
+ const url = `${constants_1.QUILL_SERVER}/newdash/${client._id}/`;
693
734
  const body = newDateFilter && Object.keys(newDateFilter).length
694
735
  ? {
695
736
  dateFilter: newDateFilter,
@@ -731,56 +772,57 @@ export function AddDashboardModal({ selectedDashboard, isOpen, setIsOpen, client
731
772
  }
732
773
  };
733
774
  if (!selectedTable) {
734
- return _jsx(_Fragment, {});
775
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
735
776
  }
736
777
  const handleAddFilter = async () => {
737
778
  setNewFilters([...newFilters, { label: '', field }]);
738
779
  };
739
- return (_jsx(ModalComponent, { isOpen: isOpen, close: () => setIsOpen(false), children: _jsxs("div", { children: [_jsx(TextInputComponent, { placeholder: "Enter Dashboard Name...", onChange: (e) => setSelectedDashboardName(e.target.value), value: selectedDashboardName }), _jsxs("div", { style: {
780
+ return ((0, jsx_runtime_1.jsx)(ModalComponent, { isOpen: isOpen, close: () => setIsOpen(false), children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(TextInputComponent, { placeholder: "Enter Dashboard Name...", onChange: (e) => setSelectedDashboardName(e.target.value), value: selectedDashboardName }), (0, jsx_runtime_1.jsxs)("div", { style: {
740
781
  display: 'flex',
741
782
  flexDirection: 'column',
742
783
  alignItems: 'center',
743
784
  }, children: [newFilters.map((filter, index) => {
744
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'row' }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx("h2", { children: "Label" }), _jsx(TextInputComponent, { value: filter.label, onChange: (e) => {
785
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'row' }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("h2", { children: "Label" }), (0, jsx_runtime_1.jsx)(TextInputComponent, { value: filter.label, onChange: (e) => {
745
786
  const updatedFilters = newFilters.map((otherFilter, i) => index === i
746
787
  ? { ...otherFilter, label: e.target.value }
747
788
  : otherFilter);
748
789
  setNewFilters(updatedFilters);
749
- } })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx("h4", { children: "Field" }), _jsx("div", { style: {
790
+ } })] }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("h4", { children: "Field" }), (0, jsx_runtime_1.jsx)("div", { style: {
750
791
  display: 'flex',
751
792
  flexDirection: 'column',
752
793
  alignItems: 'center',
753
- }, children: _jsxs("div", { style: {
794
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
754
795
  display: 'flex',
755
796
  flexDirection: 'row',
756
797
  alignItems: 'center',
757
- }, children: [_jsx(SelectComponent, { defaultValue: "", value: filter && filter.field ? filter.field : '', QuillOptions: selectedTable.columns.map((column) => {
798
+ }, children: [(0, jsx_runtime_1.jsx)(SelectComponent, { defaultValue: "", value: filter && filter.field ? filter.field : '', QuillOptions: selectedTable.columns.map((column) => {
758
799
  return { label: column.name, value: column.name };
759
800
  }), onChange: (e) => {
760
801
  const updatedFilters = newFilters.map((otherFilter, i) => index === i
761
802
  ? { ...otherFilter, field: e }
762
803
  : otherFilter);
763
804
  setNewFilters(updatedFilters);
764
- } }), _jsx("div", { onClick: () => handleDeleteFilter(filter), style: {
805
+ } }), (0, jsx_runtime_1.jsx)("div", { onClick: () => handleDeleteFilter(filter), style: {
765
806
  height: 38,
766
807
  width: 42,
767
808
  alignItems: 'center',
768
809
  justifyContent: 'center',
769
810
  display: 'flex',
770
- }, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#4C5462", width: "20", height: "20", children: _jsx("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }) })] }) })] })] }, filter.field + index));
771
- }), _jsx(ButtonComponent, { onClick: handleAddFilter, label: "Add new filter +" }), _jsx(ButtonComponent, { onClick: handleAddDashboardSubmit, label: "Add Dashboard +" })] })] }) }));
811
+ }, children: (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#4C5462", width: "20", height: "20", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }) })] }) })] })] }, filter.field + index));
812
+ }), (0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: handleAddFilter, label: "Add new filter +" }), (0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: handleAddDashboardSubmit, label: "Add Dashboard +" })] })] }) }));
772
813
  }
773
- export function TableCell({ table, clickTableCell }) {
814
+ exports.AddDashboardModal = AddDashboardModal;
815
+ function TableCell({ table, clickTableCell }) {
774
816
  const handleClickTableCell = () => {
775
817
  clickTableCell(table);
776
818
  };
777
- return (_jsxs("div", { onClick: handleClickTableCell, style: {
819
+ return ((0, jsx_runtime_1.jsxs)("div", { onClick: handleClickTableCell, style: {
778
820
  marginBottom: '54px',
779
821
  flex: 1,
780
822
  minWidth: '540px',
781
823
  maxWidth: '540px',
782
824
  cursor: 'pointer',
783
- }, children: [_jsx("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: _jsx("h3", { style: { color: '#384151' }, children: table.displayName }) }), _jsx(Highlight, { ...defaultProps, theme: prismTheme, code: table.viewQuery, language: "sql", children: ({ className, style, tokens, getLineProps, getTokenProps }) => (_jsx("pre", { className: className, style: {
825
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: (0, jsx_runtime_1.jsx)("h3", { style: { color: '#384151' }, children: table.displayName }) }), (0, jsx_runtime_1.jsx)(prism_react_renderer_1.default, { ...prism_react_renderer_1.defaultProps, theme: nightOwlLight_1.default, code: table.viewQuery, language: "sql", children: ({ className, style, tokens, getLineProps, getTokenProps }) => ((0, jsx_runtime_1.jsx)("pre", { className: className, style: {
784
826
  ...style,
785
827
  textAlign: 'left',
786
828
  margin: '1em 0',
@@ -790,21 +832,22 @@ export function TableCell({ table, clickTableCell }) {
790
832
  maxWidth: 520,
791
833
  // lineHeight: "1.3em",
792
834
  // height: "1.3em",
793
- }, children: tokens.map((line, i) => (_jsx("div", { ...getLineProps({ line, key: i }), children: line.map((token, key) => (_jsx("span", { ...getTokenProps({ token, key }) }, key))) }, i))) })) })] }, table.displayName));
835
+ }, children: tokens.map((line, i) => ((0, jsx_runtime_1.jsx)("div", { ...getLineProps({ line, key: i }), children: line.map((token, key) => ((0, jsx_runtime_1.jsx)("span", { ...getTokenProps({ token, key }) }, key))) }, i))) })) })] }, table.displayName));
794
836
  }
795
- export const SQLEditorComponent = ({ query, setQuery,
837
+ exports.TableCell = TableCell;
838
+ const SQLEditorComponent = ({ query, setQuery,
796
839
  // handleRunQuery,
797
840
  theme,
798
841
  // defineEditorTheme,
799
842
  // setEditorTheme,
800
843
  }) => {
801
- const [isOpen, setIsOpen] = useState(false);
802
- const [rows, setRows] = useState([]);
803
- const [columns, setColumns] = useState([]);
804
- const [fields, setFields] = useState([]);
844
+ const [isOpen, setIsOpen] = (0, react_1.useState)(false);
845
+ const [rows, setRows] = (0, react_1.useState)([]);
846
+ const [columns, setColumns] = (0, react_1.useState)([]);
847
+ const [fields, setFields] = (0, react_1.useState)([]);
805
848
  // const [activeQuery] = useContext(ActiveQueryContext);
806
- const { state, dispatch } = useAdmin();
807
- return (_jsxs("div", { style: {
849
+ const { state, dispatch } = (0, AdminProvider_1.useAdmin)();
850
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
808
851
  background: theme.backgroundColor,
809
852
  // maxHeight: 700,
810
853
  // width: "100%",
@@ -814,7 +857,7 @@ theme,
814
857
  // marginLeft: 20,
815
858
  borderRadius: 6,
816
859
  overflow: 'hidden',
817
- }, children: [_jsx(SQLEditor, { containerStyle: { height: 'calc(100vh - 270px)', width: '100%' }, onChangeQuery: (query) => setQuery(query), onChangeData: (data) => setRows(data), onChangeColumns: (columns) => setColumns(columns), onChangeFields: (fields) => setFields(fields), defaultQuery: state.activeQuery ? state.activeQuery : '' }), rows.length > 0 && (_jsx("button", { style: {
860
+ }, children: [(0, jsx_runtime_1.jsx)(react_2.SQLEditor, { containerStyle: { height: 'calc(100vh - 270px)', width: '100%' }, onChangeQuery: (query) => setQuery(query), onChangeData: (data) => setRows(data), onChangeColumns: (columns) => setColumns(columns), onChangeFields: (fields) => setFields(fields), defaultQuery: state.activeQuery ? state.activeQuery : '' }), rows.length > 0 && ((0, jsx_runtime_1.jsx)("button", { style: {
818
861
  height: 36,
819
862
  marginLeft: 250,
820
863
  marginTop: 20,
@@ -832,10 +875,11 @@ theme,
832
875
  fontSize: 14,
833
876
  paddingLeft: 20,
834
877
  paddingRight: 20,
835
- }, onClick: () => setIsOpen(true), children: "Add to dashboard" })), _jsx(AddToDashboardModal, { isOpen: isOpen, setIsOpen: setIsOpen, rows: rows, columns: columns, query: query, showTableFormatQuillOptions: true, showDateFieldQuillOptions: true, showAccessControlQuillOptions: true, fields: fields })] }));
878
+ }, onClick: () => setIsOpen(true), children: "Add to dashboard" })), (0, jsx_runtime_1.jsx)(react_2.AddToDashboardModal, { isOpen: isOpen, setIsOpen: setIsOpen, rows: rows, columns: columns, query: query, showTableFormatQuillOptions: true, showDateFieldQuillOptions: true, showAccessControlQuillOptions: true, fields: fields })] }));
836
879
  };
880
+ exports.SQLEditorComponent = SQLEditorComponent;
837
881
  const SchemaListComponent = ({ schema, theme }) => {
838
- return (_jsx("div", { style: {
882
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
839
883
  background: theme.backgroundColor,
840
884
  maxHeight: 700,
841
885
  width: 300,
@@ -844,10 +888,10 @@ const SchemaListComponent = ({ schema, theme }) => {
844
888
  // maxHeight: "100%",
845
889
  paddingLeft: 20,
846
890
  paddingRight: 20,
847
- }, children: schema.map((elem, index) => (_jsx(SchemaItem, { elem: elem, theme: theme, index: index }, elem.displayName + index))) }));
891
+ }, children: schema.map((elem, index) => ((0, jsx_runtime_1.jsx)(SchemaItem, { elem: elem, theme: theme, index: index }, elem.displayName + index))) }));
848
892
  };
849
893
  function SchemaItem({ elem, theme, index }) {
850
- const [isOpen, setIsOpen] = useState(index === 0);
894
+ const [isOpen, setIsOpen] = (0, react_1.useState)(index === 0);
851
895
  const schemaContainerStyle = {
852
896
  display: 'flex',
853
897
  flexDirection: 'column',
@@ -869,12 +913,12 @@ function SchemaItem({ elem, theme, index }) {
869
913
  const schemaRowHoverStyle = {
870
914
  background: theme.selectUnderlayColor,
871
915
  };
872
- return (_jsxs("div", { style: schemaContainerStyle, children: [_jsxs("div", { style: { ...schemaRowStyle, ...(isOpen && schemaRowHoverStyle) }, onClick: () => setIsOpen(!isOpen), children: [_jsx("p", { style: {
916
+ return ((0, jsx_runtime_1.jsxs)("div", { style: schemaContainerStyle, children: [(0, jsx_runtime_1.jsxs)("div", { style: { ...schemaRowStyle, ...(isOpen && schemaRowHoverStyle) }, onClick: () => setIsOpen(!isOpen), children: [(0, jsx_runtime_1.jsx)("p", { style: {
873
917
  marginLeft: theme.padding,
874
918
  fontSize: theme.fontSize,
875
919
  color: '#384151',
876
920
  fontWeight: '500',
877
- }, children: elem.displayName }), _jsx("div", { style: {
921
+ }, children: elem.displayName }), (0, jsx_runtime_1.jsx)("div", { style: {
878
922
  display: 'flex',
879
923
  alignItems: 'center',
880
924
  justifyContent: 'center',
@@ -883,19 +927,19 @@ function SchemaItem({ elem, theme, index }) {
883
927
  paddingBottom: 20,
884
928
  paddingLeft: 0,
885
929
  cursor: 'pointer',
886
- }, children: isOpen ? (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "h-5 w-5 text-gray-400", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) })) : (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "h-5 w-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) })) })] }), isOpen ? (_jsx("div", { style: {
930
+ }, children: isOpen ? ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "h-5 w-5 text-gray-400", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) })) : ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "h-5 w-5", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) })) })] }), isOpen ? ((0, jsx_runtime_1.jsx)("div", { style: {
887
931
  paddingBottom: theme.padding,
888
932
  display: 'flex',
889
933
  flexDirection: 'column',
890
934
  paddingLeft: theme.padding,
891
935
  paddingRight: theme.padding,
892
- }, children: elem.columns.map((elem, index) => (_jsxs("div", { style: {
936
+ }, children: elem.columns.map((elem, index) => ((0, jsx_runtime_1.jsxs)("div", { style: {
893
937
  paddingTop: theme.padding,
894
938
  display: 'flex',
895
939
  flexDirection: 'row',
896
940
  alignItems: 'center',
897
941
  justifyContent: 'space-between',
898
- }, children: [_jsx("div", { title: elem.displayName, className: "text-gray-500", style: {
942
+ }, children: [(0, jsx_runtime_1.jsx)("div", { title: elem.displayName, className: "text-gray-500", style: {
899
943
  fontSize: 13,
900
944
  // color: theme.secondaryFontColor,
901
945
  whiteSpace: 'nowrap',
@@ -905,14 +949,14 @@ function SchemaItem({ elem, theme, index }) {
905
949
  overflow: 'hidden',
906
950
  width: 200,
907
951
  maxWidth: 200,
908
- }, children: elem.displayName }), _jsx("div", { className: "text-gray-500", title: elem.displayName, style: {
952
+ }, children: elem.displayName }), (0, jsx_runtime_1.jsx)("div", { className: "text-gray-500", title: elem.displayName, style: {
909
953
  fontSize: 13,
910
954
  color: theme.secondaryFontColor,
911
955
  padding: 0,
912
956
  margin: 0,
913
957
  }, children: elem.fieldType })] }, elem.displayName + elem.index))) })) : null] }));
914
958
  }
915
- export function defineEditorTheme(monaco, theme) {
959
+ function defineEditorTheme(monaco, theme) {
916
960
  monaco.editor.defineTheme('onedark', {
917
961
  base: theme.darkMode ? 'vs-dark' : 'vs',
918
962
  inherit: true,
@@ -929,7 +973,8 @@ export function defineEditorTheme(monaco, theme) {
929
973
  },
930
974
  });
931
975
  }
932
- export function setEditorTheme(editor, monaco) {
976
+ exports.defineEditorTheme = defineEditorTheme;
977
+ function setEditorTheme(editor, monaco) {
933
978
  try {
934
979
  monaco.editor.setTheme('onedark');
935
980
  }
@@ -937,11 +982,14 @@ export function setEditorTheme(editor, monaco) {
937
982
  console.log('ERROR: ', e);
938
983
  }
939
984
  }
940
- export function isValidDate(d) {
985
+ exports.setEditorTheme = setEditorTheme;
986
+ function isValidDate(d) {
941
987
  return d instanceof Date && !isNaN(d);
942
988
  }
943
- export const isArrayOfValidDates = (arr, field) => arr.every((d) => new Date(d[field]) instanceof Date && !isNaN(new Date(d[field])));
944
- export function formatDateBuckets(startDate, endDate) {
989
+ exports.isValidDate = isValidDate;
990
+ const isArrayOfValidDates = (arr, field) => arr.every((d) => new Date(d[field]) instanceof Date && !isNaN(new Date(d[field])));
991
+ exports.isArrayOfValidDates = isArrayOfValidDates;
992
+ function formatDateBuckets(startDate, endDate) {
945
993
  // Calculate the distance in hours
946
994
  const distanceInHours = Math.abs(differenceInHours(endDate, startDate));
947
995
  // Check if the distance is less than or equal to one hour
@@ -989,6 +1037,7 @@ export function formatDateBuckets(startDate, endDate) {
989
1037
  startOf: startOfYear,
990
1038
  };
991
1039
  }
1040
+ exports.formatDateBuckets = formatDateBuckets;
992
1041
  const POSTGRES_DATE_TYPES = [
993
1042
  'timestamp',
994
1043
  'date',
@@ -1009,8 +1058,8 @@ const FORMAT_QuillOptionS = [
1009
1058
  { value: 'string', label: 'string' },
1010
1059
  ];
1011
1060
  function Report({ reportId, saveDashboardItem, isOpen, setIsOpen, isEditQueryOpen, SecondaryButtonComponent, ButtonComponent, deleteReport, updateQuery, OrganizationSelectComponent, ModalComponent, NavigateToDashboardBuilder, }) {
1012
- const { data, loading, error } = useQuill(reportId);
1013
- const { state, dispatch } = useAdmin();
1061
+ const { data, loading, error } = (0, react_2.useQuill)(reportId);
1062
+ const { state, dispatch } = (0, AdminProvider_1.useAdmin)();
1014
1063
  const downloadCSV = () => {
1015
1064
  // report.rows
1016
1065
  if (!data) {
@@ -1046,9 +1095,9 @@ function Report({ reportId, saveDashboardItem, isOpen, setIsOpen, isEditQueryOpe
1046
1095
  return null;
1047
1096
  }
1048
1097
  if (error) {
1049
- return _jsx("div", { children: error });
1098
+ return (0, jsx_runtime_1.jsx)("div", { children: error });
1050
1099
  }
1051
- return (_jsxs("div", { style: { paddingLeft: 40, paddingRight: 40 }, children: [_jsx("div", { style: {
1100
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { paddingLeft: 40, paddingRight: 40 }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1052
1101
  // width: 'calc(100vw - 30px)',
1053
1102
  display: 'flex',
1054
1103
  position: 'fixed',
@@ -1068,64 +1117,64 @@ function Report({ reportId, saveDashboardItem, isOpen, setIsOpen, isEditQueryOpe
1068
1117
  borderLeftWidth: 0,
1069
1118
  borderRightWidth: 0,
1070
1119
  borderStyle: 'solid',
1071
- borderColor: theme.borderColor,
1120
+ borderColor: exports.theme.borderColor,
1072
1121
  paddingBottom: 20,
1073
1122
  boxShadow: '0px 1px 4px 0px rgba(0, 0, 0, 0.07)',
1074
1123
  // paddingRight: '50px',
1075
1124
  // position: 'absolute'
1076
1125
  // // zIndex: 10
1077
- }, children: _jsxs("div", { style: {
1126
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
1078
1127
  display: 'flex',
1079
1128
  flexDirection: 'row',
1080
1129
  alignItems: 'flex-end',
1081
1130
  justifyContent: 'space-between',
1082
1131
  width: '100%',
1083
1132
  // marginLeft: '25px'
1084
- }, children: [_jsxs("div", { style: {
1133
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
1085
1134
  display: 'flex',
1086
1135
  flexDirection: 'row',
1087
1136
  alignItems: 'center',
1088
1137
  paddingBottom: 4,
1089
- }, children: [_jsx(SecondaryButtonComponent, { label: "\u2190 Back", onClick: goBack }), _jsx("h1", { style: {
1138
+ }, children: [(0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { label: "\u2190 Back", onClick: goBack }), (0, jsx_runtime_1.jsx)("h1", { style: {
1090
1139
  fontSize: '36px',
1091
1140
  paddingTop: '0px',
1092
1141
  fontWeight: '600',
1093
1142
  color: '#384151',
1094
1143
  margin: 0,
1095
1144
  paddingLeft: 16,
1096
- }, children: data.name })] }), _jsxs("div", { style: {
1145
+ }, children: data.name })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
1097
1146
  display: 'flex',
1098
1147
  flexDirection: 'row',
1099
1148
  alignItems: 'center',
1100
- }, children: [_jsx("div", { style: { width: '20px' } }), _jsx("div", { style: { display: 'flex', flexDirection: 'column' }, children: _jsx("div", { style: {
1149
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { width: '20px' } }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)("div", { style: {
1101
1150
  display: 'flex',
1102
1151
  flexDirection: 'row',
1103
1152
  alignItems: 'flex-end',
1104
1153
  gap: 16,
1105
- }, children: _jsx(OrgSelect, { environment: state.environment, setEnvironment: (env) => dispatch({ type: 'SET_ENVIRONMENT', payload: env }), organizations: state.organizations, organizationId: state.organizationId, setOrganizationId: (orgId) => dispatch({ type: 'SET_ORGANIZATION_ID', payload: orgId }), theme: state.theme }) }) })] })] }) }), _jsx("div", { style: { height: 240 } }), _jsx(Chart, { chartId: reportId, colors: theme.chartColors, containerStyle: {
1154
+ }, children: (0, jsx_runtime_1.jsx)(components_1.OrgSelect, { environment: state.environment, setEnvironment: (env) => dispatch({ type: 'SET_ENVIRONMENT', payload: env }), organizations: state.organizations, organizationId: state.organizationId, setOrganizationId: (orgId) => dispatch({ type: 'SET_ORGANIZATION_ID', payload: orgId }), theme: state.theme }) }) })] })] }) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 240 } }), (0, jsx_runtime_1.jsx)(react_2.Chart, { chartId: reportId, colors: exports.theme.chartColors, containerStyle: {
1106
1155
  width: 'calc(100vw - 80px)',
1107
1156
  height: data.chartType === 'table' ? 600 : 400,
1108
- } }), _jsxs("div", { style: {
1157
+ } }), (0, jsx_runtime_1.jsxs)("div", { style: {
1109
1158
  display: 'flex',
1110
1159
  alignItems: 'center',
1111
1160
  gap: 16,
1112
1161
  marginTop: 20,
1113
- }, children: [_jsx(SecondaryButtonComponent, { label: "Edit chart", onClick: () => setIsOpen(true) }), state.navigateToDashboardBuilder && (_jsx(SecondaryButtonComponent, { label: "Edit query", onClick: () => {
1162
+ }, children: [(0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { label: "Edit chart", onClick: () => setIsOpen(true) }), state.navigateToDashboardBuilder && ((0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { label: "Edit query", onClick: () => {
1114
1163
  dispatch({ type: 'SET_ACTIVE_QUERY', payload: data.queryString });
1115
1164
  dispatch({ type: 'SET_ACTIVE_EDIT_ITEM', payload: data });
1116
1165
  state.navigateToDashboardBuilder();
1117
- } })), _jsx(SecondaryButtonComponent, { label: "Delete", onClick: deleteReport })] }), data.chartType !== 'table' && (_jsx(Table, { containerStyle: { height: 400, width: '100%', marginTop: 24 }, chartId: reportId })), _jsx(EditVisualizationModal, { isOpen: isOpen, setIsOpen: setIsOpen, report: data, isEditMode: !!state.activeQuery, data: data.rows, query: data.queryString, columns: data.columns, fields: data.fields })] }));
1166
+ } })), (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { label: "Delete", onClick: deleteReport })] }), data.chartType !== 'table' && ((0, jsx_runtime_1.jsx)(react_2.Table, { containerStyle: { height: 400, width: '100%', marginTop: 24 }, chartId: reportId })), (0, jsx_runtime_1.jsx)(EditVisualizationModal, { isOpen: isOpen, setIsOpen: setIsOpen, report: data, isEditMode: !!state.activeQuery, data: data.rows, query: data.queryString, columns: data.columns, fields: data.fields })] }));
1118
1167
  }
1119
- function EditVisualizationModal({ isOpen, setIsOpen, report, data, isEditMode }) {
1168
+ function EditVisualizationModal({ isOpen, setIsOpen, report, data, isEditMode, }) {
1120
1169
  if (!report && !data?.length) {
1121
1170
  return null;
1122
1171
  }
1123
- return (_jsx(_Fragment, { children: isOpen && (_jsxs("div", { className: "inset-0 overflow-y-auto relative", style: { zIndex: 120 }, children: [_jsx("div", { className: "absolute inset-0 bg-black/30", "aria-hidden": "true", onClick: () => setIsOpen(false) }), _jsx("div", { className: "flex min-h-full items-center justify-center p-4", children: _jsx("div", { className: "bg-white px-7 py-7 rounded-lg", children: _jsx(ChartEditor, { isOpen: isOpen, setIsOpen: setIsOpen, isEditMode: isEditMode, chartId: report._id, admin: true }) }) })] })) }));
1172
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isOpen && ((0, jsx_runtime_1.jsxs)("div", { className: "inset-0 overflow-y-auto relative", style: { zIndex: 120 }, children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 bg-black/30", "aria-hidden": "true", onClick: () => setIsOpen(false) }), (0, jsx_runtime_1.jsx)("div", { className: "flex min-h-full items-center justify-center p-4", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-white px-7 py-7 rounded-lg", children: (0, jsx_runtime_1.jsx)(react_2.ChartEditor, { isOpen: isOpen, setIsOpen: setIsOpen, isEditMode: isEditMode, chartId: report._id, admin: true }) }) })] })) }));
1124
1173
  }
1125
- export function ReportWrapper({ SecondaryButtonComponent, ButtonComponent, ModalComponent, SelectComponent, OrganizationSelectComponent, organizationId, queryEndpoint, queryHeaders, withCredentials, }) {
1126
- const { state, dispatch } = useAdmin();
1127
- let [isOpen, setIsOpen] = useState(false);
1128
- const [isEditQueryOpen, setIsEditQueryOpen] = useState(false);
1174
+ function ReportWrapper({ SecondaryButtonComponent, ButtonComponent, ModalComponent, SelectComponent, OrganizationSelectComponent, organizationId, queryEndpoint, queryHeaders, withCredentials, }) {
1175
+ const { state, dispatch } = (0, AdminProvider_1.useAdmin)();
1176
+ let [isOpen, setIsOpen] = (0, react_1.useState)(false);
1177
+ const [isEditQueryOpen, setIsEditQueryOpen] = (0, react_1.useState)(false);
1129
1178
  const updateQuery = async (dashboardItemId, query) => {
1130
1179
  if (!state.client || !dashboardItemId || !query) {
1131
1180
  return;
@@ -1153,7 +1202,7 @@ export function ReportWrapper({ SecondaryButtonComponent, ButtonComponent, Modal
1153
1202
  responseData = await response.json();
1154
1203
  }
1155
1204
  else {
1156
- const url = `${QUILL_SERVER}/updatequery/${state.client._id}/${organizationId}/`;
1205
+ const url = `${constants_1.QUILL_SERVER}/updatequery/${state.client._id}/${organizationId}/`;
1157
1206
  const requestBody = {
1158
1207
  dashboardItemId,
1159
1208
  query,
@@ -1220,7 +1269,7 @@ export function ReportWrapper({ SecondaryButtonComponent, ButtonComponent, Modal
1220
1269
  responseData = await response.json(); // If the server returns JSON data
1221
1270
  }
1222
1271
  else {
1223
- const url = `${QUILL_SERVER}/deletedash/${state.client._id}/${organizationId}/`;
1272
+ const url = `${constants_1.QUILL_SERVER}/deletedash/${state.client._id}/${organizationId}/`;
1224
1273
  const requestBody = {
1225
1274
  dashboardItemId: state.reportId,
1226
1275
  };
@@ -1239,22 +1288,23 @@ export function ReportWrapper({ SecondaryButtonComponent, ButtonComponent, Modal
1239
1288
  dispatch({ type: 'SET_ACTIVE_COMPONENT', payload: 'Dashboards' });
1240
1289
  }
1241
1290
  };
1242
- return (_jsx(Report, { reportId: state.reportId, updateQuery: updateQuery, isOpen: isOpen, setIsOpen: setIsOpen, isEditQueryOpen: isEditQueryOpen, setIsEditQueryOpen: setIsEditQueryOpen, deleteReport: deleteReport, SecondaryButtonComponent: SecondaryButtonComponent, ButtonComponent: ButtonComponent, ModalComponent: ModalComponent, SelectComponent: SelectComponent, OrganizationSelectComponent: OrganizationSelectComponent }));
1291
+ return ((0, jsx_runtime_1.jsx)(Report, { reportId: state.reportId, updateQuery: updateQuery, isOpen: isOpen, setIsOpen: setIsOpen, isEditQueryOpen: isEditQueryOpen, setIsEditQueryOpen: setIsEditQueryOpen, deleteReport: deleteReport, SecondaryButtonComponent: SecondaryButtonComponent, ButtonComponent: ButtonComponent, ModalComponent: ModalComponent, SelectComponent: SelectComponent, OrganizationSelectComponent: OrganizationSelectComponent }));
1243
1292
  }
1293
+ exports.ReportWrapper = ReportWrapper;
1244
1294
  const measuringConfig = {
1245
1295
  droppable: {
1246
- strategy: MeasuringStrategy.Always,
1296
+ strategy: core_1.MeasuringStrategy.Always,
1247
1297
  },
1248
1298
  };
1249
- export function ReorderableList({ initialItems, client, itemMap, ButtonComponent, closeModal, onSave, }) {
1250
- const [items, setItems] = useState([]);
1299
+ function ReorderableList({ initialItems, client, itemMap, ButtonComponent, closeModal, onSave, }) {
1300
+ const [items, setItems] = (0, react_1.useState)([]);
1251
1301
  // const [client] = useContext(ClientContext);
1252
- const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, {
1253
- coordinateGetter: sortableKeyboardCoordinates,
1254
- }), useSensor(TouchSensor, {
1302
+ const sensors = (0, core_1.useSensors)((0, core_1.useSensor)(core_1.PointerSensor), (0, core_1.useSensor)(core_1.KeyboardSensor, {
1303
+ coordinateGetter: sortable_1.sortableKeyboardCoordinates,
1304
+ }), (0, core_1.useSensor)(core_1.TouchSensor, {
1255
1305
  activationConstraint: '',
1256
1306
  }));
1257
- useEffect(() => {
1307
+ (0, react_1.useEffect)(() => {
1258
1308
  setItems(initialItems
1259
1309
  .sort((a, b) => {
1260
1310
  if (a.order === undefined && b.order === undefined)
@@ -1275,7 +1325,7 @@ export function ReorderableList({ initialItems, client, itemMap, ButtonComponent
1275
1325
  return;
1276
1326
  }
1277
1327
  try {
1278
- const response = await fetch(`${QUILL_SERVER}/dashorder/`, {
1328
+ const response = await fetch(`${constants_1.QUILL_SERVER}/dashorder/`, {
1279
1329
  method: 'POST',
1280
1330
  headers: {
1281
1331
  'Content-Type': 'application/json',
@@ -1297,7 +1347,7 @@ export function ReorderableList({ initialItems, client, itemMap, ButtonComponent
1297
1347
  console.error(error.message);
1298
1348
  }
1299
1349
  };
1300
- return (_jsxs("div", { children: [_jsx(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, measuring: measuringConfig, children: _jsx(SortableContext, { items: items, strategy: verticalListSortingStrategy, children: _jsxs("div", { style: {
1350
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(core_1.DndContext, { sensors: sensors, collisionDetection: core_1.closestCenter, onDragEnd: handleDragEnd, measuring: measuringConfig, children: (0, jsx_runtime_1.jsx)(sortable_1.SortableContext, { items: items, strategy: sortable_1.verticalListSortingStrategy, children: (0, jsx_runtime_1.jsxs)("div", { style: {
1301
1351
  background: 'white',
1302
1352
  position: 'fixed',
1303
1353
  width: '100%',
@@ -1305,7 +1355,7 @@ export function ReorderableList({ initialItems, client, itemMap, ButtonComponent
1305
1355
  overflowY: 'scroll',
1306
1356
  overflowX: 'hidden',
1307
1357
  maxWidth: 700,
1308
- }, children: [_jsx("div", { style: { height: 80 } }), items.map((id) => (_jsx(SortableItem, { id: id, name: itemMap?.get(id).name }, id))), _jsx("div", { style: { height: 100, width: '100%' } })] }) }) }), _jsx("div", { style: {
1358
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { height: 80 } }), items.map((id) => ((0, jsx_runtime_1.jsx)(SortableItem, { id: id, name: itemMap?.get(id).name }, id))), (0, jsx_runtime_1.jsx)("div", { style: { height: 100, width: '100%' } })] }) }) }), (0, jsx_runtime_1.jsx)("div", { style: {
1309
1359
  height: 80,
1310
1360
  paddingTop: 20,
1311
1361
  width: '100%',
@@ -1314,7 +1364,7 @@ export function ReorderableList({ initialItems, client, itemMap, ButtonComponent
1314
1364
  bottom: -20,
1315
1365
  left: 0,
1316
1366
  right: 0,
1317
- }, children: _jsx(ButtonComponent, { onClick: handleSaveChanges, label: "Save changes" }) })] }));
1367
+ }, children: (0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: handleSaveChanges, label: "Save changes" }) })] }));
1318
1368
  function handleDragEnd(event) {
1319
1369
  const { active, over } = event;
1320
1370
  if (!over?.id || !active?.id) {
@@ -1324,20 +1374,21 @@ export function ReorderableList({ initialItems, client, itemMap, ButtonComponent
1324
1374
  setItems((items) => {
1325
1375
  const oldIndex = items.indexOf(active.id);
1326
1376
  const newIndex = items.indexOf(over.id);
1327
- return arrayMove(items, oldIndex, newIndex);
1377
+ return (0, sortable_1.arrayMove)(items, oldIndex, newIndex);
1328
1378
  });
1329
1379
  }
1330
1380
  }
1331
1381
  }
1332
- const animateLayoutChanges = (args) => args.isSorting || args.wasDragging ? defaultAnimateLayoutChanges(args) : true;
1382
+ exports.ReorderableList = ReorderableList;
1383
+ const animateLayoutChanges = (args) => args.isSorting || args.wasDragging ? (0, sortable_1.defaultAnimateLayoutChanges)(args) : true;
1333
1384
  function SortableItem({ id, name }) {
1334
- const { attributes, listeners, setNodeRef, transform, transition } = useSortable({
1385
+ const { attributes, listeners, setNodeRef, transform, transition } = (0, sortable_1.useSortable)({
1335
1386
  animateLayoutChanges,
1336
1387
  id: id,
1337
1388
  });
1338
1389
  let height = 50;
1339
1390
  const style = {
1340
- transform: CSS.Translate.toString(transform),
1391
+ transform: utilities_1.CSS.Translate.toString(transform),
1341
1392
  transition,
1342
1393
  display: 'flex',
1343
1394
  justifyContent: 'space-between',
@@ -1350,7 +1401,7 @@ function SortableItem({ id, name }) {
1350
1401
  marginBottom: 20,
1351
1402
  background: 'white',
1352
1403
  };
1353
- return (_jsx("div", { ref: setNodeRef, style: style, ...attributes, children: _jsxs("div", { style: {
1404
+ return ((0, jsx_runtime_1.jsx)("div", { ref: setNodeRef, style: style, ...attributes, children: (0, jsx_runtime_1.jsxs)("div", { style: {
1354
1405
  cursor: 'pointer',
1355
1406
  width: '100%',
1356
1407
  display: 'flex',
@@ -1358,7 +1409,7 @@ function SortableItem({ id, name }) {
1358
1409
  alignItems: 'center',
1359
1410
  justifyContent: 'space-between',
1360
1411
  height: 260,
1361
- }, ...listeners, children: [_jsxs("div", { style: {
1412
+ }, ...listeners, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
1362
1413
  display: 'flex',
1363
1414
  flexDirection: 'column',
1364
1415
  justifyContent: 'space-between',
@@ -1366,19 +1417,20 @@ function SortableItem({ id, name }) {
1366
1417
  paddingTop: 20,
1367
1418
  paddingBottom: 20,
1368
1419
  width: '100%',
1369
- }, children: [_jsx("div", { style: {
1420
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1370
1421
  minWidth: 600,
1371
1422
  width: '100%',
1372
1423
  paddingLeft: 20,
1373
1424
  fontSize: 18,
1374
1425
  fontWeight: '500',
1375
- }, children: name }), _jsx(Chart, { chartId: id, containerStyle: {
1426
+ }, children: name }), (0, jsx_runtime_1.jsx)(react_2.Chart, { chartId: id, containerStyle: {
1376
1427
  height: 180,
1377
1428
  width: '100%',
1378
- } })] }), _jsx("div", { style: {
1429
+ } })] }), (0, jsx_runtime_1.jsx)("div", { style: {
1379
1430
  display: 'flex',
1380
1431
  flexDirection: 'column',
1381
1432
  paddingRight: 20,
1382
1433
  paddingLeft: 20,
1383
- }, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "#6D727E", height: 24, width: 24, children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" }) }) })] }) }));
1434
+ }, children: (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "#6D727E", height: 24, width: 24, children: (0, jsx_runtime_1.jsx)("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" }) }) })] }) }));
1384
1435
  }
1436
+ //# sourceMappingURL=Admin.js.map