slice-machine-ui 1.19.2 → 1.19.3-dev-next-release.0
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/components/Simulator/index.tsx +4 -6
- package/out/404.html +1 -1
- package/out/_next/static/chunks/{585-f3dca093db4b3792.js → 125-f0e2eb84ee39757a.js} +1 -3
- package/out/_next/static/chunks/18539003-371d86ea83e7293b.js +97 -0
- package/out/_next/static/chunks/{125-e3857af2068bbedf.js → 474-2393e400314474be.js} +2 -2
- package/out/_next/static/chunks/482-39cef3a713901788.js +1 -0
- package/out/_next/static/chunks/{550-1dafbcec5d50b384.js → 550-e72c08c598051224.js} +1 -1
- package/out/_next/static/chunks/{80-c513d12da6156fb7.js → 80-821a0b5d4ad61185.js} +1 -1
- package/out/_next/static/chunks/840-884e41a48b92e5d3.js +1 -0
- package/out/_next/static/chunks/904-55ff54caf14254dc.js +1 -0
- package/out/_next/static/chunks/958-be627006594efb21.js +1 -0
- package/out/_next/static/chunks/pages/_app-152015a55bf443c9.js +439 -0
- package/out/_next/static/chunks/pages/{changelog-75b0bf58d1f3045d.js → changelog-fa36b9995c26e1d7.js} +1 -1
- package/out/_next/static/chunks/pages/{changes-9dcb1cdaa8b10560.js → changes-e388be4457a43c3a.js} +1 -1
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-aa37e07c96c8f9b5.js → [customTypeId]-3a37eb3373bb8823.js} +1 -1
- package/out/_next/static/chunks/pages/{index-5266b7f0ca55025a.js → index-941b44c74dd339e4.js} +1 -1
- package/out/_next/static/chunks/pages/labs-ebce03a4e7a95a4e.js +1 -0
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-d445f5cabeb460c0.js → [pageTypeId]-733f3890c0466a05.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-5e441f8b049cf91b.js → simulator-79a62d775e64898c.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-c9b5ff7076d2b19b.js → [variation]-2282320bb9091898.js} +1 -1
- package/out/_next/static/chunks/pages/{slices-247c480530e98426.js → slices-22db04643850c1d8.js} +1 -1
- package/out/_next/static/css/{26b51745402a92af.css → 16b41648cd1de03b.css} +1 -1
- package/out/_next/static/css/{1fbd45881dcf43c4.css → 3e88bd24e38f18d0.css} +1 -1
- package/out/_next/static/css/412af4286eb0b283.css +1 -0
- package/out/_next/static/css/{f585032018f6024b.css → 51597cd1f01c4889.css} +1 -1
- package/out/_next/static/css/{e4f4acc81f000d9c.css → 6e4843007ff41825.css} +1 -1
- package/out/_next/static/css/{22d69420bda374a7.css → 867d8d7ab4a75762.css} +1 -1
- package/out/_next/static/xdIrFCP9it-7L81Mcll4H/_buildManifest.js +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 +7 -7
- package/src/components/ContentTabs/ContentTabs.css.ts +1 -1
- package/src/components/SideNav/SideNav.css.ts +11 -11
- package/src/features/labs/labsList/LabsListItem.tsx +1 -1
- package/out/_next/static/8rc3TRisi8gOyPYwHa35C/_buildManifest.js +0 -1
- package/out/_next/static/chunks/18539003-1bb05c8aa7db2bc2.js +0 -97
- package/out/_next/static/chunks/482-bfe6dbc93fb63a0d.js +0 -1
- package/out/_next/static/chunks/840-c317c8ff8de0f202.js +0 -1
- package/out/_next/static/chunks/904-438ff06c6c7e18f3.js +0 -1
- package/out/_next/static/chunks/958-4f94d552d296c608.js +0 -1
- package/out/_next/static/chunks/pages/_app-19c4fbcd62918db2.js +0 -428
- package/out/_next/static/chunks/pages/labs-2349c21fbac1bd23.js +0 -1
- package/out/_next/static/css/66b3836ab88b0c5c.css +0 -1
- /package/out/_next/static/{8rc3TRisi8gOyPYwHa35C → xdIrFCP9it-7L81Mcll4H}/_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(57825)}])},57825:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return H}});var i,t,s=r(52322),o=r(97729),a=r.n(o),c=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(57825)}])},57825:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return H}});var i,t,s=r(52322),o=r(97729),a=r.n(o),c=r(22715),l=r(65077),d=r(75289),p=r(56580),x=r(39092),g=r(2784),h=r(62230),u=r(12170),f=function(e){var n=e.type,r=e.hasUpToDateVersions;return(0,s.jsx)(d.xv,{sx:(0,h.Z)({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})},v=function(e){var n=e.isSelected,r=e.onClick,i=e.versionNumber,t=e.tags,o=e.hasUpToDateVersions;return(0,s.jsxs)(d.kC,{sx:(0,h.Z)({p:1,borderRadius:"4px",cursor:"pointer",transition:"200ms all",justifyContent:"space-between",alignItems:"center"},n?{color:"purple",bg:(0,u.DZ)("purple",.95)}:{"&:hover":{bg:"grey01"}}),onClick:r,children:[(0,s.jsx)(d.xv,{children:i}),(0,s.jsx)(d.kC,{sx:{gap:"8px"},children:t.map(function(e){return(0,s.jsx)(f,{type:e,hasUpToDateVersions:o},e)})})]})};(t=i||(i={})).Latest="LATEST",t.LatestNonBreaking="LATEST-NON-BREAKING",t.Current="CURRENT";var m=function(e){var n,r=e.changelog,t=e.selectedVersion,o=e.selectVersion,a=function(e){var n=[];return e===l?n.push(i.Latest):e===r.sliceMachine.latestNonBreakingVersion&&n.push(i.LatestNonBreaking),e===r.sliceMachine.currentVersion&&n.push(i.Current),n},l=null===(n=r.sliceMachine.versions[0])||void 0===n?void 0:n.versionNumber,p=!r.adapter.updateAvailable&&!r.sliceMachine.updateAvailable;return(0,s.jsxs)(d.kC,{sx:{minWidth:"228px",borderRight:"1px dashed",borderColor:c.TV.color.greyLight6,flexDirection:"column",paddingRight:"48px"},children:[(0,s.jsxs)(d.kC,{sx:{flexDirection:"column",borderBottom:"1px dashed",borderColor:c.TV.color.greyLight6,paddingBottom:"28px"},children:[(0,s.jsx)(d.xv,{sx:{fontSize:"20px",fontWeight:500,lineHeight:"32px"},children:"Changelog"}),(0,s.jsx)(d.xv,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"24px",marginTop:"28px"},children:"All versions"})]}),(0,s.jsx)(d.kC,{sx:{mt:"24px",flexDirection:"column",gap:"4px",overflow:"auto"},children:r.sliceMachine.versions.map(function(e,n){return(0,s.jsx)(v,{isSelected:(null==t?void 0:t.versionNumber)===e.versionNumber,onClick:function(){return o(e)},versionNumber:e.versionNumber,tags:a(e.versionNumber),hasUpToDateVersions:p},"versionBadge-".concat(e.versionNumber,"-").concat(n))})})]})},b={MAJOR:"MAJOR",MINOR:"MINOR",PATCH:"PATCH",FIRST:"FIRST"},j=function(e){var n=e.versionKind,r=(0,h.Z)({fontSize:"14px",padding:"2px 4px",borderRadius:"4px",textTransform:"uppercase"},n===b.MAJOR?{color:"purple",bg:(0,u.DZ)("purple",.85)}:{color:"grey05",bg:"grey02"});return(0,s.jsx)(d.xv,{sx:r,children:n})},k=r(19870),C=function(e){var n=e.releaseNote;return(0,s.jsx)(d.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:k.TU.parse(n)}})},N=r(951),T=r(8346),y=function(e){var n,r,i,t,o,a=e.changelog,c=e.selectedVersion,l=e.packageManager,p=c.versionNumber===a.sliceMachine.versions[0].versionNumber,x=(n={sliceMachineVersionToInstall:p?"latest":c.versionNumber,isLatestSliceMachineVersion:p,adapterName:a.adapter.name},r=n.sliceMachineVersionToInstall,i=n.isLatestSliceMachineVersion,t=n.adapterName,o=["slice-machine-ui@".concat(r)],i&&o.push("".concat(t,"@latest")),o),g=function(e,n){var 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)}}(l,x),h=a.adapter.updateAvailable&&!a.sliceMachine.updateAvailable;return(0,s.jsxs)(s.Fragment,{children:[h&&p&&(0,s.jsxs)(d.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)(d.kC,{sx:{flexDirection:"column",gap:"16px",padding:"16px",bg:"grey01"},children:[(0,s.jsx)(d.xv,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"20px"},children:"How to install"}),(0,s.jsxs)(d.kC,{sx:{gap:"8px"},children:[(0,s.jsx)(T.Z,{codeStyle:{color:"white",flex:1,padding:"8px"},sx:{flex:1},children:g}),(0,s.jsx)(d.zx,{variant:"secondary",onClick:function(){navigator.clipboard.writeText(g)},children:"Copy"})]})]})]})},S=function(){return(0,s.jsxs)("div",{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=function(e){var n,r=e.changelog,i=e.selectedVersion,t=e.packageManager;return(0,s.jsxs)(d.kC,{sx:{flexDirection:"column"},children:[(0,s.jsxs)(d.kC,{sx:{padding:"0px 0px 32px 32px",borderBottom:"1px dashed",borderColor:c.TV.color.greyLight6,justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(d.xv,{sx:{fontSize:"24px",fontWeight:600,lineHeight:"32px"},children:"Version ".concat(i.versionNumber)}),!!i.kind&&(0,s.jsx)(j,{versionKind:i.kind})]}),(0,s.jsxs)(d.kC,{sx:{flexDirection:"column",padding:"24px 0px 0px 32px",gap:"24px"},children:[(null===(n=i.releaseNote)||void 0===n?void 0:n.includes("# Breaking Change"))&&(0,s.jsxs)(d.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)(y,{changelog:r,selectedVersion:i,packageManager:t}),(null==i?void 0:i.releaseNote)?(0,s.jsx)(C,{releaseNote:i.releaseNote}):(0,s.jsx)(S,{})]})]})},V=r(32665),L=r(3098),R=r(22031);function w(){var e=(0,p.v9)(function(e){return{changelog:(0,x.Sx)(e),packageManager:(0,x.Ak)(e),isChangelogLoading:(0,V.hg)(e,L.z.CHANGELOG)}}),n=e.changelog,r=e.packageManager,i=e.isChangelogLoading,t=n.sliceMachine.versions[0],o=(0,g.useState)(t||void 0),a=o[0],h=o[1];(0,g.useEffect)(function(){h(t)},[t]);var u=0===n.sliceMachine.versions.length||!a;return(0,s.jsx)(R.LN,{children:(0,s.jsx)(R.RN,{children:(0,s.jsx)(l.xR,{sx:{display:"flex",minWidth:0},children:i?(0,s.jsx)(c._3,{}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(m,{changelog:n,selectedVersion:a,selectVersion:function(e){return h(e)}}),u?(0,s.jsx)(d.kC,{sx:{paddingLeft:"32px"},children:(0,s.jsx)(S,{})}):(0,s.jsx)(M,{changelog:n,selectedVersion:a,packageManager:r})]})})})})}function H(){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a(),{children:(0,s.jsx)("title",{children:"Changelog - Slice Machine"})}),(0,s.jsx)(w,{})]})}}},function(e){e.O(0,[870,774,888,179],function(){return e(e.s=37782)}),_N_E=e.O()}]);
|
package/out/_next/static/chunks/pages/{changes-9dcb1cdaa8b10560.js → changes-e388be4457a43c3a.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[849],{21985:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changes",function(){return t(4920)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return u}});var s=t(62230),i=t(85244),r=t(98240),o=t(52322),a=t(2784),l=t(75289),c=function(e,n){return e?"".concat(e,"-").concat(n):""},d=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},u=(0,a.forwardRef)(function(e,n){var t=e.label,a=e.Icon,u=e.type,x=e.form,h=e.isLoading,m=void 0!==h&&h,p=e.disabled,f=e.onClick,g=e.sx,j=e.iconSize,v=void 0===j?16:j,y=e.iconFill,b=e.variant,_=void 0===b?"primary":b,C=(0,r.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,o.jsx)(l.zx,(0,i.Z)((0,s.Z)({ref:n,sx:(0,s.Z)((0,i.Z)((0,s.Z)({},void 0===g?{}:g),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),m?{cursor:"wait !important"}:{}),type:u,form:x,disabled:void 0!==p&&p||m,onClick:m?void 0:f,variant:_},C),{children:m?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(l.$j,{size:v,color:d(_),"data-cy":c(C["data-cy"],"spinner")}),a&&t]}):(0,o.jsxs)(o.Fragment,{children:[a&&(0,o.jsx)(a,{size:v,fill:y,"data-cy":c(C["data-cy"],"icon")}),t]})}))})},59469:function(e,n,t){"use strict";var s=t(62230),i=t(52322),r=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,o=e.defineElementKey,a=e.gridTemplateMinPx,l=e.gridGap,c=e.sx;return(0,i.jsx)(r.xu,{as:"section",sx:(0,s.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===a?"320px":a,", 1fr))"),gridGap:void 0===l?"16px":l,pt:2},c),children:n.map(function(e,n){return e?(0,i.jsx)("span",{children:t(e,n)},"".concat(o(e),"-").concat(n+1)):null})})}},4920:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ed}});var s=t(52322),i=t(71651),r=t(2784),o=t(97729),a=t.n(o),l=t(65077),c=t(56580),d=t(22031),u=t(75289),x=t(951),h=function(e){var n=e.children;return(0,s.jsx)(u.kC,{sx:{alignItems:"center",justifyContent:"space-between",mt:"8px",bg:"grey02",borderRadius:4,padding:"12px 16px"},children:n})},m=t(39097),p=t.n(m),f=t(7819),g=t(34728),j=t(67445),v=function(e){var n=e.ct,t=e.status,i=e.authStatus,r=e.isOnline;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.xu,{as:"td",style:{width:"40%"},children:(0,s.jsx)(u.xv,{sx:{fontWeight:500},children:n.label})}),(0,s.jsx)(u.xu,{as:"td",style:{width:"40%"},children:n.id}),(0,s.jsx)(u.xu,{as:"td",style:{width:"20%"},children:(0,s.jsx)(g.O,{authStatus:i,isOnline:r,modelStatus:t,modelType:"CustomType"})})]})},y=function(e){var n=e.customTypes,t=e.modelsStatuses,i=e.authStatus,r=e.isOnline;return(0,s.jsxs)(u.xu,{as:"table","data-legacy-component":!0,children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"transparent small",children:[(0,s.jsx)(u.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"Name"}),(0,s.jsx)(u.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"API ID"}),(0,s.jsx)(u.xu,{as:"th",sx:{width:"20%",fontWeight:600},children:"Status"})]})}),(0,s.jsx)("tbody",{children:n.map(function(e){return(0,f.TG)(e)?(0,s.jsx)(p(),{passHref:!0,href:j.cd[e.local.format].getBuilderPagePathname(e.local.id),legacyBehavior:!0,children:(0,s.jsx)("tr",{tabIndex:0,children:(0,s.jsx)(v,{ct:e.local,status:t.customTypes[e.local.id],authStatus:i,isOnline:r,modelsStatuses:t},e.local.id)})},e.local.id):(0,s.jsx)("tr",{tabIndex:0,className:"disabled",children:(0,s.jsx)(v,{ct:e.remote,status:t.customTypes[e.remote.id],authStatus:i,isOnline:r,modelsStatuses:t},e.remote.id)})})})]})},b=t(59469),_=t(84449),C=t(5479),S=t(47731),T=t(32681),D=t(65958),k=function(e){var n=e.unSyncedCustomTypes,t=e.unSyncedSlices,i=e.modelsStatuses,r=e.authStatus,o=e.isOnline,a=(0,S.H)(),l=a.modalPayload,c=a.onOpenModal,d=l.sliceFilterFn,m=l.defaultVariationSelector,p=t.filter(function(e){return i.slices[e.model.id]!==T.G.Deleted});return(0,s.jsxs)(s.Fragment,{children:[n.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h,{children:(0,s.jsxs)(u.xu,{children:[(0,s.jsx)(u.xv,{variant:"heading",children:"Types"}),(0,s.jsx)(u.xv,{variant:"grey",sx:{ml:"8px"},children:n.length})]})}),(0,s.jsx)(y,{customTypes:n,modelsStatuses:i,authStatus:r,isOnline:o})]}),t.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.xu,{sx:{mb:"8px"},children:(0,s.jsxs)(h,{children:[(0,s.jsxs)(u.xu,{children:[(0,s.jsx)(u.xv,{variant:"heading",children:"Slices"}),(0,s.jsx)(u.xv,{variant:"grey",sx:{ml:"8px"},children:t.length})]}),(0,s.jsxs)(u.xu,{children:[t.some(function(e){return(0,C.cx)(e)>0&&i.slices[e.model.id]!==T.G.Deleted})&&(0,s.jsxs)(u.xv,{sx:{mr:3,color:"warning02",fontSize:"12px",lineHeight:"16px",fontWeight:600},children:[(0,s.jsx)(x.sQg,{size:16,style:{marginRight:"4px",position:"relative",top:"3px"}}),"Missing Screenshots"]}),(0,s.jsxs)(u.zx,{variant:"darkSmall",onClick:function(){return c({sliceFilterFn:function(e){return e}})},children:[(0,s.jsx)(x.hOO,{style:{color:"#FFF",fontSize:"15px",position:"relative",top:"3px",marginRight:"4px"}})," ","Update all screenshots"]})]})]})}),(0,s.jsx)(b.Z,{gridGap:"32px 16px",elems:t,gridTemplateMinPx:"305px",defineElementKey:function(e){return e.model.name},renderElem:function(e){var n=i.slices[e.model.id];return(0,s.jsx)(D.b,{action:{type:"status",authStatus:r,isOnline:o,modelStatus:n},isDeleted:n===T.G.Deleted,mode:"navigation",onUpdateScreenshot:function(){c({sliceFilterFn:function(n){return n.filter(function(n){return n.model.id===e.model.id})}})},slice:e,variant:"solid"})}}),(0,s.jsx)(_.Z,{slices:d(p),defaultVariationSelector:m})]})]})},O=t(91914),w=function(){return(0,s.jsx)(u.kC,{sx:{justifyContent:"center",alignItems:"center",flex:1},children:(0,s.jsxs)(u.kC,{sx:{flexDirection:"column",alignItems:"center",transform:"translateY(-50%)"},children:[(0,s.jsx)(O.wQ1,{size:48}),(0,s.jsx)(u.xv,{sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",mb:"8px",mt:"2px"},children:"No internet connection"}),(0,s.jsx)(u.xv,{sx:{fontSize:"13px",lineHeight:"24px"},children:"You need a stable internet connection to review and push changes"})]})})},Z=t(90374),E=function(){var e=(0,Z.Z)().openLoginModal;return(0,s.jsx)(u.kC,{sx:{justifyContent:"center",alignItems:"center",flex:1},children:(0,s.jsxs)(u.kC,{sx:{flexDirection:"column",alignItems:"center",transform:"translateY(-50%)"},children:[(0,s.jsx)(u.xv,{sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",mb:"8px",mt:"2px"},children:"Could not access your repository"}),(0,s.jsx)(u.xv,{sx:{fontSize:"13px",lineHeight:"24px"},children:"You need to log in to Prismic in order to push your changes."}),(0,s.jsx)(u.zx,{sx:{mt:"24px"},onClick:function(){return e()},children:"Log in to Prismic"})]})})},R=t(5632),N=t.n(R),z=t(2754),F=t(34543),I=t(62230),M=t(85244),H=t(98240),P=t(6277);t(25977);var W={primary:"_1ecs97d74o _1ecs97d74p _1ecs97d74i _1ecs97d74j _1ecs97d74q _1ecs97d74r",secondary:"_1ecs97d6pe _1ecs97d6pf _1ecs97d6p8 _1ecs97d6p9 _1ecs97d6pg _1ecs97d6ph"},A={normal:"ovkapw1",smallBold:"ovkapw2",inherit:"ovkapw3 _1ecs97d9gj"},B=function(e){var n=e.children,t=e.color,o=e.endIcon,a=e.href,l=e.textVariant,c=void 0===l?"smallBold":l,d=(0,H.Z)(e,["children","color","endIcon","href","textVariant"]);return(0,s.jsxs)("a",(0,M.Z)((0,I.Z)({href:a,target:"_blank",rel:"noreferrer"},d),{className:(0,P.Z)("ovkapw0 _1ecs97d9bi _1ecs97d9gd _1ecs97d9bk _1ecs97d9bq",W[void 0===t?"primary":t]),children:[(0,s.jsx)(i.xv,{component:"span",color:"inherit",variant:c,children:n}),(0,r.isValidElement)(o)?(0,r.cloneElement)(o,{className:(0,P.Z)(o.props.className,"_1ecs97d9tn",A[c])}):null]}))},G=t(39092),U=function(){var e,n=(e=(0,c.v9)(function(e){return{repoName:(0,G.MY)(e)}}).repoName,"https://".concat(e,".prismic.io/documents/working"));return(0,s.jsxs)(z.R$,{style:{alignSelf:"center",marginTop:i.TV.size[72]},children:[(0,s.jsx)(z.u2,{children:(0,s.jsx)(i.Ee,{src:"/blank-slate-changes-uptodate.png",sizing:"cover"})}),(0,s.jsxs)(z.T9,{children:[(0,s.jsx)(z._T,{children:"Everything up-to-date"}),(0,s.jsx)(z.nf,{children:"You have no changes staged. Your changes appear here after you have saved them, while they're waiting to be pushed to the Page Builder. Ready to get going?"}),(0,s.jsxs)(z.Qj,{children:[(0,s.jsx)(i.zx,{onClick:function(){N().push("/")},children:"Create a page type"}),(0,s.jsx)(B,{endIcon:(0,s.jsx)(F.AlO,{}),textVariant:"normal",href:n,children:"Create content"})]})]})]})},L=t(79096),V=t(67764),Y=t(32665),q=t(3098),X=t(56577),Q=t(24340),$=t(77174),J=t(49471),K=t(40432),ee=t(78656),en=function(e){var n=e.ctName,t=e.numberOfDocuments,i=e.link,r=e.isOverLimit;return(0,s.jsxs)(u.Zb,{sx:{mb:12},variant:"drawerCard","data-cy":"AssociatedDocumentsCard-".concat(n),children:[(0,s.jsxs)(u.kC,{sx:{flexDirection:"column"},children:[(0,s.jsx)(u.xv,{children:n}),(0,s.jsxs)(u.xv,{sx:{color:"textClear",fontSize:"12px",lineHeight:"16px"},children:[t," documents"]})]}),(0,s.jsx)(u.rU,{href:i,target:"_blank",variant:"cardSmall",sx:{color:void 0!==r&&r?"danger":"purple08"},children:"View documents"})]})},et=function(e){var n=e.format,t=e.id,i=e.name;return(0,s.jsxs)(u.Zb,{sx:{mb:12},variant:"drawerCard","data-cy":"CustomTypesReferencesCard-".concat(i),children:[(0,s.jsxs)(u.kC,{sx:{flexDirection:"column"},children:[(0,s.jsx)(u.xv,{children:i}),(0,s.jsx)(u.xv,{sx:{color:"textClear",fontSize:"12px",lineHeight:"16px"},children:"Missing Slices"})]}),(0,s.jsxs)(u.rU,{href:j.cd[n].getBuilderPagePathname(t),target:"_blank",variant:"cardSmall",children:["View ",ee.$[n].name({start:!1,plural:!1})]},t)]})},es=t(79797),ei=t(54132),er=function(e){var n=e.isOpen,t=e.title,i=e.footer,r=e.explanations,o=(0,Z.Z)().closeModals;return(0,s.jsx)(es.Z,{placement:"right",open:n,level:null,onClose:o,width:496,children:(0,s.jsx)(ei.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:function(){return(0,s.jsxs)(u.kC,{sx:{p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,s.jsx)(u.kC,{sx:{alignItems:"center"},children:(0,s.jsx)(u.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:t})}),(0,s.jsx)(u.x8,{type:"button",onClick:function(){return o()}})]})},Footer:function(){return(0,s.jsx)(u.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center",paddingRight:16,borderTop:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorders))},backgroundColor:"white",padding:20},children:i})},children:r})})},eo=function(e){var n=e.onToggle,t=e.isConfirmed,i=e.sx;return(0,s.jsxs)(u.kC,{sx:(0,I.Z)({borderRadius:6,flexDirection:"column",backgroundColor:"grey03",padding:12,width:"100%"},i),children:[(0,s.jsx)(u.xv,{sx:{fontWeight:"bold",mb:2},children:"Are you sure to proceed?"}),(0,s.jsxs)(u.__,{sx:{mt:"4px",py:1},variant:"large",children:[(0,s.jsx)(u.XZ,{defaultChecked:t,onChange:n,variant:"forms.checkbox.dark"}),"Delete these Documents"]})]})},ea=function(e){var n=e.pushChanges,t=(0,r.useState)(!1),i=t[0],o=t[1],a=(0,c.v9)(function(e){return{isDeleteDocumentsDrawerOpen:(0,$.gP)(e,Q.q.SOFT_DELETE_DOCUMENTS_DRAWER),remoteOnlyCustomTypes:(0,J.Ch)(e).filter(f.yp),modalData:e.pushChanges}}),l=a.isDeleteDocumentsDrawerOpen,d=a.remoteOnlyCustomTypes,x=a.modalData,h=(0,Z.Z)(),m=h.closeModals,p=h.openToaster;if(!l)return null;if((null==x?void 0:x.type)!=="SOFT")return p("No change data",K.Jf.ERROR),null;var g=x.details.customTypes.map(function(e){var n,t=d.find(function(n){return(0,f.n5)(n)===e.id});return void 0===t?null:(0,s.jsx)(en,{isOverLimit:!0,ctName:null!==(n=t.remote.label)&&void 0!==n?n:t.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,s.jsx)(er,{isOpen:l,title:"Confirm deletion",footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eo,{onToggle:function(){o(!i)},isConfirmed:i,sx:{mb:10}}),(0,s.jsx)(X.z,{label:"Push changes",variant:"primary",onClick:function(){m(),n(i)},disabled:!i,sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}})]}),explanations:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:"This action will also delete Documents."}),(0,s.jsxs)(u.xv,{sx:{mb:24},children:[x.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."]}),g]})})},el=function(e){var n=e.pushChanges,t=(0,c.v9)(function(e){return{isDeleteDocumentsDrawerOpen:(0,$.gP)(e,Q.q.HARD_DELETE_DOCUMENTS_DRAWER),remoteOnlyCustomTypes:(0,J.Ch)(e).filter(f.yp),modalData:e.pushChanges}}),i=t.isDeleteDocumentsDrawerOpen,r=t.remoteOnlyCustomTypes,o=t.modalData,a=(0,Z.Z)(),l=a.closeModals,d=a.openToaster;if(!i)return null;if((null==o?void 0:o.type)!=="HARD")return d("No change data",K.Jf.ERROR),null;var x=o.details.customTypes.map(function(e){var n,t=r.find(function(n){return(0,f.n5)(n)===e.id});return void 0===t?null:(0,s.jsx)(en,{isOverLimit:!0,ctName:null!==(n=t.remote.label)&&void 0!==n?n:t.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,s.jsx)(er,{isOpen:i,title:"Manual action required",footer:(0,s.jsx)(X.z,{label:"Try again",variant:"primary",onClick:function(){l(),n(!1)},sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}}),explanations:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(u.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:["Your type",o.details.customTypes.length>1&&"s"," cannot be deleted."]}),(0,s.jsxs)(u.xv,{sx:{mb:24},children:[o.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."]}),x]})})},ec=function(e){var n=e.pushChanges,t=(0,c.v9)(function(e){return{isOpen:(0,$.gP)(e,Q.q.REFERENCES_MISSING_DRAWER),localCustomTypes:(0,J.Ch)(e).filter(f.TG),modalData:e.pushChanges}}),i=t.isOpen,r=t.modalData,o=t.localCustomTypes,a=(0,Z.Z)(),l=a.closeModals,d=a.openToaster;if(!i)return null;if((null==r?void 0:r.details)===void 0)return d("No change data",K.Jf.ERROR),null;var x=(null==r?void 0:r.details.customTypes.length)>1,h=r.details.customTypes.map(function(e){var n,t=o.find(function(n){return(0,f.n5)(n)===e.id});return void 0===t?null:(0,s.jsx)(et,{format:t.local.format,id:t.local.id,name:null!==(n=t.local.label)&&void 0!==n?n:t.local.id})});return(0,s.jsx)(er,{isOpen:i,title:"Missing Slices",footer:(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(X.z,{label:"Try again",variant:"primary",onClick:function(){l(),n(!1)},sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}})}),explanations:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(u.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:["You have",x?"":" a"," type",x?"s":""," that reference"," ",x?"":"s"," one or more missing Slices"]}),(0,s.jsxs)(u.xv,{sx:{mb:24},children:["Before pushing, remove references to any missing Slices by opening"," ","the affected type",x?"s":""," and clicking the"," ",(0,s.jsx)("b",{children:"Save"})," button."]}),h]})})},ed=function(){var e=(0,V.X)(),n=e.unSyncedSlices,t=e.unSyncedCustomTypes,o=e.modelsStatuses,u=e.authStatus,x=e.isOnline,h=(0,r.useMemo)(function(){var e;return{changedSlices:n.map(function(e){return{slice:e,status:o.slices[e.model.id]}}).filter(function(e){return V.O.includes(e.status)}),changedCustomTypes:t.map(function(e){return(0,f.TG)(e)?e.local:e.remote}).map(function(e){return{customType:e,status:o.customTypes[e.id]}}).filter(function(e){return V.O.includes(e.status)})}},[n,t,o]),m=h.changedSlices,p=h.changedCustomTypes,g=(0,Z.Z)(),j=g.pushChanges,v=g.closeModals,y=(0,c.v9)(function(e){return{isSyncing:(0,Y.hg)(e,q.z.CHANGES_PUSH)}}).isSyncing;(0,r.useEffect)(function(){return function(){v()}},[]);var b=n.length+t.length,_=function(e){return j({confirmDeleteDocuments:e,changedSlices:m,changedCustomTypes:p})},C=(0,r.useMemo)(function(){return x?u===L.t.UNAUTHORIZED||u===L.t.FORBIDDEN?(0,s.jsx)(E,{}):0===b?(0,s.jsx)(U,{}):(0,s.jsx)(k,{unSyncedSlices:n,unSyncedCustomTypes:t,modelsStatuses:o,authStatus:u,isOnline:x}):(0,s.jsx)(w,{})},[x,u,b,n,t,o,]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a(),{children:(0,s.jsx)("title",{children:"Changes - Slice Machine"})}),(0,s.jsxs)(d.LN,{children:[(0,s.jsxs)(d.wd,{children:[(0,s.jsx)(d.Cx,{folder:"Changes"}),(0,s.jsx)(d.K2,{children:(0,s.jsx)(i.zx,{onClick:function(){return _(!1)},loading:y,disabled:0===b||!x||u===L.t.UNAUTHORIZED||u===L.t.FORBIDDEN||y,"data-cy":"push-changes",children:"Push Changes"})})]}),(0,s.jsx)(d.RN,{children:(0,s.jsxs)(l.xR,{sx:{display:"flex",flexDirection:"column"},children:[C,(0,s.jsx)(ea,{pushChanges:_}),(0,s.jsx)(el,{pushChanges:_}),(0,s.jsx)(ec,{pushChanges:_})]})})]})]})}},2754:function(e,n,t){"use strict";t.d(n,{R$:function(){return d},Qj:function(){return p},T9:function(){return x},nf:function(){return m},u2:function(){return u},_T:function(){return h}});var s=t(67557),i=t(62230),r=t(85244),o=t(98240),a=t(52322),l=t(6277),c=t(71651);t(41236);var d=function(e){var n=e.backgroundImage,t=e.style,c=(0,o.Z)(e,["backgroundImage","style"]),d=void 0!==n;return(0,a.jsx)("article",(0,r.Z)((0,i.Z)({},c),{className:(0,l.Z)("_18bjhbz0 _1ecs97d9bi _1ecs97d9bj _1ecs97d9bk _1ecs97d9bt _1ecs97d9uk _1ecs97d9um _1ecs97d9uo _1ecs97d268 _1ecs97d2dl _1ecs97d9d7 _1ecs97d9ej _1ecs97d9ex _1ecs97d9c7",(0,s.Z)({},"_18bjhbz1 _1ecs97d9cf _1ecs97d9h6",d)),style:(0,i.Z)({backgroundImage:d?"url(".concat(n,")"):void 0},t)}))},u=function(e){return(0,a.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_1ecs97d9bi _1ecs97d9bj _1ecs97d9bk _1ecs97d9bt _1ecs97d48s _1ecs97d4g5 _1ecs97d9ep _1ecs97d9f1 _1ecs97d9c7"}))},x=function(e){return(0,a.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz3 _1ecs97d9bi _1ecs97d9bj _1ecs97d9bk _1ecs97d9bt _1ecs97d9rr"}))},h=function(e){return(0,a.jsx)(c.xv,(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz4"}))},m=function(e){return(0,a.jsx)(c.xv,(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz5",color:"grey11"}))},p=function(e){return(0,a.jsx)(c.hE,(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz6 _1ecs97d9lg _1ecs97d9bq _1ecs97d9pm",size:"medium",variant:"secondary"}))}},41236:function(){},25977:function(){}},function(e){e.O(0,[789,123,918,958,80,774,888,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,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changes",function(){return t(4920)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return u}});var s=t(62230),i=t(85244),r=t(98240),a=t(52322),o=t(2784),l=t(75289),c=function(e,n){return e?"".concat(e,"-").concat(n):""},d=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},u=(0,o.forwardRef)(function(e,n){var t=e.label,o=e.Icon,u=e.type,x=e.form,h=e.isLoading,m=void 0!==h&&h,f=e.disabled,p=e.onClick,g=e.sx,j=e.iconSize,v=void 0===j?16:j,y=e.iconFill,b=e.variant,_=void 0===b?"primary":b,C=(0,r.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,a.jsx)(l.zx,(0,i.Z)((0,s.Z)({ref:n,sx:(0,s.Z)((0,i.Z)((0,s.Z)({},void 0===g?{}:g),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),m?{cursor:"wait !important"}:{}),type:u,form:x,disabled:void 0!==f&&f||m,onClick:m?void 0:p,variant:_},C),{children:m?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.$j,{size:v,color:d(_),"data-cy":c(C["data-cy"],"spinner")}),o&&t]}):(0,a.jsxs)(a.Fragment,{children:[o&&(0,a.jsx)(o,{size:v,fill:y,"data-cy":c(C["data-cy"],"icon")}),t]})}))})},59469:function(e,n,t){"use strict";var s=t(62230),i=t(52322),r=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,a=e.defineElementKey,o=e.gridTemplateMinPx,l=e.gridGap,c=e.sx;return(0,i.jsx)(r.xu,{as:"section",sx:(0,s.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===o?"320px":o,", 1fr))"),gridGap:void 0===l?"16px":l,pt:2},c),children:n.map(function(e,n){return e?(0,i.jsx)("span",{children:t(e,n)},"".concat(a(e),"-").concat(n+1)):null})})}},4920:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ed}});var s=t(52322),i=t(22715),r=t(2784),a=t(97729),o=t.n(a),l=t(65077),c=t(56580),d=t(22031),u=t(75289),x=t(951),h=function(e){var n=e.children;return(0,s.jsx)(u.kC,{sx:{alignItems:"center",justifyContent:"space-between",mt:"8px",bg:"grey02",borderRadius:4,padding:"12px 16px"},children:n})},m=t(39097),f=t.n(m),p=t(7819),g=t(34728),j=t(67445),v=function(e){var n=e.ct,t=e.status,i=e.authStatus,r=e.isOnline;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.xu,{as:"td",style:{width:"40%"},children:(0,s.jsx)(u.xv,{sx:{fontWeight:500},children:n.label})}),(0,s.jsx)(u.xu,{as:"td",style:{width:"40%"},children:n.id}),(0,s.jsx)(u.xu,{as:"td",style:{width:"20%"},children:(0,s.jsx)(g.O,{authStatus:i,isOnline:r,modelStatus:t,modelType:"CustomType"})})]})},y=function(e){var n=e.customTypes,t=e.modelsStatuses,i=e.authStatus,r=e.isOnline;return(0,s.jsxs)(u.xu,{as:"table","data-legacy-component":!0,children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"transparent small",children:[(0,s.jsx)(u.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"Name"}),(0,s.jsx)(u.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"API ID"}),(0,s.jsx)(u.xu,{as:"th",sx:{width:"20%",fontWeight:600},children:"Status"})]})}),(0,s.jsx)("tbody",{children:n.map(function(e){return(0,p.TG)(e)?(0,s.jsx)(f(),{passHref:!0,href:j.cd[e.local.format].getBuilderPagePathname(e.local.id),legacyBehavior:!0,children:(0,s.jsx)("tr",{tabIndex:0,children:(0,s.jsx)(v,{ct:e.local,status:t.customTypes[e.local.id],authStatus:i,isOnline:r,modelsStatuses:t},e.local.id)})},e.local.id):(0,s.jsx)("tr",{tabIndex:0,className:"disabled",children:(0,s.jsx)(v,{ct:e.remote,status:t.customTypes[e.remote.id],authStatus:i,isOnline:r,modelsStatuses:t},e.remote.id)})})})]})},b=t(59469),_=t(84449),C=t(5479),S=t(47731),T=t(32681),D=t(65958),k=function(e){var n=e.unSyncedCustomTypes,t=e.unSyncedSlices,i=e.modelsStatuses,r=e.authStatus,a=e.isOnline,o=(0,S.H)(),l=o.modalPayload,c=o.onOpenModal,d=l.sliceFilterFn,m=l.defaultVariationSelector,f=t.filter(function(e){return i.slices[e.model.id]!==T.G.Deleted});return(0,s.jsxs)(s.Fragment,{children:[n.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h,{children:(0,s.jsxs)(u.xu,{children:[(0,s.jsx)(u.xv,{variant:"heading",children:"Types"}),(0,s.jsx)(u.xv,{variant:"grey",sx:{ml:"8px"},children:n.length})]})}),(0,s.jsx)(y,{customTypes:n,modelsStatuses:i,authStatus:r,isOnline:a})]}),t.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.xu,{sx:{mb:"8px"},children:(0,s.jsxs)(h,{children:[(0,s.jsxs)(u.xu,{children:[(0,s.jsx)(u.xv,{variant:"heading",children:"Slices"}),(0,s.jsx)(u.xv,{variant:"grey",sx:{ml:"8px"},children:t.length})]}),(0,s.jsxs)(u.xu,{children:[t.some(function(e){return(0,C.cx)(e)>0&&i.slices[e.model.id]!==T.G.Deleted})&&(0,s.jsxs)(u.xv,{sx:{mr:3,color:"warning02",fontSize:"12px",lineHeight:"16px",fontWeight:600},children:[(0,s.jsx)(x.sQg,{size:16,style:{marginRight:"4px",position:"relative",top:"3px"}}),"Missing Screenshots"]}),(0,s.jsxs)(u.zx,{variant:"darkSmall",onClick:function(){return c({sliceFilterFn:function(e){return e}})},children:[(0,s.jsx)(x.hOO,{style:{color:"#FFF",fontSize:"15px",position:"relative",top:"3px",marginRight:"4px"}})," ","Update all screenshots"]})]})]})}),(0,s.jsx)(b.Z,{gridGap:"32px 16px",elems:t,gridTemplateMinPx:"305px",defineElementKey:function(e){return e.model.name},renderElem:function(e){var n=i.slices[e.model.id];return(0,s.jsx)(D.b,{action:{type:"status",authStatus:r,isOnline:a,modelStatus:n},isDeleted:n===T.G.Deleted,mode:"navigation",onUpdateScreenshot:function(){c({sliceFilterFn:function(n){return n.filter(function(n){return n.model.id===e.model.id})}})},slice:e,variant:"solid"})}}),(0,s.jsx)(_.Z,{slices:d(f),defaultVariationSelector:m})]})]})},O=t(91914),w=function(){return(0,s.jsx)(u.kC,{sx:{justifyContent:"center",alignItems:"center",flex:1},children:(0,s.jsxs)(u.kC,{sx:{flexDirection:"column",alignItems:"center",transform:"translateY(-50%)"},children:[(0,s.jsx)(O.wQ1,{size:48}),(0,s.jsx)(u.xv,{sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",mb:"8px",mt:"2px"},children:"No internet connection"}),(0,s.jsx)(u.xv,{sx:{fontSize:"13px",lineHeight:"24px"},children:"You need a stable internet connection to review and push changes"})]})})},Z=t(90374),E=function(){var e=(0,Z.Z)().openLoginModal;return(0,s.jsx)(u.kC,{sx:{justifyContent:"center",alignItems:"center",flex:1},children:(0,s.jsxs)(u.kC,{sx:{flexDirection:"column",alignItems:"center",transform:"translateY(-50%)"},children:[(0,s.jsx)(u.xv,{sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",mb:"8px",mt:"2px"},children:"Could not access your repository"}),(0,s.jsx)(u.xv,{sx:{fontSize:"13px",lineHeight:"24px"},children:"You need to log in to Prismic in order to push your changes."}),(0,s.jsx)(u.zx,{sx:{mt:"24px"},onClick:function(){return e()},children:"Log in to Prismic"})]})})},R=t(5632),N=t.n(R),z=t(2754),F=t(34543),I=t(62230),M=t(85244),H=t(98240),P=t(6277);t(25977);var W={primary:"_1ecs97daq8 _1ecs97daxl _1ecs97daq2 _1ecs97daxf _1ecs97daqa _1ecs97daxn",secondary:"_1ecs97da16 _1ecs97d9yr _1ecs97da10 _1ecs97d9yl _1ecs97da18 _1ecs97d9yt"},A={normal:"ovkapw1",smallBold:"ovkapw2",inherit:"ovkapw3 _1ecs97decl"},q=function(e){var n=e.children,t=e.color,a=e.endIcon,o=e.href,l=e.textVariant,c=void 0===l?"smallBold":l,d=(0,H.Z)(e,["children","color","endIcon","href","textVariant"]);return(0,s.jsxs)("a",(0,M.Z)((0,I.Z)({href:o,target:"_blank",rel:"noreferrer"},d),{className:(0,P.Z)("ovkapw0 _1ecs97de7i _1ecs97decf _1ecs97de7k _1ecs97de7q",W[void 0===t?"primary":t]),children:[(0,s.jsx)(i.xv,{component:"span",color:"inherit",variant:c,children:n}),(0,r.isValidElement)(a)?(0,r.cloneElement)(a,{className:(0,P.Z)(a.props.className,"_1ecs97depq",A[c])}):null]}))},B=t(39092),G=function(){var e,n=(e=(0,c.v9)(function(e){return{repoName:(0,B.MY)(e)}}).repoName,"https://".concat(e,".prismic.io/documents/working"));return(0,s.jsxs)(z.R$,{style:{alignSelf:"center",marginTop:i.TV.size[72]},children:[(0,s.jsx)(z.u2,{children:(0,s.jsx)(i.Ee,{src:"/blank-slate-changes-uptodate.png",sizing:"cover"})}),(0,s.jsxs)(z.T9,{children:[(0,s.jsx)(z._T,{children:"Everything up-to-date"}),(0,s.jsx)(z.nf,{children:"You have no changes staged. Your changes appear here after you have saved them, while they're waiting to be pushed to the Page Builder. Ready to get going?"}),(0,s.jsxs)(z.Qj,{children:[(0,s.jsx)(i.zx,{onClick:function(){N().push("/")},children:"Create a page type"}),(0,s.jsx)(q,{endIcon:(0,s.jsx)(F.AlO,{}),textVariant:"normal",href:n,children:"Create content"})]})]})]})},U=t(79096),L=t(67764),V=t(32665),Y=t(3098),X=t(56577),Q=t(24340),$=t(77174),J=t(49471),K=t(40432),ee=t(78656),en=function(e){var n=e.ctName,t=e.numberOfDocuments,i=e.link,r=e.isOverLimit;return(0,s.jsxs)(u.Zb,{sx:{mb:12},variant:"drawerCard","data-cy":"AssociatedDocumentsCard-".concat(n),children:[(0,s.jsxs)(u.kC,{sx:{flexDirection:"column"},children:[(0,s.jsx)(u.xv,{children:n}),(0,s.jsxs)(u.xv,{sx:{color:"textClear",fontSize:"12px",lineHeight:"16px"},children:[t," documents"]})]}),(0,s.jsx)(u.rU,{href:i,target:"_blank",variant:"cardSmall",sx:{color:void 0!==r&&r?"danger":"purple08"},children:"View documents"})]})},et=function(e){var n=e.format,t=e.id,i=e.name;return(0,s.jsxs)(u.Zb,{sx:{mb:12},variant:"drawerCard","data-cy":"CustomTypesReferencesCard-".concat(i),children:[(0,s.jsxs)(u.kC,{sx:{flexDirection:"column"},children:[(0,s.jsx)(u.xv,{children:i}),(0,s.jsx)(u.xv,{sx:{color:"textClear",fontSize:"12px",lineHeight:"16px"},children:"Missing Slices"})]}),(0,s.jsxs)(u.rU,{href:j.cd[n].getBuilderPagePathname(t),target:"_blank",variant:"cardSmall",children:["View ",ee.$[n].name({start:!1,plural:!1})]},t)]})},es=t(79797),ei=t(54132),er=function(e){var n=e.isOpen,t=e.title,i=e.footer,r=e.explanations,a=(0,Z.Z)().closeModals;return(0,s.jsx)(es.Z,{placement:"right",open:n,level:null,onClose:a,width:496,children:(0,s.jsx)(ei.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:function(){return(0,s.jsxs)(u.kC,{sx:{p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,s.jsx)(u.kC,{sx:{alignItems:"center"},children:(0,s.jsx)(u.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:t})}),(0,s.jsx)(u.x8,{type:"button",onClick:function(){return a()}})]})},Footer:function(){return(0,s.jsx)(u.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center",paddingRight:16,borderTop:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorders))},backgroundColor:"white",padding:20},children:i})},children:r})})},ea=function(e){var n=e.onToggle,t=e.isConfirmed,i=e.sx;return(0,s.jsxs)(u.kC,{sx:(0,I.Z)({borderRadius:6,flexDirection:"column",backgroundColor:"grey03",padding:12,width:"100%"},i),children:[(0,s.jsx)(u.xv,{sx:{fontWeight:"bold",mb:2},children:"Are you sure to proceed?"}),(0,s.jsxs)(u.__,{sx:{mt:"4px",py:1},variant:"large",children:[(0,s.jsx)(u.XZ,{defaultChecked:t,onChange:n,variant:"forms.checkbox.dark"}),"Delete these Documents"]})]})},eo=function(e){var n=e.pushChanges,t=(0,r.useState)(!1),i=t[0],a=t[1],o=(0,c.v9)(function(e){return{isDeleteDocumentsDrawerOpen:(0,$.gP)(e,Q.q.SOFT_DELETE_DOCUMENTS_DRAWER),remoteOnlyCustomTypes:(0,J.Ch)(e).filter(p.yp),modalData:e.pushChanges}}),l=o.isDeleteDocumentsDrawerOpen,d=o.remoteOnlyCustomTypes,x=o.modalData,h=(0,Z.Z)(),m=h.closeModals,f=h.openToaster;if(!l)return null;if((null==x?void 0:x.type)!=="SOFT")return f("No change data",K.Jf.ERROR),null;var g=x.details.customTypes.map(function(e){var n,t=d.find(function(n){return(0,p.n5)(n)===e.id});return void 0===t?null:(0,s.jsx)(en,{isOverLimit:!0,ctName:null!==(n=t.remote.label)&&void 0!==n?n:t.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,s.jsx)(er,{isOpen:l,title:"Confirm deletion",footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ea,{onToggle:function(){a(!i)},isConfirmed:i,sx:{mb:10}}),(0,s.jsx)(X.z,{label:"Push changes",variant:"primary",onClick:function(){m(),n(i)},disabled:!i,sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}})]}),explanations:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:"This action will also delete Documents."}),(0,s.jsxs)(u.xv,{sx:{mb:24},children:[x.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."]}),g]})})},el=function(e){var n=e.pushChanges,t=(0,c.v9)(function(e){return{isDeleteDocumentsDrawerOpen:(0,$.gP)(e,Q.q.HARD_DELETE_DOCUMENTS_DRAWER),remoteOnlyCustomTypes:(0,J.Ch)(e).filter(p.yp),modalData:e.pushChanges}}),i=t.isDeleteDocumentsDrawerOpen,r=t.remoteOnlyCustomTypes,a=t.modalData,o=(0,Z.Z)(),l=o.closeModals,d=o.openToaster;if(!i)return null;if((null==a?void 0:a.type)!=="HARD")return d("No change data",K.Jf.ERROR),null;var x=a.details.customTypes.map(function(e){var n,t=r.find(function(n){return(0,p.n5)(n)===e.id});return void 0===t?null:(0,s.jsx)(en,{isOverLimit:!0,ctName:null!==(n=t.remote.label)&&void 0!==n?n:t.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,s.jsx)(er,{isOpen:i,title:"Manual action required",footer:(0,s.jsx)(X.z,{label:"Try again",variant:"primary",onClick:function(){l(),n(!1)},sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}}),explanations:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(u.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:["Your type",a.details.customTypes.length>1&&"s"," cannot be deleted."]}),(0,s.jsxs)(u.xv,{sx:{mb:24},children:[a.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."]}),x]})})},ec=function(e){var n=e.pushChanges,t=(0,c.v9)(function(e){return{isOpen:(0,$.gP)(e,Q.q.REFERENCES_MISSING_DRAWER),localCustomTypes:(0,J.Ch)(e).filter(p.TG),modalData:e.pushChanges}}),i=t.isOpen,r=t.modalData,a=t.localCustomTypes,o=(0,Z.Z)(),l=o.closeModals,d=o.openToaster;if(!i)return null;if((null==r?void 0:r.details)===void 0)return d("No change data",K.Jf.ERROR),null;var x=(null==r?void 0:r.details.customTypes.length)>1,h=r.details.customTypes.map(function(e){var n,t=a.find(function(n){return(0,p.n5)(n)===e.id});return void 0===t?null:(0,s.jsx)(et,{format:t.local.format,id:t.local.id,name:null!==(n=t.local.label)&&void 0!==n?n:t.local.id})});return(0,s.jsx)(er,{isOpen:i,title:"Missing Slices",footer:(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(X.z,{label:"Try again",variant:"primary",onClick:function(){l(),n(!1)},sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}})}),explanations:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(u.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:["You have",x?"":" a"," type",x?"s":""," that reference"," ",x?"":"s"," one or more missing Slices"]}),(0,s.jsxs)(u.xv,{sx:{mb:24},children:["Before pushing, remove references to any missing Slices by opening"," ","the affected type",x?"s":""," and clicking the"," ",(0,s.jsx)("b",{children:"Save"})," button."]}),h]})})},ed=function(){var e=(0,L.X)(),n=e.unSyncedSlices,t=e.unSyncedCustomTypes,a=e.modelsStatuses,u=e.authStatus,x=e.isOnline,h=(0,r.useMemo)(function(){var e;return{changedSlices:n.map(function(e){return{slice:e,status:a.slices[e.model.id]}}).filter(function(e){return L.O.includes(e.status)}),changedCustomTypes:t.map(function(e){return(0,p.TG)(e)?e.local:e.remote}).map(function(e){return{customType:e,status:a.customTypes[e.id]}}).filter(function(e){return L.O.includes(e.status)})}},[n,t,a]),m=h.changedSlices,f=h.changedCustomTypes,g=(0,Z.Z)(),j=g.pushChanges,v=g.closeModals,y=(0,c.v9)(function(e){return{isSyncing:(0,V.hg)(e,Y.z.CHANGES_PUSH)}}).isSyncing;(0,r.useEffect)(function(){return function(){v()}},[]);var b=n.length+t.length,_=function(e){return j({confirmDeleteDocuments:e,changedSlices:m,changedCustomTypes:f})},C=(0,r.useMemo)(function(){return x?u===U.t.UNAUTHORIZED||u===U.t.FORBIDDEN?(0,s.jsx)(E,{}):0===b?(0,s.jsx)(G,{}):(0,s.jsx)(k,{unSyncedSlices:n,unSyncedCustomTypes:t,modelsStatuses:a,authStatus:u,isOnline:x}):(0,s.jsx)(w,{})},[x,u,b,n,t,a,]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o(),{children:(0,s.jsx)("title",{children:"Changes - Slice Machine"})}),(0,s.jsxs)(d.LN,{children:[(0,s.jsxs)(d.wd,{children:[(0,s.jsx)(d.Cx,{folder:"Changes"}),(0,s.jsx)(d.K2,{children:(0,s.jsx)(i.zx,{onClick:function(){return _(!1)},loading:y,disabled:0===b||!x||u===U.t.UNAUTHORIZED||u===U.t.FORBIDDEN||y,"data-cy":"push-changes",children:"Push Changes"})})]}),(0,s.jsx)(d.RN,{children:(0,s.jsxs)(l.xR,{sx:{display:"flex",flexDirection:"column"},children:[C,(0,s.jsx)(eo,{pushChanges:_}),(0,s.jsx)(el,{pushChanges:_}),(0,s.jsx)(ec,{pushChanges:_})]})})]})]})}},2754:function(e,n,t){"use strict";t.d(n,{R$:function(){return d},Qj:function(){return f},T9:function(){return x},nf:function(){return m},u2:function(){return u},_T:function(){return h}});var s=t(67557),i=t(62230),r=t(85244),a=t(98240),o=t(52322),l=t(6277),c=t(22715);t(41236);var d=function(e){var n=e.backgroundImage,t=e.style,c=(0,a.Z)(e,["backgroundImage","style"]),d=void 0!==n;return(0,o.jsx)("article",(0,r.Z)((0,i.Z)({},c),{className:(0,l.Z)("_18bjhbz0 _1ecs97de7i _1ecs97de7j _1ecs97de7k _1ecs97de7t _1ecs97deqn _1ecs97deqp _1ecs97deqr _1ecs97d39c _1ecs97d3gp _1ecs97de99 _1ecs97deal _1ecs97deaz _1ecs97de87",(0,s.Z)({},"_18bjhbz1 _1ecs97de8f _1ecs97ded9",d)),style:(0,i.Z)({backgroundImage:d?"url(".concat(n,")"):void 0},t)}))},u=function(e){return(0,o.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_1ecs97de7i _1ecs97de7j _1ecs97de7k _1ecs97de7t _1ecs97d6f0 _1ecs97d6md _1ecs97dear _1ecs97deb3 _1ecs97de87"}))},x=function(e){return(0,o.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz3 _1ecs97de7i _1ecs97de7j _1ecs97de7k _1ecs97de7t _1ecs97denu"}))},h=function(e){return(0,o.jsx)(c.xv,(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz4"}))},m=function(e){return(0,o.jsx)(c.xv,(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz5",color:"grey11"}))},f=function(e){return(0,o.jsx)(c.hE,(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz6 _1ecs97dehj _1ecs97de7q _1ecs97delp",size:"medium",variant:"secondary"}))}},41236:function(){},25977:function(){}},function(e){e.O(0,[789,123,918,958,80,774,888,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(27266)}])},27266:function(n,u,t){"use strict";t.r(u),t.d(u,{default:function(){return _.H}});var _=t(12904)}},function(n){n.O(0,[
|
|
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(27266)}])},27266:function(n,u,t){"use strict";t.r(u),t.d(u,{default:function(){return _.H}});var _=t(12904)}},function(n){n.O(0,[474,958,550,482,904,774,888,179],function(){return n(n.s=95759)}),_N_E=n.O()}]);
|
package/out/_next/static/chunks/pages/{index-5266b7f0ca55025a.js → index-941b44c74dd339e4.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{87314:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return n(40208)}])},40208:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return _}});var r=n(52322),s=n(840),i=n(2784),o=n(56580),l=n(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{87314:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return n(40208)}])},40208:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return _}});var r=n(52322),s=n(840),i=n(2784),o=n(56580),l=n(22715),c=n(17329),a=n(80131),u=n(90374),x=n(3098),C=n(32665),h=n(62230),p=n(85244),d=function(e){return(0,r.jsxs)("svg",(0,p.Z)((0,h.Z)({width:"127",height:"101",viewBox:"0 0 127 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,r.jsx)("line",{x1:"0.353553",y1:"35.9863",x2:"15.5467",y2:"51.1794",stroke:"#C8C7CB"}),(0,r.jsx)("line",{x1:"42.1959",y1:"0.87059",x2:"47.7569",y2:"21.6248",stroke:"#C8C7CB"}),(0,r.jsx)("line",{x1:"99.5522",y1:"8.40984",x2:"87.2281",y2:"26.0104",stroke:"#C8C7CB"}),(0,r.jsx)("line",{x1:"126.408",y1:"41.0854",x2:"108.807",y2:"53.4094",stroke:"#C8C7CB"}),(0,r.jsx)("path",{d:"M93.5 93L76 81.9883L93.5 87V93Z",fill:"#6F6E77"}),(0,r.jsx)("path",{d:"M92 100.488H36C34.8954 100.488 34 99.5929 34 98.4883V37.9883C34 36.8837 34.8954 35.9883 36 35.9883H92C93.1046 35.9883 94 36.8837 94 37.9883V98.4883C94 99.5929 93.1046 100.488 92 100.488Z",stroke:"#1A1523"}),(0,r.jsx)("path",{d:"M74.4297 58.7688C71.569 63.3138 63.3588 74.9883 54.5 74.9883L93.8417 86.9402C93.9471 86.9722 94.0473 87.0119 94.1481 87.0563C95.014 87.4377 99.5549 89.2156 104.5 86.9883C106.535 86.0718 109.03 82.7182 110.424 80.6551C111.04 79.7445 110.743 78.5257 109.805 77.9526L77.2788 58.0753C76.3086 57.4824 75.0354 57.8065 74.4297 58.7688Z",fill:"#5842C3"}),(0,r.jsx)("path",{d:"M34 47.9883C34 47.9883 42.3922 74.9883 54.5 74.9883M54.5 74.9883C63.3588 74.9883 71.569 63.3138 74.4297 58.7688C75.0354 57.8065 76.3086 57.4824 77.2788 58.0753L109.805 77.9526C110.743 78.5257 111.04 79.7445 110.424 80.6551C109.03 82.7182 106.535 86.0718 104.5 86.9883C99.5549 89.2156 95.014 87.4377 94.1481 87.0563C94.0473 87.0119 93.9471 86.9722 93.8417 86.9402L54.5 74.9883Z",stroke:"#1A1523"}),(0,r.jsx)("path",{d:"M34 48.4883H94",stroke:"#1A1523"}),(0,r.jsx)("circle",{cx:"40",cy:"41.9883",r:"1.5",stroke:"#1A1523"}),(0,r.jsx)("circle",{cx:"46",cy:"41.9883",r:"1.5",stroke:"#1A1523"}),(0,r.jsx)("circle",{cx:"52",cy:"41.9883",r:"1.5",stroke:"#1A1523"})]}))},f=n(22710),g=n(17064),y=n(81541),j=n(99267),m=n(40147);function w(){return k.apply(this,arguments)}function k(){return(k=(0,f.Z)(function(){var e,t,n,r,s,i,o;return(0,j.__generator)(this,function(l){switch(l.label){case 0:return[4,Promise.all([m.j.customTypes.readAllCustomTypes(void 0),m.j.slices.readAllSlices()])];case 1:if(n=(t=(e=g.Z.apply(void 0,[l.sent(),2]))[0]).errors,r=t.models,i=(s=e[1]).errors,o=s.models,n.length>0||i.length>0)throw(0,y.Z)(n).concat((0,y.Z)(i));return[2,(null==r?void 0:r.length)===0&&(null==o?void 0:o.length)===0]}})})).apply(this,arguments)}function v(){var e=(0,u.Z)().openCreateCustomTypeModal,t=(0,o.v9)(function(e){return{isCreatingCustomType:(0,C.hg)(e,x.z.CREATE_CUSTOM_TYPE)}}).isCreatingCustomType,n=(0,i.useState)(!1),s=n[0],h=n[1];return(0,i.useEffect)(function(){t&&(h(!0),c.Fs.clear(w,[]))},[t]),(0,r.jsx)(l.xu,{display:"flex",justifyContent:"center",height:"100vh",alignItems:"center",backgroundColor:"grey2",children:(0,r.jsxs)(l.xu,{display:"flex",flexDirection:"column",alignItems:"center",width:384,children:[(0,r.jsx)(d,{}),(0,r.jsx)(l.xv,{variant:"h3",align:"center",sx:{marginTop:16},children:"Blank page"}),(0,r.jsx)(l.xv,{color:"grey11",align:"center",sx:{marginBottom:16},children:"Welcome to Slice Machine. Your journey starts with your first page type — the model that you will use to create pages for your website."}),(0,r.jsx)(l.zx,{onClick:e,loading:s,children:"Create a page type"}),(0,r.jsx)(a.M,{format:"page",origin:"onboarding"})]})})}var _=function(){return(0,c.QT)(w,[])?(0,r.jsx)(v,{}):(0,r.jsx)(s.F,{format:"page"})}}},function(e){e.O(0,[550,840,774,888,179],function(){return e(e.s=87314)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[274],{41535:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/labs",function(){return r(8951)}])},8951:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return j}});var t=r(52322),i=r(2784),s=r(22715),a=r(97729),c=r.n(a),l=r(22031),o=r(22710),u=r(17064),d=r(99267),h=r(90374),f=r(40432),x=function(e){var n=e.title,r=e.enabled,i=e.onToggle,a=e.children;return(0,t.jsx)(s.Zb,{variant:"outlined",children:(0,t.jsxs)(s.xu,{gap:8,padding:16,children:[(0,t.jsx)(s.xu,{padding:{top:6},children:(0,t.jsx)(s.I5,{name:"viewDay",size:"medium",color:"grey11"})}),(0,t.jsxs)(s.xu,{flexDirection:"column",flexGrow:1,children:[(0,t.jsx)(s.xv,{variant:"h3",children:n}),(0,t.jsx)(s.xv,{variant:"normal",children:a})]}),(0,t.jsx)(s.xu,{width:128,justifyContent:"end",children:(0,t.jsx)(s.rs,{size:"medium",checked:r,onCheckedChange:function(e){return i(e)}})})]})})},g=r(65988),b=function(){var e,n,r,i,a,c,l,b=(0,u.Z)((e="legacySliceUpgrader",n="Legacy Slice Upgrader",i=(0,h.Z)().openToaster,a=(0,u.Z)((0,g.E)(e),2),c=a[0],l=a[1],[c,(r=(0,o.Z)(function(e){var r;return(0,d.__generator)(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,l(e)];case 1:return t.sent(),i(e?"Labs: enabled ".concat(n):"Labs: disabled ".concat(n),f.Jf.SUCCESS),[3,3];case 2:return r=t.sent(),console.error(r),i(e?"Labs: failed to enable ".concat(n):"Labs: failed to disable ".concat(n),f.Jf.ERROR),[3,3];case 3:return[2]}})}),function(e){return r.apply(this,arguments)})]),2),j=b[0],p=b[1];return(0,t.jsxs)(s.xu,{flexDirection:"column",gap:32,children:[(0,t.jsx)("header",{children:(0,t.jsx)(s.xv,{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,t.jsx)(s.xu,{flexDirection:"column",gap:16,children:(0,t.jsxs)(x,{title:"Legacy Slice Upgrader",enabled:j.enabled,onToggle:function(e){p(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,t.jsx)("a",{href:"https://prismic.io/docs/environments",target:"_blank",children:"Prismic environment"})," ","or you'll be at risk of losing past content."]})})]})},j=function(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c(),{children:(0,t.jsx)("title",{children:"Labs - Slice Machine"})}),(0,t.jsx)(s.SV,{renderError:function(){return(0,t.jsx)(p,{children:(0,t.jsx)(s.xu,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)(s.Iq,{title:"Request failed",description:"An error occurred while fetching your labs configuration."})})})},children:(0,t.jsx)(i.Suspense,{fallback:(0,t.jsx)(p,{withHeader:!0,children:(0,t.jsx)(s._3,{})}),children:(0,t.jsx)(p,{withHeader:!0,children:(0,t.jsx)(b,{})})})})]})},p=function(e){var n=e.children,r=e.withHeader;return(0,t.jsxs)(l.LN,{children:[void 0!==r&&r?(0,t.jsx)(l.wd,{children:(0,t.jsx)(l.Cx,{folder:"Labs"})}):null,(0,t.jsx)(l.RN,{children:n})]})}},65988:function(e,n,r){"use strict";r.d(n,{E:function(){return h}});var t=r(22710),i=r(62230),s=r(85244),a=r(17064),c=r(99267),l=r(17329),o=r(40147);function u(){return d.apply(this,arguments)}function d(){return(d=(0,t.Z)(function(){return(0,c.__generator)(this,function(e){return[2,o.j.project.getSliceMachineConfig()]})})).apply(this,arguments)}function h(e){var n,r,d,h,f,x,g=(0,a.Z)((n=(0,l.QT)(u,[]),r=(0,t.Z)(function(e){return(0,c.__generator)(this,function(n){switch(n.label){case 0:return[4,o.j.project.writeSliceMachineConfig({config:e})];case 1:return n.sent(),(0,l.VA)(u,[],e),[2]}})}),[n,d=function(e){return r.apply(this,arguments)}]),2),b=g[0],j=g[1],p=(x=(0,t.Z)(function(n){var r;return(0,c.__generator)(this,function(t){switch(t.label){case 0:return r=(0,s.Z)((0,i.Z)({},b),{labs:(0,i.Z)({},b.labs)}),n?r.labs[e]=n:e in r.labs&&delete r.labs[e],0===Object.keys(r.labs).length&&delete r.labs,[4,j(r)];case 1:return t.sent(),[2]}})}),function(e){return x.apply(this,arguments)});return[{enabled:null!==(f=null==b?void 0:null===(h=b.labs)||void 0===h?void 0:h[e])&&void 0!==f&&f},p]}}},function(e){e.O(0,[774,888,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(95586)}])},95586:function(n,u,e){"use strict";e.r(u),e.d(u,{default:function(){return t.H}});var t=e(12904)}},function(n){n.O(0,[
|
|
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(95586)}])},95586:function(n,u,e){"use strict";e.r(u),e.d(u,{default:function(){return t.H}});var t=e(12904)}},function(n){n.O(0,[474,958,550,482,904,774,888,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,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]/simulator",function(){return t(23261)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var r=t(62230),i=t(85244),o=t(98240),s=t(52322),c=t(2784),a=t(75289),l=function(e,n){return e?"".concat(e,"-").concat(n):""},u=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},d=(0,c.forwardRef)(function(e,n){var t=e.label,c=e.Icon,d=e.type,x=e.form,f=e.isLoading,h=void 0!==f&&f,p=e.disabled,v=e.onClick,m=e.sx,g=e.iconSize,b=void 0===g?16:g,C=e.iconFill,j=e.variant,S=void 0===j?"primary":j,k=(0,o.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,s.jsx)(a.zx,(0,i.Z)((0,r.Z)({ref:n,sx:(0,r.Z)((0,i.Z)((0,r.Z)({},void 0===m?{}:m),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),h?{cursor:"wait !important"}:{}),type:d,form:x,disabled:void 0!==p&&p||h,onClick:h?void 0:v,variant:S},k),{children:h?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.$j,{size:b,color:u(S),"data-cy":l(k["data-cy"],"spinner")}),c&&t]}):(0,s.jsxs)(s.Fragment,{children:[c&&(0,s.jsx)(c,{size:b,fill:C,"data-cy":l(k["data-cy"],"icon")}),t]})}))})},61931:function(e,n,t){"use strict";t.d(n,{q:function(){return l}});var r=t(62230),i=t(52322),o=t(2784),s=t(75289),c=t(65186),a=(0,o.memo)(function(e){var n=e.src;return(0,i.jsx)(s.Ee,{src:n,alt:"Preview image",sx:{maxHeight:"100%"}})}),l=function(e){var n=e.src,t=e.sx;return(0,i.jsx)(s.kC,{sx:(0,r.Z)({position:"relative",alignItems:"center",justifyContent:"center",overflow:"hidden",backgroundImage:"url(/pattern.png)",backgroundColor:"headSection",backgroundRepeat:"repeat",backgroundSize:"20px",borderRadius:"4px"},t),children:void 0!==n?(0,i.jsx)(a,{src:n}):(0,i.jsxs)(s.xv,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,i.jsx)(c.eJU,{}),"You have no screenshot yet."]})})}},23261:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return eS}});var r,i,o,s,c=t(52322),a=t(97729),l=t.n(a),u=t(62230),d=t(85244),x=t(2784),f=t(71463),h=t(71651),p=t(75289),v=t(65077),m=t(5632),g=t.n(m),b=t(56577),C=t(19909),j=function(e){var n=e.defaultValue,t=e.variations,r=e.MenuItemAction,i=e.onChange;return(0,c.jsxs)(p.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"4px",border:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:250,maxWidth:350,color:"text"},children:[(0,c.jsxs)(p.xv,{sx:{p:3,fontSize:12,color:"textClear"},children:[t.length," VARIATION",t.length>1?"S":""]}),(0,c.jsxs)(p.kC,{sx:{p:0,flexDirection:"column"},children:[t.map(function(e){return(0,c.jsx)(S,{value:e,isActive:e.id===n.id,onClick:i},e.id)}),r||null]})]})},S=function(e){var n=e.value,t=e.isActive,r=e.onClick;return(0,c.jsx)(p.xu,{sx:{px:3,py:2,color:t?"primary":"",cursor:"pointer",borderLeft:function(e){var n=e.colors;return"2px solid ".concat(t?null==n?void 0:n.primary:null==n?void 0:n.background)},borderRadius:0,bg:"background",":hover":{bg:"hoverBackground",borderLeft:function(e){var n=e.colors;return"2px solid ".concat(null==n?void 0:n.primary)}}},onClick:function(){return r(n)},children:n.name})},k=t(75100),y=function(e){var n=e.buttonSx,t=e.defaultValue,r=e.variations,i=e.onNewVariation,o=e.onChange,s=e.sx,a=e.disabled,l=(0,x.useState)(!1),d=l[0],f=l[1],h=(0,x.useState)(t||r[0]),v=h[0],m=h[1];(0,x.useEffect)(function(){t&&m(t)},[t]);var g=function(e){f(!1),m(e),setTimeout(function(){return o(e)},210)},b=(0,c.jsx)(p.xu,{sx:{p:2},children:(0,c.jsx)(p.zx,{variant:"transparent",sx:{color:"text"},onClick:function(){f(!1),i&&i()},children:"+ Add new variation"})});return(0,c.jsx)(p.xu,{sx:s,children:(0,c.jsx)(C.Popover,{align:"start",isOpen:d,onClickOutside:function(){return f(!1)},positions:["bottom"],padding:10,content:function(){return(0,c.jsx)(j,{defaultValue:v,variations:r,onChange:g,MenuItemAction:i?b:void 0})},containerClassName:"variationSelectorContainer",children:(0,c.jsxs)(p.zx,{sx:(0,u.Z)({},n),variant:"dropDownButton",onClick:function(){return f(!d)},disabled:a,children:[v.name," ",d?(0,c.jsx)(k.bOz,{size:"16px","aria-label":"Collapse variations"}):(0,c.jsx)(k.mEq,{size:"16px","aria-label":"Expand variations"})]})})})},E=function(e){return(0,c.jsxs)("svg",(0,d.Z)((0,u.Z)({viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,c.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,c.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,c.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"})]}))},w=t(56580),I=t(52039),_=function(e,n,t){if(!n){g().push("/".concat(e.href,"/").concat(e.model.name));return}var r,i,o,s,c,a,l,u,d,x=(i=(r={lib:e.href,sliceName:e.model.name,variationId:null==n?void 0:n.id,isSimulator:t}).lib,o=r.sliceName,s=r.variationId,a=void 0===(c=r.options)?{}:c,l=r.isSimulator,u="/slices/[lib]/[sliceName]/[variation]".concat(l?"/simulator":""),d="/slices/".concat(i,"/").concat(o,"/").concat(s).concat(l?"/simulator":""),{href:u,as:d,options:a,all:[u,d,a]});g().push(x.href,x.as,x.options)},D=function(e){var n=e.slice,t=e.variation,r=e.isDisplayEditor,i=e.toggleIsDisplayEditor,o=e.onSaveMock,s=e.actionsDisabled,a=(0,w.v9)(function(e){return{savingMock:(0,I.S3)(e)}}).savingMock;return(0,c.jsxs)(p.kC,{sx:{p:"16px",display:"flex",bg:"grey07",gridTemplateRows:"1fr",borderBottom:"1px solid #DCDBDD",justifyContent:"space-between"},children:[(0,c.jsxs)(p.kC,{sx:{alignItems:"center"},children:[(0,c.jsx)(E,{height:"20px",width:"20px",fill:"#1A1523"}),(0,c.jsx)(p.xv,{sx:{ml:2,mr:"12px",fontSize:"14px",color:"#1A1523",fontWeight:"600",letterSpacing:"-0.15px"},children:n.model.name}),(0,c.jsx)(y,{defaultValue:t,variations:n.model.variations,onChange:function(e){return _(n,e,!0)},disabled:n.model.variations.length<=1||s})]}),(0,c.jsxs)(p.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,c.jsx)(p.kC,{sx:{alignItems:"center",justifyContent:"space-around"},children:(0,c.jsxs)(p.kC,{sx:{alignItems:"center",mr:4},children:[(0,c.jsx)(p.__,{htmlFor:"show-mock-editor",sx:{color:"#6F6E77",lineHeight:"16px",fontSize:"12px",fontWeight:"600",letterSpacing:"0px"},children:"Editor"}),(0,c.jsx)(p.rs,{id:"show-mock-editor",checked:r,onChange:i,disabled:s})]})}),(0,c.jsx)(b.z,{"data-cy":"save-mock",onClick:o,label:"Save mock content",disabled:a||s,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"}}}})]})]})},Z=t(82770),F=t(39092),R=function(e){var n=e.defaultValue,t=e.options,r=e.onChange;return(0,c.jsx)(p.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"6px",border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:180,maxWidth:350,color:"text"},children:(0,c.jsx)(p.kC,{sx:{p:0,flexDirection:"column"},children:t.map(function(e){return(0,c.jsx)(z,{value:e,isActive:e===n,onClick:r})})})})},z=function(e){var n=e.value,t=e.isActive,r=e.onClick;return(0,c.jsx)(p.xu,{sx:{p:2,cursor:"pointer",fontSize:"14px",borderRadius:0,bg:t?"hoverBackground":"background",":hover":{bg:"hoverBackground"}},onClick:function(){return r(n)},children:n})},N=function(e){var n=e.buttonSx,t=e.currentValue,r=e.options,i=e.onChange,o=e.disabled,s=(0,x.useState)(!1),a=s[0],l=s[1],u=function(e){l(!1),setTimeout(function(){return i(e)},210)};return(0,c.jsx)(p.xu,{children:(0,c.jsx)(C.Popover,{align:"start",isOpen:a,onClickOutside:function(){return l(!1)},positions:["bottom"],padding:2,content:function(){return(0,c.jsx)(R,{defaultValue:t,options:r,onChange:u})},children:(0,c.jsxs)(p.zx,{sx:n,variant:"dropDownButton",onClick:function(){return l(!a)},disabled:o,children:[t," ",a?(0,c.jsx)(k.bOz,{size:"24px"}):(0,c.jsx)(k.mEq,{size:"24px"})]})})})},O=t(67557);(s=r||(r={})).DESKTOP="Desktop",s.TABLET="Tablet",s.MOBILE="Mobile",s.CUSTOM="Custom";var T=(i={},(0,O.Z)(i,r.DESKTOP,{width:1280,height:800}),(0,O.Z)(i,r.TABLET,{width:1080,height:810}),(0,O.Z)(i,r.MOBILE,{width:390,height:844}),i),A=function(e){var n=e.label,t=e.startValue,r=e.onChange,i=e.sx,o=e.disabled,s=["e","-","+",",","."];return(0,c.jsxs)(p.kC,{sx:(0,u.Z)({alignItems:"center"},i),children:[(0,c.jsx)(p.__,{sx:{backgroundColor:"grey07",border:"transparent",borderRight:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.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(n,"-screensize-input"),children:n}),(0,c.jsx)(p.II,{type:"number",name:"".concat(n,"-screensize-input"),disabled:o,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:t,min:"0",onKeyDown:function(e){s.includes(e.key)&&e.preventDefault()}})]})},L=function(e){var n=e.handleScreenSizeChange,t=e.screenDimensions,i=e.actionsDisabled,o=(0,x.useState)(r.DESKTOP),s=o[0],a=o[1],l=function(e){a(e),e!==r.CUSTOM&&n(T[e])},f=function(e){var t=Object.values(T).findIndex(function(n){return JSON.stringify(n)===JSON.stringify(e)}),i=t<0?r.CUSTOM:Object.keys(T)[t];a(i),n(e)};return(0,c.jsx)(p.kC,{sx:{alignItems:"center",pb:"16px",justifyContent:"space-between",variant:"small"},children:(0,c.jsxs)(p.kC,{sx:{alignItems:"center",flex:1},children:[(0,c.jsx)(N,{options:Object.values(r),onChange:l,buttonSx:{alignSelf:"start"},currentValue:s,disabled:i}),(0,c.jsx)(A,{label:"W",startValue:t.width.toString(),onChange:function(e){f((0,d.Z)((0,u.Z)({},t),{width:Number(e.target.value)}))},disabled:i,sx:{mx:2}}),(0,c.jsx)(k.eSQ,{size:16,color:"#6F6E77"}),(0,c.jsx)(A,{label:"H",startValue:t.height.toString(),onChange:function(e){f((0,d.Z)((0,u.Z)({},t),{height:Number(e.target.value)}))},disabled:i,sx:{ml:2}})]})})},M=t(25812),U=t(77174),P=t(24340),W=t(90374),B=t(54132),H=t(61931),V=function(e){var n=e.sliceName,t=e.screenshotUrl,r=(0,w.v9)(function(e){return{isScreenshotModalOpen:(0,U.gP)(e,P.q.SCREENSHOT_PREVIEW)}}).isScreenshotModalOpen,i=(0,W.Z)().closeModals;return(0,c.jsx)(M.Z,{isOpen:r,shouldCloseOnOverlayClick:!0,contentLabel:"Screenshot Preview",portalClassName:"ScreenshotPreviewModal",onRequestClose:i,children:(0,c.jsx)(B.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:function(){return(0,c.jsxs)(p.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,c.jsxs)(p.X6,{sx:{fontSize:"14px"},children:["Screenshot Preview for ",n]}),(0,c.jsx)(p.x8,{type:"button",onClick:function(){return i()}})]})},Footer:function(){return(0,c.jsx)(p.kC,{style:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:"1px solid #DCDBDD"},children:(0,c.jsx)(p.zx,{variant:"secondary",sx:{fontWeight:600},onClick:function(){return i()},children:"Close"})})},children:(0,c.jsx)(H.q,{src:t,sx:{height:"320px"}})})})},q=t(25242),X=t(81541),G=function(e,n,t){var r=(0,x.useState)(e()),i=r[0],o=r[1],s=(0,x.useRef)(Date.now());return(0,x.useEffect)(function(){var t=setTimeout(function(){Date.now()-s.current>=n&&(o(e()),s.current=Date.now())},n-(Date.now()-s.current));return function(){clearTimeout(t)}},[n].concat((0,X.Z)(t))),i},K=t(22710),Y=t(17064),J=t(99267),Q=t(16),$=function(e){var n,t,r,i,o,s,a,l=e.apiContent,d=e.screenDimensions,f=e.simulatorUrl,h=e.dryRun,v=e.isScreenshot,m=void 0!==v&&v,g=(0,Y.Z)((t=(n=(0,x.useState)())[0],r=n[1],i=(0,x.useRef)(),o=(0,x.useRef)(),a=(0,x.useCallback)((s=(0,K.Z)(function(e){var n,t,s,c;return(0,J.__generator)(this,function(a){switch(a.label){case 0:if(null===(n=i.current)||void 0===n||n.disconnect(),null===(t=o.current)||void 0===t||t.disconnect(),r(void 0),!(null!=e))return[3,4];i.current=new Q.SH(e),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i.current.connect()];case 2:var l;return a.sent(),r(i.current),l=(0,K.Z)(function(){var e;return(0,J.__generator)(this,function(n){switch(n.label){case 0:return r(void 0),[4,null===(e=i.current)||void 0===e?void 0:e.connect({},!0)];case 1:return n.sent(),r(i.current),[2]}})}),s=function(){return l.apply(this,arguments)},o.current=new MutationObserver(function(e){e.forEach(function(e){"src"===e.attributeName&&s().catch(function(e){throw e})})}),o.current.observe(e,{attributeFilter:["src"]}),[3,4];case 3:return c=a.sent(),console.error(c),[3,4];case 4:return[2]}})}),function(e){return s.apply(this,arguments)}),[]),[t,a]),2),b=g[0],C=g[1],j=(0,W.Z)(),S=j.connectToSimulatorSuccess,k=j.connectToSimulatorFailure;(0,x.useEffect)(function(){var e;if(!f){k();return}if(void 0!==b){if(!b.connected){k(),console.warn("Trying to use a disconnected simulator client.");return}(e=(0,K.Z)(function(){return(0,J.__generator)(this,function(e){switch(e.label){case 0:return[4,b.setSliceZone([l])];case 1:return e.sent(),[2]}})}),function(){return e.apply(this,arguments)})().then(function(){S()}).catch(function(){k()})}},[b,l,f]);var y,E,w,I,_,D,Z,F,R,z=(0,x.useState)(),N=z[0],O=z[1],T=(y=function(e){var n;O({height:e.blockSize,width:e.inlineSize})},w=(0,x.useRef)(),(0,x.useCallback)(function(e){var n;null===(n=w.current)||void 0===n||n.disconnect(),null!==e&&(w.current=new ResizeObserver(function(n){var t,r=(0,Y.Z)(n,1)[0].contentRect;y({blockSize:r.height,inlineSize:r.width},e)}),w.current.observe(e))},[]));return(0,c.jsx)(p.kC,{ref:T,sx:(0,u.Z)({alignItems:"center",backgroundColor:"headSection",backgroundImage:"url(/pattern.png)",backgroundRepeat:"repeat",backgroundSize:"10px",border:m?void 0:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},borderRadius:m?void 0:8,display:"flex",height:"100%",justifyContent:"center",overflow:"hidden"},void 0!==h&&h?{display:"none"}:{}),children:f?(0,c.jsx)("iframe",{ref:C,src:f,style:(0,u.Z)({border:"none",maxHeight:"".concat(d.height,"px"),maxWidth:"".concat(d.width,"px"),minHeight:"".concat(d.height,"px"),minWidth:"".concat(d.width,"px"),overflowY:"auto"},N?{transform:"scale(".concat((I=d,_=N,D=I.height,Z=I.width,F=_.height,R=_.width,Z>R||D>F?Z-R>D-F?R/Z:F/D:1),")")}:{display:"none"})}):null})},ee=function(e){var n=e.children,t=e.sx;return(0,c.jsx)(p.kC,{sx:(0,u.Z)({bg:"grey07",height:"90%",width:"100%",justifyContent:"center",alignItems:"center",zIndex:"1"},t),children:(0,c.jsx)(p.kC,{sx:{marginTop:"-128px",justifyContent:"center",flexDirection:"column",alignItems:"center"},children:n})})},en=t(85819),et=function(e){var n=e.onRetrigger;return(0,c.jsxs)(ee,{children:[(0,c.jsx)(p.Ee,{src:"/iframe-not-running.png",sx:{width:"320px"}}),(0,c.jsx)(p.xv,{sx:{color:"textClear",mb:2,fontSize:"14px",lineHeight:"24px",fontWeight:"600"},children:"Slice Machine can't render your Slice"}),(0,c.jsxs)(p.xv,{sx:{color:"failedConnectText",maxWidth:"400px",textAlign:"center",fontSize:"12px",lineHeight:"22px"},children:["Ensure your website's development server is running by typing",(0,c.jsx)("br",{}),(0,c.jsx)(p.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,c.jsx)("br",{})," If that doesn't work, see the\xa0",(0,c.jsx)(p.rU,{target:"_blank",href:"https://prismic.io/docs/slice-machine",sx:{color:"link"},children:"troubleshooting instructions."})]}),(0,c.jsx)(b.z,{onClick:n,label:"Refresh",Icon:en.Fer,iconSize:20,iconFill:"#6F6E77",variant:"secondaryMedium",sx:{mt:"16px"}})]})},er=t(98240),ei=t(92928),eo=t(33402),es=t(59326),ec=t(86741),ea=t(65186),el=function(e){var n=e.children;return(0,c.jsx)(p.xu,{as:"code",sx:{bg:"rgba(0, 0, 0, 0.05)",borderRadius:3,padding:"2px 4px"},children:n})},eu=function(e){var n,t=e.children,r=(0,er.Z)(e,["children"]),i=(0,es.B7)().theme,o=(0,x.useState)(!1),s=o[0],a=o[1],l=(0,x.useRef)(null),f=function(){l.current&&navigator.clipboard.writeText(l.current.innerText).then(function(){a(!0),setTimeout(function(){a(!1)},1200)}).catch(function(){})};return(0,c.jsxs)(p.xu,(0,d.Z)((0,u.Z)({},r),{sx:{backgroundColor:"codeBlockBackground",borderRadius:8},children:[(0,c.jsxs)(p.kC,{sx:{px:"26px",py:"22px",color:"#FFF",flexDirection:"row",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid rgba(111, 110, 119, 0.2)"},children:[(0,c.jsx)(p.kC,{sx:{alignItems:"center"}}),(0,c.jsxs)(p.zx,{onClick:f,variant:"transparent",sx:{display:"flex",justifyContent:"center",alignItems:"center",p:0,fontSize:"12px",color:"#FFF"},children:["Copy\xa0",s?(0,c.jsx)(ea.HhX,{size:16,color:String(null==i?void 0:null===(n=i.colors)||void 0===n?void 0:n.success)}):(0,c.jsx)(ea.Fqs,{size:16,style:{marginLeft:"8px"}})]})]}),(0,c.jsx)(p.xu,{ref:l,as:"pre",sx:{color:"#c9d1d9",padding:"16px 20px",overflow:"auto"},children:t})]}))},ed={code:function(e){var n=e.children;return(0,c.jsx)(el,{children:n})},pre:function(e){var n=e.children,t=(0,er.Z)(e,["children"]);return(0,c.jsx)(eu,(0,d.Z)((0,u.Z)({},t),{children:n}))}},ex=function(e){var n=e.html,t=e.components,r=void 0===t?{}:t,i={replace:function(e){if((0,eo.Z)(e,ec.W_)&&e.attribs){var n=(0,ec.du)(e.children,i),t=(0,u.Z)({},r,ed)[e.name];if(t)return(0,c.jsx)(t,(0,d.Z)((0,u.Z)({name:e.name},e.attribs),{children:n}))}}};return(0,c.jsx)(c.Fragment,{children:(0,ec.ZP)(n,i)})},ef=function(e){var n=e.children.split("`").map(function(e,n){return n%2==1?(0,c.jsx)(el,{children:e}):e});return(0,c.jsx)(c.Fragment,{children:n})},eh=function(e){var n=e.number,t=e.title,r=e.excerpt,i=(0,er.Z)(e,["number","title","excerpt"]);return(0,c.jsx)(ei.OK,(0,d.Z)((0,u.Z)({className:"react-tabs__vertical__tab",selectedClassName:"react-tabs__vertical__tab--selected"},i),{children:(0,c.jsxs)(p.kC,{sx:{alignItems:"flex-start"},children:[(0,c.jsx)(ev,{number:n}),(0,c.jsxs)(p.xu,{sx:{ml:3,alignSelf:"center"},children:[(0,c.jsx)(p.X6,{as:"h4",sx:{color:"whiteButtonText",fontSize:"14px",fontWeight:"600"},children:(0,c.jsx)(ef,{children:t})}),r&&(0,c.jsx)(p.xv,{as:"p",sx:{mt:2,color:"textClear",fontSize:"13px",lineHeight:"24px"},children:(0,c.jsx)(ef,{children:r})})]})]})}))};eh.tabsRole="Tab";var ep,ev=function(e){var n=e.number;return(0,c.jsx)(p.kC,{sx:{height:"32px",width:"32px",alignItems:"center",justifyContent:"center",border:"1px solid #E4E2E4",borderRadius:"6px",bg:"grey07",color:"textClear",flexShrink:"0",fontSize:"13px"},children:n})},em=function(e){var n=e.isOpen,t=(0,w.v9)(function(e){return{isSimulatorAvailableForFramework:(0,F.Ql)(e),setupSteps:(0,I.qe)(e)}}),r=t.isSimulatorAvailableForFramework,i=t.setupSteps||[];return(0,x.useEffect)(function(){n&&Z.Xe.track({event:"slice-simulator:setup"})},[n]),(0,c.jsx)(M.Z,{isOpen:n,children:(0,c.jsx)(B.Z,{bodySx:{p:0,bg:"grey07",height:4===i.length?"640px":"480px"},Header:function(e){var n=e.radius;return(0,c.jsx)(p.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"grey07",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:(0,c.jsx)(p.X6,{sx:{fontSize:"14px",fontWeight:"600"},as:"h5",children:"Set up the simulator"})})},children:(0,c.jsxs)(ei.mQ,{defaultFocus:!0,className:"react-tabs__vertical",children:[(0,c.jsx)(ei.td,{className:"react-tabs__vertical__tab-list",children:i.map(function(e,n){return(0,c.jsx)(eh,{number:n+1,title:e.title,excerpt:e.description},e.title)})}),r?(0,c.jsx)(c.Fragment,{children:i.map(function(e){return(0,c.jsx)(ei.x4,{selectedClassName:"react-tabs__vertical__tab-panel--selected",className:"react-tabs__vertical__tab-panel",children:(0,c.jsx)(ex,{html:e.body})},e.title)})}):(0,c.jsx)(ei.x4,{selectedClassName:"react-tabs__vertical__tab-panel--selected",className:"react-tabs__vertical__tab-panel",children:"Framework not supported."})]})})})},eg=t(53559);(ep=o||(o={})).LOADING_SETUP="LOADING_SETUP",ep.LOADING_IFRAME="LOADING_IFRAME",ep.FAILED_SETUP="FAILED_SETUP",ep.FAILED_CONNECT="FAILED_CONNECT",ep.SUCCESS="SUCCESS";var eb=function(e){var n,t,i=e.slice,s=e.variation,a=(0,W.Z)(),l=a.checkSimulatorSetup,m=a.connectToSimulatorIframe,g=a.saveSliceMock,b=(0,w.v9)(function(e){return{simulatorUrl:(0,F.x0)(e),iframeStatus:(0,I.NL)(e),manifestStatus:(0,I.tD)(e).manifest,isWaitingForIFrameCheck:(0,I.oM)(e),endpoints:(0,F.gZ)(e)}}),C=b.simulatorUrl,j=b.iframeStatus,S=b.manifestStatus,k=b.isWaitingForIFrameCheck,y=b.endpoints,E=(0,x.useMemo)(function(){return{embedsUrl:y.PrismicOembed,env:"prod",unsplashUrl:y.PrismicUnsplash}},[y.PrismicOembed,y.PrismicUnsplash]),_=(0,x.useRef)(null),R=(0,x.useCallback)(function(){return l()},[]);(0,x.useEffect)(function(){l(),Z.Xe.track({event:"slice-simulator:open"})},[]);var z=(0,x.useRef)(!1);(0,x.useEffect)(function(){z.current=!0},[]);var N=function(e){z.current&&(z.current=!1,Z.Xe.track({event:"editor:widget-used",sliceId:e}))},O="ko"===S?o.FAILED_SETUP:"ok"===S?k||!j?o.LOADING_IFRAME:"ok"!==j?o.FAILED_CONNECT:o.SUCCESS:(0,o.LOADING_SETUP);(0,x.useEffect)(function(){if(O===o.FAILED_SETUP&&!_.current){var e=setInterval(function(){R()},3e3);_.current=e}},[O]),(0,x.useEffect)(function(){"ok"===S&&(_.current&&clearInterval(_.current),m())},[S]),(0,x.useEffect)(function(){O===o.FAILED_CONNECT&&Z.Xe.track({event:"slice-simulator:is-not-running"})},[O]),(0,x.useEffect)(function(){O===o.SUCCESS&&eo(!0)},[O]);var A=function(){m()},M=(0,x.useState)(T[r.DESKTOP]),U=M[0],P=M[1],B=(0,x.useMemo)(function(){return eg.id.fromSM(i.model)},[i.model]),H=(0,x.useState)(null),X=H[0],K=H[1],Y=(0,x.useMemo)(function(){var e,n;return(null==X?void 0:X.variation)===s.id?X:(null===(e=i.mocks)||void 0===e?void 0:e.find(function(e){return e.variation===s.id}))||{__TYPE__:"SharedSliceContent",variation:n=s.id,primary:{},items:[]}},[X,s.id]),J=(0,x.useMemo)(function(){return(0,q.renderSliceMock)(B,Y).id},[]),Q=(0,x.useCallback)(function(){return function(){return(0,d.Z)((0,u.Z)({},(0,q.renderSliceMock)(B,Y)),{id:J})}},[B,Y]),en=G(Q,800,[B,Y,]),er=(0,x.useState)(!1),ei=er[0],eo=er[1];return(0,c.jsxs)(p.kC,{sx:{flexDirection:"column",height:"100vh"},children:[(0,c.jsx)(em,{isOpen:O===o.FAILED_SETUP}),(0,c.jsx)(D,{slice:i,variation:s,isDisplayEditor:ei,actionsDisabled:O!==o.SUCCESS,toggleIsDisplayEditor:function(){return eo(!ei)},onSaveMock:function(){return X&&g({libraryID:i.from,sliceID:i.model.id,mocks:(i.mocks||[]).filter(function(e){return e.variation!==X.variation}).concat(X)})}}),(0,c.jsx)(p.xu,{sx:{flex:1,bg:"grey07",p:3,display:"flex",flexDirection:"column",height:"calc(100% - 73px - 16px)"},children:(0,c.jsxs)(p.kC,{sx:{flex:1,flexDirection:"row",position:"relative",width:"100%",height:"100%"},children:[(0,c.jsxs)(v.xR,{sx:{display:"flex",height:"100%",flexDirection:"column",flex:1,minWidth:0},children:[(0,c.jsx)(L,{handleScreenSizeChange:P,screenDimensions:U,actionsDisabled:O!==o.SUCCESS}),O===o.FAILED_CONNECT?(0,c.jsx)(et,{onRetrigger:A}):null,O===o.SUCCESS?(0,c.jsx)($,{apiContent:en,screenDimensions:U,simulatorUrl:C}):(0,c.jsx)(c.Fragment,{children:O===o.LOADING_IFRAME?(0,c.jsxs)(ee,{children:[(0,c.jsx)(p.$j,{variant:"styles.spinner"}),(0,c.jsx)($,{apiContent:en,screenDimensions:U,simulatorUrl:C,dryRun:!0})]}):null})]}),O===o.SUCCESS?(0,c.jsx)(p.xu,{className:"editor",sx:(0,u.Z)({marginLeft:"16px",maxWidth:"440px",minWidth:"440px",overflowY:"auto"},ei?{display:"flex",flexDirection:"column"}:{display:"none"}),children:(0,c.jsx)(h.SV,{renderError:function(){return(0,c.jsx)(h.Iq,{title:"Editor error",description:"An error occurred while rendering the editor."})},children:(0,c.jsx)(x.Suspense,{children:(0,c.jsx)(f.kS,{config:E,content:Y,onContentChange:function(e){K(e),N(i.model.id)},sharedSlice:B},s.id)})})}):null]})}),!!(null===(n=i.screenshots[s.id])||void 0===n?void 0:n.url)&&(0,c.jsx)(V,{sliceName:i.model.name,screenshotUrl:null===(t=i.screenshots[s.id])||void 0===t?void 0:t.url})]})},eC=t(28684),ej=(0,t(57880).y)(eb);function eS(){var e=(0,eC.Z)().slice;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l(),{children:(0,c.jsxs)("title",{children:[e?"Simulator: ".concat(e.model.name):"Simulator"," - Slice Machine"]})}),(0,c.jsx)(ej,{})]})}},28684:function(e,n,t){"use strict";var r=t(92521),i=t(90374),o=t(5632),s=t(2784),c=t(56580),a=function(){var e=(0,o.useRouter)(),n=(0,i.Z)().initSliceStore,t=(0,c.v9)(function(n){return{slice:(0,r.tL)(n,e.query.lib,e.query.sliceName)}}).slice;if((0,s.useEffect)(function(){t?n(t):e.replace("/")},[n,t,e]),!t)return{};var a=t.model.variations.find(function(n){return n.id===e.query.variation});return a?{slice:t,variation:a}:(e.replace("/"),{})};n.Z=a},57880:function(e,n,t){"use strict";t.d(n,{y:function(){return c}});var r=t(62230),i=t(52322);t(2784);var o=t(28684),s=t(95583),c=function(e){return function(n){var t=n.pageProps,c=(0,o.Z)(),a=c.slice,l=c.variation;return a&&l?(0,i.jsx)(e,(0,r.Z)({slice:a,variation:l},t)):((0,s.gx)("/"),null)}}}},function(e){e.O(0,[789,872,851,585,774,888,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,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]/simulator",function(){return t(23261)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var r=t(62230),i=t(85244),o=t(98240),s=t(52322),c=t(2784),a=t(75289),l=function(e,n){return e?"".concat(e,"-").concat(n):""},u=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},d=(0,c.forwardRef)(function(e,n){var t=e.label,c=e.Icon,d=e.type,x=e.form,f=e.isLoading,h=void 0!==f&&f,p=e.disabled,v=e.onClick,m=e.sx,g=e.iconSize,b=void 0===g?16:g,C=e.iconFill,j=e.variant,S=void 0===j?"primary":j,k=(0,o.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,s.jsx)(a.zx,(0,i.Z)((0,r.Z)({ref:n,sx:(0,r.Z)((0,i.Z)((0,r.Z)({},void 0===m?{}:m),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),h?{cursor:"wait !important"}:{}),type:d,form:x,disabled:void 0!==p&&p||h,onClick:h?void 0:v,variant:S},k),{children:h?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.$j,{size:b,color:u(S),"data-cy":l(k["data-cy"],"spinner")}),c&&t]}):(0,s.jsxs)(s.Fragment,{children:[c&&(0,s.jsx)(c,{size:b,fill:C,"data-cy":l(k["data-cy"],"icon")}),t]})}))})},61931:function(e,n,t){"use strict";t.d(n,{q:function(){return l}});var r=t(62230),i=t(52322),o=t(2784),s=t(75289),c=t(65186),a=(0,o.memo)(function(e){var n=e.src;return(0,i.jsx)(s.Ee,{src:n,alt:"Preview image",sx:{maxHeight:"100%"}})}),l=function(e){var n=e.src,t=e.sx;return(0,i.jsx)(s.kC,{sx:(0,r.Z)({position:"relative",alignItems:"center",justifyContent:"center",overflow:"hidden",backgroundImage:"url(/pattern.png)",backgroundColor:"headSection",backgroundRepeat:"repeat",backgroundSize:"20px",borderRadius:"4px"},t),children:void 0!==n?(0,i.jsx)(a,{src:n}):(0,i.jsxs)(s.xv,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,i.jsx)(c.eJU,{}),"You have no screenshot yet."]})})}},23261:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return eS}});var r,i,o,s,c=t(52322),a=t(97729),l=t.n(a),u=t(62230),d=t(85244),x=t(2784),f=t(71463),h=t(22715),p=t(75289),v=t(65077),m=t(5632),g=t.n(m),b=t(56577),C=t(19909),j=function(e){var n=e.defaultValue,t=e.variations,r=e.MenuItemAction,i=e.onChange;return(0,c.jsxs)(p.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"4px",border:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:250,maxWidth:350,color:"text"},children:[(0,c.jsxs)(p.xv,{sx:{p:3,fontSize:12,color:"textClear"},children:[t.length," VARIATION",t.length>1?"S":""]}),(0,c.jsxs)(p.kC,{sx:{p:0,flexDirection:"column"},children:[t.map(function(e){return(0,c.jsx)(S,{value:e,isActive:e.id===n.id,onClick:i},e.id)}),r||null]})]})},S=function(e){var n=e.value,t=e.isActive,r=e.onClick;return(0,c.jsx)(p.xu,{sx:{px:3,py:2,color:t?"primary":"",cursor:"pointer",borderLeft:function(e){var n=e.colors;return"2px solid ".concat(t?null==n?void 0:n.primary:null==n?void 0:n.background)},borderRadius:0,bg:"background",":hover":{bg:"hoverBackground",borderLeft:function(e){var n=e.colors;return"2px solid ".concat(null==n?void 0:n.primary)}}},onClick:function(){return r(n)},children:n.name})},k=t(75100),y=function(e){var n=e.buttonSx,t=e.defaultValue,r=e.variations,i=e.onNewVariation,o=e.onChange,s=e.sx,a=e.disabled,l=(0,x.useState)(!1),d=l[0],f=l[1],h=(0,x.useState)(t||r[0]),v=h[0],m=h[1];(0,x.useEffect)(function(){t&&m(t)},[t]);var g=function(e){f(!1),m(e),setTimeout(function(){return o(e)},210)},b=(0,c.jsx)(p.xu,{sx:{p:2},children:(0,c.jsx)(p.zx,{variant:"transparent",sx:{color:"text"},onClick:function(){f(!1),i&&i()},children:"+ Add new variation"})});return(0,c.jsx)(p.xu,{sx:s,children:(0,c.jsx)(C.Popover,{align:"start",isOpen:d,onClickOutside:function(){return f(!1)},positions:["bottom"],padding:10,content:function(){return(0,c.jsx)(j,{defaultValue:v,variations:r,onChange:g,MenuItemAction:i?b:void 0})},containerClassName:"variationSelectorContainer",children:(0,c.jsxs)(p.zx,{sx:(0,u.Z)({},n),variant:"dropDownButton",onClick:function(){return f(!d)},disabled:a,children:[v.name," ",d?(0,c.jsx)(k.bOz,{size:"16px","aria-label":"Collapse variations"}):(0,c.jsx)(k.mEq,{size:"16px","aria-label":"Expand variations"})]})})})},E=function(e){return(0,c.jsxs)("svg",(0,d.Z)((0,u.Z)({viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,c.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,c.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,c.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"})]}))},w=t(56580),I=t(52039),_=function(e,n,t){if(!n){g().push("/".concat(e.href,"/").concat(e.model.name));return}var r,i,o,s,c,a,l,u,d,x=(i=(r={lib:e.href,sliceName:e.model.name,variationId:null==n?void 0:n.id,isSimulator:t}).lib,o=r.sliceName,s=r.variationId,a=void 0===(c=r.options)?{}:c,l=r.isSimulator,u="/slices/[lib]/[sliceName]/[variation]".concat(l?"/simulator":""),d="/slices/".concat(i,"/").concat(o,"/").concat(s).concat(l?"/simulator":""),{href:u,as:d,options:a,all:[u,d,a]});g().push(x.href,x.as,x.options)},D=function(e){var n=e.slice,t=e.variation,r=e.isDisplayEditor,i=e.toggleIsDisplayEditor,o=e.onSaveMock,s=e.actionsDisabled,a=(0,w.v9)(function(e){return{savingMock:(0,I.S3)(e)}}).savingMock;return(0,c.jsxs)(p.kC,{sx:{p:"16px",display:"flex",bg:"grey07",gridTemplateRows:"1fr",borderBottom:"1px solid #DCDBDD",justifyContent:"space-between"},children:[(0,c.jsxs)(p.kC,{sx:{alignItems:"center"},children:[(0,c.jsx)(E,{height:"20px",width:"20px",fill:"#1A1523"}),(0,c.jsx)(p.xv,{sx:{ml:2,mr:"12px",fontSize:"14px",color:"#1A1523",fontWeight:"600",letterSpacing:"-0.15px"},children:n.model.name}),(0,c.jsx)(y,{defaultValue:t,variations:n.model.variations,onChange:function(e){return _(n,e,!0)},disabled:n.model.variations.length<=1||s})]}),(0,c.jsxs)(p.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,c.jsx)(p.kC,{sx:{alignItems:"center",justifyContent:"space-around"},children:(0,c.jsxs)(p.kC,{sx:{alignItems:"center",mr:4},children:[(0,c.jsx)(p.__,{htmlFor:"show-mock-editor",sx:{color:"#6F6E77",lineHeight:"16px",fontSize:"12px",fontWeight:"600",letterSpacing:"0px"},children:"Editor"}),(0,c.jsx)(p.rs,{id:"show-mock-editor",checked:r,onChange:i,disabled:s})]})}),(0,c.jsx)(b.z,{"data-cy":"save-mock",onClick:o,label:"Save mock content",disabled:a||s,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"}}}})]})]})},Z=t(82770),F=t(39092),R=function(e){var n=e.defaultValue,t=e.options,r=e.onChange;return(0,c.jsx)(p.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"6px",border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:180,maxWidth:350,color:"text"},children:(0,c.jsx)(p.kC,{sx:{p:0,flexDirection:"column"},children:t.map(function(e){return(0,c.jsx)(z,{value:e,isActive:e===n,onClick:r})})})})},z=function(e){var n=e.value,t=e.isActive,r=e.onClick;return(0,c.jsx)(p.xu,{sx:{p:2,cursor:"pointer",fontSize:"14px",borderRadius:0,bg:t?"hoverBackground":"background",":hover":{bg:"hoverBackground"}},onClick:function(){return r(n)},children:n})},N=function(e){var n=e.buttonSx,t=e.currentValue,r=e.options,i=e.onChange,o=e.disabled,s=(0,x.useState)(!1),a=s[0],l=s[1],u=function(e){l(!1),setTimeout(function(){return i(e)},210)};return(0,c.jsx)(p.xu,{children:(0,c.jsx)(C.Popover,{align:"start",isOpen:a,onClickOutside:function(){return l(!1)},positions:["bottom"],padding:2,content:function(){return(0,c.jsx)(R,{defaultValue:t,options:r,onChange:u})},children:(0,c.jsxs)(p.zx,{sx:n,variant:"dropDownButton",onClick:function(){return l(!a)},disabled:o,children:[t," ",a?(0,c.jsx)(k.bOz,{size:"24px"}):(0,c.jsx)(k.mEq,{size:"24px"})]})})})},O=t(67557);(s=r||(r={})).DESKTOP="Desktop",s.TABLET="Tablet",s.MOBILE="Mobile",s.CUSTOM="Custom";var T=(i={},(0,O.Z)(i,r.DESKTOP,{width:1280,height:800}),(0,O.Z)(i,r.TABLET,{width:1080,height:810}),(0,O.Z)(i,r.MOBILE,{width:390,height:844}),i),A=function(e){var n=e.label,t=e.startValue,r=e.onChange,i=e.sx,o=e.disabled,s=["e","-","+",",","."];return(0,c.jsxs)(p.kC,{sx:(0,u.Z)({alignItems:"center"},i),children:[(0,c.jsx)(p.__,{sx:{backgroundColor:"grey07",border:"transparent",borderRight:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.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(n,"-screensize-input"),children:n}),(0,c.jsx)(p.II,{type:"number",name:"".concat(n,"-screensize-input"),disabled:o,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:t,min:"0",onKeyDown:function(e){s.includes(e.key)&&e.preventDefault()}})]})},L=function(e){var n=e.handleScreenSizeChange,t=e.screenDimensions,i=e.actionsDisabled,o=(0,x.useState)(r.DESKTOP),s=o[0],a=o[1],l=function(e){a(e),e!==r.CUSTOM&&n(T[e])},f=function(e){var t=Object.values(T).findIndex(function(n){return JSON.stringify(n)===JSON.stringify(e)}),i=t<0?r.CUSTOM:Object.keys(T)[t];a(i),n(e)};return(0,c.jsx)(p.kC,{sx:{alignItems:"center",pb:"16px",justifyContent:"space-between",variant:"small"},children:(0,c.jsxs)(p.kC,{sx:{alignItems:"center",flex:1},children:[(0,c.jsx)(N,{options:Object.values(r),onChange:l,buttonSx:{alignSelf:"start"},currentValue:s,disabled:i}),(0,c.jsx)(A,{label:"W",startValue:t.width.toString(),onChange:function(e){f((0,d.Z)((0,u.Z)({},t),{width:Number(e.target.value)}))},disabled:i,sx:{mx:2}}),(0,c.jsx)(k.eSQ,{size:16,color:"#6F6E77"}),(0,c.jsx)(A,{label:"H",startValue:t.height.toString(),onChange:function(e){f((0,d.Z)((0,u.Z)({},t),{height:Number(e.target.value)}))},disabled:i,sx:{ml:2}})]})})},M=t(25812),U=t(77174),P=t(24340),W=t(90374),B=t(54132),H=t(61931),V=function(e){var n=e.sliceName,t=e.screenshotUrl,r=(0,w.v9)(function(e){return{isScreenshotModalOpen:(0,U.gP)(e,P.q.SCREENSHOT_PREVIEW)}}).isScreenshotModalOpen,i=(0,W.Z)().closeModals;return(0,c.jsx)(M.Z,{isOpen:r,shouldCloseOnOverlayClick:!0,contentLabel:"Screenshot Preview",portalClassName:"ScreenshotPreviewModal",onRequestClose:i,children:(0,c.jsx)(B.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:function(){return(0,c.jsxs)(p.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,c.jsxs)(p.X6,{sx:{fontSize:"14px"},children:["Screenshot Preview for ",n]}),(0,c.jsx)(p.x8,{type:"button",onClick:function(){return i()}})]})},Footer:function(){return(0,c.jsx)(p.kC,{style:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:"1px solid #DCDBDD"},children:(0,c.jsx)(p.zx,{variant:"secondary",sx:{fontWeight:600},onClick:function(){return i()},children:"Close"})})},children:(0,c.jsx)(H.q,{src:t,sx:{height:"320px"}})})})},q=t(25242),X=t(81541),G=function(e,n,t){var r=(0,x.useState)(e()),i=r[0],o=r[1],s=(0,x.useRef)(Date.now());return(0,x.useEffect)(function(){var t=setTimeout(function(){Date.now()-s.current>=n&&(o(e()),s.current=Date.now())},n-(Date.now()-s.current));return function(){clearTimeout(t)}},[n].concat((0,X.Z)(t))),i},K=t(22710),Y=t(17064),J=t(99267),Q=t(16),$=function(e){var n,t,r,i,o,s,a,l=e.apiContent,d=e.screenDimensions,f=e.simulatorUrl,h=e.dryRun,v=e.isScreenshot,m=void 0!==v&&v,g=(0,Y.Z)((t=(n=(0,x.useState)())[0],r=n[1],i=(0,x.useRef)(),o=(0,x.useRef)(),a=(0,x.useCallback)((s=(0,K.Z)(function(e){var n,t,s,c;return(0,J.__generator)(this,function(a){switch(a.label){case 0:if(null===(n=i.current)||void 0===n||n.disconnect(),null===(t=o.current)||void 0===t||t.disconnect(),r(void 0),!(null!=e))return[3,4];i.current=new Q.SH(e),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i.current.connect()];case 2:var l;return a.sent(),r(i.current),l=(0,K.Z)(function(){var e;return(0,J.__generator)(this,function(n){switch(n.label){case 0:return r(void 0),[4,null===(e=i.current)||void 0===e?void 0:e.connect({},!0)];case 1:return n.sent(),r(i.current),[2]}})}),s=function(){return l.apply(this,arguments)},o.current=new MutationObserver(function(e){e.forEach(function(e){"src"===e.attributeName&&s().catch(function(e){throw e})})}),o.current.observe(e,{attributeFilter:["src"]}),[3,4];case 3:return c=a.sent(),console.error(c),[3,4];case 4:return[2]}})}),function(e){return s.apply(this,arguments)}),[]),[t,a]),2),b=g[0],C=g[1],j=(0,W.Z)(),S=j.connectToSimulatorSuccess,k=j.connectToSimulatorFailure;(0,x.useEffect)(function(){var e;if(!f){k();return}if(void 0!==b){if(!b.connected){k(),console.warn("Trying to use a disconnected simulator client.");return}(e=(0,K.Z)(function(){return(0,J.__generator)(this,function(e){switch(e.label){case 0:return[4,b.setSliceZone([l])];case 1:return e.sent(),[2]}})}),function(){return e.apply(this,arguments)})().then(function(){S()}).catch(function(){k()})}},[b,l,f]);var y,E,w,I,_,D,Z,F,R,z=(0,x.useState)(),N=z[0],O=z[1],T=(y=function(e){var n;O({height:e.blockSize,width:e.inlineSize})},w=(0,x.useRef)(),(0,x.useCallback)(function(e){var n;null===(n=w.current)||void 0===n||n.disconnect(),null!==e&&(w.current=new ResizeObserver(function(n){var t,r=(0,Y.Z)(n,1)[0].contentRect;y({blockSize:r.height,inlineSize:r.width},e)}),w.current.observe(e))},[]));return(0,c.jsx)(p.kC,{ref:T,sx:(0,u.Z)({alignItems:"center",backgroundColor:"headSection",backgroundImage:"url(/pattern.png)",backgroundRepeat:"repeat",backgroundSize:"10px",border:m?void 0:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},borderRadius:m?void 0:8,display:"flex",height:"100%",justifyContent:"center",overflow:"hidden"},void 0!==h&&h?{display:"none"}:{}),children:f?(0,c.jsx)("iframe",{ref:C,src:f,style:(0,u.Z)({border:"none",maxHeight:"".concat(d.height,"px"),maxWidth:"".concat(d.width,"px"),minHeight:"".concat(d.height,"px"),minWidth:"".concat(d.width,"px"),overflowY:"auto"},N?{transform:"scale(".concat((I=d,_=N,D=I.height,Z=I.width,F=_.height,R=_.width,Z>R||D>F?Z-R>D-F?R/Z:F/D:1),")")}:{display:"none"})}):null})},ee=function(e){var n=e.children,t=e.sx;return(0,c.jsx)(p.kC,{sx:(0,u.Z)({bg:"grey07",height:"90%",width:"100%",justifyContent:"center",alignItems:"center",zIndex:"1"},t),children:(0,c.jsx)(p.kC,{sx:{marginTop:"-128px",justifyContent:"center",flexDirection:"column",alignItems:"center"},children:n})})},en=t(85819),et=function(e){var n=e.onRetrigger;return(0,c.jsxs)(ee,{children:[(0,c.jsx)(p.Ee,{src:"/iframe-not-running.png",sx:{width:"320px"}}),(0,c.jsx)(p.xv,{sx:{color:"textClear",mb:2,fontSize:"14px",lineHeight:"24px",fontWeight:"600"},children:"Slice Machine can't render your Slice"}),(0,c.jsxs)(p.xv,{sx:{color:"failedConnectText",maxWidth:"400px",textAlign:"center",fontSize:"12px",lineHeight:"22px"},children:["Ensure your website's development server is running by typing",(0,c.jsx)("br",{}),(0,c.jsx)(p.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,c.jsx)("br",{})," If that doesn't work, see the\xa0",(0,c.jsx)(p.rU,{target:"_blank",href:"https://prismic.io/docs/slice-machine",sx:{color:"link"},children:"troubleshooting instructions."})]}),(0,c.jsx)(b.z,{onClick:n,label:"Refresh",Icon:en.Fer,iconSize:20,iconFill:"#6F6E77",variant:"secondaryMedium",sx:{mt:"16px"}})]})},er=t(98240),ei=t(92928),eo=t(33402),es=t(59326),ec=t(86741),ea=t(65186),el=function(e){var n=e.children;return(0,c.jsx)(p.xu,{as:"code",sx:{bg:"rgba(0, 0, 0, 0.05)",borderRadius:3,padding:"2px 4px"},children:n})},eu=function(e){var n,t=e.children,r=(0,er.Z)(e,["children"]),i=(0,es.B7)().theme,o=(0,x.useState)(!1),s=o[0],a=o[1],l=(0,x.useRef)(null),f=function(){l.current&&navigator.clipboard.writeText(l.current.innerText).then(function(){a(!0),setTimeout(function(){a(!1)},1200)}).catch(function(){})};return(0,c.jsxs)(p.xu,(0,d.Z)((0,u.Z)({},r),{sx:{backgroundColor:"codeBlockBackground",borderRadius:8},children:[(0,c.jsxs)(p.kC,{sx:{px:"26px",py:"22px",color:"#FFF",flexDirection:"row",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid rgba(111, 110, 119, 0.2)"},children:[(0,c.jsx)(p.kC,{sx:{alignItems:"center"}}),(0,c.jsxs)(p.zx,{onClick:f,variant:"transparent",sx:{display:"flex",justifyContent:"center",alignItems:"center",p:0,fontSize:"12px",color:"#FFF"},children:["Copy\xa0",s?(0,c.jsx)(ea.HhX,{size:16,color:String(null==i?void 0:null===(n=i.colors)||void 0===n?void 0:n.success)}):(0,c.jsx)(ea.Fqs,{size:16,style:{marginLeft:"8px"}})]})]}),(0,c.jsx)(p.xu,{ref:l,as:"pre",sx:{color:"#c9d1d9",padding:"16px 20px",overflow:"auto"},children:t})]}))},ed={code:function(e){var n=e.children;return(0,c.jsx)(el,{children:n})},pre:function(e){var n=e.children,t=(0,er.Z)(e,["children"]);return(0,c.jsx)(eu,(0,d.Z)((0,u.Z)({},t),{children:n}))}},ex=function(e){var n=e.html,t=e.components,r=void 0===t?{}:t,i={replace:function(e){if((0,eo.Z)(e,ec.W_)&&e.attribs){var n=(0,ec.du)(e.children,i),t=(0,u.Z)({},r,ed)[e.name];if(t)return(0,c.jsx)(t,(0,d.Z)((0,u.Z)({name:e.name},e.attribs),{children:n}))}}};return(0,c.jsx)(c.Fragment,{children:(0,ec.ZP)(n,i)})},ef=function(e){var n=e.children.split("`").map(function(e,n){return n%2==1?(0,c.jsx)(el,{children:e}):e});return(0,c.jsx)(c.Fragment,{children:n})},eh=function(e){var n=e.number,t=e.title,r=e.excerpt,i=(0,er.Z)(e,["number","title","excerpt"]);return(0,c.jsx)(ei.OK,(0,d.Z)((0,u.Z)({className:"react-tabs__vertical__tab",selectedClassName:"react-tabs__vertical__tab--selected"},i),{children:(0,c.jsxs)(p.kC,{sx:{alignItems:"flex-start"},children:[(0,c.jsx)(ev,{number:n}),(0,c.jsxs)(p.xu,{sx:{ml:3,alignSelf:"center"},children:[(0,c.jsx)(p.X6,{as:"h4",sx:{color:"whiteButtonText",fontSize:"14px",fontWeight:"600"},children:(0,c.jsx)(ef,{children:t})}),r&&(0,c.jsx)(p.xv,{as:"p",sx:{mt:2,color:"textClear",fontSize:"13px",lineHeight:"24px"},children:(0,c.jsx)(ef,{children:r})})]})]})}))};eh.tabsRole="Tab";var ep,ev=function(e){var n=e.number;return(0,c.jsx)(p.kC,{sx:{height:"32px",width:"32px",alignItems:"center",justifyContent:"center",border:"1px solid #E4E2E4",borderRadius:"6px",bg:"grey07",color:"textClear",flexShrink:"0",fontSize:"13px"},children:n})},em=function(e){var n=e.isOpen,t=(0,w.v9)(function(e){return{isSimulatorAvailableForFramework:(0,F.Ql)(e),setupSteps:(0,I.qe)(e)}}),r=t.isSimulatorAvailableForFramework,i=t.setupSteps||[];return(0,x.useEffect)(function(){n&&Z.Xe.track({event:"slice-simulator:setup"})},[n]),(0,c.jsx)(M.Z,{isOpen:n,children:(0,c.jsx)(B.Z,{bodySx:{p:0,bg:"grey07",height:4===i.length?"640px":"480px"},Header:function(e){var n=e.radius;return(0,c.jsx)(p.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"grey07",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:(0,c.jsx)(p.X6,{sx:{fontSize:"14px",fontWeight:"600"},as:"h5",children:"Set up the simulator"})})},children:(0,c.jsxs)(ei.mQ,{defaultFocus:!0,className:"react-tabs__vertical",children:[(0,c.jsx)(ei.td,{className:"react-tabs__vertical__tab-list",children:i.map(function(e,n){return(0,c.jsx)(eh,{number:n+1,title:e.title,excerpt:e.description},e.title)})}),r?(0,c.jsx)(c.Fragment,{children:i.map(function(e){return(0,c.jsx)(ei.x4,{selectedClassName:"react-tabs__vertical__tab-panel--selected",className:"react-tabs__vertical__tab-panel",children:(0,c.jsx)(ex,{html:e.body})},e.title)})}):(0,c.jsx)(ei.x4,{selectedClassName:"react-tabs__vertical__tab-panel--selected",className:"react-tabs__vertical__tab-panel",children:"Framework not supported."})]})})})},eg=t(53559);(ep=o||(o={})).LOADING_SETUP="LOADING_SETUP",ep.LOADING_IFRAME="LOADING_IFRAME",ep.FAILED_SETUP="FAILED_SETUP",ep.FAILED_CONNECT="FAILED_CONNECT",ep.SUCCESS="SUCCESS";var eb=function(e){var n,t,i=e.slice,s=e.variation,a=(0,W.Z)(),l=a.checkSimulatorSetup,m=a.connectToSimulatorIframe,g=a.saveSliceMock,b=(0,w.v9)(function(e){return{simulatorUrl:(0,F.x0)(e),iframeStatus:(0,I.NL)(e),manifestStatus:(0,I.tD)(e).manifest,isWaitingForIFrameCheck:(0,I.oM)(e),endpoints:(0,F.gZ)(e)}}),C=b.simulatorUrl,j=b.iframeStatus,S=b.manifestStatus,k=b.isWaitingForIFrameCheck,y=b.endpoints,E=(0,x.useMemo)(function(){return{embedsUrl:y.PrismicOembed,env:"prod",unsplashUrl:y.PrismicUnsplash}},[y.PrismicOembed,y.PrismicUnsplash]),_=(0,x.useRef)(null),R=(0,x.useCallback)(function(){return l()},[]);(0,x.useEffect)(function(){l(),Z.Xe.track({event:"slice-simulator:open"})},[]);var z=(0,x.useRef)(!1);(0,x.useEffect)(function(){z.current=!0},[]);var N=function(e){z.current&&(z.current=!1,Z.Xe.track({event:"editor:widget-used",sliceId:e}))},O="ko"===S?o.FAILED_SETUP:"ok"===S?k||!j?o.LOADING_IFRAME:"ok"!==j?o.FAILED_CONNECT:o.SUCCESS:(0,o.LOADING_SETUP);(0,x.useEffect)(function(){if(O===o.FAILED_SETUP&&!_.current){var e=setInterval(function(){R()},3e3);_.current=e}},[O]),(0,x.useEffect)(function(){"ok"===S&&(_.current&&clearInterval(_.current),m())},[S]),(0,x.useEffect)(function(){O===o.FAILED_CONNECT&&Z.Xe.track({event:"slice-simulator:is-not-running"})},[O]),(0,x.useEffect)(function(){O===o.SUCCESS&&eo(!0)},[O]);var A=function(){m()},M=(0,x.useState)(T[r.DESKTOP]),U=M[0],P=M[1],B=(0,x.useMemo)(function(){return eg.id.fromSM(i.model)},[i.model]),H=(0,x.useState)(null),X=H[0],K=H[1],Y=(0,x.useMemo)(function(){var e,n;return(null==X?void 0:X.variation)===s.id?X:(null===(e=i.mocks)||void 0===e?void 0:e.find(function(e){return e.variation===s.id}))||{__TYPE__:"SharedSliceContent",variation:n=s.id,primary:{},items:[]}},[X,s.id]),J=(0,x.useMemo)(function(){return(0,q.renderSliceMock)(B,Y).id},[]),Q=(0,x.useCallback)(function(){return function(){return(0,d.Z)((0,u.Z)({},(0,q.renderSliceMock)(B,Y)),{id:J})}},[B,Y]),en=G(Q,800,[B,Y,]),er=(0,x.useState)(!1),ei=er[0],eo=er[1];return(0,c.jsxs)(p.kC,{sx:{flexDirection:"column",height:"100vh"},children:[(0,c.jsx)(em,{isOpen:O===o.FAILED_SETUP}),(0,c.jsx)(D,{slice:i,variation:s,isDisplayEditor:ei,actionsDisabled:O!==o.SUCCESS,toggleIsDisplayEditor:function(){return eo(!ei)},onSaveMock:function(){return X&&g({libraryID:i.from,sliceID:i.model.id,mocks:(i.mocks||[]).filter(function(e){return e.variation!==X.variation}).concat(X)})}}),(0,c.jsx)(p.xu,{sx:{flex:1,bg:"grey07",p:3,display:"flex",flexDirection:"column",height:"calc(100% - 73px - 16px)"},children:(0,c.jsxs)(p.kC,{sx:{flex:1,flexDirection:"row",position:"relative",width:"100%",height:"100%"},children:[(0,c.jsxs)(v.xR,{sx:{display:"flex",height:"100%",flexDirection:"column",flex:1,minWidth:0},children:[(0,c.jsx)(L,{handleScreenSizeChange:P,screenDimensions:U,actionsDisabled:O!==o.SUCCESS}),O===o.FAILED_CONNECT?(0,c.jsx)(et,{onRetrigger:A}):null,O===o.SUCCESS?(0,c.jsx)($,{apiContent:en,screenDimensions:U,simulatorUrl:C}):(0,c.jsx)(c.Fragment,{children:O===o.LOADING_IFRAME?(0,c.jsxs)(ee,{children:[(0,c.jsx)(p.$j,{variant:"styles.spinner"}),(0,c.jsx)($,{apiContent:en,screenDimensions:U,simulatorUrl:C,dryRun:!0})]}):null})]}),O===o.SUCCESS&&ei?(0,c.jsx)(p.kC,{className:"editor",sx:{flexDirection:"column",marginLeft:"16px",maxWidth:"440px",minWidth:"440px",overflowY:"auto"},children:(0,c.jsx)(h.SV,{renderError:function(){return(0,c.jsx)(h.Iq,{title:"Editor error",description:"An error occurred while rendering the editor."})},children:(0,c.jsx)(x.Suspense,{children:(0,c.jsx)(f.kS,{config:E,content:Y,onContentChange:function(e){K(e),N(i.model.id)},sharedSlice:B},s.id)})})}):null]})}),!!(null===(n=i.screenshots[s.id])||void 0===n?void 0:n.url)&&(0,c.jsx)(V,{sliceName:i.model.name,screenshotUrl:null===(t=i.screenshots[s.id])||void 0===t?void 0:t.url})]})},eC=t(28684),ej=(0,t(57880).y)(eb);function eS(){var e=(0,eC.Z)().slice;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l(),{children:(0,c.jsxs)("title",{children:[e?"Simulator: ".concat(e.model.name):"Simulator"," - Slice Machine"]})}),(0,c.jsx)(ej,{})]})}},28684:function(e,n,t){"use strict";var r=t(92521),i=t(90374),o=t(5632),s=t(2784),c=t(56580),a=function(){var e=(0,o.useRouter)(),n=(0,i.Z)().initSliceStore,t=(0,c.v9)(function(n){return{slice:(0,r.tL)(n,e.query.lib,e.query.sliceName)}}).slice;if((0,s.useEffect)(function(){t?n(t):e.replace("/")},[n,t,e]),!t)return{};var a=t.model.variations.find(function(n){return n.id===e.query.variation});return a?{slice:t,variation:a}:(e.replace("/"),{})};n.Z=a},57880:function(e,n,t){"use strict";t.d(n,{y:function(){return c}});var r=t(62230),i=t(52322);t(2784);var o=t(28684),s=t(95583),c=function(e){return function(n){var t=n.pageProps,c=(0,o.Z)(),a=c.slice,l=c.variation;return a&&l?(0,i.jsx)(e,(0,r.Z)({slice:a,variation:l},t)):((0,s.gx)("/"),null)}}}},function(e){e.O(0,[789,872,851,125,774,888,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,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]",function(){return t(15773)}])},15773:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return em}});var i=t(52322),r=t(97729),o=t.n(r),a=t(71651),l=t(2784),u=t(40432),s=t(47560),c=t(38876),d=t(8482),f=t(4092),p=t(2353),v=t(44384),m=t(28173),h=t(90374),x=t(53559),y=function(e){var n=e.variation,t=(0,h.Z)(),r=t.addSliceWidget,o=t.replaceSliceWidget,a=t.reorderSliceWidget,l=t.removeSliceWidget,u=t.updateSliceWidgetMock,y=t.deleteSliceWidgetMock,g=function(e){return function(t){y(n.id,e,t),l(n.id,e,t)}},b=function(e){return function(t){var i=t.apiId,r=t.newKey,a=t.value,l=t.mockValue;l?u(n.id,e,i,r,l):y(n.id,e,r),o(n.id,e,i,r,a)}},j=function(e){return function(t){var i=t.id,o=t.label,a=t.widgetTypeName,l=p[a];l||console.log('Could not find widget with type name "'.concat(a,'". Please contact us!')),r(n.id,e,i,l.create(o))}},S=function(e){return function(t){var i,r;(0,s.uS)(t)||a(n.id,e,t.source.index,null!==(r=null===(i=t.destination)||void 0===i?void 0:i.index)&&void 0!==r?r:void 0)}};return(0,i.jsxs)(m.aV,{children:[(0,i.jsx)(d.Z,{zoneType:"slice",tabId:void 0,title:"Non-Repeatable Zone",dataTip:" The non-repeatable zone\n is for fields<br/> that should appear once, like a<br/>\n section title.\n",fields:n.primary,EditModal:f.Z,widgetsArray:v.Z,onDeleteItem:g(x.Rt.Primary),onSave:b(x.Rt.Primary),onSaveNewField:j(x.Rt.Primary),onDragEnd:S(x.Rt.Primary),poolOfFieldsToCheck:n.primary||[],renderHintBase:function(e){var n=e.item;return"slice.primary".concat((0,c.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.primary".concat((0,c.Ti)(e))},dataCy:"slice-non-repeatable-zone",isRepeatableCustomType:void 0}),(0,i.jsx)(d.Z,{zoneType:"slice",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:v.Z,fields:n.items,EditModal:f.Z,onDeleteItem:g(x.Rt.Items),onSave:b(x.Rt.Items),onSaveNewField:j(x.Rt.Items),onDragEnd:S(x.Rt.Items),poolOfFieldsToCheck:n.items||[],renderHintBase:function(e){var n=e.item;return"item".concat((0,c.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.items[i]".concat((0,c.Ti)(e))},dataCy:"slice-repeatable-zone",isRepeatableCustomType:void 0})]})},g=t(62230),b=t(85244),j=t(81541),S=t(5632),w=t(22710),k=t(99267),C=t(55658),Z=t(63397),T=t(25812),E=t(75289),R=t(54132),I=function(e){var n=e.children,t=e.FooterContent,r=e.HeaderContent,o=e.close,a=e.sx,l=e.headerSx,u=void 0===l?{}:l;return(0,i.jsx)(R.Z,{borderFooter:!0,footerSx:{p:0},bodySx:{pt:2,pb:4,px:4},sx:(0,g.Z)({border:"none"},void 0===a?{}:a),Header:function(e){var n=e.radius;return(0,i.jsxs)(E.kC,{sx:(0,g.Z)({p:3,pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},u),children:[r,o?(0,i.jsx)(E.x8,{onClick:o,type:"button"}):null]})},Footer:t?(0,i.jsxs)(E.kC,{sx:{alignItems:"space-between",bg:"headSection",p:3},children:[(0,i.jsx)(E.xu,{sx:{ml:"auto"}}),t]}):null,children:n})},L=t(36131),A=function(e){var n=e.msg;return(0,i.jsx)(E.xv,{as:"span",sx:{fontSize:12,color:"error",mt:"5px",ml:2},children:n||"Error!"})},F=function(e){var n=e.isOpen,t=e.onClose,r=e.onSubmit,o=e.initialVariation,a=e.variations,u=function(e){var n=e.id,t=e.name,i=e.origin,r=n&&n.length?null:{id:"Required!"},o=a.find(function(e){return e.id===n})?{id:"This id already exists!"}:null,l=t&&t.length?null:{name:"Required!"},u=i.value.length&&a.find(function(e){return e.id===i.value})?null:{id:"Yuu must select an existing variation!"},s=n&&n.length&&!/^[A-Za-z0-9]+([A-Za-z0-9]+)*$/.exec(n)&&{id:"No special characters allowed"};return(0,g.Z)({},r,o,l,u,s)},s=function(e){j(C.e.generateId(e))},c=function(e){N(e),R&&s(e)},d=function(e){F(!1),s(e)},f=function(){p(),t()},p=function(){j(""),N(""),h({}),F(!0),z({value:o.id,label:o.name})},v=(0,l.useState)({}),m=v[0],h=v[1],x=(0,l.useState)(""),y=x[0],j=x[1],S=(0,l.useState)(!0),R=S[0],F=S[1],O=(0,l.useState)(""),P=O[0],N=O[1],V=(0,l.useState)({value:o.id,label:o.name}),_=V[0],z=V[1];function M(){return D.apply(this,arguments)}function D(){return(D=(0,w.Z)(function(){var e,n;return(0,k.__generator)(this,function(t){return Object.keys(e=u({id:y,name:P,origin:_})).length?h(e):(n=a.find(function(e){return e.id===_.value}))&&(r(y,P,n),f()),[2]})})).apply(this,arguments)}return(0,l.useEffect)(function(){p()},[o,n]),(0,i.jsx)(T.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,onRequestClose:function(){return f()},contentLabel:"Widget Form Modal",style:{content:{maxWidth:"700px"}},children:(0,i.jsx)(Z.J9,{initialValues:{id:y,name:P,origin:_},onSubmit:M,children:(0,i.jsx)(Z.l0,{id:"variation-add",onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),M())},children:(0,i.jsx)(E.xu,{children:(0,i.jsxs)(I,{sx:{textAlign:"left"},HeaderContent:(0,i.jsx)(E.xv,{as:"h2",children:"Add new Variation"}),FooterContent:(0,i.jsxs)(E.kC,{sx:{justifyContent:"flex-end"},children:[(0,i.jsx)(E.zx,{onClick:f,mr:2,variant:"secondary",children:"Cancel"}),(0,i.jsx)(E.zx,{type:"submit",children:"Submit"})]}),close:f,children:[(0,i.jsxs)(E.xu,{sx:{pb:4,mt:4},children:[(0,i.jsxs)(E.__,{htmlFor:"name",sx:{mb:1},children:["Variation name*",m.name?(0,i.jsx)(A,{msg:m.name}):""]}),(0,i.jsx)(Z.gN,{autoComplete:"off",id:"name",name:"name",placeholder:"e.g. Grid - With Icon",as:E.II,maxLength:30,value:P,onChange:function(e){return c(e.currentTarget.value)}}),(0,i.jsx)(E.xv,{children:"It will appear here in Slice Machine, and in the page editor in Prismic"})]}),(0,i.jsxs)(E.xu,{sx:{pb:4},children:[(0,i.jsxs)(E.__,{htmlFor:"id",sx:{mb:1},children:["Variation ID*",m.id?(0,i.jsx)(A,{msg:m.id}):""]}),(0,i.jsx)(Z.gN,{autoComplete:"off",id:"id",name:"id",placeholder:"e.g. GridWithIcon",as:E.II,maxLength:30,value:y,onChange:function(e){return d(e.currentTarget.value)}}),(0,i.jsx)(E.xv,{children:"It's generated automatically based on the variation name and will appear in the API responses."})]}),(0,i.jsxs)(E.xu,{sx:{pb:4},children:[(0,i.jsx)(E.__,{htmlFor:"origin",sx:{mb:1},children:"Duplicate from"}),(0,i.jsx)(L.ZP,{name:"origin",options:a.map(function(e){return{value:e.id,label:e.name}}),onChange:function(e){e&&z(e)},defaultValue:_,maxMenuHeight:150,theme:function(e){return(0,b.Z)((0,g.Z)({},e),{colors:(0,b.Z)((0,g.Z)({},e.colors),{text:"text",primary:"background"})})}})]})]})})})})})},O=t(84449),P=t(65958),N=t(49451),V=t(47731),_=function(e){var n=e.slice,t=e.variation,r=e.updateSlice,o=(0,S.useRouter)(),u=(0,V.H)(),s=u.modalPayload,c=s.sliceFilterFn,d=s.defaultVariationSelector,f=(0,l.useState)(!1),p=f[0],v=f[1],m=(0,h.Z)().copyVariationSlice;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(a.xu,{flexDirection:"column",gap:16,children:[n.model.variations.map(function(e){return(0,i.jsx)(P.b,{action:{type:"menu"},mode:"navigation",onUpdateScreenshot:function(){u.onOpenModal({sliceFilterFn:function(e){return e},defaultVariationSelector:{sliceID:n.model.id,variationID:e.id}})},replace:!0,selected:e.id===t.id,slice:n,variant:"outlined",variationId:e.id},e.id)}),(0,i.jsx)(a.zx,{onClick:function(){v(!0)},startIcon:"add",sx:{bottom:72,marginInline:24,position:"sticky"},variant:"secondary",children:"Add a new variation"})]}),(0,i.jsx)(O.Z,{slices:c([n]),defaultVariationSelector:d}),(0,i.jsx)(F,{initialVariation:t,isOpen:p,onClose:function(){v(!1)},onSubmit:function(e,t,i){m(e,t,i);var a=C.e.copyValue(i,e,t),l=(0,b.Z)((0,g.Z)({},n),{model:(0,b.Z)((0,g.Z)({},n.model),{variations:(0,j.Z)(n.model.variations).concat([a])})});r(l);var u=N.Y.getBuilderPagePathname({libraryName:l.href,sliceName:l.model.name,variationId:a.id});o.replace(u)},variations:n.model.variations})]})},z=t(56580),M=t(75329),D=t(33710),K=t(42189),H=t(17036),W=t(82770),q=t(39295),B=t(18125),X=function(){return(0,i.jsx)(q.X,{children:(0,i.jsxs)(D.Z,{clickable:!0,place:"bottom",effect:"solid",delayHide:500,id:"simulator-button-tooltip",children:[(0,i.jsx)(E.xv,{as:"b",children:"Framework not supported"}),(0,i.jsx)(E.xv,{as:"p",children:"Slice Simulator does not support your framework yet."})]})})},J=function(e){var n=e.children,t=e.open,r=e.onClose;return(0,i.jsxs)(B.zs,{open:t,trigger:n,onClose:r,children:[(0,i.jsx)(B.Ev,{children:"Simulate your slices"}),(0,i.jsx)(B.LB,{component:"video",cloudName:"dmtf1daqp",loop:!1,autoPlay:!1,publicId:M.Sn,poster:"/simulator-video-thumbnail.png",controls:!0,onPlay:function(){W.Xe.track({event:"open-video-tutorials",video:M.Sn})}}),(0,i.jsx)(B.OJ,{children:"Minimize context-switching by previewing your Slice components in the simulator."}),(0,i.jsx)(B.Rp,{children:"Got It"})]})},G=function(){return(0,i.jsx)(q.X,{children:(0,i.jsx)(D.Z,{clickable:!0,place:"bottom",effect:"solid",delayHide:500,id:"simulator-button-tooltip",children:"Save your work in order to simulate"})})},Q=function(e){var n=e.isSimulatorAvailableForFramework,t=e.isTouched,r=(0,S.useRouter)(),o=(0,l.useRef)(null),u=(0,h.Z)().setSeenSimulatorToolTip,s=(0,z.v9)(function(e){return{hasSeenSimulatorTooltip:(0,H.bv)(e)}}).hasSeenSimulatorTooltip;(0,l.useEffect)(function(){var e=o.current;e&&n&&!s&&setTimeout(function(){return D.Z.show(e)},5e3)},[n,s]);var c=function(){if(u(),o.current){var e=o.current;D.Z.hide(e)}},d=n&&!s;return(0,i.jsxs)("span",{"data-tip":!0,"data-tip-disable":!1,"data-for":"simulator-button-tooltip",ref:o,children:[(0,i.jsx)(J,{open:d,onClose:c,children:(0,i.jsx)(a.zx,{"data-tip":!0,"data-testid":"simulator-open-button",onClick:function(){c(),window.open("".concat(r.asPath,"/simulator"),M.pq)},disabled:!n||t,renderStartIcon:function(){return(0,i.jsx)(K.z,{color:a.TV.color.greyLight11,height:a.TV.size[24],style:{transform:"scale(calc(4 / 3))"},width:a.TV.size[24]})},variant:"secondary",children:"Simulate"})}),!1===n?(0,i.jsx)(X,{}):n&&!1===d&&t?(0,i.jsx)(G,{}):null]})},Y=t(22031),U=t(17329),$=t(40147);function ee(e){return en.apply(this,arguments)}function en(){return(en=(0,w.Z)(function(e){var n,t,i;return(0,k.__generator)(this,function(r){switch(r.label){case 0:return[4,$.j.customTypes.readCustomType({id:e})];case 1:if(t=(n=r.sent()).errors,i=n.model,t.length>0)throw t;return[2,i]}})})).apply(this,arguments)}var et=t(67445),ei=t(64722),er=t(20812),eo=function(e){return(0,i.jsxs)("svg",(0,b.Z)((0,g.Z)({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,i.jsx)("path",{d:"M9.5 12L6 9.5L9.5 7V9.5V12Z",fill:"currentColor"}),(0,i.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"})]}))},ea=function(){var e,n,t=(e=(0,ei.l)().source,n=(0,et.Ag)(e.query),void 0!==n&&(0,et.ne)(e.asPath,n)?n:void 0);return void 0!==t?(0,i.jsx)(a.SV,{children:(0,i.jsx)(l.Suspense,{children:(0,i.jsx)(a.xu,{bottom:32,justifyContent:"center",position:"fixed",right:0,width:"100vw",children:(0,i.jsx)(el,{sourceCustomTypeId:t})})})}):null},el=function(e){var n,t=(n=e.sourceCustomTypeId,(0,U.QT)(ee,[n])),r=(0,l.useState)(!0),o=r[0],u=r[1],s=(0,S.useRouter)();if(void 0===t||!o)return null;var c=t.format,d=t.id,f=et.cd[c].getBuilderPagePathname(d);return(0,i.jsxs)(a.hE,{density:"compact",variant:"tertiary",children:[(0,i.jsxs)(a.zx,{onClick:function(){s.push(f)},renderStartIcon:function(){return(0,i.jsx)(eo,{})},children:["Return to ",t.label]}),(0,i.jsx)(a.zx,{onClick:function(){u(!1)},renderStartIcon:function(){return(0,i.jsx)(er.T,{})}})]})},eu=t(39092),es=t(92521),ec={loading:!1,done:!1},ed=function(e){var n=e.slice,t=e.variation,r=(0,h.Z)(),o=r.openToaster,a=r.updateSlice,s=(0,z.v9)(function(e){return(0,es.sY)(e,n.from,n.model.id)}),c=(0,l.useState)(ec),d=c[0],f=c[1];return((0,l.useEffect)(function(){s&&f(ec)},[s]),(0,l.useEffect)(function(){if(d.done){var e,n;n=d,n.done&&o(n.message,n.error?u.Jf.ERROR:n.warning?u.Jf.WARNING:u.Jf.SUCCESS)}},[d]),t)?(0,i.jsx)(ef,{updateSlice:function(e){a(e,f)},slice:n,variation:t,isTouched:s,data:d}):(0,i.jsx)(Y.LN,{})},ef=function(e){var n=e.updateSlice,t=e.slice,r=e.variation,o=e.isTouched,l=e.data,u=(0,z.v9)(eu.Ql);return(0,i.jsxs)(Y.LN,{children:[(0,i.jsxs)(Y.wd,{children:[(0,i.jsx)(Y.Xq,{url:"/slices"}),(0,i.jsx)(Y.Cx,{folder:"Slices",page:t.model.name}),(0,i.jsxs)(Y.K2,{children:[(0,i.jsx)(Q,{isSimulatorAvailableForFramework:u,isTouched:!!o}),(0,i.jsx)(a.zx,{loading:l.loading,disabled:!o||l.loading,onClick:function(){n(t)},"data-cy":"builder-save-button",children:"Save"})]})]}),(0,i.jsxs)(Y.RN,{children:[(0,i.jsxs)(a.xu,{alignItems:"flex-start",display:"grid",gap:16,gridTemplateColumns:"320px 1fr",children:[(0,i.jsx)(_,{slice:t,variation:r,updateSlice:n}),(0,i.jsx)(y,{variation:r})]}),(0,i.jsx)(ea,{})]})]})},ep=t(28684),ev=(0,t(57880).y)(ed);function em(){var e=(0,ep.Z)().slice;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o(),{children:e?(0,i.jsxs)("title",{children:[e.model.name," - Slice Machine"]}):null}),(0,i.jsx)(ev,{})]})}},28684:function(e,n,t){"use strict";var i=t(92521),r=t(90374),o=t(5632),a=t(2784),l=t(56580),u=function(){var e=(0,o.useRouter)(),n=(0,r.Z)().initSliceStore,t=(0,l.v9)(function(n){return{slice:(0,i.tL)(n,e.query.lib,e.query.sliceName)}}).slice;if((0,a.useEffect)(function(){t?n(t):e.replace("/")},[n,t,e]),!t)return{};var u=t.model.variations.find(function(n){return n.id===e.query.variation});return u?{slice:t,variation:u}:(e.replace("/"),{})};n.Z=u},57880:function(e,n,t){"use strict";t.d(n,{y:function(){return l}});var i=t(62230),r=t(52322);t(2784);var o=t(28684),a=t(95583),l=function(e){return function(n){var t=n.pageProps,l=(0,o.Z)(),u=l.slice,s=l.variation;return u&&s?(0,r.jsx)(e,(0,i.Z)({slice:u,variation:s},t)):((0,a.gx)("/"),null)}}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return b}});var i=t(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}t(52322);var o=["shift","alt","meta","mod","ctrl"],a={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function l(e){return(a[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function u(e,n){return void 0===n&&(n=","),e.split(n)}function s(e,n,t){void 0===n&&(n="+");var i,a=e.toLocaleLowerCase().split(n).map(function(e){return l(e)});return r({},{alt:a.includes("alt"),ctrl:a.includes("ctrl")||a.includes("control"),shift:a.includes("shift"),meta:a.includes("meta"),mod:a.includes("mod")},{keys:a.filter(function(e){return!o.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([l(e.key),l(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&p([l(e.key),l(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){c.clear()});var c=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];c.has("meta")&&c.forEach(function(e){var n;return!o.includes(e)&&c.delete(e.toLowerCase())}),n.forEach(function(e){return c.add(e.toLowerCase())})}function p(e){var n=Array.isArray(e)?e:[e];"meta"===e?c.clear():n.forEach(function(e){return c.delete(e.toLowerCase())})}function v(e,n){var t=e.target;void 0===n&&(n=!1);var i=t&&t.tagName;return d(n)?Boolean(i&&n&&n.some(function(e){return e.toLowerCase()===i.toLowerCase()})):Boolean(i&&n&&!0===n)}var m=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,a=n.meta,u=n.mod,s=n.shift,f=n.ctrl,p=n.keys,v=e.key,m=e.code,h=e.ctrlKey,x=e.metaKey,y=e.shiftKey,g=e.altKey,b=l(m),j=v.toLowerCase();if(!t){if(!g===o&&"alt"!==j||!y===s&&"shift"!==j)return!1;if(u){if(!x&&!h)return!1}else if(!x===a&&"meta"!==j&&"os"!==j||!h===f&&"ctrl"!==j&&"control"!==j)return!1}return!!(p&&1===p.length&&(p.includes(j)||p.includes(b)))||(p?(void 0===r&&(r=","),(d(i=p)?i:i.split(r)).every(function(e){return c.has(e.trim().toLowerCase())})):!p)},h=(0,i.createContext)(void 0),x=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},g="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function b(e,n,t,r){var o,a,c=(0,i.useRef)(null),b=(0,i.useRef)(!1),j=t instanceof Array?r instanceof Array?void 0:r:t,S=d(e)?e.join(null==j?void 0:j.splitKey):e,w=t instanceof Array?t:r instanceof Array?r:void 0,k=(0,i.useCallback)(n,null!=w?w:[]),C=(0,i.useRef)(k);w?C.current=k:C.current=n;var Z=(!function e(n,t){return n&&t&&"object"==typeof n&&"object"==typeof t?Object.keys(n).length===Object.keys(t).length&&Object.keys(n).reduce(function(i,r){return i&&e(n[r],t[r])},!0):n===t}((a=(0,i.useRef)(void 0)).current,j)&&(a.current=j),a.current),T=(0,i.useContext)(x).enabledScopes,E=(0,i.useContext)(h);return g(function(){if((null==Z?void 0:Z.enabled)!==!1&&(e=T,n=null==Z?void 0:Z.scopes,0===e.length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!n||e.some(function(e){return n.includes(e)})||e.includes("*")))){var e,n,t=function(e,n){var t,i;if(void 0===n&&(n=!1),!(v(e,["input","textarea","select"])&&!v(e,null==Z?void 0:Z.enableOnFormTags)||null!=Z&&null!=Z.ignoreEventWhen&&Z.ignoreEventWhen(e))){if(null!==c.current&&document.activeElement!==c.current&&!c.current.contains(document.activeElement)){y(e);return}(null==(t=e.target)||!t.isContentEditable||null!=Z&&Z.enableOnContentEditable)&&u(S,null==Z?void 0:Z.splitKey).forEach(function(t){var i,r,o,a,l,u,c,d=s(t,null==Z?void 0:Z.combinationKey);if(m(e,d,null==Z?void 0:Z.ignoreModifiers)||null!=(c=d.keys)&&c.includes("*")){if(n&&b.current)return;if(i=e,r=d,("function"==typeof(o=null==Z?void 0:Z.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),a=e,l=d,"function"==typeof(u=null==Z?void 0:Z.enabled)?!u(a,l):!0!==u&&void 0!==u){y(e);return}C.current(e,d),n||(b.current=!0)}})}},i=function(e){void 0!==e.key&&(f(l(e.code)),((null==Z?void 0:Z.keydown)===void 0&&(null==Z?void 0:Z.keyup)!==!0||null!=Z&&Z.keydown)&&t(e))},r=function(e){void 0!==e.key&&(p(l(e.code)),b.current=!1,null!=Z&&Z.keyup&&t(e,!0))},o=c.current||(null==j?void 0:j.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),E&&u(S,null==Z?void 0:Z.splitKey).forEach(function(e){return E.addHotkey(s(e,null==Z?void 0:Z.combinationKey,null==Z?void 0:Z.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),E&&u(S,null==Z?void 0:Z.splitKey).forEach(function(e){return E.removeHotkey(s(e,null==Z?void 0:Z.combinationKey,null==Z?void 0:Z.description))})}}},[S,Z,T]),c}}},function(e){e.O(0,[789,958,80,482,774,888,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,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]",function(){return t(15773)}])},15773:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return em}});var i=t(52322),r=t(97729),o=t.n(r),a=t(22715),l=t(2784),u=t(40432),s=t(47560),c=t(38876),d=t(8482),f=t(4092),p=t(2353),v=t(44384),m=t(28173),h=t(90374),x=t(53559),y=function(e){var n=e.variation,t=(0,h.Z)(),r=t.addSliceWidget,o=t.replaceSliceWidget,a=t.reorderSliceWidget,l=t.removeSliceWidget,u=t.updateSliceWidgetMock,y=t.deleteSliceWidgetMock,g=function(e){return function(t){y(n.id,e,t),l(n.id,e,t)}},b=function(e){return function(t){var i=t.apiId,r=t.newKey,a=t.value,l=t.mockValue;l?u(n.id,e,i,r,l):y(n.id,e,r),o(n.id,e,i,r,a)}},j=function(e){return function(t){var i=t.id,o=t.label,a=t.widgetTypeName,l=p[a];l||console.log('Could not find widget with type name "'.concat(a,'". Please contact us!')),r(n.id,e,i,l.create(o))}},S=function(e){return function(t){var i,r;(0,s.uS)(t)||a(n.id,e,t.source.index,null!==(r=null===(i=t.destination)||void 0===i?void 0:i.index)&&void 0!==r?r:void 0)}};return(0,i.jsxs)(m.aV,{children:[(0,i.jsx)(d.Z,{zoneType:"slice",tabId:void 0,title:"Non-Repeatable Zone",dataTip:" The non-repeatable zone\n is for fields<br/> that should appear once, like a<br/>\n section title.\n",fields:n.primary,EditModal:f.Z,widgetsArray:v.Z,onDeleteItem:g(x.Rt.Primary),onSave:b(x.Rt.Primary),onSaveNewField:j(x.Rt.Primary),onDragEnd:S(x.Rt.Primary),poolOfFieldsToCheck:n.primary||[],renderHintBase:function(e){var n=e.item;return"slice.primary".concat((0,c.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.primary".concat((0,c.Ti)(e))},dataCy:"slice-non-repeatable-zone",isRepeatableCustomType:void 0}),(0,i.jsx)(d.Z,{zoneType:"slice",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:v.Z,fields:n.items,EditModal:f.Z,onDeleteItem:g(x.Rt.Items),onSave:b(x.Rt.Items),onSaveNewField:j(x.Rt.Items),onDragEnd:S(x.Rt.Items),poolOfFieldsToCheck:n.items||[],renderHintBase:function(e){var n=e.item;return"item".concat((0,c.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.items[i]".concat((0,c.Ti)(e))},dataCy:"slice-repeatable-zone",isRepeatableCustomType:void 0})]})},g=t(62230),b=t(85244),j=t(81541),S=t(5632),w=t(22710),k=t(99267),C=t(55658),Z=t(63397),T=t(25812),E=t(75289),R=t(54132),I=function(e){var n=e.children,t=e.FooterContent,r=e.HeaderContent,o=e.close,a=e.sx,l=e.headerSx,u=void 0===l?{}:l;return(0,i.jsx)(R.Z,{borderFooter:!0,footerSx:{p:0},bodySx:{pt:2,pb:4,px:4},sx:(0,g.Z)({border:"none"},void 0===a?{}:a),Header:function(e){var n=e.radius;return(0,i.jsxs)(E.kC,{sx:(0,g.Z)({p:3,pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},u),children:[r,o?(0,i.jsx)(E.x8,{onClick:o,type:"button"}):null]})},Footer:t?(0,i.jsxs)(E.kC,{sx:{alignItems:"space-between",bg:"headSection",p:3},children:[(0,i.jsx)(E.xu,{sx:{ml:"auto"}}),t]}):null,children:n})},L=t(36131),A=function(e){var n=e.msg;return(0,i.jsx)(E.xv,{as:"span",sx:{fontSize:12,color:"error",mt:"5px",ml:2},children:n||"Error!"})},F=function(e){var n=e.isOpen,t=e.onClose,r=e.onSubmit,o=e.initialVariation,a=e.variations,u=function(e){var n=e.id,t=e.name,i=e.origin,r=n&&n.length?null:{id:"Required!"},o=a.find(function(e){return e.id===n})?{id:"This id already exists!"}:null,l=t&&t.length?null:{name:"Required!"},u=i.value.length&&a.find(function(e){return e.id===i.value})?null:{id:"Yuu must select an existing variation!"},s=n&&n.length&&!/^[A-Za-z0-9]+([A-Za-z0-9]+)*$/.exec(n)&&{id:"No special characters allowed"};return(0,g.Z)({},r,o,l,u,s)},s=function(e){j(C.e.generateId(e))},c=function(e){N(e),R&&s(e)},d=function(e){F(!1),s(e)},f=function(){p(),t()},p=function(){j(""),N(""),h({}),F(!0),z({value:o.id,label:o.name})},v=(0,l.useState)({}),m=v[0],h=v[1],x=(0,l.useState)(""),y=x[0],j=x[1],S=(0,l.useState)(!0),R=S[0],F=S[1],O=(0,l.useState)(""),P=O[0],N=O[1],V=(0,l.useState)({value:o.id,label:o.name}),_=V[0],z=V[1];function M(){return D.apply(this,arguments)}function D(){return(D=(0,w.Z)(function(){var e,n;return(0,k.__generator)(this,function(t){return Object.keys(e=u({id:y,name:P,origin:_})).length?h(e):(n=a.find(function(e){return e.id===_.value}))&&(r(y,P,n),f()),[2]})})).apply(this,arguments)}return(0,l.useEffect)(function(){p()},[o,n]),(0,i.jsx)(T.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,onRequestClose:function(){return f()},contentLabel:"Widget Form Modal",style:{content:{maxWidth:"700px"}},children:(0,i.jsx)(Z.J9,{initialValues:{id:y,name:P,origin:_},onSubmit:M,children:(0,i.jsx)(Z.l0,{id:"variation-add",onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),M())},children:(0,i.jsx)(E.xu,{children:(0,i.jsxs)(I,{sx:{textAlign:"left"},HeaderContent:(0,i.jsx)(E.xv,{as:"h2",children:"Add new Variation"}),FooterContent:(0,i.jsxs)(E.kC,{sx:{justifyContent:"flex-end"},children:[(0,i.jsx)(E.zx,{onClick:f,mr:2,variant:"secondary",children:"Cancel"}),(0,i.jsx)(E.zx,{type:"submit",children:"Submit"})]}),close:f,children:[(0,i.jsxs)(E.xu,{sx:{pb:4,mt:4},children:[(0,i.jsxs)(E.__,{htmlFor:"name",sx:{mb:1},children:["Variation name*",m.name?(0,i.jsx)(A,{msg:m.name}):""]}),(0,i.jsx)(Z.gN,{autoComplete:"off",id:"name",name:"name",placeholder:"e.g. Grid - With Icon",as:E.II,maxLength:30,value:P,onChange:function(e){return c(e.currentTarget.value)}}),(0,i.jsx)(E.xv,{children:"It will appear here in Slice Machine, and in the page editor in Prismic"})]}),(0,i.jsxs)(E.xu,{sx:{pb:4},children:[(0,i.jsxs)(E.__,{htmlFor:"id",sx:{mb:1},children:["Variation ID*",m.id?(0,i.jsx)(A,{msg:m.id}):""]}),(0,i.jsx)(Z.gN,{autoComplete:"off",id:"id",name:"id",placeholder:"e.g. GridWithIcon",as:E.II,maxLength:30,value:y,onChange:function(e){return d(e.currentTarget.value)}}),(0,i.jsx)(E.xv,{children:"It's generated automatically based on the variation name and will appear in the API responses."})]}),(0,i.jsxs)(E.xu,{sx:{pb:4},children:[(0,i.jsx)(E.__,{htmlFor:"origin",sx:{mb:1},children:"Duplicate from"}),(0,i.jsx)(L.ZP,{name:"origin",options:a.map(function(e){return{value:e.id,label:e.name}}),onChange:function(e){e&&z(e)},defaultValue:_,maxMenuHeight:150,theme:function(e){return(0,b.Z)((0,g.Z)({},e),{colors:(0,b.Z)((0,g.Z)({},e.colors),{text:"text",primary:"background"})})}})]})]})})})})})},O=t(84449),P=t(65958),N=t(49451),V=t(47731),_=function(e){var n=e.slice,t=e.variation,r=e.updateSlice,o=(0,S.useRouter)(),u=(0,V.H)(),s=u.modalPayload,c=s.sliceFilterFn,d=s.defaultVariationSelector,f=(0,l.useState)(!1),p=f[0],v=f[1],m=(0,h.Z)().copyVariationSlice;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(a.xu,{flexDirection:"column",gap:16,children:[n.model.variations.map(function(e){return(0,i.jsx)(P.b,{action:{type:"menu"},mode:"navigation",onUpdateScreenshot:function(){u.onOpenModal({sliceFilterFn:function(e){return e},defaultVariationSelector:{sliceID:n.model.id,variationID:e.id}})},replace:!0,selected:e.id===t.id,slice:n,variant:"outlined",variationId:e.id},e.id)}),(0,i.jsx)(a.zx,{onClick:function(){v(!0)},startIcon:"add",sx:{bottom:72,marginInline:24,position:"sticky"},variant:"secondary",children:"Add a new variation"})]}),(0,i.jsx)(O.Z,{slices:c([n]),defaultVariationSelector:d}),(0,i.jsx)(F,{initialVariation:t,isOpen:p,onClose:function(){v(!1)},onSubmit:function(e,t,i){m(e,t,i);var a=C.e.copyValue(i,e,t),l=(0,b.Z)((0,g.Z)({},n),{model:(0,b.Z)((0,g.Z)({},n.model),{variations:(0,j.Z)(n.model.variations).concat([a])})});r(l);var u=N.Y.getBuilderPagePathname({libraryName:l.href,sliceName:l.model.name,variationId:a.id});o.replace(u)},variations:n.model.variations})]})},z=t(56580),M=t(75329),D=t(33710),K=t(42189),H=t(17036),W=t(82770),q=t(39295),B=t(22342),X=function(){return(0,i.jsx)(q.X,{children:(0,i.jsxs)(D.Z,{clickable:!0,place:"bottom",effect:"solid",delayHide:500,id:"simulator-button-tooltip",children:[(0,i.jsx)(E.xv,{as:"b",children:"Framework not supported"}),(0,i.jsx)(E.xv,{as:"p",children:"Slice Simulator does not support your framework yet."})]})})},J=function(e){var n=e.children,t=e.open,r=e.onClose;return(0,i.jsxs)(B.zs,{open:t,trigger:n,onClose:r,children:[(0,i.jsx)(B.Ev,{children:"Simulate your slices"}),(0,i.jsx)(B.LB,{component:"video",cloudName:"dmtf1daqp",loop:!1,autoPlay:!1,publicId:M.Sn,poster:"/simulator-video-thumbnail.png",controls:!0,onPlay:function(){W.Xe.track({event:"open-video-tutorials",video:M.Sn})}}),(0,i.jsx)(B.OJ,{children:"Minimize context-switching by previewing your Slice components in the simulator."}),(0,i.jsx)(B.Rp,{children:"Got It"})]})},G=function(){return(0,i.jsx)(q.X,{children:(0,i.jsx)(D.Z,{clickable:!0,place:"bottom",effect:"solid",delayHide:500,id:"simulator-button-tooltip",children:"Save your work in order to simulate"})})},Q=function(e){var n=e.isSimulatorAvailableForFramework,t=e.isTouched,r=(0,S.useRouter)(),o=(0,l.useRef)(null),u=(0,h.Z)().setSeenSimulatorToolTip,s=(0,z.v9)(function(e){return{hasSeenSimulatorTooltip:(0,H.bv)(e)}}).hasSeenSimulatorTooltip;(0,l.useEffect)(function(){var e=o.current;e&&n&&!s&&setTimeout(function(){return D.Z.show(e)},5e3)},[n,s]);var c=function(){if(u(),o.current){var e=o.current;D.Z.hide(e)}},d=n&&!s;return(0,i.jsxs)("span",{"data-tip":!0,"data-tip-disable":!1,"data-for":"simulator-button-tooltip",ref:o,children:[(0,i.jsx)(J,{open:d,onClose:c,children:(0,i.jsx)(a.zx,{"data-tip":!0,"data-testid":"simulator-open-button",onClick:function(){c(),window.open("".concat(r.asPath,"/simulator"),M.pq)},disabled:!n||t,renderStartIcon:function(){return(0,i.jsx)(K.z,{color:a.TV.color.greyLight11,height:a.TV.size[24],style:{transform:"scale(calc(4 / 3))"},width:a.TV.size[24]})},variant:"secondary",children:"Simulate"})}),!1===n?(0,i.jsx)(X,{}):n&&!1===d&&t?(0,i.jsx)(G,{}):null]})},Y=t(22031),U=t(17329),$=t(40147);function ee(e){return en.apply(this,arguments)}function en(){return(en=(0,w.Z)(function(e){var n,t,i;return(0,k.__generator)(this,function(r){switch(r.label){case 0:return[4,$.j.customTypes.readCustomType({id:e})];case 1:if(t=(n=r.sent()).errors,i=n.model,t.length>0)throw t;return[2,i]}})})).apply(this,arguments)}var et=t(67445),ei=t(64722),er=t(20812),eo=function(e){return(0,i.jsxs)("svg",(0,b.Z)((0,g.Z)({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,i.jsx)("path",{d:"M9.5 12L6 9.5L9.5 7V9.5V12Z",fill:"currentColor"}),(0,i.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"})]}))},ea=function(){var e,n,t=(e=(0,ei.l)().source,n=(0,et.Ag)(e.query),void 0!==n&&(0,et.ne)(e.asPath,n)?n:void 0);return void 0!==t?(0,i.jsx)(a.SV,{children:(0,i.jsx)(l.Suspense,{children:(0,i.jsx)(a.xu,{bottom:32,justifyContent:"center",position:"fixed",right:0,width:"100vw",children:(0,i.jsx)(el,{sourceCustomTypeId:t})})})}):null},el=function(e){var n,t=(n=e.sourceCustomTypeId,(0,U.QT)(ee,[n])),r=(0,l.useState)(!0),o=r[0],u=r[1],s=(0,S.useRouter)();if(void 0===t||!o)return null;var c=t.format,d=t.id,f=et.cd[c].getBuilderPagePathname(d);return(0,i.jsxs)(a.hE,{density:"compact",variant:"tertiary",children:[(0,i.jsxs)(a.zx,{onClick:function(){s.push(f)},renderStartIcon:function(){return(0,i.jsx)(eo,{})},children:["Return to ",t.label]}),(0,i.jsx)(a.zx,{onClick:function(){u(!1)},renderStartIcon:function(){return(0,i.jsx)(er.T,{})}})]})},eu=t(39092),es=t(92521),ec={loading:!1,done:!1},ed=function(e){var n=e.slice,t=e.variation,r=(0,h.Z)(),o=r.openToaster,a=r.updateSlice,s=(0,z.v9)(function(e){return(0,es.sY)(e,n.from,n.model.id)}),c=(0,l.useState)(ec),d=c[0],f=c[1];return((0,l.useEffect)(function(){s&&f(ec)},[s]),(0,l.useEffect)(function(){if(d.done){var e,n;n=d,n.done&&o(n.message,n.error?u.Jf.ERROR:n.warning?u.Jf.WARNING:u.Jf.SUCCESS)}},[d]),t)?(0,i.jsx)(ef,{updateSlice:function(e){a(e,f)},slice:n,variation:t,isTouched:s,data:d}):(0,i.jsx)(Y.LN,{})},ef=function(e){var n=e.updateSlice,t=e.slice,r=e.variation,o=e.isTouched,l=e.data,u=(0,z.v9)(eu.Ql);return(0,i.jsxs)(Y.LN,{children:[(0,i.jsxs)(Y.wd,{children:[(0,i.jsx)(Y.Xq,{url:"/slices"}),(0,i.jsx)(Y.Cx,{folder:"Slices",page:t.model.name}),(0,i.jsxs)(Y.K2,{children:[(0,i.jsx)(Q,{isSimulatorAvailableForFramework:u,isTouched:!!o}),(0,i.jsx)(a.zx,{loading:l.loading,disabled:!o||l.loading,onClick:function(){n(t)},"data-cy":"builder-save-button",children:"Save"})]})]}),(0,i.jsxs)(Y.RN,{children:[(0,i.jsxs)(a.xu,{alignItems:"flex-start",display:"grid",gap:16,gridTemplateColumns:"320px 1fr",children:[(0,i.jsx)(_,{slice:t,variation:r,updateSlice:n}),(0,i.jsx)(y,{variation:r})]}),(0,i.jsx)(ea,{})]})]})},ep=t(28684),ev=(0,t(57880).y)(ed);function em(){var e=(0,ep.Z)().slice;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o(),{children:e?(0,i.jsxs)("title",{children:[e.model.name," - Slice Machine"]}):null}),(0,i.jsx)(ev,{})]})}},28684:function(e,n,t){"use strict";var i=t(92521),r=t(90374),o=t(5632),a=t(2784),l=t(56580),u=function(){var e=(0,o.useRouter)(),n=(0,r.Z)().initSliceStore,t=(0,l.v9)(function(n){return{slice:(0,i.tL)(n,e.query.lib,e.query.sliceName)}}).slice;if((0,a.useEffect)(function(){t?n(t):e.replace("/")},[n,t,e]),!t)return{};var u=t.model.variations.find(function(n){return n.id===e.query.variation});return u?{slice:t,variation:u}:(e.replace("/"),{})};n.Z=u},57880:function(e,n,t){"use strict";t.d(n,{y:function(){return l}});var i=t(62230),r=t(52322);t(2784);var o=t(28684),a=t(95583),l=function(e){return function(n){var t=n.pageProps,l=(0,o.Z)(),u=l.slice,s=l.variation;return u&&s?(0,r.jsx)(e,(0,i.Z)({slice:u,variation:s},t)):((0,a.gx)("/"),null)}}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return b}});var i=t(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}t(52322);var o=["shift","alt","meta","mod","ctrl"],a={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function l(e){return(a[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function u(e,n){return void 0===n&&(n=","),e.split(n)}function s(e,n,t){void 0===n&&(n="+");var i,a=e.toLocaleLowerCase().split(n).map(function(e){return l(e)});return r({},{alt:a.includes("alt"),ctrl:a.includes("ctrl")||a.includes("control"),shift:a.includes("shift"),meta:a.includes("meta"),mod:a.includes("mod")},{keys:a.filter(function(e){return!o.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([l(e.key),l(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&p([l(e.key),l(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){c.clear()});var c=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];c.has("meta")&&c.forEach(function(e){var n;return!o.includes(e)&&c.delete(e.toLowerCase())}),n.forEach(function(e){return c.add(e.toLowerCase())})}function p(e){var n=Array.isArray(e)?e:[e];"meta"===e?c.clear():n.forEach(function(e){return c.delete(e.toLowerCase())})}function v(e,n){var t=e.target;void 0===n&&(n=!1);var i=t&&t.tagName;return d(n)?Boolean(i&&n&&n.some(function(e){return e.toLowerCase()===i.toLowerCase()})):Boolean(i&&n&&!0===n)}var m=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,a=n.meta,u=n.mod,s=n.shift,f=n.ctrl,p=n.keys,v=e.key,m=e.code,h=e.ctrlKey,x=e.metaKey,y=e.shiftKey,g=e.altKey,b=l(m),j=v.toLowerCase();if(!t){if(!g===o&&"alt"!==j||!y===s&&"shift"!==j)return!1;if(u){if(!x&&!h)return!1}else if(!x===a&&"meta"!==j&&"os"!==j||!h===f&&"ctrl"!==j&&"control"!==j)return!1}return!!(p&&1===p.length&&(p.includes(j)||p.includes(b)))||(p?(void 0===r&&(r=","),(d(i=p)?i:i.split(r)).every(function(e){return c.has(e.trim().toLowerCase())})):!p)},h=(0,i.createContext)(void 0),x=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},g="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function b(e,n,t,r){var o,a,c=(0,i.useRef)(null),b=(0,i.useRef)(!1),j=t instanceof Array?r instanceof Array?void 0:r:t,S=d(e)?e.join(null==j?void 0:j.splitKey):e,w=t instanceof Array?t:r instanceof Array?r:void 0,k=(0,i.useCallback)(n,null!=w?w:[]),C=(0,i.useRef)(k);w?C.current=k:C.current=n;var Z=(!function e(n,t){return n&&t&&"object"==typeof n&&"object"==typeof t?Object.keys(n).length===Object.keys(t).length&&Object.keys(n).reduce(function(i,r){return i&&e(n[r],t[r])},!0):n===t}((a=(0,i.useRef)(void 0)).current,j)&&(a.current=j),a.current),T=(0,i.useContext)(x).enabledScopes,E=(0,i.useContext)(h);return g(function(){if((null==Z?void 0:Z.enabled)!==!1&&(e=T,n=null==Z?void 0:Z.scopes,0===e.length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!n||e.some(function(e){return n.includes(e)})||e.includes("*")))){var e,n,t=function(e,n){var t,i;if(void 0===n&&(n=!1),!(v(e,["input","textarea","select"])&&!v(e,null==Z?void 0:Z.enableOnFormTags)||null!=Z&&null!=Z.ignoreEventWhen&&Z.ignoreEventWhen(e))){if(null!==c.current&&document.activeElement!==c.current&&!c.current.contains(document.activeElement)){y(e);return}(null==(t=e.target)||!t.isContentEditable||null!=Z&&Z.enableOnContentEditable)&&u(S,null==Z?void 0:Z.splitKey).forEach(function(t){var i,r,o,a,l,u,c,d=s(t,null==Z?void 0:Z.combinationKey);if(m(e,d,null==Z?void 0:Z.ignoreModifiers)||null!=(c=d.keys)&&c.includes("*")){if(n&&b.current)return;if(i=e,r=d,("function"==typeof(o=null==Z?void 0:Z.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),a=e,l=d,"function"==typeof(u=null==Z?void 0:Z.enabled)?!u(a,l):!0!==u&&void 0!==u){y(e);return}C.current(e,d),n||(b.current=!0)}})}},i=function(e){void 0!==e.key&&(f(l(e.code)),((null==Z?void 0:Z.keydown)===void 0&&(null==Z?void 0:Z.keyup)!==!0||null!=Z&&Z.keydown)&&t(e))},r=function(e){void 0!==e.key&&(p(l(e.code)),b.current=!1,null!=Z&&Z.keyup&&t(e,!0))},o=c.current||(null==j?void 0:j.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),E&&u(S,null==Z?void 0:Z.splitKey).forEach(function(e){return E.addHotkey(s(e,null==Z?void 0:Z.combinationKey,null==Z?void 0:Z.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),E&&u(S,null==Z?void 0:Z.splitKey).forEach(function(e){return E.removeHotkey(s(e,null==Z?void 0:Z.combinationKey,null==Z?void 0:Z.description))})}}},[S,Z,T]),c}}},function(e){e.O(0,[789,958,80,482,774,888,179],function(){return e(e.s=31314)}),_N_E=e.O()}]);
|
package/out/_next/static/chunks/pages/{slices-247c480530e98426.js → slices-22db04643850c1d8.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{74600:function(e,n,t){var i=t(34311),r=t(23779),o=i(function(e,n,t){return e+(t?" ":"")+r(n)});e.exports=o},26688:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices",function(){return t(12472)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var i=t(62230),r=t(85244),o=t(98240),l=t(52322),a=t(2784),c=t(75289),s=function(e,n){return e?"".concat(e,"-").concat(n):""},u=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},d=(0,a.forwardRef)(function(e,n){var t=e.label,a=e.Icon,d=e.type,f=e.form,m=e.isLoading,p=void 0!==m&&m,x=e.disabled,h=e.onClick,v=e.sx,y=e.iconSize,b=void 0===y?16:y,g=e.iconFill,j=e.variant,S=void 0===j?"primary":j,C=(0,o.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,l.jsx)(c.zx,(0,r.Z)((0,i.Z)({ref:n,sx:(0,i.Z)((0,r.Z)((0,i.Z)({},void 0===v?{}:v),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),p?{cursor:"wait !important"}:{}),type:d,form:f,disabled:void 0!==x&&x||p,onClick:p?void 0:h,variant:S},C),{children:p?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.$j,{size:b,color:u(S),"data-cy":s(C["data-cy"],"spinner")}),a&&t]}):(0,l.jsxs)(l.Fragment,{children:[a&&(0,l.jsx)(a,{size:b,fill:g,"data-cy":s(C["data-cy"],"icon")}),t]})}))})},45466:function(e,n,t){"use strict";t.d(n,{c:function(){return j}});var i=t(22710),r=t(62230),o=t(85244),l=t(99267),a=t(52322),c=t(75289),s=t(2784),u=t(36131),d=t(68780),f=t(88932),m=t(38876),p=t(40147),x=t(82770);function h(){return(h=(0,i.Z)(function(e){var n,t,i,r,o,a,c;return(0,l.__generator)(this,function(l){switch(l.label){case 0:var s;return l.trys.push([0,3,,4]),n=e.sliceName,t=e.libraryName,i=e.onSuccess,s=n,r={id:(0,m.T3)(s),type:"SharedSlice",name:s,description:s,variations:[{id:v,name:(0,m.MP)(v),docURL:"...",version:"initial",description:(0,m.MP)(v),imageUrl:""},]},[4,p.j.slices.createSlice({libraryID:t,model:r})];case 1:if((o=l.sent().errors).length>0)throw o;return x.Xe.track({event:"slice:created",id:(0,m.MP)(n),name:n,library:t}),[4,i(r)];case 2:return l.sent(),[3,4];case 3:return a=l.sent(),c="Internal Error: Slice not created",console.error(c,a),f.Am.error(c),[3,4];case 4:return[2]}})})).apply(this,arguments)}var v="default",y=t(90374),b=t(66443),g=t(70041),j=function(e){var n,t=e.onClose,f=e.onSuccess,m=e.localLibraries,p=e.remoteSlices,v=(0,y.Z)().createSliceSuccess,j=(0,s.useState)(!1),S=j[0],C=j[1],k=(n=(0,i.Z)(function(e){var n,t;return(0,l.__generator)(this,function(r){switch(r.label){case 0:var o;return n=e.sliceName,t=e.from,C(!0),[4,function(e){return h.apply(this,arguments)}({sliceName:n,libraryName:t,onSuccess:(o=(0,i.Z)(function(e){var n;return(0,l.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,x.y0)()];case 1:return v(n.sent().libraries),[4,f(e,t)];case 2:return n.sent(),[2]}})}),function(e){return o.apply(this,arguments)})})];case 1:return r.sent(),[2]}})}),function(e){return n.apply(this,arguments)});return(0,a.jsx)(d.Z,{dataCy:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:S,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:function(e){k(e)},initialValues:{sliceName:"",from:m[0].name},validate:function(e){return(0,b.h)(e,m,p)},content:{title:"Create a new slice"},children:function(e){var n=e.touched,t=e.values,i=e.setFieldValue,l=e.errors;return(0,a.jsxs)(c.xu,{children:[(0,a.jsx)(g.W,{name:"sliceName",label:"Slice Name",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?l.sliceName:void 0,dataCy:"slice-name-input"}),(0,a.jsx)(c.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,a.jsx)(u.ZP,{name:"from",options:m.map(function(e){return{value:e.name,label:e.name}}),onChange:function(e){return e?void i("from",e.value):null},defaultValue:{value:t.from,label:t.from},styles:{option:function(e){return(0,o.Z)((0,r.Z)({},e),{color:"#161618"})}},theme:function(e){return(0,o.Z)((0,r.Z)({},e),{colors:(0,o.Z)((0,r.Z)({},e.colors),{primary:"#E9E8EA"})})},menuPortalTarget:document.body})]})}})}},70041:function(e,n,t){"use strict";t.d(n,{W:function(){return a}});var i=t(62230),r=t(52322);t(2784);var o=t(63397),l=t(75289),a=function(e){var n=e.name,t=e.label,a=e.placeholder,c=e.error,s=e.dataCy,u=e.onChange;return(0,r.jsxs)(l.xu,{mb:3,children:[(0,r.jsx)(l.__,{htmlFor:n,mb:2,children:t}),(0,r.jsx)(o.gN,(0,i.Z)({name:n,type:"text",placeholder:a,as:l.II,autoComplete:"off"},u?{onChange:u}:null,s?{"data-cy":s}:null)),c?(0,r.jsx)(l.xv,{"data-cy":s?"".concat(s,"-error"):"input-error",sx:{color:"error",mt:1},children:c}):null]})}},66443:function(e,n,t){"use strict";t.d(n,{h:function(){return s}});var i=t(81541),r=t(75329),o=t(96009),l=t.n(o),a=t(74600),c=t.n(a);function s(e,n,t){var o=e.sliceName;if(!o)return{sliceName:"Cannot be empty"};if(!r.xo.exec(o))return{sliceName:"No special characters allowed"};if(c()(l()(o)).replace(/\s/gm,"")!==o.trim())return{sliceName:"Value has to be PascalCased"};if(o.match(/^\d/))return{sliceName:"Value cannot start with a number"};if(r.lS.includes(o))return{sliceName:"".concat(o," is reserved for Slice Machine use")};var a=n.flatMap(function(e){return e.components.map(function(e){return e.model.name})}),s=t.map(function(e){return e.name});if((0,i.Z)(a).concat((0,i.Z)(s)).includes(o))return{sliceName:"Slice name is already taken."}}},59469:function(e,n,t){"use strict";var i=t(62230),r=t(52322),o=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,l=e.defineElementKey,a=e.gridTemplateMinPx,c=e.gridGap,s=e.sx;return(0,r.jsx)(o.xu,{as:"section",sx:(0,i.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===a?"320px":a,", 1fr))"),gridGap:void 0===c?"16px":c,pt:2},s),children:n.map(function(e,n){return e?(0,r.jsx)("span",{children:t(e,n)},"".concat(l(e),"-").concat(n+1)):null})})}},68780:function(e,n,t){"use strict";var i=t(62230),r=t(85244),o=t(52322),l=t(37149),a=t.n(l),c=t(25812),s=t(63397),u=t(75289),d=t(56577),f=t(54132);n.Z=function(e){var n=e.children,t=e.close,l=e.isOpen,m=e.formId,p=e.validate,x=e.onSubmit,h=e.widthInPx,v=e.initialValues,y=e.content.title,b=e.cardProps,g=e.omitFooter,j=void 0!==g&&g,S=e.isLoading,C=void 0!==S&&S,k=e.buttonLabel,w=void 0===k?"Save":k,L=e.dataCy,I=e.actionMessage;return a().setAppElement("#__next"),(0,o.jsx)(c.Z,{isOpen:l,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:y,style:{content:{width:null!=h?h:"900px"}},children:(0,o.jsx)(s.J9,{validateOnChange:!0,initialValues:v,validate:function(e){return p?p(e):void 0},onSubmit:function(e){x(e)},children:function(e){var l=e.isValid,a=e.isSubmitting,c=e.values,p=e.errors,x=e.touched,h=e.setFieldValue,v=e.setValues;return(0,o.jsx)(s.l0,(0,r.Z)((0,i.Z)({id:m},null!=L?{"data-cy":L}:null),{children:(0,o.jsx)(f.Z,(0,r.Z)((0,i.Z)({borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"}},b),{Header:function(e){var n=e.radius;return(0,o.jsxs)(u.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},children:[(0,o.jsx)(u.X6,{sx:{fontSize:"20px"},children:y}),(0,o.jsx)(u.x8,{type:"button",onClick:t})]})},Footer:j?null:(0,o.jsxs)(u.kC,{sx:{alignItems:"space-between"},children:[(0,o.jsx)(u.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof I?I(e):I}),(0,o.jsxs)(u.kC,{sx:{ml:"auto"},children:[(0,o.jsx)(u.zx,{mr:2,type:"button",onClick:t,variant:"secondary",disabled:a||C,children:"Cancel"}),(0,o.jsx)(d.z,{label:w,form:m,type:"submit",disabled:!l||a||C,isLoading:a||C,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:n({isValid:l,isSubmitting:a,values:c,errors:p,touched:x,setFieldValue:h,setValues:v})}))}))}})})}},12472:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return V}});var i=t(81541),r=t(52322),o=t(71651),l=t(2784),a=t(97729),c=t.n(a),s=t(65077),u=t(75289),d=t(56580),f=t(5632),m=t(88932),p=t(75329),x=t(22031),h=t(45466),v=t(59469),y=t(36887),b=t(82770),g=function(e){var n=e.title,t=e.onCreateNew,i=e.buttonText,o=e.documentationComponent,l=e.videoPublicIdUrl;return(0,r.jsxs)(u.xu,{sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"},children:[(0,r.jsx)(u.xu,{sx:function(e){var n;return{display:"flex",flex:1,alignItems:"center",minWidth:"400px",maxWidth:"70%",border:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02)}},children:(0,r.jsx)(y.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:l,onPlay:function(){b.Xe.track({event:"open-video-tutorials",video:l})}})}),(0,r.jsxs)(u.xu,{sx:function(e){var n;return{bg:"white",display:"flex",flexDirection:"column",border:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02),flex:1,minWidth:"400px",maxWidth:"70%"}},children:[(0,r.jsxs)(u.xu,{sx:function(e){var n;return{display:"flex",flexDirection:"column",p:4,borderBottom:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02)}},children:[(0,r.jsx)(u.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:n}),(0,r.jsx)(u.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:o})]}),(0,r.jsxs)(u.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,r.jsx)(u.zx,{onClick:t,"data-cy":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:i}),(0,r.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"})]})]})]})},j=t(84449),S=t(90374),C=t(68780),k=t(70041),w=t(77174),L=t(24340),I=t(75992),E=t(66443),N=function(e){var n=e.sliceName,t=e.sliceId,i=e.libName,o=(0,S.Z)(),l=o.renameSlice,a=o.closeModals,c=(0,d.v9)(function(e){return{isRenameSliceModalOpen:(0,w.gP)(e,L.q.RENAME_SLICE),localLibs:(0,I.Sd)(e),remoteLibs:(0,I.sT)(e)}}),s=c.isRenameSliceModalOpen,f=c.localLibs,m=c.remoteLibs,p=function(e){l(i,t,e.sliceName)};return(0,r.jsx)(C.Z,{dataCy:"rename-slice-modal",isOpen:s,widthInPx:"530px",formId:"rename-slice-modal-".concat(t),close:a,buttonLabel:"Rename",onSubmit:p,initialValues:{sliceName:n},content:{title:"Rename a slice"},validate:function(e){return(0,E.h)(e,f,m)},children:function(e){var n=e.touched,t=e.errors;return(0,r.jsx)(u.xu,{children:(0,r.jsx)(k.W,{name:"sliceName",label:"Slice Name","data-cy":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?t.sliceName:void 0,dataCy:"slice-name-input"})})}})},Z=t(25812),P=t(59326),R=t(54132),O=t(65186),_=t(56577),z=t(3098),F=t(32665),M=function(e){var n=e.sliceId,t=e.sliceName,i=e.libName,o=(0,d.v9)(function(e){return{isSliceModalOpen:(0,w.gP)(e,L.q.DELETE_SLICE),isDeletingSlice:(0,F.hg)(e,z.z.DELETE_SLICE)}}),l=o.isSliceModalOpen,a=o.isDeletingSlice,c=(0,S.Z)(),s=c.closeModals,f=c.deleteSlice,m=(0,P.B7)().theme;return(0,r.jsx)(Z.Z,{isOpen:l,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:s,children:(0,r.jsx)(R.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},borderFooter:!0,Header:function(){var e;return(0,r.jsxs)(u.kC,{sx:{position:"sticky",background:"gray",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,r.jsxs)(u.kC,{sx:{alignItems:"center"},children:[(0,r.jsx)(O.$vK,{size:20,color:null===(e=m.colors)||void 0===e?void 0:e.greyIcon}),(0,r.jsx)(u.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,r.jsx)(u.x8,{type:"button",onClick:s})]})},Footer:function(){return(0,r.jsxs)(u.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorders))},backgroundColor:"gray"},children:[(0,r.jsx)(_.z,{label:"Cancel",variant:"secondary",onClick:function(){return s()},sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,r.jsx)(_.z,{label:"Delete",variant:"danger",isLoading:a,sx:{minHeight:39,minWidth:78},onClick:function(){return f(n,t,i)}})]})},children:(0,r.jsxs)(u.nv,{children:["This action will immediately make the following changes:",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["Delete the"," ",(0,r.jsxs)(u.xv,{sx:{fontWeight:"bold"},children:[i,"/",t,"/"]})," ","directory."]}),(0,r.jsx)("li",{children:"Remove the Slice from all Slice Zones that use it."})]}),"The next time you push your changes to Prismic, the following change will happen:",(0,r.jsx)("ul",{children:(0,r.jsx)("li",{children:"Remove the Slice from the list of available Slices to use in the Page Builder."})}),"You will need to manually remove the Slice from any Pages that currently use it."]})})})},A=t(47731),T=t(65958),W=t(49451),D=t(13858),V=function(){var e,n,t,a,y,b,C=(0,f.useRouter)(),k=(0,S.Z)(),w=k.openRenameSliceModal,L=k.openDeleteSliceModal,E=(0,A.H)(),Z=E.modalPayload,P=E.onOpenModal,R=Z.sliceFilterFn,O=Z.defaultVariationSelector,_=(0,d.v9)(function(e){return{remoteSlices:(0,I.sT)(e),libraries:(0,I.Sd)(e)}}),z=_.remoteSlices,F=_.libraries,V=(0,l.useState)(!1),K=V[0],B=V[1],H=F.filter(function(e){return e.isLocal}),X=F.map(function(e){return e.components=(0,i.Z)(e.components).sort(function(e,n){return e.model.name.localeCompare(n.model.name)}),e}),q=(F||[]).map(function(e){return e.components}).flat(),U=q.length,G=(0,l.useState)(),Y=G[0],$=G[1];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c(),{children:(0,r.jsx)("title",{children:"Slices - Slice Machine"})}),(0,r.jsxs)(x.LN,{children:[(0,r.jsxs)(x.wd,{children:[(0,r.jsx)(x.Cx,{folder:"Slices"}),(null==H?void 0:H.length)!==0&&0!==U?(0,r.jsx)(x.K2,{children:(0,r.jsx)(o.zx,{"data-cy":"create-slice",onClick:function(){B(!0)},startIcon:"add",children:"Create"})}):void 0]}),(0,r.jsxs)(x.RN,{children:[(0,r.jsx)(s.xR,{sx:{display:"flex",flexDirection:"column"},children:X.length>0?(0,r.jsx)(u.kC,{sx:{flex:1,flexDirection:"column"},children:0===U?(0,r.jsx)(u.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,r.jsx)(g,{title:"What are Slices?",onCreateNew:function(){B(!0)},buttonText:"Create one",videoPublicIdUrl:p.rd,documentationComponent:(0,r.jsxs)(r.Fragment,{children:['Slices are sections of your website. Prismic documents contain a dynamic "Slice Zone" that allows content creators to add, edit, and rearrange Slices to compose dynamic layouts for any page design.'," ",(0,r.jsx)(u.rU,{target:"_blank",href:"https://prismic.io/docs/core-concepts/slices",sx:function(e){var n;return{color:null==e?void 0:null===(n=e.colors)||void 0===n?void 0:n.primary}},children:"Learn more"}),"."]})})}):X.map(function(e){var n=e.name,t=e.isLocal,i=e.components;return(0,r.jsxs)(u.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,r.jsxs)(u.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsx)(u.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,r.jsx)(u.xv,{children:n})}),!t&&(0,r.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,r.jsx)(v.Z,{elems:i,defineElementKey:function(e){return e.model.name},renderElem:function(e){return(0,r.jsx)(T.b,{action:{type:"menu",onRemove:function(){$(e),L()},onRename:function(){$(e),w()}},mode:"navigation",onUpdateScreenshot:function(){P({sliceFilterFn:function(n){return n.filter(function(n){return n.model.id===e.model.id})}})},slice:e,variant:"solid"})},gridGap:"32px 16px"})]},n)})}):void 0}),(null==H?void 0:H.length)>0&&(0,r.jsx)(j.Z,{slices:R(q),defaultVariationSelector:O}),(null==H?void 0:H.length)>0&&K&&(0,r.jsx)(h.c,{localLibraries:H,remoteSlices:z,onSuccess:function(e,n){var t=e.variations[0].id,i=W.Y.getBuilderPagePathname({libraryName:n,sliceName:e.name,variationId:t});C.push(i),m.Am.success((0,D.kQ)({path:"".concat(n,"/").concat(e.name,"/model.json")}))},onClose:function(){B(!1)}}),(0,r.jsx)(N,{sliceId:null!==(e=null==Y?void 0:Y.model.id)&&void 0!==e?e:"",sliceName:null!==(n=null==Y?void 0:Y.model.name)&&void 0!==n?n:"",libName:null!==(t=null==Y?void 0:Y.from)&&void 0!==t?t:"","data-cy":"rename-slice-modal"}),(0,r.jsx)(M,{sliceId:null!==(a=null==Y?void 0:Y.model.id)&&void 0!==a?a:"",sliceName:null!==(y=null==Y?void 0:Y.model.name)&&void 0!==y?y:"",libName:null!==(b=null==Y?void 0:Y.from)&&void 0!==b?b:""})]})]})]})}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return g}});var i=t(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}t(52322);var o=["shift","alt","meta","mod","ctrl"],l={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function a(e){return(l[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function c(e,n){return void 0===n&&(n=","),e.split(n)}function s(e,n,t){void 0===n&&(n="+");var i,l=e.toLocaleLowerCase().split(n).map(function(e){return a(e)});return r({},{alt:l.includes("alt"),ctrl:l.includes("ctrl")||l.includes("control"),shift:l.includes("shift"),meta:l.includes("meta"),mod:l.includes("mod")},{keys:l.filter(function(e){return!o.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([a(e.key),a(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&m([a(e.key),a(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){u.clear()});var u=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];u.has("meta")&&u.forEach(function(e){var n;return!o.includes(e)&&u.delete(e.toLowerCase())}),n.forEach(function(e){return u.add(e.toLowerCase())})}function m(e){var n=Array.isArray(e)?e:[e];"meta"===e?u.clear():n.forEach(function(e){return u.delete(e.toLowerCase())})}function p(e,n){var t=e.target;void 0===n&&(n=!1);var i=t&&t.tagName;return d(n)?Boolean(i&&n&&n.some(function(e){return e.toLowerCase()===i.toLowerCase()})):Boolean(i&&n&&!0===n)}var x=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,l=n.meta,c=n.mod,s=n.shift,f=n.ctrl,m=n.keys,p=e.key,x=e.code,h=e.ctrlKey,v=e.metaKey,y=e.shiftKey,b=e.altKey,g=a(x),j=p.toLowerCase();if(!t){if(!b===o&&"alt"!==j||!y===s&&"shift"!==j)return!1;if(c){if(!v&&!h)return!1}else if(!v===l&&"meta"!==j&&"os"!==j||!h===f&&"ctrl"!==j&&"control"!==j)return!1}return!!(m&&1===m.length&&(m.includes(j)||m.includes(g)))||(m?(void 0===r&&(r=","),(d(i=m)?i:i.split(r)).every(function(e){return u.has(e.trim().toLowerCase())})):!m)},h=(0,i.createContext)(void 0),v=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},b="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function g(e,n,t,r){var o,l,u=(0,i.useRef)(null),g=(0,i.useRef)(!1),j=t instanceof Array?r instanceof Array?void 0:r:t,S=d(e)?e.join(null==j?void 0:j.splitKey):e,C=t instanceof Array?t:r instanceof Array?r:void 0,k=(0,i.useCallback)(n,null!=C?C:[]),w=(0,i.useRef)(k);C?w.current=k:w.current=n;var L=(!function e(n,t){return n&&t&&"object"==typeof n&&"object"==typeof t?Object.keys(n).length===Object.keys(t).length&&Object.keys(n).reduce(function(i,r){return i&&e(n[r],t[r])},!0):n===t}((l=(0,i.useRef)(void 0)).current,j)&&(l.current=j),l.current),I=(0,i.useContext)(v).enabledScopes,E=(0,i.useContext)(h);return b(function(){if((null==L?void 0:L.enabled)!==!1&&(e=I,n=null==L?void 0:L.scopes,0===e.length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!n||e.some(function(e){return n.includes(e)})||e.includes("*")))){var e,n,t=function(e,n){var t,i;if(void 0===n&&(n=!1),!(p(e,["input","textarea","select"])&&!p(e,null==L?void 0:L.enableOnFormTags)||null!=L&&null!=L.ignoreEventWhen&&L.ignoreEventWhen(e))){if(null!==u.current&&document.activeElement!==u.current&&!u.current.contains(document.activeElement)){y(e);return}(null==(t=e.target)||!t.isContentEditable||null!=L&&L.enableOnContentEditable)&&c(S,null==L?void 0:L.splitKey).forEach(function(t){var i,r,o,l,a,c,u,d=s(t,null==L?void 0:L.combinationKey);if(x(e,d,null==L?void 0:L.ignoreModifiers)||null!=(u=d.keys)&&u.includes("*")){if(n&&g.current)return;if(i=e,r=d,("function"==typeof(o=null==L?void 0:L.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),l=e,a=d,"function"==typeof(c=null==L?void 0:L.enabled)?!c(l,a):!0!==c&&void 0!==c){y(e);return}w.current(e,d),n||(g.current=!0)}})}},i=function(e){void 0!==e.key&&(f(a(e.code)),((null==L?void 0:L.keydown)===void 0&&(null==L?void 0:L.keyup)!==!0||null!=L&&L.keydown)&&t(e))},r=function(e){void 0!==e.key&&(m(a(e.code)),g.current=!1,null!=L&&L.keyup&&t(e,!0))},o=u.current||(null==j?void 0:j.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),E&&c(S,null==L?void 0:L.splitKey).forEach(function(e){return E.addHotkey(s(e,null==L?void 0:L.combinationKey,null==L?void 0:L.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),E&&c(S,null==L?void 0:L.splitKey).forEach(function(e){return E.removeHotkey(s(e,null==L?void 0:L.combinationKey,null==L?void 0:L.description))})}}},[S,L,I]),u}}},function(e){e.O(0,[789,958,80,774,888,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{74600:function(e,n,t){var i=t(34311),r=t(23779),o=i(function(e,n,t){return e+(t?" ":"")+r(n)});e.exports=o},26688:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices",function(){return t(12472)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var i=t(62230),r=t(85244),o=t(98240),l=t(52322),a=t(2784),c=t(75289),s=function(e,n){return e?"".concat(e,"-").concat(n):""},u=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},d=(0,a.forwardRef)(function(e,n){var t=e.label,a=e.Icon,d=e.type,f=e.form,m=e.isLoading,p=void 0!==m&&m,x=e.disabled,h=e.onClick,v=e.sx,y=e.iconSize,b=void 0===y?16:y,g=e.iconFill,j=e.variant,S=void 0===j?"primary":j,C=(0,o.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,l.jsx)(c.zx,(0,r.Z)((0,i.Z)({ref:n,sx:(0,i.Z)((0,r.Z)((0,i.Z)({},void 0===v?{}:v),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),p?{cursor:"wait !important"}:{}),type:d,form:f,disabled:void 0!==x&&x||p,onClick:p?void 0:h,variant:S},C),{children:p?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.$j,{size:b,color:u(S),"data-cy":s(C["data-cy"],"spinner")}),a&&t]}):(0,l.jsxs)(l.Fragment,{children:[a&&(0,l.jsx)(a,{size:b,fill:g,"data-cy":s(C["data-cy"],"icon")}),t]})}))})},45466:function(e,n,t){"use strict";t.d(n,{c:function(){return j}});var i=t(22710),r=t(62230),o=t(85244),l=t(99267),a=t(52322),c=t(75289),s=t(2784),u=t(36131),d=t(68780),f=t(88932),m=t(38876),p=t(40147),x=t(82770);function h(){return(h=(0,i.Z)(function(e){var n,t,i,r,o,a,c;return(0,l.__generator)(this,function(l){switch(l.label){case 0:var s;return l.trys.push([0,3,,4]),n=e.sliceName,t=e.libraryName,i=e.onSuccess,s=n,r={id:(0,m.T3)(s),type:"SharedSlice",name:s,description:s,variations:[{id:v,name:(0,m.MP)(v),docURL:"...",version:"initial",description:(0,m.MP)(v),imageUrl:""},]},[4,p.j.slices.createSlice({libraryID:t,model:r})];case 1:if((o=l.sent().errors).length>0)throw o;return x.Xe.track({event:"slice:created",id:(0,m.MP)(n),name:n,library:t}),[4,i(r)];case 2:return l.sent(),[3,4];case 3:return a=l.sent(),c="Internal Error: Slice not created",console.error(c,a),f.Am.error(c),[3,4];case 4:return[2]}})})).apply(this,arguments)}var v="default",y=t(90374),b=t(66443),g=t(70041),j=function(e){var n,t=e.onClose,f=e.onSuccess,m=e.localLibraries,p=e.remoteSlices,v=(0,y.Z)().createSliceSuccess,j=(0,s.useState)(!1),S=j[0],C=j[1],k=(n=(0,i.Z)(function(e){var n,t;return(0,l.__generator)(this,function(r){switch(r.label){case 0:var o;return n=e.sliceName,t=e.from,C(!0),[4,function(e){return h.apply(this,arguments)}({sliceName:n,libraryName:t,onSuccess:(o=(0,i.Z)(function(e){var n;return(0,l.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,x.y0)()];case 1:return v(n.sent().libraries),[4,f(e,t)];case 2:return n.sent(),[2]}})}),function(e){return o.apply(this,arguments)})})];case 1:return r.sent(),[2]}})}),function(e){return n.apply(this,arguments)});return(0,a.jsx)(d.Z,{dataCy:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:S,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:function(e){k(e)},initialValues:{sliceName:"",from:m[0].name},validate:function(e){return(0,b.h)(e,m,p)},content:{title:"Create a new slice"},children:function(e){var n=e.touched,t=e.values,i=e.setFieldValue,l=e.errors;return(0,a.jsxs)(c.xu,{children:[(0,a.jsx)(g.W,{name:"sliceName",label:"Slice Name",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?l.sliceName:void 0,dataCy:"slice-name-input"}),(0,a.jsx)(c.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,a.jsx)(u.ZP,{name:"from",options:m.map(function(e){return{value:e.name,label:e.name}}),onChange:function(e){return e?void i("from",e.value):null},defaultValue:{value:t.from,label:t.from},styles:{option:function(e){return(0,o.Z)((0,r.Z)({},e),{color:"#161618"})}},theme:function(e){return(0,o.Z)((0,r.Z)({},e),{colors:(0,o.Z)((0,r.Z)({},e.colors),{primary:"#E9E8EA"})})},menuPortalTarget:document.body})]})}})}},70041:function(e,n,t){"use strict";t.d(n,{W:function(){return a}});var i=t(62230),r=t(52322);t(2784);var o=t(63397),l=t(75289),a=function(e){var n=e.name,t=e.label,a=e.placeholder,c=e.error,s=e.dataCy,u=e.onChange;return(0,r.jsxs)(l.xu,{mb:3,children:[(0,r.jsx)(l.__,{htmlFor:n,mb:2,children:t}),(0,r.jsx)(o.gN,(0,i.Z)({name:n,type:"text",placeholder:a,as:l.II,autoComplete:"off"},u?{onChange:u}:null,s?{"data-cy":s}:null)),c?(0,r.jsx)(l.xv,{"data-cy":s?"".concat(s,"-error"):"input-error",sx:{color:"error",mt:1},children:c}):null]})}},66443:function(e,n,t){"use strict";t.d(n,{h:function(){return s}});var i=t(81541),r=t(75329),o=t(96009),l=t.n(o),a=t(74600),c=t.n(a);function s(e,n,t){var o=e.sliceName;if(!o)return{sliceName:"Cannot be empty"};if(!r.xo.exec(o))return{sliceName:"No special characters allowed"};if(c()(l()(o)).replace(/\s/gm,"")!==o.trim())return{sliceName:"Value has to be PascalCased"};if(o.match(/^\d/))return{sliceName:"Value cannot start with a number"};if(r.lS.includes(o))return{sliceName:"".concat(o," is reserved for Slice Machine use")};var a=n.flatMap(function(e){return e.components.map(function(e){return e.model.name})}),s=t.map(function(e){return e.name});if((0,i.Z)(a).concat((0,i.Z)(s)).includes(o))return{sliceName:"Slice name is already taken."}}},59469:function(e,n,t){"use strict";var i=t(62230),r=t(52322),o=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,l=e.defineElementKey,a=e.gridTemplateMinPx,c=e.gridGap,s=e.sx;return(0,r.jsx)(o.xu,{as:"section",sx:(0,i.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===a?"320px":a,", 1fr))"),gridGap:void 0===c?"16px":c,pt:2},s),children:n.map(function(e,n){return e?(0,r.jsx)("span",{children:t(e,n)},"".concat(l(e),"-").concat(n+1)):null})})}},68780:function(e,n,t){"use strict";var i=t(62230),r=t(85244),o=t(52322),l=t(37149),a=t.n(l),c=t(25812),s=t(63397),u=t(75289),d=t(56577),f=t(54132);n.Z=function(e){var n=e.children,t=e.close,l=e.isOpen,m=e.formId,p=e.validate,x=e.onSubmit,h=e.widthInPx,v=e.initialValues,y=e.content.title,b=e.cardProps,g=e.omitFooter,j=void 0!==g&&g,S=e.isLoading,C=void 0!==S&&S,k=e.buttonLabel,w=void 0===k?"Save":k,L=e.dataCy,I=e.actionMessage;return a().setAppElement("#__next"),(0,o.jsx)(c.Z,{isOpen:l,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:y,style:{content:{width:null!=h?h:"900px"}},children:(0,o.jsx)(s.J9,{validateOnChange:!0,initialValues:v,validate:function(e){return p?p(e):void 0},onSubmit:function(e){x(e)},children:function(e){var l=e.isValid,a=e.isSubmitting,c=e.values,p=e.errors,x=e.touched,h=e.setFieldValue,v=e.setValues;return(0,o.jsx)(s.l0,(0,r.Z)((0,i.Z)({id:m},null!=L?{"data-cy":L}:null),{children:(0,o.jsx)(f.Z,(0,r.Z)((0,i.Z)({borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"}},b),{Header:function(e){var n=e.radius;return(0,o.jsxs)(u.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},children:[(0,o.jsx)(u.X6,{sx:{fontSize:"20px"},children:y}),(0,o.jsx)(u.x8,{type:"button",onClick:t})]})},Footer:j?null:(0,o.jsxs)(u.kC,{sx:{alignItems:"space-between"},children:[(0,o.jsx)(u.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof I?I(e):I}),(0,o.jsxs)(u.kC,{sx:{ml:"auto"},children:[(0,o.jsx)(u.zx,{mr:2,type:"button",onClick:t,variant:"secondary",disabled:a||C,children:"Cancel"}),(0,o.jsx)(d.z,{label:w,form:m,type:"submit",disabled:!l||a||C,isLoading:a||C,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:n({isValid:l,isSubmitting:a,values:c,errors:p,touched:x,setFieldValue:h,setValues:v})}))}))}})})}},12472:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return V}});var i=t(81541),r=t(52322),o=t(22715),l=t(2784),a=t(97729),c=t.n(a),s=t(65077),u=t(75289),d=t(56580),f=t(5632),m=t(88932),p=t(75329),x=t(22031),h=t(45466),v=t(59469),y=t(36887),b=t(82770),g=function(e){var n=e.title,t=e.onCreateNew,i=e.buttonText,o=e.documentationComponent,l=e.videoPublicIdUrl;return(0,r.jsxs)(u.xu,{sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"},children:[(0,r.jsx)(u.xu,{sx:function(e){var n;return{display:"flex",flex:1,alignItems:"center",minWidth:"400px",maxWidth:"70%",border:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02)}},children:(0,r.jsx)(y.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:l,onPlay:function(){b.Xe.track({event:"open-video-tutorials",video:l})}})}),(0,r.jsxs)(u.xu,{sx:function(e){var n;return{bg:"white",display:"flex",flexDirection:"column",border:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02),flex:1,minWidth:"400px",maxWidth:"70%"}},children:[(0,r.jsxs)(u.xu,{sx:function(e){var n;return{display:"flex",flexDirection:"column",p:4,borderBottom:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02)}},children:[(0,r.jsx)(u.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:n}),(0,r.jsx)(u.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:o})]}),(0,r.jsxs)(u.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,r.jsx)(u.zx,{onClick:t,"data-cy":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:i}),(0,r.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"})]})]})]})},j=t(84449),S=t(90374),C=t(68780),k=t(70041),w=t(77174),L=t(24340),I=t(75992),E=t(66443),N=function(e){var n=e.sliceName,t=e.sliceId,i=e.libName,o=(0,S.Z)(),l=o.renameSlice,a=o.closeModals,c=(0,d.v9)(function(e){return{isRenameSliceModalOpen:(0,w.gP)(e,L.q.RENAME_SLICE),localLibs:(0,I.Sd)(e),remoteLibs:(0,I.sT)(e)}}),s=c.isRenameSliceModalOpen,f=c.localLibs,m=c.remoteLibs,p=function(e){l(i,t,e.sliceName)};return(0,r.jsx)(C.Z,{dataCy:"rename-slice-modal",isOpen:s,widthInPx:"530px",formId:"rename-slice-modal-".concat(t),close:a,buttonLabel:"Rename",onSubmit:p,initialValues:{sliceName:n},content:{title:"Rename a slice"},validate:function(e){return(0,E.h)(e,f,m)},children:function(e){var n=e.touched,t=e.errors;return(0,r.jsx)(u.xu,{children:(0,r.jsx)(k.W,{name:"sliceName",label:"Slice Name","data-cy":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?t.sliceName:void 0,dataCy:"slice-name-input"})})}})},Z=t(25812),P=t(59326),R=t(54132),O=t(65186),_=t(56577),z=t(3098),F=t(32665),M=function(e){var n=e.sliceId,t=e.sliceName,i=e.libName,o=(0,d.v9)(function(e){return{isSliceModalOpen:(0,w.gP)(e,L.q.DELETE_SLICE),isDeletingSlice:(0,F.hg)(e,z.z.DELETE_SLICE)}}),l=o.isSliceModalOpen,a=o.isDeletingSlice,c=(0,S.Z)(),s=c.closeModals,f=c.deleteSlice,m=(0,P.B7)().theme;return(0,r.jsx)(Z.Z,{isOpen:l,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:s,children:(0,r.jsx)(R.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},borderFooter:!0,Header:function(){var e;return(0,r.jsxs)(u.kC,{sx:{position:"sticky",background:"gray",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,r.jsxs)(u.kC,{sx:{alignItems:"center"},children:[(0,r.jsx)(O.$vK,{size:20,color:null===(e=m.colors)||void 0===e?void 0:e.greyIcon}),(0,r.jsx)(u.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,r.jsx)(u.x8,{type:"button",onClick:s})]})},Footer:function(){return(0,r.jsxs)(u.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorders))},backgroundColor:"gray"},children:[(0,r.jsx)(_.z,{label:"Cancel",variant:"secondary",onClick:function(){return s()},sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,r.jsx)(_.z,{label:"Delete",variant:"danger",isLoading:a,sx:{minHeight:39,minWidth:78},onClick:function(){return f(n,t,i)}})]})},children:(0,r.jsxs)(u.nv,{children:["This action will immediately make the following changes:",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["Delete the"," ",(0,r.jsxs)(u.xv,{sx:{fontWeight:"bold"},children:[i,"/",t,"/"]})," ","directory."]}),(0,r.jsx)("li",{children:"Remove the Slice from all Slice Zones that use it."})]}),"The next time you push your changes to Prismic, the following change will happen:",(0,r.jsx)("ul",{children:(0,r.jsx)("li",{children:"Remove the Slice from the list of available Slices to use in the Page Builder."})}),"You will need to manually remove the Slice from any Pages that currently use it."]})})})},A=t(47731),T=t(65958),W=t(49451),D=t(13858),V=function(){var e,n,t,a,y,b,C=(0,f.useRouter)(),k=(0,S.Z)(),w=k.openRenameSliceModal,L=k.openDeleteSliceModal,E=(0,A.H)(),Z=E.modalPayload,P=E.onOpenModal,R=Z.sliceFilterFn,O=Z.defaultVariationSelector,_=(0,d.v9)(function(e){return{remoteSlices:(0,I.sT)(e),libraries:(0,I.Sd)(e)}}),z=_.remoteSlices,F=_.libraries,V=(0,l.useState)(!1),K=V[0],B=V[1],H=F.filter(function(e){return e.isLocal}),X=F.map(function(e){return e.components=(0,i.Z)(e.components).sort(function(e,n){return e.model.name.localeCompare(n.model.name)}),e}),q=(F||[]).map(function(e){return e.components}).flat(),U=q.length,G=(0,l.useState)(),Y=G[0],$=G[1];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c(),{children:(0,r.jsx)("title",{children:"Slices - Slice Machine"})}),(0,r.jsxs)(x.LN,{children:[(0,r.jsxs)(x.wd,{children:[(0,r.jsx)(x.Cx,{folder:"Slices"}),(null==H?void 0:H.length)!==0&&0!==U?(0,r.jsx)(x.K2,{children:(0,r.jsx)(o.zx,{"data-cy":"create-slice",onClick:function(){B(!0)},startIcon:"add",children:"Create"})}):void 0]}),(0,r.jsxs)(x.RN,{children:[(0,r.jsx)(s.xR,{sx:{display:"flex",flexDirection:"column"},children:X.length>0?(0,r.jsx)(u.kC,{sx:{flex:1,flexDirection:"column"},children:0===U?(0,r.jsx)(u.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,r.jsx)(g,{title:"What are Slices?",onCreateNew:function(){B(!0)},buttonText:"Create one",videoPublicIdUrl:p.rd,documentationComponent:(0,r.jsxs)(r.Fragment,{children:['Slices are sections of your website. Prismic documents contain a dynamic "Slice Zone" that allows content creators to add, edit, and rearrange Slices to compose dynamic layouts for any page design.'," ",(0,r.jsx)(u.rU,{target:"_blank",href:"https://prismic.io/docs/core-concepts/slices",sx:function(e){var n;return{color:null==e?void 0:null===(n=e.colors)||void 0===n?void 0:n.primary}},children:"Learn more"}),"."]})})}):X.map(function(e){var n=e.name,t=e.isLocal,i=e.components;return(0,r.jsxs)(u.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,r.jsxs)(u.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsx)(u.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,r.jsx)(u.xv,{children:n})}),!t&&(0,r.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,r.jsx)(v.Z,{elems:i,defineElementKey:function(e){return e.model.name},renderElem:function(e){return(0,r.jsx)(T.b,{action:{type:"menu",onRemove:function(){$(e),L()},onRename:function(){$(e),w()}},mode:"navigation",onUpdateScreenshot:function(){P({sliceFilterFn:function(n){return n.filter(function(n){return n.model.id===e.model.id})}})},slice:e,variant:"solid"})},gridGap:"32px 16px"})]},n)})}):void 0}),(null==H?void 0:H.length)>0&&(0,r.jsx)(j.Z,{slices:R(q),defaultVariationSelector:O}),(null==H?void 0:H.length)>0&&K&&(0,r.jsx)(h.c,{localLibraries:H,remoteSlices:z,onSuccess:function(e,n){var t=e.variations[0].id,i=W.Y.getBuilderPagePathname({libraryName:n,sliceName:e.name,variationId:t});C.push(i),m.Am.success((0,D.kQ)({path:"".concat(n,"/").concat(e.name,"/model.json")}))},onClose:function(){B(!1)}}),(0,r.jsx)(N,{sliceId:null!==(e=null==Y?void 0:Y.model.id)&&void 0!==e?e:"",sliceName:null!==(n=null==Y?void 0:Y.model.name)&&void 0!==n?n:"",libName:null!==(t=null==Y?void 0:Y.from)&&void 0!==t?t:"","data-cy":"rename-slice-modal"}),(0,r.jsx)(M,{sliceId:null!==(a=null==Y?void 0:Y.model.id)&&void 0!==a?a:"",sliceName:null!==(y=null==Y?void 0:Y.model.name)&&void 0!==y?y:"",libName:null!==(b=null==Y?void 0:Y.from)&&void 0!==b?b:""})]})]})]})}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return g}});var i=t(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}t(52322);var o=["shift","alt","meta","mod","ctrl"],l={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function a(e){return(l[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function c(e,n){return void 0===n&&(n=","),e.split(n)}function s(e,n,t){void 0===n&&(n="+");var i,l=e.toLocaleLowerCase().split(n).map(function(e){return a(e)});return r({},{alt:l.includes("alt"),ctrl:l.includes("ctrl")||l.includes("control"),shift:l.includes("shift"),meta:l.includes("meta"),mod:l.includes("mod")},{keys:l.filter(function(e){return!o.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([a(e.key),a(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&m([a(e.key),a(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){u.clear()});var u=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];u.has("meta")&&u.forEach(function(e){var n;return!o.includes(e)&&u.delete(e.toLowerCase())}),n.forEach(function(e){return u.add(e.toLowerCase())})}function m(e){var n=Array.isArray(e)?e:[e];"meta"===e?u.clear():n.forEach(function(e){return u.delete(e.toLowerCase())})}function p(e,n){var t=e.target;void 0===n&&(n=!1);var i=t&&t.tagName;return d(n)?Boolean(i&&n&&n.some(function(e){return e.toLowerCase()===i.toLowerCase()})):Boolean(i&&n&&!0===n)}var x=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,l=n.meta,c=n.mod,s=n.shift,f=n.ctrl,m=n.keys,p=e.key,x=e.code,h=e.ctrlKey,v=e.metaKey,y=e.shiftKey,b=e.altKey,g=a(x),j=p.toLowerCase();if(!t){if(!b===o&&"alt"!==j||!y===s&&"shift"!==j)return!1;if(c){if(!v&&!h)return!1}else if(!v===l&&"meta"!==j&&"os"!==j||!h===f&&"ctrl"!==j&&"control"!==j)return!1}return!!(m&&1===m.length&&(m.includes(j)||m.includes(g)))||(m?(void 0===r&&(r=","),(d(i=m)?i:i.split(r)).every(function(e){return u.has(e.trim().toLowerCase())})):!m)},h=(0,i.createContext)(void 0),v=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},b="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function g(e,n,t,r){var o,l,u=(0,i.useRef)(null),g=(0,i.useRef)(!1),j=t instanceof Array?r instanceof Array?void 0:r:t,S=d(e)?e.join(null==j?void 0:j.splitKey):e,C=t instanceof Array?t:r instanceof Array?r:void 0,k=(0,i.useCallback)(n,null!=C?C:[]),w=(0,i.useRef)(k);C?w.current=k:w.current=n;var L=(!function e(n,t){return n&&t&&"object"==typeof n&&"object"==typeof t?Object.keys(n).length===Object.keys(t).length&&Object.keys(n).reduce(function(i,r){return i&&e(n[r],t[r])},!0):n===t}((l=(0,i.useRef)(void 0)).current,j)&&(l.current=j),l.current),I=(0,i.useContext)(v).enabledScopes,E=(0,i.useContext)(h);return b(function(){if((null==L?void 0:L.enabled)!==!1&&(e=I,n=null==L?void 0:L.scopes,0===e.length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!n||e.some(function(e){return n.includes(e)})||e.includes("*")))){var e,n,t=function(e,n){var t,i;if(void 0===n&&(n=!1),!(p(e,["input","textarea","select"])&&!p(e,null==L?void 0:L.enableOnFormTags)||null!=L&&null!=L.ignoreEventWhen&&L.ignoreEventWhen(e))){if(null!==u.current&&document.activeElement!==u.current&&!u.current.contains(document.activeElement)){y(e);return}(null==(t=e.target)||!t.isContentEditable||null!=L&&L.enableOnContentEditable)&&c(S,null==L?void 0:L.splitKey).forEach(function(t){var i,r,o,l,a,c,u,d=s(t,null==L?void 0:L.combinationKey);if(x(e,d,null==L?void 0:L.ignoreModifiers)||null!=(u=d.keys)&&u.includes("*")){if(n&&g.current)return;if(i=e,r=d,("function"==typeof(o=null==L?void 0:L.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),l=e,a=d,"function"==typeof(c=null==L?void 0:L.enabled)?!c(l,a):!0!==c&&void 0!==c){y(e);return}w.current(e,d),n||(g.current=!0)}})}},i=function(e){void 0!==e.key&&(f(a(e.code)),((null==L?void 0:L.keydown)===void 0&&(null==L?void 0:L.keyup)!==!0||null!=L&&L.keydown)&&t(e))},r=function(e){void 0!==e.key&&(m(a(e.code)),g.current=!1,null!=L&&L.keyup&&t(e,!0))},o=u.current||(null==j?void 0:j.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),E&&c(S,null==L?void 0:L.splitKey).forEach(function(e){return E.addHotkey(s(e,null==L?void 0:L.combinationKey,null==L?void 0:L.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),E&&c(S,null==L?void 0:L.splitKey).forEach(function(e){return E.removeHotkey(s(e,null==L?void 0:L.combinationKey,null==L?void 0:L.description))})}}},[S,L,I]),u}}},function(e){e.O(0,[789,958,80,774,888,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.gdfsm51{border-collapse:collapse;table-layout:fixed}.gdfsm55{vertical-align:middle}.gdfsm55:first-child{padding-right:var(--
|
|
1
|
+
.gdfsm51{border-collapse:collapse;table-layout:fixed}.gdfsm55{vertical-align:middle}.gdfsm55:first-child{padding-right:var(--_7j49md4n);width:var(--_7j49md49)}.gdfsm55:last-child{padding-left:var(--_7j49md4n);padding-right:var(--_7j49md4v);width:var(--_7j49md4b)}.gdfsm52 .gdfsm55{font-size:12px;font-weight:500}.gdfsm53 .gdfsm55{border-top-style:var(--_7j49mdf);font-size:14px}.gdfsm53 .gdfsm55:nth-child(2){color:var(--_7j49md1g);font-weight:600}.gdfsm52 .gdfsm55:first-child>.gdfsm56{padding-left:var(--_7j49md4r)}:is(.gdfsm53,.gdfsm52) .gdfsm55:not(:first-child):not(:last-child)>.gdfsm56{display:revert;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}._18bjhbz0{max-width:498px;min-height:400px;background-color:var(--_7j49md15)}._18bjhbz1{background-size:cover;background-color:transparent;border-radius:var(--_7j49md3);border-style:var(--_7j49mdd);height:100%;max-width:100%}._18bjhbz1 ._18bjhbz3{padding:64px}._18bjhbz4{font-size:18px;font-weight:600;line-height:32px}._18bjhbz5{font-weight:400;line-height:24px}._18bjhbz1 ._18bjhbz5{max-width:464px;align-self:center}._18bjhbz1 ._18bjhbz6{justify-content:center}
|