@mohasinac/appkit 2.7.35 → 2.7.37

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 (186) hide show
  1. package/dist/_internal/client/features/layout/DashboardLayoutClient.js +1 -1
  2. package/dist/_internal/client/features/seller/print-center/InventoryLabel.d.ts +12 -0
  3. package/dist/_internal/client/features/seller/print-center/InventoryLabel.js +49 -0
  4. package/dist/_internal/client/features/seller/print-center/LabelDesignPicker.d.ts +7 -0
  5. package/dist/_internal/client/features/seller/print-center/LabelDesignPicker.js +32 -0
  6. package/dist/_internal/client/features/seller/print-center/OrderPackingLabel.d.ts +28 -0
  7. package/dist/_internal/client/features/seller/print-center/OrderPackingLabel.js +33 -0
  8. package/dist/_internal/client/features/seller/print-center/PhysicalLocationModal.d.ts +12 -0
  9. package/dist/_internal/client/features/seller/print-center/PhysicalLocationModal.js +30 -0
  10. package/dist/_internal/client/features/seller/print-center/PrintCenterView.d.ts +12 -0
  11. package/dist/_internal/client/features/seller/print-center/PrintCenterView.js +102 -0
  12. package/dist/_internal/client/features/seller/print-center/PrintGrid.d.ts +12 -0
  13. package/dist/_internal/client/features/seller/print-center/PrintGrid.js +13 -0
  14. package/dist/_internal/client/features/seller/print-center/StoreCard.d.ts +19 -0
  15. package/dist/_internal/client/features/seller/print-center/StoreCard.js +30 -0
  16. package/dist/_internal/client/features/seller/print-center/WebsiteCard.d.ts +11 -0
  17. package/dist/_internal/client/features/seller/print-center/WebsiteCard.js +25 -0
  18. package/dist/_internal/client/features/seller/print-center/index.d.ts +11 -0
  19. package/dist/_internal/client/features/seller/print-center/index.js +10 -0
  20. package/dist/_internal/client/features/seller/print-center/types.d.ts +20 -0
  21. package/dist/_internal/client/features/seller/print-center/types.js +20 -0
  22. package/dist/_internal/client/features/seller/print-center/useInventoryPdf.d.ts +18 -0
  23. package/dist/_internal/client/features/seller/print-center/useInventoryPdf.js +76 -0
  24. package/dist/_internal/server/features/auctions/og.d.ts +1 -0
  25. package/dist/_internal/server/features/auctions/og.js +2 -1
  26. package/dist/_internal/server/features/blog/og.d.ts +1 -0
  27. package/dist/_internal/server/features/blog/og.js +3 -2
  28. package/dist/_internal/server/features/brands/og.d.ts +1 -0
  29. package/dist/_internal/server/features/brands/og.js +2 -1
  30. package/dist/_internal/server/features/bundles/og.d.ts +1 -0
  31. package/dist/_internal/server/features/bundles/og.js +2 -1
  32. package/dist/_internal/server/features/categories/og.d.ts +1 -0
  33. package/dist/_internal/server/features/categories/og.js +2 -1
  34. package/dist/_internal/server/features/checkout/actions.js +13 -5
  35. package/dist/_internal/server/features/classified/og.d.ts +2 -0
  36. package/dist/_internal/server/features/classified/og.js +2 -1
  37. package/dist/_internal/server/features/digital-code/og.d.ts +2 -0
  38. package/dist/_internal/server/features/digital-code/og.js +2 -1
  39. package/dist/_internal/server/features/events/og.d.ts +1 -0
  40. package/dist/_internal/server/features/events/og.js +3 -1
  41. package/dist/_internal/server/features/live/og.d.ts +2 -0
  42. package/dist/_internal/server/features/live/og.js +2 -1
  43. package/dist/_internal/server/features/pre-orders/og.d.ts +1 -0
  44. package/dist/_internal/server/features/pre-orders/og.js +2 -1
  45. package/dist/_internal/server/features/products/og.d.ts +3 -1
  46. package/dist/_internal/server/features/products/og.js +2 -1
  47. package/dist/_internal/server/features/seo/index.d.ts +1 -1
  48. package/dist/_internal/server/features/seo/index.js +1 -1
  49. package/dist/_internal/server/features/seo/og.d.ts +8 -1
  50. package/dist/_internal/server/features/seo/og.js +28 -8
  51. package/dist/_internal/server/features/stores/og.d.ts +1 -0
  52. package/dist/_internal/server/features/stores/og.js +3 -2
  53. package/dist/_internal/server/features/sublisting-categories/og.d.ts +1 -0
  54. package/dist/_internal/server/features/sublisting-categories/og.js +2 -1
  55. package/dist/_internal/server/jobs/core/draftPrune.d.ts +2 -0
  56. package/dist/_internal/server/jobs/core/draftPrune.js +15 -0
  57. package/dist/_internal/server/jobs/core/onBidPlaced.js +1 -1
  58. package/dist/_internal/server/jobs/core/onScamReportCreate.js +18 -14
  59. package/dist/_internal/server/jobs/core/onScamReportRejected.js +10 -7
  60. package/dist/_internal/server/jobs/core/onScamReportVerified.js +10 -7
  61. package/dist/_internal/server/jobs/core/promotions.d.ts +1 -0
  62. package/dist/_internal/server/jobs/core/promotions.js +21 -6
  63. package/dist/_internal/server/jobs/handlers/assignSpinPrize.js +18 -1
  64. package/dist/_internal/server/jobs/handlers/draftPrune.d.ts +2 -0
  65. package/dist/_internal/server/jobs/handlers/draftPrune.js +2 -0
  66. package/dist/_internal/server/jobs/handlers/index.d.ts +1 -0
  67. package/dist/_internal/server/jobs/handlers/index.js +2 -0
  68. package/dist/_internal/server/jobs/handlers/triggerEventRaffle.js +15 -1
  69. package/dist/_internal/shared/actions/action-registry.js +32 -0
  70. package/dist/_internal/shared/features/blog/schema.d.ts +8 -8
  71. package/dist/_internal/shared/features/categories/bundle-schemas.d.ts +10 -10
  72. package/dist/_internal/shared/features/orders/schema.d.ts +8 -8
  73. package/dist/_internal/shared/features/products/schema.d.ts +8 -8
  74. package/dist/_internal/shared/features/promotions/schema.d.ts +6 -6
  75. package/dist/_internal/shared/features/reviews/schema.d.ts +2 -2
  76. package/dist/client.d.ts +13 -1
  77. package/dist/client.js +7 -1
  78. package/dist/configs/next.js +1 -0
  79. package/dist/constants/api-endpoints.d.ts +15 -0
  80. package/dist/constants/api-endpoints.js +5 -0
  81. package/dist/core/server-action.d.ts +4 -0
  82. package/dist/errors/error-codes.d.ts +18 -0
  83. package/dist/errors/error-codes.js +18 -0
  84. package/dist/errors/index.d.ts +1 -1
  85. package/dist/errors/index.js +1 -1
  86. package/dist/errors/messages.d.ts +1 -0
  87. package/dist/errors/messages.js +1 -0
  88. package/dist/features/account/components/UserSidebar.js +1 -1
  89. package/dist/features/account/schemas/index.d.ts +12 -12
  90. package/dist/features/admin/components/AdminBundlesView.js +20 -2
  91. package/dist/features/admin/components/AdminPayoutsView.js +2 -1
  92. package/dist/features/admin/components/AdminProductsView.js +13 -0
  93. package/dist/features/admin/components/AdminSidebar.js +1 -1
  94. package/dist/features/admin/components/AdminStoresView.js +43 -5
  95. package/dist/features/admin/components/AdminUsersView.js +53 -6
  96. package/dist/features/admin/schemas/firestore.d.ts +1 -1
  97. package/dist/features/auctions/actions/bid-actions.js +13 -6
  98. package/dist/features/auctions/components/PlaceBidFormClient.js +10 -2
  99. package/dist/features/auctions/repository/bid.repository.d.ts +7 -0
  100. package/dist/features/auctions/repository/bid.repository.js +16 -0
  101. package/dist/features/auctions/schemas/index.d.ts +18 -18
  102. package/dist/features/auth/schemas/index.d.ts +2 -2
  103. package/dist/features/before-after/schemas/index.d.ts +2 -2
  104. package/dist/features/blog/actions/blog-actions.d.ts +32 -32
  105. package/dist/features/blog/components/BlogPostForm.js +2 -1
  106. package/dist/features/blog/schemas/index.d.ts +38 -38
  107. package/dist/features/categories/components/CategoryForm.js +1 -0
  108. package/dist/features/categories/schemas/index.d.ts +10 -10
  109. package/dist/features/collections/schemas/index.d.ts +4 -4
  110. package/dist/features/consultation/schemas/index.d.ts +9 -9
  111. package/dist/features/corporate/schemas/index.d.ts +4 -4
  112. package/dist/features/events/schemas/index.d.ts +50 -50
  113. package/dist/features/faq/actions/faq-actions.d.ts +6 -6
  114. package/dist/features/faq/schemas/index.d.ts +8 -8
  115. package/dist/features/homepage/actions/homepage-section-actions.d.ts +4 -4
  116. package/dist/features/homepage/components/SectionCarousel.js +1 -8
  117. package/dist/features/layout/AppLayoutShell.js +1 -1
  118. package/dist/features/layout/AutoBreadcrumbs.js +1 -1
  119. package/dist/features/media/AvatarUpload.js +1 -1
  120. package/dist/features/media/types/index.d.ts +4 -4
  121. package/dist/features/media/upload/ImageUpload.js +18 -9
  122. package/dist/features/media/upload/MediaUploadList.js +2 -2
  123. package/dist/features/orders/schemas/firestore.d.ts +6 -0
  124. package/dist/features/orders/schemas/index.d.ts +10 -10
  125. package/dist/features/orders/types/index.d.ts +5 -0
  126. package/dist/features/payments/schemas/index.d.ts +4 -4
  127. package/dist/features/pre-orders/schemas/index.d.ts +8 -8
  128. package/dist/features/products/components/PrizeDrawItemsEditor.js +1 -1
  129. package/dist/features/products/components/ProductForm.js +20 -2
  130. package/dist/features/products/repository/products.repository.d.ts +3 -1
  131. package/dist/features/products/repository/products.repository.js +12 -1
  132. package/dist/features/products/schemas/firestore.d.ts +7 -0
  133. package/dist/features/products/schemas/index.d.ts +34 -34
  134. package/dist/features/products/schemas/product-features.validators.d.ts +6 -6
  135. package/dist/features/products/types/index.d.ts +6 -0
  136. package/dist/features/promotions/schemas/index.d.ts +14 -14
  137. package/dist/features/reviews/schemas/index.d.ts +18 -18
  138. package/dist/features/seller/actions/offer-actions.js +10 -1
  139. package/dist/features/seller/components/PhysicalLocationModal.d.ts +12 -0
  140. package/dist/features/seller/components/PhysicalLocationModal.js +30 -0
  141. package/dist/features/seller/components/PrintCenterView.d.ts +40 -0
  142. package/dist/features/seller/components/PrintCenterView.js +6 -0
  143. package/dist/features/seller/components/SellerOrdersView.js +48 -3
  144. package/dist/features/seller/components/SellerProductShell.d.ts +1 -0
  145. package/dist/features/seller/components/SellerProductShell.js +26 -4
  146. package/dist/features/seller/components/SellerProductsView.js +54 -13
  147. package/dist/features/seller/components/SellerSidebar.js +1 -1
  148. package/dist/features/seller/components/index.d.ts +1 -0
  149. package/dist/features/seller/components/index.js +1 -0
  150. package/dist/features/seller/schemas/firestore.d.ts +2 -0
  151. package/dist/features/seller/schemas/firestore.js +1 -0
  152. package/dist/features/seller/schemas/index.d.ts +22 -22
  153. package/dist/features/shell/FormShell.js +1 -1
  154. package/dist/features/shell/StepForm.d.ts +3 -1
  155. package/dist/features/shell/StepForm.js +3 -3
  156. package/dist/features/stores/schemas/index.d.ts +4 -4
  157. package/dist/index.d.ts +9 -1
  158. package/dist/index.js +6 -1
  159. package/dist/next/routing/route-map.d.ts +8 -0
  160. package/dist/next/routing/route-map.js +3 -0
  161. package/dist/seed/homepage-sections-seed-data.js +10 -10
  162. package/dist/server.d.ts +1 -1
  163. package/dist/server.js +1 -1
  164. package/dist/tailwind-utilities.css +1 -1
  165. package/dist/ui/components/FormField.js +1 -0
  166. package/dist/ui/components/RowActionMenu.js +45 -10
  167. package/dist/ui/components/SideDrawer.style.css +2 -2
  168. package/dist/ui/forms/FieldCheckbox.d.ts +13 -0
  169. package/dist/ui/forms/FieldCheckbox.js +25 -0
  170. package/dist/ui/forms/FieldInput.d.ts +11 -0
  171. package/dist/ui/forms/FieldInput.js +25 -0
  172. package/dist/ui/forms/FieldSelect.d.ts +17 -0
  173. package/dist/ui/forms/FieldSelect.js +25 -0
  174. package/dist/ui/forms/FormShell.d.ts +48 -0
  175. package/dist/ui/forms/FormShell.js +176 -0
  176. package/dist/ui/forms/FormShell.style.css +287 -0
  177. package/dist/ui/forms/index.d.ts +8 -0
  178. package/dist/ui/forms/index.js +4 -0
  179. package/dist/ui/index.d.ts +9 -0
  180. package/dist/ui/index.js +5 -0
  181. package/dist/utils/action-response.d.ts +6 -0
  182. package/dist/utils/action-response.js +22 -0
  183. package/dist/utils/index.d.ts +1 -0
  184. package/dist/utils/index.js +1 -0
  185. package/dist/validation/schemas.d.ts +10 -10
  186. package/package.json +2 -2
