@adminide-stack/yantra-mobile 12.0.196-alpha.0 → 12.0.196

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 (382) hide show
  1. package/lib/components/CustomDrawer.js +17 -1
  2. package/lib/components/CustomDrawer.js.map +1 -1
  3. package/lib/compute.js +57 -1
  4. package/lib/compute.js.map +1 -1
  5. package/lib/config/env-config.js +11 -1
  6. package/lib/config/env-config.js.map +1 -1
  7. package/lib/features/agent-chat/NativeAgentChat.js +7 -0
  8. package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
  9. package/lib/features/canvas/extendVideo.js +5 -1
  10. package/lib/features/canvas/extendVideo.js.map +1 -1
  11. package/lib/features/canvas/workflow/StepSheet.js +18 -1
  12. package/lib/features/canvas/workflow/StepSheet.js.map +1 -1
  13. package/lib/features/canvas/workflow/workflowSteps.js +102 -31
  14. package/lib/features/canvas/workflow/workflowSteps.js.map +1 -1
  15. package/lib/features/chat/ComposerMicSend.js +35 -0
  16. package/lib/features/chat/ComposerMicSend.js.map +1 -0
  17. package/lib/features/chat/ComposerModeSwitch.js +64 -1
  18. package/lib/features/chat/ComposerModeSwitch.js.map +1 -1
  19. package/lib/features/chat/askUser.js +6 -1
  20. package/lib/features/chat/askUser.js.map +1 -1
  21. package/lib/features/connectors/ConnectorSheet.js +443 -0
  22. package/lib/features/connectors/ConnectorSheet.js.map +1 -0
  23. package/lib/features/connectors/ConnectorsPage.js +320 -0
  24. package/lib/features/connectors/ConnectorsPage.js.map +1 -0
  25. package/lib/features/connectors/connectConnector.js +278 -0
  26. package/lib/features/connectors/connectConnector.js.map +1 -0
  27. package/lib/features/connectors/connectorCatalog.js +222 -0
  28. package/lib/features/connectors/connectorCatalog.js.map +1 -0
  29. package/lib/features/connectors/useConnectorCatalog.js +153 -0
  30. package/lib/features/connectors/useConnectorCatalog.js.map +1 -0
  31. package/lib/features/home/needsYou/HomeNeedsYou.js +618 -0
  32. package/lib/features/home/needsYou/HomeNeedsYou.js.map +1 -0
  33. package/lib/features/home/needsYou/chatFollowUps.js +333 -0
  34. package/lib/features/home/needsYou/chatFollowUps.js.map +1 -0
  35. package/lib/features/home/needsYou/format.js +47 -0
  36. package/lib/features/home/needsYou/format.js.map +1 -0
  37. package/lib/features/home/needsYou/historyText.js +40 -0
  38. package/lib/features/home/needsYou/historyText.js.map +1 -0
  39. package/lib/features/home/needsYou/inboxHighlights.js +152 -0
  40. package/lib/features/home/needsYou/inboxHighlights.js.map +1 -0
  41. package/lib/features/home/needsYou/panelsSettings.js +71 -0
  42. package/lib/features/home/needsYou/panelsSettings.js.map +1 -0
  43. package/lib/features/home/needsYou/ported/commandConfirmProtocol.js +13 -0
  44. package/lib/features/home/needsYou/ported/commandConfirmProtocol.js.map +1 -0
  45. package/lib/features/home/needsYou/ported/paymentApprovalProtocol.js +91 -0
  46. package/lib/features/home/needsYou/ported/paymentApprovalProtocol.js.map +1 -0
  47. package/lib/features/home/needsYou/ported/resultCardModels.js +659 -0
  48. package/lib/features/home/needsYou/ported/resultCardModels.js.map +1 -0
  49. package/lib/features/home/needsYou/types.js +1 -0
  50. package/lib/features/home/needsYou/types.js.map +1 -0
  51. package/lib/features/home/needsYou/useChatFollowUps.js +149 -0
  52. package/lib/features/home/needsYou/useChatFollowUps.js.map +1 -0
  53. package/lib/features/home/needsYou/useHomeBriefing.js +68 -0
  54. package/lib/features/home/needsYou/useHomeBriefing.js.map +1 -0
  55. package/lib/features/home/needsYou/useInboxHighlights.js +173 -0
  56. package/lib/features/home/needsYou/useInboxHighlights.js.map +1 -0
  57. package/lib/features/home/needsYou/usePanelsSettings.js +105 -0
  58. package/lib/features/home/needsYou/usePanelsSettings.js.map +1 -0
  59. package/lib/features/shopping/DealCard.js +8 -1
  60. package/lib/features/shopping/DealCard.js.map +1 -1
  61. package/lib/features/shopping/DealRails.js +24 -7
  62. package/lib/features/shopping/DealRails.js.map +1 -1
  63. package/lib/features/shopping/DealsPanel.js +1 -1
  64. package/lib/features/shopping/DealsPanel.js.map +1 -1
  65. package/lib/features/shopping/HolidayDealsPanel.js +529 -0
  66. package/lib/features/shopping/HolidayDealsPanel.js.map +1 -0
  67. package/lib/features/shopping/HolidayDealsParts.js +954 -0
  68. package/lib/features/shopping/HolidayDealsParts.js.map +1 -0
  69. package/lib/features/shopping/HolidayOffers.js +351 -0
  70. package/lib/features/shopping/HolidayOffers.js.map +1 -0
  71. package/lib/features/shopping/ProductCard.js +80 -14
  72. package/lib/features/shopping/ProductCard.js.map +1 -1
  73. package/lib/features/shopping/ProductDetailSheet.js +22 -3
  74. package/lib/features/shopping/ProductDetailSheet.js.map +1 -1
  75. package/lib/features/shopping/SavedPanel.js +341 -5
  76. package/lib/features/shopping/SavedPanel.js.map +1 -1
  77. package/lib/features/shopping/SearchResults.js +8 -2
  78. package/lib/features/shopping/SearchResults.js.map +1 -1
  79. package/lib/features/shopping/ShoppingAgentChatPane.js +12 -0
  80. package/lib/features/shopping/ShoppingAgentChatPane.js.map +1 -1
  81. package/lib/features/shopping/ShoppingExperience.js +56 -19
  82. package/lib/features/shopping/ShoppingExperience.js.map +1 -1
  83. package/lib/features/shopping/TrendingSections.js +13 -4
  84. package/lib/features/shopping/TrendingSections.js.map +1 -1
  85. package/lib/features/shopping/WatchlistPanel.js +61 -5
  86. package/lib/features/shopping/WatchlistPanel.js.map +1 -1
  87. package/lib/features/shopping/catalog.js +41 -2
  88. package/lib/features/shopping/catalog.js.map +1 -1
  89. package/lib/features/shopping/chat/brainRouter.js +14 -0
  90. package/lib/features/shopping/chat/brainRouter.js.map +1 -1
  91. package/lib/features/shopping/chat/shoppingTurn.js +88 -16
  92. package/lib/features/shopping/chat/shoppingTurn.js.map +1 -1
  93. package/lib/features/shopping/hooks/useHolidayDeals.js +388 -0
  94. package/lib/features/shopping/hooks/useHolidayDeals.js.map +1 -0
  95. package/lib/features/shopping/hooks/useProductMedia.js +33 -6
  96. package/lib/features/shopping/hooks/useProductMedia.js.map +1 -1
  97. package/lib/features/shopping/hooks/useShoppingHistorySync.js +8 -4
  98. package/lib/features/shopping/hooks/useShoppingHistorySync.js.map +1 -1
  99. package/lib/features/shopping/hooks/useTrendingProducts.js +11 -3
  100. package/lib/features/shopping/hooks/useTrendingProducts.js.map +1 -1
  101. package/lib/features/shopping/savedProducts.js +76 -6
  102. package/lib/features/shopping/savedProducts.js.map +1 -1
  103. package/lib/features/shopping/services/aiRelevance.js +212 -0
  104. package/lib/features/shopping/services/aiRelevance.js.map +1 -0
  105. package/lib/features/shopping/services/blackFriday.js +301 -0
  106. package/lib/features/shopping/services/blackFriday.js.map +1 -0
  107. package/lib/features/shopping/services/blackFridayBrowserSites.js +137 -0
  108. package/lib/features/shopping/services/blackFridayBrowserSites.js.map +1 -0
  109. package/lib/features/shopping/services/catalogProductSearch.js +21 -3
  110. package/lib/features/shopping/services/catalogProductSearch.js.map +1 -1
  111. package/lib/features/shopping/services/holidayDeals.js +143 -0
  112. package/lib/features/shopping/services/holidayDeals.js.map +1 -0
  113. package/lib/features/shopping/services/mediaShape.js +7 -0
  114. package/lib/features/shopping/services/mediaShape.js.map +1 -0
  115. package/lib/features/shopping/services/modelStep.js +95 -0
  116. package/lib/features/shopping/services/modelStep.js.map +1 -0
  117. package/lib/features/shopping/services/modelWords.js +14 -0
  118. package/lib/features/shopping/services/modelWords.js.map +1 -0
  119. package/lib/features/shopping/services/productAvailability.js +5 -1
  120. package/lib/features/shopping/services/productAvailability.js.map +1 -1
  121. package/lib/features/shopping/services/productFilters.js +2 -2
  122. package/lib/features/shopping/services/productFilters.js.map +1 -1
  123. package/lib/features/shopping/services/productMedia.js +103 -18
  124. package/lib/features/shopping/services/productMedia.js.map +1 -1
  125. package/lib/features/shopping/services/retailerUrl.js +11 -8
  126. package/lib/features/shopping/services/retailerUrl.js.map +1 -1
  127. package/lib/features/shopping/services/salesDealsStore.js +3 -2
  128. package/lib/features/shopping/services/salesDealsStore.js.map +1 -1
  129. package/lib/features/shopping/services/savedReads.js +82 -0
  130. package/lib/features/shopping/services/savedReads.js.map +1 -0
  131. package/lib/features/shopping/services/searchCardFields.js +2 -0
  132. package/lib/features/shopping/services/searchCardFields.js.map +1 -1
  133. package/lib/features/shopping/services/searchRelevance.js +154 -24
  134. package/lib/features/shopping/services/searchRelevance.js.map +1 -1
  135. package/lib/features/shopping/services/secondHand.js +12 -0
  136. package/lib/features/shopping/services/secondHand.js.map +1 -0
  137. package/lib/features/shopping/services/shoppingProductSearch.js +82 -10
  138. package/lib/features/shopping/services/shoppingProductSearch.js.map +1 -1
  139. package/lib/features/shopping/services/shoppingSearchConnectorClient.js +14 -1
  140. package/lib/features/shopping/services/shoppingSearchConnectorClient.js.map +1 -1
  141. package/lib/features/shopping/services/shoppingSubgraph.js +2 -1
  142. package/lib/features/shopping/services/shoppingSubgraph.js.map +1 -1
  143. package/lib/features/shopping/services/storedGalleries.js +130 -0
  144. package/lib/features/shopping/services/storedGalleries.js.map +1 -0
  145. package/lib/features/shopping/services/usedSites.js +263 -0
  146. package/lib/features/shopping/services/usedSites.js.map +1 -0
  147. package/lib/features/shopping/services/verifyProducts.js +3 -3
  148. package/lib/features/shopping/services/verifyProducts.js.map +1 -1
  149. package/lib/features/shopping/services/watchDeal.js +61 -0
  150. package/lib/features/shopping/services/watchDeal.js.map +1 -0
  151. package/lib/features/shopping/shoppingRuntime.js +7 -2
  152. package/lib/features/shopping/shoppingRuntime.js.map +1 -1
  153. package/lib/features/shopping/state/accountCaches.js +20 -0
  154. package/lib/features/shopping/state/accountCaches.js.map +1 -0
  155. package/lib/features/shopping/state/holidayDealsRequest.js +22 -0
  156. package/lib/features/shopping/state/holidayDealsRequest.js.map +1 -0
  157. package/lib/features/shopping/tutorials/ShoppingTutorialDock.js +1 -1
  158. package/lib/features/shopping/tutorials/ShoppingTutorialDock.js.map +1 -1
  159. package/lib/features/shopping/tutorials/shoppingTutorials.js +2 -0
  160. package/lib/features/shopping/tutorials/shoppingTutorials.js.map +1 -1
  161. package/lib/features/shopping/useShoppingSearch.js +74 -18
  162. package/lib/features/shopping/useShoppingSearch.js.map +1 -1
  163. package/lib/features/team-chat/TeamChatExperience.js +474 -0
  164. package/lib/features/team-chat/TeamChatExperience.js.map +1 -0
  165. package/lib/features/team-chat/api/client.js +198 -0
  166. package/lib/features/team-chat/api/client.js.map +1 -0
  167. package/lib/features/team-chat/api/live.js +160 -0
  168. package/lib/features/team-chat/api/live.js.map +1 -0
  169. package/lib/features/team-chat/api/ops.js +241 -0
  170. package/lib/features/team-chat/api/ops.js.map +1 -0
  171. package/lib/features/team-chat/app.js +12 -0
  172. package/lib/features/team-chat/app.js.map +1 -0
  173. package/lib/features/team-chat/components/Avatar.js +107 -0
  174. package/lib/features/team-chat/components/Avatar.js.map +1 -0
  175. package/lib/features/team-chat/components/Composer.js +641 -0
  176. package/lib/features/team-chat/components/Composer.js.map +1 -0
  177. package/lib/features/team-chat/components/Dialogs.js +598 -0
  178. package/lib/features/team-chat/components/Dialogs.js.map +1 -0
  179. package/lib/features/team-chat/components/EmojiPicker.js +165 -0
  180. package/lib/features/team-chat/components/EmojiPicker.js.map +1 -0
  181. package/lib/features/team-chat/components/MessageItem.js +658 -0
  182. package/lib/features/team-chat/components/MessageItem.js.map +1 -0
  183. package/lib/features/team-chat/components/MessageList.js +248 -0
  184. package/lib/features/team-chat/components/MessageList.js.map +1 -0
  185. package/lib/features/team-chat/components/Mrkdwn.js +228 -0
  186. package/lib/features/team-chat/components/Mrkdwn.js.map +1 -0
  187. package/lib/features/team-chat/components/QuickSwitcher.js +215 -0
  188. package/lib/features/team-chat/components/QuickSwitcher.js.map +1 -0
  189. package/lib/features/team-chat/components/ui.js +662 -0
  190. package/lib/features/team-chat/components/ui.js.map +1 -0
  191. package/lib/features/team-chat/nativeTeamChatRegistry.js +15 -0
  192. package/lib/features/team-chat/nativeTeamChatRegistry.js.map +1 -0
  193. package/lib/features/team-chat/state/fetched.js +39 -0
  194. package/lib/features/team-chat/state/fetched.js.map +1 -0
  195. package/lib/features/team-chat/state/lists.js +230 -0
  196. package/lib/features/team-chat/state/lists.js.map +1 -0
  197. package/lib/features/team-chat/state/store.js +1108 -0
  198. package/lib/features/team-chat/state/store.js.map +1 -0
  199. package/lib/features/team-chat/state/useChannelDirectory.js +21 -0
  200. package/lib/features/team-chat/state/useChannelDirectory.js.map +1 -0
  201. package/lib/features/team-chat/theme.js +77 -0
  202. package/lib/features/team-chat/theme.js.map +1 -0
  203. package/lib/features/team-chat/utils/composeText.js +72 -0
  204. package/lib/features/team-chat/utils/composeText.js.map +1 -0
  205. package/lib/features/team-chat/utils/emoji.js +369 -0
  206. package/lib/features/team-chat/utils/emoji.js.map +1 -0
  207. package/lib/features/team-chat/utils/format.js +109 -0
  208. package/lib/features/team-chat/utils/format.js.map +1 -0
  209. package/lib/features/team-chat/utils/messageRows.js +24 -0
  210. package/lib/features/team-chat/utils/messageRows.js.map +1 -0
  211. package/lib/features/team-chat/utils/mrkdwn.js +222 -0
  212. package/lib/features/team-chat/utils/mrkdwn.js.map +1 -0
  213. package/lib/features/team-chat/utils/notify.js +47 -0
  214. package/lib/features/team-chat/utils/notify.js.map +1 -0
  215. package/lib/features/team-chat/utils/pickFiles.js +81 -0
  216. package/lib/features/team-chat/utils/pickFiles.js.map +1 -0
  217. package/lib/features/team-chat/views/ActivityView.js +235 -0
  218. package/lib/features/team-chat/views/ActivityView.js.map +1 -0
  219. package/lib/features/team-chat/views/BrowseView.js +179 -0
  220. package/lib/features/team-chat/views/BrowseView.js.map +1 -0
  221. package/lib/features/team-chat/views/ChannelView.js +475 -0
  222. package/lib/features/team-chat/views/ChannelView.js.map +1 -0
  223. package/lib/features/team-chat/views/DetailsPane.js +816 -0
  224. package/lib/features/team-chat/views/DetailsPane.js.map +1 -0
  225. package/lib/features/team-chat/views/DraftsView.js +212 -0
  226. package/lib/features/team-chat/views/DraftsView.js.map +1 -0
  227. package/lib/features/team-chat/views/FilesView.js +152 -0
  228. package/lib/features/team-chat/views/FilesView.js.map +1 -0
  229. package/lib/features/team-chat/views/NewMessageView.js +286 -0
  230. package/lib/features/team-chat/views/NewMessageView.js.map +1 -0
  231. package/lib/features/team-chat/views/PeopleView.js +118 -0
  232. package/lib/features/team-chat/views/PeopleView.js.map +1 -0
  233. package/lib/features/team-chat/views/ProfilePane.js +220 -0
  234. package/lib/features/team-chat/views/ProfilePane.js.map +1 -0
  235. package/lib/features/team-chat/views/SavedView.js +113 -0
  236. package/lib/features/team-chat/views/SavedView.js.map +1 -0
  237. package/lib/features/team-chat/views/SearchView.js +307 -0
  238. package/lib/features/team-chat/views/SearchView.js.map +1 -0
  239. package/lib/features/team-chat/views/Sidebar.js +368 -0
  240. package/lib/features/team-chat/views/Sidebar.js.map +1 -0
  241. package/lib/features/team-chat/views/ThreadPane.js +139 -0
  242. package/lib/features/team-chat/views/ThreadPane.js.map +1 -0
  243. package/lib/features/team-chat/views/ThreadsView.js +157 -0
  244. package/lib/features/team-chat/views/ThreadsView.js.map +1 -0
  245. package/lib/features/webbuilder/WebBuilderExperience.js +276 -42
  246. package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
  247. package/lib/features/webbuilder/buildFragments.js +10 -4
  248. package/lib/features/webbuilder/buildFragments.js.map +1 -1
  249. package/lib/features/webbuilder/components/AssetChips.js +61 -0
  250. package/lib/features/webbuilder/components/AssetChips.js.map +1 -0
  251. package/lib/features/webbuilder/components/AssetSiteChooser.js +100 -0
  252. package/lib/features/webbuilder/components/AssetSiteChooser.js.map +1 -0
  253. package/lib/features/webbuilder/components/CommentsLayer.js +485 -0
  254. package/lib/features/webbuilder/components/CommentsLayer.js.map +1 -0
  255. package/lib/features/webbuilder/components/Composer.js +16 -2
  256. package/lib/features/webbuilder/components/Composer.js.map +1 -1
  257. package/lib/features/webbuilder/components/ComposerModeSwitch.js +71 -0
  258. package/lib/features/webbuilder/components/ComposerModeSwitch.js.map +1 -0
  259. package/lib/features/webbuilder/components/MyAssetsPicker.js +500 -0
  260. package/lib/features/webbuilder/components/MyAssetsPicker.js.map +1 -0
  261. package/lib/features/webbuilder/components/PlanDocument.js +165 -0
  262. package/lib/features/webbuilder/components/PlanDocument.js.map +1 -0
  263. package/lib/features/webbuilder/components/PlanDraftCard.js +205 -0
  264. package/lib/features/webbuilder/components/PlanDraftCard.js.map +1 -0
  265. package/lib/features/webbuilder/components/PlanView.js +788 -0
  266. package/lib/features/webbuilder/components/PlanView.js.map +1 -0
  267. package/lib/features/webbuilder/components/PreviewConsoleSheet.js +334 -0
  268. package/lib/features/webbuilder/components/PreviewConsoleSheet.js.map +1 -0
  269. package/lib/features/webbuilder/components/PreviewFrame.js +45 -3
  270. package/lib/features/webbuilder/components/PreviewFrame.js.map +1 -1
  271. package/lib/features/webbuilder/components/PreviewScreen.js +94 -10
  272. package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
  273. package/lib/features/webbuilder/components/ProjectChat.js +84 -14
  274. package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
  275. package/lib/features/webbuilder/components/StudioHome.js +69 -6
  276. package/lib/features/webbuilder/components/StudioHome.js.map +1 -1
  277. package/lib/features/webbuilder/components/StyleDirectionsSheet.js +291 -0
  278. package/lib/features/webbuilder/components/StyleDirectionsSheet.js.map +1 -0
  279. package/lib/features/webbuilder/components/VersionChangesView.js +574 -0
  280. package/lib/features/webbuilder/components/VersionChangesView.js.map +1 -0
  281. package/lib/features/webbuilder/components/VersionPreviewView.js +186 -0
  282. package/lib/features/webbuilder/components/VersionPreviewView.js.map +1 -0
  283. package/lib/features/webbuilder/components/VersionsSheet.js +673 -16
  284. package/lib/features/webbuilder/components/VersionsSheet.js.map +1 -1
  285. package/lib/features/webbuilder/connectorTemplates.js +6 -1
  286. package/lib/features/webbuilder/connectorTemplates.js.map +1 -1
  287. package/lib/features/webbuilder/myAssets.js +101 -0
  288. package/lib/features/webbuilder/myAssets.js.map +1 -0
  289. package/lib/features/webbuilder/planChat.js +146 -0
  290. package/lib/features/webbuilder/planChat.js.map +1 -0
  291. package/lib/features/webbuilder/planDocument.js +89 -0
  292. package/lib/features/webbuilder/planDocument.js.map +1 -0
  293. package/lib/features/webbuilder/planStore.js +55 -0
  294. package/lib/features/webbuilder/planStore.js.map +1 -0
  295. package/lib/features/webbuilder/previewCommentsScript.js +218 -0
  296. package/lib/features/webbuilder/previewCommentsScript.js.map +1 -0
  297. package/lib/features/webbuilder/previewConsoleScript.js +39 -0
  298. package/lib/features/webbuilder/previewConsoleScript.js.map +1 -0
  299. package/lib/features/webbuilder/styleDirections.js +85 -0
  300. package/lib/features/webbuilder/styleDirections.js.map +1 -0
  301. package/lib/features/webbuilder/useCanvasComments.js +335 -0
  302. package/lib/features/webbuilder/useCanvasComments.js.map +1 -0
  303. package/lib/features/webbuilder/useCatalogTemplates.js +37 -0
  304. package/lib/features/webbuilder/useCatalogTemplates.js.map +1 -0
  305. package/lib/features/webbuilder/usePlanMode.js +145 -0
  306. package/lib/features/webbuilder/usePlanMode.js.map +1 -0
  307. package/lib/features/webbuilder/useStyleDirections.js +112 -0
  308. package/lib/features/webbuilder/useStyleDirections.js.map +1 -0
  309. package/lib/features/webbuilder/web/assets/assetsApi.js +174 -0
  310. package/lib/features/webbuilder/web/assets/assetsApi.js.map +1 -0
  311. package/lib/features/webbuilder/web/assets/assetsApi.ts +173 -0
  312. package/lib/features/webbuilder/web/assets/myAssets.js +341 -0
  313. package/lib/features/webbuilder/web/assets/myAssets.js.map +1 -0
  314. package/lib/features/webbuilder/web/assets/myAssets.ts +396 -0
  315. package/lib/features/webbuilder/web/canvas/elementName.js +46 -0
  316. package/lib/features/webbuilder/web/canvas/elementName.js.map +1 -0
  317. package/lib/features/webbuilder/web/canvas/visualEditorBridge.js +95 -0
  318. package/lib/features/webbuilder/web/canvas/visualEditorBridge.js.map +1 -0
  319. package/lib/features/webbuilder/web/chat/agentTurn.js +24 -0
  320. package/lib/features/webbuilder/web/chat/agentTurn.js.map +1 -0
  321. package/lib/features/webbuilder/web/chat/planMode.js +164 -0
  322. package/lib/features/webbuilder/web/chat/planMode.js.map +1 -0
  323. package/lib/features/webbuilder/web/chat/realPlans.js +66 -0
  324. package/lib/features/webbuilder/web/chat/realPlans.js.map +1 -0
  325. package/lib/features/webbuilder/web/comments/comments.js +336 -0
  326. package/lib/features/webbuilder/web/comments/comments.js.map +1 -0
  327. package/lib/features/webbuilder/web/comments/commentsApi.js +59 -0
  328. package/lib/features/webbuilder/web/comments/commentsApi.js.map +1 -0
  329. package/lib/features/webbuilder/web/components/planView.js +21 -0
  330. package/lib/features/webbuilder/web/components/planView.js.map +1 -0
  331. package/lib/features/webbuilder/web/console/consolePanel.js +43 -0
  332. package/lib/features/webbuilder/web/console/consolePanel.js.map +1 -0
  333. package/lib/features/webbuilder/web/console/previewConsole.js +256 -0
  334. package/lib/features/webbuilder/web/console/previewConsole.js.map +1 -0
  335. package/lib/features/webbuilder/web/console/usePreviewConsole.js +147 -0
  336. package/lib/features/webbuilder/web/console/usePreviewConsole.js.map +1 -0
  337. package/lib/features/webbuilder/web/design/directions.js +419 -1
  338. package/lib/features/webbuilder/web/design/directions.js.map +1 -1
  339. package/lib/features/webbuilder/web/history/diffActions.js +222 -0
  340. package/lib/features/webbuilder/web/history/diffActions.js.map +1 -0
  341. package/lib/features/webbuilder/web/history/diffHighlight.js +18 -0
  342. package/lib/features/webbuilder/web/history/diffHighlight.js.map +1 -0
  343. package/lib/features/webbuilder/web/history/versionActions.js +272 -0
  344. package/lib/features/webbuilder/web/history/versionActions.js.map +1 -0
  345. package/lib/features/webbuilder/web/history/versionDiff.js +338 -0
  346. package/lib/features/webbuilder/web/history/versionDiff.js.map +1 -0
  347. package/lib/features/webbuilder/web/history/versionPreview.js +83 -0
  348. package/lib/features/webbuilder/web/history/versionPreview.js.map +1 -0
  349. package/lib/features/webbuilder/web/history/versionPreviewMachine.js +150 -0
  350. package/lib/features/webbuilder/web/history/versionPreviewMachine.js.map +1 -0
  351. package/lib/features/webbuilder/web/history/versions.js +326 -1
  352. package/lib/features/webbuilder/web/history/versions.js.map +1 -1
  353. package/lib/features/webbuilder/web/hosted/hostedTurn.js +36 -0
  354. package/lib/features/webbuilder/web/hosted/hostedTurn.js.map +1 -0
  355. package/lib/features/webbuilder/web/studio/brandKit.js +25 -0
  356. package/lib/features/webbuilder/web/studio/brandKit.js.map +1 -0
  357. package/lib/features/webbuilder/web/utils/promptSafe.js +15 -0
  358. package/lib/features/webbuilder/web/utils/promptSafe.js.map +1 -0
  359. package/lib/features/webbuilder/web/webServices.js +3 -1
  360. package/lib/features/webbuilder/web/webServices.js.map +1 -1
  361. package/lib/index.js +1 -1
  362. package/lib/index.js.map +1 -1
  363. package/lib/routes.json +55 -0
  364. package/lib/screens/Account/index.js +13 -5
  365. package/lib/screens/Account/index.js.map +1 -1
  366. package/lib/screens/Chat/index.js +16 -0
  367. package/lib/screens/Chat/index.js.map +1 -1
  368. package/lib/screens/Home/HomeScreen.js +202 -39
  369. package/lib/screens/Home/HomeScreen.js.map +1 -1
  370. package/lib/screens/Home/components/HomeHero.js +52 -38
  371. package/lib/screens/Home/components/HomeHero.js.map +1 -1
  372. package/lib/screens/Home/components/homeCatalog.js +8 -1
  373. package/lib/screens/Home/components/homeCatalog.js.map +1 -1
  374. package/lib/screens/TeamChat/index.js +41 -0
  375. package/lib/screens/TeamChat/index.js.map +1 -0
  376. package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js +9 -2
  377. package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js.map +1 -1
  378. package/lib/screens/WebBuilderNative/index.js +13 -3
  379. package/lib/screens/WebBuilderNative/index.js.map +1 -1
  380. package/lib/screens/WebBuilderNative/useConnectorTemplates.js +2 -2
  381. package/lib/screens/WebBuilderNative/useConnectorTemplates.js.map +1 -1
  382. package/package.json +4 -4
