-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: add reasons to unsub modal #24109
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b36b3b8
add reasons to unsub modal
zlwaterfield c00b771
add toggleSurveyReason
zlwaterfield 5515650
Update UI snapshots for `chromium` (1)
github-actions[bot] 3405e03
fix e2e tests
zlwaterfield 170d371
Update UnsubscribeSurveyModal.tsx
zlwaterfield 18ebd8a
Update UI snapshots for `chromium` (1)
github-actions[bot] 18fbcf8
Update UI snapshots for `chromium` (1)
github-actions[bot] 0a96268
Use checkboxes instead
zlwaterfield fde6626
Update UI snapshots for `chromium` (1)
github-actions[bot] a343602
add data-attr
zlwaterfield 60e7c77
Update UnsubscribeSurveyModal.tsx
zlwaterfield c0c4700
Update UnsubscribeSurveyModal.tsx
zlwaterfield 8edeb68
Update UI snapshots for `chromium` (1)
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+22.6 KB
(190%)
frontend/__snapshots__/scenes-other-billing--billing-unsubscribe-modal--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+23.4 KB
(190%)
frontend/__snapshots__/scenes-other-billing--billing-unsubscribe-modal--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+22.7 KB
(140%)
...hots__/scenes-other-billing--billing-unsubscribe-modal-data-pipelines--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+22.2 KB
(140%)
...ots__/scenes-other-billing--billing-unsubscribe-modal-data-pipelines--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,6 +1,6 @@ | ||||||
import './UnsubscribeSurveyModal.scss' | ||||||
|
||||||
import { LemonBanner, LemonButton, LemonModal, LemonTextArea, Link } from '@posthog/lemon-ui' | ||||||
import { LemonBanner, LemonButton, LemonCheckbox, LemonLabel, LemonModal, LemonTextArea, Link } from '@posthog/lemon-ui' | ||||||
import { useActions, useValues } from 'kea' | ||||||
|
||||||
import { BillingProductV2AddonType, BillingProductV2Type } from '~/types' | ||||||
|
@@ -9,13 +9,26 @@ import { billingLogic } from './billingLogic' | |||||
import { billingProductLogic } from './billingProductLogic' | ||||||
import { ExportsUnsubscribeTable, exportsUnsubscribeTableLogic } from './ExportsUnsubscribeTable' | ||||||
|
||||||
const UNSUBSCRIBE_REASONS = [ | ||||||
'Too expensive', | ||||||
'Not getting enough value', | ||||||
'Not using the product', | ||||||
'Found a better alternative', | ||||||
'Poor customer support', | ||||||
'Too difficult to use', | ||||||
'Not enough hedgehogs', | ||||||
'Other', | ||||||
zlwaterfield marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
] | ||||||
|
||||||
export const UnsubscribeSurveyModal = ({ | ||||||
product, | ||||||
}: { | ||||||
product: BillingProductV2Type | BillingProductV2AddonType | ||||||
}): JSX.Element | null => { | ||||||
const { surveyID, surveyResponse, isAddonProduct } = useValues(billingProductLogic({ product })) | ||||||
const { setSurveyResponse, reportSurveyDismissed } = useActions(billingProductLogic({ product })) | ||||||
const { setSurveyResponse, toggleSurveyReason, reportSurveyDismissed } = useActions( | ||||||
billingProductLogic({ product }) | ||||||
) | ||||||
const { deactivateProduct, resetUnsubscribeError } = useActions(billingLogic) | ||||||
const { unsubscribeError, billingLoading, billing } = useValues(billingLogic) | ||||||
const { unsubscribeDisabledReason, itemsToDisable } = useValues(exportsUnsubscribeTableLogic) | ||||||
|
@@ -42,11 +55,7 @@ export const UnsubscribeSurveyModal = ({ | |||||
resetUnsubscribeError() | ||||||
}} | ||||||
width="max(44vw)" | ||||||
title={ | ||||||
billing?.subscription_level === 'paid' | ||||||
? `Why are you ${actionVerb}?` | ||||||
: `Why are you ${actionVerb} from ${product.name}?` | ||||||
} | ||||||
title={isAddonProduct ? action : `${action} from ${product.name}`} | ||||||
footer={ | ||||||
<> | ||||||
<LemonButton | ||||||
|
@@ -75,33 +84,59 @@ export const UnsubscribeSurveyModal = ({ | |||||
} | ||||||
> | ||||||
<div className="flex flex-col gap-3.5"> | ||||||
{unsubscribeError ? ( | ||||||
{unsubscribeError && ( | ||||||
<LemonBanner type="error"> | ||||||
<p> | ||||||
{unsubscribeError.detail} {unsubscribeError.link} | ||||||
</p> | ||||||
</LemonBanner> | ||||||
)} | ||||||
{isAddonProduct ? ( | ||||||
<p>We're sorry to see you go! Please note, you'll lose access to the addon features immediately.</p> | ||||||
) : ( | ||||||
<LemonBanner type="info"> | ||||||
<p> | ||||||
Any outstanding invoices will be billed immediately.{' '} | ||||||
<Link to={billing?.stripe_portal_url} target="_blank"> | ||||||
View invoices | ||||||
</Link> | ||||||
</p> | ||||||
</LemonBanner> | ||||||
<p> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's some extra-large margin here due to
Suggested change
(this is important so that the modal doesn't require scrolling) |
||||||
We're sorry to see you go! Please note, you'll lose access to platform features and usage limits | ||||||
will apply immediately. And if you have any outstanding invoices, they will be billed | ||||||
immediately.{' '} | ||||||
<Link to={billing?.stripe_portal_url} target="_blank"> | ||||||
View invoices | ||||||
</Link> | ||||||
</p> | ||||||
)} | ||||||
|
||||||
<LemonLabel> | ||||||
{billing?.subscription_level === 'paid' | ||||||
? `Why are you ${actionVerb}?` | ||||||
: `Why are you ${actionVerb} from ${product.name}?`}{' '} | ||||||
(select multiple) | ||||||
zlwaterfield marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
</LemonLabel> | ||||||
<div className="grid grid-cols-2 gap-2"> | ||||||
{UNSUBSCRIBE_REASONS.map((reason) => ( | ||||||
<LemonCheckbox | ||||||
bordered | ||||||
key={reason} | ||||||
label={reason} | ||||||
dataAttr={`unsubscribe-reason-${reason.toLowerCase().replace(' ', '-')}`} | ||||||
checked={surveyResponse['$survey_reasons'].includes(reason)} | ||||||
onChange={() => toggleSurveyReason(reason)} | ||||||
className="w-full" | ||||||
labelClassName="w-full" | ||||||
/> | ||||||
))} | ||||||
</div> | ||||||
|
||||||
<LemonTextArea | ||||||
data-attr="unsubscribe-reason-survey-textarea" | ||||||
placeholder={`Reason for ${actionVerb}...`} | ||||||
placeholder="Share your feedback here so we can improve PostHog!" | ||||||
value={surveyResponse['$survey_response']} | ||||||
onChange={(value) => { | ||||||
setSurveyResponse(value, '$survey_response') | ||||||
setSurveyResponse('$survey_response', value) | ||||||
}} | ||||||
/> | ||||||
|
||||||
<LemonBanner type="info"> | ||||||
<p> | ||||||
{'Need to control your costs? Learn about ways to '} | ||||||
{'Are you looking to control your costs? Learn about ways to '} | ||||||
<Link | ||||||
to="https://posthog.com/docs/billing/estimating-usage-costs#how-to-reduce-your-posthog-costs" | ||||||
target="_blank" | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOL