hey-pharmacist-ecommerce 1.1.5 → 1.1.7

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.5",
3
+ "version": "1.1.7",
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);
@@ -37,12 +37,16 @@ globalAxios.interceptors.request.use(async (config) => {
37
37
  return config;
38
38
  });
39
39
 
40
- const ABORT_CONTROLLER = new AbortController();
40
+ // Lazy-init AbortController only on client to avoid SSR errors
41
+ let abortController: AbortController | undefined;
42
+ if (typeof window !== 'undefined') {
43
+ abortController = new AbortController();
44
+ }
41
45
 
42
46
  export const AXIOS_CONFIG = new Configuration({
43
47
  basePath: BaseUrl,
44
48
  baseOptions: {
45
- signal: ABORT_CONTROLLER.signal,
49
+ signal: abortController?.signal,
46
50
  timeout: 20000,
47
51
  },
48
52
  });