@mohasinac/appkit 4.10.0 → 4.11.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.
- package/dist/_internal/client/features/layout/DashboardLayoutClient.d.ts +6 -1
- package/dist/_internal/client/features/layout/DashboardLayoutClient.js +4 -1
- package/dist/_internal/client/features/lottery/LotteryPullForm.d.ts +1 -1
- package/dist/_internal/client/features/lottery/LotteryPullForm.js +2 -2
- package/dist/_internal/server/features/admin/daily-digest-actions.d.ts +18 -0
- package/dist/_internal/server/features/admin/daily-digest-actions.js +37 -0
- package/dist/_internal/server/features/audit-log/actions.d.ts +25 -0
- package/dist/_internal/server/features/audit-log/actions.js +38 -0
- package/dist/_internal/server/features/brands/actions.js +0 -2
- package/dist/_internal/server/features/brands/og.d.ts +4 -1
- package/dist/_internal/server/features/brands/og.js +1 -1
- package/dist/_internal/server/features/grouped/data.d.ts +4 -0
- package/dist/_internal/server/features/grouped/data.js +24 -0
- package/dist/_internal/server/features/grouped/index.d.ts +1 -1
- package/dist/_internal/server/features/grouped/index.js +1 -1
- package/dist/_internal/server/features/orders/actions.js +9 -0
- package/dist/_internal/server/features/orders/adapters.js +25 -0
- package/dist/_internal/server/features/products/data.d.ts +2 -2
- package/dist/_internal/server/features/products/data.js +5 -23
- package/dist/_internal/server/functions/scheduled.d.ts +3 -1
- package/dist/_internal/server/functions/scheduled.js +17 -1
- package/dist/_internal/server/jobs/core/dailyStatusDigest.d.ts +40 -0
- package/dist/_internal/server/jobs/core/dailyStatusDigest.js +164 -0
- package/dist/_internal/server/jobs/core/hardBanCascade.js +11 -0
- package/dist/_internal/server/jobs/core/testerSandboxCleanup.d.ts +1 -0
- package/dist/_internal/server/jobs/core/testerSandboxCleanup.js +4 -1
- package/dist/_internal/server/jobs/core/testerSandboxRefresh.d.ts +12 -0
- package/dist/_internal/server/jobs/core/testerSandboxRefresh.js +85 -0
- package/dist/_internal/server/jobs/core/whatsappNotify.js +16 -0
- package/dist/_internal/server/jobs/handlers/dailyStatusDigest.d.ts +2 -0
- package/dist/_internal/server/jobs/handlers/dailyStatusDigest.js +4 -0
- package/dist/_internal/server/jobs/handlers/index.d.ts +2 -0
- package/dist/_internal/server/jobs/handlers/index.js +3 -0
- package/dist/_internal/server/jobs/handlers/testerSandboxRefresh.d.ts +2 -0
- package/dist/_internal/server/jobs/handlers/testerSandboxRefresh.js +2 -0
- package/dist/_internal/server/notifications/channel-health.d.ts +27 -0
- package/dist/_internal/server/notifications/channel-health.js +101 -0
- package/dist/_internal/shared/features/brands/schema.d.ts +0 -6
- package/dist/_internal/shared/features/brands/schema.js +0 -1
- package/dist/_internal/shared/features/categories/bundle-schemas.d.ts +7 -0
- package/dist/_internal/shared/features/categories/bundle-schemas.js +3 -0
- package/dist/_internal/shared/features/orders/schema.d.ts +8 -8
- package/dist/_internal/shared/features/products/to-product-item.d.ts +25 -0
- package/dist/_internal/shared/features/products/to-product-item.js +45 -0
- package/dist/client.d.ts +21 -6
- package/dist/client.js +13 -3
- package/dist/constants/api-endpoints.d.ts +6 -9
- package/dist/constants/api-endpoints.js +2 -3
- package/dist/contracts/client-auth.d.ts +3 -7
- package/dist/contracts/email.d.ts +1 -0
- package/dist/features/account/components/AddressForm.js +24 -2
- package/dist/features/account/components/BecomeSellerView.d.ts +1 -2
- package/dist/features/account/components/BecomeSellerView.js +1 -1
- package/dist/features/account/components/NotificationBell.js +1 -1
- package/dist/features/account/components/UserBidsView.d.ts +1 -0
- package/dist/features/account/components/UserBidsView.js +47 -0
- package/dist/features/account/components/UserOrdersView.d.ts +4 -11
- package/dist/features/account/components/UserOrdersView.js +54 -4
- package/dist/features/account/components/UserReturnsView.d.ts +4 -9
- package/dist/features/account/components/UserReturnsView.js +37 -3
- package/dist/features/account/components/index.d.ts +3 -2
- package/dist/features/account/components/index.js +1 -0
- package/dist/features/admin/actions/admin-actions.js +22 -0
- package/dist/features/admin/actions/admin-coupon-actions.js +10 -0
- package/dist/features/admin/actions/notification-actions.js +4 -3
- package/dist/features/admin/components/AdminAdsView.d.ts +2 -3
- package/dist/features/admin/components/AdminAdsView.js +86 -89
- package/dist/features/admin/components/AdminAllEventEntriesView.js +18 -3
- package/dist/features/admin/components/AdminAuditLogView.d.ts +11 -0
- package/dist/features/admin/components/AdminAuditLogView.js +95 -0
- package/dist/features/admin/components/AdminBlogEditorView.js +37 -3
- package/dist/features/admin/components/AdminBrandEditorView.js +10 -6
- package/dist/features/admin/components/AdminBundleEditorView.js +18 -2
- package/dist/features/admin/components/AdminCarouselEditorView.js +2 -2
- package/dist/features/admin/components/AdminCarouselGroupEditorView.js +2 -2
- package/dist/features/admin/components/AdminCartsView.js +34 -4
- package/dist/features/admin/components/AdminCategoryEditorView.js +5 -4
- package/dist/features/admin/components/AdminCouponEditorView.js +2 -2
- package/dist/features/admin/components/AdminFaqEditorView.js +2 -2
- package/dist/features/admin/components/AdminHistoryView.js +11 -1
- package/dist/features/admin/components/AdminNotificationsView.js +27 -1
- package/dist/features/admin/components/AdminOrderEditorView.d.ts +10 -1
- package/dist/features/admin/components/AdminOrderEditorView.js +4 -3
- package/dist/features/admin/components/AdminOrdersView.js +92 -24
- package/dist/features/admin/components/AdminPayoutMarkPaidModal.d.ts +7 -0
- package/dist/features/admin/components/AdminPayoutMarkPaidModal.js +47 -0
- package/dist/features/admin/components/AdminPayoutsView.js +15 -31
- package/dist/features/admin/components/AdminProductEditorView.js +26 -3
- package/dist/features/admin/components/AdminSiteSettingsView.js +20 -1
- package/dist/features/admin/components/AdminStoreAddressesView.js +22 -2
- package/dist/features/admin/components/AdminStoresView.js +7 -0
- package/dist/features/admin/components/AdminSublistingCategoryEditorView.js +2 -2
- package/dist/features/admin/components/AdminTesterChecklistItemEditorView.js +2 -2
- package/dist/features/admin/components/AdminUserEditorView.d.ts +2 -2
- package/dist/features/admin/components/AdminUserEditorView.js +4 -2
- package/dist/features/admin/components/AdminUsersView.js +1 -1
- package/dist/features/admin/components/AdminWishlistsView.js +14 -1
- package/dist/features/admin/components/DataListingView.d.ts +2 -2
- package/dist/features/admin/components/ViewAuditLogEntryModal.d.ts +19 -0
- package/dist/features/admin/components/ViewAuditLogEntryModal.js +22 -0
- package/dist/features/admin/components/ViewNotificationModal.d.ts +21 -0
- package/dist/features/admin/components/ViewNotificationModal.js +15 -0
- package/dist/features/admin/components/analytics/AdminPageViewsReportView.d.ts +4 -7
- package/dist/features/admin/components/analytics/AdminPageViewsReportView.js +56 -36
- package/dist/features/admin/components/index.d.ts +8 -1
- package/dist/features/admin/components/index.js +4 -0
- package/dist/features/admin/constants/filter-tabs.d.ts +49 -0
- package/dist/features/admin/constants/filter-tabs.js +27 -0
- package/dist/features/admin/hooks/useAdminListing.d.ts +6 -0
- package/dist/features/admin/hooks/useAdminListing.js +3 -1
- package/dist/features/admin/hooks/useAdminListingData.d.ts +9 -1
- package/dist/features/admin/hooks/useAdminListingData.js +9 -2
- package/dist/features/admin/repository/site-settings.repository.d.ts +5 -0
- package/dist/features/admin/schemas/firestore.d.ts +12 -0
- package/dist/features/analytics/types.d.ts +1 -1
- package/dist/features/analytics/types.js +8 -0
- package/dist/features/auctions/schemas/index.d.ts +5 -0
- package/dist/features/audit-log/repository/audit-log.repository.d.ts +45 -0
- package/dist/features/audit-log/repository/audit-log.repository.js +30 -0
- package/dist/features/audit-log/schemas/firestore.d.ts +59 -0
- package/dist/features/audit-log/schemas/firestore.js +35 -0
- package/dist/features/auth/actions/index.d.ts +0 -1
- package/dist/features/auth/actions/index.js +0 -1
- package/dist/features/auth/hooks/useAuth.d.ts +8 -35
- package/dist/features/auth/hooks/useAuth.js +21 -37
- package/dist/features/auth/permissions/constants.d.ts +1 -1
- package/dist/features/auth/permissions/constants.js +2 -0
- package/dist/features/blog/schemas/index.d.ts +32 -0
- package/dist/features/catalogue/components/AdminCatalogueApprovalsView.js +31 -3
- package/dist/features/catalogue/components/CatalogueItemEditorView.js +2 -1
- package/dist/features/categories/components/BrandDetailPageView.js +14 -12
- package/dist/features/categories/components/CategoryDetailPageView.js +7 -3
- package/dist/features/categories/components/CategoryHighlightsAndFaqSection.d.ts +14 -0
- package/dist/features/categories/components/CategoryHighlightsAndFaqSection.js +22 -0
- package/dist/features/categories/components/CategoryProductsView.d.ts +1 -5
- package/dist/features/categories/components/CategoryProductsView.js +1 -1
- package/dist/features/categories/components/CategorySelectorCreate.js +16 -2
- package/dist/features/categories/schemas/firestore.d.ts +19 -2
- package/dist/features/categories/schemas/index.d.ts +24 -3
- package/dist/features/categories/schemas/index.js +3 -1
- package/dist/features/categories/types/index.d.ts +7 -0
- package/dist/features/checkout/actions/checkout-value-otp-actions.d.ts +17 -3
- package/dist/features/checkout/actions/checkout-value-otp-actions.js +101 -22
- package/dist/features/contact/components/ContactForm.js +17 -4
- package/dist/features/contact/email.d.ts +1 -0
- package/dist/features/contact/email.js +3 -0
- package/dist/features/events/components/AdminEventEditorView.js +54 -2
- package/dist/features/events/components/AdminEventEntriesView.d.ts +2 -16
- package/dist/features/events/components/AdminEventEntriesView.js +56 -89
- package/dist/features/events/components/EventFormDrawer.js +5 -1
- package/dist/features/events/components/EventRaffleEntryForm.d.ts +1 -3
- package/dist/features/events/components/EventRaffleEntryForm.js +1 -1
- package/dist/features/events/schemas/index.d.ts +22 -0
- package/dist/features/grouped/components/GroupedListingsCarousel.js +4 -1
- package/dist/features/grouped/repository/grouped-listings.repository.d.ts +4 -0
- package/dist/features/grouped/repository/grouped-listings.repository.js +18 -0
- package/dist/features/homepage/components/CharacterHotspotForm.js +202 -187
- package/dist/features/homepage/components/SectionCarousel.d.ts +1 -7
- package/dist/features/homepage/components/SectionCarousel.js +1 -1
- package/dist/features/layout/TitleBarLayout.d.ts +1 -1
- package/dist/features/layout/TitleBarLayout.js +3 -3
- package/dist/features/media/MediaImage.js +39 -3
- package/dist/features/media/types/index.d.ts +10 -0
- package/dist/features/media/types/index.js +1 -0
- package/dist/features/media/upload/MediaUploadField.d.ts +7 -1
- package/dist/features/media/upload/MediaUploadField.js +11 -7
- package/dist/features/media/upload/video-poster.d.ts +2 -0
- package/dist/features/media/upload/video-poster.js +16 -1
- package/dist/features/media/upload/video-poster.test.js +1 -1
- package/dist/features/orders/components/OrderStatusTimeline.d.ts +12 -0
- package/dist/features/orders/components/OrderStatusTimeline.js +55 -0
- package/dist/features/orders/components/index.d.ts +2 -0
- package/dist/features/orders/components/index.js +1 -0
- package/dist/features/orders/constants/payment-window.d.ts +25 -0
- package/dist/features/orders/constants/payment-window.js +25 -0
- package/dist/features/orders/repository/orders.repository.d.ts +32 -0
- package/dist/features/orders/repository/orders.repository.js +56 -0
- package/dist/features/orders/schemas/index.d.ts +24 -24
- package/dist/features/orders/types/index.d.ts +33 -0
- package/dist/features/pre-orders/schemas/index.d.ts +5 -0
- package/dist/features/products/components/BidHistory.js +9 -1
- package/dist/features/products/components/GroupSettingsPanel.js +25 -3
- package/dist/features/products/components/PrizeDrawDetailPageView.js +1 -1
- package/dist/features/products/components/PrizeDrawEntryActions.d.ts +1 -4
- package/dist/features/products/components/PrizeDrawEntryActions.js +1 -1
- package/dist/features/products/components/ProductDetailActions.d.ts +1 -2
- package/dist/features/products/components/ProductDetailActions.js +1 -1
- package/dist/features/products/components/ProductGrid.js +15 -1
- package/dist/features/products/constants/action-defs.d.ts +1 -0
- package/dist/features/products/constants/action-defs.js +1 -0
- package/dist/features/products/schemas/index.d.ts +5 -0
- package/dist/features/promotions/components/CouponsIndexListing.d.ts +1 -3
- package/dist/features/promotions/components/CouponsIndexListing.js +1 -1
- package/dist/features/search/components/SearchView.d.ts +1 -3
- package/dist/features/search/components/SearchView.js +1 -1
- package/dist/features/seller/components/QuickProductForm.js +2 -1
- package/dist/features/seller/components/SellerBidsView.js +66 -107
- package/dist/features/seller/components/SellerGoogleReviewsView.js +17 -1
- package/dist/features/seller/components/SellerOrdersView.d.ts +15 -3
- package/dist/features/seller/components/SellerOrdersView.js +134 -163
- package/dist/features/seller/components/SellerPayoutMethodsView.js +60 -48
- package/dist/features/seller/components/SellerPayoutSettingsView.js +69 -4
- package/dist/features/seller/components/SellerPayoutsView.d.ts +12 -0
- package/dist/features/seller/components/SellerPayoutsView.js +25 -5
- package/dist/features/seller/components/SellerProductShell.d.ts +10 -3
- package/dist/features/seller/components/SellerProductShell.js +89 -36
- package/dist/features/seller/components/SellerProductsFilterDrawer.d.ts +2 -7
- package/dist/features/seller/components/SellerProductsFilterDrawer.js +4 -4
- package/dist/features/seller/components/SellerProductsView.d.ts +2 -4
- package/dist/features/seller/components/SellerProductsView.js +131 -189
- package/dist/features/seller/components/SellerReviewsView.js +95 -133
- package/dist/features/seller/components/SellerShippingConfigsView.js +47 -67
- package/dist/features/seller/components/SellerShippingView.js +41 -4
- package/dist/features/seller/components/SellerStoreCategoriesView.js +51 -59
- package/dist/features/seller/components/SellerStorefrontView.d.ts +6 -1
- package/dist/features/seller/components/SellerStorefrontView.js +42 -5
- package/dist/features/seller/components/index.d.ts +2 -2
- package/dist/features/seller/components/index.js +2 -2
- package/dist/features/shell/FormShell.d.ts +24 -4
- package/dist/features/shell/FormShell.js +12 -6
- package/dist/features/shell/QuickFormDrawer.js +67 -12
- package/dist/features/shell/StepForm.d.ts +30 -1
- package/dist/features/shell/StepForm.js +47 -4
- package/dist/features/shell/index.d.ts +1 -1
- package/dist/features/shell/index.js +1 -1
- package/dist/features/shipments/components/AdminShipmentEditorView.js +2 -2
- package/dist/features/shipments/schemas/validation.d.ts +14 -4
- package/dist/features/tester/components/AdminTesterFeedbackListView.js +23 -2
- package/dist/features/tester/components/TesterChecklistStepRow.js +1 -1
- package/dist/features/tester/components/TesterHubView.js +3 -2
- package/dist/features/tester/seed-data/orders-tester-seed-data.js +9 -1
- package/dist/features/tester/seed-data/products-tester-seed-data.js +43 -32
- package/dist/features/tester/seed-data/tester-checklist-seed-data.js +404 -15
- package/dist/index.d.ts +15 -3
- package/dist/index.js +22 -5
- package/dist/next/routing/route-map.d.ts +11 -0
- package/dist/next/routing/route-map.js +5 -0
- package/dist/providers/email-resend/provider.js +1 -0
- package/dist/providers/firebase-client/auth.d.ts +1 -0
- package/dist/providers/firebase-client/auth.js +7 -1
- package/dist/repositories/index.d.ts +1 -0
- package/dist/repositories/index.js +1 -0
- package/dist/schemas/registry.d.ts +61 -25
- package/dist/security/pii-mask.js +1 -1
- package/dist/seed/categories-seed-data.js +69 -0
- package/dist/seed/products-auctions-seed-data.js +11 -0
- package/dist/seed/products-standard-seed-data.js +93 -4
- package/dist/seed/site-settings-seed-data.js +13 -1
- package/dist/seed/store-extensions-seed-data.js +1 -1
- package/dist/server-entry.d.ts +2 -1
- package/dist/server-entry.js +20 -2
- package/dist/server.d.ts +7 -2
- package/dist/server.js +8 -3
- package/dist/styles.css +1 -1
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/components/Form.d.ts +11 -2
- package/dist/ui/components/Form.js +4 -3
- package/dist/ui/components/FormField.d.ts +3 -1
- package/dist/ui/components/FormField.js +22 -4
- package/dist/ui/components/ListingLayout.d.ts +1 -2
- package/dist/ui/components/ListingLayout.js +1 -1
- package/dist/ui/components/RecordDetailModal.d.ts +68 -0
- package/dist/ui/components/RecordDetailModal.js +8 -0
- package/dist/ui/components/SlottedListingView.js +9 -1
- package/dist/ui/forms/FormErrorSummary.d.ts +25 -0
- package/dist/ui/forms/FormErrorSummary.js +37 -0
- package/dist/ui/forms/FormShell.d.ts +37 -2
- package/dist/ui/forms/FormShell.js +37 -7
- package/dist/ui/forms/FormShell.style.css +17 -0
- package/dist/ui/forms/index.d.ts +2 -0
- package/dist/ui/forms/index.js +1 -0
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.js +5 -0
- package/dist/utils/media-url.d.ts +3 -1
- package/dist/utils/media-url.js +20 -1
- package/dist/validation/schemas.d.ts +4 -4
- package/package.json +1 -1
- package/dist/_internal/client/features/classified/ClassifiedDetailView.d.ts +0 -9
- package/dist/_internal/client/features/classified/ClassifiedDetailView.js +0 -55
- package/dist/_internal/client/features/digital-code/DigitalCodeDetailView.d.ts +0 -18
- package/dist/_internal/client/features/digital-code/DigitalCodeDetailView.js +0 -21
- package/dist/_internal/client/features/live/LiveItemDetailView.d.ts +0 -9
- package/dist/_internal/client/features/live/LiveItemDetailView.js +0 -25
- package/dist/_internal/server/jobs/core/prizeRevealClose.d.ts +0 -2
- package/dist/_internal/server/jobs/core/prizeRevealClose.js +0 -28
- package/dist/_internal/server/jobs/core/prizeRevealExpiry.d.ts +0 -2
- package/dist/_internal/server/jobs/core/prizeRevealExpiry.js +0 -61
- package/dist/_internal/server/jobs/core/prizeRevealOpen.d.ts +0 -2
- package/dist/_internal/server/jobs/core/prizeRevealOpen.js +0 -68
- package/dist/_internal/server/jobs/core/prizeRevealReminder.d.ts +0 -2
- package/dist/_internal/server/jobs/core/prizeRevealReminder.js +0 -49
- package/dist/_internal/server/jobs/handlers/prizeRevealClose.d.ts +0 -2
- package/dist/_internal/server/jobs/handlers/prizeRevealClose.js +0 -2
- package/dist/_internal/server/jobs/handlers/prizeRevealExpiry.d.ts +0 -2
- package/dist/_internal/server/jobs/handlers/prizeRevealExpiry.js +0 -2
- package/dist/_internal/server/jobs/handlers/prizeRevealOpen.d.ts +0 -2
- package/dist/_internal/server/jobs/handlers/prizeRevealOpen.js +0 -2
- package/dist/_internal/server/jobs/handlers/prizeRevealReminder.d.ts +0 -2
- package/dist/_internal/server/jobs/handlers/prizeRevealReminder.js +0 -2
- package/dist/features/auth/consent-otp.d.ts +0 -57
- package/dist/features/auth/consent-otp.js +0 -127
- package/dist/features/cart/components/CheckoutOtpModal.d.ts +0 -15
- package/dist/features/cart/components/CheckoutOtpModal.js +0 -12
- package/dist/features/checkout/actions/checkout-actions.d.ts +0 -31
- package/dist/features/checkout/actions/checkout-actions.js +0 -124
- package/dist/features/classified/components/ClassifiedIndexListing.d.ts +0 -5
- package/dist/features/classified/components/ClassifiedIndexListing.js +0 -123
- package/dist/features/classified/components/ClassifiedListView.d.ts +0 -6
- package/dist/features/classified/components/ClassifiedListView.js +0 -44
- package/dist/features/digital-codes/components/DigitalCodesIndexListing.d.ts +0 -5
- package/dist/features/digital-codes/components/DigitalCodesIndexListing.js +0 -114
- package/dist/features/digital-codes/components/DigitalCodesListView.d.ts +0 -6
- package/dist/features/digital-codes/components/DigitalCodesListView.js +0 -38
- package/dist/features/live/components/LiveItemsIndexListing.d.ts +0 -5
- package/dist/features/live/components/LiveItemsIndexListing.js +0 -115
- package/dist/features/live/components/LiveItemsListView.d.ts +0 -6
- package/dist/features/live/components/LiveItemsListView.js +0 -44
- package/dist/features/seller/components/SellerTemplatesView.d.ts +0 -12
- package/dist/features/seller/components/SellerTemplatesView.js +0 -276
- package/dist/react/hooks/useVisibleItems.d.ts +0 -37
- package/dist/react/hooks/useVisibleItems.js +0 -59
- package/dist/ui/components/TabStrip.d.ts +0 -34
- package/dist/ui/components/TabStrip.js +0 -56
- package/dist/ui/components/TabStrip.style.css +0 -97
|
@@ -3,30 +3,26 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { normalizeError } from "../../../errors/normalize";
|
|
4
4
|
import { SIEVE_OP, Stack, sieveFilter } from "@mohasinac/appkit/client";
|
|
5
5
|
import { sortBy } from "@mohasinac/appkit/client";
|
|
6
|
-
import
|
|
6
|
+
import { useState, useCallback } from "react";
|
|
7
7
|
import { useEntityDelete } from "../../../react/hooks/useEntityDelete";
|
|
8
8
|
import { useActionDispatch } from "../../../react/hooks/use-action-dispatch";
|
|
9
9
|
import { Eye, EyeOff, Pencil, Trash2, Printer, MapPin } from "lucide-react";
|
|
10
10
|
import { PhysicalLocationModal } from "./PhysicalLocationModal";
|
|
11
11
|
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
12
|
-
import {
|
|
13
|
-
import { Alert, Badge, BulkActionBar, Button, Div, ListingToolbar, ListingLayout, Pagination, Row, Select, Span, Text, useToast, StickyToolbar } from "../../../ui";
|
|
12
|
+
import { Badge, Button, Div, Row, Select, Span, Text, useToast } from "../../../ui";
|
|
14
13
|
import { MediaImage } from "../../media/MediaImage";
|
|
15
14
|
import { SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
16
15
|
import { SELLER_PRODUCT_STATUS_TABS } from "../../admin/constants/filter-tabs";
|
|
17
16
|
import { ROUTES } from "../../../constants";
|
|
18
17
|
import { normalizeListingType } from "../../products/utils/listing-type";
|
|
19
|
-
import { toRecordArray, toRelativeDate, toStringValue
|
|
20
|
-
import { DataTable } from "../../admin/components/DataTable";
|
|
21
|
-
import { useDataViewMode } from "../../account/hooks/useDataViewMode";
|
|
22
|
-
import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
|
|
23
|
-
import { buildBulkAction } from "../../../_internal/shared/actions/bulk-helpers";
|
|
18
|
+
import { toRecordArray, toRelativeDate, toStringValue } from "../hooks/useSellerListingData";
|
|
24
19
|
import { useListingTypeFlags } from "../../../react/hooks/useListingTypeFlags";
|
|
25
20
|
import { SellerProductsCards } from "./SellerProductsCards";
|
|
26
|
-
import {
|
|
21
|
+
import { SellerProductsFilterFields } from "./SellerProductsFilterDrawer";
|
|
27
22
|
import { LISTING_BADGE_VARIANT } from "../../products/utils/listing-badge-variant";
|
|
28
|
-
import {
|
|
29
|
-
|
|
23
|
+
import { DataListingView } from "../../admin/components/DataListingView";
|
|
24
|
+
import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
|
|
25
|
+
import { buildBulkAction } from "../../../_internal/shared/actions/bulk-helpers";
|
|
30
26
|
const FILTER_KEYS = [
|
|
31
27
|
"status",
|
|
32
28
|
"category",
|
|
@@ -36,6 +32,8 @@ const FILTER_KEYS = [
|
|
|
36
32
|
"maxPrice",
|
|
37
33
|
"tags",
|
|
38
34
|
"badges",
|
|
35
|
+
"listingType",
|
|
36
|
+
"showSold",
|
|
39
37
|
];
|
|
40
38
|
const DEFAULT_SORT = "-createdAt";
|
|
41
39
|
const SORT_OPTIONS = [
|
|
@@ -47,13 +45,8 @@ const SORT_OPTIONS = [
|
|
|
47
45
|
{ value: sortBy("price", "ASC"), label: "Price Low" },
|
|
48
46
|
];
|
|
49
47
|
const STATUS_OPTIONS = SELLER_PRODUCT_STATUS_TABS;
|
|
50
|
-
// S-STORE-2-A — `<TypeDropdown>` replaces the legacy chip strip. Same width on
|
|
51
|
-
// mobile, narrower on desktop. Drives the `?listingType=` query param.
|
|
52
48
|
function TypeDropdown({ active, onChange, }) {
|
|
53
49
|
const flags = useListingTypeFlags();
|
|
54
|
-
// W1-43 — hide disabled types so the seller can't filter for an
|
|
55
|
-
// inactive listing surface. Bundle is a categoryType (not a listingType)
|
|
56
|
-
// and stays unconditionally available.
|
|
57
50
|
const options = [
|
|
58
51
|
{ value: "all", label: "All listings" },
|
|
59
52
|
flags.standard && { value: "standard", label: "Standard" },
|
|
@@ -90,23 +83,19 @@ const PRODUCT_COLUMNS = [
|
|
|
90
83
|
header: "Status",
|
|
91
84
|
className: "w-28",
|
|
92
85
|
render: (row) => {
|
|
93
|
-
// Real ProductStatus is draft|published|in_review|archived — "active"
|
|
94
|
-
// and "sold" are not stored status values (sold is tracked separately
|
|
95
|
-
// via isSold, shown via the "Show sold" toolbar toggle, not this
|
|
96
|
-
// column), so those two branches never matched and were dead code.
|
|
97
86
|
const variant = row.status === "published"
|
|
98
87
|
? "success"
|
|
99
88
|
: row.status === "draft"
|
|
100
89
|
? "default"
|
|
101
90
|
: "danger";
|
|
102
|
-
return
|
|
91
|
+
return _jsx(Badge, { variant: variant, children: row.status });
|
|
103
92
|
},
|
|
104
93
|
},
|
|
105
94
|
{
|
|
106
95
|
key: "updatedAt",
|
|
107
96
|
header: "Updated",
|
|
108
97
|
className: "w-28",
|
|
109
|
-
render: (row) =>
|
|
98
|
+
render: (row) => _jsx(Span, { size: "xs", color: "muted", children: row.updatedAt }),
|
|
110
99
|
},
|
|
111
100
|
{
|
|
112
101
|
key: "physicalLocation",
|
|
@@ -115,16 +104,15 @@ const PRODUCT_COLUMNS = [
|
|
|
115
104
|
render: (row) => row.physicalLocation ? (_jsxs(Span, { size: "xs", className: "font-mono text-[var(--appkit-color-text-muted)]", children: [row.physicalLocation.zone, "/", row.physicalLocation.shelf, "/", row.physicalLocation.bin] })) : (_jsx(Span, { size: "xs", color: "faint", children: "\u2014" })),
|
|
116
105
|
},
|
|
117
106
|
];
|
|
118
|
-
export function SellerProductsView({ onDeleteProduct, onCreateClick,
|
|
119
|
-
const hasChildren = React.Children.count(children) > 0;
|
|
120
|
-
const { view, setView } = useDataViewMode("list");
|
|
107
|
+
export function SellerProductsView({ onDeleteProduct, onCreateClick, }) {
|
|
121
108
|
const dispatch = useActionDispatch();
|
|
122
109
|
const { showToast } = useToast();
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const listingKind = (
|
|
110
|
+
// Independent useUrlTable() instance for the type-dropdown + "Show sold"
|
|
111
|
+
// toggle (Root Cause #35) — reads/writes the same URL params DataListingView's
|
|
112
|
+
// own internal table also reads via `filterKeys`, so both stay in sync.
|
|
113
|
+
const sideTable = useUrlTable({ defaults: { sort: DEFAULT_SORT } });
|
|
114
|
+
const listingKind = (sideTable.get("listingType") || "all");
|
|
115
|
+
const showSold = sideTable.get("showSold") === "true";
|
|
128
116
|
const { deletingId, handleDelete: performDelete } = useEntityDelete({
|
|
129
117
|
deleteFn: onDeleteProduct,
|
|
130
118
|
onSuccess: (id) => { setDeletedIds((prev) => new Set([...prev, id])); },
|
|
@@ -133,148 +121,10 @@ export function SellerProductsView({ onDeleteProduct, onCreateClick, children, .
|
|
|
133
121
|
const [publishingId, setPublishingId] = useState(null);
|
|
134
122
|
const [statusOverrides, setStatusOverrides] = useState(new Map());
|
|
135
123
|
const [setLocationOpen, setSetLocationOpen] = useState(false);
|
|
136
|
-
const [
|
|
137
|
-
const openFilters = useCallback(() => {
|
|
138
|
-
setPendingFilters(Object.fromEntries(FILTER_KEYS.map((k) => [k, table.get(k)])));
|
|
139
|
-
setFilterOpen(true);
|
|
140
|
-
}, [table]);
|
|
141
|
-
const applyFilters = useCallback(() => {
|
|
142
|
-
const updates = { page: "1" };
|
|
143
|
-
for (const k of FILTER_KEYS)
|
|
144
|
-
updates[k] = pendingFilters[k] ?? "";
|
|
145
|
-
table.setMany(updates);
|
|
146
|
-
setFilterOpen(false);
|
|
147
|
-
}, [pendingFilters, table]);
|
|
148
|
-
const clearFilters = useCallback(() => {
|
|
149
|
-
setPendingFilters(Object.fromEntries(FILTER_KEYS.map((k) => [k, ""])));
|
|
150
|
-
}, []);
|
|
151
|
-
const resetAll = useCallback(() => {
|
|
152
|
-
const updates = { q: "", sort: "", listingType: "", showSold: "" };
|
|
153
|
-
for (const k of FILTER_KEYS)
|
|
154
|
-
updates[k] = "";
|
|
155
|
-
table.setMany(updates);
|
|
156
|
-
setSearchInput("");
|
|
157
|
-
}, [table]);
|
|
158
|
-
const commitSearch = useCallback(() => {
|
|
159
|
-
table.set("q", searchInput.trim());
|
|
160
|
-
}, [searchInput, table]);
|
|
124
|
+
const [selectedIdsForLocation, setSelectedIdsForLocation] = useState([]);
|
|
161
125
|
const handleKindChange = useCallback((kind) => {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}, [table]);
|
|
165
|
-
const showSold = table.get("showSold") === "true";
|
|
166
|
-
const activeFilterCount = FILTER_KEYS.filter((k) => !!table.get(k)).length;
|
|
167
|
-
const hasActiveState = !!table.get("q") ||
|
|
168
|
-
table.get("sort") !== DEFAULT_SORT ||
|
|
169
|
-
activeFilterCount > 0 ||
|
|
170
|
-
listingKind !== "all" ||
|
|
171
|
-
showSold;
|
|
172
|
-
const statusRaw = table.get("status");
|
|
173
|
-
const statusFilter = statusRaw && statusRaw !== "All" ? sieveFilter("status", SIEVE_OP.EQ, statusRaw) : undefined;
|
|
174
|
-
// SB1-G — single-field listingType clause. The repository's Sieve aliases
|
|
175
|
-
// accept both `==auction|preorder|standard` and `==pre-order` directly.
|
|
176
|
-
const kindFilter = listingKind === "all" ? undefined : sieveFilter("listingType", SIEVE_OP.EQ, listingKind);
|
|
177
|
-
const soldFilter = showSold ? undefined : "isSold==false";
|
|
178
|
-
const filters = [statusFilter, kindFilter, soldFilter].filter(Boolean).join(",") || undefined;
|
|
179
|
-
const { rows, total, isLoading, errorMessage } = useSellerListingData({
|
|
180
|
-
queryKey: ["seller", "products", "listing", listingKind],
|
|
181
|
-
endpoint: SELLER_ENDPOINTS.PRODUCTS,
|
|
182
|
-
page: table.getNumber("page", 1),
|
|
183
|
-
pageSize: PAGE_SIZE,
|
|
184
|
-
sorts: table.get("sort") || DEFAULT_SORT,
|
|
185
|
-
filters,
|
|
186
|
-
q: table.get("q") || undefined,
|
|
187
|
-
mapRows: (response) => toRecordArray(response.products).map((item, index) => {
|
|
188
|
-
// SB1-G — derive kind from canonical listingType with legacy fallback.
|
|
189
|
-
const lt = normalizeListingType(item);
|
|
190
|
-
const kind = lt === "auction"
|
|
191
|
-
? "auction"
|
|
192
|
-
: lt === "pre-order"
|
|
193
|
-
? "pre-order"
|
|
194
|
-
: lt === "prize-draw"
|
|
195
|
-
? "prize-draw"
|
|
196
|
-
: "standard";
|
|
197
|
-
const priceRaw = typeof item.price === "number" ? item.price : 0;
|
|
198
|
-
// Auction listings lost their reserve/bid/end-date summary when this
|
|
199
|
-
// view was consolidated from the old dedicated SellerAuctionsView —
|
|
200
|
-
// restore it into `secondary` (the one line every row/card renders)
|
|
201
|
-
// instead of the generic condition string, which auction sellers
|
|
202
|
-
// care about far less than bid activity.
|
|
203
|
-
const auctionSecondary = kind === "auction"
|
|
204
|
-
? [
|
|
205
|
-
typeof item.reservePrice === "number"
|
|
206
|
-
? `Reserve ₹${item.reservePrice.toLocaleString("en-IN")}`
|
|
207
|
-
: null,
|
|
208
|
-
`${typeof item.bidCount === "number" ? item.bidCount : 0} bids`,
|
|
209
|
-
item.auctionEndDate
|
|
210
|
-
? `Ends ${new Date(item.auctionEndDate).toLocaleDateString("en-IN", { month: "short", day: "numeric" })}`
|
|
211
|
-
: null,
|
|
212
|
-
]
|
|
213
|
-
.filter(Boolean)
|
|
214
|
-
.join(" · ")
|
|
215
|
-
: "";
|
|
216
|
-
return {
|
|
217
|
-
id: toStringValue(item.id, `product-${index}`),
|
|
218
|
-
primary: toStringValue(item.title ?? item.name, "Untitled product"),
|
|
219
|
-
secondary: auctionSecondary || toStringValue(item.condition, ""),
|
|
220
|
-
status: toStringValue(item.status, "draft"),
|
|
221
|
-
updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
|
|
222
|
-
imageUrl: toStringValue(item.mainImage ?? item.images?.[0], undefined),
|
|
223
|
-
image: toStringValue(item.mainImage ?? item.images?.[0], undefined),
|
|
224
|
-
listingKind: kind,
|
|
225
|
-
price: priceRaw ? `₹${priceRaw.toLocaleString("en-IN")}` : "—",
|
|
226
|
-
physicalLocation: item.physicalLocation &&
|
|
227
|
-
typeof item.physicalLocation.zone === "string"
|
|
228
|
-
? item.physicalLocation
|
|
229
|
-
: undefined,
|
|
230
|
-
};
|
|
231
|
-
}),
|
|
232
|
-
getTotal: (response, mappedRows) => typeof response.meta?.total === "number" ? response.meta.total : mappedRows.length,
|
|
233
|
-
});
|
|
234
|
-
const currentPage = table.getNumber("page", 1);
|
|
235
|
-
const totalPages = Math.ceil(total / PAGE_SIZE);
|
|
236
|
-
const visibleRows = rows
|
|
237
|
-
.filter((r) => !deletedIds.has(r.id))
|
|
238
|
-
.map((r) => statusOverrides.has(r.id) ? { ...r, status: statusOverrides.get(r.id) } : r);
|
|
239
|
-
const selection = useBulkSelection({ items: visibleRows, keyExtractor: (r) => r.id });
|
|
240
|
-
// handleBulkPrintLabels/handleSetLocation (useCallback) and useBottomActions
|
|
241
|
-
// must run unconditionally on every render — they were previously declared
|
|
242
|
-
// after the `hasChildren` early return below, which skips these hook calls
|
|
243
|
-
// in passthrough mode, violating the Rules of Hooks.
|
|
244
|
-
const handleBulkPrintLabels = useCallback(() => {
|
|
245
|
-
const ids = selection.selectedIds.join(",");
|
|
246
|
-
void dispatch({
|
|
247
|
-
type: "NAVIGATE",
|
|
248
|
-
href: `${String(ROUTES.STORE.PRINT_CENTER)}?type=product&ids=${ids}&autoprint=1`,
|
|
249
|
-
});
|
|
250
|
-
}, [selection.selectedIds, dispatch]);
|
|
251
|
-
const handleSetLocation = useCallback(async (loc) => {
|
|
252
|
-
try {
|
|
253
|
-
const res = await fetch(SELLER_ENDPOINTS.PRODUCTS_BULK_LOCATION, {
|
|
254
|
-
method: "PATCH",
|
|
255
|
-
headers: { "Content-Type": "application/json" },
|
|
256
|
-
body: JSON.stringify({ productIds: selection.selectedIds, physicalLocation: loc }),
|
|
257
|
-
});
|
|
258
|
-
if (!res.ok) {
|
|
259
|
-
const body = await res.json().catch(() => null);
|
|
260
|
-
throw new Error(body?.error ?? "Failed to update location");
|
|
261
|
-
}
|
|
262
|
-
showToast("Location updated.", "success");
|
|
263
|
-
setSetLocationOpen(false);
|
|
264
|
-
}
|
|
265
|
-
catch (err) {
|
|
266
|
-
void normalizeError(err);
|
|
267
|
-
showToast(err instanceof Error ? err.message : "Failed to update location.", "error");
|
|
268
|
-
}
|
|
269
|
-
}, [selection.selectedIds, showToast]);
|
|
270
|
-
const bulkActions = [
|
|
271
|
-
buildBulkAction(ACTIONS.STORE["print-labels"], handleBulkPrintLabels, { icon: _jsx(Printer, { className: "w-4 h-4" }) }),
|
|
272
|
-
buildBulkAction(ACTIONS.STORE["set-location"], () => setSetLocationOpen(true), { icon: _jsx(MapPin, { className: "w-4 h-4" }) }),
|
|
273
|
-
];
|
|
274
|
-
useBottomActions(selection.selectedCount > 0 ? { bulk: { selectedCount: selection.selectedCount, onClearSelection: selection.clearSelection, actions: bulkActions } } : {});
|
|
275
|
-
if (hasChildren) {
|
|
276
|
-
return (_jsx(ListingLayout, { portal: "seller", ...props, children: children }));
|
|
277
|
-
}
|
|
126
|
+
sideTable.setMany({ listingType: kind === "all" ? "" : kind, page: "1" });
|
|
127
|
+
}, [sideTable]);
|
|
278
128
|
const handleEdit = (row) => {
|
|
279
129
|
const href = row.listingKind === "auction"
|
|
280
130
|
? String(ROUTES.STORE.AUCTIONS_EDIT(row.id))
|
|
@@ -290,7 +140,6 @@ export function SellerProductsView({ onDeleteProduct, onCreateClick, children, .
|
|
|
290
140
|
return;
|
|
291
141
|
await performDelete(row.id);
|
|
292
142
|
};
|
|
293
|
-
// S-STORE-2-C — Duplicate verb. Server-side endpoint is /api/store/products/[id]/duplicate.
|
|
294
143
|
const handleDuplicate = async (row) => {
|
|
295
144
|
const res = await fetch(SELLER_ENDPOINTS.PRODUCT_DUPLICATE(row.id), {
|
|
296
145
|
method: "POST",
|
|
@@ -320,21 +169,114 @@ export function SellerProductsView({ onDeleteProduct, onCreateClick, children, .
|
|
|
320
169
|
setPublishingId(null);
|
|
321
170
|
}
|
|
322
171
|
};
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
172
|
+
const handleSetLocation = useCallback(async (loc, ids) => {
|
|
173
|
+
try {
|
|
174
|
+
const res = await fetch(SELLER_ENDPOINTS.PRODUCTS_BULK_LOCATION, {
|
|
175
|
+
method: "PATCH",
|
|
176
|
+
headers: { "Content-Type": "application/json" },
|
|
177
|
+
body: JSON.stringify({ productIds: ids, physicalLocation: loc }),
|
|
178
|
+
});
|
|
179
|
+
if (!res.ok) {
|
|
180
|
+
const body = await res.json().catch(() => null);
|
|
181
|
+
throw new Error(body?.error ?? "Failed to update location");
|
|
182
|
+
}
|
|
183
|
+
showToast("Location updated.", "success");
|
|
184
|
+
setSetLocationOpen(false);
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
void normalizeError(err);
|
|
188
|
+
showToast(err instanceof Error ? err.message : "Failed to update location.", "error");
|
|
189
|
+
}
|
|
190
|
+
}, [showToast]);
|
|
191
|
+
const config = {
|
|
192
|
+
portal: "seller",
|
|
193
|
+
title: "Products",
|
|
194
|
+
searchPlaceholder: "Search products by name…",
|
|
195
|
+
emptyLabel: listingKind !== "all" ? `No ${listingKind} listings found` : "No products listed yet",
|
|
196
|
+
filterKeys: FILTER_KEYS,
|
|
197
|
+
defaultSort: DEFAULT_SORT,
|
|
198
|
+
queryKey: ["seller", "products", "listing", listingKind],
|
|
199
|
+
endpoint: SELLER_ENDPOINTS.PRODUCTS,
|
|
200
|
+
sortOptions: SORT_OPTIONS,
|
|
201
|
+
columns: PRODUCT_COLUMNS,
|
|
202
|
+
toggles: [
|
|
203
|
+
{ label: "Show sold", active: showSold, onChange: (next) => sideTable.set("showSold", next ? "true" : "") },
|
|
204
|
+
],
|
|
205
|
+
primaryAction: onCreateClick ? { label: "New Listing", onClick: onCreateClick } : undefined,
|
|
206
|
+
mapRows: (response) => {
|
|
207
|
+
const rows = toRecordArray(response.products).map((item, index) => {
|
|
208
|
+
const lt = normalizeListingType(item);
|
|
209
|
+
const kind = lt === "auction"
|
|
210
|
+
? "auction"
|
|
211
|
+
: lt === "pre-order"
|
|
212
|
+
? "pre-order"
|
|
213
|
+
: lt === "prize-draw"
|
|
214
|
+
? "prize-draw"
|
|
215
|
+
: "standard";
|
|
216
|
+
const priceRaw = typeof item.price === "number" ? item.price : 0;
|
|
217
|
+
const auctionSecondary = kind === "auction"
|
|
218
|
+
? [
|
|
219
|
+
typeof item.reservePrice === "number"
|
|
220
|
+
? `Reserve ₹${item.reservePrice.toLocaleString("en-IN")}`
|
|
221
|
+
: null,
|
|
222
|
+
`${typeof item.bidCount === "number" ? item.bidCount : 0} bids`,
|
|
223
|
+
item.auctionEndDate
|
|
224
|
+
? `Ends ${new Date(item.auctionEndDate).toLocaleDateString("en-IN", { month: "short", day: "numeric" })}`
|
|
225
|
+
: null,
|
|
226
|
+
]
|
|
227
|
+
.filter(Boolean)
|
|
228
|
+
.join(" · ")
|
|
229
|
+
: "";
|
|
230
|
+
return {
|
|
231
|
+
id: toStringValue(item.id, `product-${index}`),
|
|
232
|
+
primary: toStringValue(item.title ?? item.name, "Untitled product"),
|
|
233
|
+
secondary: auctionSecondary || toStringValue(item.condition, ""),
|
|
234
|
+
status: toStringValue(item.status, "draft"),
|
|
235
|
+
updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
|
|
236
|
+
imageUrl: toStringValue(item.mainImage ?? item.images?.[0], undefined),
|
|
237
|
+
image: toStringValue(item.mainImage ?? item.images?.[0], undefined),
|
|
238
|
+
listingKind: kind,
|
|
239
|
+
price: priceRaw ? `₹${priceRaw.toLocaleString("en-IN")}` : "—",
|
|
240
|
+
physicalLocation: item.physicalLocation &&
|
|
241
|
+
typeof item.physicalLocation.zone === "string"
|
|
242
|
+
? item.physicalLocation
|
|
243
|
+
: undefined,
|
|
244
|
+
};
|
|
245
|
+
});
|
|
246
|
+
return rows.filter((r) => !deletedIds.has(r.id)).map((r) => statusOverrides.has(r.id) ? { ...r, status: statusOverrides.get(r.id) } : r);
|
|
247
|
+
},
|
|
248
|
+
getTotal: (response, mappedRows) => typeof response.meta?.total === "number" ? response.meta.total : mappedRows.length,
|
|
249
|
+
buildFilters: (state) => {
|
|
250
|
+
const statusFilter = state.status && state.status !== "All" ? sieveFilter("status", SIEVE_OP.EQ, state.status) : undefined;
|
|
251
|
+
const kindFilter = !state.listingType || state.listingType === "all" ? undefined : sieveFilter("listingType", SIEVE_OP.EQ, state.listingType);
|
|
252
|
+
const soldFilter = state.showSold === "true" ? undefined : "isSold==false";
|
|
253
|
+
return [statusFilter, kindFilter, soldFilter].filter(Boolean).join(",") || undefined;
|
|
254
|
+
},
|
|
255
|
+
renderFilterPanel: ({ pendingFilters, setPendingFilters }) => (_jsx(SellerProductsFilterFields, { pendingFilters: pendingFilters, statusOptions: STATUS_OPTIONS, onChange: setPendingFilters })),
|
|
256
|
+
renderAboveContent: () => _jsx(TypeDropdown, { active: listingKind, onChange: handleKindChange }),
|
|
257
|
+
buildBulkActions: (selection) => {
|
|
258
|
+
const handleBulkPrintLabels = () => {
|
|
259
|
+
const ids = selection.selectedIds.join(",");
|
|
260
|
+
void dispatch({
|
|
261
|
+
type: "NAVIGATE",
|
|
262
|
+
href: `${String(ROUTES.STORE.PRINT_CENTER)}?type=product&ids=${ids}&autoprint=1`,
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
return [
|
|
266
|
+
buildBulkAction(ACTIONS.STORE["print-labels"], handleBulkPrintLabels, { icon: _jsx(Printer, { className: "w-4 h-4" }) }),
|
|
267
|
+
buildBulkAction(ACTIONS.STORE["set-location"], () => { setSelectedIdsForLocation(selection.selectedIds); setSetLocationOpen(true); }, { icon: _jsx(MapPin, { className: "w-4 h-4" }) }),
|
|
268
|
+
];
|
|
269
|
+
},
|
|
270
|
+
renderCards: (rows, view, selection, isLoading) => (_jsx(SellerProductsCards, { view: view, rows: rows, isLoading: isLoading, listingKind: listingKind, selectedIds: new Set(selection.selectedIds), toggle: selection.toggleSelect, onEdit: handleEdit, onDuplicate: (row) => void handleDuplicate(row), onDelete: onDeleteProduct ? (row) => void handleDelete(row) : undefined })),
|
|
271
|
+
rowHrefTemplate: (row) => row.listingKind === "auction"
|
|
272
|
+
? `/auctions/${row.id}`
|
|
273
|
+
: row.listingKind === "pre-order"
|
|
274
|
+
? `/pre-orders/${row.id}`
|
|
275
|
+
: `/products/${row.id}`,
|
|
276
|
+
renderRowActions: (row) => {
|
|
277
|
+
const isPublished = (statusOverrides.get(row.id) ?? row.status) === "published";
|
|
278
|
+
return (_jsxs(Row, { gap: "xs", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => { e.stopPropagation(); handleEdit(row); }, "aria-label": ACTIONS.STORE["edit-listing"].ariaLabel, children: _jsx(Pencil, { className: "w-4 h-4" }) }), _jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => { e.stopPropagation(); void handleTogglePublish(row); }, "aria-label": isPublished ? "Unpublish" : "Publish", title: isPublished ? "Unpublish" : "Publish", disabled: publishingId === row.id, children: isPublished ? _jsx(EyeOff, { className: "w-4 h-4" }) : _jsx(Eye, { className: "w-4 h-4" }) }), _jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => { e.stopPropagation(); void handleDuplicate(row); }, "aria-label": "Duplicate listing", title: "Duplicate", children: "\u29C9" }), onDeleteProduct && (_jsx(Button, { variant: "ghost", size: "sm", action: ACTIONS.STORE["delete-listing"], onClick: (e) => { e.stopPropagation(); void handleDelete(row); }, disabled: deletingId === row.id, className: "text-[var(--appkit-color-error)] hover:bg-[var(--appkit-color-border-subtle)]", children: _jsx(Trash2, { className: "w-4 h-4" }) }))] }));
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
|
+
return (_jsxs(_Fragment, { children: [_jsx(DataListingView, { config: config }), setLocationOpen && (_jsx(PhysicalLocationModal, { count: selectedIdsForLocation.length, onSave: (loc) => handleSetLocation(loc, selectedIdsForLocation), onClose: () => setSetLocationOpen(false) }))] }));
|
|
340
282
|
}
|