import{b as a}from"./useflows-BpG3C9m1.js";import{e as t}from"./main-few-lands-burn.js";import{s as c}from"./machine.-BRuqPpdF.js";import"./mutative-C6xjlr6O.js";import"./lodash-YpNkAOPN.js";const u=a(({helpers:i})=>({states:{components:[{addConnectionHelpingText:t("You can get your API key from your OneHash My Settings > Settings > API Access"),componentName:i.componentName.connection,connectionsTypes:[{encryptKeys:["value"],label:t("API Key"),type:"api_key",verifyConnection:{headers:{Authorization:"","Content-Type":"application/json"},method:"GET",responseKeyMatch:["data"],url:""}}],extraComponents:[{componentName:i.componentName.input,id:"domain",label:t("Domain"),onChange:"SET_DOMAIN",placeholder:t("Enter Domain"),render:!0,required:!0,value:void 0,wrapperClassName:"mb-2"}],extraData:{},fieldType:"config",id:"connection-id",label:t("Select Connection"),onConnectionAddChange:"CONNECTION_ADD_CHANGE",onConnectionChange:"SET_CONNECTION",render:!0,value:void 0}]},actions:{ON_MACHINE_LOAD:({$:e})=>{c(e,[{db:"connectionId",id:"connection-id"}])},CONNECTION_ADD_CHANGE:({$:e,e:o})=>{e.setThisComponent(n=>{e.util.isConnectionComponent(n)&&n.connectionsTypes[0]?.verifyConnection?.headers&&(n.connectionsTypes[0].verifyConnection.headers.Authorization=`token ${o.key}:${o.value}`)})},SET_DOMAIN:({$:e,e:o})=>{e.setThisComponent(n=>{e.util.isInputComponent(n)&&(n.value=o.target.value,n.status=void 0)}),e.setComponent("connection-id",n=>{e.util.isConnectionComponent(n)&&(n.connectionsTypes[0]?.verifyConnection&&(n.connectionsTypes[0].verifyConnection.url=`https://${o.target.value}.onehash.is/api/resource/Lead`),n.extraData||(n.extraData={}),n.extraData.domain=o.target.value)})}}}));export{u as default};
