slice-machine-ui 1.23.2-beta.3 → 1.23.2-beta.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 (71) hide show
  1. package/components/DeleteSliceModal/index.tsx +34 -24
  2. package/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx +61 -38
  3. package/components/Forms/RenameCustomTypeModal/RenameCustomTypeModal.tsx +2 -2
  4. package/components/Forms/RenameSliceModal/RenameSliceModal.tsx +33 -21
  5. package/components/Navigation/ChangesListItem.tsx +14 -32
  6. package/out/404.html +1 -1
  7. package/out/_next/static/W3x14bv5_NtxtSjAB0JUM/_buildManifest.js +1 -0
  8. package/out/_next/static/chunks/{183-aab7066c73ebde44.js → 183-4feb6bb3eddbc768.js} +1 -1
  9. package/out/_next/static/chunks/25-01f422cea8066349.js +1 -0
  10. package/out/_next/static/chunks/{318-2112803ca34b2f49.js → 318-34a2dea7cfd4661d.js} +1 -1
  11. package/out/_next/static/chunks/727-358d7fae68a880b3.js +1 -0
  12. package/out/_next/static/chunks/799-d95a93e965557aeb.js +1 -0
  13. package/out/_next/static/chunks/904-1ff7519adece2b55.js +1 -0
  14. package/out/_next/static/chunks/pages/{_app-9f3513533bb2dfb8.js → _app-a2fa2db79a1e9a1e.js} +37 -37
  15. package/out/_next/static/chunks/pages/{changes-2a976f9efeb719aa.js → changes-92c84f6cac0285fd.js} +1 -1
  16. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-3f862ad6111a1fc0.js → [customTypeId]-97ab3b90b85d645d.js} +1 -1
  17. package/out/_next/static/chunks/pages/{custom-types-94b8f8dbf7727412.js → custom-types-3c8e721ec6802127.js} +1 -1
  18. package/out/_next/static/chunks/pages/index-cf93d16e9c63b6db.js +1 -0
  19. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-d1ffca11c42f2603.js → [pageTypeId]-84a22c5e480d3fa9.js} +1 -1
  20. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-897ca93c114a1435.js → simulator-52c3e1f9d14160b8.js} +1 -1
  21. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-608d206d10a719e3.js +1 -0
  22. package/out/_next/static/chunks/pages/slices-b0b58192a87df822.js +1 -0
  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/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  31. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  32. package/out/slices.html +1 -1
  33. package/package.json +3 -3
  34. package/pages/slices.tsx +20 -8
  35. package/src/apiClient.ts +1 -22
  36. package/src/domain/__tests__/customType.test.ts +179 -0
  37. package/src/domain/customType.ts +110 -2
  38. package/src/domain/slice.ts +38 -0
  39. package/src/features/customTypes/PageTypeOnboarding.tsx +21 -26
  40. package/src/features/customTypes/actions/convertCustomToPageType.ts +14 -10
  41. package/src/features/customTypes/actions/createCustomType.ts +69 -0
  42. package/src/features/customTypes/actions/deleteCustomType.ts +13 -3
  43. package/src/features/customTypes/actions/renameCustomType.ts +10 -4
  44. package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +3 -1
  45. package/src/features/customTypes/customTypesTable/CustomTypesTable.tsx +8 -8
  46. package/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +18 -17
  47. package/src/features/slices/actions/createSlice.ts +5 -29
  48. package/src/features/slices/actions/deleteSlice.ts +33 -0
  49. package/src/features/slices/actions/renameSlice.ts +37 -0
  50. package/src/modules/availableCustomTypes/index.ts +29 -135
  51. package/src/modules/loading/types.ts +0 -5
  52. package/src/modules/modal/types.ts +0 -3
  53. package/src/modules/slices/index.ts +27 -193
  54. package/src/modules/slices/selector.ts +0 -14
  55. package/src/modules/useSliceMachineActions.ts +70 -89
  56. package/src/modules/userContext/index.ts +3 -3
  57. package/src/redux/saga.ts +0 -4
  58. package/test/src/modules/availableCustomTypes/index.test.ts +2 -243
  59. package/test/src/modules/slices.test.ts +1 -267
  60. package/out/_next/static/RRBm5bm2F__Ws0vsvXhN6/_buildManifest.js +0 -1
  61. package/out/_next/static/chunks/25-37d6fa7f064be04b.js +0 -1
  62. package/out/_next/static/chunks/727-3a3bc32518778317.js +0 -1
  63. package/out/_next/static/chunks/731-501990ebe6a71b32.js +0 -1
  64. package/out/_next/static/chunks/904-9a4c1264727ae89a.js +0 -1
  65. package/out/_next/static/chunks/pages/index-64cfb8b0948ba8ef.js +0 -1
  66. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-b2a9d773ce5d7739.js +0 -1
  67. package/out/_next/static/chunks/pages/slices-e9c70c082ca3e3f9.js +0 -1
  68. package/src/features/customTypes/__tests__/createCustomType.test.ts +0 -159
  69. package/src/features/customTypes/customTypesTable/createCustomType.ts +0 -107
  70. package/test/components/CreateCustomTypeModal.test.tsx +0 -73
  71. /package/out/_next/static/{RRBm5bm2F__Ws0vsvXhN6 → W3x14bv5_NtxtSjAB0JUM}/_ssgManifest.js +0 -0
