PromucFlow_constructor/app/client/src/pages/UserAuth/ThirdPartyAuth.tsx
Diljit ed17ee0376
chore: ce - remove sentry performance tracker (#35710)
## Description
Fix the following errors

### POST https://o296332.ingest.sentry.io/api/1546547/envelope/... 429
(Too Many Requests)

We have an integration with Sentry to instrument page loads and other
transactions. This is no longer used. All page load metrics are
collected using a new relic integration.
The sentry transactions api was throwing a 429 error when we exceed our
trial quota. Removing the integration should curb this error.

<img width="1181" alt="Screenshot 2024-08-15 at 1 22 28 PM"
src="https://github.com/user-attachments/assets/543c0ec1-e87f-4439-b715-e75b3a6fd3ed">

[Slack thread
](https://theappsmith.slack.com/archives/CGBPVEJ5C/p1723699775838509)for
more context on our sentry sub exceeding its quota.

### TypeError: e.className.split is not a function at t.value
(PageLoadInstrumentation.ts:112:33)

Add a type check for string.


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

/ok-to-test tags="@tag.All"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10400625143>
> Commit: fc83198b613a973c9a02644fc742947a92bfbd3c
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10400625143&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Thu, 15 Aug 2024 08:45:49 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Removed performance tracking functionality across various components
and sagas, simplifying the codebase and reducing overhead.
- **Bug Fixes**
- No specific bug fixes were made; improvements focus on performance
tracking removal.
- **Chores**
- Eliminated unnecessary dependencies related to performance metrics,
streamlining the application's dependency management.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-08-15 19:40:53 +05:30

96 lines
2.5 KiB
TypeScript

import React from "react";
import styled from "styled-components";
import type { SocialLoginType } from "ee/constants/SocialLogin";
import { getSocialLoginButtonProps } from "ee/utils/signupHelpers";
import type { EventName } from "ee/utils/analyticsUtilTypes";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { useLocation } from "react-router-dom";
import { Button } from "@appsmith/ads";
import { isTenantConfig } from "ee/utils/adminSettingsHelpers";
import { useSelector } from "react-redux";
import { getTenantConfig } from "ee/selectors/tenantSelectors";
const ThirdPartyAuthWrapper = styled.div`
display: flex;
gap: var(--ads-v2-spaces-3);
width: 100%;
flex-wrap: wrap;
`;
const StyledButton = styled(Button)`
flex: 1 0 171px;
`;
type SignInType = "SIGNIN" | "SIGNUP";
const startIcon: {
[key: string]: string;
} = {
Google: "google-colored",
Github: "github-fill",
};
function SocialLoginButton(props: {
logo: string;
name: string;
url: string;
type: SignInType;
}) {
const tenantConfiguration = useSelector(getTenantConfig);
const location = useLocation();
const queryParams = new URLSearchParams(location.search);
let url = props.url;
const redirectUrl = queryParams.get("redirectUrl");
if (redirectUrl != null) {
url += `?redirectUrl=${encodeURIComponent(redirectUrl)}`;
}
let buttonLabel = props.name;
if (props.name && isTenantConfig(props.name)) {
buttonLabel = tenantConfiguration[props.name];
}
return (
<StyledButton
href={url}
kind="secondary"
onClick={() => {
let eventName: EventName = "LOGIN_CLICK";
if (props.type === "SIGNUP") {
eventName = "SIGNUP_CLICK";
}
AnalyticsUtil.logEvent(eventName, {
loginMethod: props.name.toUpperCase(),
});
}}
renderAs="a"
size="md"
startIcon={
["Google", "Github"].includes(props.name)
? startIcon[props.name]
: "key-2-line"
}
>
<div className="login-method" data-testid={`login-with-${props.name}`}>
{buttonLabel}
</div>
</StyledButton>
);
}
function ThirdPartyAuth(props: {
logins: SocialLoginType[];
type: SignInType;
}) {
const socialLoginButtons = getSocialLoginButtonProps(props.logins).map(
(item) => {
return <SocialLoginButton key={item.name} {...item} type={props.type} />;
},
);
return <ThirdPartyAuthWrapper>{socialLoginButtons}</ThirdPartyAuthWrapper>;
}
export default ThirdPartyAuth;