Files
freeCodeCamp/client/src/utils/analyticsStrings.ts
Ahmad Abdolsaheb bff61255f9 feat(donation): simplify donation client (#46379)
* feat: unify post payment actions

* feat: handle stripe card error and add donation after auth

* feat: add donation saga stripe test

* feat: add more coverage to stripe tests

* feat: add initial stripe card saga test

* feat: finalize initial stripe card saga test

* feat: add patreon test saga

* feat: test clean up

* feat: do not show processing for Patreon

* feat: normalize donation settings

* feat: turn payment provider/contex to enum

* feat: remove donation-settings.js

* fix: git ignore generated config

* fix: ignore the generate config from everything

* fix: remove types.js

* fix: update linting to include types.js

Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>
2022-12-20 18:03:06 +05:30

16 lines
470 B
TypeScript

import { PaymentContext, PaymentProvider } from '../components/Donation/types';
export function stringifyDonationEvents(
paymentContext: PaymentContext,
paymentProvider: PaymentProvider
): string {
const donationString = `${paymentContext} ${paymentProvider} payment ${
paymentProvider === 'patreon' ? 'redirection' : 'submission'
}`;
// return title case
return donationString.replace(/(^\w{1})|(\s+\w{1})/g, letter =>
letter.toUpperCase()
);
}