slice-machine-ui 2.16.2-beta.1 → 2.16.2-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/404.html +1 -1
- package/out/_next/static/EvmgR0Gau-7Wz9Fnt3n3p/_buildManifest.js +1 -0
- package/out/_next/static/chunks/157-54b8336d20b41933.js +3 -0
- package/out/_next/static/chunks/{183-85de38d65a85dc2c.js → 183-4ea255b867ff171b.js} +1 -1
- package/out/_next/static/chunks/397-e6c340070a3bcb41.js +1 -0
- package/out/_next/static/chunks/{main-1c0e53194ff2e726.js → main-c46f4dcf6e3174bd.js} +1 -1
- package/out/_next/static/chunks/pages/{_app-4f1854df4dfc747d.js → _app-80614b8c7575109c.js} +46 -46
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-61a3846ae1654f54.js → [customTypeId]-389d1b7a492fb3e7.js} +1 -1
- package/out/_next/static/chunks/pages/{custom-types-093f2e2213561492.js → custom-types-2a5fd94ee42ba593.js} +1 -1
- package/out/_next/static/chunks/pages/{index-0e27ae9805b59004.js → index-02dd147957c8b40f.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-91a4eb622fa3cb7c.js → [pageTypeId]-3589bd1f9138a97b.js} +1 -1
- package/out/_next/static/chunks/pages/{settings-0da3553b3a0acc99.js → settings-170379902605f38a.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-c71823bf02dc292d.js → [variation]-6de02b8ed13b680d.js} +1 -1
- package/out/_next/static/chunks/pages/{slices-7e816c2b32cc6f19.js → slices-071bb494907adf0f.js} +1 -1
- package/out/_next/static/css/{f0e6d8449ce2bb46.css → 9c9a7de81f9ac811.css} +1 -1
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/settings.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +5 -5
- package/src/apiClient.ts +8 -6
- package/src/legacy/components/App/index.tsx +0 -2
- package/src/modules/loading/types.ts +0 -1
- package/src/modules/useSliceMachineActions.ts +0 -23
- package/src/modules/userContext/index.ts +1 -33
- package/src/modules/userContext/types.ts +0 -13
- package/src/styles/modal.css +0 -22
- package/test/src/modules/userContext.test.ts +1 -50
- package/out/_next/static/9BX45OSSCQeaYmYslFbMt/_buildManifest.js +0 -1
- package/out/_next/static/chunks/157-fca2f00f6df07660.js +0 -5
- package/src/legacy/components/ReviewModal/ReviewForm.tsx +0 -169
- package/src/legacy/components/ReviewModal/ReviewFormSelect.tsx +0 -35
- package/src/legacy/components/ReviewModal/ReviewModal.tsx +0 -56
- package/src/legacy/components/ReviewModal/index.ts +0 -1
- /package/out/_next/static/{9BX45OSSCQeaYmYslFbMt → EvmgR0Gau-7Wz9Fnt3n3p}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[625],{95759:function(n,u,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/custom-types/[customTypeId]",function(){return t(60802)}])},60802:function(n,u,t){"use strict";t.r(u),t.d(u,{default:function(){return _.H}});var _=t(60882)}},function(n){n.O(0,[898,917,525,461,139,183,44,349,385,34,867,630,268,882,888,774,179],function(){return n(n.s=95759)}),_N_E=n.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[625],{95759:function(n,u,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/custom-types/[customTypeId]",function(){return t(60802)}])},60802:function(n,u,t){"use strict";t.r(u),t.d(u,{default:function(){return _.H}});var _=t(60882)}},function(n){n.O(0,[898,917,525,461,139,397,183,44,349,385,34,867,630,268,882,888,774,179],function(){return n(n.s=95759)}),_N_E=n.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[379],{70320:function(n,u,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/custom-types",function(){return t(41194)}])},41194:function(n,u,t){"use strict";t.r(u);var _=t(52322),s=t(78075);u.default=()=>(0,_.jsx)(s.F,{format:"custom"})}},function(n){n.O(0,[867,895,888,774,179],function(){return n(n.s=70320)}),_N_E=n.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[379],{70320:function(n,u,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/custom-types",function(){return t(41194)}])},41194:function(n,u,t){"use strict";t.r(u);var _=t(52322),s=t(78075);u.default=()=>(0,_.jsx)(s.F,{format:"custom"})}},function(n){n.O(0,[397,867,895,888,774,179],function(){return n(n.s=70320)}),_N_E=n.O()}]);
|
package/out/_next/static/chunks/pages/{index-0e27ae9805b59004.js → index-02dd147957c8b40f.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{87314:function(n,u,_){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return _(17134)}])},17134:function(n,u,_){"use strict";_.r(u);var t=_(52322),e=_(78075);u.default=()=>(0,t.jsx)(e.F,{format:"page"})}},function(n){n.O(0,[867,895,888,774,179],function(){return n(n.s=87314)}),_N_E=n.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{87314:function(n,u,_){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return _(17134)}])},17134:function(n,u,_){"use strict";_.r(u);var t=_(52322),e=_(78075);u.default=()=>(0,t.jsx)(e.F,{format:"page"})}},function(n){n.O(0,[397,867,895,888,774,179],function(){return n(n.s=87314)}),_N_E=n.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[936],{61367:function(n,u,e){(window.__NEXT_P=window.__NEXT_P||[]).push(["/page-types/[pageTypeId]",function(){return e(89173)}])},89173:function(n,u,e){"use strict";e.r(u),e.d(u,{default:function(){return t.H}});var t=e(60882)}},function(n){n.O(0,[898,917,525,461,139,183,44,349,385,34,867,630,268,882,888,774,179],function(){return n(n.s=61367)}),_N_E=n.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[936],{61367:function(n,u,e){(window.__NEXT_P=window.__NEXT_P||[]).push(["/page-types/[pageTypeId]",function(){return e(89173)}])},89173:function(n,u,e){"use strict";e.r(u),e.d(u,{default:function(){return t.H}});var t=e(60882)}},function(n){n.O(0,[898,917,525,461,139,397,183,44,349,385,34,867,630,268,882,888,774,179],function(){return n(n.s=61367)}),_N_E=n.O()}]);
|
package/out/_next/static/chunks/pages/{settings-0da3553b3a0acc99.js → settings-170379902605f38a.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[662],{24994:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/settings",function(){return n(62578)}])},99251:function(e,t,n){"use strict";n.d(t,{Q:function(){return l}});let i={GitHub:"gitHub"};var r=n(52322),o=n(80148);let l={gitHub:{connect:async()=>await s("gitHub"),Icon:e=>(0,r.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{d:"M12 4C7.57486 4 4 7.57486 4 12C4 15.5246 6.30057 18.5257 9.47429 19.6C9.87429 19.6754 10.0251 19.4251 10.0251 19.2251V17.8754C7.8 18.3497 7.32457 16.8 7.32457 16.8C6.94971 15.8743 6.42514 15.6251 6.42514 15.6251C5.70057 15.1246 6.47543 15.1497 6.47543 15.1497C7.27543 15.2 7.69943 15.9749 7.69943 15.9749C8.42514 17.2 9.57486 16.8503 10.0251 16.6491C10.1006 16.1246 10.2994 15.7749 10.5246 15.5749C8.74971 15.3749 6.87543 14.6754 6.87543 11.6251C6.87543 10.7497 7.17486 10.0503 7.69943 9.47543C7.62514 9.27543 7.34971 8.45029 7.77486 7.34971C7.77486 7.34971 8.44914 7.12457 9.97486 8.17486C10.6266 7.99627 11.2991 7.90405 11.9749 7.90057C12.6491 7.90057 13.3497 8 13.9749 8.17486C15.5006 7.14971 16.1749 7.34971 16.1749 7.34971C16.6 8.45029 16.3246 9.27543 16.2503 9.47543C16.776 10.024 17.0754 10.7497 17.0754 11.624C17.0754 14.6994 15.2 15.3749 13.4251 15.5749C13.6994 15.8251 13.9749 16.2994 13.9749 17.0491V19.2503C13.9749 19.4754 14.1246 19.7246 14.5246 19.6251C17.7006 18.5246 20 15.5246 20 12C20 7.57486 16.4251 4 12 4Z",fill:"currentColor"})}),name:"GitHub",supported:c("gitHub")},bitbucket:{connect:async()=>await s("bitbucket"),Icon:e=>(0,r.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.77596 5.47599C4.84147 5.44648 4.91265 5.43167 4.9845 5.4326L19.3525 5.43506C19.4243 5.43413 19.4955 5.44894 19.561 5.47845C19.6265 5.50796 19.6848 5.55146 19.7317 5.60588C19.7786 5.6603 19.8131 5.72433 19.8326 5.79348C19.8521 5.86262 19.8563 5.93521 19.8448 6.00614L19.1802 10.0751H9.71803L10.5722 14.6018H11.1162L11.1162 14.6018H13.7846L14.56 10.0751H19.1803L17.7575 18.8357C17.7387 18.9522 17.6786 19.058 17.5882 19.1339C17.4979 19.2098 17.3832 19.2507 17.2652 19.2492H7.23692C7.2134 19.249 7.19001 19.2476 7.16682 19.2449C7.03392 19.2298 6.90803 19.175 6.80603 19.0868C6.68704 18.9851 6.60772 18.8448 6.58203 18.6904L4.49219 6.00367C4.48069 5.93275 4.48485 5.86016 4.50438 5.79102C4.52392 5.72187 4.55835 5.65784 4.60527 5.60342C4.65218 5.54899 4.71044 5.5055 4.77596 5.47599Z",fill:"currentColor"})}),name:"Bitbucket",supported:c("bitbucket")},gitLab:{connect:async()=>await s("gitLab"),Icon:e=>(0,r.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.7881 10.5954L16.5431 5.20756C16.6328 4.93081 17.0594 4.93081 17.1492 5.20756L18.9076 10.5954H14.7881ZM6.6192 5.20756L4.86353 10.5954H8.97968L7.22468 5.20756C7.1349 4.93081 6.70898 4.93081 6.6192 5.20756ZM4.0299 13.2981L4.86352 10.5954H4.86353H8.979H14.7881H18.9076L19.7392 13.2981C19.7796 13.4207 19.7802 13.553 19.7408 13.676C19.7014 13.799 19.624 13.9063 19.5198 13.9826L11.893 19.5257L11.8879 19.5319L11.8923 19.5378L11.8865 19.5336L11.8835 19.5371L11.8852 19.5326L4.24927 13.9826C4.0299 13.8246 3.95092 13.5458 4.0299 13.2981Z",fill:"currentColor"})}),name:"GitLab",supported:c("gitLab")}};async function s(e){if(!c(e))throw Error("Not implemented.");let t=await o.managerClient.git.getProviderAppInstallURL({provider:e});window.open(t,"git-provider-app-installation")}function c(e){return!!Object.values(i).includes(e)}},45276:function(e,t,n){"use strict";n.d(t,{G:function(){return l}});var i=n(18566),r=n(31470),o=n(80148);function l(){let[e]=(0,r.f)();return{linkedGitRepos:(0,i.QT)(s,[e.repositoryName]),linkRepo:async t=>{await o.managerClient.git.linkRepo({prismic:{domain:e.repositoryName},git:t}),await (0,i.gw)(s,[e.repositoryName])},unlinkRepo:async t=>{await o.managerClient.git.unlinkRepo({prismic:{domain:e.repositoryName},git:t}),await (0,i.gw)(s,[e.repositoryName])}}}async function s(e){return await o.managerClient.git.fetchLinkedRepos({prismic:{domain:e}})}},31470:function(e,t,n){"use strict";n.d(t,{f:function(){return o}});var i=n(18566),r=n(80148);function o(){return[(0,i.QT)(l,[]),async e=>{await r.managerClient.project.writeSliceMachineConfig({config:e}),(0,i.VA)(l,[],e)}]}async function l(){return r.managerClient.project.getSliceMachineConfig()}},62578:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return er}});var i=n(52322),r=n(7729),o=n(97729),l=n.n(o),s=n(5632),c=n(2784),a=n(43388),d=n(37792),u=n(35050),x=n.n(u);let h=e=>(0,i.jsx)("div",{...e,className:x().root}),g=e=>{let{children:t,...n}=e;return(0,i.jsx)("div",{...n,className:x().legend,children:(0,i.jsx)(r.xvT,{color:"grey11",component:"span",noWrap:!0,variant:"smallBold",children:t})})},m=e=>(0,i.jsx)("div",{...e,className:x().header}),j=e=>(0,i.jsx)("div",{...e,className:x().content}),_=e=>(0,i.jsx)("ul",{...e,className:x().list}),p=e=>{let{action:t,children:n,...o}=e;return(0,i.jsxs)("li",{...o,className:x().listItem,children:[(0,i.jsx)(r.xvT,{component:"span",noWrap:!0,variant:"bold",sx:{flexGrow:1},children:n}),t]})},f=e=>{let{action:t,children:n,...o}=e;return(0,i.jsxs)("div",{...o,className:x().footer,children:[(0,i.jsx)(r.xvT,{color:"grey11",component:"span",noWrap:!0,variant:"small",sx:{flexGrow:1},children:n}),t]})};var w=n(17378);let v=e=>{let{title:t,description:n,action:o}=e;return(0,i.jsxs)(r.xuv,{flexDirection:"column",padding:{block:72,inline:100},children:[(0,i.jsx)(r.xvT,{align:"center",variant:"emphasized",children:t}),(0,i.jsx)(r.xvT,{align:"center",color:"grey11",children:n}),o?(0,i.jsx)(r.hE2,{sx:{alignSelf:"center",marginTop:8},children:o}):void 0]})};var C=n(98863),b=n(88932),y=n(99251);let S=()=>(0,i.jsx)(r.hE2,{children:(0,C.XP)(y.Q).map(e=>(0,i.jsx)(k,{provider:e,sx:{flexBasis:0,flexGrow:1}},e))}),k=e=>{let{provider:t,sx:n}=e,{connect:o,Icon:l,name:s,supported:a}=y.Q[t],[d,u]=(0,c.useState)(!1);return(0,i.jsxs)(r.zxk,{color:"grey",disabled:!a,loading:d,onClick:()=>{(async()=>{u(!0);try{await o()}catch(t){let e="Could not connect to ".concat(s);console.error(e,t),b.Am.error(e),u(!1)}})()},renderStartIcon:()=>(0,i.jsx)(l,{color:r.rSc.color.grey11}),sx:n,children:[s,a?void 0:(0,i.jsx)(r.xvT,{color:"inherit",variant:"small",children:" (soon)"})]})},F=e=>{let{date:t,...n}=e;return(0,i.jsx)(r.xvT,{...n,color:"inherit",variant:"inherit",children:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;return L.format(Math.round((+T(e)-+T(t))/864e5),"day")}(t)})},L=new Intl.RelativeTimeFormat("en",{numeric:"auto",style:"narrow"});function T(e){let t=new Date(e);return t.setHours(0,0,0,0),t}var Z=n(63397),I=n(31470),R=n(80148),P=n(30613);let N=e=>{let{linkRepo:t,repo:n,trigger:o}=e,l=y.Q[n.provider],{updateToken:s}=function(e){let[t]=(0,I.f)();return{updateToken:async n=>{await R.managerClient.git.updateWriteAPIToken({prismic:{domain:t.repositoryName},git:e.git,token:n})}}}({git:n}),{repositoryUrl:c}=(0,P.U)();return(0,i.jsxs)(r.VqE,{size:{width:448,height:"auto"},trigger:o,children:[(0,i.jsx)(r.fKu,{title:"Prismic Write API token required"}),(0,i.jsx)(r.cZJ,{children:(0,i.jsx)(Z.J9,{initialValues:{writeAPIToken:""},validate:e=>{if(0===e.writeAPIToken.length)return{writeAPIToken:"Cannot be empty"}},onSubmit:async e=>{try{await t(n),await s(e.writeAPIToken)}catch(t){let e="Could not connect to ".concat(n.name);console.error(e,t),b.Am.error(e)}},children:e=>(0,i.jsxs)("form",{onSubmit:e.handleSubmit,children:[(0,i.jsxs)(r.xuv,{flexDirection:"column",gap:4,padding:16,children:[(0,i.jsx)(r.ytj,{disabled:e.isSubmitting,error:"string"==typeof e.errors.writeAPIToken,label:"Paste your Write API token",onValueChange:t=>{e.setFieldValue("writeAPIToken",t)},placeholder:"Write API token",value:e.values.writeAPIToken}),(0,i.jsxs)(r.xvT,{color:"grey11",children:["Required to sync models from ",l.name," to Prismic."]})]}),(0,i.jsxs)(r.kXR,{children:[(0,i.jsx)(r.qEi,{href:new URL("/settings/apps",c).href,children:"Create a Prismic Write API token"}),(0,i.jsx)(r.POh,{size:"medium"}),(0,i.jsx)(r._dX,{disabled:!e.isValid,loading:e.isSubmitting,onClick:()=>void e.submitForm(),size:"medium",children:"Save Token"})]})]})})})]})},H=e=>{let{repo:t,trigger:n,unlinkRepo:o}=e,[l,s]=(0,c.useState)(!1);return(0,i.jsxs)(r.VqE,{size:{width:448,height:"auto"},trigger:n,children:[(0,i.jsx)(r.fKu,{title:"Remove Git Connection"}),(0,i.jsx)(r.cZJ,{children:(0,i.jsx)(r.xuv,{flexDirection:"column",padding:16,children:(0,i.jsx)(r.xvT,{children:"You will not be able to push your code alongside your models anymore. Note that you can reconnect your Git repository at any time. Are you sure you want to continue?"})})}),(0,i.jsxs)(r.kXR,{children:[(0,i.jsx)(r.POh,{size:"medium"}),(0,i.jsx)(r._dX,{size:"medium",color:"tomato",loading:l,onClick:()=>{(async()=>{s(!0);try{await o(t)}catch(n){let e="Could not disconnect from ".concat(t.name);console.error(e,n),b.Am.error(e)}s(!1)})()},children:"Disconnect"})]})]})};var W=n(45276);let A=e=>{let{mode:t,repos:n}=e,{linkRepo:o,unlinkRepo:l}=(0,W.G)();return(0,i.jsx)(_,{children:"link"===t?n.map(e=>(0,i.jsxs)(p,{action:(0,i.jsx)(N,{linkRepo:o,repo:e,trigger:(0,i.jsx)(r.zxk,{color:"grey",children:"Connect"})}),children:[e.name,(0,i.jsxs)(r.xvT,{color:"grey11",children:[" • ",(0,i.jsx)(F,{date:e.pushedAt})]})]},"".concat(e.provider,"@").concat(e.id))):n.map(e=>(0,i.jsx)(p,{action:(0,i.jsx)(H,{repo:e,trigger:(0,i.jsx)(r.zxk,{color:"grey",children:"Disconnect"}),unlinkRepo:l}),children:e.name},"".concat(e.provider,"@").concat(e.owner,"/").concat(e.name)))})},D=()=>(0,i.jsx)(_,{children:[...[,,,,].keys()].map(e=>(0,i.jsx)(p,{action:(0,i.jsx)(r.OdW,{height:32,width:67.59}),children:(0,i.jsx)(r.OdW,{height:24,sx:{verticalAlign:"middle"},width:129.92})},e))}),G=e=>{let{disabled:t,owners:n=[],selectedOwner:o,onSelectedOwnerChange:l,sx:s}=e;return(0,i.jsx)(r.PhF,{color:"grey",constrainContentWidth:!0,disabled:t,flexContent:!0,onValueChange:e=>{let[t,i]=e.split("@"),r=n.find(e=>e.provider===t&&e.id===i);r&&(null==l||l(r))},placeholder:"Owner",renderStartIcon:()=>(0,i.jsx)(z,{owner:o}),size:"large",sx:s,value:o?M(o):void 0,children:n.map(e=>(0,i.jsx)(r.QlF,{renderStartIcon:()=>(0,i.jsx)(z,{owner:e}),size:"large",value:M(e),children:e.name},M(e)))})},z=e=>{var t;let{owner:n}=e,{Icon:o}=y.Q[null!==(t=null==n?void 0:n.provider)&&void 0!==t?t:"gitHub"];return(0,i.jsx)(o,{color:r.rSc.color.grey11})};function M(e){return"".concat(e.provider,"@").concat(e.id)}var V=n(18566);async function O(e,t,n,i){return await R.managerClient.git.fetchRepos({provider:e,owner:t,query:n,page:i})}let E=e=>{let{owners:t}=e,[n,r]=(0,c.useState)(t[0]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(m,{children:(0,i.jsx)(G,{owners:t,selectedOwner:n,onSelectedOwnerChange:r,sx:{width:"calc(50% - 8px)"}})}),(0,i.jsx)(c.Suspense,{fallback:(0,i.jsx)(Q,{gitOwnerSelect:!1}),children:(0,i.jsx)(B,{owner:n})})]})},B=e=>{var t;let{owner:n}=e,r=(t={provider:n.provider,owner:n.name},(0,V.QT)(O,[t.provider,t.owner,t.query,t.page]));return r.length>0?(0,i.jsx)(A,{mode:"link",repos:r}):(0,i.jsx)(j,{children:(0,i.jsx)(v,{title:"No Results Found",description:"Try selecting a different Git account or organization on the top left."})})},Q=e=>{let{gitOwnerSelect:t}=e;return(0,i.jsxs)(i.Fragment,{children:[t?(0,i.jsx)(m,{children:(0,i.jsx)(G,{disabled:!0,sx:{width:"calc(50% - 8px)"}})}):void 0,(0,i.jsx)(D,{})]})};async function q(){return await R.managerClient.git.fetchOwners()}var K=n(54597);let X=()=>(0,i.jsxs)(h,{children:[(0,i.jsx)(g,{children:"Connected Git Repository"}),(0,i.jsx)(w.S,{renderError:J,children:(0,i.jsx)(c.Suspense,{fallback:(0,i.jsx)(Q,{gitOwnerSelect:!0}),children:(0,i.jsx)(U,{})})}),(0,i.jsx)(f,{action:(0,i.jsx)(r.ua7,{content:"Documentation is coming soon.",side:"bottom",children:(0,i.jsx)(r.hU,{disabled:!0,icon:"openInNew"})}),children:"Learn more about Prismic for Git"})]}),U=()=>{let{linkedGitRepos:e}=(0,W.G)();return e.length>0?(0,i.jsx)(A,{mode:"unlink",repos:e}):(0,i.jsx)(Y,{})},Y=()=>{let e=(0,V.QT)(q,[]);return e.length>0?(0,i.jsx)(E,{owners:e}):(0,i.jsx)(j,{children:(0,i.jsx)(S,{})})};function J(e,t){return(0,d.ff)(e)?(0,i.jsx)($,{}):(0,d.TW)(e)?(0,i.jsx)(ee,{}):(0,i.jsx)(et,{reset:t})}let $=()=>{let{openLoginModal:e}=(0,K.Z)();return(0,i.jsx)(j,{children:(0,i.jsx)(v,{title:"It seems like you are logged out",description:"Log in to connect a Git repository.",action:(0,i.jsx)(r.zxk,{onClick:e,children:"Log in to Prismic"})})})},ee=()=>(0,i.jsx)(j,{children:(0,i.jsx)(v,{title:"It seems like you do not have permission",description:"An owner or admin is required to connect a Git repository."})}),et=e=>{let{reset:t}=e;return(0,i.jsx)(j,{children:(0,i.jsx)(v,{title:"Unable to fetch data",description:"An error occurred while fetching the list of connected Git repositories.",action:(0,i.jsx)(r.zxk,{color:"grey",onClick:t,children:"Retry"})})})};var en=n(83758),ei=n(51384);let er=()=>{let e=(0,en.M)(),t=(0,s.useRouter)();return((0,c.useEffect)(()=>{e.eligible||t.replace("/")},[e.eligible,t]),e.eligible)?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l(),{children:(0,i.jsx)("title",{children:"Settings - Slice Machine"})}),(0,i.jsxs)(ei.LN,{children:[(0,i.jsx)(ei.wd,{children:(0,i.jsx)(ei.Cx,{children:(0,i.jsx)(a.g,{children:"Settings"})})}),(0,i.jsx)(ei.RN,{children:(0,i.jsx)(r.xuv,{flexDirection:"column",maxWidth:600,children:(0,i.jsx)(X,{})})})]})]}):null}},35050:function(e){e.exports={flex:"FieldSet_flex__r2Zbg",column:"FieldSet_column__esHjW FieldSet_flex__r2Zbg",root:"FieldSet_root__MYqY8 FieldSet_column__esHjW FieldSet_flex__r2Zbg",row:"FieldSet_row__DZZjD FieldSet_flex__r2Zbg",borderBottom:"FieldSet_borderBottom__WVCMK",legend:"FieldSet_legend__4k9_l FieldSet_row__DZZjD FieldSet_flex__r2Zbg FieldSet_borderBottom__WVCMK",header:"FieldSet_header__cR_f3 FieldSet_row__DZZjD FieldSet_flex__r2Zbg FieldSet_borderBottom__WVCMK",content:"FieldSet_content__WzxRs FieldSet_column__esHjW FieldSet_flex__r2Zbg",list:"FieldSet_list__mILoo FieldSet_column__esHjW FieldSet_flex__r2Zbg",listItem:"FieldSet_listItem__QOhSB FieldSet_row__DZZjD FieldSet_flex__r2Zbg FieldSet_borderBottom__WVCMK",borderTop:"FieldSet_borderTop__KfoL_",footer:"FieldSet_footer__1VWxY FieldSet_row__DZZjD FieldSet_flex__r2Zbg FieldSet_borderTop__KfoL_"}}},function(e){e.O(0,[888,774,179],function(){return e(e.s=24994)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[662],{24994:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/settings",function(){return n(62578)}])},99251:function(e,t,n){"use strict";n.d(t,{Q:function(){return l}});let i={GitHub:"gitHub"};var r=n(52322),o=n(80148);let l={gitHub:{connect:async()=>await s("gitHub"),Icon:e=>(0,r.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{d:"M12 4C7.57486 4 4 7.57486 4 12C4 15.5246 6.30057 18.5257 9.47429 19.6C9.87429 19.6754 10.0251 19.4251 10.0251 19.2251V17.8754C7.8 18.3497 7.32457 16.8 7.32457 16.8C6.94971 15.8743 6.42514 15.6251 6.42514 15.6251C5.70057 15.1246 6.47543 15.1497 6.47543 15.1497C7.27543 15.2 7.69943 15.9749 7.69943 15.9749C8.42514 17.2 9.57486 16.8503 10.0251 16.6491C10.1006 16.1246 10.2994 15.7749 10.5246 15.5749C8.74971 15.3749 6.87543 14.6754 6.87543 11.6251C6.87543 10.7497 7.17486 10.0503 7.69943 9.47543C7.62514 9.27543 7.34971 8.45029 7.77486 7.34971C7.77486 7.34971 8.44914 7.12457 9.97486 8.17486C10.6266 7.99627 11.2991 7.90405 11.9749 7.90057C12.6491 7.90057 13.3497 8 13.9749 8.17486C15.5006 7.14971 16.1749 7.34971 16.1749 7.34971C16.6 8.45029 16.3246 9.27543 16.2503 9.47543C16.776 10.024 17.0754 10.7497 17.0754 11.624C17.0754 14.6994 15.2 15.3749 13.4251 15.5749C13.6994 15.8251 13.9749 16.2994 13.9749 17.0491V19.2503C13.9749 19.4754 14.1246 19.7246 14.5246 19.6251C17.7006 18.5246 20 15.5246 20 12C20 7.57486 16.4251 4 12 4Z",fill:"currentColor"})}),name:"GitHub",supported:c("gitHub")},bitbucket:{connect:async()=>await s("bitbucket"),Icon:e=>(0,r.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.77596 5.47599C4.84147 5.44648 4.91265 5.43167 4.9845 5.4326L19.3525 5.43506C19.4243 5.43413 19.4955 5.44894 19.561 5.47845C19.6265 5.50796 19.6848 5.55146 19.7317 5.60588C19.7786 5.6603 19.8131 5.72433 19.8326 5.79348C19.8521 5.86262 19.8563 5.93521 19.8448 6.00614L19.1802 10.0751H9.71803L10.5722 14.6018H11.1162L11.1162 14.6018H13.7846L14.56 10.0751H19.1803L17.7575 18.8357C17.7387 18.9522 17.6786 19.058 17.5882 19.1339C17.4979 19.2098 17.3832 19.2507 17.2652 19.2492H7.23692C7.2134 19.249 7.19001 19.2476 7.16682 19.2449C7.03392 19.2298 6.90803 19.175 6.80603 19.0868C6.68704 18.9851 6.60772 18.8448 6.58203 18.6904L4.49219 6.00367C4.48069 5.93275 4.48485 5.86016 4.50438 5.79102C4.52392 5.72187 4.55835 5.65784 4.60527 5.60342C4.65218 5.54899 4.71044 5.5055 4.77596 5.47599Z",fill:"currentColor"})}),name:"Bitbucket",supported:c("bitbucket")},gitLab:{connect:async()=>await s("gitLab"),Icon:e=>(0,r.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.7881 10.5954L16.5431 5.20756C16.6328 4.93081 17.0594 4.93081 17.1492 5.20756L18.9076 10.5954H14.7881ZM6.6192 5.20756L4.86353 10.5954H8.97968L7.22468 5.20756C7.1349 4.93081 6.70898 4.93081 6.6192 5.20756ZM4.0299 13.2981L4.86352 10.5954H4.86353H8.979H14.7881H18.9076L19.7392 13.2981C19.7796 13.4207 19.7802 13.553 19.7408 13.676C19.7014 13.799 19.624 13.9063 19.5198 13.9826L11.893 19.5257L11.8879 19.5319L11.8923 19.5378L11.8865 19.5336L11.8835 19.5371L11.8852 19.5326L4.24927 13.9826C4.0299 13.8246 3.95092 13.5458 4.0299 13.2981Z",fill:"currentColor"})}),name:"GitLab",supported:c("gitLab")}};async function s(e){if(!c(e))throw Error("Not implemented.");let t=await o.managerClient.git.getProviderAppInstallURL({provider:e});window.open(t,"git-provider-app-installation")}function c(e){return!!Object.values(i).includes(e)}},45276:function(e,t,n){"use strict";n.d(t,{G:function(){return l}});var i=n(18566),r=n(31470),o=n(80148);function l(){let[e]=(0,r.f)();return{linkedGitRepos:(0,i.QT)(s,[e.repositoryName]),linkRepo:async t=>{await o.managerClient.git.linkRepo({prismic:{domain:e.repositoryName},git:t}),await (0,i.gw)(s,[e.repositoryName])},unlinkRepo:async t=>{await o.managerClient.git.unlinkRepo({prismic:{domain:e.repositoryName},git:t}),await (0,i.gw)(s,[e.repositoryName])}}}async function s(e){return await o.managerClient.git.fetchLinkedRepos({prismic:{domain:e}})}},31470:function(e,t,n){"use strict";n.d(t,{f:function(){return o}});var i=n(18566),r=n(80148);function o(){return[(0,i.QT)(l,[]),async e=>{await r.managerClient.project.writeSliceMachineConfig({config:e}),(0,i.VA)(l,[],e)}]}async function l(){return r.managerClient.project.getSliceMachineConfig()}},62578:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return er}});var i=n(52322),r=n(7729),o=n(97729),l=n.n(o),s=n(5632),c=n(2784),a=n(43388),d=n(37792),u=n(35050),x=n.n(u);let h=e=>(0,i.jsx)("div",{...e,className:x().root}),g=e=>{let{children:t,...n}=e;return(0,i.jsx)("div",{...n,className:x().legend,children:(0,i.jsx)(r.xvT,{color:"grey11",component:"span",noWrap:!0,variant:"smallBold",children:t})})},m=e=>(0,i.jsx)("div",{...e,className:x().header}),j=e=>(0,i.jsx)("div",{...e,className:x().content}),_=e=>(0,i.jsx)("ul",{...e,className:x().list}),p=e=>{let{action:t,children:n,...o}=e;return(0,i.jsxs)("li",{...o,className:x().listItem,children:[(0,i.jsx)(r.xvT,{component:"span",noWrap:!0,variant:"bold",sx:{flexGrow:1},children:n}),t]})},f=e=>{let{action:t,children:n,...o}=e;return(0,i.jsxs)("div",{...o,className:x().footer,children:[(0,i.jsx)(r.xvT,{color:"grey11",component:"span",noWrap:!0,variant:"small",sx:{flexGrow:1},children:n}),t]})};var w=n(17378);let v=e=>{let{title:t,description:n,action:o}=e;return(0,i.jsxs)(r.xuv,{flexDirection:"column",padding:{block:72,inline:100},children:[(0,i.jsx)(r.xvT,{align:"center",variant:"emphasized",children:t}),(0,i.jsx)(r.xvT,{align:"center",color:"grey11",children:n}),o?(0,i.jsx)(r.hE2,{sx:{alignSelf:"center",marginTop:8},children:o}):void 0]})};var C=n(98863),b=n(88932),y=n(99251);let S=()=>(0,i.jsx)(r.hE2,{children:(0,C.XP)(y.Q).map(e=>(0,i.jsx)(k,{provider:e,sx:{flexBasis:0,flexGrow:1}},e))}),k=e=>{let{provider:t,sx:n}=e,{connect:o,Icon:l,name:s,supported:a}=y.Q[t],[d,u]=(0,c.useState)(!1);return(0,i.jsxs)(r.zxk,{color:"grey",disabled:!a,loading:d,onClick:()=>{(async()=>{u(!0);try{await o()}catch(t){let e="Could not connect to ".concat(s);console.error(e,t),b.Am.error(e),u(!1)}})()},renderStartIcon:()=>(0,i.jsx)(l,{color:r.rSc.color.grey11}),sx:n,children:[s,a?void 0:(0,i.jsx)(r.xvT,{color:"inherit",variant:"small",children:" (soon)"})]})},F=e=>{let{date:t,...n}=e;return(0,i.jsx)(r.xvT,{...n,color:"inherit",variant:"inherit",children:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;return L.format(Math.round((+T(e)-+T(t))/864e5),"day")}(t)})},L=new Intl.RelativeTimeFormat("en",{numeric:"auto",style:"narrow"});function T(e){let t=new Date(e);return t.setHours(0,0,0,0),t}var Z=n(63397),I=n(31470),R=n(80148),P=n(30613);let N=e=>{let{linkRepo:t,repo:n,trigger:o}=e,l=y.Q[n.provider],{updateToken:s}=function(e){let[t]=(0,I.f)();return{updateToken:async n=>{await R.managerClient.git.updateWriteAPIToken({prismic:{domain:t.repositoryName},git:e.git,token:n})}}}({git:n}),{repositoryUrl:c}=(0,P.U)();return(0,i.jsxs)(r.VqE,{size:{width:448,height:"auto"},trigger:o,children:[(0,i.jsx)(r.fKu,{title:"Prismic Write API token required"}),(0,i.jsx)(r.cZJ,{children:(0,i.jsx)(Z.J9,{initialValues:{writeAPIToken:""},validate:e=>{if(0===e.writeAPIToken.length)return{writeAPIToken:"Cannot be empty"}},onSubmit:async e=>{try{await t(n),await s(e.writeAPIToken)}catch(t){let e="Could not connect to ".concat(n.name);console.error(e,t),b.Am.error(e)}},children:e=>(0,i.jsxs)("form",{onSubmit:e.handleSubmit,children:[(0,i.jsxs)(r.xuv,{flexDirection:"column",gap:4,padding:16,children:[(0,i.jsx)(r.ytj,{disabled:e.isSubmitting,error:"string"==typeof e.errors.writeAPIToken,label:"Paste your Write API token",onValueChange:t=>{e.setFieldValue("writeAPIToken",t)},placeholder:"Write API token",value:e.values.writeAPIToken}),(0,i.jsxs)(r.xvT,{color:"grey11",children:["Required to sync models from ",l.name," to Prismic."]})]}),(0,i.jsxs)(r.kXR,{children:[(0,i.jsx)(r.qEi,{href:new URL("/settings/apps",c).href,children:"Create a Prismic Write API token"}),(0,i.jsx)(r.POh,{size:"medium"}),(0,i.jsx)(r._dX,{disabled:!e.isValid,loading:e.isSubmitting,onClick:()=>void e.submitForm(),size:"medium",children:"Save Token"})]})]})})})]})},H=e=>{let{repo:t,trigger:n,unlinkRepo:o}=e,[l,s]=(0,c.useState)(!1);return(0,i.jsxs)(r.VqE,{size:{width:448,height:"auto"},trigger:n,children:[(0,i.jsx)(r.fKu,{title:"Remove Git Connection"}),(0,i.jsx)(r.cZJ,{children:(0,i.jsx)(r.xuv,{flexDirection:"column",padding:16,children:(0,i.jsx)(r.xvT,{children:"You will not be able to push your code alongside your models anymore. Note that you can reconnect your Git repository at any time. Are you sure you want to continue?"})})}),(0,i.jsxs)(r.kXR,{children:[(0,i.jsx)(r.POh,{size:"medium"}),(0,i.jsx)(r._dX,{size:"medium",color:"tomato",loading:l,onClick:()=>{(async()=>{s(!0);try{await o(t)}catch(n){let e="Could not disconnect from ".concat(t.name);console.error(e,n),b.Am.error(e)}s(!1)})()},children:"Disconnect"})]})]})};var W=n(45276);let A=e=>{let{mode:t,repos:n}=e,{linkRepo:o,unlinkRepo:l}=(0,W.G)();return(0,i.jsx)(_,{children:"link"===t?n.map(e=>(0,i.jsxs)(p,{action:(0,i.jsx)(N,{linkRepo:o,repo:e,trigger:(0,i.jsx)(r.zxk,{color:"grey",children:"Connect"})}),children:[e.name,(0,i.jsxs)(r.xvT,{color:"grey11",children:[" • ",(0,i.jsx)(F,{date:e.pushedAt})]})]},"".concat(e.provider,"@").concat(e.id))):n.map(e=>(0,i.jsx)(p,{action:(0,i.jsx)(H,{repo:e,trigger:(0,i.jsx)(r.zxk,{color:"grey",children:"Disconnect"}),unlinkRepo:l}),children:e.name},"".concat(e.provider,"@").concat(e.owner,"/").concat(e.name)))})},D=()=>(0,i.jsx)(_,{children:[...[,,,,].keys()].map(e=>(0,i.jsx)(p,{action:(0,i.jsx)(r.OdW,{height:32,width:67.59}),children:(0,i.jsx)(r.OdW,{height:24,sx:{verticalAlign:"middle"},width:129.92})},e))}),G=e=>{let{disabled:t,owners:n=[],selectedOwner:o,onSelectedOwnerChange:l,sx:s}=e;return(0,i.jsx)(r.PhF,{color:"grey",constrainContentWidth:!0,disabled:t,flexContent:!0,onValueChange:e=>{let[t,i]=e.split("@"),r=n.find(e=>e.provider===t&&e.id===i);r&&(null==l||l(r))},placeholder:"Owner",renderStartIcon:()=>(0,i.jsx)(z,{owner:o}),size:"large",sx:s,value:o?M(o):void 0,children:n.map(e=>(0,i.jsx)(r.QlF,{renderStartIcon:()=>(0,i.jsx)(z,{owner:e}),size:"large",value:M(e),children:e.name},M(e)))})},z=e=>{var t;let{owner:n}=e,{Icon:o}=y.Q[null!==(t=null==n?void 0:n.provider)&&void 0!==t?t:"gitHub"];return(0,i.jsx)(o,{color:r.rSc.color.grey11})};function M(e){return"".concat(e.provider,"@").concat(e.id)}var V=n(18566);async function O(e,t,n,i){return await R.managerClient.git.fetchRepos({provider:e,owner:t,query:n,page:i})}let E=e=>{let{owners:t}=e,[n,r]=(0,c.useState)(t[0]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(m,{children:(0,i.jsx)(G,{owners:t,selectedOwner:n,onSelectedOwnerChange:r,sx:{width:"calc(50% - 8px)"}})}),(0,i.jsx)(c.Suspense,{fallback:(0,i.jsx)(Q,{gitOwnerSelect:!1}),children:(0,i.jsx)(B,{owner:n})})]})},B=e=>{var t;let{owner:n}=e,r=(t={provider:n.provider,owner:n.name},(0,V.QT)(O,[t.provider,t.owner,t.query,t.page]));return r.length>0?(0,i.jsx)(A,{mode:"link",repos:r}):(0,i.jsx)(j,{children:(0,i.jsx)(v,{title:"No Results Found",description:"Try selecting a different Git account or organization on the top left."})})},Q=e=>{let{gitOwnerSelect:t}=e;return(0,i.jsxs)(i.Fragment,{children:[t?(0,i.jsx)(m,{children:(0,i.jsx)(G,{disabled:!0,sx:{width:"calc(50% - 8px)"}})}):void 0,(0,i.jsx)(D,{})]})};async function q(){return await R.managerClient.git.fetchOwners()}var K=n(54597);let X=()=>(0,i.jsxs)(h,{children:[(0,i.jsx)(g,{children:"Connected Git Repository"}),(0,i.jsx)(w.S,{renderError:J,children:(0,i.jsx)(c.Suspense,{fallback:(0,i.jsx)(Q,{gitOwnerSelect:!0}),children:(0,i.jsx)(U,{})})}),(0,i.jsx)(f,{action:(0,i.jsx)(r.ua7,{content:"Documentation is coming soon.",side:"bottom",children:(0,i.jsx)(r.hU,{disabled:!0,icon:"openInNew"})}),children:"Learn more about Prismic for Git"})]}),U=()=>{let{linkedGitRepos:e}=(0,W.G)();return e.length>0?(0,i.jsx)(A,{mode:"unlink",repos:e}):(0,i.jsx)(Y,{})},Y=()=>{let e=(0,V.QT)(q,[]);return e.length>0?(0,i.jsx)(E,{owners:e}):(0,i.jsx)(j,{children:(0,i.jsx)(S,{})})};function J(e,t){return(0,d.ff)(e)?(0,i.jsx)($,{}):(0,d.TW)(e)?(0,i.jsx)(ee,{}):(0,i.jsx)(et,{reset:t})}let $=()=>{let{openLoginModal:e}=(0,K.Z)();return(0,i.jsx)(j,{children:(0,i.jsx)(v,{title:"It seems like you are logged out",description:"Log in to connect a Git repository.",action:(0,i.jsx)(r.zxk,{onClick:e,children:"Log in to Prismic"})})})},ee=()=>(0,i.jsx)(j,{children:(0,i.jsx)(v,{title:"It seems like you do not have permission",description:"An owner or admin is required to connect a Git repository."})}),et=e=>{let{reset:t}=e;return(0,i.jsx)(j,{children:(0,i.jsx)(v,{title:"Unable to fetch data",description:"An error occurred while fetching the list of connected Git repositories.",action:(0,i.jsx)(r.zxk,{color:"grey",onClick:t,children:"Retry"})})})};var en=n(83758),ei=n(51384);let er=()=>{let e=(0,en.M)(),t=(0,s.useRouter)();return((0,c.useEffect)(()=>{e.eligible||t.replace("/")},[e.eligible,t]),e.eligible)?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l(),{children:(0,i.jsx)("title",{children:"Settings - Slice Machine"})}),(0,i.jsxs)(ei.LN,{children:[(0,i.jsx)(ei.wd,{children:(0,i.jsx)(ei.Cx,{children:(0,i.jsx)(a.g,{children:"Settings"})})}),(0,i.jsx)(ei.RN,{children:(0,i.jsx)(r.xuv,{flexDirection:"column",maxWidth:600,children:(0,i.jsx)(X,{})})})]})]}):null}},35050:function(e){e.exports={flex:"FieldSet_flex__r2Zbg",column:"FieldSet_column__esHjW FieldSet_flex__r2Zbg",root:"FieldSet_root__MYqY8 FieldSet_column__esHjW FieldSet_flex__r2Zbg",row:"FieldSet_row__DZZjD FieldSet_flex__r2Zbg",borderBottom:"FieldSet_borderBottom__WVCMK",legend:"FieldSet_legend__4k9_l FieldSet_row__DZZjD FieldSet_flex__r2Zbg FieldSet_borderBottom__WVCMK",header:"FieldSet_header__cR_f3 FieldSet_row__DZZjD FieldSet_flex__r2Zbg FieldSet_borderBottom__WVCMK",content:"FieldSet_content__WzxRs FieldSet_column__esHjW FieldSet_flex__r2Zbg",list:"FieldSet_list__mILoo FieldSet_column__esHjW FieldSet_flex__r2Zbg",listItem:"FieldSet_listItem__QOhSB FieldSet_row__DZZjD FieldSet_flex__r2Zbg FieldSet_borderBottom__WVCMK",borderTop:"FieldSet_borderTop__KfoL_",footer:"FieldSet_footer__1VWxY FieldSet_row__DZZjD FieldSet_flex__r2Zbg FieldSet_borderTop__KfoL_"}}},function(e){e.O(0,[397,888,774,179],function(){return e(e.s=24994)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[136],{31314:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]",function(){return n(92578)}])},44309:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var i=n(5632),r=n(56580),o=n(7723);let a=(e,t,n)=>{var i;let r=null===(i=(0,o.Sd)(e))||void 0===i?void 0:i.find(e=>e.name.replace(/\//g,"--")===t);return null==r?void 0:r.components.find(e=>e.model.name===n)};var l=()=>{let e=(0,i.useRouter)(),{slice:t}=(0,r.v9)(t=>({slice:a(t,e.query.lib,e.query.sliceName)}));if(!t)return{};let n=t.model.variations.find(t=>t.id===e.query.variation);return n?{slice:t,variation:n}:{}}},92578:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ez}});var i=n(52322),r=n(97729),o=n.n(r),a=n(5632),l=n(74217),s=n(2784),d=n(94160),c=n(68968),u=n(23710),m=n(54597);let h=(0,s.createContext)(void 0);function p(e){let{children:t,initialSlice:n}=e,r=(0,a.useRouter)(),[o,p]=(0,s.useState)(n),{actionQueueStatus:v,setNextAction:f}=(0,u.c)({errorMessage:"Failed to save slice. Check your browser's console for more information."}),{saveSliceSuccess:x}=(0,m.Z)(),y=(0,l.R9)(x),{syncChanges:g}=(0,c.g)(),j=(0,s.useMemo)(()=>{let e=r.query.variation,t=o.model.variations.find(t=>t.id===e);if(t)return t;throw Error("Variation not found")},[o,r]),b=(0,s.useCallback)((e,t)=>{p(e),f(async()=>{let{errors:n}=await (0,d.Ve)(e);if(n.length>0)throw n;let{errors:i,mocks:r}=await (0,d.pL)({libraryID:e.from,sliceID:e.model.id});if(i.length>0)throw i;y({...e,mocks:r}),g(),null==t||t()})},[f,y,g]),w=(0,s.useMemo)(()=>({actionQueueStatus:v,slice:o,setSlice:b,variation:j}),[v,o,b,j]);return(0,i.jsx)(h.Provider,{value:w,children:"function"==typeof t?t(w):t})}function v(){let e=(0,s.useContext)(h);if(!e)throw Error("SliceBuilderProvider not found");return e}var f=n(44309),x=n(7729),y=n(43388),g=n(23094),j=n(63470),b=n(17378),w=n(18566),C=n(80148);async function I(e){let{errors:t,model:n}=await C.managerClient.customTypes.readCustomType({id:e});if(t.length>0)throw t;return n}var k=n(59294),S=n(14101),T=n(81229);let E=e=>(0,i.jsxs)("svg",{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"})]}),R=()=>{let{source:e}=(0,S.l)(),t=function(e){let t=(0,k.Ag)(e.query);return void 0!==t&&(0,k.ne)(e.asPath,t)?t:void 0}(e);return void 0!==t?(0,i.jsx)(b.S,{children:(0,i.jsx)(s.Suspense,{children:(0,i.jsx)(x.xuv,{bottom:32,justifyContent:"center",position:"fixed",right:0,width:"100vw",children:(0,i.jsx)(A,{sourceCustomTypeId:t})})})}):null},A=e=>{let{sourceCustomTypeId:t}=e,n=(0,w.QT)(I,[t]),[r,o]=(0,s.useState)(!0),l=(0,a.useRouter)();if(void 0===n||!r)return null;{let{format:e,id:t}=n,r=k.cd[e].getBuilderPagePathname(t);return(0,i.jsxs)(x.hE2,{density:"compact",color:"dark",children:[(0,i.jsxs)(x.zxk,{onClick:()=>{l.push(r)},renderStartIcon:()=>(0,i.jsx)(E,{}),children:["Return to ",n.label]}),(0,i.jsx)(x.zxk,{onClick:()=>{o(!1)},renderStartIcon:()=>(0,i.jsx)(T.T,{})})]})}};var D=n(51384),_=n(56580),L=n(33710),O=n(67557),F=n(39180),z=n(7974),N=n(79384);let V=e=>{let{children:t,open:n,onClose:r}=e;return(0,i.jsxs)(O.zs,{open:n,trigger:t,onClose:r,children:[(0,i.jsx)(O.Ev,{children:"Simulate your slices"}),(0,i.jsx)(O.LB,{component:"video",cloudName:"dmtf1daqp",loop:!1,autoPlay:!1,publicId:z.Sn,poster:"/simulator-video-thumbnail.png",controls:!0,onPlay:()=>{d.Xe.track({event:"open-video-tutorials",video:z.Sn})}}),(0,i.jsx)(O.OJ,{children:"Minimize context-switching by previewing your Slice components in the simulator."}),(0,i.jsx)(O.Rp,{children:"Got it"})]})};var P=e=>{let{disabled:t}=e,n=(0,a.useRouter)(),r=(0,s.useRef)(null),{setSeenSimulatorToolTip:o}=(0,m.Z)(),{hasSeenSimulatorTooltip:l}=(0,_.v9)(e=>({hasSeenSimulatorTooltip:(0,N.bv)(e)}));(0,s.useEffect)(()=>{let e=r.current;e&&!l&&setTimeout(()=>L.Z.show(e),5e3)},[l]);let d=()=>{if(o(),r.current){let{current:e}=r;L.Z.hide(e)}};return(0,i.jsx)("span",{"data-tip":!0,"data-tip-disable":!1,"data-for":"simulator-button-tooltip",ref:r,children:(0,i.jsx)(V,{open:!l,onClose:d,children:(0,i.jsx)(x.zxk,{"data-tip":!0,"data-testid":"simulator-open-button",onClick:()=>{d(),window.open("".concat(n.asPath,"/simulator"),z.pq)},disabled:t,renderStartIcon:()=>(0,i.jsx)(F.z,{color:x.rSc.color.grey1,height:"24px",style:{transform:"scale(calc(4 / 3))"},width:"24px"}),children:"Simulate"})})})},M=n(31860),Z=n(88866),K=n(28316),q=n(88932),X=n(35289),H=n(63908),B=n(34166),W=n(3285),G=n(40141),U=n(49219),J=n(26109),Y=n(45440),Q=n(16086),$=n(358),ee=n(5495),et=n(39302);let en=[Y.C.Image,Y.C.Text,Y.C.StructuredText,Y.C.Link,Y.C.Select,Y.C.Boolean,Y.C.Number,Y.C.Color,Y.C.Date,Y.C.Table,Y.C.Embed,Y.C.Timestamp,Y.C.GeoPoint,Y.C.ContentRelationship,Y.C.LinkToMedia];var ei=()=>{let{slice:e,setSlice:t,variation:n}=v(),[r,o]=(0,s.useState)(!1),a=[Y.C.Group,...en],l=!!(n.items&&Object.keys(n.items).length>0),d=i=>r=>{if(i===J.Rt.Items&&n.items&&Object.keys(n.items).length<=1){o(!0);return}t((0,H.AK)({slice:e,variationId:n.id,widgetArea:i,fieldId:r}))},c=(i,r)=>{let{apiId:o,newKey:a,value:l,inGroupFieldAction:s}=r;t((0,H.L4)({slice:e,variationId:n.id,widgetArea:i,previousFieldId:o,newFieldId:a,newField:l}),()=>{"add"===s&&q.Am.success("Field added")}),s||(0,et.Z)({previousId:o,id:a,field:l})},u=(i,r)=>{let{apiId:o,value:l}=r,{type:s}=l,d=a.find(e=>e.CUSTOM_NAME===s||e.TYPE_NAME===s);if(!d)throw Error("Unsupported Field Type: ".concat(s));try{d.schema.validateSync(l,{stripUnknown:!1})}catch(e){throw Error('Model is invalid for widget "'.concat(l.type,'".'))}t((0,H.xS)({slice:e,variationId:n.id,widgetArea:i,newFieldId:o,newField:l.type===Z.GroupFieldType?U.Fl.fromSM(l):l}),()=>{q.Am.success("".concat("Group"===s?"Group":"Field"," added"))}),(0,ee.V)({id:o,field:l})},m=e=>t=>""===t.apiId?u(e,{...t,apiId:t.newKey}):c(e,t),h=i=>r=>{if((0,Q.uS)(r))return;let{source:o,destination:a}=r;if(!a)return;let l=(0,H.gR)({slice:e,variationId:n.id,widgetArea:i,sourceIndex:o.index,destinationIndex:a.index});(0,K.flushSync)(()=>t(l))};return(0,i.jsxs)(x.xuv,{flexDirection:"column",gap:18,children:[(0,i.jsxs)(X.aV,{children:[(0,i.jsx)(G.Z,{zoneType:"slice",zoneTypeFormat:void 0,tabId:void 0,title:"Fields",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:W.Z,widgetsArray:a,onDeleteItem:d(J.Rt.Primary),onSave:m(J.Rt.Primary),onDragEnd:h(J.Rt.Primary),poolOfFieldsToCheck:n.primary||[],renderHintBase:e=>{let{item:t}=e;return"slice.primary".concat((0,$.Ti)(t.key))},renderFieldAccessor:e=>"slice.primary".concat((0,$.Ti)(e)),testId:"static-zone-content",isRepeatableCustomType:void 0,emptyStateHeading:void 0}),l?(0,i.jsx)(G.Z,{zoneType:"slice",zoneTypeFormat:void 0,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:en,fields:n.items,EditModal:W.Z,onDeleteItem:d(J.Rt.Items),onSave:m(J.Rt.Items),onDragEnd:h(J.Rt.Items),poolOfFieldsToCheck:n.items||[],renderHintBase:e=>{let{item:t}=e;return"item".concat((0,$.Ti)(t.key))},renderFieldAccessor:e=>"slice.items[i]".concat((0,$.Ti)(e)),testId:"slice-repeatable-zone",isRepeatableCustomType:void 0,emptyStateHeading:"No fields"}):null,(0,i.jsxs)(x.VqE,{size:"small",open:r,onOpenChange:e=>o(e),children:[(0,i.jsx)(x.fKu,{icon:"delete",title:"Delete field"}),(0,i.jsxs)(x.cZJ,{children:[(0,i.jsx)(x.xuv,{padding:24,gap:12,flexDirection:"column",children:e.model.variations.length>1?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("strong",{children:["This action will permanently remove the repeatable zone from the ",e.model.name," slice ",n.name," variation."]}),(0,i.jsx)("div",{children:"Other variations will be left untouched. To reimplement repeatable fields later, use a group field instead of the repeatable zone."})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("strong",{children:["This action will permanently remove the repeatable zone from the ",e.model.name,"."]}),(0,i.jsx)("div",{children:"To reimplement repeatable fields later, use a group field instead of the repeatable zone."})]})}),(0,i.jsxs)(x.kXR,{children:[(0,i.jsx)(x.POh,{}),(0,i.jsx)(x._dX,{color:"tomato",onClick:()=>{t((0,H.Oh)({slice:e,variationId:n.id})),o(!1)},children:"Delete"})]})]})]})]}),(0,i.jsx)(B.rT,{type:"model",library:e.from,sliceId:e.model.id,variationId:n.id})]})},er=n(6277),eo=n(34887),ea=n.n(eo);let el=e=>{let{variant:t="dashed",color:n="currentColor",className:r}=e;return(0,i.jsx)("hr",{className:(0,er.W)(ea()["variant-".concat(t)],r),style:{color:x.rSc.color[n]}})};var es=n(51507),ed=n(27763),ec=n(21442);async function eu(e){try{let{errors:t}=await (0,d.Ve)(e.component);if(t.length>0)throw t;let{errors:n}=await (0,d.Xi)({libraryID:e.component.from,sliceID:e.component.model.id,variationID:e.variation.id});if(n.length>0)throw n;(0,B.tB)({type:"model",library:e.component.from,sliceId:e.component.model.id,variationId:e.variation.id});let{slice:i,errors:r}=await (0,d.X$)(e.component.from,e.component.model.id);if(r.length>0)throw r;if(!i)throw Error("Could not read variation `".concat(e.variation.name,"`"));let{mocks:o}=await (0,d.pL)({libraryID:e.component.from,sliceID:e.component.model.id}),a=ed.Y.getBuilderPagePathname({libraryName:e.component.href,sliceName:i.name,variationId:i.variations[0].id});await e.router.replace(a);let l={...e.component,model:i,mocks:o};return e.saveSliceSuccess(l),l}catch(n){let t="Could not delete variation `".concat(e.variation.name,"`");throw console.error(t,n),q.Am.error(t),n}}let em=e=>{let{isOpen:t,onClose:n,slice:r,variation:o}=e,l=(0,a.useRouter)(),[d,c]=(0,s.useState)(!1),{saveSliceSuccess:u}=(0,m.Z)(),{setSlice:h}=v();return(0,i.jsxs)(x.VqE,{open:t,onOpenChange:e=>!e&&n(),size:{width:448,height:"auto"},children:[(0,i.jsx)(x.fKu,{icon:"delete",title:"Delete variation"}),(0,i.jsx)(x.cZJ,{children:(0,i.jsxs)(x.xuv,{flexDirection:"column",children:[(0,i.jsxs)(x.xvT,{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)(eh,{children:"not"})," affect your documents until you ",(0,i.jsx)(eh,{children:"edit"})," ","them manually."]}),(0,i.jsxs)(x.kXR,{children:[(0,i.jsx)(x.POh,{size:"medium"}),(0,i.jsx)(x._dX,{size:"medium",color:"tomato",onClick:()=>{o&&(async()=>{c(!0);try{let e=await eu({component:r,router:l,saveSliceSuccess:u,variation:o});h(e)}catch(e){}c(!1),n()})()},loading:d,children:"Delete"})]})]})})]})},eh=e=>(0,i.jsx)(x.xvT,{...e,color:"inherit",component:"span",variant:"bold"});var ep=n(30195);async function ev(e){try{let{errors:t}=await (0,d.Ve)(e.component);if(t.length>0)throw t;let{errors:n}=await (0,d.eH)(e.component,{...e.variation,name:e.variationName});if(n.length>0)throw n;let{slice:i,errors:r}=await (0,d.X$)(e.component.from,e.component.model.id);if(r.length>0)throw r;if(!i)throw Error("Could not read variation `".concat(e.variation.name,"`"));let{mocks:o}=await (0,d.pL)({libraryID:e.component.from,sliceID:e.component.model.id}),a={...e.component,model:i,mocks:o};return e.saveSliceSuccess(a),a}catch(n){let t="Could not rename variation `".concat(e.variation.name,"`");throw console.error(t,n),q.Am.error(t),n}}let ef=e=>{let{isOpen:t,onClose:n,slice:r,variation:o}=e,[a,d]=(0,s.useState)(!1),[c,u]=(0,s.useState)(""),[h,p]=(0,s.useState)(),{setSlice:f}=v(),{saveSliceSuccess:y}=(0,m.Z)();return(0,l.pQ)(t,()=>{if(t&&(null==o?void 0:o.name)!==c){var e;u(null!==(e=null==o?void 0:o.name)&&void 0!==e?e:""),p(void 0)}}),(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(x.VqE,{open:t,onOpenChange:e=>!e&&n(),size:{width:448,height:"auto"},children:[(0,i.jsx)(x.fKu,{icon:"edit",title:"Rename variation"}),(0,i.jsx)(x.cZJ,{children:(0,i.jsxs)(x.l09,{onSubmit:function(){if(!h&&o){d(!0);try{ev({component:r,saveSliceSuccess:y,variation:o,variationName:c.trim()}).then(e=>{f(e)})}catch(e){}d(!1),n()}},children:[(0,i.jsxs)(x.xuv,{flexDirection:"column",gap:8,padding:16,children:[(0,i.jsx)(x.xvT,{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.jsx)(x.xuv,{flexDirection:"column",gap:4,children:(0,i.jsx)(x.ytj,{type:"text",label:"Variation name *",placeholder:"Variation name",error:h,value:c,onValueChange:function(e){u(e),p(function(e){let t=ex.safeParse(e,{errorMap:ey});if(t.error)return t.error.errors[0].message}(e))}})})]}),(0,i.jsxs)(x.kXR,{children:[(0,i.jsx)(x.POh,{size:"medium"}),(0,i.jsx)(x._dX,{type:"submit",size:"medium",loading:a,disabled:!!h,children:"Rename"})]})]})})]})})},ex=ep.z.string().min(1),ey=e=>e.code===ep.z.ZodIssueCode.too_small?{message:"This field is required"}:{message:"Invalid value"};var eg=n(68105),ej=n(63397),eb=n(96009),ew=n.n(eb),eC=n(36131),eI=n(75289),ek=n(30527);function eS(e){let{children:t}=e,n=(0,ek.W)();return(0,i.jsx)(eI.kC,{sx:{p:3,pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:t})}var eT=e=>{let{children:t,FooterContent:n,HeaderContent:r,close:o,sx:a={}}=e;return(0,i.jsx)(ek.Z,{borderFooter:!0,footerSx:{p:0},bodySx:{pt:2,pb:4,px:4},sx:{border:"none",...a},Header:(0,i.jsxs)(eS,{children:[r,o?(0,i.jsx)(eI.x8,{onClick:o,type:"button"}):null]}),Footer:n?(0,i.jsxs)(eI.kC,{sx:{alignItems:"space-between",bg:"headSection",p:3},children:[(0,i.jsx)(eI.xu,{sx:{ml:"auto"}}),n]}):null,children:t})},eE=n(55862);let eR=e=>{let{msg:t}=e;return(0,i.jsx)(eI.xv,{as:"span",sx:{fontSize:12,color:"error",mt:"5px",ml:2},children:t||"Error!"})};var eA=e=>{let{isOpen:t,onClose:n,onSubmit:r,initialVariation:o,variations:a}=e,[l,d]=(0,s.useState)({}),[c,u]=(0,s.useState)(""),[m,h]=(0,s.useState)(!0),[p,v]=(0,s.useState)(""),[f,y]=(0,s.useState)({value:o.id,label:o.name}),[g,j]=(0,s.useState)(!1);function b(){w(),n()}function w(){u(""),v(""),d({}),h(!0),y({value:o.id,label:o.name})}async function C(){let e=function(e){let{id:t,name:n,origin:i}=e,r=t&&t.length?null:{id:"Required!"},o=a.find(e=>e.id===t)?{id:"This id already exists!"}:null,l=n&&n.length?null:{name:"Required!"},s=i.value.length&&a.find(e=>e.id===i.value)?null:{id:"You must select an existing variation!"},d=t&&t.length&&!/^[A-Za-z0-9]+([A-Za-z0-9]+)*$/.exec(t)&&{id:"No special characters allowed"};return{...r,...o,...l,...s,...d}}({id:c,name:p,origin:f});if(Object.keys(e).length)d(e);else{let e=a.find(e=>e.id===f.value);e&&(j(!0),await r(c,p,e),j(!1),b())}}return(0,s.useEffect)(()=>{w()},[o,t]),(0,i.jsx)(eE.Z,{isOpen:t,shouldCloseOnOverlayClick:!0,onRequestClose:()=>b(),contentLabel:"Widget Form Modal",style:{content:{maxWidth:"700px"}},children:(0,i.jsx)(ej.J9,{initialValues:{id:c,name:p,origin:f},onSubmit:C,children:(0,i.jsx)(ej.l0,{id:"variation-add",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),C())},children:(0,i.jsx)(x.xuv,{children:(0,i.jsxs)(eT,{sx:{textAlign:"left"},HeaderContent:(0,i.jsx)(eI.xv,{as:"h2",children:"Add new Variation"}),FooterContent:(0,i.jsxs)(x.xuv,{gap:16,alignItems:"center",children:[(0,i.jsx)(x.zxk,{onClick:b,color:"grey",children:"Cancel"}),(0,i.jsx)(x.zxk,{type:"submit",loading:g,children:"Submit"})]}),close:b,children:[(0,i.jsxs)(x.xuv,{flexDirection:"column",padding:{block:16},children:[(0,i.jsxs)(eI.__,{htmlFor:"name",sx:{mb:1},children:["Variation name*",l.name?(0,i.jsx)(eR,{msg:l.name}):""]}),(0,i.jsx)(ej.gN,{autoComplete:"off",id:"name",name:"name",placeholder:"e.g. Grid - With Icon",as:eI.II,maxLength:30,value:p,onChange:e=>{var t;v(t=e.currentTarget.value),m&&u(ew()(t))}}),(0,i.jsx)(eI.xv,{children:"It will appear here in Slice Machine, and in the page editor in Prismic"})]}),(0,i.jsxs)(x.xuv,{flexDirection:"column",padding:{bottom:16},children:[(0,i.jsxs)(eI.__,{htmlFor:"id",sx:{mb:1},children:["Variation ID*",l.id?(0,i.jsx)(eR,{msg:l.id}):""]}),(0,i.jsx)(ej.gN,{autoComplete:"off",id:"id",name:"id",placeholder:"e.g. gridWithIcon",as:eI.II,maxLength:30,value:c,onChange:e=>{var t;return t=e.currentTarget.value,void(h(!1),u(ew()(t)))}}),(0,i.jsx)(eI.xv,{children:"It's generated automatically based on the variation name and will appear in the API responses."})]}),(0,i.jsxs)(x.xuv,{flexDirection:"column",padding:{bottom:8},children:[(0,i.jsx)(eI.__,{htmlFor:"origin",sx:{mb:1},children:"Duplicate from"}),(0,i.jsx)(eC.ZP,{name:"origin",options:a.map(e=>({value:e.id,label:e.name})),onChange:e=>{e&&y(e)},defaultValue:f,maxMenuHeight:150,theme:e=>({...e,colors:{...e.colors,text:"text",primary:"background"}})})]})]})})})})})},eD=n(20136),e_=n.n(eD);let eL=e=>{let{horizontalScroll:t=!1}=e,{slice:n,variation:r,setSlice:o}=v(),[l,c]=(0,s.useState)(),u=(0,ec.H)(),{sliceFilterFn:h,defaultVariationSelector:p,onUploadSuccess:f}=u.modalPayload,y=(0,a.useRouter)(),{saveSliceSuccess:g}=(0,m.Z)(),j=n.model.variations.length;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(x.xuv,{flexDirection:"column",gap:16,children:t?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(el,{variant:"edgeFaded",color:"grey6"}),(0,i.jsxs)(x.xuv,{justifyContent:"space-between",children:[(0,i.jsxs)(x.xvT,{color:"grey11",children:[j," variation",1!==j&&"s"]}),(0,i.jsx)(x.zxk,{onClick:()=>{c({type:"ADD_VARIATION"})},startIcon:"add",color:"grey",children:"Add a variation"})]}),(0,i.jsx)("div",{className:e_().hideScrollbar,style:{height:"240px",position:"relative",marginRight:"-32px",overflowX:"scroll",scrollSnapType:"x mandatory"},children:(0,i.jsx)("div",{style:{position:"absolute",paddingRight:"32px"},children:(0,i.jsx)(x.xuv,{flexDirection:"row",gap:16,children:(0,i.jsx)(eO,{screenshotChangesModal:u,setDialog:c,width:320})})})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eO,{screenshotChangesModal:u,setDialog:c}),(0,i.jsx)("div",{style:{bottom:x.rSc.space[0],marginBottom:"-".concat(x.rSc.space[16]),position:"sticky"},children:(0,i.jsxs)(x.xuv,{backgroundColor:"grey2",flexDirection:"column",padding:{bottom:40,inline:24},children:[(0,i.jsx)(x.phe,{sx:{left:0,position:"absolute",right:0}}),(0,i.jsx)(x.zxk,{color:"grey",onClick:()=>{c({type:"ADD_VARIATION"})},startIcon:"add",sx:{position:"relative"},children:"Add a variation"})]})})]})}),(0,i.jsx)(eg.Z,{slices:h([n]),defaultVariationSelector:p,onUploadSuccess:f}),(0,i.jsx)(ef,{isOpen:(null==l?void 0:l.type)==="RENAME_VARIATION",onClose:()=>{c(void 0)},slice:n,variation:null==l?void 0:l.variation}),(0,i.jsx)(em,{isOpen:(null==l?void 0:l.type)==="DELETE_VARIATION",onClose:()=>{c(void 0)},slice:n,variation:null==l?void 0:l.variation}),(0,i.jsx)(eA,{initialVariation:r,isOpen:(null==l?void 0:l.type)==="ADD_VARIATION",onClose:()=>{c(void 0)},onSubmit:async(e,t,i)=>{try{let{slice:r,variation:a}=(0,H.Kp)({slice:n,id:e,name:t,copiedVariation:i});await (0,d.Ve)(r),g(r),o(r);let l=ed.Y.getBuilderPagePathname({libraryName:r.href,sliceName:r.model.name,variationId:a.id});y.replace(l)}catch(n){let e="Could not add variation `".concat(t,"`");console.error(e,n),q.Am.error(e)}},variations:n.model.variations})]})},eO=e=>{let{screenshotChangesModal:t,setDialog:n,width:r}=e,{slice:o,variation:a,setSlice:l}=v(),s={scrollSnapAlign:"start"};return(0,i.jsx)(i.Fragment,{children:o.model.variations.map(e=>(0,i.jsx)("div",{style:void 0!==r?{...s,width:r}:s,children:(0,i.jsx)(es.b,{action:{type:"menu",onRename:()=>{n({type:"RENAME_VARIATION",variation:e})},onRemove:()=>{n({type:"DELETE_VARIATION",variation:e})},removeDisabled:o.model.variations.length<=1},mode:"navigation",onUpdateScreenshot:()=>{t.onOpenModal({sliceFilterFn:e=>e,defaultVariationSelector:{sliceID:o.model.id,variationID:e.id},onUploadSuccess:e=>{l(e)}})},replace:!0,selected:e.id===a.id,slice:o,variant:"outlined",variationId:e.id},e.id)},e.id))})};var eF=()=>{let{slice:e,actionQueueStatus:t}=v(),n=(0,x.ach)({max:"large"}),r=(0,j.k)();return(0,i.jsxs)(D.LN,{children:[(0,i.jsxs)(D.wd,{children:[(0,i.jsx)(D.Xq,{url:"/slices"}),(0,i.jsxs)(D.Cx,{children:[(0,i.jsx)(y.g,{children:(0,M._)((0,M.f)(r.value))}),(0,i.jsx)(y.g,{active:!0,children:e.model.name})]}),(0,i.jsxs)(D.K2,{children:[(0,i.jsx)(g.X,{status:t}),(0,i.jsx)(P,{disabled:"done"!==t})]})]}),(0,i.jsxs)(D.RN,{children:[(0,i.jsxs)(x.xuv,{display:"grid",alignItems:"flex-start",gap:16,...n?{gridTemplateRows:"304px 1fr"}:{gridTemplateColumns:"320px 1fr"},children:[(0,i.jsx)(eL,{horizontalScroll:n}),(0,i.jsx)(ei,{})]}),(0,i.jsx)(R,{})]})]})};function ez(){let e=(0,a.useRouter)(),{slice:t,variation:n}=(0,f.Z)();return void 0===t||void 0===n?(e.replace("/"),null):(0,i.jsx)(p,{initialSlice:t,children:e=>{let{slice:t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o(),{children:(0,i.jsxs)("title",{children:[t.model.name," - Slice Machine"]})}),(0,i.jsx)(eF,{})]})}})}},34887:function(e){e.exports={base:"Divider_base__4eT6E","variant-dashed":"Divider_variant-dashed__4Lvrj Divider_base__4eT6E","variant-edgeFaded":"Divider_variant-edgeFaded__049V2 Divider_base__4eT6E"}},20136:function(e){e.exports={hideScrollbar:"VariationsList_hideScrollbar__cHCIS"}},76473:function(e,t,n){"use strict";n.d(t,{y1:function(){return j}});var i=n(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}n(52322);var 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,t){return void 0===t&&(t=","),e.split(t)}function d(e,t,n){void 0===t&&(t="+");var i=e.toLocaleLowerCase().split(t).map(function(e){return l(e)}),a={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod")},s=i.filter(function(e){return!o.includes(e)});return r({},a,{keys:s,description:n})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&m([l(e.key),l(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&h([l(e.key),l(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){c.clear()});var c=new Set;function u(e){return Array.isArray(e)}function m(e){var t=Array.isArray(e)?e:[e];c.has("meta")&&c.forEach(function(e){return!o.includes(e)&&c.delete(e.toLowerCase())}),t.forEach(function(e){return c.add(e.toLowerCase())})}function h(e){var t=Array.isArray(e)?e:[e];"meta"===e?c.clear():t.forEach(function(e){return c.delete(e.toLowerCase())})}function p(e,t){var n=e.target;void 0===t&&(t=!1);var i=n&&n.tagName;return u(t)?!!(i&&t&&t.some(function(e){return e.toLowerCase()===i.toLowerCase()})):!!(i&&t&&!0===t)}var v=function(e,t,n){void 0===n&&(n=!1);var i,r=t.alt,o=t.meta,a=t.mod,s=t.shift,d=t.ctrl,m=t.keys,h=e.key,p=e.code,v=e.ctrlKey,f=e.metaKey,x=e.shiftKey,y=e.altKey,g=l(p),j=h.toLowerCase();if(!n){if(!y===r&&"alt"!==j||!x===s&&"shift"!==j)return!1;if(a){if(!f&&!v)return!1}else if(!f===o&&"meta"!==j&&"os"!==j||!v===d&&"ctrl"!==j&&"control"!==j)return!1}return!!(m&&1===m.length&&(m.includes(j)||m.includes(g)))||(m?(void 0===i&&(i=","),(u(m)?m:m.split(i)).every(function(e){return c.has(e.trim().toLowerCase())})):!m)},f=(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 j(e,t,n,r){var o,a=(0,i.useRef)(null),c=(0,i.useRef)(!1),j=n instanceof Array?r instanceof Array?void 0:r:n,b=u(e)?e.join(null==j?void 0:j.splitKey):e,w=n instanceof Array?n:r instanceof Array?r:void 0,C=(0,i.useCallback)(t,null!=w?w:[]),I=(0,i.useRef)(C);w?I.current=C:I.current=t;var k=(!function e(t,n){return t&&n&&"object"==typeof t&&"object"==typeof n?Object.keys(t).length===Object.keys(n).length&&Object.keys(t).reduce(function(i,r){return i&&e(t[r],n[r])},!0):t===n}((o=(0,i.useRef)(void 0)).current,j)&&(o.current=j),o.current),S=(0,i.useContext)(x).enabledScopes,T=(0,i.useContext)(f);return g(function(){if((null==k?void 0:k.enabled)!==!1&&(e=null==k?void 0:k.scopes,0===S.length&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!e||S.some(function(t){return e.includes(t)})||S.includes("*")))){var e,t=function(e,t){var n;if(void 0===t&&(t=!1),!(p(e,["input","textarea","select"])&&!p(e,null==k?void 0:k.enableOnFormTags)||null!=k&&null!=k.ignoreEventWhen&&k.ignoreEventWhen(e))){if(null!==a.current&&document.activeElement!==a.current&&!a.current.contains(document.activeElement)){y(e);return}(null==(n=e.target)||!n.isContentEditable||null!=k&&k.enableOnContentEditable)&&s(b,null==k?void 0:k.splitKey).forEach(function(n){var i,r,o,a=d(n,null==k?void 0:k.combinationKey);if(v(e,a,null==k?void 0:k.ignoreModifiers)||null!=(o=a.keys)&&o.includes("*")){if(t&&c.current)return;if(("function"==typeof(i=null==k?void 0:k.preventDefault)&&i(e,a)||!0===i)&&e.preventDefault(),"function"==typeof(r=null==k?void 0:k.enabled)?!r(e,a):!0!==r&&void 0!==r){y(e);return}I.current(e,a),t||(c.current=!0)}})}},n=function(e){void 0!==e.key&&(m(l(e.code)),((null==k?void 0:k.keydown)===void 0&&(null==k?void 0:k.keyup)!==!0||null!=k&&k.keydown)&&t(e))},i=function(e){void 0!==e.key&&(h(l(e.code)),c.current=!1,null!=k&&k.keyup&&t(e,!0))},r=a.current||(null==j?void 0:j.document)||document;return r.addEventListener("keyup",i),r.addEventListener("keydown",n),T&&s(b,null==k?void 0:k.splitKey).forEach(function(e){return T.addHotkey(d(e,null==k?void 0:k.combinationKey,null==k?void 0:k.description))}),function(){r.removeEventListener("keyup",i),r.removeEventListener("keydown",n),T&&s(b,null==k?void 0:k.splitKey).forEach(function(e){return T.removeHotkey(d(e,null==k?void 0:k.combinationKey,null==k?void 0:k.description))})}}},[b,k,S]),a}}},function(e){e.O(0,[898,789,917,525,461,139,183,44,349,34,630,658,888,774,179],function(){return e(e.s=31314)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[136],{31314:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]",function(){return n(92578)}])},44309:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var i=n(5632),r=n(56580),o=n(7723);let a=(e,t,n)=>{var i;let r=null===(i=(0,o.Sd)(e))||void 0===i?void 0:i.find(e=>e.name.replace(/\//g,"--")===t);return null==r?void 0:r.components.find(e=>e.model.name===n)};var l=()=>{let e=(0,i.useRouter)(),{slice:t}=(0,r.v9)(t=>({slice:a(t,e.query.lib,e.query.sliceName)}));if(!t)return{};let n=t.model.variations.find(t=>t.id===e.query.variation);return n?{slice:t,variation:n}:{}}},92578:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ez}});var i=n(52322),r=n(97729),o=n.n(r),a=n(5632),l=n(74217),s=n(2784),d=n(94160),c=n(68968),u=n(23710),m=n(54597);let h=(0,s.createContext)(void 0);function p(e){let{children:t,initialSlice:n}=e,r=(0,a.useRouter)(),[o,p]=(0,s.useState)(n),{actionQueueStatus:v,setNextAction:f}=(0,u.c)({errorMessage:"Failed to save slice. Check your browser's console for more information."}),{saveSliceSuccess:x}=(0,m.Z)(),y=(0,l.R9)(x),{syncChanges:g}=(0,c.g)(),j=(0,s.useMemo)(()=>{let e=r.query.variation,t=o.model.variations.find(t=>t.id===e);if(t)return t;throw Error("Variation not found")},[o,r]),b=(0,s.useCallback)((e,t)=>{p(e),f(async()=>{let{errors:n}=await (0,d.Ve)(e);if(n.length>0)throw n;let{errors:i,mocks:r}=await (0,d.pL)({libraryID:e.from,sliceID:e.model.id});if(i.length>0)throw i;y({...e,mocks:r}),g(),null==t||t()})},[f,y,g]),w=(0,s.useMemo)(()=>({actionQueueStatus:v,slice:o,setSlice:b,variation:j}),[v,o,b,j]);return(0,i.jsx)(h.Provider,{value:w,children:"function"==typeof t?t(w):t})}function v(){let e=(0,s.useContext)(h);if(!e)throw Error("SliceBuilderProvider not found");return e}var f=n(44309),x=n(7729),y=n(43388),g=n(23094),j=n(63470),b=n(17378),w=n(18566),C=n(80148);async function I(e){let{errors:t,model:n}=await C.managerClient.customTypes.readCustomType({id:e});if(t.length>0)throw t;return n}var k=n(59294),S=n(14101),T=n(81229);let E=e=>(0,i.jsxs)("svg",{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"})]}),R=()=>{let{source:e}=(0,S.l)(),t=function(e){let t=(0,k.Ag)(e.query);return void 0!==t&&(0,k.ne)(e.asPath,t)?t:void 0}(e);return void 0!==t?(0,i.jsx)(b.S,{children:(0,i.jsx)(s.Suspense,{children:(0,i.jsx)(x.xuv,{bottom:32,justifyContent:"center",position:"fixed",right:0,width:"100vw",children:(0,i.jsx)(A,{sourceCustomTypeId:t})})})}):null},A=e=>{let{sourceCustomTypeId:t}=e,n=(0,w.QT)(I,[t]),[r,o]=(0,s.useState)(!0),l=(0,a.useRouter)();if(void 0===n||!r)return null;{let{format:e,id:t}=n,r=k.cd[e].getBuilderPagePathname(t);return(0,i.jsxs)(x.hE2,{density:"compact",color:"dark",children:[(0,i.jsxs)(x.zxk,{onClick:()=>{l.push(r)},renderStartIcon:()=>(0,i.jsx)(E,{}),children:["Return to ",n.label]}),(0,i.jsx)(x.zxk,{onClick:()=>{o(!1)},renderStartIcon:()=>(0,i.jsx)(T.T,{})})]})}};var D=n(51384),_=n(56580),L=n(33710),O=n(67557),F=n(39180),z=n(7974),N=n(79384);let V=e=>{let{children:t,open:n,onClose:r}=e;return(0,i.jsxs)(O.zs,{open:n,trigger:t,onClose:r,children:[(0,i.jsx)(O.Ev,{children:"Simulate your slices"}),(0,i.jsx)(O.LB,{component:"video",cloudName:"dmtf1daqp",loop:!1,autoPlay:!1,publicId:z.Sn,poster:"/simulator-video-thumbnail.png",controls:!0,onPlay:()=>{d.Xe.track({event:"open-video-tutorials",video:z.Sn})}}),(0,i.jsx)(O.OJ,{children:"Minimize context-switching by previewing your Slice components in the simulator."}),(0,i.jsx)(O.Rp,{children:"Got it"})]})};var P=e=>{let{disabled:t}=e,n=(0,a.useRouter)(),r=(0,s.useRef)(null),{setSeenSimulatorToolTip:o}=(0,m.Z)(),{hasSeenSimulatorTooltip:l}=(0,_.v9)(e=>({hasSeenSimulatorTooltip:(0,N.bv)(e)}));(0,s.useEffect)(()=>{let e=r.current;e&&!l&&setTimeout(()=>L.Z.show(e),5e3)},[l]);let d=()=>{if(o(),r.current){let{current:e}=r;L.Z.hide(e)}};return(0,i.jsx)("span",{"data-tip":!0,"data-tip-disable":!1,"data-for":"simulator-button-tooltip",ref:r,children:(0,i.jsx)(V,{open:!l,onClose:d,children:(0,i.jsx)(x.zxk,{"data-tip":!0,"data-testid":"simulator-open-button",onClick:()=>{d(),window.open("".concat(n.asPath,"/simulator"),z.pq)},disabled:t,renderStartIcon:()=>(0,i.jsx)(F.z,{color:x.rSc.color.grey1,height:"24px",style:{transform:"scale(calc(4 / 3))"},width:"24px"}),children:"Simulate"})})})},M=n(31860),Z=n(88866),K=n(28316),q=n(88932),X=n(35289),H=n(63908),B=n(34166),W=n(3285),G=n(40141),U=n(49219),J=n(26109),Y=n(45440),Q=n(16086),$=n(358),ee=n(5495),et=n(39302);let en=[Y.C.Image,Y.C.Text,Y.C.StructuredText,Y.C.Link,Y.C.Select,Y.C.Boolean,Y.C.Number,Y.C.Color,Y.C.Date,Y.C.Table,Y.C.Embed,Y.C.Timestamp,Y.C.GeoPoint,Y.C.ContentRelationship,Y.C.LinkToMedia];var ei=()=>{let{slice:e,setSlice:t,variation:n}=v(),[r,o]=(0,s.useState)(!1),a=[Y.C.Group,...en],l=!!(n.items&&Object.keys(n.items).length>0),d=i=>r=>{if(i===J.Rt.Items&&n.items&&Object.keys(n.items).length<=1){o(!0);return}t((0,H.AK)({slice:e,variationId:n.id,widgetArea:i,fieldId:r}))},c=(i,r)=>{let{apiId:o,newKey:a,value:l,inGroupFieldAction:s}=r;t((0,H.L4)({slice:e,variationId:n.id,widgetArea:i,previousFieldId:o,newFieldId:a,newField:l}),()=>{"add"===s&&q.Am.success("Field added")}),s||(0,et.Z)({previousId:o,id:a,field:l})},u=(i,r)=>{let{apiId:o,value:l}=r,{type:s}=l,d=a.find(e=>e.CUSTOM_NAME===s||e.TYPE_NAME===s);if(!d)throw Error("Unsupported Field Type: ".concat(s));try{d.schema.validateSync(l,{stripUnknown:!1})}catch(e){throw Error('Model is invalid for widget "'.concat(l.type,'".'))}t((0,H.xS)({slice:e,variationId:n.id,widgetArea:i,newFieldId:o,newField:l.type===Z.GroupFieldType?U.Fl.fromSM(l):l}),()=>{q.Am.success("".concat("Group"===s?"Group":"Field"," added"))}),(0,ee.V)({id:o,field:l})},m=e=>t=>""===t.apiId?u(e,{...t,apiId:t.newKey}):c(e,t),h=i=>r=>{if((0,Q.uS)(r))return;let{source:o,destination:a}=r;if(!a)return;let l=(0,H.gR)({slice:e,variationId:n.id,widgetArea:i,sourceIndex:o.index,destinationIndex:a.index});(0,K.flushSync)(()=>t(l))};return(0,i.jsxs)(x.xuv,{flexDirection:"column",gap:18,children:[(0,i.jsxs)(X.aV,{children:[(0,i.jsx)(G.Z,{zoneType:"slice",zoneTypeFormat:void 0,tabId:void 0,title:"Fields",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:W.Z,widgetsArray:a,onDeleteItem:d(J.Rt.Primary),onSave:m(J.Rt.Primary),onDragEnd:h(J.Rt.Primary),poolOfFieldsToCheck:n.primary||[],renderHintBase:e=>{let{item:t}=e;return"slice.primary".concat((0,$.Ti)(t.key))},renderFieldAccessor:e=>"slice.primary".concat((0,$.Ti)(e)),testId:"static-zone-content",isRepeatableCustomType:void 0,emptyStateHeading:void 0}),l?(0,i.jsx)(G.Z,{zoneType:"slice",zoneTypeFormat:void 0,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:en,fields:n.items,EditModal:W.Z,onDeleteItem:d(J.Rt.Items),onSave:m(J.Rt.Items),onDragEnd:h(J.Rt.Items),poolOfFieldsToCheck:n.items||[],renderHintBase:e=>{let{item:t}=e;return"item".concat((0,$.Ti)(t.key))},renderFieldAccessor:e=>"slice.items[i]".concat((0,$.Ti)(e)),testId:"slice-repeatable-zone",isRepeatableCustomType:void 0,emptyStateHeading:"No fields"}):null,(0,i.jsxs)(x.VqE,{size:"small",open:r,onOpenChange:e=>o(e),children:[(0,i.jsx)(x.fKu,{icon:"delete",title:"Delete field"}),(0,i.jsxs)(x.cZJ,{children:[(0,i.jsx)(x.xuv,{padding:24,gap:12,flexDirection:"column",children:e.model.variations.length>1?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("strong",{children:["This action will permanently remove the repeatable zone from the ",e.model.name," slice ",n.name," variation."]}),(0,i.jsx)("div",{children:"Other variations will be left untouched. To reimplement repeatable fields later, use a group field instead of the repeatable zone."})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("strong",{children:["This action will permanently remove the repeatable zone from the ",e.model.name,"."]}),(0,i.jsx)("div",{children:"To reimplement repeatable fields later, use a group field instead of the repeatable zone."})]})}),(0,i.jsxs)(x.kXR,{children:[(0,i.jsx)(x.POh,{}),(0,i.jsx)(x._dX,{color:"tomato",onClick:()=>{t((0,H.Oh)({slice:e,variationId:n.id})),o(!1)},children:"Delete"})]})]})]})]}),(0,i.jsx)(B.rT,{type:"model",library:e.from,sliceId:e.model.id,variationId:n.id})]})},er=n(6277),eo=n(34887),ea=n.n(eo);let el=e=>{let{variant:t="dashed",color:n="currentColor",className:r}=e;return(0,i.jsx)("hr",{className:(0,er.W)(ea()["variant-".concat(t)],r),style:{color:x.rSc.color[n]}})};var es=n(51507),ed=n(27763),ec=n(21442);async function eu(e){try{let{errors:t}=await (0,d.Ve)(e.component);if(t.length>0)throw t;let{errors:n}=await (0,d.Xi)({libraryID:e.component.from,sliceID:e.component.model.id,variationID:e.variation.id});if(n.length>0)throw n;(0,B.tB)({type:"model",library:e.component.from,sliceId:e.component.model.id,variationId:e.variation.id});let{slice:i,errors:r}=await (0,d.X$)(e.component.from,e.component.model.id);if(r.length>0)throw r;if(!i)throw Error("Could not read variation `".concat(e.variation.name,"`"));let{mocks:o}=await (0,d.pL)({libraryID:e.component.from,sliceID:e.component.model.id}),a=ed.Y.getBuilderPagePathname({libraryName:e.component.href,sliceName:i.name,variationId:i.variations[0].id});await e.router.replace(a);let l={...e.component,model:i,mocks:o};return e.saveSliceSuccess(l),l}catch(n){let t="Could not delete variation `".concat(e.variation.name,"`");throw console.error(t,n),q.Am.error(t),n}}let em=e=>{let{isOpen:t,onClose:n,slice:r,variation:o}=e,l=(0,a.useRouter)(),[d,c]=(0,s.useState)(!1),{saveSliceSuccess:u}=(0,m.Z)(),{setSlice:h}=v();return(0,i.jsxs)(x.VqE,{open:t,onOpenChange:e=>!e&&n(),size:{width:448,height:"auto"},children:[(0,i.jsx)(x.fKu,{icon:"delete",title:"Delete variation"}),(0,i.jsx)(x.cZJ,{children:(0,i.jsxs)(x.xuv,{flexDirection:"column",children:[(0,i.jsxs)(x.xvT,{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)(eh,{children:"not"})," affect your documents until you ",(0,i.jsx)(eh,{children:"edit"})," ","them manually."]}),(0,i.jsxs)(x.kXR,{children:[(0,i.jsx)(x.POh,{size:"medium"}),(0,i.jsx)(x._dX,{size:"medium",color:"tomato",onClick:()=>{o&&(async()=>{c(!0);try{let e=await eu({component:r,router:l,saveSliceSuccess:u,variation:o});h(e)}catch(e){}c(!1),n()})()},loading:d,children:"Delete"})]})]})})]})},eh=e=>(0,i.jsx)(x.xvT,{...e,color:"inherit",component:"span",variant:"bold"});var ep=n(30195);async function ev(e){try{let{errors:t}=await (0,d.Ve)(e.component);if(t.length>0)throw t;let{errors:n}=await (0,d.eH)(e.component,{...e.variation,name:e.variationName});if(n.length>0)throw n;let{slice:i,errors:r}=await (0,d.X$)(e.component.from,e.component.model.id);if(r.length>0)throw r;if(!i)throw Error("Could not read variation `".concat(e.variation.name,"`"));let{mocks:o}=await (0,d.pL)({libraryID:e.component.from,sliceID:e.component.model.id}),a={...e.component,model:i,mocks:o};return e.saveSliceSuccess(a),a}catch(n){let t="Could not rename variation `".concat(e.variation.name,"`");throw console.error(t,n),q.Am.error(t),n}}let ef=e=>{let{isOpen:t,onClose:n,slice:r,variation:o}=e,[a,d]=(0,s.useState)(!1),[c,u]=(0,s.useState)(""),[h,p]=(0,s.useState)(),{setSlice:f}=v(),{saveSliceSuccess:y}=(0,m.Z)();return(0,l.pQ)(t,()=>{if(t&&(null==o?void 0:o.name)!==c){var e;u(null!==(e=null==o?void 0:o.name)&&void 0!==e?e:""),p(void 0)}}),(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(x.VqE,{open:t,onOpenChange:e=>!e&&n(),size:{width:448,height:"auto"},children:[(0,i.jsx)(x.fKu,{icon:"edit",title:"Rename variation"}),(0,i.jsx)(x.cZJ,{children:(0,i.jsxs)(x.l09,{onSubmit:function(){if(!h&&o){d(!0);try{ev({component:r,saveSliceSuccess:y,variation:o,variationName:c.trim()}).then(e=>{f(e)})}catch(e){}d(!1),n()}},children:[(0,i.jsxs)(x.xuv,{flexDirection:"column",gap:8,padding:16,children:[(0,i.jsx)(x.xvT,{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.jsx)(x.xuv,{flexDirection:"column",gap:4,children:(0,i.jsx)(x.ytj,{type:"text",label:"Variation name *",placeholder:"Variation name",error:h,value:c,onValueChange:function(e){u(e),p(function(e){let t=ex.safeParse(e,{errorMap:ey});if(t.error)return t.error.errors[0].message}(e))}})})]}),(0,i.jsxs)(x.kXR,{children:[(0,i.jsx)(x.POh,{size:"medium"}),(0,i.jsx)(x._dX,{type:"submit",size:"medium",loading:a,disabled:!!h,children:"Rename"})]})]})})]})})},ex=ep.z.string().min(1),ey=e=>e.code===ep.z.ZodIssueCode.too_small?{message:"This field is required"}:{message:"Invalid value"};var eg=n(68105),ej=n(63397),eb=n(96009),ew=n.n(eb),eC=n(36131),eI=n(75289),ek=n(30527);function eS(e){let{children:t}=e,n=(0,ek.W)();return(0,i.jsx)(eI.kC,{sx:{p:3,pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:t})}var eT=e=>{let{children:t,FooterContent:n,HeaderContent:r,close:o,sx:a={}}=e;return(0,i.jsx)(ek.Z,{borderFooter:!0,footerSx:{p:0},bodySx:{pt:2,pb:4,px:4},sx:{border:"none",...a},Header:(0,i.jsxs)(eS,{children:[r,o?(0,i.jsx)(eI.x8,{onClick:o,type:"button"}):null]}),Footer:n?(0,i.jsxs)(eI.kC,{sx:{alignItems:"space-between",bg:"headSection",p:3},children:[(0,i.jsx)(eI.xu,{sx:{ml:"auto"}}),n]}):null,children:t})},eE=n(55862);let eR=e=>{let{msg:t}=e;return(0,i.jsx)(eI.xv,{as:"span",sx:{fontSize:12,color:"error",mt:"5px",ml:2},children:t||"Error!"})};var eA=e=>{let{isOpen:t,onClose:n,onSubmit:r,initialVariation:o,variations:a}=e,[l,d]=(0,s.useState)({}),[c,u]=(0,s.useState)(""),[m,h]=(0,s.useState)(!0),[p,v]=(0,s.useState)(""),[f,y]=(0,s.useState)({value:o.id,label:o.name}),[g,j]=(0,s.useState)(!1);function b(){w(),n()}function w(){u(""),v(""),d({}),h(!0),y({value:o.id,label:o.name})}async function C(){let e=function(e){let{id:t,name:n,origin:i}=e,r=t&&t.length?null:{id:"Required!"},o=a.find(e=>e.id===t)?{id:"This id already exists!"}:null,l=n&&n.length?null:{name:"Required!"},s=i.value.length&&a.find(e=>e.id===i.value)?null:{id:"You must select an existing variation!"},d=t&&t.length&&!/^[A-Za-z0-9]+([A-Za-z0-9]+)*$/.exec(t)&&{id:"No special characters allowed"};return{...r,...o,...l,...s,...d}}({id:c,name:p,origin:f});if(Object.keys(e).length)d(e);else{let e=a.find(e=>e.id===f.value);e&&(j(!0),await r(c,p,e),j(!1),b())}}return(0,s.useEffect)(()=>{w()},[o,t]),(0,i.jsx)(eE.Z,{isOpen:t,shouldCloseOnOverlayClick:!0,onRequestClose:()=>b(),contentLabel:"Widget Form Modal",style:{content:{maxWidth:"700px"}},children:(0,i.jsx)(ej.J9,{initialValues:{id:c,name:p,origin:f},onSubmit:C,children:(0,i.jsx)(ej.l0,{id:"variation-add",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),C())},children:(0,i.jsx)(x.xuv,{children:(0,i.jsxs)(eT,{sx:{textAlign:"left"},HeaderContent:(0,i.jsx)(eI.xv,{as:"h2",children:"Add new Variation"}),FooterContent:(0,i.jsxs)(x.xuv,{gap:16,alignItems:"center",children:[(0,i.jsx)(x.zxk,{onClick:b,color:"grey",children:"Cancel"}),(0,i.jsx)(x.zxk,{type:"submit",loading:g,children:"Submit"})]}),close:b,children:[(0,i.jsxs)(x.xuv,{flexDirection:"column",padding:{block:16},children:[(0,i.jsxs)(eI.__,{htmlFor:"name",sx:{mb:1},children:["Variation name*",l.name?(0,i.jsx)(eR,{msg:l.name}):""]}),(0,i.jsx)(ej.gN,{autoComplete:"off",id:"name",name:"name",placeholder:"e.g. Grid - With Icon",as:eI.II,maxLength:30,value:p,onChange:e=>{var t;v(t=e.currentTarget.value),m&&u(ew()(t))}}),(0,i.jsx)(eI.xv,{children:"It will appear here in Slice Machine, and in the page editor in Prismic"})]}),(0,i.jsxs)(x.xuv,{flexDirection:"column",padding:{bottom:16},children:[(0,i.jsxs)(eI.__,{htmlFor:"id",sx:{mb:1},children:["Variation ID*",l.id?(0,i.jsx)(eR,{msg:l.id}):""]}),(0,i.jsx)(ej.gN,{autoComplete:"off",id:"id",name:"id",placeholder:"e.g. gridWithIcon",as:eI.II,maxLength:30,value:c,onChange:e=>{var t;return t=e.currentTarget.value,void(h(!1),u(ew()(t)))}}),(0,i.jsx)(eI.xv,{children:"It's generated automatically based on the variation name and will appear in the API responses."})]}),(0,i.jsxs)(x.xuv,{flexDirection:"column",padding:{bottom:8},children:[(0,i.jsx)(eI.__,{htmlFor:"origin",sx:{mb:1},children:"Duplicate from"}),(0,i.jsx)(eC.ZP,{name:"origin",options:a.map(e=>({value:e.id,label:e.name})),onChange:e=>{e&&y(e)},defaultValue:f,maxMenuHeight:150,theme:e=>({...e,colors:{...e.colors,text:"text",primary:"background"}})})]})]})})})})})},eD=n(20136),e_=n.n(eD);let eL=e=>{let{horizontalScroll:t=!1}=e,{slice:n,variation:r,setSlice:o}=v(),[l,c]=(0,s.useState)(),u=(0,ec.H)(),{sliceFilterFn:h,defaultVariationSelector:p,onUploadSuccess:f}=u.modalPayload,y=(0,a.useRouter)(),{saveSliceSuccess:g}=(0,m.Z)(),j=n.model.variations.length;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(x.xuv,{flexDirection:"column",gap:16,children:t?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(el,{variant:"edgeFaded",color:"grey6"}),(0,i.jsxs)(x.xuv,{justifyContent:"space-between",children:[(0,i.jsxs)(x.xvT,{color:"grey11",children:[j," variation",1!==j&&"s"]}),(0,i.jsx)(x.zxk,{onClick:()=>{c({type:"ADD_VARIATION"})},startIcon:"add",color:"grey",children:"Add a variation"})]}),(0,i.jsx)("div",{className:e_().hideScrollbar,style:{height:"240px",position:"relative",marginRight:"-32px",overflowX:"scroll",scrollSnapType:"x mandatory"},children:(0,i.jsx)("div",{style:{position:"absolute",paddingRight:"32px"},children:(0,i.jsx)(x.xuv,{flexDirection:"row",gap:16,children:(0,i.jsx)(eO,{screenshotChangesModal:u,setDialog:c,width:320})})})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eO,{screenshotChangesModal:u,setDialog:c}),(0,i.jsx)("div",{style:{bottom:x.rSc.space[0],marginBottom:"-".concat(x.rSc.space[16]),position:"sticky"},children:(0,i.jsxs)(x.xuv,{backgroundColor:"grey2",flexDirection:"column",padding:{bottom:40,inline:24},children:[(0,i.jsx)(x.phe,{sx:{left:0,position:"absolute",right:0}}),(0,i.jsx)(x.zxk,{color:"grey",onClick:()=>{c({type:"ADD_VARIATION"})},startIcon:"add",sx:{position:"relative"},children:"Add a variation"})]})})]})}),(0,i.jsx)(eg.Z,{slices:h([n]),defaultVariationSelector:p,onUploadSuccess:f}),(0,i.jsx)(ef,{isOpen:(null==l?void 0:l.type)==="RENAME_VARIATION",onClose:()=>{c(void 0)},slice:n,variation:null==l?void 0:l.variation}),(0,i.jsx)(em,{isOpen:(null==l?void 0:l.type)==="DELETE_VARIATION",onClose:()=>{c(void 0)},slice:n,variation:null==l?void 0:l.variation}),(0,i.jsx)(eA,{initialVariation:r,isOpen:(null==l?void 0:l.type)==="ADD_VARIATION",onClose:()=>{c(void 0)},onSubmit:async(e,t,i)=>{try{let{slice:r,variation:a}=(0,H.Kp)({slice:n,id:e,name:t,copiedVariation:i});await (0,d.Ve)(r),g(r),o(r);let l=ed.Y.getBuilderPagePathname({libraryName:r.href,sliceName:r.model.name,variationId:a.id});y.replace(l)}catch(n){let e="Could not add variation `".concat(t,"`");console.error(e,n),q.Am.error(e)}},variations:n.model.variations})]})},eO=e=>{let{screenshotChangesModal:t,setDialog:n,width:r}=e,{slice:o,variation:a,setSlice:l}=v(),s={scrollSnapAlign:"start"};return(0,i.jsx)(i.Fragment,{children:o.model.variations.map(e=>(0,i.jsx)("div",{style:void 0!==r?{...s,width:r}:s,children:(0,i.jsx)(es.b,{action:{type:"menu",onRename:()=>{n({type:"RENAME_VARIATION",variation:e})},onRemove:()=>{n({type:"DELETE_VARIATION",variation:e})},removeDisabled:o.model.variations.length<=1},mode:"navigation",onUpdateScreenshot:()=>{t.onOpenModal({sliceFilterFn:e=>e,defaultVariationSelector:{sliceID:o.model.id,variationID:e.id},onUploadSuccess:e=>{l(e)}})},replace:!0,selected:e.id===a.id,slice:o,variant:"outlined",variationId:e.id},e.id)},e.id))})};var eF=()=>{let{slice:e,actionQueueStatus:t}=v(),n=(0,x.ach)({max:"large"}),r=(0,j.k)();return(0,i.jsxs)(D.LN,{children:[(0,i.jsxs)(D.wd,{children:[(0,i.jsx)(D.Xq,{url:"/slices"}),(0,i.jsxs)(D.Cx,{children:[(0,i.jsx)(y.g,{children:(0,M._)((0,M.f)(r.value))}),(0,i.jsx)(y.g,{active:!0,children:e.model.name})]}),(0,i.jsxs)(D.K2,{children:[(0,i.jsx)(g.X,{status:t}),(0,i.jsx)(P,{disabled:"done"!==t})]})]}),(0,i.jsxs)(D.RN,{children:[(0,i.jsxs)(x.xuv,{display:"grid",alignItems:"flex-start",gap:16,...n?{gridTemplateRows:"304px 1fr"}:{gridTemplateColumns:"320px 1fr"},children:[(0,i.jsx)(eL,{horizontalScroll:n}),(0,i.jsx)(ei,{})]}),(0,i.jsx)(R,{})]})]})};function ez(){let e=(0,a.useRouter)(),{slice:t,variation:n}=(0,f.Z)();return void 0===t||void 0===n?(e.replace("/"),null):(0,i.jsx)(p,{initialSlice:t,children:e=>{let{slice:t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o(),{children:(0,i.jsxs)("title",{children:[t.model.name," - Slice Machine"]})}),(0,i.jsx)(eF,{})]})}})}},34887:function(e){e.exports={base:"Divider_base__4eT6E","variant-dashed":"Divider_variant-dashed__4Lvrj Divider_base__4eT6E","variant-edgeFaded":"Divider_variant-edgeFaded__049V2 Divider_base__4eT6E"}},20136:function(e){e.exports={hideScrollbar:"VariationsList_hideScrollbar__cHCIS"}},76473:function(e,t,n){"use strict";n.d(t,{y1:function(){return j}});var i=n(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}n(52322);var 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,t){return void 0===t&&(t=","),e.split(t)}function d(e,t,n){void 0===t&&(t="+");var i=e.toLocaleLowerCase().split(t).map(function(e){return l(e)}),a={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod")},s=i.filter(function(e){return!o.includes(e)});return r({},a,{keys:s,description:n})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&m([l(e.key),l(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&h([l(e.key),l(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){c.clear()});var c=new Set;function u(e){return Array.isArray(e)}function m(e){var t=Array.isArray(e)?e:[e];c.has("meta")&&c.forEach(function(e){return!o.includes(e)&&c.delete(e.toLowerCase())}),t.forEach(function(e){return c.add(e.toLowerCase())})}function h(e){var t=Array.isArray(e)?e:[e];"meta"===e?c.clear():t.forEach(function(e){return c.delete(e.toLowerCase())})}function p(e,t){var n=e.target;void 0===t&&(t=!1);var i=n&&n.tagName;return u(t)?!!(i&&t&&t.some(function(e){return e.toLowerCase()===i.toLowerCase()})):!!(i&&t&&!0===t)}var v=function(e,t,n){void 0===n&&(n=!1);var i,r=t.alt,o=t.meta,a=t.mod,s=t.shift,d=t.ctrl,m=t.keys,h=e.key,p=e.code,v=e.ctrlKey,f=e.metaKey,x=e.shiftKey,y=e.altKey,g=l(p),j=h.toLowerCase();if(!n){if(!y===r&&"alt"!==j||!x===s&&"shift"!==j)return!1;if(a){if(!f&&!v)return!1}else if(!f===o&&"meta"!==j&&"os"!==j||!v===d&&"ctrl"!==j&&"control"!==j)return!1}return!!(m&&1===m.length&&(m.includes(j)||m.includes(g)))||(m?(void 0===i&&(i=","),(u(m)?m:m.split(i)).every(function(e){return c.has(e.trim().toLowerCase())})):!m)},f=(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 j(e,t,n,r){var o,a=(0,i.useRef)(null),c=(0,i.useRef)(!1),j=n instanceof Array?r instanceof Array?void 0:r:n,b=u(e)?e.join(null==j?void 0:j.splitKey):e,w=n instanceof Array?n:r instanceof Array?r:void 0,C=(0,i.useCallback)(t,null!=w?w:[]),I=(0,i.useRef)(C);w?I.current=C:I.current=t;var k=(!function e(t,n){return t&&n&&"object"==typeof t&&"object"==typeof n?Object.keys(t).length===Object.keys(n).length&&Object.keys(t).reduce(function(i,r){return i&&e(t[r],n[r])},!0):t===n}((o=(0,i.useRef)(void 0)).current,j)&&(o.current=j),o.current),S=(0,i.useContext)(x).enabledScopes,T=(0,i.useContext)(f);return g(function(){if((null==k?void 0:k.enabled)!==!1&&(e=null==k?void 0:k.scopes,0===S.length&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!e||S.some(function(t){return e.includes(t)})||S.includes("*")))){var e,t=function(e,t){var n;if(void 0===t&&(t=!1),!(p(e,["input","textarea","select"])&&!p(e,null==k?void 0:k.enableOnFormTags)||null!=k&&null!=k.ignoreEventWhen&&k.ignoreEventWhen(e))){if(null!==a.current&&document.activeElement!==a.current&&!a.current.contains(document.activeElement)){y(e);return}(null==(n=e.target)||!n.isContentEditable||null!=k&&k.enableOnContentEditable)&&s(b,null==k?void 0:k.splitKey).forEach(function(n){var i,r,o,a=d(n,null==k?void 0:k.combinationKey);if(v(e,a,null==k?void 0:k.ignoreModifiers)||null!=(o=a.keys)&&o.includes("*")){if(t&&c.current)return;if(("function"==typeof(i=null==k?void 0:k.preventDefault)&&i(e,a)||!0===i)&&e.preventDefault(),"function"==typeof(r=null==k?void 0:k.enabled)?!r(e,a):!0!==r&&void 0!==r){y(e);return}I.current(e,a),t||(c.current=!0)}})}},n=function(e){void 0!==e.key&&(m(l(e.code)),((null==k?void 0:k.keydown)===void 0&&(null==k?void 0:k.keyup)!==!0||null!=k&&k.keydown)&&t(e))},i=function(e){void 0!==e.key&&(h(l(e.code)),c.current=!1,null!=k&&k.keyup&&t(e,!0))},r=a.current||(null==j?void 0:j.document)||document;return r.addEventListener("keyup",i),r.addEventListener("keydown",n),T&&s(b,null==k?void 0:k.splitKey).forEach(function(e){return T.addHotkey(d(e,null==k?void 0:k.combinationKey,null==k?void 0:k.description))}),function(){r.removeEventListener("keyup",i),r.removeEventListener("keydown",n),T&&s(b,null==k?void 0:k.splitKey).forEach(function(e){return T.removeHotkey(d(e,null==k?void 0:k.combinationKey,null==k?void 0:k.description))})}}},[b,k,S]),a}}},function(e){e.O(0,[898,789,917,525,461,139,397,183,44,349,34,630,658,888,774,179],function(){return e(e.s=31314)}),_N_E=e.O()}]);
|
package/out/_next/static/chunks/pages/{slices-7e816c2b32cc6f19.js → slices-071bb494907adf0f.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{74600:function(e,t,n){var i=n(34311),o=n(23779),r=i(function(e,t,n){return e+(n?" ":"")+o(t)});e.exports=r},26688:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices",function(){return n(31562)}])},34166:function(e,t,n){"use strict";n.d(t,{nZ:function(){return d},rT:function(){return f},tB:function(){return u}});var i=n(52322),o=n(7729),r=n(2784),l=n(30195),s=n(94160),a=n(76611),c=n(5683);function d(e){let{type:t,library:n,sliceId:i,variationId:o,langSmithUrl:r}=e,l=(0,c.i)({type:t,library:n,sliceId:i,variationId:o}),s=JSON.stringify({langSmithUrl:r});localStorage.setItem(l,s)}function u(e){let{type:t,library:n,sliceId:i,variationId:o}=e,r=(0,c.i)({type:t,library:n,sliceId:i,variationId:o});localStorage.removeItem(r)}function f(e){let{type:t,library:n,sliceId:d,variationId:u}=e,{key:f,value:m,done:x}=function(e){let{type:t,library:n,sliceId:i,variationId:o}=e,r=(0,c.i)({type:t,library:n,sliceId:i,variationId:o}),[s,d]=(0,a.V)(r,void 0,{schema:l.z.object({langSmithUrl:l.z.string().url().optional()})});return{key:r,value:s,done:()=>d(void 0)}}({type:t,library:n,sliceId:d,variationId:u}),[h,p]=(0,r.useState)(),v=e=>()=>{m&&(p(f),s.Xe.track({event:"slice-generation-feedback",type:t,sliceId:d,variationId:u,feedback:e,langSmithUrl:m.langSmithUrl}),x())};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.h_i,{children:(0,i.jsx)(o.FNi,{anchor:(0,i.jsx)(o.xuv,{width:"100%",justifyContent:"center",position:"absolute",bottom:64}),icon:"check",title:"Thanks for your feedback!",seconds:2,open:!!h,onOpenChange:e=>{e||p(void 0)}},h)}),(0,i.jsx)(o.FpX,{children:m&&(0,i.jsxs)(o.xuv,{flexDirection:"row",justifyContent:"end",gap:8,alignItems:"center",children:[(0,i.jsx)(o.xvT,{color:"grey11",children:"Did the AI get it right?"}),(0,i.jsxs)(o.xuv,{flexDirection:"row",gap:4,children:[(0,i.jsx)(o.ua7,{side:"bottom",sideOffset:4,variant:"text",content:"Looks good",children:(0,i.jsx)(o.hU,{variant:"solid",size:"small",icon:"thumbUp",onClick:v("up")})}),(0,i.jsx)(o.ua7,{side:"bottom",sideOffset:4,variant:"text",content:"Needs improvement",children:(0,i.jsx)(o.hU,{variant:"solid",size:"small",icon:"thumbDown",onClick:v("down")})})]})]})})]})}},76611:function(e,t,n){"use strict";n.d(t,{V:function(){return o}});var i=n(2784);function o(e,t,n){let{schema:o}=null!=n?n:{},r=()=>{try{let n=localStorage.getItem(e);if(null==n)return t;if(!o)return JSON.parse(n);return o.parse(JSON.parse(n))}catch(e){return t}},[l,s]=(0,i.useState)(r),[a,c]=(0,i.useState)(e);return a!==e&&(c(e),s(r())),[l,(0,i.useCallback)(n=>{s(i=>{let o;if(void 0===(o="function"==typeof n?n(i):n)){try{localStorage.removeItem(e)}catch(e){return i}return t}try{localStorage.setItem(e,JSON.stringify(o))}catch(e){return i}return o})},[e,t])]}},33986:function(e,t,n){"use strict";n.d(t,{z:function(){return a}});var i=n(52322),o=n(2784),r=n(75289);let l=(e,t)=>e?"".concat(e,"-").concat(t):"",s=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},a=(0,o.forwardRef)((e,t)=>{let{label:n,Icon:o,type:a,form:c,isLoading:d=!1,disabled:u=!1,onClick:f,sx:m={},iconSize:x=16,iconFill:h,variant:p="primary",...v}=e;return(0,i.jsx)(r.zx,{ref:t,sx:{...m,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...d?{cursor:"wait !important"}:{}},type:a,form:c,disabled:u||d,onClick:d?void 0:f,variant:p,...v,children:d?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.$j,{size:x,color:s(p),"data-testid":l(v["data-testid"],"spinner")}),o&&n]}):(0,i.jsxs)(i.Fragment,{children:[o&&(0,i.jsx)(o,{size:x,fill:h,"data-testid":l(v["data-testid"],"icon")}),n]})})})},46999:function(e,t,n){"use strict";n.d(t,{W:function(){return l}});var i=n(52322),o=n(63397);n(2784);var r=n(75289);let l=e=>{let{name:t,label:n,placeholder:l,error:s,testId:a,onChange:c}=e;return(0,i.jsxs)(r.xu,{mb:3,children:[(0,i.jsx)(r.__,{htmlFor:t,mb:2,children:n}),(0,i.jsx)(o.gN,{name:t,type:"text",placeholder:l,as:r.II,autoComplete:"off",...c?{onChange:c}:null,...a?{"data-testid":a}:null}),s?(0,i.jsx)(r.xv,{"data-testid":a?"".concat(a,"-error"):"input-error",sx:{color:"error",mt:1},children:s}):null]})}},59532:function(e,t,n){"use strict";var i=n(52322),o=n(63397),r=n(37149),l=n.n(r),s=n(75289),a=n(33986),c=n(55862),d=n(30527);function u(e){let{children:t}=e,n=(0,d.W)();return(0,i.jsx)(s.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:t})}t.Z=function(e){let{children:t,close:n,isOpen:r,formId:f,validate:m,onSubmit:x,widthInPx:h,initialValues:p,content:{title:v},cardProps:y,omitFooter:g=!1,isLoading:j=!1,buttonLabel:b="Save",testId:k,actionMessage:S}=e;return l().setAppElement("#__next"),(0,i.jsx)(c.Z,{isOpen:r,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:v,style:{content:{width:null!=h?h:"900px"}},children:(0,i.jsx)(o.J9,{initialValues:p,validate:e=>m?m(e):void 0,onSubmit:e=>{x(e)},children:e=>{let{isValid:r,isSubmitting:l,values:c,errors:m,touched:x,setFieldValue:h,setValues:p}=e;return(0,i.jsx)(o.l0,{id:f,...null!=k?{"data-testid":k}:null,children:(0,i.jsx)(d.Z,{borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"},...y,Header:(0,i.jsxs)(u,{children:[(0,i.jsx)(s.X6,{sx:{fontSize:"20px"},children:v}),(0,i.jsx)(s.x8,{type:"button",onClick:n})]}),Footer:g?null:(0,i.jsxs)(s.kC,{sx:{alignItems:"space-between"},children:[(0,i.jsx)(s.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof S?S(e):S}),(0,i.jsxs)(s.kC,{sx:{ml:"auto"},children:[(0,i.jsx)(s.zx,{mr:2,type:"button",onClick:n,variant:"secondary",disabled:l||j,children:"Cancel"}),(0,i.jsx)(a.z,{label:b,form:f,type:"submit",disabled:!r||l||j,isLoading:l||j,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:t({isValid:r,isSubmitting:l,values:c,errors:m,touched:x,setFieldValue:h,setValues:p})})})}})})}},31562:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Y}});var i=n(52322),o=n(7729),r=n(97729),l=n.n(r),s=n(5632),a=n(2784),c=n(56580),d=n(88932),u=n(65077),f=n(75289),m=n(43388),x=n(22654),h=n(63470),p=n(91589),v=n(27213),y=n(51507),g=n(27763),j=n(21442),b=n(51384),k=n(65186),S=n(59326),w=n(34166),C=n(80148);async function I(e){let{sliceName:t,sliceID:n,libraryID:i,sliceVariationIds:o,onSuccess:r}=e;try{let{errors:e}=await C.managerClient.slices.deleteSlice({libraryID:i,sliceID:n});if(e.length>0)throw e;o.forEach(e=>{(0,w.tB)({type:"model",library:i,sliceId:n,variationId:e})}),r(),d.Am.success("Successfully deleted slice “".concat(t,"”"))}catch(n){let e="An unexpected error happened while deleting slice “".concat(t,"”.");console.error(e,n),d.Am.error(e)}}var L=n(68968),E=n(33986),O=n(30527),A=n(55862),N=n(54597);let R=e=>{var t;let{isOpen:n,libName:o,sliceId:r,sliceName:l,sliceVariationIds:s,onClose:c}=e,[d,u]=(0,a.useState)(!1),{deleteSliceSuccess:m}=(0,N.Z)(),{syncChanges:x}=(0,L.g)(),{theme:h}=(0,S.B7)(),p=async()=>{u(!0),await I({libraryID:o,sliceID:r,sliceName:l,sliceVariationIds:s,onSuccess:()=>{m(r,o),x()}}),c(),u(!1)};return(0,i.jsx)(A.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:c,children:(0,i.jsx)(O.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},borderFooter:!0,Header:(0,i.jsxs)(f.kC,{sx:{position:"sticky",background:"gray",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,i.jsxs)(f.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(k.$vK,{size:20,color:null===(t=h.colors)||void 0===t?void 0:t.greyIcon}),(0,i.jsx)(f.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,i.jsx)(f.x8,{type:"button",onClick:c})]}),Footer:()=>(0,i.jsxs)(f.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorders))},backgroundColor:"gray"},children:[(0,i.jsx)(E.z,{label:"Cancel",variant:"secondary",onClick:c,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,i.jsx)(E.z,{label:"Delete",variant:"danger",isLoading:d,sx:{minHeight:39,minWidth:78},onClick:()=>{p()}})]}),children:(0,i.jsxs)(f.nv,{children:["This action will immediately make the following changes:",(0,i.jsxs)("ul",{children:[(0,i.jsxs)("li",{children:["Delete the"," ",(0,i.jsxs)(f.xv,{sx:{fontWeight:"bold"},children:[o,"/",l,"/"]})," ","directory."]}),(0,i.jsx)("li",{children:"Remove the Slice from all Slice Zones that use it."})]}),"The next time you push your changes to Prismic, the following change will happen:",(0,i.jsx)("ul",{children:(0,i.jsx)("li",{children:"Remove the Slice from the list of available Slices to use in the Page Builder."})}),"You will need to manually remove the Slice from any Pages that currently use it."]})})})};var z=n(36887),_=n(94160),D=e=>{let{title:t,onCreateNew:n,buttonText:o,documentationComponent:r,videoPublicIdUrl:l,...s}=e;return(0,i.jsxs)(f.xu,{sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"},...s,children:[(0,i.jsx)(f.xu,{sx:e=>{var t;return{display:"flex",flex:1,alignItems:"center",minWidth:"400px",maxWidth:"70%",border:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02)}},children:(0,i.jsx)(z.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:l,onPlay:()=>{_.Xe.track({event:"open-video-tutorials",video:l})}})}),(0,i.jsxs)(f.xu,{sx:e=>{var t;return{bg:"white",display:"flex",flexDirection:"column",border:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02),flex:1,minWidth:"400px",maxWidth:"70%"}},children:[(0,i.jsxs)(f.xu,{sx:e=>{var t;return{display:"flex",flexDirection:"column",p:4,borderBottom:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02)}},children:[(0,i.jsx)(f.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:t}),(0,i.jsx)(f.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:r})]}),(0,i.jsxs)(f.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,i.jsx)(f.zx,{onClick:n,"data-testid":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:o}),(0,i.jsx)(f.xv,{sx:{fontSize:"12px",color:"grey04",maxWidth:"280px"},children:"It will be stored locally and you will be able to push it to your repository"})]})]})]})},W=n(6256),F=n(63908),P=n(26109);async function T(e){let{slice:t,newSliceName:n,onSuccess:i}=e;try{let e=(0,F.PQ)(t,n),{errors:o}=await C.managerClient.slices.renameSlice({libraryID:t.from,model:P.id.fromSM(e.model)});if(o.length>0)throw o;i(e),d.Am.success("Slice name updated")}catch(n){let e="An unexpected error happened while renaming “".concat(t.model.name,"”.");console.error(e,n),d.Am.error(e)}}var Z=n(7723),B=n(59532),K=n(46999),X=n(63019);let H=e=>{var t,n;let{slice:o,isOpen:r,onClose:l}=e,{renameSliceSuccess:s}=(0,N.Z)(),{syncChanges:a}=(0,L.g)(),{localLibs:d,remoteLibs:u}=(0,c.v9)(e=>({localLibs:(0,Z.Sd)(e),remoteLibs:(0,Z.sT)(e)})),m=null!==(t=null==o?void 0:o.model.name)&&void 0!==t?t:"",x=async e=>{o&&(await T({slice:o,newSliceName:e.sliceName,onSuccess:e=>{s(e.from,e.model),a()}}),l())};return(0,i.jsx)(B.Z,{testId:"rename-slice-modal",isOpen:r,widthInPx:"530px",formId:"rename-slice-modal-".concat(null!==(n=null==o?void 0:o.model.id)&&void 0!==n?n:""),close:l,buttonLabel:"Rename",onSubmit:e=>void x(e),initialValues:{sliceName:m},content:{title:"Rename a slice"},validate:e=>(0,X.h)(e,d,u),children:e=>{let{touched:t,errors:n}=e;return(0,i.jsx)(f.xu,{children:(0,i.jsx)(K.W,{name:"sliceName",label:"Slice Name","data-testid":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:t.sliceName?n.sliceName:void 0,testId:"slice-name-input"})})}})};var U=n(21151),V=n(68105),M=n(39204),J=n(7974),q=n(31860),Y=()=>{var e,t,n,r;let k=(0,x.l)(),S=(0,s.useRouter)(),{modalPayload:w,onOpenModal:I}=(0,j.H)(),{openLoginModal:L}=(0,N.Z)(),E=(0,h.k)(),O=(0,v.F)({menuType:"Dropdown",sectionsNamingExperiment:E}),{sliceFilterFn:A,defaultVariationSelector:z}=w,{remoteSlices:_,libraries:F}=(0,c.v9)(e=>({remoteSlices:(0,Z.sT)(e),libraries:(0,Z.Sd)(e)})),[P,T]=(0,a.useState)(!1),[B,K]=(0,a.useState)(!1),[X,Y]=(0,a.useState)(!1),[$,G]=(0,a.useState)(!1),Q=F.filter(e=>e.isLocal),ee=F.map(e=>(e.components=[...e.components].sort((e,t)=>e.model.name.localeCompare(t.model.name)),e)),et=(F||[]).map(e=>e.components).flat(),en=et.length,[ei,eo]=(0,a.useState)(),er=()=>{K(!0)},el=()=>{Y(!0)},es=async()=>{await C.managerClient.user.checkIsLoggedIn()?G(!0):L()},ea=()=>{G(!1)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l(),{children:(0,i.jsxs)("title",{children:[(0,q._)((0,q.f)(E.value))," - Slice Machine"]})}),(0,i.jsxs)(b.LN,{children:[(0,i.jsxs)(b.wd,{children:[(0,i.jsx)(b.Cx,{children:(0,i.jsx)(m.g,{children:(0,q._)((0,q.f)(E.value))})}),(null==Q?void 0:Q.length)!==0&&0!==en?(0,i.jsxs)(o.h_2,{children:[(0,i.jsx)(o.$FS,{children:(0,i.jsx)(o.zxk,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,i.jsxs)(o.AWV,{align:"end",children:[k.eligible&&(0,i.jsx)(o.Xiv,{renderStartIcon:()=>O.fromImage.BackgroundIcon,onSelect:()=>void es(),description:O.fromImage.description,children:O.fromImage.title}),(0,i.jsx)(o.Xiv,{renderStartIcon:()=>O.fromScratch.BackgroundIcon,onSelect:()=>T(!0),description:O.fromScratch.description,children:O.fromScratch.title})]})]}):void 0]}),(0,i.jsxs)(b.RN,{children:[(0,i.jsx)(u.xR,{sx:{display:"flex",flexDirection:"column"},children:ee.length>0?(0,i.jsx)(f.kC,{sx:{flex:1,flexDirection:"column"},children:0===en?(0,i.jsx)(f.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,i.jsx)(D,{title:"What are ".concat((0,q._)(E.value),"?"),onCreateNew:()=>{T(!0)},buttonText:"Create one",videoPublicIdUrl:J.rd,documentationComponent:(0,i.jsxs)(i.Fragment,{children:[(0,q._)((0,q.f)(E.value))," ",'are sections of your website. Prismic documents contain a dynamic "',(0,q.f)(E.value)," ",'Zone" that allows content creators to add, edit, and rearrange ',(0,q._)(E.value)," ","to compose dynamic layouts for any page design."," ",(0,i.jsx)(f.rU,{target:"_blank",href:"https://prismic.io/docs/core-concepts/slices",sx:e=>{var t;return{color:null==e?void 0:null===(t=e.colors)||void 0===t?void 0:t.primary}},children:"Learn more"}),"."]}),"data-testid":"slices-table-blank-slate"})}):ee.map(e=>{let{name:t,isLocal:n,components:o}=e;return(0,i.jsxs)(f.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,i.jsxs)(f.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)(f.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,i.jsx)(f.xv,{children:E.eligible&&1===ee.length?"Your ".concat((0,q._)(E.value)):t})}),!n&&(0,i.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,i.jsx)(U.Z,{elems:o,defineElementKey:e=>e.model.name,renderElem:e=>(0,i.jsx)(y.b,{action:{type:"menu",onRemove:()=>{eo(e),er()},onRename:()=>{eo(e),el()}},mode:"navigation",onUpdateScreenshot:()=>{I({sliceFilterFn:t=>t.filter(t=>t.model.id===e.model.id)})},slice:e,variant:"solid"}),gridGap:"32px 16px"})]},t)})}):void 0}),(null==Q?void 0:Q.length)>0&&(0,i.jsx)(V.Z,{slices:A(et),defaultVariationSelector:z}),(null==Q?void 0:Q.length)>0&&P&&(0,i.jsx)(W.c,{localLibraries:Q,location:"slices",remoteSlices:_,onSuccess:(e,t)=>{let n=e.variations[0].id,i=g.Y.getBuilderPagePathname({libraryName:t,sliceName:e.name,variationId:n});S.push(i),d.Am.success((0,M.kQ)({sectionsNamingExperiment:E,path:"".concat(t,"/").concat(e.name,"/model.json")}))},onClose:()=>{T(!1)}}),(0,i.jsx)(H,{isOpen:X,slice:ei,onClose:()=>{Y(!1)},"data-testid":"rename-slice-modal"}),(0,i.jsx)(R,{isOpen:B,libName:null!==(e=null==ei?void 0:ei.from)&&void 0!==e?e:"",sliceId:null!==(t=null==ei?void 0:ei.model.id)&&void 0!==t?t:"",sliceName:null!==(n=null==ei?void 0:ei.model.name)&&void 0!==n?n:"",sliceVariationIds:(null!==(r=null==ei?void 0:ei.model.variations)&&void 0!==r?r:[]).map(e=>e.id),onClose:()=>{K(!1)}}),(0,i.jsx)(p.S,{open:$,location:"slices",onSuccess:e=>{let{library:t}=e;d.Am.success((0,i.jsx)(M.GX,{message:"".concat((0,q.f)(E.value),"(s) added to ").concat(E.value," zone and created at: "),path:t})),ea()},onClose:ea})]})]})]})}},5683:function(e,t,n){"use strict";n.d(t,{i:function(){return r},v:function(){return o}});let i=e=>"slice-machine_".concat(e),o=i("staticFieldsInfoDialogDismissed");function r(e){let{type:t,library:n,sliceId:o,variationId:r}=e;return i(["ai-feedback",t,n,o,r].join("#"))}},76473:function(e,t,n){"use strict";n.d(t,{y1:function(){return j}});var i=n(2784);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}n(52322);var r=["shift","alt","meta","mod","ctrl"],l={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function s(e){return(l[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function a(e,t){return void 0===t&&(t=","),e.split(t)}function c(e,t,n){void 0===t&&(t="+");var i=e.toLocaleLowerCase().split(t).map(function(e){return s(e)}),l={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod")},a=i.filter(function(e){return!r.includes(e)});return o({},l,{keys:a,description:n})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([s(e.key),s(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&m([s(e.key),s(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){d.clear()});var d=new Set;function u(e){return Array.isArray(e)}function f(e){var t=Array.isArray(e)?e:[e];d.has("meta")&&d.forEach(function(e){return!r.includes(e)&&d.delete(e.toLowerCase())}),t.forEach(function(e){return d.add(e.toLowerCase())})}function m(e){var t=Array.isArray(e)?e:[e];"meta"===e?d.clear():t.forEach(function(e){return d.delete(e.toLowerCase())})}function x(e,t){var n=e.target;void 0===t&&(t=!1);var i=n&&n.tagName;return u(t)?!!(i&&t&&t.some(function(e){return e.toLowerCase()===i.toLowerCase()})):!!(i&&t&&!0===t)}var h=function(e,t,n){void 0===n&&(n=!1);var i,o=t.alt,r=t.meta,l=t.mod,a=t.shift,c=t.ctrl,f=t.keys,m=e.key,x=e.code,h=e.ctrlKey,p=e.metaKey,v=e.shiftKey,y=e.altKey,g=s(x),j=m.toLowerCase();if(!n){if(!y===o&&"alt"!==j||!v===a&&"shift"!==j)return!1;if(l){if(!p&&!h)return!1}else if(!p===r&&"meta"!==j&&"os"!==j||!h===c&&"ctrl"!==j&&"control"!==j)return!1}return!!(f&&1===f.length&&(f.includes(j)||f.includes(g)))||(f?(void 0===i&&(i=","),(u(f)?f:f.split(i)).every(function(e){return d.has(e.trim().toLowerCase())})):!f)},p=(0,i.createContext)(void 0),v=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},g="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function j(e,t,n,o){var r,l=(0,i.useRef)(null),d=(0,i.useRef)(!1),j=n instanceof Array?o instanceof Array?void 0:o:n,b=u(e)?e.join(null==j?void 0:j.splitKey):e,k=n instanceof Array?n:o instanceof Array?o:void 0,S=(0,i.useCallback)(t,null!=k?k:[]),w=(0,i.useRef)(S);k?w.current=S:w.current=t;var C=(!function e(t,n){return t&&n&&"object"==typeof t&&"object"==typeof n?Object.keys(t).length===Object.keys(n).length&&Object.keys(t).reduce(function(i,o){return i&&e(t[o],n[o])},!0):t===n}((r=(0,i.useRef)(void 0)).current,j)&&(r.current=j),r.current),I=(0,i.useContext)(v).enabledScopes,L=(0,i.useContext)(p);return g(function(){if((null==C?void 0:C.enabled)!==!1&&(e=null==C?void 0:C.scopes,0===I.length&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!e||I.some(function(t){return e.includes(t)})||I.includes("*")))){var e,t=function(e,t){var n;if(void 0===t&&(t=!1),!(x(e,["input","textarea","select"])&&!x(e,null==C?void 0:C.enableOnFormTags)||null!=C&&null!=C.ignoreEventWhen&&C.ignoreEventWhen(e))){if(null!==l.current&&document.activeElement!==l.current&&!l.current.contains(document.activeElement)){y(e);return}(null==(n=e.target)||!n.isContentEditable||null!=C&&C.enableOnContentEditable)&&a(b,null==C?void 0:C.splitKey).forEach(function(n){var i,o,r,l=c(n,null==C?void 0:C.combinationKey);if(h(e,l,null==C?void 0:C.ignoreModifiers)||null!=(r=l.keys)&&r.includes("*")){if(t&&d.current)return;if(("function"==typeof(i=null==C?void 0:C.preventDefault)&&i(e,l)||!0===i)&&e.preventDefault(),"function"==typeof(o=null==C?void 0:C.enabled)?!o(e,l):!0!==o&&void 0!==o){y(e);return}w.current(e,l),t||(d.current=!0)}})}},n=function(e){void 0!==e.key&&(f(s(e.code)),((null==C?void 0:C.keydown)===void 0&&(null==C?void 0:C.keyup)!==!0||null!=C&&C.keydown)&&t(e))},i=function(e){void 0!==e.key&&(m(s(e.code)),d.current=!1,null!=C&&C.keyup&&t(e,!0))},o=l.current||(null==j?void 0:j.document)||document;return o.addEventListener("keyup",i),o.addEventListener("keydown",n),L&&a(b,null==C?void 0:C.splitKey).forEach(function(e){return L.addHotkey(c(e,null==C?void 0:C.combinationKey,null==C?void 0:C.description))}),function(){o.removeEventListener("keyup",i),o.removeEventListener("keydown",n),L&&a(b,null==C?void 0:C.splitKey).forEach(function(e){return L.removeHotkey(c(e,null==C?void 0:C.combinationKey,null==C?void 0:C.description))})}}},[b,C,I]),l}}},function(e){e.O(0,[898,789,44,34,658,268,888,774,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{74600:function(e,t,n){var i=n(34311),o=n(23779),r=i(function(e,t,n){return e+(n?" ":"")+o(t)});e.exports=r},26688:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices",function(){return n(31562)}])},34166:function(e,t,n){"use strict";n.d(t,{nZ:function(){return d},rT:function(){return f},tB:function(){return u}});var i=n(52322),o=n(7729),r=n(2784),l=n(30195),s=n(94160),a=n(76611),c=n(5683);function d(e){let{type:t,library:n,sliceId:i,variationId:o,langSmithUrl:r}=e,l=(0,c.i)({type:t,library:n,sliceId:i,variationId:o}),s=JSON.stringify({langSmithUrl:r});localStorage.setItem(l,s)}function u(e){let{type:t,library:n,sliceId:i,variationId:o}=e,r=(0,c.i)({type:t,library:n,sliceId:i,variationId:o});localStorage.removeItem(r)}function f(e){let{type:t,library:n,sliceId:d,variationId:u}=e,{key:f,value:m,done:x}=function(e){let{type:t,library:n,sliceId:i,variationId:o}=e,r=(0,c.i)({type:t,library:n,sliceId:i,variationId:o}),[s,d]=(0,a.V)(r,void 0,{schema:l.z.object({langSmithUrl:l.z.string().url().optional()})});return{key:r,value:s,done:()=>d(void 0)}}({type:t,library:n,sliceId:d,variationId:u}),[h,p]=(0,r.useState)(),v=e=>()=>{m&&(p(f),s.Xe.track({event:"slice-generation-feedback",type:t,sliceId:d,variationId:u,feedback:e,langSmithUrl:m.langSmithUrl}),x())};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.h_i,{children:(0,i.jsx)(o.FNi,{anchor:(0,i.jsx)(o.xuv,{width:"100%",justifyContent:"center",position:"absolute",bottom:64}),icon:"check",title:"Thanks for your feedback!",seconds:2,open:!!h,onOpenChange:e=>{e||p(void 0)}},h)}),(0,i.jsx)(o.FpX,{children:m&&(0,i.jsxs)(o.xuv,{flexDirection:"row",justifyContent:"end",gap:8,alignItems:"center",children:[(0,i.jsx)(o.xvT,{color:"grey11",children:"Did the AI get it right?"}),(0,i.jsxs)(o.xuv,{flexDirection:"row",gap:4,children:[(0,i.jsx)(o.ua7,{side:"bottom",sideOffset:4,variant:"text",content:"Looks good",children:(0,i.jsx)(o.hU,{variant:"solid",size:"small",icon:"thumbUp",onClick:v("up")})}),(0,i.jsx)(o.ua7,{side:"bottom",sideOffset:4,variant:"text",content:"Needs improvement",children:(0,i.jsx)(o.hU,{variant:"solid",size:"small",icon:"thumbDown",onClick:v("down")})})]})]})})]})}},76611:function(e,t,n){"use strict";n.d(t,{V:function(){return o}});var i=n(2784);function o(e,t,n){let{schema:o}=null!=n?n:{},r=()=>{try{let n=localStorage.getItem(e);if(null==n)return t;if(!o)return JSON.parse(n);return o.parse(JSON.parse(n))}catch(e){return t}},[l,s]=(0,i.useState)(r),[a,c]=(0,i.useState)(e);return a!==e&&(c(e),s(r())),[l,(0,i.useCallback)(n=>{s(i=>{let o;if(void 0===(o="function"==typeof n?n(i):n)){try{localStorage.removeItem(e)}catch(e){return i}return t}try{localStorage.setItem(e,JSON.stringify(o))}catch(e){return i}return o})},[e,t])]}},33986:function(e,t,n){"use strict";n.d(t,{z:function(){return a}});var i=n(52322),o=n(2784),r=n(75289);let l=(e,t)=>e?"".concat(e,"-").concat(t):"",s=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},a=(0,o.forwardRef)((e,t)=>{let{label:n,Icon:o,type:a,form:c,isLoading:d=!1,disabled:u=!1,onClick:f,sx:m={},iconSize:x=16,iconFill:h,variant:p="primary",...v}=e;return(0,i.jsx)(r.zx,{ref:t,sx:{...m,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...d?{cursor:"wait !important"}:{}},type:a,form:c,disabled:u||d,onClick:d?void 0:f,variant:p,...v,children:d?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.$j,{size:x,color:s(p),"data-testid":l(v["data-testid"],"spinner")}),o&&n]}):(0,i.jsxs)(i.Fragment,{children:[o&&(0,i.jsx)(o,{size:x,fill:h,"data-testid":l(v["data-testid"],"icon")}),n]})})})},46999:function(e,t,n){"use strict";n.d(t,{W:function(){return l}});var i=n(52322),o=n(63397);n(2784);var r=n(75289);let l=e=>{let{name:t,label:n,placeholder:l,error:s,testId:a,onChange:c}=e;return(0,i.jsxs)(r.xu,{mb:3,children:[(0,i.jsx)(r.__,{htmlFor:t,mb:2,children:n}),(0,i.jsx)(o.gN,{name:t,type:"text",placeholder:l,as:r.II,autoComplete:"off",...c?{onChange:c}:null,...a?{"data-testid":a}:null}),s?(0,i.jsx)(r.xv,{"data-testid":a?"".concat(a,"-error"):"input-error",sx:{color:"error",mt:1},children:s}):null]})}},59532:function(e,t,n){"use strict";var i=n(52322),o=n(63397),r=n(37149),l=n.n(r),s=n(75289),a=n(33986),c=n(55862),d=n(30527);function u(e){let{children:t}=e,n=(0,d.W)();return(0,i.jsx)(s.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:t})}t.Z=function(e){let{children:t,close:n,isOpen:r,formId:f,validate:m,onSubmit:x,widthInPx:h,initialValues:p,content:{title:v},cardProps:y,omitFooter:g=!1,isLoading:j=!1,buttonLabel:b="Save",testId:k,actionMessage:S}=e;return l().setAppElement("#__next"),(0,i.jsx)(c.Z,{isOpen:r,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:v,style:{content:{width:null!=h?h:"900px"}},children:(0,i.jsx)(o.J9,{initialValues:p,validate:e=>m?m(e):void 0,onSubmit:e=>{x(e)},children:e=>{let{isValid:r,isSubmitting:l,values:c,errors:m,touched:x,setFieldValue:h,setValues:p}=e;return(0,i.jsx)(o.l0,{id:f,...null!=k?{"data-testid":k}:null,children:(0,i.jsx)(d.Z,{borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"},...y,Header:(0,i.jsxs)(u,{children:[(0,i.jsx)(s.X6,{sx:{fontSize:"20px"},children:v}),(0,i.jsx)(s.x8,{type:"button",onClick:n})]}),Footer:g?null:(0,i.jsxs)(s.kC,{sx:{alignItems:"space-between"},children:[(0,i.jsx)(s.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof S?S(e):S}),(0,i.jsxs)(s.kC,{sx:{ml:"auto"},children:[(0,i.jsx)(s.zx,{mr:2,type:"button",onClick:n,variant:"secondary",disabled:l||j,children:"Cancel"}),(0,i.jsx)(a.z,{label:b,form:f,type:"submit",disabled:!r||l||j,isLoading:l||j,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:t({isValid:r,isSubmitting:l,values:c,errors:m,touched:x,setFieldValue:h,setValues:p})})})}})})}},31562:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Y}});var i=n(52322),o=n(7729),r=n(97729),l=n.n(r),s=n(5632),a=n(2784),c=n(56580),d=n(88932),u=n(65077),f=n(75289),m=n(43388),x=n(22654),h=n(63470),p=n(91589),v=n(27213),y=n(51507),g=n(27763),j=n(21442),b=n(51384),k=n(65186),S=n(59326),w=n(34166),C=n(80148);async function I(e){let{sliceName:t,sliceID:n,libraryID:i,sliceVariationIds:o,onSuccess:r}=e;try{let{errors:e}=await C.managerClient.slices.deleteSlice({libraryID:i,sliceID:n});if(e.length>0)throw e;o.forEach(e=>{(0,w.tB)({type:"model",library:i,sliceId:n,variationId:e})}),r(),d.Am.success("Successfully deleted slice “".concat(t,"”"))}catch(n){let e="An unexpected error happened while deleting slice “".concat(t,"”.");console.error(e,n),d.Am.error(e)}}var L=n(68968),E=n(33986),O=n(30527),A=n(55862),N=n(54597);let R=e=>{var t;let{isOpen:n,libName:o,sliceId:r,sliceName:l,sliceVariationIds:s,onClose:c}=e,[d,u]=(0,a.useState)(!1),{deleteSliceSuccess:m}=(0,N.Z)(),{syncChanges:x}=(0,L.g)(),{theme:h}=(0,S.B7)(),p=async()=>{u(!0),await I({libraryID:o,sliceID:r,sliceName:l,sliceVariationIds:s,onSuccess:()=>{m(r,o),x()}}),c(),u(!1)};return(0,i.jsx)(A.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:c,children:(0,i.jsx)(O.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},borderFooter:!0,Header:(0,i.jsxs)(f.kC,{sx:{position:"sticky",background:"gray",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,i.jsxs)(f.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(k.$vK,{size:20,color:null===(t=h.colors)||void 0===t?void 0:t.greyIcon}),(0,i.jsx)(f.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,i.jsx)(f.x8,{type:"button",onClick:c})]}),Footer:()=>(0,i.jsxs)(f.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorders))},backgroundColor:"gray"},children:[(0,i.jsx)(E.z,{label:"Cancel",variant:"secondary",onClick:c,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,i.jsx)(E.z,{label:"Delete",variant:"danger",isLoading:d,sx:{minHeight:39,minWidth:78},onClick:()=>{p()}})]}),children:(0,i.jsxs)(f.nv,{children:["This action will immediately make the following changes:",(0,i.jsxs)("ul",{children:[(0,i.jsxs)("li",{children:["Delete the"," ",(0,i.jsxs)(f.xv,{sx:{fontWeight:"bold"},children:[o,"/",l,"/"]})," ","directory."]}),(0,i.jsx)("li",{children:"Remove the Slice from all Slice Zones that use it."})]}),"The next time you push your changes to Prismic, the following change will happen:",(0,i.jsx)("ul",{children:(0,i.jsx)("li",{children:"Remove the Slice from the list of available Slices to use in the Page Builder."})}),"You will need to manually remove the Slice from any Pages that currently use it."]})})})};var z=n(36887),_=n(94160),D=e=>{let{title:t,onCreateNew:n,buttonText:o,documentationComponent:r,videoPublicIdUrl:l,...s}=e;return(0,i.jsxs)(f.xu,{sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"},...s,children:[(0,i.jsx)(f.xu,{sx:e=>{var t;return{display:"flex",flex:1,alignItems:"center",minWidth:"400px",maxWidth:"70%",border:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02)}},children:(0,i.jsx)(z.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:l,onPlay:()=>{_.Xe.track({event:"open-video-tutorials",video:l})}})}),(0,i.jsxs)(f.xu,{sx:e=>{var t;return{bg:"white",display:"flex",flexDirection:"column",border:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02),flex:1,minWidth:"400px",maxWidth:"70%"}},children:[(0,i.jsxs)(f.xu,{sx:e=>{var t;return{display:"flex",flexDirection:"column",p:4,borderBottom:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02)}},children:[(0,i.jsx)(f.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:t}),(0,i.jsx)(f.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:r})]}),(0,i.jsxs)(f.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,i.jsx)(f.zx,{onClick:n,"data-testid":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:o}),(0,i.jsx)(f.xv,{sx:{fontSize:"12px",color:"grey04",maxWidth:"280px"},children:"It will be stored locally and you will be able to push it to your repository"})]})]})]})},W=n(6256),F=n(63908),P=n(26109);async function T(e){let{slice:t,newSliceName:n,onSuccess:i}=e;try{let e=(0,F.PQ)(t,n),{errors:o}=await C.managerClient.slices.renameSlice({libraryID:t.from,model:P.id.fromSM(e.model)});if(o.length>0)throw o;i(e),d.Am.success("Slice name updated")}catch(n){let e="An unexpected error happened while renaming “".concat(t.model.name,"”.");console.error(e,n),d.Am.error(e)}}var Z=n(7723),B=n(59532),K=n(46999),X=n(63019);let H=e=>{var t,n;let{slice:o,isOpen:r,onClose:l}=e,{renameSliceSuccess:s}=(0,N.Z)(),{syncChanges:a}=(0,L.g)(),{localLibs:d,remoteLibs:u}=(0,c.v9)(e=>({localLibs:(0,Z.Sd)(e),remoteLibs:(0,Z.sT)(e)})),m=null!==(t=null==o?void 0:o.model.name)&&void 0!==t?t:"",x=async e=>{o&&(await T({slice:o,newSliceName:e.sliceName,onSuccess:e=>{s(e.from,e.model),a()}}),l())};return(0,i.jsx)(B.Z,{testId:"rename-slice-modal",isOpen:r,widthInPx:"530px",formId:"rename-slice-modal-".concat(null!==(n=null==o?void 0:o.model.id)&&void 0!==n?n:""),close:l,buttonLabel:"Rename",onSubmit:e=>void x(e),initialValues:{sliceName:m},content:{title:"Rename a slice"},validate:e=>(0,X.h)(e,d,u),children:e=>{let{touched:t,errors:n}=e;return(0,i.jsx)(f.xu,{children:(0,i.jsx)(K.W,{name:"sliceName",label:"Slice Name","data-testid":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:t.sliceName?n.sliceName:void 0,testId:"slice-name-input"})})}})};var U=n(21151),V=n(68105),M=n(39204),J=n(7974),q=n(31860),Y=()=>{var e,t,n,r;let k=(0,x.l)(),S=(0,s.useRouter)(),{modalPayload:w,onOpenModal:I}=(0,j.H)(),{openLoginModal:L}=(0,N.Z)(),E=(0,h.k)(),O=(0,v.F)({menuType:"Dropdown",sectionsNamingExperiment:E}),{sliceFilterFn:A,defaultVariationSelector:z}=w,{remoteSlices:_,libraries:F}=(0,c.v9)(e=>({remoteSlices:(0,Z.sT)(e),libraries:(0,Z.Sd)(e)})),[P,T]=(0,a.useState)(!1),[B,K]=(0,a.useState)(!1),[X,Y]=(0,a.useState)(!1),[$,G]=(0,a.useState)(!1),Q=F.filter(e=>e.isLocal),ee=F.map(e=>(e.components=[...e.components].sort((e,t)=>e.model.name.localeCompare(t.model.name)),e)),et=(F||[]).map(e=>e.components).flat(),en=et.length,[ei,eo]=(0,a.useState)(),er=()=>{K(!0)},el=()=>{Y(!0)},es=async()=>{await C.managerClient.user.checkIsLoggedIn()?G(!0):L()},ea=()=>{G(!1)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l(),{children:(0,i.jsxs)("title",{children:[(0,q._)((0,q.f)(E.value))," - Slice Machine"]})}),(0,i.jsxs)(b.LN,{children:[(0,i.jsxs)(b.wd,{children:[(0,i.jsx)(b.Cx,{children:(0,i.jsx)(m.g,{children:(0,q._)((0,q.f)(E.value))})}),(null==Q?void 0:Q.length)!==0&&0!==en?(0,i.jsxs)(o.h_2,{children:[(0,i.jsx)(o.$FS,{children:(0,i.jsx)(o.zxk,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,i.jsxs)(o.AWV,{align:"end",children:[k.eligible&&(0,i.jsx)(o.Xiv,{renderStartIcon:()=>O.fromImage.BackgroundIcon,onSelect:()=>void es(),description:O.fromImage.description,children:O.fromImage.title}),(0,i.jsx)(o.Xiv,{renderStartIcon:()=>O.fromScratch.BackgroundIcon,onSelect:()=>T(!0),description:O.fromScratch.description,children:O.fromScratch.title})]})]}):void 0]}),(0,i.jsxs)(b.RN,{children:[(0,i.jsx)(u.xR,{sx:{display:"flex",flexDirection:"column"},children:ee.length>0?(0,i.jsx)(f.kC,{sx:{flex:1,flexDirection:"column"},children:0===en?(0,i.jsx)(f.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,i.jsx)(D,{title:"What are ".concat((0,q._)(E.value),"?"),onCreateNew:()=>{T(!0)},buttonText:"Create one",videoPublicIdUrl:J.rd,documentationComponent:(0,i.jsxs)(i.Fragment,{children:[(0,q._)((0,q.f)(E.value))," ",'are sections of your website. Prismic documents contain a dynamic "',(0,q.f)(E.value)," ",'Zone" that allows content creators to add, edit, and rearrange ',(0,q._)(E.value)," ","to compose dynamic layouts for any page design."," ",(0,i.jsx)(f.rU,{target:"_blank",href:"https://prismic.io/docs/core-concepts/slices",sx:e=>{var t;return{color:null==e?void 0:null===(t=e.colors)||void 0===t?void 0:t.primary}},children:"Learn more"}),"."]}),"data-testid":"slices-table-blank-slate"})}):ee.map(e=>{let{name:t,isLocal:n,components:o}=e;return(0,i.jsxs)(f.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,i.jsxs)(f.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)(f.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,i.jsx)(f.xv,{children:E.eligible&&1===ee.length?"Your ".concat((0,q._)(E.value)):t})}),!n&&(0,i.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,i.jsx)(U.Z,{elems:o,defineElementKey:e=>e.model.name,renderElem:e=>(0,i.jsx)(y.b,{action:{type:"menu",onRemove:()=>{eo(e),er()},onRename:()=>{eo(e),el()}},mode:"navigation",onUpdateScreenshot:()=>{I({sliceFilterFn:t=>t.filter(t=>t.model.id===e.model.id)})},slice:e,variant:"solid"}),gridGap:"32px 16px"})]},t)})}):void 0}),(null==Q?void 0:Q.length)>0&&(0,i.jsx)(V.Z,{slices:A(et),defaultVariationSelector:z}),(null==Q?void 0:Q.length)>0&&P&&(0,i.jsx)(W.c,{localLibraries:Q,location:"slices",remoteSlices:_,onSuccess:(e,t)=>{let n=e.variations[0].id,i=g.Y.getBuilderPagePathname({libraryName:t,sliceName:e.name,variationId:n});S.push(i),d.Am.success((0,M.kQ)({sectionsNamingExperiment:E,path:"".concat(t,"/").concat(e.name,"/model.json")}))},onClose:()=>{T(!1)}}),(0,i.jsx)(H,{isOpen:X,slice:ei,onClose:()=>{Y(!1)},"data-testid":"rename-slice-modal"}),(0,i.jsx)(R,{isOpen:B,libName:null!==(e=null==ei?void 0:ei.from)&&void 0!==e?e:"",sliceId:null!==(t=null==ei?void 0:ei.model.id)&&void 0!==t?t:"",sliceName:null!==(n=null==ei?void 0:ei.model.name)&&void 0!==n?n:"",sliceVariationIds:(null!==(r=null==ei?void 0:ei.model.variations)&&void 0!==r?r:[]).map(e=>e.id),onClose:()=>{K(!1)}}),(0,i.jsx)(p.S,{open:$,location:"slices",onSuccess:e=>{let{library:t}=e;d.Am.success((0,i.jsx)(M.GX,{message:"".concat((0,q.f)(E.value),"(s) added to ").concat(E.value," zone and created at: "),path:t})),ea()},onClose:ea})]})]})]})}},5683:function(e,t,n){"use strict";n.d(t,{i:function(){return r},v:function(){return o}});let i=e=>"slice-machine_".concat(e),o=i("staticFieldsInfoDialogDismissed");function r(e){let{type:t,library:n,sliceId:o,variationId:r}=e;return i(["ai-feedback",t,n,o,r].join("#"))}},76473:function(e,t,n){"use strict";n.d(t,{y1:function(){return j}});var i=n(2784);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}n(52322);var r=["shift","alt","meta","mod","ctrl"],l={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function s(e){return(l[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function a(e,t){return void 0===t&&(t=","),e.split(t)}function c(e,t,n){void 0===t&&(t="+");var i=e.toLocaleLowerCase().split(t).map(function(e){return s(e)}),l={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod")},a=i.filter(function(e){return!r.includes(e)});return o({},l,{keys:a,description:n})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([s(e.key),s(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&m([s(e.key),s(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){d.clear()});var d=new Set;function u(e){return Array.isArray(e)}function f(e){var t=Array.isArray(e)?e:[e];d.has("meta")&&d.forEach(function(e){return!r.includes(e)&&d.delete(e.toLowerCase())}),t.forEach(function(e){return d.add(e.toLowerCase())})}function m(e){var t=Array.isArray(e)?e:[e];"meta"===e?d.clear():t.forEach(function(e){return d.delete(e.toLowerCase())})}function x(e,t){var n=e.target;void 0===t&&(t=!1);var i=n&&n.tagName;return u(t)?!!(i&&t&&t.some(function(e){return e.toLowerCase()===i.toLowerCase()})):!!(i&&t&&!0===t)}var h=function(e,t,n){void 0===n&&(n=!1);var i,o=t.alt,r=t.meta,l=t.mod,a=t.shift,c=t.ctrl,f=t.keys,m=e.key,x=e.code,h=e.ctrlKey,p=e.metaKey,v=e.shiftKey,y=e.altKey,g=s(x),j=m.toLowerCase();if(!n){if(!y===o&&"alt"!==j||!v===a&&"shift"!==j)return!1;if(l){if(!p&&!h)return!1}else if(!p===r&&"meta"!==j&&"os"!==j||!h===c&&"ctrl"!==j&&"control"!==j)return!1}return!!(f&&1===f.length&&(f.includes(j)||f.includes(g)))||(f?(void 0===i&&(i=","),(u(f)?f:f.split(i)).every(function(e){return d.has(e.trim().toLowerCase())})):!f)},p=(0,i.createContext)(void 0),v=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},g="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function j(e,t,n,o){var r,l=(0,i.useRef)(null),d=(0,i.useRef)(!1),j=n instanceof Array?o instanceof Array?void 0:o:n,b=u(e)?e.join(null==j?void 0:j.splitKey):e,k=n instanceof Array?n:o instanceof Array?o:void 0,S=(0,i.useCallback)(t,null!=k?k:[]),w=(0,i.useRef)(S);k?w.current=S:w.current=t;var C=(!function e(t,n){return t&&n&&"object"==typeof t&&"object"==typeof n?Object.keys(t).length===Object.keys(n).length&&Object.keys(t).reduce(function(i,o){return i&&e(t[o],n[o])},!0):t===n}((r=(0,i.useRef)(void 0)).current,j)&&(r.current=j),r.current),I=(0,i.useContext)(v).enabledScopes,L=(0,i.useContext)(p);return g(function(){if((null==C?void 0:C.enabled)!==!1&&(e=null==C?void 0:C.scopes,0===I.length&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!e||I.some(function(t){return e.includes(t)})||I.includes("*")))){var e,t=function(e,t){var n;if(void 0===t&&(t=!1),!(x(e,["input","textarea","select"])&&!x(e,null==C?void 0:C.enableOnFormTags)||null!=C&&null!=C.ignoreEventWhen&&C.ignoreEventWhen(e))){if(null!==l.current&&document.activeElement!==l.current&&!l.current.contains(document.activeElement)){y(e);return}(null==(n=e.target)||!n.isContentEditable||null!=C&&C.enableOnContentEditable)&&a(b,null==C?void 0:C.splitKey).forEach(function(n){var i,o,r,l=c(n,null==C?void 0:C.combinationKey);if(h(e,l,null==C?void 0:C.ignoreModifiers)||null!=(r=l.keys)&&r.includes("*")){if(t&&d.current)return;if(("function"==typeof(i=null==C?void 0:C.preventDefault)&&i(e,l)||!0===i)&&e.preventDefault(),"function"==typeof(o=null==C?void 0:C.enabled)?!o(e,l):!0!==o&&void 0!==o){y(e);return}w.current(e,l),t||(d.current=!0)}})}},n=function(e){void 0!==e.key&&(f(s(e.code)),((null==C?void 0:C.keydown)===void 0&&(null==C?void 0:C.keyup)!==!0||null!=C&&C.keydown)&&t(e))},i=function(e){void 0!==e.key&&(m(s(e.code)),d.current=!1,null!=C&&C.keyup&&t(e,!0))},o=l.current||(null==j?void 0:j.document)||document;return o.addEventListener("keyup",i),o.addEventListener("keydown",n),L&&a(b,null==C?void 0:C.splitKey).forEach(function(e){return L.addHotkey(c(e,null==C?void 0:C.combinationKey,null==C?void 0:C.description))}),function(){o.removeEventListener("keyup",i),o.removeEventListener("keydown",n),L&&a(b,null==C?void 0:C.splitKey).forEach(function(e){return L.removeHotkey(c(e,null==C?void 0:C.combinationKey,null==C?void 0:C.description))})}}},[b,C,I]),l}}},function(e){e.O(0,[898,789,397,44,34,658,268,888,774,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);
|