@envive-ai/react-widgets-v3 0.3.12 → 0.3.14

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 (91) hide show
  1. package/dist/CXIntegration/implementations/useEightByEightUnifiedCXButton.cjs +54 -0
  2. package/dist/CXIntegration/implementations/useEightByEightUnifiedCXButton.js +53 -0
  3. package/dist/CXIntegration/implementations/useHelpScoutUnifiedCXButton.cjs +65 -0
  4. package/dist/CXIntegration/implementations/useHelpScoutUnifiedCXButton.js +64 -0
  5. package/dist/CXIntegration/implementations/useTalkdeskUnifiedCXButton.cjs +64 -0
  6. package/dist/CXIntegration/implementations/useTalkdeskUnifiedCXButton.js +63 -0
  7. package/dist/CXIntegration/implementations/useZendeskUnifiedCXButton.cjs +2 -2
  8. package/dist/CXIntegration/implementations/useZendeskUnifiedCXButton.js +2 -2
  9. package/dist/CXIntegration/types.cjs +3 -0
  10. package/dist/CXIntegration/types.js +3 -0
  11. package/dist/CXIntegration/utils/functions.cjs +6 -0
  12. package/dist/CXIntegration/utils/functions.js +6 -0
  13. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  14. package/dist/packages/widgets/dist/SearchResults/SearchResults.d.ts +2 -2
  15. package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
  16. package/dist/packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
  17. package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +2 -2
  18. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
  19. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  20. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  21. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
  22. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  23. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
  24. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
  25. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
  26. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
  27. package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +19 -3
  28. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
  29. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
  30. package/dist/widgets/ProductCardWidget/ProductCardWidget.js +20 -4
  31. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +10 -0
  32. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  33. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  34. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +12 -2
  35. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +2 -9
  36. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  37. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  38. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +1 -8
  39. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +8 -8
  40. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
  41. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
  42. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +8 -8
  43. package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +10 -0
  44. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  45. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  46. package/dist/widgets/SocialProofWidget/SocialProofWidget.js +12 -2
  47. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +11 -0
  48. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  49. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  50. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +12 -1
  51. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +8 -8
  52. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  53. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  54. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +8 -8
  55. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +23 -3
  56. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
  57. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  58. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +24 -4
  59. package/dist/widgets/dist/SearchResults/SearchResults.d.cts +2 -2
  60. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  61. package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
  62. package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
  63. package/dist/widgets/utils/functions.cjs +9 -0
  64. package/dist/widgets/utils/functions.js +9 -1
  65. package/package.json +1 -1
  66. package/src/CXIntegration/implementations/useEightByEightUnifiedCXButton.ts +91 -0
  67. package/src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.ts +108 -0
  68. package/src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.ts +94 -0
  69. package/src/CXIntegration/implementations/useZendeskUnifiedCXButton.ts +4 -2
  70. package/src/CXIntegration/types.ts +3 -0
  71. package/src/CXIntegration/utils/functions.ts +12 -0
  72. package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +15 -3
  73. package/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.tsx +114 -0
  74. package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +119 -0
  75. package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +15 -3
  76. package/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.tsx +144 -0
  77. package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +12 -1
  78. package/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.tsx +179 -0
  79. package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +1 -14
  80. package/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.tsx +150 -0
  81. package/src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.tsx +12 -12
  82. package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +12 -1
  83. package/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.tsx +184 -0
  84. package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +12 -0
  85. package/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.tsx +150 -0
  86. package/src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.tsx +12 -12
  87. package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +19 -2
  88. package/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.tsx +163 -0
  89. package/src/widgets/__tests__/testUtils.tsx +63 -0
  90. package/src/widgets/__tests__/trackEventCanary.test.ts +45 -0
  91. package/src/widgets/utils/functions.ts +16 -0
