@stripe/stripe-js 8.6.1 → 8.6.3

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/dist/index.js CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ function _typeof(obj) {
6
+ "@babel/helpers - typeof";
7
+
8
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
9
+ _typeof = function (obj) {
10
+ return typeof obj;
11
+ };
12
+ } else {
13
+ _typeof = function (obj) {
14
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15
+ };
16
+ }
17
+
18
+ return _typeof(obj);
19
+ }
20
+
5
21
  var RELEASE_TRAIN = 'clover';
6
22
 
7
23
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion(version) {
@@ -55,7 +71,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
55
71
 
56
72
  stripe._registerWrapper({
57
73
  name: 'stripe-js',
58
- version: "8.6.1",
74
+ version: "8.6.3",
59
75
  startTime: startTime
60
76
  });
61
77
  };
@@ -145,13 +161,18 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
145
161
  }
146
162
 
147
163
  var pk = args[0];
164
+
165
+ if (typeof pk !== 'string') {
166
+ throw new Error("Expected publishable key to be of type string, got type ".concat(_typeof(pk), " instead."));
167
+ }
168
+
148
169
  var isTestKey = pk.match(/^pk_test/); // @ts-expect-error this is not publicly typed
149
170
 
150
171
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
151
172
  var expectedVersion = RELEASE_TRAIN;
152
173
 
153
174
  if (isTestKey && version !== expectedVersion) {
154
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.1", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
175
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.3", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
155
176
  }
156
177
 
157
178
  var stripe = maybeStripe.apply(undefined, args);
package/dist/index.mjs CHANGED
@@ -1,3 +1,19 @@
1
+ function _typeof(obj) {
2
+ "@babel/helpers - typeof";
3
+
4
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
5
+ _typeof = function (obj) {
6
+ return typeof obj;
7
+ };
8
+ } else {
9
+ _typeof = function (obj) {
10
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
11
+ };
12
+ }
13
+
14
+ return _typeof(obj);
15
+ }
16
+
1
17
  var RELEASE_TRAIN = 'clover';
2
18
 
3
19
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion(version) {
@@ -51,7 +67,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
51
67
 
52
68
  stripe._registerWrapper({
53
69
  name: 'stripe-js',
54
- version: "8.6.1",
70
+ version: "8.6.3",
55
71
  startTime: startTime
56
72
  });
57
73
  };
@@ -141,13 +157,18 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
141
157
  }
142
158
 
143
159
  var pk = args[0];
160
+
161
+ if (typeof pk !== 'string') {
162
+ throw new Error("Expected publishable key to be of type string, got type ".concat(_typeof(pk), " instead."));
163
+ }
164
+
144
165
  var isTestKey = pk.match(/^pk_test/); // @ts-expect-error this is not publicly typed
145
166
 
146
167
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
147
168
  var expectedVersion = RELEASE_TRAIN;
148
169
 
149
170
  if (isTestKey && version !== expectedVersion) {
150
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.1", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
171
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.3", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
151
172
  }
152
173
 
153
174
  var stripe = maybeStripe.apply(undefined, args);
package/dist/pure.js CHANGED
@@ -71,7 +71,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
71
71
 
72
72
  stripe._registerWrapper({
73
73
  name: 'stripe-js',
74
- version: "8.6.1",
74
+ version: "8.6.3",
75
75
  startTime: startTime
76
76
  });
77
77
  };
@@ -161,13 +161,18 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
161
161
  }
162
162
 
163
163
  var pk = args[0];
164
+
165
+ if (typeof pk !== 'string') {
166
+ throw new Error("Expected publishable key to be of type string, got type ".concat(_typeof(pk), " instead."));
167
+ }
168
+
164
169
  var isTestKey = pk.match(/^pk_test/); // @ts-expect-error this is not publicly typed
165
170
 
166
171
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
167
172
  var expectedVersion = RELEASE_TRAIN;
168
173
 
169
174
  if (isTestKey && version !== expectedVersion) {
170
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.1", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
175
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.3", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
171
176
  }
172
177
 
173
178
  var stripe = maybeStripe.apply(undefined, args);