@@ -1,73 +0,0 @@
1
- // @vitest-environment jsdom
2
-
3
- import { describe, test, afterEach, expect, vi } from "vitest";
4
- import { Analytics } from "@segment/analytics-node";
5
-
6
- import { render, fireEvent, act } from "../__testutils__";
7
- import { CreateCustomTypeModal } from "../../components/Forms/CreateCustomTypeModal";
8
- import { ModalKeysEnum } from "../../src/modules/modal/types";
9
-
10
- vi.mock("next/router", () => require("next-router-mock"));
11
- global.console = { ...global.console, error: vi.fn() };
12
-
13
- describe("CreateCustomTypeModal", () => {
14
- afterEach(() => {
15
- vi.clearAllMocks();
16
- });
17
-
18
- test("when a slice is created the tracker should be called", async () => {
19
- const fakeId = "testing_id";
20
- const fakeName = "testing-name";
21
- const fakeRepo = "foo";
22
-
23
- render(<CreateCustomTypeModal format="custom" />, {
24
- preloadedState: {
25
- // @ts-expect-error TS(2739) FIXME: Type '{ repo: string; }' is missing the following ... Remove this comment to see the full error message
26
- environment: {
27
- repo: fakeRepo,
28
- },
29
- availableCustomTypes: {},
30
- // @ts-expect-error TS(2740) FIXME: Type '{ CREATE_CUSTOM_TYPE: true; }' is missing th... Remove this comment to see the full error message
31
- modal: { [ModalKeysEnum.CREATE_CUSTOM_TYPE]: true },
32
- },
33
- });
34
-
35
- const idInput = document.querySelector('[name="id"]');
36
- const labelInput = document.querySelector('[name="label"]');
37
- const submitButton = document.querySelector('[type="submit"]');
38
-
39
- await act(async () => {
40
- if (labelInput) {
41
- fireEvent.change(labelInput, { target: { value: fakeName } });
42
- }
43
- });
44
-
45
- await act(async () => {
46
- if (idInput) {
47
- fireEvent.change(idInput, { target: { value: fakeId } });
48
- }
49
- });
50
-
51
- await act(async () => {
52
- if (submitButton) {
53
- fireEvent.click(submitButton);
54
- }
55
- });
56
-
57
- expect(Analytics.prototype.track).toHaveBeenCalledOnce();
58
- expect(Analytics.prototype.track).toHaveBeenCalledWith(
59
- expect.objectContaining({
60
- event: "SliceMachine Custom Type Created",
61
- properties: {
62
- id: fakeId,
63
- name: fakeName,
64
- format: "custom",
65
- type: "repeatable",
66
- nodeVersion: process.versions.node,
67
- origin: "table",
68
- },
69
- }),
70
- expect.any(Function),
71
- );
72
- });
73
- });