slice-machine-ui 1.23.2-beta.1 → 1.23.2-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.
Files changed (122) hide show
  1. package/.depcheckrc +3 -0
  2. package/components/DeleteSliceModal/index.tsx +34 -24
  3. package/components/DeleteVariationModal/index.tsx +1 -0
  4. package/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx +61 -38
  5. package/components/Forms/RenameCustomTypeModal/RenameCustomTypeModal.tsx +2 -2
  6. package/components/Forms/RenameSliceModal/RenameSliceModal.tsx +33 -21
  7. package/components/Forms/RenameVariationModal/RenameVariationModal.tsx +0 -1
  8. package/components/ModalFormCard/index.tsx +0 -1
  9. package/components/Navigation/ChangesListItem.tsx +14 -32
  10. package/components/Navigation/index.tsx +29 -12
  11. package/components/ReviewModal/ReviewForm.tsx +0 -1
  12. package/lib/builders/common/EditModal/Form.jsx +0 -1
  13. package/lib/builders/common/Zone/Card/components/NewField.tsx +0 -1
  14. package/lib/models/common/widgets/StructuredText/index.ts +1 -1
  15. package/out/404.html +1 -1
  16. package/out/_next/static/Dz7wwTNVdXvoAjySXz7mE/_buildManifest.js +1 -0
  17. package/out/_next/static/chunks/18539003-5f78714a35fde4a1.js +97 -0
  18. package/out/_next/static/chunks/25-01f422cea8066349.js +1 -0
  19. package/out/_next/static/chunks/318-99b5914b60bf1d17.js +1 -0
  20. package/out/_next/static/chunks/727-f8fefdd3e50cab2a.js +1 -0
  21. package/out/_next/static/chunks/777-8c5507e3b119b5dc.js +8 -0
  22. package/out/_next/static/chunks/799-b616401fe0dafdeb.js +1 -0
  23. package/out/_next/static/chunks/904-4653b7a849f4db94.js +1 -0
  24. package/out/_next/static/chunks/pages/_app-5ec41fc53c1f6405.js +434 -0
  25. package/out/_next/static/chunks/pages/{changelog-afd18276fe018b24.js → changelog-02cd80dad6f40878.js} +1 -1
  26. package/out/_next/static/chunks/pages/changes-8e9da8fbb809aad3.js +1 -0
  27. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-3f862ad6111a1fc0.js → [customTypeId]-97ab3b90b85d645d.js} +1 -1
  28. package/out/_next/static/chunks/pages/{custom-types-94b8f8dbf7727412.js → custom-types-3c8e721ec6802127.js} +1 -1
  29. package/out/_next/static/chunks/pages/index-cf93d16e9c63b6db.js +1 -0
  30. package/out/_next/static/chunks/pages/{labs-ee206005948f8e87.js → labs-39b50541a4c370bf.js} +1 -1
  31. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-d1ffca11c42f2603.js → [pageTypeId]-84a22c5e480d3fa9.js} +1 -1
  32. package/out/_next/static/chunks/pages/settings-879686e3a8759dc3.js +1 -0
  33. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-897ca93c114a1435.js → simulator-c498e9c80cae8cce.js} +1 -1
  34. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-9b893c62b2f2fe4a.js +1 -0
  35. package/out/_next/static/chunks/pages/slices-4522d604117d8c66.js +1 -0
  36. package/out/_next/static/css/3c26dbbbd8f4be12.css +1 -0
  37. package/out/_next/static/css/{37153180c3b0dd66.css → 838fd8bb5a7c32b0.css} +1 -1
  38. package/out/_next/static/css/ca32882a5d2d8d88.css +1 -0
  39. package/out/changelog.html +1 -1
  40. package/out/changes.html +1 -1
  41. package/out/custom-types/[customTypeId].html +1 -1
  42. package/out/custom-types.html +1 -1
  43. package/out/index.html +1 -1
  44. package/out/labs.html +1 -1
  45. package/out/page-types/[pageTypeId].html +1 -1
  46. package/out/settings.html +1 -0
  47. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  48. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  49. package/out/slices.html +1 -1
  50. package/package.json +9 -6
  51. package/pages/settings.tsx +1 -0
  52. package/pages/slices.tsx +20 -8
  53. package/postcss.config.js +10 -0
  54. package/src/apiClient.ts +1 -22
  55. package/src/components/FieldSet/FieldSet.stories.tsx +20 -11
  56. package/src/components/RelativeTime/RelativeTime.stories.tsx +25 -0
  57. package/src/components/RelativeTime/RelativeTime.tsx +40 -0
  58. package/src/components/RelativeTime/index.ts +1 -0
  59. package/src/domain/__tests__/customType.test.ts +205 -19
  60. package/src/domain/customType.ts +132 -7
  61. package/src/domain/slice.ts +38 -0
  62. package/src/features/customTypes/PageTypeOnboarding.tsx +21 -26
  63. package/src/features/customTypes/actions/convertCustomToPageType.ts +14 -10
  64. package/src/features/customTypes/actions/createCustomType.ts +69 -0
  65. package/src/features/customTypes/actions/deleteCustomType.ts +13 -3
  66. package/src/features/customTypes/actions/renameCustomType.ts +10 -4
  67. package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +3 -1
  68. package/src/features/customTypes/customTypesTable/CustomTypesTable.tsx +8 -8
  69. package/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +18 -17
  70. package/src/features/environments/actions/setEnvironment.ts +2 -2
  71. package/src/features/settings/SettingsPage.tsx +47 -0
  72. package/src/features/settings/git/ConnectGitRepository.tsx +126 -0
  73. package/src/features/settings/git/ConnectGitRepositoryBlankSlate.tsx +33 -0
  74. package/src/features/settings/git/GitOwnerSelect.tsx +71 -0
  75. package/src/features/settings/git/GitProvider.ts +40 -0
  76. package/src/features/settings/git/GitProviderConnectButtons.tsx +63 -0
  77. package/src/features/settings/git/GitRepositoriesList.tsx +76 -0
  78. package/src/features/settings/git/GitRepositoriesSearch.tsx +69 -0
  79. package/src/features/settings/git/GitRepositoryConnectDialog.tsx +85 -0
  80. package/src/features/settings/git/GitRepositoryDisconnectDialog.tsx +60 -0
  81. package/src/features/settings/git/useGitIntegrationExperiment.ts +8 -0
  82. package/src/features/settings/git/useGitOwners.ts +12 -0
  83. package/src/features/settings/git/useGitRepos.ts +24 -0
  84. package/src/features/settings/git/useLinkedGitRepos.ts +41 -0
  85. package/src/features/settings/git/useWriteAPIToken.ts +23 -0
  86. package/src/features/slices/actions/createSlice.ts +5 -29
  87. package/src/features/slices/actions/deleteSlice.ts +33 -0
  88. package/src/features/slices/actions/renameSlice.ts +37 -0
  89. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +0 -1
  90. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +0 -1
  91. package/src/features/slices/convertLegacySlice/ConvertLegacySliceMergeWithIdenticalDialog.tsx +0 -1
  92. package/src/hooks/useUser.ts +14 -0
  93. package/src/icons/SettingsIcon.tsx +19 -0
  94. package/src/modules/availableCustomTypes/index.ts +29 -135
  95. package/src/modules/loading/types.ts +0 -5
  96. package/src/modules/modal/types.ts +0 -3
  97. package/src/modules/slices/index.ts +27 -193
  98. package/src/modules/slices/selector.ts +0 -14
  99. package/src/modules/useSliceMachineActions.ts +70 -89
  100. package/src/modules/userContext/index.ts +3 -3
  101. package/src/redux/saga.ts +0 -4
  102. package/test/src/modules/__fixtures__/serverState.ts +1 -2
  103. package/test/src/modules/availableCustomTypes/index.test.ts +2 -243
  104. package/test/src/modules/slices.test.ts +1 -267
  105. package/out/_next/static/chunks/18539003-5cc559566b738915.js +0 -97
  106. package/out/_next/static/chunks/25-37d6fa7f064be04b.js +0 -1
  107. package/out/_next/static/chunks/318-ce7e74f18f2d5b22.js +0 -1
  108. package/out/_next/static/chunks/376-7e784d6069e01654.js +0 -8
  109. package/out/_next/static/chunks/727-3a3bc32518778317.js +0 -1
  110. package/out/_next/static/chunks/731-501990ebe6a71b32.js +0 -1
  111. package/out/_next/static/chunks/904-9a4c1264727ae89a.js +0 -1
  112. package/out/_next/static/chunks/pages/_app-cd9d4c76a4abc11a.js +0 -432
  113. package/out/_next/static/chunks/pages/changes-2a976f9efeb719aa.js +0 -1
  114. package/out/_next/static/chunks/pages/index-64cfb8b0948ba8ef.js +0 -1
  115. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-b2a9d773ce5d7739.js +0 -1
  116. package/out/_next/static/chunks/pages/slices-e9c70c082ca3e3f9.js +0 -1
  117. package/out/_next/static/css/200244e3e0463c39.css +0 -1
  118. package/out/_next/static/m6psnC5u1xT7Y6osWHKjp/_buildManifest.js +0 -1
  119. package/src/features/customTypes/__tests__/createCustomType.test.ts +0 -159
  120. package/src/features/customTypes/customTypesTable/createCustomType.ts +0 -107
  121. package/test/components/CreateCustomTypeModal.test.tsx +0 -73
  122. /package/out/_next/static/{m6psnC5u1xT7Y6osWHKjp → Dz7wwTNVdXvoAjySXz7mE}/_ssgManifest.js +0 -0
