@stripe/stripe-js
Advanced tools
Comparing version 1.46.0 to 1.47.0
@@ -57,3 +57,3 @@ function _typeof(obj) { | ||
name: 'stripe-js', | ||
version: "1.46.0", | ||
version: "1.47.0", | ||
startTime: startTime | ||
@@ -71,3 +71,3 @@ }); | ||
stripePromise = new Promise(function (resolve, reject) { | ||
if (typeof window === 'undefined') { | ||
if (typeof window === 'undefined' || typeof document === 'undefined') { | ||
// Resolve to null when imported server side. This makes the module | ||
@@ -153,2 +153,17 @@ // safe to import in an isomorphic code base. | ||
loadStripe.setLoadParameters = function (params) { | ||
// we won't throw an error if setLoadParameters is called with the same values as before | ||
if (loadStripeCalled && loadParams) { | ||
var validatedParams = validateLoadParams(params); | ||
var parameterKeys = Object.keys(validatedParams); | ||
var sameParameters = parameterKeys.reduce(function (previousValue, currentValue) { | ||
var _loadParams; | ||
return previousValue && params[currentValue] === ((_loadParams = loadParams) === null || _loadParams === void 0 ? void 0 : _loadParams[currentValue]); | ||
}, true); | ||
if (sameParameters) { | ||
return; | ||
} | ||
} | ||
if (loadStripeCalled) { | ||
@@ -155,0 +170,0 @@ throw new Error('You cannot change load parameters after calling loadStripe'); |
@@ -61,3 +61,3 @@ 'use strict'; | ||
name: 'stripe-js', | ||
version: "1.46.0", | ||
version: "1.47.0", | ||
startTime: startTime | ||
@@ -75,3 +75,3 @@ }); | ||
stripePromise = new Promise(function (resolve, reject) { | ||
if (typeof window === 'undefined') { | ||
if (typeof window === 'undefined' || typeof document === 'undefined') { | ||
// Resolve to null when imported server side. This makes the module | ||
@@ -157,2 +157,17 @@ // safe to import in an isomorphic code base. | ||
loadStripe.setLoadParameters = function (params) { | ||
// we won't throw an error if setLoadParameters is called with the same values as before | ||
if (loadStripeCalled && loadParams) { | ||
var validatedParams = validateLoadParams(params); | ||
var parameterKeys = Object.keys(validatedParams); | ||
var sameParameters = parameterKeys.reduce(function (previousValue, currentValue) { | ||
var _loadParams; | ||
return previousValue && params[currentValue] === ((_loadParams = loadParams) === null || _loadParams === void 0 ? void 0 : _loadParams[currentValue]); | ||
}, true); | ||
if (sameParameters) { | ||
return; | ||
} | ||
} | ||
if (loadStripeCalled) { | ||
@@ -159,0 +174,0 @@ throw new Error('You cannot change load parameters after calling loadStripe'); |
@@ -41,3 +41,3 @@ var V3_URL = 'https://js.stripe.com/v3'; | ||
name: 'stripe-js', | ||
version: "1.46.0", | ||
version: "1.47.0", | ||
startTime: startTime | ||
@@ -55,3 +55,3 @@ }); | ||
stripePromise = new Promise(function (resolve, reject) { | ||
if (typeof window === 'undefined') { | ||
if (typeof window === 'undefined' || typeof document === 'undefined') { | ||
// Resolve to null when imported server side. This makes the module | ||
@@ -58,0 +58,0 @@ // safe to import in an isomorphic code base. |
@@ -45,3 +45,3 @@ 'use strict'; | ||
name: 'stripe-js', | ||
version: "1.46.0", | ||
version: "1.47.0", | ||
startTime: startTime | ||
@@ -59,3 +59,3 @@ }); | ||
stripePromise = new Promise(function (resolve, reject) { | ||
if (typeof window === 'undefined') { | ||
if (typeof window === 'undefined' || typeof document === 'undefined') { | ||
// Resolve to null when imported server side. This makes the module | ||
@@ -62,0 +62,0 @@ // safe to import in an isomorphic code base. |
{ | ||
"name": "@stripe/stripe-js", | ||
"version": "1.46.0", | ||
"version": "1.47.0", | ||
"description": "Stripe.js loading utility", | ||
@@ -5,0 +5,0 @@ "main": "dist/stripe.js", |
@@ -130,5 +130,16 @@ /* eslint-disable @typescript-eslint/no-var-requires */ | ||
expect(() => { | ||
loadStripe.setLoadParameters({advancedFraudSignals: false}); | ||
loadStripe.setLoadParameters({advancedFraudSignals: true}); | ||
}).toThrow('cannot change load parameters'); | ||
}); | ||
test('does not throw an error if calling setLoadParameters after loadStripe but the parameters are the same', () => { | ||
const {loadStripe} = require('./pure'); | ||
loadStripe.setLoadParameters({advancedFraudSignals: false}); | ||
loadStripe('pk_foo'); | ||
expect(() => { | ||
loadStripe.setLoadParameters({advancedFraudSignals: false}); | ||
}).not.toThrow('cannot change load parameters'); | ||
}); | ||
}); |
@@ -26,2 +26,23 @@ import { | ||
loadStripe.setLoadParameters = (params): void => { | ||
// we won't throw an error if setLoadParameters is called with the same values as before | ||
if (loadStripeCalled && loadParams) { | ||
const validatedParams = validateLoadParams(params); | ||
const parameterKeys = Object.keys(validatedParams) as Array< | ||
keyof LoadParams | ||
>; | ||
const sameParameters = parameterKeys.reduce( | ||
(previousValue, currentValue) => { | ||
return ( | ||
previousValue && params[currentValue] === loadParams?.[currentValue] | ||
); | ||
}, | ||
true | ||
); | ||
if (sameParameters) { | ||
return; | ||
} | ||
} | ||
if (loadStripeCalled) { | ||
@@ -28,0 +49,0 @@ throw new Error( |
@@ -76,3 +76,3 @@ import {Stripe, StripeConstructor} from '../types'; | ||
stripePromise = new Promise((resolve, reject) => { | ||
if (typeof window === 'undefined') { | ||
if (typeof window === 'undefined' || typeof document === 'undefined') { | ||
// Resolve to null when imported server side. This makes the module | ||
@@ -79,0 +79,0 @@ // safe to import in an isomorphic code base. |
@@ -127,4 +127,6 @@ export interface RedirectToCheckoutServerOptions { | ||
| 'fi' | ||
| 'fil' | ||
| 'fr' | ||
| 'fr-CA' | ||
| 'hr' | ||
| 'hu' | ||
@@ -131,0 +133,0 @@ | 'id' |
@@ -583,6 +583,9 @@ import { | ||
| 'fi' | ||
| 'fil' | ||
| 'fr' | ||
| 'fr-CA' | ||
| 'fr-FR' | ||
| 'he' | ||
| 'hu' | ||
| 'hr' | ||
| 'id' | ||
@@ -589,0 +592,0 @@ | 'it' |
@@ -122,2 +122,9 @@ import {StripeElementBase} from './base'; | ||
update(options: Partial<StripeAddressElementOptions>): StripeAddressElement; | ||
/** | ||
* Validates and retrieves form values from the `AddressElement`. | ||
*/ | ||
getValue(): Promise< | ||
Pick<StripeAddressElementChangeEvent, 'complete' | 'isNewAddress' | 'value'> | ||
>; | ||
}; | ||
@@ -124,0 +131,0 @@ |
@@ -12,2 +12,10 @@ import {StripeElementBase, StripeElementStyle} from '../base'; | ||
update(options: Partial<StripeIssuingCardNumberDisplayElementOptions>): void; | ||
/** | ||
* Triggered when the element is fully rendered and can accept `element.focus` calls. | ||
*/ | ||
on( | ||
eventType: 'ready', | ||
handler: (event: {elementType: 'issuingCardNumberDisplay'}) => any | ||
): StripeIssuingCardNumberDisplayElement; | ||
}; | ||
@@ -14,0 +22,0 @@ |
export * from './checkout'; | ||
export * from './elements'; | ||
export * from './elements-group'; | ||
export * from './ephemeral-keys'; | ||
export * from './financial-connections'; | ||
export * from './orders'; | ||
export * from './payment-intents'; | ||
@@ -5,0 +8,0 @@ export * from './payment-request'; |
Sorry, the diff of this file is too big to display
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
405379
11019
1