You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-payment-request-api

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-payment-request-api - npm Package Compare versions

Comparing version

to
3.0.0

2

dist/react-payment-request-api.min.js

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

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):t["react-payment-request-api"]=n(t.React)}(this,function(t){"use strict";function n(t,n){function e(){this.constructor=t}o(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function e(t,n){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(e[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)n.indexOf(r[o])<0&&(e[r[o]]=t[r[o]]);return e}var r,o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])},i=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++){n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},u=function(t){var n=t.reduce(function(t,n){if(n.supportedMethods&&"basic-card"===n.supportedMethods[0]){var e=n;if(e.data&&e.data.supportedNetworks)return{supportedMethods:e.data.supportedNetworks}}return t},null);return n?[n].concat(t):t.slice()},c=function(){return!!window.PaymentRequest},p=function(t,n,e){e&&t.addEventListener(n,function(n){return n.updateWith(new Promise(function(n,r){return e(t,n,r)}))})},a=function(){return r.abort()},s=function(t){return function(){r=new PaymentRequest(u(t.methodData),t.details,t.options||{}),p(r,"shippingaddresschange",t.onShippingAddressChange),p(r,"shippingoptionchange",t.onShippingOptionChange),r.show().then(function(n){return new Promise(function(e,r){return t.onShowSuccess(n,e,r)}).then(function(){return n.complete("success")}).catch(function(){return n.complete("fail")})}).catch(function(n){return t.onShowFail(n)})}};return function(){return function(r){return function(o){function u(){return null!==o&&o.apply(this,arguments)||this}return n(u,o),u.prototype.render=function(){var n=this.props,o=n.config,u=e(n,["config"]),p=c(),f=p&&o?{isSupported:p,abort:a,show:s(o)}:{isSupported:p};return t.createElement(r,i({},u,f))},u}(t.Component)}}});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):t["react-payment-request-api"]=n(t.React)}(this,function(c){"use strict";var o=function(t,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};var p,f=function(){return(f=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++)for(var r in n=arguments[e])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)};var a=function(e,t,o){o&&e.addEventListener(t,function(t){return t.updateWith(new Promise(function(t,n){return o(e,t,n)}))})},s=function(){return p.abort()};return function(){return function(u){return function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return function(t,n){function e(){this.constructor=t}o(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}(n,t),n.prototype.render=function(){var o,t=this.props,n=t.config,e=function(t,n){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&n.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)n.indexOf(o[r])<0&&(e[o[r]]=t[o[r]])}return e}(t,["config"]),r=!!window.PaymentRequest,i=r&&n?{isSupported:r,abort:s,show:(o=n,function(){p=new PaymentRequest(o.methodData,o.details,o.options||{}),a(p,"shippingaddresschange",o.onShippingAddressChange),a(p,"shippingoptionchange",o.onShippingOptionChange),p.show().then(function(e){return new Promise(function(t,n){return o.onShowSuccess(e,t,n)}).then(function(){return e.complete("success")}).catch(function(){return e.complete("fail")})}).catch(function(t){return o.onShowFail(t)})})}:{isSupported:r};return c.createElement(u,f({},e,i))},n}(c.Component)}}});

@@ -6,3 +6,3 @@ export declare type Resolve = (value?: {} | PromiseLike<{}>) => void;

methodData: PaymentMethodData[];
details: PaymentDetails;
details: PaymentDetailsInit;
options?: PaymentOptions;

@@ -9,0 +9,0 @@ onShowSuccess: (paymentResponse: PaymentResponse, resolve: Resolve, reject: Reject) => void;

