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 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><link rel="preload" href="/_next/static/css/72465cc1225f28a2.css" as="style"/><link rel="stylesheet" href="/_next/static/css/72465cc1225f28a2.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-9f3513533bb2dfb8.js" defer=""></script><script src="/_next/static/chunks/59b4e022-7a3b5554b806349f.js" defer=""></script><script src="/_next/static/chunks/f36c6662-03bb5e9d9aa0b0aa.js" defer=""></script><script src="/_next/static/chunks/4c744e84-e3161d754618373f.js" defer=""></script><script src="/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js" defer=""></script><script src="/_next/static/chunks/1cc2734a-2c5b6c0367fcde86.js" defer=""></script><script src="/_next/static/chunks/183-aab7066c73ebde44.js" defer=""></script><script src="/_next/static/chunks/50-cfc2514205b86001.js" defer=""></script><script src="/_next/static/chunks/543-f8766685f7f451e2.js" defer=""></script><script src="/_next/static/chunks/696-b12edad30a3617e5.js" defer=""></script><script src="/_next/static/chunks/474-5a072e6fac61f703.js" defer=""></script><script src="/_next/static/chunks/25-37d6fa7f064be04b.js" defer=""></script><script src="/_next/static/chunks/731-501990ebe6a71b32.js" defer=""></script><script src="/_next/static/chunks/318-2112803ca34b2f49.js" defer=""></script><script src="/_next/static/chunks/904-9a4c1264727ae89a.js" defer=""></script><script src="/_next/static/chunks/pages/page-types/%5BpageTypeId%5D-d1ffca11c42f2603.js" defer=""></script><script src="/_next/static/RRBm5bm2F__Ws0vsvXhN6/_buildManifest.js" defer=""></script><script src="/_next/static/RRBm5bm2F__Ws0vsvXhN6/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/page-types/[pageTypeId]","query":{},"buildId":"RRBm5bm2F__Ws0vsvXhN6","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><link rel="preload" href="/_next/static/css/72465cc1225f28a2.css" as="style"/><link rel="stylesheet" href="/_next/static/css/72465cc1225f28a2.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-a2fa2db79a1e9a1e.js" defer=""></script><script src="/_next/static/chunks/59b4e022-7a3b5554b806349f.js" defer=""></script><script src="/_next/static/chunks/f36c6662-03bb5e9d9aa0b0aa.js" defer=""></script><script src="/_next/static/chunks/4c744e84-e3161d754618373f.js" defer=""></script><script src="/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js" defer=""></script><script src="/_next/static/chunks/1cc2734a-2c5b6c0367fcde86.js" defer=""></script><script src="/_next/static/chunks/183-4feb6bb3eddbc768.js" defer=""></script><script src="/_next/static/chunks/50-cfc2514205b86001.js" defer=""></script><script src="/_next/static/chunks/543-f8766685f7f451e2.js" defer=""></script><script src="/_next/static/chunks/696-b12edad30a3617e5.js" defer=""></script><script src="/_next/static/chunks/474-5a072e6fac61f703.js" defer=""></script><script src="/_next/static/chunks/25-01f422cea8066349.js" defer=""></script><script src="/_next/static/chunks/799-d95a93e965557aeb.js" defer=""></script><script src="/_next/static/chunks/318-34a2dea7cfd4661d.js" defer=""></script><script src="/_next/static/chunks/904-1ff7519adece2b55.js" defer=""></script><script src="/_next/static/chunks/pages/page-types/%5BpageTypeId%5D-84a22c5e480d3fa9.js" defer=""></script><script src="/_next/static/W3x14bv5_NtxtSjAB0JUM/_buildManifest.js" defer=""></script><script src="/_next/static/W3x14bv5_NtxtSjAB0JUM/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/page-types/[pageTypeId]","query":{},"buildId":"W3x14bv5_NtxtSjAB0JUM","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-9f3513533bb2dfb8.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/72585f70-28b4d7d5384b3703.js" defer=""></script><script src="/_next/static/chunks/18539003-5cc559566b738915.js" defer=""></script><script src="/_next/static/chunks/376-7e784d6069e01654.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D/simulator-897ca93c114a1435.js" defer=""></script><script src="/_next/static/RRBm5bm2F__Ws0vsvXhN6/_buildManifest.js" defer=""></script><script src="/_next/static/RRBm5bm2F__Ws0vsvXhN6/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices/[lib]/[sliceName]/[variation]/simulator","query":{},"buildId":"RRBm5bm2F__Ws0vsvXhN6","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-a2fa2db79a1e9a1e.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/72585f70-28b4d7d5384b3703.js" defer=""></script><script src="/_next/static/chunks/18539003-5cc559566b738915.js" defer=""></script><script src="/_next/static/chunks/376-7e784d6069e01654.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D/simulator-52c3e1f9d14160b8.js" defer=""></script><script src="/_next/static/W3x14bv5_NtxtSjAB0JUM/_buildManifest.js" defer=""></script><script src="/_next/static/W3x14bv5_NtxtSjAB0JUM/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices/[lib]/[sliceName]/[variation]/simulator","query":{},"buildId":"W3x14bv5_NtxtSjAB0JUM","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><link rel="preload" href="/_next/static/css/b22c0750c14cc089.css" as="style"/><link rel="stylesheet" href="/_next/static/css/b22c0750c14cc089.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-9f3513533bb2dfb8.js" defer=""></script><script src="/_next/static/chunks/59b4e022-7a3b5554b806349f.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/f36c6662-03bb5e9d9aa0b0aa.js" defer=""></script><script src="/_next/static/chunks/4c744e84-e3161d754618373f.js" defer=""></script><script src="/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js" defer=""></script><script src="/_next/static/chunks/1cc2734a-2c5b6c0367fcde86.js" defer=""></script><script src="/_next/static/chunks/183-aab7066c73ebde44.js" defer=""></script><script src="/_next/static/chunks/50-cfc2514205b86001.js" defer=""></script><script src="/_next/static/chunks/543-f8766685f7f451e2.js" defer=""></script><script src="/_next/static/chunks/696-b12edad30a3617e5.js" defer=""></script><script src="/_next/static/chunks/25-37d6fa7f064be04b.js" defer=""></script><script src="/_next/static/chunks/318-2112803ca34b2f49.js" defer=""></script><script src="/_next/static/chunks/286-ed90373e9a469944.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D-b2a9d773ce5d7739.js" defer=""></script><script src="/_next/static/RRBm5bm2F__Ws0vsvXhN6/_buildManifest.js" defer=""></script><script src="/_next/static/RRBm5bm2F__Ws0vsvXhN6/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices/[lib]/[sliceName]/[variation]","query":{},"buildId":"RRBm5bm2F__Ws0vsvXhN6","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><link rel="preload" href="/_next/static/css/b22c0750c14cc089.css" as="style"/><link rel="stylesheet" href="/_next/static/css/b22c0750c14cc089.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-a2fa2db79a1e9a1e.js" defer=""></script><script src="/_next/static/chunks/59b4e022-7a3b5554b806349f.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/f36c6662-03bb5e9d9aa0b0aa.js" defer=""></script><script src="/_next/static/chunks/4c744e84-e3161d754618373f.js" defer=""></script><script src="/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js" defer=""></script><script src="/_next/static/chunks/1cc2734a-2c5b6c0367fcde86.js" defer=""></script><script src="/_next/static/chunks/183-4feb6bb3eddbc768.js" defer=""></script><script src="/_next/static/chunks/50-cfc2514205b86001.js" defer=""></script><script src="/_next/static/chunks/543-f8766685f7f451e2.js" defer=""></script><script src="/_next/static/chunks/696-b12edad30a3617e5.js" defer=""></script><script src="/_next/static/chunks/25-01f422cea8066349.js" defer=""></script><script src="/_next/static/chunks/318-34a2dea7cfd4661d.js" defer=""></script><script src="/_next/static/chunks/286-ed90373e9a469944.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D-608d206d10a719e3.js" defer=""></script><script src="/_next/static/W3x14bv5_NtxtSjAB0JUM/_buildManifest.js" defer=""></script><script src="/_next/static/W3x14bv5_NtxtSjAB0JUM/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices/[lib]/[sliceName]/[variation]","query":{},"buildId":"W3x14bv5_NtxtSjAB0JUM","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
package/out/slices.html CHANGED
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><link rel="preload" href="/_next/static/css/f8eb526e10bc2441.css" as="style"/><link rel="stylesheet" href="/_next/static/css/f8eb526e10bc2441.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-9f3513533bb2dfb8.js" defer=""></script><script src="/_next/static/chunks/59b4e022-7a3b5554b806349f.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/50-cfc2514205b86001.js" defer=""></script><script src="/_next/static/chunks/25-37d6fa7f064be04b.js" defer=""></script><script src="/_next/static/chunks/286-ed90373e9a469944.js" defer=""></script><script src="/_next/static/chunks/pages/slices-e9c70c082ca3e3f9.js" defer=""></script><script src="/_next/static/RRBm5bm2F__Ws0vsvXhN6/_buildManifest.js" defer=""></script><script src="/_next/static/RRBm5bm2F__Ws0vsvXhN6/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices","query":{},"buildId":"RRBm5bm2F__Ws0vsvXhN6","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><link rel="preload" href="/_next/static/css/f8eb526e10bc2441.css" as="style"/><link rel="stylesheet" href="/_next/static/css/f8eb526e10bc2441.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-a2fa2db79a1e9a1e.js" defer=""></script><script src="/_next/static/chunks/59b4e022-7a3b5554b806349f.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/50-cfc2514205b86001.js" defer=""></script><script src="/_next/static/chunks/25-01f422cea8066349.js" defer=""></script><script src="/_next/static/chunks/286-ed90373e9a469944.js" defer=""></script><script src="/_next/static/chunks/pages/slices-b0b58192a87df822.js" defer=""></script><script src="/_next/static/W3x14bv5_NtxtSjAB0JUM/_buildManifest.js" defer=""></script><script src="/_next/static/W3x14bv5_NtxtSjAB0JUM/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices","query":{},"buildId":"W3x14bv5_NtxtSjAB0JUM","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slice-machine-ui",
3
- "version": "1.23.2-beta.3",
3
+ "version": "1.23.2-beta.5",
4
4
  "license": "MIT",
5
5
  "description": "A visual builder for your Slice Models with all the tools you need to generate data models and mock CMS content locally.",
6
6
  "repository": {
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@radix-ui/react-visually-hidden": "1.0.3",
39
- "@slicemachine/manager": "0.17.9-beta.4",
40
- "start-slicemachine": "0.12.15-beta.4"
39
+ "@slicemachine/manager": "0.17.9-beta.6",
40
+ "start-slicemachine": "0.12.15-beta.6"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@emotion/react": "11.11.1",
package/pages/slices.tsx CHANGED
@@ -24,7 +24,6 @@ import ScreenshotChangesModal from "@components/ScreenshotChangesModal";
24
24
  import { RenameSliceModal } from "@components/Forms/RenameSliceModal";
25
25
  import { DeleteSliceModal } from "@components/DeleteSliceModal";
26
26
  import { SliceMachineStoreType } from "@src/redux/type";
27
- import useSliceMachineActions from "@src/modules/useSliceMachineActions";
28
27
  import { getLibraries, getRemoteSlices } from "@src/modules/slices";
29
28
  import { useScreenshotChangesModal } from "@src/hooks/useScreenshotChangesModal";
30
29
  import { SharedSliceCard } from "@src/features/slices/sliceCards/SharedSliceCard";
@@ -33,9 +32,6 @@ import { SliceToastMessage } from "@components/ToasterContainer";
33
32
 
34
33
  const SlicesIndex: React.FunctionComponent = () => {
35
34
  const router = useRouter();
36
- const { openRenameSliceModal, openDeleteSliceModal } =
37
- useSliceMachineActions();
38
-
39
35
  const { modalPayload, onOpenModal } = useScreenshotChangesModal();
40
36
 
41
37
  const { sliceFilterFn, defaultVariationSelector } = modalPayload;
@@ -47,6 +43,8 @@ const SlicesIndex: React.FunctionComponent = () => {
47
43
  }),
48
44
  );
