@envive-ai/react-widgets-v3 0.3.2 → 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.
- package/dist/hocs/withBaseWidget/types.d.ts +5 -5
- package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/node_modules/uuid/dist/native.js +6 -0
- package/dist/node_modules/uuid/dist/rng.js +13 -0
- package/dist/node_modules/uuid/dist/stringify.js +9 -0
- package/dist/node_modules/uuid/dist/v4.js +27 -0
- package/dist/node_modules/uuid/dist-node/native.cjs +8 -0
- package/dist/node_modules/uuid/dist-node/rng.cjs +16 -0
- package/dist/node_modules/uuid/dist-node/stringify.cjs +10 -0
- package/dist/node_modules/uuid/dist-node/v4.cjs +27 -0
- package/dist/{widgets → packages/widgets}/dist/SearchResults/SearchResults.d.ts +2 -2
- package/dist/{widgets → packages/widgets}/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
- package/dist/{widgets → packages/widgets}/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
- package/dist/{widgets → packages/widgets}/dist/SuggestionBar/SuggestionBar.d.ts +2 -2
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +28 -11
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +28 -11
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +27 -10
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +27 -10
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +3 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +26 -8
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +27 -9
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +14 -6
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +15 -7
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +1 -1
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +1 -1
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +36 -13
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +36 -13
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +13 -5
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +14 -6
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +1 -1
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +1 -1
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +14 -7
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +14 -7
- package/dist/widgets/dist/SearchResults/SearchResults.d.cts +2 -2
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
- package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
- package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
- package/dist/widgets/utils/functions.cjs +1 -1
- package/dist/widgets/utils/functions.js +1 -1
- package/dist/widgets-v2/SearchResults/index.d.ts +3 -3
- package/dist/widgets-v2/SearchZeroState/index.d.ts +5 -5
- package/dist/widgets-v2/SuggestionBar/index.d.ts +3 -3
- package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/stories/SalesAgentTest/SalesAgentTest.tsx +2 -2
- package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +30 -8
- package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +33 -9
- package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +33 -8
- package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +19 -5
- package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +41 -10
- package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +19 -5
- package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +18 -5
- /package/dist/{hooks → packages/hooks}/dist/application/models/api/orgConfigResults.d.ts +0 -0
- /package/dist/{hooks → packages/hooks}/dist/application/models/frontendConfig.d.ts +0 -0
- /package/dist/{hooks → packages/hooks}/dist/contexts/amplitudeContext/amplitudeContext.d.ts +0 -0
- /package/dist/{hooks → packages/hooks}/dist/contexts/amplitudeContext/index.d.ts +0 -0
- /package/dist/{hooks → packages/hooks}/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +0 -0
- /package/dist/{hooks → packages/hooks}/dist/contexts/hardcopyContext/hardcopyContext.d.ts +0 -0
- /package/dist/{hooks → packages/hooks}/dist/contexts/hardcopyContext/index.d.ts +0 -0
- /package/dist/{hooks → packages/hooks}/dist/contexts/types.d.ts +0 -0
- /package/dist/{hooks → packages/hooks}/dist/contexts/typesV3.d.ts +0 -0
- /package/dist/{hooks → packages/hooks}/dist/services/amplitudeService/amplitudeService.d.ts +0 -0
- /package/dist/{hooks → packages/hooks}/dist/types/customerService.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SearchResults/index.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SearchResults/types.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SearchZeroState/SearchZeroState.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SearchZeroState/index.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SearchZeroState/types.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SuggestionBar/index.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SuggestionBar/types.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SuggestionButtonContainer/types.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/config/BaseWidgetConfig.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/config/WidgetType.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/api/response.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/api/search.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/contexts/types.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/hooks/utils.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/types/search-filter-types.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/types/test-types.d.ts +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { OrgUIConfigV3, WidgetConfigV3, WidgetTypeV3 } from "../../hooks/dist/contexts/typesV3.js";
|
|
2
|
-
import { SpiffyMetricsEventName } from "../../hooks/dist/services/amplitudeService/amplitudeService.js";
|
|
3
|
-
import "../../hooks/dist/contexts/amplitudeContext/index.js";
|
|
4
|
-
import { HardcopyResponse } from "../../hooks/dist/contexts/hardcopyContext/hardcopyContext.js";
|
|
5
|
-
import "../../hooks/dist/contexts/hardcopyContext/index.js";
|
|
1
|
+
import { OrgUIConfigV3, WidgetConfigV3, WidgetTypeV3 } from "../../packages/hooks/dist/contexts/typesV3.js";
|
|
2
|
+
import { SpiffyMetricsEventName } from "../../packages/hooks/dist/services/amplitudeService/amplitudeService.js";
|
|
3
|
+
import "../../packages/hooks/dist/contexts/amplitudeContext/index.js";
|
|
4
|
+
import { HardcopyResponse } from "../../packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.js";
|
|
5
|
+
import "../../packages/hooks/dist/contexts/hardcopyContext/index.js";
|
|
6
6
|
import { RefObject } from "react";
|
|
7
7
|
|
|
8
8
|
//#region src/hocs/withBaseWidget/types.d.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps, WithBaseWidgetOptions } from "./types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime12 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):
|
|
6
|
+
(props: P): react_jsx_runtime12.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps, WithBaseWidgetOptions } from "./types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime3 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):
|
|
6
|
+
(props: P): react_jsx_runtime3.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region ../../node_modules/uuid/dist/rng.js
|
|
2
|
+
let getRandomValues;
|
|
3
|
+
const rnds8 = new Uint8Array(16);
|
|
4
|
+
function rng() {
|
|
5
|
+
if (!getRandomValues) {
|
|
6
|
+
if (typeof crypto === "undefined" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
7
|
+
getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
8
|
+
}
|
|
9
|
+
return getRandomValues(rnds8);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { rng as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region ../../node_modules/uuid/dist/stringify.js
|
|
2
|
+
const byteToHex = [];
|
|
3
|
+
for (let i = 0; i < 256; ++i) byteToHex.push((i + 256).toString(16).slice(1));
|
|
4
|
+
function unsafeStringify(arr, offset = 0) {
|
|
5
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { unsafeStringify };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { unsafeStringify } from "./stringify.js";
|
|
2
|
+
import rng from "./rng.js";
|
|
3
|
+
import native_default from "./native.js";
|
|
4
|
+
|
|
5
|
+
//#region ../../node_modules/uuid/dist/v4.js
|
|
6
|
+
function _v4(options, buf, offset) {
|
|
7
|
+
options = options || {};
|
|
8
|
+
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
9
|
+
if (rnds.length < 16) throw new Error("Random bytes length must be >= 16");
|
|
10
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
11
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
12
|
+
if (buf) {
|
|
13
|
+
offset = offset || 0;
|
|
14
|
+
if (offset < 0 || offset + 16 > buf.length) throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
15
|
+
for (let i = 0; i < 16; ++i) buf[offset + i] = rnds[i];
|
|
16
|
+
return buf;
|
|
17
|
+
}
|
|
18
|
+
return unsafeStringify(rnds);
|
|
19
|
+
}
|
|
20
|
+
function v4(options, buf, offset) {
|
|
21
|
+
if (native_default.randomUUID && !buf && !options) return native_default.randomUUID();
|
|
22
|
+
return _v4(options, buf, offset);
|
|
23
|
+
}
|
|
24
|
+
var v4_default = v4;
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { v4_default as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let node_crypto = require("node:crypto");
|
|
3
|
+
|
|
4
|
+
//#region ../../node_modules/uuid/dist-node/native.js
|
|
5
|
+
var native_default = { randomUUID: node_crypto.randomUUID };
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
exports.default = native_default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let node_crypto = require("node:crypto");
|
|
3
|
+
|
|
4
|
+
//#region ../../node_modules/uuid/dist-node/rng.js
|
|
5
|
+
const rnds8Pool = new Uint8Array(256);
|
|
6
|
+
let poolPtr = rnds8Pool.length;
|
|
7
|
+
function rng() {
|
|
8
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
9
|
+
(0, node_crypto.randomFillSync)(rnds8Pool);
|
|
10
|
+
poolPtr = 0;
|
|
11
|
+
}
|
|
12
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.default = rng;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../../node_modules/uuid/dist-node/stringify.js
|
|
3
|
+
const byteToHex = [];
|
|
4
|
+
for (let i = 0; i < 256; ++i) byteToHex.push((i + 256).toString(16).slice(1));
|
|
5
|
+
function unsafeStringify(arr, offset = 0) {
|
|
6
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.unsafeStringify = unsafeStringify;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const require_stringify = require('./stringify.cjs');
|
|
2
|
+
const require_rng = require('./rng.cjs');
|
|
3
|
+
const require_native = require('./native.cjs');
|
|
4
|
+
|
|
5
|
+
//#region ../../node_modules/uuid/dist-node/v4.js
|
|
6
|
+
function _v4(options, buf, offset) {
|
|
7
|
+
options = options || {};
|
|
8
|
+
const rnds = options.random ?? options.rng?.() ?? require_rng.default();
|
|
9
|
+
if (rnds.length < 16) throw new Error("Random bytes length must be >= 16");
|
|
10
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
11
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
12
|
+
if (buf) {
|
|
13
|
+
offset = offset || 0;
|
|
14
|
+
if (offset < 0 || offset + 16 > buf.length) throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
15
|
+
for (let i = 0; i < 16; ++i) buf[offset + i] = rnds[i];
|
|
16
|
+
return buf;
|
|
17
|
+
}
|
|
18
|
+
return require_stringify.unsafeStringify(rnds);
|
|
19
|
+
}
|
|
20
|
+
function v4(options, buf, offset) {
|
|
21
|
+
if (require_native.default.randomUUID && !buf && !options) return require_native.default.randomUUID();
|
|
22
|
+
return _v4(options, buf, offset);
|
|
23
|
+
}
|
|
24
|
+
var v4_default = v4;
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.default = v4_default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SearchResultsHocProps } from "../packages/hooks/dist/hooks/Search/useSearch.js";
|
|
2
2
|
import { SearchResultsEntryPointWidgetConfig } from "./types.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region ../widgets/dist/SearchResults/SearchResults.d.ts
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
|
8
8
|
interface SearchResultsProps extends SearchResultsHocProps {
|
|
9
9
|
widgetConfig: SearchResultsEntryPointWidgetConfig;
|
|
10
10
|
}
|
|
11
|
-
declare const SearchResults: (props: Omit<SearchResultsProps, keyof SearchResultsHocProps>) =>
|
|
11
|
+
declare const SearchResults: (props: Omit<SearchResultsProps, keyof SearchResultsHocProps>) => react_jsx_runtime0.JSX.Element;
|
|
12
12
|
//#endregion
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 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: () =>
|
|
5
|
+
declare const SearchResultsWidget: () => react_jsx_runtime0.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 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) =>
|
|
14
|
+
}: SearchZeroStateWidgetProps) => react_jsx_runtime3.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SuggestionButtonVariant } from "../packages/hooks/dist/contexts/types.js";
|
|
2
2
|
import { SuggestionBarLocationForMetrics } from "./types.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
4
4
|
import { Message } from "postcss";
|
|
5
5
|
|
|
6
6
|
//#region ../widgets/dist/SuggestionBar/SuggestionBar.d.ts
|
|
@@ -30,7 +30,7 @@ declare function SuggestionBar({
|
|
|
30
30
|
buttonBorderRadius,
|
|
31
31
|
handleReply,
|
|
32
32
|
dataTestId
|
|
33
|
-
}: Readonly<SuggestionBarProps>):
|
|
33
|
+
}: Readonly<SuggestionBarProps>): react_jsx_runtime2.JSX.Element;
|
|
34
34
|
//#endregion
|
|
35
35
|
//#endregion
|
|
36
36
|
export { SuggestionBar };
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
|
|
3
|
+
const require_v4 = require('../../node_modules/uuid/dist-node/v4.cjs');
|
|
3
4
|
const require_functions = require('../utils/functions.cjs');
|
|
4
5
|
const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
|
|
5
6
|
let react = require("react");
|
|
6
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
8
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
8
|
-
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
9
|
-
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
10
|
-
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
11
|
-
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
12
9
|
let jotai = require("jotai");
|
|
10
|
+
let __envive_ai_react_hooks_atoms_chat_replies = require("@envive-ai/react-hooks/atoms/chat/replies");
|
|
11
|
+
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
13
12
|
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
14
|
-
let
|
|
13
|
+
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
14
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
15
15
|
let __envive_ai_react_toolkit_v3_ChatPreviewComparison = require("@envive-ai/react-toolkit-v3/ChatPreviewComparison");
|
|
16
|
+
let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
|
|
16
17
|
|
|
17
18
|
//#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx
|
|
18
19
|
const ChatPreviewComparisonWidgetHandler = (props) => {
|
|
19
|
-
const
|
|
20
|
+
const handleReply = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_replies.handleReplyAtom);
|
|
20
21
|
const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
21
22
|
const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
|
|
22
23
|
const variantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.variantInfoAtom);
|
|
@@ -44,15 +45,31 @@ const ChatPreviewComparisonWidgetHandler = (props) => {
|
|
|
44
45
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
45
46
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
46
47
|
const handlePromptButtonClick = (0, react.useCallback)((text) => {
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
handleReply({
|
|
49
|
+
message: {
|
|
50
|
+
id: require_v4.default(),
|
|
51
|
+
role: __envive_ai_react_hooks_application_models.MessageRole.User,
|
|
52
|
+
type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
|
|
53
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
54
|
+
metadata: { content: text }
|
|
55
|
+
},
|
|
49
56
|
userTyped: false
|
|
50
57
|
});
|
|
51
58
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
|
|
52
|
-
}, [
|
|
53
|
-
const handleTextFieldClick = (0, react.useCallback)(() => {
|
|
59
|
+
}, [handleReply, openChat]);
|
|
60
|
+
const handleTextFieldClick = (0, react.useCallback)((text) => {
|
|
61
|
+
handleReply({
|
|
62
|
+
message: {
|
|
63
|
+
id: require_v4.default(),
|
|
64
|
+
role: __envive_ai_react_hooks_application_models.MessageRole.User,
|
|
65
|
+
type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
|
|
66
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
67
|
+
metadata: { content: text }
|
|
68
|
+
},
|
|
69
|
+
userTyped: false
|
|
70
|
+
});
|
|
54
71
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
|
|
55
|
-
}, [openChat]);
|
|
72
|
+
}, [handleReply, openChat]);
|
|
56
73
|
if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChatPreviewLoadingWidget.ChatPreviewLoadingWidgetWithBaseWidget, {
|
|
57
74
|
widgetConfigId,
|
|
58
75
|
widgetType: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.ChatPreviewLoadingV3
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime14 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
|
|
5
5
|
declare const ChatPreviewComparisonWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime14.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):
|
|
15
|
+
}: ChatPreviewComparisonWidgetProps): react_jsx_runtime14.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
|
|
2
|
+
import * as react_jsx_runtime13 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
|
|
5
5
|
declare const ChatPreviewComparisonWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime13.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):
|
|
15
|
+
}: ChatPreviewComparisonWidgetProps): react_jsx_runtime13.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
|
+
import v4_default from "../../node_modules/uuid/dist/v4.js";
|
|
2
3
|
import { getMessageText, getRecentProductImageUrls } from "../utils/functions.js";
|
|
3
4
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
|
|
4
5
|
import { useCallback, useMemo } from "react";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import { useAtomValue, useSetAtom } from "jotai";
|
|
9
|
+
import { handleReplyAtom } from "@envive-ai/react-hooks/atoms/chat/replies";
|
|
9
10
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
|
-
import { ChatElementDisplayLocationV3, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
|
|
11
|
-
import { useAtomValue } from "jotai";
|
|
12
11
|
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
13
|
-
import {
|
|
12
|
+
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
13
|
+
import { ChatElementDisplayLocationV3, MessageRole, MessageType, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
|
|
14
14
|
import { ChatPreviewComparison } from "@envive-ai/react-toolkit-v3/ChatPreviewComparison";
|
|
15
|
+
import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
|
|
15
16
|
|
|
16
17
|
//#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx
|
|
17
18
|
const ChatPreviewComparisonWidgetHandler = (props) => {
|
|
18
|
-
const
|
|
19
|
+
const handleReply = useSetAtom(handleReplyAtom);
|
|
19
20
|
const { openChat } = useChatToggle();
|
|
20
21
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
21
22
|
const variantInfo = useAtomValue(variantInfoAtom);
|
|
@@ -43,15 +44,31 @@ const ChatPreviewComparisonWidgetHandler = (props) => {
|
|
|
43
44
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
44
45
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
45
46
|
const handlePromptButtonClick = useCallback((text) => {
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
handleReply({
|
|
48
|
+
message: {
|
|
49
|
+
id: v4_default(),
|
|
50
|
+
role: MessageRole.User,
|
|
51
|
+
type: MessageType.QueryTyped,
|
|
52
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
53
|
+
metadata: { content: text }
|
|
54
|
+
},
|
|
48
55
|
userTyped: false
|
|
49
56
|
});
|
|
50
57
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
|
|
51
|
-
}, [
|
|
52
|
-
const handleTextFieldClick = useCallback(() => {
|
|
58
|
+
}, [handleReply, openChat]);
|
|
59
|
+
const handleTextFieldClick = useCallback((text) => {
|
|
60
|
+
handleReply({
|
|
61
|
+
message: {
|
|
62
|
+
id: v4_default(),
|
|
63
|
+
role: MessageRole.User,
|
|
64
|
+
type: MessageType.QueryTyped,
|
|
65
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
66
|
+
metadata: { content: text }
|
|
67
|
+
},
|
|
68
|
+
userTyped: false
|
|
69
|
+
});
|
|
53
70
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
|
|
54
|
-
}, [openChat]);
|
|
71
|
+
}, [handleReply, openChat]);
|
|
55
72
|
if (isLoading) return /* @__PURE__ */ jsx(ChatPreviewLoadingWidgetWithBaseWidget, {
|
|
56
73
|
widgetConfigId,
|
|
57
74
|
widgetType: WidgetTypeV3.ChatPreviewLoadingV3
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
|
|
5
5
|
declare const ChatPreviewLoadingWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime7.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) =>
|
|
14
|
+
}: ChatPreviewLoadingWidgetProps) => react_jsx_runtime7.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime15 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
|
|
5
5
|
declare const ChatPreviewLoadingWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime15.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) =>
|
|
14
|
+
}: ChatPreviewLoadingWidgetProps) => react_jsx_runtime15.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
|
|
3
|
+
const require_v4 = require('../../node_modules/uuid/dist-node/v4.cjs');
|
|
3
4
|
const require_functions = require('../utils/functions.cjs');
|
|
4
5
|
const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
|
|
5
6
|
let react = require("react");
|
|
6
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
8
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
8
|
-
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
9
|
-
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
10
|
-
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
11
|
-
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
12
9
|
let jotai = require("jotai");
|
|
10
|
+
let __envive_ai_react_hooks_atoms_chat_replies = require("@envive-ai/react-hooks/atoms/chat/replies");
|
|
11
|
+
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
13
12
|
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
13
|
+
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
14
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
14
15
|
let __envive_ai_react_toolkit_v3_ChatPreview = require("@envive-ai/react-toolkit-v3/ChatPreview");
|
|
15
16
|
|
|
16
17
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
|
|
17
18
|
const ChatPreviewWidgetHandler = (props) => {
|
|
18
|
-
const
|
|
19
|
+
const handleReply = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_replies.handleReplyAtom);
|
|
19
20
|
const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
20
21
|
const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
|
|
21
22
|
const { suggestions } = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.chatAtom);
|
|
@@ -35,15 +36,31 @@ const ChatPreviewWidgetHandler = (props) => {
|
|
|
35
36
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
36
37
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
37
38
|
const handlePromptButtonClick = (0, react.useCallback)((text) => {
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
handleReply({
|
|
40
|
+
message: {
|
|
41
|
+
id: require_v4.default(),
|
|
42
|
+
role: __envive_ai_react_hooks_application_models.MessageRole.User,
|
|
43
|
+
type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
|
|
44
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
45
|
+
metadata: { content: text }
|
|
46
|
+
},
|
|
40
47
|
userTyped: false
|
|
41
48
|
});
|
|
42
49
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
43
|
-
}, [
|
|
44
|
-
const handleTextFieldClick = (0, react.useCallback)(() => {
|
|
50
|
+
}, [handleReply, openChat]);
|
|
51
|
+
const handleTextFieldClick = (0, react.useCallback)((text) => {
|
|
52
|
+
handleReply({
|
|
53
|
+
message: {
|
|
54
|
+
id: require_v4.default(),
|
|
55
|
+
role: __envive_ai_react_hooks_application_models.MessageRole.User,
|
|
56
|
+
type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
|
|
57
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
58
|
+
metadata: { content: text }
|
|
59
|
+
},
|
|
60
|
+
userTyped: false
|
|
61
|
+
});
|
|
45
62
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
|
|
46
|
-
}, [openChat]);
|
|
63
|
+
}, [handleReply, openChat]);
|
|
47
64
|
if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChatPreviewLoadingWidget.ChatPreviewLoadingWidgetWithBaseWidget, {
|
|
48
65
|
widgetConfigId,
|
|
49
66
|
widgetType: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.ChatPreviewLoadingV3
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
|
|
5
5
|
declare const ChatPreviewWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime5.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):
|
|
15
|
+
}: ChatPreviewWidgetProps): react_jsx_runtime5.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
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
|
|
5
5
|
declare const ChatPreviewWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime0.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):
|
|
15
|
+
}: ChatPreviewWidgetProps): react_jsx_runtime0.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
|
+
import v4_default from "../../node_modules/uuid/dist/v4.js";
|
|
2
3
|
import { getMessageText } from "../utils/functions.js";
|
|
3
4
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
|
|
4
5
|
import { useCallback, useMemo } from "react";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import { useAtomValue, useSetAtom } from "jotai";
|
|
9
|
+
import { handleReplyAtom } from "@envive-ai/react-hooks/atoms/chat/replies";
|
|
9
10
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
|
-
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
11
|
-
import { useAtomValue } from "jotai";
|
|
12
11
|
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
12
|
+
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
13
|
+
import { ChatElementDisplayLocationV3, MessageRole, MessageType } from "@envive-ai/react-hooks/application/models";
|
|
13
14
|
import { ChatPreview } from "@envive-ai/react-toolkit-v3/ChatPreview";
|
|
14
15
|
|
|
15
16
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
|
|
16
17
|
const ChatPreviewWidgetHandler = (props) => {
|
|
17
|
-
const
|
|
18
|
+
const handleReply = useSetAtom(handleReplyAtom);
|
|
18
19
|
const { openChat } = useChatToggle();
|
|
19
20
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
20
21
|
const { suggestions } = useAtomValue(chatAtom);
|
|
@@ -34,15 +35,31 @@ const ChatPreviewWidgetHandler = (props) => {
|
|
|
34
35
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
35
36
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
36
37
|
const handlePromptButtonClick = useCallback((text) => {
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
handleReply({
|
|
39
|
+
message: {
|
|
40
|
+
id: v4_default(),
|
|
41
|
+
role: MessageRole.User,
|
|
42
|
+
type: MessageType.QueryTyped,
|
|
43
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
44
|
+
metadata: { content: text }
|
|
45
|
+
},
|
|
39
46
|
userTyped: false
|
|
40
47
|
});
|
|
41
48
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
42
|
-
}, [
|
|
43
|
-
const handleTextFieldClick = useCallback(() => {
|
|
49
|
+
}, [handleReply, openChat]);
|
|
50
|
+
const handleTextFieldClick = useCallback((text) => {
|
|
51
|
+
handleReply({
|
|
52
|
+
message: {
|
|
53
|
+
id: v4_default(),
|
|
54
|
+
role: MessageRole.User,
|
|
55
|
+
type: MessageType.QueryTyped,
|
|
56
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
57
|
+
metadata: { content: text }
|
|
58
|
+
},
|
|
59
|
+
userTyped: false
|
|
60
|
+
});
|
|
44
61
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
|
|
45
|
-
}, [openChat]);
|
|
62
|
+
}, [handleReply, openChat]);
|
|
46
63
|
if (isLoading) return /* @__PURE__ */ jsx(ChatPreviewLoadingWidgetWithBaseWidget, {
|
|
47
64
|
widgetConfigId,
|
|
48
65
|
widgetType: WidgetTypeV3.ChatPreviewLoadingV3
|