@mohasinac/appkit 3.0.4 → 3.1.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 (320) hide show
  1. package/dist/_internal/client/features/lottery/LotteryAdminEditView.d.ts +42 -0
  2. package/dist/_internal/client/features/lottery/LotteryAdminEditView.js +86 -0
  3. package/dist/_internal/client/features/lottery/LotteryAdminSlotView.d.ts +14 -0
  4. package/dist/_internal/client/features/lottery/LotteryAdminSlotView.js +46 -0
  5. package/dist/_internal/client/features/lottery/LotteryDetailView.d.ts +28 -0
  6. package/dist/_internal/client/features/lottery/LotteryDetailView.js +17 -0
  7. package/dist/_internal/client/features/lottery/LotteryEntriesView.d.ts +23 -0
  8. package/dist/_internal/client/features/lottery/LotteryEntriesView.js +58 -0
  9. package/dist/_internal/client/features/lottery/LotteryListView.d.ts +21 -0
  10. package/dist/_internal/client/features/lottery/LotteryListView.js +25 -0
  11. package/dist/_internal/client/features/lottery/LotteryPullForm.d.ts +19 -0
  12. package/dist/_internal/client/features/lottery/LotteryPullForm.js +65 -0
  13. package/dist/_internal/client/features/lottery/LotterySlotGrid.d.ts +13 -0
  14. package/dist/_internal/client/features/lottery/LotterySlotGrid.js +21 -0
  15. package/dist/_internal/client/features/lottery/PrizeDrawLotteryDetailView.d.ts +28 -0
  16. package/dist/_internal/client/features/lottery/PrizeDrawLotteryDetailView.js +18 -0
  17. package/dist/_internal/server/features/auctions/__tests__/service.test.d.ts +1 -0
  18. package/dist/_internal/server/features/auctions/__tests__/service.test.js +140 -0
  19. package/dist/_internal/server/features/auctions/data.d.ts +2 -4
  20. package/dist/_internal/server/features/auctions/data.js +3 -9
  21. package/dist/_internal/server/features/checkout/__tests__/actions.test.d.ts +1 -0
  22. package/dist/_internal/server/features/checkout/__tests__/actions.test.js +600 -0
  23. package/dist/_internal/server/features/classified/adapters.d.ts +2 -15
  24. package/dist/_internal/server/features/classified/adapters.js +2 -17
  25. package/dist/_internal/server/features/classified/data.d.ts +1 -6
  26. package/dist/_internal/server/features/classified/data.js +2 -10
  27. package/dist/_internal/server/features/digital-code/adapters.d.ts +2 -15
  28. package/dist/_internal/server/features/digital-code/adapters.js +2 -17
  29. package/dist/_internal/server/features/digital-code/data.d.ts +1 -6
  30. package/dist/_internal/server/features/digital-code/data.js +2 -10
  31. package/dist/_internal/server/features/live/adapters.d.ts +2 -15
  32. package/dist/_internal/server/features/live/adapters.js +2 -17
  33. package/dist/_internal/server/features/live/data.d.ts +1 -6
  34. package/dist/_internal/server/features/live/data.js +2 -10
  35. package/dist/_internal/server/features/lottery/actions.d.ts +43 -0
  36. package/dist/_internal/server/features/lottery/actions.js +243 -0
  37. package/dist/_internal/server/features/lottery/adapters.d.ts +9 -0
  38. package/dist/_internal/server/features/lottery/adapters.js +21 -0
  39. package/dist/_internal/server/features/lottery/data.d.ts +20 -0
  40. package/dist/_internal/server/features/lottery/data.js +41 -0
  41. package/dist/_internal/server/features/lottery/metadata.d.ts +6 -0
  42. package/dist/_internal/server/features/lottery/metadata.js +31 -0
  43. package/dist/_internal/server/features/pre-orders/data.d.ts +2 -4
  44. package/dist/_internal/server/features/pre-orders/data.js +3 -9
  45. package/dist/_internal/server/features/prize-draws/actions.d.ts +2 -0
  46. package/dist/_internal/server/features/prize-draws/actions.js +22 -0
  47. package/dist/_internal/server/features/prize-draws/data.d.ts +1 -17
  48. package/dist/_internal/server/features/prize-draws/data.js +2 -20
  49. package/dist/_internal/server/features/prize-draws/index.d.ts +3 -1
  50. package/dist/_internal/server/features/prize-draws/index.js +2 -0
  51. package/dist/_internal/server/features/prize-draws/service.d.ts +3 -0
  52. package/dist/_internal/server/features/prize-draws/service.js +19 -0
  53. package/dist/_internal/server/features/refunds/__tests__/actions.test.d.ts +1 -0
  54. package/dist/_internal/server/features/refunds/__tests__/actions.test.js +263 -0
  55. package/dist/_internal/server/features/shared/listing-adapters.d.ts +19 -0
  56. package/dist/_internal/server/features/shared/listing-adapters.js +20 -0
  57. package/dist/_internal/server/features/shared/listing-data-factory.d.ts +9 -0
  58. package/dist/_internal/server/features/shared/listing-data-factory.js +33 -0
  59. package/dist/_internal/server/features/stores/data.d.ts +3 -14
  60. package/dist/_internal/server/features/stores/data.js +6 -44
  61. package/dist/_internal/server/jobs/core/__tests__/auctionSettlement.test.d.ts +1 -0
  62. package/dist/_internal/server/jobs/core/__tests__/auctionSettlement.test.js +249 -0
  63. package/dist/_internal/server/jobs/core/__tests__/onBidPlaced.test.d.ts +1 -0
  64. package/dist/_internal/server/jobs/core/__tests__/onBidPlaced.test.js +201 -0
  65. package/dist/_internal/server/jobs/core/__tests__/onOrderCreate.test.d.ts +1 -0
  66. package/dist/_internal/server/jobs/core/__tests__/onOrderCreate.test.js +169 -0
  67. package/dist/_internal/server/jobs/core/__tests__/onOrderStatusChange.test.d.ts +1 -0
  68. package/dist/_internal/server/jobs/core/__tests__/onOrderStatusChange.test.js +148 -0
  69. package/dist/_internal/server/jobs/core/__tests__/onProductStockChange.test.d.ts +1 -0
  70. package/dist/_internal/server/jobs/core/__tests__/onProductStockChange.test.js +210 -0
  71. package/dist/_internal/server/jobs/core/__tests__/onReviewWrite.test.d.ts +1 -0
  72. package/dist/_internal/server/jobs/core/__tests__/onReviewWrite.test.js +190 -0
  73. package/dist/_internal/server/jobs/core/__tests__/onUserBanChange.test.d.ts +1 -0
  74. package/dist/_internal/server/jobs/core/__tests__/onUserBanChange.test.js +161 -0
  75. package/dist/_internal/server/jobs/core/__tests__/payoutBatch.test.d.ts +1 -0
  76. package/dist/_internal/server/jobs/core/__tests__/payoutBatch.test.js +302 -0
  77. package/dist/_internal/server/jobs/core/__tests__/triggerEventRaffle.test.d.ts +1 -0
  78. package/dist/_internal/server/jobs/core/__tests__/triggerEventRaffle.test.js +252 -0
  79. package/dist/_internal/server/jobs/core/__tests__/wrapJobHandler.test.d.ts +1 -0
  80. package/dist/_internal/server/jobs/core/__tests__/wrapJobHandler.test.js +129 -0
  81. package/dist/_internal/shared/actions/action-registry.d.ts +1 -1
  82. package/dist/_internal/shared/actions/action-registry.js +46 -0
  83. package/dist/_internal/shared/features/cart/schema.d.ts +8 -8
  84. package/dist/_internal/shared/features/cart/schema.js +3 -0
  85. package/dist/_internal/shared/features/products/schema.d.ts +8 -8
  86. package/dist/_internal/shared/listing-types/_registry.js +2 -0
  87. package/dist/_internal/shared/listing-types/auction/schema.d.ts +3 -1
  88. package/dist/_internal/shared/listing-types/auction/schema.js +7 -1
  89. package/dist/_internal/shared/listing-types/classified/schema.d.ts +2 -1
  90. package/dist/_internal/shared/listing-types/classified/schema.js +3 -1
  91. package/dist/_internal/shared/listing-types/digital-code/schema.d.ts +3 -1
  92. package/dist/_internal/shared/listing-types/digital-code/schema.js +7 -1
  93. package/dist/_internal/shared/listing-types/live/schema.d.ts +2 -1
  94. package/dist/_internal/shared/listing-types/live/schema.js +3 -1
  95. package/dist/_internal/shared/listing-types/pre-order/schema.d.ts +3 -1
  96. package/dist/_internal/shared/listing-types/pre-order/schema.js +7 -1
  97. package/dist/_internal/shared/listing-types/prize-draw/schema.d.ts +3 -1
  98. package/dist/_internal/shared/listing-types/prize-draw/schema.js +13 -1
  99. package/dist/_internal/shared/listing-types/standard/schema.d.ts +2 -1
  100. package/dist/_internal/shared/listing-types/standard/schema.js +4 -1
  101. package/dist/_internal/shared/types/base-document.d.ts +15 -0
  102. package/dist/_internal/shared/types/base-document.js +1 -0
  103. package/dist/_internal/shared/types/index.d.ts +2 -0
  104. package/dist/_internal/shared/types/index.js +1 -0
  105. package/dist/client.d.ts +13 -4
  106. package/dist/client.js +11 -2
  107. package/dist/constants/api-endpoints.d.ts +12 -0
  108. package/dist/constants/api-endpoints.js +4 -0
  109. package/dist/constants/field-names.d.ts +5 -1
  110. package/dist/constants/field-names.js +5 -1
  111. package/dist/features/addresses/repository/__tests__/addresses.repository.test.d.ts +1 -0
  112. package/dist/features/addresses/repository/__tests__/addresses.repository.test.js +386 -0
  113. package/dist/features/addresses/schemas/firestore.d.ts +2 -4
  114. package/dist/features/admin/api/bids/route.d.ts +2 -2
  115. package/dist/features/admin/api/coupons/route.d.ts +2 -2
  116. package/dist/features/admin/api/products/route.d.ts +2 -2
  117. package/dist/features/admin/api/reviews/route.d.ts +2 -2
  118. package/dist/features/admin/components/AdminFulfillmentView.d.ts +6 -0
  119. package/dist/features/admin/components/AdminFulfillmentView.js +107 -0
  120. package/dist/features/admin/components/AdminProductEditorView.js +21 -9
  121. package/dist/features/admin/components/AdminProductsView.js +3 -0
  122. package/dist/features/admin/components/DataListingView.d.ts +1 -0
  123. package/dist/features/admin/components/index.d.ts +2 -0
  124. package/dist/features/admin/components/index.js +1 -0
  125. package/dist/features/admin/repository/__tests__/notification.repository.test.d.ts +1 -0
  126. package/dist/features/admin/repository/__tests__/notification.repository.test.js +356 -0
  127. package/dist/features/admin/repository/__tests__/site-settings.repository.test.d.ts +1 -0
  128. package/dist/features/admin/repository/__tests__/site-settings.repository.test.js +298 -0
  129. package/dist/features/admin/schemas/firestore.d.ts +3 -8
  130. package/dist/features/auctions/repository/__tests__/bid.repository.test.d.ts +1 -0
  131. package/dist/features/auctions/repository/__tests__/bid.repository.test.js +290 -0
  132. package/dist/features/auctions/schemas/firestore.d.ts +2 -4
  133. package/dist/features/auctions/schemas/index.d.ts +2 -2
  134. package/dist/features/auth/api/route.d.ts +2 -2
  135. package/dist/features/auth/repository/__tests__/session.repository.test.d.ts +1 -0
  136. package/dist/features/auth/repository/__tests__/session.repository.test.js +310 -0
  137. package/dist/features/auth/repository/__tests__/session.test.d.ts +1 -0
  138. package/dist/features/auth/repository/__tests__/session.test.js +146 -0
  139. package/dist/features/auth/repository/__tests__/sms-counter.repository.test.d.ts +1 -0
  140. package/dist/features/auth/repository/__tests__/sms-counter.repository.test.js +171 -0
  141. package/dist/features/auth/repository/__tests__/sms-counter.test.d.ts +1 -0
  142. package/dist/features/auth/repository/__tests__/sms-counter.test.js +88 -0
  143. package/dist/features/auth/repository/__tests__/token.repository.test.d.ts +1 -0
  144. package/dist/features/auth/repository/__tests__/token.repository.test.js +260 -0
  145. package/dist/features/auth/repository/__tests__/token.test.d.ts +1 -0
  146. package/dist/features/auth/repository/__tests__/token.test.js +140 -0
  147. package/dist/features/auth/repository/__tests__/user.repository.test.d.ts +1 -0
  148. package/dist/features/auth/repository/__tests__/user.repository.test.js +352 -0
  149. package/dist/features/auth/repository/__tests__/user.test.d.ts +1 -0
  150. package/dist/features/auth/repository/__tests__/user.test.js +226 -0
  151. package/dist/features/auth/repository/session.repository.js +10 -1
  152. package/dist/features/before-after/schemas/index.d.ts +2 -2
  153. package/dist/features/blog/schemas/firestore.d.ts +2 -4
  154. package/dist/features/blog/schemas/index.d.ts +4 -4
  155. package/dist/features/cart/repository/__tests__/cart.repository.test.d.ts +1 -0
  156. package/dist/features/cart/repository/__tests__/cart.repository.test.js +371 -0
  157. package/dist/features/cart/repository/cart.repository.js +2 -2
  158. package/dist/features/cart/schemas/firestore.d.ts +2 -4
  159. package/dist/features/categories/api/[id]/route.d.ts +4 -4
  160. package/dist/features/categories/api/route.d.ts +2 -2
  161. package/dist/features/categories/repository/__tests__/categories.repository.test.d.ts +1 -0
  162. package/dist/features/categories/repository/__tests__/categories.repository.test.js +813 -0
  163. package/dist/features/categories/schemas/firestore.d.ts +2 -4
  164. package/dist/features/categories/schemas/index.d.ts +4 -4
  165. package/dist/features/events/components/EventCard.js +1 -0
  166. package/dist/features/events/repository/__tests__/event.repository.test.d.ts +1 -0
  167. package/dist/features/events/repository/__tests__/event.repository.test.js +299 -0
  168. package/dist/features/events/schemas/firestore.d.ts +5 -4
  169. package/dist/features/events/schemas/index.d.ts +836 -16
  170. package/dist/features/events/schemas/index.js +80 -1
  171. package/dist/features/events/types/index.d.ts +4 -1
  172. package/dist/features/faq/repository/__tests__/faqs.repository.test.d.ts +1 -0
  173. package/dist/features/faq/repository/__tests__/faqs.repository.test.js +311 -0
  174. package/dist/features/faq/schemas/firestore.d.ts +2 -4
  175. package/dist/features/faq/schemas/index.d.ts +2 -2
  176. package/dist/features/grouped/schemas/index.d.ts +2 -2
  177. package/dist/features/history/repository/__tests__/user-history.repository.test.d.ts +1 -0
  178. package/dist/features/history/repository/__tests__/user-history.repository.test.js +180 -0
  179. package/dist/features/homepage/api/[id]/route.d.ts +4 -4
  180. package/dist/features/homepage/api/carousel/[id]/route.d.ts +4 -4
  181. package/dist/features/homepage/api/carousel/route.d.ts +2 -2
  182. package/dist/features/homepage/api/route.d.ts +2 -2
  183. package/dist/features/homepage/repository/__tests__/carousel.repository.test.d.ts +1 -0
  184. package/dist/features/homepage/repository/__tests__/carousel.repository.test.js +182 -0
  185. package/dist/features/homepage/repository/__tests__/homepage-sections.repository.test.d.ts +1 -0
  186. package/dist/features/homepage/repository/__tests__/homepage-sections.repository.test.js +185 -0
  187. package/dist/features/homepage/schemas/firestore.d.ts +4 -12
  188. package/dist/features/homepage/schemas/index.d.ts +2 -2
  189. package/dist/features/lottery/repository/lottery-entry.repository.d.ts +33 -0
  190. package/dist/features/lottery/repository/lottery-entry.repository.js +130 -0
  191. package/dist/features/lottery/schemas/firestore.d.ts +49 -0
  192. package/dist/features/lottery/schemas/firestore.js +25 -0
  193. package/dist/features/lottery/schemas/zod.d.ts +113 -0
  194. package/dist/features/lottery/schemas/zod.js +39 -0
  195. package/dist/features/lottery/types/index.d.ts +67 -0
  196. package/dist/features/lottery/types/index.js +55 -0
  197. package/dist/features/messages/repository/__tests__/conversations.repository.test.d.ts +1 -0
  198. package/dist/features/messages/repository/__tests__/conversations.repository.test.js +257 -0
  199. package/dist/features/messages/schemas/firestore.d.ts +2 -4
  200. package/dist/features/messages/schemas/index.d.ts +2 -2
  201. package/dist/features/orders/repository/__tests__/orders.repository.test.d.ts +1 -0
  202. package/dist/features/orders/repository/__tests__/orders.repository.test.js +211 -0
  203. package/dist/features/orders/repository/orders.repository.d.ts +5 -0
  204. package/dist/features/orders/repository/orders.repository.js +26 -0
  205. package/dist/features/orders/schemas/firestore.d.ts +9 -5
  206. package/dist/features/orders/schemas/firestore.js +3 -0
  207. package/dist/features/payments/repository/__tests__/payout.repository.test.d.ts +1 -0
  208. package/dist/features/payments/repository/__tests__/payout.repository.test.js +292 -0
  209. package/dist/features/payments/schemas/firestore.d.ts +2 -4
  210. package/dist/features/pre-orders/schemas/index.d.ts +2 -2
  211. package/dist/features/products/api/[id]/route.d.ts +4 -4
  212. package/dist/features/products/api/route.d.ts +2 -2
  213. package/dist/features/products/constants/action-defs.d.ts +16 -0
  214. package/dist/features/products/constants/action-defs.js +16 -0
  215. package/dist/features/products/constants/listing-tabs.d.ts +48 -0
  216. package/dist/features/products/constants/listing-tabs.js +12 -0
  217. package/dist/features/products/repository/__tests__/product-features.repository.test.d.ts +1 -0
  218. package/dist/features/products/repository/__tests__/product-features.repository.test.js +329 -0
  219. package/dist/features/products/repository/__tests__/products.repository.test.d.ts +1 -0
  220. package/dist/features/products/repository/__tests__/products.repository.test.js +607 -0
  221. package/dist/features/products/repository/products.repository.d.ts +37 -0
  222. package/dist/features/products/repository/products.repository.js +28 -1
  223. package/dist/features/products/schemas/firestore.d.ts +23 -7
  224. package/dist/features/products/schemas/firestore.js +2 -0
  225. package/dist/features/products/schemas/index.d.ts +18 -18
  226. package/dist/features/products/schemas/index.js +4 -2
  227. package/dist/features/products/types/index.d.ts +3 -1
  228. package/dist/features/promotions/repository/__tests__/claimed-coupons.repository.test.d.ts +1 -0
  229. package/dist/features/promotions/repository/__tests__/claimed-coupons.repository.test.js +219 -0
  230. package/dist/features/promotions/repository/__tests__/coupons.repository.test.d.ts +1 -0
  231. package/dist/features/promotions/repository/__tests__/coupons.repository.test.js +480 -0
  232. package/dist/features/promotions/schemas/firestore.d.ts +2 -4
  233. package/dist/features/promotions/schemas/index.d.ts +4 -4
  234. package/dist/features/reviews/api/[id]/route.d.ts +4 -4
  235. package/dist/features/reviews/api/route.d.ts +2 -2
  236. package/dist/features/reviews/repository/__tests__/reviews.repository.test.d.ts +1 -0
  237. package/dist/features/reviews/repository/__tests__/reviews.repository.test.js +327 -0
  238. package/dist/features/reviews/schemas/firestore.d.ts +2 -4
  239. package/dist/features/reviews/schemas/index.d.ts +2 -2
  240. package/dist/features/scams/repository/__tests__/scammer.repository.test.d.ts +1 -0
  241. package/dist/features/scams/repository/__tests__/scammer.repository.test.js +385 -0
  242. package/dist/features/scams/schemas/firestore.d.ts +2 -4
  243. package/dist/features/scams/schemas/index.d.ts +4 -4
  244. package/dist/features/search/repository/__tests__/search.repository.test.d.ts +1 -0
  245. package/dist/features/search/repository/__tests__/search.repository.test.js +369 -0
  246. package/dist/features/search/schemas/index.d.ts +2 -2
  247. package/dist/features/seller/api/coupons/route.d.ts +2 -2
  248. package/dist/features/seller/api/offers/route.d.ts +2 -2
  249. package/dist/features/seller/api/products/route.d.ts +2 -2
  250. package/dist/features/seller/api/store/route.d.ts +2 -2
  251. package/dist/features/seller/components/BarcodeField.d.ts +17 -0
  252. package/dist/features/seller/components/BarcodeField.js +30 -0
  253. package/dist/features/seller/components/FulfillmentView.d.ts +5 -0
  254. package/dist/features/seller/components/FulfillmentView.js +120 -0
  255. package/dist/features/seller/components/PrintCenterView.d.ts +3 -1
  256. package/dist/features/seller/components/PrintCenterView.js +52 -4
  257. package/dist/features/seller/components/SellerProductShell.d.ts +2 -0
  258. package/dist/features/seller/components/SellerProductShell.js +2 -1
  259. package/dist/features/seller/components/index.d.ts +4 -0
  260. package/dist/features/seller/components/index.js +2 -0
  261. package/dist/features/seller/repository/__tests__/offer.repository.test.d.ts +1 -0
  262. package/dist/features/seller/repository/__tests__/offer.repository.test.js +458 -0
  263. package/dist/features/seller/schemas/index.d.ts +2 -2
  264. package/dist/features/store-extensions/schemas/firestore.d.ts +12 -44
  265. package/dist/features/stores/components/StoreClassifiedsListing.d.ts +5 -0
  266. package/dist/features/stores/components/StoreClassifiedsListing.js +48 -0
  267. package/dist/features/stores/components/StoreClassifiedsPageView.d.ts +4 -0
  268. package/dist/features/stores/components/StoreClassifiedsPageView.js +20 -0
  269. package/dist/features/stores/components/StoreDetailLayoutView.js +23 -2
  270. package/dist/features/stores/components/StoreDigitalCodesListing.d.ts +5 -0
  271. package/dist/features/stores/components/StoreDigitalCodesListing.js +48 -0
  272. package/dist/features/stores/components/StoreDigitalCodesPageView.d.ts +4 -0
  273. package/dist/features/stores/components/StoreDigitalCodesPageView.js +20 -0
  274. package/dist/features/stores/components/StoreLiveItemsListing.d.ts +5 -0
  275. package/dist/features/stores/components/StoreLiveItemsListing.js +48 -0
  276. package/dist/features/stores/components/StoreLiveItemsPageView.d.ts +4 -0
  277. package/dist/features/stores/components/StoreLiveItemsPageView.js +20 -0
  278. package/dist/features/stores/components/index.d.ts +9 -0
  279. package/dist/features/stores/components/index.js +3 -0
  280. package/dist/features/stores/repository/__tests__/store.repository.test.d.ts +1 -0
  281. package/dist/features/stores/repository/__tests__/store.repository.test.js +261 -0
  282. package/dist/features/stores/schemas/firestore.d.ts +2 -4
  283. package/dist/features/stores/schemas/index.d.ts +4 -4
  284. package/dist/features/support/repository/__tests__/support.repository.test.d.ts +1 -0
  285. package/dist/features/support/repository/__tests__/support.repository.test.js +312 -0
  286. package/dist/features/support/schemas/firestore.d.ts +2 -4
  287. package/dist/features/support/schemas/index.d.ts +2 -2
  288. package/dist/features/wishlist/repository/__tests__/user-wishlist.repository.test.d.ts +1 -0
  289. package/dist/features/wishlist/repository/__tests__/user-wishlist.repository.test.js +139 -0
  290. package/dist/index.d.ts +14 -0
  291. package/dist/index.js +17 -0
  292. package/dist/next/api/routeHandler.d.ts +1 -1
  293. package/dist/next/routing/route-map.d.ts +24 -0
  294. package/dist/next/routing/route-map.js +11 -0
  295. package/dist/repositories/index.d.ts +1 -0
  296. package/dist/repositories/index.js +2 -0
  297. package/dist/schemas/registry.d.ts +24 -24
  298. package/dist/security/index.d.ts +1 -1
  299. package/dist/security/index.js +1 -1
  300. package/dist/security/pii-schemas.d.ts +2 -0
  301. package/dist/security/pii-schemas.js +6 -0
  302. package/dist/seed/actions/demo-seed-actions.d.ts +1 -1
  303. package/dist/seed/events-seed-data.js +85 -2
  304. package/dist/seed/grouped-listings-seed-data.d.ts +5 -2
  305. package/dist/seed/index.d.ts +1 -0
  306. package/dist/seed/index.js +1 -0
  307. package/dist/seed/lottery-entries-seed-data.d.ts +2 -0
  308. package/dist/seed/lottery-entries-seed-data.js +108 -0
  309. package/dist/seed/manifest.js +1 -0
  310. package/dist/seed/products-preorders-seed-data.d.ts +5 -2
  311. package/dist/seed/products-standard-seed-data.js +8 -0
  312. package/dist/server-entry.d.ts +3 -0
  313. package/dist/server-entry.js +3 -0
  314. package/dist/server.d.ts +10 -4
  315. package/dist/server.js +6 -0
  316. package/dist/styles.css +1 -1
  317. package/dist/tailwind-utilities.css +1 -1
  318. package/dist/utils/id-generators.d.ts +8 -0
  319. package/dist/utils/id-generators.js +14 -0
  320. package/package.json +2 -1
