slice-machine-ui 1.18.1-dev-next-release.3 → 1.18.1-dev-next-release.5
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/chunks/125-e3857af2068bbedf.js +11 -0
- package/out/_next/static/chunks/pages/{_app-24537d01d860293a.js → _app-b04ec71c46729221.js} +12 -12
- package/out/_next/static/{cjz0yUXdEAw1xeqGTjS8s → j0GKKng3reAX2Jcp0Dw_g}/_buildManifest.js +1 -1
- 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/{cjz0yUXdEAw1xeqGTjS8s → j0GKKng3reAX2Jcp0Dw_g}/_ssgManifest.js +0 -0
|
@@ -43,7 +43,7 @@ export const closeToasterCreator = createAction("TOASTER/CLOSE")<{
|
|
|
43
43
|
|
|
44
44
|
// Sagas
|
|
45
45
|
export function* openToasterSaga(
|
|
46
|
-
action: ReturnType<typeof openToasterCreator
|
|
46
|
+
action: ReturnType<typeof openToasterCreator>,
|
|
47
47
|
) {
|
|
48
48
|
switch (action.payload.type) {
|
|
49
49
|
case ToasterType.SUCCESS:
|
|
@@ -68,13 +68,13 @@ export function* openToasterSaga(
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export function* updateToasterSaga(
|
|
71
|
-
action: ReturnType<typeof updateToasterCreator
|
|
71
|
+
action: ReturnType<typeof updateToasterCreator>,
|
|
72
72
|
) {
|
|
73
73
|
toast.update(action.payload.toasterId, action.payload.options);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
export function* closeToasterSaga(
|
|
77
|
-
action: ReturnType<typeof updateToasterCreator
|
|
77
|
+
action: ReturnType<typeof updateToasterCreator>,
|
|
78
78
|
) {
|
|
79
79
|
toast.dismiss(action.payload.toasterId);
|
|
80
80
|
}
|
|
@@ -112,13 +112,15 @@ const useSliceMachineActions = () => {
|
|
|
112
112
|
dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.DELETE_SLICE }));
|
|
113
113
|
const openDeleteDocumentsDrawer = () =>
|
|
114
114
|
dispatch(
|
|
115
|
-
modalOpenCreator({
|
|
115
|
+
modalOpenCreator({
|
|
116
|
+
modalKey: ModalKeysEnum.SOFT_DELETE_DOCUMENTS_DRAWER,
|
|
117
|
+
}),
|
|
116
118
|
);
|
|
117
119
|
const openDeleteDocumentsDrawerOverLimit = () =>
|
|
118
120
|
dispatch(
|
|
119
121
|
modalOpenCreator({
|
|
120
122
|
modalKey: ModalKeysEnum.HARD_DELETE_DOCUMENTS_DRAWER,
|
|
121
|
-
})
|
|
123
|
+
}),
|
|
122
124
|
);
|
|
123
125
|
const openSimulatorSetupModal = () =>
|
|
124
126
|
dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.SIMULATOR_SETUP }));
|
|
@@ -138,13 +140,13 @@ const useSliceMachineActions = () => {
|
|
|
138
140
|
dispatch(
|
|
139
141
|
skipReviewCreator({
|
|
140
142
|
reviewType,
|
|
141
|
-
})
|
|
143
|
+
}),
|
|
142
144
|
);
|
|
143
145
|
const sendAReview = (reviewType: UserReviewType) =>
|
|
144
146
|
dispatch(
|
|
145
147
|
sendAReviewCreator({
|
|
146
148
|
reviewType,
|
|
147
|
-
})
|
|
149
|
+
}),
|
|
148
150
|
);
|
|
149
151
|
const setUpdatesViewed = (versions: UserContextStoreType["updatesViewed"]) =>
|
|
150
152
|
dispatch(updatesViewedCreator(versions));
|
|
@@ -159,16 +161,16 @@ const useSliceMachineActions = () => {
|
|
|
159
161
|
id: string,
|
|
160
162
|
label: string,
|
|
161
163
|
repeatable: boolean,
|
|
162
|
-
format: CustomTypeFormat
|
|
164
|
+
format: CustomTypeFormat,
|
|
163
165
|
) =>
|
|
164
166
|
dispatch(
|
|
165
|
-
createCustomTypeCreator.request({ id, label, repeatable, format })
|
|
167
|
+
createCustomTypeCreator.request({ id, label, repeatable, format }),
|
|
166
168
|
);
|
|
167
169
|
|
|
168
170
|
// Custom type module
|
|
169
171
|
const initCustomTypeStore = (
|
|
170
172
|
model: CustomTypeSM,
|
|
171
|
-
remoteModel: CustomTypeSM | undefined
|
|
173
|
+
remoteModel: CustomTypeSM | undefined,
|
|
172
174
|
) => dispatch(initCustomTypeStoreCreator({ model, remoteModel }));
|
|
173
175
|
const cleanupCustomTypeStore = () =>
|
|
174
176
|
dispatch(cleanupCustomTypeStoreCreator());
|
|
@@ -183,21 +185,21 @@ const useSliceMachineActions = () => {
|
|
|
183
185
|
dispatch(
|
|
184
186
|
saveCustomTypeCreator.success({
|
|
185
187
|
customType: CustomTypes.toSM(customType),
|
|
186
|
-
})
|
|
188
|
+
}),
|
|
187
189
|
);
|
|
188
190
|
|
|
189
191
|
const deleteCustomTypeSuccess = (id: string) =>
|
|
190
192
|
dispatch(
|
|
191
193
|
deleteCustomTypeCreator.success({
|
|
192
194
|
customTypeId: id,
|
|
193
|
-
})
|
|
195
|
+
}),
|
|
194
196
|
);
|
|
195
197
|
|
|
196
198
|
const renameAvailableCustomTypeSuccess = (customType: CustomType) =>
|
|
197
199
|
dispatch(
|
|
198
200
|
renameAvailableCustomType({
|
|
199
201
|
renamedCustomType: CustomTypes.toSM(customType),
|
|
200
|
-
})
|
|
202
|
+
}),
|
|
201
203
|
);
|
|
202
204
|
|
|
203
205
|
/** End of sucess actions */
|
|
@@ -211,7 +213,7 @@ const useSliceMachineActions = () => {
|
|
|
211
213
|
const addCustomTypeField = (
|
|
212
214
|
tabId: string,
|
|
213
215
|
fieldId: string,
|
|
214
|
-
field: TabField
|
|
216
|
+
field: TabField,
|
|
215
217
|
) => dispatch(addFieldCreator({ tabId, fieldId, field }));
|
|
216
218
|
const deleteCustomTypeField = (tabId: string, fieldId: string) =>
|
|
217
219
|
dispatch(deleteFieldCreator({ tabId, fieldId }));
|
|
@@ -223,10 +225,10 @@ const useSliceMachineActions = () => {
|
|
|
223
225
|
tabId: string,
|
|
224
226
|
previousFieldId: string,
|
|
225
227
|
newFieldId: string,
|
|
226
|
-
value: TabField
|
|
228
|
+
value: TabField,
|
|
227
229
|
) =>
|
|
228
230
|
dispatch(
|
|
229
|
-
replaceFieldCreator({ tabId, previousFieldId, newFieldId, value })
|
|
231
|
+
replaceFieldCreator({ tabId, previousFieldId, newFieldId, value }),
|
|
230
232
|
);
|
|
231
233
|
const createSliceZone = (tabId: string) =>
|
|
232
234
|
dispatch(createSliceZoneCreator({ tabId }));
|
|
@@ -238,25 +240,25 @@ const useSliceMachineActions = () => {
|
|
|
238
240
|
tabId: string,
|
|
239
241
|
groupId: string,
|
|
240
242
|
fieldId: string,
|
|
241
|
-
field: NestableWidget
|
|
243
|
+
field: NestableWidget,
|
|
242
244
|
) => dispatch(addFieldIntoGroupCreator({ tabId, groupId, fieldId, field }));
|
|
243
245
|
const deleteFieldIntoGroup = (
|
|
244
246
|
tabId: string,
|
|
245
247
|
groupId: string,
|
|
246
|
-
fieldId: string
|
|
248
|
+
fieldId: string,
|
|
247
249
|
) => dispatch(deleteFieldIntoGroupCreator({ tabId, groupId, fieldId }));
|
|
248
250
|
const reorderFieldIntoGroup = (
|
|
249
251
|
tabId: string,
|
|
250
252
|
groupId: string,
|
|
251
253
|
start: number,
|
|
252
|
-
end: number
|
|
254
|
+
end: number,
|
|
253
255
|
) => dispatch(reorderFieldIntoGroupCreator({ tabId, groupId, start, end }));
|
|
254
256
|
const replaceFieldIntoGroup = (
|
|
255
257
|
tabId: string,
|
|
256
258
|
groupId: string,
|
|
257
259
|
previousFieldId: string,
|
|
258
260
|
newFieldId: string,
|
|
259
|
-
value: NestableWidget
|
|
261
|
+
value: NestableWidget,
|
|
260
262
|
) =>
|
|
261
263
|
dispatch(
|
|
262
264
|
replaceFieldIntoGroupCreator({
|
|
@@ -265,7 +267,7 @@ const useSliceMachineActions = () => {
|
|
|
265
267
|
previousFieldId,
|
|
266
268
|
newFieldId,
|
|
267
269
|
value,
|
|
268
|
-
})
|
|
270
|
+
}),
|
|
269
271
|
);
|
|
270
272
|
|
|
271
273
|
// Slice module
|
|
@@ -276,7 +278,7 @@ const useSliceMachineActions = () => {
|
|
|
276
278
|
variationId: string,
|
|
277
279
|
widgetsArea: WidgetsArea,
|
|
278
280
|
key: string,
|
|
279
|
-
value: NestableWidget
|
|
281
|
+
value: NestableWidget,
|
|
280
282
|
) => {
|
|
281
283
|
dispatch(addSliceWidgetCreator({ variationId, widgetsArea, key, value }));
|
|
282
284
|
};
|
|
@@ -286,7 +288,7 @@ const useSliceMachineActions = () => {
|
|
|
286
288
|
widgetsArea: WidgetsArea,
|
|
287
289
|
previousKey: string,
|
|
288
290
|
newKey: string,
|
|
289
|
-
value: NestableWidget
|
|
291
|
+
value: NestableWidget,
|
|
290
292
|
) => {
|
|
291
293
|
dispatch(
|
|
292
294
|
replaceSliceWidgetCreator({
|
|
@@ -295,7 +297,7 @@ const useSliceMachineActions = () => {
|
|
|
295
297
|
previousKey,
|
|
296
298
|
newKey,
|
|
297
299
|
value,
|
|
298
|
-
})
|
|
300
|
+
}),
|
|
299
301
|
);
|
|
300
302
|
};
|
|
301
303
|
|
|
@@ -303,7 +305,7 @@ const useSliceMachineActions = () => {
|
|
|
303
305
|
variationId: string,
|
|
304
306
|
widgetsArea: WidgetsArea,
|
|
305
307
|
start: number,
|
|
306
|
-
end: number | undefined
|
|
308
|
+
end: number | undefined,
|
|
307
309
|
) => {
|
|
308
310
|
dispatch(
|
|
309
311
|
reorderSliceWidgetCreator({
|
|
@@ -311,35 +313,35 @@ const useSliceMachineActions = () => {
|
|
|
311
313
|
widgetsArea,
|
|
312
314
|
start,
|
|
313
315
|
end,
|
|
314
|
-
})
|
|
316
|
+
}),
|
|
315
317
|
);
|
|
316
318
|
};
|
|
317
319
|
|
|
318
320
|
const removeSliceWidget = (
|
|
319
321
|
variationId: string,
|
|
320
322
|
widgetsArea: WidgetsArea,
|
|
321
|
-
key: string
|
|
323
|
+
key: string,
|
|
322
324
|
) => {
|
|
323
325
|
dispatch(
|
|
324
326
|
removeSliceWidgetCreator({
|
|
325
327
|
variationId,
|
|
326
328
|
widgetsArea,
|
|
327
329
|
key,
|
|
328
|
-
})
|
|
330
|
+
}),
|
|
329
331
|
);
|
|
330
332
|
};
|
|
331
333
|
|
|
332
334
|
const deleteSliceWidgetMock = (
|
|
333
335
|
variationId: string,
|
|
334
336
|
widgetArea: WidgetsArea,
|
|
335
|
-
newKey: string
|
|
337
|
+
newKey: string,
|
|
336
338
|
) => {
|
|
337
339
|
dispatch(
|
|
338
340
|
deleteSliceWidgetMockCreator({
|
|
339
341
|
variationId,
|
|
340
342
|
widgetArea,
|
|
341
343
|
newKey,
|
|
342
|
-
})
|
|
344
|
+
}),
|
|
343
345
|
);
|
|
344
346
|
};
|
|
345
347
|
|
|
@@ -349,7 +351,7 @@ const useSliceMachineActions = () => {
|
|
|
349
351
|
previousKey: string,
|
|
350
352
|
newKey: string,
|
|
351
353
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
352
|
-
mockValue: any
|
|
354
|
+
mockValue: any,
|
|
353
355
|
) => {
|
|
354
356
|
dispatch(
|
|
355
357
|
updateSliceWidgetMockCreator({
|
|
@@ -359,7 +361,7 @@ const useSliceMachineActions = () => {
|
|
|
359
361
|
newKey,
|
|
360
362
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
361
363
|
mockValue,
|
|
362
|
-
})
|
|
364
|
+
}),
|
|
363
365
|
);
|
|
364
366
|
};
|
|
365
367
|
|
|
@@ -367,7 +369,7 @@ const useSliceMachineActions = () => {
|
|
|
367
369
|
variationId: string,
|
|
368
370
|
component: ComponentUI,
|
|
369
371
|
screenDimensions: ScreenDimensions,
|
|
370
|
-
method: ScreenshotGenerationMethod
|
|
372
|
+
method: ScreenshotGenerationMethod,
|
|
371
373
|
) => {
|
|
372
374
|
dispatch(
|
|
373
375
|
generateSliceScreenshotCreator.request({
|
|
@@ -375,7 +377,7 @@ const useSliceMachineActions = () => {
|
|
|
375
377
|
component,
|
|
376
378
|
screenDimensions,
|
|
377
379
|
method,
|
|
378
|
-
})
|
|
380
|
+
}),
|
|
379
381
|
);
|
|
380
382
|
};
|
|
381
383
|
|
|
@@ -383,7 +385,7 @@ const useSliceMachineActions = () => {
|
|
|
383
385
|
variationId: string,
|
|
384
386
|
component: ComponentUI,
|
|
385
387
|
file: Blob,
|
|
386
|
-
method: ScreenshotGenerationMethod
|
|
388
|
+
method: ScreenshotGenerationMethod,
|
|
387
389
|
) => {
|
|
388
390
|
dispatch(
|
|
389
391
|
generateSliceCustomScreenshotCreator.request({
|
|
@@ -391,27 +393,27 @@ const useSliceMachineActions = () => {
|
|
|
391
393
|
component,
|
|
392
394
|
file,
|
|
393
395
|
method,
|
|
394
|
-
})
|
|
396
|
+
}),
|
|
395
397
|
);
|
|
396
398
|
};
|
|
397
399
|
|
|
398
400
|
const updateSlice = (
|
|
399
401
|
component: ComponentUI,
|
|
400
402
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
401
|
-
setData: (data: any) => void
|
|
403
|
+
setData: (data: any) => void,
|
|
402
404
|
) => {
|
|
403
405
|
dispatch(
|
|
404
406
|
updateSliceCreator.request({
|
|
405
407
|
component,
|
|
406
408
|
setData,
|
|
407
|
-
})
|
|
409
|
+
}),
|
|
408
410
|
);
|
|
409
411
|
};
|
|
410
412
|
|
|
411
413
|
const copyVariationSlice = (
|
|
412
414
|
key: string,
|
|
413
415
|
name: string,
|
|
414
|
-
copied: VariationSM
|
|
416
|
+
copied: VariationSM,
|
|
415
417
|
) => {
|
|
416
418
|
dispatch(copyVariationSliceCreator({ key, name, copied }));
|
|
417
419
|
};
|
|
@@ -422,14 +424,14 @@ const useSliceMachineActions = () => {
|
|
|
422
424
|
const renameSlice = (
|
|
423
425
|
libName: string,
|
|
424
426
|
sliceId: string,
|
|
425
|
-
newSliceName: string
|
|
427
|
+
newSliceName: string,
|
|
426
428
|
) =>
|
|
427
429
|
dispatch(
|
|
428
430
|
renameSliceCreator.request({
|
|
429
431
|
sliceId,
|
|
430
432
|
newSliceName,
|
|
431
433
|
libName,
|
|
432
|
-
})
|
|
434
|
+
}),
|
|
433
435
|
);
|
|
434
436
|
|
|
435
437
|
const deleteSlice = (sliceId: string, sliceName: string, libName: string) =>
|
|
@@ -438,7 +440,7 @@ const useSliceMachineActions = () => {
|
|
|
438
440
|
sliceId,
|
|
439
441
|
sliceName,
|
|
440
442
|
libName,
|
|
441
|
-
})
|
|
443
|
+
}),
|
|
442
444
|
);
|
|
443
445
|
|
|
444
446
|
const pushChanges = (payload: ChangesPushSagaPayload) =>
|
|
@@ -447,7 +449,7 @@ const useSliceMachineActions = () => {
|
|
|
447
449
|
// Toaster store
|
|
448
450
|
const openToaster = (
|
|
449
451
|
content: string | React.ReactNode,
|
|
450
|
-
type: GenericToastTypes
|
|
452
|
+
type: GenericToastTypes,
|
|
451
453
|
) => dispatch(openToasterCreator({ content, type }));
|
|
452
454
|
|
|
453
455
|
// Simulator
|
|
@@ -464,7 +466,7 @@ const useSliceMachineActions = () => {
|
|
|
464
466
|
libraries: serverState.libraries,
|
|
465
467
|
remoteSlices: serverState.remoteSlices,
|
|
466
468
|
clientError: serverState.clientError,
|
|
467
|
-
})
|
|
469
|
+
}),
|
|
468
470
|
);
|
|
469
471
|
};
|
|
470
472
|
|
|
@@ -43,15 +43,15 @@ export const updatesViewedCreator = createAction("USER_CONTEXT/VIEWED_UPDATES")<
|
|
|
43
43
|
>();
|
|
44
44
|
|
|
45
45
|
export const hasSeenTutorialsToolTipCreator = createAction(
|
|
46
|
-
"USER_CONTEXT/VIEW_TUTORIALS_TOOL_TIP"
|
|
46
|
+
"USER_CONTEXT/VIEW_TUTORIALS_TOOL_TIP",
|
|
47
47
|
)();
|
|
48
48
|
|
|
49
49
|
export const hasSeenSimulatorToolTipCreator = createAction(
|
|
50
|
-
"USER_CONTEXT/VIEW_SIMULATOR_TOOL_TIP"
|
|
50
|
+
"USER_CONTEXT/VIEW_SIMULATOR_TOOL_TIP",
|
|
51
51
|
)();
|
|
52
52
|
|
|
53
53
|
export const hasSeenChangesToolTipCreator = createAction(
|
|
54
|
-
"USER_CONTEXT/VIEW_CHANGES_TOOL_TIP"
|
|
54
|
+
"USER_CONTEXT/VIEW_CHANGES_TOOL_TIP",
|
|
55
55
|
)();
|
|
56
56
|
|
|
57
57
|
type userContextActions = ActionType<
|
|
@@ -73,23 +73,23 @@ export const getUserReview = (state: SliceMachineStoreType): UserReviewState =>
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
export const getUpdatesViewed = (
|
|
76
|
-
state: SliceMachineStoreType
|
|
76
|
+
state: SliceMachineStoreType,
|
|
77
77
|
): UserContextStoreType["updatesViewed"] => state.userContext.updatesViewed;
|
|
78
78
|
|
|
79
79
|
export const userHasSeenTutorialsToolTip = (
|
|
80
|
-
state: SliceMachineStoreType
|
|
80
|
+
state: SliceMachineStoreType,
|
|
81
81
|
): boolean => state.userContext.hasSeenTutorialsToolTip || false;
|
|
82
82
|
|
|
83
83
|
export const userHasSeenSimulatorToolTip = (
|
|
84
|
-
state: SliceMachineStoreType
|
|
84
|
+
state: SliceMachineStoreType,
|
|
85
85
|
): boolean => state.userContext.hasSeenSimulatorToolTip || false;
|
|
86
86
|
|
|
87
87
|
export const userHasSeenChangesToolTip = (
|
|
88
|
-
state: SliceMachineStoreType
|
|
88
|
+
state: SliceMachineStoreType,
|
|
89
89
|
): boolean => state.userContext.hasSeenChangesToolTip || false;
|
|
90
90
|
|
|
91
91
|
export const getLastSyncChange = (
|
|
92
|
-
state: SliceMachineStoreType
|
|
92
|
+
state: SliceMachineStoreType,
|
|
93
93
|
): number | null => state.userContext.lastSyncChange;
|
|
94
94
|
|
|
95
95
|
// Reducer
|
|
@@ -150,7 +150,7 @@ export const userContextReducer: Reducer<
|
|
|
150
150
|
};
|
|
151
151
|
|
|
152
152
|
const getAuthStatus = (
|
|
153
|
-
clientError: ErrorWithStatus | undefined
|
|
153
|
+
clientError: ErrorWithStatus | undefined,
|
|
154
154
|
): AuthStatus => {
|
|
155
155
|
switch (clientError?.status) {
|
|
156
156
|
case undefined: {
|
package/src/redux/store.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare const window: {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export default function configureStore(
|
|
26
|
-
preloadedState: Partial<SliceMachineStoreType> = {}
|
|
26
|
+
preloadedState: Partial<SliceMachineStoreType> = {},
|
|
27
27
|
): { store: Store<SliceMachineStoreType>; persistor: Persistor } {
|
|
28
28
|
const middlewares = [sagaMiddleware, routerMiddleware];
|
|
29
29
|
const enhancers = [applyMiddleware(...middlewares)];
|
|
@@ -48,7 +48,7 @@ export default function configureStore(
|
|
|
48
48
|
persistedReducer,
|
|
49
49
|
preloadedState,
|
|
50
50
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
51
|
-
composeEnhancers(...enhancers)
|
|
51
|
+
composeEnhancers(...enhancers),
|
|
52
52
|
);
|
|
53
53
|
const persistor = persistStore(store);
|
|
54
54
|
sagaMiddleware.run(rootSaga);
|
package/src/theme.ts
CHANGED
package/src/utils/editor.ts
CHANGED
|
@@ -3,7 +3,7 @@ export const createFriendlyFieldNameWithId = (fieldId: string): string => {
|
|
|
3
3
|
/[\s\-_]+(\w)/g,
|
|
4
4
|
function (_match: string, p1: string) {
|
|
5
5
|
return p1.toUpperCase();
|
|
6
|
-
}
|
|
6
|
+
},
|
|
7
7
|
);
|
|
8
8
|
|
|
9
9
|
return fieldIdWithoutSpecialCharacter
|
|
@@ -15,7 +15,7 @@ export const createFriendlyFieldNameWithId = (fieldId: string): string => {
|
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
16
16
|
if (p1) return p1.toUpperCase();
|
|
17
17
|
return match;
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
19
|
)
|
|
20
20
|
.trim();
|
|
21
21
|
};
|
package/test/__setup__.ts
CHANGED
|
@@ -46,7 +46,7 @@ beforeEach(async (ctx) => {
|
|
|
46
46
|
createSliceMachineManagerMSWHandler({
|
|
47
47
|
url: "http://localhost:3000/_manager",
|
|
48
48
|
sliceMachineManager: manager,
|
|
49
|
-
})
|
|
49
|
+
}),
|
|
50
50
|
);
|
|
51
51
|
|
|
52
52
|
await fs.mkdir(os.homedir(), { recursive: true });
|
|
@@ -84,6 +84,17 @@ vi.mock("fs/promises", async () => {
|
|
|
84
84
|
};
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
+
// jsdom environment removes Node native modules which is desired.
|
|
88
|
+
// However, because we create a plugin before each tests and that
|
|
89
|
+
// they rely on Prettier, which relies on `node:url`, we need to
|
|
90
|
+
// bypass jsdom restricted browser environment by mocking `node:url`
|
|
91
|
+
// to itself.
|
|
92
|
+
vi.mock("url", async () => {
|
|
93
|
+
const actual: typeof import("node:url") = await vi.importActual("node:url");
|
|
94
|
+
|
|
95
|
+
return actual;
|
|
96
|
+
});
|
|
97
|
+
|
|
87
98
|
vi.mock("analytics-node", () => {
|
|
88
99
|
const MockSegmentClient = vi.fn();
|
|
89
100
|
|
|
@@ -93,7 +104,7 @@ vi.mock("analytics-node", () => {
|
|
|
93
104
|
if (callback) {
|
|
94
105
|
callback();
|
|
95
106
|
}
|
|
96
|
-
}
|
|
107
|
+
},
|
|
97
108
|
);
|
|
98
109
|
|
|
99
110
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
@@ -102,7 +113,7 @@ vi.mock("analytics-node", () => {
|
|
|
102
113
|
if (callback) {
|
|
103
114
|
callback();
|
|
104
115
|
}
|
|
105
|
-
}
|
|
116
|
+
},
|
|
106
117
|
);
|
|
107
118
|
|
|
108
119
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
@@ -111,7 +122,7 @@ vi.mock("analytics-node", () => {
|
|
|
111
122
|
if (callback) {
|
|
112
123
|
callback();
|
|
113
124
|
}
|
|
114
|
-
}
|
|
125
|
+
},
|
|
115
126
|
);
|
|
116
127
|
|
|
117
128
|
return {
|
|
@@ -148,7 +159,7 @@ vi.stubGlobal(
|
|
|
148
159
|
}
|
|
149
160
|
} else {
|
|
150
161
|
throw new Error(
|
|
151
|
-
"`fetch` with RequestInfo is not supported in this test environment."
|
|
162
|
+
"`fetch` with RequestInfo is not supported in this test environment.",
|
|
152
163
|
);
|
|
153
164
|
}
|
|
154
165
|
|
|
@@ -174,7 +185,7 @@ vi.stubGlobal(
|
|
|
174
185
|
} else {
|
|
175
186
|
return res;
|
|
176
187
|
}
|
|
177
|
-
})
|
|
188
|
+
}),
|
|
178
189
|
);
|
|
179
190
|
|
|
180
191
|
vi.stubGlobal(
|
|
@@ -185,5 +196,5 @@ vi.stubGlobal(
|
|
|
185
196
|
observe: vi.fn(),
|
|
186
197
|
unobserve: vi.fn(),
|
|
187
198
|
};
|
|
188
|
-
})
|
|
199
|
+
}),
|
|
189
200
|
);
|
|
@@ -4,7 +4,7 @@ type PrismicAuthLoginResponse = {
|
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
export const createPrismicAuthLoginResponse = (
|
|
7
|
-
loginResponse?: Partial<PrismicAuthLoginResponse
|
|
7
|
+
loginResponse?: Partial<PrismicAuthLoginResponse>,
|
|
8
8
|
): PrismicAuthLoginResponse => {
|
|
9
9
|
return {
|
|
10
10
|
email: `name@example.com`,
|
|
@@ -39,7 +39,7 @@ type CreateTestPluginArgs<TPluginOptions extends SliceMachinePluginOptions> =
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export const createTestPlugin = <
|
|
42
|
-
TPluginOptions extends SliceMachinePluginOptions
|
|
42
|
+
TPluginOptions extends SliceMachinePluginOptions,
|
|
43
43
|
>({
|
|
44
44
|
setup,
|
|
45
45
|
__autofillRequiredAdapterHooks = true,
|
|
@@ -17,7 +17,7 @@ export const createTestProject = async (
|
|
|
17
17
|
> & {
|
|
18
18
|
adapter?: string | SliceMachinePlugin;
|
|
19
19
|
plugins?: (string | SliceMachinePlugin)[];
|
|
20
|
-
} = {}
|
|
20
|
+
} = {},
|
|
21
21
|
): Promise<string> => {
|
|
22
22
|
const state = expect.getState();
|
|
23
23
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -26,7 +26,7 @@ export const createTestProject = async (
|
|
|
26
26
|
await fs.mkdir(os.tmpdir(), { recursive: true });
|
|
27
27
|
|
|
28
28
|
const root = await fs.mkdtemp(
|
|
29
|
-
path.join(os.tmpdir(), `project-${testNameDigest}-`)
|
|
29
|
+
path.join(os.tmpdir(), `project-${testNameDigest}-`),
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
await fs.writeFile(path.join(root, "package.json"), JSON.stringify({}));
|
|
@@ -47,7 +47,7 @@ export const createTestProject = async (
|
|
|
47
47
|
...sliceMachineConfig,
|
|
48
48
|
adapter: adapterName,
|
|
49
49
|
plugins,
|
|
50
|
-
})
|
|
50
|
+
}),
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
return root;
|
|
@@ -26,7 +26,7 @@ function render(
|
|
|
26
26
|
preloadedState,
|
|
27
27
|
store = configureStore(preloadedState).store,
|
|
28
28
|
...renderOptions
|
|
29
|
-
}: RenderArgs = {}
|
|
29
|
+
}: RenderArgs = {},
|
|
30
30
|
): RenderReturnType {
|
|
31
31
|
if (!document.getElementById("__next")) {
|
|
32
32
|
const div = document.createElement("div");
|
|
@@ -40,7 +40,7 @@ type MockAWSACLAPIReturnType = {
|
|
|
40
40
|
|
|
41
41
|
export const mockAWSACLAPI = (
|
|
42
42
|
ctx: TestContext,
|
|
43
|
-
config?: MockAWSACLAPIConfig
|
|
43
|
+
config?: MockAWSACLAPIConfig,
|
|
44
44
|
): MockAWSACLAPIReturnType => {
|
|
45
45
|
const endpoint =
|
|
46
46
|
config?.endpoint ??
|
|
@@ -74,16 +74,16 @@ export const mockAWSACLAPI = (
|
|
|
74
74
|
fields: s3ACL.requiredFormDataFields,
|
|
75
75
|
},
|
|
76
76
|
imgixEndpoint: s3ACL.imgixEndpoint,
|
|
77
|
-
})
|
|
77
|
+
}),
|
|
78
78
|
);
|
|
79
79
|
} else {
|
|
80
80
|
return res(
|
|
81
81
|
ctx.json({
|
|
82
82
|
message: "[MOCK ERROR MESSAGE]: Failed to generate ACL",
|
|
83
|
-
})
|
|
83
|
+
}),
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
|
-
})
|
|
86
|
+
}),
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -110,7 +110,7 @@ export const mockAWSACLAPI = (
|
|
|
110
110
|
Buffer.isBuffer(formData.file.data) &&
|
|
111
111
|
formData.file.data.equals(expectedUpload.file)
|
|
112
112
|
);
|
|
113
|
-
}
|
|
113
|
+
},
|
|
114
114
|
);
|
|
115
115
|
|
|
116
116
|
if (!expectedFileMetadata) {
|
|
@@ -130,7 +130,7 @@ export const mockAWSACLAPI = (
|
|
|
130
130
|
formData[key].data ===
|
|
131
131
|
uploadEndpointConfig.requiredFormDataFields[key]
|
|
132
132
|
);
|
|
133
|
-
}
|
|
133
|
+
},
|
|
134
134
|
) &&
|
|
135
135
|
Buffer.isBuffer(formData.file.data) &&
|
|
136
136
|
formData.file.data.equals(expectedFileMetadata.file)
|
|
@@ -139,7 +139,7 @@ export const mockAWSACLAPI = (
|
|
|
139
139
|
} else {
|
|
140
140
|
return res(ctx.status(401));
|
|
141
141
|
}
|
|
142
|
-
})
|
|
142
|
+
}),
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -156,8 +156,8 @@ export const mockAWSACLAPI = (
|
|
|
156
156
|
} else {
|
|
157
157
|
return res(ctx.status(401));
|
|
158
158
|
}
|
|
159
|
-
}
|
|
160
|
-
)
|
|
159
|
+
},
|
|
160
|
+
),
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
163
|
|