@stripe/stripe-js
Advanced tools
Comparing version 1.8.0 to 1.9.0
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
@@ -15,22 +17,2 @@ _typeof = function (obj) { | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
} | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
} | ||
var V3_URL = 'https://js.stripe.com/v3'; | ||
@@ -69,3 +51,3 @@ var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/; | ||
var registerWrapper = function registerWrapper(stripe) { | ||
var registerWrapper = function registerWrapper(stripe, startTime) { | ||
if (!stripe || !stripe._registerWrapper) { | ||
@@ -77,3 +59,4 @@ return; | ||
name: 'stripe-js', | ||
version: "1.8.0" | ||
version: "1.9.0", | ||
startTime: startTime | ||
}); | ||
@@ -132,3 +115,3 @@ }; | ||
}; | ||
var initStripe = function initStripe(maybeStripe, args) { | ||
var initStripe = function initStripe(maybeStripe, args, startTime) { | ||
if (maybeStripe === null) { | ||
@@ -138,4 +121,4 @@ return null; | ||
var stripe = maybeStripe.apply(void 0, _toConsumableArray(args)); | ||
registerWrapper(stripe); | ||
var stripe = maybeStripe.apply(undefined, args); | ||
registerWrapper(stripe, startTime); | ||
return stripe; | ||
@@ -165,4 +148,5 @@ }; | ||
loadStripeCalled = true; | ||
var startTime = Date.now(); | ||
return loadScript(loadParams).then(function (maybeStripe) { | ||
return initStripe(maybeStripe, args); | ||
return initStripe(maybeStripe, args, startTime); | ||
}); | ||
@@ -169,0 +153,0 @@ }; |
@@ -6,2 +6,4 @@ 'use strict'; | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
@@ -20,22 +22,2 @@ _typeof = function (obj) { | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
} | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
} | ||
var V3_URL = 'https://js.stripe.com/v3'; | ||
@@ -74,3 +56,3 @@ var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/; | ||
var registerWrapper = function registerWrapper(stripe) { | ||
var registerWrapper = function registerWrapper(stripe, startTime) { | ||
if (!stripe || !stripe._registerWrapper) { | ||
@@ -82,3 +64,4 @@ return; | ||
name: 'stripe-js', | ||
version: "1.8.0" | ||
version: "1.9.0", | ||
startTime: startTime | ||
}); | ||
@@ -137,3 +120,3 @@ }; | ||
}; | ||
var initStripe = function initStripe(maybeStripe, args) { | ||
var initStripe = function initStripe(maybeStripe, args, startTime) { | ||
if (maybeStripe === null) { | ||
@@ -143,4 +126,4 @@ return null; | ||
var stripe = maybeStripe.apply(void 0, _toConsumableArray(args)); | ||
registerWrapper(stripe); | ||
var stripe = maybeStripe.apply(undefined, args); | ||
registerWrapper(stripe, startTime); | ||
return stripe; | ||
@@ -170,4 +153,5 @@ }; | ||
loadStripeCalled = true; | ||
var startTime = Date.now(); | ||
return loadScript(loadParams).then(function (maybeStripe) { | ||
return initStripe(maybeStripe, args); | ||
return initStripe(maybeStripe, args, startTime); | ||
}); | ||
@@ -174,0 +158,0 @@ }; |
@@ -1,21 +0,1 @@ | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
} | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
} | ||
var V3_URL = 'https://js.stripe.com/v3'; | ||
@@ -54,3 +34,3 @@ var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/; | ||
var registerWrapper = function registerWrapper(stripe) { | ||
var registerWrapper = function registerWrapper(stripe, startTime) { | ||
if (!stripe || !stripe._registerWrapper) { | ||
@@ -62,3 +42,4 @@ return; | ||
name: 'stripe-js', | ||
version: "1.8.0" | ||
version: "1.9.0", | ||
startTime: startTime | ||
}); | ||
@@ -117,3 +98,3 @@ }; | ||
}; | ||
var initStripe = function initStripe(maybeStripe, args) { | ||
var initStripe = function initStripe(maybeStripe, args, startTime) { | ||
if (maybeStripe === null) { | ||
@@ -123,4 +104,4 @@ return null; | ||
var stripe = maybeStripe.apply(void 0, _toConsumableArray(args)); | ||
registerWrapper(stripe); | ||
var stripe = maybeStripe.apply(undefined, args); | ||
registerWrapper(stripe, startTime); | ||
return stripe; | ||
@@ -146,4 +127,5 @@ }; | ||
loadCalled = true; | ||
var startTime = Date.now(); | ||
return stripePromise$1.then(function (maybeStripe) { | ||
return initStripe(maybeStripe, args); | ||
return initStripe(maybeStripe, args, startTime); | ||
}); | ||
@@ -150,0 +132,0 @@ }; |
@@ -5,22 +5,2 @@ 'use strict'; | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
} | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
} | ||
var V3_URL = 'https://js.stripe.com/v3'; | ||
@@ -59,3 +39,3 @@ var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/; | ||
var registerWrapper = function registerWrapper(stripe) { | ||
var registerWrapper = function registerWrapper(stripe, startTime) { | ||
if (!stripe || !stripe._registerWrapper) { | ||
@@ -67,3 +47,4 @@ return; | ||
name: 'stripe-js', | ||
version: "1.8.0" | ||
version: "1.9.0", | ||
startTime: startTime | ||
}); | ||
@@ -122,3 +103,3 @@ }; | ||
}; | ||
var initStripe = function initStripe(maybeStripe, args) { | ||
var initStripe = function initStripe(maybeStripe, args, startTime) { | ||
if (maybeStripe === null) { | ||
@@ -128,4 +109,4 @@ return null; | ||
var stripe = maybeStripe.apply(void 0, _toConsumableArray(args)); | ||
registerWrapper(stripe); | ||
var stripe = maybeStripe.apply(undefined, args); | ||
registerWrapper(stripe, startTime); | ||
return stripe; | ||
@@ -151,4 +132,5 @@ }; | ||
loadCalled = true; | ||
var startTime = Date.now(); | ||
return stripePromise$1.then(function (maybeStripe) { | ||
return initStripe(maybeStripe, args); | ||
return initStripe(maybeStripe, args, startTime); | ||
}); | ||
@@ -155,0 +137,0 @@ }; |
{ | ||
"name": "@stripe/stripe-js", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "Stripe.js loading utility", | ||
@@ -5,0 +5,0 @@ "main": "dist/stripe.js", |
@@ -6,6 +6,6 @@ # Stripe.js ES Module | ||
**Note**: To be | ||
[PCI compliant](https://stripe.com/docs/security#validating-pci-compliance), you | ||
must load Stripe.js directly from `https://js.stripe.com`. You cannot include it | ||
in a bundle or host it yourself. This package wraps the global `Stripe` function | ||
provided by the Stripe.js script as an ES module. | ||
[PCI compliant](https://stripe.com/docs/security/guide#validating-pci-compliance), | ||
you must load Stripe.js directly from `https://js.stripe.com`. You cannot | ||
include it in a bundle or host it yourself. This package wraps the global | ||
`Stripe` function provided by the Stripe.js script as an ES module. | ||
@@ -12,0 +12,0 @@ [![npm version](https://img.shields.io/npm/v/@stripe/stripe-js.svg?style=flat-square)](https://www.npmjs.com/package/@stripe/stripe-js) |
@@ -17,4 +17,7 @@ import {loadScript, initStripe, LoadStripe} from './shared'; | ||
loadCalled = true; | ||
const startTime = Date.now(); | ||
return stripePromise.then((maybeStripe) => initStripe(maybeStripe, args)); | ||
return stripePromise.then((maybeStripe) => | ||
initStripe(maybeStripe, args, startTime) | ||
); | ||
}; |
@@ -18,5 +18,6 @@ import { | ||
loadStripeCalled = true; | ||
const startTime = Date.now(); | ||
return loadScript(loadParams).then((maybeStripe) => | ||
initStripe(maybeStripe, args) | ||
initStripe(maybeStripe, args, startTime) | ||
); | ||
@@ -23,0 +24,0 @@ }; |
@@ -58,3 +58,3 @@ ///<reference path='../types/index.d.ts' /> | ||
const registerWrapper = (stripe: any): void => { | ||
const registerWrapper = (stripe: any, startTime: number): void => { | ||
if (!stripe || !stripe._registerWrapper) { | ||
@@ -64,3 +64,3 @@ return; | ||
stripe._registerWrapper({name: 'stripe-js', version: _VERSION}); | ||
stripe._registerWrapper({name: 'stripe-js', version: _VERSION, startTime}); | ||
}; | ||
@@ -126,3 +126,4 @@ | ||
maybeStripe: StripeConstructor | null, | ||
args: Parameters<StripeConstructor> | ||
args: Parameters<StripeConstructor>, | ||
startTime: number | ||
): Stripe | null => { | ||
@@ -133,4 +134,4 @@ if (maybeStripe === null) { | ||
const stripe = maybeStripe(...args); | ||
registerWrapper(stripe); | ||
const stripe = maybeStripe.apply(undefined, args); | ||
registerWrapper(stripe, startTime); | ||
return stripe; | ||
@@ -137,0 +138,0 @@ }; |
@@ -101,34 +101,3 @@ declare module '@stripe/stripe-js' { | ||
*/ | ||
locale?: | ||
| 'auto' | ||
| 'bg' | ||
| 'cs' | ||
| 'da' | ||
| 'de' | ||
| 'el' | ||
| 'en' | ||
| 'es' | ||
| 'es-419' | ||
| 'et' | ||
| 'fi' | ||
| 'fr' | ||
| 'hu' | ||
| 'it' | ||
| 'ja' | ||
| 'lt' | ||
| 'lv' | ||
| 'ms' | ||
| 'mt' | ||
| 'nb' | ||
| 'nl' | ||
| 'pl' | ||
| 'pt' | ||
| 'pt-BR' | ||
| 'ro' | ||
| 'ru' | ||
| 'sk' | ||
| 'sl' | ||
| 'sv' | ||
| 'tr' | ||
| 'zh'; | ||
locale?: CheckoutLocale; | ||
@@ -146,2 +115,40 @@ /** | ||
| RedirectToCheckoutClientOptions; | ||
type CheckoutLocale = | ||
| 'auto' | ||
| 'bg' | ||
| 'cs' | ||
| 'da' | ||
| 'de' | ||
| 'el' | ||
| 'en' | ||
| 'en-GB' | ||
| 'es' | ||
| 'es-419' | ||
| 'et' | ||
| 'fi' | ||
| 'fr' | ||
| 'fr-CA' | ||
| 'hu' | ||
| 'id' | ||
| 'it' | ||
| 'ja' | ||
| 'lt' | ||
| 'lv' | ||
| 'ms' | ||
| 'mt' | ||
| 'nb' | ||
| 'nl' | ||
| 'pl' | ||
| 'pt' | ||
| 'pt-BR' | ||
| 'ro' | ||
| 'ru' | ||
| 'sk' | ||
| 'sl' | ||
| 'sv' | ||
| 'tr' | ||
| 'zh' | ||
| 'zh-HK' | ||
| 'zh-TW'; | ||
} |
@@ -201,2 +201,35 @@ ///<reference path='./elements/card.d.ts' /> | ||
type StripeElementLocale = | ||
| 'auto' | ||
| 'ar' | ||
| 'bg' | ||
| 'cs' | ||
| 'da' | ||
| 'de' | ||
| 'el' | ||
| 'en' | ||
| 'es' | ||
| 'es-419' | ||
| 'et' | ||
| 'fi' | ||
| 'fr' | ||
| 'he' | ||
| 'id' | ||
| 'it' | ||
| 'ja' | ||
| 'lt' | ||
| 'lv' | ||
| 'ms' | ||
| 'nb' | ||
| 'nl' | ||
| 'no' | ||
| 'pl' | ||
| 'pt' | ||
| 'pt-BR' | ||
| 'ru' | ||
| 'sk' | ||
| 'sl' | ||
| 'sv' | ||
| 'zh'; | ||
/** | ||
@@ -216,34 +249,3 @@ * Options to create an `Elements` instance with. | ||
*/ | ||
locale?: | ||
| 'auto' | ||
| 'ar' | ||
| 'bg' | ||
| 'cs' | ||
| 'da' | ||
| 'de' | ||
| 'el' | ||
| 'en' | ||
| 'es' | ||
| 'es-419' | ||
| 'et' | ||
| 'fi' | ||
| 'fr' | ||
| 'he' | ||
| 'id' | ||
| 'it' | ||
| 'ja' | ||
| 'lt' | ||
| 'lv' | ||
| 'ms' | ||
| 'nb' | ||
| 'nl' | ||
| 'no' | ||
| 'pl' | ||
| 'pt' | ||
| 'pt-BR' | ||
| 'ru' | ||
| 'sk' | ||
| 'sl' | ||
| 'sv' | ||
| 'zh'; | ||
locale?: StripeElementLocale; | ||
} | ||
@@ -250,0 +252,0 @@ |
@@ -44,2 +44,19 @@ ///<reference path='./checkout.d.ts' /> | ||
/** | ||
* Use `stripe.confirmAlipayPayment` in the [Alipay Payments](https://stripe.com/docs/payments/alipay) with Payment Methods flow when the customer submits your payment form. | ||
* When called, it will confirm the [PaymentIntent](https://stripe.com/docs/api/payment_intents) with `data` you provide, and it will automatically redirect the customer to authorize the transaction. | ||
* Once authorization is complete, the customer will be redirected back to your specified `return_url`. | ||
* | ||
* When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](https://stripe.com/docs/api/payment_methods). | ||
* In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new PaymentMethod for you. | ||
* If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. | ||
* | ||
* @docs https://stripe.com/docs/js/payment_intents/confirm_alipay_payment | ||
*/ | ||
confirmAlipayPayment( | ||
clientSecret: string, | ||
data?: ConfirmAlipayPaymentData, | ||
options?: ConfirmAlipayPaymentOptions | ||
): Promise<{paymentIntent?: PaymentIntent; error?: StripeError}>; | ||
/** | ||
* Requires beta access: | ||
@@ -488,34 +505,3 @@ * Contact [Stripe support](https://support.stripe.com/) for more information. | ||
*/ | ||
locale?: | ||
| 'auto' | ||
| 'ar' | ||
| 'bg' | ||
| 'cs' | ||
| 'da' | ||
| 'de' | ||
| 'el' | ||
| 'en' | ||
| 'es' | ||
| 'es-419' | ||
| 'et' | ||
| 'fi' | ||
| 'fr' | ||
| 'he' | ||
| 'id' | ||
| 'it' | ||
| 'ja' | ||
| 'lt' | ||
| 'lv' | ||
| 'ms' | ||
| 'nb' | ||
| 'nl' | ||
| 'no' | ||
| 'pl' | ||
| 'pt' | ||
| 'pt-BR' | ||
| 'ru' | ||
| 'sk' | ||
| 'sl' | ||
| 'sv' | ||
| 'zh'; | ||
locale?: StripeElementLocale | CheckoutLocale; | ||
} | ||
@@ -522,0 +508,0 @@ |
@@ -6,2 +6,3 @@ declare module '@stripe/stripe-js' { | ||
type CreatePaymentMethodData = | ||
| CreatePaymentMethodAlipayData | ||
| CreatePaymentMethodAuBecsDebitData | ||
@@ -17,2 +18,6 @@ | CreatePaymentMethodBancontactData | ||
interface CreatePaymentMethodAlipayData extends PaymentMethodCreateParams { | ||
type: 'alipay'; | ||
} | ||
interface CreatePaymentMethodBancontactData | ||
@@ -224,2 +229,34 @@ extends PaymentMethodCreateParams { | ||
/** | ||
* Data to be sent with a `stripe.confirmAlipayPayment` request. | ||
* Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters. | ||
*/ | ||
interface ConfirmAlipayPaymentData extends PaymentIntentConfirmParams { | ||
/* | ||
* The `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods). | ||
* This field is optional if a `PaymentMethod` has already been attached to this `PaymentIntent` or a new `PaymentMethod` will be created. | ||
* | ||
* @recommended | ||
*/ | ||
payment_method?: string | Omit<CreatePaymentMethodAlipayData, 'type'>; | ||
/** | ||
* The url your customer will be directed to after they complete authentication. | ||
* | ||
* @recommended | ||
*/ | ||
return_url?: string; | ||
} | ||
/** | ||
* An options object to control the behavior of `stripe.confirmAlipayPayment`. | ||
*/ | ||
interface ConfirmAlipayPaymentOptions { | ||
/* | ||
* Set this to `false` if you want to [manually handle the authorization redirect](https://stripe.com/docs/payments/alipay/accept-a-payment#handle-redirect). | ||
* Default is `true`. | ||
*/ | ||
handleActions?: boolean; | ||
} | ||
/** | ||
* An options object to control the behavior of `stripe.confirmBancontactPayment`. | ||
@@ -226,0 +263,0 @@ */ |
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
233549
5863