%PDF- %PDF-
Direktori : /home/opti/.trash/ |
Current File : /home/opti/.trash/npm.react-ravepayment.a26f5e48e192fe90bc2f.chunk.js |
(window.webpackJsonp=window.webpackJsonp||[]).push([[35],{"8e0fbf160202ce0e6992":function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var o=n("8af190b70a6bc55c6f1b"),r=n.n(o),i=function(){return(i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function a(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}var c=r.a.createContext({initializePayment:function(){},onClose:function(){},onSuccess:function(){}});function u(e){var t=e.children,n=e.onClose,o=e.onSuccess,i=l(a(e,["children","onClose","onSuccess"])).initializePayment;return r.a.createElement(c.Provider,{value:{initializePayment:i,onClose:n,onSuccess:o}},t)}var s=[];function l(e){var t=e.customer_email,n=e.customer_phone,r=e.amount,i=e.txref,a=e.PBFPubKey,c=e.meta,u=void 0===c?[{}]:c,l=e.pay_button_text,d=void 0===l?"":l,p=e.integrity_hash,f=void 0===p?"":p,m=e.currency,v=void 0===m?"NGN":m,y=e.country,b=void 0===y?"NG":y,_=e.customer_firstname,h=void 0===_?"":_,w=e.customer_lastname,O=void 0===w?"":w,g=e.production,P=void 0!==g&&g,j=e.custom_title,x=void 0===j?"":j,E=e.custom_description,S=void 0===E?"":E,C=e.custom_logo,z=void 0===C?"":C,k=e.redirect_url,L=void 0===k?"":k,N=e.payment_options,A=e.subaccounts,B=void 0===A?[{}]:A,F=e.payment_plan,G=void 0===F?"":F,J=e.hosted_payment,K=void 0===J?"":J,U=e.campaign_id,I=void 0===U?"":U,R=function(e){var t=e?"https://api.ravepay.co/flwv3-pug/getpaidx/api/flwpbf-inline.js":"https://ravesandboxapi.flutterwave.com/flwv3-pug/getpaidx/api/flwpbf-inline.js",n=Object(o.useState)({loaded:!1,error:!1}),r=n[0],i=n[1];return Object(o.useEffect)((function(){!function(){if(s.includes(t))return i({loaded:!0,error:!1}),function(){};s.push(t);var e=document.createElement("script");e.src=t,e.async=!0;var n=function(){i({loaded:!0,error:!1})},o=function(){var n=s.indexOf(t);n>=0&&s.splice(n,1),e.remove(),i({loaded:!0,error:!0})};e.addEventListener("load",n),e.addEventListener("complete",n),e.addEventListener("error",o),document.body.appendChild(e)}()}),[]),[r.loaded,r.error]}(P),q=R[0],D=R[1];return Object(o.useEffect)((function(){if(D)throw new Error("Unable to load flutterwave script")}),[D]),{initializePayment:function(e,o){if(D)throw new Error("Unable to load flutterwave script");if(q){var c={customer_email:t,customer_phone:n,amount:r,txref:i,PBFPubKey:a,meta:u,pay_button_text:d,integrity_hash:f,currency:v,country:b,customer_firstname:h,customer_lastname:O,custom_title:x,custom_description:S,custom_logo:z,redirect_url:L,payment_options:(s=N,s?Array.isArray(s)?s.join(","):s:"both"),subaccounts:B,payment_plan:G,hosted_payment:K,campaign_id:I,onclose:o||function(){},callback:e||function(){}};window.getpaidSetup&&window.getpaidSetup(c)}var s}}}function d(e){var t=e.children,n=e.ref,r=Object(o.useContext)(c);return t({initializePayment:r.initializePayment,onClose:r.onClose,onSuccess:r.onSuccess,ref:n})}Object(o.forwardRef)((function(e,t){var n=e.children,o=a(e,["children"]);return r.a.createElement(u,i({},o),r.a.createElement(d,{ref:t},n))}))}}]);