hey-pharmacist-ecommerce 1.1.4 → 1.1.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hey-pharmacist-ecommerce",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Production-ready, multi-tenant e‑commerce UI + API adapter for Next.js with auth, carts, checkout, orders, theming, and pharmacist-focused UX.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,4 +1,4 @@
1
- import { useState } from 'react';
1
+ import { useState, useEffect } from 'react';
2
2
  import { useForm } from 'react-hook-form';
3
3
  import { zodResolver } from '@hookform/resolvers/zod';
4
4
  import { Button } from '@/components/ui/Button';
@@ -41,10 +41,18 @@ export function AddressFormModal({ isOpen, onClose, onAddressAdded, onAddressUpd
41
41
  });
42
42
 
43
43
  // Reset form when switching between create/edit
44
- // eslint-disable-next-line react-hooks/rules-of-hooks
45
- useState(() => {
46
- // Using useState initializer to avoid extra render; react-hook-form defaultValues handle initial load
47
- });
44
+ useEffect(() => {
45
+ reset({
46
+ name: initialAddress?.name || '',
47
+ phone: initialAddress?.phone || '',
48
+ street1: initialAddress?.street1 || '',
49
+ street2: initialAddress?.street2 || '',
50
+ city: initialAddress?.city || '',
51
+ state: initialAddress?.state || '',
52
+ zip: initialAddress?.zip || '',
53
+ country: initialAddress?.country || 'United States',
54
+ });
55
+ }, [initialAddress, reset]);
48
56
 
49
57
  const onSubmit = async (data: AddressFormData) => {
50
58
  setIsSubmitting(true);
@@ -14,6 +14,8 @@ interface ModalProps {
14
14
 
15
15
  export function Modal({ isOpen, onClose, title, children, size = 'md' }: ModalProps) {
16
16
  useEffect(() => {
17
+ if (typeof window === 'undefined') return;
18
+
17
19
  if (isOpen) {
18
20
  document.body.style.overflow = 'hidden';
19
21
  } else {