2022-01-05 04:56:42 +00:00
|
|
|
import React, { useEffect } from "react";
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type { InjectedFormProps } from "redux-form";
|
|
|
|
|
import { reduxForm, formValueSelector } from "redux-form";
|
2019-12-16 08:49:10 +00:00
|
|
|
import { AUTH_LOGIN_URL } from "constants/routes";
|
2024-08-06 14:52:22 +00:00
|
|
|
import { SIGNUP_FORM_NAME } from "ee/constants/forms";
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type { RouteComponentProps } from "react-router-dom";
|
2023-05-19 18:37:06 +00:00
|
|
|
import { useHistory, useLocation, withRouter } from "react-router-dom";
|
2024-04-17 16:16:44 +00:00
|
|
|
import {
|
|
|
|
|
SpacedSubmitForm,
|
|
|
|
|
FormActions,
|
|
|
|
|
OrWithLines,
|
|
|
|
|
} from "pages/UserAuth/StyledComponents";
|
2019-12-16 08:49:10 +00:00
|
|
|
import {
|
|
|
|
|
SIGNUP_PAGE_TITLE,
|
|
|
|
|
SIGNUP_PAGE_EMAIL_INPUT_LABEL,
|
|
|
|
|
SIGNUP_PAGE_EMAIL_INPUT_PLACEHOLDER,
|
|
|
|
|
SIGNUP_PAGE_PASSWORD_INPUT_LABEL,
|
|
|
|
|
SIGNUP_PAGE_PASSWORD_INPUT_PLACEHOLDER,
|
|
|
|
|
SIGNUP_PAGE_LOGIN_LINK_TEXT,
|
|
|
|
|
FORM_VALIDATION_EMPTY_PASSWORD,
|
|
|
|
|
FORM_VALIDATION_INVALID_EMAIL,
|
|
|
|
|
FORM_VALIDATION_INVALID_PASSWORD,
|
|
|
|
|
SIGNUP_PAGE_SUBMIT_BUTTON_TEXT,
|
2021-01-27 06:12:32 +00:00
|
|
|
ALREADY_HAVE_AN_ACCOUNT,
|
2021-03-13 14:24:45 +00:00
|
|
|
createMessage,
|
2023-10-17 10:18:00 +00:00
|
|
|
GOOGLE_RECAPTCHA_KEY_ERROR,
|
2024-04-17 16:16:44 +00:00
|
|
|
LOOKING_TO_SELF_HOST,
|
|
|
|
|
VISIT_OUR_DOCS,
|
2024-08-06 14:52:22 +00:00
|
|
|
} from "ee/constants/messages";
|
2022-10-05 11:06:49 +00:00
|
|
|
import FormTextField from "components/utils/ReduxFormTextField";
|
2023-08-28 15:37:32 +00:00
|
|
|
import ThirdPartyAuth from "pages/UserAuth/ThirdPartyAuth";
|
2024-08-08 12:55:00 +00:00
|
|
|
import { FormGroup } from "@appsmith/ads-old";
|
2024-08-09 14:20:29 +00:00
|
|
|
import { Button, Link, Callout } from "@appsmith/ads";
|
2019-12-16 08:49:10 +00:00
|
|
|
import { isEmail, isStrongPassword, isEmptyString } from "utils/formhelpers";
|
|
|
|
|
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type { SignupFormValues } from "pages/UserAuth/helpers";
|
2024-08-06 14:52:22 +00:00
|
|
|
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
|
2019-12-16 08:49:10 +00:00
|
|
|
|
2024-08-06 14:52:22 +00:00
|
|
|
import { SIGNUP_SUBMIT_PATH } from "ee/constants/ApiConstants";
|
2023-04-30 06:22:42 +00:00
|
|
|
import { connect, useSelector } from "react-redux";
|
2024-08-06 14:52:22 +00:00
|
|
|
import type { AppState } from "ee/reducers";
|
2021-01-28 07:20:09 +00:00
|
|
|
|
2024-08-06 14:52:22 +00:00
|
|
|
import { SIGNUP_FORM_EMAIL_FIELD_NAME } from "ee/constants/forms";
|
|
|
|
|
import { getAppsmithConfigs } from "ee/configs";
|
2021-06-08 05:40:11 +00:00
|
|
|
import { useScript, ScriptStatus, AddScriptTo } from "utils/hooks/useScript";
|
2021-01-28 07:20:09 +00:00
|
|
|
|
2021-07-29 08:49:46 +00:00
|
|
|
import { getIsSafeRedirectURL } from "utils/helpers";
|
2022-12-09 14:43:47 +00:00
|
|
|
import Container from "pages/UserAuth/Container";
|
2023-05-16 09:04:48 +00:00
|
|
|
import {
|
|
|
|
|
getIsFormLoginEnabled,
|
chore: Migrate Tenant to Organization (#38891)
## Description
> [!TIP]
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._
Fixes #`Issue Number`
_or_
Fixes `Issue URL`
> [!WARNING]
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._
## Automation
/test all
### :mag: Cypress test results
<!-- This is an auto-generated comment: Cypress test results -->
> [!CAUTION]
> 🔴 🔴 🔴 Some tests have failed.
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13391658708>
> Commit: d30db4487d93622533aec846a17fecea12e0205e
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13391658708&attempt=1&selectiontype=test&testsstatus=failed&specsstatus=fail"
target="_blank">Cypress dashboard</a>.
> Tags: @tag.All
> Spec:
> The following are new failures, please fix them before merging the PR:
<ol>
>
<li>cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_LocalStoreValueFunctions_spec.ts
>
<li>cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts
>
<li>cypress/e2e/Regression/ClientSide/Widgets/TableV2/table_data_change_spec.ts</ol>
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master"
target="_blank">List of identified flaky tests</a>.
> <hr>Tue, 18 Feb 2025 14:35:32 UTC
<!-- end of auto-generated comment: Cypress test results -->
## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced organization-level configuration management, impacting
admin settings, login, and branding displays.
- Enhanced handling of permissions and feature flags now centered on
organizations.
- **Refactor**
- Updated user-facing terminology across the application from “tenant”
to “organization” (e.g., in dashboards, profile settings, error pages,
and admin panels).
- Refactored multiple components and services to utilize
organization-based logic instead of tenant-based logic.
- **Chore**
- Deployed comprehensive migration scripts to seamlessly transition all
settings and cached data to the new organization model.
These updates improve consistency and clarity in how configurations and
permissions are managed and presented.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-02-18 15:11:07 +00:00
|
|
|
getOrganizationConfig,
|
2023-05-16 09:04:48 +00:00
|
|
|
getThirdPartyAuths,
|
chore: Migrate Tenant to Organization (#38891)
## Description
> [!TIP]
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._
Fixes #`Issue Number`
_or_
Fixes `Issue URL`
> [!WARNING]
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._
## Automation
/test all
### :mag: Cypress test results
<!-- This is an auto-generated comment: Cypress test results -->
> [!CAUTION]
> 🔴 🔴 🔴 Some tests have failed.
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13391658708>
> Commit: d30db4487d93622533aec846a17fecea12e0205e
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13391658708&attempt=1&selectiontype=test&testsstatus=failed&specsstatus=fail"
target="_blank">Cypress dashboard</a>.
> Tags: @tag.All
> Spec:
> The following are new failures, please fix them before merging the PR:
<ol>
>
<li>cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_LocalStoreValueFunctions_spec.ts
>
<li>cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts
>
<li>cypress/e2e/Regression/ClientSide/Widgets/TableV2/table_data_change_spec.ts</ol>
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master"
target="_blank">List of identified flaky tests</a>.
> <hr>Tue, 18 Feb 2025 14:35:32 UTC
<!-- end of auto-generated comment: Cypress test results -->
## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced organization-level configuration management, impacting
admin settings, login, and branding displays.
- Enhanced handling of permissions and feature flags now centered on
organizations.
- **Refactor**
- Updated user-facing terminology across the application from “tenant”
to “organization” (e.g., in dashboards, profile settings, error pages,
and admin panels).
- Refactored multiple components and services to utilize
organization-based logic instead of tenant-based logic.
- **Chore**
- Deployed comprehensive migration scripts to seamlessly transition all
settings and cached data to the new organization model.
These updates improve consistency and clarity in how configurations and
permissions are managed and presented.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-02-18 15:11:07 +00:00
|
|
|
} from "ee/selectors/organizationSelectors";
|
2023-06-14 15:55:32 +00:00
|
|
|
import Helmet from "react-helmet";
|
2023-09-07 08:20:31 +00:00
|
|
|
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
|
2024-08-06 14:52:22 +00:00
|
|
|
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
|
|
|
|
|
import { getHTMLPageTitle } from "ee/utils/BusinessFeatures/brandingPageHelpers";
|
2023-10-17 10:18:00 +00:00
|
|
|
import log from "loglevel";
|
2024-04-17 16:16:44 +00:00
|
|
|
import { SELF_HOSTING_DOC } from "constants/ThirdPartyConstants";
|
2024-10-07 05:51:55 +00:00
|
|
|
import * as Sentry from "@sentry/react";
|
|
|
|
|
import { Severity } from "@sentry/react";
|
2020-07-07 10:22:17 +00:00
|
|
|
|
2021-06-08 05:40:11 +00:00
|
|
|
declare global {
|
|
|
|
|
interface Window {
|
2024-07-31 15:41:28 +00:00
|
|
|
// TODO: Fix this the next time the file is edited
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2021-06-08 05:40:11 +00:00
|
|
|
grecaptcha: any;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-17 16:16:44 +00:00
|
|
|
const { cloudHosting, googleRecaptchaSiteKey } = getAppsmithConfigs();
|
2021-06-08 05:40:11 +00:00
|
|
|
|
2019-12-16 08:49:10 +00:00
|
|
|
const validate = (values: SignupFormValues) => {
|
|
|
|
|
const errors: SignupFormValues = {};
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2019-12-16 08:49:10 +00:00
|
|
|
if (!values.password || isEmptyString(values.password)) {
|
2021-03-13 14:24:45 +00:00
|
|
|
errors.password = createMessage(FORM_VALIDATION_EMPTY_PASSWORD);
|
2019-12-16 08:49:10 +00:00
|
|
|
} else if (!isStrongPassword(values.password)) {
|
2021-03-13 14:24:45 +00:00
|
|
|
errors.password = createMessage(FORM_VALIDATION_INVALID_PASSWORD);
|
2019-12-16 08:49:10 +00:00
|
|
|
}
|
2021-01-28 07:20:09 +00:00
|
|
|
|
|
|
|
|
const email = values.email || "";
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2021-01-28 07:20:09 +00:00
|
|
|
if (!isEmptyString(email) && !isEmail(email)) {
|
2021-03-13 14:24:45 +00:00
|
|
|
errors.email = createMessage(FORM_VALIDATION_INVALID_EMAIL);
|
2019-12-16 08:49:10 +00:00
|
|
|
}
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2019-12-16 08:49:10 +00:00
|
|
|
return errors;
|
|
|
|
|
};
|
|
|
|
|
|
2021-01-28 07:20:09 +00:00
|
|
|
type SignUpFormProps = InjectedFormProps<
|
|
|
|
|
SignupFormValues,
|
|
|
|
|
{ emailValue: string }
|
|
|
|
|
> &
|
2023-01-13 11:05:59 +00:00
|
|
|
RouteComponentProps<{ email: string }> & { emailValue: string };
|
2020-08-14 06:01:50 +00:00
|
|
|
|
2021-04-28 10:28:39 +00:00
|
|
|
export function SignUp(props: SignUpFormProps) {
|
2022-01-05 04:56:42 +00:00
|
|
|
const history = useHistory();
|
2023-05-16 09:04:48 +00:00
|
|
|
const isFormLoginEnabled = useSelector(getIsFormLoginEnabled);
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2022-01-05 04:56:42 +00:00
|
|
|
useEffect(() => {
|
2023-05-16 09:04:48 +00:00
|
|
|
if (!isFormLoginEnabled) {
|
2022-04-01 11:27:49 +00:00
|
|
|
const search = new URL(window.location.href)?.searchParams?.toString();
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2022-04-01 11:27:49 +00:00
|
|
|
history.replace({
|
|
|
|
|
pathname: AUTH_LOGIN_URL,
|
|
|
|
|
search,
|
|
|
|
|
});
|
2022-01-05 04:56:42 +00:00
|
|
|
}
|
2023-08-03 06:27:16 +00:00
|
|
|
|
|
|
|
|
AnalyticsUtil.logEvent("SIGNUP_REACHED", {
|
|
|
|
|
referrer: document.referrer,
|
|
|
|
|
});
|
2022-01-05 04:56:42 +00:00
|
|
|
}, []);
|
2021-05-13 08:35:39 +00:00
|
|
|
const { emailValue: email, error, pristine, submitting, valid } = props;
|
2021-01-28 07:20:09 +00:00
|
|
|
const isFormValid = valid && email && !isEmptyString(email);
|
2023-05-02 09:38:57 +00:00
|
|
|
const socialLoginList = useSelector(getThirdPartyAuths);
|
2022-03-24 07:05:00 +00:00
|
|
|
const shouldDisableSignupButton = pristine || !isFormValid;
|
2020-08-10 12:19:46 +00:00
|
|
|
const location = useLocation();
|
2023-09-07 08:20:31 +00:00
|
|
|
const isBrandingEnabled = useFeatureFlag(
|
|
|
|
|
FEATURE_FLAG.license_branding_enabled,
|
|
|
|
|
);
|
chore: Migrate Tenant to Organization (#38891)
## Description
> [!TIP]
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._
Fixes #`Issue Number`
_or_
Fixes `Issue URL`
> [!WARNING]
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._
## Automation
/test all
### :mag: Cypress test results
<!-- This is an auto-generated comment: Cypress test results -->
> [!CAUTION]
> 🔴 🔴 🔴 Some tests have failed.
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13391658708>
> Commit: d30db4487d93622533aec846a17fecea12e0205e
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13391658708&attempt=1&selectiontype=test&testsstatus=failed&specsstatus=fail"
target="_blank">Cypress dashboard</a>.
> Tags: @tag.All
> Spec:
> The following are new failures, please fix them before merging the PR:
<ol>
>
<li>cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_LocalStoreValueFunctions_spec.ts
>
<li>cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts
>
<li>cypress/e2e/Regression/ClientSide/Widgets/TableV2/table_data_change_spec.ts</ol>
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master"
target="_blank">List of identified flaky tests</a>.
> <hr>Tue, 18 Feb 2025 14:35:32 UTC
<!-- end of auto-generated comment: Cypress test results -->
## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced organization-level configuration management, impacting
admin settings, login, and branding displays.
- Enhanced handling of permissions and feature flags now centered on
organizations.
- **Refactor**
- Updated user-facing terminology across the application from “tenant”
to “organization” (e.g., in dashboards, profile settings, error pages,
and admin panels).
- Refactored multiple components and services to utilize
organization-based logic instead of tenant-based logic.
- **Chore**
- Deployed comprehensive migration scripts to seamlessly transition all
settings and cached data to the new organization model.
These updates improve consistency and clarity in how configurations and
permissions are managed and presented.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-02-18 15:11:07 +00:00
|
|
|
const organizationConfig = useSelector(getOrganizationConfig);
|
|
|
|
|
const { instanceName } = organizationConfig;
|
2023-09-13 05:57:18 +00:00
|
|
|
const htmlPageTitle = getHTMLPageTitle(isBrandingEnabled, instanceName);
|
2020-08-10 12:19:46 +00:00
|
|
|
|
2021-06-08 05:40:11 +00:00
|
|
|
const recaptchaStatus = useScript(
|
|
|
|
|
`https://www.google.com/recaptcha/api.js?render=${googleRecaptchaSiteKey.apiKey}`,
|
|
|
|
|
AddScriptTo.HEAD,
|
|
|
|
|
);
|
|
|
|
|
|
2020-08-10 12:19:46 +00:00
|
|
|
let showError = false;
|
|
|
|
|
let errorMessage = "";
|
|
|
|
|
const queryParams = new URLSearchParams(location.search);
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2020-08-10 12:19:46 +00:00
|
|
|
if (queryParams.get("error")) {
|
|
|
|
|
errorMessage = queryParams.get("error") || "";
|
|
|
|
|
showError = true;
|
2024-10-07 05:51:55 +00:00
|
|
|
Sentry.captureException("Sign up failed", {
|
|
|
|
|
level: Severity.Error,
|
|
|
|
|
extra: {
|
|
|
|
|
error: new Error(errorMessage),
|
|
|
|
|
},
|
|
|
|
|
});
|
2020-08-10 12:19:46 +00:00
|
|
|
}
|
|
|
|
|
|
2022-07-11 09:03:37 +00:00
|
|
|
const signupURL = new URL(
|
|
|
|
|
`/api/v1/` + SIGNUP_SUBMIT_PATH,
|
|
|
|
|
window.location.origin,
|
|
|
|
|
);
|
|
|
|
|
const appId = queryParams.get("appId");
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2022-07-11 09:03:37 +00:00
|
|
|
if (appId) {
|
|
|
|
|
signupURL.searchParams.append("appId", appId);
|
2021-05-18 05:52:54 +00:00
|
|
|
} else {
|
|
|
|
|
const redirectUrl = queryParams.get("redirectUrl");
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2021-07-29 08:49:46 +00:00
|
|
|
if (redirectUrl != null && getIsSafeRedirectURL(redirectUrl)) {
|
2022-07-11 09:03:37 +00:00
|
|
|
signupURL.searchParams.append("redirectUrl", redirectUrl);
|
2021-05-18 05:52:54 +00:00
|
|
|
}
|
2020-08-10 12:19:46 +00:00
|
|
|
}
|
|
|
|
|
|
2022-03-24 07:05:00 +00:00
|
|
|
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
const formElement: HTMLFormElement = document.getElementById(
|
|
|
|
|
"signup-form",
|
|
|
|
|
) as HTMLFormElement;
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2022-03-24 07:05:00 +00:00
|
|
|
if (
|
|
|
|
|
googleRecaptchaSiteKey.enabled &&
|
|
|
|
|
recaptchaStatus === ScriptStatus.READY
|
|
|
|
|
) {
|
2023-10-17 10:18:00 +00:00
|
|
|
try {
|
|
|
|
|
window.grecaptcha
|
|
|
|
|
.execute(googleRecaptchaSiteKey.apiKey, {
|
|
|
|
|
action: "submit",
|
2024-07-31 15:41:28 +00:00
|
|
|
}) // TODO: Fix this the next time the file is edited
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2023-10-17 10:18:00 +00:00
|
|
|
.then(function (token: any) {
|
|
|
|
|
if (formElement) {
|
|
|
|
|
signupURL.searchParams.append("recaptchaToken", token);
|
|
|
|
|
formElement.setAttribute("action", signupURL.toString());
|
|
|
|
|
formElement.submit();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
log.error(createMessage(GOOGLE_RECAPTCHA_KEY_ERROR));
|
|
|
|
|
});
|
|
|
|
|
} catch (e) {
|
|
|
|
|
log.error(e);
|
|
|
|
|
}
|
2022-03-24 07:05:00 +00:00
|
|
|
} else {
|
|
|
|
|
formElement && formElement.submit();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2022-12-09 14:43:47 +00:00
|
|
|
const footerSection = (
|
2024-04-17 16:16:44 +00:00
|
|
|
<>
|
|
|
|
|
<div className="px-2 flex align-center justify-center text-center text-[color:var(--ads-v2\-color-fg)] text-[14px]">
|
|
|
|
|
{createMessage(ALREADY_HAVE_AN_ACCOUNT)}
|
|
|
|
|
<Link
|
|
|
|
|
className="t--sign-up t--signup-link"
|
|
|
|
|
kind="primary"
|
|
|
|
|
target="_self"
|
|
|
|
|
to={AUTH_LOGIN_URL}
|
|
|
|
|
>
|
|
|
|
|
{createMessage(SIGNUP_PAGE_LOGIN_LINK_TEXT)}
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
|
|
|
|
{cloudHosting && (
|
|
|
|
|
<>
|
|
|
|
|
<OrWithLines>or</OrWithLines>
|
|
|
|
|
<div className="px-2 text-center text-[color:var(--ads-v2\-color-fg)] text-[14px]">
|
|
|
|
|
{createMessage(LOOKING_TO_SELF_HOST)}
|
|
|
|
|
<Link
|
|
|
|
|
className="t--visit-docs t--visit-docs-link pl-[var(--ads-v2\-spaces-3)] justify-center"
|
|
|
|
|
kind="primary"
|
|
|
|
|
onClick={() => AnalyticsUtil.logEvent("VISIT_SELF_HOST_DOCS")}
|
|
|
|
|
target="_self"
|
|
|
|
|
to={`${SELF_HOSTING_DOC}?utm_source=cloudSignup`}
|
|
|
|
|
>
|
|
|
|
|
{createMessage(VISIT_OUR_DOCS)}
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
2022-12-09 14:43:47 +00:00
|
|
|
);
|
|
|
|
|
|
2019-12-16 08:49:10 +00:00
|
|
|
return (
|
2024-04-17 16:16:44 +00:00
|
|
|
<Container footer={footerSection} title={createMessage(SIGNUP_PAGE_TITLE)}>
|
2023-06-14 15:55:32 +00:00
|
|
|
<Helmet>
|
|
|
|
|
<title>{htmlPageTitle}</title>
|
|
|
|
|
</Helmet>
|
|
|
|
|
|
2023-05-19 18:37:06 +00:00
|
|
|
{showError && <Callout kind="error">{errorMessage}</Callout>}
|
2022-01-07 06:08:17 +00:00
|
|
|
{socialLoginList.length > 0 && (
|
|
|
|
|
<ThirdPartyAuth logins={socialLoginList} type={"SIGNUP"} />
|
2021-01-27 06:12:32 +00:00
|
|
|
)}
|
2023-05-16 09:04:48 +00:00
|
|
|
{isFormLoginEnabled && (
|
2022-03-24 07:05:00 +00:00
|
|
|
<SpacedSubmitForm
|
2022-07-11 09:03:37 +00:00
|
|
|
action={signupURL.toString()}
|
2022-03-24 07:05:00 +00:00
|
|
|
id="signup-form"
|
|
|
|
|
method="POST"
|
|
|
|
|
onSubmit={(e) => handleSubmit(e)}
|
2021-01-27 06:12:32 +00:00
|
|
|
>
|
2022-03-24 07:05:00 +00:00
|
|
|
<FormGroup
|
|
|
|
|
intent={error ? "danger" : "none"}
|
|
|
|
|
label={createMessage(SIGNUP_PAGE_EMAIL_INPUT_LABEL)}
|
|
|
|
|
>
|
|
|
|
|
<FormTextField
|
|
|
|
|
autoFocus
|
|
|
|
|
name="email"
|
|
|
|
|
placeholder={createMessage(SIGNUP_PAGE_EMAIL_INPUT_PLACEHOLDER)}
|
|
|
|
|
type="email"
|
|
|
|
|
/>
|
|
|
|
|
</FormGroup>
|
|
|
|
|
<FormGroup
|
|
|
|
|
intent={error ? "danger" : "none"}
|
|
|
|
|
label={createMessage(SIGNUP_PAGE_PASSWORD_INPUT_LABEL)}
|
|
|
|
|
>
|
|
|
|
|
<FormTextField
|
|
|
|
|
name="password"
|
|
|
|
|
placeholder={createMessage(
|
|
|
|
|
SIGNUP_PAGE_PASSWORD_INPUT_PLACEHOLDER,
|
|
|
|
|
)}
|
|
|
|
|
type="password"
|
|
|
|
|
/>
|
|
|
|
|
</FormGroup>
|
|
|
|
|
<FormActions>
|
|
|
|
|
<Button
|
2023-05-19 18:37:06 +00:00
|
|
|
isDisabled={shouldDisableSignupButton}
|
2022-03-24 07:05:00 +00:00
|
|
|
isLoading={submitting}
|
2023-05-19 18:37:06 +00:00
|
|
|
kind="primary"
|
2022-03-24 07:05:00 +00:00
|
|
|
onClick={() => {
|
|
|
|
|
AnalyticsUtil.logEvent("SIGNUP_CLICK", {
|
|
|
|
|
signupMethod: "EMAIL",
|
|
|
|
|
});
|
|
|
|
|
}}
|
2023-05-19 18:37:06 +00:00
|
|
|
size="md"
|
2022-03-24 07:05:00 +00:00
|
|
|
type="submit"
|
2023-05-19 18:37:06 +00:00
|
|
|
>
|
|
|
|
|
{createMessage(SIGNUP_PAGE_SUBMIT_BUTTON_TEXT)}
|
|
|
|
|
</Button>
|
2022-03-24 07:05:00 +00:00
|
|
|
</FormActions>
|
|
|
|
|
</SpacedSubmitForm>
|
|
|
|
|
)}
|
2022-12-09 14:43:47 +00:00
|
|
|
</Container>
|
2019-12-16 08:49:10 +00:00
|
|
|
);
|
2021-04-28 10:28:39 +00:00
|
|
|
}
|
2019-12-16 08:49:10 +00:00
|
|
|
|
2021-01-28 07:20:09 +00:00
|
|
|
const selector = formValueSelector(SIGNUP_FORM_NAME);
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2020-08-28 10:51:41 +00:00
|
|
|
export default connect((state: AppState, props: SignUpFormProps) => {
|
|
|
|
|
const queryParams = new URLSearchParams(props.location.search);
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2020-08-28 10:51:41 +00:00
|
|
|
return {
|
|
|
|
|
initialValues: {
|
|
|
|
|
email: queryParams.get("email"),
|
|
|
|
|
},
|
2021-01-28 07:20:09 +00:00
|
|
|
emailValue: selector(state, SIGNUP_FORM_EMAIL_FIELD_NAME),
|
2020-08-28 10:51:41 +00:00
|
|
|
};
|
|
|
|
|
}, null)(
|
2021-01-28 07:20:09 +00:00
|
|
|
reduxForm<SignupFormValues, { emailValue: string }>({
|
2020-08-14 06:01:50 +00:00
|
|
|
validate,
|
|
|
|
|
form: SIGNUP_FORM_NAME,
|
|
|
|
|
touchOnBlur: true,
|
2023-01-13 11:05:59 +00:00
|
|
|
})(withRouter(SignUp)),
|
2020-08-14 06:01:50 +00:00
|
|
|
);
|