hey-pharmacist-ecommerce 1.1.26 → 1.1.28
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 +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +151 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +152 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/providers/WishlistProvider.tsx +2 -2
- package/src/screens/EditProfileScreen.tsx +5 -1
package/dist/index.d.mts
CHANGED
|
@@ -3666,7 +3666,7 @@ declare class Configuration {
|
|
|
3666
3666
|
}
|
|
3667
3667
|
|
|
3668
3668
|
interface WishlistContextType extends Wishlist {
|
|
3669
|
-
addToWishlist: (product:
|
|
3669
|
+
addToWishlist: (product: ExtendedProductDTO) => Promise<void>;
|
|
3670
3670
|
removeFromWishlist: (productId: string) => Promise<void>;
|
|
3671
3671
|
isInWishlist: (productId: string) => boolean;
|
|
3672
3672
|
getWishlistCount: () => number;
|
|
@@ -3717,6 +3717,8 @@ declare function SearchPage(): react_jsx_runtime.JSX.Element;
|
|
|
3717
3717
|
|
|
3718
3718
|
declare function NewAddressPage(): react_jsx_runtime.JSX.Element;
|
|
3719
3719
|
|
|
3720
|
+
declare function EditProfileScreen(): react_jsx_runtime.JSX.Element | null;
|
|
3721
|
+
|
|
3720
3722
|
declare function Header(): react_jsx_runtime.JSX.Element;
|
|
3721
3723
|
|
|
3722
3724
|
declare function Footer(): react_jsx_runtime.JSX.Element;
|
|
@@ -3902,4 +3904,4 @@ declare function generateColorShades(baseColor: string): {
|
|
|
3902
3904
|
950: string;
|
|
3903
3905
|
};
|
|
3904
3906
|
|
|
3905
|
-
export { AddressesScreen, AuthProvider, Badge, Button, CartItem, CartProvider, CartScreen, type Category, CheckoutScreen, CurrentOrdersScreen, type EcommerceConfig, EcommerceProvider, EmptyState, Footer, Header, Input, LoginScreen, Modal, NewAddressPage as NewAddressScreen, OrderCard, OrderCardSkeleton, OrderStatus, OrdersScreen, ProductCard, ProductCardSkeleton, ProductDetailScreen, type ProductFilters, AccountPage as ProfileScreen, RegisterScreen, SearchPage as SearchResultsScreen, ShopScreen, Skeleton, ThemeProvider, WishlistProvider, WishlistScreen, formatDate, formatPrice, generateColorShades, getApiConfiguration, getInitials, hexToRgb, initializeApiAdapter, truncate, useAddresses, useAuth, useBasePath, useCart, useCategories, useCurrentOrders, useOrder, useOrders, useProduct, useProducts, useTheme, useWishlist };
|
|
3907
|
+
export { AddressesScreen, AuthProvider, Badge, Button, CartItem, CartProvider, CartScreen, type Category, CheckoutScreen, CurrentOrdersScreen, type EcommerceConfig, EcommerceProvider, EditProfileScreen, EmptyState, Footer, Header, Input, LoginScreen, Modal, NewAddressPage as NewAddressScreen, OrderCard, OrderCardSkeleton, OrderStatus, OrdersScreen, ProductCard, ProductCardSkeleton, ProductDetailScreen, type ProductFilters, AccountPage as ProfileScreen, RegisterScreen, SearchPage as SearchResultsScreen, ShopScreen, Skeleton, ThemeProvider, WishlistProvider, WishlistScreen, formatDate, formatPrice, generateColorShades, getApiConfiguration, getInitials, hexToRgb, initializeApiAdapter, truncate, useAddresses, useAuth, useBasePath, useCart, useCategories, useCurrentOrders, useOrder, useOrders, useProduct, useProducts, useTheme, useWishlist };
|
package/dist/index.d.ts
CHANGED
|
@@ -3666,7 +3666,7 @@ declare class Configuration {
|
|
|
3666
3666
|
}
|
|
3667
3667
|
|
|
3668
3668
|
interface WishlistContextType extends Wishlist {
|
|
3669
|
-
addToWishlist: (product:
|
|
3669
|
+
addToWishlist: (product: ExtendedProductDTO) => Promise<void>;
|
|
3670
3670
|
removeFromWishlist: (productId: string) => Promise<void>;
|
|
3671
3671
|
isInWishlist: (productId: string) => boolean;
|
|
3672
3672
|
getWishlistCount: () => number;
|
|
@@ -3717,6 +3717,8 @@ declare function SearchPage(): react_jsx_runtime.JSX.Element;
|
|
|
3717
3717
|
|
|
3718
3718
|
declare function NewAddressPage(): react_jsx_runtime.JSX.Element;
|
|
3719
3719
|
|
|
3720
|
+
declare function EditProfileScreen(): react_jsx_runtime.JSX.Element | null;
|
|
3721
|
+
|
|
3720
3722
|
declare function Header(): react_jsx_runtime.JSX.Element;
|
|
3721
3723
|
|
|
3722
3724
|
declare function Footer(): react_jsx_runtime.JSX.Element;
|
|
@@ -3902,4 +3904,4 @@ declare function generateColorShades(baseColor: string): {
|
|
|
3902
3904
|
950: string;
|
|
3903
3905
|
};
|
|
3904
3906
|
|
|
3905
|
-
export { AddressesScreen, AuthProvider, Badge, Button, CartItem, CartProvider, CartScreen, type Category, CheckoutScreen, CurrentOrdersScreen, type EcommerceConfig, EcommerceProvider, EmptyState, Footer, Header, Input, LoginScreen, Modal, NewAddressPage as NewAddressScreen, OrderCard, OrderCardSkeleton, OrderStatus, OrdersScreen, ProductCard, ProductCardSkeleton, ProductDetailScreen, type ProductFilters, AccountPage as ProfileScreen, RegisterScreen, SearchPage as SearchResultsScreen, ShopScreen, Skeleton, ThemeProvider, WishlistProvider, WishlistScreen, formatDate, formatPrice, generateColorShades, getApiConfiguration, getInitials, hexToRgb, initializeApiAdapter, truncate, useAddresses, useAuth, useBasePath, useCart, useCategories, useCurrentOrders, useOrder, useOrders, useProduct, useProducts, useTheme, useWishlist };
|
|
3907
|
+
export { AddressesScreen, AuthProvider, Badge, Button, CartItem, CartProvider, CartScreen, type Category, CheckoutScreen, CurrentOrdersScreen, type EcommerceConfig, EcommerceProvider, EditProfileScreen, EmptyState, Footer, Header, Input, LoginScreen, Modal, NewAddressPage as NewAddressScreen, OrderCard, OrderCardSkeleton, OrderStatus, OrdersScreen, ProductCard, ProductCardSkeleton, ProductDetailScreen, type ProductFilters, AccountPage as ProfileScreen, RegisterScreen, SearchPage as SearchResultsScreen, ShopScreen, Skeleton, ThemeProvider, WishlistProvider, WishlistScreen, formatDate, formatPrice, generateColorShades, getApiConfiguration, getInitials, hexToRgb, initializeApiAdapter, truncate, useAddresses, useAuth, useBasePath, useCart, useCategories, useCurrentOrders, useOrder, useOrders, useProduct, useProducts, useTheme, useWishlist };
|
package/dist/index.js
CHANGED
|
@@ -13562,6 +13562,156 @@ function NewAddressPage() {
|
|
|
13562
13562
|
] }) }) }) })
|
|
13563
13563
|
] });
|
|
13564
13564
|
}
|
|
13565
|
+
var profileSchema = zod.z.object({
|
|
13566
|
+
firstname: zod.z.string().min(2, "First name is required"),
|
|
13567
|
+
lastname: zod.z.string().min(2, "Last name is required"),
|
|
13568
|
+
email: zod.z.string().email("Enter a valid email address"),
|
|
13569
|
+
phoneNumber: zod.z.string().optional()
|
|
13570
|
+
});
|
|
13571
|
+
function EditProfileScreen() {
|
|
13572
|
+
const router = navigation.useRouter();
|
|
13573
|
+
const { user, updateUser } = useAuth();
|
|
13574
|
+
const { buildPath } = useBasePath();
|
|
13575
|
+
const [isSubmitting, setIsSubmitting] = React8.useState(false);
|
|
13576
|
+
const [status, setStatus] = React8.useState(
|
|
13577
|
+
null
|
|
13578
|
+
);
|
|
13579
|
+
const {
|
|
13580
|
+
register,
|
|
13581
|
+
handleSubmit,
|
|
13582
|
+
formState: { errors }
|
|
13583
|
+
} = reactHookForm.useForm({
|
|
13584
|
+
resolver: zod$1.zodResolver(profileSchema),
|
|
13585
|
+
defaultValues: {
|
|
13586
|
+
firstname: user?.firstname || "",
|
|
13587
|
+
lastname: user?.lastname || "",
|
|
13588
|
+
email: user?.email || "",
|
|
13589
|
+
phoneNumber: user?.phoneNumber || ""
|
|
13590
|
+
}
|
|
13591
|
+
});
|
|
13592
|
+
if (!user) {
|
|
13593
|
+
router.push(buildPath("/login"));
|
|
13594
|
+
return null;
|
|
13595
|
+
}
|
|
13596
|
+
const onSubmit = async (data) => {
|
|
13597
|
+
setIsSubmitting(true);
|
|
13598
|
+
setStatus(null);
|
|
13599
|
+
try {
|
|
13600
|
+
await updateUser(data);
|
|
13601
|
+
setStatus({ type: "success", message: "Profile updated successfully" });
|
|
13602
|
+
router.push(buildPath("/account"));
|
|
13603
|
+
} catch (error) {
|
|
13604
|
+
setStatus({
|
|
13605
|
+
type: "error",
|
|
13606
|
+
message: error.response?.data?.message || "Failed to update profile"
|
|
13607
|
+
});
|
|
13608
|
+
} finally {
|
|
13609
|
+
setIsSubmitting(false);
|
|
13610
|
+
}
|
|
13611
|
+
};
|
|
13612
|
+
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(
|
|
13613
|
+
framerMotion.motion.div,
|
|
13614
|
+
{
|
|
13615
|
+
initial: { opacity: 0, y: 18 },
|
|
13616
|
+
animate: { opacity: 1, y: 0 },
|
|
13617
|
+
className: "mx-auto max-w-3xl rounded-3xl border border-slate-200 bg-white p-8 shadow-xl shadow-primary-50",
|
|
13618
|
+
children: [
|
|
13619
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
13620
|
+
/* @__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.User, { className: "h-5 w-5" }) }),
|
|
13621
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
13622
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-semibold uppercase tracking-[0.32em] text-slate-500", children: "Profile" }),
|
|
13623
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-semibold text-slate-900", children: "Edit core information" })
|
|
13624
|
+
] })
|
|
13625
|
+
] }),
|
|
13626
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-3 text-sm text-slate-600", children: "Update your name, email, and contact information so we can keep your deliveries and pharmacist support aligned with your preferences." }),
|
|
13627
|
+
status && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13628
|
+
"div",
|
|
13629
|
+
{
|
|
13630
|
+
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"}`,
|
|
13631
|
+
children: [
|
|
13632
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-[2px] text-base", children: status.type === "success" ? "\u2714" : "!" }),
|
|
13633
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: status.message })
|
|
13634
|
+
]
|
|
13635
|
+
}
|
|
13636
|
+
),
|
|
13637
|
+
/* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "mt-8 space-y-6", children: [
|
|
13638
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
13639
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13640
|
+
Input,
|
|
13641
|
+
{
|
|
13642
|
+
label: "First name",
|
|
13643
|
+
placeholder: "Taylor",
|
|
13644
|
+
...register("firstname"),
|
|
13645
|
+
error: errors.firstname?.message
|
|
13646
|
+
}
|
|
13647
|
+
),
|
|
13648
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13649
|
+
Input,
|
|
13650
|
+
{
|
|
13651
|
+
label: "Last name",
|
|
13652
|
+
placeholder: "Reed",
|
|
13653
|
+
...register("lastname"),
|
|
13654
|
+
error: errors.lastname?.message
|
|
13655
|
+
}
|
|
13656
|
+
)
|
|
13657
|
+
] }),
|
|
13658
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
13659
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13660
|
+
Input,
|
|
13661
|
+
{
|
|
13662
|
+
type: "email",
|
|
13663
|
+
label: "Email address",
|
|
13664
|
+
placeholder: "you@example.com",
|
|
13665
|
+
className: "pl-10",
|
|
13666
|
+
...register("email"),
|
|
13667
|
+
error: errors.email?.message
|
|
13668
|
+
}
|
|
13669
|
+
),
|
|
13670
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mail, { className: "absolute left-3 top-[38px] h-4 w-4 text-slate-400" })
|
|
13671
|
+
] }),
|
|
13672
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
13673
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13674
|
+
Input,
|
|
13675
|
+
{
|
|
13676
|
+
type: "tel",
|
|
13677
|
+
label: "Phone number",
|
|
13678
|
+
placeholder: "+1 (555) 123-4567",
|
|
13679
|
+
className: "pl-10",
|
|
13680
|
+
...register("phoneNumber"),
|
|
13681
|
+
error: errors.phoneNumber?.message
|
|
13682
|
+
}
|
|
13683
|
+
),
|
|
13684
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Phone, { className: "absolute left-3 top-[38px] h-4 w-4 text-slate-400" })
|
|
13685
|
+
] }),
|
|
13686
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-3", children: [
|
|
13687
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13688
|
+
Button,
|
|
13689
|
+
{
|
|
13690
|
+
type: "submit",
|
|
13691
|
+
size: "lg",
|
|
13692
|
+
isLoading: isSubmitting,
|
|
13693
|
+
className: "border-slate-300 text-slate-800 hover:bg-slate-50",
|
|
13694
|
+
variant: "outline-solid",
|
|
13695
|
+
children: "Save changes"
|
|
13696
|
+
}
|
|
13697
|
+
),
|
|
13698
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13699
|
+
Button,
|
|
13700
|
+
{
|
|
13701
|
+
type: "button",
|
|
13702
|
+
variant: "outline-solid",
|
|
13703
|
+
size: "lg",
|
|
13704
|
+
className: "border-slate-300 text-slate-800 hover:bg-slate-50",
|
|
13705
|
+
onClick: () => router.push(buildPath("/account")),
|
|
13706
|
+
children: "Cancel"
|
|
13707
|
+
}
|
|
13708
|
+
)
|
|
13709
|
+
] })
|
|
13710
|
+
] })
|
|
13711
|
+
]
|
|
13712
|
+
}
|
|
13713
|
+
) }) });
|
|
13714
|
+
}
|
|
13565
13715
|
function Header() {
|
|
13566
13716
|
const { config } = useTheme();
|
|
13567
13717
|
const { user, isAuthenticated, logout } = useAuth();
|
|
@@ -13909,6 +14059,7 @@ exports.CartScreen = CartScreen;
|
|
|
13909
14059
|
exports.CheckoutScreen = CheckoutScreen;
|
|
13910
14060
|
exports.CurrentOrdersScreen = CurrentOrdersScreen;
|
|
13911
14061
|
exports.EcommerceProvider = EcommerceProvider;
|
|
14062
|
+
exports.EditProfileScreen = EditProfileScreen;
|
|
13912
14063
|
exports.EmptyState = EmptyState;
|
|
13913
14064
|
exports.Footer = Footer;
|
|
13914
14065
|
exports.Header = Header;
|