slice-machine-ui 2.17.3-beta.1 → 2.17.3-beta.10
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/out/404.html +1 -1
- package/out/_next/static/Ahdv3H07Mjm1YmGHQ2jWC/_buildManifest.js +1 -0
- package/out/_next/static/chunks/04ad993f.d7f986af0f739cc9.js +28 -0
- package/out/_next/static/chunks/248-a2a655660e3f09b0.js +1 -0
- package/out/_next/static/chunks/34-8d9d9b2944824750.js +1 -0
- package/out/_next/static/chunks/489-feb8133b2c5a7773.js +1 -0
- package/out/_next/static/chunks/50-586dc7ab5e584e76.js +1 -0
- package/out/_next/static/chunks/630-bb6e3db525588f16.js +1 -0
- package/out/_next/static/chunks/{647-7b9b5aa9468f9e4b.js → 647-4379a741c8d85d9e.js} +1 -1
- package/out/_next/static/chunks/907-445266211c48b1a5.js +1 -0
- package/out/_next/static/chunks/pages/{_app-20b580525c9dd4d8.js → _app-f232ce46126995c7.js} +219 -221
- package/out/_next/static/chunks/pages/changelog-3663cafded70979e.js +1 -0
- package/out/_next/static/chunks/pages/changes-dda121066bd037bc.js +1 -0
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-a408f5a660e096a6.js → [customTypeId]-7102c23f96cd1768.js} +1 -1
- package/out/_next/static/chunks/pages/labs-a7ead234825f32c0.js +1 -0
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-f5e851ebe35049a8.js → [pageTypeId]-d4bc920a5efffa0a.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-b127d948a17968d3.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-29476d3554e484bb.js +1 -0
- package/out/_next/static/chunks/pages/slices-742b0e644563ac91.js +1 -0
- package/out/_next/static/chunks/webpack-e0c07a2fe4908d81.js +1 -0
- package/out/_next/static/css/303dad78be1eb854.css +1 -0
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +6 -6
- package/src/domain/fields.ts +7 -7
- package/src/features/builder/AddFieldDropdown.tsx +2 -2
- package/src/features/changes/PushChangesButton.tsx +4 -67
- package/src/features/customTypes/customTypesBuilder/CreateSliceFromImageModal/CreateSliceFromImageModal.tsx +8 -21
- package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +13 -25
- package/src/features/customTypes/customTypesBuilder/sliceCreationOptions.tsx +5 -11
- package/src/features/environments/actions/getActiveEnvironment.ts +20 -5
- package/src/features/navigation/Navigation.tsx +4 -24
- package/src/features/slices/sliceCards/SharedSliceCard.tsx +2 -10
- package/src/legacy/components/AppLayout/index.tsx +34 -2
- package/src/legacy/components/ChangesItems/ChangesItems.tsx +1 -8
- package/src/legacy/components/Forms/CreateSliceModal/CreateSliceModal.tsx +3 -8
- package/src/legacy/components/ListItem/Header.tsx +18 -12
- package/src/legacy/components/ListItem/index.tsx +1 -0
- package/src/legacy/components/Navigation/Environment.tsx +11 -3
- package/src/legacy/components/Simulator/components/FailedConnect/index.tsx +51 -56
- package/src/legacy/components/ToasterContainer/index.tsx +3 -14
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +20 -28
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +1 -5
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModalList.tsx +1 -6
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +13 -29
- package/src/legacy/lib/builders/SliceBuilder/index.tsx +1 -6
- package/src/legacy/lib/builders/common/EditModal/index.jsx +3 -10
- package/src/legacy/lib/builders/common/Zone/components/ZoneEmptyState/ZoneEmptyState.tsx +5 -10
- package/src/legacy/lib/models/common/widgets/Boolean/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Color/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/ContentRelationship/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Date/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Embed/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/GeoPoint/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Group/createGroupWidget.ts +2 -0
- package/src/legacy/lib/models/common/widgets/Image/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Link/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/LinkToMedia/index.ts +2 -0
- package/src/legacy/lib/models/common/widgets/Number/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Select/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/StructuredText/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Table/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Text/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Timestamp/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/UID/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Widget.ts +1 -0
- package/src/pages/slices.tsx +19 -51
- package/out/_next/static/chunks/248-03446cd9e9f13730.js +0 -1
- package/out/_next/static/chunks/268-6a9214b97195af9c.js +0 -1
- package/out/_next/static/chunks/33641354.3864aefb6106ae71.js +0 -28
- package/out/_next/static/chunks/34-e684c5fd75cc9dd0.js +0 -1
- package/out/_next/static/chunks/44-a2056f993381ad0f.js +0 -1
- package/out/_next/static/chunks/630-29c729ad2a291ef6.js +0 -1
- package/out/_next/static/chunks/882-151468121d542ed6.js +0 -1
- package/out/_next/static/chunks/pages/changelog-063c5e11dfc8fd55.js +0 -1
- package/out/_next/static/chunks/pages/changes-564336edb0ed18b0.js +0 -1
- package/out/_next/static/chunks/pages/labs-9630bfb1005be02b.js +0 -1
- package/out/_next/static/chunks/pages/settings-01f4aeb9112a1f87.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-5008e29008aa04f4.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-bd5e45632c419567.js +0 -1
- package/out/_next/static/chunks/pages/slices-4a60cd5f2c71327e.js +0 -1
- package/out/_next/static/chunks/webpack-b3522fdebabf510a.js +0 -1
- package/out/_next/static/css/cc9b10286400c2b9.css +0 -1
- package/out/_next/static/css/e5f781f20e24a5ea.css +0 -1
- package/out/_next/static/qsIV6OuRkZuXZ3EaJau1x/_buildManifest.js +0 -1
- package/out/settings.html +0 -1
- package/out/videoHighlights.png +0 -0
- package/public/videoHighlights.png +0 -0
- package/src/components/FieldSet/FieldSet.module.css +0 -84
- package/src/components/FieldSet/FieldSet.module.css.d.ts +0 -16
- package/src/components/FieldSet/FieldSet.stories.tsx +0 -244
- package/src/components/FieldSet/FieldSet.tsx +0 -67
- package/src/components/FieldSet/index.ts +0 -9
- package/src/features/builder/useAiSliceGenerationExperiment.ts +0 -8
- package/src/features/builder/useSectionsNamingExperiment.ts +0 -15
- package/src/features/settings/SettingsPage.tsx +0 -50
- package/src/features/settings/git/ConnectGitRepository.tsx +0 -112
- package/src/features/settings/git/ConnectGitRepositoryBlankSlate.tsx +0 -33
- package/src/features/settings/git/GitOwnerSelect.tsx +0 -71
- package/src/features/settings/git/GitProvider.ts +0 -40
- package/src/features/settings/git/GitProviderConnectButtons.tsx +0 -63
- package/src/features/settings/git/GitRepositoriesList.tsx +0 -76
- package/src/features/settings/git/GitRepositoriesSearch.tsx +0 -69
- package/src/features/settings/git/GitRepositoryConnectDialog.tsx +0 -97
- package/src/features/settings/git/GitRepositoryDisconnectDialog.tsx +0 -62
- package/src/features/settings/git/useGitIntegrationExperiment.ts +0 -8
- package/src/features/settings/git/useGitOwners.ts +0 -12
- package/src/features/settings/git/useGitRepos.ts +0 -24
- package/src/features/settings/git/useLinkedGitRepos.ts +0 -41
- package/src/features/settings/git/useWriteAPIToken.ts +0 -23
- package/src/icons/BitbucketIcon.tsx +0 -19
- package/src/icons/GitHubIcon.tsx +0 -17
- package/src/icons/GitLabIcon.tsx +0 -19
- package/src/icons/SettingsIcon.tsx +0 -19
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/sliceTemplatesComingSoon.ts +0 -30
- package/src/pages/settings.tsx +0 -1
- package/src/utils/textConversion.ts +0 -11
- /package/out/_next/static/{qsIV6OuRkZuXZ3EaJau1x → Ahdv3H07Mjm1YmGHQ2jWC}/_ssgManifest.js +0 -0
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { keys } from "@prismicio/editor-support/Object";
|
|
2
|
-
import { Button, ButtonGroup, Text, theme } from "@prismicio/editor-ui";
|
|
3
|
-
import { type ComponentPropsWithoutRef, type FC, useState } from "react";
|
|
4
|
-
import { toast } from "react-toastify";
|
|
5
|
-
|
|
6
|
-
import { gitProviderToConfig } from "@/features/settings/git/GitProvider";
|
|
7
|
-
|
|
8
|
-
export const GitProviderConnectButtons: FC = () => (
|
|
9
|
-
<ButtonGroup>
|
|
10
|
-
{keys(gitProviderToConfig).map((provider) => (
|
|
11
|
-
<GitProviderConnectButton
|
|
12
|
-
key={provider}
|
|
13
|
-
provider={provider}
|
|
14
|
-
sx={{ flexBasis: 0, flexGrow: 1 }}
|
|
15
|
-
/>
|
|
16
|
-
))}
|
|
17
|
-
</ButtonGroup>
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
type GitProviderConnectButtonProps = {
|
|
21
|
-
provider: keyof typeof gitProviderToConfig;
|
|
22
|
-
sx?: SX;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const GitProviderConnectButton: FC<GitProviderConnectButtonProps> = ({
|
|
26
|
-
provider,
|
|
27
|
-
sx,
|
|
28
|
-
}) => {
|
|
29
|
-
const { connect, Icon, name, supported } = gitProviderToConfig[provider];
|
|
30
|
-
const [loading, setLoading] = useState(false);
|
|
31
|
-
return (
|
|
32
|
-
<Button
|
|
33
|
-
color="grey"
|
|
34
|
-
disabled={!supported}
|
|
35
|
-
loading={loading}
|
|
36
|
-
onClick={() => {
|
|
37
|
-
void (async () => {
|
|
38
|
-
setLoading(true);
|
|
39
|
-
try {
|
|
40
|
-
await connect();
|
|
41
|
-
} catch (error) {
|
|
42
|
-
const message = `Could not connect to ${name}`;
|
|
43
|
-
console.error(message, error);
|
|
44
|
-
toast.error(message);
|
|
45
|
-
setLoading(false);
|
|
46
|
-
}
|
|
47
|
-
})();
|
|
48
|
-
}}
|
|
49
|
-
renderStartIcon={() => <Icon color={theme.color.grey11} />}
|
|
50
|
-
sx={sx}
|
|
51
|
-
>
|
|
52
|
-
{name}
|
|
53
|
-
{supported ? undefined : (
|
|
54
|
-
<Text color="inherit" variant="small">
|
|
55
|
-
{" (soon)"}
|
|
56
|
-
</Text>
|
|
57
|
-
)}
|
|
58
|
-
</Button>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// TODO(DT-1928): export the `SX` type from `@prismicio/editor-ui`.
|
|
63
|
-
type SX = ComponentPropsWithoutRef<typeof Button>["sx"];
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Button, Skeleton, Text } from "@prismicio/editor-ui";
|
|
2
|
-
import type { GitRepo, GitRepoSpecifier } from "@slicemachine/manager";
|
|
3
|
-
import type { FC } from "react";
|
|
4
|
-
|
|
5
|
-
import { FieldSetList, FieldSetListItem } from "@/components/FieldSet";
|
|
6
|
-
import { RelativeTime } from "@/components/RelativeTime";
|
|
7
|
-
import { GitRepositoryConnectDialog } from "@/features/settings/git/GitRepositoryConnectDialog";
|
|
8
|
-
import { GitRepositoryDisconnectDialog } from "@/features/settings/git/GitRepositoryDisconnectDialog";
|
|
9
|
-
import { useLinkedGitRepos } from "@/features/settings/git/useLinkedGitRepos";
|
|
10
|
-
|
|
11
|
-
type GitRepositoriesListProps =
|
|
12
|
-
| { mode: "link"; repos: GitRepo[] }
|
|
13
|
-
| { mode: "unlink"; repos: GitRepoSpecifier[] };
|
|
14
|
-
|
|
15
|
-
export const GitRepositoriesList: FC<GitRepositoriesListProps> = ({
|
|
16
|
-
mode,
|
|
17
|
-
repos,
|
|
18
|
-
}) => {
|
|
19
|
-
const { linkRepo, unlinkRepo } = useLinkedGitRepos();
|
|
20
|
-
return (
|
|
21
|
-
<FieldSetList>
|
|
22
|
-
{mode === "link"
|
|
23
|
-
? repos.map((repo) => (
|
|
24
|
-
<FieldSetListItem
|
|
25
|
-
action={
|
|
26
|
-
<GitRepositoryConnectDialog
|
|
27
|
-
linkRepo={linkRepo}
|
|
28
|
-
repo={repo}
|
|
29
|
-
trigger={<Button color="grey">Connect</Button>}
|
|
30
|
-
/>
|
|
31
|
-
}
|
|
32
|
-
key={`${repo.provider}@${repo.id}`}
|
|
33
|
-
>
|
|
34
|
-
{repo.name}
|
|
35
|
-
<Text color="grey11">
|
|
36
|
-
{" • "}
|
|
37
|
-
<RelativeTime date={repo.pushedAt} />
|
|
38
|
-
</Text>
|
|
39
|
-
</FieldSetListItem>
|
|
40
|
-
))
|
|
41
|
-
: repos.map((repo) => (
|
|
42
|
-
<FieldSetListItem
|
|
43
|
-
action={
|
|
44
|
-
<GitRepositoryDisconnectDialog
|
|
45
|
-
repo={repo}
|
|
46
|
-
trigger={<Button color="grey">Disconnect</Button>}
|
|
47
|
-
unlinkRepo={unlinkRepo}
|
|
48
|
-
/>
|
|
49
|
-
}
|
|
50
|
-
key={`${repo.provider}@${repo.owner}/${repo.name}`}
|
|
51
|
-
>
|
|
52
|
-
{repo.name}
|
|
53
|
-
</FieldSetListItem>
|
|
54
|
-
))}
|
|
55
|
-
</FieldSetList>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const GitRepositoriesListSkeleton: FC = () => (
|
|
60
|
-
<FieldSetList>
|
|
61
|
-
{[...Array(4).keys()].map((index) => (
|
|
62
|
-
<FieldSetListItem
|
|
63
|
-
action={<Skeleton height={32} width={67.59} />}
|
|
64
|
-
key={index}
|
|
65
|
-
>
|
|
66
|
-
<Skeleton
|
|
67
|
-
height={24}
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
69
|
-
// @ts-ignore TODO(DT-1918): add `verticalAlign: "middle"` to the `sx` prop.
|
|
70
|
-
sx={{ verticalAlign: "middle" }}
|
|
71
|
-
width={129.92}
|
|
72
|
-
/>
|
|
73
|
-
</FieldSetListItem>
|
|
74
|
-
))}
|
|
75
|
-
</FieldSetList>
|
|
76
|
-
);
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { GitOwner } from "@slicemachine/manager";
|
|
2
|
-
import { type FC, Suspense, useState } from "react";
|
|
3
|
-
|
|
4
|
-
import { FieldSetContent, FieldSetHeader } from "@/components/FieldSet";
|
|
5
|
-
import { ConnectGitRepositoryBlankSlate } from "@/features/settings/git/ConnectGitRepositoryBlankSlate";
|
|
6
|
-
import { GitOwnerSelect } from "@/features/settings/git/GitOwnerSelect";
|
|
7
|
-
import {
|
|
8
|
-
GitRepositoriesList,
|
|
9
|
-
GitRepositoriesListSkeleton,
|
|
10
|
-
} from "@/features/settings/git/GitRepositoriesList";
|
|
11
|
-
import { useGitRepos } from "@/features/settings/git/useGitRepos";
|
|
12
|
-
|
|
13
|
-
type GitRepositoriesSearchProps = { owners: GitOwner[] };
|
|
14
|
-
|
|
15
|
-
export const GitRepositoriesSearch: FC<GitRepositoriesSearchProps> = ({
|
|
16
|
-
owners,
|
|
17
|
-
}) => {
|
|
18
|
-
const [selectedOwner, setSelectedOwner] = useState(owners[0]);
|
|
19
|
-
return (
|
|
20
|
-
<>
|
|
21
|
-
<FieldSetHeader>
|
|
22
|
-
<GitOwnerSelect
|
|
23
|
-
owners={owners}
|
|
24
|
-
selectedOwner={selectedOwner}
|
|
25
|
-
onSelectedOwnerChange={setSelectedOwner}
|
|
26
|
-
sx={{ width: "calc(50% - 8px)" }}
|
|
27
|
-
/>
|
|
28
|
-
</FieldSetHeader>
|
|
29
|
-
<Suspense
|
|
30
|
-
fallback={<GitRepositoriesSearchSkeleton gitOwnerSelect={false} />}
|
|
31
|
-
>
|
|
32
|
-
<GitRepositoriesSearchResults owner={selectedOwner} />
|
|
33
|
-
</Suspense>
|
|
34
|
-
</>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
type GitRepositoriesSearchResultsProps = { owner: GitOwner };
|
|
39
|
-
|
|
40
|
-
const GitRepositoriesSearchResults: FC<GitRepositoriesSearchResultsProps> = ({
|
|
41
|
-
owner,
|
|
42
|
-
}) => {
|
|
43
|
-
const repos = useGitRepos({ provider: owner.provider, owner: owner.name });
|
|
44
|
-
return repos.length > 0 ? (
|
|
45
|
-
<GitRepositoriesList mode="link" repos={repos} />
|
|
46
|
-
) : (
|
|
47
|
-
<FieldSetContent>
|
|
48
|
-
<ConnectGitRepositoryBlankSlate
|
|
49
|
-
title="No Results Found"
|
|
50
|
-
description="Try selecting a different Git account or organization on the top left."
|
|
51
|
-
/>
|
|
52
|
-
</FieldSetContent>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
type GitRepositoriesSearchSkeletonProps = { gitOwnerSelect: boolean };
|
|
57
|
-
|
|
58
|
-
export const GitRepositoriesSearchSkeleton: FC<
|
|
59
|
-
GitRepositoriesSearchSkeletonProps
|
|
60
|
-
> = ({ gitOwnerSelect }) => (
|
|
61
|
-
<>
|
|
62
|
-
{gitOwnerSelect ? (
|
|
63
|
-
<FieldSetHeader>
|
|
64
|
-
<GitOwnerSelect disabled sx={{ width: "calc(50% - 8px)" }} />
|
|
65
|
-
</FieldSetHeader>
|
|
66
|
-
) : undefined}
|
|
67
|
-
<GitRepositoriesListSkeleton />
|
|
68
|
-
</>
|
|
69
|
-
);
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Box,
|
|
3
|
-
Dialog,
|
|
4
|
-
DialogActionButton,
|
|
5
|
-
DialogActionLink,
|
|
6
|
-
DialogActions,
|
|
7
|
-
DialogCancelButton,
|
|
8
|
-
DialogContent,
|
|
9
|
-
DialogHeader,
|
|
10
|
-
FormInput,
|
|
11
|
-
Text,
|
|
12
|
-
} from "@prismicio/editor-ui";
|
|
13
|
-
import type { GitRepo, GitRepoSpecifier } from "@slicemachine/manager";
|
|
14
|
-
import { Formik } from "formik";
|
|
15
|
-
import type { FC, ReactNode } from "react";
|
|
16
|
-
import { toast } from "react-toastify";
|
|
17
|
-
|
|
18
|
-
import { gitProviderToConfig } from "@/features/settings/git/GitProvider";
|
|
19
|
-
import { useWriteAPIToken } from "@/features/settings/git/useWriteAPIToken";
|
|
20
|
-
import { useRepositoryInformation } from "@/hooks/useRepositoryInformation";
|
|
21
|
-
|
|
22
|
-
type GitRepositoryConnectDialogProps = {
|
|
23
|
-
linkRepo: (repo: GitRepoSpecifier) => Promise<void>;
|
|
24
|
-
repo: GitRepo;
|
|
25
|
-
trigger: ReactNode;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// TODO: Update form to make it work with editor-ui Form component when
|
|
29
|
-
// we start to work again on Git integration
|
|
30
|
-
export const GitRepositoryConnectDialog: FC<
|
|
31
|
-
GitRepositoryConnectDialogProps
|
|
32
|
-
> = ({ linkRepo, repo, trigger }) => {
|
|
33
|
-
const providerConfig = gitProviderToConfig[repo.provider];
|
|
34
|
-
const { updateToken } = useWriteAPIToken({ git: repo });
|
|
35
|
-
const { repositoryUrl } = useRepositoryInformation();
|
|
36
|
-
return (
|
|
37
|
-
<Dialog size={{ width: 448, height: "auto" }} trigger={trigger}>
|
|
38
|
-
<DialogHeader title="Prismic Write API token required" />
|
|
39
|
-
<DialogContent>
|
|
40
|
-
<Formik
|
|
41
|
-
initialValues={{ writeAPIToken: "" }}
|
|
42
|
-
validate={(values) => {
|
|
43
|
-
if (values.writeAPIToken.length === 0) {
|
|
44
|
-
return { writeAPIToken: "Cannot be empty" };
|
|
45
|
-
}
|
|
46
|
-
}}
|
|
47
|
-
onSubmit={async (values) => {
|
|
48
|
-
try {
|
|
49
|
-
await linkRepo(repo);
|
|
50
|
-
await updateToken(values.writeAPIToken);
|
|
51
|
-
} catch (error) {
|
|
52
|
-
const message = `Could not connect to ${repo.name}`;
|
|
53
|
-
console.error(message, error);
|
|
54
|
-
toast.error(message);
|
|
55
|
-
}
|
|
56
|
-
}}
|
|
57
|
-
>
|
|
58
|
-
{(formikProps) => (
|
|
59
|
-
<form onSubmit={formikProps.handleSubmit}>
|
|
60
|
-
<Box flexDirection="column" gap={4} padding={16}>
|
|
61
|
-
<FormInput
|
|
62
|
-
disabled={formikProps.isSubmitting}
|
|
63
|
-
error={typeof formikProps.errors.writeAPIToken === "string"}
|
|
64
|
-
label="Paste your Write API token"
|
|
65
|
-
onValueChange={(value) => {
|
|
66
|
-
void formikProps.setFieldValue("writeAPIToken", value);
|
|
67
|
-
}}
|
|
68
|
-
placeholder="Write API token"
|
|
69
|
-
value={formikProps.values.writeAPIToken}
|
|
70
|
-
/>
|
|
71
|
-
<Text color="grey11">
|
|
72
|
-
Required to sync models from {providerConfig.name} to Prismic.
|
|
73
|
-
</Text>
|
|
74
|
-
</Box>
|
|
75
|
-
<DialogActions>
|
|
76
|
-
<DialogActionLink
|
|
77
|
-
href={new URL("/settings/apps", repositoryUrl).href}
|
|
78
|
-
>
|
|
79
|
-
Create a Prismic Write API token
|
|
80
|
-
</DialogActionLink>
|
|
81
|
-
<DialogCancelButton size="medium" />
|
|
82
|
-
<DialogActionButton
|
|
83
|
-
disabled={!formikProps.isValid}
|
|
84
|
-
loading={formikProps.isSubmitting}
|
|
85
|
-
onClick={() => void formikProps.submitForm()}
|
|
86
|
-
size="medium"
|
|
87
|
-
>
|
|
88
|
-
Save Token
|
|
89
|
-
</DialogActionButton>
|
|
90
|
-
</DialogActions>
|
|
91
|
-
</form>
|
|
92
|
-
)}
|
|
93
|
-
</Formik>
|
|
94
|
-
</DialogContent>
|
|
95
|
-
</Dialog>
|
|
96
|
-
);
|
|
97
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Box,
|
|
3
|
-
Dialog,
|
|
4
|
-
DialogActionButton,
|
|
5
|
-
DialogActions,
|
|
6
|
-
DialogCancelButton,
|
|
7
|
-
DialogContent,
|
|
8
|
-
DialogHeader,
|
|
9
|
-
Text,
|
|
10
|
-
} from "@prismicio/editor-ui";
|
|
11
|
-
import type { GitRepoSpecifier } from "@slicemachine/manager";
|
|
12
|
-
import { type FC, type ReactNode, useState } from "react";
|
|
13
|
-
import { toast } from "react-toastify";
|
|
14
|
-
|
|
15
|
-
type GitRepositoryDisconnectDialogProps = {
|
|
16
|
-
repo: GitRepoSpecifier;
|
|
17
|
-
trigger: ReactNode;
|
|
18
|
-
unlinkRepo: (repo: GitRepoSpecifier) => Promise<void>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const GitRepositoryDisconnectDialog: FC<
|
|
22
|
-
GitRepositoryDisconnectDialogProps
|
|
23
|
-
> = ({ repo, trigger, unlinkRepo }) => {
|
|
24
|
-
const [loading, setLoading] = useState(false);
|
|
25
|
-
return (
|
|
26
|
-
<Dialog size={{ width: 448, height: "auto" }} trigger={trigger}>
|
|
27
|
-
<DialogHeader title="Remove Git Connection" />
|
|
28
|
-
<DialogContent>
|
|
29
|
-
<Box flexDirection="column" padding={16}>
|
|
30
|
-
<Text>
|
|
31
|
-
You will not be able to push your code alongside your models
|
|
32
|
-
anymore. Note that you can reconnect your Git repository at any
|
|
33
|
-
time. Are you sure you want to continue?
|
|
34
|
-
</Text>
|
|
35
|
-
</Box>
|
|
36
|
-
</DialogContent>
|
|
37
|
-
<DialogActions>
|
|
38
|
-
<DialogCancelButton size="medium" />
|
|
39
|
-
<DialogActionButton
|
|
40
|
-
size="medium"
|
|
41
|
-
color="tomato"
|
|
42
|
-
loading={loading}
|
|
43
|
-
onClick={() => {
|
|
44
|
-
void (async () => {
|
|
45
|
-
setLoading(true);
|
|
46
|
-
try {
|
|
47
|
-
await unlinkRepo(repo);
|
|
48
|
-
} catch (error) {
|
|
49
|
-
const message = `Could not disconnect from ${repo.name}`;
|
|
50
|
-
console.error(message, error);
|
|
51
|
-
toast.error(message);
|
|
52
|
-
}
|
|
53
|
-
setLoading(false);
|
|
54
|
-
})();
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
Disconnect
|
|
58
|
-
</DialogActionButton>
|
|
59
|
-
</DialogActions>
|
|
60
|
-
</Dialog>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { useExperimentVariant } from "@/hooks/useExperimentVariant";
|
|
2
|
-
|
|
3
|
-
type UseGitIntegrationExperimentReturnType = { eligible: boolean };
|
|
4
|
-
|
|
5
|
-
export function useGitIntegrationExperiment(): UseGitIntegrationExperimentReturnType {
|
|
6
|
-
const variant = useExperimentVariant("slicemachine-git-integration");
|
|
7
|
-
return { eligible: variant?.value === "on" };
|
|
8
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useRequest } from "@prismicio/editor-support/Suspense";
|
|
2
|
-
import type { GitOwner } from "@slicemachine/manager";
|
|
3
|
-
|
|
4
|
-
import { managerClient } from "@/managerClient";
|
|
5
|
-
|
|
6
|
-
export function useGitOwners(): GitOwner[] {
|
|
7
|
-
return useRequest(getGitOwners, []);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async function getGitOwners(): Promise<GitOwner[]> {
|
|
11
|
-
return await managerClient.git.fetchOwners();
|
|
12
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useRequest } from "@prismicio/editor-support/Suspense";
|
|
2
|
-
import type { GitRepo } from "@slicemachine/manager";
|
|
3
|
-
|
|
4
|
-
import { managerClient } from "@/managerClient";
|
|
5
|
-
|
|
6
|
-
type UseGitReposArgs = Parameters<typeof managerClient.git.fetchRepos>[0];
|
|
7
|
-
|
|
8
|
-
export function useGitRepos(args: UseGitReposArgs): GitRepo[] {
|
|
9
|
-
return useRequest(getGitRepos, [
|
|
10
|
-
args.provider,
|
|
11
|
-
args.owner,
|
|
12
|
-
args.query,
|
|
13
|
-
args.page,
|
|
14
|
-
]);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async function getGitRepos(
|
|
18
|
-
provider: "gitHub",
|
|
19
|
-
owner: string,
|
|
20
|
-
query?: string,
|
|
21
|
-
page?: number,
|
|
22
|
-
): Promise<GitRepo[]> {
|
|
23
|
-
return await managerClient.git.fetchRepos({ provider, owner, query, page });
|
|
24
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { revalidateData, useRequest } from "@prismicio/editor-support/Suspense";
|
|
2
|
-
import type { GitRepoSpecifier } from "@slicemachine/manager";
|
|
3
|
-
|
|
4
|
-
import { useSliceMachineConfig } from "@/hooks/useSliceMachineConfig";
|
|
5
|
-
import { managerClient } from "@/managerClient";
|
|
6
|
-
|
|
7
|
-
type UseLinkedGitReposReturnType = {
|
|
8
|
-
linkedGitRepos: GitRepoSpecifier[];
|
|
9
|
-
linkRepo: (git: GitRepoSpecifier) => Promise<void>;
|
|
10
|
-
unlinkRepo: (git: GitRepoSpecifier) => Promise<void>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export function useLinkedGitRepos(): UseLinkedGitReposReturnType {
|
|
14
|
-
const [config] = useSliceMachineConfig();
|
|
15
|
-
const linkedGitRepos = useRequest(getLinkedGitRepos, [config.repositoryName]);
|
|
16
|
-
return {
|
|
17
|
-
linkedGitRepos,
|
|
18
|
-
linkRepo: async (git) => {
|
|
19
|
-
await managerClient.git.linkRepo({
|
|
20
|
-
prismic: { domain: config.repositoryName },
|
|
21
|
-
git,
|
|
22
|
-
});
|
|
23
|
-
await revalidateData(getLinkedGitRepos, [config.repositoryName]);
|
|
24
|
-
},
|
|
25
|
-
unlinkRepo: async (git) => {
|
|
26
|
-
await managerClient.git.unlinkRepo({
|
|
27
|
-
prismic: { domain: config.repositoryName },
|
|
28
|
-
git,
|
|
29
|
-
});
|
|
30
|
-
await revalidateData(getLinkedGitRepos, [config.repositoryName]);
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function getLinkedGitRepos(
|
|
36
|
-
prismicDomain: string,
|
|
37
|
-
): Promise<GitRepoSpecifier[]> {
|
|
38
|
-
return await managerClient.git.fetchLinkedRepos({
|
|
39
|
-
prismic: { domain: prismicDomain },
|
|
40
|
-
});
|
|
41
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { GitRepoSpecifier } from "@slicemachine/manager";
|
|
2
|
-
|
|
3
|
-
import { useSliceMachineConfig } from "@/hooks/useSliceMachineConfig";
|
|
4
|
-
import { managerClient } from "@/managerClient";
|
|
5
|
-
|
|
6
|
-
type UseWriteAPITokenReturnType = {
|
|
7
|
-
updateToken: (token: string) => Promise<void>;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function useWriteAPIToken(args: {
|
|
11
|
-
git: GitRepoSpecifier;
|
|
12
|
-
}): UseWriteAPITokenReturnType {
|
|
13
|
-
const [config] = useSliceMachineConfig();
|
|
14
|
-
return {
|
|
15
|
-
updateToken: async (token) => {
|
|
16
|
-
await managerClient.git.updateWriteAPIToken({
|
|
17
|
-
prismic: { domain: config.repositoryName },
|
|
18
|
-
git: args.git,
|
|
19
|
-
token,
|
|
20
|
-
});
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { FC, SVGProps } from "react";
|
|
2
|
-
|
|
3
|
-
export const BitbucketIcon: FC<SVGProps<SVGSVGElement>> = (props) => (
|
|
4
|
-
<svg
|
|
5
|
-
width="24"
|
|
6
|
-
height="24"
|
|
7
|
-
viewBox="0 0 24 24"
|
|
8
|
-
fill="none"
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
{...props}
|
|
11
|
-
>
|
|
12
|
-
<path
|
|
13
|
-
fillRule="evenodd"
|
|
14
|
-
clipRule="evenodd"
|
|
15
|
-
d="M4.77596 5.47599C4.84147 5.44648 4.91265 5.43167 4.9845 5.4326L19.3525 5.43506C19.4243 5.43413 19.4955 5.44894 19.561 5.47845C19.6265 5.50796 19.6848 5.55146 19.7317 5.60588C19.7786 5.6603 19.8131 5.72433 19.8326 5.79348C19.8521 5.86262 19.8563 5.93521 19.8448 6.00614L19.1802 10.0751H9.71803L10.5722 14.6018H11.1162L11.1162 14.6018H13.7846L14.56 10.0751H19.1803L17.7575 18.8357C17.7387 18.9522 17.6786 19.058 17.5882 19.1339C17.4979 19.2098 17.3832 19.2507 17.2652 19.2492H7.23692C7.2134 19.249 7.19001 19.2476 7.16682 19.2449C7.03392 19.2298 6.90803 19.175 6.80603 19.0868C6.68704 18.9851 6.60772 18.8448 6.58203 18.6904L4.49219 6.00367C4.48069 5.93275 4.48485 5.86016 4.50438 5.79102C4.52392 5.72187 4.55835 5.65784 4.60527 5.60342C4.65218 5.54899 4.71044 5.5055 4.77596 5.47599Z"
|
|
16
|
-
fill="currentColor"
|
|
17
|
-
/>
|
|
18
|
-
</svg>
|
|
19
|
-
);
|
package/src/icons/GitHubIcon.tsx
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { FC, SVGProps } from "react";
|
|
2
|
-
|
|
3
|
-
export const GitHubIcon: FC<SVGProps<SVGSVGElement>> = (props) => (
|
|
4
|
-
<svg
|
|
5
|
-
width="24"
|
|
6
|
-
height="24"
|
|
7
|
-
viewBox="0 0 24 24"
|
|
8
|
-
fill="none"
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
{...props}
|
|
11
|
-
>
|
|
12
|
-
<path
|
|
13
|
-
d="M12 4C7.57486 4 4 7.57486 4 12C4 15.5246 6.30057 18.5257 9.47429 19.6C9.87429 19.6754 10.0251 19.4251 10.0251 19.2251V17.8754C7.8 18.3497 7.32457 16.8 7.32457 16.8C6.94971 15.8743 6.42514 15.6251 6.42514 15.6251C5.70057 15.1246 6.47543 15.1497 6.47543 15.1497C7.27543 15.2 7.69943 15.9749 7.69943 15.9749C8.42514 17.2 9.57486 16.8503 10.0251 16.6491C10.1006 16.1246 10.2994 15.7749 10.5246 15.5749C8.74971 15.3749 6.87543 14.6754 6.87543 11.6251C6.87543 10.7497 7.17486 10.0503 7.69943 9.47543C7.62514 9.27543 7.34971 8.45029 7.77486 7.34971C7.77486 7.34971 8.44914 7.12457 9.97486 8.17486C10.6266 7.99627 11.2991 7.90405 11.9749 7.90057C12.6491 7.90057 13.3497 8 13.9749 8.17486C15.5006 7.14971 16.1749 7.34971 16.1749 7.34971C16.6 8.45029 16.3246 9.27543 16.2503 9.47543C16.776 10.024 17.0754 10.7497 17.0754 11.624C17.0754 14.6994 15.2 15.3749 13.4251 15.5749C13.6994 15.8251 13.9749 16.2994 13.9749 17.0491V19.2503C13.9749 19.4754 14.1246 19.7246 14.5246 19.6251C17.7006 18.5246 20 15.5246 20 12C20 7.57486 16.4251 4 12 4Z"
|
|
14
|
-
fill="currentColor"
|
|
15
|
-
/>
|
|
16
|
-
</svg>
|
|
17
|
-
);
|
package/src/icons/GitLabIcon.tsx
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { FC, SVGProps } from "react";
|
|
2
|
-
|
|
3
|
-
export const GitLabIcon: FC<SVGProps<SVGSVGElement>> = (props) => (
|
|
4
|
-
<svg
|
|
5
|
-
width="24"
|
|
6
|
-
height="24"
|
|
7
|
-
viewBox="0 0 24 24"
|
|
8
|
-
fill="none"
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
{...props}
|
|
11
|
-
>
|
|
12
|
-
<path
|
|
13
|
-
fillRule="evenodd"
|
|
14
|
-
clipRule="evenodd"
|
|
15
|
-
d="M14.7881 10.5954L16.5431 5.20756C16.6328 4.93081 17.0594 4.93081 17.1492 5.20756L18.9076 10.5954H14.7881ZM6.6192 5.20756L4.86353 10.5954H8.97968L7.22468 5.20756C7.1349 4.93081 6.70898 4.93081 6.6192 5.20756ZM4.0299 13.2981L4.86352 10.5954H4.86353H8.979H14.7881H18.9076L19.7392 13.2981C19.7796 13.4207 19.7802 13.553 19.7408 13.676C19.7014 13.799 19.624 13.9063 19.5198 13.9826L11.893 19.5257L11.8879 19.5319L11.8923 19.5378L11.8865 19.5336L11.8835 19.5371L11.8852 19.5326L4.24927 13.9826C4.0299 13.8246 3.95092 13.5458 4.0299 13.2981Z"
|
|
16
|
-
fill="currentColor"
|
|
17
|
-
/>
|
|
18
|
-
</svg>
|
|
19
|
-
);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { FC, SVGProps } from "react";
|
|
2
|
-
|
|
3
|
-
export const SettingsIcon: FC<SVGProps<SVGSVGElement>> = (props) => (
|
|
4
|
-
<svg
|
|
5
|
-
width="32"
|
|
6
|
-
height="32"
|
|
7
|
-
viewBox="0 0 32 32"
|
|
8
|
-
fill="none"
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
{...props}
|
|
11
|
-
>
|
|
12
|
-
<path
|
|
13
|
-
fillRule="evenodd"
|
|
14
|
-
clipRule="evenodd"
|
|
15
|
-
d="M16 12C16 13.1046 15.1046 14 14 14C12.8954 14 12 13.1046 12 12C12 10.8954 12.8954 10 14 10C15.1046 10 16 10.8954 16 12ZM14 9C15.4865 9 16.7205 10.0811 16.9585 11.5H23.5C23.7761 11.5 24 11.7239 24 12C24 12.2761 23.7761 12.5 23.5 12.5H16.9585C16.7205 13.9189 15.4865 15 14 15C12.5135 15 11.2795 13.9189 11.0415 12.5H8.5C8.22386 12.5 8 12.2761 8 12C8 11.7239 8.22386 11.5 8.5 11.5H11.0415C11.2795 10.0811 12.5135 9 14 9ZM21 20C21 21.1046 20.1046 22 19 22C17.8954 22 17 21.1046 17 20C17 18.8954 17.8954 18 19 18C20.1046 18 21 18.8954 21 20ZM16.0415 20.5C16.2795 21.9189 17.5135 23 19 23C20.4865 23 21.7205 21.9189 21.9585 20.5H23.5C23.7761 20.5 24 20.2761 24 20C24 19.7239 23.7761 19.5 23.5 19.5H21.9585C21.7205 18.0811 20.4865 17 19 17C17.5135 17 16.2795 18.0811 16.0415 19.5H8.5C8.22386 19.5 8 19.7239 8 20C8 20.2761 8.22386 20.5 8.5 20.5H16.0415Z"
|
|
16
|
-
fill="currentColor"
|
|
17
|
-
/>
|
|
18
|
-
</svg>
|
|
19
|
-
);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ComponentUI } from "@/legacy/lib/models/common/ComponentUI";
|
|
2
|
-
|
|
3
|
-
export const sliceTemplatesComingSoon: ComponentUI[] = [
|
|
4
|
-
{
|
|
5
|
-
extension: "",
|
|
6
|
-
fileName: "",
|
|
7
|
-
from: "",
|
|
8
|
-
href: "",
|
|
9
|
-
pathToSlice: "",
|
|
10
|
-
model: {
|
|
11
|
-
id: "video_highlights",
|
|
12
|
-
name: "VideoHighlights",
|
|
13
|
-
type: "SharedSlice",
|
|
14
|
-
variations: [
|
|
15
|
-
{
|
|
16
|
-
description: "",
|
|
17
|
-
docURL: "",
|
|
18
|
-
id: "default",
|
|
19
|
-
name: "Default",
|
|
20
|
-
version: "sktwi1xtmkfgx8626",
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
screenshots: {
|
|
25
|
-
default: {
|
|
26
|
-
url: "/videoHighlights.png",
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
];
|
package/src/pages/settings.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SettingsPage as default } from "@/features/settings/SettingsPage";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function capitalizeFirstLetter(string: string) {
|
|
2
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function pluralize(
|
|
6
|
-
singular: string,
|
|
7
|
-
count: number = 2,
|
|
8
|
-
plural?: string,
|
|
9
|
-
) {
|
|
10
|
-
return count === 1 ? singular : plural ?? `${singular}s`;
|
|
11
|
-
}
|
|
File without changes
|