swell-js 3.17.1 → 3.17.2

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.
@@ -2,15 +2,15 @@ import { c as cardApi } from './card-2f5f9866.js';
2
2
  import { g as getCookie, s as setCookie } from './cookie-a39e556c.js';
3
3
  import { f as trimEnd, e as trimStart, c as trimBoth, b as toSnake, h as stringifyQuery, n as base64Encode, t as toCamel, s as setOptions } from './index-bce8d606.js';
4
4
  import { c as cacheApi } from './cache-54abc38e.js';
5
- import { m as methods } from './cart-bdec9379.js';
5
+ import { m as methods } from './cart-21650912.js';
6
6
  import { m as methods$1 } from './account-328cc590.js';
7
- import { m as methods$2 } from './products-a6a43be8.js';
7
+ import { m as methods$2 } from './products-baf505e7.js';
8
8
  import { m as methods$3 } from './categories-e52bebe3.js';
9
9
  import { m as methods$4 } from './attributes-db35134e.js';
10
- import { m as methods$5 } from './subscriptions-eecdd4ff.js';
10
+ import { m as methods$5 } from './subscriptions-0e44e99f.js';
11
11
  import { m as methods$6 } from './content-eb42ecce.js';
12
12
  import { m as methods$7 } from './settings-b1a4a4af.js';
13
- import { m as methods$8 } from './payment-91a15202.js';
13
+ import { m as methods$8 } from './payment-4fd3868e.js';
14
14
  import { m as methods$9 } from './locale-9de8dba1.js';
15
15
  import { m as methods$a } from './currency-209bb202.js';
16
16
 
package/dist/api.js CHANGED
@@ -1,4 +1,4 @@
1
- export { a as default } from './api-4f78f947.js';
1
+ export { a as default } from './api-31197cfd.js';
2
2
  import './card-2f5f9866.js';
3
3
  import './index-bce8d606.js';
4
4
  import 'qs';
@@ -16,15 +16,15 @@ import 'deepmerge';
16
16
  import 'object-keys-normalizer';
17
17
  import './cookie-a39e556c.js';
18
18
  import './cache-54abc38e.js';
19
- import './cart-bdec9379.js';
20
- import './products-a6a43be8.js';
19
+ import './cart-21650912.js';
20
+ import './products-baf505e7.js';
21
21
  import './attributes-db35134e.js';
22
22
  import './account-328cc590.js';
23
23
  import './categories-e52bebe3.js';
24
- import './subscriptions-eecdd4ff.js';
24
+ import './subscriptions-0e44e99f.js';
25
25
  import './content-eb42ecce.js';
26
26
  import './settings-b1a4a4af.js';
27
- import './payment-91a15202.js';
27
+ import './payment-4fd3868e.js';
28
28
  import 'lodash/toLower';
29
29
  import 'lodash/reduce';
30
30
  import 'lodash/isEmpty';
@@ -11,7 +11,7 @@ import cloneDeep from 'lodash/cloneDeep';
11
11
  import 'lodash/isEqual';
12
12
  import 'deepmerge';
13
13
  import 'object-keys-normalizer';
14
- import { c as cleanProductOptions } from './products-a6a43be8.js';
14
+ import { c as cleanProductOptions } from './products-baf505e7.js';
15
15
 
