@adminide-stack/yantra-mobile 12.0.195 → 12.0.196-alpha.1

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
@@ -1 +1 @@
1
- {"version":3,"file":"shoppingProductSearch.js","sources":["../../../../src/features/shopping/services/shoppingProductSearch.ts"],"sourcesContent":["/**\n * Shop search lanes — native twin of the web surface's\n * `services/shoppingProductSearch.ts` (0.37.0).\n *\n * Native differences, until the later phases of\n * portable-devices/mobile/native-shopping-parity.md land:\n * - no page-scrape thumbnail enrichment (`enrichProductThumbnails`): the card\n * resolves its photo from the row (productImage.ts);\n * - no paired-browser Amazon read (`ownBrowser` is ignored, see\n * amazonProductSearch.ts).\n * Section order and labels live in `../catalog` (native keeps them there).\n */\nimport { departmentBadge, SOURCE_LABELS, SOURCE_ORDER, type Product, type ProductSource } from '../catalog';\nimport { pickConnectorImageUrl } from '../resolveProductImage';\nimport { searchAmazonProducts } from './amazonProductSearch';\nimport { isCatalogConfigured, searchCatalogProducts } from './catalogProductSearch';\nimport {\n RETAILER_SEARCH_CONFIGS,\n SHOPPING_RETAILER_IDS,\n searchRetailerProducts,\n type ShoppingRetailerId,\n} from './retailerProductSearch';\nimport { parsePrice, reconcilePricing } from './pricing';\nimport { keepSellableProducts } from './productAvailability';\nimport { detectRetailerSourceFromUrl, isAggregatorSource } from './retailerUrl';\nimport {\n invokeShoppingSearchConnector,\n isConnectorLaneAbort,\n type ConnectorLaneOptions,\n type ShoppingAnalyzeResult,\n type ShoppingConnectorProduct,\n type ShoppingWidgetProperty,\n} from './shoppingSearchConnectorClient';\nimport { positiveCount } from './countText';\nimport type { SearchFacet } from './searchCardFields';\nimport { filterProductsByRelevance, type ShoppingRelevance } from './searchRelevance';\n\nexport { isCatalogConfigured } from './catalogProductSearch';\nexport { detectRetailerSourceFromUrl } from './retailerUrl';\n\nexport interface ShoppingSearchParams {\n query: string;\n category?: string;\n departmentId?: string;\n budget?: number | string;\n maxResults?: number;\n /**\n * yantra-brain's read of what the user is buying. Supplied → results are\n * filtered against it; absent (brain unreachable, or a department browse)\n * → every row a provider returned is shown, exactly as before.\n */\n relevance?: ShoppingRelevance;\n /** Web only (paired desktop browser). Ignored on native; see amazonProductSearch.ts. */\n ownBrowser?: boolean;\n /**\n * Priority and cancellation for the catalog call, which shares one\n * one-at-a-time provider lane with every other catalog read on the page. The\n * landing page's rails pass `background` plus a signal that fires once no\n * rail is waiting on the answer; a search the shopper typed leaves it unset.\n */\n lane?: ConnectorLaneOptions;\n}\n\n/** Default browse queries per department — used when the user picks a category chip. */\n/**\n * Per-department browse queries.\n *\n * `query` is a deliberately broad keyword set, which suits the Parallel research\n * path: it reads whole pages and a wider net finds more candidates.\n *\n * `catalogQuery` is the OPPOSITE, and exists because the two backends want\n * opposite things. The catalog runs a real text search over product names, so the\n * broad set matches nothing coherent - \"wireless headphones smartphone laptop\n * tablet electronics\" against Target returned Windex wipes, a USB cable and an LED\n * lamp, while plain \"wireless headphones\" returned three Sennheiser ACCENTUM\n * models with real prices and images. One tight product-class term is what the\n * catalog needs.\n */\nexport const DEPARTMENT_SEARCH_PRESETS: Record<string, { query: string; catalogQuery: string; category: string }> = {\n 'high-tech': {\n query: 'wireless headphones smartphone laptop tablet electronics',\n catalogQuery: 'wireless headphones',\n category: 'electronics',\n },\n sports: {\n query: 'sports gear bicycle backpack football fitness',\n catalogQuery: 'backpack',\n category: 'sports',\n },\n beauty: {\n query: 'skincare serum perfume beauty wellness',\n catalogQuery: 'skincare serum',\n category: 'beauty',\n },\n 'home-garden': {\n query: 'outdoor furniture BBQ grill string lights lawn garden',\n catalogQuery: 'outdoor furniture',\n category: 'home',\n },\n office: {\n query: 'standing desk tablet office supplies monitor',\n catalogQuery: 'standing desk',\n category: 'office',\n },\n toys: {\n query: 'toys games building blocks plush kids',\n catalogQuery: 'building blocks',\n category: 'toys',\n },\n fashion: {\n query: 'running shoes sneakers jacket jeans handbag apparel',\n catalogQuery: 'running shoes',\n category: 'fashion',\n },\n grocery: {\n query: 'coffee snacks paper towels laundry detergent household',\n catalogQuery: 'coffee',\n category: 'grocery',\n },\n auto: {\n query: 'car vacuum dash cam power drill tool set automotive',\n catalogQuery: 'power drill',\n category: 'auto',\n },\n pets: {\n query: 'dog food cat litter pet bed chew toys',\n catalogQuery: 'dog food',\n category: 'pets',\n },\n kitchen: {\n query: 'air fryer cookware set knife set blender kitchen',\n catalogQuery: 'air fryer',\n category: 'kitchen',\n },\n furniture: {\n query: 'sofa bookshelf floor lamp coffee table home decor',\n catalogQuery: 'sofa',\n category: 'furniture',\n },\n baby: {\n query: 'stroller car seat baby monitor crib kids clothing',\n catalogQuery: 'stroller',\n category: 'baby',\n },\n health: {\n query: 'fitness tracker protein powder yoga mat dumbbells vitamins',\n catalogQuery: 'fitness tracker',\n category: 'health',\n },\n gaming: {\n query: 'gaming console controller gaming headset graphics card gaming chair',\n catalogQuery: 'gaming headset',\n category: 'gaming',\n },\n books: {\n query: 'bestselling books vinyl records blu-ray audiobooks',\n catalogQuery: 'bestselling books',\n category: 'books',\n },\n jewelry: {\n query: 'smartwatch wristwatch necklace earrings ring jewelry',\n catalogQuery: 'wristwatch',\n category: 'jewelry',\n },\n travel: {\n query: 'carry-on suitcase travel backpack packing cubes luggage',\n catalogQuery: 'carry-on suitcase',\n category: 'travel',\n },\n music: {\n query: 'acoustic guitar digital piano keyboard microphone instruments',\n catalogQuery: 'acoustic guitar',\n category: 'music',\n },\n camera: {\n query: 'mirrorless camera lens drone action camera tripod',\n catalogQuery: 'mirrorless camera',\n category: 'camera',\n },\n};\n\nexport const DEFAULT_BROWSE_QUERY = 'popular products electronics sports beauty home office toys';\n\nfunction parseReviewCount(value?: number | string): number {\n return positiveCount(value) ?? 0;\n}\n\nfunction parseRatingNumber(rating?: number | string): number {\n if (typeof rating === 'number' && Number.isFinite(rating)) {\n return Math.min(5, Math.max(0, rating));\n }\n if (typeof rating === 'string') {\n const match = rating.match(/(\\d(?:\\.\\d+)?)/);\n if (match) {\n const value = Number.parseFloat(match[1]);\n if (Number.isFinite(value)) return Math.min(5, Math.max(0, value));\n }\n }\n return 0;\n}\n\nfunction mapWidgetProperty(\n property: ShoppingWidgetProperty,\n departmentId: string | undefined,\n index: number,\n): Product | null {\n const title = property.title?.trim();\n if (!title) return null;\n\n const dept = departmentBadge(departmentId);\n return {\n id: property.id?.trim() || `shopping-${index}-${title.slice(0, 24).replace(/\\s+/g, '-')}`,\n name: title,\n departmentId: dept.id,\n price: parsePrice(property.price, property.priceLabel),\n rating: parseRatingNumber(property.rating),\n reviews: parseReviewCount(property.reviews ?? property.reviewCount),\n icon: dept.icon,\n accent: dept.accent,\n imageUrl:\n property.imageUrl?.trim() ||\n pickConnectorImageUrl(property as unknown as Record<string, unknown>) ||\n undefined,\n url: property.url?.trim() || undefined,\n source: 'yantra',\n };\n}\n\nfunction mapConnectorProduct(\n product: ShoppingConnectorProduct,\n departmentId: string | undefined,\n index: number,\n): Product | null {\n const name = product.name?.trim();\n if (!name) return null;\n\n const dept = departmentBadge(departmentId);\n const slug = product.url\n .split('?')[0]\n .slice(-24)\n .replace(/[^a-zA-Z0-9]+/g, '-');\n return {\n id: slug ? `shopping-${slug}` : `shopping-${index}`,\n name,\n departmentId: dept.id,\n price: parsePrice(product.price, undefined, product.priceText),\n rating: parseRatingNumber(product.rating),\n reviews: parseReviewCount(product.reviews ?? product.reviewCount),\n icon: dept.icon,\n accent: dept.accent,\n imageUrl:\n product.imageUrl?.trim() ||\n pickConnectorImageUrl(product as unknown as Record<string, unknown>) ||\n undefined,\n url: product.url?.trim() || undefined,\n source: 'yantra',\n };\n}\n\n/** Map connector analyze payload to storefront `Product` cards. */\nexport function mapAnalyzeResultToProducts(data: ShoppingAnalyzeResult, departmentId?: string): Product[] {\n const deptId = departmentId;\n const fromProperties = (data.properties ?? [])\n .map((item, index) => mapWidgetProperty(item, deptId, index))\n .filter((p): p is Product => p !== null);\n if (fromProperties.length > 0) {\n return fromProperties;\n }\n\n return (data.products ?? [])\n .map((item, index) => mapConnectorProduct(item, deptId, index))\n .filter((p): p is Product => p !== null);\n}\n\nfunction buildConnectorParams(params: ShoppingSearchParams): Record<string, unknown> {\n const preset = params.departmentId ? DEPARTMENT_SEARCH_PRESETS[params.departmentId] : undefined;\n const trimmed = params.query.trim();\n const query = trimmed || preset?.query;\n if (!query) {\n throw new Error('Shopping search requires a query or department');\n }\n const category = params.category ?? preset?.category;\n\n return {\n query,\n ...(category ? { category } : {}),\n ...(params.budget != null ? { budget: params.budget } : {}),\n maxResults: params.maxResults ?? 24,\n };\n}\n\n/** Search products exclusively via the yantra-shopping-search cdecli connector. */\nexport async function searchShoppingProducts(params: ShoppingSearchParams): Promise<Product[]> {\n const { products } = await searchShoppingProductsWithMeta(params);\n return products;\n}\n\nasync function searchViaConnector(\n params: ShoppingSearchParams,\n): Promise<{ products: Product[]; query: string; totalCount: number; error?: string }> {\n const connectorParams = buildConnectorParams(params);\n const result = await invokeShoppingSearchConnector<ShoppingAnalyzeResult>(connectorParams);\n\n if (!result.success) {\n throw new Error(result.error || 'Shopping search failed');\n }\n\n const data = result.data;\n if (data?.success === false && !data.properties?.length && !data.products?.length) {\n throw new Error(data.error || 'Shopping search returned no results');\n }\n\n const mapped = mapAnalyzeResultToProducts(data ?? {}, params.departmentId);\n const products = mapped;\n return {\n products,\n query: data?.query ?? String(connectorParams.query),\n totalCount: data?.totalCount ?? products.length,\n ...(data?.error ? { error: data.error } : {}),\n };\n}\n\nfunction normalizeTitleKey(name: string): string {\n return name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, ' ')\n .trim()\n .slice(0, 80);\n}\n\n/**\n * Merge product lists in SOURCE_ORDER; skip near-duplicate titles across sources.\n * Prefer earlier sources (Amazon first, Yantra last).\n */\nexport function mergeShoppingProductSources(groups: Product[][]): Product[] {\n const seen = new Set<string>();\n const merged: Product[] = [];\n for (const group of groups) {\n for (const product of group) {\n const key = normalizeTitleKey(product.name);\n if (key && seen.has(key)) continue;\n if (key) seen.add(key);\n merged.push(product);\n }\n }\n return merged;\n}\n\n/** An empty list per source — the shape {@link mergeBySourceOrder} reads back. */\nexport function emptySourceBuckets(): Record<ProductSource, Product[]> {\n return Object.fromEntries(SOURCE_ORDER.map((source) => [source, [] as Product[]])) as Record<\n ProductSource,\n Product[]\n >;\n}\n\n/**\n * Merge every bucket in SOURCE_ORDER.\n *\n * This order used to be a hand-written array indexed positionally into\n * `SHOPPING_RETAILER_IDS` — `retailerProductGroups[3]` meant Shopify — written out\n * twice, so a new lane meant editing both and hoping the indices still lined up.\n * It also listed only some of the buckets: `costco` / `homedepot` / `lowes` /\n * `newegg` were filled and then never merged, which silently dropped every\n * browser-paired row from those four shops.\n */\nexport function mergeBySourceOrder(buckets: Record<ProductSource, Product[]>): Product[] {\n return mergeShoppingProductSources(SOURCE_ORDER.map((source) => buckets[source]));\n}\n\n/** @deprecated Prefer mergeShoppingProductSources — kept for existing tests. */\nexport function mergeAmazonAndConnectorProducts(amazon: Product[], connector: Product[]): Product[] {\n return mergeShoppingProductSources([amazon, connector]);\n}\n\nfunction outcomeErrorMessage(reason: unknown): string {\n return reason instanceof Error ? reason.message : String(reason);\n}\n\n/** Parallel 402 / billing noise must never be the shop-page copy. */\nexport function sanitizeShoppingProviderError(message: string, label = 'Amazon'): string {\n if (/402|insufficient credit|billing details|add more funds/i.test(message)) {\n return `${label} results are currently unavailable. Please try again later.`;\n }\n return message;\n}\n\n/** Infer storefront source from a product URL when LIST actions are unavailable. */\nexport function inferProductSourceFromUrl(url?: string): ProductSource | undefined {\n return detectRetailerSourceFromUrl(url);\n}\n\n/**\n * Re-tag Yantra research cards that clearly belong to a retailer domain.\n * Used when dedicated LIST actions fail (e.g. remote agent without first-aid 005)\n * so the storefront still sections by retailer.\n */\nexport function rehomeYantraProductsByUrl(products: Product[]): Product[] {\n return products.map((product) => {\n if (product.source && product.source !== 'yantra') return product;\n const inferred = inferProductSourceFromUrl(product.url);\n if (!inferred || inferred === 'yantra') return product;\n return { ...product, source: inferred };\n });\n}\n\n/**\n * Send one aggregator row to the section of the shop that actually hosts it.\n *\n * A Google Shopping row IS a bestbuy.com / costco.com / brand-store page. Leaving\n * it under \"Google Shopping\" would bury the only server-side route we have to\n * those shops in a section nobody browses by name. A row on a shop we do not\n * recognise keeps `google`, which is the honest label for it.\n */\nexport function rehomeAggregatorProduct(product: Product): Product {\n const inferred = inferProductSourceFromUrl(product.url);\n if (!inferred || inferred === 'yantra' || inferred === product.source) return product;\n return { ...product, source: inferred };\n}\n\n/** Bucket one lane's results by the source each row really belongs to. */\nfunction collectRetailerLane(\n buckets: Record<ProductSource, Product[]>,\n source: ProductSource,\n products: Product[],\n): void {\n const isAggregator = isAggregatorSource(source);\n for (const product of products) {\n const tagged = { ...product, source };\n const homed = isAggregator ? rehomeAggregatorProduct(tagged) : tagged;\n buckets[homed.source ?? source].push(homed);\n }\n}\n\nfunction isUnknownActionError(reason: unknown): boolean {\n const msg = outcomeErrorMessage(reason);\n return /unknown action/i.test(msg);\n}\n\n/**\n * Resolve the string every provider is searched with.\n *\n * The caller hands down the query yantra-brain cleaned (\"i only asked for\n * running shoes\" → \"running shoes\"); a department browse has no typed query and\n * falls back to its preset, which is a broad keyword union.\n */\nfunction resolveQueryAndCategory(params: ShoppingSearchParams): {\n preset?: { query: string; catalogQuery: string; category: string };\n trimmed: string;\n query: string;\n category?: string;\n} {\n const preset = params.departmentId ? DEPARTMENT_SEARCH_PRESETS[params.departmentId] : undefined;\n const trimmed = params.query.trim();\n const browse = preset?.query ?? (params.departmentId ? DEFAULT_BROWSE_QUERY : undefined);\n const query = trimmed || browse;\n if (!query) {\n throw new Error('Shopping search requires a query or department');\n }\n return { preset, trimmed, query, category: params.category ?? preset?.category };\n}\n\n/**\n * Drop rows the brain's read of the request rules out, and log what went.\n *\n * No relevance (brain unreachable, or a department browse) → nothing is dropped.\n * The surface does not invent its own notion of what a product is.\n */\nfunction keepRelevant(products: Product[], relevance: ShoppingRelevance | undefined): Product[] {\n if (!relevance) return products;\n const relevant = filterProductsByRelevance(products, relevance);\n if (relevant.length < products.length) {\n console.debug(\n `[shoppingProductSearch] dropped ${products.length - relevant.length}/${products.length} off-query results for \"${relevance.query ?? relevance.productType ?? ''}\"`,\n );\n }\n return relevant;\n}\n\n/**\n * The last word on a phase's rows before anyone - the grid or the AI - sees\n * them: relevant to the ask, sellable (linked to a product page, not marked out\n * of stock), and priced consistently. See {@link keepSellableProducts} for why\n * an unsellable row is not a result rather than a row with a badge.\n */\nfunction finalizeRows(products: Product[], relevance: ShoppingRelevance | undefined): Product[] {\n return keepSellableProducts(keepRelevant(products, relevance)).map(reconcilePricing);\n}\n\n/**\n * FAST shopping phase — structured, low-latency sources only: the LemmeBuyIt\n * typed catalog (the \"printing-press\" binary) + the Amazon SERP. Neither reads\n * whole pages through Parallel AI, so this returns in a few seconds for an\n * instant first paint. The slower cross-retailer research streams in via\n * {@link searchShoppingProductsRest}. Mirrors the flights fast path (bookable\n * first) and the hotels fast path (Airbnb before the browser enrich).\n */\n/** The fast phase's two sources. */\nexport type FastSearchSource = 'amazon' | 'catalog';\n\nexport interface FastSearchOptions {\n /**\n * Called once per source the moment that source settles, with its rows\n * already through the same relevance / sellable / pricing pass as the final\n * result (thumbnails are left to the final result). `products` is empty when\n * the source failed or found nothing that passed.\n *\n * The two sources take very different times: Amazon answers in ~3s, while\n * the catalog shares a one-at-a-time provider lane and walks its retailers\n * one call each - measured at ~40s for \"macbook\". Waiting for both before\n * painting anything showed \"Searching…\" over nineteen MacBooks that had\n * been in hand since second three.\n */\n onSourceSettled?: (source: FastSearchSource, products: Product[], meta?: FastSourceMeta) => void;\n}\n\n/** What a source said about its results as a whole, beside the rows. */\nexport interface FastSourceMeta {\n /** The store's own refinement column (Brand, Color, ...), when its results page had one. */\n facets?: SearchFacet[];\n}\n\nexport async function searchShoppingProductsFast(\n params: ShoppingSearchParams,\n options: FastSearchOptions = {},\n): Promise<{\n products: Product[];\n query: string;\n totalCount: number;\n affiliateDisclosure?: string;\n error?: string;\n /** Amazon's refinement column for this search; empty when it printed none. */\n facets: SearchFacet[];\n}> {\n const { preset, trimmed, query, category } = resolveQueryAndCategory(params);\n const amazonMaxResults = params.maxResults ?? 48;\n const retailerMaxResults = params.maxResults ?? 24;\n\n /** Tell the caller a source settled; a callback throwing must not fail the search. */\n const reportSource = (source: FastSearchSource, rows: Product[], meta?: FastSourceMeta): void => {\n if (!options.onSourceSettled) return;\n try {\n options.onSourceSettled(source, rows.length > 0 ? finalizeRows(rows, params.relevance) : [], meta);\n } catch (err) {\n console.warn('[shoppingProductSearch] early paint failed:', err);\n }\n };\n /** Report the source either way it settles, and hand its outcome on unchanged. */\n const reported = <R extends { products: Product[]; facets?: SearchFacet[] }>(\n source: FastSearchSource,\n run: Promise<R>,\n tag: (rows: Product[]) => Product[] = (rows) => rows,\n ): Promise<R> =>\n run.then(\n (result) => {\n reportSource(\n source,\n tag(result.products),\n result.facets?.length ? { facets: result.facets } : undefined,\n );\n return result;\n },\n (reason: unknown) => {\n if (!isConnectorLaneAbort(reason)) reportSource(source, []);\n throw reason;\n },\n );\n\n const catalogEnabled = isCatalogConfigured();\n const [amazonOutcome, catalogOutcome] = await Promise.allSettled([\n reported(\n 'amazon',\n searchAmazonProducts({\n query,\n departmentId: params.departmentId,\n budget: params.budget,\n maxResults: amazonMaxResults,\n category,\n ownBrowser: params.ownBrowser,\n }),\n (rows) => rows.map((p) => ({ ...p, source: 'amazon' as const })),\n ),\n catalogEnabled\n ? reported(\n 'catalog',\n searchCatalogProducts({\n query: trimmed || preset?.catalogQuery || query,\n departmentId: params.departmentId,\n budget: params.budget,\n maxResults: retailerMaxResults,\n // The catalog is the one lane that KNOWS stock; ask it for\n // rows a shopper can buy rather than filtering them out later.\n inStockOnly: true,\n ...(params.lane ? { lane: params.lane } : {}),\n }),\n )\n : Promise.resolve({\n products: [] as Product[],\n query,\n totalCount: 0,\n affiliateDisclosure: undefined as string | undefined,\n }),\n ]);\n\n // Cancelled, not failed: nobody is waiting for these rows any more, and\n // answering with the Amazon half would let a caller cache a rail that is\n // missing its catalog rows as if that were the whole answer.\n if (catalogOutcome.status === 'rejected' && isConnectorLaneAbort(catalogOutcome.reason)) {\n throw catalogOutcome.reason;\n }\n\n const amazonProducts =\n amazonOutcome.status === 'fulfilled'\n ? amazonOutcome.value.products.map((p) => ({ ...p, source: 'amazon' as const }))\n : [];\n const catalogProducts = catalogOutcome.status === 'fulfilled' ? catalogOutcome.value.products : [];\n const affiliateDisclosure =\n catalogOutcome.status === 'fulfilled' ? catalogOutcome.value.affiliateDisclosure : undefined;\n if (amazonOutcome.status === 'rejected') {\n console.warn('[shoppingProductSearch] Amazon search failed:', amazonOutcome.reason);\n }\n if (catalogOutcome.status === 'rejected') {\n console.warn('[shoppingProductSearch] Catalog search failed:', catalogOutcome.reason);\n }\n\n const merged = finalizeRows(mergeShoppingProductSources([catalogProducts, amazonProducts]), params.relevance);\n const products = merged;\n\n const partialErrors = [\n catalogEnabled && catalogOutcome.status === 'rejected' && !products.some((p) => p.source === 'catalog')\n ? `${SOURCE_LABELS.catalog} results unavailable`\n : null,\n amazonOutcome.status === 'rejected' && !products.some((p) => p.source === 'amazon')\n ? `${SOURCE_LABELS.amazon} results unavailable`\n : null,\n ].filter(Boolean);\n\n return {\n products,\n query,\n totalCount: products.length,\n facets: amazonOutcome.status === 'fulfilled' ? amazonOutcome.value.facets : [],\n ...(affiliateDisclosure && products.some((p) => p.source === 'catalog') ? { affiliateDisclosure } : {}),\n ...(partialErrors.length > 0 ? { error: partialErrors.join(' · ') } : {}),\n };\n}\n\n/**\n * SLOW shopping phase — the Yantra ANALYZE page research + per-retailer LIST\n * actions (Walmart/eBay/Target/Shopify/Temu/Google), all Parallel-AI-backed. The connector\n * ANALYZE runs first, then the retailer LISTs, so the Parallel-backed calls don't\n * all contend at once (same reason the combined path sequences its two phases).\n * The caller renders {@link searchShoppingProductsFast} first, then merges these\n * in as they arrive (deduped by title against what's already shown).\n */\nexport async function searchShoppingProductsRest(\n params: ShoppingSearchParams,\n): Promise<{ products: Product[]; error?: string }> {\n const { query, category } = resolveQueryAndCategory(params);\n const retailerMaxResults = params.maxResults ?? 24;\n const yantraMaxResults = params.maxResults ?? 24;\n const searchParams = { ...params, query, maxResults: yantraMaxResults };\n const sharedRetailer = {\n query,\n departmentId: params.departmentId,\n budget: params.budget,\n maxResults: retailerMaxResults,\n category,\n };\n\n const connectorOutcome = await Promise.allSettled([searchViaConnector(searchParams)]).then((r) => r[0]);\n const retailerOutcomes = await Promise.allSettled(\n SHOPPING_RETAILER_IDS.map((id) => searchRetailerProducts(id, sharedRetailer)),\n );\n if (retailerOutcomes.some((o) => o.status === 'rejected' && isUnknownActionError(o.reason))) {\n console.warn(\n '[shoppingProductSearch] Retailer LIST action missing on agent — apply first-aid 005 to yantra-shopping-search. Falling back to URL sectioning from Yantra ANALYZE.',\n );\n }\n\n const buckets = emptySourceBuckets();\n // Lane rows first, so a shop's own listing outranks a re-homed copy of it.\n SHOPPING_RETAILER_IDS.forEach((id, index) => {\n const outcome = retailerOutcomes[index];\n if (outcome.status !== 'fulfilled') {\n console.warn(`[shoppingProductSearch] ${RETAILER_SEARCH_CONFIGS[id].label} search failed:`, outcome.reason);\n return;\n }\n collectRetailerLane(buckets, RETAILER_SEARCH_CONFIGS[id].source, outcome.value.products);\n });\n\n const connectorProducts = rehomeYantraProductsByUrl(\n connectorOutcome.status === 'fulfilled'\n ? connectorOutcome.value.products.map((p) => ({ ...p, source: 'yantra' as const }))\n : [],\n );\n if (connectorOutcome.status === 'rejected') {\n console.warn('[shoppingProductSearch] Connector search failed:', connectorOutcome.reason);\n }\n for (const product of connectorProducts) {\n buckets[product.source ?? 'yantra'].push(product);\n }\n\n const merged = mergeBySourceOrder(buckets);\n const products = finalizeRows(merged, params.relevance);\n return { products };\n}\n\n/**\n * Run Amazon + Yantra first (priority SERP + research), then other retailer LIST\n * actions. Six parallel agent execs starve Amazon/Parallel; sequencing fixes that.\n *\n * Any single provider failing alone is non-fatal.\n */\nexport async function searchShoppingProductsWithMeta(params: ShoppingSearchParams): Promise<{\n products: Product[];\n query: string;\n totalCount: number;\n affiliateDisclosure?: string;\n error?: string;\n}> {\n const { preset, trimmed, query, category } = resolveQueryAndCategory(params);\n\n const amazonMaxResults = params.maxResults ?? 48;\n const retailerMaxResults = params.maxResults ?? 24;\n const yantraMaxResults = params.maxResults ?? 24;\n const searchParams = { ...params, query, maxResults: yantraMaxResults };\n const sharedRetailer = {\n query,\n departmentId: params.departmentId,\n budget: params.budget,\n maxResults: retailerMaxResults,\n category,\n };\n\n // Phase 1 — Amazon SERP + Yantra research + typed catalog. The catalog call\n // hits LemmeBuyIt rather than Parallel, so unlike a sixth SERP read it does not\n // contend for the same upstream. Skipped outright when no LemmeBuyIt key is\n // configured, so an unconfigured org pays nothing for it.\n const catalogEnabled = isCatalogConfigured();\n const [amazonOutcome, connectorOutcome, catalogOutcome] = await Promise.allSettled([\n searchAmazonProducts({\n query,\n departmentId: params.departmentId,\n budget: params.budget,\n maxResults: amazonMaxResults,\n category,\n ownBrowser: params.ownBrowser,\n }),\n searchViaConnector(searchParams),\n catalogEnabled\n ? searchCatalogProducts({\n // A typed query goes to the catalog as-is; only a department chip\n // substitutes the tighter catalogQuery (see the presets above).\n query: trimmed || preset?.catalogQuery || query,\n departmentId: params.departmentId,\n budget: params.budget,\n maxResults: retailerMaxResults,\n inStockOnly: true,\n // `category` is DELIBERATELY not forwarded. The preset's value is a\n // research-path hint (\"electronics\"), while the catalog filters on\n // its own per-retailer taxonomy (\"kitchen > beverage appliances >\n // coffee makers\"), so the hint matches nothing and empties the\n // result: target/\"wireless headphones\" returns 3 Sennheisers\n // without it and 0 rows with it. Only a caller that knows the real\n // taxonomy should filter by category.\n })\n : Promise.resolve({\n products: [] as Product[],\n query,\n totalCount: 0,\n affiliateDisclosure: undefined as string | undefined,\n }),\n ]);\n\n // Phase 2 — other retailers after Amazon+Yantra so Parallel isn't starved.\n const retailerOutcomes = await Promise.allSettled(\n SHOPPING_RETAILER_IDS.map((id) => searchRetailerProducts(id, sharedRetailer)),\n );\n if (retailerOutcomes.some((o) => o.status === 'rejected' && isUnknownActionError(o.reason))) {\n console.warn(\n '[shoppingProductSearch] Retailer LIST action missing on agent — apply first-aid 005 to yantra-shopping-search. Falling back to URL sectioning from Yantra ANALYZE.',\n );\n }\n\n const amazonProducts =\n amazonOutcome.status === 'fulfilled'\n ? amazonOutcome.value.products.map((p) => ({ ...p, source: 'amazon' as const }))\n : [];\n\n const catalogProducts = catalogOutcome.status === 'fulfilled' ? catalogOutcome.value.products : [];\n // LemmeBuyIt's free tier returns ActiveJunky affiliate links and its own\n // instructions require a disclosure wherever they are shown to an end user.\n const affiliateDisclosure =\n catalogOutcome.status === 'fulfilled' ? catalogOutcome.value.affiliateDisclosure : undefined;\n if (catalogOutcome.status === 'rejected') {\n console.warn('[shoppingProductSearch] Catalog search failed:', catalogOutcome.reason);\n }\n\n // Section ANALYZE hits by retailer URL so cards aren't stuck under Yantra when LIST is missing/empty.\n const connectorProducts = rehomeYantraProductsByUrl(\n connectorOutcome.status === 'fulfilled'\n ? connectorOutcome.value.products.map((p) => ({ ...p, source: 'yantra' as const }))\n : [],\n );\n\n if (amazonOutcome.status === 'rejected') {\n console.warn('[shoppingProductSearch] Amazon search failed:', amazonOutcome.reason);\n }\n SHOPPING_RETAILER_IDS.forEach((id, index) => {\n const outcome = retailerOutcomes[index];\n if (outcome.status === 'rejected') {\n console.warn(`[shoppingProductSearch] ${RETAILER_SEARCH_CONFIGS[id].label} search failed:`, outcome.reason);\n }\n });\n if (connectorOutcome.status === 'rejected') {\n console.warn('[shoppingProductSearch] Connector search failed:', connectorOutcome.reason);\n }\n\n // Buckets fill in precision order: typed catalog rows, then the Amazon SERP,\n // then each retailer lane, then whatever the Yantra research re-homed. Best\n // Buy / Costco / Home Depot / Lowe's / Newegg have no lane of their own — they\n // arrive from the Google Shopping aggregator lane or from ANALYZE, both of\n // which are re-homed to their section by URL.\n const buckets = emptySourceBuckets();\n buckets.catalog.push(...catalogProducts);\n buckets.amazon.push(...amazonProducts);\n SHOPPING_RETAILER_IDS.forEach((id, index) => {\n const outcome = retailerOutcomes[index];\n if (outcome.status !== 'fulfilled') return;\n collectRetailerLane(buckets, RETAILER_SEARCH_CONFIGS[id].source, outcome.value.products);\n });\n for (const product of connectorProducts) {\n buckets[product.source ?? 'yantra'].push(product);\n }\n\n const merged = mergeBySourceOrder(buckets);\n const relevant = finalizeRows(merged, params.relevance);\n\n if (relevant.length === 0) {\n const errors = [\n amazonOutcome.status === 'rejected'\n ? sanitizeShoppingProviderError(outcomeErrorMessage(amazonOutcome.reason), SOURCE_LABELS.amazon)\n : null,\n catalogOutcome.status === 'rejected'\n ? sanitizeShoppingProviderError(outcomeErrorMessage(catalogOutcome.reason), SOURCE_LABELS.catalog)\n : null,\n ...retailerOutcomes.map((o, index) =>\n o.status === 'rejected'\n ? sanitizeShoppingProviderError(\n outcomeErrorMessage(o.reason),\n SOURCE_LABELS[RETAILER_SEARCH_CONFIGS[SHOPPING_RETAILER_IDS[index]].source],\n )\n : null,\n ),\n connectorOutcome.status === 'rejected'\n ? sanitizeShoppingProviderError(outcomeErrorMessage(connectorOutcome.reason), SOURCE_LABELS.yantra)\n : null,\n ].filter(Boolean);\n throw new Error(errors[0] || 'No products found. Try a different search.');\n }\n\n const products = relevant;\n\n const partialErrors = [\n catalogEnabled && catalogOutcome.status === 'rejected' && !products.some((p) => p.source === 'catalog')\n ? `${SOURCE_LABELS.catalog} results unavailable`\n : null,\n amazonOutcome.status === 'rejected' && !products.some((p) => p.source === 'amazon')\n ? `${SOURCE_LABELS.amazon} results unavailable`\n : null,\n ...SHOPPING_RETAILER_IDS.map((id, index) => {\n const source = RETAILER_SEARCH_CONFIGS[id].source;\n const hasProducts = products.some((p) => p.source === source);\n if (hasProducts) return null;\n return retailerOutcomes[index].status === 'rejected'\n ? `${SOURCE_LABELS[source]} results unavailable`\n : null;\n }),\n connectorOutcome.status === 'rejected' && !products.some((p) => p.source === 'yantra')\n ? `${SOURCE_LABELS.yantra} unavailable`\n : null,\n ].filter(Boolean);\n\n return {\n products,\n query,\n totalCount: products.length,\n ...(affiliateDisclosure && products.some((p) => p.source === 'catalog') ? { affiliateDisclosure } : {}),\n ...(partialErrors.length > 0 ? { error: partialErrors.join(' · ') } : {}),\n };\n}\n\nexport { SOURCE_LABELS, SOURCE_ORDER };\nexport type { ShoppingRetailerId };\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;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;AACtD,EAAO,OAAA;AAAA,IACL;AAAA,GACF;AACF"}
1
+ {"version":3,"file":"shoppingProductSearch.js","sources":["../../../../src/features/shopping/services/shoppingProductSearch.ts"],"sourcesContent":["/**\n * Shop search lanes — native twin of the web surface's\n * `services/shoppingProductSearch.ts` (0.49.0 for the merge, the lanes and\n * `onLane`; the AI reading of 0.44.0 is D4).\n *\n * Native differences, until the later phases of\n * portable-devices/mobile/native-shopping-parity.md land:\n * - no page-scrape thumbnail enrichment (`enrichProductThumbnails`): the card\n * resolves its photo from the row (productImage.ts);\n * - no paired-browser Amazon read (`ownBrowser` is ignored, see\n * amazonProductSearch.ts).\n * Section order and labels live in `../catalog` (native keeps them there).\n */\nimport { departmentBadge, SOURCE_LABELS, SOURCE_ORDER, type Product, type ProductSource } from '../catalog';\nimport { isSearchStandIn } from '../imageSizing';\nimport { pickConnectorImageUrl } from '../resolveProductImage';\nimport { searchAmazonProducts } from './amazonProductSearch';\nimport { isCatalogConfigured, searchCatalogProducts } from './catalogProductSearch';\nimport {\n RETAILER_SEARCH_CONFIGS,\n SHOPPING_RETAILER_IDS,\n searchRetailerProducts,\n type ShoppingRetailerId,\n} from './retailerProductSearch';\nimport { parsePrice, reconcilePricing } from './pricing';\nimport { keepShowableProducts } from './productAvailability';\nimport { detectRetailerSourceFromUrl, isAggregatorSource } from './retailerUrl';\nimport {\n invokeShoppingSearchConnector,\n isConnectorLaneAbort,\n type ConnectorLaneOptions,\n type ShoppingAnalyzeResult,\n type ShoppingConnectorProduct,\n type ShoppingWidgetProperty,\n} from './shoppingSearchConnectorClient';\nimport { positiveCount } from './countText';\nimport type { SearchFacet } from './searchCardFields';\nimport { filterProductsByRelevance, type ShoppingRelevance } from './searchRelevance';\n\nexport { isCatalogConfigured } from './catalogProductSearch';\nexport { detectRetailerSourceFromUrl } from './retailerUrl';\n\nexport interface ShoppingSearchParams {\n query: string;\n category?: string;\n departmentId?: string;\n budget?: number | string;\n maxResults?: number;\n /**\n * yantra-brain's read of what the user is buying. Supplied → results are\n * filtered against it; absent (brain unreachable, or a department browse)\n * → every row a provider returned is shown, exactly as before.\n */\n relevance?: ShoppingRelevance;\n /** Web only (paired desktop browser). Ignored on native; see amazonProductSearch.ts. */\n ownBrowser?: boolean;\n /**\n * Priority and cancellation for the catalog call, which shares one\n * one-at-a-time provider lane with every other catalog read on the page. The\n * landing page's rails pass `background` plus a signal that fires once no\n * rail is waiting on the answer; a search the shopper typed leaves it unset.\n */\n lane?: ConnectorLaneOptions;\n}\n\n/** Default browse queries per department — used when the user picks a category chip. */\n/**\n * Per-department browse queries.\n *\n * `query` is a deliberately broad keyword set, which suits the Parallel research\n * path: it reads whole pages and a wider net finds more candidates.\n *\n * `catalogQuery` is the OPPOSITE, and exists because the two backends want\n * opposite things. The catalog runs a real text search over product names, so the\n * broad set matches nothing coherent - \"wireless headphones smartphone laptop\n * tablet electronics\" against Target returned Windex wipes, a USB cable and an LED\n * lamp, while plain \"wireless headphones\" returned three Sennheiser ACCENTUM\n * models with real prices and images. One tight product-class term is what the\n * catalog needs.\n */\nexport const DEPARTMENT_SEARCH_PRESETS: Record<string, { query: string; catalogQuery: string; category: string }> = {\n 'high-tech': {\n query: 'wireless headphones smartphone laptop tablet electronics',\n catalogQuery: 'wireless headphones',\n category: 'electronics',\n },\n sports: {\n query: 'sports gear bicycle backpack football fitness',\n catalogQuery: 'backpack',\n category: 'sports',\n },\n beauty: {\n query: 'skincare serum perfume beauty wellness',\n catalogQuery: 'skincare serum',\n category: 'beauty',\n },\n 'home-garden': {\n query: 'outdoor furniture BBQ grill string lights lawn garden',\n catalogQuery: 'outdoor furniture',\n category: 'home',\n },\n office: {\n query: 'standing desk tablet office supplies monitor',\n catalogQuery: 'standing desk',\n category: 'office',\n },\n toys: {\n query: 'toys games building blocks plush kids',\n catalogQuery: 'building blocks',\n category: 'toys',\n },\n fashion: {\n query: 'running shoes sneakers jacket jeans handbag apparel',\n catalogQuery: 'running shoes',\n category: 'fashion',\n },\n grocery: {\n query: 'coffee snacks paper towels laundry detergent household',\n catalogQuery: 'coffee',\n category: 'grocery',\n },\n auto: {\n query: 'car vacuum dash cam power drill tool set automotive',\n catalogQuery: 'power drill',\n category: 'auto',\n },\n pets: {\n query: 'dog food cat litter pet bed chew toys',\n catalogQuery: 'dog food',\n category: 'pets',\n },\n kitchen: {\n query: 'air fryer cookware set knife set blender kitchen',\n catalogQuery: 'air fryer',\n category: 'kitchen',\n },\n furniture: {\n query: 'sofa bookshelf floor lamp coffee table home decor',\n catalogQuery: 'sofa',\n category: 'furniture',\n },\n baby: {\n query: 'stroller car seat baby monitor crib kids clothing',\n catalogQuery: 'stroller',\n category: 'baby',\n },\n health: {\n query: 'fitness tracker protein powder yoga mat dumbbells vitamins',\n catalogQuery: 'fitness tracker',\n category: 'health',\n },\n gaming: {\n query: 'gaming console controller gaming headset graphics card gaming chair',\n catalogQuery: 'gaming headset',\n category: 'gaming',\n },\n books: {\n query: 'bestselling books vinyl records blu-ray audiobooks',\n catalogQuery: 'bestselling books',\n category: 'books',\n },\n jewelry: {\n query: 'smartwatch wristwatch necklace earrings ring jewelry',\n catalogQuery: 'wristwatch',\n category: 'jewelry',\n },\n travel: {\n query: 'carry-on suitcase travel backpack packing cubes luggage',\n catalogQuery: 'carry-on suitcase',\n category: 'travel',\n },\n music: {\n query: 'acoustic guitar digital piano keyboard microphone instruments',\n catalogQuery: 'acoustic guitar',\n category: 'music',\n },\n camera: {\n query: 'mirrorless camera lens drone action camera tripod',\n catalogQuery: 'mirrorless camera',\n category: 'camera',\n },\n};\n\nexport const DEFAULT_BROWSE_QUERY = 'popular products electronics sports beauty home office toys';\n\nfunction parseReviewCount(value?: number | string): number {\n return positiveCount(value) ?? 0;\n}\n\nfunction parseRatingNumber(rating?: number | string): number {\n if (typeof rating === 'number' && Number.isFinite(rating)) {\n return Math.min(5, Math.max(0, rating));\n }\n if (typeof rating === 'string') {\n const match = rating.match(/(\\d(?:\\.\\d+)?)/);\n if (match) {\n const value = Number.parseFloat(match[1]);\n if (Number.isFinite(value)) return Math.min(5, Math.max(0, value));\n }\n }\n return 0;\n}\n\nfunction mapWidgetProperty(\n property: ShoppingWidgetProperty,\n departmentId: string | undefined,\n index: number,\n): Product | null {\n const title = property.title?.trim();\n if (!title) return null;\n\n const dept = departmentBadge(departmentId);\n return {\n id: property.id?.trim() || `shopping-${index}-${title.slice(0, 24).replace(/\\s+/g, '-')}`,\n name: title,\n departmentId: dept.id,\n price: parsePrice(property.price, property.priceLabel),\n rating: parseRatingNumber(property.rating),\n reviews: parseReviewCount(property.reviews ?? property.reviewCount),\n icon: dept.icon,\n accent: dept.accent,\n imageUrl:\n property.imageUrl?.trim() ||\n pickConnectorImageUrl(property as unknown as Record<string, unknown>) ||\n undefined,\n url: property.url?.trim() || undefined,\n source: 'yantra',\n };\n}\n\nfunction mapConnectorProduct(\n product: ShoppingConnectorProduct,\n departmentId: string | undefined,\n index: number,\n): Product | null {\n const name = product.name?.trim();\n if (!name) return null;\n\n const dept = departmentBadge(departmentId);\n const slug = product.url\n .split('?')[0]\n .slice(-24)\n .replace(/[^a-zA-Z0-9]+/g, '-');\n return {\n id: slug ? `shopping-${slug}` : `shopping-${index}`,\n name,\n departmentId: dept.id,\n price: parsePrice(product.price, undefined, product.priceText),\n rating: parseRatingNumber(product.rating),\n reviews: parseReviewCount(product.reviews ?? product.reviewCount),\n icon: dept.icon,\n accent: dept.accent,\n imageUrl:\n product.imageUrl?.trim() ||\n pickConnectorImageUrl(product as unknown as Record<string, unknown>) ||\n undefined,\n url: product.url?.trim() || undefined,\n source: 'yantra',\n };\n}\n\n/** Map connector analyze payload to storefront `Product` cards. */\nexport function mapAnalyzeResultToProducts(data: ShoppingAnalyzeResult, departmentId?: string): Product[] {\n const deptId = departmentId;\n const fromProperties = (data.properties ?? [])\n .map((item, index) => mapWidgetProperty(item, deptId, index))\n .filter((p): p is Product => p !== null);\n if (fromProperties.length > 0) {\n return fromProperties;\n }\n\n return (data.products ?? [])\n .map((item, index) => mapConnectorProduct(item, deptId, index))\n .filter((p): p is Product => p !== null);\n}\n\nfunction buildConnectorParams(params: ShoppingSearchParams): Record<string, unknown> {\n const preset = params.departmentId ? DEPARTMENT_SEARCH_PRESETS[params.departmentId] : undefined;\n const trimmed = params.query.trim();\n const query = trimmed || preset?.query;\n if (!query) {\n throw new Error('Shopping search requires a query or department');\n }\n const category = params.category ?? preset?.category;\n\n return {\n query,\n ...(category ? { category } : {}),\n ...(params.budget != null ? { budget: params.budget } : {}),\n maxResults: params.maxResults ?? 24,\n };\n}\n\n/** Search products exclusively via the yantra-shopping-search cdecli connector. */\nexport async function searchShoppingProducts(params: ShoppingSearchParams): Promise<Product[]> {\n const { products } = await searchShoppingProductsWithMeta(params);\n return products;\n}\n\nasync function searchViaConnector(\n params: ShoppingSearchParams,\n): Promise<{ products: Product[]; query: string; totalCount: number; error?: string }> {\n const connectorParams = buildConnectorParams(params);\n const result = await invokeShoppingSearchConnector<ShoppingAnalyzeResult>(connectorParams);\n\n if (!result.success) {\n throw new Error(result.error || 'Shopping search failed');\n }\n\n const data = result.data;\n if (data?.success === false && !data.properties?.length && !data.products?.length) {\n throw new Error(data.error || 'Shopping search returned no results');\n }\n\n const mapped = mapAnalyzeResultToProducts(data ?? {}, params.departmentId);\n const products = mapped;\n return {\n products,\n query: data?.query ?? String(connectorParams.query),\n totalCount: data?.totalCount ?? products.length,\n ...(data?.error ? { error: data.error } : {}),\n };\n}\n\nfunction normalizeTitleKey(name: string): string {\n return name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, ' ')\n .trim()\n .slice(0, 80);\n}\n\n/**\n * Merge product lists in SOURCE_ORDER; skip near-duplicate titles across sources.\n * Prefer earlier sources (Amazon first, Yantra last).\n */\n/** The store a row's listing is at: its lane's store, or for a catalog row the retailer it lists. */\nfunction storeOf(product: Product): string {\n const store = (product.source === 'catalog' && product.retailerId) || product.source || '';\n return store.toLowerCase().replace(/[^a-z0-9]/g, '');\n}\n\n/**\n * One store's listing that two lanes returned: the copy kept first stays, and\n * takes from the other what it does not know - a rating, a real photo, the\n * rest of the gallery, a price or the price before a sale, delivery - and an\n * out-of-stock mark from either. The price on the store's own card in the\n * shopper's browser (`readInBrowser`) replaces another lane's. Another store's\n * listing of the same product is left alone: Target's stock says nothing about\n * Amazon's.\n *\n * Why: the first copy is often the thinner one. Walmart's own results said \"Out\n * of stock\" to the shopper's browser for three \"ps5 console\" listings\n * (2026-11-19) while the store search, first to answer, said nothing; and\n * Target's server read (no rating, a search stand-in photo) replaced the card\n * the shopper's browser had read off Target's page - rated, both photos, \"Out\n * of stock\" - for the PS5 Pro, and so did the catalog's copy of the same Target\n * item. A store marks a listing out of stock only when it is; \"in stock\" is\n * what many pages say by default, so the mark wins.\n */\nexport function combineSameListing(kept: Product, other: Product): Product {\n if (storeOf(kept) !== storeOf(other)) return kept;\n const next: Product = { ...kept };\n if (!(kept.rating > 0) && other.rating > 0) {\n next.rating = other.rating;\n next.reviews = other.reviews;\n }\n const keptPhoto = kept.imageUrl && !isSearchStandIn(kept.imageUrl) ? kept.imageUrl : undefined;\n if (!keptPhoto && other.imageUrl && !isSearchStandIn(other.imageUrl)) next.imageUrl = other.imageUrl;\n if (!kept.images?.length && other.images?.length) next.images = other.images;\n // The store's own card in the shopper's browser beats another lane's excerpt (Target's server\n // read said $24 for the $179.99 AirPods Pro 3), unless the kept copy's price came off the live page.\n const takePrice =\n other.price > 0 && (!(kept.price > 0) || (other.readInBrowser && !kept.readInBrowser && !kept.priceVerified));\n if (takePrice) {\n next.price = other.price;\n if (other.originalPrice !== undefined) next.originalPrice = other.originalPrice;\n else delete next.originalPrice;\n } else if (kept.originalPrice === undefined && other.originalPrice !== undefined && kept.price === other.price) {\n next.originalPrice = other.originalPrice;\n }\n if (other.readInBrowser) next.readInBrowser = true;\n if (other.inStock === false) next.inStock = false;\n else if (kept.inStock === undefined && typeof other.inStock === 'boolean') next.inStock = other.inStock;\n if (next.inStock === false) {\n // Nothing to deliver, and no \"only 3 left\" for one that is gone.\n delete next.delivery;\n delete next.badges;\n } else {\n if (kept.delivery === undefined && other.delivery !== undefined) next.delivery = other.delivery;\n if (kept.badges === undefined && other.badges !== undefined) next.badges = other.badges;\n }\n if (kept.boughtRecently === undefined && other.boughtRecently !== undefined) {\n next.boughtRecently = other.boughtRecently;\n }\n return reconcilePricing(next);\n}\n\nexport function mergeShoppingProductSources(groups: Product[][]): Product[] {\n const seen = new Map<string, number>();\n const merged: Product[] = [];\n for (const group of groups) {\n for (const product of group) {\n // One listing under two titles - Target's server read \"A New Day 3 Row Chunky Chain Necklace\",\n // its card \"3 Row Chunky Chain Necklace - A New Day Gold\" - is still one listing: same id.\n const key = normalizeTitleKey(product.name);\n const idKey = `id:${product.id}`;\n const at = seen.get(idKey) ?? (key ? seen.get(key) : undefined);\n if (at !== undefined) {\n merged[at] = combineSameListing(merged[at], product);\n continue;\n }\n if (key) seen.set(key, merged.length);\n seen.set(idKey, merged.length);\n merged.push(product);\n }\n }\n // What the store marks out of stock goes after what can be bought, each kind in its order.\n return [\n ...merged.filter((product) => product.inStock !== false),\n ...merged.filter((product) => product.inStock === false),\n ];\n}\n\n/**\n * Later lanes' copies of listings already on the grid, merged into them\n * ({@link combineSameListing}) rather than dropped. The store's own card read in\n * the shopper's browser carries the rating, stock, live price and photos that\n * the server's copy of the same listing lacks, under the same id (`tgt-<TCIN>`,\n * `wmt-<item>`, `ebay-<item>`): skipped as \"already on the grid\", every Target\n * card the server had read first stayed \"Price varies\" with no rating (live,\n * 2026-11-20). Copies of listings not on the grid come back as `pending`.\n */\nexport function mergeIntoGrid(\n rows: readonly Product[],\n copies: readonly Product[],\n): { rows: Product[]; pending: Product[] } {\n const at = new Map(rows.map((product, index) => [product.id, index]));\n const next = [...rows];\n const pending: Product[] = [];\n for (const copy of copies) {\n const index = at.get(copy.id);\n if (index === undefined) pending.push(copy);\n else next[index] = combineSameListing(next[index], copy);\n }\n // A copy can say a listing is out of stock: it goes after what can be bought, as in every merge.\n return {\n rows: [...next.filter((product) => product.inStock !== false), ...next.filter((p) => p.inStock === false)],\n pending,\n };\n}\n\n/** An empty list per source — the shape {@link mergeBySourceOrder} reads back. */\nexport function emptySourceBuckets(): Record<ProductSource, Product[]> {\n return Object.fromEntries(SOURCE_ORDER.map((source) => [source, [] as Product[]])) as Record<\n ProductSource,\n Product[]\n >;\n}\n\n/**\n * Merge every bucket in SOURCE_ORDER.\n *\n * This order used to be a hand-written array indexed positionally into\n * `SHOPPING_RETAILER_IDS` — `retailerProductGroups[3]` meant Shopify — written out\n * twice, so a new lane meant editing both and hoping the indices still lined up.\n * It also listed only some of the buckets: `costco` / `homedepot` / `lowes` /\n * `newegg` were filled and then never merged, which silently dropped every\n * browser-paired row from those four shops.\n */\nexport function mergeBySourceOrder(buckets: Record<ProductSource, Product[]>): Product[] {\n return mergeShoppingProductSources(SOURCE_ORDER.map((source) => buckets[source]));\n}\n\n/** @deprecated Prefer mergeShoppingProductSources — kept for existing tests. */\nexport function mergeAmazonAndConnectorProducts(amazon: Product[], connector: Product[]): Product[] {\n return mergeShoppingProductSources([amazon, connector]);\n}\n\nfunction outcomeErrorMessage(reason: unknown): string {\n return reason instanceof Error ? reason.message : String(reason);\n}\n\n/** Parallel 402 / billing noise must never be the shop-page copy. */\nexport function sanitizeShoppingProviderError(message: string, label = 'Amazon'): string {\n if (/402|insufficient credit|billing details|add more funds/i.test(message)) {\n return `${label} results are currently unavailable. Please try again later.`;\n }\n return message;\n}\n\n/** Infer storefront source from a product URL when LIST actions are unavailable. */\nexport function inferProductSourceFromUrl(url?: string): ProductSource | undefined {\n return detectRetailerSourceFromUrl(url);\n}\n\n/**\n * Re-tag Yantra research cards that clearly belong to a retailer domain.\n * Used when dedicated LIST actions fail (e.g. remote agent without first-aid 005)\n * so the storefront still sections by retailer.\n */\nexport function rehomeYantraProductsByUrl(products: Product[]): Product[] {\n return products.map((product) => {\n if (product.source && product.source !== 'yantra') return product;\n const inferred = inferProductSourceFromUrl(product.url);\n if (!inferred || inferred === 'yantra') return product;\n return { ...product, source: inferred };\n });\n}\n\n/**\n * Send one aggregator row to the section of the shop that actually hosts it.\n *\n * A Google Shopping row IS a bestbuy.com / costco.com / brand-store page. Leaving\n * it under \"Google Shopping\" would bury the only server-side route we have to\n * those shops in a section nobody browses by name. A row on a shop we do not\n * recognise keeps `google`, which is the honest label for it.\n */\nexport function rehomeAggregatorProduct(product: Product): Product {\n const inferred = inferProductSourceFromUrl(product.url);\n if (!inferred || inferred === 'yantra' || inferred === product.source) return product;\n return { ...product, source: inferred };\n}\n\n/** Bucket one lane's results by the source each row really belongs to. */\nfunction collectRetailerLane(\n buckets: Record<ProductSource, Product[]>,\n source: ProductSource,\n products: Product[],\n): void {\n const isAggregator = isAggregatorSource(source);\n for (const product of products) {\n const tagged = { ...product, source };\n const homed = isAggregator ? rehomeAggregatorProduct(tagged) : tagged;\n buckets[homed.source ?? source].push(homed);\n }\n}\n\nfunction isUnknownActionError(reason: unknown): boolean {\n const msg = outcomeErrorMessage(reason);\n return /unknown action/i.test(msg);\n}\n\n/**\n * Resolve the string every provider is searched with.\n *\n * The caller hands down the query yantra-brain cleaned (\"i only asked for\n * running shoes\" → \"running shoes\"); a department browse has no typed query and\n * falls back to its preset, which is a broad keyword union.\n */\nfunction resolveQueryAndCategory(params: ShoppingSearchParams): {\n preset?: { query: string; catalogQuery: string; category: string };\n trimmed: string;\n query: string;\n category?: string;\n} {\n const preset = params.departmentId ? DEPARTMENT_SEARCH_PRESETS[params.departmentId] : undefined;\n const trimmed = params.query.trim();\n const browse = preset?.query ?? (params.departmentId ? DEFAULT_BROWSE_QUERY : undefined);\n const query = trimmed || browse;\n if (!query) {\n throw new Error('Shopping search requires a query or department');\n }\n return { preset, trimmed, query, category: params.category ?? preset?.category };\n}\n\n/**\n * Drop rows the brain's read of the request rules out, and log what went.\n *\n * No relevance (brain unreachable, or a department browse) → nothing is dropped.\n * The surface does not invent its own notion of what a product is.\n */\nfunction keepRelevant(products: Product[], relevance: ShoppingRelevance | undefined): Product[] {\n if (!relevance) return products;\n const relevant = filterProductsByRelevance(products, relevance);\n if (relevant.length < products.length) {\n console.debug(\n `[shoppingProductSearch] dropped ${products.length - relevant.length}/${products.length} off-query results for \"${relevance.query ?? relevance.productType ?? ''}\"`,\n );\n }\n return relevant;\n}\n\n/**\n * The last word on a phase's rows before the grid sees them: relevant to the\n * ask, linked to a product page, and priced consistently. A row the store marks\n * out of stock stays - labelled, after the rows that can be bought - the way\n * the store's own results show it; what the agent repeats leaves it out\n * (buildShoppingAttachment, see productAvailability).\n */\nfunction finalizeRows(products: Product[], relevance: ShoppingRelevance | undefined): Product[] {\n return keepShowableProducts(keepRelevant(products, relevance)).map(reconcilePricing);\n}\n\n/**\n * FAST shopping phase — structured, low-latency sources only: the LemmeBuyIt\n * typed catalog (the \"printing-press\" binary) + the Amazon SERP. Neither reads\n * whole pages through Parallel AI, so this returns in a few seconds for an\n * instant first paint. The slower cross-retailer research streams in via\n * {@link searchShoppingProductsRest}. Mirrors the flights fast path (bookable\n * first) and the hotels fast path (Airbnb before the browser enrich).\n */\n/** The fast phase's two sources. */\nexport type FastSearchSource = 'amazon' | 'catalog';\n\nexport interface FastSearchOptions {\n /**\n * Called once per source the moment that source settles, with its rows\n * already through the same relevance / sellable / pricing pass as the final\n * result (thumbnails are left to the final result). `products` is empty when\n * the source failed or found nothing that passed.\n *\n * The two sources take very different times: Amazon answers in ~3s, while\n * the catalog shares a one-at-a-time provider lane and walks its retailers\n * one call each - measured at ~40s for \"macbook\". Waiting for both before\n * painting anything showed \"Searching…\" over nineteen MacBooks that had\n * been in hand since second three.\n */\n onSourceSettled?: (source: FastSearchSource, products: Product[], meta?: FastSourceMeta) => void;\n}\n\n/** What a source said about its results as a whole, beside the rows. */\nexport interface FastSourceMeta {\n /** The store's own refinement column (Brand, Color, ...), when its results page had one. */\n facets?: SearchFacet[];\n}\n\nexport async function searchShoppingProductsFast(\n params: ShoppingSearchParams,\n options: FastSearchOptions = {},\n): Promise<{\n products: Product[];\n query: string;\n totalCount: number;\n affiliateDisclosure?: string;\n error?: string;\n /** Amazon's refinement column for this search; empty when it printed none. */\n facets: SearchFacet[];\n}> {\n const { preset, trimmed, query, category } = resolveQueryAndCategory(params);\n const amazonMaxResults = params.maxResults ?? 48;\n const retailerMaxResults = params.maxResults ?? 24;\n\n /** Tell the caller a source settled; a callback throwing must not fail the search. */\n const reportSource = (source: FastSearchSource, rows: Product[], meta?: FastSourceMeta): void => {\n if (!options.onSourceSettled) return;\n try {\n options.onSourceSettled(source, rows.length > 0 ? finalizeRows(rows, params.relevance) : [], meta);\n } catch (err) {\n console.warn('[shoppingProductSearch] early paint failed:', err);\n }\n };\n /** Report the source either way it settles, and hand its outcome on unchanged. */\n const reported = <R extends { products: Product[]; facets?: SearchFacet[] }>(\n source: FastSearchSource,\n run: Promise<R>,\n tag: (rows: Product[]) => Product[] = (rows) => rows,\n ): Promise<R> =>\n run.then(\n (result) => {\n reportSource(\n source,\n tag(result.products),\n result.facets?.length ? { facets: result.facets } : undefined,\n );\n return result;\n },\n (reason: unknown) => {\n if (!isConnectorLaneAbort(reason)) reportSource(source, []);\n throw reason;\n },\n );\n\n const catalogEnabled = isCatalogConfigured();\n const [amazonOutcome, catalogOutcome] = await Promise.allSettled([\n reported(\n 'amazon',\n searchAmazonProducts({\n query,\n departmentId: params.departmentId,\n budget: params.budget,\n maxResults: amazonMaxResults,\n category,\n ownBrowser: params.ownBrowser,\n }),\n (rows) => rows.map((p) => ({ ...p, source: 'amazon' as const })),\n ),\n catalogEnabled\n ? reported(\n 'catalog',\n searchCatalogProducts({\n query: trimmed || preset?.catalogQuery || query,\n departmentId: params.departmentId,\n budget: params.budget,\n maxResults: retailerMaxResults,\n // The catalog is the one lane that KNOWS stock; ask it for\n // rows a shopper can buy rather than filtering them out later.\n inStockOnly: true,\n ...(params.lane ? { lane: params.lane } : {}),\n }),\n )\n : Promise.resolve({\n products: [] as Product[],\n query,\n totalCount: 0,\n affiliateDisclosure: undefined as string | undefined,\n }),\n ]);\n\n // Cancelled, not failed: nobody is waiting for these rows any more, and\n // answering with the Amazon half would let a caller cache a rail that is\n // missing its catalog rows as if that were the whole answer.\n if (catalogOutcome.status === 'rejected' && isConnectorLaneAbort(catalogOutcome.reason)) {\n throw catalogOutcome.reason;\n }\n\n const amazonProducts =\n amazonOutcome.status === 'fulfilled'\n ? amazonOutcome.value.products.map((p) => ({ ...p, source: 'amazon' as const }))\n : [];\n const catalogProducts = catalogOutcome.status === 'fulfilled' ? catalogOutcome.value.products : [];\n const affiliateDisclosure =\n catalogOutcome.status === 'fulfilled' ? catalogOutcome.value.affiliateDisclosure : undefined;\n if (amazonOutcome.status === 'rejected') {\n console.warn('[shoppingProductSearch] Amazon search failed:', amazonOutcome.reason);\n }\n if (catalogOutcome.status === 'rejected') {\n console.warn('[shoppingProductSearch] Catalog search failed:', catalogOutcome.reason);\n }\n\n const merged = finalizeRows(mergeShoppingProductSources([catalogProducts, amazonProducts]), params.relevance);\n const products = merged;\n\n const partialErrors = [\n catalogEnabled && catalogOutcome.status === 'rejected' && !products.some((p) => p.source === 'catalog')\n ? `${SOURCE_LABELS.catalog} results unavailable`\n : null,\n amazonOutcome.status === 'rejected' && !products.some((p) => p.source === 'amazon')\n ? `${SOURCE_LABELS.amazon} results unavailable`\n : null,\n ].filter(Boolean);\n\n return {\n products,\n query,\n totalCount: products.length,\n facets: amazonOutcome.status === 'fulfilled' ? amazonOutcome.value.facets : [],\n ...(affiliateDisclosure && products.some((p) => p.source === 'catalog') ? { affiliateDisclosure } : {}),\n ...(partialErrors.length > 0 ? { error: partialErrors.join(' · ') } : {}),\n };\n}\n\n/**\n * SLOW shopping phase — the Yantra ANALYZE page research + per-retailer LIST\n * actions (Walmart/eBay/Target/Shopify/Temu/Google). They run together: each\n * store list is handed to `onLane` the moment it lands, and the result is\n * everything once the research is in too. The caller renders\n * {@link searchShoppingProductsFast} first, then merges these in as they arrive\n * (deduped by title against what's already shown).\n */\nexport interface RestSearchOptions {\n /**\n * Called with each store's own list the moment it lands, through the same\n * relevance / sellable / pricing pass as the final result (thumbnails are\n * left to the final result). The store lists answer in seconds; the web\n * research (ANALYZE) takes a minute or more, and the grid should not wait\n * for it to show Walmart.\n */\n onLane?: (products: Product[]) => void;\n}\n\nexport async function searchShoppingProductsRest(\n params: ShoppingSearchParams,\n options: RestSearchOptions = {},\n): Promise<{ products: Product[]; error?: string }> {\n const { query, category } = resolveQueryAndCategory(params);\n const retailerMaxResults = params.maxResults ?? 24;\n const yantraMaxResults = params.maxResults ?? 24;\n const searchParams = { ...params, query, maxResults: yantraMaxResults };\n const sharedRetailer = {\n query,\n departmentId: params.departmentId,\n budget: params.budget,\n maxResults: retailerMaxResults,\n category,\n };\n\n // The store lists and the web research start together. They were run one\n // after the other when every store list read whole pages through the same\n // paid research backend as ANALYZE and they starved each other; the lists\n // are the free store readers now (2-5 s each, measured 2026-11-19) and were\n // waiting ~85 s behind ANALYZE for nothing.\n const connectorCall = Promise.allSettled([searchViaConnector(searchParams)]).then((r) => r[0]);\n const retailerOutcomes = await Promise.allSettled(\n SHOPPING_RETAILER_IDS.map((id) => {\n const call = searchRetailerProducts(id, sharedRetailer);\n if (options.onLane) {\n const onLane = options.onLane;\n call.then(\n (found) => {\n const lane = emptySourceBuckets();\n collectRetailerLane(lane, RETAILER_SEARCH_CONFIGS[id].source, found.products);\n const rows = finalizeRows(mergeBySourceOrder(lane), params.relevance);\n if (rows.length > 0) onLane(rows);\n },\n () => undefined,\n );\n }\n return call;\n }),\n );\n const connectorOutcome = await connectorCall;\n if (retailerOutcomes.some((o) => o.status === 'rejected' && isUnknownActionError(o.reason))) {\n console.warn(\n '[shoppingProductSearch] Retailer LIST action missing on agent — apply first-aid 005 to yantra-shopping-search. Falling back to URL sectioning from Yantra ANALYZE.',\n );\n }\n\n const buckets = emptySourceBuckets();\n // Lane rows first, so a shop's own listing outranks a re-homed copy of it.\n SHOPPING_RETAILER_IDS.forEach((id, index) => {\n const outcome = retailerOutcomes[index];\n if (outcome.status !== 'fulfilled') {\n console.warn(`[shoppingProductSearch] ${RETAILER_SEARCH_CONFIGS[id].label} search failed:`, outcome.reason);\n return;\n }\n collectRetailerLane(buckets, RETAILER_SEARCH_CONFIGS[id].source, outcome.value.products);\n });\n\n const connectorProducts = rehomeYantraProductsByUrl(\n connectorOutcome.status === 'fulfilled'\n ? connectorOutcome.value.products.map((p) => ({ ...p, source: 'yantra' as const }))\n : [],\n );\n if (connectorOutcome.status === 'rejected') {\n console.warn('[shoppingProductSearch] Connector search failed:', connectorOutcome.reason);\n }\n for (const product of connectorProducts) {\n buckets[product.source ?? 'yantra'].push(product);\n }\n\n const merged = mergeBySourceOrder(buckets);\n const products = finalizeRows(merged, params.relevance);\n return { products };\n}\n\n/**\n * Run Amazon + Yantra first (priority SERP + research), then other retailer LIST\n * actions. Six parallel agent execs starve Amazon/Parallel; sequencing fixes that.\n *\n * Any single provider failing alone is non-fatal.\n */\nexport async function searchShoppingProductsWithMeta(params: ShoppingSearchParams): Promise<{\n products: Product[];\n query: string;\n totalCount: number;\n affiliateDisclosure?: string;\n error?: string;\n}> {\n const { preset, trimmed, query, category } = resolveQueryAndCategory(params);\n\n const amazonMaxResults = params.maxResults ?? 48;\n const retailerMaxResults = params.maxResults ?? 24;\n const yantraMaxResults = params.maxResults ?? 24;\n const searchParams = { ...params, query, maxResults: yantraMaxResults };\n const sharedRetailer = {\n query,\n departmentId: params.departmentId,\n budget: params.budget,\n maxResults: retailerMaxResults,\n category,\n };\n\n // Phase 1 — Amazon SERP + Yantra research + typed catalog. The catalog call\n // hits LemmeBuyIt rather than Parallel, so unlike a sixth SERP read it does not\n // contend for the same upstream. Skipped outright when no LemmeBuyIt key is\n // configured, so an unconfigured org pays nothing for it.\n const catalogEnabled = isCatalogConfigured();\n const [amazonOutcome, connectorOutcome, catalogOutcome] = await Promise.allSettled([\n searchAmazonProducts({\n query,\n departmentId: params.departmentId,\n budget: params.budget,\n maxResults: amazonMaxResults,\n category,\n ownBrowser: params.ownBrowser,\n }),\n searchViaConnector(searchParams),\n catalogEnabled\n ? searchCatalogProducts({\n // A typed query goes to the catalog as-is; only a department chip\n // substitutes the tighter catalogQuery (see the presets above).\n query: trimmed || preset?.catalogQuery || query,\n departmentId: params.departmentId,\n budget: params.budget,\n maxResults: retailerMaxResults,\n inStockOnly: true,\n // `category` is DELIBERATELY not forwarded. The preset's value is a\n // research-path hint (\"electronics\"), while the catalog filters on\n // its own per-retailer taxonomy (\"kitchen > beverage appliances >\n // coffee makers\"), so the hint matches nothing and empties the\n // result: target/\"wireless headphones\" returns 3 Sennheisers\n // without it and 0 rows with it. Only a caller that knows the real\n // taxonomy should filter by category.\n })\n : Promise.resolve({\n products: [] as Product[],\n query,\n totalCount: 0,\n affiliateDisclosure: undefined as string | undefined,\n }),\n ]);\n\n // Phase 2 — other retailers after Amazon+Yantra so Parallel isn't starved.\n const retailerOutcomes = await Promise.allSettled(\n SHOPPING_RETAILER_IDS.map((id) => searchRetailerProducts(id, sharedRetailer)),\n );\n if (retailerOutcomes.some((o) => o.status === 'rejected' && isUnknownActionError(o.reason))) {\n console.warn(\n '[shoppingProductSearch] Retailer LIST action missing on agent — apply first-aid 005 to yantra-shopping-search. Falling back to URL sectioning from Yantra ANALYZE.',\n );\n }\n\n const amazonProducts =\n amazonOutcome.status === 'fulfilled'\n ? amazonOutcome.value.products.map((p) => ({ ...p, source: 'amazon' as const }))\n : [];\n\n const catalogProducts = catalogOutcome.status === 'fulfilled' ? catalogOutcome.value.products : [];\n // LemmeBuyIt's free tier returns ActiveJunky affiliate links and its own\n // instructions require a disclosure wherever they are shown to an end user.\n const affiliateDisclosure =\n catalogOutcome.status === 'fulfilled' ? catalogOutcome.value.affiliateDisclosure : undefined;\n if (catalogOutcome.status === 'rejected') {\n console.warn('[shoppingProductSearch] Catalog search failed:', catalogOutcome.reason);\n }\n\n // Section ANALYZE hits by retailer URL so cards aren't stuck under Yantra when LIST is missing/empty.\n const connectorProducts = rehomeYantraProductsByUrl(\n connectorOutcome.status === 'fulfilled'\n ? connectorOutcome.value.products.map((p) => ({ ...p, source: 'yantra' as const }))\n : [],\n );\n\n if (amazonOutcome.status === 'rejected') {\n console.warn('[shoppingProductSearch] Amazon search failed:', amazonOutcome.reason);\n }\n SHOPPING_RETAILER_IDS.forEach((id, index) => {\n const outcome = retailerOutcomes[index];\n if (outcome.status === 'rejected') {\n console.warn(`[shoppingProductSearch] ${RETAILER_SEARCH_CONFIGS[id].label} search failed:`, outcome.reason);\n }\n });\n if (connectorOutcome.status === 'rejected') {\n console.warn('[shoppingProductSearch] Connector search failed:', connectorOutcome.reason);\n }\n\n // Buckets fill in precision order: typed catalog rows, then the Amazon SERP,\n // then each retailer lane, then whatever the Yantra research re-homed. Best\n // Buy / Costco / Home Depot / Lowe's / Newegg have no lane of their own — they\n // arrive from the Google Shopping aggregator lane or from ANALYZE, both of\n // which are re-homed to their section by URL.\n const buckets = emptySourceBuckets();\n buckets.catalog.push(...catalogProducts);\n buckets.amazon.push(...amazonProducts);\n SHOPPING_RETAILER_IDS.forEach((id, index) => {\n const outcome = retailerOutcomes[index];\n if (outcome.status !== 'fulfilled') return;\n collectRetailerLane(buckets, RETAILER_SEARCH_CONFIGS[id].source, outcome.value.products);\n });\n for (const product of connectorProducts) {\n buckets[product.source ?? 'yantra'].push(product);\n }\n\n const merged = mergeBySourceOrder(buckets);\n const relevant = finalizeRows(merged, params.relevance);\n\n if (relevant.length === 0) {\n const errors = [\n amazonOutcome.status === 'rejected'\n ? sanitizeShoppingProviderError(outcomeErrorMessage(amazonOutcome.reason), SOURCE_LABELS.amazon)\n : null,\n catalogOutcome.status === 'rejected'\n ? sanitizeShoppingProviderError(outcomeErrorMessage(catalogOutcome.reason), SOURCE_LABELS.catalog)\n : null,\n ...retailerOutcomes.map((o, index) =>\n o.status === 'rejected'\n ? sanitizeShoppingProviderError(\n outcomeErrorMessage(o.reason),\n SOURCE_LABELS[RETAILER_SEARCH_CONFIGS[SHOPPING_RETAILER_IDS[index]].source],\n )\n : null,\n ),\n connectorOutcome.status === 'rejected'\n ? sanitizeShoppingProviderError(outcomeErrorMessage(connectorOutcome.reason), SOURCE_LABELS.yantra)\n : null,\n ].filter(Boolean);\n throw new Error(errors[0] || 'No products found. Try a different search.');\n }\n\n const products = relevant;\n\n const partialErrors = [\n catalogEnabled && catalogOutcome.status === 'rejected' && !products.some((p) => p.source === 'catalog')\n ? `${SOURCE_LABELS.catalog} results unavailable`\n : null,\n amazonOutcome.status === 'rejected' && !products.some((p) => p.source === 'amazon')\n ? `${SOURCE_LABELS.amazon} results unavailable`\n : null,\n ...SHOPPING_RETAILER_IDS.map((id, index) => {\n const source = RETAILER_SEARCH_CONFIGS[id].source;\n const hasProducts = products.some((p) => p.source === source);\n if (hasProducts) return null;\n return retailerOutcomes[index].status === 'rejected'\n ? `${SOURCE_LABELS[source]} results unavailable`\n : null;\n }),\n connectorOutcome.status === 'rejected' && !products.some((p) => p.source === 'yantra')\n ? `${SOURCE_LABELS.yantra} unavailable`\n : null,\n ].filter(Boolean);\n\n return {\n products,\n query,\n totalCount: products.length,\n ...(affiliateDisclosure && products.some((p) => p.source === 'catalog') ? { affiliateDisclosure } : {}),\n ...(partialErrors.length > 0 ? { error: partialErrors.join(' · ') } : {}),\n };\n}\n\nexport { SOURCE_LABELS, SOURCE_ORDER };\nexport type { ShoppingRetailerId };\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;AAkEO,MAAM,yBAIR,GAAA;AAAA,EACH,WAAa,EAAA;AAAA,IACX,KAAO,EAAA,0DAAA;AAAA,IACP,YAAc,EAAA,qBAAA;AAAA,IACd,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,+CAAA;AAAA,IACP,YAAc,EAAA,UAAA;AAAA,IACd,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,wCAAA;AAAA,IACP,YAAc,EAAA,gBAAA;AAAA,IACd,QAAU,EAA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S,CAAA,GAAA,CAAI,CAAM,CAAA,KAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EACnI,CADmI,CAAA,EAAA;AAAA,IAEtI,MAAQ,EAAA;AAAA,GACV,CAAE,CAAI,GAAA,EAAE,CAAA;AACR,EAAI,IAAA,gBAAA,CAAiB,WAAW,UAAY,EAAA;AAC1C,IAAQ,OAAA,CAAA,IAAA,CAAK,kDAAoD,EAAA,gBAAA,CAAiB,MAAM,CAAA;AAAA;AAE1F,EAAA,KAAA,MAAW,WAAW,iBAAmB,EAAA;AACvC,IAAA,OAAA,CAAA,CAAQ,aAAQ,MAAR,KAAA,IAAA,GAAA,EAAA,GAAkB,QAAQ,CAAA,CAAE,KAAK,OAAO,CAAA;AAAA;AAElD,EAAM,MAAA,MAAA,GAAS,mBAAmB,OAAO,CAAA;AACzC,EAAA,MAAM,QAAW,GAAA,YAAA,CAAa,MAAQ,EAAA,MAAA,CAAO,SAAS,CAAA;AACtD,EAAO,OAAA;AAAA,IACL;AAAA,GACF;AACF"}
@@ -50,6 +50,16 @@ const SHOPPING_SEARCH_ACTIONS = {
50
50
  * $-shaped text, so nothing downstream can tell 40%-off from full price.
51
51
  */
52
52
  OFFERS: "YANTRA_SHOPPING_SEARCH_OFFERS",
53
+ /**
54
+ * Black Friday and Cyber Monday deals for a search (YANTRA-899): the deal
55
+ * sites and the stores' own markdowns, real discounts only, best first.
56
+ * Closed after Cyber Monday (`active: false`).
57
+ */
58
+ BLACK_FRIDAY: "YANTRA_SHOPPING_SEARCH_BLACK_FRIDAY",
59
+ /** Holiday deal reminders and the opt-in daily deal text. */
60
+ DEAL_ALERTS: "YANTRA_SHOPPING_SEARCH_DEAL_ALERTS",
61
+ /** What a social post (TikTok, Instagram, YouTube...) is selling. */
62
+ LINK_CHECK: "YANTRA_SHOPPING_SEARCH_LINK_CHECK",
53
63
  /**
54
64
  * Coupon / voucher feeds — first-aid 009. The only lane that answers for a
55
65
  * deal with NO product behind it: a code, a store-wide markdown, a voucher.
@@ -66,7 +76,10 @@ const SHOPPING_SEARCH_ACTIONS = {
66
76
  COMPARE: "YANTRA_SHOPPING_SEARCH_COMPARE",
67
77
  /** Compound discount / price / rating / stock query over the indexed store. */
68
78
  DEALS: "YANTRA_SHOPPING_SEARCH_DEALS",
79
+ /** Pins a product and arms the person's price alerts (notification centre + phone). */
69
80
  WATCH_ADD: "YANTRA_SHOPPING_SEARCH_WATCH_ADD",
81
+ /** Stops watching a product, and with it its alerts. */
82
+ WATCH_REMOVE: "YANTRA_SHOPPING_SEARCH_WATCH_REMOVE",
70
83
  WATCH_STATUS: "YANTRA_SHOPPING_SEARCH_WATCH_STATUS",
71
84
  /** Live validation on the user's Computer browser; `schedule` arms the hourly cron. */
72
85
  PRICE_CHECK: "YANTRA_SHOPPING_SEARCH_PRICE_CHECK",
@@ -130,7 +143,7 @@ function buildConnectorCredentialsPayload(credentials) {
130
143
  function withShoppingSearchCredentials(params, credentials) {
131
144
  return __spreadValues(__spreadValues({}, params), buildConnectorCredentialsPayload(credentials));
132
145
  }
133
- const LEMMEBUYIT_ACTIONS = /* @__PURE__ */ new Set([SHOPPING_SEARCH_ACTIONS.CATALOG_SEARCH, SHOPPING_SEARCH_ACTIONS.RETAILERS, SHOPPING_SEARCH_ACTIONS.PRICE_HISTORY, SHOPPING_SEARCH_ACTIONS.COMPARE, SHOPPING_SEARCH_ACTIONS.DEALS, SHOPPING_SEARCH_ACTIONS.WATCH_ADD, SHOPPING_SEARCH_ACTIONS.WATCH_STATUS]);
146
+ const LEMMEBUYIT_ACTIONS = /* @__PURE__ */ new Set([SHOPPING_SEARCH_ACTIONS.CATALOG_SEARCH, SHOPPING_SEARCH_ACTIONS.RETAILERS, SHOPPING_SEARCH_ACTIONS.PRICE_HISTORY, SHOPPING_SEARCH_ACTIONS.COMPARE, SHOPPING_SEARCH_ACTIONS.DEALS, SHOPPING_SEARCH_ACTIONS.WATCH_ADD, SHOPPING_SEARCH_ACTIONS.WATCH_REMOVE, SHOPPING_SEARCH_ACTIONS.WATCH_STATUS]);
134
147
  const INTERACTIVE_HOLD_MS = 400;
135
148
  const lane = {
136
149
  busy: false,
@@ -1 +1 @@
1
- {"version":3,"file":"shoppingSearchConnectorClient.js","sources":["../../../../src/features/shopping/services/shoppingSearchConnectorClient.ts"],"sourcesContent":["/**\n * Bridge to the `yantra-shopping-search` cdecli connector — native twin of the\n * web surface's `services/shoppingSearchConnectorClient.ts`.\n *\n * Transport-agnostic: calls the host-installed executor (`shoppingRuntime`),\n * which on native is the cdecli `exec/stream` lane (`shoppingExec.ts`). Native\n * has no `auth`/`credentials` side-channel on its exec seam, so the configured\n * `shoppingSearch` keys ride in the params (as native always did).\n */\n\nimport { getShoppingRuntime } from '../shoppingRuntime';\nimport { currentPostalCode } from '../state/deliveryLocation';\n\nexport const SHOPPING_SEARCH_CONNECTOR_ID = 'yantra-shopping-search';\n\nexport const SHOPPING_SEARCH_ACTIONS = {\n /** Parallel AI product research + LLM buyer's guide. */\n ANALYZE: 'YANTRA_SHOPPING_SEARCH_ANALYZE',\n /** Amazon SERP via connector (RapidAPI Axesso/Realtime + Parallel) — first-aid 004+. */\n AMAZON_LIST: 'YANTRA_SHOPPING_SEARCH_AMAZON_LIST',\n /** Walmart SERP via Parallel — first-aid 005+. */\n WALMART_LIST: 'YANTRA_SHOPPING_SEARCH_WALMART_LIST',\n /** eBay SERP via Parallel — first-aid 005+. */\n EBAY_LIST: 'YANTRA_SHOPPING_SEARCH_EBAY_LIST',\n /** Target SERP via Parallel — first-aid 005+. */\n TARGET_LIST: 'YANTRA_SHOPPING_SEARCH_TARGET_LIST',\n /** Shopify SERP via Parallel — first-aid 005+. */\n SHOPIFY_LIST: 'YANTRA_SHOPPING_SEARCH_SHOPIFY_LIST',\n /**\n * Google Shopping via Parallel — first-aid 006+. An aggregator, not a shop:\n * its rows come back on the merchants' own domains, which is what makes it\n * the only server-side route to Best Buy / Costco / Newegg / brand stores.\n */\n GOOGLE_LIST: 'YANTRA_SHOPPING_SEARCH_GOOGLE_LIST',\n /**\n * Temu SERP via Parallel — first-aid 011+. A storefront pinned to temu.com,\n * same shape as the Walmart / eBay / Target lanes.\n */\n TEMU_LIST: 'YANTRA_SHOPPING_SEARCH_TEMU_LIST',\n CHECK_AVAILABILITY: 'YANTRA_SHOPPING_SEARCH_CHECK_AVAILABILITY',\n /**\n * Real-Time Product Search (Google Shopping via RapidAPI) — first-aid 007.\n * The only lane with a STRUCTURED discount: every `*_LIST` above reads a\n * rendered SERP, where the sale price and the list price are both just\n * $-shaped text, so nothing downstream can tell 40%-off from full price.\n */\n OFFERS: 'YANTRA_SHOPPING_SEARCH_OFFERS',\n\n /**\n * Coupon / voucher feeds — first-aid 009. The only lane that answers for a\n * deal with NO product behind it: a code, a store-wide markdown, a voucher.\n * Every other lane starts from a product and asks what it costs; this one\n * starts from the offer, which is the only way to reach the discount\n * inventory that never appears in a product search.\n */\n COUPONS: 'YANTRA_SHOPPING_SEARCH_COUPONS',\n\n /** The `lemmebuyit` provider — typed catalog rows, not a SERP scrape. */\n CATALOG_SEARCH: 'YANTRA_SHOPPING_SEARCH_CATALOG_SEARCH',\n RETAILERS: 'YANTRA_SHOPPING_SEARCH_RETAILERS',\n PRICE_HISTORY: 'YANTRA_SHOPPING_SEARCH_PRICE_HISTORY',\n /** Cheapest indexed retailer for one UPC/EAN/GTIN/ASIN. */\n COMPARE: 'YANTRA_SHOPPING_SEARCH_COMPARE',\n /** Compound discount / price / rating / stock query over the indexed store. */\n DEALS: 'YANTRA_SHOPPING_SEARCH_DEALS',\n WATCH_ADD: 'YANTRA_SHOPPING_SEARCH_WATCH_ADD',\n WATCH_STATUS: 'YANTRA_SHOPPING_SEARCH_WATCH_STATUS',\n /** Live validation on the user's Computer browser; `schedule` arms the hourly cron. */\n PRICE_CHECK: 'YANTRA_SHOPPING_SEARCH_PRICE_CHECK',\n /**\n * Every photo and video a listing has, at full size (connector 1.4.0+). Free\n * page reads; `paid: true` lets an Amazon robot check fall back to metered\n * RapidAPI lookups. See services/productMedia for when the surface pays.\n */\n PRODUCT_MEDIA: 'YANTRA_SHOPPING_SEARCH_PRODUCT_MEDIA',\n} as const;\n\nexport type ShoppingSearchConnectorAction = (typeof SHOPPING_SEARCH_ACTIONS)[keyof typeof SHOPPING_SEARCH_ACTIONS];\n\nexport interface ShoppingConnectorProduct {\n name: string;\n price?: number;\n priceText?: string;\n retailer?: string;\n url: string;\n imageUrl?: string;\n rating?: string;\n /** Real review count when the connector's research surfaces one. */\n reviews?: number | string;\n reviewCount?: number | string;\n highlights?: string[];\n pros?: string[];\n cons?: string[];\n summary?: string;\n tradeoffs?: string[];\n}\n\nexport interface ShoppingWidgetProperty {\n id?: string;\n title?: string;\n url?: string;\n source?: string;\n imageUrl?: string;\n price?: number;\n priceLabel?: string;\n priceUnit?: string;\n rating?: number;\n /** Real review count when the connector's research surfaces one. */\n reviews?: number | string;\n reviewCount?: number | string;\n pros?: string[];\n cons?: string[];\n summary?: string;\n}\n\nexport interface ShoppingAnalyzeResult {\n success?: boolean;\n query?: string;\n products?: ShoppingConnectorProduct[];\n properties?: ShoppingWidgetProperty[];\n recommendations?: string[];\n tradeoffs?: string[];\n buyersGuide?: string;\n totalCount?: number;\n elapsedMs?: number;\n error?: string;\n}\n\nexport type ShoppingSearchConnectorResult<T = unknown> = {\n success: boolean;\n data?: T;\n error?: string;\n};\n\nexport interface ShoppingSearchConnectorCredentials {\n parallelApiKey?: string;\n /** Forwarded to connector amazonList (Axesso / Real-Time Amazon Data). */\n rapidApiKey?: string;\n /** Forwarded to the connector's lemmebuyit provider (catalog / deals / compare). */\n lemmebuyitApiKey?: string;\n /** Coupon feeds (first-aid 009). Two vendors, two keys — a host holds either. */\n linkmydealsApiKey?: string;\n couponApiKey?: string;\n llmApiKey?: string;\n llmEndpoint?: string;\n llmModel?: string;\n}\n\nconst DEFAULT_LLM_ENDPOINT = 'https://api.openai.com';\n\n/** Read shopping-search secrets from the host-supplied config (host resolves from public env). */\nexport function resolveShoppingSearchConnectorCredentials(): ShoppingSearchConnectorCredentials {\n const runtime = getShoppingRuntime().config;\n const supplied = runtime.shoppingSearch ?? {};\n const parallelApiKey = supplied.parallelApiKey?.trim();\n const rapidApiKey = supplied.rapidApiKey?.trim();\n const lemmebuyitApiKey = supplied.lemmebuyitApiKey?.trim();\n const linkmydealsApiKey = supplied.linkmydealsApiKey?.trim();\n const couponApiKey = supplied.couponApiKey?.trim();\n const llmApiKey = supplied.llmApiKey?.trim();\n const llmModel = supplied.llmModel?.trim();\n const llmEndpoint = supplied.llmEndpoint?.trim() || (llmApiKey ? DEFAULT_LLM_ENDPOINT : undefined);\n\n return {\n ...(parallelApiKey ? { parallelApiKey } : {}),\n ...(rapidApiKey ? { rapidApiKey } : {}),\n ...(lemmebuyitApiKey ? { lemmebuyitApiKey } : {}),\n ...(linkmydealsApiKey ? { linkmydealsApiKey } : {}),\n ...(couponApiKey ? { couponApiKey } : {}),\n ...(llmApiKey ? { llmApiKey } : {}),\n ...(llmEndpoint ? { llmEndpoint } : {}),\n ...(llmModel ? { llmModel } : {}),\n };\n}\n\nfunction buildConnectorCredentialsPayload(credentials: ShoppingSearchConnectorCredentials): Record<string, unknown> {\n return {\n ...(credentials.parallelApiKey ? { parallelApiKey: credentials.parallelApiKey } : {}),\n ...(credentials.rapidApiKey ? { rapidApiKey: credentials.rapidApiKey } : {}),\n ...(credentials.lemmebuyitApiKey ? { lemmebuyitApiKey: credentials.lemmebuyitApiKey } : {}),\n ...(credentials.linkmydealsApiKey ? { linkmydealsApiKey: credentials.linkmydealsApiKey } : {}),\n ...(credentials.couponApiKey ? { couponApiKey: credentials.couponApiKey } : {}),\n ...(credentials.llmApiKey ? { llmApiKey: credentials.llmApiKey } : {}),\n ...(credentials.llmEndpoint ? { llmEndpoint: credentials.llmEndpoint } : {}),\n ...(credentials.llmModel ? { llmModel: credentials.llmModel } : {}),\n };\n}\n\nfunction withShoppingSearchCredentials(\n params: Record<string, unknown>,\n credentials: ShoppingSearchConnectorCredentials,\n): Record<string, unknown> {\n return { ...params, ...buildConnectorCredentialsPayload(credentials) };\n}\n\n/**\n * Execute a yantra-shopping-search connector action via the host connector executor.\n * All product / retailer SERP data is fetched by the connector — surface never calls RapidAPI.\n */\n/**\n * The actions the connector's `lemmebuyit` provider answers.\n *\n * LemmeBuyIt allows ONE in-flight request per key (\"LemmeBuyIt allows one\n * concurrent request… try in a moment, or upgrade for more concurrency\"). The\n * landing page's trending rails, the Deals board's catalog lane and a Shop\n * search all reach it, and when they overlap every call but one fails with\n * that message — which then reads as \"the catalog is down\" or \"took longer\n * than 20s\". So these actions go through one serial lane below: each waits\n * for the previous to settle. Slower under contention, never refused.\n */\nconst LEMMEBUYIT_ACTIONS: ReadonlySet<string> = new Set([\n SHOPPING_SEARCH_ACTIONS.CATALOG_SEARCH,\n SHOPPING_SEARCH_ACTIONS.RETAILERS,\n SHOPPING_SEARCH_ACTIONS.PRICE_HISTORY,\n SHOPPING_SEARCH_ACTIONS.COMPARE,\n SHOPPING_SEARCH_ACTIONS.DEALS,\n SHOPPING_SEARCH_ACTIONS.WATCH_ADD,\n SHOPPING_SEARCH_ACTIONS.WATCH_STATUS,\n]);\n\n/**\n * Who is waiting on a call, for the one-at-a-time LemmeBuyIt lane.\n *\n * The lane used to be a single first-come queue, and the landing page is the\n * first thing every visit fills it with: each trending rail is a catalog call,\n * and on a connector without the in-session sweep each of those is one call\n * PER RETAILER. A shopper who typed \"macbook\" a few seconds after the page\n * opened waited behind every one of them - measured on dev at two minutes of\n * \"Searching retailers and the web…\" before a single product painted, with the\n * rails' calls still running after the shopper had left the landing page.\n */\nexport interface ConnectorLaneOptions {\n /**\n * `interactive` (the default) is a person waiting on the answer: a search, a\n * product drawer, a watch they just set. `background` is work nobody has\n * asked for yet - prefetching the landing page's rails - and only runs when\n * no interactive call is waiting.\n */\n priority?: 'interactive' | 'background';\n /**\n * Aborting drops a call that is still QUEUED, before it reaches the\n * provider; the promise rejects with the signal's reason. A call already\n * running finishes (the lane still owns the provider's one session until it\n * does), and the caller simply stops caring about its answer.\n */\n signal?: AbortSignal;\n}\n\ninterface LaneEntry {\n start: () => void;\n}\n\n/**\n * After an interactive call settles, background work waits this long before it\n * may take the lane. A caller that asks several things in a row - a search\n * walking retailers, a drawer reading compare then history - awaits one answer\n * before queueing the next, so at the instant one settles its follow-up is not\n * queued yet. Without the hold a rail would slip into every one of those gaps\n * and the search would be interleaved with prefetch again, one call apiece.\n */\nconst INTERACTIVE_HOLD_MS = 400;\n\nconst lane = {\n busy: false,\n interactive: [] as LaneEntry[],\n background: [] as LaneEntry[],\n lastInteractiveSettledAt: Number.NEGATIVE_INFINITY,\n holdTimer: null as ReturnType<typeof setTimeout> | null,\n};\n\nfunction pumpLane(): void {\n if (lane.busy) return;\n const interactive = lane.interactive.shift();\n if (interactive) {\n lane.busy = true;\n interactive.start();\n return;\n }\n if (lane.background.length === 0) return;\n const holdLeft = lane.lastInteractiveSettledAt + INTERACTIVE_HOLD_MS - Date.now();\n if (holdLeft > 0) {\n if (!lane.holdTimer) {\n lane.holdTimer = setTimeout(() => {\n lane.holdTimer = null;\n pumpLane();\n }, holdLeft);\n }\n return;\n }\n const background = lane.background.shift();\n if (!background) return;\n lane.busy = true;\n background.start();\n}\n\nfunction abortReason(signal: AbortSignal): unknown {\n const reason = (signal as AbortSignal & { reason?: unknown }).reason;\n if (reason !== undefined) return reason;\n // Hermes has no DOMException; an Error named AbortError is what isConnectorLaneAbort reads.\n const error = new Error('The operation was aborted.');\n error.name = 'AbortError';\n return error;\n}\n\n/** True for the rejection a {@link ConnectorLaneOptions.signal} abort produces. */\nexport function isConnectorLaneAbort(error: unknown): boolean {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'name' in error &&\n (error as { name?: unknown }).name === 'AbortError'\n );\n}\n\nfunction throughLemmeBuyItLane<T>(work: () => Promise<T>, options: ConnectorLaneOptions = {}): Promise<T> {\n const { signal } = options;\n const interactive = options.priority !== 'background';\n if (signal?.aborted) return Promise.reject(abortReason(signal));\n\n return new Promise<T>((resolve, reject) => {\n const queue = interactive ? lane.interactive : lane.background;\n const onAbort = () => {\n const at = queue.indexOf(entry);\n if (at < 0) return; // already running - it finishes; see ConnectorLaneOptions.signal\n queue.splice(at, 1);\n reject(abortReason(signal as AbortSignal));\n };\n const entry: LaneEntry = {\n start: () => {\n signal?.removeEventListener('abort', onAbort);\n // Settles exactly once, whatever `work` does (it may even throw\n // synchronously) - a call that never released the lane would\n // block every catalog read on the page.\n Promise.resolve()\n .then(work)\n .then(resolve, reject)\n .finally(() => {\n lane.busy = false;\n if (interactive) lane.lastInteractiveSettledAt = Date.now();\n pumpLane();\n });\n },\n };\n signal?.addEventListener('abort', onAbort, { once: true });\n queue.push(entry);\n pumpLane();\n });\n}\n\n/**\n * The actions that SEARCH - the ones a store answers for a delivery location.\n * The rest (watch bookkeeping, price history, coupon feeds) are not about a\n * place, and a postal code on them would only be noise in their params.\n */\nconst LOCATION_PRICED_ACTIONS: ReadonlySet<string> = new Set([\n SHOPPING_SEARCH_ACTIONS.ANALYZE,\n SHOPPING_SEARCH_ACTIONS.AMAZON_LIST,\n SHOPPING_SEARCH_ACTIONS.WALMART_LIST,\n SHOPPING_SEARCH_ACTIONS.EBAY_LIST,\n SHOPPING_SEARCH_ACTIONS.TARGET_LIST,\n SHOPPING_SEARCH_ACTIONS.SHOPIFY_LIST,\n SHOPPING_SEARCH_ACTIONS.GOOGLE_LIST,\n SHOPPING_SEARCH_ACTIONS.TEMU_LIST,\n SHOPPING_SEARCH_ACTIONS.OFFERS,\n SHOPPING_SEARCH_ACTIONS.CATALOG_SEARCH,\n SHOPPING_SEARCH_ACTIONS.CHECK_AVAILABILITY,\n]);\n\n/**\n * A search's params with the shopper's delivery location (`postal_code`, see\n * state/deliveryLocation) added, so the store prices, stocks and dates its\n * delivery for that place. A caller that already chose a location keeps it;\n * no location set, or an action that is not a search, leaves the params as\n * they were.\n */\nexport function withPostalCode(\n action: string,\n params: Record<string, unknown>,\n postalCode: string | undefined = currentPostalCode(),\n): Record<string, unknown> {\n if (!postalCode || !LOCATION_PRICED_ACTIONS.has(action)) return params;\n if (typeof params.postal_code === 'string' && params.postal_code.trim()) return params;\n return { ...params, postal_code: postalCode };\n}\n\nexport async function invokeShoppingSearchConnector<T = ShoppingAnalyzeResult>(\n params: Record<string, unknown>,\n action: ShoppingSearchConnectorAction = SHOPPING_SEARCH_ACTIONS.ANALYZE,\n options: ConnectorLaneOptions = {},\n): Promise<ShoppingSearchConnectorResult<T>> {\n if (LEMMEBUYIT_ACTIONS.has(action)) {\n return throughLemmeBuyItLane(() => dispatchShoppingSearchConnector<T>(params, action), options);\n }\n if (options.signal?.aborted) throw abortReason(options.signal);\n return dispatchShoppingSearchConnector<T>(params, action);\n}\n\nasync function dispatchShoppingSearchConnector<T>(\n params: Record<string, unknown>,\n action: ShoppingSearchConnectorAction,\n): Promise<ShoppingSearchConnectorResult<T>> {\n const runtime = getShoppingRuntime();\n const credentials = resolveShoppingSearchConnectorCredentials();\n // Native's exec seam has no credentials/auth argument: the host's\n // `shoppingSearch` config (catalogEnabled + keys) rides in the params.\n const execParams = withShoppingSearchCredentials(\n { ...withPostalCode(action, params), stream: false, ...runtime.config.shoppingSearch },\n credentials,\n );\n const remote = await runtime.exec<T>(SHOPPING_SEARCH_CONNECTOR_ID, action, execParams);\n if (!remote.success) {\n return { success: false, error: remote.error || 'Connector action failed' };\n }\n return { success: true, data: remote.data };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAYO,MAAM,4BAA+B,GAAA;AACrC,MAAM,uBAA0B,GAAA;AAAA;AAAA,EAErC,OAAS,EAAA,gCAAA;AAAA;AAAA,EAET,WAAa,EAAA,oCAAA;AAAA;AAAA,EAEb,YAAc,EAAA,qCAAA;AAAA;AAAA,EAEd,SAAW,EAAA,kCAAA;AAAA;AAAA,EAEX,WAAa,EAAA,oCAAA;AAAA;AAAA,EAEb,YAAc,EAAA,qCAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMd,WAA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BAAA,CAAmC,MAAQ,EAAA,MAAM,GAAG,OAAO,CAAA;AAAA;AAEhG,EAAA,IAAA,CAAI,aAAQ,MAAR,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAgB,SAAe,MAAA,WAAA,CAAY,QAAQ,MAAM,CAAA;AAC7D,EAAO,OAAA,+BAAA,CAAmC,QAAQ,MAAM,CAAA;AAC1D;AACA,eAAe,+BAAA,CAAmC,QAAiC,MAAkF,EAAA;AACnK,EAAA,MAAM,UAAU,kBAAmB,EAAA;AACnC,EAAA,MAAM,cAAc,yCAA0C,EAAA;AAG9D,EAAA,MAAM,aAAa,6BAA8B,CAAA,cAAA,CAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EAC5C,cAAe,CAAA,MAAA,EAAQ,MAAM,CADe,CAAA,EAAA;AAAA,IAE/C,MAAQ,EAAA;AAAA,GACL,CAAA,EAAA,OAAA,CAAQ,MAAO,CAAA,cAAA,CAAA,EACjB,WAAW,CAAA;AACd,EAAA,MAAM,SAAS,MAAM,OAAA,CAAQ,IAAQ,CAAA,4BAAA,EAA8B,QAAQ,UAAU,CAAA;AACrF,EAAI,IAAA,CAAC,OAAO,OAAS,EAAA;AACnB,IAAO,OAAA;AAAA,MACL,OAAS,EAAA,KAAA;AAAA,MACT,KAAA,EAAO,OAAO,KAAS,IAAA;AAAA,KACzB;AAAA;AAEF,EAAO,OAAA;AAAA,IACL,OAAS,EAAA,IAAA;AAAA,IACT,MAAM,MAAO,CAAA;AAAA,GACf;AACF"}
1
+ {"version":3,"file":"shoppingSearchConnectorClient.js","sources":["../../../../src/features/shopping/services/shoppingSearchConnectorClient.ts"],"sourcesContent":["/**\n * Bridge to the `yantra-shopping-search` cdecli connector — native twin of the\n * web surface's `services/shoppingSearchConnectorClient.ts`.\n *\n * Transport-agnostic: calls the host-installed executor (`shoppingRuntime`),\n * which on native is the cdecli `exec/stream` lane (`shoppingExec.ts`). Native\n * has no `auth`/`credentials` side-channel on its exec seam, so the configured\n * `shoppingSearch` keys ride in the params (as native always did).\n */\n\nimport { getShoppingRuntime } from '../shoppingRuntime';\nimport { currentPostalCode } from '../state/deliveryLocation';\n\nexport const SHOPPING_SEARCH_CONNECTOR_ID = 'yantra-shopping-search';\n\nexport const SHOPPING_SEARCH_ACTIONS = {\n /** Parallel AI product research + LLM buyer's guide. */\n ANALYZE: 'YANTRA_SHOPPING_SEARCH_ANALYZE',\n /** Amazon SERP via connector (RapidAPI Axesso/Realtime + Parallel) — first-aid 004+. */\n AMAZON_LIST: 'YANTRA_SHOPPING_SEARCH_AMAZON_LIST',\n /** Walmart SERP via Parallel — first-aid 005+. */\n WALMART_LIST: 'YANTRA_SHOPPING_SEARCH_WALMART_LIST',\n /** eBay SERP via Parallel — first-aid 005+. */\n EBAY_LIST: 'YANTRA_SHOPPING_SEARCH_EBAY_LIST',\n /** Target SERP via Parallel — first-aid 005+. */\n TARGET_LIST: 'YANTRA_SHOPPING_SEARCH_TARGET_LIST',\n /** Shopify SERP via Parallel — first-aid 005+. */\n SHOPIFY_LIST: 'YANTRA_SHOPPING_SEARCH_SHOPIFY_LIST',\n /**\n * Google Shopping via Parallel — first-aid 006+. An aggregator, not a shop:\n * its rows come back on the merchants' own domains, which is what makes it\n * the only server-side route to Best Buy / Costco / Newegg / brand stores.\n */\n GOOGLE_LIST: 'YANTRA_SHOPPING_SEARCH_GOOGLE_LIST',\n /**\n * Temu SERP via Parallel — first-aid 011+. A storefront pinned to temu.com,\n * same shape as the Walmart / eBay / Target lanes.\n */\n TEMU_LIST: 'YANTRA_SHOPPING_SEARCH_TEMU_LIST',\n CHECK_AVAILABILITY: 'YANTRA_SHOPPING_SEARCH_CHECK_AVAILABILITY',\n /**\n * Real-Time Product Search (Google Shopping via RapidAPI) — first-aid 007.\n * The only lane with a STRUCTURED discount: every `*_LIST` above reads a\n * rendered SERP, where the sale price and the list price are both just\n * $-shaped text, so nothing downstream can tell 40%-off from full price.\n */\n OFFERS: 'YANTRA_SHOPPING_SEARCH_OFFERS',\n\n /**\n * Black Friday and Cyber Monday deals for a search (YANTRA-899): the deal\n * sites and the stores' own markdowns, real discounts only, best first.\n * Closed after Cyber Monday (`active: false`).\n */\n BLACK_FRIDAY: 'YANTRA_SHOPPING_SEARCH_BLACK_FRIDAY',\n /** Holiday deal reminders and the opt-in daily deal text. */\n DEAL_ALERTS: 'YANTRA_SHOPPING_SEARCH_DEAL_ALERTS',\n /** What a social post (TikTok, Instagram, YouTube...) is selling. */\n LINK_CHECK: 'YANTRA_SHOPPING_SEARCH_LINK_CHECK',\n\n /**\n * Coupon / voucher feeds — first-aid 009. The only lane that answers for a\n * deal with NO product behind it: a code, a store-wide markdown, a voucher.\n * Every other lane starts from a product and asks what it costs; this one\n * starts from the offer, which is the only way to reach the discount\n * inventory that never appears in a product search.\n */\n COUPONS: 'YANTRA_SHOPPING_SEARCH_COUPONS',\n\n /** The `lemmebuyit` provider — typed catalog rows, not a SERP scrape. */\n CATALOG_SEARCH: 'YANTRA_SHOPPING_SEARCH_CATALOG_SEARCH',\n RETAILERS: 'YANTRA_SHOPPING_SEARCH_RETAILERS',\n PRICE_HISTORY: 'YANTRA_SHOPPING_SEARCH_PRICE_HISTORY',\n /** Cheapest indexed retailer for one UPC/EAN/GTIN/ASIN. */\n COMPARE: 'YANTRA_SHOPPING_SEARCH_COMPARE',\n /** Compound discount / price / rating / stock query over the indexed store. */\n DEALS: 'YANTRA_SHOPPING_SEARCH_DEALS',\n /** Pins a product and arms the person's price alerts (notification centre + phone). */\n WATCH_ADD: 'YANTRA_SHOPPING_SEARCH_WATCH_ADD',\n /** Stops watching a product, and with it its alerts. */\n WATCH_REMOVE: 'YANTRA_SHOPPING_SEARCH_WATCH_REMOVE',\n WATCH_STATUS: 'YANTRA_SHOPPING_SEARCH_WATCH_STATUS',\n /** Live validation on the user's Computer browser; `schedule` arms the hourly cron. */\n PRICE_CHECK: 'YANTRA_SHOPPING_SEARCH_PRICE_CHECK',\n /**\n * Every photo and video a listing has, at full size (connector 1.4.0+). Free\n * page reads; `paid: true` lets an Amazon robot check fall back to metered\n * RapidAPI lookups. See services/productMedia for when the surface pays.\n */\n PRODUCT_MEDIA: 'YANTRA_SHOPPING_SEARCH_PRODUCT_MEDIA',\n} as const;\n\nexport type ShoppingSearchConnectorAction = (typeof SHOPPING_SEARCH_ACTIONS)[keyof typeof SHOPPING_SEARCH_ACTIONS];\n\nexport interface ShoppingConnectorProduct {\n name: string;\n price?: number;\n priceText?: string;\n retailer?: string;\n url: string;\n imageUrl?: string;\n rating?: string;\n /** Real review count when the connector's research surfaces one. */\n reviews?: number | string;\n reviewCount?: number | string;\n highlights?: string[];\n pros?: string[];\n cons?: string[];\n summary?: string;\n tradeoffs?: string[];\n}\n\nexport interface ShoppingWidgetProperty {\n id?: string;\n title?: string;\n url?: string;\n source?: string;\n imageUrl?: string;\n price?: number;\n priceLabel?: string;\n priceUnit?: string;\n rating?: number;\n /** Real review count when the connector's research surfaces one. */\n reviews?: number | string;\n reviewCount?: number | string;\n pros?: string[];\n cons?: string[];\n summary?: string;\n}\n\nexport interface ShoppingAnalyzeResult {\n success?: boolean;\n query?: string;\n products?: ShoppingConnectorProduct[];\n properties?: ShoppingWidgetProperty[];\n recommendations?: string[];\n tradeoffs?: string[];\n buyersGuide?: string;\n totalCount?: number;\n elapsedMs?: number;\n error?: string;\n}\n\nexport type ShoppingSearchConnectorResult<T = unknown> = {\n success: boolean;\n data?: T;\n error?: string;\n};\n\nexport interface ShoppingSearchConnectorCredentials {\n parallelApiKey?: string;\n /** Forwarded to connector amazonList (Axesso / Real-Time Amazon Data). */\n rapidApiKey?: string;\n /** Forwarded to the connector's lemmebuyit provider (catalog / deals / compare). */\n lemmebuyitApiKey?: string;\n /** Coupon feeds (first-aid 009). Two vendors, two keys — a host holds either. */\n linkmydealsApiKey?: string;\n couponApiKey?: string;\n llmApiKey?: string;\n llmEndpoint?: string;\n llmModel?: string;\n}\n\nconst DEFAULT_LLM_ENDPOINT = 'https://api.openai.com';\n\n/** Read shopping-search secrets from the host-supplied config (host resolves from public env). */\nexport function resolveShoppingSearchConnectorCredentials(): ShoppingSearchConnectorCredentials {\n const runtime = getShoppingRuntime().config;\n const supplied = runtime.shoppingSearch ?? {};\n const parallelApiKey = supplied.parallelApiKey?.trim();\n const rapidApiKey = supplied.rapidApiKey?.trim();\n const lemmebuyitApiKey = supplied.lemmebuyitApiKey?.trim();\n const linkmydealsApiKey = supplied.linkmydealsApiKey?.trim();\n const couponApiKey = supplied.couponApiKey?.trim();\n const llmApiKey = supplied.llmApiKey?.trim();\n const llmModel = supplied.llmModel?.trim();\n const llmEndpoint = supplied.llmEndpoint?.trim() || (llmApiKey ? DEFAULT_LLM_ENDPOINT : undefined);\n\n return {\n ...(parallelApiKey ? { parallelApiKey } : {}),\n ...(rapidApiKey ? { rapidApiKey } : {}),\n ...(lemmebuyitApiKey ? { lemmebuyitApiKey } : {}),\n ...(linkmydealsApiKey ? { linkmydealsApiKey } : {}),\n ...(couponApiKey ? { couponApiKey } : {}),\n ...(llmApiKey ? { llmApiKey } : {}),\n ...(llmEndpoint ? { llmEndpoint } : {}),\n ...(llmModel ? { llmModel } : {}),\n };\n}\n\nfunction buildConnectorCredentialsPayload(credentials: ShoppingSearchConnectorCredentials): Record<string, unknown> {\n return {\n ...(credentials.parallelApiKey ? { parallelApiKey: credentials.parallelApiKey } : {}),\n ...(credentials.rapidApiKey ? { rapidApiKey: credentials.rapidApiKey } : {}),\n ...(credentials.lemmebuyitApiKey ? { lemmebuyitApiKey: credentials.lemmebuyitApiKey } : {}),\n ...(credentials.linkmydealsApiKey ? { linkmydealsApiKey: credentials.linkmydealsApiKey } : {}),\n ...(credentials.couponApiKey ? { couponApiKey: credentials.couponApiKey } : {}),\n ...(credentials.llmApiKey ? { llmApiKey: credentials.llmApiKey } : {}),\n ...(credentials.llmEndpoint ? { llmEndpoint: credentials.llmEndpoint } : {}),\n ...(credentials.llmModel ? { llmModel: credentials.llmModel } : {}),\n };\n}\n\nfunction withShoppingSearchCredentials(\n params: Record<string, unknown>,\n credentials: ShoppingSearchConnectorCredentials,\n): Record<string, unknown> {\n return { ...params, ...buildConnectorCredentialsPayload(credentials) };\n}\n\n/**\n * Execute a yantra-shopping-search connector action via the host connector executor.\n * All product / retailer SERP data is fetched by the connector — surface never calls RapidAPI.\n */\n/**\n * The actions the connector's `lemmebuyit` provider answers.\n *\n * LemmeBuyIt allows ONE in-flight request per key (\"LemmeBuyIt allows one\n * concurrent request… try in a moment, or upgrade for more concurrency\"). The\n * landing page's trending rails, the Deals board's catalog lane and a Shop\n * search all reach it, and when they overlap every call but one fails with\n * that message — which then reads as \"the catalog is down\" or \"took longer\n * than 20s\". So these actions go through one serial lane below: each waits\n * for the previous to settle. Slower under contention, never refused.\n */\nconst LEMMEBUYIT_ACTIONS: ReadonlySet<string> = new Set([\n SHOPPING_SEARCH_ACTIONS.CATALOG_SEARCH,\n SHOPPING_SEARCH_ACTIONS.RETAILERS,\n SHOPPING_SEARCH_ACTIONS.PRICE_HISTORY,\n SHOPPING_SEARCH_ACTIONS.COMPARE,\n SHOPPING_SEARCH_ACTIONS.DEALS,\n SHOPPING_SEARCH_ACTIONS.WATCH_ADD,\n SHOPPING_SEARCH_ACTIONS.WATCH_REMOVE,\n SHOPPING_SEARCH_ACTIONS.WATCH_STATUS,\n]);\n\n/**\n * Who is waiting on a call, for the one-at-a-time LemmeBuyIt lane.\n *\n * The lane used to be a single first-come queue, and the landing page is the\n * first thing every visit fills it with: each trending rail is a catalog call,\n * and on a connector without the in-session sweep each of those is one call\n * PER RETAILER. A shopper who typed \"macbook\" a few seconds after the page\n * opened waited behind every one of them - measured on dev at two minutes of\n * \"Searching retailers and the web…\" before a single product painted, with the\n * rails' calls still running after the shopper had left the landing page.\n */\nexport interface ConnectorLaneOptions {\n /**\n * `interactive` (the default) is a person waiting on the answer: a search, a\n * product drawer, a watch they just set. `background` is work nobody has\n * asked for yet - prefetching the landing page's rails - and only runs when\n * no interactive call is waiting.\n */\n priority?: 'interactive' | 'background';\n /**\n * Aborting drops a call that is still QUEUED, before it reaches the\n * provider; the promise rejects with the signal's reason. A call already\n * running finishes (the lane still owns the provider's one session until it\n * does), and the caller simply stops caring about its answer.\n */\n signal?: AbortSignal;\n}\n\ninterface LaneEntry {\n start: () => void;\n}\n\n/**\n * After an interactive call settles, background work waits this long before it\n * may take the lane. A caller that asks several things in a row - a search\n * walking retailers, a drawer reading compare then history - awaits one answer\n * before queueing the next, so at the instant one settles its follow-up is not\n * queued yet. Without the hold a rail would slip into every one of those gaps\n * and the search would be interleaved with prefetch again, one call apiece.\n */\nconst INTERACTIVE_HOLD_MS = 400;\n\nconst lane = {\n busy: false,\n interactive: [] as LaneEntry[],\n background: [] as LaneEntry[],\n lastInteractiveSettledAt: Number.NEGATIVE_INFINITY,\n holdTimer: null as ReturnType<typeof setTimeout> | null,\n};\n\nfunction pumpLane(): void {\n if (lane.busy) return;\n const interactive = lane.interactive.shift();\n if (interactive) {\n lane.busy = true;\n interactive.start();\n return;\n }\n if (lane.background.length === 0) return;\n const holdLeft = lane.lastInteractiveSettledAt + INTERACTIVE_HOLD_MS - Date.now();\n if (holdLeft > 0) {\n if (!lane.holdTimer) {\n lane.holdTimer = setTimeout(() => {\n lane.holdTimer = null;\n pumpLane();\n }, holdLeft);\n }\n return;\n }\n const background = lane.background.shift();\n if (!background) return;\n lane.busy = true;\n background.start();\n}\n\nfunction abortReason(signal: AbortSignal): unknown {\n const reason = (signal as AbortSignal & { reason?: unknown }).reason;\n if (reason !== undefined) return reason;\n // Hermes has no DOMException; an Error named AbortError is what isConnectorLaneAbort reads.\n const error = new Error('The operation was aborted.');\n error.name = 'AbortError';\n return error;\n}\n\n/** True for the rejection a {@link ConnectorLaneOptions.signal} abort produces. */\nexport function isConnectorLaneAbort(error: unknown): boolean {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'name' in error &&\n (error as { name?: unknown }).name === 'AbortError'\n );\n}\n\nfunction throughLemmeBuyItLane<T>(work: () => Promise<T>, options: ConnectorLaneOptions = {}): Promise<T> {\n const { signal } = options;\n const interactive = options.priority !== 'background';\n if (signal?.aborted) return Promise.reject(abortReason(signal));\n\n return new Promise<T>((resolve, reject) => {\n const queue = interactive ? lane.interactive : lane.background;\n const onAbort = () => {\n const at = queue.indexOf(entry);\n if (at < 0) return; // already running - it finishes; see ConnectorLaneOptions.signal\n queue.splice(at, 1);\n reject(abortReason(signal as AbortSignal));\n };\n const entry: LaneEntry = {\n start: () => {\n signal?.removeEventListener('abort', onAbort);\n // Settles exactly once, whatever `work` does (it may even throw\n // synchronously) - a call that never released the lane would\n // block every catalog read on the page.\n Promise.resolve()\n .then(work)\n .then(resolve, reject)\n .finally(() => {\n lane.busy = false;\n if (interactive) lane.lastInteractiveSettledAt = Date.now();\n pumpLane();\n });\n },\n };\n signal?.addEventListener('abort', onAbort, { once: true });\n queue.push(entry);\n pumpLane();\n });\n}\n\n/**\n * The actions that SEARCH - the ones a store answers for a delivery location.\n * The rest (watch bookkeeping, price history, coupon feeds) are not about a\n * place, and a postal code on them would only be noise in their params.\n */\nconst LOCATION_PRICED_ACTIONS: ReadonlySet<string> = new Set([\n SHOPPING_SEARCH_ACTIONS.ANALYZE,\n SHOPPING_SEARCH_ACTIONS.AMAZON_LIST,\n SHOPPING_SEARCH_ACTIONS.WALMART_LIST,\n SHOPPING_SEARCH_ACTIONS.EBAY_LIST,\n SHOPPING_SEARCH_ACTIONS.TARGET_LIST,\n SHOPPING_SEARCH_ACTIONS.SHOPIFY_LIST,\n SHOPPING_SEARCH_ACTIONS.GOOGLE_LIST,\n SHOPPING_SEARCH_ACTIONS.TEMU_LIST,\n SHOPPING_SEARCH_ACTIONS.OFFERS,\n SHOPPING_SEARCH_ACTIONS.CATALOG_SEARCH,\n SHOPPING_SEARCH_ACTIONS.CHECK_AVAILABILITY,\n]);\n\n/**\n * A search's params with the shopper's delivery location (`postal_code`, see\n * state/deliveryLocation) added, so the store prices, stocks and dates its\n * delivery for that place. A caller that already chose a location keeps it;\n * no location set, or an action that is not a search, leaves the params as\n * they were.\n */\nexport function withPostalCode(\n action: string,\n params: Record<string, unknown>,\n postalCode: string | undefined = currentPostalCode(),\n): Record<string, unknown> {\n if (!postalCode || !LOCATION_PRICED_ACTIONS.has(action)) return params;\n if (typeof params.postal_code === 'string' && params.postal_code.trim()) return params;\n return { ...params, postal_code: postalCode };\n}\n\nexport async function invokeShoppingSearchConnector<T = ShoppingAnalyzeResult>(\n params: Record<string, unknown>,\n action: ShoppingSearchConnectorAction = SHOPPING_SEARCH_ACTIONS.ANALYZE,\n options: ConnectorLaneOptions = {},\n): Promise<ShoppingSearchConnectorResult<T>> {\n if (LEMMEBUYIT_ACTIONS.has(action)) {\n return throughLemmeBuyItLane(() => dispatchShoppingSearchConnector<T>(params, action), options);\n }\n if (options.signal?.aborted) throw abortReason(options.signal);\n return dispatchShoppingSearchConnector<T>(params, action);\n}\n\nasync function dispatchShoppingSearchConnector<T>(\n params: Record<string, unknown>,\n action: ShoppingSearchConnectorAction,\n): Promise<ShoppingSearchConnectorResult<T>> {\n const runtime = getShoppingRuntime();\n const credentials = resolveShoppingSearchConnectorCredentials();\n // Native's exec seam has no credentials/auth argument: the host's\n // `shoppingSearch` config (catalogEnabled + keys) rides in the params.\n const execParams = withShoppingSearchCredentials(\n { ...withPostalCode(action, params), stream: false, ...runtime.config.shoppingSearch },\n credentials,\n );\n const remote = await runtime.exec<T>(SHOPPING_SEARCH_CONNECTOR_ID, action, execParams);\n if (!remote.success) {\n return { success: false, error: remote.error || 'Connector action failed' };\n }\n return { success: true, data: remote.data };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAYO,MAAM,4BAA+B,GAAA;AACrC,MAAM,uBAA0B,GAAA;AAAA;AAAA,EAErC,OAAS,EAAA,gCAAA;AAAA;AAAA,EAET,WAAa,EAAA,oCAAA;AAAA;AAAA,EAEb,YAAc,EAAA,qCAAA;AAAA;AAAA,EAEd,SAAW,EAAA,kCAAA;AAAA;AAAA,EAEX,WAAa,EA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1,4 +1,4 @@
1
- import {config}from'../../../config/env-config.js';import {sessionRenewer}from'../../canvas/sessionRenewal.js';import {getShoppingRuntime}from'../shoppingRuntime.js';function shoppingSubgraphUrl() {
1
+ import {config}from'../../../config/env-config.js';import {sessionRenewer}from'../../canvas/sessionRenewal.js';import {getShoppingRuntime}from'../shoppingRuntime.js';import {followAccount}from'../state/accountCaches.js';function shoppingSubgraphUrl() {
2
2
  return (config.SHOPPING_SUBGRAPH_URL || "").trim();
3
3
  }
4
4
  function sessionToken() {
@@ -53,6 +53,7 @@ async function shoppingSubgraphQuery(query, variables = {}) {
53
53
  try {
54
54
  const firstToken = sessionToken();
55
55
  if (!firstToken) return fail("Not signed in \u2014 no session token to authenticate with.");
56
+ followAccount(firstToken);
56
57
  let res = await send(firstToken);
57
58
  if (res.status === 401 || res.status === 403) {
58
59
  const token = await ((_a = sessionRenewer()) == null ? void 0 : _a.renew().catch(() => null));
@@ -1 +1 @@
1
- {"version":3,"file":"shoppingSubgraph.js","sources":["../../../../src/features/shopping/services/shoppingSubgraph.ts"],"sourcesContent":["/**\n * Client for `servers/shopping-subgraph-server` — the shopping surface's own\n * backend (the product-page check today; the stored deals and trending boards\n * with Phase 5). Native twin of the web surface's `services/shoppingSubgraph.ts`\n * (0.37.0).\n *\n * Native differences:\n * - the endpoint is `config.SHOPPING_SUBGRAPH_URL`, which env-config derives as\n * `shopping-subgraph-backend.<env>` from the backend the surface session is\n * minted against (the same `resolveSubgraphUrl` rule as the character and\n * games subgraphs), instead of from a page host;\n * - the bearer is the host's surface session token (the one the shopping\n * connector already runs with): the session renewer's current token, else the\n * token the experience installed on the runtime. A 401/403 re-mints once\n * through that same renewer (canvas/sessionRenewal), web's `refreshAuthToken`.\n *\n * Every call returns null instead of throwing, so callers degrade to their\n * live-only path when the subgraph is unreachable. Read\n * {@link lastShoppingSubgraphError} to tell \"genuinely empty\" apart from \"could\n * not reach the server\".\n */\nimport { config } from '../../../config/env-config';\nimport { sessionRenewer } from '../../canvas/sessionRenewal';\nimport { getShoppingRuntime } from '../shoppingRuntime';\n\n/** The subgraph's GraphQL endpoint, or '' when this build has none. */\nexport function shoppingSubgraphUrl(): string {\n return (config.SHOPPING_SUBGRAPH_URL || '').trim();\n}\n\n/** The bearer the subgraph is called with: the session's current token, else the one the experience installed. */\nfunction sessionToken(): string | null {\n const fromSession = sessionRenewer()?.current()?.trim();\n if (fromSession) return fromSession;\n return getShoppingRuntime().token?.trim() || null;\n}\n\n/** True when there is somewhere to talk to AND something to authenticate with. */\nexport function shoppingSubgraphConfigured(): boolean {\n return Boolean(shoppingSubgraphUrl()) && Boolean(sessionToken());\n}\n\nlet lastError: string | null = null;\n\n/** Why the last request failed, or null after a success. */\nexport function lastShoppingSubgraphError(): string | null {\n return lastError;\n}\n\n/** First word of the operation, for log lines — `query StoredDeals…` -> `StoredDeals`. */\nfunction opName(query: string): string {\n return query.trim().match(/^(?:query|mutation)\\s+(\\w+)/)?.[1] ?? 'anonymous';\n}\n\n/** How long one subgraph request may take before it is given up as unreachable. */\nexport const SHOPPING_SUBGRAPH_TIMEOUT_MS = 20_000;\n\n/**\n * POST an operation with the bearer, re-minting once on 401/403.\n *\n * Null on every failure — with the reason recorded in {@link lastShoppingSubgraphError}\n * and warned to the console, so a silent null is never indistinguishable from\n * an empty result.\n */\nexport async function shoppingSubgraphQuery<T>(\n query: string,\n variables: Record<string, unknown> = {},\n): Promise<T | null> {\n const op = opName(query);\n const fail = (reason: string): null => {\n console.warn(`[shopping-subgraph] ${op}: ${reason}`);\n lastError = reason;\n return null;\n };\n\n const url = shoppingSubgraphUrl();\n if (!url) {\n return fail('No endpoint — set SHOPPING_SUBGRAPH_URL, or a GRAPHQL_URL it can be derived from.');\n }\n\n const body = JSON.stringify({ query, variables });\n const send = async (bearer: string | null | undefined): Promise<Response> => {\n const headers: Record<string, string> = { 'content-type': 'application/json' };\n if (bearer) headers.authorization = `Bearer ${bearer}`;\n // Native: a deadline web lacks. Search rows wait on the page check, so a hung request on a\n // phone's network would hold the grid; past this, the check is \"unverified\" and rows show as they are.\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), SHOPPING_SUBGRAPH_TIMEOUT_MS);\n try {\n return await fetch(url, { method: 'POST', headers, body, signal: controller.signal });\n } finally {\n clearTimeout(timer);\n }\n };\n\n try {\n const firstToken = sessionToken();\n if (!firstToken) return fail('Not signed in — no session token to authenticate with.');\n let res = await send(firstToken);\n if (res.status === 401 || res.status === 403) {\n const token = await sessionRenewer()\n ?.renew()\n .catch(() => null);\n if (token && token !== firstToken) res = await send(token);\n else return fail('Session expired and could not be renewed — sign in again.');\n }\n if (!res.ok) {\n const text = await res.text().catch(() => '');\n return fail(`HTTP ${res.status} — ${text.slice(0, 200)}`);\n }\n const json = (await res.json().catch(() => null)) as {\n data?: T;\n errors?: { message?: string }[];\n } | null;\n if (!json) return fail('Response was not JSON.');\n if (json.errors?.length) {\n return fail(json.errors.map((e) => e.message).join('; '));\n }\n lastError = null;\n return (json.data ?? null) as T | null;\n } catch (err) {\n return fail(`Could not reach the shopping backend — ${err instanceof Error ? err.message : String(err)}.`);\n }\n}\n"],"names":[],"mappings":"sKA0BO,SAAS,mBAA8B,GAAA;AAC5C,EAAQ,OAAA,CAAA,MAAA,CAAO,qBAAyB,IAAA,EAAA,EAAI,IAAK,EAAA;AACnD;AAGA,SAAS,YAA8B,GAAA;AA/BvC,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA;AAgCE,EAAA,MAAM,WAAc,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,cAAA,EAAA,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAkB,cAAlB,IAA6B,GAAA,MAAA,GAAA,EAAA,CAAA,IAAA,EAAA;AACjD,EAAA,IAAI,aAAoB,OAAA,WAAA;AACxB,EAAA,OAAA,CAAA,CAAO,EAAmB,GAAA,kBAAA,EAAA,CAAE,KAArB,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAA4B,IAAU,EAAA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AAAA;AAE1D,IAAA,MAAM,OAAQ,MAAM,GAAA,CAAI,MAAO,CAAA,KAAA,CAAM,MAAM,IAAI,CAAA;AAM/C,IAAA,IAAI,CAAC,IAAA,EAAa,OAAA,IAAA,CAAK,wBAAwB,CAAA;AAC/C,IAAI,IAAA,CAAA,EAAA,GAAA,IAAA,CAAK,MAAL,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAa,MAAQ,EAAA;AACvB,MAAO,OAAA,IAAA,CAAK,IAAK,CAAA,MAAA,CAAO,GAAI,CAAA,CAAA,CAAA,KAAK,EAAE,OAAO,CAAA,CAAE,IAAK,CAAA,IAAI,CAAC,CAAA;AAAA;AAExD,IAAY,SAAA,GAAA,IAAA;AACZ,IAAQ,OAAA,CAAA,EAAA,GAAA,IAAA,CAAK,SAAL,IAAa,GAAA,EAAA,GAAA,IAAA;AAAA,WACd,GAAK,EAAA;AACZ,IAAO,OAAA,IAAA,CAAK,+CAA0C,GAAe,YAAA,KAAA,GAAQ,IAAI,OAAU,GAAA,MAAA,CAAO,GAAG,CAAC,CAAG,CAAA,CAAA,CAAA;AAAA;AAE7G"}
1
+ {"version":3,"file":"shoppingSubgraph.js","sources":["../../../../src/features/shopping/services/shoppingSubgraph.ts"],"sourcesContent":["/**\n * Client for `servers/shopping-subgraph-server` — the shopping surface's own\n * backend (the product-page check today; the stored deals and trending boards\n * with Phase 5). Native twin of the web surface's `services/shoppingSubgraph.ts`\n * (0.37.0).\n *\n * Native differences:\n * - the endpoint is `config.SHOPPING_SUBGRAPH_URL`, which env-config derives as\n * `shopping-subgraph-backend.<env>` from the backend the surface session is\n * minted against (the same `resolveSubgraphUrl` rule as the character and\n * games subgraphs), instead of from a page host;\n * - the bearer is the host's surface session token (the one the shopping\n * connector already runs with): the session renewer's current token, else the\n * token the experience installed on the runtime. A 401/403 re-mints once\n * through that same renewer (canvas/sessionRenewal), web's `refreshAuthToken`.\n *\n * Every call returns null instead of throwing, so callers degrade to their\n * live-only path when the subgraph is unreachable. Read\n * {@link lastShoppingSubgraphError} to tell \"genuinely empty\" apart from \"could\n * not reach the server\".\n */\nimport { config } from '../../../config/env-config';\nimport { sessionRenewer } from '../../canvas/sessionRenewal';\nimport { getShoppingRuntime } from '../shoppingRuntime';\nimport { followAccount } from '../state/accountCaches';\n\n/** The subgraph's GraphQL endpoint, or '' when this build has none. */\nexport function shoppingSubgraphUrl(): string {\n return (config.SHOPPING_SUBGRAPH_URL || '').trim();\n}\n\n/** The bearer the subgraph is called with: the session's current token, else the one the experience installed. */\nfunction sessionToken(): string | null {\n const fromSession = sessionRenewer()?.current()?.trim();\n if (fromSession) return fromSession;\n return getShoppingRuntime().token?.trim() || null;\n}\n\n/** True when there is somewhere to talk to AND something to authenticate with. */\nexport function shoppingSubgraphConfigured(): boolean {\n return Boolean(shoppingSubgraphUrl()) && Boolean(sessionToken());\n}\n\nlet lastError: string | null = null;\n\n/** Why the last request failed, or null after a success. */\nexport function lastShoppingSubgraphError(): string | null {\n return lastError;\n}\n\n/** First word of the operation, for log lines — `query StoredDeals…` -> `StoredDeals`. */\nfunction opName(query: string): string {\n return query.trim().match(/^(?:query|mutation)\\s+(\\w+)/)?.[1] ?? 'anonymous';\n}\n\n/** How long one subgraph request may take before it is given up as unreachable. */\nexport const SHOPPING_SUBGRAPH_TIMEOUT_MS = 20_000;\n\n/**\n * POST an operation with the bearer, re-minting once on 401/403.\n *\n * Null on every failure — with the reason recorded in {@link lastShoppingSubgraphError}\n * and warned to the console, so a silent null is never indistinguishable from\n * an empty result.\n */\nexport async function shoppingSubgraphQuery<T>(\n query: string,\n variables: Record<string, unknown> = {},\n): Promise<T | null> {\n const op = opName(query);\n const fail = (reason: string): null => {\n console.warn(`[shopping-subgraph] ${op}: ${reason}`);\n lastError = reason;\n return null;\n };\n\n const url = shoppingSubgraphUrl();\n if (!url) {\n return fail('No endpoint — set SHOPPING_SUBGRAPH_URL, or a GRAPHQL_URL it can be derived from.');\n }\n\n const body = JSON.stringify({ query, variables });\n const send = async (bearer: string | null | undefined): Promise<Response> => {\n const headers: Record<string, string> = { 'content-type': 'application/json' };\n if (bearer) headers.authorization = `Bearer ${bearer}`;\n // Native: a deadline web lacks. Search rows wait on the page check, so a hung request on a\n // phone's network would hold the grid; past this, the check is \"unverified\" and rows show as they are.\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), SHOPPING_SUBGRAPH_TIMEOUT_MS);\n try {\n return await fetch(url, { method: 'POST', headers, body, signal: controller.signal });\n } finally {\n clearTimeout(timer);\n }\n };\n\n try {\n const firstToken = sessionToken();\n if (!firstToken) return fail('Not signed in — no session token to authenticate with.');\n // Another account than the one the cached reads were made for: they go.\n followAccount(firstToken);\n let res = await send(firstToken);\n if (res.status === 401 || res.status === 403) {\n const token = await sessionRenewer()\n ?.renew()\n .catch(() => null);\n if (token && token !== firstToken) res = await send(token);\n else return fail('Session expired and could not be renewed — sign in again.');\n }\n if (!res.ok) {\n const text = await res.text().catch(() => '');\n return fail(`HTTP ${res.status} — ${text.slice(0, 200)}`);\n }\n const json = (await res.json().catch(() => null)) as {\n data?: T;\n errors?: { message?: string }[];\n } | null;\n if (!json) return fail('Response was not JSON.');\n if (json.errors?.length) {\n return fail(json.errors.map((e) => e.message).join('; '));\n }\n lastError = null;\n return (json.data ?? null) as T | null;\n } catch (err) {\n return fail(`Could not reach the shopping backend — ${err instanceof Error ? err.message : String(err)}.`);\n }\n}\n"],"names":[],"mappings":"4NA2BO,SAAS,mBAA8B,GAAA;AAC5C,EAAQ,OAAA,CAAA,MAAA,CAAO,qBAAyB,IAAA,EAAA,EAAI,IAAK,EAAA;AACnD;AAGA,SAAS,YAA8B,GAAA;AAhCvC,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA;AAiCE,EAAA,MAAM,WAAc,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,cAAA,EAAA,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAkB,cAAlB,IAA6B,GAAA,MAAA,GAA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