slice-machine-ui 2.18.1-beta.5 → 2.18.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/Zy4opMpDS8I-mxQ1kA3m2/_buildManifest.js +1 -0
- package/out/_next/static/chunks/157-fa8b348c960c8283.js +3 -0
- package/out/_next/static/chunks/256-07f768a2b19b0a0e.js +4 -0
- package/out/_next/static/chunks/344-fdb3008f4bb3b0c1.js +1 -0
- package/out/_next/static/chunks/484-3e011e79c41f0342.js +1 -0
- package/out/_next/static/chunks/500-d3989390f5e8da53.js +1 -0
- package/out/_next/static/chunks/52d4c156-89c6ec6efca0a0bb.js +1 -0
- package/out/_next/static/chunks/pages/{_app-9b3d30fd1851ca31.js → _app-64feff311539f17b.js} +90 -90
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-816acb31b652239b.js → [customTypeId]-af9376721beb489e.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-669d5479e81b638b.js → [pageTypeId]-a24665e91b882169.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-da423aa0da7bc11e.js +1 -0
- package/out/_next/static/chunks/pages/slices-59b857edc9f72d5f.js +1 -0
- package/out/_next/static/css/{303dad78be1eb854.css → bc89f2cd4e4781f5.css} +1 -1
- package/out/_next/static/css/e8e03c0d4003d1eb.css +1 -0
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +3 -3
- package/src/features/navigation/RepositoryInfo.tsx +24 -18
- package/src/legacy/components/Navigation/ChangesItem.tsx +42 -94
- package/out/_next/static/chunks/157-54b8336d20b41933.js +0 -3
- package/out/_next/static/chunks/349-7118116b93278f73.js +0 -4
- package/out/_next/static/chunks/50-586dc7ab5e584e76.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-11802744e89707f7.js +0 -1
- package/out/_next/static/chunks/pages/slices-f6552e2fbc491c4d.js +0 -1
- package/out/_next/static/css/cdee5b195444f185.css +0 -1
- package/out/_next/static/tOZ9fTWuYABHIk1P8Sv1S/_buildManifest.js +0 -1
- /package/out/_next/static/{tOZ9fTWuYABHIk1P8Sv1S → Zy4opMpDS8I-mxQ1kA3m2}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[625],{95759:function(n,u,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/custom-types/[customTypeId]",function(){return t(60802)}])},60802:function(n,u,t){"use strict";t.r(u),t.d(u,{default:function(){return _.H}});var _=t(19489)}},function(n){n.O(0,[898,917,525,461,139,397,183,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[625],{95759:function(n,u,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/custom-types/[customTypeId]",function(){return t(60802)}])},60802:function(n,u,t){"use strict";t.r(u),t.d(u,{default:function(){return _.H}});var _=t(19489)}},function(n){n.O(0,[898,917,525,461,139,397,183,344,256,422,34,647,630,907,489,888,774,179],function(){return n(n.s=95759)}),_N_E=n.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[936],{61367:function(n,u,e){(window.__NEXT_P=window.__NEXT_P||[]).push(["/page-types/[pageTypeId]",function(){return e(89173)}])},89173:function(n,u,e){"use strict";e.r(u),e.d(u,{default:function(){return t.H}});var t=e(19489)}},function(n){n.O(0,[898,917,525,461,139,397,183,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[936],{61367:function(n,u,e){(window.__NEXT_P=window.__NEXT_P||[]).push(["/page-types/[pageTypeId]",function(){return e(89173)}])},89173:function(n,u,e){"use strict";e.r(u),e.d(u,{default:function(){return t.H}});var t=e(19489)}},function(n){n.O(0,[898,917,525,461,139,397,183,344,256,422,34,647,630,907,489,888,774,179],function(){return n(n.s=61367)}),_N_E=n.O()}]);
|
package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-da423aa0da7bc11e.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[136],{31314:function(e,t,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]",function(){return i(82080)}])},50477:function(e,t,i){"use strict";i.d(t,{NG:function(){return s},xU:function(){return a}});var r=i(18566),n=i(2784),o=i(80148);function a(e){let t=(0,n.useCallback)(t=>(0,r.VA)(l,[e],t),[e]);return{customTypes:(0,r.QT)(l,[e]),updateCustomTypes:t}}async function l(e){let{errors:t,models:i}=await o.managerClient.customTypes.readAllCustomTypes(e?{format:e}:void 0);if(t.length>0)throw t;return i.map(e=>{let{model:t}=e;return t})}function s(e){(0,r.gw)(l,[]),(0,r.gw)(l,[e])}},44309:function(e,t,i){"use strict";i.d(t,{Z:function(){return l}});var r=i(5632),n=i(56580),o=i(7723);let a=(e,t,i)=>{var r;let n=null===(r=(0,o.Sd)(e))||void 0===r?void 0:r.find(e=>e.name.replace(/\//g,"--")===t);return null==n?void 0:n.components.find(e=>e.model.name===i)};var l=()=>{let e=(0,r.useRouter)(),{slice:t}=(0,n.v9)(t=>({slice:a(t,e.query.lib,e.query.sliceName)}));if(!t)return{};let i=t.model.variations.find(t=>t.id===e.query.variation);return i?{slice:t,variation:i}:{}}},82080:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return eY}});var r=i(52322),n=i(97729),o=i.n(n),a=i(5632),l=i(74217),s=i(2784),d=i(94160),c=i(68968),u=i(23710),m=i(54597);let h=(0,s.createContext)(void 0);function p(e){let{children:t,initialSlice:i}=e,n=(0,a.useRouter)(),[o,p]=(0,s.useState)(i),{actionQueueStatus:v,setNextAction:x}=(0,u.c)({errorMessage:"Failed to save slice. Check your browser's console for more information."}),{saveSliceSuccess:f}=(0,m.Z)(),g=(0,l.R9)(f),{syncChanges:j}=(0,c.g)(),C=(0,s.useMemo)(()=>{let e=n.query.variation,t=o.model.variations.find(t=>t.id===e);if(t)return t;throw Error("Variation not found")},[o,n]),b=(0,s.useCallback)((e,t)=>{p(e),x(async()=>{let{errors:i}=await (0,d.Ve)(e);if(i.length>0)throw i;let{errors:r,mocks:n}=await (0,d.pL)({libraryID:e.from,sliceID:e.model.id});if(r.length>0)throw r;g({...e,mocks:n}),j(),null==t||t()})},[x,g,j]),y=(0,s.useMemo)(()=>({actionQueueStatus:v,slice:o,setSlice:b,variation:C}),[v,o,b,C]);return(0,r.jsx)(h.Provider,{value:y,children:"function"==typeof t?t(y):t})}function v(){let e=(0,s.useContext)(h);if(!e)throw Error("SliceBuilderProvider not found");return e}var x=i(44309),f=i(14226),g=i(43388),j=i(23094),C=i(17378),b=i(18566),y=i(80148);async function _(e){let{errors:t,model:i}=await y.managerClient.customTypes.readCustomType({id:e});if(t.length>0)throw t;return i}var w=i(59294),I=i(14101);let S=e=>(0,r.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.8536 6.85355C18.0488 6.65829 18.0488 6.34171 17.8536 6.14645C17.6583 5.95118 17.3417 5.95118 17.1464 6.14645L12 11.2929L6.85355 6.14645C6.65829 5.95118 6.34171 5.95118 6.14645 6.14645C5.95118 6.34171 5.95118 6.65829 6.14645 6.85355L11.2929 12L6.14645 17.1464C5.95118 17.3417 5.95118 17.6583 6.14645 17.8536C6.34171 18.0488 6.65829 18.0488 6.85355 17.8536L12 12.7071L17.1464 17.8536C17.3417 18.0488 17.6583 18.0488 17.8536 17.8536C18.0488 17.6583 18.0488 17.3417 17.8536 17.1464L12.7071 12L17.8536 6.85355Z",fill:"currentColor"})}),D=e=>(0,r.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,r.jsx)("path",{d:"M9.5 12L6 9.5L9.5 7V9.5V12Z",fill:"currentColor"}),(0,r.jsx)("path",{d:"M6 9.5H11C14.3 9.5 17 12.2 17 15.5V17.5M6 9.5L9.5 12V9.5V7L6 9.5Z",stroke:"currentColor",strokeLinecap:"round"})]}),k=()=>{let{source:e}=(0,I.l)(),t=function(e){let t=(0,w.Ag)(e.query);return void 0!==t&&(0,w.ne)(e.asPath,t)?t:void 0}(e);return void 0!==t?(0,r.jsx)(C.S,{children:(0,r.jsx)(s.Suspense,{children:(0,r.jsx)(f.D,{bottom:32,justifyContent:"center",position:"fixed",right:0,width:"100vw",children:(0,r.jsx)(T,{sourceCustomTypeId:t})})})}):null},T=e=>{let{sourceCustomTypeId:t}=e,i=(0,b.QT)(_,[t]),[n,o]=(0,s.useState)(!0),l=(0,a.useRouter)();if(void 0===i||!n)return null;{let{format:e,id:t}=i,n=w.cd[e].getBuilderPagePathname(t);return(0,r.jsxs)(f.F,{density:"compact",color:"dark",children:[(0,r.jsxs)(f.E,{onClick:()=>{l.push(n)},renderStartIcon:()=>(0,r.jsx)(D,{}),children:["Return to ",i.label]}),(0,r.jsx)(f.E,{onClick:()=>{o(!1)},renderStartIcon:()=>(0,r.jsx)(S,{})})]})}},R=()=>(0,r.jsx)(f.E,{asChild:!0,invisible:!0,color:"grey",endIcon:"openInNew",sx:{alignSelf:"center"},onClick:()=>{d.Xe.track({event:"mcp:promo-link-clicked",source:"slice_editor",target:"docs"})},children:(0,r.jsx)("a",{href:"https://prismic.io/docs/ai#code-with-prismics-mcp-server",target:"_blank",children:"Boost your workflow in Cursor with Prismic MCP"})});var H=i(62813),F=i(56580),E=i(33710),N=i(36887),A=i(6277),L=i(40484),O=i(10704),V=i.n(O);let z=e=>{let{align:t,alignOffset:i,arrowSize:n=12,children:o,collisionPadding:a=parseFloat(f.t.space[16]),side:l,sideOffset:d=4,trigger:c,...u}=e,{arrowWidth:m,arrowHeight:h}=(0,s.useMemo)(()=>{if(void 0===n)return{arrowWidth:10,arrowHeight:5};let e=Math.SQRT2*n;return{arrowWidth:e,arrowHeight:e/2}},[n]);return(0,r.jsxs)(L.fC,{...u,children:[(0,r.jsx)(L.xz,{asChild:!0,children:c}),(0,r.jsx)(L.h_,{children:(0,r.jsxs)(L.VY,{align:t,alignOffset:i,className:V().container,collisionPadding:a,side:l,sideOffset:d,children:[o,(0,r.jsx)(L.Eh,{className:V().arrow,height:h,width:m})]})})]})};var M=i(56099),P=i.n(M);let Z=e=>{let{align:t,alignOffset:i,arrowSize:n,children:o,collisionPadding:a,onClose:l,open:d,openDelay:c=5e3,side:u,sideOffset:m,trigger:h}=e,[p,v]=(0,s.useState)(!1),x=(0,s.useCallback)(()=>{l&&l(),v(!1)},[l,v]);return!function(e){let{condition:t,action:i,delay:r}=e,[n,o]=(0,s.useState)(null);(0,s.useEffect)(()=>(t&&null===n&&o(setTimeout(i,r)),()=>{null!==n&&(clearTimeout(n),o(null))}),[t,i,r,n,o])}({condition:!0===d,action:(0,s.useCallback)(()=>v(e=>!1===e),[v]),delay:c}),(0,r.jsx)(z,{align:t,alignOffset:i,arrowSize:n,collisionPadding:a,onOpenChange:e=>{!0===e&&!0===d&&v(e)},open:p,openDelay:c,side:u,sideOffset:m,trigger:h,children:(0,r.jsx)(B,{handleClose:x,children:o})})},B=e=>{let{handleClose:t,children:i}=e;return(0,r.jsx)(W.Provider,{value:{handleClose:t},children:(0,r.jsx)("div",{className:P().root,children:i})})},W=(0,s.createContext)({handleClose:()=>void 0});function q(){return(0,s.useContext)(W)}let X=e=>{let{children:t}=e,{handleClose:i}=q();return(0,r.jsxs)("div",{className:P().title,children:[(0,r.jsx)("span",{children:t}),(0,r.jsx)("button",{className:P().titleCloseIcon,onClick:i,children:(0,r.jsx)(S,{})})]})},G=e=>{let{component:t,...i}=e,n="image"===t?"img":N.nk;return(0,r.jsx)("div",{className:P().mediaContainer,children:(0,s.createElement)(n,{...i,className:(0,A.W)(P().media,i.className)})})},U=e=>{let{children:t}=e;return(0,r.jsx)("div",{className:P().description,children:t})},Y=e=>{let{children:t}=e,{handleClose:i}=q();return(0,r.jsx)("div",{className:P().closeButtonContainer,children:(0,r.jsx)(f.E,{sx:{width:"100%"},onClick:i,children:t})})};var K=i(39180),Q=i(7974),J=i(79384);let $=e=>{let{children:t,open:i,onClose:n}=e;return(0,r.jsxs)(Z,{open:i,trigger:t,onClose:n,children:[(0,r.jsx)(X,{children:"Simulate your slices"}),(0,r.jsx)(G,{component:"video",cloudName:"dmtf1daqp",loop:!1,autoPlay:!1,publicId:Q.Sn,poster:"/simulator-video-thumbnail.png",controls:!0,onPlay:()=>{d.Xe.track({event:"open-video-tutorials",video:Q.Sn})}}),(0,r.jsx)(U,{children:"Minimize context-switching by previewing your Slice components in the simulator."}),(0,r.jsx)(Y,{children:"Got it"})]})};var ee=e=>{let{disabled:t}=e,i=(0,a.useRouter)(),n=(0,s.useRef)(null),{setSeenSimulatorToolTip:o}=(0,m.Z)(),{hasSeenSimulatorTooltip:l}=(0,F.v9)(e=>({hasSeenSimulatorTooltip:(0,J.bv)(e)}));(0,s.useEffect)(()=>{let e=n.current;e&&!l&&setTimeout(()=>E.Z.show(e),5e3)},[l]);let d=()=>{if(o(),n.current){let{current:e}=n;E.Z.hide(e)}};return(0,r.jsx)("span",{"data-tip":!0,"data-tip-disable":!1,"data-for":"simulator-button-tooltip",ref:n,children:(0,r.jsx)($,{open:!l,onClose:d,children:(0,r.jsx)(f.E,{"data-tip":!0,"data-testid":"simulator-open-button",onClick:()=>{d(),window.open("".concat(i.asPath,"/simulator"),Q.pq)},disabled:t,renderStartIcon:()=>(0,r.jsx)(K.z,{color:f.t.color.grey1,height:"24px",style:{transform:"scale(calc(4 / 3))"},width:"24px"}),children:"Simulate"})})})},et=i(88866),ei=i(28316),er=i(88932),en=i(35289),eo=i(63908),ea=i(34166),el=i(3285),es=i(40141),ed=i(49219),ec=i(26109),eu=i(45440),em=i(16086),eh=i(358),ep=i(5495),ev=i(39302);let ex=[eu.C.Image,eu.C.Text,eu.C.StructuredText,eu.C.Link,eu.C.Select,eu.C.Boolean,eu.C.Number,eu.C.Color,eu.C.Date,eu.C.Table,eu.C.Embed,eu.C.Timestamp,eu.C.GeoPoint,eu.C.ContentRelationship,eu.C.LinkToMedia];var ef=()=>{let{slice:e,setSlice:t,variation:i}=v(),[n,o]=(0,s.useState)(!1),a=[eu.C.Group,...ex],l=!!(i.items&&Object.keys(i.items).length>0),d=r=>n=>{if(r===ec.Rt.Items&&i.items&&Object.keys(i.items).length<=1){o(!0);return}t((0,eo.AK)({slice:e,variationId:i.id,widgetArea:r,fieldId:n}))},c=(r,n)=>{let{apiId:o,newKey:a,value:l,inGroupFieldAction:s}=n;t((0,eo.L4)({slice:e,variationId:i.id,widgetArea:r,previousFieldId:o,newFieldId:a,newField:l}),()=>{"add"===s&&er.Am.success("Field added")}),s||(0,ev.Z)({previousId:o,id:a,field:l})},u=(r,n)=>{let{apiId:o,value:l}=n,{type:s}=l,d=a.find(e=>e.CUSTOM_NAME===s||e.TYPE_NAME===s);if(!d)throw Error("Unsupported Field Type: ".concat(s));try{d.schema.validateSync(l,{stripUnknown:!1})}catch(e){throw Error('Model is invalid for widget "'.concat(l.type,'".'))}t((0,eo.xS)({slice:e,variationId:i.id,widgetArea:r,newFieldId:o,newField:l.type===et.GroupFieldType?ed.Fl.fromSM(l):l}),()=>{er.Am.success("".concat("Group"===s?"Group":"Field"," added"))}),(0,ep.V)({id:o,field:l})},m=e=>t=>""===t.apiId?u(e,{...t,apiId:t.newKey}):c(e,t),h=r=>n=>{if((0,em.uS)(n))return;let{source:o,destination:a}=n;if(!a)return;let l=(0,eo.gR)({slice:e,variationId:i.id,widgetArea:r,sourceIndex:o.index,destinationIndex:a.index});(0,ei.flushSync)(()=>t(l))};return(0,r.jsxs)(f.D,{flexDirection:"column",gap:18,children:[(0,r.jsxs)(en.aV,{children:[(0,r.jsx)(es.Z,{zoneType:"slice",zoneTypeFormat:void 0,tabId:void 0,title:"Fields",dataTip:" The non-repeatable zone\n is for fields<br/> that should appear once, like a<br/>\n section title.\n",fields:i.primary,EditModal:el.Z,widgetsArray:a,onDeleteItem:d(ec.Rt.Primary),onSave:m(ec.Rt.Primary),onDragEnd:h(ec.Rt.Primary),poolOfFieldsToCheck:i.primary||[],renderHintBase:e=>{let{item:t}=e;return"slice.primary".concat((0,eh.Ti)(t.key))},renderFieldAccessor:e=>"slice.primary".concat((0,eh.Ti)(e)),testId:"static-zone-content",isRepeatableCustomType:void 0,emptyStateHeading:void 0}),l?(0,r.jsx)(es.Z,{zoneType:"slice",zoneTypeFormat:void 0,tabId:void 0,isRepeatable:!0,title:"Repeatable Zone",dataTip:"The repeatable zone is for a group<br/>\n of fields that you want to be able to repeat an<br/>\n indeterminate number of times, like FAQs",widgetsArray:ex,fields:i.items,EditModal:el.Z,onDeleteItem:d(ec.Rt.Items),onSave:m(ec.Rt.Items),onDragEnd:h(ec.Rt.Items),poolOfFieldsToCheck:i.items||[],renderHintBase:e=>{let{item:t}=e;return"item".concat((0,eh.Ti)(t.key))},renderFieldAccessor:e=>"slice.items[i]".concat((0,eh.Ti)(e)),testId:"slice-repeatable-zone",isRepeatableCustomType:void 0,emptyStateHeading:"No fields"}):null,(0,r.jsxs)(f.ae,{size:"small",open:n,onOpenChange:e=>o(e),children:[(0,r.jsx)(f.al,{icon:"delete",title:"Delete field"}),(0,r.jsxs)(f.aj,{children:[(0,r.jsx)(f.D,{padding:24,gap:12,flexDirection:"column",children:e.model.variations.length>1?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("strong",{children:["This action will permanently remove the repeatable zone from the ",e.model.name," slice ",i.name," variation."]}),(0,r.jsx)("div",{children:"Other variations will be left untouched. To reimplement repeatable fields later, use a group field instead of the repeatable zone."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("strong",{children:["This action will permanently remove the repeatable zone from the ",e.model.name,"."]}),(0,r.jsx)("div",{children:"To reimplement repeatable fields later, use a group field instead of the repeatable zone."})]})}),(0,r.jsxs)(f.ah,{children:[(0,r.jsx)(f.ai,{}),(0,r.jsx)(f.af,{color:"tomato",onClick:()=>{t((0,eo.Oh)({slice:e,variationId:i.id})),o(!1)},children:"Delete"})]})]})]})]}),(0,r.jsx)(ea.rT,{type:"model",library:e.from,sliceId:e.model.id,variationId:i.id})]})},eg=i(34887),ej=i.n(eg);let eC=e=>{let{variant:t="dashed",color:i="currentColor",className:n}=e;return(0,r.jsx)("hr",{className:(0,A.W)(ej()["variant-".concat(t)],n),style:{color:f.t.color[i]}})};var eb=i(51507),ey=i(27763),e_=i(21442);async function ew(e){try{let{errors:t}=await (0,d.Ve)(e.component);if(t.length>0)throw t;let{errors:i}=await (0,d.Xi)({libraryID:e.component.from,sliceID:e.component.model.id,variationID:e.variation.id});if(i.length>0)throw i;(0,ea.tB)({type:"model",library:e.component.from,sliceId:e.component.model.id,variationId:e.variation.id});let{slice:r,errors:n}=await (0,d.X$)(e.component.from,e.component.model.id);if(n.length>0)throw n;if(!r)throw Error("Could not read variation `".concat(e.variation.name,"`"));let{mocks:o}=await (0,d.pL)({libraryID:e.component.from,sliceID:e.component.model.id}),a=ey.Y.getBuilderPagePathname({libraryName:e.component.href,sliceName:r.name,variationId:r.variations[0].id});await e.router.replace(a);let l={...e.component,model:r,mocks:o};return e.saveSliceSuccess(l),l}catch(i){let t="Could not delete variation `".concat(e.variation.name,"`");throw console.error(t,i),er.Am.error(t),i}}let eI=e=>{let{isOpen:t,onClose:i,slice:n,variation:o}=e,l=(0,a.useRouter)(),[d,c]=(0,s.useState)(!1),{saveSliceSuccess:u}=(0,m.Z)(),{setSlice:h}=v();return(0,r.jsxs)(f.ae,{open:t,onOpenChange:e=>!e&&i(),size:{width:448,height:"auto"},children:[(0,r.jsx)(f.al,{icon:"delete",title:"Delete variation"}),(0,r.jsx)(f.aj,{children:(0,r.jsxs)(f.D,{flexDirection:"column",children:[(0,r.jsxs)(f.bL,{color:"grey11",sx:{marginBlock:16,marginInline:16},children:["This action will remove the variation from the slice model and delete associated files. When you push your changes, the variation will disappear from your repository. This update will"," ",(0,r.jsx)(eS,{children:"not"})," affect your documents until you ",(0,r.jsx)(eS,{children:"edit"})," ","them manually."]}),(0,r.jsxs)(f.ah,{children:[(0,r.jsx)(f.ai,{size:"medium"}),(0,r.jsx)(f.af,{size:"medium",color:"tomato",onClick:()=>{o&&(async()=>{c(!0);try{let e=await ew({component:n,router:l,saveSliceSuccess:u,variation:o});h(e)}catch(e){}c(!1),i()})()},loading:d,children:"Delete"})]})]})})]})},eS=e=>(0,r.jsx)(f.bL,{...e,color:"inherit",component:"span",variant:"bold"});var eD=i(30195);async function ek(e){try{let{errors:t}=await (0,d.Ve)(e.component);if(t.length>0)throw t;let{errors:i}=await (0,d.eH)(e.component,{...e.variation,name:e.variationName});if(i.length>0)throw i;let{slice:r,errors:n}=await (0,d.X$)(e.component.from,e.component.model.id);if(n.length>0)throw n;if(!r)throw Error("Could not read variation `".concat(e.variation.name,"`"));let{mocks:o}=await (0,d.pL)({libraryID:e.component.from,sliceID:e.component.model.id}),a={...e.component,model:r,mocks:o};return e.saveSliceSuccess(a),a}catch(i){let t="Could not rename variation `".concat(e.variation.name,"`");throw console.error(t,i),er.Am.error(t),i}}let eT=e=>{let{isOpen:t,onClose:i,slice:n,variation:o}=e,[a,d]=(0,s.useState)(!1),[c,u]=(0,s.useState)(""),[h,p]=(0,s.useState)(),{setSlice:x}=v(),{saveSliceSuccess:g}=(0,m.Z)();return(0,l.pQ)(t,()=>{if(t&&(null==o?void 0:o.name)!==c){var e;u(null!==(e=null==o?void 0:o.name)&&void 0!==e?e:""),p(void 0)}}),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(f.ae,{open:t,onOpenChange:e=>!e&&i(),size:{width:448,height:"auto"},children:[(0,r.jsx)(f.al,{icon:"edit",title:"Rename variation"}),(0,r.jsx)(f.aj,{children:(0,r.jsxs)(f.aJ,{onSubmit:function(){if(!h&&o){d(!0);try{ek({component:n,saveSliceSuccess:g,variation:o,variationName:c.trim()}).then(e=>{x(e)})}catch(e){}d(!1),i()}},children:[(0,r.jsxs)(f.D,{flexDirection:"column",gap:8,padding:16,children:[(0,r.jsx)(f.bL,{variant:"normal",color:"grey11",children:"This action will rename the variation in the slice model. When you push your changes, the variation will be renamed in your repository."}),(0,r.jsx)(f.D,{flexDirection:"column",gap:4,children:(0,r.jsx)(f.aM,{type:"text",label:"Variation name *",placeholder:"Variation name",error:h,value:c,onValueChange:function(e){u(e),p(function(e){let t=eR.safeParse(e,{errorMap:eH});if(t.error)return t.error.errors[0].message}(e))}})})]}),(0,r.jsxs)(f.ah,{children:[(0,r.jsx)(f.ai,{size:"medium"}),(0,r.jsx)(f.af,{type:"submit",size:"medium",loading:a,disabled:!!h,children:"Rename"})]})]})})]})})},eR=eD.z.string().min(1),eH=e=>e.code===eD.z.ZodIssueCode.too_small?{message:"This field is required"}:{message:"Invalid value"};var eF=i(68105),eE=i(63397),eN=i(96009),eA=i.n(eN),eL=i(36131),eO=i(75289),eV=i(30527);function ez(e){let{children:t}=e,i=(0,eV.W)();return(0,r.jsx)(eO.kC,{sx:{p:3,pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:i,borderTopRightRadius:i,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:t})}var eM=e=>{let{children:t,FooterContent:i,HeaderContent:n,close:o,sx:a={}}=e;return(0,r.jsx)(eV.Z,{borderFooter:!0,footerSx:{p:0},bodySx:{pt:2,pb:4,px:4},sx:{border:"none",...a},Header:(0,r.jsxs)(ez,{children:[n,o?(0,r.jsx)(eO.x8,{onClick:o,type:"button"}):null]}),Footer:i?(0,r.jsxs)(eO.kC,{sx:{alignItems:"space-between",bg:"headSection",p:3},children:[(0,r.jsx)(eO.xu,{sx:{ml:"auto"}}),i]}):null,children:t})},eP=i(55862);let eZ=e=>{let{msg:t}=e;return(0,r.jsx)(eO.xv,{as:"span",sx:{fontSize:12,color:"error",mt:"5px",ml:2},children:t||"Error!"})};var eB=e=>{let{isOpen:t,onClose:i,onSubmit:n,initialVariation:o,variations:a}=e,[l,d]=(0,s.useState)({}),[c,u]=(0,s.useState)(""),[m,h]=(0,s.useState)(!0),[p,v]=(0,s.useState)(""),[x,g]=(0,s.useState)({value:o.id,label:o.name}),[j,C]=(0,s.useState)(!1);function b(){y(),i()}function y(){u(""),v(""),d({}),h(!0),g({value:o.id,label:o.name})}async function _(){let e=function(e){let{id:t,name:i,origin:r}=e,n=t&&t.length?null:{id:"Required!"},o=a.find(e=>e.id===t)?{id:"This id already exists!"}:null,l=i&&i.length?null:{name:"Required!"},s=r.value.length&&a.find(e=>e.id===r.value)?null:{id:"You must select an existing variation!"},d=t&&t.length&&!/^[A-Za-z0-9]+([A-Za-z0-9]+)*$/.exec(t)&&{id:"No special characters allowed"};return{...n,...o,...l,...s,...d}}({id:c,name:p,origin:x});if(Object.keys(e).length)d(e);else{let e=a.find(e=>e.id===x.value);e&&(C(!0),await n(c,p,e),C(!1),b())}}return(0,s.useEffect)(()=>{y()},[o,t]),(0,r.jsx)(eP.Z,{isOpen:t,shouldCloseOnOverlayClick:!0,onRequestClose:()=>b(),contentLabel:"Widget Form Modal",style:{content:{maxWidth:"700px"}},children:(0,r.jsx)(eE.J9,{initialValues:{id:c,name:p,origin:x},onSubmit:_,children:(0,r.jsx)(eE.l0,{id:"variation-add",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),_())},children:(0,r.jsx)(f.D,{children:(0,r.jsxs)(eM,{sx:{textAlign:"left"},HeaderContent:(0,r.jsx)(eO.xv,{as:"h2",children:"Add new Variation"}),FooterContent:(0,r.jsxs)(f.D,{gap:16,alignItems:"center",children:[(0,r.jsx)(f.E,{onClick:b,color:"grey",children:"Cancel"}),(0,r.jsx)(f.E,{type:"submit",loading:j,children:"Submit"})]}),close:b,children:[(0,r.jsxs)(f.D,{flexDirection:"column",padding:{block:16},children:[(0,r.jsxs)(eO.__,{htmlFor:"name",sx:{mb:1},children:["Variation name*",l.name?(0,r.jsx)(eZ,{msg:l.name}):""]}),(0,r.jsx)(eE.gN,{autoComplete:"off",id:"name",name:"name",placeholder:"e.g. Grid - With Icon",as:eO.II,maxLength:30,value:p,onChange:e=>{var t;v(t=e.currentTarget.value),m&&u(eA()(t))}}),(0,r.jsx)(eO.xv,{children:"It will appear here in Slice Machine, and in the page editor in Prismic"})]}),(0,r.jsxs)(f.D,{flexDirection:"column",padding:{bottom:16},children:[(0,r.jsxs)(eO.__,{htmlFor:"id",sx:{mb:1},children:["Variation ID*",l.id?(0,r.jsx)(eZ,{msg:l.id}):""]}),(0,r.jsx)(eE.gN,{autoComplete:"off",id:"id",name:"id",placeholder:"e.g. gridWithIcon",as:eO.II,maxLength:30,value:c,onChange:e=>{var t;return t=e.currentTarget.value,void(h(!1),u(eA()(t)))}}),(0,r.jsx)(eO.xv,{children:"It's generated automatically based on the variation name and will appear in the API responses."})]}),(0,r.jsxs)(f.D,{flexDirection:"column",padding:{bottom:8},children:[(0,r.jsx)(eO.__,{htmlFor:"origin",sx:{mb:1},children:"Duplicate from"}),(0,r.jsx)(eL.ZP,{name:"origin",options:a.map(e=>({value:e.id,label:e.name})),onChange:e=>{e&&g(e)},defaultValue:x,maxMenuHeight:150,theme:e=>({...e,colors:{...e.colors,text:"text",primary:"background"}})})]})]})})})})})},eW=i(20136),eq=i.n(eW);let eX=e=>{let{horizontalScroll:t=!1}=e,{slice:i,variation:n,setSlice:o}=v(),[l,c]=(0,s.useState)(),u=(0,e_.H)(),{sliceFilterFn:h,defaultVariationSelector:p,onUploadSuccess:x}=u.modalPayload,g=(0,a.useRouter)(),{saveSliceSuccess:j}=(0,m.Z)(),C=i.model.variations.length;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.D,{flexDirection:"column",gap:16,children:t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eC,{variant:"edgeFaded",color:"grey6"}),(0,r.jsxs)(f.D,{justifyContent:"space-between",children:[(0,r.jsxs)(f.bL,{color:"grey11",children:[C," variation",1!==C&&"s"]}),(0,r.jsx)(f.E,{onClick:()=>{c({type:"ADD_VARIATION"})},startIcon:"add",color:"grey",children:"Add a variation"})]}),(0,r.jsx)("div",{className:eq().hideScrollbar,style:{height:"240px",position:"relative",marginRight:"-32px",overflowX:"scroll",scrollSnapType:"x mandatory"},children:(0,r.jsx)("div",{style:{position:"absolute",paddingRight:"32px"},children:(0,r.jsx)(f.D,{flexDirection:"row",gap:16,children:(0,r.jsx)(eG,{screenshotChangesModal:u,setDialog:c,width:320})})})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eG,{screenshotChangesModal:u,setDialog:c}),(0,r.jsx)("div",{style:{bottom:f.t.space[0],marginBottom:"-".concat(f.t.space[16]),position:"sticky"},children:(0,r.jsxs)(f.D,{backgroundColor:"grey2",flexDirection:"column",padding:{bottom:40,inline:24},children:[(0,r.jsx)(f.aS,{sx:{left:0,position:"absolute",right:0}}),(0,r.jsx)(f.E,{color:"grey",onClick:()=>{c({type:"ADD_VARIATION"})},startIcon:"add",sx:{position:"relative"},children:"Add a variation"})]})})]})}),(0,r.jsx)(eF.Z,{slices:h([i]),defaultVariationSelector:p,onUploadSuccess:x}),(0,r.jsx)(eT,{isOpen:(null==l?void 0:l.type)==="RENAME_VARIATION",onClose:()=>{c(void 0)},slice:i,variation:null==l?void 0:l.variation}),(0,r.jsx)(eI,{isOpen:(null==l?void 0:l.type)==="DELETE_VARIATION",onClose:()=>{c(void 0)},slice:i,variation:null==l?void 0:l.variation}),(0,r.jsx)(eB,{initialVariation:n,isOpen:(null==l?void 0:l.type)==="ADD_VARIATION",onClose:()=>{c(void 0)},onSubmit:async(e,t,r)=>{try{let{slice:n,variation:a}=(0,eo.Kp)({slice:i,id:e,name:t,copiedVariation:r});await (0,d.Ve)(n),j(n),o(n);let l=ey.Y.getBuilderPagePathname({libraryName:n.href,sliceName:n.model.name,variationId:a.id});g.replace(l)}catch(i){let e="Could not add variation `".concat(t,"`");console.error(e,i),er.Am.error(e)}},variations:i.model.variations})]})},eG=e=>{let{screenshotChangesModal:t,setDialog:i,width:n}=e,{slice:o,variation:a,setSlice:l}=v(),s={scrollSnapAlign:"start"};return(0,r.jsx)(r.Fragment,{children:o.model.variations.map(e=>(0,r.jsx)("div",{style:void 0!==n?{...s,width:n}:s,children:(0,r.jsx)(eb.b,{action:{type:"menu",onRename:()=>{i({type:"RENAME_VARIATION",variation:e})},onRemove:()=>{i({type:"DELETE_VARIATION",variation:e})},removeDisabled:o.model.variations.length<=1},mode:"navigation",onUpdateScreenshot:()=>{t.onOpenModal({sliceFilterFn:e=>e,defaultVariationSelector:{sliceID:o.model.id,variationID:e.id},onUploadSuccess:e=>{l(e)}})},replace:!0,selected:e.id===a.id,slice:o,variant:"outlined",variationId:e.id},e.id)},e.id))})};var eU=()=>{let{slice:e,actionQueueStatus:t}=v(),i=(0,f.cj)({max:"large"});return(0,r.jsxs)(H.LN,{children:[(0,r.jsxs)(H.wd,{children:[(0,r.jsx)(H.Xq,{url:"/slices"}),(0,r.jsxs)(H.Cx,{children:[(0,r.jsx)(g.g,{children:"Slices"}),(0,r.jsx)(g.g,{active:!0,children:e.model.name})]}),(0,r.jsxs)(H.K2,{children:[(0,r.jsx)(R,{}),(0,r.jsx)(j.X,{status:t}),(0,r.jsx)(ee,{disabled:"done"!==t})]})]}),(0,r.jsxs)(H.RN,{children:[(0,r.jsxs)(f.D,{display:"grid",alignItems:"flex-start",gap:16,...i?{gridTemplateRows:"304px 1fr"}:{gridTemplateColumns:"320px 1fr"},children:[(0,r.jsx)(eX,{horizontalScroll:i}),(0,r.jsx)(ef,{})]}),(0,r.jsx)(k,{})]})]})};function eY(){let e=(0,a.useRouter)(),{slice:t,variation:i}=(0,x.Z)();return void 0===t||void 0===i?(e.replace("/"),null):(0,r.jsx)(p,{initialSlice:t,children:e=>{let{slice:t}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o(),{children:(0,r.jsxs)("title",{children:[t.model.name," - Slice Machine"]})}),(0,r.jsx)(eU,{})]})}})}},10704:function(e){e.exports={reset:"BaseHoverCard_reset__HckHR",container:"BaseHoverCard_container__IZMCG BaseHoverCard_reset__HckHR",arrow:"BaseHoverCard_arrow__gvcjD BaseHoverCard_reset__HckHR"}},34887:function(e){e.exports={base:"Divider_base__4eT6E","variant-dashed":"Divider_variant-dashed__4Lvrj Divider_base__4eT6E","variant-edgeFaded":"Divider_variant-edgeFaded__049V2 Divider_base__4eT6E"}},56099:function(e){e.exports={block:"HoverCard_block__Fubs4",blockWithDisplayRevert:"HoverCard_blockWithDisplayRevert__H6Rbw HoverCard_block__Fubs4",root:"HoverCard_root__OaRBr HoverCard_blockWithDisplayRevert__H6Rbw HoverCard_block__Fubs4",title:"HoverCard_title__dO_Y9 HoverCard_block__Fubs4",titleCloseIcon:"HoverCard_titleCloseIcon__DlZJS HoverCard_block__Fubs4",mediaContainer:"HoverCard_mediaContainer__4Lt3z HoverCard_block__Fubs4",media:"HoverCard_media__U7jSc HoverCard_blockWithDisplayRevert__H6Rbw HoverCard_block__Fubs4",description:"HoverCard_description__HZ9_z HoverCard_blockWithDisplayRevert__H6Rbw HoverCard_block__Fubs4",closeButtonContainer:"HoverCard_closeButtonContainer__7JiLA HoverCard_blockWithDisplayRevert__H6Rbw HoverCard_block__Fubs4"}},20136:function(e){e.exports={hideScrollbar:"VariationsList_hideScrollbar__cHCIS"}}},function(e){e.O(0,[898,789,917,525,461,139,797,397,183,344,256,500,484,34,630,658,888,774,179],function(){return e(e.s=31314)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{74600:function(e,t,n){var i=n(34311),l=n(23779),o=i(function(e,t,n){return e+(n?" ":"")+l(t)});e.exports=o},26688:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices",function(){return n(31562)}])},34166:function(e,t,n){"use strict";n.d(t,{nZ:function(){return d},rT:function(){return x},tB:function(){return u}});var i=n(52322),l=n(14226),o=n(2784),r=n(30195),s=n(94160),a=n(76611),c=n(5683);function d(e){let{type:t,library:n,sliceId:i,variationId:l,langSmithUrl:o}=e,r=(0,c.i)({type:t,library:n,sliceId:i,variationId:l}),s=JSON.stringify({langSmithUrl:o});localStorage.setItem(r,s)}function u(e){let{type:t,library:n,sliceId:i,variationId:l}=e,o=(0,c.i)({type:t,library:n,sliceId:i,variationId:l});localStorage.removeItem(o)}function x(e){let{type:t,library:n,sliceId:d,variationId:u}=e,{key:x,value:m,done:h}=function(e){let{type:t,library:n,sliceId:i,variationId:l}=e,o=(0,c.i)({type:t,library:n,sliceId:i,variationId:l}),[s,d]=(0,a.V)(o,void 0,{schema:r.z.object({langSmithUrl:r.z.string().url().optional()})});return{key:o,value:s,done:()=>d(void 0)}}({type:t,library:n,sliceId:d,variationId:u}),[p,f]=(0,o.useState)(),g=e=>()=>{m&&(f(x),s.Xe.track({event:"slice-generation-feedback",type:t,sliceId:d,variationId:u,feedback:e,langSmithUrl:m.langSmithUrl}),h())};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.be,{children:(0,i.jsx)(l.bQ,{anchor:(0,i.jsx)(l.D,{width:"100%",justifyContent:"center",position:"absolute",bottom:64}),icon:"check",title:"Thanks for your feedback!",seconds:2,open:!!p,onOpenChange:e=>{e||f(void 0)}},p)}),(0,i.jsx)(l.i,{children:m&&(0,i.jsxs)(l.D,{flexDirection:"row",justifyContent:"end",gap:8,alignItems:"center",children:[(0,i.jsx)(l.bL,{color:"grey11",children:"Did the AI get it right?"}),(0,i.jsxs)(l.D,{flexDirection:"row",gap:4,children:[(0,i.jsx)(l.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Looks good",children:(0,i.jsx)(l.aZ,{variant:"solid",size:"small",icon:"thumbUp",onClick:g("up")})}),(0,i.jsx)(l.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Needs improvement",children:(0,i.jsx)(l.aZ,{variant:"solid",size:"small",icon:"thumbDown",onClick:g("down")})})]})]})})]})}},76611:function(e,t,n){"use strict";n.d(t,{V:function(){return l}});var i=n(2784);function l(e,t,n){let{schema:l}=null!=n?n:{},o=()=>{try{let n=localStorage.getItem(e);if(null==n)return t;if(!l)return JSON.parse(n);return l.parse(JSON.parse(n))}catch(e){return t}},[r,s]=(0,i.useState)(o),[a,c]=(0,i.useState)(e);return a!==e&&(c(e),s(o())),[r,(0,i.useCallback)(n=>{s(i=>{let l;if(void 0===(l="function"==typeof n?n(i):n)){try{localStorage.removeItem(e)}catch(e){return i}return t}try{localStorage.setItem(e,JSON.stringify(l))}catch(e){return i}return l})},[e,t])]}},33986:function(e,t,n){"use strict";n.d(t,{z:function(){return a}});var i=n(52322),l=n(2784),o=n(75289);let r=(e,t)=>e?"".concat(e,"-").concat(t):"",s=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},a=(0,l.forwardRef)((e,t)=>{let{label:n,Icon:l,type:a,form:c,isLoading:d=!1,disabled:u=!1,onClick:x,sx:m={},iconSize:h=16,iconFill:p,variant:f="primary",...g}=e;return(0,i.jsx)(o.zx,{ref:t,sx:{...m,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...d?{cursor:"wait !important"}:{}},type:a,form:c,disabled:u||d,onClick:d?void 0:x,variant:f,...g,children:d?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.$j,{size:h,color:s(f),"data-testid":r(g["data-testid"],"spinner")}),l&&n]}):(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsx)(l,{size:h,fill:p,"data-testid":r(g["data-testid"],"icon")}),n]})})})},46999:function(e,t,n){"use strict";n.d(t,{W:function(){return r}});var i=n(52322),l=n(63397);n(2784);var o=n(75289);let r=e=>{let{name:t,label:n,placeholder:r,error:s,testId:a,onChange:c}=e;return(0,i.jsxs)(o.xu,{mb:3,children:[(0,i.jsx)(o.__,{htmlFor:t,mb:2,children:n}),(0,i.jsx)(l.gN,{name:t,type:"text",placeholder:r,as:o.II,autoComplete:"off",...c?{onChange:c}:null,...a?{"data-testid":a}:null}),s?(0,i.jsx)(o.xv,{"data-testid":a?"".concat(a,"-error"):"input-error",sx:{color:"error",mt:1},children:s}):null]})}},59532:function(e,t,n){"use strict";var i=n(52322),l=n(63397),o=n(37149),r=n.n(o),s=n(75289),a=n(33986),c=n(55862),d=n(30527);function u(e){let{children:t}=e,n=(0,d.W)();return(0,i.jsx)(s.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:t})}t.Z=function(e){let{children:t,close:n,isOpen:o,formId:x,validate:m,onSubmit:h,widthInPx:p,initialValues:f,content:{title:g},cardProps:j,omitFooter:v=!1,isLoading:y=!1,buttonLabel:b="Save",testId:S,actionMessage:C}=e;return r().setAppElement("#__next"),(0,i.jsx)(c.Z,{isOpen:o,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:g,style:{content:{width:null!=p?p:"900px"}},children:(0,i.jsx)(l.J9,{initialValues:f,validate:e=>m?m(e):void 0,onSubmit:e=>{h(e)},children:e=>{let{isValid:o,isSubmitting:r,values:c,errors:m,touched:h,setFieldValue:p,setValues:f}=e;return(0,i.jsx)(l.l0,{id:x,...null!=S?{"data-testid":S}:null,children:(0,i.jsx)(d.Z,{borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"},...j,Header:(0,i.jsxs)(u,{children:[(0,i.jsx)(s.X6,{sx:{fontSize:"20px"},children:g}),(0,i.jsx)(s.x8,{type:"button",onClick:n})]}),Footer:v?null:(0,i.jsxs)(s.kC,{sx:{alignItems:"space-between"},children:[(0,i.jsx)(s.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof C?C(e):C}),(0,i.jsxs)(s.kC,{sx:{ml:"auto"},children:[(0,i.jsx)(s.zx,{mr:2,type:"button",onClick:n,variant:"secondary",disabled:r||y,children:"Cancel"}),(0,i.jsx)(a.z,{label:b,form:x,type:"submit",disabled:!o||r||y,isLoading:r||y,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:t({isValid:o,isSubmitting:r,values:c,errors:m,touched:h,setFieldValue:p,setValues:f})})})}})})}},31562:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return q}});var i=n(52322),l=n(14226),o=n(97729),r=n.n(o),s=n(5632),a=n(2784),c=n(56580),d=n(88932),u=n(65077),x=n(75289),m=n(43388),h=n(91589),p=n(27213),f=n(51507),g=n(27763),j=n(21442),v=n(62813),y=n(65186),b=n(59326),S=n(34166),C=n(80148);async function k(e){let{sliceName:t,sliceID:n,libraryID:i,sliceVariationIds:l,onSuccess:o}=e;try{let{errors:e}=await C.managerClient.slices.deleteSlice({libraryID:i,sliceID:n});if(e.length>0)throw e;l.forEach(e=>{(0,S.tB)({type:"model",library:i,sliceId:n,variationId:e})}),o(),d.Am.success("Successfully deleted slice “".concat(t,"”"))}catch(n){let e="An unexpected error happened while deleting slice “".concat(t,"”.");console.error(e,n),d.Am.error(e)}}var I=n(68968),w=n(33986),z=n(30527),N=n(55862),D=n(54597);let O=e=>{var t;let{isOpen:n,libName:l,sliceId:o,sliceName:r,sliceVariationIds:s,onClose:c}=e,[d,u]=(0,a.useState)(!1),{deleteSliceSuccess:m}=(0,D.Z)(),{syncChanges:h}=(0,I.g)(),{theme:p}=(0,b.B7)(),f=async()=>{u(!0),await k({libraryID:l,sliceID:o,sliceName:r,sliceVariationIds:s,onSuccess:()=>{m(o,l),h()}}),c(),u(!1)};return(0,i.jsx)(N.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:c,children:(0,i.jsx)(z.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:(0,i.jsxs)(x.kC,{sx:{position:"sticky",background:"gray",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,i.jsxs)(x.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(y.$vK,{size:20,color:null===(t=p.colors)||void 0===t?void 0:t.greyIcon}),(0,i.jsx)(x.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,i.jsx)(x.x8,{type:"button",onClick:c})]}),Footer:()=>(0,i.jsxs)(x.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorders))},backgroundColor:"gray"},children:[(0,i.jsx)(w.z,{label:"Cancel",variant:"secondary",onClick:c,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,i.jsx)(w.z,{label:"Delete",variant:"danger",isLoading:d,sx:{minHeight:39,minWidth:78},onClick:()=>{f()}})]}),children:(0,i.jsxs)(x.nv,{children:["This action will immediately make the following changes:",(0,i.jsxs)("ul",{children:[(0,i.jsxs)("li",{children:["Delete the"," ",(0,i.jsxs)(x.xv,{sx:{fontWeight:"bold"},children:[l,"/",r,"/"]})," ","directory."]}),(0,i.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,i.jsx)("ul",{children:(0,i.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."]})})})};var R=n(36887),W=n(94160),_=e=>{let{title:t,onCreateNew:n,buttonText:l,documentationComponent:o,videoPublicIdUrl:r,...s}=e;return(0,i.jsxs)(x.xu,{sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"},...s,children:[(0,i.jsx)(x.xu,{sx:e=>{var t;return{display:"flex",flex:1,alignItems:"center",minWidth:"400px",maxWidth:"70%",border:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02)}},children:(0,i.jsx)(R.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:r,onPlay:()=>{W.Xe.track({event:"open-video-tutorials",video:r})}})}),(0,i.jsxs)(x.xu,{sx:e=>{var t;return{bg:"white",display:"flex",flexDirection:"column",border:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02),flex:1,minWidth:"400px",maxWidth:"70%"}},children:[(0,i.jsxs)(x.xu,{sx:e=>{var t;return{display:"flex",flexDirection:"column",p:4,borderBottom:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02)}},children:[(0,i.jsx)(x.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:t}),(0,i.jsx)(x.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:o})]}),(0,i.jsxs)(x.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,i.jsx)(x.zx,{onClick:n,"data-testid":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:l}),(0,i.jsx)(x.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"})]})]})]})},Z=n(6256),F=n(63908),L=n(26109);async function P(e){let{slice:t,newSliceName:n,onSuccess:i}=e;try{let e=(0,F.PQ)(t,n),{errors:l}=await C.managerClient.slices.renameSlice({libraryID:t.from,model:L.id.fromSM(e.model)});if(l.length>0)throw l;i(e),d.Am.success("Slice name updated")}catch(n){let e="An unexpected error happened while renaming “".concat(t.model.name,"”.");console.error(e,n),d.Am.error(e)}}var T=n(7723),A=n(59532),B=n(46999),E=n(63019);let X=e=>{var t,n;let{slice:l,isOpen:o,onClose:r}=e,{renameSliceSuccess:s}=(0,D.Z)(),{syncChanges:a}=(0,I.g)(),{localLibs:d,remoteLibs:u}=(0,c.v9)(e=>({localLibs:(0,T.Sd)(e),remoteLibs:(0,T.sT)(e)})),m=null!==(t=null==l?void 0:l.model.name)&&void 0!==t?t:"",h=async e=>{l&&(await P({slice:l,newSliceName:e.sliceName,onSuccess:e=>{s(e.from,e.model),a()}}),r())};return(0,i.jsx)(A.Z,{testId:"rename-slice-modal",isOpen:o,widthInPx:"530px",formId:"rename-slice-modal-".concat(null!==(n=null==l?void 0:l.model.id)&&void 0!==n?n:""),close:r,buttonLabel:"Rename",onSubmit:e=>void h(e),initialValues:{sliceName:m},content:{title:"Rename a slice"},validate:e=>(0,E.h)(e,d,u),children:e=>{let{touched:t,errors:n}=e;return(0,i.jsx)(x.xu,{children:(0,i.jsx)(B.W,{name:"sliceName",label:"Slice Name","data-testid":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:t.sliceName?n.sliceName:void 0,testId:"slice-name-input"})})}})};var H=n(21151),U=n(68105),V=n(39204),J=n(7974),q=()=>{var e,t,n,o;let y=(0,s.useRouter)(),{modalPayload:b,onOpenModal:S}=(0,j.H)(),{openLoginModal:k}=(0,D.Z)(),I=(0,p.F)({menuType:"Dropdown"}),{sliceFilterFn:w,defaultVariationSelector:z}=b,{remoteSlices:N,libraries:R}=(0,c.v9)(e=>({remoteSlices:(0,T.sT)(e),libraries:(0,T.Sd)(e)})),[W,F]=(0,a.useState)(!1),[L,P]=(0,a.useState)(!1),[A,B]=(0,a.useState)(!1),[E,q]=(0,a.useState)(!1),M=R.filter(e=>e.isLocal),Q=R.map(e=>(e.components=[...e.components].sort((e,t)=>e.model.name.localeCompare(t.model.name)),e)),Y=(R||[]).map(e=>e.components).flat(),G=Y.length,[K,$]=(0,a.useState)(),ee=()=>{P(!0)},et=()=>{B(!0)},en=async()=>{await C.managerClient.user.checkIsLoggedIn()?q(!0):k()},ei=()=>{q(!1)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r(),{children:(0,i.jsx)("title",{children:"Slices - Slice Machine"})}),(0,i.jsxs)(v.LN,{children:[(0,i.jsxs)(v.wd,{children:[(0,i.jsx)(v.Cx,{children:(0,i.jsx)(m.g,{children:"Slices"})}),(null==M?void 0:M.length)!==0&&0!==G?(0,i.jsxs)(l.ar,{children:[(0,i.jsx)(l.av,{children:(0,i.jsx)(l.E,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,i.jsxs)(l.as,{align:"end",children:[(0,i.jsx)(l.at,{renderStartIcon:()=>I.fromImage.BackgroundIcon,onSelect:()=>void en(),description:I.fromImage.description,children:I.fromImage.title}),(0,i.jsx)(l.at,{renderStartIcon:()=>I.fromScratch.BackgroundIcon,onSelect:()=>F(!0),description:I.fromScratch.description,children:I.fromScratch.title})]})]}):void 0]}),(0,i.jsxs)(v.RN,{children:[(0,i.jsx)(u.xR,{sx:{display:"flex",flexDirection:"column"},children:Q.length>0?(0,i.jsx)(x.kC,{sx:{flex:1,flexDirection:"column"},children:0===G?(0,i.jsx)(x.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,i.jsx)(_,{title:"What are slices?",onCreateNew:()=>{F(!0)},buttonText:"Create one",videoPublicIdUrl:J.rd,documentationComponent:(0,i.jsxs)(i.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,i.jsx)(x.rU,{target:"_blank",href:"https://prismic.io/docs/core-concepts/slices",sx:e=>{var t;return{color:null==e?void 0:null===(t=e.colors)||void 0===t?void 0:t.primary}},children:"Learn more"}),"."]}),"data-testid":"slices-table-blank-slate"})}):Q.map(e=>{let{name:t,isLocal:n,components:l}=e;return(0,i.jsxs)(x.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,i.jsxs)(x.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)(x.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,i.jsx)(x.xv,{children:1===Q.length?"Your slices":t})}),!n&&(0,i.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,i.jsx)(H.Z,{elems:l,defineElementKey:e=>e.model.name,renderElem:e=>(0,i.jsx)(f.b,{action:{type:"menu",onRemove:()=>{$(e),ee()},onRename:()=>{$(e),et()}},mode:"navigation",onUpdateScreenshot:()=>{S({sliceFilterFn:t=>t.filter(t=>t.model.id===e.model.id)})},slice:e,variant:"solid"}),gridGap:"32px 16px"})]},t)})}):void 0}),(null==M?void 0:M.length)>0&&(0,i.jsx)(U.Z,{slices:w(Y),defaultVariationSelector:z}),(null==M?void 0:M.length)>0&&W&&(0,i.jsx)(Z.c,{localLibraries:M,location:"slices",remoteSlices:N,onSuccess:(e,t)=>{let n=e.variations[0].id,i=g.Y.getBuilderPagePathname({libraryName:t,sliceName:e.name,variationId:n});y.push(i),d.Am.success((0,V.kQ)({path:"".concat(t,"/").concat(e.name,"/model.json")}))},onClose:()=>{F(!1)}}),(0,i.jsx)(X,{isOpen:A,slice:K,onClose:()=>{B(!1)},"data-testid":"rename-slice-modal"}),(0,i.jsx)(O,{isOpen:L,libName:null!==(e=null==K?void 0:K.from)&&void 0!==e?e:"",sliceId:null!==(t=null==K?void 0:K.model.id)&&void 0!==t?t:"",sliceName:null!==(n=null==K?void 0:K.model.name)&&void 0!==n?n:"",sliceVariationIds:(null!==(o=null==K?void 0:K.model.variations)&&void 0!==o?o:[]).map(e=>e.id),onClose:()=>{P(!1)}}),(0,i.jsx)(h.S,{open:E,location:"slices",onSuccess:e=>{let{library:t}=e;d.Am.success((0,i.jsx)(V.GX,{message:"Slice(s) added to slice zone and created at: ",path:t})),ei()},onClose:ei})]})]})]})}},5683:function(e,t,n){"use strict";n.d(t,{i:function(){return o},v:function(){return l}});let i=e=>"slice-machine_".concat(e),l=i("staticFieldsInfoDialogDismissed");function o(e){let{type:t,library:n,sliceId:l,variationId:o}=e;return i(["ai-feedback",t,n,l,o].join("#"))}}},function(e){e.O(0,[898,789,797,397,344,500,34,658,907,888,774,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);
|