Skip to content

Commit

Permalink
feat(sso) add all translations
Browse files Browse the repository at this point in the history
  • Loading branch information
ansmonjol committed Apr 2, 2024
1 parent 196b79c commit 71eb2c1
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 30 deletions.
24 changes: 16 additions & 8 deletions ditto/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
"text_620bc4d4269a55014d493f12": "Welcome to Lago",
"text_620bc4d4269a55014d493fc9": "Nice to see you here, let’s start by creating your account.",
"text_62a99ba2af7535cefacab49c": "Organization name",
"text_62a99ba2af7535cefacab4ba": "Banco",
"text_620bc4d4269a55014d493f53": "Set your password",
"text_620bc4d4269a55014d493fb5": "Sign up",
"text_620bc4d4269a55014d493fd4": "By signing up, you agree to our <a rel=\"external\" target=\"_blank\" href=\"https://www.getlago.com/company/terms-of-service\">Terms of Service</a> and <a rel=\"external\" target=\"_blank\" href=\"https://www.getlago.com/company/privacy-policy\">Privacy Policy</a>.\nAlready have an account? <a href=\"{{link}}\">Log in</a>",
Expand Down Expand Up @@ -414,6 +413,7 @@
"text_628b8dc14c71840130f8d8a1": "Apply coupon",
"text_63a5ba11eb4e7e17ef88e9f0": "You're running this app in an <a rel=\"noopener noreferrer external\" target=\"_blank\" href=\"https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts\">unsecure context</a>. Clipboard access is disabled",
"TZ_AFRICA_ALGIERS": "Africa/Algiers",
"TZ_AFRICA_CAIRO": "Africa/Cairo",
"TZ_AFRICA_CASABLANCA": "Africa/Casablanca",
"TZ_AFRICA_HARARE": "Africa/Harare",
"TZ_AFRICA_JOHANNESBURG": "Africa/Johannesburg",
Expand Down Expand Up @@ -547,20 +547,19 @@
"TZ_PACIFIC_PORT_MORESBY": "Pacific/Port Moresby",
"TZ_PACIFIC_TONGATAPU": "Pacific/Tongatapu",
"TZ_UTC": "UTC",
"TZ_AFRICA_CAIRO": "Africa/Cairo",
"text_623b42ff8ee4e000ba87d0ae": "Add a billable metric",
"text_623b42ff8ee4e000ba87d0b0": "Add a billable metric",
"text_623b42ff8ee4e000ba87d0b4": "Base metric used to measure usage, and act as a foundation of pricing.",
"text_623b42ff8ee4e000ba87d0b2": "Test this snippet",
"text_623b42ff8ee4e000ba87d0c6": "Copy to clipboard",
"text_623b42ff8ee4e000ba87d0b8": "How should we name it? ",
"text_623b42ff8ee4e000ba87d0b8": "Billable metric settings",
"text_623b42ff8ee4e000ba87d0be": "Name",
"text_6241cc759211e600ea57f4c7": "Type a name",
"text_623b42ff8ee4e000ba87d0c0": "Code",
"text_623b42ff8ee4e000ba87d0c4": "Type a code",
"text_623b42ff8ee4e000ba87d0c8": "Description (optional)",
"text_623b42ff8ee4e000ba87d0ca": "Explain the goal of this billable metric …",
"text_623b42ff8ee4e000ba87d0cc": "How should we measure it? ",
"text_623b42ff8ee4e000ba87d0cc": "Billable metric aggregation",
"text_623b42ff8ee4e000ba87d0ce": "Aggregation type",
"text_623b42ff8ee4e000ba87d0d0": "Search or select an aggregation type",
"text_623b42ff8ee4e000ba87d0d4": "Add billable metric",
Expand Down Expand Up @@ -968,7 +967,7 @@
"text_646e2d0cc536351b62ba6f01": "More option",
"text_646e2d0cc536351b62ba6f0c": "Pay in arrears",
"text_646e2d0cc536351b62ba6f16": "Invoiceable",
"text_646e2d0cc536351b62ba6f20": "No spending mininum",
"text_646e2d0cc536351b62ba6f20": "No spending minimum",
"text_646e2d0cc536351b62ba6f1a": "Pay charge in",
"text_646e2d0cc536351b62ba6f2b": "Arrears",
"text_646e2d0cc536351b62ba6f3d": "Advance",
Expand Down Expand Up @@ -1611,6 +1610,15 @@
"text_63246f875e2228ab7b63dd02": "Your password is secure and you're all set!",
"text_63246f875e2228ab7b63dcf4": "Organization invitation invalid",
"text_63246f875e2228ab7b63dcfe": "It looks like the link you’re using is not valid. Please contact a member of the organization so they can invite you again.",
"text_660bf95c75dd928ced0ecb04": "Create your organization",
"text_660bf95c75dd928ced0ecb08": "This information won’t be editable in the future.",
"text_660bf95c75dd928ced0ecb25": "Sorry, Google Connect is not configured in your environment variables. Please <a rel=\"noopener noreferrer external\" target=\"_blank\" href=\"{{href}}\">read the documentation</a>.",
"text_660bf95c75dd928ced0ecb31": "Log In with Google",
"text_660bf95c75dd928ced0ecb21": "Continue with Google",
"text_660bf95c75dd928ced0ecb33": "Type your organization name",
"text_660bf95c75dd928ced0ecb2b": "Oops! Looks like your Google account email doesn't match the invitation. Give it another shot!",
"text_660bf95c75dd928ced0ecb37": "Sign up with Google",
"text_660bfaa2cbc95800a63f48b1": "Sorry, it seems there are no accounts associated with the provided credentials.",
"text_642707b0da1753a9bb6672b5": "Forget password",
"text_642707b0da1753a9bb66728e": "Password reset email sent!",
"text_642707b0da1753a9bb667298": "Check your email for a link to reset your password. If it doesn’t appear within a few minutes, check your spam folder.",
Expand Down Expand Up @@ -1873,7 +1881,7 @@
"text_636d023ce11a9d038819b579": "Something went wrong",
"text_636d023ce11a9d038819b57b": "Please refresh the page or contact us if the error persists.",
"text_636d023ce11a9d038819b57d": "Refresh the page",
"text_636d12ce54c41fccdf0ef72d": "Download pdf",
"text_636d12ce54c41fccdf0ef72d": "Download credit note",
"text_636d12ce54c41fccdf0ef72f": "Void credit available",
"text_636d12ce54c41fccdf0ef731": "Copy credit note lago_id",
"text_63720bd734e1344aea75b82d": "Credit note lago_id copied to clipboard",
Expand Down Expand Up @@ -1901,11 +1909,11 @@
"text_6374e868262bab8719eac121": "The amount should be greater than $ 0.00\nUncheck this line item to not credit this fee",
"text_63763e61409e0d55b268a590": "Credit note successfully issued",
"text_637655cb50f04bf1c8379ce8": "Actions",
"text_637655cb50f04bf1c8379cea": "Download pdf",
"text_637655cb50f04bf1c8379cea": "Download credit note",
"text_637655cb50f04bf1c8379cec": "Void credit available",
"text_637655cb50f04bf1c8379cee": "Copy credit note lago_id",
"text_637655cb50f04bf1c8379cf2": "for {{amount}}",
"text_637655cb50f04bf1c8379cf8": "Download pdf",
"text_637655cb50f04bf1c8379cf8": "Download credit note",
"text_637655cb50f04bf1c8379cfa": "Overview",
"text_637655cb50f04bf1c8379cfe": "Customer name",
"text_637655cb50f04bf1c8379d02": "Invoice number",
Expand Down
4 changes: 4 additions & 0 deletions ditto/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,11 @@ sources:
fileName: 👍 [Ready for dev] - Plans - Group by fees on invoices
- name: 👍 [Ready for dev] - Settings / Customers - Lago x Stripe ACH & BACS
id: 65e1f9032a71b571c754c489
fileName: 👍 [Ready for dev] - Settings / Customers - Lago x Stripe ACH & BACS
- name: 👍 [Ready for dev] - Plans - Invoice minimum spending
id: 65d601bee599243feb44af59
fileName: 👍 [Ready for dev] - Plans - Invoice minimum spending
- name: 👍 [Ready for dev] - Onboarding - Create/Connect Lago orga via SSO
id: 660bf95b851f012f6f11ecd0
format: flat
variants: true
3 changes: 3 additions & 0 deletions ditto/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ module.exports = {
"project_642707b04540bee48d54de86": {
"base": require('./-ready-for-dev---login---reset-password__base.json')
},
"project_660bf95b851f012f6f11ecd0": {
"base": require('./-ready-for-dev---onboarding---createconnect-lago-orga-via-sso__base.json')
},
"project_63208b60a9b2a4c6186bbd26": {
"base": require('./-ready-for-dev---onboarding---invite-member-to-organisation__base.json')
},
Expand Down
15 changes: 10 additions & 5 deletions src/components/auth/GoogleAuthButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useEffect, useState } from 'react'
import { useSearchParams } from 'react-router-dom'

