2025-06-14 03:38:09 +10:00
|
|
|
// Copyright 2025 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React, { memo } from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
|
|
|
|
import type { MutableRefObject } from 'react';
|
|
|
|
|
|
|
|
import { getIntl } from '../selectors/user';
|
|
|
|
import { PreferencesDonations } from '../../components/PreferencesDonations';
|
2025-06-27 13:48:50 -07:00
|
|
|
import type { Page } from '../../components/Preferences';
|
|
|
|
import { useDonationsActions } from '../ducks/donations';
|
|
|
|
import type { StateType } from '../reducer';
|
|
|
|
import { isStagingServer } from '../../util/isStagingServer';
|
2025-06-14 03:38:09 +10:00
|
|
|
|
|
|
|
export const SmartPreferencesDonations = memo(
|
2025-06-27 13:48:50 -07:00
|
|
|
function SmartPreferencesDonations({
|
|
|
|
contentsRef,
|
|
|
|
page,
|
|
|
|
setPage,
|
|
|
|
}: {
|
2025-06-14 03:38:09 +10:00
|
|
|
contentsRef: MutableRefObject<HTMLDivElement | null>;
|
2025-06-27 13:48:50 -07:00
|
|
|
page: Page;
|
|
|
|
setPage: (page: Page) => void;
|
2025-06-14 03:38:09 +10:00
|
|
|
}) {
|
2025-06-27 13:48:50 -07:00
|
|
|
const isStaging = isStagingServer();
|
2025-06-14 03:38:09 +10:00
|
|
|
const i18n = useSelector(getIntl);
|
2025-06-27 13:48:50 -07:00
|
|
|
const workflow = useSelector(
|
|
|
|
(state: StateType) => state.donations.currentWorkflow
|
|
|
|
);
|
|
|
|
const { clearWorkflow, submitDonation } = useDonationsActions();
|
2025-06-14 03:38:09 +10:00
|
|
|
|
2025-06-27 13:48:50 -07:00
|
|
|
return (
|
|
|
|
<PreferencesDonations
|
|
|
|
contentsRef={contentsRef}
|
|
|
|
i18n={i18n}
|
|
|
|
isStaging={isStaging}
|
|
|
|
page={page}
|
|
|
|
workflow={workflow}
|
|
|
|
clearWorkflow={clearWorkflow}
|
|
|
|
submitDonation={submitDonation}
|
|
|
|
setPage={setPage}
|
|
|
|
/>
|
|
|
|
);
|
2025-06-14 03:38:09 +10:00
|
|
|
}
|
|
|
|
);
|