@storepecker/storefront-core 2.3.6 → 2.4.1
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 +8 -5
- package/dist/api/index.d.ts +8 -5
- package/dist/api/index.js +1 -1
- package/dist/{booking-CG6tul9l.d.ts → booking-BVWe8HHh.d.ts} +1 -1
- package/dist/{booking-DNVf5ZAS.d.cts → booking-DX9SU_qm.d.cts} +1 -1
- package/dist/cart-kJoawc_Z.d.cts +126 -0
- package/dist/cart-y-7RPmnQ.d.ts +126 -0
- package/dist/checkout/index.cjs +22 -22
- package/dist/checkout/index.d.cts +3 -1
- package/dist/checkout/index.d.ts +3 -1
- 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-6DXB4O6P.cjs +121 -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-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-LLRSKDH5.js +115 -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-YK4M3SFP.js +301 -0
- package/dist/{collections-Bz9KD7Na.d.cts → collections-BDSVfRNo.d.ts} +1 -1
- package/dist/{collections-CkEUi3BR.d.ts → collections-WzvTO0OQ.d.cts} +1 -1
- 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 -695
- package/dist/components/index.d.cts +14 -87
- package/dist/components/index.d.ts +14 -87
- package/dist/components/index.js +11 -688
- 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.d.cts +4 -2
- package/dist/hooks/index.d.ts +4 -2
- package/dist/hooks/index.js +6 -5
- package/dist/models/index.d.cts +6 -4
- package/dist/models/index.d.ts +6 -4
- package/dist/orders-CjNmCY5I.d.cts +144 -0
- package/dist/orders-L_8eIkUS.d.ts +144 -0
- package/dist/{pixelEvents-OVIkPw-J.d.ts → pixelEvents-Bo-VjAx8.d.ts} +4 -2
- package/dist/{pixelEvents-DYkiTkb2.d.cts → pixelEvents-C1rFPOwb.d.cts} +4 -2
- package/dist/{orders-fIdANHSl.d.ts → product-DJMdi4D4.d.cts} +1 -265
- package/dist/{orders-fIdANHSl.d.cts → product-DJMdi4D4.d.ts} +1 -265
- package/dist/store/index.cjs +5 -5
- package/dist/store/index.d.cts +6 -4
- package/dist/store/index.d.ts +6 -4
- package/dist/store/index.js +2 -2
- package/dist/utils/index.cjs +44 -43
- package/dist/utils/index.d.cts +7 -5
- package/dist/utils/index.d.ts +7 -5
- package/dist/utils/index.js +3 -2
- package/dist/{wishlist-stNzfvIP.d.cts → wishlist-CUuCTSVJ.d.cts} +1 -1
- package/dist/{wishlist-_bd4gLyQ.d.ts → wishlist-DKYFZR0s.d.ts} +1 -1
- package/package.json +50 -6
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkXFOUNOKO_cjs = require('./chunk-XFOUNOKO.cjs');
|
|
4
4
|
var chunkK44JZ5NL_cjs = require('./chunk-K44JZ5NL.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunk7UK3E7SL_cjs = require('./chunk-7UK3E7SL.cjs');
|
|
6
6
|
var chunkN3CTXRFT_cjs = require('./chunk-N3CTXRFT.cjs');
|
|
7
7
|
var axios = require('axios');
|
|
8
8
|
|
|
@@ -66,7 +66,7 @@ function openRazorpayCheckout(order, callbacks) {
|
|
|
66
66
|
async function handleRazorpaySuccess(data, order, callbacks) {
|
|
67
67
|
try {
|
|
68
68
|
callbacks.onPaymentStart?.();
|
|
69
|
-
await
|
|
69
|
+
await chunk7UK3E7SL_cjs.razorpayOrderSuccess(data);
|
|
70
70
|
chunkK44JZ5NL_cjs.pixelEvents.purchase(order);
|
|
71
71
|
chunkK44JZ5NL_cjs.pixelEvents.checkoutCompleted(order);
|
|
72
72
|
callbacks.onCartReset();
|
|
@@ -79,7 +79,7 @@ async function handleRazorpaySuccess(data, order, callbacks) {
|
|
|
79
79
|
}
|
|
80
80
|
async function handleRazorpayFail(order, callbacks) {
|
|
81
81
|
try {
|
|
82
|
-
await
|
|
82
|
+
await chunk7UK3E7SL_cjs.razorpayOrderFail({
|
|
83
83
|
order_id: order.id,
|
|
84
84
|
razorpay_order_id: order.razorpay_order_id
|
|
85
85
|
});
|
|
@@ -111,9 +111,9 @@ async function handleCODPayment(order, callbacks, options) {
|
|
|
111
111
|
callbacks.onPaymentStart?.();
|
|
112
112
|
chunkK44JZ5NL_cjs.pixelEvents.initiateCheckout(order, "cod");
|
|
113
113
|
if (options?.isPublic) {
|
|
114
|
-
await
|
|
114
|
+
await chunk7UK3E7SL_cjs.publicMakeCODOrder(order.order_number);
|
|
115
115
|
} else {
|
|
116
|
-
await
|
|
116
|
+
await chunk7UK3E7SL_cjs.makeCODOrder(order.id);
|
|
117
117
|
}
|
|
118
118
|
chunkK44JZ5NL_cjs.pixelEvents.purchase(order);
|
|
119
119
|
chunkK44JZ5NL_cjs.pixelEvents.checkoutCompleted(order);
|
|
@@ -141,7 +141,7 @@ function handleStripePayment(order, callbacks) {
|
|
|
141
141
|
async function handleStripeSuccess(order, paymentIntentId, callbacks) {
|
|
142
142
|
try {
|
|
143
143
|
callbacks.onPaymentStart?.();
|
|
144
|
-
await
|
|
144
|
+
await chunk7UK3E7SL_cjs.stripeOrderSuccess({
|
|
145
145
|
order_id: order.id,
|
|
146
146
|
payment_intent_id: paymentIntentId
|
|
147
147
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
// src/components/icons/share.tsx
|
|
6
|
+
function ShareIcon({
|
|
7
|
+
width = 20,
|
|
8
|
+
height = 23,
|
|
9
|
+
className
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12
|
+
"svg",
|
|
13
|
+
{
|
|
14
|
+
width,
|
|
15
|
+
height,
|
|
16
|
+
viewBox: "0 0 20 23",
|
|
17
|
+
fill: "none",
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19
|
+
className,
|
|
20
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21
|
+
"path",
|
|
22
|
+
{
|
|
23
|
+
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",
|
|
24
|
+
stroke: "currentColor",
|
|
25
|
+
strokeWidth: "1.5",
|
|
26
|
+
strokeLinecap: "round",
|
|
27
|
+
strokeLinejoin: "round"
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.ShareIcon = ShareIcon;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkBBRB475I_cjs = require('./chunk-BBRB475I.cjs');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var reactDom = require('react-dom');
|
|
6
|
+
var clsx = require('clsx');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
|
|
11
|
+
var clsx__default = /*#__PURE__*/_interopDefault(clsx);
|
|
12
|
+
|
|
13
|
+
function Modal({
|
|
14
|
+
open,
|
|
15
|
+
onClose,
|
|
16
|
+
className,
|
|
17
|
+
children
|
|
18
|
+
}) {
|
|
19
|
+
react.useEffect(() => {
|
|
20
|
+
if (!open) return;
|
|
21
|
+
const handleKey = (e) => {
|
|
22
|
+
if (e.key === "Escape") onClose();
|
|
23
|
+
};
|
|
24
|
+
document.addEventListener("keydown", handleKey);
|
|
25
|
+
const prevOverflow = document.body.style.overflow;
|
|
26
|
+
document.body.style.overflow = "hidden";
|
|
27
|
+
return () => {
|
|
28
|
+
document.removeEventListener("keydown", handleKey);
|
|
29
|
+
document.body.style.overflow = prevOverflow;
|
|
30
|
+
};
|
|
31
|
+
}, [open, onClose]);
|
|
32
|
+
if (!open || typeof document === "undefined") return null;
|
|
33
|
+
return reactDom.createPortal(
|
|
34
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
|
|
38
|
+
onClick: onClose,
|
|
39
|
+
role: "dialog",
|
|
40
|
+
"aria-modal": "true",
|
|
41
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
className: clsx__default.default(
|
|
45
|
+
"relative max-h-[90vh] w-full max-w-md overflow-y-auto rounded-lg bg-white shadow-xl",
|
|
46
|
+
className
|
|
47
|
+
),
|
|
48
|
+
onClick: (e) => e.stopPropagation(),
|
|
49
|
+
children
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
document.body
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
var checkIfLimitReached = (attribute) => {
|
|
58
|
+
return chunkBBRB475I_cjs.isExpired(attribute.expiry_date) || attribute.download_count === 0;
|
|
59
|
+
};
|
|
60
|
+
var DigitalProductDownloadModal = ({ open, onClose, product, downloadAttribute, onDownload, loading }) => {
|
|
61
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
62
|
+
Modal,
|
|
63
|
+
{
|
|
64
|
+
open,
|
|
65
|
+
onClose,
|
|
66
|
+
className: "modal modal-lg modal-confirm max-w-2xl",
|
|
67
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "modal-body px-4 py-2", children: [
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-2xl block mb-2 fw-regular", children: [
|
|
69
|
+
"Download links for ",
|
|
70
|
+
product?.product_name
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "mb-4 mt-2" }),
|
|
73
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "download-links", children: loading ? Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-100 rounded-1 mb-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
|
|
74
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-100", children: [
|
|
75
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shine line w-75" }),
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shine line w-50 mt-2" })
|
|
77
|
+
] }),
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shine w-160 h-32 rounded-1" })
|
|
79
|
+
] }) }, index)) : downloadAttribute.map((attribute, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: "flex items-center justify-between mt-3",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
85
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "block text-md lh-1", children: [
|
|
86
|
+
"Download link ",
|
|
87
|
+
index + 1
|
|
88
|
+
] }),
|
|
89
|
+
checkIfLimitReached(attribute) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-danger text-sm lh-1", children: "Download link expired." }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-textSecondary text-sm lh-1", children: [
|
|
90
|
+
"Remaining tries: ",
|
|
91
|
+
attribute.download_count,
|
|
92
|
+
" ",
|
|
93
|
+
"\u2022\xA0 Expires",
|
|
94
|
+
" ",
|
|
95
|
+
chunkBBRB475I_cjs.timeFromNow(attribute.expiry_date)
|
|
96
|
+
] })
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
99
|
+
"button",
|
|
100
|
+
{
|
|
101
|
+
className: "btn btn-text btn-medium",
|
|
102
|
+
onClick: () => onDownload(attribute),
|
|
103
|
+
disabled: checkIfLimitReached(attribute),
|
|
104
|
+
children: "Download"
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
`${attribute.download_link}-${index}`
|
|
110
|
+
)) }),
|
|
111
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-textSecondary text-sm fw-regular p-2 bg-warning-light rounded-2 mt-4", children: [
|
|
112
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { className: "text-textSecondary", children: "Warning:" }),
|
|
113
|
+
" 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."
|
|
114
|
+
] })
|
|
115
|
+
] })
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
var digital_product_download_modal_default = DigitalProductDownloadModal;
|
|
120
|
+
|
|
121
|
+
exports.digital_product_download_modal_default = digital_product_download_modal_default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { updateAddress, addAddress, getCountries, getSubdivisions } from './chunk-ZGMLOLTC.js';
|
|
2
|
-
import { getCache
|
|
2
|
+
import { getCache } from './chunk-OSM73ETC.js';
|
|
3
|
+
import { getAddressMeta } from './chunk-F45S7UWC.js';
|
|
3
4
|
import { addressFormInitialValues, IP_API_CACHE_KEY, addressValidationSchema, buildSubmitPayload } from './chunk-ELP23UGF.js';
|
|
4
5
|
import { useState, useEffect, useMemo, useCallback } from 'react';
|
|
5
6
|
import { useFormik } from 'formik';
|
|
@@ -17,6 +17,11 @@ async function getOrderDetailsByNumber(orderNumber) {
|
|
|
17
17
|
params: { order_number: orderNumber }
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
+
async function getOrderDetailsByRef(orderRef) {
|
|
21
|
+
return chunkECHV2JSY_cjs.http_service_default.get("/customer/order-detail/", {
|
|
22
|
+
params: { order_ref: orderRef }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
20
25
|
async function getPublicOrderDetailsByNumber(orderNumber) {
|
|
21
26
|
return chunkECHV2JSY_cjs.http_service_default.get("/customer/public_order/", {
|
|
22
27
|
params: { order_number: orderNumber }
|
|
@@ -111,6 +116,7 @@ async function verifyTabbyPayment(orderNumber) {
|
|
|
111
116
|
exports.checkPhonepePaymentStatus = checkPhonepePaymentStatus;
|
|
112
117
|
exports.getOrderDetails = getOrderDetails;
|
|
113
118
|
exports.getOrderDetailsByNumber = getOrderDetailsByNumber;
|
|
119
|
+
exports.getOrderDetailsByRef = getOrderDetailsByRef;
|
|
114
120
|
exports.getOrders = getOrders;
|
|
115
121
|
exports.getPublicOrderDetailsByNumber = getPublicOrderDetailsByNumber;
|
|
116
122
|
exports.getStripePaymentStatus = getStripePaymentStatus;
|
|
@@ -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 };
|