1import{ak as X,f as ee,k as te,q as S,o as se,b as oe,c as b,g as d,h as r,G as p,t as a,i as e,H as A,Y as t,al as g,aq as M,I,az as u,b7 as N,b2 as c}from"./B6nVQaMA.js";import{u as ne}from"./useMailOutSettings-l-lg9IRT0.js";import"./lodash-C5hb1S-ZT.js";const ae={class:"mo-settings"},le={key:0},ie={key:1,class:"mo-settings--muted"},de={key:2,class:"mo-settings--muted"},re={class:"mo-settings--lede"},_e={class:"label"},ue={key:0,class:"mo-settings--warnings"},ce={class:"mo-settings--switches"},pe={class:"sw"},me={class:"sw"},he={key:0},ke={key:1},ve={class:"mo-settings--field"},be={class:"k"},ge={class:"providers"},ye=["onClick"],fe={class:"mo-settings--field"},we={class:"k"},xe=["placeholder"],Se={class:"hint"},Ae={key:0,class:"stored"},Me=["disabled"],Ve={key:1,class:"mo-settings--field"},Ce={class:"k"},Ke=["placeholder"],Te={class:"hint"},Ue={key:0,class:"stored"},Re=["disabled"],Le={class:"mo-settings--field"},ze={class:"k"},Be={class:"hint"},Pe={class:"addr"},Ie=["placeholder"],Ne=["placeholder"],We=["placeholder"],$e=["placeholder"],De=["placeholder"],Ee=["placeholder"],je={class:"mo-settings--field is-narrow"},qe={class:"k"},Fe=["aria-label"],He={class:"hint"},Oe={class:"mo-settings--actions"},Ge=["disabled"],Ye=["disabled"],Ze={key:0,class:"note is-ok"},Je={key:1,class:"note is-error"},Qe={__name:"SettingsPanel",props:{showTitle:{type:Boolean,default:!0}},setup(W){const{t:i}=ee(),{settings:_,canManage:$,loading:D,saving:v,testing:V,load:E,save:w,testConnection:j}=ne(),q={click2mail:"Click2Mail",lob:"Lob"},o=te({enabled:!1,provider:"click2mail",testMode:!0,maxRecipients:100,apiKey:"",webhookSecret:"",fromAddress:{name:"",company:"",line1:"",line2:"",city:"",state:"",zip:""}}),k=S(null),m=S(""),h=S(null);let x=null;const y=()=>{const n=_.value;if(!n)return;o.enabled=!!n.enabled,o.provider=n.provider||"click2mail",o.testMode=n.testMode!==!1,o.maxRecipients=n.maxRecipients||100,o.apiKey="",o.webhookSecret="";const s=n.fromAddress||{};o.fromAddress={name:s.name||"",company:s.company||"",line1:s.line1||"",line2:s.line2||"",city:s.city||"",state:s.state||"",zip:s.zip||""}};se(async()=>{await E({force:!0}),y()}),oe(()=>clearTimeout(x));const F=b(()=>{var n;return((n=_.value)==null?void 0:n.availableProviders)||["click2mail","lob"]}),H=n=>q[n]||n,f=b(()=>o.provider==="lob"),O=b(()=>f.value?"Lob secret key from the dashboard â test_⦠while you are trying it out, live_⦠for real postage.":"Click2Mail has no API keys: paste your account login as username:password on one line."),G=b(()=>{var n;return(n=_.value)!=null&&n.hasApiKey?`Stored: ${_.value.apiKeyMasked} â leave blank to keep it`:f.value?"test_xxxxxxxxxxxxxxxx":"username:password"}),Y=b(()=>{var n;return _.value?(n=_.value.status)!=null&&n.ready?"ok":"warn":"muted"}),C=async()=>{m.value="",k.value=null,h.value=null;const n={enabled:o.enabled,provider:o.provider,testMode:o.testMode,maxRecipients:Number(o.maxRecipients)||100,fromAddress:{...o.fromAddress}};o.apiKey.trim()&&(n.apiKey=o.apiKey.trim()),o.webhookSecret.trim()&&(n.webhookSecret=o.webhookSecret.trim());const s=await w(n);s!=null&&s.status?(y(),k.value="saved",clearTimeout(x),x=setTimeout(()=>{k.value==="saved"&&(k.value=null)},2500)):(k.value="error",m.value=((s==null?void 0:s.errors)||[]).join(", ")||"Could not save.")},Z=async()=>{m.value="",h.value=null;const n=await w({clearApiKey:!0});n!=null&&n.status?y():m.value=((n==null?void 0:n.errors)||[]).join(", ")||"Could not clear the key."},J=async()=>{m.value="";const n=await w({clearWebhookSecret:!0});n!=null&&n.status&&y()},Q=async()=>{var n;h.value=null,(o.apiKey.trim()||o.provider!==((n=_.value)==null?void 0:n.provider))&&await C(),h.value=await j()};return(n,s)=>{var K,T,U,R,L,z,B,P;return r(),d("div",ae,[W.showTitle?(r(),d("h3",le,a(e(i)("mail_out.settings_panel.mail_out")),1)):p("",!0),e(D)&&!e(_)?(r(),d("div",ie,a(e(i)("mail_out.settings_panel.loading")),1)):e($)?(r(),d(A,{key:3},[t("p",re,[g(a(e(i)("mail_out.settings_panel.print_mail_reports_through"))+" ",1),t("strong",null,a(e(i)("mail_out.settings_panel.click2mail")),1),g(" "+a(e(i)("mail_out.settings_panel.pay_per_piece_no_subscription_or"))+" ",1),s[12]||(s[12]=t("strong",null,"Lob",-1)),g(" "+a(e(i)("mail_out.settings_panel.per_letter_tracking_webhooks_the_key")),1)]),t("div",{class:M(["mo-settings--status",`is-${e(Y)}`])},[s[13]||(s[13]=t("span",{class:"dot"},null,-1)),t("span",_e,a(((T=(K=e(_))==null?void 0:K.status)==null?void 0:T.label)||"â"),1)],2),(L=(R=(U=e(_))==null?void 0:U.status)==null?void 0:R.warnings)!=null&&L.length?(r(),d("ul",ue,[(r(!0),d(A,null,I(e(_).status.warnings,l=>(r(),d("li",{key:l},a(l),1))),128))])):p("",!0),t("div",ce,[t("label",pe,[u(t("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>e(o).enabled=l),type:"checkbox"},null,512),[[N,e(o).enabled]]),t("span",null,[t("strong",null,a(e(i)("mail_out.settings_panel.enabled")),1),t("em",null,a(e(i)("mail_out.settings_panel.master_switch_off_means_nothing_can")),1)])]),t("label",me,[u(t("input",{"onUpdate:modelValue":s[1]||(s[1]=l=>e(o).testMode=l),type:"checkbox"},null,512),[[N,e(o).testMode]]),t("span",null,[t("strong",null,a(e(i)("mail_out.settings_panel.test_mode")),1),e(f)?(r(),d("em",he,a(e(i)("mail_out.settings_panel.expect_a_test_key_lob_accepts")),1)):(r(),d("em",ke,a(e(i)("mail_out.settings_panel.use_click2mail_s_stage_sandbox_stage")),1))])])]),t("div",ve,[t("span",be,a(e(i)("mail_out.settings_panel.provider")),1),t("div",ge,[(r(!0),d(A,null,I(e(F),l=>(r(),d("button",{key:l,type:"button",class:M(["chip",{on:e(o).provider===l}]),onClick:Xe=>e(o).provider=l},a(H(l)),11,ye))),128))])]),t("div",fe,[t("span",we,a(e(i)("mail_out.settings_panel.api_key")),1),u(t("input",{"onUpdate:modelValue":s[2]||(s[2]=l=>e(o).apiKey=l),type:"password",autocomplete:"off",spellcheck:"false",placeholder:e(G)}
1,null,8,xe),[[c,e(o).apiKey]]),t("div",Se,a(e(O)),1),(z=e(_))!=null&&z.hasApiKey?(r(),d("div",Ae,[s[14]||(s[14]=g(" Stored key ",-1)),t("code",null,a(e(_).apiKeyMasked),1),t("button",{type:"button",class:"link",disabled:e(v),onClick:Z},a(e(i)("mail_out.settings_panel.remove")),9,Me)])):p("",!0)]),e(f)?(r(),d("div",Ve,[t("span",Ce,a(e(i)("mail_out.settings_panel.webhook_signing_secret")),1),u(t("input",{"onUpdate:modelValue":s[3]||(s[3]=l=>e(o).webhookSecret=l),type:"password",autocomplete:"off",spellcheck:"false",placeholder:(B=e(_))!=null&&B.hasWebhookSecret?`Stored: ${e(_).webhookSecretMasked} â leave blank to keep it`:"whsec_â¦"},null,8,Ke),[[c,e(o).webhookSecret]]),t("div",Te,a(e(i)("mail_out.settings_panel.lob_dashboard_webhooks_signing_secret_without")),1),(P=e(_))!=null&&P.hasWebhookSecret?(r(),d("div",Ue,[s[15]||(s[15]=g(" Stored secret ",-1)),t("code",null,a(e(_).webhookSecretMasked),1),t("button",{type:"button",class:"link",disabled:e(v),onClick:J},a(e(i)("mail_out.settings_panel.remove")),9,Re)])):p("",!0)])):p("",!0),t("div",Le,[t("span",ze,a(e(i)("mail_out.settings_panel.return_address")),1),t("div",Be,a(e(i)("mail_out.settings_panel.printed_as_the_sender_on_every")),1),t("div",Pe,[u(t("input",{"onUpdate:modelValue":s[4]||(s[4]=l=>e(o).fromAddress.name=l),placeholder:e(i)("mail_out.settings_panel.name")},null,8,Ie),[[c,e(o).fromAddress.name]]),u(t("input",{"onUpdate:modelValue":s[5]||(s[5]=l=>e(o).fromAddress.company=l),placeholder:e(i)("mail_out.settings_panel.company")},null,8,Ne),[[c,e(o).fromAddress.company]]),u(t("input",{"onUpdate:modelValue":s[6]||(s[6]=l=>e(o).fromAddress.line1=l),class:"wide",placeholder:e(i)("mail_out.settings_panel.address_line_1")},null,8,We),[[c,e(o).fromAddress.line1]]),u(t("input",{"onUpdate:modelValue":s[7]||(s[7]=l=>e(o).fromAddress.line2=l),class:"wide",placeholder:e(i)("mail_out.settings_panel.address_line_2")},null,8,$e),[[c,e(o).fromAddress.line2]]),u(t("input",{"onUpdate:modelValue":s[8]||(s[8]=l=>e(o).fromAddress.city=l),placeholder:e(i)("mail_out.settings_panel.city")},null,8,De),[[c,e(o).fromAddress.city]]),u(t("input",{"onUpdate:modelValue":s[9]||(s[9]=l=>e(o).fromAddress.state=l),placeholder:e(i)("mail_out.settings_panel.state")},null,8,Ee),[[c,e(o).fromAddress.state]]),u(t("input",{"onUpdate:modelValue":s[10]||(s[10]=l=>e(o).fromAddress.zip=l),placeholder:"ZIP *"},null,512),[[c,e(o).fromAddress.zip]])])]),t("div",je,[t("span",qe,a(e(i)("mail_out.settings_panel.recipient_limit_per_send")),1),u(t("input",{"onUpdate:modelValue":s[11]||(s[11]=l=>e(o).maxRecipients=l),type:"number",min:"1",max:"5000","aria-label":e(i)("mail_out.settings_panel.recipient_limit_per_send")},null,8,Fe),[[c,e(o).maxRecipients]]),t("div",He,a(e(i)("mail_out.settings_panel.hard_cap_on_one_bulk_mail")),1)]),t("div",Oe,[t("button",{type:"button",class:"btn is-primary",disabled:e(v),onClick:C},a(e(v)?"Savingâ¦":"Save"),9,Ge),t("button",{type:"button",class:"btn",disabled:e(v)||e(V),onClick:Q},a(e(V)?"Testingâ¦":"Test connection"),9,Ye),e(k)==="saved"?(r(),d("span",Ze,"Saved")):p("",!0),e(m)?(r(),d("span",Je,a(e(m)),1)):p("",!0)]),e(h)?(r(),d("div",{key:2,class:M(["mo-settings--test",e(h).status?"is-ok":"is-error"])},a(e(h).message),3)):p("",!0)],64)):(r(),d("div",de,a(e(i)("mail_out.settings_panel.mail_out_keys_are_managed_by")),1))])}}},ot=X(Qe,[["__scopeId","data-v-8f5db04f"]]);export{ot as default};
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.