Skip to content

Commit

Permalink
add partnerMetadata to donation submission and URL parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Fishbakh-N committed Dec 6, 2024
1 parent 416fd2c commit b56cee5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const useSubmitDonation = () => {
privateNote,
publicTestimony,
webhookToken,
partnerMetadata: config.partnerMetadata,
designation,
requireShareInfo
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export interface WidgetConfig {

webhookToken?: string;

partnerMetadata?: string;

redeemGiftCardInFlow?: boolean;

designation?: string;
Expand Down
4 changes: 4 additions & 0 deletions packages/donate-button-v4/src/helpers/constructDonateUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface BaseUrlParams {
publicTestimony?: string;
utmSource?: string;
webhookToken?: string;
partnerMetadata?: string;
designation?: string;
requireShareInfo?: boolean;
}
Expand Down Expand Up @@ -77,6 +78,7 @@ function getBaseParams({
publicTestimony,
utmSource,
webhookToken,
partnerMetadata,
designation,
requireShareInfo
}: Pick<
Expand All @@ -88,6 +90,7 @@ function getBaseParams({
| 'publicTestimony'
| 'utmSource'
| 'webhookToken'
| 'partnerMetadata'
| 'designation'
| 'requireShareInfo'
>) {
Expand All @@ -97,6 +100,7 @@ function getBaseParams({
[DonateUrlParameters.PRIVATE_NOTE]: privateNote,
[DonateUrlParameters.PUBLIC_TESTIMONY]: publicTestimony,
[DonateUrlParameters.PARTNER_WEBHOOK_TOKEN]: webhookToken,
[DonateUrlParameters.PARTNER_METADATA]: partnerMetadata,
[DonateUrlParameters.DESIGNATION]: designation,
[DonateUrlParameters.REQUIRE_SHARE_INFO]: requireShareInfo,
[UTM_QUERY_PARAM.utm_campaign]: 'donate-button',
Expand Down
10 changes: 9 additions & 1 deletion packages/donate-button-v4/src/helpers/parseDonateUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ export function parseDonateUrl(
: `#${primaryColorFromUrl}`
: undefined;

const webhookToken =
searchParameters.get(DonateUrlParameters.PARTNER_WEBHOOK_TOKEN) ??
undefined;
const partnerMetadata =
searchParameters.get(DonateUrlParameters.PARTNER_METADATA) ?? undefined;

if (!nonprofitSlug) {
return;
}
Expand All @@ -131,6 +137,8 @@ export function parseDonateUrl(
minDonationAmount: minAmount,
primaryColor,
designation,
requireShareInfo
requireShareInfo,
webhookToken,
partnerMetadata
});
}

0 comments on commit b56cee5

Please sign in to comment.