swell-js 4.0.7 → 4.0.9

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 (75) hide show
  1. package/dist/account.mjs +14 -2
  2. package/dist/api.mjs +2 -2
  3. package/dist/attributes.mjs +1 -1
  4. package/dist/cache.mjs +2 -2
  5. package/dist/card.mjs +2 -2
  6. package/dist/cart.mjs +4 -4
  7. package/dist/categories.mjs +1 -1
  8. package/dist/content.mjs +1 -1
  9. package/dist/cookie.mjs +1 -1
  10. package/dist/{index.6938673d.mjs → index.95daac5a.mjs} +3 -1
  11. package/dist/index.mjs +1 -1
  12. package/dist/payment.mjs +135 -41
  13. package/dist/products.mjs +1 -1
  14. package/dist/settings.mjs +3 -3
  15. package/dist/subscriptions.mjs +1 -1
  16. package/dist/swell.cjs +165 -57
  17. package/dist/swell.cjs.map +1 -1
  18. package/dist/swell.umd.min.js +203 -136
  19. package/dist/swell.umd.min.js.map +1 -1
  20. package/dist/utils/index.mjs +1 -1
  21. package/package.json +10 -2
  22. package/types/account/camel.d.ts +6 -10
  23. package/types/account/index.d.ts +4 -3
  24. package/types/account/snake.d.ts +12 -9
  25. package/types/attribute/camel.d.ts +2 -4
  26. package/types/attribute/snake.d.ts +3 -2
  27. package/types/billing/camel.d.ts +14 -25
  28. package/types/billing/index.d.ts +5 -0
  29. package/types/billing/snake.d.ts +30 -21
  30. package/types/card/camel.d.ts +7 -10
  31. package/types/card/index.d.ts +4 -3
  32. package/types/card/snake.d.ts +6 -4
  33. package/types/cart/camel.d.ts +24 -16
  34. package/types/cart/index.d.ts +23 -1
  35. package/types/cart/snake.d.ts +57 -22
  36. package/types/category/camel.d.ts +2 -4
  37. package/types/category/snake.d.ts +10 -7
  38. package/types/content/camel.d.ts +3 -7
  39. package/types/content/index.d.ts +1 -0
  40. package/types/content/snake.d.ts +6 -3
  41. package/types/coupon/camel.d.ts +2 -4
  42. package/types/coupon/snake.d.ts +9 -11
  43. package/types/currency/camel.d.ts +9 -10
  44. package/types/currency/index.d.ts +3 -0
  45. package/types/discount/camel.d.ts +14 -5
  46. package/types/discount/index.d.ts +16 -2
  47. package/types/discount/snake.d.ts +34 -8
  48. package/types/giftcard/camel.d.ts +6 -0
  49. package/types/giftcard/index.d.ts +5 -0
  50. package/types/giftcard/snake.d.ts +39 -0
  51. package/types/index.d.ts +210 -147
  52. package/types/invoice/camel.d.ts +2 -4
  53. package/types/invoice/snake.d.ts +16 -10
  54. package/types/order/camel.d.ts +7 -16
  55. package/types/order/index.d.ts +1 -0
  56. package/types/order/snake.d.ts +35 -21
  57. package/types/payment/camel.d.ts +17 -25
  58. package/types/payment/index.d.ts +8 -0
  59. package/types/payment/snake.d.ts +57 -34
  60. package/types/product/camel.d.ts +13 -36
  61. package/types/product/index.d.ts +8 -8
  62. package/types/product/snake.d.ts +37 -30
  63. package/types/promotion/camel.d.ts +6 -5
  64. package/types/promotion/index.d.ts +6 -2
  65. package/types/promotion/snake.d.ts +20 -8
  66. package/types/purchase_link/camel.d.ts +3 -9
  67. package/types/purchase_link/index.d.ts +3 -7
  68. package/types/purchase_link/snake.d.ts +9 -12
  69. package/types/refund/camel.d.ts +2 -4
  70. package/types/shipment_rating/camel.d.ts +4 -7
  71. package/types/shipment_rating/index.d.ts +1 -0
  72. package/types/shipment_rating/snake.d.ts +3 -1
  73. package/types/subscription/camel.d.ts +13 -8
  74. package/types/subscription/index.d.ts +17 -3
  75. package/types/subscription/snake.d.ts +35 -27
package/dist/account.mjs CHANGED
@@ -77,7 +77,7 @@ function methods(request) {
77
77
  },
78
78
 
79
79
  listOrders(query) {
80
- return request('get', `/account/orders`, query);
80
+ return request('get', '/account/orders', query);
81
81
  },
82
82
 
83
83
  getOrder(id) {
@@ -85,14 +85,26 @@ function methods(request) {
85
85
  },
86
86
 
87
87
  // Deprecated methods
88
+
89
+ /**
90
+ * @deprecated use `listAddresses` instead
91
+ */
88
92
  getAddresses(query) {
89
93
  return request('get', '/account/addresses', query);
90
94
  },
95
+
96
+ /**
97
+ * @deprecated use `listCards` instead
98
+ */
91
99
  getCards(query) {
92
100
  return request('get', '/account/cards', query);
93
101
  },
102
+
103
+ /**
104
+ * @deprecated use `listOrders` instead
105
+ */
94
106
  getOrders(query) {
95
- return request('get', `/account/orders`, query);
107
+ return request('get', '/account/orders', query);
96
108
  },
97
109
  };
98
110
  }
package/dist/api.mjs CHANGED
@@ -7,7 +7,7 @@ import methods$5 from './products.mjs';
7
7
  import methods$6 from './categories.mjs';
8
8
  import methods$7 from './attributes.mjs';
9
9
  import methods$8 from './subscriptions.mjs';
10
- import { d as defaultMethods, z as trimEnd, A as utils, B as trimStart, C as trimBoth, t as toSnake, D as stringifyQuery, E as base64Encode, a as toCamel, F as setOptions } from './index.6938673d.mjs';
10
+ import { d as defaultMethods, z as trimEnd, A as utils, B as trimStart, C as trimBoth, t as toSnake, D as stringifyQuery, E as base64Encode, a as toCamel, F as setOptions } from './index.95daac5a.mjs';
11
11
  import methods$9 from './content.mjs';
12
12
  import methods$a from './settings.mjs';
13
13
  import PaymentController from './payment.mjs';
@@ -135,7 +135,7 @@ const options = {
135
135
  };
136
136
 
137
137
  const api = {
138
- version: '4.0.7',
138
+ version: '4.0.9',
139
139
  options,
140
140
  request,
141
141
 
@@ -1,4 +1,4 @@
1
- import { d as defaultMethods } from './index.6938673d.mjs';
1
+ import { d as defaultMethods } from './index.95daac5a.mjs';
2
2
  import cacheApi from './cache.mjs';
3
3
  import 'qs';
4
4
  import './find.fd7de00e.mjs';
package/dist/cache.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { s as set, m as merge, a as toCamel, h as toCamelPath, j as getOptions } from './index.6938673d.mjs';
1
+ import { s as set, m as merge, a as toCamel, h as toCamelPath, j as getOptions } from './index.95daac5a.mjs';
2
2
  import { g as get } from './find.fd7de00e.mjs';
3
3
  import 'qs';
4
4
  import './round.a606b844.mjs';
@@ -53,7 +53,7 @@ const cacheApi = {
53
53
  set(details) {
54
54
  this.debug('cache.set', ...arguments);
55
55
  let { model, id, path, value } = details;
56
- let { data = {}, record, presets } = this.values(details);
56
+ let { data = {}, record } = this.values(details);
57
57
 
58
58
  if (id === null) {
59
59
  return;
package/dist/card.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as toSnake, v as vaultRequest } from './index.6938673d.mjs';
1
+ import { t as toSnake, v as vaultRequest } from './index.95daac5a.mjs';
2
2
  import 'qs';
3
3
  import './find.fd7de00e.mjs';
4
4
  import './round.a606b844.mjs';
@@ -64,7 +64,7 @@ const cardApi = {
64
64
  return value;
65
65
  }
66
66
 
67
- const parts = new String(value).split(/[\s\/\-]+/, 2);
67
+ const parts = new String(value).split(/[\s/-]+/, 2);
68
68
  const month = parts[0];
69
69
  let year = parts[1];
70
70
 
package/dist/cart.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import 'qs';
2
- import { c as cloneDeep } from './index.6938673d.mjs';
2
+ import { c as cloneDeep } from './index.95daac5a.mjs';
3
3
  import 'deepmerge';
4
4
  import 'fast-case';
5
5
  import { cleanProductOptions } from './products.mjs';
@@ -137,7 +137,7 @@ function methods(request, options) {
137
137
  if (options.updateCart) {
138
138
  return options.updateCart(input);
139
139
  }
140
- return this.requestStateChange('put', `/cart`, data);
140
+ return this.requestStateChange('put', '/cart', data);
141
141
  },
142
142
 
143
143
  applyCoupon(code) {
@@ -176,11 +176,11 @@ function methods(request, options) {
176
176
  async getOrder(checkoutId = undefined) {
177
177
  let result;
178
178
  if (checkoutId) {
179
- result = await request('get', `/cart/order`, {
179
+ result = await request('get', '/cart/order', {
180
180
  checkout_id: checkoutId,
181
181
  });
182
182
  } else {
183
- result = await request('get', `/cart/order`);
183
+ result = await request('get', '/cart/order');
184
184
  }
185
185
  this.order = result;
186
186
  return result;
@@ -1,4 +1,4 @@
1
- import { d as defaultMethods } from './index.6938673d.mjs';
1
+ import { d as defaultMethods } from './index.95daac5a.mjs';
2
2
  import cacheApi from './cache.mjs';
3
3
  import 'qs';
4
4
  import './find.fd7de00e.mjs';
package/dist/content.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import cacheApi from './cache.mjs';
2
- import './index.6938673d.mjs';
2
+ import './index.95daac5a.mjs';
3
3
  import 'qs';
4
4
  import './find.fd7de00e.mjs';
5
5
  import './round.a606b844.mjs';
package/dist/cookie.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as isServer } from './index.6938673d.mjs';
1
+ import { i as isServer } from './index.95daac5a.mjs';
2
2
  import 'qs';
3
3
  import './find.fd7de00e.mjs';
4
4
  import './round.a606b844.mjs';
@@ -1469,11 +1469,13 @@ function isEmpty(value) {
1469
1469
  return true;
1470
1470
  }
1471
1471
 
1472
+ /* global Buffer */
1473
+
1472
1474
  const LOADING_SCRIPTS = {};
1473
1475
 
1474
1476
  let options = {};
1475
1477
 
1476
- function merge(x, y, opt = {}) {
1478
+ function merge(x, y, _opt = {}) {
1477
1479
  if (!y || typeof y !== 'object') {
1478
1480
  return x;
1479
1481
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  export { default } from './api.mjs';
2
2
  import './card.mjs';
3
- import './index.6938673d.mjs';
3
+ import './index.95daac5a.mjs';
4
4
  import 'qs';
5
5
  import './find.fd7de00e.mjs';
6
6
  import './round.a606b844.mjs';