@@ -0,0 +1,130 @@
1
+ import {httpsImages,playableVideos}from'./mediaShape.js';import {salesDealsConfigured,fnv1a,storeQuery}from'./salesDealsStore.js';var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ const STORED_GALLERY_BOARD = "gallery";
21
+ const STORED_GALLERY_FRESH_MS = 7 * 24 * 60 * 6e4;
22
+ const LOOKUP_WINDOW_MS = 50;
23
+ const MAX_LOOKUPS_PER_REQUEST = 40;
24
+ const SAVE_WINDOW_MS = 1e3;
25
+ const MAX_SAVES_PER_REQUEST = 50;
26
+ const MAX_TITLE = 200;
27
+ function storedGallerySlug(key) {
28
+ return `gallery-${fnv1a(key, 2166136261)}${fnv1a(key, 2538058380)}`;
29
+ }
30
+ function galleryFromStoredRow(row, key, now = Date.now()) {
31
+ var _a;
32
+ if (!row || !row.raw || typeof row.raw !== "object") return null;
33
+ const raw = row.raw;
34
+ if (raw.key !== key) return null;
35
+ const observed = Date.parse((_a = row.observedAt) != null ? _a : "");
36
+ if (!Number.isFinite(observed) || now - observed > STORED_GALLERY_FRESH_MS) return null;
37
+ const images = httpsImages(raw.images);
38
+ const videos = playableVideos(raw.videos);
39
+ return images.length > 0 || videos.length > 0 ? {
40
+ images,
41
+ videos
42
+ } : null;
43
+ }
44
+ function storedGalleryInput(listing, media) {
45
+ var _a, _b;
46
+ const title = (((_a = listing.name) == null ? void 0 : _a.trim()) || ((_b = listing.url) == null ? void 0 : _b.trim()) || listing.key).slice(0, MAX_TITLE);
47
+ return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
48
+ slug: storedGallerySlug(listing.key),
49
+ board: STORED_GALLERY_BOARD,
50
+ kind: "product",
51
+ title
52
+ }, listing.store ? {
53
+ merchant: listing.store
54
+ } : {}), listing.url ? {
55
+ url: listing.url
56
+ } : {}), media.images[0] ? {
57
+ imageUrl: media.images[0]
58
+ } : {}), {
59
+ tags: [],
60
+ providerId: listing.lane,
61
+ sources: [listing.lane],
62
+ raw: {
63
+ key: listing.key,
64
+ images: media.images,
65
+ videos: media.videos
66
+ }
67
+ });
68
+ }
69
+ let lookups = [];
70
+ let lookupTimer = null;
71
+ async function flushLookups() {
72
+ if (lookupTimer) clearTimeout(lookupTimer);
73
+ lookupTimer = null;
74
+ const batch = lookups.splice(0, MAX_LOOKUPS_PER_REQUEST);
75
+ if (lookups.length > 0) lookupTimer = setTimeout(() => void flushLookups(), 0);
76
+ if (batch.length === 0) return;
77
+ const slugs = [...new Set(batch.map((lookup) => lookup.slug))];
78
+ const variables = Object.fromEntries(slugs.map((slug, index) => [`s${index}`, slug]));
79
+ const gql = `query StoredGalleries(${slugs.map((_, index) => `$s${index}: String!`).join(", ")}) {
80
+ ` + slugs.map((_, index) => ` g${index}: shoppingSalesDeal(slug: $s${index}) { raw observedAt }`).join("\n") + "\n}";
81
+ const data = await storeQuery(gql, variables).catch(() => null);
82
+ const rows = new Map(slugs.map((slug, index) => {
83
+ var _a;
84
+ return [slug, (_a = data == null ? void 0 : data[`g${index}`]) != null ? _a : null];
85
+ }));
86
+ for (const lookup of batch) lookup.resolve(galleryFromStoredRow(rows.get(lookup.slug), lookup.key));
87
+ }
88
+ function loadStoredGallery(key) {
89
+ if (!salesDealsConfigured()) return Promise.resolve(null);
90
+ return new Promise((resolve) => {
91
+ lookups.push({
92
+ key,
93
+ slug: storedGallerySlug(key),
94
+ resolve
95
+ });
96
+ if (lookups.length >= MAX_LOOKUPS_PER_REQUEST) void flushLookups();
97
+ else if (!lookupTimer) lookupTimer = setTimeout(() => void flushLookups(), LOOKUP_WINDOW_MS);
98
+ });
99
+ }
100
+ const SAVE_GALLERIES_MUTATION = (
101
+ /* GraphQL */
102
+ `
103
+ mutation SaveStoredGalleries($deals: [UpsertShoppingSalesDealInput!]!) {
104
+ upsertShoppingSalesDeals(deals: $deals) {
105
+ insertedCount
106
+ updatedCount
107
+ }
108
+ }
109
+ `
110
+ );
111
+ let saves = /* @__PURE__ */ new Map();
112
+ let saveTimer = null;
113
+ async function flushSaves() {
114
+ if (saveTimer) clearTimeout(saveTimer);
115
+ saveTimer = null;
116
+ const rows = [...saves.values()];
117
+ saves = /* @__PURE__ */ new Map();
118
+ for (let at = 0; at < rows.length; at += MAX_SAVES_PER_REQUEST) {
119
+ await storeQuery(SAVE_GALLERIES_MUTATION, {
120
+ deals: rows.slice(at, at + MAX_SAVES_PER_REQUEST)
121
+ }).catch(() => null);
122
+ }
123
+ }
124
+ function saveStoredGallery(listing, media) {
125
+ if (media.images.length === 0 && media.videos.length === 0) return;
126
+ if (!salesDealsConfigured()) return;
127
+ const row = storedGalleryInput(listing, media);
128
+ saves.set(String(row.slug), row);
129
+ if (!saveTimer) saveTimer = setTimeout(() => void flushSaves(), SAVE_WINDOW_MS);
130
+ }export{MAX_LOOKUPS_PER_REQUEST,STORED_GALLERY_BOARD,STORED_GALLERY_FRESH_MS,galleryFromStoredRow,loadStoredGallery,saveStoredGallery,storedGalleryInput,storedGallerySlug};//# sourceMappingURL=storedGalleries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storedGalleries.js","sources":["../../../../src/features/shopping/services/storedGalleries.ts"],"sourcesContent":["/**\n * Listing galleries the tenant has already read, kept in the shopping subgraph\n * beside the Deals and trending boards (the same collection, board `gallery`,\n * one row per listing), so a gallery is read once and then shown to everyone.\n *\n * Why it exists: a listing's whole gallery costs something to read. Amazon,\n * Walmart and Kohl's answer a server with a bot wall - measured 2026-11-20 on\n * the trending rails' own listings, 7 of 8 walled and Target one photo - so the\n * photos come from the shopper's own browser (one agent turn per store and\n * batch, 20-50 s each) or, for an opened Amazon product, a metered lookup.\n * Neither should be paid twice for the same listing, and a shopper with no\n * paired browser could not read them at all: the landing page's rails showed\n * one photo per card for everyone. Now whatever a browser or paid read finds is\n * saved here, and every card asks here first (see productMedia).\n *\n * Rows are tenant-scoped like the boards (the subgraph takes the tenant from the\n * bearer, never from an argument) and hold only public listing photos. A row's\n * slug is the listing's media key hashed, so a lookup needs nothing beyond the\n * store's `{tenant, slug}` key: one round trip answers a whole row of cards,\n * as aliased `shoppingSalesDeal` reads. Saving a gallery re-observes only its\n * own row; the boards' freshness is untouched.\n *\n * Best-effort both ways: an unreachable store is a miss, and a failed write is a\n * gallery the next reader reads again.\n */\nimport { httpsImages, playableVideos } from './mediaShape';\nimport type { ProductMedia } from './productMedia';\nimport { fnv1a, salesDealsConfigured, storeQuery } from './salesDealsStore';\n\n/** The board gallery rows are filed under; the boards' own reads never see them. */\nexport const STORED_GALLERY_BOARD = 'gallery';\n/** A stored gallery older than this is read again: listings do swap their photos, if rarely. */\nexport const STORED_GALLERY_FRESH_MS = 7 * 24 * 60 * 60_000;\n/** Lookups asked within this window - the cards of a rail mounting together - share one request. */\nconst LOOKUP_WINDOW_MS = 50;\n/** Aliased reads in one request. */\nexport const MAX_LOOKUPS_PER_REQUEST = 40;\n/** Saves landing within this window - one browser turn answers up to eight listings - share one write. */\nconst SAVE_WINDOW_MS = 1_000;\n/** The subgraph takes up to 200 rows a write; a gallery row carries up to sixteen photo URLs. */\nconst MAX_SAVES_PER_REQUEST = 50;\nconst MAX_TITLE = 200;\n\n/** Which read found a gallery. Kept on the row (`providerId`), so the store can tell browser reads from paid ones. */\nexport type GalleryLane = 'own-browser' | 'connector';\n\n/** The listing a gallery belongs to, as the row describes it. */\nexport interface StoredGalleryListing {\n /** The listing's media key (productMedia's `mediaKey`): what the slug hashes and the row is checked against. */\n key: string;\n name?: string;\n url?: string;\n /** The store the listing is at (\"amazon\", \"walmart\"). */\n store?: string;\n lane: GalleryLane;\n}\n\nexport function storedGallerySlug(key: string): string {\n return `gallery-${fnv1a(key, 0x811c9dc5)}${fnv1a(key, 0x9747b28c)}`;\n}\n\n/** A stored row as the lookup reads it. */\nexport interface StoredGalleryRow {\n raw?: unknown;\n observedAt?: string | null;\n}\n\n/**\n * The gallery a stored row holds for `key`, or null: no row, a row for another\n * listing (a slug collision), one older than {@link STORED_GALLERY_FRESH_MS}, or\n * one with nothing showable left after the https check.\n */\nexport function galleryFromStoredRow(\n row: StoredGalleryRow | null | undefined,\n key: string,\n now = Date.now(),\n): ProductMedia | null {\n if (!row || !row.raw || typeof row.raw !== 'object') return null;\n const raw = row.raw as { key?: unknown; images?: unknown; videos?: unknown };\n if (raw.key !== key) return null;\n const observed = Date.parse(row.observedAt ?? '');\n if (!Number.isFinite(observed) || now - observed > STORED_GALLERY_FRESH_MS) return null;\n const images = httpsImages(raw.images);\n const videos = playableVideos(raw.videos);\n return images.length > 0 || videos.length > 0 ? { images, videos } : null;\n}\n\n/** The upsert row for a gallery: the board's required fields, the photos on `raw`. */\nexport function storedGalleryInput(listing: StoredGalleryListing, media: ProductMedia): Record<string, unknown> {\n const title = (listing.name?.trim() || listing.url?.trim() || listing.key).slice(0, MAX_TITLE);\n return {\n slug: storedGallerySlug(listing.key),\n board: STORED_GALLERY_BOARD,\n kind: 'product',\n title,\n ...(listing.store ? { merchant: listing.store } : {}),\n ...(listing.url ? { url: listing.url } : {}),\n ...(media.images[0] ? { imageUrl: media.images[0] } : {}),\n tags: [],\n providerId: listing.lane,\n sources: [listing.lane],\n raw: { key: listing.key, images: media.images, videos: media.videos },\n };\n}\n\n// ─── Lookups ────────────────────────────────────────────────────────────────\n\ninterface Lookup {\n key: string;\n slug: string;\n resolve: (media: ProductMedia | null) => void;\n}\n\nlet lookups: Lookup[] = [];\nlet lookupTimer: ReturnType<typeof setTimeout> | null = null;\n\nasync function flushLookups(): Promise<void> {\n if (lookupTimer) clearTimeout(lookupTimer);\n lookupTimer = null;\n const batch = lookups.splice(0, MAX_LOOKUPS_PER_REQUEST);\n if (lookups.length > 0) lookupTimer = setTimeout(() => void flushLookups(), 0);\n if (batch.length === 0) return;\n\n const slugs = [...new Set(batch.map((lookup) => lookup.slug))];\n const variables = Object.fromEntries(slugs.map((slug, index) => [`s${index}`, slug]));\n const gql =\n `query StoredGalleries(${slugs.map((_, index) => `$s${index}: String!`).join(', ')}) {\\n` +\n slugs.map((_, index) => ` g${index}: shoppingSalesDeal(slug: $s${index}) { raw observedAt }`).join('\\n') +\n '\\n}';\n const data = await storeQuery<Record<string, StoredGalleryRow | null>>(gql, variables).catch(() => null);\n const rows = new Map(slugs.map((slug, index) => [slug, data?.[`g${index}`] ?? null]));\n for (const lookup of batch) lookup.resolve(galleryFromStoredRow(rows.get(lookup.slug), lookup.key));\n}\n\n/**\n * The tenant's stored gallery for a listing, or null when there is none worth\n * showing (or no store to ask). Never rejects. Lookups asked together ride one\n * request.\n */\nexport function loadStoredGallery(key: string): Promise<ProductMedia | null> {\n if (!salesDealsConfigured()) return Promise.resolve(null);\n return new Promise((resolve) => {\n lookups.push({ key, slug: storedGallerySlug(key), resolve });\n if (lookups.length >= MAX_LOOKUPS_PER_REQUEST) void flushLookups();\n else if (!lookupTimer) lookupTimer = setTimeout(() => void flushLookups(), LOOKUP_WINDOW_MS);\n });\n}\n\n// ─── Saves ──────────────────────────────────────────────────────────────────\n\nconst SAVE_GALLERIES_MUTATION = /* GraphQL */ `\n mutation SaveStoredGalleries($deals: [UpsertShoppingSalesDealInput!]!) {\n upsertShoppingSalesDeals(deals: $deals) {\n insertedCount\n updatedCount\n }\n }\n`;\n\nlet saves = new Map<string, Record<string, unknown>>();\nlet saveTimer: ReturnType<typeof setTimeout> | null = null;\n\nasync function flushSaves(): Promise<void> {\n if (saveTimer) clearTimeout(saveTimer);\n saveTimer = null;\n const rows = [...saves.values()];\n saves = new Map();\n for (let at = 0; at < rows.length; at += MAX_SAVES_PER_REQUEST) {\n await storeQuery(SAVE_GALLERIES_MUTATION, { deals: rows.slice(at, at + MAX_SAVES_PER_REQUEST) }).catch(\n () => null,\n );\n }\n}\n\n/**\n * Remember a gallery a read just found, for everyone in the tenant. Fire and\n * forget; galleries found in the same moment share one write, and a listing\n * saved twice in that moment is written once (the later photos win).\n */\nexport function saveStoredGallery(listing: StoredGalleryListing, media: ProductMedia): void {\n if (media.images.length === 0 && media.videos.length === 0) return;\n if (!salesDealsConfigured()) return;\n const row = storedGalleryInput(listing, media);\n saves.set(String(row.slug), row);\n if (!saveTimer) saveTimer = setTimeout(() => void flushSaves(), SAVE_WINDOW_MS);\n}\n\nexport function resetStoredGalleriesForTests(): void {\n if (lookupTimer) clearTimeout(lookupTimer);\n if (saveTimer) clearTimeout(saveTimer);\n lookups = [];\n lookupTimer = null;\n saves = new Map();\n saveTimer = null;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA8BO,MAAM,oBAAuB,GAAA;AAEvB,MAAA,uBAAA,GAA0B,CAAI,GAAA,EAAA,GAAK,EAAK,GAAA;AAErD,MAAM,gBAAmB,GAAA,EAAA;AAElB,MAAM,uBAA0B,GAAA;AAEvC,MAAM,cAAiB,GAAA,GAAA;AAEvB,MAAM,qBAAwB,GAAA,EAAA;AAC9B,MAAM,SAAY,GAAA,GAAA;AAeX,SAAS,kBAAkB,GAAqB,EAAA;AACrD,EAAO,OAAA,CAAA,QAAA,EAAW,MAAM,GAAK,EAAA,UAAU,CAAC,CAAG,EAAA,KAAA,CAAM,GAAK,EAAA,UAAU,CAAC,CAAA,CAAA;AACnE;AAaO,SAAS,qBAAqB,GAA0C,EAAA,GAAA,EAAa,GAAM,GAAA,IAAA,CAAK,KAA4B,EAAA;AAvEnI,EAAA,IAAA,EAAA;AAwEE,EAAI,IAAA,CAAC,OAAO,CAAC,GAAA,CAAI,OAAO,OAAO,GAAA,CAAI,GAAQ,KAAA,QAAA,EAAiB,OA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G,GAAG,CAAA;AAC/B,EAAI,IAAA,CAAC,WAAuB,SAAA,GAAA,UAAA,CAAW,MAAM,KAAK,UAAA,IAAc,cAAc,CAAA;AAChF"}
@@ -0,0 +1,263 @@
1
+ const q = (query) => encodeURIComponent(query.trim());
2
+ const USED_SITES = [{
3
+ id: "facebook",
4
+ name: "Facebook Marketplace",
5
+ short: "FB Marketplace",
6
+ sells: "anything, sold by people near you for pickup",
7
+ always: true,
8
+ source: "used",
9
+ host: "facebook.com",
10
+ path: "/marketplace/",
11
+ open: (query) => `https://www.facebook.com/marketplace/search/?query=${q(query)}`,
12
+ item: "^/marketplace/item/([0-9]+)",
13
+ link: (id) => `https://www.facebook.com/marketplace/item/${id}/`,
14
+ title: "first",
15
+ local: true
16
+ }, {
17
+ id: "offerup",
18
+ name: "OfferUp",
19
+ sells: "anything, sold by people near you for pickup or shipping",
20
+ always: true,
21
+ source: "used",
22
+ host: "offerup.com",
23
+ open: (query) => `https://offerup.com/search?q=${q(query)}`,
24
+ item: "^/item/detail/([0-9a-f-]{20,})",
25
+ link: (id) => `https://offerup.com/item/detail/${id}`,
26
+ title: "first",
27
+ local: true
28
+ }, {
29
+ id: "craigslist",
30
+ name: "Craigslist",
31
+ sells: "anything, local classifieds near you",
32
+ always: true,
33
+ source: "used",
34
+ host: "craigslist.org",
35
+ // The home page lands on the shopper's own area; its search answers in plain markup.
36
+ open: () => "https://www.craigslist.org/",
37
+ fetch: (query) => `/search/area/{area}?cat=sss&query=${q(query)}`,
38
+ item: "^/view/d/([a-z0-9-]+/[A-Za-z0-9]+)",
39
+ link: (id) => `https://www.craigslist.org/view/d/${id}`,
40
+ title: "first",
41
+ local: true
42
+ }, {
43
+ id: "mercari",
44
+ name: "Mercari",
45
+ sells: "anything people resell, shipped: electronics, clothing, toys, home goods, collectibles",
46
+ always: true,
47
+ source: "used",
48
+ host: "mercari.com",
49
+ open: (query) => `https://www.mercari.com/search/?keyword=${q(query)}`,
50
+ item: "^/us/item/(m[0-9]+)",
51
+ link: (id) => `https://www.mercari.com/us/item/${id}/`,
52
+ title: "first"
53
+ }, {
54
+ id: "shopgoodwill",
55
+ name: "ShopGoodwill",
56
+ sells: "Goodwill thrift-store donations at auction: electronics, clothing, home goods, tools, collectibles",
57
+ source: "used",
58
+ host: "shopgoodwill.com",
59
+ open: () => "https://shopgoodwill.com/",
60
+ link: (id) => `https://shopgoodwill.com/item/${id}`,
61
+ title: "first"
62
+ }, {
63
+ id: "poshmark",
64
+ name: "Poshmark",
65
+ sells: "clothing, shoes, bags, accessories, beauty and home decor",
66
+ source: "used",
67
+ host: "poshmark.com",
68
+ open: (query) => `https://poshmark.com/search?query=${q(query)}`,
69
+ item: "^/listing/([A-Za-z0-9-]+-[0-9a-f]{24})",
70
+ link: (id) => `https://poshmark.com/listing/${id}`,
71
+ title: "first"
72
+ }, {
73
+ id: "depop",
74
+ name: "Depop",
75
+ sells: "vintage and streetwear clothing, sneakers and accessories",
76
+ source: "used",
77
+ host: "depop.com",
78
+ open: (query) => `https://www.depop.com/search/?q=${q(query)}`,
79
+ item: "^/products/([a-z0-9-]+)/?$",
80
+ link: (id) => `https://www.depop.com/products/${id}/`,
81
+ title: "slug",
82
+ brandFirst: true
83
+ }, {
84
+ id: "vinted",
85
+ name: "Vinted",
86
+ sells: "clothing, shoes and bags for women, men and kids",
87
+ source: "used",
88
+ host: "vinted.com",
89
+ open: (query) => `https://www.vinted.com/catalog?search_text=${q(query)}`,
90
+ item: "^/items/([0-9]+-[a-z0-9-]+)",
91
+ link: (id) => `https://www.vinted.com/items/${id}`,
92
+ title: "alt"
93
+ }, {
94
+ id: "grailed",
95
+ name: "Grailed",
96
+ sells: "menswear, streetwear, designer clothing and sneakers",
97
+ source: "used",
98
+ host: "grailed.com",
99
+ open: (query) => `https://www.grailed.com/shop?query=${q(query)}`,
100
+ item: "^/listings/([0-9]+-[a-z0-9-]+)",
101
+ link: (id) => `https://www.grailed.com/listings/${id}`,
102
+ title: "beforePrice"
103
+ }, {
104
+ id: "therealreal",
105
+ name: "The RealReal",
106
+ sells: "authenticated luxury designer handbags, clothing, shoes, jewelry and watches",
107
+ source: "used",
108
+ host: "therealreal.com",
109
+ open: (query) => `https://www.therealreal.com/products?keywords=${q(query)}`,
110
+ item: "^/products/((?:women|men|kids|home|art|jewelry|watches)/[a-z0-9-]+/[a-z0-9-]+/[a-z0-9-]+)$",
111
+ link: (id) => `https://www.therealreal.com/products/${id}`,
112
+ title: "first",
113
+ brandFirst: true
114
+ }, {
115
+ id: "fashionphile",
116
+ name: "Fashionphile",
117
+ sells: "pre-owned luxury designer handbags and accessories",
118
+ source: "used",
119
+ host: "fashionphile.com",
120
+ open: (query) => `https://www.fashionphile.com/shop?search=${q(query)}`,
121
+ item: "^/products/([a-z0-9-]+)$",
122
+ link: (id) => `https://www.fashionphile.com/products/${id}`,
123
+ title: "first",
124
+ brandFirst: true
125
+ }, {
126
+ id: "rebag",
127
+ name: "Rebag",
128
+ sells: "pre-owned luxury designer handbags, jewelry and watches",
129
+ source: "used",
130
+ host: "rebag.com",
131
+ open: (query) => `https://shop.rebag.com/search?q=${q(query)}`,
132
+ item: "^/products/([a-z0-9-]+)$",
133
+ link: (id) => `https://shop.rebag.com/products/${id}`,
134
+ title: "first",
135
+ brandFirst: true
136
+ }, {
137
+ id: "chairish",
138
+ name: "Chairish",
139
+ sells: "vintage and pre-owned furniture, lighting, rugs, art and decor",
140
+ source: "used",
141
+ host: "chairish.com",
142
+ open: (query) => `https://www.chairish.com/search?q=${q(query)}`,
143
+ item: "^/product/([0-9]+/[a-z0-9-]+)",
144
+ link: (id) => `https://www.chairish.com/product/${id}`,
145
+ title: "beforePrice"
146
+ }, {
147
+ id: "aptdeco",
148
+ name: "AptDeco",
149
+ sells: "used furniture: sofas, tables, dressers, beds, chairs, storage",
150
+ source: "used",
151
+ host: "aptdeco.com",
152
+ open: (query) => `https://www.aptdeco.com/catalog?search=${q(query)}`,
153
+ item: "^/product/([a-z0-9-]+)$",
154
+ link: (id) => `https://www.aptdeco.com/product/${id}`,
155
+ title: "first"
156
+ }, {
157
+ id: "reverb",
158
+ name: "Reverb",
159
+ sells: "used musical instruments: guitars, basses, amps, pedals, keyboards, drums, DJ and recording gear",
160
+ source: "used",
161
+ host: "reverb.com",
162
+ open: (query) => `https://reverb.com/marketplace?query=${q(query)}`,
163
+ item: "^/item/([0-9]+-[a-z0-9-]+)",
164
+ link: (id) => `https://reverb.com/item/${id}`,
165
+ title: "first"
166
+ }, {
167
+ id: "keh",
168
+ name: "KEH",
169
+ sells: "used cameras, lenses and photo gear",
170
+ source: "used",
171
+ host: "keh.com",
172
+ open: (query) => `https://www.keh.com/shop/search/?q=${q(query)}`,
173
+ item: "^/shop/((?:[a-z0-9]+-){3,}[a-z0-9]+[.]html|[0-9]{6,}[.]html)$",
174
+ link: (id) => `https://www.keh.com/shop/${id}`,
175
+ title: "beforePrice"
176
+ }, {
177
+ id: "mpb",
178
+ name: "MPB",
179
+ sells: "used cameras, lenses, drones and video gear",
180
+ source: "used",
181
+ host: "mpb.com",
182
+ open: (query) => `https://www.mpb.com/en-us/search?q=${q(query)}`,
183
+ item: "^/en-us/product/([a-z0-9-]+)$",
184
+ link: (id) => `https://www.mpb.com/en-us/product/${id}`,
185
+ title: "first"
186
+ }, {
187
+ id: "backmarket",
188
+ name: "Back Market",
189
+ sells: "refurbished phones, laptops, tablets, game consoles, headphones and smart watches",
190
+ source: "used",
191
+ host: "backmarket.com",
192
+ open: (query) => `https://www.backmarket.com/en-us/search?q=${q(query)}`,
193
+ item: "^/[a-z]{2}-[a-z]{2}/p/([a-z0-9-]+/[0-9a-f-]{36})",
194
+ link: (id) => `https://www.backmarket.com/en-us/p/${id}`,
195
+ title: "first"
196
+ }, {
197
+ id: "swappa",
198
+ name: "Swappa",
199
+ sells: "used phones, laptops, tablets, watches and game consoles from individual sellers",
200
+ source: "used",
201
+ host: "swappa.com",
202
+ open: (query) => `https://swappa.com/search?q=${q(query)}`,
203
+ // A model's listings page (what its search shows) or one listing (what Google Shopping links to).
204
+ item: "^/(listings/[a-z0-9-]+|listing/view/[A-Za-z0-9]+)$",
205
+ link: (id) => `https://swappa.com/${id}`,
206
+ title: "first"
207
+ }, {
208
+ id: "gazelle",
209
+ name: "Gazelle",
210
+ sells: "refurbished iPhones, Samsung and Google phones, iPads and MacBooks",
211
+ source: "used",
212
+ host: "gazelle.com",
213
+ open: (query) => `https://buy.gazelle.com/search?q=${q(query)}`,
214
+ item: "^/products/([a-z0-9-]+)$",
215
+ link: (id) => `https://buy.gazelle.com/products/${id}`,
216
+ title: "first"
217
+ }, {
218
+ id: "bestbuy",
219
+ name: "Best Buy",
220
+ sells: "refurbished and Geek Squad Certified Refurbished electronics: laptops, phones, tablets, TVs, appliances",
221
+ // Best Buy's own refurbished stock: badged Best Buy, shown in Used by its condition.
222
+ source: "bestbuy",
223
+ host: "bestbuy.com",
224
+ open: (query) => `https://www.bestbuy.com/site/searchpage.jsp?st=${q(query)}&qp=condition_facet%3DCondition~Refurbished`,
225
+ item: "^/product/([a-z0-9-]+/[A-Z0-9]{8,})",
226
+ link: (id) => `https://www.bestbuy.com/product/${id}`,
227
+ title: "first"
228
+ }];
229
+ function onSite(site, host, path) {
230
+ if (site.source !== "used") return false;
231
+ if (host !== site.host && !host.endsWith(`.${site.host}`)) return false;
232
+ return !site.path || path.startsWith(site.path);
233
+ }
234
+ const hostOf = (url) => {
235
+ try {
236
+ return new URL(url).hostname.toLowerCase();
237
+ } catch (e) {
238
+ return "";
239
+ }
240
+ };
241
+ function usedSiteOfListing(url) {
242
+ if (!url) return void 0;
243
+ const host = hostOf(url);
244
+ if (!host) return void 0;
245
+ let path;
246
+ try {
247
+ const parsed = new URL(url);
248
+ path = parsed.pathname + parsed.search;
249
+ } catch (e) {
250
+ return void 0;
251
+ }
252
+ return USED_SITES.find((site) => onSite(site, host, path) && (site.item ? new RegExp(site.item).test(path) : /^\/item\/[0-9]+/.test(path)));
253
+ }
254
+ function usedSiteOfHost(url) {
255
+ if (!url) return void 0;
256
+ let parsed;
257
+ try {
258
+ parsed = new URL(url);
259
+ } catch (e) {
260
+ return void 0;
261
+ }
262
+ return USED_SITES.find((site) => onSite(site, parsed.hostname.toLowerCase(), parsed.pathname));
263
+ }export{USED_SITES,usedSiteOfHost,usedSiteOfListing};//# sourceMappingURL=usedSites.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usedSites.js","sources":["../../../../src/features/shopping/services/usedSites.ts"],"sourcesContent":["/**\n * The sites the Used section searches: second-hand marketplaces, thrift and\n * resale shops, and refurbished stock. Every one was opened and read in a\n * shopper's own browser on 2026-11-19 (usedListingReader); the patterns below\n * are what their listing links looked like then.\n *\n * Each search reads the general marketplaces (`always`) plus the specialists\n * a model picks for what was searched (usedListings.pickUsedSites): a guitar\n * search reaches Reverb, a handbag search The RealReal, a laptop search Back\n * Market. Reading all of them every time would hold the shopper's browser for\n * minutes on sites that do not carry the item.\n *\n * Left out, and why (2026-11-19): ThredUp's search ignores the query (it\n * redirects to a department), Kaiyo walls the shopper's own browser off,\n * Decluttr has closed, Vestiaire redirects mid-read, Nextdoor needs its app.\n *\n * Data only - no imports beyond types - so the URL rules (retailerUrl) can read\n * it without pulling in the lane.\n */\nimport type { ProductSource } from '../catalog';\n\nexport type UsedSiteId =\n | 'facebook'\n | 'offerup'\n | 'craigslist'\n | 'mercari'\n | 'shopgoodwill'\n | 'poshmark'\n | 'depop'\n | 'vinted'\n | 'grailed'\n | 'therealreal'\n | 'fashionphile'\n | 'rebag'\n | 'chairish'\n | 'aptdeco'\n | 'reverb'\n | 'keh'\n | 'mpb'\n | 'backmarket'\n | 'swappa'\n | 'gazelle'\n | 'bestbuy';\n\n/** Where a card's title is among its lines (see usedListings.usedListingProduct). */\nexport type UsedTitleRule =\n /** The first line that is not a price, a badge or a label. */\n | 'first'\n /** The line right above the price (a store that prints a banner, a brand or dimensions first). */\n | 'beforePrice'\n /** The photo's alt text, up to \", Brand:\" (Vinted writes the title only there). */\n | 'alt'\n /** The listing link's words, less the seller's handle and the trailing code (Depop). */\n | 'slug'\n /**\n * The photo's alt text where it names the same item as a line of the card\n * (a big-box store): the alt when it is the fuller name (\"Gourmia GAF826\n * 8-Quart ... Air Fryer\" over \"8-Quart ... Air Fryer\"), the line with its\n * brand spaced off when the store glues the two (\"NINJA5 qt. Black ...\" with\n * the alt \"5 qt. Black ...\"). An alt that names nothing on the card - Best\n * Buy's is the text printed on the product photo - leaves the first line.\n */\n | 'altMatch';\n\n/**\n * A site whose search results the generic listing reader reads in the\n * shopper's browser (usedListingReader) and whose cards usedListings reads:\n * the Used section's sites below, and the big-box stores no other lane\n * reaches (storeSites).\n */\nexport interface ListingSite {\n id: string;\n /** The site as shoppers know it. */\n name: string;\n /** The section its cards are badged with: `used`, or the store itself. */\n source: ProductSource;\n /** The registrable host its listings are on. */\n host: string;\n /** Only links under this path are the site: Facebook's host is also its social network. */\n path?: string;\n /** The page the background tab opens. */\n open: (query: string) => string;\n /**\n * A listing link's path (and query): group 1 is the listing's id. A string,\n * written with `[0-9]` and `[.]`, because the reader carries it in a tool call.\n * Absent: the site has its own reader (ShopGoodwill).\n */\n item?: string;\n /** A same-origin page the reader reads instead of the open one (Craigslist: `{area}`). */\n fetch?: (query: string) => string;\n /** The listing's own page, from its id. */\n link: (id: string) => string;\n title: UsedTitleRule;\n /** The first text line is the brand (a designer resale card): it leads the title. */\n brandFirst?: boolean;\n /** Sold for pickup near the shopper: the line under the title is where. */\n local?: boolean;\n /**\n * A store's own new stock (storeSites), not a second-hand listing: its\n * cards go to the store's section of the grid, \"New\" on a card is no\n * condition, and the read runs as that store's browser lane.\n */\n store?: boolean;\n /** At most this many listings (8). */\n max?: number;\n /** At most this many text lines a listing (8): a store card lists features before its price. */\n lines?: number;\n /** The card prints its rating and its count as two bare lines under the title (\"4.9\", \"40\": Lowe's). */\n ratingLines?: boolean;\n /** Wait for this many listings before reading (4) - see usedListingReader's `min` - and how long their number must hold. */\n min?: number;\n settle?: number;\n /** false: the photo's alt names nothing (Best Buy's is the box's printed text) - the reader leaves it out. */\n alt?: boolean;\n /** How long the whole turn may take (usedListings.USED_SITE_TIMEOUT_MS). */\n timeoutMs?: number;\n}\n\nexport interface UsedSite extends ListingSite {\n id: UsedSiteId;\n /** What the card's store chip and its link say when the name is too long for them. */\n short?: string;\n /** What it sells, in a few words - all the site pick reads. */\n sells: string;\n /** A general marketplace: read on every search. The rest are read when the pick names them. */\n always?: boolean;\n}\n\nconst q = (query: string): string => encodeURIComponent(query.trim());\n\nexport const USED_SITES: readonly UsedSite[] = [\n {\n id: 'facebook',\n name: 'Facebook Marketplace',\n short: 'FB Marketplace',\n sells: 'anything, sold by people near you for pickup',\n always: true,\n source: 'used',\n host: 'facebook.com',\n path: '/marketplace/',\n open: (query) => `https://www.facebook.com/marketplace/search/?query=${q(query)}`,\n item: '^/marketplace/item/([0-9]+)',\n link: (id) => `https://www.facebook.com/marketplace/item/${id}/`,\n title: 'first',\n local: true,\n },\n {\n id: 'offerup',\n name: 'OfferUp',\n sells: 'anything, sold by people near you for pickup or shipping',\n always: true,\n source: 'used',\n host: 'offerup.com',\n open: (query) => `https://offerup.com/search?q=${q(query)}`,\n item: '^/item/detail/([0-9a-f-]{20,})',\n link: (id) => `https://offerup.com/item/detail/${id}`,\n title: 'first',\n local: true,\n },\n {\n id: 'craigslist',\n name: 'Craigslist',\n sells: 'anything, local classifieds near you',\n always: true,\n source: 'used',\n host: 'craigslist.org',\n // The home page lands on the shopper's own area; its search answers in plain markup.\n open: () => 'https://www.craigslist.org/',\n fetch: (query) => `/search/area/{area}?cat=sss&query=${q(query)}`,\n item: '^/view/d/([a-z0-9-]+/[A-Za-z0-9]+)',\n link: (id) => `https://www.craigslist.org/view/d/${id}`,\n title: 'first',\n local: true,\n },\n {\n id: 'mercari',\n name: 'Mercari',\n sells: 'anything people resell, shipped: electronics, clothing, toys, home goods, collectibles',\n always: true,\n source: 'used',\n host: 'mercari.com',\n open: (query) => `https://www.mercari.com/search/?keyword=${q(query)}`,\n item: '^/us/item/(m[0-9]+)',\n link: (id) => `https://www.mercari.com/us/item/${id}/`,\n title: 'first',\n },\n {\n id: 'shopgoodwill',\n name: 'ShopGoodwill',\n sells: 'Goodwill thrift-store donations at auction: electronics, clothing, home goods, tools, collectibles',\n source: 'used',\n host: 'shopgoodwill.com',\n open: () => 'https://shopgoodwill.com/',\n link: (id) => `https://shopgoodwill.com/item/${id}`,\n title: 'first',\n },\n {\n id: 'poshmark',\n name: 'Poshmark',\n sells: 'clothing, shoes, bags, accessories, beauty and home decor',\n source: 'used',\n host: 'poshmark.com',\n open: (query) => `https://poshmark.com/search?query=${q(query)}`,\n item: '^/listing/([A-Za-z0-9-]+-[0-9a-f]{24})',\n link: (id) => `https://poshmark.com/listing/${id}`,\n title: 'first',\n },\n {\n id: 'depop',\n name: 'Depop',\n sells: 'vintage and streetwear clothing, sneakers and accessories',\n source: 'used',\n host: 'depop.com',\n open: (query) => `https://www.depop.com/search/?q=${q(query)}`,\n item: '^/products/([a-z0-9-]+)/?$',\n link: (id) => `https://www.depop.com/products/${id}/`,\n title: 'slug',\n brandFirst: true,\n },\n {\n id: 'vinted',\n name: 'Vinted',\n sells: 'clothing, shoes and bags for women, men and kids',\n source: 'used',\n host: 'vinted.com',\n open: (query) => `https://www.vinted.com/catalog?search_text=${q(query)}`,\n item: '^/items/([0-9]+-[a-z0-9-]+)',\n link: (id) => `https://www.vinted.com/items/${id}`,\n title: 'alt',\n },\n {\n id: 'grailed',\n name: 'Grailed',\n sells: 'menswear, streetwear, designer clothing and sneakers',\n source: 'used',\n host: 'grailed.com',\n open: (query) => `https://www.grailed.com/shop?query=${q(query)}`,\n item: '^/listings/([0-9]+-[a-z0-9-]+)',\n link: (id) => `https://www.grailed.com/listings/${id}`,\n title: 'beforePrice',\n },\n {\n id: 'therealreal',\n name: 'The RealReal',\n sells: 'authenticated luxury designer handbags, clothing, shoes, jewelry and watches',\n source: 'used',\n host: 'therealreal.com',\n open: (query) => `https://www.therealreal.com/products?keywords=${q(query)}`,\n item: '^/products/((?:women|men|kids|home|art|jewelry|watches)/[a-z0-9-]+/[a-z0-9-]+/[a-z0-9-]+)$',\n link: (id) => `https://www.therealreal.com/products/${id}`,\n title: 'first',\n brandFirst: true,\n },\n {\n id: 'fashionphile',\n name: 'Fashionphile',\n sells: 'pre-owned luxury designer handbags and accessories',\n source: 'used',\n host: 'fashionphile.com',\n open: (query) => `https://www.fashionphile.com/shop?search=${q(query)}`,\n item: '^/products/([a-z0-9-]+)$',\n link: (id) => `https://www.fashionphile.com/products/${id}`,\n title: 'first',\n brandFirst: true,\n },\n {\n id: 'rebag',\n name: 'Rebag',\n sells: 'pre-owned luxury designer handbags, jewelry and watches',\n source: 'used',\n host: 'rebag.com',\n open: (query) => `https://shop.rebag.com/search?q=${q(query)}`,\n item: '^/products/([a-z0-9-]+)$',\n link: (id) => `https://shop.rebag.com/products/${id}`,\n title: 'first',\n brandFirst: true,\n },\n {\n id: 'chairish',\n name: 'Chairish',\n sells: 'vintage and pre-owned furniture, lighting, rugs, art and decor',\n source: 'used',\n host: 'chairish.com',\n open: (query) => `https://www.chairish.com/search?q=${q(query)}`,\n item: '^/product/([0-9]+/[a-z0-9-]+)',\n link: (id) => `https://www.chairish.com/product/${id}`,\n title: 'beforePrice',\n },\n {\n id: 'aptdeco',\n name: 'AptDeco',\n sells: 'used furniture: sofas, tables, dressers, beds, chairs, storage',\n source: 'used',\n host: 'aptdeco.com',\n open: (query) => `https://www.aptdeco.com/catalog?search=${q(query)}`,\n item: '^/product/([a-z0-9-]+)$',\n link: (id) => `https://www.aptdeco.com/product/${id}`,\n title: 'first',\n },\n {\n id: 'reverb',\n name: 'Reverb',\n sells: 'used musical instruments: guitars, basses, amps, pedals, keyboards, drums, DJ and recording gear',\n source: 'used',\n host: 'reverb.com',\n open: (query) => `https://reverb.com/marketplace?query=${q(query)}`,\n item: '^/item/([0-9]+-[a-z0-9-]+)',\n link: (id) => `https://reverb.com/item/${id}`,\n title: 'first',\n },\n {\n id: 'keh',\n name: 'KEH',\n sells: 'used cameras, lenses and photo gear',\n source: 'used',\n host: 'keh.com',\n open: (query) => `https://www.keh.com/shop/search/?q=${q(query)}`,\n item: '^/shop/((?:[a-z0-9]+-){3,}[a-z0-9]+[.]html|[0-9]{6,}[.]html)$',\n link: (id) => `https://www.keh.com/shop/${id}`,\n title: 'beforePrice',\n },\n {\n id: 'mpb',\n name: 'MPB',\n sells: 'used cameras, lenses, drones and video gear',\n source: 'used',\n host: 'mpb.com',\n open: (query) => `https://www.mpb.com/en-us/search?q=${q(query)}`,\n item: '^/en-us/product/([a-z0-9-]+)$',\n link: (id) => `https://www.mpb.com/en-us/product/${id}`,\n title: 'first',\n },\n {\n id: 'backmarket',\n name: 'Back Market',\n sells: 'refurbished phones, laptops, tablets, game consoles, headphones and smart watches',\n source: 'used',\n host: 'backmarket.com',\n open: (query) => `https://www.backmarket.com/en-us/search?q=${q(query)}`,\n item: '^/[a-z]{2}-[a-z]{2}/p/([a-z0-9-]+/[0-9a-f-]{36})',\n link: (id) => `https://www.backmarket.com/en-us/p/${id}`,\n title: 'first',\n },\n {\n id: 'swappa',\n name: 'Swappa',\n sells: 'used phones, laptops, tablets, watches and game consoles from individual sellers',\n source: 'used',\n host: 'swappa.com',\n open: (query) => `https://swappa.com/search?q=${q(query)}`,\n // A model's listings page (what its search shows) or one listing (what Google Shopping links to).\n item: '^/(listings/[a-z0-9-]+|listing/view/[A-Za-z0-9]+)$',\n link: (id) => `https://swappa.com/${id}`,\n title: 'first',\n },\n {\n id: 'gazelle',\n name: 'Gazelle',\n sells: 'refurbished iPhones, Samsung and Google phones, iPads and MacBooks',\n source: 'used',\n host: 'gazelle.com',\n open: (query) => `https://buy.gazelle.com/search?q=${q(query)}`,\n item: '^/products/([a-z0-9-]+)$',\n link: (id) => `https://buy.gazelle.com/products/${id}`,\n title: 'first',\n },\n {\n id: 'bestbuy',\n name: 'Best Buy',\n sells: 'refurbished and Geek Squad Certified Refurbished electronics: laptops, phones, tablets, TVs, appliances',\n // Best Buy's own refurbished stock: badged Best Buy, shown in Used by its condition.\n source: 'bestbuy',\n host: 'bestbuy.com',\n open: (query) =>\n `https://www.bestbuy.com/site/searchpage.jsp?st=${q(query)}&qp=condition_facet%3DCondition~Refurbished`,\n item: '^/product/([a-z0-9-]+/[A-Z0-9]{8,})',\n link: (id) => `https://www.bestbuy.com/product/${id}`,\n title: 'first',\n },\n];\n\n/** True when a link on `host` at `path` is on `site` (a site of its own, not a store's refurbished page). */\nfunction onSite(site: UsedSite, host: string, path: string): boolean {\n if (site.source !== 'used') return false;\n if (host !== site.host && !host.endsWith(`.${site.host}`)) return false;\n return !site.path || path.startsWith(site.path);\n}\n\nconst hostOf = (url: string): string => {\n try {\n return new URL(url).hostname.toLowerCase();\n } catch {\n return '';\n }\n};\n\n/** The second-hand site a link is a listing on, or undefined (a store's refurbished page is the store's own). */\nexport function usedSiteOfListing(url: string | undefined): UsedSite | undefined {\n if (!url) return undefined;\n const host = hostOf(url);\n if (!host) return undefined;\n let path: string;\n try {\n const parsed = new URL(url);\n path = parsed.pathname + parsed.search;\n } catch {\n return undefined;\n }\n return USED_SITES.find(\n (site) =>\n onSite(site, host, path) && (site.item ? new RegExp(site.item).test(path) : /^\\/item\\/[0-9]+/.test(path)),\n );\n}\n\n/** The second-hand site a link is on - a listing or any other page of it - for naming a card's store. */\nexport function usedSiteOfHost(url: string | undefined): UsedSite | undefined {\n if (!url) return undefined;\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return undefined;\n }\n return USED_SITES.find((site) => onSite(site, parsed.hostname.toLowerCase(), parsed.pathname));\n}\n"],"names":[],"mappings":"AAmGA,MAAM,IAAI,CAAC,KAAA,KAA0B,kBAAmB,CAAA,KAAA,CAAM,MAAM,CAAA;AAC7D,MAAM,aAAkC,CAAC;AAAA,EAC9C,EAAI,EAAA,UAAA;AAAA,EACJ,IAAM,EAAA,sBAAA;AAAA,EACN,KAAO,EAAA,gBAAA;AAAA,EACP,KAAO,EAAA,8CAA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S,eAAe,GAA+C,EAAA;AAC5E,EAAI,IAAA,CAAC,KAAY,OAAA,MAAA;AACjB,EAAI,IAAA,MAAA;AACJ,EAAI,IAAA;AACF,IAAS,MAAA,GAAA,IAAI,IAAI,GAAG,CAAA;AAAA,GACd,CAAA,OAAA,CAAA,EAAA;AACN,IAAO,OAAA,MAAA;AAAA;AAET,EAAO,OAAA,UAAA,CAAW,IAAK,CAAA,CAAA,IAAA,KAAQ,MAAO,CAAA,IAAA,EAAM,MAAO,CAAA,QAAA,CAAS,WAAY,EAAA,EAAG,MAAO,CAAA,QAAQ,CAAC,CAAA;AAC7F"}
@@ -1,4 +1,4 @@
1
- import {getShoppingRuntime}from'../shoppingRuntime.js';import {shoppingSubgraphConfigured,shoppingSubgraphQuery}from'./shoppingSubgraph.js';import {reconcilePricing}from'./pricing.js';import {keepSellableProducts}from'./productAvailability.js';var __defProp = Object.defineProperty;
1
+ import {getShoppingRuntime}from'../shoppingRuntime.js';import {shoppingSubgraphConfigured,shoppingSubgraphQuery}from'./shoppingSubgraph.js';import {reconcilePricing}from'./pricing.js';import {keepShowableProducts}from'./productAvailability.js';var __defProp = Object.defineProperty;
2
2
  var __defProps = Object.defineProperties;
