slice-machine-ui 1.18.1-dev-next-release.2 → 1.18.1-dev-next-release.4
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/components/Button/index.tsx +2 -2
- package/components/Changelog/index.tsx +1 -1
- package/components/Changelog/versionDetails/UpdateCommandBox.tsx +1 -1
- package/components/ChangesItems/ChangesItems.tsx +2 -2
- package/components/CustomTypeTable/changesPage.tsx +1 -1
- package/components/DeleteDocumentsDrawer/HardDeleteDocumentsDrawer.tsx +3 -3
- package/components/DeleteDocumentsDrawer/ReferencesErrorDrawer.tsx +3 -3
- package/components/DeleteDocumentsDrawer/SoftDeleteDocumentsDrawer.tsx +3 -3
- package/components/DeleteSliceModal/index.tsx +1 -1
- package/components/FormFields/CheckboxControl.jsx +1 -1
- package/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx +5 -5
- package/components/Forms/CreateSliceModal/CreateSliceModal.tsx +1 -1
- package/components/Forms/RenameSliceModal/RenameSliceModal.tsx +1 -1
- package/components/Forms/formsValidator.ts +2 -2
- package/components/Grid/index.tsx +1 -1
- package/components/Li/index.tsx +2 -2
- package/components/ListItem/index.tsx +2 -2
- package/components/ListItem/utils.js +1 -1
- package/components/LoginModal/index.tsx +2 -2
- package/components/ModalFormCard/index.tsx +2 -2
- package/components/Navigation/VideoItem.tsx +2 -2
- package/components/Navigation/index.test.tsx +8 -8
- package/components/Navigation/index.tsx +2 -2
- package/components/ReviewModal/ReviewForm.tsx +1 -1
- package/components/ReviewModal/ReviewModal.tsx +4 -4
- package/components/ScreenshotChangesModal/VariationDropZone.tsx +6 -6
- package/components/ScreenshotChangesModal/index.tsx +3 -3
- package/components/ScreenshotPreviewModal/index.tsx +2 -2
- package/components/Simulator/components/Header/index.tsx +1 -1
- package/components/Simulator/components/IframeRenderer/index.tsx +2 -2
- package/components/Simulator/components/SetupModal/index.tsx +1 -1
- package/components/Simulator/components/Toolbar/index.tsx +2 -2
- package/components/Simulator/index.tsx +5 -5
- package/components/Tooltip/TextWithTooltip.tsx +1 -1
- package/lib/builders/CustomTypeBuilder/SliceZone/List.tsx +2 -2
- package/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +4 -4
- package/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +1 -1
- package/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +12 -12
- package/lib/builders/CustomTypeBuilder/TabZone/index.tsx +1 -1
- package/lib/builders/CustomTypeBuilder/index.tsx +1 -1
- package/lib/builders/SliceBuilder/FieldZones/index.tsx +4 -4
- package/lib/builders/SliceBuilder/Header/SimulatorButton/index.tsx +1 -1
- package/lib/builders/SliceBuilder/Header/VariationsPopover/index.tsx +1 -1
- package/lib/builders/SliceBuilder/Header/index.tsx +2 -2
- package/lib/builders/SliceBuilder/index.tsx +2 -2
- package/lib/builders/common/EditModal/Form.jsx +1 -1
- package/lib/builders/common/EditModal/index.jsx +3 -3
- package/lib/builders/common/Zone/Card/components/NewField.tsx +7 -7
- package/lib/builders/common/Zone/index.jsx +2 -2
- package/lib/builders/utils/index.ts +1 -1
- package/lib/forms/defaults.ts +3 -3
- package/lib/forms/fields.ts +3 -3
- package/lib/forms/index.ts +3 -3
- package/lib/models/common/ComponentUI.ts +3 -3
- package/lib/models/common/CustomType/group.ts +2 -2
- package/lib/models/common/CustomType/index.ts +4 -4
- package/lib/models/common/CustomType/tab.ts +7 -7
- package/lib/models/common/ErrorWithStatus.ts +4 -1
- package/lib/models/common/Fields.ts +1 -1
- package/lib/models/common/Group.ts +5 -5
- package/lib/models/common/Library.ts +1 -1
- package/lib/models/common/Manifest.ts +4 -4
- package/lib/models/common/ModelData.ts +6 -6
- package/lib/models/common/ModelStatus/compareCustomTypeModels.ts +1 -1
- package/lib/models/common/ModelStatus/compareSliceModels.ts +4 -4
- package/lib/models/common/ModelStatus/index.ts +5 -5
- package/lib/models/common/Screenshots.ts +1 -1
- package/lib/models/common/Slice.ts +7 -7
- package/lib/models/common/Slices.ts +5 -5
- package/lib/models/common/UserProfile.ts +1 -1
- package/lib/models/common/Variation.ts +6 -6
- package/lib/models/common/normalizers/customType.ts +3 -3
- package/lib/models/common/normalizers/slices.ts +2 -2
- package/lib/models/common/widgets/Boolean/index.ts +2 -2
- package/lib/models/common/widgets/ContentRelationship/Form.tsx +2 -2
- package/lib/models/common/widgets/ContentRelationship/index.ts +2 -2
- package/lib/models/common/widgets/Group/ListItem/index.jsx +3 -3
- package/lib/models/common/widgets/Image/Form.tsx +3 -3
- package/lib/models/common/widgets/StructuredText/Form.tsx +2 -2
- package/lib/models/common/widgets/StructuredText/index.ts +2 -2
- package/lib/utils/index.ts +1 -1
- package/lib/utils/poll.ts +3 -3
- package/lib/utils/shared/customTypes.ts +1 -1
- package/next.config.mjs +3 -3
- package/out/404.html +1 -1
- package/out/_next/static/{4_g3bWryyxcdGzgi4MHr- → HGF5llOreY_Hv9IuGfW25}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/125-e3857af2068bbedf.js +11 -0
- package/out/_next/static/chunks/pages/{_app-b2f6093b3f1e9f24.js → _app-925e9450acf20963.js} +12 -12
- 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]/screenshot.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 +5 -5
- package/pages/_app.tsx +1 -1
- package/pages/api/embed.js +1 -1
- package/pages/slices.tsx +4 -4
- package/src/apiClient.ts +11 -11
- package/src/components/BaseHoverCard/BaseHoverCard.test.tsx +1 -1
- package/src/components/HoverCard/HoverCard.tsx +1 -1
- package/src/components/SideNav/SideNav.tsx +2 -2
- package/src/components/Table/Table.test.tsx +1 -1
- package/src/components/TextLink/TextLink.tsx +1 -1
- package/src/domain/__tests__/CustomTypeModel.test.ts +19 -19
- package/src/domain/customType.ts +10 -10
- package/src/domain/slice.ts +5 -5
- package/src/features/changes/StatusBadge.tsx +1 -1
- package/src/features/customTypes/EditDropdown.tsx +1 -1
- package/src/features/customTypes/PageTypeOnboarding.tsx +2 -2
- package/src/features/customTypes/__tests__/CustomTypeBuilderPage.test.tsx +7 -7
- package/src/features/customTypes/__tests__/CustomTypesTablePage.test.tsx +24 -22
- package/src/features/customTypes/actions/convertCustomToPageType.ts +3 -3
- package/src/features/customTypes/actions/deleteCustomType.ts +1 -1
- package/src/features/customTypes/actions/renameCustomType.ts +1 -1
- package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +3 -3
- package/src/features/customTypes/customTypesConfig.ts +3 -3
- package/src/features/customTypes/customTypesTable/CustomTypesTable.tsx +2 -2
- package/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +3 -3
- package/src/features/customTypes/customTypesTable/createCustomType.ts +2 -2
- package/src/features/customTypes/customTypesTable/useCustomTypes.ts +7 -7
- package/src/features/labs/labsList/LabsList.tsx +3 -3
- package/src/features/labs/labsList/useLab.tsx +1 -1
- package/src/features/slices/actions/addSlicesToSliceZone.ts +1 -1
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +2 -2
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +5 -5
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx +11 -11
- package/src/features/slicesTemplates/useSlicesTemplates.ts +1 -1
- package/src/hooks/useCurrentSlice.tsx +2 -2
- package/src/hooks/useElementSize.ts +1 -1
- package/src/hooks/useModelStatus.ts +13 -10
- package/src/hooks/useRouteChange.tsx +1 -1
- package/src/hooks/useSMTracker.ts +2 -2
- package/src/hooks/useSliceMachineConfig.ts +1 -1
- package/src/hooks/useThrottle.ts +10 -7
- package/src/hooks/useUnSyncChanges.ts +5 -5
- package/src/hooks/useWindowDimensions.ts +1 -1
- package/src/modules/availableCustomTypes/index.ts +19 -19
- package/src/modules/environment/index.ts +6 -6
- package/src/modules/loading/index.ts +3 -3
- package/src/modules/modal/index.ts +2 -2
- package/src/modules/pushChangesSaga/index.ts +7 -7
- package/src/modules/pushChangesSaga/trackPushChangesSuccess.ts +3 -3
- package/src/modules/screenshots/actions.ts +2 -2
- package/src/modules/screenshots/sagas.ts +9 -9
- package/src/modules/selectedCustomType/actions.ts +10 -10
- package/src/modules/selectedCustomType/reducer.ts +26 -26
- package/src/modules/selectedCustomType/sagas.ts +5 -5
- package/src/modules/selectedCustomType/selectors.ts +4 -4
- package/src/modules/selectedCustomType/stateHelpers.ts +1 -1
- package/src/modules/selectedSlice/actions.ts +4 -4
- package/src/modules/selectedSlice/reducer.ts +7 -7
- package/src/modules/selectedSlice/sagas.ts +4 -4
- package/src/modules/selectedSlice/selectors.ts +5 -5
- package/src/modules/simulator/index.ts +20 -17
- package/src/modules/slices/index.ts +18 -18
- package/src/modules/toaster/index.tsx +3 -3
- package/src/modules/toaster/utils.tsx +1 -1
- package/src/modules/useSliceMachineActions.ts +43 -41
- package/src/modules/userContext/index.ts +9 -9
- package/src/redux/store.ts +2 -2
- package/src/theme.ts +1 -1
- package/src/utils/editor.ts +1 -1
- package/src/utils/fieldNameCreator.ts +2 -2
- package/test/__setup__.ts +18 -7
- package/test/__testutils__/createPrismicAuthLoginResponse.ts +1 -1
- package/test/__testutils__/createTestPlugin.ts +1 -1
- package/test/__testutils__/createTestProject.ts +3 -3
- package/test/__testutils__/index.tsx +1 -1
- package/test/__testutils__/mockAWSACLAPI.ts +9 -9
- package/test/__testutils__/mockCustomTypesAPI.ts +16 -16
- package/test/__testutils__/mockPrismicAuthAPI.ts +3 -3
- package/test/__testutils__/mockPrismicUserAPI.ts +4 -4
- package/test/__testutils__/readMSWFormData.ts +3 -3
- package/test/components/CreateCustomTypeModal.test.tsx +1 -1
- package/test/components/LoginModal.test.tsx +2 -2
- package/test/lib/builders/EditModal.test.tsx +5 -5
- package/test/lib/builders/buildersUtils.test.ts +13 -13
- package/test/lib/models/common/CustomType/sliceZone.test.ts +2 -2
- package/test/lib/models/common/ModelStatus.test.ts +1 -1
- package/test/lib/models/common/widgets/index.test.ts +6 -6
- package/test/lib/utils/shared/customTypes.test.ts +1 -1
- package/test/pages/custom-types.test.tsx +7 -7
- package/test/pages/simulator.test.tsx +5 -5
- package/test/pages/slices.test.tsx +4 -4
- package/test/src/hooks/useModelStatus.test.ts +2 -3
- package/test/src/modules/__fixtures__/sliceUtilsFactory.ts +2 -2
- package/test/src/modules/availableCustomTypes/index.test.ts +20 -18
- package/test/src/modules/environment.test.ts +2 -2
- package/test/src/modules/loading.test.ts +1 -1
- package/test/src/modules/modal.test.ts +1 -1
- package/test/src/modules/pushChangesSaga.test.ts +10 -10
- package/test/src/modules/screenshots/sagas.test.ts +5 -5
- package/test/src/modules/selectedCustomType/reducer.test.ts +25 -25
- package/test/src/modules/selectedCustomType/sagas.test.ts +3 -3
- package/test/src/modules/selectedSlice/__testutils__/getRefreshStateCreatorPayloadData.ts +1 -1
- package/test/src/modules/selectedSlice/reducer.test.ts +12 -12
- package/test/src/modules/selectedSlice/sagas.test.ts +6 -6
- package/test/src/modules/simulator.test.ts +10 -10
- package/test/src/modules/slices.test.ts +5 -5
- package/test/src/modules/toaster/utils.test.ts +3 -3
- package/test/src/normalizers/customType.test.ts +5 -5
- package/test/src/utils/fieldNameCreator.test.ts +1 -1
- package/out/_next/static/chunks/125-84464edfe25651eb.js +0 -19
- /package/out/_next/static/{4_g3bWryyxcdGzgi4MHr- → HGF5llOreY_Hv9IuGfW25}/_ssgManifest.js +0 -0
|
@@ -46,7 +46,7 @@ const useSMTracker = () => {
|
|
|
46
46
|
export default useSMTracker;
|
|
47
47
|
|
|
48
48
|
function group(
|
|
49
|
-
libs: readonly LibraryUI[]
|
|
49
|
+
libs: readonly LibraryUI[],
|
|
50
50
|
): ReturnType<typeof telemetry.group> | void {
|
|
51
51
|
const downloadedLibs = libs.filter((l) => l.meta.isDownloaded);
|
|
52
52
|
|
|
@@ -55,7 +55,7 @@ function group(
|
|
|
55
55
|
downloadedLibsCount: downloadedLibs.length,
|
|
56
56
|
npmLibsCount: libs.filter((l) => l.meta.isNodeModule).length,
|
|
57
57
|
downloadedLibs: downloadedLibs.map((l) =>
|
|
58
|
-
l.meta.name != null ? l.meta.name : "Unknown"
|
|
58
|
+
l.meta.name != null ? l.meta.name : "Unknown",
|
|
59
59
|
),
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -5,7 +5,7 @@ import { managerClient } from "@src/managerClient";
|
|
|
5
5
|
|
|
6
6
|
type UseSliceMachineConfigReturnType = [
|
|
7
7
|
config: SliceMachineConfig,
|
|
8
|
-
setConfig: (config: SliceMachineConfig) => Promise<void
|
|
8
|
+
setConfig: (config: SliceMachineConfig) => Promise<void>,
|
|
9
9
|
];
|
|
10
10
|
|
|
11
11
|
export function useSliceMachineConfig(): UseSliceMachineConfigReturnType {
|
package/src/hooks/useThrottle.ts
CHANGED
|
@@ -3,18 +3,21 @@ import { useEffect, useState, useRef } from "react";
|
|
|
3
3
|
function useThrottle<T>(
|
|
4
4
|
cb: () => T,
|
|
5
5
|
limit: number,
|
|
6
|
-
args: ReadonlyArray<unknown
|
|
6
|
+
args: ReadonlyArray<unknown>,
|
|
7
7
|
): T {
|
|
8
8
|
const [throttledValue, setThrottledValue] = useState(cb());
|
|
9
9
|
const lastRan = useRef(Date.now());
|
|
10
10
|
|
|
11
11
|
useEffect(() => {
|
|
12
|
-
const handler = setTimeout(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const handler = setTimeout(
|
|
13
|
+
function () {
|
|
14
|
+
if (Date.now() - lastRan.current >= limit) {
|
|
15
|
+
setThrottledValue(cb());
|
|
16
|
+
lastRan.current = Date.now();
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
limit - (Date.now() - lastRan.current),
|
|
20
|
+
);
|
|
18
21
|
|
|
19
22
|
return () => {
|
|
20
23
|
clearTimeout(handler);
|
|
@@ -43,7 +43,7 @@ export const useUnSyncChanges = (): UnSyncChanges => {
|
|
|
43
43
|
customTypes: selectAllCustomTypes(store),
|
|
44
44
|
slices: getFrontendSlices(store),
|
|
45
45
|
libraries: getLibraries(store),
|
|
46
|
-
})
|
|
46
|
+
}),
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
const { modelsStatuses, authStatus, isOnline } = useModelStatus({
|
|
@@ -52,7 +52,7 @@ export const useUnSyncChanges = (): UnSyncChanges => {
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
const localComponents: ComponentUI[] = libraries.flatMap(
|
|
55
|
-
(lib) => lib.components
|
|
55
|
+
(lib) => lib.components,
|
|
56
56
|
);
|
|
57
57
|
|
|
58
58
|
const deletedComponents: ComponentUI[] = slices
|
|
@@ -67,15 +67,15 @@ export const useUnSyncChanges = (): UnSyncChanges => {
|
|
|
67
67
|
(component) =>
|
|
68
68
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
69
69
|
modelsStatuses.slices[component.model.id] &&
|
|
70
|
-
unSyncStatuses.includes(modelsStatuses.slices[component.model.id])
|
|
70
|
+
unSyncStatuses.includes(modelsStatuses.slices[component.model.id]),
|
|
71
71
|
);
|
|
72
72
|
const unSyncedCustomTypes = customTypes.filter(
|
|
73
73
|
(customType) =>
|
|
74
74
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
75
75
|
modelsStatuses.customTypes[getModelId(customType)] &&
|
|
76
76
|
unSyncStatuses.includes(
|
|
77
|
-
modelsStatuses.customTypes[getModelId(customType)]
|
|
78
|
-
)
|
|
77
|
+
modelsStatuses.customTypes[getModelId(customType)],
|
|
78
|
+
),
|
|
79
79
|
);
|
|
80
80
|
|
|
81
81
|
return {
|
|
@@ -41,7 +41,7 @@ import { ToastMessageWithPath } from "@components/ToasterContainer";
|
|
|
41
41
|
export const createCustomTypeCreator = createAsyncAction(
|
|
42
42
|
"CUSTOM_TYPES/CREATE.REQUEST",
|
|
43
43
|
"CUSTOM_TYPES/CREATE.RESPONSE",
|
|
44
|
-
"CUSTOM_TYPES/CREATE.FAILURE"
|
|
44
|
+
"CUSTOM_TYPES/CREATE.FAILURE",
|
|
45
45
|
)<
|
|
46
46
|
{
|
|
47
47
|
id: string;
|
|
@@ -55,7 +55,7 @@ export const createCustomTypeCreator = createAsyncAction(
|
|
|
55
55
|
>();
|
|
56
56
|
|
|
57
57
|
export const renameAvailableCustomType = createAction(
|
|
58
|
-
"CUSTOM_TYPES/RENAME_CUSTOM_TYPE"
|
|
58
|
+
"CUSTOM_TYPES/RENAME_CUSTOM_TYPE",
|
|
59
59
|
)<{
|
|
60
60
|
renamedCustomType: CustomTypeSM;
|
|
61
61
|
}>();
|
|
@@ -63,7 +63,7 @@ export const renameAvailableCustomType = createAction(
|
|
|
63
63
|
export const deleteCustomTypeCreator = createAsyncAction(
|
|
64
64
|
"CUSTOM_TYPES/DELETE.REQUEST",
|
|
65
65
|
"CUSTOM_TYPES/DELETE.RESPONSE",
|
|
66
|
-
"CUSTOM_TYPES/DELETE.FAILURE"
|
|
66
|
+
"CUSTOM_TYPES/DELETE.FAILURE",
|
|
67
67
|
)<
|
|
68
68
|
{
|
|
69
69
|
customTypeId: string;
|
|
@@ -85,15 +85,15 @@ type CustomTypesActions =
|
|
|
85
85
|
|
|
86
86
|
// Selectors
|
|
87
87
|
export const selectAllCustomTypes = (
|
|
88
|
-
store: SliceMachineStoreType
|
|
88
|
+
store: SliceMachineStoreType,
|
|
89
89
|
): LocalOrRemoteCustomType[] => Object.values(store.availableCustomTypes);
|
|
90
90
|
|
|
91
91
|
export const selectAllCustomTypeIds = (
|
|
92
|
-
store: SliceMachineStoreType
|
|
92
|
+
store: SliceMachineStoreType,
|
|
93
93
|
): string[] => Object.keys(store.availableCustomTypes);
|
|
94
94
|
|
|
95
95
|
export const selectAllCustomTypeLabels = (
|
|
96
|
-
store: SliceMachineStoreType
|
|
96
|
+
store: SliceMachineStoreType,
|
|
97
97
|
): string[] => {
|
|
98
98
|
return Object.values(store.availableCustomTypes)
|
|
99
99
|
.flatMap((localOrRemote) => {
|
|
@@ -108,7 +108,7 @@ export const selectAllCustomTypeLabels = (
|
|
|
108
108
|
|
|
109
109
|
export const selectCustomTypeById = (
|
|
110
110
|
store: SliceMachineStoreType,
|
|
111
|
-
id: string
|
|
111
|
+
id: string,
|
|
112
112
|
): LocalOrRemoteCustomType | null => store.availableCustomTypes[id];
|
|
113
113
|
|
|
114
114
|
// Reducer
|
|
@@ -122,7 +122,7 @@ export const availableCustomTypesReducer: Reducer<
|
|
|
122
122
|
case getType(refreshStateCreator): {
|
|
123
123
|
const normalizedNewCustomType = normalizeFrontendCustomTypes(
|
|
124
124
|
action.payload.localCustomTypes,
|
|
125
|
-
action.payload.remoteCustomTypes
|
|
125
|
+
action.payload.remoteCustomTypes,
|
|
126
126
|
);
|
|
127
127
|
|
|
128
128
|
return {
|
|
@@ -131,7 +131,7 @@ export const availableCustomTypesReducer: Reducer<
|
|
|
131
131
|
}
|
|
132
132
|
case getType(createCustomTypeCreator.success): {
|
|
133
133
|
const normalizedNewCustomType = normalizeFrontendCustomType(
|
|
134
|
-
action.payload.newCustomType
|
|
134
|
+
action.payload.newCustomType,
|
|
135
135
|
);
|
|
136
136
|
|
|
137
137
|
return {
|
|
@@ -173,7 +173,7 @@ export const availableCustomTypesReducer: Reducer<
|
|
|
173
173
|
if (hasLocalAndRemote(customType)) {
|
|
174
174
|
const remoteOnlyCustomType: RemoteOnlyCustomType = omit(
|
|
175
175
|
customType,
|
|
176
|
-
"local"
|
|
176
|
+
"local",
|
|
177
177
|
);
|
|
178
178
|
return {
|
|
179
179
|
...state,
|
|
@@ -190,7 +190,7 @@ export const availableCustomTypesReducer: Reducer<
|
|
|
190
190
|
const sliceId = action.payload.sliceId;
|
|
191
191
|
|
|
192
192
|
const customTypesUpdated: AvailableCustomTypesStoreType = Object.entries(
|
|
193
|
-
state
|
|
193
|
+
state,
|
|
194
194
|
)
|
|
195
195
|
.map<[string, LocalOrRemoteCustomType]>(
|
|
196
196
|
([customTypeId, customType]) => {
|
|
@@ -205,7 +205,7 @@ export const availableCustomTypesReducer: Reducer<
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
return [customTypeId, customType];
|
|
208
|
-
}
|
|
208
|
+
},
|
|
209
209
|
)
|
|
210
210
|
.reduce<AvailableCustomTypesStoreType>(
|
|
211
211
|
(acc, [customTypeId, customType]) => {
|
|
@@ -214,7 +214,7 @@ export const availableCustomTypesReducer: Reducer<
|
|
|
214
214
|
[customTypeId]: customType,
|
|
215
215
|
};
|
|
216
216
|
},
|
|
217
|
-
{}
|
|
217
|
+
{},
|
|
218
218
|
);
|
|
219
219
|
|
|
220
220
|
return customTypesUpdated;
|
|
@@ -237,8 +237,8 @@ export function* createCustomTypeSaga({
|
|
|
237
237
|
payload.id,
|
|
238
238
|
payload.label,
|
|
239
239
|
payload.repeatable,
|
|
240
|
-
payload.format
|
|
241
|
-
)
|
|
240
|
+
payload.format,
|
|
241
|
+
),
|
|
242
242
|
);
|
|
243
243
|
yield call(saveCustomType, newCustomType);
|
|
244
244
|
yield put(createCustomTypeCreator.success({ newCustomType }));
|
|
@@ -252,7 +252,7 @@ export function* createCustomTypeSaga({
|
|
|
252
252
|
newPageType: true,
|
|
253
253
|
}
|
|
254
254
|
: undefined,
|
|
255
|
-
})
|
|
255
|
+
}),
|
|
256
256
|
);
|
|
257
257
|
yield put(
|
|
258
258
|
openToasterCreator({
|
|
@@ -264,7 +264,7 @@ export function* createCustomTypeSaga({
|
|
|
264
264
|
path: `./customtypes/${newCustomType.id}/index.json`,
|
|
265
265
|
}),
|
|
266
266
|
type: ToasterType.SUCCESS,
|
|
267
|
-
})
|
|
267
|
+
}),
|
|
268
268
|
);
|
|
269
269
|
} catch (e) {
|
|
270
270
|
yield put(
|
|
@@ -274,7 +274,7 @@ export function* createCustomTypeSaga({
|
|
|
274
274
|
plural: false,
|
|
275
275
|
})} not saved`,
|
|
276
276
|
type: ToasterType.ERROR,
|
|
277
|
-
})
|
|
277
|
+
}),
|
|
278
278
|
);
|
|
279
279
|
}
|
|
280
280
|
}
|
|
@@ -283,7 +283,7 @@ export function* createCustomTypeSaga({
|
|
|
283
283
|
function* handleCustomTypeRequests() {
|
|
284
284
|
yield takeLatest(
|
|
285
285
|
getType(createCustomTypeCreator.request),
|
|
286
|
-
withLoader(createCustomTypeSaga, LoadingKeysEnum.CREATE_CUSTOM_TYPE)
|
|
286
|
+
withLoader(createCustomTypeSaga, LoadingKeysEnum.CREATE_CUSTOM_TYPE),
|
|
287
287
|
);
|
|
288
288
|
}
|
|
289
289
|
|
|
@@ -38,7 +38,7 @@ export const updateManifestCreator = createAction("STATE/UPDATE_MANIFEST")<{
|
|
|
38
38
|
export const getChangelogCreator = createAsyncAction(
|
|
39
39
|
"CHANGELOG.REQUEST",
|
|
40
40
|
"CHANGELOG.RESPONSE",
|
|
41
|
-
"CHANGELOG.FAILURE"
|
|
41
|
+
"CHANGELOG.FAILURE",
|
|
42
42
|
)<
|
|
43
43
|
undefined,
|
|
44
44
|
{
|
|
@@ -55,11 +55,11 @@ type EnvironmentActions = ActionType<
|
|
|
55
55
|
|
|
56
56
|
// Selectors
|
|
57
57
|
export const getEnvironment = (
|
|
58
|
-
store: SliceMachineStoreType
|
|
58
|
+
store: SliceMachineStoreType,
|
|
59
59
|
): FrontEndEnvironment => store.environment;
|
|
60
60
|
|
|
61
61
|
export const selectSimulatorUrl = (
|
|
62
|
-
store: SliceMachineStoreType
|
|
62
|
+
store: SliceMachineStoreType,
|
|
63
63
|
): string | undefined => {
|
|
64
64
|
return store.environment.manifest.localSliceSimulatorURL;
|
|
65
65
|
};
|
|
@@ -74,7 +74,7 @@ export const selectEndpoints = (store: SliceMachineStoreType): APIEndpoints =>
|
|
|
74
74
|
store.environment.endpoints;
|
|
75
75
|
|
|
76
76
|
export const selectIsSimulatorAvailableForFramework = (
|
|
77
|
-
store: SliceMachineStoreType
|
|
77
|
+
store: SliceMachineStoreType,
|
|
78
78
|
): boolean => {
|
|
79
79
|
return store.environment.supportsSliceSimulator;
|
|
80
80
|
};
|
|
@@ -98,7 +98,7 @@ export const getChangelog = (store: SliceMachineStoreType) => {
|
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
export const getPackageManager = (
|
|
101
|
-
store: SliceMachineStoreType
|
|
101
|
+
store: SliceMachineStoreType,
|
|
102
102
|
): PackageManager => {
|
|
103
103
|
return store.environment.packageManager;
|
|
104
104
|
};
|
|
@@ -152,7 +152,7 @@ export function* getChangelogSaga(): Generator<
|
|
|
152
152
|
function* watchChangelog() {
|
|
153
153
|
yield takeLatest(
|
|
154
154
|
getType(getChangelogCreator.request),
|
|
155
|
-
withLoader(getChangelogSaga, LoadingKeysEnum.CHANGELOG)
|
|
155
|
+
withLoader(getChangelogSaga, LoadingKeysEnum.CHANGELOG),
|
|
156
156
|
);
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -29,13 +29,13 @@ type LoadingActions = ActionType<
|
|
|
29
29
|
// Selectors
|
|
30
30
|
export const isLoading = (
|
|
31
31
|
store: SliceMachineStoreType,
|
|
32
|
-
key: LoadingKeysEnum
|
|
32
|
+
key: LoadingKeysEnum,
|
|
33
33
|
): boolean => store.loading[key];
|
|
34
34
|
|
|
35
35
|
// Reducer
|
|
36
36
|
export const loadingReducer: Reducer<LoadingStoreType, LoadingActions> = (
|
|
37
37
|
state = initialState,
|
|
38
|
-
action
|
|
38
|
+
action,
|
|
39
39
|
) => {
|
|
40
40
|
switch (action.type) {
|
|
41
41
|
case getType(startLoadingActionCreator):
|
|
@@ -68,7 +68,7 @@ export const withLoader = (saga: any, loadingKey: LoadingKeysEnum): Saga<any> =>
|
|
|
68
68
|
args[3],
|
|
69
69
|
args[4],
|
|
70
70
|
args[5],
|
|
71
|
-
args[6]
|
|
71
|
+
args[6],
|
|
72
72
|
);
|
|
73
73
|
} finally {
|
|
74
74
|
yield put(stopLoadingActionCreator({ loadingKey }));
|
|
@@ -22,13 +22,13 @@ type ModalActions = ActionType<
|
|
|
22
22
|
// Selectors
|
|
23
23
|
export const isModalOpen = (
|
|
24
24
|
state: SliceMachineStoreType,
|
|
25
|
-
dialog: ModalKeysEnum
|
|
25
|
+
dialog: ModalKeysEnum,
|
|
26
26
|
): boolean => state.modal[dialog];
|
|
27
27
|
|
|
28
28
|
// Reducer
|
|
29
29
|
export const modalReducer: Reducer<ModalStoreType, ModalActions> = (
|
|
30
30
|
state = initialState,
|
|
31
|
-
action
|
|
31
|
+
action,
|
|
32
32
|
) => {
|
|
33
33
|
switch (action.type) {
|
|
34
34
|
case getType(modalCloseCreator):
|
|
@@ -47,7 +47,7 @@ type Limit = NonNullable<
|
|
|
47
47
|
export const changesPushCreator = createAsyncAction(
|
|
48
48
|
"PUSH_CHANGES.REQUEST",
|
|
49
49
|
"PUSH_CHANGES.RESPONSE",
|
|
50
|
-
"PUSH_CHANGES.FAILURE"
|
|
50
|
+
"PUSH_CHANGES.FAILURE",
|
|
51
51
|
)<ChangesPushSagaPayload, undefined, Limit | InvalidCustomTypeResponse>();
|
|
52
52
|
|
|
53
53
|
export const sortDocumentLimits = (limit: Readonly<Limit>) => ({
|
|
@@ -55,7 +55,7 @@ export const sortDocumentLimits = (limit: Readonly<Limit>) => ({
|
|
|
55
55
|
details: {
|
|
56
56
|
...limit.details,
|
|
57
57
|
customTypes: [...limit.details.customTypes].sort(
|
|
58
|
-
(doc1, doc2) => doc2.numberOfDocuments - doc1.numberOfDocuments
|
|
58
|
+
(doc1, doc2) => doc2.numberOfDocuments - doc1.numberOfDocuments,
|
|
59
59
|
),
|
|
60
60
|
},
|
|
61
61
|
});
|
|
@@ -107,7 +107,7 @@ export function* changesPushSaga({
|
|
|
107
107
|
yield put(
|
|
108
108
|
modalOpenCreator({
|
|
109
109
|
modalKey: MODAL_KEY_MAP[response.type],
|
|
110
|
-
})
|
|
110
|
+
}),
|
|
111
111
|
);
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
@@ -123,7 +123,7 @@ export function* changesPushSaga({
|
|
|
123
123
|
libraries: serverState.libraries,
|
|
124
124
|
remoteSlices: serverState.remoteSlices,
|
|
125
125
|
clientError: serverState.clientError,
|
|
126
|
-
})
|
|
126
|
+
}),
|
|
127
127
|
);
|
|
128
128
|
|
|
129
129
|
// Tracking the success of the push
|
|
@@ -137,7 +137,7 @@ export function* changesPushSaga({
|
|
|
137
137
|
openToasterCreator({
|
|
138
138
|
content: "All slices and types have been pushed",
|
|
139
139
|
type: ToasterType.SUCCESS,
|
|
140
|
-
})
|
|
140
|
+
}),
|
|
141
141
|
);
|
|
142
142
|
} catch (error) {
|
|
143
143
|
if (isUnauthenticatedError(error) || isUnauthorizedError(error)) {
|
|
@@ -150,7 +150,7 @@ export function* changesPushSaga({
|
|
|
150
150
|
content:
|
|
151
151
|
"Something went wrong when pushing your changes. Check your terminal logs.",
|
|
152
152
|
type: ToasterType.ERROR,
|
|
153
|
-
})
|
|
153
|
+
}),
|
|
154
154
|
);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
@@ -158,7 +158,7 @@ export function* changesPushSaga({
|
|
|
158
158
|
function* watchChangesPush() {
|
|
159
159
|
yield takeLatest(
|
|
160
160
|
getType(changesPushCreator.request),
|
|
161
|
-
withLoader(changesPushSaga, LoadingKeysEnum.CHANGES_PUSH)
|
|
161
|
+
withLoader(changesPushSaga, LoadingKeysEnum.CHANGES_PUSH),
|
|
162
162
|
);
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -40,7 +40,7 @@ export function trackPushChangesSuccess(params: trackingParameters) {
|
|
|
40
40
|
customTypesCreated: 0,
|
|
41
41
|
customTypesModified: 0,
|
|
42
42
|
customTypesDeleted: 0,
|
|
43
|
-
}
|
|
43
|
+
},
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
const slicesStats = changedSlices.reduce<{
|
|
@@ -70,13 +70,13 @@ export function trackPushChangesSuccess(params: trackingParameters) {
|
|
|
70
70
|
slicesCreated: 0,
|
|
71
71
|
slicesModified: 0,
|
|
72
72
|
slicesDeleted: 0,
|
|
73
|
-
}
|
|
73
|
+
},
|
|
74
74
|
);
|
|
75
75
|
|
|
76
76
|
const total = changedSlices.length + changedCustomTypes.length;
|
|
77
77
|
const missingScreenshots: number = changedSlices.reduce(
|
|
78
78
|
(sum, sliceChange) => sum + countMissingScreenshots(sliceChange.slice),
|
|
79
|
-
0
|
|
79
|
+
0,
|
|
80
80
|
);
|
|
81
81
|
const duration = Date.now() - startTime;
|
|
82
82
|
|
|
@@ -12,7 +12,7 @@ export type SelectedSliceActions =
|
|
|
12
12
|
export const generateSliceScreenshotCreator = createAsyncAction(
|
|
13
13
|
"SLICE/TAKE_SCREENSHOT.REQUEST",
|
|
14
14
|
"SLICE/TAKE_SCREENSHOT.RESPONSE",
|
|
15
|
-
"SLICE/TAKE_SCREENSHOT.FAILURE"
|
|
15
|
+
"SLICE/TAKE_SCREENSHOT.FAILURE",
|
|
16
16
|
)<
|
|
17
17
|
{
|
|
18
18
|
variationId: string;
|
|
@@ -30,7 +30,7 @@ export const generateSliceScreenshotCreator = createAsyncAction(
|
|
|
30
30
|
export const generateSliceCustomScreenshotCreator = createAsyncAction(
|
|
31
31
|
"SLICE/GENERATE_CUSTOM_SCREENSHOT.REQUEST",
|
|
32
32
|
"SLICE/GENERATE_CUSTOM_SCREENSHOT.RESPONSE",
|
|
33
|
-
"SLICE/GENERATE_CUSTOM_SCREENSHOT.FAILURE"
|
|
33
|
+
"SLICE/GENERATE_CUSTOM_SCREENSHOT.FAILURE",
|
|
34
34
|
)<
|
|
35
35
|
{
|
|
36
36
|
variationId: string;
|
|
@@ -39,7 +39,7 @@ export function* generateSliceScreenshotSaga({
|
|
|
39
39
|
openToasterCreator({
|
|
40
40
|
url: response.url,
|
|
41
41
|
type: ToasterType.SCREENSHOT_CAPTURED,
|
|
42
|
-
})
|
|
42
|
+
}),
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
void telemetry.track({
|
|
@@ -55,14 +55,14 @@ export function* generateSliceScreenshotSaga({
|
|
|
55
55
|
url: response.url,
|
|
56
56
|
},
|
|
57
57
|
component,
|
|
58
|
-
})
|
|
58
|
+
}),
|
|
59
59
|
);
|
|
60
60
|
} catch (e) {
|
|
61
61
|
yield put(
|
|
62
62
|
openToasterCreator({
|
|
63
63
|
content: "Internal Error: Screenshot not saved",
|
|
64
64
|
type: ToasterType.ERROR,
|
|
65
|
-
})
|
|
65
|
+
}),
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -97,14 +97,14 @@ export function* generateSliceCustomScreenshotSaga({
|
|
|
97
97
|
url: response.url,
|
|
98
98
|
},
|
|
99
99
|
component,
|
|
100
|
-
})
|
|
100
|
+
}),
|
|
101
101
|
);
|
|
102
102
|
} catch (e) {
|
|
103
103
|
yield put(
|
|
104
104
|
openToasterCreator({
|
|
105
105
|
content: "Internal Error: Custom screenshot not saved",
|
|
106
106
|
type: ToasterType.ERROR,
|
|
107
|
-
})
|
|
107
|
+
}),
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -114,8 +114,8 @@ function* watchGenerateSliceScreenshot() {
|
|
|
114
114
|
getType(generateSliceScreenshotCreator.request),
|
|
115
115
|
withLoader(
|
|
116
116
|
generateSliceScreenshotSaga,
|
|
117
|
-
LoadingKeysEnum.GENERATE_SLICE_SCREENSHOT
|
|
118
|
-
)
|
|
117
|
+
LoadingKeysEnum.GENERATE_SLICE_SCREENSHOT,
|
|
118
|
+
),
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
function* watchGenerateSliceCustomScreenshot() {
|
|
@@ -123,8 +123,8 @@ function* watchGenerateSliceCustomScreenshot() {
|
|
|
123
123
|
getType(generateSliceCustomScreenshotCreator.request),
|
|
124
124
|
withLoader(
|
|
125
125
|
generateSliceCustomScreenshotSaga,
|
|
126
|
-
LoadingKeysEnum.GENERATE_SLICE_CUSTOM_SCREENSHOT
|
|
127
|
-
)
|
|
126
|
+
LoadingKeysEnum.GENERATE_SLICE_CUSTOM_SCREENSHOT,
|
|
127
|
+
),
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -28,14 +28,14 @@ export const initCustomTypeStoreCreator = createAction("CUSTOM_TYPE/INIT")<{
|
|
|
28
28
|
}>();
|
|
29
29
|
|
|
30
30
|
export const cleanupCustomTypeStoreCreator = createAction(
|
|
31
|
-
"CUSTOM_TYPE/CLEANUP"
|
|
31
|
+
"CUSTOM_TYPE/CLEANUP",
|
|
32
32
|
)();
|
|
33
33
|
|
|
34
34
|
// Async actions
|
|
35
35
|
export const saveCustomTypeCreator = createAsyncAction(
|
|
36
36
|
"CUSTOM_TYPE/SAVE.REQUEST",
|
|
37
37
|
"CUSTOM_TYPE/SAVE.RESPONSE",
|
|
38
|
-
"CUSTOM_TYPE/SAVE.FAILURE"
|
|
38
|
+
"CUSTOM_TYPE/SAVE.FAILURE",
|
|
39
39
|
)<undefined, { customType: CustomTypeSM }>();
|
|
40
40
|
|
|
41
41
|
// Tab actions
|
|
@@ -79,13 +79,13 @@ export const reorderFieldCreator = createAction("CUSTOM_TYPE/REORDER_FIELD")<{
|
|
|
79
79
|
|
|
80
80
|
// Slice zone actions
|
|
81
81
|
export const createSliceZoneCreator = createAction(
|
|
82
|
-
"CUSTOM_TYPE/CREATE_SLICE_ZONE"
|
|
82
|
+
"CUSTOM_TYPE/CREATE_SLICE_ZONE",
|
|
83
83
|
)<{
|
|
84
84
|
tabId: string;
|
|
85
85
|
}>();
|
|
86
86
|
|
|
87
87
|
export const deleteSliceZoneCreator = createAction(
|
|
88
|
-
"CUSTOM_TYPE/DELETE_SLICE_ZONE"
|
|
88
|
+
"CUSTOM_TYPE/DELETE_SLICE_ZONE",
|
|
89
89
|
)<{
|
|
90
90
|
tabId: string;
|
|
91
91
|
}>();
|
|
@@ -97,21 +97,21 @@ export type ReplaceSharedSliceCreatorPayload = {
|
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
export const deleteSharedSliceCreator = createAction(
|
|
100
|
-
"CUSTOM_TYPE/DELETE_SHARED_SLICE"
|
|
100
|
+
"CUSTOM_TYPE/DELETE_SHARED_SLICE",
|
|
101
101
|
)<{
|
|
102
102
|
tabId: string;
|
|
103
103
|
sliceId: string;
|
|
104
104
|
}>();
|
|
105
105
|
|
|
106
106
|
export const renameSelectedCustomTypeLabel = createAction(
|
|
107
|
-
"CUSTOM_TYPE/RENAME_CUSTOM_TYPE"
|
|
107
|
+
"CUSTOM_TYPE/RENAME_CUSTOM_TYPE",
|
|
108
108
|
)<{
|
|
109
109
|
newLabel: string;
|
|
110
110
|
}>();
|
|
111
111
|
|
|
112
112
|
// Group actions (can be grouped into the field actions probably)
|
|
113
113
|
export const addFieldIntoGroupCreator = createAction(
|
|
114
|
-
"CUSTOM_TYPE/GROUP/ADD_FIELD"
|
|
114
|
+
"CUSTOM_TYPE/GROUP/ADD_FIELD",
|
|
115
115
|
)<{
|
|
116
116
|
tabId: string;
|
|
117
117
|
groupId: string;
|
|
@@ -120,7 +120,7 @@ export const addFieldIntoGroupCreator = createAction(
|
|
|
120
120
|
}>();
|
|
121
121
|
|
|
122
122
|
export const replaceFieldIntoGroupCreator = createAction(
|
|
123
|
-
"CUSTOM_TYPE/GROUP/REPLACE_FIELD"
|
|
123
|
+
"CUSTOM_TYPE/GROUP/REPLACE_FIELD",
|
|
124
124
|
)<{
|
|
125
125
|
tabId: string;
|
|
126
126
|
groupId: string;
|
|
@@ -130,7 +130,7 @@ export const replaceFieldIntoGroupCreator = createAction(
|
|
|
130
130
|
}>();
|
|
131
131
|
|
|
132
132
|
export const reorderFieldIntoGroupCreator = createAction(
|
|
133
|
-
"CUSTOM_TYPE/GROUP/REORDER_FIELD"
|
|
133
|
+
"CUSTOM_TYPE/GROUP/REORDER_FIELD",
|
|
134
134
|
)<{
|
|
135
135
|
tabId: string;
|
|
136
136
|
groupId: string;
|
|
@@ -139,7 +139,7 @@ export const reorderFieldIntoGroupCreator = createAction(
|
|
|
139
139
|
}>();
|
|
140
140
|
|
|
141
141
|
export const deleteFieldIntoGroupCreator = createAction(
|
|
142
|
-
"CUSTOM_TYPE/GROUP/DELETE_FIELD"
|
|
142
|
+
"CUSTOM_TYPE/GROUP/DELETE_FIELD",
|
|
143
143
|
)<{
|
|
144
144
|
tabId: string;
|
|
145
145
|
groupId: string;
|