bsmnt 0.4.2 → 0.5.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/dist/application/add-integration/index.d.ts +24 -6
- package/dist/application/add-integration/index.d.ts.map +1 -1
- package/dist/application/add-integration/index.js +130 -82
- package/dist/application/add-integration/index.js.map +1 -1
- package/dist/application/create-project/map-selection-to-registry.js +1 -1
- package/dist/application/create-project/map-selection-to-registry.js.map +1 -1
- package/dist/application/shared/project-detection.d.ts +2 -2
- package/dist/application/shared/project-detection.d.ts.map +1 -1
- package/dist/application/shared/project-detection.js +2 -2
- package/dist/application/shared/project-detection.js.map +1 -1
- package/dist/core/create/internal-ids.d.ts +4 -1
- package/dist/core/create/internal-ids.d.ts.map +1 -1
- package/dist/core/create/internal-ids.js +6 -1
- package/dist/core/create/internal-ids.js.map +1 -1
- package/dist/domain/cms.d.ts +0 -7
- package/dist/domain/cms.d.ts.map +1 -1
- package/dist/domain/cms.js.map +1 -1
- package/dist/domain/forms.d.ts +17 -0
- package/dist/domain/forms.d.ts.map +1 -0
- package/dist/domain/forms.js +13 -0
- package/dist/domain/forms.js.map +1 -0
- package/dist/domain/integration.d.ts +30 -0
- package/dist/domain/integration.d.ts.map +1 -0
- package/dist/domain/integration.js +12 -0
- package/dist/domain/integration.js.map +1 -0
- package/dist/domain/skills.d.ts +32 -0
- package/dist/domain/skills.d.ts.map +1 -1
- package/dist/domain/skills.js +39 -0
- package/dist/domain/skills.js.map +1 -1
- package/dist/index.js +95 -37
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/agents/register-sanity-mcp.js +9 -6
- package/dist/infrastructure/agents/register-sanity-mcp.js.map +1 -1
- package/dist/infrastructure/create/apply-package-json.d.ts.map +1 -1
- package/dist/infrastructure/create/apply-package-json.js +19 -0
- package/dist/infrastructure/create/apply-package-json.js.map +1 -1
- package/dist/infrastructure/create/install-dependencies.d.ts.map +1 -1
- package/dist/infrastructure/create/install-dependencies.js +4 -0
- package/dist/infrastructure/create/install-dependencies.js.map +1 -1
- package/dist/infrastructure/create/merge-registry.d.ts.map +1 -1
- package/dist/infrastructure/create/merge-registry.js +8 -0
- package/dist/infrastructure/create/merge-registry.js.map +1 -1
- package/dist/infrastructure/create/setup-agent.d.ts.map +1 -1
- package/dist/infrastructure/create/setup-agent.js +29 -6
- package/dist/infrastructure/create/setup-agent.js.map +1 -1
- package/dist/infrastructure/create/setup-sanity.d.ts.map +1 -1
- package/dist/infrastructure/create/setup-sanity.js +3 -0
- package/dist/infrastructure/create/setup-sanity.js.map +1 -1
- package/dist/infrastructure/integrations/inject-integration.d.ts +3 -3
- package/dist/infrastructure/integrations/inject-integration.d.ts.map +1 -1
- package/dist/infrastructure/integrations/inject-integration.js +81 -37
- package/dist/infrastructure/integrations/inject-integration.js.map +1 -1
- package/dist/modules/features/cms/sanity/config.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/config.js +11 -5
- package/dist/modules/features/cms/sanity/config.js.map +1 -1
- package/dist/modules/features/cms/sanity/index.js +8 -2
- package/dist/modules/features/cms/sanity/index.js.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/ci-workflow.d.ts +13 -0
- package/dist/modules/features/cms/sanity/mergers/ci-workflow.d.ts.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/ci-workflow.js +38 -0
- package/dist/modules/features/cms/sanity/mergers/ci-workflow.js.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/knip.d.ts +12 -0
- package/dist/modules/features/cms/sanity/mergers/knip.d.ts.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/knip.js +38 -0
- package/dist/modules/features/cms/sanity/mergers/knip.js.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/layout.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/layout.js +7 -3
- package/dist/modules/features/cms/sanity/mergers/layout.js.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/sitemap.d.ts +3 -3
- package/dist/modules/features/cms/sanity/mergers/sitemap.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/sitemap.js +48 -62
- package/dist/modules/features/cms/sanity/mergers/sitemap.js.map +1 -1
- package/dist/modules/features/cms/sanity-pagebuilder/config.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity-pagebuilder/config.js +8 -5
- package/dist/modules/features/cms/sanity-pagebuilder/config.js.map +1 -1
- package/dist/modules/features/cms/sanity-pagebuilder/index.js +2 -2
- package/dist/modules/features/cms/sanity-pagebuilder/index.js.map +1 -1
- package/dist/modules/features/forms/hubspot/config.d.ts +31 -0
- package/dist/modules/features/forms/hubspot/config.d.ts.map +1 -0
- package/dist/modules/features/forms/hubspot/config.js +25 -0
- package/dist/modules/features/forms/hubspot/config.js.map +1 -0
- package/dist/paths.d.ts +8 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +8 -0
- package/dist/paths.js.map +1 -1
- package/index.js +2 -2
- package/package.json +17 -9
- package/src/assets/check-node-version.mjs +22 -0
- package/src/modules/features/cms/sanity/files/app/blog/page.tsx +54 -0
- package/src/modules/features/cms/sanity/files/app/feed.xml/route.ts +36 -0
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/components/disable-draft-mode.tsx +3 -3
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/schemas/article.ts +7 -7
- package/src/modules/features/cms/sanity/files/lib/scripts/setup-ci-secrets.ts +117 -0
- package/src/modules/features/cms/sanity/files/lib/utils/rss.ts +96 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/.knip.json +8 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/[[...slug]]/route.ts +100 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/draft-mode/disable/route.ts +7 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/draft-mode/enable/route.ts +20 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/revalidate/route.ts +126 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/feed.xml/route.ts +40 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/sitemap.md/route.ts +124 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/studio/[[...tool]]/page.tsx +8 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/sanity/draft-mode-toggle.tsx +27 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/sanity/rich-text.tsx +87 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/sanity/visual-editing.tsx +28 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/ui/sanity-image/index.tsx +41 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/check-integration.ts +5 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/client.ts +27 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/disable-draft-mode.tsx +23 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/page-builder-input.tsx +39 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/page-category-input.tsx +50 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/slug-field.tsx +18 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/slug-input.tsx +14 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/confirm-publish-action.ts +40 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/env.ts +34 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/fetchers/layout.ts +48 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/fetchers/redirects.ts +17 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/icons.ts +62 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/live/index.tsx +88 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/markdown-proxy.config.ts +50 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/page-builder-config.ts +130 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/page-category.ts +28 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/page-tree-pane.tsx +420 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/pinned-pages.ts +54 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/presentation.ts +119 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/queries.ts +385 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/sanity.cli.ts +29 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/sanity.config.ts +113 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/index.ts +4 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/reusable/blog-content.ts +89 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/reusable/description.ts +29 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/reusable/hero.ts +28 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/singleton/content-collection.ts +45 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/content/author.ts +70 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/content/blog-category.ts +55 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/index.ts +96 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/company-data.ts +62 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/footer.ts +79 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/navbar.ts +75 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/redirect.ts +120 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/link.ts +125 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/logo-field.ts +9 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/metadata.ts +68 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/nav-objects.ts +192 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/page-builder.ts +39 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/page-folder.ts +124 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/page.ts +242 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/richText.ts +63 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/singletons.ts +39 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/structure.ts +330 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/image.ts +8 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/link.ts +140 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/page-builder-markdown.ts +81 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/scripts/sanity-typegen.ts +45 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/check-redirect.ts +30 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/json-ld.tsx +212 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/metadata.ts +167 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/rss.ts +96 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/sitemap.ts +40 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/proxy.ts +81 -0
- package/src/templates/next-default/.github/workflows/ci.yml +62 -0
- package/src/templates/next-default/README.md +22 -0
- package/src/templates/next-default/knip.json +14 -0
- package/src/templates/next-default/lefthook.yml +5 -0
- package/src/templates/next-default/package.json +8 -4
- package/src/templates/next-experiments/.github/workflows/ci.yml +62 -0
- package/src/templates/next-experiments/README.md +22 -0
- package/src/templates/next-experiments/knip.json +14 -0
- package/src/templates/next-experiments/lefthook.yml +30 -0
- package/src/templates/next-experiments/package.json +10 -2
- package/src/templates/next-pagebuilder/.github/workflows/ci.yml +70 -0
- package/src/templates/next-pagebuilder/README.md +34 -0
- package/src/templates/next-pagebuilder/app/(content)/[[...slug]]/page.tsx +6 -1
- package/src/templates/next-pagebuilder/app/(content)/layout.tsx +3 -12
- package/src/templates/next-pagebuilder/components/layout/footer/index.tsx +11 -10
- package/src/templates/next-pagebuilder/components/layout/header/index.tsx +5 -3
- package/src/templates/next-pagebuilder/components/layout/json-ld/index.tsx +9 -10
- package/src/templates/next-pagebuilder/components/layout/wrapper/index.tsx +3 -11
- package/src/templates/next-pagebuilder/components/page-builder/components/content-collection/index.tsx +1 -1
- package/src/templates/next-pagebuilder/knip.json +27 -0
- package/src/templates/next-pagebuilder/lefthook.yml +5 -0
- package/src/templates/next-pagebuilder/lib/scripts/setup-ci-secrets.ts +117 -0
- package/src/templates/next-pagebuilder/package.json +9 -3
- package/src/templates/next-webgl/.github/workflows/ci.yml +62 -0
- package/src/templates/next-webgl/README.md +22 -0
- package/src/templates/next-webgl/knip.json +13 -0
- package/src/templates/next-webgl/lefthook.yml +5 -0
- package/src/templates/next-webgl/package.json +8 -4
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { defineField, defineType } from "sanity";
|
|
2
|
+
import { SlugField } from "@/lib/integrations/sanity/components/slug-field";
|
|
3
|
+
import { SlugInput } from "@/lib/integrations/sanity/components/slug-input";
|
|
4
|
+
import { apiVersion } from "@/lib/integrations/sanity/env";
|
|
5
|
+
import { pageIcon } from "@/lib/integrations/sanity/icons";
|
|
6
|
+
import {
|
|
7
|
+
getInvalidPageBuilderDocumentTypes,
|
|
8
|
+
getPageBuilderReferenceMemberByDocumentType,
|
|
9
|
+
getPageCategoryIcon,
|
|
10
|
+
type PageBuilderDocumentType,
|
|
11
|
+
type PageBuilderGroupName,
|
|
12
|
+
pageBuilderPageTypes,
|
|
13
|
+
} from "@/lib/integrations/sanity/page-builder-config";
|
|
14
|
+
import { getGeneratedPageCategory } from "@/lib/integrations/sanity/page-category";
|
|
15
|
+
import { getPinnedPageById } from "@/lib/integrations/sanity/pinned-pages";
|
|
16
|
+
|
|
17
|
+
type PageValidationDocument = {
|
|
18
|
+
_id?: string;
|
|
19
|
+
type?: PageBuilderGroupName;
|
|
20
|
+
pageFolder?: {
|
|
21
|
+
_ref?: string;
|
|
22
|
+
};
|
|
23
|
+
slug?: { current?: string | null };
|
|
24
|
+
pageBuilder?: Array<{
|
|
25
|
+
_key?: string;
|
|
26
|
+
_type?: string;
|
|
27
|
+
_ref?: string;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type PageSlugValidationContext = {
|
|
32
|
+
document?: PageValidationDocument | undefined;
|
|
33
|
+
getClient: (options: { apiVersion: string }) => {
|
|
34
|
+
fetch: <T>(query: string, params?: Record<string, unknown>) => Promise<T>;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
type ReferencedPageBuilderDocument = {
|
|
39
|
+
_id: string;
|
|
40
|
+
_type: PageBuilderDocumentType;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const PAGE_FOLDER_QUERY = `*[_type == "pageFolder" && _id in [$publishedId, $draftId]][0].slug.current`;
|
|
44
|
+
|
|
45
|
+
async function getGeneratedPageCategoryForDocument(
|
|
46
|
+
document: PageValidationDocument | undefined,
|
|
47
|
+
getClient: PageSlugValidationContext["getClient"],
|
|
48
|
+
) {
|
|
49
|
+
const pageFolderId = document?.pageFolder?._ref?.replace(/^drafts\./, "");
|
|
50
|
+
let folder: string | null = null;
|
|
51
|
+
|
|
52
|
+
if (pageFolderId) {
|
|
53
|
+
folder = await getClient({ apiVersion }).fetch<string | null>(
|
|
54
|
+
PAGE_FOLDER_QUERY,
|
|
55
|
+
{ draftId: `drafts.${pageFolderId}`, publishedId: pageFolderId },
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return getGeneratedPageCategory({
|
|
60
|
+
folder,
|
|
61
|
+
slug: document?.slug?.current ?? null,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function isPageSlugUniqueInFolder(
|
|
66
|
+
slug: string | null,
|
|
67
|
+
context: PageSlugValidationContext,
|
|
68
|
+
) {
|
|
69
|
+
const id = context.document?._id?.replace(/^drafts\./, "");
|
|
70
|
+
|
|
71
|
+
if (!id) return true;
|
|
72
|
+
|
|
73
|
+
const pageFolderId = context.document?.pageFolder?._ref ?? null;
|
|
74
|
+
const client = context.getClient({ apiVersion });
|
|
75
|
+
const existing = await client.fetch<number>(
|
|
76
|
+
`count(*[
|
|
77
|
+
_type == "page" &&
|
|
78
|
+
!(_id in [$id, "drafts." + $id]) &&
|
|
79
|
+
(
|
|
80
|
+
($pageFolderId == null && !defined(pageFolder._ref)) ||
|
|
81
|
+
pageFolder._ref == $pageFolderId
|
|
82
|
+
) &&
|
|
83
|
+
(
|
|
84
|
+
($slug == null && !defined(slug.current)) ||
|
|
85
|
+
slug.current == $slug
|
|
86
|
+
)
|
|
87
|
+
])`,
|
|
88
|
+
{
|
|
89
|
+
id,
|
|
90
|
+
pageFolderId,
|
|
91
|
+
slug,
|
|
92
|
+
},
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
return existing === 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const page = defineType({
|
|
99
|
+
name: "page",
|
|
100
|
+
title: "Page",
|
|
101
|
+
type: "document",
|
|
102
|
+
icon: pageIcon,
|
|
103
|
+
fields: [
|
|
104
|
+
defineField({
|
|
105
|
+
name: "title",
|
|
106
|
+
title: "Title",
|
|
107
|
+
type: "string",
|
|
108
|
+
validation: (Rule) => Rule.required(),
|
|
109
|
+
}),
|
|
110
|
+
defineField({
|
|
111
|
+
name: "type",
|
|
112
|
+
title: "Page Category",
|
|
113
|
+
type: "string",
|
|
114
|
+
options: { list: pageBuilderPageTypes },
|
|
115
|
+
initialValue: "generic",
|
|
116
|
+
hidden: true,
|
|
117
|
+
readOnly: true,
|
|
118
|
+
}),
|
|
119
|
+
defineField({
|
|
120
|
+
name: "pageFolder",
|
|
121
|
+
title: "Folder",
|
|
122
|
+
type: "reference",
|
|
123
|
+
to: [{ type: "pageFolder" }],
|
|
124
|
+
description: "Optional Studio folder for organizing this page.",
|
|
125
|
+
hidden: true,
|
|
126
|
+
}),
|
|
127
|
+
defineField({
|
|
128
|
+
name: "slug",
|
|
129
|
+
title: "Slug",
|
|
130
|
+
type: "slug",
|
|
131
|
+
description: "URL path without leading slash.",
|
|
132
|
+
readOnly: ({ document }) =>
|
|
133
|
+
getPinnedPageById(document?._id as string | undefined) !== null,
|
|
134
|
+
components: {
|
|
135
|
+
field: SlugField,
|
|
136
|
+
input: SlugInput,
|
|
137
|
+
},
|
|
138
|
+
options: {
|
|
139
|
+
source: "title",
|
|
140
|
+
maxLength: 200,
|
|
141
|
+
isUnique: (slug, context) => isPageSlugUniqueInFolder(slug, context),
|
|
142
|
+
},
|
|
143
|
+
validation: (Rule) =>
|
|
144
|
+
Rule.custom(async (slug, context) => {
|
|
145
|
+
return (
|
|
146
|
+
(await isPageSlugUniqueInFolder(slug?.current ?? null, {
|
|
147
|
+
document: context.document as PageValidationDocument | undefined,
|
|
148
|
+
getClient: context.getClient,
|
|
149
|
+
})) || "Another page in this folder already uses this slug"
|
|
150
|
+
);
|
|
151
|
+
}),
|
|
152
|
+
}),
|
|
153
|
+
defineField({
|
|
154
|
+
name: "pageBuilder",
|
|
155
|
+
title: "Page Builder",
|
|
156
|
+
type: "pageBuilder",
|
|
157
|
+
description: "Composable content blocks for this page",
|
|
158
|
+
validation: (Rule) =>
|
|
159
|
+
Rule.custom(async (value, context) => {
|
|
160
|
+
const document = context.document as
|
|
161
|
+
| PageValidationDocument
|
|
162
|
+
| undefined;
|
|
163
|
+
const pageType = await getGeneratedPageCategoryForDocument(
|
|
164
|
+
document,
|
|
165
|
+
context.getClient,
|
|
166
|
+
);
|
|
167
|
+
const pageBuilderItems = Array.isArray(value)
|
|
168
|
+
? (value as Array<{ _ref?: string }>)
|
|
169
|
+
: [];
|
|
170
|
+
const referenceIds = pageBuilderItems
|
|
171
|
+
.map((item) => item?._ref?.replace(/^drafts\./, ""))
|
|
172
|
+
.filter((item): item is string => typeof item === "string");
|
|
173
|
+
|
|
174
|
+
if (referenceIds.length === 0) return true;
|
|
175
|
+
|
|
176
|
+
const referencedDocuments = await context
|
|
177
|
+
.getClient({ apiVersion })
|
|
178
|
+
.fetch<ReferencedPageBuilderDocument[]>(
|
|
179
|
+
`*[
|
|
180
|
+
_id in $publishedIds || _id in $draftIds
|
|
181
|
+
]{
|
|
182
|
+
_id,
|
|
183
|
+
_type
|
|
184
|
+
}`,
|
|
185
|
+
{
|
|
186
|
+
publishedIds: referenceIds,
|
|
187
|
+
draftIds: referenceIds.map((id) => `drafts.${id}`),
|
|
188
|
+
},
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
const invalidDocumentTypes = getInvalidPageBuilderDocumentTypes(
|
|
192
|
+
pageType,
|
|
193
|
+
referencedDocuments.map((entry) => entry._type),
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
if (invalidDocumentTypes.length === 0) return true;
|
|
197
|
+
|
|
198
|
+
const invalidMemberTitles = invalidDocumentTypes.map(
|
|
199
|
+
(documentType) =>
|
|
200
|
+
getPageBuilderReferenceMemberByDocumentType(documentType)
|
|
201
|
+
?.title ?? documentType,
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
return `These page builder components do not belong to the "${pageType ?? "generic"}" category: ${invalidMemberTitles.join(", ")}`;
|
|
205
|
+
}),
|
|
206
|
+
}),
|
|
207
|
+
defineField({
|
|
208
|
+
name: "metadata",
|
|
209
|
+
title: "SEO & Metadata",
|
|
210
|
+
type: "metadata",
|
|
211
|
+
}),
|
|
212
|
+
],
|
|
213
|
+
preview: {
|
|
214
|
+
select: {
|
|
215
|
+
id: "_id",
|
|
216
|
+
title: "title",
|
|
217
|
+
folder: "pageFolder->slug.current",
|
|
218
|
+
slug: "slug.current",
|
|
219
|
+
},
|
|
220
|
+
prepare({ folder, id, title, slug }) {
|
|
221
|
+
let path = "No slug";
|
|
222
|
+
const pinned = getPinnedPageById(id as string | undefined);
|
|
223
|
+
if (pinned) {
|
|
224
|
+
path = pinned.path;
|
|
225
|
+
} else if (slug) {
|
|
226
|
+
path = `/${slug}`;
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
title: title || "Untitled",
|
|
230
|
+
subtitle: path,
|
|
231
|
+
media: getPageCategoryIcon(getGeneratedPageCategory({ folder, slug })),
|
|
232
|
+
};
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
orderings: [
|
|
236
|
+
{
|
|
237
|
+
title: "Title A-Z",
|
|
238
|
+
name: "titleAsc",
|
|
239
|
+
by: [{ field: "title", direction: "asc" }],
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineType } from "sanity";
|
|
2
|
+
import { linkAnnotations } from "./link";
|
|
3
|
+
|
|
4
|
+
export const richText = defineType({
|
|
5
|
+
name: "richText",
|
|
6
|
+
title: "Rich Text",
|
|
7
|
+
type: "array",
|
|
8
|
+
of: [
|
|
9
|
+
{
|
|
10
|
+
type: "block",
|
|
11
|
+
styles: [
|
|
12
|
+
{ title: "Normal", value: "normal" },
|
|
13
|
+
{ title: "H1", value: "h1" },
|
|
14
|
+
{ title: "H2", value: "h2" },
|
|
15
|
+
{ title: "H3", value: "h3" },
|
|
16
|
+
{ title: "H4", value: "h4" },
|
|
17
|
+
{ title: "H5", value: "h5" },
|
|
18
|
+
{ title: "H6", value: "h6" },
|
|
19
|
+
{ title: "Quote", value: "blockquote" },
|
|
20
|
+
],
|
|
21
|
+
lists: [
|
|
22
|
+
{ title: "Bullet", value: "bullet" },
|
|
23
|
+
{ title: "Number", value: "number" },
|
|
24
|
+
],
|
|
25
|
+
marks: {
|
|
26
|
+
decorators: [
|
|
27
|
+
{ title: "Strong", value: "strong" },
|
|
28
|
+
{ title: "Emphasis", value: "em" },
|
|
29
|
+
{ title: "Code", value: "code" },
|
|
30
|
+
{ title: "Underline", value: "underline" },
|
|
31
|
+
{ title: "Strike", value: "strike-through" },
|
|
32
|
+
],
|
|
33
|
+
annotations: linkAnnotations,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "table",
|
|
38
|
+
title: "Table",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: "image",
|
|
42
|
+
title: "Image",
|
|
43
|
+
options: {
|
|
44
|
+
hotspot: true,
|
|
45
|
+
},
|
|
46
|
+
fields: [
|
|
47
|
+
{
|
|
48
|
+
name: "alt",
|
|
49
|
+
title: "Alt Text",
|
|
50
|
+
type: "string",
|
|
51
|
+
description: "Alternative text for screen readers",
|
|
52
|
+
validation: (Rule) => Rule.required(),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "caption",
|
|
56
|
+
title: "Caption",
|
|
57
|
+
type: "string",
|
|
58
|
+
description: "Optional caption displayed below the image",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
});
|
package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/singletons.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { companyDataIcon, footerIcon, navbarIcon, pageListIcon } from "./icons";
|
|
2
|
+
|
|
3
|
+
export const singletonComponents = [
|
|
4
|
+
{
|
|
5
|
+
schemaType: "blogCollection",
|
|
6
|
+
documentId: "blogCollection",
|
|
7
|
+
title: "Blog Collection",
|
|
8
|
+
icon: pageListIcon,
|
|
9
|
+
},
|
|
10
|
+
] as const;
|
|
11
|
+
|
|
12
|
+
export const singletonLayout = [
|
|
13
|
+
{
|
|
14
|
+
schemaType: "companyData",
|
|
15
|
+
documentId: "companyData",
|
|
16
|
+
title: "Company Data",
|
|
17
|
+
icon: companyDataIcon,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
schemaType: "navbar",
|
|
21
|
+
documentId: "navbar",
|
|
22
|
+
title: "Navbar",
|
|
23
|
+
icon: navbarIcon,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
schemaType: "footer",
|
|
27
|
+
documentId: "footer",
|
|
28
|
+
title: "Footer",
|
|
29
|
+
icon: footerIcon,
|
|
30
|
+
},
|
|
31
|
+
] as const;
|
|
32
|
+
|
|
33
|
+
export const singletonComponentTypes: Set<string> = new Set(
|
|
34
|
+
singletonComponents.map((item) => item.schemaType),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export const singletonLayoutTypes: Set<string> = new Set(
|
|
38
|
+
singletonLayout.map((item) => item.schemaType),
|
|
39
|
+
);
|
package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/structure.ts
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { from } from "rxjs";
|
|
2
|
+
import { map } from "rxjs/operators";
|
|
3
|
+
import type {
|
|
4
|
+
ComponentBuilder,
|
|
5
|
+
StructureBuilder,
|
|
6
|
+
StructureResolver,
|
|
7
|
+
StructureResolverContext,
|
|
8
|
+
} from "sanity/structure";
|
|
9
|
+
import { apiVersion } from "./env";
|
|
10
|
+
import {
|
|
11
|
+
authorIcon,
|
|
12
|
+
blogCategoryIcon,
|
|
13
|
+
componentsFolderIcon,
|
|
14
|
+
contentFolderIcon,
|
|
15
|
+
contentIcon,
|
|
16
|
+
descriptionIcon,
|
|
17
|
+
heroIcon,
|
|
18
|
+
layoutFolderIcon,
|
|
19
|
+
pageFolderIcon,
|
|
20
|
+
pageIcon,
|
|
21
|
+
pagesFolderIcon,
|
|
22
|
+
redirectIcon,
|
|
23
|
+
} from "./icons";
|
|
24
|
+
import { PageTreePane } from "./page-tree-pane";
|
|
25
|
+
import { PINNED_PAGE_ENTRIES } from "./pinned-pages";
|
|
26
|
+
import { singletonComponents, singletonLayout } from "./singletons";
|
|
27
|
+
|
|
28
|
+
const PAGE_TREE_ITEM_ID_PREFIX = {
|
|
29
|
+
page: "page-tree-",
|
|
30
|
+
pageFolder: "page-folder-tree-",
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
const normalizeDocumentId = (documentId: string) =>
|
|
34
|
+
documentId.replace(/^drafts\./, "");
|
|
35
|
+
|
|
36
|
+
export const getDocumentIdFromPageTreeItemId = (itemId: string) =>
|
|
37
|
+
normalizeDocumentId(
|
|
38
|
+
itemId
|
|
39
|
+
.replace(PAGE_TREE_ITEM_ID_PREFIX.page, "")
|
|
40
|
+
.replace(PAGE_TREE_ITEM_ID_PREFIX.pageFolder, ""),
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const getPageTreeTemplateIds = (folderId: string | null) =>
|
|
44
|
+
folderId === null
|
|
45
|
+
? ["page", "pageFolder"]
|
|
46
|
+
: ["page-with-folder", "page-folder-with-parent"];
|
|
47
|
+
|
|
48
|
+
const buildPageTreeCreateChild = (
|
|
49
|
+
S: StructureBuilder,
|
|
50
|
+
documentId: string,
|
|
51
|
+
folderId: string | null,
|
|
52
|
+
templateId: string,
|
|
53
|
+
) => {
|
|
54
|
+
if (templateId === "page") {
|
|
55
|
+
return S.documentWithInitialValueTemplate("page").documentId(documentId);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (templateId === "pageFolder") {
|
|
59
|
+
return S.documentWithInitialValueTemplate("pageFolder").documentId(
|
|
60
|
+
documentId,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (templateId === "page-with-folder") {
|
|
65
|
+
return S.documentWithInitialValueTemplate("page-with-folder", {
|
|
66
|
+
pageFolderId: folderId,
|
|
67
|
+
}).documentId(documentId);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (templateId === "page-folder-with-parent") {
|
|
71
|
+
return S.documentWithInitialValueTemplate("page-folder-with-parent", {
|
|
72
|
+
parentFolderId: folderId,
|
|
73
|
+
}).documentId(documentId);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return undefined;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const getPageTreeClient = (context: StructureResolverContext) =>
|
|
80
|
+
context
|
|
81
|
+
.getClient({ apiVersion })
|
|
82
|
+
.withConfig({ perspective: context.perspectiveStack });
|
|
83
|
+
|
|
84
|
+
function buildPageTreeComponent(
|
|
85
|
+
S: StructureBuilder,
|
|
86
|
+
context: StructureResolverContext,
|
|
87
|
+
folderId: string | null,
|
|
88
|
+
title: string,
|
|
89
|
+
): ComponentBuilder {
|
|
90
|
+
const allowedTemplateIds = getPageTreeTemplateIds(folderId);
|
|
91
|
+
|
|
92
|
+
const folderMenuItems =
|
|
93
|
+
folderId === null
|
|
94
|
+
? []
|
|
95
|
+
: [
|
|
96
|
+
S.menuItem()
|
|
97
|
+
.title("Folder Settings")
|
|
98
|
+
.icon(pageFolderIcon)
|
|
99
|
+
.intent({
|
|
100
|
+
type: "edit",
|
|
101
|
+
params: { id: folderId, type: "pageFolder" },
|
|
102
|
+
}),
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
const createMenuItems =
|
|
106
|
+
folderId === null
|
|
107
|
+
? [
|
|
108
|
+
S.menuItem()
|
|
109
|
+
.title("Create Page")
|
|
110
|
+
.icon(pageIcon)
|
|
111
|
+
.intent({
|
|
112
|
+
type: "create",
|
|
113
|
+
params: { type: "page", template: "page" },
|
|
114
|
+
}),
|
|
115
|
+
S.menuItem()
|
|
116
|
+
.title("Create Folder")
|
|
117
|
+
.icon(pageFolderIcon)
|
|
118
|
+
.intent({
|
|
119
|
+
type: "create",
|
|
120
|
+
params: { type: "pageFolder", template: "pageFolder" },
|
|
121
|
+
}),
|
|
122
|
+
]
|
|
123
|
+
: [
|
|
124
|
+
S.menuItem()
|
|
125
|
+
.title("Create Page")
|
|
126
|
+
.icon(pageIcon)
|
|
127
|
+
.intent({
|
|
128
|
+
type: "create",
|
|
129
|
+
params: [
|
|
130
|
+
{ type: "page", template: "page-with-folder" },
|
|
131
|
+
{ pageFolderId: folderId },
|
|
132
|
+
],
|
|
133
|
+
}),
|
|
134
|
+
S.menuItem()
|
|
135
|
+
.title("Create Folder")
|
|
136
|
+
.icon(pageFolderIcon)
|
|
137
|
+
.intent({
|
|
138
|
+
type: "create",
|
|
139
|
+
params: [
|
|
140
|
+
{ type: "pageFolder", template: "page-folder-with-parent" },
|
|
141
|
+
{ parentFolderId: folderId },
|
|
142
|
+
],
|
|
143
|
+
}),
|
|
144
|
+
];
|
|
145
|
+
|
|
146
|
+
return S.component()
|
|
147
|
+
.id(`page-tree-${folderId ?? "root"}`)
|
|
148
|
+
.title(title)
|
|
149
|
+
.component(PageTreePane)
|
|
150
|
+
.options({ folderId })
|
|
151
|
+
.canHandleIntent((intentName, params) => {
|
|
152
|
+
if (intentName === "create") {
|
|
153
|
+
return (
|
|
154
|
+
typeof params.template === "string" &&
|
|
155
|
+
allowedTemplateIds.includes(params.template)
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (intentName === "edit") {
|
|
160
|
+
const id =
|
|
161
|
+
typeof params.id === "string" ? normalizeDocumentId(params.id) : null;
|
|
162
|
+
|
|
163
|
+
// Pinned pages live at the root pane only.
|
|
164
|
+
if (
|
|
165
|
+
folderId === null &&
|
|
166
|
+
id !== null &&
|
|
167
|
+
params.type === "page" &&
|
|
168
|
+
PINNED_PAGE_ENTRIES.some((entry) => entry.id === id)
|
|
169
|
+
) {
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
id !== null &&
|
|
175
|
+
folderId !== null &&
|
|
176
|
+
id === normalizeDocumentId(folderId) &&
|
|
177
|
+
params.type === "pageFolder"
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return false;
|
|
182
|
+
})
|
|
183
|
+
.child((childId, childOptions) => {
|
|
184
|
+
const normalizedId = getDocumentIdFromPageTreeItemId(childId);
|
|
185
|
+
|
|
186
|
+
// Pinned pages open by their raw id; seed via template so a
|
|
187
|
+
// not-yet-created pinned page gets its title/slug.
|
|
188
|
+
const pinnedEntry = PINNED_PAGE_ENTRIES.find(
|
|
189
|
+
(entry) => entry.id === childId,
|
|
190
|
+
);
|
|
191
|
+
if (pinnedEntry) {
|
|
192
|
+
return S.documentWithInitialValueTemplate(pinnedEntry.id).documentId(
|
|
193
|
+
pinnedEntry.id,
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (childId.startsWith(PAGE_TREE_ITEM_ID_PREFIX.page)) {
|
|
198
|
+
return S.document().schemaType("page").documentId(normalizedId);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (childId.startsWith(PAGE_TREE_ITEM_ID_PREFIX.pageFolder)) {
|
|
202
|
+
// Fetch the folder title so the recursive pane shows the right header.
|
|
203
|
+
return from(
|
|
204
|
+
getPageTreeClient(context).fetch<{ title: string | null } | null>(
|
|
205
|
+
`*[_id == $id || _id == "drafts." + $id][0]{ title }`,
|
|
206
|
+
{ id: normalizedId },
|
|
207
|
+
),
|
|
208
|
+
).pipe(
|
|
209
|
+
map((folder) =>
|
|
210
|
+
buildPageTreeComponent(
|
|
211
|
+
S,
|
|
212
|
+
context,
|
|
213
|
+
normalizedId,
|
|
214
|
+
folder?.title ?? "Untitled Folder",
|
|
215
|
+
),
|
|
216
|
+
),
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Current folder settings (edit intent for the folder itself).
|
|
221
|
+
if (folderId !== null && normalizedId === normalizeDocumentId(folderId)) {
|
|
222
|
+
return S.document().schemaType("pageFolder").documentId(normalizedId);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Template-based document creation.
|
|
226
|
+
const templateId =
|
|
227
|
+
typeof childOptions.params?.template === "string"
|
|
228
|
+
? childOptions.params.template
|
|
229
|
+
: null;
|
|
230
|
+
|
|
231
|
+
if (templateId) {
|
|
232
|
+
return buildPageTreeCreateChild(S, normalizedId, folderId, templateId);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return undefined;
|
|
236
|
+
})
|
|
237
|
+
.menuItems([...folderMenuItems, ...createMenuItems]);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// https://www.sanity.io/docs/structure-builder-cheat-sheet
|
|
241
|
+
export const structure: StructureResolver = (S, context) =>
|
|
242
|
+
S.list()
|
|
243
|
+
.title("Content")
|
|
244
|
+
.items([
|
|
245
|
+
// GROUP 1: Pages -- root page tree with inline search/filter
|
|
246
|
+
S.listItem()
|
|
247
|
+
.title("Pages")
|
|
248
|
+
.icon(pagesFolderIcon)
|
|
249
|
+
.child(() => buildPageTreeComponent(S, context, null, "Pages")),
|
|
250
|
+
|
|
251
|
+
S.divider(),
|
|
252
|
+
|
|
253
|
+
// GROUP 2: Content -- authors, blog categories
|
|
254
|
+
S.listItem()
|
|
255
|
+
.title("Content")
|
|
256
|
+
.icon(contentFolderIcon)
|
|
257
|
+
.child(
|
|
258
|
+
S.list()
|
|
259
|
+
.title("Content")
|
|
260
|
+
.items([
|
|
261
|
+
S.documentTypeListItem("author")
|
|
262
|
+
.title("Authors")
|
|
263
|
+
.icon(authorIcon),
|
|
264
|
+
S.documentTypeListItem("blogCategory")
|
|
265
|
+
.title("Blog Categories")
|
|
266
|
+
.icon(blogCategoryIcon),
|
|
267
|
+
]),
|
|
268
|
+
),
|
|
269
|
+
|
|
270
|
+
S.divider(),
|
|
271
|
+
|
|
272
|
+
// GROUP 3: Components -- singleton and reusable components
|
|
273
|
+
S.listItem()
|
|
274
|
+
.title("Components")
|
|
275
|
+
.icon(componentsFolderIcon)
|
|
276
|
+
.child(
|
|
277
|
+
S.list()
|
|
278
|
+
.title("Components")
|
|
279
|
+
.items([
|
|
280
|
+
S.divider().title("Singleton Components"),
|
|
281
|
+
...singletonComponents.map((item) =>
|
|
282
|
+
S.listItem()
|
|
283
|
+
.title(item.title)
|
|
284
|
+
.id(item.documentId)
|
|
285
|
+
.icon(item.icon)
|
|
286
|
+
.child(
|
|
287
|
+
S.document()
|
|
288
|
+
.schemaType(item.schemaType)
|
|
289
|
+
.documentId(item.documentId),
|
|
290
|
+
),
|
|
291
|
+
),
|
|
292
|
+
S.divider().title("Reusable Components"),
|
|
293
|
+
S.documentTypeListItem("hero").title("Headings").icon(heroIcon),
|
|
294
|
+
S.documentTypeListItem("description")
|
|
295
|
+
.title("Descriptions")
|
|
296
|
+
.icon(descriptionIcon),
|
|
297
|
+
S.documentTypeListItem("blogContent")
|
|
298
|
+
.title("Blog Content")
|
|
299
|
+
.icon(contentIcon),
|
|
300
|
+
]),
|
|
301
|
+
),
|
|
302
|
+
|
|
303
|
+
S.divider(),
|
|
304
|
+
|
|
305
|
+
// GROUP 4: Layout -- global layout singletons + managed collections
|
|
306
|
+
S.listItem()
|
|
307
|
+
.title("Layout")
|
|
308
|
+
.icon(layoutFolderIcon)
|
|
309
|
+
.child(
|
|
310
|
+
S.list()
|
|
311
|
+
.title("Layout")
|
|
312
|
+
.items([
|
|
313
|
+
...singletonLayout.map((item) =>
|
|
314
|
+
S.listItem()
|
|
315
|
+
.title(item.title)
|
|
316
|
+
.id(item.documentId)
|
|
317
|
+
.icon(item.icon)
|
|
318
|
+
.child(
|
|
319
|
+
S.document()
|
|
320
|
+
.schemaType(item.schemaType)
|
|
321
|
+
.documentId(item.documentId),
|
|
322
|
+
),
|
|
323
|
+
),
|
|
324
|
+
S.divider(),
|
|
325
|
+
S.documentTypeListItem("redirect")
|
|
326
|
+
.title("Redirects")
|
|
327
|
+
.icon(redirectIcon),
|
|
328
|
+
]),
|
|
329
|
+
),
|
|
330
|
+
]);
|
package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/image.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createImageUrlBuilder } from "@sanity/image-url";
|
|
2
|
+
import { dataset, projectId } from "../env";
|
|
3
|
+
|
|
4
|
+
const builder = createImageUrlBuilder({ projectId, dataset });
|
|
5
|
+
|
|
6
|
+
export const urlForImage = (source: Parameters<typeof builder.image>[0]) => {
|
|
7
|
+
return builder.image(source);
|
|
8
|
+
};
|