Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: events apps new install flow #14616

Merged
merged 146 commits into from May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 111 commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
2585d62
feat(appStore): add isOAuth config
ThyMinimalDev Oct 20, 2023
550a1fe
refactor(appStore): EventTypeAppSettngsInterface
ThyMinimalDev Oct 20, 2023
ca0edf1
refactor(qr_code): split EventTypeAppCardInterface and EventTypeAppSe…
ThyMinimalDev Oct 20, 2023
a4d20e7
feat(appStore): redirect to onboarding for stripe and basecam
ThyMinimalDev Oct 20, 2023
905bc23
fix(ui/ScrollableArea): overflow indicator not working
ThyMinimalDev Oct 20, 2023
4e4a8b6
feat(apps): new install app flow
ThyMinimalDev Oct 20, 2023
4fba8af
fix(configureStep): get disabled props for settings
ThyMinimalDev Oct 20, 2023
d5b34b8
fix: getAppInstallsBySlug now use teamIds
ThyMinimalDev Oct 20, 2023
81347d9
chore: Alby to AppSettingsInterface
sean-brydon Jan 23, 2024
935745f
chore: Giphy to appsettings interface
sean-brydon Jan 23, 2024
7a401ee
chore: GTM migration
sean-brydon Jan 23, 2024
c01ca48
chore: GT4 - migration
sean-brydon Jan 23, 2024
c7b3bc8
chore: fathom migration
sean-brydon Jan 23, 2024
8703354
chore: paypal
sean-brydon Jan 23, 2024
f220f78
feat: basecamp migration
sean-brydon Jan 28, 2024
e4cac4a
feat: metapixel migration
sean-brydon Jan 28, 2024
a687aa9
feat:plausable
sean-brydon Jan 28, 2024
7e38f86
feat:stripe
sean-brydon Jan 28, 2024
c1be5a1
Merge branch 'main' into new-app-install-flow
ThyMinimalDev Jan 31, 2024
f443494
fix merge issues
ThyMinimalDev Jan 31, 2024
b117710
fix merge issues in new app install flow steps
ThyMinimalDev Jan 31, 2024
5dbecb7
wip: callback to onboarding
sean-brydon Feb 9, 2024
9b3fd28
fix: imports
sean-brydon Feb 9, 2024
25d4709
fix: more imports
sean-brydon Feb 9, 2024
dca6096
Merge branch 'main' into new-app-install-flow
keithwillcode Feb 9, 2024
718e1f7
feat: use redirect to onboarding on install flow
sean-brydon Feb 10, 2024
ab8ad87
Merge remote-tracking branch 'refs/remotes/origin/new-app-install-flo…
sean-brydon Feb 10, 2024
a6a97fa
Merge branch 'main' into new-app-install-flow
keithwillcode Feb 13, 2024
f6eec4e
fix: redirect to event-type after oauth flow
SomayChauhan Mar 12, 2024
1bfd59f
When clicking on install new app button, only redirect to the new app…
SomayChauhan Mar 12, 2024
7ae9535
code refactor, skip event-type step
SomayChauhan Mar 13, 2024
b1302b0
removed extra consoles
SomayChauhan Mar 14, 2024
b19b27b
so that no one can change the eventTypeId in url
SomayChauhan Mar 15, 2024
b7cd45b
theme support enabled
SomayChauhan Mar 16, 2024
1f7ba48
only pass eventTypeId instead of whole evetType obj to OmniInstallApp…
SomayChauhan Mar 16, 2024
82c50d6
fix: clicking on event-type gives error and redirects to /apps
SomayChauhan Mar 16, 2024
c811f4d
saved appOnboardingRedirectUrl to OAuth State
SomayChauhan Mar 16, 2024
fdacdbe
fix: a user having no team breaks the onboarding flow
SomayChauhan Mar 16, 2024
433417c
add optional chaining to appMetadata.extendsFeature and appMetadata.i…
SomayChauhan Mar 18, 2024
6b59c2c
encode appOnboardingRedirectUrl
SomayChauhan Mar 18, 2024
cde8190
fix: dark theme ui issues
SomayChauhan Mar 18, 2024
ba6fdfe
skip configure step if no-event types
SomayChauhan Mar 18, 2024
c5023cb
exclude calendars from apps- onboarding flow
SomayChauhan Mar 18, 2024
0621d29
Update getAppOnboardingRedirectUrl.ts
SomayChauhan Mar 18, 2024
c349d89
fix: On configure step, inputs aren't showing errors
SomayChauhan Mar 20, 2024
abafcab
change route from `apps/onboarding` to `apps/installation`
SomayChauhan Mar 20, 2024
fed2cc3
fix: flow not correctly working for teams
SomayChauhan Mar 21, 2024
1f0efa3
should only allow team ADMIN or OWER to install an app to team
SomayChauhan Mar 21, 2024
19c56f8
Prevent two payment apps to be enabled
SomayChauhan Mar 21, 2024
7194ce5
removed loading state
SomayChauhan Mar 21, 2024
fad6c70
Merge branch 'main' into new-app-install-flow
joeauyeung Mar 22, 2024
6364193
Merge branch 'new-app-install-flow' into new-app-install-flow-2
joeauyeung Mar 22, 2024
1711e49
Fix type error
joeauyeung Mar 22, 2024
9b0f360
undo new-app-flow from OmniInstallAppButton
SomayChauhan Mar 23, 2024
444c1a3
remove OAuth Step, handle step numbering
SomayChauhan Mar 23, 2024
738dc99
fix: redirect url
SomayChauhan Mar 23, 2024
9a5db48
getAppOnboardingRedirectUrl refactor
SomayChauhan Mar 26, 2024
b9362c1
for debugging
SomayChauhan Mar 26, 2024
71d579b
Revert "for debugging"
SomayChauhan Mar 26, 2024
3149aca
fix: added toaster
SomayChauhan Mar 26, 2024
a422be6
feat: added support to select multiple events (almost)
SomayChauhan Mar 28, 2024
5ea558e
hide button
SomayChauhan Mar 29, 2024
200ff6c
Merge branch 'main' into new-app-install-flow
SomayChauhan Mar 30, 2024
437aefd
Merge branch 'new-app-install-flow' into new-app-install-flow-2
SomayChauhan Mar 30, 2024
9b2e095
Move inner form outside outer form using portal
SomayChauhan Mar 30, 2024
e8c5aac
submit buttons refs madness
SomayChauhan Mar 31, 2024
d3a6a30
removed configure step
SomayChauhan Apr 1, 2024
cef57d3
removed extra unwanted code
SomayChauhan Apr 1, 2024
db41b2e
small fix
SomayChauhan Apr 1, 2024
631860f
fix: type error
SomayChauhan Apr 1, 2024
3de4df3
fix: types
SomayChauhan Apr 2, 2024
1ae0982
implemented suggested changes
SomayChauhan Apr 3, 2024
74e9f43
removed step footer
SomayChauhan Apr 3, 2024
fc20b5e
fix: Display team event types instead of user's on event types step w…
SomayChauhan Apr 3, 2024
f9302cb
fix: typo
SomayChauhan Apr 3, 2024
70096c8
removed shouldLockDisableProps
SomayChauhan Apr 3, 2024
60e04a5
refactor setUpdatedEventTypesStatus, fix type
SomayChauhan Apr 3, 2024
912b0da
removed extra code
SomayChauhan Apr 3, 2024
a28f093
can't delete while saving
SomayChauhan Apr 3, 2024
bd6c70a
added translations
SomayChauhan Apr 3, 2024
8891ab8
fix: loading in select account step, fix handle onSelect params type
SomayChauhan Apr 3, 2024
7377de7
Merge branch 'main' into new-app-install-flow
SomayChauhan Apr 3, 2024
da31d43
Merge branch 'new-app-install-flow' into new-app-install-flow-2
SomayChauhan Apr 3, 2024
c1b798c
Fix typo
joeauyeung Apr 3, 2024
fc159bc
feat: add skip button to event-types step
SomayChauhan Apr 11, 2024
8fde02c
use set-up-later button in tests
SomayChauhan Apr 11, 2024
fc2f873
added skip button to configure step as well
SomayChauhan Apr 11, 2024
b0d82a6
feat: add test for analytics apps using the new app install flow
SomayChauhan Apr 11, 2024
22b0cd7
feat: add test for stripe 1
SomayChauhan Apr 12, 2024
ebcdb08
feat: add test for stripe 2
SomayChauhan Apr 13, 2024
ff25dcd
Fix: Redirect only those apps that extend 'EventType' to the new app …
SomayChauhan Apr 11, 2024
7693077
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 16, 2024
eda8ba0
fix: type errors
SomayChauhan Apr 16, 2024
1660aa1
fix: failing tests
SomayChauhan Apr 10, 2024
ce64678
Merge branch 'feat/app-install-flow-followup' into new-app-install-fl…
SomayChauhan Apr 16, 2024
19c221b
fix: tests
SomayChauhan Apr 17, 2024
6e5f13b
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 17, 2024
a54dce1
Merge branch 'main' into new-app-install-flow-2
joeauyeung Apr 17, 2024
919bf3c
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 18, 2024
398e78d
fix test flakiness
SomayChauhan Apr 18, 2024
fc6954d
better naming and code refactor for analytics apps tests
SomayChauhan Apr 18, 2024
e8c86fe
run tests parallelly
SomayChauhan Apr 18, 2024
43893f4
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 18, 2024
5ce1e00
removed network idle, giving error
SomayChauhan Apr 18, 2024
9ec06c6
another shot at test flakiness
SomayChauhan Apr 18, 2024
8d04e00
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 18, 2024
af6060d
Fix: can't install apps without team selector dropdown on main app s…
SomayChauhan Apr 18, 2024
966084f
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 18, 2024
bfddf73
fix: test flakiness
SomayChauhan Apr 18, 2024
897a98a
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 19, 2024
7dcb655
Merge branch 'main' into new-app-install-flow-2
joeauyeung Apr 19, 2024
ec40c3c
fix: account select loading issue
SomayChauhan Apr 22, 2024
ef2635b
Merge branch 'main' into new-app-install-flow-2
joeauyeung Apr 23, 2024
29e7db5
Merge branch 'main' into new-app-install-flow-2
zomars Apr 23, 2024
4eafb0b
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 23, 2024
7372e6e
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 24, 2024
32051f3
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 24, 2024
6099451
removed getPaymentCredential (unused)
SomayChauhan Apr 24, 2024
e984dad
fix: only redirect after the app has been added to all the event-types
SomayChauhan Apr 24, 2024
ce267a8
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 24, 2024
83cc298
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 25, 2024
204caed
remove overflowIndicatorStyles
SomayChauhan Apr 25, 2024
40553f8
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 25, 2024
806452e
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 25, 2024
bcf4c6c
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 26, 2024
a0279a0
fixed failing test
SomayChauhan Apr 26, 2024
ae48c43
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 26, 2024
22c69a8
Merge branch 'main' into new-app-install-flow-2
SomayChauhan Apr 26, 2024
17a7592
Merge branch 'main' into new-app-install-flow-2
keithwillcode May 1, 2024
aedb3a7
Merge branch 'main' into new-app-install-flow-2
SomayChauhan May 1, 2024
4fd189e
Merge branch 'main' into new-app-install-flow-2
SomayChauhan May 2, 2024
9d614ad
Merge branch 'main' into new-app-install-flow-2
SomayChauhan May 2, 2024
b79149b
Merge branch 'main' into new-app-install-flow-2
joeauyeung May 6, 2024
fa8d7d2
Merge branch 'main' into new-app-install-flow-2
keithwillcode May 8, 2024
6499134
Merge branch 'main' into new-app-install-flow-2
joeauyeung May 8, 2024
14dfe66
Merge branch 'main' into new-app-install-flow-2
SomayChauhan May 9, 2024
d5f8382
Merge branch 'main' into new-app-install-flow-2
joeauyeung May 9, 2024
61609dc
Merge branch 'main' into new-app-install-flow-2
SomayChauhan May 9, 2024
7f7e448
Merge branch 'main' into new-app-install-flow-2
SomayChauhan May 10, 2024
034a94b
fix: exclude org team events
SomayChauhan May 10, 2024
0934e0c
Merge branch 'main' into new-app-install-flow-2
SomayChauhan May 10, 2024
1a45ec7
Merge branch 'main' into new-app-install-flow-2
joeauyeung May 13, 2024
4a40e94
Merge branch 'main' into new-app-install-flow-2
SomayChauhan May 15, 2024
7b33dec
undo some random merge changes
SomayChauhan May 15, 2024
0f6f260
Merge branch 'main' into new-app-install-flow-2
SomayChauhan May 22, 2024
09c52bc
Merge branch 'main' into pr/14616
zomars May 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/api/v2/src/ee/event-types/event-types.repository.ts
@@ -1,11 +1,11 @@
import { CreateEventTypeInput } from "@/ee/event-types/inputs/create-event-type.input";
import { PrismaReadService } from "@/modules/prisma/prisma-read.service";
import type { PrismaClient } from "@calcom/prisma";
import { PrismaWriteService } from "@/modules/prisma/prisma-write.service";
import { UserWithProfile } from "@/modules/users/users.repository";
import { Injectable } from "@nestjs/common";

