@storepecker/storefront-core 1.2.0 → 2.1.0
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 +76 -75
- package/dist/api/index.d.cts +5 -3
- package/dist/api/index.d.ts +5 -3
- package/dist/api/index.js +9 -8
- package/dist/{booking-CegE1cje.d.ts → booking-BgZoXUBv.d.cts} +2 -41
- package/dist/{booking-B21s0inO.d.cts → booking-CZ59BXk3.d.ts} +2 -41
- package/dist/cart-BY8D8w-s.d.cts +90 -0
- package/dist/cart-GuhgeBBt.d.ts +90 -0
- package/dist/checkout/index.cjs +38 -37
- package/dist/checkout/index.d.cts +2 -1
- package/dist/checkout/index.d.ts +2 -1
- package/dist/checkout/index.js +6 -5
- package/dist/{chunk-34KV265H.cjs → chunk-26A3EBZI.cjs} +20 -20
- package/dist/chunk-2AHH3XBW.cjs +47 -0
- package/dist/{chunk-K5B62JZO.cjs → chunk-47XTPPII.cjs} +4 -4
- package/dist/chunk-4C4NTH6O.js +41 -0
- package/dist/{chunk-UM24VDYB.js → chunk-7R2V4C7Q.js} +2 -2
- package/dist/{chunk-CSISWBZZ.js → chunk-B7FOXIZN.js} +1 -1
- package/dist/chunk-BBRB475I.cjs +43 -0
- package/dist/chunk-BBRXE57K.cjs +50 -0
- package/dist/{chunk-QCQCFYYR.js → chunk-BHOXJGIE.js} +1 -1
- package/dist/chunk-BQ256JKN.js +39 -0
- package/dist/{chunk-7UH6REGV.js → chunk-C7ZJZEEN.js} +1 -1
- package/dist/{chunk-A6IO3HIN.cjs → chunk-FMHR5ABF.cjs} +28 -28
- package/dist/{chunk-JHGXIIBZ.cjs → chunk-G3R7ZVAG.cjs} +7 -7
- package/dist/{chunk-4MJMNIAB.js → chunk-GHABOHLA.js} +1 -1
- package/dist/chunk-GTV42PDK.cjs +46 -0
- package/dist/chunk-HEFA67WK.js +42 -0
- package/dist/chunk-HSF2D56O.js +40 -0
- package/dist/{chunk-GB3HW6DM.js → chunk-JWKDXFS4.js} +1 -1
- package/dist/{chunk-KWKHHRRJ.cjs → chunk-KKQKHG26.cjs} +3 -3
- package/dist/{chunk-QM73PI5L.cjs → chunk-N3ZCCKXV.cjs} +10 -10
- package/dist/{chunk-GQTO5ZE2.cjs → chunk-NE3ZHELZ.cjs} +0 -46
- package/dist/chunk-PWYWNRVO.cjs +150 -0
- package/dist/{chunk-E7WPE3PV.js → chunk-QAC72HKO.js} +1 -1
- package/dist/{chunk-CFF632IQ.cjs → chunk-SMHJRNCR.cjs} +4 -4
- package/dist/chunk-UOFTDL4D.js +146 -0
- package/dist/chunk-WEMNXIRS.js +47 -0
- package/dist/{chunk-LC5ZAUKL.cjs → chunk-XLQAALMU.cjs} +10 -10
- package/dist/{chunk-Z7LHRD3V.js → chunk-Y6NFUWTH.js} +3 -3
- package/dist/{chunk-LBGIUNM6.js → chunk-YY77CUWX.js} +1 -1
- package/dist/{chunk-UXLUE3HW.cjs → chunk-ZO2HREQL.cjs} +2 -2
- package/dist/collections-CenI9AlQ.d.cts +40 -0
- package/dist/collections-CenI9AlQ.d.ts +40 -0
- package/dist/components/index.cjs +126 -7
- package/dist/components/index.d.cts +35 -8
- package/dist/components/index.d.ts +35 -8
- package/dist/components/index.js +122 -7
- package/dist/hooks/index.cjs +368 -27
- package/dist/hooks/index.d.cts +83 -3
- package/dist/hooks/index.d.ts +83 -3
- package/dist/hooks/index.js +352 -14
- package/dist/middleware/index.cjs +47 -0
- package/dist/middleware/index.d.cts +8 -0
- package/dist/middleware/index.d.ts +8 -0
- package/dist/middleware/index.js +44 -0
- package/dist/models/index.d.cts +5 -3
- package/dist/models/index.d.ts +5 -3
- package/dist/{cart-VaCKkJ1C.d.cts → product-Dfi0ke-4.d.cts} +1 -88
- package/dist/{cart-VaCKkJ1C.d.ts → product-Dfi0ke-4.d.ts} +1 -88
- package/dist/store/index.cjs +17 -85
- package/dist/store/index.d.cts +22 -2
- package/dist/store/index.d.ts +22 -2
- package/dist/store/index.js +7 -82
- package/dist/utils/index.cjs +80 -65
- package/dist/utils/index.d.cts +72 -7
- package/dist/utils/index.d.ts +72 -7
- package/dist/utils/index.js +20 -43
- package/dist/{wishlist-FG8tgn76.d.ts → wishlist-DHOvXmJj.d.cts} +1 -1
- package/dist/{wishlist-CkAhLpbI.d.cts → wishlist-LfdFxddw.d.ts} +1 -1
- package/package.json +24 -5
- package/dist/chunk-7DQIKSGY.js +0 -40
- package/dist/chunk-FLBJKM6G.js +0 -83
- package/dist/chunk-S3WIGYDS.cjs +0 -42
package/dist/chunk-FLBJKM6G.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { removeCookie, getCookie, setCookie } from 'typescript-cookie';
|
|
2
|
-
|
|
3
|
-
// src/utils/constants.ts
|
|
4
|
-
var SLICE_STATUS = /* @__PURE__ */ ((SLICE_STATUS2) => {
|
|
5
|
-
SLICE_STATUS2["IDLE"] = "idle";
|
|
6
|
-
SLICE_STATUS2["LOADING"] = "loading";
|
|
7
|
-
SLICE_STATUS2["SUCCESS"] = "success";
|
|
8
|
-
SLICE_STATUS2["FAILURE"] = "failure";
|
|
9
|
-
return SLICE_STATUS2;
|
|
10
|
-
})(SLICE_STATUS || {});
|
|
11
|
-
var pathNameMap = {
|
|
12
|
-
"/checkout/cart": "bag",
|
|
13
|
-
"/checkout/address": "address",
|
|
14
|
-
"/checkout/payment": "payment",
|
|
15
|
-
"/checkout/summary": "summary"
|
|
16
|
-
};
|
|
17
|
-
var USER_CREDENTIALS = "____user_cred_";
|
|
18
|
-
var USER_CART = "____user_cart_";
|
|
19
|
-
var USER_CRED_TOKEN = "____user_cst_";
|
|
20
|
-
var USER_CRED_REFRESH_TOKEN = "____user_csr_";
|
|
21
|
-
var PRODUCT_STATUSES = [
|
|
22
|
-
"confirm",
|
|
23
|
-
"packed",
|
|
24
|
-
"shipped",
|
|
25
|
-
"delivered",
|
|
26
|
-
"cancel",
|
|
27
|
-
" return",
|
|
28
|
-
"refund"
|
|
29
|
-
];
|
|
30
|
-
var DEFAULT_TOAST_CONFIG = {
|
|
31
|
-
position: "bottom-left",
|
|
32
|
-
autoClose: 3e3,
|
|
33
|
-
hideProgressBar: false,
|
|
34
|
-
closeOnClick: true,
|
|
35
|
-
theme: "light",
|
|
36
|
-
progressClassName: "bg-primary"
|
|
37
|
-
};
|
|
38
|
-
var ALLOWED_COUNTRIES = ["AE", "IN", "US"];
|
|
39
|
-
var ADDRESS_FORM_SESSION_KEY = "address_form_values";
|
|
40
|
-
var _onTokenChange = null;
|
|
41
|
-
function setAuthTokenChangeCallback(callback) {
|
|
42
|
-
_onTokenChange = callback;
|
|
43
|
-
}
|
|
44
|
-
var Auth = {
|
|
45
|
-
isAuthenticated: false,
|
|
46
|
-
getUserDetails() {
|
|
47
|
-
return typeof window === "undefined" ? false : getCookie(USER_CRED_TOKEN);
|
|
48
|
-
},
|
|
49
|
-
setUserDetails(data) {
|
|
50
|
-
setCookie(USER_CREDENTIALS, JSON.stringify(data), {
|
|
51
|
-
expires: 60,
|
|
52
|
-
path: "/"
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
setAccessToken(token) {
|
|
56
|
-
setCookie(USER_CRED_TOKEN, token, {
|
|
57
|
-
expires: 60,
|
|
58
|
-
path: "/"
|
|
59
|
-
});
|
|
60
|
-
_onTokenChange?.(token);
|
|
61
|
-
},
|
|
62
|
-
getAccessToken() {
|
|
63
|
-
return getCookie(USER_CRED_TOKEN);
|
|
64
|
-
},
|
|
65
|
-
setRefreshToken(token) {
|
|
66
|
-
setCookie(USER_CRED_REFRESH_TOKEN, token, {
|
|
67
|
-
expires: 60,
|
|
68
|
-
path: "/"
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
getRefreshToken() {
|
|
72
|
-
return getCookie(USER_CRED_REFRESH_TOKEN);
|
|
73
|
-
},
|
|
74
|
-
removeTokens() {
|
|
75
|
-
removeCookie(USER_CRED_TOKEN);
|
|
76
|
-
removeCookie(USER_CRED_REFRESH_TOKEN);
|
|
77
|
-
removeCookie(USER_CREDENTIALS);
|
|
78
|
-
_onTokenChange?.(void 0);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
var auth_default = Auth;
|
|
82
|
-
|
|
83
|
-
export { ADDRESS_FORM_SESSION_KEY, ALLOWED_COUNTRIES, DEFAULT_TOAST_CONFIG, PRODUCT_STATUSES, SLICE_STATUS, USER_CART, USER_CREDENTIALS, USER_CRED_REFRESH_TOKEN, USER_CRED_TOKEN, auth_default, pathNameMap, setAuthTokenChangeCallback };
|
package/dist/chunk-S3WIGYDS.cjs
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk34KV265H_cjs = require('./chunk-34KV265H.cjs');
|
|
4
|
-
var zustand = require('zustand');
|
|
5
|
-
|
|
6
|
-
var initialState = {
|
|
7
|
-
cart: null,
|
|
8
|
-
status: "idle" /* IDLE */
|
|
9
|
-
};
|
|
10
|
-
var useCartStore = zustand.create((set) => ({
|
|
11
|
-
...initialState,
|
|
12
|
-
setCart: (cart) => set({ cart, status: "idle" /* IDLE */ }),
|
|
13
|
-
resetCart: () => set(initialState),
|
|
14
|
-
resetCartCount: () => set((state) => {
|
|
15
|
-
if (!state.cart) return state;
|
|
16
|
-
return { cart: { ...state.cart, total_quantity: 0 } };
|
|
17
|
-
}),
|
|
18
|
-
syncCart: async (addressId) => {
|
|
19
|
-
set({ status: "loading" /* LOADING */ });
|
|
20
|
-
try {
|
|
21
|
-
const response = await chunk34KV265H_cjs.getCart("/customer/cart/", addressId);
|
|
22
|
-
if (response) {
|
|
23
|
-
set({ cart: response, status: "idle" /* IDLE */ });
|
|
24
|
-
}
|
|
25
|
-
} catch {
|
|
26
|
-
set({ status: "idle" /* IDLE */ });
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
fetchCart: async (addressId) => {
|
|
30
|
-
set({ status: "loading" /* LOADING */ });
|
|
31
|
-
try {
|
|
32
|
-
const response = await chunk34KV265H_cjs.getCart("/customer/cart/", addressId);
|
|
33
|
-
if (response) {
|
|
34
|
-
set({ cart: response, status: "idle" /* IDLE */ });
|
|
35
|
-
}
|
|
36
|
-
} catch {
|
|
37
|
-
set({ status: "idle" /* IDLE */ });
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}));
|
|
41
|
-
|
|
42
|
-
exports.useCartStore = useCartStore;
|