@mohasinac/appkit 4.42.14 โ†’ 4.42.16

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.
@@ -21,6 +21,7 @@ import { normalizeError } from "../../../../errors/normalize";
21
21
  import { serverLogger } from "../../../../monitoring";
22
22
  import { ValidationError } from "../../../../errors";
23
23
  import { ORDER_FIELDS } from "../../../../constants/field-names";
24
+ import { firestoreTimestampToDate } from "../../../../utils/type.converter";
24
25
  import { PRODUCT_COLLECTION, PRODUCT_CODES_SUBCOLLECTION, } from "../../../../features/products/schemas/firestore";
25
26
  /**
26
27
  * Where a delivered asset's bytes live.
@@ -181,8 +182,28 @@ export async function listPoolEntries(productId) {
181
182
  status: c.status,
182
183
  ...(c.fileName ? { fileName: c.fileName } : {}),
183
184
  ...(c.orderId ? { orderId: c.orderId } : {}),
184
- ...(c.claimedAt ? { claimedAt: new Date(c.claimedAt).toISOString() } : {}),
185
- ...(c.createdAt ? { createdAt: new Date(c.createdAt).toISOString() } : {}),
185
+ /*
186
+ * ๐Ÿ›‘ firestoreTimestampToDate, never `new Date(value)`.
187
+ *
188
+ * addPoolEntries writes `createdAt: new Date()`, and the Admin SDK stores
189
+ * that as a Firestore Timestamp and reads it back as one โ€” NOT as a Date.
190
+ * `new Date(aTimestamp)` is an Invalid Date, and `.toISOString()` on an
191
+ * Invalid Date THROWS RangeError, so this map took the whole route down
192
+ * with a 500.
193
+ *
194
+ * It hid for as long as it possibly could: mapping over ZERO documents
195
+ * never throws, so GET answered `[]` for the entire period the pool had
196
+ * no writer (Root Cause #103) and only began failing once the first entry
197
+ * existed. The seller then saw "Nothing in the pool yet" โ€” the component
198
+ * rendering a failed load as an empty state โ€” and the rational response
199
+ * is to add the codes again, which silently accumulates duplicates.
200
+ */
201
+ ...(c.claimedAt
202
+ ? { claimedAt: firestoreTimestampToDate(c.claimedAt).toISOString() }
203
+ : {}),
204
+ ...(c.createdAt
205
+ ? { createdAt: firestoreTimestampToDate(c.createdAt).toISOString() }
206
+ : {}),
186
207
  };
187
208
  });
188
209
  }
@@ -69,9 +69,17 @@ export function AdminStoresView({ children, ...props }) {
69
69
  mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
70
70
  id: toStringValue(item.id, `store-${index}`),
71
71
  primary: toStringValue(item.storeName, "Unnamed store"),
72
+ // Verified / Featured are rendered here because an admin's first
73
+ // question about a store is whether it carries either, and the row
74
+ // is where that gets scanned. The API has always returned both
75
+ // (route.ts serialises isVerified/isFeatured) and the editor already
76
+ // seeds from them โ€” only the list never showed them, so the flags
77
+ // were invisible until you opened each store one at a time.
72
78
  secondary: [
73
79
  toStringValue(item.storeSlug, "No slug"),
74
80
  toStringValue(item.ownerId, "No owner"),
81
+ ...(item.isVerified ? ["Verified"] : []),
82
+ ...(item.isFeatured ? ["Featured"] : []),
75
83
  ].join(" ยท "),
76
84
  status: toStringValue(item.status, "Pending"),
77
85
  updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohasinac/appkit",
3
- "version": "4.42.14",
3
+ "version": "4.42.16",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"