slice-machine-ui 1.19.2-dev-next-release.1 → 1.19.2-dev-next-release.3

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 (47) hide show
  1. package/components/Simulator/components/IframeRenderer/index.tsx +0 -3
  2. package/components/Simulator/components/Toolbar/index.tsx +0 -42
  3. package/components/Simulator/index.tsx +0 -2
  4. package/lib/models/common/Screenshots.ts +1 -10
  5. package/out/404.html +1 -1
  6. package/out/_next/static/chunks/585-f3dca093db4b3792.js +10 -0
  7. package/out/_next/static/chunks/{80-4cd4c6f95d162ef7.js → 80-c513d12da6156fb7.js} +1 -1
  8. package/out/_next/static/chunks/{904-b2d5235c13e62ee8.js → 904-cfe9632d3f82e990.js} +1 -1
  9. package/out/_next/static/chunks/pages/{_app-d27e49f9f618a421.js → _app-37aead075684fb8d.js} +3 -3
  10. package/out/_next/static/chunks/pages/{changes-768c9cb6fef169d1.js → changes-cacc63c37e28fbbd.js} +1 -1
  11. package/out/_next/static/chunks/pages/{labs-395232bcec99d42a.js → labs-083545e0987b7886.js} +1 -1
  12. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-5e441f8b049cf91b.js +1 -0
  13. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-4dfda949290eb037.js → [variation]-3d4698bb55b09014.js} +1 -1
  14. package/out/_next/static/sVN8SG2Rfq9IshnbTCNsD/_buildManifest.js +1 -0
  15. package/out/changelog.html +1 -1
  16. package/out/changes.html +1 -1
  17. package/out/custom-types/[customTypeId].html +1 -1
  18. package/out/custom-types.html +1 -1
  19. package/out/index.html +1 -1
  20. package/out/labs.html +1 -1
  21. package/out/page-types/[pageTypeId].html +1 -1
  22. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  23. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  24. package/out/slices.html +1 -1
  25. package/package.json +4 -4
  26. package/src/apiClient.ts +1 -40
  27. package/src/modules/loading/types.ts +0 -1
  28. package/src/modules/screenshots/actions.ts +4 -25
  29. package/src/modules/screenshots/sagas.ts +1 -63
  30. package/src/modules/selectedSlice/actions.ts +1 -5
  31. package/src/modules/selectedSlice/reducer.ts +1 -5
  32. package/src/modules/slices/index.ts +1 -6
  33. package/src/modules/toaster/index.tsx +6 -22
  34. package/src/modules/useSliceMachineActions.ts +2 -25
  35. package/components/ScreenshotToaster/index.tsx +0 -53
  36. package/out/_next/static/OxAI7JbjsT4zST5HlKNEI/_buildManifest.js +0 -1
  37. package/out/_next/static/chunks/746-2ca4784811bde7c1.js +0 -8
  38. package/out/_next/static/chunks/770-c75d8245a822c5d9.js +0 -3
  39. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/screenshot-76d40513025fd76d.js +0 -1
  40. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-39efc79412072ae1.js +0 -1
  41. package/out/slices/[lib]/[sliceName]/[variation]/screenshot.html +0 -1
  42. package/pages/slices/[lib]/[sliceName]/[variation]/screenshot.tsx +0 -61
  43. package/test/src/modules/screenshots/__fixtures__/mocks.json +0 -41
  44. package/test/src/modules/screenshots/__fixtures__/model.json +0 -35
  45. package/test/src/modules/screenshots/__testutils__/getSelectedSliceDummyData.ts +0 -29
  46. package/test/src/modules/screenshots/sagas.test.ts +0 -82
  47. /package/out/_next/static/{OxAI7JbjsT4zST5HlKNEI → sVN8SG2Rfq9IshnbTCNsD}/_ssgManifest.js +0 -0
@@ -1,82 +0,0 @@
1
- import { describe, it } from "vitest";
2
- import { testSaga } from "redux-saga-test-plan";
3
- import { generateSliceScreenshotSaga } from "@src/modules/screenshots/sagas";
4
- import { generateSliceScreenshotCreator } from "@src/modules/screenshots/actions";
5
- import { generateSliceScreenshotApiClient } from "@src/apiClient";
6
- import { openToasterCreator, ToasterType } from "@src/modules/toaster";
7
- import SegmentClient from "analytics-node";
8
-
9
- import { getSelectedSliceDummyData } from "./__testutils__/getSelectedSliceDummyData";
10
-
11
- const { dummySliceState, dummyModelVariationID } = getSelectedSliceDummyData();
12
-
13
- describe("[Selected Slice sagas]", () => {
14
- describe("[generateSliceScreenshotSaga]", () => {
15
- it("should call the api and dispatch the success action", async () => {
16
- const screenDimensions = { width: 1200, height: 600 };
17
- const saga = testSaga(
18
- generateSliceScreenshotSaga,
19
- generateSliceScreenshotCreator.request({
20
- variationId: dummyModelVariationID,
21
- component: dummySliceState,
22
- screenDimensions,
23
- method: "fromSimulator",
24
- }),
25
- );
26
-
27
- saga.next().call(generateSliceScreenshotApiClient, {
28
- libraryName: dummySliceState.from,
29
- sliceId: dummySliceState.model.id,
30
- variationId: dummyModelVariationID,
31
- screenDimensions,
32
- });
33
- const response = {
34
- url: "testScreenshotUrl",
35
- errors: [],
36
- };
37
-
38
- saga.next(response).put(
39
- openToasterCreator({
40
- url: "testScreenshotUrl",
41
- type: ToasterType.SCREENSHOT_CAPTURED,
42
- }),
43
- );
44
-
45
- saga.next().put(
46
- generateSliceScreenshotCreator.success({
47
- screenshot: {
48
- url: response.url,
49
- },
50
- component: dummySliceState,
51
- variationId: dummyModelVariationID,
52
- }),
53
- );
54
-
55
- saga.next().isDone();
56
-
57
- // Wait for network request to be performed
58
- await new Promise((resolve) => setTimeout(resolve, 100));
59
- expect(SegmentClient.prototype.track).toHaveBeenCalledOnce();
60
- });
61
- it("should open a error toaster on internal error", () => {
62
- const screenDimensions = { width: 1200, height: 600 };
63
- const saga = testSaga(
64
- generateSliceScreenshotSaga,
65
- generateSliceScreenshotCreator.request({
66
- variationId: dummyModelVariationID,
67
- component: dummySliceState,
68
- screenDimensions,
69
- method: "fromSimulator",
70
- }),
71
- ).next();
72
-
73
- saga.throw(new Error()).put(
74
- openToasterCreator({
75
- content: "Internal Error: Screenshot not saved",
76
- type: ToasterType.ERROR,
77
- }),
78
- );
79
- saga.next().isDone();
80
- });
81
- });
82
- });