@quillsql/admin 1.8.1 → 1.8.2
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.cjs +36 -18
- package/dist/index.js +36 -18
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8267,15 +8267,7 @@ function AdminProvider({
|
|
|
8267
8267
|
}
|
|
8268
8268
|
return adminState;
|
|
8269
8269
|
};
|
|
8270
|
-
const
|
|
8271
|
-
const localState = JSON.parse(
|
|
8272
|
-
sessionStorage.getItem("quill-adminState") ?? "null"
|
|
8273
|
-
);
|
|
8274
|
-
if (clerkOrgId && localState?.clerkOrgId === clerkOrgId) {
|
|
8275
|
-
return parsedSessionStorageAdminState(localState);
|
|
8276
|
-
}
|
|
8277
|
-
sessionStorage.removeItem("quill-adminState");
|
|
8278
|
-
sessionStorage.removeItem("quill-client");
|
|
8270
|
+
const buildDefaultState = () => {
|
|
8279
8271
|
const populatedTheme = {
|
|
8280
8272
|
...theme,
|
|
8281
8273
|
fontFamily: theme?.fontFamily ?? defaultTheme.fontFamily,
|
|
@@ -8305,20 +8297,15 @@ function AdminProvider({
|
|
|
8305
8297
|
withCredentials,
|
|
8306
8298
|
client: null,
|
|
8307
8299
|
clients: [],
|
|
8308
|
-
organization: null,
|
|
8309
|
-
organizations: [],
|
|
8310
|
-
organizationId: null,
|
|
8311
8300
|
activeQuery: "",
|
|
8312
8301
|
activeEditItem: void 0,
|
|
8313
8302
|
tables: [],
|
|
8314
8303
|
schema: [],
|
|
8315
8304
|
activeComponent: "Dashboards",
|
|
8316
|
-
dashboards: [],
|
|
8317
8305
|
selectedDashboard: null,
|
|
8318
8306
|
reportId: null,
|
|
8319
8307
|
report: null,
|
|
8320
8308
|
theme: populatedTheme,
|
|
8321
|
-
organizationIdSet: false,
|
|
8322
8309
|
dateFilter: {},
|
|
8323
8310
|
clerkOrgId: clerkOrgId || "",
|
|
8324
8311
|
databaseTypeMismatch: { show: false, backendDatabaseType: "" },
|
|
@@ -8326,6 +8313,30 @@ function AdminProvider({
|
|
|
8326
8313
|
databaseSchema: void 0,
|
|
8327
8314
|
AskAIButton
|
|
8328
8315
|
};
|
|
8316
|
+
};
|
|
8317
|
+
const hydrateStateFromSessionStorage = () => {
|
|
8318
|
+
if (typeof window === "undefined") {
|
|
8319
|
+
return null;
|
|
8320
|
+
}
|
|
8321
|
+
try {
|
|
8322
|
+
const localState = JSON.parse(
|
|
8323
|
+
window.sessionStorage.getItem("quill-adminState") ?? "null"
|
|
8324
|
+
);
|
|
8325
|
+
if (clerkOrgId && localState?.clerkOrgId === clerkOrgId) {
|
|
8326
|
+
return parsedSessionStorageAdminState(localState);
|
|
8327
|
+
}
|
|
8328
|
+
} catch (error2) {
|
|
8329
|
+
console.warn(
|
|
8330
|
+
"AdminProvider: unable to parse quill-adminState from sessionStorage",
|
|
8331
|
+
error2
|
|
8332
|
+
);
|
|
8333
|
+
}
|
|
8334
|
+
window.sessionStorage.removeItem("quill-adminState");
|
|
8335
|
+
window.sessionStorage.removeItem("quill-client");
|
|
8336
|
+
return null;
|
|
8337
|
+
};
|
|
8338
|
+
const initialState = (0, import_react23.useMemo)(() => {
|
|
8339
|
+
return hydrateStateFromSessionStorage() ?? buildDefaultState();
|
|
8329
8340
|
}, []);
|
|
8330
8341
|
const [state, dispatch] = (0, import_react23.useReducer)(reducer, initialState);
|
|
8331
8342
|
const stateWithFlagsList = (0, import_react23.useMemo)(() => {
|
|
@@ -8539,11 +8550,16 @@ function AdminProvider({
|
|
|
8539
8550
|
}
|
|
8540
8551
|
}, [clerkOrgId]);
|
|
8541
8552
|
(0, import_react23.useEffect)(() => {
|
|
8553
|
+
if (typeof window === "undefined") {
|
|
8554
|
+
return;
|
|
8555
|
+
}
|
|
8542
8556
|
if (publicKeyRef.current !== publicKey) {
|
|
8543
8557
|
dispatch({ type: "SET_ALL_STATE", payload: initialState });
|
|
8544
8558
|
publicKeyRef.current = publicKey;
|
|
8545
8559
|
}
|
|
8546
|
-
const client = JSON.parse(
|
|
8560
|
+
const client = JSON.parse(
|
|
8561
|
+
window.sessionStorage.getItem("quill-client") ?? "null"
|
|
8562
|
+
);
|
|
8547
8563
|
let overridePublicKey = null;
|
|
8548
8564
|
if (client && client.clerkOrgId === clerkOrgId) {
|
|
8549
8565
|
overridePublicKey = client.id || client._id || client.publicKey;
|
|
@@ -8558,7 +8574,10 @@ function AdminProvider({
|
|
|
8558
8574
|
}
|
|
8559
8575
|
}, [publicKey]);
|
|
8560
8576
|
(0, import_react23.useEffect)(() => {
|
|
8561
|
-
|
|
8577
|
+
if (typeof window === "undefined") {
|
|
8578
|
+
return;
|
|
8579
|
+
}
|
|
8580
|
+
window.sessionStorage.setItem(
|
|
8562
8581
|
"quill-adminState",
|
|
8563
8582
|
JSON.stringify({
|
|
8564
8583
|
...state,
|
|
@@ -8568,7 +8587,6 @@ function AdminProvider({
|
|
|
8568
8587
|
},
|
|
8569
8588
|
clients: [],
|
|
8570
8589
|
tables: [],
|
|
8571
|
-
dashboards: [],
|
|
8572
8590
|
allTenantTypes: void 0,
|
|
8573
8591
|
selectedTenantValues: void 0,
|
|
8574
8592
|
selectedDashboardTenantIds: void 0,
|
|
@@ -8657,7 +8675,7 @@ function AdminProvider({
|
|
|
8657
8675
|
{
|
|
8658
8676
|
tenants,
|
|
8659
8677
|
flags,
|
|
8660
|
-
queryEndpoint:
|
|
8678
|
+
queryEndpoint: state.queryEndpoint,
|
|
8661
8679
|
withCredentials: state.withCredentials,
|
|
8662
8680
|
queryHeaders: state.queryHeaders,
|
|
8663
8681
|
publicKey: state.client._id,
|
package/dist/index.js
CHANGED
|
@@ -8255,15 +8255,7 @@ function AdminProvider({
|
|
|
8255
8255
|
}
|
|
8256
8256
|
return adminState;
|
|
8257
8257
|
};
|
|
8258
|
-
const
|
|
8259
|
-
const localState = JSON.parse(
|
|
8260
|
-
sessionStorage.getItem("quill-adminState") ?? "null"
|
|
8261
|
-
);
|
|
8262
|
-
if (clerkOrgId && localState?.clerkOrgId === clerkOrgId) {
|
|
8263
|
-
return parsedSessionStorageAdminState(localState);
|
|
8264
|
-
}
|
|
8265
|
-
sessionStorage.removeItem("quill-adminState");
|
|
8266
|
-
sessionStorage.removeItem("quill-client");
|
|
8258
|
+
const buildDefaultState = () => {
|
|
8267
8259
|
const populatedTheme = {
|
|
8268
8260
|
...theme,
|
|
8269
8261
|
fontFamily: theme?.fontFamily ?? defaultTheme.fontFamily,
|
|
@@ -8293,20 +8285,15 @@ function AdminProvider({
|
|
|
8293
8285
|
withCredentials,
|
|
8294
8286
|
client: null,
|
|
8295
8287
|
clients: [],
|
|
8296
|
-
organization: null,
|
|
8297
|
-
organizations: [],
|
|
8298
|
-
organizationId: null,
|
|
8299
8288
|
activeQuery: "",
|
|
8300
8289
|
activeEditItem: void 0,
|
|
8301
8290
|
tables: [],
|
|
8302
8291
|
schema: [],
|
|
8303
8292
|
activeComponent: "Dashboards",
|
|
8304
|
-
dashboards: [],
|
|
8305
8293
|
selectedDashboard: null,
|
|
8306
8294
|
reportId: null,
|
|
8307
8295
|
report: null,
|
|
8308
8296
|
theme: populatedTheme,
|
|
8309
|
-
organizationIdSet: false,
|
|
8310
8297
|
dateFilter: {},
|
|
8311
8298
|
clerkOrgId: clerkOrgId || "",
|
|
8312
8299
|
databaseTypeMismatch: { show: false, backendDatabaseType: "" },
|
|
@@ -8314,6 +8301,30 @@ function AdminProvider({
|
|
|
8314
8301
|
databaseSchema: void 0,
|
|
8315
8302
|
AskAIButton
|
|
8316
8303
|
};
|
|
8304
|
+
};
|
|
8305
|
+
const hydrateStateFromSessionStorage = () => {
|
|
8306
|
+
if (typeof window === "undefined") {
|
|
8307
|
+
return null;
|
|
8308
|
+
}
|
|
8309
|
+
try {
|
|
8310
|
+
const localState = JSON.parse(
|
|
8311
|
+
window.sessionStorage.getItem("quill-adminState") ?? "null"
|
|
8312
|
+
);
|
|
8313
|
+
if (clerkOrgId && localState?.clerkOrgId === clerkOrgId) {
|
|
8314
|
+
return parsedSessionStorageAdminState(localState);
|
|
8315
|
+
}
|
|
8316
|
+
} catch (error2) {
|
|
8317
|
+
console.warn(
|
|
8318
|
+
"AdminProvider: unable to parse quill-adminState from sessionStorage",
|
|
8319
|
+
error2
|
|
8320
|
+
);
|
|
8321
|
+
}
|
|
8322
|
+
window.sessionStorage.removeItem("quill-adminState");
|
|
8323
|
+
window.sessionStorage.removeItem("quill-client");
|
|
8324
|
+
return null;
|
|
8325
|
+
};
|
|
8326
|
+
const initialState = useMemo7(() => {
|
|
8327
|
+
return hydrateStateFromSessionStorage() ?? buildDefaultState();
|
|
8317
8328
|
}, []);
|
|
8318
8329
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
8319
8330
|
const stateWithFlagsList = useMemo7(() => {
|
|
@@ -8527,11 +8538,16 @@ function AdminProvider({
|
|
|
8527
8538
|
}
|
|
8528
8539
|
}, [clerkOrgId]);
|
|
8529
8540
|
useEffect15(() => {
|
|
8541
|
+
if (typeof window === "undefined") {
|
|
8542
|
+
return;
|
|
8543
|
+
}
|
|
8530
8544
|
if (publicKeyRef.current !== publicKey) {
|
|
8531
8545
|
dispatch({ type: "SET_ALL_STATE", payload: initialState });
|
|
8532
8546
|
publicKeyRef.current = publicKey;
|
|
8533
8547
|
}
|
|
8534
|
-
const client = JSON.parse(
|
|
8548
|
+
const client = JSON.parse(
|
|
8549
|
+
window.sessionStorage.getItem("quill-client") ?? "null"
|
|
8550
|
+
);
|
|
8535
8551
|
let overridePublicKey = null;
|
|
8536
8552
|
if (client && client.clerkOrgId === clerkOrgId) {
|
|
8537
8553
|
overridePublicKey = client.id || client._id || client.publicKey;
|
|
@@ -8546,7 +8562,10 @@ function AdminProvider({
|
|
|
8546
8562
|
}
|
|
8547
8563
|
}, [publicKey]);
|
|
8548
8564
|
useEffect15(() => {
|
|
8549
|
-
|
|
8565
|
+
if (typeof window === "undefined") {
|
|
8566
|
+
return;
|
|
8567
|
+
}
|
|
8568
|
+
window.sessionStorage.setItem(
|
|
8550
8569
|
"quill-adminState",
|
|
8551
8570
|
JSON.stringify({
|
|
8552
8571
|
...state,
|
|
@@ -8556,7 +8575,6 @@ function AdminProvider({
|
|
|
8556
8575
|
},
|
|
8557
8576
|
clients: [],
|
|
8558
8577
|
tables: [],
|
|
8559
|
-
dashboards: [],
|
|
8560
8578
|
allTenantTypes: void 0,
|
|
8561
8579
|
selectedTenantValues: void 0,
|
|
8562
8580
|
selectedDashboardTenantIds: void 0,
|
|
@@ -8645,7 +8663,7 @@ function AdminProvider({
|
|
|
8645
8663
|
{
|
|
8646
8664
|
tenants,
|
|
8647
8665
|
flags,
|
|
8648
|
-
queryEndpoint:
|
|
8666
|
+
queryEndpoint: state.queryEndpoint,
|
|
8649
8667
|
withCredentials: state.withCredentials,
|
|
8650
8668
|
queryHeaders: state.queryHeaders,
|
|
8651
8669
|
publicKey: state.client._id,
|