slice-machine-ui 1.25.1-beta.1 → 1.25.1-beta.2
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/components/FailedConnect/index.tsx +1 -1
- package/components/Simulator/index.tsx +17 -57
- package/lib/builders/SliceBuilder/SimulatorButton/index.tsx +4 -26
- package/lib/builders/SliceBuilder/index.tsx +1 -11
- package/lib/models/common/Environment.ts +0 -1
- package/out/404.html +1 -1
- package/out/_next/static/chunks/{474-5a072e6fac61f703.js → 210-aee6116139329803.js} +2 -2
- package/out/_next/static/chunks/46-d22d7a121254e31d.js +8 -0
- package/out/_next/static/chunks/{696-b12edad30a3617e5.js → 696-b992b9e1ce75777e.js} +1 -1
- package/out/_next/static/chunks/{904-bed9c8dade39dc27.js → 904-1a755ebb0f5ee4ac.js} +1 -1
- package/out/_next/static/chunks/pages/{_app-e32e7f8142e6cde0.js → _app-c0d8973a13d54a4c.js} +23 -23
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-97ab3b90b85d645d.js → [customTypeId]-d1a4a07e6b600fa6.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-84a22c5e480d3fa9.js → [pageTypeId]-a724ff12ef322020.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-3eb0fdce3228d389.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-ba6c3e2624f32fcd.js +1 -0
- package/out/_next/static/re4cxnEJmZdCTdRZZUIWc/_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/settings.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +3 -5
- package/src/apiClient.ts +0 -6
- package/src/modules/environment/index.ts +0 -6
- package/src/modules/modal/types.ts +0 -1
- package/src/modules/simulator/index.ts +5 -133
- package/src/modules/simulator/types.ts +0 -6
- package/src/modules/useSliceMachineActions.ts +1 -11
- package/test/__testutils__/createTestPlugin.ts +0 -1
- package/test/src/modules/__fixtures__/serverState.ts +0 -1
- package/test/src/modules/simulator.test.ts +0 -196
- package/components/CodeSpan/index.tsx +0 -23
- package/components/HTMLRenderer/index.tsx +0 -137
- package/components/Simulator/components/SetupModal/TextWithInlineCode.tsx +0 -21
- package/components/Simulator/components/SetupModal/index.tsx +0 -165
- package/out/_next/static/PAJQyEuW0rRHPSn18wYrk/_buildManifest.js +0 -1
- package/out/_next/static/chunks/777-7bc4ca95c82802e5.js +0 -8
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-a8213af71b0a99c9.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-60858a3cead6dc81.js +0 -1
- /package/out/_next/static/{PAJQyEuW0rRHPSn18wYrk → re4cxnEJmZdCTdRZZUIWc}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
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,S=e.variant,j=void 0===S?"primary":S,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:j},k),{children:h?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.$j,{size:b,color:u(j),"data-testid":l(k["data-testid"],"spinner")}),c&&t]}):(0,s.jsxs)(s.Fragment,{children:[c&&(0,s.jsx)(c,{size:b,fill:C,"data-testid":l(k["data-testid"],"icon")}),t]})}))})},54132:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(62230),i=t(85244),o=t(98240),s=t(52322);t(2784);var c=t(75289),a=function(e){var n=e.bg,t=e.background,i=e.sx,o=e.withRadius,a=e.radius,l=e.children;return(0,s.jsx)(c.xu,{sx:(0,r.Z)({p:4,bg:n||t},o?{borderBottomLeftRadius:a,borderBottomRightRadius:a}:null,i),children:l})},l=function(e){var n=e.Header,t=void 0===n?null:n,l=e.SubHeader,u=void 0===l?null:l,d=e.Body,x=void 0===d?null:d,f=e.Footer,h=void 0===f?null:f,p=e.borderFooter,v=e.radius,m=void 0===v?"6px":v,g=e.bodySx,b=e.footerSx,C=e.sx,S=e.bg,j=e.background,k=e.children,y=(0,o.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,s.jsxs)(c.Zb,(0,i.Z)((0,r.Z)({sx:(0,r.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:m},void 0===C?null:C)},y),{children:[t?(0,s.jsx)(t,{radius:m}):null,u?(0,s.jsx)(u,{radius:m}):null,(0,s.jsxs)(a,{bg:S,background:j,sx:void 0===g?{}:g,withRadius:!h,children:[x?(0,s.jsx)(x,{}):null,k||null]}),h?(0,s.jsx)(a,{bg:S,background:j,sx:(0,r.Z)({},void 0!==p&&p?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===b?{}:b),radius:m,withRadius:!0,children:"object"==typeof h?h:(0,s.jsx)(h,{})}):null]}))}},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 ek}});var r,i,o,s,c=t(52322),a=t(97729),l=t.n(a),u=t(5632),d=t.n(u),x=t(22710),f=t(62230),h=t(85244),p=t(99267),v=t(2784),m=t(71463),g=t(22715),b=t(88932),C=t(75289),S=t(65077),j=t(56577),k=t(19909),y=function(e){var n=e.defaultValue,t=e.variations,r=e.MenuItemAction,i=e.onChange;return(0,c.jsxs)(C.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)(C.xv,{sx:{p:3,fontSize:12,color:"textClear"},children:[t.length," VARIATION",t.length>1?"S":""]}),(0,c.jsxs)(C.kC,{sx:{p:0,flexDirection:"column"},children:[t.map(function(e){return(0,c.jsx)(E,{value:e,isActive:e.id===n.id,onClick:i},e.id)}),r||null]})]})},E=function(e){var n=e.value,t=e.isActive,r=e.onClick;return(0,c.jsx)(C.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})},w=t(75100),_=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,v.useState)(!1),u=l[0],d=l[1],x=(0,v.useState)(t||r[0]),h=x[0],p=x[1];(0,v.useEffect)(function(){t&&p(t)},[t]);var m=function(e){d(!1),p(e),setTimeout(function(){return o(e)},210)},g=(0,c.jsx)(C.xu,{sx:{p:2},children:(0,c.jsx)(C.zx,{variant:"transparent",sx:{color:"text"},onClick:function(){d(!1),i&&i()},children:"+ Add new variation"})});return(0,c.jsx)(C.xu,{sx:s,children:(0,c.jsx)(k.Popover,{align:"start",isOpen:u,onClickOutside:function(){return d(!1)},positions:["bottom"],padding:10,content:function(){return(0,c.jsx)(y,{defaultValue:h,variations:r,onChange:m,MenuItemAction:i?g:void 0})},containerClassName:"variationSelectorContainer",children:(0,c.jsxs)(C.zx,{sx:(0,f.Z)({},n),variant:"dropDownButton",onClick:function(){return d(!u)},disabled:a,children:[h.name," ",u?(0,c.jsx)(w.bOz,{size:"16px","aria-label":"Collapse variations"}):(0,c.jsx)(w.mEq,{size:"16px","aria-label":"Expand variations"})]})})})},I=function(e){return(0,c.jsxs)("svg",(0,h.Z)((0,f.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"})]}))},D=function(e,n,t){if(!n){d().push("/".concat(e.href,"/").concat(e.model.name));return}var r,i,o,s,c,a,l,u,x,f=(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":""),x="/slices/".concat(i,"/").concat(o,"/").concat(s).concat(l?"/simulator":""),{href:u,as:x,options:a,all:[u,x,a]});d().push(f.href,f.as,f.options)},Z=function(e){var n=e.slice,t=e.variation,r=e.isDisplayEditor,i=e.toggleIsDisplayEditor,o=e.onSaveMock,s=e.actionsDisabled,a=e.isSavingMock;return(0,c.jsxs)(C.kC,{sx:{p:"16px",display:"flex",bg:"grey07",gridTemplateRows:"1fr",borderBottom:"1px solid #DCDBDD",justifyContent:"space-between"},children:[(0,c.jsxs)(C.kC,{sx:{alignItems:"center"},children:[(0,c.jsx)(I,{height:"20px",width:"20px",fill:"#1A1523"}),(0,c.jsx)(C.xv,{sx:{ml:2,mr:"12px",fontSize:"14px",color:"#1A1523",fontWeight:"600",letterSpacing:"-0.15px"},children:n.model.name}),(0,c.jsx)(_,{defaultValue:t,variations:n.model.variations,onChange:function(e){return D(n,e,!0)},disabled:n.model.variations.length<=1||s})]}),(0,c.jsxs)(C.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,c.jsx)(C.kC,{sx:{alignItems:"center",justifyContent:"space-around"},children:(0,c.jsxs)(C.kC,{sx:{alignItems:"center",mr:4},children:[(0,c.jsx)(C.__,{htmlFor:"show-mock-editor",sx:{color:"#6F6E77",lineHeight:"16px",fontSize:"12px",fontWeight:"600",letterSpacing:"0px"},children:"Editor"}),(0,c.jsx)(C.rs,{id:"show-mock-editor",checked:r,onChange:i,disabled:s})]})}),(0,c.jsx)(j.z,{"data-testid":"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"}}}})]})]})},R=t(82770),F=t(56580),z=t(39092),T=function(e){var n=e.defaultValue,t=e.options,r=e.onChange;return(0,c.jsx)(C.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)(C.kC,{sx:{p:0,flexDirection:"column"},children:t.map(function(e){return(0,c.jsx)(N,{value:e,isActive:e===n,onClick:r})})})})},N=function(e){var n=e.value,t=e.isActive,r=e.onClick;return(0,c.jsx)(C.xu,{sx:{p:2,cursor:"pointer",fontSize:"14px",borderRadius:0,bg:t?"hoverBackground":"background",":hover":{bg:"hoverBackground"}},onClick:function(){return r(n)},children:n})},O=function(e){var n=e.buttonSx,t=e.currentValue,r=e.options,i=e.onChange,o=e.disabled,s=(0,v.useState)(!1),a=s[0],l=s[1],u=function(e){l(!1),setTimeout(function(){return i(e)},210)};return(0,c.jsx)(C.xu,{children:(0,c.jsx)(k.Popover,{align:"start",isOpen:a,onClickOutside:function(){return l(!1)},positions:["bottom"],padding:2,content:function(){return(0,c.jsx)(T,{defaultValue:t,options:r,onChange:u})},children:(0,c.jsxs)(C.zx,{sx:n,variant:"dropDownButton",onClick:function(){return l(!a)},disabled:o,children:[t," ",a?(0,c.jsx)(w.bOz,{size:"24px"}):(0,c.jsx)(w.mEq,{size:"24px"})]})})})},A=t(67557);(s=r||(r={})).DESKTOP="Desktop",s.TABLET="Tablet",s.MOBILE="Mobile",s.CUSTOM="Custom";var L=(i={},(0,A.Z)(i,r.DESKTOP,{width:1280,height:800}),(0,A.Z)(i,r.TABLET,{width:1080,height:810}),(0,A.Z)(i,r.MOBILE,{width:390,height:844}),i),M=function(e){var n=e.label,t=e.startValue,r=e.onChange,i=e.sx,o=e.disabled,s=["e","-","+",",","."];return(0,c.jsxs)(C.kC,{sx:(0,f.Z)({alignItems:"center"},i),children:[(0,c.jsx)(C.__,{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)(C.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()}})]})},U=function(e){var n=e.handleScreenSizeChange,t=e.screenDimensions,i=e.actionsDisabled,o=(0,v.useState)(r.DESKTOP),s=o[0],a=o[1],l=function(e){a(e),e!==r.CUSTOM&&n(L[e])},u=function(e){var t=Object.values(L).findIndex(function(n){return JSON.stringify(n)===JSON.stringify(e)}),i=t<0?r.CUSTOM:Object.keys(L)[t];a(i),n(e)};return(0,c.jsx)(C.kC,{sx:{alignItems:"center",pb:"16px",justifyContent:"space-between",variant:"small"},children:(0,c.jsxs)(C.kC,{sx:{alignItems:"center",flex:1},children:[(0,c.jsx)(O,{options:Object.values(r),onChange:l,buttonSx:{alignSelf:"start"},currentValue:s,disabled:i}),(0,c.jsx)(M,{label:"W",startValue:t.width.toString(),onChange:function(e){u((0,h.Z)((0,f.Z)({},t),{width:Number(e.target.value)}))},disabled:i,sx:{mx:2}}),(0,c.jsx)(w.eSQ,{size:16,color:"#6F6E77"}),(0,c.jsx)(M,{label:"H",startValue:t.height.toString(),onChange:function(e){u((0,h.Z)((0,f.Z)({},t),{height:Number(e.target.value)}))},disabled:i,sx:{ml:2}})]})})},P=t(25812),B=t(77174),W=t(24340),H=t(90374),V=t(54132),q=t(61931),X=function(e){var n=e.sliceName,t=e.screenshotUrl,r=(0,F.v9)(function(e){return{isScreenshotModalOpen:(0,B.gP)(e,W.q.SCREENSHOT_PREVIEW)}}).isScreenshotModalOpen,i=(0,H.Z)().closeModals;return(0,c.jsx)(P.Z,{isOpen:r,shouldCloseOnOverlayClick:!0,contentLabel:"Screenshot Preview",portalClassName:"ScreenshotPreviewModal",onRequestClose:i,children:(0,c.jsx)(V.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)(C.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)(C.X6,{sx:{fontSize:"14px"},children:["Screenshot Preview for ",n]}),(0,c.jsx)(C.x8,{type:"button",onClick:function(){return i()}})]})},Footer:function(){return(0,c.jsx)(C.kC,{style:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:"1px solid #DCDBDD"},children:(0,c.jsx)(C.zx,{variant:"secondary",sx:{fontWeight:600},onClick:function(){return i()},children:"Close"})})},children:(0,c.jsx)(q.q,{src:t,sx:{height:"320px"}})})})},G=t(25242),K=t(81541),Y=function(e,n,t){var r=(0,v.useState)(e()),i=r[0],o=r[1],s=(0,v.useRef)(Date.now());return(0,v.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,K.Z)(t))),i},J=t(17064),Q=t(16),$=function(e){var n,t,r,i,o,s,a,l=e.apiContent,u=e.screenDimensions,d=e.simulatorUrl,h=e.dryRun,m=e.isScreenshot,g=void 0!==m&&m,b=(0,J.Z)((t=(n=(0,v.useState)())[0],r=n[1],i=(0,v.useRef)(),o=(0,v.useRef)(),a=(0,v.useCallback)((s=(0,x.Z)(function(e){var n,t,s,c;return(0,p.__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,x.Z)(function(){var e;return(0,p.__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),S=b[0],j=b[1],k=(0,H.Z)(),y=k.connectToSimulatorSuccess,E=k.connectToSimulatorFailure;(0,v.useEffect)(function(){var e;if(!d){E();return}if(void 0!==S){if(!S.connected){E(),console.warn("Trying to use a disconnected simulator client.");return}(e=(0,x.Z)(function(){return(0,p.__generator)(this,function(e){switch(e.label){case 0:return[4,S.setSliceZone([l])];case 1:return e.sent(),[2]}})}),function(){return e.apply(this,arguments)})().then(function(){y()}).catch(function(){E()})}},[S,l,d]);var w,_,I,D,Z,R,F,z,T,N=(0,v.useState)(),O=N[0],A=N[1],L=(w=function(e){var n;A({height:e.blockSize,width:e.inlineSize})},I=(0,v.useRef)(),(0,v.useCallback)(function(e){var n;null===(n=I.current)||void 0===n||n.disconnect(),null!==e&&(I.current=new ResizeObserver(function(n){var t,r=(0,J.Z)(n,1)[0].contentRect;w({blockSize:r.height,inlineSize:r.width},e)}),I.current.observe(e))},[]));return(0,c.jsx)(C.kC,{ref:L,sx:(0,f.Z)({alignItems:"center",backgroundColor:"headSection",backgroundImage:"url(/pattern.png)",backgroundRepeat:"repeat",backgroundSize:"10px",border:g?void 0:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},borderRadius:g?void 0:8,display:"flex",height:"100%",justifyContent:"center",overflow:"hidden"},void 0!==h&&h?{display:"none"}:{}),children:d?(0,c.jsx)("iframe",{ref:j,src:d,style:(0,f.Z)({border:"none",maxHeight:"".concat(u.height,"px"),maxWidth:"".concat(u.width,"px"),minHeight:"".concat(u.height,"px"),minWidth:"".concat(u.width,"px"),overflowY:"auto"},O?{transform:"scale(".concat((D=u,Z=O,R=D.height,F=D.width,z=Z.height,T=Z.width,F>T||R>z?F-T>R-z?T/F:z/R:1),")")}:{display:"none"})}):null})},ee=t(52039),en=t(8564),et=function(e){var n=e.children,t=e.sx;return(0,c.jsx)(C.kC,{sx:(0,f.Z)({bg:"grey07",height:"90%",width:"100%",justifyContent:"center",alignItems:"center",zIndex:"1"},t),children:(0,c.jsx)(C.kC,{sx:{marginTop:"-128px",justifyContent:"center",flexDirection:"column",alignItems:"center"},children:n})})},er=t(85819),ei=function(e){var n=e.onRetrigger;return(0,c.jsxs)(et,{children:[(0,c.jsx)(C.Ee,{src:"/iframe-not-running.png",sx:{width:"320px"}}),(0,c.jsx)(C.xv,{sx:{color:"textClear",mb:2,fontSize:"14px",lineHeight:"24px",fontWeight:"600"},children:"Slice Machine can't render your Slice"}),(0,c.jsxs)(C.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)(C.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)(C.rU,{target:"_blank",href:"https://prismic.io/docs/slice-machine",sx:{color:"link"},children:"troubleshooting instructions."})]}),(0,c.jsx)(j.z,{onClick:n,label:"Refresh",Icon:er.Fer,iconSize:20,iconFill:"#6F6E77",variant:"secondaryMedium",sx:{mt:"16px"}})]})},eo=t(98240),es=t(92928),ec=t(33402),ea=t(59326),el=t(86741),eu=t(65186),ed=function(e){var n=e.children;return(0,c.jsx)(C.xu,{as:"code",sx:{bg:"rgba(0, 0, 0, 0.05)",borderRadius:3,padding:"2px 4px"},children:n})},ex=function(e){var n,t=e.children,r=(0,eo.Z)(e,["children"]),i=(0,ea.B7)().theme,o=(0,v.useState)(!1),s=o[0],a=o[1],l=(0,v.useRef)(null),u=function(){l.current&&navigator.clipboard.writeText(l.current.innerText).then(function(){a(!0),setTimeout(function(){a(!1)},1200)}).catch(function(){})};return(0,c.jsxs)(C.xu,(0,h.Z)((0,f.Z)({},r),{sx:{backgroundColor:"codeBlockBackground",borderRadius:8},children:[(0,c.jsxs)(C.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)(C.kC,{sx:{alignItems:"center"}}),(0,c.jsxs)(C.zx,{onClick:u,variant:"transparent",sx:{display:"flex",justifyContent:"center",alignItems:"center",p:0,fontSize:"12px",color:"#FFF"},children:["Copy\xa0",s?(0,c.jsx)(eu.HhX,{size:16,color:String(null==i?void 0:null===(n=i.colors)||void 0===n?void 0:n.success)}):(0,c.jsx)(eu.Fqs,{size:16,style:{marginLeft:"8px"}})]})]}),(0,c.jsx)(C.xu,{ref:l,as:"pre",sx:{color:"#c9d1d9",padding:"16px 20px",overflow:"auto"},children:t})]}))},ef={code:function(e){var n=e.children;return(0,c.jsx)(ed,{children:n})},pre:function(e){var n=e.children,t=(0,eo.Z)(e,["children"]);return(0,c.jsx)(ex,(0,h.Z)((0,f.Z)({},t),{children:n}))}},eh=function(e){var n=e.html,t=e.components,r=void 0===t?{}:t,i={replace:function(e){if((0,ec.Z)(e,el.W_)&&e.attribs){var n=(0,el.du)(e.children,i),t=(0,f.Z)({},r,ef)[e.name];if(t)return(0,c.jsx)(t,(0,h.Z)((0,f.Z)({name:e.name},e.attribs),{children:n}))}}};return(0,c.jsx)(c.Fragment,{children:(0,el.ZP)(n,i)})},ep=function(e){var n=e.children.split("`").map(function(e,n){return n%2==1?(0,c.jsx)(ed,{children:e}):e});return(0,c.jsx)(c.Fragment,{children:n})},ev=function(e){var n=e.number,t=e.title,r=e.excerpt,i=(0,eo.Z)(e,["number","title","excerpt"]);return(0,c.jsx)(es.OK,(0,h.Z)((0,f.Z)({className:"react-tabs__vertical__tab",selectedClassName:"react-tabs__vertical__tab--selected"},i),{children:(0,c.jsxs)(C.kC,{sx:{alignItems:"flex-start"},children:[(0,c.jsx)(eg,{number:n}),(0,c.jsxs)(C.xu,{sx:{ml:3,alignSelf:"center"},children:[(0,c.jsx)(C.X6,{as:"h4",sx:{color:"whiteButtonText",fontSize:"14px",fontWeight:"600"},children:(0,c.jsx)(ep,{children:t})}),r&&(0,c.jsx)(C.xv,{as:"p",sx:{mt:2,color:"textClear",fontSize:"13px",lineHeight:"24px"},children:(0,c.jsx)(ep,{children:r})})]})]})}))};ev.tabsRole="Tab";var em,eg=function(e){var n=e.number;return(0,c.jsx)(C.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})},eb=function(e){var n=e.isOpen,t=(0,F.v9)(function(e){return{isSimulatorAvailableForFramework:(0,z.Ql)(e),setupSteps:(0,ee.qe)(e)}}),r=t.isSimulatorAvailableForFramework,i=t.setupSteps||[];return(0,v.useEffect)(function(){n&&R.Xe.track({event:"slice-simulator:setup"})},[n]),(0,c.jsx)(P.Z,{isOpen:n,children:(0,c.jsx)(V.Z,{bodySx:{p:0,bg:"grey07",height:4===i.length?"640px":"480px"},Header:function(e){var n=e.radius;return(0,c.jsx)(C.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)(C.X6,{sx:{fontSize:"14px",fontWeight:"600"},as:"h5",children:"Set up the simulator"})})},children:(0,c.jsxs)(es.mQ,{defaultFocus:!0,className:"react-tabs__vertical",children:[(0,c.jsx)(es.td,{className:"react-tabs__vertical__tab-list",children:i.map(function(e,n){return(0,c.jsx)(ev,{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)(es.x4,{selectedClassName:"react-tabs__vertical__tab-panel--selected",className:"react-tabs__vertical__tab-panel",children:(0,c.jsx)(eh,{html:e.body})},e.title)})}):(0,c.jsx)(es.x4,{selectedClassName:"react-tabs__vertical__tab-panel--selected",className:"react-tabs__vertical__tab-panel",children:"Framework not supported."})]})})})},eC=t(53559);(em=o||(o={})).LOADING_SETUP="LOADING_SETUP",em.LOADING_IFRAME="LOADING_IFRAME",em.FAILED_SETUP="FAILED_SETUP",em.FAILED_CONNECT="FAILED_CONNECT",em.SUCCESS="SUCCESS";var eS=function(e){var n,t,i=e.slice,s=e.variation,a=(0,H.Z)(),l=a.checkSimulatorSetup,u=a.connectToSimulatorIframe,d=a.updateSliceMockSuccess,j=(0,F.v9)(function(e){return{simulatorUrl:(0,z.x0)(e),iframeStatus:(0,ee.NL)(e),manifestStatus:(0,ee.tD)(e).manifest,isWaitingForIFrameCheck:(0,ee.oM)(e),endpoints:(0,z.gZ)(e)}}),k=j.simulatorUrl,y=j.iframeStatus,E=j.manifestStatus,w=j.isWaitingForIFrameCheck,_=j.endpoints,I=(0,v.useMemo)(function(){return{embedsUrl:_.PrismicOembed,env:"prod",unsplashUrl:_.PrismicUnsplash}},[_.PrismicOembed,_.PrismicUnsplash]),D=(0,v.useRef)(null),T=(0,v.useCallback)(function(){return l()},[]);(0,v.useEffect)(function(){l(),R.Xe.track({event:"slice-simulator:open"})},[]);var N=(0,v.useRef)(!1);(0,v.useEffect)(function(){N.current=!0},[]);var O=function(e){N.current&&(N.current=!1,R.Xe.track({event:"editor:widget-used",sliceId:e}))},A="ko"===E?o.FAILED_SETUP:"ok"===E?w||!y?o.LOADING_IFRAME:"ok"!==y?o.FAILED_CONNECT:o.SUCCESS:(0,o.LOADING_SETUP);(0,v.useEffect)(function(){if(A===o.FAILED_SETUP&&!D.current){var e=setInterval(function(){T()},3e3);D.current=e}},[A]),(0,v.useEffect)(function(){"ok"===E&&(D.current&&clearInterval(D.current),u())},[E]),(0,v.useEffect)(function(){A===o.FAILED_CONNECT&&R.Xe.track({event:"slice-simulator:is-not-running"})},[A]),(0,v.useEffect)(function(){A===o.SUCCESS&&eu(!0)},[A]);var M,P=function(){u()},B=(0,v.useState)(L[r.DESKTOP]),W=B[0],V=B[1],q=(0,v.useMemo)(function(){return eC.id.fromSM(i.model)},[i.model]),K=(0,v.useState)(null),J=K[0],Q=K[1],er=(0,v.useMemo)(function(){var e,n;return(null==J?void 0:J.variation)===s.id?J:(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:[]}},[J,s.id]),eo=(0,v.useMemo)(function(){return(0,G.renderSliceMock)(q,er).id},[]),es=(0,v.useCallback)(function(){return function(){return(0,h.Z)((0,f.Z)({},(0,G.renderSliceMock)(q,er)),{id:eo})}},[q,er]),ec=Y(es,800,[q,er,]),ea=(0,v.useState)(!1),el=ea[0],eu=ea[1],ed=(0,v.useState)(!1),ex=ed[0],ef=ed[1],eh=(M=(0,x.Z)(function(){var e,n,t,r;return(0,p.__generator)(this,function(o){switch(o.label){case 0:if(!J)return[3,5];ef(!0),o.label=1;case 1:return o.trys.push([1,3,,4]),n={libraryID:i.from,sliceID:i.model.id,mocks:(null!==(e=i.mocks)&&void 0!==e?e:[]).filter(function(e){return e.variation!==J.variation}).concat(J)},[4,(0,R.y3)(n)];case 2:if((t=o.sent().errors).length>0)throw t;return d(n),b.Am.success("Saved"),[3,4];case 3:return r=o.sent(),console.error("Error while saving mock",r),b.Am.error("Error saving content"),[3,4];case 4:ef(!1),o.label=5;case 5:return[2]}})}),function(){return M.apply(this,arguments)});return(0,c.jsxs)(C.kC,{sx:{flexDirection:"column",height:"100vh"},children:[(0,c.jsx)(eb,{isOpen:A===o.FAILED_SETUP}),(0,c.jsx)(Z,{slice:i,variation:s,isDisplayEditor:el,actionsDisabled:A!==o.SUCCESS,toggleIsDisplayEditor:function(){return eu(!el)},onSaveMock:function(){eh()},isSavingMock:ex}),(0,c.jsx)(C.xu,{sx:{flex:1,bg:"grey07",p:3,display:"flex",flexDirection:"column",height:"calc(100% - 73px - 16px)"},children:(0,c.jsxs)(C.kC,{sx:{flex:1,flexDirection:"row",position:"relative",width:"100%",height:"100%"},children:[(0,c.jsxs)(S.xR,{sx:{display:"flex",height:"100%",flexDirection:"column",flex:1,minWidth:0},children:[(0,c.jsx)(U,{handleScreenSizeChange:V,screenDimensions:W,actionsDisabled:A!==o.SUCCESS}),A===o.FAILED_CONNECT?(0,c.jsx)(ei,{onRetrigger:P}):null,A===o.SUCCESS?(0,c.jsx)($,{apiContent:ec,screenDimensions:W,simulatorUrl:k}):(0,c.jsx)(c.Fragment,{children:A===o.LOADING_IFRAME?(0,c.jsxs)(et,{children:[(0,c.jsx)(C.$j,{variant:"styles.spinner"}),(0,c.jsx)($,{apiContent:ec,screenDimensions:W,simulatorUrl:k,dryRun:!0})]}):null})]}),A===o.SUCCESS&&el?(0,c.jsx)(C.kC,{className:"editor",sx:{flexDirection:"column",marginLeft:"16px",maxWidth:"440px",minWidth:"440px",overflowY:"auto"},children:(0,c.jsx)(en.S,{renderError:function(){return(0,c.jsx)(g.Iq,{title:"Editor error",description:"An error occurred while rendering the editor."})},children:(0,c.jsx)(v.Suspense,{children:(0,c.jsx)(m.kS,{config:I,content:er,onContentChange:function(e){Q(e),O(i.model.id)},sharedSlice:q},s.id)})})}):null]})}),!!(null===(n=i.screenshots[s.id])||void 0===n?void 0:n.url)&&(0,c.jsx)(X,{sliceName:i.model.name,screenshotUrl:null===(t=i.screenshots[s.id])||void 0===t?void 0:t.url})]})},ej=t(25998);function ek(){var e=(0,u.useRouter)(),n=(0,ej.Z)(),t=n.slice,r=n.variation;return void 0===t||void 0===r?(e.replace("/"),null):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l(),{children:(0,c.jsx)("title",{children:"Simulator: ".concat(t.model.name," - Slice Machine")})}),(0,c.jsx)(eS,{slice:t,variation:r})]})}},25998:function(e,n,t){"use strict";t.d(n,{Z:function(){return c}});var r=t(5632),i=t(56580),o=t(95200),s=function(e,n,t){var r,i=null===(r=(0,o.Sd)(e))||void 0===r?void 0:r.find(function(e){return e.name.replace(/\//g,"--")===n});return null==i?void 0:i.components.find(function(e){return e.model.name===t})},c=function(){var e=(0,r.useRouter)(),n=(0,i.v9)(function(n){return{slice:s(n,e.query.lib,e.query.sliceName)}}).slice;if(!n)return{};var t=n.model.variations.find(function(n){return n.id===e.query.variation});return t?{slice:n,variation:t}:{}}}},function(e){e.O(0,[789,872,851,777,774,888,179],function(){return e(e.s=30755)}),_N_E=e.O()}]);
|
package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-60858a3cead6dc81.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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(79336)}])},79336:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ew}});var i=t(52322),r=t(97729),o=t.n(r),a=t(5632),s=t(22715),c=t(28316),u=t(83462),l=t(38876),d=t(2353),f=t(44384),v=t(28173),p=t(53559),m=t(22710),h=t(62230),y=t(85244),x=t(99267),g=t(2784),j=t(74217),b=t(82770),I=t(90374),Z=t(50950),w=t(26921),S=(0,g.createContext)(void 0);function k(e){var n=e.children,t=e.initialSlice,r=(0,a.useRouter)(),o=(0,g.useState)(t),s=o[0],c=o[1],u=(0,w.c)({errorMessage:"Failed to save slice. Check your browser's console for more information."}),l=u.actionQueueStatus,d=u.setNextAction,f=(0,I.Z)().saveSliceSuccess,v=(0,j.R9)(f),p=(0,Z.g)().syncChanges,k=(0,g.useMemo)(function(){var e=r.query.variation,n=s.model.variations.find(function(n){return n.id===e});if(n)return n;throw Error("Variation not found")},[s,r]),T=(0,g.useCallback)(function(e){c(e),d((0,m.Z)(function(){var n,t,i,r,o;return(0,x.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,b.Ve)(e)];case 1:if((t=n.sent().errors).length>0)throw t;return[4,(0,b.pL)({libraryID:e.from,sliceID:e.model.id})];case 2:if(r=(i=n.sent()).errors,o=i.mocks,r.length>0)throw r;return v((0,y.Z)((0,h.Z)({},e),{mocks:o})),p(),[2]}})}))},[d,v,p]),C=(0,g.useMemo)(function(){return{actionQueueStatus:l,slice:s,setSlice:T,variation:k}},[l,s,T,k]);return(0,i.jsx)(S.Provider,{value:C,children:"function"==typeof n?n(C):n})}function T(){var e=(0,g.useContext)(S);if(!e)throw Error("SliceBuilderProvider not found");return e}var C=t(5479),F=t(8482),E=t(4092),A=function(){var e=T(),n=e.slice,t=e.setSlice,r=e.variation,o=function(e){return function(i){var o=(0,C.AK)({slice:n,variationId:r.id,widgetArea:e,fieldId:i});t(o)}},a=function(e){return function(i){var o=i.apiId,a=i.newKey,s=i.value,c=(0,C.L4)({slice:n,variationId:r.id,widgetArea:e,previousFieldId:o,newFieldId:a,newField:s});t(c)}},s=function(e){return function(i){var o=i.id,a=i.label,s=i.widgetTypeName,c=d[s];c||console.log('Could not find widget with type name "'.concat(s,'". Please contact us!'));var u=c.create(a);if("Range"===u.type||"IntegrationFields"===u.type||"Separator"===u.type)throw Error("Unsupported Field Type: ".concat(u.type));try{d[u.type].schema.validateSync(u,{stripUnknown:!1})}catch(l){throw Error('Model is invalid for widget "'.concat(u.type,'".'))}var f=(0,C.xS)({slice:n,variationId:r.id,widgetArea:e,newFieldId:o,newField:u});t(f)}},m=function(e){return function(i){if(!(0,u.uS)(i)){var o=i.source,a=i.destination;if(a){var s=(0,C.gR)({slice:n,variationId:r.id,widgetArea:e,sourceIndex:o.index,destinationIndex:a.index});(0,c.flushSync)(function(){return t(s)})}}}};return(0,i.jsxs)(v.aV,{children:[(0,i.jsx)(F.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:r.primary,EditModal:E.Z,widgetsArray:f.Z,onDeleteItem:o(p.Rt.Primary),onSave:a(p.Rt.Primary),onSaveNewField:s(p.Rt.Primary),onDragEnd:m(p.Rt.Primary),poolOfFieldsToCheck:r.primary||[],renderHintBase:function(e){var n=e.item;return"slice.primary".concat((0,l.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.primary".concat((0,l.Ti)(e))},testId:"static-zone-content",isRepeatableCustomType:void 0}),(0,i.jsx)(F.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:f.Z,fields:r.items,EditModal:E.Z,onDeleteItem:o(p.Rt.Items),onSave:a(p.Rt.Items),onSaveNewField:s(p.Rt.Items),onDragEnd:m(p.Rt.Items),poolOfFieldsToCheck:r.items||[],renderHintBase:function(e){var n=e.item;return"item".concat((0,l.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.items[i]".concat((0,l.Ti)(e))},testId:"slice-repeatable-zone",isRepeatableCustomType:void 0})]})},R=t(88932),O=t(36131),_=t(63397),N=t(75289),D=t(76635),L=t(25812),V=t(54132),M=function(e){var n=e.children,t=e.FooterContent,r=e.HeaderContent,o=e.close,a=e.sx,s=e.headerSx,c=void 0===s?{}:s;return(0,i.jsx)(V.Z,{borderFooter:!0,footerSx:{p:0},bodySx:{pt:2,pb:4,px:4},sx:(0,h.Z)({border:"none"},void 0===a?{}:a),Header:function(e){var n=e.radius;return(0,i.jsxs)(N.kC,{sx:(0,h.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)}},c),children:[r,o?(0,i.jsx)(N.x8,{onClick:o,type:"button"}):null]})},Footer:t?(0,i.jsxs)(N.kC,{sx:{alignItems:"space-between",bg:"headSection",p:3},children:[(0,i.jsx)(N.xu,{sx:{ml:"auto"}}),t]}):null,children:n})},P=function(e){var n=e.msg;return(0,i.jsx)(N.xv,{as:"span",sx:{fontSize:12,color:"error",mt:"5px",ml:2},children:n||"Error!"})},z=function(e){var n=e.isOpen,t=e.onClose,r=e.onSubmit,o=e.initialVariation,a=e.variations,c=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,s=t&&t.length?null:{name:"Required!"},c=i.value.length&&a.find(function(e){return e.id===i.value})?null:{id:"You must select an existing variation!"},u=n&&n.length&&!/^[A-Za-z0-9]+([A-Za-z0-9]+)*$/.exec(n)&&{id:"No special characters allowed"};return(0,h.Z)({},r,o,s,c,u)},u=function(e){w((0,D.camelCase)(e))},l=function(e){E(e),k&&u(e)},d=function(e){T(!1),u(e)},f=function(){v(),t()},v=function(){w(""),E(""),b({}),T(!0),V({value:o.id,label:o.name})},p=(0,g.useState)({}),j=p[0],b=p[1],I=(0,g.useState)(""),Z=I[0],w=I[1],S=(0,g.useState)(!0),k=S[0],T=S[1],C=(0,g.useState)(""),F=C[0],E=C[1],A=(0,g.useState)({value:o.id,label:o.name}),R=A[0],V=A[1],z=(0,g.useState)(!1),K=z[0],q=z[1];function B(){return H.apply(this,arguments)}function H(){return(H=(0,m.Z)(function(){var e,n;return(0,x.__generator)(this,function(t){switch(t.label){case 0:if(!Object.keys(e=c({id:Z,name:F,origin:R})).length)return[3,1];return b(e),[3,3];case 1:if(!(n=a.find(function(e){return e.id===R.value})))return[3,3];return q(!0),[4,r(Z,F,n)];case 2:t.sent(),q(!1),f(),t.label=3;case 3:return[2]}})})).apply(this,arguments)}return(0,g.useEffect)(function(){v()},[o,n]),(0,i.jsx)(L.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,onRequestClose:function(){return f()},contentLabel:"Widget Form Modal",style:{content:{maxWidth:"700px"}},children:(0,i.jsx)(_.J9,{initialValues:{id:Z,name:F,origin:R},onSubmit:B,children:(0,i.jsx)(_.l0,{id:"variation-add",onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),B())},children:(0,i.jsx)(s.xu,{children:(0,i.jsxs)(M,{sx:{textAlign:"left"},HeaderContent:(0,i.jsx)(N.xv,{as:"h2",children:"Add new Variation"}),FooterContent:(0,i.jsxs)(s.xu,{gap:16,alignItems:"center",children:[(0,i.jsx)(s.zx,{onClick:f,color:"grey",children:"Cancel"}),(0,i.jsx)(s.zx,{loading:K,children:"Submit"})]}),close:f,children:[(0,i.jsxs)(s.xu,{flexDirection:"column",padding:{block:16},children:[(0,i.jsxs)(N.__,{htmlFor:"name",sx:{mb:1},children:["Variation name*",j.name?(0,i.jsx)(P,{msg:j.name}):""]}),(0,i.jsx)(_.gN,{autoComplete:"off",id:"name",name:"name",placeholder:"e.g. Grid - With Icon",as:N.II,maxLength:30,value:F,onChange:function(e){return l(e.currentTarget.value)}}),(0,i.jsx)(N.xv,{children:"It will appear here in Slice Machine, and in the page editor in Prismic"})]}),(0,i.jsxs)(s.xu,{flexDirection:"column",padding:{bottom:16},children:[(0,i.jsxs)(N.__,{htmlFor:"id",sx:{mb:1},children:["Variation ID*",j.id?(0,i.jsx)(P,{msg:j.id}):""]}),(0,i.jsx)(_.gN,{autoComplete:"off",id:"id",name:"id",placeholder:"e.g. GridWithIcon",as:N.II,maxLength:30,value:Z,onChange:function(e){return d(e.currentTarget.value)}}),(0,i.jsx)(N.xv,{children:"It's generated automatically based on the variation name and will appear in the API responses."})]}),(0,i.jsxs)(s.xu,{flexDirection:"column",padding:{bottom:8},children:[(0,i.jsx)(N.__,{htmlFor:"origin",sx:{mb:1},children:"Duplicate from"}),(0,i.jsx)(O.ZP,{name:"origin",options:a.map(function(e){return{value:e.id,label:e.name}}),onChange:function(e){e&&V(e)},defaultValue:R,maxMenuHeight:150,theme:function(e){return(0,y.Z)((0,h.Z)({},e),{colors:(0,y.Z)((0,h.Z)({},e.colors),{text:"text",primary:"background"})})}})]})]})})})})})},K=t(49451);function q(){return(q=(0,m.Z)(function(e){var n,t,i,r,o,a,s,c,u,l,d,f;return(0,x.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,6,,7]),[4,(0,b.Ve)(e.component)];case 1:if((t=n.sent().errors).length>0)throw t;return[4,(0,b.Xi)({libraryID:e.component.from,sliceID:e.component.model.id,variationID:e.variation.id})];case 2:if((r=n.sent().errors).length>0)throw r;return[4,(0,b.X$)(e.component.from,e.component.model.id)];case 3:if(a=(o=n.sent()).slice,(s=o.errors).length>0)throw s;if(!a)throw Error("Could not read variation `".concat(e.variation.name,"`"));return[4,(0,b.pL)({libraryID:e.component.from,sliceID:e.component.model.id})];case 4:return c=n.sent().mocks,u=K.Y.getBuilderPagePathname({libraryName:e.component.href,sliceName:a.name,variationId:a.variations[0].id}),[4,e.router.replace(u)];case 5:return n.sent(),l=(0,y.Z)((0,h.Z)({},e.component),{model:a,mocks:c}),e.saveSliceSuccess(l),[2,l];case 6:throw d=n.sent(),f="Could not delete variation `".concat(e.variation.name,"`"),console.error(f,d),R.Am.error(f),d;case 7:return[2]}})})).apply(this,arguments)}var B=function(e){var n=e.isOpen,t=e.onClose,r=e.slice,o=e.variation,c=(0,a.useRouter)(),u=(0,g.useState)(!1),l=u[0],d=u[1],f=(0,I.Z)().saveSliceSuccess,v=T().setSlice;return(0,i.jsxs)(s.Vq,{open:n,onOpenChange:function(e){return!e&&t()},size:{width:448,height:"auto"},children:[(0,i.jsx)(s.fK,{icon:"delete",title:"Delete variation"}),(0,i.jsx)(s.cZ,{children:(0,i.jsxs)(s.xu,{flexDirection:"column",children:[(0,i.jsxs)(s.xv,{color:"grey11",sx:{marginBlock:16,marginInline:16},children:["This action will remove the variation from the slice model and delete associated files. When you push your changes, the variation will disappear from your repository. This update will"," ",(0,i.jsx)(H,{children:"not"})," affect your documents until you ",(0,i.jsx)(H,{children:"edit"})," ","them manually."]}),(0,i.jsx)(s.kX,{ok:{text:"Delete",color:"tomato",onClick:function(){o&&(0,m.Z)(function(){var e;return(0,x.__generator)(this,function(e){switch(e.label){case 0:d(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,function(e){return q.apply(this,arguments)}({component:r,router:c,saveSliceSuccess:f,variation:o})];case 2:return v(e.sent()),[3,4];case 3:return e.sent(),[3,4];case 4:return d(!1),t(),[2]}})})()},loading:l},cancel:{text:"Cancel"},size:"medium"})]})})]})},H=function(e){return(0,i.jsx)(s.xv,(0,y.Z)((0,h.Z)({},e),{color:"inherit",component:"span",variant:"bold"}))};function X(){return(X=(0,m.Z)(function(e){var n,t,i,r,o,a,s,c,u,l,d;return(0,x.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),[4,(0,b.Ve)(e.component)];case 1:if((t=n.sent().errors).length>0)throw t;return[4,(0,b.eH)(e.component,(0,y.Z)((0,h.Z)({},e.variation),{name:e.variationName}))];case 2:if((r=n.sent().errors).length>0)throw r;return[4,(0,b.X$)(e.component.from,e.component.model.id)];case 3:if(a=(o=n.sent()).slice,(s=o.errors).length>0)throw s;if(!a)throw Error("Could not read variation `".concat(e.variation.name,"`"));return[4,(0,b.pL)({libraryID:e.component.from,sliceID:e.component.model.id})];case 4:return c=n.sent().mocks,u=(0,y.Z)((0,h.Z)({},e.component),{model:a,mocks:c}),e.saveSliceSuccess(u),[2,u];case 5:throw l=n.sent(),d="Could not rename variation `".concat(e.variation.name,"`"),console.error(d,l),R.Am.error(d),l;case 6:return[2]}})})).apply(this,arguments)}var U=function(e){var n,t,r=e.isOpen,o=e.onClose,a=e.slice,c=e.variation,u=(0,g.useState)(!1),l=u[0],d=u[1],f=T().setSlice,v=(0,I.Z)().saveSliceSuccess;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(s.Vq,{open:r,onOpenChange:function(e){return!e&&o()},size:{width:448,height:"auto"},children:[(0,i.jsx)(s.fK,{icon:"edit",title:"Rename variation"}),(0,i.jsx)(s.cZ,{children:(0,i.jsx)(_.J9,{validateOnMount:!0,initialValues:{variationName:null!==(n=null==c?void 0:c.name)&&void 0!==n?n:""},validate:function(e){if(0===e.variationName.length)return{variationName:"Cannot be empty"}},onSubmit:(t=(0,m.Z)(function(e){var n;return(0,x.__generator)(this,function(n){switch(n.label){case 0:if(!c)return[2];d(!0),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,function(e){return X.apply(this,arguments)}({component:a,saveSliceSuccess:v,variation:c,variationName:e.variationName.trim()})];case 2:return f(n.sent()),[3,4];case 3:return n.sent(),[3,4];case 4:return d(!1),o(),[2]}})}),function(e){return t.apply(this,arguments)}),children:function(e){return(0,i.jsxs)("form",{children:[(0,i.jsxs)(s.xu,{flexDirection:"column",gap:8,padding:16,children:[(0,i.jsx)(s.xv,{variant:"normal",color:"grey11",children:"This action will rename the variation in the slice model. When you push your changes, the variation will be renamed in your repository."}),(0,i.jsxs)(s.xu,{flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:"_1ecs97dez4 _1ecs97dez8 _1ecs97df90",children:[(0,i.jsx)(s.xv,{variant:"bold",children:"Variation name*"}),"string"==typeof e.errors.variationName?(0,i.jsx)(s.xv,{variant:"small",color:"tomato10",children:e.errors.variationName}):null]}),(0,i.jsx)(s.yt,{placeholder:"Variation name",error:"string"==typeof e.errors.variationName,value:e.values.variationName,onValueChange:function(n){e.setFieldValue("variationName",n.slice(0,30))}})]})]}),(0,i.jsx)(s.kX,{ok:{text:"Rename",onClick:function(){e.submitForm()},loading:l,disabled:!e.isValid},cancel:{text:"Cancel"},size:"medium"})]})}})})]})})},W=t(15836),Q=t(71749),G=t(47731),$=function(){var e,n=T(),t=n.slice,r=n.variation,o=n.setSlice,c=(0,g.useState)(),u=c[0],l=c[1],d=(0,G.H)(),f=d.modalPayload,v=f.sliceFilterFn,p=f.defaultVariationSelector,h=f.onUploadSuccess,y=(0,a.useRouter)(),j=(0,I.Z)().saveSliceSuccess;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.xu,{flexDirection:"column",gap:16,children:[t.model.variations.map(function(e){return(0,i.jsx)(Q.b,{action:{type:"menu",onRename:function(){l({type:"RENAME_VARIATION",variation:e})},onRemove:function(){l({type:"DELETE_VARIATION",variation:e})},removeDisabled:t.model.variations.length<=1},mode:"navigation",onUpdateScreenshot:function(){d.onOpenModal({sliceFilterFn:function(e){return e},defaultVariationSelector:{sliceID:t.model.id,variationID:e.id},onUploadSuccess:function(e){o(e)}})},replace:!0,selected:e.id===r.id,slice:t,variant:"outlined",variationId:e.id},e.id)}),(0,i.jsxs)(s.xu,{backgroundColor:"grey2",bottom:0,flexDirection:"column",padding:{bottom:40,inline:24},position:"sticky",style:{marginBottom:"-16px"},children:[(0,i.jsx)(s.ph,{sx:{left:0,position:"absolute",right:0}}),(0,i.jsx)(s.zx,{onClick:function(){l({type:"ADD_VARIATION"})},startIcon:"add",sx:{position:"relative"},color:"grey",children:"Add a new variation"})]})]}),(0,i.jsx)(W.Z,{slices:v([t]),defaultVariationSelector:p,onUploadSuccess:h}),(0,i.jsx)(U,{isOpen:(null==u?void 0:u.type)==="RENAME_VARIATION",onClose:function(){l(void 0)},slice:t,variation:null==u?void 0:u.variation}),(0,i.jsx)(B,{isOpen:(null==u?void 0:u.type)==="DELETE_VARIATION",onClose:function(){l(void 0)},slice:t,variation:null==u?void 0:u.variation}),(0,i.jsx)(z,{initialVariation:r,isOpen:(null==u?void 0:u.type)==="ADD_VARIATION",onClose:function(){l(void 0)},onSubmit:(e=(0,m.Z)(function(e,n,i){var r,a,s,c,u,l;return(0,x.__generator)(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),a=(r=(0,C.Kp)({slice:t,id:e,name:n,copiedVariation:i})).slice,s=r.variation,[4,(0,b.Ve)(a)];case 1:return d.sent(),j(a),o(a),c=K.Y.getBuilderPagePathname({libraryName:a.href,sliceName:a.model.name,variationId:s.id}),y.replace(c),[3,3];case 2:return u=d.sent(),l="Could not add variation `".concat(n,"`"),console.error(l,u),R.Am.error(l),[3,3];case 3:return[2]}})}),function(n,t,i){return e.apply(this,arguments)}),variations:t.model.variations})]})},J=t(56580),Y=t(75329),ee=t(33710),en=t(42189),et=t(17036),ei=t(39295),er=t(22342),eo=function(){return(0,i.jsx)(ei.X,{children:(0,i.jsxs)(ee.Z,{clickable:!0,place:"bottom",effect:"solid",delayHide:500,id:"simulator-button-tooltip",children:[(0,i.jsx)(N.xv,{as:"b",children:"Framework not supported"}),(0,i.jsx)(N.xv,{as:"p",children:"Slice Simulator does not support your framework yet."})]})})},ea=function(e){var n=e.children,t=e.open,r=e.onClose;return(0,i.jsxs)(er.zs,{open:t,trigger:n,onClose:r,children:[(0,i.jsx)(er.Ev,{children:"Simulate your slices"}),(0,i.jsx)(er.LB,{component:"video",cloudName:"dmtf1daqp",loop:!1,autoPlay:!1,publicId:Y.Sn,poster:"/simulator-video-thumbnail.png",controls:!0,onPlay:function(){b.Xe.track({event:"open-video-tutorials",video:Y.Sn})}}),(0,i.jsx)(er.OJ,{children:"Minimize context-switching by previewing your Slice components in the simulator."}),(0,i.jsx)(er.Rp,{children:"Got it"})]})},es=function(e){var n=e.isSimulatorAvailableForFramework,t=e.disabled,r=(0,a.useRouter)(),o=(0,g.useRef)(null),c=(0,I.Z)().setSeenSimulatorToolTip,u=(0,J.v9)(function(e){return{hasSeenSimulatorTooltip:(0,et.bv)(e)}}).hasSeenSimulatorTooltip;(0,g.useEffect)(function(){var e=o.current;e&&n&&!u&&setTimeout(function(){return ee.Z.show(e)},5e3)},[n,u]);var l=function(){if(c(),o.current){var e=o.current;ee.Z.hide(e)}};return(0,i.jsxs)("span",{"data-tip":!0,"data-tip-disable":!1,"data-for":"simulator-button-tooltip",ref:o,children:[(0,i.jsx)(ea,{open:n&&!u,onClose:l,children:(0,i.jsx)(s.zx,{"data-tip":!0,"data-testid":"simulator-open-button",onClick:function(){l(),window.open("".concat(r.asPath,"/simulator"),Y.pq)},disabled:t,renderStartIcon:function(){return(0,i.jsx)(en.z,{color:s.TV.color.greyLight1,height:s.TV.size[24],style:{transform:"scale(calc(4 / 3))"},width:s.TV.size[24]})},children:"Simulate"})}),!1===n?(0,i.jsx)(eo,{}):void 0]})},ec=t(42050),eu=t(17329),el=t(81038);function ed(e){return ef.apply(this,arguments)}function ef(){return(ef=(0,m.Z)(function(e){var n,t,i;return(0,x.__generator)(this,function(r){switch(r.label){case 0:return[4,el.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 ev=t(67445),ep=t(64722),em=t(20812),eh=function(e){return(0,i.jsxs)("svg",(0,y.Z)((0,h.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"})]}))},ey=t(8564),ex=function(){var e,n,t=(e=(0,ep.l)().source,n=(0,ev.Ag)(e.query),void 0!==n&&(0,ev.ne)(e.asPath,n)?n:void 0);return void 0!==t?(0,i.jsx)(ey.S,{children:(0,i.jsx)(g.Suspense,{children:(0,i.jsx)(s.xu,{bottom:32,justifyContent:"center",position:"fixed",right:0,width:"100vw",children:(0,i.jsx)(eg,{sourceCustomTypeId:t})})})}):null},eg=function(e){var n,t=(n=e.sourceCustomTypeId,(0,eu.QT)(ed,[n])),r=(0,g.useState)(!0),o=r[0],c=r[1],u=(0,a.useRouter)();if(void 0===t||!o)return null;var l=t.format,d=t.id,f=ev.cd[l].getBuilderPagePathname(d);return(0,i.jsxs)(s.hE,{density:"compact",color:"dark",children:[(0,i.jsxs)(s.zx,{onClick:function(){u.push(f)},renderStartIcon:function(){return(0,i.jsx)(eh,{})},children:["Return to ",t.label]}),(0,i.jsx)(s.zx,{onClick:function(){c(!1)},renderStartIcon:function(){return(0,i.jsx)(em.T,{})}})]})},ej=t(39092),eb=t(47976),eI=function(){var e=T(),n=e.slice,t=e.actionQueueStatus,r=(0,J.v9)(ej.Ql);return(0,i.jsxs)(ec.LN,{children:[(0,i.jsxs)(ec.wd,{children:[(0,i.jsx)(ec.Xq,{url:"/slices"}),(0,i.jsx)(ec.Cx,{folder:"Slices",page:n.model.name}),(0,i.jsxs)(ec.K2,{children:[(0,i.jsx)(eb.X,{status:t}),(0,i.jsx)(es,{isSimulatorAvailableForFramework:r,disabled:"done"!==t})]})]}),(0,i.jsxs)(ec.RN,{children:[(0,i.jsxs)(s.xu,{alignItems:"flex-start",display:"grid",gap:16,gridTemplateColumns:"320px 1fr",children:[(0,i.jsx)($,{}),(0,i.jsx)(A,{})]}),(0,i.jsx)(ex,{})]})]})},eZ=t(25998);function ew(){var e=(0,a.useRouter)(),n=(0,eZ.Z)(),t=n.slice,r=n.variation;return void 0===t||void 0===r?(e.replace("/"),null):(0,i.jsx)(k,{initialSlice:t,children:function(e){var n=e.slice;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o(),{children:(0,i.jsxs)("title",{children:[n.model.name," - Slice Machine"]})}),(0,i.jsx)(eI,{})]})}})}},91061:function(e,n,t){"use strict";t.d(n,{AK:function(){return b},E3:function(){return p},EN:function(){return m},F$:function(){return x},GA:function(){return T},HO:function(){return g},L4:function(){return I},Tr:function(){return v},Ue:function(){return O},gR:function(){return Z},j6:function(){return S},kQ:function(){return w},l9:function(){return k},mf:function(){return h},vB:function(){return y},xS:function(){return j},y6:function(){return u}});var i=t(67557),r=t(62230),o=t(85244),a=t(17064),s=t(88866),c=t(98863);function u(e){var n;return null!==(n=e.format)&&void 0!==n?n:"custom"}function l(e){return Object.entries(e.json)}function d(e,n){return e.json[n]}function f(e,n){var t=d(e,n);if(void 0!==t)return Object.entries(t).find(function(e){var n=(0,a.Z)(e,2);return(n[0],n[1]).type===s.SlicesFieldType})}function v(e,n){if(t=e,d=f(t,c=n),(v=(0,a.Z)(null!=d?d:[],2))[0],null!==(u=null==(p=v[1])?void 0:p.config)&&void 0!==u?u:void 0)return e;var t,c,u,d,v,p,m=function(e,n){var t,i=l(e),r=i.findIndex(function(e){return(0,a.Z)(e,1)[0]===n}),o=i.flatMap(function(e){var n=(0,a.Z)(e,2),t=(n[0],n[1]);return Object.keys(t).filter(function(e){return t[e].type===s.SlicesFieldType})}),c=r;do t="slices".concat(0!==c?c.toString():""),c++;while(o.includes(t));return t}(e,n);return(0,o.Z)((0,r.Z)({},e),{json:(0,o.Z)((0,r.Z)({},e.json),(0,i.Z)({},n,(0,o.Z)((0,r.Z)({},e.json[n]),(0,i.Z)({},m,{type:s.SlicesFieldType,fieldset:"Slice Zone"}))))})}function p(e,n){var t=d(e,n);if(void 0===t)return e;var a=Object.keys(t).find(function(e){return t[e].type===s.SlicesFieldType});if(void 0===a)return e;var u=(0,c.ud)(t,a);return(0,o.Z)((0,r.Z)({},e),{json:(0,o.Z)((0,r.Z)({},e.json),(0,i.Z)({},n,u))})}function m(e){var n,t,a=e.customType,u=e.sectionId,l=e.sliceId,f=d(a,u);if(void 0===f)return a;var v=Object.keys(f).find(function(e){return f[e].type===s.SlicesFieldType});if(void 0===v)return a;var p=f[v];if(p.type!==s.SlicesFieldType)return a;var m=(0,c.ud)(null!==(t=null===(n=p.config)||void 0===n?void 0:n.choices)&&void 0!==t?t:{},l);return(0,o.Z)((0,r.Z)({},a),{json:(0,o.Z)((0,r.Z)({},a.json),(0,i.Z)({},u,(0,o.Z)((0,r.Z)({},f),(0,i.Z)({},v,(0,o.Z)((0,r.Z)({},p),{config:(0,o.Z)((0,r.Z)({},p.config),{choices:m})})))))})}function h(e){var n,t=(0,o.Z)((0,r.Z)({},e),{format:"page"}),i=l(e)[0];if(i){var s=(0,a.Z)(i,1)[0];t=v(t,s)}return t}function y(e,n){return(0,o.Z)((0,r.Z)({},e),{json:(0,o.Z)((0,r.Z)({},e.json),(0,i.Z)({},n,{}))})}function x(e,n){var t=(0,c.ud)(e.json,n);return(0,o.Z)((0,r.Z)({},e),{json:t})}function g(e,n,t){if(n===t)return e;var i=Object.keys(e.json).reduce(function(i,r){return r===n?i[t]=e.json[r]:i[r]=e.json[r],i},{});return(0,o.Z)((0,r.Z)({},e),{json:i})}function j(e){var n=e.customType,t=e.sectionId,c=e.newField,u=e.newFieldId,l=n.json[t],d=f(n,t),v=Object.fromEntries(Object.entries(l).filter(function(e){var n=(0,a.Z)(e,2);return(n[0],n[1]).type!==s.SlicesFieldType})),p=(0,o.Z)((0,r.Z)({},v),(0,i.Z)({},u,c));if(void 0!==d){var m=(0,a.Z)(d,2),h=m[0],y=m[1];p[h]=y}return C({customType:n,sectionId:t,updatedSection:p})}function b(e){var n=e.customType,t=e.sectionId,i=e.fieldId,r=(0,c.ud)(n.json[t],i);return C({customType:n,sectionId:t,updatedSection:r})}function I(e){var n=e.customType,t=e.sectionId,i=e.previousFieldId,r=e.newFieldId,o=e.newField,a=F({fields:n.json[t],previousFieldId:i,newFieldId:r,newField:o});return C({customType:n,sectionId:t,updatedSection:a})}function Z(e){var n=e.customType,t=e.sectionId,i=e.sourceIndex,r=e.destinationIndex,o=n.json[t],c=f(n,t),u=Object.fromEntries(Object.entries(o).filter(function(e){var n=(0,a.Z)(e,2);return(n[0],n[1]).type!==s.SlicesFieldType})),l=E({fields:u,sourceIndex:i,destinationIndex:r});if(void 0!==c){var d=(0,a.Z)(c,2),v=d[0],p=d[1];l[v]=p}return C({customType:n,sectionId:t,updatedSection:l})}function w(e){var n,t=e.customType,a=e.sectionId,s=e.groupFieldId,c=e.newField,u=e.newFieldId,l=A({customType:t,sectionId:a,groupFieldId:s}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l)return t;var f=R(l,(0,o.Z)((0,r.Z)({},d),(0,i.Z)({},u,c)));return C({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},s,f))})}function S(e){var n,t=e.customType,a=e.sectionId,s=e.groupFieldId,u=e.fieldId,l=A({customType:t,sectionId:a,groupFieldId:s}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l||!d)return t;var f=(0,c.ud)(d,u),v=R(l,f);return C({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},s,v))})}function k(e){var n,t=e.customType,a=e.sectionId,s=e.groupFieldId,c=e.previousFieldId,u=e.newFieldId,l=e.newField,d=A({customType:t,sectionId:a,groupFieldId:s}),f=null==d?void 0:null===(n=d.config)||void 0===n?void 0:n.fields;if(!d||!f)return t;var v=F({fields:f,previousFieldId:c,newFieldId:u,newField:l}),p=R(d,v);return C({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},s,p))})}function T(e){var n,t=e.customType,a=e.sectionId,s=e.groupFieldId,c=e.sourceIndex,u=e.destinationIndex,l=A({customType:t,sectionId:a,groupFieldId:s}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l||!d)return t;var f=E({fields:d,sourceIndex:c,destinationIndex:u}),v=R(l,f);return C({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},s,v))})}function C(e){var n=e.customType,t=e.sectionId,a=e.updatedSection;return(0,o.Z)((0,r.Z)({},n),{json:(0,o.Z)((0,r.Z)({},n.json),(0,i.Z)({},t,a))})}function F(e){var n=e.fields,t=e.previousFieldId,i=e.newFieldId,r=e.newField;return Object.entries(n).reduce(function(e,n){var o=(0,a.Z)(n,2),s=o[0],c=o[1];return s===t?e[i]=r:s!==i&&(e[s]=c),e},{})}function E(e){var n=e.fields,t=e.sourceIndex,i=e.destinationIndex,r=Object.entries(n),o=(0,a.Z)(r.splice(t,1),1)[0];return r.splice(i,0,o),Object.fromEntries(r)}function A(e){var n=e.customType,t=e.sectionId,i=e.groupFieldId,r=n.json[t][i];if(r.type===s.GroupFieldType)return r}function R(e,n){return(0,o.Z)((0,r.Z)({},e),{config:(0,o.Z)((0,r.Z)({},e.config),{fields:n})})}function O(e){var n,t,i=e.id,o=e.label,a=e.repeatable,s=e.format,c=(n=a,t=s,!1===n&&"page"===t?(0,r.Z)({},N,V):!1===n?_:"page"===t?(0,r.Z)({},L,V):D);return{format:s,id:i,json:c,label:o,repeatable:a,status:!0}}var _={Main:{}},N={Main:{slices:{config:{choices:{}},fieldset:"Slice Zone",type:"Slices"}}},D={Main:{uid:{config:{label:"UID"},type:"UID"}}},L={Main:(0,r.Z)({},D.Main,N.Main)},V={"SEO & Metadata":{meta_description:{config:{label:"Meta Description",placeholder:"A brief summary of the page"},type:"Text"},meta_image:{config:{constraint:{height:1260,width:2400},label:"Meta Image",thumbnails:[]},type:"Image"},meta_title:{config:{label:"Meta Title",placeholder:"A title of the page used for social media and search engines"},type:"Text"}}}},25998:function(e,n,t){"use strict";t.d(n,{Z:function(){return s}});var i=t(5632),r=t(56580),o=t(95200),a=function(e,n,t){var i,r=null===(i=(0,o.Sd)(e))||void 0===i?void 0:i.find(function(e){return e.name.replace(/\//g,"--")===n});return null==r?void 0:r.components.find(function(e){return e.model.name===t})},s=function(){var e=(0,i.useRouter)(),n=(0,r.v9)(function(n){return{slice:a(n,e.query.lib,e.query.sliceName)}}).slice;if(!n)return{};var t=n.model.variations.find(function(n){return n.id===e.query.variation});return t?{slice:n,variation:t}:{}}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return j}});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 s(e){return(a[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function c(e,n){return void 0===n&&(n=","),e.split(n)}function u(e,n,t){void 0===n&&(n="+");var i,a=e.toLocaleLowerCase().split(n).map(function(e){return s(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([s(e.key),s(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&v([s(e.key),s(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){l.clear()});var l=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];l.has("meta")&&l.forEach(function(e){var n;return!o.includes(e)&&l.delete(e.toLowerCase())}),n.forEach(function(e){return l.add(e.toLowerCase())})}function v(e){var n=Array.isArray(e)?e:[e];"meta"===e?l.clear():n.forEach(function(e){return l.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 m=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,a=n.meta,c=n.mod,u=n.shift,f=n.ctrl,v=n.keys,p=e.key,m=e.code,h=e.ctrlKey,y=e.metaKey,x=e.shiftKey,g=e.altKey,j=s(m),b=p.toLowerCase();if(!t){if(!g===o&&"alt"!==b||!x===u&&"shift"!==b)return!1;if(c){if(!y&&!h)return!1}else if(!y===a&&"meta"!==b&&"os"!==b||!h===f&&"ctrl"!==b&&"control"!==b)return!1}return!!(v&&1===v.length&&(v.includes(b)||v.includes(j)))||(v?(void 0===r&&(r=","),(d(i=v)?i:i.split(r)).every(function(e){return l.has(e.trim().toLowerCase())})):!v)},h=(0,i.createContext)(void 0),y=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),x=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},g="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function j(e,n,t,r){var o,a,l=(0,i.useRef)(null),j=(0,i.useRef)(!1),b=t instanceof Array?r instanceof Array?void 0:r:t,I=d(e)?e.join(null==b?void 0:b.splitKey):e,Z=t instanceof Array?t:r instanceof Array?r:void 0,w=(0,i.useCallback)(n,null!=Z?Z:[]),S=(0,i.useRef)(w);Z?S.current=w:S.current=n;var k=(!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,b)&&(a.current=b),a.current),T=(0,i.useContext)(y).enabledScopes,C=(0,i.useContext)(h);return g(function(){if((null==k?void 0:k.enabled)!==!1&&(e=T,n=null==k?void 0:k.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==k?void 0:k.enableOnFormTags)||null!=k&&null!=k.ignoreEventWhen&&k.ignoreEventWhen(e))){if(null!==l.current&&document.activeElement!==l.current&&!l.current.contains(document.activeElement)){x(e);return}(null==(t=e.target)||!t.isContentEditable||null!=k&&k.enableOnContentEditable)&&c(I,null==k?void 0:k.splitKey).forEach(function(t){var i,r,o,a,s,c,l,d=u(t,null==k?void 0:k.combinationKey);if(m(e,d,null==k?void 0:k.ignoreModifiers)||null!=(l=d.keys)&&l.includes("*")){if(n&&j.current)return;if(i=e,r=d,("function"==typeof(o=null==k?void 0:k.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),a=e,s=d,"function"==typeof(c=null==k?void 0:k.enabled)?!c(a,s):!0!==c&&void 0!==c){x(e);return}S.current(e,d),n||(j.current=!0)}})}},i=function(e){void 0!==e.key&&(f(s(e.code)),((null==k?void 0:k.keydown)===void 0&&(null==k?void 0:k.keyup)!==!0||null!=k&&k.keydown)&&t(e))},r=function(e){void 0!==e.key&&(v(s(e.code)),j.current=!1,null!=k&&k.keyup&&t(e,!0))},o=l.current||(null==b?void 0:b.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),C&&c(I,null==k?void 0:k.splitKey).forEach(function(e){return C.addHotkey(u(e,null==k?void 0:k.combinationKey,null==k?void 0:k.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),C&&c(I,null==k?void 0:k.splitKey).forEach(function(e){return C.removeHotkey(u(e,null==k?void 0:k.combinationKey,null==k?void 0:k.description))})}}},[I,k,T]),l}}},function(e){e.O(0,[898,789,917,525,461,139,183,50,543,696,25,318,286,774,888,179],function(){return e(e.s=31314)}),_N_E=e.O()}]);
|
|
File without changes
|