medusa-contact-logic-plugin 1.1.1 → 1.1.2

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.
Files changed (2) hide show
  1. package/README.md +53 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # Medusa Contact Logic Plugin
2
+
3
+ A lightweight React hook for handling contact form logic in Medusa storefronts.
4
+
5
+ ## Features
6
+ - Easy integration with Medusa backend.
7
+ - Handles loading, success, and error states.
8
+ - Support for Medusa publishable keys.
9
+ - Works with both React and Next.js.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install medusa-contact-logic-plugin
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```typescript
20
+ import { useContactForm } from 'medusa-contact-logic-plugin';
21
+
22
+ const MyComponent = () => {
23
+ const { status, message, handleSubmit } = useContactForm({
24
+ baseUrl: 'https://your-medusa-url.com',
25
+ publishableKey: 'pk_...', // Optional
26
+ onComplete: (data) => console.log('Form sent:', data)
27
+ });
28
+
29
+ return (
30
+ <form onSubmit={handleSubmit}>
31
+ <input name="email" type="email" required placeholder="Your Email" />
32
+ <textarea name="message" required placeholder="Your Message" />
33
+
34
+ <button type="submit" disabled={status === 'pending'}>
35
+ {status === 'pending' ? 'Sending...' : 'Send Message'}
36
+ </button>
37
+
38
+ {message && <p>{message}</p>}
39
+ </form>
40
+ );
41
+ };
42
+ ```
43
+
44
+ ## Props
45
+
46
+ | Prop | Type | Description |
47
+ | :--- | :--- | :--- |
48
+ | `baseUrl` | `string` | Your Medusa Backend URL. |
49
+ | `publishableKey` | `string` | (Optional) Your Medusa Publishable API Key. |
50
+ | `onComplete` | `(data: any) => void` | (Optional) Callback after successful submission. |
51
+
52
+ ## License
53
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "medusa-contact-logic-plugin",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "main": "./dist/ui-library.umd.cjs",
6
6
  "module": "./dist/ui-library.js",