16
16
  function methods(request, options) {
17
17
  return {
package/dist/cart.js CHANGED
@@ -1,4 +1,4 @@
1
- export { m as default } from './cart-bdec9379.js';
1
+ export { m as default } from './cart-21650912.js';
2
2
  import 'qs';
3
3
  import 'lodash/set';
4
4
  import 'lodash/get';
@@ -12,7 +12,7 @@ import 'lodash/cloneDeep';
12
12
  import 'lodash/isEqual';
13
13
  import 'deepmerge';
14
14
  import 'object-keys-normalizer';
15
- import './products-a6a43be8.js';
15
+ import './products-baf505e7.js';
16
16
  import './index-bce8d606.js';
17
17
  import './cache-54abc38e.js';
18
18
  import './attributes-db35134e.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { q as utils } from './index-bce8d606.js';
2
- export { a as default } from './api-4f78f947.js';
2
+ export { a as default } from './api-31197cfd.js';
3
3
  import 'qs';
4
4
  import 'lodash/set';
5
5
  import 'lodash/get';
@@ -16,15 +16,15 @@ import 'object-keys-normalizer';
16
16
  import './card-2f5f9866.js';
17
17
  import './cookie-a39e556c.js';
18
18
  import './cache-54abc38e.js';
19
- import './cart-bdec9379.js';
20
- import './products-a6a43be8.js';
19
+ import './cart-21650912.js';
20
+ import './products-baf505e7.js';
21
21
  import './attributes-db35134e.js';
22
22
  import './account-328cc590.js';
23
23
  import './categories-e52bebe3.js';
24
- import './subscriptions-eecdd4ff.js';
24
+ import './subscriptions-0e44e99f.js';
25
25
  import './content-eb42ecce.js';
26
26
  import './settings-b1a4a4af.js';
27
- import './payment-91a15202.js';
27
+ import './payment-4fd3868e.js';
28
28
  import 'lodash/toLower';
29
29
  import 'lodash/reduce';
30
30
  import 'lodash/isEmpty';
@@ -1,6 +1,6 @@
1
1
  import get from 'lodash/get';
2
2
  import toLower from 'lodash/toLower';
3
- import { m as methods$1 } from './cart-bdec9379.js';
3
+ import { m as methods$1 } from './cart-21650912.js';
4
4
  import { m as methods$2 } from './settings-b1a4a4af.js';
5
5
  import { b as toSnake, v as vaultRequest, j as isFunction, o as getLocationParams, p as removeUrlParams } from './index-bce8d606.js';
6
6
  import reduce from 'lodash/reduce';
@@ -465,12 +465,12 @@ function methods(request, opts) {
465
465
 
466
466
  async createElements(elementParams) {
467
467
  this.params = elementParams || {};
468
- const cart = toSnake(await methods$1.methods(request, options).get());
468
+ const cart = toSnake(await methods$1(request, options).get());
469
469
  if (!cart) {
470
470
  throw new Error('Cart not found');
471
471
  }
472
472
  const payMethods = toSnake(
473
- await methods$2.methods(request, options).payments(),
473
+ await methods$2(request, options).payments(),
474
474
  );
475
475
  if (payMethods.error) {
476
476
  throw new Error(payMethods.error);
@@ -479,12 +479,12 @@ function methods(request, opts) {
479
479
  },
480
480
 
481
481
  async tokenize(params) {
482
- const cart = toSnake(await methods$1.methods(request, options).get());
482
+ const cart = toSnake(await methods$1(request, options).get());
483
483
  if (!cart) {
484
484
  throw new Error('Cart not found');
485
485
  }
486
486
  const payMethods = toSnake(
487
- await methods$2.methods(request, options).payments(),
487
+ await methods$2(request, options).payments(),
488
488
  );
489
489
  if (payMethods.error) {
490
490
  throw new Error(payMethods.error);
@@ -498,7 +498,7 @@ function methods(request, opts) {
498
498
  },
499
499
 
500
500
  async handleRedirect(params) {
501
- const cart = toSnake(await methods$1.methods(request, options).get());
501
+ const cart = toSnake(await methods$1(request, options).get());
502
502
  if (!cart) {
503
503
  throw new Error('Cart not found');
504
504
  }
@@ -511,7 +511,7 @@ function methods(request, opts) {
511
511
  throw new Error('Payment not found');
512
512
  }
513
513
  const payMethods = toSnake(
514
- await methods$2.methods(request, options).payments(),
514
+ await methods$2(request, options).payments(),
515
515
  );
516
516
  if (payMethods.error) {
517
517
  throw new Error(payMethods.error);
@@ -716,7 +716,9 @@ async function payPalButton(request, cart, payMethods, params) {
716
716
  };
717
717
 
718
718
  if (!(capture_total > 0)) {
719
- throw new Error('Invalid PayPal button amount. Value should be greater than zero.');
719
+ throw new Error(
720
+ 'Invalid PayPal button amount. Value should be greater than zero.',
721
+ );
720
722
  }
721
723
 
722
724
  paypal
@@ -751,7 +753,7 @@ async function payPalButton(request, cart, payMethods, params) {
751
753
  const payer = order.payer;
752
754
  const shipping = get(order, 'purchase_units[0].shipping');
753
755
 
754
- return methods$1.methods(request).update({
756
+ return methods$1(request).update({
755
757
  ...(!account_logged_in && {
756
758
  account: {
757
759
  email: payer.email_address,
@@ -812,9 +814,9 @@ async function braintreePayPalButton(request, cart, payMethods, params) {
812
814
  paypalCheckoutInstance
813
815
  .tokenizePayment(data)
814
816
  .then(({ nonce }) =>
815
- methods$1
816
- .methods(request, options)
817
- .update({ billing: { paypal: { nonce } } }),
817
+ methods$1(request, options).update({
818
+ billing: { paypal: { nonce } },
819
+ }),
818
820
  )
819
821
  .then(
820
822
  () =>
@@ -885,8 +887,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
885
887
  } else if (capture_total < 1) {
886
888
  // should save payment method data when payment amount is less than 1
887
889
  // https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts
888
- return methods$1
889
- .methods(request, options)
890
+ return methods$1(request, options)
890
891
  .update({
891
892
  billing: {
892
893
  method: 'card',
@@ -898,7 +899,10 @@ async function paymentTokenize(request, params, payMethods, cart) {
898
899
  }
899
900
 
900
901
  const currency = toLower(get(cart, 'currency', 'usd'));
901
- const amount = stripeAmountByCurrency(currency, capture_total + auth_total);
902
+ const amount = stripeAmountByCurrency(
903
+ currency,
904
+ capture_total + auth_total,
905
+ );
902
906
  const stripeCustomer = get(cart, 'account.stripe_customer');
903
907
  const intent = toSnake(
904
908
  await methods(request)
@@ -922,8 +926,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
922
926
  );
923
927
  return error
924
928
  ? onError(error)
925
- : await methods$1
926
- .methods(request, options)
929
+ : await methods$1(request, options)
927
930
  .update({
928
931
  billing: {
929
932
  method: 'card',
@@ -952,7 +955,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
952
955
  return onError(intent.error);
953
956
  }
954
957
 
955
- await methods$1.methods(request, options).update({
958
+ await methods$1(request, options).update({
956
959
  billing: {
957
960
  method: 'card',
958
961
  intent: {
@@ -1002,8 +1005,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
1002
1005
  );
1003
1006
 
1004
1007
  if (intent) {
1005
- await methods$1
1006
- .methods(request, options)
1008
+ await methods$1(request, options)
1007
1009
  .update({
1008
1010
  billing: {
1009
1011
  method: 'ideal',
@@ -1035,9 +1037,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
1035
1037
  }
1036
1038
  const { publishable_key } = payMethods.card;
1037
1039
  const stripe = window.Stripe(publishable_key);
1038
- const settings = toSnake(
1039
- await methods$2.methods(request, options).get(),
1040
- );
1040
+ const settings = toSnake(await methods$2(request, options).get());
1041
1041
 
1042
1042
  const { error, source } = await createKlarnaSource(stripe, {
1043
1043
  ...cart,
@@ -1046,8 +1046,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
1046
1046
 
1047
1047
  return error
1048
1048
  ? onError(error)
1049
- : methods$1
1050
- .methods(request, options)
1049
+ : methods$1(request, options)
1051
1050
  .update({
1052
1051
  billing: {
1053
1052
  method: 'klarna',
@@ -1068,8 +1067,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
1068
1067
 
1069
1068
  return error
1070
1069
  ? onError(error)
1071
- : methods$1
1072
- .methods(request, options)
1070
+ : methods$1(request, options)
1073
1071
  .update({
1074
1072
  billing: {
1075
1073
  method: 'bancontact',
@@ -1087,7 +1085,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
1087
1085
  return;
1088
1086
  }
1089
1087
 
1090
- await methods$1.methods(request, options).update({
1088
+ await methods$1(request, options).update({
1091
1089
  billing: {
1092
1090
  method: 'paysafecard',
1093
1091
  intent: {
@@ -1175,7 +1173,7 @@ async function handleQuickpayRedirectAction(
1175
1173
  } else if (card.error) {
1176
1174
  return card;
1177
1175
  } else {
1178
- await methods$1.methods(request, options).update({
1176
+ await methods$1(request, options).update({
1179
1177
  billing: {
1180
1178
  method: 'card',
1181
1179
  card,
@@ -1247,7 +1245,7 @@ async function handleDirectKlarnaRedirectAction(
1247
1245
  };
1248
1246
  }
1249
1247
 
1250
- await methods$1.methods(request, options).update({
1248
+ await methods$1(request, options).update({
1251
1249
  billing: {
1252
1250
  method: 'klarna',
1253
1251
  klarna: {
package/dist/payment.js CHANGED
@@ -1,7 +1,7 @@
1
- export { m as default } from './payment-91a15202.js';
1
+ export { m as default } from './payment-4fd3868e.js';
2
2
  import 'lodash/get';
3
3
  import 'lodash/toLower';
4
- import './cart-bdec9379.js';
4
+ import './cart-21650912.js';
5
5
  import 'qs';
6
6
  import 'lodash/set';
7
7
  import 'lodash/uniq';
@@ -14,7 +14,7 @@ import 'lodash/cloneDeep';
14
14
  import 'lodash/isEqual';
15
15
  import 'deepmerge';
16
16
  import 'object-keys-normalizer';
17
- import './products-a6a43be8.js';
17
+ import './products-baf505e7.js';
18
18
  import './index-bce8d606.js';
19
19
  import './cache-54abc38e.js';
20
20
  import './attributes-db35134e.js';
@@ -235,11 +235,10 @@ function findPurchaseOption(product, purchaseOption) {
235
235
  }
236
236
 
237
237
  async function getFilterableAttributeFilters(request, products, options) {
238
- const { results: filterableAttributes } = await methods$1
239
- .methods(request, OPTIONS)
240
- .list({
241
- filterable: true,
242
- });
238
+ const { results: filterableAttributes } = await methods$1(
239
+ request).list({
240
+ filterable: true,
241
+ });
243
242
 
244
243
  return getFilters(products, { ...options, filterableAttributes });
245
244
  }
package/dist/products.js CHANGED
@@ -1,4 +1,4 @@
1
- export { b as calculateVariation, c as cleanProductOptions, m as default, f as findVariantWithOptions, g as getProductOptionIndex, a as getVariantOptionValueIds } from './products-a6a43be8.js';
1
+ export { b as calculateVariation, c as cleanProductOptions, m as default, f as findVariantWithOptions, g as getProductOptionIndex, a as getVariantOptionValueIds } from './products-baf505e7.js';
2
2
  import './index-bce8d606.js';
3
3
  import 'qs';
4
4
  import 'lodash/set';
@@ -1,4 +1,4 @@
1
- import { c as cleanProductOptions } from './products-a6a43be8.js';
1
+ import { c as cleanProductOptions } from './products-baf505e7.js';
2
2
  import { d as defaultMethods } from './index-bce8d606.js';
3
3
  import { c as cacheApi } from './cache-54abc38e.js';
4
4
 
@@ -1,5 +1,5 @@
1
- export { m as default } from './subscriptions-eecdd4ff.js';
2
- import './products-a6a43be8.js';
1
+ export { m as default } from './subscriptions-0e44e99f.js';
2
+ import './products-baf505e7.js';
3
3
  import './index-bce8d606.js';
4
4
  import 'qs';
5
5
  import 'lodash/set';