@mohasinac/appkit 4.22.0 → 4.23.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.
Files changed (71) hide show
  1. package/dist/_internal/server/features/checkout/locked-lines.js +12 -2
  2. package/dist/_internal/server/features/stores/adapters.d.ts +1 -1
  3. package/dist/_internal/server/features/stores/adapters.js +5 -0
  4. package/dist/_internal/server/jobs/core/auctionSettlement.js +10 -4
  5. package/dist/_internal/server/jobs/core/offerExpiry.js +10 -2
  6. package/dist/_internal/server/jobs/core/payoutBatch.js +15 -3
  7. package/dist/_internal/shared/features/products/schema.d.ts +8 -8
  8. package/dist/_internal/shared/features/promotions/schema.d.ts +4 -4
  9. package/dist/_internal/shared/history/index.d.ts +1 -1
  10. package/dist/_internal/shared/history/types.d.ts +16 -0
  11. package/dist/client.d.ts +2 -0
  12. package/dist/client.js +1 -0
  13. package/dist/constants/field-names.d.ts +12 -0
  14. package/dist/constants/field-names.js +12 -0
  15. package/dist/features/admin/actions/admin-actions.js +13 -3
  16. package/dist/features/admin/components/AdminBidsView.js +7 -1
  17. package/dist/features/admin/components/AdminScammerEditorView.d.ts +5 -1
  18. package/dist/features/admin/components/AdminScammerEditorView.js +3 -2
  19. package/dist/features/admin/components/AdminSupportTicketDetailView.d.ts +5 -1
  20. package/dist/features/admin/components/AdminSupportTicketDetailView.js +3 -2
  21. package/dist/features/auctions/repository/bid.repository.d.ts +21 -8
  22. package/dist/features/auctions/repository/bid.repository.js +57 -33
  23. package/dist/features/auctions/schemas/firestore.d.ts +27 -0
  24. package/dist/features/auctions/schemas/firestore.js +21 -0
  25. package/dist/features/auth/schemas/index.d.ts +2 -2
  26. package/dist/features/catalogue/actions/approve-catalogue-listing.js +7 -6
  27. package/dist/features/catalogue/actions/list-from-catalogue.js +2 -2
  28. package/dist/features/catalogue/actions/submit-for-approval.js +1 -4
  29. package/dist/features/catalogue/components/AdminCatalogueApprovalsView.js +5 -1
  30. package/dist/features/catalogue/repository/catalogue.repository.d.ts +23 -0
  31. package/dist/features/catalogue/repository/catalogue.repository.js +28 -1
  32. package/dist/features/catalogue/schemas/firestore.d.ts +19 -0
  33. package/dist/features/catalogue/schemas/firestore.js +12 -0
  34. package/dist/features/categories/schemas/index.d.ts +2 -2
  35. package/dist/features/messages/schemas/index.d.ts +6 -6
  36. package/dist/features/orders/schemas/index.d.ts +12 -12
  37. package/dist/features/payments/repository/payout.repository.d.ts +18 -5
  38. package/dist/features/payments/repository/payout.repository.js +45 -19
  39. package/dist/features/payments/schemas/firestore.d.ts +33 -1
  40. package/dist/features/payments/schemas/firestore.js +39 -0
  41. package/dist/features/payments/schemas/index.d.ts +12 -12
  42. package/dist/features/products/schemas/index.d.ts +2 -2
  43. package/dist/features/promotions/schemas/index.d.ts +12 -12
  44. package/dist/features/scams/repository/scammer.repository.d.ts +18 -1
  45. package/dist/features/scams/repository/scammer.repository.js +24 -2
  46. package/dist/features/scams/schemas/firestore.d.ts +24 -0
  47. package/dist/features/scams/schemas/firestore.js +30 -0
  48. package/dist/features/shipments/components/AdminShipmentEditorView.js +2 -1
  49. package/dist/features/shipments/repository/shipments.repository.d.ts +18 -0
  50. package/dist/features/shipments/repository/shipments.repository.js +23 -1
  51. package/dist/features/shipments/schemas/firestore.d.ts +14 -0
  52. package/dist/features/shipments/schemas/firestore.js +19 -0
  53. package/dist/features/status-history/components/RecordStatusTimeline.d.ts +12 -0
  54. package/dist/features/status-history/components/RecordStatusTimeline.js +90 -0
  55. package/dist/features/status-history/index.d.ts +2 -0
  56. package/dist/features/status-history/index.js +1 -0
  57. package/dist/features/stores/repository/store.repository.d.ts +30 -2
  58. package/dist/features/stores/repository/store.repository.js +43 -4
  59. package/dist/features/stores/schemas/firestore.d.ts +29 -0
  60. package/dist/features/stores/schemas/firestore.js +31 -0
  61. package/dist/features/support/repository/support.repository.d.ts +47 -3
  62. package/dist/features/support/repository/support.repository.js +72 -12
  63. package/dist/features/support/schemas/firestore.d.ts +38 -1
  64. package/dist/features/support/schemas/firestore.js +34 -0
  65. package/dist/features/support/schemas/index.d.ts +2 -2
  66. package/dist/features/tester/seed-data/tester-checklist-seed-data.js +54 -0
  67. package/dist/index.d.ts +4 -1
  68. package/dist/index.js +12 -1
  69. package/dist/schemas/registry.d.ts +32 -32
  70. package/dist/seed/bids-seed-data.js +8 -0
  71. package/package.json +1 -1
@@ -15,6 +15,7 @@
15
15
  * - No new ticket in the same category while existing one is waiting_on_user
16
16
  */
17
17
  import type { BaseDocument } from "../../../_internal/shared/types/base-document";
18
+ import type { StatusChangeEntry } from "../../../_internal/shared/history/types";
18
19
  export declare const TicketCategoryValues: {
19
20
  readonly ORDER_ISSUE: "order_issue";
20
21
  readonly BILLING_PAYMENT: "billing_payment";
@@ -101,11 +102,47 @@ export interface SupportTicketDocument extends BaseDocument {
101
102
  internalNotes?: string;
102
103
  /** Threaded conversation. Ordered by createdAt asc. */
103
104
  messages: TicketMessage[];
105
+ /**
106
+ * Stamped by the repository the first time `status` becomes `resolved` /
107
+ * `closed`. Both were declared, given `SUPPORT_TICKET_FIELDS` constants and
108
+ * listed in `SupportTicketUpdateInput` — and **nothing ever wrote either**
109
+ * (verified 2026-08-26), so no resolved ticket in the collection carries a
110
+ * resolution time and "how long do tickets take" has never been answerable.
111
+ *
112
+ * Server-stamped, never client-sent: the same discipline the reports route
113
+ * adopted after a client-sent `resolvedAt` arrived as a JSON string into a
114
+ * `Date` field and split the collection into two shapes.
115
+ */
104
116
  resolvedAt?: Date;
105
117
  closedAt?: Date;
118
+ /**
119
+ * Who changed what, when, and why. See § "Status History" in CLAUDE.md.
120
+ * Append-only, capped at STATUS_HISTORY_MAX, oldest evicted first.
121
+ */
122
+ statusHistory?: StatusChangeEntry[];
123
+ /** How many entries fell off the front. Never imply "this is all of it". */
124
+ statusHistoryTruncated?: number;
106
125
  }
126
+ /**
127
+ * The fields whose changes earn a timeline entry.
128
+ *
129
+ * Explicit, not a whole-document diff: a diff would record the `updatedAt`
130
+ * bump on every write and exhaust the 50-entry cap within days. `messages` is
131
+ * excluded on purpose — the thread is already the conversation, and mirroring
132
+ * every reply into history would bury the handful of transitions anyone reads.
133
+ */
134
+ export declare const SUPPORT_TICKET_TRACKED_FIELDS: readonly ["status", "priority", "assignedTo", "resolvedAt", "closedAt"];
135
+ /**
136
+ * PII on this document, for `withHistory`'s scrub.
137
+ *
138
+ * `assignedToName` is a staff display name denormalised for the admin table —
139
+ * not the ticket author's identity — but it is still a person's name reaching
140
+ * an array `encryptPiiFields` cannot descend into, so history carries the UID
141
+ * (`assignedTo`) and never the name.
142
+ */
143
+ export declare const SUPPORT_TICKET_PII_FIELDS: readonly ["userEmail", "userDisplayName", "assignedToName"];
107
144
  export type SupportTicketCreateInput = Pick<SupportTicketDocument, "userId" | "userEmail" | "userDisplayName" | "category" | "subject" | "description" | "orderId">;
108
- export type SupportTicketUpdateInput = Partial<Pick<SupportTicketDocument, "status" | "priority" | "assignedTo" | "assignedToName" | "internalNotes" | "resolvedAt" | "closedAt" | "relatedParties">>;
145
+ export type SupportTicketUpdateInput = Partial<Pick<SupportTicketDocument, "status" | "priority" | "assignedTo" | "assignedToName" | "internalNotes" | "relatedParties">>;
109
146
  export declare const SUPPORT_TICKET_COLLECTION: "supportTickets";
110
147
  export declare const SUPPORT_TICKET_ID_PREFIX: "ticket-";
111
148
  export declare const SUPPORT_TICKET_INDEXED_FIELDS: readonly ["userId", "status", "category", "priority", "assignedTo", "orderId", "createdAt", "updatedAt"];
@@ -63,6 +63,40 @@ export const ELIGIBLE_ORDER_STATUSES_FOR_TICKET = [
63
63
  "SHIPPED",
64
64
  "RETURN_REQUESTED",
65
65
  ];
66
+ /**
67
+ * The fields whose changes earn a timeline entry.
68
+ *
69
+ * Explicit, not a whole-document diff: a diff would record the `updatedAt`
70
+ * bump on every write and exhaust the 50-entry cap within days. `messages` is
71
+ * excluded on purpose — the thread is already the conversation, and mirroring
72
+ * every reply into history would bury the handful of transitions anyone reads.
73
+ */
74
+ export const SUPPORT_TICKET_TRACKED_FIELDS = [
75
+ "status",
76
+ "priority",
77
+ "assignedTo",
78
+ "resolvedAt",
79
+ "closedAt",
80
+ ];
81
+ /**
82
+ * PII on this document, for `withHistory`'s scrub.
83
+ *
84
+ * `assignedToName` is a staff display name denormalised for the admin table —
85
+ * not the ticket author's identity — but it is still a person's name reaching
86
+ * an array `encryptPiiFields` cannot descend into, so history carries the UID
87
+ * (`assignedTo`) and never the name.
88
+ */
89
+ export const SUPPORT_TICKET_PII_FIELDS = [
90
+ "userEmail",
91
+ "userDisplayName",
92
+ "assignedToName",
93
+ ];
94
+ /*
95
+ * `resolvedAt` / `closedAt` are deliberately NOT in the update input. They are
96
+ * events, and the server is the only thing that knows when one happened —
97
+ * letting a client send them is how the reports collection ended up holding
98
+ * both Timestamps and ISO strings in one field.
99
+ */
66
100
  // ============================================================================
67
101
  // COLLECTION CONSTANTS
68
102
  // ============================================================================
@@ -182,6 +182,7 @@ export declare const supportTicketFirestoreSchema: z.ZodObject<{
182
182
  closedAt?: string | Date | z.objectOutputType<{
183
183
  toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
184
184
  }, z.ZodTypeAny, "passthrough"> | undefined;
185
+ assignedToName?: string | undefined;
185
186
  relatedParties?: {
186
187
  storeId?: string | undefined;
187
188
  userId?: string | undefined;
@@ -189,7 +190,6 @@ export declare const supportTicketFirestoreSchema: z.ZodObject<{
189
190
  productId?: string | undefined;
190
191
  bidId?: string | undefined;
191
192
  } | undefined;
192
- assignedToName?: string | undefined;
193
193
  internalNotes?: string | undefined;
194
194
  }, {
195
195
  status: "closed" | "open" | "resolved" | "in_progress" | "waiting_on_user";
@@ -225,6 +225,7 @@ export declare const supportTicketFirestoreSchema: z.ZodObject<{
225
225
  closedAt?: string | Date | z.objectInputType<{
226
226
  toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
227
227
  }, z.ZodTypeAny, "passthrough"> | undefined;
228
+ assignedToName?: string | undefined;
228
229
  relatedParties?: {
229
230
  storeId?: string | undefined;
230
231
  userId?: string | undefined;
@@ -232,7 +233,6 @@ export declare const supportTicketFirestoreSchema: z.ZodObject<{
232
233
  productId?: string | undefined;
233
234
  bidId?: string | undefined;
234
235
  } | undefined;
235
- assignedToName?: string | undefined;
236
236
  internalNotes?: string | undefined;
237
237
  }>;
238
238
  export type SupportTicketFromSchema = z.infer<typeof supportTicketFirestoreSchema>;
@@ -1156,6 +1156,60 @@ const rawTesterChecklistItems = [
1156
1156
  description: "The fix had to cover the update path as well as create — a create-only fix would mean the listing saved correctly and then lost its per-type block the first time anyone edited anything else (Root Cause #39).",
1157
1157
  href: "/store/classified",
1158
1158
  },
1159
+ {
1160
+ key: "ticket-resolution-timestamp-stamped",
1161
+ label: "Resolving a support ticket records WHEN it was resolved",
1162
+ description: "`resolvedAt` and `closedAt` were declared on the document, had field-name constants, were listed in the update input — and nothing had ever written either (verified 2026-08-26), so no resolved ticket carried a resolution time. Move a ticket to Resolved, reopen it, and confirm the timeline shows a real date on that step. Re-save an unrelated field afterwards: the resolution time must NOT move forward.",
1163
+ href: "/admin/support-tickets",
1164
+ },
1165
+ {
1166
+ key: "payout-utr-actually-saves",
1167
+ label: "The UTR entered when marking a payout paid is still there on reload",
1168
+ description: "The mark-paid modal REQUIRES a transaction reference, the route declared it, its own test asserted it reached the action — and the action picked only status/adminNote/processedAt, so the UTR was dropped while the 200 echoed it back as if stored. Mark a payout paid with a reference, reload the payout, and confirm 'Transaction ref' shows it.",
1169
+ href: "/admin/payouts",
1170
+ },
1171
+ {
1172
+ key: "store-approval-makes-it-public",
1173
+ label: "Approving a pending store actually makes it visible on /stores",
1174
+ description: "`status` and `isPublic` are two distinct fields and public visibility gates on `isPublic`. The admin PATCH wrote `status` directly and never touched `isPublic`, so an approved store was active AND invisible with no error anywhere. Approve `store-blader-bazaar`, then open /stores and confirm it appears.",
1175
+ href: "/admin/stores",
1176
+ },
1177
+ {
1178
+ key: "store-timeline-shows-who-suspended",
1179
+ label: "A suspended store's page shows who suspended it, when, and why",
1180
+ description: "Previously recoverable only from /admin/audit-log, which a store owner can never see. Suspend a store with a reason, open its admin detail page, and confirm the History block names the admin, the time, and the reason.",
1181
+ href: "/admin/stores",
1182
+ },
1183
+ {
1184
+ key: "payout-failure-reasons-survive-retries",
1185
+ label: "A payout that failed twice shows BOTH reasons, not just the last",
1186
+ description: "`lastFailureReason` is overwritten by every retry, so the timeline is the only place earlier attempts survive. Also confirm the four dispatch fields (razorpayPayoutId, razorpayStatus, failureCount, lastFailureReason) render — they were written by the batch and UNDECLARED on the document until 2026-08-26, so nothing could safely surface them.",
1187
+ href: "/admin/payouts",
1188
+ },
1189
+ {
1190
+ key: "bid-timeline-explains-forfeited",
1191
+ label: "A forfeited bid says why it was forfeited",
1192
+ description: "Open a forfeited bid from /admin/bids. The History block must read 'Forfeited' with the system actor and the reason 'The 48-hour checkout window closed without payment.' A bid moves through more states than any record a buyer owns and every one of them happened inside a settlement batch with nothing recording it.",
1193
+ href: "/admin/bids",
1194
+ },
1195
+ {
1196
+ key: "catalogue-rejection-reason-survives",
1197
+ label: "A catalogue item rejected twice keeps both reasons",
1198
+ description: "`rejectionReason` holds only the last decision. Reject a submission, have the owner resubmit, reject again with a different reason — the approval modal's History block must show both, each with its own date.",
1199
+ href: "/admin/catalogue-approvals",
1200
+ },
1201
+ {
1202
+ key: "history-absent-renders-empty-not-invented",
1203
+ label: "A record created BEFORE history existed shows 'no recorded history', not a made-up date",
1204
+ description: "Never fabricate a timestamp. Open any store, payout or ticket that predates this feature: the History block must say there is none, NOT derive a step from `updatedAt` — 'last write of any kind' is not an event, and a made-up date makes the record lie.",
1205
+ href: "/admin/stores",
1206
+ },
1207
+ {
1208
+ key: "history-carries-no-pii",
1209
+ label: "No name or email appears anywhere in a record's History block",
1210
+ description: "`encryptPiiFields` is a flat top-level loop that never descends into arrays, so a PII value inside statusHistory would be stored in PLAINTEXT. Every entry shows a ROLE (Admin/System/Buyer/Store) and never a name. Check a payout (sellerEmail/upiId), a bid (userName/userEmail) and a scammer profile (built entirely of identifying details).",
1211
+ href: "/admin/payouts",
1212
+ },
1159
1213
  {
1160
1214
  key: "form-errors-wait-for-first-submit",
1161
1215
  label: "Opening the address form shows NO errors until you press Save",
package/dist/index.d.ts CHANGED
@@ -2120,6 +2120,7 @@ export { SidebarLayout } from "./features/layout/index";
2120
2120
  export { TitleBar } from "./features/layout/index";
2121
2121
  export { TitleBarLayout } from "./features/layout/index";
2122
2122
  export { useBottomActions } from "./features/layout/index";
2123
+ export { RecordStatusTimeline } from "./features/status-history/index";
2123
2124
  export { useFormBottomActions } from "./features/layout/index";
2124
2125
  export { FormErrorList } from "./ui/forms";
2125
2126
  export { OverlayContext, useIsInsideOverlay } from "./ui/components/overlay-context";
@@ -3236,7 +3237,7 @@ export { getListingRule, getCategoryRule, pickOrderType, getSplitKey, runSyncPre
3236
3237
  export type { ListingCheckoutRule, CategoryCheckoutRule, CartItemProductPair, OrderItemInput, RefundPolicy, } from "./_internal/shared/checkout/rules";
3237
3238
  export { MEGABYTE, MAX_IMAGE_BYTES, MAX_PDF_BYTES, MAX_VIDEO_BYTES, MAX_LABEL, MAX_BYTES, ALLOWED_IMAGE_MIMES, ALLOWED_VIDEO_MIMES, ALLOWED_DOC_MIMES, ALLOWED_MIMES, ALLOWED_TYPES_LABEL, MIME_TO_EXT, PDF_MAGIC, VIDEO_CONVERSION_HINTS, classifyMime, isAllowedMime, maxBytesFor, getConversionHint, } from "./_internal/shared/media/limits";
3238
3239
  export type { MediaKind, AllowedImageMime, AllowedVideoMime, AllowedDocMime, AllowedMime, } from "./_internal/shared/media/limits";
3239
- export { PRODUCT_FIELDS, PRODUCT_STATUS_TRANSITIONS, ORDER_FIELDS, REVIEW_FIELDS, BID_FIELDS, AD_FIELDS, BLOG_FIELDS, BRAND_FIELDS, WISHLIST_FIELDS, HISTORY_FIELDS, COUPON_USAGE_FIELDS, CONVERSATION_FIELDS, CAROUSEL_FIELDS, FAQ_FIELDS, HOMEPAGE_SECTION_FIELDS, SITE_SETTINGS_FIELDS, COMMON_FIELDS, OAUTH_STATE_VALUES, SCHEMA_DEFAULTS, } from "./constants/field-names";
3240
+ export { PRODUCT_FIELDS, PRODUCT_STATUS_TRANSITIONS, ORDER_FIELDS, REVIEW_FIELDS, BID_FIELDS, AD_FIELDS, AD_TRACKED_FIELDS, BLOG_FIELDS, BRAND_FIELDS, WISHLIST_FIELDS, HISTORY_FIELDS, COUPON_USAGE_FIELDS, CONVERSATION_FIELDS, CAROUSEL_FIELDS, FAQ_FIELDS, HOMEPAGE_SECTION_FIELDS, SITE_SETTINGS_FIELDS, COMMON_FIELDS, OAUTH_STATE_VALUES, SCHEMA_DEFAULTS, } from "./constants/field-names";
3240
3241
  export { SORT_DIR, sortBy } from "./constants/sort";
3241
3242
  export type { SortDirection } from "./constants/sort";
3242
3243
  export { TABLE_KEYS, VIEW_MODE } from "./constants/table-keys";
@@ -3297,3 +3298,5 @@ export { adminUserUpdateSchema, whatsappSettingsSchema, lotteryPullSchema, } fro
3297
3298
  export { siteSettingsFormSchema } from "./features/admin/schemas/site-settings-form";
3298
3299
  export { createReviewSchema as reviewSubmitSchema } from "./_internal/shared/features/reviews/schema";
3299
3300
  export { wishlistAddSchema } from "./schemas/api-routes";
3301
+ export { withHistory, buildHistoryEntry, appendHistoryEntry, diffTrackedFields, STATUS_HISTORY_MAX, } from "./_internal/shared/history/index";
3302
+ export type { StatusChangeEntry, SerialisedStatusChangeEntry, HistoryActor, HistoryActorRole, FieldChange, } from "./_internal/shared/history/index";
package/dist/index.js CHANGED
@@ -3934,6 +3934,7 @@ export { TitleBarLayout } from "./features/layout/index";
3934
3934
  // [CLIENT-SSR]-Runs in both SSR and browser â€" React component or hook that does not depend on browser-only APIs.
3935
3935
  // useBottomActions - React hook for use bottom actions.
3936
3936
  export { useBottomActions } from "./features/layout/index";
3937
+ export { RecordStatusTimeline } from "./features/status-history/index";
3937
3938
  // useFormBottomActions - pins a form's Save/Cancel row + error sheet to the mobile bottom-chrome tier.
3938
3939
  export { useFormBottomActions } from "./features/layout/index";
3939
3940
  export { FormErrorList } from "./ui/forms";
@@ -5641,7 +5642,7 @@ export { MEGABYTE, MAX_IMAGE_BYTES, MAX_PDF_BYTES, MAX_VIDEO_BYTES, MAX_LABEL, M
5641
5642
  // NOTE: STORE_FIELDS, CATEGORY_FIELDS, EVENT_FIELDS, EVENT_ENTRY_FIELDS, PAYOUT_FIELDS,
5642
5643
  // COUPON_FIELDS, CART_FIELDS, USER_FIELDS, ADDRESS_FIELDS, NOTIFICATION_FIELDS,
5643
5644
  // SESSION_FIELDS, SCAMMER_FIELDS are already exported from feature barrels above.
5644
- export { PRODUCT_FIELDS, PRODUCT_STATUS_TRANSITIONS, ORDER_FIELDS, REVIEW_FIELDS, BID_FIELDS, AD_FIELDS, BLOG_FIELDS, BRAND_FIELDS, WISHLIST_FIELDS, HISTORY_FIELDS, COUPON_USAGE_FIELDS, CONVERSATION_FIELDS, CAROUSEL_FIELDS, FAQ_FIELDS, HOMEPAGE_SECTION_FIELDS, SITE_SETTINGS_FIELDS, COMMON_FIELDS, OAUTH_STATE_VALUES, SCHEMA_DEFAULTS, } from "./constants/field-names";
5645
+ export { PRODUCT_FIELDS, PRODUCT_STATUS_TRANSITIONS, ORDER_FIELDS, REVIEW_FIELDS, BID_FIELDS, AD_FIELDS, AD_TRACKED_FIELDS, BLOG_FIELDS, BRAND_FIELDS, WISHLIST_FIELDS, HISTORY_FIELDS, COUPON_USAGE_FIELDS, CONVERSATION_FIELDS, CAROUSEL_FIELDS, FAQ_FIELDS, HOMEPAGE_SECTION_FIELDS, SITE_SETTINGS_FIELDS, COMMON_FIELDS, OAUTH_STATE_VALUES, SCHEMA_DEFAULTS, } from "./constants/field-names";
5645
5646
  // ── Sort helpers ──────────────────────────────────────────────────────────────
5646
5647
  export { SORT_DIR, sortBy } from "./constants/sort";
5647
5648
  // ── URL table keys + view mode ────────────────────────────────────────────────
@@ -5715,3 +5716,13 @@ export { siteSettingsFormSchema } from "./features/admin/schemas/site-settings-f
5715
5716
  */
5716
5717
  export { createReviewSchema as reviewSubmitSchema } from "./_internal/shared/features/reviews/schema";
5717
5718
  export { wishlistAddSchema } from "./schemas/api-routes";
5719
+ /*
5720
+ * Status history — the generic primitive behind every entity timeline.
5721
+ *
5722
+ * `withHistory` is exported because ads have no repository of their own: they
5723
+ * live inside the `siteSettings` singleton, so their route calls it directly.
5724
+ * Every other adopter funnels through its repository's write primitives and
5725
+ * should keep doing so — a call site reaching for this outside a repository
5726
+ * is usually a missing funnel, not a reason to export more of it.
5727
+ */
5728
+ export { withHistory, buildHistoryEntry, appendHistoryEntry, diffTrackedFields, STATUS_HISTORY_MAX, } from "./_internal/shared/history/index";
@@ -1234,7 +1234,7 @@ export declare const SCHEMAS: {
1234
1234
  }, import("zod").ZodTypeAny, "passthrough"> | undefined;
1235
1235
  featuredPriority?: number | undefined;
1236
1236
  isBrand?: boolean | undefined;
1237
- createdByType?: "store" | "admin" | undefined;
1237
+ createdByType?: "admin" | "store" | undefined;
1238
1238
  createdByStoreId?: string | undefined;
1239
1239
  itemCode?: string | undefined;
1240
1240
  brandWebsite?: string | undefined;
@@ -1333,7 +1333,7 @@ export declare const SCHEMAS: {
1333
1333
  }, import("zod").ZodTypeAny, "passthrough"> | undefined;
1334
1334
  featuredPriority?: number | undefined;
1335
1335
  isBrand?: boolean | undefined;
1336
- createdByType?: "store" | "admin" | undefined;
1336
+ createdByType?: "admin" | "store" | undefined;
1337
1337
  createdByStoreId?: string | undefined;
1338
1338
  itemCode?: string | undefined;
1339
1339
  brandWebsite?: string | undefined;
@@ -1406,7 +1406,7 @@ export declare const SCHEMAS: {
1406
1406
  }>;
1407
1407
  }, "strip", import("zod").ZodTypeAny, {
1408
1408
  type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
1409
- scope: "admin" | "seller";
1409
+ scope: "seller" | "admin";
1410
1410
  name: string;
1411
1411
  discount: {
1412
1412
  value: number;
@@ -1425,7 +1425,7 @@ export declare const SCHEMAS: {
1425
1425
  description?: string | undefined;
1426
1426
  }, {
1427
1427
  type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
1428
- scope: "admin" | "seller";
1428
+ scope: "seller" | "admin";
1429
1429
  name: string;
1430
1430
  discount: {
1431
1431
  value: number;
@@ -1485,7 +1485,7 @@ export declare const SCHEMAS: {
1485
1485
  couponId: string;
1486
1486
  couponSnapshot: {
1487
1487
  type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
1488
- scope: "admin" | "seller";
1488
+ scope: "seller" | "admin";
1489
1489
  name: string;
1490
1490
  discount: {
1491
1491
  value: number;
@@ -1525,7 +1525,7 @@ export declare const SCHEMAS: {
1525
1525
  couponId: string;
1526
1526
  couponSnapshot: {
1527
1527
  type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
1528
- scope: "admin" | "seller";
1528
+ scope: "seller" | "admin";
1529
1529
  name: string;
1530
1530
  discount: {
1531
1531
  value: number;
@@ -1596,7 +1596,7 @@ export declare const SCHEMAS: {
1596
1596
  body: string;
1597
1597
  isRead: boolean;
1598
1598
  senderId: string;
1599
- senderRole: "seller" | "buyer";
1599
+ senderRole: "buyer" | "seller";
1600
1600
  sentAt: string | Date | import("zod").objectOutputType<{
1601
1601
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
1602
1602
  }, import("zod").ZodTypeAny, "passthrough">;
@@ -1606,7 +1606,7 @@ export declare const SCHEMAS: {
1606
1606
  body: string;
1607
1607
  isRead: boolean;
1608
1608
  senderId: string;
1609
- senderRole: "seller" | "buyer";
1609
+ senderRole: "buyer" | "seller";
1610
1610
  sentAt: string | Date | import("zod").objectInputType<{
1611
1611
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
1612
1612
  }, import("zod").ZodTypeAny, "passthrough">;
@@ -1644,7 +1644,7 @@ export declare const SCHEMAS: {
1644
1644
  body: string;
1645
1645
  isRead: boolean;
1646
1646
  senderId: string;
1647
- senderRole: "seller" | "buyer";
1647
+ senderRole: "buyer" | "seller";
1648
1648
  sentAt: string | Date | import("zod").objectOutputType<{
1649
1649
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
1650
1650
  }, import("zod").ZodTypeAny, "passthrough">;
@@ -1677,7 +1677,7 @@ export declare const SCHEMAS: {
1677
1677
  body: string;
1678
1678
  isRead: boolean;
1679
1679
  senderId: string;
1680
- senderRole: "seller" | "buyer";
1680
+ senderRole: "buyer" | "seller";
1681
1681
  sentAt: string | Date | import("zod").objectInputType<{
1682
1682
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
1683
1683
  }, import("zod").ZodTypeAny, "passthrough">;
@@ -1838,7 +1838,7 @@ export declare const SCHEMAS: {
1838
1838
  code: string;
1839
1839
  type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
1840
1840
  id: string;
1841
- scope: "admin" | "seller";
1841
+ scope: "seller" | "admin";
1842
1842
  name: string;
1843
1843
  createdAt: string | Date | import("zod").objectOutputType<{
1844
1844
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
@@ -1896,7 +1896,7 @@ export declare const SCHEMAS: {
1896
1896
  code: string;
1897
1897
  type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
1898
1898
  id: string;
1899
- scope: "admin" | "seller";
1899
+ scope: "seller" | "admin";
1900
1900
  name: string;
1901
1901
  createdAt: string | Date | import("zod").objectInputType<{
1902
1902
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
@@ -2372,14 +2372,14 @@ export declare const SCHEMAS: {
2372
2372
  code: string;
2373
2373
  type: "auto" | "coupon" | "deal";
2374
2374
  discountAmount: number;
2375
- scope?: "admin" | "seller" | undefined;
2375
+ scope?: "seller" | "admin" | undefined;
2376
2376
  storeId?: string | undefined;
2377
2377
  couponId?: string | undefined;
2378
2378
  }, {
2379
2379
  code: string;
2380
2380
  type: "auto" | "coupon" | "deal";
2381
2381
  discountAmount: number;
2382
- scope?: "admin" | "seller" | undefined;
2382
+ scope?: "seller" | "admin" | undefined;
2383
2383
  storeId?: string | undefined;
2384
2384
  couponId?: string | undefined;
2385
2385
  }>, "many">>;
@@ -2510,9 +2510,9 @@ export declare const SCHEMAS: {
2510
2510
  overrideReason: import("zod").ZodOptional<import("zod").ZodString>;
2511
2511
  }, "strip", import("zod").ZodTypeAny, {
2512
2512
  type: "full" | "partial";
2513
+ reason: string;
2513
2514
  amount: number;
2514
2515
  refundId: string;
2515
- reason: string;
2516
2516
  refundedAt: string | Date | import("zod").objectOutputType<{
2517
2517
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
2518
2518
  }, import("zod").ZodTypeAny, "passthrough">;
@@ -2525,9 +2525,9 @@ export declare const SCHEMAS: {
2525
2525
  overrideReason?: string | undefined;
2526
2526
  }, {
2527
2527
  type: "full" | "partial";
2528
+ reason: string;
2528
2529
  amount: number;
2529
2530
  refundId: string;
2530
- reason: string;
2531
2531
  refundedAt: string | Date | import("zod").objectInputType<{
2532
2532
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
2533
2533
  }, import("zod").ZodTypeAny, "passthrough">;
@@ -2668,7 +2668,7 @@ export declare const SCHEMAS: {
2668
2668
  code: string;
2669
2669
  type: "auto" | "coupon" | "deal";
2670
2670
  discountAmount: number;
2671
- scope?: "admin" | "seller" | undefined;
2671
+ scope?: "seller" | "admin" | undefined;
2672
2672
  storeId?: string | undefined;
2673
2673
  couponId?: string | undefined;
2674
2674
  }[] | undefined;
@@ -2700,9 +2700,9 @@ export declare const SCHEMAS: {
2700
2700
  paymentBatchId?: string | undefined;
2701
2701
  refunds?: {
2702
2702
  type: "full" | "partial";
2703
+ reason: string;
2703
2704
  amount: number;
2704
2705
  refundId: string;
2705
- reason: string;
2706
2706
  refundedAt: string | Date | import("zod").objectOutputType<{
2707
2707
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
2708
2708
  }, import("zod").ZodTypeAny, "passthrough">;
@@ -2816,7 +2816,7 @@ export declare const SCHEMAS: {
2816
2816
  code: string;
2817
2817
  type: "auto" | "coupon" | "deal";
2818
2818
  discountAmount: number;
2819
- scope?: "admin" | "seller" | undefined;
2819
+ scope?: "seller" | "admin" | undefined;
2820
2820
  storeId?: string | undefined;
2821
2821
  couponId?: string | undefined;
2822
2822
  }[] | undefined;
@@ -2848,9 +2848,9 @@ export declare const SCHEMAS: {
2848
2848
  paymentBatchId?: string | undefined;
2849
2849
  refunds?: {
2850
2850
  type: "full" | "partial";
2851
+ reason: string;
2851
2852
  amount: number;
2852
2853
  refundId: string;
2853
- reason: string;
2854
2854
  refundedAt: string | Date | import("zod").objectInputType<{
2855
2855
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
2856
2856
  }, import("zod").ZodTypeAny, "passthrough">;
@@ -2944,20 +2944,20 @@ export declare const SCHEMAS: {
2944
2944
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
2945
2945
  }, import("zod").ZodTypeAny, "passthrough">>]>;
2946
2946
  }, "strip", import("zod").ZodTypeAny, {
2947
+ reason: string;
2947
2948
  orderId: string;
2948
2949
  refundId: string;
2949
2950
  refundedAmount: number;
2950
2951
  deductedAmount: number;
2951
- reason: string;
2952
2952
  appliedAt: string | Date | import("zod").objectOutputType<{
2953
2953
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
2954
2954
  }, import("zod").ZodTypeAny, "passthrough">;
2955
2955
  }, {
2956
+ reason: string;
2956
2957
  orderId: string;
2957
2958
  refundId: string;
2958
2959
  refundedAmount: number;
2959
2960
  deductedAmount: number;
2960
- reason: string;
2961
2961
  appliedAt: string | Date | import("zod").objectInputType<{
2962
2962
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
2963
2963
  }, import("zod").ZodTypeAny, "passthrough">;
@@ -2999,6 +2999,9 @@ export declare const SCHEMAS: {
2999
2999
  platformFeeRate: number;
3000
3000
  paymentMethod: "bank_transfer" | "upi";
3001
3001
  orderIds: string[];
3002
+ processedAt?: string | Date | import("zod").objectOutputType<{
3003
+ toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
3004
+ }, import("zod").ZodTypeAny, "passthrough"> | undefined;
3002
3005
  bankAccount?: {
3003
3006
  accountHolderName: string;
3004
3007
  accountNumberMasked: string;
@@ -3014,19 +3017,16 @@ export declare const SCHEMAS: {
3014
3017
  gstRate?: number | undefined;
3015
3018
  isAutomatic?: boolean | undefined;
3016
3019
  refundDeductions?: {
3020
+ reason: string;
3017
3021
  orderId: string;
3018
3022
  refundId: string;
3019
3023
  refundedAmount: number;
3020
3024
  deductedAmount: number;
3021
- reason: string;
3022
3025
  appliedAt: string | Date | import("zod").objectOutputType<{
3023
3026
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
3024
3027
  }, import("zod").ZodTypeAny, "passthrough">;
3025
3028
  }[] | undefined;
3026
3029
  netAmount?: number | undefined;
3027
- processedAt?: string | Date | import("zod").objectOutputType<{
3028
- toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
3029
- }, import("zod").ZodTypeAny, "passthrough"> | undefined;
3030
3030
  }, {
3031
3031
  currency: string;
3032
3032
  status: "paid" | "failed" | "pending" | "processing";
@@ -3049,6 +3049,9 @@ export declare const SCHEMAS: {
3049
3049
  platformFeeRate: number;
3050
3050
  paymentMethod: "bank_transfer" | "upi";
3051
3051
  orderIds: string[];
3052
+ processedAt?: string | Date | import("zod").objectInputType<{
3053
+ toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
3054
+ }, import("zod").ZodTypeAny, "passthrough"> | undefined;
3052
3055
  bankAccount?: {
3053
3056
  accountHolderName: string;
3054
3057
  accountNumberMasked: string;
@@ -3064,19 +3067,16 @@ export declare const SCHEMAS: {
3064
3067
  gstRate?: number | undefined;
3065
3068
  isAutomatic?: boolean | undefined;
3066
3069
  refundDeductions?: {
3070
+ reason: string;
3067
3071
  orderId: string;
3068
3072
  refundId: string;
3069
3073
  refundedAmount: number;
3070
3074
  deductedAmount: number;
3071
- reason: string;
3072
3075
  appliedAt: string | Date | import("zod").objectInputType<{
3073
3076
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
3074
3077
  }, import("zod").ZodTypeAny, "passthrough">;
3075
3078
  }[] | undefined;
3076
3079
  netAmount?: number | undefined;
3077
- processedAt?: string | Date | import("zod").objectInputType<{
3078
- toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
3079
- }, import("zod").ZodTypeAny, "passthrough"> | undefined;
3080
3080
  }>;
3081
3081
  readonly reviews: import("zod").ZodObject<{
3082
3082
  createdAt: import("zod").ZodUnion<[import("zod").ZodDate, import("zod").ZodString, import("zod").ZodObject<{
@@ -4192,6 +4192,7 @@ export declare const SCHEMAS: {
4192
4192
  closedAt?: string | Date | import("zod").objectOutputType<{
4193
4193
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
4194
4194
  }, import("zod").ZodTypeAny, "passthrough"> | undefined;
4195
+ assignedToName?: string | undefined;
4195
4196
  relatedParties?: {
4196
4197
  storeId?: string | undefined;
4197
4198
  userId?: string | undefined;
@@ -4199,7 +4200,6 @@ export declare const SCHEMAS: {
4199
4200
  productId?: string | undefined;
4200
4201
  bidId?: string | undefined;
4201
4202
  } | undefined;
4202
- assignedToName?: string | undefined;
4203
4203
  internalNotes?: string | undefined;
4204
4204
  }, {
4205
4205
  status: "closed" | "open" | "resolved" | "in_progress" | "waiting_on_user";
@@ -4235,6 +4235,7 @@ export declare const SCHEMAS: {
4235
4235
  closedAt?: string | Date | import("zod").objectInputType<{
4236
4236
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
4237
4237
  }, import("zod").ZodTypeAny, "passthrough"> | undefined;
4238
+ assignedToName?: string | undefined;
4238
4239
  relatedParties?: {
4239
4240
  storeId?: string | undefined;
4240
4241
  userId?: string | undefined;
@@ -4242,7 +4243,6 @@ export declare const SCHEMAS: {
4242
4243
  productId?: string | undefined;
4243
4244
  bidId?: string | undefined;
4244
4245
  } | undefined;
4245
- assignedToName?: string | undefined;
4246
4246
  internalNotes?: string | undefined;
4247
4247
  }>;
4248
4248
  };
@@ -35,6 +35,14 @@ const BIDDER_NAMES = {
35
35
  "user-rohit-collector": "Mock User 14",
36
36
  "user-ananya-collector": "Mock User 9",
37
37
  };
38
+ /*
39
+ * Typed on the document, not `FirestoreDocument`. Once `BidDocument` gained
40
+ * `statusHistory?: StatusChangeEntry[]`, `Partial<BidDocument>` stopped being
41
+ * assignable to `FirestoreDocument` — an array of objects does not satisfy
42
+ * that index signature. The right fix is to narrow the parameter to what the
43
+ * caller actually passes rather than widen the document to keep a helper
44
+ * happy.
45
+ */
38
46
  function withBidDefaults(b) {
39
47
  return {
40
48
  ...b,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohasinac/appkit",
3
- "version": "4.22.0",
3
+ "version": "4.23.0",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"