swell-js 3.19.2 → 3.19.4

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.
Files changed (46) hide show
  1. package/dist/{api-896f20cf.js → api-2a598e04.js} +2 -2
  2. package/dist/api.js +2 -2
  3. package/dist/index.js +2 -2
  4. package/dist/{payment-4030605c.js → payment-83df2674.js} +22 -32
  5. package/dist/payment.js +1 -1
  6. package/dist/swell.cjs.js +19 -32
  7. package/dist/swell.cjs.js.map +1 -1
  8. package/dist/swell.umd.min.js +16 -25
  9. package/dist/swell.umd.min.js.map +1 -1
  10. package/package.json +3 -2
  11. package/types/account/camel.d.ts +12 -0
  12. package/types/account/index.d.ts +8 -0
  13. package/types/account/snake.d.ts +51 -0
  14. package/types/attribute/camel.d.ts +6 -0
  15. package/types/attribute/index.d.ts +4 -0
  16. package/types/attribute/snake.d.ts +37 -0
  17. package/types/card/camel.d.ts +12 -0
  18. package/types/card/index.d.ts +8 -0
  19. package/types/card/snake.d.ts +40 -0
  20. package/types/cart/camel.d.ts +9 -0
  21. package/types/cart/index.d.ts +5 -0
  22. package/types/cart/snake.d.ts +112 -0
  23. package/types/category/camel.d.ts +6 -0
  24. package/types/category/index.d.ts +4 -0
  25. package/types/category/snake.d.ts +24 -0
  26. package/types/content/camel.d.ts +9 -0
  27. package/types/content/index.d.ts +7 -0
  28. package/types/content/snake.d.ts +16 -0
  29. package/types/currency/camel.d.ts +16 -0
  30. package/types/currency/index.d.ts +18 -0
  31. package/types/currency/snake.d.ts +22 -0
  32. package/types/index.d.ts +299 -0
  33. package/types/locale/index.d.ts +5 -0
  34. package/types/order/camel.d.ts +9 -0
  35. package/types/order/index.d.ts +5 -0
  36. package/types/order/snake.d.ts +167 -0
  37. package/types/payment/camel.d.ts +6 -0
  38. package/types/payment/index.d.ts +46 -0
  39. package/types/payment/snake.d.ts +42 -0
  40. package/types/product/camel.d.ts +43 -0
  41. package/types/product/index.d.ts +49 -0
  42. package/types/product/snake.d.ts +170 -0
  43. package/types/settings/index.d.ts +10 -0
  44. package/types/subscription/camel.d.ts +6 -0
  45. package/types/subscription/index.d.ts +4 -0
  46. package/types/subscription/snake.d.ts +123 -0
@@ -9,7 +9,7 @@ import { m as methods$4 } from './attributes-a5d59cae.js';
9
9
  import { m as methods$5 } from './subscriptions-afa9565b.js';
10
10
  import { m as methods$6 } from './content-8feae575.js';
11
11
  import { m as methods$7 } from './settings-3cf85d69.js';
12
- import { m as methods$8 } from './payment-4030605c.js';
12
+ import { m as methods$8 } from './payment-83df2674.js';
13
13
  import { m as methods$9 } from './locale-abdc14e0.js';
14
14
  import { m as methods$a } from './currency-85151e0d.js';
15
15
  import { n as trimEnd, E as utils, l as trimStart, k as trimBoth, j as toSnake, o as stringifyQuery, A as base64Encode, t as toCamel, e as setOptions } from './index-bee7164f.js';
@@ -23,7 +23,7 @@ const options = {
23
23
  };
24
24
 
