@quillsql/admin 1.8.7 → 1.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8165,32 +8165,140 @@ import {
8165
8165
  useEffect as useEffect14,
8166
8166
  useState as useState14
8167
8167
  } from "react";
8168
- var AgentChatContext = createContext2(null);
8169
- var WELCOME_MESSAGE = "I'm your Quill BI Agent. I can create dashboards, reports, virtual tables, run queries, and manage environments \u2014 all through conversation.\n\nI'm working in a sandbox copy of your environment, so nothing affects production until you promote your changes.";
8170
- var SESSION_STORAGE_KEY = "quill-agent-session";
8171
- function hydrateSession() {
8168
+
8169
+ // src/utils/sandboxStorage.ts
8170
+ var SANDBOX_STORAGE_KEY = "quill-sandbox-session";
8171
+ var LEGACY_SESSION_STORAGE_KEY = "quill-agent-session";
8172
+ function parsePersistedSandbox(raw) {
8173
+ if (!raw) return null;
8174
+ try {
8175
+ const parsed = JSON.parse(raw);
8176
+ if (parsed?.clerkOrgId && parsed?.sandboxSessionId && parsed?.sandboxClientId && parsed?.session?.sessionId) {
8177
+ return parsed;
8178
+ }
8179
+ } catch {
8180
+ }
8181
+ return null;
8182
+ }
8183
+ function readPersistedSandboxRaw() {
8172
8184
  if (typeof window === "undefined") {
8173
8185
  return null;
8174
8186
  }
8187
+ return parsePersistedSandbox(
8188
+ window.localStorage.getItem(SANDBOX_STORAGE_KEY)
8189
+ );
8190
+ }
8191
+ function readLegacySandboxSession(clerkOrgId) {
8175
8192
  try {
8176
- const raw = window.sessionStorage.getItem(SESSION_STORAGE_KEY);
8177
- if (!raw) return null;
8178
- const parsed = JSON.parse(raw);
8179
- if (parsed?.session?.sessionId && parsed?.session?.sandboxClientId) {
8180
- return parsed.session;
8181
- }
8193
+ const legacyRaw = window.sessionStorage.getItem(LEGACY_SESSION_STORAGE_KEY);
8194
+ if (!legacyRaw) return null;
8195
+ const legacy = JSON.parse(legacyRaw);
8196
+ const session = legacy?.session;
8197
+ if (!session?.sessionId || !session.sandboxClientId) return null;
8198
+ return {
8199
+ clerkOrgId,
8200
+ sandboxParentClientId: session.sourceClientId,
8201
+ sandboxClientId: session.sandboxClientId,
8202
+ sandboxSessionId: session.sessionId,
8203
+ session,
8204
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
8205
+ };
8182
8206
  } catch {
8207
+ return null;
8208
+ }
8209
+ }
8210
+ function resolveSandboxSession(clerkOrgId) {
8211
+ if (typeof window === "undefined") {
8212
+ return null;
8213
+ }
8214
+ const fromLocal = readPersistedSandboxRaw();
8215
+ if (fromLocal) {
8216
+ if (!clerkOrgId || fromLocal.clerkOrgId === clerkOrgId) {
8217
+ return fromLocal;
8218
+ }
8219
+ return null;
8220
+ }
8221
+ if (!clerkOrgId) {
8222
+ return null;
8223
+ }
8224
+ return readLegacySandboxSession(clerkOrgId);
8225
+ }
8226
+ function writeSandboxSession(payload) {
8227
+ if (typeof window === "undefined") return;
8228
+ window.localStorage.setItem(
8229
+ SANDBOX_STORAGE_KEY,
8230
+ JSON.stringify({ ...payload, updatedAt: (/* @__PURE__ */ new Date()).toISOString() })
8231
+ );
8232
+ window.sessionStorage.removeItem(LEGACY_SESSION_STORAGE_KEY);
8233
+ }
8234
+ function clearSandboxSession() {
8235
+ if (typeof window === "undefined") return;
8236
+ window.localStorage.removeItem(SANDBOX_STORAGE_KEY);
8237
+ window.sessionStorage.removeItem(LEGACY_SESSION_STORAGE_KEY);
8238
+ }
8239
+ function clearQuillSandboxStorage() {
8240
+ clearSandboxSession();
8241
+ }
8242
+ function subscribeSandboxSession(onChange) {
8243
+ if (typeof window === "undefined") {
8244
+ return () => {
8245
+ };
8246
+ }
8247
+ const handler = (event) => {
8248
+ if (event.key !== SANDBOX_STORAGE_KEY) return;
8249
+ onChange(parsePersistedSandbox(event.newValue));
8250
+ };
8251
+ window.addEventListener("storage", handler);
8252
+ return () => window.removeEventListener("storage", handler);
8253
+ }
8254
+ function sandboxFieldsFromSession(sessionInfo, resultClient) {
8255
+ return {
8256
+ sandboxParentClientId: String(
8257
+ resultClient?.sandboxParentClientId ?? sessionInfo.sourceClientId
8258
+ ),
8259
+ sandboxClientId: String(sessionInfo.sandboxClientId),
8260
+ sandboxSessionId: String(sessionInfo.sessionId)
8261
+ };
8262
+ }
8263
+ function persistSandboxFromSessionInfo(scopeId, sessionInfo, resultClient) {
8264
+ if (!scopeId) return;
8265
+ const fields = sandboxFieldsFromSession(sessionInfo, resultClient);
8266
+ writeSandboxSession({
8267
+ clerkOrgId: scopeId,
8268
+ ...fields,
8269
+ session: sessionInfo,
8270
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
8271
+ });
8272
+ }
8273
+ function getSandboxStorageScopeId(...candidates) {
8274
+ for (const candidate of candidates) {
8275
+ if (candidate) return candidate;
8183
8276
  }
8184
8277
  return null;
8185
8278
  }
8186
- function useAgentChatRootState() {
8279
+
8280
+ // src/components/AgentChat/AgentChatContext.tsx
8281
+ var AgentChatContext = createContext2(null);
8282
+ var WELCOME_MESSAGE = "I'm your Quill BI Agent. I can create dashboards, reports, virtual tables, run queries, and manage environments \u2014 all through conversation.\n\nI'm working in a sandbox copy of your environment, so nothing affects production until you promote your changes.";
8283
+ function hydrateSessionFromStorage(clerkOrgId) {
8284
+ return resolveSandboxSession(clerkOrgId)?.session ?? null;
8285
+ }
8286
+ function useAgentChatRootState(clerkOrgId) {
8187
8287
  const [messages, setMessages] = useState14([
8188
8288
  { role: "assistant", content: WELCOME_MESSAGE, isWelcome: true }
8189
8289
  ]);
8190
- const [initialSession] = useState14(hydrateSession);
8191
- const [session, setSessionRaw] = useState14(initialSession);
8290
+ const [session, setSessionRaw] = useState14(
8291
+ () => hydrateSessionFromStorage(clerkOrgId)
8292
+ );
8192
8293
  const [showToolOutputs, setShowToolOutputs] = useState14(false);
8193
8294
  const [changelogEntries, setChangelogEntriesState] = useState14([]);
8295
+ useEffect14(() => {
8296
+ if (!clerkOrgId) return;
8297
+ const stored = resolveSandboxSession(clerkOrgId);
8298
+ if (stored?.session) {
8299
+ setSessionRaw((prev) => prev ?? stored.session);
8300
+ }
8301
+ }, [clerkOrgId]);
8194
8302
  const setChangelogEntries = useCallback3((entries) => {
8195
8303
  setChangelogEntriesState(entries);
8196
8304
  }, []);
@@ -8203,17 +8311,6 @@ function useAgentChatRootState() {
8203
8311
  return next;
8204
8312
  });
8205
8313
  }, []);
