@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.
Files changed (80) hide show
  1. package/dist/address-DQEZzyUG.d.cts +19 -0
  2. package/dist/address-DQEZzyUG.d.ts +19 -0
  3. package/dist/api/index.cjs +367 -0
  4. package/dist/api/index.d.cts +127 -0
  5. package/dist/api/index.d.ts +127 -0
  6. package/dist/api/index.js +131 -0
  7. package/dist/booking-ClX-dhX7.d.ts +131 -0
  8. package/dist/booking-Drl7-IL7.d.cts +131 -0
  9. package/dist/cart-DVrn8hD0.d.cts +367 -0
  10. package/dist/cart-DVrn8hD0.d.ts +367 -0
  11. package/dist/checkout/index.cjs +228 -0
  12. package/dist/checkout/index.d.cts +251 -0
  13. package/dist/checkout/index.d.ts +251 -0
  14. package/dist/checkout/index.js +122 -0
  15. package/dist/chunk-4CVKE6CC.cjs +312 -0
  16. package/dist/chunk-4MJMNIAB.js +123 -0
  17. package/dist/chunk-57ZBPAXU.js +114 -0
  18. package/dist/chunk-7MQOVWLW.js +40 -0
  19. package/dist/chunk-7UH6REGV.js +12 -0
  20. package/dist/chunk-A6IO3HIN.cjs +151 -0
  21. package/dist/chunk-CFF632IQ.cjs +100 -0
  22. package/dist/chunk-CSISWBZZ.js +121 -0
  23. package/dist/chunk-E7WPE3PV.js +98 -0
  24. package/dist/chunk-FLBJKM6G.js +83 -0
  25. package/dist/chunk-GB3HW6DM.js +61 -0
  26. package/dist/chunk-GH75WUO2.cjs +42 -0
  27. package/dist/chunk-GQTO5ZE2.cjs +96 -0
  28. package/dist/chunk-JHGXIIBZ.cjs +37 -0
  29. package/dist/chunk-JQMLHRWL.js +21 -0
  30. package/dist/chunk-K44JZ5NL.cjs +212 -0
  31. package/dist/chunk-K5B62JZO.cjs +154 -0
  32. package/dist/chunk-KWKHHRRJ.cjs +15 -0
  33. package/dist/chunk-LBGIUNM6.js +30 -0
  34. package/dist/chunk-LC5ZAUKL.cjs +220 -0
  35. package/dist/chunk-N3CTXRFT.cjs +30 -0
  36. package/dist/chunk-QCQCFYYR.js +206 -0
  37. package/dist/chunk-QM73PI5L.cjs +218 -0
  38. package/dist/chunk-RCXQJ6XC.cjs +131 -0
  39. package/dist/chunk-UM24VDYB.js +216 -0
  40. package/dist/chunk-UXLUE3HW.cjs +69 -0
  41. package/dist/chunk-WFDKKOO7.js +210 -0
  42. package/dist/chunk-YUPBTD4M.js +289 -0
  43. package/dist/components/index.cjs +576 -0
  44. package/dist/components/index.css +329 -0
  45. package/dist/components/index.d.cts +58 -0
  46. package/dist/components/index.d.ts +58 -0
  47. package/dist/components/index.js +569 -0
  48. package/dist/coupons-C7iJ-1cy.d.cts +37 -0
  49. package/dist/coupons-CnfTKL1i.d.ts +37 -0
  50. package/dist/hooks/index.cjs +381 -0
  51. package/dist/hooks/index.d.cts +123 -0
  52. package/dist/hooks/index.d.ts +123 -0
  53. package/dist/hooks/index.js +364 -0
  54. package/dist/index-DTyIuLuI.d.cts +18 -0
  55. package/dist/index-DTyIuLuI.d.ts +18 -0
  56. package/dist/index.cjs +14 -0
  57. package/dist/index.d.cts +1 -0
  58. package/dist/index.d.ts +1 -0
  59. package/dist/index.js +1 -0
  60. package/dist/models/index.cjs +2 -0
  61. package/dist/models/index.d.cts +53 -0
  62. package/dist/models/index.d.ts +53 -0
  63. package/dist/models/index.js +1 -0
  64. package/dist/orders-CkUzv5Xh.d.ts +159 -0
  65. package/dist/orders-D0oC9ugD.d.cts +159 -0
  66. package/dist/phonepe-D7vn-9SR.d.cts +27 -0
  67. package/dist/phonepe-D7vn-9SR.d.ts +27 -0
  68. package/dist/store/index.cjs +149 -0
  69. package/dist/store/index.d.cts +46 -0
  70. package/dist/store/index.d.ts +46 -0
  71. package/dist/store/index.js +141 -0
  72. package/dist/useAddressForm-C-Uzug4d.d.ts +42 -0
  73. package/dist/useAddressForm-DgkCP1nG.d.cts +42 -0
  74. package/dist/utils/index.cjs +535 -0
  75. package/dist/utils/index.d.cts +507 -0
  76. package/dist/utils/index.d.ts +507 -0
  77. package/dist/utils/index.js +342 -0
  78. package/dist/wishlist-BzhnCAQD.d.ts +41 -0
  79. package/dist/wishlist-CBCZD66Y.d.cts +41 -0
  80. package/package.json +134 -0
@@ -0,0 +1,569 @@
1
+ import { useAddressForm } from '../chunk-UM24VDYB.js';
2
+ import '../chunk-LBGIUNM6.js';
3
+ import '../chunk-YUPBTD4M.js';
4
+ import '../chunk-CSISWBZZ.js';
5
+ import '../chunk-GB3HW6DM.js';
6
+ import '../chunk-FLBJKM6G.js';
7
+ import '../chunk-JQMLHRWL.js';
8
+ import { forwardRef, useImperativeHandle, useEffect, useState, useRef, useMemo, useCallback } from 'react';
9
+ import clsx from 'clsx';
10
+ import { jsxs, jsx } from 'react/jsx-runtime';
11
+
12
+ // src/components/search-dropdown/search-dropdown.module.css
13
+ var search_dropdown_default = {};
14
+ function DownChevron({
15
+ width = 24,
16
+ height = 24,
17
+ className
18
+ }) {
19
+ return /* @__PURE__ */ jsx(
20
+ "svg",
21
+ {
22
+ fill: "currentColor",
23
+ height,
24
+ width,
25
+ xmlns: "http://www.w3.org/2000/svg",
26
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
27
+ viewBox: "0 0 407.437 407.437",
28
+ xmlSpace: "preserve",
29
+ className,
30
+ children: /* @__PURE__ */ jsx(
31
+ "polygon",
32
+ {
33
+ points: "386.258,91.567 203.718,273.512 21.179,91.567 0,112.815 203.718,315.87 407.437,112.815 ",
34
+ strokeWidth: "2"
35
+ }
36
+ )
37
+ }
38
+ );
39
+ }
40
+ function SearchIcon({
41
+ width = 24,
42
+ height = 24,
43
+ className
44
+ }) {
45
+ return /* @__PURE__ */ jsxs(
46
+ "svg",
47
+ {
48
+ width,
49
+ height,
50
+ viewBox: "0 0 24 24",
51
+ fill: "none",
52
+ xmlns: "http://www.w3.org/2000/svg",
53
+ className,
54
+ children: [
55
+ /* @__PURE__ */ jsx(
56
+ "path",
57
+ {
58
+ d: "M17.5 17.5L22 22",
59
+ stroke: "currentColor",
60
+ strokeWidth: "1.5",
61
+ strokeLinecap: "round",
62
+ strokeLinejoin: "round"
63
+ }
64
+ ),
65
+ /* @__PURE__ */ jsx(
66
+ "path",
67
+ {
68
+ 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",
69
+ stroke: "currentColor",
70
+ strokeWidth: "1.5",
71
+ strokeLinejoin: "round"
72
+ }
73
+ )
74
+ ]
75
+ }
76
+ );
77
+ }
78
+ var SearchDropdown = ({
79
+ options,
80
+ value,
81
+ onChange,
82
+ placeholder = "Select an option",
83
+ searchPlaceholder = "Search...",
84
+ className,
85
+ disabled = false,
86
+ error,
87
+ label,
88
+ name,
89
+ renderOption,
90
+ renderSelected,
91
+ filterFunction,
92
+ emptyMessage = "No options found",
93
+ maxHeight = "300px"
94
+ }) => {
95
+ const [isOpen, setIsOpen] = useState(false);
96
+ const [searchTerm, setSearchTerm] = useState("");
97
+ const [focusedIndex, setFocusedIndex] = useState(-1);
98
+ const dropdownRef = useRef(null);
99
+ const searchInputRef = useRef(null);
100
+ const optionsListRef = useRef(null);
101
+ const selectedOption = useMemo(
102
+ () => options.find((opt) => opt.value === value) || null,
103
+ [options, value]
104
+ );
105
+ const defaultFilter = useCallback(
106
+ (option, term) => {
107
+ return option.label.toLowerCase().includes(term.toLowerCase());
108
+ },
109
+ []
110
+ );
111
+ const filter = filterFunction || defaultFilter;
112
+ const filteredOptions = useMemo(() => {
113
+ if (!searchTerm.trim()) return options;
114
+ return options.filter((option) => filter(option, searchTerm));
115
+ }, [options, searchTerm, filter]);
116
+ useEffect(() => {
117
+ function handleClickOutside(event) {
118
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
119
+ setIsOpen(false);
120
+ setSearchTerm("");
121
+ setFocusedIndex(-1);
122
+ }
123
+ }
124
+ if (isOpen) {
125
+ document.addEventListener("mousedown", handleClickOutside);
126
+ setTimeout(() => {
127
+ searchInputRef.current?.focus();
128
+ }, 0);
129
+ }
130
+ return () => {
131
+ document.removeEventListener("mousedown", handleClickOutside);
132
+ };
133
+ }, [isOpen]);
134
+ const handleSelect = useCallback(
135
+ (option) => {
136
+ if (option.disabled) return;
137
+ onChange?.(option.value, option);
138
+ setIsOpen(false);
139
+ setSearchTerm("");
140
+ setFocusedIndex(-1);
141
+ },
142
+ [onChange]
143
+ );
144
+ useEffect(() => {
145
+ function handleKeyDown(event) {
146
+ if (!isOpen) return;
147
+ switch (event.key) {
148
+ case "ArrowDown":
149
+ event.preventDefault();
150
+ setFocusedIndex(
151
+ (prev) => prev < filteredOptions.length - 1 ? prev + 1 : prev
152
+ );
153
+ break;
154
+ case "ArrowUp":
155
+ event.preventDefault();
156
+ setFocusedIndex((prev) => prev > 0 ? prev - 1 : -1);
157
+ break;
158
+ case "Enter":
159
+ event.preventDefault();
160
+ if (focusedIndex >= 0 && focusedIndex < filteredOptions.length) {
161
+ handleSelect(filteredOptions[focusedIndex]);
162
+ }
163
+ break;
164
+ case "Escape":
165
+ event.preventDefault();
166
+ setIsOpen(false);
167
+ setSearchTerm("");
168
+ setFocusedIndex(-1);
169
+ break;
170
+ }
171
+ }
172
+ if (isOpen) {
173
+ document.addEventListener("keydown", handleKeyDown);
174
+ }
175
+ return () => {
176
+ document.removeEventListener("keydown", handleKeyDown);
177
+ };
178
+ }, [isOpen, filteredOptions, focusedIndex, handleSelect]);
179
+ useEffect(() => {
180
+ if (focusedIndex >= 0 && optionsListRef.current) {
181
+ const focusedElement = optionsListRef.current.children[focusedIndex];
182
+ if (focusedElement) {
183
+ focusedElement.scrollIntoView({
184
+ behavior: "smooth",
185
+ block: "nearest"
186
+ });
187
+ }
188
+ }
189
+ }, [focusedIndex]);
190
+ const handleToggle = () => {
191
+ if (disabled) return;
192
+ setIsOpen((prev) => !prev);
193
+ if (!isOpen) {
194
+ setSearchTerm("");
195
+ setFocusedIndex(-1);
196
+ }
197
+ };
198
+ const handleSearchChange = (e) => {
199
+ setSearchTerm(e.target.value);
200
+ setFocusedIndex(-1);
201
+ };
202
+ const handleOptionMouseEnter = (index) => {
203
+ setFocusedIndex(index);
204
+ };
205
+ return /* @__PURE__ */ jsxs(
206
+ "div",
207
+ {
208
+ ref: dropdownRef,
209
+ className: clsx(search_dropdown_default.searchDropdown, className, {
210
+ [search_dropdown_default.disabled]: disabled,
211
+ [search_dropdown_default.error]: error,
212
+ [search_dropdown_default.open]: isOpen
213
+ }),
214
+ children: [
215
+ label && /* @__PURE__ */ jsx("label", { className: search_dropdown_default.label, htmlFor: name, children: label }),
216
+ /* @__PURE__ */ jsxs("div", { className: search_dropdown_default.dropdownContainer, children: [
217
+ /* @__PURE__ */ jsxs(
218
+ "button",
219
+ {
220
+ type: "button",
221
+ className: search_dropdown_default.dropdownButton,
222
+ onClick: handleToggle,
223
+ disabled,
224
+ "aria-expanded": isOpen,
225
+ "aria-haspopup": "listbox",
226
+ "aria-label": label || placeholder,
227
+ id: name,
228
+ children: [
229
+ /* @__PURE__ */ jsx("span", { className: search_dropdown_default.selectedValue, children: selectedOption ? renderSelected ? renderSelected(selectedOption) : selectedOption.label : placeholder }),
230
+ /* @__PURE__ */ jsx(
231
+ DownChevron,
232
+ {
233
+ width: 16,
234
+ height: 16,
235
+ className: clsx(search_dropdown_default.chevron, {
236
+ [search_dropdown_default.chevronOpen]: isOpen
237
+ })
238
+ }
239
+ )
240
+ ]
241
+ }
242
+ ),
243
+ isOpen && /* @__PURE__ */ jsxs("div", { className: search_dropdown_default.dropdownMenu, style: { maxHeight }, children: [
244
+ /* @__PURE__ */ jsxs("div", { className: search_dropdown_default.searchContainer, children: [
245
+ /* @__PURE__ */ jsx(
246
+ SearchIcon,
247
+ {
248
+ width: 16,
249
+ height: 16,
250
+ className: search_dropdown_default.searchIcon
251
+ }
252
+ ),
253
+ /* @__PURE__ */ jsx(
254
+ "input",
255
+ {
256
+ ref: searchInputRef,
257
+ type: "text",
258
+ className: search_dropdown_default.searchInput,
259
+ placeholder: searchPlaceholder,
260
+ value: searchTerm,
261
+ onChange: handleSearchChange,
262
+ onClick: (e) => e.stopPropagation(),
263
+ onKeyDown: (e) => {
264
+ if (e.key === "Enter" && filteredOptions.length === 1) {
265
+ e.preventDefault();
266
+ handleSelect(filteredOptions[0]);
267
+ }
268
+ },
269
+ autoComplete: "off"
270
+ }
271
+ )
272
+ ] }),
273
+ /* @__PURE__ */ jsx(
274
+ "ul",
275
+ {
276
+ ref: optionsListRef,
277
+ className: search_dropdown_default.optionsList,
278
+ role: "listbox",
279
+ children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => /* @__PURE__ */ jsx(
280
+ "li",
281
+ {
282
+ className: clsx(search_dropdown_default.option, {
283
+ [search_dropdown_default.optionSelected]: option.value === value,
284
+ [search_dropdown_default.optionFocused]: index === focusedIndex,
285
+ [search_dropdown_default.optionDisabled]: option.disabled
286
+ }),
287
+ onClick: () => handleSelect(option),
288
+ onMouseEnter: () => handleOptionMouseEnter(index),
289
+ role: "option",
290
+ "aria-selected": option.value === value,
291
+ children: renderOption ? renderOption(option) : option.label
292
+ },
293
+ option.value
294
+ )) : /* @__PURE__ */ jsx("li", { className: search_dropdown_default.emptyMessage, children: emptyMessage })
295
+ }
296
+ )
297
+ ] })
298
+ ] }),
299
+ error && /* @__PURE__ */ jsx("span", { className: search_dropdown_default.errorMessage, children: error })
300
+ ]
301
+ }
302
+ );
303
+ };
304
+ var search_dropdown_default2 = SearchDropdown;
305
+
306
+ // src/components/address-form/address-form.module.css
307
+ var address_form_default = {};
308
+ var AddressForm = forwardRef(
309
+ ({
310
+ address,
311
+ onSuccess,
312
+ onError,
313
+ locationCacheKey,
314
+ defaultCountryId,
315
+ renderButton,
316
+ onFormikReady,
317
+ onCancel,
318
+ showCancel = true,
319
+ showDefaultCheckbox = true,
320
+ className,
321
+ submitLabel = "Save"
322
+ }, ref) => {
323
+ const {
324
+ formik,
325
+ states,
326
+ supportedCountries,
327
+ selectedCountry,
328
+ countryCodeOptions,
329
+ addressMeta,
330
+ handlePhoneCountryChange,
331
+ handleCountryCodeChange,
332
+ handlePhoneChange,
333
+ isSubmitting,
334
+ isEditing
335
+ } = useAddressForm({
336
+ address,
337
+ onSuccess,
338
+ onError,
339
+ locationCacheKey,
340
+ defaultCountryId
341
+ });
342
+ useImperativeHandle(
343
+ ref,
344
+ () => ({
345
+ formik,
346
+ resetForm: () => formik.resetForm()
347
+ }),
348
+ [formik]
349
+ );
350
+ useEffect(() => {
351
+ onFormikReady?.(formik);
352
+ }, [formik, onFormikReady]);
353
+ return /* @__PURE__ */ jsxs(
354
+ "form",
355
+ {
356
+ name: "address-form",
357
+ className: `${address_form_default.addressForm} ${className || ""}`,
358
+ onSubmit: formik.handleSubmit,
359
+ children: [
360
+ /* @__PURE__ */ jsxs("div", { className: address_form_default.formBody, children: [
361
+ /* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
362
+ /* @__PURE__ */ jsx("label", { children: "Name *" }),
363
+ /* @__PURE__ */ jsx(
364
+ "input",
365
+ {
366
+ className: address_form_default.formControl,
367
+ type: "text",
368
+ placeholder: "Name",
369
+ "aria-label": "name",
370
+ autoFocus: true,
371
+ ...formik.getFieldProps("customer_name")
372
+ }
373
+ ),
374
+ formik.touched.customer_name && formik.errors.customer_name && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.customer_name })
375
+ ] }),
376
+ /* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
377
+ /* @__PURE__ */ jsx("label", { children: "Email *" }),
378
+ /* @__PURE__ */ jsx(
379
+ "input",
380
+ {
381
+ className: address_form_default.formControl,
382
+ type: "email",
383
+ placeholder: "Email",
384
+ "aria-label": "email",
385
+ ...formik.getFieldProps("customer_email")
386
+ }
387
+ ),
388
+ formik.touched.customer_email && formik.errors.customer_email && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.customer_email })
389
+ ] }),
390
+ /* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
391
+ /* @__PURE__ */ jsx("label", { children: "Phone *" }),
392
+ /* @__PURE__ */ jsxs("div", { className: address_form_default.phoneRow, children: [
393
+ /* @__PURE__ */ jsx("div", { className: address_form_default.phoneCodeCol, children: /* @__PURE__ */ jsx(
394
+ search_dropdown_default2,
395
+ {
396
+ options: countryCodeOptions,
397
+ value: formik.values.customer_country_code,
398
+ onChange: handlePhoneCountryChange,
399
+ placeholder: "Country",
400
+ searchPlaceholder: "Search country...",
401
+ maxHeight: "250px"
402
+ }
403
+ ) }),
404
+ /* @__PURE__ */ jsx("div", { className: address_form_default.phoneInputCol, children: /* @__PURE__ */ jsx(
405
+ "input",
406
+ {
407
+ className: address_form_default.formControl,
408
+ type: "tel",
409
+ placeholder: "Phone",
410
+ "aria-label": "phone",
411
+ name: "customer_phone",
412
+ value: formik.values.customer_phone,
413
+ onBlur: formik.handleBlur,
414
+ onChange: handlePhoneChange
415
+ }
416
+ ) })
417
+ ] }),
418
+ formik.touched.customer_phone && formik.errors.customer_phone && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.customer_phone })
419
+ ] }),
420
+ /* @__PURE__ */ jsx("hr", { className: address_form_default.divider }),
421
+ /* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
422
+ /* @__PURE__ */ jsx("label", { children: "Address (House No, Building, Street, Area) *" }),
423
+ /* @__PURE__ */ jsx(
424
+ "input",
425
+ {
426
+ className: address_form_default.formControl,
427
+ type: "text",
428
+ placeholder: "E.g. 1st Cross, 2nd Main, 3rd Stage",
429
+ "aria-label": "address",
430
+ ...formik.getFieldProps("address")
431
+ }
432
+ ),
433
+ formik.touched.address && formik.errors.address && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.address })
434
+ ] }),
435
+ /* @__PURE__ */ jsxs("div", { className: address_form_default.row, children: [
436
+ /* @__PURE__ */ jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
437
+ /* @__PURE__ */ jsx("label", { className: "text-capitalize", children: "Country *" }),
438
+ /* @__PURE__ */ jsx(
439
+ search_dropdown_default2,
440
+ {
441
+ options: countryCodeOptions,
442
+ value: selectedCountry?.tld_code,
443
+ onChange: handleCountryCodeChange,
444
+ placeholder: "Select country",
445
+ searchPlaceholder: "Search country...",
446
+ maxHeight: "250px",
447
+ name: "country_obj"
448
+ }
449
+ )
450
+ ] }) }),
451
+ /* @__PURE__ */ jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
452
+ /* @__PURE__ */ jsxs("label", { style: { textTransform: "capitalize" }, children: [
453
+ addressMeta?.regionLabel || "State",
454
+ " *"
455
+ ] }),
456
+ /* @__PURE__ */ jsxs("div", { className: address_form_default.selectWrapper, children: [
457
+ /* @__PURE__ */ jsxs(
458
+ "select",
459
+ {
460
+ className: address_form_default.formControl,
461
+ "aria-label": "state",
462
+ "data-select": "",
463
+ ...formik.getFieldProps("state_obj"),
464
+ children: [
465
+ /* @__PURE__ */ jsxs("option", { value: "", children: [
466
+ "Select ",
467
+ addressMeta?.regionLabel || "State"
468
+ ] }),
469
+ states.map((state) => /* @__PURE__ */ jsx("option", { value: state.id, children: state.name }, state.id))
470
+ ]
471
+ }
472
+ ),
473
+ /* @__PURE__ */ jsx("span", { className: address_form_default.selectArrow, children: /* @__PURE__ */ jsx(DownChevron, { width: 12, height: 12 }) })
474
+ ] }),
475
+ formik.touched.state_obj && formik.errors.state_obj && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.state_obj })
476
+ ] }) })
477
+ ] }),
478
+ /* @__PURE__ */ jsxs("div", { className: address_form_default.row, children: [
479
+ addressMeta?.hasPostal && /* @__PURE__ */ jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
480
+ /* @__PURE__ */ jsxs("label", { children: [
481
+ addressMeta?.postalLabel || "Postal Code",
482
+ " *"
483
+ ] }),
484
+ /* @__PURE__ */ jsx(
485
+ "input",
486
+ {
487
+ className: address_form_default.formControl,
488
+ type: "tel",
489
+ placeholder: addressMeta?.postalLabel || "Postal Code",
490
+ "aria-label": "pincode",
491
+ ...formik.getFieldProps("pincode")
492
+ }
493
+ ),
494
+ formik.touched.pincode && formik.errors.pincode && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.pincode })
495
+ ] }) }),
496
+ /* @__PURE__ */ jsx("div", { className: address_form_default.col, children: /* @__PURE__ */ jsxs("div", { className: address_form_default.formGroup, children: [
497
+ /* @__PURE__ */ jsx("label", { children: "City/District *" }),
498
+ /* @__PURE__ */ jsx(
499
+ "input",
500
+ {
501
+ className: address_form_default.formControl,
502
+ type: "text",
503
+ placeholder: "E.g. Kochi, Bangalore",
504
+ "aria-label": "city",
505
+ ...formik.getFieldProps("city")
506
+ }
507
+ ),
508
+ formik.touched.city && formik.errors.city && /* @__PURE__ */ jsx("span", { className: address_form_default.error, children: formik.errors.city })
509
+ ] }) })
510
+ ] }),
511
+ /* @__PURE__ */ jsx("hr", { className: address_form_default.divider }),
512
+ showDefaultCheckbox && /* @__PURE__ */ jsx("div", { className: address_form_default.formGroup, children: /* @__PURE__ */ jsxs("label", { className: address_form_default.checkboxLabel, children: [
513
+ /* @__PURE__ */ jsx(
514
+ "input",
515
+ {
516
+ type: "checkbox",
517
+ className: address_form_default.checkboxInput,
518
+ checked: formik.values.is_default || false,
519
+ onChange: (e) => {
520
+ formik.setFieldValue("is_default", e.target.checked);
521
+ }
522
+ }
523
+ ),
524
+ "Make this your default address"
525
+ ] }) })
526
+ ] }),
527
+ /* @__PURE__ */ jsxs("div", { className: address_form_default.formFooter, children: [
528
+ showCancel && onCancel && /* @__PURE__ */ jsx(
529
+ "button",
530
+ {
531
+ type: "button",
532
+ className: address_form_default.cancelBtn,
533
+ onClick: onCancel,
534
+ children: "Cancel"
535
+ }
536
+ ),
537
+ renderButton ? renderButton({
538
+ type: "submit",
539
+ disabled: !formik.isValid || isSubmitting,
540
+ loading: isSubmitting,
541
+ children: isEditing ? submitLabel : submitLabel
542
+ }) : /* @__PURE__ */ jsx(
543
+ "button",
544
+ {
545
+ type: "submit",
546
+ disabled: !formik.isValid || isSubmitting,
547
+ className: address_form_default.formControl,
548
+ style: {
549
+ width: "auto",
550
+ cursor: !formik.isValid || isSubmitting ? "not-allowed" : "pointer",
551
+ backgroundColor: "var(--primary, #003d29)",
552
+ color: "var(--btn-text, #fff)",
553
+ border: "none",
554
+ padding: "0.5rem 1.5rem",
555
+ opacity: !formik.isValid || isSubmitting ? 0.6 : 1
556
+ },
557
+ children: isSubmitting ? "Saving..." : submitLabel
558
+ }
559
+ )
560
+ ] })
561
+ ]
562
+ }
563
+ );
564
+ }
565
+ );
566
+ AddressForm.displayName = "AddressForm";
567
+ var address_form_default2 = AddressForm;
568
+
569
+ export { address_form_default2 as AddressForm, search_dropdown_default2 as SearchDropdown };
@@ -0,0 +1,37 @@
1
+ import { C as Category } from './orders-D0oC9ugD.cjs';
2
+
3
+ type DiscountType = "discount";
4
+ type ValueType = "percentage" | "fixed";
5
+ type ApplicableTarget = "product_category" | "product_variant" | "product_bundle" | "customer";
6
+ type CouponStatus = "active" | "inactive" | "expired";
7
+ interface Coupon {
8
+ id: number;
9
+ coupon_code: string;
10
+ discount_type: DiscountType;
11
+ value: string;
12
+ value_type: ValueType;
13
+ min_order_amount: string;
14
+ max_discount_amount: string;
15
+ start_date: string;
16
+ end_date: string;
17
+ status: CouponStatus;
18
+ is_deleted: boolean;
19
+ usage_limit: number;
20
+ usage_count: number;
21
+ applicable_target: ApplicableTarget;
22
+ applicable_product_variants: any[];
23
+ applicable_product_bundles: any[];
24
+ applicable_product_categories: Category.Root[];
25
+ applicable_customers: any[];
26
+ auto_apply: boolean;
27
+ created_at: string;
28
+ updated_at: string;
29
+ is_cart_applicable: boolean;
30
+ coupon_message: string;
31
+ }
32
+ type Coupons = Coupon[];
33
+ interface CouponResponse {
34
+ coupon: Coupon;
35
+ }
36
+
37
+ export type { ApplicableTarget as A, Coupon as C, DiscountType as D, ValueType as V, CouponResponse as a, CouponStatus as b, Coupons as c };
@@ -0,0 +1,37 @@
1
+ import { C as Category } from './orders-CkUzv5Xh.js';
2
+
3
+ type DiscountType = "discount";
4
+ type ValueType = "percentage" | "fixed";
5
+ type ApplicableTarget = "product_category" | "product_variant" | "product_bundle" | "customer";
6
+ type CouponStatus = "active" | "inactive" | "expired";
7
+ interface Coupon {
8
+ id: number;
9
+ coupon_code: string;
10
+ discount_type: DiscountType;
11
+ value: string;
12
+ value_type: ValueType;
13
+ min_order_amount: string;
14
+ max_discount_amount: string;
15
+ start_date: string;
16
+ end_date: string;
17
+ status: CouponStatus;
18
+ is_deleted: boolean;
19
+ usage_limit: number;
20
+ usage_count: number;
21
+ applicable_target: ApplicableTarget;
22
+ applicable_product_variants: any[];
23
+ applicable_product_bundles: any[];
24
+ applicable_product_categories: Category.Root[];
25
+ applicable_customers: any[];
26
+ auto_apply: boolean;
27
+ created_at: string;
28
+ updated_at: string;
29
+ is_cart_applicable: boolean;
30
+ coupon_message: string;
31
+ }
32
+ type Coupons = Coupon[];
33
+ interface CouponResponse {
34
+ coupon: Coupon;
35
+ }
36
+
37
+ export type { ApplicableTarget as A, Coupon as C, DiscountType as D, ValueType as V, CouponResponse as a, CouponStatus as b, Coupons as c };