@stripe/stripe-js 5.10.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,6 +30,17 @@ Use `npm` to install the Stripe.js module:
30
30
  npm install @stripe/stripe-js
31
31
  ```
32
32
 
33
+ ## Versioning
34
+
35
+ Each `@stripe/stripe-js` version is pinned to a specific
36
+ [Stripe.js version](https://docs.stripe.com/sdks/stripejs-versioning). The
37
+ pinned versions are as follows:
38
+
39
+ | **@stripe/stripe-js** | **Stripe.js** |
40
+ | --------------------- | ------------- |
41
+ | <6 | v3 |
42
+ | v6 | acacia |
43
+
33
44
  ## Usage
34
45
 
35
46
  ### `loadStripe`
@@ -111,7 +122,7 @@ one. When you call `loadStripe`, it will use the existing script tag.
111
122
 
112
123
  ```html
113
124
  <!-- Somewhere in your site's <head> -->
114
- <script src="https://js.stripe.com/v3" async></script>
125
+ <script src="https://js.stripe.com/acacia/stripe.js" async></script>
115
126
  ```
116
127
 
117
128
  ### Importing `loadStripe` without side effects
package/dist/index.js CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var RELEASE_TRAIN = 'v3';
5
+ var RELEASE_TRAIN = 'acacia';
6
6
 
7
7
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion(version) {
8
8
  return version === 3 ? 'v3' : version;
9
9
  };
10
10
 
11
11
  var ORIGIN = 'https://js.stripe.com';
12
- var STRIPE_JS_URL = "".concat(ORIGIN, "/v3") ;
12
+ var STRIPE_JS_URL = "".concat(ORIGIN, "/").concat(RELEASE_TRAIN, "/stripe.js");
13
13
  var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
14
14
  var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
15
15
  var EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
@@ -55,7 +55,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
55
55
 
56
56
  stripe._registerWrapper({
57
57
  name: 'stripe-js',
58
- version: "5.10.0",
58
+ version: "6.0.0",
59
59
  startTime: startTime
60
60
  });
61
61
  };
@@ -151,7 +151,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
151
151
  var expectedVersion = RELEASE_TRAIN;
152
152
 
153
153
  if (isTestKey && version !== expectedVersion) {
154
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("5.10.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
154
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.0.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
155
155
  }
156
156
 
157
157
  var stripe = maybeStripe.apply(undefined, args);
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- var RELEASE_TRAIN = 'v3';
1
+ var RELEASE_TRAIN = 'acacia';
2
2
 
3
3
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion(version) {
4
4
  return version === 3 ? 'v3' : version;
5
5
  };
6
6
 
7
7
  var ORIGIN = 'https://js.stripe.com';
8
- var STRIPE_JS_URL = "".concat(ORIGIN, "/v3") ;
8
+ var STRIPE_JS_URL = "".concat(ORIGIN, "/").concat(RELEASE_TRAIN, "/stripe.js");
9
9
  var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
10
10
  var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
11
11
  var EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
@@ -51,7 +51,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
51
51
 
52
52
  stripe._registerWrapper({
53
53
  name: 'stripe-js',
54
- version: "5.10.0",
54
+ version: "6.0.0",
55
55
  startTime: startTime
56
56
  });
57
57
  };
@@ -147,7 +147,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
147
147
  var expectedVersion = RELEASE_TRAIN;
148
148
 
149
149
  if (isTestKey && version !== expectedVersion) {
150
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("5.10.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
150
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.0.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
151
151
  }
152
152
 
153
153
  var stripe = maybeStripe.apply(undefined, args);
package/dist/pure.js CHANGED
@@ -18,14 +18,14 @@ function _typeof(obj) {
18
18
  return _typeof(obj);
19
19
  }
20
20
 
21
- var RELEASE_TRAIN = 'v3';
21
+ var RELEASE_TRAIN = 'acacia';
22
22
 
23
23
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion(version) {
24
24
  return version === 3 ? 'v3' : version;
25
25
  };
26
26
 
27
27
  var ORIGIN = 'https://js.stripe.com';
28
- var STRIPE_JS_URL = "".concat(ORIGIN, "/v3") ;
28
+ var STRIPE_JS_URL = "".concat(ORIGIN, "/").concat(RELEASE_TRAIN, "/stripe.js");
29
29
  var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
30
30
  var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
31
31
  var EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
@@ -71,7 +71,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
71
71
 
72
72
  stripe._registerWrapper({
73
73
  name: 'stripe-js',
74
- version: "5.10.0",
74
+ version: "6.0.0",
75
75
  startTime: startTime
76
76
  });
77
77
  };
@@ -167,7 +167,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
167
167
  var expectedVersion = RELEASE_TRAIN;
168
168
 
169
169
  if (isTestKey && version !== expectedVersion) {
170
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("5.10.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
170
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.0.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
171
171
  }
172
172
 
173
173
  var stripe = maybeStripe.apply(undefined, args);
package/dist/pure.mjs CHANGED
@@ -14,14 +14,14 @@ function _typeof(obj) {
14
14
  return _typeof(obj);
15
15
  }
16
16
 
17
- var RELEASE_TRAIN = 'v3';
17
+ var RELEASE_TRAIN = 'acacia';
18
18
 
19
19
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion(version) {
20
20
  return version === 3 ? 'v3' : version;
21
21
  };
22
22
 
23
23
  var ORIGIN = 'https://js.stripe.com';
24
- var STRIPE_JS_URL = "".concat(ORIGIN, "/v3") ;
24
+ var STRIPE_JS_URL = "".concat(ORIGIN, "/").concat(RELEASE_TRAIN, "/stripe.js");
25
25
  var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
26
26
  var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
27
27
  var EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
@@ -67,7 +67,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
67
67
 
68
68
  stripe._registerWrapper({
69
69
  name: 'stripe-js',
70
- version: "5.10.0",
70
+ version: "6.0.0",
71
71
  startTime: startTime
72
72
  });
73
73
  };
@@ -163,7 +163,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
163
163
  var expectedVersion = RELEASE_TRAIN;
164
164
 
165
165
  if (isTestKey && version !== expectedVersion) {
166
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("5.10.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
166
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.0.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
167
167
  }
168
168
 
169
169
  var stripe = maybeStripe.apply(undefined, args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "5.10.0",
3
+ "version": "6.0.0",
4
4
  "description": "Stripe.js loading utility",
5
5
  "repository": "github:stripe/stripe-js",
6
6
  "main": "lib/index.js",
package/src/index.test.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import {SCRIPT_SRC} from './testUtils';
2
- import {RELEASE_TRAIN} from './shared';
3
2
  /* eslint-disable @typescript-eslint/no-var-requires */
4
3
 
5
4
  const dispatchScriptEvent = (eventType: string): void => {
@@ -48,22 +47,6 @@ describe('Stripe module loader', () => {
48
47
  });
49
48
 
50
49
  describe('does not inject a duplicate script when one is already present', () => {
51
- if (RELEASE_TRAIN === 'v3') {
52
- test('when the script does not have a trailing slash', () => {
53
- require('./index');
54
-
55
- const script = document.createElement('script');
56
- script.src = 'https://js.stripe.com/v3';
57
- document.body.appendChild(script);
58
-
59
- return Promise.resolve().then(() => {
60
- expect(
61
- document.querySelectorAll(`script[src="${SCRIPT_SRC}"]`)
62
- ).toHaveLength(1);
63
- });
64
- });
65
- }
66
-
67
50
  test('when the script has a trailing slash', () => {
68
51
  require('./index');
69
52
 
package/src/pure.test.ts CHANGED
@@ -1,10 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-var-requires */
2
2
  import {RELEASE_TRAIN} from './shared';
3
3
 
4
- const SCRIPT_SRC =
5
- RELEASE_TRAIN === 'v3'
6
- ? `https://js.stripe.com/v3`
7
- : `https://js.stripe.com/acacia/stripe.js`;
4
+ const SCRIPT_SRC = `https://js.stripe.com/${RELEASE_TRAIN}/stripe.js`;
8
5
  const SCRIPT_SELECTOR = `script[src^="${SCRIPT_SRC}"]`;
