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.
Files changed (210) hide show
  1. package/components/Button/index.tsx +2 -2
  2. package/components/Changelog/index.tsx +1 -1
  3. package/components/Changelog/versionDetails/UpdateCommandBox.tsx +1 -1
  4. package/components/ChangesItems/ChangesItems.tsx +2 -2
  5. package/components/CustomTypeTable/changesPage.tsx +1 -1
  6. package/components/DeleteDocumentsDrawer/HardDeleteDocumentsDrawer.tsx +3 -3
  7. package/components/DeleteDocumentsDrawer/ReferencesErrorDrawer.tsx +3 -3
  8. package/components/DeleteDocumentsDrawer/SoftDeleteDocumentsDrawer.tsx +3 -3
  9. package/components/DeleteSliceModal/index.tsx +1 -1
  10. package/components/FormFields/CheckboxControl.jsx +1 -1
  11. package/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx +5 -5
  12. package/components/Forms/CreateSliceModal/CreateSliceModal.tsx +1 -1
  13. package/components/Forms/RenameSliceModal/RenameSliceModal.tsx +1 -1
  14. package/components/Forms/formsValidator.ts +2 -2
  15. package/components/Grid/index.tsx +1 -1
  16. package/components/Li/index.tsx +2 -2
  17. package/components/ListItem/index.tsx +2 -2
  18. package/components/ListItem/utils.js +1 -1
  19. package/components/LoginModal/index.tsx +2 -2
  20. package/components/ModalFormCard/index.tsx +2 -2
  21. package/components/Navigation/VideoItem.tsx +2 -2
  22. package/components/Navigation/index.test.tsx +8 -8
  23. package/components/Navigation/index.tsx +2 -2
  24. package/components/ReviewModal/ReviewForm.tsx +1 -1
  25. package/components/ReviewModal/ReviewModal.tsx +4 -4
  26. package/components/ScreenshotChangesModal/VariationDropZone.tsx +6 -6
  27. package/components/ScreenshotChangesModal/index.tsx +3 -3
  28. package/components/ScreenshotPreviewModal/index.tsx +2 -2
  29. package/components/Simulator/components/Header/index.tsx +1 -1
  30. package/components/Simulator/components/IframeRenderer/index.tsx +2 -2
  31. package/components/Simulator/components/SetupModal/index.tsx +1 -1
  32. package/components/Simulator/components/Toolbar/index.tsx +2 -2
  33. package/components/Simulator/index.tsx +5 -5
  34. package/components/Tooltip/TextWithTooltip.tsx +1 -1
  35. package/lib/builders/CustomTypeBuilder/SliceZone/List.tsx +2 -2
  36. package/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +4 -4
  37. package/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +1 -1
  38. package/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +12 -12
  39. package/lib/builders/CustomTypeBuilder/TabZone/index.tsx +1 -1
  40. package/lib/builders/CustomTypeBuilder/index.tsx +1 -1
  41. package/lib/builders/SliceBuilder/FieldZones/index.tsx +4 -4
  42. package/lib/builders/SliceBuilder/Header/SimulatorButton/index.tsx +1 -1
  43. package/lib/builders/SliceBuilder/Header/VariationsPopover/index.tsx +1 -1
  44. package/lib/builders/SliceBuilder/Header/index.tsx +2 -2
  45. package/lib/builders/SliceBuilder/index.tsx +2 -2
  46. package/lib/builders/common/EditModal/Form.jsx +1 -1
  47. package/lib/builders/common/EditModal/index.jsx +3 -3
  48. package/lib/builders/common/Zone/Card/components/NewField.tsx +7 -7
  49. package/lib/builders/common/Zone/index.jsx +2 -2
  50. package/lib/builders/utils/index.ts +1 -1
  51. package/lib/forms/defaults.ts +3 -3
  52. package/lib/forms/fields.ts +3 -3
  53. package/lib/forms/index.ts +3 -3
  54. package/lib/models/common/ComponentUI.ts +3 -3
  55. package/lib/models/common/CustomType/group.ts +2 -2
  56. package/lib/models/common/CustomType/index.ts +4 -4
  57. package/lib/models/common/CustomType/tab.ts +7 -7
  58. package/lib/models/common/ErrorWithStatus.ts +4 -1
  59. package/lib/models/common/Fields.ts +1 -1
  60. package/lib/models/common/Group.ts +5 -5
  61. package/lib/models/common/Library.ts +1 -1
  62. package/lib/models/common/Manifest.ts +4 -4
  63. package/lib/models/common/ModelData.ts +6 -6
  64. package/lib/models/common/ModelStatus/compareCustomTypeModels.ts +1 -1
  65. package/lib/models/common/ModelStatus/compareSliceModels.ts +4 -4
  66. package/lib/models/common/ModelStatus/index.ts +5 -5
  67. package/lib/models/common/Screenshots.ts +1 -1
  68. package/lib/models/common/Slice.ts +7 -7
  69. package/lib/models/common/Slices.ts +5 -5
  70. package/lib/models/common/UserProfile.ts +1 -1
  71. package/lib/models/common/Variation.ts +6 -6
  72. package/lib/models/common/normalizers/customType.ts +3 -3
  73. package/lib/models/common/normalizers/slices.ts +2 -2
  74. package/lib/models/common/widgets/Boolean/index.ts +2 -2
  75. package/lib/models/common/widgets/ContentRelationship/Form.tsx +2 -2
  76. package/lib/models/common/widgets/ContentRelationship/index.ts +2 -2
  77. package/lib/models/common/widgets/Group/ListItem/index.jsx +3 -3
  78. package/lib/models/common/widgets/Image/Form.tsx +3 -3
  79. package/lib/models/common/widgets/StructuredText/Form.tsx +2 -2
  80. package/lib/models/common/widgets/StructuredText/index.ts +2 -2
  81. package/lib/utils/index.ts +1 -1
  82. package/lib/utils/poll.ts +3 -3
  83. package/lib/utils/shared/customTypes.ts +1 -1
  84. package/next.config.mjs +3 -3
  85. package/out/404.html +1 -1
  86. package/out/_next/static/chunks/125-e3857af2068bbedf.js +11 -0
  87. package/out/_next/static/chunks/pages/{_app-24537d01d860293a.js → _app-b04ec71c46729221.js} +12 -12
  88. package/out/_next/static/{cjz0yUXdEAw1xeqGTjS8s → j0GKKng3reAX2Jcp0Dw_g}/_buildManifest.js +1 -1
  89. package/out/changelog.html +1 -1
  90. package/out/changes.html +1 -1
  91. package/out/custom-types/[customTypeId].html +1 -1
  92. package/out/custom-types.html +1 -1
  93. package/out/index.html +1 -1
  94. package/out/labs.html +1 -1
  95. package/out/page-types/[pageTypeId].html +1 -1
  96. package/out/slices/[lib]/[sliceName]/[variation]/screenshot.html +1 -1
  97. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  98. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  99. package/out/slices.html +1 -1
  100. package/package.json +5 -5
  101. package/pages/_app.tsx +1 -1
  102. package/pages/api/embed.js +1 -1
  103. package/pages/slices.tsx +4 -4
  104. package/src/apiClient.ts +11 -11
  105. package/src/components/BaseHoverCard/BaseHoverCard.test.tsx +1 -1
  106. package/src/components/HoverCard/HoverCard.tsx +1 -1
  107. package/src/components/SideNav/SideNav.tsx +2 -2
  108. package/src/components/Table/Table.test.tsx +1 -1
  109. package/src/components/TextLink/TextLink.tsx +1 -1
  110. package/src/domain/__tests__/CustomTypeModel.test.ts +19 -19
  111. package/src/domain/customType.ts +10 -10
  112. package/src/domain/slice.ts +5 -5
  113. package/src/features/changes/StatusBadge.tsx +1 -1
  114. package/src/features/customTypes/EditDropdown.tsx +1 -1
  115. package/src/features/customTypes/PageTypeOnboarding.tsx +2 -2
  116. package/src/features/customTypes/__tests__/CustomTypeBuilderPage.test.tsx +7 -7
  117. package/src/features/customTypes/__tests__/CustomTypesTablePage.test.tsx +24 -22
  118. package/src/features/customTypes/actions/convertCustomToPageType.ts +3 -3
  119. package/src/features/customTypes/actions/deleteCustomType.ts +1 -1
  120. package/src/features/customTypes/actions/renameCustomType.ts +1 -1
  121. package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +3 -3
  122. package/src/features/customTypes/customTypesConfig.ts +3 -3
  123. package/src/features/customTypes/customTypesTable/CustomTypesTable.tsx +2 -2
  124. package/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +3 -3
  125. package/src/features/customTypes/customTypesTable/createCustomType.ts +2 -2
  126. package/src/features/customTypes/customTypesTable/useCustomTypes.ts +7 -7
  127. package/src/features/labs/labsList/LabsList.tsx +3 -3
  128. package/src/features/labs/labsList/useLab.tsx +1 -1
  129. package/src/features/slices/actions/addSlicesToSliceZone.ts +1 -1
  130. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +2 -2
  131. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +5 -5
  132. package/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx +11 -11
  133. package/src/features/slicesTemplates/useSlicesTemplates.ts +1 -1
  134. package/src/hooks/useCurrentSlice.tsx +2 -2
  135. package/src/hooks/useElementSize.ts +1 -1
  136. package/src/hooks/useModelStatus.ts +13 -10
  137. package/src/hooks/useRouteChange.tsx +1 -1
  138. package/src/hooks/useSMTracker.ts +2 -2
  139. package/src/hooks/useSliceMachineConfig.ts +1 -1
  140. package/src/hooks/useThrottle.ts +10 -7
  141. package/src/hooks/useUnSyncChanges.ts +5 -5
  142. package/src/hooks/useWindowDimensions.ts +1 -1
  143. package/src/modules/availableCustomTypes/index.ts +19 -19
  144. package/src/modules/environment/index.ts +6 -6
  145. package/src/modules/loading/index.ts +3 -3
  146. package/src/modules/modal/index.ts +2 -2
  147. package/src/modules/pushChangesSaga/index.ts +7 -7
  148. package/src/modules/pushChangesSaga/trackPushChangesSuccess.ts +3 -3
  149. package/src/modules/screenshots/actions.ts +2 -2
  150. package/src/modules/screenshots/sagas.ts +9 -9
  151. package/src/modules/selectedCustomType/actions.ts +10 -10
  152. package/src/modules/selectedCustomType/reducer.ts +26 -26
  153. package/src/modules/selectedCustomType/sagas.ts +5 -5
  154. package/src/modules/selectedCustomType/selectors.ts +4 -4
  155. package/src/modules/selectedCustomType/stateHelpers.ts +1 -1
  156. package/src/modules/selectedSlice/actions.ts +4 -4
  157. package/src/modules/selectedSlice/reducer.ts +7 -7
  158. package/src/modules/selectedSlice/sagas.ts +4 -4
  159. package/src/modules/selectedSlice/selectors.ts +5 -5
  160. package/src/modules/simulator/index.ts +20 -17
  161. package/src/modules/slices/index.ts +18 -18
  162. package/src/modules/toaster/index.tsx +3 -3
  163. package/src/modules/toaster/utils.tsx +1 -1
  164. package/src/modules/useSliceMachineActions.ts +43 -41
  165. package/src/modules/userContext/index.ts +9 -9
  166. package/src/redux/store.ts +2 -2
  167. package/src/theme.ts +1 -1
  168. package/src/utils/editor.ts +1 -1
  169. package/src/utils/fieldNameCreator.ts +2 -2
  170. package/test/__setup__.ts +18 -7
  171. package/test/__testutils__/createPrismicAuthLoginResponse.ts +1 -1
  172. package/test/__testutils__/createTestPlugin.ts +1 -1
  173. package/test/__testutils__/createTestProject.ts +3 -3
  174. package/test/__testutils__/index.tsx +1 -1
  175. package/test/__testutils__/mockAWSACLAPI.ts +9 -9
  176. package/test/__testutils__/mockCustomTypesAPI.ts +16 -16
  177. package/test/__testutils__/mockPrismicAuthAPI.ts +3 -3
  178. package/test/__testutils__/mockPrismicUserAPI.ts +4 -4
  179. package/test/__testutils__/readMSWFormData.ts +3 -3
  180. package/test/components/CreateCustomTypeModal.test.tsx +1 -1
  181. package/test/components/LoginModal.test.tsx +2 -2
  182. package/test/lib/builders/EditModal.test.tsx +5 -5
  183. package/test/lib/builders/buildersUtils.test.ts +13 -13
  184. package/test/lib/models/common/CustomType/sliceZone.test.ts +2 -2
  185. package/test/lib/models/common/ModelStatus.test.ts +1 -1
  186. package/test/lib/models/common/widgets/index.test.ts +6 -6
  187. package/test/lib/utils/shared/customTypes.test.ts +1 -1
  188. package/test/pages/custom-types.test.tsx +7 -7
  189. package/test/pages/simulator.test.tsx +5 -5
  190. package/test/pages/slices.test.tsx +4 -4
  191. package/test/src/hooks/useModelStatus.test.ts +2 -3
  192. package/test/src/modules/__fixtures__/sliceUtilsFactory.ts +2 -2
  193. package/test/src/modules/availableCustomTypes/index.test.ts +20 -18
  194. package/test/src/modules/environment.test.ts +2 -2
  195. package/test/src/modules/loading.test.ts +1 -1
  196. package/test/src/modules/modal.test.ts +1 -1
  197. package/test/src/modules/pushChangesSaga.test.ts +10 -10
  198. package/test/src/modules/screenshots/sagas.test.ts +5 -5
  199. package/test/src/modules/selectedCustomType/reducer.test.ts +25 -25
  200. package/test/src/modules/selectedCustomType/sagas.test.ts +3 -3
  201. package/test/src/modules/selectedSlice/__testutils__/getRefreshStateCreatorPayloadData.ts +1 -1
  202. package/test/src/modules/selectedSlice/reducer.test.ts +12 -12
  203. package/test/src/modules/selectedSlice/sagas.test.ts +6 -6
  204. package/test/src/modules/simulator.test.ts +10 -10
  205. package/test/src/modules/slices.test.ts +5 -5
  206. package/test/src/modules/toaster/utils.test.ts +3 -3
  207. package/test/src/normalizers/customType.test.ts +5 -5
  208. package/test/src/utils/fieldNameCreator.test.ts +1 -1
  209. package/out/_next/static/chunks/125-84464edfe25651eb.js +0 -19
  210. /package/out/_next/static/{cjz0yUXdEAw1xeqGTjS8s → j0GKKng3reAX2Jcp0Dw_g}/_ssgManifest.js +0 -0
@@ -120,12 +120,12 @@ export const selectedCustomTypeReducer: Reducer<
120
120
  CurrentWidget.schema.validateSync(field, { stripUnknown: false });
121
121
  return StateHelpers.updateTab(
122
122
  state,
123
- tabId
123
+ tabId,
124
124
  )((tab) => Tab.addWidget(tab, fieldId, field));
125
125
  } catch (err) {
126
126
  console.error(
127
127
  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
128
- `[store/addWidget] Model is invalid for widget "${field.type}".\nFull error: ${err}`
128
+ `[store/addWidget] Model is invalid for widget "${field.type}".\nFull error: ${err}`,
129
129
  );
130
130
  return state;
131
131
  }
@@ -134,7 +134,7 @@ export const selectedCustomTypeReducer: Reducer<
134
134
  const { tabId, fieldId } = action.payload;
135
135
  return StateHelpers.updateTab(
136
136
  state,
137
- tabId
137
+ tabId,
138
138
  )((tab) => Tab.removeWidget(tab, fieldId));
139
139
  }
140
140
  case getType(replaceFieldCreator): {
@@ -152,7 +152,7 @@ export const selectedCustomTypeReducer: Reducer<
152
152
  CurrentWidget.schema.validateSync(value, { stripUnknown: false });
153
153
  return StateHelpers.updateTab(
154
154
  state,
155
- tabId
155
+ tabId,
156
156
  )((tab) => Tab.replaceWidget(tab, previousFieldId, newFieldId, value));
157
157
  } catch (err) {
158
158
  return state;
@@ -162,7 +162,7 @@ export const selectedCustomTypeReducer: Reducer<
162
162
  const { tabId, start, end } = action.payload;
163
163
  return StateHelpers.updateTab(
164
164
  state,
165
- tabId
165
+ tabId,
166
166
  )((tab) => Tab.reorderWidget(tab, start, end));
167
167
  }
168
168
  case getType(createSliceZoneCreator): {
@@ -176,11 +176,11 @@ export const selectedCustomTypeReducer: Reducer<
176
176
  }
177
177
 
178
178
  const existingSliceZones = CustomType.getSliceZones(state.model).filter(
179
- (e) => e
179
+ (e) => e,
180
180
  );
181
181
  return StateHelpers.updateTab(
182
182
  state,
183
- tabId
183
+ tabId,
184
184
  )((tab) => {
185
185
  const i = findAvailableKey(tabIndex, existingSliceZones);
186
186
  return Tab.createSliceZone(tab, `slices${i !== 0 ? i.toString() : ""}`);
@@ -198,7 +198,7 @@ export const selectedCustomTypeReducer: Reducer<
198
198
 
199
199
  return StateHelpers.updateTab(
200
200
  state,
201
- tabId
201
+ tabId,
202
202
  )((tab) => {
203
203
  return Tab.deleteSliceZone(tab);
204
204
  });
@@ -207,26 +207,26 @@ export const selectedCustomTypeReducer: Reducer<
207
207
  const { tabId, sliceId } = action.payload;
208
208
  return StateHelpers.updateTab(
209
209
  state,
210
- tabId
210
+ tabId,
211
211
  )((tab) =>
212
212
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
213
213
  Tab.updateSliceZone(tab)((sliceZone: SlicesSM) =>
214
- SliceZone.removeSharedSlice(sliceZone, sliceId)
215
- )
214
+ SliceZone.removeSharedSlice(sliceZone, sliceId),
215
+ ),
216
216
  );
217
217
  }
