@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.
Files changed (384) hide show
  1. package/dist/.build-stamp.json +3 -3
  2. package/dist/_internal/client/theme/ThemeProvider.js +15 -1
  3. package/dist/_internal/server/features/auth/capabilities.js +7 -5
  4. package/dist/_internal/server/features/categories/price-guidance-resolve.d.ts +66 -0
  5. package/dist/_internal/server/features/categories/price-guidance-resolve.js +138 -0
  6. package/dist/_internal/server/features/checkout/actions.d.ts +22 -6
  7. package/dist/_internal/server/features/checkout/actions.js +96 -51
  8. package/dist/_internal/server/features/checkout/index.d.ts +1 -1
  9. package/dist/_internal/server/features/checkout/index.js +1 -1
  10. package/dist/_internal/server/features/checkout/supplier-identity.js +28 -6
  11. package/dist/_internal/server/features/orders/adapters.js +1 -3
  12. package/dist/_internal/server/features/price-index/market.d.ts +57 -0
  13. package/dist/_internal/server/features/price-index/market.js +120 -0
  14. package/dist/_internal/server/features/products/list-public.d.ts +12 -0
  15. package/dist/_internal/server/features/products/list-public.js +10 -1
  16. package/dist/_internal/server/features/products/listing-tab-counts.d.ts +25 -1
  17. package/dist/_internal/server/features/products/listing-tab-counts.js +184 -10
  18. package/dist/_internal/server/features/search/index-build/sources.js +43 -2
  19. package/dist/_internal/server/features/site-settings/adapters.js +1 -1
  20. package/dist/_internal/server/features/stores/adapters.d.ts +1 -1
  21. package/dist/_internal/server/features/stores/adapters.js +0 -1
  22. package/dist/_internal/server/features/stores/tabs.d.ts +7 -2
  23. package/dist/_internal/server/features/stores/tabs.js +5 -3
  24. package/dist/_internal/server/jobs/core/analyticsAlertEvaluate.js +2 -5
  25. package/dist/_internal/server/jobs/core/jobRunners.js +0 -10
  26. package/dist/_internal/server/jobs/core/onOrderCreate.js +10 -104
  27. package/dist/_internal/server/jobs/core/onOrderStatusChange.d.ts +0 -2
  28. package/dist/_internal/server/jobs/core/onOrderStatusChange.js +0 -1
  29. package/dist/_internal/server/jobs/core/onScamReportCreate.js +0 -1
  30. package/dist/_internal/server/jobs/core/onScamReportRejected.js +0 -1
  31. package/dist/_internal/server/jobs/core/onScamReportVerified.js +0 -1
  32. package/dist/_internal/server/jobs/core/paymentWindowTimeout.js +0 -1
  33. package/dist/_internal/server/jobs/core/pendingOrderTimeout.js +0 -1
  34. package/dist/_internal/server/notifications/channel-health.d.ts +7 -3
  35. package/dist/_internal/server/notifications/channel-health.js +2 -2
  36. package/dist/_internal/server/notifications/send-guard.d.ts +1 -1
  37. package/dist/_internal/server/notifications/send-guard.js +2 -4
  38. package/dist/_internal/shared/actions/action-registry.d.ts +1 -1
  39. package/dist/_internal/shared/actions/action-registry.js +128 -28
  40. package/dist/_internal/shared/checkout/order-math.d.ts +1 -1
  41. package/dist/_internal/shared/checkout/order-math.js +1 -1
  42. package/dist/_internal/shared/features/categories/bundle-copy.d.ts +1 -1
  43. package/dist/_internal/shared/features/checkout/config.d.ts +0 -2
  44. package/dist/_internal/shared/features/checkout/config.js +0 -2
  45. package/dist/_internal/shared/features/messaging/config.d.ts +7 -5
  46. package/dist/_internal/shared/features/messaging/config.js +1 -4
  47. package/dist/_internal/shared/features/site-settings/fees.d.ts +0 -2
  48. package/dist/_internal/shared/features/site-settings/fees.js +0 -2
  49. package/dist/_internal/shared/features/site-settings/supplier-of-record.d.ts +56 -0
  50. package/dist/_internal/shared/features/site-settings/supplier-of-record.js +57 -0
  51. package/dist/_internal/shared/fees/calculator.d.ts +0 -8
  52. package/dist/_internal/shared/fees/calculator.js +0 -7
  53. package/dist/_internal/shared/listing-types/tiers.d.ts +94 -0
  54. package/dist/_internal/shared/listing-types/tiers.js +150 -0
  55. package/dist/_internal/shared/search/match.js +28 -2
  56. package/dist/cli/index.js +0 -2
  57. package/dist/client.d.ts +25 -4
  58. package/dist/client.js +36 -5
  59. package/dist/constants/api-endpoints.d.ts +28 -15
  60. package/dist/constants/api-endpoints.js +14 -8
  61. package/dist/constants/field-names.d.ts +1 -0
  62. package/dist/constants/field-names.js +1 -0
  63. package/dist/constants/notification-types.d.ts +1 -1
  64. package/dist/constants/notification-types.js +1 -1
  65. package/dist/core/integration-keys.d.ts +5 -5
  66. package/dist/core/integration-keys.js +21 -10
  67. package/dist/features/about/components/FeesView.js +0 -6
  68. package/dist/features/about/components/GuidesHubView.js +15 -2
  69. package/dist/features/account/components/NotificationPreferencesPanel.js +3 -4
  70. package/dist/features/account/components/UserOrdersView.js +26 -7
  71. package/dist/features/account/types/index.d.ts +0 -2
  72. package/dist/features/addresses/utils/postal-autofill.d.ts +39 -0
  73. package/dist/features/addresses/utils/postal-autofill.js +54 -0
  74. package/dist/features/admin/actions/notification-actions.d.ts +2 -8
  75. package/dist/features/admin/actions/notification-actions.js +9 -104
  76. package/dist/features/admin/components/AdminGuideHubView.js +1 -8
  77. package/dist/features/admin/components/AdminOrderEditorView.d.ts +1 -1
  78. package/dist/features/admin/components/AdminOrdersView.js +0 -2
  79. package/dist/features/admin/components/AdminSectionsView.js +3 -2
  80. package/dist/features/admin/components/AdminSiteSettingsView.js +22 -68
  81. package/dist/features/admin/components/AdminStoreEditorView.js +72 -34
  82. package/dist/features/admin/components/OwnerQuickActions.d.ts +29 -0
  83. package/dist/features/admin/components/OwnerQuickActions.js +142 -0
  84. package/dist/features/admin/components/sections/adminSectionsTypes.js +13 -4
  85. package/dist/features/admin/components/sections/icon-options.d.ts +21 -0
  86. package/dist/features/admin/components/sections/icon-options.js +23 -0
  87. package/dist/features/admin/components/sections/sectionTemplates.js +4 -1
  88. package/dist/features/admin/constants/site-settings-tabs.d.ts +7 -12
  89. package/dist/features/admin/constants/site-settings-tabs.js +6 -12
  90. package/dist/features/admin/repository/site-settings.repository.js +1 -1
  91. package/dist/features/admin/schemas/admin-editor-forms.d.ts +1 -1
  92. package/dist/features/admin/schemas/admin-editor-forms.js +4 -1
  93. package/dist/features/admin/schemas/admin-user-form.d.ts +0 -61
  94. package/dist/features/admin/schemas/admin-user-form.js +3 -44
  95. package/dist/features/admin/schemas/firestore.d.ts +28 -54
  96. package/dist/features/admin/schemas/firestore.js +40 -18
  97. package/dist/features/auctions/components/AuctionDetailPageView.js +12 -10
  98. package/dist/features/auctions/components/MarketplaceAuctionCard.d.ts +11 -1
  99. package/dist/features/auctions/components/MarketplaceAuctionCard.js +9 -2
  100. package/dist/features/auth/checkout-value-otp.d.ts +1 -1
  101. package/dist/features/auth/checkout-value-otp.js +1 -1
  102. package/dist/features/auth/permissions/constants.d.ts +29 -2
  103. package/dist/features/auth/permissions/constants.js +67 -1
  104. package/dist/features/blog/components/BlogFeaturedCard.d.ts +11 -1
  105. package/dist/features/blog/components/BlogFeaturedCard.js +9 -2
  106. package/dist/features/cart/components/CartDrawer.js +3 -2
  107. package/dist/features/cart/components/CartGroupLineRow.js +2 -1
  108. package/dist/features/cart/components/CartPriceBreakdown.d.ts +0 -2
  109. package/dist/features/cart/components/CartPriceBreakdown.js +1 -1
  110. package/dist/features/cart/components/StoreAddonsPicker.d.ts +2 -5
  111. package/dist/features/cart/components/StoreAddonsPicker.js +4 -5
  112. package/dist/features/cart/hooks/useAddToCart.js +10 -5
  113. package/dist/features/cart/repository/cart.repository.js +1 -2
  114. package/dist/features/cart/schemas/firestore.d.ts +1 -2
  115. package/dist/features/cart/utils/pending-ops.d.ts +11 -1
  116. package/dist/features/cart/utils/pending-ops.js +14 -2
  117. package/dist/features/categories/api/[id]/price-guidance/route.js +1 -24
  118. package/dist/features/categories/components/BrandDetailPageView.js +15 -6
  119. package/dist/features/categories/components/BrandDetailTabs.d.ts +7 -1
  120. package/dist/features/categories/components/BrandDetailTabs.js +18 -3
  121. package/dist/features/categories/components/BundleCollage.js +3 -2
  122. package/dist/features/categories/components/BundleDetailView.js +2 -1
  123. package/dist/features/categories/components/BundleItemsPicker.js +3 -4
  124. package/dist/features/categories/components/CategoryDetailPageView.js +19 -8
  125. package/dist/features/categories/components/CategoryDetailTabs.d.ts +7 -1
  126. package/dist/features/categories/components/CategoryDetailTabs.js +29 -7
  127. package/dist/features/categories/components/CategoryGrid.d.ts +11 -1
  128. package/dist/features/categories/components/CategoryGrid.js +9 -2
  129. package/dist/features/checkout/actions/checkout-value-otp-actions.d.ts +10 -5
  130. package/dist/features/checkout/actions/checkout-value-otp-actions.js +2 -88
  131. package/dist/features/classified/components/ClassifiedDetailPageView.js +12 -2
  132. package/dist/features/digital-codes/components/DigitalCodeDetailPageView.js +12 -2
  133. package/dist/features/events/components/EventCard.d.ts +11 -1
  134. package/dist/features/events/components/EventCard.js +9 -2
  135. package/dist/features/grouped/components/GroupedListingDetailView.js +3 -1
  136. package/dist/features/homepage/components/CTABannerSection.d.ts +3 -1
  137. package/dist/features/homepage/components/CTABannerSection.js +6 -3
  138. package/dist/features/homepage/components/HeroCarousel.js +8 -6
  139. package/dist/features/homepage/components/MarketplaceHomepageView.js +33 -7
  140. package/dist/features/homepage/components/SectionCarousel.js +13 -5
  141. package/dist/features/homepage/components/SecurityHighlightsSection.d.ts +8 -3
  142. package/dist/features/homepage/components/SecurityHighlightsSection.js +2 -2
  143. package/dist/features/homepage/components/StatsCounterSection.d.ts +9 -4
  144. package/dist/features/homepage/components/StatsCounterSection.js +2 -2
  145. package/dist/features/homepage/components/TestimonialsCarousel.js +1 -1
  146. package/dist/features/homepage/components/TrustFeaturesSection.d.ts +18 -4
  147. package/dist/features/homepage/components/TrustFeaturesSection.js +5 -5
  148. package/dist/features/homepage/components/WelcomeSection.d.ts +13 -2
  149. package/dist/features/homepage/components/WelcomeSection.js +3 -3
  150. package/dist/features/homepage/components/WhatsAppCommunitySection.d.ts +28 -0
  151. package/dist/features/homepage/components/WhatsAppCommunitySection.js +42 -6
  152. package/dist/features/homepage/components/WhatsAppGlyph.d.ts +20 -0
  153. package/dist/features/homepage/components/WhatsAppGlyph.js +20 -0
  154. package/dist/features/homepage/constants/hero-carousel-styles.d.ts +8 -6
  155. package/dist/features/homepage/constants/hero-carousel-styles.js +8 -6
  156. package/dist/features/homepage/constants/section-copy.d.ts +12 -10
  157. package/dist/features/homepage/constants/section-copy.js +28 -6
  158. package/dist/features/homepage/constants/stat-icons.d.ts +12 -0
  159. package/dist/features/homepage/constants/stat-icons.js +17 -0
  160. package/dist/features/homepage/constants/trust-icon-aliases.d.ts +8 -0
  161. package/dist/features/homepage/constants/trust-icon-aliases.js +75 -0
  162. package/dist/features/homepage/lib/section-defaults.d.ts +16 -1
  163. package/dist/features/homepage/lib/section-defaults.js +24 -4
  164. package/dist/features/homepage/lib/section-renderer.js +48 -8
  165. package/dist/features/homepage/schemas/firestore.d.ts +18 -1
  166. package/dist/features/layout/AppLayoutShell.js +2 -1
  167. package/dist/features/layout/BottomActions.d.ts +1 -0
  168. package/dist/features/layout/BottomActions.js +330 -0
  169. package/dist/features/layout/BottomChrome.d.ts +45 -0
  170. package/dist/features/layout/BottomChrome.js +5 -17
  171. package/dist/features/layout/SideActionDock.js +36 -13
  172. package/dist/features/layout/index.d.ts +2 -7
  173. package/dist/features/layout/index.js +7 -7
  174. package/dist/features/layout/useIsDesktop.d.ts +36 -0
  175. package/dist/features/layout/useIsDesktop.js +48 -0
  176. package/dist/features/live/components/LiveItemDetailPageView.js +12 -2
  177. package/dist/features/orders/actions/refund-actions.js +0 -1
  178. package/dist/features/orders/components/OrderAddonBadges.d.ts +1 -3
  179. package/dist/features/orders/components/OrderAddonBadges.js +3 -4
  180. package/dist/features/orders/components/OrderPaymentSummary.js +15 -2
  181. package/dist/features/orders/components/YourPurchaseStrip.d.ts +24 -0
  182. package/dist/features/orders/components/YourPurchaseStrip.js +77 -0
  183. package/dist/features/orders/components/index.d.ts +2 -1
  184. package/dist/features/orders/components/index.js +1 -1
  185. package/dist/features/orders/repository/orders.repository.d.ts +0 -8
  186. package/dist/features/orders/repository/orders.repository.js +0 -2
  187. package/dist/features/orders/schemas/firestore.d.ts +17 -9
  188. package/dist/features/orders/types/index.d.ts +2 -5
  189. package/dist/features/orders/utils/order-announcement-message.d.ts +18 -0
  190. package/dist/features/orders/utils/order-announcement-message.js +16 -0
  191. package/dist/features/orders/utils/payment-proof-message.d.ts +20 -0
  192. package/dist/features/orders/utils/payment-proof-message.js +17 -0
  193. package/dist/features/parts/components/PartDetailPageView.js +96 -1
  194. package/dist/features/parts/schemas/firestore.d.ts +247 -0
  195. package/dist/features/parts/schemas/firestore.js +6 -6
  196. package/dist/features/pre-orders/components/MarketplacePreorderCard.d.ts +11 -1
  197. package/dist/features/pre-orders/components/MarketplacePreorderCard.js +10 -3
  198. package/dist/features/pre-orders/components/PreOrderDetailPageView.js +12 -10
  199. package/dist/features/price-index/components/PriceIndexToolView.d.ts +21 -0
  200. package/dist/features/price-index/components/PriceIndexToolView.js +230 -27
  201. package/dist/features/price-index/lookup-target.d.ts +48 -0
  202. package/dist/features/price-index/lookup-target.js +107 -0
  203. package/dist/features/products/api/[id]/route.js +8 -1
  204. package/dist/features/products/api/route.js +16 -4
  205. package/dist/features/products/components/AvailabilityScopeHint.d.ts +22 -0
  206. package/dist/features/products/components/AvailabilityScopeHint.js +27 -0
  207. package/dist/features/products/components/CompareOverlay.d.ts +2 -1
  208. package/dist/features/products/components/CompareOverlay.js +2 -1
  209. package/dist/features/products/components/GroupSettingsPanel.js +2 -1
  210. package/dist/features/products/components/InteractiveProductCard.d.ts +7 -1
  211. package/dist/features/products/components/InteractiveProductCard.js +16 -4
  212. package/dist/features/products/components/MarketplaceBundleCard.d.ts +11 -1
  213. package/dist/features/products/components/MarketplaceBundleCard.js +9 -2
  214. package/dist/features/products/components/MarketplacePrizeDrawCard.d.ts +11 -1
  215. package/dist/features/products/components/MarketplacePrizeDrawCard.js +9 -2
  216. package/dist/features/products/components/PrizeDrawDetailPageView.js +2 -1
  217. package/dist/features/products/components/ProductDetailPageView.js +34 -4
  218. package/dist/features/products/components/ProductGrid.d.ts +14 -1
  219. package/dist/features/products/components/ProductGrid.js +22 -5
  220. package/dist/features/products/components/ProductsIndexListing.js +2 -2
  221. package/dist/features/products/components/SublistingCarouselSection.js +2 -1
  222. package/dist/features/products/repository/products.repository.d.ts +1 -0
  223. package/dist/features/products/repository/products.repository.js +5 -1
  224. package/dist/features/products/utils/group-member-image.d.ts +9 -2
  225. package/dist/features/products/utils/group-member-image.js +2 -1
  226. package/dist/features/reviews/api/[id]/route.js +83 -23
  227. package/dist/features/reviews/components/PurchaseReviewAffordance.d.ts +6 -0
  228. package/dist/features/reviews/components/PurchaseReviewAffordance.js +42 -0
  229. package/dist/features/reviews/components/ReviewFormDrawer.d.ts +34 -0
  230. package/dist/features/reviews/components/ReviewFormDrawer.js +127 -0
  231. package/dist/features/reviews/components/index.d.ts +4 -0
  232. package/dist/features/reviews/components/index.js +2 -0
  233. package/dist/features/scams/schemas/index.d.ts +10 -10
  234. package/dist/features/search/action-index/settings-entries.js +0 -9
  235. package/dist/features/seller/actions/seller-actions.d.ts +1 -1
  236. package/dist/features/seller/actions/seller-actions.js +49 -3
  237. package/dist/features/seller/components/SellerPayoutSettingsView.js +30 -2
  238. package/dist/features/seller/components/SellerProductShell.d.ts +17 -1
  239. package/dist/features/seller/components/SellerProductsView.js +3 -2
  240. package/dist/features/seller/hooks/useStoreListingEntitlements.d.ts +8 -0
  241. package/dist/features/seller/hooks/useStoreListingEntitlements.js +70 -0
  242. package/dist/features/store-extensions/repository/store-extensions.repositories.d.ts +1 -6
  243. package/dist/features/store-extensions/repository/store-extensions.repositories.js +1 -10
  244. package/dist/features/store-extensions/schemas/firestore.d.ts +1 -17
  245. package/dist/features/store-extensions/schemas/firestore.js +0 -10
  246. package/dist/features/stores/components/InteractiveStoreCard.d.ts +11 -1
  247. package/dist/features/stores/components/InteractiveStoreCard.js +9 -2
  248. package/dist/features/stores/components/StoreAuctionsListing.js +2 -1
  249. package/dist/features/stores/components/StoreCapabilitiesGuideView.js +0 -1
  250. package/dist/features/stores/components/StoreGuideHubView.js +2 -8
  251. package/dist/features/stores/components/StoreSettingsGuideView.js +2 -6
  252. package/dist/features/stores/components/index.d.ts +0 -2
  253. package/dist/features/stores/components/index.js +0 -1
  254. package/dist/features/stores/repository/store.repository.d.ts +1 -26
  255. package/dist/features/stores/repository/store.repository.js +5 -60
  256. package/dist/features/stores/schemas/firestore.d.ts +6 -25
  257. package/dist/features/stores/schemas/firestore.js +6 -3
  258. package/dist/features/stores/schemas/index.d.ts +1 -87
  259. package/dist/features/stores/schemas/index.js +10 -15
  260. package/dist/features/tester/seed-data/authored/admin__site-system.js +0 -48
  261. package/dist/features/tester/seed-data/authored/buying__buying-checkout.js +0 -40
  262. package/dist/features/tester/seed-data/authored/content-discovery__authenticity-checker.js +114 -2
  263. package/dist/features/tester/seed-data/authored/selling__quick-add-minimum-details.js +0 -16
  264. package/dist/features/tester/seed-data/authored/selling__seller-guide.js +1 -1
  265. package/dist/features/tester/seed-data/authored/selling__seller-marketing-extras.js +0 -79
  266. package/dist/features/tester/seed-data/authored/selling__seller-orders.js +1 -1
  267. package/dist/features/tester/seed-data/tester-checklist-seed-data.js +427 -69
  268. package/dist/index.d.ts +20 -32
  269. package/dist/index.js +34 -43
  270. package/dist/next/routing/route-map.d.ts +2 -8
  271. package/dist/next/routing/route-map.js +21 -4
  272. package/dist/providers/db-firebase/base.repository.d.ts +1 -1
  273. package/dist/providers/db-firebase/base.repository.js +1 -1
  274. package/dist/providers/payment-razorpay/index.d.ts +125 -0
  275. package/dist/providers/payment-razorpay/index.js +232 -0
  276. package/dist/providers/payment-razorpay/signature.d.ts +53 -0
  277. package/dist/providers/payment-razorpay/signature.js +71 -0
  278. package/dist/providers/shipping-shiprocket/index.d.ts +98 -0
  279. package/dist/providers/shipping-shiprocket/index.js +356 -0
  280. package/dist/providers.d.ts +3 -0
  281. package/dist/providers.js +3 -0
  282. package/dist/react/hooks/useCanSeePrices.d.ts +0 -27
  283. package/dist/react/hooks/useCanSeePrices.js +25 -0
  284. package/dist/repositories/index.d.ts +1 -1
  285. package/dist/repositories/index.js +1 -1
  286. package/dist/schemas/registry.d.ts +10 -115
  287. package/dist/schemas/registry.js +1 -2
  288. package/dist/security/pii-encrypt.js +1 -1
  289. package/dist/seed/_helpers/category-forest.js +27 -0
  290. package/dist/seed/_helpers/category-parts-glossary-map.js +1816 -86
  291. package/dist/seed/_helpers/category-parts.d.ts +1 -1
  292. package/dist/seed/_helpers/category-parts.js +13412 -3020
  293. package/dist/seed/carousel-slides-seed-data.js +47 -10
  294. package/dist/seed/categories-seed-data.js +48 -6
  295. package/dist/seed/faq-seed-data.js +2 -2
  296. package/dist/seed/homepage-sections-seed-data.js +286 -54
  297. package/dist/seed/index.d.ts +1 -1
  298. package/dist/seed/index.js +1 -1
  299. package/dist/seed/manifest.d.ts +1 -1
  300. package/dist/seed/manifest.js +1 -2
  301. package/dist/seed/model-composition-seed-data.js +6 -8
  302. package/dist/seed/part-glossary/chunk0.d.ts +9 -0
  303. package/dist/seed/part-glossary/chunk0.js +35448 -0
  304. package/dist/seed/part-glossary/chunk1.d.ts +9 -0
  305. package/dist/seed/part-glossary/chunk1.js +40494 -0
  306. package/dist/seed/part-glossary/chunk2.d.ts +9 -0
  307. package/dist/seed/part-glossary/chunk2.js +51242 -0
  308. package/dist/seed/part-glossary/chunk3.d.ts +9 -0
  309. package/dist/seed/part-glossary/chunk3.js +53337 -0
  310. package/dist/seed/part-glossary/chunk4.d.ts +9 -0
  311. package/dist/seed/part-glossary/chunk4.js +51454 -0
  312. package/dist/seed/part-glossary-seed-data.d.ts +1 -1
  313. package/dist/seed/part-glossary-seed-data.js +23 -47483
  314. package/dist/seed/products-beyblade-x-seed-data.js +36 -1
  315. package/dist/seed/site-settings-seed-data.js +34 -35
  316. package/dist/seed/store-extensions-seed-data.d.ts +1 -2
  317. package/dist/seed/store-extensions-seed-data.js +1 -23
  318. package/dist/seed/stores-seed-data.js +0 -1
  319. package/dist/server-entry.d.ts +1 -1
  320. package/dist/server-entry.js +1 -1
  321. package/dist/server.d.ts +10 -10
  322. package/dist/server.js +24 -22
  323. package/dist/styles.css +392 -43
  324. package/dist/tailwind-utilities.css +1 -1
  325. package/dist/tokens/themes/default-dark.js +1 -1
  326. package/dist/tokens/themes/default-light.js +2 -1
  327. package/dist/tokens/tokens.css +6 -2
  328. package/dist/ui/components/Button.d.ts +11 -0
  329. package/dist/ui/components/Button.js +11 -0
  330. package/dist/ui/components/Button.style.css +29 -0
  331. package/dist/ui/components/CarouselNav.d.ts +57 -0
  332. package/dist/ui/components/CarouselNav.js +25 -0
  333. package/dist/ui/components/CarouselNav.style.css +265 -0
  334. package/dist/ui/components/GatedPrice.js +30 -3
  335. package/dist/ui/components/GatedPrice.style.css +43 -40
  336. package/dist/ui/components/HorizontalScroller.d.ts +12 -1
  337. package/dist/ui/components/HorizontalScroller.js +43 -3
  338. package/dist/ui/components/ImageMosaic.d.ts +8 -1
  339. package/dist/ui/components/ImageMosaic.js +3 -2
  340. package/dist/ui/components/ImageMosaic.style.css +22 -0
  341. package/dist/ui/components/Layout.style.css +6 -0
  342. package/dist/ui/components/Semantic.d.ts +3 -2
  343. package/dist/ui/components/Semantic.js +1 -0
  344. package/dist/ui/components/Typography.d.ts +2 -0
  345. package/dist/ui/components/Typography.js +2 -0
  346. package/dist/ui/components/Typography.style.css +19 -0
  347. package/dist/ui/components/index.style.css +1 -0
  348. package/dist/ui/index.d.ts +3 -1
  349. package/dist/ui/index.js +4 -0
  350. package/package.json +3 -2
  351. package/scripts/seed-cli.mjs +133 -27
  352. package/dist/_internal/server/jobs/core/whatsappCatalogImport.d.ts +0 -27
  353. package/dist/_internal/server/jobs/core/whatsappCatalogImport.js +0 -172
  354. package/dist/_internal/server/jobs/core/whatsappNotify.d.ts +0 -35
  355. package/dist/_internal/server/jobs/core/whatsappNotify.js +0 -140
  356. package/dist/features/admin/components/AdminWhatsAppGuideView.d.ts +0 -2
  357. package/dist/features/admin/components/AdminWhatsAppGuideView.js +0 -35
  358. package/dist/features/orders/components/MarketplaceOrderCard.d.ts +0 -36
  359. package/dist/features/orders/components/MarketplaceOrderCard.js +0 -57
  360. package/dist/features/stores/components/StoreWhatsAppGuideView.d.ts +0 -3
  361. package/dist/features/stores/components/StoreWhatsAppGuideView.js +0 -12
  362. package/dist/features/whatsapp-bot/api/send-status/route.d.ts +0 -12
  363. package/dist/features/whatsapp-bot/api/send-status/route.js +0 -38
  364. package/dist/features/whatsapp-bot/api/webhook/route.d.ts +0 -12
  365. package/dist/features/whatsapp-bot/api/webhook/route.js +0 -43
  366. package/dist/features/whatsapp-bot/components/SellerWhatsAppSettingsView.d.ts +0 -6
  367. package/dist/features/whatsapp-bot/components/SellerWhatsAppSettingsView.js +0 -270
  368. package/dist/features/whatsapp-bot/components/WhatsAppChatButton.d.ts +0 -9
  369. package/dist/features/whatsapp-bot/components/WhatsAppChatButton.js +0 -7
  370. package/dist/features/whatsapp-bot/components/index.d.ts +0 -3
  371. package/dist/features/whatsapp-bot/components/index.js +0 -2
  372. package/dist/features/whatsapp-bot/helpers/payment-proof-message.d.ts +0 -14
  373. package/dist/features/whatsapp-bot/helpers/payment-proof-message.js +0 -17
  374. package/dist/features/whatsapp-bot/helpers/whatsapp.d.ts +0 -52
  375. package/dist/features/whatsapp-bot/helpers/whatsapp.js +0 -283
  376. package/dist/features/whatsapp-bot/index.d.ts +0 -3
  377. package/dist/features/whatsapp-bot/index.js +0 -3
  378. package/dist/features/whatsapp-bot/manifest.d.ts +0 -2
  379. package/dist/features/whatsapp-bot/manifest.js +0 -13
  380. package/dist/features/whatsapp-bot/messages/en.json +0 -7
  381. package/dist/features/whatsapp-bot/server.d.ts +0 -7
  382. package/dist/features/whatsapp-bot/server.js +0 -7
  383. package/dist/features/whatsapp-bot/types/index.d.ts +0 -126
  384. 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
