@simpleapps-com/augur-hooks 2.2.10 → 2.2.12
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/EXPORTS.md +3 -3
- package/README.md +267 -0
- package/dist/{cart-pricing-BF0FTKmm.d.cts → cart-pricing-DGlwKSqt.d.cts} +3 -2
- package/dist/{cart-pricing-BF0FTKmm.d.ts → cart-pricing-DGlwKSqt.d.ts} +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js.map +1 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +3 -2
- package/dist/server.d.ts +3 -2
- package/dist/server.js.map +1 -1
- package/llms.txt +121 -1
- package/package.json +4 -4
package/llms.txt
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
|
+
# Augur Platform Packages
|
|
2
|
+
|
|
3
|
+
This package is part of the @simpleapps-com/augur-* platform.
|
|
4
|
+
All packages use fixed versioning (same version number).
|
|
5
|
+
The proxy pattern (createServerQueryProxy) is the primary data fetching API.
|
|
6
|
+
Pure transform utilities bridge user-facing types to SDK params without breaking proxy type safety.
|
|
7
|
+
|
|
8
|
+
## Sibling packages
|
|
9
|
+
|
|
10
|
+
- @simpleapps-com/augur-config - Shared tooling configuration presets for Augur ecommerce sites
|
|
11
|
+
- @simpleapps-com/augur-core - Universal foundation for Augur packages — proxy infrastructure, cache keys, method classification, shared types
|
|
12
|
+
- @simpleapps-com/augur-hooks (this package) - Cross-platform React Query hooks and Zustand stores for Augur ecommerce sites
|
|
13
|
+
- @simpleapps-com/augur-mobile - React Native/Expo adapters for Augur ecommerce apps (offline sync, biometrics, push)
|
|
14
|
+
- @simpleapps-com/augur-server - Server-side utilities for Augur ecommerce sites (Redis caching, SDK helpers, auth)
|
|
15
|
+
- @simpleapps-com/augur-tailwind - Shared Tailwind CSS v4 theme with HSL variables for Augur ecommerce sites
|
|
16
|
+
- @simpleapps-com/augur-utils - Shared types, cache configuration, and utility functions for Augur ecommerce sites
|
|
17
|
+
- @simpleapps-com/augur-web - Shared React UI components for Augur ecommerce sites (Radix + Tailwind)
|
|
18
|
+
|
|
19
|
+
Each package ships its own llms.txt with exports and usage patterns.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
1
23
|
# @simpleapps-com/augur-hooks
|
|
2
24
|
|
|
3
25
|
> Cross-platform React Query hooks and Zustand stores for Augur ecommerce sites
|
|
4
26
|
|
|
5
|
-
Version: 2.
|
|
27
|
+
Version: 2.2.10
|
|
6
28
|
|
|
7
29
|
## @simpleapps-com/augur-hooks
|
|
8
30
|
|
|
@@ -28,8 +50,10 @@ Version: 2.0.21
|
|
|
28
50
|
- value: SearchSuggestionsResponse
|
|
29
51
|
- function: executeBatchQuery
|
|
30
52
|
- function: getCartPricingQueryOptions
|
|
53
|
+
- function: getRegisteredQueryAction - Returns the registered query action, or null if none registered.
|
|
31
54
|
- value: getStockKey
|
|
32
55
|
- value: getStockOptions
|
|
56
|
+
- function: registerQueryAction - Register a query action function (called by augur-server/hooks.ts on import).
|
|
33
57
|
- function: useAugurApi
|
|
34
58
|
- value: useAugurApiOptional
|
|
35
59
|
- value: useAugurAuth
|
|
@@ -69,6 +93,84 @@ Version: 2.0.21
|
|
|
69
93
|
- type: UseFormatPriceOptions
|
|
70
94
|
- type: UseStockOptions
|
|
71
95
|
|
|
96
|
+
### Examples
|
|
97
|
+
|
|
98
|
+
useAugurPersistence:
|
|
99
|
+
```tsx
|
|
100
|
+
import { useAugurPersistence } from "@simpleapps-com/augur-hooks";
|
|
101
|
+
|
|
102
|
+
function Providers({ children }) {
|
|
103
|
+
const [queryClient] = useState(() => new QueryClient({ ... }));
|
|
104
|
+
const persistOptions = useAugurPersistence({
|
|
105
|
+
key: "my-site-cache",
|
|
106
|
+
buster: "1.0.0",
|
|
107
|
+
persistableKeys: ["price", "categories", "invMast"],
|
|
108
|
+
limits: { invMast: 100 },
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<PersistQueryClientProvider client={queryClient} persistOptions={persistOptions}>
|
|
113
|
+
<augur.Provider api={api} auth={auth}>
|
|
114
|
+
{children}
|
|
115
|
+
</augur.Provider>
|
|
116
|
+
</PersistQueryClientProvider>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
useCartActions:
|
|
122
|
+
```tsx
|
|
123
|
+
import { useCartActions } from "@simpleapps-com/augur-hooks";
|
|
124
|
+
import { addToCart, updateCartLines, deleteItemsFromCart } from "@/lib/actions/commerce";
|
|
125
|
+
import { toast } from "react-toastify";
|
|
126
|
+
|
|
127
|
+
const cart = useCartActions({
|
|
128
|
+
addToCart, updateCartLines, deleteItemsFromCart,
|
|
129
|
+
toast: { info: toast.info, error: toast.error },
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
await cart.addToCart({ invMastUid: 123, quantity: 1, unitOfMeasure: "EA" });
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
useCartInitialization:
|
|
136
|
+
```tsx
|
|
137
|
+
import { useCartInitialization } from "@simpleapps-com/augur-hooks";
|
|
138
|
+
import { useSession } from "next-auth/react";
|
|
139
|
+
import { cartHdrLookup, getCartLines } from "@/lib/actions/commerce";
|
|
140
|
+
|
|
141
|
+
function CartInitializer() {
|
|
142
|
+
const { data: session, status } = useSession();
|
|
143
|
+
|
|
144
|
+
// Minimal setup — token storage defaults to localStorage,
|
|
145
|
+
// token generation defaults to crypto.randomUUID().
|
|
146
|
+
useCartInitialization(
|
|
147
|
+
{
|
|
148
|
+
status,
|
|
149
|
+
userId: session?.user?.id,
|
|
150
|
+
cartHdrUid: session?.user?.cartHdrUid,
|
|
151
|
+
},
|
|
152
|
+
{ cartHdrLookup, getCartLines },
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
usePaymentFlow:
|
|
160
|
+
```tsx
|
|
161
|
+
import { usePaymentFlow } from "@simpleapps-com/augur-hooks";
|
|
162
|
+
import { transactionSetup, cardInfo, validatePayment, accountQuery, billingUpdate } from "@/lib/actions/payments";
|
|
163
|
+
|
|
164
|
+
const payment = usePaymentFlow({
|
|
165
|
+
callbacks: { transactionSetup, cardInfo, validatePayment, accountQuery, billingUpdate },
|
|
166
|
+
customerId,
|
|
167
|
+
billingAddress,
|
|
168
|
+
paymentMethod: "credit-card",
|
|
169
|
+
shippingAccepted: true,
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
|
|
72
174
|
## @simpleapps-com/augur-hooks/server
|
|
73
175
|
|
|
74
176
|
- value: AugurAuthContext
|
|
@@ -84,6 +186,24 @@ Version: 2.0.21
|
|
|
84
186
|
- type: BatchQueryConfig
|
|
85
187
|
- type: PageData
|
|
86
188
|
|
|
189
|
+
### Examples
|
|
190
|
+
|
|
191
|
+
createAugurOptions:
|
|
192
|
+
```ts
|
|
193
|
+
// With SDK client (traditional)
|
|
194
|
+
const q = createAugurOptions(site.client, cacheConfig);
|
|
195
|
+
|
|
196
|
+
// With queryAction (server-only JWT sites)
|
|
197
|
+
import { queryAction } from "@simpleapps-com/augur-server/query-action";
|
|
198
|
+
const q = createAugurOptions(queryAction, cacheConfig);
|
|
199
|
+
|
|
200
|
+
// With auto-registered queryAction (zero args -- requires augur-server/hooks import)
|
|
201
|
+
const q = createAugurOptions();
|
|
202
|
+
|
|
203
|
+
await queryClient.prefetchQuery(q.items.invMast.doc.get(42));
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
|
|
87
207
|
## @simpleapps-com/augur-hooks/web
|
|
88
208
|
|
|
89
209
|
- function: MobileProvider - Optional provider that tracks hydration state.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simpleapps-com/augur-hooks",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.12",
|
|
4
4
|
"description": "Cross-platform React Query hooks and Zustand stores for Augur ecommerce sites",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"llms.txt"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@simpleapps-com/augur-core": "2.2.
|
|
37
|
-
"@simpleapps-com/augur-utils": "2.2.
|
|
36
|
+
"@simpleapps-com/augur-core": "2.2.12",
|
|
37
|
+
"@simpleapps-com/augur-utils": "2.2.12"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@simpleapps-com/augur-api": "^2026.3.
|
|
40
|
+
"@simpleapps-com/augur-api": "^2026.3.7",
|
|
41
41
|
"@tanstack/react-query": "^5.80.0",
|
|
42
42
|
"@tanstack/react-query-persist-client": "^5.80.0",
|
|
43
43
|
"react": "^19.0.0",
|