218
218
  case getType(addFieldIntoGroupCreator): {
219
219
  const { tabId, groupId, fieldId, field } = action.payload;
220
220
  return StateHelpers.updateTab(
221
221
  state,
222
- tabId
222
+ tabId,
223
223
  )((tab) =>
224
224
  Tab.updateGroup(
225
225
  tab,
226
- groupId
226
+ groupId,
227
227
  )((group: GroupSM) =>
228
- Group.addWidget(group, { key: fieldId, value: field })
229
- )
228
+ Group.addWidget(group, { key: fieldId, value: field }),
229
+ ),
230
230
  );
231
231
  }
232
232
  case getType(replaceFieldIntoGroupCreator): {
@@ -234,38 +234,38 @@ export const selectedCustomTypeReducer: Reducer<
234
234
  action.payload;
235
235
  return StateHelpers.updateTab(
236
236
  state,
237
- tabId
237
+ tabId,
238
238
  )((tab) =>
239
239
  Tab.updateGroup(
240
240
  tab,
241
- groupId
241
+ groupId,
242
242
  )((group: GroupSM) =>
243
- Group.replaceWidget(group, previousFieldId, newFieldId, value)
244
- )
243
+ Group.replaceWidget(group, previousFieldId, newFieldId, value),
244
+ ),
245
245
  );
246
246
  }
247
247
  case getType(deleteFieldIntoGroupCreator): {
248
248
  const { tabId, groupId, fieldId } = action.payload;
249
249
  return StateHelpers.updateTab(
250
250
  state,
251
- tabId
251
+ tabId,
252
252
  )((tab) =>
253
253
  Tab.updateGroup(
254
254
  tab,
255
- groupId
256
- )((group: GroupSM) => Group.deleteWidget(group, fieldId))
255
+ groupId,
256
+ )((group: GroupSM) => Group.deleteWidget(group, fieldId)),
257
257
  );
258
258
  }
259
259
  case getType(reorderFieldIntoGroupCreator): {
260
260
  const { tabId, groupId, start, end } = action.payload;
261
261
  return StateHelpers.updateTab(
262
262
  state,
263
- tabId
263
+ tabId,
264
264
  )((tab) =>
265
265
  Tab.updateGroup(
266
266
  tab,
267
- groupId
268
- )((group: GroupSM) => Group.reorderWidget(group, start, end))
267
+ groupId,
268
+ )((group: GroupSM) => Group.reorderWidget(group, start, end)),
269
269
  );
270
270
  }
271
271
  default:
@@ -275,7 +275,7 @@ export const selectedCustomTypeReducer: Reducer<
275
275
 
276
276
  const findAvailableKey = (
277
277
  startI: number,
278
- existingSliceZones: (SlicesSM | null)[]
278
+ existingSliceZones: (SlicesSM | null)[],
279
279
  ) => {
280
280
  for (let i = startI; i < Infinity; i++) {
281
281
  const key = `slices${i.toString()}`;
@@ -12,7 +12,7 @@ import { CUSTOM_TYPES_MESSAGES } from "@src/features/customTypes/customTypesMess
12
12
  export function* saveCustomTypeSaga() {
13
13
  try {
14
14
  const currentCustomType = (yield select(
15
- selectCurrentCustomType
15
+ selectCurrentCustomType,
16
16
  )) as ReturnType<typeof selectCurrentCustomType>;
17
17
 
18
18
  if (!currentCustomType) {
@@ -21,7 +21,7 @@ export function* saveCustomTypeSaga() {
21
21
 
22
22
  const { errors } = (yield call(
23
23
  saveCustomType,
24
- currentCustomType
24
+ currentCustomType,
25
25
  )) as Awaited<ReturnType<typeof saveCustomType>>;
26
26
  if (errors.length) {
27
27
  throw errors;
@@ -45,7 +45,7 @@ export function* saveCustomTypeSaga() {
45
45
  path: `./customtypes/${currentCustomType.id}/index.json`,
46
46
  }),
47
47
  type: ToasterType.SUCCESS,
48
- })
48
+ }),
49
49
  );
50
50
  } catch (e) {
51
51
  // Unknown errors
@@ -53,7 +53,7 @@ export function* saveCustomTypeSaga() {
53
53
  openToasterCreator({
54
54
  content: "Internal Error: Custom type not saved",
55
55
  type: ToasterType.ERROR,
56
- })
56
+ }),
57
57
  );
58
58
  }
59
59
  }
@@ -62,7 +62,7 @@ export function* saveCustomTypeSaga() {
62
62
  function* watchSaveCustomType() {
63
63
  yield takeLatest(
64
64
  getType(saveCustomTypeCreator.request),
65
- withLoader(saveCustomTypeSaga, LoadingKeysEnum.SAVE_CUSTOM_TYPE)
65
+ withLoader(saveCustomTypeSaga, LoadingKeysEnum.SAVE_CUSTOM_TYPE),
66
66
  );
67
67
  }
68
68
 
@@ -5,21 +5,21 @@ import { CustomTypeSM, TabSM } from "@lib/models/common/CustomType";
5
5
 
6
6
  // Selectors
7
7
  export const selectCurrentCustomType = (
8
- store: SliceMachineStoreType
8
+ store: SliceMachineStoreType,
9
9
  ): CustomTypeSM | null => {
10
10
  if (!store.selectedCustomType) return null;
11
11
  return store.selectedCustomType.model;
12
12
  };
13
13
 
14
14
  export const selectCurrentPoolOfFields = (
15
- store: SliceMachineStoreType
15
+ store: SliceMachineStoreType,
16
16
  ): PoolOfFields => {
17
17
  if (!store.selectedCustomType) return [];
18
18
  return store.selectedCustomType.model.tabs.reduce<PoolOfFields>(
19
19
  (acc: PoolOfFields, curr: TabSM) => {
20
20
  return [...acc, ...curr.value];
21
21
  },
22
- []
22
+ [],
23
23
  );
24
24
  };
25
25
 
@@ -28,6 +28,6 @@ export const isSelectedCustomTypeTouched = (store: SliceMachineStoreType) => {
28
28
 
29
29
  return !equal(
30
30
  store.selectedCustomType.initialModel,
31
- store.selectedCustomType.model
31
+ store.selectedCustomType.model,
32
32
  );
33
33
  };
@@ -22,7 +22,7 @@ const updateTab =
22
22
 
23
23
  const deleteTab = (
24
24
  state: SelectedCustomTypeStoreType,
25
- tabId: string
25
+ tabId: string,
26
26
  ): SelectedCustomTypeStoreType => {
27
27
  if (!state) return state;
28
28
  const tabs = state.model.tabs.filter((v) => v.key !== tabId);
@@ -28,7 +28,7 @@ export type SelectedSliceActions =
28
28
  | ActionType<typeof updateSelectedSliceMocks>;
29
29
 
30
30
  export const updateSelectedSliceMocks = createAction(
31
- "SELECTED_SLICE/UPDATE_MOCKS"
31
+ "SELECTED_SLICE/UPDATE_MOCKS",
32
32
  )<{
33
33
  mocks: SharedSliceContent[];
34
34
  }>();
@@ -65,7 +65,7 @@ export const removeSliceWidgetCreator = createAction("SLICE/REMOVE_WIDGET")<{
65
65
  }>();
66
66
 
67
67
  export const updateSliceWidgetMockCreator = createAction(
68
- "SLICE/UPDATE_WIDGET_MOCK"
68
+ "SLICE/UPDATE_WIDGET_MOCK",
69
69
  )<{
70
70
  variationId: string;
71
71
  widgetArea: WidgetsArea;
@@ -76,7 +76,7 @@ export const updateSliceWidgetMockCreator = createAction(
76
76
  }>();
77
77
 
78
78
  export const deleteSliceWidgetMockCreator = createAction(
79
- "SLICE/DELETE_WIDGET_MOCK"
79
+ "SLICE/DELETE_WIDGET_MOCK",
80
80
  )<{
81
81
  variationId: string;
82
82
  widgetArea: WidgetsArea;
@@ -86,7 +86,7 @@ export const deleteSliceWidgetMockCreator = createAction(
86
86
  export const updateSliceCreator = createAsyncAction(
87
87
  "SLICE/UPDATE.REQUEST",
88
88
  "SLICE/UPDATE.RESPONSE",
89
- "SLICE/UPDATE.FAILURE"
89
+ "SLICE/UPDATE.FAILURE",
90
90
  )<
91
91
  {
92
92
  component: ComponentUI;
@@ -63,14 +63,14 @@ export const selectedSliceReducer: Reducer<
63
63
 
64
64
  return ComponentUI.updateVariation(
65
65
  prevState,
66
- variationId
66
+ variationId,
67
67
  )((v) => Variation.addWidget(v, widgetsArea, key, value));
68
68
  }
69
69
  return prevState;
70
70
  } catch (err) {
71
71
  console.error(
72
72
  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
73
- `[store/addWidget] Model is invalid for widget "${value.type}".\nFull error: ${err}`
73
+ `[store/addWidget] Model is invalid for widget "${value.type}".\nFull error: ${err}`,
74
74
  );
75
75
  return prevState;
76
76
  }
@@ -91,16 +91,16 @@ export const selectedSliceReducer: Reducer<
91
91
 
92
92
  return ComponentUI.updateVariation(
93
93
  prevState,
94
- variationId
94
+ variationId,
95
95
  )((v) =>
96
- Variation.replaceWidget(v, widgetsArea, previousKey, newKey, value)
96
+ Variation.replaceWidget(v, widgetsArea, previousKey, newKey, value),
97
97
  );
98
98
  }
99
99
  return prevState;
100
100
  } catch (err) {
101
101
  console.error(
102
102
  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
103
- `[store/replaceWidget] Model is invalid for widget "${value.type}".\nFull error: ${err}`
103
+ `[store/replaceWidget] Model is invalid for widget "${value.type}".\nFull error: ${err}`,
104
104
  );
105
105
  return prevState;
106
106
  }
@@ -124,7 +124,7 @@ export const selectedSliceReducer: Reducer<
124
124
 
125
125
  return ComponentUI.updateVariation(
126
126
  prevState,
127
- variationId
127
+ variationId,
128
128
  )((v) => Variation.reorderWidget(v, widgetsArea, start, end));
129
129
  }
130
130
  case getType(removeSliceWidgetCreator): {
@@ -133,7 +133,7 @@ export const selectedSliceReducer: Reducer<
133
133
 
134
134
  return ComponentUI.updateVariation(
135
135
  prevState,
136
- variationId
136
+ variationId,
137
137
  )((v) => Variation.deleteWidget(v, widgetsArea, key));
138
138
  }
139
139
  case getType(copyVariationSliceCreator): {
@@ -29,7 +29,7 @@ export function* updateSliceSaga({
29
29
  });
30
30
  const { errors } = (yield call(
31
31
  updateSliceApiClient,
32
- component
32
+ component,
33
33
  )) as SagaReturnType<typeof updateSliceApiClient>;
34
34
  if (errors.length > 0) {
35
35
  return setData({
@@ -55,14 +55,14 @@ export function* updateSliceSaga({
55
55
  })) as SagaReturnType<typeof readSliceMocks>;
56
56
 
57
57
  yield put(
58
- updateSliceCreator.success({ component: { ...component, mocks } })
58
+ updateSliceCreator.success({ component: { ...component, mocks } }),
59
59
  );
60
60
  } catch (e) {
61
61
  yield put(
62
62
  openToasterCreator({
63
63
  content: "Internal Error: Models & mocks not generated",
64
64
  type: ToasterType.ERROR,
65
- })
65
+ }),
66
66
  );
67
67
  }
68
68
  }
@@ -70,7 +70,7 @@ export function* updateSliceSaga({
70
70
  function* watchSaveSlice() {
71
71
  yield takeLatest(
72
72
  getType(updateSliceCreator.request),
73
- withLoader(updateSliceSaga, LoadingKeysEnum.SAVE_SLICE)
73
+ withLoader(updateSliceSaga, LoadingKeysEnum.SAVE_SLICE),
74
74
  );
75
75
  }
76
76
 
@@ -5,7 +5,7 @@ import { getLibraries } from "../slices";
5
5
  export const selectSliceById = (
6
6
  store: SliceMachineStoreType,
7
7
  libraryName: string,
8
- sliceId: string
8
+ sliceId: string,
9
9
  ) => {
10
10
  // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
11
11
  const libraries = getLibraries(store) || [];
@@ -19,7 +19,7 @@ export const selectSliceById = (
19
19
  export const selectCurrentSlice = (
20
20
  store: SliceMachineStoreType,
21
21
  lib: string,
22
- sliceName: string
22
+ sliceName: string,
23
23
  ) => {
24
24
  const openedModel = store.selectedSlice;
25
25
  if (openedModel?.model.name === sliceName) {
@@ -27,7 +27,7 @@ export const selectCurrentSlice = (
27
27
  }
28
28
 
29
29
  const library = getLibraries(store)?.find(
30
- (l) => l.name.replace(/\//g, "--") === lib
30
+ (l) => l.name.replace(/\//g, "--") === lib,
31
31
  );
32
32
  const slice = library?.components.find((c) => c.model.name === sliceName);
33
33
 
@@ -38,7 +38,7 @@ export const selectCurrentSlice = (
38
38
  export const isSelectedSliceTouched = (
39
39
  store: SliceMachineStoreType,
40
40
  lib: string,
41
- sliceId: string
41
+ sliceId: string,
42
42
  ): boolean => {
43
43
  const selectedSlice = store.selectedSlice;
44
44
  const library = getLibraries(store)?.find((l) => l.name === lib);
@@ -48,7 +48,7 @@ export const isSelectedSliceTouched = (
48
48
 
49
49
  const sameVariations = equal(
50
50
  librarySlice.model.variations,
51
- selectedSlice.model.variations
51
+ selectedSlice.model.variations,
52
52
  );
53
53
 
54
54
  return !sameVariations;
@@ -47,7 +47,7 @@ export const initialState: SimulatorStoreType = {
47
47
  export const checkSimulatorSetupCreator = createAsyncAction(
48
48
  "SIMULATOR/CHECK_SETUP.REQUEST",
49
49
  "SIMULATOR/CHECK_SETUP.SUCCESS",
50
- "SIMULATOR/CHECK_SETUP.FAILURE"
50
+ "SIMULATOR/CHECK_SETUP.FAILURE",
51
51
  )<
52
52
  {
53
53
  callback?: () => void;
@@ -65,13 +65,13 @@ export const checkSimulatorSetupCreator = createAsyncAction(
65
65
  export const connectToSimulatorIframeCreator = createAsyncAction(
66
66
  "SIMULATOR/CONNECT_TO_SIMULATOR_IFRAME.REQUEST",
67
67
  "SIMULATOR/CONNECT_TO_SIMULATOR_IFRAME.SUCCESS",
68
- "SIMULATOR/CONNECT_TO_SIMULATOR_IFRAME.FAILURE"
68
+ "SIMULATOR/CONNECT_TO_SIMULATOR_IFRAME.FAILURE",
69
69
  )<undefined, undefined, undefined>();
70
70
 
71
71
  export const saveSliceMockCreator = createAsyncAction(
72
72
  "SIMULATOR/SAVE_MOCK.REQUEST",
73
73
  "SIMULATOR/SAVE_MOCK.SUCCESS",
74
- "SIMULATOR/SAVE_MOCK.FAILURE"
74
+ "SIMULATOR/SAVE_MOCK.FAILURE",
75
75
  )<SaveSliceMockRequest, undefined, undefined>();
76
76
 
77
77
  type SimulatorActions = ActionType<
@@ -88,19 +88,19 @@ type SimulatorActions = ActionType<
88
88
  // Selectors
89
89
 
90
90
  export const selectSetupStatus = (
91
- state: SliceMachineStoreType
91
+ state: SliceMachineStoreType,
92
92
  ): SimulatorStoreType["setupStatus"] => state.simulator.setupStatus;
93
93
 
94
94
  export const selectIsWaitingForIFrameCheck = (
95
- state: SliceMachineStoreType
95
+ state: SliceMachineStoreType,
96
96
  ): boolean => state.simulator.isWaitingForIframeCheck;
97
97
 
98
98
  export const selectIframeStatus = (
99
- state: SliceMachineStoreType
99
+ state: SliceMachineStoreType,
100
100
  ): string | null => state.simulator.iframeStatus;
101
101
 
102
102
  export const selectSetupSteps = (
103
- state: SliceMachineStoreType
103
+ state: SliceMachineStoreType,
104
104
  ): SimulatorStoreType["setupSteps"] => state.simulator.setupSteps;
105
105
 
106
106
  export const selectSavingMock = (state: SliceMachineStoreType): boolean =>
@@ -109,7 +109,7 @@ export const selectSavingMock = (state: SliceMachineStoreType): boolean =>
109
109
  // Reducer
110
110
  export const simulatorReducer: Reducer<SimulatorStoreType, SimulatorActions> = (
111
111
  state = initialState,
112
- action
112
+ action,
113
113
  ) => {
114
114
  switch (action.type) {
115
115
  case getType(connectToSimulatorIframeCreator.request):
@@ -176,7 +176,7 @@ export const simulatorReducer: Reducer<SimulatorStoreType, SimulatorActions> = (
176
176
 
177
177
  // Sagas
178
178
  export function* checkSetupSaga(
179
- action: ReturnType<typeof checkSimulatorSetupCreator.request>
179
+ action: ReturnType<typeof checkSimulatorSetupCreator.request>,
180
180
  ) {
181
181
  try {
182
182
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
@@ -191,7 +191,7 @@ export function* checkSetupSaga(
191
191
  checkSimulatorSetupCreator.success({
192
192
  setupSteps: setupSteps.steps,
193
193
  setupStatus,
194
- })
194
+ }),
195
195
  );
196
196
  yield put(updateManifestCreator({ value: setupStatus.value }));
197
197
  if (action.payload.callback) {
@@ -232,7 +232,7 @@ export function* failCheckSetupSaga({
232
232
  setupSteps,
233
233
  }: { setupSteps?: NonNullable<SimulatorStoreType["setupSteps"]> } = {}) {
234
234
  const isPreviewAvailableForFramework = (yield select(
235
- selectIsSimulatorAvailableForFramework
235
+ selectIsSimulatorAvailableForFramework,
236
236
  )) as ReturnType<typeof selectIsSimulatorAvailableForFramework>;
237
237
 
238
238
  if (!isPreviewAvailableForFramework) {
@@ -243,7 +243,7 @@ export function* failCheckSetupSaga({
243
243
  checkSimulatorSetupCreator.failure({
244
244
  setupSteps,
245
245
  error: new Error(),
246
- })
246
+ }),
247
247
  );
248
248
  yield put(modalOpenCreator({ modalKey: ModalKeysEnum.SIMULATOR_SETUP }));
249
249
  }
@@ -262,7 +262,7 @@ export function* saveSliceMockSaga({
262
262
  openToasterCreator({
263
263
  type: ToasterType.SUCCESS,
264
264
  content: "Saved",
265
- })
265
+ }),
266
266
  );
267
267
  yield put(updateSliceMock(payload));
268
268
 
@@ -273,7 +273,7 @@ export function* saveSliceMockSaga({
273
273
  openToasterCreator({
274
274
  type: ToasterType.ERROR,
275
275
  content: "Error saving content",
276
- })
276
+ }),
277
277
  );
278
278
  yield put(saveSliceMockCreator.failure());
279
279
  }
@@ -283,21 +283,24 @@ export function* saveSliceMockSaga({
283
283
  function* watchCheckSetup() {
284
284
  yield takeLeading(
285
285
  getType(checkSimulatorSetupCreator.request),
286
- withLoader(checkSetupSaga, LoadingKeysEnum.CHECK_SIMULATOR)
286
+ withLoader(checkSetupSaga, LoadingKeysEnum.CHECK_SIMULATOR),
287
287
  );
288
288
  }
289
289
 
290
290
  function* watchIframeCheck() {
291
291
  yield takeLeading(
292
292
  getType(connectToSimulatorIframeCreator.request),
293
- withLoader(connectToSimulatorIframe, LoadingKeysEnum.CHECK_SIMULATOR_IFRAME)
293
+ withLoader(
294
+ connectToSimulatorIframe,
295
+ LoadingKeysEnum.CHECK_SIMULATOR_IFRAME,
296
+ ),
294
297
  );
295
298
  }
296
299
 
297
300
  function* watchSaveSliceMock() {
298
301
  yield takeLatest(
299
302
  getType(saveSliceMockCreator.request),
300
- withLoader(saveSliceMockSaga, LoadingKeysEnum.SIMULATOR_SAVE_MOCK)
303
+ withLoader(saveSliceMockSaga, LoadingKeysEnum.SIMULATOR_SAVE_MOCK),
301
304
  );
302
305
  }
303
306
 
@@ -41,7 +41,7 @@ export const createSlice = createAction("SLICES/CREATE_SLICE")<{
41
41
  export const renameSliceCreator = createAsyncAction(
42
42
  "SLICES/RENAME.REQUEST",
43
43
  "SLICES/RENAME.RESPONSE",
44
- "SLICES/RENAME.FAILURE"
44
+ "SLICES/RENAME.FAILURE",
45
45
  )<
46
46
  {
47
47
  libName: string;
@@ -57,7 +57,7 @@ export const renameSliceCreator = createAsyncAction(
57
57
  export const deleteSliceCreator = createAsyncAction(
58
58
  "SLICES/DELETE.REQUEST",
59
59
  "SLICES/DELETE.RESPONSE",
60
- "SLICES/DELETE.FAILURE"
60
+ "SLICES/DELETE.FAILURE",
61
61
  )<
62
62
  {
63
63
  sliceId: string;
@@ -85,29 +85,29 @@ type SlicesActions =
85
85
 
86
86
  // Selectors
87
87
  export const getLibraries = (
88
- store: SliceMachineStoreType
88
+ store: SliceMachineStoreType,
89
89
  ): ReadonlyArray<LibraryUI> => store.slices.libraries;
90
90
 
91
91
  export const getRemoteSlice = (
92
92
  store: SliceMachineStoreType,
93
- componentId: string
93
+ componentId: string,
94
94
  ): SliceSM | undefined => {
95
95
  return store.slices.remoteSlices.find((rs) => rs.id === componentId);
96
96
  };
97
97
 
98
98
  export const getRemoteSlices = (
99
- store: SliceMachineStoreType
99
+ store: SliceMachineStoreType,
100
100
  ): ReadonlyArray<SliceSM> => store.slices.remoteSlices;
101
101
 
102
102
  export const getFrontendSlices = (
103
- store: SliceMachineStoreType
103
+ store: SliceMachineStoreType,
104
104
  ): LocalOrRemoteSlice[] =>
105
105
  normalizeFrontendSlices(store.slices.libraries, getRemoteSlices(store));
106
106
 
107
107
  // Reducer
108
108
  export const slicesReducer: Reducer<SlicesStoreType | null, SlicesActions> = (
109
109
  state,
110
- action
110
+ action,
111
111
  ) => {
112
112
  if (!state) return null;
113
113
 
@@ -178,7 +178,7 @@ export const slicesReducer: Reducer<SlicesStoreType | null, SlicesActions> = (
178
178
  [variationId]: screenshot,
179
179
  },
180
180
  }
181
- : c
181
+ : c,
182
182
  ),
183
183
  };
184
184
  });
@@ -192,7 +192,7 @@ export const slicesReducer: Reducer<SlicesStoreType | null, SlicesActions> = (
192
192
  return {
193
193
  ...library,
194
194
  components: library.components.filter(
195
- (component) => component.model.id !== sliceId
195
+ (component) => component.model.id !== sliceId,
196
196
  ),
197
197
  };
198
198
  });
@@ -239,11 +239,11 @@ export function* renameSliceSaga({
239
239
  const { libName, sliceId, newSliceName } = payload;
240
240
  try {
241
241
  const slice = (yield select((store: SliceMachineStoreType) =>
242
- selectSliceById(store, libName, sliceId)
242
+ selectSliceById(store, libName, sliceId),
243
243
  )) as ReturnType<typeof selectSliceById>;
244
244
  if (!slice) {
245
245
  throw new Error(
246
- `Slice "${payload.sliceId} in the "${payload.libName}" library not found.`
246
+ `Slice "${payload.sliceId} in the "${payload.libName}" library not found.`,
247
247
  );
248
248
  }
249
249
 
@@ -260,14 +260,14 @@ export function* renameSliceSaga({
260
260
  openToasterCreator({
261
261
  content: "Slice name updated",
262
262
  type: ToasterType.SUCCESS,
263
- })
263
+ }),
264
264
  );
265
265
  } catch (e) {
266
266
  yield put(
267
267
  openToasterCreator({
268
268
  content: "Internal Error: Slice name not saved",
269
269
  type: ToasterType.ERROR,
270
- })
270
+ }),
271
271
  );
272
272
  }
273
273
  }
@@ -275,7 +275,7 @@ export function* renameSliceSaga({
275
275
  function* watchRenameSlice() {
276
276
  yield takeLatest(
277
277
  getType(renameSliceCreator.request),
278
- withLoader(renameSliceSaga, LoadingKeysEnum.RENAME_SLICE)
278
+ withLoader(renameSliceSaga, LoadingKeysEnum.RENAME_SLICE),
279
279
  );
280
280
  }
281
281
 
@@ -287,7 +287,7 @@ export function* deleteSliceSaga({
287
287
  const result = (yield call(
288
288
  deleteSlice,
289
289
  sliceId,
290
- libName
290
+ libName,
291
291
  )) as SagaReturnType<typeof deleteSlice>;
292
292
  if (result.errors.length > 0) {
293
293
  throw result.errors;
@@ -297,14 +297,14 @@ export function* deleteSliceSaga({
297
297
  openToasterCreator({
298
298
  content: `Successfully deleted Slice “${sliceName}”`,
299
299
  type: ToasterType.SUCCESS,
300
- })
300
+ }),
301
301
  );
302
302
  } catch (e) {
303
303
  yield put(
304
304
  openToasterCreator({
305
305
  content: "An unexpected error happened while deleting your slice.",
306
306
  type: ToasterType.ERROR,
307
- })
307
+ }),
308
308
  );
309
309
  }
310
310
  yield put(modalCloseCreator());
@@ -313,7 +313,7 @@ export function* deleteSliceSaga({
313
313
  function* watchDeleteSlice() {
314
314
  yield takeLatest(
315
315
  getType(deleteSliceCreator.request),
316
- withLoader(deleteSliceSaga, LoadingKeysEnum.DELETE_SLICE)
316
+ withLoader(deleteSliceSaga, LoadingKeysEnum.DELETE_SLICE),
317
317
  );
318
318
  }
319
319