import{aa as r,ab as d}from"./_applist-tangy-colts-beg-36.js";import{_ as e}from"./main-tangy-colts-beg.js";import{s as m}from"./machine.-tangy-colts-beg-869.js";import{a as n,h as E,c as u}from"./brevocom-tangy-colts-beg-591.js";import{f as o,a as s}from"./machineh-tangy-colts-beg-4.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(l,t){return this.cache.has(l)?this.cache.get(l):(this.cache.set(l,t),t)}};const p=["email-blacklist-id","sms-blacklist-id","update-id","smtp-sender-list"],h=r(({helpers:l})=>({states:{components:[u(l),{componentName:l.componentName.mixInput,helperText:e("Email address of the user. Mandatory if SMS field is not passed in Attributes."),id:"email-id",label:e("Email"),onChange:"SET_EMAIL",path:"email",render:"IF_CONNECTION_SELECTED",value:[]},{addItemButtonLabel:e("Add Attributes"),componentName:l.componentName.repeaterField,fieldsMetaData:[{componentName:l.componentName.select,label:e("Title"),name:"brevoField",options:[],required:!0,style:{width:150},value:""},{componentName:l.componentName.mixInput,label:e("Value"),name:"value",required:!0,value:[],wrapperClassName:"w-100"}],id:"attributes-list",inputGroupProps:{label:e("Attribute #{COUNT}")},label:e("Attribute Fields"),onChange:"ON_FIELD_MAP_CHANGE",render:"IF_CONNECTION_SELECTED",value:void 0},{componentName:l.componentName.select,fieldType:"config",helperText:e("Select the contact list to create contacts to."),id:"list-id",label:e("Contact list"),onChange:"SELECT_LIST",onRefetch:"REFETCH_CONTACT_LIST",optionFilterProp:"label",options:[],placeholder:e("Select a list"),render:"IF_CONNECTION_SELECTED",required:!0,showSearch:!0,value:void 0},{componentName:l.componentName.switch,id:"show-advance-feature",label:e("Select Advance Feature"),onChange:"SET_FEATURE",path:"advance-feature",render:"IF_CONNECTION_SELECTED",size:"small",value:!1},{componentName:l.componentName.select,helperText:e("Set this field to blacklist the contact for emails."),id:"email-blacklist-id",label:e("Email blacklisted"),onChange:"SET_EMAIL_BLACKLISTED",options:[{label:e("Yes"),value:"true"},{label:e("No"),value:"false"}],path:"emailBlacklisted",placeholder:e("Select Email For Blacklist"),render:"IF_ADVANCE_FEATURE_SELECTED",required:!0,value:"false"},{componentName:l.componentName.select,helperText:e("Set this field to blacklist the contact for SMS."),id:"sms-blacklist-id",label:e("SMS blacklisted"),onChange:"SET_SMS_BLACKLISTED",options:[{label:e("Yes"),value:"true"},{label:e("No"),value:"false"}],path:"smsBlacklisted",placeholder:e("Select SMS For Blacklist"),render:"IF_ADVANCE_FEATURE_SELECTED",required:!0,value:"false"},{componentName:l.componentName.select,helperText:e("Facilitate to update the existing contact in the same request (updateEnabled is true)."),id:"update-id",label:e("Update Enabled"),onChange:"SET_UPDATE",options:[{label:e("Yes"),value:"true"},{label:e("No"),value:"false"}],path:"updateEnabled",placeholder:e("Select For Update"),render:"IF_ADVANCE_FEATURE_SELECTED",required:!0,value:"false"},{addItemButtonLabel:"Add SMTP Sender",componentName:l.componentName.repeaterField,fieldsMetaData:[{componentName:l.componentName.mixInput,label:e("Email"),name:"smtp-sender",required:!0,value:void 0,wrapperClassName:"w-100"}],helperText:e("Transactional email forbidden sender for contact. Use only for email Contact (updateEnabled is true)."),id:"smtp-sender-list",inputGroupProps:{label:e("SMTP Sender #{COUNT}")},label:e("SMTP blacklist sender"),loading:!1,onChange:"ON_STMP_FIELD_CHANGE",render:"IF_ADVANCE_FEATURE_SELECTED",value:[]}]},actions:{SET_CONNECTION:async({$:t,e:a})=>{t.setThisComponent(i=>{i.value=a}),t.setDb(i=>{i.connectionId=a}),await o(t),await s(t)},IF_CONNECTION_SELECTED:({$:t})=>{var a;return d((a=t.getComponent("connection-id"))==null?void 0:a.value)},IF_ADVANCE_FEATURE_SELECTED:({$:t})=>{var a,i;if(d((a=t.getComponent("connection-id"))==null?void 0:a.value)&&((i=t.getComponent("show-advance-feature"))==null?void 0:i.value)===!0)return!0},REFETCH_CONTACT_LIST:async({$:t})=>{await o(t)},SET_EMAIL:n("email"),SELECT_LIST:async({$:t,e:a})=>{t.setThisComponent(i=>{i.value=a}),t.setDb(i=>{i.listId=a}),await s(t)},CONNECTION_ADD_CHANGE:E,ON_FIELD_MAP_CHANGE:n("attributesList"),SET_EMAIL_BLACKLISTED:n("emailBlacklist"),SET_SMS_BLACKLISTED:n("smsBlacklist"),SET_FEATURE:({$:t,e:a})=>{t.setThisComponent(i=>{i.value=a}),t.setDb(i=>{i.advanceFeature=a}),a===!1&&p.map(i=>t.setComponent(i,c=>{c.value=void 0}))},SET_UPDATE:n("update"),ON_STMP_FIELD_CHANGE:n("smtpSender"),ON_MACHINE_LOAD:async({$:t})=>{var a;m(t,[{db:"connectionId",id:"connection-id"},{db:"listId",id:"list-id"},{db:"email",id:"email-id"},{db:"attributesList",id:"attributes-list"},{db:"emailBlackList",id:"email-blacklist-id"},{db:"smsBlacklist",id:"sms-blacklist-id"},{db:"update",id:"update-id"},{db:"smtpSender",id:"smtp-sender-list"}]),(a=t.db)!=null&&a.connectionId&&(await o(t),await s(t))}}}));export{h as default};
