slice-machine-ui 2.20.5-alpha.jp-import-slice-base.1 → 2.20.5-alpha.jp-import-slices-2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/404.html +1 -1
- package/out/_next/static/60BSwFmsh1-aNIyMe29hH/_buildManifest.js +1 -0
- package/out/_next/static/chunks/21-f3962d02eda0a46e.js +1 -0
- package/out/_next/static/chunks/{248-84a5987f0499b074.js → 248-2902bda47821f37b.js} +1 -1
- package/out/_next/static/chunks/{630-2bf927bca082a191.js → 630-4fe1e982234bd925.js} +1 -1
- package/out/_next/static/chunks/633-2d20c3e815c79c7f.js +1 -0
- package/out/_next/static/chunks/{647-aa094286bc248d52.js → 647-a29bee23cb9ac7a2.js} +1 -1
- package/out/_next/static/chunks/660-a3ec593dcfbb44c9.js +1 -0
- package/out/_next/static/chunks/6611d287.1714222015f895ea.js +28 -0
- package/out/_next/static/chunks/{882-48d61b2fabee28d8.js → 882-8ab59c0c72307c87.js} +1 -1
- package/out/_next/static/chunks/pages/{_app-058f06cc8ce33c8d.js → _app-a60aecdbaa4efedd.js} +217 -217
- package/out/_next/static/chunks/pages/{changelog-8514e0696e90a1b2.js → changelog-bc83e25e8d316ca9.js} +1 -1
- package/out/_next/static/chunks/pages/{changes-e66094f57453cf9c.js → changes-6f371ebe52dbe76a.js} +1 -1
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-273e9a82c085b596.js → [customTypeId]-80defa14b6ea36f7.js} +1 -1
- package/out/_next/static/chunks/pages/{labs-56fd818a63553497.js → labs-16d118a80936d583.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-3fa7667de1a790d9.js → [pageTypeId]-f4ff9ad74b44bf09.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-8c70298caf51bed0.js → simulator-873c0c89aaf50b3c.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-22ffa2561ac66557.js → [variation]-0e9aa745ed9fe1ec.js} +1 -1
- package/out/_next/static/chunks/pages/slices-93fc784c443a996c.js +1 -0
- package/out/_next/static/chunks/{webpack-24ddb02bea621501.js → webpack-e986dd216b883a74.js} +1 -1
- package/out/_next/static/css/b30fbbc3ed00a725.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 +6 -6
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/ImportSlicesFromLibraryModal.tsx +104 -285
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/LibrarySlicesTab.tsx +125 -0
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/LocalSlicesTab.tsx +67 -0
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/ReuseExistingSlicesContext.tsx +279 -0
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/hooks/useImportSlicesFromGithub.ts +7 -4
- package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +4 -18
- package/src/features/customTypes/customTypesBuilder/shared/getSubmitButtonLabel.ts +3 -5
- package/src/features/customTypes/customTypesBuilder/sliceCreationOptions.tsx +0 -14
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModalList.tsx +1 -3
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +31 -79
- package/src/pages/slices.tsx +0 -30
- package/out/_next/static/chunks/422-c7a16d95b75c9e1c.js +0 -1
- package/out/_next/static/chunks/489-c9535ef34da63d1a.js +0 -1
- package/out/_next/static/chunks/585-c89bb2471e85b9f8.js +0 -1
- package/out/_next/static/chunks/954-bedaaabf664584a0.js +0 -1
- package/out/_next/static/chunks/a6495ab1.00190ac98e794d8f.js +0 -28
- package/out/_next/static/chunks/pages/slices-76679cf064761d2b.js +0 -1
- package/out/_next/static/css/bc89f2cd4e4781f5.css +0 -1
- package/out/_next/static/ycaxuLGaColncBF1Sgjjd/_buildManifest.js +0 -1
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +0 -72
- /package/out/_next/static/{ycaxuLGaColncBF1Sgjjd → 60BSwFmsh1-aNIyMe29hH}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[477],{37782:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changelog",function(){return r(93081)}])},38193:function(e,n,r){"use strict";r.d(n,{Z:function(){return l}});var t=r(52322),i=r(61183);r(2784);var s=r(59326),o=r(75289);i.Z.registerLanguage("svelte",e=>({subLanguage:"xml",contains:[e.COMMENT("<!--","-->",{relevance:10}),{begin:/^(\s*)(<script(\s*context="module")?>)/gm,end:/^(\s*)(<\/script>)/gm,subLanguage:"javascript",excludeBegin:!0,excludeEnd:!0,contains:[{begin:/^(\s*)(\$:)/gm,end:/(\s*)/gm,className:"keyword"}]},{begin:/^(\s*)(<style.*>)/gm,end:/^(\s*)(<\/style>)/gm,subLanguage:"css",excludeBegin:!0,excludeEnd:!0},{begin:/\{/gm,end:/\}/gm,subLanguage:"javascript",contains:[{begin:/[\{]/,end:/[\}]/,skip:!0},{begin:/([#:\/@])(if|else|each|await|then|catch|debug|html)/gm,className:"keyword",relevance:10}]}]}));let a=["javascript","bash","xml","html","json"];var l=e=>{var n;let{children:r,lang:l,sx:c,codeStyle:x,codeClass:d,Header:p}=e,{theme:g}=(0,s.B7)(),u=l?i.Z.highlight(r,{language:"vue"===l?"html":l}).value:i.Z.highlightAuto(r,a).value;return(0,t.jsxs)(o.kC,{as:"pre",sx:c,children:[p?(0,t.jsx)(p,{}):null,(0,t.jsx)("code",{className:"hljs".concat(d?" ".concat(d):""),style:{overflowX:"auto",padding:"3px 5px",borderRadius:"6px",border:"1px solid",borderColor:String(null===(n=g.colors)||void 0===n?void 0:n.textClear),...x},dangerouslySetInnerHTML:{__html:u}})]})}},93081:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return O}});var t,i,s=r(52322),o=r(97729),a=r.n(o),l=r(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[477],{37782:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changelog",function(){return r(93081)}])},38193:function(e,n,r){"use strict";r.d(n,{Z:function(){return l}});var t=r(52322),i=r(61183);r(2784);var s=r(59326),o=r(75289);i.Z.registerLanguage("svelte",e=>({subLanguage:"xml",contains:[e.COMMENT("<!--","-->",{relevance:10}),{begin:/^(\s*)(<script(\s*context="module")?>)/gm,end:/^(\s*)(<\/script>)/gm,subLanguage:"javascript",excludeBegin:!0,excludeEnd:!0,contains:[{begin:/^(\s*)(\$:)/gm,end:/(\s*)/gm,className:"keyword"}]},{begin:/^(\s*)(<style.*>)/gm,end:/^(\s*)(<\/style>)/gm,subLanguage:"css",excludeBegin:!0,excludeEnd:!0},{begin:/\{/gm,end:/\}/gm,subLanguage:"javascript",contains:[{begin:/[\{]/,end:/[\}]/,skip:!0},{begin:/([#:\/@])(if|else|each|await|then|catch|debug|html)/gm,className:"keyword",relevance:10}]}]}));let a=["javascript","bash","xml","html","json"];var l=e=>{var n;let{children:r,lang:l,sx:c,codeStyle:x,codeClass:d,Header:p}=e,{theme:g}=(0,s.B7)(),u=l?i.Z.highlight(r,{language:"vue"===l?"html":l}).value:i.Z.highlightAuto(r,a).value;return(0,t.jsxs)(o.kC,{as:"pre",sx:c,children:[p?(0,t.jsx)(p,{}):null,(0,t.jsx)("code",{className:"hljs".concat(d?" ".concat(d):""),style:{overflowX:"auto",padding:"3px 5px",borderRadius:"6px",border:"1px solid",borderColor:String(null===(n=g.colors)||void 0===n?void 0:n.textClear),...x},dangerouslySetInnerHTML:{__html:u}})]})}},93081:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return O}});var t,i,s=r(52322),o=r(97729),a=r.n(o),l=r(18337),c=r(2784),x=r(56580),d=r(65077),p=r(18566),g=r(80148);async function u(){return await g.managerClient.versions.getAllStableSliceMachineVersionsWithKind()}function h(){return(0,p.QT)(u,[])}var v=r(58446),f=r(9149),m=r(75289);async function j(){return await g.managerClient.versions.getLatestNonBreakingSliceMachineVersion()}var b=r(85606),k=r(59082),C=r(12170);let y=e=>{let{type:n,hasUpToDateVersions:r}=e;return(0,s.jsx)(m.xv,{sx:{padding:"0px 4px",borderRadius:"2px",fontSize:"8px",fontWeight:600,lineHeight:"16px",textTransform:"uppercase",...(n===i.Latest||n===i.LatestNonBreaking)&&{bg:"grey02",color:"code.gray"},...n===i.Current&&r&&{bg:"lightGreen",color:"code.green"},...n===i.Current&&!r&&{bg:"lightOrange",color:"code.orange"}},children:n})},S=e=>{let{isSelected:n,onClick:r,versionNumber:t,tags:i,hasUpToDateVersions:o}=e;return(0,s.jsxs)(m.kC,{sx:{p:1,borderRadius:"4px",cursor:"pointer",transition:"200ms all",justifyContent:"space-between",alignItems:"center",...n?{color:"purple",bg:(0,C.DZ)("purple",.95)}:{"&:hover":{bg:"grey01"}}},onClick:r,children:[(0,s.jsx)(m.xv,{children:t}),(0,s.jsx)(m.kC,{sx:{gap:"8px"},children:i.map(e=>(0,s.jsx)(y,{type:e,hasUpToDateVersions:o},e))})]})};(t=i||(i={})).Latest="LATEST",t.LatestNonBreaking="LATEST-NON-BREAKING",t.Current="CURRENT";let T=e=>{var n;let{selectedVersion:r,selectVersion:t}=e,i=h(),{sliceMachineUpdateAvailable:o,adapterUpdateAvailable:a}=(0,k.P)(),c=(0,p.QT)(j,[]),x=(0,b.d)(),d=null===(n=i[0])||void 0===n?void 0:n.version;return(0,s.jsxs)(m.kC,{sx:{minWidth:"228px",borderRight:"1px dashed",borderColor:l.t.color.grey6,flexDirection:"column",paddingRight:"48px"},children:[(0,s.jsxs)(m.kC,{sx:{flexDirection:"column",borderBottom:"1px dashed",borderColor:l.t.color.grey6,paddingBottom:"28px"},children:[(0,s.jsx)(m.xv,{sx:{fontSize:"20px",fontWeight:500,lineHeight:"32px"},children:"Changelog"}),(0,s.jsx)(m.xv,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"24px",marginTop:"28px"},children:"All versions"})]}),(0,s.jsx)(m.kC,{sx:{mt:"24px",flexDirection:"column",gap:"4px",overflow:"auto"},children:i.map((e,n)=>(0,s.jsx)(S,{isSelected:(null==r?void 0:r.version)===e.version,onClick:()=>t(e),versionNumber:e.version,tags:function(e){let n=[];return e===d?n.push("LATEST"):e===c&&n.push("LATEST-NON-BREAKING"),e===x&&n.push("CURRENT"),n}(e.version),hasUpToDateVersions:!o&&!a},"versionBadge-".concat(e.version,"-").concat(n)))})]})};var N=r(951);async function w(e){return await g.managerClient.versions.getSliceMachineReleaseNotesForVersion({version:e})}var E=r(19870);let L=e=>{let{releaseNotes:n}=e;return(0,s.jsx)(m.xv,{sx:{"h1, h2, h3":{fontSize:"16px",fontWeight:600,lineHeight:"20px"},p:{fontSize:"14px",fontWeight:400,lineHeight:"20px"},b:{fontSize:"14px",fontWeight:600,lineHeight:"20px"},code:{color:"code.orange"},li:{listStyleType:"disc",marginLeft:"25px",paddingLeft:"5px"}},dangerouslySetInnerHTML:{__html:E.TU.parse(n)}})};var R=r(32554),_=r(38193);let z=e=>{let{selectedVersion:n,packageManager:r}=e,t=h(),i=(0,R.p)(),{sliceMachineUpdateAvailable:o,adapterUpdateAvailable:a}=(0,k.P)(),l=n.version===t[0].version,c=function(e,n){let r=n.join(" ");switch(e){case"bun":return"bun add --development ".concat(r);case"npm":return"npm install --save-dev ".concat(r);case"pnpm":case"pnpm@6":return"pnpm add --save-dev ".concat(r);case"yarn":case"yarn@berry":return"yarn add --dev ".concat(r)}}(r,function(e){let{sliceMachineVersionToInstall:n,isLatestSliceMachineVersion:r,adapterName:t}=e,i=["slice-machine-ui@".concat(n)];return r&&i.push("".concat(t,"@latest")),i}({sliceMachineVersionToInstall:l?"latest":n.version,isLatestSliceMachineVersion:l,adapterName:i}));return(0,s.jsxs)(s.Fragment,{children:[a&&!o&&l&&(0,s.jsxs)(m.kC,{sx:{padding:"16px",bg:"lightOrange",color:"darkOrange",fontSize:"13px",lineHeight:"24px",borderRadius:"4px",gap:"16px"},children:[(0,s.jsx)(N.CSE,{size:"24px"}),"It looks like you are using an outdated version of the adapter. Run this command to update your adapter:"]}),(0,s.jsxs)(m.kC,{sx:{flexDirection:"column",gap:"16px",padding:"16px",bg:"grey01"},children:[(0,s.jsx)(m.xv,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"20px"},children:"How to install"}),(0,s.jsxs)(m.kC,{sx:{gap:"8px"},children:[(0,s.jsx)(_.Z,{codeStyle:{color:"white",flex:1,padding:"8px"},sx:{flex:1},children:c}),(0,s.jsx)(m.zx,{variant:"secondary",onClick:()=>void navigator.clipboard.writeText(c),children:"Copy"})]})]})]})},H=e=>{let{versionKind:n}=e,r={fontSize:"14px",padding:"2px 4px",borderRadius:"4px",textTransform:"uppercase",..."MAJOR"===n?{color:"purple",bg:(0,C.DZ)("purple",.85)}:{color:"grey05",bg:"grey02"}};return(0,s.jsx)(m.xv,{sx:r,children:n})},B=()=>(0,s.jsxs)(m.kC,{sx:{paddingLeft:"32px"},children:["Could not fetch release notes."," ",(0,s.jsx)("a",{href:"https://github.com/prismicio/slice-machine/releases",target:"_blank",rel:"noopener noreferrer",children:"Find out more on GitHub"})]}),M=e=>{var n;let{selectedVersion:r,packageManager:t}=e,i=(n=r.version,(0,p.QT)(w,[n]));return(0,s.jsxs)(m.kC,{sx:{flexDirection:"column"},children:[(0,s.jsxs)(m.kC,{sx:{padding:"0px 0px 32px 32px",borderBottom:"1px dashed",borderColor:l.t.color.grey6,justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(m.xv,{sx:{fontSize:"24px",fontWeight:600,lineHeight:"32px"},children:"Version ".concat(r.version)}),!!r.kind&&(0,s.jsx)(H,{versionKind:r.kind})]}),(0,s.jsxs)(m.kC,{sx:{flexDirection:"column",padding:"24px 0px 0px 32px",gap:"24px"},children:[(null==i?void 0:i.includes("# Breaking Change"))&&(0,s.jsxs)(m.kC,{sx:{padding:"16px",bg:"lightOrange",color:"darkOrange",fontSize:"13px",lineHeight:"24px",borderRadius:"4px",gap:"16px"},"data-testid":"breaking-changes-warning",children:[(0,s.jsx)(N.CSE,{size:"24px"}),"This update includes breaking changes. To update correctly, follow the steps below."]}),(0,s.jsx)(z,{selectedVersion:r,packageManager:t}),void 0!==i?(0,s.jsx)(L,{releaseNotes:i}):(0,s.jsx)(B,{})]})]})};function A(){let{packageManager:e}=(0,x.v9)(e=>({packageManager:(0,f.Ak)(e)})),n=h(),r=n[0],[t,i]=(0,c.useState)(null!=r?r:void 0);(0,c.useEffect)(()=>{i(r)},[r]);let o=0===n.length||!t;return(0,s.jsx)(v.LN,{children:(0,s.jsx)(v.RN,{children:(0,s.jsxs)(d.xR,{sx:{display:"flex",minWidth:0},children:[(0,s.jsx)(T,{selectedVersion:t,selectVersion:e=>i(e)}),o?(0,s.jsx)(B,{}):(0,s.jsx)(l.ay,{renderError:()=>(0,s.jsx)(B,{}),children:(0,s.jsx)(c.Suspense,{fallback:(0,s.jsx)(l.bg,{}),children:(0,s.jsx)(M,{selectedVersion:t,packageManager:e})})})]})})})}function O(){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a(),{children:(0,s.jsx)("title",{children:"Changelog - Slice Machine"})}),(0,s.jsx)(A,{})]})}}},function(e){e.O(0,[898,183,870,888,774,179],function(){return e(e.s=37782)}),_N_E=e.O()}]);
|
package/out/_next/static/chunks/pages/{changes-e66094f57453cf9c.js → changes-6f371ebe52dbe76a.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[849],{21985:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changes",function(){return n(22425)}])},72641:function(e,t,n){"use strict";n.d(t,{R$:function(){return o},Qj:function(){return x},T9:function(){return d},nf:function(){return u},u2:function(){return c},_T:function(){return h}});var i=n(52322),s=n(11699),l=n(6277),r=n(83478),a=n.n(r);let o=e=>{let{backgroundImage:t,style:n,...s}=e,r=void 0!==t;return(0,i.jsx)("article",{...s,className:(0,l.W)(a().root,{[a().withBackground]:r}),style:{backgroundImage:r?"url(".concat(t,")"):void 0,...n}})},c=e=>(0,i.jsx)("div",{...e,className:a().image}),d=e=>(0,i.jsx)("div",{...e,className:a().content}),h=e=>(0,i.jsx)(s.bL,{...e,variant:"h3"}),u=e=>(0,i.jsx)(s.bL,{...e,color:"grey11"}),x=e=>(0,i.jsx)("div",{...e,className:a().actions,color:"grey"})},33986:function(e,t,n){"use strict";n.d(t,{z:function(){return o}});var i=n(52322),s=n(2784),l=n(75289);let r=(e,t)=>e?"".concat(e,"-").concat(t):"",a=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},o=(0,s.forwardRef)((e,t)=>{let{label:n,Icon:s,type:o,form:c,isLoading:d=!1,disabled:h=!1,onClick:u,sx:x={},iconSize:m=16,iconFill:g,variant:p="primary",...j}=e;return(0,i.jsx)(l.zx,{ref:t,sx:{...x,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...d?{cursor:"wait !important"}:{}},type:o,form:c,disabled:h||d,onClick:d?void 0:u,variant:p,...j,children:d?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.$j,{size:m,color:a(p),"data-testid":r(j["data-testid"],"spinner")}),s&&n]}):(0,i.jsxs)(i.Fragment,{children:[s&&(0,i.jsx)(s,{size:m,fill:g,"data-testid":r(j["data-testid"],"icon")}),n]})})})},21151:function(e,t,n){"use strict";var i=n(52322),s=n(75289);t.Z=function(e){let{elems:t,renderElem:n,defineElementKey:l,gridTemplateMinPx:r="320px",gridGap:a="16px",sx:o}=e;return(0,i.jsx)(s.xu,{as:"section",sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(r,", 1fr))"),gridGap:a,pt:2,...o},children:t.map((e,t)=>e?(0,i.jsx)("span",{children:n(e,t)},"".concat(l(e),"-").concat(t+1)):null)})}},22425:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ea}});var i=n(52322),s=n(11699),l=n(97729),r=n.n(l),a=n(5632),o=n(2784),c=n(88932),d=n(65077),h=n(94160),u=n(43388),x=n(72641);function m(e){let{isPostPush:t,documentsListEndpoint:n}=e,l=t?p:g;return(0,i.jsxs)(x.R$,{style:{alignSelf:"center",marginTop:s.t.space[72]},children:[(0,i.jsx)(x.u2,{children:(0,i.jsx)(s.a_,{src:l.img,sizing:"cover"})}),(0,i.jsxs)(x.T9,{children:[(0,i.jsx)(x._T,{children:l.title}),(0,i.jsx)(x.nf,{children:l.description}),t&&(0,i.jsx)(x.Qj,{children:(0,i.jsx)(s.E,{onClick:()=>{h.Xe.track({event:"post-push:empty-state-cta-clicked"}),window.open(n,"_blank")},size:"large",children:"Create content in the Page Builder"})})]})]})}let g={img:"/blank-slate-changes-uptodate.png",title:"Everything is up-to-date",description:"No changes are staged. Saved updates will appear here, ready to be pushed to the Page Builder."},p={img:"/blank-slate-push-success.png",title:"Success! Your changes have been pushed to the Page Builder.",description:"Add content to your website to bring it to life!"},j=(0,o.forwardRef)((e,t)=>(0,i.jsx)(s.E,{...e,ref:t,startIcon:"upload",children:"Push"}));var f=n(98250),v=n(98033),b=n(68968),y=n(13434),k=n(19468),C=n(978),w=n(30613),S=n(58446),_=n(91914),D=n(75289);let T=()=>(0,i.jsx)(D.kC,{sx:{justifyContent:"center",alignItems:"center",flex:1},children:(0,i.jsxs)(D.kC,{sx:{flexDirection:"column",alignItems:"center",transform:"translateY(-50%)"},children:[(0,i.jsx)(_.wQ1,{size:48}),(0,i.jsx)(D.xv,{sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",mb:"8px",mt:"2px",textAlign:"center"},children:"No internet connection"}),(0,i.jsx)(D.xv,{sx:{fontSize:"13px",lineHeight:"24px",textAlign:"center"},children:"Connect to the internet to sync your changes."})]})});var L=n(54597);let B=()=>{let{openLoginModal:e}=(0,L.Z)();return(0,i.jsxs)(s.D,{flexDirection:"column",height:"100%",alignItems:"center",justifyContent:"center",gap:8,children:[(0,i.jsx)(s.bL,{variant:"h3",align:"center",children:"It seems like you are logged out"}),(0,i.jsx)(s.bL,{align:"center",children:"Log in to connect to your repository."}),(0,i.jsxs)(s.bL,{align:"center",children:["If that doesn't work, it's possible that Slice Machine is having trouble accessing Prismic's servers."," ",(0,i.jsx)(s.bL,{href:"https://community.prismic.io/",children:"Contact our support team"}),"."]}),(0,i.jsx)(s.E,{onClick:()=>e(),children:"Log in to Prismic"})]})};var E=n(951),I=n(63908),O=n(87446),N=n(51507),F=n(21442);let R=e=>{let{children:t}=e;return(0,i.jsx)(D.kC,{sx:{alignItems:"center",justifyContent:"space-between",mt:"8px",bg:"grey02",borderRadius:4,padding:"12px 16px",width:"100%"},children:t})};var z=n(39097),A=n.n(z),P=n(99195),W=n(59294),H=n(16442);let X=e=>{let{ct:t,status:n,authStatus:s,isOnline:l}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D.xu,{as:"td",style:{width:"40%"},children:(0,i.jsx)(D.xv,{sx:{fontWeight:500},children:t.label})}),(0,i.jsx)(D.xu,{as:"td",style:{width:"40%"},children:t.id}),(0,i.jsx)(D.xu,{as:"td",style:{width:"20%"},children:(0,i.jsx)(P.O,{authStatus:s,isOnline:l,modelStatus:n,modelType:"CustomType"})})]})},Z=e=>{let{customTypes:t,modelsStatuses:n,authStatus:s,isOnline:l}=e;return(0,i.jsxs)(D.xu,{as:"table","data-legacy-component":!0,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:"transparent small",children:[(0,i.jsx)(D.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"Name"}),(0,i.jsx)(D.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"API ID"}),(0,i.jsx)(D.xu,{as:"th",sx:{width:"20%",fontWeight:600},children:"Status"})]})}),(0,i.jsx)("tbody",{children:t.map(e=>(0,H.TG)(e)?(0,i.jsx)(A(),{passHref:!0,href:W.cd[e.local.format].getBuilderPagePathname(e.local.id),legacyBehavior:!0,children:(0,i.jsx)("tr",{tabIndex:0,"data-testid":"custom-type-".concat(e.local.id),children:(0,i.jsx)(X,{ct:e.local,status:n.customTypes[e.local.id],authStatus:s,isOnline:l},e.local.id)})},e.local.id):(0,i.jsx)("tr",{tabIndex:0,className:"disabled","data-testid":"custom-type-".concat(e.remote.id),children:(0,i.jsx)(X,{ct:e.remote,status:n.customTypes[e.remote.id],authStatus:s,isOnline:l},e.remote.id)},e.remote.id))})]})};var G=n(21151),M=n(86652),U=n(56448),Y=n(96317);function Q(){let e=(0,Y.L)("slicemachine-dev-collaboration"),[t,n]=(0,o.useState)(!1),l=null==e?void 0:e.payload;return((0,o.useEffect)(()=>{(null==e?void 0:e.value)==="on"&&void 0!==l&&h.Xe.track({event:"dev-collab:workflow-stub-displayed"})},[e,l]),(null==e?void 0:e.value)!=="on"||void 0===l)?null:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.D,{alignItems:"flex-start",border:{bottom:!0,left:!0,right:!0,top:!0},borderRadius:6,borderStyle:"dashed",flexDirection:"column",flexShrink:0,gap:8,padding:16,width:320,children:[(0,i.jsxs)(s.D,{flexDirection:"column",gap:2,children:[(0,i.jsx)(s.bL,{variant:"smallBold",children:l.cardTitle}),(0,i.jsx)(s.bL,{color:"grey11",variant:"small",children:l.cardDescription})]}),(0,i.jsx)(s.E,{color:"grey",onClick:()=>{h.Xe.track({event:"dev-collab:set-up-workflow-opened"}),n(!0)},children:l.cardButtonLabel})]}),(0,i.jsxs)(s.ae,{onOpenChange:e=>{e||n(!1)},open:t,size:{height:"auto",width:448},children:[(0,i.jsx)(s.al,{title:l.dialogTitle}),(0,i.jsx)(s.aj,{children:(0,i.jsxs)(s.D,{flexDirection:"column",children:[(0,i.jsx)(s.D,{flexDirection:"column",padding:16,children:(0,i.jsx)(s.bL,{children:l.dialogDescription})}),(0,i.jsxs)(s.ah,{children:[(0,i.jsx)(s.ai,{size:"medium"}),(0,i.jsx)(s.af,{size:"medium",onClick:()=>{h.Xe.track({event:"dev-collab:join-beta-clicked"}),window.open(l.dialogButtonLink,"_blank"),n(!1)},children:l.dialogButtonLabel})]})]})})]})]})}let J=e=>{let{unSyncedCustomTypes:t,unSyncedSlices:n,modelsStatuses:l,authStatus:r,isOnline:a}=e,{modalPayload:c,onOpenModal:d}=(0,F.H)(),{sliceFilterFn:h,defaultVariationSelector:u}=c,x=n.filter(e=>l.slices[e.model.id]!==U.GJ.Deleted);return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(s.D,{gap:16,alignItems:"flex-start",children:[(0,i.jsxs)(s.D,{flexDirection:"column",flexGrow:1,children:[t.length>0&&(0,i.jsxs)(s.D,{flexDirection:"column",children:[(0,i.jsx)(R,{children:(0,i.jsxs)(s.D,{children:[(0,i.jsx)(s.bL,{variant:"h5",children:"Types"}),(0,i.jsx)(s.bL,{variant:"h5",sx:{marginLeft:8},children:t.length})]})}),(0,i.jsx)(Z,{customTypes:t,modelsStatuses:l,authStatus:r,isOnline:a})]}),n.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.D,{padding:{bottom:8},children:(0,i.jsxs)(R,{children:[(0,i.jsxs)(s.D,{children:[(0,i.jsx)(s.bL,{variant:"h5",children:"Slices"}),(0,i.jsx)(s.bL,{variant:"h5",sx:{marginLeft:8},children:n.length})]}),(0,i.jsxs)(s.D,{children:[n.some(e=>(0,I.cx)(e)>0&&l.slices[e.model.id]!==U.GJ.Deleted)&&(0,i.jsxs)(s.bL,{color:"amber11",sx:{marginRight:8,alignSelf:"center"},children:[(0,i.jsx)(E.sQg,{size:16,style:{marginRight:"4px",position:"relative",top:"3px"}}),"Missing Screenshots"]}),(0,i.jsx)(s.E,{color:"dark",startIcon:"photoCamera",onClick:()=>d({sliceFilterFn:e=>e}),children:"Update all screenshots"})]})]})}),(0,i.jsx)(G.Z,{gridGap:"32px 16px",elems:n,gridTemplateMinPx:"305px",defineElementKey:e=>e.model.name,renderElem:e=>{let t=l.slices[e.model.id];return(0,i.jsx)(N.b,{action:{type:"status",authStatus:r,isOnline:a,modelStatus:t},isDeleted:t===U.GJ.Deleted,mode:"navigation",onUpdateScreenshot:()=>{d({sliceFilterFn:t=>t.filter(t=>t.model.id===e.model.id)})},slice:e,variant:"solid"})}}),(0,i.jsx)(M.Z,{slices:h(x),defaultVariationSelector:u})]})]}),(0,i.jsx)(O.h,{children:(0,i.jsx)(o.Suspense,{children:(0,i.jsx)(Q,{})})})]})})};var $=n(56580),q=n(33986),K=n(79797),V=n(30527);let ee=e=>{let{isOpen:t,title:n,footer:s,explanations:l,onClose:r}=e;return(0,i.jsx)(K.Z,{placement:"right",open:t,level:null,onClose:r,width:496,children:(0,i.jsx)(V.Z,{radius:"0px",bodySx:{bg:"white",padding:24,flex:1,display:"flex",flexDirection:"column",overflow:"scroll"},footerSx:{p:0},sx:{flexDirection:"column",display:"flex",height:"100%",border:"none"},borderFooter:!0,Header:(0,i.jsxs)(D.kC,{sx:{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.jsx)(D.kC,{sx:{alignItems:"center"},children:(0,i.jsx)(D.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:n})}),(0,i.jsx)(D.x8,{type:"button",onClick:()=>r()})]}),Footer:()=>(0,i.jsx)(D.kC,{sx:{flexDirection:"column",justifyContent:"center",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:"white",padding:20},children:s}),children:l})})};var et=n(78254);n(98564);let en=e=>{let{ctName:t,numberOfDocuments:n,link:s,isOverLimit:l=!1}=e;return(0,i.jsxs)(D.Zb,{sx:{mb:12},variant:"drawerCard","data-testid":"AssociatedDocumentsCard-".concat(t),children:[(0,i.jsxs)(D.kC,{sx:{flexDirection:"column"},children:[(0,i.jsx)(D.xv,{children:t}),(0,i.jsxs)(D.xv,{sx:{color:"textClear",fontSize:"12px",lineHeight:"16px"},children:[n," documents"]})]}),(0,i.jsx)(D.rU,{href:s,target:"_blank",variant:"cardSmall",sx:{color:l?"danger":"purple08"},children:"View documents"})]})},ei=e=>{let{pushChanges:t,modalData:n,onClose:s}=e,{remoteOnlyCustomTypes:l}=(0,$.v9)(e=>({remoteOnlyCustomTypes:(0,et.Ch)(e).filter(H.yp)}));if((null==n?void 0:n.type)!=="HARD")return null;let r=n.details.customTypes.map(e=>{var t;let n=l.find(t=>(0,H.n5)(t)===e.id);return void 0===n?null:(0,i.jsx)(en,{isOverLimit:!0,ctName:null!==(t=n.remote.label)&&void 0!==t?t:n.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,i.jsx)(ee,{isOpen:"HARD"===n.type,title:"Manual action required",onClose:s,footer:(0,i.jsx)(q.z,{label:"Try again",variant:"primary",onClick:()=>{t(!1)},sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}}),explanations:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(D.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:["Your type",n.details.customTypes.length>1&&"s"," cannot be deleted."]}),(0,i.jsxs)(D.xv,{sx:{mb:24},children:[n.details.customTypes.length>1?"These types have":"This type has"," ","too many associated Documents. Archive and delete these Documents manually and then try deleting the types again."]}),r]})})},es=e=>{let{onToggle:t,isConfirmed:n,sx:s}=e;return(0,i.jsxs)(D.kC,{sx:{borderRadius:6,flexDirection:"column",backgroundColor:"grey03",padding:12,width:"100%",...s},children:[(0,i.jsx)(D.xv,{sx:{fontWeight:"bold",mb:2},children:"Are you sure to proceed?"}),(0,i.jsxs)(D.__,{sx:{mt:"4px",py:1},variant:"large",children:[(0,i.jsx)(D.XZ,{defaultChecked:n,onChange:t,variant:"forms.checkbox.dark"}),"Delete these Documents"]})]})},el=e=>{let{pushChanges:t,modalData:n,onClose:s}=e,[l,r]=(0,o.useState)(!1),{remoteOnlyCustomTypes:a}=(0,$.v9)(e=>({remoteOnlyCustomTypes:(0,et.Ch)(e).filter(H.yp)}));if((null==n?void 0:n.type)!=="SOFT")return null;let c=n.details.customTypes.map(e=>{var t;let n=a.find(t=>(0,H.n5)(t)===e.id);return void 0===n?null:(0,i.jsx)(en,{isOverLimit:!0,ctName:null!==(t=n.remote.label)&&void 0!==t?t:n.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,i.jsx)(ee,{isOpen:"SOFT"===n.type,title:"Confirm deletion",onClose:s,footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(es,{onToggle:()=>{r(!l)},isConfirmed:l,sx:{mb:10}}),(0,i.jsx)(q.z,{label:"Push changes",variant:"primary",onClick:()=>{t(l)},disabled:!l,sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}})]}),explanations:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:"This action will also delete Documents."}),(0,i.jsxs)(D.xv,{sx:{mb:24},children:[n.details.customTypes.length>1?"These types have":"This type has"," ","associated Documents, which will also be deleted. This might create broken links in your repository."]}),c]})})};var er=n(93671),ea=()=>{let{unSyncedSlices:e,unSyncedCustomTypes:t,changedCustomTypes:n,changedSlices:l,modelsStatuses:x}=(0,y.X)(),g=(0,C.L)(),p=(0,k.n)(),{pushChangesSuccess:_,refreshState:D}=(0,L.Z)(),[E,I]=(0,o.useState)(!1),[O,N]=(0,o.useState)(void 0),{autoSyncStatus:F}=(0,b.g)(),R=(0,a.useRouter)(),[z,A]=(0,o.useState)(!1),[P,W]=(0,o.useState)(!1),{repositoryUrl:H}=(0,w.U)(),{completeStep:X}=(0,f.k)(),Z=e.length+t.length;(0,o.useEffect)(()=>{("synced"===F||"failed"===F||"syncing"===F)&&R.push("/")},[F,R]);let G=async e=>{try{I(!0),N(void 0);let t=await (0,v.t)({confirmDeleteDocuments:e,changedCustomTypes:n,changedSlices:l});if(void 0!==t)N(t);else{let e=await (0,h.y0)();D(e),_(),A(!0),W(!0),X("reviewAndPush")}}catch(e){console.error("Something went wrong when manually pushing your changes",e),c.Am.error("Something went wrong when pushing your changes. Check your terminal logs.")}I(!1)},M=(0,o.useMemo)(()=>g?p===er.t.UNAUTHENTICATED?(0,i.jsx)(B,{}):0===Z?(0,i.jsx)(m,{isPostPush:z,documentsListEndpoint:H}):(0,i.jsx)(J,{unSyncedSlices:e,unSyncedCustomTypes:t,modelsStatuses:x,authStatus:p,isOnline:g}):(0,i.jsx)(T,{}),[g,p,Z,e,t,x,z,H]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r(),{children:(0,i.jsx)("title",{children:"Changes - Slice Machine"})}),(0,i.jsxs)(S.LN,{children:[(0,i.jsxs)(S.wd,{children:[(0,i.jsx)(S.Cx,{children:(0,i.jsx)(u.g,{children:"Changes"})}),(0,i.jsxs)(S.K2,{children:[(0,i.jsx)(j,{disabled:0===Z||!g||p!==er.t.AUTHENTICATED||E,loading:E,onClick:()=>{G(!1)}}),(0,i.jsx)(s.bQ,{anchor:(0,i.jsx)(s.D,{position:"fixed",top:32,right:32,width:322}),open:P,variant:"card",seconds:20,title:"Success! \uD83C\uDF89",subtitle:"Your changes have been pushed.",action:{title:"Create content in the Page Builder",onClick:()=>{h.Xe.track({event:"post-push:toast-cta-clicked"}),window.open(H,"_blank")}},cancel:{onClick:()=>W(!1)},onOpenChange:W})]})]}),(0,i.jsx)(S.RN,{children:(0,i.jsxs)(d.xR,{sx:{display:"flex",flexDirection:"column"},children:[M,(0,i.jsx)(el,{pushChanges:e=>void G(e),modalData:O,onClose:()=>N(void 0)}),(0,i.jsx)(ei,{pushChanges:e=>void G(e),modalData:O,onClose:()=>N(void 0)})]})})]})]})}},83478:function(e){e.exports={column:"BlankSlate_column__genEe",root:"BlankSlate_root__CmSqW BlankSlate_column__genEe",fadeIn:"BlankSlate_fadeIn__mAfi5",withBackground:"BlankSlate_withBackground__mLYij",image:"BlankSlate_image__Jn90S BlankSlate_column__genEe",content:"BlankSlate_content__0Yt2d BlankSlate_column__genEe",desc:"BlankSlate_desc___Dl7e",actions:"BlankSlate_actions__OYRj4"}}},function(e){e.O(0,[898,789,123,66,125,882,593,888,774,179],function(){return e(e.s=21985)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[849],{21985:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changes",function(){return n(22425)}])},72641:function(e,t,n){"use strict";n.d(t,{R$:function(){return o},Qj:function(){return x},T9:function(){return d},nf:function(){return u},u2:function(){return c},_T:function(){return h}});var i=n(52322),s=n(18337),l=n(6277),r=n(83478),a=n.n(r);let o=e=>{let{backgroundImage:t,style:n,...s}=e,r=void 0!==t;return(0,i.jsx)("article",{...s,className:(0,l.W)(a().root,{[a().withBackground]:r}),style:{backgroundImage:r?"url(".concat(t,")"):void 0,...n}})},c=e=>(0,i.jsx)("div",{...e,className:a().image}),d=e=>(0,i.jsx)("div",{...e,className:a().content}),h=e=>(0,i.jsx)(s.bL,{...e,variant:"h3"}),u=e=>(0,i.jsx)(s.bL,{...e,color:"grey11"}),x=e=>(0,i.jsx)("div",{...e,className:a().actions,color:"grey"})},33986:function(e,t,n){"use strict";n.d(t,{z:function(){return o}});var i=n(52322),s=n(2784),l=n(75289);let r=(e,t)=>e?"".concat(e,"-").concat(t):"",a=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},o=(0,s.forwardRef)((e,t)=>{let{label:n,Icon:s,type:o,form:c,isLoading:d=!1,disabled:h=!1,onClick:u,sx:x={},iconSize:m=16,iconFill:g,variant:p="primary",...j}=e;return(0,i.jsx)(l.zx,{ref:t,sx:{...x,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...d?{cursor:"wait !important"}:{}},type:o,form:c,disabled:h||d,onClick:d?void 0:u,variant:p,...j,children:d?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.$j,{size:m,color:a(p),"data-testid":r(j["data-testid"],"spinner")}),s&&n]}):(0,i.jsxs)(i.Fragment,{children:[s&&(0,i.jsx)(s,{size:m,fill:g,"data-testid":r(j["data-testid"],"icon")}),n]})})})},21151:function(e,t,n){"use strict";var i=n(52322),s=n(75289);t.Z=function(e){let{elems:t,renderElem:n,defineElementKey:l,gridTemplateMinPx:r="320px",gridGap:a="16px",sx:o}=e;return(0,i.jsx)(s.xu,{as:"section",sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(r,", 1fr))"),gridGap:a,pt:2,...o},children:t.map((e,t)=>e?(0,i.jsx)("span",{children:n(e,t)},"".concat(l(e),"-").concat(t+1)):null)})}},22425:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ea}});var i=n(52322),s=n(18337),l=n(97729),r=n.n(l),a=n(5632),o=n(2784),c=n(88932),d=n(65077),h=n(94160),u=n(43388),x=n(72641);function m(e){let{isPostPush:t,documentsListEndpoint:n}=e,l=t?p:g;return(0,i.jsxs)(x.R$,{style:{alignSelf:"center",marginTop:s.t.space[72]},children:[(0,i.jsx)(x.u2,{children:(0,i.jsx)(s.a_,{src:l.img,sizing:"cover"})}),(0,i.jsxs)(x.T9,{children:[(0,i.jsx)(x._T,{children:l.title}),(0,i.jsx)(x.nf,{children:l.description}),t&&(0,i.jsx)(x.Qj,{children:(0,i.jsx)(s.E,{onClick:()=>{h.Xe.track({event:"post-push:empty-state-cta-clicked"}),window.open(n,"_blank")},size:"large",children:"Create content in the Page Builder"})})]})]})}let g={img:"/blank-slate-changes-uptodate.png",title:"Everything is up-to-date",description:"No changes are staged. Saved updates will appear here, ready to be pushed to the Page Builder."},p={img:"/blank-slate-push-success.png",title:"Success! Your changes have been pushed to the Page Builder.",description:"Add content to your website to bring it to life!"},j=(0,o.forwardRef)((e,t)=>(0,i.jsx)(s.E,{...e,ref:t,startIcon:"upload",children:"Push"}));var f=n(98250),v=n(98033),b=n(68968),y=n(13434),k=n(19468),C=n(978),w=n(30613),S=n(58446),_=n(91914),D=n(75289);let T=()=>(0,i.jsx)(D.kC,{sx:{justifyContent:"center",alignItems:"center",flex:1},children:(0,i.jsxs)(D.kC,{sx:{flexDirection:"column",alignItems:"center",transform:"translateY(-50%)"},children:[(0,i.jsx)(_.wQ1,{size:48}),(0,i.jsx)(D.xv,{sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",mb:"8px",mt:"2px",textAlign:"center"},children:"No internet connection"}),(0,i.jsx)(D.xv,{sx:{fontSize:"13px",lineHeight:"24px",textAlign:"center"},children:"Connect to the internet to sync your changes."})]})});var L=n(54597);let B=()=>{let{openLoginModal:e}=(0,L.Z)();return(0,i.jsxs)(s.D,{flexDirection:"column",height:"100%",alignItems:"center",justifyContent:"center",gap:8,children:[(0,i.jsx)(s.bL,{variant:"h3",align:"center",children:"It seems like you are logged out"}),(0,i.jsx)(s.bL,{align:"center",children:"Log in to connect to your repository."}),(0,i.jsxs)(s.bL,{align:"center",children:["If that doesn't work, it's possible that Slice Machine is having trouble accessing Prismic's servers."," ",(0,i.jsx)(s.bL,{href:"https://community.prismic.io/",children:"Contact our support team"}),"."]}),(0,i.jsx)(s.E,{onClick:()=>e(),children:"Log in to Prismic"})]})};var E=n(951),I=n(63908),O=n(87446),N=n(51507),F=n(21442);let R=e=>{let{children:t}=e;return(0,i.jsx)(D.kC,{sx:{alignItems:"center",justifyContent:"space-between",mt:"8px",bg:"grey02",borderRadius:4,padding:"12px 16px",width:"100%"},children:t})};var z=n(39097),A=n.n(z),P=n(99195),W=n(59294),H=n(16442);let X=e=>{let{ct:t,status:n,authStatus:s,isOnline:l}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D.xu,{as:"td",style:{width:"40%"},children:(0,i.jsx)(D.xv,{sx:{fontWeight:500},children:t.label})}),(0,i.jsx)(D.xu,{as:"td",style:{width:"40%"},children:t.id}),(0,i.jsx)(D.xu,{as:"td",style:{width:"20%"},children:(0,i.jsx)(P.O,{authStatus:s,isOnline:l,modelStatus:n,modelType:"CustomType"})})]})},Z=e=>{let{customTypes:t,modelsStatuses:n,authStatus:s,isOnline:l}=e;return(0,i.jsxs)(D.xu,{as:"table","data-legacy-component":!0,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:"transparent small",children:[(0,i.jsx)(D.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"Name"}),(0,i.jsx)(D.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"API ID"}),(0,i.jsx)(D.xu,{as:"th",sx:{width:"20%",fontWeight:600},children:"Status"})]})}),(0,i.jsx)("tbody",{children:t.map(e=>(0,H.TG)(e)?(0,i.jsx)(A(),{passHref:!0,href:W.cd[e.local.format].getBuilderPagePathname(e.local.id),legacyBehavior:!0,children:(0,i.jsx)("tr",{tabIndex:0,"data-testid":"custom-type-".concat(e.local.id),children:(0,i.jsx)(X,{ct:e.local,status:n.customTypes[e.local.id],authStatus:s,isOnline:l},e.local.id)})},e.local.id):(0,i.jsx)("tr",{tabIndex:0,className:"disabled","data-testid":"custom-type-".concat(e.remote.id),children:(0,i.jsx)(X,{ct:e.remote,status:n.customTypes[e.remote.id],authStatus:s,isOnline:l},e.remote.id)},e.remote.id))})]})};var G=n(21151),M=n(86652),U=n(56448),Y=n(96317);function Q(){let e=(0,Y.L)("slicemachine-dev-collaboration"),[t,n]=(0,o.useState)(!1),l=null==e?void 0:e.payload;return((0,o.useEffect)(()=>{(null==e?void 0:e.value)==="on"&&void 0!==l&&h.Xe.track({event:"dev-collab:workflow-stub-displayed"})},[e,l]),(null==e?void 0:e.value)!=="on"||void 0===l)?null:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.D,{alignItems:"flex-start",border:{bottom:!0,left:!0,right:!0,top:!0},borderRadius:6,borderStyle:"dashed",flexDirection:"column",flexShrink:0,gap:8,padding:16,width:320,children:[(0,i.jsxs)(s.D,{flexDirection:"column",gap:2,children:[(0,i.jsx)(s.bL,{variant:"smallBold",children:l.cardTitle}),(0,i.jsx)(s.bL,{color:"grey11",variant:"small",children:l.cardDescription})]}),(0,i.jsx)(s.E,{color:"grey",onClick:()=>{h.Xe.track({event:"dev-collab:set-up-workflow-opened"}),n(!0)},children:l.cardButtonLabel})]}),(0,i.jsxs)(s.ae,{onOpenChange:e=>{e||n(!1)},open:t,size:{height:"auto",width:448},children:[(0,i.jsx)(s.al,{title:l.dialogTitle}),(0,i.jsx)(s.aj,{children:(0,i.jsxs)(s.D,{flexDirection:"column",children:[(0,i.jsx)(s.D,{flexDirection:"column",padding:16,children:(0,i.jsx)(s.bL,{children:l.dialogDescription})}),(0,i.jsxs)(s.ah,{children:[(0,i.jsx)(s.ai,{size:"medium"}),(0,i.jsx)(s.af,{size:"medium",onClick:()=>{h.Xe.track({event:"dev-collab:join-beta-clicked"}),window.open(l.dialogButtonLink,"_blank"),n(!1)},children:l.dialogButtonLabel})]})]})})]})]})}let J=e=>{let{unSyncedCustomTypes:t,unSyncedSlices:n,modelsStatuses:l,authStatus:r,isOnline:a}=e,{modalPayload:c,onOpenModal:d}=(0,F.H)(),{sliceFilterFn:h,defaultVariationSelector:u}=c,x=n.filter(e=>l.slices[e.model.id]!==U.GJ.Deleted);return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(s.D,{gap:16,alignItems:"flex-start",children:[(0,i.jsxs)(s.D,{flexDirection:"column",flexGrow:1,children:[t.length>0&&(0,i.jsxs)(s.D,{flexDirection:"column",children:[(0,i.jsx)(R,{children:(0,i.jsxs)(s.D,{children:[(0,i.jsx)(s.bL,{variant:"h5",children:"Types"}),(0,i.jsx)(s.bL,{variant:"h5",sx:{marginLeft:8},children:t.length})]})}),(0,i.jsx)(Z,{customTypes:t,modelsStatuses:l,authStatus:r,isOnline:a})]}),n.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.D,{padding:{bottom:8},children:(0,i.jsxs)(R,{children:[(0,i.jsxs)(s.D,{children:[(0,i.jsx)(s.bL,{variant:"h5",children:"Slices"}),(0,i.jsx)(s.bL,{variant:"h5",sx:{marginLeft:8},children:n.length})]}),(0,i.jsxs)(s.D,{children:[n.some(e=>(0,I.cx)(e)>0&&l.slices[e.model.id]!==U.GJ.Deleted)&&(0,i.jsxs)(s.bL,{color:"amber11",sx:{marginRight:8,alignSelf:"center"},children:[(0,i.jsx)(E.sQg,{size:16,style:{marginRight:"4px",position:"relative",top:"3px"}}),"Missing Screenshots"]}),(0,i.jsx)(s.E,{color:"dark",startIcon:"photoCamera",onClick:()=>d({sliceFilterFn:e=>e}),children:"Update all screenshots"})]})]})}),(0,i.jsx)(G.Z,{gridGap:"32px 16px",elems:n,gridTemplateMinPx:"305px",defineElementKey:e=>e.model.name,renderElem:e=>{let t=l.slices[e.model.id];return(0,i.jsx)(N.b,{action:{type:"status",authStatus:r,isOnline:a,modelStatus:t},isDeleted:t===U.GJ.Deleted,mode:"navigation",onUpdateScreenshot:()=>{d({sliceFilterFn:t=>t.filter(t=>t.model.id===e.model.id)})},slice:e,variant:"solid"})}}),(0,i.jsx)(M.Z,{slices:h(x),defaultVariationSelector:u})]})]}),(0,i.jsx)(O.h,{children:(0,i.jsx)(o.Suspense,{children:(0,i.jsx)(Q,{})})})]})})};var $=n(56580),q=n(33986),K=n(79797),V=n(30527);let ee=e=>{let{isOpen:t,title:n,footer:s,explanations:l,onClose:r}=e;return(0,i.jsx)(K.Z,{placement:"right",open:t,level:null,onClose:r,width:496,children:(0,i.jsx)(V.Z,{radius:"0px",bodySx:{bg:"white",padding:24,flex:1,display:"flex",flexDirection:"column",overflow:"scroll"},footerSx:{p:0},sx:{flexDirection:"column",display:"flex",height:"100%",border:"none"},borderFooter:!0,Header:(0,i.jsxs)(D.kC,{sx:{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.jsx)(D.kC,{sx:{alignItems:"center"},children:(0,i.jsx)(D.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:n})}),(0,i.jsx)(D.x8,{type:"button",onClick:()=>r()})]}),Footer:()=>(0,i.jsx)(D.kC,{sx:{flexDirection:"column",justifyContent:"center",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:"white",padding:20},children:s}),children:l})})};var et=n(78254);n(98564);let en=e=>{let{ctName:t,numberOfDocuments:n,link:s,isOverLimit:l=!1}=e;return(0,i.jsxs)(D.Zb,{sx:{mb:12},variant:"drawerCard","data-testid":"AssociatedDocumentsCard-".concat(t),children:[(0,i.jsxs)(D.kC,{sx:{flexDirection:"column"},children:[(0,i.jsx)(D.xv,{children:t}),(0,i.jsxs)(D.xv,{sx:{color:"textClear",fontSize:"12px",lineHeight:"16px"},children:[n," documents"]})]}),(0,i.jsx)(D.rU,{href:s,target:"_blank",variant:"cardSmall",sx:{color:l?"danger":"purple08"},children:"View documents"})]})},ei=e=>{let{pushChanges:t,modalData:n,onClose:s}=e,{remoteOnlyCustomTypes:l}=(0,$.v9)(e=>({remoteOnlyCustomTypes:(0,et.Ch)(e).filter(H.yp)}));if((null==n?void 0:n.type)!=="HARD")return null;let r=n.details.customTypes.map(e=>{var t;let n=l.find(t=>(0,H.n5)(t)===e.id);return void 0===n?null:(0,i.jsx)(en,{isOverLimit:!0,ctName:null!==(t=n.remote.label)&&void 0!==t?t:n.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,i.jsx)(ee,{isOpen:"HARD"===n.type,title:"Manual action required",onClose:s,footer:(0,i.jsx)(q.z,{label:"Try again",variant:"primary",onClick:()=>{t(!1)},sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}}),explanations:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(D.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:["Your type",n.details.customTypes.length>1&&"s"," cannot be deleted."]}),(0,i.jsxs)(D.xv,{sx:{mb:24},children:[n.details.customTypes.length>1?"These types have":"This type has"," ","too many associated Documents. Archive and delete these Documents manually and then try deleting the types again."]}),r]})})},es=e=>{let{onToggle:t,isConfirmed:n,sx:s}=e;return(0,i.jsxs)(D.kC,{sx:{borderRadius:6,flexDirection:"column",backgroundColor:"grey03",padding:12,width:"100%",...s},children:[(0,i.jsx)(D.xv,{sx:{fontWeight:"bold",mb:2},children:"Are you sure to proceed?"}),(0,i.jsxs)(D.__,{sx:{mt:"4px",py:1},variant:"large",children:[(0,i.jsx)(D.XZ,{defaultChecked:n,onChange:t,variant:"forms.checkbox.dark"}),"Delete these Documents"]})]})},el=e=>{let{pushChanges:t,modalData:n,onClose:s}=e,[l,r]=(0,o.useState)(!1),{remoteOnlyCustomTypes:a}=(0,$.v9)(e=>({remoteOnlyCustomTypes:(0,et.Ch)(e).filter(H.yp)}));if((null==n?void 0:n.type)!=="SOFT")return null;let c=n.details.customTypes.map(e=>{var t;let n=a.find(t=>(0,H.n5)(t)===e.id);return void 0===n?null:(0,i.jsx)(en,{isOverLimit:!0,ctName:null!==(t=n.remote.label)&&void 0!==t?t:n.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,i.jsx)(ee,{isOpen:"SOFT"===n.type,title:"Confirm deletion",onClose:s,footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(es,{onToggle:()=>{r(!l)},isConfirmed:l,sx:{mb:10}}),(0,i.jsx)(q.z,{label:"Push changes",variant:"primary",onClick:()=>{t(l)},disabled:!l,sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}})]}),explanations:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:"This action will also delete Documents."}),(0,i.jsxs)(D.xv,{sx:{mb:24},children:[n.details.customTypes.length>1?"These types have":"This type has"," ","associated Documents, which will also be deleted. This might create broken links in your repository."]}),c]})})};var er=n(93671),ea=()=>{let{unSyncedSlices:e,unSyncedCustomTypes:t,changedCustomTypes:n,changedSlices:l,modelsStatuses:x}=(0,y.X)(),g=(0,C.L)(),p=(0,k.n)(),{pushChangesSuccess:_,refreshState:D}=(0,L.Z)(),[E,I]=(0,o.useState)(!1),[O,N]=(0,o.useState)(void 0),{autoSyncStatus:F}=(0,b.g)(),R=(0,a.useRouter)(),[z,A]=(0,o.useState)(!1),[P,W]=(0,o.useState)(!1),{repositoryUrl:H}=(0,w.U)(),{completeStep:X}=(0,f.k)(),Z=e.length+t.length;(0,o.useEffect)(()=>{("synced"===F||"failed"===F||"syncing"===F)&&R.push("/")},[F,R]);let G=async e=>{try{I(!0),N(void 0);let t=await (0,v.t)({confirmDeleteDocuments:e,changedCustomTypes:n,changedSlices:l});if(void 0!==t)N(t);else{let e=await (0,h.y0)();D(e),_(),A(!0),W(!0),X("reviewAndPush")}}catch(e){console.error("Something went wrong when manually pushing your changes",e),c.Am.error("Something went wrong when pushing your changes. Check your terminal logs.")}I(!1)},M=(0,o.useMemo)(()=>g?p===er.t.UNAUTHENTICATED?(0,i.jsx)(B,{}):0===Z?(0,i.jsx)(m,{isPostPush:z,documentsListEndpoint:H}):(0,i.jsx)(J,{unSyncedSlices:e,unSyncedCustomTypes:t,modelsStatuses:x,authStatus:p,isOnline:g}):(0,i.jsx)(T,{}),[g,p,Z,e,t,x,z,H]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r(),{children:(0,i.jsx)("title",{children:"Changes - Slice Machine"})}),(0,i.jsxs)(S.LN,{children:[(0,i.jsxs)(S.wd,{children:[(0,i.jsx)(S.Cx,{children:(0,i.jsx)(u.g,{children:"Changes"})}),(0,i.jsxs)(S.K2,{children:[(0,i.jsx)(j,{disabled:0===Z||!g||p!==er.t.AUTHENTICATED||E,loading:E,onClick:()=>{G(!1)}}),(0,i.jsx)(s.bQ,{anchor:(0,i.jsx)(s.D,{position:"fixed",top:32,right:32,width:322}),open:P,variant:"card",seconds:20,title:"Success! \uD83C\uDF89",subtitle:"Your changes have been pushed.",action:{title:"Create content in the Page Builder",onClick:()=>{h.Xe.track({event:"post-push:toast-cta-clicked"}),window.open(H,"_blank")}},cancel:{onClick:()=>W(!1)},onOpenChange:W})]})]}),(0,i.jsx)(S.RN,{children:(0,i.jsxs)(d.xR,{sx:{display:"flex",flexDirection:"column"},children:[M,(0,i.jsx)(el,{pushChanges:e=>void G(e),modalData:O,onClose:()=>N(void 0)}),(0,i.jsx)(ei,{pushChanges:e=>void G(e),modalData:O,onClose:()=>N(void 0)})]})})]})]})}},83478:function(e){e.exports={column:"BlankSlate_column__genEe",root:"BlankSlate_root__CmSqW BlankSlate_column__genEe",fadeIn:"BlankSlate_fadeIn__mAfi5",withBackground:"BlankSlate_withBackground__mLYij",image:"BlankSlate_image__Jn90S BlankSlate_column__genEe",content:"BlankSlate_content__0Yt2d BlankSlate_column__genEe",desc:"BlankSlate_desc___Dl7e",actions:"BlankSlate_actions__OYRj4"}}},function(e){e.O(0,[898,789,123,66,125,882,593,888,774,179],function(){return e(e.s=21985)}),_N_E=e.O()}]);
|
|
@@ -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(
|
|
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(10660)}},function(n){n.O(0,[898,917,525,461,139,397,66,183,344,256,130,21,882,647,630,633,660,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([[274],{41535:function(e,n,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/labs",function(){return i(69560)}])},84879:function(e,n,i){"use strict";i.d(n,{E:function(){return s}});var r=i(18566),a=i(80148);async function l(){return a.managerClient.project.getSliceMachineConfig()}function s(e){var n,i;let[s,t]=[(0,r.QT)(l,[]),async e=>{await a.managerClient.project.writeSliceMachineConfig({config:e}),(0,r.VA)(l,[],e)}],c=async n=>{let i={...s,labs:{...s.labs}};n?i.labs[e]=n:e in i.labs&&delete i.labs[e],0===Object.keys(i.labs).length&&delete i.labs,await t(i)};return[{enabled:null!==(i=null==s?void 0:null===(n=s.labs)||void 0===n?void 0:n[e])&&void 0!==i&&i},c]}},69560:function(e,n,i){"use strict";i.r(n),i.d(n,{default:function(){return x}});var r=i(52322),a=i(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[274],{41535:function(e,n,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/labs",function(){return i(69560)}])},84879:function(e,n,i){"use strict";i.d(n,{E:function(){return s}});var r=i(18566),a=i(80148);async function l(){return a.managerClient.project.getSliceMachineConfig()}function s(e){var n,i;let[s,t]=[(0,r.QT)(l,[]),async e=>{await a.managerClient.project.writeSliceMachineConfig({config:e}),(0,r.VA)(l,[],e)}],c=async n=>{let i={...s,labs:{...s.labs}};n?i.labs[e]=n:e in i.labs&&delete i.labs[e],0===Object.keys(i.labs).length&&delete i.labs,await t(i)};return[{enabled:null!==(i=null==s?void 0:null===(n=s.labs)||void 0===n?void 0:n[e])&&void 0!==i&&i},c]}},69560:function(e,n,i){"use strict";i.r(n),i.d(n,{default:function(){return x}});var r=i(52322),a=i(18337),l=i(97729),s=i.n(l),t=i(2784),c=i(43388),o=i(87446),d=i(58446),h=i(88932);let u=e=>{let{title:n,enabled:i,onToggle:l,children:s}=e;return(0,r.jsx)(a.G,{variant:"outlined",children:(0,r.jsxs)(a.D,{gap:8,padding:16,children:[(0,r.jsx)(a.D,{padding:{top:6},children:(0,r.jsx)(a.aX,{name:"viewDay",size:"medium",color:"grey11"})}),(0,r.jsxs)(a.D,{flexDirection:"column",flexGrow:1,children:[(0,r.jsx)(a.bL,{variant:"h3",children:n}),(0,r.jsx)(a.bL,{variant:"normal",children:s})]}),(0,r.jsx)(a.D,{width:128,justifyContent:"end",children:(0,r.jsx)(a.bC,{size:"medium",checked:i,onCheckedChange:e=>l(e)})})]})})};var b=i(84879);let g=()=>{let[e,n]=function(e,n){let[i,r]=(0,b.E)(e);return[i,async e=>{try{await r(e),h.Am.success(e?"Labs: enabled ".concat(n):"Labs: disabled ".concat(n))}catch(i){console.error(i),h.Am.error(e?"Labs: failed to enable ".concat(n):"Labs: failed to disable ".concat(n))}}]}("legacySliceUpgrader","Legacy Slice Upgrader");return(0,r.jsxs)(a.D,{flexDirection:"column",gap:32,children:[(0,r.jsx)("header",{children:(0,r.jsx)(a.bL,{variant:"normal",children:"Slice Machine Labs gives you early access to new features before they're widely released. Experimental features are works-in-progress and potentially unstable, so you may find some bugs and breaking changes along the way."})}),(0,r.jsx)(a.D,{flexDirection:"column",gap:16,children:(0,r.jsxs)(u,{title:"Legacy Slice Upgrader",enabled:e.enabled,onToggle:e=>void n(e),children:["The Legacy Slice Upgrader allows you to convert old slices (legacy and composite slices) to slices managed by Slice Machine (shared slices). This feature is experimental, and we strongly recommend that you test it with a"," ",(0,r.jsx)("a",{href:"https://prismic.io/docs/environments",target:"_blank",children:"Prismic environment"})," ","or you'll be at risk of losing past content."]})})]})},x=()=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s(),{children:(0,r.jsx)("title",{children:"Labs - Slice Machine"})}),(0,r.jsx)(o.h,{renderError:()=>(0,r.jsx)(j,{children:(0,r.jsx)(a.D,{alignItems:"center",justifyContent:"center",children:(0,r.jsx)(a.ax,{title:"Request failed",description:"An error occurred while fetching your labs configuration."})})}),children:(0,r.jsx)(t.Suspense,{fallback:(0,r.jsx)(j,{withHeader:!0,children:(0,r.jsx)(a.bg,{})}),children:(0,r.jsx)(j,{withHeader:!0,children:(0,r.jsx)(g,{})})})})]}),j=e=>{let{children:n,withHeader:i=!1}=e;return(0,r.jsxs)(d.LN,{children:[i?(0,r.jsx)(d.wd,{children:(0,r.jsx)(d.Cx,{children:(0,r.jsx)(c.g,{children:"Labs"})})}):null,(0,r.jsx)(d.RN,{children:n})]})}}},function(e){e.O(0,[888,774,179],function(){return e(e.s=41535)}),_N_E=e.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(
|
|
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(10660)}},function(n){n.O(0,[898,917,525,461,139,397,66,183,344,256,130,21,882,647,630,633,660,888,774,179],function(){return n(n.s=61367)}),_N_E=n.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[33],{30755:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]/simulator",function(){return n(49823)}])},44309:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(5632),i=n(56580),o=n(7723);let s=(e,t,n)=>{var r;let i=null===(r=(0,o.Sd)(e))||void 0===r?void 0:r.find(e=>e.name.replace(/\//g,"--")===t);return null==i?void 0:i.components.find(e=>e.model.name===n)};var l=()=>{let e=(0,r.useRouter)(),{slice:t}=(0,i.v9)(t=>({slice:s(t,e.query.lib,e.query.sliceName)}));if(!t)return{};let n=t.model.variations.find(t=>t.id===e.query.variation);return n?{slice:t,variation:n}:{}}},33986:function(e,t,n){"use strict";n.d(t,{z:function(){return a}});var r=n(52322),i=n(2784),o=n(75289);let s=(e,t)=>e?"".concat(e,"-").concat(t):"",l=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},a=(0,i.forwardRef)((e,t)=>{let{label:n,Icon:i,type:a,form:c,isLoading:d=!1,disabled:u=!1,onClick:x,sx:h={},iconSize:p=16,iconFill:m,variant:g="primary",...f}=e;return(0,r.jsx)(o.zx,{ref:t,sx:{...h,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:g,...f,children:d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.$j,{size:p,color:l(g),"data-testid":s(f["data-testid"],"spinner")}),i&&n]}):(0,r.jsxs)(r.Fragment,{children:[i&&(0,r.jsx)(i,{size:p,fill:m,"data-testid":s(f["data-testid"],"icon")}),n]})})})},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return c},W:function(){return a}});var r=n(52322),i=n(2784),o=n(75289);let s=e=>{let{bg:t,background:n,sx:i,withRadius:s,radius:l,children:a}=e;return(0,r.jsx)(o.xu,{sx:{p:4,bg:t||n,...s?{borderBottomLeftRadius:l,borderBottomRightRadius:l}:null,...i},children:a})},l=(0,i.createContext)("6px"),a=()=>(0,i.useContext)(l),c=e=>{let{Header:t=null,SubHeader:n=null,Body:i=null,Footer:a=null,borderFooter:c=!1,radius:d="6px",bodySx:u={},footerSx:x={},sx:h=null,bg:p,background:m,children:g,...f}=e;return(0,r.jsx)(l.Provider,{value:d,children:(0,r.jsxs)(o.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:d,...h},...f,children:[t||null,n||null,(0,r.jsxs)(s,{bg:p,background:m,sx:u,withRadius:!a,children:[i?(0,r.jsx)(i,{}):null,g||null]}),a?(0,r.jsx)(s,{bg:p,background:m,sx:{...c?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...x},radius:d,withRadius:!0,children:"object"==typeof a?a:(0,r.jsx)(a,{})}):null]})})}},77823:function(e,t,n){"use strict";n.d(t,{q:function(){return a}});var r=n(52322),i=n(2784),o=n(65186),s=n(75289);let l=(0,i.memo)(e=>{let{src:t}=e;return(0,r.jsx)(s.Ee,{src:t,alt:"Preview image",sx:{maxHeight:"100%"}})}),a=e=>{let{src:t,sx:n}=e;return(0,r.jsx)(s.kC,{sx:{position:"relative",alignItems:"center",justifyContent:"center",overflow:"hidden",backgroundImage:"url(/pattern.png)",backgroundColor:"headSection",backgroundRepeat:"repeat",backgroundSize:"20px",borderRadius:"4px",...n},children:void 0!==t?(0,r.jsx)(l,{src:t}):(0,r.jsxs)(s.xv,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,r.jsx)(o.eJU,{}),"You have no screenshot yet."]})})}},49823:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return en}});var r,i,o=n(52322),s=n(97729),l=n.n(s),a=n(5632),c=n.n(a),d=n(44309),u=n(86753),x=n(11699),h=n(25242),p=n(25865),m=n(14010),g=n(2784),f=n(56580),v=n(88932),b=n(75289),j=n(65077),C=n(94160),k=n(87446),w=function(e,t,n){let[r,i]=(0,g.useState)(e()),o=(0,g.useRef)(Date.now());return(0,g.useEffect)(()=>{let n=setTimeout(function(){Date.now()-o.current>=t&&(i(e()),o.current=Date.now())},t-(Date.now()-o.current));return()=>{clearTimeout(n)}},[t,...n]),r},S=n(30527),y=n(77823),E=n(55862),R=n(75966),D=n(34830),z=n(54597),I=e=>{let{sliceName:t,screenshotUrl:n}=e,{isScreenshotModalOpen:r}=(0,f.v9)(e=>({isScreenshotModalOpen:(0,R.gP)(e,D.q.SCREENSHOT_PREVIEW)})),{closeModals:i}=(0,z.Z)();return(0,o.jsx)(E.Z,{isOpen:r,shouldCloseOnOverlayClick:!0,contentLabel:"Screenshot Preview",portalClassName:"ScreenshotPreviewModal",onRequestClose:i,children:(0,o.jsx)(S.Z,{radius:"0px",bodySx:{p:0,bg:"#FFF",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},Header:(0,o.jsxs)(b.kC,{sx:{position:"sticky",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,o.jsxs)(b.X6,{sx:{fontSize:"14px"},children:["Screenshot Preview for ",t]}),(0,o.jsx)(b.x8,{type:"button",onClick:()=>i()})]}),Footer:()=>(0,o.jsx)(b.kC,{style:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:"1px solid #DCDBDD"},children:(0,o.jsx)(b.zx,{variant:"secondary",sx:{fontWeight:600},onClick:()=>i(),children:"Close"})}),children:(0,o.jsx)(y.q,{src:n,sx:{height:"320px"}})})})},O=n(26109),T=n(9149);let M=e=>({__TYPE__:"SharedSliceContent",variation:e,primary:{},items:[]});var W=n(85819),_=n(33986),P=e=>{let{children:t,sx:n}=e;return(0,o.jsx)(b.kC,{sx:{bg:"grey07",height:"90%",width:"100%",justifyContent:"center",alignItems:"center",zIndex:"1",...n},children:(0,o.jsx)(b.kC,{sx:{marginTop:"-128px",justifyContent:"center",flexDirection:"column",alignItems:"center"},children:t})})},N=e=>{let{onRetrigger:t}=e;return(0,o.jsxs)(P,{children:[(0,o.jsx)(b.Ee,{src:"/iframe-not-running.png",sx:{width:"320px"}}),(0,o.jsx)(b.xv,{sx:{color:"textClear",mb:2,fontSize:"14px",lineHeight:"24px",fontWeight:"600"},children:"Slice Machine can't render your slice"}),(0,o.jsxs)(b.xv,{sx:{color:"failedConnectText",maxWidth:"400px",textAlign:"center",fontSize:"12px",lineHeight:"22px"},children:["Ensure your website's development server is running by typing",(0,o.jsx)("br",{}),(0,o.jsx)(b.xv,{as:"code",variant:"styles.inlineCode",sx:{padding:"4px",borderRadius:"6px"},children:"npm run dev"}),"\xa0 in your terminal at the root of your website directory.",(0,o.jsx)("br",{})," If that doesn't work, see the\xa0",(0,o.jsx)(b.rU,{target:"_blank",href:"https://prismic.io/docs/slice-machine#simulate-slices",sx:{color:"link"},children:"troubleshooting instructions."})]}),(0,o.jsx)(_.z,{onClick:t,label:"Refresh",Icon:W.Fer,iconSize:20,iconFill:"#6F6E77",variant:"secondaryMedium",sx:{mt:"16px"}})]})},F=e=>(0,o.jsxs)("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.3304 19.693C50.9182 18.9787 50.2527 18.6526 50.2527 18.6526L64.7906 10.2077C65.5266 9.78011 66.4679 10.0339 66.8929 10.7745C67.3179 11.5151 67.0657 12.4622 66.3294 12.8898L52.639 20.8424C52.639 20.8424 51.7428 20.4072 51.3304 19.693Z",fill:"current"}),(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M47.6775 54.7814C58.0794 48.7394 61.6433 35.3572 55.6378 24.8917C54.7801 23.397 53.7736 22.0427 52.6481 20.8367L32.9428 32.2832C32.2068 32.7108 31.2655 32.457 30.8405 31.7165C30.4155 30.9757 30.6677 30.0287 31.4039 29.6011L50.2693 18.6425C43.486 13.2668 33.8645 12.2736 25.9299 16.8827C15.5282 22.9249 11.9642 36.3071 17.9697 46.7727C18.8274 48.2671 19.8339 49.6216 20.9595 50.8276L41.1791 39.0822C41.9151 38.6546 42.8564 38.9086 43.2814 39.6492C43.7064 40.3897 43.4542 41.3368 42.7182 41.7644L23.3384 53.0217C30.1217 58.3975 39.7432 59.3906 47.6775 54.7814Z",fill:"current"}),(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.20645 61.7656C4.78145 61.0248 5.03367 60.078 5.76978 59.6502L20.9371 50.8398C20.9371 50.8398 21.8578 51.2406 22.3053 51.7062C22.7528 52.1717 23.361 53.0078 23.361 53.0078L7.30887 62.3323C6.57274 62.7599 5.63144 62.5061 5.20645 61.7656Z",fill:"current"})]}),L=n(75100),A=n(19909),B=e=>{let{defaultValue:t,variations:n,MenuItemAction:r,onChange:i}=e;return(0,o.jsxs)(b.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"4px",border:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:250,maxWidth:350,color:"text"},children:[(0,o.jsxs)(b.xv,{sx:{p:3,fontSize:12,color:"textClear"},children:[n.length," VARIATION",n.length>1?"S":""]}),(0,o.jsxs)(b.kC,{sx:{p:0,flexDirection:"column"},children:[n.map(e=>(0,o.jsx)(U,{value:e,isActive:e.id===t.id,onClick:i},e.id)),r||null]})]})};let U=e=>{let{value:t,isActive:n,onClick:r}=e;return(0,o.jsx)(b.xu,{sx:{px:3,py:2,color:n?"primary":"",cursor:"pointer",borderLeft:e=>{let{colors:t}=e;return"2px solid ".concat(n?null==t?void 0:t.primary:null==t?void 0:t.background)},borderRadius:0,bg:"background",":hover":{bg:"hoverBackground",borderLeft:e=>{let{colors:t}=e;return"2px solid ".concat(null==t?void 0:t.primary)}}},onClick:()=>r(t),children:t.name})};var H=e=>{let{buttonSx:t,defaultValue:n,variations:r,onNewVariation:i,onChange:s,sx:l,disabled:a}=e,[c,d]=(0,g.useState)(!1),[u,x]=(0,g.useState)(n||r[0]);(0,g.useEffect)(()=>{n&&x(n)},[n]);let h=function(e){d(!1),x(e),setTimeout(()=>s(e),210)},p=(0,o.jsx)(b.xu,{sx:{p:2},children:(0,o.jsx)(b.zx,{variant:"transparent",sx:{color:"text"},onClick:()=>{d(!1),i&&i()},children:"+ Add new variation"})});return(0,o.jsx)(b.xu,{sx:l,children:(0,o.jsx)(A.Popover,{align:"start",isOpen:c,onClickOutside:()=>d(!1),positions:["bottom"],padding:10,content:()=>(0,o.jsx)(B,{defaultValue:u,variations:r,onChange:h,MenuItemAction:i?p:void 0}),containerClassName:"variationSelectorContainer",children:(0,o.jsxs)(b.zx,{sx:{...t},variant:"dropDownButton",onClick:()=>d(!c),disabled:a,children:[u.name," ",c?(0,o.jsx)(L.bOz,{size:"16px","aria-label":"Collapse variations"}):(0,o.jsx)(L.mEq,{size:"16px","aria-label":"Expand variations"})]})})})};let Z=(e,t,n)=>{if(!t){c().push("/".concat(e.href,"/").concat(e.model.name));return}let r=function(e){let{lib:t,sliceName:n,variationId:r,options:i={},isSimulator:o}=e,s="/slices/[lib]/[sliceName]/[variation]".concat(o?"/simulator":""),l="/slices/".concat(t,"/").concat(n,"/").concat(r).concat(o?"/simulator":"");return{href:s,as:l,options:i,all:[s,l,i]}}({lib:e.href,sliceName:e.model.name,variationId:null==t?void 0:t.id,isSimulator:n});c().push(r.href,r.as,r.options)};var q=e=>{let{slice:t,variation:n,isDisplayEditor:r,toggleIsDisplayEditor:i,onSaveMock:s,actionsDisabled:l,isSavingMock:a}=e;return(0,o.jsxs)(b.kC,{sx:{p:"16px",display:"flex",bg:"grey07",gridTemplateRows:"1fr",borderBottom:"1px solid #DCDBDD",justifyContent:"space-between"},children:[(0,o.jsxs)(b.kC,{sx:{alignItems:"center"},children:[(0,o.jsx)(F,{height:"20px",width:"20px",fill:"#1A1523"}),(0,o.jsx)(b.xv,{sx:{ml:2,mr:"12px",fontSize:"14px",color:"#1A1523",fontWeight:"600",letterSpacing:"-0.15px"},children:t.model.name}),(0,o.jsx)(H,{defaultValue:n,variations:t.model.variations,onChange:e=>Z(t,e,!0),disabled:t.model.variations.length<=1||l})]}),(0,o.jsxs)(b.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,o.jsx)(b.kC,{sx:{alignItems:"center",justifyContent:"space-around"},children:(0,o.jsxs)(b.kC,{sx:{alignItems:"center",mr:4},children:[(0,o.jsx)(b.__,{htmlFor:"show-mock-editor",sx:{color:"#6F6E77",lineHeight:"16px",fontSize:"12px",fontWeight:"600",letterSpacing:"0px"},children:"Editor"}),(0,o.jsx)(b.rs,{id:"show-mock-editor",checked:r,onChange:i,disabled:l})]})}),(0,o.jsx)(_.z,{"data-testid":"save-mock",onClick:s,label:"Save mock content",disabled:a||l,variant:"primary",sx:{borderRadius:"6px",color:"#F1EEFE",fontWeight:"bold",border:"1px solid #5842C3",backgroundColor:"#6E56CF",boxShadow:"0px 1px 0px rgba(0, 0, 0, 0.04)","&:hover":{"&:not([disabled])":{backgroundColor:"#5842C3"}}}})]})]})},V=n(16),X=e=>{let{apiContent:t,screenDimensions:n,simulatorUrl:r,dryRun:i=!1,isScreenshot:s=!1,handleSimulatorConnectionResult:l}=e,[a,c]=function(){let[e,t]=(0,g.useState)(),n=(0,g.useRef)(),r=(0,g.useRef)();return[e,(0,g.useCallback)(async e=>{var i,o;if(null===(i=n.current)||void 0===i||i.disconnect(),null===(o=r.current)||void 0===o||o.disconnect(),t(void 0),null!=e){n.current=new V.SH(e);try{await n.current.connect(),t(n.current);let i=async()=>{var e;t(void 0),await (null===(e=n.current)||void 0===e?void 0:e.connect({},!0)),t(n.current)};r.current=new MutationObserver(e=>{e.forEach(e=>{"src"===e.attributeName&&i().catch(e=>{throw e})})}),r.current.observe(e,{attributeFilter:["src"]})}catch(e){console.error(e)}}},[])]}();(0,g.useEffect)(()=>{if(!r){l("failed");return}if(void 0!==a){if(!a.connected){l("failed"),console.warn("Trying to use a disconnected simulator client.");return}(async()=>{await a.setSliceZone([t])})().then(()=>{l("successful")}).catch(()=>{l("failed")})}},[a,t,r]);let[d,u]=(0,g.useState)(),x=function(e,t){let n=(0,g.useRef)();return(0,g.useCallback)(t=>{var r;null===(r=n.current)||void 0===r||r.disconnect(),null!==t&&(n.current=new ResizeObserver(n=>{let[r]=n,{height:i,width:o}=r.contentRect;e({blockSize:i,inlineSize:o},t)}),n.current.observe(t))},t)}(e=>{let{blockSize:t,inlineSize:n}=e;u({height:t,width:n})},[]);return(0,o.jsx)(b.kC,{ref:x,sx:{alignItems:"center",backgroundColor:"headSection",backgroundImage:"url(/pattern.png)",backgroundRepeat:"repeat",backgroundSize:"10px",border:s?void 0:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorder))},borderRadius:s?void 0:8,display:"flex",height:"100%",justifyContent:"center",overflow:"hidden",...i?{display:"none"}:{}},children:r?(0,o.jsx)("iframe",{ref:c,src:r,style:{border:"none",maxHeight:"".concat(n.height,"px"),maxWidth:"".concat(n.width,"px"),minHeight:"".concat(n.height,"px"),minWidth:"".concat(n.width,"px"),overflowY:"auto",...d?{transform:"scale(".concat(function(e,t){let{height:n,width:r}=e,{height:i,width:o}=t;return r>o||n>i?r-o>n-i?o/r:i/n:1}(n,d),")")}:{display:"none"}}}):null})},K=e=>{let{defaultValue:t,options:n,onChange:r}=e;return(0,o.jsx)(b.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"6px",border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorder))},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:180,maxWidth:350,color:"text"},children:(0,o.jsx)(b.kC,{sx:{p:0,flexDirection:"column"},children:n.map(e=>(0,o.jsx)(Y,{value:e,isActive:e===t,onClick:r}))})})};let Y=e=>{let{value:t,isActive:n,onClick:r}=e;return(0,o.jsx)(b.xu,{sx:{p:2,cursor:"pointer",fontSize:"14px",borderRadius:0,bg:n?"hoverBackground":"background",":hover":{bg:"hoverBackground"}},onClick:()=>r(t),children:t})},J=e=>{let{buttonSx:t,currentValue:n,options:r,onChange:i,disabled:s}=e,[l,a]=(0,g.useState)(!1),c=function(e){a(!1),setTimeout(()=>i(e),210)};return(0,o.jsx)(b.xu,{children:(0,o.jsx)(A.Popover,{align:"start",isOpen:l,onClickOutside:()=>a(!1),positions:["bottom"],padding:2,content:()=>(0,o.jsx)(K,{defaultValue:n,options:r,onChange:c}),children:(0,o.jsxs)(b.zx,{sx:t,variant:"dropDownButton",onClick:()=>a(!l),disabled:s,children:[n," ",l?(0,o.jsx)(L.bOz,{size:"24px"}):(0,o.jsx)(L.mEq,{size:"24px"})]})})})};(r=i||(i={})).DESKTOP="Desktop",r.TABLET="Tablet",r.MOBILE="Mobile",r.CUSTOM="Custom";let $={Desktop:{width:1280,height:800},Tablet:{width:1080,height:810},Mobile:{width:390,height:844}},Q=e=>{let{label:t,startValue:n,onChange:r,sx:i,disabled:s}=e,l=["e","-","+",",","."];return(0,o.jsxs)(b.kC,{sx:{alignItems:"center",...i},children:[(0,o.jsx)(b.__,{sx:{backgroundColor:"grey07",border:"transparent",borderRight:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorder))},borderRadius:"6px 0px 0px 6px",width:26,height:30,color:"greyIcon",fontWeight:"bold",fontSize:"14px",alignItems:"center",justifyContent:"center",position:"absolute",ml:"1px"},htmlFor:"".concat(t,"-screensize-input"),children:t}),(0,o.jsx)(b.II,{type:"number",name:"".concat(t,"-screensize-input"),disabled:s,sx:{width:80,height:32,p:0,border:"1px solid #E4E2E4",borderRadius:"6px","&::-webkit-outer-spin-button,&::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},color:"greyIcon",textAlign:"center",paddingLeft:26,"&:disabled":{cursor:"not-allowed","&:hover":{border:"1px solid #E4E2E4"},"&:active":{border:"1px solid #E4E2E4",boxShadow:"none"}}},onChange:r,value:n,min:"0",onKeyDown:e=>{l.includes(e.key)&&e.preventDefault()}})]})},G=e=>{let{handleScreenSizeChange:t,screenDimensions:n,actionsDisabled:r}=e,[s,l]=(0,g.useState)(i.DESKTOP),a=e=>{let n=Object.values($).findIndex(t=>JSON.stringify(t)===JSON.stringify(e));l(n<0?i.CUSTOM:Object.keys($)[n]),t(e)};return(0,o.jsx)(b.kC,{sx:{alignItems:"center",pb:"16px",justifyContent:"space-between",variant:"small"},children:(0,o.jsxs)(b.kC,{sx:{alignItems:"center",flex:1},children:[(0,o.jsx)(J,{options:Object.values(i),onChange:e=>{l(e),e!==i.CUSTOM.toString()&&t($[e])},buttonSx:{alignSelf:"start"},currentValue:s,disabled:r}),(0,o.jsx)(Q,{label:"W",startValue:n.width.toString(),onChange:e=>{a({...n,width:Number(e.target.value)})},disabled:r,sx:{mx:2}}),(0,o.jsx)(L.eSQ,{size:16,color:"#6F6E77"}),(0,o.jsx)(Q,{label:"H",startValue:n.height.toString(),onChange:e=>{a({...n,height:Number(e.target.value)})},disabled:r,sx:{ml:2}})]})})},ee=new p.S;var et=e=>{var t,n;let{slice:r,variation:s}=e,{updateSliceMockSuccess:l}=(0,z.Z)(),{simulatorUrl:a,endpoints:c}=(0,f.v9)(e=>({simulatorUrl:(0,T.x0)(e),endpoints:(0,T.gZ)(e)})),d=(0,g.useMemo)(()=>({embedApiEndpoint:new URL(c.PrismicEmbed),authStrategy:"cookie",unsplashApiBaseUrl:new URL(c.PrismicUnsplash),baseUrl:new URL("builder/",c.PrismicWroom)}),[c.PrismicEmbed,c.PrismicUnsplash,c.PrismicWroom]);(0,g.useEffect)(()=>{C.Xe.track({event:"slice-simulator:open"})},[]);let p=(0,g.useRef)(!1);(0,g.useEffect)(()=>{p.current=!0},[]);let S=e=>{p.current&&(p.current=!1,C.Xe.track({event:"editor:widget-used",sliceId:e}))},[y,E]=(0,g.useState)("waiting");(0,g.useEffect)(()=>{if("waiting"===y){let e=setTimeout(()=>{E("failed")},2e4);return()=>clearTimeout(e)}},[y]);let R=e=>{"waiting"===y&&("failed"===e?C.Xe.track({event:"slice-simulator:is-not-running"}):Z(!0),E(e))},[D,W]=(0,g.useState)($[i.DESKTOP]),_=(0,g.useMemo)(()=>O.id.fromSM(r.model),[r.model]),[F,L]=(0,g.useState)(null),A=(0,g.useMemo)(()=>{var e;return(null==F?void 0:F.variation)===s.id?F:(null===(e=r.mocks)||void 0===e?void 0:e.find(e=>e.variation===s.id))||M(s.id)},[F,s.id]),B=(0,g.useMemo)(()=>(0,h.renderSliceMock)(_,A).id,[]),U=w((0,g.useCallback)(()=>()=>({...(0,h.renderSliceMock)(_,A),id:B}),[_,A]),800,[_,A]),[H,Z]=(0,g.useState)(!1),[V,K]=(0,g.useState)(!1),Y=async()=>{if(F){K(!0);try{var e;let t={libraryID:r.from,sliceID:r.model.id,mocks:(null!==(e=r.mocks)&&void 0!==e?e:[]).filter(e=>e.variation!==F.variation).concat(F)},{errors:n}=await (0,C.y3)(t);if(n.length>0)throw n;l(t),v.Am.success("Saved")}catch(e){console.error("Error while saving mock",e),v.Am.error("Error saving content")}K(!1)}};return(0,o.jsxs)(b.kC,{sx:{flexDirection:"column",height:"100vh"},children:[(0,o.jsx)(q,{slice:r,variation:s,isDisplayEditor:H,actionsDisabled:"successful"!==y,toggleIsDisplayEditor:()=>Z(!H),onSaveMock:()=>void Y(),isSavingMock:V}),(0,o.jsx)(b.xu,{sx:{flex:1,bg:"grey07",p:3,display:"flex",flexDirection:"column",height:"calc(100% - 73px - 16px)"},children:(0,o.jsxs)(b.kC,{sx:{flex:1,flexDirection:"row",position:"relative",width:"100%",height:"100%"},children:[(0,o.jsxs)(j.xR,{sx:{display:"flex",height:"100%",flexDirection:"column",flex:1,minWidth:0},children:[(0,o.jsx)(G,{handleScreenSizeChange:W,screenDimensions:D,actionsDisabled:"successful"!==y}),"failed"===y?(0,o.jsx)(N,{onRetrigger:()=>{E("waiting")}}):null,"successful"===y?(0,o.jsx)(X,{apiContent:U,screenDimensions:D,simulatorUrl:a,handleSimulatorConnectionResult:R}):(0,o.jsx)(o.Fragment,{children:"waiting"===y?(0,o.jsxs)(P,{children:[(0,o.jsx)(b.$j,{variant:"styles.spinner"}),(0,o.jsx)(X,{apiContent:U,screenDimensions:D,simulatorUrl:a,dryRun:!0,handleSimulatorConnectionResult:R})]}):null})]}),"successful"===y&&H?(0,o.jsx)(b.kC,{className:"editor",sx:{flexDirection:"column",marginLeft:"16px",maxWidth:"440px",minWidth:"440px",overflowY:"auto"},children:(0,o.jsx)(k.h,{renderError:()=>(0,o.jsx)(x.ax,{title:"Editor error",description:"An error occurred while rendering the editor."}),children:(0,o.jsx)(g.Suspense,{children:(0,o.jsx)(m.aH,{client:ee,children:(0,o.jsx)(u.kS,{config:d,content:A,onContentChange:e=>{L(e),S(r.model.id)},sharedSlice:_},s.id)})})})}):null]})}),!!(null===(t=r.screenshots[s.id])||void 0===t?void 0:t.url)&&(0,o.jsx)(I,{sliceName:r.model.name,screenshotUrl:null===(n=r.screenshots[s.id])||void 0===n?void 0:n.url})]})};function en(){let e=(0,a.useRouter)(),{slice:t,variation:n}=(0,d.Z)();return void 0===t||void 0===n?(e.replace("/"),null):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(l(),{children:(0,o.jsx)("title",{children:"Simulator: ".concat(t.model.name," - Slice Machine")})}),(0,o.jsx)(et,{slice:t,variation:n})]})}}},function(e){e.O(0,[789,872,130,429,888,774,179],function(){return e(e.s=30755)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[33],{30755:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]/simulator",function(){return n(49823)}])},44309:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(5632),i=n(56580),o=n(7723);let s=(e,t,n)=>{var r;let i=null===(r=(0,o.Sd)(e))||void 0===r?void 0:r.find(e=>e.name.replace(/\//g,"--")===t);return null==i?void 0:i.components.find(e=>e.model.name===n)};var l=()=>{let e=(0,r.useRouter)(),{slice:t}=(0,i.v9)(t=>({slice:s(t,e.query.lib,e.query.sliceName)}));if(!t)return{};let n=t.model.variations.find(t=>t.id===e.query.variation);return n?{slice:t,variation:n}:{}}},33986:function(e,t,n){"use strict";n.d(t,{z:function(){return a}});var r=n(52322),i=n(2784),o=n(75289);let s=(e,t)=>e?"".concat(e,"-").concat(t):"",l=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},a=(0,i.forwardRef)((e,t)=>{let{label:n,Icon:i,type:a,form:c,isLoading:d=!1,disabled:u=!1,onClick:x,sx:h={},iconSize:p=16,iconFill:m,variant:g="primary",...f}=e;return(0,r.jsx)(o.zx,{ref:t,sx:{...h,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:g,...f,children:d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.$j,{size:p,color:l(g),"data-testid":s(f["data-testid"],"spinner")}),i&&n]}):(0,r.jsxs)(r.Fragment,{children:[i&&(0,r.jsx)(i,{size:p,fill:m,"data-testid":s(f["data-testid"],"icon")}),n]})})})},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return c},W:function(){return a}});var r=n(52322),i=n(2784),o=n(75289);let s=e=>{let{bg:t,background:n,sx:i,withRadius:s,radius:l,children:a}=e;return(0,r.jsx)(o.xu,{sx:{p:4,bg:t||n,...s?{borderBottomLeftRadius:l,borderBottomRightRadius:l}:null,...i},children:a})},l=(0,i.createContext)("6px"),a=()=>(0,i.useContext)(l),c=e=>{let{Header:t=null,SubHeader:n=null,Body:i=null,Footer:a=null,borderFooter:c=!1,radius:d="6px",bodySx:u={},footerSx:x={},sx:h=null,bg:p,background:m,children:g,...f}=e;return(0,r.jsx)(l.Provider,{value:d,children:(0,r.jsxs)(o.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:d,...h},...f,children:[t||null,n||null,(0,r.jsxs)(s,{bg:p,background:m,sx:u,withRadius:!a,children:[i?(0,r.jsx)(i,{}):null,g||null]}),a?(0,r.jsx)(s,{bg:p,background:m,sx:{...c?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...x},radius:d,withRadius:!0,children:"object"==typeof a?a:(0,r.jsx)(a,{})}):null]})})}},77823:function(e,t,n){"use strict";n.d(t,{q:function(){return a}});var r=n(52322),i=n(2784),o=n(65186),s=n(75289);let l=(0,i.memo)(e=>{let{src:t}=e;return(0,r.jsx)(s.Ee,{src:t,alt:"Preview image",sx:{maxHeight:"100%"}})}),a=e=>{let{src:t,sx:n}=e;return(0,r.jsx)(s.kC,{sx:{position:"relative",alignItems:"center",justifyContent:"center",overflow:"hidden",backgroundImage:"url(/pattern.png)",backgroundColor:"headSection",backgroundRepeat:"repeat",backgroundSize:"20px",borderRadius:"4px",...n},children:void 0!==t?(0,r.jsx)(l,{src:t}):(0,r.jsxs)(s.xv,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,r.jsx)(o.eJU,{}),"You have no screenshot yet."]})})}},49823:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return en}});var r,i,o=n(52322),s=n(97729),l=n.n(s),a=n(5632),c=n.n(a),d=n(44309),u=n(86753),x=n(18337),h=n(25242),p=n(25865),m=n(14010),g=n(2784),f=n(56580),v=n(88932),b=n(75289),j=n(65077),C=n(94160),k=n(87446),w=function(e,t,n){let[r,i]=(0,g.useState)(e()),o=(0,g.useRef)(Date.now());return(0,g.useEffect)(()=>{let n=setTimeout(function(){Date.now()-o.current>=t&&(i(e()),o.current=Date.now())},t-(Date.now()-o.current));return()=>{clearTimeout(n)}},[t,...n]),r},S=n(30527),y=n(77823),E=n(55862),R=n(75966),D=n(34830),z=n(54597),I=e=>{let{sliceName:t,screenshotUrl:n}=e,{isScreenshotModalOpen:r}=(0,f.v9)(e=>({isScreenshotModalOpen:(0,R.gP)(e,D.q.SCREENSHOT_PREVIEW)})),{closeModals:i}=(0,z.Z)();return(0,o.jsx)(E.Z,{isOpen:r,shouldCloseOnOverlayClick:!0,contentLabel:"Screenshot Preview",portalClassName:"ScreenshotPreviewModal",onRequestClose:i,children:(0,o.jsx)(S.Z,{radius:"0px",bodySx:{p:0,bg:"#FFF",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},Header:(0,o.jsxs)(b.kC,{sx:{position:"sticky",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,o.jsxs)(b.X6,{sx:{fontSize:"14px"},children:["Screenshot Preview for ",t]}),(0,o.jsx)(b.x8,{type:"button",onClick:()=>i()})]}),Footer:()=>(0,o.jsx)(b.kC,{style:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:"1px solid #DCDBDD"},children:(0,o.jsx)(b.zx,{variant:"secondary",sx:{fontWeight:600},onClick:()=>i(),children:"Close"})}),children:(0,o.jsx)(y.q,{src:n,sx:{height:"320px"}})})})},O=n(26109),T=n(9149);let M=e=>({__TYPE__:"SharedSliceContent",variation:e,primary:{},items:[]});var W=n(85819),_=n(33986),P=e=>{let{children:t,sx:n}=e;return(0,o.jsx)(b.kC,{sx:{bg:"grey07",height:"90%",width:"100%",justifyContent:"center",alignItems:"center",zIndex:"1",...n},children:(0,o.jsx)(b.kC,{sx:{marginTop:"-128px",justifyContent:"center",flexDirection:"column",alignItems:"center"},children:t})})},N=e=>{let{onRetrigger:t}=e;return(0,o.jsxs)(P,{children:[(0,o.jsx)(b.Ee,{src:"/iframe-not-running.png",sx:{width:"320px"}}),(0,o.jsx)(b.xv,{sx:{color:"textClear",mb:2,fontSize:"14px",lineHeight:"24px",fontWeight:"600"},children:"Slice Machine can't render your slice"}),(0,o.jsxs)(b.xv,{sx:{color:"failedConnectText",maxWidth:"400px",textAlign:"center",fontSize:"12px",lineHeight:"22px"},children:["Ensure your website's development server is running by typing",(0,o.jsx)("br",{}),(0,o.jsx)(b.xv,{as:"code",variant:"styles.inlineCode",sx:{padding:"4px",borderRadius:"6px"},children:"npm run dev"}),"\xa0 in your terminal at the root of your website directory.",(0,o.jsx)("br",{})," If that doesn't work, see the\xa0",(0,o.jsx)(b.rU,{target:"_blank",href:"https://prismic.io/docs/slice-machine#simulate-slices",sx:{color:"link"},children:"troubleshooting instructions."})]}),(0,o.jsx)(_.z,{onClick:t,label:"Refresh",Icon:W.Fer,iconSize:20,iconFill:"#6F6E77",variant:"secondaryMedium",sx:{mt:"16px"}})]})},F=e=>(0,o.jsxs)("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.3304 19.693C50.9182 18.9787 50.2527 18.6526 50.2527 18.6526L64.7906 10.2077C65.5266 9.78011 66.4679 10.0339 66.8929 10.7745C67.3179 11.5151 67.0657 12.4622 66.3294 12.8898L52.639 20.8424C52.639 20.8424 51.7428 20.4072 51.3304 19.693Z",fill:"current"}),(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M47.6775 54.7814C58.0794 48.7394 61.6433 35.3572 55.6378 24.8917C54.7801 23.397 53.7736 22.0427 52.6481 20.8367L32.9428 32.2832C32.2068 32.7108 31.2655 32.457 30.8405 31.7165C30.4155 30.9757 30.6677 30.0287 31.4039 29.6011L50.2693 18.6425C43.486 13.2668 33.8645 12.2736 25.9299 16.8827C15.5282 22.9249 11.9642 36.3071 17.9697 46.7727C18.8274 48.2671 19.8339 49.6216 20.9595 50.8276L41.1791 39.0822C41.9151 38.6546 42.8564 38.9086 43.2814 39.6492C43.7064 40.3897 43.4542 41.3368 42.7182 41.7644L23.3384 53.0217C30.1217 58.3975 39.7432 59.3906 47.6775 54.7814Z",fill:"current"}),(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.20645 61.7656C4.78145 61.0248 5.03367 60.078 5.76978 59.6502L20.9371 50.8398C20.9371 50.8398 21.8578 51.2406 22.3053 51.7062C22.7528 52.1717 23.361 53.0078 23.361 53.0078L7.30887 62.3323C6.57274 62.7599 5.63144 62.5061 5.20645 61.7656Z",fill:"current"})]}),L=n(75100),A=n(19909),B=e=>{let{defaultValue:t,variations:n,MenuItemAction:r,onChange:i}=e;return(0,o.jsxs)(b.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"4px",border:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:250,maxWidth:350,color:"text"},children:[(0,o.jsxs)(b.xv,{sx:{p:3,fontSize:12,color:"textClear"},children:[n.length," VARIATION",n.length>1?"S":""]}),(0,o.jsxs)(b.kC,{sx:{p:0,flexDirection:"column"},children:[n.map(e=>(0,o.jsx)(U,{value:e,isActive:e.id===t.id,onClick:i},e.id)),r||null]})]})};let U=e=>{let{value:t,isActive:n,onClick:r}=e;return(0,o.jsx)(b.xu,{sx:{px:3,py:2,color:n?"primary":"",cursor:"pointer",borderLeft:e=>{let{colors:t}=e;return"2px solid ".concat(n?null==t?void 0:t.primary:null==t?void 0:t.background)},borderRadius:0,bg:"background",":hover":{bg:"hoverBackground",borderLeft:e=>{let{colors:t}=e;return"2px solid ".concat(null==t?void 0:t.primary)}}},onClick:()=>r(t),children:t.name})};var H=e=>{let{buttonSx:t,defaultValue:n,variations:r,onNewVariation:i,onChange:s,sx:l,disabled:a}=e,[c,d]=(0,g.useState)(!1),[u,x]=(0,g.useState)(n||r[0]);(0,g.useEffect)(()=>{n&&x(n)},[n]);let h=function(e){d(!1),x(e),setTimeout(()=>s(e),210)},p=(0,o.jsx)(b.xu,{sx:{p:2},children:(0,o.jsx)(b.zx,{variant:"transparent",sx:{color:"text"},onClick:()=>{d(!1),i&&i()},children:"+ Add new variation"})});return(0,o.jsx)(b.xu,{sx:l,children:(0,o.jsx)(A.Popover,{align:"start",isOpen:c,onClickOutside:()=>d(!1),positions:["bottom"],padding:10,content:()=>(0,o.jsx)(B,{defaultValue:u,variations:r,onChange:h,MenuItemAction:i?p:void 0}),containerClassName:"variationSelectorContainer",children:(0,o.jsxs)(b.zx,{sx:{...t},variant:"dropDownButton",onClick:()=>d(!c),disabled:a,children:[u.name," ",c?(0,o.jsx)(L.bOz,{size:"16px","aria-label":"Collapse variations"}):(0,o.jsx)(L.mEq,{size:"16px","aria-label":"Expand variations"})]})})})};let Z=(e,t,n)=>{if(!t){c().push("/".concat(e.href,"/").concat(e.model.name));return}let r=function(e){let{lib:t,sliceName:n,variationId:r,options:i={},isSimulator:o}=e,s="/slices/[lib]/[sliceName]/[variation]".concat(o?"/simulator":""),l="/slices/".concat(t,"/").concat(n,"/").concat(r).concat(o?"/simulator":"");return{href:s,as:l,options:i,all:[s,l,i]}}({lib:e.href,sliceName:e.model.name,variationId:null==t?void 0:t.id,isSimulator:n});c().push(r.href,r.as,r.options)};var q=e=>{let{slice:t,variation:n,isDisplayEditor:r,toggleIsDisplayEditor:i,onSaveMock:s,actionsDisabled:l,isSavingMock:a}=e;return(0,o.jsxs)(b.kC,{sx:{p:"16px",display:"flex",bg:"grey07",gridTemplateRows:"1fr",borderBottom:"1px solid #DCDBDD",justifyContent:"space-between"},children:[(0,o.jsxs)(b.kC,{sx:{alignItems:"center"},children:[(0,o.jsx)(F,{height:"20px",width:"20px",fill:"#1A1523"}),(0,o.jsx)(b.xv,{sx:{ml:2,mr:"12px",fontSize:"14px",color:"#1A1523",fontWeight:"600",letterSpacing:"-0.15px"},children:t.model.name}),(0,o.jsx)(H,{defaultValue:n,variations:t.model.variations,onChange:e=>Z(t,e,!0),disabled:t.model.variations.length<=1||l})]}),(0,o.jsxs)(b.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,o.jsx)(b.kC,{sx:{alignItems:"center",justifyContent:"space-around"},children:(0,o.jsxs)(b.kC,{sx:{alignItems:"center",mr:4},children:[(0,o.jsx)(b.__,{htmlFor:"show-mock-editor",sx:{color:"#6F6E77",lineHeight:"16px",fontSize:"12px",fontWeight:"600",letterSpacing:"0px"},children:"Editor"}),(0,o.jsx)(b.rs,{id:"show-mock-editor",checked:r,onChange:i,disabled:l})]})}),(0,o.jsx)(_.z,{"data-testid":"save-mock",onClick:s,label:"Save mock content",disabled:a||l,variant:"primary",sx:{borderRadius:"6px",color:"#F1EEFE",fontWeight:"bold",border:"1px solid #5842C3",backgroundColor:"#6E56CF",boxShadow:"0px 1px 0px rgba(0, 0, 0, 0.04)","&:hover":{"&:not([disabled])":{backgroundColor:"#5842C3"}}}})]})]})},V=n(16),X=e=>{let{apiContent:t,screenDimensions:n,simulatorUrl:r,dryRun:i=!1,isScreenshot:s=!1,handleSimulatorConnectionResult:l}=e,[a,c]=function(){let[e,t]=(0,g.useState)(),n=(0,g.useRef)(),r=(0,g.useRef)();return[e,(0,g.useCallback)(async e=>{var i,o;if(null===(i=n.current)||void 0===i||i.disconnect(),null===(o=r.current)||void 0===o||o.disconnect(),t(void 0),null!=e){n.current=new V.SH(e);try{await n.current.connect(),t(n.current);let i=async()=>{var e;t(void 0),await (null===(e=n.current)||void 0===e?void 0:e.connect({},!0)),t(n.current)};r.current=new MutationObserver(e=>{e.forEach(e=>{"src"===e.attributeName&&i().catch(e=>{throw e})})}),r.current.observe(e,{attributeFilter:["src"]})}catch(e){console.error(e)}}},[])]}();(0,g.useEffect)(()=>{if(!r){l("failed");return}if(void 0!==a){if(!a.connected){l("failed"),console.warn("Trying to use a disconnected simulator client.");return}(async()=>{await a.setSliceZone([t])})().then(()=>{l("successful")}).catch(()=>{l("failed")})}},[a,t,r]);let[d,u]=(0,g.useState)(),x=function(e,t){let n=(0,g.useRef)();return(0,g.useCallback)(t=>{var r;null===(r=n.current)||void 0===r||r.disconnect(),null!==t&&(n.current=new ResizeObserver(n=>{let[r]=n,{height:i,width:o}=r.contentRect;e({blockSize:i,inlineSize:o},t)}),n.current.observe(t))},t)}(e=>{let{blockSize:t,inlineSize:n}=e;u({height:t,width:n})},[]);return(0,o.jsx)(b.kC,{ref:x,sx:{alignItems:"center",backgroundColor:"headSection",backgroundImage:"url(/pattern.png)",backgroundRepeat:"repeat",backgroundSize:"10px",border:s?void 0:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorder))},borderRadius:s?void 0:8,display:"flex",height:"100%",justifyContent:"center",overflow:"hidden",...i?{display:"none"}:{}},children:r?(0,o.jsx)("iframe",{ref:c,src:r,style:{border:"none",maxHeight:"".concat(n.height,"px"),maxWidth:"".concat(n.width,"px"),minHeight:"".concat(n.height,"px"),minWidth:"".concat(n.width,"px"),overflowY:"auto",...d?{transform:"scale(".concat(function(e,t){let{height:n,width:r}=e,{height:i,width:o}=t;return r>o||n>i?r-o>n-i?o/r:i/n:1}(n,d),")")}:{display:"none"}}}):null})},K=e=>{let{defaultValue:t,options:n,onChange:r}=e;return(0,o.jsx)(b.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"6px",border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorder))},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:180,maxWidth:350,color:"text"},children:(0,o.jsx)(b.kC,{sx:{p:0,flexDirection:"column"},children:n.map(e=>(0,o.jsx)(Y,{value:e,isActive:e===t,onClick:r}))})})};let Y=e=>{let{value:t,isActive:n,onClick:r}=e;return(0,o.jsx)(b.xu,{sx:{p:2,cursor:"pointer",fontSize:"14px",borderRadius:0,bg:n?"hoverBackground":"background",":hover":{bg:"hoverBackground"}},onClick:()=>r(t),children:t})},J=e=>{let{buttonSx:t,currentValue:n,options:r,onChange:i,disabled:s}=e,[l,a]=(0,g.useState)(!1),c=function(e){a(!1),setTimeout(()=>i(e),210)};return(0,o.jsx)(b.xu,{children:(0,o.jsx)(A.Popover,{align:"start",isOpen:l,onClickOutside:()=>a(!1),positions:["bottom"],padding:2,content:()=>(0,o.jsx)(K,{defaultValue:n,options:r,onChange:c}),children:(0,o.jsxs)(b.zx,{sx:t,variant:"dropDownButton",onClick:()=>a(!l),disabled:s,children:[n," ",l?(0,o.jsx)(L.bOz,{size:"24px"}):(0,o.jsx)(L.mEq,{size:"24px"})]})})})};(r=i||(i={})).DESKTOP="Desktop",r.TABLET="Tablet",r.MOBILE="Mobile",r.CUSTOM="Custom";let $={Desktop:{width:1280,height:800},Tablet:{width:1080,height:810},Mobile:{width:390,height:844}},Q=e=>{let{label:t,startValue:n,onChange:r,sx:i,disabled:s}=e,l=["e","-","+",",","."];return(0,o.jsxs)(b.kC,{sx:{alignItems:"center",...i},children:[(0,o.jsx)(b.__,{sx:{backgroundColor:"grey07",border:"transparent",borderRight:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorder))},borderRadius:"6px 0px 0px 6px",width:26,height:30,color:"greyIcon",fontWeight:"bold",fontSize:"14px",alignItems:"center",justifyContent:"center",position:"absolute",ml:"1px"},htmlFor:"".concat(t,"-screensize-input"),children:t}),(0,o.jsx)(b.II,{type:"number",name:"".concat(t,"-screensize-input"),disabled:s,sx:{width:80,height:32,p:0,border:"1px solid #E4E2E4",borderRadius:"6px","&::-webkit-outer-spin-button,&::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},color:"greyIcon",textAlign:"center",paddingLeft:26,"&:disabled":{cursor:"not-allowed","&:hover":{border:"1px solid #E4E2E4"},"&:active":{border:"1px solid #E4E2E4",boxShadow:"none"}}},onChange:r,value:n,min:"0",onKeyDown:e=>{l.includes(e.key)&&e.preventDefault()}})]})},G=e=>{let{handleScreenSizeChange:t,screenDimensions:n,actionsDisabled:r}=e,[s,l]=(0,g.useState)(i.DESKTOP),a=e=>{let n=Object.values($).findIndex(t=>JSON.stringify(t)===JSON.stringify(e));l(n<0?i.CUSTOM:Object.keys($)[n]),t(e)};return(0,o.jsx)(b.kC,{sx:{alignItems:"center",pb:"16px",justifyContent:"space-between",variant:"small"},children:(0,o.jsxs)(b.kC,{sx:{alignItems:"center",flex:1},children:[(0,o.jsx)(J,{options:Object.values(i),onChange:e=>{l(e),e!==i.CUSTOM.toString()&&t($[e])},buttonSx:{alignSelf:"start"},currentValue:s,disabled:r}),(0,o.jsx)(Q,{label:"W",startValue:n.width.toString(),onChange:e=>{a({...n,width:Number(e.target.value)})},disabled:r,sx:{mx:2}}),(0,o.jsx)(L.eSQ,{size:16,color:"#6F6E77"}),(0,o.jsx)(Q,{label:"H",startValue:n.height.toString(),onChange:e=>{a({...n,height:Number(e.target.value)})},disabled:r,sx:{ml:2}})]})})},ee=new p.S;var et=e=>{var t,n;let{slice:r,variation:s}=e,{updateSliceMockSuccess:l}=(0,z.Z)(),{simulatorUrl:a,endpoints:c}=(0,f.v9)(e=>({simulatorUrl:(0,T.x0)(e),endpoints:(0,T.gZ)(e)})),d=(0,g.useMemo)(()=>({embedApiEndpoint:new URL(c.PrismicEmbed),authStrategy:"cookie",unsplashApiBaseUrl:new URL(c.PrismicUnsplash),baseUrl:new URL("builder/",c.PrismicWroom)}),[c.PrismicEmbed,c.PrismicUnsplash,c.PrismicWroom]);(0,g.useEffect)(()=>{C.Xe.track({event:"slice-simulator:open"})},[]);let p=(0,g.useRef)(!1);(0,g.useEffect)(()=>{p.current=!0},[]);let S=e=>{p.current&&(p.current=!1,C.Xe.track({event:"editor:widget-used",sliceId:e}))},[y,E]=(0,g.useState)("waiting");(0,g.useEffect)(()=>{if("waiting"===y){let e=setTimeout(()=>{E("failed")},2e4);return()=>clearTimeout(e)}},[y]);let R=e=>{"waiting"===y&&("failed"===e?C.Xe.track({event:"slice-simulator:is-not-running"}):Z(!0),E(e))},[D,W]=(0,g.useState)($[i.DESKTOP]),_=(0,g.useMemo)(()=>O.id.fromSM(r.model),[r.model]),[F,L]=(0,g.useState)(null),A=(0,g.useMemo)(()=>{var e;return(null==F?void 0:F.variation)===s.id?F:(null===(e=r.mocks)||void 0===e?void 0:e.find(e=>e.variation===s.id))||M(s.id)},[F,s.id]),B=(0,g.useMemo)(()=>(0,h.renderSliceMock)(_,A).id,[]),U=w((0,g.useCallback)(()=>()=>({...(0,h.renderSliceMock)(_,A),id:B}),[_,A]),800,[_,A]),[H,Z]=(0,g.useState)(!1),[V,K]=(0,g.useState)(!1),Y=async()=>{if(F){K(!0);try{var e;let t={libraryID:r.from,sliceID:r.model.id,mocks:(null!==(e=r.mocks)&&void 0!==e?e:[]).filter(e=>e.variation!==F.variation).concat(F)},{errors:n}=await (0,C.y3)(t);if(n.length>0)throw n;l(t),v.Am.success("Saved")}catch(e){console.error("Error while saving mock",e),v.Am.error("Error saving content")}K(!1)}};return(0,o.jsxs)(b.kC,{sx:{flexDirection:"column",height:"100vh"},children:[(0,o.jsx)(q,{slice:r,variation:s,isDisplayEditor:H,actionsDisabled:"successful"!==y,toggleIsDisplayEditor:()=>Z(!H),onSaveMock:()=>void Y(),isSavingMock:V}),(0,o.jsx)(b.xu,{sx:{flex:1,bg:"grey07",p:3,display:"flex",flexDirection:"column",height:"calc(100% - 73px - 16px)"},children:(0,o.jsxs)(b.kC,{sx:{flex:1,flexDirection:"row",position:"relative",width:"100%",height:"100%"},children:[(0,o.jsxs)(j.xR,{sx:{display:"flex",height:"100%",flexDirection:"column",flex:1,minWidth:0},children:[(0,o.jsx)(G,{handleScreenSizeChange:W,screenDimensions:D,actionsDisabled:"successful"!==y}),"failed"===y?(0,o.jsx)(N,{onRetrigger:()=>{E("waiting")}}):null,"successful"===y?(0,o.jsx)(X,{apiContent:U,screenDimensions:D,simulatorUrl:a,handleSimulatorConnectionResult:R}):(0,o.jsx)(o.Fragment,{children:"waiting"===y?(0,o.jsxs)(P,{children:[(0,o.jsx)(b.$j,{variant:"styles.spinner"}),(0,o.jsx)(X,{apiContent:U,screenDimensions:D,simulatorUrl:a,dryRun:!0,handleSimulatorConnectionResult:R})]}):null})]}),"successful"===y&&H?(0,o.jsx)(b.kC,{className:"editor",sx:{flexDirection:"column",marginLeft:"16px",maxWidth:"440px",minWidth:"440px",overflowY:"auto"},children:(0,o.jsx)(k.h,{renderError:()=>(0,o.jsx)(x.ax,{title:"Editor error",description:"An error occurred while rendering the editor."}),children:(0,o.jsx)(g.Suspense,{children:(0,o.jsx)(m.aH,{client:ee,children:(0,o.jsx)(u.kS,{config:d,content:A,onContentChange:e=>{L(e),S(r.model.id)},sharedSlice:_},s.id)})})})}):null]})}),!!(null===(t=r.screenshots[s.id])||void 0===t?void 0:t.url)&&(0,o.jsx)(I,{sliceName:r.model.name,screenshotUrl:null===(n=r.screenshots[s.id])||void 0===n?void 0:n.url})]})};function en(){let e=(0,a.useRouter)(),{slice:t,variation:n}=(0,d.Z)();return void 0===t||void 0===n?(e.replace("/"),null):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(l(),{children:(0,o.jsx)("title",{children:"Simulator: ".concat(t.model.name," - Slice Machine")})}),(0,o.jsx)(et,{slice:t,variation:n})]})}}},function(e){e.O(0,[789,872,130,429,888,774,179],function(){return e(e.s=30755)}),_N_E=e.O()}]);
|
|
@@ -1 +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(11699),g=i(43388),j=i(23094),C=i(18566),b=i(80148);async function y(e){let{errors:t,model:i}=await b.managerClient.customTypes.readCustomType({id:e});if(t.length>0)throw t;return i}var _=i(59294),w=i(87446),I=i(14101);let D=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"})}),S=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,_.Ag)(e.query);return void 0!==t&&(0,_.ne)(e.asPath,t)?t:void 0}(e);return void 0!==t?(0,r.jsx)(w.h,{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,C.QT)(y,[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=_.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)(S,{}),children:["Return to ",i.label]}),(0,r.jsx)(f.E,{onClick:()=>{o(!1)},renderStartIcon:()=>(0,r.jsx)(D,{})})]})}},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(58446),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)(D,{})})]})},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)(eD,{children:"not"})," affect your documents until you ",(0,r.jsx)(eD,{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"})]})]})})]})},eD=e=>(0,r.jsx)(f.bL,{...e,color:"inherit",component:"span",variant:"bold"});var eS=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=eS.z.string().min(1),eH=e=>e.code===eS.z.ZodIssueCode.too_small?{message:"This field is required"}:{message:"Invalid value"};var eF=i(86652),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,66,183,344,256,444,484,882,630,593,888,774,179],function(){return e(e.s=31314)}),_N_E=e.O()}]);
|
|
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(18337),g=i(43388),j=i(23094),C=i(18566),b=i(80148);async function y(e){let{errors:t,model:i}=await b.managerClient.customTypes.readCustomType({id:e});if(t.length>0)throw t;return i}var _=i(59294),w=i(87446),I=i(14101);let D=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"})}),S=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,_.Ag)(e.query);return void 0!==t&&(0,_.ne)(e.asPath,t)?t:void 0}(e);return void 0!==t?(0,r.jsx)(w.h,{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,C.QT)(y,[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=_.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)(S,{}),children:["Return to ",i.label]}),(0,r.jsx)(f.E,{onClick:()=>{o(!1)},renderStartIcon:()=>(0,r.jsx)(D,{})})]})}},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(58446),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)(D,{})})]})},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)(eD,{children:"not"})," affect your documents until you ",(0,r.jsx)(eD,{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"})]})]})})]})},eD=e=>(0,r.jsx)(f.bL,{...e,color:"inherit",component:"span",variant:"bold"});var eS=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=eS.z.string().min(1),eH=e=>e.code===eS.z.ZodIssueCode.too_small?{message:"This field is required"}:{message:"Invalid value"};var eF=i(86652),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,66,183,344,256,444,484,882,630,593,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),o=n(23779),l=i(function(e,t,n){return e+(n?" ":"")+o(t)});e.exports=l},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 u},tB:function(){return x}});var i=n(52322),o=n(18337),l=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:o,langSmithUrl:l}=e,r=(0,c.iv)({type:t,library:n,sliceId:i,variationId:o}),s=JSON.stringify({langSmithUrl:l});localStorage.setItem(r,s)}function x(e){let{type:t,library:n,sliceId:i,variationId:o}=e,l=(0,c.iv)({type:t,library:n,sliceId:i,variationId:o});localStorage.removeItem(l)}function u(e){let{type:t,library:n,sliceId:d,variationId:x}=e,{key:u,value:m,done:h}=function(e){let{type:t,library:n,sliceId:i,variationId:o}=e,l=(0,c.iv)({type:t,library:n,sliceId:i,variationId:o}),[s,d]=(0,a.V)(l,void 0,{schema:r.z.object({langSmithUrl:r.z.string().url().optional()})});return{key:l,value:s,done:()=>d(void 0)}}({type:t,library:n,sliceId:d,variationId:x}),[p,f]=(0,l.useState)(),g=e=>()=>{m&&(f(u),s.Xe.track({event:"slice-generation-feedback",type:t,sliceId:d,variationId:x,feedback:e,langSmithUrl:m.langSmithUrl}),h())};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.be,{children:(0,i.jsx)(o.bQ,{anchor:(0,i.jsx)(o.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)(o.i,{children:m&&(0,i.jsxs)(o.D,{flexDirection:"row",justifyContent:"end",gap:8,alignItems:"center",children:[(0,i.jsx)(o.bL,{color:"grey11",children:"Did the AI get it right?"}),(0,i.jsxs)(o.D,{flexDirection:"row",gap:4,children:[(0,i.jsx)(o.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Looks good",children:(0,i.jsx)(o.aZ,{variant:"solid",size:"small",icon:"thumbUp",onClick:g("up")})}),(0,i.jsx)(o.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Needs improvement",children:(0,i.jsx)(o.aZ,{variant:"solid",size:"small",icon:"thumbDown",onClick:g("down")})})]})]})})]})}},33986:function(e,t,n){"use strict";n.d(t,{z:function(){return a}});var i=n(52322),o=n(2784),l=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,o.forwardRef)((e,t)=>{let{label:n,Icon:o,type:a,form:c,isLoading:d=!1,disabled:x=!1,onClick:u,sx:m={},iconSize:h=16,iconFill:p,variant:f="primary",...g}=e;return(0,i.jsx)(l.zx,{ref:t,sx:{...m,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...d?{cursor:"wait !important"}:{}},type:a,form:c,disabled:x||d,onClick:d?void 0:u,variant:f,...g,children:d?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.$j,{size:h,color:s(f),"data-testid":r(g["data-testid"],"spinner")}),o&&n]}):(0,i.jsxs)(i.Fragment,{children:[o&&(0,i.jsx)(o,{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),o=n(63397);n(2784);var l=n(75289);let r=e=>{let{name:t,label:n,placeholder:r,error:s,testId:a,onChange:c}=e;return(0,i.jsxs)(l.xu,{mb:3,children:[(0,i.jsx)(l.__,{htmlFor:t,mb:2,children:n}),(0,i.jsx)(o.gN,{name:t,type:"text",placeholder:r,as:l.II,autoComplete:"off",...c?{onChange:c}:null,...a?{"data-testid":a}:null}),s?(0,i.jsx)(l.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),o=n(63397),l=n(37149),r=n.n(l),s=n(75289),a=n(33986),c=n(55862),d=n(30527);function x(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:l,formId:u,validate:m,onSubmit:h,widthInPx:p,initialValues:f,content:{title:g},cardProps:j,omitFooter:v=!1,isLoading:b=!1,buttonLabel:y="Save",testId:S,actionMessage:C}=e;return r().setAppElement("#__next"),(0,i.jsx)(c.Z,{isOpen:l,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:g,style:{content:{width:null!=p?p:"900px"}},children:(0,i.jsx)(o.J9,{initialValues:f,validate:e=>m?m(e):void 0,onSubmit:e=>{h(e)},children:e=>{let{isValid:l,isSubmitting:r,values:c,errors:m,touched:h,setFieldValue:p,setValues:f}=e;return(0,i.jsx)(o.l0,{id:u,...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)(x,{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||b,children:"Cancel"}),(0,i.jsx)(a.z,{label:y,form:u,type:"submit",disabled:!l||r||b,isLoading:r||b,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:t({isValid:l,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 M}});var i=n(52322),o=n(18337),l=n(97729),r=n.n(l),s=n(5632),a=n(2784),c=n(56580),d=n(88932),x=n(65077),u=n(75289),m=n(43388),h=n(21446),p=n(27213),f=n(51507),g=n(27763),j=n(21442),v=n(58446),b=n(65186),y=n(59326),S=n(34166),C=n(80148);async function I(e){let{sliceName:t,sliceID:n,libraryID:i,sliceVariationIds:o,onSuccess:l}=e;try{let{errors:e}=await C.managerClient.slices.deleteSlice({libraryID:i,sliceID:n});if(e.length>0)throw e;o.forEach(e=>{(0,S.tB)({type:"model",library:i,sliceId:n,variationId:e})}),l(),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 k=n(68968),w=n(33986),z=n(30527),N=n(55862),D=n(54597);let R=e=>{var t;let{isOpen:n,libName:o,sliceId:l,sliceName:r,sliceVariationIds:s,onClose:c}=e,[d,x]=(0,a.useState)(!1),{deleteSliceSuccess:m}=(0,D.Z)(),{syncChanges:h}=(0,k.g)(),{theme:p}=(0,y.B7)(),f=async()=>{x(!0),await I({libraryID:o,sliceID:l,sliceName:r,sliceVariationIds:s,onSuccess:()=>{m(l,o),h()}}),c(),x(!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)(u.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)(u.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(b.$vK,{size:20,color:null===(t=p.colors)||void 0===t?void 0:t.greyIcon}),(0,i.jsx)(u.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,i.jsx)(u.x8,{type:"button",onClick:c})]}),Footer:()=>(0,i.jsxs)(u.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)(u.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)(u.xv,{sx:{fontWeight:"bold"},children:[o,"/",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 W=n(36887),_=n(94160),F=e=>{let{title:t,onCreateNew:n,onCreateFromImage:l,buttonText:r,documentationComponent:s,videoPublicIdUrl:a,...c}=e,d=(0,p.F)({menuType:"Dropdown"});return(0,i.jsxs)(u.xu,{sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"},...c,children:[(0,i.jsx)(u.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)(W.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:a,onPlay:()=>{_.Xe.track({event:"open-video-tutorials",video:a})}})}),(0,i.jsxs)(u.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)(u.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)(u.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:t}),(0,i.jsx)(u.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:s})]}),(0,i.jsxs)(u.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,i.jsxs)(o.ar,{children:[(0,i.jsx)(o.av,{children:(0,i.jsx)(u.zx,{"data-testid":"empty-state-main-button",sx:{flexShrink:0,mr:4},children:r})}),(0,i.jsxs)(o.as,{align:"end",children:[(0,i.jsx)(o.at,{renderStartIcon:()=>d.fromImage.BackgroundIcon,onSelect:l,description:d.fromImage.description,children:d.fromImage.title}),(0,i.jsx)(o.at,{renderStartIcon:()=>d.fromScratch.BackgroundIcon,onSelect:n,description:d.fromScratch.description,children:d.fromScratch.title})]})]}),(0,i.jsx)(u.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),B=n(63908),O=n(26109);async function T(e){let{slice:t,newSliceName:n,onSuccess:i}=e;try{let e=(0,B.PQ)(t,n),{errors:o}=await C.managerClient.slices.renameSlice({libraryID:t.from,model:O.id.fromSM(e.model)});if(o.length>0)throw o;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 L=n(7723),P=n(59532),A=n(46999),E=n(63019);let X=e=>{var t,n;let{slice:o,isOpen:l,onClose:r}=e,{renameSliceSuccess:s}=(0,D.Z)(),{syncChanges:a}=(0,k.g)(),{localLibs:d,remoteLibs:x}=(0,c.v9)(e=>({localLibs:(0,L.Sd)(e),remoteLibs:(0,L.sT)(e)})),m=null!==(t=null==o?void 0:o.model.name)&&void 0!==t?t:"",h=async e=>{o&&(await T({slice:o,newSliceName:e.sliceName,onSuccess:e=>{s(e.from,e.model),a()}}),r())};return(0,i.jsx)(P.Z,{testId:"rename-slice-modal",isOpen:l,widthInPx:"530px",formId:"rename-slice-modal-".concat(null!==(n=null==o?void 0:o.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,x),children:e=>{let{touched:t,errors:n}=e;return(0,i.jsx)(u.xu,{children:(0,i.jsx)(A.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(86652),V=n(39204),q=n(7974),M=()=>{var e,t,n,l;let b=(0,s.useRouter)(),{modalPayload:y,onOpenModal:S}=(0,j.H)(),{openLoginModal:I}=(0,D.Z)(),k=(0,p.F)({menuType:"Dropdown"}),{sliceFilterFn:w,defaultVariationSelector:z}=y,{remoteSlices:N,libraries:W}=(0,c.v9)(e=>({remoteSlices:(0,L.sT)(e),libraries:(0,L.Sd)(e)})),[_,B]=(0,a.useState)(!1),[O,T]=(0,a.useState)(!1),[P,A]=(0,a.useState)(!1),[E,M]=(0,a.useState)(!1),Q=W.filter(e=>e.isLocal),Y=W.map(e=>(e.components=[...e.components].sort((e,t)=>e.model.name.localeCompare(t.model.name)),e)),G=(W||[]).map(e=>e.components).flat(),J=G.length,[K,$]=(0,a.useState)(),ee=()=>{T(!0)},et=()=>{A(!0)},en=async()=>{await C.managerClient.user.checkIsLoggedIn()?M(!0):I()},ei=()=>{M(!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==Q?void 0:Q.length)!==0&&0!==J?(0,i.jsxs)(o.ar,{children:[(0,i.jsx)(o.av,{children:(0,i.jsx)(o.E,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,i.jsxs)(o.as,{align:"end",children:[(0,i.jsx)(o.at,{renderStartIcon:()=>k.fromImage.BackgroundIcon,onSelect:()=>void en(),description:k.fromImage.description,children:k.fromImage.title}),(0,i.jsx)(o.at,{renderStartIcon:()=>k.fromScratch.BackgroundIcon,onSelect:()=>B(!0),description:k.fromScratch.description,children:k.fromScratch.title})]})]}):void 0]}),(0,i.jsxs)(v.RN,{children:[(0,i.jsx)(x.xR,{sx:{display:"flex",flexDirection:"column"},children:Y.length>0?(0,i.jsx)(u.kC,{sx:{flex:1,flexDirection:"column"},children:0===J?(0,i.jsx)(u.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,i.jsx)(F,{title:"What are slices?",onCreateNew:()=>{B(!0)},onCreateFromImage:()=>{en()},buttonText:"Create one",videoPublicIdUrl:q.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)(u.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"})}):Y.map(e=>{let{name:t,isLocal:n,components:o}=e;return(0,i.jsxs)(u.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,i.jsxs)(u.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)(u.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,i.jsx)(u.xv,{children:1===Y.length?"Your slices":t})}),!n&&(0,i.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,i.jsx)(H.Z,{elems:o,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==Q?void 0:Q.length)>0&&(0,i.jsx)(U.Z,{slices:w(G),defaultVariationSelector:z}),(null==Q?void 0:Q.length)>0&&_&&(0,i.jsx)(Z.c,{localLibraries:Q,location:"slices",remoteSlices:N,onSuccess:(e,t)=>{let n=e.variations[0].id,i=g.Y.getBuilderPagePathname({libraryName:t,sliceName:e.name,variationId:n});b.push(i),d.Am.success((0,V.kQ)({path:"".concat(t,"/").concat(e.name,"/model.json")}))},onClose:()=>{B(!1)}}),(0,i.jsx)(X,{isOpen:P,slice:K,onClose:()=>{A(!1)},"data-testid":"rename-slice-modal"}),(0,i.jsx)(R,{isOpen:O,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!==(l=null==K?void 0:K.model.variations)&&void 0!==l?l:[]).map(e=>e.id),onClose:()=>{T(!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})]})]})]})}}},function(e){e.O(0,[898,789,797,397,66,344,444,882,633,593,888,774,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var e,t,n,r,o,u,i,c,f,a={},l={};function d(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={id:e,loaded:!1,exports:{}},r=!0;try{a[e].call(n.exports,n,n.exports,d),r=!1}finally{r&&delete l[e]}return n.loaded=!0,n.exports}d.m=a,e=[],d.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u<e.length;u++){for(var n=e[u][0],r=e[u][1],o=e[u][2],c=!0,f=0;f<n.length;f++)i>=o&&Object.keys(d.O).every(function(e){return d.O[e](n[f])})?n.splice(f--,1):(c=!1,o<i&&(i=o));if(c){e.splice(u--,1);var a=r();void 0!==a&&(t=a)}}return t},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},d.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);d.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach(function(t){u[t]=function(){return e[t]}});return u.default=function(){return e},d.d(o,u),o},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return"static/chunks/
|
|
1
|
+
!function(){"use strict";var e,t,n,r,o,u,i,c,f,a={},l={};function d(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={id:e,loaded:!1,exports:{}},r=!0;try{a[e].call(n.exports,n,n.exports,d),r=!1}finally{r&&delete l[e]}return n.loaded=!0,n.exports}d.m=a,e=[],d.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u<e.length;u++){for(var n=e[u][0],r=e[u][1],o=e[u][2],c=!0,f=0;f<n.length;f++)i>=o&&Object.keys(d.O).every(function(e){return d.O[e](n[f])})?n.splice(f--,1):(c=!1,o<i&&(i=o));if(c){e.splice(u--,1);var a=r();void 0!==a&&(t=a)}}return t},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},d.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);d.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach(function(t){u[t]=function(){return e[t]}});return u.default=function(){return e},d.d(o,u),o},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return"static/chunks/6611d287.1714222015f895ea.js"},d.miniCssF=function(e){},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.hmd=function(e){return(e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:function(){throw Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e},d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",d.l=function(e,t,n,u){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var i,c,f=document.getElementsByTagName("script"),a=0;a<f.length;a++){var l=f[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+n){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,d.nc&&i.setAttribute("nonce",d.nc),i.setAttribute("data-webpack",o+n),i.src=d.tu(e)),r[e]=[t];var s=function(t,n){i.onerror=i.onload=null,clearTimeout(p);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=s.bind(null,i.onerror),i.onload=s.bind(null,i.onload),c&&document.head.appendChild(i)},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},d.tt=function(){return void 0===u&&(u={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(u=trustedTypes.createPolicy("nextjs#bundler",u))),u},d.tu=function(e){return d.tt().createScriptURL(e)},d.p="/_next/",i={272:0},d.f.j=function(e,t){var n=d.o(i,e)?i[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(272!=e){var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=d.p+d.u(e),u=Error();d.l(o,function(t){if(d.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}else i[e]=0}},d.O.j=function(e){return 0===i[e]},c=function(e,t){var n,r,o=t[0],u=t[1],c=t[2],f=0;if(o.some(function(e){return 0!==i[e]})){for(n in u)d.o(u,n)&&(d.m[n]=u[n]);if(c)var a=c(d)}for(e&&e(t);f<o.length;f++)r=o[f],d.o(i,r)&&i[r]&&i[r][0](),i[r]=0;return d.O(a)},(f=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(c.bind(null,0)),f.push=c.bind(null,f.push.bind(f)),d.nc=void 0}();
|