Skip to content

Commit

Permalink
remove deprecated props
Browse files Browse the repository at this point in the history
  • Loading branch information
fpbrault committed Aug 28, 2024
1 parent cacf897 commit 5626479
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export class AtomicCategoryFacet implements InitializableComponent {
this.bindings.store.registerFacet('categoryFacets', facetInfo);
initializePopover(this.host, {
...facetInfo,
hasValues: () => !!this.facet.state.values.length,
hasValues: () => !!this.facet.state.selectedValueAncestry.length,
numberOfActiveValues: () => (this.facetState.hasActiveValues ? 1 : 0),
});
this.initializeDependenciesManager();
Expand Down Expand Up @@ -344,7 +344,8 @@ export class AtomicCategoryFacet implements InitializableComponent {
return (
this.searchStatusState.hasError ||
!this.facet.state.enabled ||
(!this.facet.state.values.length && !this.facet.state.parents.length)
(!this.facet.state.selectedValueAncestry.length &&
!this.facet.state.selectedValueAncestry.length)
);
}

Expand Down Expand Up @@ -381,7 +382,7 @@ export class AtomicCategoryFacet implements InitializableComponent {
}

private get hasParents() {
return !!this.facetState.parents.length;
return !!this.facetState.valuesAsTrees.length;
}

private initializeDependenciesManager() {
Expand Down Expand Up @@ -551,11 +552,11 @@ export class AtomicCategoryFacet implements InitializableComponent {
}

private renderChildren() {
if (!this.facetState.values.length) {
if (!this.facetState.selectedValueAncestry.length) {
return;
}

return this.facetState.values.map((value, i) =>
return this.facetState.selectedValueAncestry.map((value, i) =>
this.renderChild(value, i === 0, i === this.resultIndexToFocusOnShowMore)
);
}
Expand Down Expand Up @@ -598,7 +599,8 @@ export class AtomicCategoryFacet implements InitializableComponent {
label={this.label}
i18n={this.bindings.i18n}
onShowMore={() => {
this.resultIndexToFocusOnShowMore = this.facetState.values.length;
this.resultIndexToFocusOnShowMore =
this.facetState.selectedValueAncestry.length;
this.focusTargets.showMoreFocus.focusAfterSearch();
this.facet.showMoreValues();
}}
Expand Down Expand Up @@ -627,7 +629,7 @@ export class AtomicCategoryFacet implements InitializableComponent {
const {
bindings: {i18n},
label,
facetState: {facetSearch, enabled, valuesAsTrees, parents},
facetState: {facetSearch, enabled, valuesAsTrees},
searchStatusState: {hasError, firstSearchExecuted},
} = this;

Expand Down Expand Up @@ -666,7 +668,7 @@ export class AtomicCategoryFacet implements InitializableComponent {
isTopLevel={true}
className="mt-3"
>
{this.renderValuesTree(parents, true)}
{this.renderValuesTree(valuesAsTrees, true)}
</CategoryFacetParentAsTreeContainer>
) : (
<CategoryFacetChildrenAsTreeContainer className="mt-3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,6 @@ export interface CoreCategoryFacetState {
*/
isHierarchical: boolean;

/**
* The facet's parent values.
* @deprecated uses `valuesAsTrees` instead.
*
*/
parents: CategoryFacetValue[];

/**
* The facet's values.
* @deprecated use `selectedValueAncestry` instead.
*/
values: CategoryFacetValue[];

/**
* The selected facet values ancestry.
* The first element is the "root" of the selected value ancestry tree.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ export interface QuickviewOptions {
* The maximum preview size to retrieve, in bytes. By default, the full preview is retrieved.
*/
maximumPreviewSize?: number;
/**
* Whether to only update the `contentURL` attribute when using `fetchResultContent` rather than updating `content`.
* Use this if you are using an iframe with `state.contentURL` as the source url.
* @deprecated This option is always set to `true` ad the Insight Quickview only supports `contentURL` mode.
*/
onlyContentURL?: boolean;
}

export interface Quickview extends Controller {
Expand All @@ -49,14 +43,6 @@ export interface Quickview extends Controller {
}

export interface QuickviewState {
/**
* The result preview HTML content.
*
* @default ""
* @deprecated This value will always be empty as the InsightQuickview only supports usage of the `contentURL`.
*/
content: string;

/**
* `true` if the configured result has a preview, and `false` otherwise.
*/
Expand Down
12 changes: 0 additions & 12 deletions packages/headless/src/features/analytics/search-action-cause.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,6 @@ export enum SearchPageEvents {
* Identifies the custom event that gets logged when a snippet suggestion for a related question is collapsed.
*/
collapseSmartSnippetSuggestion = 'collapseSmartSnippetSuggestion',
/**
* Identifies the custom event that gets logged when the user presses "show more" on a snippet suggestion for a related question.
*
* @deprecated
*/
showMoreSmartSnippetSuggestion = 'showMoreSmartSnippetSuggestion',
/**
* Identifies the custom event that gets logged when the user presses "show less" on a snippet suggestion for a related question.
*
* @deprecated
*/
showLessSmartSnippetSuggestion = 'showLessSmartSnippetSuggestion',
/**
* Identifies the custom event that gets logged when a user clicks on the source of an answer in a smart snippet.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export class CategoryFacet extends Component<
this.state.hasActiveValues && (
<div>
Filtering by: {this.renderClearButton()}
{this.state.parents.map((parentValue, i) => {
const isSelectedValue = i === this.state.parents.length - 1;
{this.state.valuesAsTrees.map((parentValue, i) => {
const isSelectedValue = i === this.state.valuesAsTrees.length - 1;

return (
<span key={this.getUniqueKeyForValue(parentValue)}>
Expand All @@ -93,7 +93,7 @@ export class CategoryFacet extends Component<
private renderActiveValues() {
return (
<ul>
{this.state.values.map((value) => (
{this.state.selectedValueAncestry.map((value) => (
<li key={this.getUniqueKeyForValue(value)}>
<button onClick={() => this.controller.toggleSelect(value)}>
{value.value} ({value.numberOfResults}{' '}
Expand Down Expand Up @@ -127,7 +127,10 @@ export class CategoryFacet extends Component<
return null;
}

if (!this.state.hasActiveValues && this.state.values.length === 0) {
if (
!this.state.hasActiveValues &&
this.state.selectedValueAncestry.length === 0
) {
return <div>No facet values</div>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export const CategoryFacet: FunctionComponent<CategoryFacetProps> = (props) => {
state.hasActiveValues && (
<div>
Filtering by: {renderClearButton()}
{state.parents.map((parentValue, i) => {
const isSelectedValue = i === state.parents.length - 1;
{state.valuesAsTrees.map((parentValue, i) => {
const isSelectedValue = i === state.valuesAsTrees.length - 1;

return (
<span key={getUniqueKeyForValue(parentValue)}>
Expand All @@ -63,7 +63,7 @@ export const CategoryFacet: FunctionComponent<CategoryFacetProps> = (props) => {
function renderActiveValues() {
return (
<ul>
{state.values.map((value) => (
{state.selectedValueAncestry.map((value) => (
<li key={getUniqueKeyForValue(value)}>
<button onClick={() => controller.toggleSelect(value)}>
{value.value} ({value.numberOfResults}{' '}
Expand All @@ -88,7 +88,7 @@ export const CategoryFacet: FunctionComponent<CategoryFacetProps> = (props) => {
);
}

if (!state.hasActiveValues && state.values.length === 0) {
if (!state.hasActiveValues && state.selectedValueAncestry.length === 0) {
return <div>No facet values</div>;
}

Expand Down

0 comments on commit 5626479

Please sign in to comment.