@envive-ai/react-widgets-v3 0.3.9 → 0.3.11

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 (229) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +2 -0
  2. package/dist/debug/GenericSelect.cjs +167 -0
  3. package/dist/debug/GenericSelect.js +165 -0
  4. package/dist/debug/MessageContent.cjs +151 -0
  5. package/dist/debug/MessageContent.js +149 -0
  6. package/dist/debug/chatEmbed.cjs +95 -0
  7. package/dist/debug/chatEmbed.js +92 -0
  8. package/dist/debug/debugBar.cjs +18 -0
  9. package/dist/debug/debugBar.js +17 -0
  10. package/dist/debug/reportIssue.cjs +528 -0
  11. package/dist/debug/reportIssue.js +524 -0
  12. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  13. package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
  14. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/apis/CustomerServiceApi.cjs +265 -0
  15. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/apis/DefaultApi.cjs +591 -0
  16. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/apis/InferenceApi.cjs +265 -0
  17. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/apis/ProductsApi.cjs +105 -0
  18. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/apis/SearchApi.cjs +229 -0
  19. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/apis/index.cjs +43 -0
  20. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/index.cjs +39 -0
  21. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/AddNoteToLatestConversationRequest.cjs +68 -0
  22. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/AddNoteToLatestConversationResponse.cjs +60 -0
  23. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/AddToCartAttributes.cjs +53 -0
  24. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/AnalyticsIdentifyRequest.cjs +86 -0
  25. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/AnalyticsTrackEventRequest.cjs +62 -0
  26. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/AttachmentRequest.cjs +63 -0
  27. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/AutoForm.cjs +55 -0
  28. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/Context.cjs +89 -0
  29. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ConversationStatus.cjs +63 -0
  30. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/CreateConversationRequest.cjs +68 -0
  31. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/CreateConversationResponse.cjs +64 -0
  32. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/CustServiceAttachment.cjs +68 -0
  33. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/CustServiceConversation.cjs +69 -0
  34. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/CustServiceConversationMessages.cjs +67 -0
  35. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/CustServiceCustomer.cjs +60 -0
  36. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/CustServiceMessage.cjs +85 -0
  37. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/CustomerServiceProvider.cjs +63 -0
  38. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/FormResponseAttributes.cjs +61 -0
  39. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/FormResponseAttributesFormCategory.cjs +55 -0
  40. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/FormSubmittedAttributes.cjs +65 -0
  41. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/FormType.cjs +61 -0
  42. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/FulfillmentDisplayStatus.cjs +84 -0
  43. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/GenerationParams.cjs +74 -0
  44. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/GetConversationMessagesRequest.cjs +61 -0
  45. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/IsBusinessHoursRequest.cjs +54 -0
  46. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/IsBusinessHoursResponse.cjs +59 -0
  47. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/LabelValue.cjs +60 -0
  48. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ManualForm.cjs +55 -0
  49. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/MerchRule.cjs +70 -0
  50. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/MerchRuleAction.cjs +62 -0
  51. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/MerchRuleActionAttribute.cjs +58 -0
  52. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/MerchRuleActionType.cjs +64 -0
  53. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/MerchRuleCondition.cjs +60 -0
  54. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/MerchRuleOp.cjs +61 -0
  55. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/MerchRuleStatus.cjs +62 -0
  56. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/NextMessageRequest.cjs +78 -0
  57. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/OrderItemInfo.cjs +78 -0
  58. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/OrderResponseAttributes.cjs +71 -0
  59. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/Organization.cjs +83 -0
  60. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/OrganizationConfig.cjs +82 -0
  61. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/OrganizationConfigResults.cjs +70 -0
  62. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/OrganizationSettings.cjs +62 -0
  63. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/PDPAttributes.cjs +61 -0
  64. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/PLPAttributeCategory.cjs +61 -0
  65. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/PLPAttributes.cjs +64 -0
  66. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/PLPAttributesAttributes.cjs +55 -0
  67. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/PLPIdAttributes.cjs +53 -0
  68. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/PLPUrlAttributes.cjs +53 -0
  69. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/PageVisitAttributes.cjs +62 -0
  70. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/PageVisitCategory.cjs +65 -0
  71. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ProductRetrievalRequest.cjs +62 -0
  72. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ProductRetrievalResponse.cjs +55 -0
  73. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ProductSearchFilterResponseAttributes.cjs +53 -0
  74. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ProductSearchRequest.cjs +71 -0
  75. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ProductSearchResponse.cjs +64 -0
  76. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ProductSearchResponseAttributes.cjs +60 -0
  77. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ProductSearchResponseV2.cjs +64 -0
  78. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/QueryTypedAttributes.cjs +53 -0
  79. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ReportContent.cjs +59 -0
  80. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ReportSessionRequest.cjs +99 -0
  81. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/Response.cjs +68 -0
  82. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ResponseCategory.cjs +69 -0
  83. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/ResponseProductAttributes.cjs +91 -0
  84. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/SearchAttributes.cjs +65 -0
  85. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/SearchResponseProduct.cjs +93 -0
  86. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/SearchSuggestionsResponse.cjs +58 -0
  87. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/SendMessageRequest.cjs +71 -0
  88. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/SendMessageResponse.cjs +55 -0
  89. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/StatsigExperiment.cjs +64 -0
  90. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/StatsigFeatureGate.cjs +62 -0
  91. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/Suggestion.cjs +70 -0
  92. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/SuggestionCategory.cjs +62 -0
  93. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/SuggestionClickedAttributes.cjs +53 -0
  94. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/SupportedEventProductCategory.cjs +62 -0
  95. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/SupportedEventRequest.cjs +67 -0
  96. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/SupportedEventResponse.cjs +78 -0
  97. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/TurnInfo.cjs +70 -0
  98. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/TurnInfoPrevUserEvent.cjs +60 -0
  99. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/UrlResolvingGenericConfig.cjs +52 -0
  100. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/UrlResolvingPDPConfig.cjs +65 -0
  101. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/UrlResolvingPLPConfig.cjs +61 -0
  102. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/UrlResolvingRequest.cjs +65 -0
  103. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/UrlResolvingResponse.cjs +73 -0
  104. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/UrlResolvingResponseSpecificDetails.cjs +59 -0
  105. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/UrlResolvingType.cjs +67 -0
  106. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/UserEvent.cjs +69 -0
  107. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/UserEventAttributes.cjs +75 -0
  108. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/UserEventCategory.cjs +70 -0
  109. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/V1GetSessionMessages200Response.cjs +67 -0
  110. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/V1SearchExplainGet200Response.cjs +63 -0
  111. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/WidgetString.cjs +60 -0
  112. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/WidgetTextRequest.cjs +73 -0
  113. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/WidgetTextResponse.cjs +66 -0
  114. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/WidgetType.cjs +69 -0
  115. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/index.cjs +221 -0
  116. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/runtime.cjs +324 -0
  117. package/dist/node_modules/react-icons/fa/index.cjs +65 -0
  118. package/dist/node_modules/react-icons/fa/index.js +61 -0
  119. package/dist/node_modules/react-icons/lib/iconBase.cjs +121 -0
  120. package/dist/node_modules/react-icons/lib/iconBase.js +119 -0
  121. package/dist/node_modules/react-icons/lib/iconContext.cjs +17 -0
  122. package/dist/node_modules/react-icons/lib/iconContext.js +14 -0
  123. package/dist/packages/icons/dist/IconCloseVariant.cjs +22 -0
  124. package/dist/packages/icons/dist/IconCloseVariant.js +22 -0
  125. package/dist/packages/icons/dist/_virtual/rolldown_runtime.cjs +27 -0
  126. package/dist/packages/icons/dist/_virtual/rolldown_runtime.js +25 -0
  127. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +696 -0
  128. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.js +696 -0
  129. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.cjs +43 -0
  130. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +43 -0
  131. package/dist/packages/icons/dist/node_modules/react/cjs/react.development.cjs +1528 -0
  132. package/dist/packages/icons/dist/node_modules/react/cjs/react.development.js +1528 -0
  133. package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.cjs +329 -0
  134. package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.js +329 -0
  135. package/dist/packages/icons/dist/node_modules/react/index.cjs +13 -0
  136. package/dist/packages/icons/dist/node_modules/react/index.js +13 -0
  137. package/dist/packages/icons/dist/node_modules/react/jsx-runtime.cjs +13 -0
  138. package/dist/packages/icons/dist/node_modules/react/jsx-runtime.js +13 -0
  139. package/dist/{widgets → packages/widgets}/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
  140. package/dist/{widgets → packages/widgets}/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
  141. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
  142. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  143. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  144. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
  145. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  146. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +2 -2
  147. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +1 -1
  148. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +2 -0
  149. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
  150. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
  151. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +2 -0
  152. package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.cjs +4 -1
  153. package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.js +5 -2
  154. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.cjs +31 -0
  155. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +15 -0
  156. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +15 -0
  157. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +30 -0
  158. package/dist/widgets/FullPageSalesAgentWidget/index.cjs +3 -0
  159. package/dist/widgets/FullPageSalesAgentWidget/index.d.cts +2 -0
  160. package/dist/widgets/FullPageSalesAgentWidget/index.d.ts +2 -0
  161. package/dist/widgets/FullPageSalesAgentWidget/index.js +3 -0
  162. package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +2 -1
  163. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
  164. package/dist/widgets/ProductCardWidget/ProductCardWidget.js +2 -1
  165. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +2 -1
  166. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  167. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  168. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +2 -1
  169. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +26 -2
  170. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  171. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  172. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +27 -3
  173. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +1 -1
  174. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
  175. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +1 -1
  176. package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +4 -2
  177. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  178. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  179. package/dist/widgets/SocialProofWidget/SocialProofWidget.js +4 -2
  180. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +2 -1
  181. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  182. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  183. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +2 -1
  184. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +1 -1
  185. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  186. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  187. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +1 -1
  188. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +2 -1
  189. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
  190. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  191. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +2 -1
  192. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  193. package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
  194. package/dist/widgets-v2/SearchResults/index.d.ts +3 -3
  195. package/dist/widgets-v2/SearchZeroState/index.d.ts +4 -4
  196. package/dist/widgets-v2/SuggestionBar/index.d.ts +3 -3
  197. package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +2 -2
  198. package/package.json +5 -1
  199. package/src/debug/GenericSelect.tsx +236 -0
  200. package/src/debug/MessageContent.tsx +248 -0
  201. package/src/debug/chatEmbed.tsx +119 -0
  202. package/src/debug/debugBar.tsx +13 -0
  203. package/src/debug/reportIssue.tsx +649 -0
  204. package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +6 -0
  205. package/src/stories/FullPageSalesAgentWidget.stories.tsx +68 -0
  206. package/src/stories/SalesAgentTest/SalesAgentTest.tsx +10 -2
  207. package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +2 -0
  208. package/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.ts +11 -5
  209. package/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx +46 -0
  210. package/src/widgets/FullPageSalesAgentWidget/index.ts +1 -0
  211. package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +5 -1
  212. package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +6 -1
  213. package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +31 -2
  214. package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +10 -2
  215. package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +5 -1
  216. package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +5 -1
  217. /package/dist/{widgets → packages/widgets}/dist/SearchResults/SearchResults.d.ts +0 -0
  218. /package/dist/{widgets → packages/widgets}/dist/SearchResults/index.d.ts +0 -0
  219. /package/dist/{widgets → packages/widgets}/dist/SearchResults/types.d.ts +0 -0
  220. /package/dist/{widgets → packages/widgets}/dist/SearchZeroState/SearchZeroState.d.ts +0 -0
  221. /package/dist/{widgets → packages/widgets}/dist/SearchZeroState/index.d.ts +0 -0
  222. /package/dist/{widgets → packages/widgets}/dist/SearchZeroState/types.d.ts +0 -0
  223. /package/dist/{widgets → packages/widgets}/dist/SuggestionBar/SuggestionBar.d.ts +0 -0
  224. /package/dist/{widgets → packages/widgets}/dist/SuggestionBar/index.d.ts +0 -0
  225. /package/dist/{widgets → packages/widgets}/dist/SuggestionBar/types.d.ts +0 -0
  226. /package/dist/{widgets → packages/widgets}/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.ts +0 -0
  227. /package/dist/{widgets → packages/widgets}/dist/SuggestionButtonContainer/types.d.ts +0 -0
  228. /package/dist/{widgets → packages/widgets}/dist/config/BaseWidgetConfig.d.ts +0 -0
  229. /package/dist/{widgets → packages/widgets}/dist/config/WidgetType.d.ts +0 -0
