hey-pharmacist-ecommerce 1.1.31 → 1.1.33
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/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +423 -253
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +423 -255
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/AccountSettingsTab.tsx +0 -50
- package/src/components/NotificationDrawer.tsx +2 -9
- package/src/components/ProductCard.tsx +3 -3
- package/src/components/TabNavigation.tsx +1 -1
- package/src/components/ui/Button.tsx +1 -1
- package/src/index.ts +3 -0
- package/src/providers/NotificationCenterProvider.tsx +11 -27
- package/src/screens/NotificationSettingsScreen.tsx +119 -211
- package/src/styles/globals.css +4 -0
- package/styles/base.css +6 -0
- package/styles/globals.css +3 -0
package/dist/index.js
CHANGED
|
@@ -12444,13 +12444,6 @@ function NotificationCenterProvider({ children }) {
|
|
|
12444
12444
|
setIsLoading(true);
|
|
12445
12445
|
try {
|
|
12446
12446
|
const response = await notificationsApi.current.getNotifications(pageNum, 20, false);
|
|
12447
|
-
console.log("Raw API response:", {
|
|
12448
|
-
fullResponse: response,
|
|
12449
|
-
data: response.data,
|
|
12450
|
-
dataType: typeof response.data,
|
|
12451
|
-
isArray: Array.isArray(response.data),
|
|
12452
|
-
keys: response.data ? Object.keys(response.data) : []
|
|
12453
|
-
});
|
|
12454
12447
|
const data = response.data;
|
|
12455
12448
|
let rawNotifications = [];
|
|
12456
12449
|
if (Array.isArray(data)) {
|
|
@@ -12470,13 +12463,6 @@ function NotificationCenterProvider({ children }) {
|
|
|
12470
12463
|
createdAt: n.createdAt,
|
|
12471
12464
|
data: n.data
|
|
12472
12465
|
}));
|
|
12473
|
-
console.log("Fetched and mapped notifications:", {
|
|
12474
|
-
pageNum,
|
|
12475
|
-
append,
|
|
12476
|
-
rawCount: rawNotifications.length,
|
|
12477
|
-
mappedCount: newNotifications.length,
|
|
12478
|
-
firstNotification: newNotifications[0]
|
|
12479
|
-
});
|
|
12480
12466
|
if (append) {
|
|
12481
12467
|
setNotifications((prev) => [...prev, ...newNotifications]);
|
|
12482
12468
|
} else {
|
|
@@ -12495,7 +12481,6 @@ function NotificationCenterProvider({ children }) {
|
|
|
12495
12481
|
setIsLoading(true);
|
|
12496
12482
|
try {
|
|
12497
12483
|
const response = await notificationsApi.current.getSettings();
|
|
12498
|
-
console.log("Settings API response raw:", response);
|
|
12499
12484
|
const rawData = response.data;
|
|
12500
12485
|
let finalSettings = null;
|
|
12501
12486
|
if (rawData) {
|
|
@@ -12540,7 +12525,6 @@ function NotificationCenterProvider({ children }) {
|
|
|
12540
12525
|
finalSettings = rawData;
|
|
12541
12526
|
}
|
|
12542
12527
|
}
|
|
12543
|
-
console.log("Parsed settings:", finalSettings);
|
|
12544
12528
|
setSettings(finalSettings);
|
|
12545
12529
|
} catch (error) {
|
|
12546
12530
|
console.error("Failed to fetch settings:", error);
|
|
@@ -12556,11 +12540,12 @@ function NotificationCenterProvider({ children }) {
|
|
|
12556
12540
|
}
|
|
12557
12541
|
return;
|
|
12558
12542
|
}
|
|
12559
|
-
const token = getAuthToken();
|
|
12560
|
-
if (!token) return;
|
|
12561
12543
|
try {
|
|
12562
12544
|
const config = getCurrentConfig();
|
|
12563
|
-
const
|
|
12545
|
+
const token = getAuthToken();
|
|
12546
|
+
if (!token) return;
|
|
12547
|
+
const baseUrl = config.apiBaseUrl.endsWith("/") ? config.apiBaseUrl.slice(0, -1) : config.apiBaseUrl;
|
|
12548
|
+
const sseUrl = `${baseUrl}/notifications/stream?token=${encodeURIComponent(token)}`;
|
|
12564
12549
|
const eventSource = new EventSource(sseUrl);
|
|
12565
12550
|
eventSourceRef.current = eventSource;
|
|
12566
12551
|
eventSource.onmessage = (event) => {
|
|
@@ -12681,14 +12666,13 @@ function NotificationCenterProvider({ children }) {
|
|
|
12681
12666
|
}
|
|
12682
12667
|
}))
|
|
12683
12668
|
};
|
|
12684
|
-
console.log("Updating settings with payload:", payload);
|
|
12685
12669
|
await notificationsApi.current.updateSettings(payload);
|
|
12686
|
-
|
|
12670
|
+
await fetchSettings();
|
|
12687
12671
|
} catch (error) {
|
|
12688
12672
|
console.error("Failed to update settings:", error);
|
|
12689
12673
|
throw error;
|
|
12690
12674
|
}
|
|
12691
|
-
}, []);
|
|
12675
|
+
}, [fetchSettings]);
|
|
12692
12676
|
const value = {
|
|
12693
12677
|
notifications,
|
|
12694
12678
|
unreadCount,
|
|
@@ -12856,14 +12840,6 @@ function NotificationDrawer() {
|
|
|
12856
12840
|
const router = navigation.useRouter();
|
|
12857
12841
|
const { buildPath } = useBasePath();
|
|
12858
12842
|
const scrollContainerRef = React12.useRef(null);
|
|
12859
|
-
console.log("NotificationDrawer render:", {
|
|
12860
|
-
isDrawerOpen,
|
|
12861
|
-
notificationsCount: notifications.length,
|
|
12862
|
-
notifications: notifications.slice(0, 2),
|
|
12863
|
-
// First 2 for brevity
|
|
12864
|
-
unreadCount,
|
|
12865
|
-
isLoading
|
|
12866
|
-
});
|
|
12867
12843
|
const handleScroll = () => {
|
|
12868
12844
|
if (!scrollContainerRef.current || isLoading || !hasMore) return;
|
|
12869
12845
|
const { scrollTop, scrollHeight, clientHeight } = scrollContainerRef.current;
|
|
@@ -12895,6 +12871,7 @@ function NotificationDrawer() {
|
|
|
12895
12871
|
closeDrawer();
|
|
12896
12872
|
router.push(buildPath("/account/notifications"));
|
|
12897
12873
|
};
|
|
12874
|
+
console.log(notifications);
|
|
12898
12875
|
return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isDrawerOpen && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12899
12876
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12900
12877
|
framerMotion.motion.div,
|
|
@@ -13391,7 +13368,7 @@ function ProductCard({
|
|
|
13391
13368
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] line-clamp-2", children: product.name }),
|
|
13392
13369
|
selectedVariant && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-['Poppins',sans-serif] text-[#676c80]", children: selectedVariant.name })
|
|
13393
13370
|
] }),
|
|
13394
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 ", children: [
|
|
13371
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 my-2", children: [
|
|
13395
13372
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-0.5", children: [...Array(5)].map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
13396
13373
|
lucideReact.Star,
|
|
13397
13374
|
{
|
|
@@ -13399,7 +13376,7 @@ function ProductCard({
|
|
|
13399
13376
|
},
|
|
13400
13377
|
i
|
|
13401
13378
|
)) }),
|
|
13402
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-['Poppins',sans-serif] text-[10px] text-[#676c80]
|
|
13379
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-['Poppins',sans-serif] text-[10px] text-[#676c80] ", children: [
|
|
13403
13380
|
"(",
|
|
13404
13381
|
product.summary?.reviewCount || 0,
|
|
13405
13382
|
")"
|
|
@@ -13485,7 +13462,7 @@ function ProductCard({
|
|
|
13485
13462
|
}
|
|
13486
13463
|
},
|
|
13487
13464
|
disabled: isAddingToCart || variantImages.length > 0 && !selectedVariantId || displayInventoryCount === 0,
|
|
13488
|
-
className: "w-full font-['Poppins',sans-serif] font-medium text-[11px] px-3 py-2 rounded-full bg-[#5B9BD5] text-white hover:bg-[#4a8ac4] hover:shadow-lg transition-all duration-300 flex items-center justify-center gap-1.5 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
13465
|
+
className: "w-full font-['Poppins',sans-serif] font-medium text-[11px] px-3 py-2 rounded-full bg-[#5B9BD5] text-white hover:bg-[#4a8ac4] hover:shadow-lg transition-all duration-300 flex items-center justify-center gap-1.5 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",
|
|
13489
13466
|
children: [
|
|
13490
13467
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ShoppingCart, { className: "h-4 w-4" }),
|
|
13491
13468
|
displayInventoryCount === 0 ? "Out of Stock" : "Add to Cart"
|
|
@@ -13549,7 +13526,7 @@ function Button({
|
|
|
13549
13526
|
children,
|
|
13550
13527
|
...props
|
|
13551
13528
|
}) {
|
|
13552
|
-
const baseStyles = "font-medium rounded-full transition-all duration-200 inline-flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed focus:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary-500";
|
|
13529
|
+
const baseStyles = "font-medium rounded-full transition-all duration-200 inline-flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed focus:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary-500 hover:cursor-pointer";
|
|
13553
13530
|
const variants = {
|
|
13554
13531
|
primary: "bg-primary-600 text-white hover:bg-primary-700 shadow-lg shadow-primary-500/30 hover:shadow-xl hover:shadow-primary-500/40",
|
|
13555
13532
|
secondary: "bg-secondary-600 text-white hover:bg-secondary-700 shadow-lg shadow-secondary-500/30 hover:shadow-xl hover:shadow-secondary-500/40",
|
|
@@ -18077,7 +18054,7 @@ function TabNavigation({ tabs: tabs2, activeTab, onTabChange }) {
|
|
|
18077
18054
|
{
|
|
18078
18055
|
onClick: () => onTabChange(tab.id),
|
|
18079
18056
|
className: `
|
|
18080
|
-
flex items-center gap-2 px-6 py-3 text-sm font-medium whitespace-nowrap
|
|
18057
|
+
flex items-center gap-2 px-6 py-3 mt-2 text-sm font-medium whitespace-nowrap
|
|
18081
18058
|
border-b-2 transition-colors
|
|
18082
18059
|
${isActive ? "bg-secondary text-white rounded-xl hover:transition-all hover:duration-300 hover:ease-in-out hover:-translate-y-1" : "bg-white text-muted rounded-xl hover:text-secondary hover:transition-all hover:duration-150 hover:ease-in-out hover:-translate-y-1"}
|
|
18083
18060
|
`,
|
|
@@ -18757,9 +18734,6 @@ function AccountSettingsTab() {
|
|
|
18757
18734
|
const router = navigation.useRouter();
|
|
18758
18735
|
const { buildPath } = useBasePath();
|
|
18759
18736
|
const { logout } = useAuth();
|
|
18760
|
-
const [emailNotifications, setEmailNotifications] = React12.useState(true);
|
|
18761
|
-
const [orderUpdates, setOrderUpdates] = React12.useState(true);
|
|
18762
|
-
const [promotionalEmails, setPromotionalEmails] = React12.useState(false);
|
|
18763
18737
|
const [showDeleteModal, setShowDeleteModal] = React12.useState(false);
|
|
18764
18738
|
const [isDeleting, setIsDeleting] = React12.useState(false);
|
|
18765
18739
|
const [deleteError, setDeleteError] = React12.useState(null);
|
|
@@ -18779,59 +18753,6 @@ function AccountSettingsTab() {
|
|
|
18779
18753
|
}
|
|
18780
18754
|
};
|
|
18781
18755
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6 space-y-6", children: [
|
|
18782
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-2xl border border-slate-200 bg-white p-6", children: [
|
|
18783
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
|
|
18784
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bell, { className: "h-5 w-5 text-secondary" }),
|
|
18785
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-secondary", children: "Account Preferences" })
|
|
18786
|
-
] }),
|
|
18787
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
18788
|
-
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center justify-between gap-4 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3", children: [
|
|
18789
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
18790
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-secondary", children: "Email Notifications" }),
|
|
18791
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted", children: "Receive updates about your orders" })
|
|
18792
|
-
] }),
|
|
18793
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18794
|
-
"input",
|
|
18795
|
-
{
|
|
18796
|
-
type: "checkbox",
|
|
18797
|
-
checked: emailNotifications,
|
|
18798
|
-
onChange: (e) => setEmailNotifications(e.target.checked),
|
|
18799
|
-
className: "h-4 w-4 rounded-sm border-primary-300 text-secondary focus:ring-primary-500"
|
|
18800
|
-
}
|
|
18801
|
-
)
|
|
18802
|
-
] }),
|
|
18803
|
-
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center justify-between gap-4 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3", children: [
|
|
18804
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
18805
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-secondary", children: "Order Updates" }),
|
|
18806
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted", children: "Get notified about shipping status" })
|
|
18807
|
-
] }),
|
|
18808
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18809
|
-
"input",
|
|
18810
|
-
{
|
|
18811
|
-
type: "checkbox",
|
|
18812
|
-
checked: orderUpdates,
|
|
18813
|
-
onChange: (e) => setOrderUpdates(e.target.checked),
|
|
18814
|
-
className: "h-4 w-4 rounded-sm border-primary-300 text-secondary focus:ring-primary-500"
|
|
18815
|
-
}
|
|
18816
|
-
)
|
|
18817
|
-
] }),
|
|
18818
|
-
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center justify-between gap-4 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3", children: [
|
|
18819
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
18820
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-secondary", children: "Promotional Emails" }),
|
|
18821
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted", children: "Receive special offers and discounts" })
|
|
18822
|
-
] }),
|
|
18823
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18824
|
-
"input",
|
|
18825
|
-
{
|
|
18826
|
-
type: "checkbox",
|
|
18827
|
-
checked: promotionalEmails,
|
|
18828
|
-
onChange: (e) => setPromotionalEmails(e.target.checked),
|
|
18829
|
-
className: "h-4 w-4 rounded-sm border-primary-300 text-secondary focus:ring-primary-500"
|
|
18830
|
-
}
|
|
18831
|
-
)
|
|
18832
|
-
] })
|
|
18833
|
-
] })
|
|
18834
|
-
] }),
|
|
18835
18756
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-2xl border border-slate-200 bg-white p-6", children: [
|
|
18836
18757
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
|
|
18837
18758
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Lock, { className: "h-5 w-5 text-secondary" }),
|
|
@@ -21463,7 +21384,6 @@ function OrderReviewsScreen() {
|
|
|
21463
21384
|
var NOTIFICATION_CATEGORIES = [
|
|
21464
21385
|
{
|
|
21465
21386
|
name: "Order Updates",
|
|
21466
|
-
icon: lucideReact.Package,
|
|
21467
21387
|
types: [
|
|
21468
21388
|
{
|
|
21469
21389
|
type: "ORDER_CONFIRMATION" /* ORDERCONFIRMATION */,
|
|
@@ -21484,7 +21404,6 @@ var NOTIFICATION_CATEGORIES = [
|
|
|
21484
21404
|
},
|
|
21485
21405
|
{
|
|
21486
21406
|
name: "Payments",
|
|
21487
|
-
icon: lucideReact.CreditCard,
|
|
21488
21407
|
types: [
|
|
21489
21408
|
{
|
|
21490
21409
|
type: "PAYMENT_FAILED" /* PAYMENTFAILED */,
|
|
@@ -21500,7 +21419,6 @@ var NOTIFICATION_CATEGORIES = [
|
|
|
21500
21419
|
},
|
|
21501
21420
|
{
|
|
21502
21421
|
name: "Security",
|
|
21503
|
-
icon: lucideReact.Shield,
|
|
21504
21422
|
types: [
|
|
21505
21423
|
{
|
|
21506
21424
|
type: "PASSWORD_RESET" /* PASSWORDRESET */,
|
|
@@ -21523,7 +21441,6 @@ var NOTIFICATION_CATEGORIES = [
|
|
|
21523
21441
|
},
|
|
21524
21442
|
{
|
|
21525
21443
|
name: "Marketing",
|
|
21526
|
-
icon: lucideReact.Bell,
|
|
21527
21444
|
types: [
|
|
21528
21445
|
{
|
|
21529
21446
|
type: "ABANDONED_CART_REMINDER" /* ABANDONEDCARTREMINDER */,
|
|
@@ -21546,31 +21463,29 @@ var NOTIFICATION_CATEGORIES = [
|
|
|
21546
21463
|
]
|
|
21547
21464
|
}
|
|
21548
21465
|
];
|
|
21466
|
+
var Switch = ({ checked, onChange, disabled }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
21467
|
+
"button",
|
|
21468
|
+
{
|
|
21469
|
+
onClick: () => !disabled && onChange(!checked),
|
|
21470
|
+
className: `relative w-9 h-5 rounded-full transition-colors duration-200 ease-in-out focus:outline-none ${checked ? "bg-black" : "bg-slate-200"} ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
21471
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21472
|
+
"span",
|
|
21473
|
+
{
|
|
21474
|
+
className: `absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white shadow-sm transition-transform duration-200 ease-in-out ${checked ? "translate-x-4" : "translate-x-0"}`
|
|
21475
|
+
}
|
|
21476
|
+
)
|
|
21477
|
+
}
|
|
21478
|
+
);
|
|
21549
21479
|
function NotificationSettingsScreen() {
|
|
21550
21480
|
const { settings, updateSettings, isLoading } = useNotificationCenter();
|
|
21551
21481
|
const [localSettings, setLocalSettings] = React12.useState(settings);
|
|
21552
|
-
const [expandedCategories, setExpandedCategories] = React12.useState(
|
|
21553
|
-
new Set(NOTIFICATION_CATEGORIES.map((cat) => cat.name))
|
|
21554
|
-
);
|
|
21555
21482
|
const [isSaving, setIsSaving] = React12.useState(false);
|
|
21556
21483
|
const [hasChanges, setHasChanges] = React12.useState(false);
|
|
21557
21484
|
React12.useEffect(() => {
|
|
21558
|
-
console.log("NotificationSettingsScreen: settings updated:", settings);
|
|
21559
21485
|
if (settings) {
|
|
21560
21486
|
setLocalSettings(settings);
|
|
21561
21487
|
}
|
|
21562
21488
|
}, [settings]);
|
|
21563
|
-
const toggleCategory = (categoryName) => {
|
|
21564
|
-
setExpandedCategories((prev) => {
|
|
21565
|
-
const next = new Set(prev);
|
|
21566
|
-
if (next.has(categoryName)) {
|
|
21567
|
-
next.delete(categoryName);
|
|
21568
|
-
} else {
|
|
21569
|
-
next.add(categoryName);
|
|
21570
|
-
}
|
|
21571
|
-
return next;
|
|
21572
|
-
});
|
|
21573
|
-
};
|
|
21574
21489
|
const getChannelSetting = (type, channel) => {
|
|
21575
21490
|
const activeSettings = hasChanges ? localSettings : settings;
|
|
21576
21491
|
if (!activeSettings?.preferences || !Array.isArray(activeSettings.preferences)) {
|
|
@@ -21626,175 +21541,428 @@ function NotificationSettingsScreen() {
|
|
|
21626
21541
|
setIsSaving(false);
|
|
21627
21542
|
}
|
|
21628
21543
|
};
|
|
21629
|
-
const disableAllChannel = (channel) => {
|
|
21630
|
-
setLocalSettings((prev) => {
|
|
21631
|
-
const currentSettings = prev || { preferences: [] };
|
|
21632
|
-
const prefIsArray = Array.isArray(currentSettings.preferences);
|
|
21633
|
-
const preferences = NOTIFICATION_CATEGORIES.flatMap(
|
|
21634
|
-
(cat) => cat.types.filter((t) => !t.isComingSoon).map((t) => t.type)
|
|
21635
|
-
).map((type) => {
|
|
21636
|
-
const existing = prefIsArray ? currentSettings.preferences.find((p) => p.type === type) : void 0;
|
|
21637
|
-
return {
|
|
21638
|
-
type,
|
|
21639
|
-
settings: {
|
|
21640
|
-
email: channel === "email" ? false : existing?.settings?.email ?? true,
|
|
21641
|
-
push: channel === "push" ? false : existing?.settings?.push ?? true,
|
|
21642
|
-
inApp: existing?.settings?.inApp ?? true
|
|
21643
|
-
}
|
|
21644
|
-
};
|
|
21645
|
-
});
|
|
21646
|
-
return { ...currentSettings, preferences };
|
|
21647
|
-
});
|
|
21648
|
-
setHasChanges(true);
|
|
21649
|
-
};
|
|
21650
21544
|
if (isLoading && !settings) {
|
|
21651
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
21652
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-10 h-10 text-primary animate-spin mb-4" }),
|
|
21653
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted font-medium", children: "Loading preferences..." })
|
|
21654
|
-
] });
|
|
21545
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-[50vh] flex-col items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-6 w-6 animate-spin text-slate-400" }) });
|
|
21655
21546
|
}
|
|
21656
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
21657
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
21658
|
-
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-semibold text-
|
|
21659
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-
|
|
21547
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto max-w-4xl px-6 py-8", children: [
|
|
21548
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-6 flex items-end justify-between border-b border-slate-100 pb-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
21549
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-semibold tracking-tight text-slate-900", children: "Notifications" }),
|
|
21550
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-sm text-slate-500", children: "Manage your notification preferences across all channels." })
|
|
21660
21551
|
] }) }),
|
|
21661
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
21662
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
21552
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "hidden grid-cols-12 gap-4 border-b border-slate-100 pb-3 text-xs font-medium uppercase tracking-wider text-slate-400 sm:grid", children: [
|
|
21553
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-8", children: "Topic" }),
|
|
21554
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2 text-center", children: "Email" }),
|
|
21555
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2 text-center", children: "Push" })
|
|
21556
|
+
] }),
|
|
21557
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-8 py-4", children: NOTIFICATION_CATEGORIES.map((category) => /* @__PURE__ */ jsxRuntime.jsxs("section", { children: [
|
|
21558
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "mb-6 text-sm font-semibold text-slate-900", children: category.name }),
|
|
21559
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: category.types.map((notifType) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group grid grid-cols-1 sm:grid-cols-12 gap-y-3 sm:gap-x-4 items-start sm:items-center", children: [
|
|
21560
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-8 pr-4", children: [
|
|
21561
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
21562
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `text-sm font-medium ${notifType.isComingSoon ? "text-slate-400" : "text-slate-700"}`, children: notifType.label }),
|
|
21563
|
+
notifType.isComingSoon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded bg-slate-100 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-slate-500", children: "Soon" })
|
|
21564
|
+
] }),
|
|
21565
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs text-slate-500", children: notifType.description })
|
|
21566
|
+
] }),
|
|
21567
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-4 grid grid-cols-2 gap-4", children: [
|
|
21568
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between sm:justify-center", children: [
|
|
21569
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sm:hidden text-xs text-slate-400", children: "Email" }),
|
|
21570
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21571
|
+
Switch,
|
|
21572
|
+
{
|
|
21573
|
+
checked: getChannelSetting(notifType.type, "email"),
|
|
21574
|
+
onChange: (checked) => updateChannelSetting(notifType.type, "email", checked),
|
|
21575
|
+
disabled: notifType.isComingSoon
|
|
21576
|
+
}
|
|
21577
|
+
)
|
|
21578
|
+
] }),
|
|
21579
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between sm:justify-center", children: [
|
|
21580
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sm:hidden text-xs text-slate-400", children: "Push" }),
|
|
21581
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21582
|
+
Switch,
|
|
21583
|
+
{
|
|
21584
|
+
checked: getChannelSetting(notifType.type, "push"),
|
|
21585
|
+
onChange: (checked) => updateChannelSetting(notifType.type, "push", checked),
|
|
21586
|
+
disabled: notifType.isComingSoon
|
|
21587
|
+
}
|
|
21588
|
+
)
|
|
21589
|
+
] })
|
|
21590
|
+
] })
|
|
21591
|
+
] }, notifType.type)) })
|
|
21592
|
+
] }, category.name)) }),
|
|
21593
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-12 border-t border-slate-100 pt-8 text-center sm:text-left", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21594
|
+
Button,
|
|
21595
|
+
{
|
|
21596
|
+
variant: "ghost",
|
|
21597
|
+
className: "text-xs text-slate-400 hover:text-red-600 px-0",
|
|
21598
|
+
onClick: () => {
|
|
21599
|
+
if (confirm("Are you sure you want to disable all notifications?")) {
|
|
21600
|
+
localSettings?.preferences ? [...localSettings.preferences] : [];
|
|
21601
|
+
alert("Feature to disable all coming in next update");
|
|
21602
|
+
}
|
|
21603
|
+
},
|
|
21604
|
+
children: "Disable all notifications"
|
|
21605
|
+
}
|
|
21606
|
+
) }),
|
|
21607
|
+
hasChanges && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white/80 backdrop-blur-sm fixed bottom-6 left-1/2 -translate-x-1/2 z-50 rounded-xl shadow-lg border border-slate-200 p-2 px-4 flex items-center gap-4 animate-in slide-in-from-bottom-2 fade-in duration-300", children: [
|
|
21608
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-slate-600", children: "Unsaved changes" }),
|
|
21609
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-px bg-slate-200" }),
|
|
21610
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21611
|
+
Button,
|
|
21612
|
+
{
|
|
21613
|
+
onClick: handleSave,
|
|
21614
|
+
isLoading: isSaving,
|
|
21615
|
+
disabled: isSaving,
|
|
21616
|
+
variant: "primary",
|
|
21617
|
+
className: "h-8 rounded-lg px-4 text-xs font-medium bg-black text-white bg-slate-800 hover:bg-slate-700",
|
|
21618
|
+
children: "Save"
|
|
21619
|
+
}
|
|
21620
|
+
)
|
|
21621
|
+
] })
|
|
21622
|
+
] });
|
|
21623
|
+
}
|
|
21624
|
+
function OrderDetailScreen({ id }) {
|
|
21625
|
+
const router = navigation.useRouter();
|
|
21626
|
+
const { buildPath } = useBasePath();
|
|
21627
|
+
const { order, isLoading, error } = useOrder(id);
|
|
21628
|
+
if (isLoading) {
|
|
21629
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-h-screen bg-slate-50 flex flex-col items-center justify-center p-4", children: [
|
|
21630
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 border-4 border-primary/20 border-t-primary rounded-full animate-spin mb-4" }),
|
|
21631
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted font-medium animate-pulse", children: "Retrieving order details..." })
|
|
21632
|
+
] });
|
|
21633
|
+
}
|
|
21634
|
+
if (error || !order) {
|
|
21635
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-h-screen bg-slate-50 flex flex-col items-center justify-center p-4", children: [
|
|
21636
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 bg-red-50 rounded-full mb-4", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "w-10 h-10 text-red-500" }) }),
|
|
21637
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-bold text-secondary mb-2", children: "Order Not Found" }),
|
|
21638
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted mb-6", children: "We couldn't find the order you're looking for." }),
|
|
21639
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => router.push(buildPath("/account")), children: "Back to Account" })
|
|
21640
|
+
] });
|
|
21641
|
+
}
|
|
21642
|
+
const items = order.items || [];
|
|
21643
|
+
const status = order.orderStatus || "Pending";
|
|
21644
|
+
const isDelivery = order.orderType === "Delivery";
|
|
21645
|
+
const getStatusVariant = (status2) => {
|
|
21646
|
+
switch (status2.toLowerCase()) {
|
|
21647
|
+
case "pending":
|
|
21648
|
+
return "warning";
|
|
21649
|
+
case "delivered":
|
|
21650
|
+
case "fulfilled":
|
|
21651
|
+
case "picked up":
|
|
21652
|
+
return "success";
|
|
21653
|
+
case "shipped":
|
|
21654
|
+
return "primary";
|
|
21655
|
+
case "cancelled":
|
|
21656
|
+
return "danger";
|
|
21657
|
+
default:
|
|
21658
|
+
return "gray";
|
|
21659
|
+
}
|
|
21660
|
+
};
|
|
21661
|
+
const shippingAddress = order.shippingInfo?.addressTo;
|
|
21662
|
+
const pickupAddress = order.pickUpAddress;
|
|
21663
|
+
const activeAddress = isDelivery ? shippingAddress : pickupAddress;
|
|
21664
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-h-screen bg-linear-to-b from-[#F8FAFC] to-[#EBF4FB] pb-20", children: [
|
|
21665
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "container mx-auto px-4 pt-8 max-w-6xl", children: [
|
|
21666
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
21667
|
+
"button",
|
|
21668
|
+
{
|
|
21669
|
+
onClick: () => router.back(),
|
|
21670
|
+
className: "group flex items-center gap-2 text-muted hover:text-secondary transition-colors mb-6",
|
|
21671
|
+
children: [
|
|
21672
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-1.5 rounded-full bg-white shadow-xs group-hover:shadow-md transition-all", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "w-4 h-4" }) }),
|
|
21673
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold", children: "Back to History" })
|
|
21674
|
+
]
|
|
21675
|
+
}
|
|
21676
|
+
),
|
|
21677
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col md:flex-row md:items-end justify-between gap-6 mb-8", children: [
|
|
21678
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
21679
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
|
|
21680
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-3xl font-bold text-secondary", children: "Order Details" }),
|
|
21681
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: getStatusVariant(status), children: status }),
|
|
21682
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "primary", className: "bg-primary-100 text-primary-700 border-primary-200", children: order.orderType || "Pickup" })
|
|
21683
|
+
] }),
|
|
21684
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-2 text-sm text-muted", children: [
|
|
21685
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5 font-medium", children: [
|
|
21686
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "opacity-60 text-xs uppercase tracking-widest font-bold", children: "ID:" }),
|
|
21687
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-secondary font-mono tracking-tight", children: [
|
|
21688
|
+
"#",
|
|
21689
|
+
id.toUpperCase()
|
|
21690
|
+
] })
|
|
21691
|
+
] }),
|
|
21692
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5 font-medium", children: [
|
|
21693
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "w-4 h-4 opacity-60" }),
|
|
21694
|
+
formatDate(order.createdAt || /* @__PURE__ */ new Date(), "long")
|
|
21695
|
+
] })
|
|
21696
|
+
] })
|
|
21697
|
+
] }),
|
|
21698
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: order.payment?.hostedInvoiceUrl && /* @__PURE__ */ jsxRuntime.jsxs(Button, { size: "sm", onClick: () => window.open(order.payment?.hostedInvoiceUrl, "_blank"), className: "bg-accent hover:bg-accent-dark border-none", children: [
|
|
21699
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLink, { className: "w-4 h-4" }),
|
|
21700
|
+
"Payment Details"
|
|
21701
|
+
] }) })
|
|
21702
|
+
] })
|
|
21703
|
+
] }),
|
|
21704
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "container mx-auto px-4 max-w-6xl grid grid-cols-1 lg:grid-cols-3 gap-8", children: [
|
|
21705
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lg:col-span-2 space-y-6", children: [
|
|
21663
21706
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
21664
|
-
|
|
21707
|
+
framerMotion.motion.div,
|
|
21665
21708
|
{
|
|
21666
|
-
|
|
21667
|
-
|
|
21709
|
+
initial: { opacity: 0, y: 20 },
|
|
21710
|
+
animate: { opacity: 1, y: 0 },
|
|
21711
|
+
className: "bg-white rounded-3xl border border-slate-200 shadow-xs overflow-hidden",
|
|
21668
21712
|
children: [
|
|
21669
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center
|
|
21670
|
-
/* @__PURE__ */ jsxRuntime.
|
|
21671
|
-
|
|
21713
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6 border-b border-slate-100 bg-slate-50/50 flex items-center justify-between", children: [
|
|
21714
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
21715
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Package, { className: "w-5 h-5 text-secondary" }),
|
|
21716
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-bold text-secondary", children: "Order Items" })
|
|
21717
|
+
] }),
|
|
21718
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs font-bold bg-slate-200 text-muted px-2.5 py-1 rounded-full", children: [
|
|
21719
|
+
items.length,
|
|
21720
|
+
" ",
|
|
21721
|
+
items.length === 1 ? "Product" : "Products"
|
|
21722
|
+
] })
|
|
21672
21723
|
] }),
|
|
21673
|
-
|
|
21674
|
-
|
|
21675
|
-
|
|
21676
|
-
|
|
21677
|
-
|
|
21678
|
-
|
|
21679
|
-
|
|
21680
|
-
|
|
21681
|
-
|
|
21682
|
-
|
|
21683
|
-
|
|
21684
|
-
|
|
21685
|
-
|
|
21686
|
-
|
|
21687
|
-
|
|
21688
|
-
|
|
21689
|
-
|
|
21690
|
-
|
|
21691
|
-
|
|
21692
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-secondary", children: notifType.label }),
|
|
21693
|
-
notifType.isComingSoon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold uppercase tracking-wider bg-slate-200 text-muted px-2 py-0.5 rounded-full", children: "Soon" })
|
|
21694
|
-
] }),
|
|
21695
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted mt-1 leading-relaxed", children: notifType.description })
|
|
21724
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "divide-y divide-slate-100", children: items.map((item, idx) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6 flex gap-6 group hover:bg-slate-50/50 transition-colors", children: [
|
|
21725
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-20 h-20 bg-slate-100 rounded-2xl overflow-hidden shrink-0 border border-slate-100 group-hover:scale-105 transition-transform duration-300", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21726
|
+
Image4__default.default,
|
|
21727
|
+
{
|
|
21728
|
+
src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
|
|
21729
|
+
alt: item.productVariantData?.name || "Item",
|
|
21730
|
+
fill: true,
|
|
21731
|
+
className: "object-cover",
|
|
21732
|
+
sizes: "80px"
|
|
21733
|
+
}
|
|
21734
|
+
) }),
|
|
21735
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col justify-between py-1", children: [
|
|
21736
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
21737
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-bold text-secondary text-lg group-hover:text-primary transition-colors leading-snug mb-1", children: item.productVariantData?.name }),
|
|
21738
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-x-4 gap-y-1 text-sm text-muted", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
21739
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-slate-300" }),
|
|
21740
|
+
"Quantity: ",
|
|
21741
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-secondary font-bold", children: item.quantity })
|
|
21742
|
+
] }) })
|
|
21696
21743
|
] }),
|
|
21697
|
-
|
|
21698
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
21699
|
-
|
|
21700
|
-
|
|
21701
|
-
{
|
|
21702
|
-
type: "checkbox",
|
|
21703
|
-
checked: getChannelSetting(notifType.type, "email"),
|
|
21704
|
-
onChange: (e) => updateChannelSetting(notifType.type, "email", e.target.checked),
|
|
21705
|
-
className: "w-4 h-4 text-primary border-slate-300 rounded-sm focus:ring-primary focus:ring-offset-0"
|
|
21706
|
-
}
|
|
21707
|
-
),
|
|
21708
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted uppercase tracking-wider group-hover/label:text-primary transition-colors", children: "Email" })
|
|
21709
|
-
] }),
|
|
21710
|
-
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center gap-2 cursor-pointer group/label", children: [
|
|
21711
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21712
|
-
"input",
|
|
21713
|
-
{
|
|
21714
|
-
type: "checkbox",
|
|
21715
|
-
checked: getChannelSetting(notifType.type, "push"),
|
|
21716
|
-
onChange: (e) => updateChannelSetting(notifType.type, "push", e.target.checked),
|
|
21717
|
-
className: "w-4 h-4 text-primary border-slate-300 rounded-sm focus:ring-primary focus:ring-offset-0"
|
|
21718
|
-
}
|
|
21719
|
-
),
|
|
21720
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted uppercase tracking-wider group-hover/label:text-primary transition-colors", children: "Push" })
|
|
21744
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
21745
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted text-sm", children: [
|
|
21746
|
+
formatPrice(item.productVariantData?.finalPrice || 0),
|
|
21747
|
+
" per unit"
|
|
21721
21748
|
] }),
|
|
21722
|
-
/* @__PURE__ */ jsxRuntime.
|
|
21723
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21724
|
-
"input",
|
|
21725
|
-
{
|
|
21726
|
-
type: "checkbox",
|
|
21727
|
-
checked: getChannelSetting(notifType.type, "inApp"),
|
|
21728
|
-
onChange: (e) => updateChannelSetting(notifType.type, "inApp", e.target.checked),
|
|
21729
|
-
className: "w-4 h-4 text-primary border-slate-300 rounded-sm focus:ring-primary focus:ring-offset-0"
|
|
21730
|
-
}
|
|
21731
|
-
),
|
|
21732
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted uppercase tracking-wider group-hover/label:text-primary transition-colors", children: "In-App" })
|
|
21733
|
-
] })
|
|
21749
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-black text-secondary", children: formatPrice((item.productVariantData?.finalPrice || 0) * item.quantity) })
|
|
21734
21750
|
] })
|
|
21735
21751
|
] })
|
|
21736
|
-
},
|
|
21737
|
-
|
|
21738
|
-
)) })
|
|
21752
|
+
] }, item._id || idx)) })
|
|
21753
|
+
]
|
|
21739
21754
|
}
|
|
21740
|
-
)
|
|
21741
|
-
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
|
|
21745
|
-
|
|
21755
|
+
),
|
|
21756
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
|
|
21757
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white p-6 rounded-3xl border border-slate-200 shadow-xs", children: [
|
|
21758
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
|
|
21759
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.MapPin, { className: "w-5 h-5 text-accent" }),
|
|
21760
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-bold text-secondary", children: isDelivery ? "Shipping Address" : "Pickup Location" })
|
|
21761
|
+
] }),
|
|
21762
|
+
activeAddress ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-muted leading-relaxed", children: [
|
|
21763
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-bold text-secondary text-base mb-1", children: activeAddress.name }),
|
|
21764
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: activeAddress.street1 }),
|
|
21765
|
+
activeAddress.street2 && /* @__PURE__ */ jsxRuntime.jsx("p", { children: activeAddress.street2 }),
|
|
21766
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
|
|
21767
|
+
activeAddress.city,
|
|
21768
|
+
", ",
|
|
21769
|
+
activeAddress.state,
|
|
21770
|
+
" ",
|
|
21771
|
+
activeAddress.zip
|
|
21772
|
+
] }),
|
|
21773
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: activeAddress.country })
|
|
21774
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted italic", children: "No address recorded" })
|
|
21775
|
+
] }),
|
|
21776
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white p-6 rounded-3xl border border-slate-200 shadow-xs", children: [
|
|
21777
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
|
|
21778
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "w-5 h-5 text-accent" }),
|
|
21779
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-bold text-secondary", children: "Payment Method" })
|
|
21780
|
+
] }),
|
|
21781
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-muted leading-relaxed", children: [
|
|
21782
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-bold text-secondary text-base mb-1", children: order.payment?.paymentMethod ? order.payment.paymentMethod.replace("_", " ").toUpperCase() : "N/A" }),
|
|
21783
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2 mt-2", children: [
|
|
21784
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "opacity-60", children: "Status:" }),
|
|
21785
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: order.payment?.paymentStatus === "Paid" ? "success" : "warning", children: order.payment?.paymentStatus || "Processing" })
|
|
21786
|
+
] }),
|
|
21787
|
+
order.payment?.transactionId && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-3 text-[10px] font-bold text-slate-400 uppercase tracking-tighter", children: [
|
|
21788
|
+
"Ref: ",
|
|
21789
|
+
order.payment.transactionId
|
|
21790
|
+
] })
|
|
21791
|
+
] })
|
|
21792
|
+
] })
|
|
21793
|
+
] })
|
|
21794
|
+
] }),
|
|
21795
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-6", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21796
|
+
framerMotion.motion.div,
|
|
21797
|
+
{
|
|
21798
|
+
initial: { opacity: 0, x: 20 },
|
|
21799
|
+
animate: { opacity: 1, x: 0 },
|
|
21800
|
+
className: "bg-secondary p-8 rounded-[2rem] text-white shadow-xl shadow-secondary/20 sticky top-8",
|
|
21801
|
+
children: [
|
|
21802
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-xl font-bold mb-6 flex items-center gap-2", children: "Summary View" }),
|
|
21803
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 mb-8", children: [
|
|
21804
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center text-white/70", children: [
|
|
21805
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Subtotal" }),
|
|
21806
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-white", children: formatPrice(order.subTotal || 0) })
|
|
21807
|
+
] }),
|
|
21808
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center text-white/70", children: [
|
|
21809
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Shipping" }),
|
|
21810
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-white", children: formatPrice(order.shippingCost || 0) })
|
|
21811
|
+
] }),
|
|
21812
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center text-white/70", children: [
|
|
21813
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Tax" }),
|
|
21814
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-white", children: formatPrice(order.tax || 0) })
|
|
21815
|
+
] }),
|
|
21816
|
+
order.discountedAmount !== void 0 && order.discountedAmount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center text-primary", children: [
|
|
21817
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Discount" }),
|
|
21818
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-bold", children: [
|
|
21819
|
+
"-",
|
|
21820
|
+
formatPrice(order.discountedAmount)
|
|
21821
|
+
] })
|
|
21822
|
+
] }),
|
|
21823
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-4 border-t border-white/10 mt-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-end", children: [
|
|
21824
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
21825
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-black uppercase tracking-[0.2em] text-white/40 mb-1", children: "Grand Total" }),
|
|
21826
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-3xl font-black", children: formatPrice(order.grandTotal || 0) })
|
|
21827
|
+
] }),
|
|
21828
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-1 bg-white/10 rounded-lg text-[10px] font-black uppercase tracking-wider text-white/60", children: "USD" })
|
|
21829
|
+
] }) })
|
|
21830
|
+
] }),
|
|
21831
|
+
order.orderStatus === "Pending" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 bg-white/5 rounded-2xl border border-white/10 mb-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
21832
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: "w-5 h-5 text-primary shrink-0 mt-0.5" }),
|
|
21833
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
21834
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-bold mb-1", children: "Order is processing" }),
|
|
21835
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] text-white/60 leading-relaxed", children: "We've received your request and our pharmacists are reviewing it for safety and accuracy." })
|
|
21836
|
+
] })
|
|
21837
|
+
] }) })
|
|
21838
|
+
]
|
|
21839
|
+
}
|
|
21840
|
+
) })
|
|
21841
|
+
] })
|
|
21842
|
+
] });
|
|
21843
|
+
}
|
|
21844
|
+
init_config();
|
|
21845
|
+
var changePasswordSchema = zod.z.object({
|
|
21846
|
+
currentPassword: zod.z.string().min(6, "Current password is required"),
|
|
21847
|
+
newPassword: zod.z.string().min(8, "Password must be at least 8 characters"),
|
|
21848
|
+
confirmPassword: zod.z.string().min(8, "Confirm your new password")
|
|
21849
|
+
}).refine((data) => data.newPassword === data.confirmPassword, {
|
|
21850
|
+
path: ["confirmPassword"],
|
|
21851
|
+
message: "Passwords do not match"
|
|
21852
|
+
});
|
|
21853
|
+
function ChangePasswordScreen() {
|
|
21854
|
+
const router = navigation.useRouter();
|
|
21855
|
+
const { user } = useAuth();
|
|
21856
|
+
const { buildPath } = useBasePath();
|
|
21857
|
+
const [isSubmitting, setIsSubmitting] = React12.useState(false);
|
|
21858
|
+
const [status, setStatus] = React12.useState(
|
|
21859
|
+
null
|
|
21860
|
+
);
|
|
21861
|
+
const {
|
|
21862
|
+
register,
|
|
21863
|
+
handleSubmit,
|
|
21864
|
+
formState: { errors }
|
|
21865
|
+
} = reactHookForm.useForm({
|
|
21866
|
+
resolver: zod$1.zodResolver(changePasswordSchema)
|
|
21867
|
+
});
|
|
21868
|
+
if (!user) {
|
|
21869
|
+
router.push(buildPath("/login"));
|
|
21870
|
+
return null;
|
|
21871
|
+
}
|
|
21872
|
+
const onSubmit = async (data) => {
|
|
21873
|
+
setIsSubmitting(true);
|
|
21874
|
+
setStatus(null);
|
|
21875
|
+
try {
|
|
21876
|
+
await changePassword(data.currentPassword, data.newPassword);
|
|
21877
|
+
setStatus({ type: "success", message: "Password updated successfully" });
|
|
21878
|
+
setTimeout(() => router.push(buildPath("/account")), 600);
|
|
21879
|
+
} catch (error) {
|
|
21880
|
+
setStatus({
|
|
21881
|
+
type: "error",
|
|
21882
|
+
message: error?.response?.data?.message || "Unable to update password"
|
|
21883
|
+
});
|
|
21884
|
+
} finally {
|
|
21885
|
+
setIsSubmitting(false);
|
|
21886
|
+
}
|
|
21887
|
+
};
|
|
21888
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-screen bg-slate-50 text-slate-900", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 pb-16 pt-10", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21889
|
+
framerMotion.motion.div,
|
|
21890
|
+
{
|
|
21891
|
+
initial: { opacity: 0, y: 18 },
|
|
21892
|
+
animate: { opacity: 1, y: 0 },
|
|
21893
|
+
className: "mx-auto max-w-2xl rounded-3xl border border-slate-200 bg-white p-8 shadow-xl shadow-primary-50",
|
|
21894
|
+
children: [
|
|
21895
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
21896
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-11 w-11 items-center justify-center rounded-2xl bg-primary-50 text-primary-600", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Lock, { className: "h-5 w-5" }) }),
|
|
21897
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
21898
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-semibold uppercase tracking-[0.32em] text-slate-500", children: "Security" }),
|
|
21899
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-semibold text-slate-900", children: "Change password" })
|
|
21900
|
+
] })
|
|
21746
21901
|
] }),
|
|
21747
|
-
/* @__PURE__ */ jsxRuntime.
|
|
21902
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-3 text-sm text-slate-600", children: "Use a strong password that you have not used elsewhere. Updating your password will sign you out of other active sessions." }),
|
|
21903
|
+
status && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21904
|
+
"div",
|
|
21905
|
+
{
|
|
21906
|
+
className: `mt-4 flex items-start gap-2 rounded-2xl border px-4 py-3 text-sm ${status.type === "success" ? "border-green-200 bg-green-50 text-green-800" : "border-red-200 bg-red-50 text-red-700"}`,
|
|
21907
|
+
children: [
|
|
21908
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-[2px] text-base", children: status.type === "success" ? "\u2714" : "!" }),
|
|
21909
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: status.message })
|
|
21910
|
+
]
|
|
21911
|
+
}
|
|
21912
|
+
),
|
|
21913
|
+
/* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "mt-8 space-y-5", children: [
|
|
21748
21914
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21749
|
-
|
|
21915
|
+
Input,
|
|
21750
21916
|
{
|
|
21751
|
-
|
|
21752
|
-
|
|
21753
|
-
|
|
21754
|
-
|
|
21755
|
-
|
|
21917
|
+
type: "password",
|
|
21918
|
+
label: "Current password",
|
|
21919
|
+
placeholder: "Enter current password",
|
|
21920
|
+
...register("currentPassword"),
|
|
21921
|
+
error: errors.currentPassword?.message
|
|
21756
21922
|
}
|
|
21757
21923
|
),
|
|
21758
21924
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21759
|
-
|
|
21925
|
+
Input,
|
|
21760
21926
|
{
|
|
21761
|
-
|
|
21762
|
-
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21927
|
+
type: "password",
|
|
21928
|
+
label: "New password",
|
|
21929
|
+
placeholder: "Enter new password",
|
|
21930
|
+
...register("newPassword"),
|
|
21931
|
+
error: errors.newPassword?.message
|
|
21766
21932
|
}
|
|
21767
|
-
)
|
|
21768
|
-
|
|
21769
|
-
|
|
21770
|
-
|
|
21771
|
-
|
|
21772
|
-
|
|
21773
|
-
|
|
21774
|
-
|
|
21775
|
-
|
|
21776
|
-
|
|
21777
|
-
|
|
21778
|
-
|
|
21779
|
-
|
|
21780
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] text-white/60 font-medium", children: "Click to synchronize with account" })
|
|
21781
|
-
] }),
|
|
21933
|
+
),
|
|
21934
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21935
|
+
Input,
|
|
21936
|
+
{
|
|
21937
|
+
type: "password",
|
|
21938
|
+
label: "Confirm new password",
|
|
21939
|
+
placeholder: "Re-type new password",
|
|
21940
|
+
...register("confirmPassword"),
|
|
21941
|
+
error: errors.confirmPassword?.message
|
|
21942
|
+
}
|
|
21943
|
+
),
|
|
21944
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-3", children: [
|
|
21945
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", size: "lg", isLoading: isSubmitting, children: "Save password" }),
|
|
21782
21946
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21783
21947
|
Button,
|
|
21784
21948
|
{
|
|
21785
|
-
|
|
21786
|
-
|
|
21787
|
-
|
|
21788
|
-
|
|
21789
|
-
|
|
21790
|
-
children:
|
|
21949
|
+
type: "button",
|
|
21950
|
+
variant: "outline-solid",
|
|
21951
|
+
size: "lg",
|
|
21952
|
+
className: "border-slate-300 text-slate-800 hover:bg-slate-50",
|
|
21953
|
+
onClick: () => router.push(buildPath("/account")),
|
|
21954
|
+
children: "Cancel"
|
|
21791
21955
|
}
|
|
21792
21956
|
)
|
|
21793
21957
|
] })
|
|
21794
|
-
}
|
|
21795
|
-
|
|
21796
|
-
|
|
21797
|
-
|
|
21958
|
+
] }),
|
|
21959
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-6 flex items-center gap-2 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-600", children: [
|
|
21960
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ShieldCheck, { className: "h-4 w-4 text-primary-600" }),
|
|
21961
|
+
"Strong passwords and up-to-date contact details help pharmacists verify changes quickly."
|
|
21962
|
+
] })
|
|
21963
|
+
]
|
|
21964
|
+
}
|
|
21965
|
+
) }) });
|
|
21798
21966
|
}
|
|
21799
21967
|
function NotificationBell() {
|
|
21800
21968
|
const { unreadCount, openDrawer } = useNotificationCenter();
|
|
@@ -22179,6 +22347,7 @@ exports.CampaignDraftSendingDtoStatusEnum = CampaignDraftSendingDtoStatusEnum;
|
|
|
22179
22347
|
exports.CartItem = CartItem;
|
|
22180
22348
|
exports.CartProvider = CartProvider;
|
|
22181
22349
|
exports.CartScreen = CartScreen;
|
|
22350
|
+
exports.ChangePasswordScreen = ChangePasswordScreen;
|
|
22182
22351
|
exports.CheckoutScreen = CheckoutScreen;
|
|
22183
22352
|
exports.CreateAddressDtoAddressTypeEnum = CreateAddressDtoAddressTypeEnum;
|
|
22184
22353
|
exports.CreateDiscountDtoStateEnum = CreateDiscountDtoStateEnum;
|
|
@@ -22212,6 +22381,7 @@ exports.NotificationDrawer = NotificationDrawer;
|
|
|
22212
22381
|
exports.NotificationSettingsScreen = NotificationSettingsScreen;
|
|
22213
22382
|
exports.OrderCard = OrderCard;
|
|
22214
22383
|
exports.OrderCardSkeleton = OrderCardSkeleton;
|
|
22384
|
+
exports.OrderDetailScreen = OrderDetailScreen;
|
|
22215
22385
|
exports.OrderOrderTypeEnum = OrderOrderTypeEnum;
|
|
22216
22386
|
exports.OrderReviewsScreen = OrderReviewsScreen;
|
|
22217
22387
|
exports.OrderTimeLineDTOTypeEnum = OrderTimeLineDTOTypeEnum;
|