Skip to content

Commit 61b5bf4

Browse files
authored
Merge pull request #1849 from session-foundation/fix-pro-qa-issues-6
Fix pro qa issues 6
2 parents 60edbbf + 59da512 commit 61b5bf4

File tree

7 files changed

+130
-47
lines changed

7 files changed

+130
-47
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"framer-motion": "^12.5.0",
9696
"fs-extra": "11.3.0",
9797
"image-type": "^4.1.0",
98-
"libsession_util_nodejs": "https://github.com/session-foundation/libsession-util-nodejs/releases/download/v0.6.11/libsession_util_nodejs-v0.6.11.tar.gz",
98+
"libsession_util_nodejs": "https://github.com/session-foundation/libsession-util-nodejs/releases/download/v0.6.12/libsession_util_nodejs-v0.6.12.tar.gz",
9999
"libsodium-wrappers-sumo": "^0.7.15",
100100
"linkify-it": "^5.0.0",
101101
"lodash": "^4.17.21",

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/components/dialog/user-settings/pages/user-pro/ProNonOriginatingPage.tsx

Lines changed: 66 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
useProBackendProDetails,
2727
type ProcessedProDetails,
2828
} from '../../../../../state/selectors/proBackendData';
29+
import { userSettingsModal } from '../../../../../state/ducks/modalDialog';
2930

