slice-machine-ui 2.17.3-beta.1 → 2.17.3-beta.11
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/Mn1b3xEWEJNa-mSgCSYLq/_buildManifest.js +1 -0
- package/out/_next/static/chunks/04ad993f.d7f986af0f739cc9.js +28 -0
- package/out/_next/static/chunks/248-bdbfde18c5a04eae.js +1 -0
- package/out/_next/static/chunks/34-8d9d9b2944824750.js +1 -0
- package/out/_next/static/chunks/489-6edb99e269996dd1.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-76c43bdc0320687e.js} +220 -222
- package/out/_next/static/chunks/pages/changelog-21b960abba5abf71.js +1 -0
- package/out/_next/static/chunks/pages/changes-bdfa50eadb1e5a42.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-d79597003a1ff74e.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]-98f85d5fb8d5c704.js +1 -0
- package/out/_next/static/chunks/pages/slices-046e5e978ffc3a42.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/apiClient.ts +1 -1
- package/src/domain/fields.ts +7 -7
- package/src/features/auth/LogoutButton.tsx +37 -0
- 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 +14 -5
- package/src/features/environments/useActiveEnvironment.ts +8 -1
- package/src/features/environments/useEnvironments.ts +8 -1
- 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/LoginModal/index.tsx +11 -3
- package/src/legacy/components/Navigation/Environment.tsx +11 -3
- package/src/legacy/components/Navigation/SideNavEnvironmentSelector/SideNavEnvironmentSelector.tsx +3 -0
- 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 → Mn1b3xEWEJNa-mSgCSYLq}/_ssgManifest.js +0 -0
package/src/apiClient.ts
CHANGED
|
@@ -163,7 +163,7 @@ export const pushChanges: SliceMachineManagerClient["prismicRepository"]["pushCh
|
|
|
163
163
|
|
|
164
164
|
/** Auth Routes * */
|
|
165
165
|
|
|
166
|
-
export const
|
|
166
|
+
export const clearAuth = async (): Promise<void> => {
|
|
167
167
|
return await managerClient.user.logout();
|
|
168
168
|
};
|
|
169
169
|
|
package/src/domain/fields.ts
CHANGED
|
@@ -92,7 +92,7 @@ export const imageField: NestableField = {
|
|
|
92
92
|
type: "Image",
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
export const
|
|
95
|
+
export const linkField: NestableField = {
|
|
96
96
|
name: "Link",
|
|
97
97
|
description: "A link to a website, asset, or document.",
|
|
98
98
|
icon: "link",
|
|
@@ -111,8 +111,8 @@ export const contentRelationshipField: NestableField = {
|
|
|
111
111
|
variant: "ContentRelationship",
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
-
export const
|
|
115
|
-
name: "Link
|
|
114
|
+
export const linkToMediaField: NestableField = {
|
|
115
|
+
name: "Link to Media",
|
|
116
116
|
description: "A link to a media asset.",
|
|
117
117
|
icon: "attachFile",
|
|
118
118
|
thumbnail:
|
|
@@ -182,8 +182,8 @@ export const nestableFields: NestableField[] = [
|
|
|
182
182
|
booleanField,
|
|
183
183
|
numberField,
|
|
184
184
|
selectField,
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
linkField,
|
|
186
|
+
linkToMediaField,
|
|
187
187
|
colorField,
|
|
188
188
|
dateField,
|
|
189
189
|
tableField,
|
|
@@ -197,7 +197,7 @@ export const nestableFields: NestableField[] = [
|
|
|
197
197
|
* UID
|
|
198
198
|
*/
|
|
199
199
|
|
|
200
|
-
export const
|
|
200
|
+
export const uidField: UIDField = {
|
|
201
201
|
name: "UID",
|
|
202
202
|
description: "Unique Identifier",
|
|
203
203
|
icon: "tag",
|
|
@@ -230,4 +230,4 @@ export const groupFields: GroupField[] = [groupField, nestedGroupField];
|
|
|
230
230
|
* All fields
|
|
231
231
|
*/
|
|
232
232
|
|
|
233
|
-
export const fields = [...nestableFields,
|
|
233
|
+
export const fields = [...nestableFields, uidField, ...groupFields];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IconButton, Tooltip } from "@prismicio/editor-ui";
|
|
2
|
+
import * as Sentry from "@sentry/nextjs";
|
|
3
|
+
import { toast } from "react-toastify";
|
|
4
|
+
|
|
5
|
+
import { clearAuth as managerLogout, getState } from "@/apiClient";
|
|
6
|
+
import { invalidateActiveEnvironmentData } from "@/features/environments/useActiveEnvironment";
|
|
7
|
+
import { invalidateEnvironmentsData } from "@/features/environments/useEnvironments";
|
|
8
|
+
import useSliceMachineActions from "@/modules/useSliceMachineActions";
|
|
9
|
+
|
|
10
|
+
export function LogoutButton() {
|
|
11
|
+
const { refreshState } = useSliceMachineActions();
|
|
12
|
+
|
|
13
|
+
async function onClick() {
|
|
14
|
+
await managerLogout();
|
|
15
|
+
|
|
16
|
+
const serverState = await getState();
|
|
17
|
+
refreshState(serverState);
|
|
18
|
+
|
|
19
|
+
Sentry.setUser({ id: serverState.env.shortId });
|
|
20
|
+
|
|
21
|
+
// refresh queries to update the UI
|
|
22
|
+
invalidateEnvironmentsData();
|
|
23
|
+
invalidateActiveEnvironmentData();
|
|
24
|
+
|
|
25
|
+
toast.success("Logged out");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Tooltip content="Log out" side="right">
|
|
30
|
+
<IconButton
|
|
31
|
+
icon="logout"
|
|
32
|
+
onClick={() => void onClick()}
|
|
33
|
+
hiddenLabel="Log out"
|
|
34
|
+
/>
|
|
35
|
+
</Tooltip>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
FieldVariant,
|
|
19
19
|
groupField,
|
|
20
20
|
nestableFields,
|
|
21
|
-
|
|
21
|
+
uidField,
|
|
22
22
|
} from "@/domain/fields";
|
|
23
23
|
|
|
24
24
|
export type AddFieldDropdownProps = {
|
|
@@ -47,7 +47,7 @@ export function AddFieldDropdown(props: AddFieldDropdownProps) {
|
|
|
47
47
|
(field) =>
|
|
48
48
|
nestableFields.some(
|
|
49
49
|
(nestableField) => nestableField.name === field.name,
|
|
50
|
-
) || field.name ===
|
|
50
|
+
) || field.name === uidField.name,
|
|
51
51
|
);
|
|
52
52
|
const groupFieldToRender = fields.find(
|
|
53
53
|
(field) => field.name === groupField.name,
|
|
@@ -1,83 +1,20 @@
|
|
|
1
|
-
import { Button
|
|
1
|
+
import { Button } from "@prismicio/editor-ui";
|
|
2
2
|
import {
|
|
3
3
|
type ComponentPropsWithoutRef,
|
|
4
4
|
type ElementRef,
|
|
5
|
-
type FC,
|
|
6
5
|
forwardRef,
|
|
7
|
-
type ReactNode,
|
|
8
|
-
Suspense,
|
|
9
6
|
} from "react";
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
import { gitProviderToConfig } from "@/features/settings/git/GitProvider";
|
|
13
|
-
import { useGitIntegrationExperiment } from "@/features/settings/git/useGitIntegrationExperiment";
|
|
14
|
-
import { useLinkedGitRepos } from "@/features/settings/git/useLinkedGitRepos";
|
|
15
|
-
|
|
16
|
-
type PushChangesButtonProps = Required<BarePushChangesButtonProps>;
|
|
17
|
-
|
|
18
|
-
export const PushChangesButton: FC<PushChangesButtonProps> = (props) => (
|
|
19
|
-
<ErrorBoundary renderError={renderError}>
|
|
20
|
-
<Suspense fallback={<PushChangesButtonSkeleton />}>
|
|
21
|
-
<PushChangesButtonUsingGitIntegrationExperiment {...props} />
|
|
22
|
-
</Suspense>
|
|
23
|
-
</ErrorBoundary>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const PushChangesButtonUsingGitIntegrationExperiment: FC<
|
|
27
|
-
PushChangesButtonProps
|
|
28
|
-
> = (props) => {
|
|
29
|
-
const gitIntegrationExperiment = useGitIntegrationExperiment();
|
|
30
|
-
return gitIntegrationExperiment.eligible ? (
|
|
31
|
-
<PushChangesButtonUsingLinkedGitRepos {...props} />
|
|
32
|
-
) : (
|
|
33
|
-
<BarePushChangesButton {...props} />
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const PushChangesButtonUsingLinkedGitRepos: FC<PushChangesButtonProps> = (
|
|
38
|
-
props,
|
|
39
|
-
) => {
|
|
40
|
-
const { linkedGitRepos } = useLinkedGitRepos();
|
|
41
|
-
if (linkedGitRepos.length > 0) {
|
|
42
|
-
const providerConfig = gitProviderToConfig[linkedGitRepos[0].provider];
|
|
43
|
-
return (
|
|
44
|
-
<Tooltip
|
|
45
|
-
content={`This project uses the Git workflow. Update Prismic by pushing your changes to ${providerConfig.name}.`}
|
|
46
|
-
side="bottom"
|
|
47
|
-
>
|
|
48
|
-
<BarePushChangesButton disabled />
|
|
49
|
-
</Tooltip>
|
|
50
|
-
);
|
|
51
|
-
} else {
|
|
52
|
-
return <BarePushChangesButton {...props} />;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
type BarePushChangesButtonProps = Pick<
|
|
8
|
+
type PushChangesButtonProps = Pick<
|
|
57
9
|
ComponentPropsWithoutRef<typeof Button>,
|
|
58
10
|
"disabled" | "loading" | "onClick"
|
|
59
11
|
>;
|
|
60
12
|
|
|
61
|
-
const
|
|
13
|
+
export const PushChangesButton = forwardRef<
|
|
62
14
|
ElementRef<typeof Button>,
|
|
63
|
-
|
|
15
|
+
PushChangesButtonProps
|
|
64
16
|
>((props, ref) => (
|
|
65
17
|
<Button {...props} ref={ref} startIcon="upload">
|
|
66
18
|
Push
|
|
67
19
|
</Button>
|
|
68
20
|
));
|
|
69
|
-
|
|
70
|
-
function renderError(): ReactNode {
|
|
71
|
-
return (
|
|
72
|
-
<Tooltip
|
|
73
|
-
content="An error occurred while fetching the list of connected Git repositories."
|
|
74
|
-
side="bottom"
|
|
75
|
-
>
|
|
76
|
-
<BarePushChangesButton disabled />
|
|
77
|
-
</Tooltip>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const PushChangesButtonSkeleton: FC = () => (
|
|
82
|
-
<Skeleton height={32} width={71.32} />
|
|
83
|
-
);
|
|
@@ -22,15 +22,10 @@ import { toast } from "react-toastify";
|
|
|
22
22
|
|
|
23
23
|
import { getState, telemetry } from "@/apiClient";
|
|
24
24
|
import { addAiFeedback } from "@/features/aiFeedback";
|
|
25
|
-
import {
|
|
26
|
-
useSectionsNamingExperiment,
|
|
27
|
-
UseSectionsNamingExperimentReturnType,
|
|
28
|
-
} from "@/features/builder/useSectionsNamingExperiment";
|
|
29
25
|
import { useOnboarding } from "@/features/onboarding/useOnboarding";
|
|
30
26
|
import { useAutoSync } from "@/features/sync/AutoSyncProvider";
|
|
31
27
|
import { managerClient } from "@/managerClient";
|
|
32
28
|
import useSliceMachineActions from "@/modules/useSliceMachineActions";
|
|
33
|
-
import { pluralize } from "@/utils/textConversion";
|
|
34
29
|
|
|
35
30
|
import { Slice, SliceCard } from "./SliceCard";
|
|
36
31
|
|
|
@@ -58,7 +53,7 @@ export function CreateSliceFromImageModal(
|
|
|
58
53
|
const { syncChanges } = useAutoSync();
|
|
59
54
|
const { createSliceSuccess } = useSliceMachineActions();
|
|
60
55
|
const { completeStep } = useOnboarding();
|
|
61
|
-
|
|
56
|
+
|
|
62
57
|
/**
|
|
63
58
|
* Keeps track of the current instance id.
|
|
64
59
|
* When the modal is closed, the id is reset.
|
|
@@ -244,8 +239,7 @@ export function CreateSliceFromImageModal(
|
|
|
244
239
|
<DialogHeader title="Generate from image" />
|
|
245
240
|
<DialogContent gap={0}>
|
|
246
241
|
<DialogDescription hidden>
|
|
247
|
-
Upload images to generate
|
|
248
|
-
with AI
|
|
242
|
+
Upload images to generate slices with AI
|
|
249
243
|
</DialogDescription>
|
|
250
244
|
{slices.length === 0 ? (
|
|
251
245
|
<Box padding={16} height="100%">
|
|
@@ -285,8 +279,7 @@ export function CreateSliceFromImageModal(
|
|
|
285
279
|
loading={isCreatingSlices}
|
|
286
280
|
onClick={onSubmit}
|
|
287
281
|
>
|
|
288
|
-
{getSubmitButtonLabel(
|
|
289
|
-
{readySlices.length})
|
|
282
|
+
{getSubmitButtonLabel(location)} ({readySlices.length})
|
|
290
283
|
</DialogActionButton>
|
|
291
284
|
</DialogActions>
|
|
292
285
|
</DialogContent>
|
|
@@ -298,7 +291,6 @@ function UploadBlankSlate(props: {
|
|
|
298
291
|
droppingFiles?: boolean;
|
|
299
292
|
onFilesSelected: (files: File[]) => void;
|
|
300
293
|
}) {
|
|
301
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
302
294
|
const { droppingFiles = false, onFilesSelected } = props;
|
|
303
295
|
|
|
304
296
|
return (
|
|
@@ -320,8 +312,7 @@ function UploadBlankSlate(props: {
|
|
|
320
312
|
/>
|
|
321
313
|
<BlankSlateTitle>Upload your design images.</BlankSlateTitle>
|
|
322
314
|
<BlankSlateDescription>
|
|
323
|
-
Once uploaded, you can generate
|
|
324
|
-
{pluralize(sectionsNamingExperiment.value)} automatically using AI.
|
|
315
|
+
Once uploaded, you can generate slices automatically using AI.
|
|
325
316
|
</BlankSlateDescription>
|
|
326
317
|
<BlankSlateActions>
|
|
327
318
|
<FileUploadButton
|
|
@@ -469,19 +460,15 @@ async function addSlices(newSlices: NewSlice[]) {
|
|
|
469
460
|
return { library, slices };
|
|
470
461
|
}
|
|
471
462
|
|
|
472
|
-
const getSubmitButtonLabel = (
|
|
473
|
-
location,
|
|
474
|
-
|
|
475
|
-
}: {
|
|
476
|
-
location: "custom_type" | "page_type" | "slices";
|
|
477
|
-
sectionsNamingExperiment: UseSectionsNamingExperimentReturnType;
|
|
478
|
-
}) => {
|
|
463
|
+
const getSubmitButtonLabel = (
|
|
464
|
+
location: "custom_type" | "page_type" | "slices",
|
|
465
|
+
) => {
|
|
479
466
|
switch (location) {
|
|
480
467
|
case "custom_type":
|
|
481
468
|
return "Add to type";
|
|
482
469
|
case "page_type":
|
|
483
470
|
return "Add to page";
|
|
484
471
|
case "slices":
|
|
485
|
-
return
|
|
472
|
+
return "Add to slices";
|
|
486
473
|
}
|
|
487
474
|
};
|
|
@@ -9,10 +9,6 @@ import {
|
|
|
9
9
|
} from "@prismicio/editor-ui";
|
|
10
10
|
import { FC } from "react";
|
|
11
11
|
|
|
12
|
-
import { useAiSliceGenerationExperiment } from "@/features/builder/useAiSliceGenerationExperiment";
|
|
13
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
14
|
-
import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
|
|
15
|
-
|
|
16
12
|
import { getSliceCreationOptions } from "./sliceCreationOptions";
|
|
17
13
|
|
|
18
14
|
export type SliceZoneBlankSlateProps = {
|
|
@@ -32,11 +28,8 @@ export const SliceZoneBlankSlate: FC<SliceZoneBlankSlateProps> = ({
|
|
|
32
28
|
projectHasAvailableSlices,
|
|
33
29
|
isSlicesTemplatesSupported,
|
|
34
30
|
}) => {
|
|
35
|
-
const aiSliceGenerationExperiment = useAiSliceGenerationExperiment();
|
|
36
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
37
31
|
const sliceCreationOptions = getSliceCreationOptions({
|
|
38
32
|
menuType: "ActionList",
|
|
39
|
-
sectionsNamingExperiment,
|
|
40
33
|
});
|
|
41
34
|
|
|
42
35
|
return (
|
|
@@ -47,28 +40,23 @@ export const SliceZoneBlankSlate: FC<SliceZoneBlankSlateProps> = ({
|
|
|
47
40
|
name="add"
|
|
48
41
|
size="large"
|
|
49
42
|
/>
|
|
50
|
-
<BlankSlateTitle size="big">
|
|
51
|
-
Add {pluralize(sectionsNamingExperiment.value)}
|
|
52
|
-
</BlankSlateTitle>
|
|
43
|
+
<BlankSlateTitle size="big">Add slices</BlankSlateTitle>
|
|
53
44
|
<BlankSlateDescription>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{sectionsNamingExperiment.value} has its own component in your code.
|
|
45
|
+
Slices are website sections that you can reuse on different pages with
|
|
46
|
+
different content. Each on different pages with different content. Each{" "}
|
|
47
|
+
slice has its own component in your code.
|
|
58
48
|
</BlankSlateDescription>
|
|
59
49
|
<BlankSlateActions>
|
|
60
50
|
<ActionList>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
</ActionListItem>
|
|
71
|
-
)}
|
|
51
|
+
<ActionListItem
|
|
52
|
+
renderStartIcon={() =>
|
|
53
|
+
sliceCreationOptions.fromImage.BackgroundIcon
|
|
54
|
+
}
|
|
55
|
+
onClick={openCreateSliceFromImageModal}
|
|
56
|
+
description={sliceCreationOptions.fromImage.description}
|
|
57
|
+
>
|
|
58
|
+
{sliceCreationOptions.fromImage.title}
|
|
59
|
+
</ActionListItem>
|
|
72
60
|
<ActionListItem
|
|
73
61
|
renderStartIcon={() =>
|
|
74
62
|
sliceCreationOptions.fromScratch.BackgroundIcon
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { BackgroundIcon } from "@prismicio/editor-ui";
|
|
2
2
|
|
|
3
|
-
import { UseSectionsNamingExperimentReturnType } from "@/features/builder/useSectionsNamingExperiment";
|
|
4
|
-
import { pluralize } from "@/utils/textConversion";
|
|
5
|
-
|
|
6
3
|
type SliceCreationOptionArgs = {
|
|
7
4
|
menuType: "ActionList" | "Dropdown";
|
|
8
|
-
sectionsNamingExperiment: UseSectionsNamingExperimentReturnType;
|
|
9
5
|
};
|
|
10
6
|
|
|
11
7
|
export const getSliceCreationOptions = (args: SliceCreationOptionArgs) => {
|
|
12
|
-
const { menuType
|
|
8
|
+
const { menuType } = args;
|
|
13
9
|
|
|
14
10
|
return {
|
|
15
11
|
fromImage: {
|
|
@@ -24,7 +20,7 @@ export const getSliceCreationOptions = (args: SliceCreationOptionArgs) => {
|
|
|
24
20
|
/>
|
|
25
21
|
),
|
|
26
22
|
title: "Generate from image",
|
|
27
|
-
description:
|
|
23
|
+
description: "Build a slice based on your design image.",
|
|
28
24
|
},
|
|
29
25
|
fromScratch: {
|
|
30
26
|
BackgroundIcon: (
|
|
@@ -38,7 +34,7 @@ export const getSliceCreationOptions = (args: SliceCreationOptionArgs) => {
|
|
|
38
34
|
/>
|
|
39
35
|
),
|
|
40
36
|
title: "Start from scratch",
|
|
41
|
-
description:
|
|
37
|
+
description: "Build a custom slice your way.",
|
|
42
38
|
},
|
|
43
39
|
fromTemplate: {
|
|
44
40
|
BackgroundIcon: (
|
|
@@ -65,10 +61,8 @@ export const getSliceCreationOptions = (args: SliceCreationOptionArgs) => {
|
|
|
65
61
|
radius={6}
|
|
66
62
|
/>
|
|
67
63
|
),
|
|
68
|
-
title:
|
|
69
|
-
description:
|
|
70
|
-
sectionsNamingExperiment.value,
|
|
71
|
-
)}`,
|
|
64
|
+
title: "Reuse an existing slice",
|
|
65
|
+
description: "Select from your created slices.",
|
|
72
66
|
},
|
|
73
67
|
};
|
|
74
68
|
};
|
|
@@ -15,18 +15,27 @@ type GetActiveEnvironmentReturnType =
|
|
|
15
15
|
error: unknown;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export async function getActiveEnvironment(
|
|
18
|
+
export async function getActiveEnvironment(
|
|
19
|
+
retried = false,
|
|
20
|
+
): Promise<GetActiveEnvironmentReturnType> {
|
|
19
21
|
try {
|
|
20
|
-
const
|
|
22
|
+
const activeEnvironmentResult =
|
|
21
23
|
await managerClient.project.fetchActiveEnvironment();
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
if (activeEnvironmentResult.type === "error") {
|
|
26
|
+
const errorInstance = new Error(activeEnvironmentResult.error.message);
|
|
27
|
+
errorInstance.name = activeEnvironmentResult.error.name;
|
|
28
|
+
throw errorInstance;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return { activeEnvironment: activeEnvironmentResult.activeEnvironment };
|
|
24
32
|
} catch (error) {
|
|
25
|
-
if (isInvalidActiveEnvironmentError(error)) {
|
|
33
|
+
if (isInvalidActiveEnvironmentError(error) && !retried) {
|
|
26
34
|
// Reset to the production environment.
|
|
27
35
|
await managerClient.project.updateEnvironment({ environment: undefined });
|
|
28
36
|
|
|
29
|
-
|
|
37
|
+
// Call recursively with isRetry=true to prevent infinite loop if it fails again and again.
|
|
38
|
+
return await getActiveEnvironment(true);
|
|
30
39
|
}
|
|
31
40
|
|
|
32
41
|
return { error };
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
invalidateFetcherData,
|
|
3
|
+
useRequest,
|
|
4
|
+
} from "@prismicio/editor-support/Suspense";
|
|
2
5
|
|
|
3
6
|
import { getActiveEnvironment } from "./actions/getActiveEnvironment";
|
|
4
7
|
|
|
8
|
+
export function invalidateActiveEnvironmentData() {
|
|
9
|
+
invalidateFetcherData(getActiveEnvironment);
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
export function useActiveEnvironment() {
|
|
6
13
|
return useRequest(getActiveEnvironment, []);
|
|
7
14
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
invalidateFetcherData,
|
|
3
|
+
useRequest,
|
|
4
|
+
} from "@prismicio/editor-support/Suspense";
|
|
2
5
|
|
|
3
6
|
import { getEnvironments } from "./actions/getEnvironments";
|
|
4
7
|
|
|
8
|
+
export function invalidateEnvironmentsData() {
|
|
9
|
+
invalidateFetcherData(getEnvironments);
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
export function useEnvironments() {
|
|
6
13
|
return useRequest(getEnvironments, []);
|
|
7
14
|
}
|
|
@@ -8,18 +8,14 @@ import { CUSTOM_TYPES_CONFIG } from "@/features/customTypes/customTypesConfig";
|
|
|
8
8
|
import { CUSTOM_TYPES_MESSAGES } from "@/features/customTypes/customTypesMessages";
|
|
9
9
|
import { RepositoryInfo } from "@/features/navigation/RepositoryInfo";
|
|
10
10
|
import { OnboardingGuide } from "@/features/onboarding";
|
|
11
|
-
import { useGitIntegrationExperiment } from "@/features/settings/git/useGitIntegrationExperiment";
|
|
12
11
|
import { useAdapterName } from "@/hooks/useAdapterName";
|
|
13
12
|
import { useMarketingContent } from "@/hooks/useMarketingContent";
|
|
14
13
|
import { FolderIcon } from "@/icons/FolderIcon";
|
|
15
14
|
import { LightningIcon } from "@/icons/Lightning";
|
|
16
15
|
import { MenuBookIcon } from "@/icons/MenuBookIcon";
|
|
17
|
-
import { SettingsIcon } from "@/icons/SettingsIcon";
|
|
18
|
-
import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
|
|
19
16
|
|
|
20
17
|
import { ChangesItem } from "../../legacy/components/Navigation/ChangesItem";
|
|
21
18
|
import { Environment } from "../../legacy/components/Navigation/Environment";
|
|
22
|
-
import { useSectionsNamingExperiment } from "../builder/useSectionsNamingExperiment";
|
|
23
19
|
import { NavigationItem } from "./NavigationItem";
|
|
24
20
|
import { SliceMachineVersion } from "./SliceMachineVersion";
|
|
25
21
|
import { UpdateInfo } from "./UpdateInfo";
|
|
@@ -27,9 +23,7 @@ import { UpdateInfo } from "./UpdateInfo";
|
|
|
27
23
|
export function Navigation() {
|
|
28
24
|
const router = useRouter();
|
|
29
25
|
|
|
30
|
-
const gitIntegrationExperiment = useGitIntegrationExperiment();
|
|
31
26
|
const { documentationLink } = useMarketingContent();
|
|
32
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
33
27
|
const adapter = useAdapterName();
|
|
34
28
|
|
|
35
29
|
interface CustomTypeNavigationItemProps {
|
|
@@ -60,11 +54,9 @@ export function Navigation() {
|
|
|
60
54
|
minWidth={0}
|
|
61
55
|
>
|
|
62
56
|
<Box flexDirection="column" gap={16}>
|
|
63
|
-
<
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
</Suspense>
|
|
67
|
-
</ErrorBoundary>
|
|
57
|
+
<Suspense fallback={<Skeleton height={40} />}>
|
|
58
|
+
<Environment />
|
|
59
|
+
</Suspense>
|
|
68
60
|
|
|
69
61
|
<Separator style="dashed" />
|
|
70
62
|
|
|
@@ -80,9 +72,7 @@ export function Navigation() {
|
|
|
80
72
|
<CustomTypeNavigationItem type="custom" />
|
|
81
73
|
|
|
82
74
|
<NavigationItem
|
|
83
|
-
title=
|
|
84
|
-
capitalizeFirstLetter(sectionsNamingExperiment.value),
|
|
85
|
-
)}
|
|
75
|
+
title="Slices"
|
|
86
76
|
href="/slices"
|
|
87
77
|
Icon={FolderIcon}
|
|
88
78
|
active={router.asPath.startsWith("/slices")}
|
|
@@ -103,7 +93,6 @@ export function Navigation() {
|
|
|
103
93
|
<OnboardingGuide />
|
|
104
94
|
</Suspense>
|
|
105
95
|
</ErrorBoundary>
|
|
106
|
-
|
|
107
96
|
<NavigationItem
|
|
108
97
|
title="Documentation"
|
|
109
98
|
href={documentationLink}
|
|
@@ -117,15 +106,6 @@ export function Navigation() {
|
|
|
117
106
|
}}
|
|
118
107
|
/>
|
|
119
108
|
|
|
120
|
-
{gitIntegrationExperiment.eligible && (
|
|
121
|
-
<NavigationItem
|
|
122
|
-
title="Settings"
|
|
123
|
-
href="/settings"
|
|
124
|
-
Icon={SettingsIcon}
|
|
125
|
-
active={router.asPath.startsWith("/settings")}
|
|
126
|
-
/>
|
|
127
|
-
)}
|
|
128
|
-
|
|
129
109
|
<NavigationItem
|
|
130
110
|
title="Changelog"
|
|
131
111
|
href="/changelog"
|
|
@@ -27,7 +27,6 @@ import { AddPhotoAlternateIcon } from "@/icons/AddPhotoAlternateIcon";
|
|
|
27
27
|
import { ComponentUI } from "@/legacy/lib/models/common/ComponentUI";
|
|
28
28
|
|
|
29
29
|
type SharedSliceCardProps = {
|
|
30
|
-
isComingSoon?: boolean;
|
|
31
30
|
isDeleted?: boolean;
|
|
32
31
|
onUpdateScreenshot?: () => void;
|
|
33
32
|
slice: ComponentUI;
|
|
@@ -36,7 +35,7 @@ type SharedSliceCardProps = {
|
|
|
36
35
|
} & (
|
|
37
36
|
| /*
|
|
38
37
|
* Props for rendering a `Card` with a Next.js `Link` component (or with a
|
|
39
|
-
* non-interactive element if
|
|
38
|
+
* non-interactive element if `isDeleted` is true).
|
|
40
39
|
*/
|
|
41
40
|
{
|
|
42
41
|
mode: "navigation";
|
|
@@ -66,7 +65,6 @@ type Action =
|
|
|
66
65
|
export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
|
|
67
66
|
const {
|
|
68
67
|
action,
|
|
69
|
-
isComingSoon = false,
|
|
70
68
|
isDeleted = false,
|
|
71
69
|
onUpdateScreenshot,
|
|
72
70
|
selected = false,
|
|
@@ -79,7 +77,7 @@ export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
|
|
|
79
77
|
if (!variation) return null;
|
|
80
78
|
const src = getScreenshotUrl(slice, variation);
|
|
81
79
|
|
|
82
|
-
const disabled =
|
|
80
|
+
const disabled = isDeleted;
|
|
83
81
|
const canUpdateScreenshot = !disabled && !!onUpdateScreenshot;
|
|
84
82
|
const disableOverlay = variant === "outlined";
|
|
85
83
|
const hasVariationId = variationId !== undefined;
|
|
@@ -224,12 +222,6 @@ export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
|
|
|
224
222
|
: `${slice.model.variations.length} variation${
|
|
225
223
|
slice.model.variations.length > 1 ? "s" : ""
|
|
226
224
|
}`}
|
|
227
|
-
{isComingSoon ? (
|
|
228
|
-
<Text color="purple11" component="span" variant="small">
|
|
229
|
-
{" "}
|
|
230
|
-
• (coming soon)
|
|
231
|
-
</Text>
|
|
232
|
-
) : undefined}
|
|
233
225
|
</>
|
|
234
226
|
}
|
|
235
227
|
title={hasVariationId ? variation.name : slice.model.name}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BlankSlate,
|
|
3
|
+
BlankSlateDescription,
|
|
4
|
+
BlankSlateIcon,
|
|
5
|
+
BlankSlateTitle,
|
|
6
|
+
Box,
|
|
7
|
+
Button,
|
|
8
|
+
ButtonGroup,
|
|
9
|
+
} from "@prismicio/editor-ui";
|
|
2
10
|
import { useRouter } from "next/router";
|
|
3
11
|
import { FC, PropsWithChildren, Suspense } from "react";
|
|
4
12
|
|
|
@@ -18,7 +26,31 @@ export const AppLayout: FC<PropsWithChildren> = ({
|
|
|
18
26
|
...otherProps
|
|
19
27
|
}) => {
|
|
20
28
|
return (
|
|
21
|
-
<ErrorBoundary
|
|
29
|
+
<ErrorBoundary
|
|
30
|
+
renderError={(error) => {
|
|
31
|
+
return (
|
|
32
|
+
<Box
|
|
33
|
+
position="absolute"
|
|
34
|
+
top={64}
|
|
35
|
+
width="100%"
|
|
36
|
+
justifyContent="center"
|
|
37
|
+
flexDirection="column"
|
|
38
|
+
>
|
|
39
|
+
<BlankSlate>
|
|
40
|
+
<BlankSlateIcon
|
|
41
|
+
lineColor="tomato11"
|
|
42
|
+
backgroundColor="tomato3"
|
|
43
|
+
name="alert"
|
|
44
|
+
/>
|
|
45
|
+
<BlankSlateTitle>Failed to load Slice Machine</BlankSlateTitle>
|
|
46
|
+
<BlankSlateDescription>
|
|
47
|
+
{JSON.stringify(error)}
|
|
48
|
+
</BlankSlateDescription>
|
|
49
|
+
</BlankSlate>
|
|
50
|
+
</Box>
|
|
51
|
+
);
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
22
54
|
<Suspense>
|
|
23
55
|
<PageLayoutWithActiveEnvironment {...otherProps}>
|
|
24
56
|
<PageLayoutPane>
|
|
@@ -4,7 +4,6 @@ import { AiOutlineExclamationCircle } from "react-icons/ai";
|
|
|
4
4
|
|
|
5
5
|
import { countMissingScreenshots } from "@/domain/slice";
|
|
6
6
|
import { ErrorBoundary } from "@/ErrorBoundary";
|
|
7
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
8
7
|
import { SharedSliceCard } from "@/features/slices/sliceCards/SharedSliceCard";
|
|
9
8
|
import { ModelsStatuses } from "@/features/sync/getUnSyncChanges";
|
|
10
9
|
import { useScreenshotChangesModal } from "@/hooks/useScreenshotChangesModal";
|
|
@@ -16,7 +15,6 @@ import { ComponentUI } from "@/legacy/lib/models/common/ComponentUI";
|
|
|
16
15
|
import { LocalOrRemoteCustomType } from "@/legacy/lib/models/common/ModelData";
|
|
17
16
|
import { ModelStatus } from "@/legacy/lib/models/common/ModelStatus";
|
|
18
17
|
import { AuthStatus } from "@/modules/userContext/types";
|
|
19
|
-
import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
|
|
20
18
|
|
|
21
19
|
import { DevCollaborationExperiment } from "./DevCollaborationExperiment";
|
|
22
20
|
|
|
@@ -36,7 +34,6 @@ export const ChangesItems: React.FC<ChangesItemsProps> = ({
|
|
|
36
34
|
isOnline,
|
|
37
35
|
}) => {
|
|
38
36
|
const { modalPayload, onOpenModal } = useScreenshotChangesModal();
|
|
39
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
40
37
|
|
|
41
38
|
const { sliceFilterFn, defaultVariationSelector } = modalPayload;
|
|
42
39
|
|
|
@@ -71,11 +68,7 @@ export const ChangesItems: React.FC<ChangesItemsProps> = ({
|
|
|
71
68
|
<Box padding={{ bottom: 8 }}>
|
|
72
69
|
<ChangesSectionHeader>
|
|
73
70
|
<Box>
|
|
74
|
-
<Text variant="h5">
|
|
75
|
-
{pluralize(
|
|
76
|
-
capitalizeFirstLetter(sectionsNamingExperiment.value),
|
|
77
|
-
)}
|
|
78
|
-
</Text>
|
|
71
|
+
<Text variant="h5">Slices</Text>
|
|
79
72
|
<Text variant="h5" sx={{ marginLeft: 8 }}>
|
|
80
73
|
{unSyncedSlices.length}
|
|
81
74
|
</Text>
|