- { id: "ti-1", icon: "🚚", title: "Free Shipping", description: "On orders above ₹999" },
183
- { id: "ti-2", icon: "🔒", title: "Secure Payment", description: "Razorpay protected checkout" },
184
- { id: "ti-3", icon: "✅", title: LABEL_VERIFIED_SELLERS, description: "Every store is manually verified" },
185
- { id: "ti-4", icon: "↩️", title: "Easy Returns", description: "7-day hassle-free returns" },
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
- { id: "trust-escrow", icon: "lock", title: "Money held until delivery", description: "We hold payment in escrow, so a claim pays from funds we already have." },
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: "⑭ Notifications";
87
- readonly description: "Which channels are on — email, WhatsApp, SMS — and the daily digest.";
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: "⑮ Procurement";
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: "⑯ EMI";
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: "⑰ GST";
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: "⑱ Listings";
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" | "whatsapp" | "branding" | "themes" | "fees" | "legal" | "procurement")[];
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: "⑭ Notifications",
120
- description: "Which channels are on — email, WhatsApp, SMS — and the daily digest.",
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: "⑮ Procurement",
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: "⑯ EMI",
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: "⑰ GST",
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: "⑱ Listings",
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. whatsappTemplates: Record<string,string>)
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.ZodString, "many">>;
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
- capabilities: annotate(z.array(z.string().min(1)).max(50).optional(), {
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, whatsappSettingsSchema, lotteryPullSchema,
17
+ * adminUserUpdateSchema, lotteryPullSchema,
22
18
  * and their inferred value types
23
19
  *
24
- * @tag domain:admin,whatsapp,lottery
20
+ * @tag domain:admin,lottery
25
21
  * @tag layer:schema
26
22
  * @tag pattern:none
27
23
  * @tag access:isomorphic
28
- * @tag consumers:AdminUserEditorView,SellerWhatsAppSettingsView,LotteryPullForm
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
  *