@storepecker/storefront-core 2.2.2 → 2.3.1
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/index.cjs +78 -74
- package/dist/api/index.d.cts +6 -1
- package/dist/api/index.d.ts +6 -1
- package/dist/api/index.js +6 -6
- package/dist/checkout/index.cjs +23 -23
- package/dist/checkout/index.js +3 -3
- package/dist/{chunk-BHOXJGIE.js → chunk-27MTKBJL.js} +1 -1
- package/dist/chunk-3SYYP3XV.js +121 -0
- package/dist/{chunk-XLQAALMU.cjs → chunk-65Z7I5UP.cjs} +10 -10
- package/dist/{chunk-N3ZCCKXV.cjs → chunk-665CNTEX.cjs} +5 -5
- package/dist/{chunk-A67PCF55.cjs → chunk-6BVTMDR2.cjs} +17 -17
- package/dist/{chunk-7R2V4C7Q.js → chunk-AFM4IJVE.js} +1 -1
- package/dist/{chunk-FMHR5ABF.cjs → chunk-CV6DWPYF.cjs} +28 -28
- package/dist/chunk-ECHV2JSY.cjs +130 -0
- package/dist/{chunk-G3R7ZVAG.cjs → chunk-RDUT4W3B.cjs} +7 -7
- package/dist/{chunk-GHABOHLA.js → chunk-VWFZZFZL.js} +1 -1
- package/dist/{chunk-C7ZJZEEN.js → chunk-WYXT5AAG.js} +1 -1
- package/dist/{chunk-ZKHQPHT5.js → chunk-X35IATPX.js} +55 -7
- package/dist/{chunk-KKQKHG26.cjs → chunk-Y46EHRJQ.cjs} +3 -3
- package/dist/{chunk-ERLBPVFK.js → chunk-YEJZYH55.js} +1 -1
- package/dist/{chunk-JVSR6THX.cjs → chunk-Z4DBCDAH.cjs} +57 -9
- package/dist/{chunk-YY77CUWX.js → chunk-ZGMLOLTC.js} +1 -1
- package/dist/components/index.cjs +4 -4
- package/dist/components/index.js +3 -3
- package/dist/hooks/index.cjs +32 -31
- package/dist/hooks/index.js +9 -8
- package/dist/store/index.cjs +8 -8
- package/dist/store/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-JWKDXFS4.js +0 -61
- package/dist/chunk-ZO2HREQL.cjs +0 -69
package/dist/chunk-JWKDXFS4.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { auth_default } from './chunk-WEMNXIRS.js';
|
|
2
|
-
import { getPublicApiEndpoint, getStoreId } from './chunk-JQMLHRWL.js';
|
|
3
|
-
import axios from 'axios';
|
|
4
|
-
import { getCookie } from 'typescript-cookie';
|
|
5
|
-
|
|
6
|
-
var _instance = null;
|
|
7
|
-
function createInstance() {
|
|
8
|
-
const baseURL = getPublicApiEndpoint();
|
|
9
|
-
if (!baseURL) {
|
|
10
|
-
throw new Error("Missing API endpoint. Call initConfig() first.");
|
|
11
|
-
}
|
|
12
|
-
axios.defaults.withCredentials = true;
|
|
13
|
-
const instance = axios.create({
|
|
14
|
-
baseURL,
|
|
15
|
-
withCredentials: true
|
|
16
|
-
});
|
|
17
|
-
const onRequestSuccess = (config) => {
|
|
18
|
-
const csrftoken = getCookie("csrftoken");
|
|
19
|
-
const token = auth_default.getAccessToken();
|
|
20
|
-
config.headers["X-CSRFToken"] = csrftoken;
|
|
21
|
-
if (token) config.headers["Authorization"] = `Bearer ${token}`;
|
|
22
|
-
const storeId = getStoreId();
|
|
23
|
-
if (storeId) config.headers[""] = `Store ${storeId}`;
|
|
24
|
-
return config;
|
|
25
|
-
};
|
|
26
|
-
const onRequestFail = (error) => {
|
|
27
|
-
return Promise.reject(error);
|
|
28
|
-
};
|
|
29
|
-
instance.interceptors.request.use(onRequestSuccess, onRequestFail);
|
|
30
|
-
const onResponseSuccess = (response) => {
|
|
31
|
-
return response;
|
|
32
|
-
};
|
|
33
|
-
const onResponseFail = (error) => {
|
|
34
|
-
if (error && !error.response) ; else {
|
|
35
|
-
const status = error.response?.status;
|
|
36
|
-
if (status === 401) {
|
|
37
|
-
error.response?.data?.detail;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return Promise.reject(error);
|
|
41
|
-
};
|
|
42
|
-
instance.interceptors.response.use(onResponseSuccess, onResponseFail);
|
|
43
|
-
return instance;
|
|
44
|
-
}
|
|
45
|
-
function getHttpService() {
|
|
46
|
-
if (!_instance) {
|
|
47
|
-
_instance = createInstance();
|
|
48
|
-
}
|
|
49
|
-
return _instance;
|
|
50
|
-
}
|
|
51
|
-
function resetHttpService() {
|
|
52
|
-
_instance = null;
|
|
53
|
-
}
|
|
54
|
-
var httpService = new Proxy({}, {
|
|
55
|
-
get(_target, prop) {
|
|
56
|
-
return getHttpService()[prop];
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
var http_service_default = httpService;
|
|
60
|
-
|
|
61
|
-
export { getHttpService, http_service_default, resetHttpService };
|
package/dist/chunk-ZO2HREQL.cjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkBBRXE57K_cjs = require('./chunk-BBRXE57K.cjs');
|
|
4
|
-
var chunkN3CTXRFT_cjs = require('./chunk-N3CTXRFT.cjs');
|
|
5
|
-
var axios = require('axios');
|
|
6
|
-
var typescriptCookie = require('typescript-cookie');
|
|
7
|
-
|
|
8
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
|
|
10
|
-
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
11
|
-
|
|
12
|
-
var _instance = null;
|
|
13
|
-
function createInstance() {
|
|
14
|
-
const baseURL = chunkN3CTXRFT_cjs.getPublicApiEndpoint();
|
|
15
|
-
if (!baseURL) {
|
|
16
|
-
throw new Error("Missing API endpoint. Call initConfig() first.");
|
|
17
|
-
}
|
|
18
|
-
axios__default.default.defaults.withCredentials = true;
|
|
19
|
-
const instance = axios__default.default.create({
|
|
20
|
-
baseURL,
|
|
21
|
-
withCredentials: true
|
|
22
|
-
});
|
|
23
|
-
const onRequestSuccess = (config) => {
|
|
24
|
-
const csrftoken = typescriptCookie.getCookie("csrftoken");
|
|
25
|
-
const token = chunkBBRXE57K_cjs.auth_default.getAccessToken();
|
|
26
|
-
config.headers["X-CSRFToken"] = csrftoken;
|
|
27
|
-
if (token) config.headers["Authorization"] = `Bearer ${token}`;
|
|
28
|
-
const storeId = chunkN3CTXRFT_cjs.getStoreId();
|
|
29
|
-
if (storeId) config.headers[""] = `Store ${storeId}`;
|
|
30
|
-
return config;
|
|
31
|
-
};
|
|
32
|
-
const onRequestFail = (error) => {
|
|
33
|
-
return Promise.reject(error);
|
|
34
|
-
};
|
|
35
|
-
instance.interceptors.request.use(onRequestSuccess, onRequestFail);
|
|
36
|
-
const onResponseSuccess = (response) => {
|
|
37
|
-
return response;
|
|
38
|
-
};
|
|
39
|
-
const onResponseFail = (error) => {
|
|
40
|
-
if (error && !error.response) ; else {
|
|
41
|
-
const status = error.response?.status;
|
|
42
|
-
if (status === 401) {
|
|
43
|
-
error.response?.data?.detail;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return Promise.reject(error);
|
|
47
|
-
};
|
|
48
|
-
instance.interceptors.response.use(onResponseSuccess, onResponseFail);
|
|
49
|
-
return instance;
|
|
50
|
-
}
|
|
51
|
-
function getHttpService() {
|
|
52
|
-
if (!_instance) {
|
|
53
|
-
_instance = createInstance();
|
|
54
|
-
}
|
|
55
|
-
return _instance;
|
|
56
|
-
}
|
|
57
|
-
function resetHttpService() {
|
|
58
|
-
_instance = null;
|
|
59
|
-
}
|
|
60
|
-
var httpService = new Proxy({}, {
|
|
61
|
-
get(_target, prop) {
|
|
62
|
-
return getHttpService()[prop];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
var http_service_default = httpService;
|
|
66
|
-
|
|
67
|
-
exports.getHttpService = getHttpService;
|
|
68
|
-
exports.http_service_default = http_service_default;
|
|
69
|
-
exports.resetHttpService = resetHttpService;
|