@mohasinac/appkit 4.41.12 โ 4.41.13
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.
|
@@ -141,9 +141,35 @@ export function AdminOrdersView({ children, ...props }) {
|
|
|
141
141
|
? `${title}${extraCount > 0 ? ` +${extraCount} more` : ""}`
|
|
142
142
|
: `Order ${orderId}`,
|
|
143
143
|
secondary: [
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
/*
|
|
145
|
+
* ๐ `userName` and `totalPrice` FIRST โ they are the document's
|
|
146
|
+
* real field names (OrderDocument, and the live response of
|
|
147
|
+
* GET /api/admin/orders).
|
|
148
|
+
*
|
|
149
|
+
* This read `buyerName ?? customerName` and
|
|
150
|
+
* `totalAmount ?? total ?? amount`: five names, not one of which
|
|
151
|
+
* the order document has ever carried. So every row rendered
|
|
152
|
+
* "Unknown buyer ยท -", on all 25 rows, for as long as the view has
|
|
153
|
+
* existed โ and the `??` chains made it look like considered
|
|
154
|
+
* defensive coding rather than a guess. A fallback spelled three
|
|
155
|
+
* ways is the tell that nobody checked which one was real.
|
|
156
|
+
*
|
|
157
|
+
* The aliases are GONE rather than demoted to fallbacks: nothing
|
|
158
|
+
* declares them (the client `Order` type has no such fields) and
|
|
159
|
+
* nothing emits them (no adapter renames to them). Keeping a
|
|
160
|
+
* fallback with no producer only preserves the ambiguity that
|
|
161
|
+
* hid the bug.
|
|
162
|
+
*/
|
|
163
|
+
toStringValue(item.userName, "Unknown buyer"),
|
|
164
|
+
toCurrency(item.totalPrice),
|
|
165
|
+
/*
|
|
166
|
+
* Not `.slice(0, 14)` โ that cut mid-date, so
|
|
167
|
+
* `order-1-20260822-aucwon` and `order-1-20260821-prizedr` both
|
|
168
|
+
* rendered as "order-1-202608". A truncation that destroys
|
|
169
|
+
* uniqueness is worse than a long string, because the id is the
|
|
170
|
+
* one thing on the row an admin searches by.
|
|
171
|
+
*/
|
|
172
|
+
orderId,
|
|
147
173
|
paymentReviewLabel(item),
|
|
148
174
|
]
|
|
149
175
|
.filter(Boolean)
|
|
@@ -366,13 +366,37 @@ export function SellerOrdersView({ orderDetailApiBase = SELLER_ENDPOINTS.ORDERS,
|
|
|
366
366
|
const loc = item.physicalLocation;
|
|
367
367
|
return {
|
|
368
368
|
id: toStringValue(item.id, `order-${index}`),
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
/*
|
|
370
|
+
* ๐ The row says WHAT WAS SOLD, not the id repeated.
|
|
371
|
+
*
|
|
372
|
+
* This was `Order ${id.slice(0, 14)}` โ a raw id, truncated
|
|
373
|
+
* mid-date, so two different orders rendered identically. The title
|
|
374
|
+
* was available the whole time: `items[0].productTitle` is
|
|
375
|
+
* denormalised onto every order precisely so a list never needs a
|
|
376
|
+
* second fetch (Root Cause #52), and it is already read three lines
|
|
377
|
+
* below as `itemTitle`.
|
|
378
|
+
*/
|
|
379
|
+
primary: (() => {
|
|
380
|
+
const title = typeof firstItem.productTitle === "string" ? firstItem.productTitle : "";
|
|
381
|
+
if (!title)
|
|
382
|
+
return `Order ${toStringValue(item.id, "-")}`;
|
|
383
|
+
const extra = itemsArr.length - 1;
|
|
384
|
+
return extra > 0 ? `${title} +${extra} more` : title;
|
|
385
|
+
})(),
|
|
386
|
+
/*
|
|
387
|
+
* `userName` / `totalPrice` are the document's real field names.
|
|
388
|
+
* `buyerName`/`buyerDisplayName`/`totalAmount`/`total` are four
|
|
389
|
+
* spellings the order document has never carried, so every seller's
|
|
390
|
+
* order list showed "Unknown buyer" and โน0 โ see AdminOrdersView for
|
|
391
|
+
* the full writeup. They are removed rather than demoted: nothing
|
|
392
|
+
* declares them and nothing emits them.
|
|
393
|
+
*/
|
|
394
|
+
secondary: toStringValue(item.userName, "Unknown buyer"),
|
|
371
395
|
status: toStringValue(item.status, "PENDING"),
|
|
372
396
|
updatedAt: toRelativeDate(item.updatedAt ?? item.orderDate ?? item.createdAt),
|
|
373
397
|
itemCount: itemsArr.length,
|
|
374
|
-
totalAmount: Number(item.
|
|
375
|
-
buyerName: toStringValue(item.
|
|
398
|
+
totalAmount: Number(item.totalPrice ?? 0),
|
|
399
|
+
buyerName: toStringValue(item.userName, "Unknown buyer"),
|
|
376
400
|
itemImage: typeof firstItem.image === "string" ? firstItem.image : undefined,
|
|
377
401
|
itemTitle: typeof firstItem.productTitle === "string" ? firstItem.productTitle : undefined,
|
|
378
402
|
physicalLocation: loc && typeof loc.zone === "string"
|