@mohasinac/appkit 4.60.1 → 4.62.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 (202) hide show
  1. package/dist/.build-stamp.json +3 -3
  2. package/dist/_internal/client/features/lottery/LotteryAdminEditView.js +19 -3
  3. package/dist/_internal/client/features/maintenance/views/AnalysisRunnerView.js +1 -1
  4. package/dist/_internal/client/features/maintenance/views/CloudLogsListView.js +1 -1
  5. package/dist/_internal/server/features/auctions/actions.d.ts +1 -1
  6. package/dist/_internal/server/features/auctions/actions.js +12 -1
  7. package/dist/_internal/server/features/blog/actions.d.ts +1 -1
  8. package/dist/_internal/server/features/blog/actions.js +12 -1
  9. package/dist/_internal/server/features/brands/actions.d.ts +1 -1
  10. package/dist/_internal/server/features/brands/actions.js +12 -1
  11. package/dist/_internal/server/features/cart/actions.d.ts +1 -1
  12. package/dist/_internal/server/features/cart/actions.js +12 -1
  13. package/dist/_internal/server/features/checkout/actions.js +0 -1
  14. package/dist/_internal/server/features/events/actions.d.ts +1 -1
  15. package/dist/_internal/server/features/events/actions.js +12 -1
  16. package/dist/_internal/server/features/gateway-events/redact.js +14 -2
  17. package/dist/_internal/server/features/history/actions.d.ts +1 -1
  18. package/dist/_internal/server/features/history/actions.js +12 -1
  19. package/dist/_internal/server/features/lottery/actions.d.ts +1 -1
  20. package/dist/_internal/server/features/lottery/actions.js +12 -1
  21. package/dist/_internal/server/features/orders/actions.d.ts +1 -1
  22. package/dist/_internal/server/features/orders/actions.js +12 -1
  23. package/dist/_internal/server/features/orders/cancellation-refund.js +0 -1
  24. package/dist/_internal/server/features/orders/service.js +31 -1
  25. package/dist/_internal/server/features/payouts/actions.d.ts +1 -1
  26. package/dist/_internal/server/features/payouts/actions.js +12 -1
  27. package/dist/_internal/server/features/points/award.js +9 -1
  28. package/dist/_internal/server/features/pre-orders/actions.d.ts +1 -1
  29. package/dist/_internal/server/features/pre-orders/actions.js +12 -1
  30. package/dist/_internal/server/features/prize-draws/actions.d.ts +1 -1
  31. package/dist/_internal/server/features/prize-draws/actions.js +12 -1
  32. package/dist/_internal/server/features/products/actions.d.ts +1 -1
  33. package/dist/_internal/server/features/products/actions.js +12 -1
  34. package/dist/_internal/server/features/promotions/actions.d.ts +1 -1
  35. package/dist/_internal/server/features/promotions/actions.js +12 -1
  36. package/dist/_internal/server/features/protection-claims/actions.d.ts +2 -2
  37. package/dist/_internal/server/features/protection-claims/actions.js +21 -12
  38. package/dist/_internal/server/features/raffle/actions.d.ts +1 -1
  39. package/dist/_internal/server/features/raffle/actions.js +12 -1
  40. package/dist/_internal/server/features/refunds/actions.d.ts +1 -3
  41. package/dist/_internal/server/features/refunds/actions.js +14 -2
  42. package/dist/_internal/server/features/reviews/actions.d.ts +1 -1
  43. package/dist/_internal/server/features/reviews/actions.js +12 -1
  44. package/dist/_internal/server/features/wishlist/actions.d.ts +1 -1
  45. package/dist/_internal/server/features/wishlist/actions.js +12 -1
  46. package/dist/_internal/server/jobs/core/obligationSweep.js +0 -1
  47. package/dist/_internal/server/jobs/core/paymentReconcile.js +93 -76
  48. package/dist/_internal/server/jobs/core/testDataCleanup.d.ts +1 -1
  49. package/dist/_internal/server/jobs/core/testDataCleanup.js +22 -1
  50. package/dist/_internal/server/jobs/handlers/onShipmentAllocationSync.js +16 -4
  51. package/dist/_internal/shared/actions/action-registry.js +149 -9
  52. package/dist/_internal/shared/features/promotions/schema.d.ts +66 -0
  53. package/dist/_internal/shared/features/promotions/schema.js +7 -0
  54. package/dist/_internal/shared/media/limits.d.ts +10 -0
  55. package/dist/_internal/shared/media/limits.js +10 -0
  56. package/dist/_internal/shared/obligations/deadlines.js +11 -1
  57. package/dist/_internal/shared/tester/window.d.ts +25 -0
  58. package/dist/_internal/shared/tester/window.js +66 -0
  59. package/dist/_internal/shared/types/action-result.js +15 -1
  60. package/dist/client/api/surface-error.js +16 -2
  61. package/dist/client/api/useApiMutation.js +17 -1
  62. package/dist/client.d.ts +1 -1
  63. package/dist/client.js +1 -1
  64. package/dist/constants/api-endpoints.d.ts +3 -0
  65. package/dist/constants/api-endpoints.js +1 -0
  66. package/dist/constants/field-names.d.ts +17 -0
  67. package/dist/constants/field-names.js +23 -0
  68. package/dist/core/server-action.js +19 -3
  69. package/dist/core/unit-of-work.js +15 -1
  70. package/dist/errors/error-mapping.js +26 -1
  71. package/dist/errors/firestore-codes.d.ts +37 -0
  72. package/dist/errors/firestore-codes.js +52 -0
  73. package/dist/errors/index.d.ts +0 -1
  74. package/dist/errors/index.js +12 -2
  75. package/dist/features/account/components/UserOffersPanel.js +5 -3
  76. package/dist/features/admin/components/AdminActionIndexView.js +100 -5
  77. package/dist/features/admin/components/AdminAddressClustersView.js +21 -2
  78. package/dist/features/admin/components/AdminBlogEditorView.js +8 -8
  79. package/dist/features/admin/components/AdminCarouselEditorView.js +1 -1
  80. package/dist/features/admin/components/AdminCarouselView.js +96 -4
  81. package/dist/features/admin/components/AdminCouponEditorView.js +8 -0
  82. package/dist/features/admin/components/AdminFulfillmentView.js +3 -2
  83. package/dist/features/admin/components/AdminGatewayEventsView.js +2 -2
  84. package/dist/features/admin/components/AdminMediaView.js +36 -3
  85. package/dist/features/admin/components/AdminNavigationView.js +4 -1
  86. package/dist/features/admin/components/AdminOffersView.js +2 -1
  87. package/dist/features/admin/components/AdminPaymentClustersView.js +19 -2
  88. package/dist/features/admin/components/AdminProductEditorView.js +2 -2
  89. package/dist/features/admin/components/AdminSectionsView.d.ts +10 -0
  90. package/dist/features/admin/components/AdminSectionsView.js +486 -224
  91. package/dist/features/admin/components/DataListingView.js +2 -0
  92. package/dist/features/admin/components/ReferenceRecordEditor.js +1 -1
  93. package/dist/features/admin/components/analytics/AdminStatCard.js +4 -1
  94. package/dist/features/admin/hooks/useOptimisticRowFlag.d.ts +33 -0
  95. package/dist/features/admin/hooks/useOptimisticRowFlag.js +87 -0
  96. package/dist/features/admin/repository/notification.repository.d.ts +15 -0
  97. package/dist/features/admin/repository/notification.repository.js +32 -0
  98. package/dist/features/admin/repository/site-settings.repository.d.ts +2 -1
  99. package/dist/features/admin/repository/site-settings.repository.js +7 -0
  100. package/dist/features/admin/schemas/action-index-form.d.ts +34 -0
  101. package/dist/features/admin/schemas/action-index-form.js +115 -0
  102. package/dist/features/auctions/components/MarketplaceAuctionCard.js +1 -1
  103. package/dist/features/auth/components/RegisterForm.js +2 -1
  104. package/dist/features/catalogue/actions/approve-catalogue-listing.d.ts +1 -1
  105. package/dist/features/catalogue/actions/approve-catalogue-listing.js +12 -1
  106. package/dist/features/catalogue/actions/list-from-catalogue.d.ts +1 -1
  107. package/dist/features/catalogue/actions/list-from-catalogue.js +12 -1
  108. package/dist/features/catalogue/actions/submit-for-approval.d.ts +1 -1
  109. package/dist/features/catalogue/actions/submit-for-approval.js +12 -1
  110. package/dist/features/catalogue/components/CatalogueItemEditorView.js +3 -3
  111. package/dist/features/categories/repository/price-observation.repository.d.ts +19 -0
  112. package/dist/features/categories/repository/price-observation.repository.js +21 -2
  113. package/dist/features/events/actions/event-actions.js +4 -1
  114. package/dist/features/events/components/AdminEventEditorView.js +79 -50
  115. package/dist/features/events/components/EventsListPageView.js +2 -1
  116. package/dist/features/events/schemas/firestore.d.ts +17 -0
  117. package/dist/features/events/schemas/firestore.js +1 -0
  118. package/dist/features/events/utils/sort-pinned.d.ts +33 -0
  119. package/dist/features/events/utils/sort-pinned.js +46 -0
  120. package/dist/features/gateway-events/repository/gateway-events.repository.js +3 -40
  121. package/dist/features/gateway-events/schemas/index.d.ts +2 -2
  122. package/dist/features/inventory/components/AdminStorageBoxesView.js +55 -39
  123. package/dist/features/inventory/components/ReceiveStationView.js +61 -17
  124. package/dist/features/inventory/repository/storage-boxes.repository.d.ts +3 -1
  125. package/dist/features/inventory/repository/storage-boxes.repository.js +36 -3
  126. package/dist/features/layout/hooks/useFormBottomActions.js +20 -1
  127. package/dist/features/obligations/repository/obligations.repository.js +10 -1
  128. package/dist/features/orders/components/EmiInstallmentsPanel.js +25 -7
  129. package/dist/features/orders/components/RefundRequestView.js +4 -4
  130. package/dist/features/orders/schemas/firestore.d.ts +19 -0
  131. package/dist/features/orders/schemas/firestore.js +19 -0
  132. package/dist/features/orders/schemas/index.d.ts +6 -6
  133. package/dist/features/payment-cases/repository/payment-cases.repository.d.ts +1 -0
  134. package/dist/features/payment-cases/repository/payment-cases.repository.js +3 -14
  135. package/dist/features/pre-orders/components/MarketplacePreorderCard.js +1 -1
  136. package/dist/features/products/components/GroupMemberPicker.js +4 -1
  137. package/dist/features/products/components/MarketplaceBundleCard.js +1 -1
  138. package/dist/features/products/components/MarketplacePrizeDrawCard.js +1 -1
  139. package/dist/features/products/components/PrizeDrawEntryActions.js +2 -1
  140. package/dist/features/products/components/ProductDetailActions.js +2 -1
  141. package/dist/features/products/components/ProductForm.js +2 -2
  142. package/dist/features/products/components/ProductGrid.js +1 -1
  143. package/dist/features/promotions/repository/claimed-coupons.repository.js +31 -1
  144. package/dist/features/promotions/schemas/firestore.d.ts +22 -0
  145. package/dist/features/promotions/schemas/firestore.js +22 -0
  146. package/dist/features/promotions/schemas/index.d.ts +479 -6
  147. package/dist/features/promotions/schemas/index.js +153 -0
  148. package/dist/features/protection-claims/repository/protection-claims.repository.js +22 -15
  149. package/dist/features/seller/components/FulfillmentView.js +3 -2
  150. package/dist/features/seller/components/SellerAddressesView.js +32 -4
  151. package/dist/features/seller/components/SellerAnalyticsAlertsView.js +62 -3
  152. package/dist/features/seller/components/SellerBundlesView.js +53 -14
  153. package/dist/features/seller/components/SellerGroupedListingsView.js +23 -3
  154. package/dist/features/seller/components/SellerListingTypeView.js +56 -10
  155. package/dist/features/seller/components/SellerPayoutMethodsView.js +33 -1
  156. package/dist/features/seller/components/SellerPayoutSettingsView.js +48 -9
  157. package/dist/features/seller/components/SellerProductsView.js +5 -1
  158. package/dist/features/seller/components/SellerShippingConfigsView.js +33 -1
  159. package/dist/features/seller/components/SellerShippingView.js +2 -1
  160. package/dist/features/seller/components/SellerStoreCategoriesView.js +33 -1
  161. package/dist/features/seller/components/SellerSupportView.js +69 -2
  162. package/dist/features/seller/schemas/coupon-form.d.ts +5 -0
  163. package/dist/features/seller/schemas/coupon-form.js +18 -0
  164. package/dist/features/shell/SectionForm.js +35 -9
  165. package/dist/features/shell/build-sections.js +14 -1
  166. package/dist/features/shipments/components/AdminShipmentLotItemsView.js +54 -1
  167. package/dist/features/shipments/components/AdminShipmentProjectionsView.js +3 -2
  168. package/dist/features/sticker-trace/components/StickerCommitPanel.js +2 -1
  169. package/dist/features/sticker-trace/components/StickerPrintPanel.js +2 -1
  170. package/dist/features/sticker-trace/components/StickerRetryPanel.js +24 -4
  171. package/dist/features/sticker-trace/components/StickerTraceStudio.js +2 -1
  172. package/dist/features/sticker-trace/server.d.ts +2 -0
  173. package/dist/features/tester/components/AdminTesterFeedbackIssuesView.js +3 -2
  174. package/dist/http/api-handler.js +4 -1
  175. package/dist/index.d.ts +8 -4
  176. package/dist/index.js +6 -4
  177. package/dist/next/routing/route-map.d.ts +4 -2
  178. package/dist/next/routing/route-map.js +19 -1
  179. package/dist/schemas/registry.d.ts +15 -10
  180. package/dist/schemas/sieve.d.ts +3 -3
  181. package/dist/server.d.ts +1 -2
  182. package/dist/server.js +6 -4
  183. package/dist/styles.css +51 -0
  184. package/dist/ui/components/Checkbox.js +10 -2
  185. package/dist/ui/components/DateInput.js +8 -1
  186. package/dist/ui/components/Input.js +22 -2
  187. package/dist/ui/components/PaginatedSelect.d.ts +8 -19
  188. package/dist/ui/components/PaginatedSelect.js +0 -0
  189. package/dist/ui/components/Radio.js +8 -1
  190. package/dist/ui/components/Select.js +10 -2
  191. package/dist/ui/components/TagInput.d.ts +8 -1
  192. package/dist/ui/components/TagInput.js +4 -3
  193. package/dist/ui/components/Textarea.js +10 -2
  194. package/dist/ui/forms/FieldCheckbox.js +1 -1
  195. package/dist/ui/forms/FormErrorList.d.ts +0 -16
  196. package/dist/ui/forms/FormErrorList.js +34 -1
  197. package/dist/ui/forms/apply-zod-issues.d.ts +19 -1
  198. package/dist/ui/forms/apply-zod-issues.js +23 -1
  199. package/package.json +1 -1
  200. package/scripts/seed-cli.mjs +1822 -1812
  201. package/dist/features/tester/utils/phases.d.ts +0 -48
  202. package/dist/features/tester/utils/phases.js +0 -139
