@mohasinac/appkit 2.6.1 → 2.6.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/_internal/client/features/layout/DashboardLayoutClient.d.ts +38 -0
- package/dist/_internal/client/features/layout/DashboardLayoutClient.js +75 -0
- package/dist/_internal/client/features/layout/RoleGuard.d.ts +15 -0
- package/dist/_internal/client/features/layout/RoleGuard.js +25 -0
- package/dist/_internal/client/features/layout/index.d.ts +5 -0
- package/dist/_internal/client/features/layout/index.js +4 -0
- package/dist/_internal/server/features/brands/actions.d.ts +3 -3
- package/dist/_internal/server/features/brands/actions.js +72 -5
- package/dist/_internal/server/features/brands/data.d.ts +8 -8
- package/dist/_internal/server/features/brands/data.js +10 -11
- package/dist/_internal/server/features/brands/service.d.ts +2 -2
- package/dist/_internal/server/features/brands/service.js +5 -5
- package/dist/_internal/server/features/categories/og.d.ts +33 -0
- package/dist/_internal/server/features/categories/og.js +75 -0
- package/dist/_internal/server/features/checkout/actions.d.ts +24 -0
- package/dist/_internal/server/features/checkout/actions.js +442 -13
- package/dist/_internal/server/features/checkout/index.d.ts +1 -1
- package/dist/_internal/server/features/checkout/index.js +1 -1
- package/dist/_internal/server/features/checkout/prize-bundle-gates.d.ts +59 -0
- package/dist/_internal/server/features/checkout/prize-bundle-gates.js +99 -0
- package/dist/_internal/server/features/grouped/data.js +12 -5
- package/dist/_internal/server/features/homepage/data.d.ts +1 -1
- package/dist/_internal/server/features/homepage/data.js +2 -2
- package/dist/_internal/server/features/media/contextGuards.d.ts +52 -0
- package/dist/_internal/server/features/media/contextGuards.js +198 -0
- package/dist/_internal/server/features/orders/adapters.js +12 -0
- package/dist/_internal/server/features/products/data.d.ts +1 -1
- package/dist/_internal/server/features/sublisting-categories/data.d.ts +1 -1
- package/dist/_internal/server/features/sublisting-categories/data.js +2 -2
- package/dist/_internal/server/jobs/handlers/assignSpinPrize.d.ts +24 -0
- package/dist/_internal/server/jobs/handlers/assignSpinPrize.js +86 -0
- package/dist/_internal/server/jobs/handlers/bundleStockSync.d.ts +18 -0
- package/dist/_internal/server/jobs/handlers/bundleStockSync.js +80 -0
- package/dist/_internal/server/jobs/handlers/index.d.ts +8 -0
- package/dist/_internal/server/jobs/handlers/index.js +13 -0
- package/dist/_internal/server/jobs/handlers/listingProcessor.js +13 -3
- package/dist/_internal/server/jobs/handlers/onProductStockChange.d.ts +17 -0
- package/dist/_internal/server/jobs/handlers/onProductStockChange.js +136 -0
- package/dist/_internal/server/jobs/handlers/onProductWrite.js +17 -1
- package/dist/_internal/server/jobs/handlers/prizeRevealClose.d.ts +9 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealClose.js +29 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealExpiry.d.ts +10 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealExpiry.js +58 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealOpen.d.ts +10 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealOpen.js +65 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealReminder.d.ts +9 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealReminder.js +45 -0
- package/dist/_internal/server/jobs/handlers/triggerEventRaffle.d.ts +30 -0
- package/dist/_internal/server/jobs/handlers/triggerEventRaffle.js +94 -0
- package/dist/_internal/shared/features/brands/schema.d.ts +3 -3
- package/dist/_internal/shared/features/cart/schema.d.ts +8 -8
- package/dist/_internal/shared/features/cart/schema.js +1 -1
- package/dist/_internal/shared/features/categories/bundle-config.d.ts +17 -0
- package/dist/_internal/shared/features/categories/bundle-config.js +17 -0
- package/dist/_internal/shared/features/layout/config.d.ts +35 -0
- package/dist/_internal/shared/features/layout/config.js +58 -0
- package/dist/_internal/shared/features/layout/index.d.ts +3 -0
- package/dist/_internal/shared/features/layout/index.js +2 -0
- package/dist/_internal/shared/features/layout/types.d.ts +137 -0
- package/dist/_internal/shared/features/layout/types.js +13 -0
- package/dist/_internal/shared/features/products/types.d.ts +1 -1
- package/dist/_internal/shared/listing-types/_registry.d.ts +57 -0
- package/dist/_internal/shared/listing-types/_registry.js +28 -0
- package/dist/_internal/shared/listing-types/auction/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/auction/config.js +8 -0
- package/dist/_internal/shared/listing-types/auction/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/auction/ctas.js +2 -0
- package/dist/_internal/shared/listing-types/auction/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/auction/og.js +1 -0
- package/dist/_internal/shared/listing-types/auction/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/auction/schema.js +1 -0
- package/dist/_internal/shared/listing-types/auction/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/auction/seed-factory.js +1 -0
- package/dist/_internal/shared/listing-types/capabilities.d.ts +41 -0
- package/dist/_internal/shared/listing-types/capabilities.js +75 -0
- package/dist/_internal/shared/listing-types/pre-order/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/pre-order/config.js +8 -0
- package/dist/_internal/shared/listing-types/pre-order/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/pre-order/ctas.js +2 -0
- package/dist/_internal/shared/listing-types/pre-order/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/pre-order/og.js +1 -0
- package/dist/_internal/shared/listing-types/pre-order/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/pre-order/schema.js +1 -0
- package/dist/_internal/shared/listing-types/pre-order/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/pre-order/seed-factory.js +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.js +8 -0
- package/dist/_internal/shared/listing-types/prize-draw/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/ctas.js +2 -0
- package/dist/_internal/shared/listing-types/prize-draw/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/og.js +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/schema.js +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/seed-factory.js +1 -0
- package/dist/_internal/shared/listing-types/standard/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/standard/config.js +8 -0
- package/dist/_internal/shared/listing-types/standard/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/standard/ctas.js +3 -0
- package/dist/_internal/shared/listing-types/standard/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/standard/og.js +1 -0
- package/dist/_internal/shared/listing-types/standard/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/standard/schema.js +1 -0
- package/dist/_internal/shared/listing-types/standard/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/standard/seed-factory.js +1 -0
- package/dist/_internal/shared/media/limits.d.ts +33 -0
- package/dist/_internal/shared/media/limits.js +97 -0
- package/dist/_internal/shared/schema-versions.d.ts +76 -0
- package/dist/_internal/shared/schema-versions.js +82 -0
- package/dist/client.d.ts +9 -0
- package/dist/client.js +7 -0
- package/dist/constants/api-endpoints.d.ts +6 -3
- package/dist/constants/api-endpoints.js +2 -1
- package/dist/errors/messages.d.ts +1 -1
- package/dist/errors/messages.js +1 -1
- package/dist/features/account/migrations.d.ts +2 -0
- package/dist/features/account/migrations.js +10 -0
- package/dist/features/admin/components/AdminMediaView.js +1 -1
- package/dist/features/admin/components/AdminProductsView.js +7 -3
- package/dist/features/admin/migrations.d.ts +2 -0
- package/dist/features/admin/migrations.js +10 -0
- package/dist/features/admin/types/product.types.d.ts +1 -1
- package/dist/features/auctions/components/MarketplaceAuctionCard.d.ts +1 -1
- package/dist/features/auctions/migrations.d.ts +2 -0
- package/dist/features/auctions/migrations.js +10 -0
- package/dist/features/auctions/schemas/index.d.ts +3 -3
- package/dist/features/auctions/schemas/index.js +1 -1
- package/dist/features/auth/migrations.d.ts +2 -0
- package/dist/features/auth/migrations.js +10 -0
- package/dist/features/blog/migrations.d.ts +2 -0
- package/dist/features/blog/migrations.js +10 -0
- package/dist/features/brands/migrations.d.ts +2 -0
- package/dist/features/brands/migrations.js +10 -0
- package/dist/features/bundles/components/BundlesByCategoryListing.d.ts +6 -0
- package/dist/features/bundles/components/BundlesByCategoryListing.js +50 -0
- package/dist/features/bundles/components/index.d.ts +2 -0
- package/dist/features/bundles/components/index.js +1 -0
- package/dist/features/bundles/migrations.d.ts +2 -0
- package/dist/features/bundles/migrations.js +10 -0
- package/dist/features/bundles/schemas/index.d.ts +1 -0
- package/dist/features/bundles/schemas/index.js +1 -0
- package/dist/features/bundles/schemas/zod.d.ts +377 -0
- package/dist/features/bundles/schemas/zod.js +71 -0
- package/dist/features/cart/migrations.d.ts +2 -0
- package/dist/features/cart/migrations.js +10 -0
- package/dist/features/cart/schemas/firestore.d.ts +2 -2
- package/dist/features/categories/components/BrandDetailPageView.js +35 -4
- package/dist/features/categories/components/BrandDetailTabs.d.ts +5 -1
- package/dist/features/categories/components/BrandDetailTabs.js +22 -8
- package/dist/features/categories/components/CategoryBundlesListing.d.ts +6 -0
- package/dist/features/categories/components/CategoryBundlesListing.js +74 -0
- package/dist/features/categories/components/CategoryDetailPageView.js +29 -4
- package/dist/features/categories/components/CategoryDetailTabs.d.ts +5 -1
- package/dist/features/categories/components/CategoryDetailTabs.js +22 -8
- package/dist/features/categories/migrations.d.ts +2 -0
- package/dist/features/categories/migrations.js +10 -0
- package/dist/features/categories/repository/categories.repository.d.ts +29 -0
- package/dist/features/categories/repository/categories.repository.js +83 -0
- package/dist/features/categories/schemas/firestore.d.ts +59 -2
- package/dist/features/categories/schemas/firestore.js +6 -0
- package/dist/features/categories/types/index.d.ts +11 -3
- package/dist/features/events/migrations.d.ts +2 -0
- package/dist/features/events/migrations.js +10 -0
- package/dist/features/faq/migrations.d.ts +2 -0
- package/dist/features/faq/migrations.js +10 -0
- package/dist/features/grouped/migrations.d.ts +2 -0
- package/dist/features/grouped/migrations.js +10 -0
- package/dist/features/grouped/schemas/firestore.d.ts +29 -10
- package/dist/features/grouped/schemas/firestore.js +10 -5
- package/dist/features/history/migrations.d.ts +2 -0
- package/dist/features/history/migrations.js +10 -0
- package/dist/features/homepage/hooks/useFeaturedAuctions.js +2 -2
- package/dist/features/homepage/hooks/useFeaturedPreOrders.js +2 -2
- package/dist/features/homepage/lib/section-renderer.js +5 -3
- package/dist/features/media/AvatarUpload.js +6 -28
- package/dist/features/media/hooks/useMedia.d.ts +31 -15
- package/dist/features/media/hooks/useMedia.js +48 -13
- package/dist/features/media/upload/ImageUpload.js +1 -1
- package/dist/features/media/upload/MediaUploadField.js +1 -1
- package/dist/features/messages/migrations.d.ts +2 -0
- package/dist/features/messages/migrations.js +10 -0
- package/dist/features/orders/components/OrdersList.js +10 -1
- package/dist/features/orders/migrations.d.ts +2 -0
- package/dist/features/orders/migrations.js +10 -0
- package/dist/features/orders/repository/orders.repository.d.ts +16 -0
- package/dist/features/orders/repository/orders.repository.js +49 -0
- package/dist/features/orders/schemas/firestore.d.ts +8 -0
- package/dist/features/orders/types/index.d.ts +12 -0
- package/dist/features/orders/utils/order-splitter.d.ts +2 -2
- package/dist/features/orders/utils/order-splitter.js +5 -0
- package/dist/features/payments/migrations.d.ts +2 -0
- package/dist/features/payments/migrations.js +10 -0
- package/dist/features/pre-orders/components/PreOrderDetailPageView.js +4 -1
- package/dist/features/products/actions/product-actions.d.ts +1 -1
- package/dist/features/products/api/[id]/route.js +34 -0
- package/dist/features/products/api/route.js +1 -19
- package/dist/features/products/components/CompareOverlay.d.ts +1 -1
- package/dist/features/products/components/MarketplacePrizeDrawCard.d.ts +24 -0
- package/dist/features/products/components/MarketplacePrizeDrawCard.js +102 -0
- package/dist/features/products/components/PrizeDrawCollage.d.ts +32 -0
- package/dist/features/products/components/PrizeDrawCollage.js +22 -0
- package/dist/features/products/components/PrizeDrawDetailPageView.d.ts +27 -0
- package/dist/features/products/components/PrizeDrawDetailPageView.js +118 -0
- package/dist/features/products/components/PrizeDrawEntryActions.d.ts +19 -0
- package/dist/features/products/components/PrizeDrawEntryActions.js +48 -0
- package/dist/features/products/components/PrizeDrawItemsEditor.d.ts +13 -0
- package/dist/features/products/components/PrizeDrawItemsEditor.js +97 -0
- package/dist/features/products/components/PrizeDrawsIndexListing.d.ts +8 -0
- package/dist/features/products/components/PrizeDrawsIndexListing.js +128 -0
- package/dist/features/products/components/PrizeDrawsListingView.d.ts +15 -0
- package/dist/features/products/components/PrizeDrawsListingView.js +49 -0
- package/dist/features/products/components/PrizeRevealModal.d.ts +34 -0
- package/dist/features/products/components/PrizeRevealModal.js +124 -0
- package/dist/features/products/components/ProductDetailPageView.js +13 -1
- package/dist/features/products/components/ProductForm.js +35 -2
- package/dist/features/products/components/ProductGrid.js +3 -1
- package/dist/features/products/components/index.d.ts +16 -0
- package/dist/features/products/components/index.js +8 -0
- package/dist/features/products/constants/listing-tabs.d.ts +113 -0
- package/dist/features/products/constants/listing-tabs.js +43 -0
- package/dist/features/products/index.d.ts +1 -0
- package/dist/features/products/index.js +1 -0
- package/dist/features/products/migrations.d.ts +2 -0
- package/dist/features/products/migrations.js +10 -0
- package/dist/features/products/repository/products.repository.d.ts +11 -7
- package/dist/features/products/repository/products.repository.js +49 -24
- package/dist/features/products/schemas/firestore.d.ts +3 -3
- package/dist/features/products/schemas/firestore.js +2 -2
- package/dist/features/products/schemas/index.d.ts +5 -5
- package/dist/features/products/schemas/index.js +3 -1
- package/dist/features/products/schemas/product-features.validators.d.ts +6 -6
- package/dist/features/products/types/index.d.ts +17 -1
- package/dist/features/products/utils/listing-type.d.ts +7 -4
- package/dist/features/products/utils/listing-type.js +8 -4
- package/dist/features/promotions/actions/coupon-actions.d.ts +1 -1
- package/dist/features/promotions/hooks/useCouponValidate.d.ts +1 -1
- package/dist/features/promotions/migrations.d.ts +2 -0
- package/dist/features/promotions/migrations.js +10 -0
- package/dist/features/promotions/repository/coupons.repository.d.ts +1 -1
- package/dist/features/promotions/schemas/index.d.ts +2 -2
- package/dist/features/reviews/migrations.d.ts +2 -0
- package/dist/features/reviews/migrations.js +10 -0
- package/dist/features/scams/migrations.d.ts +2 -0
- package/dist/features/scams/migrations.js +10 -0
- package/dist/features/search/api/route.d.ts +1 -1
- package/dist/features/search/api/route.js +3 -3
- package/dist/features/search/components/Search.d.ts +1 -1
- package/dist/features/search/schemas/index.d.ts +3 -3
- package/dist/features/search/schemas/index.js +3 -1
- package/dist/features/search/types/index.d.ts +2 -2
- package/dist/features/seller/components/SellerProductShell.d.ts +1 -1
- package/dist/features/seller/components/SellerProductsView.js +20 -6
- package/dist/features/seller/migrations.d.ts +2 -0
- package/dist/features/seller/migrations.js +10 -0
- package/dist/features/seller/schemas/index.d.ts +2 -2
- package/dist/features/stores/components/StoreBundlesPageView.d.ts +12 -0
- package/dist/features/stores/components/StoreBundlesPageView.js +24 -0
- package/dist/features/stores/components/StoreDetailLayoutView.js +15 -3
- package/dist/features/stores/components/StorePrizeDrawsPageView.d.ts +11 -0
- package/dist/features/stores/components/StorePrizeDrawsPageView.js +27 -0
- package/dist/features/stores/components/index.d.ts +2 -0
- package/dist/features/stores/migrations.d.ts +2 -0
- package/dist/features/stores/migrations.js +10 -0
- package/dist/features/stores/schemas/index.d.ts +2 -2
- package/dist/features/stores/types/index.d.ts +1 -1
- package/dist/features/sublisting/migrations.d.ts +2 -0
- package/dist/features/sublisting/migrations.js +10 -0
- package/dist/features/sublisting/schemas/firestore.d.ts +2 -0
- package/dist/features/support/migrations.d.ts +2 -0
- package/dist/features/support/migrations.js +10 -0
- package/dist/features/wishlist/migrations.d.ts +2 -0
- package/dist/features/wishlist/migrations.js +10 -0
- package/dist/features/wishlist/types/index.d.ts +1 -1
- package/dist/index.d.ts +26 -18
- package/dist/index.js +41 -24
- package/dist/jobs.d.ts +1 -1
- package/dist/jobs.js +4 -0
- package/dist/next/routing/route-map.d.ts +4 -0
- package/dist/next/routing/route-map.js +2 -0
- package/dist/providers/db-firebase/filter-aliases.d.ts +2 -2
- package/dist/repositories/index.d.ts +0 -5
- package/dist/repositories/index.js +5 -4
- package/dist/seed/actions/demo-seed-actions.d.ts +1 -1
- package/dist/seed/categories-seed-data.js +1105 -6
- package/dist/seed/faq-seed-data.js +160 -0
- package/dist/seed/grouped-listings-seed-data.js +32 -32
- package/dist/seed/homepage-sections-seed-data.js +52 -6
- package/dist/seed/index.d.ts +1 -3
- package/dist/seed/index.js +4 -3
- package/dist/seed/manifest.js +8 -13
- package/dist/seed/products-prize-draws-seed-data.d.ts +17 -0
- package/dist/seed/products-prize-draws-seed-data.js +313 -0
- package/dist/seo/json-ld.d.ts +1 -1
- package/dist/server-entry.d.ts +2 -2
- package/dist/server-entry.js +5 -3
- package/dist/server.d.ts +9 -2
- package/dist/server.js +11 -5
- package/dist/tailwind-utilities.css +1 -1
- package/dist/validation/schemas.d.ts +8 -8
- package/package.json +1 -1
- package/scripts/seed-cli.mjs +2 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LISTING_TYPE_CAPABILITIES } from "../capabilities";
|
|
2
|
+
export const LISTING_TYPE = "prize-draw";
|
|
3
|
+
export const capability = LISTING_TYPE_CAPABILITIES["prize-draw"];
|
|
4
|
+
export const config = {
|
|
5
|
+
listingType: LISTING_TYPE,
|
|
6
|
+
slugPrefix: "prizedraw-",
|
|
7
|
+
cartLine: "single-product",
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ctas: readonly string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LISTING_TYPE_CAPABILITIES } from "../capabilities";
|
|
2
|
+
export const LISTING_TYPE = "standard";
|
|
3
|
+
export const capability = LISTING_TYPE_CAPABILITIES.standard;
|
|
4
|
+
export const config = {
|
|
5
|
+
listingType: LISTING_TYPE,
|
|
6
|
+
slugPrefix: "product-",
|
|
7
|
+
cartLine: "single-product",
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ctas: readonly string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media upload limits — single source of truth for byte ceilings, MIME
|
|
3
|
+
* allowlists, and extension mapping. Shared between the signed-URL issuer,
|
|
4
|
+
* the finalize handler, the client upload hook, and any field-level
|
|
5
|
+
* pre-validation.
|
|
6
|
+
*
|
|
7
|
+
* Why centralised: previously these constants were duplicated across
|
|
8
|
+
* `/api/media/upload`, `/api/media/crop`, and the React hook — drifting
|
|
9
|
+
* allowlists were the surface area Z2 had to chase down.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MEGABYTE: number;
|
|
12
|
+
export declare const MAX_IMAGE_BYTES: number;
|
|
13
|
+
export declare const MAX_PDF_BYTES: number;
|
|
14
|
+
export declare const MAX_VIDEO_BYTES: number;
|
|
15
|
+
export type MediaKind = "image" | "video" | "pdf";
|
|
16
|
+
export declare const MAX_LABEL: Record<MediaKind, string>;
|
|
17
|
+
export declare const MAX_BYTES: Record<MediaKind, number>;
|
|
18
|
+
export declare const ALLOWED_IMAGE_MIMES: readonly ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/webp"];
|
|
19
|
+
export declare const ALLOWED_VIDEO_MIMES: readonly ["video/mp4", "video/webm", "video/quicktime", "video/3gpp", "video/3gpp2", "video/x-matroska"];
|
|
20
|
+
export declare const ALLOWED_DOC_MIMES: readonly ["application/pdf"];
|
|
21
|
+
export declare const ALLOWED_MIMES: readonly ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/webp", "video/mp4", "video/webm", "video/quicktime", "video/3gpp", "video/3gpp2", "video/x-matroska", "application/pdf"];
|
|
22
|
+
export type AllowedImageMime = (typeof ALLOWED_IMAGE_MIMES)[number];
|
|
23
|
+
export type AllowedVideoMime = (typeof ALLOWED_VIDEO_MIMES)[number];
|
|
24
|
+
export type AllowedDocMime = (typeof ALLOWED_DOC_MIMES)[number];
|
|
25
|
+
export type AllowedMime = (typeof ALLOWED_MIMES)[number];
|
|
26
|
+
export declare const ALLOWED_TYPES_LABEL = "JPEG, PNG, GIF, WebP, MP4, WebM, QuickTime, 3GP, MKV, PDF";
|
|
27
|
+
export declare const MIME_TO_EXT: Record<string, string>;
|
|
28
|
+
export declare function classifyMime(mime: string): MediaKind | null;
|
|
29
|
+
export declare function isAllowedMime(mime: string): mime is AllowedMime;
|
|
30
|
+
export declare function maxBytesFor(mime: string): number | null;
|
|
31
|
+
export declare const PDF_MAGIC = "%PDF-";
|
|
32
|
+
export declare const VIDEO_CONVERSION_HINTS: Record<string, string>;
|
|
33
|
+
export declare function getConversionHint(mime: string): string | null;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media upload limits — single source of truth for byte ceilings, MIME
|
|
3
|
+
* allowlists, and extension mapping. Shared between the signed-URL issuer,
|
|
4
|
+
* the finalize handler, the client upload hook, and any field-level
|
|
5
|
+
* pre-validation.
|
|
6
|
+
*
|
|
7
|
+
* Why centralised: previously these constants were duplicated across
|
|
8
|
+
* `/api/media/upload`, `/api/media/crop`, and the React hook — drifting
|
|
9
|
+
* allowlists were the surface area Z2 had to chase down.
|
|
10
|
+
*/
|
|
11
|
+
export const MEGABYTE = 1024 * 1024;
|
|
12
|
+
export const MAX_IMAGE_BYTES = 10 * MEGABYTE;
|
|
13
|
+
export const MAX_PDF_BYTES = 20 * MEGABYTE;
|
|
14
|
+
export const MAX_VIDEO_BYTES = 50 * MEGABYTE;
|
|
15
|
+
export const MAX_LABEL = {
|
|
16
|
+
image: "10MB",
|
|
17
|
+
video: "50MB",
|
|
18
|
+
pdf: "20MB",
|
|
19
|
+
};
|
|
20
|
+
export const MAX_BYTES = {
|
|
21
|
+
image: MAX_IMAGE_BYTES,
|
|
22
|
+
video: MAX_VIDEO_BYTES,
|
|
23
|
+
pdf: MAX_PDF_BYTES,
|
|
24
|
+
};
|
|
25
|
+
// Image allowlist — kept conservative; SVG intentionally excluded (XSS surface).
|
|
26
|
+
export const ALLOWED_IMAGE_MIMES = [
|
|
27
|
+
"image/jpeg",
|
|
28
|
+
"image/jpg",
|
|
29
|
+
"image/png",
|
|
30
|
+
"image/gif",
|
|
31
|
+
"image/webp",
|
|
32
|
+
];
|
|
33
|
+
// Video allowlist — Z2 widening: phone-camera 3GPP captures + Matroska container.
|
|
34
|
+
// `video/x-matroska` covers .mkv from desktop encoders; `video/3gpp` + `video/3gpp2`
|
|
35
|
+
// cover legacy Android/iOS camera output.
|
|
36
|
+
export const ALLOWED_VIDEO_MIMES = [
|
|
37
|
+
"video/mp4",
|
|
38
|
+
"video/webm",
|
|
39
|
+
"video/quicktime",
|
|
40
|
+
"video/3gpp",
|
|
41
|
+
"video/3gpp2",
|
|
42
|
+
"video/x-matroska",
|
|
43
|
+
];
|
|
44
|
+
export const ALLOWED_DOC_MIMES = ["application/pdf"];
|
|
45
|
+
export const ALLOWED_MIMES = [
|
|
46
|
+
...ALLOWED_IMAGE_MIMES,
|
|
47
|
+
...ALLOWED_VIDEO_MIMES,
|
|
48
|
+
...ALLOWED_DOC_MIMES,
|
|
49
|
+
];
|
|
50
|
+
export const ALLOWED_TYPES_LABEL = "JPEG, PNG, GIF, WebP, MP4, WebM, QuickTime, 3GP, MKV, PDF";
|
|
51
|
+
// Server-detected MIME → canonical filename extension. The browser-supplied
|
|
52
|
+
// File.type is untrusted; the server picks the ext from the detected MIME.
|
|
53
|
+
export const MIME_TO_EXT = {
|
|
54
|
+
"image/jpeg": "jpg",
|
|
55
|
+
"image/jpg": "jpg",
|
|
56
|
+
"image/png": "png",
|
|
57
|
+
"image/gif": "gif",
|
|
58
|
+
"image/webp": "webp",
|
|
59
|
+
"video/mp4": "mp4",
|
|
60
|
+
"video/webm": "webm",
|
|
61
|
+
"video/quicktime": "mov",
|
|
62
|
+
"video/3gpp": "3gp",
|
|
63
|
+
"video/3gpp2": "3g2",
|
|
64
|
+
"video/x-matroska": "mkv",
|
|
65
|
+
"application/pdf": "pdf",
|
|
66
|
+
};
|
|
67
|
+
export function classifyMime(mime) {
|
|
68
|
+
if (ALLOWED_IMAGE_MIMES.includes(mime))
|
|
69
|
+
return "image";
|
|
70
|
+
if (ALLOWED_VIDEO_MIMES.includes(mime))
|
|
71
|
+
return "video";
|
|
72
|
+
if (ALLOWED_DOC_MIMES.includes(mime))
|
|
73
|
+
return "pdf";
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
export function isAllowedMime(mime) {
|
|
77
|
+
return ALLOWED_MIMES.includes(mime);
|
|
78
|
+
}
|
|
79
|
+
export function maxBytesFor(mime) {
|
|
80
|
+
const kind = classifyMime(mime);
|
|
81
|
+
return kind ? MAX_BYTES[kind] : null;
|
|
82
|
+
}
|
|
83
|
+
export const PDF_MAGIC = "%PDF-";
|
|
84
|
+
// Known-but-rejected video formats. Mapping returns a user-actionable
|
|
85
|
+
// conversion hint so the upload error can say "convert your .avi to .mp4"
|
|
86
|
+
// rather than the generic "invalid type" response.
|
|
87
|
+
export const VIDEO_CONVERSION_HINTS = {
|
|
88
|
+
"video/x-msvideo": "AVI is not supported — please convert to MP4 or WebM",
|
|
89
|
+
"video/avi": "AVI is not supported — please convert to MP4 or WebM",
|
|
90
|
+
"video/MP2T": "M2TS/TS streams are not supported — please convert to MP4",
|
|
91
|
+
"video/mp2t": "M2TS/TS streams are not supported — please convert to MP4",
|
|
92
|
+
"video/x-flv": "FLV is not supported — please convert to MP4",
|
|
93
|
+
"video/x-ms-wmv": "WMV is not supported — please convert to MP4",
|
|
94
|
+
};
|
|
95
|
+
export function getConversionHint(mime) {
|
|
96
|
+
return VIDEO_CONVERSION_HINTS[mime] ?? null;
|
|
97
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firestore document schema versions — SB-UNI X3.
|
|
3
|
+
*
|
|
4
|
+
* Every persisted document type carries an optional `schemaVersion?: number`
|
|
5
|
+
* field. When absent, repositories default to v1. When out-of-date, the
|
|
6
|
+
* repository's per-feature `migrations.ts` runs the in-flight migration
|
|
7
|
+
* before returning the doc.
|
|
8
|
+
*
|
|
9
|
+
* This is Pattern 4 from the SB-UNI plan — a one-time tax that prevents
|
|
10
|
+
* future migration pain by giving every document a version handle.
|
|
11
|
+
*
|
|
12
|
+
* Adding a migration:
|
|
13
|
+
* 1. Bump the entry below (e.g. `product: 2`)
|
|
14
|
+
* 2. Add a `migrations.ts` row keyed `1: (doc) => migrateProductV1ToV2(doc)`
|
|
15
|
+
* 3. Repository handles the rest via `migrateDocument()`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const SCHEMA_VERSIONS: {
|
|
18
|
+
readonly address: 1;
|
|
19
|
+
readonly bid: 1;
|
|
20
|
+
readonly blogPost: 1;
|
|
21
|
+
readonly brand: 1;
|
|
22
|
+
readonly bundle: 1;
|
|
23
|
+
readonly carouselSlide: 1;
|
|
24
|
+
readonly cart: 1;
|
|
25
|
+
readonly cartItem: 1;
|
|
26
|
+
readonly category: 1;
|
|
27
|
+
readonly chatRoom: 1;
|
|
28
|
+
readonly contactSubmission: 1;
|
|
29
|
+
readonly conversation: 1;
|
|
30
|
+
readonly copilotLog: 1;
|
|
31
|
+
readonly coupon: 1;
|
|
32
|
+
readonly couponUsage: 1;
|
|
33
|
+
readonly emailVerificationToken: 1;
|
|
34
|
+
readonly event: 1;
|
|
35
|
+
readonly eventEntry: 1;
|
|
36
|
+
readonly faq: 1;
|
|
37
|
+
readonly groupedListing: 1;
|
|
38
|
+
readonly history: 1;
|
|
39
|
+
readonly newsletterSubscriber: 1;
|
|
40
|
+
readonly notification: 1;
|
|
41
|
+
readonly offer: 1;
|
|
42
|
+
readonly order: 1;
|
|
43
|
+
readonly passwordResetToken: 1;
|
|
44
|
+
readonly payout: 1;
|
|
45
|
+
readonly product: 1;
|
|
46
|
+
readonly productFeature: 1;
|
|
47
|
+
readonly productTemplate: 1;
|
|
48
|
+
readonly review: 1;
|
|
49
|
+
readonly scammer: 1;
|
|
50
|
+
readonly scammerComment: 1;
|
|
51
|
+
readonly scammerContest: 1;
|
|
52
|
+
readonly scammerIncident: 1;
|
|
53
|
+
readonly session: 1;
|
|
54
|
+
readonly siteSettings: 1;
|
|
55
|
+
readonly smsCounter: 1;
|
|
56
|
+
readonly store: 1;
|
|
57
|
+
readonly storeAddress: 1;
|
|
58
|
+
readonly sublistingCategory: 1;
|
|
59
|
+
readonly supportTicket: 1;
|
|
60
|
+
readonly user: 1;
|
|
61
|
+
readonly wishlist: 1;
|
|
62
|
+
};
|
|
63
|
+
export type SchemaCollection = keyof typeof SCHEMA_VERSIONS;
|
|
64
|
+
export interface SchemaVersioned {
|
|
65
|
+
schemaVersion?: number;
|
|
66
|
+
}
|
|
67
|
+
export type MigrationStep<T> = (doc: T) => T;
|
|
68
|
+
/**
|
|
69
|
+
* Migrate a document from its persisted `schemaVersion` to the current
|
|
70
|
+
* collection version. Passes through unchanged when the doc is already
|
|
71
|
+
* current, missing version (treated as v1), or no migrations are defined.
|
|
72
|
+
*
|
|
73
|
+
* Migrations is a map keyed by the FROM-version (e.g. `1: (doc) => v2(doc)`
|
|
74
|
+
* upgrades a v1 doc to v2). Multi-step migrations chain automatically.
|
|
75
|
+
*/
|
|
76
|
+
export declare function migrateDocument<T extends SchemaVersioned>(doc: T, current: number, migrations: Record<number, MigrationStep<T>>): T;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firestore document schema versions — SB-UNI X3.
|
|
3
|
+
*
|
|
4
|
+
* Every persisted document type carries an optional `schemaVersion?: number`
|
|
5
|
+
* field. When absent, repositories default to v1. When out-of-date, the
|
|
6
|
+
* repository's per-feature `migrations.ts` runs the in-flight migration
|
|
7
|
+
* before returning the doc.
|
|
8
|
+
*
|
|
9
|
+
* This is Pattern 4 from the SB-UNI plan — a one-time tax that prevents
|
|
10
|
+
* future migration pain by giving every document a version handle.
|
|
11
|
+
*
|
|
12
|
+
* Adding a migration:
|
|
13
|
+
* 1. Bump the entry below (e.g. `product: 2`)
|
|
14
|
+
* 2. Add a `migrations.ts` row keyed `1: (doc) => migrateProductV1ToV2(doc)`
|
|
15
|
+
* 3. Repository handles the rest via `migrateDocument()`.
|
|
16
|
+
*/
|
|
17
|
+
export const SCHEMA_VERSIONS = {
|
|
18
|
+
address: 1,
|
|
19
|
+
bid: 1,
|
|
20
|
+
blogPost: 1,
|
|
21
|
+
brand: 1,
|
|
22
|
+
bundle: 1,
|
|
23
|
+
carouselSlide: 1,
|
|
24
|
+
cart: 1,
|
|
25
|
+
cartItem: 1,
|
|
26
|
+
category: 1,
|
|
27
|
+
chatRoom: 1,
|
|
28
|
+
contactSubmission: 1,
|
|
29
|
+
conversation: 1,
|
|
30
|
+
copilotLog: 1,
|
|
31
|
+
coupon: 1,
|
|
32
|
+
couponUsage: 1,
|
|
33
|
+
emailVerificationToken: 1,
|
|
34
|
+
event: 1,
|
|
35
|
+
eventEntry: 1,
|
|
36
|
+
faq: 1,
|
|
37
|
+
groupedListing: 1,
|
|
38
|
+
history: 1,
|
|
39
|
+
newsletterSubscriber: 1,
|
|
40
|
+
notification: 1,
|
|
41
|
+
offer: 1,
|
|
42
|
+
order: 1,
|
|
43
|
+
passwordResetToken: 1,
|
|
44
|
+
payout: 1,
|
|
45
|
+
product: 1,
|
|
46
|
+
productFeature: 1,
|
|
47
|
+
productTemplate: 1,
|
|
48
|
+
review: 1,
|
|
49
|
+
scammer: 1,
|
|
50
|
+
scammerComment: 1,
|
|
51
|
+
scammerContest: 1,
|
|
52
|
+
scammerIncident: 1,
|
|
53
|
+
session: 1,
|
|
54
|
+
siteSettings: 1,
|
|
55
|
+
smsCounter: 1,
|
|
56
|
+
store: 1,
|
|
57
|
+
storeAddress: 1,
|
|
58
|
+
sublistingCategory: 1,
|
|
59
|
+
supportTicket: 1,
|
|
60
|
+
user: 1,
|
|
61
|
+
wishlist: 1,
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Migrate a document from its persisted `schemaVersion` to the current
|
|
65
|
+
* collection version. Passes through unchanged when the doc is already
|
|
66
|
+
* current, missing version (treated as v1), or no migrations are defined.
|
|
67
|
+
*
|
|
68
|
+
* Migrations is a map keyed by the FROM-version (e.g. `1: (doc) => v2(doc)`
|
|
69
|
+
* upgrades a v1 doc to v2). Multi-step migrations chain automatically.
|
|
70
|
+
*/
|
|
71
|
+
export function migrateDocument(doc, current, migrations) {
|
|
72
|
+
let working = doc;
|
|
73
|
+
let version = doc.schemaVersion ?? 1;
|
|
74
|
+
while (version < current) {
|
|
75
|
+
const step = migrations[version];
|
|
76
|
+
if (!step)
|
|
77
|
+
break;
|
|
78
|
+
working = step(working);
|
|
79
|
+
version += 1;
|
|
80
|
+
}
|
|
81
|
+
return { ...working, schemaVersion: current };
|
|
82
|
+
}
|
package/dist/client.d.ts
CHANGED
|
@@ -175,3 +175,12 @@ export type { GuestHistoryItem, GuestHistoryType, UserHistoryItem, HistoryProduc
|
|
|
175
175
|
export type { TrackArgs as TrackHistoryArgs } from "./features/history/hooks/useHistory";
|
|
176
176
|
export { WISHLIST_MAX, HISTORY_MAX, CART_MAX_ITEMS, } from "./constants/limits";
|
|
177
177
|
export { normalizeListingType, isAuctionListing, isPreOrderListing, isStandardListing, } from "./features/products/utils/listing-type";
|
|
178
|
+
export { DashboardLayoutClient, RoleGuard } from "./_internal/client/features/layout/index";
|
|
179
|
+
export type { DashboardLayoutClientProps, RoleGuardProps, } from "./_internal/client/features/layout/index";
|
|
180
|
+
export type { LayoutBreakpoint, DashboardVariant, LayoutRole, SidebarNavItem, SidebarNavGroup, MainNavItem as LayoutMainNavItem, BrandingConfig, FooterConfig, SectionResponsive, SectionTheming, LayoutConfig, DashboardLayoutConfig, } from "./_internal/shared/features/layout/index";
|
|
181
|
+
export { LISTING_TYPE_CAPABILITIES, capabilityFor, canAddToCart, canBid, supportsShipping, requiresVendorVerified, requiresJurisdictionCheck, hasInstantFulfillment, assertNever, } from "./_internal/shared/listing-types/capabilities";
|
|
182
|
+
export type { ListingTypeCapability } from "./_internal/shared/listing-types/capabilities";
|
|
183
|
+
export { LISTING_TYPE_REGISTRY, pluginFor } from "./_internal/shared/listing-types/_registry";
|
|
184
|
+
export type { ListingTypePlugin } from "./_internal/shared/listing-types/_registry";
|
|
185
|
+
export { MEGABYTE, MAX_IMAGE_BYTES, MAX_PDF_BYTES, MAX_VIDEO_BYTES, MAX_LABEL, MAX_BYTES, ALLOWED_IMAGE_MIMES, ALLOWED_VIDEO_MIMES, ALLOWED_DOC_MIMES, ALLOWED_MIMES, ALLOWED_TYPES_LABEL, MIME_TO_EXT, PDF_MAGIC, VIDEO_CONVERSION_HINTS, classifyMime, isAllowedMime, maxBytesFor, getConversionHint, } from "./_internal/shared/media/limits";
|
|
186
|
+
export type { MediaKind, AllowedImageMime, AllowedVideoMime, AllowedDocMime, AllowedMime, } from "./_internal/shared/media/limits";
|
package/dist/client.js
CHANGED
|
@@ -198,3 +198,10 @@ export { useHistory, useHistoryMergeOnLogin, getGuestHistory, trackGuestHistory,
|
|
|
198
198
|
export { WISHLIST_MAX, HISTORY_MAX, CART_MAX_ITEMS, } from "./constants/limits";
|
|
199
199
|
// SB1-G canonical listing-type accessors (pure functions, client-safe).
|
|
200
200
|
export { normalizeListingType, isAuctionListing, isPreOrderListing, isStandardListing, } from "./features/products/utils/listing-type";
|
|
201
|
+
// Layout feature — client islands (unifies admin/store/user dashboard layouts).
|
|
202
|
+
export { DashboardLayoutClient, RoleGuard } from "./_internal/client/features/layout/index";
|
|
203
|
+
// Listing-type capability registry — SB-UNI X1.
|
|
204
|
+
export { LISTING_TYPE_CAPABILITIES, capabilityFor, canAddToCart, canBid, supportsShipping, requiresVendorVerified, requiresJurisdictionCheck, hasInstantFulfillment, assertNever, } from "./_internal/shared/listing-types/capabilities";
|
|
205
|
+
export { LISTING_TYPE_REGISTRY, pluginFor } from "./_internal/shared/listing-types/_registry";
|
|
206
|
+
// Media upload limits — shared by client uploaders + server sign/finalize routes.
|
|
207
|
+
export { MEGABYTE, MAX_IMAGE_BYTES, MAX_PDF_BYTES, MAX_VIDEO_BYTES, MAX_LABEL, MAX_BYTES, ALLOWED_IMAGE_MIMES, ALLOWED_VIDEO_MIMES, ALLOWED_DOC_MIMES, ALLOWED_MIMES, ALLOWED_TYPES_LABEL, MIME_TO_EXT, PDF_MAGIC, VIDEO_CONVERSION_HINTS, classifyMime, isAllowedMime, maxBytesFor, getConversionHint, } from "./_internal/shared/media/limits";
|
|
@@ -193,7 +193,8 @@ export declare const LOYALTY_ENDPOINTS: {
|
|
|
193
193
|
};
|
|
194
194
|
export declare const MEDIA_ENDPOINTS: {
|
|
195
195
|
readonly BASE: "/api/media";
|
|
196
|
-
readonly
|
|
196
|
+
readonly SIGN: "/api/media/sign";
|
|
197
|
+
readonly FINALIZE: "/api/media/finalize";
|
|
197
198
|
readonly CROP: "/api/media/crop";
|
|
198
199
|
readonly TRIM: "/api/media/trim";
|
|
199
200
|
readonly DELETE: (url: string) => string;
|
|
@@ -468,7 +469,8 @@ export declare const API_ENDPOINTS: {
|
|
|
468
469
|
};
|
|
469
470
|
readonly MEDIA: {
|
|
470
471
|
readonly BASE: "/api/media";
|
|
471
|
-
readonly
|
|
472
|
+
readonly SIGN: "/api/media/sign";
|
|
473
|
+
readonly FINALIZE: "/api/media/finalize";
|
|
472
474
|
readonly CROP: "/api/media/crop";
|
|
473
475
|
readonly TRIM: "/api/media/trim";
|
|
474
476
|
readonly DELETE: (url: string) => string;
|
|
@@ -742,7 +744,8 @@ export declare const API_ROUTES: {
|
|
|
742
744
|
};
|
|
743
745
|
readonly MEDIA: {
|
|
744
746
|
readonly BASE: "/api/media";
|
|
745
|
-
readonly
|
|
747
|
+
readonly SIGN: "/api/media/sign";
|
|
748
|
+
readonly FINALIZE: "/api/media/finalize";
|
|
746
749
|
readonly CROP: "/api/media/crop";
|
|
747
750
|
readonly TRIM: "/api/media/trim";
|
|
748
751
|
readonly DELETE: (url: string) => string;
|
|
@@ -259,7 +259,8 @@ export const LOYALTY_ENDPOINTS = {
|
|
|
259
259
|
// ---------------------------------------------------------------------------
|
|
260
260
|
export const MEDIA_ENDPOINTS = {
|
|
261
261
|
BASE: "/api/media",
|
|
262
|
-
|
|
262
|
+
SIGN: "/api/media/sign",
|
|
263
|
+
FINALIZE: "/api/media/finalize",
|
|
263
264
|
CROP: "/api/media/crop",
|
|
264
265
|
TRIM: "/api/media/trim",
|
|
265
266
|
DELETE: (url) => `/api/media?url=${encodeURIComponent(url)}`,
|
|
@@ -398,7 +398,7 @@ export declare const ERROR_MESSAGES: {
|
|
|
398
398
|
readonly CART_POST_ERROR: "POST /api/cart error:";
|
|
399
399
|
readonly CART_ITEM_PATCH_ERROR: "error:";
|
|
400
400
|
readonly CART_ITEM_DELETE_ERROR: "error:";
|
|
401
|
-
readonly MEDIA_UPLOAD_ERROR: "
|
|
401
|
+
readonly MEDIA_UPLOAD_ERROR: "Media upload (sign+PUT+finalize) error:";
|
|
402
402
|
readonly MEDIA_TRIM_ERROR: "POST /api/media/trim error:";
|
|
403
403
|
readonly MEDIA_CROP_ERROR: "POST /api/media/crop error:";
|
|
404
404
|
readonly PROFILE_UPDATE_ERROR: "Profile update error:";
|
package/dist/errors/messages.js
CHANGED
|
@@ -426,7 +426,7 @@ export const ERROR_MESSAGES = {
|
|
|
426
426
|
CART_POST_ERROR: "POST /api/cart error:",
|
|
427
427
|
CART_ITEM_PATCH_ERROR: "error:", // Template: `PATCH /api/cart/${itemId} error:`
|
|
428
428
|
CART_ITEM_DELETE_ERROR: "error:", // Template: `DELETE /api/cart/${itemId} error:`
|
|
429
|
-
MEDIA_UPLOAD_ERROR: "
|
|
429
|
+
MEDIA_UPLOAD_ERROR: "Media upload (sign+PUT+finalize) error:",
|
|
430
430
|
MEDIA_TRIM_ERROR: "POST /api/media/trim error:",
|
|
431
431
|
MEDIA_CROP_ERROR: "POST /api/media/crop error:",
|
|
432
432
|
PROFILE_UPDATE_ERROR: "Profile update error:",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// SB-UNI X3 — migrations shell for address.
|
|
2
|
+
// v1 schema is current; no migrations needed yet.
|
|
3
|
+
//
|
|
4
|
+
// To add a migration:
|
|
5
|
+
// 1. Bump the relevant SCHEMA_VERSIONS entry in
|
|
6
|
+
// `_internal/shared/schema-versions.ts` (e.g. `account: 2`)
|
|
7
|
+
// 2. Add a row below keyed by the FROM-version, returning the upgraded doc
|
|
8
|
+
// 3. Repository wraps reads with `migrateDocument(doc, current, migrations)`
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
export const migrations = {};
|
|
@@ -113,7 +113,7 @@ export function AdminMediaView({ labels = {}, children, ...rest }) {
|
|
|
113
113
|
_jsx(Alert, { variant: "info", title: "Media Library", children: "Upload new files in the sandbox below, or browse the existing Storage bucket via the grid." }, "media-info"),
|
|
114
114
|
_jsx(MediaBrowser, { onCopy: copyToClipboard }, "media-browser"),
|
|
115
115
|
operationMessage ? (_jsx(Alert, { variant: operationMessage.startsWith("Failed") || operationMessage.startsWith("Some") || operationMessage.startsWith("Could") ? "error" : "success", title: "Media", children: operationMessage }, "media-op-message")) : null,
|
|
116
|
-
_jsxs(Div, { className: "space-y-5 rounded-xl border border-zinc-200 bg-white p-4 dark:border-slate-700 dark:bg-slate-900", children: [_jsx(Text, { className: "text-sm font-semibold text-zinc-900 dark:text-zinc-100", children: "Upload & Copy URL" }), _jsx(MediaUploadField, { label: "Primary media asset", value: heroAssetUrl, onChange: setHeroAssetUrl, onUpload: onUpload, helperText: "Uploads
|
|
116
|
+
_jsxs(Div, { className: "space-y-5 rounded-xl border border-zinc-200 bg-white p-4 dark:border-slate-700 dark:bg-slate-900", children: [_jsx(Text, { className: "text-sm font-semibold text-zinc-900 dark:text-zinc-100", children: "Upload & Copy URL" }), _jsx(MediaUploadField, { label: "Primary media asset", value: heroAssetUrl, onChange: setHeroAssetUrl, onUpload: onUpload, helperText: "Uploads via signed URL (sign \u2192 PUT \u2192 finalize) and previews the returned URL.", onAbort: handleAbort, onStagedUrlsChange: setStagedUrls }), heroAssetUrl && (_jsxs(Div, { className: "flex items-center gap-2 rounded-lg bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 px-3 py-2", children: [_jsx(Text, { className: "flex-1 truncate text-xs text-zinc-600 dark:text-zinc-400 font-mono", children: heroAssetUrl }), _jsx(Button, { type: "button", variant: "outline", onClick: () => copyToClipboard(heroAssetUrl), children: copiedUrl === heroAssetUrl ? "Copied!" : "Copy URL" })] })), _jsx(MediaUploadList, { label: "Gallery assets", value: galleryAssets, onChange: setGalleryAssets, onUpload: onUpload, helperText: "Attach multiple images or videos for batch checks.", onAbort: handleAbort, onStagedUrlsChange: setStagedUrls, maxItems: 12 }), galleryAssets.length > 0 && (_jsxs(Div, { className: "flex flex-col gap-1", children: [_jsx(Text, { className: "text-xs text-zinc-500 dark:text-zinc-400 font-medium", children: "Gallery URLs" }), galleryAssets.map((asset, i) => (_jsxs(Div, { className: "flex items-center gap-2 rounded bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 px-2 py-1", children: [_jsx(Text, { className: "flex-1 truncate text-xs text-zinc-600 dark:text-zinc-400 font-mono", children: asset.url }), _jsx(Button, { type: "button", variant: "ghost", onClick: () => copyToClipboard(asset.url), children: copiedUrl === asset.url ? "Copied!" : "Copy" })] }, i)))] })), _jsxs(Div, { className: "flex flex-wrap items-center gap-2", children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
117
117
|
setHeroAssetUrl("");
|
|
118
118
|
setGalleryAssets([]);
|
|
119
119
|
}, disabled: isUploadPending || isCleanupPending, children: "Clear previews" }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
@@ -21,7 +21,7 @@ const SORT_OPTIONS = [
|
|
|
21
21
|
{ value: "-price", label: "Highest price" },
|
|
22
22
|
];
|
|
23
23
|
const STATUS_OPTIONS = ["All", "pending", "published", "draft", "archived"];
|
|
24
|
-
const TYPE_OPTIONS = ["All", "Products", "Auctions", "Pre-orders"];
|
|
24
|
+
const TYPE_OPTIONS = ["All", "Products", "Auctions", "Pre-orders", "Prize Draws"];
|
|
25
25
|
const FLAG_DEFS = [
|
|
26
26
|
{ key: "featured", label: "Featured" },
|
|
27
27
|
{ key: "isPromoted", label: "Promoted" },
|
|
@@ -94,9 +94,13 @@ export function AdminProductsView({ children, actionHref, getRowHref, ...props }
|
|
|
94
94
|
const typeRaw = table.get("type");
|
|
95
95
|
if (typeRaw && typeRaw !== "All") {
|
|
96
96
|
if (typeRaw === "Auctions")
|
|
97
|
-
filterParts.push("
|
|
97
|
+
filterParts.push("listingType==auction");
|
|
98
98
|
else if (typeRaw === "Pre-orders")
|
|
99
|
-
filterParts.push("
|
|
99
|
+
filterParts.push("listingType==pre-order");
|
|
100
|
+
else if (typeRaw === "Prize Draws")
|
|
101
|
+
filterParts.push("listingType==prize-draw");
|
|
102
|
+
else if (typeRaw === "Products")
|
|
103
|
+
filterParts.push("listingType==standard");
|
|
100
104
|
}
|
|
101
105
|
const filters = filterParts.join(",") || undefined;
|
|
102
106
|
const { rows: fetchedRows, total, isLoading, errorMessage } = useAdminListingData({
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// SB-UNI X3 — migrations shell for notification/chatRoom/siteSettings.
|
|
2
|
+
// v1 schema is current; no migrations needed yet.
|
|
3
|
+
//
|
|
4
|
+
// To add a migration:
|
|
5
|
+
// 1. Bump the relevant SCHEMA_VERSIONS entry in
|
|
6
|
+
// `_internal/shared/schema-versions.ts` (e.g. `admin: 2`)
|
|
7
|
+
// 2. Add a row below keyed by the FROM-version, returning the upgraded doc
|
|
8
|
+
// 3. Repository wraps reads with `migrateDocument(doc, current, migrations)`
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
export const migrations = {};
|
|
@@ -48,7 +48,7 @@ export interface AdminProduct {
|
|
|
48
48
|
insuranceCost?: number;
|
|
49
49
|
shippingPaidBy?: "seller" | "buyer";
|
|
50
50
|
/** Canonical listing-kind discriminator (SB1-G Phase 4 — booleans removed). */
|
|
51
|
-
listingType?: "standard" | "auction" | "pre-order" | "prize-draw"
|
|
51
|
+
listingType?: "standard" | "auction" | "pre-order" | "prize-draw";
|
|
52
52
|
auctionEndDate?: string;
|
|
53
53
|
startingBid?: number;
|
|
54
54
|
currentBid?: number;
|
|
@@ -12,7 +12,7 @@ export interface MarketplaceAuctionCardData {
|
|
|
12
12
|
thumbnailUrl?: string;
|
|
13
13
|
};
|
|
14
14
|
/** Canonical discriminator (SB1-G Phase 4). */
|
|
15
|
-
listingType?: "standard" | "auction" | "pre-order" | "prize-draw"
|
|
15
|
+
listingType?: "standard" | "auction" | "pre-order" | "prize-draw";
|
|
16
16
|
auctionEndDate?: string | Date;
|
|
17
17
|
startingBid?: number;
|
|
18
18
|
currentBid?: number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// SB-UNI X3 — migrations shell for bid.
|
|
2
|
+
// v1 schema is current; no migrations needed yet.
|
|
3
|
+
//
|
|
4
|
+
// To add a migration:
|
|
5
|
+
// 1. Bump the relevant SCHEMA_VERSIONS entry in
|
|
6
|
+
// `_internal/shared/schema-versions.ts` (e.g. `auctions: 2`)
|
|
7
|
+
// 2. Add a row below keyed by the FROM-version, returning the upgraded doc
|
|
8
|
+
// 3. Repository wraps reads with `migrateDocument(doc, current, migrations)`
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
export const migrations = {};
|