@attabot/product-app 1.0.2 → 1.0.3
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/README.md +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,9 +64,33 @@ export default App;
|
|
|
64
64
|
|------|------|----------|---------|-------------|
|
|
65
65
|
| `apiUrl` | `string` | Yes | `import.meta.env.VITE_API_URL` or `process.env.VITE_API_URL` if provided | The base API URL for all API calls |
|
|
66
66
|
| `authToken` | `string` | No | - | Optional bearer token to pre-seed auth |
|
|
67
|
+
| `auth` | `object` | No | `null` | Auth object from host app `{ user, token, permissions, ... }` |
|
|
67
68
|
| `basePath` | `string` | No | `'/'` | Base path for routing |
|
|
69
|
+
| `onAllStoresClick` | `function` | No | - | Callback when "All Stores" is clicked. Receives `{ stores, selectedStores, filters, updateSelection }` |
|
|
70
|
+
| `onStoreSelect` | `function` | No | - | Callback when stores are selected. Receives `(selectedStoreIds, storeData)` |
|
|
71
|
+
| `StoresModal` | `React.Component` | No | - | Custom modal component to render for store selection |
|
|
72
|
+
| `storesModalProps` | `object` | No | `{}` | Additional props to pass to your StoresModal component |
|
|
68
73
|
| `theme` | `object` | No | - | Theme configuration (coming soon) |
|
|
69
74
|
|
|
75
|
+
### Custom Store Modal
|
|
76
|
+
|
|
77
|
+
You can provide your own modal that opens when "All Stores" is clicked:
|
|
78
|
+
|
|
79
|
+
```jsx
|
|
80
|
+
<ProductApp
|
|
81
|
+
apiUrl="https://your-api-url.com/api"
|
|
82
|
+
onAllStoresClick={({ stores, selectedStores, updateSelection }) => {
|
|
83
|
+
// Open your modal here
|
|
84
|
+
// Use updateSelection(newStoreIds) to update the filter
|
|
85
|
+
}}
|
|
86
|
+
onStoreSelect={(selectedIds, stores) => {
|
|
87
|
+
// Make API calls when stores change
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
See [USAGE_EXAMPLE.md](./USAGE_EXAMPLE.md) for detailed examples.
|
|
93
|
+
|
|
70
94
|
## API Requirements
|
|
71
95
|
|
|
72
96
|
The package expects your API to have the following endpoint:
|
package/package.json
CHANGED