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: prototype of referral system in console #142

Merged
merged 30 commits into from
Dec 3, 2024
Merged

Conversation

travis
Copy link
Member

@travis travis commented Oct 25, 2024

Summary

This PR spikes out a referral system that stores data in Cloudflare's D1. It allows anonymous or logged-in users to create referral codes associated with their email addresses, and records the referral code a user used to sign up for an account. It does not implement the discounts and other rewards associated with the referral system - these are expected to be handled manually in the first released version and implemented as automated systems later, so are a non-goal of this PR.

Referrals service

The referrals service has been extracted to its own worker:

storacha/referrals-service#1

User Experience

The UX is just about dialed in - need to do a pass on the copy and some minor layout stuff, but if you have any thoughts on the big picture now is a great time to chime in!

Screenshot 2024-11-05 at 4 01 18 PM Screenshot 2024-11-05 at 4 00 10 PM Screenshot 2024-11-05 at 4 00 20 PM Screenshot 2024-11-05 at 5 57 42 PM

TODOs

  • document referrals system development process
  • document referrals system design
  • integrate designs from UX designer

use server actions for now
server actions are confusing and weren't working properly
@travis travis temporarily deployed to preview-142/merge October 25, 2024 10:25 — with GitHub Actions Inactive
@travis travis marked this pull request as draft October 25, 2024 10:26
Copy link
Contributor

github-actions bot commented Oct 25, 2024

Website preview 🔗✨

build log

@travis travis temporarily deployed to preview-142/merge November 6, 2024 00:03 — with GitHub Actions Inactive
@travis travis temporarily deployed to preview-142/merge November 6, 2024 00:14 — with GitHub Actions Inactive
also record refcode in the plan gate, too
@travis travis temporarily deployed to preview-142/merge November 6, 2024 01:59 — with GitHub Actions Inactive
@travis travis temporarily deployed to preview-142/merge November 6, 2024 18:15 — with GitHub Actions Inactive
@travis travis temporarily deployed to preview-142/merge November 7, 2024 00:39 — with GitHub Actions Inactive
extracted from original implementation in #142
travis added a commit to storacha/referrals-service that referenced this pull request Nov 8, 2024
extracted from original implementation in storacha/console#142
travis added a commit to storacha/referrals-service that referenced this pull request Nov 8, 2024
extracted from original implementation in storacha/console#142
travis added a commit to storacha/referrals-service that referenced this pull request Nov 8, 2024
extracted from original implementation in storacha/console#142
@travis travis marked this pull request as ready for review November 8, 2024 00:59
for some reason the UI isn't updating in the preview env - I suspect this is because we haven't told SWR it needs to refresh and its refresh behavior is more liberal in development
I was thinking the state would be shared between invocations of the hook and that's just not the case! I'd need to introduce a context to get it to work the way I expected. DOH.

move to an argument passing style because that's easier than introducing a context, for now
src/app/referrals/page.tsx Outdated Show resolved Hide resolved
Copy link
Member

@fforbeck fforbeck left a comment

Choose a reason for hiding this comment

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

It looks good to me. I added a minor suggestion.

Comment on lines +22 to +23
const MAX_REFERRALS = 11
const MAX_CREDITS = 460
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: read it from env.

Copy link
Member Author

Choose a reason for hiding this comment

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

ah yea - I'm going to come back to this once we have support for actually giving people credits and displaying them - will move to config once that's done!

@travis travis merged commit 6f760fe into main Dec 3, 2024
5 checks passed
@travis travis deleted the feat/referral-program branch December 3, 2024 21:38
travis pushed a commit that referenced this pull request Dec 10, 2024
🤖 I have created a release *beep* *boop*
---


##
[1.16.0](w3console-v1.15.2...w3console-v1.16.0)
(2024-12-09)


### Features

* add a PNG version of our logo
([#153](#153))
([2812b27](2812b27))
* point staging env referral link at staging marketing site
([3937048](3937048))
* prototype of referral system in console
([#142](#142))
([6f760fe](6f760fe))
* referrals tweaks
([#155](#155))
([7e58678](7e58678))
* update TOS links to point to the Storacha docs
([#148](#148))
([68d09b5](68d09b5))


### Bug Fixes

* use the correct referral URL
([#149](#149))
([bc29a2b](bc29a2b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants