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

Allow passing referral in the URL for dApp #679

Merged
merged 27 commits into from
Aug 13, 2024
Merged

Conversation

kkosiorowska
Copy link
Contributor

@kkosiorowska kkosiorowska commented Jul 30, 2024

Closes #566

Acre will support the referral program. The referral value will be specified in the ref parameter in the URL. So when the user opens the dApp from the link https://stake.acre.fi/?ref=48450, the referral in the deposit flow should be set to the same value: 48450. The value of the referral was saved in localStorage. Some basic requirements:

  • ref parameter should allow numbers only up to max uint16.
  • When the ref parameter is not specified in the URL, the referral should be set to 0.
  • When the referral does not pass the required conditions, set the value to null and show a special modal window with an error. Navigation as well as the button to connect the account should be disabled from use.
  • When the user opens the dApp from the link https://stake.acre.fi/?ref=48450, the referral in the deposit flow should be set to the same value: 48450.
  • When the user changes subpages, let's not remove the value of the ref parameter.

Testing

  • Check that the ref parameter is detected and set correctly in localStorage.
  • Check that if the parameter is not specified the referral is set to 0.
  • Check that if the parameter is not correct, an error modal window is displayed and the referral is set to null.
  • Initialize a deposit and check the referral is included in the deposit initialization event.

DApp should detect by which partner it was opened. As a result, we will be able to customize the solutions depending on the partner.
@kkosiorowska kkosiorowska self-assigned this Jul 30, 2024
Copy link

netlify bot commented Jul 30, 2024

Deploy Preview for acre-dapp ready!

Name Link
🔨 Latest commit 6e52e05
🔍 Latest deploy log https://app.netlify.com/sites/acre-dapp/deploys/66bb3df6e6b4d6000832a5a5
😎 Deploy Preview https://deploy-preview-679--acre-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jul 30, 2024

Deploy Preview for acre-dapp-testnet ready!

Name Link
🔨 Latest commit 6e52e05
🔍 Latest deploy log https://app.netlify.com/sites/acre-dapp-testnet/deploys/66bb3df6eba8b10008c83c11
😎 Deploy Preview https://deploy-preview-679--acre-dapp-testnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kkosiorowska kkosiorowska marked this pull request as ready for review July 31, 2024 08:51
kpyszkowski
kpyszkowski previously approved these changes Aug 1, 2024
Copy link
Contributor

@kpyszkowski kpyszkowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

dapp/src/hooks/useReferral.ts Outdated Show resolved Hide resolved
dapp/src/hooks/useReferral.ts Outdated Show resolved Hide resolved
@nkuba
Copy link
Member

nkuba commented Aug 7, 2024

I opened the dApp with no referral parameter https://deploy-preview-679--acre-dapp-testnet.netlify.app/.
Local storage referral was set to 0.
I tried to initialize a deposit.
I see an error thrown in logs: Error: Referral not defined.

@kkosiorowska
Copy link
Contributor Author

I opened the dApp with no referral parameter https://deploy-preview-679--acre-dapp-testnet.netlify.app/. Local storage referral was set to 0. I tried to initialize a deposit. I see an error thrown in logs: Error: Referral not defined.

Fixed in 13de34b.

We should not allow to open other modal windows when the global error modal is displayed.
@kkosiorowska kkosiorowska requested a review from nkuba August 8, 2024 07:28
Copy link
Contributor

@kpyszkowski kpyszkowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and tested.
Looks good to me

@kpyszkowski kpyszkowski enabled auto-merge August 12, 2024 07:59
Copy link
Contributor

@michalinacienciala michalinacienciala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good on a QA side.

@kpyszkowski kpyszkowski merged commit 7a3ee4a into main Aug 13, 2024
28 checks passed
@kpyszkowski kpyszkowski deleted the referral-program branch August 13, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow passing referral in the URL
4 participants