49
45
  const [isCreateSliceModalOpen, setIsCreateSliceModalOpen] = useState(false);
46
+ const [isDeleteSliceModalOpen, setIsDeleteSliceModalOpen] = useState(false);
47
+ const [isRenameSliceModalOpen, setIsRenameSliceModalOpen] = useState(false);
50
48
 
51
49
  const localLibraries: LibraryUI[] = libraries.filter(
52
50
  (library) => library.isLocal,
@@ -65,6 +63,14 @@ const SlicesIndex: React.FunctionComponent = () => {
65
63
 
66
64
  const [sliceForEdit, setSliceForEdit] = useState<ComponentUI>();
67
65
 
66
+ const openDeleteSliceModal = () => {
67
+ setIsDeleteSliceModalOpen(true);
68
+ };
69
+
70
+ const openRenameSliceModal = () => {
71
+ setIsRenameSliceModalOpen(true);
72
+ };
73
+
68
74
  return (
69
75
  <>
70
76
  <Head>
@@ -237,15 +243,21 @@ const SlicesIndex: React.FunctionComponent = () => {
237
243
  />
238
244
  )}
239
245
  <RenameSliceModal
240
- sliceId={sliceForEdit?.model.id ?? ""}
241
- sliceName={sliceForEdit?.model.name ?? ""}
242
- libName={sliceForEdit?.from ?? ""}
246
+ isOpen={isRenameSliceModalOpen}
247
+ slice={sliceForEdit}
248
+ onClose={() => {
249
+ setIsRenameSliceModalOpen(false);
250
+ }}
243
251
  data-cy="rename-slice-modal"
244
252
  />
245
253
  <DeleteSliceModal
254
+ isOpen={isDeleteSliceModalOpen}
255
+ libName={sliceForEdit?.from ?? ""}
246
256
  sliceId={sliceForEdit?.model.id ?? ""}
247
257
  sliceName={sliceForEdit?.model.name ?? ""}
248
- libName={sliceForEdit?.from ?? ""}
258
+ onClose={() => {
259
+ setIsDeleteSliceModalOpen(false);
260
+ }}
249
261
  />
250
262
  </AppLayoutContent>
251
263
  </AppLayout>
package/src/apiClient.ts CHANGED
@@ -3,12 +3,7 @@ import { SharedSliceContent } from "@prismicio/types-internal/lib/content";
3
3
 
4
4
  import { SimulatorCheckResponse } from "@models/common/Simulator";
5
5
  import { SliceMachineManagerClient } from "@slicemachine/manager/client";
6
- import {
7
- type SliceSM,
8
- Slices,
9
- type VariationSM,
10
- Variations,
11
- } from "@lib/models/common/Slice";
6
+ import { Slices, type VariationSM, Variations } from "@lib/models/common/Slice";
12
7
  import { CustomTypes } from "@lib/models/common/CustomType";
13
8
  import { CheckAuthStatusResponse } from "@models/common/Auth";
14
9
  import ServerState from "@models/server/ServerState";
@@ -89,22 +84,6 @@ export const readSlice = async (libraryID: string, sliceID: string) => {
89
84
  return { slice: model ? Slices.toSM(model) : undefined, errors };
90
85
  };
91
86
 
92
- export const renameSlice = async (
93
- slice: SliceSM,
94
- libName: string,
95
- ): ReturnType<SliceMachineManagerClient["slices"]["renameSlice"]> => {
96
- return await managerClient.slices.renameSlice({
97
- libraryID: libName,
98
- model: Slices.fromSM(slice),
99
- });
100
- };
101
-
102
- export const deleteSlice = async (sliceId: string, libName: string) =>
103
- await managerClient.slices.deleteSlice({
104
- libraryID: libName,
105
- sliceID: sliceId,
106
- });
107
-
108
87
  export const renameSliceVariation = async (
109
88
  slice: ComponentUI,
110
89
  variation: VariationSM,
@@ -782,4 +782,183 @@ describe("CustomTypeModel test suite", () => {
782
782
  },
783
783
  });
784
784
  });
