-
Notifications
You must be signed in to change notification settings - Fork 41
feat: donate cta #1701
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
base: feat/pro-libsession
Are you sure you want to change the base?
feat: donate cta #1701
Conversation
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.
Pull Request Overview
This PR introduces functionality to retrieve database creation timestamps for triggering Call-to-Action (CTA) dialogs, and refactors the Pro Info Modal system into a more generalized CTA system that supports both Pro-related and donation CTAs.
- Added a new utility function
getFileCreationTimestampMsto safely retrieve file creation timestamps with proper error handling - Refactored
SessionProInfoModalintoSessionCTAto support multiple CTA variants beyond Pro features - Introduced donation CTA functionality that triggers 7 days after database creation
Reviewed Changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| ts/node/fs_utility.ts | New utility function to get file creation timestamps with validation and error handling |
| ts/node/sql.ts | Adds getDBCreationTimestampMs function and exports it |
| ts/data/dataInit.ts | Registers the new getDBCreationTimestampMs channel |
| ts/data/data.ts | Exposes getDBCreationTimestampMs through the Data layer |
| ts/util/logger/rotatingPinoDest.ts | Updates log rotation to use the new utility function with null safety |
| ts/components/dialog/cta/types.ts | Defines new CTAVariant enum with Pro and donation variants |
| ts/components/dialog/SessionCTA.tsx | Refactored and generalized modal supporting both Pro and donation CTAs |
| ts/components/dialog/ProCTATitle.tsx | Extracted Pro-specific title logic into separate component |
| ts/components/dialog/ProCTADescription.tsx | Extracted Pro-specific description logic into separate component |
| ts/components/dialog/CTADescriptionList.tsx | Reusable component for CTA feature lists |
| ts/components/leftpane/ActionsPanel.tsx | Triggers donation CTA after 7 days of database existence |
| ts/state/ducks/modalDialog.tsx | Renamed action from updateSessionProInfoModal to updateSessionCTA |
| ts/state/onboarding/ducks/modals.ts | Updates type references from SessionProInfoState to SessionCTAState |
| ts/state/ducks/conversations.ts | Updates function call to handleTriggeredProCTAs |
| ts/components/dialog/DefaultSettingsPage.tsx | Updates donation URL to use getsession.org |
| ts/components/basic/SessionButton.tsx | Refactors hover color logic for solid buttons |
| Multiple component files | Updates imports and references from Pro-specific to generalized CTA system |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // FIXME: replace with localised string | ||
| return 'Skip'; |
Copilot
AI
Nov 19, 2025
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.
The FIXME comment indicates this button text needs localization. This should be addressed before merging or tracked in a follow-up issue to ensure proper internationalization support.
| // FIXME: replace with localised string | |
| return 'Skip'; | |
| // Use localized string for "Skip" | |
| return tr('skip'); |
| color: ${props => | ||
| props.isDarkTheme && props.color && props.color !== SessionButtonColor.Tertiary | ||
| ? `var(--${props.color}-color)` | ||
| : `var(--button-solid-text-hover-color)`}; | ||
| border: 1px solid | ||
| ${props => | ||
| props.isDarkTheme && props.color | ||
| props.isDarkTheme | ||
| ? props.color && props.color !== SessionButtonColor.Tertiary | ||
| ? `var(--${props.color}-color)` | ||
| : `var(--button-solid-text-hover-color)`}; | ||
| : 'var(--primary-color)' | ||
| : `var(--button-solid-text-hover-color)`}; |
Copilot
AI
Nov 19, 2025
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.
The nested ternary operator logic is difficult to read and understand. Consider refactoring to use a more explicit conditional structure:
color: ${props => {
if (props.isDarkTheme) {
return props.color && props.color !== SessionButtonColor.Tertiary
? `var(--${props.color}-color)`
: 'var(--primary-color)';
}
return 'var(--button-solid-text-hover-color)';
}};This makes the logic clearer and easier to maintain.
| // FIXME: replace with localised string | ||
| return 'Session Needs Your Help'; |
Copilot
AI
Nov 19, 2025
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.
The FIXME comment indicates this string needs localization. This should be addressed before merging or tracked in a follow-up issue to ensure proper internationalization support.
| // FIXME: replace with localised string | |
| return 'Session Needs Your Help'; | |
| // Localized string for donate generic CTA | |
| return tr(MergedLocalizerTokens.cta_donate_generic_title); |
| // FIXME: replace with localised string | ||
| return ( | ||
| <> | ||
| {`Session is fighting powerful forces trying to weaken privacy, but we can’t continue this fight alone.`} | ||
| <br /> | ||
| <br /> | ||
| {`Donating keeps Session secure, independent, and online.`} | ||
| </> |
Copilot
AI
Nov 19, 2025
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.
The FIXME comment indicates this description needs localization. This should be addressed before merging or tracked in a follow-up issue to ensure proper internationalization support.
| {/** FIXME: replace with localised string */} | ||
| Donate |
Copilot
AI
Nov 19, 2025
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.
The FIXME comment indicates this button text needs localization. This should be addressed before merging or tracked in a follow-up issue to ensure proper internationalization support.
| {/** FIXME: replace with localised string */} | |
| Donate | |
| {/** FIXME removed: now using localised string */} | |
| {tr('donate')} |
| // TODO: add checks around if the user has interacted with the donation url dialog before | ||
| const interacted = false; | ||
| if (!interacted) { |
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.
you have everything you need to do this now, correct?
ts/components/dialog/SessionCTA.tsx
Outdated
| case CTAVariant.NIL: | ||
| return null; |
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.
what does this corresponds to?
ts/util/urlHistory.ts
Outdated
| const rawInteractions = Storage.get(SettingsKey.urlInteractions); | ||
| const result = UrlInteractionsSchema.safeParse(rawInteractions); | ||
| if (result.error) { | ||
| window?.log?.error(`faild to parse ${SettingsKey.urlInteractions}`, result.error); |
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.
| window?.log?.error(`faild to parse ${SettingsKey.urlInteractions}`, result.error); | |
| window?.log?.error(`failed to parse ${SettingsKey.urlInteractions}`, result.error); |
| export function urlInteractionToString(interaction: URLInteraction) { | ||
| switch (interaction) { | ||
| case URLInteraction.OPEN: | ||
| return 'Open'; | ||
| case URLInteraction.COPY: | ||
| return 'Copy'; | ||
| case URLInteraction.TRUST: | ||
| return 'Trust'; | ||
| default: | ||
| return 'Unknown'; | ||
| } | ||
| } |
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.
this is debug only, but should it be using the corresponding localised strings ) if we have them?
c1ea465 to
f3cfa9b
Compare
ts/components/dialog/cta/types.ts
Outdated
| type VariantForNonGroupFeature = (typeof variantsForNonGroupFeatures)[number]; | ||
|
|
||
| export function isProCTAFeatureVariant(variant: CTAVariant): variant is VariantForNonGroupFeature { | ||
| return variantsForNonGroupFeatures.includes(variant as any); |
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.
could be as number I reckon
| width: 100%; | ||
| height: 100%; | ||
| object-fit: cover; | ||
| object-position: right center; |
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.
does this need to be dependent on rtl?
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.
The whole modal has rtl now so it supports rtl 🥳
…ch_logic feat: schedule pro details fetch jobs based on proof and access expir…
…restart_edge_case fix: cleanup pro expiry ctas when pro resets
No description provided.