@@ -0,0 +1,528 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_index = require('../node_modules/@spiffy-ai/commerce-api-client/dist/index.cjs');
3
+ const require_IconCloseVariant = require('../packages/icons/dist/IconCloseVariant.cjs');
4
+ const require_GenericSelect = require('./GenericSelect.cjs');
5
+ const require_chatEmbed = require('./chatEmbed.cjs');
6
+ let react = require("react");
7
+ let react_jsx_runtime = require("react/jsx-runtime");
8
+ let jotai = require("jotai");
9
+ let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
10
+ let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
11
+ let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
12
+ let classnames = require("classnames");
13
+ classnames = require_rolldown_runtime.__toESM(classnames);
14
+ let __envive_ai_react_hooks_application_commerce_api = require("@envive-ai/react-hooks/application/commerce-api");
15
+ __envive_ai_react_hooks_application_commerce_api = require_rolldown_runtime.__toESM(__envive_ai_react_hooks_application_commerce_api);
16
+ let __envive_ai_react_hooks_atoms_envive_enviveConfig = require("@envive-ai/react-hooks/atoms/envive/enviveConfig");
17
+ let __envive_ai_react_hooks_application_utils = require("@envive-ai/react-hooks/application/utils");
18
+
19
+ //#region src/debug/reportIssue.tsx
20
+ var import_dist = require_index.default;
21
+ const messageContent = (m) => {
22
+ if (m.type === __envive_ai_react_hooks_application_models.MessageType.Text) return m.metadata.content;
23
+ if (m.type === __envive_ai_react_hooks_application_models.MessageType.Product) return `PRODUCT ID: ${m.metadata?.id}`;
24
+ if (m.type === __envive_ai_react_hooks_application_models.MessageType.Review) return `REVIEW: by ${m.metadata?.reviewer}`;
25
+ if (m.type === __envive_ai_react_hooks_application_models.MessageType.Page) return `PAGE: ${m.metadata?.url}`;
26
+ if (m.type === __envive_ai_react_hooks_application_models.MessageType.Separator) return `SEPARATOR`;
27
+ if (m.type === __envive_ai_react_hooks_application_models.MessageType.QueryTyped) return `QUERY TYPED: ${m.metadata?.content}`;
28
+ if (m.type === __envive_ai_react_hooks_application_models.MessageType.SuggestionClicked) return `SUGGESTION CLICKED`;
29
+ if (m.type === __envive_ai_react_hooks_application_models.MessageType.Search) return `SEARCH: ${m.metadata?.searchTerm}`;
30
+ if (m.type === __envive_ai_react_hooks_application_models.MessageType.ProductSearch) return `PRODUCT SEARCH: ${m.metadata?.generatedQuery} (${m.metadata?.productCount} products)`;
31
+ if (m.type === __envive_ai_react_hooks_application_models.MessageType.ProductSearchFilter) return `PRODUCT SEARCH FILTER: ${m.metadata?.filterName}`;
32
+ if (m.type === __envive_ai_react_hooks_application_models.MessageType.Form) return `FORM: ${m.metadata?.formType}`;
33
+ if (m.type === __envive_ai_react_hooks_application_models.MessageType.Order) return `ORDER: ${m.metadata?.orderId}`;
34
+ throw new Error(`Unsupported message type: ${m.type}`);
35
+ };
36
+ const ReportHeader = ({ onClose }) => {
37
+ const userId = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.userIdAtom);
38
+ const handleCopyClick = (0, react.useCallback)(async () => {
39
+ try {
40
+ await navigator.clipboard.writeText(userId);
41
+ } catch (err) {
42
+ console.error("Failed to copy to clipboard:", err);
43
+ }
44
+ }, [userId]);
45
+ const headerTitleClassnames = (0, classnames.default)({
46
+ "envive-tw-text-[24px]": true,
47
+ "md:envive-tw-text-[30px]": true,
48
+ "envive-tw-mb-[12px]": true,
49
+ "envive-tw-color-[#161844]": true,
50
+ "envive-tw-leading-[1.33]": true,
51
+ "md:envive-tw-leading-[1.2]": true,
52
+ "envive-tw-font-bold": true
53
+ });
54
+ const headerLinkClassnames = (0, classnames.default)({
55
+ "envive-tw-underline": true,
56
+ "envive-tw-text-[#3C57AA]": true,
57
+ "hover:envive-tw-text-[#3C57AA]": true
58
+ });
59
+ const headerDescriptionClassnames = (0, classnames.default)({
60
+ "envive-tw-text-[16px]": true,
61
+ "envive-tw-text-normal": true,
62
+ "envive-tw-font-medium": true,
63
+ "envive-tw-max-w-[70ch]": true,
64
+ "envive-tw-text-[#161844]": true
65
+ });
66
+ const userIdClassnames = (0, classnames.default)({
67
+ "envive-tw-text-xs": true,
68
+ "envive-tw-text-gray-500": true,
69
+ "envive-tw-font-semibold": true
70
+ });
71
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
72
+ className: "envive-tw-pb-0 envive-tw-mb-[24px] envive-tw-flex envive-tw-w-full envive-tw-flex-row envive-tw-items-start envive-tw-justify-between envive-tw-gap-3 envive-tw-px-[24px] envive-tw-pt-[24px]",
73
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
74
+ className: "envive-tw-flex envive-tw-w-full envive-tw-flex-col envive-tw-items-stretch envive-tw-gap-3",
75
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
76
+ className: "envive-tw-flex envive-tw-flex-row envive-tw-items-start envive-tw-justify-between envive-tw-gap-3",
77
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
78
+ className: "envive-tw-max-w-[100%]",
79
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
80
+ className: headerTitleClassnames,
81
+ children: "Give us feedback on this message"
82
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
83
+ className: headerDescriptionClassnames,
84
+ children: [
85
+ "For UI bugs and Feature Ideas, please use",
86
+ " ",
87
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
88
+ href: "https://spiffy-ai.notion.site/19fe47c0828780b1a6cfd0ac4373cebe",
89
+ target: "_blank",
90
+ rel: "noopener noreferrer",
91
+ className: headerLinkClassnames,
92
+ children: "this form"
93
+ }),
94
+ "."
95
+ ]
96
+ })]
97
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
98
+ className: "envive-tw-flex envive-tw-flex-col envive-tw-items-end envive-tw-gap-3",
99
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
100
+ className: "envive-tw-flex envive-tw-flex-row envive-tw-items-center envive-tw-gap-2",
101
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
102
+ className: userIdClassnames,
103
+ children: [
104
+ "User Id: ",
105
+ userId.slice(0, 4),
106
+ "..."
107
+ ]
108
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
109
+ type: "button",
110
+ onClick: handleCopyClick,
111
+ "aria-label": "Copy chat ID",
112
+ className: "envive-tw-rounded-base envive-tw-border envive-tw-border-gray-300 envive-tw-px-2 envive-tw-py-0.5 envive-tw-text-xs envive-tw-font-bold hover:envive-tw-bg-gray-50",
113
+ children: "Copy"
114
+ })]
115
+ })
116
+ })]
117
+ })
118
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
119
+ type: "button",
120
+ className: "envive-tw-p-0 envive-tw-h-[16px] envive-tw-w-[16px]",
121
+ onClick: onClose,
122
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_IconCloseVariant.IconCloseVariant_default, {})
123
+ })]
124
+ });
125
+ };
126
+ const ReportFormFields = ({ priority, setPriority, reportedBy, onReportedByChanging, reason, onDescriptionChanging, turnInfo, setTurnInfo, lastMessagesText, lastSuggestionsText }) => {
127
+ const requiredFieldClassnames = (0, classnames.default)({
128
+ "envive-tw-text-[#008000]": true,
129
+ "envive-tw-text-xs": true,
130
+ "envive-tw-font-normal": true,
131
+ "envive-tw-italic": true
132
+ });
133
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
134
+ onSubmit: (e) => {
135
+ e.preventDefault();
136
+ },
137
+ className: "envive-tw-pt-0 envive-tw-flex envive-tw-flex-col envive-tw-gap-[24px] envive-tw-px-[24px] envive-tw-pb-[8px]",
138
+ children: [
139
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
140
+ className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2",
141
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
142
+ className: "envive-tw-flex envive-tw-flex-row envive-tw-items-center envive-tw-gap-3",
143
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
144
+ id: "priority-label",
145
+ className: "envive-tw-mb-0 envive-tw-flex envive-tw-shrink-0 envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]",
146
+ children: "Priority"
147
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_GenericSelect.GenericSelect, {
148
+ type: "priority",
149
+ selectedKey: priority,
150
+ onSelect: (key) => {
151
+ setPriority(key);
152
+ },
153
+ "aria-labelledby": "priority-label"
154
+ })]
155
+ })
156
+ }),
157
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
158
+ className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2",
159
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
160
+ id: "email-label",
161
+ className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]",
162
+ children: ["Your Email", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
163
+ className: requiredFieldClassnames,
164
+ children: "* Required so we can follow up with you"
165
+ })]
166
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
167
+ className: "envive-tw-rounded-md envive-tw-w-full envive-tw-border envive-tw-border-gray-300 envive-tw-px-3 envive-tw-py-2 envive-tw-text-sm",
168
+ placeholder: "Email address",
169
+ value: reportedBy,
170
+ type: "email",
171
+ onChange: onReportedByChanging,
172
+ "aria-labelledby": "email-label"
173
+ })]
174
+ }),
175
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
176
+ className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-[0]",
177
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
178
+ id: "chat-history-label",
179
+ className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]",
180
+ children: "Chat History"
181
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
182
+ className: "envive-tw-rounded-md envive-tw-h-[250px] envive-tw-w-full envive-tw-overflow-auto envive-tw-border envive-tw-border-[#D9D9D9] envive-tw-p-2",
183
+ "aria-labelledby": "chat-history-label",
184
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chatEmbed.default, {})
185
+ })]
186
+ }),
187
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
188
+ className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2",
189
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
190
+ id: "description-label",
191
+ className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]",
192
+ children: ["What is the problem with this message?", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
193
+ className: requiredFieldClassnames,
194
+ children: "* Required to train the model and generate the correct message"
195
+ })]
196
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
197
+ className: "envive-tw-rounded-md envive-tw-w-full envive-tw-border envive-tw-border-gray-300 envive-tw-px-3 envive-tw-py-2 envive-tw-text-sm",
198
+ placeholder: "Please describe the issue",
199
+ value: reason,
200
+ onChange: onDescriptionChanging,
201
+ "aria-labelledby": "description-label"
202
+ })]
203
+ }),
204
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
205
+ className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2",
206
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
207
+ id: "message-correction-label",
208
+ className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]",
209
+ children: ["What should the message have said?", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
210
+ className: "envive-tw-text-xs envive-tw-font-normal envive-tw-italic envive-tw-text-gray-500",
211
+ children: "Creating an alternative message will ensure the AI sounds the way you want."
212
+ })]
213
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
214
+ className: "envive-tw-rounded-md envive-tw-w-full envive-tw-border envive-tw-border-gray-300 envive-tw-px-3 envive-tw-py-2 envive-tw-text-sm",
215
+ placeholder: "Alternative phrasing of the message",
216
+ value: turnInfo.message_correction ?? lastMessagesText,
217
+ onChange: (e) => setTurnInfo(e, "message_correction"),
218
+ rows: 10,
219
+ "aria-labelledby": "message-correction-label"
220
+ })]
221
+ }),
222
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
223
+ className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2",
224
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
225
+ id: "suggested-responses-label",
226
+ className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]",
227
+ children: "What should the suggested responses for the user be?"
228
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
229
+ className: "envive-tw-rounded-md envive-tw-w-full envive-tw-border envive-tw-border-gray-300 envive-tw-px-3 envive-tw-py-2 envive-tw-text-sm",
230
+ placeholder: "Alternative suggested responses",
231
+ value: turnInfo.suggestions_correction ?? lastSuggestionsText,
232
+ onChange: (e) => setTurnInfo(e, "suggestions_correction"),
233
+ rows: 6,
234
+ "aria-labelledby": "suggested-responses-label"
235
+ })]
236
+ })
237
+ ]
238
+ });
239
+ };
240
+ const ReportFooter = ({ isReporting, errorMessage, reportedByIsInvalid, isReasonInvalid, onReportSession, onClose }) => {
241
+ const sendFeedbackButtonClassnames = (0, classnames.default)({
242
+ "envive-tw-flex": true,
243
+ "envive-tw-w-full": true,
244
+ "sm:envive-tw-w-[180px]": true,
245
+ "envive-tw-h-10": true,
246
+ "envive-tw-py-2.5": true,
247
+ "envive-tw-px-6": true,
248
+ "envive-tw-justify-center": true,
249
+ "envive-tw-items-center": true,
250
+ "envive-tw-gap-2": true,
251
+ "envive-tw-rounded-full": true,
252
+ "envive-tw-border": true,
253
+ "envive-tw-border-[#3C57AA]": true,
254
+ "envive-tw-bg-[#3C57AA]": true,
255
+ "envive-tw-text-white": true,
256
+ "hover:envive-tw-bg-[#2B4A8A]": true,
257
+ "disabled:envive-tw-opacity-50": true,
258
+ "disabled:envive-tw-cursor-not-allowed": true
259
+ });
260
+ const cancelButtonClassnames = (0, classnames.default)({
261
+ "envive-tw-flex": true,
262
+ "envive-tw-w-full": true,
263
+ "sm:envive-tw-w-[171px]": true,
264
+ "envive-tw-h-10": true,
265
+ "envive-tw-py-2.5": true,
266
+ "envive-tw-px-6": true,
267
+ "envive-tw-justify-center": true,
268
+ "envive-tw-items-center": true,
269
+ "envive-tw-gap-2": true,
270
+ "envive-tw-rounded-full": true,
271
+ "envive-tw-border": true,
272
+ "envive-tw-border-[#3C57AA]": true,
273
+ "envive-tw-text-[#3C57AA]": true,
274
+ "envive-tw-text-center": true,
275
+ "envive-tw-text-base": true,
276
+ "envive-tw-font-medium": true,
277
+ "envive-tw-bg-[#EDF2F7]": true,
278
+ "hover:envive-tw-bg-[#F5F5F5]": true,
279
+ "disabled:envive-tw-opacity-50": true,
280
+ "disabled:envive-tw-cursor-not-allowed": true
281
+ });
282
+ const buttonFooterClassnames = (0, classnames.default)({
283
+ "envive-tw-flex": true,
284
+ "envive-tw-items-start": true,
285
+ "envive-tw-gap-6": true,
286
+ "envive-tw-justify-start": true,
287
+ "envive-tw-p-0": true,
288
+ "envive-tw-shadow-none": true,
289
+ "envive-tw-flex-0": true,
290
+ "envive-tw-flex-auto": true,
291
+ "envive-tw-flex-col": true,
292
+ "sm:envive-tw-flex-row": true,
293
+ "envive-tw-w-full": true,
294
+ "envive-tw-bottom-0": true,
295
+ "envive-tw-z-[1]": true
296
+ });
297
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
298
+ className: (0, classnames.default)({
299
+ "envive-tw-bg-[#FFFFFF70]": true,
300
+ "envive-tw-py-[24px]": true,
301
+ "envive-tw-sticky": true,
302
+ "envive-tw-bottom-0": true,
303
+ "envive-tw-w-full": true,
304
+ "envive-tw-px-[24px]": true,
305
+ "envive-tw-border-t": true,
306
+ "envive-tw-border-[#EBEBEB]": true
307
+ }),
308
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
309
+ className: buttonFooterClassnames,
310
+ children: [
311
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
312
+ type: "button",
313
+ disabled: isReporting || reportedByIsInvalid || isReasonInvalid,
314
+ onClick: onReportSession,
315
+ className: sendFeedbackButtonClassnames,
316
+ children: isReporting ? "Sending..." : "Send Feedback"
317
+ }),
318
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
319
+ type: "button",
320
+ disabled: isReporting,
321
+ onClick: onClose,
322
+ className: cancelButtonClassnames,
323
+ children: "Cancel"
324
+ }),
325
+ errorMessage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
326
+ className: "envive-tw-text-xs envive-tw-font-normal envive-tw-italic envive-tw-text-red-500",
327
+ children: errorMessage
328
+ })
329
+ ]
330
+ })
331
+ });
332
+ };
333
+ const Drawer = ({ isOpen, onClose, children, width = "md:envive-tw-w-[80%] lg:envive-tw-w-[67%]" }) => {
334
+ if (!isOpen) return null;
335
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
336
+ className: "envive-tw-fixed envive-tw-right-[0] envive-tw-top-[0] envive-tw-z-[9999] envive-tw-flex envive-tw-w-full envive-tw-flex-row envive-tw-justify-end",
337
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
338
+ className: "envive-tw-bg envive-tw-flex-grow envive-tw-bg-black/40",
339
+ onClick: onClose
340
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
341
+ className: `envive-tw-w-full ${width} envive-tw-h-screen`,
342
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
343
+ className: "envive-tw-min-h-0 envive-tw-px-0 envive-tw-relative envive-tw-flex envive-tw-h-screen envive-tw-w-full envive-tw-flex-col envive-tw-border envive-tw-border-solid envive-tw-border-[#0000ff] envive-tw-bg-white",
344
+ children
345
+ })
346
+ })]
347
+ });
348
+ };
349
+ const ReportIssue = () => {
350
+ const { messages, suggestions, userEvents } = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.chatAtom);
351
+ const lastMessages = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
352
+ const [lastMessagesText, setLastMessagesText] = (0, react.useState)("");
353
+ const [lastSuggestionsText, setLastSuggestionsText] = (0, react.useState)("");
354
+ const [lastSuggestions, setLastSuggestions] = (0, react.useState)([]);
355
+ const [isOpen, setIsOpen] = (0, react.useState)(false);
356
+ const [turnInfo, setTurnInfo] = (0, react.useState)({});
357
+ const reportType = import_dist.ReportSessionRequestReportTypeEnum.Turn;
358
+ const [isReasonInvalid, setIsReasonInvalid] = (0, react.useState)(true);
359
+ const [reason, setReason] = (0, react.useState)("");
360
+ const [reportedBy, setReportedBy] = (0, react.useState)("");
361
+ const [reportedByIsInvalid, setReportedByIsInvalid] = (0, react.useState)(true);
362
+ const [isReporting, setIsReporting] = (0, react.useState)(false);
363
+ const [errorMessage, setErrorMessage] = (0, react.useState)("");
364
+ const [priority, setPriority] = (0, react.useState)(import_dist.ReportSessionRequestReportPriorityEnum.NoPriority);
365
+ const userId = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.userIdAtom);
366
+ const orgShortName = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_envive_enviveConfig.orgShortNameAtom);
367
+ const lastUserEvent = userEvents && userEvents.length > 0 ? userEvents[userEvents.length - 1] : void 0;
368
+ const onOpen = (0, react.useCallback)(() => setIsOpen(true), []);
369
+ const onClose = (0, react.useCallback)(() => setIsOpen(false), []);
370
+ (0, react.useEffect)(() => {
371
+ if (messages) {
372
+ const currentMessages = messages.length > 0 ? messages[messages.length - 1] : [];
373
+ if (currentMessages.length > 0 && lastUserEvent) setTurnInfo((prev) => ({
374
+ ...prev,
375
+ turn_idx: currentMessages.length - 1
376
+ }));
377
+ }
378
+ }, [messages]);
379
+ (0, react.useEffect)(() => {
380
+ if (suggestions) setLastSuggestions(suggestions);
381
+ else setLastSuggestions([]);
382
+ }, [suggestions]);
383
+ (0, react.useEffect)(() => {
384
+ if (lastUserEvent) setTurnInfo((prev) => ({
385
+ ...prev,
386
+ prev_user_event: {
387
+ id: lastUserEvent.eventId,
388
+ category: lastUserEvent.category
389
+ }
390
+ }));
391
+ else setTurnInfo((prev) => ({
392
+ ...prev,
393
+ prev_user_event: void 0
394
+ }));
395
+ }, [lastUserEvent]);
396
+ (0, react.useEffect)(() => {
397
+ if (lastMessages) {
398
+ setLastMessagesText(lastMessages.filter((m) => m.type !== __envive_ai_react_hooks_application_models.MessageType.Separator).map((m) => messageContent(m)).join("\n\n"));
399
+ setTurnInfo((prev) => ({
400
+ ...prev,
401
+ messages: lastMessages.map((m) => ({
402
+ id: m.id,
403
+ content: messageContent(m)
404
+ }))
405
+ }));
406
+ }
407
+ }, [lastMessages]);
408
+ (0, react.useEffect)(() => {
409
+ if (lastSuggestions) {
410
+ const sortedSuggestions = [...lastSuggestions.filter((s) => s.is_answer), ...lastSuggestions.filter((s) => !s.is_answer)];
411
+ setLastSuggestionsText(`- ${sortedSuggestions.map((s) => s.content).join("\n- ")}`);
412
+ setTurnInfo((prev) => ({
413
+ ...prev,
414
+ suggestions: sortedSuggestions.map((s) => ({
415
+ id: s.id,
416
+ content: s.content
417
+ }))
418
+ }));
419
+ }
420
+ }, [lastSuggestions]);
421
+ const reportSession = (0, react.useCallback)(async () => {
422
+ try {
423
+ setIsReporting(true);
424
+ setErrorMessage("");
425
+ const request = {
426
+ user_id: userId,
427
+ reported_by: reportedBy,
428
+ org_short_name: orgShortName,
429
+ report_priority: priority,
430
+ reason,
431
+ turn_info: turnInfo,
432
+ report_type: reportType
433
+ };
434
+ console.info("Submitting report", request);
435
+ await __envive_ai_react_hooks_application_commerce_api.default.reportSession(request);
436
+ onClose();
437
+ } catch (error) {
438
+ console.error("Error sending report", error);
439
+ setErrorMessage("There was an error sending the report. Please try again or contact Envive Support.");
440
+ } finally {
441
+ setIsReporting(false);
442
+ }
443
+ }, [
444
+ userId,
445
+ reportedBy,
446
+ orgShortName,
447
+ priority,
448
+ reason,
449
+ turnInfo,
450
+ reportType,
451
+ onClose
452
+ ]);
453
+ const onReportedByChanging = (0, react.useCallback)((e) => {
454
+ const reportedByValue = e.target.value;
455
+ const isEmail = (0, __envive_ai_react_hooks_application_utils.validateEmail)(reportedByValue);
456
+ setReportedByIsInvalid(!reportedByValue || !isEmail);
457
+ setReportedBy(reportedByValue);
458
+ }, []);
459
+ const onDescriptionChanging = (0, react.useCallback)((e) => {
460
+ const descriptionValue = e.target.value;
461
+ setIsReasonInvalid(__envive_ai_react_hooks_application_utils.StringUtils.isNullOrEmpty(descriptionValue));
462
+ setReason(descriptionValue);
463
+ }, []);
464
+ const handlePriorityChange = (0, react.useCallback)((key) => {
465
+ setPriority(key);
466
+ }, []);
467
+ const handleTurnInfoChange = (0, react.useCallback)((e, field) => {
468
+ setTurnInfo((prev) => ({
469
+ ...prev,
470
+ [field]: e.target.value
471
+ }));
472
+ }, []);
473
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
474
+ className: "envive-tw-mx-[16px] envive-tw-block envive-tw-h-[24px] envive-tw-w-full",
475
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
476
+ type: "button",
477
+ onClick: (e) => {
478
+ e.preventDefault();
479
+ onOpen();
480
+ },
481
+ className: (0, classnames.default)({
482
+ "envive-tw-underline": true,
483
+ "envive-tw-text-inherit": true,
484
+ "envive-tw-text-[12px]": true,
485
+ "envive-tw-cursor-pointer": true,
486
+ "envive-tw-bg-transparent": true,
487
+ "envive-tw-border-none": true,
488
+ "envive-tw-p-0": true,
489
+ "envive-tw-m-0": true,
490
+ "envive-tw-inline": true,
491
+ "envive-tw-z-[9999]": true
492
+ }),
493
+ children: "Give us feedback"
494
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Drawer, {
495
+ isOpen,
496
+ onClose,
497
+ children: [
498
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReportHeader, { onClose }),
499
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
500
+ className: "envive-tw-min-h-0 envive-tw-p-0 envive-tw-flex envive-tw-flex-[1_1_auto] envive-tw-flex-col envive-tw-overflow-y-auto",
501
+ children: lastMessages && lastSuggestions && lastMessages.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReportFormFields, {
502
+ priority,
503
+ setPriority: handlePriorityChange,
504
+ reportedBy,
505
+ onReportedByChanging,
506
+ reason,
507
+ onDescriptionChanging,
508
+ turnInfo,
509
+ setTurnInfo: handleTurnInfoChange,
510
+ lastMessagesText,
511
+ lastSuggestionsText
512
+ })
513
+ }),
514
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReportFooter, {
515
+ isReporting,
516
+ errorMessage,
517
+ reportedByIsInvalid,
518
+ isReasonInvalid,
519
+ onReportSession: reportSession,
520
+ onClose
521
+ })
522
+ ]
523
+ })]
524
+ });
525
+ };
526
+
527
+ //#endregion
528
+ exports.ReportIssue = ReportIssue;