@mohasinac/appkit 3.2.4 → 3.2.6
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/homepage/data.d.ts +2 -2
- package/dist/_internal/server/features/homepage/data.js +34 -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/features/products/types.d.ts +3 -2
- package/dist/client.d.ts +2 -0
- package/dist/client.js +1 -0
- package/dist/constants/field-names.d.ts +2 -0
- package/dist/constants/field-names.js +2 -0
- package/dist/features/account/components/UserOffersPanel.js +0 -1
- 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/AdminSiteSettingsView.js +2 -2
- 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/schemas/firestore.d.ts +8 -10
- 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 +7 -3
- package/dist/features/orders/schemas/index.js +1 -1
- 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/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 +0 -1
- 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/wishlist/types/index.d.ts +2 -1
- package/dist/providers/auth-firebase/provider.js +3 -1
- package/dist/providers/auth-firebase/session.js +3 -1
- 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 -1
|
@@ -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;
|
|
@@ -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");
|
|
@@ -78,7 +78,6 @@ export function SellerAddressesView({ apiBase = SELLER_ENDPOINTS.STORE_ADDRESSES
|
|
|
78
78
|
setAddresses(data);
|
|
79
79
|
}
|
|
80
80
|
catch {
|
|
81
|
-
// toast-intentionally-silent: data load, error surfaced via errorMessage state
|
|
82
81
|
setErrorMessage("Could not load addresses. Please try again.");
|
|
83
82
|
}
|
|
84
83
|
finally {
|
|
@@ -135,7 +135,6 @@ export function SellerOffersPanel({ fetchEndpoint = "/api/store/offers", onRespo
|
|
|
135
135
|
setOffers(json.items ?? json.offers ?? []);
|
|
136
136
|
}
|
|
137
137
|
catch (err) {
|
|
138
|
-
// toast-intentionally-silent: data load, error surfaced via fetchError state
|
|
139
138
|
void normalizeError(err);
|
|
140
139
|
setFetchError(err instanceof Error ? err.message : "Failed to load offers.");
|
|
141
140
|
}
|
|
@@ -110,7 +110,6 @@ export function SellerReviewsView({ reviewsApiBase = "/api/store/reviews", reply
|
|
|
110
110
|
setMeta(json?.data?.meta ?? null);
|
|
111
111
|
}
|
|
112
112
|
catch (err) {
|
|
113
|
-
// toast-intentionally-silent: data load, error surfaced via error state
|
|
114
113
|
void normalizeError(err);
|
|
115
114
|
setError(err.message);
|
|
116
115
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Offers (Make-an-Offer) Firestore Document Types & Constants
|
|
3
3
|
*/
|
|
4
4
|
import { type GenerateOfferIdInput } from "../../../utils/id-generators";
|
|
5
|
+
import type { BaseDocument } from "../../../_internal/shared/types/base-document";
|
|
5
6
|
export type OfferStatus = "pending" | "accepted" | "declined" | "countered" | "expired" | "withdrawn" | "paid";
|
|
6
7
|
/** Runtime-accessible offer status values — use instead of bare string literals. */
|
|
7
8
|
export declare const OfferStatusValues: {
|
|
@@ -13,8 +14,7 @@ export declare const OfferStatusValues: {
|
|
|
13
14
|
readonly WITHDRAWN: "withdrawn";
|
|
14
15
|
readonly PAID: "paid";
|
|
15
16
|
};
|
|
16
|
-
export interface OfferDocument {
|
|
17
|
-
id: string;
|
|
17
|
+
export interface OfferDocument extends BaseDocument {
|
|
18
18
|
productId: string;
|
|
19
19
|
productTitle: string;
|
|
20
20
|
productSlug?: string;
|
|
@@ -36,8 +36,6 @@ export interface OfferDocument {
|
|
|
36
36
|
acceptedAt?: Date;
|
|
37
37
|
checkoutDeadline?: Date;
|
|
38
38
|
respondedAt?: Date;
|
|
39
|
-
createdAt: Date;
|
|
40
|
-
updatedAt: Date;
|
|
41
39
|
}
|
|
42
40
|
export declare const OFFER_COLLECTION: "offers";
|
|
43
41
|
export declare const OFFER_INDEXED_FIELDS: readonly ["buyerUid", "storeId", "productId", "status", "createdAt", "expiresAt"];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const SERVER_ERRORS_COLLECTION = "serverErrors";
|
|
2
2
|
/** Discriminator for which surface a recorded failure came from. */
|
|
3
3
|
export type ServerErrorSource = "vercel" | "client" | "function";
|
|
4
|
-
export
|
|
4
|
+
export type ServerErrorDocument = {
|
|
5
5
|
id: string;
|
|
6
6
|
/** Server timestamp; also acts as the TTL field (30d retention). */
|
|
7
7
|
occurredAt: number;
|
|
@@ -22,7 +22,7 @@ export interface ServerErrorDocument {
|
|
|
22
22
|
userAgent?: string;
|
|
23
23
|
/** sha256(requestBody) — for diagnosis without leaking PII. */
|
|
24
24
|
bodyDigest?: string;
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
export declare const SERVER_ERROR_FIELDS: {
|
|
27
27
|
readonly ID: "id";
|
|
28
28
|
readonly OCCURRED_AT: "occurredAt";
|
|
@@ -155,14 +155,14 @@ export declare const REPORTS_COLLECTION: "reports";
|
|
|
155
155
|
export declare const REPORT_INDEXED_FIELDS: readonly ["entityType", "entityId", "reporterId", "reason", "status", "createdAt"];
|
|
156
156
|
export declare const DEFAULT_REPORT_DATA: Partial<ReportDocument>;
|
|
157
157
|
export type ItemRequestStatus = "pending-approval" | "open" | "fulfilled" | "closed" | "rejected";
|
|
158
|
-
export
|
|
158
|
+
export type ItemRequestReply = {
|
|
159
159
|
id: string;
|
|
160
160
|
authorId: string;
|
|
161
161
|
authorName?: string;
|
|
162
162
|
body: string;
|
|
163
163
|
isOpInitiatedThread: boolean;
|
|
164
164
|
createdAt: Date;
|
|
165
|
-
}
|
|
165
|
+
};
|
|
166
166
|
export interface ItemRequestDocument extends BaseDocument {
|
|
167
167
|
opUserId: string;
|
|
168
168
|
opDisplayName: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { useRouter } from "next/navigation";
|
|
5
|
-
import { Button, Input, Row } from "../../../ui";
|
|
5
|
+
import { Button, Form, Input, Row } from "../../../ui";
|
|
6
6
|
import { ROUTES } from "../../../next/routing/route-map";
|
|
7
7
|
/**
|
|
8
8
|
* W1-19 — inline search input scoped to a single store. Submits to
|
|
@@ -23,7 +23,5 @@ export function StoreScopedSearch({ storeId, storeName, placeholder, className =
|
|
|
23
23
|
params.set("q", q);
|
|
24
24
|
router.push(`${base}?${params.toString()}`);
|
|
25
25
|
};
|
|
26
|
-
return (
|
|
27
|
-
// audit-raw-form-input-ok: store-scoped search bar — single query field, no validation needed
|
|
28
|
-
_jsx("form", { onSubmit: submit, className: `w-full ${className}`, children: _jsxs(Row, { gap: "sm", align: "center", className: "w-full", children: [_jsx(Input, { type: "search", value: value, onChange: (e) => setValue(e.target.value), placeholder: placeholder ?? `Search ${storeName}…`, "aria-label": `Search ${storeName}`, className: "flex-1" }), _jsx(Button, { type: "submit", variant: "primary", size: "sm", children: "Search" })] }) }));
|
|
26
|
+
return (_jsx(Form, { onSubmit: submit, className: `w-full ${className}`, children: _jsxs(Row, { gap: "sm", align: "center", className: "w-full", children: [_jsx(Input, { type: "search", value: value, onChange: (e) => setValue(e.target.value), placeholder: placeholder ?? `Search ${storeName}…`, "aria-label": `Search ${storeName}`, className: "flex-1" }), _jsx(Button, { type: "submit", variant: "primary", size: "sm", children: "Search" })] }) }));
|
|
29
27
|
}
|
|
@@ -8,6 +8,7 @@ import { BaseRepository, prepareForFirestore, applySieveToFirestore, } from "../
|
|
|
8
8
|
import { increment } from "../../../contracts/field-ops";
|
|
9
9
|
import { STORE_COLLECTION, STORE_FIELDS, DEFAULT_STORE_DATA, StoreStatusValues, } from "../schemas";
|
|
10
10
|
import { DatabaseError } from "../../../errors";
|
|
11
|
+
import { normalizeError } from "../../../errors/normalize";
|
|
11
12
|
import { encryptSecret, decryptSecret, } from "../../../security/settings-encryption";
|
|
12
13
|
export class StoreRepository extends BaseRepository {
|
|
13
14
|
constructor() {
|
|
@@ -64,7 +65,8 @@ export class StoreRepository extends BaseRepository {
|
|
|
64
65
|
.doc(input.storeSlug)
|
|
65
66
|
.create(prepareForFirestore(this.encryptSecrets(storeData)));
|
|
66
67
|
}
|
|
67
|
-
catch (err) {
|
|
68
|
+
catch (err) {
|
|
69
|
+
void normalizeError(err);
|
|
68
70
|
// gRPC ALREADY_EXISTS = code 6
|
|
69
71
|
if (err.code === 6) {
|
|
70
72
|
throw new DatabaseError(`Store slug "${input.storeSlug}" is already taken`);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ListingType } from "../../products/types";
|
|
1
2
|
export interface StoreListItem {
|
|
2
3
|
id: string;
|
|
3
4
|
storeSlug: string;
|
|
@@ -41,7 +42,7 @@ export interface StoreProductItem {
|
|
|
41
42
|
status: string;
|
|
42
43
|
featured: boolean;
|
|
43
44
|
/** Canonical listing-kind discriminator (SB1-G Phase 4). */
|
|
44
|
-
listingType:
|
|
45
|
+
listingType: ListingType;
|
|
45
46
|
currentBid?: number;
|
|
46
47
|
isPromoted?: boolean;
|
|
47
48
|
slug: string;
|
|
@@ -48,7 +48,7 @@ export type TicketPriority = (typeof TicketPriorityValues)[keyof typeof TicketPr
|
|
|
48
48
|
export declare const ACTIVE_TICKET_STATUSES: TicketStatus[];
|
|
49
49
|
/** Order statuses that are eligible for a support ticket. */
|
|
50
50
|
export declare const ELIGIBLE_ORDER_STATUSES_FOR_TICKET: readonly ["PENDING", "PROCESSING", "SHIPPED", "RETURN_REQUESTED"];
|
|
51
|
-
export
|
|
51
|
+
export type TicketMessage = {
|
|
52
52
|
id: string;
|
|
53
53
|
authorId: string;
|
|
54
54
|
authorRole: "user" | "support" | "admin";
|
|
@@ -57,7 +57,7 @@ export interface TicketMessage {
|
|
|
57
57
|
/** Media URLs (screenshots, attachments — /media/ proxy URLs, never raw Storage). */
|
|
58
58
|
attachments?: string[];
|
|
59
59
|
createdAt: Date;
|
|
60
|
-
}
|
|
60
|
+
};
|
|
61
61
|
/**
|
|
62
62
|
* Subject entities a ticket concerns. Assigned by admin/support agents so a
|
|
63
63
|
* single ticket can reference the buyer, store, order, product, or bid in
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ListingType } from "../../products/types";
|
|
1
2
|
export interface WishlistItem {
|
|
2
3
|
id: string;
|
|
3
4
|
userId: string;
|
|
@@ -24,7 +25,7 @@ export interface WishlistProductData {
|
|
|
24
25
|
status?: "draft" | "published" | "in_review" | "archived";
|
|
25
26
|
isFeatured?: boolean;
|
|
26
27
|
/** Canonical listing-kind discriminator (SB1-G Phase 4). */
|
|
27
|
-
listingType?:
|
|
28
|
+
listingType?: ListingType;
|
|
28
29
|
}
|
|
29
30
|
/** WishlistItem enriched with inline product details returned by the wishlist GET endpoint. */
|
|
30
31
|
export interface EnrichedWishlistItem extends WishlistItem {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Server-side only. Never import this in browser/client-component code.
|
|
6
6
|
*/
|
|
7
7
|
import { getAdminAuthLite } from "../db-firebase/admin-auth-lite";
|
|
8
|
+
import { normalizeError } from "../../errors/normalize";
|
|
8
9
|
/** Firebase error codes that represent a normal "not authenticated" state. */
|
|
9
10
|
const EXPECTED_AUTH_CODES = new Set([
|
|
10
11
|
"auth/argument-error",
|
|
@@ -56,7 +57,8 @@ export const firebaseAuthProvider = {
|
|
|
56
57
|
const decoded = await getAdminAuthLite().verifyIdToken(token);
|
|
57
58
|
return toAuthPayload(decoded);
|
|
58
59
|
}
|
|
59
|
-
catch (err) {
|
|
60
|
+
catch (err) {
|
|
61
|
+
void normalizeError(err);
|
|
60
62
|
if (!isExpectedAuthError(err)) {
|
|
61
63
|
console.error("[@mohasinac/auth-firebase] Token verification failed:", err);
|
|
62
64
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* Server-side only.
|
|
8
8
|
*/
|
|
9
9
|
import { getAdminAuthLite } from "../db-firebase/admin-auth-lite";
|
|
10
|
+
import { normalizeError } from "../../errors/normalize";
|
|
10
11
|
/** Default session duration: 5 days (in milliseconds). */
|
|
11
12
|
const DEFAULT_EXPIRES_IN_MS = 60 * 60 * 24 * 5 * 1000;
|
|
12
13
|
const EXPECTED_SESSION_CODES = new Set([
|
|
@@ -56,7 +57,8 @@ export const firebaseSessionProvider = {
|
|
|
56
57
|
].includes(k))),
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
|
-
catch (err) {
|
|
60
|
+
catch (err) {
|
|
61
|
+
void normalizeError(err);
|
|
60
62
|
if (!EXPECTED_SESSION_CODES.has(err.code ?? "")) {
|
|
61
63
|
console.error("[@mohasinac/auth-firebase] Session cookie verification failed:", err);
|
|
62
64
|
}
|
package/dist/seo/json-ld.d.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* />
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
|
+
import type { ListingType } from "../features/products/types";
|
|
15
16
|
/**
|
|
16
17
|
* JSON-LD permits omitting optional fields at every nesting level — JSON.stringify
|
|
17
18
|
* drops undefined keys, so the emitted schema.org output remains valid. This
|
|
@@ -34,7 +35,7 @@ export interface ProductJsonLdInput {
|
|
|
34
35
|
status?: string;
|
|
35
36
|
auctionEndDate?: Date;
|
|
36
37
|
/** Canonical discriminator (SB1-G Phase 4). */
|
|
37
|
-
listingType?:
|
|
38
|
+
listingType?: ListingType;
|
|
38
39
|
}
|
|
39
40
|
export interface ReviewJsonLdInput {
|
|
40
41
|
id: string;
|