Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-coinbase-commerce

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-coinbase-commerce - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.circleci/config.yml

2

dist/index.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("react-coinbase-commerce",["React"],t):"object"==typeof exports?exports["react-coinbase-commerce"]=t(require("react")):e["react-coinbase-commerce"]=t(e.React)}(window,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s=10)}([function(t,n){t.exports=e},,function(e,t,n){},,function(e,t,n){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a=n(5);n(4),n(2);var i=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.isValidMessage=function(e){return e.origin===n.origin&&e.data.buttonId===n.uuid},n.handleMessage=function(e){if(n.isValidMessage(e)){var t=n.props,r=t.onChargeSuccess,o=t.onChargeFailure,a=t.onModalClose,i=t.onError;switch(e.data.event){case"charge_confirmed":r&&r(e.data);break;case"charge_failed":o&&o(e.data);break;case"error_not_found":i(e.data);break;case"checkout_modal_closed":a()}}},n.handleIFrameLoaded=function(){n.setState({loading:!1}),n.props.onLoad&&n.props.onLoad()},n.origin="https://commerce.coinbase.com",n.isValidMessage=n.isValidMessage.bind(n),n.handleMessage=n.handleMessage.bind(n),n.handleIFrameLoaded=n.handleIFrameLoaded.bind(n),n.uuid=(0,a.generateUUID)(),n.hostName=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),n.state={loading:!0},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.Component),r(t,[{key:"componentDidMount",value:function(){this.ifr.onload=this.handleIFrameLoaded,window.addEventListener("message",this.handleMessage)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("message",this.handleMessage)}},{key:"render",value:function(){var e=this,t=this.props,n=t.checkoutId,r=t.chargeId,a=n?"checkout":r?"charge":null;if(!a)throw new Error("must supply either checkoutId or chargeId prop");var i=n||r,c=this.origin+"/embed/"+a+"/"+encodeURI(i)+"?origin="+encodeURI(this.hostName)+"&version="+encodeURI("1.0.0")+"&buttonId="+this.uuid;return o.createElement("div",{className:"coinbase-commerce-iframe-container"},this.state.loading?o.createElement("div",{className:"commerce-loading-spinner"}):null,o.createElement("iframe",{className:"coinbase-commerce-iframe",ref:function(t){e.ifr=t},src:c,allowtransparency:"yes",scrolling:"no",frameBorder:"no"}))}}]),t}();t.default=i},,function(e,t,n){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0));n(8);var i=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.PureComponent),o(t,[{key:"render",value:function(){var e=this.props,t=e.styled,n=e.children,o=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["styled","children"]);return a.createElement("button",r({},o,{className:t?"coinbase-commerce-button":o.className}),n||"Buy With Crypto")}}]),t}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),i=u(n(9)),c=u(n(6));function u(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleButtonClick=function(){n.setState({showModal:!0})},n.handleModalClose=function(){n.setState({showModal:!1}),n.props.onModalClosed&&n.props.onModalClosed()},n.handleError=function(e){console.error(e),n.setState({showModal:!1})},n.state={showModal:!1},n.handleButtonClick=n.handleButtonClick.bind(n),n.handleModalClose=n.handleModalClose.bind(n),n.handleError=n.handleError.bind(n),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.Component),r(t,[{key:"render",value:function(){var e=this.state.showModal,t=this.props,n={onLoad:t.onLoad,onChargeSuccess:t.onChargeSuccess,onChargeFailure:t.onChargeFailure,checkoutId:t.checkoutId,chargeId:t.chargeId},r=function(e){var t=o({},e);return["onLoad","onChargeSuccess","onChargeFailure","checkoutId","chargeId"].forEach(function(e){return delete t[e]}),t}(this.props);return a.createElement(a.Fragment,null,a.createElement(i.default,o({},r,{onClick:this.handleButtonClick.bind(this)})),e&&a.createElement(c.default,o({},n,{onModalClose:this.handleModalClose.bind(this),onError:this.handleError})))}}]),t}();t.default=l}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("react-coinbase-commerce",["React"],t):"object"==typeof exports?exports["react-coinbase-commerce"]=t(require("react")):e["react-coinbase-commerce"]=t(e.React)}(window,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s=10)}([function(t,n){t.exports=e},,function(e,t,n){},,function(e,t,n){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a=n(5);n(4),n(2);var i=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.isValidMessage=function(e){return e.origin===n.origin&&e.data.buttonId===n.uuid},n.handleMessage=function(e){if(n.isValidMessage(e)){var t=n.props,r=t.onChargeSuccess,o=t.onChargeFailure,a=t.onModalClose,i=t.onError;switch(e.data.event){case"charge_confirmed":r&&r(e.data);break;case"charge_failed":o&&o(e.data);break;case"error_not_found":i(e.data);break;case"checkout_modal_closed":a()}}},n.handleIFrameLoaded=function(){n.setState({loading:!1}),n.props.onLoad&&n.props.onLoad()},n.origin="https://commerce.coinbase.com",n.isValidMessage=n.isValidMessage.bind(n),n.handleMessage=n.handleMessage.bind(n),n.handleIFrameLoaded=n.handleIFrameLoaded.bind(n),n.uuid=(0,a.generateUUID)(),n.hostName=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),n.state={loading:!0},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.Component),r(t,[{key:"componentDidMount",value:function(){this.ifr.onload=this.handleIFrameLoaded,window.addEventListener("message",this.handleMessage)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("message",this.handleMessage)}},{key:"render",value:function(){var e=this,t=this.props,n=t.checkoutId,r=t.chargeId,a=n?"checkout":r?"charges":null;if(!a)throw new Error("must supply either checkoutId or chargeId prop");var i=n||r,c=this.origin+"/embed/"+a+"/"+encodeURI(i)+"?origin="+encodeURI(this.hostName)+"&version="+encodeURI("1.0.1")+"&buttonId="+this.uuid;return o.createElement("div",{className:"coinbase-commerce-iframe-container"},this.state.loading?o.createElement("div",{className:"commerce-loading-spinner"}):null,o.createElement("iframe",{className:"coinbase-commerce-iframe",ref:function(t){e.ifr=t},src:c,allowtransparency:"yes",scrolling:"no",frameBorder:"no"}))}}]),t}();t.default=i},,function(e,t,n){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0));n(8);var i=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.PureComponent),o(t,[{key:"render",value:function(){var e=this.props,t=e.styled,n=e.children,o=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["styled","children"]);return a.createElement("button",r({},o,{className:t?"coinbase-commerce-button":o.className}),n||"Buy With Crypto")}}]),t}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),i=u(n(9)),c=u(n(6));function u(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleButtonClick=function(){n.setState({showModal:!0})},n.handleModalClose=function(){n.setState({showModal:!1}),n.props.onModalClosed&&n.props.onModalClosed()},n.handleError=function(e){console.error(e),n.setState({showModal:!1})},n.state={showModal:!1},n.handleButtonClick=n.handleButtonClick.bind(n),n.handleModalClose=n.handleModalClose.bind(n),n.handleError=n.handleError.bind(n),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.Component),r(t,[{key:"render",value:function(){var e=this.state.showModal,t=this.props,n={onLoad:t.onLoad,onChargeSuccess:t.onChargeSuccess,onChargeFailure:t.onChargeFailure,checkoutId:t.checkoutId,chargeId:t.chargeId},r=function(e){var t=o({},e);return["onLoad","onChargeSuccess","onChargeFailure","checkoutId","chargeId"].forEach(function(e){return delete t[e]}),t}(this.props);return a.createElement(a.Fragment,null,a.createElement(i.default,o({},r,{onClick:this.handleButtonClick.bind(this)})),e&&a.createElement(c.default,o({},n,{onModalClose:this.handleModalClose.bind(this),onError:this.handleError})))}}]),t}();t.default=l}])});
{
"name": "react-coinbase-commerce",
"version": "1.0.0",
"version": "1.0.1",
"description": "A react component to easily embed a Coinbase Commerce Checkout within your application",
"keywords": ["react", "cryptocurrency", "coinbase", "commerce", "bitcoin", "litecoin", "ethereum"],
"keywords": [
"react",
"cryptocurrency",
"coinbase",
"commerce",
"bitcoin",
"litecoin",
"ethereum"
],
"homepage": "https://github.com/coinbase/react-coinbase-commerce",

@@ -33,4 +41,5 @@ "main": "dist/index.js",

"globals": {
"VERSION": "1"
}
"VERSION": "1"
},
"testURL": "http://localhost"
},

@@ -37,0 +46,0 @@ "author": "Tyson Battistella",

@@ -0,1 +1,5 @@

[![CircleCI](https://circleci.com/gh/coinbase/react-coinbase-commerce/tree/master.svg?style=svg)](https://circleci.com/gh/coinbase/react-coinbase-commerce/tree/master)
[![npm version](https://badge.fury.io/js/react-coinbase-commerce.svg)](https://badge.fury.io/js/react-coinbase-commerce)
# Coinbase Commerce React Button

@@ -2,0 +6,0 @@ A button to embed a Coinbase Commerce checkout or charge directly into your React application.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc