UNPKG

@finapi/finapi-js-loader

Version:

finAPI JS Loader

3 lines (2 loc) 3.07 kB
"use strict";function t(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,e(t,n)}function e(t,n){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},e(t,n)}Object.defineProperty(exports,"__esModule",{value:!0});var n=function(){function t(t,e,n,r,i,o){this.ownerDocument=void 0,this.scriptId=void 0,this.container=void 0,this.webComponentId=void 0,this.source=void 0,this.internalProps=void 0,this.webComponentId="finapi-"+t,this.scriptId=t+"-script",this.container=e,this.ownerDocument=r||document,this.source=this.getSource(t,n,i),this.internalProps=o}var e=t.prototype;return e.load=function(t,e){null!=this.ownerDocument.querySelector("#"+this.scriptId)||this.ownerDocument.body.appendChild(this.createScript()),this.unload();var n=this.createWebComponent(t,e);this.container.appendChild(n)},e.unload=function(){var t=this.ownerDocument.querySelector(this.webComponentId);t&&t.parentNode&&t.parentNode.removeChild(t)},e.getSource=function(t,e,n){return(e||"https://widget-library-finapi-general-live.finapi.io")+"/"+(n||"finapi-"+t+".js")},e.createScript=function(){var t=this.ownerDocument.createElement("script");return t.src=this.source+"?t="+Date.now(),t.id=this.scriptId,t.async=!1,t},e.createWebComponent=function(t,e){var n,r=this.ownerDocument.createElement(this.webComponentId),i=r.properties||r;t&&Object.keys(t).forEach((function(e){i[e]=t[e]}));var o=this.internalProps;return o&&Object.keys(o).forEach((function(t){i[t]=o[t]})),null!=t&&null!=(n=t.scroll)&&n.enabled&&window.history.scrollRestoration&&(window.history.scrollRestoration="manual"),e&&Object.keys(e).forEach((function(t){r.addEventListener(t,(function(n){var r=e[t];r&&r(n.detail)}))})),r},t}(),r=function(e){function n(t,n,r,i){return e.call(this,"creditcheck",t,n,r,i,{type:"account"})||this}return t(n,e),n}(n),i=function(e){function n(t,n,r,i){return e.call(this,"creditcheck",t,n,r,i,{type:"b2b"})||this}return t(n,e),n}(n),o=function(e){function n(t,n,r,i){return e.call(this,"creditcheck",t,n,r,i,{type:"loan"})||this}return t(n,e),n}(n),c=function(e){function n(t,n,r,i){return e.call(this,"creditcheck",t,n,r,i,{type:"dac_b2c"})||this}return t(n,e),n}(n),s=function(e){function n(t,n,r,i){return e.call(this,"creditcheck",t,n,r,i,{type:"dac_b2b"})||this}return t(n,e),n}(n),u=function(e){function n(t,n,r,i){return e.call(this,"giroident",t,n,r,i,{type:"basis"})||this}return t(n,e),n}(n),a=function(e){function n(t,n,r,i){return e.call(this,"testingTool",t,n,r,i)||this}return t(n,e),n}(n),h=function(e){function n(t,n,r,i){return e.call(this,"transactionViewer",t,n,r,i)||this}return t(n,e),n}(n),l=function(e){function n(t,n,r,i){return e.call(this,"widgetGallery",t,n,r,i)||this}return t(n,e),n}(n);exports.CreditCheckAccount=r,exports.CreditCheckB2B=i,exports.CreditCheckLoan=o,exports.DigitalAccountCheck=c,exports.DigitalAccountCheckB2b=s,exports.GiroIdentBasis=u,exports.TestingTool=a,exports.TransactionViewer=h,exports.WidgetGallery=l; //# sourceMappingURL=finapi-js-loader.cjs.production.min.js.map