@mohasinac/appkit 4.53.2 → 4.54.0
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/.build-stamp.json +3 -3
- package/dist/_internal/server/features/auth/capabilities.js +7 -5
- package/dist/_internal/server/features/checkout/actions.d.ts +22 -6
- package/dist/_internal/server/features/checkout/actions.js +96 -51
- 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/supplier-identity.js +28 -6
- package/dist/_internal/server/features/orders/adapters.js +1 -3
- package/dist/_internal/server/features/products/listing-tab-counts.js +81 -25
- package/dist/_internal/server/features/search/index-build/sources.js +43 -2
- package/dist/_internal/server/features/site-settings/adapters.js +1 -1
- package/dist/_internal/server/features/stores/adapters.d.ts +1 -1
- package/dist/_internal/server/features/stores/adapters.js +0 -1
- package/dist/_internal/server/jobs/core/analyticsAlertEvaluate.js +2 -5
- package/dist/_internal/server/jobs/core/jobRunners.js +0 -10
- package/dist/_internal/server/jobs/core/onOrderCreate.js +10 -104
- package/dist/_internal/server/jobs/core/onOrderStatusChange.d.ts +0 -2
- package/dist/_internal/server/jobs/core/onOrderStatusChange.js +0 -1
- package/dist/_internal/server/jobs/core/onScamReportCreate.js +0 -1
- package/dist/_internal/server/jobs/core/onScamReportRejected.js +0 -1
- package/dist/_internal/server/jobs/core/onScamReportVerified.js +0 -1
- package/dist/_internal/server/jobs/core/paymentWindowTimeout.js +0 -1
- package/dist/_internal/server/jobs/core/pendingOrderTimeout.js +0 -1
- package/dist/_internal/server/notifications/channel-health.d.ts +7 -3
- package/dist/_internal/server/notifications/channel-health.js +2 -2
- package/dist/_internal/server/notifications/send-guard.d.ts +1 -1
- package/dist/_internal/server/notifications/send-guard.js +2 -4
- package/dist/_internal/shared/actions/action-registry.d.ts +1 -1
- package/dist/_internal/shared/actions/action-registry.js +128 -28
- package/dist/_internal/shared/checkout/order-math.d.ts +1 -1
- package/dist/_internal/shared/checkout/order-math.js +1 -1
- package/dist/_internal/shared/features/categories/bundle-copy.d.ts +1 -1
- package/dist/_internal/shared/features/checkout/config.d.ts +0 -2
- package/dist/_internal/shared/features/checkout/config.js +0 -2
- package/dist/_internal/shared/features/messaging/config.d.ts +7 -5
- package/dist/_internal/shared/features/messaging/config.js +1 -4
- package/dist/_internal/shared/features/site-settings/fees.d.ts +0 -2
- package/dist/_internal/shared/features/site-settings/fees.js +0 -2
- package/dist/_internal/shared/features/site-settings/supplier-of-record.d.ts +56 -0
- package/dist/_internal/shared/features/site-settings/supplier-of-record.js +57 -0
- package/dist/_internal/shared/fees/calculator.d.ts +0 -8
- package/dist/_internal/shared/fees/calculator.js +0 -7
- package/dist/_internal/shared/listing-types/tiers.d.ts +94 -0
- package/dist/_internal/shared/listing-types/tiers.js +150 -0
- package/dist/cli/index.js +0 -2
- package/dist/client.d.ts +25 -4
- package/dist/client.js +36 -5
- package/dist/constants/api-endpoints.d.ts +21 -15
- package/dist/constants/api-endpoints.js +7 -8
- package/dist/constants/field-names.d.ts +1 -0
- package/dist/constants/field-names.js +1 -0
- package/dist/constants/notification-types.d.ts +1 -1
- package/dist/constants/notification-types.js +1 -1
- package/dist/core/integration-keys.d.ts +5 -5
- package/dist/core/integration-keys.js +21 -10
- package/dist/features/about/components/FeesView.js +0 -6
- package/dist/features/about/components/GuidesHubView.js +15 -2
- package/dist/features/account/components/NotificationPreferencesPanel.js +3 -4
- package/dist/features/account/components/UserOrdersView.js +26 -7
- package/dist/features/account/types/index.d.ts +0 -2
- package/dist/features/addresses/utils/postal-autofill.d.ts +39 -0
- package/dist/features/addresses/utils/postal-autofill.js +54 -0
- package/dist/features/admin/actions/notification-actions.d.ts +2 -8
- package/dist/features/admin/actions/notification-actions.js +9 -104
- package/dist/features/admin/components/AdminGuideHubView.js +1 -8
- package/dist/features/admin/components/AdminOrderEditorView.d.ts +1 -1
- package/dist/features/admin/components/AdminOrdersView.js +0 -2
- package/dist/features/admin/components/AdminSectionsView.js +3 -2
- package/dist/features/admin/components/AdminSiteSettingsView.js +22 -68
- package/dist/features/admin/components/AdminStoreEditorView.js +72 -34
- package/dist/features/admin/components/OwnerQuickActions.d.ts +29 -0
- package/dist/features/admin/components/OwnerQuickActions.js +142 -0
- package/dist/features/admin/components/sections/adminSectionsTypes.js +13 -4
- package/dist/features/admin/components/sections/icon-options.d.ts +21 -0
- package/dist/features/admin/components/sections/icon-options.js +23 -0
- package/dist/features/admin/components/sections/sectionTemplates.js +4 -1
- package/dist/features/admin/constants/site-settings-tabs.d.ts +7 -12
- package/dist/features/admin/constants/site-settings-tabs.js +6 -12
- package/dist/features/admin/repository/site-settings.repository.js +1 -1
- package/dist/features/admin/schemas/admin-editor-forms.d.ts +1 -1
- package/dist/features/admin/schemas/admin-editor-forms.js +4 -1
- package/dist/features/admin/schemas/admin-user-form.d.ts +0 -61
- package/dist/features/admin/schemas/admin-user-form.js +3 -44
- package/dist/features/admin/schemas/firestore.d.ts +28 -54
- package/dist/features/admin/schemas/firestore.js +40 -18
- package/dist/features/auctions/components/AuctionDetailPageView.js +4 -3
- package/dist/features/auctions/components/MarketplaceAuctionCard.d.ts +11 -1
- package/dist/features/auctions/components/MarketplaceAuctionCard.js +9 -2
- package/dist/features/auth/checkout-value-otp.d.ts +1 -1
- package/dist/features/auth/checkout-value-otp.js +1 -1
- package/dist/features/auth/permissions/constants.d.ts +29 -2
- package/dist/features/auth/permissions/constants.js +67 -1
- package/dist/features/blog/components/BlogFeaturedCard.d.ts +11 -1
- package/dist/features/blog/components/BlogFeaturedCard.js +9 -2
- package/dist/features/cart/components/CartDrawer.js +3 -2
- package/dist/features/cart/components/CartGroupLineRow.js +2 -1
- package/dist/features/cart/components/CartPriceBreakdown.d.ts +0 -2
- package/dist/features/cart/components/CartPriceBreakdown.js +1 -1
- package/dist/features/cart/components/StoreAddonsPicker.d.ts +2 -5
- package/dist/features/cart/components/StoreAddonsPicker.js +4 -5
- package/dist/features/cart/hooks/useAddToCart.js +10 -5
- package/dist/features/cart/repository/cart.repository.js +1 -2
- package/dist/features/cart/schemas/firestore.d.ts +1 -2
- package/dist/features/cart/utils/pending-ops.d.ts +11 -1
- package/dist/features/cart/utils/pending-ops.js +14 -2
- package/dist/features/categories/components/BrandDetailPageView.js +2 -1
- package/dist/features/categories/components/BundleDetailView.js +2 -1
- package/dist/features/categories/components/CategoryDetailPageView.js +2 -1
- package/dist/features/categories/components/CategoryGrid.d.ts +11 -1
- package/dist/features/categories/components/CategoryGrid.js +9 -2
- package/dist/features/checkout/actions/checkout-value-otp-actions.d.ts +10 -5
- package/dist/features/checkout/actions/checkout-value-otp-actions.js +2 -88
- package/dist/features/classified/components/ClassifiedDetailPageView.js +2 -1
- package/dist/features/digital-codes/components/DigitalCodeDetailPageView.js +2 -1
- package/dist/features/events/components/EventCard.d.ts +11 -1
- package/dist/features/events/components/EventCard.js +9 -2
- package/dist/features/grouped/components/GroupedListingDetailView.js +3 -1
- package/dist/features/homepage/components/CTABannerSection.d.ts +3 -1
- package/dist/features/homepage/components/CTABannerSection.js +6 -3
- package/dist/features/homepage/components/HeroCarousel.js +8 -6
- package/dist/features/homepage/components/MarketplaceHomepageView.js +33 -7
- package/dist/features/homepage/components/SectionCarousel.js +13 -5
- package/dist/features/homepage/components/SecurityHighlightsSection.d.ts +8 -3
- package/dist/features/homepage/components/SecurityHighlightsSection.js +2 -2
- package/dist/features/homepage/components/StatsCounterSection.d.ts +9 -4
- package/dist/features/homepage/components/StatsCounterSection.js +2 -2
- package/dist/features/homepage/components/TestimonialsCarousel.js +1 -1
- package/dist/features/homepage/components/TrustFeaturesSection.d.ts +18 -4
- package/dist/features/homepage/components/TrustFeaturesSection.js +5 -5
- package/dist/features/homepage/components/WelcomeSection.d.ts +13 -2
- package/dist/features/homepage/components/WelcomeSection.js +3 -3
- package/dist/features/homepage/components/WhatsAppCommunitySection.d.ts +28 -0
- package/dist/features/homepage/components/WhatsAppCommunitySection.js +42 -6
- package/dist/features/homepage/components/WhatsAppGlyph.d.ts +20 -0
- package/dist/features/homepage/components/WhatsAppGlyph.js +20 -0
- package/dist/features/homepage/constants/hero-carousel-styles.d.ts +8 -6
- package/dist/features/homepage/constants/hero-carousel-styles.js +8 -6
- package/dist/features/homepage/constants/section-copy.d.ts +12 -10
- package/dist/features/homepage/constants/section-copy.js +28 -6
- package/dist/features/homepage/constants/stat-icons.d.ts +12 -0
- package/dist/features/homepage/constants/stat-icons.js +17 -0
- package/dist/features/homepage/constants/trust-icon-aliases.d.ts +8 -0
- package/dist/features/homepage/constants/trust-icon-aliases.js +75 -0
- package/dist/features/homepage/lib/section-defaults.d.ts +16 -1
- package/dist/features/homepage/lib/section-defaults.js +24 -4
- package/dist/features/homepage/lib/section-renderer.js +48 -8
- package/dist/features/homepage/schemas/firestore.d.ts +18 -1
- package/dist/features/layout/AppLayoutShell.js +2 -1
- package/dist/features/layout/BottomActions.d.ts +1 -0
- package/dist/features/layout/BottomActions.js +330 -0
- package/dist/features/layout/BottomChrome.d.ts +45 -0
- package/dist/features/layout/BottomChrome.js +5 -17
- package/dist/features/layout/SideActionDock.js +36 -13
- package/dist/features/layout/index.d.ts +2 -7
- package/dist/features/layout/index.js +7 -7
- package/dist/features/layout/useIsDesktop.d.ts +36 -0
- package/dist/features/layout/useIsDesktop.js +48 -0
- package/dist/features/live/components/LiveItemDetailPageView.js +2 -1
- package/dist/features/orders/actions/refund-actions.js +0 -1
- package/dist/features/orders/components/OrderAddonBadges.d.ts +1 -3
- package/dist/features/orders/components/OrderAddonBadges.js +3 -4
- package/dist/features/orders/components/OrderPaymentSummary.js +15 -2
- package/dist/features/orders/components/YourPurchaseStrip.d.ts +24 -0
- package/dist/features/orders/components/YourPurchaseStrip.js +77 -0
- package/dist/features/orders/components/index.d.ts +2 -1
- package/dist/features/orders/components/index.js +1 -1
- package/dist/features/orders/repository/orders.repository.d.ts +0 -8
- package/dist/features/orders/repository/orders.repository.js +0 -2
- package/dist/features/orders/schemas/firestore.d.ts +17 -9
- package/dist/features/orders/types/index.d.ts +2 -5
- package/dist/features/orders/utils/order-announcement-message.d.ts +18 -0
- package/dist/features/orders/utils/order-announcement-message.js +16 -0
- package/dist/features/orders/utils/payment-proof-message.d.ts +20 -0
- package/dist/features/orders/utils/payment-proof-message.js +17 -0
- package/dist/features/parts/components/PartDetailPageView.js +96 -1
- package/dist/features/parts/schemas/firestore.d.ts +247 -0
- package/dist/features/parts/schemas/firestore.js +6 -6
- package/dist/features/pre-orders/components/MarketplacePreorderCard.d.ts +11 -1
- package/dist/features/pre-orders/components/MarketplacePreorderCard.js +10 -3
- package/dist/features/pre-orders/components/PreOrderDetailPageView.js +4 -3
- package/dist/features/products/api/[id]/route.js +8 -1
- package/dist/features/products/api/route.js +16 -4
- package/dist/features/products/components/AvailabilityScopeHint.js +1 -1
- package/dist/features/products/components/InteractiveProductCard.d.ts +7 -1
- package/dist/features/products/components/InteractiveProductCard.js +16 -4
- package/dist/features/products/components/MarketplaceBundleCard.d.ts +11 -1
- package/dist/features/products/components/MarketplaceBundleCard.js +9 -2
- package/dist/features/products/components/MarketplacePrizeDrawCard.d.ts +11 -1
- package/dist/features/products/components/MarketplacePrizeDrawCard.js +9 -2
- package/dist/features/products/components/PrizeDrawDetailPageView.js +2 -1
- package/dist/features/products/components/ProductDetailPageView.js +27 -2
- package/dist/features/products/components/ProductGrid.d.ts +14 -1
- package/dist/features/products/components/ProductGrid.js +22 -5
- package/dist/features/products/components/ProductsIndexListing.js +2 -2
- package/dist/features/reviews/api/[id]/route.js +83 -23
- package/dist/features/reviews/components/PurchaseReviewAffordance.d.ts +6 -0
- package/dist/features/reviews/components/PurchaseReviewAffordance.js +42 -0
- package/dist/features/reviews/components/ReviewFormDrawer.d.ts +34 -0
- package/dist/features/reviews/components/ReviewFormDrawer.js +127 -0
- package/dist/features/reviews/components/index.d.ts +4 -0
- package/dist/features/reviews/components/index.js +2 -0
- package/dist/features/scams/schemas/index.d.ts +10 -10
- package/dist/features/search/action-index/settings-entries.js +0 -9
- package/dist/features/seller/actions/seller-actions.d.ts +1 -1
- package/dist/features/seller/actions/seller-actions.js +49 -3
- package/dist/features/seller/components/SellerPayoutSettingsView.js +30 -2
- package/dist/features/seller/components/SellerProductShell.d.ts +17 -1
- package/dist/features/seller/hooks/useStoreListingEntitlements.d.ts +8 -0
- package/dist/features/seller/hooks/useStoreListingEntitlements.js +70 -0
- package/dist/features/store-extensions/repository/store-extensions.repositories.d.ts +1 -6
- package/dist/features/store-extensions/repository/store-extensions.repositories.js +1 -10
- package/dist/features/store-extensions/schemas/firestore.d.ts +1 -17
- package/dist/features/store-extensions/schemas/firestore.js +0 -10
- package/dist/features/stores/components/InteractiveStoreCard.d.ts +11 -1
- package/dist/features/stores/components/InteractiveStoreCard.js +9 -2
- package/dist/features/stores/components/StoreCapabilitiesGuideView.js +0 -1
- package/dist/features/stores/components/StoreGuideHubView.js +2 -8
- package/dist/features/stores/components/StoreSettingsGuideView.js +2 -6
- package/dist/features/stores/components/index.d.ts +0 -2
- package/dist/features/stores/components/index.js +0 -1
- package/dist/features/stores/repository/store.repository.d.ts +1 -26
- package/dist/features/stores/repository/store.repository.js +5 -60
- package/dist/features/stores/schemas/firestore.d.ts +6 -25
- package/dist/features/stores/schemas/firestore.js +6 -3
- package/dist/features/stores/schemas/index.d.ts +1 -87
- package/dist/features/stores/schemas/index.js +10 -15
- package/dist/features/tester/seed-data/authored/admin__site-system.js +0 -48
- package/dist/features/tester/seed-data/authored/buying__buying-checkout.js +0 -40
- package/dist/features/tester/seed-data/authored/selling__quick-add-minimum-details.js +0 -16
- package/dist/features/tester/seed-data/authored/selling__seller-guide.js +1 -1
- package/dist/features/tester/seed-data/authored/selling__seller-marketing-extras.js +0 -79
- package/dist/features/tester/seed-data/authored/selling__seller-orders.js +1 -1
- package/dist/features/tester/seed-data/tester-checklist-seed-data.js +415 -69
- package/dist/index.d.ts +20 -32
- package/dist/index.js +34 -43
- package/dist/next/routing/route-map.d.ts +2 -8
- package/dist/next/routing/route-map.js +21 -4
- package/dist/providers/db-firebase/base.repository.d.ts +1 -1
- package/dist/providers/db-firebase/base.repository.js +1 -1
- package/dist/providers/payment-razorpay/index.d.ts +125 -0
- package/dist/providers/payment-razorpay/index.js +232 -0
- package/dist/providers/payment-razorpay/signature.d.ts +53 -0
- package/dist/providers/payment-razorpay/signature.js +71 -0
- package/dist/providers/shipping-shiprocket/index.d.ts +98 -0
- package/dist/providers/shipping-shiprocket/index.js +356 -0
- package/dist/providers.d.ts +3 -0
- package/dist/providers.js +3 -0
- package/dist/react/hooks/useCanSeePrices.d.ts +0 -27
- package/dist/react/hooks/useCanSeePrices.js +25 -0
- package/dist/repositories/index.d.ts +1 -1
- package/dist/repositories/index.js +1 -1
- package/dist/schemas/registry.d.ts +10 -115
- package/dist/schemas/registry.js +1 -2
- package/dist/security/pii-encrypt.js +1 -1
- package/dist/seed/_helpers/category-forest.js +27 -0
- package/dist/seed/_helpers/category-parts-glossary-map.js +1816 -86
- package/dist/seed/_helpers/category-parts.d.ts +1 -1
- package/dist/seed/_helpers/category-parts.js +13412 -3020
- package/dist/seed/carousel-slides-seed-data.js +47 -10
- package/dist/seed/categories-seed-data.js +48 -6
- package/dist/seed/faq-seed-data.js +2 -2
- package/dist/seed/homepage-sections-seed-data.js +286 -54
- package/dist/seed/index.d.ts +1 -1
- package/dist/seed/index.js +1 -1
- package/dist/seed/manifest.d.ts +1 -1
- package/dist/seed/manifest.js +1 -2
- package/dist/seed/model-composition-seed-data.js +6 -8
- package/dist/seed/part-glossary/chunk0.d.ts +9 -0
- package/dist/seed/part-glossary/chunk0.js +35448 -0
- package/dist/seed/part-glossary/chunk1.d.ts +9 -0
- package/dist/seed/part-glossary/chunk1.js +40494 -0
- package/dist/seed/part-glossary/chunk2.d.ts +9 -0
- package/dist/seed/part-glossary/chunk2.js +51242 -0
- package/dist/seed/part-glossary/chunk3.d.ts +9 -0
- package/dist/seed/part-glossary/chunk3.js +53337 -0
- package/dist/seed/part-glossary/chunk4.d.ts +9 -0
- package/dist/seed/part-glossary/chunk4.js +51454 -0
- package/dist/seed/part-glossary-seed-data.d.ts +1 -1
- package/dist/seed/part-glossary-seed-data.js +23 -47483
- package/dist/seed/site-settings-seed-data.js +34 -35
- package/dist/seed/store-extensions-seed-data.d.ts +1 -2
- package/dist/seed/store-extensions-seed-data.js +1 -23
- package/dist/seed/stores-seed-data.js +0 -1
- package/dist/server-entry.d.ts +1 -1
- package/dist/server-entry.js +1 -1
- package/dist/server.d.ts +8 -10
- package/dist/server.js +16 -22
- package/dist/styles.css +392 -43
- package/dist/tailwind-utilities.css +1 -1
- package/dist/tokens/themes/default-dark.js +1 -1
- package/dist/tokens/themes/default-light.js +2 -1
- package/dist/tokens/tokens.css +6 -2
- package/dist/ui/components/Button.d.ts +11 -0
- package/dist/ui/components/Button.js +11 -0
- package/dist/ui/components/Button.style.css +29 -0
- package/dist/ui/components/CarouselNav.d.ts +57 -0
- package/dist/ui/components/CarouselNav.js +25 -0
- package/dist/ui/components/CarouselNav.style.css +265 -0
- package/dist/ui/components/GatedPrice.js +30 -3
- package/dist/ui/components/GatedPrice.style.css +43 -40
- package/dist/ui/components/HorizontalScroller.d.ts +12 -1
- package/dist/ui/components/HorizontalScroller.js +43 -3
- package/dist/ui/components/ImageMosaic.d.ts +8 -1
- package/dist/ui/components/ImageMosaic.js +3 -2
- package/dist/ui/components/ImageMosaic.style.css +22 -0
- package/dist/ui/components/Layout.style.css +6 -0
- package/dist/ui/components/Semantic.d.ts +3 -2
- package/dist/ui/components/Semantic.js +1 -0
- package/dist/ui/components/Typography.d.ts +2 -0
- package/dist/ui/components/Typography.js +2 -0
- package/dist/ui/components/Typography.style.css +19 -0
- package/dist/ui/components/index.style.css +1 -0
- package/dist/ui/index.d.ts +3 -1
- package/dist/ui/index.js +4 -0
- package/package.json +3 -2
- package/dist/_internal/server/jobs/core/whatsappCatalogImport.d.ts +0 -27
- package/dist/_internal/server/jobs/core/whatsappCatalogImport.js +0 -172
- package/dist/_internal/server/jobs/core/whatsappNotify.d.ts +0 -35
- package/dist/_internal/server/jobs/core/whatsappNotify.js +0 -140
- package/dist/features/admin/components/AdminWhatsAppGuideView.d.ts +0 -2
- package/dist/features/admin/components/AdminWhatsAppGuideView.js +0 -35
- package/dist/features/orders/components/MarketplaceOrderCard.d.ts +0 -36
- package/dist/features/orders/components/MarketplaceOrderCard.js +0 -57
- package/dist/features/stores/components/StoreWhatsAppGuideView.d.ts +0 -3
- package/dist/features/stores/components/StoreWhatsAppGuideView.js +0 -12
- package/dist/features/whatsapp-bot/api/send-status/route.d.ts +0 -12
- package/dist/features/whatsapp-bot/api/send-status/route.js +0 -38
- package/dist/features/whatsapp-bot/api/webhook/route.d.ts +0 -12
- package/dist/features/whatsapp-bot/api/webhook/route.js +0 -43
- package/dist/features/whatsapp-bot/components/SellerWhatsAppSettingsView.d.ts +0 -6
- package/dist/features/whatsapp-bot/components/SellerWhatsAppSettingsView.js +0 -270
- package/dist/features/whatsapp-bot/components/WhatsAppChatButton.d.ts +0 -9
- package/dist/features/whatsapp-bot/components/WhatsAppChatButton.js +0 -7
- package/dist/features/whatsapp-bot/components/index.d.ts +0 -3
- package/dist/features/whatsapp-bot/components/index.js +0 -2
- package/dist/features/whatsapp-bot/helpers/payment-proof-message.d.ts +0 -14
- package/dist/features/whatsapp-bot/helpers/payment-proof-message.js +0 -17
- package/dist/features/whatsapp-bot/helpers/whatsapp.d.ts +0 -52
- package/dist/features/whatsapp-bot/helpers/whatsapp.js +0 -283
- package/dist/features/whatsapp-bot/index.d.ts +0 -3
- package/dist/features/whatsapp-bot/index.js +0 -3
- package/dist/features/whatsapp-bot/manifest.d.ts +0 -2
- package/dist/features/whatsapp-bot/manifest.js +0 -13
- package/dist/features/whatsapp-bot/messages/en.json +0 -7
- package/dist/features/whatsapp-bot/server.d.ts +0 -7
- package/dist/features/whatsapp-bot/server.js +0 -7
- package/dist/features/whatsapp-bot/types/index.d.ts +0 -126
- package/dist/features/whatsapp-bot/types/index.js +0 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Pencil / clone / bin, on a PUBLIC surface, for whoever owns the record.
|
|
5
|
+
*
|
|
6
|
+
* ── What this is for ──────────────────────────────────────────────────────
|
|
7
|
+
*
|
|
8
|
+
* An admin or seller spots a problem on the page a visitor sees — a wrong
|
|
9
|
+
* price, a typo, a bad photo — and today has to navigate to the dashboard,
|
|
10
|
+
* find the list, search for the row and open it. This is the two-click path to
|
|
11
|
+
* the editor from where the problem was noticed.
|
|
12
|
+
*
|
|
13
|
+
* ── Why it is a new component and not a slot on each card ─────────────────
|
|
14
|
+
*
|
|
15
|
+
* 🛑 Measured before building: ZERO public detail views render any owner-only
|
|
16
|
+
* control, and the only precedent anywhere is `CouponCard`, which has had
|
|
17
|
+
* `onEdit` / `onToggleActive` / `onDelete` props the whole time and whose two
|
|
18
|
+
* public consumers pass NONE of them. So there was no pattern to follow and no
|
|
19
|
+
* second implementation to reconcile — one component, used by every surface,
|
|
20
|
+
* is what keeps the visibility rule and the confirm copy in one place.
|
|
21
|
+
*
|
|
22
|
+
* ── The visibility rule, and why it has three states ──────────────────────
|
|
23
|
+
*
|
|
24
|
+
* 🛑 Public pages are static or ISR (`products/[slug]` is `revalidate = 3600`
|
|
25
|
+
* and reads no session), so `SessionProvider` mounts `initialUser={null}` and
|
|
26
|
+
* `loading` starts TRUE on every hard load — for signed-in users too. A
|
|
27
|
+
* two-state `!user → hide` gate therefore renders nothing, then pops the
|
|
28
|
+
* toolbar in a few hundred milliseconds later, on every single page load.
|
|
29
|
+
*
|
|
30
|
+
* So: render NOTHING while `isAuthResolving`. Appearing late is invisible;
|
|
31
|
+
* appearing with a flash is a bug people report. Same reasoning as
|
|
32
|
+
* `useCanSeePrices`, which exists for the mirror-image problem.
|
|
33
|
+
*
|
|
34
|
+
* ── Who sees what ─────────────────────────────────────────────────────────
|
|
35
|
+
*
|
|
36
|
+
* pencil + bin the record's owner, or any admin
|
|
37
|
+
* clone admins ONLY
|
|
38
|
+
*
|
|
39
|
+
* 🛑 Clone is gated on `useIsAdmin()`, NOT on the same check as the other two.
|
|
40
|
+
* `useIsOwner` returns `true` for admins AND for the owner, so reusing it
|
|
41
|
+
* would hand every seller a button that is meant to be a staff tool.
|
|
42
|
+
*
|
|
43
|
+
* @tag domain:admin
|
|
44
|
+
* @tag layer:components
|
|
45
|
+
* @tag access:client
|
|
46
|
+
*/
|
|
47
|
+
import { useCallback, useState } from "react";
|
|
48
|
+
import { useIsAdmin, useIsOwner } from "../../auth/hooks/useRBAC.js";
|
|
49
|
+
import { useOptionalSession } from "../../../react/contexts/SessionContext.js";
|
|
50
|
+
import { ACTIONS } from "../../../_internal/shared/actions/action-registry.js";
|
|
51
|
+
import { ConfirmDeleteModal } from "../../../ui/components/ConfirmDeleteModal.js";
|
|
52
|
+
import { Icon } from "../../../ui/components/Icon.js";
|
|
53
|
+
import { IconButton } from "../../../ui/components/IconButton.js";
|
|
54
|
+
import { Row, useToast } from "../../../ui/index.js";
|
|
55
|
+
import { normalizeError } from "../../../errors/normalize.js";
|
|
56
|
+
import { toUserMessage } from "../../../errors/error-display-map.js";
|
|
57
|
+
export function OwnerQuickActions({ resource, editHref, onDelete, onClone, ownerId, storeId, recordLabel, placement = "card", className = "", }) {
|
|
58
|
+
const session = useOptionalSession();
|
|
59
|
+
const isOwnerOrAdmin = useIsOwner(ownerId);
|
|
60
|
+
const isAdmin = useIsAdmin();
|
|
61
|
+
const { showToast } = useToast();
|
|
62
|
+
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
63
|
+
const [deleting, setDeleting] = useState(false);
|
|
64
|
+
const bucket = ACTIONS[resource];
|
|
65
|
+
const handleConfirmedDelete = useCallback(async () => {
|
|
66
|
+
if (!onDelete)
|
|
67
|
+
return;
|
|
68
|
+
setDeleting(true);
|
|
69
|
+
try {
|
|
70
|
+
await onDelete();
|
|
71
|
+
setConfirmOpen(false);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
const normalized = normalizeError(err);
|
|
75
|
+
/*
|
|
76
|
+
* 🛑 A failed delete MUST say so. Without this the dialog simply closed
|
|
77
|
+
* its spinner and the record was still there — and because the caller
|
|
78
|
+
* navigates away on success, "nothing happened" is indistinguishable
|
|
79
|
+
* from "it worked but the page did not move". This is a destructive
|
|
80
|
+
* action on a public page; silence is the worst available answer.
|
|
81
|
+
*/
|
|
82
|
+
showToast(toUserMessage(normalized.code ?? "UNKNOWN"), "error");
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
// Always clears, so a failed delete leaves a usable dialog rather than a
|
|
86
|
+
// permanently-spinning button the user cannot dismiss or retry.
|
|
87
|
+
setDeleting(false);
|
|
88
|
+
}
|
|
89
|
+
}, [onDelete, showToast]);
|
|
90
|
+
/*
|
|
91
|
+
* 🛑 Nothing at all until auth resolves — see the header. `loading` starts
|
|
92
|
+
* true on every hard load of a static page, so this is the common path on
|
|
93
|
+
* first paint, not an edge case.
|
|
94
|
+
*/
|
|
95
|
+
if (!session || session.loading)
|
|
96
|
+
return null;
|
|
97
|
+
/*
|
|
98
|
+
* A store-owned record is also "mine" when I own that store.
|
|
99
|
+
* `SessionUser.storeId` holds the store SLUG and `StoreDocument.storeId` is
|
|
100
|
+
* the slug too, while `ownerId` is the Auth UID — two different id spaces,
|
|
101
|
+
* so both have to be checked rather than one standing in for the other.
|
|
102
|
+
*/
|
|
103
|
+
const ownsStore = Boolean(storeId && session.user?.storeId === storeId);
|
|
104
|
+
/*
|
|
105
|
+
* 🛑 `isAdmin` is its OWN term, not folded into `useIsOwner`.
|
|
106
|
+
*
|
|
107
|
+
* `useIsOwner` early-returns `false` when `resourceOwnerId` is falsy — BEFORE
|
|
108
|
+
* it checks admin — so for a record with no owner at all it denies admins
|
|
109
|
+
* too. Categories, brands, franchises, carousel slides and homepage sections
|
|
110
|
+
* have no `ownerId`, and those are precisely the collections an admin needs
|
|
111
|
+
* this toolbar on. Relying on `useIsOwner` alone would have hidden it from
|
|
112
|
+
* the only person who can edit them.
|
|
113
|
+
*/
|
|
114
|
+
if (!isAdmin && !isOwnerOrAdmin && !ownsStore)
|
|
115
|
+
return null;
|
|
116
|
+
const editDef = bucket.edit;
|
|
117
|
+
const deleteDef = bucket.delete;
|
|
118
|
+
const confirmation = deleteDef?.confirmation;
|
|
119
|
+
const showClone = Boolean(onClone) && isAdmin;
|
|
120
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Row, { gap: "xs", align: "center", className: className,
|
|
121
|
+
/*
|
|
122
|
+
* Stops the click reaching an ancestor `<Link>` or the card's own
|
|
123
|
+
* `onClick`. Without it, pressing Edit on a card both navigates to the
|
|
124
|
+
* editor AND opens the public detail page behind it.
|
|
125
|
+
*/
|
|
126
|
+
onClick: (e) => {
|
|
127
|
+
e.stopPropagation();
|
|
128
|
+
}, children: [_jsx(IconButton, { "aria-label": editDef?.ariaLabel ?? editDef?.label ?? "Edit", size: "touch", variant: placement === "card" ? "scrim" : "ghost", icon: _jsx(Icon, { name: "edit" }), onClick: () => {
|
|
129
|
+
/*
|
|
130
|
+
* `window.location`, not `next/link`. This component is rendered
|
|
131
|
+
* inside cards whose whole body is already an anchor, and nesting
|
|
132
|
+
* an `<a>` in an `<a>` is invalid HTML that browsers resolve by
|
|
133
|
+
* closing the outer one early — which breaks the card's own
|
|
134
|
+
* navigation, not just this button's.
|
|
135
|
+
*/
|
|
136
|
+
if (typeof window !== "undefined")
|
|
137
|
+
window.location.assign(editHref);
|
|
138
|
+
} }), showClone && (_jsx(IconButton, { "aria-label": (bucket.duplicate?.ariaLabel ?? bucket.duplicate?.label) ||
|
|
139
|
+
"Duplicate", size: "touch", variant: placement === "card" ? "scrim" : "ghost", icon: _jsx(Icon, { name: "duplicate" }), onClick: () => void onClone?.() })), onDelete && (_jsx(IconButton, { "aria-label": deleteDef?.ariaLabel ?? deleteDef?.label ?? "Delete", size: "touch", variant: placement === "card" ? "scrim" : "danger", icon: _jsx(Icon, { name: "delete" }), onClick: () => setConfirmOpen(true) }))] }), onDelete && (_jsx(ConfirmDeleteModal, { isOpen: confirmOpen, onClose: () => setConfirmOpen(false), onConfirm: handleConfirmedDelete, isDeleting: deleting, title: confirmation?.title ?? "Delete this record?", message: recordLabel && confirmation
|
|
140
|
+
? `${confirmation.body}\n\nDeleting: ${recordLabel}`
|
|
141
|
+
: confirmation?.body, confirmText: confirmation?.confirmLabel ?? deleteDef?.label ?? "Delete", variant: "danger" }))] }));
|
|
142
|
+
}
|
|
@@ -179,10 +179,19 @@ export const DEFAULT_WELCOME_BUILDER = {
|
|
|
179
179
|
export const DEFAULT_TRUST_INDICATORS_BUILDER = {
|
|
180
180
|
title: "Why LetItRip?",
|
|
181
181
|
indicators: [
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
/*
|
|
183
|
+
* 🛑 `icon` holds an IconKey, not an emoji.
|
|
184
|
+
*
|
|
185
|
+
* These shipped "🚚" / "🔒" / "✅" / "↩️", which the component used only as
|
|
186
|
+
* a React key — every tile rendered the same hardcoded ✓ regardless. Now
|
|
187
|
+
* that `resolveTrustIcon` reads the field, an emoji resolves to nothing and
|
|
188
|
+
* the tile would render text-only, so a default that creates a correct
|
|
189
|
+
* section has to carry real keys. See trust-icon-aliases.ts.
|
|
190
|
+
*/
|
|
191
|
+
{ id: "ti-1", icon: "ship", title: "Free Shipping", description: "On orders above ₹999" },
|
|
192
|
+
{ id: "ti-2", icon: "lock", title: "Secure Payment", description: "Protected checkout" },
|
|
193
|
+
{ id: "ti-3", icon: "verify", title: LABEL_VERIFIED_SELLERS, description: "Every store is manually verified" },
|
|
194
|
+
{ id: "ti-4", icon: "restore", title: "Easy Returns", description: "7-day hassle-free returns" },
|
|
186
195
|
],
|
|
187
196
|
};
|
|
188
197
|
export const DEFAULT_CATEGORIES_BUILDER = {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PaginatedSelectOption } from "../../../../ui/components/PaginatedSelect";
|
|
2
|
+
/**
|
|
3
|
+
* Every valid icon key, as options for the section builders.
|
|
4
|
+
*
|
|
5
|
+
* ## 🛑 Why a picker and not the free-text input this replaces
|
|
6
|
+
*
|
|
7
|
+
* The trust-indicator icon field was `<Input label="Icon (emoji or text)">`,
|
|
8
|
+
* and "+ Add indicator" seeded it with `"✨"`. Both were honest while the value
|
|
9
|
+
* had no reader — the component used `icon` only as a React key and rendered a
|
|
10
|
+
* hardcoded `✓` regardless. Now that `resolveTrustIcon` reads it, a free-text
|
|
11
|
+
* value that is not a registry key resolves to `undefined` and the tile renders
|
|
12
|
+
* with no icon at all: a silent blank, authored through a field that accepted
|
|
13
|
+
* it without complaint.
|
|
14
|
+
*
|
|
15
|
+
* Rule #9 also applies on its own terms — 56 options is well past the 5 above
|
|
16
|
+
* which a selection must use `<PaginatedSelect>` rather than a bare input.
|
|
17
|
+
*
|
|
18
|
+
* The keys are intent words (`verify`, `restore`, `ship`, `lock`), so the key
|
|
19
|
+
* IS the label; there is no separate display string to keep in sync.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ICON_KEY_OPTIONS: PaginatedSelectOption<string>[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ICONS } from "../../../../ui/icons/icon-registry.js";
|
|
2
|
+
/**
|
|
3
|
+
* Every valid icon key, as options for the section builders.
|
|
4
|
+
*
|
|
5
|
+
* ## 🛑 Why a picker and not the free-text input this replaces
|
|
6
|
+
*
|
|
7
|
+
* The trust-indicator icon field was `<Input label="Icon (emoji or text)">`,
|
|
8
|
+
* and "+ Add indicator" seeded it with `"✨"`. Both were honest while the value
|
|
9
|
+
* had no reader — the component used `icon` only as a React key and rendered a
|
|
10
|
+
* hardcoded `✓` regardless. Now that `resolveTrustIcon` reads it, a free-text
|
|
11
|
+
* value that is not a registry key resolves to `undefined` and the tile renders
|
|
12
|
+
* with no icon at all: a silent blank, authored through a field that accepted
|
|
13
|
+
* it without complaint.
|
|
14
|
+
*
|
|
15
|
+
* Rule #9 also applies on its own terms — 56 options is well past the 5 above
|
|
16
|
+
* which a selection must use `<PaginatedSelect>` rather than a bare input.
|
|
17
|
+
*
|
|
18
|
+
* The keys are intent words (`verify`, `restore`, `ship`, `lock`), so the key
|
|
19
|
+
* IS the label; there is no separate display string to keep in sync.
|
|
20
|
+
*/
|
|
21
|
+
export const ICON_KEY_OPTIONS = Object.keys(ICONS)
|
|
22
|
+
.sort()
|
|
23
|
+
.map((key) => ({ value: key, label: key }));
|
|
@@ -133,7 +133,10 @@ export const SECTION_TEMPLATES = [
|
|
|
133
133
|
title: "",
|
|
134
134
|
indicators: [
|
|
135
135
|
{ id: "trust-originals", icon: "shield-check", title: "Authenticity, labelled", description: "Original, reproduction or unverified on every listing — never a silent claim." },
|
|
136
|
-
|
|
136
|
+
// No "escrow" here either — see the trust bar in homepage-sections-seed-data.ts.
|
|
137
|
+
// A TEMPLATE is a claim an admin inserts with one click and is unlikely
|
|
138
|
+
// to re-read, so a withdrawn claim left in a template comes back by itself.
|
|
139
|
+
{ id: "trust-escrow", icon: "lock", title: "Money held until delivery", description: "Payment reaches the seller after delivery, so a claim is settled from funds still with us." },
|
|
137
140
|
{ id: "trust-india", icon: "truck", title: "India-wide shipping", description: "Delhivery, Blue Dart, DTDC and India Post, with tracking on every order." },
|
|
138
141
|
{ id: "trust-rare", icon: "search", title: "Rare and pre-owned", description: "Four generations of Beyblade, including the lines that are long out of production." },
|
|
139
142
|
],
|
|
@@ -76,38 +76,33 @@ export declare const SITE_SETTINGS_TABS: readonly [{
|
|
|
76
76
|
readonly label: "⑫ Legal";
|
|
77
77
|
readonly description: "Terms, privacy policy, refund policy and the GST registration details.";
|
|
78
78
|
readonly keywords: ["terms", "privacy", "policy", "gstin", "refund policy", "compliance"];
|
|
79
|
-
}, {
|
|
80
|
-
readonly id: "whatsapp";
|
|
81
|
-
readonly label: "⑬ WhatsApp";
|
|
82
|
-
readonly description: "WhatsApp Business credentials and which messages go out over it.";
|
|
83
|
-
readonly keywords: ["whatsapp", "meta", "business api", "order updates"];
|
|
84
79
|
}, {
|
|
85
80
|
readonly id: "notifications";
|
|
86
|
-
readonly label: "
|
|
87
|
-
readonly description: "Which channels are on — email
|
|
81
|
+
readonly label: "⑬ Notifications";
|
|
82
|
+
readonly description: "Which channels are on — email and SMS — and the daily digest.";
|
|
88
83
|
readonly keywords: ["email", "sms", "alerts", "digest", "notify"];
|
|
89
84
|
}, {
|
|
90
85
|
readonly id: "procurement";
|
|
91
|
-
readonly label: "
|
|
86
|
+
readonly label: "⑭ Procurement";
|
|
92
87
|
readonly description: "Labour rate and the defaults used to price inbound shipments.";
|
|
93
88
|
readonly keywords: ["labour rate", "labor", "import", "landed cost", "supplier"];
|
|
94
89
|
}, {
|
|
95
90
|
readonly id: "emi";
|
|
96
|
-
readonly label: "
|
|
91
|
+
readonly label: "⑮ EMI";
|
|
97
92
|
readonly description: "Instalment plans: eligibility threshold, tenures and the surcharge split.";
|
|
98
93
|
readonly keywords: ["instalments", "installments", "emi", "pay monthly", "finance"];
|
|
99
94
|
}, {
|
|
100
95
|
readonly id: "gst";
|
|
101
|
-
readonly label: "
|
|
96
|
+
readonly label: "⑯ GST";
|
|
102
97
|
readonly description: "GST rates, HSN defaults and the registered business details.";
|
|
103
98
|
readonly keywords: ["tax", "gst", "hsn", "vat", "invoice tax"];
|
|
104
99
|
}, {
|
|
105
100
|
readonly id: "listings";
|
|
106
|
-
readonly label: "
|
|
101
|
+
readonly label: "⑰ Listings";
|
|
107
102
|
readonly description: "Which listing types sellers may create, and their defaults.";
|
|
108
103
|
readonly keywords: ["listing types", "auctions on", "enable", "categories"];
|
|
109
104
|
}];
|
|
110
|
-
export declare const SITE_SETTINGS_TAB_IDS: ("about" | "shipping" | "notifications" | "contact" | "auction" | "seo" | "listings" | "appearance" | "emi" | "gst" | "watermark" | "integrations" | "limits" | "announcement" | "
|
|
105
|
+
export declare const SITE_SETTINGS_TAB_IDS: ("about" | "shipping" | "notifications" | "contact" | "auction" | "seo" | "listings" | "appearance" | "emi" | "gst" | "watermark" | "integrations" | "limits" | "announcement" | "branding" | "themes" | "fees" | "legal" | "procurement")[];
|
|
111
106
|
/**
|
|
112
107
|
* The union `?tab=` is validated against.
|
|
113
108
|
*
|
|
@@ -108,39 +108,33 @@ export const SITE_SETTINGS_TABS = [
|
|
|
108
108
|
description: "Terms, privacy policy, refund policy and the GST registration details.",
|
|
109
109
|
keywords: ["terms", "privacy", "policy", "gstin", "refund policy", "compliance"],
|
|
110
110
|
},
|
|
111
|
-
{
|
|
112
|
-
id: "whatsapp",
|
|
113
|
-
label: "⑬ WhatsApp",
|
|
114
|
-
description: "WhatsApp Business credentials and which messages go out over it.",
|
|
115
|
-
keywords: ["whatsapp", "meta", "business api", "order updates"],
|
|
116
|
-
},
|
|
117
111
|
{
|
|
118
112
|
id: "notifications",
|
|
119
|
-
label: "
|
|
120
|
-
description: "Which channels are on — email
|
|
113
|
+
label: "⑬ Notifications",
|
|
114
|
+
description: "Which channels are on — email and SMS — and the daily digest.",
|
|
121
115
|
keywords: ["email", "sms", "alerts", "digest", "notify"],
|
|
122
116
|
},
|
|
123
117
|
{
|
|
124
118
|
id: "procurement",
|
|
125
|
-
label: "
|
|
119
|
+
label: "⑭ Procurement",
|
|
126
120
|
description: "Labour rate and the defaults used to price inbound shipments.",
|
|
127
121
|
keywords: ["labour rate", "labor", "import", "landed cost", "supplier"],
|
|
128
122
|
},
|
|
129
123
|
{
|
|
130
124
|
id: "emi",
|
|
131
|
-
label: "
|
|
125
|
+
label: "⑮ EMI",
|
|
132
126
|
description: "Instalment plans: eligibility threshold, tenures and the surcharge split.",
|
|
133
127
|
keywords: ["instalments", "installments", "emi", "pay monthly", "finance"],
|
|
134
128
|
},
|
|
135
129
|
{
|
|
136
130
|
id: "gst",
|
|
137
|
-
label: "
|
|
131
|
+
label: "⑯ GST",
|
|
138
132
|
description: "GST rates, HSN defaults and the registered business details.",
|
|
139
133
|
keywords: ["tax", "gst", "hsn", "vat", "invoice tax"],
|
|
140
134
|
},
|
|
141
135
|
{
|
|
142
136
|
id: "listings",
|
|
143
|
-
label: "
|
|
137
|
+
label: "⑰ Listings",
|
|
144
138
|
description: "Which listing types sellers may create, and their defaults.",
|
|
145
139
|
keywords: ["listing types", "auctions on", "enable", "categories"],
|
|
146
140
|
},
|
|
@@ -83,7 +83,7 @@ export class SiteSettingsRepository extends BaseRepository {
|
|
|
83
83
|
encrypted[key] = encryptSecret(value.trim());
|
|
84
84
|
}
|
|
85
85
|
else if (value !== undefined && typeof value !== "string") {
|
|
86
|
-
// Non-string credential fields (e.g.
|
|
86
|
+
// Non-string credential fields (e.g. a nested Record<string,string>)
|
|
87
87
|
// are stored as-is — they are not secret values to encrypt.
|
|
88
88
|
encrypted[key] = value;
|
|
89
89
|
}
|
|
@@ -12,7 +12,7 @@ export declare const adminStoreUpdateSchema: z.ZodEffects<z.ZodObject<{
|
|
|
12
12
|
isVerified: z.ZodOptional<z.ZodBoolean>;
|
|
13
13
|
isFeatured: z.ZodOptional<z.ZodBoolean>;
|
|
14
14
|
suspensionReason: z.ZodOptional<z.ZodString>;
|
|
15
|
-
capabilities: z.ZodOptional<z.ZodArray<z.
|
|
15
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<[string, ...string[]]>, "many">>;
|
|
16
16
|
adminNotes: z.ZodOptional<z.ZodString>;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
18
|
storeStatus: StoreStatus;
|
|
@@ -29,6 +29,7 @@ import { z } from "zod";
|
|
|
29
29
|
import { annotate } from "../../shell/field-ui-meta.js";
|
|
30
30
|
import { mediaUrlSchema } from "../../../validation/schemas.js";
|
|
31
31
|
import { StoreStatusValues } from "../../stores/schemas/firestore.js";
|
|
32
|
+
import { ALL_STORE_CAPABILITIES } from "../../auth/permissions/constants.js";
|
|
32
33
|
const PHONE_RE = /^(\+?91[-\s]?)?[6-9]\d{9}$/;
|
|
33
34
|
/*
|
|
34
35
|
* `adminAddressFormSchema` is DELETED (W5 / D19).
|
|
@@ -84,7 +85,9 @@ export const adminStoreUpdateSchema = z
|
|
|
84
85
|
section: "standing", order: 4, row: "full", kind: "textarea",
|
|
85
86
|
when: (v) => v.storeStatus === "suspended",
|
|
86
87
|
}),
|
|
87
|
-
|
|
88
|
+
// 🛑 z.enum, not z.string().min(1) — see storeFirestoreSchema. A typo'd
|
|
89
|
+
// capability used to save cleanly and grant nothing.
|
|
90
|
+
capabilities: annotate(z.array(z.enum(ALL_STORE_CAPABILITIES)).max(50).optional(), {
|
|
88
91
|
section: "capabilities", sectionLabel: "Capabilities", order: 1, row: "full", kind: "list",
|
|
89
92
|
}),
|
|
90
93
|
adminNotes: annotate(z.string().trim().max(2000).optional(), {
|
|
@@ -65,67 +65,6 @@ export declare function toPublicProfilePayload(v: {
|
|
|
65
65
|
linkedin?: string;
|
|
66
66
|
}): Record<string, JsonValue> | undefined;
|
|
67
67
|
export type AdminUserUpdateValues = z.infer<typeof adminUserUpdateSchema>;
|
|
68
|
-
/**
|
|
69
|
-
* A store's WhatsApp Business connection.
|
|
70
|
-
*
|
|
71
|
-
* `accessToken` is optional because the form shows a masked placeholder and
|
|
72
|
-
* only sends the field when the seller types a NEW value — so "absent" means
|
|
73
|
-
* "unchanged", not "clear it". The `.min(20)` therefore applies only to a real
|
|
74
|
-
* replacement, and is there because a truncated token fails silently at sync
|
|
75
|
-
* time rather than on save.
|
|
76
|
-
*/
|
|
77
|
-
export declare const whatsappSettingsSchema: z.ZodObject<{
|
|
78
|
-
catalogSyncEnabled: z.ZodBoolean;
|
|
79
|
-
phoneNumber: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
80
|
-
wabaId: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
81
|
-
catalogId: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
82
|
-
accessToken: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
83
|
-
}, "strip", z.ZodTypeAny, {
|
|
84
|
-
catalogSyncEnabled: boolean;
|
|
85
|
-
phoneNumber?: string | undefined;
|
|
86
|
-
accessToken?: string | undefined;
|
|
87
|
-
wabaId?: string | undefined;
|
|
88
|
-
catalogId?: string | undefined;
|
|
89
|
-
}, {
|
|
90
|
-
catalogSyncEnabled: boolean;
|
|
91
|
-
phoneNumber?: string | undefined;
|
|
92
|
-
accessToken?: string | undefined;
|
|
93
|
-
wabaId?: string | undefined;
|
|
94
|
-
catalogId?: string | undefined;
|
|
95
|
-
}>;
|
|
96
|
-
export type WhatsappSettingsValues = z.infer<typeof whatsappSettingsSchema>;
|
|
97
|
-
/**
|
|
98
|
-
* The CONNECTION form's fields — credentials only.
|
|
99
|
-
*
|
|
100
|
-
* `catalogSyncEnabled` is deliberately absent. Its toggle lives in a different
|
|
101
|
-
* card and owns its own write (`syncToggleMutation`), because the credentials
|
|
102
|
-
* form used to send it unconditionally from two cards away: a seller flipped
|
|
103
|
-
* the switch, saw it move, and nothing persisted it. A field in this schema is
|
|
104
|
-
* a field this form's Save button owns.
|
|
105
|
-
*
|
|
106
|
-
* 🛑 `.omit()` rather than a second literal, so the two cannot drift — it
|
|
107
|
-
* carries the SAME field instances into the new shape, which is what keeps the
|
|
108
|
-
* `annotate()` WeakMap entries alive. (A wrapper such as `.superRefine()` is
|
|
109
|
-
* transparent for the same reason; a field-level re-wrap is not.)
|
|
110
|
-
*/
|
|
111
|
-
export declare const whatsappConnectionSchema: z.ZodObject<Omit<{
|
|
112
|
-
catalogSyncEnabled: z.ZodBoolean;
|
|
113
|
-
phoneNumber: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
114
|
-
wabaId: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
115
|
-
catalogId: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
116
|
-
accessToken: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
117
|
-
}, "catalogSyncEnabled">, "strip", z.ZodTypeAny, {
|
|
118
|
-
phoneNumber?: string | undefined;
|
|
119
|
-
accessToken?: string | undefined;
|
|
120
|
-
wabaId?: string | undefined;
|
|
121
|
-
catalogId?: string | undefined;
|
|
122
|
-
}, {
|
|
123
|
-
phoneNumber?: string | undefined;
|
|
124
|
-
accessToken?: string | undefined;
|
|
125
|
-
wabaId?: string | undefined;
|
|
126
|
-
catalogId?: string | undefined;
|
|
127
|
-
}>;
|
|
128
|
-
export type WhatsappConnectionValues = z.infer<typeof whatsappConnectionSchema>;
|
|
129
68
|
/**
|
|
130
69
|
* A buyer's lottery entry.
|
|
131
70
|
*
|
|
@@ -8,24 +8,20 @@
|
|
|
8
8
|
* false, and saving any unrelated field silently stripped a real
|
|
9
9
|
* tester's access.
|
|
10
10
|
*
|
|
11
|
-
* `SellerWhatsAppSettingsView` writes `accessToken` — a live Meta
|
|
12
|
-
* credential — plus the WABA and catalog ids the sync runs against. A
|
|
13
|
-
* malformed id there fails at sync time, hours later, with no obvious
|
|
14
|
-
* cause.
|
|
15
11
|
*
|
|
16
12
|
* `LotteryPullForm` is a buyer-facing entry: a transaction id, a payment
|
|
17
13
|
* time and an item number, all parsed with a bare `parseInt` and a `new
|
|
18
14
|
* Date(...)` that yields `Invalid Date` on anything unparseable.
|
|
19
15
|
*
|
|
20
16
|
* EXPORTS:
|
|
21
|
-
* adminUserUpdateSchema,
|
|
17
|
+
* adminUserUpdateSchema, lotteryPullSchema,
|
|
22
18
|
* and their inferred value types
|
|
23
19
|
*
|
|
24
|
-
* @tag domain:admin,
|
|
20
|
+
* @tag domain:admin,lottery
|
|
25
21
|
* @tag layer:schema
|
|
26
22
|
* @tag pattern:none
|
|
27
23
|
* @tag access:isomorphic
|
|
28
|
-
* @tag consumers:AdminUserEditorView,
|
|
24
|
+
* @tag consumers:AdminUserEditorView,LotteryPullForm
|
|
29
25
|
* @tag sideEffects:none
|
|
30
26
|
*/
|
|
31
27
|
import { z } from "zod";
|
|
@@ -131,43 +127,6 @@ export function toPublicProfilePayload(v) {
|
|
|
131
127
|
publicProfile.socialLinks = socialLinks;
|
|
132
128
|
return Object.keys(publicProfile).length > 0 ? publicProfile : undefined;
|
|
133
129
|
}
|
|
134
|
-
/**
|
|
135
|
-
* A store's WhatsApp Business connection.
|
|
136
|
-
*
|
|
137
|
-
* `accessToken` is optional because the form shows a masked placeholder and
|
|
138
|
-
* only sends the field when the seller types a NEW value — so "absent" means
|
|
139
|
-
* "unchanged", not "clear it". The `.min(20)` therefore applies only to a real
|
|
140
|
-
* replacement, and is there because a truncated token fails silently at sync
|
|
141
|
-
* time rather than on save.
|
|
142
|
-
*/
|
|
143
|
-
export const whatsappSettingsSchema = z.object({
|
|
144
|
-
catalogSyncEnabled: annotate(z.boolean(), {
|
|
145
|
-
section: "sync", sectionLabel: "Catalog sync", sectionRequired: true, quick: true, order: 1, row: "quarter",
|
|
146
|
-
}),
|
|
147
|
-
phoneNumber: annotate(z.string().trim().regex(PHONE_RE, "Enter the 10-digit WhatsApp Business number.").optional().or(z.literal("")), { section: "connection", sectionLabel: "Connection", order: 1, row: "pair" }),
|
|
148
|
-
// Meta ids are numeric strings; a pasted URL or a stray space is the usual
|
|
149
|
-
// mistake and produces a sync that never runs.
|
|
150
|
-
wabaId: annotate(z.string().trim().regex(/^\d{5,32}$/, "A WABA ID is a numeric id, not a URL.").optional().or(z.literal("")), { section: "connection", order: 2, row: "pair" }),
|
|
151
|
-
catalogId: annotate(z.string().trim().regex(/^\d{5,32}$/, "A catalog ID is a numeric id, not a URL.").optional().or(z.literal("")), { section: "connection", order: 3, row: "pair" }),
|
|
152
|
-
accessToken: annotate(z.string().trim().min(20, "That access token looks truncated.").optional().or(z.literal("")), { section: "connection", order: 4, row: "full", help: "Leave blank to keep the current token." }),
|
|
153
|
-
});
|
|
154
|
-
/**
|
|
155
|
-
* The CONNECTION form's fields — credentials only.
|
|
156
|
-
*
|
|
157
|
-
* `catalogSyncEnabled` is deliberately absent. Its toggle lives in a different
|
|
158
|
-
* card and owns its own write (`syncToggleMutation`), because the credentials
|
|
159
|
-
* form used to send it unconditionally from two cards away: a seller flipped
|
|
160
|
-
* the switch, saw it move, and nothing persisted it. A field in this schema is
|
|
161
|
-
* a field this form's Save button owns.
|
|
162
|
-
*
|
|
163
|
-
* 🛑 `.omit()` rather than a second literal, so the two cannot drift — it
|
|
164
|
-
* carries the SAME field instances into the new shape, which is what keeps the
|
|
165
|
-
* `annotate()` WeakMap entries alive. (A wrapper such as `.superRefine()` is
|
|
166
|
-
* transparent for the same reason; a field-level re-wrap is not.)
|
|
167
|
-
*/
|
|
168
|
-
export const whatsappConnectionSchema = whatsappSettingsSchema.omit({
|
|
169
|
-
catalogSyncEnabled: true,
|
|
170
|
-
});
|
|
171
130
|
/**
|
|
172
131
|
* A buyer's lottery entry.
|
|
173
132
|
*
|