@envive-ai/react-hooks 0.3.6 → 0.3.8

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 (427) hide show
  1. package/dist/application/commerce-api.cjs +2 -2
  2. package/dist/application/commerce-api.js +2 -2
  3. package/dist/application/models/api/userEvent.d.cts +4 -2
  4. package/dist/application/models/api/userEvent.d.ts +4 -2
  5. package/dist/application/models/chatElementDisplayLocationV3.cjs +3 -1
  6. package/dist/application/models/chatElementDisplayLocationV3.d.cts +3 -1
  7. package/dist/application/models/chatElementDisplayLocationV3.d.ts +3 -1
  8. package/dist/application/models/chatElementDisplayLocationV3.js +3 -1
  9. package/dist/application/models/frontendConfigV3.d.cts +2 -2
  10. package/dist/application/models/frontendConfigV3.d.ts +2 -2
  11. package/dist/application/models/graphql/queries/getColorsAndFrontendQuery.cjs +18 -0
  12. package/dist/application/models/graphql/queries/getColorsAndFrontendQuery.js +18 -0
  13. package/dist/application/models/guards/api/isApiFormResponse.cjs +1 -1
  14. package/dist/application/models/guards/api/isApiFormResponse.js +1 -1
  15. package/dist/application/models/guards/api/isApiFormSubmittedResponseAttributes.cjs +1 -1
  16. package/dist/application/models/guards/api/isApiFormSubmittedResponseAttributes.js +1 -1
  17. package/dist/application/models/guards/api/isApiOrderResponseAttributes.cjs +1 -1
  18. package/dist/application/models/guards/api/isApiOrderResponseAttributes.js +1 -1
  19. package/dist/application/models/guards/api/isApiProductResponseAttributes.cjs +1 -1
  20. package/dist/application/models/guards/api/isApiProductResponseAttributes.js +1 -1
  21. package/dist/application/models/guards/api/isApiQueryTypedEventAttributes.cjs +2 -2
  22. package/dist/application/models/guards/api/isApiQueryTypedEventAttributes.js +2 -2
  23. package/dist/application/models/guards/api/isApiResponse.cjs +1 -1
  24. package/dist/application/models/guards/api/isApiResponse.js +1 -1
  25. package/dist/application/utils/analyticsUtils.cjs +1 -1
  26. package/dist/application/utils/analyticsUtils.js +1 -1
  27. package/dist/application/utils/elementObserver.d.cts +2 -2
  28. package/dist/application/utils/elementObserver.d.ts +2 -2
  29. package/dist/application/utils/widgetTextRequestToApiRequest.cjs +5 -2
  30. package/dist/application/utils/widgetTextRequestToApiRequest.js +5 -2
  31. package/dist/atoms/app/index.cjs +4 -4
  32. package/dist/atoms/app/index.d.cts +7 -7
  33. package/dist/atoms/app/index.d.ts +7 -7
  34. package/dist/atoms/app/index.js +4 -4
  35. package/dist/atoms/chat/chatState.d.cts +18 -18
  36. package/dist/atoms/chat/chatState.d.ts +17 -17
  37. package/dist/atoms/chat/form.d.cts +2 -2
  38. package/dist/atoms/chat/form.d.ts +2 -2
  39. package/dist/atoms/chat/index.cjs +1 -3
  40. package/dist/atoms/chat/index.d.cts +4 -5
  41. package/dist/atoms/chat/index.d.ts +4 -5
  42. package/dist/atoms/chat/index.js +2 -3
  43. package/dist/atoms/chat/lastMessage.d.cts +2 -2
  44. package/dist/atoms/chat/lastMessage.d.ts +2 -2
  45. package/dist/atoms/chat/performanceMetrics.d.cts +6 -6
  46. package/dist/atoms/chat/performanceMetrics.d.ts +6 -6
  47. package/dist/atoms/chat/renderedWidgetRefs.d.cts +2 -2
  48. package/dist/atoms/chat/renderedWidgetRefs.d.ts +2 -2
  49. package/dist/atoms/chat/replies.cjs +1 -1
  50. package/dist/atoms/chat/replies.d.cts +1 -1
  51. package/dist/atoms/chat/replies.d.ts +3 -3
  52. package/dist/atoms/chat/replies.js +1 -1
  53. package/dist/atoms/chat/suggestions.d.cts +2 -2
  54. package/dist/atoms/chat/suggestions.d.ts +2 -2
  55. package/dist/atoms/globalSearch/globalSearch.d.cts +5 -5
  56. package/dist/atoms/org/customerService.d.cts +6 -6
  57. package/dist/atoms/org/customerService.d.ts +6 -6
  58. package/dist/atoms/org/graphqlConfig.d.cts +4 -4
  59. package/dist/atoms/org/graphqlConfig.d.ts +4 -4
  60. package/dist/atoms/org/index.cjs +2 -2
  61. package/dist/atoms/org/index.js +2 -2
  62. package/dist/atoms/org/newOrgConfigAtom.d.cts +2 -2
  63. package/dist/atoms/org/newOrgConfigAtom.d.ts +2 -2
  64. package/dist/atoms/org/orgAnalyticsConfig.d.cts +5 -5
  65. package/dist/atoms/org/orgAnalyticsConfig.d.ts +5 -5
  66. package/dist/atoms/search/chatSearch.cjs +1 -1
  67. package/dist/atoms/search/chatSearch.d.cts +17 -17
  68. package/dist/atoms/search/chatSearch.d.ts +17 -17
  69. package/dist/atoms/search/chatSearch.js +1 -1
  70. package/dist/atoms/search/searchAPI.cjs +1 -1
  71. package/dist/atoms/search/searchAPI.d.cts +13 -13
  72. package/dist/atoms/search/searchAPI.d.ts +13 -13
  73. package/dist/atoms/search/searchAPI.js +1 -1
  74. package/dist/atoms/widget/chatPreviewLoading.d.cts +2 -2
  75. package/dist/contexts/amplitudeContext/amplitudeContext.cjs +6 -4
  76. package/dist/contexts/amplitudeContext/amplitudeContext.js +6 -4
  77. package/dist/contexts/enviveContext/enviveContext.cjs +38 -16
  78. package/dist/contexts/enviveContext/enviveContext.d.cts +4 -1
  79. package/dist/contexts/enviveContext/enviveContext.d.ts +4 -1
  80. package/dist/contexts/enviveContext/enviveContext.js +38 -16
  81. package/dist/contexts/enviveContext/types.d.cts +1 -1
  82. package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.cjs +57 -3
  83. package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.cts +6 -1
  84. package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +6 -1
  85. package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.js +57 -3
  86. package/dist/contexts/graphqlContext/graphqlContext.cjs +48 -28
  87. package/dist/contexts/graphqlContext/graphqlContext.js +49 -28
  88. package/dist/contexts/graphqlContext/mockV3Config.cjs +62 -49
  89. package/dist/contexts/graphqlContext/mockV3Config.js +21 -8
  90. package/dist/contexts/hardcopyContext/hardcopyContext.cjs +29 -1
  91. package/dist/contexts/hardcopyContext/hardcopyContext.js +29 -1
  92. package/dist/contexts/newOrgConfigContext/newOrgConfigContext.cjs +2 -3
  93. package/dist/contexts/newOrgConfigContext/newOrgConfigContext.js +2 -3
  94. package/dist/contexts/salesAgentContext/chatAPI.cjs +56 -7
  95. package/dist/contexts/salesAgentContext/chatAPI.d.cts +10 -6
  96. package/dist/contexts/salesAgentContext/chatAPI.d.ts +10 -6
  97. package/dist/contexts/salesAgentContext/chatAPI.js +56 -7
  98. package/dist/contexts/salesAgentContext/formSubmittedUtils.cjs +37 -0
  99. package/dist/contexts/salesAgentContext/formSubmittedUtils.js +36 -0
  100. package/dist/contexts/salesAgentContext/index.d.cts +2 -2
  101. package/dist/contexts/salesAgentContext/index.d.ts +2 -2
  102. package/dist/contexts/salesAgentContext/salesAgentContext.cjs +36 -10
  103. package/dist/contexts/salesAgentContext/salesAgentContext.d.cts +11 -4
  104. package/dist/contexts/salesAgentContext/salesAgentContext.d.ts +11 -4
  105. package/dist/contexts/salesAgentContext/salesAgentContext.js +36 -10
  106. package/dist/contexts/salesAgentContext/salesAgentService.cjs +50 -19
  107. package/dist/contexts/salesAgentContext/salesAgentService.js +50 -19
  108. package/dist/contexts/searchContext/searchContext.cjs +1 -1
  109. package/dist/contexts/searchContext/searchContext.js +1 -1
  110. package/dist/contexts/systemSettingsContext/systemSettingsContext.d.cts +2 -2
  111. package/dist/contexts/systemSettingsContext/systemSettingsContext.d.ts +2 -2
  112. package/dist/contexts/types.d.cts +1 -1
  113. package/dist/contexts/types.d.ts +1 -1
  114. package/dist/contexts/typesV3.cjs +2 -7
  115. package/dist/contexts/typesV3.d.cts +14 -11
  116. package/dist/contexts/typesV3.d.ts +14 -11
  117. package/dist/contexts/typesV3.js +3 -7
  118. package/dist/contexts/userIdentityContext/userIdentityContext.cjs +22 -30
  119. package/dist/contexts/userIdentityContext/userIdentityContext.d.cts +9 -8
  120. package/dist/contexts/userIdentityContext/userIdentityContext.d.ts +9 -8
  121. package/dist/contexts/userIdentityContext/userIdentityContext.js +22 -30
  122. package/dist/hooks/ElementObserver/useElementObserver.cjs +3 -2
  123. package/dist/hooks/ElementObserver/useElementObserver.js +3 -2
  124. package/dist/hooks/GrabAndScroll/useGrabAndScroll.d.cts +2 -2
  125. package/dist/hooks/GrabAndScroll/useGrabAndScroll.d.ts +2 -2
  126. package/dist/hooks/GraphQLConfig/useGraphQLConfig.cjs +1 -2
  127. package/dist/hooks/GraphQLConfig/useGraphQLConfig.js +1 -2
  128. package/dist/hooks/Search/useSearch.cjs +2 -2
  129. package/dist/hooks/Search/useSearch.js +2 -2
  130. package/dist/hooks/Search/useSearchInput.cjs +1 -1
  131. package/dist/hooks/Search/useSearchInput.js +1 -1
  132. package/dist/hooks/utils.d.cts +1 -1
  133. package/dist/hooks/utils.d.ts +1 -1
  134. package/dist/mocks/index.cjs +5 -0
  135. package/dist/mocks/index.d.cts +2 -0
  136. package/dist/mocks/index.d.ts +2 -0
  137. package/dist/mocks/index.js +3 -0
  138. package/dist/mocks/salesAgentMockData.cjs +207 -0
  139. package/dist/mocks/salesAgentMockData.d.cts +11 -0
  140. package/dist/mocks/salesAgentMockData.d.ts +11 -0
  141. package/dist/mocks/salesAgentMockData.js +204 -0
  142. package/dist/packages/components-v3/dist/ChatHeader/components/CloseButton.cjs +2 -2
  143. package/dist/packages/components-v3/dist/ChatHeader/components/CloseButton.js +2 -2
  144. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetCloseButtonProperties.cjs +2 -2
  145. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetCloseButtonProperties.js +2 -2
  146. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetHandleProperties.cjs +18 -18
  147. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetHandleProperties.js +18 -18
  148. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetLayoutProperties.cjs +1 -1
  149. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetLayoutProperties.js +1 -1
  150. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetToggleProperties.cjs +4 -4
  151. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetToggleProperties.js +4 -4
  152. package/dist/packages/components-v3/dist/ChatPreviewLoading/components/Skeleton.cjs +1 -0
  153. package/dist/packages/components-v3/dist/ChatPreviewLoading/components/Skeleton.js +3 -0
  154. package/dist/packages/components-v3/dist/Container/Container.cjs +19 -3
  155. package/dist/packages/components-v3/dist/Container/Container.js +19 -4
  156. package/dist/packages/components-v3/dist/Container/hooks/useGetCenterContentProperties.cjs +13 -0
  157. package/dist/packages/components-v3/dist/Container/hooks/useGetCenterContentProperties.js +11 -1
  158. package/dist/packages/components-v3/dist/Container/hooks/useGetFluidProperties.cjs +13 -0
  159. package/dist/packages/components-v3/dist/Container/hooks/useGetFluidProperties.js +11 -1
  160. package/dist/packages/components-v3/dist/Container/index.cjs +1 -1
  161. package/dist/packages/components-v3/dist/Container/index.js +1 -1
  162. package/dist/packages/components-v3/dist/DesignTokens/components/utils.cjs +16 -0
  163. package/dist/packages/components-v3/dist/DesignTokens/components/utils.js +15 -0
  164. package/dist/packages/components-v3/dist/FloatingButton/FloatingButton.cjs +2 -0
  165. package/dist/packages/components-v3/dist/FloatingButton/FloatingButton.js +4 -0
  166. package/dist/packages/components-v3/dist/FloatingButton/components/Button.cjs +9 -0
  167. package/dist/packages/components-v3/dist/FloatingButton/components/Button.js +10 -0
  168. package/dist/packages/components-v3/dist/FloatingButton/components/Container.cjs +9 -0
  169. package/dist/packages/components-v3/dist/FloatingButton/components/Container.js +10 -0
  170. package/dist/packages/components-v3/dist/FloatingButton/components/Icon.cjs +3 -0
  171. package/dist/packages/components-v3/dist/FloatingButton/components/Icon.js +5 -0
  172. package/dist/packages/components-v3/dist/FloatingButton/components/Wrapper.cjs +9 -0
  173. package/dist/packages/components-v3/dist/FloatingButton/components/Wrapper.js +10 -0
  174. package/dist/packages/components-v3/dist/FloatingButton/components/index.cjs +4 -0
  175. package/dist/packages/components-v3/dist/FloatingButton/components/index.js +6 -0
  176. package/dist/packages/components-v3/dist/FloatingButton/index.cjs +2 -0
  177. package/dist/packages/components-v3/dist/FloatingButton/index.js +4 -0
  178. package/dist/packages/components-v3/dist/FloatingButton/types/types.cjs +17 -0
  179. package/dist/packages/components-v3/dist/FloatingButton/types/types.js +16 -0
  180. package/dist/packages/components-v3/dist/ImageGallery/components/Layout.cjs +3 -3
  181. package/dist/packages/components-v3/dist/ImageGallery/components/Layout.js +3 -3
  182. package/dist/packages/components-v3/dist/PromptButton/PromptButton.cjs +40 -4
  183. package/dist/packages/components-v3/dist/PromptButton/PromptButton.js +40 -5
  184. package/dist/packages/components-v3/dist/PromptButton/components/Icon.cjs +10 -0
  185. package/dist/packages/components-v3/dist/PromptButton/components/Icon.js +8 -1
  186. package/dist/packages/components-v3/dist/PromptButton/components/Label.cjs +18 -1
  187. package/dist/packages/components-v3/dist/PromptButton/components/Label.js +16 -2
  188. package/dist/packages/components-v3/dist/PromptButton/components/Layout.cjs +31 -3
  189. package/dist/packages/components-v3/dist/PromptButton/components/Layout.js +31 -4
  190. package/dist/packages/components-v3/dist/PromptButton/components/Loading.cjs +5 -1
  191. package/dist/packages/components-v3/dist/PromptButton/components/Loading.js +5 -2
  192. package/dist/packages/components-v3/dist/PromptButton/components/index.cjs +16 -4
  193. package/dist/packages/components-v3/dist/PromptButton/components/index.js +15 -5
  194. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBackgroundColorsProperties.cjs +18 -0
  195. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBackgroundColorsProperties.js +18 -0
  196. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBoldTextProperties.cjs +12 -0
  197. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBoldTextProperties.js +10 -1
  198. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBorderColorsProperties.cjs +18 -0
  199. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBorderColorsProperties.js +18 -0
  200. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetIconColorsProperties.cjs +32 -0
  201. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetIconColorsProperties.js +32 -0
  202. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetLayoutBaseProperties.cjs +9 -1
  203. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetLayoutBaseProperties.js +9 -2
  204. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetTextColorsProperties.cjs +19 -0
  205. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetTextColorsProperties.js +19 -0
  206. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetVariantColorsProperties.cjs +29 -0
  207. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetVariantColorsProperties.js +29 -0
  208. package/dist/packages/components-v3/dist/PromptButton/index.cjs +1 -1
  209. package/dist/packages/components-v3/dist/PromptButton/index.js +1 -1
  210. package/dist/packages/components-v3/dist/PromptButton/utils/functions.cjs +10 -0
  211. package/dist/packages/components-v3/dist/PromptButton/utils/functions.js +10 -0
  212. package/dist/packages/components-v3/dist/PromptCarousel/hooks/useCarouselRefs.js +1 -1
  213. package/dist/packages/components-v3/dist/SocialProof/SocialProof.cjs +10 -0
  214. package/dist/packages/components-v3/dist/SocialProof/SocialProof.js +12 -0
  215. package/dist/packages/components-v3/dist/SocialProof/components/Headline.cjs +53 -0
  216. package/dist/packages/components-v3/dist/SocialProof/components/Headline.js +54 -0
  217. package/dist/packages/components-v3/dist/SocialProof/components/ImageGallery.cjs +5 -0
  218. package/dist/packages/components-v3/dist/SocialProof/components/ImageGallery.js +7 -0
  219. package/dist/packages/components-v3/dist/SocialProof/components/LayoutFourGrid.cjs +6 -0
  220. package/dist/packages/components-v3/dist/SocialProof/components/LayoutFourGrid.js +8 -0
  221. package/dist/packages/components-v3/dist/SocialProof/components/LayoutFourHorizontal.cjs +16 -0
  222. package/dist/packages/components-v3/dist/SocialProof/components/LayoutFourHorizontal.js +17 -0
  223. package/dist/packages/components-v3/dist/SocialProof/components/LayoutSingle.cjs +8 -0
  224. package/dist/packages/components-v3/dist/SocialProof/components/LayoutSingle.js +10 -0
  225. package/dist/packages/components-v3/dist/SocialProof/components/Skeleton.cjs +1 -0
  226. package/dist/packages/components-v3/dist/SocialProof/components/Skeleton.js +3 -0
  227. package/dist/packages/components-v3/dist/SocialProof/components/Subheadline.cjs +8 -0
  228. package/dist/packages/components-v3/dist/SocialProof/components/Subheadline.js +10 -0
  229. package/dist/packages/components-v3/dist/SocialProof/components/Textfield.cjs +3 -0
  230. package/dist/packages/components-v3/dist/SocialProof/components/Textfield.js +5 -0
  231. package/dist/packages/components-v3/dist/SocialProof/components/index.cjs +8 -0
  232. package/dist/packages/components-v3/dist/SocialProof/components/index.js +10 -0
  233. package/dist/packages/components-v3/dist/SocialProof/hooks/index.cjs +1 -0
  234. package/dist/packages/components-v3/dist/SocialProof/hooks/index.js +3 -0
  235. package/dist/packages/components-v3/dist/SocialProof/hooks/useSocialProofCount.cjs +1 -0
  236. package/dist/packages/components-v3/dist/SocialProof/hooks/useSocialProofCount.js +3 -0
  237. package/dist/packages/components-v3/dist/SocialProof/index.cjs +4 -0
  238. package/dist/packages/components-v3/dist/SocialProof/index.js +6 -0
  239. package/dist/packages/components-v3/dist/SocialProof/types/types.cjs +11 -0
  240. package/dist/packages/components-v3/dist/SocialProof/types/types.js +10 -0
  241. package/dist/packages/components-v3/dist/SocialProof/utils/functions.cjs +1 -0
  242. package/dist/packages/components-v3/dist/SocialProof/utils/functions.js +3 -0
  243. package/dist/packages/components-v3/dist/Title/Title.cjs +11 -0
  244. package/dist/packages/components-v3/dist/Title/Title.js +12 -0
  245. package/dist/packages/components-v3/dist/Title/components/Image.cjs +2 -0
  246. package/dist/packages/components-v3/dist/Title/components/Image.js +4 -0
  247. package/dist/packages/components-v3/dist/Title/components/Label.cjs +3 -0
  248. package/dist/packages/components-v3/dist/Title/components/Label.js +5 -0
  249. package/dist/packages/components-v3/dist/Title/components/Layout.cjs +11 -0
  250. package/dist/packages/components-v3/dist/Title/components/Layout.js +12 -0
  251. package/dist/packages/components-v3/dist/Title/components/index.cjs +3 -0
  252. package/dist/packages/components-v3/dist/Title/components/index.js +5 -0
  253. package/dist/packages/components-v3/dist/Title/index.cjs +1 -0
  254. package/dist/packages/components-v3/dist/Title/index.js +3 -0
  255. package/dist/packages/components-v3/dist/Tokens/index.cjs +11 -11
  256. package/dist/packages/components-v3/dist/Tokens/index.js +11 -11
  257. package/dist/packages/components-v3/dist/Typography/Typography.cjs +35 -7
  258. package/dist/packages/components-v3/dist/Typography/Typography.js +35 -8
  259. package/dist/packages/components-v3/dist/Typography/hooks/useGetAccessibilityAttributes.cjs +30 -0
  260. package/dist/packages/components-v3/dist/Typography/hooks/useGetAccessibilityAttributes.js +28 -1
  261. package/dist/packages/components-v3/dist/Typography/hooks/useGetAlignProperties.cjs +19 -0
  262. package/dist/packages/components-v3/dist/Typography/hooks/useGetAlignProperties.js +17 -1
  263. package/dist/packages/components-v3/dist/Typography/hooks/useGetColorProperties.cjs +20 -0
  264. package/dist/packages/components-v3/dist/Typography/hooks/useGetColorProperties.js +18 -1
  265. package/dist/packages/components-v3/dist/Typography/hooks/useGetNoWrapProperties.cjs +12 -0
  266. package/dist/packages/components-v3/dist/Typography/hooks/useGetNoWrapProperties.js +10 -1
  267. package/dist/packages/components-v3/dist/Typography/hooks/useGetNumberOfLinesProperties.cjs +21 -0
  268. package/dist/packages/components-v3/dist/Typography/hooks/useGetNumberOfLinesProperties.js +19 -1
  269. package/dist/packages/components-v3/dist/Typography/hooks/useGetVariantProperties.cjs +61 -0
  270. package/dist/packages/components-v3/dist/Typography/hooks/useGetVariantProperties.js +59 -1
  271. package/dist/packages/components-v3/dist/Typography/index.cjs +2 -1
  272. package/dist/packages/components-v3/dist/Typography/index.js +2 -1
  273. package/dist/packages/components-v3/dist/Typography/types/index.cjs +47 -0
  274. package/dist/packages/components-v3/dist/Typography/types/index.js +44 -0
  275. package/dist/packages/components-v3/dist/Typography/utils/utils.cjs +12 -0
  276. package/dist/packages/components-v3/dist/Typography/utils/utils.js +10 -0
  277. package/dist/packages/components-v3/dist/WelcomeMessage/components/Container.cjs +1 -1
  278. package/dist/packages/components-v3/dist/WelcomeMessage/components/Container.js +1 -1
  279. package/dist/packages/components-v3/dist/WelcomeMessage/components/SparkleIcon.cjs +1 -1
  280. package/dist/packages/components-v3/dist/WelcomeMessage/components/SparkleIcon.js +1 -1
  281. package/dist/packages/components-v3/dist/WelcomeMessage/types/types.cjs +2 -2
  282. package/dist/packages/components-v3/dist/WelcomeMessage/types/types.js +2 -2
  283. package/dist/packages/components-v3/dist/WidgetTextField/WidgetTextField.cjs +2 -0
  284. package/dist/packages/components-v3/dist/WidgetTextField/WidgetTextField.js +4 -0
  285. package/dist/packages/components-v3/dist/WidgetTextField/components/Container.cjs +14 -0
  286. package/dist/packages/components-v3/dist/WidgetTextField/components/Container.js +15 -0
  287. package/dist/packages/components-v3/dist/WidgetTextField/components/FakeTextInput.cjs +3 -0
  288. package/dist/packages/components-v3/dist/WidgetTextField/components/FakeTextInput.js +5 -0
  289. package/dist/packages/components-v3/dist/WidgetTextField/components/Icon.cjs +7 -0
  290. package/dist/packages/components-v3/dist/WidgetTextField/components/Icon.js +9 -0
  291. package/dist/packages/components-v3/dist/WidgetTextField/components/Skeleton.cjs +10 -0
  292. package/dist/packages/components-v3/dist/WidgetTextField/components/Skeleton.js +11 -0
  293. package/dist/packages/components-v3/dist/WidgetTextField/components/index.cjs +4 -0
  294. package/dist/packages/components-v3/dist/WidgetTextField/components/index.js +6 -0
  295. package/dist/packages/components-v3/dist/WidgetTextField/hooks/useGetContainerProperties.cjs +1 -0
  296. package/dist/packages/components-v3/dist/WidgetTextField/hooks/useGetContainerProperties.js +3 -0
  297. package/dist/packages/components-v3/dist/WidgetTextField/index.cjs +1 -0
  298. package/dist/packages/components-v3/dist/WidgetTextField/index.js +3 -0
  299. package/dist/packages/components-v3/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.cjs +8 -0
  300. package/dist/packages/components-v3/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.js +10 -0
  301. package/dist/packages/components-v3/dist/packages/components-v3/src/models/colorsConfig.cjs +26 -0
  302. package/dist/packages/components-v3/dist/packages/components-v3/src/models/colorsConfig.js +25 -0
  303. package/dist/packages/components-v3/dist/packages/components-v3/tokens/aspectRatio/aspectRatio.cjs +16 -0
  304. package/dist/packages/components-v3/dist/packages/components-v3/tokens/aspectRatio/aspectRatio.js +17 -0
  305. package/dist/packages/components-v3/dist/packages/components-v3/tokens/breakpoints/breakpoints.cjs +25 -0
  306. package/dist/packages/components-v3/dist/packages/components-v3/tokens/breakpoints/breakpoints.js +23 -0
  307. package/dist/packages/components-v3/dist/packages/components-v3/tokens/colors/colors.cjs +51 -0
  308. package/dist/packages/components-v3/dist/packages/components-v3/tokens/colors/colors.js +51 -0
  309. package/dist/packages/components-v3/dist/packages/components-v3/tokens/radius/radius.cjs +64 -0
  310. package/dist/packages/components-v3/dist/packages/components-v3/tokens/radius/radius.js +65 -0
  311. package/dist/packages/components-v3/dist/packages/components-v3/tokens/theme/theme.cjs +18 -0
  312. package/dist/packages/components-v3/dist/packages/components-v3/tokens/theme/theme.js +16 -0
  313. package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/fontFamily.cjs +25 -0
  314. package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/fontFamily.js +25 -0
  315. package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/fontSize.cjs +37 -0
  316. package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/fontSize.js +38 -0
  317. package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/fontWeight.cjs +17 -0
  318. package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/fontWeight.js +18 -0
  319. package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/letterSpacing.cjs +15 -0
  320. package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/letterSpacing.js +16 -0
  321. package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/lineHeight.cjs +31 -0
  322. package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/lineHeight.js +32 -0
  323. package/dist/packages/components-v3/dist/packages/components-v3/tokens/utils.cjs +7 -0
  324. package/dist/packages/components-v3/dist/packages/components-v3/tokens/utils.js +6 -0
  325. package/dist/packages/components-v3/dist/utils/CustomIcon.cjs +2 -0
  326. package/dist/packages/components-v3/dist/utils/CustomIcon.js +4 -0
  327. package/dist/packages/components-v3/dist/utils/resolveTheme.cjs +13 -0
  328. package/dist/packages/components-v3/dist/utils/resolveTheme.js +13 -0
  329. package/dist/packages/components-v3/dist/utils/useGetContentSize.cjs +1 -0
  330. package/dist/packages/components-v3/dist/utils/useGetContentSize.js +3 -0
  331. package/dist/packages/components-v3/dist/utils/useResponsiveValue.cjs +2 -2
  332. package/dist/packages/components-v3/dist/utils/useResponsiveValue.js +2 -2
  333. package/dist/packages/icons/dist/FourPointStar.cjs +16 -1
  334. package/dist/packages/icons/dist/FourPointStar.js +16 -2
  335. package/dist/packages/icons/dist/MagnifyingGlass.cjs +8 -0
  336. package/dist/packages/icons/dist/MagnifyingGlass.js +9 -0
  337. package/dist/packages/icons/dist/MagnifyingThin.cjs +8 -0
  338. package/dist/packages/icons/dist/MagnifyingThin.js +9 -0
  339. package/dist/packages/icons/dist/SendMinimalist.cjs +8 -0
  340. package/dist/packages/icons/dist/SendMinimalist.js +9 -0
  341. package/dist/packages/icons/dist/SendModern.cjs +8 -0
  342. package/dist/packages/icons/dist/SendModern.js +9 -0
  343. package/dist/packages/icons/dist/SendStandard.cjs +8 -0
  344. package/dist/packages/icons/dist/SendStandard.js +9 -0
  345. package/dist/services/amplitudeService/amplitudeService.cjs +36 -8
  346. package/dist/services/amplitudeService/amplitudeService.d.cts +11 -3
  347. package/dist/services/amplitudeService/amplitudeService.d.ts +11 -3
  348. package/dist/services/amplitudeService/amplitudeService.js +36 -8
  349. package/dist/services/userIdentityService/index.cjs +3 -0
  350. package/dist/services/userIdentityService/index.d.cts +2 -0
  351. package/dist/services/userIdentityService/index.d.ts +2 -0
  352. package/dist/services/userIdentityService/index.js +3 -0
  353. package/dist/services/userIdentityService/userIdentityService.cjs +49 -0
  354. package/dist/services/userIdentityService/userIdentityService.d.cts +19 -0
  355. package/dist/services/userIdentityService/userIdentityService.d.ts +19 -0
  356. package/dist/services/userIdentityService/userIdentityService.js +48 -0
  357. package/package.json +14 -5
  358. package/src/application/models/api/userEvent.ts +3 -1
  359. package/src/application/models/chatElementDisplayLocationV3.ts +2 -0
  360. package/src/application/models/frontendConfigV3.ts +1 -1
  361. package/src/application/models/graphql/queries/getColorsAndFrontendQuery.ts +13 -0
  362. package/src/application/models/guards/api/isApiQueryTypedEventAttributes.ts +6 -1
  363. package/src/application/utils/widgetTextRequestToApiRequest.ts +5 -5
  364. package/src/atoms/app/index.ts +9 -7
  365. package/src/atoms/chat/index.ts +0 -1
  366. package/src/contexts/amplitudeContext/__tests__/amplitudeContext.test.tsx +47 -66
  367. package/src/contexts/amplitudeContext/amplitudeContext.tsx +4 -1
  368. package/src/contexts/enviveContext/enviveContext.tsx +47 -6
  369. package/src/contexts/featureFlagServiceContext/featureFlagServiceContext.tsx +101 -2
  370. package/src/contexts/graphqlContext/graphqlContext.tsx +42 -42
  371. package/src/contexts/graphqlContext/mockV3Config.ts +18 -6
  372. package/src/contexts/hardcopyContext/hardcopyContext.tsx +29 -0
  373. package/src/contexts/newOrgConfigContext/newOrgConfigContext.tsx +0 -1
  374. package/src/contexts/salesAgentContext/chatAPI.ts +56 -10
  375. package/src/contexts/salesAgentContext/formSubmittedUtils.ts +57 -0
  376. package/src/contexts/salesAgentContext/salesAgentContext.tsx +66 -9
  377. package/src/contexts/salesAgentContext/salesAgentService.ts +42 -11
  378. package/src/contexts/searchContext/__tests__/searchContext.test.tsx +3 -1
  379. package/src/contexts/typesV3.ts +16 -14
  380. package/src/contexts/uiConfigContext/__tests__/uiConfigContext.test.tsx +3 -2
  381. package/src/contexts/userIdentityContext/__tests__/userIdentityContext.test.tsx +18 -131
  382. package/src/contexts/userIdentityContext/userIdentityContext.tsx +47 -42
  383. package/src/hooks/ElementObserver/useElementObserver.ts +2 -1
  384. package/src/hooks/GraphQLConfig/useGraphQLConfig.ts +0 -1
  385. package/src/hooks/Search/__tests__/useSearch.test.tsx +11 -1
  386. package/src/mocks/index.ts +1 -0
  387. package/src/mocks/salesAgentMockData.ts +247 -0
  388. package/src/services/amplitudeService/__tests__/amplitudeService.test.ts +17 -15
  389. package/src/services/amplitudeService/amplitudeService.ts +50 -10
  390. package/src/services/userIdentityService/index.ts +1 -0
  391. package/src/services/userIdentityService/userIdentityService.ts +64 -0
  392. package/dist/contexts/featureFlagContext/featureFlagContext.cjs +0 -105
  393. package/dist/contexts/featureFlagContext/featureFlagContext.d.cts +0 -19
  394. package/dist/contexts/featureFlagContext/featureFlagContext.d.ts +0 -19
  395. package/dist/contexts/featureFlagContext/featureFlagContext.js +0 -102
  396. package/dist/contexts/featureFlagContext/index.cjs +0 -4
  397. package/dist/contexts/featureFlagContext/index.d.cts +0 -2
  398. package/dist/contexts/featureFlagContext/index.d.ts +0 -2
  399. package/dist/contexts/featureFlagContext/index.js +0 -3
  400. package/dist/packages/components-v3/dist/src/models/colorsConfig.cjs +0 -26
  401. package/dist/packages/components-v3/dist/src/models/colorsConfig.js +0 -25
  402. package/dist/packages/components-v3/dist/tokens/aspectRatio/aspectRatio.cjs +0 -16
  403. package/dist/packages/components-v3/dist/tokens/aspectRatio/aspectRatio.js +0 -17
  404. package/dist/packages/components-v3/dist/tokens/breakpoints/breakpoints.cjs +0 -25
  405. package/dist/packages/components-v3/dist/tokens/breakpoints/breakpoints.js +0 -23
  406. package/dist/packages/components-v3/dist/tokens/colors/colors.cjs +0 -51
  407. package/dist/packages/components-v3/dist/tokens/colors/colors.js +0 -51
  408. package/dist/packages/components-v3/dist/tokens/radius/radius.cjs +0 -64
  409. package/dist/packages/components-v3/dist/tokens/radius/radius.js +0 -65
  410. package/dist/packages/components-v3/dist/tokens/theme/theme.cjs +0 -13
  411. package/dist/packages/components-v3/dist/tokens/theme/theme.js +0 -12
  412. package/dist/packages/components-v3/dist/tokens/typography/fontFamily.cjs +0 -25
  413. package/dist/packages/components-v3/dist/tokens/typography/fontFamily.js +0 -25
  414. package/dist/packages/components-v3/dist/tokens/typography/fontSize.cjs +0 -37
  415. package/dist/packages/components-v3/dist/tokens/typography/fontSize.js +0 -38
  416. package/dist/packages/components-v3/dist/tokens/typography/fontWeight.cjs +0 -17
  417. package/dist/packages/components-v3/dist/tokens/typography/fontWeight.js +0 -18
  418. package/dist/packages/components-v3/dist/tokens/typography/letterSpacing.cjs +0 -15
  419. package/dist/packages/components-v3/dist/tokens/typography/letterSpacing.js +0 -16
  420. package/dist/packages/components-v3/dist/tokens/typography/lineHeight.cjs +0 -31
  421. package/dist/packages/components-v3/dist/tokens/typography/lineHeight.js +0 -32
  422. package/dist/packages/components-v3/dist/tokens/utils.cjs +0 -7
  423. package/dist/packages/components-v3/dist/tokens/utils.js +0 -6
  424. package/src/contexts/featureFlagContext/featureFlagContext.tsx +0 -180
  425. package/src/contexts/featureFlagContext/index.ts +0 -1
  426. /package/dist/packages/components-v3/dist/{tokens → packages/components-v3/tokens}/typography/typography.cjs +0 -0
  427. /package/dist/packages/components-v3/dist/{tokens → packages/components-v3/tokens}/typography/typography.js +0 -0