package/dist/client.d.ts CHANGED
@@ -57,10 +57,20 @@ export { OtpInput } from "./ui/components/OtpInput";
57
57
  export type { OtpInputProps } from "./ui/components/OtpInput";
58
58
  export { DateInput, DateRangeInput } from "./ui/components/DateInput";
59
59
  export type { DateInputProps, DateRangeInputProps } from "./ui/components/DateInput";
60
+ export type { FormShellProps, FormShellStep, FormShellContextValue } from "./ui/forms";
61
+ export { FormShell, useFormShell } from "./ui/forms";
62
+ export type { FieldInputProps } from "./ui/forms";
63
+ export { FieldInput } from "./ui/forms";
64
+ export type { FieldSelectProps } from "./ui/forms";
65
+ export { FieldSelect } from "./ui/forms";
66
+ export type { FieldCheckboxProps } from "./ui/forms";
67
+ export { FieldCheckbox } from "./ui/forms";
60
68
  export { Select } from "./ui/components/Select";
61
69
  export type { SelectOption, SelectProps } from "./ui/components/Select";
62
70
  export { Heading } from "./ui/components/Typography";
63
71
  export { Label, Text } from "./ui/components/Typography";
72
+ export { TextLink } from "./ui/components/TextLink";
73
+ export type { TextLinkProps } from "./ui/components/TextLink";
64
74
  export { Textarea } from "./ui/components/Textarea";
