@getalby/bitcoin-connect-react
Advanced tools
Comparing version 3.0.0-beta.2 to 3.0.0-beta.3
@@ -7,5 +7,13 @@ import React from 'react'; | ||
invoice: string; | ||
/** | ||
* @param response response of the WebLN send payment call | ||
*/ | ||
onPaid?: (response: SendPaymentResponse) => void; | ||
/** | ||
* Check if an external payment was made for the invoice. This function will be called once per second. | ||
* @returns WebLN compatible payment response if paid, otherwise undefined | ||
*/ | ||
checkPayment?: () => Promise<SendPaymentResponse | undefined>; | ||
}; | ||
export declare const SendPayment: React.FC<SendPaymentProps>; | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import n from"react";import{onConnected as e,onConnecting as o,onDisconnected as t,onModalOpened as c,onModalClosed as r}from"@getalby/bitcoin-connect";export{closeModal,disconnect,init,isConnected,launchModal,onConnected,onConnecting,onDisconnected,onModalClosed,onModalOpened,requestProvider}from"@getalby/bitcoin-connect";function i(i){n.useEffect(()=>{if(i.onConnected){const n=e(i.onConnected);return()=>{n()}}return()=>{}},[]),n.useEffect(()=>{if(i.onConnecting){const n=o(i.onConnecting);return()=>{n()}}return()=>{}},[]),n.useEffect(()=>{if(i.onDisconnected){const n=t(i.onDisconnected);return()=>{n()}}return()=>{}},[]),n.useEffect(()=>{if(i.onModalOpened){const n=c(i.onModalOpened);return()=>{n()}}return()=>{}},[]),n.useEffect(()=>{if(i.onModalClosed){const n=r(i.onModalClosed);return()=>{n()}}return()=>{}},[])}const d=e=>(i(e),/*#__PURE__*/n.createElement("bc-button",null)),s=e=>(i(e),/*#__PURE__*/n.createElement("bc-connect-flow",null)),l=e=>(i(e),n.useEffect(()=>{const n=e.onPaid;if(n){const e=e=>{n(e.detail)};return window.addEventListener("bc:onpaid",e),()=>{window.removeEventListener("bc:onpaid",e)}}return()=>{}},[]),/*#__PURE__*/n.createElement("bc-send-payment-flow",{invoice:e.invoice}));export{d as Button,s as Connect,l as SendPayment}; | ||
import n from"react";import{onConnected as e,onConnecting as t,onDisconnected as o,onModalOpened as c,onModalClosed as r}from"@getalby/bitcoin-connect";export{closeModal,disconnect,init,isConnected,launchModal,onConnected,onConnecting,onDisconnected,onModalClosed,onModalOpened,requestProvider}from"@getalby/bitcoin-connect";function i(i){n.useEffect(()=>{if(i.onConnected){const n=e(i.onConnected);return()=>{n()}}return()=>{}},[]),n.useEffect(()=>{if(i.onConnecting){const n=t(i.onConnecting);return()=>{n()}}return()=>{}},[]),n.useEffect(()=>{if(i.onDisconnected){const n=o(i.onDisconnected);return()=>{n()}}return()=>{}},[]),n.useEffect(()=>{if(i.onModalOpened){const n=c(i.onModalOpened);return()=>{n()}}return()=>{}},[]),n.useEffect(()=>{if(i.onModalClosed){const n=r(i.onModalClosed);return()=>{n()}}return()=>{}},[])}const a=e=>(i(e),/*#__PURE__*/n.createElement("bc-button",null)),s=e=>(i(e),/*#__PURE__*/n.createElement("bc-connect-flow",null));function d(){return d=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n},d.apply(this,arguments)}const l=e=>{i(e);const[t,o]=n.useState();return n.useEffect(()=>{const{onPaid:n,checkPayment:t}=e,c=e=>{null==n||n(e.detail)};window.addEventListener("bc:onpaid",c);const r=setInterval(async()=>{const n=await(null==t?void 0:t());n&&(clearInterval(r),o(!0),window.dispatchEvent(new CustomEvent("bc:onpaid",{detail:n})))},1e3);return()=>{window.removeEventListener("bc:onpaid",c),clearInterval(r)}},[]),/*#__PURE__*/n.createElement("bc-send-payment-flow",d({invoice:e.invoice},t?{paid:t}:{}))};export{a as Button,s as Connect,l as SendPayment}; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import n from"react";import{onConnected as e,onConnecting as o,onDisconnected as t,onModalOpened as c,onModalClosed as i}from"@getalby/bitcoin-connect";export{closeModal,disconnect,init,isConnected,launchModal,onConnected,onConnecting,onDisconnected,onModalClosed,onModalOpened,requestProvider}from"@getalby/bitcoin-connect";function r(r){n.useEffect(function(){if(r.onConnected){var n=e(r.onConnected);return function(){n()}}return function(){}},[]),n.useEffect(function(){if(r.onConnecting){var n=o(r.onConnecting);return function(){n()}}return function(){}},[]),n.useEffect(function(){if(r.onDisconnected){var n=t(r.onDisconnected);return function(){n()}}return function(){}},[]),n.useEffect(function(){if(r.onModalOpened){var n=c(r.onModalOpened);return function(){n()}}return function(){}},[]),n.useEffect(function(){if(r.onModalClosed){var n=i(r.onModalClosed);return function(){n()}}return function(){}},[])}var u=function(e){return r(e),/*#__PURE__*/n.createElement("bc-button",null)},f=function(e){return r(e),/*#__PURE__*/n.createElement("bc-connect-flow",null)},d=function(e){return r(e),n.useEffect(function(){var n=e.onPaid;if(n){var o=function(e){n(e.detail)};return window.addEventListener("bc:onpaid",o),function(){window.removeEventListener("bc:onpaid",o)}}return function(){}},[]),/*#__PURE__*/n.createElement("bc-send-payment-flow",{invoice:e.invoice})};export{u as Button,f as Connect,d as SendPayment}; | ||
import n from"react";import{onConnected as e,onConnecting as t,onDisconnected as o,onModalOpened as c,onModalClosed as r}from"@getalby/bitcoin-connect";export{closeModal,disconnect,init,isConnected,launchModal,onConnected,onConnecting,onDisconnected,onModalClosed,onModalOpened,requestProvider}from"@getalby/bitcoin-connect";function i(i){n.useEffect(function(){if(i.onConnected){var n=e(i.onConnected);return function(){n()}}return function(){}},[]),n.useEffect(function(){if(i.onConnecting){var n=t(i.onConnecting);return function(){n()}}return function(){}},[]),n.useEffect(function(){if(i.onDisconnected){var n=o(i.onDisconnected);return function(){n()}}return function(){}},[]),n.useEffect(function(){if(i.onModalOpened){var n=c(i.onModalOpened);return function(){n()}}return function(){}},[]),n.useEffect(function(){if(i.onModalClosed){var n=r(i.onModalClosed);return function(){n()}}return function(){}},[])}var u=function(e){return i(e),/*#__PURE__*/n.createElement("bc-button",null)},a=function(e){return i(e),/*#__PURE__*/n.createElement("bc-connect-flow",null)};function f(){return f=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n},f.apply(this,arguments)}var l=function(e){i(e);var t=n.useState(),o=t[0],c=t[1];return n.useEffect(function(){var n=e.onPaid,t=e.checkPayment,o=function(e){null==n||n(e.detail)};window.addEventListener("bc:onpaid",o);var r=setInterval(function(){return Promise.resolve(null==t?void 0:t()).then(function(n){n&&(clearInterval(r),c(!0),window.dispatchEvent(new CustomEvent("bc:onpaid",{detail:n})))})},1e3);return function(){window.removeEventListener("bc:onpaid",o),clearInterval(r)}},[]),/*#__PURE__*/n.createElement("bc-send-payment-flow",f({invoice:e.invoice},o?{paid:o}:{}))};export{u as Button,a as Connect,l as SendPayment}; | ||
//# sourceMappingURL=index.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("@getalby/bitcoin-connect")):"function"==typeof define&&define.amd?define(["exports","react","@getalby/bitcoin-connect"],n):n((e||self).bitcoinConnectReact={},e.React,e.bitcoinConnect)}(this,function(e,n,t){function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=/*#__PURE__*/o(n);function c(e){r.default.useEffect(function(){if(e.onConnected){var n=t.onConnected(e.onConnected);return function(){n()}}return function(){}},[]),r.default.useEffect(function(){if(e.onConnecting){var n=t.onConnecting(e.onConnecting);return function(){n()}}return function(){}},[]),r.default.useEffect(function(){if(e.onDisconnected){var n=t.onDisconnected(e.onDisconnected);return function(){n()}}return function(){}},[]),r.default.useEffect(function(){if(e.onModalOpened){var n=t.onModalOpened(e.onModalOpened);return function(){n()}}return function(){}},[]),r.default.useEffect(function(){if(e.onModalClosed){var n=t.onModalClosed(e.onModalClosed);return function(){n()}}return function(){}},[])}Object.defineProperty(e,"closeModal",{enumerable:!0,get:function(){return t.closeModal}}),Object.defineProperty(e,"disconnect",{enumerable:!0,get:function(){return t.disconnect}}),Object.defineProperty(e,"init",{enumerable:!0,get:function(){return t.init}}),Object.defineProperty(e,"isConnected",{enumerable:!0,get:function(){return t.isConnected}}),Object.defineProperty(e,"launchModal",{enumerable:!0,get:function(){return t.launchModal}}),Object.defineProperty(e,"onConnected",{enumerable:!0,get:function(){return t.onConnected}}),Object.defineProperty(e,"onConnecting",{enumerable:!0,get:function(){return t.onConnecting}}),Object.defineProperty(e,"onDisconnected",{enumerable:!0,get:function(){return t.onDisconnected}}),Object.defineProperty(e,"onModalClosed",{enumerable:!0,get:function(){return t.onModalClosed}}),Object.defineProperty(e,"onModalOpened",{enumerable:!0,get:function(){return t.onModalOpened}}),Object.defineProperty(e,"requestProvider",{enumerable:!0,get:function(){return t.requestProvider}}),e.Button=function(e){return c(e),/*#__PURE__*/r.default.createElement("bc-button",null)},e.Connect=function(e){return c(e),/*#__PURE__*/r.default.createElement("bc-connect-flow",null)},e.SendPayment=function(e){return c(e),r.default.useEffect(function(){var n=e.onPaid;if(n){var t=function(e){n(e.detail)};return window.addEventListener("bc:onpaid",t),function(){window.removeEventListener("bc:onpaid",t)}}return function(){}},[]),/*#__PURE__*/r.default.createElement("bc-send-payment-flow",{invoice:e.invoice})}}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("@getalby/bitcoin-connect")):"function"==typeof define&&define.amd?define(["exports","react","@getalby/bitcoin-connect"],n):n((e||self).bitcoinConnectReact={},e.React,e.bitcoinConnect)}(this,function(e,n,t){function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=/*#__PURE__*/o(n);function c(e){r.default.useEffect(function(){if(e.onConnected){var n=t.onConnected(e.onConnected);return function(){n()}}return function(){}},[]),r.default.useEffect(function(){if(e.onConnecting){var n=t.onConnecting(e.onConnecting);return function(){n()}}return function(){}},[]),r.default.useEffect(function(){if(e.onDisconnected){var n=t.onDisconnected(e.onDisconnected);return function(){n()}}return function(){}},[]),r.default.useEffect(function(){if(e.onModalOpened){var n=t.onModalOpened(e.onModalOpened);return function(){n()}}return function(){}},[]),r.default.useEffect(function(){if(e.onModalClosed){var n=t.onModalClosed(e.onModalClosed);return function(){n()}}return function(){}},[])}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},i.apply(this,arguments)}Object.defineProperty(e,"closeModal",{enumerable:!0,get:function(){return t.closeModal}}),Object.defineProperty(e,"disconnect",{enumerable:!0,get:function(){return t.disconnect}}),Object.defineProperty(e,"init",{enumerable:!0,get:function(){return t.init}}),Object.defineProperty(e,"isConnected",{enumerable:!0,get:function(){return t.isConnected}}),Object.defineProperty(e,"launchModal",{enumerable:!0,get:function(){return t.launchModal}}),Object.defineProperty(e,"onConnected",{enumerable:!0,get:function(){return t.onConnected}}),Object.defineProperty(e,"onConnecting",{enumerable:!0,get:function(){return t.onConnecting}}),Object.defineProperty(e,"onDisconnected",{enumerable:!0,get:function(){return t.onDisconnected}}),Object.defineProperty(e,"onModalClosed",{enumerable:!0,get:function(){return t.onModalClosed}}),Object.defineProperty(e,"onModalOpened",{enumerable:!0,get:function(){return t.onModalOpened}}),Object.defineProperty(e,"requestProvider",{enumerable:!0,get:function(){return t.requestProvider}}),e.Button=function(e){return c(e),/*#__PURE__*/r.default.createElement("bc-button",null)},e.Connect=function(e){return c(e),/*#__PURE__*/r.default.createElement("bc-connect-flow",null)},e.SendPayment=function(e){c(e);var n=r.default.useState(),t=n[0],o=n[1];return r.default.useEffect(function(){var n=e.onPaid,t=e.checkPayment,r=function(e){null==n||n(e.detail)};window.addEventListener("bc:onpaid",r);var c=setInterval(function(){return Promise.resolve(null==t?void 0:t()).then(function(e){e&&(clearInterval(c),o(!0),window.dispatchEvent(new CustomEvent("bc:onpaid",{detail:e})))})},1e3);return function(){window.removeEventListener("bc:onpaid",r),clearInterval(c)}},[]),/*#__PURE__*/r.default.createElement("bc-send-payment-flow",i({invoice:e.invoice},t?{paid:t}:{}))}}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@getalby/bitcoin-connect-react", | ||
"version": "3.0.0-beta.2", | ||
"version": "3.0.0-beta.3", | ||
"type": "module", | ||
@@ -24,3 +24,3 @@ "source": "src/index.ts", | ||
"dependencies": { | ||
"@getalby/bitcoin-connect": "^3.0.0-beta.2" | ||
"@getalby/bitcoin-connect": "^3.0.0-beta.3" | ||
}, | ||
@@ -27,0 +27,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37219
95