@mohasinac/appkit 4.11.3 → 4.12.1

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 (160) hide show
  1. package/dist/_internal/server/features/auctions/service.d.ts +7 -1
  2. package/dist/_internal/server/features/auctions/service.js +13 -5
  3. package/dist/_internal/server/features/checkout/actions.d.ts +36 -18
  4. package/dist/_internal/server/features/checkout/actions.js +127 -45
  5. package/dist/_internal/server/features/orders/actions.js +5 -3
  6. package/dist/_internal/server/features/orders/adapters.js +13 -0
  7. package/dist/_internal/server/features/products/list-public.d.ts +28 -0
  8. package/dist/_internal/server/features/products/list-public.js +92 -0
  9. package/dist/_internal/server/functions/firestore.d.ts +1 -2
  10. package/dist/_internal/server/functions/firestore.js +1 -9
  11. package/dist/_internal/server/jobs/core/auctionSettlement.js +5 -2
  12. package/dist/_internal/server/jobs/core/index.d.ts +0 -1
  13. package/dist/_internal/server/jobs/core/index.js +0 -1
  14. package/dist/_internal/server/jobs/core/offerExpiry.js +33 -1
  15. package/dist/_internal/server/jobs/handlers/index.d.ts +1 -2
  16. package/dist/_internal/server/jobs/handlers/index.js +1 -2
  17. package/dist/_internal/shared/checkout/lanes.d.ts +20 -0
  18. package/dist/_internal/shared/checkout/lanes.js +28 -0
  19. package/dist/_internal/shared/features/auctions/config.d.ts +34 -0
  20. package/dist/_internal/shared/features/auctions/config.js +47 -3
  21. package/dist/_internal/shared/features/checkout/config.d.ts +4 -0
  22. package/dist/_internal/shared/features/checkout/config.js +8 -0
  23. package/dist/_internal/shared/fees/calculator.d.ts +34 -2
  24. package/dist/_internal/shared/fees/calculator.js +45 -1
  25. package/dist/_internal/shared/listing-types/auction/config.js +1 -1
  26. package/dist/_internal/shared/listing-types/digital-code/config.js +1 -1
  27. package/dist/_internal/shared/listing-types/live/config.js +1 -1
  28. package/dist/_internal/shared/listing-types/pre-order/config.js +1 -1
  29. package/dist/client.d.ts +7 -1
  30. package/dist/client.js +4 -1
  31. package/dist/constants/api-endpoints.d.ts +6 -0
  32. package/dist/constants/api-endpoints.js +2 -0
  33. package/dist/features/account/components/NotificationBell.js +1 -1
  34. package/dist/features/admin/components/AdminAddressesView.js +18 -10
  35. package/dist/features/admin/components/AdminArtView.d.ts +9 -0
  36. package/dist/features/admin/components/AdminArtView.js +11 -35
  37. package/dist/features/admin/components/AdminClassifiedView.d.ts +9 -0
  38. package/dist/features/admin/components/AdminClassifiedView.js +11 -35
  39. package/dist/features/admin/components/AdminDigitalCodesView.d.ts +9 -0
  40. package/dist/features/admin/components/AdminDigitalCodesView.js +11 -42
  41. package/dist/features/admin/components/AdminLiveView.d.ts +9 -0
  42. package/dist/features/admin/components/AdminLiveView.js +11 -41
  43. package/dist/features/admin/components/AdminNotificationsView.js +4 -1
  44. package/dist/features/admin/components/AdminOrderEditorView.d.ts +14 -1
  45. package/dist/features/admin/components/AdminOrderEditorView.js +18 -5
  46. package/dist/features/admin/components/AdminOrdersView.js +15 -1
  47. package/dist/features/admin/components/AdminPaymentMethodsView.js +15 -10
  48. package/dist/features/admin/components/AdminSiteConfigGuideView.js +1 -1
  49. package/dist/features/admin/components/AdminSiteSettingsView.js +4 -2
  50. package/dist/features/admin/components/AdminStickersView.d.ts +9 -0
  51. package/dist/features/admin/components/AdminStickersView.js +11 -35
  52. package/dist/features/admin/hooks/useAdminListing.js +7 -2
  53. package/dist/features/admin/schemas/firestore.d.ts +5 -0
  54. package/dist/features/admin/schemas/firestore.js +1 -0
  55. package/dist/features/auctions/actions/bid-actions.js +73 -11
  56. package/dist/features/auctions/components/AuctionDetailPageView.js +8 -2
  57. package/dist/features/auctions/components/MarketplaceAuctionCard.js +3 -3
  58. package/dist/features/auctions/components/PlaceBidFormClient.js +89 -14
  59. package/dist/features/auctions/schemas/bid-input.d.ts +19 -6
  60. package/dist/features/auctions/schemas/bid-input.js +19 -7
  61. package/dist/features/auth/repository/user.repository.js +6 -0
  62. package/dist/features/cart/components/CartDrawer.d.ts +9 -1
  63. package/dist/features/cart/components/CartDrawer.js +4 -3
  64. package/dist/features/cart/components/CartPriceBreakdown.d.ts +61 -0
  65. package/dist/features/cart/components/CartPriceBreakdown.js +25 -0
  66. package/dist/features/cart/components/StoreAddonsPicker.d.ts +47 -0
  67. package/dist/features/cart/components/StoreAddonsPicker.js +21 -0
  68. package/dist/features/cart/components/index.d.ts +4 -0
  69. package/dist/features/cart/components/index.js +2 -0
  70. package/dist/features/cart/repository/cart.repository.d.ts +20 -2
  71. package/dist/features/cart/repository/cart.repository.js +49 -0
  72. package/dist/features/cart/schemas/firestore.d.ts +26 -0
  73. package/dist/features/faq/components/FAQHelpfulButtons.js +2 -2
  74. package/dist/features/filters/FilterFacetSection.js +1 -1
  75. package/dist/features/homepage/components/WhatsAppCommunitySection.js +1 -1
  76. package/dist/features/layout/BackToTop.js +1 -1
  77. package/dist/features/layout/BottomActions.js +38 -5
  78. package/dist/features/layout/BottomActionsContext.d.ts +12 -0
  79. package/dist/features/layout/BottomActionsContext.js +5 -0
  80. package/dist/features/layout/FooterLayout.js +2 -2
  81. package/dist/features/layout/TitleBarLayout.js +1 -1
  82. package/dist/features/layout/hooks/useBottomActions.d.ts +6 -0
  83. package/dist/features/layout/hooks/useBottomActions.js +11 -1
  84. package/dist/features/orders/components/OrderAddonBadges.d.ts +36 -0
  85. package/dist/features/orders/components/OrderAddonBadges.js +28 -0
  86. package/dist/features/orders/components/index.d.ts +1 -0
  87. package/dist/features/orders/components/index.js +1 -0
  88. package/dist/features/orders/repository/orders.repository.d.ts +32 -0
  89. package/dist/features/orders/repository/orders.repository.js +14 -0
  90. package/dist/features/orders/types/index.d.ts +22 -0
  91. package/dist/features/pre-orders/components/MarketplacePreorderCard.js +3 -3
  92. package/dist/features/products/components/ArtStickersListView.js +5 -4
  93. package/dist/features/products/components/MarketplaceBundleCard.js +2 -2
  94. package/dist/features/products/components/MarketplacePrizeDrawCard.js +2 -2
  95. package/dist/features/products/components/PrizeDrawCollage.js +1 -1
  96. package/dist/features/products/components/PrizeDrawItemsEditor.js +1 -1
  97. package/dist/features/products/components/PrizeDrawsListingView.js +18 -33
  98. package/dist/features/products/components/ProductDetailPageView.js +1 -1
  99. package/dist/features/products/components/ProductGrid.js +3 -3
  100. package/dist/features/products/components/ProductsIndexListing.js +87 -11
  101. package/dist/features/products/components/ProductsIndexPageView.js +14 -2
  102. package/dist/features/products/config/listing-type-listing-config.d.ts +31 -0
  103. package/dist/features/products/config/listing-type-listing-config.js +74 -0
  104. package/dist/features/products/hooks/useProducts.js +14 -0
  105. package/dist/features/products/repository/products.repository.d.ts +0 -4
  106. package/dist/features/products/repository/products.repository.js +0 -15
  107. package/dist/features/products/types/index.d.ts +15 -0
  108. package/dist/features/promotions/repository/coupons.repository.d.ts +12 -0
  109. package/dist/features/promotions/repository/coupons.repository.js +12 -0
  110. package/dist/features/seller/components/SellerOrdersView.js +2 -1
  111. package/dist/features/seller/components/SellerSidebar.js +1 -1
  112. package/dist/features/stores/components/StoreArtStickersPageView.d.ts +21 -0
  113. package/dist/features/stores/components/StoreArtStickersPageView.js +30 -0
  114. package/dist/features/stores/components/StoreAuctionsPageView.d.ts +4 -1
  115. package/dist/features/stores/components/StoreAuctionsPageView.js +17 -17
  116. package/dist/features/stores/components/StoreClassifiedsListing.js +7 -0
  117. package/dist/features/stores/components/StoreClassifiedsPageView.d.ts +4 -1
  118. package/dist/features/stores/components/StoreClassifiedsPageView.js +16 -12
  119. package/dist/features/stores/components/StoreDetailLayoutView.js +4 -3
  120. package/dist/features/stores/components/StoreDigitalCodesListing.js +5 -0
  121. package/dist/features/stores/components/StoreDigitalCodesPageView.d.ts +4 -1
  122. package/dist/features/stores/components/StoreDigitalCodesPageView.js +16 -12
  123. package/dist/features/stores/components/StoreLiveItemsListing.js +7 -0
  124. package/dist/features/stores/components/StoreLiveItemsPageView.d.ts +4 -1
  125. package/dist/features/stores/components/StoreLiveItemsPageView.js +16 -12
  126. package/dist/features/stores/components/StorePreOrdersPageView.d.ts +4 -1
  127. package/dist/features/stores/components/StorePreOrdersPageView.js +17 -17
  128. package/dist/features/stores/components/StorePrizeDrawsPageView.d.ts +4 -8
  129. package/dist/features/stores/components/StorePrizeDrawsPageView.js +17 -22
  130. package/dist/features/stores/components/StoreProductsListing.d.ts +7 -1
  131. package/dist/features/stores/components/StoreProductsListing.js +3 -2
  132. package/dist/features/stores/components/StoreProductsPageView.d.ts +1 -1
  133. package/dist/features/stores/components/StoreProductsPageView.js +16 -21
  134. package/dist/features/tester/seed-data/tester-checklist-seed-data.js +875 -0
  135. package/dist/features/whatsapp-bot/components/WhatsAppChatButton.js +1 -1
  136. package/dist/jobs.d.ts +1 -1
  137. package/dist/jobs.js +1 -1
  138. package/dist/next/routing/route-map.d.ts +2 -0
  139. package/dist/next/routing/route-map.js +5 -0
  140. package/dist/seed/homepage-sections-seed-data.js +5 -1
  141. package/dist/seed/reviews-seed-data.js +52 -0
  142. package/dist/seed/site-settings-seed-data.js +18 -0
  143. package/dist/server-entry.d.ts +1 -0
  144. package/dist/server-entry.js +1 -0
  145. package/dist/styles.css +66 -1
  146. package/dist/tailwind-utilities.css +1 -1
  147. package/dist/tokens/color-pairs.js +1 -0
  148. package/dist/tokens/tokens.css +33 -0
  149. package/dist/ui/components/Button.style.css +21 -0
  150. package/dist/ui/components/Checkbox.d.ts +10 -1
  151. package/dist/ui/components/Checkbox.js +14 -2
  152. package/dist/ui/components/Checkbox.style.css +11 -0
  153. package/dist/ui/components/ImageLightbox.js +7 -4
  154. package/dist/ui/components/surface-tokens.d.ts +7 -0
  155. package/dist/ui/components/surface-tokens.js +7 -0
  156. package/package.json +1 -1
  157. package/dist/_internal/server/jobs/core/onBidPlaced.d.ts +0 -15
  158. package/dist/_internal/server/jobs/core/onBidPlaced.js +0 -63
  159. package/dist/_internal/server/jobs/handlers/onBidPlaced.d.ts +0 -3
  160. package/dist/_internal/server/jobs/handlers/onBidPlaced.js +0 -9
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { sortBy } from "@mohasinac/appkit/client";
4
- import { useState } from "react";
4
+ import { useUrlTable } from "../../../react/hooks/useUrlTable";
5
5
  import { useQueryClient } from "@tanstack/react-query";