@@ -17,16 +17,19 @@ export declare const discountConfigSchema: z.ZodObject<{
17
17
  export declare const bxgyConfigSchema: z.ZodObject<{
18
18
  buyQuantity: z.ZodNumber;
19
19
  getQuantity: z.ZodNumber;
20
+ maxItemPrice: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodNumber, number, number>, number, number>>;
20
21
  applicableProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
21
22
  applicableCategories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
22
23
  }, "strip", z.ZodTypeAny, {
23
24
  buyQuantity: number;
24
25
  getQuantity: number;
26
+ maxItemPrice?: number | undefined;
25
27
  applicableProducts?: string[] | undefined;
26
28
  applicableCategories?: string[] | undefined;
27
29
  }, {
28
30
  buyQuantity: number;
29
31
  getQuantity: number;
32
+ maxItemPrice?: number | undefined;
30
33
  applicableProducts?: string[] | undefined;
31
34
  applicableCategories?: string[] | undefined;
32
35
  }>;
@@ -160,16 +163,19 @@ export declare const couponFirestoreSchema: z.ZodObject<{
160
163
  bxgy: z.ZodOptional<z.ZodObject<{
161
164
  buyQuantity: z.ZodNumber;
162
165
  getQuantity: z.ZodNumber;
166
+ maxItemPrice: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodNumber, number, number>, number, number>>;
163
167
  applicableProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
164
168
  applicableCategories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
165
169
  }, "strip", z.ZodTypeAny, {
166
170
  buyQuantity: number;
167
171
  getQuantity: number;
172
+ maxItemPrice?: number | undefined;
168
173
  applicableProducts?: string[] | undefined;
169
174
  applicableCategories?: string[] | undefined;
170
175
  }, {
171
176
  buyQuantity: number;
172
177
  getQuantity: number;
178
+ maxItemPrice?: number | undefined;
173
179
  applicableProducts?: string[] | undefined;
174
180
  applicableCategories?: string[] | undefined;
175
181
  }>>;
@@ -316,6 +322,7 @@ export declare const couponFirestoreSchema: z.ZodObject<{
316
322
  bxgy?: {
317
323
  buyQuantity: number;
318
324
  getQuantity: number;
325
+ maxItemPrice?: number | undefined;
319
326
  applicableProducts?: string[] | undefined;
320
327
  applicableCategories?: string[] | undefined;
321
328
  } | undefined;
@@ -374,6 +381,7 @@ export declare const couponFirestoreSchema: z.ZodObject<{
374
381
  bxgy?: {
375
382
  buyQuantity: number;
376
383
  getQuantity: number;
384
+ maxItemPrice?: number | undefined;
377
385
  applicableProducts?: string[] | undefined;
378
386
  applicableCategories?: string[] | undefined;
379
387
  } | undefined;
@@ -382,6 +390,471 @@ export declare const couponFirestoreSchema: z.ZodObject<{
382
390
  discountValue: number;
383
391
  }[] | undefined;
384
392
  }>;
393
+ /**
394
+ * The admin create-coupon REQUEST BODY.
395
+ *
396
+ * 🛑 It lives here, in appkit, because `bxgyConfigSchema` does — and a zod
397
+ * schema CANNOT cross the version boundary. The consumer root is on zod 4 and
398
+ * appkit depends on zod 3, so `/api/admin/coupons` composing
399
+ * `bxgy: bxgyConfigSchema.optional()` into a consumer `z.object({...})` did
400
+ * not merely infer `unknown`: zod 4 **throws** on it —
401
+ *
402
+ * Invalid element at key "bx": expected a Zod schema
403
+ *
404
+ * — so every POST to that route failed. The type error was the only signal,
405
+ * and it reads as a cosmetic inference problem.
406
+ *
407
+ * Composed from the pieces above rather than restated, which is the concern
408
+ * the route's own comment raised about `bxgy`: "four write paths validate this
409
+ * shape and a fifth copy is how they drift". Re-declaring the shape in
410
+ * consumer zod would have been that fifth copy; moving the whole body schema
411
+ * to where the pieces live is the version of that fix which also works.
412
+ */
413
+ export declare const couponCreateBodySchema: z.ZodEffects<z.ZodObject<{
414
+ code: z.ZodString;
415
+ name: z.ZodString;
416
+ description: z.ZodDefault<z.ZodString>;
417
+ type: z.ZodEnum<["percentage", "fixed", "free_shipping", "buy_x_get_y"]>;
418
+ tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
419
+ minAmount: z.ZodEffects<z.ZodNumber, number, number>;
420
+ discountValue: z.ZodNumber;
421
+ }, "strip", z.ZodTypeAny, {
422
+ minAmount: number;
423
+ discountValue: number;
424
+ }, {
425
+ minAmount: number;
426
+ discountValue: number;
427
+ }>, "many">>;
428
+ bxgy: z.ZodOptional<z.ZodObject<{
429
+ buyQuantity: z.ZodNumber;
430
+ getQuantity: z.ZodNumber;
431
+ maxItemPrice: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodNumber, number, number>, number, number>>;
432
+ applicableProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
433
+ applicableCategories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
434
+ }, "strip", z.ZodTypeAny, {
435
+ buyQuantity: number;
436
+ getQuantity: number;
437
+ maxItemPrice?: number | undefined;
438
+ applicableProducts?: string[] | undefined;
439
+ applicableCategories?: string[] | undefined;
440
+ }, {
441
+ buyQuantity: number;
442
+ getQuantity: number;
443
+ maxItemPrice?: number | undefined;
444
+ applicableProducts?: string[] | undefined;
445
+ applicableCategories?: string[] | undefined;
446
+ }>>;
447
+ discount: z.ZodObject<{
448
+ value: z.ZodNumber;
449
+ maxDiscount: z.ZodOptional<z.ZodNumber>;
450
+ minPurchase: z.ZodOptional<z.ZodNumber>;
451
+ }, "strip", z.ZodTypeAny, {
452
+ value: number;
453
+ minPurchase?: number | undefined;
454
+ maxDiscount?: number | undefined;
455
+ }, {
456
+ value: number;
457
+ minPurchase?: number | undefined;
458
+ maxDiscount?: number | undefined;
459
+ }>;
460
+ usage: z.ZodObject<{
461
+ totalLimit: z.ZodOptional<z.ZodNumber>;
462
+ perUserLimit: z.ZodOptional<z.ZodNumber>;
463
+ currentUsage: z.ZodDefault<z.ZodNumber>;
464
+ }, "strip", z.ZodTypeAny, {
465
+ currentUsage: number;
466
+ totalLimit?: number | undefined;
467
+ perUserLimit?: number | undefined;
468
+ }, {
469
+ currentUsage?: number | undefined;
470
+ totalLimit?: number | undefined;
471
+ perUserLimit?: number | undefined;
472
+ }>;
473
+ validity: z.ZodObject<{
474
+ startDate: z.ZodEffects<z.ZodString, Date, string>;
475
+ endDate: z.ZodEffects<z.ZodOptional<z.ZodString>, Date | undefined, string | undefined>;
476
+ isActive: z.ZodDefault<z.ZodBoolean>;
477
+ }, "strip", z.ZodTypeAny, {
478
+ isActive: boolean;
479
+ startDate: Date;
480
+ endDate?: Date | undefined;
481
+ }, {
482
+ startDate: string;
483
+ isActive?: boolean | undefined;
484
+ endDate?: string | undefined;
485
+ }>;
486
+ restrictions: z.ZodDefault<z.ZodObject<{
487
+ applicableProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
488
+ applicableCategories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
489
+ applicableSellers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
490
+ excludeProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
491
+ excludeCategories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
492
+ firstTimeUserOnly: z.ZodDefault<z.ZodBoolean>;
493
+ }, "strip", z.ZodTypeAny, {
494
+ firstTimeUserOnly: boolean;
495
+ applicableProducts?: string[] | undefined;
496
+ applicableCategories?: string[] | undefined;
497
+ applicableSellers?: string[] | undefined;
498
+ excludeProducts?: string[] | undefined;
499
+ excludeCategories?: string[] | undefined;
500
+ }, {
501
+ firstTimeUserOnly?: boolean | undefined;
502
+ applicableProducts?: string[] | undefined;
503
+ applicableCategories?: string[] | undefined;
504
+ applicableSellers?: string[] | undefined;
505
+ excludeProducts?: string[] | undefined;
506
+ excludeCategories?: string[] | undefined;
507
+ }>>;
508
+ createdBy: z.ZodDefault<z.ZodOptional<z.ZodString>>;
509
+ }, "strip", z.ZodTypeAny, {
510
+ code: string;
511
+ type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
512
+ name: string;
513
+ createdBy: string;
514
+ description: string;
515
+ discount: {
516
+ value: number;
517
+ minPurchase?: number | undefined;
518
+ maxDiscount?: number | undefined;
519
+ };
520
+ usage: {
521
+ currentUsage: number;
522
+ totalLimit?: number | undefined;
523
+ perUserLimit?: number | undefined;
524
+ };
525
+ validity: {
526
+ isActive: boolean;
527
+ startDate: Date;
528
+ endDate?: Date | undefined;
529
+ };
530
+ restrictions: {
531
+ firstTimeUserOnly: boolean;
532
+ applicableProducts?: string[] | undefined;
533
+ applicableCategories?: string[] | undefined;
534
+ applicableSellers?: string[] | undefined;
535
+ excludeProducts?: string[] | undefined;
536
+ excludeCategories?: string[] | undefined;
537
+ };
538
+ bxgy?: {
539
+ buyQuantity: number;
540
+ getQuantity: number;
541
+ maxItemPrice?: number | undefined;
542
+ applicableProducts?: string[] | undefined;
543
+ applicableCategories?: string[] | undefined;
544
+ } | undefined;
545
+ tiers?: {
546
+ minAmount: number;
547
+ discountValue: number;
548
+ }[] | undefined;
549
+ }, {
550
+ code: string;
551
+ type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
552
+ name: string;
553
+ discount: {
554
+ value: number;
555
+ minPurchase?: number | undefined;
556
+ maxDiscount?: number | undefined;
557
+ };
558
+ usage: {
559
+ currentUsage?: number | undefined;
560
+ totalLimit?: number | undefined;
561
+ perUserLimit?: number | undefined;
562
+ };
563
+ validity: {
564
+ startDate: string;
565
+ isActive?: boolean | undefined;
566
+ endDate?: string | undefined;
567
+ };
568
+ createdBy?: string | undefined;
569
+ description?: string | undefined;
570
+ bxgy?: {
571
+ buyQuantity: number;
572
+ getQuantity: number;
573
+ maxItemPrice?: number | undefined;
574
+ applicableProducts?: string[] | undefined;
575
+ applicableCategories?: string[] | undefined;
576
+ } | undefined;
577
+ tiers?: {
578
+ minAmount: number;
579
+ discountValue: number;
580
+ }[] | undefined;
581
+ restrictions?: {
582
+ firstTimeUserOnly?: boolean | undefined;
583
+ applicableProducts?: string[] | undefined;
584
+ applicableCategories?: string[] | undefined;
585
+ applicableSellers?: string[] | undefined;
586
+ excludeProducts?: string[] | undefined;
587
+ excludeCategories?: string[] | undefined;
588
+ } | undefined;
589
+ }>, {
590
+ code: string;
591
+ type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
592
+ name: string;
593
+ createdBy: string;
594
+ description: string;
595
+ discount: {
596
+ value: number;
597
+ minPurchase?: number | undefined;
598
+ maxDiscount?: number | undefined;
599
+ };
600
+ usage: {
601
+ currentUsage: number;
602
+ totalLimit?: number | undefined;
603
+ perUserLimit?: number | undefined;
604
+ };
605
+ validity: {
606
+ isActive: boolean;
607
+ startDate: Date;
608
+ endDate?: Date | undefined;
609
+ };
610
+ restrictions: {
611
+ firstTimeUserOnly: boolean;
612
+ applicableProducts?: string[] | undefined;
613
+ applicableCategories?: string[] | undefined;
614
+ applicableSellers?: string[] | undefined;
615
+ excludeProducts?: string[] | undefined;
616
+ excludeCategories?: string[] | undefined;
617
+ };
618
+ bxgy?: {
619
+ buyQuantity: number;
620
+ getQuantity: number;
621
+ maxItemPrice?: number | undefined;
622
+ applicableProducts?: string[] | undefined;
623
+ applicableCategories?: string[] | undefined;
624
+ } | undefined;
625
+ tiers?: {
626
+ minAmount: number;
627
+ discountValue: number;
628
+ }[] | undefined;
629
+ }, {
630
+ code: string;
631
+ type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
632
+ name: string;
633
+ discount: {
634
+ value: number;
635
+ minPurchase?: number | undefined;
636
+ maxDiscount?: number | undefined;
637
+ };
638
+ usage: {
639
+ currentUsage?: number | undefined;
640
+ totalLimit?: number | undefined;
641
+ perUserLimit?: number | undefined;
642
+ };
643
+ validity: {
644
+ startDate: string;
645
+ isActive?: boolean | undefined;
646
+ endDate?: string | undefined;
647
+ };
648
+ createdBy?: string | undefined;
649
+ description?: string | undefined;
650
+ bxgy?: {
651
+ buyQuantity: number;
652
+ getQuantity: number;
653
+ maxItemPrice?: number | undefined;
654
+ applicableProducts?: string[] | undefined;
655
+ applicableCategories?: string[] | undefined;
656
+ } | undefined;
657
+ tiers?: {
658
+ minAmount: number;
659
+ discountValue: number;
660
+ }[] | undefined;
661
+ restrictions?: {
662
+ firstTimeUserOnly?: boolean | undefined;
663
+ applicableProducts?: string[] | undefined;
664
+ applicableCategories?: string[] | undefined;
665
+ applicableSellers?: string[] | undefined;
666
+ excludeProducts?: string[] | undefined;
667
+ excludeCategories?: string[] | undefined;
668
+ } | undefined;
669
+ }>;
670
+ export type CouponCreateBody = z.infer<typeof couponCreateBodySchema>;
671
+ /**
672
+ * The admin update-coupon REQUEST BODY (`PATCH /api/admin/coupons/[id]`).
673
+ *
674
+ * 🛑 HERE FOR THE SAME REASON AS `couponCreateBodySchema` — read its note
675
+ * first. It embeds `bxgyConfigSchema`, and a zod-3 schema composed into a
676
+ * consumer zod-4 `z.object({...})` THROWS at parse time rather than merely
677
+ * mistyping. The POST route was migrated when that was discovered; this is
678
+ * the sibling PATCH, which has the same embed and would fail the same way.
679
+ *
680
+ * 🛑 NOT `couponCreateBodySchema.partial()`. That schema carries a
681
+ * `.superRefine`, so it is a ZodEffects and has no `.partial()` — and the
682
+ * update body is genuinely a different shape anyway: no `code` (a coupon's
683
+ * code is immutable after creation), plus the `action` discriminator the
684
+ * route uses for activate/deactivate.
685
+ *
686
+ * Every nested object stays OPTIONAL as a whole, which is what lets the route
687
+ * merge `validity` and `restrictions` against the stored document instead of
688
+ * replacing them — a caller sending only `{isActive: false}` must not wipe
689
+ * the coupon's real dates.
690
+ */
691
+ export declare const couponUpdateBodySchema: z.ZodObject<{
692
+ name: z.ZodOptional<z.ZodString>;
693
+ description: z.ZodOptional<z.ZodString>;
694
+ tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
695
+ minAmount: z.ZodEffects<z.ZodNumber, number, number>;
696
+ discountValue: z.ZodNumber;
697
+ }, "strip", z.ZodTypeAny, {
698
+ minAmount: number;
699
+ discountValue: number;
700
+ }, {
701
+ minAmount: number;
702
+ discountValue: number;
703
+ }>, "many">>;
704
+ bxgy: z.ZodOptional<z.ZodObject<{
705
+ buyQuantity: z.ZodNumber;
706
+ getQuantity: z.ZodNumber;
707
+ maxItemPrice: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodNumber, number, number>, number, number>>;
708
+ applicableProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
709
+ applicableCategories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
710
+ }, "strip", z.ZodTypeAny, {
711
+ buyQuantity: number;
712
+ getQuantity: number;
713
+ maxItemPrice?: number | undefined;
714
+ applicableProducts?: string[] | undefined;
715
+ applicableCategories?: string[] | undefined;
716
+ }, {
717
+ buyQuantity: number;
718
+ getQuantity: number;
719
+ maxItemPrice?: number | undefined;
720
+ applicableProducts?: string[] | undefined;
721
+ applicableCategories?: string[] | undefined;
722
+ }>>;
723
+ discount: z.ZodOptional<z.ZodObject<{
724
+ value: z.ZodNumber;
725
+ maxDiscount: z.ZodOptional<z.ZodNumber>;
726
+ minPurchase: z.ZodOptional<z.ZodNumber>;
727
+ }, "strip", z.ZodTypeAny, {
728
+ value: number;
729
+ minPurchase?: number | undefined;
730
+ maxDiscount?: number | undefined;
731
+ }, {
732
+ value: number;
733
+ minPurchase?: number | undefined;
734
+ maxDiscount?: number | undefined;
735
+ }>>;
736
+ usage: z.ZodOptional<z.ZodObject<{
737
+ totalLimit: z.ZodOptional<z.ZodNumber>;
738
+ perUserLimit: z.ZodOptional<z.ZodNumber>;
739
+ }, "strip", z.ZodTypeAny, {
740
+ totalLimit?: number | undefined;
741
+ perUserLimit?: number | undefined;
742
+ }, {
743
+ totalLimit?: number | undefined;
744
+ perUserLimit?: number | undefined;
745
+ }>>;
746
+ validity: z.ZodOptional<z.ZodObject<{
747
+ startDate: z.ZodOptional<z.ZodEffects<z.ZodString, Date, string>>;
748
+ endDate: z.ZodEffects<z.ZodOptional<z.ZodString>, Date | undefined, string | undefined>;
749
+ isActive: z.ZodOptional<z.ZodBoolean>;
750
+ }, "strip", z.ZodTypeAny, {
751
+ isActive?: boolean | undefined;
752
+ endDate?: Date | undefined;
753
+ startDate?: Date | undefined;
754
+ }, {
755
+ isActive?: boolean | undefined;
756
+ endDate?: string | undefined;
757
+ startDate?: string | undefined;
758
+ }>>;
759
+ restrictions: z.ZodOptional<z.ZodObject<{
760
+ applicableProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
761
+ applicableCategories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
762
+ applicableSellers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
763
+ excludeProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
764
+ excludeCategories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
765
+ firstTimeUserOnly: z.ZodOptional<z.ZodBoolean>;
766
+ }, "strip", z.ZodTypeAny, {
767
+ firstTimeUserOnly?: boolean | undefined;
768
+ applicableProducts?: string[] | undefined;
769
+ applicableCategories?: string[] | undefined;
770
+ applicableSellers?: string[] | undefined;
771
+ excludeProducts?: string[] | undefined;
772
+ excludeCategories?: string[] | undefined;
773
+ }, {
774
+ firstTimeUserOnly?: boolean | undefined;
775
+ applicableProducts?: string[] | undefined;
776
+ applicableCategories?: string[] | undefined;
777
+ applicableSellers?: string[] | undefined;
778
+ excludeProducts?: string[] | undefined;
779
+ excludeCategories?: string[] | undefined;
780
+ }>>;
781
+ action: z.ZodOptional<z.ZodEnum<["activate", "deactivate"]>>;
782
+ }, "strip", z.ZodTypeAny, {
783
+ action?: "activate" | "deactivate" | undefined;
784
+ name?: string | undefined;
785
+ description?: string | undefined;
786
+ discount?: {
787
+ value: number;
788
+ minPurchase?: number | undefined;
789
+ maxDiscount?: number | undefined;
790
+ } | undefined;
791
+ bxgy?: {
792
+ buyQuantity: number;
793
+ getQuantity: number;
794
+ maxItemPrice?: number | undefined;
795
+ applicableProducts?: string[] | undefined;
796
+ applicableCategories?: string[] | undefined;
797
+ } | undefined;
798
+ tiers?: {
799
+ minAmount: number;
800
+ discountValue: number;
801
+ }[] | undefined;
802
+ usage?: {
803
+ totalLimit?: number | undefined;
804
+ perUserLimit?: number | undefined;
805
+ } | undefined;
806
+ validity?: {
807
+ isActive?: boolean | undefined;
808
+ endDate?: Date | undefined;
809
+ startDate?: Date | undefined;
810
+ } | undefined;
811
+ restrictions?: {
812
+ firstTimeUserOnly?: boolean | undefined;
813
+ applicableProducts?: string[] | undefined;
814
+ applicableCategories?: string[] | undefined;
815
+ applicableSellers?: string[] | undefined;
816
+ excludeProducts?: string[] | undefined;
817
+ excludeCategories?: string[] | undefined;
818
+ } | undefined;
819
+ }, {
820
+ action?: "activate" | "deactivate" | undefined;
821
+ name?: string | undefined;
822
+ description?: string | undefined;
823
+ discount?: {
824
+ value: number;
825
+ minPurchase?: number | undefined;
826
+ maxDiscount?: number | undefined;
827
+ } | undefined;
828
+ bxgy?: {
829
+ buyQuantity: number;
830
+ getQuantity: number;
831
+ maxItemPrice?: number | undefined;
832
+ applicableProducts?: string[] | undefined;
833
+ applicableCategories?: string[] | undefined;
834
+ } | undefined;
835
+ tiers?: {
836
+ minAmount: number;
837
+ discountValue: number;
838
+ }[] | undefined;
839
+ usage?: {
840
+ totalLimit?: number | undefined;
841
+ perUserLimit?: number | undefined;
842
+ } | undefined;
843
+ validity?: {
844
+ isActive?: boolean | undefined;
845
+ endDate?: string | undefined;
846
+ startDate?: string | undefined;
847
+ } | undefined;
848
+ restrictions?: {
849
+ firstTimeUserOnly?: boolean | undefined;
850
+ applicableProducts?: string[] | undefined;
851
+ applicableCategories?: string[] | undefined;
852
+ applicableSellers?: string[] | undefined;
853
+ excludeProducts?: string[] | undefined;
854
+ excludeCategories?: string[] | undefined;
855
+ } | undefined;
856
+ }>;
857
+ export type CouponUpdateBody = z.infer<typeof couponUpdateBodySchema>;
385
858
  export declare const couponUsageFirestoreSchema: z.ZodObject<{
386
859
  id: z.ZodString;
387
860
  userId: z.ZodString;
@@ -621,6 +1094,9 @@ export declare const claimedCouponFirestoreSchema: z.ZodObject<{
621
1094
  }, z.ZodTypeAny, "passthrough">;
622
1095
  userId: string;
623
1096
  couponCode: string;
1097
+ claimedAt: string | Date | z.objectOutputType<{
1098
+ toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
1099
+ }, z.ZodTypeAny, "passthrough">;
624
1100
  couponId: string;
625
1101
  couponSnapshot: {
626
1102
  type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
@@ -642,9 +1118,6 @@ export declare const claimedCouponFirestoreSchema: z.ZodObject<{
642
1118
  storeId?: string | undefined;
643
1119
  description?: string | undefined;
644
1120
  };
645
- claimedAt: string | Date | z.objectOutputType<{
646
- toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
647
- }, z.ZodTypeAny, "passthrough">;
648
1121
  expiresAt?: string | Date | z.objectOutputType<{
649
1122
  toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
650
1123
  }, z.ZodTypeAny, "passthrough"> | null | undefined;
@@ -661,6 +1134,9 @@ export declare const claimedCouponFirestoreSchema: z.ZodObject<{
661
1134
  }, z.ZodTypeAny, "passthrough">;
662
1135
  userId: string;
663
1136
  couponCode: string;
1137
+ claimedAt: string | Date | z.objectInputType<{
1138
+ toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
1139
+ }, z.ZodTypeAny, "passthrough">;
664
1140
  couponId: string;
665
1141
  couponSnapshot: {
666
1142
  type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
@@ -682,9 +1158,6 @@ export declare const claimedCouponFirestoreSchema: z.ZodObject<{
682
1158
  storeId?: string | undefined;
683
1159
  description?: string | undefined;
684
1160
  };
685
- claimedAt: string | Date | z.objectInputType<{
686
- toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
687
- }, z.ZodTypeAny, "passthrough">;
688
1161
  expiresAt?: string | Date | z.objectInputType<{
689
1162
  toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
690
1163
  }, z.ZodTypeAny, "passthrough"> | null | undefined;