@mohasinac/appkit 2.7.36 → 2.7.38
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.js +1 -1
- package/dist/_internal/client/features/seller/print-center/InventoryLabel.d.ts +12 -0
- package/dist/_internal/client/features/seller/print-center/InventoryLabel.js +49 -0
- package/dist/_internal/client/features/seller/print-center/LabelDesignPicker.d.ts +7 -0
- package/dist/_internal/client/features/seller/print-center/LabelDesignPicker.js +32 -0
- package/dist/_internal/client/features/seller/print-center/OrderPackingLabel.d.ts +28 -0
- package/dist/_internal/client/features/seller/print-center/OrderPackingLabel.js +33 -0
- package/dist/_internal/client/features/seller/print-center/PhysicalLocationModal.d.ts +12 -0
- package/dist/_internal/client/features/seller/print-center/PhysicalLocationModal.js +30 -0
- package/dist/_internal/client/features/seller/print-center/PrintCenterView.d.ts +12 -0
- package/dist/_internal/client/features/seller/print-center/PrintCenterView.js +102 -0
- package/dist/_internal/client/features/seller/print-center/PrintGrid.d.ts +12 -0
- package/dist/_internal/client/features/seller/print-center/PrintGrid.js +13 -0
- package/dist/_internal/client/features/seller/print-center/StoreCard.d.ts +19 -0
- package/dist/_internal/client/features/seller/print-center/StoreCard.js +30 -0
- package/dist/_internal/client/features/seller/print-center/WebsiteCard.d.ts +11 -0
- package/dist/_internal/client/features/seller/print-center/WebsiteCard.js +25 -0
- package/dist/_internal/client/features/seller/print-center/index.d.ts +11 -0
- package/dist/_internal/client/features/seller/print-center/index.js +10 -0
- package/dist/_internal/client/features/seller/print-center/types.d.ts +20 -0
- package/dist/_internal/client/features/seller/print-center/types.js +20 -0
- package/dist/_internal/client/features/seller/print-center/useInventoryPdf.d.ts +18 -0
- package/dist/_internal/client/features/seller/print-center/useInventoryPdf.js +76 -0
- package/dist/_internal/server/jobs/core/draftPrune.d.ts +2 -0
- package/dist/_internal/server/jobs/core/draftPrune.js +15 -0
- package/dist/_internal/server/jobs/core/onBidPlaced.js +1 -1
- package/dist/_internal/server/jobs/core/promotions.d.ts +1 -0
- package/dist/_internal/server/jobs/core/promotions.js +21 -6
- package/dist/_internal/server/jobs/handlers/assignSpinPrize.js +18 -1
- package/dist/_internal/server/jobs/handlers/draftPrune.d.ts +2 -0
- package/dist/_internal/server/jobs/handlers/draftPrune.js +2 -0
- package/dist/_internal/server/jobs/handlers/index.d.ts +1 -0
- package/dist/_internal/server/jobs/handlers/index.js +2 -0
- package/dist/_internal/server/jobs/handlers/triggerEventRaffle.js +15 -1
- package/dist/_internal/shared/actions/action-registry.js +32 -0
- package/dist/_internal/shared/features/blog/schema.d.ts +8 -8
- package/dist/_internal/shared/features/categories/bundle-schemas.d.ts +10 -10
- package/dist/_internal/shared/features/orders/schema.d.ts +8 -8
- package/dist/_internal/shared/features/products/schema.d.ts +8 -8
- package/dist/_internal/shared/features/promotions/schema.d.ts +6 -6
- package/dist/_internal/shared/features/reviews/schema.d.ts +2 -2
- package/dist/client.d.ts +13 -1
- package/dist/client.js +7 -1
- package/dist/configs/next.js +1 -0
- package/dist/constants/api-endpoints.d.ts +6 -0
- package/dist/constants/api-endpoints.js +2 -0
- package/dist/core/server-action.d.ts +4 -0
- package/dist/errors/error-codes.d.ts +18 -0
- package/dist/errors/error-codes.js +18 -0
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/errors/messages.d.ts +1 -0
- package/dist/errors/messages.js +1 -0
- package/dist/features/account/components/UserSidebar.js +1 -1
- package/dist/features/account/schemas/index.d.ts +12 -12
- package/dist/features/admin/components/AdminSidebar.js +1 -1
- package/dist/features/auctions/actions/bid-actions.js +27 -11
- package/dist/features/auctions/components/PlaceBidFormClient.js +10 -2
- package/dist/features/auctions/repository/bid.repository.d.ts +7 -0
- package/dist/features/auctions/repository/bid.repository.js +16 -0
- package/dist/features/auctions/schemas/index.d.ts +18 -18
- package/dist/features/auth/schemas/index.d.ts +2 -2
- package/dist/features/before-after/schemas/index.d.ts +2 -2
- package/dist/features/blog/actions/blog-actions.d.ts +32 -32
- package/dist/features/blog/components/BlogPostForm.js +1 -1
- package/dist/features/blog/schemas/index.d.ts +38 -38
- package/dist/features/categories/schemas/index.d.ts +10 -10
- package/dist/features/collections/schemas/index.d.ts +4 -4
- package/dist/features/consultation/schemas/index.d.ts +9 -9
- package/dist/features/corporate/schemas/index.d.ts +4 -4
- package/dist/features/events/schemas/index.d.ts +50 -50
- package/dist/features/faq/actions/faq-actions.d.ts +6 -6
- package/dist/features/faq/schemas/index.d.ts +8 -8
- package/dist/features/homepage/actions/homepage-section-actions.d.ts +4 -4
- package/dist/features/layout/AppLayoutShell.js +1 -1
- package/dist/features/layout/AutoBreadcrumbs.js +1 -1
- package/dist/features/media/AvatarUpload.js +1 -1
- package/dist/features/media/types/index.d.ts +4 -4
- package/dist/features/media/upload/ImageUpload.js +18 -9
- package/dist/features/media/upload/MediaUploadList.js +2 -2
- package/dist/features/orders/schemas/firestore.d.ts +6 -0
- package/dist/features/orders/schemas/index.d.ts +10 -10
- package/dist/features/orders/types/index.d.ts +5 -0
- package/dist/features/payments/schemas/index.d.ts +4 -4
- package/dist/features/pre-orders/schemas/index.d.ts +8 -8
- package/dist/features/products/components/PrizeDrawItemsEditor.js +1 -1
- package/dist/features/products/components/ProductDetailActions.d.ts +16 -0
- package/dist/features/products/components/ProductDetailActions.js +94 -0
- package/dist/features/products/components/ProductDetailPageView.d.ts +16 -1
- package/dist/features/products/components/ProductDetailPageView.js +22 -3
- package/dist/features/products/components/ProductForm.js +20 -2
- package/dist/features/products/repository/products.repository.d.ts +3 -1
- package/dist/features/products/repository/products.repository.js +12 -1
- package/dist/features/products/schemas/firestore.d.ts +7 -0
- package/dist/features/products/schemas/index.d.ts +34 -34
- package/dist/features/products/schemas/product-features.validators.d.ts +6 -6
- package/dist/features/products/types/index.d.ts +6 -0
- package/dist/features/promotions/schemas/index.d.ts +14 -14
- package/dist/features/reviews/schemas/index.d.ts +18 -18
- package/dist/features/seller/actions/offer-actions.js +10 -1
- package/dist/features/seller/components/PhysicalLocationModal.d.ts +12 -0
- package/dist/features/seller/components/PhysicalLocationModal.js +30 -0
- package/dist/features/seller/components/PrintCenterView.d.ts +40 -0
- package/dist/features/seller/components/PrintCenterView.js +6 -0
- package/dist/features/seller/components/SellerOrdersView.js +48 -3
- package/dist/features/seller/components/SellerProductShell.d.ts +1 -0
- package/dist/features/seller/components/SellerProductShell.js +26 -4
- package/dist/features/seller/components/SellerProductsView.js +54 -13
- package/dist/features/seller/components/SellerSidebar.js +1 -1
- package/dist/features/seller/components/index.d.ts +1 -0
- package/dist/features/seller/components/index.js +1 -0
- package/dist/features/seller/schemas/firestore.d.ts +2 -0
- package/dist/features/seller/schemas/firestore.js +1 -0
- package/dist/features/seller/schemas/index.d.ts +22 -22
- package/dist/features/shell/FormShell.js +1 -1
- package/dist/features/shell/StepForm.d.ts +3 -1
- package/dist/features/shell/StepForm.js +3 -3
- package/dist/features/stores/schemas/index.d.ts +4 -4
- package/dist/index.d.ts +9 -1
- package/dist/index.js +6 -1
- package/dist/next/routing/route-map.d.ts +8 -0
- package/dist/next/routing/route-map.js +3 -0
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/components/RowActionMenu.js +45 -10
- package/dist/ui/components/SideDrawer.style.css +2 -2
- package/dist/ui/forms/FieldCheckbox.d.ts +13 -0
- package/dist/ui/forms/FieldCheckbox.js +25 -0
- package/dist/ui/forms/FieldInput.d.ts +11 -0
- package/dist/ui/forms/FieldInput.js +25 -0
- package/dist/ui/forms/FieldSelect.d.ts +17 -0
- package/dist/ui/forms/FieldSelect.js +25 -0
- package/dist/ui/forms/FormShell.d.ts +48 -0
- package/dist/ui/forms/FormShell.js +176 -0
- package/dist/ui/forms/FormShell.style.css +287 -0
- package/dist/ui/forms/index.d.ts +8 -0
- package/dist/ui/forms/index.js +4 -0
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.js +5 -0
- package/dist/utils/action-response.d.ts +6 -0
- package/dist/utils/action-response.js +22 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/validation/schemas.d.ts +10 -10
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -57,6 +57,14 @@ export { OtpInput } from "./ui/components/OtpInput";
|
|
|
57
57
|
export type { OtpInputProps } from "./ui/components/OtpInput";
|
|
58
58
|
export { DateInput, DateRangeInput } from "./ui/components/DateInput";
|
|
59
59
|
export type { DateInputProps, DateRangeInputProps } from "./ui/components/DateInput";
|
|
60
|
+
export type { FormShellProps, FormShellStep, FormShellContextValue } from "./ui/forms";
|
|
61
|
+
export { FormShell, useFormShell } from "./ui/forms";
|
|
62
|
+
export type { FieldInputProps } from "./ui/forms";
|
|
63
|
+
export { FieldInput } from "./ui/forms";
|
|
64
|
+
export type { FieldSelectProps } from "./ui/forms";
|
|
65
|
+
export { FieldSelect } from "./ui/forms";
|
|
66
|
+
export type { FieldCheckboxProps } from "./ui/forms";
|
|
67
|
+
export { FieldCheckbox } from "./ui/forms";
|
|
60
68
|
export { Select } from "./ui/components/Select";
|
|
61
69
|
export type { SelectOption, SelectProps } from "./ui/components/Select";
|
|
62
70
|
export { Heading } from "./ui/components/Typography";
|
|
@@ -153,6 +161,8 @@ export { usePanelUrlSync } from "./react/hooks/use-panel-url-sync";
|
|
|
153
161
|
export type { PanelUrlSync } from "./react/hooks/use-panel-url-sync";
|
|
154
162
|
export { MakeOfferButton } from "./features/products/components/MakeOfferButton";
|
|
155
163
|
export type { MakeOfferButtonProps } from "./features/products/components/MakeOfferButton";
|
|
164
|
+
export { ProductDetailActions } from "./features/products/components/ProductDetailActions";
|
|
165
|
+
export type { ProductDetailActionsProps } from "./features/products/components/ProductDetailActions";
|
|
156
166
|
export { ProductFeaturesProvider, useProductFeatures, } from "./features/products/components/ProductFeaturesContext";
|
|
157
167
|
export type { ProductFeaturesProviderProps } from "./features/products/components/ProductFeaturesContext";
|
|
158
168
|
export { FeatureBadge, FeatureBadgeList } from "./features/products/components/FeatureBadge";
|
|
@@ -163,7 +173,7 @@ export { UserOffersPanel } from "./features/account/components/UserOffersPanel";
|
|
|
163
173
|
export type { UserOffersPanelProps } from "./features/account/components/UserOffersPanel";
|
|
164
174
|
export { SellerDashboardView as StoreDashboardView, SellerDashboardView, useSellerDashboard as useStoreDashboard, useSellerDashboard } from "./features/seller/index";
|
|
165
175
|
export type { SellerDashboardViewProps as StoreDashboardViewProps, SellerDashboardViewProps } from "./features/seller/index";
|
|
166
|
-
export { SellerPayoutSettingsView, SellerShippingView, SellerReviewsView, SellerPayoutRequestView, SellerAnalyticsStats, SellerTopProducts, SellerAnalyticsView, SellerPayoutsView, SellerCouponEditorView, SellerBidsView, SellerAddressesView, SellerPreOrdersView, SellerPrizeDrawsView } from "./features/seller/components/index";
|
|
176
|
+
export { SellerPayoutSettingsView, SellerShippingView, SellerReviewsView, SellerPayoutRequestView, SellerAnalyticsStats, SellerTopProducts, SellerAnalyticsView, SellerPayoutsView, SellerCouponEditorView, SellerBidsView, SellerAddressesView, SellerPreOrdersView, SellerPrizeDrawsView, PrintCenterView } from "./features/seller/components/index";
|
|
167
177
|
export type { SellerPayoutSettingsViewProps, SellerShippingViewProps, SellerReviewsViewProps, SellerPayoutRequestViewProps, SellerAnalyticsViewProps, SellerPayoutsViewProps, SellerCouponEditorViewProps, CouponEditorDraft, SellerBidsViewProps, SellerAddressesViewProps, SellerPreOrdersViewProps, SellerPrizeDrawsViewProps } from "./features/seller/components/index";
|
|
168
178
|
export type { SellerAnalyticsSummary, SellerAnalyticsTopProduct } from "./features/seller/types/index";
|
|
169
179
|
export { UserAccountHubView, UserOrdersView, OrderDetailView, UserNotificationsView, UserReturnsView, UserSupportView } from "./features/account/index";
|
|
@@ -216,3 +226,5 @@ export { DigitalCodeDetailView } from "./_internal/client/features/digital-code/
|
|
|
216
226
|
export type { DigitalCodeDetailViewProps } from "./_internal/client/features/digital-code/DigitalCodeDetailView";
|
|
217
227
|
export { LiveItemDetailView } from "./_internal/client/features/live/LiveItemDetailView";
|
|
218
228
|
export type { LiveItemDetailViewProps } from "./_internal/client/features/live/LiveItemDetailView";
|
|
229
|
+
export { PhysicalLocationModal } from "./features/seller/components/PhysicalLocationModal";
|
|
230
|
+
export type { PhysicalLocation } from "./features/seller/components/PhysicalLocationModal";
|
package/dist/client.js
CHANGED
|
@@ -123,6 +123,10 @@ export { Checkbox } from "./ui/components/Checkbox";
|
|
|
123
123
|
export { Input } from "./ui/components/Input";
|
|
124
124
|
export { OtpInput } from "./ui/components/OtpInput";
|
|
125
125
|
export { DateInput, DateRangeInput } from "./ui/components/DateInput";
|
|
126
|
+
export { FormShell, useFormShell } from "./ui/forms";
|
|
127
|
+
export { FieldInput } from "./ui/forms";
|
|
128
|
+
export { FieldSelect } from "./ui/forms";
|
|
129
|
+
export { FieldCheckbox } from "./ui/forms";
|
|
126
130
|
export { Select } from "./ui/components/Select";
|
|
127
131
|
export { Heading } from "./ui/components/Typography";
|
|
128
132
|
export { Label, Text } from "./ui/components/Typography";
|
|
@@ -186,13 +190,14 @@ export { useActionDispatch } from "./react/hooks/use-action-dispatch";
|
|
|
186
190
|
export { usePanelStore } from "./stores/panel-store";
|
|
187
191
|
export { usePanelUrlSync } from "./react/hooks/use-panel-url-sync";
|
|
188
192
|
export { MakeOfferButton } from "./features/products/components/MakeOfferButton";
|
|
193
|
+
export { ProductDetailActions } from "./features/products/components/ProductDetailActions";
|
|
189
194
|
// productFeatures (FI6) — client-safe components + context
|
|
190
195
|
export { ProductFeaturesProvider, useProductFeatures, } from "./features/products/components/ProductFeaturesContext";
|
|
191
196
|
export { FeatureBadge, FeatureBadgeList } from "./features/products/components/FeatureBadge";
|
|
192
197
|
export { SellerOffersPanel } from "./features/seller/components/SellerOffersPanel";
|
|
193
198
|
export { UserOffersPanel } from "./features/account/components/UserOffersPanel";
|
|
194
199
|
export { SellerDashboardView as StoreDashboardView, SellerDashboardView, useSellerDashboard as useStoreDashboard, useSellerDashboard } from "./features/seller/index";
|
|
195
|
-
export { SellerPayoutSettingsView, SellerShippingView, SellerReviewsView, SellerPayoutRequestView, SellerAnalyticsStats, SellerTopProducts, SellerAnalyticsView, SellerPayoutsView, SellerCouponEditorView, SellerBidsView, SellerAddressesView, SellerPreOrdersView, SellerPrizeDrawsView } from "./features/seller/components/index";
|
|
200
|
+
export { SellerPayoutSettingsView, SellerShippingView, SellerReviewsView, SellerPayoutRequestView, SellerAnalyticsStats, SellerTopProducts, SellerAnalyticsView, SellerPayoutsView, SellerCouponEditorView, SellerBidsView, SellerAddressesView, SellerPreOrdersView, SellerPrizeDrawsView, PrintCenterView } from "./features/seller/components/index";
|
|
196
201
|
export { UserAccountHubView, UserOrdersView, OrderDetailView, UserNotificationsView, UserReturnsView, UserSupportView } from "./features/account/index";
|
|
197
202
|
export { useOrders, useOrder, OrdersList } from "./features/orders/index";
|
|
198
203
|
export { useCouponValidate } from "./features/promotions/hooks/useCouponValidate";
|
|
@@ -238,3 +243,4 @@ export { NavPermissionsManager } from "./features/site-settings/components/NavPe
|
|
|
238
243
|
export { ClassifiedDetailView } from "./_internal/client/features/classified/ClassifiedDetailView";
|
|
239
244
|
export { DigitalCodeDetailView } from "./_internal/client/features/digital-code/DigitalCodeDetailView";
|
|
240
245
|
export { LiveItemDetailView } from "./_internal/client/features/live/LiveItemDetailView";
|
|
246
|
+
export { PhysicalLocationModal } from "./features/seller/components/PhysicalLocationModal";
|
package/dist/configs/next.js
CHANGED
|
@@ -263,6 +263,7 @@ export function defineNextConfig(override = {}) {
|
|
|
263
263
|
const defaultRemotePatterns = [
|
|
264
264
|
{ protocol: "https", hostname: "firebasestorage.googleapis.com" },
|
|
265
265
|
{ protocol: "https", hostname: "*.firebasestorage.googleapis.com" },
|
|
266
|
+
{ protocol: "https", hostname: "storage.googleapis.com" },
|
|
266
267
|
{ protocol: "http", hostname: "localhost" },
|
|
267
268
|
{ protocol: "http", hostname: "127.0.0.1" },
|
|
268
269
|
];
|
|
@@ -264,6 +264,8 @@ export declare const SELLER_ENDPOINTS: {
|
|
|
264
264
|
readonly ANALYTICS: (period?: string) => string;
|
|
265
265
|
readonly FEATURES: "/api/store/features";
|
|
266
266
|
readonly FEATURE_BY_ID: (id: string) => string;
|
|
267
|
+
readonly PRODUCTS_BULK_LOCATION: "/api/store/products/bulk-location";
|
|
268
|
+
readonly ORDERS_BULK_LOCATION: "/api/store/orders/bulk-location";
|
|
267
269
|
};
|
|
268
270
|
export declare const BLOG_ENDPOINTS: {
|
|
269
271
|
readonly LIST: "/api/blog";
|
|
@@ -570,6 +572,8 @@ export declare const API_ENDPOINTS: {
|
|
|
570
572
|
readonly ANALYTICS: (period?: string) => string;
|
|
571
573
|
readonly FEATURES: "/api/store/features";
|
|
572
574
|
readonly FEATURE_BY_ID: (id: string) => string;
|
|
575
|
+
readonly PRODUCTS_BULK_LOCATION: "/api/store/products/bulk-location";
|
|
576
|
+
readonly ORDERS_BULK_LOCATION: "/api/store/orders/bulk-location";
|
|
573
577
|
};
|
|
574
578
|
readonly BLOG: {
|
|
575
579
|
readonly LIST: "/api/blog";
|
|
@@ -875,6 +879,8 @@ export declare const API_ROUTES: {
|
|
|
875
879
|
readonly ANALYTICS: (period?: string) => string;
|
|
876
880
|
readonly FEATURES: "/api/store/features";
|
|
877
881
|
readonly FEATURE_BY_ID: (id: string) => string;
|
|
882
|
+
readonly PRODUCTS_BULK_LOCATION: "/api/store/products/bulk-location";
|
|
883
|
+
readonly ORDERS_BULK_LOCATION: "/api/store/orders/bulk-location";
|
|
878
884
|
};
|
|
879
885
|
readonly BLOG: {
|
|
880
886
|
readonly LIST: "/api/blog";
|
|
@@ -353,6 +353,8 @@ export const SELLER_ENDPOINTS = {
|
|
|
353
353
|
ANALYTICS: (period) => `/api/store/analytics${period ? `?period=${period}` : ""}`,
|
|
354
354
|
FEATURES: "/api/store/features",
|
|
355
355
|
FEATURE_BY_ID: (id) => `/api/store/features/${id}`,
|
|
356
|
+
PRODUCTS_BULK_LOCATION: "/api/store/products/bulk-location",
|
|
357
|
+
ORDERS_BULK_LOCATION: "/api/store/orders/bulk-location",
|
|
356
358
|
};
|
|
357
359
|
// ---------------------------------------------------------------------------
|
|
358
360
|
// Blog
|
|
@@ -40,7 +40,11 @@ export type ActionResult<TOutput> = {
|
|
|
40
40
|
} | {
|
|
41
41
|
ok: false;
|
|
42
42
|
error: string;
|
|
43
|
+
code?: string;
|
|
43
44
|
fieldErrors?: Record<string, string[]>;
|
|
45
|
+
debug?: {
|
|
46
|
+
stack?: string;
|
|
47
|
+
};
|
|
44
48
|
};
|
|
45
49
|
export interface ActionMiddlewareContext<TInput = unknown, TOutput = unknown> {
|
|
46
50
|
actionName: string;
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
export declare const BID_ERROR_CODES: {
|
|
2
|
+
readonly PRODUCT_NOT_FOUND: "BID_PRODUCT_NOT_FOUND";
|
|
3
|
+
readonly NOT_AUCTION: "BID_NOT_AUCTION";
|
|
4
|
+
readonly AUCTION_ENDED: "BID_AUCTION_ENDED";
|
|
5
|
+
readonly TOO_LOW: "BID_AMOUNT_TOO_LOW";
|
|
6
|
+
readonly INCREMENT_VIOLATED: "BID_INCREMENT_TOO_LOW";
|
|
7
|
+
readonly SELF_BID: "BID_SELF_BID";
|
|
8
|
+
readonly USER_BANNED: "BID_USER_BANNED";
|
|
9
|
+
};
|
|
10
|
+
export declare const OFFER_ERROR_CODES: {
|
|
11
|
+
readonly DISABLED: "OFFER_DISABLED";
|
|
12
|
+
readonly PRICE_TOO_LOW: "OFFER_PRICE_TOO_LOW";
|
|
13
|
+
readonly LIMIT_REACHED: "OFFER_LIMIT_REACHED";
|
|
14
|
+
readonly ALREADY_ACTIVE: "OFFER_ALREADY_ACTIVE";
|
|
15
|
+
readonly EXPIRED: "OFFER_EXPIRED";
|
|
16
|
+
readonly CHECKOUT_EXPIRED: "OFFER_CHECKOUT_EXPIRED";
|
|
17
|
+
readonly WRONG_STATE: "OFFER_WRONG_STATE";
|
|
18
|
+
};
|
|
1
19
|
export declare const ERROR_CODES: {
|
|
2
20
|
readonly AUTH_INVALID_CREDENTIALS: "AUTH_001";
|
|
3
21
|
readonly AUTH_TOKEN_EXPIRED: "AUTH_002";
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
export const BID_ERROR_CODES = {
|
|
2
|
+
PRODUCT_NOT_FOUND: "BID_PRODUCT_NOT_FOUND",
|
|
3
|
+
NOT_AUCTION: "BID_NOT_AUCTION",
|
|
4
|
+
AUCTION_ENDED: "BID_AUCTION_ENDED",
|
|
5
|
+
TOO_LOW: "BID_AMOUNT_TOO_LOW",
|
|
6
|
+
INCREMENT_VIOLATED: "BID_INCREMENT_TOO_LOW",
|
|
7
|
+
SELF_BID: "BID_SELF_BID",
|
|
8
|
+
USER_BANNED: "BID_USER_BANNED",
|
|
9
|
+
};
|
|
10
|
+
export const OFFER_ERROR_CODES = {
|
|
11
|
+
DISABLED: "OFFER_DISABLED",
|
|
12
|
+
PRICE_TOO_LOW: "OFFER_PRICE_TOO_LOW",
|
|
13
|
+
LIMIT_REACHED: "OFFER_LIMIT_REACHED",
|
|
14
|
+
ALREADY_ACTIVE: "OFFER_ALREADY_ACTIVE",
|
|
15
|
+
EXPIRED: "OFFER_EXPIRED",
|
|
16
|
+
CHECKOUT_EXPIRED: "OFFER_CHECKOUT_EXPIRED",
|
|
17
|
+
WRONG_STATE: "OFFER_WRONG_STATE",
|
|
18
|
+
};
|
|
1
19
|
export const ERROR_CODES = {
|
|
2
20
|
// Authentication
|
|
3
21
|
AUTH_INVALID_CREDENTIALS: "AUTH_001",
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AppError } from "./base-error";
|
|
2
|
-
export { ERROR_CODES } from "./error-codes";
|
|
2
|
+
export { ERROR_CODES, BID_ERROR_CODES, OFFER_ERROR_CODES } from "./error-codes";
|
|
3
3
|
export type { ErrorCode } from "./error-codes";
|
|
4
4
|
export { ERROR_MESSAGES } from "./messages";
|
|
5
5
|
export { ApiError } from "./api-error";
|
package/dist/errors/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AppError } from "./base-error";
|
|
2
|
-
export { ERROR_CODES } from "./error-codes";
|
|
2
|
+
export { ERROR_CODES, BID_ERROR_CODES, OFFER_ERROR_CODES } from "./error-codes";
|
|
3
3
|
export { ERROR_MESSAGES } from "./messages";
|
|
4
4
|
// Note: appkit/src/errors has two ERROR_MESSAGE patterns:
|
|
5
5
|
// - ERROR_CODES.AUTH_001 → "Invalid email or password" (code-based)
|
|
@@ -345,6 +345,7 @@ export declare const ERROR_MESSAGES: {
|
|
|
345
345
|
readonly AUCTION_NOT_FOUND: "Auction product not found";
|
|
346
346
|
readonly NOT_AN_AUCTION: "This product is not an auction";
|
|
347
347
|
readonly BID_TOO_LOW: "Your bid must be higher than the current bid";
|
|
348
|
+
readonly INCREMENT_TOO_LOW: "Your bid does not meet the minimum increment requirement";
|
|
348
349
|
readonly OWN_AUCTION: "You cannot bid on your own auction";
|
|
349
350
|
};
|
|
350
351
|
readonly CONTACT: {
|
package/dist/errors/messages.js
CHANGED
|
@@ -372,6 +372,7 @@ export const ERROR_MESSAGES = {
|
|
|
372
372
|
AUCTION_NOT_FOUND: "Auction product not found",
|
|
373
373
|
NOT_AN_AUCTION: "This product is not an auction",
|
|
374
374
|
BID_TOO_LOW: "Your bid must be higher than the current bid",
|
|
375
|
+
INCREMENT_TOO_LOW: "Your bid does not meet the minimum increment requirement",
|
|
375
376
|
OWN_AUCTION: "You cannot bid on your own auction",
|
|
376
377
|
},
|
|
377
378
|
CONTACT: {
|
|
@@ -63,7 +63,7 @@ export function UserSidebar({ items, groups, mobileOpen = false, onCloseMobile,
|
|
|
63
63
|
height: "calc(100vh - var(--header-height, 3.5rem))",
|
|
64
64
|
width: "13rem",
|
|
65
65
|
transform: desktopOpen ? "translateX(0)" : "translateX(calc(-100% + 1.25rem))",
|
|
66
|
-
}, children: [_jsxs("div", { className: "flex-1 bg-white dark:bg-slate-900 border-r border-zinc-200 dark:border-slate-800 flex flex-col overflow-hidden shadow-xl", children: [_jsx("div", { className: "px-4 py-3.5 border-b border-zinc-100 dark:border-slate-800 shrink-0", children: _jsx("span", { className: "text-xs font-semibold uppercase tracking-widest text-zinc-400 dark:text-zinc-500", children: "My Account" }) }), _jsx("div", { className: "flex-1 overflow-y-auto", children: _jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname }) })] }), _jsx("button", { type: "button", onClick: handleToggle, "aria-label": desktopOpen ? "Collapse sidebar" : "Expand sidebar", className: "w-
|
|
66
|
+
}, children: [_jsxs("div", { className: "flex-1 bg-white dark:bg-slate-900 border-r border-zinc-200 dark:border-slate-800 flex flex-col overflow-hidden shadow-xl", children: [_jsx("div", { className: "px-4 py-3.5 border-b border-zinc-100 dark:border-slate-800 shrink-0", children: _jsx("span", { className: "text-xs font-semibold uppercase tracking-widest text-zinc-400 dark:text-zinc-500", children: "My Account" }) }), _jsx("div", { className: "flex-1 overflow-y-auto", children: _jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname }) })] }), _jsx("button", { type: "button", onClick: handleToggle, "aria-label": desktopOpen ? "Collapse sidebar" : "Expand sidebar", className: "w-9 shrink-0 flex items-center justify-center cursor-pointer rounded-r-[1.25rem] shadow-lg transition-all duration-200 hover:shadow-xl hover:brightness-110 active:scale-[0.96]", style: { background: "linear-gradient(to bottom, var(--appkit-color-primary-700, var(--appkit-color-primary)), var(--appkit-color-secondary-500, var(--appkit-color-secondary)))" }, children: _jsx("svg", { className: `w-4 h-4 text-white drop-shadow-sm transition-transform duration-300 ${desktopOpen ? "" : "rotate-180"}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M15 19l-7-7 7-7" }) }) })] }), _jsx("div", { className: "md:hidden", children: _jsx(BottomSheet, { open: mobileOpen, onClose: close, title: "My Account", children: _jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname, onItemClick: close }) }) })] }));
|
|
67
67
|
}
|
|
68
68
|
// ── Overlay variant (default) — portal on desktop, bottom-sheet on mobile ─
|
|
69
69
|
const content = (_jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname, onItemClick: close }));
|
|
@@ -18,8 +18,8 @@ export declare const userAddressSchema: z.ZodObject<{
|
|
|
18
18
|
city: string;
|
|
19
19
|
postalCode: string;
|
|
20
20
|
line1: string;
|
|
21
|
-
label?: string | undefined;
|
|
22
21
|
phone?: string | undefined;
|
|
22
|
+
label?: string | undefined;
|
|
23
23
|
isDefault?: boolean | undefined;
|
|
24
24
|
line2?: string | undefined;
|
|
25
25
|
}, {
|
|
@@ -29,8 +29,8 @@ export declare const userAddressSchema: z.ZodObject<{
|
|
|
29
29
|
city: string;
|
|
30
30
|
postalCode: string;
|
|
31
31
|
line1: string;
|
|
32
|
-
label?: string | undefined;
|
|
33
32
|
phone?: string | undefined;
|
|
33
|
+
label?: string | undefined;
|
|
34
34
|
isDefault?: boolean | undefined;
|
|
35
35
|
line2?: string | undefined;
|
|
36
36
|
}>;
|
|
@@ -89,8 +89,8 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
89
89
|
city: string;
|
|
90
90
|
postalCode: string;
|
|
91
91
|
line1: string;
|
|
92
|
-
label?: string | undefined;
|
|
93
92
|
phone?: string | undefined;
|
|
93
|
+
label?: string | undefined;
|
|
94
94
|
isDefault?: boolean | undefined;
|
|
95
95
|
line2?: string | undefined;
|
|
96
96
|
}, {
|
|
@@ -100,8 +100,8 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
100
100
|
city: string;
|
|
101
101
|
postalCode: string;
|
|
102
102
|
line1: string;
|
|
103
|
-
label?: string | undefined;
|
|
104
103
|
phone?: string | undefined;
|
|
104
|
+
label?: string | undefined;
|
|
105
105
|
isDefault?: boolean | undefined;
|
|
106
106
|
line2?: string | undefined;
|
|
107
107
|
}>, "many">>;
|
|
@@ -128,11 +128,11 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
128
128
|
updatedAt: z.ZodOptional<z.ZodString>;
|
|
129
129
|
}, "strip", z.ZodTypeAny, {
|
|
130
130
|
id: string;
|
|
131
|
+
phone?: string | undefined;
|
|
131
132
|
createdAt?: string | undefined;
|
|
132
133
|
updatedAt?: string | undefined;
|
|
133
|
-
displayName?: string | undefined;
|
|
134
134
|
email?: string | undefined;
|
|
135
|
-
|
|
135
|
+
displayName?: string | undefined;
|
|
136
136
|
addresses?: {
|
|
137
137
|
country: string;
|
|
138
138
|
id: string;
|
|
@@ -140,8 +140,8 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
140
140
|
city: string;
|
|
141
141
|
postalCode: string;
|
|
142
142
|
line1: string;
|
|
143
|
-
label?: string | undefined;
|
|
144
143
|
phone?: string | undefined;
|
|
144
|
+
label?: string | undefined;
|
|
145
145
|
isDefault?: boolean | undefined;
|
|
146
146
|
line2?: string | undefined;
|
|
147
147
|
}[] | undefined;
|
|
@@ -156,11 +156,11 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
156
156
|
bio?: string | undefined;
|
|
157
157
|
}, {
|
|
158
158
|
id: string;
|
|
159
|
+
phone?: string | undefined;
|
|
159
160
|
createdAt?: string | undefined;
|
|
160
161
|
updatedAt?: string | undefined;
|
|
161
|
-
displayName?: string | undefined;
|
|
162
162
|
email?: string | undefined;
|
|
163
|
-
|
|
163
|
+
displayName?: string | undefined;
|
|
164
164
|
addresses?: {
|
|
165
165
|
country: string;
|
|
166
166
|
id: string;
|
|
@@ -168,8 +168,8 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
168
168
|
city: string;
|
|
169
169
|
postalCode: string;
|
|
170
170
|
line1: string;
|
|
171
|
-
label?: string | undefined;
|
|
172
171
|
phone?: string | undefined;
|
|
172
|
+
label?: string | undefined;
|
|
173
173
|
isDefault?: boolean | undefined;
|
|
174
174
|
line2?: string | undefined;
|
|
175
175
|
}[] | undefined;
|
|
@@ -188,11 +188,11 @@ export declare const updateProfileSchema: z.ZodObject<{
|
|
|
188
188
|
phone: z.ZodOptional<z.ZodString>;
|
|
189
189
|
bio: z.ZodOptional<z.ZodString>;
|
|
190
190
|
}, "strip", z.ZodTypeAny, {
|
|
191
|
-
displayName?: string | undefined;
|
|
192
191
|
phone?: string | undefined;
|
|
192
|
+
displayName?: string | undefined;
|
|
193
193
|
bio?: string | undefined;
|
|
194
194
|
}, {
|
|
195
|
-
displayName?: string | undefined;
|
|
196
195
|
phone?: string | undefined;
|
|
196
|
+
displayName?: string | undefined;
|
|
197
197
|
bio?: string | undefined;
|
|
198
198
|
}>;
|
|
@@ -47,7 +47,7 @@ export function AdminSidebar({ renderNavItems, renderHeader, renderFooter, activ
|
|
|
47
47
|
height: "calc(100vh - var(--header-height, 3.5rem))",
|
|
48
48
|
width: "18rem",
|
|
49
49
|
transform: desktopOpen ? "translateX(0)" : "translateX(calc(-100% + 1.25rem))",
|
|
50
|
-
}, children: [_jsxs("div", { className: "flex-1 bg-white dark:bg-slate-950 border-r border-zinc-200 dark:border-slate-800 flex flex-col overflow-hidden shadow-xl", children: [_jsx("div", { className: "px-4 py-3.5 border-b border-zinc-100 dark:border-slate-800 shrink-0", children: renderHeader ? renderHeader() : _jsx("span", { className: "text-xs font-semibold uppercase tracking-widest text-zinc-400 dark:text-zinc-500", children: "Admin Panel" }) }), _jsx("div", { className: "flex-1 overflow-y-auto", children: navContent }), renderFooter && _jsx("div", { className: "px-4 py-3 border-t border-zinc-200 dark:border-slate-800", children: renderFooter() })] }), _jsx("button", { type: "button", onClick: handleToggle, "aria-label": desktopOpen ? "Collapse sidebar" : "Expand sidebar", className: "w-
|
|
50
|
+
}, children: [_jsxs("div", { className: "flex-1 bg-white dark:bg-slate-950 border-r border-zinc-200 dark:border-slate-800 flex flex-col overflow-hidden shadow-xl", children: [_jsx("div", { className: "px-4 py-3.5 border-b border-zinc-100 dark:border-slate-800 shrink-0", children: renderHeader ? renderHeader() : _jsx("span", { className: "text-xs font-semibold uppercase tracking-widest text-zinc-400 dark:text-zinc-500", children: "Admin Panel" }) }), _jsx("div", { className: "flex-1 overflow-y-auto", children: navContent }), renderFooter && _jsx("div", { className: "px-4 py-3 border-t border-zinc-200 dark:border-slate-800", children: renderFooter() })] }), _jsx("button", { type: "button", onClick: handleToggle, "aria-label": desktopOpen ? "Collapse sidebar" : "Expand sidebar", className: "w-9 shrink-0 flex items-center justify-center cursor-pointer rounded-r-[1.25rem] shadow-lg transition-all duration-200 hover:shadow-xl hover:brightness-110 active:scale-[0.96]", style: { background: "linear-gradient(to bottom, #1343de, #3570fc)" }, children: _jsx("svg", { className: `w-4 h-4 text-white drop-shadow-sm transition-transform duration-300 ${desktopOpen ? "" : "rotate-180"}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M15 19l-7-7 7-7" }) }) })] }), _jsx("div", { className: "md:hidden", children: _jsx(BottomSheet, { open: mobileOpen, onClose: close, title: "Admin Panel", children: mobileNavContent }) })] }));
|
|
51
51
|
}
|
|
52
52
|
return (_jsxs(_Fragment, { children: [mounted && mobileOpen &&
|
|
53
53
|
createPortal(_jsx(DrawerPanel, { title: "Admin Panel", onClose: close, children: navContent }), document.body), _jsx("div", { className: "md:hidden", children: _jsx(BottomSheet, { open: mobileOpen, onClose: close, title: "Admin Panel", children: mobileNavContent }) })] }));
|
|
@@ -14,6 +14,8 @@ import { storeRepository } from "../../stores/repository/store.repository";
|
|
|
14
14
|
import { getAdminRealtimeDb } from "../../../providers/db-firebase";
|
|
15
15
|
import { maskPublicBid } from "../../../security";
|
|
16
16
|
import { ERROR_MESSAGES, AuthorizationError, ValidationError, NotFoundError, } from "../../../errors";
|
|
17
|
+
import { BID_ERROR_CODES } from "../../../errors/error-codes";
|
|
18
|
+
import { increment } from "../../../contracts/field-ops";
|
|
17
19
|
import { getDefaultCurrency } from "../../../core/baseline-resolver";
|
|
18
20
|
import { resolveDate } from "../../../utils";
|
|
19
21
|
// --- Domain Functions ----------------------------------------------------------
|
|
@@ -27,7 +29,7 @@ export async function placeBid(userId, userEmail, input) {
|
|
|
27
29
|
if (product.auctionEndDate) {
|
|
28
30
|
const endDate = resolveDate(product.auctionEndDate);
|
|
29
31
|
if (endDate && endDate.getTime() < Date.now()) {
|
|
30
|
-
throw new ValidationError(ERROR_MESSAGES.BID.AUCTION_ENDED);
|
|
32
|
+
throw new ValidationError(ERROR_MESSAGES.BID.AUCTION_ENDED, { code: BID_ERROR_CODES.AUCTION_ENDED });
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
if (product.storeId) {
|
|
@@ -36,11 +38,15 @@ export async function placeBid(userId, userEmail, input) {
|
|
|
36
38
|
throw new AuthorizationError(ERROR_MESSAGES.BID.OWN_AUCTION);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
|
-
const
|
|
41
|
+
const baseBid = (product.currentBid ?? 0) > 0
|
|
40
42
|
? product.currentBid
|
|
41
43
|
: (product.startingBid ?? product.price);
|
|
42
|
-
if (bidAmount <=
|
|
43
|
-
throw new ValidationError(ERROR_MESSAGES.BID.BID_TOO_LOW);
|
|
44
|
+
if (bidAmount <= baseBid) {
|
|
45
|
+
throw new ValidationError(ERROR_MESSAGES.BID.BID_TOO_LOW, { code: BID_ERROR_CODES.TOO_LOW });
|
|
46
|
+
}
|
|
47
|
+
const minIncrement = product.minBidIncrement ?? 100;
|
|
48
|
+
if (bidAmount < baseBid + minIncrement) {
|
|
49
|
+
throw new ValidationError(ERROR_MESSAGES.BID.INCREMENT_TOO_LOW, { code: BID_ERROR_CODES.INCREMENT_VIOLATED });
|
|
44
50
|
}
|
|
45
51
|
const profile = await userRepository.findById(userId);
|
|
46
52
|
const bid = await bidRepository.create({
|
|
@@ -54,24 +60,34 @@ export async function placeBid(userId, userEmail, input) {
|
|
|
54
60
|
bidDate: new Date(),
|
|
55
61
|
...(autoMaxBid ? { autoMaxBid } : {}),
|
|
56
62
|
});
|
|
57
|
-
|
|
63
|
+
// Only flip the previous winning bid (if any) — no need to rewrite every
|
|
64
|
+
// historical bid each time, which previously exceeded Firestore's 500-op
|
|
65
|
+
// batch cap on auctions with hundreds of bids ("Batch write failed").
|
|
66
|
+
const previousWinner = await bidRepository
|
|
67
|
+
.getWinningBid(productId)
|
|
68
|
+
.catch(() => null);
|
|
58
69
|
await unitOfWork.runBatch((batch) => {
|
|
59
|
-
|
|
60
|
-
unitOfWork.bids.updateInBatch(batch,
|
|
61
|
-
isWinning:
|
|
62
|
-
status:
|
|
70
|
+
if (previousWinner && previousWinner.data.id !== bid.id) {
|
|
71
|
+
unitOfWork.bids.updateInBatch(batch, previousWinner.data.id, {
|
|
72
|
+
isWinning: false,
|
|
73
|
+
status: "outbid",
|
|
63
74
|
});
|
|
64
75
|
}
|
|
76
|
+
unitOfWork.bids.updateInBatch(batch, bid.id, {
|
|
77
|
+
isWinning: true,
|
|
78
|
+
status: "active",
|
|
79
|
+
});
|
|
65
80
|
unitOfWork.products.updateInBatch(batch, productId, {
|
|
66
81
|
currentBid: bidAmount,
|
|
67
|
-
bidCount: (
|
|
82
|
+
bidCount: increment(1),
|
|
83
|
+
leadingBidderId: userId,
|
|
84
|
+
bidsHaveStarted: true,
|
|
68
85
|
});
|
|
69
86
|
});
|
|
70
87
|
try {
|
|
71
88
|
const rtdb = getAdminRealtimeDb();
|
|
72
89
|
await rtdb.ref(`/auction-bids/${productId}`).set({
|
|
73
90
|
currentBid: bidAmount,
|
|
74
|
-
bidCount: (product.bidCount ?? 0) + 1,
|
|
75
91
|
lastBid: {
|
|
76
92
|
amount: bidAmount,
|
|
77
93
|
bidderName: "Bidder",
|
|
@@ -4,6 +4,13 @@ import { useState, useTransition } from "react";
|
|
|
4
4
|
import { formatCurrency } from "../../../utils/number.formatter";
|
|
5
5
|
import { isAuthError } from "../../../utils/auth-error";
|
|
6
6
|
import { Button, Div, Input, LoginRequiredModal, Row, Span, Stack, Text } from "../../../ui";
|
|
7
|
+
const BID_ERROR_DISPLAY = {
|
|
8
|
+
BID_AUCTION_ENDED: "This auction has closed. No more bids are accepted.",
|
|
9
|
+
BID_AMOUNT_TOO_LOW: "Your bid must exceed the current winning bid.",
|
|
10
|
+
BID_INCREMENT_TOO_LOW: "Your bid does not meet the minimum increment requirement.",
|
|
11
|
+
BID_SELF_BID: "You cannot bid on your own listing.",
|
|
12
|
+
BID_USER_BANNED: "Your account is currently restricted from bidding. Contact support.",
|
|
13
|
+
};
|
|
7
14
|
export function PlaceBidFormClient({ productId, currentBid, startingBid, minBidIncrement, currency, isEnded, buyNowPrice, bidCount, tags = [], onPlaceBid, }) {
|
|
8
15
|
const minBid = currentBid + minBidIncrement;
|
|
9
16
|
const [bidAmount, setBidAmount] = useState(String(minBid));
|
|
@@ -27,8 +34,9 @@ export function PlaceBidFormClient({ productId, currentBid, startingBid, minBidI
|
|
|
27
34
|
typeof result === "object" &&
|
|
28
35
|
"ok" in result &&
|
|
29
36
|
result.ok === false) {
|
|
30
|
-
const
|
|
31
|
-
|
|
37
|
+
const r = result;
|
|
38
|
+
const display = (r.code && BID_ERROR_DISPLAY[r.code]) ?? r.error ?? "Failed to place bid. Please try again.";
|
|
39
|
+
setError(display);
|
|
32
40
|
return;
|
|
33
41
|
}
|
|
34
42
|
setSuccess(true);
|
|
@@ -23,6 +23,13 @@ export declare class BidRepository extends BaseRepository<BidDocument> {
|
|
|
23
23
|
* Find bids by user ID
|
|
24
24
|
*/
|
|
25
25
|
findByUser(userId: string): Promise<BidDocument[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Paginated bids by user — returns at most pageSize bids, sorted by createdAt desc.
|
|
28
|
+
*/
|
|
29
|
+
findByUserPaginated(userId: string, pageSize?: number, startAfterDoc?: import("firebase-admin/firestore").QueryDocumentSnapshot): Promise<{
|
|
30
|
+
items: BidDocument[];
|
|
31
|
+
hasMore: boolean;
|
|
32
|
+
}>;
|
|
26
33
|
/**
|
|
27
34
|
* Find bids by status
|
|
28
35
|
*/
|
|
@@ -56,6 +56,22 @@ export class BidRepository extends BaseRepository {
|
|
|
56
56
|
async findByUser(userId) {
|
|
57
57
|
return this.findBy(BID_FIELDS.USER_ID, userId);
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Paginated bids by user — returns at most pageSize bids, sorted by createdAt desc.
|
|
61
|
+
*/
|
|
62
|
+
async findByUserPaginated(userId, pageSize = 25, startAfterDoc) {
|
|
63
|
+
let query = this.db
|
|
64
|
+
.collection(this.collection)
|
|
65
|
+
.where(BID_FIELDS.USER_ID, "==", userId)
|
|
66
|
+
.orderBy("createdAt", "desc")
|
|
67
|
+
.limit(pageSize + 1);
|
|
68
|
+
if (startAfterDoc)
|
|
69
|
+
query = query.startAfter(startAfterDoc);
|
|
70
|
+
const snap = await query.get();
|
|
71
|
+
const hasMore = snap.docs.length > pageSize;
|
|
72
|
+
const docs = hasMore ? snap.docs.slice(0, pageSize) : snap.docs;
|
|
73
|
+
return { items: docs.map((d) => this.mapDoc(d)), hasMore };
|
|
74
|
+
}
|
|
59
75
|
/**
|
|
60
76
|
* Find bids by status
|
|
61
77
|
*/
|
|
@@ -29,18 +29,18 @@ export declare const auctionItemSchema: z.ZodObject<{
|
|
|
29
29
|
source: z.ZodOptional<z.ZodEnum<["upload", "youtube", "external"]>>;
|
|
30
30
|
youtubeId: z.ZodOptional<z.ZodString>;
|
|
31
31
|
}, "strip", z.ZodTypeAny, {
|
|
32
|
-
type: "video" | "image" | "file";
|
|
33
32
|
url: string;
|
|
34
|
-
|
|
33
|
+
type: "image" | "video" | "file";
|
|
35
34
|
alt?: string | undefined;
|
|
36
35
|
thumbnailUrl?: string | undefined;
|
|
36
|
+
source?: "upload" | "youtube" | "external" | undefined;
|
|
37
37
|
youtubeId?: string | undefined;
|
|
38
38
|
}, {
|
|
39
|
-
type: "video" | "image" | "file";
|
|
40
39
|
url: string;
|
|
41
|
-
|
|
40
|
+
type: "image" | "video" | "file";
|
|
42
41
|
alt?: string | undefined;
|
|
43
42
|
thumbnailUrl?: string | undefined;
|
|
43
|
+
source?: "upload" | "youtube" | "external" | undefined;
|
|
44
44
|
youtubeId?: string | undefined;
|
|
45
45
|
}>, "many">>;
|
|
46
46
|
currency: z.ZodString;
|
|
@@ -59,18 +59,18 @@ export declare const auctionItemSchema: z.ZodObject<{
|
|
|
59
59
|
updatedAt: z.ZodString;
|
|
60
60
|
}, "strip", z.ZodTypeAny, {
|
|
61
61
|
currency: string;
|
|
62
|
-
id: string;
|
|
63
|
-
createdAt: string;
|
|
64
|
-
updatedAt: string;
|
|
65
62
|
status: "draft" | "published" | "archived" | "sold";
|
|
66
|
-
title: string;
|
|
67
63
|
featured: boolean;
|
|
68
64
|
listingType: "auction";
|
|
65
|
+
createdAt: string;
|
|
66
|
+
id: string;
|
|
67
|
+
title: string;
|
|
69
68
|
slug: string;
|
|
70
69
|
price: number;
|
|
71
70
|
auctionEndDate: string;
|
|
72
71
|
startingBid: number;
|
|
73
72
|
bidCount: number;
|
|
73
|
+
updatedAt: string;
|
|
74
74
|
sellerId: string;
|
|
75
75
|
storeId?: string | undefined;
|
|
76
76
|
description?: string | undefined;
|
|
@@ -78,28 +78,28 @@ export declare const auctionItemSchema: z.ZodObject<{
|
|
|
78
78
|
images?: string[] | undefined;
|
|
79
79
|
currentBid?: number | undefined;
|
|
80
80
|
media?: {
|
|
81
|
-
type: "video" | "image" | "file";
|
|
82
81
|
url: string;
|
|
83
|
-
|
|
82
|
+
type: "image" | "video" | "file";
|
|
84
83
|
alt?: string | undefined;
|
|
85
84
|
thumbnailUrl?: string | undefined;
|
|
85
|
+
source?: "upload" | "youtube" | "external" | undefined;
|
|
86
86
|
youtubeId?: string | undefined;
|
|
87
87
|
}[] | undefined;
|
|
88
88
|
storeSlug?: string | undefined;
|
|
89
89
|
}, {
|
|
90
90
|
currency: string;
|
|
91
|
-
id: string;
|
|
92
|
-
createdAt: string;
|
|
93
|
-
updatedAt: string;
|
|
94
91
|
status: "draft" | "published" | "archived" | "sold";
|
|
95
|
-
title: string;
|
|
96
92
|
featured: boolean;
|
|
97
93
|
listingType: "auction";
|
|
94
|
+
createdAt: string;
|
|
95
|
+
id: string;
|
|
96
|
+
title: string;
|
|
98
97
|
slug: string;
|
|
99
98
|
price: number;
|
|
100
99
|
auctionEndDate: string;
|
|
101
100
|
startingBid: number;
|
|
102
101
|
bidCount: number;
|
|
102
|
+
updatedAt: string;
|
|
103
103
|
sellerId: string;
|
|
104
104
|
storeId?: string | undefined;
|
|
105
105
|
description?: string | undefined;
|
|
@@ -107,11 +107,11 @@ export declare const auctionItemSchema: z.ZodObject<{
|
|
|
107
107
|
images?: string[] | undefined;
|
|
108
108
|
currentBid?: number | undefined;
|
|
109
109
|
media?: {
|
|
110
|
-
type: "video" | "image" | "file";
|
|
111
110
|
url: string;
|
|
112
|
-
|
|
111
|
+
type: "image" | "video" | "file";
|
|
113
112
|
alt?: string | undefined;
|
|
114
113
|
thumbnailUrl?: string | undefined;
|
|
114
|
+
source?: "upload" | "youtube" | "external" | undefined;
|
|
115
115
|
youtubeId?: string | undefined;
|
|
116
116
|
}[] | undefined;
|
|
117
117
|
storeSlug?: string | undefined;
|
|
@@ -152,14 +152,14 @@ export declare const auctionListParamsSchema: z.ZodObject<{
|
|
|
152
152
|
filters: z.ZodOptional<z.ZodString>;
|
|
153
153
|
}, "strip", z.ZodTypeAny, {
|
|
154
154
|
sort?: string | undefined;
|
|
155
|
-
pageSize?: number | undefined;
|
|
156
155
|
page?: number | undefined;
|
|
156
|
+
pageSize?: number | undefined;
|
|
157
157
|
filters?: string | undefined;
|
|
158
158
|
storeSlug?: string | undefined;
|
|
159
159
|
}, {
|
|
160
160
|
sort?: string | undefined;
|
|
161
|
-
pageSize?: number | undefined;
|
|
162
161
|
page?: number | undefined;
|
|
162
|
+
pageSize?: number | undefined;
|
|
163
163
|
filters?: string | undefined;
|
|
164
164
|
storeSlug?: string | undefined;
|
|
165
165
|
}>;
|
|
@@ -57,16 +57,16 @@ export declare const authUserSchema: z.ZodObject<{
|
|
|
57
57
|
isEmailVerified: z.ZodOptional<z.ZodBoolean>;
|
|
58
58
|
}, "strip", z.ZodTypeAny, {
|
|
59
59
|
id: string;
|
|
60
|
-
displayName?: string | undefined;
|
|
61
60
|
role?: "user" | "seller" | "moderator" | "employee" | "admin" | undefined;
|
|
62
61
|
email?: string | undefined;
|
|
62
|
+
displayName?: string | undefined;
|
|
63
63
|
photoURL?: string | undefined;
|
|
64
64
|
isEmailVerified?: boolean | undefined;
|
|
65
65
|
}, {
|
|
66
66
|
id: string;
|
|
67
|
-
displayName?: string | undefined;
|
|
68
67
|
role?: "user" | "seller" | "moderator" | "employee" | "admin" | undefined;
|
|
69
68
|
email?: string | undefined;
|
|
69
|
+
displayName?: string | undefined;
|
|
70
70
|
photoURL?: string | undefined;
|
|
71
71
|
isEmailVerified?: boolean | undefined;
|
|
72
72
|
}>;
|