785
+
786
+ it("should create a custom type with repeatable true", () => {
787
+ expect(
788
+ CustomTypeModel.create({
789
+ id: "id",
790
+ label: "lama",
791
+ repeatable: true,
792
+ format: "custom",
793
+ }),
794
+ ).toMatchInlineSnapshot(`
795
+ {
796
+ "format": "custom",
797
+ "id": "id",
798
+ "json": {
799
+ "Main": {
800
+ "uid": {
801
+ "config": {
802
+ "label": "UID",
803
+ },
804
+ "type": "UID",
805
+ },
806
+ },
807
+ },
808
+ "label": "lama",
809
+ "repeatable": true,
810
+ "status": true,
811
+ }
812
+ `);
813
+ });
814
+
815
+ it("should create a custom type with repeatable false", () => {
816
+ const result = CustomTypeModel.create({
817
+ id: "id",
818
+ label: "lama",
819
+ repeatable: false,
820
+ format: "custom",
821
+ });
822
+
823
+ expect(result.id).toBe("id");
824
+ expect(result.label).toBe("lama");
825
+ expect(result.format).toBe("custom");
826
+ expect(result.json).toHaveProperty("Main");
827
+ expect(result).toMatchInlineSnapshot(`
828
+ {
829
+ "format": "custom",
830
+ "id": "id",
831
+ "json": {
832
+ "Main": {},
833
+ },
834
+ "label": "lama",
835
+ "repeatable": false,
836
+ "status": true,
837
+ }
838
+ `);
839
+ });
840
+
841
+ it("should create a page type with a slice zone", () => {
842
+ const result = CustomTypeModel.create({
843
+ id: "🥪",
844
+ label: "label",
845
+ repeatable: true,
846
+ format: "page",
847
+ });
848
+
849
+ expect(result.format).toBe("page");
850
+ expect(result.json).toHaveProperty("Main");
851
+ expect(result.json.Main).toHaveProperty("slices");
852
+ expect(result.json).toHaveProperty("SEO & Metadata");
853
+ expect(result).toMatchInlineSnapshot(`
854
+ {
855
+ "format": "page",
856
+ "id": "🥪",
857
+ "json": {
858
+ "Main": {
859
+ "slices": {
860
+ "config": {
861
+ "choices": {},
862
+ },
863
+ "fieldset": "Slice Zone",
864
+ "type": "Slices",
865
+ },
866
+ "uid": {
867
+ "config": {
868
+ "label": "UID",
869
+ },
870
+ "type": "UID",
871
+ },
872
+ },
873
+ "SEO & Metadata": {
874
+ "meta_description": {
875
+ "config": {
876
+ "label": "Meta Description",
877
+ "placeholder": "A brief summary of the page",
878
+ },
879
+ "type": "Text",
880
+ },
881
+ "meta_image": {
882
+ "config": {
883
+ "constraint": {
884
+ "height": 1260,
885
+ "width": 2400,
886
+ },
887
+ "label": "Meta Image",
888
+ "thumbnails": [],
889
+ },
890
+ "type": "Image",
891
+ },
892
+ "meta_title": {
893
+ "config": {
894
+ "label": "Meta Title",
895
+ "placeholder": "A title of the page used for social media and search engines",
896
+ },
897
+ "type": "Text",
898
+ },
899
+ },
900
+ },
901
+ "label": "label",
902
+ "repeatable": true,
903
+ "status": true,
904
+ }
905
+ `);
906
+ });
907
+ });
908
+
909
+ it("when non repeatable page type is should contain Main with a slice-zone, no uid, and a SEO tab", () => {
910
+ const result = CustomTypeModel.create({
911
+ id: "foo",
912
+ label: "bar",
913
+ repeatable: false,
914
+ format: "page",
915
+ });
916
+
917
+ expect(result).toMatchInlineSnapshot(`
918
+ {
919
+ "format": "page",
920
+ "id": "foo",
921
+ "json": {
922
+ "Main": {
923
+ "slices": {
924
+ "config": {
925
+ "choices": {},
926
+ },
927
+ "fieldset": "Slice Zone",
928
+ "type": "Slices",
929
+ },
930
+ },
931
+ "SEO & Metadata": {
932
+ "meta_description": {
933
+ "config": {
934
+ "label": "Meta Description",
935
+ "placeholder": "A brief summary of the page",
936
+ },
937
+ "type": "Text",
938
+ },
939
+ "meta_image": {
940
+ "config": {
941
+ "constraint": {
942
+ "height": 1260,
943
+ "width": 2400,
944
+ },
945
+ "label": "Meta Image",
946
+ "thumbnails": [],
947
+ },
948
+ "type": "Image",
949
+ },
950
+ "meta_title": {
951
+ "config": {
952
+ "label": "Meta Title",
953
+ "placeholder": "A title of the page used for social media and search engines",
954
+ },
955
+ "type": "Text",
956
+ },
957
+ },
958
+ },
959
+ "label": "bar",
960
+ "repeatable": false,
961
+ "status": true,
962
+ }
963
+ `);
785
964
  });
