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.
- package/components/DeleteSliceModal/index.tsx +34 -24
- package/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx +61 -38
- package/components/Forms/RenameCustomTypeModal/RenameCustomTypeModal.tsx +2 -2
- package/components/Forms/RenameSliceModal/RenameSliceModal.tsx +33 -21
- package/components/Navigation/ChangesListItem.tsx +14 -32
- package/out/404.html +1 -1
- package/out/_next/static/W3x14bv5_NtxtSjAB0JUM/_buildManifest.js +1 -0
- package/out/_next/static/chunks/{183-aab7066c73ebde44.js → 183-4feb6bb3eddbc768.js} +1 -1
- package/out/_next/static/chunks/25-01f422cea8066349.js +1 -0
- package/out/_next/static/chunks/{318-2112803ca34b2f49.js → 318-34a2dea7cfd4661d.js} +1 -1
- package/out/_next/static/chunks/727-358d7fae68a880b3.js +1 -0
- package/out/_next/static/chunks/799-d95a93e965557aeb.js +1 -0
- package/out/_next/static/chunks/904-1ff7519adece2b55.js +1 -0
- package/out/_next/static/chunks/pages/{_app-9f3513533bb2dfb8.js → _app-a2fa2db79a1e9a1e.js} +37 -37
- package/out/_next/static/chunks/pages/{changes-2a976f9efeb719aa.js → changes-92c84f6cac0285fd.js} +1 -1
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-3f862ad6111a1fc0.js → [customTypeId]-97ab3b90b85d645d.js} +1 -1
- package/out/_next/static/chunks/pages/{custom-types-94b8f8dbf7727412.js → custom-types-3c8e721ec6802127.js} +1 -1
- package/out/_next/static/chunks/pages/index-cf93d16e9c63b6db.js +1 -0
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-d1ffca11c42f2603.js → [pageTypeId]-84a22c5e480d3fa9.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-897ca93c114a1435.js → simulator-52c3e1f9d14160b8.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-608d206d10a719e3.js +1 -0
- package/out/_next/static/chunks/pages/slices-b0b58192a87df822.js +1 -0
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +3 -3
- package/pages/slices.tsx +20 -8
- package/src/apiClient.ts +1 -22
- package/src/domain/__tests__/customType.test.ts +179 -0
- package/src/domain/customType.ts +110 -2
- package/src/domain/slice.ts +38 -0
- package/src/features/customTypes/PageTypeOnboarding.tsx +21 -26
- package/src/features/customTypes/actions/convertCustomToPageType.ts +14 -10
- package/src/features/customTypes/actions/createCustomType.ts +69 -0
- package/src/features/customTypes/actions/deleteCustomType.ts +13 -3
- package/src/features/customTypes/actions/renameCustomType.ts +10 -4
- package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +3 -1
- package/src/features/customTypes/customTypesTable/CustomTypesTable.tsx +8 -8
- package/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +18 -17
- package/src/features/slices/actions/createSlice.ts +5 -29
- package/src/features/slices/actions/deleteSlice.ts +33 -0
- package/src/features/slices/actions/renameSlice.ts +37 -0
- package/src/modules/availableCustomTypes/index.ts +29 -135
- package/src/modules/loading/types.ts +0 -5
- package/src/modules/modal/types.ts +0 -3
- package/src/modules/slices/index.ts +27 -193
- package/src/modules/slices/selector.ts +0 -14
- package/src/modules/useSliceMachineActions.ts +70 -89
- package/src/modules/userContext/index.ts +3 -3
- package/src/redux/saga.ts +0 -4
- package/test/src/modules/availableCustomTypes/index.test.ts +2 -243
- package/test/src/modules/slices.test.ts +1 -267
- package/out/_next/static/RRBm5bm2F__Ws0vsvXhN6/_buildManifest.js +0 -1
- package/out/_next/static/chunks/25-37d6fa7f064be04b.js +0 -1
- package/out/_next/static/chunks/727-3a3bc32518778317.js +0 -1
- package/out/_next/static/chunks/731-501990ebe6a71b32.js +0 -1
- package/out/_next/static/chunks/904-9a4c1264727ae89a.js +0 -1
- package/out/_next/static/chunks/pages/index-64cfb8b0948ba8ef.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-b2a9d773ce5d7739.js +0 -1
- package/out/_next/static/chunks/pages/slices-e9c70c082ca3e3f9.js +0 -1
- package/src/features/customTypes/__tests__/createCustomType.test.ts +0 -159
- package/src/features/customTypes/customTypesTable/createCustomType.ts +0 -107
- package/test/components/CreateCustomTypeModal.test.tsx +0 -73
- /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
|
-
});
|
|
File without changes
|