@envive-ai/react-widgets-v3 0.3.14 → 0.3.15-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +4 -3
- package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -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/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +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.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +13 -1
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +15 -3
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/dist/SearchResults/SearchResults.d.cts +4 -3
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -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-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/widgets/FloatingChatWidget/FloatingChatWidget.tsx +56 -15
- package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +32 -9
package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.cts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IsLowerCase, IsNumeric, IsUpperCase, WordSeparators } from "./internal.cjs";
|
|
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 };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Whitespace } from "./internal.cjs";
|
|
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 };
|
package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.cts
ADDED
|
@@ -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,14 @@
|
|
|
1
|
+
//#region ../widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts
|
|
2
|
+
|
|
3
|
+
//#region ../hooks/dist/atoms/search/searchAPI.d.ts
|
|
4
|
+
|
|
5
|
+
//#region src/atoms/search/searchAPI.d.ts
|
|
6
|
+
type SelectedFilterOption = {
|
|
7
|
+
id: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
filterId: string;
|
|
10
|
+
filterItemId: string;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SelectedFilterOption };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//#region ../widgets/dist/packages/hooks/dist/contexts/types.d.ts
|
|
2
|
+
|
|
3
|
+
type ProductCardVariant = 'filled' | 'bordered' | 'minimal' | 'transparentBordered';
|
|
4
|
+
type ProductCardHoverVariant = 'backgroundDark' | 'none';
|
|
5
|
+
type ProductCardLayoutVariant = 'normal' | 'tall' | 'square';
|
|
6
|
+
interface ProductCardConfig {
|
|
7
|
+
variant: ProductCardVariant;
|
|
8
|
+
hoverVariant: ProductCardHoverVariant;
|
|
9
|
+
layoutVariant: ProductCardLayoutVariant;
|
|
10
|
+
pricePrefix?: string;
|
|
11
|
+
}
|
|
12
|
+
type SuggestionButtonVariant = 'outlined' | 'outlinedLight' | 'primary' | 'secondary' | 'tertiary' | 'dark' | 'darkAccent' | 'darkPrimary' | 'secondaryDark' | 'secondaryAccent' | 'transparent' | 'transparentDark' | 'lightDark';
|
|
13
|
+
interface SuggestionButtonConfig {
|
|
14
|
+
variant?: SuggestionButtonVariant;
|
|
15
|
+
hoverVariant?: SuggestionButtonVariant;
|
|
16
|
+
answerVariant?: SuggestionButtonVariant;
|
|
17
|
+
borderRadius?: 'sm' | 'md' | 'lg';
|
|
18
|
+
}
|
|
19
|
+
type SearchZeroStateVariant = 'backgroundTertiary' | 'backgroundDark' | 'backgroundPrimary';
|
|
20
|
+
type SearchZeroStateLayout = 'input' | 'icon';
|
|
21
|
+
type SearchInputVariant = 'standard';
|
|
22
|
+
type SearchIconVariant = 'thin' | 'bold';
|
|
23
|
+
declare enum WidgetType {
|
|
24
|
+
ChatPreview = "ChatPreview",
|
|
25
|
+
SocialProofV2 = "SocialProofV2",
|
|
26
|
+
ChatPreviewV2 = "ChatPreviewV2",
|
|
27
|
+
ChatPreviewIsLoading = "ChatPreviewIsLoading",
|
|
28
|
+
ChatPreviewPostInteraction = "ChatPreviewPostInteraction",
|
|
29
|
+
ChatPreviewProductComparison = "ChatPreviewProductComparison",
|
|
30
|
+
SuggestionBar = "SuggestionBar",
|
|
31
|
+
SuggestionBarV2 = "SuggestionBarV2",
|
|
32
|
+
ImagePromptCard = "ImagePromptCard",
|
|
33
|
+
ImageBanner = "ImageBanner",
|
|
34
|
+
SingleImagePrompt = "SingleImagePrompt",
|
|
35
|
+
SearchPrompt = "SearchPrompt",
|
|
36
|
+
SearchZeroStateEntryPoint = "SearchZeroStateEntryPoint",
|
|
37
|
+
SearchResultsEntryPoint = "SearchResultsEntryPoint",
|
|
38
|
+
SearchOverlayHost = "SearchOverlayHost",
|
|
39
|
+
NoOp = "NoOp",
|
|
40
|
+
}
|
|
41
|
+
interface BaseWidgetConfig<T extends WidgetType> {
|
|
42
|
+
widgetConfigId: string;
|
|
43
|
+
type: T;
|
|
44
|
+
contentId?: string;
|
|
45
|
+
}
|
|
46
|
+
interface SearchEntryPointWidgetConfig extends BaseWidgetConfig<WidgetType.SearchZeroStateEntryPoint> {
|
|
47
|
+
searchZeroStateVariant: SearchZeroStateVariant;
|
|
48
|
+
searchInputVariant: SearchInputVariant;
|
|
49
|
+
searchIconVariant?: SearchIconVariant;
|
|
50
|
+
searchIconSize?: number;
|
|
51
|
+
suggestionButtonConfig: SuggestionButtonConfig;
|
|
52
|
+
layout: SearchZeroStateLayout;
|
|
53
|
+
searchBoxPlaceholder: string;
|
|
54
|
+
animationSpeed?: 'standard' | 'slow' | 'none';
|
|
55
|
+
compactLabel?: string;
|
|
56
|
+
initialSuggestions?: string[];
|
|
57
|
+
usingPortal?: boolean;
|
|
58
|
+
includeSubtitle?: boolean;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { type ProductCardConfig, type SearchEntryPointWidgetConfig, SearchInputVariant, type SuggestionButtonVariant };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ProductCardConfig } from "../../contexts/types.cjs";
|
|
2
|
+
import { SearchResponseProductAttributes } from "../../application/models/api/response.cjs";
|
|
3
|
+
import { SearchResult } from "../../application/models/api/search.cjs";
|
|
4
|
+
import { SelectedFilterOption } from "../../atoms/search/searchAPI.cjs";
|
|
5
|
+
import { SearchFilterDatum, SelectFilterItem } from "../../types/search-filter-types.cjs";
|
|
6
|
+
import { SearchResultsState } from "../utils.cjs";
|
|
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,12 @@
|
|
|
1
|
+
//#region ../widgets/dist/packages/hooks/dist/hooks/utils.d.ts
|
|
2
|
+
|
|
3
|
+
//#region ../hooks/dist/hooks/utils.d.ts
|
|
4
|
+
|
|
5
|
+
declare enum SearchResultsState {
|
|
6
|
+
Loading = 0,
|
|
7
|
+
Results = 1,
|
|
8
|
+
NoResults = 2,
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//#endregion
|
|
12
|
+
export { SearchResultsState };
|
|
@@ -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,4 +1,5 @@
|
|
|
1
|
-
import { SearchEntryPointWidgetConfig, SearchInputVariant
|
|
1
|
+
import { SearchEntryPointWidgetConfig, SearchInputVariant } from "../../widgets/dist/packages/hooks/dist/contexts/types.cjs";
|
|
2
|
+
import { SearchZeroStateProps } from "../../widgets/dist/SearchZeroState/types.cjs";
|
|
2
3
|
import { SearchZeroState } from "../../widgets/dist/SearchZeroState/SearchZeroState.cjs";
|
|
3
4
|
import { SearchZeroStateWidget } from "../../widgets/dist/SearchZeroState/SearchZeroStateWidget.cjs";
|
|
4
5
|
export { SearchEntryPointWidgetConfig, SearchInputVariant, SearchZeroState, SearchZeroStateProps, SearchZeroStateWidget };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { SearchEntryPointWidgetConfig, SearchInputVariant
|
|
1
|
+
import { SearchEntryPointWidgetConfig, SearchInputVariant } from "../../packages/widgets/dist/packages/hooks/dist/contexts/types.js";
|
|
2
|
+
import { SearchZeroStateProps } from "../../packages/widgets/dist/SearchZeroState/types.js";
|
|
2
3
|
import { SearchZeroState } from "../../packages/widgets/dist/SearchZeroState/SearchZeroState.js";
|
|
3
4
|
import { SearchZeroStateWidget } from "../../packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.js";
|
|
4
5
|
import "../../packages/widgets/dist/SearchZeroState/index.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { SuggestionButtonContainerProps } from "../../packages/widgets/dist/SuggestionButtonContainer/types.js";
|
|
2
2
|
import { SuggestionButtonContainer } from "../../packages/widgets/dist/SuggestionButtonContainer/SuggestionButtonContainer.js";
|
|
3
|
+
import "../../packages/widgets/dist/SuggestionButtonContainer/index.js";
|
|
3
4
|
export { SuggestionButtonContainer, SuggestionButtonContainerProps };
|
package/package.json
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
2
|
+
import {
|
|
3
|
+
EnviveMetricsEventName,
|
|
4
|
+
SpiffyMetricsEventName,
|
|
5
|
+
useAmplitude,
|
|
6
|
+
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
7
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
2
8
|
import {
|
|
3
9
|
FloatingChatConfig,
|
|
4
10
|
LookAndFeelConfig,
|
|
5
11
|
WidgetTypeV3,
|
|
6
12
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
13
|
+
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
14
|
+
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
7
15
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
16
|
+
Collapse,
|
|
17
|
+
WidgetInteractionComponent,
|
|
18
|
+
WidgetInteractionType,
|
|
19
|
+
} from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
13
20
|
import {
|
|
14
21
|
FloatingButton,
|
|
15
22
|
FloatingButtonBackgroundColor,
|
|
@@ -18,15 +25,15 @@ import {
|
|
|
18
25
|
FloatingButtonShow,
|
|
19
26
|
FloatingButtonVariant,
|
|
20
27
|
} from '@envive-ai/react-toolkit-v3/FloatingButton';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
28
|
+
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
29
|
+
import { ReactNode, Suspense, lazy, useEffect, useMemo, useRef, useState } from 'react';
|
|
23
30
|
import { DebugBar } from 'src/debug/debugBar';
|
|
31
|
+
import { useUnifiedCXButton } from '../../CXIntegration/hooks/useUnifiedCXButton';
|
|
32
|
+
import { CustomerServiceType } from '../../CXIntegration/types';
|
|
24
33
|
import { BaseWidgetProps, withBaseWidget } from '../../hocs/withBaseWidget';
|
|
25
|
-
import { FloatingChatOverlay } from './FloatingChatOverlay';
|
|
26
34
|
import useGetWidgetStatus from '../hooks/useGetWidgetStatus';
|
|
27
|
-
import { useUnifiedCXButton } from '../../CXIntegration/hooks/useUnifiedCXButton';
|
|
28
35
|
import { FLOATING_BUTTON_ID } from './constants';
|
|
29
|
-
import {
|
|
36
|
+
import { FloatingChatOverlay } from './FloatingChatOverlay';
|
|
30
37
|
import { useFloatingButtonVisibility } from './hooks/useFloatingButtonVisibility';
|
|
31
38
|
import { useAutoPopup } from './hooks/useAutoPopup';
|
|
32
39
|
|
|
@@ -74,7 +81,7 @@ interface FloatingChatWidgetHandlerProps extends BaseWidgetProps {
|
|
|
74
81
|
const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
|
|
75
82
|
const { previewButtonOnly, previewChatAlwaysOpen } = props;
|
|
76
83
|
const salesAgentData = useSalesAgent();
|
|
77
|
-
|
|
84
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
78
85
|
const { userHasInteractedValue } = useGetWidgetStatus();
|
|
79
86
|
|
|
80
87
|
// TODO: Get hardcopy
|
|
@@ -86,7 +93,7 @@ const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
|
|
|
86
93
|
CustomerServiceType.unsupported;
|
|
87
94
|
|
|
88
95
|
// TODO: Get hardcopy content
|
|
89
|
-
const { isOpen, openChat, closeChat } = useChatToggle();
|
|
96
|
+
const { isOpen, openChat, closeChat, onHover } = useChatToggle();
|
|
90
97
|
|
|
91
98
|
const [isCXOpen, setIsCXOpen] = useState(false);
|
|
92
99
|
|
|
@@ -95,6 +102,19 @@ const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
|
|
|
95
102
|
if (isOpen) setIsCXOpen(false);
|
|
96
103
|
}, [isOpen]);
|
|
97
104
|
|
|
105
|
+
const handleClose = (type: Collapse) => {
|
|
106
|
+
trackWidgetInteraction({
|
|
107
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
108
|
+
trigger: {
|
|
109
|
+
widget: WidgetInteractionComponent.FLOATING_CHAT,
|
|
110
|
+
widget_interaction: WidgetInteractionType.WIDGET_COLLAPSED,
|
|
111
|
+
widget_interaction_data: {
|
|
112
|
+
widget_collapsed: type,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
98
118
|
const { shouldShowFloatingButton } = useFloatingButtonVisibility({
|
|
99
119
|
floatingButtonShowConfig: floatingButton?.showOption as FloatingButtonShow,
|
|
100
120
|
isChatOpen: isOpen,
|
|
@@ -152,7 +172,12 @@ const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
|
|
|
152
172
|
onClose={
|
|
153
173
|
previewChatAlwaysOpen
|
|
154
174
|
? () => {}
|
|
155
|
-
: () =>
|
|
175
|
+
: () => {
|
|
176
|
+
closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY);
|
|
177
|
+
handleClose({
|
|
178
|
+
collapse_source: 'body_click',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
156
181
|
}
|
|
157
182
|
previewMode={!!previewChatAlwaysOpen}
|
|
158
183
|
>
|
|
@@ -167,10 +192,25 @@ const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
|
|
|
167
192
|
isFloatingChatOpen={effectiveIsOpen}
|
|
168
193
|
onToggleCXButton={toggle}
|
|
169
194
|
debugBar={<DebugBar />}
|
|
195
|
+
onSwipeClose={
|
|
196
|
+
previewChatAlwaysOpen
|
|
197
|
+
? () => {}
|
|
198
|
+
: () => {
|
|
199
|
+
closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
|
|
200
|
+
handleClose({
|
|
201
|
+
collapse_source: 'swipe',
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
170
205
|
onClose={
|
|
171
206
|
previewChatAlwaysOpen
|
|
172
207
|
? () => {}
|
|
173
|
-
: () =>
|
|
208
|
+
: () => {
|
|
209
|
+
closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
|
|
210
|
+
handleClose({
|
|
211
|
+
collapse_source: 'close_button',
|
|
212
|
+
});
|
|
213
|
+
}
|
|
174
214
|
}
|
|
175
215
|
/>
|
|
176
216
|
</Suspense>
|
|
@@ -189,6 +229,7 @@ const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
|
|
|
189
229
|
? () => {}
|
|
190
230
|
: () => openChat(ChatElementDisplayLocationV3.FLOATING_BUTTON)
|
|
191
231
|
}
|
|
232
|
+
onMouseOver={onHover}
|
|
192
233
|
customIcon={floatingButton?.iconSVGSrc}
|
|
193
234
|
show={floatingButton?.showOption as FloatingButtonShow}
|
|
194
235
|
location={floatingButton?.position as FloatingButtonLocation}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PromptCarouselWidgetV3Config,
|
|
3
|
-
WidgetTypeV3,
|
|
4
|
-
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
-
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
6
1
|
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
7
|
-
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
8
|
-
import { useCallback, useEffect } from 'react';
|
|
9
2
|
import {
|
|
10
3
|
EnviveMetricsEventName,
|
|
11
4
|
SpiffyMetricsEventName,
|
|
12
5
|
useAmplitude,
|
|
13
6
|
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
14
|
-
|
|
7
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
8
|
+
import {
|
|
9
|
+
PromptCarouselWidgetV3Config,
|
|
10
|
+
WidgetTypeV3,
|
|
11
|
+
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
15
12
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
13
|
+
import { WidgetInteractionComponent } from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
14
|
+
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
15
|
+
import {
|
|
16
|
+
PromptCarousel,
|
|
17
|
+
usePromptCarouselAnalytics,
|
|
18
|
+
} from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
16
19
|
import { AnimationSpeed } from '@envive-ai/react-toolkit-v3/PromptCarousel/types/types';
|
|
17
20
|
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
18
|
-
import {
|
|
21
|
+
import { useCallback, useEffect } from 'react';
|
|
19
22
|
import { BaseWidgetProps, withBaseWidget } from '../../hocs/withBaseWidget';
|
|
20
23
|
import { RawValues, getStringIdForText } from '../utils/functions';
|
|
21
24
|
|
|
@@ -33,6 +36,19 @@ const PromptCarouselWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
33
36
|
|
|
34
37
|
const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
|
|
35
38
|
|
|
39
|
+
const {
|
|
40
|
+
onClick: onSuggestionClick,
|
|
41
|
+
onDrag,
|
|
42
|
+
onHover,
|
|
43
|
+
onMouseDown,
|
|
44
|
+
onMouseUp,
|
|
45
|
+
onTouchStart,
|
|
46
|
+
onTouchEnd,
|
|
47
|
+
} = usePromptCarouselAnalytics(WidgetInteractionComponent.SUGGESTION_BAR, text => {
|
|
48
|
+
const rawValues = (hardcopyContent as { rawValues?: RawValues } | undefined)?.rawValues;
|
|
49
|
+
return getStringIdForText(rawValues, text);
|
|
50
|
+
});
|
|
51
|
+
|
|
36
52
|
const promptButtonTexts = (hardcopyContent?.values?.promptButtonTexts as string[]) || [];
|
|
37
53
|
const buttonTexts = isLoading ? mockButtonTexts : promptButtonTexts;
|
|
38
54
|
|
|
@@ -62,6 +78,7 @@ const PromptCarouselWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
62
78
|
(text: string) => {
|
|
63
79
|
const rawValues = (hardcopyContent as { rawValues?: RawValues } | undefined)?.rawValues;
|
|
64
80
|
const stringId = getStringIdForText(rawValues, text);
|
|
81
|
+
onSuggestionClick(stringId);
|
|
65
82
|
trackEvent({
|
|
66
83
|
eventName: EnviveMetricsEventName.WidgetTextClicked,
|
|
67
84
|
eventProps: {
|
|
@@ -91,6 +108,12 @@ const PromptCarouselWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
91
108
|
promptCarouselRows={promptCarouselRows}
|
|
92
109
|
animationSpeed={animationSpeed}
|
|
93
110
|
handleButtonClick={handleButtonClick}
|
|
111
|
+
handleButtonHover={onHover}
|
|
112
|
+
handleButtonDrag={onDrag}
|
|
113
|
+
handleButtonMouseUp={onMouseUp}
|
|
114
|
+
handleButtonMouseDown={onMouseDown}
|
|
115
|
+
handleButtonTouchStart={onTouchStart}
|
|
116
|
+
handleButtonTouchEnd={onTouchEnd}
|
|
94
117
|
promptButtonTexts={buttonTexts}
|
|
95
118
|
/>
|
|
96
119
|
);
|