slice-machine-ui 2.8.1-beta.1 → 2.8.1
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/chunks/150-e3d2b02540447045.js +1 -0
- package/out/_next/static/chunks/{183-1298bf7953a6f2a0.js → 183-b1a9f55f45cb8d8e.js} +1 -1
- package/out/_next/static/chunks/{18539003-9b393c900c89e552.js → 18539003-c65c99f4e1d8f6a8.js} +3 -3
- package/out/_next/static/chunks/{372-cfee53700e416e09.js → 372-295e09136ef6fd8c.js} +1 -1
- package/out/_next/static/chunks/{441-76bd8e7cf8cc22da.js → 441-29739f872f8d0039.js} +6 -6
- package/out/_next/static/chunks/{627-092c9e4c99442c08.js → 479-6205c85aa978fc0b.js} +2 -2
- package/out/_next/static/chunks/50-586dc7ab5e584e76.js +1 -0
- package/out/_next/static/chunks/764-e040bcebe6027fea.js +1 -0
- package/out/_next/static/chunks/{772-db5f72095641ec1d.js → 772-58d0c8f8ae1c6791.js} +1 -1
- package/out/_next/static/chunks/{882-32959ffa63fa455c.js → 882-0286cc56ae67376e.js} +1 -1
- package/out/_next/static/chunks/{591-a272f15a4bf9830a.js → 918-38ab72e6ee071fec.js} +2 -2
- package/out/_next/static/chunks/pages/{_app-be6b83d484e3ae6f.js → _app-23712efc496c1618.js} +157 -157
- package/out/_next/static/chunks/pages/{changelog-86f30b15d852e710.js → changelog-f9055af0d38a0c24.js} +1 -1
- package/out/_next/static/chunks/pages/{changes-6c05ef623617785e.js → changes-5f02b3fe08918de1.js} +1 -1
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-fd2416081ef2ffca.js → [customTypeId]-2eb64c9ea82fcd0a.js} +1 -1
- package/out/_next/static/chunks/pages/{custom-types-5de2dd7b9b93236e.js → custom-types-ddc20cfdd8049c04.js} +1 -1
- package/out/_next/static/chunks/pages/{index-2d7f95201a656c12.js → index-17f953c11b46cb20.js} +1 -1
- package/out/_next/static/chunks/pages/{labs-81cf5c5f09fa0bda.js → labs-867606e5aff179cd.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-59e143620505f73f.js → [pageTypeId]-e5a5e6b345081e0a.js} +1 -1
- package/out/_next/static/chunks/pages/settings-80b9910a0643abb5.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-908e779f6d24760d.js → simulator-783b6577bd4e3728.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-0b6162eb591ee324.js → [variation]-743fc5c3feab52f8.js} +1 -1
- package/out/_next/static/chunks/pages/{slices-317ec2bd3451566e.js → slices-0f6e50acfb5957ed.js} +1 -1
- package/out/_next/static/css/{4840a6c8541a6625.css → aeaa4dcbac2fb8d0.css} +1 -1
- package/out/_next/static/css/cc25c43805d5a292.css +1 -0
- package/out/_next/static/oV23UDOb3NVyGcNysJee4/_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 +5 -6
- package/src/features/settings/git/GitRepositoryConnectDialog.tsx +2 -0
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +111 -114
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +134 -140
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceMergeWithIdenticalDialog.tsx +75 -72
- package/src/legacy/components/Forms/RenameVariationModal/RenameVariationModal.tsx +91 -71
- package/src/legacy/components/Forms/formsValidator.ts +1 -1
- package/src/theme.ts +0 -4
- package/out/_next/static/3qbqGvjPz_LCGtwI1SVmH/_buildManifest.js +0 -1
- package/out/_next/static/chunks/150-96a0c443c430ec4b.js +0 -1
- package/out/_next/static/chunks/588-d017e0fe2a651a87.js +0 -1
- package/out/_next/static/chunks/750-aa35f21031ee1f96.js +0 -1
- package/out/_next/static/chunks/pages/settings-80e0d6f1c79282d3.js +0 -1
- package/out/_next/static/css/e5c7f63f02ff4d0f.css +0 -1
- package/src/legacy/components/Forms/RenameVariationModal/RenameVariationModal.module.css +0 -5
- package/src/legacy/components/Forms/RenameVariationModal/RenameVariationModal.module.css.d.ts +0 -5
- /package/out/_next/static/{3qbqGvjPz_LCGtwI1SVmH → oV23UDOb3NVyGcNysJee4}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[372],{28574:function(e,t,n){"use strict";n.d(t,{R$:function(){return s},Qj:function(){return f},T9:function(){return u},nf:function(){return m},u2:function(){return c},_T:function(){return d}});var r=n(52322),o=n(38392),i=n(6277),l=n(43217),a=n.n(l);let s=e=>{let{backgroundImage:t,style:n,...o}=e,l=void 0!==t;return(0,r.jsx)("article",{...o,className:(0,i.W)(a().root,{[a().withBackground]:l}),style:{backgroundImage:l?"url(".concat(t,")"):void 0,...n}})},c=e=>(0,r.jsx)("div",{...e,className:a().image}),u=e=>(0,r.jsx)("div",{...e,className:a().content}),d=e=>(0,r.jsx)(o.xv,{...e,variant:"h3"}),m=e=>(0,r.jsx)(o.xv,{...e,color:"grey11"}),f=e=>(0,r.jsx)("div",{...e,className:a().actions,color:"grey"})},93216:function(e,t,n){"use strict";n.d(t,{AK:function(){return v},E3:function(){return m},EN:function(){return f},F$:function(){return y},H8:function(){return S},HO:function(){return h},L4:function(){return g},N3:function(){return c},Tr:function(){return d},Ue:function(){return I},eK:function(){return k},gR:function(){return b},j5:function(){return s},mf:function(){return p},vB:function(){return x},xS:function(){return j},y6:function(){return i}});var r=n(98863),o=n(88866);function i(e){var t;return null!==(t=e.format)&&void 0!==t?t:"custom"}function l(e){return Object.entries(e.json)}function a(e){return l(e).find(e=>{let[t,n]=e;return Object.values(n).some(e=>"UID"===e.type)})}function s(e){var t;let[n,r]=null!==(t=a(e))&&void 0!==t?t:[];return Object.entries(null!=r?r:{}).find(e=>{let[t,n]=e;return"UID"===n.type})}function c(e){var t,n;return null!==(n=null==e?void 0:null===(t=e.config)||void 0===t?void 0:t.label)&&void 0!==n?n:void 0}function u(e,t){let n=e.json[t];if(void 0!==n)return Object.entries(n).find(e=>{let[t,n]=e;return n.type===o.SlicesFieldType})}function d(e,t){if(function(e,t){var n;let r=u(e,t),[o,i]=null!=r?r:[];return null!==(n=null==i?void 0:i.config)&&void 0!==n?n:void 0}(e,t))return e;let n=function(e,t){let n;let r=l(e),i=r.findIndex(e=>{let[n]=e;return n===t}),a=r.flatMap(e=>{let[t,n]=e;return Object.keys(n).filter(e=>n[e].type===o.SlicesFieldType)}),s=i;do n="slices".concat(0!==s?s.toString():""),s++;while(a.includes(n));return n}(e,t);return{...e,json:{...e.json,[t]:{...e.json[t],[n]:{type:o.SlicesFieldType,fieldset:"Slice Zone"}}}}}function m(e,t){let n=e.json[t];if(void 0===n)return e;let i=Object.keys(n).find(e=>n[e].type===o.SlicesFieldType);if(void 0===i)return e;let l=(0,r.ud)(n,i);return{...e,json:{...e.json,[t]:l}}}function f(e){var t,n;let{customType:i,sectionId:l,sliceId:a}=e,s=i.json[l];if(void 0===s)return i;let c=Object.keys(s).find(e=>s[e].type===o.SlicesFieldType);if(void 0===c)return i;let u=s[c];if(u.type!==o.SlicesFieldType)return i;let d=(0,r.ud)(null!==(n=null===(t=u.config)||void 0===t?void 0:t.choices)&&void 0!==n?n:{},a);return{...i,json:{...i.json,[l]:{...s,[c]:{...u,config:{...u.config,choices:d}}}}}}function p(e){let t={...e,format:"page"},n=l(e)[0];if(n){let[e]=n;t=d(t,e)}return t}function x(e,t){return{...e,json:{...e.json,[t]:{}}}}function y(e,t){let n=(0,r.ud)(e.json,t);return{...e,json:n}}function h(e,t,n){if(t===n)return e;let r=Object.keys(e.json).reduce((r,o)=>(o===t?r[n]=e.json[o]:r[o]=e.json[o],r),{});return{...e,json:r}}function j(e){let{customType:t,sectionId:n,newField:r,newFieldId:i}=e,l=t.json[n],a=u(t,n),s={...Object.fromEntries(Object.entries(l).filter(e=>{let[t,n]=e;return n.type!==o.SlicesFieldType})),[i]:r};if(void 0!==a){let[e,t]=a;s[e]=t}return _({customType:t,sectionId:n,updatedSection:s})}function v(e){let{customType:t,sectionId:n,fieldId:o}=e,i=(0,r.ud)(t.json[n],o);return _({customType:t,sectionId:n,updatedSection:i})}function g(e){let{customType:t,sectionId:n,previousFieldId:r,newFieldId:o,newField:i}=e,l=C({fields:t.json[n],previousFieldId:r,newFieldId:o,newField:i});return _({customType:t,sectionId:n,updatedSection:l})}function b(e){let{customType:t,sectionId:n,sourceIndex:r,destinationIndex:i}=e,l=t.json[n],a=u(t,n),s=function(e){let{fields:t,sourceIndex:n,destinationIndex:r}=e,o=Object.entries(t),[i]=o.splice(n,1);return o.splice(r,0,i),Object.fromEntries(o)}({fields:Object.fromEntries(Object.entries(l).filter(e=>{let[t,n]=e;return n.type!==o.SlicesFieldType})),sourceIndex:r,destinationIndex:i});if(void 0!==a){let[e,t]=a;s[e]=t}return _({customType:t,sectionId:n,updatedSection:s})}function S(e,t){let n=l(t)[0],[r]=null!=n?n:[];return void 0===r?t:j({customType:t,sectionId:r,newField:{type:"UID",config:{label:e}},newFieldId:"uid"})}function k(e,t){var n,r;let[o]=null!==(n=a(t))&&void 0!==n?n:[],[i,l]=null!==(r=s(t))&&void 0!==r?r:[];if(!l||void 0===i||void 0===o)return t;let c=C({fields:t.json[o],previousFieldId:i,newFieldId:i,newField:{...l,config:{...l.config,label:e}}});return _({customType:t,sectionId:o,updatedSection:c})}function _(e){let{customType:t,sectionId:n,updatedSection:r}=e;return{...t,json:{...t.json,[n]:r}}}function C(e){let{fields:t,previousFieldId:n,newFieldId:r,newField:o}=e;return Object.entries(t).reduce((e,t)=>{let[i,l]=t;return i===n?e[r]=o:i!==r&&(e[i]=l),e},{})}function I(e){let{id:t,label:n,repeatable:r,format:o}=e,i=!1===r&&"page"===o?{...T,...B}:!1===r?w:"page"===o?{...F,...B}:O;return{format:o,id:t,json:i,label:n,repeatable:r,status:!0}}let w={Main:{}},T={Main:{slices:{config:{choices:{}},fieldset:"Slice Zone",type:"Slices"}}},O={Main:{uid:{type:"UID",config:{label:"UID"}}}},F={Main:{...O.Main,...T.Main}},B={"SEO & Metadata":{meta_title:{config:{label:"Meta Title",placeholder:"A title of the page used for social media and search engines"},type:"Text"},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"}}}},64910:function(e,t,n){"use strict";n.d(t,{_:function(){return F}});var r=n(52322),o=n(38392),i=n(5632),l=n(2784),a=n(65186),s=n(59326),c=n(75289),u=n(88932),d=n(70647),m=n(77507);async function f(e){let{customType:t,onSuccess:n}=e,r=m.$[t.format];try{let{errors:e}=await d.j.customTypes.deleteCustomType({id:t.id});if(e.length>0)throw e;n(),u.Am.success("".concat(r.name({start:!0,plural:!1})," deleted"))}catch(t){let e="Internal Error: ".concat(r.name({start:!0,plural:!1})," could not be deleted");console.error(e,t),u.Am.error(e)}}var p=n(47861),x=n(76805),y=n(11104),h=n(41067);let j=e=>{let{customType:t,format:n,onClose:o,onDeleteCustomTypeSuccess:i}=e,u=m.$[n],[d,j]=(0,l.useState)(!1),{deleteCustomTypeSuccess:v}=(0,h.Z)(),g=async()=>{j(!0),await f({customType:t,onSuccess:()=>v(t.id)}),i()},{theme:b}=(0,s.B7)();return(0,r.jsx)(y.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:()=>o(),children:(0,r.jsx)(x.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none",overflow:"hidden"},borderFooter:!0,Header:()=>{var e;return(0,r.jsxs)(c.kC,{sx:{position:"sticky",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,r.jsxs)(c.kC,{sx:{alignItems:"center"},children:[(0,r.jsx)(a.$vK,{size:20,color:null===(e=b.colors)||void 0===e?void 0:e.greyIcon}),(0,r.jsxs)(c.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:["Delete"," ",u.name({start:!1,plural:!1})]})]}),(0,r.jsx)(c.x8,{type:"button",onClick:()=>o()})]})},Footer:()=>(0,r.jsxs)(c.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,r.jsx)(p.z,{label:"Cancel",variant:"secondary",onClick:()=>o(),sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),void 0!==t&&(0,r.jsx)(p.z,{label:"Delete",variant:"danger",isLoading:d,onClick:()=>void g(),sx:{minHeight:39,minWidth:78}})]}),children:(0,r.jsxs)("div",{children:["This action will immediately make the following change:",(0,r.jsx)("ul",{children:(0,r.jsxs)("li",{children:["Delete the"," ",(0,r.jsxs)(c.xv,{sx:{fontWeight:"bold"},children:["customtypes/",null==t?void 0:t.id,"/"]})," ","directory."]})}),"The next time you push your changes to Prismic, the following change will happen:",(0,r.jsx)("ul",{children:(0,r.jsxs)("li",{children:["Remove the"," ",u.name({start:!1,plural:!1})," and any associated Documents from your repository."]})})]})})})};var v=n(56580);async function g(e){let{model:t,newLabel:n,onSuccess:r}=e,o=m.$[t.format];try{let e={...t,label:n},{errors:i}=await d.j.customTypes.renameCustomType({model:e});if(i.length>0)throw i;r(e),u.Am.success("".concat(o.name({start:!0,plural:!1})," renamed"))}catch(t){let e="Internal Error: ".concat(o.name({start:!0,plural:!1})," could not be renamed");console.error(e,t),u.Am.error(e)}}var b=n(80546),S=n(40572),k=n(1490),_=n(28801);let C=e=>{var t,n;let{isChangesLocal:o,customType:i,format:a,onClose:s,setLocalCustomType:u}=e,d=null!==(t=null==i?void 0:i.label)&&void 0!==t?t:"",f=null!==(n=null==i?void 0:i.id)&&void 0!==n?n:"",{renameCustomTypeSuccess:p}=(0,h.Z)(),{syncChanges:x}=(0,b.g)(),[y,j]=(0,l.useState)(!1),C=async e=>{j(!0),o&&u?u({...i,label:e.customTypeName}):await g({model:i,newLabel:e.customTypeName,onSuccess:e=>{p(e),x()}}),j(!1),s()},{customTypeLabels:I}=(0,v.v9)(e=>({customTypeLabels:(0,S.YS)(e)})),w=m.$[a];return(0,r.jsx)(k.Z,{isOpen:!0,testId:"rename-custom-type-modal",widthInPx:"530px",formId:"rename-custom-type-modal-".concat(f),buttonLabel:"Rename",close:s,onSubmit:e=>void C(e),initialValues:{customTypeName:d},isLoading:y,content:{title:"Rename a ".concat(w.name({start:!1,plural:!1}))},validate:e=>{let{customTypeName:t}=e,n={};return t&&t.length||(n.customTypeName="Cannot be empty."),void 0!=n.customTypeName&&I.includes(t)&&d!==t&&(n.customTypeName="".concat(w.name({start:!0,plural:!1})," name is already taken.")),Object.keys(n).length>0?n:void 0},children:e=>{let{errors:t}=e;return(0,r.jsx)(c.xu,{children:(0,r.jsx)(_.W,{name:"customTypeName",label:"".concat(w.name({start:!0,plural:!1})," Name"),placeholder:"A display name for the ".concat(w.name({start:!1,plural:!1})),error:t.customTypeName,testId:"custom-type-name-input"})})}})};var I=n(93188),w=n(93216);async function T(e,t){let n=m.$[e.format];try{let r=(0,w.mf)(e),{errors:o}=await (0,I.KA)(r);if(o.length>0)throw o;t(r),u.Am.success("".concat(n.name({start:!0,plural:!1})," converted to page type"))}catch(t){let e="Internal Error: ".concat(n.name({start:!0,plural:!1})," not converted to page type");console.error(e,t),u.Am.error(e)}}var O=n(63447);let F=e=>{let{format:t,customType:n,isChangesLocal:a,setLocalCustomType:s}=e,c=(0,i.useRouter)(),{saveCustomTypeSuccess:u}=(0,h.Z)(),[d,m]=(0,l.useState)(!1),[f,p]=(0,l.useState)(!1),[x,y]=(0,l.useState)(!1),v=async()=>{y(!0),await T(n,u);let e=O.cd.custom.getBuilderPagePathname(n.id);if(c.asPath===e){let e=O.cd.page.getBuilderPagePathname(n.id);c.replace(e),y(!1)}else y(!1)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.h_,{modal:!0,children:[(0,r.jsx)(o.$F,{disabled:x,children:(0,r.jsx)(o.hU,{color:"grey","data-testid":"editDropdown",hiddenLabel:"Custom type actions",icon:"moreVert",loading:x,variant:"solid"})}),(0,r.jsxs)(o.AW,{align:"end",children:[(0,r.jsx)(o.Xi,{startIcon:(0,r.jsx)(o.I5,{name:"edit"}),onSelect:()=>{p(!0)},children:"Rename"}),"custom"===t&&!a&&(0,r.jsx)(o.Xi,{startIcon:(0,r.jsx)(o.I5,{name:"driveFileMove"}),onSelect:()=>void v(),children:"Convert to page type"}),(0,r.jsx)(o.Xi,{color:"tomato",startIcon:(0,r.jsx)(o.I5,{name:"delete"}),onSelect:()=>{m(!0)},children:"Remove"})]})]}),d?(0,r.jsx)(j,{format:t,customType:n,onClose:()=>m(!1),onDeleteCustomTypeSuccess:()=>{var e;let{tablePagePathname:t}=O.cd[null!==(e=n.format)&&void 0!==e?e:"custom"];c.asPath!==t?c.replace(t):m(!1)}}):null,f?(0,r.jsx)(C,{format:t,customType:n,isChangesLocal:a,onClose:()=>p(!1),setLocalCustomType:s}):null]})}},47861:function(e,t,n){"use strict";n.d(t,{z:function(){return s}});var r=n(52322),o=n(2784),i=n(75289);let l=(e,t)=>e?"".concat(e,"-").concat(t):"",a=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},s=(0,o.forwardRef)((e,t)=>{let{label:n,Icon:o,type:s,form:c,isLoading:u=!1,disabled:d=!1,onClick:m,sx:f={},iconSize:p=16,iconFill:x,variant:y="primary",...h}=e;return(0,r.jsx)(i.zx,{ref:t,sx:{...f,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...u?{cursor:"wait !important"}:{}},type:s,form:c,disabled:d||u,onClick:u?void 0:m,variant:y,...h,children:u?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.$j,{size:p,color:a(y),"data-testid":l(h["data-testid"],"spinner")}),o&&n]}):(0,r.jsxs)(r.Fragment,{children:[o&&(0,r.jsx)(o,{size:p,fill:x,"data-testid":l(h["data-testid"],"icon")}),n]})})})},28801:function(e,t,n){"use strict";n.d(t,{W:function(){return l}});var r=n(52322),o=n(63397);n(2784);var i=n(75289);let l=e=>{let{name:t,label:n,placeholder:l,error:a,testId:s,onChange:c}=e;return(0,r.jsxs)(i.xu,{mb:3,children:[(0,r.jsx)(i.__,{htmlFor:t,mb:2,children:n}),(0,r.jsx)(o.gN,{name:t,type:"text",placeholder:l,as:i.II,autoComplete:"off",...c?{onChange:c}:null,...s?{"data-testid":s}:null}),a?(0,r.jsx)(i.xv,{"data-testid":s?"".concat(s,"-error"):"input-error",sx:{color:"error",mt:1},children:a}):null]})}},1490:function(e,t,n){"use strict";var r=n(52322),o=n(63397),i=n(37149),l=n.n(i),a=n(75289),s=n(47861),c=n(11104),u=n(76805);t.Z=function(e){let{children:t,close:n,isOpen:i,formId:d,validate:m,onSubmit:f,widthInPx:p,initialValues:x,content:{title:y},cardProps:h,omitFooter:j=!1,isLoading:v=!1,buttonLabel:g="Save",testId:b,actionMessage:S}=e;return l().setAppElement("#__next"),(0,r.jsx)(c.Z,{isOpen:i,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:y,style:{content:{width:null!=p?p:"900px"}},children:(0,r.jsx)(o.J9,{initialValues:x,validate:e=>m?m(e):void 0,onSubmit:e=>{f(e)},children:e=>{let{isValid:i,isSubmitting:l,values:c,errors:m,touched:f,setFieldValue:p,setValues:x}=e;return(0,r.jsx)(o.l0,{id:d,...null!=b?{"data-testid":b}:null,children:(0,r.jsx)(u.Z,{borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"},...h,Header:e=>{let{radius:t}=e;return(0,r.jsxs)(a.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:t,borderTopRightRadius:t,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:[(0,r.jsx)(a.X6,{sx:{fontSize:"20px"},children:y}),(0,r.jsx)(a.x8,{type:"button",onClick:n})]})},Footer:j?null:(0,r.jsxs)(a.kC,{sx:{alignItems:"space-between"},children:[(0,r.jsx)(a.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof S?S(e):S}),(0,r.jsxs)(a.kC,{sx:{ml:"auto"},children:[(0,r.jsx)(a.zx,{mr:2,type:"button",onClick:n,variant:"secondary",disabled:l||v,children:"Cancel"}),(0,r.jsx)(s.z,{label:g,form:d,type:"submit",disabled:!i||l||v,isLoading:l||v,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:t({isValid:i,isSubmitting:l,values:c,errors:m,touched:f,setFieldValue:p,setValues:x})})})}})})}},43217:function(e){e.exports={column:"BlankSlate_column__genEe",root:"BlankSlate_root__CmSqW BlankSlate_column__genEe",fadeIn:"BlankSlate_fadeIn__mAfi5",withBackground:"BlankSlate_withBackground__mLYij",image:"BlankSlate_image__Jn90S BlankSlate_column__genEe",content:"BlankSlate_content__0Yt2d BlankSlate_column__genEe",desc:"BlankSlate_desc___Dl7e",actions:"BlankSlate_actions__OYRj4"}}}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[372],{28574:function(e,t,n){"use strict";n.d(t,{R$:function(){return s},Qj:function(){return f},T9:function(){return u},nf:function(){return m},u2:function(){return c},_T:function(){return d}});var r=n(52322),o=n(33760),i=n(6277),l=n(43217),a=n.n(l);let s=e=>{let{backgroundImage:t,style:n,...o}=e,l=void 0!==t;return(0,r.jsx)("article",{...o,className:(0,i.W)(a().root,{[a().withBackground]:l}),style:{backgroundImage:l?"url(".concat(t,")"):void 0,...n}})},c=e=>(0,r.jsx)("div",{...e,className:a().image}),u=e=>(0,r.jsx)("div",{...e,className:a().content}),d=e=>(0,r.jsx)(o.xv,{...e,variant:"h3"}),m=e=>(0,r.jsx)(o.xv,{...e,color:"grey11"}),f=e=>(0,r.jsx)("div",{...e,className:a().actions,color:"grey"})},93216:function(e,t,n){"use strict";n.d(t,{AK:function(){return v},E3:function(){return m},EN:function(){return f},F$:function(){return y},H8:function(){return S},HO:function(){return h},L4:function(){return g},N3:function(){return c},Tr:function(){return d},Ue:function(){return I},eK:function(){return k},gR:function(){return b},j5:function(){return s},mf:function(){return p},vB:function(){return x},xS:function(){return j},y6:function(){return i}});var r=n(98863),o=n(88866);function i(e){var t;return null!==(t=e.format)&&void 0!==t?t:"custom"}function l(e){return Object.entries(e.json)}function a(e){return l(e).find(e=>{let[t,n]=e;return Object.values(n).some(e=>"UID"===e.type)})}function s(e){var t;let[n,r]=null!==(t=a(e))&&void 0!==t?t:[];return Object.entries(null!=r?r:{}).find(e=>{let[t,n]=e;return"UID"===n.type})}function c(e){var t,n;return null!==(n=null==e?void 0:null===(t=e.config)||void 0===t?void 0:t.label)&&void 0!==n?n:void 0}function u(e,t){let n=e.json[t];if(void 0!==n)return Object.entries(n).find(e=>{let[t,n]=e;return n.type===o.SlicesFieldType})}function d(e,t){if(function(e,t){var n;let r=u(e,t),[o,i]=null!=r?r:[];return null!==(n=null==i?void 0:i.config)&&void 0!==n?n:void 0}(e,t))return e;let n=function(e,t){let n;let r=l(e),i=r.findIndex(e=>{let[n]=e;return n===t}),a=r.flatMap(e=>{let[t,n]=e;return Object.keys(n).filter(e=>n[e].type===o.SlicesFieldType)}),s=i;do n="slices".concat(0!==s?s.toString():""),s++;while(a.includes(n));return n}(e,t);return{...e,json:{...e.json,[t]:{...e.json[t],[n]:{type:o.SlicesFieldType,fieldset:"Slice Zone"}}}}}function m(e,t){let n=e.json[t];if(void 0===n)return e;let i=Object.keys(n).find(e=>n[e].type===o.SlicesFieldType);if(void 0===i)return e;let l=(0,r.ud)(n,i);return{...e,json:{...e.json,[t]:l}}}function f(e){var t,n;let{customType:i,sectionId:l,sliceId:a}=e,s=i.json[l];if(void 0===s)return i;let c=Object.keys(s).find(e=>s[e].type===o.SlicesFieldType);if(void 0===c)return i;let u=s[c];if(u.type!==o.SlicesFieldType)return i;let d=(0,r.ud)(null!==(n=null===(t=u.config)||void 0===t?void 0:t.choices)&&void 0!==n?n:{},a);return{...i,json:{...i.json,[l]:{...s,[c]:{...u,config:{...u.config,choices:d}}}}}}function p(e){let t={...e,format:"page"},n=l(e)[0];if(n){let[e]=n;t=d(t,e)}return t}function x(e,t){return{...e,json:{...e.json,[t]:{}}}}function y(e,t){let n=(0,r.ud)(e.json,t);return{...e,json:n}}function h(e,t,n){if(t===n)return e;let r=Object.keys(e.json).reduce((r,o)=>(o===t?r[n]=e.json[o]:r[o]=e.json[o],r),{});return{...e,json:r}}function j(e){let{customType:t,sectionId:n,newField:r,newFieldId:i}=e,l=t.json[n],a=u(t,n),s={...Object.fromEntries(Object.entries(l).filter(e=>{let[t,n]=e;return n.type!==o.SlicesFieldType})),[i]:r};if(void 0!==a){let[e,t]=a;s[e]=t}return _({customType:t,sectionId:n,updatedSection:s})}function v(e){let{customType:t,sectionId:n,fieldId:o}=e,i=(0,r.ud)(t.json[n],o);return _({customType:t,sectionId:n,updatedSection:i})}function g(e){let{customType:t,sectionId:n,previousFieldId:r,newFieldId:o,newField:i}=e,l=C({fields:t.json[n],previousFieldId:r,newFieldId:o,newField:i});return _({customType:t,sectionId:n,updatedSection:l})}function b(e){let{customType:t,sectionId:n,sourceIndex:r,destinationIndex:i}=e,l=t.json[n],a=u(t,n),s=function(e){let{fields:t,sourceIndex:n,destinationIndex:r}=e,o=Object.entries(t),[i]=o.splice(n,1);return o.splice(r,0,i),Object.fromEntries(o)}({fields:Object.fromEntries(Object.entries(l).filter(e=>{let[t,n]=e;return n.type!==o.SlicesFieldType})),sourceIndex:r,destinationIndex:i});if(void 0!==a){let[e,t]=a;s[e]=t}return _({customType:t,sectionId:n,updatedSection:s})}function S(e,t){let n=l(t)[0],[r]=null!=n?n:[];return void 0===r?t:j({customType:t,sectionId:r,newField:{type:"UID",config:{label:e}},newFieldId:"uid"})}function k(e,t){var n,r;let[o]=null!==(n=a(t))&&void 0!==n?n:[],[i,l]=null!==(r=s(t))&&void 0!==r?r:[];if(!l||void 0===i||void 0===o)return t;let c=C({fields:t.json[o],previousFieldId:i,newFieldId:i,newField:{...l,config:{...l.config,label:e}}});return _({customType:t,sectionId:o,updatedSection:c})}function _(e){let{customType:t,sectionId:n,updatedSection:r}=e;return{...t,json:{...t.json,[n]:r}}}function C(e){let{fields:t,previousFieldId:n,newFieldId:r,newField:o}=e;return Object.entries(t).reduce((e,t)=>{let[i,l]=t;return i===n?e[r]=o:i!==r&&(e[i]=l),e},{})}function I(e){let{id:t,label:n,repeatable:r,format:o}=e,i=!1===r&&"page"===o?{...T,...B}:!1===r?w:"page"===o?{...F,...B}:O;return{format:o,id:t,json:i,label:n,repeatable:r,status:!0}}let w={Main:{}},T={Main:{slices:{config:{choices:{}},fieldset:"Slice Zone",type:"Slices"}}},O={Main:{uid:{type:"UID",config:{label:"UID"}}}},F={Main:{...O.Main,...T.Main}},B={"SEO & Metadata":{meta_title:{config:{label:"Meta Title",placeholder:"A title of the page used for social media and search engines"},type:"Text"},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"}}}},64910:function(e,t,n){"use strict";n.d(t,{_:function(){return F}});var r=n(52322),o=n(33760),i=n(5632),l=n(2784),a=n(65186),s=n(59326),c=n(75289),u=n(88932),d=n(70647),m=n(77507);async function f(e){let{customType:t,onSuccess:n}=e,r=m.$[t.format];try{let{errors:e}=await d.j.customTypes.deleteCustomType({id:t.id});if(e.length>0)throw e;n(),u.Am.success("".concat(r.name({start:!0,plural:!1})," deleted"))}catch(t){let e="Internal Error: ".concat(r.name({start:!0,plural:!1})," could not be deleted");console.error(e,t),u.Am.error(e)}}var p=n(47861),x=n(76805),y=n(11104),h=n(41067);let j=e=>{let{customType:t,format:n,onClose:o,onDeleteCustomTypeSuccess:i}=e,u=m.$[n],[d,j]=(0,l.useState)(!1),{deleteCustomTypeSuccess:v}=(0,h.Z)(),g=async()=>{j(!0),await f({customType:t,onSuccess:()=>v(t.id)}),i()},{theme:b}=(0,s.B7)();return(0,r.jsx)(y.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:()=>o(),children:(0,r.jsx)(x.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none",overflow:"hidden"},borderFooter:!0,Header:()=>{var e;return(0,r.jsxs)(c.kC,{sx:{position:"sticky",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,r.jsxs)(c.kC,{sx:{alignItems:"center"},children:[(0,r.jsx)(a.$vK,{size:20,color:null===(e=b.colors)||void 0===e?void 0:e.greyIcon}),(0,r.jsxs)(c.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:["Delete"," ",u.name({start:!1,plural:!1})]})]}),(0,r.jsx)(c.x8,{type:"button",onClick:()=>o()})]})},Footer:()=>(0,r.jsxs)(c.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,r.jsx)(p.z,{label:"Cancel",variant:"secondary",onClick:()=>o(),sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),void 0!==t&&(0,r.jsx)(p.z,{label:"Delete",variant:"danger",isLoading:d,onClick:()=>void g(),sx:{minHeight:39,minWidth:78}})]}),children:(0,r.jsxs)("div",{children:["This action will immediately make the following change:",(0,r.jsx)("ul",{children:(0,r.jsxs)("li",{children:["Delete the"," ",(0,r.jsxs)(c.xv,{sx:{fontWeight:"bold"},children:["customtypes/",null==t?void 0:t.id,"/"]})," ","directory."]})}),"The next time you push your changes to Prismic, the following change will happen:",(0,r.jsx)("ul",{children:(0,r.jsxs)("li",{children:["Remove the"," ",u.name({start:!1,plural:!1})," and any associated Documents from your repository."]})})]})})})};var v=n(56580);async function g(e){let{model:t,newLabel:n,onSuccess:r}=e,o=m.$[t.format];try{let e={...t,label:n},{errors:i}=await d.j.customTypes.renameCustomType({model:e});if(i.length>0)throw i;r(e),u.Am.success("".concat(o.name({start:!0,plural:!1})," renamed"))}catch(t){let e="Internal Error: ".concat(o.name({start:!0,plural:!1})," could not be renamed");console.error(e,t),u.Am.error(e)}}var b=n(80546),S=n(40572),k=n(1490),_=n(28801);let C=e=>{var t,n;let{isChangesLocal:o,customType:i,format:a,onClose:s,setLocalCustomType:u}=e,d=null!==(t=null==i?void 0:i.label)&&void 0!==t?t:"",f=null!==(n=null==i?void 0:i.id)&&void 0!==n?n:"",{renameCustomTypeSuccess:p}=(0,h.Z)(),{syncChanges:x}=(0,b.g)(),[y,j]=(0,l.useState)(!1),C=async e=>{j(!0),o&&u?u({...i,label:e.customTypeName}):await g({model:i,newLabel:e.customTypeName,onSuccess:e=>{p(e),x()}}),j(!1),s()},{customTypeLabels:I}=(0,v.v9)(e=>({customTypeLabels:(0,S.YS)(e)})),w=m.$[a];return(0,r.jsx)(k.Z,{isOpen:!0,testId:"rename-custom-type-modal",widthInPx:"530px",formId:"rename-custom-type-modal-".concat(f),buttonLabel:"Rename",close:s,onSubmit:e=>void C(e),initialValues:{customTypeName:d},isLoading:y,content:{title:"Rename a ".concat(w.name({start:!1,plural:!1}))},validate:e=>{let{customTypeName:t}=e,n={};return t&&t.length||(n.customTypeName="Cannot be empty."),void 0!=n.customTypeName&&I.includes(t)&&d!==t&&(n.customTypeName="".concat(w.name({start:!0,plural:!1})," name is already taken.")),Object.keys(n).length>0?n:void 0},children:e=>{let{errors:t}=e;return(0,r.jsx)(c.xu,{children:(0,r.jsx)(_.W,{name:"customTypeName",label:"".concat(w.name({start:!0,plural:!1})," Name"),placeholder:"A display name for the ".concat(w.name({start:!1,plural:!1})),error:t.customTypeName,testId:"custom-type-name-input"})})}})};var I=n(93188),w=n(93216);async function T(e,t){let n=m.$[e.format];try{let r=(0,w.mf)(e),{errors:o}=await (0,I.KA)(r);if(o.length>0)throw o;t(r),u.Am.success("".concat(n.name({start:!0,plural:!1})," converted to page type"))}catch(t){let e="Internal Error: ".concat(n.name({start:!0,plural:!1})," not converted to page type");console.error(e,t),u.Am.error(e)}}var O=n(63447);let F=e=>{let{format:t,customType:n,isChangesLocal:a,setLocalCustomType:s}=e,c=(0,i.useRouter)(),{saveCustomTypeSuccess:u}=(0,h.Z)(),[d,m]=(0,l.useState)(!1),[f,p]=(0,l.useState)(!1),[x,y]=(0,l.useState)(!1),v=async()=>{y(!0),await T(n,u);let e=O.cd.custom.getBuilderPagePathname(n.id);if(c.asPath===e){let e=O.cd.page.getBuilderPagePathname(n.id);c.replace(e),y(!1)}else y(!1)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.h_,{modal:!0,children:[(0,r.jsx)(o.$F,{disabled:x,children:(0,r.jsx)(o.hU,{color:"grey","data-testid":"editDropdown",hiddenLabel:"Custom type actions",icon:"moreVert",loading:x,variant:"solid"})}),(0,r.jsxs)(o.AW,{align:"end",children:[(0,r.jsx)(o.Xi,{startIcon:(0,r.jsx)(o.I5,{name:"edit"}),onSelect:()=>{p(!0)},children:"Rename"}),"custom"===t&&!a&&(0,r.jsx)(o.Xi,{startIcon:(0,r.jsx)(o.I5,{name:"driveFileMove"}),onSelect:()=>void v(),children:"Convert to page type"}),(0,r.jsx)(o.Xi,{color:"tomato",startIcon:(0,r.jsx)(o.I5,{name:"delete"}),onSelect:()=>{m(!0)},children:"Remove"})]})]}),d?(0,r.jsx)(j,{format:t,customType:n,onClose:()=>m(!1),onDeleteCustomTypeSuccess:()=>{var e;let{tablePagePathname:t}=O.cd[null!==(e=n.format)&&void 0!==e?e:"custom"];c.asPath!==t?c.replace(t):m(!1)}}):null,f?(0,r.jsx)(C,{format:t,customType:n,isChangesLocal:a,onClose:()=>p(!1),setLocalCustomType:s}):null]})}},47861:function(e,t,n){"use strict";n.d(t,{z:function(){return s}});var r=n(52322),o=n(2784),i=n(75289);let l=(e,t)=>e?"".concat(e,"-").concat(t):"",a=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},s=(0,o.forwardRef)((e,t)=>{let{label:n,Icon:o,type:s,form:c,isLoading:u=!1,disabled:d=!1,onClick:m,sx:f={},iconSize:p=16,iconFill:x,variant:y="primary",...h}=e;return(0,r.jsx)(i.zx,{ref:t,sx:{...f,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...u?{cursor:"wait !important"}:{}},type:s,form:c,disabled:d||u,onClick:u?void 0:m,variant:y,...h,children:u?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.$j,{size:p,color:a(y),"data-testid":l(h["data-testid"],"spinner")}),o&&n]}):(0,r.jsxs)(r.Fragment,{children:[o&&(0,r.jsx)(o,{size:p,fill:x,"data-testid":l(h["data-testid"],"icon")}),n]})})})},28801:function(e,t,n){"use strict";n.d(t,{W:function(){return l}});var r=n(52322),o=n(63397);n(2784);var i=n(75289);let l=e=>{let{name:t,label:n,placeholder:l,error:a,testId:s,onChange:c}=e;return(0,r.jsxs)(i.xu,{mb:3,children:[(0,r.jsx)(i.__,{htmlFor:t,mb:2,children:n}),(0,r.jsx)(o.gN,{name:t,type:"text",placeholder:l,as:i.II,autoComplete:"off",...c?{onChange:c}:null,...s?{"data-testid":s}:null}),a?(0,r.jsx)(i.xv,{"data-testid":s?"".concat(s,"-error"):"input-error",sx:{color:"error",mt:1},children:a}):null]})}},1490:function(e,t,n){"use strict";var r=n(52322),o=n(63397),i=n(37149),l=n.n(i),a=n(75289),s=n(47861),c=n(11104),u=n(76805);t.Z=function(e){let{children:t,close:n,isOpen:i,formId:d,validate:m,onSubmit:f,widthInPx:p,initialValues:x,content:{title:y},cardProps:h,omitFooter:j=!1,isLoading:v=!1,buttonLabel:g="Save",testId:b,actionMessage:S}=e;return l().setAppElement("#__next"),(0,r.jsx)(c.Z,{isOpen:i,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:y,style:{content:{width:null!=p?p:"900px"}},children:(0,r.jsx)(o.J9,{initialValues:x,validate:e=>m?m(e):void 0,onSubmit:e=>{f(e)},children:e=>{let{isValid:i,isSubmitting:l,values:c,errors:m,touched:f,setFieldValue:p,setValues:x}=e;return(0,r.jsx)(o.l0,{id:d,...null!=b?{"data-testid":b}:null,children:(0,r.jsx)(u.Z,{borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"},...h,Header:e=>{let{radius:t}=e;return(0,r.jsxs)(a.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:t,borderTopRightRadius:t,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:[(0,r.jsx)(a.X6,{sx:{fontSize:"20px"},children:y}),(0,r.jsx)(a.x8,{type:"button",onClick:n})]})},Footer:j?null:(0,r.jsxs)(a.kC,{sx:{alignItems:"space-between"},children:[(0,r.jsx)(a.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof S?S(e):S}),(0,r.jsxs)(a.kC,{sx:{ml:"auto"},children:[(0,r.jsx)(a.zx,{mr:2,type:"button",onClick:n,variant:"secondary",disabled:l||v,children:"Cancel"}),(0,r.jsx)(s.z,{label:g,form:d,type:"submit",disabled:!i||l||v,isLoading:l||v,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:t({isValid:i,isSubmitting:l,values:c,errors:m,touched:f,setFieldValue:p,setValues:x})})})}})})}},43217:function(e){e.exports={column:"BlankSlate_column__genEe",root:"BlankSlate_root__CmSqW BlankSlate_column__genEe",fadeIn:"BlankSlate_fadeIn__mAfi5",withBackground:"BlankSlate_withBackground__mLYij",image:"BlankSlate_image__Jn90S BlankSlate_column__genEe",content:"BlankSlate_content__0Yt2d BlankSlate_column__genEe",desc:"BlankSlate_desc___Dl7e",actions:"BlankSlate_actions__OYRj4"}}}]);
|