-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #888 from 0xsend/dev
deploy
- Loading branch information
Showing
41 changed files
with
2,087 additions
and
2,999 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import Head from 'next/head' | ||
import { userProtectedGetSSP } from 'utils/userProtected' | ||
import type { NextPageWithLayout } from '../_app' | ||
import { AffiliateScreen } from 'app/features/affiliate/screen' | ||
import { HomeLayout } from 'app/features/home/layout.web' | ||
import { TopNav } from 'app/components/TopNav' | ||
|
||
export const Page: NextPageWithLayout = () => { | ||
return ( | ||
<> | ||
<Head> | ||
<title>Send | Affiliates</title> | ||
<meta | ||
name="description" | ||
content="View your network and track referral activity." | ||
key="desc" | ||
/> | ||
</Head> | ||
<AffiliateScreen /> | ||
</> | ||
) | ||
} | ||
|
||
const subheader = 'View your network and track referral activity.' | ||
|
||
export const getServerSideProps = userProtectedGetSSP() | ||
|
||
Page.getLayout = (children) => ( | ||
<HomeLayout TopNav={<TopNav header="Affiliate" subheader={subheader} />}>{children}</HomeLayout> | ||
) | ||
|
||
export default Page |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { TRPCError } from '@trpc/server' | ||
import { supabaseAdmin } from 'app/utils/supabase/admin' | ||
import debug from 'debug' | ||
import { z } from 'zod' | ||
import { createTRPCRouter, publicProcedure } from '../../trpc' | ||
import { AuthStatus } from './types' | ||
|
||
const log = debug('api:auth') | ||
|
||
export const authRouter = createTRPCRouter({ | ||
signInWithOtp: publicProcedure | ||
.input( | ||
z.object({ | ||
phone: z.string().trim(), | ||
countrycode: z.string(), | ||
captchaToken: z.string().optional(), | ||
bypassOnboardedCheck: z.boolean().optional().default(false), | ||
}) | ||
) | ||
.mutation(async ({ input }) => { | ||
const { phone, countrycode, captchaToken, bypassOnboardedCheck } = input | ||
|
||
if (!phone) { | ||
throw new TRPCError({ | ||
code: 'BAD_REQUEST', | ||
message: 'Phone number is required', | ||
}) | ||
} | ||
|
||
if (!countrycode) { | ||
throw new TRPCError({ | ||
code: 'BAD_REQUEST', | ||
message: 'Country Code is required', | ||
}) | ||
} | ||
|
||
if (!!process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY && !captchaToken) { | ||
throw new TRPCError({ | ||
code: 'BAD_REQUEST', | ||
message: 'Captcha token is required', | ||
}) | ||
} | ||
|
||
if (!bypassOnboardedCheck) { | ||
log('checking if phone is already used', { phone }) | ||
|
||
const { data } = await supabaseAdmin | ||
.rpc('profile_lookup', { lookup_type: 'phone', identifier: `${countrycode}${phone}` }) | ||
.maybeSingle() | ||
|
||
if (data) { | ||
log('phone is already used', { phone }) | ||
|
||
return { | ||
status: AuthStatus.PhoneAlreadyUsed, | ||
} | ||
} | ||
} | ||
|
||
const { error } = await supabaseAdmin.auth | ||
.signInWithOtp({ phone: `${countrycode}${phone}`, options: { captchaToken } }) | ||
.then(async (r) => { | ||
// TODO: potentially add a fake numbers list for app store reviewers | ||
if (__DEV__ || process.env.CI) { | ||
log('fake_otp_credentials', { phone: `${countrycode}${phone}` }) | ||
return await supabaseAdmin.rpc('fake_otp_credentials', { | ||
phone: `${countrycode}${phone}`, | ||
}) | ||
} | ||
const errMessage = r.error?.message.toLowerCase() | ||
log('signInWithOtp', { errMessage, phone }) | ||
return r | ||
}) | ||
|
||
if (error) { | ||
throw new TRPCError({ | ||
code: 'INTERNAL_SERVER_ERROR', | ||
message: error.message, | ||
}) | ||
} | ||
|
||
log('successfully signed up with otp', { phone }) | ||
|
||
return { | ||
status: AuthStatus.SignedIn, | ||
} | ||
}), | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum AuthStatus { | ||
SignedIn = 'SignedIn', | ||
PhoneAlreadyUsed = 'PhoneAlreadyUsed', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { ColorTokens } from '@my/ui/types' | ||
import { type IconProps, themed } from '@tamagui/helpers-icon' | ||
import { memo } from 'react' | ||
import { Mask, Path, Svg, Rect, G } from 'react-native-svg' | ||
|
||
const Rocket = (props) => { | ||
const { size, color, ...rest } = props | ||
return ( | ||
<Svg | ||
width={size ?? 48} | ||
height={size ?? 48} | ||
color={color as ColorTokens | undefined} | ||
viewBox="0 0 48 48" | ||
fill="none" | ||
{...rest} | ||
> | ||
<Mask id="mask0_1_1346" maskUnits="userSpaceOnUse" x="0" y="0" width="48" height="48"> | ||
<Rect width="48" height="48" fill="#D9D9D9" /> | ||
</Mask> | ||
<G mask="url(#mask0_1_1346)"> | ||
<Path | ||
d="M9.35 20.4499L14.65 22.6999C15.25 21.4999 15.8917 20.3166 16.575 19.1499C17.2583 17.9832 17.9833 16.8666 18.75 15.7999L14.8 14.9999L9.35 20.4499ZM17.05 24.4999L23.7 31.1499C25.6 30.2832 27.3833 29.2999 29.05 28.1999C30.7167 27.0999 32.0667 26.0332 33.1 24.9999C35.8 22.2999 37.7833 19.5332 39.05 16.6999C40.3167 13.8666 41 10.6666 41.1 7.0999C37.5333 7.1999 34.3333 7.88323 31.5 9.1499C28.6667 10.4166 25.9 12.3999 23.2 15.0999C22.1667 16.1332 21.1 17.4832 20 19.1499C18.9 20.8166 17.9167 22.5999 17.05 24.4999ZM28.5 19.6999C27.8333 19.0332 27.5 18.2082 27.5 17.2249C27.5 16.2416 27.8333 15.4166 28.5 14.7499C29.1667 14.0832 29.9917 13.7499 30.975 13.7499C31.9583 13.7499 32.7833 14.0832 33.45 14.7499C34.1167 15.4166 34.45 16.2416 34.45 17.2249C34.45 18.2082 34.1167 19.0332 33.45 19.6999C32.7833 20.3666 31.9583 20.6999 30.975 20.6999C29.9917 20.6999 29.1667 20.3666 28.5 19.6999ZM27.75 38.8499L33.2 33.3999L32.4 29.4499C31.3333 30.2166 30.2167 30.9416 29.05 31.6249C27.8833 32.3082 26.7 32.9499 25.5 33.5499L27.75 38.8499ZM44.05 4.1499C44.35 8.68323 43.7833 12.8166 42.35 16.5499C40.9167 20.2832 38.55 23.7999 35.25 27.0999L35.05 27.2999L36.15 32.7999C36.25 33.2999 36.225 33.7832 36.075 34.2499C35.925 34.7166 35.6667 35.1332 35.3 35.4999L26.75 44.0999L22.5 34.1999L14 25.6999L4.1 21.4499L12.7 12.8999C13.0667 12.5332 13.4833 12.2749 13.95 12.1249C14.4167 11.9749 14.9 11.9499 15.4 12.0499L20.9 13.1499C20.9333 13.1166 20.9667 13.0916 21 13.0749C21.0333 13.0582 21.0667 13.0332 21.1 12.9999C24.4 9.6999 27.9167 7.3249 31.65 5.8749C35.3833 4.4249 39.5167 3.8499 44.05 4.1499ZM7.45 31.7499C8.61667 30.5832 10.0417 29.9916 11.725 29.9749C13.4083 29.9582 14.8333 30.5332 16 31.6999C17.1667 32.8666 17.7417 34.2916 17.725 35.9749C17.7083 37.6582 17.1167 39.0832 15.95 40.2499C15.0833 41.1166 13.7417 41.8332 11.925 42.3999C10.1083 42.9666 7.38333 43.4999 3.75 43.9999C4.25 40.3666 4.775 37.6332 5.325 35.7999C5.875 33.9666 6.58333 32.6166 7.45 31.7499ZM9.55 33.8999C9.08333 34.3999 8.66667 35.1832 8.3 36.2499C7.93333 37.3166 7.61667 38.6832 7.35 40.3499C9.01667 40.0832 10.3833 39.7666 11.45 39.3999C12.5167 39.0332 13.3 38.6166 13.8 38.1499C14.4333 37.5832 14.7583 36.8749 14.775 36.0249C14.7917 35.1749 14.5 34.4332 13.9 33.7999C13.2667 33.1999 12.525 32.9082 11.675 32.9249C10.825 32.9416 10.1167 33.2666 9.55 33.8999Z" | ||
fill={'currentColor'} | ||
/> | ||
</G> | ||
</Svg> | ||
) | ||
} | ||
|
||
const IconRocket = memo<IconProps>(themed(Rocket)) | ||
export { IconRocket } |
Oops, something went wrong.