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

MNTOR-3057 - Cancel flow discount callout #4635

Merged
merged 27 commits into from
Jun 19, 2024
Merged

MNTOR-3057 - Cancel flow discount callout #4635

merged 27 commits into from
Jun 19, 2024

Conversation

codemist
Copy link
Collaborator

@codemist codemist commented Jun 5, 2024

References:

Jira: MNTOR-3057
Figma: https://www.figma.com/design/DTbmXzCQCw2PxXpHQW8yfW/Monitor-MVP-Enhancements?node-id=1157-25611&t=CyXrO2sT6Vra9psg-0

Description

The flags CancellationFlow, ConfirmCancellation and DiscountCouponNextThreeMonths are required. You'll also need the CURRENT_COUPON_CODE_ID env var set, which can be found in this ticket: https://mozilla-hub.atlassian.net/browse/MNTOR-3057?focusedCommentId=895742.

With account that's subscribed to premium, go through the cancellation flow and the 30% off discount state should be visible. Selecting the CTA should output a fxa_apply_coupon_code_success in your server logs, and you should be taken to the all-set dialog state.

Screenshot (if applicable)

Screen.Recording.2024-06-13.at.3.34.02.PM.mov

How to test

Checklist (Definition of Done)

  • Localization strings (if needed) have been added.
  • Commits in this PR are minimal and have descriptive commit messages.
  • I've added or updated the relevant sections in readme and/or code comments
  • I've added a unit test to test for potential regressions of this bug.
  • If this PR implements a feature flag or experimentation, the Ship Behind Feature Flag status in Jira has been set
  • Product Owner accepted the User Story (demo of functionality completed) or waived the privilege.
  • All acceptance criteria are met.
  • Jira ticket has been updated (if needed) to match changes made during the development process.
  • Jira ticket has been updated (if needed) with suggestions for QA when this PR is deployed to stage.

Copy link

github-actions bot commented Jun 5, 2024

@codemist codemist changed the base branch from main to MNTOR-3272 June 6, 2024 15:48
@codemist codemist changed the base branch from MNTOR-3272 to MNTOR-3271 June 6, 2024 15:50
@codemist codemist changed the base branch from MNTOR-3271 to MNTOR-3272 June 6, 2024 15:52
@codemist codemist changed the base branch from MNTOR-3272 to main June 6, 2024 20:57
@codemist codemist changed the base branch from main to MNTOR-3272 June 7, 2024 19:39
@codemist codemist changed the base branch from MNTOR-3272 to main June 7, 2024 19:39
@codemist codemist changed the base branch from main to MNTOR-3272 June 7, 2024 19:40
Base automatically changed from MNTOR-3272 to main June 12, 2024 20:49
@codemist codemist marked this pull request as ready for review June 13, 2024 13:52
@codemist codemist requested a review from flodolo as a code owner June 13, 2024 13:52
Copy link
Collaborator

@mansaj mansaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking good to me, tests are breaking due to the console logs I believe.
I haven't had the chance to manually test the UI e2e, will do

@codemist codemist requested a review from flozia June 14, 2024 15:40

const discountedNext3Months: DiscountData = {
headline: l10n.getString("settings-unsubscribe-dialog-promotion-cta", {
discount_percentage_num: "30%",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Is it OK to pass the % sign here or should this be part of the localized string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 54 to 55
const [primaryCta, setPrimaryCta] = useState<ReactElement>();
const [ctaSubtitle, setCtaSubtitle] = useState<ReactElement>();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React component should not go into state: What Shouldn’t Go in State?. Since the entire component rerenders when you update step with setStep you can just assign primaryCta and ctaSubtitle to a variable depending on the current step.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha! I previously used state because in the old nimbus experiments implementation it seemed like we wanted to account for different variations of the discount code step. Good to know though. 06d0d4b

Comment on lines 106 to 107
// Current experiment
// Note: Opted to use state here to support future experiments
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, I don’t think you would need to store the elements in state.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 06d0d4b

/>
</video>
{/* Fall back to the image if the video formats are not supported: */}
{/* The .staticAlternative class ensures that this image will only be shown if the user has prefers-reduced-motion on */}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise: Nice!

@codemist codemist requested a review from flozia June 17, 2024 15:37
@codemist codemist requested review from mansaj and jespy2 June 17, 2024 22:48
Comment on lines +51 to +74
.goToDashboardCta {
margin-top: $spacing-lg;
font: $text-body-md;
font-weight: 500;
border: 0;
padding: $spacing-md $spacing-lg;
border-radius: $border-radius-md;
cursor: pointer;
display: inline-block;
line-height: 1;
text-align: center;
text-decoration: none;
color: $color-white;
background-color: $color-blue-50;

&:hover {
background-color: $color-blue-60;
}

&:focus {
outline: $border-focus-width solid $color-blue-30;
}
}

Copy link
Collaborator Author

@codemist codemist Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use the styling from Button here but alas, "Go to dashboard" functions as an internal link and I had to use the TelemetryLink component which does not use the Button, hence the custom styling.

Comment on lines +168 to +171
className={`
${styles.cancellationIllustrationWrapper}
${styles.staticAlternative}
`}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting: Not sure why the linter is not picking up on this, but the formatting seems to be off here?


const checkCouponCode = async () => {
const result = await onCheckUserHasCurrentCouponSet();
if (typeof result.success === "boolean") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking for a boolean here might not be enough. It’s safer to explicitly check if result.success is also truthy.

Copy link
Collaborator

@mansaj mansaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, lgtm on the calls

/* c8 ignore start */
const handleApplyCouponCode = async () => {
const result = await onApplyCouponCode();
if (result?.success) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be simplified as: setCouponSuccess(!!result?.success);

Copy link
Contributor

@jespy2 jespy2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM--no additional comments

@codemist codemist merged commit 190f4c0 into main Jun 19, 2024
15 checks passed
@codemist codemist deleted the mntor-3057 branch June 19, 2024 14:24
Copy link

Cleanup completed - database 'blurts-server-pr-4635' destroyed, cloud run service 'blurts-server-pr-4635' destroyed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants