@storepecker/storefront-core 1.0.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/address-DQEZzyUG.d.cts +19 -0
- package/dist/address-DQEZzyUG.d.ts +19 -0
- package/dist/api/index.cjs +367 -0
- package/dist/api/index.d.cts +127 -0
- package/dist/api/index.d.ts +127 -0
- package/dist/api/index.js +131 -0
- package/dist/booking-ClX-dhX7.d.ts +131 -0
- package/dist/booking-Drl7-IL7.d.cts +131 -0
- package/dist/cart-DVrn8hD0.d.cts +367 -0
- package/dist/cart-DVrn8hD0.d.ts +367 -0
- package/dist/checkout/index.cjs +228 -0
- package/dist/checkout/index.d.cts +251 -0
- package/dist/checkout/index.d.ts +251 -0
- package/dist/checkout/index.js +122 -0
- package/dist/chunk-4CVKE6CC.cjs +312 -0
- package/dist/chunk-4MJMNIAB.js +123 -0
- package/dist/chunk-57ZBPAXU.js +114 -0
- package/dist/chunk-7MQOVWLW.js +40 -0
- package/dist/chunk-7UH6REGV.js +12 -0
- package/dist/chunk-A6IO3HIN.cjs +151 -0
- package/dist/chunk-CFF632IQ.cjs +100 -0
- package/dist/chunk-CSISWBZZ.js +121 -0
- package/dist/chunk-E7WPE3PV.js +98 -0
- package/dist/chunk-FLBJKM6G.js +83 -0
- package/dist/chunk-GB3HW6DM.js +61 -0
- package/dist/chunk-GH75WUO2.cjs +42 -0
- package/dist/chunk-GQTO5ZE2.cjs +96 -0
- package/dist/chunk-JHGXIIBZ.cjs +37 -0
- package/dist/chunk-JQMLHRWL.js +21 -0
- package/dist/chunk-K44JZ5NL.cjs +212 -0
- package/dist/chunk-K5B62JZO.cjs +154 -0
- package/dist/chunk-KWKHHRRJ.cjs +15 -0
- package/dist/chunk-LBGIUNM6.js +30 -0
- package/dist/chunk-LC5ZAUKL.cjs +220 -0
- package/dist/chunk-N3CTXRFT.cjs +30 -0
- package/dist/chunk-QCQCFYYR.js +206 -0
- package/dist/chunk-QM73PI5L.cjs +218 -0
- package/dist/chunk-RCXQJ6XC.cjs +131 -0
- package/dist/chunk-UM24VDYB.js +216 -0
- package/dist/chunk-UXLUE3HW.cjs +69 -0
- package/dist/chunk-WFDKKOO7.js +210 -0
- package/dist/chunk-YUPBTD4M.js +289 -0
- package/dist/components/index.cjs +576 -0
- package/dist/components/index.css +329 -0
- package/dist/components/index.d.cts +58 -0
- package/dist/components/index.d.ts +58 -0
- package/dist/components/index.js +569 -0
- package/dist/coupons-C7iJ-1cy.d.cts +37 -0
- package/dist/coupons-CnfTKL1i.d.ts +37 -0
- package/dist/hooks/index.cjs +381 -0
- package/dist/hooks/index.d.cts +123 -0
- package/dist/hooks/index.d.ts +123 -0
- package/dist/hooks/index.js +364 -0
- package/dist/index-DTyIuLuI.d.cts +18 -0
- package/dist/index-DTyIuLuI.d.ts +18 -0
- package/dist/index.cjs +14 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/models/index.cjs +2 -0
- package/dist/models/index.d.cts +53 -0
- package/dist/models/index.d.ts +53 -0
- package/dist/models/index.js +1 -0
- package/dist/orders-CkUzv5Xh.d.ts +159 -0
- package/dist/orders-D0oC9ugD.d.cts +159 -0
- package/dist/phonepe-D7vn-9SR.d.cts +27 -0
- package/dist/phonepe-D7vn-9SR.d.ts +27 -0
- package/dist/store/index.cjs +149 -0
- package/dist/store/index.d.cts +46 -0
- package/dist/store/index.d.ts +46 -0
- package/dist/store/index.js +141 -0
- package/dist/useAddressForm-C-Uzug4d.d.ts +42 -0
- package/dist/useAddressForm-DgkCP1nG.d.cts +42 -0
- package/dist/utils/index.cjs +535 -0
- package/dist/utils/index.d.cts +507 -0
- package/dist/utils/index.d.ts +507 -0
- package/dist/utils/index.js +342 -0
- package/dist/wishlist-BzhnCAQD.d.ts +41 -0
- package/dist/wishlist-CBCZD66Y.d.cts +41 -0
- package/package.json +134 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
export { cart_default as LocalCart } from '../chunk-E7WPE3PV.js';
|
|
2
|
+
export { pixelEvents } from '../chunk-WFDKKOO7.js';
|
|
3
|
+
import { digestMessage } from '../chunk-YUPBTD4M.js';
|
|
4
|
+
export { CacheManager, cache, clearCache, constructFilter, convertObjectToParams, convertToCurrency, deleteCache, digestMessage, formatDateTime, formatPostalLabel, generateCacheKey, getAddressMeta, getCache, getDelayInMilliseconds, getParamsFromURL, getQueryParams, hasCache, invalidateCache, pluralize, pushParamsToURL, setCache, shareLink } from '../chunk-YUPBTD4M.js';
|
|
5
|
+
export { ADDRESS_FORM_SESSION_KEY, ALLOWED_COUNTRIES, auth_default as Auth, DEFAULT_TOAST_CONFIG, PRODUCT_STATUSES, SLICE_STATUS, USER_CART, USER_CREDENTIALS, USER_CRED_REFRESH_TOKEN, USER_CRED_TOKEN, pathNameMap, setAuthTokenChangeCallback } from '../chunk-FLBJKM6G.js';
|
|
6
|
+
import { getPhonePeApiEndpoint, getPublicApiEndpoint } from '../chunk-JQMLHRWL.js';
|
|
7
|
+
export { getApiEndpoint, getCloudFront, getConfig, getPhonePeApiEndpoint, getPublicApiEndpoint, getSecretKey, getStoreId, initConfig } from '../chunk-JQMLHRWL.js';
|
|
8
|
+
import axios from 'axios';
|
|
9
|
+
import { Cookies } from 'typescript-cookie';
|
|
10
|
+
|
|
11
|
+
// src/utils/crop.ts
|
|
12
|
+
var createImage = (url) => new Promise((resolve, reject) => {
|
|
13
|
+
const image = new Image();
|
|
14
|
+
image.addEventListener("load", () => resolve(image));
|
|
15
|
+
image.addEventListener("error", (error) => reject(error));
|
|
16
|
+
image.setAttribute("crossOrigin", "anonymous");
|
|
17
|
+
image.src = url;
|
|
18
|
+
});
|
|
19
|
+
async function getCroppedImg(imageSrc, pixelCrop, onBlob) {
|
|
20
|
+
const image = await createImage(imageSrc);
|
|
21
|
+
const canvas = document.createElement("canvas");
|
|
22
|
+
const ctx = canvas.getContext("2d");
|
|
23
|
+
const maxSize = Math.max(image.width, image.height);
|
|
24
|
+
const safeArea = 2 * (maxSize / 2 * Math.sqrt(2));
|
|
25
|
+
canvas.width = safeArea;
|
|
26
|
+
canvas.height = safeArea;
|
|
27
|
+
if (!ctx) return null;
|
|
28
|
+
ctx.drawImage(
|
|
29
|
+
image,
|
|
30
|
+
safeArea / 2 - image.width * 0.5,
|
|
31
|
+
safeArea / 2 - image.height * 0.5
|
|
32
|
+
);
|
|
33
|
+
const data = ctx.getImageData(0, 0, safeArea, safeArea);
|
|
34
|
+
canvas.width = pixelCrop.width;
|
|
35
|
+
canvas.height = pixelCrop.height;
|
|
36
|
+
ctx.putImageData(
|
|
37
|
+
data,
|
|
38
|
+
Math.round(0 - safeArea / 2 + image.width * 0.5 - pixelCrop.x),
|
|
39
|
+
Math.round(0 - safeArea / 2 + image.height * 0.5 - pixelCrop.y)
|
|
40
|
+
);
|
|
41
|
+
canvas.toBlob((blob) => {
|
|
42
|
+
onBlob(blob);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
var cropImage = async (image, croppedAreaPixels, onError, onBlob) => {
|
|
46
|
+
try {
|
|
47
|
+
const croppedImage = await getCroppedImg(image, croppedAreaPixels, onBlob);
|
|
48
|
+
return croppedImage;
|
|
49
|
+
} catch (err) {
|
|
50
|
+
onError(err);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/utils/helper.ts
|
|
55
|
+
var debounce = (fn, ms = 300) => {
|
|
56
|
+
let timeoutId;
|
|
57
|
+
return function(...args) {
|
|
58
|
+
clearTimeout(timeoutId);
|
|
59
|
+
timeoutId = setTimeout(() => fn.apply(this, args), ms);
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
var constructPaymentPayload = async (amount, orderId, userId, phoneNumber, merchantId, saltKey, saltIndex) => {
|
|
63
|
+
const isURLIncludeParams = window.location.href.includes("?");
|
|
64
|
+
const isTransactionIDPresent = window.location.href.includes("transactionId");
|
|
65
|
+
const paymentPayload = {
|
|
66
|
+
merchantId,
|
|
67
|
+
merchantTransactionId: orderId,
|
|
68
|
+
merchantUserId: userId,
|
|
69
|
+
amount: amount * 100,
|
|
70
|
+
redirectUrl: isTransactionIDPresent ? window.location.href : `${window.location.href}${isURLIncludeParams ? "&" : "?"}transactionId=${orderId}`,
|
|
71
|
+
redirectMode: "REDIRECT",
|
|
72
|
+
callbackUrl: `${getPublicApiEndpoint()}/payment/phonepe-order-webhook/`,
|
|
73
|
+
mobileNumber: phoneNumber,
|
|
74
|
+
paymentInstrument: {
|
|
75
|
+
type: "PAY_PAGE"
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const dataPayload = JSON.stringify(paymentPayload);
|
|
79
|
+
console.log(dataPayload);
|
|
80
|
+
const dataBase64 = Buffer.from(dataPayload).toString("base64");
|
|
81
|
+
const checksum = await digestMessage(`${dataBase64}/pg/v1/pay${saltKey}`);
|
|
82
|
+
const finalChecksum = `${checksum}###${saltIndex}`;
|
|
83
|
+
return {
|
|
84
|
+
base64Payload: dataBase64,
|
|
85
|
+
checksum: finalChecksum
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
var createXVerifyHeader = async (merchantId, transactionId, saltKey, saltIndex) => {
|
|
89
|
+
const checksum = await digestMessage(
|
|
90
|
+
`/pg/v1/status/${merchantId}/${transactionId}${saltKey}`
|
|
91
|
+
);
|
|
92
|
+
const finalChecksum = `${checksum}###${saltIndex}`;
|
|
93
|
+
return finalChecksum;
|
|
94
|
+
};
|
|
95
|
+
var PhonepePayment = class {
|
|
96
|
+
constructor(amount, orderId, userId, phoneNumber, merchantId, saltKey, saltIndex) {
|
|
97
|
+
this.amount = amount;
|
|
98
|
+
this.orderId = orderId;
|
|
99
|
+
this.userId = userId;
|
|
100
|
+
this.phoneNumber = phoneNumber;
|
|
101
|
+
this.merchantId = merchantId;
|
|
102
|
+
this.saltKey = saltKey;
|
|
103
|
+
this.saltIndex = saltIndex;
|
|
104
|
+
this.payload = {
|
|
105
|
+
base64Payload: "",
|
|
106
|
+
checksum: ""
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
async init() {
|
|
110
|
+
this.payload = await constructPaymentPayload(
|
|
111
|
+
this.amount,
|
|
112
|
+
this.orderId.toString(),
|
|
113
|
+
this.userId.toString(),
|
|
114
|
+
this.phoneNumber,
|
|
115
|
+
this.merchantId,
|
|
116
|
+
this.saltKey,
|
|
117
|
+
this.saltIndex
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
async getPaymentUrl() {
|
|
121
|
+
console.log(this.payload);
|
|
122
|
+
const response = await axios.post(
|
|
123
|
+
`${getPhonePeApiEndpoint()}/pay`,
|
|
124
|
+
{
|
|
125
|
+
request: this.payload.base64Payload
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
headers: {
|
|
129
|
+
accept: "application/json",
|
|
130
|
+
"Content-Type": "application/json",
|
|
131
|
+
"X-VERIFY": this.payload.checksum
|
|
132
|
+
},
|
|
133
|
+
withCredentials: false
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
const redirect = response.data.data.instrumentResponse.redirectInfo.url;
|
|
137
|
+
return redirect;
|
|
138
|
+
}
|
|
139
|
+
async checkPaymentStatus(transactionId) {
|
|
140
|
+
try {
|
|
141
|
+
const checksum = await createXVerifyHeader(
|
|
142
|
+
this.merchantId,
|
|
143
|
+
transactionId,
|
|
144
|
+
this.saltKey,
|
|
145
|
+
this.saltIndex
|
|
146
|
+
);
|
|
147
|
+
const response = await axios.get(
|
|
148
|
+
`${getPhonePeApiEndpoint()}/status/${this.merchantId}/${transactionId}`,
|
|
149
|
+
{
|
|
150
|
+
headers: {
|
|
151
|
+
accept: "application/json",
|
|
152
|
+
"Content-Type": "application/json",
|
|
153
|
+
"X-VERIFY": checksum
|
|
154
|
+
},
|
|
155
|
+
withCredentials: false
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
return response;
|
|
159
|
+
} catch (error) {
|
|
160
|
+
console.log(error);
|
|
161
|
+
return void 0;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
var phonepe_default = PhonepePayment;
|
|
166
|
+
|
|
167
|
+
// src/utils/routes.ts
|
|
168
|
+
var protectedRoutes = [
|
|
169
|
+
"/my/profile",
|
|
170
|
+
"/my/orders",
|
|
171
|
+
"/my/delete-account",
|
|
172
|
+
"/my/addresses",
|
|
173
|
+
"/my/dashboard"
|
|
174
|
+
];
|
|
175
|
+
var authRoutes = ["/login", "/signup"];
|
|
176
|
+
var publicRoutes = ["/about", "/"];
|
|
177
|
+
var urls = {
|
|
178
|
+
dashboard: "/my/dashboard",
|
|
179
|
+
profile: "/my/profile",
|
|
180
|
+
orders: "/my/orders",
|
|
181
|
+
orderDetail: "/my/orders/:id",
|
|
182
|
+
deleteAccount: "/my/delete-account",
|
|
183
|
+
addresses: "/my/addresses",
|
|
184
|
+
bookings: "/my/bookings",
|
|
185
|
+
login: "/login",
|
|
186
|
+
signup: "/signup",
|
|
187
|
+
about: "/about",
|
|
188
|
+
home: "/",
|
|
189
|
+
searchProducts: "/search-products",
|
|
190
|
+
shop: "/shop",
|
|
191
|
+
shopDetails: "/shop/:id",
|
|
192
|
+
cart: "/checkout/cart",
|
|
193
|
+
address: "/checkout/address",
|
|
194
|
+
payment: "/checkout/payment",
|
|
195
|
+
wishlist: "/wishlist",
|
|
196
|
+
privacyPolicy: "/privacy-policy",
|
|
197
|
+
faq: "/faq",
|
|
198
|
+
contactUs: "/contact-us",
|
|
199
|
+
services: "/services",
|
|
200
|
+
storeReview: "/store-review",
|
|
201
|
+
returnAndRefund: "/return-and-refund",
|
|
202
|
+
shippingPolicy: "/shipping-policy",
|
|
203
|
+
termsOfService: "/terms-of-service"
|
|
204
|
+
};
|
|
205
|
+
var routes_default = urls;
|
|
206
|
+
var getUniqueId = () => {
|
|
207
|
+
const uniqueId = Cookies.get("__spa_id");
|
|
208
|
+
if (!uniqueId) {
|
|
209
|
+
Cookies.set(
|
|
210
|
+
"__spa_id",
|
|
211
|
+
`SP-${Math.random().toString(36).substring(2, 15)}`
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
return Cookies.get("__spa_id");
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// src/utils/booking.ts
|
|
218
|
+
var dayNameToNumber = {
|
|
219
|
+
sunday: 0,
|
|
220
|
+
monday: 1,
|
|
221
|
+
tuesday: 2,
|
|
222
|
+
wednesday: 3,
|
|
223
|
+
thursday: 4,
|
|
224
|
+
friday: 5,
|
|
225
|
+
saturday: 6
|
|
226
|
+
};
|
|
227
|
+
var isAvailableDay = (date, availableDays, advanceBookingWindow) => {
|
|
228
|
+
const today = /* @__PURE__ */ new Date();
|
|
229
|
+
today.setHours(0, 0, 0, 0);
|
|
230
|
+
const availableDayNumbers = availableDays.map(
|
|
231
|
+
(day) => dayNameToNumber[day.toLowerCase()]
|
|
232
|
+
);
|
|
233
|
+
if (!availableDayNumbers.includes(date.getDay())) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
if (advanceBookingWindow > 0) {
|
|
237
|
+
let nextAvailableDate = new Date(today);
|
|
238
|
+
let daysChecked = 0;
|
|
239
|
+
while (daysChecked < 7) {
|
|
240
|
+
if (availableDayNumbers.includes(nextAvailableDate.getDay())) {
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
nextAvailableDate.setDate(nextAvailableDate.getDate() + 1);
|
|
244
|
+
daysChecked++;
|
|
245
|
+
}
|
|
246
|
+
let countAvailableDays = 0;
|
|
247
|
+
let currentDate = new Date(nextAvailableDate);
|
|
248
|
+
if (date < nextAvailableDate) {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
while (currentDate <= date) {
|
|
252
|
+
if (availableDayNumbers.includes(currentDate.getDay())) {
|
|
253
|
+
countAvailableDays++;
|
|
254
|
+
}
|
|
255
|
+
currentDate.setDate(currentDate.getDate() + 1);
|
|
256
|
+
}
|
|
257
|
+
return countAvailableDays <= advanceBookingWindow + 1;
|
|
258
|
+
}
|
|
259
|
+
return true;
|
|
260
|
+
};
|
|
261
|
+
var getAvailableDaysText = (availableDays) => {
|
|
262
|
+
const days = availableDays.map((day) => day.toLowerCase());
|
|
263
|
+
const sortedDays = days.sort(
|
|
264
|
+
(a, b) => dayNameToNumber[a] - dayNameToNumber[b]
|
|
265
|
+
);
|
|
266
|
+
const isAllWeekdays = [
|
|
267
|
+
"monday",
|
|
268
|
+
"tuesday",
|
|
269
|
+
"wednesday",
|
|
270
|
+
"thursday",
|
|
271
|
+
"friday"
|
|
272
|
+
].every((day) => days.includes(day));
|
|
273
|
+
const isWeekends = ["saturday", "sunday"].every((day) => days.includes(day)) && days.length === 2;
|
|
274
|
+
const isAllDays = days.length === 7;
|
|
275
|
+
if (isAllDays) return "Available every day";
|
|
276
|
+
if (isAllWeekdays) return "Available on weekdays (Monday-Friday)";
|
|
277
|
+
if (isWeekends) return "Saturday-Sunday";
|
|
278
|
+
return `Available on ${sortedDays.map((day) => day.charAt(0).toUpperCase() + day.slice(1)).join(", ")}`;
|
|
279
|
+
};
|
|
280
|
+
var getTimeConstraints = (date, operatingHours) => {
|
|
281
|
+
if (!date || !operatingHours) return { minTime: "", maxTime: "" };
|
|
282
|
+
const dayOfWeek = date.getDay();
|
|
283
|
+
const dayNames = [
|
|
284
|
+
"sunday",
|
|
285
|
+
"monday",
|
|
286
|
+
"tuesday",
|
|
287
|
+
"wednesday",
|
|
288
|
+
"thursday",
|
|
289
|
+
"friday",
|
|
290
|
+
"saturday"
|
|
291
|
+
];
|
|
292
|
+
const dayName = dayNames[dayOfWeek];
|
|
293
|
+
const timeSlots = operatingHours[dayName.toLowerCase()];
|
|
294
|
+
if (!timeSlots || timeSlots.length === 0) return { minTime: "", maxTime: "" };
|
|
295
|
+
const minTime = timeSlots.reduce(
|
|
296
|
+
(earliest, slot) => slot.start < earliest ? slot.start : earliest,
|
|
297
|
+
timeSlots[0].start
|
|
298
|
+
);
|
|
299
|
+
const maxTime = timeSlots.reduce(
|
|
300
|
+
(latest, slot) => slot.end > latest ? slot.end : latest,
|
|
301
|
+
timeSlots[0].end
|
|
302
|
+
);
|
|
303
|
+
return {
|
|
304
|
+
minTime,
|
|
305
|
+
maxTime,
|
|
306
|
+
// Add timeSlots for potential future use (e.g., showing breaks)
|
|
307
|
+
timeSlots
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
var generateTimeOptions = (minTime, maxTime) => {
|
|
311
|
+
const times = [];
|
|
312
|
+
let current = /* @__PURE__ */ new Date(`2000-01-01T${minTime}`);
|
|
313
|
+
const end = /* @__PURE__ */ new Date(`2000-01-01T${maxTime}`);
|
|
314
|
+
while (current <= end) {
|
|
315
|
+
times.push(current.toTimeString().slice(0, 5));
|
|
316
|
+
current.setMinutes(current.getMinutes() + 15);
|
|
317
|
+
}
|
|
318
|
+
return times;
|
|
319
|
+
};
|
|
320
|
+
var getNextAvailableDate = (availableDays, advanceBookingWindow) => {
|
|
321
|
+
const today = /* @__PURE__ */ new Date();
|
|
322
|
+
today.setHours(0, 0, 0, 0);
|
|
323
|
+
let nextDate = new Date(today);
|
|
324
|
+
let daysChecked = 0;
|
|
325
|
+
while (daysChecked < 7) {
|
|
326
|
+
if (isAvailableDay(nextDate, availableDays, advanceBookingWindow)) {
|
|
327
|
+
return nextDate;
|
|
328
|
+
}
|
|
329
|
+
nextDate.setDate(nextDate.getDate() + 1);
|
|
330
|
+
daysChecked++;
|
|
331
|
+
}
|
|
332
|
+
return null;
|
|
333
|
+
};
|
|
334
|
+
var formatBookingDateTime = (date, time) => {
|
|
335
|
+
if (!date || !time) return "";
|
|
336
|
+
const bookingDate = new Date(date);
|
|
337
|
+
const [hours, minutes] = time.split(":").map(Number);
|
|
338
|
+
bookingDate.setHours(hours, minutes, 0, 0);
|
|
339
|
+
return bookingDate.toISOString();
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
export { phonepe_default as PhonepePayment, authRoutes, cropImage, debounce, formatBookingDateTime, generateTimeOptions, getAvailableDaysText, getNextAvailableDate, getTimeConstraints, getUniqueId, isAvailableDay, protectedRoutes, publicRoutes, routes_default as urls };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { f as SLICE_STATUS, e as ProductDetail } from './cart-DVrn8hD0.js';
|
|
2
|
+
|
|
3
|
+
declare namespace User {
|
|
4
|
+
interface Root {
|
|
5
|
+
customer_name: string;
|
|
6
|
+
phone: string;
|
|
7
|
+
email: string;
|
|
8
|
+
date_of_birth: string;
|
|
9
|
+
country_code: string;
|
|
10
|
+
gender: string;
|
|
11
|
+
}
|
|
12
|
+
interface UserState {
|
|
13
|
+
user: LoginUserData | null;
|
|
14
|
+
isAuthenticated: boolean;
|
|
15
|
+
status: SLICE_STATUS;
|
|
16
|
+
}
|
|
17
|
+
interface LoginUserData {
|
|
18
|
+
email: string;
|
|
19
|
+
first_name: string;
|
|
20
|
+
last_name: string;
|
|
21
|
+
access: string;
|
|
22
|
+
refresh: string;
|
|
23
|
+
user_id: number;
|
|
24
|
+
phone_number: string;
|
|
25
|
+
}
|
|
26
|
+
interface UserDetailsPayload {
|
|
27
|
+
customer_name: string;
|
|
28
|
+
gender: string;
|
|
29
|
+
date_of_birth: string;
|
|
30
|
+
}
|
|
31
|
+
type LoginMethod = "email_otp" | "phone_otp";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare namespace Wishlist {
|
|
35
|
+
interface Root {
|
|
36
|
+
wishlist_count: number;
|
|
37
|
+
product_variants: ProductDetail.Root[];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { User as U, Wishlist as W };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { f as SLICE_STATUS, e as ProductDetail } from './cart-DVrn8hD0.cjs';
|
|
2
|
+
|
|
3
|
+
declare namespace User {
|
|
4
|
+
interface Root {
|
|
5
|
+
customer_name: string;
|
|
6
|
+
phone: string;
|
|
7
|
+
email: string;
|
|
8
|
+
date_of_birth: string;
|
|
9
|
+
country_code: string;
|
|
10
|
+
gender: string;
|
|
11
|
+
}
|
|
12
|
+
interface UserState {
|
|
13
|
+
user: LoginUserData | null;
|
|
14
|
+
isAuthenticated: boolean;
|
|
15
|
+
status: SLICE_STATUS;
|
|
16
|
+
}
|
|
17
|
+
interface LoginUserData {
|
|
18
|
+
email: string;
|
|
19
|
+
first_name: string;
|
|
20
|
+
last_name: string;
|
|
21
|
+
access: string;
|
|
22
|
+
refresh: string;
|
|
23
|
+
user_id: number;
|
|
24
|
+
phone_number: string;
|
|
25
|
+
}
|
|
26
|
+
interface UserDetailsPayload {
|
|
27
|
+
customer_name: string;
|
|
28
|
+
gender: string;
|
|
29
|
+
date_of_birth: string;
|
|
30
|
+
}
|
|
31
|
+
type LoginMethod = "email_otp" | "phone_otp";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare namespace Wishlist {
|
|
35
|
+
interface Root {
|
|
36
|
+
wishlist_count: number;
|
|
37
|
+
product_variants: ProductDetail.Root[];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { User as U, Wishlist as W };
|
package/package.json
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@storepecker/storefront-core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared logic and utilities for Snapstore themes",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./api": {
|
|
15
|
+
"types": "./dist/api/index.d.ts",
|
|
16
|
+
"import": "./dist/api/index.js",
|
|
17
|
+
"require": "./dist/api/index.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./models": {
|
|
20
|
+
"types": "./dist/models/index.d.ts",
|
|
21
|
+
"import": "./dist/models/index.js",
|
|
22
|
+
"require": "./dist/models/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./utils": {
|
|
25
|
+
"types": "./dist/utils/index.d.ts",
|
|
26
|
+
"import": "./dist/utils/index.js",
|
|
27
|
+
"require": "./dist/utils/index.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./hooks": {
|
|
30
|
+
"types": "./dist/hooks/index.d.ts",
|
|
31
|
+
"import": "./dist/hooks/index.js",
|
|
32
|
+
"require": "./dist/hooks/index.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./store": {
|
|
35
|
+
"types": "./dist/store/index.d.ts",
|
|
36
|
+
"import": "./dist/store/index.js",
|
|
37
|
+
"require": "./dist/store/index.cjs"
|
|
38
|
+
},
|
|
39
|
+
"./checkout": {
|
|
40
|
+
"types": "./dist/checkout/index.d.ts",
|
|
41
|
+
"import": "./dist/checkout/index.js",
|
|
42
|
+
"require": "./dist/checkout/index.cjs"
|
|
43
|
+
},
|
|
44
|
+
"./components": {
|
|
45
|
+
"types": "./dist/components/index.d.ts",
|
|
46
|
+
"import": "./dist/components/index.js",
|
|
47
|
+
"require": "./dist/components/index.cjs"
|
|
48
|
+
},
|
|
49
|
+
"./components/styles": "./dist/components/index.css"
|
|
50
|
+
},
|
|
51
|
+
"typesVersions": {
|
|
52
|
+
"*": {
|
|
53
|
+
"api": [
|
|
54
|
+
"./dist/api/index.d.ts"
|
|
55
|
+
],
|
|
56
|
+
"models": [
|
|
57
|
+
"./dist/models/index.d.ts"
|
|
58
|
+
],
|
|
59
|
+
"utils": [
|
|
60
|
+
"./dist/utils/index.d.ts"
|
|
61
|
+
],
|
|
62
|
+
"hooks": [
|
|
63
|
+
"./dist/hooks/index.d.ts"
|
|
64
|
+
],
|
|
65
|
+
"store": [
|
|
66
|
+
"./dist/store/index.d.ts"
|
|
67
|
+
],
|
|
68
|
+
"checkout": [
|
|
69
|
+
"./dist/checkout/index.d.ts"
|
|
70
|
+
],
|
|
71
|
+
"components": [
|
|
72
|
+
"./dist/components/index.d.ts"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "tsup",
|
|
78
|
+
"dev": "tsup --watch",
|
|
79
|
+
"lint": "tsc --noEmit",
|
|
80
|
+
"prepublishOnly": "npm run build",
|
|
81
|
+
"release": "npm run build && npm publish --access public",
|
|
82
|
+
"release:patch": "npm version patch && npm run release",
|
|
83
|
+
"release:minor": "npm version minor && npm run release",
|
|
84
|
+
"release:major": "npm version major && npm run release"
|
|
85
|
+
},
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"axios": "^1.0.0",
|
|
88
|
+
"clsx": "^2.0.0",
|
|
89
|
+
"formik": "^2.0.0",
|
|
90
|
+
"libphonenumber-js": "^1.10.0",
|
|
91
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
92
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
93
|
+
"typescript-cookie": "^1.0.0",
|
|
94
|
+
"yup": "^1.0.0",
|
|
95
|
+
"zustand": "^5.0.0"
|
|
96
|
+
},
|
|
97
|
+
"peerDependenciesMeta": {
|
|
98
|
+
"clsx": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"formik": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"yup": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
"libphonenumber-js": {
|
|
108
|
+
"optional": true
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"devDependencies": {
|
|
112
|
+
"@types/node": "^25.3.3",
|
|
113
|
+
"@types/react": "^18.0.0",
|
|
114
|
+
"axios": "^1.7.0",
|
|
115
|
+
"clsx": "^2.1.1",
|
|
116
|
+
"esbuild-css-modules-plugin": "^3.1.5",
|
|
117
|
+
"formik": "^2.4.6",
|
|
118
|
+
"libphonenumber-js": "^1.11.0",
|
|
119
|
+
"react": "^18.3.1",
|
|
120
|
+
"react-dom": "^18.3.1",
|
|
121
|
+
"react-easy-crop": "^5.5.6",
|
|
122
|
+
"react-toastify": "^11.0.5",
|
|
123
|
+
"sass": "^1.97.3",
|
|
124
|
+
"tsup": "^8.0.0",
|
|
125
|
+
"typescript": "^5.5.0",
|
|
126
|
+
"typescript-cookie": "^1.0.0",
|
|
127
|
+
"yup": "^1.4.0",
|
|
128
|
+
"zustand": "^5.0.11"
|
|
129
|
+
},
|
|
130
|
+
"files": [
|
|
131
|
+
"dist"
|
|
132
|
+
],
|
|
133
|
+
"license": "UNLICENSED"
|
|
134
|
+
}
|