UNPKG

@finapi/finapi-js-loader

Version:

finAPI JS Loader

3 lines (2 loc) 3.25 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@finapi/finapi-js-loader"]={})}(this,(function(t){"use strict";function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,n(t,e)}function n(t,e){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},n(t,e)}var i=function(){function t(t,e,n,i,o,r){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=i||document,this.source=this.getSource(t,n,o),this.internalProps=r}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,i=this.ownerDocument.createElement(this.webComponentId),o=i.properties||i;t&&Object.keys(t).forEach((function(e){o[e]=t[e]}));var r=this.internalProps;return r&&Object.keys(r).forEach((function(t){o[t]=r[t]})),null!=t&&null!=(n=t.scroll)&&n.enabled&&window.history.scrollRestoration&&(window.history.scrollRestoration="manual"),e&&Object.keys(e).forEach((function(t){i.addEventListener(t,(function(n){var i=e[t];i&&i(n.detail)}))})),i},t}(),o=function(t){function n(e,n,i,o){return t.call(this,"creditcheck",e,n,i,o,{type:"account"})||this}return e(n,t),n}(i),r=function(t){function n(e,n,i,o){return t.call(this,"creditcheck",e,n,i,o,{type:"b2b"})||this}return e(n,t),n}(i),c=function(t){function n(e,n,i,o){return t.call(this,"creditcheck",e,n,i,o,{type:"loan"})||this}return e(n,t),n}(i),s=function(t){function n(e,n,i,o){return t.call(this,"creditcheck",e,n,i,o,{type:"dac_b2c"})||this}return e(n,t),n}(i),u=function(t){function n(e,n,i,o){return t.call(this,"creditcheck",e,n,i,o,{type:"dac_b2b"})||this}return e(n,t),n}(i),a=function(t){function n(e,n,i,o){return t.call(this,"giroident",e,n,i,o,{type:"basis"})||this}return e(n,t),n}(i),h=function(t){function n(e,n,i,o){return t.call(this,"testingTool",e,n,i,o)||this}return e(n,t),n}(i),l=function(t){function n(e,n,i,o){return t.call(this,"transactionViewer",e,n,i,o)||this}return e(n,t),n}(i),d=function(t){function n(e,n,i,o){return t.call(this,"widgetGallery",e,n,i,o)||this}return e(n,t),n}(i);t.CreditCheckAccount=o,t.CreditCheckB2B=r,t.CreditCheckLoan=c,t.DigitalAccountCheck=s,t.DigitalAccountCheckB2b=u,t.GiroIdentBasis=a,t.TestingTool=h,t.TransactionViewer=l,t.WidgetGallery=d,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=finapi-js-loader.umd.production.min.js.map