6
6
  import { Badge, Div, FilterChipGroup, Span, Stack, Text, useToast } from "../../../ui";
7
7
  import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
@@ -44,18 +44,20 @@ const PM_COLUMNS = [
44
44
  render: (row) => _jsx(Span, { size: "sm", color: "muted", children: row.updatedAt }),
45
45
  },
46
46
  ];
47
- function buildConfig(banStatus, onAction) {
47
+ function buildConfig(onAction) {
48
48
  return {
49
49
  portal: "admin",
50
50
  title: "Payment Methods",
51
51
  searchPlaceholder: "Search by type or owner",
52
52
  emptyLabel: "No payment methods found",
53
- filterKeys: [],
53
+ // URL-synced via filterKeys (2026-08-21) — see the matching note in
54
+ // AdminAddressesView. banStatus is a query param, not a Sieve clause,
55
+ // hence buildExtraParams rather than buildFilters.
56
+ filterKeys: ["banStatus"],
54
57
  defaultSort: sortBy("bannedAt", "DESC"),
55
- queryKey: ["admin", "payment-methods", banStatus],
56
- endpoint: banStatus
57
- ? `${ADMIN_ENDPOINTS.PAYMENT_METHODS}?banStatus=${encodeURIComponent(banStatus)}`
58
- : ADMIN_ENDPOINTS.PAYMENT_METHODS,
58
+ queryKey: ["admin", "payment-methods"],
59
+ endpoint: ADMIN_ENDPOINTS.PAYMENT_METHODS,
60
+ buildExtraParams: (state) => state.banStatus ? { banStatus: state.banStatus } : undefined,
59
61
  sortOptions: [
60
62
  // -bannedAt (newest flagged first) to match defaultSort — the option was
61
63
  // "bannedAt" (oldest first), so the dropdown opened with nothing selected.
@@ -109,7 +111,10 @@ function buildConfig(banStatus, onAction) {
109
111
  };
110
112
  }
111
113
  export function AdminPaymentMethodsView(_props) {
112
- const [banStatus, setBanStatus] = useState("");
114
+ // Independent useUrlTable() against the same URL param the listing reads
115
+ // via filterKeys (Root Cause #35 pattern).
116
+ const chipTable = useUrlTable({ defaults: {} });
117
+ const banStatus = chipTable.get("banStatus");
113
118
  const queryClient = useQueryClient();
114
119
  const { showToast } = useToast();
115
120
  const actionMutation = useApiMutation({
@@ -127,6 +132,6 @@ export function AdminPaymentMethodsView(_props) {
127
132
  const handleAction = (id, action) => {
128
133
  actionMutation.mutate({ id, action });
129
134
  };
130
- const config = buildConfig(banStatus, handleAction);
131
- return (_jsxs(Stack, { gap: "md", children: [_jsx(Div, { padding: "inline", border: "default", className: "border-b", children: _jsx(FilterChipGroup, { label: "Status", tabs: BAN_STATUS_TABS, value: banStatus, onChange: (v) => setBanStatus(v) }) }), _jsx(DataListingView, { config: config })] }));
135
+ const config = buildConfig(handleAction);
136
+ return (_jsxs(Stack, { gap: "md", children: [_jsx(Div, { padding: "inline", border: "default", className: "border-b", children: _jsx(FilterChipGroup, { label: "Status", tabs: BAN_STATUS_TABS, value: banStatus, onChange: (v) => chipTable.set("banStatus", v) }) }), _jsx(DataListingView, { config: config })] }));
132
137
  }
@@ -18,5 +18,5 @@ export function AdminSiteConfigGuideView() {
18
18
  { name: "platformLimits", desc: "Cart item cap (50), wishlist cap (20), history cap (50), support ticket limits (2 general + 1 per order)." },
19
19
  { name: "legalPages", desc: "Body HTML for Terms of Service, Privacy Policy, Refund Policy, and Shipping Policy. Rendered on their respective static pages." },
20
20
  ];
21
- return (_jsxs(Stack, { className: "max-w-3xl mx-auto", padding: "b-2xl", gap: "xl", children: [_jsxs(Section, { children: [_jsxs(Row, { className: "mb-2", align: "center", gap: "3", children: [_jsx(Row, { className: "flex-shrink-0 w-10 h-10 [background:linear-gradient(135deg,var(--appkit-color-primary-700)_0%,var(--appkit-color-cobalt)_100%)]", align: "center", justify: "center", rounded: "xl", children: _jsx(Settings, { className: "w-5 h-5 text-white" }) }), _jsx(Text, { className: "text-[var(--appkit-color-text-muted)] tracking-widest", size: "sm", weight: "semibold", transform: "uppercase", children: "Admin Guide" })] }), _jsx(Heading, { level: 1, className: "text-[var(--appkit-color-text)] mb-2", mdSize: "3xl", size: "2xl", weight: "bold", children: "Site Configuration" }), _jsxs(Text, { className: "text-[var(--appkit-color-text-muted)]", children: ["All site settings are stored in a single Firestore document at ", _jsx(Code, { size: "xs", children: "site_settings/global" }), ". Changes take effect on the next page render (ISR or cache revalidation)."] })] }), _jsxs(Section, { className: GC.sectionWrap, children: [_jsxs(Div, { className: GC.sectionHeader, children: [_jsx(Settings, { className: "w-5 h-5 text-[var(--appkit-color-primary)]" }), _jsx(Heading, { level: 2, className: GC.sectionTitle, children: "Settings Groups" })] }), _jsx(Stack, { paddingY: "y-md-lg", padding: "x-lg", gap: "md", children: SETTING_GROUPS.map(({ name, desc }) => (_jsxs(Row, { textSize: "sm", gap: "3", children: [_jsx(Text, { className: "flex-shrink-0 font-mono text-[var(--appkit-color-primary)] w-40", size: "xs", weight: "semibold", children: name }), _jsx(Text, { className: "text-[var(--appkit-color-text-muted)]", children: desc })] }, name))) })] }), _jsxs(Section, { className: GC.sectionWrap, children: [_jsxs(Div, { className: GC.sectionHeader, children: [_jsx(Settings, { className: CLS_HEADER_ICON }), _jsx(Heading, { level: 2, className: GC.sectionTitle, children: "API Keys & Integrations" })] }), _jsx(Div, { paddingY: "y-md-lg", padding: "x-lg", children: _jsxs(Alert, { variant: "warning", children: ["API keys in ", _jsx(Code, { size: "xs", children: "integrations" }), " are stored encrypted. They are masked in the admin UI \u2014 you see ", _jsx(Code, { size: "xs", children: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" }), " by design. To rotate a key: paste the new value into the field and save. The old key is immediately invalidated on your payment/shipping provider's side \u2014 test in staging first. Never paste API keys into Slack, email, or any external service."] }) })] }), _jsxs(Section, { className: GC.sectionWrap, children: [_jsxs(Div, { className: GC.sectionHeader, children: [_jsx(Settings, { className: "w-5 h-5 text-[var(--appkit-color-primary)]" }), _jsx(Heading, { level: 2, className: GC.sectionTitle, children: "Feature Flags" })] }), _jsxs(Stack, { paddingY: "y-md-lg", padding: "x-lg", gap: "3", children: [_jsxs(Text, { className: "text-[var(--appkit-color-text-muted)]", size: "sm", children: ["Feature flags are boolean toggles under ", _jsx(Code, { size: "xs", padding: "xs", rounded: "default", surface: "subtle", children: "siteSettings" }), ". They control platform-wide features without a code deploy:"] }), _jsxs(Ul, { className: "list-inside text-[var(--appkit-color-text-muted)]", marker: "disc", spacing: "tight", size: "sm", children: [_jsxs(Li, { children: [_jsx(Code, { size: "xs", padding: "xs", rounded: "default", surface: "subtle", children: "enableAuctions" }), " \u2014 globally enable/disable all auction listings."] }), _jsxs(Li, { children: [_jsx(Code, { size: "xs", padding: "xs", rounded: "default", surface: "subtle", children: "enablePreOrders" }), " \u2014 globally enable/disable pre-order creation."] }), _jsxs(Li, { children: [_jsx(Code, { size: "xs", padding: "xs", rounded: "default", surface: "subtle", children: "maintenanceMode" }), " \u2014 shows a maintenance banner and blocks non-admin access."] })] }), _jsx(Text, { className: "text-[var(--appkit-color-text-muted)]", size: "sm", children: "Flags are evaluated per-request via ISR cache \u2014 a change may take up to the revalidation interval (3600s default) to propagate to all pages." })] })] })] }));
21
+ return (_jsxs(Stack, { className: "max-w-3xl mx-auto", padding: "b-2xl", gap: "xl", children: [_jsxs(Section, { children: [_jsxs(Row, { className: "mb-2", align: "center", gap: "3", children: [_jsx(Row, { className: "flex-shrink-0 w-10 h-10 [background:linear-gradient(135deg,var(--appkit-color-primary-700)_0%,var(--appkit-color-cobalt)_100%)]", align: "center", justify: "center", rounded: "xl", children: _jsx(Settings, { className: "w-5 h-5 text-white" }) }), _jsx(Text, { className: "text-[var(--appkit-color-text-muted)] tracking-widest", size: "sm", weight: "semibold", transform: "uppercase", children: "Admin Guide" })] }), _jsx(Heading, { level: 1, className: "text-[var(--appkit-color-text)] mb-2", mdSize: "3xl", size: "2xl", weight: "bold", children: "Site Configuration" }), _jsxs(Text, { className: "text-[var(--appkit-color-text-muted)]", children: ["All site settings are stored in a single Firestore document at ", _jsx(Code, { size: "xs", children: "siteSettings/global" }), ". Changes take effect on the next page render (ISR or cache revalidation)."] })] }), _jsxs(Section, { className: GC.sectionWrap, children: [_jsxs(Div, { className: GC.sectionHeader, children: [_jsx(Settings, { className: "w-5 h-5 text-[var(--appkit-color-primary)]" }), _jsx(Heading, { level: 2, className: GC.sectionTitle, children: "Settings Groups" })] }), _jsx(Stack, { paddingY: "y-md-lg", padding: "x-lg", gap: "md", children: SETTING_GROUPS.map(({ name, desc }) => (_jsxs(Row, { textSize: "sm", gap: "3", children: [_jsx(Text, { className: "flex-shrink-0 font-mono text-[var(--appkit-color-primary)] w-40", size: "xs", weight: "semibold", children: name }), _jsx(Text, { className: "text-[var(--appkit-color-text-muted)]", children: desc })] }, name))) })] }), _jsxs(Section, { className: GC.sectionWrap, children: [_jsxs(Div, { className: GC.sectionHeader, children: [_jsx(Settings, { className: CLS_HEADER_ICON }), _jsx(Heading, { level: 2, className: GC.sectionTitle, children: "API Keys & Integrations" })] }), _jsx(Div, { paddingY: "y-md-lg", padding: "x-lg", children: _jsxs(Alert, { variant: "warning", children: ["API keys in ", _jsx(Code, { size: "xs", children: "integrations" }), " are stored encrypted. They are masked in the admin UI \u2014 you see ", _jsx(Code, { size: "xs", children: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" }), " by design. To rotate a key: paste the new value into the field and save. The old key is immediately invalidated on your payment/shipping provider's side \u2014 test in staging first. Never paste API keys into Slack, email, or any external service."] }) })] }), _jsxs(Section, { className: GC.sectionWrap, children: [_jsxs(Div, { className: GC.sectionHeader, children: [_jsx(Settings, { className: "w-5 h-5 text-[var(--appkit-color-primary)]" }), _jsx(Heading, { level: 2, className: GC.sectionTitle, children: "Feature Flags" })] }), _jsxs(Stack, { paddingY: "y-md-lg", padding: "x-lg", gap: "3", children: [_jsxs(Text, { className: "text-[var(--appkit-color-text-muted)]", size: "sm", children: ["Feature flags are boolean toggles under ", _jsx(Code, { size: "xs", padding: "xs", rounded: "default", surface: "subtle", children: "siteSettings" }), ". They control platform-wide features without a code deploy:"] }), _jsxs(Ul, { className: "list-inside text-[var(--appkit-color-text-muted)]", marker: "disc", spacing: "tight", size: "sm", children: [_jsxs(Li, { children: [_jsx(Code, { size: "xs", padding: "xs", rounded: "default", surface: "subtle", children: "enableAuctions" }), " \u2014 globally enable/disable all auction listings."] }), _jsxs(Li, { children: [_jsx(Code, { size: "xs", padding: "xs", rounded: "default", surface: "subtle", children: "enablePreOrders" }), " \u2014 globally enable/disable pre-order creation."] }), _jsxs(Li, { children: [_jsx(Code, { size: "xs", padding: "xs", rounded: "default", surface: "subtle", children: "maintenanceMode" }), " \u2014 shows a maintenance banner and blocks non-admin access."] })] }), _jsx(Text, { className: "text-[var(--appkit-color-text-muted)]", size: "sm", children: "Flags are evaluated per-request via ISR cache \u2014 a change may take up to the revalidation interval (3600s default) to propagate to all pages." })] })] })] }));
22
22
  }
@@ -146,6 +146,7 @@ export function AdminSiteSettingsView({ labels = {}, ...rest }) {
146
146
  const [platformFeePercent, setPlatformFeePercent] = React.useState(5);
147
147
  const [gstPercent, setGstPercent] = React.useState(18);
148
148
  const [minimumTransactionFee, setMinimumTransactionFee] = React.useState(0);
149
+ const [platformFeeMax, setPlatformFeeMax] = React.useState(10);
149
150
  const [gatewayFeePercent, setGatewayFeePercent] = React.useState(2);
150
151
  const [payoutHoldDays, setPayoutHoldDays] = React.useState(7);
151
152
  const [minPayoutAmount, setMinPayoutAmount] = React.useState(100);
@@ -329,6 +330,7 @@ export function AdminSiteSettingsView({ labels = {}, ...rest }) {
329
330
  setPlatformFeePercent(s.commissions?.platformFeePercent ?? 5);
330
331
  setGstPercent(s.commissions?.gstPercent ?? 18);
331
332
  setMinimumTransactionFee(s.commissions?.minimumTransactionFee ?? 0);
333
+ setPlatformFeeMax(s.commissions?.platformFeeMax ?? 10);
332
334
  setGatewayFeePercent(s.commissions?.gatewayFeePercent ?? 2);
333
335
  setPayoutHoldDays(s.commissions?.payoutHoldDays ?? 7);
334
336
  setMinPayoutAmount(s.commissions?.minPayoutAmount ?? 100);
@@ -522,7 +524,7 @@ export function AdminSiteSettingsView({ labels = {}, ...rest }) {
522
524
  offsetX: watermarkOffsetX,
523
525
  offsetY: watermarkOffsetY,
524
526
  },
525
- commissions: { platformFeePercent, gstPercent, minimumTransactionFee, gatewayFeePercent, payoutHoldDays, minPayoutAmount, auctionListingFee, preOrderListingFee, featuredSlotFee, promotedSlotFee, whatsappNotifyFeeEnabled, whatsappNotifyFee, giftWrapFeeEnabled, giftWrapFee, shipmentProtectionFeeEnabled, shipmentProtectionFeePercent, shipmentProtectionFeeMin, codDepositPercent, sellerShippingFixed, platformShippingPercent, platformShippingFixedMin },
527
+ commissions: { platformFeePercent, gstPercent, minimumTransactionFee, platformFeeMax, gatewayFeePercent, payoutHoldDays, minPayoutAmount, auctionListingFee, preOrderListingFee, featuredSlotFee, promotedSlotFee, whatsappNotifyFeeEnabled, whatsappNotifyFee, giftWrapFeeEnabled, giftWrapFee, shipmentProtectionFeeEnabled, shipmentProtectionFeePercent, shipmentProtectionFeeMin, codDepositPercent, sellerShippingFixed, platformShippingPercent, platformShippingFixedMin },
526
528
  laborRate: { hourlyRate: laborHourlyRate, maxHoursPerDay: laborMaxHoursPerDay },
527
529
  emi: {
528
530
  enabled: emiEnabled,
@@ -668,7 +670,7 @@ export function AdminSiteSettingsView({ labels = {}, ...rest }) {
668
670
  { label: "Top right", value: "top-right" },
669
671
  { label: "Bottom left", value: "bottom-left" },
670
672
  { label: "Bottom right", value: "bottom-right" },
671
- ], value: watermarkPosition, onValueChange: (v) => setWatermarkPosition(v), disabled: watermarkUseCustomOffset }), _jsx(Toggle, { checked: watermarkUseCustomOffset, onChange: setWatermarkUseCustomOffset, label: "Use a custom X/Y offset instead" }), watermarkUseCustomOffset && (_jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "X offset (%) \u2014 + right / \u2212 left of center", value: String(watermarkOffsetX), onChange: (e) => setWatermarkOffsetX(Math.max(-45, Math.min(45, parseInt(e.target.value) || 0))), type: "number", min: -45, max: 45 }), _jsx(Input, { label: "Y offset (%) \u2014 + down / \u2212 up from center", value: String(watermarkOffsetY), onChange: (e) => setWatermarkOffsetY(Math.max(-45, Math.min(45, parseInt(e.target.value) || 0))), type: "number", min: -45, max: 45 })] })), _jsxs(Stack, { gap: "xs", surface: "muted", rounded: "lg", border: "default", padding: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Preview (text watermark only)" }), _jsx(Row, { surface: "default", justify: "end", align: "end", className: `relative h-32 ${__O.hidden}`, rounded: "default", children: _jsx(Span, { ref: watermarkPreviewRef, weight: "medium", color: "faint", padding: "1", className: "select-none", children: watermarkText }) })] })] }) }), _jsx(TabsContent, { value: "fees", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Platform fee \u2014 our cut (%)", helperText: "% charged on order value. Buyer pays this.", value: String(platformFeePercent), onChange: (e) => setPlatformFeePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1 }), _jsx(Input, { label: "GST on platform fee (%)", helperText: "Applied to our fee only (not full order). Usually 18%.", value: String(gstPercent), onChange: (e) => setGstPercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1 }), _jsx(Input, { label: "Razorpay gateway cost (%)", helperText: "Gateway's own fee \u2014 absorbed by platform, not passed through.", value: String(gatewayFeePercent), onChange: (e) => setGatewayFeePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 10, step: 0.01 }), _jsx(Input, { label: "Minimum transaction fee (\u20B9)", helperText: "Per-transaction floor. Total charge will never be below base + this.", value: String(minimumTransactionFee), onChange: (e) => setMinimumTransactionFee(parseFloat(e.target.value) || 0), type: "number", min: 0, step: 0.01 }), _jsx(Input, { label: "Seller payout hold (days)", value: String(payoutHoldDays), onChange: (e) => setPayoutHoldDays(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Minimum payout amount (\u20B9)", value: String(minPayoutAmount), onChange: (e) => setMinPayoutAmount(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Auction listing fee (\u20B9)", value: String(auctionListingFee), onChange: (e) => setAuctionListingFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Pre-order listing fee (\u20B9)", value: String(preOrderListingFee), onChange: (e) => setPreOrderListingFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Featured slot fee (\u20B9)", value: String(featuredSlotFee), onChange: (e) => setFeaturedSlotFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Promoted slot fee (\u20B9)", value: String(promotedSlotFee), onChange: (e) => setPromotedSlotFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "COD deposit (%)", helperText: "% of order collected upfront on COD orders; remainder paid on delivery.", value: String(codDepositPercent), onChange: (e) => setCodDepositPercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1 })] }), _jsx(Toggle, { checked: whatsappNotifyFeeEnabled, onChange: setWhatsappNotifyFeeEnabled, label: "Offer the WhatsApp order-updates addon at checkout" }), _jsx(Grid, { cols: 2, gap: "md", children: _jsx(Input, { label: "WhatsApp addon fee (\u20B9)", helperText: "Flat fee charged to the buyer when they opt in. Requires WhatsApp credentials + at least one approved template \u2014 see the WhatsApp tab.", value: String(whatsappNotifyFee), onChange: (e) => setWhatsappNotifyFee(parseFloat(e.target.value) || 0), type: "number", min: 0, disabled: !whatsappNotifyFeeEnabled }) }), _jsx(Toggle, { checked: giftWrapFeeEnabled, onChange: setGiftWrapFeeEnabled, label: "Offer the gift-wrap addon at checkout" }), _jsx(Grid, { cols: 2, gap: "md", children: _jsx(Input, { label: "Gift wrap fee (\u20B9)", helperText: "Flat fee charged to the buyer when they opt in.", value: String(giftWrapFee), onChange: (e) => setGiftWrapFee(parseFloat(e.target.value) || 0), type: "number", min: 0, disabled: !giftWrapFeeEnabled }) }), _jsx(Toggle, { checked: shipmentProtectionFeeEnabled, onChange: setShipmentProtectionFeeEnabled, label: "Offer the shipment-protection addon at checkout" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Shipment protection (%)", helperText: "% of order subtotal, charged when the buyer opts in.", value: String(shipmentProtectionFeePercent), onChange: (e) => setShipmentProtectionFeePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1, disabled: !shipmentProtectionFeeEnabled }), _jsx(Input, { label: "Shipment protection minimum (\u20B9)", helperText: "Floor for the shipment-protection fee.", value: String(shipmentProtectionFeeMin), onChange: (e) => setShipmentProtectionFeeMin(parseFloat(e.target.value) || 0), type: "number", min: 0, disabled: !shipmentProtectionFeeEnabled })] })] }) }), _jsx(TabsContent, { value: "procurement", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Used to compute each procurement shipment's labor cost (hours spent \u00D7 hourly rate) and its estimated processing time (hours spent \u00F7 max hours/day)." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Hourly rate (\u20B9)", helperText: "Your effective hourly wage for sorting/categorizing/listing a shipment.", value: String(laborHourlyRate), onChange: (e) => setLaborHourlyRate(Math.round((parseFloat(e.target.value) || 0) * 100) / 100), type: "number", min: 0 }), _jsx(Input, { label: "Max hours per day", helperText: "Used only to project how many days a shipment's tracked hours will take.", value: String(laborMaxHoursPerDay), onChange: (e) => setLaborMaxHoursPerDay(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 24 })] })] }) }), _jsx(TabsContent, { value: "emi", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "A seller must also opt in via their own Payout Settings for EMI to appear at checkout on their items. See the \"How EMI Works\" public page for buyer-facing copy." }), _jsx(Toggle, { checked: emiEnabled, onChange: setEmiEnabled, label: "Enable EMI platform-wide" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Minimum order value (\u20B9)", helperText: "A seller's cart subtotal must exceed this for EMI to appear as an option.", value: String(emiMinOrderValue), onChange: (e) => setEmiMinOrderValue(Math.round((parseFloat(e.target.value) || 0) * 100) / 100), type: "number", min: 0 }), _jsx(Input, { label: "Tenure options (months, comma-separated)", helperText: "e.g. 2,3,4,5,6", value: emiTenureOptionsText, onChange: (e) => setEmiTenureOptionsText(e.target.value) }), _jsx(Input, { label: "Token / down-payment (%)", helperText: "Collected upfront at checkout.", value: String(emiTokenPercent), onChange: (e) => setEmiTokenPercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100 }), _jsx(Input, { label: "Billing day (1\u201310)", helperText: "Day of month each installment is due.", value: String(emiBillingDay), onChange: (e) => setEmiBillingDay(parseFloat(e.target.value) || 1), type: "number", min: 1, max: 10 }), _jsx(Input, { label: "Surcharge (% of principal per month)", helperText: "The 'excess EMI fee' the buyer pays for spreading payment.", value: String(emiSurchargePercentPerMonth), onChange: (e) => setEmiSurchargePercentPerMonth(parseFloat(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Seller's share of surcharge (%)", helperText: "The rest of the surcharge goes to the platform.", value: String(emiSurchargeSellerSharePercent), onChange: (e) => setEmiSurchargeSellerSharePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100 })] })] }) }), _jsx(TabsContent, { value: "gst", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Required before enabling GST-inclusive checkout (P-8). Also set a GST rate + HSN code on each taxable product for the tax breakdown to appear." }), _jsx(Toggle, { checked: gstEnabled, onChange: setGstEnabled, label: "Enable GST on checkout" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "GSTIN", helperText: "15-character GST Identification Number.", value: gstin, onChange: (e) => setGstin(e.target.value), placeholder: "29AAAAA0000A1Z5", maxLength: 15 }), _jsx(Input, { label: "Legal name", helperText: "Registered business name for invoices.", value: gstLegalName, onChange: (e) => setGstLegalName(e.target.value), placeholder: "LetItRip Collectibles Pvt Ltd" })] }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "semibold", children: "Registered address" }), _jsx(Textarea, { value: gstAddress, onChange: (e) => setGstAddress(e.target.value), placeholder: "Registered business address for GST invoices\u2026", rows: 3 })] })] }) }), _jsx(TabsContent, { value: "featureflags", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "lg", children: [_jsx(Text, { size: "xs", color: "muted", children: "Site-wide platform feature toggles. Disabling a flag hides that feature's nav entries and pages \u2014 existing data is untouched, it just becomes unreachable until re-enabled." }), _jsx(Grid, { cols: 2, gap: "md", children: FEATURE_FLAG_META.map((flag) => (_jsxs(Stack, { gap: "xs", children: [_jsx(Toggle, { label: `${flag.icon} ${flag.labelKey}`, checked: featureFlags[flag.key] ?? false, onChange: (v) => setFeatureFlags((prev) => ({ ...prev, [flag.key]: v })) }), _jsx(Text, { size: "xs", color: "muted", children: flag.descKey })] }, flag.key))) }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "semibold", children: "Listing types" }), _jsx(Text, { size: "xs", color: "muted", children: "Disabled types are hidden from listings and reject create/add-to-cart." }), _jsx(Grid, { cols: 2, gap: "sm", children: LISTING_TYPE_KEYS.map((key) => (_jsx(Toggle, { label: key, checked: listingTypeFlags[key] ?? true, onChange: (v) => setListingTypeFlags((prev) => ({ ...prev, [key]: v })) }, key))) })] }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "semibold", children: "Category types" }), _jsx(Grid, { cols: 2, gap: "sm", children: CATEGORY_TYPE_KEYS.map((key) => (_jsx(Toggle, { label: key, checked: categoryTypeFlags[key] ?? true, onChange: (v) => setCategoryTypeFlags((prev) => ({ ...prev, [key]: v })) }, key))) })] })] }) }), _jsx(TabsContent, { value: "integrations", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Keys are masked in transit and stored encrypted. Click Reveal to view." }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Razorpay" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Razorpay Key ID", value: razorpayKeyId, onChange: setRazorpayKeyId, placeholder: "rzp_live_\u2026" }), _jsx(MaskedInput, { label: "Razorpay Secret", value: razorpaySecret, onChange: setRazorpaySecret, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "SMTP / Email" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "SMTP host", value: smtpHost, onChange: (e) => setSmtpHost(e.target.value), placeholder: "smtp.sendgrid.net" }), _jsx(Input, { label: "SMTP port", value: smtpPort, onChange: (e) => setSmtpPort(e.target.value), type: "number", placeholder: "587" }), _jsx(Input, { label: "SMTP user", value: smtpUser, onChange: (e) => setSmtpUser(e.target.value), placeholder: "apikey" }), _jsx(MaskedInput, { label: "SMTP password", value: smtpPassword, onChange: setSmtpPassword, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] }), _jsx(Input, { label: "From address", value: smtpFrom, onChange: (e) => setSmtpFrom(e.target.value), placeholder: "noreply@letitrip.in", type: "email" })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Analytics & Tracking" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Google Analytics ID", value: gaMeasurementId, onChange: (e) => setGaMeasurementId(e.target.value), placeholder: "G-XXXXXXXXXX" }), _jsx(Input, { label: "Facebook Pixel ID", value: fbPixelId, onChange: (e) => setFbPixelId(e.target.value), placeholder: "XXXXXXXXXXXXXXXX" }), _jsx(Input, { label: "GTM Container ID", value: gtmContainerId, onChange: (e) => setGtmContainerId(e.target.value), placeholder: "GTM-XXXXXXX" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Meta (Instagram & Facebook Social Feed)" }), _jsx(Text, { size: "xs", color: "muted", children: "Used by the Social Feed section to fetch Instagram and Facebook posts via Meta Graph API v19." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Page Access Token", value: metaPageAccessToken, onChange: setMetaPageAccessToken, placeholder: "EAAxxxxxxx\u2026" }), _jsx(Input, { label: "Page ID (or handle)", value: metaPageId, onChange: (e) => setMetaPageId(e.target.value), placeholder: "letitrip" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "TikTok for Developers (Social Feed)" }), _jsx(Text, { size: "xs", color: "muted", children: "Client credentials + long-lived access token from TikTok for Developers. Used to list your account's public videos." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Client Key", value: tiktokClientKey, onChange: setTiktokClientKey, placeholder: "aw\u2026" }), _jsx(MaskedInput, { label: "Client Secret", value: tiktokClientSecret, onChange: setTiktokClientSecret, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" }), _jsx(MaskedInput, { label: "Access Token (long-lived)", value: tiktokAccessToken, onChange: setTiktokAccessToken, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "DeviantArt OAuth2 (Social Feed)" }), _jsx(Text, { size: "xs", color: "muted", children: "Client credentials for DeviantArt gallery fetching (client-credentials OAuth2 flow \u2014 no user login required)." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Client ID", value: deviantartClientId, onChange: setDeviantartClientId, placeholder: "1234" }), _jsx(MaskedInput, { label: "Client Secret", value: deviantartClientSecret, onChange: setDeviantartClientSecret, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] })] })] }) }), _jsx(TabsContent, { value: "shipping", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Payment methods" }), _jsx(Toggle, { label: "Razorpay (online card/UPI) enabled \u2014 disabled by default, manual payment is the default", checked: razorpayEnabled, onChange: setRazorpayEnabled }), _jsx(Toggle, { label: "Manual UPI/bank transfer enabled", checked: upiManualEnabled, onChange: setUpiManualEnabled }), _jsx(Toggle, { label: "Cash on delivery (COD) enabled", checked: codEnabled, onChange: setCodEnabled }), _jsx(Input, { label: "Free shipping threshold (\u20B9)", value: String(freeShippingThreshold), onChange: (e) => setFreeShippingThreshold(parseInt(e.target.value) || 0), type: "number", min: 0, helperText: "Orders above this amount get free shipping." }), _jsx(Select, { label: "Default carrier", options: CARRIER_OPTIONS, value: defaultCarrier, onValueChange: setDefaultCarrier }), _jsx(Input, { label: "Max delivery radius (km, 0 = no limit)", value: String(maxDeliveryRadius), onChange: (e) => setMaxDeliveryRadius(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "High-value checkout OTP threshold (\u20B9)", helperText: "Carts at or above this subtotal require an extra OTP verification step before payment (0 = disabled).", value: String(otpCheckoutThreshold), onChange: (e) => setOtpCheckoutThreshold(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Text, { size: "sm", weight: "medium", color: "muted", className: "pt-[var(--appkit-space-2)]", children: "Seller shipping charge defaults" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Seller shipping fixed (\u20B9)", helperText: "Flat shipping charge collected on the seller's behalf.", value: String(sellerShippingFixed), onChange: (e) => setSellerShippingFixed(parseFloat(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Platform shipping (%)", helperText: "Platform's own shipping markup, as a % of order value.", value: String(platformShippingPercent), onChange: (e) => setPlatformShippingPercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1 }), _jsx(Input, { label: "Platform shipping minimum (\u20B9)", helperText: "Floor for the platform shipping markup.", value: String(platformShippingFixedMin), onChange: (e) => setPlatformShippingFixedMin(parseFloat(e.target.value) || 0), type: "number", min: 0 })] })] }) }), _jsx(TabsContent, { value: "auction", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsxs(Stack, { gap: "sm", rounded: "lg", border: "default", padding: "sm", children: [_jsx(Text, { size: "xs", weight: "medium", color: "muted", children: "Bid increment tiers" }), _jsx(Text, { size: "xs", color: "muted", children: "The minimum jump a new bid must clear, based on the current bid amount. A seller's per-listing override can require more than the matching tier, but can never undercut it." }), bidIncrementTiers.map((tier, i) => {
673
+ ], value: watermarkPosition, onValueChange: (v) => setWatermarkPosition(v), disabled: watermarkUseCustomOffset }), _jsx(Toggle, { checked: watermarkUseCustomOffset, onChange: setWatermarkUseCustomOffset, label: "Use a custom X/Y offset instead" }), watermarkUseCustomOffset && (_jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "X offset (%) \u2014 + right / \u2212 left of center", value: String(watermarkOffsetX), onChange: (e) => setWatermarkOffsetX(Math.max(-45, Math.min(45, parseInt(e.target.value) || 0))), type: "number", min: -45, max: 45 }), _jsx(Input, { label: "Y offset (%) \u2014 + down / \u2212 up from center", value: String(watermarkOffsetY), onChange: (e) => setWatermarkOffsetY(Math.max(-45, Math.min(45, parseInt(e.target.value) || 0))), type: "number", min: -45, max: 45 })] })), _jsxs(Stack, { gap: "xs", surface: "muted", rounded: "lg", border: "default", padding: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Preview (text watermark only)" }), _jsx(Row, { surface: "default", justify: "end", align: "end", className: `relative h-32 ${__O.hidden}`, rounded: "default", children: _jsx(Span, { ref: watermarkPreviewRef, weight: "medium", color: "faint", padding: "1", className: "select-none", children: watermarkText }) })] })] }) }), _jsx(TabsContent, { value: "fees", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Platform fee \u2014 our cut (%)", helperText: "% charged on order value. Buyer pays this.", value: String(platformFeePercent), onChange: (e) => setPlatformFeePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1 }), _jsx(Input, { label: "GST on platform fee (%)", helperText: "Applied to our fee only (not full order). Usually 18%.", value: String(gstPercent), onChange: (e) => setGstPercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1 }), _jsx(Input, { label: "Razorpay gateway cost (%)", helperText: "Gateway's own fee \u2014 absorbed by platform, not passed through.", value: String(gatewayFeePercent), onChange: (e) => setGatewayFeePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 10, step: 0.01 }), _jsx(Input, { label: "Minimum transaction fee (\u20B9)", helperText: "Per-transaction floor. Total charge will never be below base + this.", value: String(minimumTransactionFee), onChange: (e) => setMinimumTransactionFee(parseFloat(e.target.value) || 0), type: "number", min: 0, step: 0.01 }), _jsx(Input, { label: "Maximum platform fee (\u20B9)", helperText: "Ceiling on the buyer's platform commission, charged once per checkout on every payment method. GST is calculated on the capped amount.", value: String(platformFeeMax), onChange: (e) => setPlatformFeeMax(parseFloat(e.target.value) || 0), type: "number", min: 0, step: 0.01 }), _jsx(Input, { label: "Seller payout hold (days)", value: String(payoutHoldDays), onChange: (e) => setPayoutHoldDays(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Minimum payout amount (\u20B9)", value: String(minPayoutAmount), onChange: (e) => setMinPayoutAmount(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Auction listing fee (\u20B9)", value: String(auctionListingFee), onChange: (e) => setAuctionListingFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Pre-order listing fee (\u20B9)", value: String(preOrderListingFee), onChange: (e) => setPreOrderListingFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Featured slot fee (\u20B9)", value: String(featuredSlotFee), onChange: (e) => setFeaturedSlotFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Promoted slot fee (\u20B9)", value: String(promotedSlotFee), onChange: (e) => setPromotedSlotFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "COD deposit (%)", helperText: "% of order collected upfront on COD orders; remainder paid on delivery.", value: String(codDepositPercent), onChange: (e) => setCodDepositPercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1 })] }), _jsx(Toggle, { checked: whatsappNotifyFeeEnabled, onChange: setWhatsappNotifyFeeEnabled, label: "Offer the WhatsApp order-updates addon at checkout" }), _jsx(Grid, { cols: 2, gap: "md", children: _jsx(Input, { label: "WhatsApp addon fee (\u20B9)", helperText: "Flat fee charged to the buyer when they opt in. Requires WhatsApp credentials + at least one approved template \u2014 see the WhatsApp tab.", value: String(whatsappNotifyFee), onChange: (e) => setWhatsappNotifyFee(parseFloat(e.target.value) || 0), type: "number", min: 0, disabled: !whatsappNotifyFeeEnabled }) }), _jsx(Toggle, { checked: giftWrapFeeEnabled, onChange: setGiftWrapFeeEnabled, label: "Offer the gift-wrap addon at checkout" }), _jsx(Grid, { cols: 2, gap: "md", children: _jsx(Input, { label: "Gift wrap fee (\u20B9)", helperText: "Flat fee charged to the buyer when they opt in.", value: String(giftWrapFee), onChange: (e) => setGiftWrapFee(parseFloat(e.target.value) || 0), type: "number", min: 0, disabled: !giftWrapFeeEnabled }) }), _jsx(Toggle, { checked: shipmentProtectionFeeEnabled, onChange: setShipmentProtectionFeeEnabled, label: "Offer the shipment-protection addon at checkout" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Shipment protection (%)", helperText: "% of order subtotal, charged when the buyer opts in.", value: String(shipmentProtectionFeePercent), onChange: (e) => setShipmentProtectionFeePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1, disabled: !shipmentProtectionFeeEnabled }), _jsx(Input, { label: "Shipment protection minimum (\u20B9)", helperText: "Floor for the shipment-protection fee.", value: String(shipmentProtectionFeeMin), onChange: (e) => setShipmentProtectionFeeMin(parseFloat(e.target.value) || 0), type: "number", min: 0, disabled: !shipmentProtectionFeeEnabled })] })] }) }), _jsx(TabsContent, { value: "procurement", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Used to compute each procurement shipment's labor cost (hours spent \u00D7 hourly rate) and its estimated processing time (hours spent \u00F7 max hours/day)." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Hourly rate (\u20B9)", helperText: "Your effective hourly wage for sorting/categorizing/listing a shipment.", value: String(laborHourlyRate), onChange: (e) => setLaborHourlyRate(Math.round((parseFloat(e.target.value) || 0) * 100) / 100), type: "number", min: 0 }), _jsx(Input, { label: "Max hours per day", helperText: "Used only to project how many days a shipment's tracked hours will take.", value: String(laborMaxHoursPerDay), onChange: (e) => setLaborMaxHoursPerDay(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 24 })] })] }) }), _jsx(TabsContent, { value: "emi", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "A seller must also opt in via their own Payout Settings for EMI to appear at checkout on their items. See the \"How EMI Works\" public page for buyer-facing copy." }), _jsx(Toggle, { checked: emiEnabled, onChange: setEmiEnabled, label: "Enable EMI platform-wide" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Minimum order value (\u20B9)", helperText: "A seller's cart subtotal must exceed this for EMI to appear as an option.", value: String(emiMinOrderValue), onChange: (e) => setEmiMinOrderValue(Math.round((parseFloat(e.target.value) || 0) * 100) / 100), type: "number", min: 0 }), _jsx(Input, { label: "Tenure options (months, comma-separated)", helperText: "e.g. 2,3,4,5,6", value: emiTenureOptionsText, onChange: (e) => setEmiTenureOptionsText(e.target.value) }), _jsx(Input, { label: "Token / down-payment (%)", helperText: "Collected upfront at checkout.", value: String(emiTokenPercent), onChange: (e) => setEmiTokenPercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100 }), _jsx(Input, { label: "Billing day (1\u201310)", helperText: "Day of month each installment is due.", value: String(emiBillingDay), onChange: (e) => setEmiBillingDay(parseFloat(e.target.value) || 1), type: "number", min: 1, max: 10 }), _jsx(Input, { label: "Surcharge (% of principal per month)", helperText: "The 'excess EMI fee' the buyer pays for spreading payment.", value: String(emiSurchargePercentPerMonth), onChange: (e) => setEmiSurchargePercentPerMonth(parseFloat(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Seller's share of surcharge (%)", helperText: "The rest of the surcharge goes to the platform.", value: String(emiSurchargeSellerSharePercent), onChange: (e) => setEmiSurchargeSellerSharePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100 })] })] }) }), _jsx(TabsContent, { value: "gst", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Required before enabling GST-inclusive checkout (P-8). Also set a GST rate + HSN code on each taxable product for the tax breakdown to appear." }), _jsx(Toggle, { checked: gstEnabled, onChange: setGstEnabled, label: "Enable GST on checkout" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "GSTIN", helperText: "15-character GST Identification Number.", value: gstin, onChange: (e) => setGstin(e.target.value), placeholder: "29AAAAA0000A1Z5", maxLength: 15 }), _jsx(Input, { label: "Legal name", helperText: "Registered business name for invoices.", value: gstLegalName, onChange: (e) => setGstLegalName(e.target.value), placeholder: "LetItRip Collectibles Pvt Ltd" })] }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "semibold", children: "Registered address" }), _jsx(Textarea, { value: gstAddress, onChange: (e) => setGstAddress(e.target.value), placeholder: "Registered business address for GST invoices\u2026", rows: 3 })] })] }) }), _jsx(TabsContent, { value: "featureflags", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "lg", children: [_jsx(Text, { size: "xs", color: "muted", children: "Site-wide platform feature toggles. Disabling a flag hides that feature's nav entries and pages \u2014 existing data is untouched, it just becomes unreachable until re-enabled." }), _jsx(Grid, { cols: 2, gap: "md", children: FEATURE_FLAG_META.map((flag) => (_jsxs(Stack, { gap: "xs", children: [_jsx(Toggle, { label: `${flag.icon} ${flag.labelKey}`, checked: featureFlags[flag.key] ?? false, onChange: (v) => setFeatureFlags((prev) => ({ ...prev, [flag.key]: v })) }), _jsx(Text, { size: "xs", color: "muted", children: flag.descKey })] }, flag.key))) }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "semibold", children: "Listing types" }), _jsx(Text, { size: "xs", color: "muted", children: "Disabled types are hidden from listings and reject create/add-to-cart." }), _jsx(Grid, { cols: 2, gap: "sm", children: LISTING_TYPE_KEYS.map((key) => (_jsx(Toggle, { label: key, checked: listingTypeFlags[key] ?? true, onChange: (v) => setListingTypeFlags((prev) => ({ ...prev, [key]: v })) }, key))) })] }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "semibold", children: "Category types" }), _jsx(Grid, { cols: 2, gap: "sm", children: CATEGORY_TYPE_KEYS.map((key) => (_jsx(Toggle, { label: key, checked: categoryTypeFlags[key] ?? true, onChange: (v) => setCategoryTypeFlags((prev) => ({ ...prev, [key]: v })) }, key))) })] })] }) }), _jsx(TabsContent, { value: "integrations", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Keys are masked in transit and stored encrypted. Click Reveal to view." }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Razorpay" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Razorpay Key ID", value: razorpayKeyId, onChange: setRazorpayKeyId, placeholder: "rzp_live_\u2026" }), _jsx(MaskedInput, { label: "Razorpay Secret", value: razorpaySecret, onChange: setRazorpaySecret, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "SMTP / Email" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "SMTP host", value: smtpHost, onChange: (e) => setSmtpHost(e.target.value), placeholder: "smtp.sendgrid.net" }), _jsx(Input, { label: "SMTP port", value: smtpPort, onChange: (e) => setSmtpPort(e.target.value), type: "number", placeholder: "587" }), _jsx(Input, { label: "SMTP user", value: smtpUser, onChange: (e) => setSmtpUser(e.target.value), placeholder: "apikey" }), _jsx(MaskedInput, { label: "SMTP password", value: smtpPassword, onChange: setSmtpPassword, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] }), _jsx(Input, { label: "From address", value: smtpFrom, onChange: (e) => setSmtpFrom(e.target.value), placeholder: "noreply@letitrip.in", type: "email" })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Analytics & Tracking" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Google Analytics ID", value: gaMeasurementId, onChange: (e) => setGaMeasurementId(e.target.value), placeholder: "G-XXXXXXXXXX" }), _jsx(Input, { label: "Facebook Pixel ID", value: fbPixelId, onChange: (e) => setFbPixelId(e.target.value), placeholder: "XXXXXXXXXXXXXXXX" }), _jsx(Input, { label: "GTM Container ID", value: gtmContainerId, onChange: (e) => setGtmContainerId(e.target.value), placeholder: "GTM-XXXXXXX" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Meta (Instagram & Facebook Social Feed)" }), _jsx(Text, { size: "xs", color: "muted", children: "Used by the Social Feed section to fetch Instagram and Facebook posts via Meta Graph API v19." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Page Access Token", value: metaPageAccessToken, onChange: setMetaPageAccessToken, placeholder: "EAAxxxxxxx\u2026" }), _jsx(Input, { label: "Page ID (or handle)", value: metaPageId, onChange: (e) => setMetaPageId(e.target.value), placeholder: "letitrip" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "TikTok for Developers (Social Feed)" }), _jsx(Text, { size: "xs", color: "muted", children: "Client credentials + long-lived access token from TikTok for Developers. Used to list your account's public videos." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Client Key", value: tiktokClientKey, onChange: setTiktokClientKey, placeholder: "aw\u2026" }), _jsx(MaskedInput, { label: "Client Secret", value: tiktokClientSecret, onChange: setTiktokClientSecret, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" }), _jsx(MaskedInput, { label: "Access Token (long-lived)", value: tiktokAccessToken, onChange: setTiktokAccessToken, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "DeviantArt OAuth2 (Social Feed)" }), _jsx(Text, { size: "xs", color: "muted", children: "Client credentials for DeviantArt gallery fetching (client-credentials OAuth2 flow \u2014 no user login required)." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Client ID", value: deviantartClientId, onChange: setDeviantartClientId, placeholder: "1234" }), _jsx(MaskedInput, { label: "Client Secret", value: deviantartClientSecret, onChange: setDeviantartClientSecret, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] })] })] }) }), _jsx(TabsContent, { value: "shipping", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Payment methods" }), _jsx(Toggle, { label: "Razorpay (online card/UPI) enabled \u2014 disabled by default, manual payment is the default", checked: razorpayEnabled, onChange: setRazorpayEnabled }), _jsx(Toggle, { label: "Manual UPI/bank transfer enabled", checked: upiManualEnabled, onChange: setUpiManualEnabled }), _jsx(Toggle, { label: "Cash on delivery (COD) enabled", checked: codEnabled, onChange: setCodEnabled }), _jsx(Input, { label: "Free shipping threshold (\u20B9)", value: String(freeShippingThreshold), onChange: (e) => setFreeShippingThreshold(parseInt(e.target.value) || 0), type: "number", min: 0, helperText: "Orders above this amount get free shipping." }), _jsx(Select, { label: "Default carrier", options: CARRIER_OPTIONS, value: defaultCarrier, onValueChange: setDefaultCarrier }), _jsx(Input, { label: "Max delivery radius (km, 0 = no limit)", value: String(maxDeliveryRadius), onChange: (e) => setMaxDeliveryRadius(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "High-value checkout OTP threshold (\u20B9)", helperText: "Carts at or above this subtotal require an extra OTP verification step before payment (0 = disabled).", value: String(otpCheckoutThreshold), onChange: (e) => setOtpCheckoutThreshold(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Text, { size: "sm", weight: "medium", color: "muted", className: "pt-[var(--appkit-space-2)]", children: "Seller shipping charge defaults" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Seller shipping fixed (\u20B9)", helperText: "Flat shipping charge collected on the seller's behalf.", value: String(sellerShippingFixed), onChange: (e) => setSellerShippingFixed(parseFloat(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Platform shipping (%)", helperText: "Platform's own shipping markup, as a % of order value.", value: String(platformShippingPercent), onChange: (e) => setPlatformShippingPercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1 }), _jsx(Input, { label: "Platform shipping minimum (\u20B9)", helperText: "Floor for the platform shipping markup.", value: String(platformShippingFixedMin), onChange: (e) => setPlatformShippingFixedMin(parseFloat(e.target.value) || 0), type: "number", min: 0 })] })] }) }), _jsx(TabsContent, { value: "auction", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsxs(Stack, { gap: "sm", rounded: "lg", border: "default", padding: "sm", children: [_jsx(Text, { size: "xs", weight: "medium", color: "muted", children: "Bid increment tiers" }), _jsx(Text, { size: "xs", color: "muted", children: "The minimum jump a new bid must clear, based on the current bid amount. A seller's per-listing override can require more than the matching tier, but can never undercut it." }), bidIncrementTiers.map((tier, i) => {
672
674
  const isLast = i === bidIncrementTiers.length - 1;
673
675
  return (_jsxs(Grid, { align: "end", gap: "xs", className: "grid-cols-12", children: [_jsx(Div, { className: "col-span-5", children: isLast ? (_jsxs(_Fragment, { children: [_jsx(Text, { size: "xs", weight: "medium", className: "mb-1", children: "Up to (\u20B9)" }), _jsx(Text, { size: "sm", color: "muted", children: "and above" })] })) : (_jsx(Input, { label: "Up to (\u20B9)", type: "number", min: 1, value: String(tier.upTo ?? ""), onChange: (e) => setBidIncrementTiers(bidIncrementTiers.map((t, j) => j === i ? { ...t, upTo: parseInt(e.target.value) || 0 } : t)) })) }), _jsx(Div, { className: "col-span-5", children: _jsx(Input, { label: "Increment (\u20B9)", type: "number", min: 1, value: String(tier.increment), onChange: (e) => setBidIncrementTiers(bidIncrementTiers.map((t, j) => j === i ? { ...t, increment: parseInt(e.target.value) || 0 } : t)) }) }), _jsx(Row, { centered: true, className: "col-span-2", padding: "b-xs", children: _jsx(Button, { variant: "ghost", type: "button", disabled: bidIncrementTiers.length <= 1, onClick: () => setBidIncrementTiers(bidIncrementTiers.filter((_, j) => j !== i)), "aria-label": "Remove tier", children: "\u00D7" }) })] }, i));
674
676
  }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setBidIncrementTiers([
@@ -1,3 +1,12 @@
1
+ /**
2
+ * AdminStickersView — admin browse of stickers listings.
3
+ *
4
+ * A thin wrapper over the shared per-listing-type config. This file (and its
5
+ * four siblings) used to carry a full hand-written ListingViewConfig; all five
6
+ * were the same config with a different listingType, and all five shipped
7
+ * an empty filterKeys array — no filter drawer at all — plus their own copy
8
+ * of a three-option sort array. See listing-type-listing-config.ts.
9
+ */
1
10
  import React from "react";
2
11
  import type { ListingLayoutProps } from "../../../ui";
3
12
  export type AdminStickersViewProps = ListingLayoutProps;
@@ -1,50 +1,26 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  /**
4
- * AdminStickersView — admin browse of sticker listings (EMI/art-stickers session).
5
- * Mirrors AdminClassifiedView's thin config-driven pattern.
4
+ * AdminStickersView — admin browse of stickers listings.
5
+ *
6
+ * A thin wrapper over the shared per-listing-type config. This file (and its
7
+ * four siblings) used to carry a full hand-written ListingViewConfig; all five
8
+ * were the same config with a different listingType, and all five shipped
9
+ * an empty filterKeys array — no filter drawer at all — plus their own copy
10
+ * of a three-option sort array. See listing-type-listing-config.ts.
6
11
  */
7
- import { sortBy } from "@mohasinac/appkit/client";
8
12
  import React from "react";
9
13
  import { ListingLayout } from "../../../ui";
10
- import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
11
- import { toRecordArray, toRelativeDate, toCurrency, toStringValue, } from "../hooks/useAdminListingData";
14
+ import { buildListingTypeListingConfig } from "../../products/config/listing-type-listing-config";
12
15
  import { DataListingView } from "./DataListingView";
13
- import { ROUTES } from "../../../next/routing/route-map";
14
- const ADMIN_STICKERS_CONFIG = {
15
- portal: "admin",
16
+ const CONFIG = buildListingTypeListingConfig("stickers", {
16
17
  title: "Stickers",
17
18
  searchPlaceholder: "Search stickers by name or seller",
18
19
  emptyLabel: "No sticker listings",
19
- filterKeys: [],
20
- defaultSort: sortBy("createdAt", "DESC"),
21
- queryKey: ["admin", "stickers", "listing"],
22
- endpoint: ADMIN_ENDPOINTS.PRODUCTS,
23
- sortOptions: [
24
- { value: sortBy("createdAt", "DESC"), label: "Newest" },
25
- { value: sortBy("createdAt", "ASC"), label: "Oldest" },
26
- { value: "title", label: "Title A–Z" },
27
- ],
28
- mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
29
- id: toStringValue(item.id, `stickers-${index}`),
30
- primary: toStringValue(item.title ?? item.productTitle, "Untitled sticker listing"),
31
- secondary: [
32
- toStringValue(item.sellerName, "Unknown seller"),
33
- toCurrency(item.price),
34
- ].join(" · "),
35
- status: toStringValue(item.status, "draft"),
36
- updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
37
- image: toStringValue(item.mainImage, "") || undefined,
38
- })),
39
- getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
40
- buildFilters: () => "listingType==stickers",
41
- // Sticker listings are products (filtered by listingType) — reuse the
42
- // real admin product edit page rather than leaving rows non-navigable.
43
- rowHrefTemplate: String(ROUTES.ADMIN.PRODUCTS_EDIT("{id}")),
44
- };
20
+ });
45
21
  export function AdminStickersView({ children, ...props }) {
46
22
  if (React.Children.count(children) > 0) {
47
23
  return (_jsx(ListingLayout, { portal: "admin", ...props, children: children }));
48
24
  }
49
- return _jsx(DataListingView, { config: ADMIN_STICKERS_CONFIG });
25
+ return _jsx(DataListingView, { config: CONFIG });
50
26
  }
@@ -40,11 +40,16 @@ export function useAdminListing(config) {
40
40
  }, [filterKeys]);
41
41
  const resetAll = useCallback(() => {
42
42
  const updates = { q: "", sort: "" };
43
+ // Restore each key to its CONFIGURED default, not to "". A view using
44
+ // `filterDefaults` (e.g. hide-inactive on first load) would otherwise have
45
+ // "Reset" land somewhere the user could never get back to by reloading —
46
+ // reset showed MORE rows than a fresh visit, which reads as a bug in the
47
+ // filter rather than in the reset.
43
48
  for (const k of filterKeys)
44
- updates[k] = "";
49
+ updates[k] = filterDefaults?.[k] ?? "";
45
50
  table.setMany(updates);
46
51
  setSearchInput("");
47
- }, [filterKeys, table]);
52
+ }, [filterKeys, filterDefaults, table]);
48
53
  const commitSearch = useCallback(() => {
49
54
  table.set("q", searchInput.trim());
50
55
  }, [searchInput, table]);
@@ -342,6 +342,11 @@ export interface SiteSettingsDocument extends BaseDocument {
342
342
  gstPercent: number;
343
343
  /** Per-transaction gateway minimum fee in rupees. Ensures total charge is never below this floor. 0 = no minimum. */
344
344
  minimumTransactionFee: number;
345
+ /**
346
+ * Rupee ceiling on the buyer-facing platform commission. Charged on every
347
+ * payment method (COD/UPI-manual/cash/EMI/Razorpay), once per checkout.
348
+ * Optional so pre-existing documents keep working — falls back to ₹10.
349
+ */ platformFeeMax?: number;
345
350
  /** Razorpay gateway cost % (absorbed by platform, not passed through separately). */
346
351
  gatewayFeePercent: number;
347
352
  codDepositPercent: number;
@@ -186,6 +186,7 @@ export const DEFAULT_SITE_SETTINGS_DATA = {
186
186
  platformFeePercent: 5,
187
187
  gstPercent: 18,
188
188
  minimumTransactionFee: 0,
189
+ platformFeeMax: 10,
189
190
  gatewayFeePercent: 2,
190
191
  codDepositPercent: 10,
191
192
  codHandlingFeeMin: 200,
@@ -17,19 +17,21 @@ import { storeRepository } from "../../stores/repository/store.repository";
17
17
  import { siteSettingsRepository } from "../../../repositories";
18
18
  import { getAdminRealtimeDb } from "../../../providers/db-firebase";
19
19
  import { maskPublicBid } from "../../../security";
20
- import { resolveMinBidIncrement } from "../../../_internal/shared/features/auctions/config";
20
+ import { resolveMinBid, resolveMinBidIncrement } from "../../../_internal/shared/features/auctions/config";
21
+ import { sendNotification } from "../../admin/actions/notification-actions";
22
+ import { BID_MESSAGES } from "../../../_internal/server/jobs/handlers/messages";
21
23
  import { ERROR_MESSAGES, AuthorizationError, ValidationError, NotFoundError, } from "../../../errors";
22
24
  import { BID_ERROR_CODES } from "../../../errors/error-codes";
23
25
  import { increment } from "../../../contracts/field-ops";
24
26
  import { getDefaultCurrency } from "../../../core/baseline-resolver";
25
27
  import { cartRepository } from "../../cart/repository/cart.repository";
26
28
  import { ROUTES } from "../../../next/routing/route-map";
27
- import { CART_LANE } from "../../../_internal/shared/checkout/lanes";
29
+ import { CART_LANE, LANE_CHECKOUT_WINDOW_MS } from "../../../_internal/shared/checkout/lanes";
28
30
  /**
29
31
  * Buy-Now and auction settlement give the buyer the same 48h window to pay for
30
32
  * a locked line. Kept identical on purpose — both are "you now owe this".
31
33
  */
32
- const AUCTION_CHECKOUT_WINDOW_MS = 48 * 60 * 60 * 1000;
34
+ const AUCTION_CHECKOUT_WINDOW_MS = LANE_CHECKOUT_WINDOW_MS.auction;
33
35
  import { resolveDate } from "../../../utils";
34
36
  // --- Domain Functions ----------------------------------------------------------
35
37
  export async function placeBid(userId, userEmail, input) {
@@ -54,22 +56,38 @@ export async function placeBid(userId, userEmail, input) {
54
56
  throw new AuthorizationError(ERROR_MESSAGES.BID.OWN_AUCTION);
55
57
  }
56
58
  }
57
- const baseBid = (product.currentBid ?? 0) > 0
58
- ? product.currentBid
59
+ // An auction with no bids yet prices off its starting bid, and that starting
60
+ // bid is itself acceptable — see ResolveMinBidOptions.hasBids.
61
+ const hasBids = (product.currentBid ?? 0) > 0 || (product.bidCount ?? 0) > 0;
62
+ const baseBid = hasBids
63
+ ? (product.currentBid ?? product.startingBid ?? product.price)
59
64
  : (product.startingBid ?? product.price);
60
65
  const settings = await siteSettingsRepository.getSingleton();
61
- const minIncrement = resolveMinBidIncrement(baseBid, settings.auctionConfig?.bidIncrementTiers ?? [], product.minBidIncrement);
66
+ const tiers = settings.auctionConfig?.bidIncrementTiers ?? [];
67
+ const minIncrement = resolveMinBidIncrement(baseBid, tiers, product.minBidIncrement);
68
+ // Identical derivation to the bid form's, via the one shared helper — the
69
+ // form seeds `resolveMinBid(...)` and this rejects below it, so the two can
70
+ // never disagree about what the auction will accept.
71
+ const minAcceptableBid = resolveMinBid(baseBid, tiers, product.minBidIncrement, { hasBids });
62
72
  // Proxy-bid semantics (eBay style): the buyer's `bidAmount` is treated as
63
73
  // their **maximum** they're willing to pay; the visible price only steps up
64
74
  // in `minIncrement` units as needed to stay ahead of the previous high bid.
65
75
  // If `autoMaxBid` is supplied explicitly it takes precedence over bidAmount
66
76
  // as the cap (lets clients separate desired-step from secret-cap).
67
77
  const newCap = Math.max(bidAmount, autoMaxBid ?? bidAmount);
68
- if (newCap <= baseBid) {
69
- throw new ValidationError(ERROR_MESSAGES.BID.BID_TOO_LOW, { code: BID_ERROR_CODES.TOO_LOW });
70
- }
71
- if (newCap < baseBid + minIncrement) {
72
- throw new ValidationError(ERROR_MESSAGES.BID.INCREMENT_TOO_LOW, { code: BID_ERROR_CODES.INCREMENT_VIOLATED });
78
+ if (newCap < minAcceptableBid) {
79
+ // Both rejections stay distinguishable: "below the standing price" and
80
+ // "above it but short of the increment" are different mistakes and the
81
+ // form maps their codes to different copy. With no bids yet only the
82
+ // former is reachable, since the minimum IS the starting bid.
83
+ const isIncrementViolation = hasBids && newCap > baseBid;
84
+ throw new ValidationError(isIncrementViolation
85
+ ? ERROR_MESSAGES.BID.INCREMENT_TOO_LOW
86
+ : ERROR_MESSAGES.BID.BID_TOO_LOW, {
87
+ code: isIncrementViolation
88
+ ? BID_ERROR_CODES.INCREMENT_VIOLATED
89
+ : BID_ERROR_CODES.TOO_LOW,
90
+ });
73
91
  }
74
92
  const previousWinner = await bidRepository
75
93
  .getWinningBid(productId)
@@ -89,6 +107,14 @@ export async function placeBid(userId, userEmail, input) {
89
107
  newBidWins = true;
90
108
  visibleBid = prevVisible;
91
109
  }
110
+ else if (!hasBids) {
111
+ // Opening bid: the price displays at the seller's starting bid, not at
112
+ // `startingBid + increment`, because there is nobody to outpace yet. Under
113
+ // proxy semantics the submission is a maximum, so without this an opening
114
+ // max of ₹500 on a ₹100 auction would be recorded at ₹200 for no reason.
115
+ newBidWins = true;
116
+ visibleBid = baseBid;
117
+ }
92
118
  else if (!previousWinner || newCap > prevCap) {
93
119
  newBidWins = true;
94
120
  const target = Math.max(prevCap + minIncrement, baseBid + minIncrement);
@@ -162,6 +188,41 @@ export async function placeBid(userId, userEmail, input) {
162
188
  productId,
163
189
  });
164
190
  }
191
+ // Outbid notification.
192
+ //
193
+ // This used to live in the `onBidPlaced` Firestore trigger, which derived the
194
+ // outbid user by re-reading `getWinningBid()` AFTER the fact. That read raced
195
+ // the batch above (the bid doc is created before the batch commits, so the
196
+ // trigger could observe either side of it) and so notified the wrong user, or
197
+ // nobody, non-deterministically. Here the outcome is already known exactly:
198
+ // `previousWinner` plus `newBidWins` say who lost the lead and who kept it.
199
+ //
200
+ // Best-effort, like the RTDB mirror above — a failed notification must never
201
+ // fail a bid that has already been committed.
202
+ const outbidUserId = newBidWins && previousWinner && previousWinner.data.userId !== userId
203
+ ? previousWinner.data.userId
204
+ : null;
205
+ if (outbidUserId) {
206
+ try {
207
+ await sendNotification({
208
+ userId: outbidUserId,
209
+ type: "bid_outbid",
210
+ priority: "high",
211
+ title: BID_MESSAGES.OUTBID_TITLE,
212
+ message: BID_MESSAGES.OUTBID_MESSAGE(product.title, product.currency || getDefaultCurrency(), finalVisibleForRtdb),
213
+ relatedId: productId,
214
+ relatedType: "product",
215
+ });
216
+ }
217
+ catch (notifyErr) {
218
+ void normalizeError(notifyErr);
219
+ serverLogger.warn("placeBid: outbid notification failed", {
220
+ error: notifyErr,
221
+ productId,
222
+ outbidUserId,
223
+ });
224
+ }
225
+ }
165
226
  serverLogger.info("placeBid", {
166
227
  bidId: bid.id,
167
228
  productId,
@@ -169,6 +230,7 @@ export async function placeBid(userId, userEmail, input) {
169
230
  bidAmount: visibleBid,
170
231
  maxProxyBid: newCap,
171
232
  winning: newBidWins,
233
+ outbidUserId,
172
234
  });
173
235
  return { bid };
174
236
  }
@@ -15,7 +15,7 @@ import { formatCurrency } from "../../../utils/number.formatter";
15
15
  import { normalizeRichTextHtml } from "../../../utils/string.formatter";
16
16
  import { safeDisplayName } from "../../../security";
17
17
  import { getSiteSettingsGlobal } from "../../admin/utils/getSiteSettingsGlobal";
18
- import { resolveMinBidIncrement, } from "../../../_internal/shared/features/auctions/config";
18
+ import { resolveMinBid, resolveMinBidIncrement, } from "../../../_internal/shared/features/auctions/config";
19
19
  import { Button, Container, CountdownDisplay, Div, Heading, Input, Main, Nav, RichText, Row, Section, Span, Stack, Text, Ul, Li, Dl, Dt, Dd, } from "../../../ui";
20
20
  import { AuctionDetailView } from "../../products/components/AuctionDetailView";
21
21
  import { ProductTabsShell } from "../../products/components/ProductTabsShell";
@@ -133,6 +133,12 @@ export async function AuctionDetailPageView({ id, initialAuction, onPlaceBid, on
133
133
  ]);
134
134
  const bidIncrementTiers = siteSettings.auctionConfig?.bidIncrementTiers ?? [];
135
135
  const initialMinBidIncrement = resolveMinBidIncrement(currentBid, bidIncrementTiers, minBidIncrementOverride);
136
+ // Mirrors placeBid's own hasBids — with no bids the starting bid is itself
137
+ // the minimum, so this preview must not advertise startingBid + increment.
138
+ const initialHasBids = bidCount > 0 || currentBid > startingBid;
139
+ const initialMinBid = resolveMinBid(currentBid, bidIncrementTiers, minBidIncrementOverride, {
140
+ hasBids: initialHasBids,
141
+ });
136
142
  return (_jsxs(Main, { children: [_jsx(HistoryTracker, { productId: String(p.id ?? p.slug ?? ""), productType: "auction", snapshot: {
137
143
  title: typeof p.title === "string" ? p.title : undefined,
138
144
  thumb: typeof p.mainImage === "string"
@@ -145,7 +151,7 @@ export async function AuctionDetailPageView({ id, initialAuction, onPlaceBid, on
145
151
  storeName: typeof p.storeName === "string" ? p.storeName : undefined,
146
152
  } }), _jsxs(Container, { size: "xl", padding: "y-lg", children: [_jsxs(Row, { className: "mb-4", align: "center", justify: "between", gap: "sm", wrap: true, children: [_jsxs(Nav, { "aria-label": "Breadcrumb", layout: "flex-wrap", gap: "2xs", textSize: "xs", color: "muted", children: [_jsx(Link, { href: String(ROUTES.HOME), className: CLS_BREADCRUMB_LINK, children: "Home" }), _jsx(Span, { "aria-hidden": true, children: "/" }), _jsx(Link, { href: String(ROUTES.PUBLIC.AUCTIONS), className: CLS_BREADCRUMB_LINK, children: "Auctions" }), category && (_jsxs(_Fragment, { children: [_jsx(Span, { "aria-hidden": true, children: "/" }), _jsx(Link, { href: String(ROUTES.PUBLIC.CATEGORY_DETAIL(category)), className: CLS_BREADCRUMB_LINK, children: categoryName || category })] })), _jsx(Span, { "aria-hidden": true, children: "/" }), _jsx(Span, { className: "truncate max-w-[200px]", color: "muted", children: title })] }), _jsx(ShareButton, { title: title })] }), _jsx(AuctionDetailView, { renderGallery: () => (_jsx(ProductGalleryClient, { images: images, video: productVideo, productName: title })), renderInfo: () => renderAuctionInfoPanel({ productId: String(product.id), title, currentBid, currency, bidCount, isEnded, endDate, buyNowPrice, featured, freeShipping, condition, category, categoryName, brand, brandSlug, productFeatures, features, descriptionHtml, safeSeller, storeHref }), renderBidForm: () => onPlaceBid ? (_jsx(Stack, { id: "auction-bid-form", gap: "3", children: _jsxs(Stack, { className: `${__P.p5}`, border: "subtle", gap: "3", rounded: "xl", surface: "muted", children: [_jsxs(Row, { justify: "between", align: "baseline", children: [_jsx(LiveBidPrice, { productId: String(product.id), currentBid: currentBid, bidCount: bidCount, currency: currency, isEnded: isEnded, priceSize: "xl", badgeSize: "xs" }), !isEnded && (_jsx(LiveMinIncrement, { productId: String(product.id), currentBid: currentBid, bidCount: bidCount, currency: currency, isEnded: isEnded, tiers: bidIncrementTiers, minBidIncrementOverride: minBidIncrementOverride }))] }), !isEnded && endDate && (_jsxs(Text, { align: "center", size: "xs", color: "muted", children: ["Ends in ", _jsx(CountdownDisplay, { targetDate: endDate, format: "auto", expiredLabel: "Ended" })] })), _jsx(PlaceBidModalButton, { productId: String(product.id), currentBid: currentBid, startingBid: startingBid, tiers: bidIncrementTiers, minBidIncrementOverride: minBidIncrementOverride, currency: currency, isEnded: isEnded, auctionEndDate: endDate, buyNowPrice: buyNowPrice, bidsHaveStarted: bidsHaveStarted, bidCount: bidCount, tags: tags, onPlaceBid: onPlaceBid, onBuyNow: onBuyNow, triggerClassName: "w-full" })] }) })) : (
147
153
  /* Read-only bid panel — shown when no bid action is wired (preview/demo) */
148
- _jsxs(Stack, { className: `${__P.p5}`, border: "subtle", gap: "md", rounded: "xl", surface: "muted", children: [_jsx(Stack, { gap: "xs", children: _jsxs(Text, { size: "xs", color: "muted", children: ["Starting bid: ", formatCurrency(startingBid, currency), !isEnded && _jsxs(_Fragment, { children: [" \u00B7 min increment ", formatCurrency(initialMinBidIncrement, currency)] })] }) }), _jsxs(Stack, { gap: "sm", children: [_jsx(Input, { type: "number", placeholder: `At least ${formatCurrency(currentBid + initialMinBidIncrement, currency)}`, min: currentBid + initialMinBidIncrement, "aria-label": "Your bid amount", disabled: isEnded }), !isEnded && endDate && (_jsxs(Text, { align: "center", size: "xs", color: "muted", children: ["Ends in ", _jsx(CountdownDisplay, { targetDate: endDate, format: "auto", expiredLabel: "Ended" })] })), _jsx(Button, { variant: "primary", size: "md", className: "w-full", disabled: isEnded, children: isEnded ? "Auction Ended" : "Place Bid" }), buyNowPrice !== null && !isEnded && !bidsHaveStarted && (_jsxs(Button, { variant: "secondary", size: "md", className: "w-full", disabled: true, children: ["Buy Now \u2014 ", formatCurrency(buyNowPrice, currency)] }))] }), tags.length > 0 && (_jsx(Div, { border: "default", className: "border-t", padding: "t-md", children: _jsx(Row, { wrap: true, gap: "xs", children: tags.map((tag) => (_jsx(Span, { size: "xs", rounded: "full", padding: "pill-sm-tall", surface: "subtle", color: "muted", children: tag }, tag))) }) }))] })), renderMobileBidForm: () => !isEnded && onPlaceBid ? (_jsxs(Stack, { className: `lg:hidden ${__P.p4}`, border: "subtle", gap: "3", rounded: "xl", surface: "muted", children: [_jsx(LiveBidPrice, { productId: String(product.id), currentBid: currentBid, bidCount: bidCount, currency: currency, isEnded: isEnded, priceSize: "base", badgeSize: "xs" }), endDate && (_jsxs(Text, { align: "center", size: "xs", color: "muted", children: ["Ends in ", _jsx(CountdownDisplay, { targetDate: endDate, format: "auto", expiredLabel: "Ended" })] })), _jsx(PlaceBidModalButton, { productId: String(product.id), currentBid: currentBid, startingBid: startingBid, tiers: bidIncrementTiers, minBidIncrementOverride: minBidIncrementOverride, currency: currency, isEnded: isEnded, auctionEndDate: endDate, buyNowPrice: buyNowPrice, bidsHaveStarted: bidsHaveStarted, bidCount: bidCount, tags: tags, onPlaceBid: onPlaceBid, onBuyNow: onBuyNow, triggerClassName: "w-full" })] })) : !isEnded ? (_jsxs(Div, { className: `${__P.p4} lg:hidden`, border: "subtle", rounded: "xl", surface: "muted", children: [_jsxs(Row, { align: "center", gap: "sm", className: "mb-3", children: [_jsx(Span, { size: "base", weight: "bold", className: "text-primary-600 dark:text-primary-400", children: formatCurrency(currentBid, currency) }), _jsxs(Span, { size: "xs", color: "muted", children: [bidCount, " bids"] })] }), endDate && (_jsxs(Text, { align: "center", className: "mb-3", size: "xs", color: "muted", children: ["Ends in ", _jsx(CountdownDisplay, { targetDate: endDate, format: "auto", expiredLabel: "Ended" })] })), _jsx(Button, { variant: "primary", size: "md", className: "w-full", children: "Place Bid" })] })) : null, renderSublistingSection: sublistingCategoryId
154
+ _jsxs(Stack, { className: `${__P.p5}`, border: "subtle", gap: "md", rounded: "xl", surface: "muted", children: [_jsx(Stack, { gap: "xs", children: _jsxs(Text, { size: "xs", color: "muted", children: ["Starting bid: ", formatCurrency(startingBid, currency), !isEnded && _jsxs(_Fragment, { children: [" \u00B7 min increment ", formatCurrency(initialMinBidIncrement, currency)] })] }) }), _jsxs(Stack, { gap: "sm", children: [_jsx(Input, { type: "number", placeholder: `At least ${formatCurrency(initialMinBid, currency)}`, min: initialMinBid, "aria-label": "Your bid amount", disabled: isEnded }), !isEnded && endDate && (_jsxs(Text, { align: "center", size: "xs", color: "muted", children: ["Ends in ", _jsx(CountdownDisplay, { targetDate: endDate, format: "auto", expiredLabel: "Ended" })] })), _jsx(Button, { variant: "primary", size: "md", className: "w-full", disabled: isEnded, children: isEnded ? "Auction Ended" : "Place Bid" }), buyNowPrice !== null && !isEnded && !bidsHaveStarted && (_jsxs(Button, { variant: "secondary", size: "md", className: "w-full", disabled: true, children: ["Buy Now \u2014 ", formatCurrency(buyNowPrice, currency)] }))] }), tags.length > 0 && (_jsx(Div, { border: "default", className: "border-t", padding: "t-md", children: _jsx(Row, { wrap: true, gap: "xs", children: tags.map((tag) => (_jsx(Span, { size: "xs", rounded: "full", padding: "pill-sm-tall", surface: "subtle", color: "muted", children: tag }, tag))) }) }))] })), renderMobileBidForm: () => !isEnded && onPlaceBid ? (_jsxs(Stack, { className: `lg:hidden ${__P.p4}`, border: "subtle", gap: "3", rounded: "xl", surface: "muted", children: [_jsx(LiveBidPrice, { productId: String(product.id), currentBid: currentBid, bidCount: bidCount, currency: currency, isEnded: isEnded, priceSize: "base", badgeSize: "xs" }), endDate && (_jsxs(Text, { align: "center", size: "xs", color: "muted", children: ["Ends in ", _jsx(CountdownDisplay, { targetDate: endDate, format: "auto", expiredLabel: "Ended" })] })), _jsx(PlaceBidModalButton, { productId: String(product.id), currentBid: currentBid, startingBid: startingBid, tiers: bidIncrementTiers, minBidIncrementOverride: minBidIncrementOverride, currency: currency, isEnded: isEnded, auctionEndDate: endDate, buyNowPrice: buyNowPrice, bidsHaveStarted: bidsHaveStarted, bidCount: bidCount, tags: tags, onPlaceBid: onPlaceBid, onBuyNow: onBuyNow, triggerClassName: "w-full" })] })) : !isEnded ? (_jsxs(Div, { className: `${__P.p4} lg:hidden`, border: "subtle", rounded: "xl", surface: "muted", children: [_jsxs(Row, { align: "center", gap: "sm", className: "mb-3", children: [_jsx(Span, { size: "base", weight: "bold", className: "text-primary-600 dark:text-primary-400", children: formatCurrency(currentBid, currency) }), _jsxs(Span, { size: "xs", color: "muted", children: [bidCount, " bids"] })] }), endDate && (_jsxs(Text, { align: "center", className: "mb-3", size: "xs", color: "muted", children: ["Ends in ", _jsx(CountdownDisplay, { targetDate: endDate, format: "auto", expiredLabel: "Ended" })] })), _jsx(Button, { variant: "primary", size: "md", className: "w-full", children: "Place Bid" })] })) : null, renderSublistingSection: sublistingCategoryId
149
155
  ? () => (_jsx(SublistingCarouselSection, { sublistingCategoryId: sublistingCategoryId, currentListingId: String(product.id) }))
150
156
  : undefined, renderTabs: () => (_jsx(ProductTabsShell, { descriptionContent: descriptionHtml ? (_jsx(RichText, { html: descriptionHtml, proseClass: "prose prose-sm sm:prose max-w-none dark:prose-invert", className: "text-[var(--appkit-color-text-muted)]" })) : undefined, specsContent: specs.length > 0 ? (_jsx(Dl, { divide: "subtle", rounded: "xl", border: "subtle", className: "overflow-hidden", children: specs.map((s, i) => (_jsxs(Row, { gap: "md", oddEven: "zebra", surface: "default", padding: "inline", children: [_jsx(Dt, { className: "w-36 flex-shrink-0", color: "primary", weight: "medium", children: s.name }), _jsxs(Dd, { className: "flex-1", color: "muted", children: [s.value, s.unit ? ` ${s.unit}` : ""] })] }, i))) })) : undefined, customTabs: customSections.map((s) => ({
151
157
  id: s.id,
@@ -13,9 +13,9 @@ import { formatCurrency } from "../../../utils";
13
13
  import { getDefaultCurrency } from "../../../core/baseline-resolver";
14
14
  import { BaseListingCard, Button, Caption, Div, Row, Span, Stack, Text, TextLink } from "../../../ui";
15
15
  const CLS_STAR_ICON = "h-5 w-5 fill-warning text-warning";
16
- const CLS_LIVE_BADGE = "rounded-full bg-error-surface px-[var(--appkit-space-2)] py-[var(--appkit-space-0-5)] text-white";
17
- const CLS_ENDING_BADGE = "rounded-full bg-warning-surface px-[var(--appkit-space-2)] py-[var(--appkit-space-0-5)] text-white";
18
- const CLS_RESERVE_BADGE = "inline-flex items-center gap-[var(--appkit-space-1)] rounded-full bg-warning-surface px-[var(--appkit-space-2)] py-[var(--appkit-space-0-5)] text-white";
16
+ const CLS_LIVE_BADGE = "rounded-full bg-error-solid px-[var(--appkit-space-2)] py-[var(--appkit-space-0-5)] text-error-on-solid";
17
+ const CLS_ENDING_BADGE = "rounded-full bg-warning-solid px-[var(--appkit-space-2)] py-[var(--appkit-space-0-5)] text-warning-on-solid";
18
+ const CLS_RESERVE_BADGE = "inline-flex items-center gap-[var(--appkit-space-1)] rounded-full bg-warning-solid px-[var(--appkit-space-2)] py-[var(--appkit-space-0-5)] text-warning-on-solid";
19
19
  const CLS_HEART_ON = "fill-error text-error";
20
20
  const CLS_HEART_OFF = "text-zinc-400";
21
21
  function renderAuctionCardHero(props) {