slice-machine-ui 1.19.2-dev-next-release.2 → 1.19.2-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 (62) hide show
  1. package/components/Navigation/ChangesListItem.tsx +0 -4
  2. package/components/Navigation/VideoItem.tsx +82 -76
  3. package/components/Navigation/index.test.tsx +2 -13
  4. package/components/Simulator/components/IframeRenderer/index.tsx +0 -3
  5. package/components/Simulator/components/Toolbar/index.tsx +0 -42
  6. package/components/Simulator/index.tsx +0 -2
  7. package/lib/builders/SliceBuilder/SimulatorButton/index.tsx +5 -20
  8. package/lib/consts.ts +0 -7
  9. package/lib/models/common/Screenshots.ts +1 -10
  10. package/out/404.html +1 -1
  11. package/out/_next/static/4sLbpIu3gX8jUmr0j0Shc/_buildManifest.js +1 -0
  12. package/out/_next/static/chunks/585-f3dca093db4b3792.js +10 -0
  13. package/out/_next/static/chunks/{80-4cd4c6f95d162ef7.js → 80-c513d12da6156fb7.js} +1 -1
  14. package/out/_next/static/chunks/{840-4e395e66a2b2f394.js → 840-c317c8ff8de0f202.js} +1 -1
  15. package/out/_next/static/chunks/{904-b2d5235c13e62ee8.js → 904-d5dfccdb4d9ab010.js} +1 -1
  16. package/out/_next/static/chunks/pages/{_app-ec1f14f2d3ddb69d.js → _app-ee40681cde62eb80.js} +3 -3
  17. package/out/_next/static/chunks/pages/{changelog-11c9e241f5a8a4cb.js → changelog-75b0bf58d1f3045d.js} +1 -1
  18. package/out/_next/static/chunks/pages/{changes-768c9cb6fef169d1.js → changes-9dcb1cdaa8b10560.js} +1 -1
  19. package/out/_next/static/chunks/pages/{labs-395232bcec99d42a.js → labs-2349c21fbac1bd23.js} +1 -1
  20. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-5e441f8b049cf91b.js +1 -0
  21. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-c9b5ff7076d2b19b.js +1 -0
  22. package/out/_next/static/chunks/pages/{slices-f77df402117379c6.js → slices-247c480530e98426.js} +1 -1
  23. package/out/changelog.html +1 -1
  24. package/out/changes.html +1 -1
  25. package/out/custom-types/[customTypeId].html +1 -1
  26. package/out/custom-types.html +1 -1
  27. package/out/index.html +1 -1
  28. package/out/labs.html +1 -1
  29. package/out/page-types/[pageTypeId].html +1 -1
  30. package/out/prismic-academy-101.png +0 -0
  31. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  32. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  33. package/out/slices.html +1 -1
  34. package/package.json +4 -4
  35. package/public/prismic-academy-101.png +0 -0
  36. package/src/apiClient.ts +1 -40
  37. package/src/components/HoverCard/HoverCard.stories.tsx +1 -1
  38. package/src/hooks/useMarketingContent.ts +65 -0
  39. package/src/modules/loading/types.ts +0 -1
  40. package/src/modules/screenshots/actions.ts +4 -25
  41. package/src/modules/screenshots/sagas.ts +1 -63
  42. package/src/modules/selectedSlice/actions.ts +1 -5
  43. package/src/modules/selectedSlice/reducer.ts +1 -5
  44. package/src/modules/slices/index.ts +1 -6
  45. package/src/modules/toaster/index.tsx +6 -22
  46. package/src/modules/useSliceMachineActions.ts +2 -25
  47. package/components/ScreenshotToaster/index.tsx +0 -53
  48. package/out/_next/static/DcicAqW9Z1wJ8X-Tue3N3/_buildManifest.js +0 -1
  49. package/out/_next/static/chunks/746-2ca4784811bde7c1.js +0 -8
  50. package/out/_next/static/chunks/770-c75d8245a822c5d9.js +0 -3
  51. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/screenshot-76d40513025fd76d.js +0 -1
  52. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-39efc79412072ae1.js +0 -1
  53. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-4dfda949290eb037.js +0 -1
  54. package/out/phil.png +0 -0
  55. package/out/slices/[lib]/[sliceName]/[variation]/screenshot.html +0 -1
  56. package/pages/slices/[lib]/[sliceName]/[variation]/screenshot.tsx +0 -61
  57. package/public/phil.png +0 -0
  58. package/test/src/modules/screenshots/__fixtures__/mocks.json +0 -41
  59. package/test/src/modules/screenshots/__fixtures__/model.json +0 -35
  60. package/test/src/modules/screenshots/__testutils__/getSelectedSliceDummyData.ts +0 -29
  61. package/test/src/modules/screenshots/sagas.test.ts +0 -82
  62. /package/out/_next/static/{DcicAqW9Z1wJ8X-Tue3N3 → 4sLbpIu3gX8jUmr0j0Shc}/_ssgManifest.js +0 -0
