Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(account balance): add functionality to close campaigns and transfer balance #1356

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

IanKrieger
Copy link
Member

No description provided.

@IanKrieger IanKrieger requested a review from a team as a code owner September 20, 2024 20:08
@IanKrieger IanKrieger marked this pull request as draft September 20, 2024 20:09
Copy link

[puLL-Merge] - brave/ads-ui@1356

Description

This PR adds functionality to close campaigns and manage account balances for advertisers. It introduces a new "Close Campaign" button, a modal for confirming campaign closure, and displays account balance information in various parts of the UI.

Changes

Changes

  1. src/components/Campaigns/CloseCampaignModal.tsx:

    • New component for closing campaigns with a confirmation modal.
  2. src/components/Steps/CloseCampaignSidebar.tsx:

    • New component to display the close campaign button in the sidebar.
  3. src/components/Steps/ActionButtons.tsx:

    • Added CloseCampaignSidebar component.
  4. src/components/Datagrid/renderers.tsx:

    • Updated renderMonetaryAmount to accept string input.
  5. src/hooks/useStickyRef.ts:

    • New hook for persisting state in local storage.
  6. src/user/campaignList/CampaignList.tsx:

    • Added CloseCampaignModal to campaign list items.
  7. src/user/hooks/useGetAdvertiserAccountBalance.tsx:

    • New hook for fetching advertiser account balance.
  8. src/user/settings/AccountBalance.tsx:

    • New component to display account balance in settings.
  9. src/user/settings/Settings.tsx:

    • Added AccountBalance component to settings page.
  10. src/user/views/adsManager/views/advanced/components/campaign/fields/PaymentMethodField.tsx:

    • Updated to display account balance information and calculate charges.
  11. Various GraphQL schema and localization updates to support new features.

Possible Issues

  1. The new useStickyRef hook doesn't fully support setting state with a function, which may limit its flexibility in some scenarios.

  2. The account balance feature is only shown for certain types of advertisers (selfServiceManageCampaign true and selfServiceSetPrice false). This may cause confusion for users who don't see the feature.

Security Hotspots

  1. src/hooks/useStickyRef.ts: This hook stores data in localStorage, which could potentially expose sensitive information if not used carefully. Ensure that no sensitive data is stored using this hook.

  2. src/components/Campaigns/CloseCampaignModal.tsx: The forceCampaignCompletionAndTransferFunds mutation should be properly secured on the server-side to prevent unauthorized campaign closures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant