slice-machine-ui 2.3.1-beta.6 → 2.3.1-beta.7
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/out/404.html +1 -1
- package/out/_next/static/chunks/{448-183e650f05037eef.js → 448-703cda73b6039a88.js} +1 -1
- package/out/_next/static/chunks/{802-72ceb03e414202ee.js → 802-0be9bb20fc0d40d4.js} +1 -1
- package/out/_next/static/chunks/pages/{_app-d1a873a080e65564.js → _app-3f5ee8a060fdd43e.js} +2 -2
- package/out/_next/static/chunks/pages/{changelog-cbafb05b25714889.js → changelog-40f8a853383eb4e7.js} +1 -1
- package/out/_next/static/chunks/pages/{changes-5b897a4267b76a20.js → changes-feef2813ba80b777.js} +1 -1
- package/out/_next/static/chunks/pages/{labs-445e30efa64531d0.js → labs-8c10ebf645f94206.js} +1 -1
- package/out/_next/static/chunks/pages/{settings-0c5d282867dc559a.js → settings-3e0fc87452053a17.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-628fd7717e5e7678.js → [variation]-cc3c69bbc0168169.js} +1 -1
- package/out/_next/static/chunks/pages/{slices-cc1865f601dca9df.js → slices-e13ad016b19446e7.js} +1 -1
- package/out/_next/static/css/{fbc38696c23ee168.css → c1b9dfb59bc111e1.css} +1 -1
- package/out/_next/static/{BYX3lrf2WNCjipk8J_g8B → qBIKwMGCCngU7ltrCgjdx}/_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/settings.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 +4 -3
- package/src/features/onboarding/OnboardingGuide/OnboardingGuide.module.css +21 -0
- package/src/features/onboarding/OnboardingGuide/OnboardingGuide.module.css.d.ts +8 -0
- package/src/features/onboarding/OnboardingGuide/OnboardingGuide.tsx +90 -0
- package/src/features/onboarding/OnboardingGuide/index.ts +1 -0
- package/src/features/onboarding/OnboardingProgressStepper.tsx +3 -1
- package/src/features/onboarding/OnboardingProvider.tsx +10 -1
- package/src/features/onboarding/OnboardingGuide.tsx +0 -55
- /package/out/_next/static/{BYX3lrf2WNCjipk8J_g8B → qBIKwMGCCngU7ltrCgjdx}/_ssgManifest.js +0 -0
package/out/_next/static/chunks/pages/{slices-cc1865f601dca9df.js → slices-e13ad016b19446e7.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{74600:function(e,n,t){var i=t(34311),r=t(23779),o=i(function(e,n,t){return e+(t?" ":"")+r(n)});e.exports=o},26688:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices",function(){return t(90217)}])},61107:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var i=t(62230),r=t(85244),o=t(98240),l=t(52322),s=t(2784),c=t(75289),a=function(e,n){return e?"".concat(e,"-").concat(n):""},u=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},d=(0,s.forwardRef)(function(e,n){var t=e.label,s=e.Icon,d=e.type,f=e.form,m=e.isLoading,p=void 0!==m&&m,h=e.disabled,x=e.onClick,v=e.sx,y=e.iconSize,b=void 0===y?16:y,g=e.iconFill,j=e.variant,S=void 0===j?"primary":j,C=(0,o.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,l.jsx)(c.zx,(0,r.Z)((0,i.Z)({ref:n,sx:(0,i.Z)((0,r.Z)((0,i.Z)({},void 0===v?{}:v),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),p?{cursor:"wait !important"}:{}),type:d,form:f,disabled:void 0!==h&&h||p,onClick:p?void 0:x,variant:S},C),{children:p?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.$j,{size:b,color:u(S),"data-testid":a(C["data-testid"],"spinner")}),s&&t]}):(0,l.jsxs)(l.Fragment,{children:[s&&(0,l.jsx)(s,{size:b,fill:g,"data-testid":a(C["data-testid"],"icon")}),t]})}))})},13330:function(e,n,t){"use strict";t.d(n,{c:function(){return S}});var i=t(22710),r=t(62230),o=t(85244),l=t(99267),s=t(52322),c=t(2784),a=t(36131),u=t(75289),d=t(12189),f=t(88932),m=t(74029),p=t(55197),h=t(7604);function x(){return(x=(0,i.Z)(function(e){var n,t,i,r,o,s,c;return(0,l.__generator)(this,function(l){switch(l.label){case 0:n=e.sliceName,t=e.libraryName,i=e.onSuccess,l.label=1;case 1:return l.trys.push([1,4,,5]),r=(0,m.fo)(n),[4,h.j.slices.createSlice({libraryID:t,model:r})];case 2:if((o=l.sent().errors).length>0)throw o;return d.Xe.track({event:"slice:created",id:(0,p.MP)(n),name:n,library:t}),[4,i(r)];case 3:return l.sent(),[3,5];case 4:return s=l.sent(),c="An unexpected error happened while creating slice ".concat(n,"."),console.error(c,s),f.Am.error(c),[3,5];case 5:return[2]}})})).apply(this,arguments)}var v=t(35393),y=t(4995),b=t(7342),g=t(44570),j=t(41434),S=function(e){var n,t=e.onClose,f=e.onSuccess,m=e.localLibraries,p=e.remoteSlices,h=(0,b.Z)().createSliceSuccess,S=(0,c.useState)(!1),C=S[0],w=S[1],k=(0,v.g)().syncChanges,I=(n=(0,i.Z)(function(e){var n,t;return(0,l.__generator)(this,function(r){switch(r.label){case 0:var o;return n=e.sliceName,t=e.from,w(!0),[4,function(e){return x.apply(this,arguments)}({sliceName:n,libraryName:t,onSuccess:(o=(0,i.Z)(function(e){var n;return(0,l.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,d.y0)()];case 1:return h(n.sent().libraries),f(e,t),k(),[2]}})}),function(e){return o.apply(this,arguments)})})];case 1:return r.sent(),[2]}})}),function(e){return n.apply(this,arguments)});return(0,s.jsx)(y.Z,{testId:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:C,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:function(e){I(e)},initialValues:{sliceName:"",from:m[0].name},validate:function(e){return(0,j.h)(e,m,p)},content:{title:"Create a new slice"},children:function(e){var n=e.touched,t=e.values,i=e.setFieldValue,l=e.errors;return(0,s.jsxs)(u.xu,{children:[(0,s.jsx)(g.W,{name:"sliceName",label:"Slice Name",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?l.sliceName:void 0,testId:"slice-name-input"}),(0,s.jsx)(u.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,s.jsx)(a.ZP,{name:"from",options:m.map(function(e){return{value:e.name,label:e.name}}),onChange:function(e){return e?void i("from",e.value):null},defaultValue:{value:t.from,label:t.from},styles:{option:function(e){return(0,o.Z)((0,r.Z)({},e),{color:"#161618"})}},theme:function(e){return(0,o.Z)((0,r.Z)({},e),{colors:(0,o.Z)((0,r.Z)({},e.colors),{primary:"#E9E8EA"})})},menuPortalTarget:document.body})]})}})}},44570:function(e,n,t){"use strict";t.d(n,{W:function(){return s}});var i=t(62230),r=t(52322),o=t(63397);t(2784);var l=t(75289),s=function(e){var n=e.name,t=e.label,s=e.placeholder,c=e.error,a=e.testId,u=e.onChange;return(0,r.jsxs)(l.xu,{mb:3,children:[(0,r.jsx)(l.__,{htmlFor:n,mb:2,children:t}),(0,r.jsx)(o.gN,(0,i.Z)({name:n,type:"text",placeholder:s,as:l.II,autoComplete:"off"},u?{onChange:u}:null,a?{"data-testid":a}:null)),c?(0,r.jsx)(l.xv,{"data-testid":a?"".concat(a,"-error"):"input-error",sx:{color:"error",mt:1},children:c}):null]})}},41434:function(e,n,t){"use strict";t.d(n,{h:function(){return a}});var i=t(81541),r=t(96009),o=t.n(r),l=t(74600),s=t.n(l),c=t(25978);function a(e,n,t){var r=e.sliceName;if(!r)return{sliceName:"Cannot be empty"};if(!c.xo.exec(r))return{sliceName:"No special characters allowed"};if(s()(o()(r)).replace(/\s/gm,"")!==r.trim())return{sliceName:"Value has to be PascalCased"};if(r.match(/^\d/))return{sliceName:"Value cannot start with a number"};if(c.lS.includes(r))return{sliceName:"".concat(r," is reserved for Slice Machine use")};var l=n.flatMap(function(e){return e.components.map(function(e){return e.model.name})}),a=t.map(function(e){return e.name});if((0,i.Z)(l).concat((0,i.Z)(a)).includes(r))return{sliceName:"Slice name is already taken."}}},26574:function(e,n,t){"use strict";var i=t(62230),r=t(52322),o=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,l=e.defineElementKey,s=e.gridTemplateMinPx,c=e.gridGap,a=e.sx;return(0,r.jsx)(o.xu,{as:"section",sx:(0,i.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===s?"320px":s,", 1fr))"),gridGap:void 0===c?"16px":c,pt:2},a),children:n.map(function(e,n){return e?(0,r.jsx)("span",{children:t(e,n)},"".concat(l(e),"-").concat(n+1)):null})})}},4995:function(e,n,t){"use strict";var i=t(62230),r=t(85244),o=t(52322),l=t(63397),s=t(37149),c=t.n(s),a=t(75289),u=t(61107),d=t(28199),f=t(2978);n.Z=function(e){var n=e.children,t=e.close,s=e.isOpen,m=e.formId,p=e.validate,h=e.onSubmit,x=e.widthInPx,v=e.initialValues,y=e.content.title,b=e.cardProps,g=e.omitFooter,j=void 0!==g&&g,S=e.isLoading,C=void 0!==S&&S,w=e.buttonLabel,k=void 0===w?"Save":w,I=e.testId,N=e.actionMessage;return c().setAppElement("#__next"),(0,o.jsx)(d.Z,{isOpen:s,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:y,style:{content:{width:null!=x?x:"900px"}},children:(0,o.jsx)(l.J9,{initialValues:v,validate:function(e){return p?p(e):void 0},onSubmit:function(e){h(e)},children:function(e){var s=e.isValid,c=e.isSubmitting,d=e.values,p=e.errors,h=e.touched,x=e.setFieldValue,v=e.setValues;return(0,o.jsx)(l.l0,(0,r.Z)((0,i.Z)({id:m},null!=I?{"data-testid":I}:null),{children:(0,o.jsx)(f.Z,(0,r.Z)((0,i.Z)({borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"}},b),{Header:function(e){var n=e.radius;return(0,o.jsxs)(a.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,o.jsx)(a.X6,{sx:{fontSize:"20px"},children:y}),(0,o.jsx)(a.x8,{type:"button",onClick:t})]})},Footer:j?null:(0,o.jsxs)(a.kC,{sx:{alignItems:"space-between"},children:[(0,o.jsx)(a.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof N?N(e):N}),(0,o.jsxs)(a.kC,{sx:{ml:"auto"},children:[(0,o.jsx)(a.zx,{mr:2,type:"button",onClick:t,variant:"secondary",disabled:c||C,children:"Cancel"}),(0,o.jsx)(u.z,{label:k,form:m,type:"submit",disabled:!s||c||C,isLoading:c||C,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:n({isValid:s,isSubmitting:c,values:d,errors:p,touched:h,setFieldValue:x,setValues:v})}))}))}})})}},90217:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Q}});var i=t(81541),r=t(52322),o=t(37577),l=t(97729),s=t.n(l),c=t(5632),a=t(2784),u=t(56580),d=t(88932),f=t(65077),m=t(75289),p=t(42770),h=t(88201),x=t(72484),v=t(63815),y=t(59078),b=t(22710),g=t(99267),j=t(65186),S=t(59326),C=t(7604);function w(){return(w=(0,b.Z)(function(e){var n,t,i,r,o,l,s;return(0,g.__generator)(this,function(c){switch(c.label){case 0:n=e.sliceName,t=e.sliceID,i=e.libraryID,r=e.onSuccess,c.label=1;case 1:return c.trys.push([1,3,,4]),[4,C.j.slices.deleteSlice({libraryID:i,sliceID:t})];case 2:if((o=c.sent().errors).length>0)throw o;return r(),d.Am.success("Successfully deleted slice “".concat(n,"”")),[3,4];case 3:return l=c.sent(),s="An unexpected error happened while deleting slice “".concat(n,"”."),console.error(s,l),d.Am.error(s),[3,4];case 4:return[2]}})})).apply(this,arguments)}var k=t(35393),I=t(61107),N=t(2978),Z=t(28199),L=t(7342),E=function(e){var n,t=e.sliceId,i=e.sliceName,o=e.libName,l=e.isOpen,s=e.onClose,c=(0,a.useState)(!1),u=c[0],d=c[1],f=(0,L.Z)().deleteSliceSuccess,p=(0,k.g)().syncChanges,h=(0,S.B7)().theme,x=(n=(0,b.Z)(function(){return(0,g.__generator)(this,function(e){switch(e.label){case 0:return d(!0),[4,function(e){return w.apply(this,arguments)}({sliceID:t,sliceName:i,libraryID:o,onSuccess:function(){f(t,o),p()}})];case 1:return e.sent(),s(),d(!1),[2]}})}),function(){return n.apply(this,arguments)});return(0,r.jsx)(Z.Z,{isOpen:l,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:s,children:(0,r.jsx)(N.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},borderFooter:!0,Header:function(){var e;return(0,r.jsxs)(m.kC,{sx:{position:"sticky",background:"gray",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,r.jsxs)(m.kC,{sx:{alignItems:"center"},children:[(0,r.jsx)(j.$vK,{size:20,color:null===(e=h.colors)||void 0===e?void 0:e.greyIcon}),(0,r.jsx)(m.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,r.jsx)(m.x8,{type:"button",onClick:s})]})},Footer:function(){return(0,r.jsxs)(m.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,r.jsx)(I.z,{label:"Cancel",variant:"secondary",onClick:s,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,r.jsx)(I.z,{label:"Delete",variant:"danger",isLoading:u,sx:{minHeight:39,minWidth:78},onClick:function(){x()}})]})},children:(0,r.jsxs)(m.nv,{children:["This action will immediately make the following changes:",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["Delete the"," ",(0,r.jsxs)(m.xv,{sx:{fontWeight:"bold"},children:[o,"/",i,"/"]})," ","directory."]}),(0,r.jsx)("li",{children:"Remove the Slice from all Slice Zones that use it."})]}),"The next time you push your changes to Prismic, the following change will happen:",(0,r.jsx)("ul",{children:(0,r.jsx)("li",{children:"Remove the Slice from the list of available Slices to use in the Page Builder."})}),"You will need to manually remove the Slice from any Pages that currently use it."]})})})},_=t(62230),P=t(85244),A=t(98240),O=t(36887),R=t(12189),z=function(e){var n=e.title,t=e.onCreateNew,i=e.buttonText,o=e.documentationComponent,l=e.videoPublicIdUrl,s=(0,A.Z)(e,["title","onCreateNew","buttonText","documentationComponent","videoPublicIdUrl"]);return(0,r.jsxs)(m.xu,(0,P.Z)((0,_.Z)({sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"}},s),{children:[(0,r.jsx)(m.xu,{sx:function(e){var n;return{display:"flex",flex:1,alignItems:"center",minWidth:"400px",maxWidth:"70%",border:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02)}},children:(0,r.jsx)(O.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:l,onPlay:function(){R.Xe.track({event:"open-video-tutorials",video:l})}})}),(0,r.jsxs)(m.xu,{sx:function(e){var n;return{bg:"white",display:"flex",flexDirection:"column",border:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02),flex:1,minWidth:"400px",maxWidth:"70%"}},children:[(0,r.jsxs)(m.xu,{sx:function(e){var n;return{display:"flex",flexDirection:"column",p:4,borderBottom:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02)}},children:[(0,r.jsx)(m.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:n}),(0,r.jsx)(m.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:o})]}),(0,r.jsxs)(m.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,r.jsx)(m.zx,{onClick:t,"data-testid":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:i}),(0,r.jsx)(m.xv,{sx:{fontSize:"12px",color:"grey04",maxWidth:"280px"},children:"It will be stored locally and you will be able to push it to your repository"})]})]})]}))},F=t(13330),D=t(74029),W=t(37806);function T(){return(T=(0,b.Z)(function(e){var n,t,i,r,o,l,s;return(0,g.__generator)(this,function(c){switch(c.label){case 0:n=e.slice,t=e.newSliceName,i=e.onSuccess,c.label=1;case 1:return c.trys.push([1,3,,4]),r=(0,D.PQ)(n,t),[4,C.j.slices.renameSlice({libraryID:n.from,model:W.id.fromSM(r.model)})];case 2:if((o=c.sent().errors).length>0)throw o;return i(r),d.Am.success("Slice name updated"),[3,4];case 3:return l=c.sent(),s="An unexpected error happened while renaming “".concat(n.model.name,"”."),console.error(s,l),d.Am.error(s),[3,4];case 4:return[2]}})})).apply(this,arguments)}var V=t(15933),K=t(4995),B=t(44570),M=t(41434),H=function(e){var n,t,i,o=e.slice,l=e.isOpen,s=e.onClose,c=(0,L.Z)().renameSliceSuccess,a=(0,k.g)().syncChanges,d=(0,u.v9)(function(e){return{localLibs:(0,V.Sd)(e),remoteLibs:(0,V.sT)(e)}}),f=d.localLibs,p=d.remoteLibs,h=null!==(n=null==o?void 0:o.model.name)&&void 0!==n?n:"",x=(i=(0,b.Z)(function(e){return(0,g.__generator)(this,function(n){switch(n.label){case 0:if(!o)return[3,2];return[4,function(e){return T.apply(this,arguments)}({slice:o,newSliceName:e.sliceName,onSuccess:function(e){c(e.from,e.model),a()}})];case 1:n.sent(),s(),n.label=2;case 2:return[2]}})}),function(e){return i.apply(this,arguments)});return(0,r.jsx)(K.Z,{testId:"rename-slice-modal",isOpen:l,widthInPx:"530px",formId:"rename-slice-modal-".concat(null!==(t=null==o?void 0:o.model.id)&&void 0!==t?t:""),close:s,buttonLabel:"Rename",onSubmit:function(e){x(e)},initialValues:{sliceName:h},content:{title:"Rename a slice"},validate:function(e){return(0,M.h)(e,f,p)},children:function(e){var n=e.touched,t=e.errors;return(0,r.jsx)(m.xu,{children:(0,r.jsx)(B.W,{name:"sliceName",label:"Slice Name","data-testid":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?t.sliceName:void 0,testId:"slice-name-input"})})}})},X=t(26574),U=t(97461),q=t(84562),G=t(25978),Q=function(){var e,n,t,l=(0,c.useRouter)(),b=(0,v.H)(),g=b.modalPayload,j=b.onOpenModal,S=g.sliceFilterFn,C=g.defaultVariationSelector,w=(0,u.v9)(function(e){return{remoteSlices:(0,V.sT)(e),libraries:(0,V.Sd)(e)}}),k=w.remoteSlices,I=w.libraries,N=(0,a.useState)(!1),Z=N[0],L=N[1],_=(0,a.useState)(!1),P=_[0],A=_[1],O=(0,a.useState)(!1),R=O[0],D=O[1],W=I.filter(function(e){return e.isLocal}),T=I.map(function(e){return e.components=(0,i.Z)(e.components).sort(function(e,n){return e.model.name.localeCompare(n.model.name)}),e}),K=(I||[]).map(function(e){return e.components}).flat(),B=K.length,M=(0,a.useState)(),Q=M[0],Y=M[1],$=function(){A(!0)},J=function(){D(!0)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s(),{children:(0,r.jsx)("title",{children:"Slices - Slice Machine"})}),(0,r.jsxs)(y.LN,{children:[(0,r.jsxs)(y.wd,{children:[(0,r.jsx)(y.Cx,{children:(0,r.jsx)(p.g,{children:"Slices"})}),(null==W?void 0:W.length)!==0&&0!==B?(0,r.jsx)(y.K2,{children:(0,r.jsx)(o.zx,{"data-testid":"create-slice",onClick:function(){L(!0)},startIcon:"add",children:"Create"})}):void 0]}),(0,r.jsxs)(y.RN,{children:[(0,r.jsx)(f.xR,{sx:{display:"flex",flexDirection:"column"},children:T.length>0?(0,r.jsx)(m.kC,{sx:{flex:1,flexDirection:"column"},children:0===B?(0,r.jsx)(m.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,r.jsx)(z,{title:"What are Slices?",onCreateNew:function(){L(!0)},buttonText:"Create one",videoPublicIdUrl:G.rd,documentationComponent:(0,r.jsxs)(r.Fragment,{children:['Slices are sections of your website. Prismic documents contain a dynamic "Slice Zone" that allows content creators to add, edit, and rearrange Slices to compose dynamic layouts for any page design.'," ",(0,r.jsx)(m.rU,{target:"_blank",href:"https://prismic.io/docs/core-concepts/slices",sx:function(e){var n;return{color:null==e?void 0:null===(n=e.colors)||void 0===n?void 0:n.primary}},children:"Learn more"}),"."]}),"data-testid":"slices-table-blank-slate"})}):T.map(function(e){var n=e.name,t=e.isLocal,i=e.components;return(0,r.jsxs)(m.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,r.jsxs)(m.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsx)(m.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,r.jsx)(m.xv,{children:n})}),!t&&(0,r.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,r.jsx)(X.Z,{elems:i,defineElementKey:function(e){return e.model.name},renderElem:function(e){return(0,r.jsx)(h.b,{action:{type:"menu",onRemove:function(){Y(e),$()},onRename:function(){Y(e),J()}},mode:"navigation",onUpdateScreenshot:function(){j({sliceFilterFn:function(n){return n.filter(function(n){return n.model.id===e.model.id})}})},slice:e,variant:"solid"})},gridGap:"32px 16px"})]},n)})}):void 0}),(null==W?void 0:W.length)>0&&(0,r.jsx)(U.Z,{slices:S(K),defaultVariationSelector:C}),(null==W?void 0:W.length)>0&&Z&&(0,r.jsx)(F.c,{localLibraries:W,remoteSlices:k,onSuccess:function(e,n){var t=e.variations[0].id,i=x.Y.getBuilderPagePathname({libraryName:n,sliceName:e.name,variationId:t});l.push(i),d.Am.success((0,q.kQ)({path:"".concat(n,"/").concat(e.name,"/model.json")}))},onClose:function(){L(!1)}}),(0,r.jsx)(H,{isOpen:R,slice:Q,onClose:function(){D(!1)},"data-testid":"rename-slice-modal"}),(0,r.jsx)(E,{isOpen:P,libName:null!==(e=null==Q?void 0:Q.from)&&void 0!==e?e:"",sliceId:null!==(n=null==Q?void 0:Q.model.id)&&void 0!==n?n:"",sliceName:null!==(t=null==Q?void 0:Q.model.name)&&void 0!==t?t:"",onClose:function(){A(!1)}})]})]})]})}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return g}});var i=t(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}t(52322);var o=["shift","alt","meta","mod","ctrl"],l={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function s(e){return(l[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function c(e,n){return void 0===n&&(n=","),e.split(n)}function a(e,n,t){void 0===n&&(n="+");var i,l=e.toLocaleLowerCase().split(n).map(function(e){return s(e)});return r({},{alt:l.includes("alt"),ctrl:l.includes("ctrl")||l.includes("control"),shift:l.includes("shift"),meta:l.includes("meta"),mod:l.includes("mod")},{keys:l.filter(function(e){return!o.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([s(e.key),s(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&m([s(e.key),s(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){u.clear()});var u=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];u.has("meta")&&u.forEach(function(e){var n;return!o.includes(e)&&u.delete(e.toLowerCase())}),n.forEach(function(e){return u.add(e.toLowerCase())})}function m(e){var n=Array.isArray(e)?e:[e];"meta"===e?u.clear():n.forEach(function(e){return u.delete(e.toLowerCase())})}function p(e,n){var t=e.target;void 0===n&&(n=!1);var i=t&&t.tagName;return d(n)?Boolean(i&&n&&n.some(function(e){return e.toLowerCase()===i.toLowerCase()})):Boolean(i&&n&&!0===n)}var h=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,l=n.meta,c=n.mod,a=n.shift,f=n.ctrl,m=n.keys,p=e.key,h=e.code,x=e.ctrlKey,v=e.metaKey,y=e.shiftKey,b=e.altKey,g=s(h),j=p.toLowerCase();if(!t){if(!b===o&&"alt"!==j||!y===a&&"shift"!==j)return!1;if(c){if(!v&&!x)return!1}else if(!v===l&&"meta"!==j&&"os"!==j||!x===f&&"ctrl"!==j&&"control"!==j)return!1}return!!(m&&1===m.length&&(m.includes(j)||m.includes(g)))||(m?(void 0===r&&(r=","),(d(i=m)?i:i.split(r)).every(function(e){return u.has(e.trim().toLowerCase())})):!m)},x=(0,i.createContext)(void 0),v=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},b="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function g(e,n,t,r){var o,l,u=(0,i.useRef)(null),g=(0,i.useRef)(!1),j=t instanceof Array?r instanceof Array?void 0:r:t,S=d(e)?e.join(null==j?void 0:j.splitKey):e,C=t instanceof Array?t:r instanceof Array?r:void 0,w=(0,i.useCallback)(n,null!=C?C:[]),k=(0,i.useRef)(w);C?k.current=w:k.current=n;var I=(!function e(n,t){return n&&t&&"object"==typeof n&&"object"==typeof t?Object.keys(n).length===Object.keys(t).length&&Object.keys(n).reduce(function(i,r){return i&&e(n[r],t[r])},!0):n===t}((l=(0,i.useRef)(void 0)).current,j)&&(l.current=j),l.current),N=(0,i.useContext)(v).enabledScopes,Z=(0,i.useContext)(x);return b(function(){if((null==I?void 0:I.enabled)!==!1&&(e=N,n=null==I?void 0:I.scopes,0===e.length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!n||e.some(function(e){return n.includes(e)})||e.includes("*")))){var e,n,t=function(e,n){var t,i;if(void 0===n&&(n=!1),!(p(e,["input","textarea","select"])&&!p(e,null==I?void 0:I.enableOnFormTags)||null!=I&&null!=I.ignoreEventWhen&&I.ignoreEventWhen(e))){if(null!==u.current&&document.activeElement!==u.current&&!u.current.contains(document.activeElement)){y(e);return}(null==(t=e.target)||!t.isContentEditable||null!=I&&I.enableOnContentEditable)&&c(S,null==I?void 0:I.splitKey).forEach(function(t){var i,r,o,l,s,c,u,d=a(t,null==I?void 0:I.combinationKey);if(h(e,d,null==I?void 0:I.ignoreModifiers)||null!=(u=d.keys)&&u.includes("*")){if(n&&g.current)return;if(i=e,r=d,("function"==typeof(o=null==I?void 0:I.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),l=e,s=d,"function"==typeof(c=null==I?void 0:I.enabled)?!c(l,s):!0!==c&&void 0!==c){y(e);return}k.current(e,d),n||(g.current=!0)}})}},i=function(e){void 0!==e.key&&(f(s(e.code)),((null==I?void 0:I.keydown)===void 0&&(null==I?void 0:I.keyup)!==!0||null!=I&&I.keydown)&&t(e))},r=function(e){void 0!==e.key&&(m(s(e.code)),g.current=!1,null!=I&&I.keyup&&t(e,!0))},o=u.current||(null==j?void 0:j.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),Z&&c(S,null==I?void 0:I.splitKey).forEach(function(e){return Z.addHotkey(a(e,null==I?void 0:I.combinationKey,null==I?void 0:I.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),Z&&c(S,null==I?void 0:I.splitKey).forEach(function(e){return Z.removeHotkey(a(e,null==I?void 0:I.combinationKey,null==I?void 0:I.description))})}}},[S,I,N]),u}}},function(e){e.O(0,[898,789,50,816,152,774,888,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{74600:function(e,n,t){var i=t(34311),r=t(23779),o=i(function(e,n,t){return e+(t?" ":"")+r(n)});e.exports=o},26688:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices",function(){return t(90217)}])},61107:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var i=t(62230),r=t(85244),o=t(98240),l=t(52322),s=t(2784),c=t(75289),a=function(e,n){return e?"".concat(e,"-").concat(n):""},u=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},d=(0,s.forwardRef)(function(e,n){var t=e.label,s=e.Icon,d=e.type,f=e.form,m=e.isLoading,p=void 0!==m&&m,h=e.disabled,x=e.onClick,v=e.sx,y=e.iconSize,b=void 0===y?16:y,g=e.iconFill,j=e.variant,S=void 0===j?"primary":j,C=(0,o.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,l.jsx)(c.zx,(0,r.Z)((0,i.Z)({ref:n,sx:(0,i.Z)((0,r.Z)((0,i.Z)({},void 0===v?{}:v),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),p?{cursor:"wait !important"}:{}),type:d,form:f,disabled:void 0!==h&&h||p,onClick:p?void 0:x,variant:S},C),{children:p?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.$j,{size:b,color:u(S),"data-testid":a(C["data-testid"],"spinner")}),s&&t]}):(0,l.jsxs)(l.Fragment,{children:[s&&(0,l.jsx)(s,{size:b,fill:g,"data-testid":a(C["data-testid"],"icon")}),t]})}))})},13330:function(e,n,t){"use strict";t.d(n,{c:function(){return S}});var i=t(22710),r=t(62230),o=t(85244),l=t(99267),s=t(52322),c=t(2784),a=t(36131),u=t(75289),d=t(12189),f=t(88932),m=t(74029),p=t(55197),h=t(7604);function x(){return(x=(0,i.Z)(function(e){var n,t,i,r,o,s,c;return(0,l.__generator)(this,function(l){switch(l.label){case 0:n=e.sliceName,t=e.libraryName,i=e.onSuccess,l.label=1;case 1:return l.trys.push([1,4,,5]),r=(0,m.fo)(n),[4,h.j.slices.createSlice({libraryID:t,model:r})];case 2:if((o=l.sent().errors).length>0)throw o;return d.Xe.track({event:"slice:created",id:(0,p.MP)(n),name:n,library:t}),[4,i(r)];case 3:return l.sent(),[3,5];case 4:return s=l.sent(),c="An unexpected error happened while creating slice ".concat(n,"."),console.error(c,s),f.Am.error(c),[3,5];case 5:return[2]}})})).apply(this,arguments)}var v=t(35393),y=t(4995),b=t(7342),g=t(44570),j=t(41434),S=function(e){var n,t=e.onClose,f=e.onSuccess,m=e.localLibraries,p=e.remoteSlices,h=(0,b.Z)().createSliceSuccess,S=(0,c.useState)(!1),C=S[0],w=S[1],k=(0,v.g)().syncChanges,I=(n=(0,i.Z)(function(e){var n,t;return(0,l.__generator)(this,function(r){switch(r.label){case 0:var o;return n=e.sliceName,t=e.from,w(!0),[4,function(e){return x.apply(this,arguments)}({sliceName:n,libraryName:t,onSuccess:(o=(0,i.Z)(function(e){var n;return(0,l.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,d.y0)()];case 1:return h(n.sent().libraries),f(e,t),k(),[2]}})}),function(e){return o.apply(this,arguments)})})];case 1:return r.sent(),[2]}})}),function(e){return n.apply(this,arguments)});return(0,s.jsx)(y.Z,{testId:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:C,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:function(e){I(e)},initialValues:{sliceName:"",from:m[0].name},validate:function(e){return(0,j.h)(e,m,p)},content:{title:"Create a new slice"},children:function(e){var n=e.touched,t=e.values,i=e.setFieldValue,l=e.errors;return(0,s.jsxs)(u.xu,{children:[(0,s.jsx)(g.W,{name:"sliceName",label:"Slice Name",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?l.sliceName:void 0,testId:"slice-name-input"}),(0,s.jsx)(u.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,s.jsx)(a.ZP,{name:"from",options:m.map(function(e){return{value:e.name,label:e.name}}),onChange:function(e){return e?void i("from",e.value):null},defaultValue:{value:t.from,label:t.from},styles:{option:function(e){return(0,o.Z)((0,r.Z)({},e),{color:"#161618"})}},theme:function(e){return(0,o.Z)((0,r.Z)({},e),{colors:(0,o.Z)((0,r.Z)({},e.colors),{primary:"#E9E8EA"})})},menuPortalTarget:document.body})]})}})}},44570:function(e,n,t){"use strict";t.d(n,{W:function(){return s}});var i=t(62230),r=t(52322),o=t(63397);t(2784);var l=t(75289),s=function(e){var n=e.name,t=e.label,s=e.placeholder,c=e.error,a=e.testId,u=e.onChange;return(0,r.jsxs)(l.xu,{mb:3,children:[(0,r.jsx)(l.__,{htmlFor:n,mb:2,children:t}),(0,r.jsx)(o.gN,(0,i.Z)({name:n,type:"text",placeholder:s,as:l.II,autoComplete:"off"},u?{onChange:u}:null,a?{"data-testid":a}:null)),c?(0,r.jsx)(l.xv,{"data-testid":a?"".concat(a,"-error"):"input-error",sx:{color:"error",mt:1},children:c}):null]})}},41434:function(e,n,t){"use strict";t.d(n,{h:function(){return a}});var i=t(81541),r=t(96009),o=t.n(r),l=t(74600),s=t.n(l),c=t(25978);function a(e,n,t){var r=e.sliceName;if(!r)return{sliceName:"Cannot be empty"};if(!c.xo.exec(r))return{sliceName:"No special characters allowed"};if(s()(o()(r)).replace(/\s/gm,"")!==r.trim())return{sliceName:"Value has to be PascalCased"};if(r.match(/^\d/))return{sliceName:"Value cannot start with a number"};if(c.lS.includes(r))return{sliceName:"".concat(r," is reserved for Slice Machine use")};var l=n.flatMap(function(e){return e.components.map(function(e){return e.model.name})}),a=t.map(function(e){return e.name});if((0,i.Z)(l).concat((0,i.Z)(a)).includes(r))return{sliceName:"Slice name is already taken."}}},26574:function(e,n,t){"use strict";var i=t(62230),r=t(52322),o=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,l=e.defineElementKey,s=e.gridTemplateMinPx,c=e.gridGap,a=e.sx;return(0,r.jsx)(o.xu,{as:"section",sx:(0,i.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===s?"320px":s,", 1fr))"),gridGap:void 0===c?"16px":c,pt:2},a),children:n.map(function(e,n){return e?(0,r.jsx)("span",{children:t(e,n)},"".concat(l(e),"-").concat(n+1)):null})})}},4995:function(e,n,t){"use strict";var i=t(62230),r=t(85244),o=t(52322),l=t(63397),s=t(37149),c=t.n(s),a=t(75289),u=t(61107),d=t(28199),f=t(2978);n.Z=function(e){var n=e.children,t=e.close,s=e.isOpen,m=e.formId,p=e.validate,h=e.onSubmit,x=e.widthInPx,v=e.initialValues,y=e.content.title,b=e.cardProps,g=e.omitFooter,j=void 0!==g&&g,S=e.isLoading,C=void 0!==S&&S,w=e.buttonLabel,k=void 0===w?"Save":w,I=e.testId,N=e.actionMessage;return c().setAppElement("#__next"),(0,o.jsx)(d.Z,{isOpen:s,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:y,style:{content:{width:null!=x?x:"900px"}},children:(0,o.jsx)(l.J9,{initialValues:v,validate:function(e){return p?p(e):void 0},onSubmit:function(e){h(e)},children:function(e){var s=e.isValid,c=e.isSubmitting,d=e.values,p=e.errors,h=e.touched,x=e.setFieldValue,v=e.setValues;return(0,o.jsx)(l.l0,(0,r.Z)((0,i.Z)({id:m},null!=I?{"data-testid":I}:null),{children:(0,o.jsx)(f.Z,(0,r.Z)((0,i.Z)({borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"}},b),{Header:function(e){var n=e.radius;return(0,o.jsxs)(a.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,o.jsx)(a.X6,{sx:{fontSize:"20px"},children:y}),(0,o.jsx)(a.x8,{type:"button",onClick:t})]})},Footer:j?null:(0,o.jsxs)(a.kC,{sx:{alignItems:"space-between"},children:[(0,o.jsx)(a.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof N?N(e):N}),(0,o.jsxs)(a.kC,{sx:{ml:"auto"},children:[(0,o.jsx)(a.zx,{mr:2,type:"button",onClick:t,variant:"secondary",disabled:c||C,children:"Cancel"}),(0,o.jsx)(u.z,{label:k,form:m,type:"submit",disabled:!s||c||C,isLoading:c||C,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:n({isValid:s,isSubmitting:c,values:d,errors:p,touched:h,setFieldValue:x,setValues:v})}))}))}})})}},90217:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Q}});var i=t(81541),r=t(52322),o=t(37577),l=t(97729),s=t.n(l),c=t(5632),a=t(2784),u=t(56580),d=t(88932),f=t(65077),m=t(75289),p=t(42770),h=t(88201),x=t(72484),v=t(63815),y=t(83981),b=t(22710),g=t(99267),j=t(65186),S=t(59326),C=t(7604);function w(){return(w=(0,b.Z)(function(e){var n,t,i,r,o,l,s;return(0,g.__generator)(this,function(c){switch(c.label){case 0:n=e.sliceName,t=e.sliceID,i=e.libraryID,r=e.onSuccess,c.label=1;case 1:return c.trys.push([1,3,,4]),[4,C.j.slices.deleteSlice({libraryID:i,sliceID:t})];case 2:if((o=c.sent().errors).length>0)throw o;return r(),d.Am.success("Successfully deleted slice “".concat(n,"”")),[3,4];case 3:return l=c.sent(),s="An unexpected error happened while deleting slice “".concat(n,"”."),console.error(s,l),d.Am.error(s),[3,4];case 4:return[2]}})})).apply(this,arguments)}var k=t(35393),I=t(61107),N=t(2978),Z=t(28199),L=t(7342),E=function(e){var n,t=e.sliceId,i=e.sliceName,o=e.libName,l=e.isOpen,s=e.onClose,c=(0,a.useState)(!1),u=c[0],d=c[1],f=(0,L.Z)().deleteSliceSuccess,p=(0,k.g)().syncChanges,h=(0,S.B7)().theme,x=(n=(0,b.Z)(function(){return(0,g.__generator)(this,function(e){switch(e.label){case 0:return d(!0),[4,function(e){return w.apply(this,arguments)}({sliceID:t,sliceName:i,libraryID:o,onSuccess:function(){f(t,o),p()}})];case 1:return e.sent(),s(),d(!1),[2]}})}),function(){return n.apply(this,arguments)});return(0,r.jsx)(Z.Z,{isOpen:l,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:s,children:(0,r.jsx)(N.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},borderFooter:!0,Header:function(){var e;return(0,r.jsxs)(m.kC,{sx:{position:"sticky",background:"gray",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,r.jsxs)(m.kC,{sx:{alignItems:"center"},children:[(0,r.jsx)(j.$vK,{size:20,color:null===(e=h.colors)||void 0===e?void 0:e.greyIcon}),(0,r.jsx)(m.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,r.jsx)(m.x8,{type:"button",onClick:s})]})},Footer:function(){return(0,r.jsxs)(m.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,r.jsx)(I.z,{label:"Cancel",variant:"secondary",onClick:s,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,r.jsx)(I.z,{label:"Delete",variant:"danger",isLoading:u,sx:{minHeight:39,minWidth:78},onClick:function(){x()}})]})},children:(0,r.jsxs)(m.nv,{children:["This action will immediately make the following changes:",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["Delete the"," ",(0,r.jsxs)(m.xv,{sx:{fontWeight:"bold"},children:[o,"/",i,"/"]})," ","directory."]}),(0,r.jsx)("li",{children:"Remove the Slice from all Slice Zones that use it."})]}),"The next time you push your changes to Prismic, the following change will happen:",(0,r.jsx)("ul",{children:(0,r.jsx)("li",{children:"Remove the Slice from the list of available Slices to use in the Page Builder."})}),"You will need to manually remove the Slice from any Pages that currently use it."]})})})},_=t(62230),P=t(85244),A=t(98240),O=t(36887),R=t(12189),z=function(e){var n=e.title,t=e.onCreateNew,i=e.buttonText,o=e.documentationComponent,l=e.videoPublicIdUrl,s=(0,A.Z)(e,["title","onCreateNew","buttonText","documentationComponent","videoPublicIdUrl"]);return(0,r.jsxs)(m.xu,(0,P.Z)((0,_.Z)({sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"}},s),{children:[(0,r.jsx)(m.xu,{sx:function(e){var n;return{display:"flex",flex:1,alignItems:"center",minWidth:"400px",maxWidth:"70%",border:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02)}},children:(0,r.jsx)(O.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:l,onPlay:function(){R.Xe.track({event:"open-video-tutorials",video:l})}})}),(0,r.jsxs)(m.xu,{sx:function(e){var n;return{bg:"white",display:"flex",flexDirection:"column",border:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02),flex:1,minWidth:"400px",maxWidth:"70%"}},children:[(0,r.jsxs)(m.xu,{sx:function(e){var n;return{display:"flex",flexDirection:"column",p:4,borderBottom:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02)}},children:[(0,r.jsx)(m.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:n}),(0,r.jsx)(m.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:o})]}),(0,r.jsxs)(m.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,r.jsx)(m.zx,{onClick:t,"data-testid":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:i}),(0,r.jsx)(m.xv,{sx:{fontSize:"12px",color:"grey04",maxWidth:"280px"},children:"It will be stored locally and you will be able to push it to your repository"})]})]})]}))},F=t(13330),D=t(74029),W=t(37806);function T(){return(T=(0,b.Z)(function(e){var n,t,i,r,o,l,s;return(0,g.__generator)(this,function(c){switch(c.label){case 0:n=e.slice,t=e.newSliceName,i=e.onSuccess,c.label=1;case 1:return c.trys.push([1,3,,4]),r=(0,D.PQ)(n,t),[4,C.j.slices.renameSlice({libraryID:n.from,model:W.id.fromSM(r.model)})];case 2:if((o=c.sent().errors).length>0)throw o;return i(r),d.Am.success("Slice name updated"),[3,4];case 3:return l=c.sent(),s="An unexpected error happened while renaming “".concat(n.model.name,"”."),console.error(s,l),d.Am.error(s),[3,4];case 4:return[2]}})})).apply(this,arguments)}var V=t(15933),K=t(4995),B=t(44570),M=t(41434),H=function(e){var n,t,i,o=e.slice,l=e.isOpen,s=e.onClose,c=(0,L.Z)().renameSliceSuccess,a=(0,k.g)().syncChanges,d=(0,u.v9)(function(e){return{localLibs:(0,V.Sd)(e),remoteLibs:(0,V.sT)(e)}}),f=d.localLibs,p=d.remoteLibs,h=null!==(n=null==o?void 0:o.model.name)&&void 0!==n?n:"",x=(i=(0,b.Z)(function(e){return(0,g.__generator)(this,function(n){switch(n.label){case 0:if(!o)return[3,2];return[4,function(e){return T.apply(this,arguments)}({slice:o,newSliceName:e.sliceName,onSuccess:function(e){c(e.from,e.model),a()}})];case 1:n.sent(),s(),n.label=2;case 2:return[2]}})}),function(e){return i.apply(this,arguments)});return(0,r.jsx)(K.Z,{testId:"rename-slice-modal",isOpen:l,widthInPx:"530px",formId:"rename-slice-modal-".concat(null!==(t=null==o?void 0:o.model.id)&&void 0!==t?t:""),close:s,buttonLabel:"Rename",onSubmit:function(e){x(e)},initialValues:{sliceName:h},content:{title:"Rename a slice"},validate:function(e){return(0,M.h)(e,f,p)},children:function(e){var n=e.touched,t=e.errors;return(0,r.jsx)(m.xu,{children:(0,r.jsx)(B.W,{name:"sliceName",label:"Slice Name","data-testid":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?t.sliceName:void 0,testId:"slice-name-input"})})}})},X=t(26574),U=t(97461),q=t(84562),G=t(25978),Q=function(){var e,n,t,l=(0,c.useRouter)(),b=(0,v.H)(),g=b.modalPayload,j=b.onOpenModal,S=g.sliceFilterFn,C=g.defaultVariationSelector,w=(0,u.v9)(function(e){return{remoteSlices:(0,V.sT)(e),libraries:(0,V.Sd)(e)}}),k=w.remoteSlices,I=w.libraries,N=(0,a.useState)(!1),Z=N[0],L=N[1],_=(0,a.useState)(!1),P=_[0],A=_[1],O=(0,a.useState)(!1),R=O[0],D=O[1],W=I.filter(function(e){return e.isLocal}),T=I.map(function(e){return e.components=(0,i.Z)(e.components).sort(function(e,n){return e.model.name.localeCompare(n.model.name)}),e}),K=(I||[]).map(function(e){return e.components}).flat(),B=K.length,M=(0,a.useState)(),Q=M[0],Y=M[1],$=function(){A(!0)},J=function(){D(!0)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s(),{children:(0,r.jsx)("title",{children:"Slices - Slice Machine"})}),(0,r.jsxs)(y.LN,{children:[(0,r.jsxs)(y.wd,{children:[(0,r.jsx)(y.Cx,{children:(0,r.jsx)(p.g,{children:"Slices"})}),(null==W?void 0:W.length)!==0&&0!==B?(0,r.jsx)(y.K2,{children:(0,r.jsx)(o.zx,{"data-testid":"create-slice",onClick:function(){L(!0)},startIcon:"add",children:"Create"})}):void 0]}),(0,r.jsxs)(y.RN,{children:[(0,r.jsx)(f.xR,{sx:{display:"flex",flexDirection:"column"},children:T.length>0?(0,r.jsx)(m.kC,{sx:{flex:1,flexDirection:"column"},children:0===B?(0,r.jsx)(m.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,r.jsx)(z,{title:"What are Slices?",onCreateNew:function(){L(!0)},buttonText:"Create one",videoPublicIdUrl:G.rd,documentationComponent:(0,r.jsxs)(r.Fragment,{children:['Slices are sections of your website. Prismic documents contain a dynamic "Slice Zone" that allows content creators to add, edit, and rearrange Slices to compose dynamic layouts for any page design.'," ",(0,r.jsx)(m.rU,{target:"_blank",href:"https://prismic.io/docs/core-concepts/slices",sx:function(e){var n;return{color:null==e?void 0:null===(n=e.colors)||void 0===n?void 0:n.primary}},children:"Learn more"}),"."]}),"data-testid":"slices-table-blank-slate"})}):T.map(function(e){var n=e.name,t=e.isLocal,i=e.components;return(0,r.jsxs)(m.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,r.jsxs)(m.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsx)(m.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,r.jsx)(m.xv,{children:n})}),!t&&(0,r.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,r.jsx)(X.Z,{elems:i,defineElementKey:function(e){return e.model.name},renderElem:function(e){return(0,r.jsx)(h.b,{action:{type:"menu",onRemove:function(){Y(e),$()},onRename:function(){Y(e),J()}},mode:"navigation",onUpdateScreenshot:function(){j({sliceFilterFn:function(n){return n.filter(function(n){return n.model.id===e.model.id})}})},slice:e,variant:"solid"})},gridGap:"32px 16px"})]},n)})}):void 0}),(null==W?void 0:W.length)>0&&(0,r.jsx)(U.Z,{slices:S(K),defaultVariationSelector:C}),(null==W?void 0:W.length)>0&&Z&&(0,r.jsx)(F.c,{localLibraries:W,remoteSlices:k,onSuccess:function(e,n){var t=e.variations[0].id,i=x.Y.getBuilderPagePathname({libraryName:n,sliceName:e.name,variationId:t});l.push(i),d.Am.success((0,q.kQ)({path:"".concat(n,"/").concat(e.name,"/model.json")}))},onClose:function(){L(!1)}}),(0,r.jsx)(H,{isOpen:R,slice:Q,onClose:function(){D(!1)},"data-testid":"rename-slice-modal"}),(0,r.jsx)(E,{isOpen:P,libName:null!==(e=null==Q?void 0:Q.from)&&void 0!==e?e:"",sliceId:null!==(n=null==Q?void 0:Q.model.id)&&void 0!==n?n:"",sliceName:null!==(t=null==Q?void 0:Q.model.name)&&void 0!==t?t:"",onClose:function(){A(!1)}})]})]})]})}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return g}});var i=t(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}t(52322);var o=["shift","alt","meta","mod","ctrl"],l={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function s(e){return(l[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function c(e,n){return void 0===n&&(n=","),e.split(n)}function a(e,n,t){void 0===n&&(n="+");var i,l=e.toLocaleLowerCase().split(n).map(function(e){return s(e)});return r({},{alt:l.includes("alt"),ctrl:l.includes("ctrl")||l.includes("control"),shift:l.includes("shift"),meta:l.includes("meta"),mod:l.includes("mod")},{keys:l.filter(function(e){return!o.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([s(e.key),s(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&m([s(e.key),s(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){u.clear()});var u=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];u.has("meta")&&u.forEach(function(e){var n;return!o.includes(e)&&u.delete(e.toLowerCase())}),n.forEach(function(e){return u.add(e.toLowerCase())})}function m(e){var n=Array.isArray(e)?e:[e];"meta"===e?u.clear():n.forEach(function(e){return u.delete(e.toLowerCase())})}function p(e,n){var t=e.target;void 0===n&&(n=!1);var i=t&&t.tagName;return d(n)?Boolean(i&&n&&n.some(function(e){return e.toLowerCase()===i.toLowerCase()})):Boolean(i&&n&&!0===n)}var h=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,l=n.meta,c=n.mod,a=n.shift,f=n.ctrl,m=n.keys,p=e.key,h=e.code,x=e.ctrlKey,v=e.metaKey,y=e.shiftKey,b=e.altKey,g=s(h),j=p.toLowerCase();if(!t){if(!b===o&&"alt"!==j||!y===a&&"shift"!==j)return!1;if(c){if(!v&&!x)return!1}else if(!v===l&&"meta"!==j&&"os"!==j||!x===f&&"ctrl"!==j&&"control"!==j)return!1}return!!(m&&1===m.length&&(m.includes(j)||m.includes(g)))||(m?(void 0===r&&(r=","),(d(i=m)?i:i.split(r)).every(function(e){return u.has(e.trim().toLowerCase())})):!m)},x=(0,i.createContext)(void 0),v=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},b="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function g(e,n,t,r){var o,l,u=(0,i.useRef)(null),g=(0,i.useRef)(!1),j=t instanceof Array?r instanceof Array?void 0:r:t,S=d(e)?e.join(null==j?void 0:j.splitKey):e,C=t instanceof Array?t:r instanceof Array?r:void 0,w=(0,i.useCallback)(n,null!=C?C:[]),k=(0,i.useRef)(w);C?k.current=w:k.current=n;var I=(!function e(n,t){return n&&t&&"object"==typeof n&&"object"==typeof t?Object.keys(n).length===Object.keys(t).length&&Object.keys(n).reduce(function(i,r){return i&&e(n[r],t[r])},!0):n===t}((l=(0,i.useRef)(void 0)).current,j)&&(l.current=j),l.current),N=(0,i.useContext)(v).enabledScopes,Z=(0,i.useContext)(x);return b(function(){if((null==I?void 0:I.enabled)!==!1&&(e=N,n=null==I?void 0:I.scopes,0===e.length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!n||e.some(function(e){return n.includes(e)})||e.includes("*")))){var e,n,t=function(e,n){var t,i;if(void 0===n&&(n=!1),!(p(e,["input","textarea","select"])&&!p(e,null==I?void 0:I.enableOnFormTags)||null!=I&&null!=I.ignoreEventWhen&&I.ignoreEventWhen(e))){if(null!==u.current&&document.activeElement!==u.current&&!u.current.contains(document.activeElement)){y(e);return}(null==(t=e.target)||!t.isContentEditable||null!=I&&I.enableOnContentEditable)&&c(S,null==I?void 0:I.splitKey).forEach(function(t){var i,r,o,l,s,c,u,d=a(t,null==I?void 0:I.combinationKey);if(h(e,d,null==I?void 0:I.ignoreModifiers)||null!=(u=d.keys)&&u.includes("*")){if(n&&g.current)return;if(i=e,r=d,("function"==typeof(o=null==I?void 0:I.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),l=e,s=d,"function"==typeof(c=null==I?void 0:I.enabled)?!c(l,s):!0!==c&&void 0!==c){y(e);return}k.current(e,d),n||(g.current=!0)}})}},i=function(e){void 0!==e.key&&(f(s(e.code)),((null==I?void 0:I.keydown)===void 0&&(null==I?void 0:I.keyup)!==!0||null!=I&&I.keydown)&&t(e))},r=function(e){void 0!==e.key&&(m(s(e.code)),g.current=!1,null!=I&&I.keyup&&t(e,!0))},o=u.current||(null==j?void 0:j.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),Z&&c(S,null==I?void 0:I.splitKey).forEach(function(e){return Z.addHotkey(a(e,null==I?void 0:I.combinationKey,null==I?void 0:I.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),Z&&c(S,null==I?void 0:I.splitKey).forEach(function(e){return Z.removeHotkey(a(e,null==I?void 0:I.combinationKey,null==I?void 0:I.description))})}}},[S,I,N]),u}}},function(e){e.O(0,[898,789,50,816,152,774,888,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);
|