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
|
@@ -71,7 +71,6 @@ const t = useTranslations(lang, '@studiocms/dashboard:user-mngmt-sidebar');
|
|
|
71
71
|
|
|
72
72
|
<div id="user-list"
|
|
73
73
|
class="inner-sidebar-users scrollbar"
|
|
74
|
-
data-userpartial={Astro.locals.StudioCMS.routeMap.endpointLinks.partials.userListItems}
|
|
75
74
|
data-users={JSON.stringify(safeUsers)}
|
|
76
75
|
>
|
|
77
76
|
{ Users.map((user) => <UserListItem user={user} />) }
|
|
@@ -80,17 +79,10 @@ const t = useTranslations(lang, '@studiocms/dashboard:user-mngmt-sidebar');
|
|
|
80
79
|
<div id="search-list"
|
|
81
80
|
class="inner-sidebar-users scrollbar"
|
|
82
81
|
style="display: none;"
|
|
83
|
-
data-userpartial={Astro.locals.StudioCMS.routeMap.endpointLinks.partials.userListItems}
|
|
84
82
|
data-users={JSON.stringify(safeUsers)}
|
|
85
83
|
>
|
|
86
84
|
</div>
|
|
87
85
|
|
|
88
|
-
<div id="new-users-links"
|
|
89
|
-
style="display: none;"
|
|
90
|
-
data-create_user={Astro.locals.StudioCMS.routeMap.endpointLinks.newUsers.create}
|
|
91
|
-
data-create_invite={Astro.locals.StudioCMS.routeMap.endpointLinks.newUsers.invite}
|
|
92
|
-
></div>
|
|
93
|
-
|
|
94
86
|
<script>
|
|
95
87
|
import {
|
|
96
88
|
$i18n,
|
|
@@ -145,6 +137,9 @@ const t = useTranslations(lang, '@studiocms/dashboard:user-mngmt-sidebar');
|
|
|
145
137
|
import { DropdownHelper } from 'studiocms:ui/components/dropdown/client';
|
|
146
138
|
import { ModalHelper } from 'studiocms:ui/components/modal/client';
|
|
147
139
|
import { toast } from 'studiocms:ui/components/toaster/client';
|
|
140
|
+
import { dashboardClient, dashboardSharedCatchTags } from "studiocms:client/apiClients";
|
|
141
|
+
import * as Effect from "effect/Effect";
|
|
142
|
+
import { availablePermissionRanks, type AvailablePermissionRanks } from '@withstudiocms/auth-kit/types';
|
|
148
143
|
|
|
149
144
|
const createNewDropdown = new DropdownHelper('create-user-dropdown');
|
|
150
145
|
const createNewUserModal = new ModalHelper('create-new-user-modal');
|
|
@@ -154,10 +149,9 @@ const t = useTranslations(lang, '@studiocms/dashboard:user-mngmt-sidebar');
|
|
|
154
149
|
|
|
155
150
|
const inviteResponsePlaceholder = document.getElementById('invite-response-placeholder') as HTMLElement;
|
|
156
151
|
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const createUserInviteLink = newUsersLinks.dataset.create_invite as string;
|
|
152
|
+
const isValidRank = (rank: string): rank is AvailablePermissionRanks => {
|
|
153
|
+
return availablePermissionRanks.includes(rank as AvailablePermissionRanks);
|
|
154
|
+
}
|
|
161
155
|
|
|
162
156
|
createNewDropdown.registerClickCallback((value) => {
|
|
163
157
|
if (value === 'new-user') {
|
|
@@ -168,107 +162,122 @@ const t = useTranslations(lang, '@studiocms/dashboard:user-mngmt-sidebar');
|
|
|
168
162
|
});
|
|
169
163
|
|
|
170
164
|
createNewUserModal.registerConfirmCallback(async (formData) => {
|
|
171
|
-
const username = formData?.get('create-new-username');
|
|
172
|
-
const email = formData?.get('create-new-email');
|
|
173
|
-
const password = formData?.get('create-new-password');
|
|
174
|
-
const displayname = formData?.get('create-new-display_name');
|
|
175
|
-
const rank = formData?.get('create-new-rank');
|
|
176
|
-
|
|
177
|
-
const data = {
|
|
178
|
-
username,
|
|
179
|
-
email,
|
|
180
|
-
password,
|
|
181
|
-
displayname,
|
|
182
|
-
rank
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const apiResponse = await fetch(createNewUserLink, {
|
|
186
|
-
method: 'POST',
|
|
187
|
-
headers: {
|
|
188
|
-
'Content-Type': 'application/json',
|
|
189
|
-
},
|
|
190
|
-
body: JSON.stringify(data),
|
|
191
|
-
});
|
|
165
|
+
const username = formData?.get('create-new-username')?.toString() as string | null;
|
|
166
|
+
const email = formData?.get('create-new-email')?.toString() as string | null;
|
|
167
|
+
const password = formData?.get('create-new-password')?.toString() as string | null;
|
|
168
|
+
const displayname = formData?.get('create-new-display_name')?.toString() as string | null;
|
|
169
|
+
const rank = formData?.get('create-new-rank')?.toString() as string | null;
|
|
192
170
|
|
|
193
|
-
|
|
171
|
+
if (!username || !email || !password || !displayname || !rank) {
|
|
172
|
+
toast({
|
|
173
|
+
title: 'Please fill out all fields.',
|
|
174
|
+
type: 'warning',
|
|
175
|
+
});
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
194
178
|
|
|
195
|
-
if (!
|
|
196
|
-
|
|
179
|
+
if (!isValidRank(rank)) {
|
|
180
|
+
toast({
|
|
181
|
+
title: 'Invalid rank provided.',
|
|
182
|
+
type: 'danger',
|
|
183
|
+
});
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const response = await dashboardClient.pipe(
|
|
188
|
+
Effect.flatMap((client) => client.create.createUser({
|
|
189
|
+
payload: {
|
|
190
|
+
username,
|
|
191
|
+
email,
|
|
192
|
+
password,
|
|
193
|
+
displayname,
|
|
194
|
+
rank,
|
|
195
|
+
originalUrl: window.location.origin
|
|
196
|
+
}
|
|
197
|
+
})),
|
|
198
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
199
|
+
Effect.runPromise
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
if ('error' in response) {
|
|
203
|
+
console.error('Failed to create new user', response.error);
|
|
197
204
|
toast({
|
|
198
205
|
title: 'Failed to create new user',
|
|
199
206
|
description: response.error,
|
|
200
207
|
type: 'danger',
|
|
201
208
|
})
|
|
202
209
|
return;
|
|
210
|
+
} else {
|
|
211
|
+
createNewUserModal.hide();
|
|
212
|
+
toast({
|
|
213
|
+
title: 'User created successfully.',
|
|
214
|
+
type: 'success',
|
|
215
|
+
});
|
|
216
|
+
return;
|
|
203
217
|
}
|
|
204
|
-
|
|
205
|
-
createNewUserModal.hide();
|
|
206
|
-
toast({
|
|
207
|
-
title: 'User created successfully.',
|
|
208
|
-
type: 'success',
|
|
209
|
-
});
|
|
210
218
|
});
|
|
211
219
|
|
|
212
220
|
createUserInviteModal.registerConfirmCallback(async (formData) => {
|
|
213
|
-
const username = formData?.get('create-user-invite-username');
|
|
214
|
-
const email = formData?.get('create-user-invite-email');
|
|
215
|
-
const displayname = formData?.get('create-user-invite-display_name');
|
|
216
|
-
const rank = formData?.get('create-user-invite-rank');
|
|
217
|
-
|
|
218
|
-
const data = {
|
|
219
|
-
username,
|
|
220
|
-
email,
|
|
221
|
-
displayname,
|
|
222
|
-
rank,
|
|
223
|
-
originalUrl: window.location.origin
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
const apiResponse = await fetch(createUserInviteLink, {
|
|
227
|
-
method: 'POST',
|
|
228
|
-
headers: {
|
|
229
|
-
'Content-Type': 'application/json',
|
|
230
|
-
},
|
|
231
|
-
body: JSON.stringify(data),
|
|
232
|
-
});
|
|
221
|
+
const username = formData?.get('create-user-invite-username')?.toString() as string | null;
|
|
222
|
+
const email = formData?.get('create-user-invite-email')?.toString() as string | null;
|
|
223
|
+
const displayname = formData?.get('create-user-invite-display_name')?.toString() as string | null;
|
|
224
|
+
const rank = formData?.get('create-user-invite-rank')?.toString() as string | null;
|
|
233
225
|
|
|
234
|
-
|
|
226
|
+
if (!username || !email || !displayname || !rank) {
|
|
227
|
+
toast({
|
|
228
|
+
title: 'Please fill out all fields.',
|
|
229
|
+
type: 'warning',
|
|
230
|
+
});
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (!isValidRank(rank)) {
|
|
235
|
+
toast({
|
|
236
|
+
title: 'Invalid rank provided.',
|
|
237
|
+
type: 'danger',
|
|
238
|
+
});
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const response = await dashboardClient.pipe(
|
|
243
|
+
Effect.flatMap((client) => client.create.createUserInvite({
|
|
244
|
+
payload: {
|
|
245
|
+
username,
|
|
246
|
+
email,
|
|
247
|
+
displayname,
|
|
248
|
+
rank,
|
|
249
|
+
originalUrl: window.location.origin
|
|
250
|
+
}
|
|
251
|
+
})),
|
|
252
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
253
|
+
Effect.runPromise
|
|
254
|
+
);
|
|
235
255
|
|
|
236
|
-
if (
|
|
237
|
-
console.error('Failed to create new user invite');
|
|
256
|
+
if ('error' in response) {
|
|
257
|
+
console.error('Failed to create new user invite', response.error);
|
|
238
258
|
toast({
|
|
239
259
|
title: 'Failed to create new user invite',
|
|
240
260
|
description: response.error,
|
|
241
261
|
type: 'danger',
|
|
242
262
|
})
|
|
243
263
|
return;
|
|
264
|
+
} else {
|
|
265
|
+
inviteResponsePlaceholder.innerText = response.message;
|
|
266
|
+
createUserInviteModal.hide();
|
|
267
|
+
inviteResponseModal.show();
|
|
268
|
+
return;
|
|
244
269
|
}
|
|
245
|
-
|
|
246
|
-
inviteResponsePlaceholder.innerText = response.message;
|
|
247
|
-
|
|
248
|
-
createUserInviteModal.hide();
|
|
249
|
-
inviteResponseModal.show();
|
|
250
270
|
});
|
|
251
271
|
</script>
|
|
252
272
|
|
|
253
273
|
<script>
|
|
254
274
|
import DOMPurify from "dompurify";
|
|
255
275
|
import Fuse from "fuse.js";
|
|
276
|
+
import { sdkClient } from "studiocms:client/apiClients";
|
|
277
|
+
import * as Effect from "effect/Effect";
|
|
278
|
+
import type { CombinedUserData } from "studiocms:sdk/types";
|
|
256
279
|
|
|
257
|
-
type
|
|
258
|
-
id: string;
|
|
259
|
-
name: string;
|
|
260
|
-
email: string | null;
|
|
261
|
-
avatar: string | null;
|
|
262
|
-
username: string;
|
|
263
|
-
permissionsData:
|
|
264
|
-
| {
|
|
265
|
-
user: string;
|
|
266
|
-
rank: string;
|
|
267
|
-
}
|
|
268
|
-
| undefined;
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
type Users = User[];
|
|
280
|
+
type Users = Pick<CombinedUserData, 'id' | 'name' | 'email' | 'avatar' | 'username' | 'permissionsData'>[];
|
|
272
281
|
|
|
273
282
|
function clearSearchParams(userListElm: HTMLDivElement, ActualList: HTMLDivElement) {
|
|
274
283
|
const url = new URL(window.location.href);
|
|
@@ -278,7 +287,7 @@ const t = useTranslations(lang, '@studiocms/dashboard:user-mngmt-sidebar');
|
|
|
278
287
|
ActualList.style.display = 'flex';
|
|
279
288
|
}
|
|
280
289
|
|
|
281
|
-
async function runSearch(form: HTMLFormElement, userListElm: HTMLDivElement, users: Users,
|
|
290
|
+
async function runSearch(form: HTMLFormElement, userListElm: HTMLDivElement, users: Users, ActualList: HTMLDivElement) {
|
|
282
291
|
const formData = new FormData(form);
|
|
283
292
|
|
|
284
293
|
const searchTerm = DOMPurify.sanitize(formData.get('search')?.toString() || '');
|
|
@@ -299,20 +308,19 @@ const t = useTranslations(lang, '@studiocms/dashboard:user-mngmt-sidebar');
|
|
|
299
308
|
|
|
300
309
|
const results = fuse.search(searchTerm);
|
|
301
310
|
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const html = await res.text();
|
|
311
|
+
const html = await sdkClient.pipe(
|
|
312
|
+
Effect.flatMap((client) =>
|
|
313
|
+
client.utils.userListItems({
|
|
314
|
+
payload: {
|
|
315
|
+
users: results.map(({ item }) => item),
|
|
316
|
+
searchQuery: searchTerm,
|
|
317
|
+
}
|
|
318
|
+
})
|
|
319
|
+
),
|
|
320
|
+
Effect.tapError(Effect.logError),
|
|
321
|
+
Effect.map((res) => res.html),
|
|
322
|
+
Effect.runPromise
|
|
323
|
+
);
|
|
316
324
|
|
|
317
325
|
userListElm.innerHTML = html;
|
|
318
326
|
userListElm.style.display = 'flex';
|
|
@@ -327,7 +335,6 @@ const t = useTranslations(lang, '@studiocms/dashboard:user-mngmt-sidebar');
|
|
|
327
335
|
|
|
328
336
|
const userListElm = document.querySelector('#search-list') as HTMLDivElement;
|
|
329
337
|
const users: Users = JSON.parse(userListElm.dataset.users!);
|
|
330
|
-
const userListItemsPartial = userListElm.dataset.userpartial!;
|
|
331
338
|
|
|
332
339
|
const url = new URL(window.location.href);
|
|
333
340
|
|
|
@@ -336,18 +343,18 @@ const t = useTranslations(lang, '@studiocms/dashboard:user-mngmt-sidebar');
|
|
|
336
343
|
if (searchTerm) {
|
|
337
344
|
const input = searchInput;
|
|
338
345
|
input.value = searchTerm;
|
|
339
|
-
await runSearch(searchForm, userListElm, users,
|
|
346
|
+
await runSearch(searchForm, userListElm, users, ActualUserList);
|
|
340
347
|
}
|
|
341
348
|
|
|
342
349
|
searchForm.addEventListener('submit', async (e) => {
|
|
343
350
|
e.preventDefault();
|
|
344
|
-
await runSearch(searchForm, userListElm, users,
|
|
351
|
+
await runSearch(searchForm, userListElm, users, ActualUserList);
|
|
345
352
|
});
|
|
346
353
|
|
|
347
354
|
let timeout: NodeJS.Timeout;
|
|
348
355
|
searchInput.addEventListener('input', () => {
|
|
349
356
|
clearTimeout(timeout);
|
|
350
|
-
timeout = setTimeout(async () => await runSearch(searchForm, userListElm, users,
|
|
357
|
+
timeout = setTimeout(async () => await runSearch(searchForm, userListElm, users, ActualUserList), 500);
|
|
351
358
|
});
|
|
352
359
|
|
|
353
360
|
searchInput.addEventListener('search', () => {
|
|
@@ -1,41 +1,28 @@
|
|
|
1
1
|
---
|
|
2
|
+
import config from 'studiocms:config';
|
|
2
3
|
import { useTranslations } from 'studiocms:i18n';
|
|
4
|
+
import { StudioCMSRoutes } from 'studiocms:lib';
|
|
5
|
+
import type { CombinedUserData } from 'studiocms:sdk/types';
|
|
3
6
|
import { Divider } from 'studiocms:ui/components/divider';
|
|
4
7
|
import { Icon } from 'studiocms:ui/components/icon';
|
|
5
|
-
import type { AvailablePermissionRanks } from '@withstudiocms/auth-kit/types';
|
|
6
8
|
import User from '../../shared/SSRUser.astro';
|
|
7
9
|
|
|
8
10
|
interface Props {
|
|
9
|
-
user:
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
email: string | null | undefined;
|
|
13
|
-
avatar: string | null | undefined;
|
|
14
|
-
username: string;
|
|
15
|
-
permissionsData:
|
|
16
|
-
| {
|
|
17
|
-
user: string;
|
|
18
|
-
rank: AvailablePermissionRanks;
|
|
19
|
-
}
|
|
20
|
-
| undefined;
|
|
21
|
-
};
|
|
11
|
+
user: Pick<CombinedUserData, 'id' | 'name' | 'email' | 'avatar' | 'username' | 'permissionsData'>;
|
|
22
12
|
searchQuery?: string;
|
|
23
13
|
}
|
|
24
14
|
|
|
25
15
|
const { user, searchQuery } = Astro.props;
|
|
26
16
|
|
|
27
|
-
const lang = Astro.locals
|
|
17
|
+
const lang = Astro.locals?.StudioCMS?.defaultLang || config.locale.i18n.defaultLocale;
|
|
28
18
|
const t = useTranslations(lang, '@studiocms/dashboard:user-component');
|
|
29
19
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
Astro.url.origin
|
|
33
|
-
);
|
|
34
|
-
userListItemHref.searchParams.set('user', user.id);
|
|
20
|
+
const userListItemSearch = new URLSearchParams({ user: user.id });
|
|
21
|
+
|
|
35
22
|
if (searchQuery) {
|
|
36
|
-
|
|
23
|
+
userListItemSearch.set('search', searchQuery);
|
|
37
24
|
}
|
|
38
|
-
const userListItemHrefString =
|
|
25
|
+
const userListItemHrefString = `${StudioCMSRoutes.mainLinks.userManagementEdit}?${userListItemSearch.toString()}`;
|
|
39
26
|
|
|
40
27
|
const id = `user-mngmt-user-account-${user.id || 'unknown'}`;
|
|
41
28
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { CombinedUserData } from 'studiocms:sdk/types';
|
|
3
|
+
import UserListItem from './UserListItem.astro';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
users: Pick<
|
|
7
|
+
CombinedUserData,
|
|
8
|
+
'id' | 'name' | 'email' | 'avatar' | 'username' | 'permissionsData'
|
|
9
|
+
>[];
|
|
10
|
+
searchQuery?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { users, searchQuery } = Astro.props;
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
{users.map((user) => (
|
|
17
|
+
<UserListItem user={user} searchQuery={searchQuery} />
|
|
18
|
+
))}
|
|
@@ -39,10 +39,7 @@ if (ins) {
|
|
|
39
39
|
const id = __test_mode ? 'test-id' : Math.random().toString(36).substring(2, 9);
|
|
40
40
|
---
|
|
41
41
|
|
|
42
|
-
<pre
|
|
43
|
-
class="code-container scrollbar">
|
|
44
|
-
<code id={id} class:list={["custom-code", (del || ins) ? 'diff' : '']} {...props} set:html={htmlCode} />
|
|
45
|
-
</pre>
|
|
42
|
+
<pre class="code-container scrollbar"><code id={id} class:list={["custom-code", (del || ins) ? 'diff' : '']} {...props} set:html={htmlCode} /></pre>
|
|
46
43
|
<script is:inline define:vars={{ id: id }}>
|
|
47
44
|
const codesWithDiff = document.getElementById(id);
|
|
48
45
|
|
|
@@ -90,7 +90,6 @@ const {
|
|
|
90
90
|
const avatarUrl = this.dataset.avatarUrl;
|
|
91
91
|
const timeoutDelay = parseInt(this.dataset.avatarTimeout || '3000', 10);
|
|
92
92
|
const fallbackDataUri = this.dataset.avatarFallback;
|
|
93
|
-
const avatarName = this.dataset.avatarName || 'User';
|
|
94
93
|
|
|
95
94
|
if (!avatarUrl) return;
|
|
96
95
|
if (!fallbackDataUri) return;
|
|
@@ -98,7 +97,7 @@ const {
|
|
|
98
97
|
const img = this.querySelector('img');
|
|
99
98
|
if (!img) return;
|
|
100
99
|
|
|
101
|
-
this.loadAvatar(img, avatarUrl, timeoutDelay, fallbackDataUri
|
|
100
|
+
this.loadAvatar(img, avatarUrl, timeoutDelay, fallbackDataUri);
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
isValidAvatarUrl(url: string): boolean {
|
|
@@ -153,8 +152,7 @@ const {
|
|
|
153
152
|
img: HTMLImageElement,
|
|
154
153
|
url: string,
|
|
155
154
|
timeoutMs: number,
|
|
156
|
-
fallbackDataUri: string
|
|
157
|
-
name: string
|
|
155
|
+
fallbackDataUri: string
|
|
158
156
|
): Promise<void> {
|
|
159
157
|
if (!this.isValidAvatarUrl(url)) {
|
|
160
158
|
this.showFallbackIcon(img, fallbackDataUri);
|
|
@@ -35,12 +35,6 @@ const t = useTranslations(lang, '@studiocms/dashboard:file-tree-renderer');
|
|
|
35
35
|
aria-controls={contentId}
|
|
36
36
|
aria-label={`Toggle ${node.name} folder`}
|
|
37
37
|
>
|
|
38
|
-
{/*<Icon
|
|
39
|
-
name="heroicons:chevron-right"
|
|
40
|
-
class="chevron-icon"
|
|
41
|
-
width={16}
|
|
42
|
-
height={16}
|
|
43
|
-
/>*/}
|
|
44
38
|
</button>
|
|
45
39
|
<div class="tree-node-content">
|
|
46
40
|
<Icon
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { useTranslations } from 'studiocms:i18n';
|
|
3
3
|
import { isDefaultManager } from 'studiocms:storage-manager/name';
|
|
4
4
|
import { Button } from 'studiocms:ui/components/button';
|
|
5
|
-
import { Divider } from 'studiocms:ui/components/divider';
|
|
6
5
|
import { Icon } from 'studiocms:ui/components/icon';
|
|
7
6
|
import { Input } from 'studiocms:ui/components/input';
|
|
8
7
|
|
|
@@ -39,12 +39,6 @@ const t = useTranslations(lang, '@studiocms/dashboard:taxonomy-tree-renderer');
|
|
|
39
39
|
aria-controls={contentId}
|
|
40
40
|
aria-label={`Toggle ${node.name}`}
|
|
41
41
|
>
|
|
42
|
-
{/*<Icon
|
|
43
|
-
name="heroicons:chevron-right"
|
|
44
|
-
class="chevron-icon"
|
|
45
|
-
width={16}
|
|
46
|
-
height={16}
|
|
47
|
-
/>*/}
|
|
48
42
|
</button>
|
|
49
43
|
)
|
|
50
44
|
}
|
|
@@ -4,12 +4,10 @@ import '../styles/dashboard-base.css';
|
|
|
4
4
|
import '../styles/dashboard-diff.css';
|
|
5
5
|
import type { UserSessionData } from 'studiocms:auth/lib/types';
|
|
6
6
|
import { defaultLang } from 'studiocms:i18n';
|
|
7
|
-
import type { AvailablePermissionRanks } from '@withstudiocms/auth-kit/types';
|
|
8
7
|
import type { DynamicConfigEntry, StudioCMSSiteConfig } from '@withstudiocms/sdk/types';
|
|
9
8
|
import type { ComponentProps } from 'astro/types';
|
|
10
9
|
import Ambients from '../components/Ambients.astro';
|
|
11
10
|
import DoubleSidebar from '../components/dashboard/DoubleSidebar.astro';
|
|
12
|
-
import LoginChecker from '../components/dashboard/LoginChecker.astro';
|
|
13
11
|
import SidebarModals from '../components/dashboard/SidebarModals.astro';
|
|
14
12
|
import SingleSidebar from '../components/dashboard/SingleSidebar.astro';
|
|
15
13
|
import BaseLayout from './BaseLayout.astro';
|
|
@@ -27,9 +25,8 @@ const makePageTitle = (
|
|
|
27
25
|
};
|
|
28
26
|
|
|
29
27
|
interface Props extends ComponentProps<typeof BaseLayout> {
|
|
30
|
-
config: DynamicConfigEntry<StudioCMSSiteConfig
|
|
28
|
+
config: DynamicConfigEntry<Pick<StudioCMSSiteConfig, 'title' | 'description'>>;
|
|
31
29
|
sidebar?: false | 'single' | 'double';
|
|
32
|
-
requiredPermission?: AvailablePermissionRanks | 'none';
|
|
33
30
|
currentUser: UserSessionData | null;
|
|
34
31
|
}
|
|
35
32
|
|
|
@@ -38,7 +35,6 @@ const {
|
|
|
38
35
|
title: propTitle,
|
|
39
36
|
description: propDescription,
|
|
40
37
|
lang = defaultLang,
|
|
41
|
-
requiredPermission = 'unknown',
|
|
42
38
|
sidebar = 'single',
|
|
43
39
|
currentUser,
|
|
44
40
|
} = Astro.props;
|
|
@@ -50,11 +46,6 @@ const description = propDescription ?? config.data.description;
|
|
|
50
46
|
<BaseLayout {lang} {title} {description}>
|
|
51
47
|
<Ambients />
|
|
52
48
|
<SidebarModals {lang} />
|
|
53
|
-
{
|
|
54
|
-
requiredPermission !== 'none' && (
|
|
55
|
-
<LoginChecker {requiredPermission} {currentUser} />
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
49
|
{
|
|
59
50
|
sidebar === 'single' && (
|
|
60
51
|
<SingleSidebar {currentUser} />
|