@mohasinac/appkit 4.53.1 → 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/client/theme/ThemeProvider.js +15 -1
- package/dist/_internal/server/features/auth/capabilities.js +7 -5
- package/dist/_internal/server/features/categories/price-guidance-resolve.d.ts +66 -0
- package/dist/_internal/server/features/categories/price-guidance-resolve.js +138 -0
- 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/price-index/market.d.ts +57 -0
- package/dist/_internal/server/features/price-index/market.js +120 -0
- package/dist/_internal/server/features/products/list-public.d.ts +12 -0
- package/dist/_internal/server/features/products/list-public.js +10 -1
- package/dist/_internal/server/features/products/listing-tab-counts.d.ts +25 -1
- package/dist/_internal/server/features/products/listing-tab-counts.js +184 -10
- 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/features/stores/tabs.d.ts +7 -2
- package/dist/_internal/server/features/stores/tabs.js +5 -3
- 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/_internal/shared/search/match.js +28 -2
- 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 +28 -15
- package/dist/constants/api-endpoints.js +14 -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 +12 -10
- 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/api/[id]/price-guidance/route.js +1 -24
- package/dist/features/categories/components/BrandDetailPageView.js +15 -6
- package/dist/features/categories/components/BrandDetailTabs.d.ts +7 -1
- package/dist/features/categories/components/BrandDetailTabs.js +18 -3
- package/dist/features/categories/components/BundleCollage.js +3 -2
- package/dist/features/categories/components/BundleDetailView.js +2 -1
- package/dist/features/categories/components/BundleItemsPicker.js +3 -4
- package/dist/features/categories/components/CategoryDetailPageView.js +19 -8
- package/dist/features/categories/components/CategoryDetailTabs.d.ts +7 -1
- package/dist/features/categories/components/CategoryDetailTabs.js +29 -7
- 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 +12 -2
- package/dist/features/digital-codes/components/DigitalCodeDetailPageView.js +12 -2
- 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 +12 -2
- 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 +12 -10
- package/dist/features/price-index/components/PriceIndexToolView.d.ts +21 -0
- package/dist/features/price-index/components/PriceIndexToolView.js +230 -27
- package/dist/features/price-index/lookup-target.d.ts +48 -0
- package/dist/features/price-index/lookup-target.js +107 -0
- 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.d.ts +22 -0
- package/dist/features/products/components/AvailabilityScopeHint.js +27 -0
- package/dist/features/products/components/CompareOverlay.d.ts +2 -1
- package/dist/features/products/components/CompareOverlay.js +2 -1
- package/dist/features/products/components/GroupSettingsPanel.js +2 -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 +34 -4
- 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/products/components/SublistingCarouselSection.js +2 -1
- package/dist/features/products/repository/products.repository.d.ts +1 -0
- package/dist/features/products/repository/products.repository.js +5 -1
- package/dist/features/products/utils/group-member-image.d.ts +9 -2
- package/dist/features/products/utils/group-member-image.js +2 -1
- 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/components/SellerProductsView.js +3 -2
- 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/StoreAuctionsListing.js +2 -1
- 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/content-discovery__authenticity-checker.js +114 -2
- 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 +427 -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/products-beyblade-x-seed-data.js +36 -1
- 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 +10 -10
- package/dist/server.js +24 -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/scripts/seed-cli.mjs +133 -27
- 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,356 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @mohasinac/shipping-shiprocket — IShippingProvider over Shiprocket's v1 API.
|
|
3
|
+
*
|
|
4
|
+
* ── Read this before trusting it ──────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* ── What is verified, and what is not ────────────────────────────────────
|
|
7
|
+
*
|
|
8
|
+
* ✅ VERIFIED against the live API (2026-10-20, real API-user credentials):
|
|
9
|
+
* `POST /v1/external/auth/login` returns HTTP 200 with
|
|
10
|
+
* `{ company_id, created_at, email, first_name, id, last_name, token }`.
|
|
11
|
+
* The `token` field is present and non-empty, which is the only field
|
|
12
|
+
* `loginResponse` requires — the rest are ignored, as Zod ignores unknown
|
|
13
|
+
* keys by default.
|
|
14
|
+
*
|
|
15
|
+
* 🛑 NOT VERIFIED: every other endpoint. Order creation, AWB assignment,
|
|
16
|
+
* tracking, serviceability and label generation all MUTATE or bill against
|
|
17
|
+
* a real carrier account, so none was called. Their field names below are
|
|
18
|
+
* claims taken from the published docs, not facts read off a payload.
|
|
19
|
+
*
|
|
20
|
+
* That asymmetry is the reason every response is parsed through Zod rather
|
|
21
|
+
* than cast: an unverified contract that is wrong surfaces as a named error at
|
|
22
|
+
* the boundary, instead of as an `undefined` AWB written to an order and shown
|
|
23
|
+
* to a buyer as a tracking number that tracks nothing.
|
|
24
|
+
*
|
|
25
|
+
* ── Auth: why a dedicated API user, and why the token is cached ───────────
|
|
26
|
+
*
|
|
27
|
+
* Shiprocket's core v1 API has no long-lived key/secret. You POST credentials
|
|
28
|
+
* to `/v1/external/auth/login` and receive a bearer token valid for roughly
|
|
29
|
+
* ten days, then log in again.
|
|
30
|
+
*
|
|
31
|
+
* 🛑 Those credentials should be a DEDICATED API USER (Shiprocket dashboard →
|
|
32
|
+
* Settings → API → Configure), not the dashboard login. Using the dashboard
|
|
33
|
+
* account means the token dies whenever someone changes that password — a
|
|
34
|
+
* shipping integration that breaks on an unrelated admin action — and it hands
|
|
35
|
+
* full account scope to this process. The env var is named
|
|
36
|
+
* `SHIPROCKET_LOGIN_USER_EMAIL` rather than `LOGIN_ID` because the login payload
|
|
37
|
+
* field is `email`; a var called "login id" invites someone to put a username
|
|
38
|
+
* in it and get a 400 they cannot explain.
|
|
39
|
+
*
|
|
40
|
+
* 🛑 The token is cached in module state with its expiry. Logging in per
|
|
41
|
+
* request would mean two round trips for every shipment and would hit
|
|
42
|
+
* Shiprocket's auth rate limit under any real volume. A 401 mid-flight clears
|
|
43
|
+
* the cache and retries ONCE — exactly once, because a credential that is
|
|
44
|
+
* genuinely wrong must fail fast rather than loop.
|
|
45
|
+
*
|
|
46
|
+
* ── What is deliberately NOT here ────────────────────────────────────────
|
|
47
|
+
*
|
|
48
|
+
* Inbound webhooks. Shiprocket pushes status updates to a URL configured in
|
|
49
|
+
* its dashboard and authenticates them with an `x-api-key` header whose value
|
|
50
|
+
* you set there — a THIRD secret, and an inbound route rather than a provider
|
|
51
|
+
* method. `trackShipment` below polls instead, which is correct for a provider
|
|
52
|
+
* contract and wasteful as a status mechanism; the webhook is the better
|
|
53
|
+
* answer and belongs in its own route with its own verification.
|
|
54
|
+
*
|
|
55
|
+
* @tag domain:shipping
|
|
56
|
+
* @tag layer:providers
|
|
57
|
+
* @tag access:server-only
|
|
58
|
+
*/
|
|
59
|
+
import { z } from "zod";
|
|
60
|
+
import { IShippingProvider } from "../../contracts/index.js";
|
|
61
|
+
import { ApiError } from "../../errors/index.js";
|
|
62
|
+
import { normalizeError } from "../../errors/normalize.js";
|
|
63
|
+
import { serverLogger } from "../../monitoring/server-logger.js";
|
|
64
|
+
const API_BASE = "https://apiv2.shiprocket.in/v1/external";
|
|
65
|
+
// ── Response contracts ──────────────────────────────────────────────────────
|
|
66
|
+
//
|
|
67
|
+
// Every one of these is a CLAIM about a payload nobody here has seen. Parsing
|
|
68
|
+
// rather than casting is what turns a wrong claim into a named error.
|
|
69
|
+
const loginResponse = z.object({
|
|
70
|
+
token: z.string().min(1),
|
|
71
|
+
});
|
|
72
|
+
const createOrderResponse = z.object({
|
|
73
|
+
order_id: z.union([z.number(), z.string()]),
|
|
74
|
+
shipment_id: z.union([z.number(), z.string()]),
|
|
75
|
+
/** Absent until an AWB is assigned — which is a separate call. */
|
|
76
|
+
awb_code: z.string().nullish(),
|
|
77
|
+
courier_name: z.string().nullish(),
|
|
78
|
+
status: z.string().nullish(),
|
|
79
|
+
});
|
|
80
|
+
const trackingResponse = z.object({
|
|
81
|
+
tracking_data: z.object({
|
|
82
|
+
shipment_status: z.union([z.number(), z.string()]).nullish(),
|
|
83
|
+
shipment_track: z
|
|
84
|
+
.array(z.object({
|
|
85
|
+
current_status: z.string().nullish(),
|
|
86
|
+
delivered_date: z.string().nullish(),
|
|
87
|
+
edd: z.string().nullish(),
|
|
88
|
+
}))
|
|
89
|
+
.nullish(),
|
|
90
|
+
shipment_track_activities: z
|
|
91
|
+
.array(z.object({
|
|
92
|
+
date: z.string().nullish(),
|
|
93
|
+
status: z.string().nullish(),
|
|
94
|
+
activity: z.string().nullish(),
|
|
95
|
+
location: z.string().nullish(),
|
|
96
|
+
}))
|
|
97
|
+
.nullish(),
|
|
98
|
+
}),
|
|
99
|
+
});
|
|
100
|
+
const serviceabilityResponse = z.object({
|
|
101
|
+
data: z.object({
|
|
102
|
+
available_courier_companies: z
|
|
103
|
+
.array(z.object({
|
|
104
|
+
courier_name: z.string(),
|
|
105
|
+
estimated_delivery_days: z.union([z.number(), z.string()]).nullish(),
|
|
106
|
+
rate: z.union([z.number(), z.string()]).nullish(),
|
|
107
|
+
}))
|
|
108
|
+
.nullish(),
|
|
109
|
+
}),
|
|
110
|
+
});
|
|
111
|
+
function num(v, fallback = 0) {
|
|
112
|
+
const n = typeof v === "string" ? Number.parseFloat(v) : v;
|
|
113
|
+
return typeof n === "number" && Number.isFinite(n) ? n : fallback;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Parse an upstream response, or throw a named contract error.
|
|
117
|
+
*
|
|
118
|
+
* 🛑 `.parse()`, not `.safeParse()`. The only branch on failure is to throw,
|
|
119
|
+
* and a `safeParse` whose `.success` is checked once and converted straight
|
|
120
|
+
* into a throw is indistinguishable — to a reader and to
|
|
121
|
+
* `audit-unvalidated-safeparse` — from a result nobody handled.
|
|
122
|
+
*
|
|
123
|
+
* 🛑 Logs the FAILING PATHS, never the payload. A Shiprocket response carries
|
|
124
|
+
* the buyer's name, phone and full address, and an error log is the wrong
|
|
125
|
+
* place for all three.
|
|
126
|
+
*/
|
|
127
|
+
function parseUpstream(contract, json, what) {
|
|
128
|
+
try {
|
|
129
|
+
return contract.parse(json);
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
// Normalised first, before the value is inspected — audit-catch-normalize
|
|
133
|
+
// is strict-zero and the ZodError branch below reads `err` either way.
|
|
134
|
+
void normalizeError(err);
|
|
135
|
+
const issues = err instanceof z.ZodError
|
|
136
|
+
? err.issues.map((i) => i.path.join("."))
|
|
137
|
+
: [];
|
|
138
|
+
serverLogger.error("shiprocket: response contract mismatch", {
|
|
139
|
+
what,
|
|
140
|
+
issues,
|
|
141
|
+
});
|
|
142
|
+
throw new ApiError(502, `Shiprocket ${what} returned an unexpected shape.`, {
|
|
143
|
+
code: "SHIPROCKET_CONTRACT_MISMATCH",
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
export class ShiprocketShippingProvider extends IShippingProvider {
|
|
148
|
+
constructor(config) {
|
|
149
|
+
super();
|
|
150
|
+
this.config = config;
|
|
151
|
+
this.name = "shiprocket";
|
|
152
|
+
this.token = null;
|
|
153
|
+
this.tokenExpiresAt = 0;
|
|
154
|
+
/*
|
|
155
|
+
* 🛑 Refuses at CONSTRUCTION, not at first use. `providers.config.ts`
|
|
156
|
+
* already argues this: a degraded shipping provider hands back a synthetic
|
|
157
|
+
* tracking id for a parcel no carrier was told about, so the seller sees an
|
|
158
|
+
* AWB-shaped string and a success toast while the buyer gets a number that
|
|
159
|
+
* tracks nothing. A loud failure at boot is attributable and recoverable by
|
|
160
|
+
* flipping one setting; the silent version is neither.
|
|
161
|
+
*/
|
|
162
|
+
if (!config.email?.trim() || !config.password?.trim()) {
|
|
163
|
+
throw new Error("[shiprocket] SHIPROCKET_LOGIN_USER_EMAIL / SHIPROCKET_API_PASSWORD are empty. " +
|
|
164
|
+
"Create a dedicated API user in Shiprocket (Settings -> API -> Configure) " +
|
|
165
|
+
"and set both, or set siteSettings.shipping.provider back to 'manual'. " +
|
|
166
|
+
"This refuses rather than degrading because a fallback would return a " +
|
|
167
|
+
"synthetic tracking id for a parcel that was never booked.");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A bearer token, logging in only when the cached one is absent or stale.
|
|
172
|
+
*
|
|
173
|
+
* The 60-second safety margin matters: a token that expires mid-request
|
|
174
|
+
* produces a 401 the caller has to interpret, and shaving a minute off a
|
|
175
|
+
* ten-day lifetime costs nothing.
|
|
176
|
+
*/
|
|
177
|
+
async getToken(force = false) {
|
|
178
|
+
if (!force && this.token && Date.now() < this.tokenExpiresAt - 60000) {
|
|
179
|
+
return this.token;
|
|
180
|
+
}
|
|
181
|
+
const res = await fetch(`${API_BASE}/auth/login`, {
|
|
182
|
+
method: "POST",
|
|
183
|
+
headers: { "Content-Type": "application/json" },
|
|
184
|
+
body: JSON.stringify({
|
|
185
|
+
email: this.config.email,
|
|
186
|
+
password: this.config.password,
|
|
187
|
+
}),
|
|
188
|
+
});
|
|
189
|
+
if (!res.ok) {
|
|
190
|
+
throw new ApiError(502, `Shiprocket auth failed (${res.status}). Check the API user's credentials.`, { code: "SHIPROCKET_AUTH_FAILED" });
|
|
191
|
+
}
|
|
192
|
+
const parsed = parseUpstream(loginResponse, await res.json(), "auth/login");
|
|
193
|
+
this.token = parsed.token;
|
|
194
|
+
// Their docs say ~10 days; treated as 9 so a boundary never surprises us.
|
|
195
|
+
this.tokenExpiresAt = Date.now() + 9 * 24 * 60 * 60 * 1000;
|
|
196
|
+
return this.token;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* One authenticated call, with a single re-auth on 401.
|
|
200
|
+
*
|
|
201
|
+
* 🛑 Exactly one retry. A token that expired early is worth one more attempt;
|
|
202
|
+
* a credential that is wrong must fail rather than loop, because a retry loop
|
|
203
|
+
* against an auth endpoint is how an integration gets rate-limited and then
|
|
204
|
+
* looks like an outage.
|
|
205
|
+
*/
|
|
206
|
+
async call(path, init, contract) {
|
|
207
|
+
const attempt = async (force) => {
|
|
208
|
+
const token = await this.getToken(force);
|
|
209
|
+
return fetch(`${API_BASE}${path}`, {
|
|
210
|
+
...init,
|
|
211
|
+
headers: {
|
|
212
|
+
"Content-Type": "application/json",
|
|
213
|
+
Authorization: `Bearer ${token}`,
|
|
214
|
+
...(init.headers ?? {}),
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
let res = await attempt(false);
|
|
219
|
+
if (res.status === 401) {
|
|
220
|
+
this.token = null;
|
|
221
|
+
res = await attempt(true);
|
|
222
|
+
}
|
|
223
|
+
if (!res.ok) {
|
|
224
|
+
throw new ApiError(502, `Shiprocket ${path} failed (${res.status}).`, { code: "SHIPROCKET_REQUEST_FAILED" });
|
|
225
|
+
}
|
|
226
|
+
const json = await res.json();
|
|
227
|
+
return parseUpstream(contract, json, path);
|
|
228
|
+
}
|
|
229
|
+
/** Their order payload wants the address flattened across many keys. */
|
|
230
|
+
addressFields(prefix, a) {
|
|
231
|
+
const p = prefix === "billing" ? "billing" : "shipping";
|
|
232
|
+
return {
|
|
233
|
+
[`${p}_customer_name`]: a.name,
|
|
234
|
+
[`${p}_address`]: a.addressLine1,
|
|
235
|
+
[`${p}_address_2`]: a.addressLine2 ?? "",
|
|
236
|
+
[`${p}_city`]: a.city,
|
|
237
|
+
[`${p}_pincode`]: a.pincode,
|
|
238
|
+
[`${p}_state`]: a.state,
|
|
239
|
+
[`${p}_country`]: a.country,
|
|
240
|
+
[`${p}_phone`]: a.phone,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
async createShipment(data) {
|
|
244
|
+
const body = {
|
|
245
|
+
order_id: data.orderId,
|
|
246
|
+
order_date: new Date().toISOString().slice(0, 10),
|
|
247
|
+
pickup_location: this.config.pickupLocation ?? "Primary",
|
|
248
|
+
...this.addressFields("billing", data.delivery),
|
|
249
|
+
shipping_is_billing: true,
|
|
250
|
+
/*
|
|
251
|
+
* Shiprocket requires at least one order item. We do not receive the
|
|
252
|
+
* line items on this contract — `CreateShipmentInput` carries only
|
|
253
|
+
* dimensions and the two addresses — so a single synthetic line stands
|
|
254
|
+
* for the parcel. 🛑 This is a known gap, not a simplification: a real
|
|
255
|
+
* integration needs per-item HSN and value for a commercial invoice, and
|
|
256
|
+
* that means widening the shared contract rather than inventing values
|
|
257
|
+
* here.
|
|
258
|
+
*/
|
|
259
|
+
order_items: [
|
|
260
|
+
{
|
|
261
|
+
name: `Order ${data.orderId}`,
|
|
262
|
+
sku: data.orderId,
|
|
263
|
+
units: 1,
|
|
264
|
+
selling_price: data.codAmount ?? 0,
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
payment_method: data.isCod ? "COD" : "Prepaid",
|
|
268
|
+
sub_total: data.codAmount ?? 0,
|
|
269
|
+
length: data.dimensions.length,
|
|
270
|
+
breadth: data.dimensions.width,
|
|
271
|
+
height: data.dimensions.height,
|
|
272
|
+
weight: data.dimensions.weight,
|
|
273
|
+
};
|
|
274
|
+
const out = await this.call("/orders/create/adhoc", { method: "POST", body: JSON.stringify(body) }, createOrderResponse);
|
|
275
|
+
return {
|
|
276
|
+
id: String(out.shipment_id),
|
|
277
|
+
/*
|
|
278
|
+
* 🛑 Falls back to the shipment id when no AWB has been assigned yet —
|
|
279
|
+
* assignment is a separate call. It does NOT invent a `manual_…` string:
|
|
280
|
+
* a synthetic tracking number that a buyer can paste into a courier site
|
|
281
|
+
* and get nothing from is the failure mode this whole provider is
|
|
282
|
+
* supposed to avoid.
|
|
283
|
+
*/
|
|
284
|
+
trackingId: out.awb_code?.trim() || String(out.shipment_id),
|
|
285
|
+
orderId: data.orderId,
|
|
286
|
+
status: out.status ?? "created",
|
|
287
|
+
courier: out.courier_name ?? undefined,
|
|
288
|
+
createdAt: new Date().toISOString(),
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
async trackShipment(trackingId) {
|
|
292
|
+
const out = await this.call(`/courier/track/awb/${encodeURIComponent(trackingId)}`, { method: "GET" }, trackingResponse);
|
|
293
|
+
const t = out.tracking_data;
|
|
294
|
+
const head = t.shipment_track?.[0];
|
|
295
|
+
return {
|
|
296
|
+
trackingId,
|
|
297
|
+
currentStatus: head?.current_status ?? String(t.shipment_status ?? "unknown"),
|
|
298
|
+
estimatedDelivery: head?.edd ?? undefined,
|
|
299
|
+
events: (t.shipment_track_activities ?? []).map((e) => ({
|
|
300
|
+
status: e.status ?? "",
|
|
301
|
+
location: e.location ?? "",
|
|
302
|
+
timestamp: e.date ?? "",
|
|
303
|
+
description: e.activity ?? undefined,
|
|
304
|
+
})),
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
async cancelShipment(shipmentId) {
|
|
308
|
+
await this.call("/orders/cancel", { method: "POST", body: JSON.stringify({ ids: [shipmentId] }) },
|
|
309
|
+
// Their cancel returns a message envelope we do not read; accepting any
|
|
310
|
+
// object keeps us from asserting a shape we have not seen.
|
|
311
|
+
z.object({}).passthrough());
|
|
312
|
+
}
|
|
313
|
+
async checkServiceability(pincode, weight) {
|
|
314
|
+
/*
|
|
315
|
+
* 🛑 `pickup_postcode` is required by their API and we do not have it on
|
|
316
|
+
* this contract. Taken from the registered pickup location's name is NOT
|
|
317
|
+
* possible — it is a nickname, not a pincode — so this returns
|
|
318
|
+
* "unserviceable" rather than guessing a origin pincode, which would
|
|
319
|
+
* produce confidently wrong rates.
|
|
320
|
+
*/
|
|
321
|
+
const origin = process.env.SHIPROCKET_PICKUP_PINCODE?.trim();
|
|
322
|
+
if (!origin) {
|
|
323
|
+
serverLogger.warn("shiprocket: SHIPROCKET_PICKUP_PINCODE unset — serviceability cannot be checked", { pincode });
|
|
324
|
+
return { isServiceable: false, couriers: [] };
|
|
325
|
+
}
|
|
326
|
+
try {
|
|
327
|
+
const out = await this.call(`/courier/serviceability/?pickup_postcode=${encodeURIComponent(origin)}` +
|
|
328
|
+
`&delivery_postcode=${encodeURIComponent(pincode)}` +
|
|
329
|
+
`&weight=${encodeURIComponent(String(weight))}&cod=0`, { method: "GET" }, serviceabilityResponse);
|
|
330
|
+
const couriers = (out.data.available_courier_companies ?? []).map((c) => ({
|
|
331
|
+
name: c.courier_name,
|
|
332
|
+
estimatedDays: num(c.estimated_delivery_days),
|
|
333
|
+
rate: num(c.rate),
|
|
334
|
+
}));
|
|
335
|
+
return { isServiceable: couriers.length > 0, couriers };
|
|
336
|
+
}
|
|
337
|
+
catch (err) {
|
|
338
|
+
void normalizeError(err);
|
|
339
|
+
/*
|
|
340
|
+
* Serviceability is a QUOTE, not a write. Failing closed here means the
|
|
341
|
+
* checkout says "we cannot ship there" on a transient carrier outage,
|
|
342
|
+
* which is wrong in the safe direction — the alternative is quoting a
|
|
343
|
+
* rate we cannot honour.
|
|
344
|
+
*/
|
|
345
|
+
return { isServiceable: false, couriers: [] };
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
async generateLabel(shipmentId) {
|
|
349
|
+
const out = await this.call("/courier/generate/label", { method: "POST", body: JSON.stringify({ shipment_id: [shipmentId] }) }, z.object({ label_url: z.string().url() }));
|
|
350
|
+
const res = await fetch(out.label_url);
|
|
351
|
+
if (!res.ok) {
|
|
352
|
+
throw new ApiError(502, `Shiprocket label download failed (${res.status}).`, { code: "SHIPROCKET_LABEL_FAILED" });
|
|
353
|
+
}
|
|
354
|
+
return res.arrayBuffer();
|
|
355
|
+
}
|
|
356
|
+
}
|
package/dist/providers.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ export type { DocumentSnapshot } from "firebase-admin/firestore";
|
|
|
17
17
|
export { firebaseStorageProvider } from "./providers/storage-firebase/index";
|
|
18
18
|
export { createResendProvider } from "./providers/email-resend/index";
|
|
19
19
|
export type { ResendProviderOptions } from "./providers/email-resend/index";
|
|
20
|
+
export { RazorpayProvider } from "./providers/payment-razorpay/index";
|
|
21
|
+
export type { RazorpayConfig } from "./providers/payment-razorpay/index";
|
|
22
|
+
export { verifyPaymentSignature as verifyRazorpayPaymentSignature, verifyWebhookSignature as verifyRazorpayWebhookSignature, type RazorpayPaymentResult, } from "./providers/payment-razorpay/signature";
|
|
20
23
|
export { PhonePeProvider } from "./providers/payment-phonepe/index";
|
|
21
24
|
export type { PhonePeConfig } from "./providers/payment-phonepe/index";
|
|
22
25
|
export { rupeesToPaise, paiseToRupees } from "./core/money";
|
package/dist/providers.js
CHANGED
|
@@ -20,6 +20,9 @@ export { firebaseDbProvider, getAdminApp, getAdminAuth, getAdminDb, getAdminStor
|
|
|
20
20
|
export { firebaseStorageProvider } from "./providers/storage-firebase/index.js";
|
|
21
21
|
// Email (Resend)
|
|
22
22
|
export { createResendProvider } from "./providers/email-resend/index.js";
|
|
23
|
+
// Payment (Razorpay) — disabled by default; siteSettings.payment.razorpayEnabled turns it on
|
|
24
|
+
export { RazorpayProvider } from "./providers/payment-razorpay/index.js";
|
|
25
|
+
export { verifyPaymentSignature as verifyRazorpayPaymentSignature, verifyWebhookSignature as verifyRazorpayWebhookSignature, } from "./providers/payment-razorpay/signature.js";
|
|
23
26
|
// Payment (PhonePe) — disabled by default; siteSettings.payment.phonepeEnabled turns it on
|
|
24
27
|
export { PhonePeProvider } from "./providers/payment-phonepe/index.js";
|
|
25
28
|
export { rupeesToPaise, paiseToRupees } from "./core/money.js";
|
|
@@ -7,31 +7,4 @@ export interface CanSeePricesState {
|
|
|
7
7
|
*/
|
|
8
8
|
isAuthResolving: boolean;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* May the current viewer be shown money amounts on a public listing surface?
|
|
12
|
-
*
|
|
13
|
-
* Prices, current bids, deposits and per-entry amounts are hidden from
|
|
14
|
-
* signed-out visitors so the catalogue cannot be read at scale without an
|
|
15
|
-
* account. Signed-in users see everything exactly as before.
|
|
16
|
-
*
|
|
17
|
-
* ## Why there are THREE states, not two
|
|
18
|
-
*
|
|
19
|
-
* `SessionProvider` is mounted `initialUser={null}` because the root locale
|
|
20
|
-
* layout must stay static (Root Cause #82), so `loading` starts `true` on every
|
|
21
|
-
* hard load — for signed-in users too, until Firebase persistence resolves and
|
|
22
|
-
* `/api/user/profile` returns. A naive `!user` test therefore renders
|
|
23
|
-
* "Sign in to see price" at an already-signed-in user for several hundred
|
|
24
|
-
* milliseconds on every page load.
|
|
25
|
-
*
|
|
26
|
-
* So: `isAuthResolving` means "don't know yet" and must render a neutral
|
|
27
|
-
* placeholder. Only `canSeePrices === false && isAuthResolving === false` is a
|
|
28
|
-
* confirmed guest.
|
|
29
|
-
*
|
|
30
|
-
* ## Why `useOptionalSession`
|
|
31
|
-
*
|
|
32
|
-
* This is library code that ADJUSTS for the viewer rather than requiring one.
|
|
33
|
-
* `useSession()` throws without a provider, which would turn an optional
|
|
34
|
-
* refinement into a breaking contract for every consumer (Root Cause #20). With
|
|
35
|
-
* no provider we fail CLOSED — no session means no prices.
|
|
36
|
-
*/
|
|
37
10
|
export declare function useCanSeePrices(): CanSeePricesState;
|
|
@@ -27,8 +27,33 @@ import { useOptionalSession } from "../contexts/SessionContext.js";
|
|
|
27
27
|
* refinement into a breaking contract for every consumer (Root Cause #20). With
|
|
28
28
|
* no provider we fail CLOSED — no session means no prices.
|
|
29
29
|
*/
|
|
30
|
+
/**
|
|
31
|
+
* 🛑 THE switch. `false` = prices are public; `true` restores the sign-in gate
|
|
32
|
+
* described above, with no other edit anywhere.
|
|
33
|
+
*
|
|
34
|
+
* Turned off 2026-10-20: a catalogue that will not show a price to a visitor
|
|
35
|
+
* who has not signed in loses the visitor, not the scraper — the price is in
|
|
36
|
+
* the RSC payload and in `GET /api/products` either way (the "accepted
|
|
37
|
+
* residue" in CLAUDE.md), so the gate only ever cost real buyers.
|
|
38
|
+
*
|
|
39
|
+
* Every call site, wrapper and three-state branch below is left INTACT rather
|
|
40
|
+
* than ripped out, because that is what makes this one boolean a real switch
|
|
41
|
+
* instead of a rewrite. Two things outside this file move with it, and must
|
|
42
|
+
* move back if it is ever flipped:
|
|
43
|
+
* · `gatedPriceWebPageJsonLd()` — dropped from the product and auction
|
|
44
|
+
* pages. `isAccessibleForFree: false` over a price anyone can read is a
|
|
45
|
+
* false declaration to a crawler, which is the exact mismatch the node was
|
|
46
|
+
* added to prevent, pointed the other way.
|
|
47
|
+
* · `audit-guest-price-leak` R3 — the rule that REQUIRES that pairing.
|
|
48
|
+
*/
|
|
49
|
+
const GUEST_PRICE_GATE_ENABLED = false;
|
|
30
50
|
export function useCanSeePrices() {
|
|
51
|
+
// Called unconditionally: hook order cannot depend on a build-time flag.
|
|
31
52
|
const session = useOptionalSession();
|
|
53
|
+
// Gate off — everyone sees prices, and nothing is "resolving", so no surface
|
|
54
|
+
// is left holding a neutral placeholder waiting for a session it never needs.
|
|
55
|
+
if (!GUEST_PRICE_GATE_ENABLED)
|
|
56
|
+
return { canSeePrices: true, isAuthResolving: false };
|
|
32
57
|
// No provider: fail closed, and don't claim to be mid-resolution — there is
|
|
33
58
|
// nothing in flight that will ever change the answer.
|
|
34
59
|
if (!session)
|
|
@@ -40,7 +40,7 @@ export { shipmentItemsRepository } from "../features/shipments/repository/shipme
|
|
|
40
40
|
export { catalogueRepository } from "../features/catalogue/repository/catalogue.repository";
|
|
41
41
|
export { SavedPaymentMethodsRepository, savedPaymentMethodsRepository, } from "../features/payments/repository/saved-payment-methods.repository";
|
|
42
42
|
export { GroupedListingsRepository, groupedListingsRepository, } from "../features/grouped/repository/grouped-listings.repository";
|
|
43
|
-
export { payoutMethodsRepository, shippingConfigsRepository, analyticsCardsRepository, analyticsAlertsRepository, storeCategoriesRepository, listingTemplatesRepository, moderationQueueRepository, reportsRepository, itemRequestsRepository,
|
|
43
|
+
export { payoutMethodsRepository, shippingConfigsRepository, analyticsCardsRepository, analyticsAlertsRepository, storeCategoriesRepository, listingTemplatesRepository, moderationQueueRepository, reportsRepository, itemRequestsRepository, storeGoogleConfigRepository, PayoutMethodsRepository, ShippingConfigsRepository, AnalyticsCardsRepository, AnalyticsAlertsRepository, StoreCategoriesRepository, ListingTemplatesRepository, ModerationQueueRepository, ReportsRepository, ItemRequestsRepository, StoreGoogleConfigRepository, } from "../features/store-extensions/repository/store-extensions.repositories";
|
|
44
44
|
export { roleOverridesRepository, customRolesRepository, adminNotificationsRepository, RoleOverridesRepository, CustomRolesRepository, AdminNotificationsRepository, } from "../features/store-extensions/repository/rbac.repositories";
|
|
45
45
|
export { OfferRepository, offerRepository, } from "../features/seller/repository/offer.repository";
|
|
46
46
|
export { wishlistRepository, type UserWishlistItem as WishlistItem, WishlistFullError, } from "../features/wishlist/repository/user-wishlist.repository";
|
|
@@ -56,7 +56,7 @@ export { SavedPaymentMethodsRepository, savedPaymentMethodsRepository, } from ".
|
|
|
56
56
|
// Grouped listings repository
|
|
57
57
|
export { GroupedListingsRepository, groupedListingsRepository, } from "../features/grouped/repository/grouped-listings.repository.js";
|
|
58
58
|
// S-STORE-CROSS — 11 new collection repositories
|
|
59
|
-
export { payoutMethodsRepository, shippingConfigsRepository, analyticsCardsRepository, analyticsAlertsRepository, storeCategoriesRepository, listingTemplatesRepository, moderationQueueRepository, reportsRepository, itemRequestsRepository,
|
|
59
|
+
export { payoutMethodsRepository, shippingConfigsRepository, analyticsCardsRepository, analyticsAlertsRepository, storeCategoriesRepository, listingTemplatesRepository, moderationQueueRepository, reportsRepository, itemRequestsRepository, storeGoogleConfigRepository, PayoutMethodsRepository, ShippingConfigsRepository, AnalyticsCardsRepository, AnalyticsAlertsRepository, StoreCategoriesRepository, ListingTemplatesRepository, ModerationQueueRepository, ReportsRepository, ItemRequestsRepository, StoreGoogleConfigRepository, } from "../features/store-extensions/repository/store-extensions.repositories.js";
|
|
60
60
|
// S-STORE RBAC + admin notifications
|
|
61
61
|
export { roleOverridesRepository, customRolesRepository, adminNotificationsRepository, RoleOverridesRepository, CustomRolesRepository, AdminNotificationsRepository, } from "../features/store-extensions/repository/rbac.repositories.js";
|
|
62
62
|
export { OfferRepository, offerRepository, } from "../features/seller/repository/offer.repository.js";
|