package/.depcheckrc CHANGED
@@ -6,6 +6,9 @@ ignores:
6
6
  "@vitest/coverage-v8",
7
7
  "monocle-ts",
8
8
  "newtype-ts",
9
+ "postcss",
10
+ "postcss-flexbugs-fixes",
11
+ "postcss-preset-env",
9
12
  "semver",
10
13
  "start-slicemachine",
11
14
  "stylelint-config-css-modules",
@@ -1,46 +1,54 @@
1
+ import { useState } from "react";
2
+ import { MdOutlineDelete } from "react-icons/md";
3
+ import { Close, Flex, Heading, Paragraph, Text, useThemeUI } from "theme-ui";
4
+
1
5
  import SliceMachineModal from "@components/SliceMachineModal";
2
- import { useSelector } from "react-redux";
3
- import { SliceMachineStoreType } from "@src/redux/type";
4
- import { isModalOpen } from "@src/modules/modal";
5
- import { ModalKeysEnum } from "@src/modules/modal/types";
6
6
  import useSliceMachineActions from "@src/modules/useSliceMachineActions";
7
- import { Close, Flex, Heading, Paragraph, Text, useThemeUI } from "theme-ui";
8
7
  import Card from "@components/Card";
9
- import { MdOutlineDelete } from "react-icons/md";
10
8
  import { Button } from "@components/Button";