import { hasDefinedGQLError } from '~/core/apolloClient'
import { DOCUMENTATION_ENV_VARS } from '~/core/constants/externalUrls'
import { addValuesToUrlState } from '~/core/utils/urlUtils'
import { LagoApiError, useGetGoogleAuthUrlLazyQuery } from '~/generated/graphql'
import { useInternationalization } from '~/hooks/core/useInternationalization'
Expand All @@ -15,13 +16,13 @@ export type GoogleAuthModeEnum = 'login' | 'signup' | 'invite'
const getErrorKey = (errorCode: string): string => {
switch (errorCode) {
case LagoApiError.InvalidGoogleToken:
return 'TODO: This is the error message for invalid google code'
case LagoApiError.InvalidGoogleCode:
return 'TODO: This is the error message for invalid google code'
case LagoApiError.GoogleAuthMissingSetup:
return 'TODO: This is the error message for missing google setup'
return 'text_660bf95c75dd928ced0ecb25'
case LagoApiError.UserDoesNotExists:
return 'text_660bfaa2cbc95800a63f48b1'
default:
return 'TODO: This is the default error message'
return 'text_62b31e1f6a5b8b1b745ece48'
}
}

Expand Down Expand Up @@ -64,7 +65,11 @@ const GoogleAuthButton = ({ invitationToken, label, mode }: BasicGoogleAuthButto

return (
<Stack spacing={8}>
{!!errorCode && <Alert type="danger">{translate(getErrorKey(errorCode))}</Alert>}
{!!errorCode && (
<Alert type="danger">
{translate(getErrorKey(errorCode), { href: DOCUMENTATION_ENV_VARS })}
</Alert>
)}

<Button
fullWidth
Expand Down
2 changes: 2 additions & 0 deletions src/core/constants/externalUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const DOCUMENTATION_SEGMENT = 'https://docs.getlago.com/integrations/usag
export const DOCUMENTATION_HIGHTTOUCH = 'https://docs.getlago.com/integrations/usage/hightouch'
export const DOCUMENTATION_OSO =
'https://www.osohq.com/docs/guides/model-your-apps-authz#entitlements'
export const DOCUMENTATION_ENV_VARS =
'https://docs.getlago.com/guide/self-hosted/docker#environment-variables'
export const FEATURE_REQUESTS_URL = 'https://getlago.canny.io/feature-requests'
export const ADYEN_SUCCESS_LINK_SPEC_URL =
'https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-returnUrl'
14 changes: 6 additions & 8 deletions src/pages/Invitation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import GoogleAuthButton from '~/components/auth/GoogleAuthButton'
import { Alert, Button, Skeleton, Typography } from '~/components/designSystem'
import { TextInput } from '~/components/form'
import { hasDefinedGQLError, onLogIn } from '~/core/apolloClient'
import { DOCUMENTATION_ENV_VARS } from '~/core/constants/externalUrls'
import { LOGIN_ROUTE } from '~/core/router'
import {
CurrentUserFragmentDoc,
Expand Down Expand Up @@ -179,16 +180,13 @@ const Invitation = () => {
hasDefinedGQLError('InvalidGoogleCode', googleAcceptInviteError) ||
hasDefinedGQLError('InvalidGoogleToken', googleAcceptInviteError)
) {
// TODO: note there is a link in the translation below
return translate(
'TODO: Sorry, Google Connect is not configured in your environment variables. Please read the documentation.',
)
return translate('text_660bf95c75dd928ced0ecb25', {
href: DOCUMENTATION_ENV_VARS,
})
}

if (hasDefinedGQLError('InviteEmailMistmatch', googleAcceptInviteError)) {
return translate(
"TODO: Oops! Looks like your Google account email doesn't match the invitation. Give it another shot!",
)
return translate('text_660bf95c75dd928ced0ecb2b')
}

return
Expand Down Expand Up @@ -239,7 +237,7 @@ const Invitation = () => {
<GoogleAuthButton
mode="invite"
invitationToken={token || ''}
label={translate('TODO: Sign up with Google')}
label={translate('text_660bf95c75dd928ced0ecb37')}
/>

<OrSeparator>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const Login = () => {
</Alert>
)}

<GoogleAuthButton mode="login" label={translate('TODO: Log in with Google')} />
<GoogleAuthButton mode="login" label={translate('text_660bf95c75dd928ced0ecb31')} />

<OrSeparator>
<Typography variant="captionHl" color="grey500">
Expand Down
14 changes: 6 additions & 8 deletions src/pages/auth/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import GoogleAuthButton from '~/components/auth/GoogleAuthButton'
import { Alert, Button, Typography } from '~/components/designSystem'
import { TextInput } from '~/components/form'
import { hasDefinedGQLError, onLogIn } from '~/core/apolloClient'
import { DOCUMENTATION_ENV_VARS } from '~/core/constants/externalUrls'
import { LOGIN_ROUTE } from '~/core/router'
import {
CurrentUserFragmentDoc,
Expand Down Expand Up @@ -133,10 +134,7 @@ const SignUp = () => {
hasDefinedGQLError('InvalidGoogleCode', googleRegisterError) ||
hasDefinedGQLError('InvalidGoogleToken', googleRegisterError)
) {
// TODO: note there is a link in the translation below
return translate(
'TODO: Sorry, Google Connect is not configured in your environment variables. Please read the documentation.',
)
return translate('text_660bf95c75dd928ced0ecb25', { href: DOCUMENTATION_ENV_VARS })
}

return
Expand Down Expand Up @@ -200,14 +198,14 @@ const SignUp = () => {
<Title variant="headline">
{translate(
isGoogleRegister
? 'TODO: Create your organization'
? 'text_660bf95c75dd928ced0ecb04'
: 'text_620bc4d4269a55014d493f12',
)}
</Title>
<Subtitle>
{translate(
isGoogleRegister
? 'TODO: This information won’t be editable in the future.'
? 'text_660bf95c75dd928ced0ecb08'
: 'text_620bc4d4269a55014d493fc9',
)}
</Subtitle>
Expand All @@ -221,7 +219,7 @@ const SignUp = () => {

{!isGoogleRegister && (
<>
<GoogleAuthButton mode="signup" label={translate('TODO: Continue with Google')} />
<GoogleAuthButton mode="signup" label={translate('text_660bf95c75dd928ced0ecb21')} />

<OrSeparator>
<Typography variant="captionHl" color="grey500">
Expand All @@ -236,7 +234,7 @@ const SignUp = () => {
name="organizationName"
onChange={(value) => setFormFields((prev) => ({ ...prev, organizationName: value }))}
label={translate('text_62a99ba2af7535cefacab49c')}
placeholder={translate('TODO: Type your organization name')}
placeholder={translate('text_660bf95c75dd928ced0ecb33')}
// eslint-disable-next-line jsx-a11y/no-autofocus
autoFocus
/>
Expand Down

0 comments on commit 71eb2c1

Please sign in to comment.