1import{s as D,E as x,al as G,J as B,S as H,f as M,aJ as C,aN as F,aO as O,aG as S,r as l,o as d,c as b,a as n,w as i,$ as r,F as g,g as u,t as c,l as f,h as V,aP as R}from"./index-D-iuxWOd.js";import{b as j,c as I,u as U,R as A,O as N,E as z,h as q,y as J,x as K,v as W,j as Q,w as X}from"./ToggleSwitch-BgU4tYOz-CnUDkOkJ.js";import{E as Y,b as Z,a as _}from"./EmailConfirmation-UCKIKj0U-DJZczQw9.js";import{x as tt,$ as et}from"./GPAndPostcodeInput-C_eqteAW-DfZEfoVc.js";const it={name:"LinkSubscription",components:{AddressInput:tt,DnmContentWrapper:x,DnmHeadline:G,DnmParagraph:B,DnmButton:H,GPAndPostcodeInput:et,MessageBox:M,RedirectTimer:C,ToggleSwitch:j},data(){return{currentView:"form",currentForm:"withGP",linkError:!1,linkErrorText:"",isPosting:!1,linkedEmail:""}},setup(){const{t}=Y();return Z({title:t("LinkSubscriptions.title")}),{v$:I()}},methods:{resetErrors(){this.v$.$reset(),this.linkError=!1},redirectToReturnUrl(){var e;if(this.$store.getters["userServices/userServices/getReturnUrl"]){F(this.$store,!0);return}const t=(e=window==null?void 0:window.history.state)==null?void 0:e.back;t?this.$router.replace(t):this.$router.replace("/")},requestLoginData(){this.$router.replace({name:"RequestAccessData"})},cancel(){O(this.$router,this.$route.path)},async submit(){if(this.linkError=!1,this.linkErrorText="",this.v$.$touch(),this.v$.$error){const t=this.currentForm==="withGP"?"gpAndPostcodeInput":"addressInput";U(this.$refs[t],this.v$.formData);return}this.isPosting=!0;try{let t;if(this.currentForm==="withoutGP"){const e=await S.getGpByAddress(this.formData);if(e&&e.gp)t=e.gp;else throw new Error("Unable to fetch customer number")}else t=this.formData.gp_number;await this.linkGPtoProfile(t)}catch{this.linkError=!0}this.isPosting=!1},async linkGPtoProfile(t){try{await S.linkGPToProfile({gp_number:t,postcode:this.formData.postcode}),this.currentForm==="withoutGP"?_({event:"abo_verknuepfung_reg",abo_verknuepfung_reg:"mit Adresse"},this):_({event:"abo_verknuepfung_reg",abo_verknuepfung_reg:"mit Kunden-Nr"},this);try{const e=await this.$store.dispatch("userServices/userServices/getUserData",!0);this.$store.dispatch("userServices/userServices/updateUserData",{...e,gp_number:t}),this.currentView="success"}catch{throw new Error("User segment could not be updated.")}}catch(e){if(e.response){const o=e.response.data.shift();switch(o.code){case 20:this.currentView="alreadyLinked",this.linkedEmail=o.info;return;case 2:this.linkErrorText=o.info;break}}else Object.prototype.hasOwnProperty.call(e,"response")||(this.linkErrorText=this.$t("Common.fallbackErrorInfo"));throw e}}},computed:{formData:{get(){return this.$store.getters["userServices/getFormData"]},set(t){this.$store.dispatch("userServices/setFormData",t)}},truncatedEmail(){if(this.linkedEmail==="")return"";const t=this.linkedEmail,e="*";let[o,p]=t.split("@");return o=o.substr(0,1)+e.repeat(o.length-2)+o.substr(o.length-1),p=`@${p}`,`${o}${p}`},validationRules(){let t={postcode:X};switch(this.currentForm){case"withGP":t={...t,gp_number:Q};break;case"withoutGP":t={...t,street:A,housenumber:N,city:z},this.formData.customer_type==="private"&&(t={...t,gender:q,given_name:J,family_name:K}),this.formData.customer_type==="company"&&(t={...t,company_name:W});break}return t}},validations(){return{formData:{...this.validationRules}}}},st={class:"linkSubscription"},nt=["innerHTML"],rt=["innerHTML"],ot=["innerHTML"],at={class:"linkSubscription__buttons"},lt=["innerHTML"],ut=["innerHTML"],ct={class:"linkSubscription__inputGroup"},dt={class:"linkSubscription__buttons"};function pt(t,e,o,p,s,a){const y=l("RedirectTimer"),k=l("MessageBox"),h=l("DnmButton"),v=l("DnmHeadline"),w=l("DnmParagraph"),$=l("ToggleSwitch"),L=l("GPAndPostcodeInput"),P=l("AddressInput"),T=l("DnmContentWrapper"),E=l("client-only");return d(),b("div",null,[n(E,null,{default:i(()=>[n(T,{size:"extraSmall"},{default:i(()=>[r("div",st,[s.currentView==="success"?(d(),b(g,{key:0},[n(k,{class:"linkSubscription__messageBox","data-testid":"link-subscription-success-message",type:"success"},{title:i(()=>[u(c(t.$t("LinkSubscriptions.linkSuccess.headline")),1)]),content:i(()=>[r("div",{innerHTML:t.$t("LinkSubscriptions.linkSuccess.text")},null,8,nt),e[3]||(e[3]=r("br",null,null,-1)),r("div",null,[n(y,{onFinished:a.redirectToReturnUrl},{default:i(({remainingSeconds:m})=>[r("span",{innerHTML:t.$t("LinkSubscriptions.successText",{count:m})},null,8,rt)]),_:1},8,["onFinished"])])]),_:1}),n(h,{onOnClick:a.redirectToReturnUrl,buttonStyle:"tertiary",expand:"",size:"medium"},{default:i(()=>[u(c(t.$t("LinkSubscriptions.backToNewsPortal")),1)]),_:1},8,["onOnClick"])],64)):s.currentView==="alreadyLinked"?(d(),b(g,{key:1},[n(k,{class:"linkSubscription__messageBox","data-testid":"link-subscription-already-linked-message",type:"warning"},{title:i(()=>[u(c(t.$t("LinkSubscriptions.alreadyLinked.headline")),1)]),content:i(()=>[r("div",{innerHTML:t.$t("LinkSubscriptions.alreadyLinked.text",{email:a.truncatedEmail})},null,8,ot)]),_:1}
1),r("div",at,[n(h,{disabled:s.isPosting,isLoading:s.isPosting,onOnClick:a.requestLoginData,class:"linkSubscription__submitButton",expand:"",size:"large",buttonStyle:"primary"},{default:i(()=>[u(c(t.$t("LinkSubscriptions.requestLoginData")),1)]),_:1},8,["disabled","isLoading","onOnClick"]),e[4]||(e[4]=r("br",null,null,-1)),n(h,{onOnClick:e[0]||(e[0]=m=>s.currentView="form"),buttonStyle:"tertiary",expand:"",size:"large"},{default:i(()=>[u(c(t.$t("LinkSubscriptions.back")),1)]),_:1})])],64)):(d(),b(g,{key:2},[n(v,{innerHTML:t.$t("LinkSubscriptions.headline"),class:"linkSubscription__headline","data-testid":"link-subscription-headline",headlineStyle:"headline3"},null,8,["innerHTML"]),n(w,{innerHTML:t.$t("LinkSubscriptions.subHeadline"),class:"linkSubscription__paragraph","data-testid":"link-subscription-sub-headline",paragraphStyle:"regular"},null,8,["innerHTML"]),n($,{modelValue:s.currentForm,"onUpdate:modelValue":e[1]||(e[1]=m=>s.currentForm=m),options:{left:"withGP",right:"withoutGP"},onToggle:a.resetErrors,class:"linkSubscription__toggle","data-testid":"link-subscription-form-switch"},{leftButton:i(()=>[u(c(t.$t("LinkSubscriptions.toggle.withGP")),1)]),rightButton:i(()=>[u(c(t.$t("LinkSubscriptions.toggle.withoutGP")),1)]),_:1},8,["modelValue","onToggle"]),s.linkError?(d(),f(k,{key:0,class:"linkSubscription__messageBox","data-testid":"link-subscription-message","scroll-to-when-shown":"",type:"error"},{title:i(()=>[u(c(t.$t("LinkSubscriptions.linkError.headline")),1)]),content:i(()=>[s.linkErrorText?(d(),b("div",{key:0,innerHTML:s.linkErrorText},null,8,lt)):(d(),b("div",{key:1,innerHTML:t.$t("LinkSubscriptions.linkError.text")},null,8,ut))]),_:1})):V("",!0),r("form",{onSubmit:e[2]||(e[2]=R((...m)=>a.submit&&a.submit(...m),["prevent"]))},[r("div",ct,[s.currentForm==="withGP"?(d(),f(L,{key:0,disabled:s.isPosting,"model-obj":a.formData,"vuelidate-object":p.v$.formData,"data-testid":"link-subscription-gp-postcode-input",ref:"gpAndPostcodeInput"},null,8,["disabled","model-obj","vuelidate-object"])):(d(),f(P,{key:1,disabled:s.isPosting,"model-obj":a.formData,"vuelidate-object":p.v$.formData,"data-testid":"link-subscription-address-input",ref:"addressInput","show-customer-switch":"",hideNameFieldsForCompany:""},null,8,["disabled","model-obj","vuelidate-object"]))]),r("div",dt,[n(h,{disabled:s.isPosting,isLoading:s.isPosting,onOnClick:a.submit,class:"linkSubscription__submitButton","data-testid":"link-subscription-submit-button",expand:"",size:"large",buttonStyle:"primary"},{default:i(()=>[u(c(t.$t("LinkSubscriptions.saveButton")),1)]),_:1},8,["disabled","isLoading","onOnClick"]),e[5]||(e[5]=r("br",null,null,-1)),n(h,{onOnClick:a.redirectToReturnUrl,buttonStyle:"tertiary","data-testid":"link-subscription-back-button",expand:"",size:"large"},{default:i(()=>[u(c(t.$t("LinkSubscriptions.back")),1)]),_:1},8,["onOnClick"])])],32)],64))])]),_:1})]),_:1})])}const gt=D(it,[["render",pt],["__scopeId","data-v-c61294de"]]);export{gt 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.