slice-machine-ui 2.18.0 → 2.18.1-alpha.dani-mcp.1

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 (44) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/{by9lqJyIeSCZtBP_fLO45 → SYZmtCXDQQhzEqpdfRb9-}/_buildManifest.js +1 -1
  3. package/out/_next/static/chunks/248-43faecb386a16518.js +1 -0
  4. package/out/_next/static/chunks/422-c9192a1dbdd2ae0e.js +1 -0
  5. package/out/_next/static/chunks/489-234ed5471aa694b3.js +1 -0
  6. package/out/_next/static/chunks/pages/{_app-76c43bdc0320687e.js → _app-0d5ae0ab4cbc0245.js} +2 -2
  7. package/out/_next/static/chunks/pages/changelog-ba55ed247c20dc21.js +1 -0
  8. package/out/_next/static/chunks/pages/changes-4c23263cdc8e59c6.js +1 -0
  9. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-7102c23f96cd1768.js → [customTypeId]-816acb31b652239b.js} +1 -1
  10. package/out/_next/static/chunks/pages/labs-78ac01d97ab02cd7.js +1 -0
  11. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-d4bc920a5efffa0a.js → [pageTypeId]-669d5479e81b638b.js} +1 -1
  12. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-93e6cb0c4429ce10.js +1 -0
  13. package/out/_next/static/chunks/pages/slices-f6552e2fbc491c4d.js +1 -0
  14. package/out/changelog.html +1 -1
  15. package/out/changes.html +1 -1
  16. package/out/custom-types/[customTypeId].html +1 -1
  17. package/out/custom-types.html +1 -1
  18. package/out/index.html +1 -1
  19. package/out/labs.html +1 -1
  20. package/out/page-types/[pageTypeId].html +1 -1
  21. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  22. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  23. package/out/slices.html +1 -1
  24. package/package.json +5 -7
  25. package/src/features/auth/LogoutButton.tsx +30 -4
  26. package/src/features/navigation/Navigation.tsx +25 -1
  27. package/src/features/navigation/NavigationItem.tsx +9 -3
  28. package/src/features/sync/actions/pushChanges.ts +1 -0
  29. package/src/features/sync/getUnSyncChanges.ts +22 -4
  30. package/src/legacy/components/AppLayout/index.tsx +42 -2
  31. package/src/legacy/components/ChangesEmptyState/AuthErrorPage.tsx +2 -12
  32. package/src/legacy/components/Navigation/Environment.tsx +2 -10
  33. package/src/legacy/components/Navigation/SideNavEnvironmentSelector/SideNavEnvironmentSelector.tsx +6 -1
  34. package/src/legacy/lib/models/common/ModelStatus/index.ts +6 -1
  35. package/src/pages/changes.tsx +1 -4
  36. package/out/_next/static/chunks/248-bdbfde18c5a04eae.js +0 -1
  37. package/out/_next/static/chunks/385-b949173dfa03dd3e.js +0 -1
  38. package/out/_next/static/chunks/489-6edb99e269996dd1.js +0 -1
  39. package/out/_next/static/chunks/pages/changelog-21b960abba5abf71.js +0 -1
  40. package/out/_next/static/chunks/pages/changes-bdfa50eadb1e5a42.js +0 -1
  41. package/out/_next/static/chunks/pages/labs-d79597003a1ff74e.js +0 -1
  42. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-98f85d5fb8d5c704.js +0 -1
  43. package/out/_next/static/chunks/pages/slices-046e5e978ffc3a42.js +0 -1
  44. /package/out/_next/static/{by9lqJyIeSCZtBP_fLO45 → SYZmtCXDQQhzEqpdfRb9-}/_ssgManifest.js +0 -0
@@ -13,6 +13,7 @@ type NavigationItemPropsBase = {
13
13
  active?: boolean;
14
14
  Icon: FC<SVGProps<SVGSVGElement>>;
15
15
  RightElement?: ReactNode;
16
+ tooltip?: string;
16
17
  };
17
18
 
18
19
  type NavigationLinkItemProps = NavigationItemPropsBase & {
@@ -32,7 +33,8 @@ type NavigationButtonItemProps = NavigationItemPropsBase & {
32
33
  type NavigationItemProps = NavigationLinkItemProps | NavigationButtonItemProps;
33
34
 
34
35
  export function NavigationItem(props: NavigationItemProps) {
35
- const { title, href, target, active, Icon, RightElement, onClick } = props;
36
+ const { title, href, target, active, Icon, RightElement, onClick, tooltip } =
37
+ props;
36
38
 
37
39
  const isCollapsed = useMediaQuery({ max: "medium" });
38
40
 
@@ -45,7 +47,7 @@ export function NavigationItem(props: NavigationItemProps) {
45
47
  textVariant="normal"
46
48
  backgroundColor="transparent"
47
49
  renderStartIcon={ItemIcon}
48
- endAdornment={RightElement}
50
+ endAdornment={isCollapsed ? undefined : RightElement}
49
51
  selected={active}
50
52
  >
51
53
  {isCollapsed ? null : title}
@@ -53,7 +55,11 @@ export function NavigationItem(props: NavigationItemProps) {
53
55
  );
54
56
 
55
57
  return (
56
- <Tooltip content={title} side="right" visible={isCollapsed}>
58
+ <Tooltip
59
+ content={Boolean(tooltip) ? tooltip ?? "" : title}
60
+ side="right"
61
+ visible={Boolean(tooltip) ? undefined : isCollapsed}
62
+ >
57
63
  {href !== undefined ? (
58
64
  <Link
59
65
  href={href}
@@ -29,6 +29,7 @@ export async function pushChanges(
29
29
  type: "Slice" as const,
30
30
  libraryID: sliceChange.slice.from,
31
31
  status: sliceChange.status,
32
+ variationImageUrlMap: sliceChange.variationImageUrlMap,
32
33
  }));
33
34
  const customTypeChanges = changedCustomTypes.map((customTypeChange) => ({
34
35
  id: customTypeChange.customType.id,
@@ -3,6 +3,7 @@ import { LibraryUI } from "@/legacy/lib/models/common/LibraryUI";
3
3
  import {
4
4
  getModelId,
5
5
  hasLocal,
6
+ hasRemote,
6
7
  isRemoteOnly,
7
8
  LocalOrRemoteCustomType,
8
9
  LocalOrRemoteSlice,
@@ -76,11 +77,23 @@ export function getUnSyncedChanges(
76
77
  );
77
78
 
78
79
  const changedSlices = unSyncedSlices
79
- .map((s) => ({
80
- slice: s,
81
- status: modelsStatuses.slices[s.model.id],
82
- }))
80
+ .map((slice) => {
81
+ const status = modelsStatuses.slices[slice.model.id];
82
+
83
+ const imageUrlMap = findRemoteSlice(
84
+ slices,
85
+ slice.model.id,
86
+ )?.variations.reduce<Record<string, string>>((result, variation) => {
87
+ const { imageUrl } = variation;
88
+ if (imageUrl === undefined || imageUrl === "") return result;
89
+ result[variation.id] = imageUrl;
90
+ return result;
91
+ }, {});
92
+
93
+ return { status, slice, variationImageUrlMap: imageUrlMap ?? {} };
94
+ })
83
95
  .filter((s): s is ChangedSlice => unSyncStatuses.includes(s.status));
96
+
84
97
  const changedCustomTypes = unSyncedCustomTypes
85
98
  .map((model) => (hasLocal(model) ? model.local : model.remote))
86
99
  .map((ct) => ({
@@ -98,6 +111,11 @@ export function getUnSyncedChanges(
98
111
  };
99
112
  }
100
113
 
114
+ function findRemoteSlice(slices: LocalOrRemoteSlice[], sliceId: string) {
115
+ const slice = slices.find((s) => hasRemote(s) && s.remote.id === sliceId);
116
+ return slice && hasRemote(slice) ? slice.remote : undefined;
117
+ }
118
+
101
119
  // ComponentUI are manipulated on all the relevant pages
102
120
  // But the data is not available for remote only slices
103
121
  // which have been deleted locally
@@ -6,9 +6,11 @@ import {
6
6
  Box,
7
7
  Button,
8
8
  ButtonGroup,
9
+ Text,
9
10
  } from "@prismicio/editor-ui";
11
+ import { isUnauthorizedError } from "@slicemachine/manager/client";
10
12
  import { useRouter } from "next/router";
11
- import { FC, PropsWithChildren, Suspense } from "react";
13
+ import { FC, PropsWithChildren, Suspense, useState } from "react";
12
14
 
13
15
  import { Breadcrumb } from "@/components/Breadcrumb";
14
16
  import {
@@ -18,6 +20,7 @@ import {
18
20
  PageLayoutPane,
19
21
  } from "@/components/PageLayout";
20
22
  import { ErrorBoundary } from "@/ErrorBoundary";
23
+ import { LogoutButton } from "@/features/auth/LogoutButton";
21
24
  import { useActiveEnvironment } from "@/features/environments/useActiveEnvironment";
22
25
  import { Navigation } from "@/features/navigation/Navigation";
23
26
 
@@ -44,7 +47,7 @@ export const AppLayout: FC<PropsWithChildren> = ({
44
47
  />
45
48
  <BlankSlateTitle>Failed to load Slice Machine</BlankSlateTitle>
46
49
  <BlankSlateDescription>
47
- {JSON.stringify(error)}
50
+ <RenderError error={error} />
48
51
  </BlankSlateDescription>
49
52
  </BlankSlate>
50
53
  </Box>
@@ -63,6 +66,43 @@ export const AppLayout: FC<PropsWithChildren> = ({
63
66
  );
64
67
  };
65
68
 
69
+ function RenderError(args: { error: unknown }) {
70
+ const { error } = args;
71
+
72
+ if (isUnauthorizedError(error)) {
73
+ return <UnauthorizedErrorView />;
74
+ }
75
+ return <>{JSON.stringify(error)}</>;
76
+ }
77
+
78
+ function UnauthorizedErrorView() {
79
+ const [isLoggingOut, setIsLoggingOut] = useState(false);
80
+
81
+ return (
82
+ <Box flexDirection="column" gap={16} margin={{ top: 8 }}>
83
+ <Box flexDirection="column" gap={8} alignItems="center">
84
+ <Text variant="h3" align="center">
85
+ It seems like you don't have access to this repository
86
+ </Text>
87
+ <Text align="center">
88
+ Check that the repository name is correct, then contact your
89
+ repository administrator.
90
+ </Text>
91
+ </Box>
92
+ <LogoutButton
93
+ isLoading={isLoggingOut}
94
+ onLogoutSuccess={() => {
95
+ setIsLoggingOut(true);
96
+ window.location.reload();
97
+ }}
98
+ sx={{ alignSelf: "center" }}
99
+ >
100
+ Log out
101
+ </LogoutButton>
102
+ </Box>
103
+ );
104
+ }
105
+
66
106
  const environmentTopBorderColorMap = {
67
107
  prod: "purple",
68
108
  stage: "indigo",
@@ -5,7 +5,7 @@ import { AuthStatus } from "@/modules/userContext/types";
5
5
  import useSliceMachineActions from "@/modules/useSliceMachineActions";
6
6
 
7
7
  export type AuthErrorPageProps = {
8
- authStatus: AuthStatus.UNAUTHORIZED | AuthStatus.FORBIDDEN;
8
+ authStatus: AuthStatus.FORBIDDEN;
9
9
  };
10
10
 
11
11
  export const AuthErrorPage: FC<AuthErrorPageProps> = (props) => {
@@ -20,23 +20,13 @@ export const AuthErrorPage: FC<AuthErrorPageProps> = (props) => {
20
20
  justifyContent="center"
21
21
  gap={8}
22
22
  >
23
- {authStatus === AuthStatus.FORBIDDEN ? (
23
+ {authStatus === AuthStatus.FORBIDDEN && (
24
24
  <>
25
25
  <Text variant="h3" align="center">
26
26
  It seems like you are logged out
27
27
  </Text>
28
28
  <Text align="center">Log in to connect to your repository.</Text>
29
29
  </>
30
- ) : (
31
- <>
32
- <Text variant="h3" align="center">
33
- It seems like you don't have access to this repository
34
- </Text>
35
- <Text align="center">
36
- Check that the repository name is correct, then contact your
37
- repository administrator.
38
- </Text>
39
- </>
40
30
  )}
41
31
  <Text align="center">
42
32
  If that doesn't work, it's possible that Slice Machine is having trouble
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  Environment as EnvironmentType,
3
3
  isUnauthenticatedError,
4
- isUnauthorizedError,
5
4
  } from "@slicemachine/manager/client";
6
5
  import { useState } from "react";
7
6
 
@@ -98,17 +97,10 @@ export function Environment() {
98
97
  );
99
98
  }
100
99
 
101
- if (
102
- isUnauthenticatedError(useEnvironmentsError) ||
103
- isUnauthorizedError(useEnvironmentsError)
104
- ) {
100
+ if (isUnauthenticatedError(useEnvironmentsError)) {
105
101
  return (
106
102
  <SideNavEnvironmentSelector
107
- variant={
108
- isUnauthenticatedError(useEnvironmentsError)
109
- ? "unauthenticated"
110
- : "unauthorized"
111
- }
103
+ variant="unauthenticated"
112
104
  onLogInClick={() => openLoginModal()}
113
105
  />
114
106
  );
@@ -17,6 +17,7 @@ import * as VisuallyHidden from "@radix-ui/react-visually-hidden";
17
17
  import type { Environment } from "@slicemachine/manager/client";
18
18
  import { clsx } from "clsx";
19
19
  import type { FC, ReactNode } from "react";
20
+ import { toast } from "react-toastify";
20
21
 
21
22
  import { LogoutButton } from "@/features/auth/LogoutButton";
22
23
  import { LoginIcon } from "@/icons/LoginIcon";
@@ -140,7 +141,11 @@ export const SideNavEnvironmentSelector: FC<SideNavEnvironmentSelectorProps> = (
140
141
  />
141
142
  ) : undefined}
142
143
 
143
- {variant === "default" && <LogoutButton />}
144
+ {variant === "default" && (
145
+ <LogoutButton
146
+ onLogoutSuccess={() => toast.success("Logged out")}
147
+ />
148
+ )}
144
149
  </Box>
145
150
  </>
146
151
  )}
@@ -30,7 +30,12 @@ export type ChangesStatus =
30
30
  | ModelStatus.New
31
31
  | ModelStatus.Modified;
32
32
 
33
- export type ChangedSlice = { status: ChangesStatus; slice: ComponentUI };
33
+ export type ChangedSlice = {
34
+ status: ChangesStatus;
35
+ slice: ComponentUI;
36
+ /** A map of variation IDs to remote screenshot URLs. */
37
+ variationImageUrlMap: Record<string, string>;
38
+ };
34
39
  export type ChangedCustomType = {
35
40
  status: ChangesStatus;
36
41
  customType: CustomTypeSM;
@@ -114,10 +114,7 @@ const Changes: React.FunctionComponent = () => {
114
114
  if (!isOnline) {
115
115
  return <OfflinePage />;
116
116
  }
117
- if (
118
- authStatus === AuthStatus.UNAUTHORIZED ||
119
- authStatus === AuthStatus.FORBIDDEN
120
- ) {
117
+ if (authStatus === AuthStatus.FORBIDDEN) {
121
118
  return <AuthErrorPage authStatus={authStatus} />;
122
119
  }
123
120
  if (numberOfChanges === 0) {
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[248],{72641:function(e,t,n){"use strict";n.d(t,{R$:function(){return i},Qj:function(){return x},T9:function(){return d},nf:function(){return h},u2:function(){return o},_T:function(){return u}});var l=n(52322),r=n(14226),a=n(6277),s=n(83478),c=n.n(s);let i=e=>{let{backgroundImage:t,style:n,...r}=e,s=void 0!==t;return(0,l.jsx)("article",{...r,className:(0,a.W)(c().root,{[c().withBackground]:s}),style:{backgroundImage:s?"url(".concat(t,")"):void 0,...n}})},o=e=>(0,l.jsx)("div",{...e,className:c().image}),d=e=>(0,l.jsx)("div",{...e,className:c().content}),u=e=>(0,l.jsx)(r.bL,{...e,variant:"h3"}),h=e=>(0,l.jsx)(r.bL,{...e,color:"grey11"}),x=e=>(0,l.jsx)("div",{...e,className:c().actions,color:"grey"})},38241:function(e,t,n){"use strict";n.d(t,{F:function(){return O}});var l=n(52322),r=n(14226),a=n(97729),s=n.n(a),c=n(2784),i=n(43388),o=n(17378),d=n(98564),u=n(2993),h=n(5632),x=n(56580),m=n(75289),p=n(77630),j=n(88932),g=n(94160),b=n(39204);async function f(e){let{id:t,label:n,repeatable:l,format:r,onSuccess:a}=e,s=d.$[r],c=(0,p.Ue)({id:t,label:n,repeatable:l,format:r});try{let{errors:e}=await (0,g.KA)({customType:c});if(e.length>0)throw e;g.Xe.track({event:"custom-type:created",id:c.id,name:n,format:r,type:l?"repeatable":"single",origin:"table"}),await a(c),j.Am.success((0,b.GX)({message:"".concat(s.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(c.id,"/index.json")}))}catch(t){let e="Internal Error: ".concat(s.name({start:!0,plural:!1})," not saved");console.error(e,t),j.Am.error(e)}}var v=n(59294),_=n(98250),S=n(68968),y=n(59532),C=n(7974),k=n(358),w=n(78254),L=n(54597),I=n(46999),R=n(63397);let B=e=>{let{selected:t,...n}=e;return(0,l.jsx)(m.kC,{sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:t?e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}:"none","&:hover":{boxShadow:e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}}},...n})},N=e=>{let{format:t}=e,[n,,r]=(0,R.U$)("repeatable"),a=d.$[t];return(0,l.jsxs)(m.xu,{mb:2,children:[(0,l.jsxs)(B,{selected:n.value,onClick:()=>r.setValue(!0),children:[(0,l.jsx)(m.Y8,{checked:n.value,onChange:()=>{},"data-testid":"repeatable-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Reusable type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintRepeatable})]})]}),(0,l.jsxs)(B,{selected:!n.value,onClick:()=>r.setValue(!1),children:[(0,l.jsx)(m.Y8,{checked:!n.value,onChange:()=>{},"data-testid":"single-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Single type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintSingle})]})]})]})},z=e=>{let{format:t,isCreating:n,isOpen:r,origin:a="table",onCreateChange:s,onOpenChange:i}=e,{createCustomTypeSuccess:o}=(0,L.Z)(),{completeStep:u}=(0,_.k)(),{customTypeIds:j,customTypeLabels:g}=(0,x.v9)(e=>({customTypeIds:(0,w.W6)(e),customTypeLabels:(0,w.YS)(e)})),b=d.$[t],[R,B]=(0,c.useState)(!0),{syncChanges:z}=(0,S.g)(),E=(0,h.useRouter)(),T=async e=>{let{id:n,label:l,repeatable:r}=e;s(!0),await f({format:t,id:n,label:l,origin:a,repeatable:r,onSuccess:async e=>{o(e);let t=(0,p.y6)(e),l=v.cd[t];B(!0),await E.push({pathname:l.getBuilderPagePathname(n)}),z(),"page"===t&&u("createPageType")}}),s(!1),i(!1)},G=(e,t,n)=>{n(R?{...t,label:e.target.value,id:(0,k.lV)(e.target.value)}:{...t,label:e.target.value})},D=(e,t)=>{t("id",e.target.value),B(!1)};return(0,l.jsx)(y.Z,{testId:"create-ct-modal",isOpen:r,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:()=>{i(!1),B(!0)},onSubmit:e=>{T(e)},isLoading:n,initialValues:{repeatable:!0,id:"",label:""},validate:e=>{let{id:t,label:n}=e,l={};return n&&n.length||(l.label="Cannot be empty."),!l.label&&g.includes(n)&&(l.label="".concat(b.name({start:!0,plural:!1})," name is already taken.")),["update","insert"].includes(n.toLowerCase())&&(l.label='Name "'.concat(n,'" is reserved for Slice Machine use.')),t&&t.length||(l.id="ID cannot be empty."),["update","insert"].includes(t.toLowerCase())&&(l.id='Id "'.concat(t,'" is reserved for Slice Machine use.')),l.id||!t||C.xo.exec(t)||(l.id="Invalid id: No special characters allowed."),!l.id&&t&&j.map(e=>e.toLowerCase()).includes(t)&&(l.id='ID "'.concat(t,'" exists already.')),Object.keys(l).length>0?l:void 0},content:{title:"Create a new ".concat(b.name({start:!1,plural:!1}))},children:e=>{let{errors:n,setValues:r,setFieldValue:a,values:s,touched:c}=e;return(0,l.jsxs)(m.xu,{children:[(0,l.jsx)(N,{format:t}),(0,l.jsx)(I.W,{name:"label",label:"".concat(b.name({start:!0,plural:!1})," Name"),testId:"ct-name-input",placeholder:"A display name for the ".concat(b.name({start:!1,plural:!1})),error:c.label?n.label:void 0,onChange:e=>G(e,s,r)}),(0,l.jsx)(I.W,{name:"id",testId:"ct-id-input",label:"".concat(b.name({start:!0,plural:!1})," ID"),placeholder:b.inputPlaceholder,error:c.id?n.id:void 0,onChange:e=>D(e,a)})]})}})};var E=n(72641);let T=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf"}),(0,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc"}),(0,l.jsx)("path",{d:"m10.0912 8c-2.8118 0-5.0912 2.2794-5.0912 5.0912s2.2794 5.0912 5.0912 5.0912c1.8851 0 3.5303-1.0247 4.4098-2.5452.1553-.2684.2868-.5523.3916-.8489.092-.2604-.0444-.5461-.3048-.6381-.2603-.092-.546.0445-.638.3048-.0841.238-.1897.4659-.3144.6815-.7081 1.2241-2.0305 2.0459-3.5442 2.0459-2.2595 0-4.0912-1.8317-4.0912-4.0912s1.8317-4.0912 4.0912-4.0912c1.3566 0 2.5595.66 3.3043 1.6782h-1.7739c-.2761 0-.5.2239-.5.5 0 .2762.2239.5.5.5h2.6782c.2762 0 .5-.2238.5-.5v-2.6782c0-.2761-.2238-.5-.5-.5-.2761 0-.5.2239-.5.5v1.1032c-.9281-.9865-2.2462-1.6032-3.7086-1.6032z",fill:"#fff"})]}),G=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf",fillRule:"nonzero"}),(0,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc",fillRule:"nonzero"}),(0,l.jsx)("path",{d:"m8.0869 10.6818.5758-2.3031c.0556-.2226.2556-.3787.485-.3787.3253 0 .564.3057.4851.6213l-.5151 2.0605h2.6055l.5758-2.3031c.0557-.2226.2557-.3787.4851-.3787.3253 0 .564.3057.4851.6213l-.5152 2.0605h2.246c.2761 0 .5.2239.5.5 0 .2762-.2239.5-.5.5h-2.496l-.6591 2.6364h2.1551c.2761 0 .5.2238.5.5 0 .2761-.2239.5-.5.5h-2.4051l-.5757 2.3031c-.0557.2226-.2557.3787-.4851.3787-.3253 0-.564-.3057-.4851-.6213l.5152-2.0605h-2.6056l-.5758 2.3031c-.0556.2226-.2556.3787-.4851.3787-.3253 0-.5639-.3057-.485-.6213l.5151-2.0605h-1.9278c-.2761 0-.5-.2239-.5-.5 0-.2762.2239-.5.5-.5h2.1778l.6591-2.6364h-1.8369c-.2761 0-.5-.2238-.5-.5 0-.2761.2239-.5.5-.5zm2.7273 3.6364.659-2.6364h-2.6055l-.6591 2.6364z",fill:"#fff"})]});var D=n(60867),P=n(50477),W=n(94840),A=n(16442);let $=e=>{let{format:t,isCreatingCustomType:n,openCreateCustomTypeModal:a}=e,s=(0,h.useRouter)(),{customTypes:i,updateCustomTypes:o}=(0,P.xU)(t),u=i.sort((e,t)=>e.id.localeCompare(t.id)),m=v.cd[t],p=d.$[t];return(!function(e,t,n){let{storeCustomTypes:l}=(0,x.v9)(e=>({storeCustomTypes:(0,w.Ch)(e).filter(A.TG)}));(0,c.useEffect)(()=>{let r=l.filter(e=>{let{local:n}=e;return n.format===t});(r.length!==e.length||r.some(t=>{let n=e.find(e=>e.id===t.local.id);return!n||JSON.stringify(W.Dc.fromSM(t.local))!==JSON.stringify(n)}))&&n(r.map(e=>{let{local:t}=e;return W.Dc.fromSM(t)}))},[t,n,e,l])}(i,t,o),0===u.length)?(0,l.jsxs)(E.R$,{"data-testid":"blank-slate",style:{alignSelf:"center",marginTop:r.t.space[72]},children:[(0,l.jsx)(E.u2,{children:(0,l.jsx)(r.a_,{src:m.blankSlateImage,sizing:"cover"})}),(0,l.jsxs)(E.T9,{children:[(0,l.jsx)(E._T,{children:p.name({start:!0,plural:!0})}),(0,l.jsx)(E.nf,{children:p.blankSlateDescription}),(0,l.jsx)(E.Qj,{children:(0,l.jsx)(r.E,{onClick:a,loading:n,children:"Create"})})]})]}):(0,l.jsx)("div",{children:(0,l.jsxs)(r.bE,{columnLayout:"28px 1fr 1fr 1fr 42px",children:[(0,l.jsx)(r.bH,{children:(0,l.jsxs)(r.bI,{children:[(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.aX,{name:"notes",size:"medium"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Label"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"API ID"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Limit"})}),(0,l.jsx)(r.bG,{})]})}),(0,l.jsx)(r.bF,{children:u.map(e=>{let{repeatable:n,label:a,id:c}=e;return(0,l.jsxs)(r.bI,{onClick:()=>{s.push(v.cd[t].getBuilderPagePathname(c))},children:[(0,l.jsx)(r.bG,{children:n?(0,l.jsx)(T,{width:r.t.space[20]}):(0,l.jsx)(G,{width:r.t.space[20]})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{variant:"bold",noWrap:!0,children:a})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:c})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:n?"Reusable":"Single"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(D._,{isChangesLocal:!1,format:t,customType:e})})]},c)})})]})})},O=e=>{let{format:t}=e,n=d.$[t],[a,h]=(0,c.useState)(!1),[x,m]=(0,c.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s(),{children:(0,l.jsxs)("title",{children:[n.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,l.jsx)(o.S,{renderError:()=>(0,l.jsx)(u.LN,{children:(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.D,{alignItems:"center",justifyContent:"center",children:(0,l.jsx)(r.ax,{title:"Request failed",description:"An error occurred while fetching your ".concat(n.name({start:!1,plural:!0}),".")})})})}),children:(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.bg,{})})]}),children:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{"data-testid":"create-ct",loading:a,onClick:()=>{m(!0)},startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsxs)(r.D,{flexDirection:"column",children:[(0,l.jsx)($,{format:t,isCreatingCustomType:a,openCreateCustomTypeModal:()=>{m(!0)}}),(0,l.jsx)(z,{format:t,isCreating:a,isOpen:x,onCreateChange:h,onOpenChange:m})]})})]})})})]})}},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return o},W:function(){return i}});var l=n(52322),r=n(2784),a=n(75289);let s=e=>{let{bg:t,background:n,sx:r,withRadius:s,radius:c,children:i}=e;return(0,l.jsx)(a.xu,{sx:{p:4,bg:t||n,...s?{borderBottomLeftRadius:c,borderBottomRightRadius:c}:null,...r},children:i})},c=(0,r.createContext)("6px"),i=()=>(0,r.useContext)(c),o=e=>{let{Header:t=null,SubHeader:n=null,Body:r=null,Footer:i=null,borderFooter:o=!1,radius:d="6px",bodySx:u={},footerSx:h={},sx:x=null,bg:m,background:p,children:j,...g}=e;return(0,l.jsx)(c.Provider,{value:d,children:(0,l.jsxs)(a.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:d,...x},...g,children:[t||null,n||null,(0,l.jsxs)(s,{bg:m,background:p,sx:u,withRadius:!i,children:[r?(0,l.jsx)(r,{}):null,j||null]}),i?(0,l.jsx)(s,{bg:m,background:p,sx:{...o?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...h},radius:d,withRadius:!0,children:"object"==typeof i?i:(0,l.jsx)(i,{})}):null]})})}},7974:function(e,t,n){"use strict";n.d(t,{Sn:function(){return c},lS:function(){return l},nG:function(){return r},pq:function(){return i},rd:function(){return s},xo:function(){return a}});let l=["components","update","insert"],r=["png","jpg","jpeg"],a=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,s="placeholders/What_are_Slices_mrvome",c="SM_HELP_VIDEOS/mock_data",i="slice-machine-simulator"},83478:function(e){e.exports={column:"BlankSlate_column__genEe",root:"BlankSlate_root__CmSqW BlankSlate_column__genEe",fadeIn:"BlankSlate_fadeIn__mAfi5",withBackground:"BlankSlate_withBackground__mLYij",image:"BlankSlate_image__Jn90S BlankSlate_column__genEe",content:"BlankSlate_content__0Yt2d BlankSlate_column__genEe",desc:"BlankSlate_desc___Dl7e",actions:"BlankSlate_actions__OYRj4"}}}]);