slice-machine-ui 1.22.2-beta.1 → 1.22.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/components/AppLayout/index.tsx +8 -4
- package/components/Navigation/ChangesListItem.tsx +1 -1
- package/components/Navigation/Environment.tsx +8 -7
- package/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +1 -1
- package/lib/builders/SliceBuilder/Sidebar/index.tsx +1 -1
- package/lib/builders/SliceBuilder/SimulatorButton/index.tsx +2 -2
- package/lib/builders/common/Zone/components/EmptyState/index.tsx +1 -1
- package/lib/builders/common/Zone/index.jsx +1 -1
- package/out/404.html +1 -1
- package/out/_next/static/bgAW-O9SejtbtaQ7v0wB1/_buildManifest.js +1 -0
- package/out/_next/static/chunks/18539003-4460ccbfe3109578.js +97 -0
- package/out/_next/static/chunks/482-34cee2a2071c235f.js +1 -0
- package/out/_next/static/chunks/{505-fa47e200ac3a012d.js → 505-3f1cf09a086dcba8.js} +1 -1
- package/out/_next/static/chunks/550-c80fd46fb64d1eef.js +1 -0
- package/out/_next/static/chunks/{840-45aefe7b4d84745c.js → 840-163f8a1040e6820d.js} +1 -1
- package/out/_next/static/chunks/904-519dbf0f7e8c6243.js +1 -0
- package/out/_next/static/chunks/{958-0a6a103fac00582b.js → 958-8aca174b80cb0c35.js} +1 -1
- package/out/_next/static/chunks/pages/_app-36b2c828e330d9c7.js +458 -0
- package/out/_next/static/chunks/pages/{changelog-cfda9d30715b6e2a.js → changelog-4d0f2f1222e403fe.js} +1 -1
- package/out/_next/static/chunks/pages/{changes-a3cdb6251b224e4b.js → changes-52c9d917808d1461.js} +1 -1
- package/out/_next/static/chunks/pages/{labs-dfad3c3553469739.js → labs-526bb7d60a1b90f4.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-ef11594ce026b650.js +1 -0
- package/out/_next/static/chunks/pages/{slices-dc4f17b54c9a3eb5.js → slices-884a936a9a062a65.js} +1 -1
- package/out/_next/static/css/{7ef90ba762e84cee.css → 1bbf650dfd37ce69.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/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 +7 -6
- package/src/components/BlankSlate/BlankSlate.css.ts +4 -1
- package/src/components/BlankSlate/BlankSlate.tsx +2 -7
- package/src/components/Card/Card.stories.tsx +3 -3
- package/src/components/HoverCard/HoverCard.css.ts +0 -9
- package/src/components/HoverCard/HoverCard.stories.tsx +3 -3
- package/src/components/HoverCard/HoverCard.tsx +1 -1
- package/src/components/List/List.stories.tsx +2 -2
- package/src/components/PageLayout/PageLayout.css.ts +6 -12
- package/src/components/PageLayout/PageLayout.tsx +6 -6
- package/src/components/SideNav/SideNavEnvironmentSelector.tsx +36 -7
- package/src/components/Window/Window.tsx +1 -1
- package/src/features/customTypes/EditDropdown.tsx +7 -5
- package/src/features/customTypes/customTypesBuilder/PageSnippetDialog/PageSnippetDialog.tsx +2 -2
- package/src/features/environments/actions/getActiveEnvironment.ts +34 -0
- package/src/features/environments/actions/getEnvironments.ts +5 -2
- package/src/features/environments/actions/setEnvironment.ts +2 -2
- package/src/features/environments/useActiveEnvironment.ts +2 -33
- package/src/features/inAppGuide/InAppGuideDialog.tsx +1 -7
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +1 -1
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +1 -1
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx +1 -1
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceMergeWithIdenticalDialog.tsx +1 -1
- package/src/features/slices/sliceBuilder/FloatingBackButton.tsx +1 -1
- package/src/features/slices/sliceCards/SharedSliceCard.tsx +2 -2
- package/out/_next/static/ALrNHXPZGeRwEXHdmh5-C/_buildManifest.js +0 -1
- package/out/_next/static/chunks/18539003-9f66499125869c64.js +0 -97
- package/out/_next/static/chunks/482-7e97f91961588a90.js +0 -1
- package/out/_next/static/chunks/550-8557ad3750e1e581.js +0 -1
- package/out/_next/static/chunks/904-e7c8c1ba265177fb.js +0 -1
- package/out/_next/static/chunks/pages/_app-cae1327f33c96711.js +0 -447
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-c228a7c42e87eb27.js +0 -1
- package/src/features/environments/actions/getActiveEnvironmentDomain.ts +0 -11
- /package/out/_next/static/{ALrNHXPZGeRwEXHdmh5-C → bgAW-O9SejtbtaQ7v0wB1}/_ssgManifest.js +0 -0
package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-c228a7c42e87eb27.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[136],{31314:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]",function(){return t(47914)}])},47914:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ej}});var i=t(52322),r=t(97729),o=t.n(r),a=t(22715),l=t(2784),s=t(40432),c=t(47560),u=t(38876),d=t(8482),f=t(4092),m=t(2353),v=t(44384),p=t(28173),h=t(90374),x=t(53559),y=function(e){var n=e.variation,t=(0,h.Z)(),r=t.addSliceWidget,o=t.replaceSliceWidget,a=t.reorderSliceWidget,l=t.removeSliceWidget,s=t.updateSliceWidgetMock,y=t.deleteSliceWidgetMock,g=function(e){return function(t){y(n.id,e,t),l(n.id,e,t)}},b=function(e){return function(t){var i=t.apiId,r=t.newKey,a=t.value,l=t.mockValue;l?s(n.id,e,i,r,l):y(n.id,e,r),o(n.id,e,i,r,a)}},j=function(e){return function(t){var i=t.id,o=t.label,a=t.widgetTypeName,l=m[a];l||console.log('Could not find widget with type name "'.concat(a,'". Please contact us!')),r(n.id,e,i,l.create(o))}},S=function(e){return function(t){var i,r;(0,c.uS)(t)||a(n.id,e,t.source.index,null!==(r=null===(i=t.destination)||void 0===i?void 0:i.index)&&void 0!==r?r:void 0)}};return(0,i.jsxs)(p.aV,{children:[(0,i.jsx)(d.Z,{zoneType:"slice",tabId:void 0,title:"Non-Repeatable Zone",dataTip:" The non-repeatable zone\n is for fields<br/> that should appear once, like a<br/>\n section title.\n",fields:n.primary,EditModal:f.Z,widgetsArray:v.Z,onDeleteItem:g(x.Rt.Primary),onSave:b(x.Rt.Primary),onSaveNewField:j(x.Rt.Primary),onDragEnd:S(x.Rt.Primary),poolOfFieldsToCheck:n.primary||[],renderHintBase:function(e){var n=e.item;return"slice.primary".concat((0,u.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.primary".concat((0,u.Ti)(e))},dataCy:"slice-non-repeatable-zone",isRepeatableCustomType:void 0}),(0,i.jsx)(d.Z,{zoneType:"slice",tabId:void 0,isRepeatable:!0,title:"Repeatable Zone",dataTip:"The repeatable zone is for a group<br/>\n of fields that you want to be able to repeat an<br/>\n indeterminate number of times, like FAQs",widgetsArray:v.Z,fields:n.items,EditModal:f.Z,onDeleteItem:g(x.Rt.Items),onSave:b(x.Rt.Items),onSaveNewField:j(x.Rt.Items),onDragEnd:S(x.Rt.Items),poolOfFieldsToCheck:n.items||[],renderHintBase:function(e){var n=e.item;return"item".concat((0,u.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.items[i]".concat((0,u.Ti)(e))},dataCy:"slice-repeatable-zone",isRepeatableCustomType:void 0})]})},g=t(62230),b=t(85244),j=t(81541),S=t(5632),w=t(22710),C=t(99267),k=t(55658),Z=t(63397),I=t(25812),T=t(75289),E=t(54132),R=function(e){var n=e.children,t=e.FooterContent,r=e.HeaderContent,o=e.close,a=e.sx,l=e.headerSx,s=void 0===l?{}:l;return(0,i.jsx)(E.Z,{borderFooter:!0,footerSx:{p:0},bodySx:{pt:2,pb:4,px:4},sx:(0,g.Z)({border:"none"},void 0===a?{}:a),Header:function(e){var n=e.radius;return(0,i.jsxs)(T.kC,{sx:(0,g.Z)({p:3,pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},s),children:[r,o?(0,i.jsx)(T.x8,{onClick:o,type:"button"}):null]})},Footer:t?(0,i.jsxs)(T.kC,{sx:{alignItems:"space-between",bg:"headSection",p:3},children:[(0,i.jsx)(T.xu,{sx:{ml:"auto"}}),t]}):null,children:n})},A=t(36131),N=function(e){var n=e.msg;return(0,i.jsx)(T.xv,{as:"span",sx:{fontSize:12,color:"error",mt:"5px",ml:2},children:n||"Error!"})},L=function(e){var n=e.isOpen,t=e.onClose,r=e.onSubmit,o=e.initialVariation,a=e.variations,s=function(e){var n=e.id,t=e.name,i=e.origin,r=n&&n.length?null:{id:"Required!"},o=a.find(function(e){return e.id===n})?{id:"This id already exists!"}:null,l=t&&t.length?null:{name:"Required!"},s=i.value.length&&a.find(function(e){return e.id===i.value})?null:{id:"You must select an existing variation!"},c=n&&n.length&&!/^[A-Za-z0-9]+([A-Za-z0-9]+)*$/.exec(n)&&{id:"No special characters allowed"};return(0,g.Z)({},r,o,l,s,c)},c=function(e){j(k.e.generateId(e))},u=function(e){O(e),E&&c(e)},d=function(e){L(!1),c(e)},f=function(){m(),t()},m=function(){j(""),O(""),h({}),L(!0),F({value:o.id,label:o.name})},v=(0,l.useState)({}),p=v[0],h=v[1],x=(0,l.useState)(""),y=x[0],j=x[1],S=(0,l.useState)(!0),E=S[0],L=S[1],V=(0,l.useState)(""),_=V[0],O=V[1],D=(0,l.useState)({value:o.id,label:o.name}),B=D[0],F=D[1];function z(){return P.apply(this,arguments)}function P(){return(P=(0,w.Z)(function(){var e,n;return(0,C.__generator)(this,function(t){return Object.keys(e=s({id:y,name:_,origin:B})).length?h(e):(n=a.find(function(e){return e.id===B.value}))&&(r(y,_,n),f()),[2]})})).apply(this,arguments)}return(0,l.useEffect)(function(){m()},[o,n]),(0,i.jsx)(I.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,onRequestClose:function(){return f()},contentLabel:"Widget Form Modal",style:{content:{maxWidth:"700px"}},children:(0,i.jsx)(Z.J9,{initialValues:{id:y,name:_,origin:B},onSubmit:z,children:(0,i.jsx)(Z.l0,{id:"variation-add",onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),z())},children:(0,i.jsx)(T.xu,{children:(0,i.jsxs)(R,{sx:{textAlign:"left"},HeaderContent:(0,i.jsx)(T.xv,{as:"h2",children:"Add new Variation"}),FooterContent:(0,i.jsxs)(T.kC,{sx:{justifyContent:"flex-end"},children:[(0,i.jsx)(T.zx,{onClick:f,mr:2,variant:"secondary",children:"Cancel"}),(0,i.jsx)(T.zx,{type:"submit",children:"Submit"})]}),close:f,children:[(0,i.jsxs)(T.xu,{sx:{pb:4,mt:4},children:[(0,i.jsxs)(T.__,{htmlFor:"name",sx:{mb:1},children:["Variation name*",p.name?(0,i.jsx)(N,{msg:p.name}):""]}),(0,i.jsx)(Z.gN,{autoComplete:"off",id:"name",name:"name",placeholder:"e.g. Grid - With Icon",as:T.II,maxLength:30,value:_,onChange:function(e){return u(e.currentTarget.value)}}),(0,i.jsx)(T.xv,{children:"It will appear here in Slice Machine, and in the page editor in Prismic"})]}),(0,i.jsxs)(T.xu,{sx:{pb:4},children:[(0,i.jsxs)(T.__,{htmlFor:"id",sx:{mb:1},children:["Variation ID*",p.id?(0,i.jsx)(N,{msg:p.id}):""]}),(0,i.jsx)(Z.gN,{autoComplete:"off",id:"id",name:"id",placeholder:"e.g. GridWithIcon",as:T.II,maxLength:30,value:y,onChange:function(e){return d(e.currentTarget.value)}}),(0,i.jsx)(T.xv,{children:"It's generated automatically based on the variation name and will appear in the API responses."})]}),(0,i.jsxs)(T.xu,{sx:{pb:4},children:[(0,i.jsx)(T.__,{htmlFor:"origin",sx:{mb:1},children:"Duplicate from"}),(0,i.jsx)(A.ZP,{name:"origin",options:a.map(function(e){return{value:e.id,label:e.name}}),onChange:function(e){e&&F(e)},defaultValue:B,maxMenuHeight:150,theme:function(e){return(0,b.Z)((0,g.Z)({},e),{colors:(0,b.Z)((0,g.Z)({},e.colors),{text:"text",primary:"background"})})}})]})]})})})})})},V=t(13858),_=t(82770),O=t(49451);function D(){return(D=(0,w.Z)(function(e){var n,t,i,r,o,a,l,s,c,u,d,f;return(0,C.__generator)(this,function(n){switch(n.label){case 0:e.setSliceBuilderState({loading:!0,done:!1}),n.label=1;case 1:return n.trys.push([1,7,,8]),[4,(0,_.Ve)(e.component)];case 2:if((t=n.sent().errors).length>0)throw t;return[4,(0,_.Xi)({libraryID:e.component.from,sliceID:e.component.model.id,variationID:e.variation.id})];case 3:if((r=n.sent().errors).length>0)throw r;return[4,(0,_.X$)(e.component.from,e.component.model.id)];case 4:if(a=(o=n.sent()).slice,(l=o.errors).length>0)throw l;if(!a)throw Error("Could not read variation `".concat(e.variation.name,"`"));return[4,(0,_.pL)({libraryID:e.component.from,sliceID:e.component.model.id})];case 5:return s=n.sent().mocks,c=O.Y.getBuilderPagePathname({libraryName:e.component.href,sliceName:a.name,variationId:a.variations[0].id}),[4,e.router.replace(c)];case 6:return n.sent(),e.updateAndSaveSlice((0,b.Z)((0,g.Z)({},e.component),{model:a,mocks:s})),u="".concat(e.component.from,"/").concat(e.component.model.name,"/model.json"),e.setSliceBuilderState({loading:!1,done:!0,error:!1,message:(0,V.kQ)({path:u})}),[3,8];case 7:throw d=n.sent(),f="Could not delete variation `".concat(e.variation.name,"`"),console.error(f,d),e.setSliceBuilderState({loading:!1,done:!0,error:!0,message:f}),d;case 8:return[2]}})})).apply(this,arguments)}var B=function(e){var n=e.isOpen,t=e.onClose,r=e.slice,o=e.variation,l=e.sliceBuilderState,s=e.setSliceBuilderState,c=(0,S.useRouter)(),u=(0,h.Z)().updateAndSaveSlice;return(0,i.jsxs)(a.Vq,{open:n,onOpenChange:function(e){return!e&&t()},size:{width:448,height:"auto"},children:[(0,i.jsx)(a.fK,{icon:"delete",title:"Delete variation"}),(0,i.jsx)(a.cZ,{children:(0,i.jsxs)(a.xu,{flexDirection:"column",children:[(0,i.jsxs)(a.xv,{color:"grey11",sx:{marginBlock:16,marginInline:16},children:["This action will remove the variation from the slice model and delete associated files. When you push your changes, the variation will disappear from your repository. This update will"," ",(0,i.jsx)(F,{children:"not"})," affect your documents until you ",(0,i.jsx)(F,{children:"edit"})," ","them manually."]}),(0,i.jsx)(a.kX,{ok:{text:"Delete",onClick:function(){o&&(0,w.Z)(function(){return(0,C.__generator)(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,function(e){return D.apply(this,arguments)}({component:r,router:c,setSliceBuilderState:s,updateAndSaveSlice:u,variation:o})];case 1:case 2:return e.sent(),[3,3];case 3:return t(),[2]}})})()},loading:l.loading},cancel:{text:"Cancel"},size:"medium"})]})})]})},F=function(e){return(0,i.jsx)(a.xv,(0,b.Z)((0,g.Z)({},e),{color:"inherit",component:"span",variant:"bold"}))};function z(){return(z=(0,w.Z)(function(e){var n,t,i,r,o,a,l,s,c,u,d;return(0,C.__generator)(this,function(n){switch(n.label){case 0:e.setSliceBuilderState({loading:!0,done:!1}),n.label=1;case 1:return n.trys.push([1,6,,7]),[4,(0,_.Ve)(e.component)];case 2:if((t=n.sent().errors).length>0)throw t;return[4,(0,_.eH)(e.component,(0,b.Z)((0,g.Z)({},e.variation),{name:e.variationName}))];case 3:if((r=n.sent().errors).length>0)throw r;return[4,(0,_.X$)(e.component.from,e.component.model.id)];case 4:if(a=(o=n.sent()).slice,(l=o.errors).length>0)throw l;if(!a)throw Error("Could not read variation `".concat(e.variation.name,"`"));return[4,(0,_.pL)({libraryID:e.component.from,sliceID:e.component.model.id})];case 5:return s=n.sent().mocks,e.updateAndSaveSlice((0,b.Z)((0,g.Z)({},e.component),{model:a,mocks:s})),c="".concat(e.component.from,"/").concat(e.component.model.name,"/model.json"),e.setSliceBuilderState({loading:!1,done:!0,error:!1,message:(0,V.kQ)({path:c})}),[3,7];case 6:throw u=n.sent(),d="Could not rename variation `".concat(e.variation.name,"`"),console.error(d,u),e.setSliceBuilderState({loading:!1,done:!0,error:!0,message:d}),u;case 7:return[2]}})})).apply(this,arguments)}var P=function(e){var n,t,r=e.isOpen,o=e.onClose,l=e.slice,s=e.variation,c=e.sliceBuilderState,u=e.setSliceBuilderState,d=(0,h.Z)().updateAndSaveSlice;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(a.Vq,{open:r,onOpenChange:function(e){return!e&&o()},size:{width:448,height:"auto"},children:[(0,i.jsx)(a.fK,{icon:"edit",title:"Rename variation"}),(0,i.jsx)(a.cZ,{children:(0,i.jsx)(Z.J9,{validateOnChange:!0,validateOnMount:!0,initialValues:{variationName:null!==(n=null==s?void 0:s.name)&&void 0!==n?n:""},validate:function(e){if(0===e.variationName.length)return{variationName:"Cannot be empty"}},onSubmit:(t=(0,w.Z)(function(e){return(0,C.__generator)(this,function(n){switch(n.label){case 0:if(!s)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,function(e){return z.apply(this,arguments)}({component:l,setSliceBuilderState:u,updateAndSaveSlice:d,variation:s,variationName:e.variationName.trim()})];case 2:case 3:return n.sent(),[3,4];case 4:return o(),[2]}})}),function(e){return t.apply(this,arguments)}),children:function(e){return(0,i.jsxs)("form",{children:[(0,i.jsxs)(a.xu,{flexDirection:"column",gap:8,padding:16,children:[(0,i.jsx)(a.xv,{variant:"normal",color:"grey11",children:"This action will rename the variation in the slice model. When you push your changes, the variation will be renamed in your repository."}),(0,i.jsxs)(a.xu,{flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:"_1ecs97dez4 _1ecs97dez8 _1ecs97df90",children:[(0,i.jsx)(a.xv,{variant:"bold",children:"Variation name*"}),"string"==typeof e.errors.variationName?(0,i.jsx)(a.xv,{variant:"small",color:"tomato10",children:e.errors.variationName}):null]}),(0,i.jsx)(a.yt,{placeholder:"Variation name",error:"string"==typeof e.errors.variationName,value:e.values.variationName,onValueChange:function(n){e.setFieldValue("variationName",n.slice(0,30))}})]})]}),(0,i.jsx)(a.kX,{ok:{text:"Rename",onClick:function(){e.submitForm()},loading:c.loading,disabled:!e.isValid},cancel:{text:"Cancel"},size:"medium"})]})}})})]})})},M=t(84449),K=t(65958),H=t(47731),W=function(e){var n=e.slice,t=e.variation,r=e.sliceBuilderState,o=e.setSliceBuilderState,s=(0,l.useState)(),c=s[0],u=s[1],d=(0,H.H)(),f=d.modalPayload,m=f.sliceFilterFn,v=f.defaultVariationSelector,p=(0,h.Z)(),x=p.copyVariationSlice,y=p.updateSlice,w=(0,S.useRouter)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(a.xu,{flexDirection:"column",gap:16,children:[n.model.variations.map(function(e){return(0,i.jsx)(K.b,{action:{type:"menu",onRename:function(){u({type:"RENAME_VARIATION",variation:e})},onRemove:function(){u({type:"DELETE_VARIATION",variation:e})},removeDisabled:n.model.variations.length<=1},mode:"navigation",onUpdateScreenshot:function(){d.onOpenModal({sliceFilterFn:function(e){return e},defaultVariationSelector:{sliceID:n.model.id,variationID:e.id}})},replace:!0,selected:e.id===t.id,slice:n,variant:"outlined",variationId:e.id},e.id)}),(0,i.jsxs)(a.xu,{backgroundColor:"grey2",bottom:0,flexDirection:"column",padding:{bottom:40,inline:24},position:"sticky",style:{marginBottom:"-16px"},children:[(0,i.jsx)(a.ph,{sx:{left:0,position:"absolute",right:0}}),(0,i.jsx)(a.zx,{onClick:function(){u({type:"ADD_VARIATION"})},startIcon:"add",sx:{position:"relative"},variant:"secondary",children:"Add a new variation"})]})]}),(0,i.jsx)(M.Z,{slices:m([n]),defaultVariationSelector:v}),(0,i.jsx)(P,{isOpen:(null==c?void 0:c.type)==="RENAME_VARIATION",onClose:function(){u(void 0)},slice:n,variation:null==c?void 0:c.variation,sliceBuilderState:r,setSliceBuilderState:o}),(0,i.jsx)(B,{isOpen:(null==c?void 0:c.type)==="DELETE_VARIATION",onClose:function(){u(void 0)},slice:n,variation:null==c?void 0:c.variation,sliceBuilderState:r,setSliceBuilderState:o}),(0,i.jsx)(L,{initialVariation:t,isOpen:(null==c?void 0:c.type)==="ADD_VARIATION",onClose:function(){u(void 0)},onSubmit:function(e,t,i){x(e,t,i);var r=k.e.copyValue(i,e,t),a=(0,b.Z)((0,g.Z)({},n),{model:(0,b.Z)((0,g.Z)({},n.model),{variations:(0,j.Z)(n.model.variations).concat([r])})});y(a,o);var l=O.Y.getBuilderPagePathname({libraryName:a.href,sliceName:a.model.name,variationId:r.id});w.replace(l)},variations:n.model.variations})]})},q=t(56580),X=t(75329),J=t(33710),Q=t(42189),Y=t(17036),G=t(39295),$=t(22342),U=function(){return(0,i.jsx)(G.X,{children:(0,i.jsxs)(J.Z,{clickable:!0,place:"bottom",effect:"solid",delayHide:500,id:"simulator-button-tooltip",children:[(0,i.jsx)(T.xv,{as:"b",children:"Framework not supported"}),(0,i.jsx)(T.xv,{as:"p",children:"Slice Simulator does not support your framework yet."})]})})},ee=function(e){var n=e.children,t=e.open,r=e.onClose;return(0,i.jsxs)($.zs,{open:t,trigger:n,onClose:r,children:[(0,i.jsx)($.Ev,{children:"Simulate your slices"}),(0,i.jsx)($.LB,{component:"video",cloudName:"dmtf1daqp",loop:!1,autoPlay:!1,publicId:X.Sn,poster:"/simulator-video-thumbnail.png",controls:!0,onPlay:function(){_.Xe.track({event:"open-video-tutorials",video:X.Sn})}}),(0,i.jsx)($.OJ,{children:"Minimize context-switching by previewing your Slice components in the simulator."}),(0,i.jsx)($.Rp,{children:"Got It"})]})},en=function(){return(0,i.jsx)(G.X,{children:(0,i.jsx)(J.Z,{clickable:!0,place:"bottom",effect:"solid",delayHide:500,id:"simulator-button-tooltip",children:"Save your work in order to simulate"})})},et=function(e){var n=e.isSimulatorAvailableForFramework,t=e.isTouched,r=(0,S.useRouter)(),o=(0,l.useRef)(null),s=(0,h.Z)().setSeenSimulatorToolTip,c=(0,q.v9)(function(e){return{hasSeenSimulatorTooltip:(0,Y.bv)(e)}}).hasSeenSimulatorTooltip;(0,l.useEffect)(function(){var e=o.current;e&&n&&!c&&setTimeout(function(){return J.Z.show(e)},5e3)},[n,c]);var u=function(){if(s(),o.current){var e=o.current;J.Z.hide(e)}},d=n&&!c;return(0,i.jsxs)("span",{"data-tip":!0,"data-tip-disable":!1,"data-for":"simulator-button-tooltip",ref:o,children:[(0,i.jsx)(ee,{open:d,onClose:u,children:(0,i.jsx)(a.zx,{"data-tip":!0,"data-testid":"simulator-open-button",onClick:function(){u(),window.open("".concat(r.asPath,"/simulator"),X.pq)},disabled:!n||t,renderStartIcon:function(){return(0,i.jsx)(Q.z,{color:a.TV.color.greyLight11,height:a.TV.size[24],style:{transform:"scale(calc(4 / 3))"},width:a.TV.size[24]})},variant:"secondary",children:"Simulate"})}),!1===n?(0,i.jsx)(U,{}):n&&!1===d&&t?(0,i.jsx)(en,{}):null]})},ei=t(76747),er=t(17329),eo=t(81038);function ea(e){return el.apply(this,arguments)}function el(){return(el=(0,w.Z)(function(e){var n,t,i;return(0,C.__generator)(this,function(r){switch(r.label){case 0:return[4,eo.j.customTypes.readCustomType({id:e})];case 1:if(t=(n=r.sent()).errors,i=n.model,t.length>0)throw t;return[2,i]}})})).apply(this,arguments)}var es=t(67445),ec=t(64722),eu=t(20812),ed=function(e){return(0,i.jsxs)("svg",(0,b.Z)((0,g.Z)({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,i.jsx)("path",{d:"M9.5 12L6 9.5L9.5 7V9.5V12Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M6 9.5H11C14.3 9.5 17 12.2 17 15.5V17.5M6 9.5L9.5 12V9.5V7L6 9.5Z",stroke:"currentColor",strokeLinecap:"round"})]}))},ef=function(){var e,n,t=(e=(0,ec.l)().source,n=(0,es.Ag)(e.query),void 0!==n&&(0,es.ne)(e.asPath,n)?n:void 0);return void 0!==t?(0,i.jsx)(a.SV,{children:(0,i.jsx)(l.Suspense,{children:(0,i.jsx)(a.xu,{bottom:32,justifyContent:"center",position:"fixed",right:0,width:"100vw",children:(0,i.jsx)(em,{sourceCustomTypeId:t})})})}):null},em=function(e){var n,t=(n=e.sourceCustomTypeId,(0,er.QT)(ea,[n])),r=(0,l.useState)(!0),o=r[0],s=r[1],c=(0,S.useRouter)();if(void 0===t||!o)return null;var u=t.format,d=t.id,f=es.cd[u].getBuilderPagePathname(d);return(0,i.jsxs)(a.hE,{density:"compact",variant:"tertiary",children:[(0,i.jsxs)(a.zx,{onClick:function(){c.push(f)},renderStartIcon:function(){return(0,i.jsx)(ed,{})},children:["Return to ",t.label]}),(0,i.jsx)(a.zx,{onClick:function(){s(!1)},renderStartIcon:function(){return(0,i.jsx)(eu.T,{})}})]})},ev=t(39092),ep=t(92521),eh={loading:!1,done:!1},ex=function(e){var n=e.slice,t=e.variation,r=(0,h.Z)().openToaster,o=(0,q.v9)(function(e){return(0,ep.sY)(e,n.from,n.model.id)}),a=(0,l.useState)(eh),c=a[0],u=a[1];return((0,l.useEffect)(function(){o&&u(eh)},[o]),(0,l.useEffect)(function(){if(c.done){var e,n;n=c,n.done&&r(n.message,n.error?s.Jf.ERROR:s.Jf.SUCCESS)}},[c]),t)?(0,i.jsx)(ey,{setState:u,slice:n,variation:t,isTouched:o,state:c}):(0,i.jsx)(ei.LN,{})},ey=function(e){var n=e.setState,t=e.slice,r=e.variation,o=e.isTouched,l=e.state,s=(0,q.v9)(ev.Ql),c=(0,h.Z)().updateSlice;return(0,i.jsxs)(ei.LN,{children:[(0,i.jsxs)(ei.wd,{children:[(0,i.jsx)(ei.Xq,{url:"/slices"}),(0,i.jsx)(ei.Cx,{folder:"Slices",page:t.model.name}),(0,i.jsxs)(ei.K2,{children:[(0,i.jsx)(et,{isSimulatorAvailableForFramework:s,isTouched:!!o}),(0,i.jsx)(a.zx,{loading:l.loading,disabled:!o||l.loading,onClick:function(){c(t,n)},"data-cy":"builder-save-button",children:"Save"})]})]}),(0,i.jsxs)(ei.RN,{children:[(0,i.jsxs)(a.xu,{alignItems:"flex-start",display:"grid",gap:16,gridTemplateColumns:"320px 1fr",children:[(0,i.jsx)(W,{slice:t,variation:r,sliceBuilderState:l,setSliceBuilderState:n}),(0,i.jsx)(y,{variation:r})]}),(0,i.jsx)(ef,{})]})]})},eg=t(28684),eb=(0,t(57880).y)(ex);function ej(){var e=(0,eg.Z)().slice;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o(),{children:e?(0,i.jsxs)("title",{children:[e.model.name," - Slice Machine"]}):null}),(0,i.jsx)(eb,{})]})}},28684:function(e,n,t){"use strict";var i=t(92521),r=t(90374),o=t(5632),a=t(2784),l=t(56580),s=function(){var e=(0,o.useRouter)(),n=(0,r.Z)().initSliceStore,t=(0,l.v9)(function(n){return{slice:(0,i.tL)(n,e.query.lib,e.query.sliceName)}}).slice;if((0,a.useEffect)(function(){t?n(t):e.replace("/")},[n,t,e]),!t)return{};var s=t.model.variations.find(function(n){return n.id===e.query.variation});return s?{slice:t,variation:s}:(e.replace("/"),{})};n.Z=s},57880:function(e,n,t){"use strict";t.d(n,{y:function(){return l}});var i=t(62230),r=t(52322);t(2784);var o=t(28684),a=t(95583),l=function(e){return function(n){var t=n.pageProps,l=(0,o.Z)(),s=l.slice,c=l.variation;return s&&c?(0,r.jsx)(e,(0,i.Z)({slice:s,variation:c},t)):((0,a.gx)("/"),null)}}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return b}});var i=t(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}t(52322);var o=["shift","alt","meta","mod","ctrl"],a={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function l(e){return(a[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function s(e,n){return void 0===n&&(n=","),e.split(n)}function c(e,n,t){void 0===n&&(n="+");var i,a=e.toLocaleLowerCase().split(n).map(function(e){return l(e)});return r({},{alt:a.includes("alt"),ctrl:a.includes("ctrl")||a.includes("control"),shift:a.includes("shift"),meta:a.includes("meta"),mod:a.includes("mod")},{keys:a.filter(function(e){return!o.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([l(e.key),l(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&m([l(e.key),l(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){u.clear()});var u=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];u.has("meta")&&u.forEach(function(e){var n;return!o.includes(e)&&u.delete(e.toLowerCase())}),n.forEach(function(e){return u.add(e.toLowerCase())})}function m(e){var n=Array.isArray(e)?e:[e];"meta"===e?u.clear():n.forEach(function(e){return u.delete(e.toLowerCase())})}function v(e,n){var t=e.target;void 0===n&&(n=!1);var i=t&&t.tagName;return d(n)?Boolean(i&&n&&n.some(function(e){return e.toLowerCase()===i.toLowerCase()})):Boolean(i&&n&&!0===n)}var p=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,a=n.meta,s=n.mod,c=n.shift,f=n.ctrl,m=n.keys,v=e.key,p=e.code,h=e.ctrlKey,x=e.metaKey,y=e.shiftKey,g=e.altKey,b=l(p),j=v.toLowerCase();if(!t){if(!g===o&&"alt"!==j||!y===c&&"shift"!==j)return!1;if(s){if(!x&&!h)return!1}else if(!x===a&&"meta"!==j&&"os"!==j||!h===f&&"ctrl"!==j&&"control"!==j)return!1}return!!(m&&1===m.length&&(m.includes(j)||m.includes(b)))||(m?(void 0===r&&(r=","),(d(i=m)?i:i.split(r)).every(function(e){return u.has(e.trim().toLowerCase())})):!m)},h=(0,i.createContext)(void 0),x=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},g="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function b(e,n,t,r){var o,a,u=(0,i.useRef)(null),b=(0,i.useRef)(!1),j=t instanceof Array?r instanceof Array?void 0:r:t,S=d(e)?e.join(null==j?void 0:j.splitKey):e,w=t instanceof Array?t:r instanceof Array?r:void 0,C=(0,i.useCallback)(n,null!=w?w:[]),k=(0,i.useRef)(C);w?k.current=C:k.current=n;var Z=(!function e(n,t){return n&&t&&"object"==typeof n&&"object"==typeof t?Object.keys(n).length===Object.keys(t).length&&Object.keys(n).reduce(function(i,r){return i&&e(n[r],t[r])},!0):n===t}((a=(0,i.useRef)(void 0)).current,j)&&(a.current=j),a.current),I=(0,i.useContext)(x).enabledScopes,T=(0,i.useContext)(h);return g(function(){if((null==Z?void 0:Z.enabled)!==!1&&(e=I,n=null==Z?void 0:Z.scopes,0===e.length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!n||e.some(function(e){return n.includes(e)})||e.includes("*")))){var e,n,t=function(e,n){var t,i;if(void 0===n&&(n=!1),!(v(e,["input","textarea","select"])&&!v(e,null==Z?void 0:Z.enableOnFormTags)||null!=Z&&null!=Z.ignoreEventWhen&&Z.ignoreEventWhen(e))){if(null!==u.current&&document.activeElement!==u.current&&!u.current.contains(document.activeElement)){y(e);return}(null==(t=e.target)||!t.isContentEditable||null!=Z&&Z.enableOnContentEditable)&&s(S,null==Z?void 0:Z.splitKey).forEach(function(t){var i,r,o,a,l,s,u,d=c(t,null==Z?void 0:Z.combinationKey);if(p(e,d,null==Z?void 0:Z.ignoreModifiers)||null!=(u=d.keys)&&u.includes("*")){if(n&&b.current)return;if(i=e,r=d,("function"==typeof(o=null==Z?void 0:Z.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),a=e,l=d,"function"==typeof(s=null==Z?void 0:Z.enabled)?!s(a,l):!0!==s&&void 0!==s){y(e);return}k.current(e,d),n||(b.current=!0)}})}},i=function(e){void 0!==e.key&&(f(l(e.code)),((null==Z?void 0:Z.keydown)===void 0&&(null==Z?void 0:Z.keyup)!==!0||null!=Z&&Z.keydown)&&t(e))},r=function(e){void 0!==e.key&&(m(l(e.code)),b.current=!1,null!=Z&&Z.keyup&&t(e,!0))},o=u.current||(null==j?void 0:j.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),T&&s(S,null==Z?void 0:Z.splitKey).forEach(function(e){return T.addHotkey(c(e,null==Z?void 0:Z.combinationKey,null==Z?void 0:Z.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),T&&s(S,null==Z?void 0:Z.splitKey).forEach(function(e){return T.removeHotkey(c(e,null==Z?void 0:Z.combinationKey,null==Z?void 0:Z.description))})}}},[S,Z,I]),u}}},function(e){e.O(0,[789,958,80,482,774,888,179],function(){return e(e.s=31314)}),_N_E=e.O()}]);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { managerClient } from "@src/managerClient";
|
|
2
|
-
|
|
3
|
-
export async function getActiveEnvironmentDomain() {
|
|
4
|
-
try {
|
|
5
|
-
const { environment } = await managerClient.project.readEnvironment();
|
|
6
|
-
|
|
7
|
-
return { activeEnvironmentDomain: environment };
|
|
8
|
-
} catch (error) {
|
|
9
|
-
return { error };
|
|
10
|
-
}
|
|
11
|
-
}
|
|
File without changes
|