import{aa as o,ab as s}from"./_applist-tangy-colts-beg-36.js";import{_ as e}from"./main-tangy-colts-beg.js";import{s as c}from"./machine.-tangy-colts-beg-869.js";import{h as n,f as i,b as d,a as m,c as E}from"./mailchim-tangy-colts-beg-692.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,a){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,a),a)}};const r=["addr1","city","zip","state"],N=o(({helpers:t})=>({states:{components:[E(t),{componentName:t.componentName.switch,fieldType:"config",helperText:e("Enable the switch to update an existing member."),id:"member-update-switch",label:e("Update Existing Member"),onChange:"SET_UPDATE_SWITCH",render:"IF_AUDIENCE_SELECTED",size:"small",value:!1},{allowClear:!0,componentName:t.componentName.select,helperText:e("Choose the list from which you want to add or update a member. After selecting the list, other fields will appear."),id:"select-audience",label:e("Select Audience List"),onChange:"HANDLE_SELECT_AUDIENCE",onRefetch:"REFETCH_AUDIENCE_LIST",options:[],path:"select-audience",render:"IF_CONNECTION_SELECTED",value:void 0},{addItemButtonLabel:"Add Field",componentName:t.componentName.repeaterField,fieldsMetaData:[{componentName:t.componentName.select,label:e("Field Name"),name:"mailchimpField",options:[],showSearch:!0,style:{width:150},value:""},{componentName:t.componentName.mixInput,label:e("Value"),name:"value",value:[],wrapperClassName:"w-100"}],id:"field-map",inputGroupProps:{label:e("Field #{COUNT}")},label:e("Merge Field Map"),labelActionIconName:"refresh-cw",labelActionOnClick:"REFETCH_AUDIENCE_FIELDS",labelActionText:e("Refetch Fields"),nonRemovableRows:[],onChange:"ON_CHANGE_FIELD_MAP_DATA",render:"IF_AUDIENCE_SELECTED",value:[]},{componentName:t.componentName.select,helperText:e("Select the status you want to assign to your member."),id:"status",label:e("Status"),onChange:"SET_STATUS",options:[{label:e("Subscribed"),value:"subscribed"},{label:e("Unsubscribed"),value:"unsubscribed"},{label:e("Cleaned"),value:"cleaned"},{label:e("Pending"),value:"pending"},{label:e("Transactional"),value:"transactional"}],path:"status",placeholder:e("Select a Status"),render:"IF_AUDIENCE_SELECTED",value:"subscribed"},{componentName:t.componentName.switch,helperText:e("Enable the switch to assign VIP status to the member."),id:"vip",label:e("VIP"),onChange:"SET_VIP",path:"vip",render:"IF_AUDIENCE_SELECTED",size:"small",value:!1},{componentName:t.componentName.switch,fieldType:"config",helperText:e("Enable the switch to map address fields with their values."),id:"address-field-switch",label:e("Address Field"),onChange:"HANDLE_ADD_ADDRESS_FIELD",render:"IF_AUDIENCE_SELECTED",size:"small",value:!1},{addItemButtonLabel:"Add Field",componentName:t.componentName.repeaterField,fieldsMetaData:[{componentName:t.componentName.select,label:e("Field Name"),name:"mailchimpAddressField",options:[{label:e("Address 1"),value:"addr1"},{label:e("Address 2"),value:"addr2"},{label:e("City"),value:"city"},{label:e("Zip"),value:"zip"},{label:e("State"),value:"state"},{label:e("Country"),value:"country"}],showSearch:!0,style:{width:150},value:""},{componentName:t.componentName.mixInput,label:e("Value"),name:"value",value:[],wrapperClassName:"w-100"}],id:"address-field-map",inputGroupProps:{label:e("Address #{COUNT}")},label:e("Address Field Map"),nonRemovableRows:[0,1,2,3],onChange:"ON_CHANGE_ADDRESS_FIELD_MAP_DATA",render:"IF_ADD_ADDRESS_SELECTED",value:r.map(a=>[{disabled:!0,name:"mailchimpAddressField",value:a},{name:"value",value:[]}])}]},actions:{SET_CONNECTION:async({$:a,e:l})=>{n("connectionId")({$:a,e:l}),await i(a)},HANDLE_SELECT_AUDIENCE:async({$:a,e:l})=>{n("audienceList")({$:a,e:l}),await d(a)},CONNECTION_ADD_CHANGE:m,HANDLE_ADD_ADDRESS_FIELD:n("addAddressField"),HANDLE_SELECT_TAG:n("selectTags"),IF_ADD_ADDRESS_SELECTED:({$:a})=>{var l;return((l=a.getComponent("address-field-switch"))==null?void 0:l.value)===!0},IF_AUDIENCE_SELECTED:({$:a})=>{var l;return s((l=a.getComponent("select-audience"))==null?void 0:l.value)},IF_CONNECTION_SELECTED:({$:a})=>{var l;return s((l=a.getComponent("connection-id"))==null?void 0:l.value)},ON_CHANGE_ADDRESS_FIELD_MAP_DATA:n("addressFieldMap"),ON_CHANGE_FIELD_MAP_DATA:n("fieldMap"),REFETCH_AUDIENCE_FIELDS:async({$:a})=>await d(a),REFETCH_AUDIENCE_LIST:async({$:a})=>await i(a),SET_STATUS:n("status"),SET_UPDATE_SWITCH:n("updateSwitch"),SET_VIP:n("vip"),ON_MACHINE_LOAD:async({$:a})=>{c(a,[{db:"connectionId",id:"connection-id"},{db:"audienceList",id:"select-audience"},{db:"fieldMap",id:"field-map"},{db:"addAddressField",id:"address-field-switch"},{db:"addressFieldMap",id:"address-field-map"},{db:"status",id:"status"},{db:"updateSwitch",id:"member-update-switch"},{db:"vip",id:"vip"}]),await Promise.all([i(a),d(a)])}}}));export{N as default};