11
- import { LoadingKeysEnum } from "@src/modules/loading/types";
12
- import { isLoading } from "@src/modules/loading";
9
+ import { deleteSlice } from "@src/features/slices/actions/deleteSlice";
13
10
 
14
11
  type DeleteSliceModalProps = {
12
+ isOpen: boolean;
13
+ libName: string;
15
14
  sliceId: string;
16
15
  sliceName: string;
17
- libName: string;
16
+ onClose: () => void;
18
17
  };
19
18
 
20
19
  export const DeleteSliceModal: React.FunctionComponent<
21
20
  DeleteSliceModalProps
22
- > = ({ sliceId, sliceName, libName }) => {
23
- const { isSliceModalOpen, isDeletingSlice } = useSelector(
24
- (store: SliceMachineStoreType) => ({
25
- isSliceModalOpen: isModalOpen(store, ModalKeysEnum.DELETE_SLICE),
26
- isDeletingSlice: isLoading(store, LoadingKeysEnum.DELETE_SLICE),
27
- }),
28
- );
21
+ > = ({ sliceId, sliceName, libName, isOpen, onClose }) => {
22
+ const [isDeleting, setIsDeleting] = useState(false);
23
+ const { deleteSliceSuccess } = useSliceMachineActions();
24
+ const { theme } = useThemeUI();
29
25
 
30
- const { closeModals, deleteSlice } = useSliceMachineActions();
26
+ const onDelete = async () => {
27
+ setIsDeleting(true);
31
28
 
32
- const { theme } = useThemeUI();
29
+ await deleteSlice({
30
+ sliceID: sliceId,
31
+ sliceName,
32
+ libraryID: libName,
33
+ onSuccess: () => {
34
+ deleteSliceSuccess(sliceId, libName);
35
+ },
36
+ });
37
+
38
+ onClose();
39
+ setIsDeleting(false);
40
+ };
33
41
 
34
42
  return (
35
43
  <SliceMachineModal
36
- isOpen={isSliceModalOpen}
44
+ isOpen={isOpen}
37
45
  shouldCloseOnOverlayClick={true}
38
46
  style={{
39
47
  content: {
40
48
  maxWidth: 612,
41
49
  },
42
50
  }}
43
- onRequestClose={closeModals}
51
+ onRequestClose={onClose}
44
52
  >
45
53
  <Card
46
54
  bodySx={{
@@ -79,7 +87,7 @@ export const DeleteSliceModal: React.FunctionComponent<
79
87
  Delete Slice
80
88
  </Heading>
81
89
  </Flex>
82
- <Close type="button" onClick={closeModals} />
90
+ <Close type="button" onClick={onClose} />
83
91
  </Flex>
84
92
  )}
85
93
  Footer={() => (
@@ -96,7 +104,7 @@ export const DeleteSliceModal: React.FunctionComponent<
96
104
  <Button
97
105
  label="Cancel"
98
106
  variant="secondary"
99
- onClick={() => closeModals()}
107
+ onClick={onClose}
100
108
  sx={{
101
109
  mr: "10px",
102
110
  fontWeight: "bold",
@@ -107,9 +115,11 @@ export const DeleteSliceModal: React.FunctionComponent<
107
115
  <Button
108
116
  label="Delete"
109
117
  variant="danger"
110
- isLoading={isDeletingSlice}
118
+ isLoading={isDeleting}
111
119
  sx={{ minHeight: 39, minWidth: 78 }}
112
- onClick={() => deleteSlice(sliceId, sliceName, libName)}
120
+ onClick={() => {
121
+ void onDelete();
122
+ }}
113
123
  />
114
124
  </Flex>
115
125
  )}
@@ -52,6 +52,7 @@ export const DeleteVariationModal: FC<DeleteVariationModalProps> = ({
52
52
  <DialogActions
53
53
  ok={{
54
54
  text: "Delete",
55
+ color: "tomato",
55
56
  onClick: () => {
56
57
  if (!variation) return;
57
58
  void (async () => {
@@ -2,25 +2,28 @@ import { SetStateAction, useState } from "react";
2
2
  import { Box } from "theme-ui";
3
3
  import { FormikErrors } from "formik";
4
4
  import { useSelector } from "react-redux";
5
+ import { useRouter } from "next/router";
5
6
 
6
7
  import ModalFormCard from "@components/ModalFormCard";
7
- import { InputBox } from "../components/InputBox";
8
- import { SelectRepeatable } from "../components/SelectRepeatable";
9
8
  import useSliceMachineActions from "@src/modules/useSliceMachineActions";
10
9
  import { SliceMachineStoreType } from "@src/redux/type";
11
10
  import {
12
11
  selectAllCustomTypeIds,
13
12
  selectAllCustomTypeLabels,
14
13
  } from "@src/modules/availableCustomTypes";
15
- import { isModalOpen } from "@src/modules/modal";
16
- import { ModalKeysEnum } from "@src/modules/modal/types";
17
- import { isLoading } from "@src/modules/loading";
18
- import { LoadingKeysEnum } from "@src/modules/loading/types";
19
- import { telemetry } from "@src/apiClient";
20
14
  import { slugify } from "@lib/utils/str";
21
15
  import { API_ID_REGEX } from "@lib/consts";
22
16
  import type { CustomTypeFormat } from "@slicemachine/manager";
23
17
  import { CUSTOM_TYPES_MESSAGES } from "@src/features/customTypes/customTypesMessages";
18
+ import {
19
+ CustomTypeOrigin,
20
+ createCustomType,
21
+ } from "@src/features/customTypes/actions/createCustomType";
22
+ import { CUSTOM_TYPES_CONFIG } from "@src/features/customTypes/customTypesConfig";
23
+ import { getFormat } from "@src/domain/customType";
24
+
25
+ import { InputBox } from "../components/InputBox";
26
+ import { SelectRepeatable } from "../components/SelectRepeatable";
24
27
 
25
28
  interface FormValues {
26
29
  id: string;
@@ -30,46 +33,64 @@ interface FormValues {
30
33
 
31
34
  type CreateCustomTypeModalProps = {
32
35
  format: CustomTypeFormat;
33
- origin?: "onboarding" | "table";
36
+ isCreating: boolean;
37
+ isOpen: boolean;
38
+ origin?: CustomTypeOrigin;
39
+ onCreateChange: (isCreating: boolean) => void;
40
+ onOpenChange: (isOpen: boolean) => void;
34
41
  };
35
42
 
36
43
  export const CreateCustomTypeModal: React.FC<CreateCustomTypeModalProps> = ({
37
44
  format,
45
+ isCreating,
46
+ isOpen,
38
47
  origin = "table",
48
+ onCreateChange,
49
+ onOpenChange,
39
50
  }) => {
40
- const { createCustomType, closeModals } = useSliceMachineActions();
41
-
42
- const {
43
- customTypeIds,
44
- isCreateCustomTypeModalOpen,
45
- isCreatingCustomType,
46
- customTypeLabels,
47
- } = useSelector((store: SliceMachineStoreType) => ({
48
- customTypeIds: selectAllCustomTypeIds(store),
49
- customTypeLabels: selectAllCustomTypeLabels(store),
50
- isCreateCustomTypeModalOpen: isModalOpen(
51
- store,
52
- ModalKeysEnum.CREATE_CUSTOM_TYPE,
53
- ),
54
- isCreatingCustomType: isLoading(store, LoadingKeysEnum.CREATE_CUSTOM_TYPE),
55
- }));
51
+ const { createCustomTypeSuccess } = useSliceMachineActions();
52
+
53
+ const { customTypeIds, customTypeLabels } = useSelector(
54
+ (store: SliceMachineStoreType) => ({
55
+ customTypeIds: selectAllCustomTypeIds(store),
56
+ customTypeLabels: selectAllCustomTypeLabels(store),
57
+ }),
58
+ );
56
59
  const customTypesMessages = CUSTOM_TYPES_MESSAGES[format];
57
60
  const [isIdFieldPristine, setIsIdFieldPristine] = useState(true);
61
+ const router = useRouter();
58
62
 
59
- const createCustomTypeAndTrack = ({ id, label, repeatable }: FormValues) => {
60
- const name = label || id;
63
+ const onSubmit = async ({ id, label, repeatable }: FormValues) => {
64
+ onCreateChange(true);
61
65
 
62
- void telemetry.track({
63
- event: "custom-type:created",
64
- id,
65
- name,
66
+ await createCustomType({
66
67
  format,
67
- type: repeatable ? "repeatable" : "single",
68
+ id,
69
+ label,
68
70
  origin,
71
+ repeatable,
72
+ onSuccess: async (newCustomType) => {
73
+ createCustomTypeSuccess(newCustomType);
74
+
75
+ const format = getFormat(newCustomType);
76
+ const customTypesConfig = CUSTOM_TYPES_CONFIG[format];
77
+
78
+ setIsIdFieldPristine(true);
79
+
80
+ await router.push({
81
+ pathname: customTypesConfig.getBuilderPagePathname(id),
82
+ query:
83
+ newCustomType.format === "page"
84
+ ? {
85
+ newPageType: true,
86
+ }
87
+ : undefined,
88
+ });
89
+ },
69
90
  });
70
- createCustomType(id, name, repeatable, format);
71
- closeModals();
72
- setIsIdFieldPristine(true);
91
+
92
+ onCreateChange(false);
93
+ onOpenChange(false);
73
94
  };
74
95
 
75
96
  const handleLabelChange = (
@@ -106,16 +127,18 @@ export const CreateCustomTypeModal: React.FC<CreateCustomTypeModalProps> = ({
106
127
  return (
107
128
  <ModalFormCard
108
129
  dataCy="create-ct-modal"
109
- isOpen={isCreateCustomTypeModalOpen}
130
+ isOpen={isOpen}
110
131
  widthInPx="530px"
111
132
  formId="create-custom-type"
112
133
  buttonLabel={"Create"}
113
134
  close={() => {
114
- closeModals();
135
+ onOpenChange(false);
115
136
  setIsIdFieldPristine(true);
116
137
  }}
117
- onSubmit={createCustomTypeAndTrack}
118
- isLoading={isCreatingCustomType}
138
+ onSubmit={(values) => {
139
+ void onSubmit(values);
140
+ }}
141
+ isLoading={isCreating}
119
142
  initialValues={{
120
143
  repeatable: true,
121
144
  id: "",
@@ -31,7 +31,7 @@ export const RenameCustomTypeModal: React.FC<RenameCustomTypeModalProps> = ({
31
31
  }) => {
32
32
  const customTypeName = customType?.label ?? "";
33
33
  const customTypeId = customType?.id ?? "";
34
- const { renameAvailableCustomTypeSuccess } = useSliceMachineActions();
34
+ const { renameCustomTypeSuccess } = useSliceMachineActions();
35
35
 
36
36
  const [isRenaming, setIsRenaming] = useState(false);
37
37
 
@@ -46,7 +46,7 @@ export const RenameCustomTypeModal: React.FC<RenameCustomTypeModalProps> = ({
46
46
  await renameCustomType({
47
47
  model: customType,
48
48
  newLabel: values.customTypeName,
49
- onSuccess: renameAvailableCustomTypeSuccess,
49
+ onSuccess: renameCustomTypeSuccess,
50
50
  });
51
51
  }
52
52
  setIsRenaming(false);
@@ -1,50 +1,62 @@
1
1
  import { Box } from "theme-ui";
2
- import useSliceMachineActions from "@src/modules/useSliceMachineActions";
3
- import ModalFormCard from "../../ModalFormCard";
4
- import { InputBox } from "../components/InputBox";
5
2
  import { useSelector } from "react-redux";
3
+
4
+ import useSliceMachineActions from "@src/modules/useSliceMachineActions";
6
5
  import { SliceMachineStoreType } from "@src/redux/type";
7
- import { isModalOpen } from "@src/modules/modal";
8
- import { ModalKeysEnum } from "@src/modules/modal/types";
9
6
  import { getLibraries, getRemoteSlices } from "@src/modules/slices";
7
+ import { ComponentUI } from "@lib/models/common/ComponentUI";
8
+ import { renameSlice } from "@src/features/slices/actions/renameSlice";
9
+
10
+ import { InputBox } from "../components/InputBox";
11
+ import ModalFormCard from "../../ModalFormCard";
10
12
  import { SliceModalValues } from "../formsTypes";
11
13
  import { validateSliceModalValues } from "../formsValidator";
12
14
 
13
15
  interface RenameSliceModalProps {
14
- sliceName: string;
15
- sliceId: string;
16
- libName: string;
16
+ isOpen: boolean;
17
+ slice?: ComponentUI;
18
+ onClose: () => void;
17
19
  }
18
20
 
19
21
  export const RenameSliceModal: React.FC<RenameSliceModalProps> = ({
20
- sliceName,
21
- sliceId,
22
- libName,
22
+ slice,
23
+ isOpen,
24
+ onClose,
23
25
  }) => {
24
- const { renameSlice, closeModals } = useSliceMachineActions();
25
- const { isRenameSliceModalOpen, localLibs, remoteLibs } = useSelector(
26
+ const { renameSliceSuccess } = useSliceMachineActions();
27
+ const { localLibs, remoteLibs } = useSelector(
26
28
  (store: SliceMachineStoreType) => ({
27
- isRenameSliceModalOpen: isModalOpen(store, ModalKeysEnum.RENAME_SLICE),
28
29
  localLibs: getLibraries(store),
29
30
  remoteLibs: getRemoteSlices(store),
30
31
  }),
31
32
  );
33
+ const initialSliceName = slice?.model.name ?? "";
34
+
35
+ const handleOnSubmit = async (values: SliceModalValues) => {
36
+ if (slice) {
37
+ await renameSlice({
38
+ slice,
39
+ newSliceName: values.sliceName,
40
+ onSuccess: (renamedSlice) => {
41
+ renameSliceSuccess(renamedSlice.from, renamedSlice.model);
42
+ },
43
+ });
32
44
 
33
- const handleOnSubmit = (values: SliceModalValues) => {
34
- renameSlice(libName, sliceId, values.sliceName);
45
+ onClose();
46
+ }
35
47
  };
36
48
 
37
49
  return (
38
50
  <ModalFormCard<SliceModalValues>
39
51
  dataCy="rename-slice-modal"
40
- isOpen={isRenameSliceModalOpen}
52
+ isOpen={isOpen}
41
53
  widthInPx="530px"
42
- formId={`rename-slice-modal-${sliceId}`}
43
- close={closeModals}
54
+ formId={`rename-slice-modal-${slice?.model.id ?? ""}`}
55
+ close={onClose}
44
56
  buttonLabel="Rename"
45
- onSubmit={handleOnSubmit}
57
+ onSubmit={(values) => void handleOnSubmit(values)}
46
58
  initialValues={{
47
- sliceName: sliceName,
59
+ sliceName: initialSliceName,
48
60
  }}
49
61
  content={{
50
62
  title: "Rename a slice",
@@ -45,7 +45,6 @@ export const RenameVariationModal: FC<RenameVariationModalProps> = ({
45
45
  <DialogHeader icon="edit" title="Rename variation" />
46
46
  <DialogContent>
47
47
  <Formik
48
- validateOnChange
49
48
  validateOnMount
50
49
  initialValues={{ variationName: variation?.name ?? "" }}
51
50
  validate={(values) => {
@@ -81,7 +81,6 @@ function ModalCard<Values extends FormikValues>({
81
81
  }}
82
82
  >
83
83
  <Formik
84
- validateOnChange
85
84
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
86
85
  initialValues={initialValues}
87
86
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
@@ -1,13 +1,9 @@
1
- import { type FC, useState } from "react";
1
+ import { type FC } from "react";
2
2
  import Link from "next/link";
3
3
  import { useRouter } from "next/router";
4
- import { SliceMachineStoreType } from "@src/redux/type";
5
- import { useSelector } from "react-redux";
6
4
 
7
5
  import { SideNavLink, SideNavListItem } from "@src/components/SideNav";
8
6
  import { RadarIcon } from "@src/icons/RadarIcon";
9
- import { isLoading } from "@src/modules/loading";
10
- import { LoadingKeysEnum } from "@src/modules/loading/types";
11
7
  import {
12
8
  HoverCard,
13
9
  HoverCardCloseButton,
@@ -15,11 +11,8 @@ import {
15
11
  HoverCardMedia,
16
12
  HoverCardTitle,
17
13
  } from "@src/components/HoverCard";
18
- import {
19
- userHasSeenChangesToolTip,
20
- userHasSeenSimulatorToolTip,
21
- } from "@src/modules/userContext";
22
14
  import useSliceMachineActions from "@src/modules/useSliceMachineActions";
15
+
23
16
  import { ChangesRightElement } from "./ChangesRightElement";
24
17
 
25
18
  export const ChangesListItem: FC = () => {
@@ -63,30 +56,19 @@ export const ChangesListItem: FC = () => {
63
56
  );
64
57
  };
65
58
 
59
+ // TODO(DT-1925): Reactivate this feature
66
60
  const useOpenChangesHoverCard = () => {
67
- const {
68
- hasSeenChangesToolTip,
69
- hasSeenSimulatorToolTip,
70
- isSavingCustomType,
71
- isSavingSlice,
72
- } = useSelector((store: SliceMachineStoreType) => ({
73
- hasSeenChangesToolTip: userHasSeenChangesToolTip(store),
74
- hasSeenSimulatorToolTip: userHasSeenSimulatorToolTip(store),
75
- isSavingCustomType: isLoading(store, LoadingKeysEnum.SAVE_CUSTOM_TYPE),
76
- isSavingSlice: isLoading(store, LoadingKeysEnum.SAVE_SLICE),
77
- }));
78
-
79
- const isSaving = isSavingCustomType || isSavingSlice;
80
- const [prevIsSaving, setPrevIsSaving] = useState(isSaving);
61
+ // const { hasSeenChangesToolTip, hasSeenSimulatorToolTip } = useSelector(
62
+ // (store: SliceMachineStoreType) => ({
63
+ // hasSeenChangesToolTip: userHasSeenChangesToolTip(store),
64
+ // hasSeenSimulatorToolTip: userHasSeenSimulatorToolTip(store),
65
+ // }),
66
+ // );
81
67
 
82
- if (!prevIsSaving && isSaving) {
83
- setPrevIsSaving(isSaving);
84
- }
68
+ // return (
69
+ // !hasSeenChangesToolTip &&
70
+ // hasSeenSimulatorToolTip
71
+ // );
85
72
 
86
- return (
87
- !hasSeenChangesToolTip &&
88
- hasSeenSimulatorToolTip &&
89
- !isSaving &&
90
- prevIsSaving
91
- );
73
+ return false;
92
74
  };
@@ -8,6 +8,7 @@ import { telemetry } from "@src/apiClient";
8
8
  import VideoItem from "@components/Navigation/VideoItem";
9
9
  import { LightningIcon } from "@src/icons/Lightning";
10
10
  import { MathPlusIcon } from "@src/icons/MathPlusIcon";
11
+ import { SettingsIcon } from "@src/icons/SettingsIcon";
11
12
  import { CUSTOM_TYPES_CONFIG } from "@src/features/customTypes/customTypesConfig";
12
13
  import {
13
14
  SideNavSeparator,
@@ -26,6 +27,7 @@ import { SliceMachineStoreType } from "@src/redux/type";
26
27
  import useSliceMachineActions from "@src/modules/useSliceMachineActions";
27
28
  import { getChangelog } from "@src/modules/environment";
28
29
  import { CUSTOM_TYPES_MESSAGES } from "@src/features/customTypes/customTypesMessages";
30
+ import { useGitIntegrationExperiment } from "@src/features/settings/git/useGitIntegrationExperiment";
29
31
  import { useRepositoryInformation } from "@src/hooks/useRepositoryInformation";
30
32
 
31
33
  import { ChangesListItem } from "./ChangesListItem";
@@ -45,6 +47,7 @@ const Navigation: FC = () => {
45
47
  useSliceMachineActions();
46
48
  const { repositoryName, repositoryDomain, repositoryUrl } =
47
49
  useRepositoryInformation();
50
+ const gitIntegrationExperiment = useGitIntegrationExperiment();
48
51
 
49
52
  return (
50
53
  <SideNav>
@@ -141,17 +144,19 @@ const Navigation: FC = () => {
141
144
  )}
142
145
 
143
146
  <SideNavList position="bottom">
144
- <SideNavLink
145
- title="Invite team"
146
- href={`${repositoryUrl}/settings/users`}
147
- Icon={(props) => <MathPlusIcon {...props} />}
148
- onClick={() => {
149
- void telemetry.track({
150
- event: "users-invite-button-clicked",
151
- });
152
- }}
153
- target="_blank"
154
- />
147
+ <SideNavListItem>
148
+ <SideNavLink
149
+ title="Invite team"
150
+ href={`${repositoryUrl}/settings/users`}
151
+ Icon={MathPlusIcon}
152
+ onClick={() => {
153
+ void telemetry.track({
154
+ event: "users-invite-button-clicked",
155
+ });
156
+ }}
157
+ target="_blank"
158
+ />
159
+ </SideNavListItem>
155
160
 
156
161
  <ErrorBoundary>
157
162
  <Suspense>
@@ -162,11 +167,23 @@ const Navigation: FC = () => {
162
167
  </Suspense>
163
168
  </ErrorBoundary>
164
169
 
170
+ {gitIntegrationExperiment.eligible ? (
171
+ <SideNavListItem>
172
+ <SideNavLink
173
+ title="Settings"
174
+ href="/settings"
175
+ Icon={SettingsIcon}
176
+ active={router.asPath.startsWith("/settings")}
177
+ component={Link}
178
+ />
179
+ </SideNavListItem>
180
+ ) : undefined}
181
+
165
182
  <SideNavListItem>
166
183
  <SideNavLink
167
184
  title="Changelog"
168
185
  href="/changelog"
169
- Icon={(props) => <LightningIcon {...props} />}
186
+ Icon={LightningIcon}
170
187
  active={router.asPath.startsWith("/changelog")}
171
188
  component={Link}
172
189
  RightElement={
@@ -94,7 +94,6 @@ export const ReviewForm: FC<ReviewFormProps> = (props) => {
94
94
  >
95
95
  <Formik
96
96
  validateOnMount
97
- validateOnChange
98
97
  initialValues={{
99
98
  rating: 0,
100
99
  comment: "",
@@ -13,7 +13,6 @@ const WidgetForm = ({
13
13
  return (
14
14
  <Box>
15
15
  <Formik
16
- validateOnChange
17
16
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
18
17
  initialValues={initialValues}
19
18
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-assignment
@@ -114,7 +114,6 @@ const NewField: React.FC<NewField> = ({
114
114
 
115
115
  return (
116
116
  <Formik
117
- validateOnChange
118
117
  onSubmit={onSave}
119
118
  validationSchema={validationSchema}
120
119
  initialValues={initialValues}
@@ -51,7 +51,7 @@ export const StructuredTextWidget: Widget<RichText, typeof schema> = {
51
51
  label,
52
52
  placeholder: "",
53
53
  allowTargetBlank: true,
54
- single: optionValues.join(","),
54
+ multi: optionValues.join(","),
55
55
  },
56
56
  }),
57
57
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
package/out/404.html CHANGED
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-cd9d4c76a4abc11a.js" defer=""></script><script src="/_next/static/chunks/pages/_error-69b4f498bafdd188.js" defer=""></script><script src="/_next/static/m6psnC5u1xT7Y6osWHKjp/_buildManifest.js" defer=""></script><script src="/_next/static/m6psnC5u1xT7Y6osWHKjp/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"m6psnC5u1xT7Y6osWHKjp","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/3c26dbbbd8f4be12.css" as="style"/><link rel="stylesheet" href="/_next/static/css/3c26dbbbd8f4be12.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-5ec41fc53c1f6405.js" defer=""></script><script src="/_next/static/chunks/pages/_error-69b4f498bafdd188.js" defer=""></script><script src="/_next/static/Dz7wwTNVdXvoAjySXz7mE/_buildManifest.js" defer=""></script><script src="/_next/static/Dz7wwTNVdXvoAjySXz7mE/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"Dz7wwTNVdXvoAjySXz7mE","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
@@ -0,0 +1 @@
1
+ self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,f,n,u,d,h,l,k,j,p,g,o,r){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[a,j,p,"static/chunks/pages/index-cf93d16e9c63b6db.js"],"/_error":["static/chunks/pages/_error-69b4f498bafdd188.js"],"/changelog":[s,e,"static/chunks/870-0c7a8a9622de78b7.js","static/chunks/pages/changelog-02cd80dad6f40878.js"],"/changes":[s,t,"static/chunks/8eec4907-b712959d9f984b68.js",i,"static/chunks/918-5bb55fb464e34768.js",c,f,"static/css/838fd8bb5a7c32b0.css","static/chunks/pages/changes-8e9da8fbb809aad3.js"],"/custom-types":[a,j,p,"static/chunks/pages/custom-types-3c8e721ec6802127.js"],"/custom-types/[customTypeId]":[s,n,u,d,h,e,b,i,l,g,c,a,k,o,r,"static/chunks/pages/custom-types/[customTypeId]-97ab3b90b85d645d.js"],"/labs":["static/chunks/pages/labs-39b50541a4c370bf.js"],"/page-types/[pageTypeId]":[s,n,u,d,h,e,b,i,l,g,c,a,k,o,r,"static/chunks/pages/page-types/[pageTypeId]-84a22c5e480d3fa9.js"],"/settings":["static/css/ca32882a5d2d8d88.css","static/chunks/pages/settings-879686e3a8759dc3.js"],"/slices":[s,t,b,c,f,"static/css/f8eb526e10bc2441.css","static/chunks/pages/slices-4522d604117d8c66.js"],"/slices/[lib]/[sliceName]/[variation]":[s,t,n,u,d,h,e,b,i,l,c,k,f,"static/css/b22c0750c14cc089.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-9b893c62b2f2fe4a.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[t,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/18539003-5f78714a35fde4a1.js","static/chunks/777-8c5507e3b119b5dc.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-c498e9c80cae8cce.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/settings","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/59b4e022-7a3b5554b806349f.js","static/chunks/25-01f422cea8066349.js","static/chunks/799-b616401fe0dafdeb.js","static/chunks/183-4feb6bb3eddbc768.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/543-f8766685f7f451e2.js","static/chunks/50-cfc2514205b86001.js","static/chunks/286-ed90373e9a469944.js","static/chunks/f36c6662-03bb5e9d9aa0b0aa.js","static/chunks/4c744e84-e3161d754618373f.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-2c5b6c0367fcde86.js","static/chunks/696-b12edad30a3617e5.js","static/chunks/318-99b5914b60bf1d17.js","static/chunks/727-f8fefdd3e50cab2a.js","static/css/be1f49e49a5aa7eb.css","static/chunks/474-5a072e6fac61f703.js","static/chunks/904-4653b7a849f4db94.js","static/css/72465cc1225f28a2.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();