2025-06-25 18:16:46 -05:00
|
|
|
// Copyright 2025 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import { DataReader } from '../sql/Client';
|
|
|
|
import { strictAssert } from '../util/assert';
|
|
|
|
|
2025-07-10 07:34:42 +10:00
|
|
|
import { _getWorkflowFromStorage } from './donations';
|
|
|
|
|
2025-06-25 18:16:46 -05:00
|
|
|
import type { DonationReceipt } from '../types/Donations';
|
|
|
|
import type { DonationsStateType } from '../state/ducks/donations';
|
|
|
|
|
|
|
|
let donationReceipts: Array<DonationReceipt> | undefined;
|
|
|
|
|
|
|
|
export async function loadDonationReceipts(): Promise<void> {
|
|
|
|
donationReceipts = await DataReader.getAllDonationReceipts();
|
|
|
|
}
|
|
|
|
|
2025-07-17 04:33:41 +10:00
|
|
|
export function getDonationsForRedux(): DonationsStateType {
|
2025-06-25 18:16:46 -05:00
|
|
|
strictAssert(
|
|
|
|
donationReceipts != null,
|
|
|
|
'donation receipts have not been loaded'
|
|
|
|
);
|
2025-07-17 04:33:41 +10:00
|
|
|
const currentWorkflow = _getWorkflowFromStorage();
|
|
|
|
|
2025-06-25 18:16:46 -05:00
|
|
|
return {
|
2025-07-17 04:33:41 +10:00
|
|
|
currentWorkflow,
|
|
|
|
didResumeWorkflowAtStartup: Boolean(currentWorkflow),
|
2025-07-10 07:34:42 +10:00
|
|
|
lastError: undefined,
|
2025-06-25 18:16:46 -05:00
|
|
|
receipts: donationReceipts,
|
|
|
|
};
|
|
|
|
}
|