@@ -8,65 +8,13 @@ import {
8
8
  import { getType } from "typesafe-actions";
9
9
  import { withLoader } from "../loading";
10
10
  import { LoadingKeysEnum } from "../loading/types";
11
+ import { generateSliceCustomScreenshotCreator } from "./actions";
11
12
  import {
12
- generateSliceScreenshotCreator,
13
- generateSliceCustomScreenshotCreator,
14
- } from "./actions";
15
- import {
16
- generateSliceScreenshotApiClient,
17
13
  generateSliceCustomScreenshotApiClient,
18
14
  telemetry,
19
15
  } from "@src/apiClient";
20
16
  import { openToasterCreator, ToasterType } from "@src/modules/toaster";
21
17
 
22
- export function* generateSliceScreenshotSaga({
23
- payload,
24
- }: ReturnType<typeof generateSliceScreenshotCreator.request>) {
25
- const { component, variationId, screenDimensions, method } = payload;
26
- try {
27
- const response = (yield call(generateSliceScreenshotApiClient, {
28
- libraryName: component.from,
29
- sliceId: component.model.id,
30
- variationId,
31
- screenDimensions,
32
- })) as SagaReturnType<typeof generateSliceScreenshotApiClient>;
33
-
34
- if (!response) {
35
- throw Error("No screenshot saved");
36
- }
37
-
38
- yield put(
39
- openToasterCreator({
40
- url: response.url,
41
- type: ToasterType.SCREENSHOT_CAPTURED,
42
- }),
43
- );
44
-
45
- void telemetry.track({
46
- event: "screenshot-taken",
47
- type: "automatic",
48
- method,
49
- });
50
-
51
- yield put(
52
- generateSliceScreenshotCreator.success({
53
- variationId,
54
- screenshot: {
55
- url: response.url,
56
- },
57
- component,
58
- }),
59
- );
60
- } catch (e) {
61
- yield put(
62
- openToasterCreator({
63
- content: "Internal Error: Screenshot not saved",
64
- type: ToasterType.ERROR,
65
- }),
66
- );
67
- }
68
- }
69
-
70
18
  export function* generateSliceCustomScreenshotSaga({
71
19
  payload,
72
20
  }: ReturnType<typeof generateSliceCustomScreenshotCreator.request>) {
@@ -109,15 +57,6 @@ export function* generateSliceCustomScreenshotSaga({
109
57
  }
110
58
  }
111
59
 
112
- function* watchGenerateSliceScreenshot() {
113
- yield takeLatest(
114
- getType(generateSliceScreenshotCreator.request),
115
- withLoader(
116
- generateSliceScreenshotSaga,
117
- LoadingKeysEnum.GENERATE_SLICE_SCREENSHOT,
118
- ),
119
- );
120
- }
121
60
  function* watchGenerateSliceCustomScreenshot() {
122
61
  yield takeLatest(
123
62
  getType(generateSliceCustomScreenshotCreator.request),
@@ -130,6 +69,5 @@ function* watchGenerateSliceCustomScreenshot() {
130
69
 
131
70
  // Saga Exports
132
71
  export function* screenshotsSagas() {
133
- yield fork(watchGenerateSliceScreenshot);
134
72
  yield fork(watchGenerateSliceCustomScreenshot);
135
73
  }
@@ -4,10 +4,7 @@ import { ComponentUI } from "@lib/models/common/ComponentUI";
4
4
  import { renameSliceCreator } from "../slices";
5
5
  import { SelectedSliceStoreType } from "./types";
6
6
  import { refreshStateCreator } from "../environment";
7
- import {
8
- generateSliceCustomScreenshotCreator,
9
- generateSliceScreenshotCreator,
10
- } from "../screenshots/actions";
7
+ import { generateSliceCustomScreenshotCreator } from "../screenshots/actions";
11
8
  import { VariationSM, WidgetsArea } from "@lib/models/common/Slice";
12
9
  import { SharedSliceContent } from "@prismicio/types-internal/lib/content";
13
10
 
@@ -23,7 +20,6 @@ export type SelectedSliceActions =
23
20
  | ActionType<typeof copyVariationSliceCreator>
24
21
  | ActionType<typeof renameSliceCreator>
25
22
  | ActionType<typeof refreshStateCreator>
26
- | ActionType<typeof generateSliceScreenshotCreator>
27
23
  | ActionType<typeof generateSliceCustomScreenshotCreator>
28
24
  | ActionType<typeof updateSelectedSliceMocks>;
29
25
 
@@ -18,10 +18,7 @@ import { ComponentUI } from "@lib/models/common/ComponentUI";
18
18
  import { SliceSM } from "@lib/models/common/Slice";
19
19
  import { renameSliceCreator } from "../slices";
20
20
  import { refreshStateCreator } from "../environment";
21
- import {
22
- generateSliceCustomScreenshotCreator,
23
- generateSliceScreenshotCreator,
24
- } from "../screenshots/actions";
21
+ import { generateSliceCustomScreenshotCreator } from "../screenshots/actions";
25
22
 
26
23
  // Reducer
27
24
  export const selectedSliceReducer: Reducer<
@@ -105,7 +102,6 @@ export const selectedSliceReducer: Reducer<
105
102
  return prevState;
106
103
  }
107
104
  }
108
- case getType(generateSliceScreenshotCreator.success):
109
105
  case getType(generateSliceCustomScreenshotCreator.success): {
110
106
  if (!prevState) return prevState;
111
107
  const { component, screenshot, variationId } = action.payload;
@@ -26,10 +26,7 @@ import { refreshStateCreator } from "@src/modules/environment";
26
26
  import { SliceMachineStoreType } from "@src/redux/type";
27
27
  import { openToasterCreator, ToasterType } from "@src/modules/toaster";
28
28
  import { updateSliceCreator } from "../selectedSlice/actions";
29
- import {
30
- generateSliceCustomScreenshotCreator,
31
- generateSliceScreenshotCreator,
32
- } from "../screenshots/actions";
29
+ import { generateSliceCustomScreenshotCreator } from "../screenshots/actions";
33
30
  import { selectSliceById } from "../selectedSlice/selectors";
34
31
  import { SlicesStoreType } from "./types";
35
32
 
@@ -79,7 +76,6 @@ type SlicesActions =
79
76
  | ActionType<typeof renameSliceCreator>
80
77
  | ActionType<typeof deleteSliceCreator>
81
78
  | ActionType<typeof updateSliceCreator>
82
- | ActionType<typeof generateSliceScreenshotCreator>
83
79
  | ActionType<typeof generateSliceCustomScreenshotCreator>
84
80
  | ActionType<typeof updateSliceMock>;
85
81
 
@@ -161,7 +157,6 @@ export const slicesReducer: Reducer<SlicesStoreType | null, SlicesActions> = (
161
157
 
162
158
  return { ...state, libraries: newLibraries };
163
159
  }
164
- case getType(generateSliceScreenshotCreator.success):
165
160
  case getType(generateSliceCustomScreenshotCreator.success): {
166
161
  const { component, screenshot, variationId } = action.payload;
167
162
 
@@ -1,7 +1,6 @@
1
1
  import { toast, ToastOptions, UpdateOptions } from "react-toastify";
2
2
  import { createAction, getType } from "typesafe-actions";
3
3
  import { fork, takeLatest } from "redux-saga/effects";
4
- import ScreenshotToaster from "@components/ScreenshotToaster";
5
4
 
6
5
  export enum ToasterType {
7
6
  SUCCESS = "success",
@@ -9,28 +8,16 @@ export enum ToasterType {
9
8
  ERROR = "error",
10
9
  INFO = "info",
11
10
  LOADING = "loading",
12
- SCREENSHOT_CAPTURED = "screenshot_captured",
13
11
  }
14
12
 
15
- type ScreenshotCapturedToast = {
16
- type: ToasterType.SCREENSHOT_CAPTURED;
17
- url: string;
18
- };
19
-
20
- export type GenericToastTypes = Exclude<
21
- ToasterType,
22
- ToasterType.SCREENSHOT_CAPTURED
23
- >;
13
+ export type GenericToastTypes = ToasterType;
24
14
 
25
15
  // Action Creators
26
- export const openToasterCreator = createAction("TOASTER/OPEN")<
27
- | {
28
- content: string | React.ReactNode;
29
- type: GenericToastTypes;
30
- options?: ToastOptions;
31
- }
32
- | ScreenshotCapturedToast
33
- >();
16
+ export const openToasterCreator = createAction("TOASTER/OPEN")<{
17
+ content: string | React.ReactNode;
18
+ type: GenericToastTypes;
19
+ options?: ToastOptions;
20
+ }>();
34
21
 
35
22
  export const updateToasterCreator = createAction("TOASTER/UPDATE")<{
36
23
  toasterId: string;
@@ -61,9 +48,6 @@ export function* openToasterSaga(
61
48
  case ToasterType.LOADING:
62
49
  toast.loading(action.payload.content, action.payload.options);
63
50
  break;
64
- case ToasterType.SCREENSHOT_CAPTURED:
65
- toast(<ScreenshotToaster url={action.payload.url} />);
66
- break;
67
51
  }
68
52
  }
69
53
 
@@ -65,16 +65,10 @@ import {
65
65
  updateSliceCreator,
66
66
  updateSliceWidgetMockCreator,
67
67
  } from "./selectedSlice/actions";
68
- import {
69
- generateSliceCustomScreenshotCreator,
70
- generateSliceScreenshotCreator,
71
- } from "./screenshots/actions";
68
+ import { generateSliceCustomScreenshotCreator } from "./screenshots/actions";
72
69
  import { ComponentUI } from "../../lib/models/common/ComponentUI";
73
70
  import { ChangesPushSagaPayload, changesPushCreator } from "./pushChangesSaga";
74
- import type {
75
- ScreenDimensions,
76
- ScreenshotGenerationMethod,
77
- } from "@lib/models/common/Screenshots";
71
+ import type { ScreenshotGenerationMethod } from "@lib/models/common/Screenshots";
78
72
  import { saveSliceMockCreator } from "./simulator";
79
73
  import { SaveSliceMockRequest } from "@src/apiClient";
80
74
  import { VariationSM, WidgetsArea } from "@lib/models/common/Slice";
@@ -365,22 +359,6 @@ const useSliceMachineActions = () => {
365
359
  );
366
360
  };
367
361
 
368
- const generateSliceScreenshot = (
369
- variationId: string,
370
- component: ComponentUI,
371
- screenDimensions: ScreenDimensions,
372
- method: ScreenshotGenerationMethod,
373
- ) => {
374
- dispatch(
375
- generateSliceScreenshotCreator.request({
376
- variationId,
377
- component,
378
- screenDimensions,
379
- method,
380
- }),
381
- );
382
- };
383
-
384
362
  const generateSliceCustomScreenshot = (
385
363
  variationId: string,
386
364
  component: ComponentUI,
@@ -517,7 +495,6 @@ const useSliceMachineActions = () => {
517
495
  removeSliceWidget,
518
496
  updateSliceWidgetMock,
519
497
  deleteSliceWidgetMock,
520
- generateSliceScreenshot,
521
498
  generateSliceCustomScreenshot,
522
499
  updateSlice,
523
500
  copyVariationSlice,
@@ -1,53 +0,0 @@
1
- import useSliceMachineActions from "@src/modules/useSliceMachineActions";
2
- import { FC } from "react";
3
- import { Container, Flex, Image, Text } from "theme-ui";
4
-
5
- type ScreenshotToasterProps = {
6
- url: string;
7
- };
8
-
9
- const ScreenshotToaster: FC<ScreenshotToasterProps> = ({ url }) => {
10
- const { openScreenshotPreviewModal } = useSliceMachineActions();
11
-
12
- return (
13
- <Flex
14
- sx={{ height: 75, backgroundColor: "rgba(37, 37, 45, 0.9)" }}
15
- onClick={openScreenshotPreviewModal}
16
- >
17
- <Container
18
- sx={{
19
- width: 102,
20
- justifyContent: "center",
21
- height: "100%",
22
- display: "flex",
23
- mr: 16,
24
- backgroundImage: "url(/pattern.png)",
25
- backgroundColor: "headSection",
26
- backgroundRepeat: "repeat",
27
- backgroundSize: "5px",
28
- borderRadius: "2px",
29
- }}
30
- >
31
- <Image sx={{ maxHeight: "100%", objectFit: "contain" }} src={url} />
32
- </Container>
33
- <Flex
34
- style={{
35
- flexDirection: "column",
36
- justifyContent: "center",
37
- }}
38
- >
39
- <Text sx={{ fontWeight: "Display", fontSize: 16 }}>
40
- Screenshot taken
41
- </Text>
42
- <Text
43
- variant={"xs"}
44
- sx={{ fontSize: 14, color: "icons", fontWeight: "label" }}
45
- >
46
- Tap to view screenshot
47
- </Text>
48
- </Flex>
49
- </Flex>
50
- );
51
- };
52
-
53
- export default ScreenshotToaster;
@@ -1 +0,0 @@
1
- self.__BUILD_MANIFEST=function(s,c,e,a,t,i,b,n,l,d,u){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[c,i,b,"static/chunks/pages/index-5266b7f0ca55025a.js"],"/_error":["static/chunks/pages/_error-69b4f498bafdd188.js"],"/changelog":["static/chunks/870-0c7a8a9622de78b7.js","static/chunks/pages/changelog-11c9e241f5a8a4cb.js"],"/changes":[e,"static/chunks/8eec4907-b712959d9f984b68.js","static/chunks/918-38d08f1e885b222d.js",s,a,"static/css/f585032018f6024b.css","static/chunks/pages/changes-768c9cb6fef169d1.js"],"/custom-types":[c,i,b,"static/chunks/pages/custom-types-2f5664d9492b13fb.js"],"/custom-types/[customTypeId]":[n,s,c,t,l,d,"static/chunks/pages/custom-types/[customTypeId]-aa37e07c96c8f9b5.js"],"/labs":["static/chunks/pages/labs-395232bcec99d42a.js"],"/page-types/[pageTypeId]":[n,s,c,t,l,d,"static/chunks/pages/page-types/[pageTypeId]-d445f5cabeb460c0.js"],"/slices":[e,s,a,"static/css/22d69420bda374a7.css","static/chunks/pages/slices-f77df402117379c6.js"],"/slices/[lib]/[sliceName]/[variation]":[e,s,a,t,"static/css/e4f4acc81f000d9c.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-4dfda949290eb037.js"],"/slices/[lib]/[sliceName]/[variation]/screenshot":[u,"static/chunks/pages/slices/[lib]/[sliceName]/[variation]/screenshot-76d40513025fd76d.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[e,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/18539003-1bb05c8aa7db2bc2.js",u,"static/chunks/770-c75d8245a822c5d9.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-39efc79412072ae1.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/screenshot","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/958-2b881a5b68ff11ba.js","static/chunks/550-1dafbcec5d50b384.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/80-4cd4c6f95d162ef7.js","static/chunks/482-e6bbd1fcdcdf79ad.js","static/chunks/840-4e395e66a2b2f394.js","static/css/26b51745402a92af.css","static/chunks/125-e3857af2068bbedf.js","static/chunks/904-b2d5235c13e62ee8.js","static/css/1fbd45881dcf43c4.css","static/chunks/746-2ca4784811bde7c1.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();