1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[914],{12857:(e,t,i)=>{"use strict";i.d(t,{A:()=>u});var r=i(37876),a=i(85051),l=i(83621),s=i(73060),n=i(77713),d=i(95927),o=i(2498),c=i(58053);let u=({isSubmitting:e,name:t,label:i,options:u,fullWidth:p=!0,description:h})=>(0,r.jsx)(a.B0,{name:t,children:({field:a,form:x,meta:m})=>(0,r.jsxs)(l.A,{fullWidth:p,disabled:e,error:m.touched&&!!m.error,children:[(0,r.jsx)(s.A,{children:i??(0,c.i5)(t)}),(0,r.jsx)(n.A,{...a,label:i??(0,c.i5)(t),onChange:e=>x.setFieldValue(t,e.target.value),children:u.map(e=>(0,r.jsx)(d.A,{value:e.value,children:e.label},e.value))}),m.touched&&m.error||h?(0,r.jsx)(o.A,{children:m.touched&&m.error?m.error:h}):null]})})},25363:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>x});var r=i(37876),a=i(93546),l=i(53935),s=i(75353),n=i(21565),d=i(59852),o=i(76686),c=i(11399),u=i(54431),p=i(89099);let h=()=>{let e=(0,p.useRouter)(),t=(0,c.OX)(e),{data:i}=(0,u.IT)(d.Sg,{skip:!t,variables:{id:t}});return(0,r.jsxs)(o.A,{display:"flex",flexDirection:"column",alignItems:"center",gap:2,children:[(0,r.jsx)(s.A,{title:(0,r.jsx)(n.A,{title:"Edit Article",backLink:(0,c.a$)("/articles")}),sx:{width:"100%"},content:!1}),(0,r.jsx)(s.A,{sx:{position:"relative",width:"100%"},children:(0,r.jsx)(o.A,{children:i?.article&&(0,r.jsx)(l.A,{article:i.article})})})]})};h.getLayout=function(e){return(0,r.jsx)(a.A,{children:e})};let x=h},31120:(e,t,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/articles/edit/[id]",function(){return i(25363)}])},47520:(e,t,i)=>{"use strict";i.d(t,{A:()=>m});var r=i(37876),a=i(73640),l=i.n(a),s=i(4103),n=i.n(s),d=i(96521),o=i(73996),c=i(14232),u=i(59852),p=i(26686),h=i(64177),x=i(54431);let m=({title:e="Tag",value:t,onChange:i,error:a,helperText:s})=>{let[m]=(0,h.n)(u.j$),[g,A]=(0,c.useState)([]),[S,b]=(0,c.useState)(""),[j,I]=(0,c.useState)([]),{loading:f,data:v}=(0,x.IT)(u.PR,{variables:{offset:0,limit:10,sort:{name:p.pH.asc},search:S}});(0,c.useEffect)(()=>{!f&&v?.tags&&A(v.tags.data)},[f,v,A]);let w=l()(e=>{let t=e.trim();t&&b(t)}),y=async(e,t)=>{let r=t.find(e=>void 0===e.id),a=t.filter(e=>e.id);if(r){let e=r.value,t=await m({variables:{tag:{name:e,slug:n()(e,{trim:!0,lower:!0})}}});t.data?.saveTag&&a.push(t.data.saveTag)}I(a),i&&i(e,a)},C=[...Array.from(new Set([...g,...j,...t||[]]))].sort((0,p.hz)(p.pH.asc,"name"));return(0,r.jsx)(d.A,{fullWidth:!0,multiple:!0,autoComplete:!0,options:C,loading:f,value:t,getOptionLabel:({name:e})=>e,isOptionEqualToValue:(e,t)=>e.id==t.id,filterOptions:(e,{inputValue:t})=>{let i=e.find(e=>e.name===t),r=t.trim();return i||""===r||e.push({value:r,name:`Add "${r}"`}),e},renderInput:t=>(0,r.jsx)(o.A,{...t,label:e,error:a,helperText:s}),onInputChange:(e,t)=>
1{w(t)},onChange:y})}},53935:(e,t,i)=>{"use strict";i.d(t,{A:()=>q});var r=i(37876),a=i(26727),l=i(10892),s=i(58362),n=i(3369),d=i(20038),o=i(30258),c=i(43588),u=i(11171),p=i.n(u),h=i(9092),x=i(76686),m=i(82702),g=i(22250),A=i(24661),S=i(58347),b=i(93494),j=i(41411),I=i(57025);let f=({articleStep:e,index:t,isSubmitting:i,onDelete:a,setFieldValue:u,onMoveComponentUp:f,onMoveComponentDown:v,upDisabled:w=!1,downDisabled:y=!1})=>(0,r.jsxs)(h.A,{elevation:3,sx:{marginLeft:"1em",marginTop:"2em",padding:"1em"},children:[(0,r.jsxs)(x.A,{sx:{marginBottom:"1em"},display:"flex",justifyContent:"space-between",children:[(0,r.jsxs)(m.A,{variant:"h3",children:[`Step #${e.order}`,p()(e.id)&&(0,r.jsxs)("small",{children:[" ",` (id: ${e.id})`]})]}),(0,r.jsxs)(x.A,{display:"flex",alignItems:"center",gap:1,children:[(0,r.jsx)(g.A,{size:"small",disabled:w||i,onClick:()=>f?.(t),title:"Move Step up",children:(0,r.jsx)(b.A,{})}),(0,r.jsx)(g.A,{size:"small",disabled:y||i,onClick:()=>v?.(t),title:"Move Step down",children:(0,r.jsx)(j.A,{})}),(0,r.jsx)(l.A,{onConfirmation:a,message:`Are you sure you want to delete the step #${e.order}${p()(e.id)?` (id: ${e.id})`:""}?`,children:(0,r.jsx)(A.A,{variant:"text",endIcon:(0,r.jsx)(s.A,{}),color:"error",children:"Delete Step"})})]})]}),(0,r.jsxs)(S.A,{container:!0,spacing:2,children:[(0,r.jsx)(S.A,{size:{xs:12,md:12},children:(0,r.jsx)(o.A,{title:"Step Image",onSave:e=>u(`articleSteps[${t}].headerImageId`,e.id),onDelete:()=>u(`articleSteps[${t}].headerImageId`,null),height:500,width:500,imageId:e.headerImageId})}),(0,r.jsx)(S.A,{size:{xs:12},children:(0,r.jsx)(d.A,{name:`articleSteps[${t}].instagramLink`,label:"Instagram Link",isSubmitting:i})}),(0,r.jsx)(S.A,{size:{xs:12},children:(0,r.jsx)(d.A,{name:`articleSteps[${t}].title`,label:"Title",isSubmitting:i})}),(0,r.jsx)(I.A,{initialValue:e.description??"",onChange:e=>u(`articleSteps[${t}].description`,e),placeholder:"Enter description...",label:"Description"}),(0,r.jsx)(c.A,{setFieldValue:u,relationName:`articleSteps[${t}].articleStepsOnProducts`,productsOnSomething:e.articleStepsOnProducts??[]}),(0,r.jsx)(S.A,{size:{xs:12},children:(0,r.jsx)(n.A,{productsOnSomething:e.articleStepsOnProducts??[],productsToDelete:e.productsToDelete??[],setFieldValue:u,relationName:`articleSteps[${t}].articleStepsOnProducts`,productsToDeleteRelationName:`articleSteps[${t}].productsToDelete`})})]})]},t);var v=i(70521),w=i(57186),y=i(26686);let C=({articleSteps:e,articleStepsToDelete:t,isSubmitting:i,setFieldValue:l})=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(S.A,{size:{xs:12},display:"flex",justifyContent:"space-between",style:{margin:"2em 1em 0",borderTop:"0.5px solid grey"},children:[(0,r.jsxs)(S.A,{display:"flex",justifyContent:"space-between",sx:{gap:"24px"},children:[(0,r.jsx)("h1",{children:"Steps"}),(0,r.jsx)(v.A,{name:"showStepsNumbers",isSubmitting:i,labelPlacement:"start"})]}),(0,r.jsx)(A.A,{variant:"text",endIcon:(0,r.jsx)(a.A,{}),onClick:()=>{l("articleSteps",[...e,{articleStepsOnProducts:[],order:e.length+1,id:(0,w.A)()}])},children:"Add Step"})]}),(0,r.jsx)(S.A,{size:{xs:12},children:e.map((a,s)=>(0,r.jsx)(f,{articleStep:a,index:s,isSubmitting:i,onDelete:()=>{let i=e.filter((e,t)=>t!==s).sort((0,y.hz)(y.pH.asc,"order"));l("articleSteps",i=i.map((e,t)=>({...e,order:t+1}))),p()(a.id)&&l("articleStepsToDelete",[...t,a.id])},setFieldValue:l,onMoveComponentUp:()=>(t=>{if(t>0){let i=e.map((i,r)=>r===t?{...i,order:e[t-1].order}:r===t-1?{...i,order:e[t].order}:i);i.sort((e,t)=>e.order-t.order),l("articleSteps",i)}})(s),onMoveComponentDown:()=>(t=>{if(t<e.length-1){let i=e.map((i,r)=>r===t?{...i,order:e[t+1].order}:r===t+1?{...i,order:e[t].order}:i);i.sort((e,t)=>e.order-t.order),l("articleSteps",i)}})(s),upDisabled:0===s,downDisabled:s===e.length-1},a.id))})]});var T=i(51829),D=i(16969),P=i(72790),E=i(57390),k=i(83365),z=i(75340),O=i(47520),M=i(61482),U=i(56557),$=i.n(U),H=i(59852),V=i(72193),F=i(73446),N=i(76213),B=i(14232),R=i(75826),_=i(64177),L=i(58053);let q=({article:e})=>{let[t,{data:i,error:a}]=(0,_.n)(H.f0),[s]=(0,_.n)(H.Yp),[n,c]=(0,B.useState)(!1),[u,h]=(0,B.useState)(!1),[x,g]=(0,B.useState)(),{submitType:b,meaningfulUpdate:j,handleSubmit:f}=(0,R.j)();(0,B.useEffect)(()=>{g((0,F.u)(e))},[e,g]),(0,B.useEffect)(()=>{!a&&i&&(g((0,F.u)(i.saveArticle)),c(!0))},[a,i,g,c]);let w={articleSteps:x?.articleSteps??[],showStepsNumbers:x?.showStepsNumbers??!0,articleStepsToDelete:[],authorId:x?.authorId??null,headline:x?.headline??"",content:x?.content??"",footer:x?.footer??"",copywriterId:x?.copywriterId??null,reviewerId:x?.reviewerId??null,headerImageBigId:x?.headerImageBigId??null,headerImageBig:x?.headerImageBig??null,headerImageSmallId:x?.headerImageSmallId??null,headerImageSmall:x?.headerImageSmall??null,meta:x?.meta??{description:"",keywords:"",title:""},productExpertId:x?.productExpertId??null,publishAt:x?.publishAt??"",showInSave:x?.showInSave??!1,showInShop:x?.showInShop??!1,awakn:x?.awakn??!1,includeInHomeMainSection:x?.includeInHomeMainSection??!1,slug:x?.slug??"",tags:x?.tags??[],title:x?.title??"",robotsMetaTag:x?.robotsMetaTag??"index,follow",updatedAt:x?.updatedAt??"",softUpdatedAt:x?.softUpdatedAt??""},y=async e=>{await s({variables:{id:e}}),h(!0)};return e?.id&&!x?null:(0,r.jsx)(T.A,{baseUrl:"/articles",existingId:e?.id,updatedId:i?.saveArticle?.id,savedSuccessfully:n,unPublishedSuccessfully:u,initialValues:w,error:a,validate:e=>{let t={...(0,V.D2)({inputValues:e,requiredFields:["title","slug"]}),...(0,N.Cs)(e.articleSteps,"articleSteps")};return"publish"===b.current&&(t={...t,...(0,V.D2)({inputValues:e,requiredFields:["headline","copywriterId","headerImageBigId","content"]}),...(0,N.lH)(e.headerImageBig,"headerImageBigId",{labelPrefix:"Header Image Big: "}),...(0,N.lH)(e.headerImageSmall,"headerImageSmallId",{labelPrefix:"Header Image Small: "})},e.articleSteps?.forEach((e,i)=>{t={...t={...t,...(0,V.D2)({inputValues:e,requiredFields:["title","description"],keyOverride:`articleSteps.${i}`})},...(0,N.qG)(e.articleStepsOnProducts??null,`articleSteps.${i}.articleStepsOnProducts`)}})),t},onSubmit:async i=>{let{meta:r,articleSteps:a,publishAt:l,headerImageBig:s,headerImageSmall:n,...d}=i,o=(0,L.Fp)(x?.isPublished,b.current,x?.updatedAt,j.current),c=(0,L.n)(b.current,x?.softUpdatedAt??void 0),u="publish"!==b.current||l?(0,L.V3)(l):$()().toDate();await t({variables:{article:{...d,publishAt:u,updatedAt:o,softUpdatedAt:c,articleSteps:a?.map(e=>({articleStepsOnProducts:(0,N.Z3)(e.articleStepsOnProducts),description:e.description??"",id:p()(e.id)?e.id:void 0,order:e.order,productsToDelete:e.productsToDelete??[],title:e.title??"",headerImageId:e.headerImageId,instagramLink:e.instagramLink??""}))??[],id:e?.id,meta:{...r,id:e?.metaId||void 0}},publish:"publish"===b.current}})},children:t=>{let{isSubmitting:i,values:a,errors:s,touched:n,setFieldValue:c,submitForm:u,dirty:p}=t;return(0,r.jsxs)(S.A,{container:!0,spacing:2,children:[(0,r.jsx)(S.A,{size:{xs:12,md:6},children:(0,r.jsx)(o.A,{title:"Header Image Big",required:!0,onSave:e=>{c("headerImageBigId",e.id),c("headerImageBig",e)},height:800,width:800,imageId:a.headerImageBigId,captionEnabled:!1,altEnabled:!0})}),(0,r.jsx)(S.A,{size:{xs:12,md:6},children:(0,r.jsx)(o.A,{title:"Header Image Small",onSave:e=>{c("headerImageSmallId",e.id),c("headerImageSmall",e)},onDelete:()=>{c("headerImageSmallId",null),c("headerImageSmall",null)},height:275,width:410,imageId:a.headerImageSmallId,captionEnabled:!1,altEnabled:!0})}),(0,r.jsx)(S.A,{size:{xs:12,sm:6},children:(0,r.jsx)(d.A,{name:"title",isSubmitting:i})}),(0,r.jsxs)(S.A,{size:{xs:12,sm:6},style:{display:"flex",alignItems:"start",paddingLeft:"16px",flexDirection:"column",gap:"8px"},children:[(0,r.jsxs)(m.A,{component:"div",variant:"body1",children:[(0,r.jsx)("b",{children:"Published At (US/Chicago):"})," ",$()(a.publishAt).isValid()?(0,L.FJ)($()(a.publishAt).toDate(),"America/Chicago",!0):"N/A"]}),(0,r.jsxs)(m.A,{component:"div",variant:"body1",children:[(0,r.jsx)("b",{children:"Updated At (US/Chicago):"})," ",$()(a.updatedAt).isValid()?(0,L.FJ)($()(a.updatedAt).toDate(),"America/Chicago",!0):"N/A"]}),(0,L.Rc)(a.softUpdatedAt,a.updatedAt)&&(0,r.jsxs)(m.A,{component:"div",variant:"body1",children:[(0,r.jsx)("b",{children:"Soft Updated At (US/Chicago):"})," ",(0,L.FJ)($()(a.softUpdatedAt).toDate(),"America/Chicago",!0)]})]}),(0,r.jsx)(S.A,{size:{xs:12,sm:6},children:(0,r.jsx)(E.A,{name:"slug",isSubmitting:i})}),(0,r.jsx)(S.A,{size:{xs:12,sm:6},children:(0,r.jsx)(d.A,{name:"headline",isSubmitting:i})}),(0,r.jsx)(S.A,{size:{xs:12,sm:6},children:(0,r.jsx)(M.A,{label:"Copywriter",userId:a.copywriterId,onChange:(e,t)=>
1c("copywriterId",t?.id),error:n.copywriterId&&!!s.copywriterId,helperText:n.copywriterId&&s.copywriterId})}),(0,r.jsx)(S.A,{size:{xs:12,md:6},children:(0,r.jsx)(M.A,{label:"Product Expert",userId:a.productExpertId,onChange:(e,t)=>c("productExpertId",t?.id),error:n.productExpertId&&!!s.productExpertId,helperText:n.productExpertId&&s.productExpertId})}),(0,r.jsx)(S.A,{size:{xs:12,md:6},children:(0,r.jsx)(M.A,{label:"Reviewer",userId:a.reviewerId,onChange:(e,t)=>c("reviewerId",t?.id),error:n.reviewerId&&!!s.reviewerId,helperText:n.reviewerId&&s.reviewerId})}),(0,r.jsxs)(S.A,{size:{xs:12,md:6},justifyContent:"space-around",display:"flex",children:[(0,r.jsx)(v.A,{name:"showInSave",isSubmitting:i,labelPlacement:"start"}),(0,r.jsx)(v.A,{name:"showInShop",isSubmitting:i,labelPlacement:"start"}),(0,r.jsx)(v.A,{name:"awakn",isSubmitting:i,labelPlacement:"start"}),(0,r.jsx)(v.A,{name:"includeInHomeMainSection",isSubmitting:i,labelPlacement:"start"})]}),(0,r.jsx)(S.A,{size:{xs:12,md:6},justifyContent:"space-around",display:"flex",children:(0,r.jsx)(k.A,{isSubmitting:i})}),(0,r.jsx)(S.A,{size:{xs:12},children:(0,r.jsx)(O.A,{value:a.tags,onChange:(e,t)=>
1c("tags",t),error:n.tags&&!!s.tags,helperText:n.tags&&s.tags})}),(0,r.jsx)(I.A,{initialValue:w.content,onChange:e=>c("content",e),label:"Content"}),(0,r.jsx)(C,{articleSteps:a.articleSteps,articleStepsToDelete:a.articleStepsToDelete,isSubmitting:i,setFieldValue:c}),(0,r.jsx)(I.A,{initialValue:w.footer,onChange:e=>c("footer",e),label:"Footer"}),(0,r.jsx)(z.A,{isSubmitting:i}),(0,r.jsx)(S.A,{size:{xs:12},children:(0,r.jsxs)(S.A,{sx:D.VU,children:[(0,r.jsx)(S.A,{children:(0,r.jsx)(A.A,{variant:"contained",color:"primary",disabled:i||!p,onClick:()=>f("draft",u),children:"Save Draft"})}),(0,r.jsx)(S.A,{children:(0,r.jsx)(l.A,{message:x?.isPublished?P.pM:P.Hn,onConfirmation:e=>f("publish",u,e),disabled:i||!p,useMeaningfulUpdate:!0,hideMeaningCheckbox:!x?.isPublished,children:(0,r.jsx)(A.A,{variant:"contained",color:"secondary",disabled:i||!p,children:"Save & Publish"})})}),e?.isPublished&&(0,r.jsx)(S.A,{children:(0,r.jsx)(l.A,{message:"Are you sure to un-publish this Article? Make sure to have a redirect url!",onConfirmation:()=>y(e.id),disabled:i||!p,children:(0,r.jsx)(A.A,{variant:"contained",color:"warning",children:"Un-publish"})})})]})})]})}})}},61482:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var r=i(37876),a=i(80053),l=i(26686),s=i(14232),n=i(59852),d=i(54431),o=i(75850);let c=({label:e="User",userId:t,onChange:i,error:c,helperText:u})=>
1{let[p,h]=(0,s.useState)(""),{loading:x,data:m}=(0,d.IT)(n.sO,{variables:{offset:0,limit:10,sort:[{firstName:l.pH.asc},{lastName:l.pH.asc}],role:o.f.AUTHOR,search:p||void 0}}),{data:g}=(0,d.IT)(n.xb,{skip:!t,variables:{id:t}});return(0,r.jsx)(a.A,{data:m?.users.data,error:c,getOptionLabel:e=>(({firstName:e,lastName:t,email:i})=>`${e} ${t}`.trim()||i)(e),helperText:u,label:e,loading:x,onChange:i,setSearch:h,value:t&&g?.user||null})}},75826:(e,t,i)=>{"use strict";i.d(t,{j:()=>a});var r=i(14232);let a=()=>{let e=(0,r.useRef)("draft"),t=(0,r.useRef)(!0),i=(0,r.useRef)("");return{submitType:e,meaningfulUpdate:t,changeLogDescription:i,handleSubmit:(r,a,l=!0,s)=>(e.current=r,t.current=l,i.current=s??"",a()),prepareSaveDraft:()=>{e.current="draft",t.current=!1,i.current=""}}}},75850:(e,t,i)=>{"use strict";i.d(t,{f:()=>r});let r={USER:"user",STAFF:"staff",AUTHOR:"author",SUPERADMIN:"superadmin"}},83365:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var r=i(37876),a=i(12857),l=i(73287),s=i(82702),n=i(19135),d=i(85051);let o=({name:e="robotsMetaTag",label:t="Robots Meta Tag",isSubmitting:i})=>{let[o]=(0,d.Mt)(e),c=String(o.value).includes("noindex")?(0,r.jsxs)(s.A,{sx:{color:l.M.red},children:["If tag is ",(0,r.jsx)("code",{children:"noindex"}),", the page will not be listed in sitemap.xml."," ",(0,r.jsx)(n.A,{href:"https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag",target:"_blank",rel:"noopener noreferrer",sx:{textDecorationColor:l.M.red,color:l.M.red},children:"Learn more"}),"."]}):null;return(0,r.jsx)(a.A,{name:e,label:t,isSubmitting:i,options:[{value:"index,follow",label:"index,follow"},{value:"noindex,nofollow",label:"noindex,nofollow"},{value:"noindex,follow",label:"noindex,follow"},{value:"index,nofollow",label:"index,nofollow"}],description:c})}}},e=>{e.O(0,[7755,6680,7713,3996,6654,7664,6103,8230,2251,8856,4431,6760,8289,7602,3990,424,3089,1678,2732,696,5454,8575,4770,9514,8612,3546,9852,5066,9800,8886,636,6593,8792],()=>e(e.s=31120)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.