@@ -0,0 +1,54 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_constants = require('../../widgets/FloatingChatWidget/constants.cjs');
3
+ let __envive_ai_react_hooks_application_utils = require("@envive-ai/react-hooks/application/utils");
4
+ let __envive_ai_react_hooks_hooks_ElementObserver = require("@envive-ai/react-hooks/hooks/ElementObserver");
5
+
6
+ //#region src/CXIntegration/implementations/useEightByEightUnifiedCXButton.ts
7
+ const EIGHT_BY_EIGHT_BUBBLE_SELECTOR = "div[id^=\"__8x8-chat-button-container-script\"]";
8
+ const EIGHT_BY_EIGHT_BUTTON_SELECTOR = `${EIGHT_BY_EIGHT_BUBBLE_SELECTOR} a[data-type="online"], ${EIGHT_BY_EIGHT_BUBBLE_SELECTOR} a[data-type="offline"]`;
9
+ const EIGHT_BY_EIGHT_CHAT_WINDOW_SELECTOR = "div.__8x8Chat-Container";
10
+ const useEightByEightUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton }) => {
11
+ const eightByEightBubble = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.query(EIGHT_BY_EIGHT_BUBBLE_SELECTOR));
12
+ const eightByEightChatWindow = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.query(EIGHT_BY_EIGHT_CHAT_WINDOW_SELECTOR));
13
+ const enviveFloatingButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(require_constants.FLOATING_BUTTON_ID));
14
+ const isEightByEightEnabled = () => !!document.querySelector(EIGHT_BY_EIGHT_BUTTON_SELECTOR);
15
+ const toggle = () => {
16
+ const button = document.querySelector(EIGHT_BY_EIGHT_BUTTON_SELECTOR);
17
+ if (!button) return;
18
+ onSwitchToAgent();
19
+ enviveFloatingButton.hide();
20
+ button.click();
21
+ };
22
+ const isSwitchEnabled = () => isEightByEightEnabled();
23
+ eightByEightBubble.onAdd((el) => {
24
+ if (suppressMerchantButton && el) eightByEightBubble.hide();
25
+ enviveFloatingButton.show();
26
+ });
27
+ eightByEightBubble.onChange((el) => {
28
+ if (!el || !suppressMerchantButton) return;
29
+ if (window.getComputedStyle(el).getPropertyValue("display") !== "none") eightByEightBubble.hide();
30
+ });
31
+ eightByEightChatWindow.onChange((el) => {
32
+ if (!el) return;
33
+ const rect = el.getBoundingClientRect();
34
+ if (rect.width > 50 && rect.height > 50) {
35
+ enviveFloatingButton.hide();
36
+ return;
37
+ }
38
+ onCXClose?.();
39
+ if (suppressMerchantButton) eightByEightBubble.hide();
40
+ enviveFloatingButton.show();
41
+ });
42
+ eightByEightChatWindow.onRemove(() => {
43
+ onCXClose?.();
44
+ if (suppressMerchantButton) eightByEightBubble.hide();
45
+ enviveFloatingButton.show();
46
+ });
47
+ return {
48
+ toggle,
49
+ isSwitchEnabled
50
+ };
51
+ };
52
+
53
+ //#endregion
54
+ exports.useEightByEightUnifiedCXButton = useEightByEightUnifiedCXButton;
@@ -0,0 +1,53 @@
1
+ import { FLOATING_BUTTON_ID } from "../../widgets/FloatingChatWidget/constants.js";
2
+ import { SelectorFactory } from "@envive-ai/react-hooks/application/utils";
3
+ import { useElementObserver } from "@envive-ai/react-hooks/hooks/ElementObserver";
4
+
5
+ //#region src/CXIntegration/implementations/useEightByEightUnifiedCXButton.ts
6
+ const EIGHT_BY_EIGHT_BUBBLE_SELECTOR = "div[id^=\"__8x8-chat-button-container-script\"]";
7
+ const EIGHT_BY_EIGHT_BUTTON_SELECTOR = `${EIGHT_BY_EIGHT_BUBBLE_SELECTOR} a[data-type="online"], ${EIGHT_BY_EIGHT_BUBBLE_SELECTOR} a[data-type="offline"]`;
8
+ const EIGHT_BY_EIGHT_CHAT_WINDOW_SELECTOR = "div.__8x8Chat-Container";
9
+ const useEightByEightUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton }) => {
10
+ const eightByEightBubble = useElementObserver(SelectorFactory.query(EIGHT_BY_EIGHT_BUBBLE_SELECTOR));
11
+ const eightByEightChatWindow = useElementObserver(SelectorFactory.query(EIGHT_BY_EIGHT_CHAT_WINDOW_SELECTOR));
12
+ const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
13
+ const isEightByEightEnabled = () => !!document.querySelector(EIGHT_BY_EIGHT_BUTTON_SELECTOR);
14
+ const toggle = () => {
15
+ const button = document.querySelector(EIGHT_BY_EIGHT_BUTTON_SELECTOR);
16
+ if (!button) return;
17
+ onSwitchToAgent();
18
+ enviveFloatingButton.hide();
19
+ button.click();
20
+ };
21
+ const isSwitchEnabled = () => isEightByEightEnabled();
22
+ eightByEightBubble.onAdd((el) => {
23
+ if (suppressMerchantButton && el) eightByEightBubble.hide();
24
+ enviveFloatingButton.show();
25
+ });
26
+ eightByEightBubble.onChange((el) => {
27
+ if (!el || !suppressMerchantButton) return;
28
+ if (window.getComputedStyle(el).getPropertyValue("display") !== "none") eightByEightBubble.hide();
29
+ });
30
+ eightByEightChatWindow.onChange((el) => {
31
+ if (!el) return;
32
+ const rect = el.getBoundingClientRect();
33
+ if (rect.width > 50 && rect.height > 50) {
34
+ enviveFloatingButton.hide();
35
+ return;
36
+ }
37
+ onCXClose?.();
38
+ if (suppressMerchantButton) eightByEightBubble.hide();
39
+ enviveFloatingButton.show();
40
+ });
41
+ eightByEightChatWindow.onRemove(() => {
42
+ onCXClose?.();
43
+ if (suppressMerchantButton) eightByEightBubble.hide();
44
+ enviveFloatingButton.show();
45
+ });
46
+ return {
47
+ toggle,
48
+ isSwitchEnabled
49
+ };
50
+ };
51
+
52
+ //#endregion
53
+ export { useEightByEightUnifiedCXButton };
@@ -0,0 +1,65 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_constants = require('../../widgets/FloatingChatWidget/constants.cjs');
3
+ let __envive_ai_react_hooks_application_utils = require("@envive-ai/react-hooks/application/utils");
4
+ let __envive_ai_react_hooks_hooks_ElementObserver = require("@envive-ai/react-hooks/hooks/ElementObserver");
5
+
6
+ //#region src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.ts
7
+ const BEACON_CONTAINER_ID = "beacon-container";
8
+ const useHelpScoutUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
9
+ const beaconContainer = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(BEACON_CONTAINER_ID));
10
+ const enviveFloatingButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(require_constants.FLOATING_BUTTON_ID));
11
+ const toggle = () => {
12
+ onSwitchToAgent();
13
+ if (typeof window.Beacon !== "undefined") window.Beacon("open");
14
+ else {
15
+ const fabButton = document.getElementById(BEACON_CONTAINER_ID)?.querySelector(".BeaconFabButtonFrame");
16
+ if (fabButton) {
17
+ fabButton.style.display = "";
18
+ fabButton.click();
19
+ }
20
+ }
21
+ if (suppressMerchantButton) enviveFloatingButton.hide();
22
+ };
23
+ const isHelpScoutButtonEnabled = () => {
24
+ const beaconContainerEl = document.getElementById("beacon-container");
25
+ if (!beaconContainerEl) return false;
26
+ const fabButton = beaconContainerEl.querySelector(".BeaconFabButtonFrame");
27
+ const hasBeaconAPI = typeof window.Beacon !== "undefined";
28
+ return !!(fabButton || hasBeaconAPI);
29
+ };
30
+ const isSwitchEnabled = () => isHelpScoutButtonEnabled();
31
+ beaconContainer.onAdd(() => {
32
+ if (suppressMerchantButton) {
33
+ const fabButton = document.getElementById(BEACON_CONTAINER_ID)?.querySelector(".BeaconFabButtonFrame");
34
+ if (fabButton) fabButton.style.display = "none";
35
+ enviveFloatingButton.show();
36
+ }
37
+ });
38
+ beaconContainer.onChange((el) => {
39
+ if (el && suppressMerchantButton) {
40
+ const beaconWidget = el.querySelector(".BeaconContainer");
41
+ const fabButton = el.querySelector(".BeaconFabButtonFrame");
42
+ if (beaconWidget && fabButton) {
43
+ const { classList } = beaconWidget;
44
+ if (classList.contains("BeaconContainer-enter-done") || classList.contains("BeaconContainer-enter-active")) {
45
+ fabButton.style.display = "";
46
+ enviveFloatingButton.hide();
47
+ }
48
+ if (classList.contains("BeaconContainer-exit") || classList.contains("BeaconContainer-exit-active")) {
49
+ fabButton.style.display = "none";
50
+ enviveFloatingButton.show();
51
+ }
52
+ }
53
+ }
54
+ });
55
+ beaconContainer.onRemove(() => {
56
+ if (suppressMerchantButton) enviveFloatingButton.show();
57
+ });
58
+ return {
59
+ toggle,
60
+ isSwitchEnabled
61
+ };
62
+ };
63
+
64
+ //#endregion
65
+ exports.useHelpScoutUnifiedCXButton = useHelpScoutUnifiedCXButton;
@@ -0,0 +1,64 @@
1
+ import { FLOATING_BUTTON_ID } from "../../widgets/FloatingChatWidget/constants.js";
2
+ import { SelectorFactory } from "@envive-ai/react-hooks/application/utils";
3
+ import { useElementObserver } from "@envive-ai/react-hooks/hooks/ElementObserver";
4
+
5
+ //#region src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.ts
6
+ const BEACON_CONTAINER_ID = "beacon-container";
7
+ const useHelpScoutUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
8
+ const beaconContainer = useElementObserver(SelectorFactory.id(BEACON_CONTAINER_ID));
9
+ const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
10
+ const toggle = () => {
11
+ onSwitchToAgent();
12
+ if (typeof window.Beacon !== "undefined") window.Beacon("open");
13
+ else {
14
+ const fabButton = document.getElementById(BEACON_CONTAINER_ID)?.querySelector(".BeaconFabButtonFrame");
15
+ if (fabButton) {
16
+ fabButton.style.display = "";
17
+ fabButton.click();
18
+ }
19
+ }
20
+ if (suppressMerchantButton) enviveFloatingButton.hide();
21
+ };
22
+ const isHelpScoutButtonEnabled = () => {
23
+ const beaconContainerEl = document.getElementById("beacon-container");
24
+ if (!beaconContainerEl) return false;
25
+ const fabButton = beaconContainerEl.querySelector(".BeaconFabButtonFrame");
26
+ const hasBeaconAPI = typeof window.Beacon !== "undefined";
27
+ return !!(fabButton || hasBeaconAPI);
28
+ };
29
+ const isSwitchEnabled = () => isHelpScoutButtonEnabled();
30
+ beaconContainer.onAdd(() => {
31
+ if (suppressMerchantButton) {
32
+ const fabButton = document.getElementById(BEACON_CONTAINER_ID)?.querySelector(".BeaconFabButtonFrame");
33
+ if (fabButton) fabButton.style.display = "none";
34
+ enviveFloatingButton.show();
35
+ }
36
+ });
37
+ beaconContainer.onChange((el) => {
38
+ if (el && suppressMerchantButton) {
39
+ const beaconWidget = el.querySelector(".BeaconContainer");
40
+ const fabButton = el.querySelector(".BeaconFabButtonFrame");
41
+ if (beaconWidget && fabButton) {
42
+ const { classList } = beaconWidget;
43
+ if (classList.contains("BeaconContainer-enter-done") || classList.contains("BeaconContainer-enter-active")) {
44
+ fabButton.style.display = "";
45
+ enviveFloatingButton.hide();
46
+ }
47
+ if (classList.contains("BeaconContainer-exit") || classList.contains("BeaconContainer-exit-active")) {
48
+ fabButton.style.display = "none";
49
+ enviveFloatingButton.show();
50
+ }
51
+ }
52
+ }
53
+ });
54
+ beaconContainer.onRemove(() => {
55
+ if (suppressMerchantButton) enviveFloatingButton.show();
56
+ });
57
+ return {
58
+ toggle,
59
+ isSwitchEnabled
60
+ };
61
+ };
62
+
63
+ //#endregion
64
+ export { useHelpScoutUnifiedCXButton };
@@ -0,0 +1,64 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_constants = require('../../widgets/FloatingChatWidget/constants.cjs');
3
+ let __envive_ai_react_hooks_application_utils = require("@envive-ai/react-hooks/application/utils");
4
+ let __envive_ai_react_hooks_hooks_ElementObserver = require("@envive-ai/react-hooks/hooks/ElementObserver");
5
+
6
+ //#region src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.ts
7
+ const useTalkdeskUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
8
+ const talkdeskButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id("talkdesk-chat-widget-trigger"));
9
+ const talkdeskWidget = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id("talkdesk-chat-widget"));
10
+ const talkdeskContainer = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id("tdWebchat"));
11
+ const enviveFloatingButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(require_constants.FLOATING_BUTTON_ID));
12
+ const toggle = () => {
13
+ onSwitchToAgent();
14
+ if (suppressMerchantButton) enviveFloatingButton.hide();
15
+ talkdeskButton.show();
16
+ talkdeskButton.fire("click");
17
+ };
18
+ const isTalkdeskButtonEnabled = () => {
19
+ if (!document.getElementById("tdWebchat")) return false;
20
+ return !!document.getElementById("talkdesk-chat-widget-trigger");
21
+ };
22
+ const isSwitchEnabled = () => isTalkdeskButtonEnabled();
23
+ talkdeskButton.onAdd(() => {
24
+ if (suppressMerchantButton) {
25
+ talkdeskButton.hide();
26
+ enviveFloatingButton.show();
27
+ }
28
+ });
29
+ talkdeskWidget.onAdd((el) => {
30
+ if (el && suppressMerchantButton) if (el.getAttribute("aria-hidden") === "false") {
31
+ talkdeskButton.show();
32
+ enviveFloatingButton.hide();
33
+ } else {
34
+ talkdeskButton.hide();
35
+ enviveFloatingButton.show();
36
+ }
37
+ });
38
+ talkdeskWidget.onChange((el) => {
39
+ if (el && suppressMerchantButton) {
40
+ const ariaHidden = el.getAttribute("aria-hidden");
41
+ if (ariaHidden === "false") {
42
+ talkdeskButton.show();
43
+ enviveFloatingButton.hide();
44
+ }
45
+ if (ariaHidden === "true") {
46
+ talkdeskButton.hide();
47
+ enviveFloatingButton.show();
48
+ }
49
+ }
50
+ });
51
+ talkdeskContainer.onRemove(() => {
52
+ if (suppressMerchantButton) {
53
+ talkdeskButton.hide();
54
+ enviveFloatingButton.show();
55
+ }
56
+ });
57
+ return {
58
+ toggle,
59
+ isSwitchEnabled
60
+ };
61
+ };
62
+
63
+ //#endregion
64
+ exports.useTalkdeskUnifiedCXButton = useTalkdeskUnifiedCXButton;
@@ -0,0 +1,63 @@
1
+ import { FLOATING_BUTTON_ID } from "../../widgets/FloatingChatWidget/constants.js";
2
+ import { SelectorFactory } from "@envive-ai/react-hooks/application/utils";
3
+ import { useElementObserver } from "@envive-ai/react-hooks/hooks/ElementObserver";
4
+
5
+ //#region src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.ts
6
+ const useTalkdeskUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
7
+ const talkdeskButton = useElementObserver(SelectorFactory.id("talkdesk-chat-widget-trigger"));
8
+ const talkdeskWidget = useElementObserver(SelectorFactory.id("talkdesk-chat-widget"));
9
+ const talkdeskContainer = useElementObserver(SelectorFactory.id("tdWebchat"));
10
+ const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
11
+ const toggle = () => {
12
+ onSwitchToAgent();
13
+ if (suppressMerchantButton) enviveFloatingButton.hide();
14
+ talkdeskButton.show();
15
+ talkdeskButton.fire("click");
16
+ };
17
+ const isTalkdeskButtonEnabled = () => {
18
+ if (!document.getElementById("tdWebchat")) return false;
19
+ return !!document.getElementById("talkdesk-chat-widget-trigger");
20
+ };
21
+ const isSwitchEnabled = () => isTalkdeskButtonEnabled();
22
+ talkdeskButton.onAdd(() => {
23
+ if (suppressMerchantButton) {
24
+ talkdeskButton.hide();
25
+ enviveFloatingButton.show();
26
+ }
27
+ });
28
+ talkdeskWidget.onAdd((el) => {
29
+ if (el && suppressMerchantButton) if (el.getAttribute("aria-hidden") === "false") {
30
+ talkdeskButton.show();
31
+ enviveFloatingButton.hide();
32
+ } else {
33
+ talkdeskButton.hide();
34
+ enviveFloatingButton.show();
35
+ }
36
+ });
37
+ talkdeskWidget.onChange((el) => {
38
+ if (el && suppressMerchantButton) {
39
+ const ariaHidden = el.getAttribute("aria-hidden");
40
+ if (ariaHidden === "false") {
41
+ talkdeskButton.show();
42
+ enviveFloatingButton.hide();
43
+ }
44
+ if (ariaHidden === "true") {
45
+ talkdeskButton.hide();
46
+ enviveFloatingButton.show();
47
+ }
48
+ }
49
+ });
50
+ talkdeskContainer.onRemove(() => {
51
+ if (suppressMerchantButton) {
52
+ talkdeskButton.hide();
53
+ enviveFloatingButton.show();
54
+ }
55
+ });
56
+ return {
57
+ toggle,
58
+ isSwitchEnabled
59
+ };
60
+ };
61
+
62
+ //#endregion
63
+ export { useTalkdeskUnifiedCXButton };
@@ -5,10 +5,10 @@ let __envive_ai_react_hooks_hooks_ElementObserver = require("@envive-ai/react-ho
5
5
 
6
6
  //#region src/CXIntegration/implementations/useZendeskUnifiedCXButton.ts
7
7
  const useZendeskUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton }) => {
8
- const zendeskButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.chain("id|launcher @ query|button"));
8
+ const zendeskButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.chain("query|iframe#launcher @ query|button"));
9
9
  const zendeskAlternativeIframe = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.chain("id|webWidget"));
