@storepecker/storefront-core 2.3.5 → 2.4.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 +28 -24
- package/dist/api/index.d.cts +2 -1
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +1 -1
- package/dist/checkout/index.cjs +22 -22
- package/dist/checkout/index.js +2 -2
- package/dist/{chunk-BTT3XQ32.cjs → chunk-33TWVRZE.cjs} +6 -6
- package/dist/chunk-3YRSHPM6.cjs +34 -0
- package/dist/chunk-5NUDTIQ2.js +9 -0
- package/dist/{chunk-ILVGYHNI.js → chunk-6Q7QMPOQ.js} +2 -1
- package/dist/{chunk-HTFVROIV.cjs → chunk-7UK3E7SL.cjs} +6 -0
- package/dist/chunk-B3BXKMQA.cjs +271 -0
- package/dist/chunk-BTR3HLL4.js +14 -0
- package/dist/chunk-DODFO744.cjs +11 -0
- package/dist/chunk-EGFOTJPC.js +22 -0
- package/dist/{chunk-YUPBTD4M.js → chunk-F45S7UWC.js} +1 -139
- package/dist/chunk-HAQWCNDY.cjs +24 -0
- package/dist/{chunk-Y4NGR42Z.js → chunk-HUIT4JCR.js} +1 -1
- package/dist/{chunk-TF2KMTB6.js → chunk-JRYWZMNT.js} +1 -1
- package/dist/{chunk-JCOOINQF.cjs → chunk-KLNKIQQM.cjs} +4 -3
- package/dist/chunk-L43KF3AC.js +269 -0
- package/dist/chunk-LHF5BSWO.cjs +16 -0
- package/dist/chunk-LJUGNSQQ.cjs +149 -0
- package/dist/chunk-NA5GT4D3.js +75 -0
- package/dist/chunk-OSM73ETC.js +139 -0
- package/dist/{chunk-4CVKE6CC.cjs → chunk-OTMTHA5C.cjs} +0 -147
- package/dist/{chunk-JH4JJBXE.cjs → chunk-TTIQRDHX.cjs} +2 -2
- package/dist/chunk-U7EXLQCT.js +32 -0
- package/dist/{chunk-LW3V53WJ.js → chunk-UVU7H4E6.js} +6 -1
- package/dist/chunk-V447PVRV.cjs +308 -0
- package/dist/chunk-VWQR3A7V.cjs +81 -0
- package/dist/chunk-YK4M3SFP.js +301 -0
- package/dist/components/address-form.cjs +17 -0
- package/dist/components/address-form.css +329 -0
- package/dist/components/address-form.d.cts +33 -0
- package/dist/components/address-form.d.ts +33 -0
- package/dist/components/address-form.js +11 -0
- package/dist/components/digital-product-download-modal.cjs +8 -0
- package/dist/components/digital-product-download-modal.d.cts +15 -0
- package/dist/components/digital-product-download-modal.d.ts +15 -0
- package/dist/components/digital-product-download-modal.js +2 -0
- package/dist/components/index.cjs +35 -684
- package/dist/components/index.d.cts +14 -82
- package/dist/components/index.d.ts +14 -82
- package/dist/components/index.js +11 -678
- package/dist/components/search-dropdown.cjs +7 -0
- package/dist/components/search-dropdown.css +200 -0
- package/dist/components/search-dropdown.d.cts +28 -0
- package/dist/components/search-dropdown.d.ts +28 -0
- package/dist/components/search-dropdown.js +1 -0
- package/dist/components/share-button.cjs +9 -0
- package/dist/components/share-button.d.cts +11 -0
- package/dist/components/share-button.d.ts +11 -0
- package/dist/components/share-button.js +3 -0
- package/dist/components/share-icon.cjs +7 -0
- package/dist/components/share-icon.d.cts +9 -0
- package/dist/components/share-icon.d.ts +9 -0
- package/dist/components/share-icon.js +1 -0
- package/dist/components/theme-data-initializer.cjs +8 -0
- package/dist/components/theme-data-initializer.d.cts +12 -0
- package/dist/components/theme-data-initializer.d.ts +12 -0
- package/dist/components/theme-data-initializer.js +2 -0
- package/dist/hooks/index.cjs +18 -17
- package/dist/hooks/index.js +6 -5
- package/dist/pixelEvents-Bo-VjAx8.d.ts +371 -0
- package/dist/pixelEvents-C1rFPOwb.d.cts +371 -0
- package/dist/store/index.cjs +10 -5
- package/dist/store/index.d.cts +10 -1
- package/dist/store/index.d.ts +10 -1
- package/dist/store/index.js +3 -2
- package/dist/utils/index.cjs +44 -43
- package/dist/utils/index.d.cts +7 -370
- package/dist/utils/index.d.ts +7 -370
- package/dist/utils/index.js +3 -2
- package/package.json +49 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkV447PVRV_cjs = require('./chunk-V447PVRV.cjs');
|
|
4
|
+
var chunkKLNKIQQM_cjs = require('./chunk-KLNKIQQM.cjs');
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
// src/components/address-form/address-form.module.css
|
|
9
|
+
var address_form_default = {};
|
|
10
|
+
var AddressForm = react.forwardRef(
|
|
11
|
+
({
|
|
12
|
+
address,
|
|
13
|
+
onSuccess,
|
|
14
|
+
onError,
|
|
15
|
+
locationCacheKey,
|
|
16
|
+
defaultCountryId,
|
|
17
|
+
renderButton,
|
|
18
|
+
onFormikReady,
|
|
19
|
+
onCancel,
|
|
20
|
+
showCancel = true,
|
|
21
|
+
showDefaultCheckbox = true,
|
|
22
|
+
className,
|
|
23
|
+
submitLabel = "Save"
|
|
24
|
+
}, ref) => {
|
|
25
|
+
const {
|
|
26
|
+
formik,
|
|
27
|
+
states,
|
|
28
|
+
supportedCountries,
|
|
29
|
+
selectedCountry,
|
|
30
|
+
countryCodeOptions,
|
|
31
|
+
addressMeta,
|
|
32
|
+
handlePhoneCountryChange,
|
|
33
|
+
handleCountryCodeChange,
|
|
34
|
+
handlePhoneChange,
|
|
35
|
+
isSubmitting,
|
|
36
|
+
isEditing
|
|
37
|
+
} = chunkKLNKIQQM_cjs.useAddressForm({
|
|
38
|
+
address,
|
|
39
|
+
onSuccess,
|
|
40
|
+
onError,
|
|
41
|
+
locationCacheKey,
|
|
42
|
+
defaultCountryId
|
|
43
|
+
});
|
|
44
|
+
react.useImperativeHandle(
|
|
45
|
+
ref,
|
|
46
|
+
() => ({
|
|
47
|
+
formik,
|
|
48
|
+
resetForm: () => formik.resetForm()
|
|
49
|
+
}),
|
|
50
|
+
[formik]
|
|
51
|
+
);
|
|
52
|
+
react.useEffect(() => {
|
|
53
|
+
onFormikReady?.(formik);
|
|
54
|
+
}, [formik, onFormikReady]);
|
|
55
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
56
|
+
"form",
|
|
57
|
+
{
|
|
58
|
+
name: "address-form",
|
|
59
|
+
className: `${address_form_default.addressForm} ${className || ""}`,
|
|
60
|
+
onSubmit: formik.handleSubmit,
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formBody, children: [
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
|
|
64
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { children: "Name *" }),
|
|
65
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
+
"input",
|
|
67
|
+
{
|
|
68
|
+
className: address_form_default.formControl,
|
|
69
|
+
type: "text",
|
|
70
|
+
placeholder: "Name",
|
|
71
|
+
"aria-label": "name",
|
|
72
|
+
autoFocus: true,
|
|
73
|
+
...formik.getFieldProps("customer_name")
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
formik.touched.customer_name && formik.errors.customer_name && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.customer_name })
|
|
77
|
+
] }),
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
|
|
79
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { children: "Email *" }),
|
|
80
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
81
|
+
"input",
|
|
82
|
+
{
|
|
83
|
+
className: address_form_default.formControl,
|
|
84
|
+
type: "email",
|
|
85
|
+
placeholder: "Email",
|
|
86
|
+
"aria-label": "email",
|
|
87
|
+
...formik.getFieldProps("customer_email")
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
formik.touched.customer_email && formik.errors.customer_email && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.customer_email })
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
|
|
93
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { children: "Phone *" }),
|
|
94
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.phoneRow, children: [
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.phoneCodeCol, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
96
|
+
chunkV447PVRV_cjs.search_dropdown_default,
|
|
97
|
+
{
|
|
98
|
+
options: countryCodeOptions,
|
|
99
|
+
value: formik.values.customer_country_code,
|
|
100
|
+
onChange: handlePhoneCountryChange,
|
|
101
|
+
placeholder: "Country",
|
|
102
|
+
searchPlaceholder: "Search country...",
|
|
103
|
+
maxHeight: "250px"
|
|
104
|
+
}
|
|
105
|
+
) }),
|
|
106
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.phoneInputCol, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
107
|
+
"input",
|
|
108
|
+
{
|
|
109
|
+
className: address_form_default.formControl,
|
|
110
|
+
type: "tel",
|
|
111
|
+
placeholder: "Phone",
|
|
112
|
+
"aria-label": "phone",
|
|
113
|
+
name: "customer_phone",
|
|
114
|
+
value: formik.values.customer_phone,
|
|
115
|
+
onBlur: formik.handleBlur,
|
|
116
|
+
onChange: handlePhoneChange
|
|
117
|
+
}
|
|
118
|
+
) })
|
|
119
|
+
] }),
|
|
120
|
+
formik.touched.customer_phone && formik.errors.customer_phone && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.customer_phone })
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: address_form_default.divider }),
|
|
123
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { children: "Address (House No, Building, Street, Area) *" }),
|
|
125
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
126
|
+
"input",
|
|
127
|
+
{
|
|
128
|
+
className: address_form_default.formControl,
|
|
129
|
+
type: "text",
|
|
130
|
+
placeholder: "E.g. 1st Cross, 2nd Main, 3rd Stage",
|
|
131
|
+
"aria-label": "address",
|
|
132
|
+
...formik.getFieldProps("address")
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
formik.touched.address && formik.errors.address && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.address })
|
|
136
|
+
] }),
|
|
137
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.row, children: [
|
|
138
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
|
|
139
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-capitalize", children: "Country *" }),
|
|
140
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
141
|
+
chunkV447PVRV_cjs.search_dropdown_default,
|
|
142
|
+
{
|
|
143
|
+
options: countryCodeOptions,
|
|
144
|
+
value: selectedCountry?.tld_code,
|
|
145
|
+
onChange: handleCountryCodeChange,
|
|
146
|
+
placeholder: "Select country",
|
|
147
|
+
searchPlaceholder: "Search country...",
|
|
148
|
+
maxHeight: "250px",
|
|
149
|
+
name: "country_obj"
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] }) }),
|
|
153
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
|
|
154
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { style: { textTransform: "capitalize" }, children: [
|
|
155
|
+
addressMeta?.regionLabel || "State",
|
|
156
|
+
" *"
|
|
157
|
+
] }),
|
|
158
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.selectWrapper, children: [
|
|
159
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
160
|
+
"select",
|
|
161
|
+
{
|
|
162
|
+
className: address_form_default.formControl,
|
|
163
|
+
"aria-label": "state",
|
|
164
|
+
"data-select": "",
|
|
165
|
+
...formik.getFieldProps("state_obj"),
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ jsxRuntime.jsxs("option", { value: "", children: [
|
|
168
|
+
"Select ",
|
|
169
|
+
addressMeta?.regionLabel || "State"
|
|
170
|
+
] }),
|
|
171
|
+
states.map((state) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: state.id, children: state.name }, state.id))
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.selectArrow, children: /* @__PURE__ */ jsxRuntime.jsx(chunkV447PVRV_cjs.DownChevron, { width: 12, height: 12 }) })
|
|
176
|
+
] }),
|
|
177
|
+
formik.touched.state_obj && formik.errors.state_obj && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.state_obj })
|
|
178
|
+
] }) })
|
|
179
|
+
] }),
|
|
180
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.row, children: [
|
|
181
|
+
addressMeta?.hasPostal && /* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
|
|
182
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
|
|
183
|
+
addressMeta?.postalLabel || "Postal Code",
|
|
184
|
+
" *"
|
|
185
|
+
] }),
|
|
186
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
187
|
+
"input",
|
|
188
|
+
{
|
|
189
|
+
className: address_form_default.formControl,
|
|
190
|
+
type: "tel",
|
|
191
|
+
placeholder: addressMeta?.postalLabel || "Postal Code",
|
|
192
|
+
"aria-label": "pincode",
|
|
193
|
+
...formik.getFieldProps("pincode")
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
formik.touched.pincode && formik.errors.pincode && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.pincode })
|
|
197
|
+
] }) }),
|
|
198
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formGroup, children: [
|
|
199
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { children: "City/District *" }),
|
|
200
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
201
|
+
"input",
|
|
202
|
+
{
|
|
203
|
+
className: address_form_default.formControl,
|
|
204
|
+
type: "text",
|
|
205
|
+
placeholder: "E.g. Kochi, Bangalore",
|
|
206
|
+
"aria-label": "city",
|
|
207
|
+
...formik.getFieldProps("city")
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
formik.touched.city && formik.errors.city && /* @__PURE__ */ jsxRuntime.jsx("span", { className: address_form_default.error, children: formik.errors.city })
|
|
211
|
+
] }) })
|
|
212
|
+
] }),
|
|
213
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: address_form_default.divider }),
|
|
214
|
+
showDefaultCheckbox && /* @__PURE__ */ jsxRuntime.jsx("div", { className: address_form_default.formGroup, children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: address_form_default.checkboxLabel, children: [
|
|
215
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
216
|
+
"input",
|
|
217
|
+
{
|
|
218
|
+
type: "checkbox",
|
|
219
|
+
className: address_form_default.checkboxInput,
|
|
220
|
+
checked: formik.values.is_default || false,
|
|
221
|
+
onChange: (e) => {
|
|
222
|
+
formik.setFieldValue("is_default", e.target.checked);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
"Make this your default address"
|
|
227
|
+
] }) })
|
|
228
|
+
] }),
|
|
229
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: address_form_default.formFooter, children: [
|
|
230
|
+
showCancel && onCancel && /* @__PURE__ */ jsxRuntime.jsx(
|
|
231
|
+
"button",
|
|
232
|
+
{
|
|
233
|
+
type: "button",
|
|
234
|
+
className: address_form_default.cancelBtn,
|
|
235
|
+
onClick: onCancel,
|
|
236
|
+
children: "Cancel"
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
renderButton ? renderButton({
|
|
240
|
+
type: "submit",
|
|
241
|
+
disabled: !formik.isValid || isSubmitting,
|
|
242
|
+
loading: isSubmitting,
|
|
243
|
+
children: isEditing ? submitLabel : submitLabel
|
|
244
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
245
|
+
"button",
|
|
246
|
+
{
|
|
247
|
+
type: "submit",
|
|
248
|
+
disabled: !formik.isValid || isSubmitting,
|
|
249
|
+
className: address_form_default.formControl,
|
|
250
|
+
style: {
|
|
251
|
+
width: "auto",
|
|
252
|
+
cursor: !formik.isValid || isSubmitting ? "not-allowed" : "pointer",
|
|
253
|
+
backgroundColor: "var(--primary, #003d29)",
|
|
254
|
+
color: "var(--btn-text, #fff)",
|
|
255
|
+
border: "none",
|
|
256
|
+
padding: "0.5rem 1.5rem",
|
|
257
|
+
opacity: !formik.isValid || isSubmitting ? 0.6 : 1
|
|
258
|
+
},
|
|
259
|
+
children: isSubmitting ? "Saving..." : submitLabel
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
] })
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
AddressForm.displayName = "AddressForm";
|
|
269
|
+
var address_form_default2 = AddressForm;
|
|
270
|
+
|
|
271
|
+
exports.address_form_default = address_form_default2;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useThemeData } from './chunk-5NUDTIQ2.js';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function ThemeDataInitializer({
|
|
5
|
+
themeData
|
|
6
|
+
}) {
|
|
7
|
+
const setThemeData = useThemeData((state) => state.setThemeData);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
setThemeData(themeData);
|
|
10
|
+
}, [themeData]);
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { ThemeDataInitializer };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ShareIcon } from './chunk-U7EXLQCT.js';
|
|
2
|
+
import { shareLink, convertToCurrency } from './chunk-F45S7UWC.js';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var ShareButton = ({
|
|
6
|
+
product,
|
|
7
|
+
className = "flex space-x-2 items-center hover:text-textSecondary transition-all duration-100",
|
|
8
|
+
iconSize = 22
|
|
9
|
+
}) => {
|
|
10
|
+
const _handleShare = () => {
|
|
11
|
+
shareLink(
|
|
12
|
+
`Buy ${product.name} at ${convertToCurrency(
|
|
13
|
+
Number(product.selling_price)
|
|
14
|
+
)}`,
|
|
15
|
+
product.name
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-start gap-4", children: /* @__PURE__ */ jsx("button", { className, onClick: _handleShare, children: /* @__PURE__ */ jsx(ShareIcon, { width: iconSize, height: iconSize }) }) });
|
|
19
|
+
};
|
|
20
|
+
var share_button_default = ShareButton;
|
|
21
|
+
|
|
22
|
+
export { share_button_default };
|
|
@@ -1,141 +1,3 @@
|
|
|
1
|
-
// src/utils/cache.ts
|
|
2
|
-
var DEFAULT_EXPIRY_HOURS = 24;
|
|
3
|
-
var CacheManager = class _CacheManager {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
6
|
-
this.loadFromStorage();
|
|
7
|
-
}
|
|
8
|
-
static getInstance() {
|
|
9
|
-
if (!_CacheManager.instance) {
|
|
10
|
-
_CacheManager.instance = new _CacheManager();
|
|
11
|
-
}
|
|
12
|
-
return _CacheManager.instance;
|
|
13
|
-
}
|
|
14
|
-
loadFromStorage() {
|
|
15
|
-
if (typeof window === "undefined") return;
|
|
16
|
-
try {
|
|
17
|
-
const stored = localStorage.getItem("app_cache");
|
|
18
|
-
if (stored) {
|
|
19
|
-
const parsed = JSON.parse(stored);
|
|
20
|
-
this.cache = new Map(Object.entries(parsed));
|
|
21
|
-
this.cleanExpired();
|
|
22
|
-
}
|
|
23
|
-
} catch (error) {
|
|
24
|
-
console.warn("Failed to load cache from storage:", error);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
saveToStorage() {
|
|
28
|
-
if (typeof window === "undefined") return;
|
|
29
|
-
try {
|
|
30
|
-
const cacheObject = Object.fromEntries(this.cache);
|
|
31
|
-
localStorage.setItem("app_cache", JSON.stringify(cacheObject));
|
|
32
|
-
} catch (error) {
|
|
33
|
-
console.warn("Failed to save cache to storage:", error);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
cleanExpired() {
|
|
37
|
-
const now = Date.now();
|
|
38
|
-
const keysToDelete = [];
|
|
39
|
-
this.cache.forEach((item, key) => {
|
|
40
|
-
if (now > item.expiry) {
|
|
41
|
-
keysToDelete.push(key);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
keysToDelete.forEach((key) => {
|
|
45
|
-
this.cache.delete(key);
|
|
46
|
-
});
|
|
47
|
-
this.saveToStorage();
|
|
48
|
-
}
|
|
49
|
-
set(key, data, options = {}) {
|
|
50
|
-
const expiryHours = options.expiryHours || DEFAULT_EXPIRY_HOURS;
|
|
51
|
-
const now = Date.now();
|
|
52
|
-
const expiry = now + expiryHours * 60 * 60 * 1e3;
|
|
53
|
-
const cacheItem = {
|
|
54
|
-
data,
|
|
55
|
-
timestamp: now,
|
|
56
|
-
expiry
|
|
57
|
-
};
|
|
58
|
-
this.cache.set(key, cacheItem);
|
|
59
|
-
this.saveToStorage();
|
|
60
|
-
}
|
|
61
|
-
get(key) {
|
|
62
|
-
this.cleanExpired();
|
|
63
|
-
const item = this.cache.get(key);
|
|
64
|
-
if (!item) return null;
|
|
65
|
-
const now = Date.now();
|
|
66
|
-
if (now > item.expiry) {
|
|
67
|
-
this.cache.delete(key);
|
|
68
|
-
this.saveToStorage();
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
return item.data;
|
|
72
|
-
}
|
|
73
|
-
has(key) {
|
|
74
|
-
this.cleanExpired();
|
|
75
|
-
return this.cache.has(key);
|
|
76
|
-
}
|
|
77
|
-
delete(key) {
|
|
78
|
-
this.cache.delete(key);
|
|
79
|
-
this.saveToStorage();
|
|
80
|
-
}
|
|
81
|
-
clear() {
|
|
82
|
-
this.cache.clear();
|
|
83
|
-
if (typeof window !== "undefined") {
|
|
84
|
-
localStorage.removeItem("app_cache");
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
getCacheInfo() {
|
|
88
|
-
this.cleanExpired();
|
|
89
|
-
return {
|
|
90
|
-
size: this.cache.size,
|
|
91
|
-
keys: Array.from(this.cache.keys())
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
invalidateCache(pattern) {
|
|
95
|
-
this.cleanExpired();
|
|
96
|
-
if (!pattern) {
|
|
97
|
-
this.clear();
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const keysToDelete = [];
|
|
101
|
-
this.cache.forEach((item, key) => {
|
|
102
|
-
if (key.includes(pattern)) {
|
|
103
|
-
keysToDelete.push(key);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
keysToDelete.forEach((key) => {
|
|
107
|
-
this.cache.delete(key);
|
|
108
|
-
});
|
|
109
|
-
this.saveToStorage();
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
var cache = CacheManager.getInstance();
|
|
113
|
-
function setCache(key, data, options = {}) {
|
|
114
|
-
cache.set(key, data, options);
|
|
115
|
-
}
|
|
116
|
-
function getCache(key) {
|
|
117
|
-
return cache.get(key);
|
|
118
|
-
}
|
|
119
|
-
function hasCache(key) {
|
|
120
|
-
return cache.has(key);
|
|
121
|
-
}
|
|
122
|
-
function deleteCache(key) {
|
|
123
|
-
cache.delete(key);
|
|
124
|
-
}
|
|
125
|
-
function clearCache() {
|
|
126
|
-
cache.clear();
|
|
127
|
-
}
|
|
128
|
-
function invalidateCache(pattern) {
|
|
129
|
-
cache.invalidateCache(pattern);
|
|
130
|
-
}
|
|
131
|
-
function generateCacheKey(endpoint, params) {
|
|
132
|
-
const baseKey = endpoint.replace(/[^a-zA-Z0-9]/g, "_");
|
|
133
|
-
if (!params) return baseKey;
|
|
134
|
-
const paramString = JSON.stringify(params);
|
|
135
|
-
const hash = btoa(paramString).replace(/[^a-zA-Z0-9]/g, "");
|
|
136
|
-
return `${baseKey}_${hash}`;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
1
|
// src/utils/misc.ts
|
|
140
2
|
function convertObjectToParams(params) {
|
|
141
3
|
const cleanedParams = Object.fromEntries(
|
|
@@ -286,4 +148,4 @@ async function getAddressMeta(countryCode) {
|
|
|
286
148
|
};
|
|
287
149
|
}
|
|
288
150
|
|
|
289
|
-
export {
|
|
151
|
+
export { constructFilter, convertObjectToParams, convertToCurrency, digestMessage, formatDateTime, formatPostalLabel, getAddressMeta, getDelayInMilliseconds, getParamsFromURL, getQueryParams, pluralize, pushParamsToURL, shareLink };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk3YRSHPM6_cjs = require('./chunk-3YRSHPM6.cjs');
|
|
4
|
+
var chunkOTMTHA5C_cjs = require('./chunk-OTMTHA5C.cjs');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
var ShareButton = ({
|
|
8
|
+
product,
|
|
9
|
+
className = "flex space-x-2 items-center hover:text-textSecondary transition-all duration-100",
|
|
10
|
+
iconSize = 22
|
|
11
|
+
}) => {
|
|
12
|
+
const _handleShare = () => {
|
|
13
|
+
chunkOTMTHA5C_cjs.shareLink(
|
|
14
|
+
`Buy ${product.name} at ${chunkOTMTHA5C_cjs.convertToCurrency(
|
|
15
|
+
Number(product.selling_price)
|
|
16
|
+
)}`,
|
|
17
|
+
product.name
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start gap-4", children: /* @__PURE__ */ jsxRuntime.jsx("button", { className, onClick: _handleShare, children: /* @__PURE__ */ jsxRuntime.jsx(chunk3YRSHPM6_cjs.ShareIcon, { width: iconSize, height: iconSize }) }) });
|
|
21
|
+
};
|
|
22
|
+
var share_button_default = ShareButton;
|
|
23
|
+
|
|
24
|
+
exports.share_button_default = share_button_default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCoupons, getAppliedCoupon, applyCoupon, removeCoupon } from './chunk-7M5CVYZJ.js';
|
|
2
2
|
import { pixelEvents } from './chunk-WFDKKOO7.js';
|
|
3
|
-
import { razorpayOrderSuccess, razorpayOrderFail, publicMakeCODOrder, makeCODOrder, stripeOrderSuccess } from './chunk-
|
|
3
|
+
import { razorpayOrderSuccess, razorpayOrderFail, publicMakeCODOrder, makeCODOrder, stripeOrderSuccess } from './chunk-UVU7H4E6.js';
|
|
4
4
|
import { getCloudFront } from './chunk-JQMLHRWL.js';
|
|
5
5
|
import { AxiosError } from 'axios';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { updateCart, removeFromCart, addToCart, getCart } from './chunk-U25T7M6S.js';
|
|
2
2
|
import { cart_default } from './chunk-QAC72HKO.js';
|
|
3
|
-
import { updateOrderCustomization } from './chunk-
|
|
3
|
+
import { updateOrderCustomization } from './chunk-UVU7H4E6.js';
|
|
4
4
|
import { auth_default } from './chunk-WEMNXIRS.js';
|
|
5
5
|
import { USER_CRED_TOKEN, USER_CREDENTIALS } from './chunk-BQ256JKN.js';
|
|
6
6
|
import { create } from 'zustand';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkRDUT4W3B_cjs = require('./chunk-RDUT4W3B.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkLJUGNSQQ_cjs = require('./chunk-LJUGNSQQ.cjs');
|
|
5
|
+
var chunkOTMTHA5C_cjs = require('./chunk-OTMTHA5C.cjs');
|
|
5
6
|
var chunkTB72NPRM_cjs = require('./chunk-TB72NPRM.cjs');
|
|
6
7
|
var react = require('react');
|
|
7
8
|
var formik = require('formik');
|
|
@@ -96,7 +97,7 @@ function useAddressForm(options = {}) {
|
|
|
96
97
|
};
|
|
97
98
|
const fetchAddressMeta = async () => {
|
|
98
99
|
try {
|
|
99
|
-
const response = await
|
|
100
|
+
const response = await chunkOTMTHA5C_cjs.getAddressMeta(
|
|
100
101
|
selectedCountry.tld_code
|
|
101
102
|
);
|
|
102
103
|
setAddressMeta(response);
|
|
@@ -146,7 +147,7 @@ function useAddressForm(options = {}) {
|
|
|
146
147
|
}
|
|
147
148
|
formik$1.setValues(addressValues);
|
|
148
149
|
} else {
|
|
149
|
-
const locationData =
|
|
150
|
+
const locationData = chunkLJUGNSQQ_cjs.getCache(locationCacheKey);
|
|
150
151
|
if (locationData) {
|
|
151
152
|
const { country_code = "IN" } = locationData;
|
|
152
153
|
const foundCountry = supportedCountries.find(
|