@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
558 lines (487 loc) • 59 kB
JavaScript
let e=e=>e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_;function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?v(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function b(e,t,n){return(t=x(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(e){var t=S(e,`string`);return typeof t==`symbol`?t:t+``}function S(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}
/*!
* License: LGPL-2.1-or-later
* Dependencies:
*
* @dbp-toolkit/app-shell: 0.3.17 (LGPL-2.1-or-later)
* @dbp-toolkit/language-select: 0.3.7 (LGPL-2.1-or-later)
* @dbp-toolkit/auth: 0.3.8 (LGPL-2.1-or-later)
* lit-html: 3.3.2 (BSD-3-Clause)
* @dbp-toolkit/notification: 0.3.8 (LGPL-2.1-or-later)
* @dbp-toolkit/theme-switcher: 0.1.5 (LGPL-2.1-or-later)
* universal-router: 10.0.3 (MIT)
* @dbp-toolkit/matomo: 0.2.12 (LGPL-2.1-or-later)
* @tugraz/web-components: 0.3.12 (LGPL-2.1-or-later)
*/
import{C,D as w,F as ee,I as te,N as T,O as ne,S as re,T as E,_ as D,b as ie,h as ae,j as O,k,m as oe,t as A,u as j,v as se,w as ce,x as M,y as N}from"./shared/dbp-lit-element.DnNHYy91.js";var P={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-link":`Anmelden`,"error-login-message":`Bitte melden Sie sich an, um diese Funktion nutzen zu können.`,"error-message":`Kein aktiver Zahlungsvorgang gefunden.`,failed:{"button-return":`Zurück zu {{return-name}}`,info:`Zahlung fehlgeschlagen`,"info-failed":`Die Zahlung konnte leider nicht abgeschlossen werden. Bitte gehen Sie zurück zu "{{return-name}}" und versuchen Sie es erneut oder wählen Sie eine andere Zahlungsmethode.`},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.`},F={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-link":`Log in`,"error-login-message":`Please log in to use this functionality.`,"error-message":`No active payment process found.`,failed:{"button-return":`Return to {{return-name}}`,info:`Payment failed`,"info-failed":`Unfortunately, the payment could not be completed. Please go back to "{{return-name}}" and try again or choose a different payment method.`},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.`};function I(){return te({en:F,de:P},`de`,`en`)}var L=class extends ae{constructor(){super(),this._i18n=I(),this.lang=this._i18n.language,this.auth={},this.entryPointUrl=null,this.routingUrl=null,this.routingBaseUrl=null}static get properties(){return y(y({},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(this.routingBaseUrl===null)throw 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},this._loginStatus===`logged-in`&&(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();break}}),super.update(e)}isLoggedIn(){return this.auth.person!==void 0&&this.auth.person!==null}isLoading(){return this._loginStatus===`logged-out`?!1:!this.isLoggedIn()&&this.auth.token!==void 0}};function R(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t,n){return t&&z(e.prototype,t),n&&z(e,n),e}function V(e){return H(e)||U(e)||W(e)||le()}function H(e){if(Array.isArray(e))return G(e)}function U(e){if(typeof Symbol<`u`&&Symbol.iterator in Object(e))return Array.from(e)}function W(e,t){if(e){if(typeof e==`string`)return G(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(n);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(e,t)}}function G(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function le(){throw TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var K=function(){var e=[`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^="-"])`],t=function(){function t(e){var n=e.targetModal,r=e.triggers,i=r===void 0?[]:r,a=e.onShow,o=a===void 0?function(){}:a,s=e.onClose,c=s===void 0?function(){}:s,l=e.openTrigger,u=l===void 0?`data-micromodal-trigger`:l,d=e.closeTrigger,f=d===void 0?`data-micromodal-close`:d,p=e.openClass,m=p===void 0?`is-open`:p,h=e.disableScroll,g=h===void 0?!1:h,_=e.disableFocus,v=_===void 0?!1:_,y=e.awaitCloseAnimation,b=y===void 0?!1:y,x=e.awaitOpenAnimation,S=x===void 0?!1:x,C=e.debugMode,w=C===void 0?!1:C;R(this,t),this.modal=this.modal=typeof n==`string`?document.getElementById(n):n,this.config={debugMode:w,disableScroll:g,openTrigger:u,closeTrigger:f,openClass:m,onShow:o,onClose:c,awaitCloseAnimation:b,awaitOpenAnimation:S,disableFocus:v},i.length>0&&this.registerTriggers.apply(this,V(i)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}return B(t,[{key:`registerTriggers`,value:function(){var e=this;[...arguments].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&&arguments[0]!==void 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&&arguments[0]!==void 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`});break}}}},{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){e.keyCode===27&&this.closeModal(e),e.keyCode===9&&this.retainFocus(e)}},{key:`getFocusableNodes`,value:function(){var t=this.modal.querySelectorAll(e);return Array.apply(void 0,V(t))}},{key:`setFocusToFirstNode`,value:function(){var e=this;if(!this.config.disableFocus){var t=this.getFocusableNodes();if(t.length!==0){var n=t.filter(function(t){return!t.hasAttribute(e.config.closeTrigger)});n.length>0&&n[0].focus(),n.length===0&&t[0].focus()}}}},{key:`retainFocus`,value:function(e){var t=this.getFocusableNodes();if(t.length!==0)if(t=t.filter(function(e){return e.offsetParent!==null}),!this.modal.contains(document.activeElement))t[0].focus();else{var n=t.indexOf(document.activeElement);e.shiftKey&&n===0&&(t[t.length-1].focus(),e.preventDefault()),!e.shiftKey&&t.length>0&&n===t.length-1&&(t[0].focus(),e.preventDefault())}}}]),t}(),n=null,r=function(e,t){var n=[];return e.forEach(function(e){var r=e.attributes[t].value;n[r]===void 0&&(n[r]=[]),n[r].push(e)}),n},i=function(e){if(!document.getElementById(e))return console.warn(`MicroModal: ❗Seems like you have missed %c'${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="${e}"></div>`),!1},a=function(e){if(e.length<=0)return 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>`),!1},o=function(e,t){if(a(e),!t)return!0;for(var n in t)i(n);return!0};return{init:function(e){var i=Object.assign({},{openTrigger:`data-micromodal-trigger`},e),a=V(document.querySelectorAll(`[${i.openTrigger}]`)),s=r(a,i.openTrigger);if(!(i.debugMode===!0&&o(a,s)===!1))for(var c in s){var l=s[c];i.targetModal=c,i.triggers=V(l),n=new t(i)}},show:function(e,r){var a=r||{};a.targetModal=e,!(a.debugMode===!0&&i(e)===!1)&&(n&&n.removeEventListeners(),n=new t(a),n.showModal())},close:function(e){e?n.closeModalById(e):n.closeModal()}}}();window.MicroModal=K;var q=K;const J=`default`,Y=`return`,X=`select`,Z=`create`;function Q(e){return e.pathname.split(`/`).filter(e=>e!==``).map(e=>decodeURIComponent(e))}function ue(e){let t=Q(new URL(e??``,window.location.origin));if(t.length>0&&[Z,X,Y].includes(t[0]))return t[0];if(t.length===0)return J;throw Error(`Invalid view`)}function de(e){let t=Q(new URL(e??``,window.location.origin));if(t.length<2||t[0]!==X)throw Error(`Invalid select URL`);return t[1]}function $(e){let t=new URL(e??``,window.location.origin),n=Q(t);if(n.length>=1&&n[0]===Z){let e=t.searchParams;return{type:e.get(`type`)??``,data:e.get(`data`)??``,clientIp:e.get(`clientIp`),returnUrl:e.get(`returnUrl`),notifyUrl:e.get(`notifyUrl`),localIdentifier:e.get(`localIdentifier`),authRequired:!!e.get(`authRequired`)}}throw Error(`Invalid create URL`)}function fe(e){let t=Q(new URL(e??``,window.location.origin));if(t.length<1||t[0]!==Y)throw Error(`Invalid return URL`);return e.split(`/`).slice(1).join(`/`)}O(`dbp-mono-processpayment`,class extends ne(L){constructor(){super(),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.reloadOnModalClose=!0,this.showPending=!1,this.showFailed=!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=J}pollPayment(){this.showPending&&this.getPayment()}connectedCallback(){super.connectedCallback();let e=ue(this.routingUrl);switch(e){case X:this.fullSizeLoading=!1,this.view=e,this.identifier=de(this.routingUrl??``);break;case Y:this.fullSizeLoading=!0,this.view=e;break;case Z:this.fullSizeLoading=!0,this.view=e;break;default:this.view=J,this.showDefaultPageMessage=!0,this.fullSizeLoading=!1;break}this._paymentPollingTimerID=setInterval(()=>{this.pollPayment()},1e3*5)}disconnectedCallback(){clearInterval(this._paymentPollingTimerID),this._paymentPollingTimerID=null,super.disconnectedCallback()}updated(e){e.has(`lang`)&&this._loginStatus===`logged-in`&&this.view===X&&this.getPayment(),super.updated(e)}static get scopedElements(){return{"dbp-button":D,"dbp-loading-button":se,"dbp-icon":k,"dbp-inline-notification":oe}}static get properties(){return y(y({},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},showFailed:{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(){if(super._updateAuth(),this._loginStatus===`logged-in`||this._loginStatus===`logged-out`)switch(this.view){case Z:this.authRequired=$(this.routingUrl??``).authRequired,this._loginStatus===`logged-out`&&this.authRequired?this.sendSetPropertyEvent(`requested-login-status`,`logged-in`):this.createPayment();break;case X:this.getPayment();break;case Y:this.completePayment();break}}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(){let e=$(this.routingUrl??``);this.loading=!0;let t=await this.sendCreatePaymentRequest(e.type,e.data,e.clientIp,e.returnUrl,e.notifyUrl,e.localIdentifier);await this.createPaymentResponse(t),this.loading=!1}async sendCreatePaymentRequest(e,t,n,r,i,a){let o={type:e,data:t,clientIp:n,returnUrl:r,notifyUrl:i,localIdentifier:a},s={method:`POST`,headers:this._requestHeaders,body:JSON.stringify(o)};return await this.httpGetAsync(this.entryPointUrl+`/mono/payments`,s)}async createPaymentResponse(e){let t=this._i18n,n=e.status,r=``;try{r=await e.clone().json()}catch(e){console.log(e)}switch(this.fullSizeLoading=!1,n){case 201:this.identifier=r.identifier,this.reloadSelect(),this.wrongPageCall=!1;break;case 401:this._loginStatus===`logged-in`&&(this.sendSetPropertyEvent(`requested-login-status`,`logged-in`),A({summary:t.t(`common.other-error-title`),body:t.t(`error-message`),type:`danger`,timeout:5})),this.authRequired=!0;break;case 429:A({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;break}}async getPayment(){this.loading=this.amount===null;let e=await this.sendGetPaymentRequest(this.identifier);await this.getPaymentResponse(e),this.loading=!1}async sendGetPaymentRequest(e){let t={method:`GET`,headers:this._requestHeaders};return await this.httpGetAsync(this.entryPointUrl+`/mono/payments/`+encodeURIComponent(e),t)}async getPaymentResponse(e){let t=this._i18n,n=e.status,r=await e.clone().json();switch(this.showTransactionSpinner=!1,n){case 200:switch(this.paymentStatus=r.paymentStatus,this.paymentReference=r.paymentReference,this.amount=r.amount,this.alternateName=r.alternateName,this.currency=r.currency,this.honoricPrefix=r.honoricPrefix,this.givenName=r.givenName,this.familyName=r.familyName,this.companyName=r.companyName,this.honoricSuffix=r.honoricSuffix,this.recipient=r.recipient,this.paymentMethods=JSON.parse(r.paymentMethod),this.dataProtectionDeclarationUrl=r.dataProtectionDeclarationUrl,this.returnUrl=r.returnUrl,this.showFailed=!1,r.paymentStatus){case`prepared`:this.showPending=!1,this.showRestart=!1,this.showPaymentMethods=!0,this.showCompleteConfirmation=!1;break;case`failed`:this.showFailed=!0,this.showPending=!1,this.showRestart=!1,this.showPaymentMethods=!1,this.showCompleteConfirmation=!1;break;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}break;case 401:A({summary:t.t(`common.login-required-title`),body:t.t(`common.login-required-body`),type:`danger`,timeout:5});break;case 403:A({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:A({summary:t.t(`common.timeout-exceeded-title`),body:t.t(`common.timeout-exceeded-body`),type:`danger`,timeout:5});break;case 429:A({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,A({summary:t.t(`common.other-error-title`),body:t.t(`error-message`),type:`danger`,timeout:5});break}}reloadSelect(){window.location.replace(this.getRoutingBaseUrl()+`/select/`+encodeURIComponent(this.identifier))}openModal(){let e=this._(`#payment-modal`);e&&(q.show(e,{onClose:(e,t)=>{this.popUp&&this.popUp.close(),this.reloadOnModalClose&&this.reloadSelect()},disableScroll:!0,disableFocus:!1}),this.modalIsVisible=!0)}closeModal(){this.modalIsVisible=!1;let e=this._(`#payment-modal`);e&&q.close(e)}popupCenter({url:e,title:t,w:n,h:r}){let i=window.screenLeft===void 0?window.screenX:window.screenLeft,a=window.screenTop===void 0?window.screenY:window.screenTop,o=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,c=o/window.screen.availWidth,l=(o-n)/2/c+i,u=(s-r)/2/c+a;return window.open(e,t,`
toolbar=no,
location=no,
status=no,
menubar=no,
scrollbars=yes,
width=${n/c},
height=${r/c},
top=${u},
left=${l}
`)}startPayAction(){let e=this._i18n;this.popUp=this.popupCenter({url:``,title:`xtf`,w:900,h:550});try{this.popUp.focus()}catch{alert(`Pop-up Blocker is enabled! Please disable your pop-up blocker.`);return}this.openModal();let t=this.getRoutingBaseUrl()+`/return/`;this.sendPostStartPayActionRequest(this.identifier,this.selectedPaymentMethod,t,this.consent).then(t=>{t.clone().json().then(n=>{switch(t.status){case 201:{this.reloadOnModalClose=!0,this.widgetUrl=new URL(n.widgetUrl).toString(),this.popUp.location=this.widgetUrl;let e=setInterval(()=>{this.popUp.closed&&(clearInterval(e),this.reloadSelect())},250);break}case 400:this.reloadOnModalClose=!1,this.closeModal(),A({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:this.reloadOnModalClose=!1,this.closeModal(),A({summary:e.t(`common.login-required-title`),body:e.t(`common.login-required-body`),type:`danger`,timeout:5});break;case 403:this.reloadOnModalClose=!1,this.closeModal(),A({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.reloadOnModalClose=!1,this.closeModal(),this.showNotFound=!0,this.showRestart=!1,this.showPaymentMethods=!1,this.showCompleteConfirmation=!1;break;case 410:this.reloadOnModalClose=!1,this.closeModal(),A({summary:e.t(`common.timeout-exceeded-title`),body:e.t(`common.timeout-exceeded-body`),type:`danger`,timeout:5});break;case 429:this.reloadOnModalClose=!1,this.closeModal(),this.showPaymentMethods=!0,A({summary:e.t(`start.too-many-requests-title`),body:e.t(`start.too-many-requests-body`),type:`danger`,timeout:5});break;case 500:this.reloadOnModalClose=!1,this.closeModal(),A({summary:e.t(`common.backend-error-title`),body:e.t(`common.backend-error-body`),type:`danger`,timeout:5});break;default:this.reloadOnModalClose=!1,this.closeModal(),A({summary:e.t(`common.other-error-title`),body:e.t(`common.other-error-body`),type:`danger`,timeout:5});break}})})}async sendPostStartPayActionRequest(e,t,n,r){let i={identifier:e,paymentMethod:t,pspReturnUrl:n,consent:r},a={method:`POST`,headers:this._requestHeaders,body:JSON.stringify(i)};return await this.httpGetAsync(this.entryPointUrl+`/mono/start-pay-actions`,a)}async completePayment(){let e=fe(this.routingUrl??``),t=await this.sendCompletePaymentRequest(e);this.showTransactionSpinner=!0,await this.completePaymentResponse(t),t=await this.sendGetPaymentRequest(this.identifier),await this.getCompletePaymentResponse(t)}async sendCompletePaymentRequest(e){let t={pspData:e},n={method:`POST`,headers:this._requestHeaders,body:JSON.stringify(t)};return await this.httpGetAsync(this.entryPointUrl+`/mono/complete-pay-actions`,n)}async completePaymentResponse(e){let t=this._i18n,n=e.status,r=await e.clone().json();switch(this.showTransactionSpinner=!1,n){case 201:this.returnUrl=r.returnUrl,this.identifier=r.identifier;break;case 404:this.showNotFound=!0,this.showRestart=!1,this.showPaymentMethods=!1,this.showCompleteConfirmation=!1;break;case 500:A({summary:t.t(`common.backend-error-title`),body:t.t(`common.backend-error-body`),type:`danger`,timeout:5});break;default:A({summary:t.t(`common.other-error-title`),body:t.t(`common.other-error-body`),type:`danger`,timeout:5});break}}async getCompletePaymentResponse(e){let t=this._i18n,n=e.status,r=await e.clone().json();switch(this.showTransactionSpinner=!1,n){case 200:{this.paymentStatus=r.paymentStatus;let e=this.getRoutingBaseUrl()+`/select/`+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:A({summary:t.t(`common.other-error-title`),body:t.t(`common.other-error-body`),type:`danger`,timeout:5});break}}clickOnPaymentMethod(e){this.selectedPaymentMethod=e.identifier,this.isPaymentMethodSelected=!!this.selectedPaymentMethod}printSummary(){if(!this.shadowRoot||!this.shadowRoot.host||!this.shadowRoot.host.getRootNode()){window.print();return}let e=this.shadowRoot.host.getRootNode().querySelector(`#root header`),t=this.shadowRoot.host.getRootNode().querySelector(`#root footer`),n=this.shadowRoot.host.getRootNode().querySelector(`#root aside`),r=this.shadowRoot.host.getRootNode().querySelector(`#root main`);e!==null&&t!==null&&n!==null&&r!==null&&(t.classList.add(`hidden`),e.classList.add(`hidden`),n.classList.add(`hidden`),r.style.position=`absolute`,r.style.width=`97vw`,r.style.marginTop=`100px`),window.print(),e!==null&&t!==null&&n!==null&&r!==null&&(t.classList.remove(`hidden`),e.classList.remove(`hidden`),n.classList.remove(`hidden`),r.style=null)}getReturnButtonString(){let e=this._i18n,t=this.returnHostname;return t?e.t(`complete.return-button-text-name`,{name:t}):e.t(`complete.return-button-text`)}_onLoginClicked(e){this.sendSetPropertyEvent(`requested-login-status`,`logged-in`),e.preventDefault()}static get styles(){return[w(),M(!1),C(),ie(),ce(),E(),N(),re(),ee(t||=e`
.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 {
border: 1px solid var(--dbp-override-primary);
padding: 15px 20px 15px 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 {
.details {
background: var(--dbp-override-primary);
color: var(--dbp-override-secondary-surface);
}
}
@media only screen and (min-width: 768px) {
.row {
display: flex;
margin-left: -15px;
}
.details {
width: 300px;
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;
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;
background-color: var(--dbp-background);
color: var(--dbp-content);
}
}
`)]}render(){let t=this._i18n;return T(n||=e`
<div
class="notification is-warning ${0}">
${0}
<a href="#" @click="${0}">${0}</a>
</div>
<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="danger">
<div slot="body">
<p>${0}</p>
<p>
${0}
</p>
<dbp-button
no-spinner-on-click
@click="${0}">
${0}
</dbp-button>
</div>
</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}