@@ -104,8 +104,15 @@ type GetGroupFieldArgs = {
104
104
  groupFieldId: string;
105
105
  };
106
106
 
107
- export function getFormat(custom: CustomType): CustomTypeFormat {
108
- return custom.format ?? "custom";
107
+ type CreateArgs = {
108
+ format: CustomTypeFormat;
109
+ id: string;
110
+ label: string;
111
+ repeatable: boolean;
112
+ };
113
+
114
+ export function getFormat(customType: CustomType): CustomTypeFormat {
115
+ return customType.format ?? "custom";
109
116
  }
110
117
 
111
118
  export function getSectionEntries(
@@ -633,3 +640,104 @@ export function updateGroupFields(
633
640
  },
634
641
  };
635
642
  }
643
+
644
+ export function create(args: CreateArgs) {
645
+ const { id, label, repeatable, format } = args;
646
+ const mainTab = makeMainTab(repeatable, format);
647
+
648
+ return {
649
+ format,
650
+ id,
651
+ json: mainTab,
652
+ label,
653
+ repeatable,
654
+ status: true,
655
+ };
656
+ }
657
+
658
+ function makeMainTab(
659
+ repeatable: boolean,
660
+ format: CustomTypeFormat,
661
+ ): CustomType["json"] {
662
+ if (repeatable === false && format === "page") {
663
+ return { ...DEFAULT_MAIN_WITH_SLICE_ZONE, ...DEFAULT_SEO_TAB };
664
+ }
665
+
666
+ if (repeatable === false) {
667
+ return DEFAULT_MAIN;
668
+ }
669
+
670
+ if (format === "page") {
671
+ return {
672
+ ...DEFAULT_MAIN_WITH_UID_AND_SLICE_ZONE,
673
+ ...DEFAULT_SEO_TAB,
674
+ };
675
+ }
676
+
677
+ return DEFAULT_MAIN_WITH_UID;
678
+ }
679
+
680
+ const DEFAULT_MAIN: CustomType["json"] = {
681
+ Main: {},
682
+ };
683
+
684
+ const DEFAULT_MAIN_WITH_SLICE_ZONE: CustomType["json"] = {
685
+ Main: {
686
+ slices: {
687
+ config: {
688
+ choices: {},
689
+ },
690
+ fieldset: "Slice Zone",
691
+ type: "Slices",
692
+ },
693
+ },
694
+ };
695
+
696
+ const DEFAULT_MAIN_WITH_UID: CustomType["json"] = {
697
+ Main: {
698
+ uid: {
699
+ config: {
700
+ label: "UID",
701
+ },
702
+ type: "UID",
703
+ },
704
+ },
705
+ };
706
+
707
+ const DEFAULT_MAIN_WITH_UID_AND_SLICE_ZONE: CustomType["json"] = {
708
+ Main: {
709
+ ...DEFAULT_MAIN_WITH_UID.Main,
710
+ ...DEFAULT_MAIN_WITH_SLICE_ZONE.Main,
711
+ },
712
+ };
713
+
714
+ const DEFAULT_SEO_TAB: CustomType["json"] = {
715
+ "SEO & Metadata": {
716
+ meta_description: {
717
+ config: {
718
+ label: "Meta Description",
719
+ placeholder: "A brief summary of the page",
720
+ },
721
+ type: "Text",
722
+ },
723
+ meta_image: {
724
+ config: {
725
+ constraint: {
726
+ height: 1260,
727
+ width: 2400,
728
+ },
729
+ label: "Meta Image",
730
+ thumbnails: [],
731
+ },
732
+ type: "Image",
733
+ },
734
+ meta_title: {
735
+ config: {
736
+ label: "Meta Title",
737
+ placeholder:
738
+ "A title of the page used for social media and search engines",
739
+ },
740
+ type: "Text",
741
+ },
742
+ },
743
+ };
@@ -1,11 +1,13 @@
1
1
  import type {
2
2
  CompositeSlice,
3
3
  LegacySlice,
4
+ SharedSlice,
4
5
  } from "@prismicio/types-internal/lib/customtypes/widgets/slices";
