@digital-blueprint/mono-app
Version:
[GitHub Repository](https://github.com/digital-blueprint/mono-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/mono-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/mono-app/) | [Mono Bundle](https://github.com/digital
570 lines (498 loc) • 58.7 kB
JavaScript
let e,t,n,i,o,a,r,s,l,d,c,h,u,m,p,g,y,b,f,w,v=e=>e;function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},k.apply(null,arguments)
/*!
* License: LGPL-2.1-or-later
* Dependencies:
*
* @dbp-toolkit/app-shell: 0.3.11 (LGPL-2.1-or-later)
* @dbp-toolkit/language-select: 0.3.3 (LGPL-2.1-or-later)
* @dbp-toolkit/common: 0.3.10 (LGPL-2.1-or-later)
* @dbp-toolkit/auth: 0.3.4 (LGPL-2.1-or-later)
* @dbp-toolkit/notification: 0.3.3 (LGPL-2.1-or-later)
* @dbp-toolkit/theme-switcher: 0.1.1 (LGPL-2.1-or-later)
* path-to-regexp: 6.3.0 (MIT)
* universal-router: 9.2.1 (MIT)
* generateUrls: 9.2.1 (MIT)
* @dbp-toolkit/matomo: 0.2.8 (LGPL-2.1-or-later)
* @tugraz/web-components: 0.3.7 (LGPL-2.1-or-later)
*/}import{D as x,i as S,g as P,b as $,d as R,x as C,c as U,S as q,B as L,L as M,I as E,s as N,m as B,h as I,n as A,p as T,l as _,e as F,k as z}from"./shared/notification.D4Bgzi3L.es.js";class D extends x{constructor(){super(),this.type="",this.summary="",this.body=""}static get properties(){return{type:{type:String},summary:{type:String},body:{type:String}}}connectedCallback(){super.connectedCallback()}static get styles(){return S(e||(e=v`
${0}
${0}
${0}
.notification:not(:last-child) {
margin-bottom: 1.5rem;
}
.notification h3 {
font-weight: bold;
margin-bottom: 3px;
}
.notification h3 {
margin: 0 0 3px 0;
font: inherit;
font-weight: bold;
}
`),P(),$(),R())}createBodyHtml(){return document.createRange().createContextualFragment(`<slot name="body">${this.body}</slot>`)}render(){const e=this.createBodyHtml();return C(t||(t=v`
<div class="columns">
<div class="column">
<div
id="inline-notification"
class="notification is-${0}">
${0}
${0}
</div>
</div>
</div>
`),""!==this.type?this.type:"info",""!==this.summary?C(n||(n=v`
<h3>${0}</h3>
`),this.summary):"",e)}}var Z={element:"dbp-mono-processpayment",module_src:"dbp-mono-processpayment.js",routing_name:"mono-processpayment",name:{de:"Bezahlvorgang durchführen",en:"Process payment"},short_name:{de:"Bezahlvorgang durchführen",en:"Process payment"},description:{de:"Diese Applikation ermöglicht Ihnen einfaches Durchführen elektronischer Zahlungen.",en:"This application enables you to conduct electronic payments easily."},subscribe:"lang,auth,entry-point-url,routing-url,routing-base-url"};class j{constructor(e){this._data=e}getName(e){var t;let n=this._data.name;return null!=(t=n[e])?t:n.en}getDescription(e){var t;let n=this._data.description;return null!=(t=n[e])?t:n.en}}var O={common:{"backend-error-body":"Bei der Kommunikation mit einem Backend-System ist ein Fehler aufgetreten.","backend-error-title":"Fehler!","client-ip-not-allowed-body":"Sie dürfen von diesem Endgerät nicht auf die Ressource zugreifen.","client-ip-not-allowed-title":"Fehler!","login-required-body":"Bitte melden Sie sich an, um fortfahren zu können.","login-required-title":"Anmeldung erforderlich","other-error-body":"Es ist ein unbekannter Fehler aufgetreten.","other-error-title":"Fehler!","psp-return-url-not-allowed-body":"Die PSP-RETURN-URL ist nicht erlaubt.","psp-return-url-not-allowed-title":"Fehler!","timeout-exceeded-body":"Die Ressource ist abgelaufen, Sie dürfen nicht mehr zugreifen.","timeout-exceeded-title":"Fehler!"},complete:{amount:"Betrag:","amount-format":"{{val, currency}}",close:"Es kann etwas dauern, bis die Zahlung im System aufscheint. Sie können diese Seite jetzt verlassen.",payed:"Erfolgreich abgeschlossen","payment-id":"Zahlungsidentifikator","print-button-text":"Zusammenfassung drucken",recipient:"An:",reference:"Zahlungsgrund:","return-button-text":"Zurück zur initiierenden Applikation","return-button-text-name":"Zurück zu {{name}}",sender:"Von:",status:"Status:",summary:"Zusammenfassung"},create:{"too-many-requests-body":"Zu viele aktive Zahlungen. Bitte versuchen Sie es später erneut.","too-many-requests-title":"Fehler!"},"data-protection":"Datenschutzerklärung",default:{warning:"Diese Applikation kann nur im Rahmen eines gültigen Zahlungsvorgangs aufgerufen werden. Bitte starten Sie den Prozess über die dafür vorgesehene Einstiegsseite."},"error-login-message":"Sie müssen angemeldet sein, um diese Zahlung durchführen zu können!","error-message":"Kein aktiver Zahlungsvorgang gefunden.",get:{"too-many-requests-body":"Sie haben die Ressource zu oft aufgerufen.","too-many-requests-title":"Fehler!"},"loading-message":"Lädt...","not-found":{info:"Die ausgewählte Zahlung ist nicht mehr aktiv. Sie können dieses Fenster jetzt schließen und die Zahlung erneut starten."},"payment-method":{"cancel-payment-label":"Bezahlvorgang abbrechen","method-started":"Bezahlvorgang gestartet","method-started-hint":"Sie sehen das Popup-Fenster nicht?","method-started-hint-text":"Wählen Sie „Fenster“ in Ihrer Symbolleiste, um „Bezahlen - Elektronischer Bezahlservice“ zu finden.","method-started-text":"Der Bezahlvorgang wurde in einem neuen Fenster gestartet."},pending:{"button-return":"Zurück zu {{return-name}}",info:"Wir warten derzeit auf eine Antwort des Zahlungsanbieters. Dies kann ein paar Sekunden dauern.","info-canceled":'Wenn Sie die Seite des Zahlungsanbieters vor dem Abschluss geschlossen oder den Zahlungsvorgang auf andere Weise abgebrochen haben, gehen Sie bitte zurück zu "{{return-name}}" und starten Sie den Zahlungsvorgang von vorne.'},restart:{info:"Diese Zahlung wurde bereits von Ihnen gestartet. Falls ein Fehler aufgetreten ist oder Sie eine andere Zahlungsmethode auswählen möchten, starten Sie die Zahlung erneut."},select:{amount:"Betrag","amount-format":"{{val, currency}}","amount-too-low":"Der Zahlungsbetrag ist zu gering.","default-reference":"Zahlung","payment-method":"Bitte wählen Sie eine Zahlungsmethode aus:",recipient:"An",sender:"Von","start-pay-action-btn-title":"Zahlung starten","start-pay-action-info":'Mit dem Klick auf "Zahlung starten" erfolgt eine Weiterleitung an den jeweiligen Zahlungsdienstleister.'},start:{"too-many-requests-body":"Die Zahlung darf nur einmalig gestartet werden.","too-many-requests-title":"Fehler!"},"transaction-text":"Die Zahlung wird verarbeitet. Das kann einige Minuten dauern.",warning:"Achtung","warning-text":"Diese Zusammenfassung dient nicht als Nachweis einer durchgeführten Zahlung."},H={common:{"backend-error-body":"An error occurred during communication with a backend system.","backend-error-title":"Error!","client-ip-not-allowed-body":"You are not allowed to access this resource from this device.","client-ip-not-allowed-title":"Error!","login-required-body":"Please log in to continue.","login-required-title":"Login required","other-error-body":"An unknown error has occurred.","other-error-title":"Error!","psp-return-url-not-allowed-body":"The PSP return url is not allowed.","psp-return-url-not-allowed-title":"Error!","timeout-exceeded-body":"Timeout exceeded for this resource, you are no longer allowed to access it.","timeout-exceeded-title":"Error!"},complete:{amount:"Amount:","amount-format":"{{val, currency}}",close:"It may take some time for the payment to appear in the system. You can now leave this page.",payed:"Successfully completed","payment-id":"Payment identification","print-button-text":"Print summary",recipient:"To:",reference:"Purpose of payment ","return-button-text":"Return to the initiating application","return-button-text-name":"Back to {{name}}",sender:"From:",status:"Status:",summary:"Summary"},create:{"too-many-requests-body":"Too many active payments. Please try again later.","too-many-requests-title":"Error!"},"data-protection":"Privacy statement",default:{warning:"This application can only be accessed as part of a valid payment process. Please start the process through the designated entry page."},"error-login-message":"You need to be logged in to process this payment!","error-message":"No active payment process found.",get:{"too-many-requests-body":"You made too many requests on this resource.","too-many-requests-title":"Error!"},"loading-message":"Loading...","not-found":{info:"The selected payment is no longer active. You can close this window now and start the payment again."},"payment-method":{"cancel-payment-label":"Cancel payment process","method-started":"Payment process started","method-started-hint":"Don't see the popup window?","method-started-hint-text":'Select "Window" in your toolbar to find "Log in to your PayPal account"',"method-started-text":"The payment process started in a new window."},pending:{"button-return":"Go back to {{return-name}}",info:"We are currently waiting for a response from the payment provider. This may take a few seconds.","info-canceled":'If you have closed the page of the payment provider before completion or canceled the payment process in any other way, please go back to "{{return-name}}" and start the payment process from the beginning.'},restart:{info:"This payment has already been started. If an error occurred or you want to select another payment method, start the payment again."},select:{amount:"Amount","amount-format":"{{val, currency}}","amount-too-low":"Amount is too low.","default-reference":"Payment","payment-method":"Please select a payment method:",recipient:"To",sender:"From","start-pay-action-btn-title":"Start payment","start-pay-action-info":'By clicking on "Start payment" you will be forwarded to the respective payment service provider.'},start:{"too-many-requests-body":"You are allowed to start the payment only once.","too-many-requests-title":"Fehler!"},"transaction-text":"The payment is being processed. This may take a few minutes.",warning:"Warning","warning-text":"This summary does not serve as proof of an executed payment."};class W extends x{constructor(){super(),this._i18n=U({en:H,de:O},"de","en"),this.lang=this._i18n.language,this.auth={},this.entryPointUrl=null,this.routingUrl=null,this.routingBaseUrl=null}static get properties(){return k({},super.properties,{lang:{type:String},auth:{type:Object},entryPointUrl:{type:String,attribute:"entry-point-url"},routingUrl:{type:String,attribute:"routing-url"},routingBaseUrl:{type:String,attribute:"routing-base-url"}})}connectedCallback(){super.connectedCallback(),this._loginStatus="",this._requestHeaders={"Accept-Language":this.lang}}getRoutingBaseUrl(){if(null===this.routingBaseUrl)throw new Error("routing-base-url not set");return this.routingBaseUrl}_updateAuth(){this._loginStatus=this.auth["login-status"],this._requestHeaders={"Content-Type":"application/ld+json","Accept-Language":this.lang},"logged-in"===this._loginStatus&&(this._requestHeaders.Authorization="Bearer "+this.auth.token)}update(e){e.forEach(((e,t)=>{switch(t){case"lang":this._i18n.changeLanguage(this.lang),this._requestHeaders["Accept-Language"]=this.lang;break;case"auth":this._updateAuth()}})),super.update(e)}isLoggedIn(){return void 0!==this.auth.person&&null!==this.auth.person}isLoading(){return"logged-out"!==this._loginStatus&&(!this.isLoggedIn()&&void 0!==this.auth.token)}}function G(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),e}function K(e){return function(e){if(Array.isArray(e))return V(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return V(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return V(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var Y,J,X,Q,ee,te=(Y=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],J=function(){function e(t){var n=t.targetModal,i=t.triggers,o=void 0===i?[]:i,a=t.onShow,r=void 0===a?function(){}:a,s=t.onClose,l=void 0===s?function(){}:s,d=t.openTrigger,c=void 0===d?"data-micromodal-trigger":d,h=t.closeTrigger,u=void 0===h?"data-micromodal-close":h,m=t.openClass,p=void 0===m?"is-open":m,g=t.disableScroll,y=void 0!==g&&g,b=t.disableFocus,f=void 0!==b&&b,w=t.awaitCloseAnimation,v=void 0!==w&&w,k=t.awaitOpenAnimation,x=void 0!==k&&k,S=t.debugMode,P=void 0!==S&&S;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.modal=this.modal="string"==typeof n?document.getElementById(n):n,this.config={debugMode:P,disableScroll:y,openTrigger:c,closeTrigger:u,openClass:p,onShow:r,onClose:l,awaitCloseAnimation:v,awaitOpenAnimation:x,disableFocus:f},o.length>0&&this.registerTriggers.apply(this,K(o)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}return G(e,[{key:"registerTriggers",value:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];n.filter(Boolean).forEach((function(t){t.addEventListener("click",(function(t){return e.showModal(t)}))}))}},{key:"showModal",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.scrollBehaviour("disable"),this.addEventListeners(),this.config.awaitOpenAnimation?this.modal.addEventListener("animationend",(function t(){e.modal.removeEventListener("animationend",t,!1),e.setFocusToFirstNode()}),!1):this.setFocusToFirstNode(),this.config.onShow(this.modal,this.activeElement,t)}},{key:"closeModal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.modal;if(this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,e),this.config.awaitCloseAnimation){var n=this.config.openClass;this.modal.addEventListener("animationend",(function e(){t.classList.remove(n),t.removeEventListener("animationend",e,!1)}),!1)}else t.classList.remove(this.config.openClass)}},{key:"closeModalById",value:function(e){e instanceof HTMLElement?this.modal=e:this.model=document.getElementById(e),this.modal&&this.closeModal()}},{key:"scrollBehaviour",value:function(e){if(this.config.disableScroll){var t=document.querySelector("body");switch(e){case"enable":Object.assign(t.style,{overflow:""});break;case"disable":Object.assign(t.style,{overflow:"hidden"})}}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}},{key:"onClick",value:function(e){e.target.hasAttribute(this.config.closeTrigger)&&this.closeModal(e)}},{key:"onKeydown",value:function(e){27===e.keyCode&&this.closeModal(e),9===e.keyCode&&this.retainFocus(e)}},{key:"getFocusableNodes",value:function(){var e=this.modal.querySelectorAll(Y);return Array.apply(void 0,K(e))}},{key:"setFocusToFirstNode",value:function(){var e=this;if(!this.config.disableFocus){var t=this.getFocusableNodes();if(0!==t.length){var n=t.filter((function(t){return!t.hasAttribute(e.config.closeTrigger)}));n.length>0&&n[0].focus(),0===n.length&&t[0].focus()}}}},{key:"retainFocus",value:function(e){var t=this.getFocusableNodes();if(0!==t.length)if(t=t.filter((function(e){return null!==e.offsetParent})),this.modal.contains(document.activeElement)){var n=t.indexOf(document.activeElement);e.shiftKey&&0===n&&(t[t.length-1].focus(),e.preventDefault()),!e.shiftKey&&t.length>0&&n===t.length-1&&(t[0].focus(),e.preventDefault())}else t[0].focus()}}]),e}(),X=null,Q=function(e){if(!document.getElementById(e))return console.warn("MicroModal: ❗Seems like you have missed %c'".concat(e,"'"),"background-color: #f8f9fa;color: #50596c;font-weight: bold;","ID somewhere in your code. Refer example below to resolve it."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<div class="modal" id="'.concat(e,'"></div>')),!1},ee=function(e,t){if(function(e){e.length<=0&&(console.warn("MicroModal: ❗Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<a href="#" data-micromodal-trigger="my-modal"></a>'))}(e),!t)return!0;for(var n in t)Q(n);return!0},{init:function(e){var t=Object.assign({},{openTrigger:"data-micromodal-trigger"},e),n=K(document.querySelectorAll("[".concat(t.openTrigger,"]"))),i=function(e,t){var n=[];return e.forEach((function(e){var i=e.attributes[t].value;void 0===n[i]&&(n[i]=[]),n[i].push(e)})),n}(n,t.openTrigger);if(!0!==t.debugMode||!1!==ee(n,i))for(var o in i){var a=i[o];t.targetModal=o,t.triggers=K(a),X=new J(t)}},show:function(e,t){var n=t||{};n.targetModal=e,!0===n.debugMode&&!1===Q(e)||(X&&X.removeEventListeners(),(X=new J(n)).showModal())},close:function(e){e?X.closeModalById(e):X.closeModal()}});window.MicroModal=te;const ne="default",ie="return",oe="select",ae="create";function re(e){return e.pathname.split("/").filter((e=>""!==e)).map((e=>decodeURIComponent(e)))}function se(e){let t=new URL(null!=e?e:"",window.location.origin),n=re(t);if(n.length>=1&&n[0]===ae){var i,o;let e=t.searchParams;return{type:null!=(i=e.get("type"))?i:"",data:null!=(o=e.get("data"))?o:"",clientIp:e.get("clientIp"),returnUrl:e.get("returnUrl"),notifyUrl:e.get("notifyUrl"),localIdentifier:e.get("localIdentifier"),authRequired:!!e.get("authRequired")}}throw new Error("Invalid create URL")}class le extends(q(W)){constructor(){super(),this.activity=new j(Z),this.wrongPageCall=!1,this.loading=!1,this.fullSizeLoading=!1,this.authRequired=!1,this.showDefaultPageMessage=!1,this.paymentReference=null,this.amount=null,this.currency=null,this.honoricPrefix=null,this.givenName=null,this.familyName=null,this.companyName=null,this.honoricSuffix=null,this.recipient=null,this.dataProtectionDeclarationUrl=null,this.alternateName=null,this.returnUrl=null,this.showNotFound=!1,this.showRestart=!1,this.modalIsVisible=!1,this.showPending=!1,this.identifier=null,this.showPaymentMethods=!1,this.paymentMethods=[],this.selectedPaymentMethod="",this.isPaymentMethodSelected=!1,this.consent=!1,this.showTransactionSpinner=!1,this.widgetUrl="about:blank",this.paymentStatus=null,this.showCompleteConfirmation=!1,this.popUp=null,this._paymentPollingTimerID=null,this.view=ne}pollPayment(){this.showPending&&this.getPayment()}connectedCallback(){super.connectedCallback();let e=function(e){let t=re(new URL(null!=e?e:"",window.location.origin));if(t.length>0&&[ae,oe,ie].includes(t[0]))return t[0];if(0===t.length)return ne;throw new Error("Invalid view")}(this.routingUrl);switch(e){case oe:var t;this.fullSizeLoading=!1,this.view=e,this.identifier=function(e){let t=re(new URL(null!=e?e:"",window.location.origin));if(t.length<2||t[0]!==oe)throw new Error("Invalid select URL");return t[1]}(null!=(t=this.routingUrl)?t:"");break;case ie:case ae:this.fullSizeLoading=!0,this.view=e;break;default:this.view=ne,this.showDefaultPageMessage=!0,this.fullSizeLoading=!1}this._paymentPollingTimerID=setInterval((()=>{this.pollPayment()}),5e3)}disconnectedCallback(){clearInterval(this._paymentPollingTimerID),this._paymentPollingTimerID=null,super.disconnectedCallback()}updated(e){e.has("lang")&&"logged-in"===this._loginStatus&&this.view===oe&&this.getPayment(),super.updated(e)}static get scopedElements(){return{"dbp-button":L,"dbp-loading-button":M,"dbp-icon":E,"dbp-inline-notification":D}}static get properties(){return k({},super.properties,{wrongPageCall:{type:Boolean,attribute:!1},showDefaultPageMessage:{type:Boolean,attribute:!1},loading:{type:Boolean,attribute:!1},fullSizeLoading:{type:Boolean,attribute:!1},authRequired:{type:Boolean},paymentReference:{type:String,attribute:!1},amount:{type:String,attribute:!1},currency:{type:String,attribute:!1},honoricPrefix:{type:String,attribute:!1},givenName:{type:String,attribute:!1},familyName:{type:String,attribute:!1},companyName:{type:String,attribute:!1},honoricSuffix:{type:String,attribute:!1},recipient:{type:String,attribute:!1},dataProtectionDeclarationUrl:{type:String,attribute:!1},returnUrl:{type:String},showNotFound:{type:Boolean,attribute:!1},showRestart:{type:Boolean,attribute:!1},modalIsVisible:{type:Boolean,attribute:!1},showPending:{type:Boolean,attribute:!1},identifier:{type:String},showPaymentMethods:{type:Boolean,attribute:!1},paymentMethods:{type:Array,attribute:!1},selectedPaymentMethod:{type:String,attribute:!1},isPaymentMethodSelected:{type:Boolean,attribute:!1},consent:{type:Boolean,attribute:!1},showTransactionSpinner:{type:Boolean,attribute:!1},widgetUrl:{type:String,attribute:!1},paymentStatus:{type:String,attribute:!1},showCompleteConfirmation:{type:Boolean,attribute:!1}})}_updateAuth(){var e;if(super._updateAuth(),"logged-in"===this._loginStatus||"logged-out"===this._loginStatus)switch(this.view){case ae:this.authRequired=se(null!=(e=this.routingUrl)?e:"").authRequired,"logged-out"===this._loginStatus&&this.authRequired?this.sendSetPropertyEvent("requested-login-status","logged-in"):this.createPayment();break;case oe:this.getPayment();break;case ie:this.completePayment()}}async httpGetAsync(e,t){return await fetch(e,t).then((e=>{if(!e.ok)throw e;return e})).catch((e=>e))}get returnHostname(){return this.returnUrl?new URL(this.returnUrl).hostname:""}async createPayment(){var e;let t=se(null!=(e=this.routingUrl)?e:"");this.loading=!0;let n=await this.sendCreatePaymentRequest(t.type,t.data,t.clientIp,t.returnUrl,t.notifyUrl,t.localIdentifier);await this.createPaymentResponse(n),this.loading=!1}async sendCreatePaymentRequest(e,t,n,i,o,a){let r={type:e,data:t,clientIp:n,returnUrl:i,notifyUrl:o,localIdentifier:a};const s={method:"POST",headers:this._requestHeaders,body:JSON.stringify(r)};return await this.httpGetAsync(this.entryPointUrl+"/mono/payments",s)}async createPaymentResponse(e){const t=this._i18n;let n=e.status,i="";try{i=await e.clone().json()}catch(e){console.log(e)}switch(this.fullSizeLoading=!1,n){case 201:this.identifier=i.identifier,this.reloadSelect(),this.wrongPageCall=!1;break;case 401:"logged-in"===this._loginStatus&&(this.sendSetPropertyEvent("requested-login-status","logged-in"),N({summary:t.t("common.other-error-title"),body:t.t("error-message"),type:"danger",timeout:5})),this.authRequired=!0;break;case 429:N({summary:t.t("create.too-many-requests-title"),body:t.t("create.too-many-requests-body"),type:"danger",timeout:5});break;default:this.wrongPageCall=!0}}async getPayment(){this.loading=null===this.amount;let e=await this.sendGetPaymentRequest(this.identifier);await this.getPaymentResponse(e),this.loading=!1}async sendGetPaymentRequest(e){const t={method:"GET",headers:this._requestHeaders};return await this.httpGetAsync(this.entryPointUrl+"/mono/payments/"+encodeURIComponent(e),t)}async getPaymentResponse(e){const t=this._i18n;let n=e.status,i=await e.clone().json();switch(this.showTransactionSpinner=!1,n){case 200:switch(this.paymentStatus=i.paymentStatus,this.paymentReference=i.paymentReference,this.amount=i.amount,this.alternateName=i.alternateName,this.currency=i.currency,this.honoricPrefix=i.honoricPrefix,this.givenName=i.givenName,this.familyName=i.familyName,this.companyName=i.companyName,this.honoricSuffix=i.honoricSuffix,this.recipient=i.recipient,this.paymentMethods=JSON.parse(i.paymentMethod),this.dataProtectionDeclarationUrl=i.dataProtectionDeclarationUrl,this.returnUrl=i.returnUrl,i.paymentStatus){case"prepared":this.showPending=!1,this.showRestart=!1,this.showPaymentMethods=!0,this.showCompleteConfirmation=!1;break;case"cancelled":case"failed":case"started":this.showPending=!1,this.showRestart=!0,this.showPaymentMethods=!0,this.showCompleteConfirmation=!1;break;case"pending":this.showPending=!0,this.showRestart=!1,this.showPaymentMethods=!1,this.showCompleteConfirmation=!1;break;case"completed":this.showPending=!1,this.showRestart=!1,this.showPaymentMethods=!1,this.showCompleteConfirmation=!0}break;case 401:N({summary:t.t("common.login-required-title"),body:t.t("common.login-required-body"),type:"danger",timeout:5});break;case 403:N({summary:t.t("common.client-ip-not-allowed-title"),body:t.t("common.client-ip-not-allowed-body"),type:"danger",timeout:5});break;case 404:this.showNotFound=!0,this.showRestart=!1,this.showPaymentMethods=!1,this.showCompleteConfirmation=!1;break;case 410:N({summary:t.t("common.timeout-exceeded-title"),body:t.t("common.timeout-exceeded-body"),type:"danger",timeout:5});break;case 429:N({summary:t.t("get.too-many-requests-title"),body:t.t("get.too-many-requests-body"),type:"danger",timeout:5});break;default:this.wrongPageCall=!0,N({summary:t.t("common.other-error-title"),body:t.t("error-message"),type:"danger",timeout:5})}}reloadSelect(){window.location.replace(this.getRoutingBaseUrl()+"/"+encodeURIComponent(oe)+"/"+encodeURIComponent(this.identifier))}openModal(){const e=this._("#payment-modal");e&&(te.show(e,{onClose:(e,t)=>{this.popUp&&this.popUp.close(),this.reloadSelect()},disableScroll:!0,disableFocus:!1}),this.modalIsVisible=!0)}closeModal(){this.modalIsVisible=!1;const e=this._("#payment-modal");e&&te.close(e)}popupCenter({url:e,title:t,w:n,h:i}){const o=void 0!==window.screenLeft?window.screenLeft:window.screenX,a=void 0!==window.screenTop?window.screenTop:window.screenY,r=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,s=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,l=r/window.screen.availWidth,d=(r-n)/2/l+o,c=(s-i)/2/l+a;return window.open(e,t,`\n toolbar=no,\n location=no,\n status=no,\n menubar=no,\n scrollbars=yes,\n width=${n/l}, \n height=${i/l}, \n top=${c}, \n left=${d}\n `)}startPayAction(){const e=this._i18n;this.popUp=this.popupCenter({url:"",title:"xtf",w:500,h:768});try{this.popUp.focus()}catch(e){return void alert("Pop-up Blocker is enabled! Please disable your pop-up blocker.")}this.openModal();let t=this.getRoutingBaseUrl()+"/"+encodeURIComponent(ie)+"/";this.sendPostStartPayActionRequest(this.identifier,this.selectedPaymentMethod,t,this.consent).then((t=>{t.clone().json().then((n=>{switch(t.status){case 201:{let e=new URL(n.widgetUrl);this.widgetUrl=e.toString(),this.popUp.location=this.widgetUrl;let t=setInterval((()=>{this.popUp.closed&&(clearInterval(t),this.reloadSelect())}),250);break}case 400:N({summary:e.t("common.psp-return-url-not-allowed-title"),body:e.t("common.psp-return-url-not-allowed-body"),type:"danger",timeout:5});break;case 401:N({summary:e.t("common.login-required-title"),body:e.t("common.login-required-body"),type:"danger",timeout:5});break;case 403:N({summary:e.t("common.client-ip-not-allowed-title"),body:e.t("common.client-ip-not-allowed-body"),type:"danger",timeout:5});break;case 404:this.showNotFound=!0,this.showRestart=!1,this.showPaymentMethods=!1,this.showCompleteConfirmation=!1;break;case 410:N({summary:e.t("common.timeout-exceeded-title"),body:e.t("common.timeout-exceeded-body"),type:"danger",timeout:5});break;case 429:this.showPaymentMethods=!0,N({summary:e.t("start.too-many-requests-title"),body:e.t("start.too-many-requests-body"),type:"danger",timeout:5});break;case 500:N({summary:e.t("common.backend-error-title"),body:e.t("common.backend-error-body"),type:"danger",timeout:5});break;default:N({summary:e.t("common.other-error-title"),body:e.t("common.other-error-body"),type:"danger",timeout:5})}}))}))}async sendPostStartPayActionRequest(e,t,n,i){let o={identifier:e,paymentMethod:t,pspReturnUrl:n,consent:i};const a={method:"POST",headers:this._requestHeaders,body:JSON.stringify(o)};return await this.httpGetAsync(this.entryPointUrl+"/mono/start-pay-actions",a)}async completePayment(){var e;let t=function(e){let t=re(new URL(null!=e?e:"",window.location.origin));if(t.length<1||t[0]!==ie)throw new Error("Invalid return URL");return e.split("/").slice(1).join("/")}(null!=(e=this.routingUrl)?e:""),n=await this.sendCompletePaymentRequest(t);this.showTransactionSpinner=!0,await this.completePaymentResponse(n),n=await this.sendGetPaymentRequest(this.identifier),await this.getCompletePaymentResponse(n)}async sendCompletePaymentRequest(e){let t={pspData:e};const n={method:"POST",headers:this._requestHeaders,body:JSON.stringify(t)};return await this.httpGetAsync(this.entryPointUrl+"/mono/complete-pay-actions",n)}async completePaymentResponse(e){const t=this._i18n;let n=e.status,i=await e.clone().json();switch(this.showTransactionSpinner=!1,n){case 201:this.returnUrl=i.returnUrl,this.identifier=i.identifier;break;case 404:this.showNotFound=!0,this.showRestart=!1,this.showPaymentMethods=!1,this.showCompleteConfirmation=!1;break;case 500:N({summary:t.t("common.backend-error-title"),body:t.t("common.backend-error-body"),type:"danger",timeout:5});break;default:N({summary:t.t("common.other-error-title"),body:t.t("common.other-error-body"),type:"danger",timeout:5})}}async getCompletePaymentResponse(e){const t=this._i18n;let n=e.status,i=await e.clone().json();switch(this.showTransactionSpinner=!1,n){case 200:{this.paymentStatus=i.paymentStatus;let e=this.getRoutingBaseUrl()+"/"+encodeURIComponent(oe)+"/"+encodeURIComponent(this.identifier)+"/";window.opener&&!window.opener.closed?(window.opener.location=e,window.close()):window.location=e,this.showCompleteConfirmation=!0,this.isPaymentMethodSelected=!1;break}case 404:this.showNotFound=!0,this.showRestart=!1,this.showPaymentMethods=!1,this.showCompleteConfirmation=!1;break;default:N({summary:t.t("common.other-error-title"),body:t.t("common.other-error-body"),type:"danger",timeout:5})}}clickOnPaymentMethod(e){this.selectedPaymentMethod=e.identifier,this.isPaymentMethodSelected=!!this.selectedPaymentMethod}printSummary(){if(!this.shadowRoot||!this.shadowRoot.host||!this.shadowRoot.host.getRootNode())return void window.print();const e=this.shadowRoot.host.getRootNode().querySelector("#root header"),t=this.shadowRoot.host.getRootNode().querySelector("#root footer"),n=this.shadowRoot.host.getRootNode().querySelector("#root aside"),i=this.shadowRoot.host.getRootNode().querySelector("#root main");null!==e&&null!==t&&null!==n&&null!==i&&(t.classList.add("hidden"),e.classList.add("hidden"),n.classList.add("hidden"),i.style.position="absolute",i.style.width="97vw",i.style.marginTop="100px"),window.print(),null!==e&&null!==t&&null!==n&&null!==i&&(t.classList.remove("hidden"),e.classList.remove("hidden"),n.classList.remove("hidden"),i.style=null)}getReturnButtonString(){const e=this._i18n;let t=this.returnHostname;return t?e.t("complete.return-button-text-name",{name:t}):e.t("complete.return-button-text")}static get styles(){return[P(),$(!1),B(),I(),R(),A(),T(),_(),S(i||(i=v`
.full-size-spinner {
background-color: white;
position: absolute;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
z-index: 100;
display: flex;
justify-content: center;
align-items: center;
font-size: 30px;
}
.hidden {
display: none;
}
.subheadline {
margin-bottom: 2em;
}
.restart {
padding-bottom: 1.2em;
}
.col {
border: 1px solid var(--dbp-override-muted);
padding: 25px 15px 15px 20px;
flex: 1 0 0%;
}
.details {
padding: 15px 20px 15px 15px;
background: var(--dbp-override-primary);
color: var(--dbp-override-secondary-surface);
border: 1px solid var(--dbp-override-primary);
width: 300px;
margin-left: 15px;
}
.details .reference {
font-size: 2em;
font-weight: bold;
text-align: right;
}
.amount {
font-size: 2em;
font-weight: bold;
margin-top: 0;
}
.payment-methods {
padding-top: 1.5em;
}
.form-check {
padding-top: 5px;
padding-bottom: 5px;
}
.form-check-div {
display: grid;
grid-template-columns: 206px 100px;
column-gap: 0.5em;
}
.form-check-div img {
max-height: 30px;
place-self: center;
}
.modal-container {
display: flex;
flex-direction: column;
}
.modal-header {
text-align: center;
}
.modal-content {
height: 100%;
}
#payment-modal-box {
padding: 10px 20px;
}
.payment-hint {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
flex-direction: column;
text-align: center;
padding-bottom: 20px;
box-sizing: border-box;
}
.print-content-wrapper {
display: grid;
grid-template-columns: min-content auto;
grid-template-rows: auto;
}
.element-left.first,
.element-right.first {
padding-top: 12px;
}
.element-right.first {
border-top: 1px solid var(--dbp-override-muted);
}
.element-right.last {
border-bottom: 1px solid var(--dbp-override-muted);
}
.element-left {
background-color: var(--dbp-primary-surface);
color: var(--dbp-on-primary-surface);
border-left: var(--dbp-border);
border-right: var(--dbp-border);
border-color: var(--dbp-primary-surface-border-color);
padding: 0px 20px 15px 40px;
text-align: right;
width: 300px;
}
.element-left.first {
border-top: var(--dbp-border);
border-color: var(--dbp-primary-surface-border-color);
}
.element-left.last {
border-bottom: var(--dbp-border);
border-color: var(--dbp-primary-surface-border-color);
}
.element-right {
text-align: left;
padding-left: 15px;
padding-right: 15px;
border-right: 1px solid var(--dbp-override-muted);
}
.print-title {
padding-bottom: 1em;
}
.print-title h2:first-child {
margin-top: 0;
margin-bottom: 0;
}
.data-declaration {
display: flex;
flex-direction: row;
justify-content: space-between;
padding-right: 15px;
}
.print-warning {
display: flex;
justify-content: space-between;
padding-top: 0.5em;
}
.success {
color: var(--dbp-success);
}
@media only screen and (min-width: 768px) {
.row {
display: flex;
margin-left: -15px;
}
.col:first-child {
width: 25%;
flex: 0 0 auto;
}
}
@media only screen and (orientation: portrait) and (max-width: 768px) {
.details {
padding: 0;
width: 100%;
margin-left: 0;
border: none;
}
.details .reference {
padding: 20px 20px 20px 20px;
text-align: left;
}
.col > h3 {
padding-top: 1em;
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
word-break: break-word;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
.button-description-text {
margin: 0;
padding: 1em 0 1.5em 0;
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
word-break: break-word;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
.btn-row-left dbp-loading-button {
width: 100%;
}
dbp-loading-button {
width: 100%;
}
.form-check-div {
/* grid-template-columns: 150px 100px;
row-gap: 2em; */
display: flex;
flex-direction: row;
justify-content: space-between;
padding-top: 3px;
}
.form-check-div img {
margin-top: -6px;
}
.form-check {
padding: 0.8em 0 0.8em 0;
}
.print-content-wrapper {
grid-template-columns: auto;
border-bottom: 1px solid rgba(51, 51, 51, 0.2);
}
.element-left {
border-left: none;
border-right: none;
}
.element-left.first {
margin-top: 10px;
border-top: 0px;
}
.element-left.last {
border-bottom: none;
border-color: rgba(51, 51, 51, 0.2);
}
.element-right.first {
padding-top: 0px;
border-top: none;
}
.element-right.last {
border-bottom: none;
}
.element-right {
margin-left: 12px;
padding: 0px 0px 12px;
border-right: none;
}
.element-left {
text-align: left;
padding: 10px 5px;
background-color: inherit;
color: inherit;
font-weight: 400;
border-top: 1px solid rgba(51, 51, 51, 0.2);
border-color: rgba(51, 51, 51, 0.2);
width: unset;
}
#payment-modal-box {
width: 100%;
height: 100%;
padding: 0;
}
.print-warning {
padding-top: 1em;
flex-direction: column;
gap: 1em;
}
.data-declaration {
display: inline-grid;
gap: 2em;
}
.int-link-internal {
width: fit-content;
}
.complete-redirect-notice {
margin-top: 2em;
}
}
@media print {
#payment-modal,
dbp-inline-notification,
.control,
dbp-loading-button,
.subheadline,
.print-warning .warning-high,
.complete-redirect-notice {
display: none;
}
.element-left {
width: unset;
}
}
`))]}render(){const e=this._i18n;return C(o||(o=v`
<div
class="${0}">
<h2>${0}</h2>
<p class="subheadline">
<slot name="description">${0}</slot>
</p>
</div>
<dbp-inline-notification
class=" ${0}"
type="warning"
body="${0}"></dbp-inline-notification>
<dbp-inline-notification
class=" ${0}"
type="warning"
body="${0}"></dbp-inline-notification>
<dbp-inline-notification
class="${0}"
type="danger"
body="${0}"></dbp-inline-notification>
<dbp-inline-notification
class="${0}"
type="danger"
body="${0}"></dbp-inline-notification>
<div class="control ${0}">
<span class="loading">
<dbp-mini-spinner text=${0}></dbp-mini-spinner>
</span>
</div>
<div class="control full-size-spinner ${0}">
<span class="loading">
<dbp-mini-spinner text=${0}></dbp-mini-spinner>
</span>
</div>
<div
class="${0}">
<div
class="restart ${0}">
<dbp-inline-notification
type="warning"
body="${0}"></dbp-inline-notification>
</div>
<div class="${0}">
<dbp-inline-notification type="warning">
<div slot="body">
<p><dbp-mini-spinner text=" "></dbp-mini-spinner> ${0}</p>
<p>
${0}
</p>
<dbp-button
type="is-warning"
no-spinner-on-click
@click="${0}">
${0}
</dbp-button>
</div>
</dbp-inline-notification>
</div>
<div class="${0}">
<div class="row">
<div class="details">
<div class="reference">
${0}
</div>
</div>
<div class="col">
<strong>${0}</strong>
<p class="amount">
${0}
${0}
</p>
<p class="sender">
<strong>${0}</strong>
<br />
${0} ${0} ${0}
${0}
${0}
${0}
</p>
${0}
</div>
</div>
<div class="payment-methods">
${0}
</div>
${0}
</div>
</div>
<div class="${0}">
<span class="loading">
<dbp-mini-spinner text=${0}></dbp-mini-spinner>
</span>
</div>
<div
class="${0}">
<div class="${0}">
<div class="print" id="print-view-wrapper">
<div class="print-title">
<h2>${0}</h2>
</div>
<div class="print-content-wrapper">
<div class="element-left first">${0}</div>
<div class="element-right first">
${0}
</div>
<div class="element-left">${0}</div>
<div class="element-right">
${0}
${0}
</div>
<div class="element-left">${0}</div>
<div class="element-right">
${0} ${0} ${0}
${0}
${0}
</div>
${0}
<div class="element-left">${0}</div>
<div class="element-right">${0}</div>
<div class="element-left last">${0}</div>
<div class="element-right last">
<span class="success">
<strong>${0}</strong>
</span>
</div>
</div>
<div class="print-warning">
<div>
<dbp-icon
title="${0}"
name="warning-high"
class="warning-high"></dbp-icon>
<span>${0}</span>
</div>
<dbp-loading-button
@click="${0}"
title="${0}">
${0}
</dbp-loading-button>
</div>
<div class="complete-redirect-notice">
<p>
${0}
<br />
${0}
</p>
</div>
</div>
</div>
</div>
<div class="modal micromodal-slide" id="payment-modal" aria-hidden="true">
<div class="modal-overlay" tabindex="-2">
<div
class="modal-container"
id="payment-modal-box"
role="dialog"
aria-modal="true"
aria-labelledby="submission-modal-title">
<main class="modal-content" id="payment-modal-content">
<div class="payment-hint">
<h2>${0}</h2>
<p>${0}</p>
<p class="hint">
<strong>${0}</strong>
<br />
${0}
</p>
</div>
</main>
<header class="modal-header">
<d