react-coinbase-commerce
Advanced tools
Comparing version 1.4.3 to 1.4.4
@@ -1,1 +0,1 @@ | ||
module.exports=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=1)}([function(e,t){e.exports=require("react")},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(2)),c=u(n(5));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}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,e),r(t,[{key:"render",value:function(){var e=this.state.showModal,t=this.props,n=t.onLoad,r=t.onChargeSuccess,u=t.onChargeFailure,l=t.checkoutId,s=t.chargeId,f=t.customMetadata,d=t.onPaymentDetected,p=t.disableCaching,h=t.wrapperStyle,y={onLoad:n,onChargeSuccess:r,onChargeFailure:u,checkoutId:l,chargeId:s,onPaymentDetected:d,disableCaching:p},b=function(e){var t=o({},e);return["onLoad","onChargeSuccess","onChargeFailure","customMetadata","onPaymentDetected","checkoutId","chargeId","disableCaching","wrapperStyle"].forEach((function(e){return delete t[e]})),t}(this.props);return a.createElement("div",{style:h},a.createElement("a",{href:"https://commerce.coinbase.com",rel:"external",title:"Pay with Bitcoin, Bitcoin Cash, DAI, Litecoin, Ethereum, or USD Coin",onClick:function(e){return e.preventDefault()}},a.createElement(i.default,o({},b,{onClick:this.handleButtonClick}))),e&&a.createElement(c.default,o({},y,{onModalClose:this.handleModalClose,onError:this.handleError,customMetadata:f})))}}]),t}(a.Component);t.default=l},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));function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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}n(3);var u=function(e){function t(){return i(this,t),c(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,e),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}(a.PureComponent);t.default=u},function(e,t,n){},,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(6);n(7),n(9);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.buildSrc=function(e){var t=n.props,r=t.checkoutId,o=t.chargeId,a=t.customMetadata,i=t.disableCaching;var c=void 0,u=void 0;if(r)u=r,c="checkout";else{if(!o)throw new Error("must supply either checkoutId or chargeId prop");u=o,c="charges"}var l={origin:e,version:"1.4.3",buttonId:n.uuid,cacheDisabled:i},s="";return a&&"string"!=typeof a?console.error('Received customMetadata not of "string" type. Ignoring.'):a&&(s=a),s&&(l.custom=s),n.origin+"/embed/"+c+"/"+encodeURI(u)+"?"+function(e){var t=[],n=window.encodeURIComponent;for(var r in e)e.hasOwnProperty(r)&&t.push(n(r)+"="+n(e[r]));return t.join("&")}(l)},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,c=t.onPaymentDetected;switch(e.data.event){case"charge_confirmed":r&&r(e.data);break;case"charge_failed":o&&o(e.data);break;case"payment_detected":c&&c(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.uuid=(0,a.generateUUID)(),n.state={loading:!0,src:null},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,e),r(t,[{key:"componentDidMount",value:function(){window.addEventListener("message",this.handleMessage);var e=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");this.setState({src:this.buildSrc(e)})}},{key:"componentWillUnmount",value:function(){window.removeEventListener("message",this.handleMessage)}},{key:"render",value:function(){var e=this.state,t=e.loading,n=e.src;return o.createElement("div",{className:"coinbase-commerce-iframe-container"},t||null===n&&o.createElement("div",{className:"commerce-loading-spinner"}),null!==n&&o.createElement("iframe",{onLoad:this.handleIFrameLoaded,className:"coinbase-commerce-iframe",src:n,scrolling:"no",frameBorder:"no"}))}}]),t}(o.Component);t.default=i},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){},,function(e,t,n){}]); | ||
module.exports=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=1)}([function(e,t){e.exports=require("react")},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(2)),c=u(n(5));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}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,e),r(t,[{key:"render",value:function(){var e=this.state.showModal,t=this.props,n=t.onLoad,r=t.onChargeSuccess,u=t.onChargeFailure,l=t.checkoutId,s=t.chargeId,f=t.customMetadata,d=t.onPaymentDetected,p=t.disableCaching,h=t.wrapperStyle,y={onLoad:n,onChargeSuccess:r,onChargeFailure:u,checkoutId:l,chargeId:s,onPaymentDetected:d,disableCaching:p},b=function(e){var t=o({},e);return["onLoad","onChargeSuccess","onChargeFailure","customMetadata","onPaymentDetected","checkoutId","chargeId","disableCaching","wrapperStyle"].forEach((function(e){return delete t[e]})),t}(this.props);return a.createElement("div",{style:h},a.createElement("a",{href:"https://commerce.coinbase.com",rel:"external",title:"Pay with Bitcoin, Bitcoin Cash, DAI, Litecoin, Ethereum, or USD Coin",onClick:function(e){return e.preventDefault()}},a.createElement(i.default,o({},b,{onClick:this.handleButtonClick}))),e&&a.createElement(c.default,o({},y,{onModalClose:this.handleModalClose,onError:this.handleError,customMetadata:f})))}}]),t}(a.Component);t.default=l},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));function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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}n(3);var u=function(e){function t(){return i(this,t),c(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,e),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}(a.PureComponent);t.default=u},function(e,t,n){},,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(6);n(7),n(9);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.buildSrc=function(e){var t=n.props,r=t.checkoutId,o=t.chargeId,a=t.customMetadata,i=t.disableCaching;var c=void 0,u=void 0;if(r)u=r,c="checkout";else{if(!o)throw new Error("must supply either checkoutId or chargeId prop");u=o,c="charges"}var l={origin:e,version:"1.4.4",buttonId:n.uuid,cacheDisabled:i},s="";return a&&"string"!=typeof a?console.error('Received customMetadata not of "string" type. Ignoring.'):a&&(s=a),s&&(l.custom=s),n.origin+"/embed/"+c+"/"+encodeURI(u)+"?"+function(e){var t=[],n=window.encodeURIComponent;for(var r in e)e.hasOwnProperty(r)&&t.push(n(r)+"="+n(e[r]));return t.join("&")}(l)},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,c=t.onPaymentDetected;switch(e.data.event){case"charge_confirmed":r&&r(e.data);break;case"charge_failed":o&&o(e.data);break;case"payment_detected":c&&c(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.uuid=(0,a.generateUUID)(),n.state={loading:!0,src:null},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,e),r(t,[{key:"componentDidMount",value:function(){window.addEventListener("message",this.handleMessage);var e=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");this.setState({src:this.buildSrc(e)})}},{key:"componentWillUnmount",value:function(){window.removeEventListener("message",this.handleMessage)}},{key:"render",value:function(){var e=this.state,t=e.loading,n=e.src;return o.createElement("div",{className:"coinbase-commerce-iframe-container"},t||null===n&&o.createElement("div",{className:"commerce-loading-spinner"}),null!==n&&o.createElement("iframe",{onLoad:this.handleIFrameLoaded,className:"coinbase-commerce-iframe",src:n,scrolling:"no",frameBorder:"no"}))}}]),t}(o.Component);t.default=i},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){},,function(e,t,n){}]); |
{ | ||
"name": "react-coinbase-commerce", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"description": "A react component to easily embed a Coinbase Commerce Checkout within your application", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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