5
6
  import { NestableWidget } from "@prismicio/types-internal/lib/customtypes";
6
7
 
7
8
  import type { ComponentUI } from "@lib/models/common/ComponentUI";
8
9
  import type { VariationSM, WidgetsArea } from "@lib/models/common/Slice";
10
+ import { pascalize, snakelize } from "@lib/utils/str";
9
11
 
10
12
  type CopySliceVariationArgs = {
11
13
  copiedVariation: VariationSM;
@@ -46,6 +48,8 @@ type ReorderFieldArgs = {
46
48
  destinationIndex: number;
47
49
  };
48
50
 
51
+ const DEFAULT_VARIATION_ID = "default";
52
+
49
53
  export function countMissingScreenshots(slice: ComponentUI): number {
50
54
  return slice.model.variations.length - Object.keys(slice.screenshots).length;
51
55
  }
@@ -243,3 +247,37 @@ export function reorderField(args: ReorderFieldArgs): ComponentUI {
243
247
  },
244
248
  };
245
249
  }
250
+
251
+ export function buildEmptySliceModel(sliceName: string): SharedSlice {
252
+ return {
253
+ id: snakelize(sliceName),
254
+ type: "SharedSlice",
255
+ name: sliceName,
256
+ description: sliceName,
257
+ variations: [
258
+ {
259
+ id: DEFAULT_VARIATION_ID,
260
+ name: pascalize(DEFAULT_VARIATION_ID),
261
+ // Property not used yet. Fallback to "...".
262
+ docURL: "...",
263
+ // "initial" is fine here as default value.
264
+ version: "initial",
265
+ description: pascalize(DEFAULT_VARIATION_ID),
266
+ // Empty string is fine, we don't want to save imageUrl.
267
+ // We don't want to compare local and remote image with imageUrl.
268
+ // It will be striped anyway when doing the comparison.
269
+ imageUrl: "",
270
+ },
271
+ ],
272
+ };
273
+ }
274
+
275
+ export function rename(slice: ComponentUI, newSliceName: string): ComponentUI {
276
+ return {
277
+ ...slice,
278
+ model: {
279
+ ...slice.model,
280
+ name: newSliceName,
281
+ },
282
+ };
283
+ }
@@ -1,35 +1,15 @@
1
- import { useEffect, useState } from "react";
2
- import { useSelector } from "react-redux";
1
+ import { useState } from "react";
3
2
  import { Box, Button, Text } from "@prismicio/editor-ui";
4
3
  import { cache } from "@prismicio/editor-support/Suspense";
5
4
 
6
5
  import { CreateCustomTypeModal } from "@components/Forms/CreateCustomTypeModal";
7
- import { SliceMachineStoreType } from "@src/redux/type";
8
- import useSliceMachineActions from "@src/modules/useSliceMachineActions";
9
- import { LoadingKeysEnum } from "@src/modules/loading/types";
10
- import { isLoading } from "@src/modules/loading";
11
6
  import { BlankPageIcon } from "@src/icons/BlankPageIcon";
12
7
  import { getIsEmptyProject } from "@src/hooks/useIsEmptyProject";
13
8
 
14
9
  export function PageTypeOnboarding() {
15
- const { openCreateCustomTypeModal } = useSliceMachineActions();
16
- const { isCreatingCustomType } = useSelector(
17
- (store: SliceMachineStoreType) => ({
18
- isCreatingCustomType: isLoading(
19
- store,
20
- LoadingKeysEnum.CREATE_CUSTOM_TYPE,
21
- ),
22
- }),
23
- );
24
- // State to ensure button loader is still visible while redirecting
25
- const [isButtonLoading, setIsButtonLoading] = useState(false);
26
-
27
- useEffect(() => {
28
- if (isCreatingCustomType) {
29
- setIsButtonLoading(true);
30
- cache.clear(getIsEmptyProject, []);
31
- }
32
- }, [isCreatingCustomType]);
10
+ const [isCreatingCustomType, setIsCreatingCustomType] = useState(false);
11
+ const [isCreateCustomTypeModalOpen, setIsCreateCustomTypeModalOpen] =
12
+ useState(false);
33
13
 
34
14
  return (
35
15
  <Box
@@ -53,10 +33,25 @@ export function PageTypeOnboarding() {
53
33
  Welcome to Slice Machine. Your journey starts with your first page
54
34
  type — the model that you will use to create pages for your website.
55
35
  </Text>
56
- <Button onClick={openCreateCustomTypeModal} loading={isButtonLoading}>
36
+ <Button
37
+ loading={isCreatingCustomType}
38
+ onClick={() => {
39
+ setIsCreateCustomTypeModalOpen(true);
40
+ }}
41
+ >
57
42
  Create a page type
58
43
  </Button>
59
- <CreateCustomTypeModal format="page" origin="onboarding" />
44
+ <CreateCustomTypeModal
45
+ format="page"
46
+ isCreating={isCreatingCustomType}
47
+ isOpen={isCreateCustomTypeModalOpen}
48
+ origin="onboarding"
49
+ onCreateChange={(isCreating) => {
50
+ setIsCreatingCustomType(isCreating);
51
+ cache.clear(getIsEmptyProject, []);
52
+ }}
53
+ onOpenChange={setIsCreateCustomTypeModalOpen}
54
+ />
60
55
  </Box>
61
56
  </Box>
62
57
  );