@btst/stack 1.5.0 → 1.5.1
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/packages/better-stack/src/plugins/blog/client/components/pages/edit-post-page.internal.cjs +7 -6
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/edit-post-page.internal.mjs +7 -6
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/home-page.internal.cjs +9 -7
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/home-page.internal.mjs +9 -7
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/new-post-page.internal.cjs +7 -6
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/new-post-page.internal.mjs +7 -6
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/post-page.internal.cjs +7 -5
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/post-page.internal.mjs +7 -5
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/tag-page.internal.cjs +5 -3
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/tag-page.internal.mjs +5 -3
- package/dist/packages/better-stack/src/plugins/blog/client/plugin.cjs +6 -6
- package/dist/packages/better-stack/src/plugins/blog/client/plugin.mjs +6 -6
- package/dist/packages/better-stack/src/plugins/cms/client/components/pages/content-editor-page.internal.cjs +19 -2
- package/dist/packages/better-stack/src/plugins/cms/client/components/pages/content-editor-page.internal.mjs +19 -2
- package/dist/packages/better-stack/src/plugins/cms/client/components/pages/content-list-page.internal.cjs +19 -6
- package/dist/packages/better-stack/src/plugins/cms/client/components/pages/content-list-page.internal.mjs +19 -6
- package/dist/packages/better-stack/src/plugins/cms/client/components/pages/dashboard-page.internal.cjs +18 -2
- package/dist/packages/better-stack/src/plugins/cms/client/components/pages/dashboard-page.internal.mjs +18 -2
- package/dist/packages/better-stack/src/plugins/cms/client/plugin.cjs +112 -22
- package/dist/packages/better-stack/src/plugins/cms/client/plugin.mjs +112 -22
- package/dist/packages/{better-stack/src/plugins/blog/client/components/shared → ui/src/hooks}/use-route-lifecycle.cjs +8 -9
- package/dist/packages/{better-stack/src/plugins/blog/client/components/shared → ui/src/hooks}/use-route-lifecycle.mjs +1 -2
- package/dist/plugins/blog/api/index.d.cts +1 -1
- package/dist/plugins/blog/api/index.d.mts +1 -1
- package/dist/plugins/blog/api/index.d.ts +1 -1
- package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
- package/dist/plugins/blog/client/index.d.cts +1 -1
- package/dist/plugins/blog/client/index.d.mts +1 -1
- package/dist/plugins/blog/client/index.d.ts +1 -1
- package/dist/plugins/blog/query-keys.d.cts +2 -2
- package/dist/plugins/blog/query-keys.d.mts +2 -2
- package/dist/plugins/blog/query-keys.d.ts +2 -2
- package/dist/plugins/cms/client/index.d.cts +66 -1
- package/dist/plugins/cms/client/index.d.mts +66 -1
- package/dist/plugins/cms/client/index.d.ts +66 -1
- package/package.json +1 -1
- package/src/plugins/blog/client/components/pages/edit-post-page.internal.tsx +4 -3
- package/src/plugins/blog/client/components/pages/home-page.internal.tsx +4 -2
- package/src/plugins/blog/client/components/pages/new-post-page.internal.tsx +4 -3
- package/src/plugins/blog/client/components/pages/post-page.internal.tsx +4 -2
- package/src/plugins/blog/client/components/pages/tag-page.internal.tsx +4 -2
- package/src/plugins/blog/client/plugin.tsx +10 -9
- package/src/plugins/cms/client/components/pages/content-editor-page.internal.tsx +21 -3
- package/src/plugins/cms/client/components/pages/content-list-page.internal.tsx +21 -6
- package/src/plugins/cms/client/components/pages/dashboard-page.internal.tsx +20 -3
- package/src/plugins/cms/client/index.ts +1 -1
- package/src/plugins/cms/client/plugin.tsx +236 -25
- package/src/plugins/blog/client/components/shared/use-route-lifecycle.tsx +0 -68
- package/dist/shared/{stack.CcI4sYJP.d.ts → stack.DLhzx1-D.d.cts} +1 -1
- package/dist/shared/{stack.CcI4sYJP.d.cts → stack.DLhzx1-D.d.mts} +1 -1
- package/dist/shared/{stack.CcI4sYJP.d.mts → stack.DLhzx1-D.d.ts} +1 -1
|
@@ -7,14 +7,14 @@ const postForms = require('../forms/post-forms.cjs');
|
|
|
7
7
|
const pageHeader = require('../shared/page-header.cjs');
|
|
8
8
|
const pageWrapper = require('../shared/page-wrapper.cjs');
|
|
9
9
|
const index = require('../../localization/index.cjs');
|
|
10
|
-
const useRouteLifecycle = require('
|
|
10
|
+
const useRouteLifecycle = require('../../../../../../../ui/src/hooks/use-route-lifecycle.cjs');
|
|
11
11
|
|
|
12
12
|
function EditPostPage({ slug }) {
|
|
13
|
-
const
|
|
13
|
+
const overrides = context.usePluginOverrides("blog", {
|
|
14
14
|
localization: index.BLOG_LOCALIZATION
|
|
15
15
|
});
|
|
16
|
+
const { localization, navigate } = overrides;
|
|
16
17
|
const basePath = context.useBasePath();
|
|
17
|
-
const { navigate } = context.usePluginOverrides("blog");
|
|
18
18
|
useRouteLifecycle.useRouteLifecycle({
|
|
19
19
|
routeName: "editPost",
|
|
20
20
|
context: {
|
|
@@ -22,9 +22,10 @@ function EditPostPage({ slug }) {
|
|
|
22
22
|
params: { slug },
|
|
23
23
|
isSSR: typeof window === "undefined"
|
|
24
24
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
overrides,
|
|
26
|
+
beforeRenderHook: (overrides2, context) => {
|
|
27
|
+
if (overrides2.onBeforeEditPostPageRendered) {
|
|
28
|
+
return overrides2.onBeforeEditPostPageRendered(slug, context);
|
|
28
29
|
}
|
|
29
30
|
return true;
|
|
30
31
|
}
|
|
@@ -5,14 +5,14 @@ import { EditPostForm } from '../forms/post-forms.mjs';
|
|
|
5
5
|
import { PageHeader } from '../shared/page-header.mjs';
|
|
6
6
|
import { PageWrapper } from '../shared/page-wrapper.mjs';
|
|
7
7
|
import { BLOG_LOCALIZATION } from '../../localization/index.mjs';
|
|
8
|
-
import { useRouteLifecycle } from '
|
|
8
|
+
import { useRouteLifecycle } from '../../../../../../../ui/src/hooks/use-route-lifecycle.mjs';
|
|
9
9
|
|
|
10
10
|
function EditPostPage({ slug }) {
|
|
11
|
-
const
|
|
11
|
+
const overrides = usePluginOverrides("blog", {
|
|
12
12
|
localization: BLOG_LOCALIZATION
|
|
13
13
|
});
|
|
14
|
+
const { localization, navigate } = overrides;
|
|
14
15
|
const basePath = useBasePath();
|
|
15
|
-
const { navigate } = usePluginOverrides("blog");
|
|
16
16
|
useRouteLifecycle({
|
|
17
17
|
routeName: "editPost",
|
|
18
18
|
context: {
|
|
@@ -20,9 +20,10 @@ function EditPostPage({ slug }) {
|
|
|
20
20
|
params: { slug },
|
|
21
21
|
isSSR: typeof window === "undefined"
|
|
22
22
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
overrides,
|
|
24
|
+
beforeRenderHook: (overrides2, context) => {
|
|
25
|
+
if (overrides2.onBeforeEditPostPageRendered) {
|
|
26
|
+
return overrides2.onBeforeEditPostPageRendered(slug, context);
|
|
26
27
|
}
|
|
27
28
|
return true;
|
|
28
29
|
}
|
package/dist/packages/better-stack/src/plugins/blog/client/components/pages/home-page.internal.cjs
CHANGED
|
@@ -9,12 +9,13 @@ const tagsList = require('../shared/tags-list.cjs');
|
|
|
9
9
|
const blogHooks = require('../../hooks/blog-hooks.cjs');
|
|
10
10
|
const index = require('../../localization/index.cjs');
|
|
11
11
|
const context = require('@btst/stack/context');
|
|
12
|
-
const useRouteLifecycle = require('
|
|
12
|
+
const useRouteLifecycle = require('../../../../../../../ui/src/hooks/use-route-lifecycle.cjs');
|
|
13
13
|
|
|
14
14
|
function HomePage({ published }) {
|
|
15
|
-
const
|
|
15
|
+
const overrides = context.usePluginOverrides("blog", {
|
|
16
16
|
localization: index.BLOG_LOCALIZATION
|
|
17
17
|
});
|
|
18
|
+
const { localization } = overrides;
|
|
18
19
|
useRouteLifecycle.useRouteLifecycle({
|
|
19
20
|
routeName: published ? "posts" : "drafts",
|
|
20
21
|
context: {
|
|
@@ -22,12 +23,13 @@ function HomePage({ published }) {
|
|
|
22
23
|
isSSR: typeof window === "undefined",
|
|
23
24
|
published
|
|
24
25
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
overrides,
|
|
27
|
+
beforeRenderHook: (overrides2, context) => {
|
|
28
|
+
if (published && overrides2.onBeforePostsPageRendered) {
|
|
29
|
+
return overrides2.onBeforePostsPageRendered(context);
|
|
28
30
|
}
|
|
29
|
-
if (!published &&
|
|
30
|
-
return
|
|
31
|
+
if (!published && overrides2.onBeforeDraftsPageRendered) {
|
|
32
|
+
return overrides2.onBeforeDraftsPageRendered(context);
|
|
31
33
|
}
|
|
32
34
|
return true;
|
|
33
35
|
}
|
package/dist/packages/better-stack/src/plugins/blog/client/components/pages/home-page.internal.mjs
CHANGED
|
@@ -7,12 +7,13 @@ import { TagsList } from '../shared/tags-list.mjs';
|
|
|
7
7
|
import { useSuspensePosts } from '../../hooks/blog-hooks.mjs';
|
|
8
8
|
import { BLOG_LOCALIZATION } from '../../localization/index.mjs';
|
|
9
9
|
import { usePluginOverrides } from '@btst/stack/context';
|
|
10
|
-
import { useRouteLifecycle } from '
|
|
10
|
+
import { useRouteLifecycle } from '../../../../../../../ui/src/hooks/use-route-lifecycle.mjs';
|
|
11
11
|
|
|
12
12
|
function HomePage({ published }) {
|
|
13
|
-
const
|
|
13
|
+
const overrides = usePluginOverrides("blog", {
|
|
14
14
|
localization: BLOG_LOCALIZATION
|
|
15
15
|
});
|
|
16
|
+
const { localization } = overrides;
|
|
16
17
|
useRouteLifecycle({
|
|
17
18
|
routeName: published ? "posts" : "drafts",
|
|
18
19
|
context: {
|
|
@@ -20,12 +21,13 @@ function HomePage({ published }) {
|
|
|
20
21
|
isSSR: typeof window === "undefined",
|
|
21
22
|
published
|
|
22
23
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
overrides,
|
|
25
|
+
beforeRenderHook: (overrides2, context) => {
|
|
26
|
+
if (published && overrides2.onBeforePostsPageRendered) {
|
|
27
|
+
return overrides2.onBeforePostsPageRendered(context);
|
|
26
28
|
}
|
|
27
|
-
if (!published &&
|
|
28
|
-
return
|
|
29
|
+
if (!published && overrides2.onBeforeDraftsPageRendered) {
|
|
30
|
+
return overrides2.onBeforeDraftsPageRendered(context);
|
|
29
31
|
}
|
|
30
32
|
return true;
|
|
31
33
|
}
|
|
@@ -7,13 +7,13 @@ const postForms = require('../forms/post-forms.cjs');
|
|
|
7
7
|
const pageHeader = require('../shared/page-header.cjs');
|
|
8
8
|
const pageWrapper = require('../shared/page-wrapper.cjs');
|
|
9
9
|
const index = require('../../localization/index.cjs');
|
|
10
|
-
const useRouteLifecycle = require('
|
|
10
|
+
const useRouteLifecycle = require('../../../../../../../ui/src/hooks/use-route-lifecycle.cjs');
|
|
11
11
|
|
|
12
12
|
function NewPostPage() {
|
|
13
|
-
const
|
|
13
|
+
const overrides = context.usePluginOverrides("blog", {
|
|
14
14
|
localization: index.BLOG_LOCALIZATION
|
|
15
15
|
});
|
|
16
|
-
const { navigate } =
|
|
16
|
+
const { localization, navigate } = overrides;
|
|
17
17
|
const basePath = context.useBasePath();
|
|
18
18
|
useRouteLifecycle.useRouteLifecycle({
|
|
19
19
|
routeName: "newPost",
|
|
@@ -21,9 +21,10 @@ function NewPostPage() {
|
|
|
21
21
|
path: "/blog/new",
|
|
22
22
|
isSSR: typeof window === "undefined"
|
|
23
23
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
overrides,
|
|
25
|
+
beforeRenderHook: (overrides2, context) => {
|
|
26
|
+
if (overrides2.onBeforeNewPostPageRendered) {
|
|
27
|
+
return overrides2.onBeforeNewPostPageRendered(context);
|
|
27
28
|
}
|
|
28
29
|
return true;
|
|
29
30
|
}
|
|
@@ -5,13 +5,13 @@ import { AddPostForm } from '../forms/post-forms.mjs';
|
|
|
5
5
|
import { PageHeader } from '../shared/page-header.mjs';
|
|
6
6
|
import { PageWrapper } from '../shared/page-wrapper.mjs';
|
|
7
7
|
import { BLOG_LOCALIZATION } from '../../localization/index.mjs';
|
|
8
|
-
import { useRouteLifecycle } from '
|
|
8
|
+
import { useRouteLifecycle } from '../../../../../../../ui/src/hooks/use-route-lifecycle.mjs';
|
|
9
9
|
|
|
10
10
|
function NewPostPage() {
|
|
11
|
-
const
|
|
11
|
+
const overrides = usePluginOverrides("blog", {
|
|
12
12
|
localization: BLOG_LOCALIZATION
|
|
13
13
|
});
|
|
14
|
-
const { navigate } =
|
|
14
|
+
const { localization, navigate } = overrides;
|
|
15
15
|
const basePath = useBasePath();
|
|
16
16
|
useRouteLifecycle({
|
|
17
17
|
routeName: "newPost",
|
|
@@ -19,9 +19,10 @@ function NewPostPage() {
|
|
|
19
19
|
path: "/blog/new",
|
|
20
20
|
isSSR: typeof window === "undefined"
|
|
21
21
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
overrides,
|
|
23
|
+
beforeRenderHook: (overrides2, context) => {
|
|
24
|
+
if (overrides2.onBeforeNewPostPageRendered) {
|
|
25
|
+
return overrides2.onBeforeNewPostPageRendered(context);
|
|
25
26
|
}
|
|
26
27
|
return true;
|
|
27
28
|
}
|
package/dist/packages/better-stack/src/plugins/blog/client/components/pages/post-page.internal.cjs
CHANGED
|
@@ -14,14 +14,15 @@ const index = require('../../localization/index.cjs');
|
|
|
14
14
|
const postNavigation = require('../shared/post-navigation.cjs');
|
|
15
15
|
const recentPostsCarousel = require('../shared/recent-posts-carousel.cjs');
|
|
16
16
|
const badge = require('../../../../../../../ui/src/components/badge.cjs');
|
|
17
|
-
const useRouteLifecycle = require('
|
|
17
|
+
const useRouteLifecycle = require('../../../../../../../ui/src/hooks/use-route-lifecycle.cjs');
|
|
18
18
|
const onThisPage = require('../shared/on-this-page.cjs');
|
|
19
19
|
|
|
20
20
|
function PostPage({ slug }) {
|
|
21
|
-
const
|
|
21
|
+
const overrides = context.usePluginOverrides("blog", {
|
|
22
22
|
Image: defaults.DefaultImage,
|
|
23
23
|
localization: index.BLOG_LOCALIZATION
|
|
24
24
|
});
|
|
25
|
+
const { Image, localization } = overrides;
|
|
25
26
|
useRouteLifecycle.useRouteLifecycle({
|
|
26
27
|
routeName: "post",
|
|
27
28
|
context: {
|
|
@@ -29,9 +30,10 @@ function PostPage({ slug }) {
|
|
|
29
30
|
params: { slug },
|
|
30
31
|
isSSR: typeof window === "undefined"
|
|
31
32
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
overrides,
|
|
34
|
+
beforeRenderHook: (overrides2, context) => {
|
|
35
|
+
if (overrides2.onBeforePostPageRendered) {
|
|
36
|
+
return overrides2.onBeforePostPageRendered(slug, context);
|
|
35
37
|
}
|
|
36
38
|
return true;
|
|
37
39
|
}
|
package/dist/packages/better-stack/src/plugins/blog/client/components/pages/post-page.internal.mjs
CHANGED
|
@@ -12,14 +12,15 @@ import { BLOG_LOCALIZATION } from '../../localization/index.mjs';
|
|
|
12
12
|
import { PostNavigation } from '../shared/post-navigation.mjs';
|
|
13
13
|
import { RecentPostsCarousel } from '../shared/recent-posts-carousel.mjs';
|
|
14
14
|
import { Badge } from '../../../../../../../ui/src/components/badge.mjs';
|
|
15
|
-
import { useRouteLifecycle } from '
|
|
15
|
+
import { useRouteLifecycle } from '../../../../../../../ui/src/hooks/use-route-lifecycle.mjs';
|
|
16
16
|
import { OnThisPageSelect, OnThisPage } from '../shared/on-this-page.mjs';
|
|
17
17
|
|
|
18
18
|
function PostPage({ slug }) {
|
|
19
|
-
const
|
|
19
|
+
const overrides = usePluginOverrides("blog", {
|
|
20
20
|
Image: DefaultImage,
|
|
21
21
|
localization: BLOG_LOCALIZATION
|
|
22
22
|
});
|
|
23
|
+
const { Image, localization } = overrides;
|
|
23
24
|
useRouteLifecycle({
|
|
24
25
|
routeName: "post",
|
|
25
26
|
context: {
|
|
@@ -27,9 +28,10 @@ function PostPage({ slug }) {
|
|
|
27
28
|
params: { slug },
|
|
28
29
|
isSSR: typeof window === "undefined"
|
|
29
30
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
overrides,
|
|
32
|
+
beforeRenderHook: (overrides2, context) => {
|
|
33
|
+
if (overrides2.onBeforePostPageRendered) {
|
|
34
|
+
return overrides2.onBeforePostPageRendered(slug, context);
|
|
33
35
|
}
|
|
34
36
|
return true;
|
|
35
37
|
}
|
package/dist/packages/better-stack/src/plugins/blog/client/components/pages/tag-page.internal.cjs
CHANGED
|
@@ -9,19 +9,21 @@ const emptyList = require('../shared/empty-list.cjs');
|
|
|
9
9
|
const blogHooks = require('../../hooks/blog-hooks.cjs');
|
|
10
10
|
const index = require('../../localization/index.cjs');
|
|
11
11
|
const context = require('@btst/stack/context');
|
|
12
|
-
const useRouteLifecycle = require('
|
|
12
|
+
const useRouteLifecycle = require('../../../../../../../ui/src/hooks/use-route-lifecycle.cjs');
|
|
13
13
|
|
|
14
14
|
function TagPage({ tagSlug }) {
|
|
15
|
-
const
|
|
15
|
+
const overrides = context.usePluginOverrides("blog", {
|
|
16
16
|
localization: index.BLOG_LOCALIZATION
|
|
17
17
|
});
|
|
18
|
+
const { localization } = overrides;
|
|
18
19
|
useRouteLifecycle.useRouteLifecycle({
|
|
19
20
|
routeName: "tag",
|
|
20
21
|
context: {
|
|
21
22
|
path: `/blog/tag/${tagSlug}`,
|
|
22
23
|
params: { tagSlug },
|
|
23
24
|
isSSR: typeof window === "undefined"
|
|
24
|
-
}
|
|
25
|
+
},
|
|
26
|
+
overrides
|
|
25
27
|
});
|
|
26
28
|
const { tags } = blogHooks.useTags();
|
|
27
29
|
const tag = tags?.find((t) => t.slug === tagSlug);
|
package/dist/packages/better-stack/src/plugins/blog/client/components/pages/tag-page.internal.mjs
CHANGED
|
@@ -7,19 +7,21 @@ import { EmptyList } from '../shared/empty-list.mjs';
|
|
|
7
7
|
import { useTags, useSuspensePosts } from '../../hooks/blog-hooks.mjs';
|
|
8
8
|
import { BLOG_LOCALIZATION } from '../../localization/index.mjs';
|
|
9
9
|
import { usePluginOverrides } from '@btst/stack/context';
|
|
10
|
-
import { useRouteLifecycle } from '
|
|
10
|
+
import { useRouteLifecycle } from '../../../../../../../ui/src/hooks/use-route-lifecycle.mjs';
|
|
11
11
|
|
|
12
12
|
function TagPage({ tagSlug }) {
|
|
13
|
-
const
|
|
13
|
+
const overrides = usePluginOverrides("blog", {
|
|
14
14
|
localization: BLOG_LOCALIZATION
|
|
15
15
|
});
|
|
16
|
+
const { localization } = overrides;
|
|
16
17
|
useRouteLifecycle({
|
|
17
18
|
routeName: "tag",
|
|
18
19
|
context: {
|
|
19
20
|
path: `/blog/tag/${tagSlug}`,
|
|
20
21
|
params: { tagSlug },
|
|
21
22
|
isSSR: typeof window === "undefined"
|
|
22
|
-
}
|
|
23
|
+
},
|
|
24
|
+
overrides
|
|
23
25
|
});
|
|
24
26
|
const { tags } = useTags();
|
|
25
27
|
const tag = tags?.find((t) => t.slug === tagSlug);
|
|
@@ -182,12 +182,12 @@ function createTagLoader(tagSlug, config) {
|
|
|
182
182
|
});
|
|
183
183
|
const tagsQuery = queries.tags.list();
|
|
184
184
|
await queryClient.prefetchQuery(tagsQuery);
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
185
|
+
const listState = queryClient.getQueryState(listQuery.queryKey);
|
|
186
|
+
const tagsState = queryClient.getQueryState(tagsQuery.queryKey);
|
|
187
|
+
const queryError = listState?.error || tagsState?.error;
|
|
188
|
+
if (queryError && hooks?.onLoadError) {
|
|
189
|
+
const error = queryError instanceof Error ? queryError : new Error(String(queryError));
|
|
190
|
+
await hooks.onLoadError(error, context);
|
|
191
191
|
}
|
|
192
192
|
} catch (error) {
|
|
193
193
|
if (hooks?.onLoadError) {
|
|
@@ -180,12 +180,12 @@ function createTagLoader(tagSlug, config) {
|
|
|
180
180
|
});
|
|
181
181
|
const tagsQuery = queries.tags.list();
|
|
182
182
|
await queryClient.prefetchQuery(tagsQuery);
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
183
|
+
const listState = queryClient.getQueryState(listQuery.queryKey);
|
|
184
|
+
const tagsState = queryClient.getQueryState(tagsQuery.queryKey);
|
|
185
|
+
const queryError = listState?.error || tagsState?.error;
|
|
186
|
+
if (queryError && hooks?.onLoadError) {
|
|
187
|
+
const error = queryError instanceof Error ? queryError : new Error(String(queryError));
|
|
188
|
+
await hooks.onLoadError(error, context);
|
|
189
189
|
}
|
|
190
190
|
} catch (error) {
|
|
191
191
|
if (hooks?.onLoadError) {
|
|
@@ -10,12 +10,29 @@ const emptyState = require('../shared/empty-state.cjs');
|
|
|
10
10
|
const pageWrapper = require('../shared/page-wrapper.cjs');
|
|
11
11
|
const editorSkeleton = require('../loading/editor-skeleton.cjs');
|
|
12
12
|
const index = require('../../localization/index.cjs');
|
|
13
|
+
const useRouteLifecycle = require('../../../../../../../ui/src/hooks/use-route-lifecycle.cjs');
|
|
13
14
|
const cmsHooks = require('../../hooks/cms-hooks.cjs');
|
|
14
15
|
|
|
15
16
|
function ContentEditorPage({ typeSlug, id }) {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
17
|
+
const overrides = context.usePluginOverrides("cms");
|
|
18
|
+
const { navigate } = overrides;
|
|
19
|
+
const localization = { ...index.CMS_LOCALIZATION, ...overrides.localization };
|
|
18
20
|
const basePath = context.useBasePath();
|
|
21
|
+
useRouteLifecycle.useRouteLifecycle({
|
|
22
|
+
routeName: "contentEditor",
|
|
23
|
+
context: {
|
|
24
|
+
path: id ? `/cms/${typeSlug}/${id}` : `/cms/${typeSlug}/new`,
|
|
25
|
+
params: id ? { typeSlug, id } : { typeSlug },
|
|
26
|
+
isSSR: typeof window === "undefined"
|
|
27
|
+
},
|
|
28
|
+
overrides,
|
|
29
|
+
beforeRenderHook: (overrides2, context) => {
|
|
30
|
+
if (overrides2.onBeforeEditorRendered) {
|
|
31
|
+
return overrides2.onBeforeEditorRendered(typeSlug, id ?? null, context);
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
19
36
|
const { contentTypes } = cmsHooks.useSuspenseContentTypes();
|
|
20
37
|
const contentType = contentTypes.find((ct) => ct.slug === typeSlug);
|
|
21
38
|
const isEditing = !!id;
|
|
@@ -8,12 +8,29 @@ import { EmptyState } from '../shared/empty-state.mjs';
|
|
|
8
8
|
import { PageWrapper } from '../shared/page-wrapper.mjs';
|
|
9
9
|
import { EditorSkeleton } from '../loading/editor-skeleton.mjs';
|
|
10
10
|
import { CMS_LOCALIZATION } from '../../localization/index.mjs';
|
|
11
|
+
import { useRouteLifecycle } from '../../../../../../../ui/src/hooks/use-route-lifecycle.mjs';
|
|
11
12
|
import { useSuspenseContentTypes, useContentItem, useCreateContent, useUpdateContent } from '../../hooks/cms-hooks.mjs';
|
|
12
13
|
|
|
13
14
|
function ContentEditorPage({ typeSlug, id }) {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
15
|
+
const overrides = usePluginOverrides("cms");
|
|
16
|
+
const { navigate } = overrides;
|
|
17
|
+
const localization = { ...CMS_LOCALIZATION, ...overrides.localization };
|
|
16
18
|
const basePath = useBasePath();
|
|
19
|
+
useRouteLifecycle({
|
|
20
|
+
routeName: "contentEditor",
|
|
21
|
+
context: {
|
|
22
|
+
path: id ? `/cms/${typeSlug}/${id}` : `/cms/${typeSlug}/new`,
|
|
23
|
+
params: id ? { typeSlug, id } : { typeSlug },
|
|
24
|
+
isSSR: typeof window === "undefined"
|
|
25
|
+
},
|
|
26
|
+
overrides,
|
|
27
|
+
beforeRenderHook: (overrides2, context) => {
|
|
28
|
+
if (overrides2.onBeforeEditorRendered) {
|
|
29
|
+
return overrides2.onBeforeEditorRendered(typeSlug, id ?? null, context);
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
17
34
|
const { contentTypes } = useSuspenseContentTypes();
|
|
18
35
|
const contentType = contentTypes.find((ct) => ct.slug === typeSlug);
|
|
19
36
|
const isEditing = !!id;
|
|
@@ -9,17 +9,30 @@ const context = require('@btst/stack/context');
|
|
|
9
9
|
const emptyState = require('../shared/empty-state.cjs');
|
|
10
10
|
const pageWrapper = require('../shared/page-wrapper.cjs');
|
|
11
11
|
const index = require('../../localization/index.cjs');
|
|
12
|
+
const useRouteLifecycle = require('../../../../../../../ui/src/hooks/use-route-lifecycle.cjs');
|
|
12
13
|
const sonner = require('sonner');
|
|
13
14
|
const cmsHooks = require('../../hooks/cms-hooks.cjs');
|
|
14
15
|
|
|
15
16
|
function ContentListPage({ typeSlug }) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
localization: customLocalization
|
|
20
|
-
} = context.usePluginOverrides("cms");
|
|
21
|
-
const localization = { ...index.CMS_LOCALIZATION, ...customLocalization };
|
|
17
|
+
const overrides = context.usePluginOverrides("cms");
|
|
18
|
+
const { navigate, Link } = overrides;
|
|
19
|
+
const localization = { ...index.CMS_LOCALIZATION, ...overrides.localization };
|
|
22
20
|
const basePath = context.useBasePath();
|
|
21
|
+
useRouteLifecycle.useRouteLifecycle({
|
|
22
|
+
routeName: "contentList",
|
|
23
|
+
context: {
|
|
24
|
+
path: `/cms/${typeSlug}`,
|
|
25
|
+
params: { typeSlug },
|
|
26
|
+
isSSR: typeof window === "undefined"
|
|
27
|
+
},
|
|
28
|
+
overrides,
|
|
29
|
+
beforeRenderHook: (overrides2, context) => {
|
|
30
|
+
if (overrides2.onBeforeListRendered) {
|
|
31
|
+
return overrides2.onBeforeListRendered(typeSlug, context);
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
23
36
|
const limit = 20;
|
|
24
37
|
const { contentTypes } = cmsHooks.useSuspenseContentTypes();
|
|
25
38
|
const contentType = contentTypes.find((ct) => ct.slug === typeSlug);
|
|
@@ -7,17 +7,30 @@ import { usePluginOverrides, useBasePath } from '@btst/stack/context';
|
|
|
7
7
|
import { EmptyState } from '../shared/empty-state.mjs';
|
|
8
8
|
import { PageWrapper } from '../shared/page-wrapper.mjs';
|
|
9
9
|
import { CMS_LOCALIZATION } from '../../localization/index.mjs';
|
|
10
|
+
import { useRouteLifecycle } from '../../../../../../../ui/src/hooks/use-route-lifecycle.mjs';
|
|
10
11
|
import { toast } from 'sonner';
|
|
11
12
|
import { useSuspenseContentTypes, useSuspenseContent, useDeleteContent } from '../../hooks/cms-hooks.mjs';
|
|
12
13
|
|
|
13
14
|
function ContentListPage({ typeSlug }) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
localization: customLocalization
|
|
18
|
-
} = usePluginOverrides("cms");
|
|
19
|
-
const localization = { ...CMS_LOCALIZATION, ...customLocalization };
|
|
15
|
+
const overrides = usePluginOverrides("cms");
|
|
16
|
+
const { navigate, Link } = overrides;
|
|
17
|
+
const localization = { ...CMS_LOCALIZATION, ...overrides.localization };
|
|
20
18
|
const basePath = useBasePath();
|
|
19
|
+
useRouteLifecycle({
|
|
20
|
+
routeName: "contentList",
|
|
21
|
+
context: {
|
|
22
|
+
path: `/cms/${typeSlug}`,
|
|
23
|
+
params: { typeSlug },
|
|
24
|
+
isSSR: typeof window === "undefined"
|
|
25
|
+
},
|
|
26
|
+
overrides,
|
|
27
|
+
beforeRenderHook: (overrides2, context) => {
|
|
28
|
+
if (overrides2.onBeforeListRendered) {
|
|
29
|
+
return overrides2.onBeforeListRendered(typeSlug, context);
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
21
34
|
const limit = 20;
|
|
22
35
|
const { contentTypes } = useSuspenseContentTypes();
|
|
23
36
|
const contentType = contentTypes.find((ct) => ct.slug === typeSlug);
|
|
@@ -8,12 +8,28 @@ const context = require('@btst/stack/context');
|
|
|
8
8
|
const emptyState = require('../shared/empty-state.cjs');
|
|
9
9
|
const pageWrapper = require('../shared/page-wrapper.cjs');
|
|
10
10
|
const index = require('../../localization/index.cjs');
|
|
11
|
+
const useRouteLifecycle = require('../../../../../../../ui/src/hooks/use-route-lifecycle.cjs');
|
|
11
12
|
const cmsHooks = require('../../hooks/cms-hooks.cjs');
|
|
12
13
|
|
|
13
14
|
function DashboardPage() {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
15
|
+
const overrides = context.usePluginOverrides("cms");
|
|
16
|
+
const { navigate } = overrides;
|
|
17
|
+
const localization = { ...index.CMS_LOCALIZATION, ...overrides.localization };
|
|
16
18
|
const basePath = context.useBasePath();
|
|
19
|
+
useRouteLifecycle.useRouteLifecycle({
|
|
20
|
+
routeName: "dashboard",
|
|
21
|
+
context: {
|
|
22
|
+
path: "/cms",
|
|
23
|
+
isSSR: typeof window === "undefined"
|
|
24
|
+
},
|
|
25
|
+
overrides,
|
|
26
|
+
beforeRenderHook: (overrides2, context) => {
|
|
27
|
+
if (overrides2.onBeforeDashboardRendered) {
|
|
28
|
+
return overrides2.onBeforeDashboardRendered(context);
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
17
33
|
const { contentTypes } = cmsHooks.useSuspenseContentTypes();
|
|
18
34
|
if (contentTypes.length === 0) {
|
|
19
35
|
return /* @__PURE__ */ jsxRuntime.jsx(pageWrapper.PageWrapper, { testId: "cms-dashboard-page", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-5xl space-y-6", children: [
|
|
@@ -6,12 +6,28 @@ import { usePluginOverrides, useBasePath } from '@btst/stack/context';
|
|
|
6
6
|
import { EmptyState } from '../shared/empty-state.mjs';
|
|
7
7
|
import { PageWrapper } from '../shared/page-wrapper.mjs';
|
|
8
8
|
import { CMS_LOCALIZATION } from '../../localization/index.mjs';
|
|
9
|
+
import { useRouteLifecycle } from '../../../../../../../ui/src/hooks/use-route-lifecycle.mjs';
|
|
9
10
|
import { useSuspenseContentTypes } from '../../hooks/cms-hooks.mjs';
|
|
10
11
|
|
|
11
12
|
function DashboardPage() {
|
|
12
|
-
const
|
|
13
|
-
const
|
|
13
|
+
const overrides = usePluginOverrides("cms");
|
|
14
|
+
const { navigate } = overrides;
|
|
15
|
+
const localization = { ...CMS_LOCALIZATION, ...overrides.localization };
|
|
14
16
|
const basePath = useBasePath();
|
|
17
|
+
useRouteLifecycle({
|
|
18
|
+
routeName: "dashboard",
|
|
19
|
+
context: {
|
|
20
|
+
path: "/cms",
|
|
21
|
+
isSSR: typeof window === "undefined"
|
|
22
|
+
},
|
|
23
|
+
overrides,
|
|
24
|
+
beforeRenderHook: (overrides2, context) => {
|
|
25
|
+
if (overrides2.onBeforeDashboardRendered) {
|
|
26
|
+
return overrides2.onBeforeDashboardRendered(context);
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
15
31
|
const { contentTypes } = useSuspenseContentTypes();
|
|
16
32
|
if (contentTypes.length === 0) {
|
|
17
33
|
return /* @__PURE__ */ jsx(PageWrapper, { testId: "cms-dashboard-page", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-5xl space-y-6", children: [
|