@simpleapps-com/augur-hooks 2.0.23 → 2.1.1
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 +10 -118
- package/dist/cart-pricing-D_mSECzx.d.cts +184 -0
- package/dist/cart-pricing-D_mSECzx.d.ts +184 -0
- package/dist/chunk-UMCLTMAJ.cjs +135 -0
- package/dist/chunk-UMCLTMAJ.cjs.map +1 -0
- package/dist/chunk-V2CAXA4X.js +135 -0
- package/dist/chunk-V2CAXA4X.js.map +1 -0
- package/dist/index.cjs +53 -818
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -622
- package/dist/index.d.ts +5 -622
- package/dist/index.js +28 -793
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +2 -84
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +3 -85
- package/dist/server.js.map +1 -1
- package/dist/web.cjs +42 -6
- package/dist/web.cjs.map +1 -1
- package/dist/web.d.cts +16 -3
- package/dist/web.d.ts +16 -3
- package/dist/web.js +40 -4
- package/dist/web.js.map +1 -1
- package/llms.txt +12 -118
- package/package.json +3 -3
- package/dist/chunk-AXCNTEAB.cjs +0 -44
- package/dist/chunk-AXCNTEAB.cjs.map +0 -1
- package/dist/chunk-H7OXSAHP.cjs +0 -748
- package/dist/chunk-H7OXSAHP.cjs.map +0 -1
- package/dist/chunk-LTBEP4MC.js +0 -44
- package/dist/chunk-LTBEP4MC.js.map +0 -1
- package/dist/chunk-QFZHOGID.js +0 -748
- package/dist/chunk-QFZHOGID.js.map +0 -1
- package/dist/customer-quotes-BQYqzomR.d.cts +0 -562
- package/dist/customer-quotes-BQYqzomR.d.ts +0 -562
- package/dist/use-image-with-fallback-DgmtrGZU.d.cts +0 -17
- package/dist/use-image-with-fallback-DgmtrGZU.d.ts +0 -17
package/dist/chunk-QFZHOGID.js
DELETED
|
@@ -1,748 +0,0 @@
|
|
|
1
|
-
// src/queries/stable-stringify.ts
|
|
2
|
-
import { stableStringify } from "@simpleapps-com/augur-core";
|
|
3
|
-
|
|
4
|
-
// src/queries/cache-helper.ts
|
|
5
|
-
function fnv1a(str) {
|
|
6
|
-
let h = 2166136261;
|
|
7
|
-
for (let i = 0; i < str.length; i++) {
|
|
8
|
-
h ^= str.charCodeAt(i);
|
|
9
|
-
h = Math.imul(h, 16777619);
|
|
10
|
-
}
|
|
11
|
-
return (h >>> 0).toString(16).padStart(8, "0");
|
|
12
|
-
}
|
|
13
|
-
async function withCache(provider, tier, methodPath, fn, ...keyArgs) {
|
|
14
|
-
const redisTtl = tier?.redis;
|
|
15
|
-
if (!provider || !redisTtl) return fn();
|
|
16
|
-
const key = `${provider.prefix}sdk:${methodPath}:${fnv1a(stableStringify(keyArgs))}`;
|
|
17
|
-
try {
|
|
18
|
-
const cached = await provider.get(key);
|
|
19
|
-
if (cached != null) return JSON.parse(cached);
|
|
20
|
-
} catch {
|
|
21
|
-
}
|
|
22
|
-
const result = await fn();
|
|
23
|
-
try {
|
|
24
|
-
provider.set(key, JSON.stringify(result), redisTtl).catch(() => {
|
|
25
|
-
});
|
|
26
|
-
} catch {
|
|
27
|
-
}
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// src/queries/item-price.ts
|
|
32
|
-
var getItemPriceKey = (itemId, customerId, quantity = 1) => {
|
|
33
|
-
return ["price", itemId?.toUpperCase() || "", customerId, quantity];
|
|
34
|
-
};
|
|
35
|
-
var getItemPriceOptions = (api, itemId, customerId, quantity = 1, cache) => {
|
|
36
|
-
const tier = cache?.semiStatic;
|
|
37
|
-
return {
|
|
38
|
-
queryKey: getItemPriceKey(itemId, customerId, quantity),
|
|
39
|
-
queryFn: async () => {
|
|
40
|
-
const edgeCache = tier?.edgeCache;
|
|
41
|
-
return withCache(
|
|
42
|
-
cache?.provider,
|
|
43
|
-
tier,
|
|
44
|
-
"pricing.priceEngine.get",
|
|
45
|
-
async () => {
|
|
46
|
-
const response = await api.pricing.priceEngine.get({
|
|
47
|
-
itemId: itemId?.toUpperCase() || "",
|
|
48
|
-
customerId: Number(customerId),
|
|
49
|
-
quantity,
|
|
50
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
51
|
-
});
|
|
52
|
-
return response.data;
|
|
53
|
-
},
|
|
54
|
-
itemId,
|
|
55
|
-
customerId,
|
|
56
|
-
quantity
|
|
57
|
-
);
|
|
58
|
-
},
|
|
59
|
-
staleTime: tier?.staleTime,
|
|
60
|
-
gcTime: tier?.gcTime,
|
|
61
|
-
refetchOnReconnect: true,
|
|
62
|
-
refetchOnWindowFocus: false,
|
|
63
|
-
meta: { persist: true }
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// src/queries/inv-mast-doc.ts
|
|
68
|
-
var getInvMastDocKey = (invMastUid, itemId, includePricing) => {
|
|
69
|
-
return ["invMastDoc", invMastUid, itemId.toUpperCase(), includePricing];
|
|
70
|
-
};
|
|
71
|
-
var getInvMastDocOptions = (api, invMastUid, itemId, includePricing, cache) => {
|
|
72
|
-
const tier = cache?.static;
|
|
73
|
-
return {
|
|
74
|
-
queryKey: getInvMastDocKey(invMastUid, itemId, includePricing),
|
|
75
|
-
queryFn: async () => {
|
|
76
|
-
const edgeCache = tier?.edgeCache;
|
|
77
|
-
return withCache(
|
|
78
|
-
cache?.provider,
|
|
79
|
-
tier,
|
|
80
|
-
"items.invMast.doc.list",
|
|
81
|
-
async () => {
|
|
82
|
-
const response = await api.items.invMast.doc.list(invMastUid, {
|
|
83
|
-
itemId: itemId.toUpperCase(),
|
|
84
|
-
includePricing,
|
|
85
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
86
|
-
});
|
|
87
|
-
if (!response.data) throw new Error("Item not found");
|
|
88
|
-
return response.data;
|
|
89
|
-
},
|
|
90
|
-
invMastUid,
|
|
91
|
-
itemId,
|
|
92
|
-
includePricing
|
|
93
|
-
);
|
|
94
|
-
},
|
|
95
|
-
staleTime: tier?.staleTime,
|
|
96
|
-
gcTime: tier?.gcTime
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// src/queries/item-category.ts
|
|
101
|
-
var getItemCategoryKey = (itemCategoryUid, apiOptions) => {
|
|
102
|
-
return ["itemCategory", itemCategoryUid, apiOptions];
|
|
103
|
-
};
|
|
104
|
-
var getItemCategoryOptions = (api, itemCategoryUid, apiOptions, cache) => {
|
|
105
|
-
const tier = cache?.static;
|
|
106
|
-
return {
|
|
107
|
-
queryKey: getItemCategoryKey(itemCategoryUid, apiOptions),
|
|
108
|
-
queryFn: async () => {
|
|
109
|
-
const edgeCache = tier?.edgeCache;
|
|
110
|
-
return withCache(
|
|
111
|
-
cache?.provider,
|
|
112
|
-
tier,
|
|
113
|
-
"items.categories.get",
|
|
114
|
-
async () => {
|
|
115
|
-
const response = await api.items.categories.get(itemCategoryUid, {
|
|
116
|
-
...apiOptions,
|
|
117
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
118
|
-
});
|
|
119
|
-
if (!response.data) throw new Error("Item category not found");
|
|
120
|
-
return response.data;
|
|
121
|
-
},
|
|
122
|
-
itemCategoryUid,
|
|
123
|
-
apiOptions
|
|
124
|
-
);
|
|
125
|
-
},
|
|
126
|
-
staleTime: tier?.staleTime,
|
|
127
|
-
gcTime: tier?.gcTime
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
// src/queries/inv-mast.ts
|
|
132
|
-
var getInvMastKey = (invMastUid, itemId) => {
|
|
133
|
-
return ["invMast", invMastUid, itemId.toUpperCase()];
|
|
134
|
-
};
|
|
135
|
-
var getInvMastOptions = (api, invMastUid, itemId, cache) => {
|
|
136
|
-
const tier = cache?.static;
|
|
137
|
-
return {
|
|
138
|
-
queryKey: getInvMastKey(invMastUid, itemId),
|
|
139
|
-
queryFn: async () => {
|
|
140
|
-
const edgeCache = tier?.edgeCache;
|
|
141
|
-
return withCache(
|
|
142
|
-
cache?.provider,
|
|
143
|
-
tier,
|
|
144
|
-
"items.invMast.get",
|
|
145
|
-
async () => {
|
|
146
|
-
const response = await api.items.invMast.get(invMastUid, {
|
|
147
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
148
|
-
});
|
|
149
|
-
if (!response.data) throw new Error("Item not found");
|
|
150
|
-
return response.data;
|
|
151
|
-
},
|
|
152
|
-
invMastUid
|
|
153
|
-
);
|
|
154
|
-
},
|
|
155
|
-
staleTime: tier?.staleTime,
|
|
156
|
-
gcTime: tier?.gcTime
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
// src/queries/inv-mast-stock.ts
|
|
161
|
-
var getInvMastStockKey = (invMastUid) => {
|
|
162
|
-
return ["invMastStock", invMastUid];
|
|
163
|
-
};
|
|
164
|
-
var getInvMastStockOptions = (api, invMastUid, cache) => {
|
|
165
|
-
const tier = cache?.semiStatic;
|
|
166
|
-
return {
|
|
167
|
-
queryKey: getInvMastStockKey(invMastUid),
|
|
168
|
-
queryFn: async () => {
|
|
169
|
-
const edgeCache = tier?.edgeCache;
|
|
170
|
-
return withCache(
|
|
171
|
-
cache?.provider,
|
|
172
|
-
tier,
|
|
173
|
-
"items.invMast.stock.get",
|
|
174
|
-
async () => {
|
|
175
|
-
const response = await api.items.invMast.stock.get(Number(invMastUid), {
|
|
176
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
177
|
-
});
|
|
178
|
-
const stockData = response.data?.stockData ?? [];
|
|
179
|
-
return stockData.reduce((qty, stock) => qty + stock.qtyOnHand, 0);
|
|
180
|
-
},
|
|
181
|
-
invMastUid
|
|
182
|
-
);
|
|
183
|
-
},
|
|
184
|
-
staleTime: tier?.staleTime,
|
|
185
|
-
gcTime: tier?.gcTime
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
// src/queries/stock.ts
|
|
190
|
-
var getStockKey = (invMastUid) => {
|
|
191
|
-
return ["stock", invMastUid];
|
|
192
|
-
};
|
|
193
|
-
var getStockOptions = (api, invMastUid, cache) => {
|
|
194
|
-
const tier = cache?.semiStatic;
|
|
195
|
-
return {
|
|
196
|
-
queryKey: getStockKey(invMastUid),
|
|
197
|
-
queryFn: async () => {
|
|
198
|
-
const edgeCache = tier?.edgeCache;
|
|
199
|
-
return withCache(
|
|
200
|
-
cache?.provider,
|
|
201
|
-
tier,
|
|
202
|
-
"items.invMast.stock.get",
|
|
203
|
-
async () => {
|
|
204
|
-
const response = await api.items.invMast.stock.get(Number(invMastUid), {
|
|
205
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
206
|
-
});
|
|
207
|
-
const stockData = response.data?.stockData ?? [];
|
|
208
|
-
const companySummary = response.data?.companySummary ?? {};
|
|
209
|
-
return { stockData, companySummary };
|
|
210
|
-
},
|
|
211
|
-
invMastUid
|
|
212
|
-
);
|
|
213
|
-
},
|
|
214
|
-
staleTime: tier?.staleTime,
|
|
215
|
-
gcTime: tier?.gcTime
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
// src/queries/batch-inv-mast-doc.ts
|
|
220
|
-
var getBatchInvMastDocKey = (params, includePricing) => {
|
|
221
|
-
const sorted = [...params].sort(
|
|
222
|
-
(a, b) => a.itemId.toUpperCase().localeCompare(b.itemId.toUpperCase())
|
|
223
|
-
);
|
|
224
|
-
return [
|
|
225
|
-
"batchInvMastDoc",
|
|
226
|
-
stableStringify(
|
|
227
|
-
sorted.map((p) => ({ invMastUid: p.invMastUid, itemId: p.itemId.toUpperCase() }))
|
|
228
|
-
),
|
|
229
|
-
includePricing
|
|
230
|
-
];
|
|
231
|
-
};
|
|
232
|
-
var getBatchInvMastDocOptions = (api, params, includePricing, cache) => {
|
|
233
|
-
const tier = cache?.static;
|
|
234
|
-
return {
|
|
235
|
-
queryKey: getBatchInvMastDocKey(params, includePricing),
|
|
236
|
-
queryFn: async () => {
|
|
237
|
-
const results = {};
|
|
238
|
-
const settled = await Promise.allSettled(
|
|
239
|
-
params.map(async (p) => {
|
|
240
|
-
const opts = getInvMastDocOptions(api, p.invMastUid, p.itemId, includePricing, cache);
|
|
241
|
-
const data = await opts.queryFn();
|
|
242
|
-
return { key: p.itemId.toUpperCase(), data };
|
|
243
|
-
})
|
|
244
|
-
);
|
|
245
|
-
for (const entry of settled) {
|
|
246
|
-
if (entry.status === "fulfilled") {
|
|
247
|
-
results[entry.value.key] = entry.value.data;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
return results;
|
|
251
|
-
},
|
|
252
|
-
staleTime: tier?.staleTime,
|
|
253
|
-
gcTime: tier?.gcTime
|
|
254
|
-
};
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
// src/queries/batch-query.ts
|
|
258
|
-
async function executeBatchQuery(config) {
|
|
259
|
-
const { params, queryClient, getItemKey, getResultKey, fetchItems, getSeedKey } = config;
|
|
260
|
-
if (params.length === 0) {
|
|
261
|
-
return {};
|
|
262
|
-
}
|
|
263
|
-
const cached = {};
|
|
264
|
-
const uncached = [];
|
|
265
|
-
for (const param of params) {
|
|
266
|
-
const existing = queryClient.getQueryData(getItemKey(param));
|
|
267
|
-
if (existing !== void 0) {
|
|
268
|
-
cached[getResultKey(param)] = existing;
|
|
269
|
-
} else {
|
|
270
|
-
uncached.push(param);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
if (uncached.length === 0) {
|
|
274
|
-
return cached;
|
|
275
|
-
}
|
|
276
|
-
const fetched = await fetchItems(uncached);
|
|
277
|
-
for (const [key, data] of Object.entries(fetched)) {
|
|
278
|
-
queryClient.setQueryData(getSeedKey(key, data), data);
|
|
279
|
-
}
|
|
280
|
-
return { ...cached, ...fetched };
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// src/queries/product-category.ts
|
|
284
|
-
var getProductCategoryKey = (itemCategoryUid) => {
|
|
285
|
-
return ["productCategory", itemCategoryUid];
|
|
286
|
-
};
|
|
287
|
-
var getProductCategoryOptions = (api, itemCategoryUid, cache) => {
|
|
288
|
-
const tier = cache?.static;
|
|
289
|
-
return {
|
|
290
|
-
queryKey: getProductCategoryKey(itemCategoryUid),
|
|
291
|
-
queryFn: async () => {
|
|
292
|
-
const edgeCache = tier?.edgeCache;
|
|
293
|
-
return withCache(
|
|
294
|
-
cache?.provider,
|
|
295
|
-
tier,
|
|
296
|
-
"items.categories.get",
|
|
297
|
-
async () => {
|
|
298
|
-
const response = await api.items.categories.get(Number(itemCategoryUid), {
|
|
299
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
300
|
-
});
|
|
301
|
-
return response.data;
|
|
302
|
-
},
|
|
303
|
-
itemCategoryUid
|
|
304
|
-
);
|
|
305
|
-
},
|
|
306
|
-
staleTime: tier?.staleTime,
|
|
307
|
-
gcTime: tier?.gcTime
|
|
308
|
-
};
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
// src/queries/item-details.ts
|
|
312
|
-
var getItemDetailsKey = (itemId) => {
|
|
313
|
-
const normalizedId = typeof itemId === "string" ? itemId.toUpperCase() : itemId;
|
|
314
|
-
return ["itemDetails", normalizedId];
|
|
315
|
-
};
|
|
316
|
-
var getItemDetailsOptions = (api, itemId, cache) => {
|
|
317
|
-
const tier = cache?.static;
|
|
318
|
-
return {
|
|
319
|
-
queryKey: getItemDetailsKey(itemId),
|
|
320
|
-
queryFn: async () => {
|
|
321
|
-
const edgeCache = tier?.edgeCache;
|
|
322
|
-
return withCache(
|
|
323
|
-
cache?.provider,
|
|
324
|
-
tier,
|
|
325
|
-
"items.invMast.doc.list",
|
|
326
|
-
async () => {
|
|
327
|
-
const response = await api.items.invMast.doc.list(Number(itemId), {
|
|
328
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
329
|
-
});
|
|
330
|
-
if (!response.data) throw new Error("Item not found");
|
|
331
|
-
return response.data;
|
|
332
|
-
},
|
|
333
|
-
itemId
|
|
334
|
-
);
|
|
335
|
-
},
|
|
336
|
-
staleTime: tier?.staleTime,
|
|
337
|
-
gcTime: tier?.gcTime
|
|
338
|
-
};
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
// src/queries/item-attributes.ts
|
|
342
|
-
var getItemAttributesKey = (itemCategoryUid) => {
|
|
343
|
-
return ["itemAttributes", itemCategoryUid];
|
|
344
|
-
};
|
|
345
|
-
var getItemAttributesOptions = (api, itemCategoryUid, cache) => {
|
|
346
|
-
const tier = cache?.static;
|
|
347
|
-
return {
|
|
348
|
-
queryKey: getItemAttributesKey(itemCategoryUid),
|
|
349
|
-
queryFn: async () => {
|
|
350
|
-
const edgeCache = tier?.edgeCache;
|
|
351
|
-
return withCache(
|
|
352
|
-
cache?.provider,
|
|
353
|
-
tier,
|
|
354
|
-
"openSearch.itemSearch.attributes.list",
|
|
355
|
-
async () => {
|
|
356
|
-
const response = await api.openSearch.itemSearch.attributes.list({
|
|
357
|
-
q: "",
|
|
358
|
-
searchType: "query",
|
|
359
|
-
classId5List: String(itemCategoryUid),
|
|
360
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
361
|
-
});
|
|
362
|
-
return response.data;
|
|
363
|
-
},
|
|
364
|
-
itemCategoryUid
|
|
365
|
-
);
|
|
366
|
-
},
|
|
367
|
-
staleTime: tier?.staleTime,
|
|
368
|
-
gcTime: tier?.gcTime
|
|
369
|
-
};
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
// src/queries/product-search.ts
|
|
373
|
-
var getProductSearchKey = (pageData) => {
|
|
374
|
-
return [
|
|
375
|
-
"productSearch",
|
|
376
|
-
pageData.q,
|
|
377
|
-
pageData.limit,
|
|
378
|
-
pageData.offset,
|
|
379
|
-
pageData.sortBy,
|
|
380
|
-
pageData.itemCategoryUid
|
|
381
|
-
];
|
|
382
|
-
};
|
|
383
|
-
var getProductSearchOptions = (api, pageData, cache) => {
|
|
384
|
-
const tier = cache?.semiStatic;
|
|
385
|
-
return {
|
|
386
|
-
queryKey: getProductSearchKey(pageData),
|
|
387
|
-
queryFn: async () => {
|
|
388
|
-
const edgeCache = tier?.edgeCache;
|
|
389
|
-
return withCache(
|
|
390
|
-
cache?.provider,
|
|
391
|
-
tier,
|
|
392
|
-
"openSearch.itemSearch.list",
|
|
393
|
-
async () => {
|
|
394
|
-
const response = await api.openSearch.itemSearch.list({
|
|
395
|
-
q: pageData.q,
|
|
396
|
-
searchType: "query",
|
|
397
|
-
size: pageData.limit,
|
|
398
|
-
from: pageData.offset,
|
|
399
|
-
classId5List: pageData.itemCategoryUid ? String(pageData.itemCategoryUid) : void 0,
|
|
400
|
-
filters: pageData.filters ? JSON.stringify(pageData.filters) : void 0,
|
|
401
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
402
|
-
});
|
|
403
|
-
return response.data;
|
|
404
|
-
},
|
|
405
|
-
pageData
|
|
406
|
-
);
|
|
407
|
-
},
|
|
408
|
-
staleTime: tier?.staleTime,
|
|
409
|
-
gcTime: tier?.gcTime
|
|
410
|
-
};
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
// src/queries/search-suggestions.ts
|
|
414
|
-
var getSearchSuggestionsKey = (query, limit, offset) => {
|
|
415
|
-
return ["searchSuggestions", query, limit, offset];
|
|
416
|
-
};
|
|
417
|
-
var getSearchSuggestionsOptions = (api, query, limit = 10, offset = 0, cache) => {
|
|
418
|
-
const tier = cache?.static;
|
|
419
|
-
return {
|
|
420
|
-
queryKey: getSearchSuggestionsKey(query, limit, offset),
|
|
421
|
-
queryFn: async () => {
|
|
422
|
-
const edgeCache = tier?.edgeCache;
|
|
423
|
-
return withCache(
|
|
424
|
-
cache?.provider,
|
|
425
|
-
tier,
|
|
426
|
-
"openSearch.suggestions.suggest.list",
|
|
427
|
-
async () => {
|
|
428
|
-
const response = await api.openSearch.suggestions.suggest.list({
|
|
429
|
-
q: query,
|
|
430
|
-
size: limit,
|
|
431
|
-
from: offset,
|
|
432
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
433
|
-
});
|
|
434
|
-
return response.data;
|
|
435
|
-
},
|
|
436
|
-
query,
|
|
437
|
-
limit,
|
|
438
|
-
offset
|
|
439
|
-
);
|
|
440
|
-
},
|
|
441
|
-
staleTime: tier?.staleTime,
|
|
442
|
-
gcTime: tier?.gcTime
|
|
443
|
-
};
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
// src/queries/cart-pricing.ts
|
|
447
|
-
function getCartPricingQueryOptions(api, cartLines, customerId, cache) {
|
|
448
|
-
return cartLines.map((line) => ({
|
|
449
|
-
...getItemPriceOptions(api, line.itemId, customerId, line.quantity, cache),
|
|
450
|
-
enabled: !!customerId && !!line.itemId
|
|
451
|
-
}));
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// src/queries/category-items-infinite.ts
|
|
455
|
-
var getCategoryItemsInfiniteKey = (itemCategoryUid, itemsFilters) => {
|
|
456
|
-
return ["categoryItemsInfinite", itemCategoryUid, stableStringify(itemsFilters)];
|
|
457
|
-
};
|
|
458
|
-
var getCategoryItemsInfiniteOptions = (api, itemCategoryUid, itemsFilters, cache) => {
|
|
459
|
-
const tier = cache?.semiStatic;
|
|
460
|
-
return {
|
|
461
|
-
queryKey: getCategoryItemsInfiniteKey(itemCategoryUid, itemsFilters),
|
|
462
|
-
queryFn: async ({ pageParam = 0 }) => {
|
|
463
|
-
const edgeCache = tier?.edgeCache;
|
|
464
|
-
return withCache(
|
|
465
|
-
cache?.provider,
|
|
466
|
-
tier,
|
|
467
|
-
"openSearch.itemSearch.list",
|
|
468
|
-
async () => {
|
|
469
|
-
const response = await api.openSearch.itemSearch.list({
|
|
470
|
-
q: itemsFilters.q || "",
|
|
471
|
-
searchType: "query",
|
|
472
|
-
size: itemsFilters.limit,
|
|
473
|
-
from: pageParam,
|
|
474
|
-
classId5List: String(itemCategoryUid),
|
|
475
|
-
filters: itemsFilters.filters?.length ? JSON.stringify(itemsFilters.filters) : void 0,
|
|
476
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
477
|
-
});
|
|
478
|
-
const items = response.data?.items ?? [];
|
|
479
|
-
const total = response.data?.totalResults ?? 0;
|
|
480
|
-
const nextOffset = pageParam + itemsFilters.limit;
|
|
481
|
-
return {
|
|
482
|
-
data: items,
|
|
483
|
-
total,
|
|
484
|
-
nextCursor: nextOffset < total ? nextOffset : void 0
|
|
485
|
-
};
|
|
486
|
-
},
|
|
487
|
-
itemCategoryUid,
|
|
488
|
-
itemsFilters,
|
|
489
|
-
pageParam
|
|
490
|
-
);
|
|
491
|
-
},
|
|
492
|
-
initialPageParam: 0,
|
|
493
|
-
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
|
494
|
-
staleTime: tier?.staleTime,
|
|
495
|
-
gcTime: tier?.gcTime
|
|
496
|
-
};
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
// src/queries/item-search-infinite.ts
|
|
500
|
-
var getItemSearchInfiniteKey = (itemsFilters, itemCategoryUid) => {
|
|
501
|
-
return ["itemSearchInfinite", stableStringify(itemsFilters), itemCategoryUid];
|
|
502
|
-
};
|
|
503
|
-
var getItemSearchInfiniteOptions = (api, itemsFilters, itemCategoryUid, cache) => {
|
|
504
|
-
const tier = cache?.semiStatic;
|
|
505
|
-
return {
|
|
506
|
-
queryKey: getItemSearchInfiniteKey(itemsFilters, itemCategoryUid),
|
|
507
|
-
queryFn: async ({ pageParam = 0 }) => {
|
|
508
|
-
const edgeCache = tier?.edgeCache;
|
|
509
|
-
return withCache(
|
|
510
|
-
cache?.provider,
|
|
511
|
-
tier,
|
|
512
|
-
"openSearch.itemSearch.list",
|
|
513
|
-
async () => {
|
|
514
|
-
const response = await api.openSearch.itemSearch.list({
|
|
515
|
-
q: itemsFilters.q,
|
|
516
|
-
searchType: "query",
|
|
517
|
-
size: itemsFilters.limit,
|
|
518
|
-
from: pageParam,
|
|
519
|
-
classId5List: itemCategoryUid ? String(itemCategoryUid) : void 0,
|
|
520
|
-
filters: itemsFilters.filters?.length ? JSON.stringify(itemsFilters.filters) : void 0,
|
|
521
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
522
|
-
});
|
|
523
|
-
const items = response.data?.items ?? [];
|
|
524
|
-
const total = response.data?.totalResults ?? 0;
|
|
525
|
-
const nextOffset = pageParam + itemsFilters.limit;
|
|
526
|
-
return {
|
|
527
|
-
data: items,
|
|
528
|
-
total,
|
|
529
|
-
nextCursor: nextOffset < total ? nextOffset : void 0
|
|
530
|
-
};
|
|
531
|
-
},
|
|
532
|
-
itemsFilters,
|
|
533
|
-
itemCategoryUid,
|
|
534
|
-
pageParam
|
|
535
|
-
);
|
|
536
|
-
},
|
|
537
|
-
initialPageParam: 0,
|
|
538
|
-
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
|
539
|
-
staleTime: tier?.staleTime,
|
|
540
|
-
gcTime: tier?.gcTime,
|
|
541
|
-
meta: { persist: true }
|
|
542
|
-
};
|
|
543
|
-
};
|
|
544
|
-
|
|
545
|
-
// src/queries/joomla-content.ts
|
|
546
|
-
var getJoomlaContentKey = (articleId) => {
|
|
547
|
-
return ["joomlaContent", articleId];
|
|
548
|
-
};
|
|
549
|
-
var getJoomlaContentOptions = (api, articleId, cache) => {
|
|
550
|
-
const tier = cache?.static;
|
|
551
|
-
return {
|
|
552
|
-
queryKey: getJoomlaContentKey(articleId),
|
|
553
|
-
queryFn: async () => {
|
|
554
|
-
const edgeCache = tier?.edgeCache;
|
|
555
|
-
return withCache(
|
|
556
|
-
cache?.provider,
|
|
557
|
-
tier,
|
|
558
|
-
"joomla.content.doc.get",
|
|
559
|
-
async () => {
|
|
560
|
-
const response = await api.joomla.content.doc.get(articleId, {
|
|
561
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
562
|
-
});
|
|
563
|
-
if (!response.data) throw new Error("Article not found");
|
|
564
|
-
return response.data;
|
|
565
|
-
},
|
|
566
|
-
articleId
|
|
567
|
-
);
|
|
568
|
-
},
|
|
569
|
-
staleTime: tier?.staleTime,
|
|
570
|
-
gcTime: tier?.gcTime
|
|
571
|
-
};
|
|
572
|
-
};
|
|
573
|
-
|
|
574
|
-
// src/queries/joomla-content-list.ts
|
|
575
|
-
var getJoomlaContentListKey = (categoryId, filters) => {
|
|
576
|
-
return ["joomlaContentList", categoryId, filters];
|
|
577
|
-
};
|
|
578
|
-
var getJoomlaContentListOptions = (api, categoryId, filters, cache) => {
|
|
579
|
-
const tier = cache?.semiStatic;
|
|
580
|
-
return {
|
|
581
|
-
queryKey: getJoomlaContentListKey(categoryId, filters),
|
|
582
|
-
queryFn: async () => {
|
|
583
|
-
const edgeCache = tier?.edgeCache;
|
|
584
|
-
return withCache(
|
|
585
|
-
cache?.provider,
|
|
586
|
-
tier,
|
|
587
|
-
"joomla.content.list",
|
|
588
|
-
async () => {
|
|
589
|
-
const response = await api.joomla.content.list({
|
|
590
|
-
catid: categoryId,
|
|
591
|
-
...filters,
|
|
592
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
593
|
-
});
|
|
594
|
-
return {
|
|
595
|
-
data: response.data ?? [],
|
|
596
|
-
total: response.total ?? 0,
|
|
597
|
-
count: response.count,
|
|
598
|
-
totalResults: response.totalResults,
|
|
599
|
-
message: response.message,
|
|
600
|
-
status: response.status
|
|
601
|
-
};
|
|
602
|
-
},
|
|
603
|
-
categoryId,
|
|
604
|
-
filters
|
|
605
|
-
);
|
|
606
|
-
},
|
|
607
|
-
staleTime: tier?.staleTime,
|
|
608
|
-
gcTime: tier?.gcTime
|
|
609
|
-
};
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
// src/queries/joomla-menu.ts
|
|
613
|
-
var getJoomlaMenuKey = (filters) => {
|
|
614
|
-
return ["joomlaMenu", filters];
|
|
615
|
-
};
|
|
616
|
-
var getJoomlaMenuOptions = (api, filters, cache) => {
|
|
617
|
-
const tier = cache?.semiStatic;
|
|
618
|
-
return {
|
|
619
|
-
queryKey: getJoomlaMenuKey(filters),
|
|
620
|
-
queryFn: async () => {
|
|
621
|
-
const edgeCache = tier?.edgeCache;
|
|
622
|
-
return withCache(
|
|
623
|
-
cache?.provider,
|
|
624
|
-
tier,
|
|
625
|
-
"joomla.menu.list",
|
|
626
|
-
async () => {
|
|
627
|
-
const response = await api.joomla.menu.list({
|
|
628
|
-
...filters,
|
|
629
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
630
|
-
});
|
|
631
|
-
return {
|
|
632
|
-
data: response.data ?? [],
|
|
633
|
-
total: response.total ?? 0,
|
|
634
|
-
count: response.count,
|
|
635
|
-
totalResults: response.totalResults,
|
|
636
|
-
message: response.message,
|
|
637
|
-
status: response.status
|
|
638
|
-
};
|
|
639
|
-
},
|
|
640
|
-
filters
|
|
641
|
-
);
|
|
642
|
-
},
|
|
643
|
-
staleTime: tier?.staleTime,
|
|
644
|
-
gcTime: tier?.gcTime
|
|
645
|
-
};
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
// src/queries/joomla-menu-doc.ts
|
|
649
|
-
var getJoomlaMenuDocKey = (menuId) => {
|
|
650
|
-
return ["joomlaMenuDoc", menuId];
|
|
651
|
-
};
|
|
652
|
-
var getJoomlaMenuDocOptions = (api, menuId, cache) => {
|
|
653
|
-
const tier = cache?.static;
|
|
654
|
-
return {
|
|
655
|
-
queryKey: getJoomlaMenuDocKey(menuId),
|
|
656
|
-
queryFn: async () => {
|
|
657
|
-
const edgeCache = tier?.edgeCache;
|
|
658
|
-
return withCache(
|
|
659
|
-
cache?.provider,
|
|
660
|
-
tier,
|
|
661
|
-
"joomla.menu.doc.get",
|
|
662
|
-
async () => {
|
|
663
|
-
const response = await api.joomla.menu.doc.get(menuId, {
|
|
664
|
-
...edgeCache != null ? { edgeCache } : {}
|
|
665
|
-
});
|
|
666
|
-
if (!response.data) throw new Error("Menu item not found");
|
|
667
|
-
return response.data;
|
|
668
|
-
},
|
|
669
|
-
menuId
|
|
670
|
-
);
|
|
671
|
-
},
|
|
672
|
-
staleTime: tier?.staleTime,
|
|
673
|
-
gcTime: tier?.gcTime
|
|
674
|
-
};
|
|
675
|
-
};
|
|
676
|
-
|
|
677
|
-
// src/queries/customer-orders.ts
|
|
678
|
-
var getCustomerOrdersKey = (customerId, params) => {
|
|
679
|
-
return ["customerOrders", customerId, params];
|
|
680
|
-
};
|
|
681
|
-
var getCustomerOrderDetailKey = (customerId, orderId) => {
|
|
682
|
-
return ["customerOrderDetail", customerId, orderId];
|
|
683
|
-
};
|
|
684
|
-
|
|
685
|
-
// src/queries/customer-invoices.ts
|
|
686
|
-
var getCustomerInvoicesKey = (customerId, params) => {
|
|
687
|
-
return ["customerInvoices", customerId, params];
|
|
688
|
-
};
|
|
689
|
-
var getCustomerInvoiceDetailKey = (customerId, invoiceNo) => {
|
|
690
|
-
return ["customerInvoiceDetail", customerId, invoiceNo];
|
|
691
|
-
};
|
|
692
|
-
|
|
693
|
-
// src/queries/customer-quotes.ts
|
|
694
|
-
var getCustomerQuotesKey = (customerId, params) => {
|
|
695
|
-
return ["customerQuotes", customerId, params];
|
|
696
|
-
};
|
|
697
|
-
var getCustomerQuoteDetailKey = (customerId, quoteNo) => {
|
|
698
|
-
return ["customerQuoteDetail", customerId, quoteNo];
|
|
699
|
-
};
|
|
700
|
-
|
|
701
|
-
export {
|
|
702
|
-
stableStringify,
|
|
703
|
-
getItemPriceKey,
|
|
704
|
-
getItemPriceOptions,
|
|
705
|
-
getInvMastDocKey,
|
|
706
|
-
getInvMastDocOptions,
|
|
707
|
-
getItemCategoryKey,
|
|
708
|
-
getItemCategoryOptions,
|
|
709
|
-
getInvMastKey,
|
|
710
|
-
getInvMastOptions,
|
|
711
|
-
getInvMastStockKey,
|
|
712
|
-
getInvMastStockOptions,
|
|
713
|
-
getStockKey,
|
|
714
|
-
getStockOptions,
|
|
715
|
-
getBatchInvMastDocKey,
|
|
716
|
-
getBatchInvMastDocOptions,
|
|
717
|
-
executeBatchQuery,
|
|
718
|
-
getProductCategoryKey,
|
|
719
|
-
getProductCategoryOptions,
|
|
720
|
-
getItemDetailsKey,
|
|
721
|
-
getItemDetailsOptions,
|
|
722
|
-
getItemAttributesKey,
|
|
723
|
-
getItemAttributesOptions,
|
|
724
|
-
getProductSearchKey,
|
|
725
|
-
getProductSearchOptions,
|
|
726
|
-
getSearchSuggestionsKey,
|
|
727
|
-
getSearchSuggestionsOptions,
|
|
728
|
-
getCartPricingQueryOptions,
|
|
729
|
-
getCategoryItemsInfiniteKey,
|
|
730
|
-
getCategoryItemsInfiniteOptions,
|
|
731
|
-
getItemSearchInfiniteKey,
|
|
732
|
-
getItemSearchInfiniteOptions,
|
|
733
|
-
getJoomlaContentKey,
|
|
734
|
-
getJoomlaContentOptions,
|
|
735
|
-
getJoomlaContentListKey,
|
|
736
|
-
getJoomlaContentListOptions,
|
|
737
|
-
getJoomlaMenuKey,
|
|
738
|
-
getJoomlaMenuOptions,
|
|
739
|
-
getJoomlaMenuDocKey,
|
|
740
|
-
getJoomlaMenuDocOptions,
|
|
741
|
-
getCustomerOrdersKey,
|
|
742
|
-
getCustomerOrderDetailKey,
|
|
743
|
-
getCustomerInvoicesKey,
|
|
744
|
-
getCustomerInvoiceDetailKey,
|
|
745
|
-
getCustomerQuotesKey,
|
|
746
|
-
getCustomerQuoteDetailKey
|
|
747
|
-
};
|
|
748
|
-
//# sourceMappingURL=chunk-QFZHOGID.js.map
|