1import{_ as x}from"./Co1YIp_a.js";import{ay as G,az as X,d as I,r as v,a as B,S as p,o as L,c as a,j as y,w as h,f as n,g as o,e as g,i as m,_ as T,h as b,aA as D,H as $,I as F,u as U,k as N}from"./wGaC-Zcn.js";import{u as j}from"./BfYqtZUW.js";import{u as R}from"./O3KBn1aK.js";const z="voucherCheckout",r=G("voucher",()=>({permanent:X(z,{voucherCode:"",plenigoOfferId:""},localStorage)})),M={class:"voucher"},Z={class:"voucher__media"},H=["src"],J={key:0,class:"voucher__form"},q={key:1,class:"voucher__success"},K=I({__name:"VoucherActivation",setup(f){const c=v(),_=B(),u=v(!1),s=j({default:p()?r().permanent.voucherCode:"",validate:async t=>{const e=(t.value||"").trim(),l=new RegExp("^[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}$");if(e.length===0)return"Bitte geben Sie einen Gutscheincode ein.";if(l.test(e)){const i=await V(e);if("status"in i)switch(i.status){case"INACTIVE":return"Der Gutscheincode ist nicht mehr gültig oder wurde bereits eingelöst. Bitte geben sie einen gültigen Gutscheincode ein.";case 400:return"Der Gutscheincode ist nicht mehr gültig oder wurde bereits eingelöst. Bitte geben sie einen gültigen Gutscheincode ein.";case 404:return"Der Gutscheincode ist ungültig. Bitte geben sie einen gültigen Gutscheincode ein.";case 500:return"Es gab ein Problem bei der Validierung des Gutscheincodes. Bitte versuchen sie es später noc
1h einmal."}return""}else return"Der Gutscheincode entspricht nicht dem notwendigen Format."}});async function V(t){const e=await $fetch("/api/checkout/voucher/validate",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({voucherCode:t})});return e?.status==="ACTIVE"&&e?.plenigoOfferId?(r().permanent.voucherCode=t,r().permanent.plenigoOfferId=e.plenigoOfferId):(r().permanent.voucherCode="",r().permanent.plenigoOfferId=""),e}async function w(t){return await $fetch("/api/checkout/prepare-purchase",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({voucherCode:t,allowMultiplePurchases:!0,sourceUrl:window.location.origin})})}function C(t){try{new plenigo.Checkout(t,{returnUrl:window.location.href,testMode:!1}).start()}catch(e){console.error(e)}}async function k(t){await s.validate()&&D(t)}async function S(){if(await s.validate()){const{purchaseId:e}=await w(r().permanent.voucherCode);C(e)}}function A(t){console.log("# CheckoutPayment Debug - ERROR",t,t.detail)}function P(t){console.log("# CheckoutPayment Debug - FAILED",t,t.detail)}function E(t){if(console.log("# CheckoutPayment Debug - SUCCESS",t),!(t.detail.orderId==="-1"||t.detail.errorCode))u.value=!0,r().$reset;else return tracking.orderFailed(t.detail),!1;document.body.dispatchEvent(new CustomEvent("user-ping"))}return L(async()=>{p()&&(await R(),document.addEventListener("plenigo.PurchaseSuccess",E),document.addEventListener("plenigo.PurchaseFailed",P),document.addEventListener("plenigo.PurchaseError",A),c.value?.$el.querySelectorAll("input")[0].focus())}),(t,e)=>{const l=x,i=T,O=$;return a(),y(O,null,{default:h(()=>[n("div",M,[n("div",Z,[n("img",{src:`/static/images/${o(_)}/gutscheincode.svg`,class:"mx-auto mt-7 d-block",alt:"Person überreicht ein Geschenk"},null,8,H)]),o(u)?(a(),g("div",q,[e[5]||(e[5]=n("h1",{class:"mb-7 mt-4"},[n("span",{class:"font-set-5 fw-bold text-color-primary d-block mb-0"},"Das hat geklappt!"),n("span",{class:"font-set-8 fw-bold lh-sm"},"Ihr Gutschein wurde erfolgreich eingelöst")],-1)),m(i,{class:"mt-10 mx-auto px-10",version:"primary",type:"button",big:!0,url:"/"},{default:h(()=>e[4]||(e[4]=[b(" Zur Startseite ")])),_:1})])):(a(),g("div",J,[e[3]||(e[3]=n("h1",{class:"mb-7 mt-4"},[n("span",{class:"font-set-5 fw-bold text-color-primary d-block mb-0"},"Ihr persönlicher Vorteil"),n("span",{class:"font-set-8 fw-bold lh-sm"},"Bitte geben Sie Ihren Gutscheincode ein")],-1)),m(l,{class:"voucherCode",name:"voucherCode",label:"Gutscheincode",ref_key:"voucherInput",ref:c,modelValue:o(s).fieldValue,"onUpdate:modelValue":e[0]||(e[0]=d=>o(s).fieldValue=d),"error-message":o(s).errorMessage,isValidated:o(s).isValidated,inputAttrs:{placeholder:"XXXX-XXXX-XXXX"},onFocusout:o(s).validate},null,8,["modelValue","error-message","isValidated","onFocusout"]),m(i,{class:"mt-10 d-block mx-auto px-10",version:"primary",type:"button",big:!0,onClick:e[1]||(e[1]=d=>("useUserIsLoggedIn"in t?t.useUserIsLoggedIn:o(p))()?S():k(d))},{default:h(()=>e[2]||(e[2]=[b(" Gutschein einlösen ")])),_:1})]))])]),_:1})}}}),Y=Object.assign(F(K,[["__scopeId","data-v-b0760696"]]),{__name:"VoucherActivation"}),Q={class:"u-main-content u-main-content--full-content-width"},W={class:"u-main-content__inner content-col"},se=I({__name:"gutscheinaktivierung",setup(f){const c=U()==="twipe";return(_,u)=>(a(),g("main",Q,[n("div",W,[c?N("",!0):(a(),y(Y,{key:0}))])]))}});export{se 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.