slice-machine-ui 1.23.2-beta.4 → 1.23.2-beta.6
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/RenameSliceModal/RenameSliceModal.tsx +33 -21
- package/out/404.html +1 -1
- package/out/_next/static/chunks/25-01f422cea8066349.js +1 -0
- 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-4a63c0e108026c4d.js → _app-fc26eeb48d6b42ce.js} +37 -37
- 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-ca194b18d0e3930d.js → index-cf93d16e9c63b6db.js} +1 -1
- 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/_next/static/{GqPZYfMQrQUPwvgI_rvdq → y29BInt77vPZ4FQmk4-Xa}/_buildManifest.js +1 -1
- 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/slice.ts +38 -0
- 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 +3 -3
- package/src/modules/loading/types.ts +0 -2
- package/src/modules/modal/types.ts +0 -2
- package/src/modules/slices/index.ts +27 -193
- package/src/modules/slices/selector.ts +0 -14
- package/src/modules/useSliceMachineActions.ts +25 -38
- package/src/redux/saga.ts +0 -2
- package/test/src/modules/availableCustomTypes/index.test.ts +0 -89
- package/test/src/modules/slices.test.ts +1 -267
- package/out/_next/static/chunks/25-37d6fa7f064be04b.js +0 -1
- package/out/_next/static/chunks/727-c5028806448c4387.js +0 -1
- package/out/_next/static/chunks/731-341869976a48a09a.js +0 -1
- package/out/_next/static/chunks/904-833eed675f19ab60.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-2d3d84de925b289e.js +0 -1
- package/out/_next/static/chunks/pages/slices-e9c70c082ca3e3f9.js +0 -1
- /package/out/_next/static/{GqPZYfMQrQUPwvgI_rvdq → y29BInt77vPZ4FQmk4-Xa}/_ssgManifest.js +0 -0
|
@@ -25,11 +25,11 @@ import {
|
|
|
25
25
|
customTypeSaveSuccess,
|
|
26
26
|
} from "./availableCustomTypes";
|
|
27
27
|
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
sliceCreateSuccess,
|
|
29
|
+
sliceDeleteSuccess,
|
|
30
|
+
sliceGenerateCustomScreenshotSuccess,
|
|
31
|
+
sliceUpdateSuccess,
|
|
32
|
+
sliceRenameSuccess,
|
|
33
33
|
} from "./slices";
|
|
34
34
|
import { UserContextStoreType, UserReviewType } from "./userContext/types";
|
|
35
35
|
import { GenericToastTypes, openToasterCreator } from "./toaster";
|
|
@@ -39,6 +39,7 @@ import { ComponentUI, ScreenshotUI } from "../../lib/models/common/ComponentUI";
|
|
|
39
39
|
import { saveSliceMockCreator } from "./simulator";
|
|
40
40
|
import { SaveSliceMockRequest } from "@src/apiClient";
|
|
41
41
|
import { LibraryUI } from "@lib/models/common/LibraryUI";
|
|
42
|
+
import { SliceSM } from "@lib/models/common/Slice";
|
|
42
43
|
|
|
43
44
|
const useSliceMachineActions = () => {
|
|
44
45
|
const dispatch = useDispatch();
|
|
@@ -61,12 +62,8 @@ const useSliceMachineActions = () => {
|
|
|
61
62
|
dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.LOGIN }));
|
|
62
63
|
const openScreenshotsModal = () =>
|
|
63
64
|
dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.SCREENSHOTS }));
|
|
64
|
-
const openRenameSliceModal = () =>
|
|
65
|
-
dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.RENAME_SLICE }));
|
|
66
65
|
const openScreenshotPreviewModal = () =>
|
|
67
66
|
dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.SCREENSHOT_PREVIEW }));
|
|
68
|
-
const openDeleteSliceModal = () =>
|
|
69
|
-
dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.DELETE_SLICE }));
|
|
70
67
|
const openSimulatorSetupModal = () =>
|
|
71
68
|
dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.SIMULATOR_SETUP }));
|
|
72
69
|
|
|
@@ -101,28 +98,6 @@ const useSliceMachineActions = () => {
|
|
|
101
98
|
dispatch(hasSeenTutorialsToolTipCreator());
|
|
102
99
|
const setSeenChangesToolTip = () => dispatch(hasSeenChangesToolTipCreator());
|
|
103
100
|
|
|
104
|
-
const renameSlice = (
|
|
105
|
-
libName: string,
|
|
106
|
-
sliceId: string,
|
|
107
|
-
newSliceName: string,
|
|
108
|
-
) =>
|
|
109
|
-
dispatch(
|
|
110
|
-
renameSliceCreator.request({
|
|
111
|
-
sliceId,
|
|
112
|
-
newSliceName,
|
|
113
|
-
libName,
|
|
114
|
-
}),
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
const deleteSlice = (sliceId: string, sliceName: string, libName: string) =>
|
|
118
|
-
dispatch(
|
|
119
|
-
deleteSliceCreator.request({
|
|
120
|
-
sliceId,
|
|
121
|
-
sliceName,
|
|
122
|
-
libName,
|
|
123
|
-
}),
|
|
124
|
-
);
|
|
125
|
-
|
|
126
101
|
// Toaster store
|
|
127
102
|
const openToaster = (
|
|
128
103
|
content: string | React.ReactNode,
|
|
@@ -190,7 +165,7 @@ const useSliceMachineActions = () => {
|
|
|
190
165
|
*/
|
|
191
166
|
const saveSliceSuccess = (component: ComponentUI) => {
|
|
192
167
|
dispatch(
|
|
193
|
-
|
|
168
|
+
sliceUpdateSuccess({
|
|
194
169
|
component,
|
|
195
170
|
}),
|
|
196
171
|
);
|
|
@@ -201,7 +176,7 @@ const useSliceMachineActions = () => {
|
|
|
201
176
|
component: ComponentUI,
|
|
202
177
|
) => {
|
|
203
178
|
dispatch(
|
|
204
|
-
|
|
179
|
+
sliceGenerateCustomScreenshotSuccess({
|
|
205
180
|
variationId,
|
|
206
181
|
screenshot,
|
|
207
182
|
component,
|
|
@@ -209,7 +184,21 @@ const useSliceMachineActions = () => {
|
|
|
209
184
|
);
|
|
210
185
|
};
|
|
211
186
|
const createSliceSuccess = (libraries: readonly LibraryUI[]) =>
|
|
212
|
-
dispatch(
|
|
187
|
+
dispatch(sliceCreateSuccess({ libraries }));
|
|
188
|
+
const deleteSliceSuccess = (sliceId: string, libName: string) =>
|
|
189
|
+
dispatch(
|
|
190
|
+
sliceDeleteSuccess({
|
|
191
|
+
sliceId,
|
|
192
|
+
libName,
|
|
193
|
+
}),
|
|
194
|
+
);
|
|
195
|
+
const renameSliceSuccess = (libName: string, renamedSlice: SliceSM) =>
|
|
196
|
+
dispatch(
|
|
197
|
+
sliceRenameSuccess({
|
|
198
|
+
renamedSlice,
|
|
199
|
+
libName,
|
|
200
|
+
}),
|
|
201
|
+
);
|
|
213
202
|
|
|
214
203
|
/**
|
|
215
204
|
* Changes module
|
|
@@ -234,8 +223,8 @@ const useSliceMachineActions = () => {
|
|
|
234
223
|
saveSliceSuccess,
|
|
235
224
|
saveSliceCustomScreenshotSuccess,
|
|
236
225
|
createSliceSuccess,
|
|
237
|
-
|
|
238
|
-
|
|
226
|
+
renameSliceSuccess,
|
|
227
|
+
deleteSliceSuccess,
|
|
239
228
|
sendAReview,
|
|
240
229
|
skipReview,
|
|
241
230
|
setUpdatesViewed,
|
|
@@ -243,9 +232,7 @@ const useSliceMachineActions = () => {
|
|
|
243
232
|
setSeenSimulatorToolTip,
|
|
244
233
|
setSeenChangesToolTip,
|
|
245
234
|
openScreenshotPreviewModal,
|
|
246
|
-
openDeleteSliceModal,
|
|
247
235
|
openSimulatorSetupModal,
|
|
248
|
-
openRenameSliceModal,
|
|
249
236
|
closeModals,
|
|
250
237
|
openToaster,
|
|
251
238
|
saveSliceMock,
|
package/src/redux/saga.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { fork } from "redux-saga/effects";
|
|
2
2
|
|
|
3
3
|
import { watchSimulatorSagas } from "@src/modules/simulator";
|
|
4
|
-
import { watchSliceSagas } from "@src/modules/slices";
|
|
5
4
|
import { watchToasterSagas } from "@src/modules/toaster";
|
|
6
5
|
import { watchChangelogSagas } from "@src/modules/environment";
|
|
7
6
|
|
|
8
7
|
// Single entry point to start all Sagas at once
|
|
9
8
|
export default function* rootSaga() {
|
|
10
9
|
yield fork(watchSimulatorSagas);
|
|
11
|
-
yield fork(watchSliceSagas);
|
|
12
10
|
yield fork(watchToasterSagas);
|
|
13
11
|
yield fork(watchChangelogSagas);
|
|
14
12
|
}
|
|
@@ -3,8 +3,6 @@ import { describe, expect, it } from "vitest";
|
|
|
3
3
|
import { availableCustomTypesReducer } from "@src/modules/availableCustomTypes";
|
|
4
4
|
import { AvailableCustomTypesStoreType } from "@src/modules/availableCustomTypes/types";
|
|
5
5
|
import { refreshStateCreator } from "@src/modules/environment";
|
|
6
|
-
import { CustomTypeSM } from "@lib/models/common/CustomType";
|
|
7
|
-
import { deleteSliceCreator } from "@src/modules/slices";
|
|
8
6
|
|
|
9
7
|
import { dummyServerState } from "../__fixtures__/serverState";
|
|
10
8
|
|
|
@@ -47,92 +45,5 @@ describe("[Available Custom types module]", () => {
|
|
|
47
45
|
},
|
|
48
46
|
});
|
|
49
47
|
});
|
|
50
|
-
|
|
51
|
-
it("should update the custom types state given SLICES/DELETE.SUCCESS action", () => {
|
|
52
|
-
const sliceToDeleteId = "slice_id";
|
|
53
|
-
const mockCustomTypeToUpdate: CustomTypeSM = {
|
|
54
|
-
id: "id",
|
|
55
|
-
label: "lama",
|
|
56
|
-
repeatable: false,
|
|
57
|
-
status: true,
|
|
58
|
-
format: "custom",
|
|
59
|
-
tabs: [
|
|
60
|
-
{
|
|
61
|
-
key: "Main",
|
|
62
|
-
value: [],
|
|
63
|
-
sliceZone: {
|
|
64
|
-
key: "slices",
|
|
65
|
-
value: [
|
|
66
|
-
{
|
|
67
|
-
key: sliceToDeleteId,
|
|
68
|
-
value: {
|
|
69
|
-
type: "SharedSlice",
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
key: "slice_2",
|
|
74
|
-
value: {
|
|
75
|
-
type: "SharedSlice",
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const originalState = { ...dummyCustomTypesState };
|
|
85
|
-
|
|
86
|
-
originalState["id"] = {
|
|
87
|
-
local: mockCustomTypeToUpdate,
|
|
88
|
-
remote: mockCustomTypeToUpdate,
|
|
89
|
-
};
|
|
90
|
-
const action = deleteSliceCreator.success({
|
|
91
|
-
sliceId: sliceToDeleteId,
|
|
92
|
-
sliceName: "slice_name",
|
|
93
|
-
libName: "lib",
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const result = availableCustomTypesReducer(
|
|
97
|
-
originalState,
|
|
98
|
-
action,
|
|
99
|
-
) as AvailableCustomTypesStoreType;
|
|
100
|
-
|
|
101
|
-
expect(
|
|
102
|
-
Object.values(result).flatMap((localAndRemote) => {
|
|
103
|
-
return Object.values(localAndRemote);
|
|
104
|
-
}),
|
|
105
|
-
).not.toContain(undefined);
|
|
106
|
-
|
|
107
|
-
expect(result).toEqual({
|
|
108
|
-
id: {
|
|
109
|
-
local: {
|
|
110
|
-
id: "id",
|
|
111
|
-
label: "lama",
|
|
112
|
-
repeatable: false,
|
|
113
|
-
status: true,
|
|
114
|
-
format: "custom",
|
|
115
|
-
tabs: [
|
|
116
|
-
{
|
|
117
|
-
key: "Main",
|
|
118
|
-
value: [],
|
|
119
|
-
sliceZone: {
|
|
120
|
-
key: "slices",
|
|
121
|
-
value: [
|
|
122
|
-
{
|
|
123
|
-
key: "slice_2",
|
|
124
|
-
value: {
|
|
125
|
-
type: "SharedSlice",
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
},
|
|
133
|
-
remote: mockCustomTypeToUpdate,
|
|
134
|
-
},
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
48
|
});
|
|
138
49
|
});
|
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
// @vitest-environment jsdom
|
|
2
2
|
|
|
3
3
|
import { describe, expect, it } from "vitest";
|
|
4
|
-
import {
|
|
5
|
-
slicesReducer,
|
|
6
|
-
deleteSliceCreator,
|
|
7
|
-
// getFrontendSlices,
|
|
8
|
-
deleteSliceSaga,
|
|
9
|
-
} from "@src/modules/slices";
|
|
10
|
-
import { testSaga } from "redux-saga-test-plan";
|
|
11
|
-
|
|
12
|
-
import { deleteSlice } from "@src/apiClient";
|
|
13
|
-
import { modalCloseCreator } from "@src/modules/modal";
|
|
4
|
+
import { slicesReducer } from "@src/modules/slices";
|
|
14
5
|
import { SlicesStoreType } from "@src/modules/slices/types";
|
|
15
|
-
import { openToasterCreator, ToasterType } from "@src/modules/toaster";
|
|
16
|
-
import { LibraryUI } from "@lib/models/common/LibraryUI";
|
|
17
|
-
// import { generateComponentUI, generateLibraryUI, generateSliceSM } from "./__fixtures__/sliceUtilsFactory";
|
|
18
|
-
// import { SliceMachineStoreType } from "@src/redux/type";
|
|
19
6
|
|
|
20
7
|
const dummySlicesState: SlicesStoreType = {
|
|
21
8
|
libraries: [],
|
|
@@ -35,258 +22,5 @@ describe("[Slices module]", () => {
|
|
|
35
22
|
dummySlicesState,
|
|
36
23
|
);
|
|
37
24
|
});
|
|
38
|
-
|
|
39
|
-
it("should update the slice state given SLICES/DELETE.SUCCESS action", () => {
|
|
40
|
-
const sliceIdToDelete = "id";
|
|
41
|
-
const sliceNameToDelete = "slice-name";
|
|
42
|
-
const libName = "libName";
|
|
43
|
-
|
|
44
|
-
const originalState = { ...dummySlicesState };
|
|
45
|
-
|
|
46
|
-
originalState["libraries"] = [
|
|
47
|
-
{
|
|
48
|
-
name: libName,
|
|
49
|
-
isLocal: true,
|
|
50
|
-
components: [
|
|
51
|
-
{ model: { id: sliceIdToDelete } },
|
|
52
|
-
{ model: { id: "second-slice" } },
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
] as unknown as LibraryUI[];
|
|
56
|
-
|
|
57
|
-
const action = deleteSliceCreator.success({
|
|
58
|
-
sliceId: sliceIdToDelete,
|
|
59
|
-
libName,
|
|
60
|
-
sliceName: sliceNameToDelete,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const result = slicesReducer(originalState, action);
|
|
64
|
-
|
|
65
|
-
const expectState = { ...originalState };
|
|
66
|
-
expectState["libraries"] = [
|
|
67
|
-
{
|
|
68
|
-
name: libName,
|
|
69
|
-
isLocal: true,
|
|
70
|
-
components: [{ model: { id: "second-slice" } }],
|
|
71
|
-
},
|
|
72
|
-
] as unknown as LibraryUI[];
|
|
73
|
-
|
|
74
|
-
expect(result).toEqual(expectState);
|
|
75
|
-
});
|
|
76
25
|
});
|
|
77
|
-
|
|
78
|
-
// describe("[renameSliceSaga]", () => {
|
|
79
|
-
// it("should call the api and dispatch the good actions", () => {
|
|
80
|
-
// const actionPayload = {
|
|
81
|
-
// sliceId: "MySlice",
|
|
82
|
-
// libName: "MyLib/Components",
|
|
83
|
-
// newSliceName: "MyNewSlice",
|
|
84
|
-
// };
|
|
85
|
-
// const saga = testSaga(
|
|
86
|
-
// renameSliceSaga,
|
|
87
|
-
// renameSliceCreator.request(actionPayload)
|
|
88
|
-
// );
|
|
89
|
-
|
|
90
|
-
// saga
|
|
91
|
-
// .next()
|
|
92
|
-
// .call(
|
|
93
|
-
// renameSlice,
|
|
94
|
-
// actionPayload.sliceId,
|
|
95
|
-
// actionPayload.newSliceName,
|
|
96
|
-
// actionPayload.libName
|
|
97
|
-
// );
|
|
98
|
-
// saga.next().put(
|
|
99
|
-
// renameSliceCreator.success({
|
|
100
|
-
// libName: actionPayload.libName,
|
|
101
|
-
// sliceId: actionPayload.sliceId,
|
|
102
|
-
// newSliceName: actionPayload.newSliceName,
|
|
103
|
-
// })
|
|
104
|
-
// );
|
|
105
|
-
// saga.next().put(modalCloseCreator());
|
|
106
|
-
// saga.next().put(
|
|
107
|
-
// openToasterCreator({
|
|
108
|
-
// content: "Slice name updated",
|
|
109
|
-
// type: ToasterType.SUCCESS,
|
|
110
|
-
// })
|
|
111
|
-
// );
|
|
112
|
-
// saga.next().isDone();
|
|
113
|
-
// });
|
|
114
|
-
// });
|
|
115
|
-
|
|
116
|
-
describe("[deleteSliceSaga]", () => {
|
|
117
|
-
it("should call the api and dispatch the good actions on success", () => {
|
|
118
|
-
const actionPayload = {
|
|
119
|
-
sliceId: "id",
|
|
120
|
-
sliceName: "name",
|
|
121
|
-
libName: "lib",
|
|
122
|
-
};
|
|
123
|
-
const saga = testSaga(
|
|
124
|
-
deleteSliceSaga,
|
|
125
|
-
deleteSliceCreator.request(actionPayload),
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
saga
|
|
129
|
-
.next()
|
|
130
|
-
.call(deleteSlice, actionPayload.sliceId, actionPayload.libName);
|
|
131
|
-
saga.next({ errors: [] }).put(deleteSliceCreator.success(actionPayload));
|
|
132
|
-
saga.next().put(
|
|
133
|
-
openToasterCreator({
|
|
134
|
-
content: `Successfully deleted Slice “${actionPayload.sliceName}”`,
|
|
135
|
-
type: ToasterType.SUCCESS,
|
|
136
|
-
}),
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
saga.next().put(modalCloseCreator());
|
|
140
|
-
saga.next().isDone();
|
|
141
|
-
});
|
|
142
|
-
it("should call the api and dispatch the good actions on unknown failure", () => {
|
|
143
|
-
const actionPayload = {
|
|
144
|
-
sliceId: "id",
|
|
145
|
-
sliceName: "name",
|
|
146
|
-
libName: "lib",
|
|
147
|
-
};
|
|
148
|
-
const saga = testSaga(
|
|
149
|
-
deleteSliceSaga,
|
|
150
|
-
deleteSliceCreator.request(actionPayload),
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
saga
|
|
154
|
-
.next()
|
|
155
|
-
.call(deleteSlice, actionPayload.sliceId, actionPayload.libName);
|
|
156
|
-
saga.throw(new Error()).put(
|
|
157
|
-
openToasterCreator({
|
|
158
|
-
content: "An unexpected error happened while deleting your slice.",
|
|
159
|
-
type: ToasterType.ERROR,
|
|
160
|
-
}),
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
saga.next().put(modalCloseCreator());
|
|
164
|
-
saga.next().isDone();
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
// describe("[Selectors]", () => {
|
|
169
|
-
// describe.only("getLocallyDeletedSlices", () => {
|
|
170
|
-
// it("works as expected", () => {
|
|
171
|
-
// const l1 = generateLibraryUI({
|
|
172
|
-
// components: [
|
|
173
|
-
// generateComponentUI({
|
|
174
|
-
// model: generateSliceSM({ id: "1" }),
|
|
175
|
-
// }),
|
|
176
|
-
// generateComponentUI({
|
|
177
|
-
// model: generateSliceSM({ id: "2" }),
|
|
178
|
-
// }),
|
|
179
|
-
// generateComponentUI({
|
|
180
|
-
// model: generateSliceSM({ id: "3" }),
|
|
181
|
-
// }),
|
|
182
|
-
// ],
|
|
183
|
-
// });
|
|
184
|
-
// const l2 = generateLibraryUI({
|
|
185
|
-
// components: [
|
|
186
|
-
// generateComponentUI({
|
|
187
|
-
// model: generateSliceSM({ id: "4" }),
|
|
188
|
-
// }),
|
|
189
|
-
// generateComponentUI({
|
|
190
|
-
// model: generateSliceSM({ id: "5" }),
|
|
191
|
-
// }),
|
|
192
|
-
// ],
|
|
193
|
-
// });
|
|
194
|
-
|
|
195
|
-
// const remoteSlices = [
|
|
196
|
-
// generateSliceSM({ id: "1" }),
|
|
197
|
-
// generateSliceSM({ id: "3" }),
|
|
198
|
-
// generateSliceSM({ id: "4" }),
|
|
199
|
-
// generateSliceSM({ id: "6" }),
|
|
200
|
-
// ];
|
|
201
|
-
|
|
202
|
-
// const frontendSlices = getFrontendSlices({
|
|
203
|
-
// slices: { libraries: [l1, l2], remoteSlices },
|
|
204
|
-
// } as unknown as SliceMachineStoreType);
|
|
205
|
-
|
|
206
|
-
// // it combines slices from all the local libraries
|
|
207
|
-
// // it combines local and remote only libraries
|
|
208
|
-
// // it maps the correct remote slice if found
|
|
209
|
-
// expect(frontendSlices.length).toEqual(6);
|
|
210
|
-
// expect(frontendSlices.map((s) => s.local?.id)).toEqual([
|
|
211
|
-
// "1",
|
|
212
|
-
// "2",
|
|
213
|
-
// "3",
|
|
214
|
-
// "4",
|
|
215
|
-
// "5",
|
|
216
|
-
// undefined,
|
|
217
|
-
// ]);
|
|
218
|
-
// expect(frontendSlices.map((s) => s.remote?.id)).toEqual([
|
|
219
|
-
// "1",
|
|
220
|
-
// undefined,
|
|
221
|
-
// "3",
|
|
222
|
-
// "4",
|
|
223
|
-
// undefined,
|
|
224
|
-
// "6",
|
|
225
|
-
// ]);
|
|
226
|
-
// });
|
|
227
|
-
// });
|
|
228
|
-
// });
|
|
229
26
|
});
|
|
230
|
-
|
|
231
|
-
// describe("[utils]", () => {
|
|
232
|
-
// const PREV_NAME = "SliceName";
|
|
233
|
-
// const NEW_NAME = "SliceRenamed";
|
|
234
|
-
// it("test renameScreenshots", () => {
|
|
235
|
-
// const initialPaths: Record<string, ScreenshotUI> = {
|
|
236
|
-
// "default-variation": createScreenshotUI(PREV_NAME, "default-variation"),
|
|
237
|
-
// "other-variation": createScreenshotUI(PREV_NAME, "other-variation"),
|
|
238
|
-
// };
|
|
239
|
-
// const expectedRenamedPaths: Record<string, ScreenshotUI> = {
|
|
240
|
-
// "default-variation": createScreenshotUI(NEW_NAME, "default-variation"),
|
|
241
|
-
// "other-variation": createScreenshotUI(NEW_NAME, "other-variation"),
|
|
242
|
-
// };
|
|
243
|
-
// expect(renameScreenshots(initialPaths, PREV_NAME, NEW_NAME)).toEqual(
|
|
244
|
-
// expectedRenamedPaths
|
|
245
|
-
// );
|
|
246
|
-
// });
|
|
247
|
-
|
|
248
|
-
// it("test renameScreenshotUrls", () => {
|
|
249
|
-
// const initialUrls: Screenshots = {
|
|
250
|
-
// "default-variation": {
|
|
251
|
-
// hash: "xxx",
|
|
252
|
-
// path: `../../e2e-projects/next/.slicemachine/assets/slices/ecommerce/${PREV_NAME}/default-variation/preview.png`,
|
|
253
|
-
// url: `http://localhost:9999/api/__preview?q=..%2F..%2Fe2e-projects%2Fnext%2F.slicemachine%2Fassets%2Fslices%2Fecommerce%2F${PREV_NAME}%2Fdefault-slice%2Fpreview.png&uniq=0.39230892472268586`,
|
|
254
|
-
// },
|
|
255
|
-
// "other-variation": {
|
|
256
|
-
// hash: "xxx",
|
|
257
|
-
// path: `../../e2e-projects/next/.slicemachine/assets/slices/ecommerce/${PREV_NAME}/other-variation/preview.png`,
|
|
258
|
-
// url: `http://localhost:9999/api/__preview?q=..%2F..%2Fe2e-projects%2Fnext%2F.slicemachine%2Fassets%2Fslices%2Fecommerce%2F${PREV_NAME}%2Fdefault-slice%2Fpreview.png&uniq=0.39230892472268586`,
|
|
259
|
-
// },
|
|
260
|
-
// };
|
|
261
|
-
// const expectedRenamedUrls: Screenshots = {
|
|
262
|
-
// "default-variation": {
|
|
263
|
-
// hash: "xxx",
|
|
264
|
-
// path: `../../e2e-projects/next/.slicemachine/assets/slices/ecommerce/${NEW_NAME}/default-variation/preview.png`,
|
|
265
|
-
// url: `http://localhost:9999/api/__preview?q=..%2F..%2Fe2e-projects%2Fnext%2F.slicemachine%2Fassets%2Fslices%2Fecommerce%2F${NEW_NAME}%2Fdefault-slice%2Fpreview.png&uniq=0.39230892472268586`,
|
|
266
|
-
// },
|
|
267
|
-
// "other-variation": {
|
|
268
|
-
// hash: "xxx",
|
|
269
|
-
// path: `../../e2e-projects/next/.slicemachine/assets/slices/ecommerce/${NEW_NAME}/other-variation/preview.png`,
|
|
270
|
-
// url: `http://localhost:9999/api/__preview?q=..%2F..%2Fe2e-projects%2Fnext%2F.slicemachine%2Fassets%2Fslices%2Fecommerce%2F${NEW_NAME}%2Fdefault-slice%2Fpreview.png&uniq=0.39230892472268586`,
|
|
271
|
-
// },
|
|
272
|
-
// };
|
|
273
|
-
// expect(renameScreenshots(initialUrls, PREV_NAME, NEW_NAME)).toEqual(
|
|
274
|
-
// expectedRenamedUrls
|
|
275
|
-
// );
|
|
276
|
-
// });
|
|
277
|
-
// it("test renameModel", () => {
|
|
278
|
-
// const initialModel: SliceSM = {
|
|
279
|
-
// id: "slice_id",
|
|
280
|
-
// name: PREV_NAME,
|
|
281
|
-
// type: "SharedSlice",
|
|
282
|
-
// variations: [],
|
|
283
|
-
// };
|
|
284
|
-
// const expectedModel: SliceSM = {
|
|
285
|
-
// id: "slice_id",
|
|
286
|
-
// name: NEW_NAME,
|
|
287
|
-
// type: "SharedSlice",
|
|
288
|
-
// variations: [],
|
|
289
|
-
// };
|
|
290
|
-
// expect(renameModel(initialModel, NEW_NAME)).toEqual(expectedModel);
|
|
291
|
-
// });
|
|
292
|
-
// });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25],{54132:function(e,n,t){"use strict";t.d(n,{Z:function(){return s}});var o=t(62230),i=t(85244),r=t(98240),d=t(52322);t(2784);var c=t(75289),a=function(e){var n=e.bg,t=e.background,i=e.sx,r=e.withRadius,a=e.radius,s=e.children;return(0,d.jsx)(c.xu,{sx:(0,o.Z)({p:4,bg:n||t},r?{borderBottomLeftRadius:a,borderBottomRightRadius:a}:null,i),children:s})},s=function(e){var n=e.Header,t=void 0===n?null:n,s=e.SubHeader,l=void 0===s?null:s,u=e.Body,v=void 0===u?null:u,f=e.Footer,h=void 0===f?null:f,m=e.borderFooter,p=e.radius,b=void 0===p?"6px":p,x=e.bodySx,Z=e.footerSx,g=e.sx,_=e.bg,y=e.background,C=e.children,j=(0,r.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,d.jsxs)(c.Zb,(0,i.Z)((0,o.Z)({sx:(0,o.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:b},void 0===g?null:g)},j),{children:[t?(0,d.jsx)(t,{radius:b}):null,l?(0,d.jsx)(l,{radius:b}):null,(0,d.jsxs)(a,{bg:_,background:y,sx:void 0===x?{}:x,withRadius:!h,children:[v?(0,d.jsx)(v,{}):null,C||null]}),h?(0,d.jsx)(a,{bg:_,background:y,sx:(0,o.Z)({},void 0!==m&&m?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===Z?{}:Z),radius:b,withRadius:!0,children:"object"==typeof h?h:(0,d.jsx)(h,{})}):null]}))}},75329:function(e,n,t){"use strict";t.d(n,{Sn:function(){return c},lS:function(){return o},nG:function(){return i},pq:function(){return a},rd:function(){return d},xo:function(){return r}});var o=["components"],i=["png","jpg","jpeg"],r=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,d="placeholders/What_are_Slices_mrvome",c="SM_HELP_VIDEOS/mock_data",a="slice-machine-simulator"},24804:function(e,n,t){"use strict";t.d(n,{Zb:function(){return p},T$:function(){return x},eW:function(){return Z},ZB:function(){return b},Lm:function(){return g}});var o=t(67557),i=t(62230),r=t(85244),d=t(98240),c=t(52322),a=t(50002),s=t(22715),l=t(6277),u=t(2784);t(71457);var v={solid:"_1ecs97d3c _1ecs97dap _1ecs97d4pk _1ecs97d4wx",outlined:"_1ecs97d2i _1ecs97d9v _1ecs97dw _1ecs97d89 _1ecs97d2w _1ecs97da9 _1ecs97d4oq _1ecs97d4w3 _1ecs97d4oc _1ecs97d4vp"},f={div:"_1ecs97dez0 _1ecs97dez3 _1ecs97dezd",img:"kedahr9 _1ecs97df77 _1ecs97dezn"},h={small:"kedahr2",medium:"kedahr3"},m={solid:"kedahr4 _1ecs97d1u _1ecs97d97 _1ecs97d4pe _1ecs97d4wr",outlined:"kedahr5 _1ecs97d18 _1ecs97d8l _1ecs97d4o6 _1ecs97d4vj"},p=function(e){var n,t=e.checked,s=e.size,f=e.variant,p=void 0===f?"solid":f,b=(e.interactive,e.disabled,e.onClick,e.href,e.component),x=void 0===b?"a":b,Z=(e.replace,(0,d.Z)(e,["checked","size","variant","interactive","disabled","onClick","href","component","replace"])),g=(0,r.Z)((0,i.Z)({},Z),{className:(0,l.W)("_1ecs97dez0 _1ecs97dez2 _1ecs97dezb _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dez1 _1ecs97dezr _1ecs97dezv",h[void 0===s?"medium":s],m[p],(n={},(0,o.Z)(n,"kedahr6",e.interactive),(0,o.Z)(n,v[p],e.interactive),n)),"data-state":!0===(void 0!==t&&t)?"checked":void 0});return!0===e.interactive&&void 0===e.href?(0,c.jsx)("div",(0,r.Z)((0,i.Z)({},g),{"data-disabled":!0===e.disabled?"":void 0,onClick:function(n){if(!0!==e.disabled&&void 0!==e.onClick){var t=n.target;(0,a.JY)(t)===n.currentTarget&&e.onClick(n)}},tabIndex:!0===e.disabled?void 0:0})):!0===e.interactive?(0,u.createElement)(x,(0,i.Z)((0,r.Z)((0,i.Z)({},g),{href:e.href,onClick:function(e){var n=e.target;(0,a.JY)(n)!==e.currentTarget&&e.preventDefault()}}),"a"===x?{}:{replace:e.replace})):(0,c.jsx)("div",(0,i.Z)({},g))},b=function(e){var n=e.className,t=e.component,o=void 0===t?"img":t,a=e.overlay,s=(0,d.Z)(e,["className","component","overlay"]);return(0,c.jsxs)("div",{className:"kedahr7 _1ecs97dez0 _1ecs97dez2 _1ecs97dezb _1ecs97deze _1ecs97dezd _1ecs97df7d _1ecs97dezv",children:[(0,u.createElement)(o,(0,r.Z)((0,i.Z)({},s),{className:(0,l.W)(f[o],n)})),Boolean(a)?(0,c.jsx)("div",{className:"kedahra _1ecs97dez0 _1ecs97dez3 _1ecs97df9d _1ecs97dezt _1ecs97df0i",children:a}):void 0]})},x=function(e){return(0,c.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"kedahrc kedahrb _1ecs97dez0 _1ecs97dez2 _1ecs97dez8 _1ecs97dez1 _1ecs97dezc _1ecs97df71 _1ecs97dezi"}))},Z=function(e){var n=e.action,t=e.subtitle,o=e.title,a=(0,d.Z)(e,["action","subtitle","title"]);return(0,c.jsxs)("div",(0,r.Z)((0,i.Z)({},a),{className:"kedahrd kedahrb _1ecs97dez0 _1ecs97dez2 _1ecs97dez8 _1ecs97dez1 _1ecs97dezc _1ecs97df92 _1ecs97df73",children:[(0,c.jsxs)("div",{className:"kedahre _1ecs97dez0 _1ecs97dez2 _1ecs97dezb _1ecs97deze _1ecs97dezd _1ecs97df51",children:[(0,c.jsx)(s.xv,{component:"span",noWrap:!0,variant:"bold",children:o}),(0,c.jsx)(s.xv,{color:"grey11",component:"span",noWrap:!0,variant:"small",children:t})]}),n]}))},g=function(e){var n=e.children,t=(0,d.Z)(e,["children"]);return(0,c.jsx)("div",(0,r.Z)((0,i.Z)({},t),{className:"kedahrf _1ecs97dez0 _1ecs97dez2 _1ecs97dezb _1ecs97df6v _1ecs97dfb5 _1ecs97dezh _1ecs97dfhi _1ecs97dezt",children:(0,c.jsx)(s.xv,{align:"center",color:"inherit",component:"span",noWrap:!0,variant:"smallBold",children:n})}))}},5479:function(e,n,t){"use strict";t.d(n,{AK:function(){return f},Dj:function(){return s},Kp:function(){return v},L4:function(){return h},cx:function(){return a},d7:function(){return l},gR:function(){return p},ux:function(){return u},xS:function(){return m}});var o=t(67557),i=t(62230),r=t(85244),d=t(17064),c=t(81541);function a(e){return e.model.variations.length-Object.keys(e.screenshots).length}function s(e){var n,t,o;return null!==(o=null!==(t=null===(n=e.config)||void 0===n?void 0:n.label)&&void 0!==t?t:"Group"===e.type||"Slice"===e.type||"Boolean"!==e.type&&"Separator"!==e.type?e.fieldset:void 0)&&void 0!==o?o:e.type}function l(e,n){var t;return null===(t=e.screenshots[n.id])||void 0===t?void 0:t.url}function u(e,n){var t={},o={};if("type"in e){if("Slice"===e.type){for(var i in e["non-repeat"])t[i]=e["non-repeat"][i].type;for(var r in e.repeat)o[r]=e.repeat[r].type}else if("Group"===e.type)for(var d in null===(l=e.config)||void 0===l?void 0:l.fields)o[d]=null!==(v=null===(u=e.config)||void 0===u?void 0:u.fields[d].type)&&void 0!==v?v:"";else t[n]=e.type}else if("id"in e){var c=!0,a=!1,s=void 0;try{for(var l,u,v,f,h,m=(null!==(f=e.primary)&&void 0!==f?f:[])[Symbol.iterator]();!(c=(h=m.next()).done);c=!0){var p=h.value,b=p.key,x=p.value;t[b]=x.type}}catch(Z){a=!0,s=Z}finally{try{c||null==m.return||m.return()}finally{if(a)throw s}}var g=!0,_=!1,y=void 0;try{for(var C,j,k=(null!==(C=e.items)&&void 0!==C?C:[])[Symbol.iterator]();!(g=(j=k.next()).done);g=!0){var z=j.value,S=z.key,w=z.value;o[S]=w.type}}catch(I){_=!0,y=I}finally{try{g||null==k.return||k.return()}finally{if(_)throw y}}}return{primary:JSON.stringify(Object.keys(t).sort().map(function(e){return[e,t[e]]})),items:JSON.stringify(Object.keys(o).sort().map(function(e){return[e,o[e]]}))}}function v(e){var n=e.slice,t=e.id,o=e.name,d=e.copiedVariation,c=(0,r.Z)((0,i.Z)({},d),{id:t,name:o});return{slice:(0,r.Z)((0,i.Z)({},n),{model:(0,r.Z)((0,i.Z)({},n.model),{variations:n.model.variations.concat([c])})}),variation:c}}function f(e){var n=e.slice,t=e.variationId,d=e.widgetArea,c=e.fieldId;return(0,r.Z)((0,i.Z)({},n),{model:(0,r.Z)((0,i.Z)({},n.model),{variations:n.model.variations.map(function(e){if(e.id===t){var n;return(0,r.Z)((0,i.Z)({},e),(0,o.Z)({},d,null===(n=e[d])||void 0===n?void 0:n.filter(function(e){return e.key!==c})))}return e})})})}function h(e){var n=e.slice,t=e.variationId,d=e.widgetArea,c=e.previousFieldId,a=e.newFieldId,s=e.newField;return(0,r.Z)((0,i.Z)({},n),{model:(0,r.Z)((0,i.Z)({},n.model),{variations:n.model.variations.map(function(e){if(e.id===t){var n;return(0,r.Z)((0,i.Z)({},e),(0,o.Z)({},d,null===(n=e[d])||void 0===n?void 0:n.map(function(e){return e.key===c?{key:a,value:s}:e})))}return e})})})}function m(e){var n=e.slice,t=e.variationId,d=e.widgetArea,c=e.newFieldId,a=e.newField;return(0,r.Z)((0,i.Z)({},n),{model:(0,r.Z)((0,i.Z)({},n.model),{variations:n.model.variations.map(function(e){if(e.id===t){var n;return(0,r.Z)((0,i.Z)({},e),(0,o.Z)({},d,null===(n=e[d])||void 0===n?void 0:n.concat([{key:c,value:a},])))}return e})})})}function p(e){var n,t,a=e.slice,s=e.variationId,l=e.widgetArea,u=e.sourceIndex,v=e.destinationIndex,f=null!==(t=null===(n=a.model.variations.find(function(e){return e.id===s}))||void 0===n?void 0:n[l])&&void 0!==t?t:[],h=(0,c.Z)(f),m=(0,d.Z)(h.splice(u,1),1)[0];return h.splice(v,0,m),(0,r.Z)((0,i.Z)({},a),{model:(0,r.Z)((0,i.Z)({},a.model),{variations:a.model.variations.map(function(e){return e.id===s?(0,r.Z)((0,i.Z)({},e),(0,o.Z)({},l,h)):e})})})}},34728:function(e,n,t){"use strict";t.d(n,{O:function(){return c}});var o=t(52322),i=t(22715),r=t(32681),d=t(79096),c=function(e){var n=function(e){var n=a[e.modelType];switch(e.modelStatus){case r.G.New:return{badgeColor:"green",badgeTitle:"New",tooltipContent:"This ".concat(n," exists only locally. Upon sync, it will be pushed to your remote repository.")};case r.G.Modified:return{badgeColor:"amber",badgeTitle:"Modified",tooltipContent:"This ".concat(n," has been modified locally. Upon sync, changes will be pushed to your remote repository.")};case r.G.Synced:return{badgeColor:"purple",badgeTitle:"Synced",tooltipContent:"This ".concat(n," is in sync with the remote repository.")};case r.G.Deleted:return{badgeColor:"tomato",badgeTitle:"Deleted",tooltipContent:"This ".concat(n," has been deleted locally.")};case r.G.Unknown:if(!e.isOnline)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (no internet connection)."};if(e.authStatus===d.t.UNAUTHORIZED)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (not connected to Prismic)."};if(e.authStatus===d.t.FORBIDDEN)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (you don't have access to the repository)."};default:return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (unknown error)."}}}(e),t=n.badgeColor,c=n.badgeTitle,s=n.tooltipContent;return(0,o.jsx)(i.u,{content:s,side:"bottom",children:(0,o.jsx)(i.Ct,{color:t,title:c})})},a={CustomType:"type",Slice:"slice"}},71749:function(e,n,t){"use strict";t.d(n,{b:function(){return b}});var o=t(62230),i=t(85244),r=t(52322),d=t(22715),c=t(39097),a=t.n(c),s=t(67557),l=t(17064),u={build:function(e){var n;return(0,i.Z)((0,o.Z)({},e),{screenshots:(n=e.screenshots)?Object.entries(n).reduce(function(e,n){var t,r=(0,l.Z)(n,2),d=r[0],c=r[1];return c.hash?(0,i.Z)((0,o.Z)({},e),(0,s.Z)({},d,(0,o.Z)({},c,{hash:c.hash}))):e},{}):{}})},variation:function(e,n){if(e.model.variations.length)return n?e.model.variations.find(function(e){return e.id===n}):e.model.variations[0]}},v=t(24804),f=t(5479),h=t(34728),m=t(49451),p=function(e){return(0,r.jsx)("svg",(0,i.Z)((0,o.Z)({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 5.5C4 4.67157 4.67157 4 5.5 4H18.5C19.3284 4 20 4.67157 20 5.5V12.4413C20 12.4512 19.9997 12.461 19.9991 12.4707C20.0072 12.6083 19.9586 12.7485 19.8536 12.8536C19.6583 13.0488 19.3417 13.0488 19.1464 12.8536L16.3536 10.0607C16.1583 9.8654 15.8417 9.8654 15.6464 10.0607L11.8536 13.8536C11.6583 14.0488 11.3417 14.0488 11.1464 13.8536L9.35355 12.0607C9.15829 11.8654 8.84171 11.8654 8.64645 12.0607L5 15.7071V18.5C5 18.7761 5.22386 19 5.5 19H12.5C12.7761 19 13 19.2239 13 19.5C13 19.7761 12.7761 20 12.5 20H5.5C4.67157 20 4 19.3284 4 18.5V15.5003V15.4997V5.5ZM11.5 12.7929L14.9393 9.35355C15.5251 8.76777 16.4749 8.76777 17.0607 9.35355L19 11.2929V5.5C19 5.22386 18.7761 5 18.5 5H5.5C5.22386 5 5 5.22386 5 5.5V14.2929L7.93934 11.3536C8.52513 10.7678 9.47487 10.7678 10.0607 11.3536L11.5 12.7929ZM16.5 13C16.7761 13 17 13.2239 17 13.5V16H19.5C19.7761 16 20 16.2239 20 16.5C20 16.7761 19.7761 17 19.5 17H17V19.5C17 19.7761 16.7761 20 16.5 20C16.2239 20 16 19.7761 16 19.5V17H13.5C13.2239 17 13 16.7761 13 16.5C13 16.2239 13.2239 16 13.5 16H16V13.5C16 13.2239 16.2239 13 16.5 13Z",fill:"currentColor"})}))},b=function(e){var n,t=e.action,c=e.isComingSoon,s=void 0!==c&&c,l=e.isDeleted,b=e.onUpdateScreenshot,g=e.selected,_=void 0!==g&&g,y=e.slice,C=e.variant,j=e.variationId,k=u.variation(y,j);if(!k)return null;var z=(0,f.d7)(y,k),S=s||void 0!==l&&l,w=!S&&!!b,I="outlined"===C,N=void 0!==j;return n="selection"===e.mode?{disabled:S,interactive:!0,onClick:function(){e.onSelectedChange(!_)}}:S?{interactive:!1}:{component:a(),href:m.Y.getBuilderPagePathname({libraryName:y.href,sliceName:y.model.name,variationId:k.id}),interactive:!0,replace:e.replace},(0,r.jsxs)(v.Zb,(0,i.Z)((0,o.Z)({"aria-label":"".concat(y.model.name," ").concat(k.name," slice card"),checked:_,"data-cy":"shared-slice-card","data-testid":"shared-slice-card"},n,"outlined"===C?{size:"small",variant:"outlined"}:{}),{children:[void 0!==z?(0,r.jsx)(v.ZB,{alt:"Preview image",overlay:w&&!I?(0,r.jsx)(d.xu,{alignItems:"center",justifyContent:"center",children:(0,r.jsx)(x,{onClick:b})}):void 0,src:z}):(0,r.jsx)(v.ZB,{component:"div",children:(0,r.jsxs)(d.xu,{alignItems:"center",flexDirection:"column",gap:8,justifyContent:"center",children:[(0,r.jsx)(d.xv,{color:"grey11",component:"span",children:"No screenshot available"}),w&&!I?(0,r.jsx)(x,{onClick:b}):void 0]})}),(0,r.jsx)(v.eW,{action:"checkbox"===t.type&&"selection"===e.mode?(0,r.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:(0,r.jsx)(d.XZ,{checked:_,disabled:S,onCheckedChange:e.onSelectedChange})}):"menu"===t.type?(0,r.jsxs)(d.h_,{modal:!0,children:[(0,r.jsx)(d.$F,{disabled:S,children:(0,r.jsx)(d.hU,{hiddenLabel:"Slice actions",icon:"moreVert"})}),(0,r.jsxs)(d.AW,{align:"end","data-cy":"slice-action-icon-dropdown",children:[w&&I?(0,r.jsx)(d.Xi,{onSelect:b,startIcon:(0,r.jsx)(p,{}),children:"Update screenshot"}):void 0,(0,r.jsx)(d.Xi,{onSelect:t.onRename,startIcon:(0,r.jsx)(d.I5,{name:"edit"}),children:"Rename"}),!0===t.removeDisabled&&N?(0,r.jsx)(d.u,{content:"The slice needs to have at least one variation.",side:"bottom",stableMount:!0,children:(0,r.jsx)(Z,{disabled:!0,onSelect:t.onRemove})}):(0,r.jsx)(Z,{disabled:!0===t.removeDisabled,onSelect:t.onRemove})]})]}):"remove"===t.type?(0,r.jsx)(d.hU,{icon:"close",onClick:function(){return!S&&t.onRemove()},hiddenLabel:"Remove slice"}):"status"===t.type?(0,r.jsx)(h.O,{authStatus:t.authStatus,isOnline:t.isOnline,modelStatus:t.modelStatus,modelType:"Slice"}):void 0,subtitle:(0,r.jsxs)(r.Fragment,{children:[N?k.id:"".concat(y.model.variations.length," variation").concat(y.model.variations.length>1?"s":""),s?(0,r.jsxs)(d.xv,{color:"purple11",component:"span",variant:"small",children:[" ","• (coming soon)"]}):void 0]}),title:N?k.name:y.model.name}),w&&!N&&(0,f.cx)(y)>0?(0,r.jsx)(v.Lm,{children:"Missing screenshot"}):void 0]}))},x=function(e){return(0,r.jsx)(d.zx,{onClick:e.onClick,renderStartIcon:function(){return(0,r.jsx)(p,{color:d.TV.color.greyLight11})},color:"grey",children:"Update screenshot"})},Z=function(e){return(0,r.jsx)(d.Xi,(0,i.Z)((0,o.Z)({},e),{color:"tomato",startIcon:(0,r.jsx)(d.I5,{name:"delete"}),children:"Delete"}))}},49451:function(e,n,t){"use strict";t.d(n,{Y:function(){return o}});var o={getBuilderPagePathname:function(e){return"/slices/".concat(e.libraryName.replaceAll("/","--"),"/").concat(e.sliceName,"/").concat(e.variationId)}}},71457:function(){}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[727],{54132:function(e,n,r){"use strict";r.d(n,{Z:function(){return o}});var t=r(62230),s=r(85244),a=r(98240),i=r(52322);r(2784);var c=r(75289),l=function(e){var n=e.bg,r=e.background,s=e.sx,a=e.withRadius,l=e.radius,o=e.children;return(0,i.jsx)(c.xu,{sx:(0,t.Z)({p:4,bg:n||r},a?{borderBottomLeftRadius:l,borderBottomRightRadius:l}:null,s),children:o})},o=function(e){var n=e.Header,r=void 0===n?null:n,o=e.SubHeader,d=void 0===o?null:o,u=e.Body,h=void 0===u?null:u,f=e.Footer,x=void 0===f?null:f,p=e.borderFooter,m=e.radius,C=void 0===m?"6px":m,j=e.bodySx,g=e.footerSx,v=e.sx,b=e.bg,y=e.background,_=e.children,S=(0,a.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,i.jsxs)(c.Zb,(0,s.Z)((0,t.Z)({sx:(0,t.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:C},void 0===v?null:v)},S),{children:[r?(0,i.jsx)(r,{radius:C}):null,d?(0,i.jsx)(d,{radius:C}):null,(0,i.jsxs)(l,{bg:b,background:y,sx:void 0===j?{}:j,withRadius:!x,children:[h?(0,i.jsx)(h,{}):null,_||null]}),x?(0,i.jsx)(l,{bg:b,background:y,sx:(0,t.Z)({},void 0!==p&&p?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===g?{}:g),radius:C,withRadius:!0,children:"object"==typeof x?x:(0,i.jsx)(x,{})}):null]}))}},58882:function(e,n,r){"use strict";r.d(n,{M:function(){return z}});var t=r(22710),s=r(62230),a=r(85244),i=r(99267),c=r(52322),l=r(2784),o=r(75289),d=r(56580),u=r(5632),h=r(68780),f=r(90374),x=r(31667),p=r(38876),m=r(75329),C=r(78656),j=r(88932),g=r(13858),v=r(82770),b=r(91061);function y(){return(y=(0,t.Z)(function(e){var n,r,t,s,a,c,l,o,d,u;return(0,i.__generator)(this,function(i){switch(i.label){case 0:n=e.id,r=e.label,t=e.repeatable,s=e.format,a=e.onSuccess,c=C.$[s],l=(0,b.Ue)({id:n,label:r,repeatable:t,format:s}),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,(0,v.KA)(l)];case 2:if((o=i.sent().errors).length>0)throw o;return v.Xe.track({event:"custom-type:created",id:l.id,name:r,format:s,type:t?"repeatable":"single",origin:"table"}),[4,a(l)];case 3:return i.sent(),j.Am.success((0,g.GX)({message:"".concat(c.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(l.id,"/index.json")})),[3,5];case 4:return d=i.sent(),u="Internal Error: ".concat(c.name({start:!0,plural:!1})," not saved"),console.error(u,d),j.Am.error(u),[3,5];case 5:return[2]}})})).apply(this,arguments)}var _=r(67445),S=r(70041),w=r(17064),L=r(63397),Z=r(98240),k=function(e){var n=e.selected,r=(0,Z.Z)(e,["selected"]);return(0,c.jsx)(o.kC,(0,s.Z)({sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:n?function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}:"none","&:hover":{boxShadow:function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}}}},r))},T=function(e){var n=e.format,r=(0,w.Z)((0,L.U$)("repeatable"),3),t=r[0],s=r[2],a=C.$[n];return(0,c.jsxs)(o.xu,{mb:2,children:[(0,c.jsxs)(k,{selected:t.value,onClick:function(){return s.setValue(!0)},children:[(0,c.jsx)(o.Y8,{checked:t.value,onChange:function(){},"data-cy":"repeatable-type-radio-btn"}),(0,c.jsxs)(o.xu,{sx:{marginLeft:2},children:["Reusable type",(0,c.jsx)(o.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintRepeatable})]})]}),(0,c.jsxs)(k,{selected:!t.value,onClick:function(){return s.setValue(!1)},children:[(0,c.jsx)(o.Y8,{checked:!t.value,onChange:function(){},"data-cy":"single-type-radio-btn"}),(0,c.jsxs)(o.xu,{sx:{marginLeft:2},children:["Single type",(0,c.jsx)(o.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintSingle})]})]})]})},z=function(e){var n,r=e.format,j=e.isCreating,g=e.isOpen,v=e.origin,w=void 0===v?"table":v,L=e.onCreateChange,Z=e.onOpenChange,k=(0,f.Z)().createCustomTypeSuccess,z=(0,d.v9)(function(e){return{customTypeIds:(0,x.W6)(e),customTypeLabels:(0,x.YS)(e)}}),H=z.customTypeIds,R=z.customTypeLabels,I=C.$[r],N=(0,l.useState)(!0),V=N[0],M=N[1],E=(0,u.useRouter)(),F=(n=(0,t.Z)(function(e){var n,s,a;return(0,i.__generator)(this,function(c){switch(c.label){case 0:var l;return n=e.id,s=e.label,a=e.repeatable,L(!0),[4,function(e){return y.apply(this,arguments)}({format:r,id:n,label:s,origin:w,repeatable:a,onSuccess:(l=(0,t.Z)(function(e){var r,t;return(0,i.__generator)(this,function(s){switch(s.label){case 0:return k(e),r=(0,b.y6)(e),t=_.cd[r],M(!0),[4,E.push({pathname:t.getBuilderPagePathname(n),query:"page"===e.format?{newPageType:!0}:void 0})];case 1:return s.sent(),[2]}})}),function(e){return l.apply(this,arguments)})})];case 1:return c.sent(),L(!1),Z(!1),[2]}})}),function(e){return n.apply(this,arguments)}),P=function(e,n,r){r(V?(0,a.Z)((0,s.Z)({},n),{label:e.target.value,id:(0,p.lV)(e.target.value)}):(0,a.Z)((0,s.Z)({},n),{label:e.target.value}))},A=function(e,n){n("id",e.target.value),M(!1)};return(0,c.jsx)(h.Z,{dataCy:"create-ct-modal",isOpen:g,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:function(){Z(!1),M(!0)},onSubmit:function(e){F(e)},isLoading:j,initialValues:{repeatable:!0,id:"",label:""},validate:function(e){var n=e.id,r=e.label,t={};return r&&r.length||(t.label="Cannot be empty."),!t.label&&R.includes(r)&&(t.label="".concat(I.name({start:!0,plural:!1})," name is already taken.")),n&&n.length||(t.id="ID cannot be empty."),t.id||!n||m.xo.exec(n)||(t.id="Invalid id: No special characters allowed."),!t.id&&n&&H.map(function(e){return e.toLowerCase()}).includes(n)&&(t.id='ID "'.concat(n,'" exists already.')),Object.keys(t).length>0?t:void 0},content:{title:"Create a new ".concat(I.name({start:!1,plural:!1}))},children:function(e){var n=e.errors,t=e.setValues,s=e.setFieldValue,a=e.values,i=e.touched;return(0,c.jsxs)(o.xu,{children:[(0,c.jsx)(T,{format:r}),(0,c.jsx)(S.W,{name:"label",label:"".concat(I.name({start:!0,plural:!1})," Name"),dataCy:"ct-name-input",placeholder:"A display name for the ".concat(I.name({start:!1,plural:!1})),error:i.label?n.label:void 0,onChange:function(e){return P(e,a,t)}}),(0,c.jsx)(S.W,{name:"id",dataCy:"ct-id-input",label:"".concat(I.name({start:!0,plural:!1})," ID"),placeholder:I.inputPlaceholder,error:i.id?n.id:void 0,onChange:function(e){return A(e,s)}})]})}})}},75329:function(e,n,r){"use strict";r.d(n,{Sn:function(){return c},lS:function(){return t},nG:function(){return s},pq:function(){return l},rd:function(){return i},xo:function(){return a}});var t=["components"],s=["png","jpg","jpeg"],a=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,i="placeholders/What_are_Slices_mrvome",c="SM_HELP_VIDEOS/mock_data",l="slice-machine-simulator"},840:function(e,n,r){"use strict";r.d(n,{F:function(){return F}});var t=r(52322),s=r(2784),a=r(22715),i=r(97729),c=r.n(i),l=r(29930),o=r(58882),d=r(78656),u=r(5632),h=r(67557),f=r(50002),x=r(6277);r(64117);var p=function(e){var n=e.children;return(0,t.jsx)("div",{className:"_1ecs97dez0 _1ecs97dez5 _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dezr",children:(0,t.jsx)("table",{className:"gdfsm51 _1ecs97dez0 _1ecs97dez5 _1ecs97df3p _1ecs97df4v",children:n})})},m=(0,s.createContext)("body");function C(){return(0,s.useContext)(m)}var j=function(e){var n=e.children;return(0,t.jsx)(m.Provider,{value:"head",children:(0,t.jsx)("thead",{className:"gdfsm52 _1ecs97dez0 _1ecs97dez5 _1ecs97d18 _1ecs97d8l",children:n})})},g=function(e){var n=e.children;return(0,t.jsx)(m.Provider,{value:"body",children:(0,t.jsx)("tbody",{className:"gdfsm53 _1ecs97dez0 _1ecs97dez5",children:n})})},v=function(e){var n,r=e.children,s=e.onClick,a=C();return(0,t.jsx)("tr",{className:(0,x.W)("_1ecs97dez0 _1ecs97dez5 _1ecs97df71",(n={},(0,h.Z)(n,"_1ecs97df41",!!s),(0,h.Z)(n,"_1ecs97dm _1ecs97d7z _1ecs97d3c _1ecs97dap _1ecs97d2w _1ecs97da9 _1ecs97df74 _1ecs97dfj8 _1ecs97df0d _1ecs97dfjb","body"===a),n)),onClick:function(e){var n,r=e.target;if(s&&e.currentTarget.contains(r)){var t=(0,f.JY)(r);(null===(n=null==t?void 0:t.contains(e.currentTarget))||void 0===n||n)&&s(e)}},children:r})},b=function(e){var n=e.children,r=C();return(0,t.jsx)("head"===r?"th":"td",{className:"gdfsm55 _1ecs97dez0 _1ecs97dez5 _1ecs97d3fg _1ecs97d3mt _1ecs97df2h _1ecs97dez1 _1ecs97da62 _1ecs97dadf _1ecs97df45 _1ecs97dfhi",children:(0,t.jsx)("div",{className:"gdfsm56 _1ecs97dez0 _1ecs97dez2",children:n})})},y=function(){return(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M8 28H24C25.1046 28 26 27.1046 26 26V9L21 4H8C6.89543 4 6 4.89543 6 6V26C6 27.1046 6.89543 28 8 28Z",fill:"#6E56CF"}),(0,t.jsx)("path",{d:"M23 9H26L21 4V7C21 8.10457 21.8954 9 23 9Z",fill:"#9E8CFC"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.0912 12C13.2794 12 11 14.2794 11 17.0912C11 19.903 13.2794 22.1824 16.0912 22.1824C17.9763 22.1824 19.6215 21.1577 20.501 19.6372C20.6563 19.3688 20.7878 19.0849 20.8926 18.7883C20.9846 18.5279 20.8482 18.2422 20.5878 18.1502C20.3275 18.0582 20.0418 18.1947 19.9498 18.455C19.8657 18.693 19.7601 18.9209 19.6354 19.1365C18.9273 20.3606 17.6049 21.1824 16.0912 21.1824C13.8317 21.1824 12 19.3507 12 17.0912C12 14.8317 13.8317 13 16.0912 13C17.4478 13 18.6507 13.66 19.3955 14.6782H17.6216C17.3455 14.6782 17.1216 14.9021 17.1216 15.1782C17.1216 15.4544 17.3455 15.6782 17.6216 15.6782H20.2998C20.576 15.6782 20.7998 15.4544 20.7998 15.1782V12.5C20.7998 12.2239 20.576 12 20.2998 12C20.0237 12 19.7998 12.2239 19.7998 12.5V13.6032C18.8717 12.6167 17.5536 12 16.0912 12Z",fill:"white"})]})},_=function(){return(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M8 28H24C25.1046 28 26 27.1046 26 26V9L21 4H8C6.89543 4 6 4.89543 6 6V26C6 27.1046 6.89543 28 8 28Z",fill:"#6E56CF"}),(0,t.jsx)("path",{d:"M23 9H26L21 4V7C21 8.10457 21.8954 9 23 9Z",fill:"#9E8CFC"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.0869 14.6818L14.6627 12.3787C14.7183 12.1561 14.9183 12 15.1477 12C15.473 12 15.7117 12.3057 15.6328 12.6213L15.1177 14.6818H17.7232L18.299 12.3787C18.3547 12.1561 18.5547 12 18.7841 12C19.1094 12 19.3481 12.3057 19.2692 12.6213L18.754 14.6818H21C21.2761 14.6818 21.5 14.9057 21.5 15.1818C21.5 15.458 21.2761 15.6818 21 15.6818H18.504L17.8449 18.3182H20C20.2761 18.3182 20.5 18.542 20.5 18.8182C20.5 19.0943 20.2761 19.3182 20 19.3182H17.5949L17.0192 21.6213C16.9635 21.8439 16.7635 22 16.5341 22C16.2088 22 15.9701 21.6943 16.049 21.3787L16.5642 19.3182H13.9586L13.3828 21.6213C13.3272 21.8439 13.1272 22 12.8977 22C12.5724 22 12.3338 21.6943 12.4127 21.3787L12.9278 19.3182H11C10.7239 19.3182 10.5 19.0943 10.5 18.8182C10.5 18.542 10.7239 18.3182 11 18.3182H13.1778L13.8369 15.6818H12C11.7239 15.6818 11.5 15.458 11.5 15.1818C11.5 14.9057 11.7239 14.6818 12 14.6818H14.0869ZM16.8142 18.3182L17.4732 15.6818H14.8677L14.2086 18.3182H16.8142Z",fill:"white"})]})},S=r(2754),w=r(67445),L=r(19345),Z=r(22710),k=r(99267),T=r(56580),z=r(17329),H=r(81038),R=r(31667),I=r(7819),N=r(14137);function V(e){return M.apply(this,arguments)}function M(){return(M=(0,Z.Z)(function(e){var n,r,t;return(0,k.__generator)(this,function(s){switch(s.label){case 0:return[4,H.j.customTypes.readAllCustomTypes({format:e})];case 1:if(r=(n=s.sent()).errors,t=n.models,r.length>0)throw r;return[2,t.map(function(e){return e.model})]}})})).apply(this,arguments)}var E=function(e){var n,r,i,c,l,o,h=e.format,f=e.isCreatingCustomType,x=e.openCreateCustomTypeModal,m=(0,u.useRouter)(),C=(r=(0,s.useCallback)(function(e){return(0,z.VA)(V,[h],e)},[h]),{customTypes:(0,z.QT)(V,[h]),updateCustomTypes:r}),Z=C.customTypes,k=C.updateCustomTypes,H=Z.sort(function(e,n){return e.id.localeCompare(n.id)}),M=w.cd[h],E=d.$[h];return(o=(0,T.v9)(function(e){return{storeCustomTypes:(0,R.Ch)(e).filter(I.TG)}}).storeCustomTypes,(0,s.useEffect)(function(){var e=o.filter(function(e){return e.local.format===h});(e.length!==Z.length||e.some(function(e){var n=Z.find(function(n){return n.id===e.local.id});return!n||JSON.stringify(N.Dc.fromSM(e.local))!==JSON.stringify(n)}))&&k(e.map(function(e){var n=e.local;return N.Dc.fromSM(n)}))},[h,k,Z,o]),0===H.length)?(0,t.jsxs)(S.R$,{style:{alignSelf:"center",marginTop:a.TV.size[72]},children:[(0,t.jsx)(S.u2,{children:(0,t.jsx)(a.Ee,{src:M.blankSlateImage,sizing:"cover"})}),(0,t.jsxs)(S.T9,{children:[(0,t.jsx)(S._T,{children:E.name({start:!0,plural:!0})}),(0,t.jsx)(S.nf,{children:E.blankSlateDescription}),(0,t.jsx)(S.Qj,{children:(0,t.jsx)(a.zx,{onClick:x,loading:f,children:"Create"})})]})]}):(0,t.jsxs)(p,{children:[(0,t.jsx)(j,{children:(0,t.jsxs)(v,{children:[(0,t.jsx)(b,{children:(0,t.jsx)(a.I5,{name:"notes",size:"medium"})}),(0,t.jsx)(b,{children:"Label"}),(0,t.jsx)(b,{children:"API ID"}),(0,t.jsx)(b,{children:"Limit"}),(0,t.jsx)(b,{})]})}),(0,t.jsx)(g,{children:H.map(function(e){var n=e.repeatable,r=e.label,s=e.id;return(0,t.jsxs)(v,{onClick:function(){m.push(w.cd[h].getBuilderPagePathname(s))},children:[(0,t.jsx)(b,{children:n?(0,t.jsx)(y,{}):(0,t.jsx)(_,{})}),(0,t.jsx)(b,{children:r}),(0,t.jsx)(b,{children:s}),(0,t.jsx)(b,{children:n?"Reusable":"Single"}),(0,t.jsx)(b,{children:(0,t.jsx)(L._,{isChangesLocal:!1,format:h,customType:e})})]},s)})})]})},F=function(e){var n=e.format,r=d.$[n],i=(0,s.useState)(!1),u=i[0],h=i[1],f=(0,s.useState)(!1),x=f[0],p=f[1];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c(),{children:(0,t.jsxs)("title",{children:[r.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,t.jsx)(a.SV,{renderError:function(){return(0,t.jsx)(l.LN,{children:(0,t.jsx)(l.RN,{children:(0,t.jsx)(a.xu,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)(a.Iq,{title:"Request failed",description:"An error occurred while fetching your ".concat(r.name({start:!1,plural:!0}),".")})})})})},children:(0,t.jsx)(s.Suspense,{fallback:(0,t.jsxs)(l.LN,{children:[(0,t.jsxs)(l.wd,{children:[(0,t.jsx)(l.Cx,{folder:r.name({start:!0,plural:!0})}),(0,t.jsx)(l.K2,{children:(0,t.jsx)(a.zx,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,t.jsx)(l.RN,{children:(0,t.jsx)(a._3,{})})]}),children:(0,t.jsxs)(l.LN,{children:[(0,t.jsxs)(l.wd,{children:[(0,t.jsx)(l.Cx,{folder:r.name({start:!0,plural:!0})}),(0,t.jsx)(l.K2,{children:(0,t.jsx)(a.zx,{"data-cy":"create-ct",loading:u,onClick:function(){p(!0)},startIcon:"add",children:"Create"})})]}),(0,t.jsx)(l.RN,{children:(0,t.jsxs)(a.xu,{flexDirection:"column",children:[(0,t.jsx)(E,{format:n,isCreatingCustomType:u,openCreateCustomTypeModal:function(){p(!0)}}),(0,t.jsx)(o.M,{format:n,isCreating:u,isOpen:x,onCreateChange:h,onOpenChange:p})]})})]})})})]})}},64117:function(){}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[731],{56577:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var r=t(62230),o=t(85244),i=t(98240),s=t(52322),c=t(2784),u=t(75289),a=function(e,n){return e?"".concat(e,"-").concat(n):""},l=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},d=(0,c.forwardRef)(function(e,n){var t=e.label,c=e.Icon,d=e.type,f=e.form,p=e.isLoading,m=void 0!==p&&p,v=e.disabled,y=e.onClick,h=e.sx,x=e.iconSize,g=void 0===x?16:x,Z=e.iconFill,b=e.variant,j=void 0===b?"primary":b,I=(0,i.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,s.jsx)(u.zx,(0,o.Z)((0,r.Z)({ref:n,sx:(0,r.Z)((0,o.Z)((0,r.Z)({},void 0===h?{}:h),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),m?{cursor:"wait !important"}:{}),type:d,form:f,disabled:void 0!==v&&v||m,onClick:m?void 0:y,variant:j},I),{children:m?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.$j,{size:g,color:l(j),"data-cy":a(I["data-cy"],"spinner")}),c&&t]}):(0,s.jsxs)(s.Fragment,{children:[c&&(0,s.jsx)(c,{size:g,fill:Z,"data-cy":a(I["data-cy"],"icon")}),t]})}))})},70041:function(e,n,t){"use strict";t.d(n,{W:function(){return c}});var r=t(62230),o=t(52322);t(2784);var i=t(63397),s=t(75289),c=function(e){var n=e.name,t=e.label,c=e.placeholder,u=e.error,a=e.dataCy,l=e.onChange;return(0,o.jsxs)(s.xu,{mb:3,children:[(0,o.jsx)(s.__,{htmlFor:n,mb:2,children:t}),(0,o.jsx)(i.gN,(0,r.Z)({name:n,type:"text",placeholder:c,as:s.II,autoComplete:"off"},l?{onChange:l}:null,a?{"data-cy":a}:null)),u?(0,o.jsx)(s.xv,{"data-cy":a?"".concat(a,"-error"):"input-error",sx:{color:"error",mt:1},children:u}):null]})}},68780:function(e,n,t){"use strict";var r=t(62230),o=t(85244),i=t(52322),s=t(37149),c=t.n(s),u=t(25812),a=t(63397),l=t(75289),d=t(56577),f=t(54132);n.Z=function(e){var n=e.children,t=e.close,s=e.isOpen,p=e.formId,m=e.validate,v=e.onSubmit,y=e.widthInPx,h=e.initialValues,x=e.content.title,g=e.cardProps,Z=e.omitFooter,b=void 0!==Z&&Z,j=e.isLoading,I=void 0!==j&&j,T=e.buttonLabel,_=void 0===T?"Save":T,C=e.dataCy,S=e.actionMessage;return c().setAppElement("#__next"),(0,i.jsx)(u.Z,{isOpen:s,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:x,style:{content:{width:null!=y?y:"900px"}},children:(0,i.jsx)(a.J9,{validateOnChange:!0,initialValues:h,validate:function(e){return m?m(e):void 0},onSubmit:function(e){v(e)},children:function(e){var s=e.isValid,c=e.isSubmitting,u=e.values,m=e.errors,v=e.touched,y=e.setFieldValue,h=e.setValues;return(0,i.jsx)(a.l0,(0,o.Z)((0,r.Z)({id:p},null!=C?{"data-cy":C}:null),{children:(0,i.jsx)(f.Z,(0,o.Z)((0,r.Z)({borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"}},g),{Header:function(e){var n=e.radius;return(0,i.jsxs)(l.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},children:[(0,i.jsx)(l.X6,{sx:{fontSize:"20px"},children:x}),(0,i.jsx)(l.x8,{type:"button",onClick:t})]})},Footer:b?null:(0,i.jsxs)(l.kC,{sx:{alignItems:"space-between"},children:[(0,i.jsx)(l.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof S?S(e):S}),(0,i.jsxs)(l.kC,{sx:{ml:"auto"},children:[(0,i.jsx)(l.zx,{mr:2,type:"button",onClick:t,variant:"secondary",disabled:c||I,children:"Cancel"}),(0,i.jsx)(d.z,{label:_,form:p,type:"submit",disabled:!s||c||I,isLoading:c||I,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:n({isValid:s,isSubmitting:c,values:u,errors:m,touched:v,setFieldValue:y,setValues:h})}))}))}})})}},38876:function(e,n,t){"use strict";t.d(n,{MP:function(){return i},T3:function(){return c},Ti:function(){return o},lV:function(){return u}});var r=/-(\w)/g;function o(e){return e.includes("-")?"['".concat(e,"']"):".".concat(e)}function i(e){return e?(e=e.replace(/_/g,"-").replace(r,function(e,n){return n?n.toUpperCase():""}))[0].toUpperCase()+e.slice(1):""}var s=/\B([A-Z])/g;function c(e){var n;return e.replace(s,"-$1").toLowerCase().replace(/-/g,"_")}var u=function(e){return e.trim().replace(/ /g,"_").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}},2754:function(e,n,t){"use strict";t.d(n,{R$:function(){return l},Qj:function(){return v},T9:function(){return f},nf:function(){return m},u2:function(){return d},_T:function(){return p}});var r=t(67557),o=t(62230),i=t(85244),s=t(98240),c=t(52322),u=t(6277),a=t(22715);t(69143);var l=function(e){var n=e.backgroundImage,t=e.style,a=(0,s.Z)(e,["backgroundImage","style"]),l=void 0!==n;return(0,c.jsx)("article",(0,i.Z)((0,o.Z)({},a),{className:(0,u.Z)("_18bjhbz0 _1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97dfiv _1ecs97dfix _1ecs97dfiz _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dezp",(0,r.Z)({},"_18bjhbz1 _1ecs97dezx _1ecs97df4v",l)),style:(0,o.Z)({backgroundImage:l?"url(".concat(n,")"):void 0},t)}))},d=function(e){return(0,c.jsx)("div",(0,i.Z)((0,o.Z)({},e),{className:"_1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97d6r8 _1ecs97d6yl _1ecs97df29 _1ecs97df2l _1ecs97dezp"}))},f=function(e){return(0,c.jsx)("div",(0,i.Z)((0,o.Z)({},e),{className:"_18bjhbz3 _1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97dffv"}))},p=function(e){return(0,c.jsx)(a.xv,(0,i.Z)((0,o.Z)({},e),{className:"_18bjhbz4"}))},m=function(e){return(0,c.jsx)(a.xv,(0,i.Z)((0,o.Z)({},e),{className:"_18bjhbz5",color:"grey11"}))},v=function(e){return(0,c.jsx)("div",(0,i.Z)((0,o.Z)({},e),{className:"_18bjhbz6 _1ecs97dez0 _1ecs97dez8 _1ecs97dez1 _1ecs97dez2 _1ecs97df95 _1ecs97dfdl",color:"grey"}))}},91061:function(e,n,t){"use strict";t.d(n,{AK:function(){return b},E3:function(){return m},EN:function(){return v},F$:function(){return x},GA:function(){return S},HO:function(){return g},L4:function(){return j},Tr:function(){return p},Ue:function(){return O},gR:function(){return I},j6:function(){return _},kQ:function(){return T},l9:function(){return C},mf:function(){return y},vB:function(){return h},xS:function(){return Z},y6:function(){return a}});var r=t(67557),o=t(62230),i=t(85244),s=t(17064),c=t(88866),u=t(98863);function a(e){var n;return null!==(n=e.format)&&void 0!==n?n:"custom"}function l(e){return Object.entries(e.json)}function d(e,n){return e.json[n]}function f(e,n){var t=d(e,n);if(void 0!==t)return Object.entries(t).find(function(e){var n=(0,s.Z)(e,2);return(n[0],n[1]).type===c.SlicesFieldType})}function p(e,n){if(t=e,d=f(t,u=n),(p=(0,s.Z)(null!=d?d:[],2))[0],null!==(a=null==(m=p[1])?void 0:m.config)&&void 0!==a?a:void 0)return e;var t,u,a,d,p,m,v=function(e,n){var t,r=l(e),o=r.findIndex(function(e){return(0,s.Z)(e,1)[0]===n}),i=r.flatMap(function(e){var n=(0,s.Z)(e,2),t=(n[0],n[1]);return Object.keys(t).filter(function(e){return t[e].type===c.SlicesFieldType})}),u=o;do t="slices".concat(0!==u?u.toString():""),u++;while(i.includes(t));return t}(e,n);return(0,i.Z)((0,o.Z)({},e),{json:(0,i.Z)((0,o.Z)({},e.json),(0,r.Z)({},n,(0,i.Z)((0,o.Z)({},e.json[n]),(0,r.Z)({},v,{type:c.SlicesFieldType,fieldset:"Slice Zone"}))))})}function m(e,n){var t=d(e,n);if(void 0===t)return e;var s=Object.keys(t).find(function(e){return t[e].type===c.SlicesFieldType});if(void 0===s)return e;var a=(0,u.ud)(t,s);return(0,i.Z)((0,o.Z)({},e),{json:(0,i.Z)((0,o.Z)({},e.json),(0,r.Z)({},n,a))})}function v(e){var n,t,s=e.customType,a=e.sectionId,l=e.sliceId,f=d(s,a);if(void 0===f)return s;var p=Object.keys(f).find(function(e){return f[e].type===c.SlicesFieldType});if(void 0===p)return s;var m=f[p];if(m.type!==c.SlicesFieldType)return s;var v=(0,u.ud)(null!==(t=null===(n=m.config)||void 0===n?void 0:n.choices)&&void 0!==t?t:{},l);return(0,i.Z)((0,o.Z)({},s),{json:(0,i.Z)((0,o.Z)({},s.json),(0,r.Z)({},a,(0,i.Z)((0,o.Z)({},f),(0,r.Z)({},p,(0,i.Z)((0,o.Z)({},m),{config:(0,i.Z)((0,o.Z)({},m.config),{choices:v})})))))})}function y(e){var n,t=(0,i.Z)((0,o.Z)({},e),{format:"page"}),r=l(e)[0];if(r){var c=(0,s.Z)(r,1)[0];t=p(t,c)}return t}function h(e,n){return(0,i.Z)((0,o.Z)({},e),{json:(0,i.Z)((0,o.Z)({},e.json),(0,r.Z)({},n,{}))})}function x(e,n){var t=(0,u.ud)(e.json,n);return(0,i.Z)((0,o.Z)({},e),{json:t})}function g(e,n,t){if(n===t)return e;var r=Object.keys(e.json).reduce(function(r,o){return o===n?r[t]=e.json[o]:r[o]=e.json[o],r},{});return(0,i.Z)((0,o.Z)({},e),{json:r})}function Z(e){var n=e.customType,t=e.sectionId,s=e.newField,c=e.newFieldId;return F({customType:n,sectionId:t,updatedSection:(0,i.Z)((0,o.Z)({},n.json[t]),(0,r.Z)({},c,s))})}function b(e){var n=e.customType,t=e.sectionId,r=e.fieldId,o=(0,u.ud)(n.json[t],r);return F({customType:n,sectionId:t,updatedSection:o})}function j(e){var n=e.customType,t=e.sectionId,r=e.previousFieldId,o=e.newFieldId,i=e.newField,s=w({fields:n.json[t],previousFieldId:r,newFieldId:o,newField:i});return F({customType:n,sectionId:t,updatedSection:s})}function I(e){var n=e.customType,t=e.sectionId,r=e.sourceIndex,o=e.destinationIndex,i=n.json[t],u=f(n,t),a=Object.fromEntries(Object.entries(i).filter(function(e){var n=(0,s.Z)(e,2);return(n[0],n[1]).type!==c.SlicesFieldType})),l=z({fields:a,sourceIndex:r,destinationIndex:o});if(void 0!==u){var d=(0,s.Z)(u,2),p=d[0],m=d[1];l[p]=m}return F({customType:n,sectionId:t,updatedSection:l})}function T(e){var n,t=e.customType,s=e.sectionId,c=e.groupFieldId,u=e.newField,a=e.newFieldId,l=k({customType:t,sectionId:s,groupFieldId:c}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l)return t;var f=L(l,(0,i.Z)((0,o.Z)({},d),(0,r.Z)({},a,u)));return F({customType:t,sectionId:s,updatedSection:(0,i.Z)((0,o.Z)({},t.json[s]),(0,r.Z)({},c,f))})}function _(e){var n,t=e.customType,s=e.sectionId,c=e.groupFieldId,a=e.fieldId,l=k({customType:t,sectionId:s,groupFieldId:c}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l||!d)return t;var f=(0,u.ud)(d,a),p=L(l,f);return F({customType:t,sectionId:s,updatedSection:(0,i.Z)((0,o.Z)({},t.json[s]),(0,r.Z)({},c,p))})}function C(e){var n,t=e.customType,s=e.sectionId,c=e.groupFieldId,u=e.previousFieldId,a=e.newFieldId,l=e.newField,d=k({customType:t,sectionId:s,groupFieldId:c}),f=null==d?void 0:null===(n=d.config)||void 0===n?void 0:n.fields;if(!d||!f)return t;var p=w({fields:f,previousFieldId:u,newFieldId:a,newField:l}),m=L(d,p);return F({customType:t,sectionId:s,updatedSection:(0,i.Z)((0,o.Z)({},t.json[s]),(0,r.Z)({},c,m))})}function S(e){var n,t=e.customType,s=e.sectionId,c=e.groupFieldId,u=e.sourceIndex,a=e.destinationIndex,l=k({customType:t,sectionId:s,groupFieldId:c}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l||!d)return t;var f=z({fields:d,sourceIndex:u,destinationIndex:a}),p=L(l,f);return F({customType:t,sectionId:s,updatedSection:(0,i.Z)((0,o.Z)({},t.json[s]),(0,r.Z)({},c,p))})}function F(e){var n=e.customType,t=e.sectionId,s=e.updatedSection;return(0,i.Z)((0,o.Z)({},n),{json:(0,i.Z)((0,o.Z)({},n.json),(0,r.Z)({},t,s))})}function w(e){var n=e.fields,t=e.previousFieldId,r=e.newFieldId,o=e.newField;return Object.entries(n).reduce(function(e,n){var i=(0,s.Z)(n,2),c=i[0],u=i[1];return c===t?e[r]=o:c!==r&&(e[c]=u),e},{})}function z(e){var n=e.fields,t=e.sourceIndex,r=e.destinationIndex,o=Object.entries(n),i=(0,s.Z)(o.splice(t,1),1)[0];return o.splice(r,0,i),Object.fromEntries(o)}function k(e){var n=e.customType,t=e.sectionId,r=e.groupFieldId,o=n.json[t][r];if(o.type===c.GroupFieldType)return o}function L(e,n){return(0,i.Z)((0,o.Z)({},e),{config:(0,i.Z)((0,o.Z)({},e.config),{fields:n})})}function O(e){var n,t,r=e.id,i=e.label,s=e.repeatable,c=e.format,u=(n=s,t=c,!1===n&&"page"===t?(0,o.Z)({},R,P):!1===n?N:"page"===t?(0,o.Z)({},M,P):A);return{format:c,id:r,json:u,label:i,repeatable:s,status:!0}}var N={Main:{}},R={Main:{slices:{config:{choices:{}},fieldset:"Slice Zone",type:"Slices"}}},A={Main:{uid:{config:{label:"UID"},type:"UID"}}},M={Main:(0,o.Z)({},A.Main,R.Main)},P={"SEO & Metadata":{meta_description:{config:{label:"Meta Description",placeholder:"A brief summary of the page"},type:"Text"},meta_image:{config:{constraint:{height:1260,width:2400},label:"Meta Image",thumbnails:[]},type:"Image"},meta_title:{config:{label:"Meta Title",placeholder:"A title of the page used for social media and search engines"},type:"Text"}}}},19345:function(e,n,t){"use strict";t.d(n,{_:function(){return O}});var r=t(22710),o=t(99267),i=t(52322),s=t(2784),c=t(22715),u=t(5632),a=t(90374),l=t(88932),d=t(91061),f=t(82770),p=t(78656);function m(){return(m=(0,r.Z)(function(e,n){var t,r,i,s,c;return(0,o.__generator)(this,function(o){switch(o.label){case 0:t=p.$[e.format],o.label=1;case 1:return o.trys.push([1,3,,4]),r=(0,d.mf)(e),[4,(0,f.KA)(r)];case 2:if((i=o.sent().errors).length>0)throw i;return n(r),l.Am.success("".concat(t.name({start:!0,plural:!1})," converted to page type")),[3,4];case 3:return s=o.sent(),c="Internal Error: ".concat(t.name({start:!0,plural:!1})," not converted to page type"),console.error(c,s),l.Am.error(c),[3,4];case 4:return[2]}})})).apply(this,arguments)}var v=t(67445),y=t(62230),h=t(85244),x=t(75289),g=t(68780),Z=t(70041),b=t(56580),j=t(31667),I=t(81038);function T(){return(T=(0,r.Z)(function(e){var n,t,r,i,s,c,u,a;return(0,o.__generator)(this,function(o){switch(o.label){case 0:n=e.model,t=e.newLabel,r=e.onSuccess,i=p.$[n.format],o.label=1;case 1:return o.trys.push([1,3,,4]),s=(0,h.Z)((0,y.Z)({},n),{label:t}),[4,I.j.customTypes.renameCustomType({model:s})];case 2:if((c=o.sent().errors).length>0)throw c;return r(s),l.Am.success("".concat(i.name({start:!0,plural:!1})," renamed")),[3,4];case 3:return u=o.sent(),a="Internal Error: ".concat(i.name({start:!0,plural:!1})," could not be renamed"),console.error(a,u),l.Am.error(a),[3,4];case 4:return[2]}})})).apply(this,arguments)}var _=function(e){var n,t,c,u=e.isChangesLocal,l=e.customType,d=e.format,f=e.onClose,m=e.setLocalCustomType,v=null!==(n=null==l?void 0:l.label)&&void 0!==n?n:"",I=null!==(t=null==l?void 0:l.id)&&void 0!==t?t:"",_=(0,a.Z)().renameCustomTypeSuccess,C=(0,s.useState)(!1),S=C[0],F=C[1],w=(c=(0,r.Z)(function(e){return(0,o.__generator)(this,function(n){switch(n.label){case 0:if(F(!0),!(u&&m))return[3,1];return m((0,h.Z)((0,y.Z)({},l),{label:e.customTypeName})),[3,3];case 1:return[4,function(e){return T.apply(this,arguments)}({model:l,newLabel:e.customTypeName,onSuccess:_})];case 2:n.sent(),n.label=3;case 3:return F(!1),f(),[2]}})}),function(e){return c.apply(this,arguments)}),z=(0,b.v9)(function(e){return{customTypeLabels:(0,j.YS)(e)}}).customTypeLabels,k=p.$[d];return(0,i.jsx)(g.Z,{isOpen:!0,dataCy:"rename-custom-type-modal",widthInPx:"530px",formId:"rename-custom-type-modal-".concat(I),buttonLabel:"Rename",close:f,onSubmit:function(e){w(e)},initialValues:{customTypeName:v},isLoading:S,content:{title:"Rename a ".concat(k.name({start:!1,plural:!1}))},validate:function(e){var n=e.customTypeName,t={};return n&&n.length||(t.customTypeName="Cannot be empty."),void 0!=t.customTypeName&&z.includes(n)&&v!==n&&(t.customTypeName="".concat(k.name({start:!0,plural:!1})," name is already taken.")),Object.keys(t).length>0?t:void 0},children:function(e){var n=e.errors;return(0,i.jsx)(x.xu,{children:(0,i.jsx)(Z.W,{name:"customTypeName",label:"".concat(k.name({start:!0,plural:!1})," Name"),placeholder:"A display name for the ".concat(k.name({start:!1,plural:!1})),error:n.customTypeName,dataCy:"custom-type-name-input"})})}})},C=t(25812),S=t(59326),F=t(54132),w=t(65186),z=t(56577);function k(){return(k=(0,r.Z)(function(e){var n,t,r,i,s,c;return(0,o.__generator)(this,function(o){switch(o.label){case 0:n=e.customType,t=e.onSuccess,r=p.$[n.format],o.label=1;case 1:return o.trys.push([1,3,,4]),[4,I.j.customTypes.deleteCustomType({id:n.id})];case 2:if((i=o.sent().errors).length>0)throw i;return t(),l.Am.success("".concat(r.name({start:!0,plural:!1})," deleted")),[3,4];case 3:return s=o.sent(),c="Internal Error: ".concat(r.name({start:!0,plural:!1})," could not be deleted"),console.error(c,s),l.Am.error(c),[3,4];case 4:return[2]}})})).apply(this,arguments)}var L=function(e){var n,t=e.customType,c=e.format,u=e.onClose,l=e.onDeleteCustomTypeSuccess,d=p.$[c],f=(0,s.useState)(!1),m=f[0],v=f[1],y=(0,a.Z)().deleteCustomTypeSuccess,h=(n=(0,r.Z)(function(){return(0,o.__generator)(this,function(e){switch(e.label){case 0:return v(!0),[4,function(e){return k.apply(this,arguments)}({customType:t,onSuccess:function(){return y(t.id)}})];case 1:return e.sent(),l(),[2]}})}),function(){return n.apply(this,arguments)}),g=(0,S.B7)().theme;return(0,i.jsx)(C.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:function(){return u()},children:(0,i.jsx)(F.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none",overflow:"hidden"},borderFooter:!0,Header:function(){var e;return(0,i.jsxs)(x.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,i.jsxs)(x.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(w.$vK,{size:20,color:null===(e=g.colors)||void 0===e?void 0:e.greyIcon}),(0,i.jsxs)(x.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:["Delete"," ",d.name({start:!1,plural:!1})]})]}),(0,i.jsx)(x.x8,{type:"button",onClick:function(){return u()}})]})},Footer:function(){return(0,i.jsxs)(x.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorders))},backgroundColor:"gray"},children:[(0,i.jsx)(z.z,{label:"Cancel",variant:"secondary",onClick:function(){return u()},sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),void 0!==t&&(0,i.jsx)(z.z,{label:"Delete",variant:"danger",isLoading:m,onClick:function(){h()},sx:{minHeight:39,minWidth:78}})]})},children:(0,i.jsxs)("div",{children:["This action will immediately make the following change:",(0,i.jsx)("ul",{children:(0,i.jsxs)("li",{children:["Delete the"," ",(0,i.jsxs)(x.xv,{sx:{fontWeight:"bold"},children:["customtypes/",null==t?void 0:t.id,"/"]})," ","directory."]})}),"The next time you push your changes to Prismic, the following change will happen:",(0,i.jsx)("ul",{children:(0,i.jsxs)("li",{children:["Remove the"," ",d.name({start:!1,plural:!1})," and any associated Documents from your repository."]})})]})})})},O=function(e){var n,t=e.format,l=e.customType,d=e.isChangesLocal,f=e.setLocalCustomType,p=(0,u.useRouter)(),y=(0,a.Z)().saveCustomTypeSuccess,h=(0,s.useState)(!1),x=h[0],g=h[1],Z=(0,s.useState)(!1),b=Z[0],j=Z[1],I=(0,s.useState)(!1),T=I[0],C=I[1],S=(n=(0,r.Z)(function(){var e,n;return(0,o.__generator)(this,function(t){switch(t.label){case 0:return C(!0),[4,function(e,n){return m.apply(this,arguments)}(l,y)];case 1:return t.sent(),e=v.cd.custom.getBuilderPagePathname(l.id),p.asPath===e&&(n=v.cd.page.getBuilderPagePathname(l.id),p.replace(n)),C(!1),[2]}})}),function(){return n.apply(this,arguments)}),F=function(){var e,n=v.cd[null!==(e=l.format)&&void 0!==e?e:"custom"].tablePagePathname;p.asPath!==n?p.replace(n):g(!1)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(c.h_,{modal:!0,children:[(0,i.jsx)(c.$F,{disabled:T,children:(0,i.jsx)(c.hU,{color:"grey","data-testid":"editDropdown",hiddenLabel:"Custom type actions",icon:"moreVert",loading:T,variant:"solid"})}),(0,i.jsxs)(c.AW,{align:"end",children:[(0,i.jsx)(c.Xi,{startIcon:(0,i.jsx)(c.I5,{name:"edit"}),onSelect:function(){j(!0)},children:"Rename"}),"custom"===t&&!d&&(0,i.jsx)(c.Xi,{startIcon:(0,i.jsx)(c.I5,{name:"driveFileMove"}),onSelect:function(){S()},children:"Convert to page type"}),(0,i.jsx)(c.Xi,{color:"tomato",startIcon:(0,i.jsx)(c.I5,{name:"delete"}),onSelect:function(){g(!0)},children:"Remove"})]})]}),x?(0,i.jsx)(L,{format:t,customType:l,onClose:function(){return g(!1)},onDeleteCustomTypeSuccess:F}):null,b?(0,i.jsx)(_,{format:t,customType:l,isChangesLocal:d,onClose:function(){return j(!1)},setLocalCustomType:f}):null]})}},69143:function(){}}]);
|