Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch all support articles from the same endpoint #76734

Merged
merged 28 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0ba29b6
Hack Calypso help to pull all articles from the same endpoint
gravityrail May 9, 2023
3e8a9b1
checkpoint
gravityrail May 9, 2023
b8fc52a
Linting
gravityrail May 11, 2023
1d4d7dc
Fix missing variables (need to keep siteIntent for later
gravityrail May 11, 2023
1b15aea
Merge branch 'trunk' into goldsounds/vectorized-help-search
gravityrail May 11, 2023
c841fdf
Revert unrelated change
gravityrail May 11, 2023
c40c645
Revert more unrelated changes
gravityrail May 11, 2023
e618673
Remove disabled tests that were breaking the build
gravityrail May 11, 2023
445c531
Armwrestling the type system
gravityrail May 11, 2023
81c4bf9
Revert unrelated changes
gravityrail May 12, 2023
c1fabe0
Add more tracks events
gravityrail May 15, 2023
dd47cd8
Merge branch 'trunk' into goldsounds/vectorized-help-search
gravityrail May 15, 2023
e86fe6d
Remove more Sibyl parts
gravityrail May 15, 2023
28585ad
Remove all trace of Sibyl for now
gravityrail May 15, 2023
99da64a
Add more tracking, thumbs up/down, and button state tweaks
gravityrail May 16, 2023
697082e
Add external/internal icons to search results
gravityrail May 16, 2023
5c04369
Add better styling, remove warnings, better type hints
gravityrail May 16, 2023
8f19d1c
Remove unrelated changes
gravityrail May 16, 2023
2326ddd
Better (but not perfect) state handling
gravityrail May 16, 2023
d974cc1
Revert unnecessary changes
gravityrail May 16, 2023
5b15e6a
Fix small formatting issue
gravityrail May 16, 2023
8de71d0
Set email subject/message from search query
gravityrail May 16, 2023
9884229
More informative error
gravityrail May 16, 2023
51b8e04
Merge branch 'trunk' into goldsounds/vectorized-help-search
gravityrail May 16, 2023
fa468c7
Make search result titles more consistent
gravityrail May 16, 2023
3812f4d
Fix naming of contact form tracks events
gravityrail May 17, 2023
ab3711a
Merge branch 'trunk' into goldsounds/vectorized-help-search
gravityrail May 17, 2023
3d218c6
Remove stray and incorrect comment
gravityrail May 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/blocks/inline-help/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
flex-grow: 2;
}

.gridicon {
.gridicon, svg {
align-self: baseline;
color: var( --color-neutral-light );
flex-shrink: 0;
Expand Down
58 changes: 29 additions & 29 deletions client/me/help/help-contact-form/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,33 @@ import { generateSubjectFromMessage } from './utils';

import './style.scss';

const trackSibylClick = ( event, helpLink ) =>
const trackArticleClick = ( event, helpLink ) =>
composeAnalytics(
bumpStat( 'sibyl_question_clicks', helpLink.id ),
recordTracksEventAction( 'calypso_sibyl_question_click', {
question_id: helpLink.id,
} )
);

const trackSibylFirstClick = ( event, helpLink ) =>
const trackArticleFirstClick = ( event, helpLink ) =>
composeAnalytics(
recordTracksEventAction( 'calypso_sibyl_first_question_click', {
question_id: helpLink.id,
} )
);

const trackSupportAfterSibylClick = () =>
const trackSupportAfterArticleClick = () =>
composeAnalytics( recordTracksEventAction( 'calypso_sibyl_support_after_question_click' ) );

const trackSupportWithSibylSuggestions = ( query, suggestions ) =>
const trackSupportWithArticleSuggestions = ( query, suggestions ) =>
composeAnalytics(
recordTracksEventAction( 'calypso_sibyl_support_with_suggestions_showing', {
query,
suggestions,
} )
);

const trackSupportWithoutSibylSuggestions = ( query ) =>
const trackSupportWithoutArticleSuggestions = ( query ) =>
composeAnalytics(
recordTracksEventAction( 'calypso_sibyl_support_without_suggestions_showing', { query } )
);
Expand Down Expand Up @@ -112,7 +112,7 @@ export class HelpContactForm extends PureComponent {
state = this.props.valueLink.value || {
message: '',
subject: '',
sibylClicked: false,
articleClicked: false,
userDeclaresNoSite: false,
userDeclaresUnableToSeeSite: this.props.siteCount === 0,
userDeclaredUrl: '',
Expand Down Expand Up @@ -151,7 +151,7 @@ export class HelpContactForm extends PureComponent {
} );
};

getSibylQuery = () => this.state.message.trim();
getArticleQuery = () => this.state.message.trim();

doRequestSite = () => {
if ( resemblesUrl( this.state.userDeclaredUrl ) ) {
Expand Down Expand Up @@ -183,7 +183,7 @@ export class HelpContactForm extends PureComponent {
requestSite = debounce( this.doRequestSite, 500 );

doQandASearch = () => {
const query = this.getSibylQuery();
const query = this.getArticleQuery();

if ( '' === query ) {
this.setState( { qanda: [] } );
Expand Down Expand Up @@ -214,23 +214,23 @@ export class HelpContactForm extends PureComponent {
}
this.setState( {
qanda: Array.isArray( qanda ) ? qanda : [],
// only keep sibylClicked true if the user is seeing the same set of questions
// only keep articleClicked true if the user is seeing the same set of questions
// we don't want to track "questions -> question click -> different questions -> support click",
// so we need to set sibylClicked to false here if the questions have changed
sibylClicked: this.state.sibylClicked && sameQuestionsReturned,
// so we need to set articleClicked to false here if the questions have changed
articleClicked: this.state.articleClicked && sameQuestionsReturned,
} );
} )
.catch( () => this.setState( { qanda: [], sibylClicked: false } ) );
.catch( () => this.setState( { qanda: [], articleClicked: false } ) );
};

debouncedQandA = debounce( this.doQandASearch, 500 );

trackSibylClick = ( event, helpLink ) => {
if ( ! this.state.sibylClicked ) {
this.props.trackSibylFirstClick( event, helpLink );
if ( ! this.state.articleClicked ) {
this.props.trackArticleFirstClick( event, helpLink );
}
this.props.trackSibylClick( event, helpLink );
this.setState( { sibylClicked: true } );
this.props.trackArticleClick( event, helpLink );
this.setState( { articleClicked: true } );
};

/**
Expand Down Expand Up @@ -319,17 +319,17 @@ export class HelpContactForm extends PureComponent {
} );
}

if ( this.state.sibylClicked ) {
if ( this.state.articleClicked ) {
// track that the user had clicked a Sibyl result, but still contacted support
this.props.trackSupportAfterSibylClick();
this.setState( { sibylClicked: false } );
this.props.trackSupportAfterArticleClick();
this.setState( { articleClicked: false } );
}

if ( this.state.qanda.length === 0 ) {
this.props.trackSupportWithoutSibylSuggestions( this.getSibylQuery() );
this.props.trackSupportWithoutArticleSuggestions( this.getArticleQuery() );
} else {
this.props.trackSupportWithSibylSuggestions(
this.getSibylQuery(),
this.props.trackSupportWithArticleSuggestions(
this.getArticleQuery(),
this.state.qanda.map( ( { id, title } ) => `${ id } - ${ title }` ).join( ' / ' )
);
}
Expand Down Expand Up @@ -474,7 +474,7 @@ export class HelpContactForm extends PureComponent {
</h2>
<InlineHelpCompactResults
helpLinks={ this.state.qanda }
onClick={ this.trackSibylClick }
onClick={ this.trackArticleClick }
/>
<FormButton disabled={ ! this.canSubmitForm() } type="button" onClick={ this.submitForm }>
{ buttonLabel }
Expand Down Expand Up @@ -628,7 +628,7 @@ export class HelpContactForm extends PureComponent {
header={ translate( 'Do you want the answer to any of these questions?' ) }
helpLinks={ this.state.qanda }
iconTypeDescription="book"
onClick={ this.trackSibylClick }
onClick={ this.trackArticleClick }
compact
/>
) }
Expand Down Expand Up @@ -675,11 +675,11 @@ const mapDispatchToProps = {
onChangeSite: selectSiteId,
recordTracksEventAction,
requestSite,
trackSibylClick,
trackSibylFirstClick,
trackSupportAfterSibylClick,
trackSupportWithSibylSuggestions,
trackSupportWithoutSibylSuggestions,
trackArticleClick,
trackArticleFirstClick,
trackSupportAfterArticleClick,
trackSupportWithArticleSuggestions,
trackSupportWithoutArticleSuggestions,
};

export default connect( mapStateToProps, mapDispatchToProps )( localize( HelpContactForm ) );
2 changes: 1 addition & 1 deletion packages/calypso-e2e/src/secrets/secrets-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class SecretsManager {
'This also may mean the typings for the secrets are stale and need updating.\n\n' +
'Details:\n' +
`\tInvalid or missing key: ${ fullKeyPath }\n` +
`\tExpected type: ${ typeof reference[ key ] }`
`\tExpected type: ${ typeof reference[ key ] }, got ${ typeof target[ key ] }`
);
}

Expand Down
Loading