slice-machine-ui 1.24.1-beta.1 → 1.24.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.
Files changed (41) hide show
  1. package/components/AppLayout/index.tsx +2 -1
  2. package/components/ChangesItems/ChangesItems.tsx +2 -1
  3. package/components/Navigation/index.tsx +2 -9
  4. package/components/Simulator/index.tsx +2 -5
  5. package/lib/builders/CustomTypeBuilder/TabZone/index.tsx +2 -1
  6. package/out/404.html +1 -1
  7. package/out/_next/static/{iDK_o1l8rg00jCK9CxTpb → HOPF2nFc-wvA4oDgGeECz}/_buildManifest.js +1 -1
  8. package/out/_next/static/chunks/727-c6c0c0d8c72c2676.js +1 -0
  9. package/out/_next/static/chunks/904-c09e8a519129a3d8.js +1 -0
  10. package/out/_next/static/chunks/pages/{_app-9054db3cdf4d28ea.js → _app-b6065a869383b3f2.js} +1 -1
  11. package/out/_next/static/chunks/pages/changes-0623b15f5e49d3b0.js +1 -0
  12. package/out/_next/static/chunks/pages/labs-773e5e6044d04247.js +1 -0
  13. package/out/_next/static/chunks/pages/{settings-0643e22c88bd7aca.js → settings-02a1097addef7470.js} +1 -1
  14. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-aaf65fbec8f5839c.js → simulator-22770c807a7d7090.js} +1 -1
  15. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-90bb2ea76d2abf42.js → [variation]-4cd51835ba731872.js} +1 -1
  16. package/out/changelog.html +1 -1
  17. package/out/changes.html +1 -1
  18. package/out/custom-types/[customTypeId].html +1 -1
  19. package/out/custom-types.html +1 -1
  20. package/out/index.html +1 -1
  21. package/out/labs.html +1 -1
  22. package/out/page-types/[pageTypeId].html +1 -1
  23. package/out/settings.html +1 -1
  24. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  25. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  26. package/out/slices.html +1 -1
  27. package/package.json +3 -3
  28. package/pages/_app.tsx +2 -15
  29. package/src/ErrorBoundary.tsx +43 -0
  30. package/src/features/customTypes/customTypesBuilder/PageSnippetDialog/PageSnippetDialog.tsx +2 -7
  31. package/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +1 -1
  32. package/src/features/labs/labsList/LabsPage.tsx +2 -6
  33. package/src/features/settings/git/ConnectGitRepository.tsx +6 -20
  34. package/src/features/slices/sliceBuilder/FloatingBackButton.tsx +2 -1
  35. package/test/__testutils__/index.tsx +8 -8
  36. package/out/_next/static/chunks/727-de03055e40815a3a.js +0 -1
  37. package/out/_next/static/chunks/904-40686b0426716111.js +0 -1
  38. package/out/_next/static/chunks/pages/changes-ccfd715c2bdc4f83.js +0 -1
  39. package/out/_next/static/chunks/pages/labs-2adfb5127f9c4081.js +0 -1
  40. package/src/hooks/useUser.ts +0 -14
  41. /package/out/_next/static/{iDK_o1l8rg00jCK9CxTpb → HOPF2nFc-wvA4oDgGeECz}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[849],{21985:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changes",function(){return t(58928)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return u}});var s=t(62230),i=t(85244),r=t(98240),o=t(52322),c=t(2784),l=t(75289),a=function(e,n){return e?"".concat(e,"-").concat(n):""},d=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},u=(0,c.forwardRef)(function(e,n){var t=e.label,c=e.Icon,u=e.type,x=e.form,h=e.isLoading,m=void 0!==h&&h,f=e.disabled,p=e.onClick,g=e.sx,j=e.iconSize,v=void 0===j?16:j,y=e.iconFill,b=e.variant,_=void 0===b?"primary":b,C=(0,r.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,o.jsx)(l.zx,(0,i.Z)((0,s.Z)({ref:n,sx:(0,s.Z)((0,i.Z)((0,s.Z)({},void 0===g?{}:g),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),m?{cursor:"wait !important"}:{}),type:u,form:x,disabled:void 0!==f&&f||m,onClick:m?void 0:p,variant:_},C),{children:m?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(l.$j,{size:v,color:d(_),"data-cy":a(C["data-cy"],"spinner")}),c&&t]}):(0,o.jsxs)(o.Fragment,{children:[c&&(0,o.jsx)(c,{size:v,fill:y,"data-cy":a(C["data-cy"],"icon")}),t]})}))})},59469:function(e,n,t){"use strict";var s=t(62230),i=t(52322),r=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,o=e.defineElementKey,c=e.gridTemplateMinPx,l=e.gridGap,a=e.sx;return(0,i.jsx)(r.xu,{as:"section",sx:(0,s.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===c?"320px":c,", 1fr))"),gridGap:void 0===l?"16px":l,pt:2},a),children:n.map(function(e,n){return e?(0,i.jsx)("span",{children:t(e,n)},"".concat(o(e),"-").concat(n+1)):null})})}},58928:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ex}});var s=t(22710),i=t(99267),r=t(52322),o=t(22715),c=t(2784),l=t(88932),a=t(97729),d=t.n(a),u=t(65077),x=t(5632),h=t.n(x),m=t(22840),f=t(951),p=t(75289),g=function(e){var n=e.children;return(0,r.jsx)(p.kC,{sx:{alignItems:"center",justifyContent:"space-between",mt:"8px",bg:"grey02",borderRadius:4,padding:"12px 16px",width:"100%"},children:n})},j=t(39097),v=t.n(j),y=t(7819),b=t(34728),_=t(67445),C=function(e){var n=e.ct,t=e.status,s=e.authStatus,i=e.isOnline;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.xu,{as:"td",style:{width:"40%"},children:(0,r.jsx)(p.xv,{sx:{fontWeight:500},children:n.label})}),(0,r.jsx)(p.xu,{as:"td",style:{width:"40%"},children:n.id}),(0,r.jsx)(p.xu,{as:"td",style:{width:"20%"},children:(0,r.jsx)(b.O,{authStatus:s,isOnline:i,modelStatus:t,modelType:"CustomType"})})]})},S=function(e){var n=e.customTypes,t=e.modelsStatuses,s=e.authStatus,i=e.isOnline;return(0,r.jsxs)(p.xu,{as:"table","data-legacy-component":!0,children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"transparent small",children:[(0,r.jsx)(p.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"Name"}),(0,r.jsx)(p.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"API ID"}),(0,r.jsx)(p.xu,{as:"th",sx:{width:"20%",fontWeight:600},children:"Status"})]})}),(0,r.jsx)("tbody",{children:n.map(function(e){return(0,y.TG)(e)?(0,r.jsx)(v(),{passHref:!0,href:_.cd[e.local.format].getBuilderPagePathname(e.local.id),legacyBehavior:!0,children:(0,r.jsx)("tr",{tabIndex:0,"data-cy":"custom-type-".concat(e.local.id),children:(0,r.jsx)(C,{ct:e.local,status:t.customTypes[e.local.id],authStatus:s,isOnline:i},e.local.id)})},e.local.id):(0,r.jsx)("tr",{tabIndex:0,className:"disabled","data-cy":"custom-type-".concat(e.remote.id),children:(0,r.jsx)(C,{ct:e.remote,status:t.customTypes[e.remote.id],authStatus:s,isOnline:i},e.remote.id)},e.remote.id)})})]})},k=t(59469),w=t(15836),z=t(5479),D=t(47731),T=t(32681),Z=t(71749),O=t(11563),F=t(82770);function I(){var e=(0,O.L)("slicemachine-dev-collaboration"),n=(0,c.useState)(!1),t=n[0],s=n[1],i=null==e?void 0:e.payload;return((0,c.useEffect)(function(){(null==e?void 0:e.value)==="on"&&void 0!==i&&F.Xe.track({event:"dev-collab:workflow-stub-displayed"})},[e,i]),(null==e?void 0:e.value)!=="on"||void 0===i)?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.xu,{alignItems:"flex-start",border:{bottom:!0,left:!0,right:!0,top:!0},borderRadius:6,borderStyle:"dashed",flexDirection:"column",flexShrink:0,gap:8,padding:16,width:320,children:[(0,r.jsxs)(o.xu,{flexDirection:"column",gap:2,children:[(0,r.jsx)(o.xv,{variant:"smallBold",children:i.cardTitle}),(0,r.jsx)(o.xv,{color:"grey11",variant:"small",children:i.cardDescription})]}),(0,r.jsx)(o.zx,{color:"grey",onClick:function(){F.Xe.track({event:"dev-collab:set-up-workflow-opened"}),s(!0)},children:i.cardButtonLabel})]}),(0,r.jsxs)(o.Vq,{onOpenChange:function(e){e||s(!1)},open:t,size:{height:"auto",width:448},children:[(0,r.jsx)(o.fK,{title:i.dialogTitle}),(0,r.jsx)(o.cZ,{children:(0,r.jsxs)(o.xu,{flexDirection:"column",children:[(0,r.jsx)(o.xu,{flexDirection:"column",padding:16,children:(0,r.jsx)(o.xv,{children:i.dialogDescription})}),(0,r.jsx)(o.kX,{cancel:{text:"Cancel"},ok:{text:i.dialogButtonLabel,onClick:function(){F.Xe.track({event:"dev-collab:join-beta-clicked"}),window.open(i.dialogButtonLink,"_blank"),s(!1)}},size:"medium"})]})})]})]})}var N=function(e){var n=e.unSyncedCustomTypes,t=e.unSyncedSlices,s=e.modelsStatuses,i=e.authStatus,l=e.isOnline,a=(0,D.H)(),d=a.modalPayload,u=a.onOpenModal,x=d.sliceFilterFn,h=d.defaultVariationSelector,m=t.filter(function(e){return s.slices[e.model.id]!==T.GJ.Deleted});return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(o.xu,{gap:16,alignItems:"flex-start",children:[(0,r.jsxs)(o.xu,{flexDirection:"column",flexGrow:1,children:[n.length>0&&(0,r.jsxs)(o.xu,{flexDirection:"column",children:[(0,r.jsx)(g,{children:(0,r.jsxs)(o.xu,{children:[(0,r.jsx)(o.xv,{variant:"h5",children:"Types"}),(0,r.jsx)(o.xv,{variant:"h5",sx:{marginLeft:8},children:n.length})]})}),(0,r.jsx)(S,{customTypes:n,modelsStatuses:s,authStatus:i,isOnline:l})]}),t.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.xu,{padding:{bottom:8},children:(0,r.jsxs)(g,{children:[(0,r.jsxs)(o.xu,{children:[(0,r.jsx)(o.xv,{variant:"h5",children:"Slices"}),(0,r.jsx)(o.xv,{variant:"h5",sx:{marginLeft:8},children:t.length})]}),(0,r.jsxs)(o.xu,{children:[t.some(function(e){return(0,z.cx)(e)>0&&s.slices[e.model.id]!==T.GJ.Deleted})&&(0,r.jsxs)(o.xv,{color:"amber11",sx:{marginRight:8,alignSelf:"center"},children:[(0,r.jsx)(f.sQg,{size:16,style:{marginRight:"4px",position:"relative",top:"3px"}}),"Missing Screenshots"]}),(0,r.jsxs)(o.zx,{color:"dark",onClick:function(){return u({sliceFilterFn:function(e){return e}})},children:[(0,r.jsx)(f.hOO,{style:{color:"#FFF",fontSize:"15px",position:"relative",top:"3px",marginRight:"4px"}})," ","Update all screenshots"]})]})]})}),(0,r.jsx)(k.Z,{gridGap:"32px 16px",elems:t,gridTemplateMinPx:"305px",defineElementKey:function(e){return e.model.name},renderElem:function(e){var n=s.slices[e.model.id];return(0,r.jsx)(Z.b,{action:{type:"status",authStatus:i,isOnline:l,modelStatus:n},isDeleted:n===T.GJ.Deleted,mode:"navigation",onUpdateScreenshot:function(){u({sliceFilterFn:function(n){return n.filter(function(n){return n.model.id===e.model.id})}})},slice:e,variant:"solid"})}}),(0,r.jsx)(w.Z,{slices:x(m),defaultVariationSelector:h})]})]}),(0,r.jsx)(o.SV,{children:(0,r.jsx)(c.Suspense,{children:(0,r.jsx)(I,{})})})]})})},R=t(91914),E=function(){return(0,r.jsx)(p.kC,{sx:{justifyContent:"center",alignItems:"center",flex:1},children:(0,r.jsxs)(p.kC,{sx:{flexDirection:"column",alignItems:"center",transform:"translateY(-50%)"},children:[(0,r.jsx)(R.wQ1,{size:48}),(0,r.jsx)(p.xv,{sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",mb:"8px",mt:"2px",textAlign:"center"},children:"No internet connection"}),(0,r.jsx)(p.xv,{sx:{fontSize:"13px",lineHeight:"24px",textAlign:"center"},children:"Connect to the internet to sync your changes."})]})})},L=t(90374),A=t(79096),B=function(e){var n=e.authStatus,t=(0,L.Z)().openLoginModal;return(0,r.jsxs)(o.xu,{flexDirection:"column",height:"100%",alignItems:"center",justifyContent:"center",gap:8,children:[n===A.t.FORBIDDEN?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.xv,{variant:"h3",align:"center",children:"It seems like you are logged out"}),(0,r.jsx)(o.xv,{align:"center",children:"Log in to connect to your repository."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.xv,{variant:"h3",align:"center",children:"It seems like you don't have access to this repository"}),(0,r.jsx)(o.xv,{align:"center",children:"Check that the repository name is correct, then contact your repository administrator."})]}),(0,r.jsxs)(o.xv,{align:"center",children:["If that doesn't work, it's possible that Slice Machine is having trouble accessing Prismic's servers."," ",(0,r.jsx)(o.hh,{href:"https://community.prismic.io/",children:"Contact our support team"}),"."]}),n===A.t.FORBIDDEN&&(0,r.jsx)(o.zx,{onClick:function(){return t()},children:"Log in to Prismic"})]})},P=t(2754),H=t(34543),M=t(62230),W=t(85244),V=t(98240),X=t(6277);t(25977);var G={primary:"_1ecs97dbc8 _1ecs97dbjl _1ecs97dbc2 _1ecs97dbjf _1ecs97dbca _1ecs97dbjn",secondary:"_1ecs97daji _1ecs97dah3 _1ecs97dajc _1ecs97dagx _1ecs97dajk _1ecs97dah5"},U={normal:"ovkapw1",smallBold:"ovkapw2",inherit:"ovkapw3 _1ecs97df47"},Y=function(e){var n=e.children,t=e.color,s=e.endIcon,i=e.href,l=e.textVariant,a=void 0===l?"smallBold":l,d=(0,V.Z)(e,["children","color","endIcon","href","textVariant"]);return(0,r.jsxs)("a",(0,W.Z)((0,M.Z)({href:i,target:"_blank",rel:"noreferrer"},d),{className:(0,X.Z)("ovkapw0 _1ecs97dez0 _1ecs97df41 _1ecs97dez2 _1ecs97dez8",G[void 0===t?"primary":t]),children:[(0,r.jsx)(o.xv,{component:"span",color:"inherit",variant:a,children:n}),(0,c.isValidElement)(s)?(0,c.cloneElement)(s,{className:(0,X.Z)(s.props.className,"_1ecs97dfhw",U[a])}):null]}))},K=t(56580),Q=t(39092),J=function(){var e,n=(e=(0,K.v9)(function(e){return{repoName:(0,Q.MY)(e)}}).repoName,"https://".concat(e,".prismic.io/documents/working"));return(0,r.jsxs)(P.R$,{style:{alignSelf:"center",marginTop:o.TV.size[72]},children:[(0,r.jsx)(P.u2,{children:(0,r.jsx)(o.Ee,{src:"/blank-slate-changes-uptodate.png",sizing:"cover"})}),(0,r.jsxs)(P.T9,{children:[(0,r.jsx)(P._T,{children:"Everything up-to-date"}),(0,r.jsx)(P.nf,{children:"You have no changes staged. Your changes appear here after you have saved them, while they're waiting to be pushed to the Page Builder. Ready to get going?"}),(0,r.jsxs)(P.Qj,{children:[(0,r.jsx)(o.zx,{onClick:function(){h().push("/")},children:"Create a page type"}),(0,r.jsx)(Y,{endIcon:(0,r.jsx)(H.AlO,{}),textVariant:"normal",href:n,children:"Create content"})]})]})]})},$=t(56577),q=t(31667);t(78656);var ee=function(e){var n=e.ctName,t=e.numberOfDocuments,s=e.link,i=e.isOverLimit;return(0,r.jsxs)(p.Zb,{sx:{mb:12},variant:"drawerCard","data-cy":"AssociatedDocumentsCard-".concat(n),children:[(0,r.jsxs)(p.kC,{sx:{flexDirection:"column"},children:[(0,r.jsx)(p.xv,{children:n}),(0,r.jsxs)(p.xv,{sx:{color:"textClear",fontSize:"12px",lineHeight:"16px"},children:[t," documents"]})]}),(0,r.jsx)(p.rU,{href:s,target:"_blank",variant:"cardSmall",sx:{color:void 0!==i&&i?"danger":"purple08"},children:"View documents"})]})},en=t(79797),et=t(54132),es=function(e){var n=e.isOpen,t=e.title,s=e.footer,i=e.explanations,o=e.onClose;return(0,r.jsx)(en.Z,{placement:"right",open:n,level:null,onClose:o,width:496,children:(0,r.jsx)(et.Z,{radius:"0px",bodySx:{bg:"white",padding:24,flex:1,display:"flex",flexDirection:"column",overflow:"scroll"},footerSx:{p:0},sx:{flexDirection:"column",display:"flex",height:"100%",border:"none"},borderFooter:!0,Header:function(){return(0,r.jsxs)(p.kC,{sx:{p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,r.jsx)(p.kC,{sx:{alignItems:"center"},children:(0,r.jsx)(p.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:t})}),(0,r.jsx)(p.x8,{type:"button",onClick:function(){return o()}})]})},Footer:function(){return(0,r.jsx)(p.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center",paddingRight:16,borderTop:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorders))},backgroundColor:"white",padding:20},children:s})},children:i})})},ei=function(e){var n=e.onToggle,t=e.isConfirmed,s=e.sx;return(0,r.jsxs)(p.kC,{sx:(0,M.Z)({borderRadius:6,flexDirection:"column",backgroundColor:"grey03",padding:12,width:"100%"},s),children:[(0,r.jsx)(p.xv,{sx:{fontWeight:"bold",mb:2},children:"Are you sure to proceed?"}),(0,r.jsxs)(p.__,{sx:{mt:"4px",py:1},variant:"large",children:[(0,r.jsx)(p.XZ,{defaultChecked:t,onChange:n,variant:"forms.checkbox.dark"}),"Delete these Documents"]})]})},er=function(e){var n=e.pushChanges,t=e.modalData,s=e.onClose,i=(0,c.useState)(!1),o=i[0],l=i[1],a=(0,K.v9)(function(e){return{remoteOnlyCustomTypes:(0,q.Ch)(e).filter(y.yp)}}).remoteOnlyCustomTypes;if((null==t?void 0:t.type)!=="SOFT")return null;var d=t.details.customTypes.map(function(e){var n,t=a.find(function(n){return(0,y.n5)(n)===e.id});return void 0===t?null:(0,r.jsx)(ee,{isOverLimit:!0,ctName:null!==(n=t.remote.label)&&void 0!==n?n:t.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,r.jsx)(es,{isOpen:"SOFT"===t.type,title:"Confirm deletion",onClose:s,footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ei,{onToggle:function(){l(!o)},isConfirmed:o,sx:{mb:10}}),(0,r.jsx)($.z,{label:"Push changes",variant:"primary",onClick:function(){n(o)},disabled:!o,sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}})]}),explanations:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:"This action will also delete Documents."}),(0,r.jsxs)(p.xv,{sx:{mb:24},children:[t.details.customTypes.length>1?"These types have":"This type has"," ","associated Documents, which will also be deleted. This might create broken links in your repository."]}),d]})})},eo=function(e){var n=e.pushChanges,t=e.modalData,s=e.onClose,i=(0,K.v9)(function(e){return{remoteOnlyCustomTypes:(0,q.Ch)(e).filter(y.yp)}}).remoteOnlyCustomTypes;if((null==t?void 0:t.type)!=="HARD")return null;var o=t.details.customTypes.map(function(e){var n,t=i.find(function(n){return(0,y.n5)(n)===e.id});return void 0===t?null:(0,r.jsx)(ee,{isOverLimit:!0,ctName:null!==(n=t.remote.label)&&void 0!==n?n:t.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,r.jsx)(es,{isOpen:"HARD"===t.type,title:"Manual action required",onClose:s,footer:(0,r.jsx)($.z,{label:"Try again",variant:"primary",onClick:function(){n(!1)},sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}}),explanations:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(p.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:["Your type",t.details.customTypes.length>1&&"s"," cannot be deleted."]}),(0,r.jsxs)(p.xv,{sx:{mb:24},children:[t.details.customTypes.length>1?"These types have":"This type has"," ","too many associated Documents. Archive and delete these Documents manually and then try deleting the types again."]}),o]})})},ec=t(46326),el=t(41834),ea=t(80262),ed=t(16847),eu=t(50950),ex=function(){var e,n=(0,el.X)(),t=n.unSyncedSlices,a=n.unSyncedCustomTypes,h=n.changedCustomTypes,f=n.changedSlices,p=n.modelsStatuses,g=(0,ea.L)(),j=(0,ed.n)(),v=(0,L.Z)(),y=v.pushChangesSuccess,b=v.refreshState,_=(0,c.useState)(!1),C=_[0],S=_[1],k=(0,c.useState)(void 0),w=k[0],z=k[1],D=(0,eu.g)().autoSyncStatus,T=(0,x.useRouter)(),Z=t.length+a.length;(0,c.useEffect)(function(){("synced"===D||"failed"===D||"syncing"===D)&&T.push("/")},[D,T]);var O=(e=(0,s.Z)(function(e){var n,t,s;return(0,i.__generator)(this,function(t){switch(t.label){case 0:return t.trys.push([0,5,,6]),S(!0),z(void 0),[4,(0,ec.t)({confirmDeleteDocuments:e,changedCustomTypes:h,changedSlices:f})];case 1:if(!(void 0!==(n=t.sent())))return[3,2];return z(n),[3,4];case 2:return[4,(0,F.y0)()];case 3:b(t.sent()),y(),l.Am.success("All slices and types have been pushed"),t.label=4;case 4:return[3,6];case 5:return s=t.sent(),console.error("Something went wrong when manually pushing your changes",s),l.Am.error("Something went wrong when pushing your changes. Check your terminal logs."),[3,6];case 6:return S(!1),[2]}})}),function(n){return e.apply(this,arguments)}),I=(0,c.useMemo)(function(){return g?j===A.t.UNAUTHORIZED||j===A.t.FORBIDDEN?(0,r.jsx)(B,{authStatus:j}):0===Z?(0,r.jsx)(J,{}):(0,r.jsx)(N,{unSyncedSlices:t,unSyncedCustomTypes:a,modelsStatuses:p,authStatus:j,isOnline:g}):(0,r.jsx)(E,{})},[g,j,Z,t,a,p,]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d(),{children:(0,r.jsx)("title",{children:"Changes - Slice Machine"})}),(0,r.jsxs)(m.LN,{children:[(0,r.jsxs)(m.wd,{children:[(0,r.jsx)(m.Cx,{folder:"Changes"}),(0,r.jsx)(m.K2,{children:(0,r.jsx)(o.zx,{onClick:function(){O(!1)},loading:C,disabled:0===Z||!g||j===A.t.UNAUTHORIZED||j===A.t.FORBIDDEN||C,"data-cy":"push-changes",children:"Push Changes"})})]}),(0,r.jsx)(m.RN,{children:(0,r.jsxs)(u.xR,{sx:{display:"flex",flexDirection:"column"},children:[I,(0,r.jsx)(er,{pushChanges:function(e){O(e)},modalData:w,onClose:function(){return z(void 0)}}),(0,r.jsx)(eo,{pushChanges:function(e){O(e)},modalData:w,onClose:function(){return z(void 0)}})]})})]})]})}},2754:function(e,n,t){"use strict";t.d(n,{R$:function(){return d},Qj:function(){return f},T9:function(){return x},nf:function(){return m},u2:function(){return u},_T:function(){return h}});var s=t(67557),i=t(62230),r=t(85244),o=t(98240),c=t(52322),l=t(6277),a=t(22715);t(69143);var d=function(e){var n=e.backgroundImage,t=e.style,a=(0,o.Z)(e,["backgroundImage","style"]),d=void 0!==n;return(0,c.jsx)("article",(0,r.Z)((0,i.Z)({},a),{className:(0,l.Z)("_18bjhbz0 _1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97dfiv _1ecs97dfix _1ecs97dfiz _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dezp",(0,s.Z)({},"_18bjhbz1 _1ecs97dezx _1ecs97df4v",d)),style:(0,i.Z)({backgroundImage:d?"url(".concat(n,")"):void 0},t)}))},u=function(e){return(0,c.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97d6r8 _1ecs97d6yl _1ecs97df29 _1ecs97df2l _1ecs97dezp"}))},x=function(e){return(0,c.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz3 _1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97dffv"}))},h=function(e){return(0,c.jsx)(a.xv,(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz4"}))},m=function(e){return(0,c.jsx)(a.xv,(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz5",color:"grey11"}))},f=function(e){return(0,c.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz6 _1ecs97dez0 _1ecs97dez8 _1ecs97dez1 _1ecs97dez2 _1ecs97df95 _1ecs97dfdl",color:"grey"}))}},69143:function(){},25977:function(){}},function(e){e.O(0,[898,789,123,543,918,25,286,774,888,179],function(){return e(e.s=21985)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[274],{41535:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/labs",function(){return r(8951)}])},8951:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return j}});var t=r(52322),i=r(2784),s=r(22715),c=r(97729),a=r.n(c),l=r(22840),o=r(22710),u=r(17064),d=r(99267),h=r(90374),f=r(40432),x=function(e){var n=e.title,r=e.enabled,i=e.onToggle,c=e.children;return(0,t.jsx)(s.Zb,{variant:"outlined",children:(0,t.jsxs)(s.xu,{gap:8,padding:16,children:[(0,t.jsx)(s.xu,{padding:{top:6},children:(0,t.jsx)(s.I5,{name:"viewDay",size:"medium",color:"grey11"})}),(0,t.jsxs)(s.xu,{flexDirection:"column",flexGrow:1,children:[(0,t.jsx)(s.xv,{variant:"h3",children:n}),(0,t.jsx)(s.xv,{variant:"normal",children:c})]}),(0,t.jsx)(s.xu,{width:128,justifyContent:"end",children:(0,t.jsx)(s.rs,{size:"medium",checked:r,onCheckedChange:function(e){return i(e)}})})]})})},g=r(63269),b=function(){var e,n,r,i,c,a,l,b=(0,u.Z)((e="legacySliceUpgrader",n="Legacy Slice Upgrader",i=(0,h.Z)().openToaster,c=(0,u.Z)((0,g.E)(e),2),a=c[0],l=c[1],[a,(r=(0,o.Z)(function(e){var r;return(0,d.__generator)(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,l(e)];case 1:return t.sent(),i(e?"Labs: enabled ".concat(n):"Labs: disabled ".concat(n),f.Jf.SUCCESS),[3,3];case 2:return r=t.sent(),console.error(r),i(e?"Labs: failed to enable ".concat(n):"Labs: failed to disable ".concat(n),f.Jf.ERROR),[3,3];case 3:return[2]}})}),function(e){return r.apply(this,arguments)})]),2),j=b[0],p=b[1];return(0,t.jsxs)(s.xu,{flexDirection:"column",gap:32,children:[(0,t.jsx)("header",{children:(0,t.jsx)(s.xv,{variant:"normal",children:"Slice Machine Labs gives you early access to new features before they're widely released. Experimental features are works-in-progress and potentially unstable, so you may find some bugs and breaking changes along the way."})}),(0,t.jsx)(s.xu,{flexDirection:"column",gap:16,children:(0,t.jsxs)(x,{title:"Legacy Slice Upgrader",enabled:j.enabled,onToggle:function(e){p(e)},children:["The Legacy Slice Upgrader allows you to convert old slices (legacy and composite slices) to slices managed by Slice Machine (shared slices). This feature is experimental, and we strongly recommend that you test it with a"," ",(0,t.jsx)("a",{href:"https://prismic.io/docs/environments",target:"_blank",children:"Prismic environment"})," ","or you'll be at risk of losing past content."]})})]})},j=function(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a(),{children:(0,t.jsx)("title",{children:"Labs - Slice Machine"})}),(0,t.jsx)(s.SV,{renderError:function(){return(0,t.jsx)(p,{children:(0,t.jsx)(s.xu,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)(s.Iq,{title:"Request failed",description:"An error occurred while fetching your labs configuration."})})})},children:(0,t.jsx)(i.Suspense,{fallback:(0,t.jsx)(p,{withHeader:!0,children:(0,t.jsx)(s._3,{})}),children:(0,t.jsx)(p,{withHeader:!0,children:(0,t.jsx)(b,{})})})})]})},p=function(e){var n=e.children,r=e.withHeader;return(0,t.jsxs)(l.LN,{children:[void 0!==r&&r?(0,t.jsx)(l.wd,{children:(0,t.jsx)(l.Cx,{folder:"Labs"})}):null,(0,t.jsx)(l.RN,{children:n})]})}},63269:function(e,n,r){"use strict";r.d(n,{E:function(){return o}});var t=r(22710),i=r(62230),s=r(85244),c=r(17064),a=r(99267),l=r(19334);function o(e){var n,r,o,u=(0,c.Z)((0,l.f)(),2),d=u[0],h=u[1],f=(o=(0,t.Z)(function(n){var r;return(0,a.__generator)(this,function(t){switch(t.label){case 0:return r=(0,s.Z)((0,i.Z)({},d),{labs:(0,i.Z)({},d.labs)}),n?r.labs[e]=n:e in r.labs&&delete r.labs[e],0===Object.keys(r.labs).length&&delete r.labs,[4,h(r)];case 1:return t.sent(),[2]}})}),function(e){return o.apply(this,arguments)});return[{enabled:null!==(r=null==d?void 0:null===(n=d.labs)||void 0===n?void 0:n[e])&&void 0!==r&&r},f]}},19334:function(e,n,r){"use strict";r.d(n,{f:function(){return a}});var t=r(22710),i=r(99267),s=r(17329),c=r(81038);function a(){var e,n=(0,s.QT)(l,[]),r=(e=(0,t.Z)(function(e){return(0,i.__generator)(this,function(n){switch(n.label){case 0:return[4,c.j.project.writeSliceMachineConfig({config:e})];case 1:return n.sent(),(0,s.VA)(l,[],e),[2]}})}),function(n){return e.apply(this,arguments)});return[n,r]}function l(){return o.apply(this,arguments)}function o(){return(o=(0,t.Z)(function(){return(0,i.__generator)(this,function(e){return[2,c.j.project.getSliceMachineConfig()]})})).apply(this,arguments)}}},function(e){e.O(0,[774,888,179],function(){return e(e.s=41535)}),_N_E=e.O()}]);
@@ -1,14 +0,0 @@
1
- import { useRequest } from "@prismicio/editor-support/Suspense";
2
-
3
- import { managerClient } from "@src/managerClient";
4
-
5
- type User = { isLoggedIn: boolean };
6
-
7
- export function useUser(): User {
8
- return useRequest(getUser, []);
9
- }
10
-
11
- async function getUser(): Promise<User> {
12
- const isLoggedIn = await managerClient.user.checkIsLoggedIn();
13
- return { isLoggedIn };
14
- }