@envive-ai/react-widgets-v3 0.3.13 → 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/CXIntegration/implementations/useHelpScoutUnifiedCXButton.cjs +65 -0
- package/dist/CXIntegration/implementations/useHelpScoutUnifiedCXButton.js +64 -0
- package/dist/CXIntegration/implementations/useTalkdeskUnifiedCXButton.cjs +64 -0
- package/dist/CXIntegration/implementations/useTalkdeskUnifiedCXButton.js +63 -0
- package/dist/CXIntegration/types.cjs +2 -0
- package/dist/CXIntegration/types.js +2 -0
- package/dist/CXIntegration/utils/functions.cjs +4 -0
- package/dist/CXIntegration/utils/functions.js +4 -0
- package/dist/hocs/withBaseWidget/types.d.cts +3 -3
- package/dist/hocs/withBaseWidget/types.d.ts +5 -3
- package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/hooks/dist/application/models/api/widgetText.d.cts +8 -0
- package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.cts +12 -0
- package/dist/hooks/dist/contexts/types.d.cts +38 -0
- package/dist/hooks/dist/contexts/typesV3.d.cts +239 -0
- package/dist/hooks/dist/services/amplitudeService/eventNames.d.cts +43 -0
- package/dist/hooks/dist/types/customerService.d.cts +21 -0
- package/dist/packages/hooks/dist/application/models/api/orgConfigResults.d.ts +1 -0
- package/dist/packages/hooks/dist/application/models/api/widgetText.d.ts +8 -0
- package/dist/packages/hooks/dist/application/models/frontendConfig.d.ts +1 -0
- package/dist/packages/hooks/dist/contexts/amplitudeContext/amplitudeContext.d.ts +2 -0
- package/dist/packages/hooks/dist/contexts/amplitudeContext/index.d.ts +2 -0
- package/dist/packages/hooks/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +2 -0
- package/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +14 -0
- package/dist/packages/hooks/dist/contexts/hardcopyContext/index.d.ts +1 -0
- package/dist/packages/hooks/dist/contexts/types.d.ts +42 -0
- package/dist/packages/hooks/dist/contexts/typesV3.d.ts +239 -0
- package/dist/packages/hooks/dist/services/amplitudeService/amplitudeService.d.ts +1 -0
- package/dist/packages/hooks/dist/services/amplitudeService/eventNames.d.ts +43 -0
- package/dist/packages/hooks/dist/types/customerService.d.ts +21 -0
- package/dist/packages/widgets/dist/SearchResults/SearchResults.d.ts +3 -2
- package/dist/packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SearchZeroState/index.d.ts +2 -1
- package/dist/packages/widgets/dist/SearchZeroState/types.d.ts +2 -2
- package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +3 -3
- package/dist/packages/widgets/dist/SuggestionButtonContainer/index.d.ts +2 -0
- package/dist/packages/widgets/dist/SuggestionButtonContainer/types.d.ts +3 -2
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/response.d.ts +14 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/search.d.ts +15 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.ts +73 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts +61 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts +25 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts +35 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts +32 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts +32 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/variantInfo/variantInfo.d.ts +1 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts +15 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +1 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/contexts/types.d.ts +63 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts +60 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/hooks/utils.d.ts +13 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/types/OrgInfo.d.ts +1 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/types/index.d.ts +1 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/types/search-filter-types.d.ts +28 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/types/test-types.d.ts +10 -0
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +29 -5
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +30 -6
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +19 -3
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.js +20 -4
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +10 -0
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +12 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +15 -10
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +16 -11
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +10 -0
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +12 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +11 -0
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +12 -1
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +23 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +24 -4
- package/dist/widgets/dist/SearchResults/SearchResults.d.cts +3 -2
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
- package/dist/widgets/dist/SearchZeroState/types.d.cts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +3 -3
- package/dist/widgets/dist/SuggestionButtonContainer/types.d.cts +3 -2
- package/dist/widgets/dist/packages/hooks/dist/application/models/api/response.d.cts +14 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/api/search.d.cts +15 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.cts +73 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.cts +61 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.cts +25 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.cts +35 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.cts +32 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.cts +32 -0
- package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.cts +14 -0
- package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.cts +61 -0
- package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.cts +60 -0
- package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.cts +12 -0
- package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.cts +28 -0
- package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.cts +10 -0
- package/dist/widgets/utils/functions.cjs +9 -0
- package/dist/widgets/utils/functions.js +9 -1
- package/dist/widgets-v2/SearchZeroState/index.d.cts +2 -1
- package/dist/widgets-v2/SearchZeroState/index.d.ts +2 -1
- package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.ts +108 -0
- package/src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.ts +94 -0
- package/src/CXIntegration/types.ts +2 -0
- package/src/CXIntegration/utils/functions.ts +8 -0
- package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +15 -3
- package/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.tsx +114 -0
- package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +56 -15
- package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +119 -0
- package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +15 -3
- package/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.tsx +144 -0
- package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +12 -1
- package/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.tsx +179 -0
- package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +33 -23
- package/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.tsx +150 -0
- package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +12 -1
- package/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.tsx +184 -0
- package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +12 -0
- package/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.tsx +150 -0
- package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +19 -2
- package/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.tsx +163 -0
- package/src/widgets/__tests__/testUtils.tsx +63 -0
- package/src/widgets/__tests__/trackEventCanary.test.ts +45 -0
- package/src/widgets/utils/functions.ts +16 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { CamelCase, CamelCaseOptions } from "./camelCase.js";
|
|
2
|
+
import { UnknownArray } from "./unknownArray.js";
|
|
3
|
+
|
|
4
|
+
//#region ../widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts
|
|
5
|
+
|
|
6
|
+
//#region ../hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts
|
|
7
|
+
//#region src/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Convert object properties to camel case recursively.
|
|
10
|
+
*
|
|
11
|
+
* This can be useful when, for example, converting some API types from a different style.
|
|
12
|
+
*
|
|
13
|
+
* @see CamelCasedProperties
|
|
14
|
+
* @see CamelCase
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```
|
|
18
|
+
* import type {CamelCasedPropertiesDeep} from 'type-fest';
|
|
19
|
+
*
|
|
20
|
+
* interface User {
|
|
21
|
+
* UserId: number;
|
|
22
|
+
* UserName: string;
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* interface UserWithFriends {
|
|
26
|
+
* UserInfo: User;
|
|
27
|
+
* UserFriends: User[];
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* const result: CamelCasedPropertiesDeep<UserWithFriends> = {
|
|
31
|
+
* userInfo: {
|
|
32
|
+
* userId: 1,
|
|
33
|
+
* userName: 'Tom',
|
|
34
|
+
* },
|
|
35
|
+
* userFriends: [
|
|
36
|
+
* {
|
|
37
|
+
* userId: 2,
|
|
38
|
+
* userName: 'Jerry',
|
|
39
|
+
* },
|
|
40
|
+
* {
|
|
41
|
+
* userId: 3,
|
|
42
|
+
* userName: 'Spike',
|
|
43
|
+
* },
|
|
44
|
+
* ],
|
|
45
|
+
* };
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @category Change case
|
|
49
|
+
* @category Template literal
|
|
50
|
+
* @category Object
|
|
51
|
+
*/
|
|
52
|
+
type CamelCasedPropertiesDeep<Value, Options extends CamelCaseOptions = {
|
|
53
|
+
preserveConsecutiveUppercase: true;
|
|
54
|
+
}> = Value extends Function ? Value : Value extends UnknownArray ? CamelCasedPropertiesArrayDeep<Value> : Value extends Set<infer U> ? Set<CamelCasedPropertiesDeep<U, Options>> : { [K in keyof Value as CamelCase<K, Options>]: CamelCasedPropertiesDeep<Value[K], Options> };
|
|
55
|
+
type CamelCasedPropertiesArrayDeep<Value extends UnknownArray> = Value extends [] ? [] : Value extends [infer U, ...infer V] ? [CamelCasedPropertiesDeep<U>, ...CamelCasedPropertiesDeep<V>] : Value extends readonly [infer U, ...infer V] ? readonly [CamelCasedPropertiesDeep<U>, ...CamelCasedPropertiesDeep<V>] : Value extends readonly [...infer U, infer V] ? [...CamelCasedPropertiesDeep<U>, CamelCasedPropertiesDeep<V>] : Value extends readonly [...infer U, infer V] ? readonly [...CamelCasedPropertiesDeep<U>, CamelCasedPropertiesDeep<V>] : Value extends Array<infer U> ? Array<CamelCasedPropertiesDeep<U>> : Value extends ReadonlyArray<infer U> ? ReadonlyArray<CamelCasedPropertiesDeep<U>> : never;
|
|
56
|
+
//#endregion
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { CamelCasedPropertiesDeep };
|
package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Trim } from "./trim.js";
|
|
2
|
+
|
|
3
|
+
//#region ../widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts
|
|
4
|
+
|
|
5
|
+
//#region ../hooks/dist/application/models/utilityTypes/internal.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Returns a boolean for whether the string is numeric.
|
|
8
|
+
*
|
|
9
|
+
* This type is a workaround for [Microsoft/TypeScript#46109](https://github.com/microsoft/TypeScript/issues/46109#issuecomment-930307987).
|
|
10
|
+
*/
|
|
11
|
+
type IsNumeric<T extends string> = T extends `${number}` ? Trim<T> extends T ? true : false : false;
|
|
12
|
+
/**
|
|
13
|
+
* Returns a boolean for whether the string is lowercased.
|
|
14
|
+
*/
|
|
15
|
+
type IsLowerCase<T extends string> = T extends Lowercase<T> ? true : false;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a boolean for whether the string is upper-cased.
|
|
18
|
+
*/
|
|
19
|
+
type IsUpperCase<T extends string> = T extends Uppercase<T> ? true : false;
|
|
20
|
+
type WordSeparators = '-' | '_' | Whitespace;
|
|
21
|
+
type Whitespace = '\u{9}' | '\u{A}' | '\u{B}' | '\u{C}' | '\u{D}' | '\u{20}' | '\u{85}' | '\u{A0}' | '\u{1680}' | '\u{2000}' | '\u{2001}' | '\u{2002}' | '\u{2003}' | '\u{2004}' | '\u{2005}' | '\u{2006}' | '\u{2007}' | '\u{2008}' | '\u{2009}' | '\u{200A}' | '\u{2028}' | '\u{2029}' | '\u{202F}' | '\u{205F}' | '\u{3000}' | '\u{FEFF}';
|
|
22
|
+
//#endregion
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { IsLowerCase, IsNumeric, IsUpperCase, Whitespace, WordSeparators };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IsLowerCase, IsNumeric, IsUpperCase, WordSeparators } from "./internal.js";
|
|
2
|
+
|
|
3
|
+
//#region ../widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts
|
|
4
|
+
|
|
5
|
+
//#region ../hooks/dist/application/models/utilityTypes/splitWords.d.ts
|
|
6
|
+
//#region src/application/models/utilityTypes/splitWords.d.ts
|
|
7
|
+
type SkipEmptyWord<Word extends string> = Word extends '' ? [] : [Word];
|
|
8
|
+
type RemoveLastCharacter<Sentence extends string, Character extends string> = Sentence extends `${infer LeftSide}${Character}` ? SkipEmptyWord<LeftSide> : never;
|
|
9
|
+
/**
|
|
10
|
+
* Split a string (almost) like Lodash's `_.words()` function.
|
|
11
|
+
*
|
|
12
|
+
* - Split on each word that begins with a capital letter.
|
|
13
|
+
* - Split on each {@link WordSeparators}.
|
|
14
|
+
* - Split on numeric sequence.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```
|
|
18
|
+
* type Words0 = SplitWords<'helloWorld'>; // ['hello', 'World']
|
|
19
|
+
* type Words1 = SplitWords<'helloWORLD'>; // ['hello', 'WORLD']
|
|
20
|
+
* type Words2 = SplitWords<'hello-world'>; // ['hello', 'world']
|
|
21
|
+
* type Words3 = SplitWords<'--hello the_world'>; // ['hello', 'the', 'world']
|
|
22
|
+
* type Words4 = SplitWords<'lifeIs42'>; // ['life', 'Is', '42']
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
* @category Change case
|
|
27
|
+
* @category Template literal
|
|
28
|
+
*/
|
|
29
|
+
type SplitWords<Sentence extends string, LastCharacter extends string = '', CurrentWord extends string = ''> = Sentence extends `${infer FirstCharacter}${infer RemainingCharacters}` ? FirstCharacter extends WordSeparators ? [...SkipEmptyWord<CurrentWord>, ...SplitWords<RemainingCharacters>] : LastCharacter extends '' ? SplitWords<RemainingCharacters, FirstCharacter, FirstCharacter> : [false, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? [...SkipEmptyWord<CurrentWord>, ...SplitWords<RemainingCharacters, FirstCharacter, FirstCharacter>] : [true, false] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? [...SkipEmptyWord<CurrentWord>, ...SplitWords<RemainingCharacters, FirstCharacter, FirstCharacter>] : [true, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? SplitWords<RemainingCharacters, FirstCharacter, `${CurrentWord}${FirstCharacter}`> : [true, true] extends [IsLowerCase<LastCharacter>, IsUpperCase<FirstCharacter>] ? [...SkipEmptyWord<CurrentWord>, ...SplitWords<RemainingCharacters, FirstCharacter, FirstCharacter>] : [true, true] extends [IsUpperCase<LastCharacter>, IsLowerCase<FirstCharacter>] ? [...RemoveLastCharacter<CurrentWord, LastCharacter>, ...SplitWords<RemainingCharacters, FirstCharacter, `${LastCharacter}${FirstCharacter}`>] : SplitWords<RemainingCharacters, FirstCharacter, `${CurrentWord}${FirstCharacter}`> : [...SkipEmptyWord<CurrentWord>];
|
|
30
|
+
//#endregion
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { SplitWords };
|
package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Whitespace } from "./internal.js";
|
|
2
|
+
|
|
3
|
+
//#region ../widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts
|
|
4
|
+
|
|
5
|
+
//#region ../hooks/dist/application/models/utilityTypes/trim.d.ts
|
|
6
|
+
//#region src/application/models/utilityTypes/trim.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Remove spaces from the left side.
|
|
9
|
+
*/
|
|
10
|
+
type TrimLeft<V extends string> = V extends `${Whitespace}${infer R}` ? TrimLeft<R> : V;
|
|
11
|
+
/**
|
|
12
|
+
* Remove spaces from the right side.
|
|
13
|
+
*/
|
|
14
|
+
type TrimRight<V extends string> = V extends `${infer R}${Whitespace}` ? TrimRight<R> : V;
|
|
15
|
+
/**
|
|
16
|
+
* Remove leading and trailing spaces from a string.
|
|
17
|
+
* @example
|
|
18
|
+
* ```
|
|
19
|
+
* import type {Trim} from 'type-fest';
|
|
20
|
+
*
|
|
21
|
+
* Trim<' foo '>
|
|
22
|
+
* //=> 'foo'
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @category String
|
|
26
|
+
* @category Template literal
|
|
27
|
+
*/
|
|
28
|
+
type Trim<V extends string> = TrimLeft<TrimRight<V>>;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#endregion
|
|
31
|
+
//#endregion
|
|
32
|
+
export { Trim };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region ../widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts
|
|
2
|
+
//#region ../hooks/dist/application/models/utilityTypes/unknownArray.d.ts
|
|
3
|
+
//#region src/application/models/utilityTypes/unknownArray.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Represents an array with `unknown` value.
|
|
6
|
+
*
|
|
7
|
+
* Use case: You want a type that all arrays can be assigned to, but you don't care about the value.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```
|
|
11
|
+
* import type {UnknownArray} from 'type-fest';
|
|
12
|
+
*
|
|
13
|
+
* type IsArray<T> = T extends UnknownArray ? true : false;
|
|
14
|
+
*
|
|
15
|
+
* type A = IsArray<['foo']>;
|
|
16
|
+
* //=> true
|
|
17
|
+
*
|
|
18
|
+
* type B = IsArray<readonly number[]>;
|
|
19
|
+
* //=> true
|
|
20
|
+
*
|
|
21
|
+
* type C = IsArray<string>;
|
|
22
|
+
* //=> false
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @category Type
|
|
26
|
+
* @category Array
|
|
27
|
+
*/
|
|
28
|
+
type UnknownArray = readonly unknown[];
|
|
29
|
+
//#endregion
|
|
30
|
+
//#endregion
|
|
31
|
+
//#endregion
|
|
32
|
+
export { UnknownArray };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../../contexts/types.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "jotai";
|
|
2
|
+
|
|
3
|
+
//#region ../widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts
|
|
4
|
+
|
|
5
|
+
//#region ../hooks/dist/atoms/search/searchAPI.d.ts
|
|
6
|
+
//#region src/atoms/search/searchAPI.d.ts
|
|
7
|
+
type SelectedFilterOption = {
|
|
8
|
+
id: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
filterId: string;
|
|
11
|
+
filterItemId: string;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
//#endregion
|
|
15
|
+
export { SelectedFilterOption };
|
package/dist/packages/widgets/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "react";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import "./hardcopyContext/hardcopyContext.js";
|
|
2
|
+
|
|
3
|
+
//#region ../widgets/dist/packages/hooks/dist/contexts/types.d.ts
|
|
4
|
+
|
|
5
|
+
type ProductCardVariant = 'filled' | 'bordered' | 'minimal' | 'transparentBordered';
|
|
6
|
+
type ProductCardHoverVariant = 'backgroundDark' | 'none';
|
|
7
|
+
type ProductCardLayoutVariant = 'normal' | 'tall' | 'square';
|
|
8
|
+
interface ProductCardConfig {
|
|
9
|
+
variant: ProductCardVariant;
|
|
10
|
+
hoverVariant: ProductCardHoverVariant;
|
|
11
|
+
layoutVariant: ProductCardLayoutVariant;
|
|
12
|
+
pricePrefix?: string;
|
|
13
|
+
}
|
|
14
|
+
type SuggestionButtonVariant = 'outlined' | 'outlinedLight' | 'primary' | 'secondary' | 'tertiary' | 'dark' | 'darkAccent' | 'darkPrimary' | 'secondaryDark' | 'secondaryAccent' | 'transparent' | 'transparentDark' | 'lightDark';
|
|
15
|
+
interface SuggestionButtonConfig {
|
|
16
|
+
variant?: SuggestionButtonVariant;
|
|
17
|
+
hoverVariant?: SuggestionButtonVariant;
|
|
18
|
+
answerVariant?: SuggestionButtonVariant;
|
|
19
|
+
borderRadius?: 'sm' | 'md' | 'lg';
|
|
20
|
+
}
|
|
21
|
+
type SearchZeroStateVariant = 'backgroundTertiary' | 'backgroundDark' | 'backgroundPrimary';
|
|
22
|
+
type SearchZeroStateLayout = 'input' | 'icon';
|
|
23
|
+
type SearchInputVariant = 'standard';
|
|
24
|
+
type SearchIconVariant = 'thin' | 'bold';
|
|
25
|
+
declare enum WidgetType {
|
|
26
|
+
ChatPreview = "ChatPreview",
|
|
27
|
+
SocialProofV2 = "SocialProofV2",
|
|
28
|
+
ChatPreviewV2 = "ChatPreviewV2",
|
|
29
|
+
ChatPreviewIsLoading = "ChatPreviewIsLoading",
|
|
30
|
+
ChatPreviewPostInteraction = "ChatPreviewPostInteraction",
|
|
31
|
+
ChatPreviewProductComparison = "ChatPreviewProductComparison",
|
|
32
|
+
SuggestionBar = "SuggestionBar",
|
|
33
|
+
SuggestionBarV2 = "SuggestionBarV2",
|
|
34
|
+
ImagePromptCard = "ImagePromptCard",
|
|
35
|
+
ImageBanner = "ImageBanner",
|
|
36
|
+
SingleImagePrompt = "SingleImagePrompt",
|
|
37
|
+
SearchPrompt = "SearchPrompt",
|
|
38
|
+
SearchZeroStateEntryPoint = "SearchZeroStateEntryPoint",
|
|
39
|
+
SearchResultsEntryPoint = "SearchResultsEntryPoint",
|
|
40
|
+
SearchOverlayHost = "SearchOverlayHost",
|
|
41
|
+
NoOp = "NoOp",
|
|
42
|
+
}
|
|
43
|
+
interface BaseWidgetConfig<T extends WidgetType> {
|
|
44
|
+
widgetConfigId: string;
|
|
45
|
+
type: T;
|
|
46
|
+
contentId?: string;
|
|
47
|
+
}
|
|
48
|
+
interface SearchEntryPointWidgetConfig extends BaseWidgetConfig<WidgetType.SearchZeroStateEntryPoint> {
|
|
49
|
+
searchZeroStateVariant: SearchZeroStateVariant;
|
|
50
|
+
searchInputVariant: SearchInputVariant;
|
|
51
|
+
searchIconVariant?: SearchIconVariant;
|
|
52
|
+
searchIconSize?: number;
|
|
53
|
+
suggestionButtonConfig: SuggestionButtonConfig;
|
|
54
|
+
layout: SearchZeroStateLayout;
|
|
55
|
+
searchBoxPlaceholder: string;
|
|
56
|
+
animationSpeed?: 'standard' | 'slow' | 'none';
|
|
57
|
+
compactLabel?: string;
|
|
58
|
+
initialSuggestions?: string[];
|
|
59
|
+
usingPortal?: boolean;
|
|
60
|
+
includeSubtitle?: boolean;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { type ProductCardConfig, type SearchEntryPointWidgetConfig, SearchInputVariant, type SuggestionButtonVariant };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ProductCardConfig } from "../../contexts/types.js";
|
|
2
|
+
import { SearchResponseProductAttributes } from "../../application/models/api/response.js";
|
|
3
|
+
import { SearchResult } from "../../application/models/api/search.js";
|
|
4
|
+
import { SelectedFilterOption } from "../../atoms/search/searchAPI.js";
|
|
5
|
+
import { SearchFilterDatum, SelectFilterItem } from "../../types/search-filter-types.js";
|
|
6
|
+
import { SearchResultsState } from "../utils.js";
|
|
7
|
+
import { SearchResponseProduct } from "@spiffy-ai/commerce-api-client";
|
|
8
|
+
|
|
9
|
+
//#region ../widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts
|
|
10
|
+
|
|
11
|
+
//#region ../hooks/dist/hooks/Search/useSearch.d.ts
|
|
12
|
+
//#region src/hooks/Search/useSearch.d.ts
|
|
13
|
+
interface SearchResultsHocProps {
|
|
14
|
+
searchData: SearchResult | null;
|
|
15
|
+
searchResponseId: string;
|
|
16
|
+
merchantShortName: string;
|
|
17
|
+
productCardConfig: ProductCardConfig;
|
|
18
|
+
productList: SearchResponseProduct[];
|
|
19
|
+
autocompleteResults: string[];
|
|
20
|
+
searchFilters: SearchFilterDatum[];
|
|
21
|
+
availableDynamicFilters: {
|
|
22
|
+
name: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
}[];
|
|
25
|
+
selectedFilterOptions: SelectedFilterOption[];
|
|
26
|
+
recommendedProducts: SearchResponseProductAttributes['attributes'][];
|
|
27
|
+
recommendedProductsHeading: string;
|
|
28
|
+
searchOverlayHeading: string;
|
|
29
|
+
searchText: string;
|
|
30
|
+
query: string;
|
|
31
|
+
searchResultsState: SearchResultsState;
|
|
32
|
+
isLoadingSearch: boolean;
|
|
33
|
+
isFilterOpen: boolean;
|
|
34
|
+
shouldShowAutocomplete: boolean;
|
|
35
|
+
focusedIndex: number;
|
|
36
|
+
focusedOptionId: string | undefined;
|
|
37
|
+
filterButtonText: string;
|
|
38
|
+
onSearchInputChange: (value: string) => void;
|
|
39
|
+
onSubmitSearch: () => void;
|
|
40
|
+
onAutocompleteSelect: (suggestion: string) => void;
|
|
41
|
+
onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
42
|
+
onSearchInputFocus: () => void;
|
|
43
|
+
onSearchInputBlur: () => void;
|
|
44
|
+
onToggleDynamicFilter: ({
|
|
45
|
+
filter,
|
|
46
|
+
dynamicFilterDisplayName
|
|
47
|
+
}: {
|
|
48
|
+
filter: string;
|
|
49
|
+
dynamicFilterDisplayName: string;
|
|
50
|
+
}) => void;
|
|
51
|
+
onSelectFilterItem: SelectFilterItem;
|
|
52
|
+
onRemoveFilter: (filter: SelectedFilterOption) => void;
|
|
53
|
+
onClearAllFilters: () => void;
|
|
54
|
+
setIsFilterOpen: (isFilterOpen: boolean) => void;
|
|
55
|
+
resetSearch: () => void;
|
|
56
|
+
searchResultsRef: React.RefObject<HTMLDivElement>;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#endregion
|
|
60
|
+
export { SearchResultsHocProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "../application/models/variantInfo/variantInfo.js";
|
|
2
|
+
|
|
3
|
+
//#region ../widgets/dist/packages/hooks/dist/hooks/utils.d.ts
|
|
4
|
+
|
|
5
|
+
//#region ../hooks/dist/hooks/utils.d.ts
|
|
6
|
+
declare enum SearchResultsState {
|
|
7
|
+
Loading = 0,
|
|
8
|
+
Results = 1,
|
|
9
|
+
NoResults = 2,
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#endregion
|
|
13
|
+
export { SearchResultsState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../contexts/types.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./OrgInfo.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region ../widgets/dist/packages/hooks/dist/types/search-filter-types.d.ts
|
|
2
|
+
//#region ../hooks/dist/types/search-filter-types.d.ts
|
|
3
|
+
|
|
4
|
+
type SelectFilterItem = ({
|
|
5
|
+
filterId,
|
|
6
|
+
filterItemId,
|
|
7
|
+
isSelected,
|
|
8
|
+
displayName
|
|
9
|
+
}: {
|
|
10
|
+
filterId: string;
|
|
11
|
+
filterItemId: string;
|
|
12
|
+
isSelected: boolean;
|
|
13
|
+
displayName: string;
|
|
14
|
+
}) => void;
|
|
15
|
+
type SearchFilterDatum = {
|
|
16
|
+
filterId: string;
|
|
17
|
+
displayName: string;
|
|
18
|
+
items: SearchFilterItemDatum[];
|
|
19
|
+
};
|
|
20
|
+
type SearchFilterItemDatum = {
|
|
21
|
+
filterItemId: string;
|
|
22
|
+
displayName: string;
|
|
23
|
+
productCount: number;
|
|
24
|
+
isSelected: boolean;
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
//#endregion
|
|
28
|
+
export { SearchFilterDatum, SelectFilterItem };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region ../widgets/dist/packages/hooks/dist/types/test-types.d.ts
|
|
2
|
+
//#region ../hooks/dist/types/test-types.d.ts
|
|
3
|
+
//#region src/types/test-types.d.ts
|
|
4
|
+
interface TestProps {
|
|
5
|
+
dataTestId?: string;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
//#endregion
|
|
9
|
+
//#endregion
|
|
10
|
+
export { TestProps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime6 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_runtime6.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_runtime6.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
|
|
2
|
+
import * as react_jsx_runtime16 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_runtime16.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_runtime16.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_runtime14 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_runtime14.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_runtime14.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
|
|
2
|
+
import * as react_jsx_runtime4 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_runtime4.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_runtime4.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_runtime12 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_runtime12.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_runtime12.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -2,11 +2,11 @@ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
|
2
2
|
const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
|
|
3
3
|
require('../../hocs/withBaseWidget/index.cjs');
|
|
4
4
|
const require_debugBar = require('../../debug/debugBar.cjs');
|
|
5
|
-
const require_FloatingChatOverlay = require('./FloatingChatOverlay.cjs');
|
|
6
|
-
const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
|
|
7
5
|
const require_types = require('../../CXIntegration/types.cjs');
|
|
8
6
|
const require_constants = require('./constants.cjs');
|
|
9
7
|
const require_useUnifiedCXButton = require('../../CXIntegration/hooks/useUnifiedCXButton.cjs');
|
|
8
|
+
const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
|
|
9
|
+
const require_FloatingChatOverlay = require('./FloatingChatOverlay.cjs');
|
|
10
10
|
const require_useFloatingButtonVisibility = require('./hooks/useFloatingButtonVisibility.cjs');
|
|
11
11
|
const require_useAutoPopup = require('./hooks/useAutoPopup.cjs');
|
|
12
12
|
let react = require("react");
|
|
@@ -17,6 +17,8 @@ let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/rea
|
|
|
17
17
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
18
18
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
19
19
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
20
|
+
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
21
|
+
let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
|
|
20
22
|
let __envive_ai_react_toolkit_v3_FloatingButton = require("@envive-ai/react-toolkit-v3/FloatingButton");
|
|
21
23
|
|
|
22
24
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
|
|
@@ -43,15 +45,26 @@ const CXButtonProvider = ({ provider, enabled, suppressMerchantButton, onSwitchT
|
|
|
43
45
|
const FloatingChatWidgetHandler = (props) => {
|
|
44
46
|
const { previewButtonOnly, previewChatAlwaysOpen } = props;
|
|
45
47
|
const salesAgentData = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
|
|
48
|
+
const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
|
|
46
49
|
const { userHasInteractedValue } = require_useGetWidgetStatus.default();
|
|
47
50
|
const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
|
|
48
51
|
const { customerServiceIntegration, floatingButton, floatingChat } = uiConfig ?? {};
|
|
49
52
|
const cxProvider = customerServiceIntegration?.provider ?? require_types.CustomerServiceType.unsupported;
|
|
50
|
-
const { isOpen, openChat, closeChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
53
|
+
const { isOpen, openChat, closeChat, onHover } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
51
54
|
const [isCXOpen, setIsCXOpen] = (0, react.useState)(false);
|
|
52
55
|
(0, react.useEffect)(() => {
|
|
53
56
|
if (isOpen) setIsCXOpen(false);
|
|
54
57
|
}, [isOpen]);
|
|
58
|
+
const handleClose = (type) => {
|
|
59
|
+
trackWidgetInteraction({
|
|
60
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
61
|
+
trigger: {
|
|
62
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FLOATING_CHAT,
|
|
63
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.WIDGET_COLLAPSED,
|
|
64
|
+
widget_interaction_data: { widget_collapsed: type }
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
55
68
|
const { shouldShowFloatingButton } = require_useFloatingButtonVisibility.useFloatingButtonVisibility({
|
|
56
69
|
floatingButtonShowConfig: floatingButton?.showOption,
|
|
57
70
|
isChatOpen: isOpen,
|
|
@@ -86,7 +99,10 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
86
99
|
onCXClose: () => setIsCXOpen(false),
|
|
87
100
|
children: ({ isSwitchEnabled, toggle }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(previewChatAlwaysOpen || effectiveIsOpen) && !previewButtonOnly && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FloatingChatOverlay.FloatingChatOverlay, {
|
|
88
101
|
isOpened: effectiveIsOpen,
|
|
89
|
-
onClose: previewChatAlwaysOpen ? () => {} : () =>
|
|
102
|
+
onClose: previewChatAlwaysOpen ? () => {} : () => {
|
|
103
|
+
closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY);
|
|
104
|
+
handleClose({ collapse_source: "body_click" });
|
|
105
|
+
},
|
|
90
106
|
previewMode: !!previewChatAlwaysOpen,
|
|
91
107
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatingChat, {
|
|
92
108
|
theme,
|
|
@@ -98,7 +114,14 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
98
114
|
isFloatingChatOpen: effectiveIsOpen,
|
|
99
115
|
onToggleCXButton: toggle,
|
|
100
116
|
debugBar: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_debugBar.DebugBar, {}),
|
|
101
|
-
|
|
117
|
+
onSwipeClose: previewChatAlwaysOpen ? () => {} : () => {
|
|
118
|
+
closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
|
|
119
|
+
handleClose({ collapse_source: "swipe" });
|
|
120
|
+
},
|
|
121
|
+
onClose: previewChatAlwaysOpen ? () => {} : () => {
|
|
122
|
+
closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
|
|
123
|
+
handleClose({ collapse_source: "close_button" });
|
|
124
|
+
}
|
|
102
125
|
}) })
|
|
103
126
|
}), buttonShouldRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_FloatingButton.FloatingButton, {
|
|
104
127
|
id: require_constants.FLOATING_BUTTON_ID,
|
|
@@ -106,6 +129,7 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
106
129
|
mode: floatingButton?.mode,
|
|
107
130
|
backgroundColor: floatingButton?.backgroundColor,
|
|
108
131
|
onClick: previewButtonOnly ? () => {} : () => openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_BUTTON),
|
|
132
|
+
onMouseOver: onHover,
|
|
109
133
|
customIcon: floatingButton?.iconSVGSrc,
|
|
110
134
|
show: floatingButton?.showOption,
|
|
111
135
|
location: floatingButton?.position,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
|
|
4
4
|
interface FloatingChatWidgetProps {
|
|
@@ -9,7 +9,7 @@ declare const FloatingChatWidget: {
|
|
|
9
9
|
({
|
|
10
10
|
previewButtonOnly,
|
|
11
11
|
previewChatAlwaysOpen
|
|
12
|
-
}?: FloatingChatWidgetProps):
|
|
12
|
+
}?: FloatingChatWidgetProps): react_jsx_runtime3.JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
|
|
4
4
|
interface FloatingChatWidgetProps {
|
|
@@ -9,7 +9,7 @@ declare const FloatingChatWidget: {
|
|
|
9
9
|
({
|
|
10
10
|
previewButtonOnly,
|
|
11
11
|
previewChatAlwaysOpen
|
|
12
|
-
}?: FloatingChatWidgetProps):
|
|
12
|
+
}?: FloatingChatWidgetProps): react_jsx_runtime11.JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|