3031
type VariantPageProps = {
3132
variant: ProNonOriginatingPageVariant;
@@ -69,6 +70,8 @@ function ProPageHero({ variant }: VariantPageProps) {
6970
return <ProHeroImage heroText={tr('proCancelSorry')} noColors={true} />;
7071
case 'refund':
7172
return <ProHeroImage heroText={tr('proRefundDescription')} noColors={true} />;
73+
case 'refundRequested':
74+
return <ProHeroImage heroText={tr('proRequestedRefund')} noColors={true} />;
7275
default:
7376
return assertUnreachable(variant, `Unknown pro non originating page variant: ${variant}`);
7477
}
@@ -404,16 +407,16 @@ const ProInfoBlockRefundTitle = styled.div`
404407
font-weight: 700;
405408
padding-top: var(--margins-xs);
406409
`;
410+
const containerStyle = {
411+
paddingBlock: 'var(--margins-md)',
412+
paddingInline: 'var(--margins-lg)',
413+
gap: 'var(--margins-sm)',
414+
lineHeight: '120%',
415+
};
407416

408417
function ProInfoBlockRefundSessionSupport() {
409418
return (
410-
<PanelButtonGroup
411-
containerStyle={{
412-
paddingBlock: 'var(--margins-md)',
413-
paddingInline: 'var(--margins-lg)',
414-
gap: 'var(--margins-sm)',
415-
}}
416-
>
419+
<PanelButtonGroup containerStyle={containerStyle}>
417420
<ProInfoBlockRefundTitle>
418421
<Localizer token="proRefunding" />
419422
</ProInfoBlockRefundTitle>
@@ -429,13 +432,7 @@ function ProInfoBlockRefundSessionSupport() {
429432
function ProInfoBlockRefundGooglePlay() {
430433
const { data } = useProBackendProDetailsLocal();
431434
return (
432-
<PanelButtonGroup
433-
containerStyle={{
434-
paddingBlock: 'var(--margins-md)',
435-
paddingInline: 'var(--margins-lg)',
436-
gap: 'var(--margins-sm)',
437-
}}
438-
>
435+
<PanelButtonGroup containerStyle={containerStyle}>
439436
<ProInfoBlockRefundTitle>
440437
<Localizer token="proRefunding" />
441438
</ProInfoBlockRefundTitle>
@@ -508,6 +505,36 @@ function ProInfoBlockRefund() {
508505
}
509506
}
510507

508+
function ProInfoBlockRefundRequested() {
509+
const { data } = useProBackendProDetailsLocal();
510+
const dispatch = getAppDispatch();
511+
512+
return (
513+
<PanelButtonGroup containerStyle={containerStyle}>
514+
<ProInfoBlockRefundTitle>
515+
<Localizer token="nextSteps" />
516+
</ProInfoBlockRefundTitle>
517+
518+
<Localizer token="proRefundNextSteps" platform={data.providerConstants.platform} />
519+
<ProInfoBlockRefundTitle>
520+
<Localizer token="helpSupport" />
521+
</ProInfoBlockRefundTitle>
522+
<ProInfoBlockDescription
523+
onClick={() =>
524+
showLinkVisitWarningDialog(data.providerConstants.refund_status_url, dispatch)
525+
}
526+
style={{ cursor: 'pointer' }}
527+
>
528+
<Localizer
529+
token="proRefundSupport"
530+
platform={data.providerConstants.platform}
531+
icon={LUCIDE_ICONS_UNICODE.EXTERNAL_LINK_ICON}
532+
/>
533+
</ProInfoBlockDescription>
534+
</PanelButtonGroup>
535+
);
536+
}
537+
511538
function ProInfoBlock({ variant }: VariantPageProps) {
512539
switch (variant) {
513540
case 'upgrade':
@@ -518,6 +545,8 @@ function ProInfoBlock({ variant }: VariantPageProps) {
518545
return <ProInfoBlockCancel />;
519546
case 'refund':
520547
return <ProInfoBlockRefund />;
548+
case 'refundRequested':
549+
return <ProInfoBlockRefundRequested />;
521550
case 'renew':
522551
return <ProInfoBlockRenew />;
523552
default:
@@ -589,6 +618,27 @@ function ProPageButtonRefund() {
589618
);
590619
}
591620

621+
function ProPageButtonRefundRequested() {
622+
const dispatch = getAppDispatch();
623+
624+
return (
625+
<SessionButton
626+
{...proButtonProps}
627+
buttonColor={SessionButtonColor.Primary}
628+
onClick={() => {
629+
dispatch(
630+
userSettingsModal({
631+
userSettingsPage: 'pro',
632+
})
633+
);
634+
}}
635+
dataTestId="pro-refund-return-button"
636+
>
637+
<Localizer token="theReturn" />
638+
</SessionButton>
639+
);
640+
}
641+
592642
function ProPageButton({ variant }: VariantPageProps) {
593643
switch (variant) {
594644
case 'upgrade':
@@ -600,6 +650,8 @@ function ProPageButton({ variant }: VariantPageProps) {
600650
return <ProPageButtonCancel />;
601651
case 'refund':
602652
return <ProPageButtonRefund />;
653+
case 'refundRequested':
654+
return <ProPageButtonRefundRequested />;
603655
default:
604656
return assertUnreachable(variant, `Unknown pro non originating page variant: ${variant}`);
605657
}

ts/components/dialog/user-settings/pages/user-pro/ProSettingsPage.tsx

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,18 @@ function ProSettings({ state }: SectionProps) {
464464
title: { token: 'proAccessLoading' },
465465
description: { token: 'proAccessLoadingDescription' },
466466
})
467-
: userSettingsModal({
468-
userSettingsPage: 'proNonOriginating',
469-
nonOriginatingVariant: 'update',
470-
overrideBackAction: returnToThisModalAction,
471-
centerAlign,
472-
})
467+
: data.isProcessingRefund
468+
? userSettingsModal({
469+
userSettingsPage: 'proNonOriginating',
470+
nonOriginatingVariant: 'refundRequested',
471+
overrideBackAction: state.returnToThisModalAction,
472+
})
473+
: userSettingsModal({
474+
userSettingsPage: 'proNonOriginating',
475+
nonOriginatingVariant: 'update',
476+
overrideBackAction: returnToThisModalAction,
477+
centerAlign,
478+
})
473479
);
474480
};
475481

@@ -481,29 +487,43 @@ function ProSettings({ state }: SectionProps) {
481487
return null;
482488
}
483489

490+
let subText: TrArgs;
491+
if (isError) {
492+
subText = { token: 'errorLoadingProAccess' };
493+
} else if (isLoading) {
494+
subText = { token: 'proAccessLoadingEllipsis' };
495+
} else if (data.isProcessingRefund) {
496+
subText = { token: 'processingRefundRequest', platform: data.providerConstants.platform };
497+
} else if (data.inGracePeriod) {
498+
subText = { token: 'proRenewalUnsuccessful' };
499+
} else if (data.autoRenew) {
500+
subText = { token: 'proAutoRenewTime', time: data.expiryTimeRelativeString };
501+
} else {
502+
subText = { token: 'proExpiringTime', time: data.expiryTimeRelativeString };
503+
}
504+
484505
return (
485506
<SectionFlexContainer>
486507
<PanelLabelWithDescription title={{ token: 'proSettings' }} />
487508
<PanelButtonGroup>
488-
<SettingsChevronBasic
489-
baseDataTestId="update-access"
490-
text={{ token: 'updateAccess' }}
491-
subText={{
492-
token: isError
493-
? 'errorLoadingProAccess'
494-
: isLoading
495-
? 'proAccessLoadingEllipsis'
496-
: data.inGracePeriod
497-
? 'proRenewalUnsuccessful'
498-
: data.autoRenew
499-
? 'proAutoRenewTime'
500-
: 'proExpiringTime',
501-
time: data.expiryTimeRelativeString,
502-
}}
503-
onClick={handleUpdateAccessClick}
504-
loading={isLoading}
505-
subTextColor={isError || data.inGracePeriod ? 'var(--warning-color)' : undefined}
506-
/>
509+
{data.isProcessingRefund ? (
510+
<PanelIconButton
511+
text={{ token: 'proRequestedRefund' }}
512+
dataTestId="update-access-settings-button"
513+
onClick={handleUpdateAccessClick}
514+
iconElement={<PanelIconLucideIcon unicode={LUCIDE_ICONS_UNICODE.CIRCLE_ALERT} />}
515+
rowReverse
516+
/>
517+
) : (
518+
<SettingsChevronBasic
519+
baseDataTestId="update-access"
520+
text={{ token: 'updateAccess' }}
521+
subText={subText}
522+
onClick={handleUpdateAccessClick}
523+
loading={isLoading}
524+
subTextColor={isError || data.inGracePeriod ? 'var(--warning-color)' : undefined}
525+
/>
526+
)}
507527
<SettingsToggleBasic
508528
baseDataTestId="pro-badge-visible"
509529
text={{ token: 'proBadge' }}

ts/react.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ declare module 'react' {
211211
| 'pro-open-platform-website'
212212
| 'pro-backend-error-retry'
213213
| 'pro-backend-error-support'
214+
| 'pro-refund-return'
214215
| `${ConfirmButtons}-confirm`
215216
| `${CancelButtons}-cancel`
216217
| `clear-${ClearButtons}`

ts/state/selectors/proBackendData.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ type ProAccessDetails = {
133133
currentStatus: ProStatus;
134134
autoRenew: boolean;
135135
inGracePeriod: boolean;
136+
isProcessingRefund: boolean;
136137
variant: ProAccessVariant;
137138
variantString: string;
138139
expiryTimeMs: number;
@@ -225,11 +226,14 @@ function processProBackendData({
225226
inGracePeriod = autoRenew && now >= beginAutoRenew && now < expiryTimeMs;
226227
}
227228

229+
const isProcessingRefund = !!data?.refund_requested_unix_ts_ms;
230+
228231
return {
229232
data: {
230233
currentStatus: data?.status ?? defaultProAccessDetailsSourceData.currentStatus,
231234
autoRenew,
232235
inGracePeriod,
236+
isProcessingRefund,
233237
variant,
234238
variantString: proAccessVariantToString(variant),
235239
expiryTimeMs,

ts/types/ReduxTypes.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77

88
export type PasswordAction = 'set' | 'change' | 'remove';
99

10-
export type ProNonOriginatingPageVariant = 'upgrade' | 'update' | 'cancel' | 'refund' | 'renew';
10+
export type ProNonOriginatingPageVariant =
11+
| 'upgrade'
12+
| 'update'
13+
| 'cancel'
14+
| 'refund'
15+
| 'refundRequested'
16+
| 'renew';
1117

1218
export type EditProfilePictureModalProps = {
1319
conversationId: string;

0 commit comments

Comments
 (0)