package/dist/pure.mjs CHANGED
@@ -67,7 +67,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
67
67
 
68
68
  stripe._registerWrapper({
69
69
  name: 'stripe-js',
70
- version: "8.6.1",
70
+ version: "8.6.3",
71
71
  startTime: startTime
72
72
  });
73
73
  };
@@ -157,13 +157,18 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
157
157
  }
158
158
 
159
159
  var pk = args[0];
160
+
161
+ if (typeof pk !== 'string') {
162
+ throw new Error("Expected publishable key to be of type string, got type ".concat(_typeof(pk), " instead."));
163
+ }
164
+
160
165
  var isTestKey = pk.match(/^pk_test/); // @ts-expect-error this is not publicly typed
161
166
 
162
167
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
163
168
  var expectedVersion = RELEASE_TRAIN;
164
169
 
165
170
  if (isTestKey && version !== expectedVersion) {
166
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.1", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
171
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.3", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
167
172
  }
168
173
 
169
174
  var stripe = maybeStripe.apply(undefined, args);
@@ -715,6 +715,13 @@ interface BaseStripeElementsOptions {
715
715
  * @docs https://docs.stripe.com/js/elements_object/create#stripe_elements-options-syncAddressCheckbox
716
716
  */
717
717
  syncAddressCheckbox?: 'billing' | 'shipping' | 'none';
718
+
719
+ /**
720
+ * Allows PaymentMethods to be created from the Elements instance.
721
+ *
722
+ * @docs https://docs.stripe.com/js/elements_object/create#stripe_elements-options-paymentMethodCreation
723
+ */
724
+ paymentMethodCreation?: 'manual';
718
725
  }
719
726
 
720
727
  export interface StripeElementsOptionsClientSecret
@@ -827,11 +834,6 @@ interface StripeElementsOptionsModeBase extends BaseStripeElementsOptions {
827
834
  */
828
835
  payment_method_configuration?: string;
829
836
 
830
- /**
831
- * Allows PaymentMethods to be created from the Elements instance.
832
- */
833
- paymentMethodCreation?: 'manual';
834
-
835
837
  /**
836
838
  * Additional payment-method-specific options for configuring Payment Element behavior.
837
839
  *
@@ -715,6 +715,13 @@ interface BaseStripeElementsOptions {
715
715
  * @docs https://docs.stripe.com/js/elements_object/create#stripe_elements-options-syncAddressCheckbox
716
716
  */
717
717
  syncAddressCheckbox?: 'billing' | 'shipping' | 'none';
718
+
719
+ /**
720
+ * Allows PaymentMethods to be created from the Elements instance.
721
+ *
722
+ * @docs https://docs.stripe.com/js/elements_object/create#stripe_elements-options-paymentMethodCreation
723
+ */
724
+ paymentMethodCreation?: 'manual';
718
725
  }
719
726
 
720
727
  export interface StripeElementsOptionsClientSecret
@@ -827,11 +834,6 @@ interface StripeElementsOptionsModeBase extends BaseStripeElementsOptions {
827
834
  */
828
835
  payment_method_configuration?: string;
829
836
 
830
- /**
831
- * Allows PaymentMethods to be created from the Elements instance.
832
- */
833
- paymentMethodCreation?: 'manual';
834
-
835
837
  /**
836
838
  * Additional payment-method-specific options for configuring Payment Element behavior.
837
839
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "8.6.1",
3
+ "version": "8.6.3",
4
4
  "description": "Stripe.js loading utility",
5
5
  "repository": "github:stripe/stripe-js",
6
6
  "main": "lib/index.js",
package/src/shared.ts CHANGED
@@ -169,6 +169,13 @@ export const initStripe = (
169
169
  }
170
170
 
171
171
  const pk = args[0];
172
+
173
+ if (typeof pk !== 'string') {
174
+ throw new Error(
175
+ `Expected publishable key to be of type string, got type ${typeof pk} instead.`
176
+ );
177
+ }
178
+
172
179
  const isTestKey = pk.match(/^pk_test/);
173
180
 
174
181
  // @ts-expect-error this is not publicly typed