"use strict";(globalThis.webpackChunkwpmvc=globalThis.webpackChunkwpmvc||[]).push([[425],{24893:(e,t,n)=>{n.d(t,{Q:()=>a});var s=n(51962),i=n(31890),l=n(38800),r=n(10790);function a(e){return t=>{const{bgUrl:n,...a}=t;return(0,l.n_)()?(0,r.jsx)(e,{...a}):(0,r.jsxs)(i.ComingSoon,{bgUrl:n,children:[(0,r.jsx)("h3",{children:"Upgrade to Pro"}),(0,r.jsx)("p",{children:"Get access to this premium feature with Vendtics PRO version!"}),(0,r.jsx)(i.Button,{variant:s.zB,sx:{background:"#F59E0B",border:"none"},children:"Upgrade to Pro!"})]})}}},79425:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Ne});var s=n(56427),i=n(86087),l=n(47767),r=n(72404),a=n(67601),o=n(85011),c=n(47143),d=n(29491),m=n(27723),u=n(97072),h=n(60742),x=n(36552),g=n(90888),p=n(70885),_=n(11575),f=n(4856),y=n(42855),j=n(48737),v=n(60258),b=n(71479);const A=b.A.h2`
	color: ${v.l.neutral900};
	font-size: 18px;
	font-weight: 600;
	margin-bottom: 10px;
`,S=b.A.p`
	color: ${v.l.neutral800};
	font-size: 14px;
`;var q=n(10790);function F(){const{countries:e}=(0,j.Av)();return(0,q.jsxs)(s.Flex,{align:"flex-start",gap:"16px",children:[(0,q.jsxs)(s.FlexItem,{style:{flexBasis:"40%"},children:[(0,q.jsx)(A,{children:(0,m.__)("Business Address","vendtics")}),(0,q.jsx)(S,{children:(0,m.__)("Lorem Ipsum is simply dummy text of the printing and typesetting industry.","vendtics")})]}),(0,q.jsx)(s.FlexItem,{style:{flexBasis:"60%"},children:(0,q.jsx)(_.A,{children:(0,q.jsxs)(s.Flex,{direction:"column",gap:"16px",children:[(0,q.jsxs)(s.__experimentalGrid,{columns:2,gap:5,children:[(0,q.jsx)(f.A,{label:(0,m.__)("Address line 1","vendtics"),type:"text",name:"address_line_one"}),(0,q.jsx)(f.A,{label:(0,m.__)("Address line 2","vendtics"),type:"text",name:"address_line_two"})]}),(0,q.jsxs)(s.__experimentalGrid,{columns:2,gap:5,children:[(0,q.jsx)(y.A,{label:(0,m.__)("Country","vendtics"),options:e,placeholder:(0,m.__)("Select Country","vendtics"),name:"country"}),(0,q.jsx)(f.A,{label:(0,m.__)("State","vendtics"),type:"text",name:"state"})]}),(0,q.jsxs)(s.__experimentalGrid,{columns:2,gap:5,children:[(0,q.jsx)(f.A,{label:(0,m.__)("City","vendtics"),type:"text",name:"city"}),(0,q.jsx)(f.A,{label:(0,m.__)("Zip Code","vendtics"),type:"text",name:"zip_code"})]})]})})})]})}var R=n(11402);const E=b.A.div`
	padding: 30px;
	border-radius: 8px;
	background-color: ${v.l.light};
	height: 70vh;
	overflow-y: auto;
	&::-webkit-scrollbar {
		display: none;
	}
`,I=(0,b.A)(R.A)`
	padding: 30px;
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: flex-start;
`,C=(0,b.A)(s.Flex)`
	border-radius: 6px;
	border: 1px solid ${v.l.neutral300};
	background: ${v.l.light};
	padding: 2px;

	.ventics-img-wrapper {
		display: flex;
		align-items: center;
		justify-content: flex-start;
		gap: 14px;
	}
	img {
		width: 64px;
		height: 64px;
		border-radius: 6px;
		border: 1px solid ${v.l.neutral300};
	}
	span {
		color: ${v.l.neutral800};
		font-size: 12px;
	}
`;var w=n(89745),T=n(2572),B=n(51962),D=n(14476),G=n(6299);const N=D.Ay.object({company:D.Ay.string({required_error:"Company is required"}).trim().min(1,{message:"Company is required"}),upload_file:D.Ay.string({required_error:"Company logo is required"}).trim().min(1,{message:"Company logo is required"})}),k=(0,G.w)(N),H={companyName:(0,m.__)("Company Name","vendtics"),phoneNumber:(0,m.__)("Phone Number","vendtics"),companyLogo:(0,m.__)("Company Logo","vendtics"),upload:(0,m.__)("Upload","vendtics")};function L(e){const{form:t,imageInfo:n,setImageInfo:l}=e,{imageUrl:r,handleClick:a,handleRemove:o,fileInfo:c}=(0,j.lf)({form:t,name:"upload_file"});return(0,i.useEffect)((()=>{r&&c?.id&&l({url:r,filename:c?.filename,id:c?.id})}),[r,c,l]),(0,q.jsxs)(s.Flex,{align:"flex-start",gap:"16px",children:[(0,q.jsxs)(s.FlexItem,{style:{flexBasis:"40%"},children:[(0,q.jsx)(A,{children:(0,m.__)("Company Info","vendtics")}),(0,q.jsx)(S,{children:(0,m.__)("Lorem Ipsum is simply dummy text of the printing and typesetting industry.","vendtics")})]}),(0,q.jsx)(s.FlexItem,{style:{flexBasis:"60%"},children:(0,q.jsx)(_.A,{children:(0,q.jsxs)(s.Flex,{direction:"column",gap:"16px",children:[(0,q.jsxs)(s.__experimentalGrid,{columns:2,gap:5,children:[(0,q.jsx)(f.A,{required:!0,label:H.companyName,type:"text",name:"company",rules:[k]}),(0,q.jsx)(f.A,{label:H.phoneNumber,type:"text",name:"phone"})]}),(0,q.jsx)(T.A,{label:H.companyLogo,name:"upload_file",style:{width:"100%"},children:n.url||r?(0,q.jsx)(U,{imageUrl:n.url||r,handleRemove:o,filename:n.filename||c.filename,setImageInfo:l}):(0,q.jsx)(I,{icon:(0,q.jsx)(w.f2,{}),onClick:a,children:H.upload})})]})})})]})}const U=React.memo((e=>{const{imageUrl:t,handleRemove:n,filename:i,setImageInfo:l}=e;return(0,q.jsxs)(C,{align:"center",justify:"space-between",children:[(0,q.jsxs)(s.FlexItem,{className:"ventics-img-wrapper",children:[(0,q.jsx)("img",{src:t,alt:"company-logo"}),(0,q.jsx)("span",{children:i})]}),(0,q.jsx)(s.FlexItem,{children:(0,q.jsx)(R.A,{variant:B.Qq,onClick:()=>{n(),l({})},children:(0,q.jsx)(w.d7,{})})})]})}));function $(e){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(s.Fill,{name:a.A.SETTINGS_SECONDARY_HEADER_LEFT,children:(0,q.jsx)("h3",{children:(0,m.__)("Business Settings","vendtics")})}),(0,q.jsx)(s.Fill,{name:a.A.SETTINGS_SECONDARY_HEADER_RIGHT,children:(0,q.jsx)(R.A,{variant:B.zB,onClick:()=>e.form.submit(),children:(0,m.__)("Save Changes","vendtics")})})]})}const P=(0,c.withDispatch)((e=>({saveSettings:e(p.A.SETTINGS).saveSettings}))),M=(0,d.compose)([P])((function(e){const{form:t,details:n,hasResolved:l,imageInfo:r,setImageInfo:a,handleUpdateBusinessSetting:o}=(e=>{const{saveSettings:t}=e,[n]=h.A.useForm(),[s,l]=(0,i.useState)({}),{details:r,hasResolved:a}=(0,c.useSelect)((e=>{const t=e(p.A.SETTINGS);return{details:t.getDetails(),hasResolved:t.hasFinishedResolution("getDetails")}}));return(0,i.useEffect)((()=>{a&&l({url:r?.settings.business?.company_logo?.url,filename:r?.settings.business?.company_logo?.filename,id:r?.settings.business?.company_logo?.id})}),[r,a]),{form:n,details:r,hasResolved:a,imageInfo:s,setImageInfo:l,handleUpdateBusinessSetting:async e=>{e.upload_file&&delete e.upload_file;const n={settings:{...r.settings,business:{...e,company_logo:{id:s.id,url:s.url,filename:s.filename}}}};try{const e=await t(n);g.Ay.success((0,m.__)(e.message,"vendtics"))}catch(e){g.Ay.error(e.message),console.log(e.message)}}}})(e);return l?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)($,{form:t}),(0,q.jsx)(E,{children:(0,q.jsx)(h.A,{form:t,initialValues:n?.settings?.business||{},onFinish:o,children:(0,q.jsxs)(s.Flex,{direction:"column",gap:"0px",children:[(0,q.jsx)(s.FlexItem,{children:(0,q.jsx)(L,{form:t,imageInfo:r,setImageInfo:a,settings:n?.settings?.business})}),(0,q.jsx)(x.A,{style:{backgroundColor:"#D2D4DA"}}),(0,q.jsx)(s.FlexItem,{children:(0,q.jsx)(F,{})})]})})})]}):(0,q.jsx)(u.A,{})})),O=D.Ay.object({unsubscribe_confirm_page:D.Ay.string({required_error:"Select Confirmation Page"}).trim(),unsubscribe_redirect_page:D.Ay.string({required_error:"Select redirect Page"}).trim(),unsubscribe_redirect_url:D.Ay.string({required_error:"Redirect URL is required"}).trim().min(1,{message:"Redirect URL is required"}).url({message:"Invalid URL"})}),z=(0,G.w)(O),Y="redirect_to_page";var V=n(38800);const W=(0,c.withSelect)((e=>({pages:e(p.A.SETTINGS).getPages()}))),Q=(0,d.compose)([W])((function(e){const{label:t="Select Page",name:n="unsubscribe_confirm_page",placeholder:s="Select",pages:l,rules:r=[],...a}=e,o=(0,i.useMemo)((()=>l?.items?(0,V.Wf)(l?.items,{label:"name",value:"id"}):[]),[l?.items]);return(0,q.jsx)(y.A,{label:(0,m.__)(t,"vendtics"),options:o,placeholder:(0,m.__)(s,"vendtics"),name:n,rules:r,...a})}));var J=n(50770);const X=b.A.div`
	padding: 30px;
	border-radius: 8px;
	background-color: ${v.l.light};
	height: 70vh;
	overflow-y: auto;
	&::-webkit-scrollbar {
		display: none;
	}
	.vendtics-general-setting-text {
		color: ${v.l.neutral800};
		font-size: 14px;
		font-weight: 600;
	}
`,Z=(0,b.A)(J.Ay)`
	border-radius: 6px;
	padding: 12px 14px;
	border: 1px solid ${v.l.neutral300};
	background: ${v.l.light};
	width: 100%;
	justify-content: flex-start;
`;function K(e){const{onChange:t,value:n}=e;return(0,q.jsx)(J.Ay.Group,{onChange:t,value:n,block:!0,children:(0,q.jsxs)(s.Flex,{justify:"flex-start",gap:"16px",children:[(0,q.jsx)(Z,{value:Y,children:(0,m.__)("Redirect to page","vendtics")}),(0,q.jsx)(Z,{value:"redirect_to_custom_url",children:(0,m.__)("Redirect to custom URL","vendtics")})]})})}function ee(e){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(s.Fill,{name:a.A.SETTINGS_SECONDARY_HEADER_LEFT,children:(0,q.jsx)("h3",{children:"General Settings"})}),(0,q.jsx)(s.Fill,{name:a.A.SETTINGS_SECONDARY_HEADER_RIGHT,children:(0,q.jsx)(R.A,{variant:B.zB,onClick:e.form.submit,children:"Save Changes"})})]})}const te=(0,c.withDispatch)((e=>({saveSettings:e(p.A.SETTINGS).saveSettings}))),ne=(0,d.compose)([te])((function(e){const{saveSettings:t}=e,{form:n,details:l,onChange:r,hasResolved:a,selectRadioBtn:o,renderSelectedComponent:d,handleSaveGeneralSettings:x}=(e=>{const[t]=h.A.useForm(),[n,s]=(0,i.useState)(Y),{details:l,hasResolved:r}=(0,c.useSelect)((e=>{const t=e(p.A.SETTINGS);return{details:t.getDetails(),hasResolved:t.hasFinishedResolution("getDetails")}}));(0,i.useEffect)((()=>{l&&s(l?.settings?.general?.after_unsubscribe)}),[l]);const a=(0,i.useMemo)((()=>n===Y?(0,q.jsx)(Q,{label:"Select Page",placeholder:"Select",name:"unsubscribe_redirect_page",rules:[z]}):(0,q.jsx)(f.A,{label:(0,m.__)("Redirect URL","vendtics"),name:"unsubscribe_redirect_url",rules:[z]})),[n]);return{form:t,details:l,onChange:({target:{value:e}})=>{s(e)},hasResolved:r,selectRadioBtn:n,renderSelectedComponent:a,handleSaveGeneralSettings:async t=>{const s={settings:{...l.settings,general:{...t,after_unsubscribe:n}}};try{const t=await e(s);g.Ay.success((0,m.__)(t.message,"vendtics"))}catch(e){console.error(e.message),g.Ay.error(e.message)}}}})(t);return a?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ee,{form:n}),(0,q.jsx)(X,{children:(0,q.jsxs)(s.Flex,{align:"flex-start",gap:"16px",children:[(0,q.jsxs)(s.FlexItem,{style:{flexBasis:"40%"},children:[(0,q.jsx)(A,{children:"Unsubscribe Page Settings"}),(0,q.jsx)(S,{children:"Lorem Ipsum is simply dummy text of the printing and typesetting industry."})]}),(0,q.jsx)(s.FlexItem,{style:{flexBasis:"60%"},children:(0,q.jsx)(_.A,{children:(0,q.jsx)(h.A,{onFinish:x,form:n,initialValues:l?.settings?.general||{},children:(0,q.jsxs)(s.Flex,{direction:"column",gap:"16px",children:[(0,q.jsx)(Q,{label:"Confirmation Page",placeholder:"Select",name:"unsubscribe_confirm_page",rules:[z]}),(0,q.jsx)("h4",{className:"vendtics-general-setting-text",children:"After Unsubscription"}),(0,q.jsx)(K,{onChange:r,value:o}),d]})})})})]})})]}):(0,q.jsx)(u.A,{})}));var se=n(74247),ie=n(24893);const le=(0,ie.Q)((function(){return(0,q.jsx)(se.CustomFieldsSlot.Slot,{children:e=>(0,q.jsx)(q.Fragment,{children:e})})})),re=[{label:"Recommended",value:"recommended"},{label:"Manual",value:"manual"}],ae=[{host:"1and1",limit:30,frequency:"5_min"},{host:"BlueHost",limit:70,frequency:"30_min"},{host:"DomainFactory (df.eu)",limit:115,frequency:"15_min"},{host:"DreamHost",limit:25,frequency:"15_min"},{host:"Free.fr",limit:18,frequency:"15_min"},{host:"FrogHost.com",limit:490,frequency:"30_min"},{host:"Gmail",limit:20,frequency:"60_min"},{host:"Google Apps",limit:10,frequency:"30_min"},{host:"GoDaddy",limit:5,frequency:"30_min"},{host:"Goneo",limit:60,frequency:"15_min"},{host:"GreenGeeks",limit:45,frequency:"30_min"},{host:"hawkhost.com",limit:25,frequency:"5_min"},{host:"Hivetec",limit:20,frequency:"15_min"},{host:"Host Gator",limit:115,frequency:"15_min"},{host:"Hostinger",limit:100,frequency:"30_min"},{host:"Host Monster",limit:115,frequency:"15_min"},{host:"Hosting 2GO",limit:45,frequency:"15_min"},{host:"Hotmail",limit:24,frequency:"5_min"},{host:"Infomaniak",limit:20,frequency:"15_min"},{host:"InMotion",limit:20,frequency:"5_min"},{host:"JustHost",limit:70,frequency:"30_min"},{host:"Lunarpages",limit:19,frequency:"15_min"},{host:"Media Temple",limit:115,frequency:"15_min"},{host:"NameCheap",limit:50,frequency:"60_min"},{host:"Netfirms",limit:200,frequency:"60_min"},{host:"Netissime",limit:40,frequency:"60_min"},{host:"one.com",limit:25,frequency:"5_min"},{host:"PHPNet",limit:25,frequency:"5_min"},{host:"PlanetHoster",limit:90,frequency:"30_min"},{host:"Rochen",limit:40,frequency:"60_min"},{host:"ServerMX.com",limit:120,frequency:"1_min"},{host:"Siteground",limit:95,frequency:"15_min"},{host:"Site5",limit:41,frequency:"5_min"},{host:"Synthesis",limit:250,frequency:"15_min"},{host:"Techark",limit:60,frequency:"15_min"},{host:"VPS.net",limit:90,frequency:"30_min"},{host:"Webcity",limit:19,frequency:"15_min"},{host:"Westhost",limit:225,frequency:"15_min"},{host:"wpwebhost.com",limit:95,frequency:"30_min"},{host:"Vexxhost",limit:60,frequency:"15_min"},{host:"Yahoo",limit:95,frequency:"60_min"},{host:"Others",limit:25,frequency:"5_min"}],oe=[{label:(0,m.__)("Every Minute","vendtics"),value:"1_min"},{label:(0,m.__)("Every 2 Minutes","vendtics"),value:"2_min"},{label:(0,m.__)("Every 5 Minutes","vendtics"),value:"5_min"},{label:(0,m.__)("Every 10 Minutes","vendtics"),value:"10_min"},{label:(0,m.__)("Every 15 Minutes","vendtics"),value:"15_min"},{label:(0,m.__)("Every 30 Minutes","vendtics"),value:"30_min"},{label:(0,m.__)("Every Hour","vendtics"),value:"60_min"}];var ce=n(94681);const de=D.Ay.object({from_name:D.Ay.string({required_error:"From name is required"}).trim().min(2,{message:"From name is required"}),frequency:D.Ay.string({required_error:"Frequency is required"}).trim().min(2,{message:"Frequency is required"}),host:D.Ay.string({required_error:"Host is required"}).trim().min(2,{message:"Host is required"}),limit:D.Ay.number().int(),from_email:D.Ay.string({required_error:"Email is required"}).trim().min(2,{message:"From name is required"}).email()}),me=(0,G.w)(de);var ue=n(82604);const he=ae.map((e=>({value:e.host.toLowerCase().replace(/\s+/g,"_"),label:e.host})));function xe(e){const{selectRadioBtn:t,handleSelectHost:n,sentEmailPerDay:i,setLimitAndFrequency:l}=e;return t===re[0].value?(0,q.jsx)(ue.A,{message:(0,m.__)("Maximum 300 Emails every 60 minutes.","vendtics"),type:"info",showIcon:!0}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(y.A,{label:(0,m.__)("Host","vendtics"),options:he,placeholder:(0,m.__)("Select Host","vendtics"),name:"host",required:!0,onChange:n,rules:[me]}),(0,q.jsxs)(s.__experimentalGrid,{gap:6,children:[(0,q.jsx)(ce.A,{label:(0,m.__)("Emails","vendtics"),name:"limit",rules:[me],onChange:e=>l((t=>({...t,limit:e})))}),(0,q.jsx)(y.A,{label:(0,m.__)("Frequency","vendtics"),options:oe,placeholder:(0,m.__)("Select","vendtics"),name:"frequency",rules:[me],onChange:e=>l((t=>({...t,frequency:+e.split("_")[0]})))})]}),(0,q.jsx)("div",{children:(0,q.jsx)(ue.A,{message:(0,q.jsxs)("p",{className:"vendtics-email-setting-recommended-text",children:["That's ",i||0," emails per day"]}),description:(0,q.jsxs)("p",{className:"vendtics-email-setting-manual-text",children:[(0,q.jsx)("span",{children:(0,m.__)("Warning!","vendtics")})," ",(0,m.__)("Exceeding the recommended daily email limit may violate the terms of service of your email hosting provider. To increase your email-sending capacity, please reach out to your email hosting provider for assistance.","vendtics")]}),type:"warning",showIcon:!0,icon:(0,q.jsx)(w.aT,{})})})]})}var ge=n(31890);const pe=b.A.div`
	padding: 30px;
	border-radius: 8px;
	background-color: ${v.l.light};
	height: 70vh;
	overflow-y: auto;
	&::-webkit-scrollbar {
		display: none;
	}

	.vendtics-email-setting-text {
		color: ${v.l.neutral800};
		font-size: 14px;
		font-weight: 600;
	}
	.vendtics-email-setting-recommended-text {
		color: ${v.l.neutral800};
		font-size: 14px;
		font-weight: 600;
		line-height: normal;
		margin-bottom: 5px;
	}
	.vendtics-email-setting-manual-text {
		color: ${v.l.neutral800};
		font-size: 14px;
		font-weight: 400;

		span {
			color: #ef4444;
		}
	}
`,_e=(0,b.A)(J.Ay)`
	border-radius: 6px;
	padding: 12px 14px;
	border: 1px solid ${v.l.neutral300};
	background: ${v.l.light};
	width: 100%;
	justify-content: flex-start;
`;function fe(e){const{onChange:t,value:n}=e;return(0,q.jsx)(ge.FormRadioButton,{label:"Sending Frequency",style:{width:"100%"},children:(0,q.jsx)(J.Ay.Group,{onChange:t,value:n,block:!0,children:(0,q.jsx)(s.__experimentalGrid,{columns:2,gap:6,style:{width:"100%"},children:re.map((e=>(0,q.jsx)(_e,{value:e.value,children:e.label},e.value)))})})})}function ye(e){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(s.Fill,{name:a.A.SETTINGS_SECONDARY_HEADER_LEFT,children:(0,q.jsx)("h3",{children:"Email Settings"})}),(0,q.jsx)(s.Fill,{name:a.A.SETTINGS_SECONDARY_HEADER_RIGHT,children:(0,q.jsx)(R.A,{variant:B.zB,onClick:e.form.submit,children:"Save Changes"})})]})}const je=(0,c.withDispatch)((e=>({saveSettings:e(p.A.SETTINGS).saveSettings}))),ve=(0,d.compose)([je])((function(e){const{form:t,details:n,hasResolved:l,selectRadioBtn:r,handleSelectRadioBtn:a,renderSelectedComponent:o,handleSaveEmailSetting:d}=(({saveSettings:e})=>{const[t]=h.A.useForm(),[n,s]=(0,i.useState)(0),[l,r]=(0,i.useState)({limit:0,frequency:0}),[a,o]=(0,i.useState)(re[0].value),{details:d,hasResolved:u}=(0,c.useSelect)((e=>{const t=e(p.A.SETTINGS);return{details:t.getDetails(),hasResolved:t.hasFinishedResolution("getDetails")}}));return(0,i.useEffect)((()=>{s(l.limit*(1440/l.frequency))}),[l]),(0,i.useEffect)((()=>(({details:e,setSelectRadioBtn:t,setLimitAndFrequency:n})=>{if(e){t(e?.settings?.email?.frequency_type);const s=e?.settings?.email.limit;n({limit:s,frequency:e?.settings?.email.frequency?+e?.settings?.email.frequency.split("_")[0]:0})}})({details:d,setSelectRadioBtn:o,setLimitAndFrequency:r})),[d]),{form:t,details:d,hasResolved:u,selectRadioBtn:a,handleSelectRadioBtn:({target:{value:e}})=>o(e),renderSelectedComponent:(0,q.jsx)(xe,{selectRadioBtn:a,sentEmailPerDay:n,handleSelectHost:(e,n)=>{const s=ae.find((e=>e.host===n.label));if(s){t.setFieldsValue({limit:s.limit,frequency:s.frequency});const e=s.limit,n=s.frequency?+s.frequency.split("_")[0]:0;r({limit:e,frequency:n})}},setLimitAndFrequency:r}),handleSaveEmailSetting:async t=>{try{const n=((e,t,n)=>(n===re.RECOMMENDED&&(e.limit=300,e.frequency="60_min"),{settings:{...t.settings,email:{...e,frequency_type:n}}}))(t,d,a),s=await e(n);g.Ay.success((0,m.__)(s.message,"vendtics"))}catch(e){console.error(e.message),g.Ay.error(e.message)}}}})(e);return l?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ye,{form:t}),(0,q.jsx)(pe,{children:(0,q.jsxs)(s.Flex,{align:"flex-start",gap:"16px",children:[(0,q.jsxs)(s.FlexItem,{style:{flexBasis:"40%"},children:[(0,q.jsx)(A,{children:"Default Email Settings"}),(0,q.jsx)(S,{children:"Lorem Ipsum is simply dummy text of the printing and typesetting industry."})]}),(0,q.jsx)(s.FlexItem,{style:{flexBasis:"60%"},children:(0,q.jsx)(h.A,{onFinish:d,form:t,initialValues:n?.settings?.email||{},children:(0,q.jsx)(_.A,{children:(0,q.jsxs)(s.Flex,{direction:"column",gap:"16px",children:[(0,q.jsxs)(s.__experimentalGrid,{columns:2,gap:6,children:[(0,q.jsx)(f.A,{label:(0,m.__)("From Name","vendtics"),name:"from_name",required:!0,rules:[me]}),(0,q.jsx)(f.A,{label:(0,m.__)("From Email","vendtics"),name:"from_email",required:!0,rules:[me]})]}),(0,q.jsxs)(s.Flex,{direction:"column",gap:"16px",children:[(0,q.jsx)(fe,{onChange:a,value:r}),o]})]})})})})]})})]}):(0,q.jsx)(u.A,{})}));var be=n(27174),Ae=n(12609);const Se=D.Ay.object({redirect_to_page:D.Ay.string({required_error:"Select redirect Page"}).trim(),redirect_url:D.Ay.string({required_error:"Redirect URL is required"}).trim().min(1,{message:"Redirect URL is required"}).url({message:"Invalid URL"})}),qe=(0,G.w)(Se),Fe="redirect_to_page",Re=b.A.div`
	padding: 30px;
	border-radius: 8px;
	background-color: ${v.l.light};
	height: 70vh;
	overflow-y: auto;
	&::-webkit-scrollbar {
		display: none;
	}
	.vendtics-double-setting-text {
		color: ${v.l.neutral800};
		font-size: 16px;
		font-weight: 500;
		margin-top: 16px;
		margin-bottom: 12px;
	}
`,Ee=(0,b.A)(J.Ay)`
	border-radius: 6px;
	padding: 12px 14px;
	border: 1px solid ${v.l.neutral300};
	background: ${v.l.light};
	width: 100%;
`,Ie=b.A.h3`
	color: ${v.l.neutral800};
	font-size: 14px;
	font-weight: 600;
`;function Ce(e){const{onChange:t,value:n}=e;return(0,q.jsx)(J.Ay.Group,{onChange:t,value:n,children:(0,q.jsxs)(s.Flex,{justify:"flex-start",gap:"16px",children:[(0,q.jsx)(Ee,{value:Fe,children:(0,m.__)("Redirect to page","vendtics")}),(0,q.jsx)(Ee,{value:"redirect_to_custom_url",children:(0,m.__)("Redirect to custom URL","vendtics")})]})})}function we(e){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(s.Fill,{name:a.A.SETTINGS_SECONDARY_HEADER_LEFT,children:(0,q.jsx)("h3",{children:"Double Opt-In"})}),(0,q.jsx)(s.Fill,{name:a.A.SETTINGS_SECONDARY_HEADER_RIGHT,children:(0,q.jsx)(R.A,{variant:B.zB,onClick:e.form.submit,children:"Save Changes"})})]})}function Te({enable:e,handleEnable:t}){return(0,q.jsxs)(s.Flex,{align:"center",justify:"flex-start",gap:"14px",children:[(0,q.jsx)(s.FlexItem,{children:(0,q.jsx)(Ae.A,{onChange:t,value:e})}),(0,q.jsx)(s.FlexItem,{children:(0,q.jsx)(Ie,{children:e?"Enable":"Disable"})})]})}const Be=(0,c.withDispatch)((e=>({saveSettings:e(p.A.SETTINGS).saveSettings}))),De=(0,d.compose)([Be])((function(e){const{saveSettings:t}=e,{form:n,state:l,details:r,onChange:a,hasResolved:o,setEmailBody:d,handleEnable:x,renderSelectedComponent:y,handleSaveDoubleOptinSetting:j}=(e=>{const[t]=h.A.useForm(),[n,s]=(0,i.useState)({enable:!0,emailBody:"",selectRadioBtn:Fe}),{details:l,hasResolved:r}=(0,c.useSelect)((e=>{const t=e(p.A.SETTINGS);return{details:t.getDetails(),hasResolved:t.hasFinishedResolution("getDetails")}}));(0,i.useEffect)((()=>(e=>{e&&s({enable:e?.settings?.double_optin?.status,emailBody:e?.settings?.double_optin?.email_body||"",selectRadioBtn:e?.settings?.double_optin?.after_confirmation})})(l)),[l]);const a=(0,i.useMemo)((()=>n.selectRadioBtn===Fe?(0,q.jsx)(Q,{label:"Select Page",placeholder:"Select",name:"redirect_to_page",rules:[qe]}):(0,q.jsx)(f.A,{label:(0,m.__)("Redirect URL","vendtics"),name:"redirect_url",rules:[qe]})),[n.selectRadioBtn]);return{form:t,state:n,details:l,onChange:({target:{value:e}})=>s((t=>({...t,selectRadioBtn:e}))),hasResolved:r,handleEnable:e=>s((t=>({...t,enable:e}))),renderSelectedComponent:a,handleSaveDoubleOptinSetting:async t=>{try{const s=(e=>({settings:{...l.settings,double_optin:{...e,status:n.enable,email_body:n.emailBody,after_confirmation:n.selectRadioBtn}}}))(t),i=await e(s);g.Ay.success((0,m.__)(i.message,"vendtics"))}catch(e){console.error(e.message),g.Ay.error(e.message)}},setEmailBody:e=>s((t=>({...t,emailBody:e})))}})(t);return o?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(we,{form:n}),(0,q.jsx)(Re,{children:(0,q.jsxs)(s.Flex,{align:"flex-start",gap:"16px",children:[(0,q.jsxs)(s.FlexItem,{style:{flexBasis:"40%"},children:[(0,q.jsx)(A,{children:"Enable Double Opt-In"}),(0,q.jsx)(S,{children:"Lorem Ipsum is simply dummy text of the printing and typesetting industry."})]}),(0,q.jsx)(s.FlexItem,{style:{flexBasis:"60%"},children:(0,q.jsx)(h.A,{onFinish:j,form:n,initialValues:r?.settings?.double_optin||{},children:(0,q.jsx)(_.A,{title:(0,q.jsx)(Te,{enable:l.enable,handleEnable:x}),styles:{body:{display:l.enable?"block":"none"}},children:l.enable?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(s.__experimentalGrid,{columns:2,gap:5,children:[(0,q.jsx)(f.A,{label:(0,m.__)("Email Subject","vendtics"),name:"email_subject"}),(0,q.jsx)(f.A,{label:(0,m.__)("Email Pre Header","vendtics"),name:"email_pre_header"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("h4",{className:"vendtics-double-setting-text",children:(0,m.__)("Email Body","vendtics")}),(0,q.jsx)(be.A,{value:l.emailBody,onChange:e=>d(e),useExtendStyles:!0})]}),(0,q.jsx)("h4",{className:"vendtics-double-setting-text",style:{marginTop:"10px"},children:(0,m.__)("Action After Confirmation","vendtics")}),(0,q.jsxs)(s.Flex,{direction:"column",gap:"16px",children:[(0,q.jsx)(Ce,{onChange:a,value:l.selectRadioBtn}),y]})]}):null})})})]})})]}):(0,q.jsx)(u.A,{})})),Ge=(0,ie.Q)((function(){return(0,q.jsx)(se.WebhookSlot.Slot,{children:e=>(0,q.jsx)(q.Fragment,{children:e})})}));function Ne(){return(0,q.jsxs)(i.Fragment,{children:[(0,q.jsx)(s.Fill,{name:a.A.PRIMARY_HEADER_NAME,children:"Settings"}),(0,q.jsx)(l.BV,{children:(0,q.jsxs)(l.qh,{element:(0,q.jsx)(o.C1,{}),children:[(0,q.jsx)(l.qh,{index:!0,element:(0,q.jsx)(r.A,{children:(0,q.jsx)(M,{})},"business-settings")}),(0,q.jsx)(l.qh,{path:"general",element:(0,q.jsx)(r.A,{children:(0,q.jsx)(ne,{})},"general-settings")}),(0,q.jsx)(l.qh,{path:"custom-fields",element:(0,q.jsx)(r.A,{children:(0,q.jsx)(le,{bgUrl:""})},"custom-fields")}),(0,q.jsx)(l.qh,{path:"email",element:(0,q.jsx)(r.A,{children:(0,q.jsx)(ve,{})},"email")}),(0,q.jsx)(l.qh,{path:"double-optin",element:(0,q.jsx)(r.A,{children:(0,q.jsx)(De,{})},"double-optin")}),(0,q.jsx)(l.qh,{path:"webhook",element:(0,q.jsx)(r.A,{children:(0,q.jsx)(Ge,{bgUrl:""})},"webhook")})]})})]})}}}]);