@envive-ai/react-hooks 0.3.45 → 0.3.47

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 (293) hide show
  1. package/dist/application/commerce-api.cjs +73 -3
  2. package/dist/application/commerce-api.d.cts +16 -1
  3. package/dist/application/commerce-api.d.ts +16 -1
  4. package/dist/application/commerce-api.js +73 -3
  5. package/dist/application/models/api/userEvent.d.cts +9 -2
  6. package/dist/application/models/api/userEvent.d.ts +9 -2
  7. package/dist/application/models/api/widgetText.d.cts +2 -1
  8. package/dist/application/models/api/widgetText.d.ts +2 -1
  9. package/dist/application/models/featureGates.cjs +2 -1
  10. package/dist/application/models/featureGates.d.cts +2 -1
  11. package/dist/application/models/featureGates.d.ts +2 -1
  12. package/dist/application/models/featureGates.js +2 -1
  13. package/dist/application/models/graphql/queries/getProductOptionsQuery.cjs +33 -0
  14. package/dist/application/models/graphql/queries/getProductOptionsQuery.d.cts +28 -0
  15. package/dist/application/models/graphql/queries/getProductOptionsQuery.d.ts +28 -0
  16. package/dist/application/models/graphql/queries/getProductOptionsQuery.js +32 -0
  17. package/dist/application/models/index.cjs +1 -1
  18. package/dist/application/models/index.js +1 -1
  19. package/dist/application/models/validators/validateGraphQLFrontendConfig.cjs +1 -1
  20. package/dist/application/models/validators/validateGraphQLFrontendConfig.js +1 -1
  21. package/dist/application/models/validators/validateResponse.cjs +2 -1
  22. package/dist/application/models/validators/validateResponse.js +2 -1
  23. package/dist/application/models/validators/validateUserEvent.cjs +3 -3
  24. package/dist/application/models/validators/validateUserEvent.js +3 -3
  25. package/dist/application/utils/elementObserver.d.cts +2 -2
  26. package/dist/application/utils/elementObserver.d.ts +2 -2
  27. package/dist/application/utils/index.cjs +2 -0
  28. package/dist/application/utils/index.d.cts +2 -1
  29. package/dist/application/utils/index.d.ts +2 -1
  30. package/dist/application/utils/index.js +2 -1
  31. package/dist/application/utils/messageFromAddToCartEvent.cjs +32 -0
  32. package/dist/application/utils/messageFromAddToCartEvent.d.cts +19 -0
  33. package/dist/application/utils/messageFromAddToCartEvent.d.ts +19 -0
  34. package/dist/application/utils/messageFromAddToCartEvent.js +31 -0
  35. package/dist/application/utils/widgetTextFromApiWidgetTextResponse.cjs +3 -2
  36. package/dist/application/utils/widgetTextFromApiWidgetTextResponse.js +3 -2
  37. package/dist/atoms/app/index.cjs +1 -1
  38. package/dist/atoms/app/index.d.cts +7 -7
  39. package/dist/atoms/app/index.d.ts +7 -7
  40. package/dist/atoms/app/index.js +1 -1
  41. package/dist/atoms/app/variant.cjs +2 -2
  42. package/dist/atoms/app/variant.d.cts +7 -7
  43. package/dist/atoms/app/variant.d.ts +7 -7
  44. package/dist/atoms/app/variant.js +2 -2
  45. package/dist/atoms/chat/chatState.d.cts +19 -19
  46. package/dist/atoms/chat/chatState.d.ts +19 -19
  47. package/dist/atoms/chat/form.d.cts +2 -2
  48. package/dist/atoms/chat/form.d.ts +2 -2
  49. package/dist/atoms/chat/index.cjs +1 -1
  50. package/dist/atoms/chat/index.d.cts +2 -2
  51. package/dist/atoms/chat/index.d.ts +2 -2
  52. package/dist/atoms/chat/index.js +1 -1
  53. package/dist/atoms/chat/lastMessage.d.cts +2 -2
  54. package/dist/atoms/chat/lastMessage.d.ts +2 -2
  55. package/dist/atoms/chat/messageQueue.d.cts +6 -6
  56. package/dist/atoms/chat/messageQueue.d.ts +6 -6
  57. package/dist/atoms/chat/performanceMetrics.d.cts +6 -6
  58. package/dist/atoms/chat/performanceMetrics.d.ts +6 -6
  59. package/dist/atoms/chat/renderedWidgetRefs.d.cts +2 -2
  60. package/dist/atoms/chat/renderedWidgetRefs.d.ts +2 -2
  61. package/dist/atoms/chat/replies.d.cts +3 -3
  62. package/dist/atoms/chat/replies.d.ts +2 -2
  63. package/dist/atoms/chat/suggestions.d.cts +2 -2
  64. package/dist/atoms/chat/suggestions.d.ts +2 -2
  65. package/dist/atoms/envive/enviveConfig.cjs +7 -4
  66. package/dist/atoms/envive/enviveConfig.d.cts +16 -14
  67. package/dist/atoms/envive/enviveConfig.d.ts +16 -14
  68. package/dist/atoms/envive/enviveConfig.js +6 -4
  69. package/dist/atoms/globalSearch/globalSearch.d.cts +5 -5
  70. package/dist/atoms/globalSearch/globalSearch.d.ts +5 -5
  71. package/dist/atoms/org/customerService.d.cts +6 -6
  72. package/dist/atoms/org/customerService.d.ts +6 -6
  73. package/dist/atoms/org/graphqlConfig.cjs +1 -1
  74. package/dist/atoms/org/graphqlConfig.d.cts +6 -6
  75. package/dist/atoms/org/graphqlConfig.d.ts +6 -6
  76. package/dist/atoms/org/graphqlConfig.js +1 -1
  77. package/dist/atoms/org/index.cjs +1 -1
  78. package/dist/atoms/org/index.js +1 -1
  79. package/dist/atoms/org/newOrgConfigAtom.d.cts +2 -2
  80. package/dist/atoms/org/newOrgConfigAtom.d.ts +2 -2
  81. package/dist/atoms/org/orgAnalyticsConfig.d.cts +4 -4
  82. package/dist/atoms/org/orgAnalyticsConfig.d.ts +4 -4
  83. package/dist/atoms/search/chatSearch.cjs +1 -1
  84. package/dist/atoms/search/chatSearch.d.cts +17 -17
  85. package/dist/atoms/search/chatSearch.d.ts +17 -17
  86. package/dist/atoms/search/chatSearch.js +1 -1
  87. package/dist/atoms/search/searchAPI.cjs +1 -1
  88. package/dist/atoms/search/searchAPI.d.cts +13 -13
  89. package/dist/atoms/search/searchAPI.d.ts +13 -13
  90. package/dist/atoms/search/searchAPI.js +1 -1
  91. package/dist/atoms/widget/chatPreviewLoading.d.cts +2 -2
  92. package/dist/atoms/widget/chatPreviewLoading.d.ts +2 -2
  93. package/dist/contexts/enviveConfigContext/enviveConfigContext.cjs +6 -4
  94. package/dist/contexts/enviveConfigContext/enviveConfigContext.d.cts +3 -1
  95. package/dist/contexts/enviveConfigContext/enviveConfigContext.d.ts +3 -1
  96. package/dist/contexts/enviveConfigContext/enviveConfigContext.js +6 -4
  97. package/dist/contexts/enviveContext/enviveContext.cjs +7 -3
  98. package/dist/contexts/enviveContext/enviveContext.d.cts +5 -1
  99. package/dist/contexts/enviveContext/enviveContext.d.ts +5 -1
  100. package/dist/contexts/enviveContext/enviveContext.js +7 -3
  101. package/dist/contexts/enviveContext/types.d.cts +1 -1
  102. package/dist/contexts/enviveContext/types.d.ts +1 -1
  103. package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.cjs +2 -97
  104. package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.cts +3 -25
  105. package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +3 -25
  106. package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.js +3 -97
  107. package/dist/contexts/featureFlagServiceContext/index.cjs +2 -1
  108. package/dist/contexts/featureFlagServiceContext/index.d.cts +2 -1
  109. package/dist/contexts/featureFlagServiceContext/index.d.ts +2 -1
  110. package/dist/contexts/featureFlagServiceContext/index.js +2 -1
  111. package/dist/contexts/graphqlContext/mockV3Config.cjs +1 -1
  112. package/dist/contexts/graphqlContext/mockV3Config.js +1 -1
  113. package/dist/contexts/localStorageContext/index.cjs +2 -1
  114. package/dist/contexts/localStorageContext/index.d.cts +2 -1
  115. package/dist/contexts/localStorageContext/index.d.ts +2 -1
  116. package/dist/contexts/localStorageContext/index.js +2 -1
  117. package/dist/contexts/localStorageContext/localStorageContext.cjs +5 -11
  118. package/dist/contexts/localStorageContext/localStorageContext.d.cts +3 -7
  119. package/dist/contexts/localStorageContext/localStorageContext.d.ts +3 -7
  120. package/dist/contexts/localStorageContext/localStorageContext.js +3 -8
  121. package/dist/contexts/localStorageContext/localStorageKeys.cjs +12 -0
  122. package/dist/contexts/localStorageContext/localStorageKeys.d.cts +9 -0
  123. package/dist/contexts/localStorageContext/localStorageKeys.d.ts +9 -0
  124. package/dist/contexts/localStorageContext/localStorageKeys.js +11 -0
  125. package/dist/contexts/pageContext/pageContext.cjs +2 -2
  126. package/dist/contexts/pageContext/pageContext.js +2 -2
  127. package/dist/contexts/salesAgentContext/chatAPI.cjs +15 -4
  128. package/dist/contexts/salesAgentContext/chatAPI.d.cts +4 -1
  129. package/dist/contexts/salesAgentContext/chatAPI.d.ts +4 -1
  130. package/dist/contexts/salesAgentContext/chatAPI.js +16 -5
  131. package/dist/contexts/salesAgentContext/salesAgentContext.cjs +15 -4
  132. package/dist/contexts/salesAgentContext/salesAgentContext.d.cts +2 -1
  133. package/dist/contexts/salesAgentContext/salesAgentContext.d.ts +2 -1
  134. package/dist/contexts/salesAgentContext/salesAgentContext.js +16 -5
  135. package/dist/contexts/salesAgentContext/salesAgentService.cjs +12 -4
  136. package/dist/contexts/salesAgentContext/salesAgentService.js +12 -4
  137. package/dist/contexts/searchContext/searchContext.cjs +1 -1
  138. package/dist/contexts/searchContext/searchContext.js +1 -1
  139. package/dist/contexts/systemSettingsContext/systemSettingsContext.d.cts +2 -2
  140. package/dist/contexts/systemSettingsContext/systemSettingsContext.d.ts +2 -2
  141. package/dist/contexts/types.cjs +1 -1
  142. package/dist/contexts/types.d.cts +3 -1
  143. package/dist/contexts/types.d.ts +3 -1
  144. package/dist/contexts/types.js +1 -1
  145. package/dist/contexts/typesV3.cjs +1 -1
  146. package/dist/contexts/typesV3.d.cts +11 -2
  147. package/dist/contexts/typesV3.d.ts +12 -3
  148. package/dist/contexts/typesV3.js +1 -1
  149. package/dist/contexts/widgetConfigContext/widgetConfigContext.cjs +1 -1
  150. package/dist/contexts/widgetConfigContext/widgetConfigContext.js +1 -1
  151. package/dist/hooks/AddToCart/addToCartErrorMessage.cjs +7 -0
  152. package/dist/hooks/AddToCart/addToCartErrorMessage.d.cts +5 -0
  153. package/dist/hooks/AddToCart/addToCartErrorMessage.d.ts +5 -0
  154. package/dist/hooks/AddToCart/addToCartErrorMessage.js +6 -0
  155. package/dist/hooks/AddToCart/createAddToCartUserEvent.cjs +20 -0
  156. package/dist/hooks/AddToCart/createAddToCartUserEvent.d.cts +17 -0
  157. package/dist/hooks/AddToCart/createAddToCartUserEvent.d.ts +17 -0
  158. package/dist/hooks/AddToCart/createAddToCartUserEvent.js +19 -0
  159. package/dist/hooks/AddToCart/index.cjs +9 -0
  160. package/dist/hooks/AddToCart/index.d.cts +5 -0
  161. package/dist/hooks/AddToCart/index.d.ts +5 -0
  162. package/dist/hooks/AddToCart/index.js +6 -0
  163. package/dist/hooks/AddToCart/parseAddToCartFunction.cjs +27 -0
  164. package/dist/hooks/AddToCart/parseAddToCartFunction.d.cts +13 -0
  165. package/dist/hooks/AddToCart/parseAddToCartFunction.d.ts +13 -0
  166. package/dist/hooks/AddToCart/parseAddToCartFunction.js +27 -0
  167. package/dist/hooks/AddToCart/useAddToCart.cjs +24 -0
  168. package/dist/hooks/AddToCart/useAddToCart.d.cts +14 -0
  169. package/dist/hooks/AddToCart/useAddToCart.d.ts +14 -0
  170. package/dist/hooks/AddToCart/useAddToCart.js +23 -0
  171. package/dist/hooks/ChatToggle/useChatToggle.cjs +1 -1
  172. package/dist/hooks/ChatToggle/useChatToggle.js +1 -1
  173. package/dist/hooks/LocalStorageOperations/useLocalStorageOperations.cjs +6 -5
  174. package/dist/hooks/LocalStorageOperations/useLocalStorageOperations.js +3 -2
  175. package/dist/hooks/PageViewedEvent/usePageViewedEvent.cjs +6 -3
  176. package/dist/hooks/PageViewedEvent/usePageViewedEvent.js +6 -3
  177. package/dist/hooks/ProductDetails/index.cjs +9 -0
  178. package/dist/hooks/ProductDetails/index.d.cts +4 -0
  179. package/dist/hooks/ProductDetails/index.d.ts +4 -0
  180. package/dist/hooks/ProductDetails/index.js +4 -0
  181. package/dist/hooks/ProductDetails/useProductDetails.cjs +53 -0
  182. package/dist/hooks/ProductDetails/useProductDetails.d.cts +20 -0
  183. package/dist/hooks/ProductDetails/useProductDetails.d.ts +20 -0
  184. package/dist/hooks/ProductDetails/useProductDetails.js +52 -0
  185. package/dist/hooks/ProductDetails/variantSelection.cjs +42 -0
  186. package/dist/hooks/ProductDetails/variantSelection.d.cts +35 -0
  187. package/dist/hooks/ProductDetails/variantSelection.d.ts +35 -0
  188. package/dist/hooks/ProductDetails/variantSelection.js +38 -0
  189. package/dist/hooks/Search/useSearch.cjs +3 -3
  190. package/dist/hooks/Search/useSearch.d.cts +1 -1
  191. package/dist/hooks/Search/useSearch.d.ts +1 -1
  192. package/dist/hooks/Search/useSearch.js +3 -3
  193. package/dist/hooks/SystemSettingsContext/useSystemSettingsContext.d.cts +2 -2
  194. package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.cjs +11 -2
  195. package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.d.cts +1 -10
  196. package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.d.ts +1 -10
  197. package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.js +11 -2
  198. package/dist/hooks/WidgetInteraction/types.cjs +13 -3
  199. package/dist/hooks/WidgetInteraction/types.d.cts +29 -4
  200. package/dist/hooks/WidgetInteraction/types.d.ts +29 -4
  201. package/dist/hooks/WidgetInteraction/types.js +13 -3
  202. package/dist/hooks/WidgetInteraction/utils.cjs +2 -2
  203. package/dist/hooks/WidgetInteraction/utils.js +2 -2
  204. package/dist/hooks/utils.d.cts +1 -1
  205. package/dist/hooks/utils.d.ts +1 -1
  206. package/dist/services/amplitudeService/amplitudeService.cjs +18 -11
  207. package/dist/services/amplitudeService/amplitudeService.d.cts +5 -2
  208. package/dist/services/amplitudeService/amplitudeService.d.ts +5 -2
  209. package/dist/services/amplitudeService/amplitudeService.js +16 -8
  210. package/dist/services/enviveConfigService/enviveConfigService.cjs +36 -4
  211. package/dist/services/enviveConfigService/enviveConfigService.d.cts +4 -1
  212. package/dist/services/enviveConfigService/enviveConfigService.d.ts +4 -1
  213. package/dist/services/enviveConfigService/enviveConfigService.js +35 -3
  214. package/dist/services/enviveConfigService/fetchGraphQLConfig.cjs +9 -8
  215. package/dist/services/enviveConfigService/fetchGraphQLConfig.js +9 -7
  216. package/dist/services/featureFlagService/index.cjs +101 -0
  217. package/dist/services/featureFlagService/index.d.cts +28 -0
  218. package/dist/services/featureFlagService/index.d.ts +28 -0
  219. package/dist/services/featureFlagService/index.js +101 -0
  220. package/dist/services/ga4ProjectionService/ga4EventSchema.cjs +8 -2
  221. package/dist/services/ga4ProjectionService/ga4EventSchema.js +8 -2
  222. package/dist/services/hardcopyService/hardcopyService.cjs +4 -3
  223. package/dist/services/hardcopyService/hardcopyService.d.cts +1 -1
  224. package/dist/services/hardcopyService/hardcopyService.d.ts +1 -1
  225. package/dist/services/hardcopyService/hardcopyService.js +4 -3
  226. package/dist/services/urlResolverWarmupService/index.cjs +54 -0
  227. package/dist/services/urlResolverWarmupService/index.d.cts +40 -0
  228. package/dist/services/urlResolverWarmupService/index.d.ts +40 -0
  229. package/dist/services/urlResolverWarmupService/index.js +54 -0
  230. package/dist/types/enviveConfig.d.cts +6 -2
  231. package/dist/types/enviveConfig.d.ts +6 -2
  232. package/dist/types/index.d.cts +2 -2
  233. package/dist/types/index.d.ts +2 -2
  234. package/package.json +18 -2
  235. package/src/application/__tests__/commerceApiAddToCartRehydration.test.ts +126 -0
  236. package/src/application/commerce-api.ts +142 -23
  237. package/src/application/models/api/userEvent.ts +8 -1
  238. package/src/application/models/api/widgetText.ts +3 -0
  239. package/src/application/models/featureGates.ts +5 -0
  240. package/src/application/models/graphql/queries/getProductOptionsQuery.ts +59 -0
  241. package/src/application/models/validators/__tests__/validateUserEvent.test.ts +41 -0
  242. package/src/application/models/validators/validateResponse.ts +1 -0
  243. package/src/application/models/validators/validateUserEvent.ts +7 -2
  244. package/src/application/utils/__tests__/messageFromAddToCartEvent.test.ts +109 -0
  245. package/src/application/utils/index.ts +1 -0
  246. package/src/application/utils/messageFromAddToCartEvent.ts +32 -0
  247. package/src/application/utils/widgetTextFromApiWidgetTextResponse.ts +1 -0
  248. package/src/atoms/app/index.ts +1 -1
  249. package/src/atoms/app/variant.ts +1 -1
  250. package/src/atoms/envive/enviveConfig.ts +6 -1
  251. package/src/atoms/org/graphqlConfig.ts +1 -1
  252. package/src/contexts/enviveConfigContext/enviveConfigContext.tsx +5 -0
  253. package/src/contexts/enviveContext/enviveContext.tsx +10 -0
  254. package/src/contexts/featureFlagServiceContext/featureFlagServiceContext.tsx +6 -173
  255. package/src/contexts/localStorageContext/localStorageContext.tsx +2 -5
  256. package/src/contexts/localStorageContext/localStorageKeys.ts +8 -0
  257. package/src/contexts/pageContext/pageContext.tsx +1 -1
  258. package/src/contexts/salesAgentContext/__tests__/chatAPI.test.tsx +63 -0
  259. package/src/contexts/salesAgentContext/chatAPI.ts +20 -1
  260. package/src/contexts/salesAgentContext/salesAgentContext.tsx +17 -0
  261. package/src/contexts/salesAgentContext/salesAgentService.ts +12 -3
  262. package/src/contexts/types.ts +2 -0
  263. package/src/contexts/typesV3.ts +14 -0
  264. package/src/hooks/AddToCart/__tests__/parseAddToCartFunction.test.ts +31 -0
  265. package/src/hooks/AddToCart/__tests__/useAddToCart.test.tsx +204 -0
  266. package/src/hooks/AddToCart/addToCartErrorMessage.ts +2 -0
  267. package/src/hooks/AddToCart/createAddToCartUserEvent.ts +25 -0
  268. package/src/hooks/AddToCart/index.ts +4 -0
  269. package/src/hooks/AddToCart/parseAddToCartFunction.ts +31 -0
  270. package/src/hooks/AddToCart/useAddToCart.ts +35 -0
  271. package/src/hooks/PageViewedEvent/__tests__/usePageViewedEvent.test.ts +4 -4
  272. package/src/hooks/PageViewedEvent/usePageViewedEvent.ts +5 -1
  273. package/src/hooks/ProductDetails/__tests__/useProductDetails.test.tsx +129 -0
  274. package/src/hooks/ProductDetails/__tests__/variantSelection.test.ts +145 -0
  275. package/src/hooks/ProductDetails/index.ts +2 -0
  276. package/src/hooks/ProductDetails/useProductDetails.ts +62 -0
  277. package/src/hooks/ProductDetails/variantSelection.ts +61 -0
  278. package/src/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.ts +15 -0
  279. package/src/hooks/WidgetInteraction/types.ts +43 -2
  280. package/src/hooks/WidgetInteraction/utils.ts +1 -1
  281. package/src/services/amplitudeService/__tests__/amplitudeService.test.ts +8 -8
  282. package/src/services/amplitudeService/amplitudeService.ts +43 -23
  283. package/src/services/enviveConfigService/__tests__/enviveConfigService.test.ts +208 -0
  284. package/src/services/enviveConfigService/enviveConfigService.ts +62 -2
  285. package/src/services/enviveConfigService/fetchGraphQLConfig.ts +17 -6
  286. package/src/services/featureFlagService/index.ts +176 -0
  287. package/src/services/ga4ProjectionService/__tests__/ga4ProjectionService.test.ts +36 -0
  288. package/src/services/ga4ProjectionService/ga4EventSchema.ts +7 -0
  289. package/src/services/hardcopyService/__tests__/hardcopyService.test.ts +47 -1
  290. package/src/services/hardcopyService/hardcopyService.ts +5 -0
  291. package/src/services/urlResolverWarmupService/__tests__/urlResolverWarmupService.test.ts +85 -0
  292. package/src/services/urlResolverWarmupService/index.ts +89 -0
  293. package/src/types/enviveConfig.ts +3 -0
