Skip to content

Commit

Permalink
Included referrerId for orion account creation (#4926)
Browse files Browse the repository at this point in the history
* added referrerChannelId for Orion account

* lint

---------

Co-authored-by: Artem <Artem Slugin>
  • Loading branch information
attemka authored Oct 3, 2023
1 parent b9fc1b4 commit 4a00a24
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const SIGNUP_FORM_DATA_INITIAL_STATE: AccountFormData & MemberFormData = {
confirmedTerms: false,
confirmedCopy: false,
memberId: '',
referrerChannelId: undefined,
}

const stepToPageName: Partial<Record<SignUpSteps, string>> = {
Expand All @@ -64,6 +65,7 @@ export const SignUpModal = () => {
const ytResponseData = useYppStore((state) => state.ytResponseData)
const setYppModalOpenName = useYppStore((state) => state.actions.setYppModalOpenName)
const setYtResponseData = useYppStore((state) => state.actions.setYtResponseData)
const referrerChannelId = useYppStore((state) => state.referrerId)
const { anonymousUserId } = useAuthStore()
const { displaySnackbar } = useSnackbar()

Expand Down Expand Up @@ -117,7 +119,11 @@ export const SignUpModal = () => {
}

return createNewOrionAccount({
data: { ...signUpFormData.current, memberId: memberRef.current },
data: {
...signUpFormData.current,
memberId: memberRef.current,
...(referrerChannelId ? { referrerChannelId } : {}),
},
onError: (error) => {
if (error === RegisterError.EmailAlreadyExists) {
setEmailAlreadyTakenError(true)
Expand Down Expand Up @@ -170,6 +176,7 @@ export const SignUpModal = () => {
displaySnackbar,
goToNextStep,
goToStep,
referrerChannelId,
setAuthModalOpenName,
setYppModalOpenName,
setYtResponseData,
Expand Down
3 changes: 3 additions & 0 deletions packages/atlas/src/hooks/useCreateMember.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type MemberFormData = {
authorizationCode?: string
userId?: string
confirmedCopy: boolean
referrerChannelId?: string
}

export type AccountFormData = {
Expand All @@ -37,6 +38,7 @@ export type AccountFormData = {
mnemonic: string
confirmedTerms: boolean
memberId: string
referrerChannelId?: string
}

type NewMemberResponse = {
Expand Down Expand Up @@ -122,6 +124,7 @@ export const useCreateMember = () => {
? {
userId: data.userId,
authorizationCode: data.authorizationCode,
...(data.referrerChannelId ? { referrerChannelId: data.referrerChannelId } : {}),
}
: {}),
}
Expand Down

0 comments on commit 4a00a24

Please sign in to comment.