studiocms 0.2.0 → 0.4.0
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/CHANGELOG.md +122 -0
- package/dist/cli/add/index.d.ts +2 -2
- package/dist/cli/add/index.js +4 -3
- package/dist/cli/add/npm-utils.d.ts +6 -6
- package/dist/cli/add/tryToInstallPlugins.d.ts +1 -1
- package/dist/cli/add/tryToInstallPlugins.js +6 -5
- package/dist/cli/add/updateStudioCMSConfig.d.ts +1 -1
- package/dist/cli/add/updateStudioCMSConfig.js +3 -4
- package/dist/cli/add/validatePlugins.d.ts +1 -2
- package/dist/cli/add/validatePlugins.js +15 -9
- package/dist/cli/crypto/genJWT/index.d.ts +1 -1
- package/dist/cli/crypto/genJWT/index.js +8 -9
- package/dist/cli/crypto/index.d.ts +1 -1
- package/dist/cli/init/steps/env.js +14 -4
- package/dist/cli/init/steps/next.d.ts +1 -1
- package/dist/cli/init/steps/next.js +6 -5
- package/dist/cli/migrator/index.d.ts +1 -1
- package/dist/cli/migrator/index.js +2 -2
- package/dist/cli/users/index.d.ts +1 -1
- package/dist/cli/users/shared.js +2 -2
- package/dist/cli/users/steps/createUsers.js +7 -7
- package/dist/cli/users/steps/modifyUsers.js +2 -2
- package/dist/cli/users/steps/next.d.ts +1 -1
- package/dist/cli/utils/checkRequiredEnvVars.js +2 -2
- package/dist/cli/utils/context.d.ts +2 -4
- package/dist/cli/utils/context.js +1 -3
- package/dist/cli/utils/getCliDbClient.d.ts +1 -1
- package/dist/cli/utils/intro.d.ts +1 -1
- package/dist/cli/utils/loadConfig.d.ts +54 -49
- package/dist/cli/utils/loadConfig.js +5 -8
- package/dist/cli/utils/logger.js +3 -3
- package/dist/cli/utils/user-utils.d.ts +1 -1
- package/dist/cli/utils/user-utils.js +4 -3
- package/dist/client/apiClient.d.ts +4923 -0
- package/dist/client/apiClient.js +72 -0
- package/dist/config.d.ts +1734 -1
- package/dist/consts.d.ts +5 -5
- package/dist/consts.js +3 -2
- package/dist/db/plugins.d.ts +1 -1
- package/dist/db/plugins.js +5 -8
- package/dist/handlers/frontend/routes.d.ts +4 -18
- package/dist/handlers/frontend/routes.js +13 -152
- package/dist/handlers/frontend/types.d.ts +1 -1
- package/dist/handlers/frontend/utils.js +0 -18
- package/dist/handlers/pluginHandler.d.ts +34 -257
- package/dist/handlers/pluginHandler.js +92 -46
- package/dist/handlers/routeHandler.js +32 -11
- package/dist/handlers/setupDbStudio.d.ts +3 -1
- package/dist/handlers/setupDbStudio.js +19 -10
- package/dist/handlers/storage-manager/core/effectify-astro-context.d.ts +25 -0
- package/dist/handlers/storage-manager/core/effectify-astro-context.js +78 -0
- package/dist/handlers/storage-manager/no-op.d.ts +2 -2
- package/dist/handlers/storage-manager/no-op.js +2 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +10 -20
- package/dist/integrations/robots/index.d.ts +2 -2
- package/dist/integrations/robots/index.js +1 -3
- package/dist/integrations/robots/schema.d.ts +102 -273
- package/dist/integrations/robots/schema.js +220 -209
- package/dist/plugins/analytics/assets/schemas.d.ts +14 -9
- package/dist/plugins/analytics/assets/schemas.js +25 -17
- package/dist/plugins/analytics/db-client.d.ts +1 -1
- package/dist/plugins/analytics/index.d.ts +823 -3
- package/dist/plugins/analytics/index.js +4 -5
- package/dist/plugins/analytics/schemas.d.ts +54 -62
- package/dist/plugins/analytics/schemas.js +64 -13
- package/dist/plugins/analytics/table.d.ts +1 -1
- package/dist/plugins.d.ts +0 -1
- package/dist/schemas/config/api.d.ts +17 -0
- package/dist/schemas/config/api.js +14 -0
- package/dist/schemas/config/auth.d.ts +55 -59
- package/dist/schemas/config/auth.js +34 -11
- package/dist/schemas/config/dashboard.d.ts +43 -79
- package/dist/schemas/config/dashboard.js +43 -12
- package/dist/schemas/config/db.d.ts +15 -17
- package/dist/schemas/config/db.js +13 -5
- package/dist/schemas/config/developer.d.ts +33 -45
- package/dist/schemas/config/developer.js +22 -5
- package/dist/schemas/config/index.d.ts +398 -521
- package/dist/schemas/config/index.js +115 -57
- package/dist/schemas/config/sdk.d.ts +50 -196
- package/dist/schemas/config/sdk.js +61 -73
- package/dist/schemas/custom.d.ts +40 -0
- package/dist/schemas/custom.js +41 -0
- package/dist/schemas/external-schemas.d.ts +171 -0
- package/dist/schemas/external-schemas.js +179 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/plugins/i18n.d.ts +59 -39
- package/dist/schemas/plugins/i18n.js +42 -5
- package/dist/schemas/plugins/index.d.ts +7126 -10296
- package/dist/schemas/plugins/index.js +260 -276
- package/dist/schemas/plugins/shared.d.ts +1293 -3718
- package/dist/schemas/plugins/shared.js +320 -329
- package/dist/test-utils.d.ts +15 -4
- package/dist/test-utils.js +27 -11
- package/dist/toolbar/db-viewer/db-shared-types.d.ts +6 -6
- package/dist/toolbar/db-viewer/studio/connection.d.ts +8 -4
- package/dist/toolbar/db-viewer/studio/connection.js +2 -28
- package/dist/toolbar/db-viewer/studio/env/libsql.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/libsql.js +17 -0
- package/dist/toolbar/db-viewer/studio/env/mysql.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/mysql.js +23 -0
- package/dist/toolbar/db-viewer/studio/env/postgres.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/postgres.js +23 -0
- package/dist/toolbar/db-viewer/studio/index.js +20 -56
- package/dist/toolbar/db-viewer/studio/type.d.ts +1 -2
- package/dist/toolbar/db-viewer/studio/virtual-connection/libsql.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/libsql.js +24 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/mysql.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/mysql.js +9 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/postgres.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/postgres.js +9 -0
- package/dist/toolbar/db-viewer/viewer.js +20 -21
- package/dist/types.d.ts +30 -0
- package/dist/utils/effects/smtp.d.ts +1 -1
- package/dist/utils/lang-helper.d.ts +10 -2
- package/dist/virtual.d.ts +35 -28
- package/dist/virtuals/auth/core.d.ts +5 -5
- package/dist/virtuals/auth/verify-email.d.ts +6 -6
- package/dist/virtuals/components/Generator.astro +2 -2
- package/dist/virtuals/components/Renderer.astro +9 -1
- package/dist/virtuals/components/renderFn.d.ts +3 -1
- package/dist/virtuals/components/renderFn.js +18 -0
- package/dist/virtuals/lib/headDefaults.d.ts +4 -2
- package/dist/virtuals/lib/headDefaults.js +0 -2
- package/dist/virtuals/lib/routeMap.d.ts +0 -12
- package/dist/virtuals/lib/routeMap.js +2 -14
- package/dist/virtuals/mailer/index.d.ts +3 -3
- package/dist/virtuals/notifier/index.d.ts +5 -5
- package/dist/virtuals/plugins/dashboard-pages.d.ts +2 -64
- package/dist/virtuals/scripts/StorageFileBrowser.d.ts +1 -172
- package/dist/virtuals/scripts/StorageFileBrowser.js +216 -119
- package/dist/virtuals/template-engine/index.d.ts +4 -4
- package/frontend/components/dashboard/configuration/ConfigForm.astro +218 -110
- package/frontend/components/dashboard/content-mgmt/ContentSearch.astro +21 -22
- package/frontend/components/dashboard/content-mgmt/CreateFolder.astro +66 -54
- package/frontend/components/dashboard/content-mgmt/CreatePage.astro +58 -104
- package/frontend/components/dashboard/content-mgmt/EditFolder.astro +65 -67
- package/frontend/components/dashboard/content-mgmt/EditPage.astro +86 -134
- package/frontend/components/dashboard/content-mgmt/InnerSidebarElement.astro +0 -1
- package/frontend/components/dashboard/content-mgmt/PageHeader.astro +33 -52
- package/frontend/components/dashboard/content-mgmt/PageTypeHandler.astro +2 -2
- package/frontend/components/dashboard/profile/APITokens.astro +219 -158
- package/frontend/components/dashboard/profile/BasicInfo.astro +165 -106
- package/frontend/components/dashboard/profile/Notifications.astro +27 -18
- package/frontend/components/dashboard/profile/UpdatePassword.astro +134 -94
- package/frontend/components/dashboard/sidebar/VersionCheck.astro +31 -16
- package/frontend/components/dashboard/sidebar/VersionCheckChangelog.astro +18 -11
- package/frontend/components/dashboard/sidebar-modals/VersionModal.astro +2 -2
- package/frontend/components/dashboard/smtp-config/TemplateEditor.astro +14 -14
- package/frontend/components/dashboard/taxonomy/InnerSidebarElement.astro +0 -1
- package/frontend/components/dashboard/taxonomy/MetaContainer.astro +0 -2
- package/frontend/components/dashboard/taxonomy/PageHeader.astro +16 -24
- package/frontend/components/dashboard/taxonomy/TaxonomySearch.astro +23 -27
- package/frontend/components/dashboard/user-mgmt/InnerSidebarElement.astro +111 -104
- package/frontend/components/dashboard/user-mgmt/UserListItem.astro +9 -22
- package/frontend/components/dashboard/user-mgmt/UserListItems.astro +18 -0
- package/frontend/components/first-time-setup/snippets/{opt2-studiocms.config.diff → studiocms.config.diff} +1 -0
- package/frontend/components/shared/Code.astro +1 -4
- package/frontend/components/shared/DynamicSettingsRenderer.astro +1 -1
- package/frontend/components/shared/SSRUser.astro +2 -4
- package/frontend/components/shared/foldertree/FolderTreeNode.astro +0 -6
- package/frontend/components/shared/storage-manager/StorageCopyOutput.astro +0 -1
- package/frontend/components/shared/taxonomy/TaxonomyTreeNode.astro +0 -6
- package/frontend/layouts/DashboardLayout.astro +1 -10
- package/frontend/layouts/TaxonomyLayout.astro +0 -1
- package/frontend/middleware/index.ts +102 -61
- package/frontend/pages/404.astro +5 -9
- package/frontend/pages/[dashboard]/[...pluginPage].astro +10 -1
- package/frontend/pages/[dashboard]/configuration.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/createfolder.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/createpage.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/diff.astro +39 -14
- package/frontend/pages/[dashboard]/content-management/editfolder.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/editpage.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/index.astro +10 -1
- package/frontend/pages/[dashboard]/index.astro +10 -1
- package/frontend/pages/[dashboard]/login.astro +86 -25
- package/frontend/pages/[dashboard]/password-reset.astro +22 -16
- package/frontend/pages/[dashboard]/plugins/[plugin].astro +10 -1
- package/frontend/pages/[dashboard]/profile.astro +10 -1
- package/frontend/pages/[dashboard]/signup.astro +153 -52
- package/frontend/pages/[dashboard]/smtp-configuration.astro +77 -75
- package/frontend/pages/[dashboard]/system-management.astro +10 -1
- package/frontend/pages/[dashboard]/taxonomy/categories.astro +30 -41
- package/frontend/pages/[dashboard]/taxonomy/index.astro +10 -0
- package/frontend/pages/[dashboard]/taxonomy/tags.astro +33 -43
- package/frontend/pages/[dashboard]/unverified-email.astro +29 -21
- package/frontend/pages/[dashboard]/user-management/edit.astro +170 -90
- package/frontend/pages/[dashboard]/user-management/index.astro +10 -1
- package/frontend/pages/studiocms_api/[...all].ts +106 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/auth.ts +26 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/changelog.ts +147 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/db-studio-driver.ts +46 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/parseLogLevel.ts +27 -0
- package/frontend/pages/studiocms_api/_handlers/auth/auth.ts +459 -0
- package/frontend/pages/studiocms_api/_handlers/auth/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/auth/oauth.ts +91 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/_shared.ts +57 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/apiTokens.ts +134 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/config.ts +64 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/content.ts +741 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/create.ts +480 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/emailNotifications.ts +49 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/index.ts +45 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/mailer.ts +136 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/plugins.ts +80 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/profile.ts +275 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/resetPassword.ts +140 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/search.ts +63 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/taxonomy.ts +285 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/templates.ts +75 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/users.ts +312 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/verifyEndpoints.ts +307 -0
- package/frontend/pages/studiocms_api/_handlers/integration/dbStudio.ts +98 -0
- package/frontend/pages/studiocms_api/_handlers/integration/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/integration/storageManager.ts +107 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/index.ts +8 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/_shared.ts +41 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/public.ts +195 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/secure.ts +1726 -0
- package/frontend/pages/studiocms_api/_handlers/sdk.ts +129 -0
- package/frontend/pages/studiocms_api/_middleware/astroLocals.ts +36 -0
- package/frontend/pages/studiocms_api/_middleware/restApi.ts +56 -0
- package/frontend/pages/studiocms_api/integrations/[...all].ts +8 -0
- package/frontend/scripts/formdata.ts +219 -0
- package/frontend/setup-pages/3-done.astro +4 -20
- package/frontend/setup-pages/studiocms_api/dashboard/step-2.ts +3 -6
- package/frontend/styles/dashboard-base.css +0 -1
- package/frontend/web-vitals/endpoint.ts +2 -1
- package/package.json +35 -31
- package/dist/global.d.ts +0 -9
- package/frontend/components/dashboard/LoginChecker.astro +0 -68
- package/frontend/components/dashboard/user-mgmt/RankCheck.astro +0 -57
- package/frontend/components/first-time-setup/snippets/opt1-astro.config.diff +0 -14
- package/frontend/components/first-time-setup/snippets/opt2-astro.config.diff +0 -9
- package/frontend/middleware/_authmap.ts +0 -63
- package/frontend/pages/studiocms_api/auth/[path].ts +0 -390
- package/frontend/pages/studiocms_api/auth/[provider]/[...id].ts +0 -64
- package/frontend/pages/studiocms_api/auth/[provider]/_effects/index.ts +0 -101
- package/frontend/pages/studiocms_api/auth/_shared.ts +0 -52
- package/frontend/pages/studiocms_api/dashboard/api-tokens.ts +0 -115
- package/frontend/pages/studiocms_api/dashboard/config.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/content/diff.ts +0 -73
- package/frontend/pages/studiocms_api/dashboard/content/folder.ts +0 -220
- package/frontend/pages/studiocms_api/dashboard/content/page.ts +0 -359
- package/frontend/pages/studiocms_api/dashboard/create-reset-link.ts +0 -77
- package/frontend/pages/studiocms_api/dashboard/create-user-invite.ts +0 -231
- package/frontend/pages/studiocms_api/dashboard/create-user.ts +0 -186
- package/frontend/pages/studiocms_api/dashboard/email-notification-settings-site.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/mailer/check-email.ts +0 -75
- package/frontend/pages/studiocms_api/dashboard/mailer/config.ts +0 -136
- package/frontend/pages/studiocms_api/dashboard/plugins/[plugin].ts +0 -80
- package/frontend/pages/studiocms_api/dashboard/profile.ts +0 -245
- package/frontend/pages/studiocms_api/dashboard/resend-verify-email.ts +0 -77
- package/frontend/pages/studiocms_api/dashboard/reset-password.ts +0 -124
- package/frontend/pages/studiocms_api/dashboard/search-list.ts +0 -59
- package/frontend/pages/studiocms_api/dashboard/taxonomy-search.ts +0 -47
- package/frontend/pages/studiocms_api/dashboard/taxonomy.ts +0 -230
- package/frontend/pages/studiocms_api/dashboard/templates.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/update-user-notifications.ts +0 -86
- package/frontend/pages/studiocms_api/dashboard/users.ts +0 -236
- package/frontend/pages/studiocms_api/dashboard/verify-email.ts +0 -83
- package/frontend/pages/studiocms_api/dashboard/verify-session.ts +0 -187
- package/frontend/pages/studiocms_api/integrations/[type]/[...id].ts +0 -15
- package/frontend/pages/studiocms_api/integrations/[type]/_routes/db-studio.ts +0 -173
- package/frontend/pages/studiocms_api/integrations/[type]/_routes/storage.ts +0 -88
- package/frontend/pages/studiocms_api/partials/editor.astro +0 -74
- package/frontend/pages/studiocms_api/partials/render.astro +0 -39
- package/frontend/pages/studiocms_api/partials/user-list-items.astro +0 -43
- package/frontend/pages/studiocms_api/rest/utils/auth-token.ts +0 -59
- package/frontend/pages/studiocms_api/rest/v1/[type]/[...id].ts +0 -23
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/categories.ts +0 -267
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/folders.ts +0 -283
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/pages.ts +0 -505
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/settings.ts +0 -100
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/tags.ts +0 -229
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/users.ts +0 -553
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/[...id].ts +0 -19
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/categories.ts +0 -74
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/folders.ts +0 -85
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/pages.ts +0 -103
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/tags.ts +0 -67
- package/frontend/pages/studiocms_api/sdk/[...path].ts +0 -97
- package/frontend/pages/studiocms_api/sdk/utils/changelog.ts +0 -119
- package/frontend/scripts/auth/formListener.ts +0 -81
- package/frontend/scripts/formdata-utils.ts +0 -116
- package/frontend/utils/build-partial-schema.ts +0 -46
- package/frontend/utils/errors.ts +0 -6
- package/frontend/utils/param-extractor.ts +0 -83
- package/frontend/utils/rest-router.ts +0 -444
|
@@ -37,7 +37,9 @@ const status: false | 'outdated' | 'latest' | 'future' = (() => {
|
|
|
37
37
|
import { dateTimeListener } from "../../../scripts/dateTimeListener.js";
|
|
38
38
|
import { dateWithTimeAndZone } from "../../../scripts/dateWithTimeAndZone.js";
|
|
39
39
|
import { timeAgo } from "../../../scripts/timeAgo.js";
|
|
40
|
-
|
|
40
|
+
import * as Effect from 'effect/Effect';
|
|
41
|
+
import { sdkClient } from 'studiocms:client/apiClients';
|
|
42
|
+
import { toast } from 'studiocms:ui/components/toaster/client';
|
|
41
43
|
|
|
42
44
|
function setupVersionChecker() {
|
|
43
45
|
const reloadButton = document.getElementById(
|
|
@@ -70,21 +72,34 @@ const status: false | 'outdated' | 'latest' | 'future' = (() => {
|
|
|
70
72
|
new ModalHelper("version-modal", "version-modal-trigger");
|
|
71
73
|
|
|
72
74
|
reloadButton.addEventListener("click", async () => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
reloadButton.disabled = true;
|
|
76
|
+
|
|
77
|
+
type FailureVersionResponse = {
|
|
78
|
+
readonly success: false;
|
|
79
|
+
readonly latestVersion: null;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const { latestVersion, success } = await Effect.orElse(
|
|
83
|
+
sdkClient.pipe(Effect.flatMap((client) =>
|
|
84
|
+
client.sdk.updateLatestVersionCache()
|
|
85
|
+
)),
|
|
86
|
+
() => Effect.succeed({ success: false, latestVersion: null } as FailureVersionResponse)
|
|
87
|
+
).pipe(Effect.runPromise);
|
|
88
|
+
|
|
89
|
+
if (success) {
|
|
90
|
+
latestVersionElem.textContent = `v${latestVersion.version}`;
|
|
91
|
+
timeElem.dateTime = new Date(latestVersion.lastCacheUpdate).toISOString();
|
|
92
|
+
timeElem.textContent = dateWithTimeAndZone(new Date(latestVersion.lastCacheUpdate));
|
|
93
|
+
latestUpdateCheck.textContent = `(${timeAgo(new Date(latestVersion.lastCacheUpdate))})`;
|
|
94
|
+
|
|
95
|
+
reloadButton.disabled = false;
|
|
96
|
+
} else {
|
|
97
|
+
reloadButton.disabled = false;
|
|
98
|
+
toast({
|
|
99
|
+
title: "Failed to update version check",
|
|
100
|
+
description: "Please try again later.",
|
|
101
|
+
type: "danger",
|
|
102
|
+
});
|
|
88
103
|
}
|
|
89
104
|
});
|
|
90
105
|
}
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
import css from '@studiocms/ui/css/prose.css?raw';
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
|
-
link: string;
|
|
6
5
|
changelog: string;
|
|
7
6
|
}
|
|
8
7
|
|
|
9
|
-
const {
|
|
8
|
+
const { changelog } = Astro.props;
|
|
10
9
|
---
|
|
11
10
|
|
|
12
|
-
<frame-button data-
|
|
11
|
+
<frame-button data-changelog={changelog} data-styles={css}>
|
|
13
12
|
<slot />
|
|
14
13
|
</frame-button>
|
|
15
14
|
|
|
16
15
|
<script>
|
|
16
|
+
import * as Effect from 'effect/Effect';
|
|
17
|
+
import { sdkClient } from 'studiocms:client/apiClients';
|
|
18
|
+
|
|
17
19
|
if (!customElements.get('frame-button')) {
|
|
18
20
|
|
|
19
21
|
class FrameButton extends HTMLElement {
|
|
@@ -81,15 +83,20 @@ const { link, changelog } = Astro.props;
|
|
|
81
83
|
});
|
|
82
84
|
|
|
83
85
|
slot.addEventListener('click', async () => {
|
|
86
|
+
const { changelog } = await Effect.orElse(
|
|
87
|
+
sdkClient.pipe(Effect.flatMap((client) =>
|
|
88
|
+
client.sdk.fullChangelog({
|
|
89
|
+
payload: { currentURLOrigin: window.location.origin },
|
|
90
|
+
})
|
|
91
|
+
)),
|
|
92
|
+
() => Effect.succeed({
|
|
93
|
+
success: false,
|
|
94
|
+
changelog: 'Failed to load changelog. Please try again later.'
|
|
95
|
+
})
|
|
96
|
+
).pipe(
|
|
97
|
+
Effect.runPromise
|
|
98
|
+
);
|
|
84
99
|
const changelogLink = this.getAttribute('data-changelog')!;
|
|
85
|
-
const link = this.getAttribute('data-link')!;
|
|
86
|
-
const { changelog } = await (await fetch(link, {
|
|
87
|
-
method: 'POST',
|
|
88
|
-
headers: {
|
|
89
|
-
'Content-Type': 'application/json',
|
|
90
|
-
},
|
|
91
|
-
body: JSON.stringify({ currentURLOrigin: window.location.origin }),
|
|
92
|
-
})).json();
|
|
93
100
|
const styles = this.getAttribute('data-styles')!;
|
|
94
101
|
|
|
95
102
|
frameContent.innerHTML = `
|
|
@@ -25,7 +25,7 @@ const lastChecked = new Date(Astro.locals.StudioCMS.latestVersion.lastCacheUpdat
|
|
|
25
25
|
|
|
26
26
|
<h2 slot="header" class="inline-title">
|
|
27
27
|
<span><t-vcm key="header-title">{t('header-title')}</t-vcm></span>
|
|
28
|
-
<button
|
|
28
|
+
<button
|
|
29
29
|
id="version-modal-reload"
|
|
30
30
|
class="reload-button"
|
|
31
31
|
title="Check for updates"
|
|
@@ -58,7 +58,7 @@ const lastChecked = new Date(Astro.locals.StudioCMS.latestVersion.lastCacheUpdat
|
|
|
58
58
|
<div class="version-modal-release-notes">
|
|
59
59
|
<div class="prose"><Fragment set:html={parseMarkdown(changelog)} /></div>
|
|
60
60
|
<span class="release-notes-read-more">
|
|
61
|
-
<VersionCheckChangelog changelog={studioCMSSocials.changelog}
|
|
61
|
+
<VersionCheckChangelog changelog={studioCMSSocials.changelog}><span class="read-more-text"><t-vcm key="full-changelog">{t('full-changelog')}</t-vcm></span></VersionCheckChangelog>
|
|
62
62
|
</span>
|
|
63
63
|
</div>
|
|
64
64
|
|
|
@@ -11,8 +11,6 @@ interface Props {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const { templateKeys, templates, defaultTemplates, t } = Astro.props;
|
|
14
|
-
|
|
15
|
-
const templateSaveAPIEndpoint = Astro.locals.StudioCMS.routeMap.endpointLinks.templates;
|
|
16
14
|
---
|
|
17
15
|
|
|
18
16
|
<Modal id='template-editor-preview-modal' size='lg'>
|
|
@@ -44,7 +42,6 @@ const templateSaveAPIEndpoint = Astro.locals.StudioCMS.routeMap.endpointLinks.te
|
|
|
44
42
|
data-templates={JSON.stringify(templates)}
|
|
45
43
|
data-template-keys={JSON.stringify(templateKeys)}
|
|
46
44
|
data-default-templates={JSON.stringify(defaultTemplates)}
|
|
47
|
-
data-save-endpoint={templateSaveAPIEndpoint}
|
|
48
45
|
></div>
|
|
49
46
|
|
|
50
47
|
<script>
|
|
@@ -83,6 +80,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
83
80
|
import { $i18n, baseTranslation, updateSelectOptions } from 'studiocms:i18n/client';
|
|
84
81
|
import { ModalHelper } from 'studiocms:ui/components/modal/client';
|
|
85
82
|
import { toast } from 'studiocms:ui/components/toaster/client';
|
|
83
|
+
import { dashboardClient, dashboardSharedCatchTags } from "studiocms:client/apiClients";
|
|
84
|
+
import * as Effect from "effect/Effect";
|
|
86
85
|
import 'ace-builds/src-noconflict/ace';
|
|
87
86
|
import 'ace-builds/src-noconflict/mode-handlebars';
|
|
88
87
|
import 'ace-builds/src-noconflict/theme-cloud_editor';
|
|
@@ -151,7 +150,6 @@ const defaultTemplates = JSON.parse(templateEditor.dataset.defaultTemplates || '
|
|
|
151
150
|
string,
|
|
152
151
|
string
|
|
153
152
|
>;
|
|
154
|
-
const saveEndpoint = templateEditor.dataset.saveEndpoint as string;
|
|
155
153
|
|
|
156
154
|
// --- INTERNATIONALIZATION SETUP ---
|
|
157
155
|
const i18n = $i18n(i18nCurrentPage, baseTranslation[i18nCurrentPage]);
|
|
@@ -243,16 +241,18 @@ async function saveTemplate(templateKey: string, content: string) {
|
|
|
243
241
|
const allTemplates = { ...templates, [templateKey]: content };
|
|
244
242
|
|
|
245
243
|
try {
|
|
246
|
-
const response = await
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
244
|
+
const response = await dashboardClient.pipe(
|
|
245
|
+
Effect.flatMap((client) =>
|
|
246
|
+
client.templates.updateEmailTemplates({
|
|
247
|
+
payload: allTemplates,
|
|
248
|
+
})
|
|
249
|
+
),
|
|
250
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
251
|
+
Effect.runPromise,
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
if ('error' in response) {
|
|
255
|
+
throw new Error(`${t['template-editor-save-failed']}: ${response.error}`);
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
displaySuccessToastThenReload(t['template-editor-save-success']);
|
|
@@ -108,7 +108,6 @@ const tagData = tagsToTaxonomyNodes(tags);
|
|
|
108
108
|
id="inner-sidebar-items-search"
|
|
109
109
|
class="folder-tree-search-container scrollbar"
|
|
110
110
|
style="display: none;"
|
|
111
|
-
data-searchlist={Astro.locals.StudioCMS.routeMap.endpointLinks.taxonomySearch}
|
|
112
111
|
data-base-category-link={Astro.locals.StudioCMS.routeMap.mainLinks.taxonomyCategories}
|
|
113
112
|
data-base-tag-link={Astro.locals.StudioCMS.routeMap.mainLinks.taxonomyTags}
|
|
114
113
|
>
|
|
@@ -180,8 +180,10 @@ const replaceNameParam = (str: string) => str.replace('{name}', pageTitle);
|
|
|
180
180
|
></div>
|
|
181
181
|
|
|
182
182
|
<script>
|
|
183
|
+
import { dashboardClient, dashboardSharedCatchTags } from 'studiocms:client/apiClients';
|
|
183
184
|
import { ModalHelper } from 'studiocms:ui/components/modal/client';
|
|
184
185
|
import { toast } from "studiocms:ui/components/toaster/client";
|
|
186
|
+
import * as Effect from "effect/Effect";
|
|
185
187
|
|
|
186
188
|
function setup() {
|
|
187
189
|
const modeSelectorEl = document.getElementById('current-mode-selector') as HTMLDivElement;
|
|
@@ -232,10 +234,10 @@ const replaceNameParam = (str: string) => str.replace('{name}', pageTitle);
|
|
|
232
234
|
|
|
233
235
|
const { actionRoute, slug, confirmSlug, ...jsonData } = {
|
|
234
236
|
type: type,
|
|
235
|
-
id: formData.get('id'),
|
|
236
|
-
actionRoute: formData.get('action-route'),
|
|
237
|
-
slug: formData.get('slug'),
|
|
238
|
-
confirmSlug: formData.get('confirm-slug'),
|
|
237
|
+
id: formData.get('id')?.toString() || '',
|
|
238
|
+
actionRoute: formData.get('action-route')?.toString(),
|
|
239
|
+
slug: formData.get('slug')?.toString(),
|
|
240
|
+
confirmSlug: formData.get('confirm-slug')?.toString(),
|
|
239
241
|
}
|
|
240
242
|
|
|
241
243
|
if (!actionRoute || typeof actionRoute !== 'string') {
|
|
@@ -288,25 +290,22 @@ const replaceNameParam = (str: string) => str.replace('{name}', pageTitle);
|
|
|
288
290
|
id: Number.parseInt(jsonData.id, 10),
|
|
289
291
|
}
|
|
290
292
|
|
|
291
|
-
const response = await
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
293
|
+
const response = await dashboardClient.pipe(
|
|
294
|
+
Effect.flatMap((client) => client.taxonomy.taxonomyDelete({
|
|
295
|
+
payload: parsedJsonData,
|
|
296
|
+
})),
|
|
297
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
298
|
+
Effect.runPromise
|
|
299
|
+
);
|
|
298
300
|
|
|
299
|
-
if (
|
|
300
|
-
const errorData = await response.json();
|
|
301
|
+
if ('error' in response) {
|
|
301
302
|
toast({
|
|
302
303
|
title: 'Error',
|
|
303
|
-
description:
|
|
304
|
+
description: response.error,
|
|
304
305
|
type: 'danger',
|
|
305
306
|
});
|
|
306
307
|
return;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
if (response.ok) {
|
|
308
|
+
} else {
|
|
310
309
|
toast({
|
|
311
310
|
title: 'Success',
|
|
312
311
|
description: `Deleted ${type === 'categories' ? 'category' : 'tag'} successfully.`,
|
|
@@ -317,13 +316,6 @@ const replaceNameParam = (str: string) => str.replace('{name}', pageTitle);
|
|
|
317
316
|
window.location.href = indexPage;
|
|
318
317
|
return;
|
|
319
318
|
}
|
|
320
|
-
|
|
321
|
-
toast({
|
|
322
|
-
title: 'Error',
|
|
323
|
-
description: 'An unexpected error occurred during deletion.',
|
|
324
|
-
type: 'danger',
|
|
325
|
-
});
|
|
326
|
-
return;
|
|
327
319
|
})
|
|
328
320
|
break;
|
|
329
321
|
}
|
|
@@ -33,6 +33,8 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-sidebar');
|
|
|
33
33
|
baseTranslation,
|
|
34
34
|
updateElmPlaceholder,
|
|
35
35
|
} from "studiocms:i18n/client";
|
|
36
|
+
import { dashboardClient } from "studiocms:client/apiClients";
|
|
37
|
+
import * as Effect from "effect/Effect";
|
|
36
38
|
|
|
37
39
|
const currentPage = "@studiocms/dashboard:content-sidebar";
|
|
38
40
|
|
|
@@ -53,19 +55,19 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-sidebar');
|
|
|
53
55
|
const searchOutputEl = $<HTMLDivElement>(`#${searchOutputElId}`);
|
|
54
56
|
|
|
55
57
|
interface TaxonomyNode {
|
|
56
|
-
id: number;
|
|
57
|
-
name: string;
|
|
58
|
-
slug: string;
|
|
59
|
-
description: string;
|
|
60
|
-
meta: {
|
|
58
|
+
readonly id: number;
|
|
59
|
+
readonly name: string;
|
|
60
|
+
readonly slug: string;
|
|
61
|
+
readonly description: string;
|
|
62
|
+
readonly meta: {
|
|
61
63
|
readonly [x: string]: unknown;
|
|
62
64
|
};
|
|
63
|
-
parent: number | null | undefined;
|
|
64
|
-
children: TaxonomyNode[];
|
|
65
|
-
type: 'category' | 'tag';
|
|
65
|
+
readonly parent: number | null | undefined;
|
|
66
|
+
readonly children: readonly TaxonomyNode[];
|
|
67
|
+
readonly type: 'category' | 'tag';
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
type SearchList = TaxonomyNode[];
|
|
70
|
+
type SearchList = readonly TaxonomyNode[];
|
|
69
71
|
|
|
70
72
|
function getIcons(item: TaxonomyNode) {
|
|
71
73
|
switch (item.type) {
|
|
@@ -85,24 +87,18 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-sidebar');
|
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
async function getSearchList(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
async function getSearchList(): Promise<SearchList> {
|
|
91
|
+
return await Effect.runPromise(
|
|
92
|
+
Effect.orElse(
|
|
93
|
+
dashboardClient.pipe(
|
|
94
|
+
Effect.flatMap((client) => client.taxonomy.taxonomySearch({})),
|
|
95
|
+
Effect.tapError(Effect.logError)
|
|
96
|
+
),
|
|
97
|
+
() => Effect.log("Failed to fetch search list, returning empty array").pipe(
|
|
98
|
+
Effect.as([] as SearchList)
|
|
99
|
+
)
|
|
100
|
+
)
|
|
97
101
|
);
|
|
98
|
-
|
|
99
|
-
if (response.ok) {
|
|
100
|
-
const data: SearchList = await response.json();
|
|
101
|
-
return data;
|
|
102
|
-
} else {
|
|
103
|
-
console.error("Failed to fetch search list");
|
|
104
|
-
return [];
|
|
105
|
-
}
|
|
106
102
|
}
|
|
107
103
|
|
|
108
104
|
function clearSearchParams(innerSidebarItemsSearch: HTMLDivElement) {
|
|
@@ -176,7 +172,7 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-sidebar');
|
|
|
176
172
|
currentUrl.searchParams.set("search", searchTerm);
|
|
177
173
|
window.history.pushState({}, "", currentUrl);
|
|
178
174
|
|
|
179
|
-
const searchList = await getSearchList(
|
|
175
|
+
const searchList = await getSearchList();
|
|
180
176
|
|
|
181
177
|
const fuse = new Fuse(searchList, {
|
|
182
178
|
keys: ["name", "slug"],
|