@@ -1,4 +1,5 @@
1
1
  import type { FirestoreDocument } from "@mohasinac/appkit";
2
+ import type { BaseDocument } from "../../../_internal/shared/types/base-document";
2
3
  /**
3
4
  * S-STORE Extensions — Firestore Document Types
4
5
  *
@@ -20,8 +21,7 @@ import type { FirestoreDocument } from "@mohasinac/appkit";
20
21
  * 11. storeGoogleConfig — per-store Google Business reviews integration
21
22
  */
22
23
  export type PayoutMethodType = "upi" | "bank" | "card" | "other";
23
- export interface PayoutMethodDocument {
24
- id: string;
24
+ export interface PayoutMethodDocument extends BaseDocument {
25
25
  sellerId: string;
26
26
  storeId: string;
27
27
  type: PayoutMethodType;
@@ -34,15 +34,12 @@ export interface PayoutMethodDocument {
34
34
  accountHolderName?: string;
35
35
  bankName?: string;
36
36
  details?: Record<string, string>;
37
- createdAt: Date;
38
- updatedAt: Date;
39
37
  }
40
38
  export declare const PAYOUT_METHODS_COLLECTION: "payoutMethods";
41
39
  export declare const PAYOUT_METHOD_INDEXED_FIELDS: readonly ["sellerId", "storeId", "type", "isDefault", "isActive", "createdAt"];
42
40
  export declare const DEFAULT_PAYOUT_METHOD_DATA: Partial<PayoutMethodDocument>;
43
41
  export type ShippingMethod = "free" | "flat" | "weight" | "express" | "pickup" | "custom";
44
- export interface ShippingConfigDocument {
45
- id: string;
42
+ export interface ShippingConfigDocument extends BaseDocument {
46
43
  storeId: string;
47
44
  label: string;
48
45
  method: ShippingMethod;
@@ -54,16 +51,13 @@ export interface ShippingConfigDocument {
54
51
  expressSurchargeInPaise?: number;
55
52
  estimatedDays?: number;
56
53
  zones?: string[];
57
- createdAt: Date;
58
- updatedAt: Date;
59
54
  }
60
55
  export declare const SHIPPING_CONFIGS_COLLECTION: "shippingConfigs";
61
56
  export declare const SHIPPING_CONFIG_INDEXED_FIELDS: readonly ["storeId", "method", "isDefault", "isActive", "createdAt"];
62
57
  export declare const DEFAULT_SHIPPING_CONFIG_DATA: Partial<ShippingConfigDocument>;
63
58
  export type AnalyticsScope = "seller" | "admin";
64
59
  export type AnalyticsCardType = "metric" | "line" | "bar" | "pie" | "table" | "custom";
65
- export interface AnalyticsCardDocument {
66
- id: string;
60
+ export interface AnalyticsCardDocument extends BaseDocument {
67
61
  scope: AnalyticsScope;
68
62
  ownerId: string;
69
63
  title: string;
@@ -73,15 +67,12 @@ export interface AnalyticsCardDocument {
73
67
  position: number;
74
68
  isBuiltIn: boolean;
75
69
  isVisible: boolean;
76
- createdAt: Date;
77
- updatedAt: Date;
78
70
  }
79
71
  export declare const ANALYTICS_CARDS_COLLECTION: "analyticsCards";
80
72
  export declare const ANALYTICS_CARD_INDEXED_FIELDS: readonly ["scope", "ownerId", "isVisible", "position", "createdAt"];
81
73
  export declare const DEFAULT_ANALYTICS_CARD_DATA: Partial<AnalyticsCardDocument>;
82
74
  export type AlertOperator = ">" | "<" | ">=" | "<=" | "==" | "!=";
83
- export interface AnalyticsAlertDocument {
84
- id: string;
75
+ export interface AnalyticsAlertDocument extends BaseDocument {
85
76
  scope: AnalyticsScope;
86
77
  ownerId: string;
87
78
  label: string;
@@ -92,14 +83,11 @@ export interface AnalyticsAlertDocument {
92
83
  isActive: boolean;
93
84
  notifyChannels: Array<"in-app" | "email" | "whatsapp">;
94
85
  lastTriggeredAt?: Date;
95
- createdAt: Date;
96
- updatedAt: Date;
97
86
  }
98
87
  export declare const ANALYTICS_ALERTS_COLLECTION: "analyticsAlerts";
99
88
  export declare const ANALYTICS_ALERT_INDEXED_FIELDS: readonly ["scope", "ownerId", "isActive", "metric", "createdAt"];
100
89
  export declare const DEFAULT_ANALYTICS_ALERT_DATA: Partial<AnalyticsAlertDocument>;
101
- export interface StoreCategoryDocument {
102
- id: string;
90
+ export interface StoreCategoryDocument extends BaseDocument {
103
91
  storeId: string;
104
92
  label: string;
105
93
  slug: string;
@@ -108,15 +96,12 @@ export interface StoreCategoryDocument {
108
96
  isActive: boolean;
109
97
  description?: string;
110
98
  coverImageUrl?: string;
111
- createdAt: Date;
112
- updatedAt: Date;
113
99
  }
114
100
  export declare const STORE_CATEGORIES_COLLECTION: "storeCategories";
115
101
  export declare const STORE_CATEGORY_INDEXED_FIELDS: readonly ["storeId", "slug", "isActive", "displayOrder", "createdAt"];
116
102
  export declare const DEFAULT_STORE_CATEGORY_DATA: Partial<StoreCategoryDocument>;
117
103
  export type ListingTemplateType = "standard" | "auction" | "pre-order" | "prize-draw" | "bundle" | "classified" | "digital-code" | "live";
118
- export interface ListingTemplateDocument {
119
- id: string;
104
+ export interface ListingTemplateDocument extends BaseDocument {
120
105
  storeId: string;
121
106
  ownerId: string;
122
107
  name: string;
@@ -127,16 +112,13 @@ export interface ListingTemplateDocument {
127
112
  isShared: boolean;
128
113
  isActive: boolean;
129
114
  usageCount: number;
130
- createdAt: Date;
131
- updatedAt: Date;
132
115
  }
133
116
  export declare const LISTING_TEMPLATES_COLLECTION: "listingTemplates";
134
117
  export declare const LISTING_TEMPLATE_INDEXED_FIELDS: readonly ["storeId", "ownerId", "listingType", "isShared", "isActive", "createdAt"];
135
118
  export declare const DEFAULT_LISTING_TEMPLATE_DATA: Partial<ListingTemplateDocument>;
136
119
  export type ModerationStatus = "pending" | "approved" | "rejected" | "auto-approved";
137
120
  export type ModerationMediaType = "video" | "image" | "rich-text";
138
- export interface ModerationQueueDocument {
139
- id: string;
121
+ export interface ModerationQueueDocument extends BaseDocument {
140
122
  mediaType: ModerationMediaType;
141
123
  mediaUrl?: string;
142
124
  thumbnailUrl?: string;
@@ -149,8 +131,6 @@ export interface ModerationQueueDocument {
149
131
  reviewerId?: string;
150
132
  reviewedAt?: Date;
151
133
  submittedAt: Date;
152
- createdAt: Date;
153
- updatedAt: Date;
154
134
  }
155
135
  export declare const MODERATION_QUEUE_COLLECTION: "moderationQueue";
156
136
  export declare const MODERATION_QUEUE_INDEXED_FIELDS: readonly ["status", "mediaType", "entityType", "entityId", "storeId", "ownerId", "submittedAt", "createdAt"];
@@ -158,8 +138,7 @@ export declare const DEFAULT_MODERATION_QUEUE_DATA: Partial<ModerationQueueDocum
158
138
  export type ReportEntityType = "product" | "store" | "review" | "event" | "user" | "blog" | "comment";
159
139
  export type ReportStatus = "pending" | "under-review" | "actioned" | "dismissed";
160
140
  export type ReportReason = "scam" | "counterfeit" | "prohibited" | "inappropriate" | "harassment" | "spam" | "ip-violation" | "other";
161
- export interface ReportDocument {
162
- id: string;
141
+ export interface ReportDocument extends BaseDocument {
163
142
  entityType: ReportEntityType;
164
143
  entityId: string;
165
144
  reporterId: string;
@@ -171,8 +150,6 @@ export interface ReportDocument {
171
150
  assignedTo?: string;
172
151
  resolution?: string;
173
152
  resolvedAt?: Date;
174
- createdAt: Date;
175
- updatedAt: Date;
176
153
  }
177
154
  export declare const REPORTS_COLLECTION: "reports";
178
155
  export declare const REPORT_INDEXED_FIELDS: readonly ["entityType", "entityId", "reporterId", "reason", "status", "createdAt"];
@@ -186,8 +163,7 @@ export interface ItemRequestReply {
186
163
  isOpInitiatedThread: boolean;
187
164
  createdAt: Date;
188
165
  }
189
- export interface ItemRequestDocument {
190
- id: string;
166
+ export interface ItemRequestDocument extends BaseDocument {
191
167
  opUserId: string;
192
168
  opDisplayName: string;
193
169
  title: string;
@@ -203,14 +179,11 @@ export interface ItemRequestDocument {
203
179
  approvedAt?: Date;
204
180
  approvedBy?: string;
205
181
  closedAt?: Date;
206
- createdAt: Date;
207
- updatedAt: Date;
208
182
  }
209
183
  export declare const ITEM_REQUESTS_COLLECTION: "itemRequests";
210
184
  export declare const ITEM_REQUEST_INDEXED_FIELDS: readonly ["opUserId", "status", "category", "createdAt"];
211
185
  export declare const DEFAULT_ITEM_REQUEST_DATA: Partial<ItemRequestDocument>;
212
- export interface StoreWhatsAppConfigDocument {
213
- id: string;
186
+ export interface StoreWhatsAppConfigDocument extends BaseDocument {
214
187
  storeId: string;
215
188
  isConnected: boolean;
216
189
  isPaid: boolean;
@@ -221,14 +194,11 @@ export interface StoreWhatsAppConfigDocument {
221
194
  welcomeMessage?: string;
222
195
  /** Status of pending WhatsApp Business onboarding (Meta Cloud API). */
223
196
  onboardingStatus?: "pending" | "approved" | "rejected";
224
- createdAt: Date;
225
- updatedAt: Date;
226
197
  }
227
198
  export declare const STORE_WHATSAPP_CONFIG_COLLECTION: "storeWhatsAppConfig";
228
199
  export declare const STORE_WHATSAPP_CONFIG_INDEXED_FIELDS: readonly ["storeId", "isConnected", "isPaid"];
229
200
  export declare const DEFAULT_STORE_WHATSAPP_CONFIG_DATA: Partial<StoreWhatsAppConfigDocument>;
230
- export interface StoreGoogleConfigDocument {
231
- id: string;
201
+ export interface StoreGoogleConfigDocument extends BaseDocument {
232
202
  storeId: string;
233
203
  isConnected: boolean;
234
204
  placeId?: string;
@@ -237,8 +207,6 @@ export interface StoreGoogleConfigDocument {
237
207
  totalReviews?: number;
238
208
  lastSyncedAt?: Date;
239
209
  oauthRefreshToken?: string;
240
- createdAt: Date;
241
- updatedAt: Date;
242
210
  }
243
211
  export declare const STORE_GOOGLE_CONFIG_COLLECTION: "storeGoogleConfig";
244
212
  export declare const STORE_GOOGLE_CONFIG_INDEXED_FIELDS: readonly ["storeId", "isConnected"];
@@ -0,0 +1,5 @@
1
+ export interface StoreClassifiedsListingProps {
2
+ storeId?: string;
3
+ initialData?: any;
4
+ }
5
+ export declare function StoreClassifiedsListing({ storeId, initialData }: StoreClassifiedsListingProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState, useCallback } from "react";
4
+ import { useUrlTable } from "../../../react/hooks/useUrlTable";
5
+ import { usePendingTable } from "../../../react/hooks/usePendingTable";
6
+ import { useProducts } from "../../products/hooks/useProducts";
7
+ import { Div, FilterDrawer, ListingToolbar, Pagination, Row, Text } from "../../../ui";
8
+ import { ClassifiedFilters } from "../../classified/components/ClassifiedFilters";
9
+ import { InteractiveProductCard } from "../../products/components/InteractiveProductCard";
10
+ import { PRODUCT_FIELDS } from "../../../constants/field-names";
11
+ import { TABLE_KEYS } from "../../../constants/table-keys";
12
+ import { sortBy } from "../../../constants/sort";
13
+ import { ROUTES } from "../../../next";
14
+ const DEFAULT_SORT = sortBy(PRODUCT_FIELDS.CREATED_AT);
15
+ const SORT_OPTIONS = [
16
+ { value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Newest First" },
17
+ { value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest First" },
18
+ { value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: "Price: Low to High" },
19
+ { value: sortBy(PRODUCT_FIELDS.PRICE), label: "Price: High to Low" },
20
+ ];
21
+ const FILTER_KEYS = [TABLE_KEYS.MIN_PRICE, TABLE_KEYS.MAX_PRICE, TABLE_KEYS.NEGOTIABLE, TABLE_KEYS.ACCEPTS_SHIPPING];
22
+ export function StoreClassifiedsListing({ storeId, initialData }) {
23
+ const table = useUrlTable({ defaults: { pageSize: "24", sort: DEFAULT_SORT } });
24
+ const [searchInput, setSearchInput] = useState(table.get("q") || "");
25
+ const [filterOpen, setFilterOpen] = useState(false);
26
+ const { pendingTable, filterActiveCount, onFilterApply, onFilterClear, onResetAll, onFilterReset } = usePendingTable(table, FILTER_KEYS);
27
+ const openFilters = useCallback(() => { onFilterReset(); setFilterOpen(true); }, [onFilterReset]);
28
+ const applyFilters = useCallback(() => { onFilterApply(); setFilterOpen(false); }, [onFilterApply]);
29
+ const resetAll = useCallback(() => { onResetAll({ q: "", sort: "" }); setSearchInput(""); }, [onResetAll]);
30
+ const hasActiveState = !!table.get("q") || table.get("sort") !== DEFAULT_SORT || filterActiveCount > 0;
31
+ const params = {
32
+ q: table.get("q") || undefined,
33
+ minPrice: table.get(TABLE_KEYS.MIN_PRICE) ? Number(table.get(TABLE_KEYS.MIN_PRICE)) : undefined,
34
+ maxPrice: table.get(TABLE_KEYS.MAX_PRICE) ? Number(table.get(TABLE_KEYS.MAX_PRICE)) : undefined,
35
+ sort: table.get("sort") || DEFAULT_SORT,
36
+ page: table.getNumber("page", 1),
37
+ perPage: table.getNumber("pageSize", 24),
38
+ storeId: storeId || undefined,
39
+ listingType: "classified",
40
+ };
41
+ const { products, totalPages, page, isLoading } = useProducts(params, { initialData });
42
+ const gridClass = "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4";
43
+ return (_jsxs(Div, { className: "min-h-[200px]", children: [_jsx(ListingToolbar, { filterCount: filterActiveCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search store classifieds\u2026", onSearchChange: setSearchInput, onSearchCommit: () => table.set("q", searchInput.trim()), sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => table.set("sort", v), onResetAll: resetAll, hasActiveState: hasActiveState }), totalPages > 1 && (_jsx(Row, { border: "bottom", className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 backdrop-blur-sm", surface: "default", padding: "toolbar", justify: "center", children: _jsx(Pagination, { currentPage: page, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsx(Div, { padding: "y-lg", children: _jsx(Div, { className: gridClass, children: isLoading
44
+ ? Array.from({ length: 8 }).map((_, i) => _jsx(Div, { surface: "muted", rounded: "xl", className: "aspect-square animate-pulse" }, i))
45
+ : products.length === 0
46
+ ? _jsx(Div, { paddingY: "y-4xl", className: "col-span-full text-center", children: _jsx(Text, { color: "muted", children: "No classified listings in this store yet." }) })
47
+ : products.map((p) => (_jsx(InteractiveProductCard, { product: p, href: String(ROUTES.PUBLIC.CLASSIFIED_DETAIL(p.slug ?? p.id)) }, p.id))) }) }), _jsx(FilterDrawer, { open: filterOpen, onOpen: openFilters, onClose: () => setFilterOpen(false), onApply: applyFilters, onReset: onFilterClear, activeCount: filterActiveCount, hideTrigger: true, children: _jsx(ClassifiedFilters, { table: pendingTable, currencyPrefix: "\u20B9" }) })] }));
48
+ }
@@ -0,0 +1,4 @@
1
+ export interface StoreClassifiedsPageViewProps {
2
+ storeSlug: string;
3
+ }
4
+ export declare function StoreClassifiedsPageView({ storeSlug }: StoreClassifiedsPageViewProps): Promise<import("react/jsx-runtime").JSX.Element | null>;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { sieveFilter, sieveAnd, SIEVE_OP, sortBy, PRODUCT_FIELDS } from "@mohasinac/appkit";
3
+ import { productRepository } from "../../../repositories";
4
+ import { getStoreBySlug } from "./StoreDetailLayoutView";
5
+ import { StoreClassifiedsListing } from "./StoreClassifiedsListing";
6
+ export async function StoreClassifiedsPageView({ storeSlug }) {
7
+ const store = await getStoreBySlug(storeSlug);
8
+ const storeId = store?.id;
9
+ if (!storeId)
10
+ return null;
11
+ const result = await productRepository
12
+ .list({
13
+ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "classified")),
14
+ sorts: sortBy(PRODUCT_FIELDS.CREATED_AT),
15
+ page: 1,
16
+ pageSize: 24,
17
+ })
18
+ .catch(() => null);
19
+ return _jsx(StoreClassifiedsListing, { storeId: storeId, initialData: result ?? undefined });
20
+ }
@@ -14,6 +14,9 @@ const STORE_LISTING_HREF = {
14
14
  "pre-orders": (slug) => String(ROUTES.PUBLIC.STORE_PRE_ORDERS(slug)),
15
15
  "prize-draws": (slug) => String(ROUTES.PUBLIC.STORE_PRIZE_DRAWS(slug)),
16
16
  bundles: (slug) => String(ROUTES.PUBLIC.STORE_BUNDLES(slug)),
17
+ classifieds: (slug) => String(ROUTES.PUBLIC.STORE_CLASSIFIEDS(slug)),
18
+ "digital-codes": (slug) => String(ROUTES.PUBLIC.STORE_DIGITAL_CODES(slug)),
19
+ live: (slug) => String(ROUTES.PUBLIC.STORE_LIVE(slug)),
17
20
  };
18
21
  export const getStoreBySlug = cache((slug) => storeRepository.findBySlug(slug).catch(() => undefined));
19
22
  function tabLabel(base, count) {
@@ -28,7 +31,7 @@ export async function StoreDetailLayoutView({ storeSlug, activeTab, children, })
28
31
  }
29
32
  const storeId = store?.id;
30
33
  const settings = await siteSettingsRepository.findById("global").catch(() => null);
31
- const [productsCount, auctionsCount, preOrdersCount, prizeDrawsCount, bundlesCount, couponsCount, reviewsCount] = storeId
34
+ const [productsCount, auctionsCount, preOrdersCount, prizeDrawsCount, bundlesCount, classifiedsCount, digitalCodesCount, liveCount, couponsCount, reviewsCount] = storeId
32
35
  ? await Promise.all([
33
36
  productRepository
34
37
  .list({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "standard")), page: 1, pageSize: 1 })
@@ -52,6 +55,18 @@ export async function StoreDetailLayoutView({ storeSlug, activeTab, children, })
52
55
  .listByType("bundle", { activeOnly: true, limit: 100 })
53
56
  .then((rows) => rows.filter((c) => c.createdByStoreId === storeId).length)
54
57
  .catch(() => 0),
58
+ productRepository
59
+ .list({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "classified")), page: 1, pageSize: 1 })
60
+ .then((r) => r.total)
61
+ .catch(() => 0),
62
+ productRepository
63
+ .list({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "digital-code")), page: 1, pageSize: 1 })
64
+ .then((r) => r.total)
65
+ .catch(() => 0),
66
+ productRepository
67
+ .list({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "live")), page: 1, pageSize: 1 })
68
+ .then((r) => r.total)
69
+ .catch(() => 0),
55
70
  couponsRepository
56
71
  .list({ filters: sieveAnd(sieveFilter("sellerId", SIEVE_OP.EQ, storeId), sieveFilter("validity.isActive", SIEVE_OP.EQ, "true")), page: 1, pageSize: 1 })
57
72
  .then((r) => r.total)
@@ -61,19 +76,25 @@ export async function StoreDetailLayoutView({ storeSlug, activeTab, children, })
61
76
  .then((r) => r.total)
62
77
  .catch(() => 0),
63
78
  ])
64
- : [0, 0, 0, 0, 0, 0, 0];
79
+ : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
65
80
  const listingCounts = {
66
81
  products: productsCount,
67
82
  auctions: auctionsCount,
68
83
  "pre-orders": preOrdersCount,
69
84
  "prize-draws": prizeDrawsCount,
70
85
  bundles: bundlesCount,
86
+ classifieds: classifiedsCount,
87
+ "digital-codes": digitalCodesCount,
88
+ live: liveCount,
71
89
  };
72
90
  const TAB_LISTING_TYPE = {
73
91
  products: "standard",
74
92
  auctions: "auction",
75
93
  "pre-orders": "pre-order",
76
94
  "prize-draws": "prize-draw",
95
+ classifieds: "classified",
96
+ "digital-codes": "digital-code",
97
+ live: "live",
77
98
  };
78
99
  const visibleStoreTabs = STORE_PAGE_TABS.filter((tab) => {
79
100
  if (tab.id === "bundles")
@@ -0,0 +1,5 @@
1
+ export interface StoreDigitalCodesListingProps {
2
+ storeId?: string;
3
+ initialData?: any;
4
+ }
5
+ export declare function StoreDigitalCodesListing({ storeId, initialData }: StoreDigitalCodesListingProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState, useCallback } from "react";
4
+ import { useUrlTable } from "../../../react/hooks/useUrlTable";
5
+ import { usePendingTable } from "../../../react/hooks/usePendingTable";
6
+ import { useProducts } from "../../products/hooks/useProducts";
7
+ import { Div, FilterDrawer, ListingToolbar, Pagination, Row, Text } from "../../../ui";
8
+ import { DigitalCodeFilters } from "../../digital-codes/components/DigitalCodeFilters";
9
+ import { InteractiveProductCard } from "../../products/components/InteractiveProductCard";
10
+ import { PRODUCT_FIELDS } from "../../../constants/field-names";
11
+ import { TABLE_KEYS } from "../../../constants/table-keys";
12
+ import { sortBy } from "../../../constants/sort";
13
+ import { ROUTES } from "../../../next";
14
+ const DEFAULT_SORT = sortBy(PRODUCT_FIELDS.CREATED_AT);
15
+ const SORT_OPTIONS = [
16
+ { value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Newest First" },
17
+ { value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest First" },
18
+ { value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: "Price: Low to High" },
19
+ { value: sortBy(PRODUCT_FIELDS.PRICE), label: "Price: High to Low" },
20
+ ];
21
+ const FILTER_KEYS = [TABLE_KEYS.MIN_PRICE, TABLE_KEYS.MAX_PRICE];
22
+ export function StoreDigitalCodesListing({ storeId, initialData }) {
23
+ const table = useUrlTable({ defaults: { pageSize: "24", sort: DEFAULT_SORT } });
24
+ const [searchInput, setSearchInput] = useState(table.get("q") || "");
25
+ const [filterOpen, setFilterOpen] = useState(false);
26
+ const { pendingTable, filterActiveCount, onFilterApply, onFilterClear, onResetAll, onFilterReset } = usePendingTable(table, FILTER_KEYS);
27
+ const openFilters = useCallback(() => { onFilterReset(); setFilterOpen(true); }, [onFilterReset]);
28
+ const applyFilters = useCallback(() => { onFilterApply(); setFilterOpen(false); }, [onFilterApply]);
29
+ const resetAll = useCallback(() => { onResetAll({ q: "", sort: "" }); setSearchInput(""); }, [onResetAll]);
30
+ const hasActiveState = !!table.get("q") || table.get("sort") !== DEFAULT_SORT || filterActiveCount > 0;
31
+ const params = {
32
+ q: table.get("q") || undefined,
33
+ minPrice: table.get(TABLE_KEYS.MIN_PRICE) ? Number(table.get(TABLE_KEYS.MIN_PRICE)) : undefined,
34
+ maxPrice: table.get(TABLE_KEYS.MAX_PRICE) ? Number(table.get(TABLE_KEYS.MAX_PRICE)) : undefined,
35
+ sort: table.get("sort") || DEFAULT_SORT,
36
+ page: table.getNumber("page", 1),
37
+ perPage: table.getNumber("pageSize", 24),
38
+ storeId: storeId || undefined,
39
+ listingType: "digital-code",
40
+ };
41
+ const { products, totalPages, page, isLoading } = useProducts(params, { initialData });
42
+ const gridClass = "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4";
43
+ return (_jsxs(Div, { className: "min-h-[200px]", children: [_jsx(ListingToolbar, { filterCount: filterActiveCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search digital codes\u2026", onSearchChange: setSearchInput, onSearchCommit: () => table.set("q", searchInput.trim()), sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => table.set("sort", v), onResetAll: resetAll, hasActiveState: hasActiveState }), totalPages > 1 && (_jsx(Row, { border: "bottom", className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 backdrop-blur-sm", surface: "default", padding: "toolbar", justify: "center", children: _jsx(Pagination, { currentPage: page, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsx(Div, { padding: "y-lg", children: _jsx(Div, { className: gridClass, children: isLoading
44
+ ? Array.from({ length: 8 }).map((_, i) => _jsx(Div, { surface: "muted", rounded: "xl", className: "aspect-square animate-pulse" }, i))
45
+ : products.length === 0
46
+ ? _jsx(Div, { paddingY: "y-4xl", className: "col-span-full text-center", children: _jsx(Text, { color: "muted", children: "No digital codes in this store yet." }) })
47
+ : products.map((p) => (_jsx(InteractiveProductCard, { product: p, href: String(ROUTES.PUBLIC.DIGITAL_CODE_DETAIL(p.slug ?? p.id)) }, p.id))) }) }), _jsx(FilterDrawer, { open: filterOpen, onOpen: openFilters, onClose: () => setFilterOpen(false), onApply: applyFilters, onReset: onFilterClear, activeCount: filterActiveCount, hideTrigger: true, children: _jsx(DigitalCodeFilters, { table: pendingTable, currencyPrefix: "\u20B9" }) })] }));
48
+ }
@@ -0,0 +1,4 @@
1
+ export interface StoreDigitalCodesPageViewProps {
2
+ storeSlug: string;
3
+ }
4
+ export declare function StoreDigitalCodesPageView({ storeSlug }: StoreDigitalCodesPageViewProps): Promise<import("react/jsx-runtime").JSX.Element | null>;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { sieveFilter, sieveAnd, SIEVE_OP, sortBy, PRODUCT_FIELDS } from "@mohasinac/appkit";
3
+ import { productRepository } from "../../../repositories";
4
+ import { getStoreBySlug } from "./StoreDetailLayoutView";
5
+ import { StoreDigitalCodesListing } from "./StoreDigitalCodesListing";
6
+ export async function StoreDigitalCodesPageView({ storeSlug }) {
7
+ const store = await getStoreBySlug(storeSlug);
8
+ const storeId = store?.id;
9
+ if (!storeId)
10
+ return null;
11
+ const result = await productRepository
12
+ .list({
13
+ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "digital-code")),
14
+ sorts: sortBy(PRODUCT_FIELDS.CREATED_AT),
15
+ page: 1,
16
+ pageSize: 24,
17
+ })
18
+ .catch(() => null);
19
+ return _jsx(StoreDigitalCodesListing, { storeId: storeId, initialData: result ?? undefined });
20
+ }
@@ -0,0 +1,5 @@
1
+ export interface StoreLiveItemsListingProps {
2
+ storeId?: string;
3
+ initialData?: any;
4
+ }
5
+ export declare function StoreLiveItemsListing({ storeId, initialData }: StoreLiveItemsListingProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState, useCallback } from "react";
4
+ import { useUrlTable } from "../../../react/hooks/useUrlTable";
5
+ import { usePendingTable } from "../../../react/hooks/usePendingTable";
6
+ import { useProducts } from "../../products/hooks/useProducts";
7
+ import { Div, FilterDrawer, ListingToolbar, Pagination, Row, Text } from "../../../ui";
8
+ import { LiveItemFilters } from "../../live/components/LiveItemFilters";
9
+ import { InteractiveProductCard } from "../../products/components/InteractiveProductCard";
10
+ import { PRODUCT_FIELDS } from "../../../constants/field-names";
11
+ import { TABLE_KEYS } from "../../../constants/table-keys";
12
+ import { sortBy } from "../../../constants/sort";
13
+ import { ROUTES } from "../../../next";
14
+ const DEFAULT_SORT = sortBy(PRODUCT_FIELDS.CREATED_AT);
15
+ const SORT_OPTIONS = [
16
+ { value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Newest First" },
17
+ { value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest First" },
18
+ { value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: "Price: Low to High" },
19
+ { value: sortBy(PRODUCT_FIELDS.PRICE), label: "Price: High to Low" },
20
+ ];
21
+ const FILTER_KEYS = [TABLE_KEYS.MIN_PRICE, TABLE_KEYS.MAX_PRICE, TABLE_KEYS.SPECIES, "liveSex", "liveTransportMethod", "jurisdiction"];
22
+ export function StoreLiveItemsListing({ storeId, initialData }) {
23
+ const table = useUrlTable({ defaults: { pageSize: "24", sort: DEFAULT_SORT } });
24
+ const [searchInput, setSearchInput] = useState(table.get("q") || "");
25
+ const [filterOpen, setFilterOpen] = useState(false);
26
+ const { pendingTable, filterActiveCount, onFilterApply, onFilterClear, onResetAll, onFilterReset } = usePendingTable(table, FILTER_KEYS);
27
+ const openFilters = useCallback(() => { onFilterReset(); setFilterOpen(true); }, [onFilterReset]);
28
+ const applyFilters = useCallback(() => { onFilterApply(); setFilterOpen(false); }, [onFilterApply]);
29
+ const resetAll = useCallback(() => { onResetAll({ q: "", sort: "" }); setSearchInput(""); }, [onResetAll]);
30
+ const hasActiveState = !!table.get("q") || table.get("sort") !== DEFAULT_SORT || filterActiveCount > 0;
31
+ const params = {
32
+ q: table.get("q") || undefined,
33
+ minPrice: table.get(TABLE_KEYS.MIN_PRICE) ? Number(table.get(TABLE_KEYS.MIN_PRICE)) : undefined,
34
+ maxPrice: table.get(TABLE_KEYS.MAX_PRICE) ? Number(table.get(TABLE_KEYS.MAX_PRICE)) : undefined,
35
+ sort: table.get("sort") || DEFAULT_SORT,
36
+ page: table.getNumber("page", 1),
37
+ perPage: table.getNumber("pageSize", 24),
38
+ storeId: storeId || undefined,
39
+ listingType: "live",
40
+ };
41
+ const { products, totalPages, page, isLoading } = useProducts(params, { initialData });
42
+ const gridClass = "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4";
43
+ return (_jsxs(Div, { className: "min-h-[200px]", children: [_jsx(ListingToolbar, { filterCount: filterActiveCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search live animals & plants\u2026", onSearchChange: setSearchInput, onSearchCommit: () => table.set("q", searchInput.trim()), sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => table.set("sort", v), onResetAll: resetAll, hasActiveState: hasActiveState }), totalPages > 1 && (_jsx(Row, { border: "bottom", className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 backdrop-blur-sm", surface: "default", padding: "toolbar", justify: "center", children: _jsx(Pagination, { currentPage: page, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsx(Div, { padding: "y-lg", children: _jsx(Div, { className: gridClass, children: isLoading
44
+ ? Array.from({ length: 8 }).map((_, i) => _jsx(Div, { surface: "muted", rounded: "xl", className: "aspect-square animate-pulse" }, i))
45
+ : products.length === 0
46
+ ? _jsx(Div, { paddingY: "y-4xl", className: "col-span-full text-center", children: _jsx(Text, { color: "muted", children: "No live items in this store yet." }) })
47
+ : products.map((p) => (_jsx(InteractiveProductCard, { product: p, href: String(ROUTES.PUBLIC.LIVE_DETAIL(p.slug ?? p.id)) }, p.id))) }) }), _jsx(FilterDrawer, { open: filterOpen, onOpen: openFilters, onClose: () => setFilterOpen(false), onApply: applyFilters, onReset: onFilterClear, activeCount: filterActiveCount, hideTrigger: true, children: _jsx(LiveItemFilters, { table: pendingTable, currencyPrefix: "\u20B9" }) })] }));
48
+ }
@@ -0,0 +1,4 @@
1
+ export interface StoreLiveItemsPageViewProps {
2
+ storeSlug: string;
3
+ }
4
+ export declare function StoreLiveItemsPageView({ storeSlug }: StoreLiveItemsPageViewProps): Promise<import("react/jsx-runtime").JSX.Element | null>;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { sieveFilter, sieveAnd, SIEVE_OP, sortBy, PRODUCT_FIELDS } from "@mohasinac/appkit";
3
+ import { productRepository } from "../../../repositories";
4
+ import { getStoreBySlug } from "./StoreDetailLayoutView";
5
+ import { StoreLiveItemsListing } from "./StoreLiveItemsListing";
6
+ export async function StoreLiveItemsPageView({ storeSlug }) {
7
+ const store = await getStoreBySlug(storeSlug);
8
+ const storeId = store?.id;
9
+ if (!storeId)
10
+ return null;
11
+ const result = await productRepository
12
+ .list({
13
+ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "live")),
14
+ sorts: sortBy(PRODUCT_FIELDS.CREATED_AT),
15
+ page: 1,
16
+ pageSize: 24,
17
+ })
18
+ .catch(() => null);
19
+ return _jsx(StoreLiveItemsListing, { storeId: storeId, initialData: result ?? undefined });
20
+ }
@@ -26,6 +26,15 @@ export type { StorePreOrdersListingProps } from "./StorePreOrdersListing";
26
26
  export type { StorePreOrdersPageViewProps } from "./StorePreOrdersPageView";
27
27
  export type { StorePrizeDrawsPageViewProps } from "./StorePrizeDrawsPageView";
28
28
  export type { StoreBundlesPageViewProps } from "./StoreBundlesPageView";
29
+ export { StoreClassifiedsListing } from "./StoreClassifiedsListing";
30
+ export type { StoreClassifiedsListingProps } from "./StoreClassifiedsListing";
31
+ export type { StoreClassifiedsPageViewProps } from "./StoreClassifiedsPageView";
32
+ export { StoreDigitalCodesListing } from "./StoreDigitalCodesListing";
33
+ export type { StoreDigitalCodesListingProps } from "./StoreDigitalCodesListing";
34
+ export type { StoreDigitalCodesPageViewProps } from "./StoreDigitalCodesPageView";
35
+ export { StoreLiveItemsListing } from "./StoreLiveItemsListing";
36
+ export type { StoreLiveItemsListingProps } from "./StoreLiveItemsListing";
37
+ export type { StoreLiveItemsPageViewProps } from "./StoreLiveItemsPageView";
29
38
  export { StoreGuideHubView } from "./StoreGuideHubView";
30
39
  export type { StoreGuideHubViewProps } from "./StoreGuideHubView";
31
40
  export { StoreListingsGuideView } from "./StoreListingsGuideView";
@@ -11,6 +11,9 @@ export { StoreProductsListing } from "./StoreProductsListing";
11
11
  export { StoreAuctionsListing } from "./StoreAuctionsListing";
12
12
  export { StoreReviewsListing } from "./StoreReviewsListing";
13
13
  export { StorePreOrdersListing } from "./StorePreOrdersListing";
14
+ export { StoreClassifiedsListing } from "./StoreClassifiedsListing";
15
+ export { StoreDigitalCodesListing } from "./StoreDigitalCodesListing";
16
+ export { StoreLiveItemsListing } from "./StoreLiveItemsListing";
14
17
  export { StoreGuideHubView } from "./StoreGuideHubView";
15
18
  export { StoreListingsGuideView } from "./StoreListingsGuideView";
16
19
  export { StoreOrdersGuideView } from "./StoreOrdersGuideView";