@@ -28,6 +28,10 @@ import {
28
28
  UserEvent,
29
29
  } from 'src/application/models';
30
30
  import { OrgConfig } from 'src/application/models/api/orgConfigResults';
31
+ import {
32
+ ProductDetails,
33
+ getProductOptionsQuery,
34
+ } from 'src/application/models/graphql/queries/getProductOptionsQuery';
31
35
  import { ProductExperiment } from 'src/application/models/productExperiment';
32
36
  import { validateOrgConfigResults } from 'src/application/models/validators/validateOrgConfigResults';
33
37
  import { validateResponse } from 'src/application/models/validators/validateResponse';
@@ -35,6 +39,7 @@ import { validateSuggestion } from 'src/application/models/validators/validateSu
35
39
  import { validateUserEvent } from 'src/application/models/validators/validateUserEvent';
36
40
  import {
37
41
  getQueryParam,
42
+ messageFromAddToCartEvent,
38
43
  messageFromQueryEvent,
39
44
  messageFromResponse,
40
45
  messageFromSuggestionEvent,
@@ -146,7 +151,26 @@ class CommerceApiClient {
146
151
  this.productsApi = new ProductsApi(config);
147
152
  }
148
153
 
154
+ // Dedupes concurrent resolutions of the same URL: the injection bundle
155
+ // warms this call before React mounts, and PageProvider may request the
156
+ // same URL while the warm-up is still in flight.
157
+ private static inFlightUrlResolutions = new Map<string, Promise<unknown>>();
158
+
149
159
  static resolveUrl = async (url: string) => {
160
+ const inFlight = CommerceApiClient.inFlightUrlResolutions.get(url);
161
+ if (inFlight) {
162
+ return inFlight;
163
+ }
164
+ const request = CommerceApiClient.resolveUrlUncached(url);
165
+ CommerceApiClient.inFlightUrlResolutions.set(url, request);
166
+ try {
167
+ return await request;
168
+ } finally {
169
+ CommerceApiClient.inFlightUrlResolutions.delete(url);
170
+ }
171
+ };
172
+
173
+ private static resolveUrlUncached = async (url: string) => {
150
174
  const atomStore = getAtomStore();
151
175
  const orgShortName = atomStore.get(orgShortNameAtom);
152
176
  const orgId = atomStore.get(orgIdAtom);
@@ -405,33 +429,64 @@ class CommerceApiClient {
405
429
  )
406
430
  .filter(turn => turn.length > 0);
407
431
 
408
- const userMessages: Message[][] = userEvents
409
- .map(event => {
410
- if ([UserEventCategory.QueryTyped, UserEventCategory.Search].includes(event.category)) {
411
- return [messageFromQueryEvent(event)];
412
- }
432
+ const userMessages: Message[][] = (
433
+ await Promise.all(
434
+ userEvents.map(async event => {
435
+ if ([UserEventCategory.QueryTyped, UserEventCategory.Search].includes(event.category)) {
436
+ return [messageFromQueryEvent(event)];
437
+ }
413
438
 
414
- if (event.category === UserEventCategory.SuggestionClicked) {
415
- return [messageFromSuggestionEvent(event, suggestions)];
416
- }
439
+ if (event.category === UserEventCategory.SuggestionClicked) {
440
+ return [messageFromSuggestionEvent(event, suggestions)];
441
+ }
417
442
 
418
- if (event.category === UserEventCategory.FormSubmitted) {
419
- const formResponse = responses
420
- .flat()
421
- .find(
422
- response =>
423
- response.id === event.attributes.formResponseId &&
424
- event.attributes.formType !== FormType.Escalation,
425
- );
426
-
427
- if (formResponse && formResponse.category === ResponseCategory.Form) {
428
- return [messageFromFormSubmittedEvent(event, formResponse.attributes)];
443
+ if (event.category === UserEventCategory.AddToCart) {
444
+ // Historical events never carried a client-local productTitle (it's
445
+ // dropped before hitting the backend), so resolve it here: first for
446
+ // free from a matching Product response already fetched above, then
447
+ // as a fallback via the cached product-details call.
448
+ const matchedProduct = responses
449
+ .flat()
450
+ .find(
451
+ response =>
452
+ response.category === ResponseCategory.Product &&
453
+ response.attributes.id === event.attributes.productId,
454
+ );
455
+ let productTitle =
456
+ matchedProduct?.category === ResponseCategory.Product
457
+ ? matchedProduct.attributes.title
458
+ : undefined;
459
+ if (!productTitle) {
460
+ try {
461
+ const details = await CommerceApiClient.retrieveProductDetails(
462
+ event.attributes.productId,
463
+ );
464
+ productTitle = details?.title;
465
+ } catch {
466
+ productTitle = undefined;
467
+ }
468
+ }
469
+ return [messageFromAddToCartEvent(event, productTitle)];
470
+ }
471
+
472
+ if (event.category === UserEventCategory.FormSubmitted) {
473
+ const formResponse = responses
474
+ .flat()
475
+ .find(
476
+ response =>
477
+ response.id === event.attributes.formResponseId &&
478
+ event.attributes.formType !== FormType.Escalation,
479
+ );
480
+
481
+ if (formResponse && formResponse.category === ResponseCategory.Form) {
482
+ return [messageFromFormSubmittedEvent(event, formResponse.attributes)];
483
+ }
429
484
  }
430
- }
431
485
 
432
- return [];
433
- })
434
- .filter((message): message is Message[] => message.length > 0);
486
+ return [];
487
+ }),
488
+ )
489
+ ).filter((message): message is Message[] => message.length > 0);
435
490
 
436
491
  // Sort the messages chronologically to reconstruct the chat history
437
492
  const sortedMessages = [...assistantMessages, ...userMessages].sort(
@@ -494,6 +549,70 @@ class CommerceApiClient {
494
549
  }
495
550
  };
496
551
 
552
+ // Caches resolved product details by productId for the lifetime of the
553
+ // session: variant selection, the display of the add-to-cart chat message,
554
+ // and useProductDetails all resolve the same product repeatedly. Failed
555
+ // requests are evicted so a later call can retry.
556
+ private static productDetailsCache = new Map<string, Promise<ProductDetails | undefined>>();
557
+
558
+ static retrieveProductDetails = (productId: string): Promise<ProductDetails | undefined> => {
559
+ const cached = CommerceApiClient.productDetailsCache.get(productId);
560
+ if (cached) {
561
+ return cached;
562
+ }
563
+ const request = CommerceApiClient.retrieveProductDetailsUncached(productId).catch(err => {
564
+ CommerceApiClient.productDetailsCache.delete(productId);
565
+ throw err;
566
+ });
567
+ CommerceApiClient.productDetailsCache.set(productId, request);
568
+ return request;
569
+ };
570
+
571
+ /**
572
+ * Retrieves variant-level product details for a single product via the GraphQL
573
+ * `me.productOptions` query on POST /v1/graphql. Only meaningful for products
574
+ * that offer variations.
575
+ *
576
+ * @param productId - The product ID to retrieve details for
577
+ * @returns ProductDetails, or undefined when the product has no options data
578
+ * @throws on network/HTTP failure or GraphQL errors
579
+ */
580
+ private static retrieveProductDetailsUncached = async (
581
+ productId: string,
582
+ ): Promise<ProductDetails | undefined> => {
583
+ const atomStore = getAtomStore();
584
+ const baseUrl = atomStore.get(baseUrlAtom);
585
+ const apiKey = atomStore.get(orgLevelApiKeyAtom);
586
+
587
+ try {
588
+ const response = await fetch(`${baseUrl}/v1/graphql`, {
589
+ method: 'POST',
590
+ headers: {
591
+ 'Content-Type': 'application/json',
592
+ Authorization: `Bearer ${apiKey}`,
593
+ },
594
+ body: JSON.stringify({
595
+ query: getProductOptionsQuery(),
596
+ variables: { productId },
597
+ }),
598
+ });
599
+
600
+ if (!response.ok) {
601
+ throw new ResponseError(response, `GraphQL request failed: ${response.statusText}`);
602
+ }
603
+
604
+ const result = await response.json();
605
+ if (result.errors) {
606
+ throw new Error(`GraphQL errors: ${JSON.stringify(result.errors)}`);
607
+ }
608
+
609
+ return result.data?.me?.productOptions ?? undefined;
610
+ } catch (err) {
611
+ await throwSessionRestartRequiredIf('Failed to retrieve product details', err);
612
+ return undefined;
613
+ }
614
+ };
615
+
497
616
  /**
498
617
  *
499
618
  * @param payload
@@ -12,7 +12,14 @@ import {
12
12
  import { CamelCasedPropertiesDeep } from 'src/application/models/utilityTypes';
13
13
 
14
14
  // TODO flatten these out or explore new typescript openapi generator fork
15
- export interface PDPAttributes extends CamelCasedPropertiesDeep<ApiPDPAttributes> {}
15
+ export interface PDPAttributes extends CamelCasedPropertiesDeep<ApiPDPAttributes> {
16
+ /**
17
+ * Client-local only: never serialized to the backend (coreUserEventToApiUserEvent
18
+ * hand-picks fields and ignores this one). Lets the live add-to-cart chat message
19
+ * show a resolved product title instead of the raw productId.
20
+ */
21
+ productTitle?: string;
22
+ }
16
23
 
17
24
  export interface PLPAttributes extends CamelCasedPropertiesDeep<ApiPLPAttributes> {}
18
25
 
@@ -8,4 +8,7 @@ export type WidgetText = {
8
8
  requestId: string;
9
9
  language: string;
10
10
  values: Record<string, WidgetString[]>;
11
+ // Served-method attribution keyed by overridden slot name. Forwarded verbatim
12
+ // to the widget-text analytics events; the frontend never interprets it.
13
+ aiSuggestionsAttributionBySlot?: Record<string, unknown> | null;
11
14
  };
@@ -27,6 +27,11 @@ export enum FeatureGates {
27
27
  IsAiSuggestionsVariantEnabled = 'is_ai_suggestions_variant_enabled',
28
28
  IsAiSuggestionsVariantAEnabled = 'is_ai_suggestions_variant_a_enabled',
29
29
  IsAiSuggestionsVariantBEnabled = 'is_ai_suggestions_variant_b_enabled',
30
+ // Serves the agentic storefront (FullPageSalesAgentV3 welcome overlay)
31
+ // independently of the pdp/plp variant_b experiment. The backend serves the
32
+ // storefront under this gate and falls back to variant_b only until this
33
+ // ships, so an org can run the storefront without opting pdp/plp into variant_b.
34
+ IsAiSuggestionsStorefrontEnabled = 'is_ai_suggestions_storefront_enabled',
30
35
  IsVoiceInputEnabled = 'is_voice_input_enabled',
31
36
  // Statsig experiments / unified getWidgetConfig endpoint migration. When
32
37
  // true, EnviveConfigService calls getWidgetConfig (experiment-aware)
@@ -0,0 +1,59 @@
1
+ // Fetches variant-level product details (options, availability, pricing,
2
+ // images) for a single product. Only meaningful for products that offer
3
+ // variations — non-variant PDP surfaces should keep using the REST
4
+ // /v1/products/retrieve path (CommerceApiClient.retrieveProducts).
5
+ export const getProductOptionsQuery = () => `
6
+ query($productId: String!) {
7
+ me {
8
+ productOptions(productId: $productId) {
9
+ productId
10
+ virtualParentId
11
+ title
12
+ options {
13
+ name
14
+ values
15
+ }
16
+ variants {
17
+ variantId
18
+ available
19
+ originalPrice
20
+ salePrice
21
+ imageUrl
22
+ url
23
+ options {
24
+ name
25
+ value
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+ `;
32
+
33
+ export interface ProductVariantOption {
34
+ name: string;
35
+ value: string;
36
+ }
37
+
38
+ export interface ProductVariant {
39
+ variantId: string;
40
+ available: boolean;
41
+ originalPrice?: number;
42
+ salePrice?: number;
43
+ imageUrl?: string;
44
+ url?: string;
45
+ options: ProductVariantOption[];
46
+ }
47
+
48
+ export interface ProductOption {
49
+ name: string;
50
+ values: string[];
51
+ }
52
+
53
+ export interface ProductDetails {
54
+ productId: string;
55
+ virtualParentId?: string;
56
+ title: string;
57
+ options: ProductOption[];
58
+ variants: ProductVariant[];
59
+ }
@@ -0,0 +1,41 @@
1
+ import { UserEventCategory } from '@spiffy-ai/commerce-api-client';
2
+ import { validateUserEvent } from 'src/application/models/validators/validateUserEvent';
3
+
4
+ describe('validateUserEvent', () => {
5
+ it('preserves productId, parentProductId, and url for an AddToCart event', () => {
6
+ const result = validateUserEvent({
7
+ event_id: 'event-1',
8
+ created_at: '2026-07-20T00:00:00.000Z',
9
+ category: UserEventCategory.AddToCart,
10
+ attributes: {
11
+ product_id: 'product-1',
12
+ parent_product_id: 'parent-1',
13
+ url: 'https://example.com/product-1',
14
+ },
15
+ });
16
+
17
+ expect(result).toEqual({
18
+ eventId: 'event-1',
19
+ createdAt: '2026-07-20T00:00:00.000Z',
20
+ category: UserEventCategory.AddToCart,
21
+ attributes: {
22
+ productId: 'product-1',
23
+ parentProductId: 'parent-1',
24
+ url: 'https://example.com/product-1',
25
+ },
26
+ });
27
+ });
28
+
29
+ it('does not fall through to AppLoaded for an AddToCart event', () => {
30
+ const result = validateUserEvent({
31
+ event_id: 'event-1',
32
+ created_at: '2026-07-20T00:00:00.000Z',
33
+ category: UserEventCategory.AddToCart,
34
+ attributes: {
35
+ product_id: 'product-1',
36
+ },
37
+ });
38
+
39
+ expect(result?.category).toBe(UserEventCategory.AddToCart);
40
+ });
41
+ });
@@ -48,6 +48,7 @@ export const validateResponse = (data: unknown): Response | undefined => {
48
48
  category: ResponseCategory.Product,
49
49
  attributes: {
50
50
  id: data.attributes.id,
51
+ itemGroupId: data.attributes.item_group_id,
51
52
  description: data.attributes.description,
52
53
  imageUrl: data.attributes.image_url,
53
54
  imageUrls: data.attributes.image_urls,
@@ -16,11 +16,16 @@ export const validateUserEvent = (data: unknown): UserEvent | undefined => {
16
16
  return undefined;
17
17
  }
18
18
 
19
- if (data.category === UserEventCategory.PdpVisit && isApiPDPAttributes(data.attributes)) {
19
+ // PdpVisit and AddToCart share the same attributes structure
20
+ if (
21
+ (data.category === UserEventCategory.PdpVisit ||
22
+ data.category === UserEventCategory.AddToCart) &&
23
+ isApiPDPAttributes(data.attributes)
24
+ ) {
20
25
  return {
21
26
  eventId: data.event_id,
22
27
  createdAt: data.created_at,
23
- category: UserEventCategory.PdpVisit,
28
+ category: data.category,
24
29
  attributes: {
25
30
  productId: data.attributes.product_id,
26
31
  parentProductId: data.attributes.parent_product_id,
@@ -0,0 +1,109 @@
1
+ import { UserEventCategory } from '@spiffy-ai/commerce-api-client';
2
+ import { MessageRole, MessageType, UserEvent } from 'src/application/models';
3
+ import { messageFromAddToCartEvent } from '../messageFromAddToCartEvent';
4
+
5
+ describe('messageFromAddToCartEvent', () => {
6
+ it('builds a user message from an AddToCart event', () => {
7
+ const event: UserEvent = {
8
+ eventId: 'event-1',
9
+ createdAt: '2026-07-20T00:00:00.000Z',
10
+ category: UserEventCategory.AddToCart,
11
+ attributes: {
12
+ productId: 'product-1',
13
+ parentProductId: '',
14
+ url: '',
15
+ },
16
+ };
17
+
18
+ expect(messageFromAddToCartEvent(event)).toEqual({
19
+ id: 'event-1',
20
+ role: MessageRole.User,
21
+ type: MessageType.QueryTyped,
22
+ createdAt: '2026-07-20T00:00:00.000Z',
23
+ metadata: {
24
+ content: 'Add product-1 to my cart',
25
+ },
26
+ });
27
+ });
28
+
29
+ it('returns undefined for a non-AddToCart event', () => {
30
+ const event: UserEvent = {
31
+ eventId: 'event-1',
32
+ createdAt: '2026-07-20T00:00:00.000Z',
33
+ category: UserEventCategory.AppLoaded,
34
+ };
35
+
36
+ expect(messageFromAddToCartEvent(event)).toBeUndefined();
37
+ });
38
+
39
+ it('prefers the explicit productTitle override parameter', () => {
40
+ const event: UserEvent = {
41
+ eventId: 'event-1',
42
+ createdAt: '2026-07-20T00:00:00.000Z',
43
+ category: UserEventCategory.AddToCart,
44
+ attributes: {
45
+ productId: 'product-1',
46
+ parentProductId: '',
47
+ url: '',
48
+ productTitle: 'Attribute Title',
49
+ },
50
+ };
51
+
52
+ expect(messageFromAddToCartEvent(event, 'Override Title')).toEqual({
53
+ id: 'event-1',
54
+ role: MessageRole.User,
55
+ type: MessageType.QueryTyped,
56
+ createdAt: '2026-07-20T00:00:00.000Z',
57
+ metadata: {
58
+ content: 'Add Override Title to my cart',
59
+ },
60
+ });
61
+ });
62
+
63
+ it('falls back to event.attributes.productTitle when no override is passed', () => {
64
+ const event: UserEvent = {
65
+ eventId: 'event-1',
66
+ createdAt: '2026-07-20T00:00:00.000Z',
67
+ category: UserEventCategory.AddToCart,
68
+ attributes: {
69
+ productId: 'product-1',
70
+ parentProductId: '',
71
+ url: '',
72
+ productTitle: 'Attribute Title',
73
+ },
74
+ };
75
+
76
+ expect(messageFromAddToCartEvent(event)).toEqual({
77
+ id: 'event-1',
78
+ role: MessageRole.User,
79
+ type: MessageType.QueryTyped,
80
+ createdAt: '2026-07-20T00:00:00.000Z',
81
+ metadata: {
82
+ content: 'Add Attribute Title to my cart',
83
+ },
84
+ });
85
+ });
86
+
87
+ it('falls back to the raw productId when neither a title override nor an attribute title is present', () => {
88
+ const event: UserEvent = {
89
+ eventId: 'event-1',
90
+ createdAt: '2026-07-20T00:00:00.000Z',
91
+ category: UserEventCategory.AddToCart,
92
+ attributes: {
93
+ productId: 'product-1',
94
+ parentProductId: '',
95
+ url: '',
96
+ },
97
+ };
98
+
99
+ expect(messageFromAddToCartEvent(event)).toEqual({
100
+ id: 'event-1',
101
+ role: MessageRole.User,
102
+ type: MessageType.QueryTyped,
103
+ createdAt: '2026-07-20T00:00:00.000Z',
104
+ metadata: {
105
+ content: 'Add product-1 to my cart',
106
+ },
107
+ });
108
+ });
109
+ });
@@ -6,6 +6,7 @@ export * from './divideArray';
6
6
  export * from './domObserver';
7
7
  export * from './elementObserver';
8
8
  export * from './imageFilter';
9
+ export * from './messageFromAddToCartEvent';
9
10
  export * from './messageFromFormSubmittedEvent';
10
11
  export * from './messageFromQueryEvent';
11
12
  export * from './messageFromResponse';
@@ -0,0 +1,32 @@
1
+ import { UserEventCategory } from '@spiffy-ai/commerce-api-client';
2
+ import { Message, MessageRole, MessageType, UserEvent } from 'src/application/models';
3
+
4
+ /**
5
+ * Transforms an AddToCart UserEvent object into a Message object for presentation.
6
+ *
7
+ * @param event The user event object received from the server
8
+ * @param productTitle Resolved product title to display instead of the raw
9
+ * productId. Falls back to `event.attributes.productTitle` (set on freshly
10
+ * created, not-yet-serialized events) and finally to the productId itself.
11
+ *
12
+ * @returns A Message if the event is an AddToCart event, otherwise undefined
13
+ */
14
+ export const messageFromAddToCartEvent = (
15
+ event: UserEvent,
16
+ productTitle?: string,
17
+ ): Message | undefined => {
18
+ if (event.category === UserEventCategory.AddToCart) {
19
+ const label = productTitle ?? event.attributes.productTitle ?? event.attributes.productId;
20
+ return {
21
+ id: event.eventId,
22
+ role: MessageRole.User,
23
+ type: MessageType.QueryTyped,
24
+ createdAt: event.createdAt,
25
+ metadata: {
26
+ content: `Add ${label} to my cart`,
27
+ },
28
+ };
29
+ }
30
+
31
+ return undefined;
32
+ };
@@ -29,4 +29,5 @@ export const apiWidgetTextResponseToCoreWidgetText = (
29
29
  value.map(apiWidgetStringToCoreWidgetString),
30
30
  ]),
31
31
  ),
32
+ aiSuggestionsAttributionBySlot: apiWidgetTextResponse.ai_suggestions_attribution_by_slot,
32
33
  });
@@ -2,7 +2,7 @@ import { ContextEnvEnum, ContextSourceEnum } from '@spiffy-ai/commerce-api-clien
2
2
  import { atom } from 'jotai';
3
3
  import { atomWithStorage } from 'jotai/utils';
4
4
  import { VariantInfo } from 'src/application/models';
5
- import { UserIdentityContextType } from 'src/contexts/userIdentityContext/userIdentityContext';
5
+ import type { UserIdentityContextType } from 'src/contexts/userIdentityContext/userIdentityContext';
6
6
  import { v4 as uuid } from 'uuid';
7
7
  import { contextSourceAtom, envAtom, orgIdAtom, orgShortNameAtom } from '../envive/enviveConfig';
8
8
 
@@ -255,7 +255,7 @@ const getPageVisitContext = (pageVisitCategory: PageVisitCategory | undefined) =
255
255
  }
256
256
  if (pageVisitCategory === PageVisitCategory.FullPage) {
257
257
  return {
258
- page_type: 'full_page',
258
+ page_type: 'adaptive_storefront',
259
259
  page_id: window.location.href,
260
260
  };
261
261
  }
@@ -2,7 +2,7 @@ import Logger from 'src/application/logging/logger';
2
2
  import { atom } from 'jotai';
3
3
  import { EnviveConfig } from 'src/contexts/types';
4
4
  import { ContextSourceEnum } from '@spiffy-ai/commerce-api-client';
5
- import { LocalStorageKeys } from 'src/contexts/localStorageContext';
5
+ import { LocalStorageKeys } from 'src/contexts/localStorageContext/localStorageKeys';
6
6
 
7
7
  const logger = new Logger('enviveConfig');
8
8
 
@@ -49,6 +49,11 @@ export const orgIdAtom = atom(get => {
49
49
  return config?.orgId;
50
50
  });
51
51
 
52
+ export const addToCartCallbackAtom = atom(get => {
53
+ const config = get(enviveConfigAtom);
54
+ return config?.addToCart;
55
+ });
56
+
52
57
  export const contextSourceAtom = atom(get => {
53
58
  const config = get(enviveConfigAtom);
54
59
 
@@ -1,7 +1,7 @@
1
1
  import { atom } from 'jotai';
2
2
  import { ColorMapping } from 'src/application/models/colorsConfig';
3
3
  import { FrontendConfig } from 'src/application/models/frontendConfig';
4
- import { FeatureFlagContextType } from 'src/contexts/featureFlagServiceContext/featureFlagServiceContext'; // Import FeatureFlagContextType from new context
4
+ import type { FeatureFlagContextType } from 'src/contexts/featureFlagServiceContext/featureFlagServiceContext';
5
5
 
6
6
  export const internalGraphQLColorsConfigAtom = atom<ColorMapping | undefined>(undefined);
7
7
  const internalGraphQLFrontendConfigAtom = atom<FrontendConfig | undefined>(undefined);
@@ -3,6 +3,7 @@ import { useSetAtom } from 'jotai';
3
3
  import { enviveConfigAtom } from 'src/atoms/envive/enviveConfig';
4
4
  import Logger from 'src/application/logging/logger';
5
5
  import { OrgConfigFeatureGate } from 'src/application/models';
6
+ import { AddToCartCallback } from 'src/types/enviveConfig';
6
7
 
7
8
  const logger = new Logger('enviveConfigContext');
8
9
 
@@ -24,6 +25,7 @@ interface EnviveConfigProviderProps {
24
25
  publicKey?: string;
25
26
  featureOverrides?: Record<string, boolean>;
26
27
  featureGates?: OrgConfigFeatureGate[];
28
+ addToCart?: AddToCartCallback;
27
29
  }
28
30
 
29
31
  export const EnviveConfigProvider: React.FC<EnviveConfigProviderProps> = ({
@@ -44,6 +46,7 @@ export const EnviveConfigProvider: React.FC<EnviveConfigProviderProps> = ({
44
46
  publicKey,
45
47
  featureOverrides,
46
48
  featureGates,
49
+ addToCart,
47
50
  }) => {
48
51
  const setEnviveConfig = useSetAtom(enviveConfigAtom);
49
52
 
@@ -65,6 +68,7 @@ export const EnviveConfigProvider: React.FC<EnviveConfigProviderProps> = ({
65
68
  publicKey,
66
69
  featureOverrides,
67
70
  featureGates,
71
+ addToCart,
68
72
  }),
69
73
  [
70
74
  identifyingPrefix,
@@ -83,6 +87,7 @@ export const EnviveConfigProvider: React.FC<EnviveConfigProviderProps> = ({
83
87
  publicKey,
84
88
  featureOverrides,
85
89
  featureGates,
90
+ addToCart,
86
91
  ],
87
92
  );
88
93
 
@@ -7,6 +7,7 @@ import { resolvedBaseConfigVersionAtom } from 'src/atoms/envive/resolvedBaseConf
7
7
  import { IHardcopyService } from 'src/services/hardcopyService';
8
8
  import { IUserIdentityService } from 'src/services/userIdentityService';
9
9
  import Logger from 'src/application/logging/logger';
10
+ import { AddToCartCallback } from 'src/types/enviveConfig';
10
11
  import { AmplitudeProvider } from '../amplitudeContext';
11
12
  import { EnviveConfigProvider } from '../enviveConfigContext';
12
13
  import { EnviveCssProvider } from '../enviveCssContext';
@@ -51,8 +52,11 @@ interface EnviveProviderProps extends AgentWrapperProps {
51
52
  enviveOn?: boolean;
52
53
  cdnUrl?: string;
53
54
  reactAppName?: string;
55
+ env?: string;
56
+ contextSource?: string;
54
57
  previewMode?: boolean;
55
58
  mockSalesAgentData?: any;
59
+ addToCart?: AddToCartCallback;
56
60
  }
57
61
 
58
62
  const SearchAgentWrapper: React.FC<AgentWrapperProps> = ({ children, enabledAgents }) => {
@@ -100,7 +104,10 @@ export const EnviveProvider: React.FC<EnviveProviderProps> = ({
100
104
  enviveOn,
101
105
  cdnUrl,
102
106
  reactAppName,
107
+ env,
108
+ contextSource,
103
109
  identifyingPrefix,
110
+ addToCart,
104
111
  }) => {
105
112
  const { extensionService } = services;
106
113
  const [enviveServiceConfig, setEnviveServiceConfig] = useState<EnviveServiceConfig | null>(null);
@@ -196,6 +203,9 @@ export const EnviveProvider: React.FC<EnviveProviderProps> = ({
196
203
  enviveOn={enviveOn}
197
204
  cdnUrl={cdnUrl}
198
205
  reactAppName={reactAppName}
206
+ env={env}
207
+ contextSource={contextSource}
208
+ addToCart={addToCart}
199
209
  >
200
210
  <NewOrgConfigProvider config={enviveServiceConfig.orgConfig ?? {}}>
201
211
  <LocalStorageProvider>