@mohasinac/appkit 3.2.5 → 3.2.7
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/SidebarCollapseToggle.js +1 -1
- package/dist/_internal/client/features/lottery/LotteryAdminEditView.js +3 -3
- package/dist/_internal/server/features/products/data.d.ts +2 -1
- package/dist/_internal/server/jobs/core/countersReconcile.js +2 -1
- package/dist/_internal/shared/actions/action-registry.js +62 -0
- package/dist/_internal/shared/features/products/types.d.ts +3 -2
- package/dist/client.d.ts +2 -0
- package/dist/client.js +1 -0
- package/dist/constants/api-endpoints.d.ts +12 -0
- package/dist/constants/api-endpoints.js +4 -0
- package/dist/constants/field-names.d.ts +2 -0
- package/dist/constants/field-names.js +2 -0
- package/dist/features/about/components/PublicProfileView.js +8 -5
- package/dist/features/account/components/UserOffersPanel.js +0 -1
- package/dist/features/addresses/repository/addresses.repository.d.ts +14 -1
- package/dist/features/addresses/repository/addresses.repository.js +122 -1
- package/dist/features/addresses/schemas/firestore.d.ts +22 -3
- package/dist/features/addresses/schemas/firestore.js +25 -0
- package/dist/features/addresses/schemas/index.d.ts +2 -2
- package/dist/features/admin/components/AdminAddressClustersView.d.ts +5 -0
- package/dist/features/admin/components/AdminAddressClustersView.js +38 -0
- package/dist/features/admin/components/AdminAddressesView.d.ts +5 -0
- package/dist/features/admin/components/AdminAddressesView.js +137 -0
- package/dist/features/admin/components/AdminCarouselEditorView.js +1 -4
- package/dist/features/admin/components/AdminFulfillmentView.js +2 -3
- package/dist/features/admin/components/AdminOrderEditorView.js +1 -3
- package/dist/features/admin/components/AdminPaymentClustersView.d.ts +5 -0
- package/dist/features/admin/components/AdminPaymentClustersView.js +37 -0
- package/dist/features/admin/components/AdminPaymentMethodsView.d.ts +5 -0
- package/dist/features/admin/components/AdminPaymentMethodsView.js +130 -0
- package/dist/features/admin/components/AdminSiteSettingsView.js +2 -2
- package/dist/features/admin/components/index.d.ts +8 -0
- package/dist/features/admin/components/index.js +4 -0
- package/dist/features/admin/schemas/firestore.d.ts +3 -5
- package/dist/features/admin/types/product.types.d.ts +2 -1
- package/dist/features/auth/actions/profile-actions.d.ts +3 -1
- package/dist/features/auth/actions/profile-actions.js +29 -2
- package/dist/features/auth/schemas/firestore.d.ts +8 -10
- package/dist/features/cart/schemas/index.d.ts +6 -6
- package/dist/features/categories/components/CategoryBundlesListing.js +1 -3
- package/dist/features/checkout/schemas/firestore.d.ts +4 -4
- package/dist/features/copilot/components/AdminCopilotView.js +4 -4
- package/dist/features/events/schemas/firestore.d.ts +2 -2
- package/dist/features/grouped/schemas/firestore.d.ts +2 -4
- package/dist/features/history/hooks/useHistory.js +3 -2
- package/dist/features/homepage/actions/homepage-section-actions.d.ts +6 -6
- package/dist/features/homepage/actions/homepage-section-actions.js +2 -2
- package/dist/features/homepage/components/PromoGrid.js +1 -1
- package/dist/features/homepage/schemas/firestore.d.ts +15 -14
- package/dist/features/layout/AppLayoutShell.js +3 -18
- package/dist/features/layout/background-seed-defaults.d.ts +19 -0
- package/dist/features/layout/background-seed-defaults.js +14 -0
- package/dist/features/lottery/schemas/firestore.d.ts +2 -2
- package/dist/features/messages/hooks/useConversation.js +5 -13
- package/dist/features/messages/hooks/useConversations.js +0 -1
- package/dist/features/messages/schemas/firestore.d.ts +2 -2
- package/dist/features/orders/components/RefundHistoryTable.js +1 -3
- package/dist/features/orders/schemas/firestore.d.ts +2 -1
- package/dist/features/orders/schemas/index.d.ts +11 -7
- package/dist/features/orders/schemas/index.js +1 -1
- package/dist/features/payments/repository/saved-payment-methods.repository.d.ts +48 -0
- package/dist/features/payments/repository/saved-payment-methods.repository.js +236 -0
- package/dist/features/payments/schemas/index.d.ts +1 -0
- package/dist/features/payments/schemas/index.js +1 -0
- package/dist/features/payments/schemas/saved-methods-firestore.d.ts +63 -0
- package/dist/features/payments/schemas/saved-methods-firestore.js +60 -0
- package/dist/features/payments/server.d.ts +2 -0
- package/dist/features/payments/server.js +2 -0
- package/dist/features/products/actions/product-actions.d.ts +2 -1
- package/dist/features/products/api/[id]/route.js +1 -1
- package/dist/features/products/api/route.js +1 -1
- package/dist/features/products/components/CompareOverlay.d.ts +18 -1
- package/dist/features/products/components/CompareOverlay.js +0 -16
- package/dist/features/products/components/ProductDetailActions.js +2 -1
- package/dist/features/products/components/ShowGroupSection.js +1 -3
- package/dist/features/products/repository/product-features.repository.js +1 -1
- package/dist/features/products/schemas/firestore.d.ts +3 -6
- package/dist/features/promotions/actions/coupon-actions.d.ts +2 -1
- package/dist/features/promotions/hooks/useCouponValidate.d.ts +2 -1
- package/dist/features/promotions/repository/coupons.repository.d.ts +2 -1
- package/dist/features/promotions/schemas/firestore.d.ts +4 -4
- package/dist/features/promotions/schemas/index.d.ts +6 -6
- package/dist/features/reviews/repository/reviews.repository.d.ts +12 -0
- package/dist/features/reviews/repository/reviews.repository.js +24 -0
- package/dist/features/reviews/schemas/firestore.d.ts +5 -1
- package/dist/features/reviews/schemas/firestore.js +2 -0
- package/dist/features/reviews/schemas/index.d.ts +6 -6
- package/dist/features/scams/components/ScamRegistryView.js +2 -2
- package/dist/features/scams/schemas/firestore.d.ts +6 -6
- package/dist/features/search/types/index.d.ts +3 -2
- package/dist/features/search/types/index.js +0 -1
- package/dist/features/seller/components/FulfillmentView.js +2 -3
- package/dist/features/seller/components/PrintCenterView.js +1 -3
- package/dist/features/seller/components/SellerAddressesView.js +7 -4
- package/dist/features/seller/components/SellerOffersPanel.js +0 -1
- package/dist/features/seller/components/SellerReviewsView.js +0 -1
- package/dist/features/seller/schemas/firestore.d.ts +2 -4
- package/dist/features/server-errors/schemas/firestore.d.ts +2 -2
- package/dist/features/store-extensions/schemas/firestore.d.ts +2 -2
- package/dist/features/stores/components/StoreScopedSearch.js +2 -4
- package/dist/features/stores/repository/store.repository.js +3 -1
- package/dist/features/stores/types/index.d.ts +2 -1
- package/dist/features/stores/types/index.js +0 -1
- package/dist/features/support/schemas/firestore.d.ts +2 -2
- package/dist/features/support/schemas/index.d.ts +8 -8
- package/dist/features/wishlist/schemas/index.d.ts +2 -2
- package/dist/features/wishlist/types/index.d.ts +2 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/next/routing/route-map.d.ts +8 -0
- package/dist/next/routing/route-map.js +4 -0
- package/dist/providers/auth-firebase/provider.js +3 -1
- package/dist/providers/auth-firebase/session.js +3 -1
- package/dist/repositories/index.d.ts +1 -0
- package/dist/repositories/index.js +1 -0
- package/dist/schemas/registry.d.ts +66 -66
- package/dist/schemas/webhooks/razorpay.d.ts +50 -50
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.js +1 -1
- package/dist/security/pii-schemas.d.ts +2 -0
- package/dist/security/pii-schemas.js +2 -0
- package/dist/seo/json-ld.d.ts +2 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/components/Form.d.ts +3 -1
- package/dist/ui/components/Form.js +2 -1
- package/dist/ui/components/Radio.d.ts +7 -0
- package/dist/ui/components/Radio.js +7 -0
- package/dist/ui/components/surface-tokens.d.ts +4 -0
- package/dist/ui/components/surface-tokens.js +24 -0
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/dist/ui/rich-text/RichText.js +0 -1
- package/package.json +5 -2
|
@@ -48,7 +48,7 @@ const productUpdateSchema = z
|
|
|
48
48
|
])
|
|
49
49
|
.optional(),
|
|
50
50
|
mainImage: z.string().optional(),
|
|
51
|
-
images: z.array(z.
|
|
51
|
+
images: z.array(z.union([z.string(), mediaFieldSchema])).optional(),
|
|
52
52
|
tags: z.array(z.string()).optional(),
|
|
53
53
|
featured: z.boolean().optional(),
|
|
54
54
|
isPromoted: z.boolean().optional(),
|
|
@@ -38,7 +38,7 @@ const productMutateSchema = z
|
|
|
38
38
|
])
|
|
39
39
|
.optional(),
|
|
40
40
|
mainImage: z.string().optional(),
|
|
41
|
-
images: z.array(z.
|
|
41
|
+
images: z.array(z.union([z.string(), mediaFieldSchema])).optional(),
|
|
42
42
|
tags: z.array(z.string()).optional(),
|
|
43
43
|
featured: z.boolean().optional(),
|
|
44
44
|
isPromoted: z.boolean().optional(),
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CompareOverlay â€" BK3
|
|
3
|
+
*
|
|
4
|
+
* Fullscreen comparison overlay triggered by the Compare bulk action on
|
|
5
|
+
* Products / Auctions / Pre-orders listings.
|
|
6
|
+
*
|
|
7
|
+
* Layout:
|
|
8
|
+
* - Desktop (md+): up to COMPARE_MAX_ITEMS columns side-by-side. Left rail
|
|
9
|
+
* holds field labels, columns hold values.
|
|
10
|
+
* - Mobile (< md): single-card swipeable view with dot pagination. The
|
|
11
|
+
* `useSwipe` hook detects left/right swipes on the card area.
|
|
12
|
+
*
|
|
13
|
+
* Data: parent passes either pre-loaded `items` or a list of `productIds`.
|
|
14
|
+
* When ids are passed, this component does a single fetch to
|
|
15
|
+
* `GET /api/products?ids=<csv>` (BK3 listByIds endpoint).
|
|
16
|
+
*/
|
|
17
|
+
import type { ListingType } from "../types";
|
|
1
18
|
/** Subset of ProductDocument the overlay needs. Kept loose so it can be fed
|
|
2
19
|
* sanitized public payloads directly. */
|
|
3
20
|
export interface CompareProductLike {
|
|
@@ -17,7 +34,7 @@ export interface CompareProductLike {
|
|
|
17
34
|
storeName?: string;
|
|
18
35
|
storeSlug?: string;
|
|
19
36
|
/** Canonical discriminator (SB1-G Phase 4). */
|
|
20
|
-
listingType?:
|
|
37
|
+
listingType?: ListingType;
|
|
21
38
|
features?: string[];
|
|
22
39
|
}
|
|
23
40
|
interface CompareFieldLabels {
|
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
/**
|
|
4
|
-
* CompareOverlay â€" BK3
|
|
5
|
-
*
|
|
6
|
-
* Fullscreen comparison overlay triggered by the Compare bulk action on
|
|
7
|
-
* Products / Auctions / Pre-orders listings.
|
|
8
|
-
*
|
|
9
|
-
* Layout:
|
|
10
|
-
* - Desktop (md+): up to COMPARE_MAX_ITEMS columns side-by-side. Left rail
|
|
11
|
-
* holds field labels, columns hold values.
|
|
12
|
-
* - Mobile (< md): single-card swipeable view with dot pagination. The
|
|
13
|
-
* `useSwipe` hook detects left/right swipes on the card area.
|
|
14
|
-
*
|
|
15
|
-
* Data: parent passes either pre-loaded `items` or a list of `productIds`.
|
|
16
|
-
* When ids are passed, this component does a single fetch to
|
|
17
|
-
* `GET /api/products?ids=<csv>` (BK3 listByIds endpoint).
|
|
18
|
-
*/
|
|
19
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
20
4
|
const __P = {
|
|
21
5
|
p4: "p-4",
|
|
@@ -59,7 +59,8 @@ export function ProductDetailActions({ productId, productSlug, productTitle, pro
|
|
|
59
59
|
try {
|
|
60
60
|
await apiClient.post("/api/wishlist", { productId });
|
|
61
61
|
}
|
|
62
|
-
catch (err) {
|
|
62
|
+
catch (err) {
|
|
63
|
+
void normalizeError(err);
|
|
63
64
|
const status = err?.status;
|
|
64
65
|
if (status === 401 || status === 403) {
|
|
65
66
|
addToGuestWishlist(productId, "product", {
|
|
@@ -23,9 +23,7 @@ function MemberThumb({ member, isCurrent }) {
|
|
|
23
23
|
const price = formatCurrency(member.price, member.currency ?? "INR");
|
|
24
24
|
return (_jsxs(Link, { href: href, "aria-label": member.title, className: "flex flex-col items-center gap-1.5 flex-shrink-0 w-16 group", children: [_jsxs("div", { className: `relative w-14 h-14 rounded-full overflow-hidden border-2 transition-all ${isCurrent
|
|
25
25
|
? "border-[var(--appkit-color-primary)] ring-2 ring-[var(--appkit-color-primary)]/30"
|
|
26
|
-
: "border-zinc-200 dark:border-zinc-700 group-hover:border-[var(--appkit-color-primary)]"}`, children: [_jsx(MediaImage, { src: image, alt: member.title, size: "card" }), member.isGroupParent && (
|
|
27
|
-
// audit-inline-style-ok: single-corner border-radius; no appkit rounded= variant covers individual corners
|
|
28
|
-
_jsx(Span, { color: "inverse", className: "absolute bottom-0 right-0 bg-[var(--appkit-color-primary)] text-[8px] leading-none px-[0.25rem] py-[0.125rem]", style: { borderTopLeftRadius: "0.25rem" }, children: "Set" }))] }), _jsx(Text, { className: "text-[10px] leading-tight line-clamp-2 w-full", color: "muted", align: "center", children: member.title }), _jsx(Text, { className: "text-[10px]", color: "primary", weight: "semibold", children: price })] }));
|
|
26
|
+
: "border-zinc-200 dark:border-zinc-700 group-hover:border-[var(--appkit-color-primary)]"}`, children: [_jsx(MediaImage, { src: image, alt: member.title, size: "card" }), member.isGroupParent && (_jsx(Span, { color: "inverse", rounded: "sm", className: "absolute bottom-0 right-0 bg-[var(--appkit-color-primary)] text-[8px] leading-none px-[0.25rem] py-[0.125rem]", children: "Set" }))] }), _jsx(Text, { className: "text-[10px] leading-tight line-clamp-2 w-full", color: "muted", align: "center", children: member.title }), _jsx(Text, { className: "text-[10px]", color: "primary", weight: "semibold", children: price })] }));
|
|
29
27
|
}
|
|
30
28
|
function GroupTableRow({ member }) {
|
|
31
29
|
const href = memberHref(member);
|
|
@@ -37,7 +37,7 @@ export class ProductFeaturesRepository extends BaseRepository {
|
|
|
37
37
|
if (filter.storeId)
|
|
38
38
|
q = q.where(PRODUCT_FIELDS.STORE_ID, "==", filter.storeId);
|
|
39
39
|
if (typeof filter.isActive === "boolean") {
|
|
40
|
-
q = q.where(
|
|
40
|
+
q = q.where(PRODUCT_FIELDS.IS_ACTIVE, "==", filter.isActive);
|
|
41
41
|
}
|
|
42
42
|
const snap = await q.get();
|
|
43
43
|
let docs = snap.docs.map((d) => this.mapDoc(d));
|
|
@@ -26,12 +26,12 @@ export interface CustomField {
|
|
|
26
26
|
}
|
|
27
27
|
export declare const MAX_CUSTOM_FIELDS = 50;
|
|
28
28
|
export declare const MAX_CUSTOM_SECTIONS = 3;
|
|
29
|
-
export
|
|
29
|
+
export type CustomSection = {
|
|
30
30
|
id: string;
|
|
31
31
|
title: string;
|
|
32
32
|
text?: string;
|
|
33
33
|
fields?: CustomField[];
|
|
34
|
-
}
|
|
34
|
+
};
|
|
35
35
|
export type GradingService = "PSA" | "BGS" | "CGC" | "SGC" | "OTHER";
|
|
36
36
|
export interface ProductGrading {
|
|
37
37
|
/** Grading service (PSA / BGS / CGC / SGC / OTHER) — sortable index field. */
|
|
@@ -319,8 +319,7 @@ export type ProductUpdateInput = Partial<Pick<ProductDocument, (typeof PRODUCT_U
|
|
|
319
319
|
export type ProductAdminUpdateInput = Partial<Omit<ProductDocument, "id" | "createdAt">>;
|
|
320
320
|
export declare const PRODUCT_CODES_SUBCOLLECTION: "codes";
|
|
321
321
|
export type ProductCodeStatus = "available" | "claimed" | "revoked";
|
|
322
|
-
export interface ProductCodeDocument {
|
|
323
|
-
id: string;
|
|
322
|
+
export interface ProductCodeDocument extends BaseDocument {
|
|
324
323
|
productId: string;
|
|
325
324
|
code: string;
|
|
326
325
|
status: ProductCodeStatus;
|
|
@@ -328,8 +327,6 @@ export interface ProductCodeDocument {
|
|
|
328
327
|
claimedByUserId?: string;
|
|
329
328
|
claimedAt?: Date;
|
|
330
329
|
expiresAt?: Date;
|
|
331
|
-
createdAt: Date;
|
|
332
|
-
updatedAt: Date;
|
|
333
330
|
}
|
|
334
331
|
export declare const productQueryHelpers: {
|
|
335
332
|
readonly byStore: (storeId: string) => readonly ["storeId", "==", string];
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* are handled by the calling server action in the consumer.
|
|
6
6
|
*/
|
|
7
7
|
import type { CouponValidationResult } from "../schemas";
|
|
8
|
+
import type { ListingType } from "../../products/types";
|
|
8
9
|
export type { CouponValidationResult };
|
|
9
10
|
export interface CouponCartValidationResult {
|
|
10
11
|
valid: boolean;
|
|
@@ -22,7 +23,7 @@ export type CouponCartItem = {
|
|
|
22
23
|
price: number;
|
|
23
24
|
quantity: number;
|
|
24
25
|
/** Canonical listing-kind snapshot (SB1-G Phase 4). */
|
|
25
|
-
listingType:
|
|
26
|
+
listingType: ListingType;
|
|
26
27
|
};
|
|
27
28
|
export declare function validateCoupon(userId: string, code: string, orderTotal: number): Promise<CouponValidationResult>;
|
|
28
29
|
export declare function validateCouponForCart(userId: string, code: string, cartItems: CouponCartItem[]): Promise<CouponCartValidationResult>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { JsonValue } from "@mohasinac/appkit";
|
|
2
|
+
import type { ListingType } from "../../products/types";
|
|
2
3
|
interface ValidateCouponPayload {
|
|
3
4
|
code: string;
|
|
4
5
|
orderTotal?: number;
|
|
@@ -8,7 +9,7 @@ interface ValidateCouponPayload {
|
|
|
8
9
|
price: number;
|
|
9
10
|
quantity: number;
|
|
10
11
|
/** Canonical listing-kind snapshot (SB1-G Phase 4). */
|
|
11
|
-
listingType?:
|
|
12
|
+
listingType?: ListingType;
|
|
12
13
|
}>;
|
|
13
14
|
}
|
|
14
15
|
interface ValidateCouponResult {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ListingType } from "../../products/types";
|
|
1
2
|
/**
|
|
2
3
|
* Coupons Repository
|
|
3
4
|
*
|
|
@@ -141,7 +142,7 @@ export declare class CouponsRepository extends BaseRepository<CouponDocument> {
|
|
|
141
142
|
price: number;
|
|
142
143
|
quantity: number;
|
|
143
144
|
/** Canonical listing-kind snapshot (SB1-G Phase 4). */
|
|
144
|
-
listingType:
|
|
145
|
+
listingType: ListingType;
|
|
145
146
|
}>): Promise<{
|
|
146
147
|
valid: boolean;
|
|
147
148
|
coupon?: CouponDocument;
|
|
@@ -60,14 +60,14 @@ export interface CouponDocument extends BaseDocument {
|
|
|
60
60
|
createdBy: string;
|
|
61
61
|
stats: CouponStats;
|
|
62
62
|
}
|
|
63
|
-
export
|
|
63
|
+
export type CouponUsageDocument = {
|
|
64
64
|
id: string;
|
|
65
65
|
userId: string;
|
|
66
66
|
couponCode: string;
|
|
67
67
|
usageCount: number;
|
|
68
68
|
lastUsedAt: Date;
|
|
69
69
|
orders: string[];
|
|
70
|
-
}
|
|
70
|
+
};
|
|
71
71
|
export type ClaimedCouponStatus = "active" | "expired" | "used";
|
|
72
72
|
export type ClaimedCouponSource = "manual" | "promo" | "spin" | "raffle" | "prize-draw";
|
|
73
73
|
export interface ClaimedCouponSnapshot {
|
|
@@ -79,7 +79,7 @@ export interface ClaimedCouponSnapshot {
|
|
|
79
79
|
discount: DiscountConfig;
|
|
80
80
|
restrictions: RestrictionsConfig;
|
|
81
81
|
}
|
|
82
|
-
export
|
|
82
|
+
export type ClaimedCouponDocument = {
|
|
83
83
|
id: string;
|
|
84
84
|
userId: string;
|
|
85
85
|
couponId: string;
|
|
@@ -98,7 +98,7 @@ export interface ClaimedCouponDocument {
|
|
|
98
98
|
usedOrderId?: string;
|
|
99
99
|
claimedAt: Date;
|
|
100
100
|
updatedAt: Date;
|
|
101
|
-
}
|
|
101
|
+
};
|
|
102
102
|
export declare const CLAIMED_COUPONS_COLLECTION: "claimedCoupons";
|
|
103
103
|
export declare const CLAIMED_COUPONS_INDEXED_FIELDS: readonly ["userId", "couponCode", "status", "expiresAt"];
|
|
104
104
|
export declare function createClaimedCouponId(userId: string, couponCode: string): string;
|
|
@@ -405,22 +405,22 @@ export declare const couponUsageFirestoreSchema: z.ZodObject<{
|
|
|
405
405
|
orders: z.ZodArray<z.ZodString, "many">;
|
|
406
406
|
}, "strip", z.ZodTypeAny, {
|
|
407
407
|
id: string;
|
|
408
|
-
orders: string[];
|
|
409
408
|
userId: string;
|
|
410
|
-
couponCode: string;
|
|
411
|
-
usageCount: number;
|
|
412
409
|
lastUsedAt: string | Date | z.objectOutputType<{
|
|
413
410
|
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
414
411
|
}, z.ZodTypeAny, "passthrough">;
|
|
415
|
-
}, {
|
|
416
|
-
id: string;
|
|
417
412
|
orders: string[];
|
|
418
|
-
userId: string;
|
|
419
413
|
couponCode: string;
|
|
420
414
|
usageCount: number;
|
|
415
|
+
}, {
|
|
416
|
+
id: string;
|
|
417
|
+
userId: string;
|
|
421
418
|
lastUsedAt: string | Date | z.objectInputType<{
|
|
422
419
|
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
423
420
|
}, z.ZodTypeAny, "passthrough">;
|
|
421
|
+
orders: string[];
|
|
422
|
+
couponCode: string;
|
|
423
|
+
usageCount: number;
|
|
424
424
|
}>;
|
|
425
425
|
export declare const claimedCouponStatusSchema: z.ZodEnum<["active", "expired", "used"]>;
|
|
426
426
|
export declare const claimedCouponSourceSchema: z.ZodEnum<["manual", "promo", "spin", "raffle", "prize-draw"]>;
|
|
@@ -35,6 +35,10 @@ declare class ReviewRepository extends BaseRepository<ReviewDocument> {
|
|
|
35
35
|
* Cloud Functions compatibility: approved review count + average by store.
|
|
36
36
|
*/
|
|
37
37
|
getApprovedRatingAggregateByStore(storeId: string): Promise<ReviewRatingAggregate>;
|
|
38
|
+
/** Find reviews where this user is the reviewee (seller→buyer reviews received by a buyer). */
|
|
39
|
+
findByReviewee(revieweeId: string): Promise<ReviewDocument[]>;
|
|
40
|
+
/** Find reviews written by a user filtered by their role as reviewer. */
|
|
41
|
+
findByUserAsRole(userId: string, role: "buyer" | "seller"): Promise<ReviewDocument[]>;
|
|
38
42
|
static readonly SIEVE_FIELDS: {
|
|
39
43
|
id: {
|
|
40
44
|
canFilter: boolean;
|
|
@@ -68,6 +72,14 @@ declare class ReviewRepository extends BaseRepository<ReviewDocument> {
|
|
|
68
72
|
canFilter: boolean;
|
|
69
73
|
canSort: boolean;
|
|
70
74
|
};
|
|
75
|
+
revieweeId: {
|
|
76
|
+
canFilter: boolean;
|
|
77
|
+
canSort: boolean;
|
|
78
|
+
};
|
|
79
|
+
reviewerRole: {
|
|
80
|
+
canFilter: boolean;
|
|
81
|
+
canSort: boolean;
|
|
82
|
+
};
|
|
71
83
|
status: {
|
|
72
84
|
canFilter: boolean;
|
|
73
85
|
canSort: boolean;
|
|
@@ -8,6 +8,8 @@ const REVIEW_FIELDS = {
|
|
|
8
8
|
STATUS: "status",
|
|
9
9
|
FEATURED: "featured",
|
|
10
10
|
CREATED_AT: "createdAt",
|
|
11
|
+
REVIEWEE_ID: "revieweeId",
|
|
12
|
+
REVIEWER_ROLE: "reviewerRole",
|
|
11
13
|
};
|
|
12
14
|
class ReviewRepository extends BaseRepository {
|
|
13
15
|
constructor() {
|
|
@@ -197,6 +199,26 @@ class ReviewRepository extends BaseRepository {
|
|
|
197
199
|
const avgRating = Math.round((sum / count) * 10) / 10;
|
|
198
200
|
return { count, avgRating };
|
|
199
201
|
}
|
|
202
|
+
/** Find reviews where this user is the reviewee (seller→buyer reviews received by a buyer). */
|
|
203
|
+
async findByReviewee(revieweeId) {
|
|
204
|
+
const snapshot = await this.db
|
|
205
|
+
.collection(this.collection)
|
|
206
|
+
.where(REVIEW_FIELDS.REVIEWEE_ID, "==", revieweeId)
|
|
207
|
+
.where(REVIEW_FIELDS.STATUS, "==", "approved")
|
|
208
|
+
.orderBy(REVIEW_FIELDS.CREATED_AT, "desc")
|
|
209
|
+
.get();
|
|
210
|
+
return snapshot.docs.map((doc) => this.mapDoc(doc));
|
|
211
|
+
}
|
|
212
|
+
/** Find reviews written by a user filtered by their role as reviewer. */
|
|
213
|
+
async findByUserAsRole(userId, role) {
|
|
214
|
+
const snapshot = await this.db
|
|
215
|
+
.collection(this.collection)
|
|
216
|
+
.where(REVIEW_FIELDS.USER_ID, "==", userId)
|
|
217
|
+
.where(REVIEW_FIELDS.REVIEWER_ROLE, "==", role)
|
|
218
|
+
.orderBy(REVIEW_FIELDS.CREATED_AT, "desc")
|
|
219
|
+
.get();
|
|
220
|
+
return snapshot.docs.map((doc) => this.mapDoc(doc));
|
|
221
|
+
}
|
|
200
222
|
async listForProduct(productId, model) {
|
|
201
223
|
const baseQuery = this.getCollection().where(REVIEW_FIELDS.PRODUCT_ID, "==", productId);
|
|
202
224
|
const result = await this.sieveQuery(model, ReviewRepository.SIEVE_FIELDS, {
|
|
@@ -232,6 +254,8 @@ ReviewRepository.SIEVE_FIELDS = {
|
|
|
232
254
|
userName: { canFilter: false, canSort: false },
|
|
233
255
|
storeId: { canFilter: true, canSort: false },
|
|
234
256
|
storeName: { canFilter: true, canSort: false },
|
|
257
|
+
revieweeId: { canFilter: true, canSort: false },
|
|
258
|
+
reviewerRole: { canFilter: true, canSort: false },
|
|
235
259
|
status: { canFilter: true, canSort: true },
|
|
236
260
|
rating: { canFilter: true, canSort: true },
|
|
237
261
|
verified: { canFilter: true, canSort: false },
|
|
@@ -46,9 +46,13 @@ export interface ReviewDocument extends BaseDocument {
|
|
|
46
46
|
sellerRepliedAt?: Date;
|
|
47
47
|
approvedAt?: Date;
|
|
48
48
|
rejectedAt?: Date;
|
|
49
|
+
/** Set only on seller→buyer reviews. The userId of the buyer being reviewed. */
|
|
50
|
+
revieweeId?: string;
|
|
51
|
+
/** Absent on legacy docs = "buyer". Distinguishes seller→buyer reviews from buyer→product reviews. */
|
|
52
|
+
reviewerRole?: "buyer" | "seller";
|
|
49
53
|
}
|
|
50
54
|
export declare const REVIEW_COLLECTION: "reviews";
|
|
51
|
-
export declare const REVIEW_INDEXED_FIELDS: readonly ["productId", "storeId", "userId", "status", "rating", "verified", "featured", "createdAt"];
|
|
55
|
+
export declare const REVIEW_INDEXED_FIELDS: readonly ["productId", "storeId", "userId", "revieweeId", "reviewerRole", "status", "rating", "verified", "featured", "createdAt"];
|
|
52
56
|
export declare const DEFAULT_REVIEW_DATA: Partial<ReviewDocument>;
|
|
53
57
|
export declare const REVIEW_PUBLIC_FIELDS: readonly ["id", "productId", "userName", "userAvatar", "rating", "title", "comment", "helpfulCount", "verified", "images", "createdAt"];
|
|
54
58
|
export declare const REVIEW_UPDATABLE_FIELDS: readonly ["rating", "title", "comment", "images"];
|
|
@@ -108,10 +108,10 @@ export declare const reviewFirestoreSchema: z.ZodObject<{
|
|
|
108
108
|
updatedAt: string | Date | z.objectOutputType<{
|
|
109
109
|
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
110
110
|
}, z.ZodTypeAny, "passthrough">;
|
|
111
|
+
userId: string;
|
|
111
112
|
productId: string;
|
|
112
113
|
productTitle: string;
|
|
113
114
|
rating: number;
|
|
114
|
-
userId: string;
|
|
115
115
|
userName: string;
|
|
116
116
|
comment: string;
|
|
117
117
|
helpfulCount: number;
|
|
@@ -155,10 +155,10 @@ export declare const reviewFirestoreSchema: z.ZodObject<{
|
|
|
155
155
|
updatedAt: string | Date | z.objectInputType<{
|
|
156
156
|
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
157
157
|
}, z.ZodTypeAny, "passthrough">;
|
|
158
|
+
userId: string;
|
|
158
159
|
productId: string;
|
|
159
160
|
productTitle: string;
|
|
160
161
|
rating: number;
|
|
161
|
-
userId: string;
|
|
162
162
|
userName: string;
|
|
163
163
|
comment: string;
|
|
164
164
|
helpfulCount: number;
|
|
@@ -288,9 +288,9 @@ export declare const reviewSchema: z.ZodObject<{
|
|
|
288
288
|
}, "strip", z.ZodTypeAny, {
|
|
289
289
|
status: "pending" | "approved" | "rejected";
|
|
290
290
|
id: string;
|
|
291
|
+
userId: string;
|
|
291
292
|
productId: string;
|
|
292
293
|
rating: 3 | 1 | 2 | 4 | 5;
|
|
293
|
-
userId: string;
|
|
294
294
|
userName: string;
|
|
295
295
|
video?: {
|
|
296
296
|
url: string;
|
|
@@ -318,9 +318,9 @@ export declare const reviewSchema: z.ZodObject<{
|
|
|
318
318
|
}, {
|
|
319
319
|
status: "pending" | "approved" | "rejected";
|
|
320
320
|
id: string;
|
|
321
|
+
userId: string;
|
|
321
322
|
productId: string;
|
|
322
323
|
rating: 3 | 1 | 2 | 4 | 5;
|
|
323
|
-
userId: string;
|
|
324
324
|
userName: string;
|
|
325
325
|
video?: {
|
|
326
326
|
url: string;
|
|
@@ -364,9 +364,9 @@ export declare const reviewListParamsSchema: z.ZodObject<{
|
|
|
364
364
|
featured?: boolean | undefined;
|
|
365
365
|
page?: number | undefined;
|
|
366
366
|
perPage?: number | undefined;
|
|
367
|
+
userId?: string | undefined;
|
|
367
368
|
productId?: string | undefined;
|
|
368
369
|
rating?: number | undefined;
|
|
369
|
-
userId?: string | undefined;
|
|
370
370
|
}, {
|
|
371
371
|
status?: "pending" | "approved" | "rejected" | undefined;
|
|
372
372
|
sort?: string | undefined;
|
|
@@ -374,7 +374,7 @@ export declare const reviewListParamsSchema: z.ZodObject<{
|
|
|
374
374
|
featured?: boolean | undefined;
|
|
375
375
|
page?: number | undefined;
|
|
376
376
|
perPage?: number | undefined;
|
|
377
|
+
userId?: string | undefined;
|
|
377
378
|
productId?: string | undefined;
|
|
378
379
|
rating?: number | undefined;
|
|
379
|
-
userId?: string | undefined;
|
|
380
380
|
}>;
|
|
@@ -6,7 +6,7 @@ const CLS_ICON_SM = "h-3 w-3 shrink-0";
|
|
|
6
6
|
const CLS_ROW_CHEVRON = "h-4 w-4 shrink-0 text-zinc-300 transition group-hover:text-error dark:text-zinc-600";
|
|
7
7
|
const CLS_PILL_LINK = "inline-flex items-center gap-1 rounded-full bg-error-surface dark:bg-error-surface px-2.5 py-0.5 text-xs font-medium text-error dark:text-error hover:bg-error-surface transition-colors";
|
|
8
8
|
import { Shield, Phone, Wallet, Mail, ChevronRight, Search } from "lucide-react";
|
|
9
|
-
import { Container, Div, Heading, Main, Section, Text, Grid, Stack, Row, Card, Badge, Alert, EmptyState, Input, } from "../../../ui";
|
|
9
|
+
import { Button, Container, Div, Form, Heading, Main, Section, Select, Text, Grid, Stack, Row, Card, Badge, Alert, EmptyState, Input, } from "../../../ui";
|
|
10
10
|
import { listVerifiedScammers } from "../actions/scam-actions";
|
|
11
11
|
import { SCAM_PLATFORM_LABELS } from "../schemas/firestore";
|
|
12
12
|
import { SCAM_TYPES, SCAM_TYPE_LABELS } from "../constants/scam-types";
|
|
@@ -65,7 +65,7 @@ export async function ScamRegistryView({ searchParams = {} }) {
|
|
|
65
65
|
const qs = p.toString();
|
|
66
66
|
return `/scams${qs ? `?${qs}` : ""}`;
|
|
67
67
|
}
|
|
68
|
-
return (_jsxs(Main, { children: [_jsx(Div, { className: "border-b appkit-alert--warning", rounded: "none", children: _jsx(Container, { padding: "y-xs", size: "xl", className: "", children: _jsxs(Alert, { variant: "warning", compact: true, children: ["All profiles on this page have been verified by our moderation team. If you recognise a scammer not listed here,", " ", _jsx(Link, { href: reportHref, className: "font-medium underline hover:no-underline", children: "report them" }), "."] }) }) }), _jsx(Section, { padding: "y-2xl", children: _jsx(Container, { size: "xl", children: _jsxs(Stack, { gap: "xl", children: [_jsxs(Row, { justify: "between", gap: "md", align: "end", wrap: true, children: [_jsxs(Stack, { gap: "xs", children: [_jsx(Heading, { level: 1, weight: "semibold", size: "3xl", children: "Scam Registry" }), _jsx(Text, { variant: "secondary", size: "sm", children: "Verified scammers active in India's collectibles community. Search by name, phone, or UPI." })] }), _jsxs(Link, { href: reportHref, className: "appkit-button appkit-button--danger appkit-button--md shrink-0", children: [_jsx(Shield, { className: "h-4 w-4" }), "Report a Scammer"] })] }),
|
|
68
|
+
return (_jsxs(Main, { children: [_jsx(Div, { className: "border-b appkit-alert--warning", rounded: "none", children: _jsx(Container, { padding: "y-xs", size: "xl", className: "", children: _jsxs(Alert, { variant: "warning", compact: true, children: ["All profiles on this page have been verified by our moderation team. If you recognise a scammer not listed here,", " ", _jsx(Link, { href: reportHref, className: "font-medium underline hover:no-underline", children: "report them" }), "."] }) }) }), _jsx(Section, { padding: "y-2xl", children: _jsx(Container, { size: "xl", children: _jsxs(Stack, { gap: "xl", children: [_jsxs(Row, { justify: "between", gap: "md", align: "end", wrap: true, children: [_jsxs(Stack, { gap: "xs", children: [_jsx(Heading, { level: 1, weight: "semibold", size: "3xl", children: "Scam Registry" }), _jsx(Text, { variant: "secondary", size: "sm", children: "Verified scammers active in India's collectibles community. Search by name, phone, or UPI." })] }), _jsxs(Link, { href: reportHref, className: "appkit-button appkit-button--danger appkit-button--md shrink-0", children: [_jsx(Shield, { className: "h-4 w-4" }), "Report a Scammer"] })] }), _jsx(Form, { method: "GET", children: _jsxs(Row, { wrap: true, gap: "sm", children: [_jsx(Div, { className: "flex-1 min-w-48", children: _jsx(Input, { type: "search", name: "q", defaultValue: query, placeholder: "Search name, phone, UPI ID, or email\u2026", icon: _jsx(Search, { className: "h-4 w-4" }) }) }), _jsx(Select, { name: "scamType", defaultValue: scamType, options: SCAM_TYPES.map((t) => ({ value: t.id, label: t.label })), placeholder: "All scam types" }), _jsx(Select, { name: "sort", defaultValue: sort, options: SORT_OPTIONS.map((o) => ({ value: o.value, label: o.label })) }), _jsx(Button, { type: "submit", variant: "primary", size: "sm", children: "Search" }), (query || scamType || sort !== "-createdAt") && (_jsx(Link, { href: ROUTES.PUBLIC.SCAMS, className: "rounded-lg border border-zinc-300 dark:border-slate-600 px-4 py-2 text-sm text-zinc-600 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:bg-slate-800 transition-colors", children: "Clear" }))] }) }), scamType && SCAM_TYPE_LABELS[scamType] && (_jsxs(Row, { gap: "sm", align: "center", children: [_jsx(Text, { variant: "secondary", size: "xs", children: "Filtering by:" }), _jsxs(Link, { href: buildHref({ scamType: "" }), className: CLS_PILL_LINK, children: [SCAM_TYPE_LABELS[scamType], _jsx(Span, { "aria-hidden": "true", children: "\u00D7" })] })] })), result.items.length === 0 ? (_jsx(EmptyState, { icon: _jsx(Shield, { className: "h-12 w-12" }), title: query || scamType
|
|
69
69
|
? "No verified scammers matched your filters"
|
|
70
70
|
: "No verified scammers in the registry yet", description: query || scamType
|
|
71
71
|
? "Try a different search or clear your filters."
|
|
@@ -167,7 +167,7 @@ export interface ScammerDocument extends BaseDocument {
|
|
|
167
167
|
* it is stored here instead of creating a duplicate top-level profile.
|
|
168
168
|
* The public detail page shows these in a table ("Other victims who reported this person").
|
|
169
169
|
*/
|
|
170
|
-
export
|
|
170
|
+
export type ScammerIncidentDocument = {
|
|
171
171
|
/** Firestore auto-ID — incidents never get semantic slugs. */
|
|
172
172
|
id: string;
|
|
173
173
|
/** Parent ScammerDocument id. */
|
|
@@ -197,7 +197,7 @@ export interface ScammerIncidentDocument {
|
|
|
197
197
|
verifiedBy?: string;
|
|
198
198
|
verifiedAt?: Date;
|
|
199
199
|
createdAt: Date;
|
|
200
|
-
}
|
|
200
|
+
};
|
|
201
201
|
export type ScammerIncidentCreateInput = Pick<ScammerIncidentDocument, "scammerId" | "reportedBy" | "reportedByAnon" | "scamType" | "scamPlatform" | "description" | "amountLost" | "itemInvolved" | "evidence" | "matchedPhones" | "matchedUpiIds" | "matchedEmails" | "matchedNames">;
|
|
202
202
|
export declare const SCAMMER_INCIDENTS_SUBCOLLECTION: "incidents";
|
|
203
203
|
export declare const DEFAULT_SCAMMER_INCIDENT_DATA: Partial<ScammerIncidentDocument>;
|
|
@@ -213,7 +213,7 @@ export declare const DEFAULT_SCAMMER_INCIDENT_DATA: Partial<ScammerIncidentDocum
|
|
|
213
213
|
* - isAccused is self-declared — admin reviews and can set isAccusedVerified
|
|
214
214
|
* - Hidden comments are still stored but not rendered to public
|
|
215
215
|
*/
|
|
216
|
-
export
|
|
216
|
+
export type ScammerCommentDocument = {
|
|
217
217
|
/** Firestore auto-ID. */
|
|
218
218
|
id: string;
|
|
219
219
|
scammerId: string;
|
|
@@ -245,7 +245,7 @@ export interface ScammerCommentDocument {
|
|
|
245
245
|
hiddenReason?: string;
|
|
246
246
|
createdAt: Date;
|
|
247
247
|
updatedAt?: Date;
|
|
248
|
-
}
|
|
248
|
+
};
|
|
249
249
|
export type ScammerCommentCreateInput = Pick<ScammerCommentDocument, "scammerId" | "authorId" | "authorDisplayName" | "authorRole" | "isAccused" | "isVerifiedVictim" | "linkedOrderId" | "body">;
|
|
250
250
|
export declare const SCAMMER_COMMENTS_SUBCOLLECTION: "comments";
|
|
251
251
|
export declare const DEFAULT_SCAMMER_COMMENT_DATA: Partial<ScammerCommentDocument>;
|
|
@@ -263,7 +263,7 @@ export declare const MAX_COMMENT_BODY_LENGTH = 500;
|
|
|
263
263
|
* On uphold: admin edits profile manually before marking upheld.
|
|
264
264
|
* On dismiss: profile status is unchanged; contest is archived.
|
|
265
265
|
*/
|
|
266
|
-
export
|
|
266
|
+
export type ScammerContestDocument = {
|
|
267
267
|
/** Firestore auto-ID. */
|
|
268
268
|
id: string;
|
|
269
269
|
scammerId: string;
|
|
@@ -288,7 +288,7 @@ export interface ScammerContestDocument {
|
|
|
288
288
|
/** Internal note — never shown to contest submitter or public. */
|
|
289
289
|
reviewNote?: string;
|
|
290
290
|
createdAt: Date;
|
|
291
|
-
}
|
|
291
|
+
};
|
|
292
292
|
export type ScammerContestCreateInput = Pick<ScammerContestDocument, "scammerId" | "contestType" | "contestedBy" | "contestedByAnon" | "explanation" | "evidence">;
|
|
293
293
|
export declare const SCAMMER_CONTESTS_SUBCOLLECTION: "contests";
|
|
294
294
|
export declare const DEFAULT_SCAMMER_CONTEST_DATA: Partial<ScammerContestDocument>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ListingType } from "../../products/types";
|
|
1
2
|
export interface SearchProductItem {
|
|
2
3
|
id: string;
|
|
3
4
|
title: string;
|
|
@@ -9,7 +10,7 @@ export interface SearchProductItem {
|
|
|
9
10
|
status: string;
|
|
10
11
|
featured?: boolean;
|
|
11
12
|
/** Canonical listing-kind discriminator (SB1-G Phase 4). */
|
|
12
|
-
listingType?:
|
|
13
|
+
listingType?: ListingType;
|
|
13
14
|
currentBid?: number;
|
|
14
15
|
isPromoted?: boolean;
|
|
15
16
|
slug: string;
|
|
@@ -32,7 +33,7 @@ export interface SearchQuery {
|
|
|
32
33
|
maxPrice?: number;
|
|
33
34
|
condition?: string;
|
|
34
35
|
/** Canonical listing-kind discriminator (SB1-G Phase 4). */
|
|
35
|
-
listingType?:
|
|
36
|
+
listingType?: ListingType;
|
|
36
37
|
inStock?: boolean;
|
|
37
38
|
minRating?: number;
|
|
38
39
|
sort?: string;
|
|
@@ -31,14 +31,13 @@ export function FulfillmentView({ currentUserId, }) {
|
|
|
31
31
|
const [actionLoadingId, setActionLoadingId] = useState(null);
|
|
32
32
|
const { showToast } = useToast();
|
|
33
33
|
const fetchOrders = useCallback(async () => {
|
|
34
|
-
// toast-intentionally-silent: background data loader — stale list is kept on error
|
|
35
34
|
setIsLoadingOrders(true);
|
|
36
35
|
try {
|
|
37
36
|
const res = await apiClient.get(SELLER_ENDPOINTS.ORDERS_FULFILLMENT);
|
|
38
37
|
setOrders(res.orders ?? []);
|
|
39
38
|
}
|
|
40
|
-
catch {
|
|
41
|
-
|
|
39
|
+
catch (err) {
|
|
40
|
+
void normalizeError(err);
|
|
42
41
|
}
|
|
43
42
|
finally {
|
|
44
43
|
setIsLoadingOrders(false);
|
|
@@ -28,9 +28,7 @@ function ProductLabel({ product }) {
|
|
|
28
28
|
return (_jsxs(Stack, { surface: "card", padding: "sm", rounded: "sm", gap: "xs", className: "break-inside-avoid text-center w-[200px]", children: [product.barcodeId ? (_jsx("svg", { ref: svgRef })) : (_jsx(Text, { size: "xs", color: "muted", children: "No barcode" })), _jsx(Text, { size: "xs", weight: "medium", truncate: 1, children: product.name }), _jsxs(Text, { size: "xs", color: "muted", children: ["\u20B9", (product.price / 100).toLocaleString("en-IN")] }), product.physicalLocation && (_jsx(Text, { size: "xs", color: "muted", children: product.physicalLocation }))] }));
|
|
29
29
|
}
|
|
30
30
|
function PackingSlip({ order, brandName }) {
|
|
31
|
-
return (_jsxs(Stack, { surface: "card", padding: "md", rounded: "sm", className: "break-inside-avoid mb-4 max-w-[480px]", children: [_jsxs(Row, { justify: "between", className: "mb-2", children: [_jsx(Heading, { level: 5, children: brandName }), _jsxs(Text, { size: "xs", color: "muted", children: ["#", order.id] })] }), _jsx(Text, { size: "xs", color: "muted", children: new Date(order.createdAt).toLocaleDateString("en-IN") }), order.buyerDisplayName && _jsx(Text, { size: "sm", weight: "medium", children: order.buyerDisplayName }), order.buyerCity && _jsx(Text, { size: "xs", color: "muted", children: order.buyerCity }), order.physicalLocation && (_jsxs(Text, { size: "xs", color: "muted", children: ["Staging: ", order.physicalLocation] })), _jsx(Stack, { className: "mt-3 border-
|
|
32
|
-
// audit-variant-ok: py-1 is vertical-only padding; border-b last:border-b-0 uses pseudo-selector — no Row variant covers these
|
|
33
|
-
_jsxs(Row, { justify: "between", className: "py-1 border-b last:border-b-0", children: [_jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "xs", weight: "medium", children: item.productName }), item.barcodeId && _jsx(Text, { size: "xs", color: "muted", children: item.barcodeId })] }), _jsxs(Stack, { className: "text-right", children: [_jsxs(Text, { size: "xs", children: ["\u00D7", item.quantity] }), _jsxs(Text, { size: "xs", color: "muted", children: ["\u20B9", (item.price / 100).toLocaleString("en-IN")] })] })] }, i))) })] }));
|
|
31
|
+
return (_jsxs(Stack, { surface: "card", padding: "md", rounded: "sm", className: "break-inside-avoid mb-4 max-w-[480px]", children: [_jsxs(Row, { justify: "between", className: "mb-2", children: [_jsx(Heading, { level: 5, children: brandName }), _jsxs(Text, { size: "xs", color: "muted", children: ["#", order.id] })] }), _jsx(Text, { size: "xs", color: "muted", children: new Date(order.createdAt).toLocaleDateString("en-IN") }), order.buyerDisplayName && _jsx(Text, { size: "sm", weight: "medium", children: order.buyerDisplayName }), order.buyerCity && _jsx(Text, { size: "xs", color: "muted", children: order.buyerCity }), order.physicalLocation && (_jsxs(Text, { size: "xs", color: "muted", children: ["Staging: ", order.physicalLocation] })), _jsx(Stack, { border: "top", padding: "t-xs", className: "mt-3", children: order.items.map((item, i) => (_jsxs(Row, { justify: "between", padding: "y-2xs", className: "border-b last:border-b-0", children: [_jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "xs", weight: "medium", children: item.productName }), item.barcodeId && _jsx(Text, { size: "xs", color: "muted", children: item.barcodeId })] }), _jsxs(Stack, { className: "text-right", children: [_jsxs(Text, { size: "xs", children: ["\u00D7", item.quantity] }), _jsxs(Text, { size: "xs", color: "muted", children: ["\u20B9", (item.price / 100).toLocaleString("en-IN")] })] })] }, i))) })] }));
|
|
34
32
|
}
|
|
35
33
|
export function PrintCenterView({ store, brandName = "LetItRip", initialProducts = [], initialOrders = [], }) {
|
|
36
34
|
const [tab, setTab] = useState("labels");
|