Skip to content

Commit

Permalink
feat: add/remove phone number
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Burtey committed Jul 20, 2023
1 parent c93f4b8 commit 43a64bc
Show file tree
Hide file tree
Showing 19 changed files with 1,254 additions and 116 deletions.
8 changes: 4 additions & 4 deletions .storybook/storybook.requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ const getStories = () => {
"./app/components/atomic/galoy-secondary-button/galoy-secondary-button.stories.tsx": require("../app/components/atomic/galoy-secondary-button/galoy-secondary-button.stories.tsx"),
"./app/components/atomic/galoy-tertiary-button/galoy-tertiary-button.stories.tsx": require("../app/components/atomic/galoy-tertiary-button/galoy-tertiary-button.stories.tsx"),
"./app/components/balance-header/balance-header.stories.tsx": require("../app/components/balance-header/balance-header.stories.tsx"),
"./app/components/button-group/button-group.stories.tsx": require("../app/components/button-group/button-group.stories.tsx"),
"./app/components/currency-keyboard/currency-keyboard.stories.tsx": require("../app/components/currency-keyboard/currency-keyboard.stories.tsx"),
"./app/components/custom-modal/custom-modal.stories.tsx": require("../app/components/custom-modal/custom-modal.stories.tsx"),
"./app/components/menu-select/menu-select.stories.tsx": require("../app/components/menu-select/menu-select.stories.tsx"),
"./app/components/button-group/button-group.stories.tsx": require("../app/components/button-group/button-group.stories.tsx"),
"./app/components/modal-nfc/modal-nfc.stories.tsx": require("../app/components/modal-nfc/modal-nfc.stories.tsx"),
"./app/components/set-default-account-modal/set-default-account-modal.stories.tsx": require("../app/components/set-default-account-modal/set-default-account-modal.stories.tsx"),
"./app/components/set-lightning-address-modal/set-lightning-address-modal.stories.tsx": require("../app/components/set-lightning-address-modal/set-lightning-address-modal.stories.tsx"),
Expand Down Expand Up @@ -78,10 +78,10 @@ const getStories = () => {
"./app/screens/get-started-screen/device-account-fail-modal.stories.tsx": require("../app/screens/get-started-screen/device-account-fail-modal.stories.tsx"),
"./app/screens/get-started-screen/get-started-screen.stories.tsx": require("../app/screens/get-started-screen/get-started-screen.stories.tsx"),
"./app/screens/home-screen/home-screen.stories.tsx": require("../app/screens/home-screen/home-screen.stories.tsx"),
"./app/screens/phone-auth-screen/phone-flow.stories.tsx": require("../app/screens/phone-auth-screen/phone-flow.stories.tsx"),
"./app/screens/phone-auth-screen/phone-validation.stories.tsx": require("../app/screens/phone-auth-screen/phone-validation.stories.tsx"),
"./app/screens/receive-bitcoin-screen/receive-screen.stories.tsx": require("../app/screens/receive-bitcoin-screen/receive-screen.stories.tsx"),
"./app/screens/phone-auth-screen/phone-login-flow.stories.tsx": require("../app/screens/phone-auth-screen/phone-login-flow.stories.tsx"),
"./app/screens/phone-auth-screen/phone-login-validation.stories.tsx": require("../app/screens/phone-auth-screen/phone-login-validation.stories.tsx"),
"./app/screens/receive-bitcoin-screen/qr-view.stories.tsx": require("../app/screens/receive-bitcoin-screen/qr-view.stories.tsx"),
"./app/screens/receive-bitcoin-screen/receive-screen.stories.tsx": require("../app/screens/receive-bitcoin-screen/receive-screen.stories.tsx"),
"./app/screens/redeem-lnurl-withdrawal-screen/redeem-bitcoin-detail-screen.stories.tsx": require("../app/screens/redeem-lnurl-withdrawal-screen/redeem-bitcoin-detail-screen.stories.tsx"),
"./app/screens/redeem-lnurl-withdrawal-screen/redeem-bitcoin-result-screen.stories.tsx": require("../app/screens/redeem-lnurl-withdrawal-screen/redeem-bitcoin-result-screen.stories.tsx"),
"./app/screens/send-bitcoin-screen/confirm-destination-modal.stories.tsx": require("../app/screens/send-bitcoin-screen/confirm-destination-modal.stories.tsx"),
Expand Down
34 changes: 34 additions & 0 deletions app/graphql/generated.gql
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ mutation userEmailDelete {
}
me {
id
phone
email {
address
verified
Expand Down Expand Up @@ -488,6 +489,39 @@ mutation userPhoneDelete {
}
me {
id
phone
email {
address
verified
__typename
}
__typename
}
__typename
}
}

mutation userPhoneRegistrationInitiate($input: UserPhoneRegistrationInitiateInput!) {
userPhoneRegistrationInitiate(input: $input) {
errors {
message
__typename
}
success
__typename
}
}

mutation userPhoneRegistrationValidate($input: UserPhoneRegistrationValidateInput!) {
userPhoneRegistrationValidate(input: $input) {
errors {
message
code
__typename
}
me {
id
phone
email {
address
verified
Expand Down
100 changes: 98 additions & 2 deletions app/graphql/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,13 @@ export type UserLoginUpgradeMutationVariables = Exact<{

export type UserLoginUpgradeMutation = { readonly __typename: 'Mutation', readonly userLoginUpgrade: { readonly __typename: 'UpgradePayload', readonly success: boolean, readonly authToken?: string | null, readonly errors: ReadonlyArray<{ readonly __typename: 'GraphQLApplicationError', readonly message: string, readonly code?: string | null }> } };

export type UserPhoneRegistrationValidateMutationVariables = Exact<{
input: UserPhoneRegistrationValidateInput;
}>;


export type UserPhoneRegistrationValidateMutation = { readonly __typename: 'Mutation', readonly userPhoneRegistrationValidate: { readonly __typename: 'UserPhoneRegistrationValidatePayload', readonly errors: ReadonlyArray<{ readonly __typename: 'GraphQLApplicationError', readonly message: string, readonly code?: string | null }>, readonly me?: { readonly __typename: 'User', readonly id: string, readonly phone?: string | null, readonly email?: { readonly __typename: 'Email', readonly address?: string | null, readonly verified?: boolean | null } | null } | null } };

export type CaptchaRequestAuthCodeMutationVariables = Exact<{
input: CaptchaRequestAuthCodeInput;
}>;
Expand All @@ -1907,6 +1914,13 @@ export type SupportedCountriesQueryVariables = Exact<{ [key: string]: never; }>;

export type SupportedCountriesQuery = { readonly __typename: 'Query', readonly globals?: { readonly __typename: 'Globals', readonly supportedCountries: ReadonlyArray<{ readonly __typename: 'Country', readonly id: string, readonly supportedAuthChannels: ReadonlyArray<PhoneCodeChannelType> }> } | null };

export type UserPhoneRegistrationInitiateMutationVariables = Exact<{
input: UserPhoneRegistrationInitiateInput;
}>;


export type UserPhoneRegistrationInitiateMutation = { readonly __typename: 'Mutation', readonly userPhoneRegistrationInitiate: { readonly __typename: 'SuccessPayload', readonly success?: boolean | null, readonly errors: ReadonlyArray<{ readonly __typename: 'GraphQLApplicationError', readonly message: string }> } };

export type MyLnUpdatesSubscriptionVariables = Exact<{ [key: string]: never; }>;


Expand Down Expand Up @@ -2123,12 +2137,12 @@ export type AccountDeleteMutation = { readonly __typename: 'Mutation', readonly
export type UserEmailDeleteMutationVariables = Exact<{ [key: string]: never; }>;


export type UserEmailDeleteMutation = { readonly __typename: 'Mutation', readonly userEmailDelete: { readonly __typename: 'UserEmailDeletePayload', readonly errors: ReadonlyArray<{ readonly __typename: 'GraphQLApplicationError', readonly message: string }>, readonly me?: { readonly __typename: 'User', readonly id: string, readonly email?: { readonly __typename: 'Email', readonly address?: string | null, readonly verified?: boolean | null } | null } | null } };
export type UserEmailDeleteMutation = { readonly __typename: 'Mutation', readonly userEmailDelete: { readonly __typename: 'UserEmailDeletePayload', readonly errors: ReadonlyArray<{ readonly __typename: 'GraphQLApplicationError', readonly message: string }>, readonly me?: { readonly __typename: 'User', readonly id: string, readonly phone?: string | null, readonly email?: { readonly __typename: 'Email', readonly address?: string | null, readonly verified?: boolean | null } | null } | null } };

export type UserPhoneDeleteMutationVariables = Exact<{ [key: string]: never; }>;


export type UserPhoneDeleteMutation = { readonly __typename: 'Mutation', readonly userPhoneDelete: { readonly __typename: 'UserPhoneDeletePayload', readonly errors: ReadonlyArray<{ readonly __typename: 'GraphQLApplicationError', readonly message: string }>, readonly me?: { readonly __typename: 'User', readonly id: string, readonly email?: { readonly __typename: 'Email', readonly address?: string | null, readonly verified?: boolean | null } | null } | null } };
export type UserPhoneDeleteMutation = { readonly __typename: 'Mutation', readonly userPhoneDelete: { readonly __typename: 'UserPhoneDeletePayload', readonly errors: ReadonlyArray<{ readonly __typename: 'GraphQLApplicationError', readonly message: string }>, readonly me?: { readonly __typename: 'User', readonly id: string, readonly phone?: string | null, readonly email?: { readonly __typename: 'Email', readonly address?: string | null, readonly verified?: boolean | null } | null } | null } };

export type AccountUpdateDefaultWalletIdMutationVariables = Exact<{
input: AccountUpdateDefaultWalletIdInput;
Expand Down Expand Up @@ -3626,6 +3640,50 @@ export function useUserLoginUpgradeMutation(baseOptions?: Apollo.MutationHookOpt
export type UserLoginUpgradeMutationHookResult = ReturnType<typeof useUserLoginUpgradeMutation>;
export type UserLoginUpgradeMutationResult = Apollo.MutationResult<UserLoginUpgradeMutation>;
export type UserLoginUpgradeMutationOptions = Apollo.BaseMutationOptions<UserLoginUpgradeMutation, UserLoginUpgradeMutationVariables>;
export const UserPhoneRegistrationValidateDocument = gql`
mutation userPhoneRegistrationValidate($input: UserPhoneRegistrationValidateInput!) {
userPhoneRegistrationValidate(input: $input) {
errors {
message
code
}
me {
id
phone
email {
address
verified
}
}
}
}
`;
export type UserPhoneRegistrationValidateMutationFn = Apollo.MutationFunction<UserPhoneRegistrationValidateMutation, UserPhoneRegistrationValidateMutationVariables>;

/**
* __useUserPhoneRegistrationValidateMutation__
*
* To run a mutation, you first call `useUserPhoneRegistrationValidateMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useUserPhoneRegistrationValidateMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [userPhoneRegistrationValidateMutation, { data, loading, error }] = useUserPhoneRegistrationValidateMutation({
* variables: {
* input: // value for 'input'
* },
* });
*/
export function useUserPhoneRegistrationValidateMutation(baseOptions?: Apollo.MutationHookOptions<UserPhoneRegistrationValidateMutation, UserPhoneRegistrationValidateMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<UserPhoneRegistrationValidateMutation, UserPhoneRegistrationValidateMutationVariables>(UserPhoneRegistrationValidateDocument, options);
}
export type UserPhoneRegistrationValidateMutationHookResult = ReturnType<typeof useUserPhoneRegistrationValidateMutation>;
export type UserPhoneRegistrationValidateMutationResult = Apollo.MutationResult<UserPhoneRegistrationValidateMutation>;
export type UserPhoneRegistrationValidateMutationOptions = Apollo.BaseMutationOptions<UserPhoneRegistrationValidateMutation, UserPhoneRegistrationValidateMutationVariables>;
export const CaptchaRequestAuthCodeDocument = gql`
mutation captchaRequestAuthCode($input: CaptchaRequestAuthCodeInput!) {
captchaRequestAuthCode(input: $input) {
Expand Down Expand Up @@ -3700,6 +3758,42 @@ export function useSupportedCountriesLazyQuery(baseOptions?: Apollo.LazyQueryHoo
export type SupportedCountriesQueryHookResult = ReturnType<typeof useSupportedCountriesQuery>;
export type SupportedCountriesLazyQueryHookResult = ReturnType<typeof useSupportedCountriesLazyQuery>;
export type SupportedCountriesQueryResult = Apollo.QueryResult<SupportedCountriesQuery, SupportedCountriesQueryVariables>;
export const UserPhoneRegistrationInitiateDocument = gql`
mutation userPhoneRegistrationInitiate($input: UserPhoneRegistrationInitiateInput!) {
userPhoneRegistrationInitiate(input: $input) {
errors {
message
}
success
}
}
`;
export type UserPhoneRegistrationInitiateMutationFn = Apollo.MutationFunction<UserPhoneRegistrationInitiateMutation, UserPhoneRegistrationInitiateMutationVariables>;

/**
* __useUserPhoneRegistrationInitiateMutation__
*
* To run a mutation, you first call `useUserPhoneRegistrationInitiateMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useUserPhoneRegistrationInitiateMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [userPhoneRegistrationInitiateMutation, { data, loading, error }] = useUserPhoneRegistrationInitiateMutation({
* variables: {
* input: // value for 'input'
* },
* });
*/
export function useUserPhoneRegistrationInitiateMutation(baseOptions?: Apollo.MutationHookOptions<UserPhoneRegistrationInitiateMutation, UserPhoneRegistrationInitiateMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<UserPhoneRegistrationInitiateMutation, UserPhoneRegistrationInitiateMutationVariables>(UserPhoneRegistrationInitiateDocument, options);
}
export type UserPhoneRegistrationInitiateMutationHookResult = ReturnType<typeof useUserPhoneRegistrationInitiateMutation>;
export type UserPhoneRegistrationInitiateMutationResult = Apollo.MutationResult<UserPhoneRegistrationInitiateMutation>;
export type UserPhoneRegistrationInitiateMutationOptions = Apollo.BaseMutationOptions<UserPhoneRegistrationInitiateMutation, UserPhoneRegistrationInitiateMutationVariables>;
export const MyLnUpdatesDocument = gql`
subscription myLnUpdates {
myUpdates {
Expand Down Expand Up @@ -4982,6 +5076,7 @@ export const UserEmailDeleteDocument = gql`
}
me {
id
phone
email {
address
verified
Expand Down Expand Up @@ -5023,6 +5118,7 @@ export const UserPhoneDeleteDocument = gql`
}
me {
id
phone
email {
address
verified
Expand Down
15 changes: 15 additions & 0 deletions app/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,21 @@ const en: BaseTranslation = {
sendViaOtherChannel:
"You selected to receive the code via {channel: string}. You can try receiving via {other: string} instead",
},
PhoneRegistrationInitiateScreen: {
title: "Phone set up",
header: "Enter your phone number, and we'll text you an access code.",
headerVerify: "Verify you are human",
errorRequestingCode: "Something went wrong requesting the phone code, please try again later.",
errorInvalidPhoneNumber: "Invalid phone number. Are you sure you entered the right number?",
errorUnsupportedCountry: "We are unable to support customers in your country.",
placeholder: "Phone Number",
verify: "Click to Verify",
sms: "Send via SMS",
whatsapp: "Send via WhatsApp",
},
PhoneRegistrationValidateScreen: {
successTitle: "Phone number confirmed",
},
EmailRegistrationInitiateScreen: {
title: "Add your email",
header: "Enter your email address, and we'll send you an access code.",
Expand Down
96 changes: 96 additions & 0 deletions app/i18n/i18n-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2738,6 +2738,54 @@ type RootTranslation = {
*/
sendViaOtherChannel: RequiredParams<'channel' | 'other'>
}
PhoneRegistrationInitiateScreen: {
/**
* P​h​o​n​e​ ​s​e​t​ ​u​p
*/
title: string
/**
* E​n​t​e​r​ ​y​o​u​r​ ​p​h​o​n​e​ ​n​u​m​b​e​r​,​ ​a​n​d​ ​w​e​'​l​l​ ​t​e​x​t​ ​y​o​u​ ​a​n​ ​a​c​c​e​s​s​ ​c​o​d​e​.
*/
header: string
/**
* V​e​r​i​f​y​ ​y​o​u​ ​a​r​e​ ​h​u​m​a​n
*/
headerVerify: string
/**
* S​o​m​e​t​h​i​n​g​ ​w​e​n​t​ ​w​r​o​n​g​ ​r​e​q​u​e​s​t​i​n​g​ ​t​h​e​ ​p​h​o​n​e​ ​c​o​d​e​,​ ​p​l​e​a​s​e​ ​t​r​y​ ​a​g​a​i​n​ ​l​a​t​e​r​.
*/
errorRequestingCode: string
/**
* I​n​v​a​l​i​d​ ​p​h​o​n​e​ ​n​u​m​b​e​r​.​ ​A​r​e​ ​y​o​u​ ​s​u​r​e​ ​y​o​u​ ​e​n​t​e​r​e​d​ ​t​h​e​ ​r​i​g​h​t​ ​n​u​m​b​e​r​?
*/
errorInvalidPhoneNumber: string
/**
* W​e​ ​a​r​e​ ​u​n​a​b​l​e​ ​t​o​ ​s​u​p​p​o​r​t​ ​c​u​s​t​o​m​e​r​s​ ​i​n​ ​y​o​u​r​ ​c​o​u​n​t​r​y​.
*/
errorUnsupportedCountry: string
/**
* P​h​o​n​e​ ​N​u​m​b​e​r
*/
placeholder: string
/**
* C​l​i​c​k​ ​t​o​ ​V​e​r​i​f​y
*/
verify: string
/**
* S​e​n​d​ ​v​i​a​ ​S​M​S
*/
sms: string
/**
* S​e​n​d​ ​v​i​a​ ​W​h​a​t​s​A​p​p
*/
whatsapp: string
}
PhoneRegistrationValidateScreen: {
/**
* P​h​o​n​e​ ​n​u​m​b​e​r​ ​c​o​n​f​i​r​m​e​d
*/
successTitle: string
}
EmailRegistrationInitiateScreen: {
/**
* A​d​d​ ​y​o​u​r​ ​e​m​a​i​l
Expand Down Expand Up @@ -6061,6 +6109,54 @@ export type TranslationFunctions = {
*/
sendViaOtherChannel: (arg: { channel: string, other: string }) => LocalizedString
}
PhoneRegistrationInitiateScreen: {
/**
* Phone set up
*/
title: () => LocalizedString
/**
* Enter your phone number, and we'll text you an access code.
*/
header: () => LocalizedString
/**
* Verify you are human
*/
headerVerify: () => LocalizedString
/**
* Something went wrong requesting the phone code, please try again later.
*/
errorRequestingCode: () => LocalizedString
/**
* Invalid phone number. Are you sure you entered the right number?
*/
errorInvalidPhoneNumber: () => LocalizedString
/**
* We are unable to support customers in your country.
*/
errorUnsupportedCountry: () => LocalizedString
/**
* Phone Number
*/
placeholder: () => LocalizedString
/**
* Click to Verify
*/
verify: () => LocalizedString
/**
* Send via SMS
*/
sms: () => LocalizedString
/**
* Send via WhatsApp
*/
whatsapp: () => LocalizedString
}
PhoneRegistrationValidateScreen: {
/**
* Phone number confirmed
*/
successTitle: () => LocalizedString
}
EmailRegistrationInitiateScreen: {
/**
* Add your email
Expand Down
Loading

0 comments on commit 43a64bc

Please sign in to comment.