3
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -164,13 +164,13 @@ async function mapWithConcurrency(items, limit, mapper) {
164
164
  return results;
165
165
  }
166
166
  async function verifyProducts(products) {
167
- const candidates = keepSellableProducts(products);
167
+ const candidates = keepShowableProducts(products);
168
168
  if (candidates.length === 0) return [];
169
169
  const checked = await mapWithConcurrency(candidates, MAX_CONCURRENT, async (product) => {
170
170
  const check = await checkProductLink(product.url);
171
171
  return applyPageCheck(product, check);
172
172
  });
173
- return keepSellableProducts(checked.filter((p) => p !== null));
173
+ return keepShowableProducts(checked.filter((p) => p !== null));
174
174
  }
175
175
  function applyVerifiedRows(current, checked, verified) {
176
176
  const checkedIds = new Set(checked.map((p) => p.id));
@@ -1 +1 @@
1
- {"version":3,"file":"verifyProducts.js","sources":["../../../../src/features/shopping/services/verifyProducts.ts"],"sourcesContent":["/**\n * Live verification of the rows on the grid: open each product page (server\n * side, via the shopping subgraph's page check) and let what it says override\n * what the search excerpt or the index claimed. Native twin of the web\n * surface's `services/verifyProducts.ts` (0.37.0).\n *\n * Why this exists: every lane but the catalog reads a rendered search page, so\n * a row's price is a regex hit and its stock is nobody's word. The AI answers\n * from those rows. This pass is what makes \"in stock at $X, here is the link\"\n * a statement about the page as it is now rather than about an excerpt.\n *\n * The rule for applying a verdict is asymmetric on purpose:\n *\n * - DEAD (404, or the shop redirected the item away) → the row is dropped;\n * - OK, out of stock → dropped (see\n * {@link ./productAvailability});\n * - OK, in stock / priced → the row is UPDATED and\n * marked verified;\n * - UNVERIFIED (bot wall, timeout, no route wired) → the row is left exactly\n * as it was. Not being able to look is not evidence.\n *\n * Where the page is opened, first answer wins: the host's `checkProductPage`\n * seam, then the shopping subgraph's `checkShoppingProductPages`. Web also\n * posts to its own `/resources/shopping-page-check` route last; the phone has\n * no same origin, so native stops at the subgraph.\n *\n * Fail-open is the whole design: an install with no server lane at all gets the\n * same grid it had before, minus nothing.\n */\nimport type { Product } from '../catalog';\nimport { getShoppingRuntime, type ProductPageCheck } from '../shoppingRuntime';\nimport { shoppingSubgraphConfigured, shoppingSubgraphQuery } from './shoppingSubgraph';\nimport { reconcilePricing } from './pricing';\nimport { keepSellableProducts } from './productAvailability';\n\nconst MAX_CONCURRENT = 6;\n/** A verdict is reused within a session for this long; stock and price move. */\nconst CACHE_TTL_MS = 5 * 60_000;\n\nconst UNVERIFIED: ProductPageCheck = { status: 'unverified' };\n\nconst cache = new Map<string, { at: number; result: ProductPageCheck }>();\nconst inflight = new Map<string, Promise<ProductPageCheck>>();\n\nexport function clearProductCheckCacheForTests(): void {\n cache.clear();\n inflight.clear();\n subgraphQueue = [];\n subgraphDownUntil = 0;\n}\n\n// ─── Subgraph lane ───────────────────────────────────────────────────────────\n\nconst CHECK_PAGES_QUERY = `query CheckShoppingProductPages($urls: [String!]!) {\n checkShoppingProductPages(urls: $urls) {\n url\n status\n httpStatus\n finalUrl\n reason\n facts { isProduct title price currency originalPrice availability }\n }\n}`;\n\n/** The subgraph's per-call cap. */\nconst SUBGRAPH_BATCH = 40;\n\ntype Waiter = { url: string; resolve: (check: ProductPageCheck | null) => void };\nlet subgraphQueue: Waiter[] = [];\n/** After a call fails outright, skip the lane this long: one outage is one failed call, not one per row. */\nconst SUBGRAPH_BACKOFF_MS = 60_000;\nlet subgraphDownUntil = 0;\nconst subgraphDown = (): boolean => Date.now() < subgraphDownUntil;\n\nfunction stripNulls<T extends object>(value: T): T {\n return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== null && v !== undefined)) as T;\n}\n\nasync function flushSubgraphQueue(): Promise<void> {\n const waiters = subgraphQueue;\n subgraphQueue = [];\n for (let i = 0; i < waiters.length; i += SUBGRAPH_BATCH) {\n const chunk = waiters.slice(i, i + SUBGRAPH_BATCH);\n const urls = Array.from(new Set(chunk.map((w) => w.url)));\n const data = subgraphDown()\n ? null\n : await shoppingSubgraphQuery<{ checkShoppingProductPages: (ProductPageCheck & { url: string })[] }>(\n CHECK_PAGES_QUERY,\n { urls },\n );\n if (!data) subgraphDownUntil = Date.now() + SUBGRAPH_BACKOFF_MS;\n const byUrl = new Map<string, ProductPageCheck>();\n for (const row of data?.checkShoppingProductPages ?? []) {\n const { url, facts, ...rest } = row;\n const check = { ...stripNulls(rest), ...(facts ? { facts: stripNulls(facts) } : {}) } as ProductPageCheck;\n if (isCheck(check)) byUrl.set(url, check);\n }\n for (const waiter of chunk) waiter.resolve(byUrl.get(waiter.url) ?? null);\n }\n}\n\n/**\n * Ask the subgraph about one URL. Calls made in the same tick share one request,\n * so verifying a grid is one round trip, not one per row.\n */\nfunction checkViaSubgraph(url: string): Promise<ProductPageCheck | null> {\n if (subgraphDown() || !shoppingSubgraphConfigured()) return Promise.resolve(null);\n return new Promise((resolve) => {\n if (subgraphQueue.length === 0) setTimeout(() => void flushSubgraphQueue(), 0);\n subgraphQueue.push({ url, resolve });\n });\n}\n\nfunction isCheck(value: unknown): value is ProductPageCheck {\n return (\n !!value &&\n typeof value === 'object' &&\n ['ok', 'dead', 'unverified'].includes(String((value as { status?: unknown }).status))\n );\n}\n\n/** Check one link: host seam first, then the shopping subgraph. */\nexport async function checkProductLink(url: string): Promise<ProductPageCheck> {\n const key = url.trim();\n if (!key) return UNVERIFIED;\n const hit = cache.get(key);\n if (hit && Date.now() - hit.at < CACHE_TTL_MS) return hit.result;\n const pending = inflight.get(key);\n if (pending) return pending;\n\n const request = (async () => {\n try {\n const hostCheck = getShoppingRuntime().checkProductPage;\n if (hostCheck) {\n const fromHost = await hostCheck(key).catch(() => null);\n if (fromHost && isCheck(fromHost)) return fromHost;\n }\n // The subgraph runs the web routes' checker; with no answer from it\n // the row is left as it was (web's same-origin route has no native\n // counterpart).\n const fromSubgraph = await checkViaSubgraph(key);\n if (fromSubgraph) return fromSubgraph;\n return UNVERIFIED;\n } catch {\n return UNVERIFIED;\n } finally {\n inflight.delete(key);\n }\n })();\n inflight.set(key, request);\n const result = await request;\n // Only a verdict is worth remembering; \"could not look\" is retried next time.\n if (result.status !== 'unverified') cache.set(key, { at: Date.now(), result });\n return result;\n}\n\n/**\n * One row after its page check. Pure, so the asymmetry above is testable\n * without a network: `null` means \"drop this row\".\n */\nexport function applyPageCheck(product: Product, check: ProductPageCheck): Product | null {\n if (check.status === 'dead') return null;\n if (check.status !== 'ok' || !check.facts) return product;\n\n const facts = check.facts;\n let next: Product = { ...product };\n if (facts.isProduct) next.linkVerified = true;\n\n if (facts.availability === 'out_of_stock') return { ...next, inStock: false };\n if (facts.availability === 'in_stock') next.inStock = true;\n\n // A live price replaces the listed one only when both speak the same\n // currency: a €-priced page must not overwrite a $-formatted card.\n const listedCurrency = (product.currency ?? 'USD').toUpperCase();\n const pageCurrency = (facts.currency ?? listedCurrency).toUpperCase();\n if (typeof facts.price === 'number' && facts.price > 0 && pageCurrency === listedCurrency) {\n next = reconcilePricing({\n ...next,\n price: facts.price,\n priceVerified: true,\n ...(typeof facts.originalPrice === 'number' && facts.originalPrice > facts.price\n ? { originalPrice: facts.originalPrice }\n : {}),\n });\n }\n return next;\n}\n\nasync function mapWithConcurrency<T, R>(items: T[], limit: number, mapper: (item: T) => Promise<R>): Promise<R[]> {\n const results: R[] = new Array(items.length);\n let nextIndex = 0;\n async function worker(): Promise<void> {\n while (nextIndex < items.length) {\n const index = nextIndex++;\n results[index] = await mapper(items[index]);\n }\n }\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));\n return results;\n}\n\n/**\n * Verify every row that has a link and return the rows that survive, in the\n * order given. Rows without a link are dropped outright (a result the shopper\n * cannot open is not a result); rows whose page could not be read are kept\n * untouched.\n */\nexport async function verifyProducts(products: Product[]): Promise<Product[]> {\n const candidates = keepSellableProducts(products);\n if (candidates.length === 0) return [];\n const checked = await mapWithConcurrency(candidates, MAX_CONCURRENT, async (product) => {\n const check = await checkProductLink(product.url as string);\n return applyPageCheck(product, check);\n });\n return keepSellableProducts(checked.filter((p): p is Product => p !== null));\n}\n\n/**\n * Fold a verified subset back into the rows on the grid: a row that was checked\n * is replaced by its verified self, or removed if verification dropped it; a\n * row that was not part of this batch is untouched.\n */\nexport function applyVerifiedRows(current: Product[], checked: Product[], verified: Product[]): Product[] {\n const checkedIds = new Set(checked.map((p) => p.id));\n const byId = new Map(verified.map((p) => [p.id, p] as const));\n const out: Product[] = [];\n for (const row of current) {\n if (!checkedIds.has(row.id)) {\n out.push(row);\n continue;\n }\n const replacement = byId.get(row.id);\n if (replacement) out.push(replacement);\n }\n return out;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,cAAiB,GAAA,CAAA;AAEvB,MAAM,eAAe,CAAI,GAAA,GAAA;AACzB,MAAM,UAA+B,GAAA;AAAA,EACnC,MAAQ,EAAA;A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O,OAAA,cAAA,CAAe,SAAS,KAAK,CAAA;AAAA,GACrC,CAAA;AACD,EAAA,OAAO,qBAAqB,OAAQ,CAAA,MAAA,CAAO,CAAC,CAAoB,KAAA,CAAA,KAAM,IAAI,CAAC,CAAA;AAC7E;AAOgB,SAAA,iBAAA,CAAkB,OAAoB,EAAA,OAAA,EAAoB,QAAgC,EAAA;AACxG,EAAM,MAAA,UAAA,GAAa,IAAI,GAAI,CAAA,OAAA,CAAQ,IAAI,CAAK,CAAA,KAAA,CAAA,CAAE,EAAE,CAAC,CAAA;AACjD,EAAM,MAAA,IAAA,GAAO,IAAI,GAAA,CAAI,QAAS,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA,CAAC,CAAE,CAAA,EAAA,EAAI,CAAC,CAAU,CAAC,CAAA;AAC1D,EAAA,MAAM,MAAiB,EAAC;AACxB,EAAA,KAAA,MAAW,OAAO,OAAS,EAAA;AACzB,IAAA,IAAI,CAAC,UAAA,CAAW,GAAI,CAAA,GAAA,CAAI,EAAE,CAAG,EAAA;AAC3B,MAAA,GAAA,CAAI,KAAK,GAAG,CAAA;AACZ,MAAA;AAAA;AAEF,IAAA,MAAM,WAAc,GAAA,IAAA,CAAK,GAAI,CAAA,GAAA,CAAI,EAAE,CAAA;AACnC,IAAI,IAAA,WAAA,EAAiB,GAAA,CAAA,IAAA,CAAK,WAAW,CAAA;AAAA;AAEvC,EAAO,OAAA,GAAA;AACT"}
1
+ {"version":3,"file":"verifyProducts.js","sources":["../../../../src/features/shopping/services/verifyProducts.ts"],"sourcesContent":["/**\n * Live verification of the rows on the grid: open each product page (server\n * side, via the shopping subgraph's page check) and let what it says override\n * what the search excerpt or the index claimed. Native twin of the web\n * surface's `services/verifyProducts.ts` (0.37.0).\n *\n * Why this exists: every lane but the catalog reads a rendered search page, so\n * a row's price is a regex hit and its stock is nobody's word. The AI answers\n * from those rows. This pass is what makes \"in stock at $X, here is the link\"\n * a statement about the page as it is now rather than about an excerpt.\n *\n * The rule for applying a verdict is asymmetric on purpose:\n *\n * - DEAD (404, or the shop redirected the item away) → the row is dropped;\n * - OK, out of stock → dropped (see\n * {@link ./productAvailability});\n * - OK, in stock / priced → the row is UPDATED and\n * marked verified;\n * - UNVERIFIED (bot wall, timeout, no route wired) → the row is left exactly\n * as it was. Not being able to look is not evidence.\n *\n * Where the page is opened, first answer wins: the host's `checkProductPage`\n * seam, then the shopping subgraph's `checkShoppingProductPages`. Web also\n * posts to its own `/resources/shopping-page-check` route last; the phone has\n * no same origin, so native stops at the subgraph.\n *\n * Fail-open is the whole design: an install with no server lane at all gets the\n * same grid it had before, minus nothing.\n */\nimport type { Product } from '../catalog';\nimport { getShoppingRuntime, type ProductPageCheck } from '../shoppingRuntime';\nimport { shoppingSubgraphConfigured, shoppingSubgraphQuery } from './shoppingSubgraph';\nimport { reconcilePricing } from './pricing';\nimport { keepShowableProducts } from './productAvailability';\n\nconst MAX_CONCURRENT = 6;\n/** A verdict is reused within a session for this long; stock and price move. */\nconst CACHE_TTL_MS = 5 * 60_000;\n\nconst UNVERIFIED: ProductPageCheck = { status: 'unverified' };\n\nconst cache = new Map<string, { at: number; result: ProductPageCheck }>();\nconst inflight = new Map<string, Promise<ProductPageCheck>>();\n\nexport function clearProductCheckCacheForTests(): void {\n cache.clear();\n inflight.clear();\n subgraphQueue = [];\n subgraphDownUntil = 0;\n}\n\n// ─── Subgraph lane ───────────────────────────────────────────────────────────\n\nconst CHECK_PAGES_QUERY = `query CheckShoppingProductPages($urls: [String!]!) {\n checkShoppingProductPages(urls: $urls) {\n url\n status\n httpStatus\n finalUrl\n reason\n facts { isProduct title price currency originalPrice availability }\n }\n}`;\n\n/** The subgraph's per-call cap. */\nconst SUBGRAPH_BATCH = 40;\n\ntype Waiter = { url: string; resolve: (check: ProductPageCheck | null) => void };\nlet subgraphQueue: Waiter[] = [];\n/** After a call fails outright, skip the lane this long: one outage is one failed call, not one per row. */\nconst SUBGRAPH_BACKOFF_MS = 60_000;\nlet subgraphDownUntil = 0;\nconst subgraphDown = (): boolean => Date.now() < subgraphDownUntil;\n\nfunction stripNulls<T extends object>(value: T): T {\n return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== null && v !== undefined)) as T;\n}\n\nasync function flushSubgraphQueue(): Promise<void> {\n const waiters = subgraphQueue;\n subgraphQueue = [];\n for (let i = 0; i < waiters.length; i += SUBGRAPH_BATCH) {\n const chunk = waiters.slice(i, i + SUBGRAPH_BATCH);\n const urls = Array.from(new Set(chunk.map((w) => w.url)));\n const data = subgraphDown()\n ? null\n : await shoppingSubgraphQuery<{ checkShoppingProductPages: (ProductPageCheck & { url: string })[] }>(\n CHECK_PAGES_QUERY,\n { urls },\n );\n if (!data) subgraphDownUntil = Date.now() + SUBGRAPH_BACKOFF_MS;\n const byUrl = new Map<string, ProductPageCheck>();\n for (const row of data?.checkShoppingProductPages ?? []) {\n const { url, facts, ...rest } = row;\n const check = { ...stripNulls(rest), ...(facts ? { facts: stripNulls(facts) } : {}) } as ProductPageCheck;\n if (isCheck(check)) byUrl.set(url, check);\n }\n for (const waiter of chunk) waiter.resolve(byUrl.get(waiter.url) ?? null);\n }\n}\n\n/**\n * Ask the subgraph about one URL. Calls made in the same tick share one request,\n * so verifying a grid is one round trip, not one per row.\n */\nfunction checkViaSubgraph(url: string): Promise<ProductPageCheck | null> {\n if (subgraphDown() || !shoppingSubgraphConfigured()) return Promise.resolve(null);\n return new Promise((resolve) => {\n if (subgraphQueue.length === 0) setTimeout(() => void flushSubgraphQueue(), 0);\n subgraphQueue.push({ url, resolve });\n });\n}\n\nfunction isCheck(value: unknown): value is ProductPageCheck {\n return (\n !!value &&\n typeof value === 'object' &&\n ['ok', 'dead', 'unverified'].includes(String((value as { status?: unknown }).status))\n );\n}\n\n/** Check one link: host seam first, then the shopping subgraph. */\nexport async function checkProductLink(url: string): Promise<ProductPageCheck> {\n const key = url.trim();\n if (!key) return UNVERIFIED;\n const hit = cache.get(key);\n if (hit && Date.now() - hit.at < CACHE_TTL_MS) return hit.result;\n const pending = inflight.get(key);\n if (pending) return pending;\n\n const request = (async () => {\n try {\n const hostCheck = getShoppingRuntime().checkProductPage;\n if (hostCheck) {\n const fromHost = await hostCheck(key).catch(() => null);\n if (fromHost && isCheck(fromHost)) return fromHost;\n }\n // The subgraph runs the web routes' checker; with no answer from it\n // the row is left as it was (web's same-origin route has no native\n // counterpart).\n const fromSubgraph = await checkViaSubgraph(key);\n if (fromSubgraph) return fromSubgraph;\n return UNVERIFIED;\n } catch {\n return UNVERIFIED;\n } finally {\n inflight.delete(key);\n }\n })();\n inflight.set(key, request);\n const result = await request;\n // Only a verdict is worth remembering; \"could not look\" is retried next time.\n if (result.status !== 'unverified') cache.set(key, { at: Date.now(), result });\n return result;\n}\n\n/**\n * One row after its page check. Pure, so the asymmetry above is testable\n * without a network: `null` means \"drop this row\".\n */\nexport function applyPageCheck(product: Product, check: ProductPageCheck): Product | null {\n if (check.status === 'dead') return null;\n if (check.status !== 'ok' || !check.facts) return product;\n\n const facts = check.facts;\n let next: Product = { ...product };\n if (facts.isProduct) next.linkVerified = true;\n\n if (facts.availability === 'out_of_stock') return { ...next, inStock: false };\n if (facts.availability === 'in_stock') next.inStock = true;\n\n // A live price replaces the listed one only when both speak the same\n // currency: a €-priced page must not overwrite a $-formatted card.\n const listedCurrency = (product.currency ?? 'USD').toUpperCase();\n const pageCurrency = (facts.currency ?? listedCurrency).toUpperCase();\n if (typeof facts.price === 'number' && facts.price > 0 && pageCurrency === listedCurrency) {\n next = reconcilePricing({\n ...next,\n price: facts.price,\n priceVerified: true,\n ...(typeof facts.originalPrice === 'number' && facts.originalPrice > facts.price\n ? { originalPrice: facts.originalPrice }\n : {}),\n });\n }\n return next;\n}\n\nasync function mapWithConcurrency<T, R>(items: T[], limit: number, mapper: (item: T) => Promise<R>): Promise<R[]> {\n const results: R[] = new Array(items.length);\n let nextIndex = 0;\n async function worker(): Promise<void> {\n while (nextIndex < items.length) {\n const index = nextIndex++;\n results[index] = await mapper(items[index]);\n }\n }\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));\n return results;\n}\n\n/**\n * Verify every row that has a link and return the rows that survive, in the\n * order given. Rows without a link are dropped outright (a result the shopper\n * cannot open is not a result); rows whose page could not be read are kept\n * untouched. A row whose page (or store) says out of stock stays, marked, after\n * the rows that can be bought - see productAvailability.\n */\nexport async function verifyProducts(products: Product[]): Promise<Product[]> {\n const candidates = keepShowableProducts(products);\n if (candidates.length === 0) return [];\n const checked = await mapWithConcurrency(candidates, MAX_CONCURRENT, async (product) => {\n const check = await checkProductLink(product.url as string);\n return applyPageCheck(product, check);\n });\n return keepShowableProducts(checked.filter((p): p is Product => p !== null));\n}\n\n/**\n * Fold a verified subset back into the rows on the grid: a row that was checked\n * is replaced by its verified self, or removed if verification dropped it; a\n * row that was not part of this batch is untouched.\n */\nexport function applyVerifiedRows(current: Product[], checked: Product[], verified: Product[]): Product[] {\n const checkedIds = new Set(checked.map((p) => p.id));\n const byId = new Map(verified.map((p) => [p.id, p] as const));\n const out: Product[] = [];\n for (const row of current) {\n if (!checkedIds.has(row.id)) {\n out.push(row);\n continue;\n }\n const replacement = byId.get(row.id);\n if (replacement) out.push(replacement);\n }\n return out;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,cAAiB,GAAA,CAAA;AAEvB,MAAM,eAAe,CAAI,GAAA,GAAA;AACzB,MAAM,UAA+B,GAAA;AAAA,EACnC,MAAQ,EAAA;AACV,CAAA;AACA,MAAM,KAAA,uBAAY,GAGf,EAAA;AACH,MAAM,QAAA,uBAAe,GAAuC,EAAA;AAU5D,MAAM,iBAAoB,GAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA,CAAA;AAY1B,MAAM,cAAiB,GAAA,EAAA;AAKvB,IAAI,gBAA0B,EAAC;AAE/B,MAAM,mBAAsB,GAAA,GAAA;AAC5B,IAAI,iBAAoB,GAAA,CAAA;AACxB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