slice-machine-ui 1.25.1-beta.6 → 1.25.1-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/builders/CustomTypeBuilder/TabZone/index.tsx +8 -6
- package/lib/builders/SliceBuilder/FieldZones/index.tsx +17 -2
- package/lib/builders/common/Zone/index.jsx +18 -0
- package/lib/models/common/widgets/Group/ListItem/index.jsx +21 -0
- package/out/404.html +1 -1
- package/out/_next/static/chunks/318-d6f1200138628ec3.js +1 -0
- package/out/_next/static/chunks/{904-6fec9bac11fa810f.js → 904-c9221a5cb09524e8.js} +1 -1
- package/out/_next/static/chunks/pages/{_app-fe38e3feca584fa4.js → _app-30f8a579c4d383f3.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-8d7043e6638d65cd.js +1 -0
- package/out/_next/static/{BgmBc78JMOwL2qPVTvh8F → vNxSAIw3P6M_wdZBPWPUk}/_buildManifest.js +1 -1
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/settings.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +3 -3
- package/out/_next/static/chunks/318-2426f74a0d6c3b89.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-f0052f6f451357a6.js +0 -1
- /package/out/_next/static/{BgmBc78JMOwL2qPVTvh8F → vNxSAIw3P6M_wdZBPWPUk}/_ssgManifest.js +0 -0
package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-f0052f6f451357a6.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 eb}});var i=t(52322),r=t(97729),o=t.n(r),a=t(5632),c=t(22715),s=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 T(e){var n=e.children,t=e.initialSlice,r=(0,a.useRouter)(),o=(0,g.useState)(t),c=o[0],s=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,T=(0,g.useMemo)(function(){var e=r.query.variation,n=c.model.variations.find(function(n){return n.id===e});if(n)return n;throw Error("Variation not found")},[c,r]),C=(0,g.useCallback)(function(e){s(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]),k=(0,g.useMemo)(function(){return{actionQueueStatus:l,slice:c,setSlice:C,variation:T}},[l,c,C,T]);return(0,i.jsx)(S.Provider,{value:k,children:"function"==typeof n?n(k):n})}function C(){var e=(0,g.useContext)(S);if(!e)throw Error("SliceBuilderProvider not found");return e}var k=t(5479),F=t(8482),E=t(4092),R=function(){var e=C(),n=e.slice,t=e.setSlice,r=e.variation,o=function(e){return function(i){var o=(0,k.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,c=i.value,s=(0,k.L4)({slice:n,variationId:r.id,widgetArea:e,previousFieldId:o,newFieldId:a,newField:c});t(s)}},c=function(e){return function(i){var o=i.id,a=i.label,c=i.widgetTypeName,s=d[c];s||console.log('Could not find widget with type name "'.concat(c,'". Please contact us!'));var u=s.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,k.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 c=(0,k.gR)({slice:n,variationId:r.id,widgetArea:e,sourceIndex:o.index,destinationIndex:a.index});(0,s.flushSync)(function(){return t(c)})}}}};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:c(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:c(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})]})},A=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,c=e.headerSx,s=void 0===c?{}:c;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)}},s),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,s=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,c=t&&t.length?null:{name:"Required!"},s=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,c,s,u)},u=function(e){w((0,D.camelCase)(e))},l=function(e){E(e),T&&u(e)},d=function(e){C(!1),u(e)},f=function(){v(),t()},v=function(){w(""),E(""),b({}),C(!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),T=S[0],C=S[1],k=(0,g.useState)(""),F=k[0],E=k[1],R=(0,g.useState)({value:o.id,label:o.name}),A=R[0],V=R[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=s({id:Z,name:F,origin:A})).length)return[3,1];return b(e),[3,3];case 1:if(!(n=a.find(function(e){return e.id===A.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:A},onSubmit:B,children:(0,i.jsx)(_.l0,{id:"variation-add",onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),B())},children:(0,i.jsx)(c.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)(c.xu,{gap:16,alignItems:"center",children:[(0,i.jsx)(c.zx,{onClick:f,color:"grey",children:"Cancel"}),(0,i.jsx)(c.zx,{loading:K,children:"Submit"})]}),close:f,children:[(0,i.jsxs)(c.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)(c.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)(c.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:A,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,c,s,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,(c=o.errors).length>0)throw c;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 s=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:s}),e.saveSliceSuccess(l),[2,l];case 6:throw d=n.sent(),f="Could not delete variation `".concat(e.variation.name,"`"),console.error(f,d),A.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,s=(0,a.useRouter)(),u=(0,g.useState)(!1),l=u[0],d=u[1],f=(0,I.Z)().saveSliceSuccess,v=C().setSlice;return(0,i.jsxs)(c.Vq,{open:n,onOpenChange:function(e){return!e&&t()},size:{width:448,height:"auto"},children:[(0,i.jsx)(c.fK,{icon:"delete",title:"Delete variation"}),(0,i.jsx)(c.cZ,{children:(0,i.jsxs)(c.xu,{flexDirection:"column",children:[(0,i.jsxs)(c.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)(c.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:s,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)(c.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,c,s,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,(c=o.errors).length>0)throw c;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 s=n.sent().mocks,u=(0,y.Z)((0,h.Z)({},e.component),{model:a,mocks:s}),e.saveSliceSuccess(u),[2,u];case 5:throw l=n.sent(),d="Could not rename variation `".concat(e.variation.name,"`"),console.error(d,l),A.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,s=e.variation,u=(0,g.useState)(!1),l=u[0],d=u[1],f=C().setSlice,v=(0,I.Z)().saveSliceSuccess;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(c.Vq,{open:r,onOpenChange:function(e){return!e&&o()},size:{width:448,height:"auto"},children:[(0,i.jsx)(c.fK,{icon:"edit",title:"Rename variation"}),(0,i.jsx)(c.cZ,{children:(0,i.jsx)(_.J9,{validateOnMount:!0,initialValues:{variationName:null!==(n=null==s?void 0:s.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(!s)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:s,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)(c.xu,{flexDirection:"column",gap:8,padding:16,children:[(0,i.jsx)(c.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)(c.xu,{flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:"_1ecs97dez4 _1ecs97dez8 _1ecs97df90",children:[(0,i.jsx)(c.xv,{variant:"bold",children:"Variation name*"}),"string"==typeof e.errors.variationName?(0,i.jsx)(c.xv,{variant:"small",color:"tomato10",children:e.errors.variationName}):null]}),(0,i.jsx)(c.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)(c.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=C(),t=n.slice,r=n.variation,o=n.setSlice,s=(0,g.useState)(),u=s[0],l=s[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)(c.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)(c.xu,{backgroundColor:"grey2",bottom:0,flexDirection:"column",padding:{bottom:40,inline:24},position:"sticky",style:{marginBottom:"-16px"},children:[(0,i.jsx)(c.ph,{sx:{left:0,position:"absolute",right:0}}),(0,i.jsx)(c.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,c,s,u,l;return(0,x.__generator)(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),a=(r=(0,k.Kp)({slice:t,id:e,name:n,copiedVariation:i})).slice,c=r.variation,[4,(0,b.Ve)(a)];case 1:return d.sent(),j(a),o(a),s=K.Y.getBuilderPagePathname({libraryName:a.href,sliceName:a.model.name,variationId:c.id}),y.replace(s),[3,3];case 2:return u=d.sent(),l="Could not add variation `".concat(n,"`"),console.error(l,u),A.Am.error(l),[3,3];case 3:return[2]}})}),function(n,t,i){return e.apply(this,arguments)}),variations:t.model.variations})]})},J=t(75329),Y=t(33710),ee=t(42189),en=t(17036),et=t(56580),ei=t(22342),er=function(e){var n=e.children,t=e.open,r=e.onClose;return(0,i.jsxs)(ei.zs,{open:t,trigger:n,onClose:r,children:[(0,i.jsx)(ei.Ev,{children:"Simulate your slices"}),(0,i.jsx)(ei.LB,{component:"video",cloudName:"dmtf1daqp",loop:!1,autoPlay:!1,publicId:J.Sn,poster:"/simulator-video-thumbnail.png",controls:!0,onPlay:function(){b.Xe.track({event:"open-video-tutorials",video:J.Sn})}}),(0,i.jsx)(ei.OJ,{children:"Minimize context-switching by previewing your Slice components in the simulator."}),(0,i.jsx)(ei.Rp,{children:"Got it"})]})},eo=function(e){var n=e.disabled,t=(0,a.useRouter)(),r=(0,g.useRef)(null),o=(0,I.Z)().setSeenSimulatorToolTip,s=(0,et.v9)(function(e){return{hasSeenSimulatorTooltip:(0,en.bv)(e)}}).hasSeenSimulatorTooltip;(0,g.useEffect)(function(){var e=r.current;e&&!s&&setTimeout(function(){return Y.Z.show(e)},5e3)},[s]);var u=function(){if(o(),r.current){var e=r.current;Y.Z.hide(e)}};return(0,i.jsx)("span",{"data-tip":!0,"data-tip-disable":!1,"data-for":"simulator-button-tooltip",ref:r,children:(0,i.jsx)(er,{open:!s,onClose:u,children:(0,i.jsx)(c.zx,{"data-tip":!0,"data-testid":"simulator-open-button",onClick:function(){u(),window.open("".concat(t.asPath,"/simulator"),J.pq)},disabled:n,renderStartIcon:function(){return(0,i.jsx)(ee.z,{color:c.TV.color.greyLight1,height:c.TV.size[24],style:{transform:"scale(calc(4 / 3))"},width:c.TV.size[24]})},children:"Simulate"})})})},ea=t(53220),ec=t(17329),es=t(81038);function eu(e){return el.apply(this,arguments)}function el(){return(el=(0,m.Z)(function(e){var n,t,i;return(0,x.__generator)(this,function(r){switch(r.label){case 0:return[4,es.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 ed=t(67445),ef=t(64722),ev=t(20812),ep=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"})]}))},em=t(8564),eh=function(){var e,n,t=(e=(0,ef.l)().source,n=(0,ed.Ag)(e.query),void 0!==n&&(0,ed.ne)(e.asPath,n)?n:void 0);return void 0!==t?(0,i.jsx)(em.S,{children:(0,i.jsx)(g.Suspense,{children:(0,i.jsx)(c.xu,{bottom:32,justifyContent:"center",position:"fixed",right:0,width:"100vw",children:(0,i.jsx)(ey,{sourceCustomTypeId:t})})})}):null},ey=function(e){var n,t=(n=e.sourceCustomTypeId,(0,ec.QT)(eu,[n])),r=(0,g.useState)(!0),o=r[0],s=r[1],u=(0,a.useRouter)();if(void 0===t||!o)return null;var l=t.format,d=t.id,f=ed.cd[l].getBuilderPagePathname(d);return(0,i.jsxs)(c.hE,{density:"compact",color:"dark",children:[(0,i.jsxs)(c.zx,{onClick:function(){u.push(f)},renderStartIcon:function(){return(0,i.jsx)(ep,{})},children:["Return to ",t.label]}),(0,i.jsx)(c.zx,{onClick:function(){s(!1)},renderStartIcon:function(){return(0,i.jsx)(ev.T,{})}})]})},ex=t(47976),eg=function(){var e=C(),n=e.slice,t=e.actionQueueStatus;return(0,i.jsxs)(ea.LN,{children:[(0,i.jsxs)(ea.wd,{children:[(0,i.jsx)(ea.Xq,{url:"/slices"}),(0,i.jsx)(ea.Cx,{folder:"Slices",page:n.model.name}),(0,i.jsxs)(ea.K2,{children:[(0,i.jsx)(ex.X,{status:t}),(0,i.jsx)(eo,{disabled:"done"!==t})]})]}),(0,i.jsxs)(ea.RN,{children:[(0,i.jsxs)(c.xu,{alignItems:"flex-start",display:"grid",gap:16,gridTemplateColumns:"320px 1fr",children:[(0,i.jsx)($,{}),(0,i.jsx)(R,{})]}),(0,i.jsx)(eh,{})]})]})},ej=t(25998);function eb(){var e=(0,a.useRouter)(),n=(0,ej.Z)(),t=n.slice,r=n.variation;return void 0===t||void 0===r?(e.replace("/"),null):(0,i.jsx)(T,{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)(eg,{})]})}})}},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 C},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 T},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),c=t(88866),s=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===c.SlicesFieldType})}function v(e,n){if(t=e,d=f(t,s=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,s,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===c.SlicesFieldType})}),s=r;do t="slices".concat(0!==s?s.toString():""),s++;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:c.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===c.SlicesFieldType});if(void 0===a)return e;var u=(0,s.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===c.SlicesFieldType});if(void 0===v)return a;var p=f[v];if(p.type!==c.SlicesFieldType)return a;var m=(0,s.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 c=(0,a.Z)(i,1)[0];t=v(t,c)}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,s.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,s=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!==c.SlicesFieldType})),p=(0,o.Z)((0,r.Z)({},v),(0,i.Z)({},u,s));if(void 0!==d){var m=(0,a.Z)(d,2),h=m[0],y=m[1];p[h]=y}return k({customType:n,sectionId:t,updatedSection:p})}function b(e){var n=e.customType,t=e.sectionId,i=e.fieldId,r=(0,s.ud)(n.json[t],i);return k({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 k({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],s=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!==c.SlicesFieldType})),l=E({fields:u,sourceIndex:i,destinationIndex:r});if(void 0!==s){var d=(0,a.Z)(s,2),v=d[0],p=d[1];l[v]=p}return k({customType:n,sectionId:t,updatedSection:l})}function w(e){var n,t=e.customType,a=e.sectionId,c=e.groupFieldId,s=e.newField,u=e.newFieldId,l=R({customType:t,sectionId:a,groupFieldId:c}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l)return t;var f=A(l,(0,o.Z)((0,r.Z)({},d),(0,i.Z)({},u,s)));return k({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},c,f))})}function S(e){var n,t=e.customType,a=e.sectionId,c=e.groupFieldId,u=e.fieldId,l=R({customType:t,sectionId:a,groupFieldId:c}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l||!d)return t;var f=(0,s.ud)(d,u),v=A(l,f);return k({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},c,v))})}function T(e){var n,t=e.customType,a=e.sectionId,c=e.groupFieldId,s=e.previousFieldId,u=e.newFieldId,l=e.newField,d=R({customType:t,sectionId:a,groupFieldId:c}),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:s,newFieldId:u,newField:l}),p=A(d,v);return k({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},c,p))})}function C(e){var n,t=e.customType,a=e.sectionId,c=e.groupFieldId,s=e.sourceIndex,u=e.destinationIndex,l=R({customType:t,sectionId:a,groupFieldId:c}),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:s,destinationIndex:u}),v=A(l,f);return k({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},c,v))})}function k(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),c=o[0],s=o[1];return c===t?e[i]=r:c!==i&&(e[c]=s),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 R(e){var n=e.customType,t=e.sectionId,i=e.groupFieldId,r=n.json[t][i];if(r.type===c.GroupFieldType)return r}function A(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,c=e.format,s=(n=a,t=c,!1===n&&"page"===t?(0,r.Z)({},N,V):!1===n?_:"page"===t?(0,r.Z)({},L,V):D);return{format:c,id:i,json:s,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 c}});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})},c=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 c(e){return(a[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function s(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 c(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([c(e.key),c(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&v([c(e.key),c(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,s=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=c(m),b=p.toLowerCase();if(!t){if(!g===o&&"alt"!==b||!x===u&&"shift"!==b)return!1;if(s){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 T=(!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),C=(0,i.useContext)(y).enabledScopes,k=(0,i.useContext)(h);return g(function(){if((null==T?void 0:T.enabled)!==!1&&(e=C,n=null==T?void 0:T.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==T?void 0:T.enableOnFormTags)||null!=T&&null!=T.ignoreEventWhen&&T.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!=T&&T.enableOnContentEditable)&&s(I,null==T?void 0:T.splitKey).forEach(function(t){var i,r,o,a,c,s,l,d=u(t,null==T?void 0:T.combinationKey);if(m(e,d,null==T?void 0:T.ignoreModifiers)||null!=(l=d.keys)&&l.includes("*")){if(n&&j.current)return;if(i=e,r=d,("function"==typeof(o=null==T?void 0:T.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),a=e,c=d,"function"==typeof(s=null==T?void 0:T.enabled)?!s(a,c):!0!==s&&void 0!==s){x(e);return}S.current(e,d),n||(j.current=!0)}})}},i=function(e){void 0!==e.key&&(f(c(e.code)),((null==T?void 0:T.keydown)===void 0&&(null==T?void 0:T.keyup)!==!0||null!=T&&T.keydown)&&t(e))},r=function(e){void 0!==e.key&&(v(c(e.code)),j.current=!1,null!=T&&T.keyup&&t(e,!0))},o=l.current||(null==b?void 0:b.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),k&&s(I,null==T?void 0:T.splitKey).forEach(function(e){return k.addHotkey(u(e,null==T?void 0:T.combinationKey,null==T?void 0:T.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),k&&s(I,null==T?void 0:T.splitKey).forEach(function(e){return k.removeHotkey(u(e,null==T?void 0:T.combinationKey,null==T?void 0:T.description))})}}},[I,T,C]),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
|