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
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Text } from "@prismicio/editor-ui";
|
|
2
2
|
import { FC, ReactNode } from "react";
|
|
3
3
|
|
|
4
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
5
|
-
|
|
6
4
|
import styles from "./ZoneEmptyState.module.css";
|
|
7
5
|
|
|
8
6
|
type ZoneEmptyStateProps = {
|
|
@@ -12,14 +10,11 @@ type ZoneEmptyStateProps = {
|
|
|
12
10
|
};
|
|
13
11
|
|
|
14
12
|
export const ZoneEmptyState: FC<ZoneEmptyStateProps> = (props) => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const { heading = `Your ${modifiedZoneType} has no fields yet`, action } =
|
|
22
|
-
props;
|
|
13
|
+
const {
|
|
14
|
+
zoneType,
|
|
15
|
+
heading = `Your ${zoneType} has no fields yet`,
|
|
16
|
+
action,
|
|
17
|
+
} = props;
|
|
23
18
|
|
|
24
19
|
return (
|
|
25
20
|
<div className={styles.root}>
|
|
@@ -2,6 +2,8 @@ import { BooleanField } from "@prismicio/types-internal/lib/customtypes/widgets/
|
|
|
2
2
|
import { MdOutlineToggleOff } from "react-icons/md";
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
|
|
5
|
+
import { booleanField } from "@/domain/fields";
|
|
6
|
+
|
|
5
7
|
import { createValidationSchema } from "../../../../forms";
|
|
6
8
|
import { DefaultFields } from "../../../../forms/defaults";
|
|
7
9
|
import { CheckBox, Input } from "../../../../forms/fields";
|
|
@@ -68,4 +70,5 @@ export const BooleanWidget: Widget<BooleanField, typeof schema> = {
|
|
|
68
70
|
Meta,
|
|
69
71
|
schema,
|
|
70
72
|
FormFields,
|
|
73
|
+
label: booleanField.name,
|
|
71
74
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Color } from "@prismicio/types-internal/lib/customtypes/widgets/nestable";
|
|
2
2
|
import { MdOutlineColorLens } from "react-icons/md";
|
|
3
3
|
|
|
4
|
+
import { colorField } from "@/domain/fields";
|
|
5
|
+
|
|
4
6
|
import { createDefaultWidgetValues } from "../../../../utils";
|
|
5
7
|
import { Widget } from "../Widget";
|
|
6
8
|
|
|
@@ -31,4 +33,5 @@ export const ColorWidget: Widget<Color, typeof schema> = {
|
|
|
31
33
|
TYPE_NAME,
|
|
32
34
|
schema,
|
|
33
35
|
Meta,
|
|
36
|
+
label: colorField.name,
|
|
34
37
|
};
|
|
@@ -2,6 +2,8 @@ import { Link } from "@prismicio/types-internal/lib/customtypes/widgets/nestable
|
|
|
2
2
|
import { MdSettingsEthernet } from "react-icons/md";
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
|
|
5
|
+
import { contentRelationshipField } from "@/domain/fields";
|
|
6
|
+
|
|
5
7
|
import { linkConfigSchema } from "../Link";
|
|
6
8
|
import { Widget } from "../Widget";
|
|
7
9
|
import Form, { FormFields } from "./Form";
|
|
@@ -102,4 +104,5 @@ export const ContentRelationshipWidget: Widget<Link, typeof schema> = {
|
|
|
102
104
|
),
|
|
103
105
|
};
|
|
104
106
|
},
|
|
107
|
+
label: contentRelationshipField.name,
|
|
105
108
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Date } from "@prismicio/types-internal/lib/customtypes/widgets/nestable";
|
|
2
2
|
import { MdDateRange } from "react-icons/md";
|
|
3
3
|
|
|
4
|
+
import { dateField } from "@/domain/fields";
|
|
5
|
+
|
|
4
6
|
import { createDefaultWidgetValues } from "../../../../utils";
|
|
5
7
|
import { Widget } from "../Widget";
|
|
6
8
|
|
|
@@ -32,4 +34,5 @@ export const DateWidget: Widget<Date, typeof schema> = {
|
|
|
32
34
|
TYPE_NAME: "Date",
|
|
33
35
|
schema,
|
|
34
36
|
Meta,
|
|
37
|
+
label: dateField.name,
|
|
35
38
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Embed } from "@prismicio/types-internal/lib/customtypes/widgets/nestable";
|
|
2
2
|
import { MdCode } from "react-icons/md";
|
|
3
3
|
|
|
4
|
+
import { embedField } from "@/domain/fields";
|
|
5
|
+
|
|
4
6
|
import { createDefaultWidgetValues } from "../../../../utils";
|
|
5
7
|
import { Widget } from "../Widget";
|
|
6
8
|
|
|
@@ -32,4 +34,5 @@ export const EmbedWidget: Widget<Embed, typeof schema> = {
|
|
|
32
34
|
TYPE_NAME: "Embed",
|
|
33
35
|
schema,
|
|
34
36
|
Meta,
|
|
37
|
+
label: embedField.name,
|
|
35
38
|
};
|
|
@@ -2,6 +2,8 @@ import { GeoPoint } from "@prismicio/types-internal/lib/customtypes/widgets/nest
|
|
|
2
2
|
import { MdOutlinePlace } from "react-icons/md";
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
|
|
5
|
+
import { geoPointField } from "@/domain/fields";
|
|
6
|
+
|
|
5
7
|
import { DefaultFields } from "../../../../forms/defaults";
|
|
6
8
|
import { Widget } from "../Widget";
|
|
7
9
|
|
|
@@ -52,4 +54,5 @@ export const GeoPointWidget: Widget<GeoPoint, typeof schema> = {
|
|
|
52
54
|
TYPE_NAME: "GeoPoint",
|
|
53
55
|
schema,
|
|
54
56
|
Meta,
|
|
57
|
+
label: geoPointField.name,
|
|
55
58
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MdOutlineCreateNewFolder } from "react-icons/md";
|
|
2
2
|
import * as yup from "yup";
|
|
3
3
|
|
|
4
|
+
import { groupField } from "@/domain/fields";
|
|
4
5
|
import { TabField } from "@/legacy/lib/models/common/CustomType";
|
|
5
6
|
import {
|
|
6
7
|
type GroupSM,
|
|
@@ -76,5 +77,6 @@ export function createGroupWidget({
|
|
|
76
77
|
TYPE_NAME: "Group",
|
|
77
78
|
CUSTOM_NAME: customName,
|
|
78
79
|
hintItemName,
|
|
80
|
+
label: groupField.name,
|
|
79
81
|
};
|
|
80
82
|
}
|
|
@@ -2,6 +2,8 @@ import { Image } from "@prismicio/types-internal/lib/customtypes/widgets/nestabl
|
|
|
2
2
|
import { MdOutlineImage } from "react-icons/md";
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
|
|
5
|
+
import { imageField } from "@/domain/fields";
|
|
6
|
+
|
|
5
7
|
import { createValidationSchema } from "../../../../forms";
|
|
6
8
|
import { removeProp } from "../../../../utils";
|
|
7
9
|
import { Widget } from "../Widget";
|
|
@@ -55,4 +57,5 @@ export const ImageWidget: Widget<Image, typeof schema> = {
|
|
|
55
57
|
}),
|
|
56
58
|
FormFields,
|
|
57
59
|
TYPE_NAME: "Image",
|
|
60
|
+
label: imageField.name,
|
|
58
61
|
};
|
|
@@ -2,6 +2,8 @@ import { Link } from "@prismicio/types-internal/lib/customtypes";
|
|
|
2
2
|
import { MdLink } from "react-icons/md";
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
|
|
5
|
+
import { linkField } from "@/domain/fields";
|
|
6
|
+
|
|
5
7
|
import { Widget } from "../Widget";
|
|
6
8
|
import Form, { FormFields } from "./Form";
|
|
7
9
|
|
|
@@ -115,4 +117,5 @@ export const LinkWidget: Widget<Link, typeof schema> = {
|
|
|
115
117
|
},
|
|
116
118
|
}),
|
|
117
119
|
TYPE_NAME: "Link",
|
|
120
|
+
label: linkField.name,
|
|
118
121
|
};
|
|
@@ -2,6 +2,7 @@ import { Link } from "@prismicio/types-internal/lib/customtypes/widgets/nestable
|
|
|
2
2
|
import { MdAttachFile } from "react-icons/md";
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
|
|
5
|
+
import { linkToMediaField } from "@/domain/fields";
|
|
5
6
|
import { linkConfigSchema } from "@/legacy/lib/models/common/widgets/Link";
|
|
6
7
|
|
|
7
8
|
import { Widget } from "../Widget";
|
|
@@ -45,4 +46,5 @@ export const LinkToMediaWidget: Widget<Link, typeof schema> = {
|
|
|
45
46
|
}),
|
|
46
47
|
TYPE_NAME: "Link",
|
|
47
48
|
CUSTOM_NAME: "LinkToMedia",
|
|
49
|
+
label: linkToMediaField.name,
|
|
48
50
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Number as PrismicNumber } from "@prismicio/types-internal/lib/customtypes/widgets/nestable";
|
|
2
2
|
import { MdOutlinePin } from "react-icons/md";
|
|
3
3
|
|
|
4
|
+
import { numberField } from "@/domain/fields";
|
|
5
|
+
|
|
4
6
|
import { createDefaultWidgetValues } from "../../../../utils";
|
|
5
7
|
import { Widget } from "../Widget";
|
|
6
8
|
|
|
@@ -32,4 +34,5 @@ export const NumberWidget: Widget<PrismicNumber, typeof schema> = {
|
|
|
32
34
|
TYPE_NAME: "Number",
|
|
33
35
|
schema,
|
|
34
36
|
Meta,
|
|
37
|
+
label: numberField.name,
|
|
35
38
|
};
|
|
@@ -2,6 +2,8 @@ import { Select } from "@prismicio/types-internal/lib/customtypes/widgets/nestab
|
|
|
2
2
|
import { MdOutlineArrowDropDownCircle } from "react-icons/md";
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
|
|
5
|
+
import { selectField } from "@/domain/fields";
|
|
6
|
+
|
|
5
7
|
import { createValidationSchema } from "../../../../forms";
|
|
6
8
|
import { removeProp } from "../../../../utils";
|
|
7
9
|
import { Widget } from "../Widget";
|
|
@@ -45,4 +47,5 @@ export const SelectWidget: Widget<Select, typeof schema> = {
|
|
|
45
47
|
schema,
|
|
46
48
|
Meta,
|
|
47
49
|
TYPE_NAME: "Select",
|
|
50
|
+
label: selectField.name,
|
|
48
51
|
};
|
|
@@ -2,6 +2,8 @@ import { RichText } from "@prismicio/types-internal/lib/customtypes/widgets/nest
|
|
|
2
2
|
import { MdTextFields } from "react-icons/md";
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
|
|
5
|
+
import { richTextField } from "@/domain/fields";
|
|
6
|
+
|
|
5
7
|
import { createValidationSchema } from "../../../../forms";
|
|
6
8
|
import { removeProp } from "../../../../utils";
|
|
7
9
|
import { Widget } from "../Widget";
|
|
@@ -55,4 +57,5 @@ export const StructuredTextWidget: Widget<RichText, typeof schema> = {
|
|
|
55
57
|
schema,
|
|
56
58
|
TYPE_NAME: "StructuredText",
|
|
57
59
|
Form,
|
|
60
|
+
label: richTextField.name,
|
|
58
61
|
};
|
|
@@ -3,6 +3,8 @@ import { Table } from "@prismicio/types-internal/lib/customtypes/widgets/nestabl
|
|
|
3
3
|
import { FaTable } from "react-icons/fa";
|
|
4
4
|
import * as yup from "yup";
|
|
5
5
|
|
|
6
|
+
import { tableField } from "@/domain/fields";
|
|
7
|
+
|
|
6
8
|
import { DefaultFields } from "../../../../forms/defaults";
|
|
7
9
|
import { Widget } from "../Widget";
|
|
8
10
|
|
|
@@ -49,4 +51,5 @@ export const TableWidget: Widget<Table, typeof schema> = {
|
|
|
49
51
|
TYPE_NAME: "Table",
|
|
50
52
|
schema,
|
|
51
53
|
Meta,
|
|
54
|
+
label: tableField.name,
|
|
52
55
|
};
|
|
@@ -2,6 +2,8 @@ import { Text } from "@prismicio/types-internal/lib/customtypes/widgets/nestable
|
|
|
2
2
|
import { MdTitle } from "react-icons/md";
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
|
|
5
|
+
import { textField } from "@/domain/fields";
|
|
6
|
+
|
|
5
7
|
import { createValidationSchema } from "../../../../forms";
|
|
6
8
|
import { DefaultFields } from "../../../../forms/defaults";
|
|
7
9
|
/**
|
|
@@ -45,4 +47,5 @@ export const TextWidget: Widget<Text, typeof schema> = {
|
|
|
45
47
|
TYPE_NAME: "Text",
|
|
46
48
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
47
49
|
FormFields,
|
|
50
|
+
label: textField.name,
|
|
48
51
|
};
|
|
@@ -2,6 +2,8 @@ import { Timestamp } from "@prismicio/types-internal/lib/customtypes/widgets/nes
|
|
|
2
2
|
import { MdSchedule } from "react-icons/md";
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
|
|
5
|
+
import { timestampField } from "@/domain/fields";
|
|
6
|
+
|
|
5
7
|
import { createValidationSchema } from "../../../../forms";
|
|
6
8
|
import { DefaultFields } from "../../../../forms/defaults";
|
|
7
9
|
/** {
|
|
@@ -43,4 +45,5 @@ export const TimestampWidget: Widget<Timestamp, typeof schema> = {
|
|
|
43
45
|
FormFields,
|
|
44
46
|
TYPE_NAME: "Timestamp",
|
|
45
47
|
Meta,
|
|
48
|
+
label: timestampField.name,
|
|
46
49
|
};
|
|
@@ -2,6 +2,8 @@ import { UID } from "@prismicio/types-internal/lib/customtypes/widgets";
|
|
|
2
2
|
import { MdTag } from "react-icons/md";
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
|
|
5
|
+
import { uidField } from "@/domain/fields";
|
|
6
|
+
|
|
5
7
|
import { createValidationSchema } from "../../../../forms";
|
|
6
8
|
import { DefaultFields } from "../../../../forms/defaults";
|
|
7
9
|
/**
|
|
@@ -50,4 +52,5 @@ export const UIDWidget: Widget<UID, typeof schema> = {
|
|
|
50
52
|
schema,
|
|
51
53
|
TYPE_NAME: "UID",
|
|
52
54
|
FormFields,
|
|
55
|
+
label: uidField.name,
|
|
53
56
|
};
|
|
@@ -24,6 +24,7 @@ interface WidgetBase<F extends TabField, S extends AnyObjectSchema> {
|
|
|
24
24
|
customTypes: LocalOnlyCustomType[],
|
|
25
25
|
initialValues: F["config"],
|
|
26
26
|
) => F["config"];
|
|
27
|
+
label: string;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export type Widget<F extends TabField, S extends AnyObjectSchema> = F extends
|
package/src/pages/slices.tsx
CHANGED
|
@@ -14,8 +14,6 @@ import { toast } from "react-toastify";
|
|
|
14
14
|
import { BaseStyles, Flex, Link, Text } from "theme-ui";
|
|
15
15
|
|
|
16
16
|
import { BreadcrumbItem } from "@/components/Breadcrumb";
|
|
17
|
-
import { useAiSliceGenerationExperiment } from "@/features/builder/useAiSliceGenerationExperiment";
|
|
18
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
19
17
|
import { CreateSliceFromImageModal } from "@/features/customTypes/customTypesBuilder/CreateSliceFromImageModal";
|
|
20
18
|
import { getSliceCreationOptions } from "@/features/customTypes/customTypesBuilder/sliceCreationOptions";
|
|
21
19
|
import { SharedSliceCard } from "@/features/slices/sliceCards/SharedSliceCard";
|
|
@@ -44,17 +42,13 @@ import { managerClient } from "@/managerClient";
|
|
|
44
42
|
import { getLibraries, getRemoteSlices } from "@/modules/slices";
|
|
45
43
|
import useSliceMachineActions from "@/modules/useSliceMachineActions";
|
|
46
44
|
import { SliceMachineStoreType } from "@/redux/type";
|
|
47
|
-
import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
|
|
48
45
|
|
|
49
46
|
const SlicesIndex: React.FunctionComponent = () => {
|
|
50
|
-
const aiSliceGenerationExperiment = useAiSliceGenerationExperiment();
|
|
51
47
|
const router = useRouter();
|
|
52
48
|
const { modalPayload, onOpenModal } = useScreenshotChangesModal();
|
|
53
49
|
const { openLoginModal } = useSliceMachineActions();
|
|
54
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
55
50
|
const sliceCreationOptions = getSliceCreationOptions({
|
|
56
51
|
menuType: "Dropdown",
|
|
57
|
-
sectionsNamingExperiment,
|
|
58
52
|
});
|
|
59
53
|
|
|
60
54
|
const { sliceFilterFn, defaultVariationSelector } = modalPayload;
|
|
@@ -113,17 +107,12 @@ const SlicesIndex: React.FunctionComponent = () => {
|
|
|
113
107
|
return (
|
|
114
108
|
<>
|
|
115
109
|
<Head>
|
|
116
|
-
<title>
|
|
117
|
-
{pluralize(capitalizeFirstLetter(sectionsNamingExperiment.value))} -
|
|
118
|
-
Slice Machine
|
|
119
|
-
</title>
|
|
110
|
+
<title>Slices - Slice Machine</title>
|
|
120
111
|
</Head>
|
|
121
112
|
<AppLayout>
|
|
122
113
|
<AppLayoutHeader>
|
|
123
114
|
<AppLayoutBreadcrumb>
|
|
124
|
-
<BreadcrumbItem>
|
|
125
|
-
{pluralize(capitalizeFirstLetter(sectionsNamingExperiment.value))}
|
|
126
|
-
</BreadcrumbItem>
|
|
115
|
+
<BreadcrumbItem>Slices</BreadcrumbItem>
|
|
127
116
|
</AppLayoutBreadcrumb>
|
|
128
117
|
{localLibraries?.length !== 0 && sliceCount !== 0 ? (
|
|
129
118
|
<DropdownMenu>
|
|
@@ -138,17 +127,15 @@ const SlicesIndex: React.FunctionComponent = () => {
|
|
|
138
127
|
</DropdownMenuTrigger>
|
|
139
128
|
|
|
140
129
|
<DropdownMenuContent align="end">
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
</DropdownMenuItem>
|
|
151
|
-
)}
|
|
130
|
+
<DropdownMenuItem
|
|
131
|
+
renderStartIcon={() =>
|
|
132
|
+
sliceCreationOptions.fromImage.BackgroundIcon
|
|
133
|
+
}
|
|
134
|
+
onSelect={() => void openCreateSliceFromImageModal()}
|
|
135
|
+
description={sliceCreationOptions.fromImage.description}
|
|
136
|
+
>
|
|
137
|
+
{sliceCreationOptions.fromImage.title}
|
|
138
|
+
</DropdownMenuItem>
|
|
152
139
|
<DropdownMenuItem
|
|
153
140
|
renderStartIcon={() =>
|
|
154
141
|
sliceCreationOptions.fromScratch.BackgroundIcon
|
|
@@ -180,9 +167,7 @@ const SlicesIndex: React.FunctionComponent = () => {
|
|
|
180
167
|
}}
|
|
181
168
|
>
|
|
182
169
|
<EmptyState
|
|
183
|
-
title=
|
|
184
|
-
sectionsNamingExperiment.value,
|
|
185
|
-
)}?`}
|
|
170
|
+
title="What are slices?"
|
|
186
171
|
onCreateNew={() => {
|
|
187
172
|
setIsCreateSliceModalOpen(true);
|
|
188
173
|
}}
|
|
@@ -190,19 +175,10 @@ const SlicesIndex: React.FunctionComponent = () => {
|
|
|
190
175
|
videoPublicIdUrl={VIDEO_WHAT_ARE_SLICES}
|
|
191
176
|
documentationComponent={
|
|
192
177
|
<>
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
)}{" "}
|
|
198
|
-
are sections of your website. Prismic documents
|
|
199
|
-
contain a dynamic "
|
|
200
|
-
{capitalizeFirstLetter(
|
|
201
|
-
sectionsNamingExperiment.value,
|
|
202
|
-
)}{" "}
|
|
203
|
-
Zone" that allows content creators to add, edit, and
|
|
204
|
-
rearrange {pluralize(sectionsNamingExperiment.value)}{" "}
|
|
205
|
-
to compose dynamic layouts for any page design.{" "}
|
|
178
|
+
Slices are sections of your website. Prismic documents
|
|
179
|
+
contain a dynamic "Slice Zone" that allows content
|
|
180
|
+
creators to add, edit, and rearrange slices to compose
|
|
181
|
+
dynamic layouts for any page design.{" "}
|
|
206
182
|
<Link
|
|
207
183
|
target={"_blank"}
|
|
208
184
|
href={
|
|
@@ -249,11 +225,8 @@ const SlicesIndex: React.FunctionComponent = () => {
|
|
|
249
225
|
}}
|
|
250
226
|
>
|
|
251
227
|
<Text>
|
|
252
|
-
{
|
|
253
|
-
|
|
254
|
-
? `Your ${pluralize(
|
|
255
|
-
sectionsNamingExperiment.value,
|
|
256
|
-
)}`
|
|
228
|
+
{sortedLibraries.length === 1
|
|
229
|
+
? `Your slices`
|
|
257
230
|
: name}
|
|
258
231
|
</Text>
|
|
259
232
|
</Flex>
|
|
@@ -321,7 +294,6 @@ const SlicesIndex: React.FunctionComponent = () => {
|
|
|
321
294
|
void router.push(sliceLocation);
|
|
322
295
|
toast.success(
|
|
323
296
|
SliceToastMessage({
|
|
324
|
-
sectionsNamingExperiment,
|
|
325
297
|
path: `${libraryName}/${newSlice.name}/model.json`,
|
|
326
298
|
}),
|
|
327
299
|
);
|
|
@@ -357,11 +329,7 @@ const SlicesIndex: React.FunctionComponent = () => {
|
|
|
357
329
|
onSuccess={({ library }) => {
|
|
358
330
|
toast.success(
|
|
359
331
|
<ToastMessageWithPath
|
|
360
|
-
message=
|
|
361
|
-
sectionsNamingExperiment.value,
|
|
362
|
-
)}(s) added to ${
|
|
363
|
-
sectionsNamingExperiment.value
|
|
364
|
-
} zone and created at: `}
|
|
332
|
+
message="Slice(s) added to slice zone and created at: "
|
|
365
333
|
path={library}
|
|
366
334
|
/>,
|
|
367
335
|
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[248],{72641:function(e,t,n){"use strict";n.d(t,{R$:function(){return i},Qj:function(){return x},T9:function(){return d},nf:function(){return h},u2:function(){return o},_T:function(){return u}});var l=n(52322),r=n(56803),a=n(6277),s=n(83478),c=n.n(s);let i=e=>{let{backgroundImage:t,style:n,...r}=e,s=void 0!==t;return(0,l.jsx)("article",{...r,className:(0,a.W)(c().root,{[c().withBackground]:s}),style:{backgroundImage:s?"url(".concat(t,")"):void 0,...n}})},o=e=>(0,l.jsx)("div",{...e,className:c().image}),d=e=>(0,l.jsx)("div",{...e,className:c().content}),u=e=>(0,l.jsx)(r.bL,{...e,variant:"h3"}),h=e=>(0,l.jsx)(r.bL,{...e,color:"grey11"}),x=e=>(0,l.jsx)("div",{...e,className:c().actions,color:"grey"})},38241:function(e,t,n){"use strict";n.d(t,{F:function(){return O}});var l=n(52322),r=n(56803),a=n(97729),s=n.n(a),c=n(2784),i=n(43388),o=n(17378),d=n(98564),u=n(51384),h=n(5632),x=n(56580),m=n(75289),p=n(77630),j=n(88932),g=n(94160),b=n(39204);async function f(e){let{id:t,label:n,repeatable:l,format:r,onSuccess:a}=e,s=d.$[r],c=(0,p.Ue)({id:t,label:n,repeatable:l,format:r});try{let{errors:e}=await (0,g.KA)({customType:c});if(e.length>0)throw e;g.Xe.track({event:"custom-type:created",id:c.id,name:n,format:r,type:l?"repeatable":"single",origin:"table"}),await a(c),j.Am.success((0,b.GX)({message:"".concat(s.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(c.id,"/index.json")}))}catch(t){let e="Internal Error: ".concat(s.name({start:!0,plural:!1})," not saved");console.error(e,t),j.Am.error(e)}}var v=n(59294),_=n(98250),S=n(68968),y=n(59532),C=n(7974),k=n(358),w=n(78254),L=n(54597),I=n(46999),R=n(63397);let B=e=>{let{selected:t,...n}=e;return(0,l.jsx)(m.kC,{sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:t?e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}:"none","&:hover":{boxShadow:e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}}},...n})},N=e=>{let{format:t}=e,[n,,r]=(0,R.U$)("repeatable"),a=d.$[t];return(0,l.jsxs)(m.xu,{mb:2,children:[(0,l.jsxs)(B,{selected:n.value,onClick:()=>r.setValue(!0),children:[(0,l.jsx)(m.Y8,{checked:n.value,onChange:()=>{},"data-testid":"repeatable-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Reusable type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintRepeatable})]})]}),(0,l.jsxs)(B,{selected:!n.value,onClick:()=>r.setValue(!1),children:[(0,l.jsx)(m.Y8,{checked:!n.value,onChange:()=>{},"data-testid":"single-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Single type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintSingle})]})]})]})},z=e=>{let{format:t,isCreating:n,isOpen:r,origin:a="table",onCreateChange:s,onOpenChange:i}=e,{createCustomTypeSuccess:o}=(0,L.Z)(),{completeStep:u}=(0,_.k)(),{customTypeIds:j,customTypeLabels:g}=(0,x.v9)(e=>({customTypeIds:(0,w.W6)(e),customTypeLabels:(0,w.YS)(e)})),b=d.$[t],[R,B]=(0,c.useState)(!0),{syncChanges:z}=(0,S.g)(),E=(0,h.useRouter)(),T=async e=>{let{id:n,label:l,repeatable:r}=e;s(!0),await f({format:t,id:n,label:l,origin:a,repeatable:r,onSuccess:async e=>{o(e);let t=(0,p.y6)(e),l=v.cd[t];B(!0),await E.push({pathname:l.getBuilderPagePathname(n)}),z(),"page"===t&&u("createPageType")}}),s(!1),i(!1)},G=(e,t,n)=>{n(R?{...t,label:e.target.value,id:(0,k.lV)(e.target.value)}:{...t,label:e.target.value})},D=(e,t)=>{t("id",e.target.value),B(!1)};return(0,l.jsx)(y.Z,{testId:"create-ct-modal",isOpen:r,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:()=>{i(!1),B(!0)},onSubmit:e=>{T(e)},isLoading:n,initialValues:{repeatable:!0,id:"",label:""},validate:e=>{let{id:t,label:n}=e,l={};return n&&n.length||(l.label="Cannot be empty."),!l.label&&g.includes(n)&&(l.label="".concat(b.name({start:!0,plural:!1})," name is already taken.")),["update","insert"].includes(n.toLowerCase())&&(l.label='Name "'.concat(n,'" is reserved for Slice Machine use.')),t&&t.length||(l.id="ID cannot be empty."),["update","insert"].includes(t.toLowerCase())&&(l.id='Id "'.concat(t,'" is reserved for Slice Machine use.')),l.id||!t||C.xo.exec(t)||(l.id="Invalid id: No special characters allowed."),!l.id&&t&&j.map(e=>e.toLowerCase()).includes(t)&&(l.id='ID "'.concat(t,'" exists already.')),Object.keys(l).length>0?l:void 0},content:{title:"Create a new ".concat(b.name({start:!1,plural:!1}))},children:e=>{let{errors:n,setValues:r,setFieldValue:a,values:s,touched:c}=e;return(0,l.jsxs)(m.xu,{children:[(0,l.jsx)(N,{format:t}),(0,l.jsx)(I.W,{name:"label",label:"".concat(b.name({start:!0,plural:!1})," Name"),testId:"ct-name-input",placeholder:"A display name for the ".concat(b.name({start:!1,plural:!1})),error:c.label?n.label:void 0,onChange:e=>G(e,s,r)}),(0,l.jsx)(I.W,{name:"id",testId:"ct-id-input",label:"".concat(b.name({start:!0,plural:!1})," ID"),placeholder:b.inputPlaceholder,error:c.id?n.id:void 0,onChange:e=>D(e,a)})]})}})};var E=n(72641);let T=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf"}),(0,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc"}),(0,l.jsx)("path",{d:"m10.0912 8c-2.8118 0-5.0912 2.2794-5.0912 5.0912s2.2794 5.0912 5.0912 5.0912c1.8851 0 3.5303-1.0247 4.4098-2.5452.1553-.2684.2868-.5523.3916-.8489.092-.2604-.0444-.5461-.3048-.6381-.2603-.092-.546.0445-.638.3048-.0841.238-.1897.4659-.3144.6815-.7081 1.2241-2.0305 2.0459-3.5442 2.0459-2.2595 0-4.0912-1.8317-4.0912-4.0912s1.8317-4.0912 4.0912-4.0912c1.3566 0 2.5595.66 3.3043 1.6782h-1.7739c-.2761 0-.5.2239-.5.5 0 .2762.2239.5.5.5h2.6782c.2762 0 .5-.2238.5-.5v-2.6782c0-.2761-.2238-.5-.5-.5-.2761 0-.5.2239-.5.5v1.1032c-.9281-.9865-2.2462-1.6032-3.7086-1.6032z",fill:"#fff"})]}),G=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf",fillRule:"nonzero"}),(0,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc",fillRule:"nonzero"}),(0,l.jsx)("path",{d:"m8.0869 10.6818.5758-2.3031c.0556-.2226.2556-.3787.485-.3787.3253 0 .564.3057.4851.6213l-.5151 2.0605h2.6055l.5758-2.3031c.0557-.2226.2557-.3787.4851-.3787.3253 0 .564.3057.4851.6213l-.5152 2.0605h2.246c.2761 0 .5.2239.5.5 0 .2762-.2239.5-.5.5h-2.496l-.6591 2.6364h2.1551c.2761 0 .5.2238.5.5 0 .2761-.2239.5-.5.5h-2.4051l-.5757 2.3031c-.0557.2226-.2557.3787-.4851.3787-.3253 0-.564-.3057-.4851-.6213l.5152-2.0605h-2.6056l-.5758 2.3031c-.0556.2226-.2556.3787-.4851.3787-.3253 0-.5639-.3057-.485-.6213l.5151-2.0605h-1.9278c-.2761 0-.5-.2239-.5-.5 0-.2762.2239-.5.5-.5h2.1778l.6591-2.6364h-1.8369c-.2761 0-.5-.2238-.5-.5 0-.2761.2239-.5.5-.5zm2.7273 3.6364.659-2.6364h-2.6055l-.6591 2.6364z",fill:"#fff"})]});var D=n(60867),P=n(50477),W=n(94840),A=n(16442);let $=e=>{let{format:t,isCreatingCustomType:n,openCreateCustomTypeModal:a}=e,s=(0,h.useRouter)(),{customTypes:i,updateCustomTypes:o}=(0,P.xU)(t),u=i.sort((e,t)=>e.id.localeCompare(t.id)),m=v.cd[t],p=d.$[t];return(!function(e,t,n){let{storeCustomTypes:l}=(0,x.v9)(e=>({storeCustomTypes:(0,w.Ch)(e).filter(A.TG)}));(0,c.useEffect)(()=>{let r=l.filter(e=>{let{local:n}=e;return n.format===t});(r.length!==e.length||r.some(t=>{let n=e.find(e=>e.id===t.local.id);return!n||JSON.stringify(W.Dc.fromSM(t.local))!==JSON.stringify(n)}))&&n(r.map(e=>{let{local:t}=e;return W.Dc.fromSM(t)}))},[t,n,e,l])}(i,t,o),0===u.length)?(0,l.jsxs)(E.R$,{"data-testid":"blank-slate",style:{alignSelf:"center",marginTop:r.t.space[72]},children:[(0,l.jsx)(E.u2,{children:(0,l.jsx)(r.a_,{src:m.blankSlateImage,sizing:"cover"})}),(0,l.jsxs)(E.T9,{children:[(0,l.jsx)(E._T,{children:p.name({start:!0,plural:!0})}),(0,l.jsx)(E.nf,{children:p.blankSlateDescription}),(0,l.jsx)(E.Qj,{children:(0,l.jsx)(r.E,{onClick:a,loading:n,children:"Create"})})]})]}):(0,l.jsx)("div",{children:(0,l.jsxs)(r.bE,{columnLayout:"28px 1fr 1fr 1fr 42px",children:[(0,l.jsx)(r.bH,{children:(0,l.jsxs)(r.bI,{children:[(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.aX,{name:"notes",size:"medium"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Label"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"API ID"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Limit"})}),(0,l.jsx)(r.bG,{})]})}),(0,l.jsx)(r.bF,{children:u.map(e=>{let{repeatable:n,label:a,id:c}=e;return(0,l.jsxs)(r.bI,{onClick:()=>{s.push(v.cd[t].getBuilderPagePathname(c))},children:[(0,l.jsx)(r.bG,{children:n?(0,l.jsx)(T,{width:r.t.space[20]}):(0,l.jsx)(G,{width:r.t.space[20]})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{variant:"bold",noWrap:!0,children:a})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:c})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:n?"Reusable":"Single"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(D._,{isChangesLocal:!1,format:t,customType:e})})]},c)})})]})})},O=e=>{let{format:t}=e,n=d.$[t],[a,h]=(0,c.useState)(!1),[x,m]=(0,c.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s(),{children:(0,l.jsxs)("title",{children:[n.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,l.jsx)(o.S,{renderError:()=>(0,l.jsx)(u.LN,{children:(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.D,{alignItems:"center",justifyContent:"center",children:(0,l.jsx)(r.ax,{title:"Request failed",description:"An error occurred while fetching your ".concat(n.name({start:!1,plural:!0}),".")})})})}),children:(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.bg,{})})]}),children:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{"data-testid":"create-ct",loading:a,onClick:()=>{m(!0)},startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsxs)(r.D,{flexDirection:"column",children:[(0,l.jsx)($,{format:t,isCreatingCustomType:a,openCreateCustomTypeModal:()=>{m(!0)}}),(0,l.jsx)(z,{format:t,isCreating:a,isOpen:x,onCreateChange:h,onOpenChange:m})]})})]})})})]})}},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return o},W:function(){return i}});var l=n(52322),r=n(2784),a=n(75289);let s=e=>{let{bg:t,background:n,sx:r,withRadius:s,radius:c,children:i}=e;return(0,l.jsx)(a.xu,{sx:{p:4,bg:t||n,...s?{borderBottomLeftRadius:c,borderBottomRightRadius:c}:null,...r},children:i})},c=(0,r.createContext)("6px"),i=()=>(0,r.useContext)(c),o=e=>{let{Header:t=null,SubHeader:n=null,Body:r=null,Footer:i=null,borderFooter:o=!1,radius:d="6px",bodySx:u={},footerSx:h={},sx:x=null,bg:m,background:p,children:j,...g}=e;return(0,l.jsx)(c.Provider,{value:d,children:(0,l.jsxs)(a.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:d,...x},...g,children:[t||null,n||null,(0,l.jsxs)(s,{bg:m,background:p,sx:u,withRadius:!i,children:[r?(0,l.jsx)(r,{}):null,j||null]}),i?(0,l.jsx)(s,{bg:m,background:p,sx:{...o?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...h},radius:d,withRadius:!0,children:"object"==typeof i?i:(0,l.jsx)(i,{})}):null]})})}},7974:function(e,t,n){"use strict";n.d(t,{Sn:function(){return c},lS:function(){return l},nG:function(){return r},pq:function(){return i},rd:function(){return s},xo:function(){return a}});let l=["components","update","insert"],r=["png","jpg","jpeg"],a=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,s="placeholders/What_are_Slices_mrvome",c="SM_HELP_VIDEOS/mock_data",i="slice-machine-simulator"},83478:function(e){e.exports={column:"BlankSlate_column__genEe",root:"BlankSlate_root__CmSqW BlankSlate_column__genEe",fadeIn:"BlankSlate_fadeIn__mAfi5",withBackground:"BlankSlate_withBackground__mLYij",image:"BlankSlate_image__Jn90S BlankSlate_column__genEe",content:"BlankSlate_content__0Yt2d BlankSlate_column__genEe",desc:"BlankSlate_desc___Dl7e",actions:"BlankSlate_actions__OYRj4"}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[268],{22654:function(e,t,a){a.d(t,{l:function(){return n}});var r=a(96317);function n(){let e=(0,r.L)("slicemachine-image-to-slice");return{eligible:(null==e?void 0:e.value)==="on"}}},91589:function(e,t,a){a.d(t,{S:function(){return x}});var r=a(52322),n=a(56803),i=a(2784),l=a(88932),s=a(94160),c=a(34166),o=a(63470),u=a(98250),d=a(68968),m=a(80148),g=a(54597),p=a(31860),h=a(62434);function f(e){let{slice:t}=e,a="uploading"===t.status||"generating"===t.status,i="uploadError"===t.status||"generateError"===t.status,l="generateError"===t.status||"generating"===t.status||"success"===t.status;return(0,r.jsxs)(h.Zb,{disabled:a,children:[l?(0,r.jsx)(h.ZB,{src:t.thumbnailUrl}):(0,r.jsx)(h.ZB,{component:"div"}),(0,r.jsx)(h.eW,{loading:a,startIcon:function(e){switch(e){case"uploadError":case"generateError":return"close";case"success":return"check";default:return}}(t.status),title:"success"===t.status?t.model.name:t.image.name,subtitle:function(e){switch(e){case"uploading":return"Uploading...";case"uploadError":return"Unable to upload image";case"generating":return"Generating...";case"generateError":return"Something went wrong";case"success":return"Generated"}}(t.status),error:i,action:i?(0,r.jsx)(n.E,{startIcon:"refresh",color:"grey",onClick:t.onRetry,children:"Retry"}):void 0})]})}function x(e){let{open:t,location:a,onSuccess:h,onClose:x}=e,[S,b]=(0,i.useState)([]),[C,I]=(0,i.useState)(!1),{syncChanges:k}=(0,d.g)(),{createSliceSuccess:A}=(0,g.Z)(),{completeStep:E}=(0,u.k)(),U=(0,o.k)(),L=(0,i.useRef)(crypto.randomUUID()),N=e=>{let{index:t,slice:a}=e;b(e=>e.map((e,r)=>r===t?a(e):e))},D=e=>{if(e.length>10){l.Am.error("You can only upload ".concat(10," images at a time."));return}b(e.map(e=>({status:"uploading",image:e}))),e.forEach((e,t)=>B({index:t,image:e}))},B=e=>{let{index:t,image:a}=e,r=L.current;N({index:t,slice:e=>({...e,status:"uploading"})}),j({image:a}).then(e=>{r===L.current&&F({index:t,imageUrl:e})},()=>{r===L.current&&N({index:t,slice:e=>({...e,status:"uploadError",onRetry:()=>B({index:t,image:a})})})})},_=function(e){let{open:t}=e,a=(0,i.useRef)([]);return(0,i.useEffect)(()=>{t&&(a.current=[],m.managerClient.slices.readAllSlices().then(e=>{a.current=e.models.map(e=>{let{model:t}=e;return t})}).catch(()=>null))},[t]),a}({open:t}),F=e=>{let{index:t,imageUrl:a}=e,r=L.current;N({index:t,slice:e=>({...e,status:"generating",thumbnailUrl:a})}),m.managerClient.customTypes.inferSlice({imageUrl:a}).then(e=>{let{slice:n,langSmithUrl:i}=e;r===L.current&&b(e=>e.map((r,l)=>l===t?{...r,status:"success",thumbnailUrl:a,model:function(e){let{existingSlices:t,newSlices:a,slice:r}=e,n=new Set,i=new Set;for(let{id:e,name:a}of t)n.add(e),i.add(a.toLowerCase());for(let e of a)"success"===e.status&&(n.add(e.model.id),i.add(e.model.name.toLowerCase()));let l=r.id,s=2;for(;n.has(l);)l="".concat(r.id,"_").concat(s),s++;let c=r.name;for(s=2;i.has(c.toLowerCase());)c="".concat(r.name).concat(s),s++;return{...r,id:l,name:c}}({existingSlices:_.current,newSlices:e,slice:n}),langSmithUrl:i}:r))},()=>{r===L.current&&N({index:t,slice:e=>({...e,status:"generateError",thumbnailUrl:a,onRetry:()=>F({index:t,imageUrl:a})})})})},z=S.some(e=>"uploading"===e.status||"generating"===e.status),R=S.filter(e=>"success"===e.status),Z=R.length>0;return(0,r.jsxs)(n.ae,{open:t,onOpenChange:e=>{e||C||(x(),L.current=crypto.randomUUID(),b([]))},children:[(0,r.jsx)(n.al,{title:"Generate from image"}),(0,r.jsxs)(n.aj,{gap:0,children:[(0,r.jsxs)(n.ak,{hidden:!0,children:["Upload images to generate ",(0,p._)(U.value)," ","with AI"]}),0===S.length?(0,r.jsx)(n.D,{padding:16,height:"100%",children:(0,r.jsx)(n.aF,{onFilesSelected:D,assetType:"image",maxFiles:10,overlay:(0,r.jsx)(y,{onFilesSelected:D,droppingFiles:!0}),children:(0,r.jsx)(y,{onFilesSelected:D})})}):(0,r.jsx)(n.bn,{stableScrollbar:!1,children:(0,r.jsx)(n.D,{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:16,children:S.map((e,t)=>(0,r.jsx)(f,{slice:e},"slice-".concat(t)))})}),(0,r.jsxs)(n.ah,{children:[(0,r.jsx)(n.ai,{disabled:C}),(0,r.jsxs)(n.af,{disabled:!Z||z,loading:C,onClick:()=>{let e=S.reduce((e,t)=>("success"===t.status&&e.push(t),e),[]);if(!e.length)return;let t=L.current;I(!0),v(e).then(async e=>{let{slices:r,library:n}=e;if(t===L.current)for(let{model:e,langSmithUrl:t}of(A((await (0,s.y0)()).libraries),k(),h({slices:r,library:n}),I(!1),L.current=crypto.randomUUID(),b([]),E("createSlice"),r))s.Xe.track({event:"slice:created",id:e.id,name:e.name,library:n,location:a,mode:"ai",langSmithUrl:t}),(0,c.nZ)({type:"model",library:n,sliceId:e.id,variationId:e.variations[0].id,langSmithUrl:t})}).catch(()=>{t===L.current&&(I(!1),l.Am.error("An unexpected error happened while adding slices."))})},children:[w({location:a,sectionsNamingExperiment:U})," (",R.length,")"]})]})]})]})}function y(e){let t=(0,o.k)(),{droppingFiles:a=!1,onFilesSelected:i}=e;return(0,r.jsx)(n.D,{justifyContent:"center",flexDirection:"column",height:"100%",backgroundColor:a?"purple2":"grey2",border:!0,borderStyle:"dashed",borderColor:a?"purple9":"grey6",children:(0,r.jsxs)(n.s,{children:[(0,r.jsx)(n.x,{lineColor:"purple11",backgroundColor:"purple5",name:"cloudUpload",size:"large"}),(0,r.jsx)(n.z,{children:"Upload your design images."}),(0,r.jsxs)(n.w,{children:["Once uploaded, you can generate"," ",(0,p._)(t.value)," automatically using AI."]}),(0,r.jsx)(n.v,{children:(0,r.jsx)(n.aG,{startIcon:"attachFile",onFilesSelected:i,color:"grey",children:"Add images"})})]})})}async function j(e){let{image:t}=e,a=[await m.managerClient.project.getResolvedRepositoryName(),"shared-slices","prismic-inferred-slices",crypto.randomUUID()].join("/");await m.managerClient.screenshots.initS3ACL();let{url:r}=await m.managerClient.screenshots.uploadScreenshot({keyPrefix:a,data:t});return r}async function v(e){let{libraries:t=[]}=await m.managerClient.project.getSliceMachineConfig(),a=t[0];if(!a)throw Error("No library found in the config.");for(let{model:t}of e){let{errors:e}=await m.managerClient.slices.createSlice({libraryID:a,model:t});if(e.length)throw Error("Failed to create slice ".concat(t.id,"."))}let r=await Promise.all(e.map(async e=>{let{model:t,image:r,langSmithUrl:n}=e;return await m.managerClient.slices.updateSliceScreenshot({libraryID:a,sliceID:t.id,variationID:t.variations[0].id,data:r}),{model:t,langSmithUrl:n}}));return{library:a,slices:r}}let w=e=>{let{location:t,sectionsNamingExperiment:a}=e;switch(t){case"custom_type":return"Add to type";case"page_type":return"Add to page";case"slices":return"Add to ".concat((0,p._)(a.value))}}},27213:function(e,t,a){a.d(t,{F:function(){return l}});var r=a(52322),n=a(56803),i=a(31860);let l=e=>{let{menuType:t,sectionsNamingExperiment:a}=e;return{fromImage:{BackgroundIcon:(0,r.jsx)(n.B,{name:"autoFixHigh",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"purple",variant:"solid",radius:6}),title:"Generate from image",description:"Build a ".concat(a.value," based on your design image.")},fromScratch:{BackgroundIcon:(0,r.jsx)(n.B,{name:"add",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Start from scratch",description:"Build a custom ".concat(a.value," your way.")},fromTemplate:{BackgroundIcon:(0,r.jsx)(n.B,{name:"contentCopy",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Use a template",description:"Choose from ready-made examples."},fromExisting:{BackgroundIcon:(0,r.jsx)(n.B,{name:"folder",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Reuse an existing ".concat(a.value),description:"Select from your created ".concat((0,i._)(a.value))}}}},6256:function(e,t,a){a.d(t,{c:function(){return w}});var r=a(52322),n=a(2784),i=a(36131),l=a(75289),s=a(94160),c=a(63470),o=a(98250),u=a(88932),d=a(63908),m=a(358),g=a(80148);async function p(e){let{sliceName:t,libraryName:a,location:r,onSuccess:n}=e;try{let e=(0,d.fo)(t),{errors:i}=await g.managerClient.slices.createSlice({libraryID:a,model:e});if(i.length>0)throw i;s.Xe.track({event:"slice:created",id:(0,m.MP)(t),name:t,library:a,location:r,mode:"manual"}),await n(e)}catch(a){let e="An unexpected error happened while creating slice ".concat(t,".");console.error(e,a),u.Am.error(e)}}var h=a(68968),f=a(59532),x=a(54597),y=a(31860),j=a(46999),v=a(63019);let w=e=>{let{onClose:t,onSuccess:a,localLibraries:u,location:d,remoteSlices:m}=e,{createSliceSuccess:g}=(0,x.Z)(),[w,S]=(0,n.useState)(!1),{syncChanges:b}=(0,h.g)(),{completeStep:C}=(0,o.k)(),I=(0,c.k)(),k=async e=>{let t=e.sliceName,r=e.from;S(!0),await p({sliceName:t,libraryName:r,location:d,onSuccess:async e=>{g((await (0,s.y0)()).libraries),a(e,r),b(),C("createSlice")}})};return(0,r.jsx)(f.Z,{testId:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:w,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:e=>{k(e)},initialValues:{sliceName:"",from:u[0].name},validate:e=>(0,v.h)(e,u,m),content:{title:"Create a new ".concat(I.value)},children:e=>{let{touched:t,values:a,setFieldValue:n,errors:s}=e;return(0,r.jsxs)(l.xu,{children:[(0,r.jsx)(j.W,{name:"sliceName",label:"".concat((0,y.f)(I.value)," name"),placeholder:"Pascalised ".concat(I.value," API ID (e.g. TextBlock)"),error:t.sliceName?s.sliceName:void 0,testId:"slice-name-input"}),(0,r.jsx)(l.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,r.jsx)(i.ZP,{name:"from",options:u.map(e=>({value:e.name,label:e.name})),onChange:e=>e?void n("from",e.value):null,defaultValue:{value:a.from,label:a.from},styles:{option:e=>({...e,color:"#161618"})},theme:e=>({...e,colors:{...e.colors,primary:"#E9E8EA"}}),menuPortalTarget:document.body})]})}})}},63019:function(e,t,a){a.d(t,{h:function(){return c}});var r=a(96009),n=a.n(r),i=a(74600),l=a.n(i),s=a(7974);function c(e,t,a){let{sliceName:r}=e;return r?s.lS.includes(r.toLowerCase())?{sliceName:'Name "'.concat(r,'" is reserved for Slice Machine use.')}:s.xo.exec(r)?l()(n()(r)).replace(/\s/gm,"")!==r.trim()?{sliceName:"Value has to be PascalCased."}:r.match(/^\d/)?{sliceName:"Value cannot start with a number."}:[...t.flatMap(e=>e.components.map(e=>e.model.name)),...a.map(e=>e.name)].includes(r)?{sliceName:"Slice name is already taken."}:void 0:{sliceName:"No special characters allowed."}:{sliceName:"Cannot be empty"}}},21151:function(e,t,a){var r=a(52322),n=a(75289);t.Z=function(e){let{elems:t,renderElem:a,defineElementKey:i,gridTemplateMinPx:l="320px",gridGap:s="16px",sx:c}=e;return(0,r.jsx)(n.xu,{as:"section",sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(l,", 1fr))"),gridGap:s,pt:2,...c},children:t.map((e,t)=>e?(0,r.jsx)("span",{children:a(e,t)},"".concat(i(e),"-").concat(t+1)):null)})}}}]);
|