swell-js 4.2.1 → 4.2.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.
- package/dist/api.mjs +9 -4
- package/dist/attributes.mjs +1 -1
- package/dist/cache.mjs +1 -1
- package/dist/card.mjs +1 -1
- package/dist/cart.mjs +1 -1
- package/dist/categories.mjs +1 -1
- package/dist/content.mjs +1 -1
- package/dist/cookie.mjs +2 -2
- package/dist/{index.738bc14a.mjs → index.6497db06.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/payment.mjs +1 -1
- package/dist/products.mjs +1 -1
- package/dist/settings.mjs +1 -1
- package/dist/subscriptions.mjs +1 -1
- package/dist/swell.cjs +10 -5
- package/dist/swell.cjs.map +1 -1
- package/dist/swell.umd.min.js +10 -5
- package/dist/swell.umd.min.js.map +1 -1
- package/dist/utils/index.mjs +1 -1
- package/package.json +1 -1
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, y as trimEnd, z as utils, A as trimStart, B as trimBoth, t as toSnake, C as stringifyQuery, D as base64Encode, a as toCamel, E as setOptions } from './index.
|
|
10
|
+
import { d as defaultMethods, y as trimEnd, z as utils, A as trimStart, B as trimBoth, t as toSnake, C as stringifyQuery, D as base64Encode, i as isServer, a as toCamel, E as setOptions } from './index.6497db06.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.2.
|
|
138
|
+
version: '4.2.2',
|
|
139
139
|
options,
|
|
140
140
|
request,
|
|
141
141
|
|
|
@@ -284,8 +284,13 @@ async function request(
|
|
|
284
284
|
method: reqMethod,
|
|
285
285
|
headers: reqHeaders,
|
|
286
286
|
body: reqBody,
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
// Credentials and mode are only available in the browser
|
|
288
|
+
...(!isServer()
|
|
289
|
+
? {
|
|
290
|
+
credentials: 'include',
|
|
291
|
+
mode: 'cors',
|
|
292
|
+
}
|
|
293
|
+
: undefined),
|
|
289
294
|
});
|
|
290
295
|
|
|
291
296
|
const responseSession = response.headers.get('X-Session');
|
package/dist/attributes.mjs
CHANGED
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.
|
|
1
|
+
import { s as set, m as merge, a as toCamel, h as toCamelPath, j as getOptions } from './index.6497db06.mjs';
|
|
2
2
|
import { g as get } from './find.18f1ac6d.mjs';
|
|
3
3
|
import 'qs';
|
|
4
4
|
import './round.577a8441.mjs';
|
package/dist/card.mjs
CHANGED
package/dist/cart.mjs
CHANGED
package/dist/categories.mjs
CHANGED
package/dist/content.mjs
CHANGED
package/dist/cookie.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isServer } from './index.
|
|
1
|
+
import { i as isServer } from './index.6497db06.mjs';
|
|
2
2
|
import 'qs';
|
|
3
3
|
import './find.18f1ac6d.mjs';
|
|
4
4
|
import './round.577a8441.mjs';
|
|
@@ -12,7 +12,7 @@ function getCookie(name) {
|
|
|
12
12
|
return undefined;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const matches = document.cookie
|
|
15
|
+
const matches = window.document.cookie?.match(
|
|
16
16
|
new RegExp(
|
|
17
17
|
'(?:^|; )' + name.replace(/([.$?*|{}()[]\\\/\+^])/g, '\\$1') + '=([^;]*)',
|
|
18
18
|
),
|
|
@@ -1576,7 +1576,7 @@ function reduce(arr, cb, init) {
|
|
|
1576
1576
|
}
|
|
1577
1577
|
|
|
1578
1578
|
function isServer() {
|
|
1579
|
-
return !(typeof window !== 'undefined' && window
|
|
1579
|
+
return !(typeof window !== 'undefined' && window?.document);
|
|
1580
1580
|
}
|
|
1581
1581
|
|
|
1582
1582
|
function isFunction(func) {
|
package/dist/index.mjs
CHANGED
package/dist/payment.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import methods from './cart.mjs';
|
|
2
2
|
import methods$1 from './settings.mjs';
|
|
3
|
-
import { b as isObject, k as isFunction, l as loadScript, c as cloneDeep, t as toSnake, v as vaultRequest, p as pick, n as isEmpty, o as isLiveMode, q as map, r as reduce, w as getLocationParams, x as removeUrlParams, a as toCamel } from './index.
|
|
3
|
+
import { b as isObject, k as isFunction, l as loadScript, c as cloneDeep, t as toSnake, v as vaultRequest, p as pick, n as isEmpty, o as isLiveMode, q as map, r as reduce, w as getLocationParams, x as removeUrlParams, a as toCamel } from './index.6497db06.mjs';
|
|
4
4
|
import { g as get, t as toNumber } from './find.18f1ac6d.mjs';
|
|
5
5
|
import 'qs';
|
|
6
6
|
import 'deepmerge';
|
package/dist/products.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as defaultMethods, r as reduce, t as toSnake, a as toCamel, f as snakeCase, u as uniq, g as isEqual } from './index.
|
|
1
|
+
import { d as defaultMethods, r as reduce, t as toSnake, a as toCamel, f as snakeCase, u as uniq, g as isEqual } from './index.6497db06.mjs';
|
|
2
2
|
import cacheApi from './cache.mjs';
|
|
3
3
|
import methods$1 from './attributes.mjs';
|
|
4
4
|
import { g as get, f as find } from './find.18f1ac6d.mjs';
|
package/dist/settings.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as set, a as toCamel, m as merge, c as cloneDeep, b as isObject, e as camelCase } from './index.
|
|
1
|
+
import { s as set, a as toCamel, m as merge, c as cloneDeep, b as isObject, e as camelCase } from './index.6497db06.mjs';
|
|
2
2
|
import { g as get, f as find } from './find.18f1ac6d.mjs';
|
|
3
3
|
import 'qs';
|
|
4
4
|
import './round.577a8441.mjs';
|
package/dist/subscriptions.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cleanProductOptions } from './products.mjs';
|
|
2
|
-
import { d as defaultMethods } from './index.
|
|
2
|
+
import { d as defaultMethods } from './index.6497db06.mjs';
|
|
3
3
|
import cacheApi from './cache.mjs';
|
|
4
4
|
import './attributes.mjs';
|
|
5
5
|
import './find.18f1ac6d.mjs';
|
package/dist/swell.cjs
CHANGED
|
@@ -4596,7 +4596,7 @@ function reduce(arr, cb, init) {
|
|
|
4596
4596
|
}
|
|
4597
4597
|
|
|
4598
4598
|
function isServer() {
|
|
4599
|
-
return !(typeof window !== 'undefined' && window
|
|
4599
|
+
return !(typeof window !== 'undefined' && window?.document);
|
|
4600
4600
|
}
|
|
4601
4601
|
|
|
4602
4602
|
function isFunction(func) {
|
|
@@ -4969,7 +4969,7 @@ function getCookie(name) {
|
|
|
4969
4969
|
return undefined;
|
|
4970
4970
|
}
|
|
4971
4971
|
|
|
4972
|
-
const matches = document.cookie
|
|
4972
|
+
const matches = window.document.cookie?.match(
|
|
4973
4973
|
new RegExp(
|
|
4974
4974
|
'(?:^|; )' + name.replace(/([.$?*|{}()[]\\\/\+^])/g, '\\$1') + '=([^;]*)',
|
|
4975
4975
|
),
|
|
@@ -10165,7 +10165,7 @@ const options = {
|
|
|
10165
10165
|
};
|
|
10166
10166
|
|
|
10167
10167
|
const api = {
|
|
10168
|
-
version: '4.2.
|
|
10168
|
+
version: '4.2.2',
|
|
10169
10169
|
options,
|
|
10170
10170
|
request,
|
|
10171
10171
|
|
|
@@ -10314,8 +10314,13 @@ async function request(
|
|
|
10314
10314
|
method: reqMethod,
|
|
10315
10315
|
headers: reqHeaders,
|
|
10316
10316
|
body: reqBody,
|
|
10317
|
-
|
|
10318
|
-
|
|
10317
|
+
// Credentials and mode are only available in the browser
|
|
10318
|
+
...(!isServer()
|
|
10319
|
+
? {
|
|
10320
|
+
credentials: 'include',
|
|
10321
|
+
mode: 'cors',
|
|
10322
|
+
}
|
|
10323
|
+
: undefined),
|
|
10319
10324
|
});
|
|
10320
10325
|
|
|
10321
10326
|
const responseSession = response.headers.get('X-Session');
|