@@ -3,6 +3,8 @@ import { OrgConfigFeatureGate } from 'src/application/models/api/orgConfigResult
3
3
  import { FeatureGates } from 'src/application/models/featureGates';
4
4
  import Logger from 'src/application/logging/logger';
5
5
 
6
+ const FEATURE_FLAGS_STORAGE_KEY = 'spiffy-feature-flags';
7
+
6
8
  // This is the class that was previously implicitly used or defined elsewhere
7
9
  export class FeatureFlagService {
8
10
  private featureGates: OrgConfigFeatureGate[];
@@ -11,11 +13,94 @@ export class FeatureFlagService {
11
13
  this.featureGates = featureGates;
12
14
  }
13
15
 
16
+ static getQueryParamFeatureGateOverrides(featureGate: FeatureGates): boolean | undefined {
17
+ const url = window.location?.href ?? '';
18
+ if (url.includes('?')) {
19
+ const urlObj = new URL(url);
20
+ const params = new URLSearchParams(urlObj.search);
21
+ const paramsObj = Object.fromEntries(params.entries());
22
+ const value = paramsObj[featureGate];
23
+
24
+ if (value != null) {
25
+ return value === 'true';
26
+ }
27
+ }
28
+
29
+ return undefined;
30
+ }
31
+
32
+ static getWindowFeatureGateOverrides(featureGate: FeatureGates): boolean | undefined {
33
+ if (typeof window === 'undefined') {
34
+ return undefined;
35
+ }
36
+ const windowOverride = window as Window & {
37
+ _envive?: { featureOverrides?: Record<string, boolean> };
38
+ _spiffy?: { featureOverrides?: Record<string, boolean> };
39
+ };
40
+ const featureOverrides =
41
+ windowOverride?._envive?.featureOverrides ?? windowOverride?._spiffy?.featureOverrides;
42
+ const value = featureOverrides?.[String(featureGate)];
43
+ if (value != null) {
44
+ return value;
45
+ }
46
+ return undefined;
47
+ }
48
+
49
+ static getStoredFeatureGateOverrides(featureGate: FeatureGates): boolean | undefined {
50
+ if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') {
51
+ return undefined;
52
+ }
53
+ try {
54
+ const featureFlags = window.localStorage.getItem(FEATURE_FLAGS_STORAGE_KEY);
55
+ if (!featureFlags) {
56
+ return undefined;
57
+ }
58
+ const featureFlagsObj = JSON.parse(featureFlags) as Record<string, boolean>;
59
+ return featureFlagsObj[featureGate];
60
+ } catch (err) {
61
+ Logger.logError(
62
+ '[spiffy-ai] getStoredFeatureGateOverrides: error parsing feature flags',
63
+ err,
64
+ );
65
+ return undefined;
66
+ }
67
+ }
68
+
69
+ static getFeatureFlagOverride(featureGate: FeatureGates): boolean | undefined {
70
+ const queryOverride = FeatureFlagService.getQueryParamFeatureGateOverrides(featureGate);
71
+ if (queryOverride != null) {
72
+ Logger.logDebug(
73
+ `[spiffy-ai] isFeatureGateEnabled featureGate:${featureGate} overridden by URL param. New value: ${queryOverride}`,
74
+ );
75
+ return queryOverride;
76
+ }
77
+
78
+ const windowOverride = FeatureFlagService.getWindowFeatureGateOverrides(featureGate);
79
+ if (windowOverride != null) {
80
+ Logger.logDebug(
81
+ `[spiffy-ai] isFeatureGateEnabled featureGate:${featureGate} overridden by window param. New value: ${windowOverride}`,
82
+ );
83
+ return windowOverride;
84
+ }
85
+
86
+ const storedOverride = FeatureFlagService.getStoredFeatureGateOverrides(featureGate);
87
+ if (storedOverride != null) {
88
+ Logger.logDebug(
89
+ `[spiffy-ai] isFeatureGateEnabled featureGate:${featureGate} overridden by stored value. New value: ${storedOverride}`,
90
+ );
91
+ return storedOverride;
92
+ }
93
+
94
+ return undefined;
95
+ }
96
+
14
97
  isFeatureGateEnabled = (featureGate: FeatureGates): boolean => {
15
98
  const gateValue = this.featureGates.find(gate => gate.name === featureGate);
16
99
 
17
- // TODO: Add logic for overrides (query params, window, stored) if needed, similar to the old FeatureFlagContext.tsx
18
- // For now, direct value from config is used.
100
+ const featureFlagOverride = FeatureFlagService.getFeatureFlagOverride(featureGate);
101
+ if (featureFlagOverride !== undefined) {
102
+ return featureFlagOverride;
103
+ }
19
104
 
20
105
  if (gateValue == null || gateValue.value == null) {
21
106
  Logger.logDebug(
@@ -38,6 +123,20 @@ export class FeatureFlagService {
38
123
  ]),
39
124
  );
40
125
  };
