slice-machine-ui 1.23.2-beta.3 → 1.23.2-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx +61 -38
- package/components/Forms/RenameCustomTypeModal/RenameCustomTypeModal.tsx +2 -2
- package/components/Navigation/ChangesListItem.tsx +14 -32
- package/out/404.html +1 -1
- package/out/_next/static/{RRBm5bm2F__Ws0vsvXhN6 → GqPZYfMQrQUPwvgI_rvdq}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/{183-aab7066c73ebde44.js → 183-4feb6bb3eddbc768.js} +1 -1
- package/out/_next/static/chunks/{318-2112803ca34b2f49.js → 318-34a2dea7cfd4661d.js} +1 -1
- package/out/_next/static/chunks/727-c5028806448c4387.js +1 -0
- package/out/_next/static/chunks/731-341869976a48a09a.js +1 -0
- package/out/_next/static/chunks/{904-9a4c1264727ae89a.js → 904-833eed675f19ab60.js} +1 -1
- package/out/_next/static/chunks/pages/{_app-9f3513533bb2dfb8.js → _app-4a63c0e108026c4d.js} +2 -2
- package/out/_next/static/chunks/pages/{changes-2a976f9efeb719aa.js → changes-92c84f6cac0285fd.js} +1 -1
- package/out/_next/static/chunks/pages/index-ca194b18d0e3930d.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-2d3d84de925b289e.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/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/domain/__tests__/customType.test.ts +179 -0
- package/src/domain/customType.ts +110 -2
- package/src/features/customTypes/PageTypeOnboarding.tsx +21 -26
- package/src/features/customTypes/actions/convertCustomToPageType.ts +14 -10
- package/src/features/customTypes/actions/createCustomType.ts +69 -0
- package/src/features/customTypes/actions/deleteCustomType.ts +13 -3
- package/src/features/customTypes/actions/renameCustomType.ts +10 -4
- package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +3 -1
- package/src/features/customTypes/customTypesTable/CustomTypesTable.tsx +8 -8
- package/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +18 -17
- package/src/modules/availableCustomTypes/index.ts +26 -132
- package/src/modules/loading/types.ts +0 -3
- package/src/modules/modal/types.ts +0 -1
- package/src/modules/useSliceMachineActions.ts +72 -78
- package/src/modules/userContext/index.ts +3 -3
- package/src/redux/saga.ts +0 -2
- package/test/src/modules/availableCustomTypes/index.test.ts +4 -156
- package/out/_next/static/chunks/727-3a3bc32518778317.js +0 -1
- package/out/_next/static/chunks/731-501990ebe6a71b32.js +0 -1
- package/out/_next/static/chunks/pages/index-64cfb8b0948ba8ef.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-b2a9d773ce5d7739.js +0 -1
- package/src/features/customTypes/__tests__/createCustomType.test.ts +0 -159
- package/src/features/customTypes/customTypesTable/createCustomType.ts +0 -107
- package/test/components/CreateCustomTypeModal.test.tsx +0 -73
- /package/out/_next/static/{RRBm5bm2F__Ws0vsvXhN6 → GqPZYfMQrQUPwvgI_rvdq}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[727],{54132:function(e,n,r){"use strict";r.d(n,{Z:function(){return o}});var t=r(62230),s=r(85244),i=r(98240),a=r(52322);r(2784);var l=r(75289),c=function(e){var n=e.bg,r=e.background,s=e.sx,i=e.withRadius,c=e.radius,o=e.children;return(0,a.jsx)(l.xu,{sx:(0,t.Z)({p:4,bg:n||r},i?{borderBottomLeftRadius:c,borderBottomRightRadius:c}:null,s),children:o})},o=function(e){var n=e.Header,r=void 0===n?null:n,o=e.SubHeader,d=void 0===o?null:o,u=e.Body,x=void 0===u?null:u,h=e.Footer,f=void 0===h?null:h,p=e.borderFooter,C=e.radius,m=void 0===C?"6px":C,j=e.bodySx,v=e.footerSx,g=e.sx,b=e.bg,_=e.background,y=e.children,T=(0,i.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,a.jsxs)(l.Zb,(0,s.Z)((0,t.Z)({sx:(0,t.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:m},void 0===g?null:g)},T),{children:[r?(0,a.jsx)(r,{radius:m}):null,d?(0,a.jsx)(d,{radius:m}):null,(0,a.jsxs)(c,{bg:b,background:_,sx:void 0===j?{}:j,withRadius:!f,children:[x?(0,a.jsx)(x,{}):null,y||null]}),f?(0,a.jsx)(c,{bg:b,background:_,sx:(0,t.Z)({},void 0!==p&&p?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===v?{}:v),radius:m,withRadius:!0,children:"object"==typeof f?f:(0,a.jsx)(f,{})}):null]}))}},80131:function(e,n,r){"use strict";r.d(n,{M:function(){return L}});var t=r(62230),s=r(85244),i=r(52322),a=r(2784),l=r(75289),c=r(56580),o=r(68780),d=r(70041),u=r(17064),x=r(63397),h=r(78656),f=r(98240),p=function(e){var n=e.selected,r=(0,f.Z)(e,["selected"]);return(0,i.jsx)(l.kC,(0,t.Z)({sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:n?function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}:"none","&:hover":{boxShadow:function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}}}},r))},C=function(e){var n=e.format,r=(0,u.Z)((0,x.U$)("repeatable"),3),t=r[0],s=r[2],a=h.$[n];return(0,i.jsxs)(l.xu,{mb:2,children:[(0,i.jsxs)(p,{selected:t.value,onClick:function(){return s.setValue(!0)},children:[(0,i.jsx)(l.Y8,{checked:t.value,onChange:function(){},"data-cy":"repeatable-type-radio-btn"}),(0,i.jsxs)(l.xu,{sx:{marginLeft:2},children:["Reusable type",(0,i.jsx)(l.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintRepeatable})]})]}),(0,i.jsxs)(p,{selected:!t.value,onClick:function(){return s.setValue(!1)},children:[(0,i.jsx)(l.Y8,{checked:!t.value,onChange:function(){},"data-cy":"single-type-radio-btn"}),(0,i.jsxs)(l.xu,{sx:{marginLeft:2},children:["Single type",(0,i.jsx)(l.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintSingle})]})]})]})},m=r(90374),j=r(49471),v=r(77174),g=r(24340),b=r(32665),_=r(3098),y=r(82770),T=r(38876),S=r(75329),L=function(e){var n=e.format,r=e.origin,u=void 0===r?"table":r,x=(0,m.Z)(),f=x.createCustomType,p=x.closeModals,L=(0,c.v9)(function(e){return{customTypeIds:(0,j.W6)(e),customTypeLabels:(0,j.YS)(e),isCreateCustomTypeModalOpen:(0,v.gP)(e,g.q.CREATE_CUSTOM_TYPE),isCreatingCustomType:(0,b.hg)(e,_.z.CREATE_CUSTOM_TYPE)}}),w=L.customTypeIds,Z=L.isCreateCustomTypeModalOpen,z=L.isCreatingCustomType,k=L.customTypeLabels,H=h.$[n],R=(0,a.useState)(!0),M=R[0],E=R[1],N=function(e){var r=e.id,t=e.label,s=e.repeatable,i=t||r;y.Xe.track({event:"custom-type:created",id:r,name:i,format:n,type:s?"repeatable":"single",origin:u}),f(r,i,s,n),p(),E(!0)},I=function(e,n,r){r(M?(0,s.Z)((0,t.Z)({},n),{label:e.target.value,id:(0,T.lV)(e.target.value)}):(0,s.Z)((0,t.Z)({},n),{label:e.target.value}))},V=function(e,n){n("id",e.target.value),E(!1)};return(0,i.jsx)(o.Z,{dataCy:"create-ct-modal",isOpen:Z,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:function(){p(),E(!0)},onSubmit:N,isLoading:z,initialValues:{repeatable:!0,id:"",label:""},validate:function(e){var n=e.id,r=e.label,t={};return r&&r.length||(t.label="Cannot be empty."),!t.label&&k.includes(r)&&(t.label="".concat(H.name({start:!0,plural:!1})," name is already taken.")),n&&n.length||(t.id="ID cannot be empty."),t.id||!n||S.xo.exec(n)||(t.id="Invalid id: No special characters allowed."),!t.id&&n&&w.map(function(e){return e.toLowerCase()}).includes(n)&&(t.id='ID "'.concat(n,'" exists already.')),Object.keys(t).length>0?t:void 0},content:{title:"Create a new ".concat(H.name({start:!1,plural:!1}))},children:function(e){var r=e.errors,t=e.setValues,s=e.setFieldValue,a=e.values,c=e.touched;return(0,i.jsxs)(l.xu,{children:[(0,i.jsx)(C,{format:n}),(0,i.jsx)(d.W,{name:"label",label:"".concat(H.name({start:!0,plural:!1})," Name"),dataCy:"ct-name-input",placeholder:"A display name for the ".concat(H.name({start:!1,plural:!1})),error:c.label?r.label:void 0,onChange:function(e){return I(e,a,t)}}),(0,i.jsx)(d.W,{name:"id",dataCy:"ct-id-input",label:"".concat(H.name({start:!0,plural:!1})," ID"),placeholder:H.inputPlaceholder,error:c.id?r.id:void 0,onChange:function(e){return V(e,s)}})]})}})}},75329:function(e,n,r){"use strict";r.d(n,{Sn:function(){return l},lS:function(){return t},nG:function(){return s},pq:function(){return c},rd:function(){return a},xo:function(){return i}});var t=["components"],s=["png","jpg","jpeg"],i=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,a="placeholders/What_are_Slices_mrvome",l="SM_HELP_VIDEOS/mock_data",c="slice-machine-simulator"},840:function(e,n,r){"use strict";r.d(n,{F:function(){return O}});var t=r(52322),s=r(2784),i=r(22715),a=r(97729),l=r.n(a),c=r(56580),o=r(29930),d=r(90374),u=r(32665),x=r(3098),h=r(80131),f=r(78656),p=r(5632),C=r(67557),m=r(50002),j=r(6277);r(64117);var v=function(e){var n=e.children;return(0,t.jsx)("div",{className:"_1ecs97dez0 _1ecs97dez5 _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dezr",children:(0,t.jsx)("table",{className:"gdfsm51 _1ecs97dez0 _1ecs97dez5 _1ecs97df3p _1ecs97df4v",children:n})})},g=(0,s.createContext)("body");function b(){return(0,s.useContext)(g)}var _=function(e){var n=e.children;return(0,t.jsx)(g.Provider,{value:"head",children:(0,t.jsx)("thead",{className:"gdfsm52 _1ecs97dez0 _1ecs97dez5 _1ecs97d18 _1ecs97d8l",children:n})})},y=function(e){var n=e.children;return(0,t.jsx)(g.Provider,{value:"body",children:(0,t.jsx)("tbody",{className:"gdfsm53 _1ecs97dez0 _1ecs97dez5",children:n})})},T=function(e){var n,r=e.children,s=e.onClick,i=b();return(0,t.jsx)("tr",{className:(0,j.W)("_1ecs97dez0 _1ecs97dez5 _1ecs97df71",(n={},(0,C.Z)(n,"_1ecs97df41",!!s),(0,C.Z)(n,"_1ecs97dm _1ecs97d7z _1ecs97d3c _1ecs97dap _1ecs97d2w _1ecs97da9 _1ecs97df74 _1ecs97dfj8 _1ecs97df0d _1ecs97dfjb","body"===i),n)),onClick:function(e){var n,r=e.target;if(s&&e.currentTarget.contains(r)){var t=(0,m.JY)(r);(null===(n=null==t?void 0:t.contains(e.currentTarget))||void 0===n||n)&&s(e)}},children:r})},S=function(e){var n=e.children,r=b();return(0,t.jsx)("head"===r?"th":"td",{className:"gdfsm55 _1ecs97dez0 _1ecs97dez5 _1ecs97d3fg _1ecs97d3mt _1ecs97df2h _1ecs97dez1 _1ecs97da62 _1ecs97dadf _1ecs97df45 _1ecs97dfhi",children:(0,t.jsx)("div",{className:"gdfsm56 _1ecs97dez0 _1ecs97dez2",children:n})})},L=function(){return(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M8 28H24C25.1046 28 26 27.1046 26 26V9L21 4H8C6.89543 4 6 4.89543 6 6V26C6 27.1046 6.89543 28 8 28Z",fill:"#6E56CF"}),(0,t.jsx)("path",{d:"M23 9H26L21 4V7C21 8.10457 21.8954 9 23 9Z",fill:"#9E8CFC"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.0912 12C13.2794 12 11 14.2794 11 17.0912C11 19.903 13.2794 22.1824 16.0912 22.1824C17.9763 22.1824 19.6215 21.1577 20.501 19.6372C20.6563 19.3688 20.7878 19.0849 20.8926 18.7883C20.9846 18.5279 20.8482 18.2422 20.5878 18.1502C20.3275 18.0582 20.0418 18.1947 19.9498 18.455C19.8657 18.693 19.7601 18.9209 19.6354 19.1365C18.9273 20.3606 17.6049 21.1824 16.0912 21.1824C13.8317 21.1824 12 19.3507 12 17.0912C12 14.8317 13.8317 13 16.0912 13C17.4478 13 18.6507 13.66 19.3955 14.6782H17.6216C17.3455 14.6782 17.1216 14.9021 17.1216 15.1782C17.1216 15.4544 17.3455 15.6782 17.6216 15.6782H20.2998C20.576 15.6782 20.7998 15.4544 20.7998 15.1782V12.5C20.7998 12.2239 20.576 12 20.2998 12C20.0237 12 19.7998 12.2239 19.7998 12.5V13.6032C18.8717 12.6167 17.5536 12 16.0912 12Z",fill:"white"})]})},w=function(){return(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M8 28H24C25.1046 28 26 27.1046 26 26V9L21 4H8C6.89543 4 6 4.89543 6 6V26C6 27.1046 6.89543 28 8 28Z",fill:"#6E56CF"}),(0,t.jsx)("path",{d:"M23 9H26L21 4V7C21 8.10457 21.8954 9 23 9Z",fill:"#9E8CFC"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.0869 14.6818L14.6627 12.3787C14.7183 12.1561 14.9183 12 15.1477 12C15.473 12 15.7117 12.3057 15.6328 12.6213L15.1177 14.6818H17.7232L18.299 12.3787C18.3547 12.1561 18.5547 12 18.7841 12C19.1094 12 19.3481 12.3057 19.2692 12.6213L18.754 14.6818H21C21.2761 14.6818 21.5 14.9057 21.5 15.1818C21.5 15.458 21.2761 15.6818 21 15.6818H18.504L17.8449 18.3182H20C20.2761 18.3182 20.5 18.542 20.5 18.8182C20.5 19.0943 20.2761 19.3182 20 19.3182H17.5949L17.0192 21.6213C16.9635 21.8439 16.7635 22 16.5341 22C16.2088 22 15.9701 21.6943 16.049 21.3787L16.5642 19.3182H13.9586L13.3828 21.6213C13.3272 21.8439 13.1272 22 12.8977 22C12.5724 22 12.3338 21.6943 12.4127 21.3787L12.9278 19.3182H11C10.7239 19.3182 10.5 19.0943 10.5 18.8182C10.5 18.542 10.7239 18.3182 11 18.3182H13.1778L13.8369 15.6818H12C11.7239 15.6818 11.5 15.458 11.5 15.1818C11.5 14.9057 11.7239 14.6818 12 14.6818H14.0869ZM16.8142 18.3182L17.4732 15.6818H14.8677L14.2086 18.3182H16.8142Z",fill:"white"})]})},Z=r(67445),z=r(22710),k=r(99267),H=r(17329),R=r(81038),M=r(49471),E=r(7819),N=r(14137);function I(e){return V.apply(this,arguments)}function V(){return(V=(0,z.Z)(function(e){var n,r,t;return(0,k.__generator)(this,function(s){switch(s.label){case 0:return[4,R.j.customTypes.readAllCustomTypes({format:e})];case 1:if(r=(n=s.sent()).errors,t=n.models,r.length>0)throw r;return[2,t.map(function(e){return e.model})]}})})).apply(this,arguments)}var P=r(2754),F=r(19345),A=function(e){var n,r,a,l,o,u,x=e.format,h=e.isCreatingCustomType,C=(0,d.Z)().openCreateCustomTypeModal,m=(0,p.useRouter)(),j=(r=(0,s.useCallback)(function(e){return(0,H.VA)(I,[x],e)},[x]),{customTypes:(0,H.QT)(I,[x]),updateCustomTypes:r}),g=j.customTypes,b=j.updateCustomTypes,z=g.sort(function(e,n){return e.id.localeCompare(n.id)}),k=Z.cd[x],R=f.$[x];return(u=(0,c.v9)(function(e){return{storeCustomTypes:(0,M.Ch)(e).filter(E.TG)}}).storeCustomTypes,(0,s.useEffect)(function(){var e=u.filter(function(e){return e.local.format===x});(e.length!==g.length||e.some(function(e){var n=g.find(function(n){return n.id===e.local.id});return!n||JSON.stringify(N.Dc.fromSM(e.local))!==JSON.stringify(n)}))&&b(e.map(function(e){var n=e.local;return N.Dc.fromSM(n)}))},[x,b,g,u]),0===z.length)?(0,t.jsxs)(P.R$,{style:{alignSelf:"center",marginTop:i.TV.size[72]},children:[(0,t.jsx)(P.u2,{children:(0,t.jsx)(i.Ee,{src:k.blankSlateImage,sizing:"cover"})}),(0,t.jsxs)(P.T9,{children:[(0,t.jsx)(P._T,{children:R.name({start:!0,plural:!0})}),(0,t.jsx)(P.nf,{children:R.blankSlateDescription}),(0,t.jsx)(P.Qj,{children:(0,t.jsx)(i.zx,{onClick:C,loading:h,children:"Create"})})]})]}):(0,t.jsxs)(v,{children:[(0,t.jsx)(_,{children:(0,t.jsxs)(T,{children:[(0,t.jsx)(S,{children:(0,t.jsx)(i.I5,{name:"notes",size:"medium"})}),(0,t.jsx)(S,{children:"Label"}),(0,t.jsx)(S,{children:"API ID"}),(0,t.jsx)(S,{children:"Limit"}),(0,t.jsx)(S,{})]})}),(0,t.jsx)(y,{children:z.map(function(e){var n=e.repeatable,r=e.label,s=e.id;return(0,t.jsxs)(T,{onClick:function(){m.push(Z.cd[x].getBuilderPagePathname(s))},children:[(0,t.jsx)(S,{children:n?(0,t.jsx)(L,{}):(0,t.jsx)(w,{})}),(0,t.jsx)(S,{children:r}),(0,t.jsx)(S,{children:s}),(0,t.jsx)(S,{children:n?"Reusable":"Single"}),(0,t.jsx)(S,{children:(0,t.jsx)(F._,{isChangesLocal:!1,format:x,customType:e})})]},s)})})]})},O=function(e){var n=e.format,r=f.$[n],a=(0,d.Z)().openCreateCustomTypeModal,p=(0,c.v9)(function(e){return{isCreatingCustomType:(0,u.hg)(e,x.z.CREATE_CUSTOM_TYPE)}}).isCreatingCustomType;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l(),{children:(0,t.jsxs)("title",{children:[r.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,t.jsx)(i.SV,{renderError:function(){return(0,t.jsx)(o.LN,{children:(0,t.jsx)(o.RN,{children:(0,t.jsx)(i.xu,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)(i.Iq,{title:"Request failed",description:"An error occurred while fetching your ".concat(r.name({start:!1,plural:!0}),".")})})})})},children:(0,t.jsx)(s.Suspense,{fallback:(0,t.jsxs)(o.LN,{children:[(0,t.jsxs)(o.wd,{children:[(0,t.jsx)(o.Cx,{folder:r.name({start:!0,plural:!0})}),(0,t.jsx)(o.K2,{children:(0,t.jsx)(i.zx,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,t.jsx)(o.RN,{children:(0,t.jsx)(i._3,{})})]}),children:(0,t.jsxs)(o.LN,{children:[(0,t.jsxs)(o.wd,{children:[(0,t.jsx)(o.Cx,{folder:r.name({start:!0,plural:!0})}),(0,t.jsx)(o.K2,{children:(0,t.jsx)(i.zx,{"data-cy":"create-ct",loading:p,onClick:a,startIcon:"add",children:"Create"})})]}),(0,t.jsx)(o.RN,{children:(0,t.jsxs)(i.xu,{flexDirection:"column",children:[(0,t.jsx)(A,{format:n,isCreatingCustomType:p}),(0,t.jsx)(h.M,{format:n})]})})]})})})]})}},64117:function(){}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[731],{56577:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var r=t(62230),o=t(85244),i=t(98240),s=t(52322),c=t(2784),u=t(75289),a=function(e,n){return e?"".concat(e,"-").concat(n):""},l=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},d=(0,c.forwardRef)(function(e,n){var t=e.label,c=e.Icon,d=e.type,f=e.form,p=e.isLoading,m=void 0!==p&&p,v=e.disabled,y=e.onClick,h=e.sx,x=e.iconSize,Z=void 0===x?16:x,g=e.iconFill,j=e.variant,b=void 0===j?"primary":j,I=(0,i.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,s.jsx)(u.zx,(0,o.Z)((0,r.Z)({ref:n,sx:(0,r.Z)((0,o.Z)((0,r.Z)({},void 0===h?{}:h),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),m?{cursor:"wait !important"}:{}),type:d,form:f,disabled:void 0!==v&&v||m,onClick:m?void 0:y,variant:b},I),{children:m?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.$j,{size:Z,color:l(b),"data-cy":a(I["data-cy"],"spinner")}),c&&t]}):(0,s.jsxs)(s.Fragment,{children:[c&&(0,s.jsx)(c,{size:Z,fill:g,"data-cy":a(I["data-cy"],"icon")}),t]})}))})},70041:function(e,n,t){"use strict";t.d(n,{W:function(){return c}});var r=t(62230),o=t(52322);t(2784);var i=t(63397),s=t(75289),c=function(e){var n=e.name,t=e.label,c=e.placeholder,u=e.error,a=e.dataCy,l=e.onChange;return(0,o.jsxs)(s.xu,{mb:3,children:[(0,o.jsx)(s.__,{htmlFor:n,mb:2,children:t}),(0,o.jsx)(i.gN,(0,r.Z)({name:n,type:"text",placeholder:c,as:s.II,autoComplete:"off"},l?{onChange:l}:null,a?{"data-cy":a}:null)),u?(0,o.jsx)(s.xv,{"data-cy":a?"".concat(a,"-error"):"input-error",sx:{color:"error",mt:1},children:u}):null]})}},68780:function(e,n,t){"use strict";var r=t(62230),o=t(85244),i=t(52322),s=t(37149),c=t.n(s),u=t(25812),a=t(63397),l=t(75289),d=t(56577),f=t(54132);n.Z=function(e){var n=e.children,t=e.close,s=e.isOpen,p=e.formId,m=e.validate,v=e.onSubmit,y=e.widthInPx,h=e.initialValues,x=e.content.title,Z=e.cardProps,g=e.omitFooter,j=void 0!==g&&g,b=e.isLoading,I=void 0!==b&&b,T=e.buttonLabel,_=void 0===T?"Save":T,C=e.dataCy,S=e.actionMessage;return c().setAppElement("#__next"),(0,i.jsx)(u.Z,{isOpen:s,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:x,style:{content:{width:null!=y?y:"900px"}},children:(0,i.jsx)(a.J9,{validateOnChange:!0,initialValues:h,validate:function(e){return m?m(e):void 0},onSubmit:function(e){v(e)},children:function(e){var s=e.isValid,c=e.isSubmitting,u=e.values,m=e.errors,v=e.touched,y=e.setFieldValue,h=e.setValues;return(0,i.jsx)(a.l0,(0,o.Z)((0,r.Z)({id:p},null!=C?{"data-cy":C}:null),{children:(0,i.jsx)(f.Z,(0,o.Z)((0,r.Z)({borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"}},Z),{Header:function(e){var n=e.radius;return(0,i.jsxs)(l.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},children:[(0,i.jsx)(l.X6,{sx:{fontSize:"20px"},children:x}),(0,i.jsx)(l.x8,{type:"button",onClick:t})]})},Footer:j?null:(0,i.jsxs)(l.kC,{sx:{alignItems:"space-between"},children:[(0,i.jsx)(l.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof S?S(e):S}),(0,i.jsxs)(l.kC,{sx:{ml:"auto"},children:[(0,i.jsx)(l.zx,{mr:2,type:"button",onClick:t,variant:"secondary",disabled:c||I,children:"Cancel"}),(0,i.jsx)(d.z,{label:_,form:p,type:"submit",disabled:!s||c||I,isLoading:c||I,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:n({isValid:s,isSubmitting:c,values:u,errors:m,touched:v,setFieldValue:y,setValues:h})}))}))}})})}},38876:function(e,n,t){"use strict";t.d(n,{MP:function(){return i},T3:function(){return c},Ti:function(){return o},lV:function(){return u}});var r=/-(\w)/g;function o(e){return e.includes("-")?"['".concat(e,"']"):".".concat(e)}function i(e){return e?(e=e.replace(/_/g,"-").replace(r,function(e,n){return n?n.toUpperCase():""}))[0].toUpperCase()+e.slice(1):""}var s=/\B([A-Z])/g;function c(e){var n;return e.replace(s,"-$1").toLowerCase().replace(/-/g,"_")}var u=function(e){return e.trim().replace(/ /g,"_").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}},2754:function(e,n,t){"use strict";t.d(n,{R$:function(){return l},Qj:function(){return v},T9:function(){return f},nf:function(){return m},u2:function(){return d},_T:function(){return p}});var r=t(67557),o=t(62230),i=t(85244),s=t(98240),c=t(52322),u=t(6277),a=t(22715);t(69143);var l=function(e){var n=e.backgroundImage,t=e.style,a=(0,s.Z)(e,["backgroundImage","style"]),l=void 0!==n;return(0,c.jsx)("article",(0,i.Z)((0,o.Z)({},a),{className:(0,u.Z)("_18bjhbz0 _1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97dfiv _1ecs97dfix _1ecs97dfiz _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dezp",(0,r.Z)({},"_18bjhbz1 _1ecs97dezx _1ecs97df4v",l)),style:(0,o.Z)({backgroundImage:l?"url(".concat(n,")"):void 0},t)}))},d=function(e){return(0,c.jsx)("div",(0,i.Z)((0,o.Z)({},e),{className:"_1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97d6r8 _1ecs97d6yl _1ecs97df29 _1ecs97df2l _1ecs97dezp"}))},f=function(e){return(0,c.jsx)("div",(0,i.Z)((0,o.Z)({},e),{className:"_18bjhbz3 _1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97dffv"}))},p=function(e){return(0,c.jsx)(a.xv,(0,i.Z)((0,o.Z)({},e),{className:"_18bjhbz4"}))},m=function(e){return(0,c.jsx)(a.xv,(0,i.Z)((0,o.Z)({},e),{className:"_18bjhbz5",color:"grey11"}))},v=function(e){return(0,c.jsx)("div",(0,i.Z)((0,o.Z)({},e),{className:"_18bjhbz6 _1ecs97dez0 _1ecs97dez8 _1ecs97dez1 _1ecs97dez2 _1ecs97df95 _1ecs97dfdl",color:"grey"}))}},91061:function(e,n,t){"use strict";t.d(n,{AK:function(){return j},E3:function(){return m},EN:function(){return v},F$:function(){return x},GA:function(){return S},HO:function(){return Z},L4:function(){return b},Tr:function(){return p},gR:function(){return I},j6:function(){return _},kQ:function(){return T},l9:function(){return C},mf:function(){return y},vB:function(){return h},xS:function(){return g},y6:function(){return a}});var r=t(67557),o=t(62230),i=t(85244),s=t(17064),c=t(88866),u=t(98863);function a(e){var n;return null!==(n=e.format)&&void 0!==n?n:"custom"}function l(e){return Object.entries(e.json)}function d(e,n){return e.json[n]}function f(e,n){var t=d(e,n);if(void 0!==t)return Object.entries(t).find(function(e){var n=(0,s.Z)(e,2);return(n[0],n[1]).type===c.SlicesFieldType})}function p(e,n){if(t=e,d=f(t,u=n),(p=(0,s.Z)(null!=d?d:[],2))[0],null!==(a=null==(m=p[1])?void 0:m.config)&&void 0!==a?a:void 0)return e;var t,u,a,d,p,m,v=function(e,n){var t,r=l(e),o=r.findIndex(function(e){return(0,s.Z)(e,1)[0]===n}),i=r.flatMap(function(e){var n=(0,s.Z)(e,2),t=(n[0],n[1]);return Object.keys(t).filter(function(e){return t[e].type===c.SlicesFieldType})}),u=o;do t="slices".concat(0!==u?u.toString():""),u++;while(i.includes(t));return t}(e,n);return(0,i.Z)((0,o.Z)({},e),{json:(0,i.Z)((0,o.Z)({},e.json),(0,r.Z)({},n,(0,i.Z)((0,o.Z)({},e.json[n]),(0,r.Z)({},v,{type:c.SlicesFieldType,fieldset:"Slice Zone"}))))})}function m(e,n){var t=d(e,n);if(void 0===t)return e;var s=Object.keys(t).find(function(e){return t[e].type===c.SlicesFieldType});if(void 0===s)return e;var a=(0,u.ud)(t,s);return(0,i.Z)((0,o.Z)({},e),{json:(0,i.Z)((0,o.Z)({},e.json),(0,r.Z)({},n,a))})}function v(e){var n,t,s=e.customType,a=e.sectionId,l=e.sliceId,f=d(s,a);if(void 0===f)return s;var p=Object.keys(f).find(function(e){return f[e].type===c.SlicesFieldType});if(void 0===p)return s;var m=f[p];if(m.type!==c.SlicesFieldType)return s;var v=(0,u.ud)(null!==(t=null===(n=m.config)||void 0===n?void 0:n.choices)&&void 0!==t?t:{},l);return(0,i.Z)((0,o.Z)({},s),{json:(0,i.Z)((0,o.Z)({},s.json),(0,r.Z)({},a,(0,i.Z)((0,o.Z)({},f),(0,r.Z)({},p,(0,i.Z)((0,o.Z)({},m),{config:(0,i.Z)((0,o.Z)({},m.config),{choices:v})})))))})}function y(e){var n,t=(0,i.Z)((0,o.Z)({},e),{format:"page"}),r=l(e)[0];if(r){var c=(0,s.Z)(r,1)[0];t=p(t,c)}return t}function h(e,n){return(0,i.Z)((0,o.Z)({},e),{json:(0,i.Z)((0,o.Z)({},e.json),(0,r.Z)({},n,{}))})}function x(e,n){var t=(0,u.ud)(e.json,n);return(0,i.Z)((0,o.Z)({},e),{json:t})}function Z(e,n,t){if(n===t)return e;var r=Object.keys(e.json).reduce(function(r,o){return o===n?r[t]=e.json[o]:r[o]=e.json[o],r},{});return(0,i.Z)((0,o.Z)({},e),{json:r})}function g(e){var n=e.customType,t=e.sectionId,s=e.newField,c=e.newFieldId;return F({customType:n,sectionId:t,updatedSection:(0,i.Z)((0,o.Z)({},n.json[t]),(0,r.Z)({},c,s))})}function j(e){var n=e.customType,t=e.sectionId,r=e.fieldId,o=(0,u.ud)(n.json[t],r);return F({customType:n,sectionId:t,updatedSection:o})}function b(e){var n=e.customType,t=e.sectionId,r=e.previousFieldId,o=e.newFieldId,i=e.newField,s=w({fields:n.json[t],previousFieldId:r,newFieldId:o,newField:i});return F({customType:n,sectionId:t,updatedSection:s})}function I(e){var n=e.customType,t=e.sectionId,r=e.sourceIndex,o=e.destinationIndex,i=n.json[t],u=f(n,t),a=Object.fromEntries(Object.entries(i).filter(function(e){var n=(0,s.Z)(e,2);return(n[0],n[1]).type!==c.SlicesFieldType})),l=z({fields:a,sourceIndex:r,destinationIndex:o});if(void 0!==u){var d=(0,s.Z)(u,2),p=d[0],m=d[1];l[p]=m}return F({customType:n,sectionId:t,updatedSection:l})}function T(e){var n,t=e.customType,s=e.sectionId,c=e.groupFieldId,u=e.newField,a=e.newFieldId,l=k({customType:t,sectionId:s,groupFieldId:c}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l)return t;var f=L(l,(0,i.Z)((0,o.Z)({},d),(0,r.Z)({},a,u)));return F({customType:t,sectionId:s,updatedSection:(0,i.Z)((0,o.Z)({},t.json[s]),(0,r.Z)({},c,f))})}function _(e){var n,t=e.customType,s=e.sectionId,c=e.groupFieldId,a=e.fieldId,l=k({customType:t,sectionId:s,groupFieldId:c}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l||!d)return t;var f=(0,u.ud)(d,a),p=L(l,f);return F({customType:t,sectionId:s,updatedSection:(0,i.Z)((0,o.Z)({},t.json[s]),(0,r.Z)({},c,p))})}function C(e){var n,t=e.customType,s=e.sectionId,c=e.groupFieldId,u=e.previousFieldId,a=e.newFieldId,l=e.newField,d=k({customType:t,sectionId:s,groupFieldId:c}),f=null==d?void 0:null===(n=d.config)||void 0===n?void 0:n.fields;if(!d||!f)return t;var p=w({fields:f,previousFieldId:u,newFieldId:a,newField:l}),m=L(d,p);return F({customType:t,sectionId:s,updatedSection:(0,i.Z)((0,o.Z)({},t.json[s]),(0,r.Z)({},c,m))})}function S(e){var n,t=e.customType,s=e.sectionId,c=e.groupFieldId,u=e.sourceIndex,a=e.destinationIndex,l=k({customType:t,sectionId:s,groupFieldId:c}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l||!d)return t;var f=z({fields:d,sourceIndex:u,destinationIndex:a}),p=L(l,f);return F({customType:t,sectionId:s,updatedSection:(0,i.Z)((0,o.Z)({},t.json[s]),(0,r.Z)({},c,p))})}function F(e){var n=e.customType,t=e.sectionId,s=e.updatedSection;return(0,i.Z)((0,o.Z)({},n),{json:(0,i.Z)((0,o.Z)({},n.json),(0,r.Z)({},t,s))})}function w(e){var n=e.fields,t=e.previousFieldId,r=e.newFieldId,o=e.newField;return Object.entries(n).reduce(function(e,n){var i=(0,s.Z)(n,2),c=i[0],u=i[1];return c===t?e[r]=o:c!==r&&(e[c]=u),e},{})}function z(e){var n=e.fields,t=e.sourceIndex,r=e.destinationIndex,o=Object.entries(n),i=(0,s.Z)(o.splice(t,1),1)[0];return o.splice(r,0,i),Object.fromEntries(o)}function k(e){var n=e.customType,t=e.sectionId,r=e.groupFieldId,o=n.json[t][r];if(o.type===c.GroupFieldType)return o}function L(e,n){return(0,i.Z)((0,o.Z)({},e),{config:(0,i.Z)((0,o.Z)({},e.config),{fields:n})})}},19345:function(e,n,t){"use strict";t.d(n,{_:function(){return O}});var r=t(22710),o=t(99267),i=t(52322),s=t(2784),c=t(22715),u=t(5632),a=t(90374),l=t(88932),d=t(91061),f=t(82770),p=t(78656);function m(){return(m=(0,r.Z)(function(e,n){var t,r;return(0,o.__generator)(this,function(o){switch(o.label){case 0:t=p.$[e.format],o.label=1;case 1:return o.trys.push([1,3,,4]),r=(0,d.mf)(e),[4,(0,f.KA)(r)];case 2:return o.sent(),n(r),l.Am.success("".concat(t.name({start:!0,plural:!1})," converted to page type")),[3,4];case 3:return o.sent(),l.Am.error("Internal Error: ".concat(t.name({start:!0,plural:!1})," not converted to page type")),[3,4];case 4:return[2]}})})).apply(this,arguments)}var v=t(67445),y=t(62230),h=t(85244),x=t(75289),Z=t(68780),g=t(70041),j=t(56580),b=t(49471),I=t(81038);function T(){return(T=(0,r.Z)(function(e){var n,t,r,i,s,c,u;return(0,o.__generator)(this,function(o){switch(o.label){case 0:n=e.model,t=e.newLabel,r=e.onSuccess,i=p.$[n.format],o.label=1;case 1:return o.trys.push([1,3,,4]),s=(0,h.Z)((0,y.Z)({},n),{label:t}),[4,I.j.customTypes.renameCustomType({model:s})];case 2:return o.sent(),r(s),l.Am.success("".concat(i.name({start:!0,plural:!1})," renamed")),[3,4];case 3:return c=o.sent(),u="Internal Error: ".concat(i.name({start:!0,plural:!1})," could not be renamed"),console.error(u,c),l.Am.error(u),[3,4];case 4:return[2]}})})).apply(this,arguments)}var _=function(e){var n,t,c,u=e.isChangesLocal,l=e.customType,d=e.format,f=e.onClose,m=e.setLocalCustomType,v=null!==(n=null==l?void 0:l.label)&&void 0!==n?n:"",I=null!==(t=null==l?void 0:l.id)&&void 0!==t?t:"",_=(0,a.Z)().renameAvailableCustomTypeSuccess,C=(0,s.useState)(!1),S=C[0],F=C[1],w=(c=(0,r.Z)(function(e){return(0,o.__generator)(this,function(n){switch(n.label){case 0:if(F(!0),!(u&&m))return[3,1];return m((0,h.Z)((0,y.Z)({},l),{label:e.customTypeName})),[3,3];case 1:return[4,function(e){return T.apply(this,arguments)}({model:l,newLabel:e.customTypeName,onSuccess:_})];case 2:n.sent(),n.label=3;case 3:return F(!1),f(),[2]}})}),function(e){return c.apply(this,arguments)}),z=(0,j.v9)(function(e){return{customTypeLabels:(0,b.YS)(e)}}).customTypeLabels,k=p.$[d];return(0,i.jsx)(Z.Z,{isOpen:!0,dataCy:"rename-custom-type-modal",widthInPx:"530px",formId:"rename-custom-type-modal-".concat(I),buttonLabel:"Rename",close:f,onSubmit:function(e){w(e)},initialValues:{customTypeName:v},isLoading:S,content:{title:"Rename a ".concat(k.name({start:!1,plural:!1}))},validate:function(e){var n=e.customTypeName,t={};return n&&n.length||(t.customTypeName="Cannot be empty."),void 0!=t.customTypeName&&z.includes(n)&&v!==n&&(t.customTypeName="".concat(k.name({start:!0,plural:!1})," name is already taken.")),Object.keys(t).length>0?t:void 0},children:function(e){var n=e.errors;return(0,i.jsx)(x.xu,{children:(0,i.jsx)(g.W,{name:"customTypeName",label:"".concat(k.name({start:!0,plural:!1})," Name"),placeholder:"A display name for the ".concat(k.name({start:!1,plural:!1})),error:n.customTypeName,dataCy:"custom-type-name-input"})})}})},C=t(25812),S=t(59326),F=t(54132),w=t(65186),z=t(56577);function k(){return(k=(0,r.Z)(function(e){var n,t,r,i,s;return(0,o.__generator)(this,function(o){switch(o.label){case 0:n=e.customType,t=e.onSuccess,r=p.$[n.format],o.label=1;case 1:return o.trys.push([1,3,,4]),[4,I.j.customTypes.deleteCustomType({id:n.id})];case 2:return o.sent(),t(),l.Am.success("".concat(r.name({start:!0,plural:!1})," deleted")),[3,4];case 3:return i=o.sent(),s="Internal Error: ".concat(r.name({start:!0,plural:!1})," could not be deleted"),console.error(s,i),[3,4];case 4:return[2]}})})).apply(this,arguments)}var L=function(e){var n,t=e.customType,c=e.format,u=e.onClose,l=e.onDeleteCustomTypeSuccess,d=p.$[c],f=(0,s.useState)(!1),m=f[0],v=f[1],y=(0,a.Z)().deleteCustomTypeSuccess,h=(n=(0,r.Z)(function(){return(0,o.__generator)(this,function(e){switch(e.label){case 0:return v(!0),[4,function(e){return k.apply(this,arguments)}({customType:t,onSuccess:function(){return y(t.id)}})];case 1:return e.sent(),l(),[2]}})}),function(){return n.apply(this,arguments)}),Z=(0,S.B7)().theme;return(0,i.jsx)(C.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:function(){return u()},children:(0,i.jsx)(F.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:function(){var e;return(0,i.jsxs)(x.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,i.jsxs)(x.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(w.$vK,{size:20,color:null===(e=Z.colors)||void 0===e?void 0:e.greyIcon}),(0,i.jsxs)(x.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:["Delete"," ",d.name({start:!1,plural:!1})]})]}),(0,i.jsx)(x.x8,{type:"button",onClick:function(){return u()}})]})},Footer:function(){return(0,i.jsxs)(x.kC,{sx:{justifyContent:"flex-end",height:64,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:"gray"},children:[(0,i.jsx)(z.z,{label:"Cancel",variant:"secondary",onClick:function(){return u()},sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),void 0!==t&&(0,i.jsx)(z.z,{label:"Delete",variant:"danger",isLoading:m,onClick:function(){h()},sx:{minHeight:39,minWidth:78}})]})},children:(0,i.jsxs)("div",{children:["This action will immediately make the following change:",(0,i.jsx)("ul",{children:(0,i.jsxs)("li",{children:["Delete the"," ",(0,i.jsxs)(x.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,i.jsx)("ul",{children:(0,i.jsxs)("li",{children:["Remove the"," ",d.name({start:!1,plural:!1})," and any associated Documents from your repository."]})})]})})})},O=function(e){var n,t=e.format,l=e.customType,d=e.isChangesLocal,f=e.setLocalCustomType,p=(0,u.useRouter)(),y=(0,a.Z)().saveCustomTypeSuccess,h=(0,s.useState)(!1),x=h[0],Z=h[1],g=(0,s.useState)(!1),j=g[0],b=g[1],I=(0,s.useState)(!1),T=I[0],C=I[1],S=(n=(0,r.Z)(function(){var e,n;return(0,o.__generator)(this,function(t){switch(t.label){case 0:return C(!0),[4,function(e,n){return m.apply(this,arguments)}(l,y)];case 1:return t.sent(),e=v.cd.custom.getBuilderPagePathname(l.id),p.asPath===e&&(n=v.cd.page.getBuilderPagePathname(l.id),p.replace(n)),C(!1),[2]}})}),function(){return n.apply(this,arguments)}),F=function(){var e,n=v.cd[null!==(e=l.format)&&void 0!==e?e:"custom"].tablePagePathname;p.asPath!==n?p.replace(n):Z(!1)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(c.h_,{modal:!0,children:[(0,i.jsx)(c.$F,{disabled:T,children:(0,i.jsx)(c.hU,{color:"grey","data-testid":"editDropdown",hiddenLabel:"Custom type actions",icon:"moreVert",loading:T,variant:"solid"})}),(0,i.jsxs)(c.AW,{align:"end",children:[(0,i.jsx)(c.Xi,{startIcon:(0,i.jsx)(c.I5,{name:"edit"}),onSelect:function(){b(!0)},children:"Rename"}),"custom"===t&&!d&&(0,i.jsx)(c.Xi,{startIcon:(0,i.jsx)(c.I5,{name:"driveFileMove"}),onSelect:function(){S()},children:"Convert to page type"}),(0,i.jsx)(c.Xi,{color:"tomato",startIcon:(0,i.jsx)(c.I5,{name:"delete"}),onSelect:function(){Z(!0)},children:"Remove"})]})]}),x?(0,i.jsx)(L,{format:t,customType:l,onClose:function(){return Z(!1)},onDeleteCustomTypeSuccess:F}):null,j?(0,i.jsx)(_,{format:t,customType:l,isChangesLocal:d,onClose:function(){return b(!1)},setLocalCustomType:f}):null]})}},69143:function(){}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{87314:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return n(26971)}])},26971:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(52322),s=n(840),i=n(2784),o=n(56580),c=n(22715),a=n(17329),l=n(80131),x=n(90374),C=n(3098),u=n(32665),h=n(62230),f=n(85244),g=function(e){return(0,r.jsxs)("svg",(0,f.Z)((0,h.Z)({width:"127",height:"101",viewBox:"0 0 127 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,r.jsx)("line",{x1:"0.353553",y1:"35.9863",x2:"15.5467",y2:"51.1794",stroke:"#C8C7CB"}),(0,r.jsx)("line",{x1:"42.1959",y1:"0.87059",x2:"47.7569",y2:"21.6248",stroke:"#C8C7CB"}),(0,r.jsx)("line",{x1:"99.5522",y1:"8.40984",x2:"87.2281",y2:"26.0104",stroke:"#C8C7CB"}),(0,r.jsx)("line",{x1:"126.408",y1:"41.0854",x2:"108.807",y2:"53.4094",stroke:"#C8C7CB"}),(0,r.jsx)("path",{d:"M93.5 93L76 81.9883L93.5 87V93Z",fill:"#6F6E77"}),(0,r.jsx)("path",{d:"M92 100.488H36C34.8954 100.488 34 99.5929 34 98.4883V37.9883C34 36.8837 34.8954 35.9883 36 35.9883H92C93.1046 35.9883 94 36.8837 94 37.9883V98.4883C94 99.5929 93.1046 100.488 92 100.488Z",stroke:"#1A1523"}),(0,r.jsx)("path",{d:"M74.4297 58.7688C71.569 63.3138 63.3588 74.9883 54.5 74.9883L93.8417 86.9402C93.9471 86.9722 94.0473 87.0119 94.1481 87.0563C95.014 87.4377 99.5549 89.2156 104.5 86.9883C106.535 86.0718 109.03 82.7182 110.424 80.6551C111.04 79.7445 110.743 78.5257 109.805 77.9526L77.2788 58.0753C76.3086 57.4824 75.0354 57.8065 74.4297 58.7688Z",fill:"#5842C3"}),(0,r.jsx)("path",{d:"M34 47.9883C34 47.9883 42.3922 74.9883 54.5 74.9883M54.5 74.9883C63.3588 74.9883 71.569 63.3138 74.4297 58.7688C75.0354 57.8065 76.3086 57.4824 77.2788 58.0753L109.805 77.9526C110.743 78.5257 111.04 79.7445 110.424 80.6551C109.03 82.7182 106.535 86.0718 104.5 86.9883C99.5549 89.2156 95.014 87.4377 94.1481 87.0563C94.0473 87.0119 93.9471 86.9722 93.8417 86.9402L54.5 74.9883Z",stroke:"#1A1523"}),(0,r.jsx)("path",{d:"M34 48.4883H94",stroke:"#1A1523"}),(0,r.jsx)("circle",{cx:"40",cy:"41.9883",r:"1.5",stroke:"#1A1523"}),(0,r.jsx)("circle",{cx:"46",cy:"41.9883",r:"1.5",stroke:"#1A1523"}),(0,r.jsx)("circle",{cx:"52",cy:"41.9883",r:"1.5",stroke:"#1A1523"})]}))},p=n(93858);function y(){var e=(0,x.Z)().openCreateCustomTypeModal,t=(0,o.v9)(function(e){return{isCreatingCustomType:(0,u.hg)(e,C.z.CREATE_CUSTOM_TYPE)}}).isCreatingCustomType,n=(0,i.useState)(!1),s=n[0],h=n[1];return(0,i.useEffect)(function(){t&&(h(!0),a.Fs.clear(p.f,[]))},[t]),(0,r.jsx)(c.xu,{display:"flex",justifyContent:"center",height:"100vh",alignItems:"center",backgroundColor:"grey2",children:(0,r.jsxs)(c.xu,{display:"flex",flexDirection:"column",alignItems:"center",width:384,children:[(0,r.jsx)(g,{}),(0,r.jsx)(c.xv,{variant:"h3",align:"center",sx:{marginTop:16},children:"Blank page"}),(0,r.jsx)(c.xv,{color:"grey11",align:"center",sx:{marginBottom:16},children:"Welcome to Slice Machine. Your journey starts with your first page type — the model that you will use to create pages for your website."}),(0,r.jsx)(c.zx,{onClick:e,loading:s,children:"Create a page type"}),(0,r.jsx)(l.M,{format:"page",origin:"onboarding"})]})})}var d=function(){return(0,p.N)()?(0,r.jsx)(y,{}):(0,r.jsx)(s.F,{format:"page"})}}},function(e){e.O(0,[731,727,774,888,179],function(){return e(e.s=87314)}),_N_E=e.O()}]);
|
package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-b2a9d773ce5d7739.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[136],{31314:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]",function(){return t(79336)}])},38876:function(e,n,t){"use strict";t.d(n,{MP:function(){return o},T3:function(){return s},Ti:function(){return r},lV:function(){return c}});var i=/-(\w)/g;function r(e){return e.includes("-")?"['".concat(e,"']"):".".concat(e)}function o(e){return e?(e=e.replace(/_/g,"-").replace(i,function(e,n){return n?n.toUpperCase():""}))[0].toUpperCase()+e.slice(1):""}var a=/\B([A-Z])/g;function s(e){var n;return e.replace(a,"-$1").toLowerCase().replace(/-/g,"_")}var c=function(e){return e.trim().replace(/ /g,"_").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}},79336:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ew}});var i=t(52322),r=t(97729),o=t.n(r),a=t(5632),s=t(22715),c=t(28316),u=t(83462),l=t(38876),d=t(2353),f=t(44384),v=t(28173),p=t(53559),m=t(22710),h=t(62230),y=t(85244),x=t(99267),g=t(2784),j=t(74217),b=t(41072),w=t(82770),Z=t(90374),I=(0,g.createContext)(void 0);function S(e){var n=e.children,t=e.initialSlice,r=(0,a.useRouter)(),o=(0,g.useState)(t),s=o[0],c=o[1],u=(0,b.Q)({errorMessage:"Failed to save slice. Check your browser's console for more information."}),l=u.autoSaveStatus,d=u.setNextSave,f=(0,Z.Z)().saveSliceSuccess,v=(0,j.R9)(f),p=(0,g.useMemo)(function(){var e=r.query.variation,n=s.model.variations.find(function(n){return n.id===e});if(n)return n;throw Error("Variation not found")},[s,r]),S=(0,g.useCallback)(function(e){c(e),d((0,m.Z)(function(){var n,t,i,r,o;return(0,x.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,w.Ve)(e)];case 1:if((t=n.sent().errors).length>0)throw t;return[4,(0,w.pL)({libraryID:e.from,sliceID:e.model.id})];case 2:if(r=(i=n.sent()).errors,o=i.mocks,r.length>0)throw r;return v((0,y.Z)((0,h.Z)({},e),{mocks:o})),[2]}})}))},[d,v]),C=(0,g.useMemo)(function(){return{autoSaveStatus:l,slice:s,setSlice:S,variation:p}},[l,s,S,p]);return(0,i.jsx)(I.Provider,{value:C,children:"function"==typeof n?n(C):n})}function C(){var e=(0,g.useContext)(I);if(!e)throw Error("SliceBuilderProvider not found");return e}var k=t(5479),T=t(8482),F=t(4092),E=function(){var e=C(),n=e.slice,t=e.setSlice,r=e.variation,o=function(e){return function(i){var o=(0,k.AK)({slice:n,variationId:r.id,widgetArea:e,fieldId:i});t(o)}},a=function(e){return function(i){var o=i.apiId,a=i.newKey,s=i.value,c=(0,k.L4)({slice:n,variationId:r.id,widgetArea:e,previousFieldId:o,newFieldId:a,newField:s});t(c)}},s=function(e){return function(i){var o=i.id,a=i.label,s=i.widgetTypeName,c=d[s];c||console.log('Could not find widget with type name "'.concat(s,'". Please contact us!'));var u=c.create(a);if("Range"===u.type||"IntegrationFields"===u.type||"Separator"===u.type)throw Error("Unsupported Field Type: ".concat(u.type));try{d[u.type].schema.validateSync(u,{stripUnknown:!1})}catch(l){throw Error('Model is invalid for widget "'.concat(u.type,'".'))}var f=(0,k.xS)({slice:n,variationId:r.id,widgetArea:e,newFieldId:o,newField:u});t(f)}},m=function(e){return function(i){if(!(0,u.uS)(i)){var o=i.source,a=i.destination;if(a){var s=(0,k.gR)({slice:n,variationId:r.id,widgetArea:e,sourceIndex:o.index,destinationIndex:a.index});(0,c.flushSync)(function(){return t(s)})}}}};return(0,i.jsxs)(v.aV,{children:[(0,i.jsx)(T.Z,{zoneType:"slice",tabId:void 0,title:"Non-Repeatable Zone",dataTip:" The non-repeatable zone\n is for fields<br/> that should appear once, like a<br/>\n section title.\n",fields:r.primary,EditModal:F.Z,widgetsArray:f.Z,onDeleteItem:o(p.Rt.Primary),onSave:a(p.Rt.Primary),onSaveNewField:s(p.Rt.Primary),onDragEnd:m(p.Rt.Primary),poolOfFieldsToCheck:r.primary||[],renderHintBase:function(e){var n=e.item;return"slice.primary".concat((0,l.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.primary".concat((0,l.Ti)(e))},dataCy:"static-zone-content",isRepeatableCustomType:void 0}),(0,i.jsx)(T.Z,{zoneType:"slice",tabId:void 0,isRepeatable:!0,title:"Repeatable Zone",dataTip:"The repeatable zone is for a group<br/>\n of fields that you want to be able to repeat an<br/>\n indeterminate number of times, like FAQs",widgetsArray:f.Z,fields:r.items,EditModal:F.Z,onDeleteItem:o(p.Rt.Items),onSave:a(p.Rt.Items),onSaveNewField:s(p.Rt.Items),onDragEnd:m(p.Rt.Items),poolOfFieldsToCheck:r.items||[],renderHintBase:function(e){var n=e.item;return"item".concat((0,l.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.items[i]".concat((0,l.Ti)(e))},dataCy:"slice-repeatable-zone",isRepeatableCustomType:void 0})]})},R=t(88932),A=t(36131),O=t(63397),_=t(75289),N=t(76635),L=t(25812),V=t(54132),D=function(e){var n=e.children,t=e.FooterContent,r=e.HeaderContent,o=e.close,a=e.sx,s=e.headerSx,c=void 0===s?{}:s;return(0,i.jsx)(V.Z,{borderFooter:!0,footerSx:{p:0},bodySx:{pt:2,pb:4,px:4},sx:(0,h.Z)({border:"none"},void 0===a?{}:a),Header:function(e){var n=e.radius;return(0,i.jsxs)(_.kC,{sx:(0,h.Z)({p:3,pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},c),children:[r,o?(0,i.jsx)(_.x8,{onClick:o,type:"button"}):null]})},Footer:t?(0,i.jsxs)(_.kC,{sx:{alignItems:"space-between",bg:"headSection",p:3},children:[(0,i.jsx)(_.xu,{sx:{ml:"auto"}}),t]}):null,children:n})},P=function(e){var n=e.msg;return(0,i.jsx)(_.xv,{as:"span",sx:{fontSize:12,color:"error",mt:"5px",ml:2},children:n||"Error!"})},z=function(e){var n=e.isOpen,t=e.onClose,r=e.onSubmit,o=e.initialVariation,a=e.variations,c=function(e){var n=e.id,t=e.name,i=e.origin,r=n&&n.length?null:{id:"Required!"},o=a.find(function(e){return e.id===n})?{id:"This id already exists!"}:null,s=t&&t.length?null:{name:"Required!"},c=i.value.length&&a.find(function(e){return e.id===i.value})?null:{id:"You must select an existing variation!"},u=n&&n.length&&!/^[A-Za-z0-9]+([A-Za-z0-9]+)*$/.exec(n)&&{id:"No special characters allowed"};return(0,h.Z)({},r,o,s,c,u)},u=function(e){I((0,N.camelCase)(e))},l=function(e){E(e),C&&u(e)},d=function(e){k(!1),u(e)},f=function(){v(),t()},v=function(){I(""),E(""),b({}),k(!0),z({value:o.id,label:o.name})},p=(0,g.useState)({}),j=p[0],b=p[1],w=(0,g.useState)(""),Z=w[0],I=w[1],S=(0,g.useState)(!0),C=S[0],k=S[1],T=(0,g.useState)(""),F=T[0],E=T[1],R=(0,g.useState)({value:o.id,label:o.name}),V=R[0],z=R[1],M=(0,g.useState)(!1),K=M[0],B=M[1];function q(){return H.apply(this,arguments)}function H(){return(H=(0,m.Z)(function(){var e,n;return(0,x.__generator)(this,function(t){switch(t.label){case 0:if(!Object.keys(e=c({id:Z,name:F,origin:V})).length)return[3,1];return b(e),[3,3];case 1:if(!(n=a.find(function(e){return e.id===V.value})))return[3,3];return B(!0),[4,r(Z,F,n)];case 2:t.sent(),B(!1),f(),t.label=3;case 3:return[2]}})})).apply(this,arguments)}return(0,g.useEffect)(function(){v()},[o,n]),(0,i.jsx)(L.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,onRequestClose:function(){return f()},contentLabel:"Widget Form Modal",style:{content:{maxWidth:"700px"}},children:(0,i.jsx)(O.J9,{initialValues:{id:Z,name:F,origin:V},onSubmit:q,children:(0,i.jsx)(O.l0,{id:"variation-add",onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),q())},children:(0,i.jsx)(s.xu,{children:(0,i.jsxs)(D,{sx:{textAlign:"left"},HeaderContent:(0,i.jsx)(_.xv,{as:"h2",children:"Add new Variation"}),FooterContent:(0,i.jsxs)(s.xu,{gap:16,alignItems:"center",children:[(0,i.jsx)(s.zx,{onClick:f,color:"grey",children:"Cancel"}),(0,i.jsx)(s.zx,{loading:K,children:"Submit"})]}),close:f,children:[(0,i.jsxs)(s.xu,{flexDirection:"column",padding:{block:16},children:[(0,i.jsxs)(_.__,{htmlFor:"name",sx:{mb:1},children:["Variation name*",j.name?(0,i.jsx)(P,{msg:j.name}):""]}),(0,i.jsx)(O.gN,{autoComplete:"off",id:"name",name:"name",placeholder:"e.g. Grid - With Icon",as:_.II,maxLength:30,value:F,onChange:function(e){return l(e.currentTarget.value)}}),(0,i.jsx)(_.xv,{children:"It will appear here in Slice Machine, and in the page editor in Prismic"})]}),(0,i.jsxs)(s.xu,{flexDirection:"column",padding:{bottom:16},children:[(0,i.jsxs)(_.__,{htmlFor:"id",sx:{mb:1},children:["Variation ID*",j.id?(0,i.jsx)(P,{msg:j.id}):""]}),(0,i.jsx)(O.gN,{autoComplete:"off",id:"id",name:"id",placeholder:"e.g. GridWithIcon",as:_.II,maxLength:30,value:Z,onChange:function(e){return d(e.currentTarget.value)}}),(0,i.jsx)(_.xv,{children:"It's generated automatically based on the variation name and will appear in the API responses."})]}),(0,i.jsxs)(s.xu,{flexDirection:"column",padding:{bottom:8},children:[(0,i.jsx)(_.__,{htmlFor:"origin",sx:{mb:1},children:"Duplicate from"}),(0,i.jsx)(A.ZP,{name:"origin",options:a.map(function(e){return{value:e.id,label:e.name}}),onChange:function(e){e&&z(e)},defaultValue:V,maxMenuHeight:150,theme:function(e){return(0,y.Z)((0,h.Z)({},e),{colors:(0,y.Z)((0,h.Z)({},e.colors),{text:"text",primary:"background"})})}})]})]})})})})})},M=t(49451);function K(){return(K=(0,m.Z)(function(e){var n,t,i,r,o,a,s,c,u,l,d,f;return(0,x.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,6,,7]),[4,(0,w.Ve)(e.component)];case 1:if((t=n.sent().errors).length>0)throw t;return[4,(0,w.Xi)({libraryID:e.component.from,sliceID:e.component.model.id,variationID:e.variation.id})];case 2:if((r=n.sent().errors).length>0)throw r;return[4,(0,w.X$)(e.component.from,e.component.model.id)];case 3:if(a=(o=n.sent()).slice,(s=o.errors).length>0)throw s;if(!a)throw Error("Could not read variation `".concat(e.variation.name,"`"));return[4,(0,w.pL)({libraryID:e.component.from,sliceID:e.component.model.id})];case 4:return c=n.sent().mocks,u=M.Y.getBuilderPagePathname({libraryName:e.component.href,sliceName:a.name,variationId:a.variations[0].id}),[4,e.router.replace(u)];case 5:return n.sent(),l=(0,y.Z)((0,h.Z)({},e.component),{model:a,mocks:c}),e.saveSliceSuccess(l),[2,l];case 6:throw d=n.sent(),f="Could not delete variation `".concat(e.variation.name,"`"),console.error(f,d),R.Am.error(f),d;case 7:return[2]}})})).apply(this,arguments)}var B=function(e){var n=e.isOpen,t=e.onClose,r=e.slice,o=e.variation,c=(0,a.useRouter)(),u=(0,g.useState)(!1),l=u[0],d=u[1],f=(0,Z.Z)().saveSliceSuccess,v=C().setSlice;return(0,i.jsxs)(s.Vq,{open:n,onOpenChange:function(e){return!e&&t()},size:{width:448,height:"auto"},children:[(0,i.jsx)(s.fK,{icon:"delete",title:"Delete variation"}),(0,i.jsx)(s.cZ,{children:(0,i.jsxs)(s.xu,{flexDirection:"column",children:[(0,i.jsxs)(s.xv,{color:"grey11",sx:{marginBlock:16,marginInline:16},children:["This action will remove the variation from the slice model and delete associated files. When you push your changes, the variation will disappear from your repository. This update will"," ",(0,i.jsx)(q,{children:"not"})," affect your documents until you ",(0,i.jsx)(q,{children:"edit"})," ","them manually."]}),(0,i.jsx)(s.kX,{ok:{text:"Delete",onClick:function(){o&&(0,m.Z)(function(){var e;return(0,x.__generator)(this,function(e){switch(e.label){case 0:d(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,function(e){return K.apply(this,arguments)}({component:r,router:c,saveSliceSuccess:f,variation:o})];case 2:return v(e.sent()),[3,4];case 3:return e.sent(),[3,4];case 4:return d(!1),t(),[2]}})})()},loading:l},cancel:{text:"Cancel"},size:"medium"})]})})]})},q=function(e){return(0,i.jsx)(s.xv,(0,y.Z)((0,h.Z)({},e),{color:"inherit",component:"span",variant:"bold"}))};function H(){return(H=(0,m.Z)(function(e){var n,t,i,r,o,a,s,c,u,l,d;return(0,x.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),[4,(0,w.Ve)(e.component)];case 1:if((t=n.sent().errors).length>0)throw t;return[4,(0,w.eH)(e.component,(0,y.Z)((0,h.Z)({},e.variation),{name:e.variationName}))];case 2:if((r=n.sent().errors).length>0)throw r;return[4,(0,w.X$)(e.component.from,e.component.model.id)];case 3:if(a=(o=n.sent()).slice,(s=o.errors).length>0)throw s;if(!a)throw Error("Could not read variation `".concat(e.variation.name,"`"));return[4,(0,w.pL)({libraryID:e.component.from,sliceID:e.component.model.id})];case 4:return c=n.sent().mocks,u=(0,y.Z)((0,h.Z)({},e.component),{model:a,mocks:c}),e.saveSliceSuccess(u),[2,u];case 5:throw l=n.sent(),d="Could not rename variation `".concat(e.variation.name,"`"),console.error(d,l),R.Am.error(d),l;case 6:return[2]}})})).apply(this,arguments)}var X=function(e){var n,t,r=e.isOpen,o=e.onClose,a=e.slice,c=e.variation,u=(0,g.useState)(!1),l=u[0],d=u[1],f=C().setSlice,v=(0,Z.Z)().saveSliceSuccess;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(s.Vq,{open:r,onOpenChange:function(e){return!e&&o()},size:{width:448,height:"auto"},children:[(0,i.jsx)(s.fK,{icon:"edit",title:"Rename variation"}),(0,i.jsx)(s.cZ,{children:(0,i.jsx)(O.J9,{validateOnChange:!0,validateOnMount:!0,initialValues:{variationName:null!==(n=null==c?void 0:c.name)&&void 0!==n?n:""},validate:function(e){if(0===e.variationName.length)return{variationName:"Cannot be empty"}},onSubmit:(t=(0,m.Z)(function(e){var n;return(0,x.__generator)(this,function(n){switch(n.label){case 0:if(!c)return[2];d(!0),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,function(e){return H.apply(this,arguments)}({component:a,saveSliceSuccess:v,variation:c,variationName:e.variationName.trim()})];case 2:return f(n.sent()),[3,4];case 3:return n.sent(),[3,4];case 4:return d(!1),o(),[2]}})}),function(e){return t.apply(this,arguments)}),children:function(e){return(0,i.jsxs)("form",{children:[(0,i.jsxs)(s.xu,{flexDirection:"column",gap:8,padding:16,children:[(0,i.jsx)(s.xv,{variant:"normal",color:"grey11",children:"This action will rename the variation in the slice model. When you push your changes, the variation will be renamed in your repository."}),(0,i.jsxs)(s.xu,{flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:"_1ecs97dez4 _1ecs97dez8 _1ecs97df90",children:[(0,i.jsx)(s.xv,{variant:"bold",children:"Variation name*"}),"string"==typeof e.errors.variationName?(0,i.jsx)(s.xv,{variant:"small",color:"tomato10",children:e.errors.variationName}):null]}),(0,i.jsx)(s.yt,{placeholder:"Variation name",error:"string"==typeof e.errors.variationName,value:e.values.variationName,onValueChange:function(n){e.setFieldValue("variationName",n.slice(0,30))}})]})]}),(0,i.jsx)(s.kX,{ok:{text:"Rename",onClick:function(){e.submitForm()},loading:l,disabled:!e.isValid},cancel:{text:"Cancel"},size:"medium"})]})}})})]})})},U=t(15836),W=t(71749),G=t(47731),Q=function(){var e,n=C(),t=n.slice,r=n.variation,o=n.setSlice,c=(0,g.useState)(),u=c[0],l=c[1],d=(0,G.H)(),f=d.modalPayload,v=f.sliceFilterFn,p=f.defaultVariationSelector,h=f.onUploadSuccess,y=(0,a.useRouter)(),j=(0,Z.Z)().saveSliceSuccess;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.xu,{flexDirection:"column",gap:16,children:[t.model.variations.map(function(e){return(0,i.jsx)(W.b,{action:{type:"menu",onRename:function(){l({type:"RENAME_VARIATION",variation:e})},onRemove:function(){l({type:"DELETE_VARIATION",variation:e})},removeDisabled:t.model.variations.length<=1},mode:"navigation",onUpdateScreenshot:function(){d.onOpenModal({sliceFilterFn:function(e){return e},defaultVariationSelector:{sliceID:t.model.id,variationID:e.id},onUploadSuccess:function(e){o(e)}})},replace:!0,selected:e.id===r.id,slice:t,variant:"outlined",variationId:e.id},e.id)}),(0,i.jsxs)(s.xu,{backgroundColor:"grey2",bottom:0,flexDirection:"column",padding:{bottom:40,inline:24},position:"sticky",style:{marginBottom:"-16px"},children:[(0,i.jsx)(s.ph,{sx:{left:0,position:"absolute",right:0}}),(0,i.jsx)(s.zx,{onClick:function(){l({type:"ADD_VARIATION"})},startIcon:"add",sx:{position:"relative"},color:"grey",children:"Add a new variation"})]})]}),(0,i.jsx)(U.Z,{slices:v([t]),defaultVariationSelector:p,onUploadSuccess:h}),(0,i.jsx)(X,{isOpen:(null==u?void 0:u.type)==="RENAME_VARIATION",onClose:function(){l(void 0)},slice:t,variation:null==u?void 0:u.variation}),(0,i.jsx)(B,{isOpen:(null==u?void 0:u.type)==="DELETE_VARIATION",onClose:function(){l(void 0)},slice:t,variation:null==u?void 0:u.variation}),(0,i.jsx)(z,{initialVariation:r,isOpen:(null==u?void 0:u.type)==="ADD_VARIATION",onClose:function(){l(void 0)},onSubmit:(e=(0,m.Z)(function(e,n,i){var r,a,s,c,u,l;return(0,x.__generator)(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),a=(r=(0,k.Kp)({slice:t,id:e,name:n,copiedVariation:i})).slice,s=r.variation,[4,(0,w.Ve)(a)];case 1:return d.sent(),j(a),o(a),c=M.Y.getBuilderPagePathname({libraryName:a.href,sliceName:a.model.name,variationId:s.id}),y.replace(c),[3,3];case 2:return u=d.sent(),l="Could not add variation `".concat(n,"`"),console.error(l,u),R.Am.error(l),[3,3];case 3:return[2]}})}),function(n,t,i){return e.apply(this,arguments)}),variations:t.model.variations})]})},$=t(56580),J=t(75329),Y=t(33710),ee=t(42189),en=t(17036),et=t(39295),ei=t(22342),er=function(){return(0,i.jsx)(et.X,{children:(0,i.jsxs)(Y.Z,{clickable:!0,place:"bottom",effect:"solid",delayHide:500,id:"simulator-button-tooltip",children:[(0,i.jsx)(_.xv,{as:"b",children:"Framework not supported"}),(0,i.jsx)(_.xv,{as:"p",children:"Slice Simulator does not support your framework yet."})]})})},eo=function(e){var n=e.children,t=e.open,r=e.onClose;return(0,i.jsxs)(ei.zs,{open:t,trigger:n,onClose:r,children:[(0,i.jsx)(ei.Ev,{children:"Simulate your slices"}),(0,i.jsx)(ei.LB,{component:"video",cloudName:"dmtf1daqp",loop:!1,autoPlay:!1,publicId:J.Sn,poster:"/simulator-video-thumbnail.png",controls:!0,onPlay:function(){w.Xe.track({event:"open-video-tutorials",video:J.Sn})}}),(0,i.jsx)(ei.OJ,{children:"Minimize context-switching by previewing your Slice components in the simulator."}),(0,i.jsx)(ei.Rp,{children:"Got it"})]})},ea=function(e){var n=e.isSimulatorAvailableForFramework,t=e.disabled,r=(0,a.useRouter)(),o=(0,g.useRef)(null),c=(0,Z.Z)().setSeenSimulatorToolTip,u=(0,$.v9)(function(e){return{hasSeenSimulatorTooltip:(0,en.bv)(e)}}).hasSeenSimulatorTooltip;(0,g.useEffect)(function(){var e=o.current;e&&n&&!u&&setTimeout(function(){return Y.Z.show(e)},5e3)},[n,u]);var l=function(){if(c(),o.current){var e=o.current;Y.Z.hide(e)}};return(0,i.jsxs)("span",{"data-tip":!0,"data-tip-disable":!1,"data-for":"simulator-button-tooltip",ref:o,children:[(0,i.jsx)(eo,{open:n&&!u,onClose:l,children:(0,i.jsx)(s.zx,{"data-tip":!0,"data-testid":"simulator-open-button",onClick:function(){l(),window.open("".concat(r.asPath,"/simulator"),J.pq)},disabled:t,renderStartIcon:function(){return(0,i.jsx)(ee.z,{color:s.TV.color.greyLight1,height:s.TV.size[24],style:{transform:"scale(calc(4 / 3))"},width:s.TV.size[24]})},children:"Simulate"})}),!1===n?(0,i.jsx)(er,{}):void 0]})},es=t(29930),ec=t(17329),eu=t(81038);function el(e){return ed.apply(this,arguments)}function ed(){return(ed=(0,m.Z)(function(e){var n,t,i;return(0,x.__generator)(this,function(r){switch(r.label){case 0:return[4,eu.j.customTypes.readCustomType({id:e})];case 1:if(t=(n=r.sent()).errors,i=n.model,t.length>0)throw t;return[2,i]}})})).apply(this,arguments)}var ef=t(67445),ev=t(64722),ep=t(20812),em=function(e){return(0,i.jsxs)("svg",(0,y.Z)((0,h.Z)({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,i.jsx)("path",{d:"M9.5 12L6 9.5L9.5 7V9.5V12Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M6 9.5H11C14.3 9.5 17 12.2 17 15.5V17.5M6 9.5L9.5 12V9.5V7L6 9.5Z",stroke:"currentColor",strokeLinecap:"round"})]}))},eh=function(){var e,n,t=(e=(0,ev.l)().source,n=(0,ef.Ag)(e.query),void 0!==n&&(0,ef.ne)(e.asPath,n)?n:void 0);return void 0!==t?(0,i.jsx)(s.SV,{children:(0,i.jsx)(g.Suspense,{children:(0,i.jsx)(s.xu,{bottom:32,justifyContent:"center",position:"fixed",right:0,width:"100vw",children:(0,i.jsx)(ey,{sourceCustomTypeId:t})})})}):null},ey=function(e){var n,t=(n=e.sourceCustomTypeId,(0,ec.QT)(el,[n])),r=(0,g.useState)(!0),o=r[0],c=r[1],u=(0,a.useRouter)();if(void 0===t||!o)return null;var l=t.format,d=t.id,f=ef.cd[l].getBuilderPagePathname(d);return(0,i.jsxs)(s.hE,{density:"compact",color:"dark",children:[(0,i.jsxs)(s.zx,{onClick:function(){u.push(f)},renderStartIcon:function(){return(0,i.jsx)(em,{})},children:["Return to ",t.label]}),(0,i.jsx)(s.zx,{onClick:function(){c(!1)},renderStartIcon:function(){return(0,i.jsx)(ep.T,{})}})]})},ex=t(39092),eg=t(47976),ej=function(){var e=C(),n=e.slice,t=e.autoSaveStatus,r=(0,$.v9)(ex.Ql);return(0,i.jsxs)(es.LN,{children:[(0,i.jsxs)(es.wd,{children:[(0,i.jsx)(es.Xq,{url:"/slices"}),(0,i.jsx)(es.Cx,{folder:"Slices",page:n.model.name}),(0,i.jsxs)(es.K2,{children:[(0,i.jsx)(eg.X,{status:t}),(0,i.jsx)(ea,{isSimulatorAvailableForFramework:r,disabled:"saved"!==t})]})]}),(0,i.jsxs)(es.RN,{children:[(0,i.jsxs)(s.xu,{alignItems:"flex-start",display:"grid",gap:16,gridTemplateColumns:"320px 1fr",children:[(0,i.jsx)(Q,{}),(0,i.jsx)(E,{})]}),(0,i.jsx)(eh,{})]})]})},eb=t(28684);function ew(){var e=(0,a.useRouter)(),n=(0,eb.Z)(),t=n.slice,r=n.variation;return void 0===t||void 0===r?(e.replace("/"),null):(0,i.jsx)(S,{initialSlice:t,children:function(e){var n=e.slice;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o(),{children:(0,i.jsxs)("title",{children:[n.model.name," - Slice Machine"]})}),(0,i.jsx)(ej,{})]})}})}},91061:function(e,n,t){"use strict";t.d(n,{AK:function(){return b},E3:function(){return p},EN:function(){return m},F$:function(){return x},GA:function(){return k},HO:function(){return g},L4:function(){return w},Tr:function(){return v},gR:function(){return Z},j6:function(){return S},kQ:function(){return I},l9:function(){return C},mf:function(){return h},vB:function(){return y},xS:function(){return j},y6:function(){return u}});var i=t(67557),r=t(62230),o=t(85244),a=t(17064),s=t(88866),c=t(98863);function u(e){var n;return null!==(n=e.format)&&void 0!==n?n:"custom"}function l(e){return Object.entries(e.json)}function d(e,n){return e.json[n]}function f(e,n){var t=d(e,n);if(void 0!==t)return Object.entries(t).find(function(e){var n=(0,a.Z)(e,2);return(n[0],n[1]).type===s.SlicesFieldType})}function v(e,n){if(t=e,d=f(t,c=n),(v=(0,a.Z)(null!=d?d:[],2))[0],null!==(u=null==(p=v[1])?void 0:p.config)&&void 0!==u?u:void 0)return e;var t,c,u,d,v,p,m=function(e,n){var t,i=l(e),r=i.findIndex(function(e){return(0,a.Z)(e,1)[0]===n}),o=i.flatMap(function(e){var n=(0,a.Z)(e,2),t=(n[0],n[1]);return Object.keys(t).filter(function(e){return t[e].type===s.SlicesFieldType})}),c=r;do t="slices".concat(0!==c?c.toString():""),c++;while(o.includes(t));return t}(e,n);return(0,o.Z)((0,r.Z)({},e),{json:(0,o.Z)((0,r.Z)({},e.json),(0,i.Z)({},n,(0,o.Z)((0,r.Z)({},e.json[n]),(0,i.Z)({},m,{type:s.SlicesFieldType,fieldset:"Slice Zone"}))))})}function p(e,n){var t=d(e,n);if(void 0===t)return e;var a=Object.keys(t).find(function(e){return t[e].type===s.SlicesFieldType});if(void 0===a)return e;var u=(0,c.ud)(t,a);return(0,o.Z)((0,r.Z)({},e),{json:(0,o.Z)((0,r.Z)({},e.json),(0,i.Z)({},n,u))})}function m(e){var n,t,a=e.customType,u=e.sectionId,l=e.sliceId,f=d(a,u);if(void 0===f)return a;var v=Object.keys(f).find(function(e){return f[e].type===s.SlicesFieldType});if(void 0===v)return a;var p=f[v];if(p.type!==s.SlicesFieldType)return a;var m=(0,c.ud)(null!==(t=null===(n=p.config)||void 0===n?void 0:n.choices)&&void 0!==t?t:{},l);return(0,o.Z)((0,r.Z)({},a),{json:(0,o.Z)((0,r.Z)({},a.json),(0,i.Z)({},u,(0,o.Z)((0,r.Z)({},f),(0,i.Z)({},v,(0,o.Z)((0,r.Z)({},p),{config:(0,o.Z)((0,r.Z)({},p.config),{choices:m})})))))})}function h(e){var n,t=(0,o.Z)((0,r.Z)({},e),{format:"page"}),i=l(e)[0];if(i){var s=(0,a.Z)(i,1)[0];t=v(t,s)}return t}function y(e,n){return(0,o.Z)((0,r.Z)({},e),{json:(0,o.Z)((0,r.Z)({},e.json),(0,i.Z)({},n,{}))})}function x(e,n){var t=(0,c.ud)(e.json,n);return(0,o.Z)((0,r.Z)({},e),{json:t})}function g(e,n,t){if(n===t)return e;var i=Object.keys(e.json).reduce(function(i,r){return r===n?i[t]=e.json[r]:i[r]=e.json[r],i},{});return(0,o.Z)((0,r.Z)({},e),{json:i})}function j(e){var n=e.customType,t=e.sectionId,a=e.newField,s=e.newFieldId;return T({customType:n,sectionId:t,updatedSection:(0,o.Z)((0,r.Z)({},n.json[t]),(0,i.Z)({},s,a))})}function b(e){var n=e.customType,t=e.sectionId,i=e.fieldId,r=(0,c.ud)(n.json[t],i);return T({customType:n,sectionId:t,updatedSection:r})}function w(e){var n=e.customType,t=e.sectionId,i=e.previousFieldId,r=e.newFieldId,o=e.newField,a=F({fields:n.json[t],previousFieldId:i,newFieldId:r,newField:o});return T({customType:n,sectionId:t,updatedSection:a})}function Z(e){var n=e.customType,t=e.sectionId,i=e.sourceIndex,r=e.destinationIndex,o=n.json[t],c=f(n,t),u=Object.fromEntries(Object.entries(o).filter(function(e){var n=(0,a.Z)(e,2);return(n[0],n[1]).type!==s.SlicesFieldType})),l=E({fields:u,sourceIndex:i,destinationIndex:r});if(void 0!==c){var d=(0,a.Z)(c,2),v=d[0],p=d[1];l[v]=p}return T({customType:n,sectionId:t,updatedSection:l})}function I(e){var n,t=e.customType,a=e.sectionId,s=e.groupFieldId,c=e.newField,u=e.newFieldId,l=R({customType:t,sectionId:a,groupFieldId:s}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l)return t;var f=A(l,(0,o.Z)((0,r.Z)({},d),(0,i.Z)({},u,c)));return T({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},s,f))})}function S(e){var n,t=e.customType,a=e.sectionId,s=e.groupFieldId,u=e.fieldId,l=R({customType:t,sectionId:a,groupFieldId:s}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l||!d)return t;var f=(0,c.ud)(d,u),v=A(l,f);return T({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},s,v))})}function C(e){var n,t=e.customType,a=e.sectionId,s=e.groupFieldId,c=e.previousFieldId,u=e.newFieldId,l=e.newField,d=R({customType:t,sectionId:a,groupFieldId:s}),f=null==d?void 0:null===(n=d.config)||void 0===n?void 0:n.fields;if(!d||!f)return t;var v=F({fields:f,previousFieldId:c,newFieldId:u,newField:l}),p=A(d,v);return T({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},s,p))})}function k(e){var n,t=e.customType,a=e.sectionId,s=e.groupFieldId,c=e.sourceIndex,u=e.destinationIndex,l=R({customType:t,sectionId:a,groupFieldId:s}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l||!d)return t;var f=E({fields:d,sourceIndex:c,destinationIndex:u}),v=A(l,f);return T({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},s,v))})}function T(e){var n=e.customType,t=e.sectionId,a=e.updatedSection;return(0,o.Z)((0,r.Z)({},n),{json:(0,o.Z)((0,r.Z)({},n.json),(0,i.Z)({},t,a))})}function F(e){var n=e.fields,t=e.previousFieldId,i=e.newFieldId,r=e.newField;return Object.entries(n).reduce(function(e,n){var o=(0,a.Z)(n,2),s=o[0],c=o[1];return s===t?e[i]=r:s!==i&&(e[s]=c),e},{})}function E(e){var n=e.fields,t=e.sourceIndex,i=e.destinationIndex,r=Object.entries(n),o=(0,a.Z)(r.splice(t,1),1)[0];return r.splice(i,0,o),Object.fromEntries(r)}function R(e){var n=e.customType,t=e.sectionId,i=e.groupFieldId,r=n.json[t][i];if(r.type===s.GroupFieldType)return r}function A(e,n){return(0,o.Z)((0,r.Z)({},e),{config:(0,o.Z)((0,r.Z)({},e.config),{fields:n})})}},28684:function(e,n,t){"use strict";var i=t(5632),r=t(56580),o=t(49222),a=function(){var e=(0,i.useRouter)(),n=(0,r.v9)(function(n){return{slice:(0,o.t)(n,e.query.lib,e.query.sliceName)}}).slice;if(!n)return{};var t=n.model.variations.find(function(n){return n.id===e.query.variation});return t?{slice:n,variation:t}:{}};n.Z=a},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return j}});var i=t(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}t(52322);var o=["shift","alt","meta","mod","ctrl"],a={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function s(e){return(a[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function c(e,n){return void 0===n&&(n=","),e.split(n)}function u(e,n,t){void 0===n&&(n="+");var i,a=e.toLocaleLowerCase().split(n).map(function(e){return s(e)});return r({},{alt:a.includes("alt"),ctrl:a.includes("ctrl")||a.includes("control"),shift:a.includes("shift"),meta:a.includes("meta"),mod:a.includes("mod")},{keys:a.filter(function(e){return!o.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([s(e.key),s(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&v([s(e.key),s(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){l.clear()});var l=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];l.has("meta")&&l.forEach(function(e){var n;return!o.includes(e)&&l.delete(e.toLowerCase())}),n.forEach(function(e){return l.add(e.toLowerCase())})}function v(e){var n=Array.isArray(e)?e:[e];"meta"===e?l.clear():n.forEach(function(e){return l.delete(e.toLowerCase())})}function p(e,n){var t=e.target;void 0===n&&(n=!1);var i=t&&t.tagName;return d(n)?Boolean(i&&n&&n.some(function(e){return e.toLowerCase()===i.toLowerCase()})):Boolean(i&&n&&!0===n)}var m=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,a=n.meta,c=n.mod,u=n.shift,f=n.ctrl,v=n.keys,p=e.key,m=e.code,h=e.ctrlKey,y=e.metaKey,x=e.shiftKey,g=e.altKey,j=s(m),b=p.toLowerCase();if(!t){if(!g===o&&"alt"!==b||!x===u&&"shift"!==b)return!1;if(c){if(!y&&!h)return!1}else if(!y===a&&"meta"!==b&&"os"!==b||!h===f&&"ctrl"!==b&&"control"!==b)return!1}return!!(v&&1===v.length&&(v.includes(b)||v.includes(j)))||(v?(void 0===r&&(r=","),(d(i=v)?i:i.split(r)).every(function(e){return l.has(e.trim().toLowerCase())})):!v)},h=(0,i.createContext)(void 0),y=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),x=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},g="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function j(e,n,t,r){var o,a,l=(0,i.useRef)(null),j=(0,i.useRef)(!1),b=t instanceof Array?r instanceof Array?void 0:r:t,w=d(e)?e.join(null==b?void 0:b.splitKey):e,Z=t instanceof Array?t:r instanceof Array?r:void 0,I=(0,i.useCallback)(n,null!=Z?Z:[]),S=(0,i.useRef)(I);Z?S.current=I:S.current=n;var C=(!function e(n,t){return n&&t&&"object"==typeof n&&"object"==typeof t?Object.keys(n).length===Object.keys(t).length&&Object.keys(n).reduce(function(i,r){return i&&e(n[r],t[r])},!0):n===t}((a=(0,i.useRef)(void 0)).current,b)&&(a.current=b),a.current),k=(0,i.useContext)(y).enabledScopes,T=(0,i.useContext)(h);return g(function(){if((null==C?void 0:C.enabled)!==!1&&(e=k,n=null==C?void 0:C.scopes,0===e.length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!n||e.some(function(e){return n.includes(e)})||e.includes("*")))){var e,n,t=function(e,n){var t,i;if(void 0===n&&(n=!1),!(p(e,["input","textarea","select"])&&!p(e,null==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)){x(e);return}(null==(t=e.target)||!t.isContentEditable||null!=C&&C.enableOnContentEditable)&&c(w,null==C?void 0:C.splitKey).forEach(function(t){var i,r,o,a,s,c,l,d=u(t,null==C?void 0:C.combinationKey);if(m(e,d,null==C?void 0:C.ignoreModifiers)||null!=(l=d.keys)&&l.includes("*")){if(n&&j.current)return;if(i=e,r=d,("function"==typeof(o=null==C?void 0:C.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),a=e,s=d,"function"==typeof(c=null==C?void 0:C.enabled)?!c(a,s):!0!==c&&void 0!==c){x(e);return}S.current(e,d),n||(j.current=!0)}})}},i=function(e){void 0!==e.key&&(f(s(e.code)),((null==C?void 0:C.keydown)===void 0&&(null==C?void 0:C.keyup)!==!0||null!=C&&C.keydown)&&t(e))},r=function(e){void 0!==e.key&&(v(s(e.code)),j.current=!1,null!=C&&C.keyup&&t(e,!0))},o=l.current||(null==b?void 0:b.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),T&&c(w,null==C?void 0:C.splitKey).forEach(function(e){return T.addHotkey(u(e,null==C?void 0:C.combinationKey,null==C?void 0:C.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),T&&c(w,null==C?void 0:C.splitKey).forEach(function(e){return T.removeHotkey(u(e,null==C?void 0:C.combinationKey,null==C?void 0:C.description))})}}},[w,C,k]),l}}},function(e){e.O(0,[898,789,917,525,461,139,183,50,543,696,25,318,286,774,888,179],function(){return e(e.s=31314)}),_N_E=e.O()}]);
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { describe, expect } from "vitest";
|
|
2
|
-
import { createCustomType } from "@src/features/customTypes/customTypesTable/createCustomType";
|
|
3
|
-
|
|
4
|
-
describe("createCustomType test suite", () => {
|
|
5
|
-
it("should create a custom type with repeatable true", () => {
|
|
6
|
-
expect(createCustomType("id", "lama", true, "custom"))
|
|
7
|
-
.toMatchInlineSnapshot(`
|
|
8
|
-
{
|
|
9
|
-
"format": "custom",
|
|
10
|
-
"id": "id",
|
|
11
|
-
"json": {
|
|
12
|
-
"Main": {
|
|
13
|
-
"uid": {
|
|
14
|
-
"config": {
|
|
15
|
-
"label": "UID",
|
|
16
|
-
},
|
|
17
|
-
"type": "UID",
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
"label": "lama",
|
|
22
|
-
"repeatable": true,
|
|
23
|
-
"status": true,
|
|
24
|
-
}
|
|
25
|
-
`);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("should create a custom type with repeatable false", () => {
|
|
29
|
-
const result = createCustomType("id", "lama", false, "custom");
|
|
30
|
-
expect(result.id).toBe("id");
|
|
31
|
-
expect(result.label).toBe("lama");
|
|
32
|
-
expect(result.format).toBe("custom");
|
|
33
|
-
expect(result.json).toHaveProperty("Main");
|
|
34
|
-
expect(result).toMatchInlineSnapshot(`
|
|
35
|
-
{
|
|
36
|
-
"format": "custom",
|
|
37
|
-
"id": "id",
|
|
38
|
-
"json": {
|
|
39
|
-
"Main": {},
|
|
40
|
-
},
|
|
41
|
-
"label": "lama",
|
|
42
|
-
"repeatable": false,
|
|
43
|
-
"status": true,
|
|
44
|
-
}
|
|
45
|
-
`);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("should create a page type with a slice zone", () => {
|
|
49
|
-
const result = createCustomType("🥪", "label", true, "page");
|
|
50
|
-
expect(result.format).toBe("page");
|
|
51
|
-
expect(result.json).toHaveProperty("Main");
|
|
52
|
-
expect(result.json.Main).toHaveProperty("slices");
|
|
53
|
-
expect(result.json).toHaveProperty("SEO & Metadata");
|
|
54
|
-
expect(result).toMatchInlineSnapshot(`
|
|
55
|
-
{
|
|
56
|
-
"format": "page",
|
|
57
|
-
"id": "🥪",
|
|
58
|
-
"json": {
|
|
59
|
-
"Main": {
|
|
60
|
-
"slices": {
|
|
61
|
-
"config": {
|
|
62
|
-
"choices": {},
|
|
63
|
-
},
|
|
64
|
-
"fieldset": "Slice Zone",
|
|
65
|
-
"type": "Slices",
|
|
66
|
-
},
|
|
67
|
-
"uid": {
|
|
68
|
-
"config": {
|
|
69
|
-
"label": "UID",
|
|
70
|
-
},
|
|
71
|
-
"type": "UID",
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
"SEO & Metadata": {
|
|
75
|
-
"meta_description": {
|
|
76
|
-
"config": {
|
|
77
|
-
"label": "Meta Description",
|
|
78
|
-
"placeholder": "A brief summary of the page",
|
|
79
|
-
},
|
|
80
|
-
"type": "Text",
|
|
81
|
-
},
|
|
82
|
-
"meta_image": {
|
|
83
|
-
"config": {
|
|
84
|
-
"constraint": {
|
|
85
|
-
"height": 1260,
|
|
86
|
-
"width": 2400,
|
|
87
|
-
},
|
|
88
|
-
"label": "Meta Image",
|
|
89
|
-
"thumbnails": [],
|
|
90
|
-
},
|
|
91
|
-
"type": "Image",
|
|
92
|
-
},
|
|
93
|
-
"meta_title": {
|
|
94
|
-
"config": {
|
|
95
|
-
"label": "Meta Title",
|
|
96
|
-
"placeholder": "A title of the page used for social media and search engines",
|
|
97
|
-
},
|
|
98
|
-
"type": "Text",
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
"label": "label",
|
|
103
|
-
"repeatable": true,
|
|
104
|
-
"status": true,
|
|
105
|
-
}
|
|
106
|
-
`);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it("when non repeatable page type is should contain Main with a slice-zone, no uid, and a SEO tab", () => {
|
|
111
|
-
const result = createCustomType("foo", "bar", false, "page");
|
|
112
|
-
expect(result).toMatchInlineSnapshot(`
|
|
113
|
-
{
|
|
114
|
-
"format": "page",
|
|
115
|
-
"id": "foo",
|
|
116
|
-
"json": {
|
|
117
|
-
"Main": {
|
|
118
|
-
"slices": {
|
|
119
|
-
"config": {
|
|
120
|
-
"choices": {},
|
|
121
|
-
},
|
|
122
|
-
"fieldset": "Slice Zone",
|
|
123
|
-
"type": "Slices",
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
"SEO & Metadata": {
|
|
127
|
-
"meta_description": {
|
|
128
|
-
"config": {
|
|
129
|
-
"label": "Meta Description",
|
|
130
|
-
"placeholder": "A brief summary of the page",
|
|
131
|
-
},
|
|
132
|
-
"type": "Text",
|
|
133
|
-
},
|
|
134
|
-
"meta_image": {
|
|
135
|
-
"config": {
|
|
136
|
-
"constraint": {
|
|
137
|
-
"height": 1260,
|
|
138
|
-
"width": 2400,
|
|
139
|
-
},
|
|
140
|
-
"label": "Meta Image",
|
|
141
|
-
"thumbnails": [],
|
|
142
|
-
},
|
|
143
|
-
"type": "Image",
|
|
144
|
-
},
|
|
145
|
-
"meta_title": {
|
|
146
|
-
"config": {
|
|
147
|
-
"label": "Meta Title",
|
|
148
|
-
"placeholder": "A title of the page used for social media and search engines",
|
|
149
|
-
},
|
|
150
|
-
"type": "Text",
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
"label": "bar",
|
|
155
|
-
"repeatable": false,
|
|
156
|
-
"status": true,
|
|
157
|
-
}
|
|
158
|
-
`);
|
|
159
|
-
});
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { CustomType } from "@prismicio/types-internal/lib/customtypes";
|
|
2
|
-
import type { CustomTypeFormat } from "@slicemachine/manager";
|
|
3
|
-
|
|
4
|
-
export function createCustomType(
|
|
5
|
-
id: string,
|
|
6
|
-
label: string,
|
|
7
|
-
repeatable: boolean,
|
|
8
|
-
format: CustomTypeFormat,
|
|
9
|
-
): CustomType {
|
|
10
|
-
const mainTab = makeMainTab(repeatable, format);
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
id,
|
|
14
|
-
label,
|
|
15
|
-
format,
|
|
16
|
-
repeatable,
|
|
17
|
-
json: mainTab,
|
|
18
|
-
status: true,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function makeMainTab(
|
|
23
|
-
repeatable: boolean,
|
|
24
|
-
format: CustomTypeFormat,
|
|
25
|
-
): CustomType["json"] {
|
|
26
|
-
if (repeatable === false && format === "page") {
|
|
27
|
-
return { ...DEFAULT_MAIN_WITH_SLICE_ZONE, ...DEFAULT_SEO_TAB };
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (repeatable === false) {
|
|
31
|
-
return DEFAULT_MAIN;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (format === "page") {
|
|
35
|
-
return {
|
|
36
|
-
...DEFAULT_MAIN_WITH_UID_AND_SLICE_ZONE,
|
|
37
|
-
...DEFAULT_SEO_TAB,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return DEFAULT_MAIN_WITH_UID;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const DEFAULT_MAIN: CustomType["json"] = {
|
|
45
|
-
Main: {},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const DEFAULT_MAIN_WITH_SLICE_ZONE: CustomType["json"] = {
|
|
49
|
-
Main: {
|
|
50
|
-
slices: {
|
|
51
|
-
config: {
|
|
52
|
-
choices: {},
|
|
53
|
-
},
|
|
54
|
-
fieldset: "Slice Zone",
|
|
55
|
-
type: "Slices",
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const DEFAULT_MAIN_WITH_UID: CustomType["json"] = {
|
|
61
|
-
Main: {
|
|
62
|
-
uid: {
|
|
63
|
-
config: {
|
|
64
|
-
label: "UID",
|
|
65
|
-
},
|
|
66
|
-
type: "UID",
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const DEFAULT_MAIN_WITH_UID_AND_SLICE_ZONE: CustomType["json"] = {
|
|
72
|
-
Main: {
|
|
73
|
-
...DEFAULT_MAIN_WITH_UID.Main,
|
|
74
|
-
...DEFAULT_MAIN_WITH_SLICE_ZONE.Main,
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const DEFAULT_SEO_TAB: CustomType["json"] = {
|
|
79
|
-
"SEO & Metadata": {
|
|
80
|
-
meta_description: {
|
|
81
|
-
config: {
|
|
82
|
-
label: "Meta Description",
|
|
83
|
-
placeholder: "A brief summary of the page",
|
|
84
|
-
},
|
|
85
|
-
type: "Text",
|
|
86
|
-
},
|
|
87
|
-
meta_image: {
|
|
88
|
-
config: {
|
|
89
|
-
constraint: {
|
|
90
|
-
height: 1260,
|
|
91
|
-
width: 2400,
|
|
92
|
-
},
|
|
93
|
-
label: "Meta Image",
|
|
94
|
-
thumbnails: [],
|
|
95
|
-
},
|
|
96
|
-
type: "Image",
|
|
97
|
-
},
|
|
98
|
-
meta_title: {
|
|
99
|
-
config: {
|
|
100
|
-
label: "Meta Title",
|
|
101
|
-
placeholder:
|
|
102
|
-
"A title of the page used for social media and search engines",
|
|
103
|
-
},
|
|
104
|
-
type: "Text",
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
|
|
3
|
-
import { describe, test, afterEach, expect, vi } from "vitest";
|
|
4
|
-
import { Analytics } from "@segment/analytics-node";
|
|
5
|
-
|
|
6
|
-
import { render, fireEvent, act } from "../__testutils__";
|
|
7
|
-
import { CreateCustomTypeModal } from "../../components/Forms/CreateCustomTypeModal";
|
|
8
|
-
import { ModalKeysEnum } from "../../src/modules/modal/types";
|
|
9
|
-
|
|
10
|
-
vi.mock("next/router", () => require("next-router-mock"));
|
|
11
|
-
global.console = { ...global.console, error: vi.fn() };
|
|
12
|
-
|
|
13
|
-
describe("CreateCustomTypeModal", () => {
|
|
14
|
-
afterEach(() => {
|
|
15
|
-
vi.clearAllMocks();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test("when a slice is created the tracker should be called", async () => {
|
|
19
|
-
const fakeId = "testing_id";
|
|
20
|
-
const fakeName = "testing-name";
|
|
21
|
-
const fakeRepo = "foo";
|
|
22
|
-
|
|
23
|
-
render(<CreateCustomTypeModal format="custom" />, {
|
|
24
|
-
preloadedState: {
|
|
25
|
-
// @ts-expect-error TS(2739) FIXME: Type '{ repo: string; }' is missing the following ... Remove this comment to see the full error message
|
|
26
|
-
environment: {
|
|
27
|
-
repo: fakeRepo,
|
|
28
|
-
},
|
|
29
|
-
availableCustomTypes: {},
|
|
30
|
-
// @ts-expect-error TS(2740) FIXME: Type '{ CREATE_CUSTOM_TYPE: true; }' is missing th... Remove this comment to see the full error message
|
|
31
|
-
modal: { [ModalKeysEnum.CREATE_CUSTOM_TYPE]: true },
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const idInput = document.querySelector('[name="id"]');
|
|
36
|
-
const labelInput = document.querySelector('[name="label"]');
|
|
37
|
-
const submitButton = document.querySelector('[type="submit"]');
|
|
38
|
-
|
|
39
|
-
await act(async () => {
|
|
40
|
-
if (labelInput) {
|
|
41
|
-
fireEvent.change(labelInput, { target: { value: fakeName } });
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
await act(async () => {
|
|
46
|
-
if (idInput) {
|
|
47
|
-
fireEvent.change(idInput, { target: { value: fakeId } });
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
await act(async () => {
|
|
52
|
-
if (submitButton) {
|
|
53
|
-
fireEvent.click(submitButton);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
expect(Analytics.prototype.track).toHaveBeenCalledOnce();
|
|
58
|
-
expect(Analytics.prototype.track).toHaveBeenCalledWith(
|
|
59
|
-
expect.objectContaining({
|
|
60
|
-
event: "SliceMachine Custom Type Created",
|
|
61
|
-
properties: {
|
|
62
|
-
id: fakeId,
|
|
63
|
-
name: fakeName,
|
|
64
|
-
format: "custom",
|
|
65
|
-
type: "repeatable",
|
|
66
|
-
nodeVersion: process.versions.node,
|
|
67
|
-
origin: "table",
|
|
68
|
-
},
|
|
69
|
-
}),
|
|
70
|
-
expect.any(Function),
|
|
71
|
-
);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
File without changes
|