10
10
  const enviveFloatingButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(require_constants.FLOATING_BUTTON_ID));
11
- const zendeskIframe = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id("launcher"));
11
+ const zendeskIframe = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.query("iframe#launcher"));
12
12
  const toggle = () => {
13
13
  zendeskIframe.hide();
14
14
  onSwitchToAgent();
@@ -4,10 +4,10 @@ import { useElementObserver } from "@envive-ai/react-hooks/hooks/ElementObserver
4
4
 
5
5
  //#region src/CXIntegration/implementations/useZendeskUnifiedCXButton.ts
6
6
  const useZendeskUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton }) => {
7
- const zendeskButton = useElementObserver(SelectorFactory.chain("id|launcher @ query|button"));
7
+ const zendeskButton = useElementObserver(SelectorFactory.chain("query|iframe#launcher @ query|button"));
8
8
  const zendeskAlternativeIframe = useElementObserver(SelectorFactory.chain("id|webWidget"));
9
9
  const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
10
- const zendeskIframe = useElementObserver(SelectorFactory.id("launcher"));
10
+ const zendeskIframe = useElementObserver(SelectorFactory.query("iframe#launcher"));
11
11
  const toggle = () => {
12
12
  zendeskIframe.hide();
13
13
  onSwitchToAgent();
@@ -11,6 +11,9 @@ let CustomerServiceType = /* @__PURE__ */ function(CustomerServiceType$1) {
11
11
  CustomerServiceType$1["gladly"] = "gladly";
12
12
  CustomerServiceType$1["richpanel"] = "richpanel";
13
13
  CustomerServiceType$1["zendesk"] = "zendesk";
14
+ CustomerServiceType$1["helpscout"] = "helpscout";
15
+ CustomerServiceType$1["talkdesk"] = "talkdesk";
16
+ CustomerServiceType$1["eightByEight"] = "8x8";
14
17
  CustomerServiceType$1["unsupported"] = "unsupported";
15
18
  return CustomerServiceType$1;
16
19
  }({});
@@ -10,6 +10,9 @@ let CustomerServiceType = /* @__PURE__ */ function(CustomerServiceType$1) {
10
10
  CustomerServiceType$1["gladly"] = "gladly";
11
11
  CustomerServiceType$1["richpanel"] = "richpanel";
12
12
  CustomerServiceType$1["zendesk"] = "zendesk";
13
+ CustomerServiceType$1["helpscout"] = "helpscout";
14
+ CustomerServiceType$1["talkdesk"] = "talkdesk";
15
+ CustomerServiceType$1["eightByEight"] = "8x8";
13
16
  CustomerServiceType$1["unsupported"] = "unsupported";
14
17
  return CustomerServiceType$1;
15
18
  }({});
@@ -9,6 +9,9 @@ const require_useReDoUnifiedCXButton = require('../implementations/useReDoUnifie
9
9
  const require_useRichpanelUnifiedCXButton = require('../implementations/useRichpanelUnifiedCXButton.cjs');
10
10
  const require_useZendeskUnifiedCXButton = require('../implementations/useZendeskUnifiedCXButton.cjs');
11
11
  const require_useKustomerUnifiedCXButton = require('../implementations/useKustomerUnifiedCXButton.cjs');
12
+ const require_useHelpScoutUnifiedCXButton = require('../implementations/useHelpScoutUnifiedCXButton.cjs');
13
+ const require_useTalkdeskUnifiedCXButton = require('../implementations/useTalkdeskUnifiedCXButton.cjs');
14
+ const require_useEightByEightUnifiedCXButton = require('../implementations/useEightByEightUnifiedCXButton.cjs');
12
15
  const require_useDefaultUnifiedCXButton = require('../implementations/useDefaultUnifiedCXButton.cjs');
13
16
 
14
17
  //#region src/CXIntegration/utils/functions.ts
@@ -23,6 +26,9 @@ const findCustomerServiceImpl = (provider) => {
23
26
  if (provider === require_types.CustomerServiceType.redo) return require_useReDoUnifiedCXButton.useReDoUnifiedCXButton;
24
27
  if (provider === require_types.CustomerServiceType.richpanel) return require_useRichpanelUnifiedCXButton.useRichpanelUnifiedCXButton;
25
28
  if (provider === require_types.CustomerServiceType.zendesk) return require_useZendeskUnifiedCXButton.useZendeskUnifiedCXButton;
29
+ if (provider === require_types.CustomerServiceType.helpscout) return require_useHelpScoutUnifiedCXButton.useHelpScoutUnifiedCXButton;
30
+ if (provider === require_types.CustomerServiceType.talkdesk) return require_useTalkdeskUnifiedCXButton.useTalkdeskUnifiedCXButton;
31
+ if (provider === require_types.CustomerServiceType.eightByEight) return require_useEightByEightUnifiedCXButton.useEightByEightUnifiedCXButton;
26
32
  return require_useDefaultUnifiedCXButton.useDefaultUnifiedCXButton;
27
33
  };
28
34
 
@@ -9,6 +9,9 @@ import { useReDoUnifiedCXButton } from "../implementations/useReDoUnifiedCXButto
9
9
  import { useRichpanelUnifiedCXButton } from "../implementations/useRichpanelUnifiedCXButton.js";
10
10
  import { useZendeskUnifiedCXButton } from "../implementations/useZendeskUnifiedCXButton.js";
11
11
  import { useKustomerUnifiedCXButton } from "../implementations/useKustomerUnifiedCXButton.js";
12
+ import { useHelpScoutUnifiedCXButton } from "../implementations/useHelpScoutUnifiedCXButton.js";
13
+ import { useTalkdeskUnifiedCXButton } from "../implementations/useTalkdeskUnifiedCXButton.js";
14
+ import { useEightByEightUnifiedCXButton } from "../implementations/useEightByEightUnifiedCXButton.js";
12
15
  import { useDefaultUnifiedCXButton } from "../implementations/useDefaultUnifiedCXButton.js";
13
16
 
14
17
  //#region src/CXIntegration/utils/functions.ts
@@ -23,6 +26,9 @@ const findCustomerServiceImpl = (provider) => {
23
26
  if (provider === CustomerServiceType.redo) return useReDoUnifiedCXButton;
24
27
  if (provider === CustomerServiceType.richpanel) return useRichpanelUnifiedCXButton;
25
28
  if (provider === CustomerServiceType.zendesk) return useZendeskUnifiedCXButton;
29
+ if (provider === CustomerServiceType.helpscout) return useHelpScoutUnifiedCXButton;
30
+ if (provider === CustomerServiceType.talkdesk) return useTalkdeskUnifiedCXButton;
31
+ if (provider === CustomerServiceType.eightByEight) return useEightByEightUnifiedCXButton;
26
32
  return useDefaultUnifiedCXButton;
27
33
  };
28
34
 
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps, WithBaseWidgetOptions } from "./types.cjs";
2
- import * as react_jsx_runtime14 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime7 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/hocs/withBaseWidget/withBaseWidget.d.ts
5
5
  declare function withBaseWidget<P extends BaseWidgetProps>(Widget: React.ComponentType<P>, options?: WithBaseWidgetOptions): {
6
- (props: P): react_jsx_runtime14.JSX.Element;
6
+ (props: P): react_jsx_runtime7.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { SearchResultsEntryPointWidgetConfig } from "./types.js";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
3
3
  import { SearchResultsHocProps } from "@envive-ai/react-hooks/hooks/Search";
4
4
 
5
5
  //#region ../widgets/dist/SearchResults/SearchResults.d.ts
@@ -7,7 +7,7 @@ import { SearchResultsHocProps } from "@envive-ai/react-hooks/hooks/Search";
7
7
  interface SearchResultsProps extends SearchResultsHocProps {
8
8
  widgetConfig: SearchResultsEntryPointWidgetConfig;
9
9
  }
10
- declare const SearchResults: (props: Omit<SearchResultsProps, string | number | symbol>) => react_jsx_runtime0.JSX.Element;
10
+ declare const SearchResults: (props: Omit<SearchResultsProps, string | number | symbol>) => react_jsx_runtime1.JSX.Element;
11
11
  //#endregion
12
12
 
13
13
  //#endregion
@@ -1,8 +1,8 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
2
2
 
3
3
  //#region ../widgets/dist/SearchResults/SearchResultsWidget.d.ts
4
4
  //#region src/SearchResults/SearchResultsWidget.d.ts
5
- declare const SearchResultsWidget: () => react_jsx_runtime1.JSX.Element;
5
+ declare const SearchResultsWidget: () => react_jsx_runtime3.JSX.Element;
6
6
  //#endregion
7
7
 
8
8
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime3 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
 
3
3
  //#region ../widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts
4
4
  //#region src/SearchZeroState/SearchZeroStateWidget.d.ts
@@ -11,7 +11,7 @@ declare const SearchZeroStateWidget: ({
11
11
  initialIsOpen,
12
12
  widgetConfigId,
13
13
  entryPointRef
14
- }: SearchZeroStateWidgetProps) => react_jsx_runtime3.JSX.Element;
14
+ }: SearchZeroStateWidgetProps) => react_jsx_runtime0.JSX.Element;
15
15
  //#endregion
16
16
 
17
17
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { SuggestionBarLocationForMetrics } from "./types.js";
2
- import * as react_jsx_runtime2 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
  import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
4
4
  import { Message } from "postcss";
5
5
 
@@ -30,7 +30,7 @@ declare function SuggestionBar({
30
30
  buttonBorderRadius,
31
31
  handleReply,
32
32
  dataTestId
33
- }: Readonly<SuggestionBarProps>): react_jsx_runtime2.JSX.Element;
33
+ }: Readonly<SuggestionBarProps>): react_jsx_runtime0.JSX.Element;
34
34
  //#endregion
