@mohasinac/appkit 2.8.0 → 2.8.2
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/features/about/components/PublicProfileView.js +8 -8
- package/dist/features/admin/components/AdminSiteSettingsView.js +4 -5
- package/dist/features/admin/components/AdminUserEditorView.js +7 -11
- package/dist/features/admin/components/AdminViewCards.js +15 -15
- package/dist/features/auth/consent-otp.d.ts +2 -2
- package/dist/features/blog/components/BlogFeaturedCard.js +1 -0
- package/dist/features/events/components/AdminEventEditorView.js +10 -13
- package/dist/features/events/components/EventCard.js +1 -0
- package/dist/features/faq/components/FAQPageContent.js +1 -0
- package/dist/features/homepage/components/AdvertisementBanner.js +6 -6
- package/dist/features/homepage/components/HomepageSkeleton.js +2 -2
- package/dist/features/homepage/components/WelcomeSection.js +3 -3
- package/dist/features/layout/TitleBar.js +1 -0
- package/dist/features/products/components/ProductGrid.js +1 -0
- package/dist/features/promotions/components/CouponsIndexListing.js +4 -4
- package/dist/features/reviews/components/ReviewDetailShell.js +3 -3
- package/dist/features/seller/components/SellerAddressesView.js +4 -5
- package/dist/features/shell/FormShell.js +3 -3
- package/dist/providers/db-firebase/base.repository.d.ts +1 -1
- package/dist/seed/actions/demo-seed-actions.d.ts +1 -1
- package/dist/seed/manifest.js +10 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind-utilities.css +1 -1
- package/package.json +12 -3
|
@@ -5,7 +5,7 @@ import { X, AlertTriangle, Eye, ArrowLeft } from "lucide-react";
|
|
|
5
5
|
import { Button } from "../../ui/components/Button";
|
|
6
6
|
import { classNames } from "../../ui/style.helper";
|
|
7
7
|
import { FORM_ACTION_META, FORM_ACTION_ID } from "../products/constants/action-defs";
|
|
8
|
-
import { Text } from "../../ui";
|
|
8
|
+
import { Div, Row, Span, Stack, Text } from "../../ui";
|
|
9
9
|
export function useFormShell() {
|
|
10
10
|
const [isDirty, setIsDirty] = useState(false);
|
|
11
11
|
return {
|
|
@@ -105,8 +105,8 @@ export function FormShell({ isOpen, onClose, title, breadcrumb, isDirty = false,
|
|
|
105
105
|
};
|
|
106
106
|
if (!isOpen)
|
|
107
107
|
return null;
|
|
108
|
-
return (_jsxs(_Fragment, { children: [_jsx(
|
|
108
|
+
return (_jsxs(_Fragment, { children: [_jsx(Div, { className: "fixed inset-0 bg-black/50 backdrop-blur-[2px]", style: { zIndex: "calc(var(--appkit-z-modal) - 1)" }, "aria-hidden": "true", onClick: attemptClose }), _jsxs(Div, { ref: panelRef, role: "dialog", "aria-modal": "true", "aria-label": title, className: "fixed top-0 bottom-0 left-0 right-0 lg:left-[10%] lg:right-[10%] flex flex-col bg-[var(--appkit-color-surface)] shadow-2xl", style: { zIndex: "var(--appkit-z-modal)" }, children: [_jsxs(Row, { gap: "sm", className: "flex-shrink-0 sticky top-0 z-10 border-b border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)] px-5 py-3", children: [previewMode ? (_jsxs("button", { type: "button", onClick: () => setPreviewMode(false), "aria-label": "Back to edit", className: "rounded-lg p-1.5 text-[var(--appkit-color-text-muted)] hover:bg-[var(--appkit-color-border-subtle)] transition-colors flex-shrink-0 flex items-center gap-1.5 text-sm", children: [_jsx(ArrowLeft, { className: "w-4 h-4" }), _jsx(Span, { className: "hidden sm:inline", children: "Back to Edit" })] })) : (_jsx("button", { type: "button", onClick: attemptClose, "aria-label": "Close", className: "rounded-lg p-1.5 text-[var(--appkit-color-text-muted)] hover:bg-[var(--appkit-color-border-subtle)] transition-colors flex-shrink-0", children: _jsx(X, { className: "w-5 h-5" }) })), _jsxs(Div, { className: "flex-1 min-w-0", children: [breadcrumb && (_jsx(Text, { className: "text-xs text-[var(--appkit-color-text-muted)] truncate mb-0.5", children: breadcrumb })), _jsx(Text, { className: "text-sm font-semibold text-[var(--appkit-color-text)] truncate", children: previewMode ? `Preview — ${title}` : title })] }), _jsx(Row, { gap: "xs", className: "flex-shrink-0", children: previewMode ? null : (_jsxs(_Fragment, { children: [previewSlot && (_jsxs("button", { type: "button", onClick: () => setPreviewMode(true), className: "flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm text-[var(--appkit-color-text-muted)] hover:bg-[var(--appkit-color-border-subtle)] transition-colors border border-[var(--appkit-color-border)]", children: [_jsx(Eye, { className: "w-4 h-4" }), _jsx(Span, { className: "hidden sm:inline", children: "Preview" })] })), onSaveDraft && (_jsx(Button, { variant: "outline", size: "sm", onClick: handleSaveDraft, disabled: isLoading || savingDraft || publishing, isLoading: savingDraft, children: saveLabel })), onPublish && (_jsx(Button, { variant: "primary", size: "sm", onClick: handlePublish, disabled: isLoading || savingDraft || publishing, isLoading: publishing, children: publishLabel }))] })) })] }), _jsxs(Div, { className: "flex flex-1 overflow-hidden", children: [sections && sections.length > 0 && !previewMode && (_jsx("nav", { "aria-label": "Form sections", className: "hidden lg:flex flex-col flex-shrink-0 w-48 border-r border-[var(--appkit-color-border)] py-4 px-3 gap-1 overflow-y-auto", children: sections.map((sec) => (_jsx("button", { type: "button", onClick: () => scrollToSection(sec.id), className: "text-left text-sm px-3 py-2 rounded-lg text-[var(--appkit-color-text-muted)] hover:text-[var(--appkit-color-text)] hover:bg-[var(--appkit-color-border-subtle)] transition-colors", children: sec.label }, sec.id))) })), sections && sections.length > 0 && !previewMode && (_jsx(Row, { gap: "px", className: "lg:hidden fixed top-[var(--form-shell-topbar-h,57px)] left-0 right-0 z-10 overflow-x-auto px-5 py-2 bg-[var(--appkit-color-surface)] border-b border-[var(--appkit-color-border)]", children: sections.map((sec) => (_jsx("button", { type: "button", onClick: () => scrollToSection(sec.id), className: "flex-shrink-0 text-xs px-3 py-1.5 rounded-full border border-[var(--appkit-color-border)] text-[var(--appkit-color-text-muted)] hover:border-[var(--appkit-color-primary)] hover:text-[var(--appkit-color-primary)] transition-colors whitespace-nowrap", children: sec.label }, sec.id))) })), _jsx(Div, { ref: bodyRef, className: classNames("flex-1 overflow-y-auto", sections && sections.length > 0 && !previewMode ? "pt-0 lg:pt-0" : ""), children: previewMode && previewSlot ? (_jsxs(_Fragment, { children: [_jsxs(Row, { gap: "xs", className: "sticky top-0 z-10 bg-[var(--appkit-color-warning-surface)] border-b border-[var(--appkit-color-warning)] px-4 py-2 text-sm text-[var(--appkit-color-warning-text,var(--appkit-color-warning))]", children: [_jsx(Eye, { className: "w-4 h-4 flex-shrink-0" }), _jsx(Span, { children: "Preview \u2014 not visible to buyers until published" })] }), _jsx(Div, { className: "py-4", children: previewSlot() })] })) : splitPreview && previewSlot ? (
|
|
109
109
|
// S-STORE-3-D — desktop 60/40 split: form left, preview right.
|
|
110
110
|
// Below `lg`, falls back to single-column form (preview-as-modal via existing toggle).
|
|
111
|
-
_jsxs(
|
|
111
|
+
_jsxs(Div, { className: "lg:grid lg:grid-cols-[3fr_2fr] lg:gap-6 lg:px-6 lg:py-6 lg:max-w-[1400px] lg:mx-auto", children: [_jsx(Div, { className: "max-w-3xl mx-auto px-5 py-6 sm:px-6 lg:max-w-none lg:px-0 lg:py-0", children: children }), _jsxs(Div, { className: "hidden lg:block sticky lg:top-4 lg:self-start lg:max-h-[calc(100vh-6rem)] overflow-y-auto border border-[var(--appkit-color-border)] rounded-lg bg-[var(--appkit-color-surface-raised)] p-4", children: [_jsxs(Row, { gap: "xs", className: "mb-3 text-xs font-semibold uppercase tracking-wide text-[var(--appkit-color-text-muted)]", children: [_jsx(Eye, { className: "w-3.5 h-3.5" }), _jsx(Span, { children: "Live preview" })] }), previewSlot()] })] })) : (_jsx(Div, { className: "max-w-3xl mx-auto px-5 py-6 sm:px-6", children: children })) })] }), !previewMode && renderBottomBar ? (renderBottomBar()) : !previewMode && (onSaveDraft || onPublish) ? (_jsxs(Row, { justify: "between", className: "flex-shrink-0 sticky bottom-0 z-10 border-t border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)] px-5 py-3", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: attemptClose, disabled: isLoading, children: FORM_ACTION_META[FORM_ACTION_ID.DISCARD].label }), _jsxs(Row, { gap: "xs", children: [onSaveDraft && (_jsx(Button, { variant: "outline", size: "sm", onClick: handleSaveDraft, disabled: isLoading || savingDraft || publishing, isLoading: savingDraft, children: saveLabel })), onPublish && (_jsxs(Button, { variant: "primary", size: "sm", onClick: handlePublish, disabled: isLoading || savingDraft || publishing, isLoading: publishing, children: [publishLabel, " \u2192"] }))] })] })) : null] }), showUnsaved && (_jsxs(_Fragment, { children: [_jsx(Div, { className: "fixed inset-0 bg-black/60", style: { zIndex: "calc(var(--appkit-z-modal) + 5)" }, onClick: () => setShowUnsaved(false) }), _jsxs(Div, { className: "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[90vw] max-w-sm bg-[var(--appkit-color-surface)] rounded-xl shadow-2xl p-6", style: { zIndex: "calc(var(--appkit-z-modal) + 5)" }, children: [_jsxs(Row, { gap: "sm", align: "start", className: "mb-4", children: [_jsx(Span, { className: "flex-shrink-0 w-10 h-10 rounded-full bg-[var(--appkit-color-warning-surface)] flex items-center justify-center", children: _jsx(AlertTriangle, { className: "w-5 h-5 text-[var(--appkit-color-warning)]" }) }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { className: "font-semibold text-[var(--appkit-color-text)]", children: "Unsaved changes" }), _jsx(Text, { className: "text-sm text-[var(--appkit-color-text-muted)]", children: "You have unsaved changes. Leave without saving?" })] })] }), _jsxs(Row, { gap: "xs", justify: "end", children: [_jsx(Button, { variant: "outline", size: "sm", onClick: () => setShowUnsaved(false), children: "Stay" }), _jsx(Button, { variant: "danger", size: "sm", onClick: () => { setShowUnsaved(false); onClose(); }, children: "Leave" })] })] })] }))] }));
|
|
112
112
|
}
|
|
@@ -4,7 +4,7 @@ export declare abstract class BaseRepository<T extends DocumentData> {
|
|
|
4
4
|
protected collection: string;
|
|
5
5
|
constructor(collectionName: string);
|
|
6
6
|
protected get db(): Firestore;
|
|
7
|
-
protected getCollection(): CollectionReference<DocumentData>;
|
|
7
|
+
protected getCollection(): CollectionReference<DocumentData, DocumentData>;
|
|
8
8
|
protected mapDoc<D = T>(snap: DocumentSnapshot): D;
|
|
9
9
|
findById(id: string): Promise<T | null>;
|
|
10
10
|
findByIdOrFail(id: string): Promise<T>;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* the actual collection-specific seeding logic (800+ lines with PII encryption,
|
|
7
7
|
* Auth user creation, subcollection handling, etc.).
|
|
8
8
|
*/
|
|
9
|
-
export type SeedCollectionName = "users" | "addresses" | "categories" | "stores" | "products" | "orders" | "reviews" | "bids" | "coupons" | "carousels" | "carouselSlides" | "homepageSections" | "siteSettings" | "faqs" | "notifications" | "payouts" | "blogPosts" | "events" | "eventEntries" | "sessions" | "carts" | "wishlists" | "history" | "conversations" | "groupedListings" | "scammerProfiles" | "supportTickets" | "productFeatures" | "offers" | "payoutMethods" | "shippingConfigs" | "analyticsCards" | "analyticsAlerts" | "storeCategories" | "listingTemplates" | "moderationQueue" | "reports" | "itemRequests" | "storeWhatsAppConfig" | "storeGoogleConfig" | "roleOverrides" | "customRoles" | "adminNotifications";
|
|
9
|
+
export type SeedCollectionName = "users" | "addresses" | "categories" | "stores" | "products" | "orders" | "reviews" | "bids" | "coupons" | "carousels" | "carouselSlides" | "homepageSections" | "siteSettings" | "faqs" | "notifications" | "payouts" | "blogPosts" | "events" | "eventEntries" | "sessions" | "carts" | "wishlists" | "history" | "conversations" | "groupedListings" | "scammerProfiles" | "supportTickets" | "productFeatures" | "offers" | "couponUsage" | "claimedCoupons" | "payoutMethods" | "shippingConfigs" | "analyticsCards" | "analyticsAlerts" | "storeCategories" | "listingTemplates" | "moderationQueue" | "reports" | "itemRequests" | "storeWhatsAppConfig" | "storeGoogleConfig" | "roleOverrides" | "customRoles" | "adminNotifications";
|
|
10
10
|
export interface SeedOperationResult {
|
|
11
11
|
success?: boolean;
|
|
12
12
|
message: string;
|
package/dist/seed/manifest.js
CHANGED
|
@@ -44,6 +44,8 @@ import { scammersSeedData } from "./scammers-seed-data";
|
|
|
44
44
|
import { supportTicketsSeedData } from "./support-tickets-seed-data";
|
|
45
45
|
import { productFeaturesSeedData } from "./product-features-seed-data";
|
|
46
46
|
import { offersSeedData } from "./offers-seed-data";
|
|
47
|
+
import { couponUsageSeedData } from "./coupon-usage-seed-data";
|
|
48
|
+
import { claimedCouponsSeedData } from "./claimed-coupons-seed-data";
|
|
47
49
|
function asArr(items) {
|
|
48
50
|
return items ?? [];
|
|
49
51
|
}
|
|
@@ -187,6 +189,14 @@ export const SEED_MANIFEST = {
|
|
|
187
189
|
...o,
|
|
188
190
|
name: o.productTitle ?? o.id,
|
|
189
191
|
}))),
|
|
192
|
+
couponUsage: asArr(couponUsageSeedData).map((u) => ({
|
|
193
|
+
id: `${u.userId}/${u.couponId}`,
|
|
194
|
+
name: String(u.couponCode ?? u.couponId),
|
|
195
|
+
})),
|
|
196
|
+
claimedCoupons: pick(asArr(claimedCouponsSeedData).map((c) => ({
|
|
197
|
+
...c,
|
|
198
|
+
name: c.couponCode ?? c.couponId ?? c.id,
|
|
199
|
+
}))),
|
|
190
200
|
// S-STORE foundation collections — entries derived lazily from store-extensions-seed-data
|
|
191
201
|
payoutMethods: pick(asArr(payoutMethodsSeedData)),
|
|
192
202
|
shippingConfigs: pick(asArr(shippingConfigsSeedData)),
|