hey-pharmacist-ecommerce 1.1.31 → 1.1.32
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.js +92 -267
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -268
- 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/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,173 +21541,83 @@ 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: "
|
|
21663
|
-
|
|
21664
|
-
|
|
21665
|
-
|
|
21666
|
-
|
|
21667
|
-
|
|
21668
|
-
|
|
21669
|
-
|
|
21670
|
-
|
|
21671
|
-
|
|
21672
|
-
|
|
21673
|
-
|
|
21674
|
-
|
|
21675
|
-
}
|
|
21676
|
-
),
|
|
21677
|
-
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: expandedCategories.has(category.name) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
21678
|
-
framerMotion.motion.div,
|
|
21679
|
-
{
|
|
21680
|
-
initial: { height: 0, opacity: 0 },
|
|
21681
|
-
animate: { height: "auto", opacity: 1 },
|
|
21682
|
-
exit: { height: 0, opacity: 0 },
|
|
21683
|
-
transition: { duration: 0.2 },
|
|
21684
|
-
className: "border-t border-slate-100",
|
|
21685
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6 space-y-4", children: category.types.map((notifType) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
21686
|
-
"div",
|
|
21687
|
-
{
|
|
21688
|
-
className: `rounded-xl border border-slate-200 bg-slate-50 p-4 transition-all hover:bg-white hover:shadow-sm ${notifType.isComingSoon ? "opacity-50 grayscale select-none" : ""}`,
|
|
21689
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center justify-between gap-6", children: [
|
|
21690
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
|
|
21691
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
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 })
|
|
21696
|
-
] }),
|
|
21697
|
-
!notifType.isComingSoon && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-6 sm:border-l sm:border-slate-200 sm:pl-6", children: [
|
|
21698
|
-
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center gap-2 cursor-pointer group/label", children: [
|
|
21699
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21700
|
-
"input",
|
|
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" })
|
|
21721
|
-
] }),
|
|
21722
|
-
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center gap-2 cursor-pointer group/label", children: [
|
|
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
|
-
] })
|
|
21734
|
-
] })
|
|
21735
|
-
] })
|
|
21736
|
-
},
|
|
21737
|
-
notifType.type
|
|
21738
|
-
)) })
|
|
21739
|
-
}
|
|
21740
|
-
) })
|
|
21741
|
-
] }, category.name)) }),
|
|
21742
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white rounded-2xl p-6 border border-slate-200 mb-8 shadow-xs", children: [
|
|
21743
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
|
|
21744
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Zap, { className: "h-5 w-5 text-accent" }),
|
|
21745
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-secondary", children: "Quick Actions" })
|
|
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 })
|
|
21746
21566
|
] }),
|
|
21747
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
21748
|
-
/* @__PURE__ */ jsxRuntime.
|
|
21749
|
-
|
|
21750
|
-
{
|
|
21751
|
-
variant: "outline-solid",
|
|
21752
|
-
size: "sm",
|
|
21753
|
-
onClick: () => disableAllChannel("email"),
|
|
21754
|
-
className: "rounded-xl border-slate-200 hover:bg-slate-50",
|
|
21755
|
-
children: "Disable All Emails"
|
|
21756
|
-
}
|
|
21757
|
-
),
|
|
21758
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21759
|
-
Button,
|
|
21760
|
-
{
|
|
21761
|
-
variant: "outline-solid",
|
|
21762
|
-
size: "sm",
|
|
21763
|
-
onClick: () => disableAllChannel("push"),
|
|
21764
|
-
className: "rounded-xl border-slate-200 hover:bg-slate-50",
|
|
21765
|
-
children: "Disable All Push"
|
|
21766
|
-
}
|
|
21767
|
-
)
|
|
21768
|
-
] })
|
|
21769
|
-
] }),
|
|
21770
|
-
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: hasChanges && /* @__PURE__ */ jsxRuntime.jsx(
|
|
21771
|
-
framerMotion.motion.div,
|
|
21772
|
-
{
|
|
21773
|
-
initial: { opacity: 0, y: 100 },
|
|
21774
|
-
animate: { opacity: 1, y: 0 },
|
|
21775
|
-
exit: { opacity: 0, y: 100 },
|
|
21776
|
-
className: "fixed bottom-10 left-0 right-0 flex justify-center z-50 pointer-events-none",
|
|
21777
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pointer-events-auto px-6 py-4 bg-secondary shadow-lg rounded-3xl flex items-center gap-8 max-w-xl mx-auto transform hover:scale-[1.02] transition-all duration-300 ease-out border border-white/10", children: [
|
|
21778
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "hidden sm:block", children: [
|
|
21779
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-bold text-white leading-tight tracking-wide italic", children: "Changes Pending" }),
|
|
21780
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] text-white/60 font-medium", children: "Click to synchronize with account" })
|
|
21781
|
-
] }),
|
|
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" }),
|
|
21782
21570
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21783
|
-
|
|
21571
|
+
Switch,
|
|
21784
21572
|
{
|
|
21785
|
-
|
|
21786
|
-
|
|
21787
|
-
disabled:
|
|
21788
|
-
|
|
21789
|
-
|
|
21790
|
-
|
|
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
|
|
21791
21587
|
}
|
|
21792
21588
|
)
|
|
21793
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"
|
|
21794
21619
|
}
|
|
21795
|
-
)
|
|
21620
|
+
)
|
|
21796
21621
|
] })
|
|
21797
21622
|
] });
|
|
21798
21623
|
}
|