65
75
  export { GlobalError } from "./next/components/GlobalError";
66
76
  export { AppLayoutShell, LocaleSwitcher, useDashboardNav, BottomActionsProvider, DashboardNavProvider, LayoutClient, ListingLayout } from "./features/layout/index";
@@ -161,7 +171,7 @@ export { UserOffersPanel } from "./features/account/components/UserOffersPanel";
161
171
  export type { UserOffersPanelProps } from "./features/account/components/UserOffersPanel";
162
172
  export { SellerDashboardView as StoreDashboardView, SellerDashboardView, useSellerDashboard as useStoreDashboard, useSellerDashboard } from "./features/seller/index";
163
173
  export type { SellerDashboardViewProps as StoreDashboardViewProps, SellerDashboardViewProps } from "./features/seller/index";
164
- export { SellerPayoutSettingsView, SellerShippingView, SellerReviewsView, SellerPayoutRequestView, SellerAnalyticsStats, SellerTopProducts, SellerAnalyticsView, SellerPayoutsView, SellerCouponEditorView, SellerBidsView, SellerAddressesView, SellerPreOrdersView, SellerPrizeDrawsView } from "./features/seller/components/index";
174
+ export { SellerPayoutSettingsView, SellerShippingView, SellerReviewsView, SellerPayoutRequestView, SellerAnalyticsStats, SellerTopProducts, SellerAnalyticsView, SellerPayoutsView, SellerCouponEditorView, SellerBidsView, SellerAddressesView, SellerPreOrdersView, SellerPrizeDrawsView, PrintCenterView } from "./features/seller/components/index";
165
175
  export type { SellerPayoutSettingsViewProps, SellerShippingViewProps, SellerReviewsViewProps, SellerPayoutRequestViewProps, SellerAnalyticsViewProps, SellerPayoutsViewProps, SellerCouponEditorViewProps, CouponEditorDraft, SellerBidsViewProps, SellerAddressesViewProps, SellerPreOrdersViewProps, SellerPrizeDrawsViewProps } from "./features/seller/components/index";
166
176
  export type { SellerAnalyticsSummary, SellerAnalyticsTopProduct } from "./features/seller/types/index";
167
177
  export { UserAccountHubView, UserOrdersView, OrderDetailView, UserNotificationsView, UserReturnsView, UserSupportView } from "./features/account/index";
@@ -214,3 +224,5 @@ export { DigitalCodeDetailView } from "./_internal/client/features/digital-code/
214
224
  export type { DigitalCodeDetailViewProps } from "./_internal/client/features/digital-code/DigitalCodeDetailView";
215
225
  export { LiveItemDetailView } from "./_internal/client/features/live/LiveItemDetailView";
216
226
  export type { LiveItemDetailViewProps } from "./_internal/client/features/live/LiveItemDetailView";
227
+ export { PhysicalLocationModal } from "./features/seller/components/PhysicalLocationModal";
228
+ export type { PhysicalLocation } from "./features/seller/components/PhysicalLocationModal";
package/dist/client.js CHANGED
@@ -123,9 +123,14 @@ export { Checkbox } from "./ui/components/Checkbox";
123
123
  export { Input } from "./ui/components/Input";
124
124
  export { OtpInput } from "./ui/components/OtpInput";
125
125
  export { DateInput, DateRangeInput } from "./ui/components/DateInput";
126
+ export { FormShell, useFormShell } from "./ui/forms";
127
+ export { FieldInput } from "./ui/forms";
128
+ export { FieldSelect } from "./ui/forms";
129
+ export { FieldCheckbox } from "./ui/forms";
126
130
  export { Select } from "./ui/components/Select";
127
131
  export { Heading } from "./ui/components/Typography";
128
132
  export { Label, Text } from "./ui/components/Typography";
133
+ export { TextLink } from "./ui/components/TextLink";
129
134
  export { Textarea } from "./ui/components/Textarea";
130
135
  export { GlobalError } from "./next/components/GlobalError";
131
136
  export { AppLayoutShell, LocaleSwitcher, useDashboardNav, BottomActionsProvider, DashboardNavProvider, LayoutClient, ListingLayout } from "./features/layout/index";
@@ -191,7 +196,7 @@ export { FeatureBadge, FeatureBadgeList } from "./features/products/components/F
191
196
  export { SellerOffersPanel } from "./features/seller/components/SellerOffersPanel";
192
197
  export { UserOffersPanel } from "./features/account/components/UserOffersPanel";
193
198
  export { SellerDashboardView as StoreDashboardView, SellerDashboardView, useSellerDashboard as useStoreDashboard, useSellerDashboard } from "./features/seller/index";
194
- export { SellerPayoutSettingsView, SellerShippingView, SellerReviewsView, SellerPayoutRequestView, SellerAnalyticsStats, SellerTopProducts, SellerAnalyticsView, SellerPayoutsView, SellerCouponEditorView, SellerBidsView, SellerAddressesView, SellerPreOrdersView, SellerPrizeDrawsView } from "./features/seller/components/index";
199
+ export { SellerPayoutSettingsView, SellerShippingView, SellerReviewsView, SellerPayoutRequestView, SellerAnalyticsStats, SellerTopProducts, SellerAnalyticsView, SellerPayoutsView, SellerCouponEditorView, SellerBidsView, SellerAddressesView, SellerPreOrdersView, SellerPrizeDrawsView, PrintCenterView } from "./features/seller/components/index";
195
200
  export { UserAccountHubView, UserOrdersView, OrderDetailView, UserNotificationsView, UserReturnsView, UserSupportView } from "./features/account/index";
196
201
  export { useOrders, useOrder, OrdersList } from "./features/orders/index";
197
202
  export { useCouponValidate } from "./features/promotions/hooks/useCouponValidate";
@@ -237,3 +242,4 @@ export { NavPermissionsManager } from "./features/site-settings/components/NavPe
237
242
  export { ClassifiedDetailView } from "./_internal/client/features/classified/ClassifiedDetailView";
238
243
  export { DigitalCodeDetailView } from "./_internal/client/features/digital-code/DigitalCodeDetailView";
239
244
  export { LiveItemDetailView } from "./_internal/client/features/live/LiveItemDetailView";
