@envive-ai/react-hooks 0.3.14 → 0.3.15-beta.0
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.
- package/dist/atoms/app/index.d.cts +1 -1
- package/dist/atoms/app/index.d.ts +7 -7
- package/dist/atoms/app/variant.d.cts +6 -6
- package/dist/atoms/app/variant.d.ts +6 -6
- package/dist/atoms/chat/chatState.d.cts +17 -17
- package/dist/atoms/chat/chatState.d.ts +18 -18
- package/dist/atoms/chat/form.d.cts +3 -3
- package/dist/atoms/chat/form.d.ts +3 -3
- package/dist/atoms/chat/index.d.cts +3 -3
- package/dist/atoms/chat/index.d.ts +3 -3
- package/dist/atoms/chat/lastMessage.d.cts +2 -2
- package/dist/atoms/chat/lastMessage.d.ts +2 -2
- package/dist/atoms/chat/messageQueue.d.cts +6 -6
- package/dist/atoms/chat/messageQueue.d.ts +7 -7
- package/dist/atoms/chat/performanceMetrics.d.cts +7 -7
- package/dist/atoms/chat/performanceMetrics.d.ts +6 -6
- package/dist/atoms/chat/renderedWidgetRefs.d.cts +2 -2
- package/dist/atoms/chat/renderedWidgetRefs.d.ts +3 -3
- package/dist/atoms/chat/replies.d.cts +2 -2
- package/dist/atoms/chat/replies.d.ts +3 -3
- package/dist/atoms/chat/suggestions.d.cts +2 -2
- package/dist/atoms/chat/suggestions.d.ts +3 -3
- package/dist/atoms/envive/enviveConfig.d.cts +12 -12
- package/dist/atoms/envive/enviveConfig.d.ts +13 -13
- package/dist/atoms/globalSearch/globalSearch.d.cts +5 -5
- package/dist/atoms/globalSearch/globalSearch.d.ts +5 -5
- package/dist/atoms/org/customerService.d.cts +6 -6
- package/dist/atoms/org/customerService.d.ts +6 -6
- package/dist/atoms/org/graphqlConfig.d.cts +4 -4
- package/dist/atoms/org/graphqlConfig.d.ts +4 -4
- package/dist/atoms/org/newOrgConfigAtom.d.cts +2 -2
- package/dist/atoms/org/newOrgConfigAtom.d.ts +3 -3
- package/dist/atoms/org/orgAnalyticsConfig.d.cts +5 -5
- package/dist/atoms/org/orgAnalyticsConfig.d.ts +6 -6
- package/dist/atoms/search/chatSearch.d.cts +17 -17
- package/dist/atoms/search/chatSearch.d.ts +17 -17
- package/dist/atoms/search/searchAPI.d.cts +13 -13
- package/dist/atoms/search/searchAPI.d.ts +13 -13
- package/dist/atoms/search/types.d.cts +1 -1
- package/dist/atoms/search/utils.d.ts +1 -1
- package/dist/atoms/widget/chatPreviewLoading.d.cts +2 -2
- package/dist/atoms/widget/chatPreviewLoading.d.ts +2 -2
- package/dist/contexts/salesAgentContext/chatAPI.cjs +21 -1
- package/dist/contexts/salesAgentContext/chatAPI.js +21 -1
- package/dist/contexts/systemSettingsContext/systemSettingsContext.d.cts +2 -2
- package/dist/contexts/systemSettingsContext/systemSettingsContext.d.ts +2 -2
- package/dist/contexts/types.d.cts +1 -1
- package/dist/contexts/types.d.ts +1 -1
- package/dist/contexts/typesV3.d.ts +1 -1
- package/dist/hooks/ChatToggle/useChatToggle.cjs +47 -17
- package/dist/hooks/ChatToggle/useChatToggle.d.cts +2 -1
- package/dist/hooks/ChatToggle/useChatToggle.d.ts +2 -1
- package/dist/hooks/ChatToggle/useChatToggle.js +48 -18
- package/dist/hooks/GrabAndScroll/useGrabAndScroll.d.cts +2 -2
- package/dist/hooks/ShopifyUrlOperations/useShopifyUrlOperations.d.cts +2 -2
- package/dist/hooks/ShopifyUrlOperations/useShopifyUrlOperations.d.ts +2 -2
- package/dist/hooks/SystemSettingsContext/useSystemSettingsContext.d.ts +2 -2
- package/dist/hooks/WidgetInteraction/index.cjs +3 -0
- package/dist/hooks/WidgetInteraction/index.d.cts +2 -0
- package/dist/hooks/WidgetInteraction/index.d.ts +2 -0
- package/dist/hooks/WidgetInteraction/index.js +3 -0
- package/dist/hooks/WidgetInteraction/types.cjs +47 -0
- package/dist/hooks/WidgetInteraction/types.d.cts +110 -0
- package/dist/hooks/WidgetInteraction/types.d.ts +110 -0
- package/dist/hooks/WidgetInteraction/types.js +44 -0
- package/dist/hooks/WidgetInteraction/useWidgetInteraction.cjs +34 -0
- package/dist/hooks/WidgetInteraction/useWidgetInteraction.d.cts +10 -0
- package/dist/hooks/WidgetInteraction/useWidgetInteraction.d.ts +10 -0
- package/dist/hooks/WidgetInteraction/useWidgetInteraction.js +33 -0
- package/dist/hooks/WidgetInteraction/utils.cjs +34 -0
- package/dist/hooks/WidgetInteraction/utils.d.cts +8 -0
- package/dist/hooks/WidgetInteraction/utils.d.ts +8 -0
- package/dist/hooks/WidgetInteraction/utils.js +34 -0
- package/dist/hooks/utils.d.cts +1 -1
- package/dist/hooks/utils.d.ts +1 -1
- package/package.json +13 -1
- package/src/contexts/salesAgentContext/chatAPI.ts +39 -6
- package/src/hooks/ChatToggle/useChatToggle.ts +35 -2
- package/src/hooks/WidgetInteraction/index.ts +1 -0
- package/src/hooks/WidgetInteraction/types.ts +139 -0
- package/src/hooks/WidgetInteraction/useWidgetInteraction.ts +35 -0
- package/src/hooks/WidgetInteraction/utils.ts +44 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { VariantTypeEnum } from 'src/application/models';
|
|
2
|
+
import {
|
|
3
|
+
FullPageSalesAgentVariantInfo,
|
|
4
|
+
HomeVariantInfo,
|
|
5
|
+
OtherVariantInfo,
|
|
6
|
+
PageVariantInfo,
|
|
7
|
+
PDPPageVariantInfo,
|
|
8
|
+
PLPPageVariantInfo,
|
|
9
|
+
} from '../../contexts/pageContext/types';
|
|
10
|
+
import { WidgetInteractionContext, WidgetInteractionPageType } from './types';
|
|
11
|
+
|
|
12
|
+
export const extractPageContext = (
|
|
13
|
+
pageVariant: PageVariantInfo,
|
|
14
|
+
): WidgetInteractionContext | null => {
|
|
15
|
+
switch (pageVariant.variantType) {
|
|
16
|
+
case VariantTypeEnum.Pdp:
|
|
17
|
+
return {
|
|
18
|
+
page_id: (pageVariant as PDPPageVariantInfo).productId,
|
|
19
|
+
page_type: WidgetInteractionPageType.PDP,
|
|
20
|
+
};
|
|
21
|
+
case VariantTypeEnum.Plp:
|
|
22
|
+
return {
|
|
23
|
+
page_id: (pageVariant as PLPPageVariantInfo).plpId,
|
|
24
|
+
page_type: WidgetInteractionPageType.PLP,
|
|
25
|
+
};
|
|
26
|
+
case VariantTypeEnum.Home:
|
|
27
|
+
return {
|
|
28
|
+
page_id: (pageVariant as HomeVariantInfo).url,
|
|
29
|
+
page_type: WidgetInteractionPageType.HOMEPAGE,
|
|
30
|
+
};
|
|
31
|
+
case VariantTypeEnum.Other:
|
|
32
|
+
return {
|
|
33
|
+
page_id: (pageVariant as OtherVariantInfo).url,
|
|
34
|
+
page_type: WidgetInteractionPageType.OTHER,
|
|
35
|
+
};
|
|
36
|
+
case VariantTypeEnum.FullPageSalesAgent:
|
|
37
|
+
return {
|
|
38
|
+
page_id: (pageVariant as FullPageSalesAgentVariantInfo).url,
|
|
39
|
+
page_type: WidgetInteractionPageType.FULL_PAGE,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return null;
|
|
44
|
+
};
|