UNPKG

flutterwave-vue-v3

Version:

Flutterwave official Vue library to accept payment via Card , USSD, QrCode etc.

1 lines 5.89 kB
var FlwTs=function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,o,i=[],c=!0,u=!1;try{for(n=n.call(t);!(c=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{c||null==n.return||n.return()}finally{if(u)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return c(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function u(t,e,n,r,o,i,c,u,a,l){"boolean"!=typeof c&&(a=u,u=c,c=!1);const s="function"==typeof n?n.options:n;let y;if(t&&t.render&&(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,o&&(s.functional=!0)),r&&(s._scopeId=r),i?(y=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,a(t)),t&&t._registeredComponents&&t._registeredComponents.add(i)},s._ssrRegister=y):e&&(y=c?function(t){e.call(this,l(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,u(t))}),y)if(s.functional){const t=s.render;s.render=function(e,n){return y.call(n),t(e,n)}}else{const t=s.beforeCreate;s.beforeCreate=t?[].concat(t,y):[y]}return n}var a=u({render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("button",{on:{click:t.showPaymentModal}},[t._t("default")],2)},staticRenderFns:[]},undefined,e(t).default.extend({name:"FlutterwavePayButton",props:{public_key:{type:String},tx_ref:{type:[String,Number]},amount:{type:[String,Number],required:!0},currency:{type:String,default:"NGN"},country:{type:String,default:"NG"},payment_options:{type:String},payment_plan:{type:[String,Number]},subaccounts:{type:Array},integrity_hash:{type:[String,Number]},redirect_url:{type:String},meta:{type:Object},authorization:{type:String},customer:{type:Object},customizations:{type:Object},callback:{type:Function},onclose:{type:Function}},methods:{showPaymentModal:function(){var t=this,e={tx_ref:this.tx_ref,amount:this.amount,currency:this.currency,country:this.country,payment_options:this.payment_options,payment_plan:this.payment_plan,subaccounts:this.subaccounts,integrity_hash:this.integrity_hash,redirect_url:this.redirect_url,meta:this.meta,authorization:this.authorization,customer:this.customer,customizations:this.customizations,callback:function(e){return t.callback(e)},onclose:function(){return t.onclose()}};this.public_key&&(e.public_key=this.public_key),this.$payWithFlutterwave(e)}}}),undefined,false,undefined,!1,void 0,void 0,void 0),l=Object.freeze({__proto__:null,FlutterwavePayButton:a}),s=function(t,e){var n=e.publicKey,o=void 0===n?"":n;Object.entries(l).forEach((function(e){var n=i(e,2),r=n[0],o=n[1];t.component(r,o)})),t.mixin({mounted:function(){var t="https://checkout.flutterwave.com/v3.js",e=document.createElement("script");e.src=t,document.querySelector('[src="'.concat(t,'"]'))||document.body.appendChild(e)},methods:{payWithFlutterwave:function(t){var e=r(r({},t),{},{public_key:t.public_key||o,callback:function(e){t.callback(e)}});window.FlutterwaveCheckout(e)},asyncPayWithFlutterwave:function(t){return new Promise((function(e){var n=r(r({},t),{},{public_key:t.public_key||o,callback:function(t){e(t)},onclose:function(){return e("closed")}});window.FlutterwaveCheckout(n)}))},closePaymentModal:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;setTimeout((function(){document.getElementsByName("checkout")[0].setAttribute("style","position:fixed;top:0;left:0;z-index:-1;border:none;opacity:0;pointer-events:none;width:100%;height:100%;"),document.body.style.overflow=""}),1e3*t)}}}),t.prototype.$payWithFlutterwave=function(t){var e=r(r({},t),{},{public_key:t.public_key||o,callback:function(e){t.callback(e)}});window.FlutterwaveCheckout(e)},t.prototype.$asyncPayWithFlutterwave=function(t){return new Promise((function(e){var n=r(r({},t),{},{public_key:t.public_key||o,callback:function(t){e(t)},onclose:function(){return e("closed")}});window.FlutterwaveCheckout(n)}))},t.prototype.$closePaymentModal=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;setTimeout((function(){document.getElementsByName("checkout")[0].setAttribute("style","position:fixed;top:0;left:0;z-index:-1;border:none;opacity:0;pointer-events:none;width:100%;height:100%;"),document.body.style.overflow=""}),1e3*t)}},y=Object.freeze({__proto__:null,default:s,FlutterwavePayButton:a});return Object.entries(y).forEach((function(t){var e=i(t,2),n=e[0],r=e[1];"default"!==n&&(s[n]=r)})),s}(Vue);