25
25
  const api = {
26
- version: '3.19.2',
26
+ version: '3.19.4',
27
27
  options,
28
28
  request,
29
29
 
package/dist/api.js CHANGED
@@ -1,4 +1,4 @@
1
- export { a as default } from './api-896f20cf.js';
1
+ export { a as default } from './api-2a598e04.js';
2
2
  import './card-31d20d88.js';
3
3
  import './index-bee7164f.js';
4
4
  import 'qs';
@@ -14,6 +14,6 @@ import './categories-bb6f6179.js';
14
14
  import './subscriptions-afa9565b.js';
15
15
  import './content-8feae575.js';
16
16
  import './settings-3cf85d69.js';
17
- import './payment-4030605c.js';
17
+ import './payment-83df2674.js';
18
18
  import './locale-abdc14e0.js';
19
19
  import './currency-85151e0d.js';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { a as default } from './api-896f20cf.js';
1
+ export { a as default } from './api-2a598e04.js';
2
2
  import './card-31d20d88.js';
3
3
  import './index-bee7164f.js';
4
4
  import 'qs';
@@ -14,6 +14,6 @@ import './categories-bb6f6179.js';
14
14
  import './subscriptions-afa9565b.js';
15
15
  import './content-8feae575.js';
16
16
  import './settings-3cf85d69.js';
17
- import './payment-4030605c.js';
17
+ import './payment-83df2674.js';
18
18
  import './locale-abdc14e0.js';
19
19
  import './currency-85151e0d.js';
@@ -1,6 +1,9 @@
1
- import { F as toString, G as keys, H as isArrayLike, I as baseIteratee, J as isArray, K as isBuffer, L as isTypedArray, M as isArguments, N as getTag, O as isPrototype, P as baseKeys, Q as arrayMap, j as toSnake, g as get, R as toNumber, B as vaultRequest, q as isFunction, C as getLocationParams, D as removeUrlParams } from './index-bee7164f.js';
1
+ import { F as toString, G as keys, H as isArrayLike, I as baseIteratee, J as isArray, K as isBuffer, L as isTypedArray, M as isArguments, N as getTag, O as isPrototype, P as baseKeys, Q as arrayMap, g as get, R as toNumber, j as toSnake, B as vaultRequest, q as isFunction, C as getLocationParams, D as removeUrlParams } from './index-bee7164f.js';
2
2
  import { m as methods$1 } from './cart-5e54de2c.js';
3
3
  import { m as methods$2 } from './settings-3cf85d69.js';
4
+ import 'qs';
5
+ import 'deepmerge';
6
+ import 'fast-case';
4
7
 
5
8
  /**
6
9
  * Converts `string`, as a whole, to lower case just like
@@ -510,37 +513,26 @@ function setBancontactOwner(source, data) {
510
513
  };
511
514
  }
512
515
 
513
- async function createPaymentMethod(stripe, cardElement, authorize, cart) {
516
+ async function createPaymentMethod(stripe, cardElement, cart) {
514
517
  const billingDetails = getBillingDetails(cart);
515
- const { paymentMethod, error: paymentMethodError } =
516
- await stripe.createPaymentMethod({
517
- type: 'card',
518
- card: cardElement,
519
- ...(!isEmpty(billingDetails) ? { billing_details: billingDetails } : {}),
520
- });
521
-
522
- if (paymentMethodError) {
523
- return { error: paymentMethodError };
524
- }
525
-
526
- const customer = cart.account && cart.account.stripe_customer;
527
- const authorization = await authorize({
528
- gateway: 'stripe',
529
- params: {
530
- usage: 'off_session',
531
- payment_method: paymentMethod.id,
532
- ...(customer ? { customer } : {}),
533
- },
518
+ const { paymentMethod, error } = await stripe.createPaymentMethod({
519
+ type: 'card',
520
+ card: cardElement,
521
+ billing_details: billingDetails,
534
522
  });
535
523
 
536
- if (!authorization) {
537
- return;
538
- }
539
-
540
- const { error: setupIntentError } = await stripe.confirmCardSetup(
541
- toSnake(authorization).client_secret,
542
- );
543
- return setupIntentError ? { error: setupIntentError } : authorization.card;
524
+ return error
525
+ ? { error }
526
+ : {
527
+ token: paymentMethod.id,
528
+ last4: paymentMethod.card.last4,
529
+ exp_month: paymentMethod.card.exp_month,
530
+ exp_year: paymentMethod.card.exp_year,
531
+ brand: paymentMethod.card.brand,
532
+ address_check: paymentMethod.card.checks.address_line1_check,
533
+ cvc_check: paymentMethod.card.checks.cvc_check,
534
+ zip_check: paymentMethod.card.checks.address_zip_check,
535
+ };
544
536
  }
545
537
 
546
538
  async function createIDealPaymentMethod(stripe, element, cart) {
@@ -1241,7 +1233,6 @@ async function paymentTokenize(request, params, payMethods, cart) {
1241
1233
  const paymentMethod = await createPaymentMethod(
1242
1234
  stripe,
1243
1235
  CARD_ELEMENTS.stripe,
1244
- methods(request).authorizeGateway,
1245
1236
  cart,
1246
1237
  ).catch(onError);
1247
1238
 
@@ -1278,8 +1269,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
1278
1269
  amount,
1279
1270
  currency,
1280
1271
  capture_method: 'manual',
1281
- off_session: true,
1282
- confirm: true,
1272
+ setup_future_usage: 'off_session',
1283
1273
  ...(stripeCustomer ? { customer: stripeCustomer } : {}),
1284
1274
  },
1285
1275
  })
package/dist/payment.js CHANGED
@@ -1,4 +1,4 @@
1
- export { m as default, s as shouldUsePayPalEmail } from './payment-4030605c.js';
1
+ export { m as default, s as shouldUsePayPalEmail } from './payment-83df2674.js';
2
2
  import './index-bee7164f.js';
3
3
  import 'qs';
4
4
  import 'deepmerge';
package/dist/swell.cjs.js CHANGED
@@ -6248,37 +6248,26 @@ function setBancontactOwner(source, data) {
6248
6248
  };
6249
6249
  }
6250
6250
 
6251
- async function createPaymentMethod(stripe, cardElement, authorize, cart) {
6251
+ async function createPaymentMethod(stripe, cardElement, cart) {
6252
6252
  const billingDetails = getBillingDetails(cart);
6253
- const { paymentMethod, error: paymentMethodError } =
6254
- await stripe.createPaymentMethod({
6255
- type: 'card',
6256
- card: cardElement,
6257
- ...(!isEmpty(billingDetails) ? { billing_details: billingDetails } : {}),
6258
- });
6259
-
6260
- if (paymentMethodError) {
6261
- return { error: paymentMethodError };
6262
- }
6263
-
6264
- const customer = cart.account && cart.account.stripe_customer;
6265
- const authorization = await authorize({
6266
- gateway: 'stripe',
6267
- params: {
6268
- usage: 'off_session',
6269
- payment_method: paymentMethod.id,
6270
- ...(customer ? { customer } : {}),
6271
- },
6253
+ const { paymentMethod, error } = await stripe.createPaymentMethod({
6254
+ type: 'card',
6255
+ card: cardElement,
6256
+ billing_details: billingDetails,
6272
6257
  });
6273
6258
 
6274
- if (!authorization) {
6275
- return;
6276
- }
6277
-
6278
- const { error: setupIntentError } = await stripe.confirmCardSetup(
6279
- toSnake(authorization).client_secret,
6280
- );
6281
- return setupIntentError ? { error: setupIntentError } : authorization.card;
6259
+ return error
6260
+ ? { error }
6261
+ : {
6262
+ token: paymentMethod.id,
6263
+ last4: paymentMethod.card.last4,
6264
+ exp_month: paymentMethod.card.exp_month,
6265
+ exp_year: paymentMethod.card.exp_year,
6266
+ brand: paymentMethod.card.brand,
6267
+ address_check: paymentMethod.card.checks.address_line1_check,
6268
+ cvc_check: paymentMethod.card.checks.cvc_check,
6269
+ zip_check: paymentMethod.card.checks.address_zip_check,
6270
+ };
6282
6271
  }
6283
6272
 
6284
6273
  async function createIDealPaymentMethod(stripe, element, cart) {
@@ -6979,7 +6968,6 @@ async function paymentTokenize(request, params, payMethods, cart) {
6979
6968
  const paymentMethod = await createPaymentMethod(
6980
6969
  stripe,
6981
6970
  CARD_ELEMENTS.stripe,
6982
- methods$2(request).authorizeGateway,
6983
6971
  cart,
6984
6972
  ).catch(onError);
6985
6973
 
@@ -7016,8 +7004,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
7016
7004
  amount,
7017
7005
  currency,
7018
7006
  capture_method: 'manual',
7019
- off_session: true,
7020
- confirm: true,
7007
+ setup_future_usage: 'off_session',
7021
7008
  ...(stripeCustomer ? { customer: stripeCustomer } : {}),
7022
7009
  },
7023
7010
  })
@@ -7655,7 +7642,7 @@ const options = {
7655
7642
  };
7656
7643
 
7657
7644
  const api = {
7658
- version: '3.19.2',
7645
+ version: '3.19.4',
7659
7646
  options,
7660
7647
  request,
7661
7648