swell-js 3.19.6 → 3.19.8

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.
@@ -1,18 +1,29 @@
1
1
  import { c as cardApi } from './card-31d20d88.js';
2
2
  import { g as getCookie, s as setCookie } from './cookie-dff5d694.js';
3
3
  import { c as cacheApi } from './cache-70cd9241.js';
4
- import { m as methods } from './cart-fe0aca95.js';
5
- import { m as methods$1 } from './account-328cc590.js';
6
- import { m as methods$2 } from './products-9a198f48.js';
7
- import { m as methods$3 } from './categories-bb6f6179.js';
8
- import { m as methods$4 } from './attributes-a5d59cae.js';
9
- import { m as methods$5 } from './subscriptions-5d5db711.js';
10
- import { m as methods$6 } from './content-8feae575.js';
11
- import { m as methods$7 } from './settings-3cf85d69.js';
12
- import { m as methods$8 } from './payment-491338ef.js';
13
- import { m as methods$9 } from './locale-abdc14e0.js';
14
- import { m as methods$a } from './currency-85151e0d.js';
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';
4
+ import { m as methods$1 } from './cart-fe0aca95.js';
5
+ import { m as methods$2 } from './account-328cc590.js';
6
+ import { m as methods$3 } from './products-9a198f48.js';
7
+ import { m as methods$4 } from './categories-bb6f6179.js';
8
+ import { m as methods$5 } from './attributes-a5d59cae.js';
9
+ import { m as methods$6 } from './subscriptions-5d5db711.js';
10
+ import { d as defaultMethods, 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';
11
+ import { m as methods$7 } from './content-8feae575.js';
12
+ import { m as methods$8 } from './settings-3cf85d69.js';
13
+ import { m as methods$9 } from './payment-491338ef.js';
14
+ import { m as methods$a } from './locale-abdc14e0.js';
15
+ import { m as methods$b } from './currency-85151e0d.js';
16
+
17
+ function methods(request) {
18
+ const { get, list } = defaultMethods(request, '/invoices', ['list', 'get']);
19
+ return {
20
+ get: (id, ...args) => {
21
+ return cacheApi.getFetch('invoices', id, () => get(id, ...args));
22
+ },
23
+
24
+ list,
25
+ };
26
+ }
16
27
 
17
28
  const options = {
18
29
  store: null,
@@ -23,7 +34,7 @@ const options = {
23
34
  };
24
35
 
25
36
  const api = {
26
- version: '3.19.6',
37
+ version: '3.19.8',
27
38
  options,
28
39
  request,
29
40
 
@@ -71,27 +82,29 @@ const api = {
71
82
 
72
83
  card: cardApi,
73
84
 
74
- cart: methods(request, options),
85
+ cart: methods$1(request, options),
86
+
87
+ account: methods$2(request),
75
88
 
76
- account: methods$1(request),
89
+ products: methods$3(request, options),
77
90
 
78
- products: methods$2(request, options),
91
+ categories: methods$4(request),
79
92
 
80
- categories: methods$3(request),
93
+ attributes: methods$5(request),
81
94
 
82
- attributes: methods$4(request),
95
+ subscriptions: methods$6(request),
83
96
 
84
- subscriptions: methods$5(request),
97
+ invoices: methods(request),
85
98
 
86
- content: methods$6(request, options),
99
+ content: methods$7(request, options),
87
100
 
88
- settings: methods$7(request, options),
101
+ settings: methods$8(request, options),
89
102
 
90
- payment: methods$8(request, options),
103
+ payment: methods$9(request, options),
91
104
 
92
- locale: methods$9(request, options),
105
+ locale: methods$a(request, options),
93
106
 
94
- currency: methods$a(request, options),
107
+ currency: methods$b(request, options),
95
108
 
96
109
  utils,
97
110
  };
package/dist/api.js CHANGED
@@ -1,4 +1,4 @@
1
- export { a as default } from './api-8d3f4a5e.js';
1
+ export { a as default } from './api-bb7a91b7.js';
2
2
  import './card-31d20d88.js';
3
3
  import './index-bee7164f.js';
4
4
  import 'qs';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { a as default } from './api-8d3f4a5e.js';
1
+ export { a as default } from './api-bb7a91b7.js';
2
2
  import './card-31d20d88.js';
3
3
  import './index-bee7164f.js';
4
4
  import 'qs';
package/dist/swell.cjs.js CHANGED
@@ -4689,7 +4689,7 @@ const cacheApi = {
4689
4689
  },
4690
4690
  };
4691
4691
 
4692
- function methods$a(request) {
4692
+ function methods$b(request) {
4693
4693
  const { get, list } = defaultMethods(request, '/attributes', ['list', 'get']);
4694
4694
 
4695
4695
  return {
@@ -4703,7 +4703,7 @@ function methods$a(request) {
4703
4703
 
4704
4704
  let OPTIONS;
4705
4705
 
4706
- function methods$9(request, opt) {
4706
+ function methods$a(request, opt) {
4707
4707
  OPTIONS = opt;
4708
4708
  const { get, list } = defaultMethods(request, '/products', ['list', 'get']);
4709
4709
  return {
@@ -4912,7 +4912,7 @@ function findPurchaseOption(product, purchaseOption) {
4912
4912
  }
4913
4913
 
4914
4914
  async function getFilterableAttributeFilters(request, products, options) {
4915
- const { results: filterableAttributes } = await methods$a(
4915
+ const { results: filterableAttributes } = await methods$b(
4916
4916
  request).list({
4917
4917
  filterable: true,
4918
4918
  });
@@ -5097,7 +5097,7 @@ function getPriceRange(products) {
5097
5097
  };
5098
5098
  }
5099
5099
 
5100
- function methods$8(request, options) {
5100
+ function methods$9(request, options) {
5101
5101
  return {
5102
5102
  state: null,
5103
5103
  order: null,
@@ -5259,7 +5259,7 @@ function methods$8(request, options) {
5259
5259
  };
5260
5260
  }
5261
5261
 
5262
- function methods$7(request) {
5262
+ function methods$8(request) {
5263
5263
  return {
5264
5264
  state: null,
5265
5265
 
@@ -5358,7 +5358,7 @@ function methods$7(request) {
5358
5358
  };
5359
5359
  }
5360
5360
 
5361
- function methods$6(request) {
5361
+ function methods$7(request) {
5362
5362
  const { get, list } = defaultMethods(request, '/categories', ['list', 'get']);
5363
5363
 
5364
5364
  return {
@@ -5370,7 +5370,7 @@ function methods$6(request) {
5370
5370
  };
5371
5371
  }
5372
5372
 
5373
- function methods$5(request) {
5373
+ function methods$6(request) {
5374
5374
  const { get, list } = defaultMethods(request, '/subscriptions', [
5375
5375
  'list',
5376
5376
  'get',
@@ -5434,6 +5434,17 @@ function methods$5(request) {
5434
5434
  };
5435
5435
  }
5436
5436
 
5437
+ function methods$5(request) {
5438
+ const { get, list } = defaultMethods(request, '/invoices', ['list', 'get']);
5439
+ return {
5440
+ get: (id, ...args) => {
5441
+ return cacheApi.getFetch('invoices', id, () => get(id, ...args));
5442
+ },
5443
+
5444
+ list,
5445
+ };
5446
+ }
5447
+
5437
5448
  function methods$4(request, opt) {
5438
5449
  return {
5439
5450
  get: (type, id, query) => {
@@ -6528,7 +6539,7 @@ function methods$2(request, opts) {
6528
6539
 
6529
6540
  async createElements(elementParams) {
6530
6541
  this.params = elementParams || {};
6531
- const cart = toSnake(await methods$8(request, options$1).get());
6542
+ const cart = toSnake(await methods$9(request, options$1).get());
6532
6543
  if (!cart) {
6533
6544
  throw new Error('Cart not found');
6534
6545
  }
@@ -6542,7 +6553,7 @@ function methods$2(request, opts) {
6542
6553
  },
6543
6554
 
6544
6555
  async tokenize(params) {
6545
- const cart = toSnake(await methods$8(request, options$1).get());
6556
+ const cart = toSnake(await methods$9(request, options$1).get());
6546
6557
  if (!cart) {
6547
6558
  throw new Error('Cart not found');
6548
6559
  }
@@ -6561,7 +6572,7 @@ function methods$2(request, opts) {
6561
6572
  },
6562
6573
 
6563
6574
  async handleRedirect(params) {
6564
- const cart = toSnake(await methods$8(request, options$1).get());
6575
+ const cart = toSnake(await methods$9(request, options$1).get());
6565
6576
  if (!cart) {
6566
6577
  throw new Error('Cart not found');
6567
6578
  }
@@ -6776,7 +6787,7 @@ async function shouldUsePayPalEmail(guest, request, options) {
6776
6787
  if (!guest) return false;
6777
6788
 
6778
6789
  // Refetch to avoid stale data from the cart
6779
- const updatedCart = await methods$8(request, options).get();
6790
+ const updatedCart = await methods$9(request, options).get();
6780
6791
  const currentEmail = get(updatedCart, 'account.email');
6781
6792
 
6782
6793
  // If no email is present, use paypal's email
@@ -6848,7 +6859,7 @@ async function payPalButton(request, cart, payMethods, params) {
6848
6859
  options$1,
6849
6860
  );
6850
6861
 
6851
- return methods$8(request).update({
6862
+ return methods$9(request).update({
6852
6863
  ...(usePayPalEmail && {
6853
6864
  account: {
6854
6865
  email: payer.email_address,
@@ -6909,7 +6920,7 @@ async function braintreePayPalButton(request, cart, payMethods, params) {
6909
6920
  paypalCheckoutInstance
6910
6921
  .tokenizePayment(data)
6911
6922
  .then(({ nonce }) =>
6912
- methods$8(request, options$1).update({
6923
+ methods$9(request, options$1).update({
6913
6924
  billing: { paypal: { nonce } },
6914
6925
  }),
6915
6926
  )
@@ -6984,7 +6995,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
6984
6995
  } else if (capture_total < 1) {
6985
6996
  // should save payment method data when payment amount is less than 1
6986
6997
  // https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts
6987
- return methods$8(request, options$1)
6998
+ return methods$9(request, options$1)
6988
6999
  .update({
6989
7000
  billing: {
6990
7001
  method: 'card',
@@ -7032,7 +7043,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
7032
7043
  }
7033
7044
 
7034
7045
  // Capture the payment
7035
- return await methods$8(request, options$1)
7046
+ return await methods$9(request, options$1)
7036
7047
  .update({
7037
7048
  billing: {
7038
7049
  method: 'card',
@@ -7061,7 +7072,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
7061
7072
  return onError(intent.error);
7062
7073
  }
7063
7074
 
7064
- await methods$8(request, options$1).update({
7075
+ await methods$9(request, options$1).update({
7065
7076
  billing: {
7066
7077
  method: 'card',
7067
7078
  intent: {
@@ -7111,7 +7122,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
7111
7122
  );
7112
7123
 
7113
7124
  if (intent) {
7114
- await methods$8(request, options$1)
7125
+ await methods$9(request, options$1)
7115
7126
  .update({
7116
7127
  billing: {
7117
7128
  method: 'ideal',
@@ -7152,7 +7163,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
7152
7163
 
7153
7164
  return error
7154
7165
  ? onError(error)
7155
- : methods$8(request, options$1)
7166
+ : methods$9(request, options$1)
7156
7167
  .update({
7157
7168
  billing: {
7158
7169
  method: 'klarna',
@@ -7173,7 +7184,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
7173
7184
 
7174
7185
  return error
7175
7186
  ? onError(error)
7176
- : methods$8(request, options$1)
7187
+ : methods$9(request, options$1)
7177
7188
  .update({
7178
7189
  billing: {
7179
7190
  method: 'bancontact',
@@ -7191,7 +7202,7 @@ async function paymentTokenize(request, params, payMethods, cart) {
7191
7202
  return;
7192
7203
  }
7193
7204
 
7194
- await methods$8(request, options$1).update({
7205
+ await methods$9(request, options$1).update({
7195
7206
  billing: {
7196
7207
  method: 'paysafecard',
7197
7208
  intent: {
@@ -7279,7 +7290,7 @@ async function handleQuickpayRedirectAction(
7279
7290
  } else if (card.error) {
7280
7291
  return card;
7281
7292
  } else {
7282
- await methods$8(request, options$1).update({
7293
+ await methods$9(request, options$1).update({
7283
7294
  billing: {
7284
7295
  method: 'card',
7285
7296
  card,
@@ -7351,7 +7362,7 @@ async function handleDirectKlarnaRedirectAction(
7351
7362
  };
7352
7363
  }
7353
7364
 
7354
- await methods$8(request, options$1).update({
7365
+ await methods$9(request, options$1).update({
7355
7366
  billing: {
7356
7367
  method: 'klarna',
7357
7368
  klarna: {
@@ -7648,7 +7659,7 @@ const options = {
7648
7659
  };
7649
7660
 
7650
7661
  const api = {
7651
- version: '3.19.6',
7662
+ version: '3.19.8',
7652
7663
  options,
7653
7664
  request,
7654
7665
 
@@ -7696,17 +7707,19 @@ const api = {
7696
7707
 
7697
7708
  card: cardApi,
7698
7709
 
7699
- cart: methods$8(request, options),
7710
+ cart: methods$9(request, options),
7711
+
7712
+ account: methods$8(request),
7700
7713
 
7701
- account: methods$7(request),
7714
+ products: methods$a(request, options),
7702
7715
 
7703
- products: methods$9(request, options),
7716
+ categories: methods$7(request),
7704
7717
 
7705
- categories: methods$6(request),
7718
+ attributes: methods$b(request),
7706
7719
 
7707
- attributes: methods$a(request),
7720
+ subscriptions: methods$6(request),
7708
7721
 
7709
- subscriptions: methods$5(request),
7722
+ invoices: methods$5(request),
7710
7723
 
7711
7724
  content: methods$4(request, options),
7712
7725