@mohasinac/appkit 2.7.35 → 2.7.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/features/auctions/og.d.ts +1 -0
- package/dist/_internal/server/features/auctions/og.js +2 -1
- package/dist/_internal/server/features/blog/og.d.ts +1 -0
- package/dist/_internal/server/features/blog/og.js +3 -2
- package/dist/_internal/server/features/brands/og.d.ts +1 -0
- package/dist/_internal/server/features/brands/og.js +2 -1
- package/dist/_internal/server/features/bundles/og.d.ts +1 -0
- package/dist/_internal/server/features/bundles/og.js +2 -1
- package/dist/_internal/server/features/categories/og.d.ts +1 -0
- package/dist/_internal/server/features/categories/og.js +2 -1
- package/dist/_internal/server/features/checkout/actions.js +13 -5
- package/dist/_internal/server/features/classified/og.d.ts +2 -0
- package/dist/_internal/server/features/classified/og.js +2 -1
- package/dist/_internal/server/features/digital-code/og.d.ts +2 -0
- package/dist/_internal/server/features/digital-code/og.js +2 -1
- package/dist/_internal/server/features/events/og.d.ts +1 -0
- package/dist/_internal/server/features/events/og.js +3 -1
- package/dist/_internal/server/features/live/og.d.ts +2 -0
- package/dist/_internal/server/features/live/og.js +2 -1
- package/dist/_internal/server/features/pre-orders/og.d.ts +1 -0
- package/dist/_internal/server/features/pre-orders/og.js +2 -1
- package/dist/_internal/server/features/products/og.d.ts +3 -1
- package/dist/_internal/server/features/products/og.js +2 -1
- package/dist/_internal/server/features/seo/index.d.ts +1 -1
- package/dist/_internal/server/features/seo/index.js +1 -1
- package/dist/_internal/server/features/seo/og.d.ts +8 -1
- package/dist/_internal/server/features/seo/og.js +28 -8
- package/dist/_internal/server/features/stores/og.d.ts +1 -0
- package/dist/_internal/server/features/stores/og.js +3 -2
- package/dist/_internal/server/features/sublisting-categories/og.d.ts +1 -0
- package/dist/_internal/server/features/sublisting-categories/og.js +2 -1
- 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/onScamReportCreate.js +18 -14
- package/dist/_internal/server/jobs/core/onScamReportRejected.js +10 -7
- package/dist/_internal/server/jobs/core/onScamReportVerified.js +10 -7
- 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 +15 -0
- package/dist/constants/api-endpoints.js +5 -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/AdminBundlesView.js +20 -2
- package/dist/features/admin/components/AdminPayoutsView.js +2 -1
- package/dist/features/admin/components/AdminProductsView.js +13 -0
- package/dist/features/admin/components/AdminSidebar.js +1 -1
- package/dist/features/admin/components/AdminStoresView.js +43 -5
- package/dist/features/admin/components/AdminUsersView.js +53 -6
- package/dist/features/admin/schemas/firestore.d.ts +1 -1
- package/dist/features/auctions/actions/bid-actions.js +13 -6
- 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 +2 -1
- package/dist/features/blog/schemas/index.d.ts +38 -38
- package/dist/features/categories/components/CategoryForm.js +1 -0
- 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/homepage/components/SectionCarousel.js +1 -8
- 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/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/seed/homepage-sections-seed-data.js +10 -10
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/components/FormField.js +1 -0
- 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
|
@@ -239,7 +239,7 @@ export declare class ProductRepository extends BaseRepository<ProductDocument> {
|
|
|
239
239
|
/**
|
|
240
240
|
* Cloud Functions: stage an atomic bid-count increment into a caller-owned WriteBatch.
|
|
241
241
|
*/
|
|
242
|
-
incrementBidCountInBatch(batch: WriteBatch, productId: string, currentBid: number): void;
|
|
242
|
+
incrementBidCountInBatch(batch: WriteBatch, productId: string, currentBid: number, leadingBidderId?: string): void;
|
|
243
243
|
/**
|
|
244
244
|
* SB6-C / SB4-H — atomically bump `prizeCurrentEntries` by `count`. The
|
|
245
245
|
* checkout transaction calls this after pool-cap validation; the reveal
|
|
@@ -248,6 +248,8 @@ export declare class ProductRepository extends BaseRepository<ProductDocument> {
|
|
|
248
248
|
*/
|
|
249
249
|
incrementPrizeEntriesInBatch(batch: WriteBatch, productId: string, count: number): void;
|
|
250
250
|
productRef(productId: string): DocumentReference;
|
|
251
|
+
/** Cloud Functions: returns refs for draft products older than `cutoff` (for 30-day prune). */
|
|
252
|
+
getStaleDraftRefs(cutoff: Date): Promise<DocumentReference[]>;
|
|
251
253
|
}
|
|
252
254
|
export declare class ProductsRepository extends ProductRepository {
|
|
253
255
|
}
|
|
@@ -385,10 +385,11 @@ export class ProductRepository extends BaseRepository {
|
|
|
385
385
|
/**
|
|
386
386
|
* Cloud Functions: stage an atomic bid-count increment into a caller-owned WriteBatch.
|
|
387
387
|
*/
|
|
388
|
-
incrementBidCountInBatch(batch, productId, currentBid) {
|
|
388
|
+
incrementBidCountInBatch(batch, productId, currentBid, leadingBidderId) {
|
|
389
389
|
batch.update(this.db.collection(this.collection).doc(productId), {
|
|
390
390
|
currentBid,
|
|
391
391
|
bidCount: increment(1),
|
|
392
|
+
...(leadingBidderId && { leadingBidderId }),
|
|
392
393
|
// SB-UNI-H 2026-05-13 — flip `bidsHaveStarted` when any bid lands.
|
|
393
394
|
// Idempotent on subsequent bids; the BIN button is hidden by the PDP
|
|
394
395
|
// as soon as this is true (eBay-style hybrid auction rule).
|
|
@@ -411,6 +412,16 @@ export class ProductRepository extends BaseRepository {
|
|
|
411
412
|
productRef(productId) {
|
|
412
413
|
return this.db.collection(this.collection).doc(productId);
|
|
413
414
|
}
|
|
415
|
+
/** Cloud Functions: returns refs for draft products older than `cutoff` (for 30-day prune). */
|
|
416
|
+
async getStaleDraftRefs(cutoff) {
|
|
417
|
+
const snap = await this.db
|
|
418
|
+
.collection(this.collection)
|
|
419
|
+
.where("status", "==", "draft")
|
|
420
|
+
.where("updatedAt", "<", cutoff)
|
|
421
|
+
.limit(200)
|
|
422
|
+
.get();
|
|
423
|
+
return snap.docs.map((d) => d.ref);
|
|
424
|
+
}
|
|
414
425
|
}
|
|
415
426
|
ProductRepository.CACHE_TTL_MS = 30000;
|
|
416
427
|
ProductRepository.SIEVE_FIELDS = {
|
|
@@ -146,6 +146,7 @@ export interface ProductDocument {
|
|
|
146
146
|
startingBid?: number;
|
|
147
147
|
currentBid?: number;
|
|
148
148
|
bidCount?: number;
|
|
149
|
+
leadingBidderId?: string;
|
|
149
150
|
reservePrice?: number;
|
|
150
151
|
buyNowPrice?: number;
|
|
151
152
|
minBidIncrement?: number;
|
|
@@ -237,6 +238,12 @@ export interface ProductDocument {
|
|
|
237
238
|
etaDaysMax?: number;
|
|
238
239
|
}>;
|
|
239
240
|
};
|
|
241
|
+
/** Physical storage location for inventory management (Print & Label Center). */
|
|
242
|
+
physicalLocation?: {
|
|
243
|
+
zone: string;
|
|
244
|
+
shelf: string;
|
|
245
|
+
bin: string;
|
|
246
|
+
};
|
|
240
247
|
createdAt: Date;
|
|
241
248
|
updatedAt: Date;
|
|
242
249
|
}
|
|
@@ -60,18 +60,18 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
60
60
|
source: z.ZodOptional<z.ZodEnum<["upload", "youtube", "external"]>>;
|
|
61
61
|
youtubeId: z.ZodOptional<z.ZodString>;
|
|
62
62
|
}, "strip", z.ZodTypeAny, {
|
|
63
|
-
type: "video" | "image" | "file";
|
|
64
63
|
url: string;
|
|
65
|
-
|
|
64
|
+
type: "image" | "video" | "file";
|
|
66
65
|
alt?: string | undefined;
|
|
67
66
|
thumbnailUrl?: string | undefined;
|
|
67
|
+
source?: "upload" | "youtube" | "external" | undefined;
|
|
68
68
|
youtubeId?: string | undefined;
|
|
69
69
|
}, {
|
|
70
|
-
type: "video" | "image" | "file";
|
|
71
70
|
url: string;
|
|
72
|
-
|
|
71
|
+
type: "image" | "video" | "file";
|
|
73
72
|
alt?: string | undefined;
|
|
74
73
|
thumbnailUrl?: string | undefined;
|
|
74
|
+
source?: "upload" | "youtube" | "external" | undefined;
|
|
75
75
|
youtubeId?: string | undefined;
|
|
76
76
|
}>, "many">>;
|
|
77
77
|
video: z.ZodOptional<z.ZodObject<{
|
|
@@ -232,13 +232,13 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
232
232
|
value: z.ZodString;
|
|
233
233
|
unit: z.ZodOptional<z.ZodString>;
|
|
234
234
|
}, "strip", z.ZodTypeAny, {
|
|
235
|
+
type: "number" | "boolean" | "url" | "text";
|
|
235
236
|
value: string;
|
|
236
|
-
type: "number" | "boolean" | "text" | "url";
|
|
237
237
|
key: string;
|
|
238
238
|
unit?: string | undefined;
|
|
239
239
|
}, {
|
|
240
|
+
type: "number" | "boolean" | "url" | "text";
|
|
240
241
|
value: string;
|
|
241
|
-
type: "number" | "boolean" | "text" | "url";
|
|
242
242
|
key: string;
|
|
243
243
|
unit?: string | undefined;
|
|
244
244
|
}>, "many">>;
|
|
@@ -252,13 +252,13 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
252
252
|
value: z.ZodString;
|
|
253
253
|
unit: z.ZodOptional<z.ZodString>;
|
|
254
254
|
}, "strip", z.ZodTypeAny, {
|
|
255
|
+
type: "number" | "boolean" | "url" | "text";
|
|
255
256
|
value: string;
|
|
256
|
-
type: "number" | "boolean" | "text" | "url";
|
|
257
257
|
key: string;
|
|
258
258
|
unit?: string | undefined;
|
|
259
259
|
}, {
|
|
260
|
+
type: "number" | "boolean" | "url" | "text";
|
|
260
261
|
value: string;
|
|
261
|
-
type: "number" | "boolean" | "text" | "url";
|
|
262
262
|
key: string;
|
|
263
263
|
unit?: string | undefined;
|
|
264
264
|
}>, "many">>;
|
|
@@ -267,8 +267,8 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
267
267
|
title: string;
|
|
268
268
|
text?: string | undefined;
|
|
269
269
|
fields?: {
|
|
270
|
+
type: "number" | "boolean" | "url" | "text";
|
|
270
271
|
value: string;
|
|
271
|
-
type: "number" | "boolean" | "text" | "url";
|
|
272
272
|
key: string;
|
|
273
273
|
unit?: string | undefined;
|
|
274
274
|
}[] | undefined;
|
|
@@ -277,29 +277,28 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
277
277
|
title: string;
|
|
278
278
|
text?: string | undefined;
|
|
279
279
|
fields?: {
|
|
280
|
+
type: "number" | "boolean" | "url" | "text";
|
|
280
281
|
value: string;
|
|
281
|
-
type: "number" | "boolean" | "text" | "url";
|
|
282
282
|
key: string;
|
|
283
283
|
unit?: string | undefined;
|
|
284
284
|
}[] | undefined;
|
|
285
285
|
}>, "many">>;
|
|
286
286
|
}, "strip", z.ZodTypeAny, {
|
|
287
|
-
id: string;
|
|
288
287
|
status: "draft" | "published" | "archived" | "sold" | "out_of_stock" | "discontinued";
|
|
288
|
+
id: string;
|
|
289
289
|
title: string;
|
|
290
290
|
price: number;
|
|
291
291
|
currency?: string | undefined;
|
|
292
|
-
createdAt?: string | undefined;
|
|
293
|
-
updatedAt?: string | undefined;
|
|
294
|
-
storeId?: string | undefined;
|
|
295
292
|
video?: {
|
|
296
293
|
url: string;
|
|
297
294
|
thumbnailUrl?: string | undefined;
|
|
298
295
|
} | undefined;
|
|
296
|
+
storeId?: string | undefined;
|
|
299
297
|
category?: string | undefined;
|
|
300
298
|
featured?: boolean | undefined;
|
|
301
299
|
listingType?: "standard" | "auction" | "pre-order" | "prize-draw" | "bundle" | undefined;
|
|
302
300
|
isPromoted?: boolean | undefined;
|
|
301
|
+
createdAt?: string | undefined;
|
|
303
302
|
description?: string | undefined;
|
|
304
303
|
slug?: string | undefined;
|
|
305
304
|
subcategory?: string | undefined;
|
|
@@ -351,8 +350,8 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
351
350
|
allowOffers?: boolean | undefined;
|
|
352
351
|
minOfferPercent?: number | undefined;
|
|
353
352
|
customFields?: {
|
|
353
|
+
type: "number" | "boolean" | "url" | "text";
|
|
354
354
|
value: string;
|
|
355
|
-
type: "number" | "boolean" | "text" | "url";
|
|
356
355
|
key: string;
|
|
357
356
|
unit?: string | undefined;
|
|
358
357
|
}[] | undefined;
|
|
@@ -361,8 +360,8 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
361
360
|
title: string;
|
|
362
361
|
text?: string | undefined;
|
|
363
362
|
fields?: {
|
|
363
|
+
type: "number" | "boolean" | "url" | "text";
|
|
364
364
|
value: string;
|
|
365
|
-
type: "number" | "boolean" | "text" | "url";
|
|
366
365
|
key: string;
|
|
367
366
|
unit?: string | undefined;
|
|
368
367
|
}[] | undefined;
|
|
@@ -388,15 +387,16 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
388
387
|
prizeCurrentEntries?: number | undefined;
|
|
389
388
|
prizeRevealWindowStart?: string | Date | undefined;
|
|
390
389
|
prizeRevealWindowEnd?: string | Date | undefined;
|
|
391
|
-
prizeRevealStatus?: "pending" | "
|
|
390
|
+
prizeRevealStatus?: "pending" | "open" | "closed" | undefined;
|
|
392
391
|
prizeRevealDeadlineDays?: number | undefined;
|
|
393
392
|
prizeGithubFileUrl?: string | undefined;
|
|
393
|
+
updatedAt?: string | undefined;
|
|
394
394
|
media?: {
|
|
395
|
-
type: "video" | "image" | "file";
|
|
396
395
|
url: string;
|
|
397
|
-
|
|
396
|
+
type: "image" | "video" | "file";
|
|
398
397
|
alt?: string | undefined;
|
|
399
398
|
thumbnailUrl?: string | undefined;
|
|
399
|
+
source?: "upload" | "youtube" | "external" | undefined;
|
|
400
400
|
youtubeId?: string | undefined;
|
|
401
401
|
}[] | undefined;
|
|
402
402
|
inStock?: boolean | undefined;
|
|
@@ -413,22 +413,21 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
413
413
|
} | undefined;
|
|
414
414
|
publishedAt?: string | undefined;
|
|
415
415
|
}, {
|
|
416
|
-
id: string;
|
|
417
416
|
status: "draft" | "published" | "archived" | "sold" | "out_of_stock" | "discontinued";
|
|
417
|
+
id: string;
|
|
418
418
|
title: string;
|
|
419
419
|
price: number;
|
|
420
420
|
currency?: string | undefined;
|
|
421
|
-
createdAt?: string | undefined;
|
|
422
|
-
updatedAt?: string | undefined;
|
|
423
|
-
storeId?: string | undefined;
|
|
424
421
|
video?: {
|
|
425
422
|
url: string;
|
|
426
423
|
thumbnailUrl?: string | undefined;
|
|
427
424
|
} | undefined;
|
|
425
|
+
storeId?: string | undefined;
|
|
428
426
|
category?: string | undefined;
|
|
429
427
|
featured?: boolean | undefined;
|
|
430
428
|
listingType?: "standard" | "auction" | "pre-order" | "prize-draw" | "bundle" | undefined;
|
|
431
429
|
isPromoted?: boolean | undefined;
|
|
430
|
+
createdAt?: string | undefined;
|
|
432
431
|
description?: string | undefined;
|
|
433
432
|
slug?: string | undefined;
|
|
434
433
|
subcategory?: string | undefined;
|
|
@@ -480,8 +479,8 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
480
479
|
allowOffers?: boolean | undefined;
|
|
481
480
|
minOfferPercent?: number | undefined;
|
|
482
481
|
customFields?: {
|
|
482
|
+
type: "number" | "boolean" | "url" | "text";
|
|
483
483
|
value: string;
|
|
484
|
-
type: "number" | "boolean" | "text" | "url";
|
|
485
484
|
key: string;
|
|
486
485
|
unit?: string | undefined;
|
|
487
486
|
}[] | undefined;
|
|
@@ -490,8 +489,8 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
490
489
|
title: string;
|
|
491
490
|
text?: string | undefined;
|
|
492
491
|
fields?: {
|
|
492
|
+
type: "number" | "boolean" | "url" | "text";
|
|
493
493
|
value: string;
|
|
494
|
-
type: "number" | "boolean" | "text" | "url";
|
|
495
494
|
key: string;
|
|
496
495
|
unit?: string | undefined;
|
|
497
496
|
}[] | undefined;
|
|
@@ -517,15 +516,16 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
517
516
|
prizeCurrentEntries?: number | undefined;
|
|
518
517
|
prizeRevealWindowStart?: string | Date | undefined;
|
|
519
518
|
prizeRevealWindowEnd?: string | Date | undefined;
|
|
520
|
-
prizeRevealStatus?: "pending" | "
|
|
519
|
+
prizeRevealStatus?: "pending" | "open" | "closed" | undefined;
|
|
521
520
|
prizeRevealDeadlineDays?: number | undefined;
|
|
522
521
|
prizeGithubFileUrl?: string | undefined;
|
|
522
|
+
updatedAt?: string | undefined;
|
|
523
523
|
media?: {
|
|
524
|
-
type: "video" | "image" | "file";
|
|
525
524
|
url: string;
|
|
526
|
-
|
|
525
|
+
type: "image" | "video" | "file";
|
|
527
526
|
alt?: string | undefined;
|
|
528
527
|
thumbnailUrl?: string | undefined;
|
|
528
|
+
source?: "upload" | "youtube" | "external" | undefined;
|
|
529
529
|
youtubeId?: string | undefined;
|
|
530
530
|
}[] | undefined;
|
|
531
531
|
inStock?: boolean | undefined;
|
|
@@ -558,30 +558,30 @@ export declare const productListParamsSchema: z.ZodObject<{
|
|
|
558
558
|
perPage: z.ZodOptional<z.ZodNumber>;
|
|
559
559
|
featured: z.ZodOptional<z.ZodBoolean>;
|
|
560
560
|
}, "strip", z.ZodTypeAny, {
|
|
561
|
+
status?: "draft" | "published" | "archived" | "sold" | "out_of_stock" | "discontinued" | undefined;
|
|
561
562
|
sort?: string | undefined;
|
|
562
|
-
perPage?: number | undefined;
|
|
563
563
|
storeId?: string | undefined;
|
|
564
|
-
status?: "draft" | "published" | "archived" | "sold" | "out_of_stock" | "discontinued" | undefined;
|
|
565
|
-
q?: string | undefined;
|
|
566
564
|
category?: string | undefined;
|
|
567
565
|
featured?: boolean | undefined;
|
|
568
566
|
listingType?: "standard" | "auction" | "pre-order" | "prize-draw" | "bundle" | undefined;
|
|
569
567
|
condition?: "new" | "used" | "refurbished" | "broken" | "like_new" | "good" | "fair" | "poor" | undefined;
|
|
568
|
+
q?: string | undefined;
|
|
570
569
|
page?: number | undefined;
|
|
570
|
+
perPage?: number | undefined;
|
|
571
571
|
minPrice?: number | undefined;
|
|
572
572
|
maxPrice?: number | undefined;
|
|
573
573
|
inStock?: boolean | undefined;
|
|
574
574
|
}, {
|
|
575
|
+
status?: "draft" | "published" | "archived" | "sold" | "out_of_stock" | "discontinued" | undefined;
|
|
575
576
|
sort?: string | undefined;
|
|
576
|
-
perPage?: number | undefined;
|
|
577
577
|
storeId?: string | undefined;
|
|
578
|
-
status?: "draft" | "published" | "archived" | "sold" | "out_of_stock" | "discontinued" | undefined;
|
|
579
|
-
q?: string | undefined;
|
|
580
578
|
category?: string | undefined;
|
|
581
579
|
featured?: boolean | undefined;
|
|
582
580
|
listingType?: "standard" | "auction" | "pre-order" | "prize-draw" | "bundle" | undefined;
|
|
583
581
|
condition?: "new" | "used" | "refurbished" | "broken" | "like_new" | "good" | "fair" | "poor" | undefined;
|
|
582
|
+
q?: string | undefined;
|
|
584
583
|
page?: number | undefined;
|
|
584
|
+
perPage?: number | undefined;
|
|
585
585
|
minPrice?: number | undefined;
|
|
586
586
|
maxPrice?: number | undefined;
|
|
587
587
|
inStock?: boolean | undefined;
|
|
@@ -22,9 +22,9 @@ export declare const productFeatureAdminCreateSchema: z.ZodObject<{
|
|
|
22
22
|
isActive: z.ZodBoolean;
|
|
23
23
|
displayOrder: z.ZodNumber;
|
|
24
24
|
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
category: "seller" | "custom" | "auction" | "condition" | "shipping" | "preorder" | "platform";
|
|
25
26
|
label: string;
|
|
26
27
|
scope: "store" | "platform";
|
|
27
|
-
category: "seller" | "custom" | "auction" | "condition" | "shipping" | "preorder" | "platform";
|
|
28
28
|
icon: string;
|
|
29
29
|
isActive: boolean;
|
|
30
30
|
displayOrder: number;
|
|
@@ -33,9 +33,9 @@ export declare const productFeatureAdminCreateSchema: z.ZodObject<{
|
|
|
33
33
|
description?: string | undefined;
|
|
34
34
|
iconColor?: string | undefined;
|
|
35
35
|
}, {
|
|
36
|
+
category: "seller" | "custom" | "auction" | "condition" | "shipping" | "preorder" | "platform";
|
|
36
37
|
label: string;
|
|
37
38
|
scope: "store" | "platform";
|
|
38
|
-
category: "seller" | "custom" | "auction" | "condition" | "shipping" | "preorder" | "platform";
|
|
39
39
|
icon: string;
|
|
40
40
|
isActive: boolean;
|
|
41
41
|
displayOrder: number;
|
|
@@ -55,8 +55,8 @@ export declare const productFeatureStoreCreateSchema: z.ZodObject<{
|
|
|
55
55
|
isActive: z.ZodBoolean;
|
|
56
56
|
displayOrder: z.ZodNumber;
|
|
57
57
|
}, "strip", z.ZodTypeAny, {
|
|
58
|
-
label: string;
|
|
59
58
|
category: "seller" | "custom" | "auction" | "condition" | "shipping" | "preorder" | "platform";
|
|
59
|
+
label: string;
|
|
60
60
|
icon: string;
|
|
61
61
|
isActive: boolean;
|
|
62
62
|
displayOrder: number;
|
|
@@ -64,8 +64,8 @@ export declare const productFeatureStoreCreateSchema: z.ZodObject<{
|
|
|
64
64
|
description?: string | undefined;
|
|
65
65
|
iconColor?: string | undefined;
|
|
66
66
|
}, {
|
|
67
|
-
label: string;
|
|
68
67
|
category: "seller" | "custom" | "auction" | "condition" | "shipping" | "preorder" | "platform";
|
|
68
|
+
label: string;
|
|
69
69
|
icon: string;
|
|
70
70
|
isActive: boolean;
|
|
71
71
|
displayOrder: number;
|
|
@@ -84,18 +84,18 @@ export declare const productFeatureUpdateSchema: z.ZodObject<{
|
|
|
84
84
|
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
85
85
|
displayOrder: z.ZodOptional<z.ZodNumber>;
|
|
86
86
|
}, "strip", z.ZodTypeAny, {
|
|
87
|
-
label?: string | undefined;
|
|
88
87
|
category?: "seller" | "custom" | "auction" | "condition" | "shipping" | "preorder" | "platform" | undefined;
|
|
89
88
|
description?: string | undefined;
|
|
89
|
+
label?: string | undefined;
|
|
90
90
|
icon?: string | undefined;
|
|
91
91
|
isActive?: boolean | undefined;
|
|
92
92
|
iconColor?: string | undefined;
|
|
93
93
|
displayOrder?: number | undefined;
|
|
94
94
|
productTypes?: ("auction" | "prize-draw" | "classified" | "digital-code" | "live" | "all" | "product" | "preorder")[] | undefined;
|
|
95
95
|
}, {
|
|
96
|
-
label?: string | undefined;
|
|
97
96
|
category?: "seller" | "custom" | "auction" | "condition" | "shipping" | "preorder" | "platform" | undefined;
|
|
98
97
|
description?: string | undefined;
|
|
98
|
+
label?: string | undefined;
|
|
99
99
|
icon?: string | undefined;
|
|
100
100
|
isActive?: boolean | undefined;
|
|
101
101
|
iconColor?: string | undefined;
|
|
@@ -139,6 +139,12 @@ export interface ProductItem {
|
|
|
139
139
|
insuranceCost?: number;
|
|
140
140
|
customFields?: CustomField[];
|
|
141
141
|
customSections?: CustomSection[];
|
|
142
|
+
/** Physical storage location set in the Print & Label Center. */
|
|
143
|
+
physicalLocation?: {
|
|
144
|
+
zone: string;
|
|
145
|
+
shelf: string;
|
|
146
|
+
bin: string;
|
|
147
|
+
};
|
|
142
148
|
}
|
|
143
149
|
export interface ProductListResponse {
|
|
144
150
|
items: ProductItem[];
|
|
@@ -39,14 +39,14 @@ export declare const couponItemSchema: z.ZodObject<{
|
|
|
39
39
|
createdAt: z.ZodString;
|
|
40
40
|
updatedAt: z.ZodString;
|
|
41
41
|
}, "strip", z.ZodTypeAny, {
|
|
42
|
-
id: string;
|
|
43
|
-
createdAt: string;
|
|
44
|
-
updatedAt: string;
|
|
45
|
-
code: string;
|
|
46
42
|
type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
|
|
47
|
-
|
|
43
|
+
code: string;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
id: string;
|
|
48
46
|
description: string;
|
|
47
|
+
updatedAt: string;
|
|
49
48
|
name: string;
|
|
49
|
+
scope: "seller" | "admin";
|
|
50
50
|
isActive: boolean;
|
|
51
51
|
isPublic: boolean;
|
|
52
52
|
usageCount: number;
|
|
@@ -63,14 +63,14 @@ export declare const couponItemSchema: z.ZodObject<{
|
|
|
63
63
|
applicableProductIds?: string[] | undefined;
|
|
64
64
|
applicableCategoryIds?: string[] | undefined;
|
|
65
65
|
}, {
|
|
66
|
-
id: string;
|
|
67
|
-
createdAt: string;
|
|
68
|
-
updatedAt: string;
|
|
69
|
-
code: string;
|
|
70
66
|
type: "fixed" | "percentage" | "free_shipping" | "buy_x_get_y";
|
|
71
|
-
|
|
67
|
+
code: string;
|
|
68
|
+
createdAt: string;
|
|
69
|
+
id: string;
|
|
72
70
|
description: string;
|
|
71
|
+
updatedAt: string;
|
|
73
72
|
name: string;
|
|
73
|
+
scope: "seller" | "admin";
|
|
74
74
|
isActive: boolean;
|
|
75
75
|
isPublic: boolean;
|
|
76
76
|
usageCount: number;
|
|
@@ -97,18 +97,18 @@ export declare const promotionsListParamsSchema: z.ZodObject<{
|
|
|
97
97
|
sort: z.ZodOptional<z.ZodString>;
|
|
98
98
|
}, "strip", z.ZodTypeAny, {
|
|
99
99
|
sort?: string | undefined;
|
|
100
|
-
pageSize?: number | undefined;
|
|
101
100
|
storeId?: string | undefined;
|
|
102
|
-
scope?: "seller" | "admin" | undefined;
|
|
103
101
|
page?: number | undefined;
|
|
102
|
+
scope?: "seller" | "admin" | undefined;
|
|
103
|
+
pageSize?: number | undefined;
|
|
104
104
|
isActive?: boolean | undefined;
|
|
105
105
|
filters?: string | undefined;
|
|
106
106
|
}, {
|
|
107
107
|
sort?: string | undefined;
|
|
108
|
-
pageSize?: number | undefined;
|
|
109
108
|
storeId?: string | undefined;
|
|
110
|
-
scope?: "seller" | "admin" | undefined;
|
|
111
109
|
page?: number | undefined;
|
|
110
|
+
scope?: "seller" | "admin" | undefined;
|
|
111
|
+
pageSize?: number | undefined;
|
|
112
112
|
isActive?: boolean | undefined;
|
|
113
113
|
filters?: string | undefined;
|
|
114
114
|
}>;
|
|
@@ -19,15 +19,15 @@ export declare const reviewVideoSchema: z.ZodObject<{
|
|
|
19
19
|
trimEnd: z.ZodOptional<z.ZodNumber>;
|
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
|
21
21
|
url: string;
|
|
22
|
+
thumbnailUrl?: string | undefined;
|
|
22
23
|
trimEnd?: number | undefined;
|
|
23
24
|
trimStart?: number | undefined;
|
|
24
|
-
thumbnailUrl?: string | undefined;
|
|
25
25
|
duration?: number | undefined;
|
|
26
26
|
}, {
|
|
27
27
|
url: string;
|
|
28
|
+
thumbnailUrl?: string | undefined;
|
|
28
29
|
trimEnd?: number | undefined;
|
|
29
30
|
trimStart?: number | undefined;
|
|
30
|
-
thumbnailUrl?: string | undefined;
|
|
31
31
|
duration?: number | undefined;
|
|
32
32
|
}>;
|
|
33
33
|
/**
|
|
@@ -73,15 +73,15 @@ export declare const reviewSchema: z.ZodObject<{
|
|
|
73
73
|
trimEnd: z.ZodOptional<z.ZodNumber>;
|
|
74
74
|
}, "strip", z.ZodTypeAny, {
|
|
75
75
|
url: string;
|
|
76
|
+
thumbnailUrl?: string | undefined;
|
|
76
77
|
trimEnd?: number | undefined;
|
|
77
78
|
trimStart?: number | undefined;
|
|
78
|
-
thumbnailUrl?: string | undefined;
|
|
79
79
|
duration?: number | undefined;
|
|
80
80
|
}, {
|
|
81
81
|
url: string;
|
|
82
|
+
thumbnailUrl?: string | undefined;
|
|
82
83
|
trimEnd?: number | undefined;
|
|
83
84
|
trimStart?: number | undefined;
|
|
84
|
-
thumbnailUrl?: string | undefined;
|
|
85
85
|
duration?: number | undefined;
|
|
86
86
|
}>>;
|
|
87
87
|
status: z.ZodEnum<["pending", "approved", "rejected"]>;
|
|
@@ -92,28 +92,28 @@ export declare const reviewSchema: z.ZodObject<{
|
|
|
92
92
|
createdAt: z.ZodOptional<z.ZodString>;
|
|
93
93
|
updatedAt: z.ZodOptional<z.ZodString>;
|
|
94
94
|
}, "strip", z.ZodTypeAny, {
|
|
95
|
-
id: string;
|
|
96
95
|
status: "pending" | "approved" | "rejected";
|
|
96
|
+
id: string;
|
|
97
97
|
productId: string;
|
|
98
98
|
rating: 3 | 1 | 2 | 4 | 5;
|
|
99
99
|
userId: string;
|
|
100
100
|
userName: string;
|
|
101
|
-
createdAt?: string | undefined;
|
|
102
|
-
updatedAt?: string | undefined;
|
|
103
|
-
title?: string | undefined;
|
|
104
101
|
video?: {
|
|
105
102
|
url: string;
|
|
103
|
+
thumbnailUrl?: string | undefined;
|
|
106
104
|
trimEnd?: number | undefined;
|
|
107
105
|
trimStart?: number | undefined;
|
|
108
|
-
thumbnailUrl?: string | undefined;
|
|
109
106
|
duration?: number | undefined;
|
|
110
107
|
} | undefined;
|
|
111
108
|
featured?: boolean | undefined;
|
|
109
|
+
createdAt?: string | undefined;
|
|
110
|
+
title?: string | undefined;
|
|
112
111
|
images?: {
|
|
113
112
|
url: string;
|
|
114
113
|
thumbnailUrl?: string | undefined;
|
|
115
114
|
}[] | undefined;
|
|
116
115
|
storeName?: string | undefined;
|
|
116
|
+
updatedAt?: string | undefined;
|
|
117
117
|
productTitle?: string | undefined;
|
|
118
118
|
storeSlug?: string | undefined;
|
|
119
119
|
userAvatar?: string | undefined;
|
|
@@ -122,28 +122,28 @@ export declare const reviewSchema: z.ZodObject<{
|
|
|
122
122
|
reportCount?: number | undefined;
|
|
123
123
|
verified?: boolean | undefined;
|
|
124
124
|
}, {
|
|
125
|
-
id: string;
|
|
126
125
|
status: "pending" | "approved" | "rejected";
|
|
126
|
+
id: string;
|
|
127
127
|
productId: string;
|
|
128
128
|
rating: 3 | 1 | 2 | 4 | 5;
|
|
129
129
|
userId: string;
|
|
130
130
|
userName: string;
|
|
131
|
-
createdAt?: string | undefined;
|
|
132
|
-
updatedAt?: string | undefined;
|
|
133
|
-
title?: string | undefined;
|
|
134
131
|
video?: {
|
|
135
132
|
url: string;
|
|
133
|
+
thumbnailUrl?: string | undefined;
|
|
136
134
|
trimEnd?: number | undefined;
|
|
137
135
|
trimStart?: number | undefined;
|
|
138
|
-
thumbnailUrl?: string | undefined;
|
|
139
136
|
duration?: number | undefined;
|
|
140
137
|
} | undefined;
|
|
141
138
|
featured?: boolean | undefined;
|
|
139
|
+
createdAt?: string | undefined;
|
|
140
|
+
title?: string | undefined;
|
|
142
141
|
images?: {
|
|
143
142
|
url: string;
|
|
144
143
|
thumbnailUrl?: string | undefined;
|
|
145
144
|
}[] | undefined;
|
|
146
145
|
storeName?: string | undefined;
|
|
146
|
+
updatedAt?: string | undefined;
|
|
147
147
|
productTitle?: string | undefined;
|
|
148
148
|
storeSlug?: string | undefined;
|
|
149
149
|
userAvatar?: string | undefined;
|
|
@@ -164,22 +164,22 @@ export declare const reviewListParamsSchema: z.ZodObject<{
|
|
|
164
164
|
perPage: z.ZodOptional<z.ZodNumber>;
|
|
165
165
|
sort: z.ZodOptional<z.ZodString>;
|
|
166
166
|
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
status?: "pending" | "approved" | "rejected" | undefined;
|
|
167
168
|
sort?: string | undefined;
|
|
168
|
-
perPage?: number | undefined;
|
|
169
169
|
storeId?: string | undefined;
|
|
170
|
-
status?: "pending" | "approved" | "rejected" | undefined;
|
|
171
170
|
featured?: boolean | undefined;
|
|
172
171
|
page?: number | undefined;
|
|
172
|
+
perPage?: number | undefined;
|
|
173
173
|
productId?: string | undefined;
|
|
174
174
|
rating?: number | undefined;
|
|
175
175
|
userId?: string | undefined;
|
|
176
176
|
}, {
|
|
177
|
+
status?: "pending" | "approved" | "rejected" | undefined;
|
|
177
178
|
sort?: string | undefined;
|
|
178
|
-
perPage?: number | undefined;
|
|
179
179
|
storeId?: string | undefined;
|
|
180
|
-
status?: "pending" | "approved" | "rejected" | undefined;
|
|
181
180
|
featured?: boolean | undefined;
|
|
182
181
|
page?: number | undefined;
|
|
182
|
+
perPage?: number | undefined;
|
|
183
183
|
productId?: string | undefined;
|
|
184
184
|
rating?: number | undefined;
|
|
185
185
|
userId?: string | undefined;
|
|
@@ -13,7 +13,7 @@ import { userRepository } from "../../auth/repository/user.repository";
|
|
|
13
13
|
import { storeRepository } from "../../stores/repository/store.repository";
|
|
14
14
|
import { cartRepository } from "../../cart/repository/cart.repository";
|
|
15
15
|
import { maskOfferForSeller } from "../../../security";
|
|
16
|
-
import { ERROR_MESSAGES, AuthorizationError, ValidationError, NotFoundError, } from "../../../errors";
|
|
16
|
+
import { ERROR_MESSAGES, AuthorizationError, ValidationError, NotFoundError, OFFER_ERROR_CODES, } from "../../../errors";
|
|
17
17
|
import { OfferStatusValues } from "../schemas";
|
|
18
18
|
const ERR_OFFER_NOT_FOUND = "Offer not found";
|
|
19
19
|
const ERR_NOT_AUTHORISED = "Not authorized";
|
|
@@ -89,8 +89,12 @@ export async function respondToOffer(userId, input) {
|
|
|
89
89
|
if (new Date() > offer.expiresAt)
|
|
90
90
|
throw new ValidationError(ERROR_MESSAGES.OFFER.EXPIRED);
|
|
91
91
|
let updated;
|
|
92
|
+
const CHECKOUT_WINDOW_MS = 48 * 60 * 60 * 1000;
|
|
92
93
|
if (action === "accept") {
|
|
93
94
|
updated = await offerRepository.accept(offerId, offer.offerAmount, sellerNote);
|
|
95
|
+
await offerRepository.update(offerId, {
|
|
96
|
+
checkoutDeadline: new Date(Date.now() + CHECKOUT_WINDOW_MS),
|
|
97
|
+
});
|
|
94
98
|
}
|
|
95
99
|
else if (action === "decline") {
|
|
96
100
|
updated = await offerRepository.decline(offerId, sellerNote);
|
|
@@ -141,6 +145,9 @@ export async function acceptCounterOffer(userId, offerId) {
|
|
|
141
145
|
if (new Date() > offer.expiresAt)
|
|
142
146
|
throw new ValidationError(ERROR_MESSAGES.OFFER.EXPIRED);
|
|
143
147
|
const updated = await offerRepository.acceptCounter(offerId);
|
|
148
|
+
await offerRepository.update(offerId, {
|
|
149
|
+
checkoutDeadline: new Date(Date.now() + 48 * 60 * 60 * 1000),
|
|
150
|
+
});
|
|
144
151
|
const counterStore = offer.storeId ? await storeRepository.findById(offer.storeId) : null;
|
|
145
152
|
if (counterStore?.ownerId)
|
|
146
153
|
await sendNotification({
|
|
@@ -254,6 +261,8 @@ export async function checkoutOffer(userId, offerId) {
|
|
|
254
261
|
throw new ValidationError("Only accepted offers can be checked out.");
|
|
255
262
|
if (!offer.lockedPrice)
|
|
256
263
|
throw new ValidationError("Offer price not confirmed. Contact support.");
|
|
264
|
+
if (offer.checkoutDeadline && new Date() > offer.checkoutDeadline)
|
|
265
|
+
throw new ValidationError("This accepted offer has expired. Please make a new offer.", { code: OFFER_ERROR_CODES.CHECKOUT_EXPIRED });
|
|
257
266
|
const product = await productRepository.findById(offer.productId);
|
|
258
267
|
if (!product)
|
|
259
268
|
throw new NotFoundError(ERROR_MESSAGES.PRODUCT.NOT_FOUND);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface PhysicalLocation {
|
|
2
|
+
zone: string;
|
|
3
|
+
shelf: string;
|
|
4
|
+
bin: string;
|
|
5
|
+
}
|
|
6
|
+
interface PhysicalLocationModalProps {
|
|
7
|
+
count: number;
|
|
8
|
+
onSave: (loc: PhysicalLocation) => Promise<void>;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function PhysicalLocationModal({ count, onSave, onClose }: PhysicalLocationModalProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Modal } from "../../../ui/components/Modal";
|
|
5
|
+
import { Input } from "../../../ui/components/Input";
|
|
6
|
+
import { Button } from "../../../ui/components/Button";
|
|
7
|
+
import { Row } from "../../../ui/components/Layout";
|
|
8
|
+
import { Text } from "../../../ui/components/Typography";
|
|
9
|
+
export function PhysicalLocationModal({ count, onSave, onClose }) {
|
|
10
|
+
const [zone, setZone] = useState("");
|
|
11
|
+
const [shelf, setShelf] = useState("");
|
|
12
|
+
const [bin, setBin] = useState("");
|
|
13
|
+
const [saving, setSaving] = useState(false);
|
|
14
|
+
const [error, setError] = useState("");
|
|
15
|
+
const handleSave = async () => {
|
|
16
|
+
setSaving(true);
|
|
17
|
+
setError("");
|
|
18
|
+
try {
|
|
19
|
+
await onSave({ zone: zone.trim(), shelf: shelf.trim(), bin: bin.trim() });
|
|
20
|
+
onClose();
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
setError(e instanceof Error ? e.message : "Failed to save location");
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
setSaving(false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return (_jsx(Modal, { isOpen: true, onClose: onClose, title: `Set Location — ${count} item${count !== 1 ? "s" : ""}`, size: "sm", actions: _jsxs(Row, { gap: "sm", justify: "end", children: [_jsx(Button, { variant: "ghost", onClick: onClose, disabled: saving, children: "Cancel" }), _jsx(Button, { variant: "primary", onClick: handleSave, disabled: saving, children: saving ? "Saving..." : "Save" })] }), children: _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [_jsx(Text, { variant: "muted", children: "Assign a physical storage location to the selected items. All fields are optional." }), _jsx(Input, { label: "Zone (e.g. A, B, Storage-1)", value: zone, onChange: e => setZone(e.target.value), placeholder: "A" }), _jsx(Input, { label: "Shelf (e.g. 3, Top, Middle)", value: shelf, onChange: e => setShelf(e.target.value), placeholder: "3" }), _jsx(Input, { label: "Bin (e.g. Blue, Box-12)", value: bin, onChange: e => setBin(e.target.value), placeholder: "Blue" }), error && _jsx(Text, { variant: "error", children: error })] }) }));
|
|
30
|
+
}
|