9
6
 
10
7
  describe('pure module', () => {
package/src/shared.ts CHANGED
@@ -12,16 +12,13 @@ export interface LoadParams {
12
12
  // containing the package.json version
13
13
  declare const _VERSION: string;
14
14
 
15
- export const RELEASE_TRAIN = 'v3';
15
+ export const RELEASE_TRAIN = 'acacia';
16
16
 
17
17
  const runtimeVersionToUrlVersion = (version: string | number) =>
18
18
  version === 3 ? 'v3' : version;
19
19
 
20
20
  const ORIGIN = 'https://js.stripe.com';
21
- const STRIPE_JS_URL =
22
- RELEASE_TRAIN === 'v3'
23
- ? `${ORIGIN}/v3`
24
- : `${ORIGIN}/${RELEASE_TRAIN}/stripe.js`;
21
+ const STRIPE_JS_URL = `${ORIGIN}/${RELEASE_TRAIN}/stripe.js`;
25
22
 
26
23
  const V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
27
24
  const STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
package/src/testUtils.ts CHANGED
@@ -1,6 +1,3 @@
1
1
  import {RELEASE_TRAIN} from './shared';
2
2
 
3
- export const SCRIPT_SRC =
4
- RELEASE_TRAIN === 'v3'
5
- ? `https://js.stripe.com/v3`
6
- : `https://js.stripe.com/${RELEASE_TRAIN}/stripe.js`;
3
+ export const SCRIPT_SRC = `https://js.stripe.com/${RELEASE_TRAIN}/stripe.js`;