245
+ export { PhysicalLocationModal } from "./features/seller/components/PhysicalLocationModal";
@@ -263,6 +263,7 @@ export function defineNextConfig(override = {}) {
263
263
  const defaultRemotePatterns = [
264
264
  { protocol: "https", hostname: "firebasestorage.googleapis.com" },
265
265
  { protocol: "https", hostname: "*.firebasestorage.googleapis.com" },
266
+ { protocol: "https", hostname: "storage.googleapis.com" },
266
267
  { protocol: "http", hostname: "localhost" },
267
268
  { protocol: "http", hostname: "127.0.0.1" },
268
269
  ];
@@ -71,6 +71,9 @@ export declare const ADMIN_ENDPOINTS: {
71
71
  readonly BID_BY_ID: (id: string) => string;
72
72
  readonly BLOG: "/api/admin/blog";
73
73
  readonly BLOG_BY_ID: (id: string) => string;
74
+ readonly BUNDLES: "/api/admin/bundles";
75
+ readonly BUNDLE_BY_ID: (id: string) => string;
76
+ readonly BUNDLE_REBUILD: (id: string) => string;
74
77
  readonly CATEGORIES: "/api/admin/categories";
75
78
  readonly CATEGORY_BY_ID: (id: string) => string;
76
79
  readonly BRANDS: "/api/admin/brands";
@@ -261,6 +264,8 @@ export declare const SELLER_ENDPOINTS: {
261
264
  readonly ANALYTICS: (period?: string) => string;
262
265
  readonly FEATURES: "/api/store/features";
263
266
  readonly FEATURE_BY_ID: (id: string) => string;
267
+ readonly PRODUCTS_BULK_LOCATION: "/api/store/products/bulk-location";
268
+ readonly ORDERS_BULK_LOCATION: "/api/store/orders/bulk-location";
264
269
  };
265
270
  export declare const BLOG_ENDPOINTS: {
266
271
  readonly LIST: "/api/blog";
@@ -371,6 +376,9 @@ export declare const API_ENDPOINTS: {
371
376
  readonly BID_BY_ID: (id: string) => string;
372
377
  readonly BLOG: "/api/admin/blog";
373
378
  readonly BLOG_BY_ID: (id: string) => string;
379
+ readonly BUNDLES: "/api/admin/bundles";
380
+ readonly BUNDLE_BY_ID: (id: string) => string;
381
+ readonly BUNDLE_REBUILD: (id: string) => string;
374
382
  readonly CATEGORIES: "/api/admin/categories";
375
383
  readonly CATEGORY_BY_ID: (id: string) => string;
376
384
  readonly BRANDS: "/api/admin/brands";
@@ -564,6 +572,8 @@ export declare const API_ENDPOINTS: {
564
572
  readonly ANALYTICS: (period?: string) => string;
565
573
  readonly FEATURES: "/api/store/features";
566
574
  readonly FEATURE_BY_ID: (id: string) => string;
575
+ readonly PRODUCTS_BULK_LOCATION: "/api/store/products/bulk-location";
576
+ readonly ORDERS_BULK_LOCATION: "/api/store/orders/bulk-location";
567
577
  };
568
578
  readonly BLOG: {
569
579
  readonly LIST: "/api/blog";
@@ -673,6 +683,9 @@ export declare const API_ROUTES: {
673
683
  readonly BID_BY_ID: (id: string) => string;
674
684
  readonly BLOG: "/api/admin/blog";
675
685
  readonly BLOG_BY_ID: (id: string) => string;
686
+ readonly BUNDLES: "/api/admin/bundles";
687
+ readonly BUNDLE_BY_ID: (id: string) => string;
688
+ readonly BUNDLE_REBUILD: (id: string) => string;
676
689
  readonly CATEGORIES: "/api/admin/categories";
677
690
  readonly CATEGORY_BY_ID: (id: string) => string;
678
691
  readonly BRANDS: "/api/admin/brands";
@@ -866,6 +879,8 @@ export declare const API_ROUTES: {
866
879
  readonly ANALYTICS: (period?: string) => string;
867
880
  readonly FEATURES: "/api/store/features";
868
881
  readonly FEATURE_BY_ID: (id: string) => string;
882
+ readonly PRODUCTS_BULK_LOCATION: "/api/store/products/bulk-location";
883
+ readonly ORDERS_BULK_LOCATION: "/api/store/orders/bulk-location";
869
884
  };
870
885
  readonly BLOG: {
871
886
  readonly LIST: "/api/blog";
@@ -89,6 +89,9 @@ export const ADMIN_ENDPOINTS = {
89
89
  BID_BY_ID: (id) => `/api/admin/bids/${id}`,
90
90
  BLOG: "/api/admin/blog",
91
91
  BLOG_BY_ID: (id) => `/api/admin/blog/${id}`,
92
+ BUNDLES: "/api/admin/bundles",
93
+ BUNDLE_BY_ID: (id) => `/api/admin/bundles/${id}`,
94
+ BUNDLE_REBUILD: (id) => `/api/admin/bundles/${id}/rebuild`,
92
95
  CATEGORIES: "/api/admin/categories",
93
96
  CATEGORY_BY_ID: (id) => `/api/admin/categories/${id}`,
94
97
  BRANDS: "/api/admin/brands",
@@ -350,6 +353,8 @@ export const SELLER_ENDPOINTS = {
350
353
  ANALYTICS: (period) => `/api/store/analytics${period ? `?period=${period}` : ""}`,
351
354
  FEATURES: "/api/store/features",
352
355
  FEATURE_BY_ID: (id) => `/api/store/features/${id}`,
356
+ PRODUCTS_BULK_LOCATION: "/api/store/products/bulk-location",
357
+ ORDERS_BULK_LOCATION: "/api/store/orders/bulk-location",
353
358
  };
354
359
  // ---------------------------------------------------------------------------
355
360
  // Blog
@@ -40,7 +40,11 @@ export type ActionResult<TOutput> = {
40
40
  } | {
41
41
  ok: false;
42
42
  error: string;
43
+ code?: string;
43
44
  fieldErrors?: Record<string, string[]>;
45
+ debug?: {
46
+ stack?: string;
47
+ };
44
48
  };
45
49
  export interface ActionMiddlewareContext<TInput = unknown, TOutput = unknown> {
46
50
  actionName: string;
@@ -1,3 +1,21 @@
1
+ export declare const BID_ERROR_CODES: {
2
+ readonly PRODUCT_NOT_FOUND: "BID_PRODUCT_NOT_FOUND";
3
+ readonly NOT_AUCTION: "BID_NOT_AUCTION";
4
+ readonly AUCTION_ENDED: "BID_AUCTION_ENDED";
5
+ readonly TOO_LOW: "BID_AMOUNT_TOO_LOW";
6
+ readonly INCREMENT_VIOLATED: "BID_INCREMENT_TOO_LOW";
7
+ readonly SELF_BID: "BID_SELF_BID";
8
+ readonly USER_BANNED: "BID_USER_BANNED";
9
+ };
10
+ export declare const OFFER_ERROR_CODES: {
11
+ readonly DISABLED: "OFFER_DISABLED";
12
+ readonly PRICE_TOO_LOW: "OFFER_PRICE_TOO_LOW";
13
+ readonly LIMIT_REACHED: "OFFER_LIMIT_REACHED";
14
+ readonly ALREADY_ACTIVE: "OFFER_ALREADY_ACTIVE";
15
+ readonly EXPIRED: "OFFER_EXPIRED";
16
+ readonly CHECKOUT_EXPIRED: "OFFER_CHECKOUT_EXPIRED";
17
+ readonly WRONG_STATE: "OFFER_WRONG_STATE";
18
+ };
1
19
  export declare const ERROR_CODES: {
2
20
  readonly AUTH_INVALID_CREDENTIALS: "AUTH_001";
3
21
  readonly AUTH_TOKEN_EXPIRED: "AUTH_002";
@@ -1,3 +1,21 @@
1
+ export const BID_ERROR_CODES = {
2
+ PRODUCT_NOT_FOUND: "BID_PRODUCT_NOT_FOUND",
3
+ NOT_AUCTION: "BID_NOT_AUCTION",
4
+ AUCTION_ENDED: "BID_AUCTION_ENDED",
5
+ TOO_LOW: "BID_AMOUNT_TOO_LOW",
6
+ INCREMENT_VIOLATED: "BID_INCREMENT_TOO_LOW",
7
+ SELF_BID: "BID_SELF_BID",
8
+ USER_BANNED: "BID_USER_BANNED",
9
+ };
10
+ export const OFFER_ERROR_CODES = {
11
+ DISABLED: "OFFER_DISABLED",
12
+ PRICE_TOO_LOW: "OFFER_PRICE_TOO_LOW",
13
+ LIMIT_REACHED: "OFFER_LIMIT_REACHED",
14
+ ALREADY_ACTIVE: "OFFER_ALREADY_ACTIVE",
15
+ EXPIRED: "OFFER_EXPIRED",
16
+ CHECKOUT_EXPIRED: "OFFER_CHECKOUT_EXPIRED",
17
+ WRONG_STATE: "OFFER_WRONG_STATE",
18
+ };
1
19
  export const ERROR_CODES = {
2
20
  // Authentication
3
21
  AUTH_INVALID_CREDENTIALS: "AUTH_001",
@@ -1,5 +1,5 @@
1
1
  export { AppError } from "./base-error";
2
- export { ERROR_CODES } from "./error-codes";
2
+ export { ERROR_CODES, BID_ERROR_CODES, OFFER_ERROR_CODES } from "./error-codes";
3
3
  export type { ErrorCode } from "./error-codes";
4
4
  export { ERROR_MESSAGES } from "./messages";
5
5
  export { ApiError } from "./api-error";
@@ -1,5 +1,5 @@
1
1
  export { AppError } from "./base-error";
2
- export { ERROR_CODES } from "./error-codes";
2
+ export { ERROR_CODES, BID_ERROR_CODES, OFFER_ERROR_CODES } from "./error-codes";
3
3
  export { ERROR_MESSAGES } from "./messages";
4
4
  // Note: appkit/src/errors has two ERROR_MESSAGE patterns:
5
5
  // - ERROR_CODES.AUTH_001 → "Invalid email or password" (code-based)
@@ -345,6 +345,7 @@ export declare const ERROR_MESSAGES: {
345
345
  readonly AUCTION_NOT_FOUND: "Auction product not found";
346
346
  readonly NOT_AN_AUCTION: "This product is not an auction";
347
347
  readonly BID_TOO_LOW: "Your bid must be higher than the current bid";
348
+ readonly INCREMENT_TOO_LOW: "Your bid does not meet the minimum increment requirement";
348
349
  readonly OWN_AUCTION: "You cannot bid on your own auction";
349
350
  };
350
351
  readonly CONTACT: {
@@ -372,6 +372,7 @@ export const ERROR_MESSAGES = {
372
372
  AUCTION_NOT_FOUND: "Auction product not found",
373
373
  NOT_AN_AUCTION: "This product is not an auction",
374
374
  BID_TOO_LOW: "Your bid must be higher than the current bid",
375
+ INCREMENT_TOO_LOW: "Your bid does not meet the minimum increment requirement",
375
376
  OWN_AUCTION: "You cannot bid on your own auction",
376
377
  },
377
378
  CONTACT: {
@@ -63,7 +63,7 @@ export function UserSidebar({ items, groups, mobileOpen = false, onCloseMobile,
63
63
  height: "calc(100vh - var(--header-height, 3.5rem))",
64
64
  width: "13rem",
65
65
  transform: desktopOpen ? "translateX(0)" : "translateX(calc(-100% + 1.25rem))",
66
- }, children: [_jsxs("div", { className: "flex-1 bg-white dark:bg-slate-900 border-r border-zinc-200 dark:border-slate-800 flex flex-col overflow-hidden shadow-xl", children: [_jsx("div", { className: "px-4 py-3.5 border-b border-zinc-100 dark:border-slate-800 shrink-0", children: _jsx("span", { className: "text-xs font-semibold uppercase tracking-widest text-zinc-400 dark:text-zinc-500", children: "My Account" }) }), _jsx("div", { className: "flex-1 overflow-y-auto", children: _jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname }) })] }), _jsx("button", { type: "button", onClick: handleToggle, "aria-label": desktopOpen ? "Collapse sidebar" : "Expand sidebar", className: "w-5 shrink-0 flex items-center justify-center transition-opacity rounded-r-md shadow-md hover:opacity-85", style: { background: "linear-gradient(to bottom, var(--appkit-color-cobalt-700), var(--appkit-color-cobalt))" }, children: _jsx("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: desktopOpen ? (_jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M11 19l-7-7 7-7m8 14l-7-7 7-7" })) : (_jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M13 5l7 7-7 7M5 5l7 7-7 7" })) }) })] }), _jsx("div", { className: "md:hidden", children: _jsx(BottomSheet, { open: mobileOpen, onClose: close, title: "My Account", children: _jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname, onItemClick: close }) }) })] }));
66
+ }, children: [_jsxs("div", { className: "flex-1 bg-white dark:bg-slate-900 border-r border-zinc-200 dark:border-slate-800 flex flex-col overflow-hidden shadow-xl", children: [_jsx("div", { className: "px-4 py-3.5 border-b border-zinc-100 dark:border-slate-800 shrink-0", children: _jsx("span", { className: "text-xs font-semibold uppercase tracking-widest text-zinc-400 dark:text-zinc-500", children: "My Account" }) }), _jsx("div", { className: "flex-1 overflow-y-auto", children: _jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname }) })] }), _jsx("button", { type: "button", onClick: handleToggle, "aria-label": desktopOpen ? "Collapse sidebar" : "Expand sidebar", className: "w-9 shrink-0 flex items-center justify-center cursor-pointer rounded-r-[1.25rem] shadow-lg transition-all duration-200 hover:shadow-xl hover:brightness-110 active:scale-[0.96]", style: { background: "linear-gradient(to bottom, #3e7708, #65c408)" }, children: _jsx("svg", { className: `w-4 h-4 text-white drop-shadow-sm transition-transform duration-300 ${desktopOpen ? "" : "rotate-180"}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M15 19l-7-7 7-7" }) }) })] }), _jsx("div", { className: "md:hidden", children: _jsx(BottomSheet, { open: mobileOpen, onClose: close, title: "My Account", children: _jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname, onItemClick: close }) }) })] }));
67
67
  }
68
68
  // ── Overlay variant (default) — portal on desktop, bottom-sheet on mobile ─
69
69
  const content = (_jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname, onItemClick: close }));
@@ -18,8 +18,8 @@ export declare const userAddressSchema: z.ZodObject<{
18
18
  city: string;
19
19
  postalCode: string;
20
20
  line1: string;
21
- label?: string | undefined;
22
21
  phone?: string | undefined;
22
+ label?: string | undefined;
23
23
  isDefault?: boolean | undefined;
24
24
  line2?: string | undefined;
25
25
  }, {
@@ -29,8 +29,8 @@ export declare const userAddressSchema: z.ZodObject<{
29
29
  city: string;
30
30
  postalCode: string;
31
31
  line1: string;
32
- label?: string | undefined;
33
32
  phone?: string | undefined;
33
+ label?: string | undefined;
34
34
  isDefault?: boolean | undefined;
35
35
  line2?: string | undefined;
36
36
  }>;
@@ -89,8 +89,8 @@ export declare const userProfileSchema: z.ZodObject<{
89
89
  city: string;
90
90
  postalCode: string;
91
91
  line1: string;
92
- label?: string | undefined;
93
92
  phone?: string | undefined;
93
+ label?: string | undefined;
94
94
  isDefault?: boolean | undefined;
95
95
  line2?: string | undefined;
96
96
  }, {
@@ -100,8 +100,8 @@ export declare const userProfileSchema: z.ZodObject<{
100
100
  city: string;
101
101
  postalCode: string;
102
102
  line1: string;
103
- label?: string | undefined;
104
103
  phone?: string | undefined;
104
+ label?: string | undefined;
105
105
  isDefault?: boolean | undefined;
106
106
  line2?: string | undefined;
107
107
  }>, "many">>;
@@ -128,11 +128,11 @@ export declare const userProfileSchema: z.ZodObject<{
128
128
  updatedAt: z.ZodOptional<z.ZodString>;
129
129
  }, "strip", z.ZodTypeAny, {
130
130
  id: string;
131
+ phone?: string | undefined;
131
132
  createdAt?: string | undefined;
132
133
  updatedAt?: string | undefined;
133
- displayName?: string | undefined;
134
134
  email?: string | undefined;
135
- phone?: string | undefined;
135
+ displayName?: string | undefined;
136
136
  addresses?: {
137
137
  country: string;
138
138
  id: string;
@@ -140,8 +140,8 @@ export declare const userProfileSchema: z.ZodObject<{
140
140
  city: string;
141
141
  postalCode: string;
142
142
  line1: string;
143
- label?: string | undefined;
144
143
  phone?: string | undefined;
144
+ label?: string | undefined;
145
145
  isDefault?: boolean | undefined;
146
146
  line2?: string | undefined;
147
147
  }[] | undefined;
@@ -156,11 +156,11 @@ export declare const userProfileSchema: z.ZodObject<{
156
156
  bio?: string | undefined;
157
157
  }, {
158
158
  id: string;
159
+ phone?: string | undefined;
159
160
  createdAt?: string | undefined;
160
161
  updatedAt?: string | undefined;
161
- displayName?: string | undefined;
162
162
  email?: string | undefined;
163
- phone?: string | undefined;
163
+ displayName?: string | undefined;
164
164
  addresses?: {
165
165
  country: string;
166
166
  id: string;
@@ -168,8 +168,8 @@ export declare const userProfileSchema: z.ZodObject<{
168
168
  city: string;
169
169
  postalCode: string;
170
170
  line1: string;
171
- label?: string | undefined;
172
171
  phone?: string | undefined;
172
+ label?: string | undefined;
173
173
  isDefault?: boolean | undefined;
174
174
  line2?: string | undefined;
175
175
  }[] | undefined;
@@ -188,11 +188,11 @@ export declare const updateProfileSchema: z.ZodObject<{
188
188
  phone: z.ZodOptional<z.ZodString>;
189
189
  bio: z.ZodOptional<z.ZodString>;
190
190
  }, "strip", z.ZodTypeAny, {
191
- displayName?: string | undefined;
192
191
  phone?: string | undefined;
192
+ displayName?: string | undefined;
193
193
  bio?: string | undefined;
194
194
  }, {
195
- displayName?: string | undefined;
196
195
  phone?: string | undefined;
196
+ displayName?: string | undefined;
197
197
  bio?: string | undefined;
198
198
  }>;
@@ -13,8 +13,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  */
14
14
  import { useCallback, useEffect, useState } from "react";
15
15
  import Link from "next/link";
16
- import { Badge, Button, Container, Div, Heading, Row, Section, Stack, Text, } from "../../../ui";
16
+ import { Badge, Button, Container, Div, Heading, Row, Section, Stack, Text, useToast, } from "../../../ui";
17
17
  import { BUNDLE_COPY, BUNDLE_STOCK_VARIANT, } from "../../../_internal/shared/features/categories/bundle-copy";
18
+ import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
18
19
  const STOCK_LIST_LABEL = {
19
20
  in_stock: BUNDLE_COPY.stockBadge.listVariantInStock,
20
21
  out_of_stock: BUNDLE_COPY.stockBadge.listVariantOutOfStock,
@@ -28,6 +29,23 @@ export function AdminBundlesView({ getEditHref, newHref, }) {
28
29
  const [bundles, setBundles] = useState([]);
29
30
  const [loading, setLoading] = useState(true);
30
31
  const [error, setError] = useState(null);
32
+ const [rebuildingId, setRebuildingId] = useState(null);
33
+ const toast = useToast();
34
+ const handleRebuild = useCallback(async (bundleId) => {
35
+ setRebuildingId(bundleId);
36
+ try {
37
+ const res = await fetch(`/api/admin/bundles/${encodeURIComponent(bundleId)}/rebuild`, { method: "POST" });
38
+ if (!res.ok)
39
+ throw new Error("Rebuild failed");
40
+ toast.showToast("Bundle stock rebuilt.", "success");
41
+ }
42
+ catch {
43
+ toast.showToast("Failed to rebuild bundle stock.", "error");
44
+ }
45
+ finally {
46
+ setRebuildingId(null);
47
+ }
48
+ }, [toast]);
31
49
  const load = useCallback(async () => {
32
50
  setLoading(true);
33
51
  setError(null);
@@ -53,6 +71,6 @@ export function AdminBundlesView({ getEditHref, newHref, }) {
53
71
  const memberCount = b.bundleProductIds?.length ?? 0;
54
72
  return (_jsxs("tr", { className: "border-t border-zinc-100 dark:border-zinc-800", children: [_jsx("td", { className: "px-3 py-2", children: _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "medium", children: b.name }), _jsx(Text, { size: "xs", color: "muted", children: b.slug })] }) }), _jsx("td", { className: "px-3 py-2", children: formatPrice(b.bundlePriceInPaise) }), _jsx("td", { className: "px-3 py-2", children: memberCount }), _jsx("td", { className: "px-3 py-2", children: _jsx(Badge, { variant: BUNDLE_STOCK_VARIANT[stockKey], children: STOCK_LIST_LABEL[stockKey] }) }), _jsx("td", { className: "px-3 py-2", children: _jsx(Badge, { variant: b.isActive ? "success" : "default", children: b.isActive
55
73
  ? BUNDLE_COPY.adminList.activeBadge
56
- : BUNDLE_COPY.adminList.inactiveBadge }) }), _jsx("td", { className: "px-3 py-2 text-right", children: _jsx(Button, { asChild: true, variant: "ghost", size: "sm", children: _jsx(Link, { href: getEditHref({ id: b.id }), children: BUNDLE_COPY.adminList.editLabel }) }) })] }, b.id));
74
+ : BUNDLE_COPY.adminList.inactiveBadge }) }), _jsx("td", { className: "px-3 py-2 text-right", children: _jsxs(Row, { gap: "xs", justify: "end", children: [_jsx(Button, { variant: "ghost", size: "sm", isLoading: rebuildingId === b.id, disabled: rebuildingId === b.id, onClick: () => handleRebuild(b.id), children: ACTIONS.ADMIN["rebuild-bundle"].label }), _jsx(Button, { asChild: true, variant: "ghost", size: "sm", children: _jsx(Link, { href: getEditHref({ id: b.id }), children: BUNDLE_COPY.adminList.editLabel }) })] }) })] }, b.id));
57
75
  }) })] }) }))] }) }) }));
58
76
  }
@@ -8,6 +8,7 @@ import { useBulkSelection } from "../../../react/hooks/useBulkSelection";
8
8
  import { BulkActionBar, Button, Form, FormActions, FilterChipGroup, Input, ListingToolbar, ListingViewShell, Modal, Pagination, RowActionMenu, useToast, } from "../../../ui";
9
9
  import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
10
10
  import { ADMIN_PAYOUT_STATUS_TABS } from "../constants/filter-tabs";
11
+ import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
11
12
  import { toRecordArray, toRelativeDate, toRupees, toStringValue, useAdminListingData, } from "../hooks/useAdminListingData";
12
13
  import { DataTable } from "./DataTable";
13
14
  import { apiClient } from "../../../http";
@@ -135,7 +136,7 @@ export function AdminPayoutsView({ children, ...props }) {
135
136
  const pr = row;
136
137
  return (_jsx(RowActionMenu, { actions: [
137
138
  {
138
- label: "Mark paid",
139
+ label: ACTIONS.ADMIN["grant-payout"].label,
139
140
  onClick: () => {
140
141
  setSelectedPayoutId(pr.id);
141
142
  setMarkPaidOpen(true);
@@ -12,6 +12,7 @@ import { toRecordArray, toRelativeDate, toStringValue, useAdminListingData, } fr
12
12
  import { DataTable } from "./DataTable";
13
13
  import { AdminViewCards } from "./AdminViewCards";
14
14
  import { apiClient } from "../../../http";
15
+ import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
15
16
  import { AdminProductEditorView } from "./AdminProductEditorView";
16
17
  import { QuickEditMenu } from "./QuickEditMenu";
17
18
  const PAGE_SIZE = 25;
@@ -183,8 +184,20 @@ export function AdminProductsView({ children, actionHref, getRowHref, ...props }
183
184
  { id: "sale", label: "Toggle On Sale", variant: "secondary", onClick: () => { for (const id of selection.selectedIds)
184
185
  void handleToggle(id, "isOnSale", !rows.find(r => r.id === id)?.isOnSale); selection.clearSelection(); } },
185
186
  ] }), totalPages > 1 && (_jsx("div", { className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 flex justify-center bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700 px-3 py-1.5", children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsxs("div", { className: "py-4 px-3 sm:px-4", children: [errorMessage && (_jsx("div", { className: "mb-4 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/40 dark:text-red-200", children: errorMessage })), view === "table" ? (_jsx(DataTable, { rows: rows, columns: [...buildBaseColumns(), flagColumn], isLoading: isLoading, emptyLabel: "No products found", onRowClick: (row) => openEditPanel(row.id), selectedIds: selection.selectedIdSet, onToggleSelect: selection.toggle, onToggleSelectAll: (next) => next ? selection.setSelectedIds(rows.map(r => r.id)) : selection.clearSelection(), renderRowActions: (row) => (_jsx(QuickEditMenu, { actions: [
187
+ {
188
+ label: ACTIONS.ADMIN["approve-product"].label,
189
+ onClick: () => handleQuickEdit(row.id, { status: "published" }),
190
+ disabled: row.status === "published",
191
+ },
192
+ {
193
+ label: ACTIONS.ADMIN["reject-product"].label,
194
+ destructive: true,
195
+ onClick: () => handleQuickEdit(row.id, { status: "rejected" }),
196
+ disabled: row.status === "rejected",
197
+ },
186
198
  {
187
199
  label: "Quick edit",
200
+ separator: true,
188
201
  formTitle: "Quick Edit Product",
189
202
  fields: [
190
203
  { name: "status", label: "Status", type: "select", required: true,
@@ -47,7 +47,7 @@ export function AdminSidebar({ renderNavItems, renderHeader, renderFooter, activ
47
47
  height: "calc(100vh - var(--header-height, 3.5rem))",
48
48
  width: "18rem",
49
49
  transform: desktopOpen ? "translateX(0)" : "translateX(calc(-100% + 1.25rem))",
50
- }, children: [_jsxs("div", { className: "flex-1 bg-white dark:bg-slate-950 border-r border-zinc-200 dark:border-slate-800 flex flex-col overflow-hidden shadow-xl", children: [_jsx("div", { className: "px-4 py-3.5 border-b border-zinc-100 dark:border-slate-800 shrink-0", children: renderHeader ? renderHeader() : _jsx("span", { className: "text-xs font-semibold uppercase tracking-widest text-zinc-400 dark:text-zinc-500", children: "Admin Panel" }) }), _jsx("div", { className: "flex-1 overflow-y-auto", children: navContent }), renderFooter && _jsx("div", { className: "px-4 py-3 border-t border-zinc-200 dark:border-slate-800", children: renderFooter() })] }), _jsx("button", { type: "button", onClick: handleToggle, "aria-label": desktopOpen ? "Collapse sidebar" : "Expand sidebar", className: "w-5 shrink-0 flex items-center justify-center transition-opacity rounded-r-md shadow-md hover:opacity-85", style: { background: "linear-gradient(to bottom, var(--appkit-color-cobalt-700), var(--appkit-color-cobalt))" }, children: _jsx("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: desktopOpen ? (_jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M11 19l-7-7 7-7m8 14l-7-7 7-7" })) : (_jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M13 5l7 7-7 7M5 5l7 7-7 7" })) }) })] }), _jsx("div", { className: "md:hidden", children: _jsx(BottomSheet, { open: mobileOpen, onClose: close, title: "Admin Panel", children: mobileNavContent }) })] }));
50
+ }, children: [_jsxs("div", { className: "flex-1 bg-white dark:bg-slate-950 border-r border-zinc-200 dark:border-slate-800 flex flex-col overflow-hidden shadow-xl", children: [_jsx("div", { className: "px-4 py-3.5 border-b border-zinc-100 dark:border-slate-800 shrink-0", children: renderHeader ? renderHeader() : _jsx("span", { className: "text-xs font-semibold uppercase tracking-widest text-zinc-400 dark:text-zinc-500", children: "Admin Panel" }) }), _jsx("div", { className: "flex-1 overflow-y-auto", children: navContent }), renderFooter && _jsx("div", { className: "px-4 py-3 border-t border-zinc-200 dark:border-slate-800", children: renderFooter() })] }), _jsx("button", { type: "button", onClick: handleToggle, "aria-label": desktopOpen ? "Collapse sidebar" : "Expand sidebar", className: "w-9 shrink-0 flex items-center justify-center cursor-pointer rounded-r-[1.25rem] shadow-lg transition-all duration-200 hover:shadow-xl hover:brightness-110 active:scale-[0.96]", style: { background: "linear-gradient(to bottom, #1343de, #3570fc)" }, children: _jsx("svg", { className: `w-4 h-4 text-white drop-shadow-sm transition-transform duration-300 ${desktopOpen ? "" : "rotate-180"}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M15 19l-7-7 7-7" }) }) })] }), _jsx("div", { className: "md:hidden", children: _jsx(BottomSheet, { open: mobileOpen, onClose: close, title: "Admin Panel", children: mobileNavContent }) })] }));
51
51
  }
52
52
  return (_jsxs(_Fragment, { children: [mounted && mobileOpen &&
53
53
  createPortal(_jsx(DrawerPanel, { title: "Admin Panel", onClose: close, children: navContent }), document.body), _jsx("div", { className: "md:hidden", children: _jsx(BottomSheet, { open: mobileOpen, onClose: close, title: "Admin Panel", children: mobileNavContent }) })] }));
@@ -2,14 +2,17 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import React, { useState, useCallback } from "react";
4
4
  import { X } from "lucide-react";
5
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
5
6
  import { useUrlTable } from "../../../react/hooks/useUrlTable";
6
7
  import { usePanelUrlSync } from "../../../react/hooks/use-panel-url-sync";
7
8
  import { useBulkSelection } from "../../../react/hooks/useBulkSelection";
8
- import { BulkActionBar, FilterChipGroup, ListingToolbar, Pagination, ListingViewShell, RowActionMenu } from "../../../ui";
9
+ import { BulkActionBar, FilterChipGroup, ListingToolbar, Pagination, ListingViewShell, RowActionMenu, useToast } from "../../../ui";
9
10
  import { AdminViewCards } from "./AdminViewCards";
10
11
  import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
12
+ import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
11
13
  import { ADMIN_STORE_STATUS_TABS } from "../constants/filter-tabs";
12
14
  import { toRecordArray, toRelativeDate, toStringValue, useAdminListingData, } from "../hooks/useAdminListingData";
15
+ import { apiClient } from "../../../http";
13
16
  import { DataTable } from "./DataTable";
14
17
  import { AdminStoreEditorView } from "./AdminStoreEditorView";
15
18
  const PAGE_SIZE = 25;
@@ -29,8 +32,26 @@ function StoresFilterDrawer({ filterOpen, setFilterOpen, activeFilterCount, clea
29
32
  export function AdminStoresView({ children, ...props }) {
30
33
  const hasChildren = React.Children.count(children) > 0;
31
34
  const [view, setView] = useState("table");
35
+ const toast = useToast();
36
+ const queryClient = useQueryClient();
32
37
  const table = useUrlTable({ defaults: { pageSize: String(PAGE_SIZE), sort: DEFAULT_SORT } });
33
38
  const { openEditPanel, closePanel, isEditOpen, editId } = usePanelUrlSync();
39
+ const verifyStore = useMutation({
40
+ mutationFn: (storeId) => apiClient.patch(ADMIN_ENDPOINTS.STORE_BY_ID(storeId), { isVerified: true }),
41
+ onSuccess: () => {
42
+ toast.showToast("Store verified.", "success");
43
+ void queryClient.invalidateQueries({ queryKey: ["admin", "stores", "listing"] });
44
+ },
45
+ onError: () => { toast.showToast("Failed to verify store.", "error"); },
46
+ });
47
+ const suspendStore = useMutation({
48
+ mutationFn: (storeId) => apiClient.patch(ADMIN_ENDPOINTS.STORE_BY_ID(storeId), { storeStatus: "suspended" }),
49
+ onSuccess: () => {
50
+ toast.showToast("Store suspended.", "success");
51
+ void queryClient.invalidateQueries({ queryKey: ["admin", "stores", "listing"] });
52
+ },
53
+ onError: () => { toast.showToast("Failed to suspend store.", "error"); },
54
+ });
34
55
  const [searchInput, setSearchInput] = useState(table.get("q") || "");
35
56
  const [filterOpen, setFilterOpen] = useState(false);
36
57
  const [pendingFilters, setPendingFilters] = useState(() => Object.fromEntries(FILTER_KEYS.map((k) => [k, table.get(k)])));
@@ -93,10 +114,27 @@ export function AdminStoresView({ children, ...props }) {
93
114
  return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "min-h-screen", children: [_jsx(ListingToolbar, { filterCount: activeFilterCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search stores, slugs, or owner names", onSearchChange: setSearchInput, onSearchCommit: commitSearch, sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => { table.set("sort", v); }, showTableView: true, view: view, onViewChange: (v) => setView(v), onResetAll: resetAll, hasActiveState: hasActiveState }), _jsx(BulkActionBar, { selectedCount: selection.selectedCount, onClearSelection: selection.clearSelection, actions: [
94
115
  { id: "manage", label: "Manage Store", variant: "primary", onClick: () => { const id = selection.selectedIds[0]; if (id)
95
116
  openEditPanel(id); selection.clearSelection(); } },
96
- ] }), totalPages > 1 && (_jsx("div", { className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 flex justify-center bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700 px-3 py-1.5", children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsxs("div", { className: "py-4 px-3 sm:px-4", children: [errorMessage && (_jsx("div", { className: "mb-4 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/40 dark:text-red-200", children: errorMessage })), view === "table" ? (_jsx(DataTable, { rows: rows, isLoading: isLoading, emptyLabel: "No stores found", selectedIds: selection.selectedIdSet, onToggleSelect: selection.toggle, onToggleSelectAll: (next) => next ? selection.setSelectedIds(rows.map(r => r.id)) : selection.clearSelection(), renderRowActions: (row) => (_jsx(RowActionMenu, { actions: [{
97
- label: "Manage",
98
- onClick: () => openEditPanel(row.id),
99
- }] })) })) : (_jsx(AdminViewCards, { rows: rows, view: view, isLoading: isLoading, emptyLabel: "No stores found", onRowClick: (row) => openEditPanel(row.id), selectedIdSet: selection.selectedIdSet, onToggleSelect: selection.toggle }))] }), _jsx(StoresFilterDrawer, { filterOpen: filterOpen, setFilterOpen: setFilterOpen, activeFilterCount: activeFilterCount, clearFilters: clearFilters, pendingFilters: pendingFilters, setPendingFilters: setPendingFilters, applyFilters: applyFilters })] }), _jsx(AdminStoreEditorView, { open: isEditOpen, onClose: closePanel, storeId: editId ?? undefined, storeName: panelRow?.primary, currentStatus: panelRow?.status?.toLowerCase(), currentIsVerified: Boolean(panelRow?._raw?.isVerified), currentCapabilities: Array.isArray(panelRow?._raw?.capabilities)
117
+ ] }), totalPages > 1 && (_jsx("div", { className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 flex justify-center bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700 px-3 py-1.5", children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsxs("div", { className: "py-4 px-3 sm:px-4", children: [errorMessage && (_jsx("div", { className: "mb-4 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/40 dark:text-red-200", children: errorMessage })), view === "table" ? (_jsx(DataTable, { rows: rows, isLoading: isLoading, emptyLabel: "No stores found", selectedIds: selection.selectedIdSet, onToggleSelect: selection.toggle, onToggleSelectAll: (next) => next ? selection.setSelectedIds(rows.map(r => r.id)) : selection.clearSelection(), renderRowActions: (row) => {
118
+ const sr = row;
119
+ const isSuspended = sr.status?.toLowerCase() === "suspended";
120
+ const isVerified = Boolean(sr._raw?.isVerified);
121
+ return (_jsx(RowActionMenu, { actions: [
122
+ {
123
+ label: "Manage",
124
+ onClick: () => openEditPanel(sr.id),
125
+ },
126
+ {
127
+ label: ACTIONS.ADMIN["verify-store"].label,
128
+ onClick: () => verifyStore.mutate(sr.id),
129
+ disabled: isVerified || verifyStore.isPending,
130
+ },
131
+ {
132
+ label: ACTIONS.ADMIN["suspend-store"].label,
133
+ onClick: () => suspendStore.mutate(sr.id),
134
+ disabled: isSuspended || suspendStore.isPending,
135
+ },
136
+ ] }));
137
+ } })) : (_jsx(AdminViewCards, { rows: rows, view: view, isLoading: isLoading, emptyLabel: "No stores found", onRowClick: (row) => openEditPanel(row.id), selectedIdSet: selection.selectedIdSet, onToggleSelect: selection.toggle }))] }), _jsx(StoresFilterDrawer, { filterOpen: filterOpen, setFilterOpen: setFilterOpen, activeFilterCount: activeFilterCount, clearFilters: clearFilters, pendingFilters: pendingFilters, setPendingFilters: setPendingFilters, applyFilters: applyFilters })] }), _jsx(AdminStoreEditorView, { open: isEditOpen, onClose: closePanel, storeId: editId ?? undefined, storeName: panelRow?.primary, currentStatus: panelRow?.status?.toLowerCase(), currentIsVerified: Boolean(panelRow?._raw?.isVerified), currentCapabilities: Array.isArray(panelRow?._raw?.capabilities)
100
138
  ? panelRow._raw.capabilities
101
139
  : undefined })] }));
102
140
  }