@@ -13,4 +13,3 @@ {

"collectCoverageFrom": ["src/paymentRequest.tsx", "src/normalizeInstrumentations.ts"],
"mapCoverage": true,
"setupTestFrameworkScriptFile": "./enzyme-setup.js"
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var details = {
displayItems: [],
total: {},
total: {
label: 'Total due',
amount: { currency: 'USD', value: '22.15' },
},
};

@@ -7,0 +9,0 @@ var getConfig = function (onShowFail, removeOptions) { return ({

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {

@@ -12,9 +15,12 @@ extendStatics(d, b);

})();
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};

@@ -32,3 +38,2 @@ var __rest = (this && this.__rest) || function (s, e) {

var React = require("react");
var normalizeInstrumentations_1 = require("./normalizeInstrumentations");
var request;

@@ -43,3 +48,3 @@ var hasSupport = function () { return !!window.PaymentRequest; };

exports.show = function (params) { return function () {
request = new PaymentRequest(normalizeInstrumentations_1.default(params.methodData), params.details, params.options || {});
request = new PaymentRequest(params.methodData, params.details, params.options || {});
addEventListener(request, 'shippingaddresschange', params.onShippingAddressChange);

@@ -46,0 +51,0 @@ addEventListener(request, 'shippingoptionchange', params.onShippingOptionChange);

@@ -6,3 +6,3 @@ export declare type Resolve = (value?: {} | PromiseLike<{}>) => void;

methodData: PaymentMethodData[];
details: PaymentDetails;
details: PaymentDetailsInit;
options?: PaymentOptions;

@@ -9,0 +9,0 @@ onShowSuccess: (paymentResponse: PaymentResponse, resolve: Resolve, reject: Reject) => void;

{
"name": "react-payment-request-api",
"version": "2.1.0",
"version": "3.0.0",
"description": "React high order component that expose the payment request api",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"jsnext:main": "lib/index.d.ts",
"module": "lib/index.d.ts",
"scripts": {

@@ -38,26 +36,26 @@ "clean": "rm -rf ./lib && rm -rf ./dist",

"devDependencies": {
"@types/enzyme": "^3.1.0",
"@types/jest": "^21.1.4",
"@types/react": "^16.0.16",
"@types/react-dom": "^16.0.2",
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.2",
"jest": "^21.2.1",
"pre-commit": "^1.1.3",
"react-test-renderer": "^16.0.0",
"@types/enzyme": "^3.1.14",
"@types/jest": "^23.3.2",
"@types/react": "^16.4.14",
"@types/react-dom": "^16.0.7",
"enzyme": "^3.6.0",
"enzyme-adapter-react-16": "^1.5.0",
"jest": "^23.6.0",
"pre-commit": "^1.2.2",
"react-test-renderer": "^16.5.2",
"rollup": "^0.50.0",
"rollup-plugin-typescript2": "^0.7.0",
"rollup-plugin-uglify": "^2.0.1",
"source-map-loader": "^0.2.2",
"ts-jest": "^21.1.3",
"ts-loader": "^3.0.5",
"tslint": "^5.8.0",
"tslint-eslint-rules": "^4.0.0",
"tslint-microsoft-contrib": "^5.0.1",
"tslint-react": "^3.2.0",
"typescript": "^2.5.3"
"source-map-loader": "^0.2.4",
"ts-jest": "^23.10.1",
"ts-loader": "^5.2.1",
"tslint": "^5.11.0",
"tslint-eslint-rules": "^5.4.0",
"tslint-microsoft-contrib": "^5.2.1",
"tslint-react": "^3.6.0",
"typescript": "^3.0.3"
},
"dependencies": {
"react": "^16.0.0",
"react-dom": "^16.0.0"
"react": "^16.5.2",
"react-dom": "^16.5.2"
},

@@ -64,0 +62,0 @@ "pre-commit": [

@@ -26,3 +26,3 @@ <p align="center">

[Payment request api](https://developers.google.com/web/fundamentals/getting-started/primers/payment-request/) is supported on Chrome for desktop v. ^60.0, Chrome for Android and Android Webview v. ^53.0, Microsoft Edge v. ^15.0.
[Payment request api](https://developers.google.com/web/fundamentals/getting-started/primers/payment-request/) is supported on Chrome for desktop v. ^61.0, Chrome for Android and Android Webview v. ^56.0, Microsoft Edge v. ^15.0.

@@ -73,23 +73,2 @@ ## Demo

#### How does it support browser that were implementing the first draft of Payment Request?
Chrome v. 53.0 - 55.00 was implementing a draft of the standard for Payment Request. Since then, there have been some evolutions on how to define `paymentMethods` in the configuration. Specifically, the payment methos should now be defined as:
```bash
{
supportedMethods: ['basic-card'],
data: {
supportedNetworks: ['visa', 'mastercard'],
},
}
```
The library de-normalize the configuration to be able to support the old standard that looks like:
```bash
{
supportedMethods: ['visa', 'mastercard']
}
```
#### Does it support Redux or any other flux implementation?

@@ -96,0 +75,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet