swell-js 3.23.2 → 3.23.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/{api.1a1cff2e.mjs → api.2d3371be.mjs} +126 -25
- package/dist/api.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/swell.cjs +131 -30
- package/dist/swell.cjs.map +1 -1
- package/dist/swell.umd.min.js +486 -374
- package/dist/swell.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +28 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { c as cardApi } from './card.982ad378.mjs';
|
|
2
2
|
import { g as getCookie, s as setCookie } from './cookie.40ff798c.mjs';
|
|
3
3
|
import { c as cacheApi } from './cache.70033487.mjs';
|
|
4
|
-
import { m as methods$
|
|
5
|
-
import { m as methods$
|
|
6
|
-
import { m as methods$
|
|
7
|
-
import { m as methods$
|
|
8
|
-
import { m as methods$
|
|
9
|
-
import { m as methods$
|
|
4
|
+
import { m as methods$3 } from './cart.dd00d6d6.mjs';
|
|
5
|
+
import { m as methods$4 } from './account.d991b136.mjs';
|
|
6
|
+
import { m as methods$5 } from './products.c20a4350.mjs';
|
|
7
|
+
import { m as methods$6 } from './categories.f6027058.mjs';
|
|
8
|
+
import { m as methods$7 } from './attributes.b332bfad.mjs';
|
|
9
|
+
import { m as methods$8 } from './subscriptions.fd44cccc.mjs';
|
|
10
10
|
import { d as defaultMethods, j as trimEnd, E as utils, i as trimStart, h as trimBoth, f as toSnake, k as stringifyQuery, y as base64Encode, t as toCamel, b as setOptions } from './index.b29eadc6.mjs';
|
|
11
|
-
import { m as methods$
|
|
12
|
-
import { m as methods$
|
|
11
|
+
import { m as methods$9 } from './content.5b4bea62.mjs';
|
|
12
|
+
import { m as methods$a } from './settings.6c0d2563.mjs';
|
|
13
13
|
import { P as PaymentController } from './index.33151a3b.mjs';
|
|
14
|
-
import { m as methods$
|
|
15
|
-
import { m as methods$
|
|
14
|
+
import { m as methods$b } from './locale.9d7241ac.mjs';
|
|
15
|
+
import { m as methods$c } from './currency.e2cd8985.mjs';
|
|
16
16
|
|
|
17
|
-
function methods(request) {
|
|
17
|
+
function methods$2(request) {
|
|
18
18
|
const { get, list } = defaultMethods(request, '/invoices', ['list', 'get']);
|
|
19
19
|
return {
|
|
20
20
|
get: (id, ...args) => {
|
|
@@ -25,6 +25,102 @@ function methods(request) {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
function methods$1(request, opt) {
|
|
29
|
+
return {
|
|
30
|
+
/**
|
|
31
|
+
* Get the decoded session as an object of session values
|
|
32
|
+
*/
|
|
33
|
+
get() {
|
|
34
|
+
return request('get', '/session');
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get the encoded session cookie
|
|
39
|
+
* This simplifies storing or passing the session to another system
|
|
40
|
+
*/
|
|
41
|
+
getCookie() {
|
|
42
|
+
return opt.getCookie('swell-session');
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Set the encoded session cookie
|
|
47
|
+
* This simplifies restoring the session from another system
|
|
48
|
+
*/
|
|
49
|
+
setCookie(value) {
|
|
50
|
+
opt.setCookie('swell-session', value);
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function methods(request, _opt) {
|
|
56
|
+
return {
|
|
57
|
+
/**
|
|
58
|
+
* Make a request to an app function and greceiveet a response
|
|
59
|
+
* @param {string} method
|
|
60
|
+
* @param {string} appId
|
|
61
|
+
* @param {string} functionName
|
|
62
|
+
* @param {any} data
|
|
63
|
+
* @param {object?} options
|
|
64
|
+
* @returns {any}
|
|
65
|
+
*/
|
|
66
|
+
request(method, appId, functionName, data, options = undefined) {
|
|
67
|
+
return request(method, functionName, undefined, data, {
|
|
68
|
+
...options,
|
|
69
|
+
path: `/functions/${appId}`,
|
|
70
|
+
useCamelCase: false, // avoid mutating data
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Helper to make a GET request to an app function and receive a response
|
|
76
|
+
* @param {string} appId
|
|
77
|
+
* @param {string} functionName
|
|
78
|
+
* @param {any} data
|
|
79
|
+
* @param {object?} options
|
|
80
|
+
* @returns {any}
|
|
81
|
+
*/
|
|
82
|
+
get(appId, functionName, data, options = undefined) {
|
|
83
|
+
return this.request('get', appId, functionName, data, options);
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Helper to make a PUT request to an app function and receive a response
|
|
88
|
+
* @param {string} appId
|
|
89
|
+
* @param {string} functionName
|
|
90
|
+
* @param {any} data
|
|
91
|
+
* @param {object?} options
|
|
92
|
+
* @returns {any}
|
|
93
|
+
*/
|
|
94
|
+
put(appId, functionName, data, options = undefined) {
|
|
95
|
+
return this.request('put', appId, functionName, data, options);
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Helper to make a POST request to an app function and receive a response
|
|
100
|
+
* @param {string} appId
|
|
101
|
+
* @param {string} functionName
|
|
102
|
+
* @param {any} data
|
|
103
|
+
* @param {object?} options
|
|
104
|
+
* @returns {any}
|
|
105
|
+
*/
|
|
106
|
+
post(appId, functionName, data, options = undefined) {
|
|
107
|
+
return this.request('post', appId, functionName, data, options);
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Helper to make a DELETE request to an app function and receive a response
|
|
112
|
+
* @param {string} appId
|
|
113
|
+
* @param {string} functionName
|
|
114
|
+
* @param {any} data
|
|
115
|
+
* @param {object?} options
|
|
116
|
+
* @returns {any}
|
|
117
|
+
*/
|
|
118
|
+
delete(appId, functionName, data, options = undefined) {
|
|
119
|
+
return this.request('delete', appId, functionName, data, options);
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
28
124
|
const options = {
|
|
29
125
|
store: null,
|
|
30
126
|
key: null,
|
|
@@ -34,7 +130,7 @@ const options = {
|
|
|
34
130
|
};
|
|
35
131
|
|
|
36
132
|
const api = {
|
|
37
|
-
version: '3.23.
|
|
133
|
+
version: '3.23.3',
|
|
38
134
|
options,
|
|
39
135
|
request,
|
|
40
136
|
|
|
@@ -86,29 +182,33 @@ const api = {
|
|
|
86
182
|
|
|
87
183
|
card: cardApi,
|
|
88
184
|
|
|
89
|
-
cart: methods$
|
|
185
|
+
cart: methods$3(request, options),
|
|
90
186
|
|
|
91
|
-
account: methods$
|
|
187
|
+
account: methods$4(request),
|
|
92
188
|
|
|
93
|
-
products: methods$
|
|
189
|
+
products: methods$5(request, options),
|
|
94
190
|
|
|
95
|
-
categories: methods$
|
|
191
|
+
categories: methods$6(request),
|
|
96
192
|
|
|
97
|
-
attributes: methods$
|
|
193
|
+
attributes: methods$7(request),
|
|
98
194
|
|
|
99
|
-
subscriptions: methods$
|
|
195
|
+
subscriptions: methods$8(request),
|
|
100
196
|
|
|
101
|
-
invoices: methods(request),
|
|
197
|
+
invoices: methods$2(request),
|
|
102
198
|
|
|
103
|
-
content: methods$
|
|
199
|
+
content: methods$9(request, options),
|
|
104
200
|
|
|
105
|
-
settings: methods$
|
|
201
|
+
settings: methods$a(request, options),
|
|
106
202
|
|
|
107
203
|
payment: new PaymentController(request, options),
|
|
108
204
|
|
|
109
|
-
locale: methods$
|
|
205
|
+
locale: methods$b(request, options),
|
|
206
|
+
|
|
207
|
+
currency: methods$c(request, options),
|
|
208
|
+
|
|
209
|
+
session: methods$1(request, options),
|
|
110
210
|
|
|
111
|
-
|
|
211
|
+
functions: methods(request),
|
|
112
212
|
|
|
113
213
|
utils,
|
|
114
214
|
};
|
|
@@ -128,8 +228,9 @@ async function request(
|
|
|
128
228
|
const session = allOptions.session || allOptions.getCookie('swell-session');
|
|
129
229
|
const locale = allOptions.locale || allOptions.getCookie('swell-locale');
|
|
130
230
|
const currency = allOptions.currency || allOptions.getCookie('swell-currency');
|
|
231
|
+
const path = allOptions.path || '/api';
|
|
131
232
|
|
|
132
|
-
const baseUrl = `${allOptions.url}${allOptions.base || ''}
|
|
233
|
+
const baseUrl = `${allOptions.url}${allOptions.base || ''}${path}`;
|
|
133
234
|
const reqMethod = String(method).toLowerCase();
|
|
134
235
|
|
|
135
236
|
let reqUrl = url;
|
|
@@ -203,7 +304,7 @@ async function request(
|
|
|
203
304
|
throw err;
|
|
204
305
|
}
|
|
205
306
|
|
|
206
|
-
return
|
|
307
|
+
return allOptions.useCamelCase ? toCamel(result) : result;
|
|
207
308
|
}
|
|
208
309
|
|
|
209
310
|
export { api as a };
|
package/dist/api.mjs
CHANGED
package/dist/index.mjs
CHANGED
package/dist/swell.cjs
CHANGED
|
@@ -5106,7 +5106,7 @@ const cacheApi = {
|
|
|
5106
5106
|
},
|
|
5107
5107
|
};
|
|
5108
5108
|
|
|
5109
|
-
function methods$
|
|
5109
|
+
function methods$c(request) {
|
|
5110
5110
|
const { get, list } = defaultMethods(request, '/attributes', ['list', 'get']);
|
|
5111
5111
|
|
|
5112
5112
|
return {
|
|
@@ -5120,7 +5120,7 @@ function methods$a(request) {
|
|
|
5120
5120
|
|
|
5121
5121
|
let OPTIONS;
|
|
5122
5122
|
|
|
5123
|
-
function methods$
|
|
5123
|
+
function methods$b(request, opt) {
|
|
5124
5124
|
OPTIONS = opt;
|
|
5125
5125
|
const { get, list } = defaultMethods(request, '/products', ['list', 'get']);
|
|
5126
5126
|
return {
|
|
@@ -5329,7 +5329,7 @@ function findPurchaseOption(product, purchaseOption) {
|
|
|
5329
5329
|
}
|
|
5330
5330
|
|
|
5331
5331
|
async function getFilterableAttributeFilters(request, products, options) {
|
|
5332
|
-
const { results: filterableAttributes } = await methods$
|
|
5332
|
+
const { results: filterableAttributes } = await methods$c(
|
|
5333
5333
|
request).list({
|
|
5334
5334
|
filterable: true,
|
|
5335
5335
|
});
|
|
@@ -5514,7 +5514,7 @@ function getPriceRange(products) {
|
|
|
5514
5514
|
};
|
|
5515
5515
|
}
|
|
5516
5516
|
|
|
5517
|
-
function methods$
|
|
5517
|
+
function methods$a(request, options) {
|
|
5518
5518
|
return {
|
|
5519
5519
|
state: null,
|
|
5520
5520
|
order: null,
|
|
@@ -5696,7 +5696,7 @@ function methods$8(request, options) {
|
|
|
5696
5696
|
};
|
|
5697
5697
|
}
|
|
5698
5698
|
|
|
5699
|
-
function methods$
|
|
5699
|
+
function methods$9(request) {
|
|
5700
5700
|
return {
|
|
5701
5701
|
state: null,
|
|
5702
5702
|
|
|
@@ -5795,7 +5795,7 @@ function methods$7(request) {
|
|
|
5795
5795
|
};
|
|
5796
5796
|
}
|
|
5797
5797
|
|
|
5798
|
-
function methods$
|
|
5798
|
+
function methods$8(request) {
|
|
5799
5799
|
const { get, list } = defaultMethods(request, '/categories', ['list', 'get']);
|
|
5800
5800
|
|
|
5801
5801
|
return {
|
|
@@ -5807,7 +5807,7 @@ function methods$6(request) {
|
|
|
5807
5807
|
};
|
|
5808
5808
|
}
|
|
5809
5809
|
|
|
5810
|
-
function methods$
|
|
5810
|
+
function methods$7(request) {
|
|
5811
5811
|
const { get, list } = defaultMethods(request, '/subscriptions', [
|
|
5812
5812
|
'list',
|
|
5813
5813
|
'get',
|
|
@@ -5871,7 +5871,7 @@ function methods$5(request) {
|
|
|
5871
5871
|
};
|
|
5872
5872
|
}
|
|
5873
5873
|
|
|
5874
|
-
function methods$
|
|
5874
|
+
function methods$6(request) {
|
|
5875
5875
|
const { get, list } = defaultMethods(request, '/invoices', ['list', 'get']);
|
|
5876
5876
|
return {
|
|
5877
5877
|
get: (id, ...args) => {
|
|
@@ -5882,7 +5882,7 @@ function methods$4(request) {
|
|
|
5882
5882
|
};
|
|
5883
5883
|
}
|
|
5884
5884
|
|
|
5885
|
-
function methods$
|
|
5885
|
+
function methods$5(request, opt) {
|
|
5886
5886
|
return {
|
|
5887
5887
|
get: (type, id, query) => {
|
|
5888
5888
|
return cacheApi.getFetch(`content_${type}`, id, () =>
|
|
@@ -5897,7 +5897,7 @@ function methods$3(request, opt) {
|
|
|
5897
5897
|
};
|
|
5898
5898
|
}
|
|
5899
5899
|
|
|
5900
|
-
function methods$
|
|
5900
|
+
function methods$4(request, opt) {
|
|
5901
5901
|
return {
|
|
5902
5902
|
state: null,
|
|
5903
5903
|
menuState: null,
|
|
@@ -6188,6 +6188,33 @@ function decodeLocaleValue(locale, values, key, configs, opt) {
|
|
|
6188
6188
|
}
|
|
6189
6189
|
}
|
|
6190
6190
|
|
|
6191
|
+
function methods$3(request, opt) {
|
|
6192
|
+
return {
|
|
6193
|
+
/**
|
|
6194
|
+
* Get the decoded session as an object of session values
|
|
6195
|
+
*/
|
|
6196
|
+
get() {
|
|
6197
|
+
return request('get', '/session');
|
|
6198
|
+
},
|
|
6199
|
+
|
|
6200
|
+
/**
|
|
6201
|
+
* Get the encoded session cookie
|
|
6202
|
+
* This simplifies storing or passing the session to another system
|
|
6203
|
+
*/
|
|
6204
|
+
getCookie() {
|
|
6205
|
+
return opt.getCookie('swell-session');
|
|
6206
|
+
},
|
|
6207
|
+
|
|
6208
|
+
/**
|
|
6209
|
+
* Set the encoded session cookie
|
|
6210
|
+
* This simplifies restoring the session from another system
|
|
6211
|
+
*/
|
|
6212
|
+
setCookie(value) {
|
|
6213
|
+
opt.setCookie('swell-session', value);
|
|
6214
|
+
},
|
|
6215
|
+
};
|
|
6216
|
+
}
|
|
6217
|
+
|
|
6191
6218
|
const SCRIPT_HANDLERS = {
|
|
6192
6219
|
'stripe-js': loadStripe,
|
|
6193
6220
|
'paypal-sdk': loadPaypal,
|
|
@@ -6507,7 +6534,7 @@ class Payment {
|
|
|
6507
6534
|
* @returns {object}
|
|
6508
6535
|
*/
|
|
6509
6536
|
async getCart() {
|
|
6510
|
-
const cart = await methods$
|
|
6537
|
+
const cart = await methods$a(this.request, this.options).get();
|
|
6511
6538
|
|
|
6512
6539
|
if (!cart) {
|
|
6513
6540
|
throw new Error('Cart not found');
|
|
@@ -6535,7 +6562,7 @@ class Payment {
|
|
|
6535
6562
|
}
|
|
6536
6563
|
}
|
|
6537
6564
|
|
|
6538
|
-
const updatedCart = await methods$
|
|
6565
|
+
const updatedCart = await methods$a(this.request, this.options).update(
|
|
6539
6566
|
updateData,
|
|
6540
6567
|
);
|
|
6541
6568
|
|
|
@@ -6548,7 +6575,7 @@ class Payment {
|
|
|
6548
6575
|
* @returns {object}
|
|
6549
6576
|
*/
|
|
6550
6577
|
async getSettings() {
|
|
6551
|
-
return methods$
|
|
6578
|
+
return methods$4(this.request, this.options).get();
|
|
6552
6579
|
}
|
|
6553
6580
|
|
|
6554
6581
|
/**
|
|
@@ -9418,7 +9445,7 @@ class PaymentController {
|
|
|
9418
9445
|
}
|
|
9419
9446
|
|
|
9420
9447
|
async _getPaymentMethods() {
|
|
9421
|
-
const paymentMethods = await methods$
|
|
9448
|
+
const paymentMethods = await methods$4(
|
|
9422
9449
|
this.request,
|
|
9423
9450
|
this.options,
|
|
9424
9451
|
).payments();
|
|
@@ -9626,7 +9653,7 @@ class PaymentController {
|
|
|
9626
9653
|
}
|
|
9627
9654
|
}
|
|
9628
9655
|
|
|
9629
|
-
function methods$
|
|
9656
|
+
function methods$2(request, opt) {
|
|
9630
9657
|
return {
|
|
9631
9658
|
code: null,
|
|
9632
9659
|
state: null,
|
|
@@ -9672,7 +9699,7 @@ function methods$1(request, opt) {
|
|
|
9672
9699
|
|
|
9673
9700
|
const FORMATTERS = {};
|
|
9674
9701
|
|
|
9675
|
-
function methods(request, opt) {
|
|
9702
|
+
function methods$1(request, opt) {
|
|
9676
9703
|
return {
|
|
9677
9704
|
code: null,
|
|
9678
9705
|
state: null,
|
|
@@ -9860,6 +9887,75 @@ function methods(request, opt) {
|
|
|
9860
9887
|
};
|
|
9861
9888
|
}
|
|
9862
9889
|
|
|
9890
|
+
function methods(request, _opt) {
|
|
9891
|
+
return {
|
|
9892
|
+
/**
|
|
9893
|
+
* Make a request to an app function and greceiveet a response
|
|
9894
|
+
* @param {string} method
|
|
9895
|
+
* @param {string} appId
|
|
9896
|
+
* @param {string} functionName
|
|
9897
|
+
* @param {any} data
|
|
9898
|
+
* @param {object?} options
|
|
9899
|
+
* @returns {any}
|
|
9900
|
+
*/
|
|
9901
|
+
request(method, appId, functionName, data, options = undefined) {
|
|
9902
|
+
return request(method, functionName, undefined, data, {
|
|
9903
|
+
...options,
|
|
9904
|
+
path: `/functions/${appId}`,
|
|
9905
|
+
useCamelCase: false, // avoid mutating data
|
|
9906
|
+
});
|
|
9907
|
+
},
|
|
9908
|
+
|
|
9909
|
+
/**
|
|
9910
|
+
* Helper to make a GET request to an app function and receive a response
|
|
9911
|
+
* @param {string} appId
|
|
9912
|
+
* @param {string} functionName
|
|
9913
|
+
* @param {any} data
|
|
9914
|
+
* @param {object?} options
|
|
9915
|
+
* @returns {any}
|
|
9916
|
+
*/
|
|
9917
|
+
get(appId, functionName, data, options = undefined) {
|
|
9918
|
+
return this.request('get', appId, functionName, data, options);
|
|
9919
|
+
},
|
|
9920
|
+
|
|
9921
|
+
/**
|
|
9922
|
+
* Helper to make a PUT request to an app function and receive a response
|
|
9923
|
+
* @param {string} appId
|
|
9924
|
+
* @param {string} functionName
|
|
9925
|
+
* @param {any} data
|
|
9926
|
+
* @param {object?} options
|
|
9927
|
+
* @returns {any}
|
|
9928
|
+
*/
|
|
9929
|
+
put(appId, functionName, data, options = undefined) {
|
|
9930
|
+
return this.request('put', appId, functionName, data, options);
|
|
9931
|
+
},
|
|
9932
|
+
|
|
9933
|
+
/**
|
|
9934
|
+
* Helper to make a POST request to an app function and receive a response
|
|
9935
|
+
* @param {string} appId
|
|
9936
|
+
* @param {string} functionName
|
|
9937
|
+
* @param {any} data
|
|
9938
|
+
* @param {object?} options
|
|
9939
|
+
* @returns {any}
|
|
9940
|
+
*/
|
|
9941
|
+
post(appId, functionName, data, options = undefined) {
|
|
9942
|
+
return this.request('post', appId, functionName, data, options);
|
|
9943
|
+
},
|
|
9944
|
+
|
|
9945
|
+
/**
|
|
9946
|
+
* Helper to make a DELETE request to an app function and receive a response
|
|
9947
|
+
* @param {string} appId
|
|
9948
|
+
* @param {string} functionName
|
|
9949
|
+
* @param {any} data
|
|
9950
|
+
* @param {object?} options
|
|
9951
|
+
* @returns {any}
|
|
9952
|
+
*/
|
|
9953
|
+
delete(appId, functionName, data, options = undefined) {
|
|
9954
|
+
return this.request('delete', appId, functionName, data, options);
|
|
9955
|
+
},
|
|
9956
|
+
};
|
|
9957
|
+
}
|
|
9958
|
+
|
|
9863
9959
|
const options = {
|
|
9864
9960
|
store: null,
|
|
9865
9961
|
key: null,
|
|
@@ -9869,7 +9965,7 @@ const options = {
|
|
|
9869
9965
|
};
|
|
9870
9966
|
|
|
9871
9967
|
const api = {
|
|
9872
|
-
version: '3.23.
|
|
9968
|
+
version: '3.23.3',
|
|
9873
9969
|
options,
|
|
9874
9970
|
request,
|
|
9875
9971
|
|
|
@@ -9921,29 +10017,33 @@ const api = {
|
|
|
9921
10017
|
|
|
9922
10018
|
card: cardApi,
|
|
9923
10019
|
|
|
9924
|
-
cart: methods$
|
|
10020
|
+
cart: methods$a(request, options),
|
|
9925
10021
|
|
|
9926
|
-
account: methods$
|
|
10022
|
+
account: methods$9(request),
|
|
9927
10023
|
|
|
9928
|
-
products: methods$
|
|
10024
|
+
products: methods$b(request, options),
|
|
9929
10025
|
|
|
9930
|
-
categories: methods$
|
|
10026
|
+
categories: methods$8(request),
|
|
9931
10027
|
|
|
9932
|
-
attributes: methods$
|
|
10028
|
+
attributes: methods$c(request),
|
|
9933
10029
|
|
|
9934
|
-
subscriptions: methods$
|
|
10030
|
+
subscriptions: methods$7(request),
|
|
9935
10031
|
|
|
9936
|
-
invoices: methods$
|
|
10032
|
+
invoices: methods$6(request),
|
|
9937
10033
|
|
|
9938
|
-
content: methods$
|
|
10034
|
+
content: methods$5(request, options),
|
|
9939
10035
|
|
|
9940
|
-
settings: methods$
|
|
10036
|
+
settings: methods$4(request, options),
|
|
9941
10037
|
|
|
9942
10038
|
payment: new PaymentController(request, options),
|
|
9943
10039
|
|
|
9944
|
-
locale: methods$
|
|
10040
|
+
locale: methods$2(request, options),
|
|
10041
|
+
|
|
10042
|
+
currency: methods$1(request, options),
|
|
10043
|
+
|
|
10044
|
+
session: methods$3(request, options),
|
|
9945
10045
|
|
|
9946
|
-
|
|
10046
|
+
functions: methods(request),
|
|
9947
10047
|
|
|
9948
10048
|
utils,
|
|
9949
10049
|
};
|
|
@@ -9963,8 +10063,9 @@ async function request(
|
|
|
9963
10063
|
const session = allOptions.session || allOptions.getCookie('swell-session');
|
|
9964
10064
|
const locale = allOptions.locale || allOptions.getCookie('swell-locale');
|
|
9965
10065
|
const currency = allOptions.currency || allOptions.getCookie('swell-currency');
|
|
10066
|
+
const path = allOptions.path || '/api';
|
|
9966
10067
|
|
|
9967
|
-
const baseUrl = `${allOptions.url}${allOptions.base || ''}
|
|
10068
|
+
const baseUrl = `${allOptions.url}${allOptions.base || ''}${path}`;
|
|
9968
10069
|
const reqMethod = String(method).toLowerCase();
|
|
9969
10070
|
|
|
9970
10071
|
let reqUrl = url;
|
|
@@ -10038,7 +10139,7 @@ async function request(
|
|
|
10038
10139
|
throw err;
|
|
10039
10140
|
}
|
|
10040
10141
|
|
|
10041
|
-
return
|
|
10142
|
+
return allOptions.useCamelCase ? toCamel(result) : result;
|
|
10042
10143
|
}
|
|
10043
10144
|
|
|
10044
10145
|
module.exports = api;
|