[PB-5984]: integrate Cello referral program with refer-and-earn UI#1887
[PB-5984]: integrate Cello referral program with refer-and-earn UI#1887
Conversation
Deploying drive-web with
|
| Latest commit: |
029b418
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6785f24a.drive-web.pages.dev |
| Branch Preview URL: | https://feature-cello-referral.drive-web.pages.dev |
Need to merge this one internxt/sdk#374 to solve it |
Tests will be added in another PR |
src/services/referral.service.ts
Outdated
|
|
||
| declare global { | ||
| interface Window { | ||
| cello?: { |
There was a problem hiding this comment.
shouldn't this be defined here? https://github.com/internxt/drive-web/blob/master/src/react-app-env.d.ts 🤔
Add referral service powered by Cello SDK for refer-a-friend functionality. Include referral panel triggers in the navbar and account popover, capture UCC tracking codes during checkout, and pass referral metadata when creating customers. Add i18n translations for all 8 supported languages.
Consolidate Window augmentations (cello, Cello, CelloAttribution) and ReferralBootOptions into the shared type declaration file instead of using declare global in the referral service.
36c9850 to
bf60349
Compare
src/app/i18n/locales/en.json
Outdated
| "desktop": "Desktop" | ||
| "desktop": "Desktop", | ||
| "referralBanner": { | ||
| "message": "Remember! Earn up to €1,000 by refering a friend", |
There was a problem hiding this comment.
typo: refering -> referring
| "trash": "Papierkorb", | ||
| "desktop": "Desktop" | ||
| "desktop": "Desktop", | ||
| "referralBanner": { |
There was a problem hiding this comment.
Do these texts go in the side menu section?
| impactApiUrl: 'REACT_APP_IMPACT_API', | ||
| dontRedirect: 'REACT_APP_DONT_REDIRECT', | ||
| celloProductId: 'REACT_APP_CELLO_PRODUCT_ID', | ||
| celloAssetsUrl: 'REACT_APP_CELLO_ASSETS_URL', |
There was a problem hiding this comment.
have someone added this env vars to Cloudflare?
| token: string, | ||
| productId: string, | ||
| language?: string, | ||
| ): ReferralBootOptions => ({ |
There was a problem hiding this comment.
where is this type ReferralBootOptions?
There was a problem hiding this comment.
in src/react-app-env.d.ts
src/services/referral.service.ts
Outdated
| return uccFromUrl; | ||
| } | ||
|
|
||
| return localStorageService.get(UCC_STORAGE_KEY) ?? null; |
There was a problem hiding this comment.
Whiy if it’s supposed to capture it from the URL, and as a fallback returns the one from storage if it’s not in the URL, isn’t that a bit odd? I might remove it
|
|
||
| const customerToken = await generateCaptchaToken(); | ||
| const ucc = referralService.getStoredUcc(); | ||
| const currentUser = store.getState().user.user; |
There was a problem hiding this comment.
store.getState() is generally an anti-pattern in component code since it bypasses React's reactivity because if user changes, this won't re-render. Can use useAppSelector((state) => state.user.user) at the component level
…ale Redux state The user object from Redux was undefined during checkout because the user is created before the subscription. Now onAuthenticateUser returns the freshly created user, ensuring the uuid is available for metadata. Also simplifies UCC capture logic and fixes referral banner typo.
| export const useAuthCheckout = ({ changeAuthMethod }: Pick<AuthCheckoutProps, 'changeAuthMethod'>) => { | ||
| const [authError, setAuthError] = useState<string | null>(); | ||
|
|
||
| const onAuthenticateUser = async ({ |
There was a problem hiding this comment.
If there isn't one, please add a test to validate this new behaviour
|


Description
Add referral service powered by Cello SDK for refer-a-friend functionality. Include referral panel triggers in the navbar and account popover, capture UCC tracking codes during checkout, and pass referral metadata when creating customers. Add i18n translations for all 8 supported languages.
Related Issues
Related Pull Requests
Checklist
Testing Process
Additional Notes