126
+
127
+ static persistFeatureGateOverrides(): void {
128
+ if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') {
129
+ return;
130
+ }
131
+ const overrides = Object.values(FeatureGates)
132
+ .map(
133
+ featureGate =>
134
+ [featureGate, FeatureFlagService.getFeatureFlagOverride(featureGate)] as const,
135
+ )
136
+ .filter(([, value]) => value !== undefined)
137
+ .reduce<Record<string, boolean>>((acc, [key, value]) => ({ ...acc, [key]: value! }), {});
138
+ window.localStorage.setItem(FEATURE_FLAGS_STORAGE_KEY, JSON.stringify(overrides));
139
+ }
41
140
  }
42
141
 
43
142
  export interface FeatureFlagContextType {
@@ -1,26 +1,23 @@
1
- import React, { ReactNode, createContext, useCallback, useContext, useMemo } from 'react';
1
+ import { ReactNode, createContext, useCallback, useContext, useMemo } from 'react';
2
2
  import { useAtomValue } from 'jotai';
3
3
  import { baseUrlAtom, orgLevelApiKeyAtom } from 'src/atoms/envive/enviveConfig';
4
4
  import { getMerchantOrgIdQuery } from 'src/application/models/graphql/queries/getMerchantOrgIdQuery';
5
5
  import { validateGraphQLOrgId } from 'src/application/models/validators/validateGraphQLOrgId';
6
- import {
7
- GetMerchantColorsQueryData,
8
- GetMerchantFrontendConfigQueryData,
9
- } from 'src/application/models/graphql';
10
6
  import { ColorMapping } from 'src/application/models/colorsConfig';
11
7
  import { FrontendConfig } from 'src/application/models/frontendConfig';
12
8
  import Logger from 'src/application/logging/logger';
13
- import { configVersion } from 'src/types/config-versions';
14
9
  import {
15
10
  CamelCasedPropertiesDeep,
16
11
  transformSnakeToCamel,
17
12
  validateAndTransformMountingConfig,
18
13
  validateAndTransformPageVariants,
19
14
  } from 'src/application/models';
15
+ import { getColorsAndFrontendQuery } from 'src/application/models/graphql/queries/getColorsAndFrontendQuery';
20
16
  import { FrontendConfigV3 } from 'src/application/models/frontendConfigV3';
21
17
  import { ColorMappingV3 } from 'src/application/models/colorsConfigV3';
18
+ import { FloatingButtonLocation } from '@envive-ai/react-toolkit-v3/FloatingButton';
22
19
  import { mockV3ColorsConfig, mockV3FrontendConfig } from './mockV3Config';
23
- import { ConfigVersionEnum, Position, WidgetConfigV3 } from '../typesV3';
20
+ import { ConfigVersionEnum, WidgetConfigV3 } from '../typesV3';
24
21
  import {
25
22
  OrgPageConfig,
26
23
  PageVariantConfig,
@@ -28,19 +25,6 @@ import {
28
25
  WidgetMountingConfig,
29
26
  } from '../types';
30
27
 
31
- interface BaseMeConfigQueryResponse {
32
- me: {
33
- org?: {
34
- id: string;
35
- };
36
- getProductsConfigByVersion?: {
37
- frontend?: {
38
- values: CamelCasedPropertiesDeep<GetMerchantFrontendConfigQueryData>;
39
- };
40
- colors?: { values: CamelCasedPropertiesDeep<GetMerchantColorsQueryData> };
41
- };
42
- };
43
- }
44
28
  export type ColorsConfigResponse = CamelCasedPropertiesDeep<ColorMapping>;
45
29
  export type FrontendConfigResponse = CamelCasedPropertiesDeep<FrontendConfig>;
46
30
  export type ColorsConfigV3Response = CamelCasedPropertiesDeep<ColorMappingV3>;
@@ -63,18 +47,6 @@ interface GraphQLContextValue {
63
47
 
64
48
  const GraphQLContext = createContext<GraphQLContextValue | null>(null);
65
49
 
66
- const colorsAndFrontendConfigQuery = () => `
67
- query ($version: String = "${configVersion()}") {
68
- me {
69
- getProductsConfigByVersion(version: $version) {
70
- frontend { values }
71
- colors { values }
72
- v_three_config { values }
73
- }
74
- }
75
- }
76
- `;
77
-
78
50
  type GraphQLProviderProps = {
79
51
  children: ReactNode;
80
52
  requestV3Config?: boolean;
@@ -106,18 +78,18 @@ const DEFAULT_PAGE_VARIANTS: PageVariantConfig[] = [
106
78
  },
107
79
  ];
108
80
 
109
- const mapPositionToCamelCase = (position: string): Position => {
81
+ const mapPositionToCamelCase = (position: string): FloatingButtonLocation => {
110
82
  if (position === 'bottom-left') {
111
- return 'bottomLeft';
83
+ return FloatingButtonLocation.BOTTOM_LEFT;
112
84
  }
113
85
  if (position === 'middle-left') {
114
- return 'middleLeft';
86
+ return FloatingButtonLocation.MIDDLE_LEFT;
115
87
  }
116
88
  if (position === 'middle-right') {
117
- return 'middleRight';
89
+ return FloatingButtonLocation.MIDDLE_RIGHT;
118
90
  }
119
91
  if (position === 'bottom-right') {
120
- return 'bottomRight';
92
+ return FloatingButtonLocation.BOTTOM_RIGHT;
121
93
  }
122
94
  throw new Error(`Invalid position: ${position}`);
123
95
  };
@@ -234,7 +206,7 @@ export const GraphQLProvider = ({
234
206
 
235
207
  const getV3Config = useCallback(async (): Promise<GraphQlConfigValues> => {
236
208
  try {
237
- const query = await colorsAndFrontendConfigQuery();
209
+ const query = await getColorsAndFrontendQuery();
238
210
  if (!query) {
239
211
  throw new Error('Colors and frontend config query is not defined');
240
212
  }
@@ -242,11 +214,17 @@ export const GraphQLProvider = ({
242
214
 
243
215
  // We may update this root config location in the future
244
216
  const v3RootConfig = response.me.getProductsConfigByVersion?.v_three_config?.values;
217
+ const frontendValues = response.me.getProductsConfigByVersion?.frontend?.values;
245
218
 
246
219
  const v3FrontendConfig = v3FrontendConfigCleanup(
247
220
  transformSnakeToCamel(v3RootConfig) as FrontendConfigV3Response,
248
221
  );
249
222
 
223
+ // Get merchant_override_css from frontend.values if v3RootConfig is not available
224
+ const frontendMerchantOverrideCss = frontendValues?.merchant_override_css;
225
+ const v3MerchantOverrideCss = v3FrontendConfig.uiConfigs?.merchantOverrideCss;
226
+ const merchantOverrideCss = v3MerchantOverrideCss || frontendMerchantOverrideCss;
227
+
250
228
  const v3MountingConfigsArray = (transformSnakeToCamel(v3RootConfig?.mounting_configs) ??
251
229
  []) as unknown as { key: string; config: WidgetMountingConfig }[];
252
230
 
@@ -271,10 +249,15 @@ export const GraphQLProvider = ({
271
249
  : DEFAULT_PAGE_VARIANTS;
272
250
 
273
251
  const v3ColorsConfig = transformSnakeToCamel(v3RootConfig?.colors?.values);
252
+ const isSemanticColors = !window.location.href.includes('globals=merchant');
253
+ const isStorybook = window.top?.location.href.includes('?path=');
274
254
 
275
255
  // If the v3 root config is not found and we are configured to return the deprecated config, we will return the mocked config
276
- if (!v3RootConfig && mockV3ConfigToDeprecatedConfig) {
277
- const isSemanticColors = !window.location.href.includes('globals=merchant');
256
+ if ((!v3RootConfig && mockV3ConfigToDeprecatedConfig) || (isStorybook && isSemanticColors)) {
257
+ Logger.logInfo('GraphQLContext | Returning mock v3 config', {
258
+ colorsConfig: mockV3ColorsConfig as ColorsConfigV3Response,
259
+ frontendConfig: mockV3FrontendConfig as FrontendConfigV3Response,
260
+ });
278
261
  const colorsConfig = mockV3ColorsConfig;
279
262
  const frontendConfig = mockV3FrontendConfig;
280
263
  return {
@@ -282,13 +265,29 @@ export const GraphQLProvider = ({
282
265
  ? (colorsConfig as ColorsConfigV3Response)
283
266
  : (v3ColorsConfig as ColorsConfigV3Response),
284
267
  frontendConfig: frontendConfig as FrontendConfigV3Response,
268
+ orgPageConfig: {
269
+ pageVariants: [],
270
+ widgetConfigs: {},
271
+ mountingConfigs: {},
272
+ },
285
273
  };
286
274
  }
287
275
 
276
+ Logger.logInfo('GraphQLContext | Returning v3 config', {
277
+ colorsConfig: v3ColorsConfig as ColorsConfigV3Response,
278
+ frontendConfig: v3FrontendConfig as FrontendConfigV3Response,
279
+ orgPageConfig: {
280
+ pageVariants: v3pageVariants,
281
+ widgetConfigs: v3WidgetConfigs,
282
+ mountingConfigs: v3MountingConfigs,
283
+ },
284
+ });
285
+
288
286
  return {
289
287
  colorsConfig: v3ColorsConfig as ColorsConfigV3Response,
290
288
  frontendConfig: {
291
289
  ...(v3FrontendConfig as FrontendConfigV3Response),
290
+ merchantOverrideCss,
292
291
  // Need to replace the automatic widget configs with the object based ones
293
292
  widgetConfigs: v3WidgetConfigs,
294
293
  },
@@ -307,7 +306,7 @@ export const GraphQLProvider = ({
307
306
 
308
307
  const getColorsAndFrontendConfig = useCallback(async (): Promise<GraphQlConfigValues> => {
309
308
  try {
310
- const query = await colorsAndFrontendConfigQuery();
309
+ const query = await getColorsAndFrontendQuery();
311
310
  if (!query) {
312
311
  throw new Error('Colors and frontend config query is not defined');
313
312
  }
@@ -347,10 +346,11 @@ export const GraphQLProvider = ({
347
346
  }, [executeQuery]);
348
347
 
349
348
  const getConfig = useCallback(async (): Promise<GraphQlConfigValues> => {
350
- console.log('GraphQLProvider: getConfig: requestV3Config', requestV3Config);
351
349
  if (requestV3Config) {
350
+ Logger.logInfo('GraphQLContext | Getting v3 config', requestV3Config);
352
351
  return getV3Config();
353
352
  }
353
+ Logger.logInfo('GraphQLContext | Getting colors and frontend config', requestV3Config);
354
354
  return getColorsAndFrontendConfig();
355
355
  }, [getColorsAndFrontendConfig, getV3Config, requestV3Config]);
356
356
 
@@ -7,10 +7,12 @@ import { AnimationSpeed, PromptCarouselRows } from '@envive-ai/react-toolkit-v3/
7
7
  import { WidgetWrapperVariant } from '@envive-ai/react-toolkit-v3/WidgetWrapper';
8
8
  import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
9
9
  import { ChatHeaderVariant } from '@envive-ai/react-toolkit-v3/ChatHeader';
10
+ import { WidgetKind } from '@envive-ai/react-toolkit-v3/SocialProof';
10
11
  import { SparkleIconColor } from '@envive-ai/react-toolkit-v3/WelcomeMessage';
11
12
 
12
13
  import { CustomerServiceType } from 'src/types/customerService';
13
- import { ConfigVersionEnum, SocialProofWidgetKind, WidgetTypeV3 } from '../typesV3';
14
+ import { FloatingButtonLocation } from '@envive-ai/react-toolkit-v3/FloatingButton';
15
+ import { ConfigVersionEnum, WidgetTypeV3 } from '../typesV3';
14
16
 
15
17
  const mockImages = [
16
18
  {
@@ -111,7 +113,7 @@ export const mockV3FrontendConfig: FrontendConfigV3 = {
111
113
  },
112
114
  },
113
115
  floatingButton: {
114
- position: 'bottomRight',
116
+ position: FloatingButtonLocation.BOTTOM_RIGHT,
115
117
  backgroundColor: ColorNames.BackgroundPrimary,
116
118
  mode: 'dark',
117
119
  showOption: 'always',
@@ -119,7 +121,7 @@ export const mockV3FrontendConfig: FrontendConfigV3 = {
119
121
  iconSVGSrc: '',
120
122
  },
121
123
  floatingChat: {
122
- headerBackgroundColor: undefined,
124
+ headerBackgroundColor: ColorNames.BackgroundPrimary,
123
125
  headerMode: ChatHeaderVariant.DARK,
124
126
  welcomeMessageIconColor: SparkleIconColor.ACCENT_PRIMARY,
125
127
  showVerifiedBuyer: true,
@@ -187,7 +189,7 @@ export const mockV3FrontendConfig: FrontendConfigV3 = {
187
189
  type: WidgetTypeV3.SocialProofV3,
188
190
 
189
191
  imageGalleryLayout: ImageGalleryLayout.FOUR_GRID,
190
- kind: SocialProofWidgetKind.STATIC,
192
+ kind: WidgetKind.STATIC,
191
193
  variant: WidgetWrapperVariant.INLINE_WITH_BORDER,
192
194
  promptCarouselRows: PromptCarouselRows.TWO_ON_MOBILE_ONE_ON_DESKTOP,
193
195
  primaryButtonVariant: PromptButtonVariant.DARK,
@@ -200,7 +202,7 @@ export const mockV3FrontendConfig: FrontendConfigV3 = {
200
202
  type: WidgetTypeV3.SocialProofV3,
201
203
 
202
204
  imageGalleryLayout: ImageGalleryLayout.SINGLE,
203
- kind: SocialProofWidgetKind.STATIC,
205
+ kind: WidgetKind.STATIC,
204
206
  variant: WidgetWrapperVariant.CARD_NO_BORDER,
205
207
  promptCarouselRows: PromptCarouselRows.TWO_ON_MOBILE_ONE_ON_DESKTOP,
206
208
  primaryButtonVariant: PromptButtonVariant.DARK,
@@ -213,7 +215,7 @@ export const mockV3FrontendConfig: FrontendConfigV3 = {
213
215
  type: WidgetTypeV3.SocialProofV3,
214
216
 
215
217
  imageGalleryLayout: ImageGalleryLayout.FOUR_HORIZONTAL,
216
- kind: SocialProofWidgetKind.STATIC,
218
+ kind: WidgetKind.STATIC,
217
219
  variant: WidgetWrapperVariant.CARD_WITH_BORDER,
218
220
  promptCarouselRows: PromptCarouselRows.TWO_ON_MOBILE_ONE_ON_DESKTOP,
219
221
  primaryButtonVariant: PromptButtonVariant.DARK,
@@ -246,5 +248,15 @@ export const mockV3FrontendConfig: FrontendConfigV3 = {
246
248
  image: mockImages[0],
247
249
  hideTextField: false,
248
250
  },
251
+ 'product-card-test-widget': {
252
+ widgetConfigId: 'product-card-test-widget',
253
+ contentId: 'product-card-test-widget',
254
+ type: WidgetTypeV3.ProductCardV3,
255
+ promptButtonType: PromptButtonVariant.LIGHT,
256
+ italicizeHeadline: false,
257
+ fallbackColor: '#F9F6EA',
258
+ imageSrc:
259
+ 'https://www.bandolierstyle.com/cdn/shop/files/Lily17_Black_Gold_Chrome_MOD_Dec25_6.jpg?v=1765844272',
260
+ },
249
261
  },
250
262
  };
@@ -137,6 +137,35 @@ const MOCK_HARDCOPY_RESPONSE: Partial<Record<WidgetTypeV3, HardcopyResponse>> =
137
137
  textFieldPlaceholderText: 'Ask me anything...',
138
138
  },
139
139
  },
140
+ [WidgetTypeV3.ProductCardV3]: {
141
+ language: 'en',
142
+ values: {
143
+ headline: 'Discover Your Perfect Style',
144
+ animatedText: [
145
+ 'the perfect outfit for any occasion',
146
+ 'trending fashion that fits your lifestyle',
147
+ 'quality pieces that last',
148
+ ],
149
+ prompts: [
150
+ 'What are your best sellers?',
151
+ 'Show me summer dresses',
152
+ 'Do you have free shipping?',
153
+ 'What sizes are available?',
154
+ 'Can I return items?',
155
+ ],
156
+ placeholder: 'Ask me anything...',
157
+ },
158
+ },
159
+ [WidgetTypeV3.FloatingChatV3]: {
160
+ language: 'en',
161
+ values: {
162
+ welcomeMessageTitle: 'Welcome to Envive AI',
163
+ welcomeMessageText:
164
+ 'Your personal shopper trained on the collective knowledge of thousands of real experts!',
165
+ chatFooterTextFieldPlaceholderText: 'Ask me anything...',
166
+ disclaimerText: 'This is a disclaimer...',
167
+ },
168
+ },
140
169
  };
141
170
 
142
171
  const HardcopyContext = createContext<HardcopyContextType | undefined>(undefined);
@@ -25,7 +25,6 @@ export const NewOrgConfigProvider: React.FC<NewOrgConfigProviderProps> = ({
25
25
  const setNewOrgConfig = useSetAtom(newOrgConfigAtom);
26
26
 
27
27
  const { data: fetchedConfig, loading, error } = useUIConfig();
28
- console.log('NewOrgConfigProvider: newConfig', fetchedConfig, loading, error);
29
28
 
30
29
  const contextValue = useMemo(() => {
31
30
  if (!orgShortName || loading) {
@@ -1,24 +1,35 @@
1
1
  // This component will interact with the backend API to get the responses from the sales agent.
2
2
 
3
3
  import { PageVisitCategory, UserEventCategory } from '@spiffy-ai/commerce-api-client';
4
- import { Suggestion, UserEvent } from 'src/application/models';
4
+ import {
5
+ FormSubmittedAttributes,
6
+ MessageRole,
7
+ MessageType,
8
+ Suggestion,
9
+ UserEvent,
10
+ } from 'src/application/models';
5
11
  import { useSetAtom } from 'jotai';
6
12
  import { useCallback } from 'react';
7
13
  import { v4 as uuid } from 'uuid';
14
+ import { formSubmitAtom, replyEventCategoryAtom } from 'src/atoms/chat';
8
15
  import { queueUserEventAtom } from 'src/atoms/chat/messageQueue';
16
+ import { SpiffyMetricsEventName, useAmplitude } from '../amplitudeContext';
9
17
 
10
18
  export interface SalesAgentChatAPI {
11
19
  logPageVisit: ({ pageVisitCategory }: { pageVisitCategory: PageVisitCategory }) => void;
12
20
  logUserEvent: (event: UserEvent) => void;
13
21
  onSuggestionClicked: (suggestion: Suggestion) => void;
14
- onTypedMessageSubmitted: ({ query }: { query: string }) => void;
15
- onFormResponseSubmitted: (formResponse: any) => void; // TODO: Figure out the right type
22
+ onTypedMessageSubmitted: ({ query, userTyped }: { query: string; userTyped: boolean }) => void;
23
+ onFormResponseSubmitted: (formResponse: FormSubmittedAttributes) => void;
16
24
  }
17
25
 
18
26
  export const useSalesAgentChatAPI = () => {
19
27
  // TODO: Each of these functions will trigger both the necessary amplitude events and initiate the
20
28
  // necessary actions to trigger the backend API
21
29
  const queueUserEvent = useSetAtom(queueUserEventAtom);
30
+ const setReplyEventCategory = useSetAtom(replyEventCategoryAtom);
31
+ const setFormSubmit = useSetAtom(formSubmitAtom);
32
+ const { trackEvent } = useAmplitude();
22
33
 
23
34
  const logPageVisit = useCallback(
24
35
  ({ pageVisitCategory }: { pageVisitCategory: PageVisitCategory }) => {
@@ -44,6 +55,13 @@ export const useSalesAgentChatAPI = () => {
44
55
  );
45
56
  const onSuggestionClicked = useCallback(
46
57
  (suggestion: Suggestion) => {
58
+ trackEvent({
59
+ eventName: SpiffyMetricsEventName.ChatSuggestionClicked,
60
+ eventProps: {
61
+ suggestionId: suggestion.id,
62
+ content: suggestion.content,
63
+ },
64
+ });
47
65
  const event: UserEvent = {
48
66
  eventId: uuid(),
49
67
  category: UserEventCategory.SuggestionClicked,
@@ -55,25 +73,53 @@ export const useSalesAgentChatAPI = () => {
55
73
  };
56
74
  queueUserEvent(event);
57
75
  },
58
- [queueUserEvent],
76
+ [queueUserEvent, trackEvent],
59
77
  );
60
78
  const onTypedMessageSubmitted = useCallback(
61
- ({ query }: { query: string }) => {
79
+ ({ query, userTyped }: { query: string; userTyped: boolean }) => {
80
+ const eventId = uuid();
81
+ trackEvent({
82
+ eventName: SpiffyMetricsEventName.ChatUserMessageInput,
83
+ eventProps: {
84
+ query,
85
+ user_typed: userTyped,
86
+ message_id: eventId,
87
+ message_role: MessageRole.User,
88
+ message_type: MessageType.QueryTyped,
89
+ message_metadata: {
90
+ content: query,
91
+ created_at: new Date().toISOString(),
92
+ user_typed: userTyped,
93
+ },
94
+ },
95
+ });
62
96
  const event: UserEvent = {
63
- eventId: uuid(),
97
+ eventId,
64
98
  category: UserEventCategory.QueryTyped,
65
99
  createdAt: new Date().toISOString(),
66
100
  attributes: {
67
101
  query,
102
+ userTyped,
68
103
  },
69
104
  };
70
105
  queueUserEvent(event);
71
106
  },
72
- [queueUserEvent],
107
+ [queueUserEvent, trackEvent],
108
+ );
109
+ const onFormResponseSubmitted = useCallback(
110
+ (form: FormSubmittedAttributes) => {
111
+ setReplyEventCategory(UserEventCategory.FormSubmitted);
112
+ setFormSubmit(form);
113
+ const event: UserEvent = {
114
+ eventId: uuid(),
115
+ category: UserEventCategory.FormSubmitted,
116
+ createdAt: new Date().toISOString(),
117
+ attributes: form,
118
+ };
119
+ queueUserEvent(event);
120
+ },
121
+ [queueUserEvent, setReplyEventCategory, setFormSubmit],
73
122
  );
74
- const onFormResponseSubmitted = useCallback(() => {
75
- // TODO: Implement the form response submitted
76
- }, []);
77
123
 
78
124
  return {
79
125
  logPageVisit,
@@ -0,0 +1,57 @@
1
+ import { Message, MessageRole, MessageType } from 'src/application/models/message';
2
+ import { UserEvent } from 'src/application/models';
3
+
4
+ /**
5
+ * Searches the chat history for the form message by form response ID and builds the display string for the form.
6
+ */
7
+ export const buildFormSubmittedDisplayContent = (
8
+ messages: Message[][],
9
+ formResponseId: string,
10
+ filledSchema: Record<string, unknown>,
11
+ ): string => {
12
+ let formFields: { key: string; title: string }[] = [];
13
+ // Find the form message in the chat history
14
+ for (const turn of messages) {
15
+ for (const msg of turn) {
16
+ if (
17
+ msg.type === MessageType.Form &&
18
+ msg.id === formResponseId &&
19
+ msg.metadata &&
20
+ 'fields' in msg.metadata &&
21
+ Array.isArray(msg.metadata.fields)
22
+ ) {
23
+ formFields = msg.metadata.fields.map((field: { key: string; title: string }) => ({
24
+ key: field.key,
25
+ title: field.title,
26
+ }));
27
+ break;
28
+ }
29
+ }
30
+ if (formFields.length > 0) break;
31
+ }
32
+ // Build the display string for the form
33
+ const formStringContent =
34
+ formFields.length > 0
35
+ ? formFields.map(({ key, title }) => `${title}: ${filledSchema[key] ?? ''}`).join('\n')
36
+ : Object.entries(filledSchema)
37
+ .map(([key, value]) => `${key}: ${value}`)
38
+ .join('\n');
39
+ return formStringContent;
40
+ };
41
+
42
+ /**
43
+ * Creates a user message representing a submitted form for display in the chat.
44
+ */
45
+ export const createFormSubmittedUserMessage = (
46
+ userEvent: UserEvent,
47
+ formSubmittedContent: string,
48
+ ): Message => {
49
+ const newMessage: Message = {
50
+ id: userEvent.eventId,
51
+ role: MessageRole.User,
52
+ type: MessageType.QueryTyped,
53
+ createdAt: userEvent.createdAt,
54
+ metadata: { content: formSubmittedContent },
55
+ };
56
+ return newMessage;
57
+ };