8206
- useEffect14(() => {
8207
- if (typeof window === "undefined") return;
8208
- if (session) {
8209
- window.sessionStorage.setItem(
8210
- SESSION_STORAGE_KEY,
8211
- JSON.stringify({ session })
8212
- );
8213
- } else {
8214
- window.sessionStorage.removeItem(SESSION_STORAGE_KEY);
8215
- }
8216
- }, [session]);
8217
8314
  return {
8218
8315
  messages,
8219
8316
  setMessages,
@@ -8472,7 +8569,7 @@ function AdminProvider({
8472
8569
  onRequestAddVirtualTable,
8473
8570
  hideEnvDropdown
8474
8571
  }) {
8475
- const agentChatState = useAgentChatRootState();
8572
+ const agentChatState = useAgentChatRootState(clerkOrgId);
8476
8573
  const refreshChangelogRef = useRef10(null);
8477
8574
  const registerChangelogRefresh = useCallback4(
8478
8575
  (fn) => {
@@ -8482,6 +8579,7 @@ function AdminProvider({
8482
8579
  );
8483
8580
  const [clientLoading, setClientLoading] = useState15(true);
8484
8581
  const currentFetchingClientRef = useRef10(void 0);
8582
+ const previousClerkOrgIdRef = useRef10(void 0);
8485
8583
  const [schemaLoading, setSchemaLoading] = useState15(false);
8486
8584
  const [error, setError] = useState15(null);
8487
8585
  const publicKeyRef = useRef10(void 0);
@@ -8556,6 +8654,21 @@ function AdminProvider({
8556
8654
  sandboxSessionId: null
8557
8655
  };
8558
8656
  };
8657
+ const mergeSandboxIntoState = (baseState, orgId) => {
8658
+ const storedSandbox = resolveSandboxSession(
8659
+ orgId ?? clerkOrgId ?? baseState.clerkOrgId
8660
+ );
8661
+ if (!storedSandbox) {
8662
+ return baseState;
8663
+ }
8664
+ return {
8665
+ ...baseState,
8666
+ clerkOrgId: storedSandbox.clerkOrgId || baseState.clerkOrgId,
8667
+ sandboxParentClientId: storedSandbox.sandboxParentClientId,
8668
+ sandboxClientId: storedSandbox.sandboxClientId,
8669
+ sandboxSessionId: storedSandbox.sandboxSessionId
8670
+ };
8671
+ };
8559
8672
  const hydrateStateFromSessionStorage = () => {
8560
8673
  if (typeof window === "undefined") {
8561
8674
  return null;
@@ -8566,7 +8679,8 @@ function AdminProvider({
8566
8679
  );
8567
8680
  if (clerkOrgId && localState?.clerkOrgId === clerkOrgId) {
8568
8681
  const parsedState = parsedSessionStorageAdminState(localState);
8569
- return {
8682
+ const storedSandbox2 = resolveSandboxSession(clerkOrgId);
8683
+ return mergeSandboxIntoState({
8570
8684
  ...parsedState,
8571
8685
  queryEndpoint,
8572
8686
  isSelfHosted: !QUILL_ENDPOINTS.includes(
@@ -8575,10 +8689,14 @@ function AdminProvider({
8575
8689
  queryHeaders: queryHeaders !== void 0 ? queryHeaders : parsedState.queryHeaders,
8576
8690
  withCredentials: withCredentials !== void 0 ? withCredentials : parsedState.withCredentials,
8577
8691
  hideEnvDropdown: hideEnvDropdown !== void 0 ? hideEnvDropdown : parsedState.hideEnvDropdown ?? false,
8578
- sandboxParentClientId: parsedState.sandboxParentClientId ?? null,
8579
- sandboxClientId: parsedState.sandboxClientId ?? null,
8580
- sandboxSessionId: parsedState.sandboxSessionId ?? null
8581
- };
8692
+ sandboxParentClientId: storedSandbox2?.sandboxParentClientId ?? parsedState.sandboxParentClientId ?? null,
8693
+ sandboxClientId: storedSandbox2?.sandboxClientId ?? parsedState.sandboxClientId ?? null,
8694
+ sandboxSessionId: storedSandbox2?.sandboxSessionId ?? parsedState.sandboxSessionId ?? null
8695
+ });
8696
+ }
8697
+ if (clerkOrgId && localState?.clerkOrgId && localState.clerkOrgId !== clerkOrgId) {
8698
+ window.sessionStorage.removeItem("quill-adminState");
8699
+ window.sessionStorage.removeItem("quill-client");
8582
8700
  }
8583
8701
  } catch (error2) {
8584
8702
  console.warn(
@@ -8586,8 +8704,14 @@ function AdminProvider({
8586
8704
  error2
8587
8705
  );
8588
8706
  }
8589
- window.sessionStorage.removeItem("quill-adminState");
8590
- window.sessionStorage.removeItem("quill-client");
8707
+ const storedSandbox = resolveSandboxSession(clerkOrgId);
8708
+ if (storedSandbox) {
8709
+ return mergeSandboxIntoState(buildDefaultState());
8710
+ }
8711
+ const storedWithoutOrg = resolveSandboxSession(null);
8712
+ if (storedWithoutOrg) {
8713
+ return mergeSandboxIntoState(buildDefaultState());
8714
+ }
8591
8715
  return null;
8592
8716
  };
8593
8717
  const initialState = useMemo7(() => {
@@ -8631,7 +8755,12 @@ function AdminProvider({
8631
8755
  return;
8632
8756
  }
8633
8757
  const activeClientId = state.client?._id ?? state.client?.id ?? state.client?.publicKey ?? state.client?.clientId;
8634
- if (!forceRefresh && !resetSandbox && activeClientId != null && String(activeClientId) === String(targetClientId)) {
8758
+ const targetClientIdString = String(targetClientId);
8759
+ const sandboxClientId = state.sandboxClientId ? String(state.sandboxClientId) : null;
8760
+ const sandboxParentClientId = state.sandboxParentClientId ? String(state.sandboxParentClientId) : null;
8761
+ const switchingOutsideSandbox = !!state.sandboxSessionId && targetClientIdString !== sandboxClientId && targetClientIdString !== sandboxParentClientId;
8762
+ const shouldResetSandbox = !!resetSandbox || switchingOutsideSandbox;
8763
+ if (!forceRefresh && !shouldResetSandbox && activeClientId != null && String(activeClientId) === String(targetClientId)) {
8635
8764
  return;
8636
8765
  }
8637
8766
  setClientLoading(true);
@@ -8639,7 +8768,7 @@ function AdminProvider({
8639
8768
  targetClientId,
8640
8769
  false,
8641
8770
  preserveSelectedDashboard,
8642
- resetSandbox
8771
+ shouldResetSandbox
8643
8772
  );
8644
8773
  return;
8645
8774
  }
@@ -8776,11 +8905,15 @@ function AdminProvider({
8776
8905
  setClientLoading(true);
8777
8906
  currentFetchingClientRef.current = publicKey2;
8778
8907
  const requestedClientId = String(publicKey2);
8779
- const sandboxClientId = state.sandboxClientId != null ? String(state.sandboxClientId) : null;
8780
- const sandboxParentClientId = state.sandboxParentClientId != null ? String(state.sandboxParentClientId) : null;
8781
- const loadingExistingSandbox = loadSandbox && !resetSandbox && !!sandboxClientId && (requestedClientId === sandboxClientId || requestedClientId === sandboxParentClientId);
8908
+ const storedSandbox = resolveSandboxSession(clerkOrgId ?? state.clerkOrgId);
8909
+ const sandboxClientId = state.sandboxClientId != null ? String(state.sandboxClientId) : storedSandbox?.sandboxClientId ?? null;
8910
+ const sandboxParentClientId = state.sandboxParentClientId != null ? String(state.sandboxParentClientId) : storedSandbox?.sandboxParentClientId ?? null;
8911
+ const sandboxSessionId = state.sandboxSessionId ?? storedSandbox?.sandboxSessionId ?? null;
8912
+ const loadingExistingSandbox = loadSandbox && !resetSandbox && !!sandboxClientId && !!sandboxSessionId && (requestedClientId === sandboxClientId || requestedClientId === sandboxParentClientId);
8913
+ const requestClientId = loadingExistingSandbox ? sandboxParentClientId ?? publicKey2 : publicKey2;
8782
8914
  if (resetSandbox) {
8783
8915
  agentChatState.clearChangelogEntries();
8916
+ clearSandboxSession();
8784
8917
  }
8785
8918
  try {
8786
8919
  const data = await quillFetchWithToken({
@@ -8788,14 +8921,14 @@ function AdminProvider({
8788
8921
  queryEndpoint,
8789
8922
  queryHeaders,
8790
8923
  withCredentials: !!state.withCredentials,
8791
- clientId: publicKey2
8924
+ clientId: requestClientId
8792
8925
  },
8793
8926
  task: "client",
8794
8927
  metadata: {
8795
- clientId: loadingExistingSandbox ? sandboxParentClientId ?? publicKey2 : publicKey2,
8928
+ clientId: loadingExistingSandbox ? sandboxParentClientId ?? requestClientId : requestClientId,
8796
8929
  fetchDefaultDashboard: true,
8797
8930
  sandboxClientId: loadingExistingSandbox ? sandboxClientId : void 0,
8798
- sandboxSessionId: loadingExistingSandbox ? state.sandboxSessionId ?? void 0 : void 0,
8931
+ sandboxSessionId: loadingExistingSandbox ? sandboxSessionId ?? void 0 : void 0,
8799
8932
  ...loadSandbox ? { loadSandbox: true } : {},
8800
8933
  ...resetSandbox ? { resetSandbox: true } : {}
8801
8934
  },
@@ -8829,11 +8962,11 @@ function AdminProvider({
8829
8962
  queryEndpoint,
8830
8963
  queryHeaders,
8831
8964
  withCredentials: !!state.withCredentials,
8832
- clientId: publicKey2
8965
+ clientId: requestClientId
8833
8966
  },
8834
8967
  task: "clients",
8835
8968
  metadata: {
8836
- clientId: publicKey2
8969
+ clientId: requestClientId
8837
8970
  },
8838
8971
  adminMode: true
8839
8972
  }) : Promise.resolve(void 0)
@@ -8852,9 +8985,48 @@ function AdminProvider({
8852
8985
  });
8853
8986
  }
8854
8987
  const sessionInfo = buildSessionInfo(result, publicKey2);
8855
- agentChatState.setSession(sessionInfo);
8988
+ if (sessionInfo) {
8989
+ agentChatState.setSession(sessionInfo);
8990
+ const sandboxFields = sandboxFieldsFromSession(sessionInfo, result.client);
8991
+ dispatch({
8992
+ type: "SET_SANDBOX_FIELDS",
8993
+ payload: sandboxFields
8994
+ });
8995
+ persistSandboxFromSessionInfo(
8996
+ getSandboxStorageScopeId(
8997
+ clerkOrgId,
8998
+ state.clerkOrgId,
8999
+ publicKey2
9000
+ ),
9001
+ sessionInfo,
9002
+ result.client
9003
+ );
9004
+ } else if (resetSandbox) {
9005
+ agentChatState.setSession(null);
9006
+ dispatch({
9007
+ type: "SET_SANDBOX_FIELDS",
9008
+ payload: {
9009
+ sandboxParentClientId: null,
9010
+ sandboxClientId: null,
9011
+ sandboxSessionId: null
9012
+ }
9013
+ });
9014
+ } else {
9015
+ const preservedSandbox = storedSandbox ?? resolveSandboxSession(clerkOrgId ?? state.clerkOrgId);
9016
+ if (preservedSandbox) {
9017
+ dispatch({
9018
+ type: "SET_SANDBOX_FIELDS",
9019
+ payload: {
9020
+ sandboxParentClientId: preservedSandbox.sandboxParentClientId,
9021
+ sandboxClientId: preservedSandbox.sandboxClientId,
9022
+ sandboxSessionId: preservedSandbox.sandboxSessionId
9023
+ }
9024
+ });
9025
+ agentChatState.setSession((prev) => prev ?? preservedSandbox.session);
9026
+ }
9027
+ }
8856
9028
  if (typeof window !== "undefined" && clerkOrgId) {
8857
- const sourceClientId = sessionInfo?.sourceClientId ?? requestedClientId;
9029
+ const sourceClientId = sessionInfo?.sourceClientId ?? storedSandbox?.sandboxParentClientId ?? requestedClientId;
8858
9030
  window.sessionStorage.setItem(
8859
9031
  "quill-client",
8860
9032
  JSON.stringify({
@@ -8863,16 +9035,6 @@ function AdminProvider({
8863
9035
  })
8864
9036
  );
8865
9037
  }
8866
- dispatch({
8867
- type: "SET_SANDBOX_FIELDS",
8868
- payload: {
8869
- sandboxParentClientId: sessionInfo ? String(
8870
- result.client.sandboxParentClientId ?? sessionInfo.sourceClientId
8871
- ) : null,
8872
- sandboxClientId: sessionInfo?.sandboxClientId ?? null,
8873
- sandboxSessionId: sessionInfo?.sessionId ?? null
8874
- }
8875
- });
8876
9038
  setClient({
8877
9039
  ...result.client,
8878
9040
  queryEndpoint: result.client.queryEndpoint ?? queryEndpoint,
@@ -8942,12 +9104,123 @@ function AdminProvider({
8942
9104
  dispatch({ type: "SET_CLERK_ORG_ID", payload: clerkOrgId });
8943
9105
  }
8944
9106
  }, [clerkOrgId]);
9107
+ useEffect16(() => {
9108
+ const previousClerkOrgId = previousClerkOrgIdRef.current;
9109
+ const currentClerkOrgId = clerkOrgId ?? null;
9110
+ if (previousClerkOrgId !== void 0 && previousClerkOrgId !== currentClerkOrgId) {
9111
+ clearSandboxSession();
9112
+ agentChatState.setSession(null);
9113
+ agentChatState.clearChangelogEntries();
9114
+ dispatch({
9115
+ type: "SET_SANDBOX_FIELDS",
9116
+ payload: {
9117
+ sandboxParentClientId: null,
9118
+ sandboxClientId: null,
9119
+ sandboxSessionId: null
9120
+ }
9121
+ });
9122
+ }
9123
+ previousClerkOrgIdRef.current = currentClerkOrgId;
9124
+ }, [clerkOrgId, agentChatState.setSession, agentChatState.clearChangelogEntries]);
9125
+ useEffect16(() => {
9126
+ if (!clerkOrgId) return;
9127
+ const storedSandbox = resolveSandboxSession(clerkOrgId);
9128
+ if (!storedSandbox) return;
9129
+ if (!state.sandboxSessionId || state.sandboxSessionId !== storedSandbox.sandboxSessionId) {
9130
+ dispatch({
9131
+ type: "SET_SANDBOX_FIELDS",
9132
+ payload: {
9133
+ sandboxParentClientId: storedSandbox.sandboxParentClientId,
9134
+ sandboxClientId: storedSandbox.sandboxClientId,
9135
+ sandboxSessionId: storedSandbox.sandboxSessionId
9136
+ }
9137
+ });
9138
+ }
9139
+ agentChatState.setSession((prev) => prev ?? storedSandbox.session);
9140
+ }, [clerkOrgId]);
9141
+ useEffect16(() => {
9142
+ if (!clerkOrgId) return;
9143
+ return subscribeSandboxSession((stored) => {
9144
+ if (!stored || stored.clerkOrgId !== clerkOrgId) {
9145
+ dispatch({
9146
+ type: "SET_SANDBOX_FIELDS",
9147
+ payload: {
9148
+ sandboxParentClientId: null,
9149
+ sandboxClientId: null,
9150
+ sandboxSessionId: null
9151
+ }
9152
+ });
9153
+ agentChatState.setSession(null);
9154
+ agentChatState.clearChangelogEntries();
9155
+ return;
9156
+ }
9157
+ dispatch({
9158
+ type: "SET_SANDBOX_FIELDS",
9159
+ payload: {
9160
+ sandboxParentClientId: stored.sandboxParentClientId,
9161
+ sandboxClientId: stored.sandboxClientId,
9162
+ sandboxSessionId: stored.sandboxSessionId
9163
+ }
9164
+ });
9165
+ agentChatState.setSession(stored.session);
9166
+ });
9167
+ }, [clerkOrgId, agentChatState.setSession, agentChatState.clearChangelogEntries]);
9168
+ useEffect16(() => {
9169
+ const scopeId = getSandboxStorageScopeId(
9170
+ clerkOrgId,
9171
+ state.clerkOrgId,
9172
+ publicKey
9173
+ );
9174
+ const session = agentChatState.session;
9175
+ const sessionId = session?.sessionId ?? state.sandboxSessionId;
9176
+ const sandboxClientId = session?.sandboxClientId ?? state.sandboxClientId ?? null;
9177
+ const sourceClientId = session?.sourceClientId ?? state.sandboxParentClientId ?? null;
9178
+ if (!scopeId || !sessionId || !sandboxClientId || !sourceClientId) {
9179
+ return;
9180
+ }
9181
+ const sessionPayload = session ?? {
9182
+ sessionId,
9183
+ sourceClientId,
9184
+ sourceClientName: "",
9185
+ sandboxClientId,
9186
+ sandboxClientName: "",
9187
+ status: "active"
9188
+ };
9189
+ persistSandboxFromSessionInfo(scopeId, sessionPayload, {
9190
+ sandboxParentClientId: sourceClientId
9191
+ });
9192
+ }, [
9193
+ clerkOrgId,
9194
+ publicKey,
9195
+ state.clerkOrgId,
9196
+ state.sandboxParentClientId,
9197
+ state.sandboxClientId,
9198
+ state.sandboxSessionId,
9199
+ agentChatState.session
9200
+ ]);
8945
9201
  useEffect16(() => {
8946
9202
  if (typeof window === "undefined") {
8947
9203
  return;
8948
9204
  }
9205
+ const storedSandbox = resolveSandboxSession(clerkOrgId ?? state.clerkOrgId);
9206
+ if (storedSandbox) {
9207
+ if (!state.sandboxSessionId || state.sandboxSessionId !== storedSandbox.sandboxSessionId) {
9208
+ dispatch({
9209
+ type: "SET_SANDBOX_FIELDS",
9210
+ payload: {
9211
+ sandboxParentClientId: storedSandbox.sandboxParentClientId,
9212
+ sandboxClientId: storedSandbox.sandboxClientId,
9213
+ sandboxSessionId: storedSandbox.sandboxSessionId
9214
+ }
9215
+ });
9216
+ }
9217
+ agentChatState.setSession((prev) => prev ?? storedSandbox.session);
9218
+ }
8949
9219
  if (publicKeyRef.current !== publicKey) {
8950
- dispatch({ type: "SET_ALL_STATE", payload: initialState });
9220
+ dispatch({
9221
+ type: "SET_ALL_STATE",
9222
+ payload: storedSandbox ? mergeSandboxIntoState(initialState, clerkOrgId) : initialState
9223
+ });
8951
9224
  publicKeyRef.current = publicKey;
8952
9225
  }
8953
9226
  const client = JSON.parse(
@@ -8957,8 +9230,7 @@ function AdminProvider({
8957
9230
  if (client && client.clerkOrgId === clerkOrgId) {
8958
9231
  overridePublicKey = client.id || client._id || client.publicKey;
8959
9232
  }
8960
- const hydratedClientId = state.sandboxParentClientId || state.client?.id || state.client?._id || state.client?.clientId || state.client?.publicKey;
8961
- const fetchPublicKey = overridePublicKey || hydratedClientId || publicKey;
9233
+ const fetchPublicKey = overridePublicKey || storedSandbox?.sandboxParentClientId || state.sandboxParentClientId || state.client?.id || state.client?._id || state.client?.clientId || state.client?.publicKey || publicKey;
8962
9234
  if (!fetchPublicKey) {
8963
9235
  setClientLoading(false);
8964
9236
  currentFetchingClientRef.current = void 0;
@@ -8966,7 +9238,7 @@ function AdminProvider({
8966
9238
  if (currentFetchingClientRef.current === fetchPublicKey) return;
8967
9239
  fetchClient(fetchPublicKey, true);
8968
9240
  }
8969
- }, [publicKey]);
9241
+ }, [publicKey, clerkOrgId]);
8970
9242
  useEffect16(() => {
8971
9243
  if (typeof window === "undefined") {
8972
9244
  return;
@@ -9233,7 +9505,7 @@ async function getClientTenantIds({
9233
9505
  // src/public_components/DashboardManager.tsx
9234
9506
  import { useCallback as useCallback10, useEffect as useEffect33, useRef as useRef25, useState as useState37 } from "react";
9235
9507
  import {
9236
- useDashboardInternal as useDashboardInternal5,
9508
+ useDashboardInternal as useDashboardInternal6,
9237
9509
  useDashboards as useDashboards5
9238
9510
  } from "@quillsql/react";
9239
9511
 
@@ -21327,6 +21599,7 @@ function EditEnvironmentModal({
21327
21599
  state,
21328
21600
  dispatch,
21329
21601
  refreshClientsList,
21602
+ setClient,
21330
21603
  getToken,
21331
21604
  quillFetchWithToken,
21332
21605
  eventTracking
@@ -21338,6 +21611,12 @@ function EditEnvironmentModal({
21338
21611
  const [isSubmitTenantLoading, setSubmitTenantLoading] = useState28(false);
21339
21612
  const [isSaveEnvironmentLoading, setIsSaveEnvironmentLoading] = useState28(false);
21340
21613
  const [isDeleteEnvironmentLoading, setIsDeleteEnvironmentLoading] = useState28(false);
21614
+ const [isCreateChildEnvironmentLoading, setIsCreateChildEnvironmentLoading] = useState28(false);
21615
+ const [
21616
+ isPromoteChildEnvironmentLoading,
21617
+ setIsPromoteChildEnvironmentLoading
21618
+ ] = useState28(false);
21619
+ const [developmentEnvironmentConfirm, setDevelopmentEnvironmentConfirm] = useState28(null);
21341
21620
  const [validationError, setValidationError] = useState28(
21342
21621
  void 0
21343
21622
  );
@@ -21345,6 +21624,26 @@ function EditEnvironmentModal({
21345
21624
  const connectionDetails = useMemo14(() => {
21346
21625
  return getDatabaseConnectionFormat(state.client?.databaseType || "");
21347
21626
  }, [state.client?.databaseType]);
21627
+ const sourceClientId = useMemo14(() => {
21628
+ if (state.sandboxParentClientId != null) {
21629
+ return String(state.sandboxParentClientId);
21630
+ }
21631
+ return clientRecordId(state.client);
21632
+ }, [state.sandboxParentClientId, state.client]);
21633
+ const relatedChildEnvironments = useMemo14(() => {
21634
+ const parentClientId = state.client?.sandboxParentClientId != null ? String(state.client.sandboxParentClientId) : sourceClientId;
21635
+ if (!parentClientId) return [];
21636
+ return state.clients.filter(
21637
+ (c2) => c2.sandboxParentClientId != null && String(c2.sandboxParentClientId) === parentClientId
21638
+ );
21639
+ }, [state.clients, state.client?.sandboxParentClientId, sourceClientId]);
21640
+ const sourceEnvironmentName = useMemo14(() => {
21641
+ if (!sourceClientId) return state.client?.name;
21642
+ const sourceClient = state.clients.find(
21643
+ (c2) => clientRecordId(c2) === sourceClientId
21644
+ );
21645
+ return sourceClient?.name ?? state.client?.name;
21646
+ }, [sourceClientId, state.clients, state.client?.name]);
21348
21647
  const [tenantToEdit, setTenantToEdit] = useState28(
21349
21648
  void 0
21350
21649
  );
@@ -21743,6 +22042,104 @@ function EditEnvironmentModal({
21743
22042
  setFetchSchemasLoading(false);
21744
22043
  }
21745
22044
  };
22045
+ const handleCreateChildEnvironment = async () => {
22046
+ if (!sourceClientId) return;
22047
+ setDevelopmentEnvironmentConfirm(null);
22048
+ setIsCreateChildEnvironmentLoading(true);
22049
+ try {
22050
+ const response = await quillFetchWithToken({
22051
+ client: {
22052
+ queryEndpoint: state.queryEndpoint,
22053
+ clientId: sourceClientId,
22054
+ withCredentials: !!state.withCredentials,
22055
+ queryHeaders: state.queryHeaders
22056
+ },
22057
+ task: "create-sandbox",
22058
+ metadata: {
22059
+ clientId: sourceClientId,
22060
+ permanentSandbox: true
22061
+ },
22062
+ adminMode: true
22063
+ });
22064
+ if (response.status === "error") {
22065
+ throw new Error(response.error);
22066
+ }
22067
+ await refreshClientsList(sourceClientId);
22068
+ } catch (e2) {
22069
+ eventTracking?.logError?.({
22070
+ type: "bug",
22071
+ // TODO: determine type
22072
+ severity: "high",
22073
+ message: "Error creating child environment",
22074
+ errorMessage: e2.message,
22075
+ errorStack: e2.stack,
22076
+ errorData: {
22077
+ caller: "EditEnvironmentModal",
22078
+ function: "handleCreateChildEnvironment"
22079
+ }
22080
+ });
22081
+ setValidationError(e2.message);
22082
+ } finally {
22083
+ setIsCreateChildEnvironmentLoading(false);
22084
+ }
22085
+ };
22086
+ const handlePromoteChildEnvironment = async () => {
22087
+ if (developmentEnvironmentConfirm?.action !== "promote") return;
22088
+ const childEnvironmentToPromote = developmentEnvironmentConfirm.environment;
22089
+ const promoteClientId = clientRecordId(childEnvironmentToPromote);
22090
+ if (!promoteClientId) {
22091
+ setValidationError("Cannot promote: missing target environment id.");
22092
+ return;
22093
+ }
22094
+ setDevelopmentEnvironmentConfirm(null);
22095
+ setIsPromoteChildEnvironmentLoading(true);
22096
+ try {
22097
+ const response = await quillFetchWithToken({
22098
+ client: {
22099
+ queryEndpoint: state.queryEndpoint,
22100
+ clientId: promoteClientId,
22101
+ withCredentials: !!state.withCredentials,
22102
+ queryHeaders: state.queryHeaders
22103
+ },
22104
+ task: "promote",
22105
+ metadata: {
22106
+ clientId: promoteClientId,
22107
+ forcePromote: true
22108
+ },
22109
+ adminMode: true
22110
+ });
22111
+ if (response.status === "error" || response.error) {
22112
+ throw new Error(response.error);
22113
+ }
22114
+ const hasActiveSandbox = state.sandboxSessionId != null || state.sandboxClientId != null;
22115
+ if (hasActiveSandbox && sourceClientId) {
22116
+ setClient(
22117
+ { clientId: sourceClientId },
22118
+ true,
22119
+ true,
22120
+ true
22121
+ );
22122
+ }
22123
+ await refreshClientsList(sourceClientId);
22124
+ setIsOpen(false);
22125
+ } catch (e2) {
22126
+ eventTracking?.logError?.({
22127
+ type: "bug",
22128
+ // TODO: determine type
22129
+ severity: "high",
22130
+ message: "Error promoting child environment",
22131
+ errorMessage: e2.message,
22132
+ errorStack: e2.stack,
22133
+ errorData: {
22134
+ caller: "EditEnvironmentModal",
22135
+ function: "handlePromoteChildEnvironment"
22136
+ }
22137
+ });
22138
+ setValidationError(e2.message);
22139
+ } finally {
22140
+ setIsPromoteChildEnvironmentLoading(false);
22141
+ }
22142
+ };
21746
22143
  const handleDeleteEnvironment = async () => {
21747
22144
  if (state.clients.length === 1) {
21748
22145
  alert("You cannot delete the only environment");
@@ -21789,8 +22186,9 @@ function EditEnvironmentModal({
21789
22186
  }
21790
22187
  }
21791
22188
  };
21792
- const isEnvironmentModalLoading = isDeleteEnvironmentLoading || isSaveEnvironmentLoading;
21793
- const environmentLoadingLabel = isDeleteEnvironmentLoading ? "Deleting environment..." : "Saving environment...";
22189
+ const isEnvironmentModalLoading = isDeleteEnvironmentLoading || isSaveEnvironmentLoading || isCreateChildEnvironmentLoading || isPromoteChildEnvironmentLoading;
22190
+ const environmentLoadingLabel = isDeleteEnvironmentLoading ? "Deleting environment..." : isCreateChildEnvironmentLoading ? "Creating child environment..." : isPromoteChildEnvironmentLoading ? "Promoting environment..." : "Saving environment...";
22191
+ const isDevelopmentEnvironmentConfirmLoading = developmentEnvironmentConfirm?.action === "promote" ? isPromoteChildEnvironmentLoading : isCreateChildEnvironmentLoading;
21794
22192
  return /* @__PURE__ */ jsxs37(Fragment13, { children: [
21795
22193
  /* @__PURE__ */ jsx52(
21796
22194
  ModalComponent,
@@ -21803,6 +22201,9 @@ function EditEnvironmentModal({
21803
22201
  setSelectedEnvironmentName(state.client.name);
21804
22202
  setIsSaveEnvironmentLoading(false);
21805
22203
  setIsDeleteEnvironmentLoading(false);
22204
+ setIsCreateChildEnvironmentLoading(false);
22205
+ setIsPromoteChildEnvironmentLoading(false);
22206
+ setDevelopmentEnvironmentConfirm(null);
21806
22207
  },
21807
22208
  style: {
21808
22209
  minWidth: "600px"
@@ -21973,38 +22374,115 @@ function EditEnvironmentModal({
21973
22374
  disabled: isEnvironmentModalLoading
21974
22375
  }
21975
22376
  ) }),
21976
- /* @__PURE__ */ jsxs37(Fragment13, { children: [
21977
- /* @__PURE__ */ jsx52(CardSection, { children: "Danger Zone" }),
21978
- /* @__PURE__ */ jsxs37(
21979
- "div",
21980
- {
21981
- style: {
21982
- display: "flex",
21983
- flexDirection: "column",
21984
- width: "fit-content",
21985
- gap: 16
21986
- },
21987
- children: [
21988
- /* @__PURE__ */ jsx52(
21989
- SecondaryButtonComponent,
21990
- {
21991
- onClick: () => setIsConnectDatabaseModalOpen(true),
21992
- label: "Edit Database Connection",
21993
- disabled: isEnvironmentModalLoading
21994
- }
21995
- ),
21996
- /* @__PURE__ */ jsx52(
21997
- SecondaryButtonComponent,
21998
- {
21999
- onClick: handleDeleteEnvironment,
22000
- label: "Delete Environment",
22001
- disabled: isEnvironmentModalLoading
22002
- }
22003
- )
22004
- ]
22005
- }
22006
- )
22007
- ] }),
22377
+ /* @__PURE__ */ jsx52(CardSection, { children: "Danger Zone" }),
22378
+ /* @__PURE__ */ jsxs37(
22379
+ "div",
22380
+ {
22381
+ style: {
22382
+ display: "flex",
22383
+ flexDirection: "column",
22384
+ width: "fit-content",
22385
+ gap: 16
22386
+ },
22387
+ children: [
22388
+ /* @__PURE__ */ jsx52(
22389
+ SecondaryButtonComponent,
22390
+ {
22391
+ onClick: () => setIsConnectDatabaseModalOpen(true),
22392
+ label: "Edit Database Connection",
22393
+ disabled: isEnvironmentModalLoading
22394
+ }
22395
+ ),
22396
+ /* @__PURE__ */ jsx52(
22397
+ SecondaryButtonComponent,
22398
+ {
22399
+ onClick: handleDeleteEnvironment,
22400
+ label: "Delete Environment",
22401
+ disabled: isEnvironmentModalLoading
22402
+ }
22403
+ )
22404
+ ]
22405
+ }
22406
+ ),
22407
+ /* @__PURE__ */ jsx52(CardSection, { children: "Development Environments" }),
22408
+ /* @__PURE__ */ jsxs37(
22409
+ "div",
22410
+ {
22411
+ style: {
22412
+ display: "flex",
22413
+ flexDirection: "column",
22414
+ width: "fit-content",
22415
+ gap: 16
22416
+ },
22417
+ children: [
22418
+ relatedChildEnvironments.length > 0 && /* @__PURE__ */ jsx52(
22419
+ "table",
22420
+ {
22421
+ style: {
22422
+ borderCollapse: "collapse",
22423
+ width: "100%",
22424
+ minWidth: 280,
22425
+ fontFamily: state.theme.fontFamily,
22426
+ fontSize: 14,
22427
+ color: state.theme.primaryTextColor
22428
+ },
22429
+ children: /* @__PURE__ */ jsx52("tbody", { children: relatedChildEnvironments.map((env) => {
22430
+ const envId = clientRecordId(env);
22431
+ const cellBorder = `1px solid ${state.theme.borderColor ?? "#e7e7e7"}`;
22432
+ return /* @__PURE__ */ jsxs37("tr", { children: [
22433
+ /* @__PURE__ */ jsx52(
22434
+ "td",
22435
+ {
22436
+ style: {
22437
+ border: cellBorder,
22438
+ padding: "8px 12px",
22439
+ fontWeight: 500
22440
+ },
22441
+ children: env.name
22442
+ }
22443
+ ),
22444
+ /* @__PURE__ */ jsx52(
22445
+ "td",
22446
+ {
22447
+ style: {
22448
+ border: cellBorder,
22449
+ padding: "8px 12px",
22450
+ width: 1,
22451
+ whiteSpace: "nowrap"
22452
+ },
22453
+ children: /* @__PURE__ */ jsx52(
22454
+ ButtonComponent,
22455
+ {
22456
+ label: "Promote",
22457
+ onClick: () => setDevelopmentEnvironmentConfirm({
22458
+ action: "promote",
22459
+ environment: env
22460
+ }),
22461
+ disabled: isEnvironmentModalLoading || developmentEnvironmentConfirm != null,
22462
+ style: {
22463
+ height: 32,
22464
+ paddingLeft: 12,
22465
+ paddingRight: 12
22466
+ }
22467
+ }
22468
+ )
22469
+ }
22470
+ )
22471
+ ] }, envId ?? env.name);
22472
+ }) })
22473
+ }
22474
+ ),
22475
+ /* @__PURE__ */ jsx52("div", { children: /* @__PURE__ */ jsx52(
22476
+ SecondaryButtonComponent,
22477
+ {
22478
+ onClick: () => setDevelopmentEnvironmentConfirm({ action: "create" }),
22479
+ label: "+ Create New",
22480
+ disabled: isEnvironmentModalLoading
22481
+ }
22482
+ ) })
22483
+ ]
22484
+ }
22485
+ ),
22008
22486
  /* @__PURE__ */ jsx52("div", { style: { height: 18 } }),
22009
22487
  /* @__PURE__ */ jsxs37(
22010
22488
  "div",
@@ -22243,6 +22721,117 @@ function EditEnvironmentModal({
22243
22721
  )
22244
22722
  }
22245
22723
  ),
22724
+ /* @__PURE__ */ jsx52(
22725
+ ModalComponent,
22726
+ {
22727
+ isOpen: developmentEnvironmentConfirm != null,
22728
+ onClose: () => {
22729
+ if (isDevelopmentEnvironmentConfirmLoading) return;
22730
+ setDevelopmentEnvironmentConfirm(null);
22731
+ },
22732
+ style: {
22733
+ width: 480
22734
+ },
22735
+ children: /* @__PURE__ */ jsxs37(
22736
+ "div",
22737
+ {
22738
+ style: {
22739
+ display: "flex",
22740
+ flexDirection: "column",
22741
+ gap: 20,
22742
+ width: "100%",
22743
+ padding: 24
22744
+ },
22745
+ children: [
22746
+ /* @__PURE__ */ jsx52(CardSection, { children: developmentEnvironmentConfirm?.action === "promote" ? "Promote Environment Changes" : "Create child environment" }),
22747
+ /* @__PURE__ */ jsxs37(
22748
+ "div",
22749
+ {
22750
+ style: {
22751
+ display: "flex",
22752
+ flexDirection: "column",
22753
+ gap: 12,
22754
+ fontFamily: state.theme.fontFamily,
22755
+ fontSize: 14,
22756
+ lineHeight: 1.6,
22757
+ color: state.theme.primaryTextColor
22758
+ },
22759
+ children: [
22760
+ developmentEnvironmentConfirm?.action === "promote" ? /* @__PURE__ */ jsxs37("p", { style: { margin: 0 }, children: [
22761
+ "Promoting",
22762
+ " ",
22763
+ /* @__PURE__ */ jsxs37("strong", { children: [
22764
+ developmentEnvironmentConfirm.environment?.name ?? "this environment",
22765
+ "\xA0into\xA0",
22766
+ sourceEnvironmentName ?? "the current environment"
22767
+ ] }),
22768
+ " ",
22769
+ "will replicate the development environment's state into the current environment."
22770
+ ] }) : /* @__PURE__ */ jsxs37("p", { style: { margin: 0 }, children: [
22771
+ "Creating a child development environment for",
22772
+ " ",
22773
+ /* @__PURE__ */ jsx52("strong", { children: sourceEnvironmentName ?? "the current environment" }),
22774
+ " ",
22775
+ "will create an environment you can use to preview changes before promoting them into the currently active environment."
22776
+ ] }),
22777
+ /* @__PURE__ */ jsx52(
22778
+ "p",
22779
+ {
22780
+ style: {
22781
+ margin: 0,
22782
+ padding: "12px 14px",
22783
+ borderRadius: 6,
22784
+ border: `1px solid ${state.theme.borderColor ?? "#e7e7e7"}`,
22785
+ backgroundColor: state.theme.hoverBackgroundColor ?? "#f7f7f7",
22786
+ color: "#DC2626"
22787
+ },
22788
+ children: "This is not a sandbox operation and will immediately apply to the live environment. Your current active session will be discarded."
22789
+ }
22790
+ )
22791
+ ]
22792
+ }
22793
+ ),
22794
+ /* @__PURE__ */ jsxs37(
22795
+ "div",
22796
+ {
22797
+ style: {
22798
+ display: "flex",
22799
+ flexDirection: "row",
22800
+ justifyContent: "flex-end",
22801
+ gap: 16,
22802
+ width: "100%"
22803
+ },
22804
+ children: [
22805
+ /* @__PURE__ */ jsx52(
22806
+ SecondaryButtonComponent,
22807
+ {
22808
+ label: "Cancel",
22809
+ onClick: () => setDevelopmentEnvironmentConfirm(null),
22810
+ disabled: isDevelopmentEnvironmentConfirmLoading
22811
+ }
22812
+ ),
22813
+ /* @__PURE__ */ jsx52(
22814
+ ButtonComponent,
22815
+ {
22816
+ label: "Confirm",
22817
+ onClick: () => {
22818
+ if (developmentEnvironmentConfirm?.action === "promote") {
22819
+ handlePromoteChildEnvironment();
22820
+ } else if (developmentEnvironmentConfirm?.action === "create") {
22821
+ handleCreateChildEnvironment();
22822
+ }
22823
+ },
22824
+ disabled: isDevelopmentEnvironmentConfirmLoading
22825
+ }
22826
+ )
22827
+ ]
22828
+ }
22829
+ )
22830
+ ]
22831
+ }
22832
+ )
22833
+ }
22834
+ ),
22246
22835
  /* @__PURE__ */ jsx52(
22247
22836
  ModalComponent,
22248
22837
  {
@@ -22814,7 +23403,7 @@ function ReportCodeDetail({
22814
23403
 
22815
23404
  // src/modals/SavedQueriesModal.tsx
22816
23405
  import { useCallback as useCallback8, useEffect as useEffect29, useMemo as useMemo16, useRef as useRef20, useState as useState31 } from "react";
22817
- import { DashboardLegacy as DashboardLegacy2 } from "@quillsql/react";
23406
+ import { DashboardLegacy as DashboardLegacy2, useDashboardInternal as useDashboardInternal4 } from "@quillsql/react";
22818
23407
  import { Highlight as Highlight4, themes as themes4 } from "prism-react-renderer";
22819
23408
  import { jsx as jsx55, jsxs as jsxs40 } from "react/jsx-runtime";
22820
23409
  import { createElement as createElement4 } from "react";
@@ -22920,7 +23509,8 @@ function SavedQueriesModal({
22920
23509
  ) });
22921
23510
  }
22922
23511
  function SavedQueryTile({ report }) {
22923
- const { state, dispatch, getToken } = useAdmin();
23512
+ const { state, dispatch, getToken, eventTracking } = useAdmin();
23513
+ const { reload } = useDashboardInternal4(SAVED_QUERIES_DASHBOARD);
22924
23514
  useEffect29(() => {
22925
23515
  async function getIsOpenableByReportBuilder() {
22926
23516
  const hello = await parseQuillReportToQuillReportInternal(
@@ -22945,6 +23535,14 @@ function SavedQueryTile({ report }) {
22945
23535
  payload: report?.queryString
22946
23536
  });
22947
23537
  };
23538
+ const handleDelete = async () => {
23539
+ if (await deleteReport(report.id, state, getToken, eventTracking)) {
23540
+ reload(SAVED_QUERIES_DASHBOARD, true, {
23541
+ report: { id: report.id },
23542
+ action: "delete"
23543
+ });
23544
+ }
23545
+ };
22948
23546
  if (!report.queryString) {
22949
23547
  return null;
22950
23548
  }
@@ -22978,7 +23576,8 @@ function SavedQueryTile({ report }) {
22978
23576
  label: "Open in SQL Editor \u2197",
22979
23577
  onClick: handleOpenReportInSQLEditor
22980
23578
  }
22981
- )
23579
+ ),
23580
+ /* @__PURE__ */ jsx55(SecondaryButtonPrimitive_default, { label: "Delete", onClick: handleDelete })
22982
23581
  ]
22983
23582
  }
22984
23583
  );
@@ -23050,7 +23649,7 @@ import {
23050
23649
  } from "react";
23051
23650
  import {
23052
23651
  Chart as Chart2,
23053
- useDashboardInternal as useDashboardInternal4,
23652
+ useDashboardInternal as useDashboardInternal5,
23054
23653
  useAllReports
23055
23654
  } from "@quillsql/react";
23056
23655
  import equal2 from "fast-deep-equal";
@@ -23802,7 +24401,7 @@ var InternalDashboard = ({
23802
24401
  dashboardFilters: populatedDashboardFilters,
23803
24402
  reload,
23804
24403
  setSectionOrder
23805
- } = useDashboardInternal4(
24404
+ } = useDashboardInternal5(
23806
24405
  name,
23807
24406
  filters?.map((f) => convertCustomFilter(f)) ?? []
23808
24407
  // .concat(
@@ -26520,8 +27119,39 @@ function DashboardSelectPopover({
26520
27119
  import { useEffect as useEffect32, useRef as useRef23, useState as useState35 } from "react";
26521
27120
  import { Resizable as Resizable2 } from "re-resizable";
26522
27121
 
27122
+ // src/hooks/useSandboxSession.ts
27123
+ import { useMemo as useMemo20 } from "react";
27124
+ function useSandboxSession() {
27125
+ const { state } = useAdmin();
27126
+ const { session } = useAgentChat();
27127
+ return useMemo20(() => {
27128
+ const sessionId = session?.sessionId ?? state.sandboxSessionId ?? null;
27129
+ const sandboxClientId = session?.sandboxClientId ?? state.sandboxClientId ?? null;
27130
+ const sourceClientId = session?.sourceClientId ?? state.sandboxParentClientId ?? null;
27131
+ const mergedSession = session ?? (sessionId && sandboxClientId && sourceClientId ? {
27132
+ sessionId,
27133
+ sourceClientId,
27134
+ sourceClientName: "",
27135
+ sandboxClientId,
27136
+ sandboxClientName: "",
27137
+ status: "active"
27138
+ } : null);
27139
+ return {
27140
+ sessionId,
27141
+ sandboxClientId,
27142
+ sourceClientId,
27143
+ session: mergedSession
27144
+ };
27145
+ }, [
27146
+ session,
27147
+ state.sandboxSessionId,
27148
+ state.sandboxClientId,
27149
+ state.sandboxParentClientId
27150
+ ]);
27151
+ }
27152
+
26523
27153
  // src/components/AgentChat/AgentChat.tsx
26524
- import { memo as memo2, useEffect as useEffect31, useMemo as useMemo20, useRef as useRef22, useState as useState34 } from "react";
27154
+ import { memo as memo2, useEffect as useEffect31, useMemo as useMemo21, useRef as useRef22, useState as useState34 } from "react";
26525
27155
 
26526
27156
  // src/components/AgentChat/agentChatMarkdownCss.ts
26527
27157
  var AGENT_CHAT_MARKDOWN_STYLE_ID = "quillsql-agent-chat-markdown";
@@ -27508,7 +28138,7 @@ function AgentChat({
27508
28138
  const { schema: allTableData } = useDatabaseSchema();
27509
28139
  const { allReportsById } = useAllReports2();
27510
28140
  const { data: virtualTables } = useVirtualTables();
27511
- const changelogDiffs = useMemo20(
28141
+ const changelogDiffs = useMemo21(
27512
28142
  () => changelogEntries.flatMap((entry) => {
27513
28143
  const diff = parseDiffEntry(entry);
27514
28144
  return diff ? [diff] : [];
@@ -27592,6 +28222,7 @@ function AgentChat({
27592
28222
  setMessages((prev) => prev.filter((m3) => m3.isWelcome));
27593
28223
  setSession(null);
27594
28224
  clearChangelogEntries();
28225
+ clearSandboxSession();
27595
28226
  const activeClientId = getActiveClientId(state.client);
27596
28227
  const sourceId = sourceClientId || state.sandboxParentClientId || activeClientId || null;
27597
28228
  if (!sourceId) return;
@@ -28339,14 +28970,17 @@ function AgentChatPanel() {
28339
28970
  const {
28340
28971
  messages,
28341
28972
  setMessages,
28342
- session,
28343
28973
  setSession,
28344
28974
  showToolOutputs,
28345
28975
  setShowToolOutputs,
28346
28976
  clearChangelogEntries
28347
28977
  } = useAgentChat();
28348
- const sourceClientId = state.sandboxParentClientId;
28349
- const sandboxClientId = state.sandboxClientId ?? session?.sandboxClientId ?? null;
28978
+ const {
28979
+ sessionId,
28980
+ sandboxClientId,
28981
+ sourceClientId,
28982
+ session
28983
+ } = useSandboxSession();
28350
28984
  const [collapsed, setCollapsed] = useState35(false);
28351
28985
  const minWidth = typeof window !== "undefined" ? Math.max(DEFAULT_MIN_WIDTH, window.innerWidth * DEFAULT_WIDTH_FRACTION) : 480;
28352
28986
  const [width, setWidth] = useState35(
@@ -28364,13 +28998,20 @@ function AgentChatPanel() {
28364
28998
  if (!prev || !clientId || prev === clientId) return;
28365
28999
  if (sandboxClientId && clientId === sandboxClientId) return;
28366
29000
  if (sourceClientId && clientId === sourceClientId) return;
29001
+ if (state.sandboxSessionId && (clientId === state.sandboxClientId || clientId === state.sandboxParentClientId)) {
29002
+ return;
29003
+ }
28367
29004
  setMessages((prev2) => prev2.filter((m3) => m3.isWelcome));
28368
29005
  setSession(null);
28369
29006
  clearChangelogEntries();
29007
+ clearSandboxSession();
28370
29008
  }, [
28371
29009
  clientId,
28372
29010
  sandboxClientId,
28373
29011
  sourceClientId,
29012
+ state.sandboxSessionId,
29013
+ state.sandboxClientId,
29014
+ state.sandboxParentClientId,
28374
29015
  setMessages,
28375
29016
  setSession,
28376
29017
  clearChangelogEntries
@@ -28670,9 +29311,9 @@ function AgentChatPanel() {
28670
29311
  children: clientId && /* @__PURE__ */ jsx63(
28671
29312
  AgentChat,
28672
29313
  {
28673
- agentSessionId: session?.sessionId ?? "",
29314
+ agentSessionId: sessionId ?? "",
28674
29315
  sandboxClientId: sandboxClientId ?? "",
28675
- sourceClientId: session?.sourceClientId ?? sourceClientId ?? "",
29316
+ sourceClientId: sourceClientId ?? "",
28676
29317
  getToken: async () => await getToken() || ""
28677
29318
  }
28678
29319
  )
@@ -28835,7 +29476,7 @@ function DashboardManager({
28835
29476
  },
28836
29477
  [dispatch]
28837
29478
  );
28838
- const { data: dashboardConfig, reload: reloadDashboard } = useDashboardInternal5(state.selectedDashboard, userFilters);
29479
+ const { data: dashboardConfig, reload: reloadDashboard } = useDashboardInternal6(state.selectedDashboard, userFilters);
28839
29480
  const { dashboards, isLoading: dashboardsLoading } = useDashboards5();
28840
29481
  useLongLoading(dashboardsLoading, {
28841
29482
  origin: "DashboardManager",
@@ -29605,7 +30246,7 @@ function DashboardManager({
29605
30246
  import {
29606
30247
  useCallback as useCallback11,
29607
30248
  useEffect as useEffect35,
29608
- useMemo as useMemo22,
30249
+ useMemo as useMemo23,
29609
30250
  useRef as useRef27,
29610
30251
  useState as useState39
29611
30252
  } from "react";
@@ -29616,7 +30257,7 @@ import {
29616
30257
  Table as Table3,
29617
30258
  SchemaListComponent as SchemaListComponent2
29618
30259
  } from "@quillsql/react";
29619
- import { useEffect as useEffect34, useMemo as useMemo21, useRef as useRef26, useState as useState38 } from "react";
30260
+ import { useEffect as useEffect34, useMemo as useMemo22, useRef as useRef26, useState as useState38 } from "react";
29620
30261
 
29621
30262
  // src/modals/TenantFieldModal.tsx
29622
30263
  import { Fragment as Fragment21, jsx as jsx67, jsxs as jsxs52 } from "react/jsx-runtime";
@@ -29893,7 +30534,7 @@ function CreateEditVirtualTable({
29893
30534
  override
29894
30535
  );
29895
30536
  };
29896
- const dashboardOwnerTenants = useMemo21(() => {
30537
+ const dashboardOwnerTenants = useMemo22(() => {
29897
30538
  return client.allTenantTypes?.filter((t2) => client.ownerTenantFields?.includes(t2.tenantField)).filter((t2) => t2.tenantField !== SINGLE_TENANT);
29898
30539
  }, [client.ownerTenantFields, client.allTenantTypes]);
29899
30540
  useEffect34(() => {
@@ -30436,7 +31077,7 @@ ${duplicateColumns.join("\n")}`
30436
31077
  }
30437
31078
 
30438
31079
  // src/utils/dataEditor.tsx
30439
- var editVirtualTable = async (editName, editViewQuery, editViewId, customFieldInfo, state, ownerTenantFields, getToken, noCustomerField) => {
31080
+ var editVirtualTable = async (editName, editViewQuery, editViewId, description, customFieldInfo, state, ownerTenantFields, getToken, noCustomerField) => {
30440
31081
  if (!editName.length) {
30441
31082
  alert("Please enter a table name.");
30442
31083
  return;
@@ -30462,6 +31103,7 @@ var editVirtualTable = async (editName, editViewQuery, editViewId, customFieldIn
30462
31103
  name: editName,
30463
31104
  customFieldInfo,
30464
31105
  id: editViewId,
31106
+ description,
30465
31107
  clientId: state.client._id,
30466
31108
  runQueryConfig: { getColumns: true },
30467
31109
  databaseType: state.client.databaseType,
@@ -30472,7 +31114,7 @@ var editVirtualTable = async (editName, editViewQuery, editViewId, customFieldIn
30472
31114
  getToken
30473
31115
  });
30474
31116
  };
30475
- var addVirtualTable = async (name, editViewQuery, customFieldInfo, state, ownerTenantFields, getToken, noCustomerField) => {
31117
+ var addVirtualTable = async (name, editViewQuery, description, customFieldInfo, state, ownerTenantFields, getToken, noCustomerField) => {
30476
31118
  if (!name.length) {
30477
31119
  alert("Please enter a table name.");
30478
31120
  return;
@@ -30493,6 +31135,7 @@ var addVirtualTable = async (name, editViewQuery, customFieldInfo, state, ownerT
30493
31135
  preQueries: [editViewQuery.replace(/;/, "")],
30494
31136
  customFieldInfo,
30495
31137
  name,
31138
+ description,
30496
31139
  clientId: state.client._id,
30497
31140
  runQueryConfig: { getColumns: true },
30498
31141
  databaseType: state.client.databaseType,
@@ -30657,6 +31300,7 @@ function VirtualTableManager({
30657
31300
  const [editQueryView, setEditQueryView] = useState39(false);
30658
31301
  const [editVirtualTableId, setEditVirtualTableId] = useState39("");
30659
31302
  const [editName, setEditName] = useState39("");
31303
+ const [editDescription, setEditDescription] = useState39("");
30660
31304
  const [editError, setEditError] = useState39();
30661
31305
  const [editVirtualTableQuery, setEditVirtualTableQuery] = useState39("");
30662
31306
  const [
@@ -30694,11 +31338,13 @@ function VirtualTableManager({
30694
31338
  const closeEditModal = () => {
30695
31339
  setEditModalIsOpen(false);
30696
31340
  setEditName("");
31341
+ setEditDescription("");
30697
31342
  setEditVirtualTableQuery("");
30698
31343
  setCustomFieldInfo(void 0);
30699
31344
  };
30700
31345
  const clickTableCell = (table, suppressModal = false) => {
30701
31346
  setEditName(table.name);
31347
+ setEditDescription(table.description ?? "");
30702
31348
  setEditVirtualTableQuery(table.viewQuery);
30703
31349
  setEditVirtualTableOwnerTenantFields(table.ownerTenantFields ?? []);
30704
31350
  setEditVirtualTableId(table._id);
@@ -30771,7 +31417,7 @@ function VirtualTableManager({
30771
31417
  document.body.style.overflow = prevOverflow;
30772
31418
  };
30773
31419
  }, [showVirtualTableEditorPortal]);
30774
- const handleModalSubmit = async (submitRequest, query, ownerTenantFields, name, id, columns, customFieldInfo2, override) => {
31420
+ const handleModalSubmit = async (submitRequest, query, ownerTenantFields, name, description, id, columns, customFieldInfo2, override) => {
30775
31421
  if (override) {
30776
31422
  setNoCustomerField(true);
30777
31423
  } else {
@@ -30811,6 +31457,7 @@ ${duplicateColumns.join("\n")}`
30811
31457
  submitResponse = await addVirtualTable(
30812
31458
  trimmedName,
30813
31459
  query,
31460
+ description,
30814
31461
  customFieldInfo2,
30815
31462
  state,
30816
31463
  ownerTenantFields,
@@ -30847,43 +31494,45 @@ ${errorColumns.length > 1 ? "They" : "It"} will be deleted off of the referencin
30847
31494
  return;
30848
31495
  }
30849
31496
  } else {
30850
- const referencedTableInfo = referencedTablesMap[prevTableName].map((info) => {
30851
- return `"${info.reportName}" on the "${info.dashboardName}" dashboard`;
30852
- });
30853
- if (referenceFiltersMap?.[prevTableName]) {
30854
- const referencedFilterInfo = referenceFiltersMap[prevTableName].map((info) => {
30855
- return `${info.dashboardName} - ${info.filterField}`;
31497
+ if (prevTableName !== trimmedName) {
31498
+ const referencedTableInfo = referencedTablesMap[prevTableName].map((info) => {
31499
+ return `"${info.reportName}" on the "${info.dashboardName}" dashboard`;
30856
31500
  });
30857
- alert(
30858
- `Warning
31501
+ if (referenceFiltersMap?.[prevTableName]) {
31502
+ const referencedFilterInfo = referenceFiltersMap[prevTableName].map((info) => {
31503
+ return `${info.dashboardName} - ${info.filterField}`;
31504
+ });
31505
+ alert(
31506
+ `Warning
30859
31507
 
30860
31508
  '${prevTableName}' is referenced in the following dashboard filters:
30861
31509
 
30862
31510
  ${referencedFilterInfo.join(
30863
- "\n"
30864
- )}
31511
+ "\n"
31512
+ )}
30865
31513
 
30866
31514
  Please delete those filters before renaming this virtual table.`
30867
- );
30868
- return;
30869
- }
30870
- if (table && table.broken) {
31515
+ );
31516
+ return;
31517
+ }
31518
+ if (table && table.broken) {
31519
+ alert(
31520
+ "Error\n\nThis virtual table has an invalid query. Please fix the query before renaming it."
31521
+ );
31522
+ return;
31523
+ }
30871
31524
  alert(
30872
- "Error\n\nThis virtual table has an invalid query. Please fix the query before renaming it."
30873
- );
30874
- return;
30875
- }
30876
- alert(
30877
- `Warning
31525
+ `Warning
30878
31526
 
30879
31527
  '${prevTableName}' is referenced by:
30880
31528
  ${referencedTableInfo.join(
30881
- "\n"
30882
- )}
31529
+ "\n"
31530
+ )}
30883
31531
 
30884
31532
  Please delete those charts before renaming this virtual table.`
30885
- );
30886
- return;
31533
+ );
31534
+ return;
31535
+ }
30887
31536
  }
30888
31537
  }
30889
31538
  if (!trimmedName) {
@@ -30913,6 +31562,7 @@ ${duplicateColumns.join("\n")}`
30913
31562
  trimmedName,
30914
31563
  query,
30915
31564
  id,
31565
+ description,
30916
31566
  customFieldInfo2,
30917
31567
  state,
30918
31568
  ownerTenantFields,
@@ -31014,7 +31664,7 @@ Please delete those filters before deleting this table.`
31014
31664
  await reloadTables();
31015
31665
  return response;
31016
31666
  };
31017
- const handleEditAddView = async (request, query, ownerTenantFields, name, id, columns, override) => {
31667
+ const handleEditAddView = async (request, query, ownerTenantFields, name, description, id, columns, override) => {
31018
31668
  switch (request) {
31019
31669
  case "edit":
31020
31670
  await handleModalSubmit(
@@ -31022,6 +31672,7 @@ Please delete those filters before deleting this table.`
31022
31672
  query,
31023
31673
  ownerTenantFields,
31024
31674
  name,
31675
+ description,
31025
31676
  id,
31026
31677
  columns,
31027
31678
  void 0,
@@ -31035,6 +31686,7 @@ Please delete those filters before deleting this table.`
31035
31686
  ownerTenantFields,
31036
31687
  void 0,
31037
31688
  void 0,
31689
+ void 0,
31038
31690
  columns,
31039
31691
  void 0,
31040
31692
  override
@@ -31076,6 +31728,7 @@ Please delete those filters before deleting this table.`
31076
31728
  query,
31077
31729
  ownerTenantFields,
31078
31730
  name,
31731
+ void 0,
31079
31732
  id,
31080
31733
  columns,
31081
31734
  override
@@ -31200,6 +31853,7 @@ Please delete those filters before deleting this table.`
31200
31853
  {
31201
31854
  onClick: () => {
31202
31855
  setEditName("");
31856
+ setEditDescription("");
31203
31857
  setEditVirtualTableQuery("");
31204
31858
  setEditVirtualTableId("");
31205
31859
  setInitialVirtualTable(void 0);
@@ -31748,6 +32402,7 @@ Please delete those filters before deleting this table.`
31748
32402
  EditAddViewModal,
31749
32403
  {
31750
32404
  viewName: editName,
32405
+ viewDescription: editDescription,
31751
32406
  viewQuery: editVirtualTableQuery,
31752
32407
  viewId: editVirtualTableId,
31753
32408
  viewOwnerTenantFields: editVirtualTableOwnerTenantFields,
@@ -31755,7 +32410,7 @@ Please delete those filters before deleting this table.`
31755
32410
  customFieldInfo,
31756
32411
  closeEditModal,
31757
32412
  error: editError,
31758
- submit: async (submitRequest, query, ownerTenantFields, name, id, columns, customFieldInfo2, noCustomerField2) => {
32413
+ submit: async (submitRequest, query, ownerTenantFields, name, description, id, columns, customFieldInfo2, noCustomerField2) => {
31759
32414
  if (submitRequest !== "delete") {
31760
32415
  setSubmittingVirtualTable(true);
31761
32416
  }
@@ -31764,6 +32419,7 @@ Please delete those filters before deleting this table.`
31764
32419
  query,
31765
32420
  ownerTenantFields,
31766
32421
  name,
32422
+ description,
31767
32423
  id,
31768
32424
  columns,
31769
32425
  customFieldInfo2,
@@ -31809,6 +32465,7 @@ Please delete those filters before deleting this table.`
31809
32465
  }
31810
32466
  function EditAddViewModal({
31811
32467
  viewName,
32468
+ viewDescription,
31812
32469
  viewQuery,
31813
32470
  viewOwnerTenantFields,
31814
32471
  viewId,
@@ -31824,6 +32481,7 @@ function EditAddViewModal({
31824
32481
  noCustomerField
31825
32482
  }) {
31826
32483
  const [name, setName] = useState39(viewName);
32484
+ const [description, setDescription] = useState39(viewDescription);
31827
32485
  const [query, setQuery] = useState39(viewQuery);
31828
32486
  const [id, setId] = useState39(viewId);
31829
32487
  const [useCustomField, setUseCustomField] = useState39(
@@ -31838,7 +32496,7 @@ function EditAddViewModal({
31838
32496
  const [runQueryButtonLoading, setRunQueryButtonLoading] = useState39(false);
31839
32497
  const [tableData, setTableData] = useState39(void 0);
31840
32498
  const [errorInfo, setErrorInfo] = useState39({ show: false, message: "" });
31841
- const clientIsSingleTenant = useMemo22(
32499
+ const clientIsSingleTenant = useMemo23(
31842
32500
  () => onlySingleDatabaseTenant(state.client),
31843
32501
  [state.client]
31844
32502
  );
@@ -31851,6 +32509,9 @@ function EditAddViewModal({
31851
32509
  useEffect35(() => {
31852
32510
  setName(viewName);
31853
32511
  }, [viewName]);
32512
+ useEffect35(() => {
32513
+ setDescription(viewDescription);
32514
+ }, [viewDescription]);
31854
32515
  useEffect35(() => {
31855
32516
  setQuery(viewQuery);
31856
32517
  }, [viewQuery]);
@@ -31868,6 +32529,7 @@ function EditAddViewModal({
31868
32529
  setTableData(void 0);
31869
32530
  setErrorInfo({ show: false, message: "" });
31870
32531
  setName("");
32532
+ setDescription("");
31871
32533
  closeEditModal();
31872
32534
  },
31873
32535
  children: /* @__PURE__ */ jsxs56(
@@ -31914,21 +32576,47 @@ function EditAddViewModal({
31914
32576
  ]
31915
32577
  }
31916
32578
  ),
31917
- /* @__PURE__ */ jsx71(InputLabel, { children: "Name" }),
31918
- /* @__PURE__ */ jsx71(
31919
- TextInputPrimitive_default,
31920
- {
31921
- ref: (input) => {
31922
- if (editModalIsOpen && !viewName) {
31923
- input?.focus();
32579
+ /* @__PURE__ */ jsxs56("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
32580
+ /* @__PURE__ */ jsx71(InputLabel, { children: "Name" }),
32581
+ /* @__PURE__ */ jsx71(
32582
+ TextInputPrimitive_default,
32583
+ {
32584
+ placeholder: "Enter view display name...",
32585
+ onChange: (e2) => setName(e2.target.value),
32586
+ value: name ? name : ""
32587
+ }
32588
+ )
32589
+ ] }),
32590
+ /* @__PURE__ */ jsx71("div", { style: { height: 12 } }),
32591
+ /* @__PURE__ */ jsxs56("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
32592
+ /* @__PURE__ */ jsx71(InputLabel, { children: "Description" }),
32593
+ /* @__PURE__ */ jsx71(
32594
+ "textarea",
32595
+ {
32596
+ placeholder: "Enter description...",
32597
+ onChange: (e2) => setDescription(e2.target.value),
32598
+ value: description ?? "",
32599
+ rows: 3,
32600
+ style: {
32601
+ width: "100%",
32602
+ minHeight: 88,
32603
+ resize: "vertical",
32604
+ padding: "10px 12px",
32605
+ fontWeight: "medium",
32606
+ backgroundColor: state.theme?.backgroundColor || "white",
32607
+ color: state.theme?.primaryTextColor,
32608
+ borderWidth: "1px",
32609
+ borderColor: state.theme?.borderColor || "#E7E7E7",
32610
+ borderStyle: "solid",
32611
+ borderRadius: "6px",
32612
+ fontSize: 14,
32613
+ fontFamily: state.theme?.fontFamily,
32614
+ boxSizing: "border-box"
31924
32615
  }
31925
- },
31926
- placeholder: "Enter view display name...",
31927
- onChange: (e2) => setName(e2.target.value),
31928
- value: name ? name : ""
31929
- }
31930
- ),
31931
- /* @__PURE__ */ jsx71("br", {}),
32616
+ }
32617
+ )
32618
+ ] }),
32619
+ /* @__PURE__ */ jsx71("div", { style: { height: 16 } }),
31932
32620
  viewOwnerTenantFields.length > 0 && /* @__PURE__ */ jsxs56(Fragment22, { children: [
31933
32621
  /* @__PURE__ */ jsx71(InputLabel, { tooltip: "Dashboards may only query from virtual tables that share an owner with them. Virtual tables are required to return each of their owners' foreign keys as part of the query.", children: "Owners" }),
31934
32622
  /* @__PURE__ */ jsx71(
@@ -31963,7 +32651,7 @@ function EditAddViewModal({
31963
32651
  ))
31964
32652
  }
31965
32653
  ),
31966
- /* @__PURE__ */ jsx71("br", {})
32654
+ /* @__PURE__ */ jsx71("div", { style: { height: 16 } })
31967
32655
  ] }),
31968
32656
  error && /* @__PURE__ */ jsxs56(Fragment22, { children: [
31969
32657
  /* @__PURE__ */ jsx71("h3", { style: { color: "#CA3A31" }, children: error }),
@@ -32239,7 +32927,14 @@ function EditAddViewModal({
32239
32927
  viewName && /* @__PURE__ */ jsx71(
32240
32928
  MemoizedButton,
32241
32929
  {
32242
- onClick: () => submit("delete", query, viewOwnerTenantFields, name, id),
32930
+ onClick: () => submit(
32931
+ "delete",
32932
+ query,
32933
+ viewOwnerTenantFields,
32934
+ name,
32935
+ description,
32936
+ id
32937
+ ),
32243
32938
  label: "Delete",
32244
32939
  style: { color: "red", backgroundColor: "white" }
32245
32940
  }
@@ -32320,6 +33015,7 @@ function EditAddViewModal({
32320
33015
  query,
32321
33016
  viewOwnerTenantFields,
32322
33017
  name,
33018
+ description,
32323
33019
  id,
32324
33020
  void 0,
32325
33021
  useCustomField ? {
@@ -32366,7 +33062,9 @@ export {
32366
33062
  SecondaryButtonPrimitive_default as SecondaryButtonPrimitive,
32367
33063
  TextInputPrimitive_default as TextInputPrimitive,
32368
33064
  VirtualTableManager,
33065
+ clearQuillSandboxStorage,
32369
33066
  exportChatAsMarkdown,
32370
33067
  useAdmin,
32371
- useAgentChat
33068
+ useAgentChat,
33069
+ useSandboxSession
32372
33070
  };