@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
package/dist/components/index.js
CHANGED
|
@@ -1,684 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { address_form_default as AddressForm } from '../chunk-L43KF3AC.js';
|
|
2
|
+
export { search_dropdown_default as SearchDropdown } from '../chunk-YK4M3SFP.js';
|
|
3
|
+
export { share_button_default as ShareButton } from '../chunk-EGFOTJPC.js';
|
|
4
|
+
export { ShareIcon } from '../chunk-U7EXLQCT.js';
|
|
5
|
+
export { digital_product_download_modal_default as DigitalProductDownloadModal } from '../chunk-NA5GT4D3.js';
|
|
6
|
+
export { ThemeDataInitializer } from '../chunk-BTR3HLL4.js';
|
|
7
|
+
import '../chunk-HSF2D56O.js';
|
|
8
|
+
import '../chunk-6Q7QMPOQ.js';
|
|
3
9
|
import '../chunk-ZGMLOLTC.js';
|
|
4
|
-
import
|
|
10
|
+
import '../chunk-OSM73ETC.js';
|
|
11
|
+
import '../chunk-F45S7UWC.js';
|
|
12
|
+
import '../chunk-5NUDTIQ2.js';
|
|
5
13
|
import '../chunk-ELP23UGF.js';
|
|
6
14
|
import '../chunk-3SYYP3XV.js';
|
|
7
15
|
import '../chunk-WEMNXIRS.js';
|
|
8
16
|
import '../chunk-BQ256JKN.js';
|
|
9
17
|
import '../chunk-JQMLHRWL.js';
|
|
10
|
-
import { forwardRef, useImperativeHandle, useEffect, useState, useRef, useMemo, useCallback } from 'react';
|
|
11
|
-
import clsx from 'clsx';
|
|
12
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
|
-
import Modal from 'react-responsive-modal';
|
|
14
|
-
import 'react-responsive-modal/styles.css';
|
|
15
|
-
|
|
16
|
-
// src/components/search-dropdown/search-dropdown.module.css
|
|
17
|
-
var search_dropdown_default = {};
|
|
18
|
-
function DownChevron({
|
|
19
|
-
width = 24,
|
|
20
|
-
height = 24,
|
|
21
|
-
className
|
|
22
|
-
}) {
|
|
23
|
-
return /* @__PURE__ */ jsx(
|
|
24
|
-
"svg",
|
|
25
|
-
{
|
|
26
|
-
fill: "currentColor",
|
|
27
|
-
height,
|
|
28
|
-
width,
|
|
29
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
30
|
-
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
31
|
-
viewBox: "0 0 407.437 407.437",
|
|
32
|
-
xmlSpace: "preserve",
|
|
33
|
-
className,
|
|
34
|
-
children: /* @__PURE__ */ jsx(
|
|
35
|
-
"polygon",
|
|
36
|
-
{
|
|
37
|
-
points: "386.258,91.567 203.718,273.512 21.179,91.567 0,112.815 203.718,315.87 407.437,112.815 ",
|
|
38
|
-
strokeWidth: "2"
|
|
39
|
-
}
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
function SearchIcon({
|
|
45
|
-
width = 24,
|
|
46
|
-
height = 24,
|
|
47
|
-
className
|
|
48
|
-
}) {
|
|
49
|
-
return /* @__PURE__ */ jsxs(
|
|
50
|
-
"svg",
|
|
51
|
-
{
|
|
52
|
-
width,
|
|
53
|
-
height,
|
|
54
|
-
viewBox: "0 0 24 24",
|
|
55
|
-
fill: "none",
|
|
56
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
57
|
-
className,
|
|
58
|
-
children: [
|
|
59
|
-
/* @__PURE__ */ jsx(
|
|
60
|
-
"path",
|
|
61
|
-
{
|
|
62
|
-
d: "M17.5 17.5L22 22",
|
|
63
|
-
stroke: "currentColor",
|
|
64
|
-
strokeWidth: "1.5",
|
|
65
|
-
strokeLinecap: "round",
|
|
66
|
-
strokeLinejoin: "round"
|
|
67
|
-
}
|
|
68
|
-
),
|
|
69
|
-
/* @__PURE__ */ jsx(
|
|
70
|
-
"path",
|
|
71
|
-
{
|
|
72
|
-
d: "M20 11C20 6.02944 15.9706 2 11 2C6.02944 2 2 6.02944 2 11C2 15.9706 6.02944 20 11 20C15.9706 20 20 15.9706 20 11Z",
|
|
73
|
-
stroke: "currentColor",
|
|
74
|
-
strokeWidth: "1.5",
|
|
75
|
-
strokeLinejoin: "round"
|
|
76
|
-
}
|
|
77
|
-
)
|
|
78
|
-
]
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
var SearchDropdown = ({
|
|
83
|
-
options,
|
|
84
|
-
value,
|
|
85
|
-
onChange,
|
|
86
|
-
placeholder = "Select an option",
|
|
87
|
-
searchPlaceholder = "Search...",
|
|
88
|
-
className,
|
|
89
|
-
disabled = false,
|
|
90
|
-
error,
|
|
91
|
-
label,
|
|
92
|
-
name,
|
|
93
|
-
renderOption,
|
|
94
|
-
renderSelected,
|
|
95
|
-
filterFunction,
|
|
96
|
-
emptyMessage = "No options found",
|
|
97
|
-
maxHeight = "300px"
|
|
98
|
-
}) => {
|
|
99
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
100
|
-
const [searchTerm, setSearchTerm] = useState("");
|
|
101
|
-
const [focusedIndex, setFocusedIndex] = useState(-1);
|
|
102
|
-
const dropdownRef = useRef(null);
|
|
103
|
-
const searchInputRef = useRef(null);
|
|
104
|
-
const optionsListRef = useRef(null);
|
|
105
|
-
const selectedOption = useMemo(
|
|
106
|
-
() => options.find((opt) => opt.value === value) || null,
|
|
107
|
-
[options, value]
|
|
108
|
-
);
|
|
109
|
-
const defaultFilter = useCallback(
|
|
110
|
-
(option, term) => {
|
|
111
|
-
return option.label.toLowerCase().includes(term.toLowerCase());
|
|
112
|
-
},
|
|
113
|
-
[]
|
|
114
|
-
);
|
|
115
|
-
const filter = filterFunction || defaultFilter;
|
|
116
|
-
const filteredOptions = useMemo(() => {
|
|
117
|
-
if (!searchTerm.trim()) return options;
|
|
118
|
-
return options.filter((option) => filter(option, searchTerm));
|
|
119
|
-
}, [options, searchTerm, filter]);
|
|
120
|
-
useEffect(() => {
|
|
121
|
-
function handleClickOutside(event) {
|
|
122
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
123
|
-
setIsOpen(false);
|
|
124
|
-
setSearchTerm("");
|
|
125
|
-
setFocusedIndex(-1);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (isOpen) {
|
|
129
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
130
|
-
setTimeout(() => {
|
|
131
|
-
searchInputRef.current?.focus();
|
|
132
|
-
}, 0);
|
|
133
|
-
}
|
|
134
|
-
return () => {
|
|
135
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
136
|
-
};
|
|
137
|
-
}, [isOpen]);
|
|
138
|
-
const handleSelect = useCallback(
|
|
139
|
-
(option) => {
|
|
140
|
-
if (option.disabled) return;
|
|
141
|
-
onChange?.(option.value, option);
|
|
142
|
-
setIsOpen(false);
|
|
143
|
-
setSearchTerm("");
|
|
144
|
-
setFocusedIndex(-1);
|
|
145
|
-
},
|
|
146
|
-
[onChange]
|
|
147
|
-
);
|
|
148
|
-
useEffect(() => {
|
|
149
|
-
function handleKeyDown(event) {
|
|
150
|
-
if (!isOpen) return;
|
|
151
|
-
switch (event.key) {
|
|
152
|
-
case "ArrowDown":
|
|
153
|
-
event.preventDefault();
|
|
154
|
-
setFocusedIndex(
|
|
155
|
-
(prev) => prev < filteredOptions.length - 1 ? prev + 1 : prev
|
|
156
|
-
);
|
|
157
|
-
break;
|
|
158
|
-
case "ArrowUp":
|
|
159
|
-
event.preventDefault();
|
|
160
|
-
setFocusedIndex((prev) => prev > 0 ? prev - 1 : -1);
|
|
161
|
-
break;
|
|
162
|
-
case "Enter":
|
|
163
|
-
event.preventDefault();
|
|
164
|
-
if (focusedIndex >= 0 && focusedIndex < filteredOptions.length) {
|
|
165
|
-
handleSelect(filteredOptions[focusedIndex]);
|
|
166
|
-
}
|
|
167
|
-
break;
|
|
168
|
-
case "Escape":
|
|
169
|
-
event.preventDefault();
|
|
170
|
-
setIsOpen(false);
|
|
171
|
-
setSearchTerm("");
|
|
172
|
-
setFocusedIndex(-1);
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if (isOpen) {
|
|
177
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
178
|
-
}
|
|
179
|
-
return () => {
|
|
180
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
181
|
-
};
|
|
182
|
-
}, [isOpen, filteredOptions, focusedIndex, handleSelect]);
|
|
183
|
-
useEffect(() => {
|
|
184
|
-
if (focusedIndex >= 0 && optionsListRef.current) {
|
|
185
|
-
const focusedElement = optionsListRef.current.children[focusedIndex];
|
|
186
|
-
if (focusedElement) {
|
|
187
|
-
focusedElement.scrollIntoView({
|
|
188
|
-
behavior: "smooth",
|
|
189
|
-
block: "nearest"
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}, [focusedIndex]);
|
|
194
|
-
const handleToggle = () => {
|
|
195
|
-
if (disabled) return;
|
|
196
|
-
setIsOpen((prev) => !prev);
|
|
197
|
-
if (!isOpen) {
|
|
198
|
-
setSearchTerm("");
|
|
199
|
-
setFocusedIndex(-1);
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
const handleSearchChange = (e) => {
|
|
203
|
-
setSearchTerm(e.target.value);
|
|
204
|
-
setFocusedIndex(-1);
|
|
205
|
-
};
|
|
206
|
-
const handleOptionMouseEnter = (index) => {
|
|
207
|
-
setFocusedIndex(index);
|
|
208
|
-
};
|
|
209
|
-
return /* @__PURE__ */ jsxs(
|
|
210
|
-
"div",
|
|
211
|
-
{
|
|
212
|
-
ref: dropdownRef,
|
|
213
|
-
className: clsx(search_dropdown_default.searchDropdown, className, {
|
|
214
|
-
[search_dropdown_default.disabled]: disabled,
|
|
215
|
-
[search_dropdown_default.error]: error,
|
|
216
|
-
[search_dropdown_default.open]: isOpen
|
|
217
|
-
}),
|
|
218
|
-
children: [
|
|
219
|
-
label && /* @__PURE__ */ jsx("label", { className: search_dropdown_default.label, htmlFor: name, children: label }),
|
|
220
|
-
/* @__PURE__ */ jsxs("div", { className: search_dropdown_default.dropdownContainer, children: [
|
|
221
|
-
/* @__PURE__ */ jsxs(
|
|
222
|
-
"button",
|
|
223
|
-
{
|
|
224
|
-
type: "button",
|
|
225
|
-
className: search_dropdown_default.dropdownButton,
|
|
226
|
-
onClick: handleToggle,
|
|
227
|
-
disabled,
|
|
228
|
-
"aria-expanded": isOpen,
|
|
229
|
-
"aria-haspopup": "listbox",
|
|
230
|
-
"aria-label": label || placeholder,
|
|
231
|
-
id: name,
|
|
232
|
-
children: [
|
|
233
|
-
/* @__PURE__ */ jsx("span", { className: search_dropdown_default.selectedValue, children: selectedOption ? renderSelected ? renderSelected(selectedOption) : selectedOption.label : placeholder }),
|
|
234
|
-
/* @__PURE__ */ jsx(
|
|
235
|
-
DownChevron,
|
|
236
|
-
{
|
|
237
|
-
width: 16,
|
|
238
|
-
height: 16,
|
|
239
|
-
className: clsx(search_dropdown_default.chevron, {
|
|
240
|
-
[search_dropdown_default.chevronOpen]: isOpen
|
|
241
|
-
})
|
|
242
|
-
}
|
|
243
|
-
)
|
|
244
|
-
]
|
|
245
|
-
}
|
|
246
|
-
),
|
|
247
|
-
isOpen && /* @__PURE__ */ jsxs("div", { className: search_dropdown_default.dropdownMenu, style: { maxHeight }, children: [
|
|
248
|
-
/* @__PURE__ */ jsxs("div", { className: search_dropdown_default.searchContainer, children: [
|
|
249
|
-
/* @__PURE__ */ jsx(
|
|
250
|
-
SearchIcon,
|
|
251
|
-
{
|
|
252
|
-
width: 16,
|
|
253
|
-
height: 16,
|
|
254
|
-
className: search_dropdown_default.searchIcon
|
|
255
|
-
}
|
|
256
|
-
),
|
|
257
|
-
/* @__PURE__ */ jsx(
|
|
258
|
-
"input",
|
|
259
|
-
{
|
|
260
|
-
ref: searchInputRef,
|
|
261
|
-
type: "text",
|
|
262
|
-
className: search_dropdown_default.searchInput,
|
|
263
|
-
placeholder: searchPlaceholder,
|
|
264
|
-
value: searchTerm,
|
|
265
|
-
onChange: handleSearchChange,
|
|
266
|
-
onClick: (e) => e.stopPropagation(),
|
|
267
|
-
onKeyDown: (e) => {
|
|
268
|
-
if (e.key === "Enter" && filteredOptions.length === 1) {
|
|
269
|
-
e.preventDefault();
|
|
270
|
-
handleSelect(filteredOptions[0]);
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
autoComplete: "off"
|
|
274
|
-
}
|
|
275
|
-
)
|
|
276
|
-
] }),
|
|
277
|
-
/* @__PURE__ */ jsx(
|
|
278
|
-
"ul",
|
|
279
|
-
{
|
|
280
|
-
ref: optionsListRef,
|
|
281
|
-
className: search_dropdown_default.optionsList,
|
|
282
|
-
role: "listbox",
|
|
283
|
-
children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => /* @__PURE__ */ jsx(
|
|
284
|
-
"li",
|
|
285
|
-
{
|
|
286
|
-
className: clsx(search_dropdown_default.option, {
|
|
287
|
-
[search_dropdown_default.optionSelected]: option.value === value,
|
|
288
|
-
[search_dropdown_default.optionFocused]: index === focusedIndex,
|
|
289
|
-
[search_dropdown_default.optionDisabled]: option.disabled
|
|
290
|
-
}),
|
|
291
|
-
onClick: () => handleSelect(option),
|
|
292
|
-
onMouseEnter: () => handleOptionMouseEnter(index),
|
|
293
|
-
role: "option",
|
|
294
|
-
"aria-selected": option.value === value,
|
|
295
|
-
children: renderOption ? renderOption(option) : option.label
|
|
296
|
-
},
|
|
297
|
-
option.value
|
|
298
|
-
)) : /* @__PURE__ */ jsx("li", { className: search_dropdown_default.emptyMessage, children: emptyMessage })
|
|
299
|
-
}
|
|
300
|
-
)
|
|
301
|
-
] })
|
|
302
|
-
] }),
|
|
303
|
-
error && /* @__PURE__ */ jsx("span", { className: search_dropdown_default.errorMessage, children: error })
|
|
304
|
-
]
|
|
305
|
-
}
|
|
306
|
-
);
|
|
307
|
-
};
|
|
308
|
-
var search_dropdown_default2 = SearchDropdown;
|
|
309
|
-
|
|
310
|
-
// src/components/address-form/address-form.module.css
|
|
311
|
-
var address_form_default = {};
|
|
312
|
-
var AddressForm = forwardRef(
|
|
313
|
-
({
|
|
314
|
-
address,
|
|
315
|
-
onSuccess,
|
|
316
|
-
onError,
|
|
317
|
-
locationCacheKey,
|
|
318
|
-
defaultCountryId,
|
|
319
|
-
renderButton,
|
|
320
|
-
onFormikReady,
|
|
321
|
-
onCancel,
|
|
322
|
-
showCancel = true,
|
|
323
|
-
showDefaultCheckbox = true,
|
|
324
|
-
className,
|
|
325
|
-
submitLabel = "Save"
|
|
326
|
-
}, ref) => {
|
|
327
|
-
const {
|
|
328
|
-
formik,
|
|
329
|
-
states,
|
|
330
|
-
supportedCountries,
|
|
331
|
-
selectedCountry,
|
|
332
|
-
countryCodeOptions,
|
|
333
|
-
addressMeta,
|
|
334
|
-
handlePhoneCountryChange,
|
|
335
|
-
handleCountryCodeChange,
|
|
336
|
-
handlePhoneChange,
|
|
337
|
-
isSubmitting,
|
|
338
|
-
isEditing
|
|
339
|
-
} = useAddressForm({
|
|
340
|
-
address,
|
|
341
|
-
onSuccess,
|
|
342
|
-
onError,
|
|
343
|
-
locationCacheKey,
|
|
344
|
-
defaultCountryId
|
|
345
|
-
});
|
|
346
|
-
useImperativeHandle(
|
|
347
|
-
ref,
|
|
348
|
-
() => ({
|
|
349
|
-
formik,
|
|
350
|
-
resetForm: () => formik.resetForm()
|
|
351
|
-
}),
|
|
352
|
-
[formik]
|
|
353
|
-
);
|
|
354
|
-
useEffect(() => {
|
|
355
|
-
onFormikReady?.(formik);
|
|
356
|
-
}, [formik, onFormikReady]);
|
|
357
|
-
return /* @__PURE__ */ jsxs(
|
|
358
|
-
"form",
|
|
359
|
-
{
|
|
360
|
-
name: "address-form",
|
|
361
|
-
className: `${address_form_default.addressForm} ${className || ""}`,
|
|
362
|
-
onSubmit: formik.handleSubmit,
|
|
363
|
-
children: [
|
|
364
|
-
/* @__PURE__ */ jsxs("div", { className: address_form_default.formBody, children: [
|
|
365
|
-
/* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
|
|
366
|
-
/* @__PURE__ */ jsx("label", { children: "Name *" }),
|
|
367
|
-
/* @__PURE__ */ jsx(
|
|
368
|
-
"input",
|
|
369
|
-
{
|
|
370
|
-
className: address_form_default.formControl,
|
|
371
|
-
type: "text",
|
|
372
|
-
placeholder: "Name",
|
|
373
|
-
"aria-label": "name",
|
|
374
|
-
autoFocus: true,
|
|
375
|
-
...formik.getFieldProps("customer_name")
|
|
376
|
-
}
|
|
377
|
-
),
|
|
378
|
-
formik.touched.customer_name && formik.errors.customer_name && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.customer_name })
|
|
379
|
-
] }),
|
|
380
|
-
/* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
|
|
381
|
-
/* @__PURE__ */ jsx("label", { children: "Email *" }),
|
|
382
|
-
/* @__PURE__ */ jsx(
|
|
383
|
-
"input",
|
|
384
|
-
{
|
|
385
|
-
className: address_form_default.formControl,
|
|
386
|
-
type: "email",
|
|
387
|
-
placeholder: "Email",
|
|
388
|
-
"aria-label": "email",
|
|
389
|
-
...formik.getFieldProps("customer_email")
|
|
390
|
-
}
|
|
391
|
-
),
|
|
392
|
-
formik.touched.customer_email && formik.errors.customer_email && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.customer_email })
|
|
393
|
-
] }),
|
|
394
|
-
/* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
|
|
395
|
-
/* @__PURE__ */ jsx("label", { children: "Phone *" }),
|
|
396
|
-
/* @__PURE__ */ jsxs("div", { className: address_form_default.phoneRow, children: [
|
|
397
|
-
/* @__PURE__ */ jsx("div", { className: address_form_default.phoneCodeCol, children: /* @__PURE__ */ jsx(
|
|
398
|
-
search_dropdown_default2,
|
|
399
|
-
{
|
|
400
|
-
options: countryCodeOptions,
|
|
401
|
-
value: formik.values.customer_country_code,
|
|
402
|
-
onChange: handlePhoneCountryChange,
|
|
403
|
-
placeholder: "Country",
|
|
404
|
-
searchPlaceholder: "Search country...",
|
|
405
|
-
maxHeight: "250px"
|
|
406
|
-
}
|
|
407
|
-
) }),
|
|
408
|
-
/* @__PURE__ */ jsx("div", { className: address_form_default.phoneInputCol, children: /* @__PURE__ */ jsx(
|
|
409
|
-
"input",
|
|
410
|
-
{
|
|
411
|
-
className: address_form_default.formControl,
|
|
412
|
-
type: "tel",
|
|
413
|
-
placeholder: "Phone",
|
|
414
|
-
"aria-label": "phone",
|
|
415
|
-
name: "customer_phone",
|
|
416
|
-
value: formik.values.customer_phone,
|
|
417
|
-
onBlur: formik.handleBlur,
|
|
418
|
-
onChange: handlePhoneChange
|
|
419
|
-
}
|
|
420
|
-
) })
|
|
421
|
-
] }),
|
|
422
|
-
formik.touched.customer_phone && formik.errors.customer_phone && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.customer_phone })
|
|
423
|
-
] }),
|
|
424
|
-
/* @__PURE__ */ jsx("hr", { className: address_form_default.divider }),
|
|
425
|
-
/* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
|
|
426
|
-
/* @__PURE__ */ jsx("label", { children: "Address (House No, Building, Street, Area) *" }),
|
|
427
|
-
/* @__PURE__ */ jsx(
|
|
428
|
-
"input",
|
|
429
|
-
{
|
|
430
|
-
className: address_form_default.formControl,
|
|
431
|
-
type: "text",
|
|
432
|
-
placeholder: "E.g. 1st Cross, 2nd Main, 3rd Stage",
|
|
433
|
-
"aria-label": "address",
|
|
434
|
-
...formik.getFieldProps("address")
|
|
435
|
-
}
|
|
436
|
-
),
|
|
437
|
-
formik.touched.address && formik.errors.address && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.address })
|
|
438
|
-
] }),
|
|
439
|
-
/* @__PURE__ */ jsxs("div", { className: address_form_default.row, children: [
|
|
440
|
-
/* @__PURE__ */ jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
|
|
441
|
-
/* @__PURE__ */ jsx("label", { className: "text-capitalize", children: "Country *" }),
|
|
442
|
-
/* @__PURE__ */ jsx(
|
|
443
|
-
search_dropdown_default2,
|
|
444
|
-
{
|
|
445
|
-
options: countryCodeOptions,
|
|
446
|
-
value: selectedCountry?.tld_code,
|
|
447
|
-
onChange: handleCountryCodeChange,
|
|
448
|
-
placeholder: "Select country",
|
|
449
|
-
searchPlaceholder: "Search country...",
|
|
450
|
-
maxHeight: "250px",
|
|
451
|
-
name: "country_obj"
|
|
452
|
-
}
|
|
453
|
-
)
|
|
454
|
-
] }) }),
|
|
455
|
-
/* @__PURE__ */ jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
|
|
456
|
-
/* @__PURE__ */ jsxs("label", { style: { textTransform: "capitalize" }, children: [
|
|
457
|
-
addressMeta?.regionLabel || "State",
|
|
458
|
-
" *"
|
|
459
|
-
] }),
|
|
460
|
-
/* @__PURE__ */ jsxs("div", { className: address_form_default.selectWrapper, children: [
|
|
461
|
-
/* @__PURE__ */ jsxs(
|
|
462
|
-
"select",
|
|
463
|
-
{
|
|
464
|
-
className: address_form_default.formControl,
|
|
465
|
-
"aria-label": "state",
|
|
466
|
-
"data-select": "",
|
|
467
|
-
...formik.getFieldProps("state_obj"),
|
|
468
|
-
children: [
|
|
469
|
-
/* @__PURE__ */ jsxs("option", { value: "", children: [
|
|
470
|
-
"Select ",
|
|
471
|
-
addressMeta?.regionLabel || "State"
|
|
472
|
-
] }),
|
|
473
|
-
states.map((state) => /* @__PURE__ */ jsx("option", { value: state.id, children: state.name }, state.id))
|
|
474
|
-
]
|
|
475
|
-
}
|
|
476
|
-
),
|
|
477
|
-
/* @__PURE__ */ jsx("span", { className: address_form_default.selectArrow, children: /* @__PURE__ */ jsx(DownChevron, { width: 12, height: 12 }) })
|
|
478
|
-
] }),
|
|
479
|
-
formik.touched.state_obj && formik.errors.state_obj && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.state_obj })
|
|
480
|
-
] }) })
|
|
481
|
-
] }),
|
|
482
|
-
/* @__PURE__ */ jsxs("div", { className: address_form_default.row, children: [
|
|
483
|
-
addressMeta?.hasPostal && /* @__PURE__ */ jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
|
|
484
|
-
/* @__PURE__ */ jsxs("label", { children: [
|
|
485
|
-
addressMeta?.postalLabel || "Postal Code",
|
|
486
|
-
" *"
|
|
487
|
-
] }),
|
|
488
|
-
/* @__PURE__ */ jsx(
|
|
489
|
-
"input",
|
|
490
|
-
{
|
|
491
|
-
className: address_form_default.formControl,
|
|
492
|
-
type: "tel",
|
|
493
|
-
placeholder: addressMeta?.postalLabel || "Postal Code",
|
|
494
|
-
"aria-label": "pincode",
|
|
495
|
-
...formik.getFieldProps("pincode")
|
|
496
|
-
}
|
|
497
|
-
),
|
|
498
|
-
formik.touched.pincode && formik.errors.pincode && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.pincode })
|
|
499
|
-
] }) }),
|
|
500
|
-
/* @__PURE__ */ jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
|
|
501
|
-
/* @__PURE__ */ jsx("label", { children: "City/District *" }),
|
|
502
|
-
/* @__PURE__ */ jsx(
|
|
503
|
-
"input",
|
|
504
|
-
{
|
|
505
|
-
className: address_form_default.formControl,
|
|
506
|
-
type: "text",
|
|
507
|
-
placeholder: "E.g. Kochi, Bangalore",
|
|
508
|
-
"aria-label": "city",
|
|
509
|
-
...formik.getFieldProps("city")
|
|
510
|
-
}
|
|
511
|
-
),
|
|
512
|
-
formik.touched.city && formik.errors.city && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.city })
|
|
513
|
-
] }) })
|
|
514
|
-
] }),
|
|
515
|
-
/* @__PURE__ */ jsx("hr", { className: address_form_default.divider }),
|
|
516
|
-
showDefaultCheckbox && /* @__PURE__ */ jsx("div", { className: address_form_default.formGroup, children: /* @__PURE__ */ jsxs("label", { className: address_form_default.checkboxLabel, children: [
|
|
517
|
-
/* @__PURE__ */ jsx(
|
|
518
|
-
"input",
|
|
519
|
-
{
|
|
520
|
-
type: "checkbox",
|
|
521
|
-
className: address_form_default.checkboxInput,
|
|
522
|
-
checked: formik.values.is_default || false,
|
|
523
|
-
onChange: (e) => {
|
|
524
|
-
formik.setFieldValue("is_default", e.target.checked);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
),
|
|
528
|
-
"Make this your default address"
|
|
529
|
-
] }) })
|
|
530
|
-
] }),
|
|
531
|
-
/* @__PURE__ */ jsxs("div", { className: address_form_default.formFooter, children: [
|
|
532
|
-
showCancel && onCancel && /* @__PURE__ */ jsx(
|
|
533
|
-
"button",
|
|
534
|
-
{
|
|
535
|
-
type: "button",
|
|
536
|
-
className: address_form_default.cancelBtn,
|
|
537
|
-
onClick: onCancel,
|
|
538
|
-
children: "Cancel"
|
|
539
|
-
}
|
|
540
|
-
),
|
|
541
|
-
renderButton ? renderButton({
|
|
542
|
-
type: "submit",
|
|
543
|
-
disabled: !formik.isValid || isSubmitting,
|
|
544
|
-
loading: isSubmitting,
|
|
545
|
-
children: isEditing ? submitLabel : submitLabel
|
|
546
|
-
}) : /* @__PURE__ */ jsx(
|
|
547
|
-
"button",
|
|
548
|
-
{
|
|
549
|
-
type: "submit",
|
|
550
|
-
disabled: !formik.isValid || isSubmitting,
|
|
551
|
-
className: address_form_default.formControl,
|
|
552
|
-
style: {
|
|
553
|
-
width: "auto",
|
|
554
|
-
cursor: !formik.isValid || isSubmitting ? "not-allowed" : "pointer",
|
|
555
|
-
backgroundColor: "var(--primary, #003d29)",
|
|
556
|
-
color: "var(--btn-text, #fff)",
|
|
557
|
-
border: "none",
|
|
558
|
-
padding: "0.5rem 1.5rem",
|
|
559
|
-
opacity: !formik.isValid || isSubmitting ? 0.6 : 1
|
|
560
|
-
},
|
|
561
|
-
children: isSubmitting ? "Saving..." : submitLabel
|
|
562
|
-
}
|
|
563
|
-
)
|
|
564
|
-
] })
|
|
565
|
-
]
|
|
566
|
-
}
|
|
567
|
-
);
|
|
568
|
-
}
|
|
569
|
-
);
|
|
570
|
-
AddressForm.displayName = "AddressForm";
|
|
571
|
-
var address_form_default2 = AddressForm;
|
|
572
|
-
function ShareIcon({
|
|
573
|
-
width = 20,
|
|
574
|
-
height = 23,
|
|
575
|
-
className
|
|
576
|
-
}) {
|
|
577
|
-
return /* @__PURE__ */ jsx(
|
|
578
|
-
"svg",
|
|
579
|
-
{
|
|
580
|
-
width,
|
|
581
|
-
height,
|
|
582
|
-
viewBox: "0 0 20 23",
|
|
583
|
-
fill: "none",
|
|
584
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
585
|
-
className,
|
|
586
|
-
children: /* @__PURE__ */ jsx(
|
|
587
|
-
"path",
|
|
588
|
-
{
|
|
589
|
-
d: "M5.0745 10.357C4.82568 9.90934 4.43524 9.55692 3.96446 9.35513C3.49369 9.15333 2.96923 9.11357 2.47341 9.24209C1.97759 9.37061 1.53848 9.66013 1.22501 10.0652C0.911539 10.4703 0.741455 10.968 0.741455 11.4802C0.741455 11.9924 0.911539 12.4901 1.22501 12.8952C1.53848 13.3003 1.97759 13.5898 2.47341 13.7183C2.96923 13.8469 3.49369 13.8071 3.96446 13.6053C4.43524 13.4035 4.82568 13.0511 5.0745 12.6034M5.0745 10.357C5.25947 10.69 5.36531 11.0723 5.36531 11.4802C5.36531 11.8882 5.25947 12.2715 5.0745 12.6034M5.0745 10.357L14.9045 4.89641M5.0745 12.6034L14.9045 18.064M14.9045 4.89641C15.0486 5.16783 15.2454 5.4078 15.4833 5.60229C15.7213 5.79678 15.9956 5.94187 16.2903 6.0291C16.585 6.11633 16.8941 6.14393 17.1996 6.1103C17.5051 6.07667 17.8008 5.98247 18.0694 5.83323C18.338 5.68398 18.5742 5.48267 18.7642 5.24108C18.9541 4.99948 19.094 4.72244 19.1756 4.42616C19.2572 4.12988 19.279 3.8203 19.2395 3.51552C19.2001 3.21074 19.1003 2.91687 18.946 2.65111C18.6419 2.12739 18.1445 1.74388 17.5606 1.58304C16.9768 1.4222 16.3531 1.49685 15.8237 1.79096C15.2943 2.08507 14.9014 2.57515 14.7295 3.15586C14.5577 3.73656 14.6205 4.36152 14.9045 4.89641ZM14.9045 18.064C14.757 18.3295 14.6632 18.6215 14.6286 18.9232C14.5939 19.225 14.619 19.5306 14.7025 19.8226C14.7859 20.1146 14.9261 20.3874 15.1149 20.6253C15.3038 20.8631 15.5376 21.0615 15.8031 21.209C16.0686 21.3565 16.3606 21.4502 16.6623 21.4849C16.9641 21.5196 17.2697 21.4944 17.5617 21.411C17.8537 21.3276 18.1265 21.1874 18.3644 20.9986C18.6022 20.8097 18.8006 20.5758 18.9481 20.3103C19.246 19.7741 19.3186 19.1415 19.1501 18.5517C18.9816 17.962 18.5857 17.4633 18.0494 17.1654C17.5132 16.8675 16.8806 16.7948 16.2908 16.9634C15.7011 17.1319 15.2024 17.5278 14.9045 18.064Z",
|
|
590
|
-
stroke: "currentColor",
|
|
591
|
-
strokeWidth: "1.5",
|
|
592
|
-
strokeLinecap: "round",
|
|
593
|
-
strokeLinejoin: "round"
|
|
594
|
-
}
|
|
595
|
-
)
|
|
596
|
-
}
|
|
597
|
-
);
|
|
598
|
-
}
|
|
599
|
-
var ShareButton = ({
|
|
600
|
-
product,
|
|
601
|
-
className = "flex space-x-2 items-center hover:text-textSecondary transition-all duration-100",
|
|
602
|
-
iconSize = 22
|
|
603
|
-
}) => {
|
|
604
|
-
const _handleShare = () => {
|
|
605
|
-
shareLink(
|
|
606
|
-
`Buy ${product.name} at ${convertToCurrency(
|
|
607
|
-
Number(product.selling_price)
|
|
608
|
-
)}`,
|
|
609
|
-
product.name
|
|
610
|
-
);
|
|
611
|
-
};
|
|
612
|
-
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 }) }) });
|
|
613
|
-
};
|
|
614
|
-
var share_button_default = ShareButton;
|
|
615
|
-
var checkIfLimitReached = (attribute) => {
|
|
616
|
-
return isExpired(attribute.expiry_date) || attribute.download_count === 0;
|
|
617
|
-
};
|
|
618
|
-
var DigitalProductDownloadModal = ({ open, onClose, product, downloadAttribute, onDownload, loading }) => {
|
|
619
|
-
return /* @__PURE__ */ jsx(
|
|
620
|
-
Modal,
|
|
621
|
-
{
|
|
622
|
-
classNames: {
|
|
623
|
-
modal: "modal modal-lg modal-confirm",
|
|
624
|
-
closeButton: "modal-close"
|
|
625
|
-
},
|
|
626
|
-
open,
|
|
627
|
-
onClose,
|
|
628
|
-
center: true,
|
|
629
|
-
closeIcon: null,
|
|
630
|
-
children: /* @__PURE__ */ jsxs("div", { className: "modal-body px-4 py-2", children: [
|
|
631
|
-
/* @__PURE__ */ jsxs("span", { className: "text-2xl block mb-2 fw-regular", children: [
|
|
632
|
-
"Download links for ",
|
|
633
|
-
product?.product_name
|
|
634
|
-
] }),
|
|
635
|
-
/* @__PURE__ */ jsx("hr", { className: "mb-4 mt-2" }),
|
|
636
|
-
/* @__PURE__ */ jsx("div", { className: "download-links", children: loading ? Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsx("div", { className: "w-100 rounded-1 mb-3", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
637
|
-
/* @__PURE__ */ jsxs("div", { className: "w-100", children: [
|
|
638
|
-
/* @__PURE__ */ jsx("div", { className: "shine line w-75" }),
|
|
639
|
-
/* @__PURE__ */ jsx("div", { className: "shine line w-50 mt-2" })
|
|
640
|
-
] }),
|
|
641
|
-
/* @__PURE__ */ jsx("div", { className: "shine w-160 h-32 rounded-1" })
|
|
642
|
-
] }) }, index)) : downloadAttribute.map((attribute, index) => /* @__PURE__ */ jsxs(
|
|
643
|
-
"div",
|
|
644
|
-
{
|
|
645
|
-
className: "flex items-center justify-between mt-3",
|
|
646
|
-
children: [
|
|
647
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
648
|
-
/* @__PURE__ */ jsxs("span", { className: "block text-md lh-1", children: [
|
|
649
|
-
"Download link ",
|
|
650
|
-
index + 1
|
|
651
|
-
] }),
|
|
652
|
-
checkIfLimitReached(attribute) ? /* @__PURE__ */ jsx("span", { className: "text-danger text-sm lh-1", children: "Download link expired." }) : /* @__PURE__ */ jsxs("span", { className: "text-textSecondary text-sm lh-1", children: [
|
|
653
|
-
"Remaining tries: ",
|
|
654
|
-
attribute.download_count,
|
|
655
|
-
" ",
|
|
656
|
-
"\u2022\xA0 Expires",
|
|
657
|
-
" ",
|
|
658
|
-
timeFromNow(attribute.expiry_date)
|
|
659
|
-
] })
|
|
660
|
-
] }),
|
|
661
|
-
/* @__PURE__ */ jsx(
|
|
662
|
-
"button",
|
|
663
|
-
{
|
|
664
|
-
className: "btn btn-text btn-medium",
|
|
665
|
-
onClick: () => onDownload(attribute),
|
|
666
|
-
disabled: checkIfLimitReached(attribute),
|
|
667
|
-
children: "Download"
|
|
668
|
-
}
|
|
669
|
-
)
|
|
670
|
-
]
|
|
671
|
-
},
|
|
672
|
-
`${attribute.download_link}-${index}`
|
|
673
|
-
)) }),
|
|
674
|
-
/* @__PURE__ */ jsxs("p", { className: "text-textSecondary text-sm fw-regular p-2 bg-warning-light rounded-2 mt-4", children: [
|
|
675
|
-
/* @__PURE__ */ jsx("strong", { className: "text-textSecondary", children: "Warning:" }),
|
|
676
|
-
" The download link is time-sensitive and will expire after a set period. You are limited to a specific number of download attempts, with each attempt reducing the remaining tries. To avoid any disruptions, please ensure a stable internet connection before proceeding with the download."
|
|
677
|
-
] })
|
|
678
|
-
] })
|
|
679
|
-
}
|
|
680
|
-
);
|
|
681
|
-
};
|
|
682
|
-
var digital_product_download_modal_default = DigitalProductDownloadModal;
|
|
683
|
-
|
|
684
|
-
export { address_form_default2 as AddressForm, digital_product_download_modal_default as DigitalProductDownloadModal, search_dropdown_default2 as SearchDropdown, share_button_default as ShareButton, ShareIcon };
|