@envive-ai/react-hooks 0.3.4 → 0.3.5

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 (277) hide show
  1. package/dist/application/commerce-api.cjs +1 -1
  2. package/dist/application/commerce-api.js +1 -1
  3. package/dist/application/models/chatElementDisplayLocationV3.cjs +7 -1
  4. package/dist/application/models/chatElementDisplayLocationV3.d.cts +7 -1
  5. package/dist/application/models/chatElementDisplayLocationV3.d.ts +7 -1
  6. package/dist/application/models/chatElementDisplayLocationV3.js +7 -1
  7. package/dist/application/models/featureGates.cjs +6 -2
  8. package/dist/application/models/featureGates.d.cts +6 -2
  9. package/dist/application/models/featureGates.d.ts +6 -2
  10. package/dist/application/models/featureGates.js +6 -2
  11. package/dist/application/models/guards/api/isApiFormResponse.cjs +1 -1
  12. package/dist/application/models/guards/api/isApiFormResponse.js +1 -1
  13. package/dist/application/models/guards/api/isApiFormSubmittedResponseAttributes.cjs +1 -1
  14. package/dist/application/models/guards/api/isApiFormSubmittedResponseAttributes.js +1 -1
  15. package/dist/application/models/guards/api/isApiOrderResponseAttributes.cjs +1 -1
  16. package/dist/application/models/guards/api/isApiOrderResponseAttributes.js +1 -1
  17. package/dist/application/models/guards/api/isApiPDPEventAttributes.cjs +2 -2
  18. package/dist/application/models/guards/api/isApiPDPEventAttributes.js +2 -2
  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/isApiResponse.cjs +1 -1
  22. package/dist/application/models/guards/api/isApiResponse.js +1 -1
  23. package/dist/application/utils/analyticsUtils.cjs +1 -1
  24. package/dist/application/utils/analyticsUtils.js +1 -1
  25. package/dist/atoms/app/index.cjs +3 -1
  26. package/dist/atoms/app/index.d.cts +3 -3
  27. package/dist/atoms/app/index.d.ts +9 -9
  28. package/dist/atoms/app/index.js +3 -3
  29. package/dist/atoms/app/variant.cjs +2 -1
  30. package/dist/atoms/app/variant.d.cts +14 -6
  31. package/dist/atoms/app/variant.d.ts +17 -9
  32. package/dist/atoms/app/variant.js +2 -2
  33. package/dist/atoms/chat/chatState.d.cts +1 -1
  34. package/dist/atoms/chat/chatState.d.ts +18 -18
  35. package/dist/atoms/chat/form.d.cts +2 -2
  36. package/dist/atoms/chat/form.d.ts +2 -2
  37. package/dist/atoms/chat/index.d.cts +1 -1
  38. package/dist/atoms/chat/index.d.ts +3 -3
  39. package/dist/atoms/chat/lastMessage.d.cts +2 -2
  40. package/dist/atoms/chat/lastMessage.d.ts +2 -2
  41. package/dist/atoms/chat/performanceMetrics.d.cts +6 -6
  42. package/dist/atoms/chat/performanceMetrics.d.ts +6 -6
  43. package/dist/atoms/chat/renderedWidgetRefs.d.cts +2 -2
  44. package/dist/atoms/chat/renderedWidgetRefs.d.ts +2 -2
  45. package/dist/atoms/chat/replies.d.cts +1 -1
  46. package/dist/atoms/chat/replies.d.ts +3 -3
  47. package/dist/atoms/chat/suggestions.d.cts +2 -2
  48. package/dist/atoms/chat/suggestions.d.ts +2 -2
  49. package/dist/atoms/envive/enviveConfig.cjs +1 -11
  50. package/dist/atoms/envive/enviveConfig.js +1 -11
  51. package/dist/atoms/globalSearch/globalSearch.d.cts +5 -5
  52. package/dist/atoms/globalSearch/globalSearch.d.ts +5 -5
  53. package/dist/atoms/org/customerService.d.cts +6 -6
  54. package/dist/atoms/org/graphqlConfig.d.cts +4 -4
  55. package/dist/atoms/org/newOrgConfigAtom.d.cts +2 -2
  56. package/dist/atoms/org/orgAnalyticsConfig.d.ts +5 -5
  57. package/dist/atoms/search/chatSearch.d.ts +17 -17
  58. package/dist/atoms/search/productRetrievalAPI.cjs +1 -7
  59. package/dist/atoms/search/productRetrievalAPI.js +1 -7
  60. package/dist/atoms/search/productRetrievalAdapter.cjs +4 -4
  61. package/dist/atoms/search/productRetrievalAdapter.js +4 -4
  62. package/dist/atoms/search/searchAPI.d.ts +13 -13
  63. package/dist/atoms/search/types.d.cts +1 -1
  64. package/dist/atoms/search/types.d.ts +1 -1
  65. package/dist/atoms/search/utils.d.cts +1 -1
  66. package/dist/atoms/search/utils.d.ts +1 -1
  67. package/dist/atoms/widget/chatPreviewLoading.d.cts +2 -2
  68. package/dist/contexts/enviveContext/enviveContext.cjs +14 -11
  69. package/dist/contexts/enviveContext/enviveContext.d.cts +2 -1
  70. package/dist/contexts/enviveContext/enviveContext.d.ts +2 -1
  71. package/dist/contexts/enviveContext/enviveContext.js +14 -11
  72. package/dist/contexts/enviveContext/types.d.ts +1 -1
  73. package/dist/contexts/featureFlagContext/featureFlagContext.cjs +1 -1
  74. package/dist/contexts/featureFlagContext/featureFlagContext.js +1 -1
  75. package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.cjs +1 -1
  76. package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.js +1 -1
  77. package/dist/contexts/graphqlContext/graphqlContext.cjs +87 -6
  78. package/dist/contexts/graphqlContext/graphqlContext.js +87 -6
  79. package/dist/contexts/graphqlContext/mockV3Config.cjs +56 -14
  80. package/dist/contexts/graphqlContext/mockV3Config.js +56 -14
  81. package/dist/contexts/hardcopyContext/hardcopyContext.cjs +33 -20
  82. package/dist/contexts/hardcopyContext/hardcopyContext.d.cts +2 -2
  83. package/dist/contexts/hardcopyContext/hardcopyContext.d.ts +2 -2
  84. package/dist/contexts/hardcopyContext/hardcopyContext.js +33 -20
  85. package/dist/contexts/pageContext/index.cjs +1 -0
  86. package/dist/contexts/pageContext/index.d.cts +2 -2
  87. package/dist/contexts/pageContext/index.d.ts +2 -2
  88. package/dist/contexts/pageContext/index.js +2 -2
  89. package/dist/contexts/pageContext/mapping.cjs +91 -1
  90. package/dist/contexts/pageContext/mapping.d.cts +5 -2
  91. package/dist/contexts/pageContext/mapping.d.ts +5 -2
  92. package/dist/contexts/pageContext/mapping.js +90 -2
  93. package/dist/contexts/pageContext/pageContext.cjs +33 -5
  94. package/dist/contexts/pageContext/pageContext.d.cts +2 -1
  95. package/dist/contexts/pageContext/pageContext.d.ts +2 -1
  96. package/dist/contexts/pageContext/pageContext.js +34 -6
  97. package/dist/contexts/pageContext/types.d.cts +2 -2
  98. package/dist/contexts/pageContext/types.d.ts +2 -2
  99. package/dist/contexts/salesAgentContext/chatAPI.cjs +4 -1
  100. package/dist/contexts/salesAgentContext/chatAPI.d.cts +4 -1
  101. package/dist/contexts/salesAgentContext/chatAPI.d.ts +4 -1
  102. package/dist/contexts/salesAgentContext/chatAPI.js +4 -1
  103. package/dist/contexts/salesAgentContext/index.d.cts +2 -2
  104. package/dist/contexts/salesAgentContext/index.d.ts +2 -2
  105. package/dist/contexts/salesAgentContext/salesAgentContext.cjs +4 -2
  106. package/dist/contexts/salesAgentContext/salesAgentContext.d.cts +2 -2
  107. package/dist/contexts/salesAgentContext/salesAgentContext.d.ts +2 -2
  108. package/dist/contexts/salesAgentContext/salesAgentContext.js +4 -2
  109. package/dist/contexts/salesAgentContext/salesAgentService.cjs +7 -4
  110. package/dist/contexts/salesAgentContext/salesAgentService.js +8 -5
  111. package/dist/contexts/systemSettingsContext/systemSettingsContext.d.cts +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 +20 -17
  115. package/dist/contexts/typesV3.d.cts +39 -12
  116. package/dist/contexts/typesV3.d.ts +39 -12
  117. package/dist/contexts/typesV3.js +5 -2
  118. package/dist/hooks/ChatToggle/useChatToggle.cjs +1 -1
  119. package/dist/hooks/ChatToggle/useChatToggle.d.cts +5 -5
  120. package/dist/hooks/ChatToggle/useChatToggle.d.ts +5 -5
  121. package/dist/hooks/ChatToggle/useChatToggle.js +1 -1
  122. package/dist/hooks/ElementObserver/useElementObserver.cjs +10 -10
  123. package/dist/hooks/ElementObserver/useElementObserver.js +10 -10
  124. package/dist/hooks/GrabAndScroll/useGrabAndScroll.d.cts +2 -2
  125. package/dist/hooks/GrabAndScroll/useGrabAndScroll.d.ts +2 -2
  126. package/dist/hooks/Search/useSearch.cjs +1 -1
  127. package/dist/hooks/Search/useSearch.js +1 -1
  128. package/dist/hooks/utils.d.cts +1 -1
  129. package/dist/merchants/domInsertion.cjs +1 -1
  130. package/dist/merchants/domInsertion.d.cts +1 -1
  131. package/dist/merchants/domInsertion.d.ts +1 -1
  132. package/dist/merchants/domInsertion.js +1 -1
  133. package/dist/packages/components-v3/dist/ChatHeader/ChatHeader.cjs +2 -0
  134. package/dist/packages/components-v3/dist/ChatHeader/ChatHeader.js +4 -0
  135. package/dist/packages/components-v3/dist/ChatHeader/components/CloseButton.cjs +16 -0
  136. package/dist/packages/components-v3/dist/ChatHeader/components/CloseButton.js +17 -0
  137. package/dist/packages/components-v3/dist/ChatHeader/components/Handle.cjs +6 -0
  138. package/dist/packages/components-v3/dist/ChatHeader/components/Handle.js +8 -0
  139. package/dist/packages/components-v3/dist/ChatHeader/components/Layout.cjs +4 -0
  140. package/dist/packages/components-v3/dist/ChatHeader/components/Layout.js +6 -0
  141. package/dist/packages/components-v3/dist/ChatHeader/components/Logo.cjs +3 -0
  142. package/dist/packages/components-v3/dist/ChatHeader/components/Logo.js +5 -0
  143. package/dist/packages/components-v3/dist/ChatHeader/components/Toggle.cjs +7 -0
  144. package/dist/packages/components-v3/dist/ChatHeader/components/Toggle.js +9 -0
  145. package/dist/packages/components-v3/dist/ChatHeader/components/ToggleItem.cjs +6 -0
  146. package/dist/packages/components-v3/dist/ChatHeader/components/ToggleItem.js +8 -0
  147. package/dist/packages/components-v3/dist/ChatHeader/components/index.cjs +6 -0
  148. package/dist/packages/components-v3/dist/ChatHeader/components/index.js +8 -0
  149. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetCloseButtonProperties.cjs +22 -0
  150. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetCloseButtonProperties.js +23 -0
  151. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetHandleProperties.cjs +58 -0
  152. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetHandleProperties.js +59 -0
  153. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetLayoutProperties.cjs +8 -0
  154. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetLayoutProperties.js +9 -0
  155. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetToggleOptionProperties.cjs +1 -0
  156. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetToggleOptionProperties.js +3 -0
  157. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetToggleProperties.cjs +12 -0
  158. package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetToggleProperties.js +13 -0
  159. package/dist/packages/components-v3/dist/ChatHeader/index.cjs +2 -0
  160. package/dist/packages/components-v3/dist/ChatHeader/index.js +4 -0
  161. package/dist/packages/components-v3/dist/ChatHeader/types/index.cjs +11 -0
  162. package/dist/packages/components-v3/dist/ChatHeader/types/index.js +10 -0
  163. package/dist/packages/components-v3/dist/ImageGallery/components/Layout.cjs +2 -2
  164. package/dist/packages/components-v3/dist/ImageGallery/components/Layout.js +2 -2
  165. package/dist/packages/components-v3/dist/PromptButton/PromptButton.cjs +1 -1
  166. package/dist/packages/components-v3/dist/PromptButton/PromptButton.js +1 -1
  167. package/dist/packages/components-v3/dist/PromptButton/components/Layout.cjs +1 -1
  168. package/dist/packages/components-v3/dist/PromptButton/components/Layout.js +1 -1
  169. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetLayoutBaseProperties.cjs +1 -1
  170. package/dist/packages/components-v3/dist/PromptButton/hooks/useGetLayoutBaseProperties.js +1 -1
  171. package/dist/packages/components-v3/dist/Tokens/index.cjs +11 -0
  172. package/dist/packages/components-v3/dist/Tokens/index.js +13 -0
  173. package/dist/packages/components-v3/dist/WelcomeMessage/WelcomeMessage.cjs +2 -0
  174. package/dist/packages/components-v3/dist/WelcomeMessage/WelcomeMessage.js +4 -0
  175. package/dist/packages/components-v3/dist/WelcomeMessage/components/Container.cjs +14 -0
  176. package/dist/packages/components-v3/dist/WelcomeMessage/components/Container.js +15 -0
  177. package/dist/packages/components-v3/dist/WelcomeMessage/components/SparkleIcon.cjs +3 -0
  178. package/dist/packages/components-v3/dist/WelcomeMessage/components/SparkleIcon.js +5 -0
  179. package/dist/packages/components-v3/dist/WelcomeMessage/components/Text.cjs +3 -0
  180. package/dist/packages/components-v3/dist/WelcomeMessage/components/Text.js +5 -0
  181. package/dist/packages/components-v3/dist/WelcomeMessage/components/Title.cjs +3 -0
  182. package/dist/packages/components-v3/dist/WelcomeMessage/components/Title.js +5 -0
  183. package/dist/packages/components-v3/dist/WelcomeMessage/components/index.cjs +4 -0
  184. package/dist/packages/components-v3/dist/WelcomeMessage/components/index.js +6 -0
  185. package/dist/packages/components-v3/dist/WelcomeMessage/hooks/useGetContainerProperties.cjs +1 -0
  186. package/dist/packages/components-v3/dist/WelcomeMessage/hooks/useGetContainerProperties.js +3 -0
  187. package/dist/packages/components-v3/dist/WelcomeMessage/hooks/useGetSparkleIconProperties.cjs +1 -0
  188. package/dist/packages/components-v3/dist/WelcomeMessage/hooks/useGetSparkleIconProperties.js +3 -0
  189. package/dist/packages/components-v3/dist/WelcomeMessage/index.cjs +2 -0
  190. package/dist/packages/components-v3/dist/WelcomeMessage/index.js +4 -0
  191. package/dist/packages/components-v3/dist/WelcomeMessage/types/types.cjs +14 -0
  192. package/dist/packages/components-v3/dist/WelcomeMessage/types/types.js +14 -0
  193. package/dist/packages/components-v3/dist/src/models/colorsConfig.cjs +26 -0
  194. package/dist/packages/components-v3/dist/src/models/colorsConfig.js +25 -0
  195. package/dist/packages/components-v3/dist/tokens/aspectRatio/aspectRatio.cjs +16 -0
  196. package/dist/packages/components-v3/dist/tokens/aspectRatio/aspectRatio.js +17 -0
  197. package/dist/packages/components-v3/dist/tokens/breakpoints/breakpoints.cjs +25 -0
  198. package/dist/packages/components-v3/dist/tokens/breakpoints/breakpoints.js +23 -0
  199. package/dist/packages/components-v3/dist/tokens/colors/colors.cjs +51 -0
  200. package/dist/packages/components-v3/dist/tokens/colors/colors.js +51 -0
  201. package/dist/packages/components-v3/dist/tokens/radius/radius.cjs +64 -0
  202. package/dist/packages/components-v3/dist/tokens/radius/radius.js +65 -0
  203. package/dist/packages/components-v3/dist/tokens/theme/theme.cjs +13 -0
  204. package/dist/packages/components-v3/dist/tokens/theme/theme.js +12 -0
  205. package/dist/packages/components-v3/dist/tokens/typography/fontFamily.cjs +25 -0
  206. package/dist/packages/components-v3/dist/tokens/typography/fontFamily.js +25 -0
  207. package/dist/packages/components-v3/dist/tokens/typography/fontSize.cjs +37 -0
  208. package/dist/packages/components-v3/dist/tokens/typography/fontSize.js +38 -0
  209. package/dist/packages/components-v3/dist/tokens/typography/fontWeight.cjs +17 -0
  210. package/dist/packages/components-v3/dist/tokens/typography/fontWeight.js +18 -0
  211. package/dist/packages/components-v3/dist/tokens/typography/letterSpacing.cjs +15 -0
  212. package/dist/packages/components-v3/dist/tokens/typography/letterSpacing.js +16 -0
  213. package/dist/packages/components-v3/dist/tokens/typography/lineHeight.cjs +31 -0
  214. package/dist/packages/components-v3/dist/tokens/typography/lineHeight.js +32 -0
  215. package/dist/packages/components-v3/dist/tokens/typography/typography.cjs +5 -0
  216. package/dist/packages/components-v3/dist/tokens/typography/typography.js +7 -0
  217. package/dist/packages/components-v3/dist/tokens/utils.cjs +7 -0
  218. package/dist/packages/components-v3/dist/tokens/utils.js +6 -0
  219. package/dist/packages/components-v3/dist/utils/useResponsiveValue.cjs +2 -2
  220. package/dist/packages/components-v3/dist/utils/useResponsiveValue.js +2 -2
  221. package/dist/packages/icons/dist/IconCloseRounded.cjs +22 -0
  222. package/dist/packages/icons/dist/IconCloseRounded.js +22 -0
  223. package/dist/packages/icons/dist/IconCloseSharp.cjs +31 -0
  224. package/dist/packages/icons/dist/IconCloseSharp.js +31 -0
  225. package/dist/packages/icons/dist/IconCloseTransparent.cjs +24 -0
  226. package/dist/packages/icons/dist/IconCloseTransparent.js +24 -0
  227. package/dist/packages/icons/dist/Sparkles.cjs +8 -0
  228. package/dist/packages/icons/dist/Sparkles.js +9 -0
  229. package/dist/types/customerService.cjs +20 -0
  230. package/dist/types/customerService.js +19 -0
  231. package/package.json +1 -5
  232. package/src/application/models/chatElementDisplayLocationV3.ts +6 -0
  233. package/src/application/models/featureGates.ts +6 -1
  234. package/src/application/models/guards/api/isApiPDPEventAttributes.ts +5 -1
  235. package/src/atoms/app/index.ts +7 -1
  236. package/src/atoms/app/variant.ts +3 -2
  237. package/src/atoms/envive/enviveConfig.ts +0 -11
  238. package/src/atoms/search/productRetrievalAPI.ts +0 -8
  239. package/src/atoms/search/productRetrievalAdapter.ts +6 -10
  240. package/src/contexts/amplitudeContext/__tests__/amplitudeContext.test.tsx +0 -1
  241. package/src/contexts/enviveContext/enviveContext.tsx +5 -3
  242. package/src/contexts/graphqlContext/graphqlContext.tsx +128 -9
  243. package/src/contexts/graphqlContext/mockV3Config.ts +53 -12
  244. package/src/contexts/hardcopyContext/hardcopyContext.tsx +29 -13
  245. package/src/contexts/pageContext/__tests__/pageContext.test.tsx +119 -69
  246. package/src/contexts/pageContext/mapping.ts +184 -2
  247. package/src/contexts/pageContext/pageContext.tsx +30 -5
  248. package/src/contexts/pageContext/types.ts +1 -2
  249. package/src/contexts/salesAgentContext/chatAPI.ts +9 -0
  250. package/src/contexts/salesAgentContext/salesAgentContext.tsx +10 -3
  251. package/src/contexts/salesAgentContext/salesAgentService.ts +13 -1
  252. package/src/contexts/typesV3.ts +52 -20
  253. package/src/contexts/uiConfigContext/__tests__/uiConfigContext.test.tsx +14 -6
  254. package/src/contexts/widgetConfigContext/__tests__/widgetConfigContext.test.tsx +1 -1
  255. package/src/hooks/ChatToggle/useChatToggle.ts +4 -4
  256. package/src/hooks/ElementObserver/useElementObserver.ts +9 -9
  257. package/src/merchants/domInsertion.ts +0 -16
  258. package/dist/hooks/ChatToggleAnalytics/index.cjs +0 -3
  259. package/dist/hooks/ChatToggleAnalytics/index.d.cts +0 -2
  260. package/dist/hooks/ChatToggleAnalytics/index.d.ts +0 -2
  261. package/dist/hooks/ChatToggleAnalytics/index.js +0 -3
  262. package/dist/hooks/ChatToggleAnalytics/useChatToggleAnalytics.cjs +0 -19
  263. package/dist/hooks/ChatToggleAnalytics/useChatToggleAnalytics.d.cts +0 -9
  264. package/dist/hooks/ChatToggleAnalytics/useChatToggleAnalytics.d.ts +0 -9
  265. package/dist/hooks/ChatToggleAnalytics/useChatToggleAnalytics.js +0 -18
  266. package/dist/packages/components-v3/dist/packages/components-v3/tokens/breakpoints/breakpoints.cjs +0 -25
  267. package/dist/packages/components-v3/dist/packages/components-v3/tokens/breakpoints/breakpoints.js +0 -23
  268. package/src/application/utils/cdnUtils.ts +0 -8
  269. package/src/config/divIds.ts +0 -31
  270. package/src/config/locators/components/chat/entrypoints.ts +0 -13
  271. package/src/config/locators/components/chat/preview.ts +0 -12
  272. package/src/config/locators/components/report-issue.ts +0 -21
  273. package/src/config/socialProofClasses.ts +0 -12
  274. package/src/events/registerAnalyticsListeners.ts +0 -44
  275. package/src/hooks/ChatToggleAnalytics/index.ts +0 -1
  276. package/src/hooks/ChatToggleAnalytics/useChatToggleAnalytics.ts +0 -15
  277. package/src/types/FilterAttribute.ts +0 -32
