Add sessionId to itsr query string

Summary: This will allow rating data to be joined with version number so we can get the rating of each release.

Reviewed By: mweststrate

Differential Revision: D18297808

fbshipit-source-id: 00f151c64aad40632389f728ad25a565f44a2a90
This commit is contained in:
John Knox
2019-11-04 09:22:18 -08:00
committed by Facebook Github Bot
parent b2cf34bc2f
commit ed2343b3c6
2 changed files with 22 additions and 7 deletions

View File

@@ -21,8 +21,14 @@ import {
import GK from '../fb-stubs/GK';
import * as UserFeedback from '../fb-stubs/UserFeedback';
import {FeedbackPrompt} from '../fb-stubs/UserFeedback';
import {connect} from 'react-redux';
import {State as Store} from 'src/reducers';
type Props = {
type PropsFromState = {
sessionId: string | null;
};
type OwnProps = {
onRatingChanged: (rating: number) => void;
};
@@ -281,14 +287,14 @@ class FeedbackComponent extends Component<
}
}
export default class RatingButton extends Component<Props, State> {
class RatingButton extends Component<PropsFromState & OwnProps, State> {
state: State = {
promptData: null,
isShown: false,
hasTriggered: false,
};
constructor(props: Props) {
constructor(props: PropsFromState & OwnProps) {
super(props);
if (GK.get('flipper_rating')) {
UserFeedback.getPrompt().then(prompt => {
@@ -302,12 +308,12 @@ export default class RatingButton extends Component<Props, State> {
const willBeShown = !this.state.isShown;
this.setState({isShown: willBeShown, hasTriggered: true});
if (!willBeShown) {
UserFeedback.dismiss();
UserFeedback.dismiss(this.props.sessionId);
}
}
submitRating(rating: number) {
UserFeedback.submitRating(rating);
UserFeedback.submitRating(rating, this.props.sessionId);
}
submitComment(
@@ -321,6 +327,7 @@ export default class RatingButton extends Component<Props, State> {
comment,
selectedPredefinedComments,
allowUserInfoSharing,
this.props.sessionId,
);
}
@@ -370,3 +377,7 @@ export default class RatingButton extends Component<Props, State> {
);
}
}
export default connect<{sessionId: string | null}, null, OwnProps, Store>(
({application: {sessionId}}) => ({sessionId}),
)(RatingButton);

View File

@@ -18,7 +18,10 @@ export type FeedbackPrompt = {
shouldPopup: boolean;
};
export async function submitRating(rating: number): Promise<void> {
export async function submitRating(
rating: number,
sessionId: string | null,
): Promise<void> {
throw new Error('Method not implemented.');
}
export async function submitComment(
@@ -26,10 +29,11 @@ export async function submitComment(
comment: string,
selectedPredefinedComments: string[],
allowUserInfoSharing: boolean,
sessionId: string | null,
): Promise<void> {
throw new Error('Method not implemented.');
}
export async function dismiss(): Promise<void> {
export async function dismiss(sessionId: string | null): Promise<void> {
throw new Error('Method not implemented.');
}
export async function getPrompt(): Promise<FeedbackPrompt> {