slice-machine-ui 1.18.1-dev-next-release.3 → 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.
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/{cjz0yUXdEAw1xeqGTjS8s → HGF5llOreY_Hv9IuGfW25}/_buildManifest.js +1 -1
  87. package/out/_next/static/chunks/125-e3857af2068bbedf.js +11 -0
  88. package/out/_next/static/chunks/pages/{_app-24537d01d860293a.js → _app-925e9450acf20963.js} +12 -12
  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 → HGF5llOreY_Hv9IuGfW25}/_ssgManifest.js +0 -0
@@ -21,7 +21,7 @@ export const TextWithTooltip: React.FC<TextWithTooltipProps> = ({
21
21
  const updateTooltipVisibility = () => {
22
22
  setShowTooltip(
23
23
  headingRef.current &&
24
- headingRef.current.offsetWidth < headingRef.current.scrollWidth
24
+ headingRef.current.offsetWidth < headingRef.current.scrollWidth,
25
25
  );
26
26
  };
27
27
 
@@ -46,14 +46,14 @@ export const SlicesList: React.FC<SlicesListProps> = ({
46
46
  start: false,
47
47
  plural: false,
48
48
  })} contains legacy slices that can be upgraded.`,
49
- ToasterType.INFO
49
+ ToasterType.INFO,
50
50
  )
51
51
  : openToaster(
52
52
  `This ${customTypesMessages.name({
53
53
  start: false,
54
54
  plural: false,
55
55
  })} contains slices that are incompatible.`,
56
- ToasterType.WARNING
56
+ ToasterType.WARNING,
57
57
  );
58
58
  // eslint-disable-next-line react-hooks/exhaustive-deps
59
59
  }, [hasLegacySlices]);
@@ -65,8 +65,8 @@ export const SlicesTemplatesModal: FC<UpdateSliceModalProps> = ({
65
65
  return slice.model;
66
66
  })
67
67
  .filter(
68
- (slice) => slice !== undefined
69
- ) as Promise<SharedSlice>[]
68
+ (slice) => slice !== undefined,
69
+ ) as Promise<SharedSlice>[],
70
70
  );
71
71
 
72
72
  await onSuccess(slices);
@@ -112,9 +112,9 @@ export const SlicesTemplatesModal: FC<UpdateSliceModalProps> = ({
112
112
  url: curr[1],
113
113
  },
114
114
  }),
115
- {}
115
+ {},
116
116
  ),
117
- })
117
+ }),
118
118
  ),
119
119
  ...sliceTemplatesComingSoon,
120
120
  ]}
@@ -34,7 +34,7 @@ const UpdateSliceZoneModal: React.FC<UpdateSliceModalProps> = ({
34
34
  const slices = sliceKeys
35
35
  .map(
36
36
  (sliceKey) =>
37
- availableSlices.find((s) => s.model.id === sliceKey)?.model
37
+ availableSlices.find((s) => s.model.id === sliceKey)?.model,
38
38
  )
39
39
  .filter((slice) => slice !== undefined) as SharedSlice[];
40
40
  void onSubmit(slices);
@@ -42,14 +42,14 @@ import { SlicesList } from "./List";
42
42
 
43
43
  const mapAvailableAndSharedSlices = (
44
44
  sliceZone: SlicesSM,
45
- libraries: ReadonlyArray<LibraryUI> | null
45
+ libraries: ReadonlyArray<LibraryUI> | null,
46
46
  ) => {
47
47
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
48
48
  const availableSlices = (libraries || []).reduce<ReadonlyArray<ComponentUI>>(
49
49
  (acc, curr: LibraryUI) => {
50
50
  return [...acc, ...curr.components];
51
51
  },
52
- []
52
+ [],
53
53
  );
54
54
  const { slicesInSliceZone, notFound } = sliceZone.value.reduce<{
55
55
  slicesInSliceZone: ReadonlyArray<SliceZoneSlice>;
@@ -59,7 +59,7 @@ const mapAvailableAndSharedSlices = (
59
59
  // Shared Slice
60
60
  if (value.type === "SharedSlice") {
61
61
  const maybeSliceState: ComponentUI | undefined = availableSlices.find(
62
- (slice) => slice.model.id === key
62
+ (slice) => slice.model.id === key,
63
63
  );
64
64
 
65
65
  if (maybeSliceState) {
@@ -84,7 +84,7 @@ const mapAvailableAndSharedSlices = (
84
84
  ],
85
85
  };
86
86
  },
87
- { slicesInSliceZone: [], notFound: [] }
87
+ { slicesInSliceZone: [], notFound: [] },
88
88
  );
89
89
 
90
90
  return { availableSlices, slicesInSliceZone, notFound };
@@ -119,19 +119,19 @@ const SliceZone: React.FC<SliceZoneProps> = ({
119
119
  remoteSlices: getRemoteSlices(store),
120
120
  libraries: getLibraries(store),
121
121
  slices: getFrontendSlices(store),
122
- })
122
+ }),
123
123
  );
124
124
  const { initCustomTypeStore, saveCustomTypeSuccess } =
125
125
  useSliceMachineActions();
126
126
  const localLibraries: readonly LibraryUI[] = libraries.filter(
127
- (library) => library.isLocal
127
+ (library) => library.isLocal,
128
128
  );
129
129
  const { availableSlices, slicesInSliceZone, notFound } = useMemo(
130
130
  () =>
131
131
  sliceZone
132
132
  ? mapAvailableAndSharedSlices(sliceZone, libraries)
133
133
  : { availableSlices: [], slicesInSliceZone: [], notFound: [] },
134
- [sliceZone, libraries]
134
+ [sliceZone, libraries],
135
135
  );
136
136
  const [isDeleteSliceZoneModalOpen, setIsDeleteSliceZoneModalOpen] =
137
137
  useState(false);
@@ -153,8 +153,8 @@ const SliceZone: React.FC<SliceZoneProps> = ({
153
153
  const availableSlicesToAdd = availableSlices.filter(
154
154
  (slice) =>
155
155
  !sharedSlicesInSliceZone.some(
156
- (sharedSlice) => sharedSlice.model.id === slice.model.id
157
- )
156
+ (sharedSlice) => sharedSlice.model.id === slice.model.id,
157
+ ),
158
158
  );
159
159
 
160
160
  const openUpdateSliceZoneModal = () => {
@@ -180,7 +180,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
180
180
  void replace(
181
181
  { pathname, query: { pageTypeId: query.pageTypeId } },
182
182
  undefined,
183
- { shallow: true }
183
+ { shallow: true },
184
184
  );
185
185
  }
186
186
  };
@@ -330,7 +330,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
330
330
  <ToastMessageWithPath
331
331
  message="Slice template(s) added to slice zone and created at: "
332
332
  path={`${localLibraries[0].name}/`}
333
- />
333
+ />,
334
334
  );
335
335
  }}
336
336
  close={closeSlicesTemplatesModal}
@@ -362,7 +362,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
362
362
  <ToastMessageWithPath
363
363
  message="New slice added to slice zone and created at: "
364
364
  path={`${localLibraries[0].name}/`}
365
- />
365
+ />,
366
366
  );
367
367
  }}
368
368
  localLibraries={localLibraries}
@@ -99,7 +99,7 @@ const TabZone: FC<TabZoneProps> = ({
99
99
  tabId,
100
100
  result.source.index,
101
101
  // @ts-expect-error We have to change the typeGuard above to cast properly the "result" property
102
- result.destination.index
102
+ result.destination.index,
103
103
  );
104
104
  };
105
105
 
@@ -146,7 +146,7 @@ export const CustomTypeBuilder: FC<CustomTypeBuilderProps> = (props) => {
146
146
  deleteCustomTypeTab(dialog.tabKey);
147
147
  if (tabValue === dialog.tabKey) {
148
148
  const otherTabValue = customType.tabs.find(
149
- (tab) => tab.key !== dialog.tabKey
149
+ (tab) => tab.key !== dialog.tabKey,
150
150
  )?.key;
151
151
  if (otherTabValue !== undefined) setTabValue(otherTabValue);
152
152
  }
@@ -66,7 +66,7 @@ const FieldZones: React.FunctionComponent<FieldZonesProps> = ({
66
66
  previousKey,
67
67
  newKey,
68
68
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
69
- mockValue
69
+ mockValue,
70
70
  );
71
71
  } else {
72
72
  deleteSliceWidgetMock(variation.id, widgetArea, newKey);
@@ -93,7 +93,7 @@ const FieldZones: React.FunctionComponent<FieldZonesProps> = ({
93
93
  // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
94
94
  if (!widget) {
95
95
  console.log(
96
- `Could not find widget with type name "${widgetTypeName}". Please contact us!`
96
+ `Could not find widget with type name "${widgetTypeName}". Please contact us!`,
97
97
  );
98
98
  }
99
99
 
@@ -102,7 +102,7 @@ const FieldZones: React.FunctionComponent<FieldZonesProps> = ({
102
102
  widgetArea,
103
103
  id,
104
104
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
105
- widget.create(label) as NestableWidget
105
+ widget.create(label) as NestableWidget,
106
106
  );
107
107
  };
108
108
 
@@ -113,7 +113,7 @@ const FieldZones: React.FunctionComponent<FieldZonesProps> = ({
113
113
  variation.id,
114
114
  widgetArea,
115
115
  result.source.index,
116
- result.destination?.index ?? undefined
116
+ result.destination?.index ?? undefined,
117
117
  );
118
118
  };
119
119
 
@@ -101,7 +101,7 @@ const SimulatorButton: React.FC<{
101
101
  (store: SliceMachineStoreType) => ({
102
102
  hasSeenSimulatorTooltip: userHasSeenSimulatorToolTip(store),
103
103
  hasSeenTutorialsToolTip: userHasSeenTutorialsToolTip(store),
104
- })
104
+ }),
105
105
  );
106
106
 
107
107
  useEffect(() => {
@@ -28,7 +28,7 @@ const VarationsPopover: React.FunctionComponent<{
28
28
  const [isOpen, setIsOpen] = useState(false);
29
29
  const [current, setCurrent] = useState<VariationSM>(
30
30
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
31
- defaultValue || variations[0]
31
+ defaultValue || variations[0],
32
32
  );
33
33
 
34
34
  useEffect(() => {
@@ -33,7 +33,7 @@ const Header: React.FC<{
33
33
  lib: component.href,
34
34
  sliceName: component.model.name,
35
35
  variationId: v.id,
36
- }).all
36
+ }).all,
37
37
  )
38
38
  }
39
39
  />
@@ -52,7 +52,7 @@ const Header: React.FC<{
52
52
  lib: component.href,
53
53
  sliceName: component.model.name,
54
54
  variationId: id,
55
- }).all
55
+ }).all,
56
56
  );
57
57
  }}
58
58
  initialVariation={variation}
@@ -58,7 +58,7 @@ const SliceBuilder: ComponentWithSliceProps = ({ slice, variation }) => {
58
58
  (store: SliceMachineStoreType) => ({
59
59
  isTouched: isSelectedSliceTouched(store, slice.from, slice.model.id),
60
60
  remoteSlice: getRemoteSlice(store, slice.model.id),
61
- })
61
+ }),
62
62
  );
63
63
 
64
64
  // We need to move this state to somewhere global to update the UI if any action from anywhere save or update to the filesystem I'd guess
@@ -115,7 +115,7 @@ const SliceBuilderForVariation: React.FC<SliceBuilderForVariationProps> = ({
115
115
  (state: SliceMachineStoreType) => ({
116
116
  isSimulatorAvailableForFramework:
117
117
  selectIsSimulatorAvailableForFramework(state),
118
- })
118
+ }),
119
119
  );
120
120
 
121
121
  const sliceModel: LocalAndRemoteSlice | LocalOnlySlice = {
@@ -43,7 +43,7 @@ const WidgetForm = ({
43
43
  [key]: value,
44
44
  };
45
45
  },
46
- {}
46
+ {},
47
47
  );
48
48
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
49
49
  onSave({ newKey: apiId, value: withDefaultValues });
@@ -44,7 +44,7 @@ const EditModal = ({ close, data, fields, onSave, zoneType }) => {
44
44
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
45
45
  initialModelValues.config,
46
46
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
47
- initialModelValues.type
47
+ initialModelValues.type,
48
48
  );
49
49
 
50
50
  // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
@@ -83,7 +83,7 @@ const EditModal = ({ close, data, fields, onSave, zoneType }) => {
83
83
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
84
84
  config: initialConfig,
85
85
  },
86
- { stripUnknown: true }
86
+ { stripUnknown: true },
87
87
  ),
88
88
  };
89
89
  } catch (e) {
@@ -96,7 +96,7 @@ const EditModal = ({ close, data, fields, onSave, zoneType }) => {
96
96
  if (err) {
97
97
  console.error(
98
98
  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access
99
- `[EditModal] Failed to validate field of type ${initialModelValues.type}.\n Please update model.json accordingly.`
99
+ `[EditModal] Failed to validate field of type ${initialModelValues.type}.\n Please update model.json accordingly.`,
100
100
  );
101
101
  console.error(err);
102
102
  }
@@ -58,7 +58,7 @@ const NewField: React.FC<NewField> = ({
58
58
  // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
59
59
  if (!widget) {
60
60
  console.error(
61
- `Widget of type "${widgetTypeName}" not found. This is a problem on our side!`
61
+ `Widget of type "${widgetTypeName}" not found. This is a problem on our side!`,
62
62
  );
63
63
  return <div>Unexpected error. Contact us for more info.</div>;
64
64
  }
@@ -84,8 +84,8 @@ const NewField: React.FC<NewField> = ({
84
84
  values: FormFieldValues,
85
85
  setValues: (
86
86
  values: SetStateAction<FormFieldValues>,
87
- shouldValidate?: boolean
88
- ) => void
87
+ shouldValidate?: boolean,
88
+ ) => void,
89
89
  ) => {
90
90
  // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
91
91
  if (isIdFieldPristine && !FormFields.id.disabled) {
@@ -104,8 +104,8 @@ const NewField: React.FC<NewField> = ({
104
104
  setFieldValue: (
105
105
  field: keyof typeof FormFields,
106
106
  value: string,
107
- shouldValidate?: boolean
108
- ) => Promise<unknown>
107
+ shouldValidate?: boolean,
108
+ ) => Promise<unknown>,
109
109
  ) => {
110
110
  void setFieldValue("id", e.target.value);
111
111
  setIsIdFieldPristine(false);
@@ -180,7 +180,7 @@ const NewField: React.FC<NewField> = ({
180
180
  : // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
181
181
  errors.label
182
182
  ? InputFieldStyles.ERROR
183
- : undefined
183
+ : undefined,
184
184
  )}
185
185
  aria-label="label-input"
186
186
  data-cy="new-field-name-input"
@@ -215,7 +215,7 @@ const NewField: React.FC<NewField> = ({
215
215
  : // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
216
216
  errors.id
217
217
  ? InputFieldStyles.ERROR
218
- : undefined
218
+ : undefined,
219
219
  )}
220
220
  data-cy="new-field-id-input"
221
221
  />
@@ -37,7 +37,7 @@ const Zone = ({
37
37
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
38
38
  const hasUid = !!Object.entries(poolOfFieldsToCheck).find(
39
39
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
40
- ([, { value }]) => value.type === "UID"
40
+ ([, { value }]) => value.type === "UID",
41
41
  );
42
42
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
43
43
  return hasUid
@@ -237,7 +237,7 @@ Zone.propTypes = {
237
237
  fields: array,
238
238
  type: string.isRequired,
239
239
  }),
240
- })
240
+ }),
241
241
  ),
242
242
  };
243
243
 
@@ -8,7 +8,7 @@ export const findWidgetByConfigOrType = (
8
8
  widgets: Widgets,
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
10
  config: any,
11
- type: string
11
+ type: string,
12
12
  ) => {
13
13
  if (type === "Link") {
14
14
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
@@ -28,7 +28,7 @@ export const DefaultFields: Record<string, InputType> = {
28
28
  },
29
29
  undefined,
30
30
  undefined,
31
- "Label for content creators (defaults to field type)"
31
+ "Label for content creators (defaults to field type)",
32
32
  ),
33
33
  id: Input(
34
34
  "API ID*",
@@ -40,7 +40,7 @@ export const DefaultFields: Record<string, InputType> = {
40
40
  },
41
41
  validateId,
42
42
  undefined,
43
- "A unique identifier for the field (e.g. buttonLink)"
43
+ "A unique identifier for the field (e.g. buttonLink)",
44
44
  ),
45
45
  placeholder: Input(
46
46
  "Placeholder",
@@ -50,6 +50,6 @@ export const DefaultFields: Record<string, InputType> = {
50
50
  },
51
51
  undefined,
52
52
  undefined,
53
- "Placeholder text for content creators"
53
+ "Placeholder text for content creators",
54
54
  ),
55
55
  };
@@ -5,7 +5,7 @@ import { createValidationArgs } from ".";
5
5
  export const CheckBox = (
6
6
  label: string,
7
7
  required = true,
8
- defaultValue = true
8
+ defaultValue = true,
9
9
  ) => ({
10
10
  type: FormTypes.CHECKBOX,
11
11
  validate: {
@@ -24,7 +24,7 @@ export const Select = (
24
24
  options: any,
25
25
  required = true,
26
26
  multi = true,
27
- defaultValue = true
27
+ defaultValue = true,
28
28
  ) => ({
29
29
  type: FormTypes.SELECT,
30
30
  required,
@@ -73,7 +73,7 @@ export const Input = (
73
73
  },
74
74
  fieldLevelValidation: FieldLevelValidationFn | undefined | null,
75
75
  defaultValue: string | undefined,
76
- placeholder: string
76
+ placeholder: string,
77
77
  ): InputType => {
78
78
  // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
79
79
  const { min, max, required, matches } = conditions || {};
@@ -27,7 +27,7 @@ export const createFieldNameFromKey = (key: string) =>
27
27
 
28
28
  export const createValidationArgs = (
29
29
  args: (string | number)[] | boolean | string | undefined,
30
- defaultArgs: (string | number)[]
30
+ defaultArgs: (string | number)[],
31
31
  ) => {
32
32
  if (Array.isArray(args)) {
33
33
  return args;
@@ -92,7 +92,7 @@ export const createValidationSchema = (FormFields: {
92
92
  if (args && validator[func]) {
93
93
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
94
94
  validator = validator[func](
95
- ...(Array.isArray(args) ? args : [args])
95
+ ...(Array.isArray(args) ? args : [args]),
96
96
  );
97
97
  return;
98
98
  }
@@ -103,7 +103,7 @@ export const createValidationSchema = (FormFields: {
103
103
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
104
104
  [key]: validator,
105
105
  };
106
- }, {})
106
+ }, {}),
107
107
  )
108
108
  .required()
109
109
  .default(undefined)
@@ -10,7 +10,7 @@ export const buildScreenshotUrls = (
10
10
  | {
11
11
  [variationId: string]: Screenshot;
12
12
  }
13
- | undefined
13
+ | undefined,
14
14
  ): { [v: string]: ScreenshotUI } => {
15
15
  if (!screenshots) {
16
16
  return {};
@@ -28,7 +28,7 @@ export const buildScreenshotUrls = (
28
28
  }
29
29
  : acc;
30
30
  },
31
- {}
31
+ {},
32
32
  );
33
33
  };
34
34
 
@@ -49,7 +49,7 @@ export const ComponentUI = {
49
49
  },
50
50
  variation(
51
51
  component: ComponentUI,
52
- variationId?: string
52
+ variationId?: string,
53
53
  ): VariationSM | undefined {
54
54
  if (component.model.variations.length) {
55
55
  // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
@@ -4,7 +4,7 @@ import { GroupSM } from "../Group";
4
4
  export const Group = {
5
5
  addWidget(
6
6
  group: GroupSM,
7
- newField: { key: string; value: NestableWidget }
7
+ newField: { key: string; value: NestableWidget },
8
8
  ): GroupSM {
9
9
  return {
10
10
  ...group,
@@ -58,7 +58,7 @@ export const Group = {
58
58
  group: GroupSM,
59
59
  previousKey: string,
60
60
  newKey: string,
61
- value: NestableWidget
61
+ value: NestableWidget,
62
62
  ): GroupSM {
63
63
  return {
64
64
  ...group,
@@ -26,14 +26,14 @@ export const CustomTypeSM = t.exact(
26
26
  t.partial({
27
27
  hash: t.string,
28
28
  }),
29
- ])
29
+ ]),
30
30
  );
31
31
  export type CustomTypeSM = t.TypeOf<typeof CustomTypeSM>;
32
32
 
33
33
  export const CustomTypes = {
34
34
  toSM(ct: CustomTypeInternal): CustomTypeSM {
35
35
  const tabs: Array<TabSM> = Object.entries(ct.json).map(
36
- ([tabKey, tabValue]) => Tabs.toSM(tabKey, tabValue)
36
+ ([tabKey, tabValue]) => Tabs.toSM(tabKey, tabValue),
37
37
  );
38
38
  return getOrElseW(() => {
39
39
  throw new Error("Error while parsing a prismic custom type.");
@@ -41,7 +41,7 @@ export const CustomTypes = {
41
41
  CustomTypeSM.decode({
42
42
  ...ct,
43
43
  tabs,
44
- })
44
+ }),
45
45
  );
46
46
  },
47
47
  fromSM(ct: CustomTypeSM): CustomTypeInternal {
@@ -56,7 +56,7 @@ export const CustomTypes = {
56
56
  [tab.key]: Tabs.fromSM(tab),
57
57
  };
58
58
  }, {}),
59
- })
59
+ }),
60
60
  );
61
61
  },
62
62
  };
@@ -17,7 +17,7 @@ export const TabFields = t.array(
17
17
  t.type({
18
18
  key: t.string,
19
19
  value: t.union([NestableWidget, UID, GroupSM]),
20
- })
20
+ }),
21
21
  );
22
22
  export type TabFields = t.TypeOf<typeof TabFields>;
23
23
 
@@ -35,7 +35,7 @@ export type TabSM = t.TypeOf<typeof TabSM>;
35
35
  export const Tabs = {
36
36
  toSM(key: string, tab: DynamicSection): TabSM {
37
37
  const maybeSz = Object.entries(tab).find(
38
- ([, value]) => value.type === "Slices"
38
+ ([, value]) => value.type === "Slices",
39
39
  );
40
40
  const sliceZone =
41
41
  maybeSz && SliceZone.toSM(maybeSz[0], maybeSz[1] as DynamicSlices);
@@ -60,7 +60,7 @@ export const Tabs = {
60
60
  return [...acc, { key: fieldId, value }];
61
61
  }
62
62
  },
63
- []
63
+ [],
64
64
  ),
65
65
  ...(sliceZone ? { sliceZone } : {}),
66
66
  };
@@ -76,12 +76,12 @@ export const Tabs = {
76
76
  return [...acc, [key, value]];
77
77
  }
78
78
  },
79
- []
79
+ [],
80
80
  )
81
81
  .concat(
82
82
  !tab.sliceZone
83
83
  ? []
84
- : [[tab.sliceZone.key, SliceZone.fromSM(tab.sliceZone)]]
84
+ : [[tab.sliceZone.key, SliceZone.fromSM(tab.sliceZone)]],
85
85
  )
86
86
  .reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {});
87
87
  return fields;
@@ -137,7 +137,7 @@ export const Tab = {
137
137
  tab: TabSM,
138
138
  previousKey: string,
139
139
  newKey: string,
140
- value: TabField
140
+ value: TabField,
141
141
  ): TabSM {
142
142
  return {
143
143
  ...tab,
@@ -221,7 +221,7 @@ export const Tab = {
221
221
  };
222
222
  }
223
223
  },
224
- { fields: [], groups: [] }
224
+ { fields: [], groups: [] },
225
225
  );
226
226
  return {
227
227
  fields,
@@ -1,5 +1,8 @@
1
1
  export default class ErrorWithStatus extends Error {
2
- constructor(readonly reason: string, readonly status: number) {
2
+ constructor(
3
+ readonly reason: string,
4
+ readonly status: number,
5
+ ) {
3
6
  super(reason);
4
7
  }
5
8
  }
@@ -2,6 +2,6 @@ import * as t from "io-ts";
2
2
  import { NestableWidget } from "@prismicio/types-internal/lib/customtypes";
3
3
 
4
4
  export const FieldsSM = t.array(
5
- t.type({ key: t.string, value: NestableWidget })
5
+ t.type({ key: t.string, value: NestableWidget }),
6
6
  );
7
7
  export type FieldsSM = t.TypeOf<typeof FieldsSM>;
@@ -9,7 +9,7 @@ export const GroupConfig = t.exact(
9
9
  label: StringOrNull,
10
10
  repeat: t.boolean,
11
11
  fields: FieldsSM,
12
- })
12
+ }),
13
13
  );
14
14
  export type GroupConfig = t.TypeOf<typeof GroupConfig>;
15
15
 
@@ -24,7 +24,7 @@ export const GroupSM = t.exact(
24
24
  description: t.string,
25
25
  config: GroupConfig,
26
26
  }),
27
- ])
27
+ ]),
28
28
  );
29
29
  export type GroupSM = t.TypeOf<typeof GroupSM>;
30
30
 
@@ -35,7 +35,7 @@ export const Groups = {
35
35
 
36
36
  return group.config.fields.reduce(
37
37
  (acc, { key, value }) => ({ ...acc, [key]: value }),
38
- {}
38
+ {},
39
39
  );
40
40
  })();
41
41
 
@@ -48,7 +48,7 @@ export const Groups = {
48
48
  ...group.config,
49
49
  ...(fields ? { fields } : {}),
50
50
  },
51
- })
51
+ }),
52
52
  );
53
53
  },
54
54
 
@@ -72,7 +72,7 @@ export const Groups = {
72
72
  ...group.config,
73
73
  ...(fields ? { fields } : {}),
74
74
  },
75
- })
75
+ }),
76
76
  );
77
77
  },
78
78
  };