slice-machine-ui 2.17.3-alpha.jp-remove-image-to-slice-experiment.1 → 2.17.3-alpha.jp-revert-section-naming-experiment.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/out/404.html +1 -1
- package/out/_next/static/{ce5aK5e3S4mimRW6pM_1C → TDI0oMeAJsBzW3-NbPUKW}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/489-949e8f6070a61205.js +1 -0
- package/out/_next/static/chunks/{630-29c729ad2a291ef6.js → 630-799c128fd87fa645.js} +1 -1
- package/out/_next/static/chunks/7-4221ce4f79fb2ff2.js +1 -0
- package/out/_next/static/chunks/pages/{_app-b4198e0ebcc68d2d.js → _app-79bce46871ddade7.js} +1 -1
- package/out/_next/static/chunks/pages/changes-b4b7d3047cf012a0.js +1 -0
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-4024560ca59ad2be.js → [customTypeId]-d4b2bfcf2a7dd717.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-0d2416da0958eb40.js → [pageTypeId]-912b2d65b2db290d.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-0ecd552897e61e29.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-0a51da2e35d6e62f.js +1 -0
- package/out/_next/static/chunks/pages/slices-12e4d75d553a0426.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 -3
- package/src/features/customTypes/customTypesBuilder/CreateSliceFromImageModal/CreateSliceFromImageModal.tsx +8 -21
- package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +52 -38
- package/src/features/navigation/Navigation.tsx +1 -7
- package/src/legacy/components/ChangesItems/ChangesItems.tsx +1 -8
- package/src/legacy/components/Forms/CreateSliceModal/CreateSliceModal.tsx +3 -8
- package/src/legacy/components/Simulator/components/FailedConnect/index.tsx +51 -56
- package/src/legacy/components/ToasterContainer/index.tsx +3 -14
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +1 -4
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +1 -5
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +53 -40
- package/src/legacy/lib/builders/SliceBuilder/index.tsx +1 -6
- package/src/legacy/lib/builders/common/Zone/components/ZoneEmptyState/ZoneEmptyState.tsx +5 -10
- package/src/pages/slices.tsx +36 -57
- package/out/_next/static/chunks/489-f1d584386a1ead7e.js +0 -1
- package/out/_next/static/chunks/907-590c914f55547b96.js +0 -1
- package/out/_next/static/chunks/pages/changes-564336edb0ed18b0.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-5008e29008aa04f4.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-bd5e45632c419567.js +0 -1
- package/out/_next/static/chunks/pages/slices-a0aa3bbe2cf1689c.js +0 -1
- package/src/features/builder/useSectionsNamingExperiment.ts +0 -15
- package/src/features/customTypes/customTypesBuilder/sliceCreationOptions.tsx +0 -74
- package/src/utils/textConversion.ts +0 -11
- /package/out/_next/static/{ce5aK5e3S4mimRW6pM_1C → TDI0oMeAJsBzW3-NbPUKW}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{74600:function(e,t,n){var i=n(34311),o=n(23779),r=i(function(e,t,n){return e+(n?" ":"")+o(t)});e.exports=r},26688:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices",function(){return n(31562)}])},34166:function(e,t,n){"use strict";n.d(t,{nZ:function(){return d},rT:function(){return f},tB:function(){return u}});var i=n(52322),o=n(56803),r=n(2784),l=n(30195),s=n(94160),a=n(76611),c=n(5683);function d(e){let{type:t,library:n,sliceId:i,variationId:o,langSmithUrl:r}=e,l=(0,c.i)({type:t,library:n,sliceId:i,variationId:o}),s=JSON.stringify({langSmithUrl:r});localStorage.setItem(l,s)}function u(e){let{type:t,library:n,sliceId:i,variationId:o}=e,r=(0,c.i)({type:t,library:n,sliceId:i,variationId:o});localStorage.removeItem(r)}function f(e){let{type:t,library:n,sliceId:d,variationId:u}=e,{key:f,value:m,done:x}=function(e){let{type:t,library:n,sliceId:i,variationId:o}=e,r=(0,c.i)({type:t,library:n,sliceId:i,variationId:o}),[s,d]=(0,a.V)(r,void 0,{schema:l.z.object({langSmithUrl:l.z.string().url().optional()})});return{key:r,value:s,done:()=>d(void 0)}}({type:t,library:n,sliceId:d,variationId:u}),[h,p]=(0,r.useState)(),v=e=>()=>{m&&(p(f),s.Xe.track({event:"slice-generation-feedback",type:t,sliceId:d,variationId:u,feedback:e,langSmithUrl:m.langSmithUrl}),x())};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.be,{children:(0,i.jsx)(o.bQ,{anchor:(0,i.jsx)(o.D,{width:"100%",justifyContent:"center",position:"absolute",bottom:64}),icon:"check",title:"Thanks for your feedback!",seconds:2,open:!!h,onOpenChange:e=>{e||p(void 0)}},h)}),(0,i.jsx)(o.i,{children:m&&(0,i.jsxs)(o.D,{flexDirection:"row",justifyContent:"end",gap:8,alignItems:"center",children:[(0,i.jsx)(o.bL,{color:"grey11",children:"Did the AI get it right?"}),(0,i.jsxs)(o.D,{flexDirection:"row",gap:4,children:[(0,i.jsx)(o.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Looks good",children:(0,i.jsx)(o.aZ,{variant:"solid",size:"small",icon:"thumbUp",onClick:v("up")})}),(0,i.jsx)(o.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Needs improvement",children:(0,i.jsx)(o.aZ,{variant:"solid",size:"small",icon:"thumbDown",onClick:v("down")})})]})]})})]})}},76611:function(e,t,n){"use strict";n.d(t,{V:function(){return o}});var i=n(2784);function o(e,t,n){let{schema:o}=null!=n?n:{},r=()=>{try{let n=localStorage.getItem(e);if(null==n)return t;if(!o)return JSON.parse(n);return o.parse(JSON.parse(n))}catch(e){return t}},[l,s]=(0,i.useState)(r),[a,c]=(0,i.useState)(e);return a!==e&&(c(e),s(r())),[l,(0,i.useCallback)(n=>{s(i=>{let o;if(void 0===(o="function"==typeof n?n(i):n)){try{localStorage.removeItem(e)}catch(e){return i}return t}try{localStorage.setItem(e,JSON.stringify(o))}catch(e){return i}return o})},[e,t])]}},33986:function(e,t,n){"use strict";n.d(t,{z:function(){return a}});var i=n(52322),o=n(2784),r=n(75289);let l=(e,t)=>e?"".concat(e,"-").concat(t):"",s=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},a=(0,o.forwardRef)((e,t)=>{let{label:n,Icon:o,type:a,form:c,isLoading:d=!1,disabled:u=!1,onClick:f,sx:m={},iconSize:x=16,iconFill:h,variant:p="primary",...v}=e;return(0,i.jsx)(r.zx,{ref:t,sx:{...m,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...d?{cursor:"wait !important"}:{}},type:a,form:c,disabled:u||d,onClick:d?void 0:f,variant:p,...v,children:d?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.$j,{size:x,color:s(p),"data-testid":l(v["data-testid"],"spinner")}),o&&n]}):(0,i.jsxs)(i.Fragment,{children:[o&&(0,i.jsx)(o,{size:x,fill:h,"data-testid":l(v["data-testid"],"icon")}),n]})})})},46999:function(e,t,n){"use strict";n.d(t,{W:function(){return l}});var i=n(52322),o=n(63397);n(2784);var r=n(75289);let l=e=>{let{name:t,label:n,placeholder:l,error:s,testId:a,onChange:c}=e;return(0,i.jsxs)(r.xu,{mb:3,children:[(0,i.jsx)(r.__,{htmlFor:t,mb:2,children:n}),(0,i.jsx)(o.gN,{name:t,type:"text",placeholder:l,as:r.II,autoComplete:"off",...c?{onChange:c}:null,...a?{"data-testid":a}:null}),s?(0,i.jsx)(r.xv,{"data-testid":a?"".concat(a,"-error"):"input-error",sx:{color:"error",mt:1},children:s}):null]})}},59532:function(e,t,n){"use strict";var i=n(52322),o=n(63397),r=n(37149),l=n.n(r),s=n(75289),a=n(33986),c=n(55862),d=n(30527);function u(e){let{children:t}=e,n=(0,d.W)();return(0,i.jsx)(s.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:t})}t.Z=function(e){let{children:t,close:n,isOpen:r,formId:f,validate:m,onSubmit:x,widthInPx:h,initialValues:p,content:{title:v},cardProps:y,omitFooter:g=!1,isLoading:b=!1,buttonLabel:j="Save",testId:k,actionMessage:S}=e;return l().setAppElement("#__next"),(0,i.jsx)(c.Z,{isOpen:r,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:v,style:{content:{width:null!=h?h:"900px"}},children:(0,i.jsx)(o.J9,{initialValues:p,validate:e=>m?m(e):void 0,onSubmit:e=>{x(e)},children:e=>{let{isValid:r,isSubmitting:l,values:c,errors:m,touched:x,setFieldValue:h,setValues:p}=e;return(0,i.jsx)(o.l0,{id:f,...null!=k?{"data-testid":k}:null,children:(0,i.jsx)(d.Z,{borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"},...y,Header:(0,i.jsxs)(u,{children:[(0,i.jsx)(s.X6,{sx:{fontSize:"20px"},children:v}),(0,i.jsx)(s.x8,{type:"button",onClick:n})]}),Footer:g?null:(0,i.jsxs)(s.kC,{sx:{alignItems:"space-between"},children:[(0,i.jsx)(s.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof S?S(e):S}),(0,i.jsxs)(s.kC,{sx:{ml:"auto"},children:[(0,i.jsx)(s.zx,{mr:2,type:"button",onClick:n,variant:"secondary",disabled:l||b,children:"Cancel"}),(0,i.jsx)(a.z,{label:j,form:f,type:"submit",disabled:!r||l||b,isLoading:l||b,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:t({isValid:r,isSubmitting:l,values:c,errors:m,touched:x,setFieldValue:h,setValues:p})})})}})})}},31562:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return q}});var i=n(52322),o=n(56803),r=n(97729),l=n.n(r),s=n(5632),a=n(2784),c=n(56580),d=n(88932),u=n(65077),f=n(75289),m=n(43388),x=n(63470),h=n(91589),p=n(27213),v=n(51507),y=n(27763),g=n(21442),b=n(51384),j=n(65186),k=n(59326),S=n(34166),w=n(80148);async function C(e){let{sliceName:t,sliceID:n,libraryID:i,sliceVariationIds:o,onSuccess:r}=e;try{let{errors:e}=await w.managerClient.slices.deleteSlice({libraryID:i,sliceID:n});if(e.length>0)throw e;o.forEach(e=>{(0,S.tB)({type:"model",library:i,sliceId:n,variationId:e})}),r(),d.Am.success("Successfully deleted slice “".concat(t,"”"))}catch(n){let e="An unexpected error happened while deleting slice “".concat(t,"”.");console.error(e,n),d.Am.error(e)}}var I=n(68968),L=n(33986),E=n(30527),O=n(55862),R=n(54597);let A=e=>{var t;let{isOpen:n,libName:o,sliceId:r,sliceName:l,sliceVariationIds:s,onClose:c}=e,[d,u]=(0,a.useState)(!1),{deleteSliceSuccess:m}=(0,R.Z)(),{syncChanges:x}=(0,I.g)(),{theme:h}=(0,k.B7)(),p=async()=>{u(!0),await C({libraryID:o,sliceID:r,sliceName:l,sliceVariationIds:s,onSuccess:()=>{m(r,o),x()}}),c(),u(!1)};return(0,i.jsx)(O.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:c,children:(0,i.jsx)(E.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},borderFooter:!0,Header:(0,i.jsxs)(f.kC,{sx:{position:"sticky",background:"gray",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,i.jsxs)(f.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(j.$vK,{size:20,color:null===(t=h.colors)||void 0===t?void 0:t.greyIcon}),(0,i.jsx)(f.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,i.jsx)(f.x8,{type:"button",onClick:c})]}),Footer:()=>(0,i.jsxs)(f.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorders))},backgroundColor:"gray"},children:[(0,i.jsx)(L.z,{label:"Cancel",variant:"secondary",onClick:c,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,i.jsx)(L.z,{label:"Delete",variant:"danger",isLoading:d,sx:{minHeight:39,minWidth:78},onClick:()=>{p()}})]}),children:(0,i.jsxs)(f.nv,{children:["This action will immediately make the following changes:",(0,i.jsxs)("ul",{children:[(0,i.jsxs)("li",{children:["Delete the"," ",(0,i.jsxs)(f.xv,{sx:{fontWeight:"bold"},children:[o,"/",l,"/"]})," ","directory."]}),(0,i.jsx)("li",{children:"Remove the Slice from all Slice Zones that use it."})]}),"The next time you push your changes to Prismic, the following change will happen:",(0,i.jsx)("ul",{children:(0,i.jsx)("li",{children:"Remove the Slice from the list of available Slices to use in the Page Builder."})}),"You will need to manually remove the Slice from any Pages that currently use it."]})})})};var N=n(36887),z=n(94160),D=e=>{let{title:t,onCreateNew:n,buttonText:o,documentationComponent:r,videoPublicIdUrl:l,...s}=e;return(0,i.jsxs)(f.xu,{sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"},...s,children:[(0,i.jsx)(f.xu,{sx:e=>{var t;return{display:"flex",flex:1,alignItems:"center",minWidth:"400px",maxWidth:"70%",border:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02)}},children:(0,i.jsx)(N.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:l,onPlay:()=>{z.Xe.track({event:"open-video-tutorials",video:l})}})}),(0,i.jsxs)(f.xu,{sx:e=>{var t;return{bg:"white",display:"flex",flexDirection:"column",border:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02),flex:1,minWidth:"400px",maxWidth:"70%"}},children:[(0,i.jsxs)(f.xu,{sx:e=>{var t;return{display:"flex",flexDirection:"column",p:4,borderBottom:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02)}},children:[(0,i.jsx)(f.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:t}),(0,i.jsx)(f.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:r})]}),(0,i.jsxs)(f.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,i.jsx)(f.zx,{onClick:n,"data-testid":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:o}),(0,i.jsx)(f.xv,{sx:{fontSize:"12px",color:"grey04",maxWidth:"280px"},children:"It will be stored locally and you will be able to push it to your repository"})]})]})]})},_=n(6256),W=n(63908),P=n(26109);async function F(e){let{slice:t,newSliceName:n,onSuccess:i}=e;try{let e=(0,W.PQ)(t,n),{errors:o}=await w.managerClient.slices.renameSlice({libraryID:t.from,model:P.id.fromSM(e.model)});if(o.length>0)throw o;i(e),d.Am.success("Slice name updated")}catch(n){let e="An unexpected error happened while renaming “".concat(t.model.name,"”.");console.error(e,n),d.Am.error(e)}}var Z=n(7723),T=n(59532),B=n(46999),K=n(63019);let H=e=>{var t,n;let{slice:o,isOpen:r,onClose:l}=e,{renameSliceSuccess:s}=(0,R.Z)(),{syncChanges:a}=(0,I.g)(),{localLibs:d,remoteLibs:u}=(0,c.v9)(e=>({localLibs:(0,Z.Sd)(e),remoteLibs:(0,Z.sT)(e)})),m=null!==(t=null==o?void 0:o.model.name)&&void 0!==t?t:"",x=async e=>{o&&(await F({slice:o,newSliceName:e.sliceName,onSuccess:e=>{s(e.from,e.model),a()}}),l())};return(0,i.jsx)(T.Z,{testId:"rename-slice-modal",isOpen:r,widthInPx:"530px",formId:"rename-slice-modal-".concat(null!==(n=null==o?void 0:o.model.id)&&void 0!==n?n:""),close:l,buttonLabel:"Rename",onSubmit:e=>void x(e),initialValues:{sliceName:m},content:{title:"Rename a slice"},validate:e=>(0,K.h)(e,d,u),children:e=>{let{touched:t,errors:n}=e;return(0,i.jsx)(f.xu,{children:(0,i.jsx)(B.W,{name:"sliceName",label:"Slice Name","data-testid":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:t.sliceName?n.sliceName:void 0,testId:"slice-name-input"})})}})};var X=n(21151),U=n(68105),M=n(39204),V=n(7974),J=n(31860),q=()=>{var e,t,n,r;let j=(0,s.useRouter)(),{modalPayload:k,onOpenModal:S}=(0,g.H)(),{openLoginModal:C}=(0,R.Z)(),I=(0,x.k)(),L=(0,p.F)({menuType:"Dropdown",sectionsNamingExperiment:I}),{sliceFilterFn:E,defaultVariationSelector:O}=k,{remoteSlices:N,libraries:z}=(0,c.v9)(e=>({remoteSlices:(0,Z.sT)(e),libraries:(0,Z.Sd)(e)})),[W,P]=(0,a.useState)(!1),[F,T]=(0,a.useState)(!1),[B,K]=(0,a.useState)(!1),[q,Q]=(0,a.useState)(!1),Y=z.filter(e=>e.isLocal),G=z.map(e=>(e.components=[...e.components].sort((e,t)=>e.model.name.localeCompare(t.model.name)),e)),$=(z||[]).map(e=>e.components).flat(),ee=$.length,[et,en]=(0,a.useState)(),ei=()=>{T(!0)},eo=()=>{K(!0)},er=async()=>{await w.managerClient.user.checkIsLoggedIn()?Q(!0):C()},el=()=>{Q(!1)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l(),{children:(0,i.jsxs)("title",{children:[(0,J._)((0,J.f)(I.value))," - Slice Machine"]})}),(0,i.jsxs)(b.LN,{children:[(0,i.jsxs)(b.wd,{children:[(0,i.jsx)(b.Cx,{children:(0,i.jsx)(m.g,{children:(0,J._)((0,J.f)(I.value))})}),(null==Y?void 0:Y.length)!==0&&0!==ee?(0,i.jsxs)(o.ar,{children:[(0,i.jsx)(o.av,{children:(0,i.jsx)(o.E,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,i.jsxs)(o.as,{align:"end",children:[(0,i.jsx)(o.at,{renderStartIcon:()=>L.fromImage.BackgroundIcon,onSelect:()=>void er(),description:L.fromImage.description,children:L.fromImage.title}),(0,i.jsx)(o.at,{renderStartIcon:()=>L.fromScratch.BackgroundIcon,onSelect:()=>P(!0),description:L.fromScratch.description,children:L.fromScratch.title})]})]}):void 0]}),(0,i.jsxs)(b.RN,{children:[(0,i.jsx)(u.xR,{sx:{display:"flex",flexDirection:"column"},children:G.length>0?(0,i.jsx)(f.kC,{sx:{flex:1,flexDirection:"column"},children:0===ee?(0,i.jsx)(f.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,i.jsx)(D,{title:"What are ".concat((0,J._)(I.value),"?"),onCreateNew:()=>{P(!0)},buttonText:"Create one",videoPublicIdUrl:V.rd,documentationComponent:(0,i.jsxs)(i.Fragment,{children:[(0,J._)((0,J.f)(I.value))," ",'are sections of your website. Prismic documents contain a dynamic "',(0,J.f)(I.value)," ",'Zone" that allows content creators to add, edit, and rearrange ',(0,J._)(I.value)," ","to compose dynamic layouts for any page design."," ",(0,i.jsx)(f.rU,{target:"_blank",href:"https://prismic.io/docs/core-concepts/slices",sx:e=>{var t;return{color:null==e?void 0:null===(t=e.colors)||void 0===t?void 0:t.primary}},children:"Learn more"}),"."]}),"data-testid":"slices-table-blank-slate"})}):G.map(e=>{let{name:t,isLocal:n,components:o}=e;return(0,i.jsxs)(f.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,i.jsxs)(f.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)(f.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,i.jsx)(f.xv,{children:I.eligible&&1===G.length?"Your ".concat((0,J._)(I.value)):t})}),!n&&(0,i.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,i.jsx)(X.Z,{elems:o,defineElementKey:e=>e.model.name,renderElem:e=>(0,i.jsx)(v.b,{action:{type:"menu",onRemove:()=>{en(e),ei()},onRename:()=>{en(e),eo()}},mode:"navigation",onUpdateScreenshot:()=>{S({sliceFilterFn:t=>t.filter(t=>t.model.id===e.model.id)})},slice:e,variant:"solid"}),gridGap:"32px 16px"})]},t)})}):void 0}),(null==Y?void 0:Y.length)>0&&(0,i.jsx)(U.Z,{slices:E($),defaultVariationSelector:O}),(null==Y?void 0:Y.length)>0&&W&&(0,i.jsx)(_.c,{localLibraries:Y,location:"slices",remoteSlices:N,onSuccess:(e,t)=>{let n=e.variations[0].id,i=y.Y.getBuilderPagePathname({libraryName:t,sliceName:e.name,variationId:n});j.push(i),d.Am.success((0,M.kQ)({sectionsNamingExperiment:I,path:"".concat(t,"/").concat(e.name,"/model.json")}))},onClose:()=>{P(!1)}}),(0,i.jsx)(H,{isOpen:B,slice:et,onClose:()=>{K(!1)},"data-testid":"rename-slice-modal"}),(0,i.jsx)(A,{isOpen:F,libName:null!==(e=null==et?void 0:et.from)&&void 0!==e?e:"",sliceId:null!==(t=null==et?void 0:et.model.id)&&void 0!==t?t:"",sliceName:null!==(n=null==et?void 0:et.model.name)&&void 0!==n?n:"",sliceVariationIds:(null!==(r=null==et?void 0:et.model.variations)&&void 0!==r?r:[]).map(e=>e.id),onClose:()=>{T(!1)}}),(0,i.jsx)(h.S,{open:q,location:"slices",onSuccess:e=>{let{library:t}=e;d.Am.success((0,i.jsx)(M.GX,{message:"".concat((0,J.f)(I.value),"(s) added to ").concat(I.value," zone and created at: "),path:t})),el()},onClose:el})]})]})]})}},5683:function(e,t,n){"use strict";n.d(t,{i:function(){return r},v:function(){return o}});let i=e=>"slice-machine_".concat(e),o=i("staticFieldsInfoDialogDismissed");function r(e){let{type:t,library:n,sliceId:o,variationId:r}=e;return i(["ai-feedback",t,n,o,r].join("#"))}},76473:function(e,t,n){"use strict";n.d(t,{y1:function(){return b}});var i=n(2784);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}n(52322);var r=["shift","alt","meta","mod","ctrl"],l={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function s(e){return(l[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function a(e,t){return void 0===t&&(t=","),e.split(t)}function c(e,t,n){void 0===t&&(t="+");var i=e.toLocaleLowerCase().split(t).map(function(e){return s(e)}),l={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod")},a=i.filter(function(e){return!r.includes(e)});return o({},l,{keys:a,description:n})}"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&&m([s(e.key),s(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){d.clear()});var d=new Set;function u(e){return Array.isArray(e)}function f(e){var t=Array.isArray(e)?e:[e];d.has("meta")&&d.forEach(function(e){return!r.includes(e)&&d.delete(e.toLowerCase())}),t.forEach(function(e){return d.add(e.toLowerCase())})}function m(e){var t=Array.isArray(e)?e:[e];"meta"===e?d.clear():t.forEach(function(e){return d.delete(e.toLowerCase())})}function x(e,t){var n=e.target;void 0===t&&(t=!1);var i=n&&n.tagName;return u(t)?!!(i&&t&&t.some(function(e){return e.toLowerCase()===i.toLowerCase()})):!!(i&&t&&!0===t)}var h=function(e,t,n){void 0===n&&(n=!1);var i,o=t.alt,r=t.meta,l=t.mod,a=t.shift,c=t.ctrl,f=t.keys,m=e.key,x=e.code,h=e.ctrlKey,p=e.metaKey,v=e.shiftKey,y=e.altKey,g=s(x),b=m.toLowerCase();if(!n){if(!y===o&&"alt"!==b||!v===a&&"shift"!==b)return!1;if(l){if(!p&&!h)return!1}else if(!p===r&&"meta"!==b&&"os"!==b||!h===c&&"ctrl"!==b&&"control"!==b)return!1}return!!(f&&1===f.length&&(f.includes(b)||f.includes(g)))||(f?(void 0===i&&(i=","),(u(f)?f:f.split(i)).every(function(e){return d.has(e.trim().toLowerCase())})):!f)},p=(0,i.createContext)(void 0),v=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},g="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function b(e,t,n,o){var r,l=(0,i.useRef)(null),d=(0,i.useRef)(!1),b=n instanceof Array?o instanceof Array?void 0:o:n,j=u(e)?e.join(null==b?void 0:b.splitKey):e,k=n instanceof Array?n:o instanceof Array?o:void 0,S=(0,i.useCallback)(t,null!=k?k:[]),w=(0,i.useRef)(S);k?w.current=S:w.current=t;var C=(!function e(t,n){return t&&n&&"object"==typeof t&&"object"==typeof n?Object.keys(t).length===Object.keys(n).length&&Object.keys(t).reduce(function(i,o){return i&&e(t[o],n[o])},!0):t===n}((r=(0,i.useRef)(void 0)).current,b)&&(r.current=b),r.current),I=(0,i.useContext)(v).enabledScopes,L=(0,i.useContext)(p);return g(function(){if((null==C?void 0:C.enabled)!==!1&&(e=null==C?void 0:C.scopes,0===I.length&&e?(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):!!(!e||I.some(function(t){return e.includes(t)})||I.includes("*")))){var e,t=function(e,t){var n;if(void 0===t&&(t=!1),!(x(e,["input","textarea","select"])&&!x(e,null==C?void 0:C.enableOnFormTags)||null!=C&&null!=C.ignoreEventWhen&&C.ignoreEventWhen(e))){if(null!==l.current&&document.activeElement!==l.current&&!l.current.contains(document.activeElement)){y(e);return}(null==(n=e.target)||!n.isContentEditable||null!=C&&C.enableOnContentEditable)&&a(j,null==C?void 0:C.splitKey).forEach(function(n){var i,o,r,l=c(n,null==C?void 0:C.combinationKey);if(h(e,l,null==C?void 0:C.ignoreModifiers)||null!=(r=l.keys)&&r.includes("*")){if(t&&d.current)return;if(("function"==typeof(i=null==C?void 0:C.preventDefault)&&i(e,l)||!0===i)&&e.preventDefault(),"function"==typeof(o=null==C?void 0:C.enabled)?!o(e,l):!0!==o&&void 0!==o){y(e);return}w.current(e,l),t||(d.current=!0)}})}},n=function(e){void 0!==e.key&&(f(s(e.code)),((null==C?void 0:C.keydown)===void 0&&(null==C?void 0:C.keyup)!==!0||null!=C&&C.keydown)&&t(e))},i=function(e){void 0!==e.key&&(m(s(e.code)),d.current=!1,null!=C&&C.keyup&&t(e,!0))},o=l.current||(null==b?void 0:b.document)||document;return o.addEventListener("keyup",i),o.addEventListener("keydown",n),L&&a(j,null==C?void 0:C.splitKey).forEach(function(e){return L.addHotkey(c(e,null==C?void 0:C.combinationKey,null==C?void 0:C.description))}),function(){o.removeEventListener("keyup",i),o.removeEventListener("keydown",n),L&&a(j,null==C?void 0:C.splitKey).forEach(function(e){return L.removeHotkey(c(e,null==C?void 0:C.combinationKey,null==C?void 0:C.description))})}}},[j,C,I]),l}}},function(e){e.O(0,[898,789,397,44,34,658,907,888,774,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useExperimentVariant } from "@/hooks/useExperimentVariant";
|
|
2
|
-
|
|
3
|
-
export type UseSectionsNamingExperimentReturnType = {
|
|
4
|
-
eligible: boolean;
|
|
5
|
-
value: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export function useSectionsNamingExperiment(): UseSectionsNamingExperimentReturnType {
|
|
9
|
-
const variant = useExperimentVariant("section_greater_than_slice");
|
|
10
|
-
const eligible = variant?.value === "treatment";
|
|
11
|
-
return {
|
|
12
|
-
eligible,
|
|
13
|
-
value: eligible ? "section" : "slice",
|
|
14
|
-
};
|
|
15
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { BackgroundIcon } from "@prismicio/editor-ui";
|
|
2
|
-
|
|
3
|
-
import { UseSectionsNamingExperimentReturnType } from "@/features/builder/useSectionsNamingExperiment";
|
|
4
|
-
import { pluralize } from "@/utils/textConversion";
|
|
5
|
-
|
|
6
|
-
type SliceCreationOptionArgs = {
|
|
7
|
-
menuType: "ActionList" | "Dropdown";
|
|
8
|
-
sectionsNamingExperiment: UseSectionsNamingExperimentReturnType;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const getSliceCreationOptions = (args: SliceCreationOptionArgs) => {
|
|
12
|
-
const { menuType, sectionsNamingExperiment } = args;
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
fromImage: {
|
|
16
|
-
BackgroundIcon: (
|
|
17
|
-
<BackgroundIcon
|
|
18
|
-
name="autoFixHigh"
|
|
19
|
-
size={menuType === "ActionList" ? "small" : "extraSmall"}
|
|
20
|
-
iconSize={menuType === "ActionList" ? "medium" : "small"}
|
|
21
|
-
color="purple"
|
|
22
|
-
variant="solid"
|
|
23
|
-
radius={6}
|
|
24
|
-
/>
|
|
25
|
-
),
|
|
26
|
-
title: "Generate from image",
|
|
27
|
-
description: `Build a ${sectionsNamingExperiment.value} based on your design image.`,
|
|
28
|
-
},
|
|
29
|
-
fromScratch: {
|
|
30
|
-
BackgroundIcon: (
|
|
31
|
-
<BackgroundIcon
|
|
32
|
-
name="add"
|
|
33
|
-
size={menuType === "ActionList" ? "small" : "extraSmall"}
|
|
34
|
-
iconSize={menuType === "ActionList" ? "medium" : "small"}
|
|
35
|
-
color="white"
|
|
36
|
-
variant="solid"
|
|
37
|
-
radius={6}
|
|
38
|
-
/>
|
|
39
|
-
),
|
|
40
|
-
title: "Start from scratch",
|
|
41
|
-
description: `Build a custom ${sectionsNamingExperiment.value} your way.`,
|
|
42
|
-
},
|
|
43
|
-
fromTemplate: {
|
|
44
|
-
BackgroundIcon: (
|
|
45
|
-
<BackgroundIcon
|
|
46
|
-
name="contentCopy"
|
|
47
|
-
size={menuType === "ActionList" ? "small" : "extraSmall"}
|
|
48
|
-
iconSize={menuType === "ActionList" ? "medium" : "small"}
|
|
49
|
-
color="white"
|
|
50
|
-
variant="solid"
|
|
51
|
-
radius={6}
|
|
52
|
-
/>
|
|
53
|
-
),
|
|
54
|
-
title: "Use a template",
|
|
55
|
-
description: "Choose from ready-made examples.",
|
|
56
|
-
},
|
|
57
|
-
fromExisting: {
|
|
58
|
-
BackgroundIcon: (
|
|
59
|
-
<BackgroundIcon
|
|
60
|
-
name="folder"
|
|
61
|
-
size={menuType === "ActionList" ? "small" : "extraSmall"}
|
|
62
|
-
iconSize={menuType === "ActionList" ? "medium" : "small"}
|
|
63
|
-
color="white"
|
|
64
|
-
variant="solid"
|
|
65
|
-
radius={6}
|
|
66
|
-
/>
|
|
67
|
-
),
|
|
68
|
-
title: `Reuse an existing ${sectionsNamingExperiment.value}`,
|
|
69
|
-
description: `Select from your created ${pluralize(
|
|
70
|
-
sectionsNamingExperiment.value,
|
|
71
|
-
)}`,
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function capitalizeFirstLetter(string: string) {
|
|
2
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function pluralize(
|
|
6
|
-
singular: string,
|
|
7
|
-
count: number = 2,
|
|
8
|
-
plural?: string,
|
|
9
|
-
) {
|
|
10
|
-
return count === 1 ? singular : plural ?? `${singular}s`;
|
|
11
|
-
}
|
|
File without changes
|