@quillsql/admin 1.8.7 → 1.8.8

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;
@@ -26520,8 +26792,39 @@ function DashboardSelectPopover({
26520
26792
  import { useEffect as useEffect32, useRef as useRef23, useState as useState35 } from "react";
26521
26793
  import { Resizable as Resizable2 } from "re-resizable";
26522
26794
 
26795
+ // src/hooks/useSandboxSession.ts
26796
+ import { useMemo as useMemo20 } from "react";
26797
+ function useSandboxSession() {
26798
+ const { state } = useAdmin();
26799
+ const { session } = useAgentChat();
26800
+ return useMemo20(() => {
26801
+ const sessionId = session?.sessionId ?? state.sandboxSessionId ?? null;
26802
+ const sandboxClientId = session?.sandboxClientId ?? state.sandboxClientId ?? null;
26803
+ const sourceClientId = session?.sourceClientId ?? state.sandboxParentClientId ?? null;
26804
+ const mergedSession = session ?? (sessionId && sandboxClientId && sourceClientId ? {
26805
+ sessionId,
26806
+ sourceClientId,
26807
+ sourceClientName: "",
26808
+ sandboxClientId,
26809
+ sandboxClientName: "",
26810
+ status: "active"
26811
+ } : null);
26812
+ return {
26813
+ sessionId,
26814
+ sandboxClientId,
26815
+ sourceClientId,
26816
+ session: mergedSession
26817
+ };
26818
+ }, [
26819
+ session,
26820
+ state.sandboxSessionId,
26821
+ state.sandboxClientId,
26822
+ state.sandboxParentClientId
26823
+ ]);
26824
+ }
26825
+
26523
26826
  // src/components/AgentChat/AgentChat.tsx
26524
- import { memo as memo2, useEffect as useEffect31, useMemo as useMemo20, useRef as useRef22, useState as useState34 } from "react";
26827
+ import { memo as memo2, useEffect as useEffect31, useMemo as useMemo21, useRef as useRef22, useState as useState34 } from "react";
26525
26828
 
26526
26829
  // src/components/AgentChat/agentChatMarkdownCss.ts
26527
26830
  var AGENT_CHAT_MARKDOWN_STYLE_ID = "quillsql-agent-chat-markdown";
@@ -27508,7 +27811,7 @@ function AgentChat({
27508
27811
  const { schema: allTableData } = useDatabaseSchema();
27509
27812
  const { allReportsById } = useAllReports2();
27510
27813
  const { data: virtualTables } = useVirtualTables();
27511
- const changelogDiffs = useMemo20(
27814
+ const changelogDiffs = useMemo21(
27512
27815
  () => changelogEntries.flatMap((entry) => {
27513
27816
  const diff = parseDiffEntry(entry);
27514
27817
  return diff ? [diff] : [];
@@ -27592,6 +27895,7 @@ function AgentChat({
27592
27895
  setMessages((prev) => prev.filter((m3) => m3.isWelcome));
27593
27896
  setSession(null);
27594
27897
  clearChangelogEntries();
27898
+ clearSandboxSession();
27595
27899
  const activeClientId = getActiveClientId(state.client);
27596
27900
  const sourceId = sourceClientId || state.sandboxParentClientId || activeClientId || null;
27597
27901
  if (!sourceId) return;
@@ -28339,14 +28643,17 @@ function AgentChatPanel() {
28339
28643
  const {
28340
28644
  messages,
28341
28645
  setMessages,
28342
- session,
28343
28646
  setSession,
28344
28647
  showToolOutputs,
28345
28648
  setShowToolOutputs,
28346
28649
  clearChangelogEntries
28347
28650
  } = useAgentChat();
28348
- const sourceClientId = state.sandboxParentClientId;
28349
- const sandboxClientId = state.sandboxClientId ?? session?.sandboxClientId ?? null;
28651
+ const {
28652
+ sessionId,
28653
+ sandboxClientId,
28654
+ sourceClientId,
28655
+ session
28656
+ } = useSandboxSession();
28350
28657
  const [collapsed, setCollapsed] = useState35(false);
28351
28658
  const minWidth = typeof window !== "undefined" ? Math.max(DEFAULT_MIN_WIDTH, window.innerWidth * DEFAULT_WIDTH_FRACTION) : 480;
28352
28659
  const [width, setWidth] = useState35(
@@ -28364,13 +28671,20 @@ function AgentChatPanel() {
28364
28671
  if (!prev || !clientId || prev === clientId) return;
28365
28672
  if (sandboxClientId && clientId === sandboxClientId) return;
28366
28673
  if (sourceClientId && clientId === sourceClientId) return;
28674
+ if (state.sandboxSessionId && (clientId === state.sandboxClientId || clientId === state.sandboxParentClientId)) {
28675
+ return;
28676
+ }
28367
28677
  setMessages((prev2) => prev2.filter((m3) => m3.isWelcome));
28368
28678
  setSession(null);
28369
28679
  clearChangelogEntries();
28680
+ clearSandboxSession();
28370
28681
  }, [
28371
28682
  clientId,
28372
28683
  sandboxClientId,
28373
28684
  sourceClientId,
28685
+ state.sandboxSessionId,
28686
+ state.sandboxClientId,
28687
+ state.sandboxParentClientId,
28374
28688
  setMessages,
28375
28689
  setSession,
28376
28690
  clearChangelogEntries
@@ -28670,9 +28984,9 @@ function AgentChatPanel() {
28670
28984
  children: clientId && /* @__PURE__ */ jsx63(
28671
28985
  AgentChat,
28672
28986
  {
28673
- agentSessionId: session?.sessionId ?? "",
28987
+ agentSessionId: sessionId ?? "",
28674
28988
  sandboxClientId: sandboxClientId ?? "",
28675
- sourceClientId: session?.sourceClientId ?? sourceClientId ?? "",
28989
+ sourceClientId: sourceClientId ?? "",
28676
28990
  getToken: async () => await getToken() || ""
28677
28991
  }
28678
28992
  )
@@ -29605,7 +29919,7 @@ function DashboardManager({
29605
29919
  import {
29606
29920
  useCallback as useCallback11,
29607
29921
  useEffect as useEffect35,
29608
- useMemo as useMemo22,
29922
+ useMemo as useMemo23,
29609
29923
  useRef as useRef27,
29610
29924
  useState as useState39
29611
29925
  } from "react";
@@ -29616,7 +29930,7 @@ import {
29616
29930
  Table as Table3,
29617
29931
  SchemaListComponent as SchemaListComponent2
29618
29932
  } from "@quillsql/react";
29619
- import { useEffect as useEffect34, useMemo as useMemo21, useRef as useRef26, useState as useState38 } from "react";
29933
+ import { useEffect as useEffect34, useMemo as useMemo22, useRef as useRef26, useState as useState38 } from "react";
29620
29934
 
29621
29935
  // src/modals/TenantFieldModal.tsx
29622
29936
  import { Fragment as Fragment21, jsx as jsx67, jsxs as jsxs52 } from "react/jsx-runtime";
@@ -29893,7 +30207,7 @@ function CreateEditVirtualTable({
29893
30207
  override
29894
30208
  );
29895
30209
  };
29896
- const dashboardOwnerTenants = useMemo21(() => {
30210
+ const dashboardOwnerTenants = useMemo22(() => {
29897
30211
  return client.allTenantTypes?.filter((t2) => client.ownerTenantFields?.includes(t2.tenantField)).filter((t2) => t2.tenantField !== SINGLE_TENANT);
29898
30212
  }, [client.ownerTenantFields, client.allTenantTypes]);
29899
30213
  useEffect34(() => {
@@ -30436,7 +30750,7 @@ ${duplicateColumns.join("\n")}`
30436
30750
  }
30437
30751
 
30438
30752
  // src/utils/dataEditor.tsx
30439
- var editVirtualTable = async (editName, editViewQuery, editViewId, customFieldInfo, state, ownerTenantFields, getToken, noCustomerField) => {
30753
+ var editVirtualTable = async (editName, editViewQuery, editViewId, description, customFieldInfo, state, ownerTenantFields, getToken, noCustomerField) => {
30440
30754
  if (!editName.length) {
30441
30755
  alert("Please enter a table name.");
30442
30756
  return;
@@ -30462,6 +30776,7 @@ var editVirtualTable = async (editName, editViewQuery, editViewId, customFieldIn
30462
30776
  name: editName,
30463
30777
  customFieldInfo,
30464
30778
  id: editViewId,
30779
+ description,
30465
30780
  clientId: state.client._id,
30466
30781
  runQueryConfig: { getColumns: true },
30467
30782
  databaseType: state.client.databaseType,
@@ -30472,7 +30787,7 @@ var editVirtualTable = async (editName, editViewQuery, editViewId, customFieldIn
30472
30787
  getToken
30473
30788
  });
30474
30789
  };
30475
- var addVirtualTable = async (name, editViewQuery, customFieldInfo, state, ownerTenantFields, getToken, noCustomerField) => {
30790
+ var addVirtualTable = async (name, editViewQuery, description, customFieldInfo, state, ownerTenantFields, getToken, noCustomerField) => {
30476
30791
  if (!name.length) {
30477
30792
  alert("Please enter a table name.");
30478
30793
  return;
@@ -30493,6 +30808,7 @@ var addVirtualTable = async (name, editViewQuery, customFieldInfo, state, ownerT
30493
30808
  preQueries: [editViewQuery.replace(/;/, "")],
30494
30809
  customFieldInfo,
30495
30810
  name,
30811
+ description,
30496
30812
  clientId: state.client._id,
30497
30813
  runQueryConfig: { getColumns: true },
30498
30814
  databaseType: state.client.databaseType,
@@ -30657,6 +30973,7 @@ function VirtualTableManager({
30657
30973
  const [editQueryView, setEditQueryView] = useState39(false);
30658
30974
  const [editVirtualTableId, setEditVirtualTableId] = useState39("");
30659
30975
  const [editName, setEditName] = useState39("");
30976
+ const [editDescription, setEditDescription] = useState39("");
30660
30977
  const [editError, setEditError] = useState39();
30661
30978
  const [editVirtualTableQuery, setEditVirtualTableQuery] = useState39("");
30662
30979
  const [
@@ -30694,11 +31011,13 @@ function VirtualTableManager({
30694
31011
  const closeEditModal = () => {
30695
31012
  setEditModalIsOpen(false);
30696
31013
  setEditName("");
31014
+ setEditDescription("");
30697
31015
  setEditVirtualTableQuery("");
30698
31016
  setCustomFieldInfo(void 0);
30699
31017
  };
30700
31018
  const clickTableCell = (table, suppressModal = false) => {
30701
31019
  setEditName(table.name);
31020
+ setEditDescription(table.description ?? "");
30702
31021
  setEditVirtualTableQuery(table.viewQuery);
30703
31022
  setEditVirtualTableOwnerTenantFields(table.ownerTenantFields ?? []);
30704
31023
  setEditVirtualTableId(table._id);
@@ -30771,7 +31090,7 @@ function VirtualTableManager({
30771
31090
  document.body.style.overflow = prevOverflow;
30772
31091
  };
30773
31092
  }, [showVirtualTableEditorPortal]);
30774
- const handleModalSubmit = async (submitRequest, query, ownerTenantFields, name, id, columns, customFieldInfo2, override) => {
31093
+ const handleModalSubmit = async (submitRequest, query, ownerTenantFields, name, description, id, columns, customFieldInfo2, override) => {
30775
31094
  if (override) {
30776
31095
  setNoCustomerField(true);
30777
31096
  } else {
@@ -30811,6 +31130,7 @@ ${duplicateColumns.join("\n")}`
30811
31130
  submitResponse = await addVirtualTable(
30812
31131
  trimmedName,
30813
31132
  query,
31133
+ description,
30814
31134
  customFieldInfo2,
30815
31135
  state,
30816
31136
  ownerTenantFields,
@@ -30847,43 +31167,45 @@ ${errorColumns.length > 1 ? "They" : "It"} will be deleted off of the referencin
30847
31167
  return;
30848
31168
  }
30849
31169
  } 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}`;
31170
+ if (prevTableName !== trimmedName) {
31171
+ const referencedTableInfo = referencedTablesMap[prevTableName].map((info) => {
31172
+ return `"${info.reportName}" on the "${info.dashboardName}" dashboard`;
30856
31173
  });
30857
- alert(
30858
- `Warning
31174
+ if (referenceFiltersMap?.[prevTableName]) {
31175
+ const referencedFilterInfo = referenceFiltersMap[prevTableName].map((info) => {
31176
+ return `${info.dashboardName} - ${info.filterField}`;
31177
+ });
31178
+ alert(
31179
+ `Warning
30859
31180
 
30860
31181
  '${prevTableName}' is referenced in the following dashboard filters:
30861
31182
 
30862
31183
  ${referencedFilterInfo.join(
30863
- "\n"
30864
- )}
31184
+ "\n"
31185
+ )}
30865
31186
 
30866
31187
  Please delete those filters before renaming this virtual table.`
30867
- );
30868
- return;
30869
- }
30870
- if (table && table.broken) {
31188
+ );
31189
+ return;
31190
+ }
31191
+ if (table && table.broken) {
31192
+ alert(
31193
+ "Error\n\nThis virtual table has an invalid query. Please fix the query before renaming it."
31194
+ );
31195
+ return;
31196
+ }
30871
31197
  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
31198
+ `Warning
30878
31199
 
30879
31200
  '${prevTableName}' is referenced by:
30880
31201
  ${referencedTableInfo.join(
30881
- "\n"
30882
- )}
31202
+ "\n"
31203
+ )}
30883
31204
 
30884
31205
  Please delete those charts before renaming this virtual table.`
30885
- );
30886
- return;
31206
+ );
31207
+ return;
31208
+ }
30887
31209
  }
30888
31210
  }
30889
31211
  if (!trimmedName) {
@@ -30913,6 +31235,7 @@ ${duplicateColumns.join("\n")}`
30913
31235
  trimmedName,
30914
31236
  query,
30915
31237
  id,
31238
+ description,
30916
31239
  customFieldInfo2,
30917
31240
  state,
30918
31241
  ownerTenantFields,
@@ -31014,7 +31337,7 @@ Please delete those filters before deleting this table.`
31014
31337
  await reloadTables();
31015
31338
  return response;
31016
31339
  };
31017
- const handleEditAddView = async (request, query, ownerTenantFields, name, id, columns, override) => {
31340
+ const handleEditAddView = async (request, query, ownerTenantFields, name, description, id, columns, override) => {
31018
31341
  switch (request) {
31019
31342
  case "edit":
31020
31343
  await handleModalSubmit(
@@ -31022,6 +31345,7 @@ Please delete those filters before deleting this table.`
31022
31345
  query,
31023
31346
  ownerTenantFields,
31024
31347
  name,
31348
+ description,
31025
31349
  id,
31026
31350
  columns,
31027
31351
  void 0,
@@ -31035,6 +31359,7 @@ Please delete those filters before deleting this table.`
31035
31359
  ownerTenantFields,
31036
31360
  void 0,
31037
31361
  void 0,
31362
+ void 0,
31038
31363
  columns,
31039
31364
  void 0,
31040
31365
  override
@@ -31076,6 +31401,7 @@ Please delete those filters before deleting this table.`
31076
31401
  query,
31077
31402
  ownerTenantFields,
31078
31403
  name,
31404
+ void 0,
31079
31405
  id,
31080
31406
  columns,
31081
31407
  override
@@ -31200,6 +31526,7 @@ Please delete those filters before deleting this table.`
31200
31526
  {
31201
31527
  onClick: () => {
31202
31528
  setEditName("");
31529
+ setEditDescription("");
31203
31530
  setEditVirtualTableQuery("");
31204
31531
  setEditVirtualTableId("");
31205
31532
  setInitialVirtualTable(void 0);
@@ -31748,6 +32075,7 @@ Please delete those filters before deleting this table.`
31748
32075
  EditAddViewModal,
31749
32076
  {
31750
32077
  viewName: editName,
32078
+ viewDescription: editDescription,
31751
32079
  viewQuery: editVirtualTableQuery,
31752
32080
  viewId: editVirtualTableId,
31753
32081
  viewOwnerTenantFields: editVirtualTableOwnerTenantFields,
@@ -31755,7 +32083,7 @@ Please delete those filters before deleting this table.`
31755
32083
  customFieldInfo,
31756
32084
  closeEditModal,
31757
32085
  error: editError,
31758
- submit: async (submitRequest, query, ownerTenantFields, name, id, columns, customFieldInfo2, noCustomerField2) => {
32086
+ submit: async (submitRequest, query, ownerTenantFields, name, description, id, columns, customFieldInfo2, noCustomerField2) => {
31759
32087
  if (submitRequest !== "delete") {
31760
32088
  setSubmittingVirtualTable(true);
31761
32089
  }
@@ -31764,6 +32092,7 @@ Please delete those filters before deleting this table.`
31764
32092
  query,
31765
32093
  ownerTenantFields,
31766
32094
  name,
32095
+ description,
31767
32096
  id,
31768
32097
  columns,
31769
32098
  customFieldInfo2,
@@ -31809,6 +32138,7 @@ Please delete those filters before deleting this table.`
31809
32138
  }
31810
32139
  function EditAddViewModal({
31811
32140
  viewName,
32141
+ viewDescription,
31812
32142
  viewQuery,
31813
32143
  viewOwnerTenantFields,
31814
32144
  viewId,
@@ -31824,6 +32154,7 @@ function EditAddViewModal({
31824
32154
  noCustomerField
31825
32155
  }) {
31826
32156
  const [name, setName] = useState39(viewName);
32157
+ const [description, setDescription] = useState39(viewDescription);
31827
32158
  const [query, setQuery] = useState39(viewQuery);
31828
32159
  const [id, setId] = useState39(viewId);
31829
32160
  const [useCustomField, setUseCustomField] = useState39(
@@ -31838,7 +32169,7 @@ function EditAddViewModal({
31838
32169
  const [runQueryButtonLoading, setRunQueryButtonLoading] = useState39(false);
31839
32170
  const [tableData, setTableData] = useState39(void 0);
31840
32171
  const [errorInfo, setErrorInfo] = useState39({ show: false, message: "" });
31841
- const clientIsSingleTenant = useMemo22(
32172
+ const clientIsSingleTenant = useMemo23(
31842
32173
  () => onlySingleDatabaseTenant(state.client),
31843
32174
  [state.client]
31844
32175
  );
@@ -31851,6 +32182,9 @@ function EditAddViewModal({
31851
32182
  useEffect35(() => {
31852
32183
  setName(viewName);
31853
32184
  }, [viewName]);
32185
+ useEffect35(() => {
32186
+ setDescription(viewDescription);
32187
+ }, [viewDescription]);
31854
32188
  useEffect35(() => {
31855
32189
  setQuery(viewQuery);
31856
32190
  }, [viewQuery]);
@@ -31868,6 +32202,7 @@ function EditAddViewModal({
31868
32202
  setTableData(void 0);
31869
32203
  setErrorInfo({ show: false, message: "" });
31870
32204
  setName("");
32205
+ setDescription("");
31871
32206
  closeEditModal();
31872
32207
  },
31873
32208
  children: /* @__PURE__ */ jsxs56(
@@ -31914,21 +32249,47 @@ function EditAddViewModal({
31914
32249
  ]
31915
32250
  }
31916
32251
  ),
31917
- /* @__PURE__ */ jsx71(InputLabel, { children: "Name" }),
31918
- /* @__PURE__ */ jsx71(
31919
- TextInputPrimitive_default,
31920
- {
31921
- ref: (input) => {
31922
- if (editModalIsOpen && !viewName) {
31923
- input?.focus();
32252
+ /* @__PURE__ */ jsxs56("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
32253
+ /* @__PURE__ */ jsx71(InputLabel, { children: "Name" }),
32254
+ /* @__PURE__ */ jsx71(
32255
+ TextInputPrimitive_default,
32256
+ {
32257
+ placeholder: "Enter view display name...",
32258
+ onChange: (e2) => setName(e2.target.value),
32259
+ value: name ? name : ""
32260
+ }
32261
+ )
32262
+ ] }),
32263
+ /* @__PURE__ */ jsx71("div", { style: { height: 12 } }),
32264
+ /* @__PURE__ */ jsxs56("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
32265
+ /* @__PURE__ */ jsx71(InputLabel, { children: "Description" }),
32266
+ /* @__PURE__ */ jsx71(
32267
+ "textarea",
32268
+ {
32269
+ placeholder: "Enter description...",
32270
+ onChange: (e2) => setDescription(e2.target.value),
32271
+ value: description ?? "",
32272
+ rows: 3,
32273
+ style: {
32274
+ width: "100%",
32275
+ minHeight: 88,
32276
+ resize: "vertical",
32277
+ padding: "10px 12px",
32278
+ fontWeight: "medium",
32279
+ backgroundColor: state.theme?.backgroundColor || "white",
32280
+ color: state.theme?.primaryTextColor,
32281
+ borderWidth: "1px",
32282
+ borderColor: state.theme?.borderColor || "#E7E7E7",
32283
+ borderStyle: "solid",
32284
+ borderRadius: "6px",
32285
+ fontSize: 14,
32286
+ fontFamily: state.theme?.fontFamily,
32287
+ boxSizing: "border-box"
31924
32288
  }
31925
- },
31926
- placeholder: "Enter view display name...",
31927
- onChange: (e2) => setName(e2.target.value),
31928
- value: name ? name : ""
31929
- }
31930
- ),
31931
- /* @__PURE__ */ jsx71("br", {}),
32289
+ }
32290
+ )
32291
+ ] }),
32292
+ /* @__PURE__ */ jsx71("div", { style: { height: 16 } }),
31932
32293
  viewOwnerTenantFields.length > 0 && /* @__PURE__ */ jsxs56(Fragment22, { children: [
31933
32294
  /* @__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
32295
  /* @__PURE__ */ jsx71(
@@ -31963,7 +32324,7 @@ function EditAddViewModal({
31963
32324
  ))
31964
32325
  }
31965
32326
  ),
31966
- /* @__PURE__ */ jsx71("br", {})
32327
+ /* @__PURE__ */ jsx71("div", { style: { height: 16 } })
31967
32328
  ] }),
31968
32329
  error && /* @__PURE__ */ jsxs56(Fragment22, { children: [
31969
32330
  /* @__PURE__ */ jsx71("h3", { style: { color: "#CA3A31" }, children: error }),
@@ -32239,7 +32600,14 @@ function EditAddViewModal({
32239
32600
  viewName && /* @__PURE__ */ jsx71(
32240
32601
  MemoizedButton,
32241
32602
  {
32242
- onClick: () => submit("delete", query, viewOwnerTenantFields, name, id),
32603
+ onClick: () => submit(
32604
+ "delete",
32605
+ query,
32606
+ viewOwnerTenantFields,
32607
+ name,
32608
+ description,
32609
+ id
32610
+ ),
32243
32611
  label: "Delete",
32244
32612
  style: { color: "red", backgroundColor: "white" }
32245
32613
  }
@@ -32320,6 +32688,7 @@ function EditAddViewModal({
32320
32688
  query,
32321
32689
  viewOwnerTenantFields,
32322
32690
  name,
32691
+ description,
32323
32692
  id,
32324
32693
  void 0,
32325
32694
  useCustomField ? {
@@ -32366,7 +32735,9 @@ export {
32366
32735
  SecondaryButtonPrimitive_default as SecondaryButtonPrimitive,
32367
32736
  TextInputPrimitive_default as TextInputPrimitive,
32368
32737
  VirtualTableManager,
32738
+ clearQuillSandboxStorage,
32369
32739
  exportChatAsMarkdown,
32370
32740
  useAdmin,
32371
- useAgentChat
32741
+ useAgentChat,
32742
+ useSandboxSession
32372
32743
  };