@simpleapps-com/augur-utils 0.1.0
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/dist/index.cjs +46 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +611 -0
- package/dist/index.d.ts +611 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/web.cjs +10 -0
- package/dist/web.cjs.map +1 -0
- package/dist/web.d.cts +6 -0
- package/dist/web.d.ts +6 -0
- package/dist/web.js +10 -0
- package/dist/web.js.map +1 -0
- package/package.json +55 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/cache-config.ts
|
|
2
|
+
var CACHE_CONFIG = {
|
|
3
|
+
STATIC: {
|
|
4
|
+
staleTime: 1e3 * 60 * 60,
|
|
5
|
+
// 1 hour
|
|
6
|
+
gcTime: 1e3 * 60 * 60 * 24
|
|
7
|
+
// 24 hours
|
|
8
|
+
},
|
|
9
|
+
SEMI_STATIC: {
|
|
10
|
+
staleTime: 1e3 * 60 * 10,
|
|
11
|
+
// 10 minutes
|
|
12
|
+
gcTime: 1e3 * 60 * 60 * 4
|
|
13
|
+
// 4 hours
|
|
14
|
+
},
|
|
15
|
+
DYNAMIC: {
|
|
16
|
+
staleTime: 1e3 * 60 * 5,
|
|
17
|
+
// 5 minutes
|
|
18
|
+
gcTime: 1e3 * 60 * 30
|
|
19
|
+
// 30 minutes
|
|
20
|
+
},
|
|
21
|
+
CART: {
|
|
22
|
+
staleTime: 1e3 * 60 * 2,
|
|
23
|
+
// 2 minutes
|
|
24
|
+
gcTime: 1e3 * 60 * 30
|
|
25
|
+
// 30 minutes
|
|
26
|
+
},
|
|
27
|
+
REALTIME: {
|
|
28
|
+
staleTime: 0,
|
|
29
|
+
gcTime: 1e3 * 60 * 5
|
|
30
|
+
// 5 minutes
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// src/format-price.ts
|
|
35
|
+
function formatPrice(price, locale = "en-US", currency = "USD") {
|
|
36
|
+
return new Intl.NumberFormat(locale, {
|
|
37
|
+
style: "currency",
|
|
38
|
+
currency,
|
|
39
|
+
minimumFractionDigits: 2
|
|
40
|
+
}).format(price);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
exports.CACHE_CONFIG = CACHE_CONFIG; exports.formatPrice = formatPrice;
|
|
46
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-utils/dist/index.cjs","../src/cache-config.ts","../src/format-price.ts"],"names":[],"mappings":"AAAA;ACkBO,IAAM,aAAA,EAAe;AAAA,EAC1B,MAAA,EAAQ;AAAA,IACN,SAAA,EAAW,IAAA,EAAO,GAAA,EAAK,EAAA;AAAA;AAAA,IACvB,MAAA,EAAQ,IAAA,EAAO,GAAA,EAAK,GAAA,EAAK;AAAA;AAAA,EAC3B,CAAA;AAAA,EACA,WAAA,EAAa;AAAA,IACX,SAAA,EAAW,IAAA,EAAO,GAAA,EAAK,EAAA;AAAA;AAAA,IACvB,MAAA,EAAQ,IAAA,EAAO,GAAA,EAAK,GAAA,EAAK;AAAA;AAAA,EAC3B,CAAA;AAAA,EACA,OAAA,EAAS;AAAA,IACP,SAAA,EAAW,IAAA,EAAO,GAAA,EAAK,CAAA;AAAA;AAAA,IACvB,MAAA,EAAQ,IAAA,EAAO,GAAA,EAAK;AAAA;AAAA,EACtB,CAAA;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,SAAA,EAAW,IAAA,EAAO,GAAA,EAAK,CAAA;AAAA;AAAA,IACvB,MAAA,EAAQ,IAAA,EAAO,GAAA,EAAK;AAAA;AAAA,EACtB,CAAA;AAAA,EACA,QAAA,EAAU;AAAA,IACR,SAAA,EAAW,CAAA;AAAA,IACX,MAAA,EAAQ,IAAA,EAAO,GAAA,EAAK;AAAA;AAAA,EACtB;AACF,CAAA;ADPA;AACA;AE7BO,SAAS,WAAA,CACd,KAAA,EACA,OAAA,EAAiB,OAAA,EACjB,SAAA,EAAmB,KAAA,EACX;AACR,EAAA,OAAO,IAAI,IAAA,CAAK,YAAA,CAAa,MAAA,EAAQ;AAAA,IACnC,KAAA,EAAO,UAAA;AAAA,IACP,QAAA;AAAA,IACA,qBAAA,EAAuB;AAAA,EACzB,CAAC,CAAA,CAAE,MAAA,CAAO,KAAK,CAAA;AACjB;AF2BA;AACE;AACA;AACF,uEAAC","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-utils/dist/index.cjs","sourcesContent":[null,"/**\n * Centralized cache configuration for React Query (TanStack Query)\n *\n * staleTime -- How long cached data is considered \"fresh\". While fresh,\n * React Query serves the cache instantly and does NOT refetch in the\n * background. After staleTime expires the data is \"stale\" and will be\n * refetched on the next access (mount, window focus, etc.).\n *\n * gcTime (garbage collection time) -- How long UNUSED cached data stays in\n * memory after all components using it unmount. Once gcTime expires the\n * cache entry is deleted entirely.\n *\n * STATIC (1h): categories, menus, item details\n * SEMI_STATIC (10m): pricing, stock, search results\n * DYNAMIC (5m): infinite scroll data\n * CART (2m): cart lines, cart header\n * REALTIME (0): active orders, checkout state\n */\nexport const CACHE_CONFIG = {\n STATIC: {\n staleTime: 1000 * 60 * 60, // 1 hour\n gcTime: 1000 * 60 * 60 * 24, // 24 hours\n },\n SEMI_STATIC: {\n staleTime: 1000 * 60 * 10, // 10 minutes\n gcTime: 1000 * 60 * 60 * 4, // 4 hours\n },\n DYNAMIC: {\n staleTime: 1000 * 60 * 5, // 5 minutes\n gcTime: 1000 * 60 * 30, // 30 minutes\n },\n CART: {\n staleTime: 1000 * 60 * 2, // 2 minutes\n gcTime: 1000 * 60 * 30, // 30 minutes\n },\n REALTIME: {\n staleTime: 0,\n gcTime: 1000 * 60 * 5, // 5 minutes\n },\n} as const;\n\nexport type CacheTier = keyof typeof CACHE_CONFIG;\n","/**\n * Locale-aware currency formatting.\n * Defaults to USD -- consumers can override locale and currency.\n */\nexport function formatPrice(\n price: number,\n locale: string = \"en-US\",\n currency: string = \"USD\",\n): string {\n return new Intl.NumberFormat(locale, {\n style: \"currency\",\n currency,\n minimumFractionDigits: 2,\n }).format(price);\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
type TCartLine = {
|
|
2
|
+
cartHdrUid?: string | number | undefined;
|
|
3
|
+
invMastUid: number;
|
|
4
|
+
invMastUidCount: number;
|
|
5
|
+
isAssembly: string;
|
|
6
|
+
itemId: string;
|
|
7
|
+
lineNo: number;
|
|
8
|
+
lineNote: null;
|
|
9
|
+
quantity: number;
|
|
10
|
+
unitOfMeasure: string;
|
|
11
|
+
};
|
|
12
|
+
type TCartLookUp = {
|
|
13
|
+
cartHdrUid: number;
|
|
14
|
+
cartToken: string;
|
|
15
|
+
contactId: number;
|
|
16
|
+
customerId: number;
|
|
17
|
+
userId: number;
|
|
18
|
+
};
|
|
19
|
+
type TCartHdrUid = Pick<TCartLine, "cartHdrUid">;
|
|
20
|
+
type TOrderCartLine = {
|
|
21
|
+
inv_mast_uid: number;
|
|
22
|
+
item_id: string;
|
|
23
|
+
qty: number;
|
|
24
|
+
uom: string;
|
|
25
|
+
weight: number;
|
|
26
|
+
classId5: string | null;
|
|
27
|
+
unitPrice: number;
|
|
28
|
+
manualPriceOverride?: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type TCategoryChild = {
|
|
32
|
+
itemCategoryUid: number;
|
|
33
|
+
itemCategoryId: string;
|
|
34
|
+
itemCategoryDesc: string;
|
|
35
|
+
fullPath: string;
|
|
36
|
+
cleanPath: string;
|
|
37
|
+
categoryImage: string;
|
|
38
|
+
sequenceNo: number;
|
|
39
|
+
productCollection: null;
|
|
40
|
+
itemCount: number;
|
|
41
|
+
};
|
|
42
|
+
type TCategory = {
|
|
43
|
+
itemCategoryUid: number;
|
|
44
|
+
itemCategoryId: string;
|
|
45
|
+
itemCategoryDesc: string;
|
|
46
|
+
categoryImage: string | false;
|
|
47
|
+
parentItemCategoryUid: number;
|
|
48
|
+
nodeCount: number;
|
|
49
|
+
fullPath: string;
|
|
50
|
+
cleanPath: string;
|
|
51
|
+
displayOnWebFlag: string;
|
|
52
|
+
subItemCategoryUids: number[];
|
|
53
|
+
maxItems: number;
|
|
54
|
+
itemsByCategory: number;
|
|
55
|
+
children: TCategoryChild[];
|
|
56
|
+
childrenTotal: number;
|
|
57
|
+
childrenCount: number;
|
|
58
|
+
};
|
|
59
|
+
type TItemCategory = {
|
|
60
|
+
itemCategoryUid: number;
|
|
61
|
+
itemCategoryId: string;
|
|
62
|
+
itemCategoryDesc: string;
|
|
63
|
+
masterCategoryFlag: string;
|
|
64
|
+
parentCategoryFlag: string;
|
|
65
|
+
displayOnWebFlag: string;
|
|
66
|
+
displayMasterProductFlag: string;
|
|
67
|
+
catalogPage: string | null;
|
|
68
|
+
deleteFlag: string;
|
|
69
|
+
dateCreated: string;
|
|
70
|
+
createdBy: string;
|
|
71
|
+
dateLastModified: string;
|
|
72
|
+
lastMaintainedBy: string;
|
|
73
|
+
subCategoryImageFile: string | null;
|
|
74
|
+
updateCd: number;
|
|
75
|
+
statusCd: number;
|
|
76
|
+
processCd: number;
|
|
77
|
+
itemCount: number;
|
|
78
|
+
};
|
|
79
|
+
type TProductCategory = {
|
|
80
|
+
fullPath: string;
|
|
81
|
+
itemCategoryDesc: string;
|
|
82
|
+
itemCategoryId: string;
|
|
83
|
+
itemCategoryUid: number;
|
|
84
|
+
itemCount: number;
|
|
85
|
+
productCollection: any;
|
|
86
|
+
sequenceNo: number;
|
|
87
|
+
children: TProductCategory[];
|
|
88
|
+
childrenTotal: number;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
type TInventorySupplier = {
|
|
92
|
+
inventorySupplierUid: number;
|
|
93
|
+
invMastUid: number;
|
|
94
|
+
supplierId: number;
|
|
95
|
+
upcCode: string;
|
|
96
|
+
checkDigit: string;
|
|
97
|
+
upc: string;
|
|
98
|
+
supplierPartNo: string;
|
|
99
|
+
primarySupplierFlag: string | null;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
type TItemUom = {
|
|
103
|
+
unitOfMeasure: string;
|
|
104
|
+
unitSize: number;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
type TItemAttribute = {
|
|
108
|
+
attributeName: string;
|
|
109
|
+
attributeValue: string;
|
|
110
|
+
};
|
|
111
|
+
type TAttributeValue = {
|
|
112
|
+
attributeValue: string;
|
|
113
|
+
attributeValueUid: number;
|
|
114
|
+
};
|
|
115
|
+
type TAttribute = {
|
|
116
|
+
attributeDesc: string;
|
|
117
|
+
attributeId: string;
|
|
118
|
+
attributeUid: number;
|
|
119
|
+
sequenceNo: number;
|
|
120
|
+
valueCount: number;
|
|
121
|
+
values: TAttributeValue[];
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
type TInvMast = {
|
|
125
|
+
invMastUid: number;
|
|
126
|
+
itemId: string;
|
|
127
|
+
itemDesc: string;
|
|
128
|
+
deleteFlag: string;
|
|
129
|
+
weight: number;
|
|
130
|
+
dateCreated: string;
|
|
131
|
+
dateLastModified: string;
|
|
132
|
+
inactive: string;
|
|
133
|
+
classId1: string;
|
|
134
|
+
classId2: string | null;
|
|
135
|
+
classId3: string | null;
|
|
136
|
+
classId4: string;
|
|
137
|
+
classId5: string;
|
|
138
|
+
upcOrEan: string;
|
|
139
|
+
upcOrEanId: string;
|
|
140
|
+
serialized: string;
|
|
141
|
+
productType: string;
|
|
142
|
+
dLength: string | null;
|
|
143
|
+
shortCode: string;
|
|
144
|
+
price1: number;
|
|
145
|
+
price2: number;
|
|
146
|
+
price3: number;
|
|
147
|
+
price4: number;
|
|
148
|
+
price5: number;
|
|
149
|
+
price6: number;
|
|
150
|
+
price7: number;
|
|
151
|
+
price8: number;
|
|
152
|
+
price9: number;
|
|
153
|
+
price10: number;
|
|
154
|
+
extendedDesc: string | null;
|
|
155
|
+
defaultSellingUnit: string;
|
|
156
|
+
hazMatFlag: string;
|
|
157
|
+
keywords: string;
|
|
158
|
+
disposition: string;
|
|
159
|
+
baseUnit: string;
|
|
160
|
+
restrictedFlag: string | null;
|
|
161
|
+
parkerProductCd: number | null;
|
|
162
|
+
parkerDivisionCd: number | null;
|
|
163
|
+
commodityCode: string;
|
|
164
|
+
unspscCode: string | null;
|
|
165
|
+
dciCode: string | null;
|
|
166
|
+
epaCertReqFlag: string;
|
|
167
|
+
length: null;
|
|
168
|
+
width: null;
|
|
169
|
+
height: null;
|
|
170
|
+
itemNotes: null;
|
|
171
|
+
vndrStock: unknown | null;
|
|
172
|
+
manufacturerName: string;
|
|
173
|
+
brandName: string;
|
|
174
|
+
partNumber: null;
|
|
175
|
+
updateCd: number;
|
|
176
|
+
defaultProductGroup: string;
|
|
177
|
+
upcOrEanPrefix: string;
|
|
178
|
+
upcOrEanItem: string;
|
|
179
|
+
attributeGroupUid: number | null;
|
|
180
|
+
defaultPriceFamilyUid: number;
|
|
181
|
+
purchasePricingUnit: string;
|
|
182
|
+
purchasePricingUnitSize: number;
|
|
183
|
+
salesPricingUnit: string;
|
|
184
|
+
salesPricingUnitSize: number;
|
|
185
|
+
defaultPurchasingUnit: string;
|
|
186
|
+
statusCd: number;
|
|
187
|
+
onlineCd: number;
|
|
188
|
+
processCd: number;
|
|
189
|
+
};
|
|
190
|
+
type TStockData = {
|
|
191
|
+
baseUnit: string;
|
|
192
|
+
baseUnitSize: number;
|
|
193
|
+
calcQtyAllocated: number;
|
|
194
|
+
calcQtyAvailable: number;
|
|
195
|
+
calcQtyOnHand: number;
|
|
196
|
+
companyId: string;
|
|
197
|
+
defaultSellingUnit: string;
|
|
198
|
+
defaultSellingUnitSize: number;
|
|
199
|
+
discontinued: string;
|
|
200
|
+
divisor: number;
|
|
201
|
+
locationId: number;
|
|
202
|
+
locationName: string;
|
|
203
|
+
nextDueInPoDate: string | null;
|
|
204
|
+
orderQuantity: number;
|
|
205
|
+
primaryBin: string;
|
|
206
|
+
productGroupId: string;
|
|
207
|
+
qtyAllocated: number;
|
|
208
|
+
qtyAvailable: number;
|
|
209
|
+
qtyBackordered: number;
|
|
210
|
+
qtyFrozen: number;
|
|
211
|
+
qtyOnHand: number;
|
|
212
|
+
qtyQuarantined: number;
|
|
213
|
+
stockable: string;
|
|
214
|
+
unallocated: number;
|
|
215
|
+
};
|
|
216
|
+
type TStock = {
|
|
217
|
+
companySummary: Record<string, number>;
|
|
218
|
+
stockData: TStockData[];
|
|
219
|
+
};
|
|
220
|
+
type TInvMastDoc = {
|
|
221
|
+
invMastUid: number;
|
|
222
|
+
itemId: string;
|
|
223
|
+
itemDesc: string;
|
|
224
|
+
displayDesc: string;
|
|
225
|
+
extendedDesc: string | null;
|
|
226
|
+
defaultSellingUnit: string;
|
|
227
|
+
baseUnit: string;
|
|
228
|
+
vndrStock: number | null;
|
|
229
|
+
classId1: string | null;
|
|
230
|
+
classId2: string | null;
|
|
231
|
+
classId3: string | null;
|
|
232
|
+
classId4: string | null;
|
|
233
|
+
classId5: string | null;
|
|
234
|
+
defaultProductGroup: string | null;
|
|
235
|
+
upcOrEanId: string | null;
|
|
236
|
+
upcOrEan: string | null;
|
|
237
|
+
weight: number | null;
|
|
238
|
+
length: number | null;
|
|
239
|
+
width: number | null;
|
|
240
|
+
height: number | null;
|
|
241
|
+
inventorySupplier: TInventorySupplier[];
|
|
242
|
+
itemUom: TItemUom[];
|
|
243
|
+
attributes: TItemAttribute[];
|
|
244
|
+
images: string[];
|
|
245
|
+
categoryList: number[];
|
|
246
|
+
userDefined: any[];
|
|
247
|
+
invMastText: any[];
|
|
248
|
+
stock: TStock;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
type TProductStockData = {
|
|
252
|
+
locationId: number;
|
|
253
|
+
companyId: string;
|
|
254
|
+
qtyOnHand: number;
|
|
255
|
+
qtyAllocated: number;
|
|
256
|
+
stockable: string;
|
|
257
|
+
unallocated: number;
|
|
258
|
+
nextDueInPoDate: string | null;
|
|
259
|
+
qtyBackordered: number;
|
|
260
|
+
primaryBin: string;
|
|
261
|
+
discontinued: string;
|
|
262
|
+
qtyFrozen: number;
|
|
263
|
+
qtyQuarantined: number;
|
|
264
|
+
qtyAvailable: number;
|
|
265
|
+
};
|
|
266
|
+
type TProductItem = {
|
|
267
|
+
brandName: string;
|
|
268
|
+
defaultSellingUnit: string;
|
|
269
|
+
extendedDesc: string;
|
|
270
|
+
images: string[];
|
|
271
|
+
invMastUid: number;
|
|
272
|
+
itemDesc: string;
|
|
273
|
+
itemId: string;
|
|
274
|
+
displayDesc: string;
|
|
275
|
+
manufacturerName: string;
|
|
276
|
+
shortCode: string | null;
|
|
277
|
+
classId5: string;
|
|
278
|
+
stock: {
|
|
279
|
+
stockData: TProductStockData[];
|
|
280
|
+
companySummary: Record<string, number>;
|
|
281
|
+
};
|
|
282
|
+
sourceFields: {
|
|
283
|
+
display_desc: string;
|
|
284
|
+
};
|
|
285
|
+
vndrStock: number;
|
|
286
|
+
};
|
|
287
|
+
type TItemDetails = {
|
|
288
|
+
attributes: TItemAttribute[];
|
|
289
|
+
categoryList: number[];
|
|
290
|
+
classId1: string | null;
|
|
291
|
+
classId2: string | null;
|
|
292
|
+
classId3: string | null;
|
|
293
|
+
classId4: string | null;
|
|
294
|
+
classId5: string | null;
|
|
295
|
+
defaultSellingUnit: string;
|
|
296
|
+
displayDesc: any;
|
|
297
|
+
extendedDesc: string;
|
|
298
|
+
images: string[];
|
|
299
|
+
invMastText: any[];
|
|
300
|
+
invMastUid: number;
|
|
301
|
+
itemDesc: string;
|
|
302
|
+
itemId: string;
|
|
303
|
+
itemUom: TItemUom[];
|
|
304
|
+
length: number;
|
|
305
|
+
vndrStock: any;
|
|
306
|
+
userDefined: any[];
|
|
307
|
+
isWood: boolean;
|
|
308
|
+
defaultProductGroup: string | null;
|
|
309
|
+
};
|
|
310
|
+
type TItemAccessory = {
|
|
311
|
+
childItemUom: TItemUom[];
|
|
312
|
+
childItemDesc: string;
|
|
313
|
+
childInvMastUid: number;
|
|
314
|
+
childItemId: string;
|
|
315
|
+
};
|
|
316
|
+
type TItemRelatedProduct = TItemDetails & {
|
|
317
|
+
childItemUom: TItemUom[];
|
|
318
|
+
childItemDesc: string;
|
|
319
|
+
childInvMastUid: number;
|
|
320
|
+
childItemId: string;
|
|
321
|
+
childImages: string[];
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
type TLibraryPriceBreak = {
|
|
325
|
+
calculationValue: number;
|
|
326
|
+
break: number;
|
|
327
|
+
unitPrice: number;
|
|
328
|
+
};
|
|
329
|
+
type TLibraryPriceData = {
|
|
330
|
+
unitPrice: number;
|
|
331
|
+
quantity: number;
|
|
332
|
+
pricePageUid: number;
|
|
333
|
+
pricePageCdType: number;
|
|
334
|
+
pricePageCdDesc: string;
|
|
335
|
+
effectiveDate: string;
|
|
336
|
+
expirationDate: string;
|
|
337
|
+
itemId: string;
|
|
338
|
+
invMastUid: number;
|
|
339
|
+
pricingMethodCd: number;
|
|
340
|
+
pricingMethodCdDesc: string;
|
|
341
|
+
sourcePriceCd: number;
|
|
342
|
+
sourcePriceCdDesc: string;
|
|
343
|
+
calculationMethodCd: number;
|
|
344
|
+
calculationMethodCdDesc: string;
|
|
345
|
+
totalingMethodCd: number;
|
|
346
|
+
totalingMethodCdDesc: string;
|
|
347
|
+
purchasePricingUnit: string;
|
|
348
|
+
purchasePricingUnitSize: number;
|
|
349
|
+
salesPricingUnit: string;
|
|
350
|
+
salesPricingUnitSize: number;
|
|
351
|
+
unitOfMeasure: string;
|
|
352
|
+
unitOfMeasureSize: number;
|
|
353
|
+
defaultSellingUnit: string;
|
|
354
|
+
defaultSellingUnitSize: number;
|
|
355
|
+
defaultPurchasingUnit: string;
|
|
356
|
+
defaultPurchasingUnitSize: number;
|
|
357
|
+
baseUnit: string;
|
|
358
|
+
baseUnitSize: number;
|
|
359
|
+
sourcePrice: number;
|
|
360
|
+
multiplier: number;
|
|
361
|
+
pricePageDiscountGroupId: string;
|
|
362
|
+
invLocSalesDiscountGroup: string;
|
|
363
|
+
baseSize: number;
|
|
364
|
+
basePrice: number;
|
|
365
|
+
breaks: Record<string, TLibraryPriceBreak>;
|
|
366
|
+
};
|
|
367
|
+
type TPriceData = {
|
|
368
|
+
pricedFrom: string;
|
|
369
|
+
unitPrice: number;
|
|
370
|
+
unitOfMeasure?: string;
|
|
371
|
+
jobPrice: boolean;
|
|
372
|
+
priceType: string;
|
|
373
|
+
customer: {
|
|
374
|
+
customerId: number;
|
|
375
|
+
valid: boolean;
|
|
376
|
+
sourcePriceCd: boolean;
|
|
377
|
+
hasJobPricing: boolean;
|
|
378
|
+
};
|
|
379
|
+
item: {
|
|
380
|
+
itemId: string;
|
|
381
|
+
valid: boolean;
|
|
382
|
+
invMastUid: number;
|
|
383
|
+
quantity: number;
|
|
384
|
+
unitOfMeasure: string;
|
|
385
|
+
};
|
|
386
|
+
options: {
|
|
387
|
+
customerId: string;
|
|
388
|
+
itemId: string;
|
|
389
|
+
cacheTtl: number;
|
|
390
|
+
};
|
|
391
|
+
messages: string[];
|
|
392
|
+
libraryPriceData: TLibraryPriceData;
|
|
393
|
+
listPrice: number;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
type TItemsFilters = {
|
|
397
|
+
filters: any[];
|
|
398
|
+
limit: number;
|
|
399
|
+
offset: number;
|
|
400
|
+
sortBy: string;
|
|
401
|
+
q: string;
|
|
402
|
+
page?: number;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
type TApiResponse<T> = {
|
|
406
|
+
status: string;
|
|
407
|
+
data: T | undefined;
|
|
408
|
+
error: {
|
|
409
|
+
message: string;
|
|
410
|
+
} | undefined;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
type CustomerDocument = {
|
|
414
|
+
customerId: number;
|
|
415
|
+
companyId: string;
|
|
416
|
+
customerName: string;
|
|
417
|
+
class1Id: string;
|
|
418
|
+
class2Id: string | null;
|
|
419
|
+
class3Id: string | null;
|
|
420
|
+
class4Id: string | null;
|
|
421
|
+
class5Id: string | null;
|
|
422
|
+
webEnabledFlag: string;
|
|
423
|
+
deleteFlag: string;
|
|
424
|
+
salesRepId: string;
|
|
425
|
+
poNoRequired: string;
|
|
426
|
+
termsId: string;
|
|
427
|
+
termsDesc: string;
|
|
428
|
+
taxableFlag: string;
|
|
429
|
+
userDefined: string[];
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
type MenuItem = {
|
|
433
|
+
id: number;
|
|
434
|
+
access: number;
|
|
435
|
+
alias: string;
|
|
436
|
+
level: number;
|
|
437
|
+
link: string;
|
|
438
|
+
menuType: string;
|
|
439
|
+
parentId: number;
|
|
440
|
+
path: string;
|
|
441
|
+
published: number;
|
|
442
|
+
title: string;
|
|
443
|
+
type: string;
|
|
444
|
+
children: MenuItem[];
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
type OrderHeader = {
|
|
448
|
+
carrier_id: string;
|
|
449
|
+
carrier_name: string;
|
|
450
|
+
contact_id: string;
|
|
451
|
+
customer_id: string;
|
|
452
|
+
company_id: string;
|
|
453
|
+
user_id: string;
|
|
454
|
+
user_email: string;
|
|
455
|
+
quote: "Y" | "N";
|
|
456
|
+
import_as_quote: "Y" | "N";
|
|
457
|
+
ip_address: string;
|
|
458
|
+
order_source: string;
|
|
459
|
+
web_source: string;
|
|
460
|
+
class_id1: string | null;
|
|
461
|
+
class_id2: string | null;
|
|
462
|
+
class_id3: string | null;
|
|
463
|
+
class_id4: string | null;
|
|
464
|
+
class_id5: string | null;
|
|
465
|
+
generate_po_number: number;
|
|
466
|
+
is_sample: string;
|
|
467
|
+
order_date: string;
|
|
468
|
+
customer_po_number: string;
|
|
469
|
+
ship_to_name: string;
|
|
470
|
+
ship_to_address1: string;
|
|
471
|
+
ship_to_address2: string;
|
|
472
|
+
ship_to_city: string;
|
|
473
|
+
ship_to_state: string;
|
|
474
|
+
ship_to_country: string;
|
|
475
|
+
ship_to_postal_code: string;
|
|
476
|
+
ship_to_address3: string | null;
|
|
477
|
+
ship_to_companyname: string;
|
|
478
|
+
ship_to_phone: string;
|
|
479
|
+
ship_to_email: string;
|
|
480
|
+
terms: string | null;
|
|
481
|
+
packing_basis: string | null;
|
|
482
|
+
delivery_instructions: string | null;
|
|
483
|
+
cart_tax: {
|
|
484
|
+
tax_amount: number;
|
|
485
|
+
tax_amount_string: string;
|
|
486
|
+
};
|
|
487
|
+
shipping_estimate: number;
|
|
488
|
+
incoming_freight: number;
|
|
489
|
+
handling_fee: number;
|
|
490
|
+
manager_approval_needed: number;
|
|
491
|
+
};
|
|
492
|
+
type OrderLine = {
|
|
493
|
+
item_id: string;
|
|
494
|
+
item_name: string;
|
|
495
|
+
currency: string;
|
|
496
|
+
index: number;
|
|
497
|
+
item_category: string;
|
|
498
|
+
price: number;
|
|
499
|
+
quantity: number;
|
|
500
|
+
displayDesc: string;
|
|
501
|
+
};
|
|
502
|
+
type OrderPayment = {
|
|
503
|
+
first_name: string;
|
|
504
|
+
last_name: string;
|
|
505
|
+
street_address1: string;
|
|
506
|
+
street_address2: string;
|
|
507
|
+
city: string;
|
|
508
|
+
state: string;
|
|
509
|
+
zip_code: string;
|
|
510
|
+
country: string;
|
|
511
|
+
processor: "invoice" | "element";
|
|
512
|
+
paymentType: "unified" | "invoice";
|
|
513
|
+
};
|
|
514
|
+
type OrderNote = {
|
|
515
|
+
note: string;
|
|
516
|
+
note_areas: string[];
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
type TShippingMethod = {
|
|
520
|
+
billingWeight: number;
|
|
521
|
+
billingWeightUom: string | null;
|
|
522
|
+
guaranteedDaysToDelivery: string | null;
|
|
523
|
+
negotiatedRates: number;
|
|
524
|
+
scheduledDeliveryTime: string | null;
|
|
525
|
+
serviceCode: string;
|
|
526
|
+
serviceName: string;
|
|
527
|
+
serviceOptionsCharges: number;
|
|
528
|
+
totalCharges: number;
|
|
529
|
+
transportationCharges: number;
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
type TTaxItem = {
|
|
533
|
+
itemId: string;
|
|
534
|
+
quantity: number;
|
|
535
|
+
unitOfMeasure: string;
|
|
536
|
+
unitPrice: number;
|
|
537
|
+
};
|
|
538
|
+
type TTax = {
|
|
539
|
+
taxEstimate: number;
|
|
540
|
+
customerId: number;
|
|
541
|
+
postalCode: string;
|
|
542
|
+
taxRate: number;
|
|
543
|
+
items: TTaxItem[];
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
type TMetaTags = {
|
|
547
|
+
invMastExtUid: number;
|
|
548
|
+
invMastUid: number;
|
|
549
|
+
metaTitle: string;
|
|
550
|
+
metaDescription: string;
|
|
551
|
+
metaKeywords: string;
|
|
552
|
+
};
|
|
553
|
+
type TWebDesc = {
|
|
554
|
+
invMastUid: number;
|
|
555
|
+
invMastWebDescUid: number;
|
|
556
|
+
webDesc1: string | null;
|
|
557
|
+
webDesc2: string | null;
|
|
558
|
+
webDesc3: string | null;
|
|
559
|
+
webDesc4: string | null;
|
|
560
|
+
webDescFull: string | null;
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Centralized cache configuration for React Query (TanStack Query)
|
|
565
|
+
*
|
|
566
|
+
* staleTime -- How long cached data is considered "fresh". While fresh,
|
|
567
|
+
* React Query serves the cache instantly and does NOT refetch in the
|
|
568
|
+
* background. After staleTime expires the data is "stale" and will be
|
|
569
|
+
* refetched on the next access (mount, window focus, etc.).
|
|
570
|
+
*
|
|
571
|
+
* gcTime (garbage collection time) -- How long UNUSED cached data stays in
|
|
572
|
+
* memory after all components using it unmount. Once gcTime expires the
|
|
573
|
+
* cache entry is deleted entirely.
|
|
574
|
+
*
|
|
575
|
+
* STATIC (1h): categories, menus, item details
|
|
576
|
+
* SEMI_STATIC (10m): pricing, stock, search results
|
|
577
|
+
* DYNAMIC (5m): infinite scroll data
|
|
578
|
+
* CART (2m): cart lines, cart header
|
|
579
|
+
* REALTIME (0): active orders, checkout state
|
|
580
|
+
*/
|
|
581
|
+
declare const CACHE_CONFIG: {
|
|
582
|
+
readonly STATIC: {
|
|
583
|
+
readonly staleTime: number;
|
|
584
|
+
readonly gcTime: number;
|
|
585
|
+
};
|
|
586
|
+
readonly SEMI_STATIC: {
|
|
587
|
+
readonly staleTime: number;
|
|
588
|
+
readonly gcTime: number;
|
|
589
|
+
};
|
|
590
|
+
readonly DYNAMIC: {
|
|
591
|
+
readonly staleTime: number;
|
|
592
|
+
readonly gcTime: number;
|
|
593
|
+
};
|
|
594
|
+
readonly CART: {
|
|
595
|
+
readonly staleTime: number;
|
|
596
|
+
readonly gcTime: number;
|
|
597
|
+
};
|
|
598
|
+
readonly REALTIME: {
|
|
599
|
+
readonly staleTime: 0;
|
|
600
|
+
readonly gcTime: number;
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
type CacheTier = keyof typeof CACHE_CONFIG;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Locale-aware currency formatting.
|
|
607
|
+
* Defaults to USD -- consumers can override locale and currency.
|
|
608
|
+
*/
|
|
609
|
+
declare function formatPrice(price: number, locale?: string, currency?: string): string;
|
|
610
|
+
|
|
611
|
+
export { CACHE_CONFIG, type CacheTier, type CustomerDocument, type MenuItem, type OrderHeader, type OrderLine, type OrderNote, type OrderPayment, type TApiResponse, type TAttribute, type TAttributeValue, type TCartHdrUid, type TCartLine, type TCartLookUp, type TCategory, type TCategoryChild, type TInvMast, type TInvMastDoc, type TInventorySupplier, type TItemAccessory, type TItemAttribute, type TItemCategory, type TItemDetails, type TItemRelatedProduct, type TItemUom, type TItemsFilters, type TLibraryPriceBreak, type TLibraryPriceData, type TMetaTags, type TOrderCartLine, type TPriceData, type TProductCategory, type TProductItem, type TProductStockData, type TShippingMethod, type TStock, type TStockData, type TTax, type TTaxItem, type TWebDesc, formatPrice };
|