diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte
index 524e70e329..88201aa225 100644
--- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte
+++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte
@@ -49,7 +49,7 @@
const disabled = () => {
return {
SEND_EMAIL_SMTP: {
- disabled: !$admin.checklist.smtp.checked,
+ disabled: !$admin.checklist?.smtp?.checked,
message: "Please configure SMTP",
},
COLLECT: {
diff --git a/packages/builder/src/pages/builder/admin/_layout.svelte b/packages/builder/src/pages/builder/admin/_layout.svelte
index f03a7b8285..b304d91710 100644
--- a/packages/builder/src/pages/builder/admin/_layout.svelte
+++ b/packages/builder/src/pages/builder/admin/_layout.svelte
@@ -9,7 +9,7 @@
$: useAccountPortal = cloud && !$admin.disableAccountPortal
onMount(() => {
- if ($admin?.checklist?.adminUser.checked || useAccountPortal) {
+ if ($admin?.checklist?.adminUser?.checked || useAccountPortal) {
$redirect("../")
} else {
loaded = true
diff --git a/packages/builder/src/pages/builder/portal/settings/email/index.svelte b/packages/builder/src/pages/builder/portal/settings/email/index.svelte
index 0b9fb44bac..4d76c4f49c 100644
--- a/packages/builder/src/pages/builder/portal/settings/email/index.svelte
+++ b/packages/builder/src/pages/builder/portal/settings/email/index.svelte
@@ -177,7 +177,7 @@
diff --git a/packages/builder/src/stores/portal/admin.test.js b/packages/builder/src/stores/portal/admin.test.js
index a3f1e645c3..a4adb4320a 100644
--- a/packages/builder/src/stores/portal/admin.test.js
+++ b/packages/builder/src/stores/portal/admin.test.js
@@ -1,5 +1,5 @@
import { it, expect, describe, beforeEach, vi } from "vitest"
-import { DEFAULT_CONFIG, createAdminStore } from "./admin"
+import { createAdminStore } from "./admin"
import { writable, get } from "svelte/store"
import { API } from "api"
@@ -45,11 +45,6 @@ describe("admin store", () => {
ctx.returnedStore = createAdminStore()
})
- it("inits the writable store with the default config", () => {
- expect(writable).toHaveBeenCalledTimes(1)
- expect(writable).toHaveBeenCalledWith(DEFAULT_CONFIG)
- })
-
it("returns the created store", ctx => {
expect(ctx.returnedStore).toEqual({
subscribe: expect.toBe(ctx.writableReturn.subscribe),
diff --git a/packages/builder/src/stores/portal/admin.js b/packages/builder/src/stores/portal/admin.ts
similarity index 80%
rename from packages/builder/src/stores/portal/admin.js
rename to packages/builder/src/stores/portal/admin.ts
index 54757fb314..2141cf1b9c 100644
--- a/packages/builder/src/stores/portal/admin.js
+++ b/packages/builder/src/stores/portal/admin.ts
@@ -2,27 +2,28 @@ import { writable, get } from "svelte/store"
import { API } from "api"
import { auth } from "stores/portal"
import { banner } from "@budibase/bbui"
+import {
+ ConfigChecklistResponse,
+ GetEnvironmentResponse,
+ SystemStatusResponse,
+} from "@budibase/types"
-export const DEFAULT_CONFIG = {
- loaded: false,
- multiTenancy: false,
- cloud: false,
- isDev: false,
- disableAccountPortal: false,
- accountPortalUrl: "",
- importComplete: false,
- checklist: {
- apps: { checked: false },
- smtp: { checked: false },
- adminUser: { checked: false },
- sso: { checked: false },
- },
- maintenance: [],
- offlineMode: false,
+interface PortalAdminStore extends GetEnvironmentResponse {
+ loaded: boolean
+ checklist?: ConfigChecklistResponse
+ status?: SystemStatusResponse
}
export function createAdminStore() {
- const admin = writable(DEFAULT_CONFIG)
+ const admin = writable({
+ loaded: false,
+ multiTenancy: false,
+ cloud: false,
+ isDev: false,
+ disableAccountPortal: false,
+ offlineMode: false,
+ maintenance: [],
+ })
async function init() {
await getChecklist()