@@ -9,7 +9,11 @@ export const isApiPDPAttributes = (data: unknown): data is PDPAttributes => {
9
9
  return false;
10
10
  }
11
11
 
12
- if ('parent_product_id' in data && typeof data.parent_product_id !== 'string') {
12
+ if (
13
+ 'parent_product_id' in data &&
14
+ data.parent_product_id !== null &&
15
+ typeof data.parent_product_id === 'string'
16
+ ) {
13
17
  return false;
14
18
  }
15
19
 
@@ -18,7 +18,13 @@ export interface AppDetails {
18
18
  variantInfo: VariantInfo;
19
19
  }
20
20
 
21
- export { pageUserEventAtom, pageVariantInfoAtom, variantInfoAtom } from './variant';
21
+ export {
22
+ pageUserEventAtom,
23
+ pageVariantInfoAtom,
24
+ variantInfoAtom,
25
+ hasParsedVariantInfoAtom,
26
+ supportedEventAtom,
27
+ } from './variant';
22
28
 
23
29
  const internalUserIdAtom = atom<string | undefined>(undefined);
24
30
 
@@ -1,14 +1,15 @@
1
1
  import { atomWithStorage } from 'jotai/utils';
2
2
  import { atom } from 'jotai';
3
3
  import {
4
+ UserEvent as ApiUserEvent,
4
5
  PageVisitCategory,
5
6
  SupportedEventResponse,
6
- UserEvent,
7
7
  } from '@spiffy-ai/commerce-api-client';
8
8
  import {
9
9
  PDPVariantInfo,
10
10
  PLPVariantInfo,
11
11
  PageVisitVariantInfo,
12
+ UserEvent,
12
13
  VariantInfo,
13
14
  VariantTypeEnum,
14
15
  } from 'src/application/models';
@@ -92,7 +93,7 @@ export interface UrlResolverResponse {
92
93
  variant_type: string;
93
94
  specific_details: UrlResolvingPDPConfig | UrlResolvingPLPConfig | UrlResolvingGenericConfig;
94
95
  ready: boolean;
95
- user_event?: UserEvent;
96
+ user_event?: ApiUserEvent;
96
97
  page_variant?: BackendPageVariantConfig;
97
98
  }
98
99
 
@@ -72,14 +72,3 @@ export const orgShortNameAtom = atom(get => {
72
72
  Logger.logDebug('enviveConfig.ts: Accessing orgShortName', config);
73
73
  return config?.orgShortName;
74
74
  });
75
- export const identifyingPrefixAtom = atom(get => {
76
- const config = get(enviveConfigAtom);
77
- Logger.logDebug('enviveConfig.ts: Accessing identifyingPrefix', config);
78
- return config?.identifyingPrefix || 'spiffy';
79
- });
80
-
81
- export const publicKeyAtom = atom(get => {
82
- const config = get(enviveConfigAtom);
83
- Logger.logDebug('enviveConfig.ts: Accessing publicKey', config);
84
- return config?.publicKey;
85
- });
@@ -58,11 +58,3 @@ export const retrievedProductsAtom = atom(get => {
58
58
  const retrievalData = get(productRetrievalAtom).data;
59
59
  return retrievalData?.products || [];
60
60
  });
61
-
62
- export const productRetrievalLoadingAtom = atom(get => {
63
- return get(productRetrievalAtom).loading;
64
- });
65
-
66
- export const productRetrievalErrorAtom = atom(get => {
67
- return get(productRetrievalAtom).error;
68
- });
@@ -1,25 +1,21 @@
1
1
  import { ProductRetrievalParams, ProductRetrievalResult } from './types';
2
2
 
3
3
  // This will be set by the ProductRetrievalProvider when it initializes
4
- let productRetrievalFunction:
5
- | ((params: ProductRetrievalParams) => Promise<ProductRetrievalResult>)
6
- | null = null;
4
+ const productRetrievalAdapter: {
5
+ fn: ((params: ProductRetrievalParams) => Promise<ProductRetrievalResult>) | null;
6
+ } = { fn: null };
7
7
 
8
8
  export const setProductRetrievalFunction = (
9
9
  fn: (params: ProductRetrievalParams) => Promise<ProductRetrievalResult>,
10
10
  ) => {
11
- productRetrievalFunction = fn;
11
+ productRetrievalAdapter.fn = fn;
12
12
  };
13
13
 
14
14
  export const getProductRetrievalFunction = () => {
15
- if (!productRetrievalFunction) {
15
+ if (!productRetrievalAdapter.fn) {
16
16
  throw new Error(
17
17
  'Product retrieval function not initialized. Make sure ProductRetrievalProvider is mounted.',
18
18
  );
19
19
  }
20
- return productRetrievalFunction;
21
- };
22
-
23
- export const clearProductRetrievalFunction = () => {
24
- productRetrievalFunction = null;
20
+ return productRetrievalAdapter.fn;
25
21
  };
@@ -31,7 +31,6 @@ vi.mock('src/services/amplitudeService/amplitudeService', async () => {
31
31
  setSupplementalDefaultProps = mockSetSupplementalDefaultProps;
32
32
 
33
33
  get isReady(): boolean {
34
- // eslint-disable-next-line class-methods-use-this
35
34
  return mockIsReady();
36
35
  }
37
36
  }
@@ -50,6 +50,7 @@ interface EnviveProviderProps extends AgentWrapperProps {
50
50
  amplitudeService?: AmplitudeService;
51
51
  mockV3ConfigToDeprecatedConfig?: boolean;
52
52
  requestV3Config?: boolean;
53
+ previewMode?: boolean;
53
54
  }
54
55
 
55
56
  const SearchAgentWrapper: React.FC<AgentWrapperProps> = ({ children, enabledAgents }) => {
@@ -72,6 +73,7 @@ const SalesAgentWrapper: React.FC<AgentWrapperProps> = ({ children, enabledAgent
72
73
 
73
74
  export const EnviveProvider: React.FC<EnviveProviderProps> = ({
74
75
  children,
76
+ previewMode = false,
75
77
  enabledAgents,
76
78
  enviveConfigService: inputEnviveConfigService,
77
79
  featureFlagService: inputFeatureFlagService,
@@ -107,8 +109,8 @@ export const EnviveProvider: React.FC<EnviveProviderProps> = ({
107
109
  () => ({
108
110
  ...config,
109
111
  featureGates: enviveServiceConfig?.gates || [],
110
- orgShortName: enviveServiceConfig?.org.org.short_name || '',
111
- orgId: enviveServiceConfig?.org.org.id || '',
112
+ orgShortName: enviveServiceConfig?.org?.org?.short_name || '',
113
+ orgId: enviveServiceConfig?.org?.org?.id || '',
112
114
  }),
113
115
  [config, enviveServiceConfig],
114
116
  );
@@ -136,7 +138,7 @@ export const EnviveProvider: React.FC<EnviveProviderProps> = ({
136
138
  <FeatureFlagServiceProvider featureFlagService={featureFlagService}>
137
139
  <UserIdentityProvider>
138
140
  <AmplitudeProvider externalAmplitudeService={inputAmplitudeService}>
139
- <PageProvider>
141
+ <PageProvider previewMode={previewMode}>
140
142
  <UiConfigProvider>
141
143
  <WidgetConfigProvider>
142
144
  <HardcopyProvider>
@@ -20,8 +20,13 @@ import {
20
20
  import { FrontendConfigV3 } from 'src/application/models/frontendConfigV3';
21
21
  import { ColorMappingV3 } from 'src/application/models/colorsConfigV3';
22
22
  import { mockV3ColorsConfig, mockV3FrontendConfig } from './mockV3Config';
23
- import { ConfigVersionEnum, WidgetConfigV3 } from '../typesV3';
24
- import { OrgPageConfig, PageVariantConfig, WidgetMountingConfig } from '../types';
23
+ import { ConfigVersionEnum, Position, WidgetConfigV3 } from '../typesV3';
24
+ import {
25
+ OrgPageConfig,
26
+ PageVariantConfig,
27
+ PageVariantTestType,
28
+ WidgetMountingConfig,
29
+ } from '../types';
25
30
 
26
31
  interface BaseMeConfigQueryResponse {
27
32
  me: {
@@ -64,6 +69,7 @@ const colorsAndFrontendConfigQuery = () => `
64
69
  getProductsConfigByVersion(version: $version) {
65
70
  frontend { values }
66
71
  colors { values }
72
+ v_three_config { values }
67
73
  }
68
74
  }
69
75
  }
@@ -75,6 +81,114 @@ type GraphQLProviderProps = {
75
81
  mockV3ConfigToDeprecatedConfig?: boolean;
76
82
  };
77
83
 
84
+ const DEFAULT_PAGE_VARIANTS: PageVariantConfig[] = [
85
+ {
86
+ variantId: 'plp',
87
+ variantType: 'plp',
88
+ plpIdExtractor: 'url-resolver-plp-id',
89
+ widgetMounting: [],
90
+ variantTests: [
91
+ {
92
+ testType: PageVariantTestType.UrlResolver,
93
+ },
94
+ ],
95
+ },
96
+ {
97
+ variantId: 'pdp',
98
+ variantType: 'pdp',
99
+ productIdExtractor: 'url-resolver-product-id',
100
+ widgetMounting: [],
101
+ variantTests: [
102
+ {
103
+ testType: PageVariantTestType.UrlResolver,
104
+ },
105
+ ],
106
+ },
107
+ ];
108
+
109
+ const mapPositionToCamelCase = (position: string): Position => {
110
+ if (position === 'bottom-left') {
111
+ return 'bottomLeft';
112
+ }
113
+ if (position === 'middle-left') {
114
+ return 'middleLeft';
115
+ }
116
+ if (position === 'middle-right') {
117
+ return 'middleRight';
118
+ }
119
+ if (position === 'bottom-right') {
120
+ return 'bottomRight';
121
+ }
122
+ throw new Error(`Invalid position: ${position}`);
123
+ };
124
+
125
+ /**
126
+ * This function is used to do some additional cleanup of the v3 frontend config to ensure that the config is in the correct format.
127
+ */
128
+ const v3FrontendConfigCleanup = (
129
+ v3RootConfig: FrontendConfigV3Response,
130
+ ): FrontendConfigV3Response => {
131
+ const { uiConfigs } = v3RootConfig;
132
+ if (!uiConfigs) {
133
+ return v3RootConfig;
134
+ }
135
+ const { floatingButton, lookAndFeel } = uiConfigs as any;
136
+ if (!floatingButton || !lookAndFeel) {
137
+ return v3RootConfig;
138
+ }
139
+ const { fontSize, lineHeight } = lookAndFeel.typography as any;
140
+ return {
141
+ ...v3RootConfig,
142
+ uiConfigs: {
143
+ ...uiConfigs,
144
+ floatingButton: {
145
+ ...floatingButton,
146
+ position: mapPositionToCamelCase(
147
+ v3RootConfig.uiConfigs?.floatingButton?.position as string,
148
+ ),
149
+ },
150
+ lookAndFeel: {
151
+ ...lookAndFeel,
152
+ chatHeaderLogoDarkSrc: lookAndFeel.chatHeaderLogoDarkSrc || lookAndFeel.chatHeaderLogoSrc,
153
+ chatHeaderLogoLightSrc: lookAndFeel.chatHeaderLogoLightSrc || lookAndFeel.chatHeaderLogoSrc,
154
+ typography: {
155
+ ...lookAndFeel.typography,
156
+ fontSize: {
157
+ // The fonts sizes are defined differently in the backend config
158
+ // so we need to map the values to the correct camel case keys
159
+ b1: fontSize?.b1 || fontSize?.b_1,
160
+ b2: fontSize?.b2 || fontSize?.b_2,
161
+ b3: fontSize?.b3 || fontSize?.b_3,
162
+ b4: fontSize?.b4 || fontSize?.b_4,
163
+ b5: fontSize?.b5 || fontSize?.b_5,
164
+ h1: fontSize?.h1 || fontSize?.h_1,
165
+ h2: fontSize?.h2 || fontSize?.h_2,
166
+ h3: fontSize?.h3 || fontSize?.h_3,
167
+ l1: fontSize?.l1 || fontSize?.l_1,
168
+ l2: fontSize?.l2 || fontSize?.l_2,
169
+ t1: fontSize?.t1 || fontSize?.t_1,
170
+ t2: fontSize?.t2 || fontSize?.t_2,
171
+ t3: fontSize?.t3 || fontSize?.t_3,
172
+ },
173
+ lineHeight: {
174
+ ...lookAndFeel.typography.lineHeight,
175
+ '114': lineHeight?.lh_114 || lineHeight?.[114],
176
+ '116': lineHeight?.lh_116 || lineHeight?.[116],
177
+ '118': lineHeight?.lh_118 || lineHeight?.[118],
178
+ '120': lineHeight?.lh_120 || lineHeight?.[120],
179
+ '124': lineHeight?.lh_124 || lineHeight?.[124],
180
+ '128': lineHeight?.lh_128 || lineHeight?.[128],
181
+ '130': lineHeight?.lh_130 || lineHeight?.[130],
182
+ '133': lineHeight?.lh_133 || lineHeight?.[133],
183
+ '140': lineHeight?.lh_140 || lineHeight?.[140],
184
+ '148': lineHeight?.lh_148 || lineHeight?.[148],
185
+ },
186
+ },
187
+ },
188
+ },
189
+ };
190
+ };
191
+
78
192
  export const GraphQLProvider = ({
79
193
  children,
80
194
  requestV3Config = false,
@@ -127,10 +241,11 @@ export const GraphQLProvider = ({
127
241
  const response = await executeQuery(query);
128
242
 
129
243
  // We may update this root config location in the future
130
- const v3RootConfig =
131
- response.me.getProductsConfigByVersion?.frontend?.values?.ui_configs?.v_three_config;
244
+ const v3RootConfig = response.me.getProductsConfigByVersion?.v_three_config?.values;
132
245
 
133
- const v3FrontendConfig = transformSnakeToCamel(v3RootConfig) as FrontendConfigV3Response;
246
+ const v3FrontendConfig = v3FrontendConfigCleanup(
247
+ transformSnakeToCamel(v3RootConfig) as FrontendConfigV3Response,
248
+ );
134
249
 
135
250
  const v3MountingConfigsArray = (transformSnakeToCamel(v3RootConfig?.mounting_configs) ??
136
251
  []) as unknown as { key: string; config: WidgetMountingConfig }[];
@@ -151,9 +266,9 @@ export const GraphQLProvider = ({
151
266
  { widgetConfigId, ...rest } as WidgetConfigV3,
152
267
  ]),
153
268
  ) as Record<string, WidgetConfigV3>;
154
- const v3pageVariants = v3RootConfig?.page_variants.map(
155
- validateAndTransformPageVariants,
156
- ) as PageVariantConfig[];
269
+ const v3pageVariants: PageVariantConfig[] = Array.isArray(v3RootConfig?.page_variants)
270
+ ? v3RootConfig?.page_variants.map(validateAndTransformPageVariants)
271
+ : DEFAULT_PAGE_VARIANTS;
157
272
 
158
273
  const v3ColorsConfig = transformSnakeToCamel(v3RootConfig?.colors?.values);
159
274
 
@@ -172,7 +287,11 @@ export const GraphQLProvider = ({
172
287
 
173
288
  return {
174
289
  colorsConfig: v3ColorsConfig as ColorsConfigV3Response,
175
- frontendConfig: v3FrontendConfig as FrontendConfigV3Response,
290
+ frontendConfig: {
291
+ ...(v3FrontendConfig as FrontendConfigV3Response),
292
+ // Need to replace the automatic widget configs with the object based ones
293
+ widgetConfigs: v3WidgetConfigs,
294
+ },
176
295
  orgPageConfig: {
177
296
  pageVariants: v3pageVariants,
178
297
  widgetConfigs: v3WidgetConfigs,
@@ -3,8 +3,13 @@ import { ColorMappingV3, ColorNames, colorVar } from 'src/application/models/col
3
3
  import { CamelCasedPropertiesDeep } from 'src/application/models';
4
4
  import { ImageGalleryLayout } from '@envive-ai/react-toolkit-v3/ImageGallery';
5
5
  import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton';
6
- import { PromptCarouselRows, AnimationSpeed } from '@envive-ai/react-toolkit-v3/PromptCarousel';
6
+ import { AnimationSpeed, PromptCarouselRows } from '@envive-ai/react-toolkit-v3/PromptCarousel';
7
7
  import { WidgetWrapperVariant } from '@envive-ai/react-toolkit-v3/WidgetWrapper';
8
+ import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
9
+ import { ChatHeaderVariant } from '@envive-ai/react-toolkit-v3/ChatHeader';
10
+ import { SparkleIconColor } from '@envive-ai/react-toolkit-v3/WelcomeMessage';
11
+
12
+ import { CustomerServiceType } from 'src/types/customerService';
8
13
  import { ConfigVersionEnum, SocialProofWidgetKind, WidgetTypeV3 } from '../typesV3';
9
14
 
10
15
  const mockImages = [
@@ -49,13 +54,14 @@ export const mockV3FrontendConfig: FrontendConfigV3 = {
49
54
  version: ConfigVersionEnum.V3,
50
55
  shortName: 'Envive AI',
51
56
  lookAndFeel: {
52
- theme: 'standard',
57
+ theme: Theme.STANDARD,
53
58
  agentName: 'Envive AI',
54
- chatHeaderLogoSrc: 'https://cdn.spiffy.ai/other/assets/envive-ai/Envive_Logo_Lt.svg',
59
+ chatHeaderLogoDarkSrc: 'https://cdn.spiffy.ai/other/assets/envive-ai/Envive_Logo_DK.svg',
60
+ chatHeaderLogoLightSrc: 'https://cdn.spiffy.ai/other/assets/envive-ai/Envive_Logo_Lt.svg',
55
61
  widgetLogoSrc: 'https://cdn.spiffy.ai/other/assets/envive-ai/Envive_Logo_DK.svg',
56
62
  hideWidgetLogo: false,
57
63
  elementRadius: 8,
58
- imageAspectRatio: '3/4',
64
+ imageAspectRatio: '1/1',
59
65
  buttonColors: {
60
66
  lightButtonBackgroundColor: colorVar(ColorNames.BackgroundSecondary),
61
67
  lightButtonIconColor: colorVar(ColorNames.AccentPrimary),
@@ -105,22 +111,31 @@ export const mockV3FrontendConfig: FrontendConfigV3 = {
105
111
  },
106
112
  },
107
113
  floatingButton: {
108
- position: 'bottom-right',
109
- backgroundColor: colorVar(ColorNames.BackgroundPrimary),
110
- mode: 'light',
114
+ position: 'bottomRight',
115
+ backgroundColor: ColorNames.BackgroundPrimary,
116
+ mode: 'dark',
111
117
  showOption: 'always',
112
118
  style: 'attached',
113
119
  iconSVGSrc: '',
114
120
  },
115
121
  floatingChat: {
116
- headerBackgroundColor: colorVar(ColorNames.BackgroundPrimary),
117
- headerMode: 'dark',
118
- welcomeMessageIconColor: colorVar(ColorNames.AccentPrimary),
119
- showVerifiedBuyer: false,
120
- userCanEditQueries: true,
122
+ headerBackgroundColor: undefined,
123
+ headerMode: ChatHeaderVariant.DARK,
124
+ welcomeMessageIconColor: SparkleIconColor.ACCENT_PRIMARY,
125
+ showVerifiedBuyer: true,
126
+ userQueryInputEnabled: true,
121
127
  showEnviveLogo: true,
122
128
  ignoreFirstModelResponse: false,
123
129
  neverShowSingleProductCards: false,
130
+ welcomeMessageTitle: 'Welcome to Envive AI',
131
+ welcomeMessageText:
132
+ 'Your personal shopper trained on the collective knowledge of thousands of real experts!',
133
+ chatFooterTextFieldPlaceholderText: 'Ask me anything...',
134
+ },
135
+ customerServiceIntegration: {
136
+ provider: CustomerServiceType.unsupported,
137
+ enabled: false,
138
+ suppressMerchantButton: false,
124
139
  },
125
140
  },
126
141
  pageVariants: [],
@@ -205,5 +220,31 @@ export const mockV3FrontendConfig: FrontendConfigV3 = {
205
220
  secondaryButtonVariant: PromptButtonVariant.LIGHT,
206
221
  images: mockImages,
207
222
  },
223
+ 'typing-animation-test-light-widget': {
224
+ widgetConfigId: 'typing-animation-test-light-widget',
225
+ contentId: 'typing-animation-test-light-widget',
226
+ type: WidgetTypeV3.TypingAnimationV3,
227
+ widgetVariant: WidgetWrapperVariant.CARD_WITH_BORDER,
228
+ promptButtonType: PromptButtonVariant.LIGHT,
229
+ promptCarouselRows: PromptCarouselRows.ALWAYS_ONE,
230
+ showTextField: true,
231
+ },
232
+ 'typing-animation-test-dark-widget': {
233
+ widgetConfigId: 'typing-animation-test-dark-widget',
234
+ contentId: 'typing-animation-test-dark-widget',
235
+ type: WidgetTypeV3.TypingAnimationV3,
236
+ widgetVariant: WidgetWrapperVariant.CARD_WITH_BORDER,
237
+ promptButtonType: PromptButtonVariant.DARK,
238
+ promptCarouselRows: PromptCarouselRows.ALWAYS_ONE,
239
+ showTextField: true,
240
+ },
241
+ 'prompt-button-carousel-with-image-test-widget': {
242
+ widgetConfigId: 'prompt-button-carousel-with-image-test-widget',
243
+ contentId: 'prompt-button-carousel-with-image-test-widget',
244
+ type: WidgetTypeV3.PromptButtonCarouselWithImageV3,
245
+ promptButtonType: PromptButtonVariant.LIGHT,
246
+ image: mockImages[0],
247
+ hideTextField: false,
248
+ },
208
249
  },
209
250
  };
@@ -1,4 +1,3 @@
1
- import { UserEvent } from '@spiffy-ai/commerce-api-client';
2
1
  import { ReactNode, createContext, useCallback, useContext, useMemo, useState } from 'react';
3
2
  import Logger from 'src/application/logging/logger';
4
3
 
@@ -9,6 +8,7 @@ import { WidgetTextRequest } from 'src/application/models/api/widgetTextRequest'
9
8
  import { useAtomValue } from 'jotai';
10
9
  import { appDetailsAtom } from 'src/atoms/app';
11
10
  import { toCamelCase } from 'src/application/models/utils/snakeToCamelTransformer';
11
+ import { UserEvent } from 'src/application/models';
12
12
  import { WidgetTypeV3 } from '../typesV3';
13
13
  import { useFeatureFlagService } from '../featureFlagServiceContext/featureFlagServiceContext';
14
14
 
@@ -69,18 +69,6 @@ const MOCK_HARDCOPY_RESPONSE: Partial<Record<WidgetTypeV3, HardcopyResponse>> =
69
69
  ],
70
70
  },
71
71
  },
72
- [WidgetTypeV3.TypingAnimationV3]: {
73
- language: 'en',
74
- values: {
75
- chatPreviewTitle: 'Chat Preview Title',
76
- typewriterTextPrefix: 'Want to know',
77
- typewriterTexts: ['more about this product?', 'what others are saying?', 'how to use it?'],
78
- suggestionButtons: ['Button 1', 'Button 2', 'Button 3'],
79
- footerText: 'Ask me anything...',
80
-
81
- chatPreviewDescription: 'Chat Preview Description',
82
- },
83
- },
84
72
  [WidgetTypeV3.SocialProofV3]: {
85
73
  language: 'en',
86
74
  values: {
@@ -99,6 +87,26 @@ const MOCK_HARDCOPY_RESPONSE: Partial<Record<WidgetTypeV3, HardcopyResponse>> =
99
87
  textFieldPlaceholderText: 'Ask me anything...',
100
88
  },
101
89
  },
90
+ [WidgetTypeV3.TypingAnimationV3]: {
91
+ language: 'en',
92
+ values: {
93
+ titleLabel: 'Shopping Assistant',
94
+ headlineText: 'Need help finding',
95
+ animatedTextSequence: [
96
+ 'the perfect gift for your loved ones?',
97
+ 'something special for the holidays?',
98
+ 'the ideal present for someone special?',
99
+ ],
100
+ hintText: 'Ask me anything',
101
+ promptButtonTexts: [
102
+ 'What are your best sellers?',
103
+ 'Show me summer dresses',
104
+ 'Do you have free shipping?',
105
+ 'What sizes are available?',
106
+ ],
107
+ textFieldAriaLabel: 'Ask me anything',
108
+ },
109
+ },
102
110
  [WidgetTypeV3.ChatPreviewComparisonV3]: {
103
111
  language: 'en',
104
112
  values: {
@@ -121,6 +129,14 @@ const MOCK_HARDCOPY_RESPONSE: Partial<Record<WidgetTypeV3, HardcopyResponse>> =
121
129
  textFieldPlaceholderText: 'Ask me anything...',
122
130
  },
123
131
  },
132
+ [WidgetTypeV3.PromptButtonCarouselWithImageV3]: {
133
+ language: 'en',
134
+ values: {
135
+ titleLabel: 'Need some help?',
136
+ promptButtonsTexts: ['Help me find a product', "What's on your mind?", 'Talk to a human'],
137
+ textFieldPlaceholderText: 'Ask me anything...',
138
+ },
139
+ },
124
140
  };
125
141
 
126
142
  const HardcopyContext = createContext<HardcopyContextType | undefined>(undefined);