import { getEventTypeById } from "@calcom/platform-libraries";
import type { PrismaClient } from "@calcom/prisma";

@Injectable()
export class EventTypesRepository {
Expand Down
4 changes: 2 additions & 2 deletions apps/api/v2/tsconfig.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intended?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

umm, maybe @ThyMinimalDev knows?

Expand Up @@ -23,6 +23,6 @@
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false
},
"exclude": ["./dist", "next-i18next.config.js"],
"include": ["./**/*.ts", "../../../packages/types/*.d.ts"]
"exclude": ["./dist"],
"include": ["./**/*.ts", "../../../packages/types/*.d.ts", "next-i18next.config.js"]
}
4 changes: 4 additions & 0 deletions apps/web/components/apps/AppPage.tsx
Expand Up @@ -21,6 +21,7 @@ export type AppPageProps = {
isGlobal?: AppType["isGlobal"];
logo: string;
slug: string;
dirName: string | undefined;
variant: string;
body: React.ReactNode;
categories: string[];
Expand Down Expand Up @@ -68,6 +69,7 @@ export const AppPage = ({
dependencies,
concurrentMeetings,
paid,
dirName,
}: AppPageProps) => {
const { t, i18n } = useLocale();
const hasDescriptionItems = descriptionItems && descriptionItems.length > 0;
Expand Down Expand Up @@ -223,6 +225,7 @@ export const AppPage = ({
multiInstall
concurrentMeetings={concurrentMeetings}
paid={paid}
dirName={dirName}
{...props}
/>
);
Expand Down Expand Up @@ -262,6 +265,7 @@ export const AppPage = ({
credentials={appDbQuery.data?.credentials}
concurrentMeetings={concurrentMeetings}
paid={paid}
dirName={dirName}
{...props}
/>
);
Expand Down
38 changes: 38 additions & 0 deletions apps/web/components/apps/InstallAppButtonChild.tsx
@@ -1,7 +1,14 @@
import { useRouter } from "next/navigation";
import { useMemo } from "react";

import useAddAppMutation from "@calcom/app-store/_utils/useAddAppMutation";
import { appStoreMetadata } from "@calcom/app-store/appStoreMetaData";
import { doesAppSupportTeamInstall } from "@calcom/app-store/utils";
import { Spinner } from "@calcom/features/calendars/weeklyview/components/spinner/Spinner";
import type { UserAdminTeams } from "@calcom/features/ee/teams/lib/getUserAdminTeams";
import { AppOnboardingSteps } from "@calcom/lib/apps/appOnboardingSteps";
import { getAppOnboardingUrl } from "@calcom/lib/apps/getAppOnboardingUrl";
import { shouldRedirectToAppOnboarding } from "@calcom/lib/apps/shouldRedirectToAppOnboarding";
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { RouterOutputs } from "@calcom/trpc/react";
Expand All @@ -26,7 +33,9 @@ export const InstallAppButtonChild = ({
multiInstall,
credentials,
concurrentMeetings,
dirName,
paid,
onClick,
...props
}: {
userAdminTeams?: UserAdminTeams;
Expand All @@ -36,8 +45,10 @@ export const InstallAppButtonChild = ({
credentials?: RouterOutputs["viewer"]["appCredentialsByType"]["credentials"];
concurrentMeetings?: boolean;
paid?: AppFrontendPayload["paid"];
dirName: string | undefined;
} & ButtonProps) => {
const { t } = useLocale();
const router = useRouter();

const mutation = useAddAppMutation(null, {
onSuccess: (data) => {
Expand All @@ -49,13 +60,26 @@ export const InstallAppButtonChild = ({
},
});
const shouldDisableInstallation = !multiInstall ? !!(credentials && credentials.length) : false;
const appMetadata = appStoreMetadata[dirName as keyof typeof appStoreMetadata];
const redirectToAppOnboarding = useMemo(() => shouldRedirectToAppOnboarding(appMetadata), [appMetadata]);

const _onClick = (e: React.MouseEvent<HTMLElement, MouseEvent>) => {
if (redirectToAppOnboarding) {
router.push(
getAppOnboardingUrl({ slug: addAppMutationInput.slug, step: AppOnboardingSteps.ACCOUNTS_STEP })
);
} else if (onClick) {
onClick(e);
}
};

// Paid apps don't support team installs at the moment
// Also, cal.ai(the only paid app at the moment) doesn't support team install either
if (paid) {
return (
<Button
data-testid="install-app-button"
onClick={_onClick}
{...props}
disabled={shouldDisableInstallation}
color="primary"
Expand All @@ -72,6 +96,7 @@ export const InstallAppButtonChild = ({
return (
<Button
data-testid="install-app-button"
onClick={_onClick}
{...props}
// @TODO: Overriding color and size prevent us from
// having to duplicate InstallAppButton for now.
Expand All @@ -83,6 +108,19 @@ export const InstallAppButtonChild = ({
);
}

if (redirectToAppOnboarding) {
return (
<Button
data-testid="install-app-button"
disabled={shouldDisableInstallation}
onClick={_onClick}
color="primary"
size="base"
{...props}>
{multiInstall ? t("install_another") : t("install_app")}
</Button>
);
}
return (
<Dropdown>
<DropdownMenuTrigger asChild>
Expand Down
97 changes: 97 additions & 0 deletions apps/web/components/apps/installation/AccountsStepCard.tsx
@@ -0,0 +1,97 @@
import type { FC } from "react";
import React, { useState } from "react";

import { classNames } from "@calcom/lib";
import { CAL_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { Team, User } from "@calcom/prisma/client";
import { Avatar, StepCard } from "@calcom/ui";

type AccountSelectorProps = {
avatar?: string;
name: string;
alreadyInstalled: boolean;
onClick?: () => void;
loading: boolean;
testId: string;
};

const AccountSelector: FC<AccountSelectorProps> = ({
avatar,
alreadyInstalled,
name,
onClick,
loading,
testId,
}) => {
const { t } = useLocale();
const [selected, setSelected] = useState(false);
return (
<div
className={classNames(
"hover:bg-muted flex cursor-pointer flex-row items-center gap-2 p-1",
(alreadyInstalled || loading) && "cursor-not-allowed",
selected && "bg-muted animate-pulse"
)}
data-testid={testId}
onClick={() => {
if (onClick) {
setSelected(true);
onClick();
}
}}>
<Avatar
alt={avatar || ""}
imageSrc={avatar || `${CAL_URL}/${avatar}`} // if no image, use default avatar
size="sm"
/>
<div className="text-md pt-0.5 font-medium text-gray-500">
{name}
{alreadyInstalled ? <span className="ml-1 text-sm text-gray-400">{t("already_installed")}</span> : ""}
</div>
</div>
);
};

export type PersonalAccountProps = Pick<User, "id" | "avatar" | "name"> & { alreadyInstalled: boolean };

export type TeamsProp = (Pick<Team, "id" | "name" | "logo"> & {
alreadyInstalled: boolean;
})[];

type AccountStepCardProps = {
teams: TeamsProp;
personalAccount: PersonalAccountProps;
onSelect: (id?: number) => void;
loading: boolean;
};

export const AccountsStepCard: FC<AccountStepCardProps> = ({ teams, personalAccount, onSelect, loading }) => {
const { t } = useLocale();
return (
<StepCard>
<div className="text-sm font-medium text-gray-400">{t("install_app_on")}</div>
<div className={classNames("mt-2 flex flex-col gap-2 ")}>
<AccountSelector
testId="install-app-button-personal"
avatar={personalAccount.avatar ?? ""}
name={personalAccount.name ?? ""}
alreadyInstalled={personalAccount.alreadyInstalled}
onClick={() => !personalAccount.alreadyInstalled && !loading && onSelect()}
loading={loading}
/>
{teams.map((team) => (
<AccountSelector
key={team.id}
testId={`install-app-button-team${team.id}`}
alreadyInstalled={team.alreadyInstalled}
avatar={team.logo ?? ""}
name={team.name}
onClick={() => !team.alreadyInstalled && !loading && onSelect(team.id)}
loading={loading}
/>
))}
</div>
</StepCard>
);
};