slice-machine-ui 1.22.3-beta.1 → 1.22.3-beta.3
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/DeleteVariationModal/index.tsx +12 -11
- package/components/Forms/CreateSliceModal/CreateSliceModal.tsx +2 -5
- package/components/Forms/RenameCustomTypeModal/RenameCustomTypeModal.tsx +9 -5
- package/components/Forms/RenameVariationModal/RenameVariationModal.tsx +12 -11
- package/components/ItemHeader/index.tsx +1 -0
- package/components/ListItem/index.tsx +5 -2
- package/components/ScreenshotChangesModal/VariationDropZone.tsx +31 -9
- package/components/ScreenshotChangesModal/index.tsx +3 -0
- package/components/ScreenshotChangesModal/useCustomScreenshot.tsx +5 -5
- package/components/Simulator/index.tsx +9 -3
- package/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +2 -2
- package/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +2 -2
- package/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +12 -20
- package/lib/builders/CustomTypeBuilder/TabModal/update.tsx +3 -1
- package/lib/builders/CustomTypeBuilder/TabZone/index.tsx +119 -52
- package/lib/builders/CustomTypeBuilder/index.tsx +39 -42
- package/lib/builders/SliceBuilder/FieldZones/index.tsx +81 -56
- package/lib/builders/SliceBuilder/Sidebar/AddVariationModal.tsx +24 -16
- package/lib/builders/SliceBuilder/Sidebar/index.tsx +44 -46
- package/lib/builders/SliceBuilder/SimulatorButton/index.tsx +4 -28
- package/lib/builders/SliceBuilder/index.tsx +10 -96
- package/lib/builders/common/Zone/Card/components/Hints/CodeBlock.tsx +5 -1
- package/lib/builders/common/Zone/Card/components/NewField.tsx +16 -15
- package/lib/builders/common/Zone/Card/index.jsx +2 -0
- package/lib/builders/common/Zone/index.jsx +3 -1
- package/lib/models/common/ComponentUI.ts +0 -14
- package/lib/models/common/CustomType/sliceZone.ts +0 -29
- package/lib/models/common/CustomType/tab.ts +10 -142
- package/lib/models/common/widgets/Group/ListItem/index.jsx +61 -23
- package/out/404.html +1 -1
- package/out/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js +1 -0
- package/out/_next/static/chunks/183-4feb6bb3eddbc768.js +1 -0
- package/out/_next/static/chunks/18539003-7b2711e6c51d6fac.js +97 -0
- package/out/_next/static/chunks/1cc2734a-2c5b6c0367fcde86.js +1 -0
- package/out/_next/static/chunks/25-8fedd33ad9b6de5b.js +1 -0
- package/out/_next/static/chunks/318-541db69860d31138.js +1 -0
- package/out/_next/static/chunks/{505-3f1cf09a086dcba8.js → 376-0ed5822f8afcaa7c.js} +3 -3
- package/out/_next/static/chunks/4c744e84-e3161d754618373f.js +1 -0
- package/out/_next/static/chunks/50-cfc2514205b86001.js +1 -0
- package/out/_next/static/chunks/543-f8766685f7f451e2.js +1 -0
- package/out/_next/static/chunks/59b4e022-7a3b5554b806349f.js +1 -0
- package/out/_next/static/chunks/696-b12edad30a3617e5.js +31 -0
- package/out/_next/static/chunks/727-15cf3f2fea9a37e5.js +1 -0
- package/out/_next/static/chunks/731-501990ebe6a71b32.js +1 -0
- package/out/_next/static/chunks/787-727e3aef5d2a10a8.js +1 -0
- package/out/_next/static/chunks/904-ccd8ca3368ce29fc.js +1 -0
- package/out/_next/static/chunks/{918-38d08f1e885b222d.js → 918-5bb55fb464e34768.js} +1 -1
- package/out/_next/static/chunks/f36c6662-03bb5e9d9aa0b0aa.js +1 -0
- package/out/_next/static/chunks/pages/_app-20876abeebe0fda7.js +430 -0
- package/out/_next/static/chunks/pages/changelog-68d115a14f1423d7.js +1 -0
- package/out/_next/static/chunks/pages/changes-6f62ae7b6243a1c7.js +1 -0
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-3a37eb3373bb8823.js → [customTypeId]-3f862ad6111a1fc0.js} +1 -1
- package/out/_next/static/chunks/pages/{custom-types-2f5664d9492b13fb.js → custom-types-94b8f8dbf7727412.js} +1 -1
- package/out/_next/static/chunks/pages/{index-d8e3a2c0d712904f.js → index-64cfb8b0948ba8ef.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-733f3890c0466a05.js → [pageTypeId]-d1ffca11c42f2603.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-897ca93c114a1435.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-e89e2e6f772a3454.js +1 -0
- package/out/_next/static/chunks/pages/slices-9628f8aa54968d6a.js +1 -0
- package/out/_next/static/css/{1bbf650dfd37ce69.css → 1aa04669758c24f4.css} +1 -1
- package/out/_next/static/j_voPTrYzsuLCERqtl3Hn/_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/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 +6 -6
- package/pages/slices/[lib]/[sliceName]/[variation]/index.tsx +25 -11
- package/pages/slices/[lib]/[sliceName]/[variation]/simulator.tsx +12 -9
- package/src/apiClient.ts +7 -6
- package/src/components/CodeBlock/CodeBlock.tsx +1 -0
- package/src/components/Window/Window.tsx +7 -1
- package/src/domain/__tests__/customType.test.ts +785 -0
- package/src/domain/customType.ts +519 -6
- package/src/domain/slice.ts +166 -1
- package/src/features/autoSave/AutoSaveStatusIndicator.tsx +43 -0
- package/src/features/autoSave/useAutoSave.tsx +177 -0
- package/src/features/customTypes/EditDropdown.tsx +3 -0
- package/src/features/customTypes/actions/convertCustomToPageType.ts +2 -4
- package/src/features/customTypes/customTypesBuilder/CustomTypeProvider.tsx +90 -0
- package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +46 -79
- package/src/features/customTypes/customTypesMessages.ts +4 -0
- package/src/features/slices/actions/addSlicesToSliceZone.ts +2 -7
- package/src/features/slices/actions/uploadSliceScreenshot.ts +45 -0
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +5 -5
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx +4 -10
- package/src/features/slices/sliceBuilder/SliceBuilderProvider.tsx +110 -0
- package/src/features/slices/sliceBuilder/actions/deleteVariation.ts +8 -24
- package/src/features/slices/sliceBuilder/actions/renameVariation.ts +8 -24
- package/src/features/slices/sliceCards/SharedSliceCard.tsx +1 -0
- package/src/hooks/useCurrentSlice.tsx +4 -16
- package/src/hooks/useScreenshotChangesModal.ts +1 -0
- package/src/hooks/useServerState.ts +1 -58
- package/src/modules/availableCustomTypes/index.ts +8 -3
- package/src/modules/simulator/index.ts +0 -2
- package/src/modules/slices/index.ts +32 -25
- package/src/modules/slices/selector.ts +30 -0
- package/src/modules/useSliceMachineActions.ts +20 -270
- package/src/redux/reducer.ts +0 -4
- package/src/redux/saga.ts +0 -6
- package/src/redux/type.ts +0 -4
- package/test/src/modules/availableCustomTypes/index.test.ts +8 -10
- package/test/src/modules/simulator.test.ts +0 -2
- package/lib/models/common/CustomType/group.ts +0 -80
- package/lib/models/common/Variation.ts +0 -100
- package/out/_next/static/ZrWICkLApT4ZATA_akn-2/_buildManifest.js +0 -1
- package/out/_next/static/chunks/18539003-4460ccbfe3109578.js +0 -97
- package/out/_next/static/chunks/482-34cee2a2071c235f.js +0 -1
- package/out/_next/static/chunks/550-c80fd46fb64d1eef.js +0 -1
- package/out/_next/static/chunks/80-7b8a97d0122ff74a.js +0 -1
- package/out/_next/static/chunks/840-163f8a1040e6820d.js +0 -1
- package/out/_next/static/chunks/904-519dbf0f7e8c6243.js +0 -1
- package/out/_next/static/chunks/958-8aca174b80cb0c35.js +0 -1
- package/out/_next/static/chunks/pages/_app-132564608e9a9502.js +0 -458
- package/out/_next/static/chunks/pages/changelog-4d0f2f1222e403fe.js +0 -1
- package/out/_next/static/chunks/pages/changes-52c9d917808d1461.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-7b17cb59d0db03b5.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-ef11594ce026b650.js +0 -1
- package/out/_next/static/chunks/pages/slices-884a936a9a062a65.js +0 -1
- package/src/domain/__tests__/CustomTypeModel.test.ts +0 -247
- package/src/layouts/WithSlice.tsx +0 -26
- package/src/modules/screenshots/actions.ts +0 -21
- package/src/modules/screenshots/sagas.ts +0 -70
- package/src/modules/selectedCustomType/actions.ts +0 -147
- package/src/modules/selectedCustomType/index.ts +0 -11
- package/src/modules/selectedCustomType/reducer.ts +0 -287
- package/src/modules/selectedCustomType/sagas.ts +0 -72
- package/src/modules/selectedCustomType/selectors.ts +0 -33
- package/src/modules/selectedCustomType/stateHelpers.ts +0 -42
- package/src/modules/selectedCustomType/types.ts +0 -9
- package/src/modules/selectedSlice/actions.ts +0 -106
- package/src/modules/selectedSlice/reducer.ts +0 -175
- package/src/modules/selectedSlice/sagas.ts +0 -72
- package/src/modules/selectedSlice/selectors.ts +0 -55
- package/src/modules/selectedSlice/types.ts +0 -3
- package/src/modules/toaster/utils.tsx +0 -23
- package/test/lib/models/common/CustomType/sliceZone.test.ts +0 -49
- package/test/pages/custom-types.test.tsx +0 -625
- package/test/src/modules/selectedCustomType/__fixtures__/model.json +0 -119
- package/test/src/modules/selectedCustomType/reducer.test.ts +0 -322
- package/test/src/modules/selectedCustomType/sagas.test.ts +0 -89
- package/test/src/modules/selectedCustomType/selectors.test.ts +0 -54
- package/test/src/modules/selectedSlice/__fixtures__/mocks.json +0 -171
- package/test/src/modules/selectedSlice/__fixtures__/model.json +0 -35
- package/test/src/modules/selectedSlice/__testutils__/getRefreshStateCreatorPayloadData.ts +0 -72
- package/test/src/modules/selectedSlice/__testutils__/getSelectedSliceDummyData.ts +0 -30
- package/test/src/modules/selectedSlice/reducer.test.ts +0 -170
- package/test/src/modules/selectedSlice/sagas.test.ts +0 -82
- package/test/src/modules/toaster/utils.test.ts +0 -50
- /package/out/_next/static/{ZrWICkLApT4ZATA_akn-2 → j_voPTrYzsuLCERqtl3Hn}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[477],{37782:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changelog",function(){return r(57825)}])},57825:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return H}});var i,t,s=r(52322),o=r(97729),a=r.n(o),c=r(22715),l=r(65077),d=r(75289),p=r(56580),x=r(39092),g=r(2784),h=r(62230),u=r(12170),f=function(e){var n=e.type,r=e.hasUpToDateVersions;return(0,s.jsx)(d.xv,{sx:(0,h.Z)({padding:"0px 4px",borderRadius:"2px",fontSize:"8px",fontWeight:600,lineHeight:"16px",textTransform:"uppercase"},(n===i.Latest||n===i.LatestNonBreaking)&&{bg:"grey02",color:"code.gray"},n===i.Current&&r&&{bg:"lightGreen",color:"code.green"},n===i.Current&&!r&&{bg:"lightOrange",color:"code.orange"}),children:n})},v=function(e){var n=e.isSelected,r=e.onClick,i=e.versionNumber,t=e.tags,o=e.hasUpToDateVersions;return(0,s.jsxs)(d.kC,{sx:(0,h.Z)({p:1,borderRadius:"4px",cursor:"pointer",transition:"200ms all",justifyContent:"space-between",alignItems:"center"},n?{color:"purple",bg:(0,u.DZ)("purple",.95)}:{"&:hover":{bg:"grey01"}}),onClick:r,children:[(0,s.jsx)(d.xv,{children:i}),(0,s.jsx)(d.kC,{sx:{gap:"8px"},children:t.map(function(e){return(0,s.jsx)(f,{type:e,hasUpToDateVersions:o},e)})})]})};(t=i||(i={})).Latest="LATEST",t.LatestNonBreaking="LATEST-NON-BREAKING",t.Current="CURRENT";var m=function(e){var n,r=e.changelog,t=e.selectedVersion,o=e.selectVersion,a=function(e){var n=[];return e===l?n.push(i.Latest):e===r.sliceMachine.latestNonBreakingVersion&&n.push(i.LatestNonBreaking),e===r.sliceMachine.currentVersion&&n.push(i.Current),n},l=null===(n=r.sliceMachine.versions[0])||void 0===n?void 0:n.versionNumber,p=!r.adapter.updateAvailable&&!r.sliceMachine.updateAvailable;return(0,s.jsxs)(d.kC,{sx:{minWidth:"228px",borderRight:"1px dashed",borderColor:c.TV.color.greyLight6,flexDirection:"column",paddingRight:"48px"},children:[(0,s.jsxs)(d.kC,{sx:{flexDirection:"column",borderBottom:"1px dashed",borderColor:c.TV.color.greyLight6,paddingBottom:"28px"},children:[(0,s.jsx)(d.xv,{sx:{fontSize:"20px",fontWeight:500,lineHeight:"32px"},children:"Changelog"}),(0,s.jsx)(d.xv,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"24px",marginTop:"28px"},children:"All versions"})]}),(0,s.jsx)(d.kC,{sx:{mt:"24px",flexDirection:"column",gap:"4px",overflow:"auto"},children:r.sliceMachine.versions.map(function(e,n){return(0,s.jsx)(v,{isSelected:(null==t?void 0:t.versionNumber)===e.versionNumber,onClick:function(){return o(e)},versionNumber:e.versionNumber,tags:a(e.versionNumber),hasUpToDateVersions:p},"versionBadge-".concat(e.versionNumber,"-").concat(n))})})]})},b={MAJOR:"MAJOR",MINOR:"MINOR",PATCH:"PATCH",FIRST:"FIRST"},j=function(e){var n=e.versionKind,r=(0,h.Z)({fontSize:"14px",padding:"2px 4px",borderRadius:"4px",textTransform:"uppercase"},n===b.MAJOR?{color:"purple",bg:(0,u.DZ)("purple",.85)}:{color:"grey05",bg:"grey02"});return(0,s.jsx)(d.xv,{sx:r,children:n})},k=r(19870),C=function(e){var n=e.releaseNote;return(0,s.jsx)(d.xv,{sx:{"h1, h2, h3":{fontSize:"16px",fontWeight:600,lineHeight:"20px"},p:{fontSize:"14px",fontWeight:400,lineHeight:"20px"},b:{fontSize:"14px",fontWeight:600,lineHeight:"20px"},code:{color:"code.orange"},li:{listStyleType:"disc",marginLeft:"25px",paddingLeft:"5px"}},dangerouslySetInnerHTML:{__html:k.TU.parse(n)}})},N=r(951),T=r(8346),y=function(e){var n,r,i,t,o,a=e.changelog,c=e.selectedVersion,l=e.packageManager,p=c.versionNumber===a.sliceMachine.versions[0].versionNumber,x=(n={sliceMachineVersionToInstall:p?"latest":c.versionNumber,isLatestSliceMachineVersion:p,adapterName:a.adapter.name},r=n.sliceMachineVersionToInstall,i=n.isLatestSliceMachineVersion,t=n.adapterName,o=["slice-machine-ui@".concat(r)],i&&o.push("".concat(t,"@latest")),o),g=function(e,n){var r=n.join(" ");switch(e){case"bun":return"bun add --development ".concat(r);case"npm":return"npm install --save-dev ".concat(r);case"pnpm":case"pnpm@6":return"pnpm add --save-dev ".concat(r);case"yarn":case"yarn@berry":return"yarn add --dev ".concat(r)}}(l,x),h=a.adapter.updateAvailable&&!a.sliceMachine.updateAvailable;return(0,s.jsxs)(s.Fragment,{children:[h&&p&&(0,s.jsxs)(d.kC,{sx:{padding:"16px",bg:"lightOrange",color:"darkOrange",fontSize:"13px",lineHeight:"24px",borderRadius:"4px",gap:"16px"},children:[(0,s.jsx)(N.CSE,{size:"24px"}),"It looks like you are using an outdated version of the adapter. Run this command to update your adapter:"]}),(0,s.jsxs)(d.kC,{sx:{flexDirection:"column",gap:"16px",padding:"16px",bg:"grey01"},children:[(0,s.jsx)(d.xv,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"20px"},children:"How to install"}),(0,s.jsxs)(d.kC,{sx:{gap:"8px"},children:[(0,s.jsx)(T.Z,{codeStyle:{color:"white",flex:1,padding:"8px"},sx:{flex:1},children:g}),(0,s.jsx)(d.zx,{variant:"secondary",onClick:function(){navigator.clipboard.writeText(g)},children:"Copy"})]})]})]})},S=function(){return(0,s.jsxs)("div",{children:["Could not fetch release notes."," ",(0,s.jsx)("a",{href:"https://github.com/prismicio/slice-machine/releases",target:"_blank",rel:"noopener noreferrer",children:"Find out more on GitHub"})]})},M=function(e){var n,r=e.changelog,i=e.selectedVersion,t=e.packageManager;return(0,s.jsxs)(d.kC,{sx:{flexDirection:"column"},children:[(0,s.jsxs)(d.kC,{sx:{padding:"0px 0px 32px 32px",borderBottom:"1px dashed",borderColor:c.TV.color.greyLight6,justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(d.xv,{sx:{fontSize:"24px",fontWeight:600,lineHeight:"32px"},children:"Version ".concat(i.versionNumber)}),!!i.kind&&(0,s.jsx)(j,{versionKind:i.kind})]}),(0,s.jsxs)(d.kC,{sx:{flexDirection:"column",padding:"24px 0px 0px 32px",gap:"24px"},children:[(null===(n=i.releaseNote)||void 0===n?void 0:n.includes("# Breaking Change"))&&(0,s.jsxs)(d.kC,{sx:{padding:"16px",bg:"lightOrange",color:"darkOrange",fontSize:"13px",lineHeight:"24px",borderRadius:"4px",gap:"16px"},"data-testid":"breaking-changes-warning",children:[(0,s.jsx)(N.CSE,{size:"24px"}),"This update includes breaking changes. To update correctly, follow the steps below."]}),(0,s.jsx)(y,{changelog:r,selectedVersion:i,packageManager:t}),(null==i?void 0:i.releaseNote)?(0,s.jsx)(C,{releaseNote:i.releaseNote}):(0,s.jsx)(S,{})]})]})},V=r(32665),L=r(3098),R=r(22337);function w(){var e=(0,p.v9)(function(e){return{changelog:(0,x.Sx)(e),packageManager:(0,x.Ak)(e),isChangelogLoading:(0,V.hg)(e,L.z.CHANGELOG)}}),n=e.changelog,r=e.packageManager,i=e.isChangelogLoading,t=n.sliceMachine.versions[0],o=(0,g.useState)(t||void 0),a=o[0],h=o[1];(0,g.useEffect)(function(){h(t)},[t]);var u=0===n.sliceMachine.versions.length||!a;return(0,s.jsx)(R.LN,{children:(0,s.jsx)(R.RN,{children:(0,s.jsx)(l.xR,{sx:{display:"flex",minWidth:0},children:i?(0,s.jsx)(c._3,{}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(m,{changelog:n,selectedVersion:a,selectVersion:function(e){return h(e)}}),u?(0,s.jsx)(d.kC,{sx:{paddingLeft:"32px"},children:(0,s.jsx)(S,{})}):(0,s.jsx)(M,{changelog:n,selectedVersion:a,packageManager:r})]})})})})}function H(){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a(),{children:(0,s.jsx)("title",{children:"Changelog - Slice Machine"})}),(0,s.jsx)(w,{})]})}}},function(e){e.O(0,[870,774,888,179],function(){return e(e.s=37782)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[849],{21985:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changes",function(){return t(4920)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return u}});var s=t(62230),i=t(85244),r=t(98240),a=t(52322),o=t(2784),c=t(75289),l=function(e,n){return e?"".concat(e,"-").concat(n):""},d=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},u=(0,o.forwardRef)(function(e,n){var t=e.label,o=e.Icon,u=e.type,h=e.form,x=e.isLoading,m=void 0!==x&&x,f=e.disabled,p=e.onClick,g=e.sx,j=e.iconSize,v=void 0===j?16:j,y=e.iconFill,b=e.variant,_=void 0===b?"primary":b,C=(0,r.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,a.jsx)(c.zx,(0,i.Z)((0,s.Z)({ref:n,sx:(0,s.Z)((0,i.Z)((0,s.Z)({},void 0===g?{}:g),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),m?{cursor:"wait !important"}:{}),type:u,form:h,disabled:void 0!==f&&f||m,onClick:m?void 0:p,variant:_},C),{children:m?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.$j,{size:v,color:d(_),"data-cy":l(C["data-cy"],"spinner")}),o&&t]}):(0,a.jsxs)(a.Fragment,{children:[o&&(0,a.jsx)(o,{size:v,fill:y,"data-cy":l(C["data-cy"],"icon")}),t]})}))})},59469:function(e,n,t){"use strict";var s=t(62230),i=t(52322),r=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,a=e.defineElementKey,o=e.gridTemplateMinPx,c=e.gridGap,l=e.sx;return(0,i.jsx)(r.xu,{as:"section",sx:(0,s.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===o?"320px":o,", 1fr))"),gridGap:void 0===c?"16px":c,pt:2},l),children:n.map(function(e,n){return e?(0,i.jsx)("span",{children:t(e,n)},"".concat(a(e),"-").concat(n+1)):null})})}},4920:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ed}});var s=t(52322),i=t(22715),r=t(2784),a=t(97729),o=t.n(a),c=t(65077),l=t(56580),d=t(22337),u=t(75289),h=t(951),x=function(e){var n=e.children;return(0,s.jsx)(u.kC,{sx:{alignItems:"center",justifyContent:"space-between",mt:"8px",bg:"grey02",borderRadius:4,padding:"12px 16px"},children:n})},m=t(39097),f=t.n(m),p=t(7819),g=t(34728),j=t(67445),v=function(e){var n=e.ct,t=e.status,i=e.authStatus,r=e.isOnline;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.xu,{as:"td",style:{width:"40%"},children:(0,s.jsx)(u.xv,{sx:{fontWeight:500},children:n.label})}),(0,s.jsx)(u.xu,{as:"td",style:{width:"40%"},children:n.id}),(0,s.jsx)(u.xu,{as:"td",style:{width:"20%"},children:(0,s.jsx)(g.O,{authStatus:i,isOnline:r,modelStatus:t,modelType:"CustomType"})})]})},y=function(e){var n=e.customTypes,t=e.modelsStatuses,i=e.authStatus,r=e.isOnline;return(0,s.jsxs)(u.xu,{as:"table","data-legacy-component":!0,children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"transparent small",children:[(0,s.jsx)(u.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"Name"}),(0,s.jsx)(u.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"API ID"}),(0,s.jsx)(u.xu,{as:"th",sx:{width:"20%",fontWeight:600},children:"Status"})]})}),(0,s.jsx)("tbody",{children:n.map(function(e){return(0,p.TG)(e)?(0,s.jsx)(f(),{passHref:!0,href:j.cd[e.local.format].getBuilderPagePathname(e.local.id),legacyBehavior:!0,children:(0,s.jsx)("tr",{tabIndex:0,"data-cy":"custom-type-".concat(e.local.id),children:(0,s.jsx)(v,{ct:e.local,status:t.customTypes[e.local.id],authStatus:i,isOnline:r,modelsStatuses:t},e.local.id)})},e.local.id):(0,s.jsx)("tr",{tabIndex:0,className:"disabled","data-cy":"custom-type-".concat(e.remote.id),children:(0,s.jsx)(v,{ct:e.remote,status:t.customTypes[e.remote.id],authStatus:i,isOnline:r,modelsStatuses:t},e.remote.id)})})})]})},b=t(59469),_=t(84449),C=t(5479),S=t(47731),D=t(32681),T=t(65958),k=function(e){var n=e.unSyncedCustomTypes,t=e.unSyncedSlices,i=e.modelsStatuses,r=e.authStatus,a=e.isOnline,o=(0,S.H)(),c=o.modalPayload,l=o.onOpenModal,d=c.sliceFilterFn,m=c.defaultVariationSelector,f=t.filter(function(e){return i.slices[e.model.id]!==D.G.Deleted});return(0,s.jsxs)(s.Fragment,{children:[n.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(x,{children:(0,s.jsxs)(u.xu,{children:[(0,s.jsx)(u.xv,{variant:"heading",children:"Types"}),(0,s.jsx)(u.xv,{variant:"grey",sx:{ml:"8px"},children:n.length})]})}),(0,s.jsx)(y,{customTypes:n,modelsStatuses:i,authStatus:r,isOnline:a})]}),t.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.xu,{sx:{mb:"8px"},children:(0,s.jsxs)(x,{children:[(0,s.jsxs)(u.xu,{children:[(0,s.jsx)(u.xv,{variant:"heading",children:"Slices"}),(0,s.jsx)(u.xv,{variant:"grey",sx:{ml:"8px"},children:t.length})]}),(0,s.jsxs)(u.xu,{children:[t.some(function(e){return(0,C.cx)(e)>0&&i.slices[e.model.id]!==D.G.Deleted})&&(0,s.jsxs)(u.xv,{sx:{mr:3,color:"warning02",fontSize:"12px",lineHeight:"16px",fontWeight:600},children:[(0,s.jsx)(h.sQg,{size:16,style:{marginRight:"4px",position:"relative",top:"3px"}}),"Missing Screenshots"]}),(0,s.jsxs)(u.zx,{variant:"darkSmall",onClick:function(){return l({sliceFilterFn:function(e){return e}})},children:[(0,s.jsx)(h.hOO,{style:{color:"#FFF",fontSize:"15px",position:"relative",top:"3px",marginRight:"4px"}})," ","Update all screenshots"]})]})]})}),(0,s.jsx)(b.Z,{gridGap:"32px 16px",elems:t,gridTemplateMinPx:"305px",defineElementKey:function(e){return e.model.name},renderElem:function(e){var n=i.slices[e.model.id];return(0,s.jsx)(T.b,{action:{type:"status",authStatus:r,isOnline:a,modelStatus:n},isDeleted:n===D.G.Deleted,mode:"navigation",onUpdateScreenshot:function(){l({sliceFilterFn:function(n){return n.filter(function(n){return n.model.id===e.model.id})}})},slice:e,variant:"solid"})}}),(0,s.jsx)(_.Z,{slices:d(f),defaultVariationSelector:m})]})]})},z=t(91914),O=function(){return(0,s.jsx)(u.kC,{sx:{justifyContent:"center",alignItems:"center",flex:1},children:(0,s.jsxs)(u.kC,{sx:{flexDirection:"column",alignItems:"center",transform:"translateY(-50%)"},children:[(0,s.jsx)(z.wQ1,{size:48}),(0,s.jsx)(u.xv,{sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",mb:"8px",mt:"2px"},children:"No internet connection"}),(0,s.jsx)(u.xv,{sx:{fontSize:"13px",lineHeight:"24px"},children:"You need a stable internet connection to review and push changes"})]})})},w=t(90374),Z=t(79096),R=function(e){var n=e.authStatus,t=(0,w.Z)().openLoginModal;return(0,s.jsxs)(i.xu,{flexDirection:"column",height:"100%",alignItems:"center",justifyContent:"center",gap:8,children:[n===Z.t.FORBIDDEN?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.xv,{variant:"h3",children:"It seems like you are logged out"}),(0,s.jsx)(i.xv,{children:"Log in to connect to your repository."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.xv,{variant:"h3",children:"It seems like you don't have access to this repository"}),(0,s.jsx)(i.xv,{children:"Check that the repository name is correct, then contact your repository administrator."})]}),(0,s.jsxs)(i.xv,{children:["If that doesn't work, it's possible that Slice Machine is having trouble accessing Prismic's servers."," ",(0,s.jsx)(i.hh,{href:"https://community.prismic.io/",children:"Contact our support team"}),"."]}),n===Z.t.FORBIDDEN&&(0,s.jsx)(i.zx,{onClick:function(){return t()},children:"Log in to Prismic"})]})},E=t(5632),N=t.n(E),F=t(2754),I=t(34543),M=t(62230),P=t(85244),H=t(98240),W=t(6277);t(25977);var A={primary:"_1ecs97dbc8 _1ecs97dbjl _1ecs97dbc2 _1ecs97dbjf _1ecs97dbca _1ecs97dbjn",secondary:"_1ecs97daji _1ecs97dah3 _1ecs97dajc _1ecs97dagx _1ecs97dajk _1ecs97dah5"},B={normal:"ovkapw1",smallBold:"ovkapw2",inherit:"ovkapw3 _1ecs97df47"},G=function(e){var n=e.children,t=e.color,a=e.endIcon,o=e.href,c=e.textVariant,l=void 0===c?"smallBold":c,d=(0,H.Z)(e,["children","color","endIcon","href","textVariant"]);return(0,s.jsxs)("a",(0,P.Z)((0,M.Z)({href:o,target:"_blank",rel:"noreferrer"},d),{className:(0,W.Z)("ovkapw0 _1ecs97dez0 _1ecs97df41 _1ecs97dez2 _1ecs97dez8",A[void 0===t?"primary":t]),children:[(0,s.jsx)(i.xv,{component:"span",color:"inherit",variant:l,children:n}),(0,r.isValidElement)(a)?(0,r.cloneElement)(a,{className:(0,W.Z)(a.props.className,"_1ecs97dfhw",B[l])}):null]}))},L=t(39092),U=function(){var e,n=(e=(0,l.v9)(function(e){return{repoName:(0,L.MY)(e)}}).repoName,"https://".concat(e,".prismic.io/documents/working"));return(0,s.jsxs)(F.R$,{style:{alignSelf:"center",marginTop:i.TV.size[72]},children:[(0,s.jsx)(F.u2,{children:(0,s.jsx)(i.Ee,{src:"/blank-slate-changes-uptodate.png",sizing:"cover"})}),(0,s.jsxs)(F.T9,{children:[(0,s.jsx)(F._T,{children:"Everything up-to-date"}),(0,s.jsx)(F.nf,{children:"You have no changes staged. Your changes appear here after you have saved them, while they're waiting to be pushed to the Page Builder. Ready to get going?"}),(0,s.jsxs)(F.Qj,{children:[(0,s.jsx)(i.zx,{onClick:function(){N().push("/")},children:"Create a page type"}),(0,s.jsx)(G,{endIcon:(0,s.jsx)(I.AlO,{}),textVariant:"normal",href:n,children:"Create content"})]})]})]})},V=t(67764),Y=t(32665),X=t(3098),q=t(56577),Q=t(24340),$=t(77174),J=t(49471),K=t(40432),ee=t(78656),en=function(e){var n=e.ctName,t=e.numberOfDocuments,i=e.link,r=e.isOverLimit;return(0,s.jsxs)(u.Zb,{sx:{mb:12},variant:"drawerCard","data-cy":"AssociatedDocumentsCard-".concat(n),children:[(0,s.jsxs)(u.kC,{sx:{flexDirection:"column"},children:[(0,s.jsx)(u.xv,{children:n}),(0,s.jsxs)(u.xv,{sx:{color:"textClear",fontSize:"12px",lineHeight:"16px"},children:[t," documents"]})]}),(0,s.jsx)(u.rU,{href:i,target:"_blank",variant:"cardSmall",sx:{color:void 0!==r&&r?"danger":"purple08"},children:"View documents"})]})},et=function(e){var n=e.format,t=e.id,i=e.name;return(0,s.jsxs)(u.Zb,{sx:{mb:12},variant:"drawerCard","data-cy":"CustomTypesReferencesCard-".concat(i),children:[(0,s.jsxs)(u.kC,{sx:{flexDirection:"column"},children:[(0,s.jsx)(u.xv,{children:i}),(0,s.jsx)(u.xv,{sx:{color:"textClear",fontSize:"12px",lineHeight:"16px"},children:"Missing Slices"})]}),(0,s.jsxs)(u.rU,{href:j.cd[n].getBuilderPagePathname(t),target:"_blank",variant:"cardSmall",children:["View ",ee.$[n].name({start:!1,plural:!1})]},t)]})},es=t(79797),ei=t(54132),er=function(e){var n=e.isOpen,t=e.title,i=e.footer,r=e.explanations,a=(0,w.Z)().closeModals;return(0,s.jsx)(es.Z,{placement:"right",open:n,level:null,onClose:a,width:496,children:(0,s.jsx)(ei.Z,{radius:"0px",bodySx:{bg:"white",padding:24,flex:1,display:"flex",flexDirection:"column",overflow:"scroll"},footerSx:{p:0},sx:{flexDirection:"column",display:"flex",height:"100%",border:"none"},borderFooter:!0,Header:function(){return(0,s.jsxs)(u.kC,{sx:{p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,s.jsx)(u.kC,{sx:{alignItems:"center"},children:(0,s.jsx)(u.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:t})}),(0,s.jsx)(u.x8,{type:"button",onClick:function(){return a()}})]})},Footer:function(){return(0,s.jsx)(u.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center",paddingRight:16,borderTop:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorders))},backgroundColor:"white",padding:20},children:i})},children:r})})},ea=function(e){var n=e.onToggle,t=e.isConfirmed,i=e.sx;return(0,s.jsxs)(u.kC,{sx:(0,M.Z)({borderRadius:6,flexDirection:"column",backgroundColor:"grey03",padding:12,width:"100%"},i),children:[(0,s.jsx)(u.xv,{sx:{fontWeight:"bold",mb:2},children:"Are you sure to proceed?"}),(0,s.jsxs)(u.__,{sx:{mt:"4px",py:1},variant:"large",children:[(0,s.jsx)(u.XZ,{defaultChecked:t,onChange:n,variant:"forms.checkbox.dark"}),"Delete these Documents"]})]})},eo=function(e){var n=e.pushChanges,t=(0,r.useState)(!1),i=t[0],a=t[1],o=(0,l.v9)(function(e){return{isDeleteDocumentsDrawerOpen:(0,$.gP)(e,Q.q.SOFT_DELETE_DOCUMENTS_DRAWER),remoteOnlyCustomTypes:(0,J.Ch)(e).filter(p.yp),modalData:e.pushChanges}}),c=o.isDeleteDocumentsDrawerOpen,d=o.remoteOnlyCustomTypes,h=o.modalData,x=(0,w.Z)(),m=x.closeModals,f=x.openToaster;if(!c)return null;if((null==h?void 0:h.type)!=="SOFT")return f("No change data",K.Jf.ERROR),null;var g=h.details.customTypes.map(function(e){var n,t=d.find(function(n){return(0,p.n5)(n)===e.id});return void 0===t?null:(0,s.jsx)(en,{isOverLimit:!0,ctName:null!==(n=t.remote.label)&&void 0!==n?n:t.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,s.jsx)(er,{isOpen:c,title:"Confirm deletion",footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ea,{onToggle:function(){a(!i)},isConfirmed:i,sx:{mb:10}}),(0,s.jsx)(q.z,{label:"Push changes",variant:"primary",onClick:function(){m(),n(i)},disabled:!i,sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}})]}),explanations:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:"This action will also delete Documents."}),(0,s.jsxs)(u.xv,{sx:{mb:24},children:[h.details.customTypes.length>1?"These types have":"This type has"," ","associated Documents, which will also be deleted. This might create broken links in your repository."]}),g]})})},ec=function(e){var n=e.pushChanges,t=(0,l.v9)(function(e){return{isDeleteDocumentsDrawerOpen:(0,$.gP)(e,Q.q.HARD_DELETE_DOCUMENTS_DRAWER),remoteOnlyCustomTypes:(0,J.Ch)(e).filter(p.yp),modalData:e.pushChanges}}),i=t.isDeleteDocumentsDrawerOpen,r=t.remoteOnlyCustomTypes,a=t.modalData,o=(0,w.Z)(),c=o.closeModals,d=o.openToaster;if(!i)return null;if((null==a?void 0:a.type)!=="HARD")return d("No change data",K.Jf.ERROR),null;var h=a.details.customTypes.map(function(e){var n,t=r.find(function(n){return(0,p.n5)(n)===e.id});return void 0===t?null:(0,s.jsx)(en,{isOverLimit:!0,ctName:null!==(n=t.remote.label)&&void 0!==n?n:t.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,s.jsx)(er,{isOpen:i,title:"Manual action required",footer:(0,s.jsx)(q.z,{label:"Try again",variant:"primary",onClick:function(){c(),n(!1)},sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}}),explanations:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(u.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:["Your type",a.details.customTypes.length>1&&"s"," cannot be deleted."]}),(0,s.jsxs)(u.xv,{sx:{mb:24},children:[a.details.customTypes.length>1?"These types have":"This type has"," ","too many associated Documents. Archive and delete these Documents manually and then try deleting the types again."]}),h]})})},el=function(e){var n=e.pushChanges,t=(0,l.v9)(function(e){return{isOpen:(0,$.gP)(e,Q.q.REFERENCES_MISSING_DRAWER),localCustomTypes:(0,J.Ch)(e).filter(p.TG),modalData:e.pushChanges}}),i=t.isOpen,r=t.modalData,a=t.localCustomTypes,o=(0,w.Z)(),c=o.closeModals,d=o.openToaster;if(!i)return null;if((null==r?void 0:r.details)===void 0)return d("No change data",K.Jf.ERROR),null;var h=(null==r?void 0:r.details.customTypes.length)>1,x=r.details.customTypes.map(function(e){var n,t=a.find(function(n){return(0,p.n5)(n)===e.id});return void 0===t?null:(0,s.jsx)(et,{format:t.local.format,id:t.local.id,name:null!==(n=t.local.label)&&void 0!==n?n:t.local.id})});return(0,s.jsx)(er,{isOpen:i,title:"Missing Slices",footer:(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(q.z,{label:"Try again",variant:"primary",onClick:function(){c(),n(!1)},sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}})}),explanations:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(u.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:["You have",h?"":" a"," type",h?"s":""," that reference"," ",h?"":"s"," one or more missing Slices"]}),(0,s.jsxs)(u.xv,{sx:{mb:24},children:["Before pushing, remove references to any missing Slices by opening"," ","the affected type",h?"s":""," and clicking the"," ",(0,s.jsx)("b",{children:"Save"})," button."]}),x]})})},ed=function(){var e=(0,V.X)(),n=e.unSyncedSlices,t=e.unSyncedCustomTypes,a=e.modelsStatuses,u=e.authStatus,h=e.isOnline,x=(0,r.useMemo)(function(){var e;return{changedSlices:n.map(function(e){return{slice:e,status:a.slices[e.model.id]}}).filter(function(e){return V.O.includes(e.status)}),changedCustomTypes:t.map(function(e){return(0,p.TG)(e)?e.local:e.remote}).map(function(e){return{customType:e,status:a.customTypes[e.id]}}).filter(function(e){return V.O.includes(e.status)})}},[n,t,a]),m=x.changedSlices,f=x.changedCustomTypes,g=(0,w.Z)(),j=g.pushChanges,v=g.closeModals,y=(0,l.v9)(function(e){return{isSyncing:(0,Y.hg)(e,X.z.CHANGES_PUSH)}}).isSyncing;(0,r.useEffect)(function(){return function(){v()}},[]);var b=n.length+t.length,_=function(e){return j({confirmDeleteDocuments:e,changedSlices:m,changedCustomTypes:f})},C=(0,r.useMemo)(function(){return h?u===Z.t.UNAUTHORIZED||u===Z.t.FORBIDDEN?(0,s.jsx)(R,{authStatus:u}):0===b?(0,s.jsx)(U,{}):(0,s.jsx)(k,{unSyncedSlices:n,unSyncedCustomTypes:t,modelsStatuses:a,authStatus:u,isOnline:h}):(0,s.jsx)(O,{})},[h,u,b,n,t,a,]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o(),{children:(0,s.jsx)("title",{children:"Changes - Slice Machine"})}),(0,s.jsxs)(d.LN,{children:[(0,s.jsxs)(d.wd,{children:[(0,s.jsx)(d.Cx,{folder:"Changes"}),(0,s.jsx)(d.K2,{children:(0,s.jsx)(i.zx,{onClick:function(){return _(!1)},loading:y,disabled:0===b||!h||u===Z.t.UNAUTHORIZED||u===Z.t.FORBIDDEN||y,"data-cy":"push-changes",children:"Push Changes"})})]}),(0,s.jsx)(d.RN,{children:(0,s.jsxs)(c.xR,{sx:{display:"flex",flexDirection:"column"},children:[C,(0,s.jsx)(eo,{pushChanges:_}),(0,s.jsx)(ec,{pushChanges:_}),(0,s.jsx)(el,{pushChanges:_})]})})]})]})}},2754:function(e,n,t){"use strict";t.d(n,{R$:function(){return d},Qj:function(){return f},T9:function(){return h},nf:function(){return m},u2:function(){return u},_T:function(){return x}});var s=t(67557),i=t(62230),r=t(85244),a=t(98240),o=t(52322),c=t(6277),l=t(22715);t(69143);var d=function(e){var n=e.backgroundImage,t=e.style,l=(0,a.Z)(e,["backgroundImage","style"]),d=void 0!==n;return(0,o.jsx)("article",(0,r.Z)((0,i.Z)({},l),{className:(0,c.Z)("_18bjhbz0 _1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97dfiv _1ecs97dfix _1ecs97dfiz _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dezp",(0,s.Z)({},"_18bjhbz1 _1ecs97dezx _1ecs97df4v",d)),style:(0,i.Z)({backgroundImage:d?"url(".concat(n,")"):void 0},t)}))},u=function(e){return(0,o.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97d6r8 _1ecs97d6yl _1ecs97df29 _1ecs97df2l _1ecs97dezp"}))},h=function(e){return(0,o.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz3 _1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97dffv"}))},x=function(e){return(0,o.jsx)(l.xv,(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz4"}))},m=function(e){return(0,o.jsx)(l.xv,(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz5",color:"grey11"}))},f=function(e){return(0,o.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz6 _1ecs97dez0 _1ecs97dez8 _1ecs97dez1 _1ecs97dez2 _1ecs97df95 _1ecs97dfdl",color:"grey"}))}},69143:function(){},25977:function(){}},function(e){e.O(0,[789,123,918,958,80,774,888,179],function(){return e(e.s=21985)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[33],{30755:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]/simulator",function(){return t(23261)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var r=t(62230),i=t(85244),o=t(98240),s=t(52322),c=t(2784),a=t(75289),l=function(e,n){return e?"".concat(e,"-").concat(n):""},u=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,x=e.form,f=e.isLoading,h=void 0!==f&&f,p=e.disabled,v=e.onClick,m=e.sx,g=e.iconSize,b=void 0===g?16:g,C=e.iconFill,j=e.variant,S=void 0===j?"primary":j,k=(0,o.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,s.jsx)(a.zx,(0,i.Z)((0,r.Z)({ref:n,sx:(0,r.Z)((0,i.Z)((0,r.Z)({},void 0===m?{}:m),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),h?{cursor:"wait !important"}:{}),type:d,form:x,disabled:void 0!==p&&p||h,onClick:h?void 0:v,variant:S},k),{children:h?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.$j,{size:b,color:u(S),"data-cy":l(k["data-cy"],"spinner")}),c&&t]}):(0,s.jsxs)(s.Fragment,{children:[c&&(0,s.jsx)(c,{size:b,fill:C,"data-cy":l(k["data-cy"],"icon")}),t]})}))})},61931:function(e,n,t){"use strict";t.d(n,{q:function(){return l}});var r=t(62230),i=t(52322),o=t(2784),s=t(75289),c=t(65186),a=(0,o.memo)(function(e){var n=e.src;return(0,i.jsx)(s.Ee,{src:n,alt:"Preview image",sx:{maxHeight:"100%"}})}),l=function(e){var n=e.src,t=e.sx;return(0,i.jsx)(s.kC,{sx:(0,r.Z)({position:"relative",alignItems:"center",justifyContent:"center",overflow:"hidden",backgroundImage:"url(/pattern.png)",backgroundColor:"headSection",backgroundRepeat:"repeat",backgroundSize:"20px",borderRadius:"4px"},t),children:void 0!==n?(0,i.jsx)(a,{src:n}):(0,i.jsxs)(s.xv,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,i.jsx)(c.eJU,{}),"You have no screenshot yet."]})})}},23261:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return eS}});var r,i,o,s,c=t(52322),a=t(97729),l=t.n(a),u=t(62230),d=t(85244),x=t(2784),f=t(71463),h=t(22715),p=t(75289),v=t(65077),m=t(5632),g=t.n(m),b=t(56577),C=t(19909),j=function(e){var n=e.defaultValue,t=e.variations,r=e.MenuItemAction,i=e.onChange;return(0,c.jsxs)(p.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"4px",border:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:250,maxWidth:350,color:"text"},children:[(0,c.jsxs)(p.xv,{sx:{p:3,fontSize:12,color:"textClear"},children:[t.length," VARIATION",t.length>1?"S":""]}),(0,c.jsxs)(p.kC,{sx:{p:0,flexDirection:"column"},children:[t.map(function(e){return(0,c.jsx)(S,{value:e,isActive:e.id===n.id,onClick:i},e.id)}),r||null]})]})},S=function(e){var n=e.value,t=e.isActive,r=e.onClick;return(0,c.jsx)(p.xu,{sx:{px:3,py:2,color:t?"primary":"",cursor:"pointer",borderLeft:function(e){var n=e.colors;return"2px solid ".concat(t?null==n?void 0:n.primary:null==n?void 0:n.background)},borderRadius:0,bg:"background",":hover":{bg:"hoverBackground",borderLeft:function(e){var n=e.colors;return"2px solid ".concat(null==n?void 0:n.primary)}}},onClick:function(){return r(n)},children:n.name})},k=t(75100),y=function(e){var n=e.buttonSx,t=e.defaultValue,r=e.variations,i=e.onNewVariation,o=e.onChange,s=e.sx,a=e.disabled,l=(0,x.useState)(!1),d=l[0],f=l[1],h=(0,x.useState)(t||r[0]),v=h[0],m=h[1];(0,x.useEffect)(function(){t&&m(t)},[t]);var g=function(e){f(!1),m(e),setTimeout(function(){return o(e)},210)},b=(0,c.jsx)(p.xu,{sx:{p:2},children:(0,c.jsx)(p.zx,{variant:"transparent",sx:{color:"text"},onClick:function(){f(!1),i&&i()},children:"+ Add new variation"})});return(0,c.jsx)(p.xu,{sx:s,children:(0,c.jsx)(C.Popover,{align:"start",isOpen:d,onClickOutside:function(){return f(!1)},positions:["bottom"],padding:10,content:function(){return(0,c.jsx)(j,{defaultValue:v,variations:r,onChange:g,MenuItemAction:i?b:void 0})},containerClassName:"variationSelectorContainer",children:(0,c.jsxs)(p.zx,{sx:(0,u.Z)({},n),variant:"dropDownButton",onClick:function(){return f(!d)},disabled:a,children:[v.name," ",d?(0,c.jsx)(k.bOz,{size:"16px","aria-label":"Collapse variations"}):(0,c.jsx)(k.mEq,{size:"16px","aria-label":"Expand variations"})]})})})},E=function(e){return(0,c.jsxs)("svg",(0,d.Z)((0,u.Z)({viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,c.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.3304 19.693C50.9182 18.9787 50.2527 18.6526 50.2527 18.6526L64.7906 10.2077C65.5266 9.78011 66.4679 10.0339 66.8929 10.7745C67.3179 11.5151 67.0657 12.4622 66.3294 12.8898L52.639 20.8424C52.639 20.8424 51.7428 20.4072 51.3304 19.693Z",fill:"current"}),(0,c.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M47.6775 54.7814C58.0794 48.7394 61.6433 35.3572 55.6378 24.8917C54.7801 23.397 53.7736 22.0427 52.6481 20.8367L32.9428 32.2832C32.2068 32.7108 31.2655 32.457 30.8405 31.7165C30.4155 30.9757 30.6677 30.0287 31.4039 29.6011L50.2693 18.6425C43.486 13.2668 33.8645 12.2736 25.9299 16.8827C15.5282 22.9249 11.9642 36.3071 17.9697 46.7727C18.8274 48.2671 19.8339 49.6216 20.9595 50.8276L41.1791 39.0822C41.9151 38.6546 42.8564 38.9086 43.2814 39.6492C43.7064 40.3897 43.4542 41.3368 42.7182 41.7644L23.3384 53.0217C30.1217 58.3975 39.7432 59.3906 47.6775 54.7814Z",fill:"current"}),(0,c.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.20645 61.7656C4.78145 61.0248 5.03367 60.078 5.76978 59.6502L20.9371 50.8398C20.9371 50.8398 21.8578 51.2406 22.3053 51.7062C22.7528 52.1717 23.361 53.0078 23.361 53.0078L7.30887 62.3323C6.57274 62.7599 5.63144 62.5061 5.20645 61.7656Z",fill:"current"})]}))},w=t(56580),I=t(52039),_=function(e,n,t){if(!n){g().push("/".concat(e.href,"/").concat(e.model.name));return}var r,i,o,s,c,a,l,u,d,x=(i=(r={lib:e.href,sliceName:e.model.name,variationId:null==n?void 0:n.id,isSimulator:t}).lib,o=r.sliceName,s=r.variationId,a=void 0===(c=r.options)?{}:c,l=r.isSimulator,u="/slices/[lib]/[sliceName]/[variation]".concat(l?"/simulator":""),d="/slices/".concat(i,"/").concat(o,"/").concat(s).concat(l?"/simulator":""),{href:u,as:d,options:a,all:[u,d,a]});g().push(x.href,x.as,x.options)},D=function(e){var n=e.slice,t=e.variation,r=e.isDisplayEditor,i=e.toggleIsDisplayEditor,o=e.onSaveMock,s=e.actionsDisabled,a=(0,w.v9)(function(e){return{savingMock:(0,I.S3)(e)}}).savingMock;return(0,c.jsxs)(p.kC,{sx:{p:"16px",display:"flex",bg:"grey07",gridTemplateRows:"1fr",borderBottom:"1px solid #DCDBDD",justifyContent:"space-between"},children:[(0,c.jsxs)(p.kC,{sx:{alignItems:"center"},children:[(0,c.jsx)(E,{height:"20px",width:"20px",fill:"#1A1523"}),(0,c.jsx)(p.xv,{sx:{ml:2,mr:"12px",fontSize:"14px",color:"#1A1523",fontWeight:"600",letterSpacing:"-0.15px"},children:n.model.name}),(0,c.jsx)(y,{defaultValue:t,variations:n.model.variations,onChange:function(e){return _(n,e,!0)},disabled:n.model.variations.length<=1||s})]}),(0,c.jsxs)(p.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,c.jsx)(p.kC,{sx:{alignItems:"center",justifyContent:"space-around"},children:(0,c.jsxs)(p.kC,{sx:{alignItems:"center",mr:4},children:[(0,c.jsx)(p.__,{htmlFor:"show-mock-editor",sx:{color:"#6F6E77",lineHeight:"16px",fontSize:"12px",fontWeight:"600",letterSpacing:"0px"},children:"Editor"}),(0,c.jsx)(p.rs,{id:"show-mock-editor",checked:r,onChange:i,disabled:s})]})}),(0,c.jsx)(b.z,{"data-cy":"save-mock",onClick:o,label:"Save mock content",disabled:a||s,variant:"primary",sx:{borderRadius:"6px",color:"#F1EEFE",fontWeight:"bold",border:"1px solid #5842C3",backgroundColor:"#6E56CF",boxShadow:"0px 1px 0px rgba(0, 0, 0, 0.04)","&:hover":{"&:not([disabled])":{backgroundColor:"#5842C3"}}}})]})]})},Z=t(82770),F=t(39092),R=function(e){var n=e.defaultValue,t=e.options,r=e.onChange;return(0,c.jsx)(p.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"6px",border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:180,maxWidth:350,color:"text"},children:(0,c.jsx)(p.kC,{sx:{p:0,flexDirection:"column"},children:t.map(function(e){return(0,c.jsx)(z,{value:e,isActive:e===n,onClick:r})})})})},z=function(e){var n=e.value,t=e.isActive,r=e.onClick;return(0,c.jsx)(p.xu,{sx:{p:2,cursor:"pointer",fontSize:"14px",borderRadius:0,bg:t?"hoverBackground":"background",":hover":{bg:"hoverBackground"}},onClick:function(){return r(n)},children:n})},N=function(e){var n=e.buttonSx,t=e.currentValue,r=e.options,i=e.onChange,o=e.disabled,s=(0,x.useState)(!1),a=s[0],l=s[1],u=function(e){l(!1),setTimeout(function(){return i(e)},210)};return(0,c.jsx)(p.xu,{children:(0,c.jsx)(C.Popover,{align:"start",isOpen:a,onClickOutside:function(){return l(!1)},positions:["bottom"],padding:2,content:function(){return(0,c.jsx)(R,{defaultValue:t,options:r,onChange:u})},children:(0,c.jsxs)(p.zx,{sx:n,variant:"dropDownButton",onClick:function(){return l(!a)},disabled:o,children:[t," ",a?(0,c.jsx)(k.bOz,{size:"24px"}):(0,c.jsx)(k.mEq,{size:"24px"})]})})})},O=t(67557);(s=r||(r={})).DESKTOP="Desktop",s.TABLET="Tablet",s.MOBILE="Mobile",s.CUSTOM="Custom";var T=(i={},(0,O.Z)(i,r.DESKTOP,{width:1280,height:800}),(0,O.Z)(i,r.TABLET,{width:1080,height:810}),(0,O.Z)(i,r.MOBILE,{width:390,height:844}),i),A=function(e){var n=e.label,t=e.startValue,r=e.onChange,i=e.sx,o=e.disabled,s=["e","-","+",",","."];return(0,c.jsxs)(p.kC,{sx:(0,u.Z)({alignItems:"center"},i),children:[(0,c.jsx)(p.__,{sx:{backgroundColor:"grey07",border:"transparent",borderRight:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},borderRadius:"6px 0px 0px 6px",width:26,height:30,color:"greyIcon",fontWeight:"bold",fontSize:"14px",alignItems:"center",justifyContent:"center",position:"absolute",ml:"1px"},htmlFor:"".concat(n,"-screensize-input"),children:n}),(0,c.jsx)(p.II,{type:"number",name:"".concat(n,"-screensize-input"),disabled:o,sx:{width:80,height:32,p:0,border:"1px solid #E4E2E4",borderRadius:"6px","&::-webkit-outer-spin-button,&::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},color:"greyIcon",textAlign:"center",paddingLeft:26,"&:disabled":{cursor:"not-allowed","&:hover":{border:"1px solid #E4E2E4"},"&:active":{border:"1px solid #E4E2E4",boxShadow:"none"}}},onChange:r,value:t,min:"0",onKeyDown:function(e){s.includes(e.key)&&e.preventDefault()}})]})},L=function(e){var n=e.handleScreenSizeChange,t=e.screenDimensions,i=e.actionsDisabled,o=(0,x.useState)(r.DESKTOP),s=o[0],a=o[1],l=function(e){a(e),e!==r.CUSTOM&&n(T[e])},f=function(e){var t=Object.values(T).findIndex(function(n){return JSON.stringify(n)===JSON.stringify(e)}),i=t<0?r.CUSTOM:Object.keys(T)[t];a(i),n(e)};return(0,c.jsx)(p.kC,{sx:{alignItems:"center",pb:"16px",justifyContent:"space-between",variant:"small"},children:(0,c.jsxs)(p.kC,{sx:{alignItems:"center",flex:1},children:[(0,c.jsx)(N,{options:Object.values(r),onChange:l,buttonSx:{alignSelf:"start"},currentValue:s,disabled:i}),(0,c.jsx)(A,{label:"W",startValue:t.width.toString(),onChange:function(e){f((0,d.Z)((0,u.Z)({},t),{width:Number(e.target.value)}))},disabled:i,sx:{mx:2}}),(0,c.jsx)(k.eSQ,{size:16,color:"#6F6E77"}),(0,c.jsx)(A,{label:"H",startValue:t.height.toString(),onChange:function(e){f((0,d.Z)((0,u.Z)({},t),{height:Number(e.target.value)}))},disabled:i,sx:{ml:2}})]})})},M=t(25812),U=t(77174),P=t(24340),W=t(90374),B=t(54132),H=t(61931),V=function(e){var n=e.sliceName,t=e.screenshotUrl,r=(0,w.v9)(function(e){return{isScreenshotModalOpen:(0,U.gP)(e,P.q.SCREENSHOT_PREVIEW)}}).isScreenshotModalOpen,i=(0,W.Z)().closeModals;return(0,c.jsx)(M.Z,{isOpen:r,shouldCloseOnOverlayClick:!0,contentLabel:"Screenshot Preview",portalClassName:"ScreenshotPreviewModal",onRequestClose:i,children:(0,c.jsx)(B.Z,{radius:"0px",bodySx:{p:0,bg:"#FFF",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},Header:function(){return(0,c.jsxs)(p.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,c.jsxs)(p.X6,{sx:{fontSize:"14px"},children:["Screenshot Preview for ",n]}),(0,c.jsx)(p.x8,{type:"button",onClick:function(){return i()}})]})},Footer:function(){return(0,c.jsx)(p.kC,{style:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:"1px solid #DCDBDD"},children:(0,c.jsx)(p.zx,{variant:"secondary",sx:{fontWeight:600},onClick:function(){return i()},children:"Close"})})},children:(0,c.jsx)(H.q,{src:t,sx:{height:"320px"}})})})},q=t(25242),X=t(81541),G=function(e,n,t){var r=(0,x.useState)(e()),i=r[0],o=r[1],s=(0,x.useRef)(Date.now());return(0,x.useEffect)(function(){var t=setTimeout(function(){Date.now()-s.current>=n&&(o(e()),s.current=Date.now())},n-(Date.now()-s.current));return function(){clearTimeout(t)}},[n].concat((0,X.Z)(t))),i},K=t(22710),Y=t(17064),J=t(99267),Q=t(16),$=function(e){var n,t,r,i,o,s,a,l=e.apiContent,d=e.screenDimensions,f=e.simulatorUrl,h=e.dryRun,v=e.isScreenshot,m=void 0!==v&&v,g=(0,Y.Z)((t=(n=(0,x.useState)())[0],r=n[1],i=(0,x.useRef)(),o=(0,x.useRef)(),a=(0,x.useCallback)((s=(0,K.Z)(function(e){var n,t,s,c;return(0,J.__generator)(this,function(a){switch(a.label){case 0:if(null===(n=i.current)||void 0===n||n.disconnect(),null===(t=o.current)||void 0===t||t.disconnect(),r(void 0),!(null!=e))return[3,4];i.current=new Q.SH(e),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i.current.connect()];case 2:var l;return a.sent(),r(i.current),l=(0,K.Z)(function(){var e;return(0,J.__generator)(this,function(n){switch(n.label){case 0:return r(void 0),[4,null===(e=i.current)||void 0===e?void 0:e.connect({},!0)];case 1:return n.sent(),r(i.current),[2]}})}),s=function(){return l.apply(this,arguments)},o.current=new MutationObserver(function(e){e.forEach(function(e){"src"===e.attributeName&&s().catch(function(e){throw e})})}),o.current.observe(e,{attributeFilter:["src"]}),[3,4];case 3:return c=a.sent(),console.error(c),[3,4];case 4:return[2]}})}),function(e){return s.apply(this,arguments)}),[]),[t,a]),2),b=g[0],C=g[1],j=(0,W.Z)(),S=j.connectToSimulatorSuccess,k=j.connectToSimulatorFailure;(0,x.useEffect)(function(){var e;if(!f){k();return}if(void 0!==b){if(!b.connected){k(),console.warn("Trying to use a disconnected simulator client.");return}(e=(0,K.Z)(function(){return(0,J.__generator)(this,function(e){switch(e.label){case 0:return[4,b.setSliceZone([l])];case 1:return e.sent(),[2]}})}),function(){return e.apply(this,arguments)})().then(function(){S()}).catch(function(){k()})}},[b,l,f]);var y,E,w,I,_,D,Z,F,R,z=(0,x.useState)(),N=z[0],O=z[1],T=(y=function(e){var n;O({height:e.blockSize,width:e.inlineSize})},w=(0,x.useRef)(),(0,x.useCallback)(function(e){var n;null===(n=w.current)||void 0===n||n.disconnect(),null!==e&&(w.current=new ResizeObserver(function(n){var t,r=(0,Y.Z)(n,1)[0].contentRect;y({blockSize:r.height,inlineSize:r.width},e)}),w.current.observe(e))},[]));return(0,c.jsx)(p.kC,{ref:T,sx:(0,u.Z)({alignItems:"center",backgroundColor:"headSection",backgroundImage:"url(/pattern.png)",backgroundRepeat:"repeat",backgroundSize:"10px",border:m?void 0:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},borderRadius:m?void 0:8,display:"flex",height:"100%",justifyContent:"center",overflow:"hidden"},void 0!==h&&h?{display:"none"}:{}),children:f?(0,c.jsx)("iframe",{ref:C,src:f,style:(0,u.Z)({border:"none",maxHeight:"".concat(d.height,"px"),maxWidth:"".concat(d.width,"px"),minHeight:"".concat(d.height,"px"),minWidth:"".concat(d.width,"px"),overflowY:"auto"},N?{transform:"scale(".concat((I=d,_=N,D=I.height,Z=I.width,F=_.height,R=_.width,Z>R||D>F?Z-R>D-F?R/Z:F/D:1),")")}:{display:"none"})}):null})},ee=function(e){var n=e.children,t=e.sx;return(0,c.jsx)(p.kC,{sx:(0,u.Z)({bg:"grey07",height:"90%",width:"100%",justifyContent:"center",alignItems:"center",zIndex:"1"},t),children:(0,c.jsx)(p.kC,{sx:{marginTop:"-128px",justifyContent:"center",flexDirection:"column",alignItems:"center"},children:n})})},en=t(85819),et=function(e){var n=e.onRetrigger;return(0,c.jsxs)(ee,{children:[(0,c.jsx)(p.Ee,{src:"/iframe-not-running.png",sx:{width:"320px"}}),(0,c.jsx)(p.xv,{sx:{color:"textClear",mb:2,fontSize:"14px",lineHeight:"24px",fontWeight:"600"},children:"Slice Machine can't render your Slice"}),(0,c.jsxs)(p.xv,{sx:{color:"failedConnectText",maxWidth:"400px",textAlign:"center",fontSize:"12px",lineHeight:"22px"},children:["Ensure your website's development server is running by typing",(0,c.jsx)("br",{}),(0,c.jsx)(p.xv,{as:"code",variant:"styles.inlineCode",sx:{padding:"4px",borderRadius:"6px"},children:"npm run dev"}),"\xa0 in your terminal at the root of your website directory.",(0,c.jsx)("br",{})," If that doesn't work, see the\xa0",(0,c.jsx)(p.rU,{target:"_blank",href:"https://prismic.io/docs/slice-machine",sx:{color:"link"},children:"troubleshooting instructions."})]}),(0,c.jsx)(b.z,{onClick:n,label:"Refresh",Icon:en.Fer,iconSize:20,iconFill:"#6F6E77",variant:"secondaryMedium",sx:{mt:"16px"}})]})},er=t(98240),ei=t(92928),eo=t(33402),es=t(59326),ec=t(86741),ea=t(65186),el=function(e){var n=e.children;return(0,c.jsx)(p.xu,{as:"code",sx:{bg:"rgba(0, 0, 0, 0.05)",borderRadius:3,padding:"2px 4px"},children:n})},eu=function(e){var n,t=e.children,r=(0,er.Z)(e,["children"]),i=(0,es.B7)().theme,o=(0,x.useState)(!1),s=o[0],a=o[1],l=(0,x.useRef)(null),f=function(){l.current&&navigator.clipboard.writeText(l.current.innerText).then(function(){a(!0),setTimeout(function(){a(!1)},1200)}).catch(function(){})};return(0,c.jsxs)(p.xu,(0,d.Z)((0,u.Z)({},r),{sx:{backgroundColor:"codeBlockBackground",borderRadius:8},children:[(0,c.jsxs)(p.kC,{sx:{px:"26px",py:"22px",color:"#FFF",flexDirection:"row",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid rgba(111, 110, 119, 0.2)"},children:[(0,c.jsx)(p.kC,{sx:{alignItems:"center"}}),(0,c.jsxs)(p.zx,{onClick:f,variant:"transparent",sx:{display:"flex",justifyContent:"center",alignItems:"center",p:0,fontSize:"12px",color:"#FFF"},children:["Copy\xa0",s?(0,c.jsx)(ea.HhX,{size:16,color:String(null==i?void 0:null===(n=i.colors)||void 0===n?void 0:n.success)}):(0,c.jsx)(ea.Fqs,{size:16,style:{marginLeft:"8px"}})]})]}),(0,c.jsx)(p.xu,{ref:l,as:"pre",sx:{color:"#c9d1d9",padding:"16px 20px",overflow:"auto"},children:t})]}))},ed={code:function(e){var n=e.children;return(0,c.jsx)(el,{children:n})},pre:function(e){var n=e.children,t=(0,er.Z)(e,["children"]);return(0,c.jsx)(eu,(0,d.Z)((0,u.Z)({},t),{children:n}))}},ex=function(e){var n=e.html,t=e.components,r=void 0===t?{}:t,i={replace:function(e){if((0,eo.Z)(e,ec.W_)&&e.attribs){var n=(0,ec.du)(e.children,i),t=(0,u.Z)({},r,ed)[e.name];if(t)return(0,c.jsx)(t,(0,d.Z)((0,u.Z)({name:e.name},e.attribs),{children:n}))}}};return(0,c.jsx)(c.Fragment,{children:(0,ec.ZP)(n,i)})},ef=function(e){var n=e.children.split("`").map(function(e,n){return n%2==1?(0,c.jsx)(el,{children:e}):e});return(0,c.jsx)(c.Fragment,{children:n})},eh=function(e){var n=e.number,t=e.title,r=e.excerpt,i=(0,er.Z)(e,["number","title","excerpt"]);return(0,c.jsx)(ei.OK,(0,d.Z)((0,u.Z)({className:"react-tabs__vertical__tab",selectedClassName:"react-tabs__vertical__tab--selected"},i),{children:(0,c.jsxs)(p.kC,{sx:{alignItems:"flex-start"},children:[(0,c.jsx)(ev,{number:n}),(0,c.jsxs)(p.xu,{sx:{ml:3,alignSelf:"center"},children:[(0,c.jsx)(p.X6,{as:"h4",sx:{color:"whiteButtonText",fontSize:"14px",fontWeight:"600"},children:(0,c.jsx)(ef,{children:t})}),r&&(0,c.jsx)(p.xv,{as:"p",sx:{mt:2,color:"textClear",fontSize:"13px",lineHeight:"24px"},children:(0,c.jsx)(ef,{children:r})})]})]})}))};eh.tabsRole="Tab";var ep,ev=function(e){var n=e.number;return(0,c.jsx)(p.kC,{sx:{height:"32px",width:"32px",alignItems:"center",justifyContent:"center",border:"1px solid #E4E2E4",borderRadius:"6px",bg:"grey07",color:"textClear",flexShrink:"0",fontSize:"13px"},children:n})},em=function(e){var n=e.isOpen,t=(0,w.v9)(function(e){return{isSimulatorAvailableForFramework:(0,F.Ql)(e),setupSteps:(0,I.qe)(e)}}),r=t.isSimulatorAvailableForFramework,i=t.setupSteps||[];return(0,x.useEffect)(function(){n&&Z.Xe.track({event:"slice-simulator:setup"})},[n]),(0,c.jsx)(M.Z,{isOpen:n,children:(0,c.jsx)(B.Z,{bodySx:{p:0,bg:"grey07",height:4===i.length?"640px":"480px"},Header:function(e){var n=e.radius;return(0,c.jsx)(p.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"grey07",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:(0,c.jsx)(p.X6,{sx:{fontSize:"14px",fontWeight:"600"},as:"h5",children:"Set up the simulator"})})},children:(0,c.jsxs)(ei.mQ,{defaultFocus:!0,className:"react-tabs__vertical",children:[(0,c.jsx)(ei.td,{className:"react-tabs__vertical__tab-list",children:i.map(function(e,n){return(0,c.jsx)(eh,{number:n+1,title:e.title,excerpt:e.description},e.title)})}),r?(0,c.jsx)(c.Fragment,{children:i.map(function(e){return(0,c.jsx)(ei.x4,{selectedClassName:"react-tabs__vertical__tab-panel--selected",className:"react-tabs__vertical__tab-panel",children:(0,c.jsx)(ex,{html:e.body})},e.title)})}):(0,c.jsx)(ei.x4,{selectedClassName:"react-tabs__vertical__tab-panel--selected",className:"react-tabs__vertical__tab-panel",children:"Framework not supported."})]})})})},eg=t(53559);(ep=o||(o={})).LOADING_SETUP="LOADING_SETUP",ep.LOADING_IFRAME="LOADING_IFRAME",ep.FAILED_SETUP="FAILED_SETUP",ep.FAILED_CONNECT="FAILED_CONNECT",ep.SUCCESS="SUCCESS";var eb=function(e){var n,t,i=e.slice,s=e.variation,a=(0,W.Z)(),l=a.checkSimulatorSetup,m=a.connectToSimulatorIframe,g=a.saveSliceMock,b=(0,w.v9)(function(e){return{simulatorUrl:(0,F.x0)(e),iframeStatus:(0,I.NL)(e),manifestStatus:(0,I.tD)(e).manifest,isWaitingForIFrameCheck:(0,I.oM)(e),endpoints:(0,F.gZ)(e)}}),C=b.simulatorUrl,j=b.iframeStatus,S=b.manifestStatus,k=b.isWaitingForIFrameCheck,y=b.endpoints,E=(0,x.useMemo)(function(){return{embedsUrl:y.PrismicOembed,env:"prod",unsplashUrl:y.PrismicUnsplash}},[y.PrismicOembed,y.PrismicUnsplash]),_=(0,x.useRef)(null),R=(0,x.useCallback)(function(){return l()},[]);(0,x.useEffect)(function(){l(),Z.Xe.track({event:"slice-simulator:open"})},[]);var z=(0,x.useRef)(!1);(0,x.useEffect)(function(){z.current=!0},[]);var N=function(e){z.current&&(z.current=!1,Z.Xe.track({event:"editor:widget-used",sliceId:e}))},O="ko"===S?o.FAILED_SETUP:"ok"===S?k||!j?o.LOADING_IFRAME:"ok"!==j?o.FAILED_CONNECT:o.SUCCESS:(0,o.LOADING_SETUP);(0,x.useEffect)(function(){if(O===o.FAILED_SETUP&&!_.current){var e=setInterval(function(){R()},3e3);_.current=e}},[O]),(0,x.useEffect)(function(){"ok"===S&&(_.current&&clearInterval(_.current),m())},[S]),(0,x.useEffect)(function(){O===o.FAILED_CONNECT&&Z.Xe.track({event:"slice-simulator:is-not-running"})},[O]),(0,x.useEffect)(function(){O===o.SUCCESS&&eo(!0)},[O]);var A=function(){m()},M=(0,x.useState)(T[r.DESKTOP]),U=M[0],P=M[1],B=(0,x.useMemo)(function(){return eg.id.fromSM(i.model)},[i.model]),H=(0,x.useState)(null),X=H[0],K=H[1],Y=(0,x.useMemo)(function(){var e,n;return(null==X?void 0:X.variation)===s.id?X:(null===(e=i.mocks)||void 0===e?void 0:e.find(function(e){return e.variation===s.id}))||{__TYPE__:"SharedSliceContent",variation:n=s.id,primary:{},items:[]}},[X,s.id]),J=(0,x.useMemo)(function(){return(0,q.renderSliceMock)(B,Y).id},[]),Q=(0,x.useCallback)(function(){return function(){return(0,d.Z)((0,u.Z)({},(0,q.renderSliceMock)(B,Y)),{id:J})}},[B,Y]),en=G(Q,800,[B,Y,]),er=(0,x.useState)(!1),ei=er[0],eo=er[1];return(0,c.jsxs)(p.kC,{sx:{flexDirection:"column",height:"100vh"},children:[(0,c.jsx)(em,{isOpen:O===o.FAILED_SETUP}),(0,c.jsx)(D,{slice:i,variation:s,isDisplayEditor:ei,actionsDisabled:O!==o.SUCCESS,toggleIsDisplayEditor:function(){return eo(!ei)},onSaveMock:function(){return X&&g({libraryID:i.from,sliceID:i.model.id,mocks:(i.mocks||[]).filter(function(e){return e.variation!==X.variation}).concat(X)})}}),(0,c.jsx)(p.xu,{sx:{flex:1,bg:"grey07",p:3,display:"flex",flexDirection:"column",height:"calc(100% - 73px - 16px)"},children:(0,c.jsxs)(p.kC,{sx:{flex:1,flexDirection:"row",position:"relative",width:"100%",height:"100%"},children:[(0,c.jsxs)(v.xR,{sx:{display:"flex",height:"100%",flexDirection:"column",flex:1,minWidth:0},children:[(0,c.jsx)(L,{handleScreenSizeChange:P,screenDimensions:U,actionsDisabled:O!==o.SUCCESS}),O===o.FAILED_CONNECT?(0,c.jsx)(et,{onRetrigger:A}):null,O===o.SUCCESS?(0,c.jsx)($,{apiContent:en,screenDimensions:U,simulatorUrl:C}):(0,c.jsx)(c.Fragment,{children:O===o.LOADING_IFRAME?(0,c.jsxs)(ee,{children:[(0,c.jsx)(p.$j,{variant:"styles.spinner"}),(0,c.jsx)($,{apiContent:en,screenDimensions:U,simulatorUrl:C,dryRun:!0})]}):null})]}),O===o.SUCCESS&&ei?(0,c.jsx)(p.kC,{className:"editor",sx:{flexDirection:"column",marginLeft:"16px",maxWidth:"440px",minWidth:"440px",overflowY:"auto"},children:(0,c.jsx)(h.SV,{renderError:function(){return(0,c.jsx)(h.Iq,{title:"Editor error",description:"An error occurred while rendering the editor."})},children:(0,c.jsx)(x.Suspense,{children:(0,c.jsx)(f.kS,{config:E,content:Y,onContentChange:function(e){K(e),N(i.model.id)},sharedSlice:B},s.id)})})}):null]})}),!!(null===(n=i.screenshots[s.id])||void 0===n?void 0:n.url)&&(0,c.jsx)(V,{sliceName:i.model.name,screenshotUrl:null===(t=i.screenshots[s.id])||void 0===t?void 0:t.url})]})},eC=t(28684),ej=(0,t(57880).y)(eb);function eS(){var e=(0,eC.Z)().slice;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l(),{children:(0,c.jsxs)("title",{children:[e?"Simulator: ".concat(e.model.name):"Simulator"," - Slice Machine"]})}),(0,c.jsx)(ej,{})]})}},28684:function(e,n,t){"use strict";var r=t(92521),i=t(90374),o=t(5632),s=t(2784),c=t(56580),a=function(){var e=(0,o.useRouter)(),n=(0,i.Z)().initSliceStore,t=(0,c.v9)(function(n){return{slice:(0,r.tL)(n,e.query.lib,e.query.sliceName)}}).slice;if((0,s.useEffect)(function(){t?n(t):e.replace("/")},[n,t,e]),!t)return{};var a=t.model.variations.find(function(n){return n.id===e.query.variation});return a?{slice:t,variation:a}:(e.replace("/"),{})};n.Z=a},57880:function(e,n,t){"use strict";t.d(n,{y:function(){return c}});var r=t(62230),i=t(52322);t(2784);var o=t(28684),s=t(95583),c=function(e){return function(n){var t=n.pageProps,c=(0,o.Z)(),a=c.slice,l=c.variation;return a&&l?(0,i.jsx)(e,(0,r.Z)({slice:a,variation:l},t)):((0,s.gx)("/"),null)}}}},function(e){e.O(0,[789,872,851,505,774,888,179],function(){return e(e.s=30755)}),_N_E=e.O()}]);
|
package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-ef11594ce026b650.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(47914)}])},47914:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ej}});var i=t(52322),r=t(97729),o=t.n(r),a=t(22715),l=t(2784),s=t(40432),c=t(47560),u=t(38876),d=t(8482),f=t(4092),m=t(2353),p=t(44384),v=t(28173),h=t(90374),x=t(53559),y=function(e){var n=e.variation,t=(0,h.Z)(),r=t.addSliceWidget,o=t.replaceSliceWidget,a=t.reorderSliceWidget,l=t.removeSliceWidget,s=t.updateSliceWidgetMock,y=t.deleteSliceWidgetMock,g=function(e){return function(t){y(n.id,e,t),l(n.id,e,t)}},b=function(e){return function(t){var i=t.apiId,r=t.newKey,a=t.value,l=t.mockValue;l?s(n.id,e,i,r,l):y(n.id,e,r),o(n.id,e,i,r,a)}},j=function(e){return function(t){var i=t.id,o=t.label,a=t.widgetTypeName,l=m[a];l||console.log('Could not find widget with type name "'.concat(a,'". Please contact us!')),r(n.id,e,i,l.create(o))}},S=function(e){return function(t){var i,r;(0,c.uS)(t)||a(n.id,e,t.source.index,null!==(r=null===(i=t.destination)||void 0===i?void 0:i.index)&&void 0!==r?r:void 0)}};return(0,i.jsxs)(v.aV,{children:[(0,i.jsx)(d.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:n.primary,EditModal:f.Z,widgetsArray:p.Z,onDeleteItem:g(x.Rt.Primary),onSave:b(x.Rt.Primary),onSaveNewField:j(x.Rt.Primary),onDragEnd:S(x.Rt.Primary),poolOfFieldsToCheck:n.primary||[],renderHintBase:function(e){var n=e.item;return"slice.primary".concat((0,u.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.primary".concat((0,u.Ti)(e))},dataCy:"slice-non-repeatable-zone",isRepeatableCustomType:void 0}),(0,i.jsx)(d.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:p.Z,fields:n.items,EditModal:f.Z,onDeleteItem:g(x.Rt.Items),onSave:b(x.Rt.Items),onSaveNewField:j(x.Rt.Items),onDragEnd:S(x.Rt.Items),poolOfFieldsToCheck:n.items||[],renderHintBase:function(e){var n=e.item;return"item".concat((0,u.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.items[i]".concat((0,u.Ti)(e))},dataCy:"slice-repeatable-zone",isRepeatableCustomType:void 0})]})},g=t(62230),b=t(85244),j=t(81541),S=t(5632),w=t(22710),k=t(99267),C=t(55658),Z=t(63397),I=t(25812),T=t(75289),E=t(54132),R=function(e){var n=e.children,t=e.FooterContent,r=e.HeaderContent,o=e.close,a=e.sx,l=e.headerSx,s=void 0===l?{}:l;return(0,i.jsx)(E.Z,{borderFooter:!0,footerSx:{p:0},bodySx:{pt:2,pb:4,px:4},sx:(0,g.Z)({border:"none"},void 0===a?{}:a),Header:function(e){var n=e.radius;return(0,i.jsxs)(T.kC,{sx:(0,g.Z)({p:3,pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},s),children:[r,o?(0,i.jsx)(T.x8,{onClick:o,type:"button"}):null]})},Footer:t?(0,i.jsxs)(T.kC,{sx:{alignItems:"space-between",bg:"headSection",p:3},children:[(0,i.jsx)(T.xu,{sx:{ml:"auto"}}),t]}):null,children:n})},A=t(36131),N=function(e){var n=e.msg;return(0,i.jsx)(T.xv,{as:"span",sx:{fontSize:12,color:"error",mt:"5px",ml:2},children:n||"Error!"})},L=function(e){var n=e.isOpen,t=e.onClose,r=e.onSubmit,o=e.initialVariation,a=e.variations,s=function(e){var n=e.id,t=e.name,i=e.origin,r=n&&n.length?null:{id:"Required!"},o=a.find(function(e){return e.id===n})?{id:"This id already exists!"}:null,l=t&&t.length?null:{name:"Required!"},s=i.value.length&&a.find(function(e){return e.id===i.value})?null:{id:"You must select an existing variation!"},c=n&&n.length&&!/^[A-Za-z0-9]+([A-Za-z0-9]+)*$/.exec(n)&&{id:"No special characters allowed"};return(0,g.Z)({},r,o,l,s,c)},c=function(e){j(C.e.generateId(e))},u=function(e){O(e),E&&c(e)},d=function(e){L(!1),c(e)},f=function(){m(),t()},m=function(){j(""),O(""),h({}),L(!0),F({value:o.id,label:o.name})},p=(0,l.useState)({}),v=p[0],h=p[1],x=(0,l.useState)(""),y=x[0],j=x[1],S=(0,l.useState)(!0),E=S[0],L=S[1],V=(0,l.useState)(""),_=V[0],O=V[1],D=(0,l.useState)({value:o.id,label:o.name}),B=D[0],F=D[1];function z(){return P.apply(this,arguments)}function P(){return(P=(0,w.Z)(function(){var e,n;return(0,k.__generator)(this,function(t){return Object.keys(e=s({id:y,name:_,origin:B})).length?h(e):(n=a.find(function(e){return e.id===B.value}))&&(r(y,_,n),f()),[2]})})).apply(this,arguments)}return(0,l.useEffect)(function(){m()},[o,n]),(0,i.jsx)(I.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,onRequestClose:function(){return f()},contentLabel:"Widget Form Modal",style:{content:{maxWidth:"700px"}},children:(0,i.jsx)(Z.J9,{initialValues:{id:y,name:_,origin:B},onSubmit:z,children:(0,i.jsx)(Z.l0,{id:"variation-add",onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),z())},children:(0,i.jsx)(T.xu,{children:(0,i.jsxs)(R,{sx:{textAlign:"left"},HeaderContent:(0,i.jsx)(T.xv,{as:"h2",children:"Add new Variation"}),FooterContent:(0,i.jsxs)(T.kC,{sx:{justifyContent:"flex-end"},children:[(0,i.jsx)(T.zx,{onClick:f,mr:2,variant:"secondary",children:"Cancel"}),(0,i.jsx)(T.zx,{type:"submit",children:"Submit"})]}),close:f,children:[(0,i.jsxs)(T.xu,{sx:{pb:4,mt:4},children:[(0,i.jsxs)(T.__,{htmlFor:"name",sx:{mb:1},children:["Variation name*",v.name?(0,i.jsx)(N,{msg:v.name}):""]}),(0,i.jsx)(Z.gN,{autoComplete:"off",id:"name",name:"name",placeholder:"e.g. Grid - With Icon",as:T.II,maxLength:30,value:_,onChange:function(e){return u(e.currentTarget.value)}}),(0,i.jsx)(T.xv,{children:"It will appear here in Slice Machine, and in the page editor in Prismic"})]}),(0,i.jsxs)(T.xu,{sx:{pb:4},children:[(0,i.jsxs)(T.__,{htmlFor:"id",sx:{mb:1},children:["Variation ID*",v.id?(0,i.jsx)(N,{msg:v.id}):""]}),(0,i.jsx)(Z.gN,{autoComplete:"off",id:"id",name:"id",placeholder:"e.g. GridWithIcon",as:T.II,maxLength:30,value:y,onChange:function(e){return d(e.currentTarget.value)}}),(0,i.jsx)(T.xv,{children:"It's generated automatically based on the variation name and will appear in the API responses."})]}),(0,i.jsxs)(T.xu,{sx:{pb:4},children:[(0,i.jsx)(T.__,{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&&F(e)},defaultValue:B,maxMenuHeight:150,theme:function(e){return(0,b.Z)((0,g.Z)({},e),{colors:(0,b.Z)((0,g.Z)({},e.colors),{text:"text",primary:"background"})})}})]})]})})})})})},V=t(13858),_=t(82770),O=t(49451);function D(){return(D=(0,w.Z)(function(e){var n,t,i,r,o,a,l,s,c,u,d,f;return(0,k.__generator)(this,function(n){switch(n.label){case 0:e.setSliceBuilderState({loading:!0,done:!1}),n.label=1;case 1:return n.trys.push([1,7,,8]),[4,(0,_.Ve)(e.component)];case 2:if((t=n.sent().errors).length>0)throw t;return[4,(0,_.Xi)({libraryID:e.component.from,sliceID:e.component.model.id,variationID:e.variation.id})];case 3:if((r=n.sent().errors).length>0)throw r;return[4,(0,_.X$)(e.component.from,e.component.model.id)];case 4:if(a=(o=n.sent()).slice,(l=o.errors).length>0)throw l;if(!a)throw Error("Could not read variation `".concat(e.variation.name,"`"));return[4,(0,_.pL)({libraryID:e.component.from,sliceID:e.component.model.id})];case 5:return s=n.sent().mocks,c=O.Y.getBuilderPagePathname({libraryName:e.component.href,sliceName:a.name,variationId:a.variations[0].id}),[4,e.router.replace(c)];case 6:return n.sent(),e.updateAndSaveSlice((0,b.Z)((0,g.Z)({},e.component),{model:a,mocks:s})),u="".concat(e.component.from,"/").concat(e.component.model.name,"/model.json"),e.setSliceBuilderState({loading:!1,done:!0,error:!1,message:(0,V.kQ)({path:u})}),[3,8];case 7:throw d=n.sent(),f="Could not delete variation `".concat(e.variation.name,"`"),console.error(f,d),e.setSliceBuilderState({loading:!1,done:!0,error:!0,message:f}),d;case 8:return[2]}})})).apply(this,arguments)}var B=function(e){var n=e.isOpen,t=e.onClose,r=e.slice,o=e.variation,l=e.sliceBuilderState,s=e.setSliceBuilderState,c=(0,S.useRouter)(),u=(0,h.Z)().updateAndSaveSlice;return(0,i.jsxs)(a.Vq,{open:n,onOpenChange:function(e){return!e&&t()},size:{width:448,height:"auto"},children:[(0,i.jsx)(a.fK,{icon:"delete",title:"Delete variation"}),(0,i.jsx)(a.cZ,{children:(0,i.jsxs)(a.xu,{flexDirection:"column",children:[(0,i.jsxs)(a.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)(F,{children:"not"})," affect your documents until you ",(0,i.jsx)(F,{children:"edit"})," ","them manually."]}),(0,i.jsx)(a.kX,{ok:{text:"Delete",onClick:function(){o&&(0,w.Z)(function(){return(0,k.__generator)(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,function(e){return D.apply(this,arguments)}({component:r,router:c,setSliceBuilderState:s,updateAndSaveSlice:u,variation:o})];case 1:case 2:return e.sent(),[3,3];case 3:return t(),[2]}})})()},loading:l.loading},cancel:{text:"Cancel"},size:"medium"})]})})]})},F=function(e){return(0,i.jsx)(a.xv,(0,b.Z)((0,g.Z)({},e),{color:"inherit",component:"span",variant:"bold"}))};function z(){return(z=(0,w.Z)(function(e){var n,t,i,r,o,a,l,s,c,u,d;return(0,k.__generator)(this,function(n){switch(n.label){case 0:e.setSliceBuilderState({loading:!0,done:!1}),n.label=1;case 1:return n.trys.push([1,6,,7]),[4,(0,_.Ve)(e.component)];case 2:if((t=n.sent().errors).length>0)throw t;return[4,(0,_.eH)(e.component,(0,b.Z)((0,g.Z)({},e.variation),{name:e.variationName}))];case 3:if((r=n.sent().errors).length>0)throw r;return[4,(0,_.X$)(e.component.from,e.component.model.id)];case 4:if(a=(o=n.sent()).slice,(l=o.errors).length>0)throw l;if(!a)throw Error("Could not read variation `".concat(e.variation.name,"`"));return[4,(0,_.pL)({libraryID:e.component.from,sliceID:e.component.model.id})];case 5:return s=n.sent().mocks,e.updateAndSaveSlice((0,b.Z)((0,g.Z)({},e.component),{model:a,mocks:s})),c="".concat(e.component.from,"/").concat(e.component.model.name,"/model.json"),e.setSliceBuilderState({loading:!1,done:!0,error:!1,message:(0,V.kQ)({path:c})}),[3,7];case 6:throw u=n.sent(),d="Could not rename variation `".concat(e.variation.name,"`"),console.error(d,u),e.setSliceBuilderState({loading:!1,done:!0,error:!0,message:d}),u;case 7:return[2]}})})).apply(this,arguments)}var P=function(e){var n,t,r=e.isOpen,o=e.onClose,l=e.slice,s=e.variation,c=e.sliceBuilderState,u=e.setSliceBuilderState,d=(0,h.Z)().updateAndSaveSlice;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(a.Vq,{open:r,onOpenChange:function(e){return!e&&o()},size:{width:448,height:"auto"},children:[(0,i.jsx)(a.fK,{icon:"edit",title:"Rename variation"}),(0,i.jsx)(a.cZ,{children:(0,i.jsx)(Z.J9,{validateOnChange:!0,validateOnMount:!0,initialValues:{variationName:null!==(n=null==s?void 0:s.name)&&void 0!==n?n:""},validate:function(e){if(0===e.variationName.length)return{variationName:"Cannot be empty"}},onSubmit:(t=(0,w.Z)(function(e){return(0,k.__generator)(this,function(n){switch(n.label){case 0:if(!s)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,function(e){return z.apply(this,arguments)}({component:l,setSliceBuilderState:u,updateAndSaveSlice:d,variation:s,variationName:e.variationName.trim()})];case 2:case 3:return n.sent(),[3,4];case 4:return o(),[2]}})}),function(e){return t.apply(this,arguments)}),children:function(e){return(0,i.jsxs)("form",{children:[(0,i.jsxs)(a.xu,{flexDirection:"column",gap:8,padding:16,children:[(0,i.jsx)(a.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)(a.xu,{flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:"_1ecs97dez4 _1ecs97dez8 _1ecs97df90",children:[(0,i.jsx)(a.xv,{variant:"bold",children:"Variation name*"}),"string"==typeof e.errors.variationName?(0,i.jsx)(a.xv,{variant:"small",color:"tomato10",children:e.errors.variationName}):null]}),(0,i.jsx)(a.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)(a.kX,{ok:{text:"Rename",onClick:function(){e.submitForm()},loading:c.loading,disabled:!e.isValid},cancel:{text:"Cancel"},size:"medium"})]})}})})]})})},M=t(84449),K=t(65958),H=t(47731),W=function(e){var n=e.slice,t=e.variation,r=e.sliceBuilderState,o=e.setSliceBuilderState,s=(0,l.useState)(),c=s[0],u=s[1],d=(0,H.H)(),f=d.modalPayload,m=f.sliceFilterFn,p=f.defaultVariationSelector,v=(0,h.Z)(),x=v.copyVariationSlice,y=v.updateSlice,w=(0,S.useRouter)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(a.xu,{flexDirection:"column",gap:16,children:[n.model.variations.map(function(e){return(0,i.jsx)(K.b,{action:{type:"menu",onRename:function(){u({type:"RENAME_VARIATION",variation:e})},onRemove:function(){u({type:"DELETE_VARIATION",variation:e})},removeDisabled:n.model.variations.length<=1},mode:"navigation",onUpdateScreenshot:function(){d.onOpenModal({sliceFilterFn:function(e){return e},defaultVariationSelector:{sliceID:n.model.id,variationID:e.id}})},replace:!0,selected:e.id===t.id,slice:n,variant:"outlined",variationId:e.id},e.id)}),(0,i.jsxs)(a.xu,{backgroundColor:"grey2",bottom:0,flexDirection:"column",padding:{bottom:40,inline:24},position:"sticky",style:{marginBottom:"-16px"},children:[(0,i.jsx)(a.ph,{sx:{left:0,position:"absolute",right:0}}),(0,i.jsx)(a.zx,{onClick:function(){u({type:"ADD_VARIATION"})},startIcon:"add",sx:{position:"relative"},color:"grey",children:"Add a new variation"})]})]}),(0,i.jsx)(M.Z,{slices:m([n]),defaultVariationSelector:p}),(0,i.jsx)(P,{isOpen:(null==c?void 0:c.type)==="RENAME_VARIATION",onClose:function(){u(void 0)},slice:n,variation:null==c?void 0:c.variation,sliceBuilderState:r,setSliceBuilderState:o}),(0,i.jsx)(B,{isOpen:(null==c?void 0:c.type)==="DELETE_VARIATION",onClose:function(){u(void 0)},slice:n,variation:null==c?void 0:c.variation,sliceBuilderState:r,setSliceBuilderState:o}),(0,i.jsx)(L,{initialVariation:t,isOpen:(null==c?void 0:c.type)==="ADD_VARIATION",onClose:function(){u(void 0)},onSubmit:function(e,t,i){x(e,t,i);var r=C.e.copyValue(i,e,t),a=(0,b.Z)((0,g.Z)({},n),{model:(0,b.Z)((0,g.Z)({},n.model),{variations:(0,j.Z)(n.model.variations).concat([r])})});y(a,o);var l=O.Y.getBuilderPagePathname({libraryName:a.href,sliceName:a.model.name,variationId:r.id});w.replace(l)},variations:n.model.variations})]})},q=t(56580),X=t(75329),J=t(33710),Q=t(42189),Y=t(17036),G=t(39295),$=t(22342),U=function(){return(0,i.jsx)(G.X,{children:(0,i.jsxs)(J.Z,{clickable:!0,place:"bottom",effect:"solid",delayHide:500,id:"simulator-button-tooltip",children:[(0,i.jsx)(T.xv,{as:"b",children:"Framework not supported"}),(0,i.jsx)(T.xv,{as:"p",children:"Slice Simulator does not support your framework yet."})]})})},ee=function(e){var n=e.children,t=e.open,r=e.onClose;return(0,i.jsxs)($.zs,{open:t,trigger:n,onClose:r,children:[(0,i.jsx)($.Ev,{children:"Simulate your slices"}),(0,i.jsx)($.LB,{component:"video",cloudName:"dmtf1daqp",loop:!1,autoPlay:!1,publicId:X.Sn,poster:"/simulator-video-thumbnail.png",controls:!0,onPlay:function(){_.Xe.track({event:"open-video-tutorials",video:X.Sn})}}),(0,i.jsx)($.OJ,{children:"Minimize context-switching by previewing your Slice components in the simulator."}),(0,i.jsx)($.Rp,{children:"Got it"})]})},en=function(){return(0,i.jsx)(G.X,{children:(0,i.jsx)(J.Z,{clickable:!0,place:"bottom",effect:"solid",delayHide:500,id:"simulator-button-tooltip",children:"Save your work in order to simulate"})})},et=function(e){var n=e.isSimulatorAvailableForFramework,t=e.isTouched,r=(0,S.useRouter)(),o=(0,l.useRef)(null),s=(0,h.Z)().setSeenSimulatorToolTip,c=(0,q.v9)(function(e){return{hasSeenSimulatorTooltip:(0,Y.bv)(e)}}).hasSeenSimulatorTooltip;(0,l.useEffect)(function(){var e=o.current;e&&n&&!c&&setTimeout(function(){return J.Z.show(e)},5e3)},[n,c]);var u=function(){if(s(),o.current){var e=o.current;J.Z.hide(e)}},d=n&&!c;return(0,i.jsxs)("span",{"data-tip":!0,"data-tip-disable":!1,"data-for":"simulator-button-tooltip",ref:o,children:[(0,i.jsx)(ee,{open:d,onClose:u,children:(0,i.jsx)(a.zx,{"data-tip":!0,"data-testid":"simulator-open-button",onClick:function(){u(),window.open("".concat(r.asPath,"/simulator"),X.pq)},disabled:!n||t,renderStartIcon:function(){return(0,i.jsx)(Q.z,{color:a.TV.color.greyLight11,height:a.TV.size[24],style:{transform:"scale(calc(4 / 3))"},width:a.TV.size[24]})},color:"grey",children:"Simulate"})}),!1===n?(0,i.jsx)(U,{}):n&&!1===d&&t?(0,i.jsx)(en,{}):null]})},ei=t(22337),er=t(17329),eo=t(81038);function ea(e){return el.apply(this,arguments)}function el(){return(el=(0,w.Z)(function(e){var n,t,i;return(0,k.__generator)(this,function(r){switch(r.label){case 0:return[4,eo.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 es=t(67445),ec=t(64722),eu=t(20812),ed=function(e){return(0,i.jsxs)("svg",(0,b.Z)((0,g.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"})]}))},ef=function(){var e,n,t=(e=(0,ec.l)().source,n=(0,es.Ag)(e.query),void 0!==n&&(0,es.ne)(e.asPath,n)?n:void 0);return void 0!==t?(0,i.jsx)(a.SV,{children:(0,i.jsx)(l.Suspense,{children:(0,i.jsx)(a.xu,{bottom:32,justifyContent:"center",position:"fixed",right:0,width:"100vw",children:(0,i.jsx)(em,{sourceCustomTypeId:t})})})}):null},em=function(e){var n,t=(n=e.sourceCustomTypeId,(0,er.QT)(ea,[n])),r=(0,l.useState)(!0),o=r[0],s=r[1],c=(0,S.useRouter)();if(void 0===t||!o)return null;var u=t.format,d=t.id,f=es.cd[u].getBuilderPagePathname(d);return(0,i.jsxs)(a.hE,{density:"compact",color:"dark",children:[(0,i.jsxs)(a.zx,{onClick:function(){c.push(f)},renderStartIcon:function(){return(0,i.jsx)(ed,{})},children:["Return to ",t.label]}),(0,i.jsx)(a.zx,{onClick:function(){s(!1)},renderStartIcon:function(){return(0,i.jsx)(eu.T,{})}})]})},ep=t(39092),ev=t(92521),eh={loading:!1,done:!1},ex=function(e){var n=e.slice,t=e.variation,r=(0,h.Z)().openToaster,o=(0,q.v9)(function(e){return(0,ev.sY)(e,n.from,n.model.id)}),a=(0,l.useState)(eh),c=a[0],u=a[1];return((0,l.useEffect)(function(){o&&u(eh)},[o]),(0,l.useEffect)(function(){if(c.done){var e,n;n=c,n.done&&r(n.message,n.error?s.Jf.ERROR:s.Jf.SUCCESS)}},[c]),t)?(0,i.jsx)(ey,{setState:u,slice:n,variation:t,isTouched:o,state:c}):(0,i.jsx)(ei.LN,{})},ey=function(e){var n=e.setState,t=e.slice,r=e.variation,o=e.isTouched,l=e.state,s=(0,q.v9)(ep.Ql),c=(0,h.Z)().updateSlice;return(0,i.jsxs)(ei.LN,{children:[(0,i.jsxs)(ei.wd,{children:[(0,i.jsx)(ei.Xq,{url:"/slices"}),(0,i.jsx)(ei.Cx,{folder:"Slices",page:t.model.name}),(0,i.jsxs)(ei.K2,{children:[(0,i.jsx)(et,{isSimulatorAvailableForFramework:s,isTouched:!!o}),(0,i.jsx)(a.zx,{loading:l.loading,disabled:!o||l.loading,onClick:function(){c(t,n)},"data-cy":"builder-save-button",children:"Save"})]})]}),(0,i.jsxs)(ei.RN,{children:[(0,i.jsxs)(a.xu,{alignItems:"flex-start",display:"grid",gap:16,gridTemplateColumns:"320px 1fr",children:[(0,i.jsx)(W,{slice:t,variation:r,sliceBuilderState:l,setSliceBuilderState:n}),(0,i.jsx)(y,{variation:r})]}),(0,i.jsx)(ef,{})]})]})},eg=t(28684),eb=(0,t(57880).y)(ex);function ej(){var e=(0,eg.Z)().slice;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o(),{children:e?(0,i.jsxs)("title",{children:[e.model.name," - Slice Machine"]}):null}),(0,i.jsx)(eb,{})]})}},28684:function(e,n,t){"use strict";var i=t(92521),r=t(90374),o=t(5632),a=t(2784),l=t(56580),s=function(){var e=(0,o.useRouter)(),n=(0,r.Z)().initSliceStore,t=(0,l.v9)(function(n){return{slice:(0,i.tL)(n,e.query.lib,e.query.sliceName)}}).slice;if((0,a.useEffect)(function(){t?n(t):e.replace("/")},[n,t,e]),!t)return{};var s=t.model.variations.find(function(n){return n.id===e.query.variation});return s?{slice:t,variation:s}:(e.replace("/"),{})};n.Z=s},57880:function(e,n,t){"use strict";t.d(n,{y:function(){return l}});var i=t(62230),r=t(52322);t(2784);var o=t(28684),a=t(95583),l=function(e){return function(n){var t=n.pageProps,l=(0,o.Z)(),s=l.slice,c=l.variation;return s&&c?(0,r.jsx)(e,(0,i.Z)({slice:s,variation:c},t)):((0,a.gx)("/"),null)}}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return b}});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 l(e){return(a[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function s(e,n){return void 0===n&&(n=","),e.split(n)}function c(e,n,t){void 0===n&&(n="+");var i,a=e.toLocaleLowerCase().split(n).map(function(e){return l(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([l(e.key),l(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&m([l(e.key),l(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){u.clear()});var u=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];u.has("meta")&&u.forEach(function(e){var n;return!o.includes(e)&&u.delete(e.toLowerCase())}),n.forEach(function(e){return u.add(e.toLowerCase())})}function m(e){var n=Array.isArray(e)?e:[e];"meta"===e?u.clear():n.forEach(function(e){return u.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 v=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,a=n.meta,s=n.mod,c=n.shift,f=n.ctrl,m=n.keys,p=e.key,v=e.code,h=e.ctrlKey,x=e.metaKey,y=e.shiftKey,g=e.altKey,b=l(v),j=p.toLowerCase();if(!t){if(!g===o&&"alt"!==j||!y===c&&"shift"!==j)return!1;if(s){if(!x&&!h)return!1}else if(!x===a&&"meta"!==j&&"os"!==j||!h===f&&"ctrl"!==j&&"control"!==j)return!1}return!!(m&&1===m.length&&(m.includes(j)||m.includes(b)))||(m?(void 0===r&&(r=","),(d(i=m)?i:i.split(r)).every(function(e){return u.has(e.trim().toLowerCase())})):!m)},h=(0,i.createContext)(void 0),x=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},g="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function b(e,n,t,r){var o,a,u=(0,i.useRef)(null),b=(0,i.useRef)(!1),j=t instanceof Array?r instanceof Array?void 0:r:t,S=d(e)?e.join(null==j?void 0:j.splitKey):e,w=t instanceof Array?t:r instanceof Array?r:void 0,k=(0,i.useCallback)(n,null!=w?w:[]),C=(0,i.useRef)(k);w?C.current=k:C.current=n;var Z=(!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,j)&&(a.current=j),a.current),I=(0,i.useContext)(x).enabledScopes,T=(0,i.useContext)(h);return g(function(){if((null==Z?void 0:Z.enabled)!==!1&&(e=I,n=null==Z?void 0:Z.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==Z?void 0:Z.enableOnFormTags)||null!=Z&&null!=Z.ignoreEventWhen&&Z.ignoreEventWhen(e))){if(null!==u.current&&document.activeElement!==u.current&&!u.current.contains(document.activeElement)){y(e);return}(null==(t=e.target)||!t.isContentEditable||null!=Z&&Z.enableOnContentEditable)&&s(S,null==Z?void 0:Z.splitKey).forEach(function(t){var i,r,o,a,l,s,u,d=c(t,null==Z?void 0:Z.combinationKey);if(v(e,d,null==Z?void 0:Z.ignoreModifiers)||null!=(u=d.keys)&&u.includes("*")){if(n&&b.current)return;if(i=e,r=d,("function"==typeof(o=null==Z?void 0:Z.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),a=e,l=d,"function"==typeof(s=null==Z?void 0:Z.enabled)?!s(a,l):!0!==s&&void 0!==s){y(e);return}C.current(e,d),n||(b.current=!0)}})}},i=function(e){void 0!==e.key&&(f(l(e.code)),((null==Z?void 0:Z.keydown)===void 0&&(null==Z?void 0:Z.keyup)!==!0||null!=Z&&Z.keydown)&&t(e))},r=function(e){void 0!==e.key&&(m(l(e.code)),b.current=!1,null!=Z&&Z.keyup&&t(e,!0))},o=u.current||(null==j?void 0:j.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),T&&s(S,null==Z?void 0:Z.splitKey).forEach(function(e){return T.addHotkey(c(e,null==Z?void 0:Z.combinationKey,null==Z?void 0:Z.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),T&&s(S,null==Z?void 0:Z.splitKey).forEach(function(e){return T.removeHotkey(c(e,null==Z?void 0:Z.combinationKey,null==Z?void 0:Z.description))})}}},[S,Z,I]),u}}},function(e){e.O(0,[789,958,80,482,774,888,179],function(){return e(e.s=31314)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{74600:function(e,n,t){var i=t(34311),r=t(23779),o=i(function(e,n,t){return e+(t?" ":"")+r(n)});e.exports=o},26688:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices",function(){return t(12472)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var i=t(62230),r=t(85244),o=t(98240),l=t(52322),a=t(2784),c=t(75289),s=function(e,n){return e?"".concat(e,"-").concat(n):""},u=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},d=(0,a.forwardRef)(function(e,n){var t=e.label,a=e.Icon,d=e.type,f=e.form,m=e.isLoading,p=void 0!==m&&m,x=e.disabled,h=e.onClick,v=e.sx,y=e.iconSize,b=void 0===y?16:y,g=e.iconFill,j=e.variant,S=void 0===j?"primary":j,C=(0,o.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,l.jsx)(c.zx,(0,r.Z)((0,i.Z)({ref:n,sx:(0,i.Z)((0,r.Z)((0,i.Z)({},void 0===v?{}:v),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),p?{cursor:"wait !important"}:{}),type:d,form:f,disabled:void 0!==x&&x||p,onClick:p?void 0:h,variant:S},C),{children:p?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.$j,{size:b,color:u(S),"data-cy":s(C["data-cy"],"spinner")}),a&&t]}):(0,l.jsxs)(l.Fragment,{children:[a&&(0,l.jsx)(a,{size:b,fill:g,"data-cy":s(C["data-cy"],"icon")}),t]})}))})},45466:function(e,n,t){"use strict";t.d(n,{c:function(){return j}});var i=t(22710),r=t(62230),o=t(85244),l=t(99267),a=t(52322),c=t(75289),s=t(2784),u=t(36131),d=t(68780),f=t(88932),m=t(38876),p=t(81038),x=t(82770);function h(){return(h=(0,i.Z)(function(e){var n,t,i,r,o,a,c;return(0,l.__generator)(this,function(l){switch(l.label){case 0:var s;return l.trys.push([0,3,,4]),n=e.sliceName,t=e.libraryName,i=e.onSuccess,s=n,r={id:(0,m.T3)(s),type:"SharedSlice",name:s,description:s,variations:[{id:v,name:(0,m.MP)(v),docURL:"...",version:"initial",description:(0,m.MP)(v),imageUrl:""},]},[4,p.j.slices.createSlice({libraryID:t,model:r})];case 1:if((o=l.sent().errors).length>0)throw o;return x.Xe.track({event:"slice:created",id:(0,m.MP)(n),name:n,library:t}),[4,i(r)];case 2:return l.sent(),[3,4];case 3:return a=l.sent(),c="Internal Error: Slice not created",console.error(c,a),f.Am.error(c),[3,4];case 4:return[2]}})})).apply(this,arguments)}var v="default",y=t(90374),b=t(66443),g=t(70041),j=function(e){var n,t=e.onClose,f=e.onSuccess,m=e.localLibraries,p=e.remoteSlices,v=(0,y.Z)().createSliceSuccess,j=(0,s.useState)(!1),S=j[0],C=j[1],k=(n=(0,i.Z)(function(e){var n,t;return(0,l.__generator)(this,function(r){switch(r.label){case 0:var o;return n=e.sliceName,t=e.from,C(!0),[4,function(e){return h.apply(this,arguments)}({sliceName:n,libraryName:t,onSuccess:(o=(0,i.Z)(function(e){var n;return(0,l.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,x.y0)()];case 1:return v(n.sent().libraries),[4,f(e,t)];case 2:return n.sent(),[2]}})}),function(e){return o.apply(this,arguments)})})];case 1:return r.sent(),[2]}})}),function(e){return n.apply(this,arguments)});return(0,a.jsx)(d.Z,{dataCy:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:S,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:function(e){k(e)},initialValues:{sliceName:"",from:m[0].name},validate:function(e){return(0,b.h)(e,m,p)},content:{title:"Create a new slice"},children:function(e){var n=e.touched,t=e.values,i=e.setFieldValue,l=e.errors;return(0,a.jsxs)(c.xu,{children:[(0,a.jsx)(g.W,{name:"sliceName",label:"Slice Name",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?l.sliceName:void 0,dataCy:"slice-name-input"}),(0,a.jsx)(c.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,a.jsx)(u.ZP,{name:"from",options:m.map(function(e){return{value:e.name,label:e.name}}),onChange:function(e){return e?void i("from",e.value):null},defaultValue:{value:t.from,label:t.from},styles:{option:function(e){return(0,o.Z)((0,r.Z)({},e),{color:"#161618"})}},theme:function(e){return(0,o.Z)((0,r.Z)({},e),{colors:(0,o.Z)((0,r.Z)({},e.colors),{primary:"#E9E8EA"})})},menuPortalTarget:document.body})]})}})}},70041:function(e,n,t){"use strict";t.d(n,{W:function(){return a}});var i=t(62230),r=t(52322);t(2784);var o=t(63397),l=t(75289),a=function(e){var n=e.name,t=e.label,a=e.placeholder,c=e.error,s=e.dataCy,u=e.onChange;return(0,r.jsxs)(l.xu,{mb:3,children:[(0,r.jsx)(l.__,{htmlFor:n,mb:2,children:t}),(0,r.jsx)(o.gN,(0,i.Z)({name:n,type:"text",placeholder:a,as:l.II,autoComplete:"off"},u?{onChange:u}:null,s?{"data-cy":s}:null)),c?(0,r.jsx)(l.xv,{"data-cy":s?"".concat(s,"-error"):"input-error",sx:{color:"error",mt:1},children:c}):null]})}},66443:function(e,n,t){"use strict";t.d(n,{h:function(){return s}});var i=t(81541),r=t(75329),o=t(96009),l=t.n(o),a=t(74600),c=t.n(a);function s(e,n,t){var o=e.sliceName;if(!o)return{sliceName:"Cannot be empty"};if(!r.xo.exec(o))return{sliceName:"No special characters allowed"};if(c()(l()(o)).replace(/\s/gm,"")!==o.trim())return{sliceName:"Value has to be PascalCased"};if(o.match(/^\d/))return{sliceName:"Value cannot start with a number"};if(r.lS.includes(o))return{sliceName:"".concat(o," is reserved for Slice Machine use")};var a=n.flatMap(function(e){return e.components.map(function(e){return e.model.name})}),s=t.map(function(e){return e.name});if((0,i.Z)(a).concat((0,i.Z)(s)).includes(o))return{sliceName:"Slice name is already taken."}}},59469:function(e,n,t){"use strict";var i=t(62230),r=t(52322),o=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,l=e.defineElementKey,a=e.gridTemplateMinPx,c=e.gridGap,s=e.sx;return(0,r.jsx)(o.xu,{as:"section",sx:(0,i.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===a?"320px":a,", 1fr))"),gridGap:void 0===c?"16px":c,pt:2},s),children:n.map(function(e,n){return e?(0,r.jsx)("span",{children:t(e,n)},"".concat(l(e),"-").concat(n+1)):null})})}},68780:function(e,n,t){"use strict";var i=t(62230),r=t(85244),o=t(52322),l=t(37149),a=t.n(l),c=t(25812),s=t(63397),u=t(75289),d=t(56577),f=t(54132);n.Z=function(e){var n=e.children,t=e.close,l=e.isOpen,m=e.formId,p=e.validate,x=e.onSubmit,h=e.widthInPx,v=e.initialValues,y=e.content.title,b=e.cardProps,g=e.omitFooter,j=void 0!==g&&g,S=e.isLoading,C=void 0!==S&&S,k=e.buttonLabel,w=void 0===k?"Save":k,L=e.dataCy,I=e.actionMessage;return a().setAppElement("#__next"),(0,o.jsx)(c.Z,{isOpen:l,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:y,style:{content:{width:null!=h?h:"900px"}},children:(0,o.jsx)(s.J9,{validateOnChange:!0,initialValues:v,validate:function(e){return p?p(e):void 0},onSubmit:function(e){x(e)},children:function(e){var l=e.isValid,a=e.isSubmitting,c=e.values,p=e.errors,x=e.touched,h=e.setFieldValue,v=e.setValues;return(0,o.jsx)(s.l0,(0,r.Z)((0,i.Z)({id:m},null!=L?{"data-cy":L}:null),{children:(0,o.jsx)(f.Z,(0,r.Z)((0,i.Z)({borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"}},b),{Header:function(e){var n=e.radius;return(0,o.jsxs)(u.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,o.jsx)(u.X6,{sx:{fontSize:"20px"},children:y}),(0,o.jsx)(u.x8,{type:"button",onClick:t})]})},Footer:j?null:(0,o.jsxs)(u.kC,{sx:{alignItems:"space-between"},children:[(0,o.jsx)(u.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof I?I(e):I}),(0,o.jsxs)(u.kC,{sx:{ml:"auto"},children:[(0,o.jsx)(u.zx,{mr:2,type:"button",onClick:t,variant:"secondary",disabled:a||C,children:"Cancel"}),(0,o.jsx)(d.z,{label:w,form:m,type:"submit",disabled:!l||a||C,isLoading:a||C,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:n({isValid:l,isSubmitting:a,values:c,errors:p,touched:x,setFieldValue:h,setValues:v})}))}))}})})}},12472:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return V}});var i=t(81541),r=t(52322),o=t(22715),l=t(2784),a=t(97729),c=t.n(a),s=t(65077),u=t(75289),d=t(56580),f=t(5632),m=t(88932),p=t(75329),x=t(22337),h=t(45466),v=t(59469),y=t(36887),b=t(82770),g=function(e){var n=e.title,t=e.onCreateNew,i=e.buttonText,o=e.documentationComponent,l=e.videoPublicIdUrl;return(0,r.jsxs)(u.xu,{sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"},children:[(0,r.jsx)(u.xu,{sx:function(e){var n;return{display:"flex",flex:1,alignItems:"center",minWidth:"400px",maxWidth:"70%",border:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02)}},children:(0,r.jsx)(y.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:l,onPlay:function(){b.Xe.track({event:"open-video-tutorials",video:l})}})}),(0,r.jsxs)(u.xu,{sx:function(e){var n;return{bg:"white",display:"flex",flexDirection:"column",border:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02),flex:1,minWidth:"400px",maxWidth:"70%"}},children:[(0,r.jsxs)(u.xu,{sx:function(e){var n;return{display:"flex",flexDirection:"column",p:4,borderBottom:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02)}},children:[(0,r.jsx)(u.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:n}),(0,r.jsx)(u.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:o})]}),(0,r.jsxs)(u.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,r.jsx)(u.zx,{onClick:t,"data-cy":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:i}),(0,r.jsx)(u.xv,{sx:{fontSize:"12px",color:"grey04",maxWidth:"280px"},children:"It will be stored locally and you will be able to push it to your repository"})]})]})]})},j=t(84449),S=t(90374),C=t(68780),k=t(70041),w=t(77174),L=t(24340),I=t(75992),E=t(66443),N=function(e){var n=e.sliceName,t=e.sliceId,i=e.libName,o=(0,S.Z)(),l=o.renameSlice,a=o.closeModals,c=(0,d.v9)(function(e){return{isRenameSliceModalOpen:(0,w.gP)(e,L.q.RENAME_SLICE),localLibs:(0,I.Sd)(e),remoteLibs:(0,I.sT)(e)}}),s=c.isRenameSliceModalOpen,f=c.localLibs,m=c.remoteLibs,p=function(e){l(i,t,e.sliceName)};return(0,r.jsx)(C.Z,{dataCy:"rename-slice-modal",isOpen:s,widthInPx:"530px",formId:"rename-slice-modal-".concat(t),close:a,buttonLabel:"Rename",onSubmit:p,initialValues:{sliceName:n},content:{title:"Rename a slice"},validate:function(e){return(0,E.h)(e,f,m)},children:function(e){var n=e.touched,t=e.errors;return(0,r.jsx)(u.xu,{children:(0,r.jsx)(k.W,{name:"sliceName",label:"Slice Name","data-cy":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?t.sliceName:void 0,dataCy:"slice-name-input"})})}})},Z=t(25812),P=t(59326),R=t(54132),O=t(65186),_=t(56577),z=t(3098),F=t(32665),M=function(e){var n=e.sliceId,t=e.sliceName,i=e.libName,o=(0,d.v9)(function(e){return{isSliceModalOpen:(0,w.gP)(e,L.q.DELETE_SLICE),isDeletingSlice:(0,F.hg)(e,z.z.DELETE_SLICE)}}),l=o.isSliceModalOpen,a=o.isDeletingSlice,c=(0,S.Z)(),s=c.closeModals,f=c.deleteSlice,m=(0,P.B7)().theme;return(0,r.jsx)(Z.Z,{isOpen:l,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:s,children:(0,r.jsx)(R.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},borderFooter:!0,Header:function(){var e;return(0,r.jsxs)(u.kC,{sx:{position:"sticky",background:"gray",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,r.jsxs)(u.kC,{sx:{alignItems:"center"},children:[(0,r.jsx)(O.$vK,{size:20,color:null===(e=m.colors)||void 0===e?void 0:e.greyIcon}),(0,r.jsx)(u.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,r.jsx)(u.x8,{type:"button",onClick:s})]})},Footer:function(){return(0,r.jsxs)(u.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,r.jsx)(_.z,{label:"Cancel",variant:"secondary",onClick:function(){return s()},sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,r.jsx)(_.z,{label:"Delete",variant:"danger",isLoading:a,sx:{minHeight:39,minWidth:78},onClick:function(){return f(n,t,i)}})]})},children:(0,r.jsxs)(u.nv,{children:["This action will immediately make the following changes:",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["Delete the"," ",(0,r.jsxs)(u.xv,{sx:{fontWeight:"bold"},children:[i,"/",t,"/"]})," ","directory."]}),(0,r.jsx)("li",{children:"Remove the Slice from all Slice Zones that use it."})]}),"The next time you push your changes to Prismic, the following change will happen:",(0,r.jsx)("ul",{children:(0,r.jsx)("li",{children:"Remove the Slice from the list of available Slices to use in the Page Builder."})}),"You will need to manually remove the Slice from any Pages that currently use it."]})})})},A=t(47731),T=t(65958),W=t(49451),D=t(13858),V=function(){var e,n,t,a,y,b,C=(0,f.useRouter)(),k=(0,S.Z)(),w=k.openRenameSliceModal,L=k.openDeleteSliceModal,E=(0,A.H)(),Z=E.modalPayload,P=E.onOpenModal,R=Z.sliceFilterFn,O=Z.defaultVariationSelector,_=(0,d.v9)(function(e){return{remoteSlices:(0,I.sT)(e),libraries:(0,I.Sd)(e)}}),z=_.remoteSlices,F=_.libraries,V=(0,l.useState)(!1),K=V[0],B=V[1],H=F.filter(function(e){return e.isLocal}),X=F.map(function(e){return e.components=(0,i.Z)(e.components).sort(function(e,n){return e.model.name.localeCompare(n.model.name)}),e}),q=(F||[]).map(function(e){return e.components}).flat(),U=q.length,G=(0,l.useState)(),Y=G[0],$=G[1];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c(),{children:(0,r.jsx)("title",{children:"Slices - Slice Machine"})}),(0,r.jsxs)(x.LN,{children:[(0,r.jsxs)(x.wd,{children:[(0,r.jsx)(x.Cx,{folder:"Slices"}),(null==H?void 0:H.length)!==0&&0!==U?(0,r.jsx)(x.K2,{children:(0,r.jsx)(o.zx,{"data-testid":"create-slice","data-cy":"create-slice",onClick:function(){B(!0)},startIcon:"add",children:"Create"})}):void 0]}),(0,r.jsxs)(x.RN,{children:[(0,r.jsx)(s.xR,{sx:{display:"flex",flexDirection:"column"},children:X.length>0?(0,r.jsx)(u.kC,{sx:{flex:1,flexDirection:"column"},children:0===U?(0,r.jsx)(u.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,r.jsx)(g,{title:"What are Slices?",onCreateNew:function(){B(!0)},buttonText:"Create one",videoPublicIdUrl:p.rd,documentationComponent:(0,r.jsxs)(r.Fragment,{children:['Slices are sections of your website. Prismic documents contain a dynamic "Slice Zone" that allows content creators to add, edit, and rearrange Slices to compose dynamic layouts for any page design.'," ",(0,r.jsx)(u.rU,{target:"_blank",href:"https://prismic.io/docs/core-concepts/slices",sx:function(e){var n;return{color:null==e?void 0:null===(n=e.colors)||void 0===n?void 0:n.primary}},children:"Learn more"}),"."]})})}):X.map(function(e){var n=e.name,t=e.isLocal,i=e.components;return(0,r.jsxs)(u.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,r.jsxs)(u.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsx)(u.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,r.jsx)(u.xv,{children:n})}),!t&&(0,r.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,r.jsx)(v.Z,{elems:i,defineElementKey:function(e){return e.model.name},renderElem:function(e){return(0,r.jsx)(T.b,{action:{type:"menu",onRemove:function(){$(e),L()},onRename:function(){$(e),w()}},mode:"navigation",onUpdateScreenshot:function(){P({sliceFilterFn:function(n){return n.filter(function(n){return n.model.id===e.model.id})}})},slice:e,variant:"solid"})},gridGap:"32px 16px"})]},n)})}):void 0}),(null==H?void 0:H.length)>0&&(0,r.jsx)(j.Z,{slices:R(q),defaultVariationSelector:O}),(null==H?void 0:H.length)>0&&K&&(0,r.jsx)(h.c,{localLibraries:H,remoteSlices:z,onSuccess:function(e,n){var t=e.variations[0].id,i=W.Y.getBuilderPagePathname({libraryName:n,sliceName:e.name,variationId:t});C.push(i),m.Am.success((0,D.kQ)({path:"".concat(n,"/").concat(e.name,"/model.json")}))},onClose:function(){B(!1)}}),(0,r.jsx)(N,{sliceId:null!==(e=null==Y?void 0:Y.model.id)&&void 0!==e?e:"",sliceName:null!==(n=null==Y?void 0:Y.model.name)&&void 0!==n?n:"",libName:null!==(t=null==Y?void 0:Y.from)&&void 0!==t?t:"","data-cy":"rename-slice-modal"}),(0,r.jsx)(M,{sliceId:null!==(a=null==Y?void 0:Y.model.id)&&void 0!==a?a:"",sliceName:null!==(y=null==Y?void 0:Y.model.name)&&void 0!==y?y:"",libName:null!==(b=null==Y?void 0:Y.from)&&void 0!==b?b:""})]})]})]})}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return g}});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"],l={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function a(e){return(l[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function c(e,n){return void 0===n&&(n=","),e.split(n)}function s(e,n,t){void 0===n&&(n="+");var i,l=e.toLocaleLowerCase().split(n).map(function(e){return a(e)});return r({},{alt:l.includes("alt"),ctrl:l.includes("ctrl")||l.includes("control"),shift:l.includes("shift"),meta:l.includes("meta"),mod:l.includes("mod")},{keys:l.filter(function(e){return!o.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([a(e.key),a(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&m([a(e.key),a(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){u.clear()});var u=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];u.has("meta")&&u.forEach(function(e){var n;return!o.includes(e)&&u.delete(e.toLowerCase())}),n.forEach(function(e){return u.add(e.toLowerCase())})}function m(e){var n=Array.isArray(e)?e:[e];"meta"===e?u.clear():n.forEach(function(e){return u.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 x=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,l=n.meta,c=n.mod,s=n.shift,f=n.ctrl,m=n.keys,p=e.key,x=e.code,h=e.ctrlKey,v=e.metaKey,y=e.shiftKey,b=e.altKey,g=a(x),j=p.toLowerCase();if(!t){if(!b===o&&"alt"!==j||!y===s&&"shift"!==j)return!1;if(c){if(!v&&!h)return!1}else if(!v===l&&"meta"!==j&&"os"!==j||!h===f&&"ctrl"!==j&&"control"!==j)return!1}return!!(m&&1===m.length&&(m.includes(j)||m.includes(g)))||(m?(void 0===r&&(r=","),(d(i=m)?i:i.split(r)).every(function(e){return u.has(e.trim().toLowerCase())})):!m)},h=(0,i.createContext)(void 0),v=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},b="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function g(e,n,t,r){var o,l,u=(0,i.useRef)(null),g=(0,i.useRef)(!1),j=t instanceof Array?r instanceof Array?void 0:r:t,S=d(e)?e.join(null==j?void 0:j.splitKey):e,C=t instanceof Array?t:r instanceof Array?r:void 0,k=(0,i.useCallback)(n,null!=C?C:[]),w=(0,i.useRef)(k);C?w.current=k:w.current=n;var L=(!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}((l=(0,i.useRef)(void 0)).current,j)&&(l.current=j),l.current),I=(0,i.useContext)(v).enabledScopes,E=(0,i.useContext)(h);return b(function(){if((null==L?void 0:L.enabled)!==!1&&(e=I,n=null==L?void 0:L.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==L?void 0:L.enableOnFormTags)||null!=L&&null!=L.ignoreEventWhen&&L.ignoreEventWhen(e))){if(null!==u.current&&document.activeElement!==u.current&&!u.current.contains(document.activeElement)){y(e);return}(null==(t=e.target)||!t.isContentEditable||null!=L&&L.enableOnContentEditable)&&c(S,null==L?void 0:L.splitKey).forEach(function(t){var i,r,o,l,a,c,u,d=s(t,null==L?void 0:L.combinationKey);if(x(e,d,null==L?void 0:L.ignoreModifiers)||null!=(u=d.keys)&&u.includes("*")){if(n&&g.current)return;if(i=e,r=d,("function"==typeof(o=null==L?void 0:L.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),l=e,a=d,"function"==typeof(c=null==L?void 0:L.enabled)?!c(l,a):!0!==c&&void 0!==c){y(e);return}w.current(e,d),n||(g.current=!0)}})}},i=function(e){void 0!==e.key&&(f(a(e.code)),((null==L?void 0:L.keydown)===void 0&&(null==L?void 0:L.keyup)!==!0||null!=L&&L.keydown)&&t(e))},r=function(e){void 0!==e.key&&(m(a(e.code)),g.current=!1,null!=L&&L.keyup&&t(e,!0))},o=u.current||(null==j?void 0:j.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),E&&c(S,null==L?void 0:L.splitKey).forEach(function(e){return E.addHotkey(s(e,null==L?void 0:L.combinationKey,null==L?void 0:L.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),E&&c(S,null==L?void 0:L.splitKey).forEach(function(e){return E.removeHotkey(s(e,null==L?void 0:L.combinationKey,null==L?void 0:L.description))})}}},[S,L,I]),u}}},function(e){e.O(0,[789,958,80,774,888,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { describe, expect } from "vitest";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
CustomType,
|
|
5
|
-
DynamicSection,
|
|
6
|
-
} from "@prismicio/types-internal/lib/customtypes";
|
|
7
|
-
|
|
8
|
-
import * as CustomTypeModel from "../customType";
|
|
9
|
-
|
|
10
|
-
describe("CustomTypeModel test suite", () => {
|
|
11
|
-
const mainSection: DynamicSection = {
|
|
12
|
-
uid: {
|
|
13
|
-
config: {
|
|
14
|
-
label: "MainSectionField",
|
|
15
|
-
},
|
|
16
|
-
type: "UID",
|
|
17
|
-
},
|
|
18
|
-
slices: {
|
|
19
|
-
type: "Slices",
|
|
20
|
-
fieldset: "Slice Zone",
|
|
21
|
-
config: {
|
|
22
|
-
choices: {
|
|
23
|
-
hero_banner: {
|
|
24
|
-
type: "SharedSlice",
|
|
25
|
-
},
|
|
26
|
-
promo_section_image_tiles: {
|
|
27
|
-
type: "SharedSlice",
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
const anotherSection: DynamicSection = {
|
|
34
|
-
uid: {
|
|
35
|
-
config: {
|
|
36
|
-
label: "AnotherSectionField",
|
|
37
|
-
},
|
|
38
|
-
type: "UID",
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
const mockCustomType: CustomType = {
|
|
42
|
-
format: "custom",
|
|
43
|
-
id: "id",
|
|
44
|
-
json: {
|
|
45
|
-
mainSection,
|
|
46
|
-
anotherSection,
|
|
47
|
-
},
|
|
48
|
-
label: "lama",
|
|
49
|
-
repeatable: true,
|
|
50
|
-
status: true,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
it("getSectionEntries should return the sections entries", () => {
|
|
54
|
-
expect(CustomTypeModel.getSectionEntries(mockCustomType)).toEqual([
|
|
55
|
-
["mainSection", mainSection],
|
|
56
|
-
["anotherSection", anotherSection],
|
|
57
|
-
]);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it("getSectionEntries should return an empty array if there are no sections", () => {
|
|
61
|
-
expect(
|
|
62
|
-
CustomTypeModel.getSectionEntries({
|
|
63
|
-
...mockCustomType,
|
|
64
|
-
json: {},
|
|
65
|
-
}),
|
|
66
|
-
).toEqual([]);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("getMainSectionEntry should return the first section even if not named Main", () => {
|
|
70
|
-
expect(CustomTypeModel.getMainSectionEntry(mockCustomType)).toEqual([
|
|
71
|
-
"mainSection",
|
|
72
|
-
mainSection,
|
|
73
|
-
]);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it("getMainSectionEntry should return undefined if there is are sections", () => {
|
|
77
|
-
expect(
|
|
78
|
-
CustomTypeModel.getMainSectionEntry({
|
|
79
|
-
...mockCustomType,
|
|
80
|
-
json: {},
|
|
81
|
-
}),
|
|
82
|
-
).toEqual(undefined);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("getSection should return the section matching the key", () => {
|
|
86
|
-
expect(
|
|
87
|
-
CustomTypeModel.getSection(mockCustomType, "anotherSection"),
|
|
88
|
-
).toEqual(anotherSection);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it("getSection should return undefined if there are no sections", () => {
|
|
92
|
-
expect(
|
|
93
|
-
CustomTypeModel.getSection(
|
|
94
|
-
{
|
|
95
|
-
...mockCustomType,
|
|
96
|
-
json: {},
|
|
97
|
-
},
|
|
98
|
-
"mainSection",
|
|
99
|
-
),
|
|
100
|
-
).toEqual(undefined);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("getSectionSliceZoneConfig should return the config of the given section", () => {
|
|
104
|
-
expect(
|
|
105
|
-
CustomTypeModel.getSectionSliceZoneConfig(mockCustomType, "mainSection"),
|
|
106
|
-
).toEqual({
|
|
107
|
-
choices: {
|
|
108
|
-
hero_banner: {
|
|
109
|
-
type: "SharedSlice",
|
|
110
|
-
},
|
|
111
|
-
promo_section_image_tiles: {
|
|
112
|
-
type: "SharedSlice",
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it("getSectionSliceZoneConfig should return undefined if there are no sections", () => {
|
|
119
|
-
expect(
|
|
120
|
-
CustomTypeModel.getSectionSliceZoneConfig(
|
|
121
|
-
{
|
|
122
|
-
...mockCustomType,
|
|
123
|
-
json: {},
|
|
124
|
-
},
|
|
125
|
-
"mainSection",
|
|
126
|
-
),
|
|
127
|
-
).toEqual(undefined);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it("findNextSectionSliceZoneKey should return 'slices'", () => {
|
|
131
|
-
expect(
|
|
132
|
-
CustomTypeModel.findNextSectionSliceZoneKey(
|
|
133
|
-
{
|
|
134
|
-
...mockCustomType,
|
|
135
|
-
json: {
|
|
136
|
-
anotherSection: {},
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
"anotherSection",
|
|
140
|
-
),
|
|
141
|
-
).toEqual("slices");
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it("findNextSectionSliceZoneKey should return 'slices1'", () => {
|
|
145
|
-
expect(
|
|
146
|
-
CustomTypeModel.findNextSectionSliceZoneKey(
|
|
147
|
-
mockCustomType,
|
|
148
|
-
"anotherSection",
|
|
149
|
-
),
|
|
150
|
-
).toEqual("slices1");
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it("findNextSectionSliceZoneKey should return 'slices2'", () => {
|
|
154
|
-
expect(
|
|
155
|
-
CustomTypeModel.findNextSectionSliceZoneKey(
|
|
156
|
-
{
|
|
157
|
-
...mockCustomType,
|
|
158
|
-
json: {
|
|
159
|
-
mainSection,
|
|
160
|
-
SecondSection: {
|
|
161
|
-
slices1: {
|
|
162
|
-
type: "Slices",
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
anotherSection,
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
"anotherSection",
|
|
169
|
-
),
|
|
170
|
-
).toEqual("slices2");
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it("findNextSectionSliceZoneKey should return 'slices3'", () => {
|
|
174
|
-
expect(
|
|
175
|
-
CustomTypeModel.findNextSectionSliceZoneKey(
|
|
176
|
-
{
|
|
177
|
-
...mockCustomType,
|
|
178
|
-
json: {
|
|
179
|
-
mainSection,
|
|
180
|
-
SecondSection: {
|
|
181
|
-
slices2: {
|
|
182
|
-
type: "Slices",
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
anotherSection,
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
"anotherSection",
|
|
189
|
-
),
|
|
190
|
-
).toEqual("slices3");
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it("createSectionSliceZone should return the given custom type with a slice zone for given section", () => {
|
|
194
|
-
expect(
|
|
195
|
-
CustomTypeModel.createSectionSliceZone(mockCustomType, "anotherSection"),
|
|
196
|
-
).toEqual({
|
|
197
|
-
...mockCustomType,
|
|
198
|
-
json: {
|
|
199
|
-
...mockCustomType.json,
|
|
200
|
-
anotherSection: {
|
|
201
|
-
...mockCustomType.json.anotherSection,
|
|
202
|
-
slices1: {
|
|
203
|
-
type: "Slices",
|
|
204
|
-
fieldset: "Slice Zone",
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it("createSectionSliceZone should return the same custom type if slice zone already exist for given section", () => {
|
|
212
|
-
expect(
|
|
213
|
-
CustomTypeModel.createSectionSliceZone(mockCustomType, "mainSection"),
|
|
214
|
-
).toEqual(mockCustomType);
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it("convertToPageType should convert the given custom type", () => {
|
|
218
|
-
expect(CustomTypeModel.convertToPageType(mockCustomType)).toEqual({
|
|
219
|
-
...mockCustomType,
|
|
220
|
-
format: "page",
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
it("convertToPageType should convert the given custom type with a slice zone for Main section when it doesn't exist", () => {
|
|
225
|
-
expect(
|
|
226
|
-
CustomTypeModel.convertToPageType({
|
|
227
|
-
...mockCustomType,
|
|
228
|
-
json: {
|
|
229
|
-
mainSection: {},
|
|
230
|
-
anotherSection,
|
|
231
|
-
},
|
|
232
|
-
}),
|
|
233
|
-
).toEqual({
|
|
234
|
-
...mockCustomType,
|
|
235
|
-
json: {
|
|
236
|
-
mainSection: {
|
|
237
|
-
slices: {
|
|
238
|
-
type: "Slices",
|
|
239
|
-
fieldset: "Slice Zone",
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
anotherSection,
|
|
243
|
-
},
|
|
244
|
-
format: "page",
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
2
|
-
import { ComponentUI } from "@lib/models/common/ComponentUI";
|
|
3
|
-
import { VariationSM } from "@lib/models/common/Slice";
|
|
4
|
-
import useCurrentSlice from "@src/hooks/useCurrentSlice";
|
|
5
|
-
import { AppProps } from "next/app";
|
|
6
|
-
|
|
7
|
-
import { replace } from "connected-next-router";
|
|
8
|
-
|
|
9
|
-
export type ComponentWithSliceProps = React.FC<{
|
|
10
|
-
slice: ComponentUI;
|
|
11
|
-
variation: VariationSM;
|
|
12
|
-
}>;
|
|
13
|
-
|
|
14
|
-
export const createComponentWithSlice = (C: ComponentWithSliceProps) => {
|
|
15
|
-
const Wrapper: React.FC<{ pageProps?: AppProps }> & {
|
|
16
|
-
CustomLayout?: React.FC<{ children: ReactNode }>;
|
|
17
|
-
} = ({ pageProps }) => {
|
|
18
|
-
const { slice, variation } = useCurrentSlice();
|
|
19
|
-
if (!slice || !variation) {
|
|
20
|
-
void replace("/");
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
return <C slice={slice} variation={variation} {...pageProps} />;
|
|
24
|
-
};
|
|
25
|
-
return Wrapper;
|
|
26
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ActionType, createAsyncAction } from "typesafe-actions";
|
|
2
|
-
import type { ScreenshotGenerationMethod } from "@lib/models/common/Screenshots";
|
|
3
|
-
import { ComponentUI, ScreenshotUI } from "@lib/models/common/ComponentUI";
|
|
4
|
-
|
|
5
|
-
export type SelectedSliceActions = ActionType<
|
|
6
|
-
typeof generateSliceCustomScreenshotCreator
|
|
7
|
-
>;
|
|
8
|
-
|
|
9
|
-
export const generateSliceCustomScreenshotCreator = createAsyncAction(
|
|
10
|
-
"SLICE/GENERATE_CUSTOM_SCREENSHOT.REQUEST",
|
|
11
|
-
"SLICE/GENERATE_CUSTOM_SCREENSHOT.RESPONSE",
|
|
12
|
-
"SLICE/GENERATE_CUSTOM_SCREENSHOT.FAILURE",
|
|
13
|
-
)<
|
|
14
|
-
{
|
|
15
|
-
variationId: string;
|
|
16
|
-
component: ComponentUI;
|
|
17
|
-
file: Blob;
|
|
18
|
-
method: ScreenshotGenerationMethod;
|
|
19
|
-
},
|
|
20
|
-
{ variationId: string; screenshot: ScreenshotUI; component: ComponentUI }
|
|
21
|
-
>();
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call,
|
|
3
|
-
fork,
|
|
4
|
-
takeLatest,
|
|
5
|
-
put,
|
|
6
|
-
SagaReturnType,
|
|
7
|
-
} from "redux-saga/effects";
|
|
8
|
-
import { getType } from "typesafe-actions";
|
|
9
|
-
import { withLoader } from "../loading";
|
|
10
|
-
import { LoadingKeysEnum } from "../loading/types";
|
|
11
|
-
import { generateSliceCustomScreenshotCreator } from "./actions";
|
|
12
|
-
import { generateSliceCustomScreenshot, telemetry } from "@src/apiClient";
|
|
13
|
-
import { openToasterCreator, ToasterType } from "@src/modules/toaster";
|
|
14
|
-
|
|
15
|
-
export function* generateSliceCustomScreenshotSaga({
|
|
16
|
-
payload,
|
|
17
|
-
}: ReturnType<typeof generateSliceCustomScreenshotCreator.request>) {
|
|
18
|
-
const { variationId, component, file, method } = payload;
|
|
19
|
-
try {
|
|
20
|
-
const form = new FormData();
|
|
21
|
-
form.append("file", file);
|
|
22
|
-
form.append("libraryName", component.from);
|
|
23
|
-
form.append("sliceName", component.model.name);
|
|
24
|
-
form.append("variationId", variationId);
|
|
25
|
-
const response = (yield call(generateSliceCustomScreenshot, {
|
|
26
|
-
libraryName: component.from,
|
|
27
|
-
sliceId: component.model.id,
|
|
28
|
-
variationId,
|
|
29
|
-
file,
|
|
30
|
-
})) as SagaReturnType<typeof generateSliceCustomScreenshot>;
|
|
31
|
-
|
|
32
|
-
if (!response?.url) {
|
|
33
|
-
throw Error("No screenshot saved");
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
void telemetry.track({ event: "screenshot-taken", type: "custom", method });
|
|
37
|
-
|
|
38
|
-
yield put(
|
|
39
|
-
generateSliceCustomScreenshotCreator.success({
|
|
40
|
-
variationId,
|
|
41
|
-
screenshot: {
|
|
42
|
-
url: response.url,
|
|
43
|
-
},
|
|
44
|
-
component,
|
|
45
|
-
}),
|
|
46
|
-
);
|
|
47
|
-
} catch (e) {
|
|
48
|
-
yield put(
|
|
49
|
-
openToasterCreator({
|
|
50
|
-
content: "Internal Error: Custom screenshot not saved",
|
|
51
|
-
type: ToasterType.ERROR,
|
|
52
|
-
}),
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function* watchGenerateSliceCustomScreenshot() {
|
|
58
|
-
yield takeLatest(
|
|
59
|
-
getType(generateSliceCustomScreenshotCreator.request),
|
|
60
|
-
withLoader(
|
|
61
|
-
generateSliceCustomScreenshotSaga,
|
|
62
|
-
LoadingKeysEnum.GENERATE_SLICE_CUSTOM_SCREENSHOT,
|
|
63
|
-
),
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Saga Exports
|
|
68
|
-
export function* screenshotsSagas() {
|
|
69
|
-
yield fork(watchGenerateSliceCustomScreenshot);
|
|
70
|
-
}
|