35
35
  //#endregion
36
36
  export { SuggestionBar };
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime17 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime9 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
5
5
  declare const ChatPreviewComparisonWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime17.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime9.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewComparisonWidgetProps {
@@ -12,7 +12,7 @@ interface ChatPreviewComparisonWidgetProps {
12
12
  declare const ChatPreviewComparisonWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: ChatPreviewComparisonWidgetProps): react_jsx_runtime17.JSX.Element;
15
+ }: ChatPreviewComparisonWidgetProps): react_jsx_runtime9.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
2
- import * as react_jsx_runtime16 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime11 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
5
5
  declare const ChatPreviewComparisonWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime16.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime11.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewComparisonWidgetProps {
@@ -12,7 +12,7 @@ interface ChatPreviewComparisonWidgetProps {
12
12
  declare const ChatPreviewComparisonWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: ChatPreviewComparisonWidgetProps): react_jsx_runtime16.JSX.Element;
15
+ }: ChatPreviewComparisonWidgetProps): react_jsx_runtime11.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime4 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime13 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
5
5
  declare const ChatPreviewLoadingWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime4.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime13.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewLoadingWidgetProps {
@@ -11,6 +11,6 @@ interface ChatPreviewLoadingWidgetProps {
11
11
  }
12
12
  declare const ChatPreviewLoadingWidget: ({
13
13
  widgetConfigId
14
- }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime4.JSX.Element;
14
+ }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime13.JSX.Element;
15
15
  //#endregion
16
16
  export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime15 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime11 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
5
5
  declare const ChatPreviewWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime15.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime11.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewWidgetProps {
@@ -12,7 +12,7 @@ interface ChatPreviewWidgetProps {
12
12
  declare const ChatPreviewWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: ChatPreviewWidgetProps): react_jsx_runtime15.JSX.Element;
15
+ }: ChatPreviewWidgetProps): react_jsx_runtime11.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
2
- import * as react_jsx_runtime18 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime7 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
5
5
  declare const ChatPreviewWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime18.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime7.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewWidgetProps {
@@ -12,7 +12,7 @@ interface ChatPreviewWidgetProps {
12
12
  declare const ChatPreviewWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: ChatPreviewWidgetProps): react_jsx_runtime18.JSX.Element;
15
+ }: ChatPreviewWidgetProps): react_jsx_runtime7.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion