Introduce EventTypeAppCard in app-store and make it super easy to add it through CLI - Also adds Fathom app (#4727)

* Add OmniInstall button

* Make AppCards configurable by the app itself

* Make OmniInstallAppButton not redirect

* Fixes

* Add extendsFeature support to CLI

* Move to automatic file generation approach as dynamic import checking doesnt work correctly

* Use zod everywhere consistenly for metadata and fix all TS issues

* Fix viewer.eventTypes endpoint. Make prisma base select and _ prefixed models consistent in expecting scalars only

* Remove unnecessary zod parsing of event-types as it is making the scope of the PR huge

* Fix UI TS errors

* wip

* Add zod types support in EventTypeAppCard.tsx

* Fixes during PR review and other failing tests

* Remove unused app

* Fix stripe installation flow

* More fixes

* Fix apps and active apps count

* self review

* Add loading attribute to OmniInsall button

* Handle empty state

* Improve types

* Fix stripe app installation bug

* added fathom app (#4804)

* added fathom app wrapper, needs script injection to public booking page

* new logo

* Add Fathom script support on booking pages and add it as an eventTypeapp

* Add automation and analytics apps

* Add missing pieces for analytics category

* Rename BookingPageScripts to BookingPageTagManager

Co-authored-by: Hariom Balhara <[email protected]>

* Fix lint error

* Fix runtime error with legayAppData being undefined

* Remove duplicate automation key

Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
Hariom BalharaandPeer Richelsen authored and GitHub committed 2022-10-14 10:24:43 -06:00
1 parent 215e3c93d6
commit 271d4319b9
79 files changed
+1324 -1466

No files matched your search

+2 -2
View File
@@ -1,7 +1,7 @@
import React, { ErrorInfo } from "react";
class ErrorBoundary extends React.Component<
{ children: React.ReactNode },
{ children: React.ReactNode; message?: string },
{ error: Error | null; errorInfo: ErrorInfo | null }
> {
constructor(props: { children: React.ReactNode } | Readonly<{ children: React.ReactNode }>) {
@@ -20,7 +20,7 @@ class ErrorBoundary extends React.Component<
// Error path
return (
<div>
<h2>Something went wrong.</h2>
<h2>{this.props.message || "Something went wrong."}</h2>
<details style={{ whiteSpace: "pre-wrap" }}>
{this.state.error && this.state.error.toString()}
</details>
+1 -1
View File
@@ -527,7 +527,7 @@ function useShouldDisplayNavigationItem(item: NavigationItemType) {
const { data: routingForms } = trpc.useQuery(["viewer.appById", { appId: "routing-forms" }], {
enabled: status === "authenticated" && requiredCredentialNavigationItems.includes(item.name),
});
return !requiredCredentialNavigationItems.includes(item.name) || !!routingForms;
return !requiredCredentialNavigationItems.includes(item.name) || routingForms?.isInstalled;
}
const defaultIsCurrent: NavigationItemType["isCurrent"] = ({ isChild, item, router }) => {
+1 -1
View File
@@ -3,9 +3,9 @@ import type { Credential } from "@prisma/client";
import useAddAppMutation from "@calcom/app-store/_utils/useAddAppMutation";
import { InstallAppButton } from "@calcom/app-store/components";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { App } from "@calcom/types/App";
import { Icon } from "@calcom/ui/Icon";
import { showToast } from "@calcom/ui/v2";
import Button from "@calcom/ui/v2/core/Button";
interface AppCardProps {
@@ -26,6 +26,16 @@ const tabs: (VerticalTabItemProps | HorizontalTabItemProps)[] = [
href: "/apps/installed/payment",
icon: Icon.FiCreditCard,
},
{
name: "Automation",
href: "/apps/installed/automation",
icon: Icon.FiShare2,
},
{
name: "Analytics",
href: "/apps/installed/analytics",
icon: Icon.FiBarChart,
},
{
name: "other",
href: "/apps/installed/other",
@@ -1,21 +1,23 @@
import { Prisma, SchedulingType } from "@prisma/client";
import { useMemo } from "react";
import { FormattedNumber, IntlProvider } from "react-intl";
import { z } from "zod";
import { classNames, parseRecurringEvent } from "@calcom/lib";
import getStripeAppData from "@calcom/lib/getStripeAppData";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { baseEventTypeSelect } from "@calcom/prisma/selects";
import { baseEventTypeSelect } from "@calcom/prisma";
import { EventTypeModel } from "@calcom/prisma/zod";
import { Icon } from "@calcom/ui";
import Badge from "@calcom/ui/v2/core/Badge";
const eventTypeData = Prisma.validator<Prisma.EventTypeArgs>()({
select: baseEventTypeSelect,
});
type EventType = Prisma.EventTypeGetPayload<typeof eventTypeData>;
export type EventTypeDescriptionProps = {
eventType: EventType;
eventType: Pick<
z.infer<typeof EventTypeModel>,
Exclude<keyof typeof baseEventTypeSelect, "recurringEvent"> | "metadata"
> & {
recurringEvent: Prisma.JsonValue;
};
className?: string;
};
@@ -27,6 +29,8 @@ export const EventTypeDescription = ({ eventType, className }: EventTypeDescript
[eventType.recurringEvent]
);
const stripeAppData = getStripeAppData(eventType);
return (
<>
<div className={classNames("dark:text-darkgray-800 text-neutral-500", className)}>
@@ -65,14 +69,14 @@ export const EventTypeDescription = ({ eventType, className }: EventTypeDescript
</Badge>
</li>
)}
{eventType.price > 0 && (
{stripeAppData.price > 0 && (
<li>
<Badge variant="gray" size="lg" StartIcon={Icon.FiCreditCard}>
<IntlProvider locale="en">
<FormattedNumber
value={eventType.price / 100.0}
value={stripeAppData.price / 100.0}
style="currency"
currency={eventType.currency.toUpperCase()}
currency={stripeAppData.currency.toUpperCase()}
/>
</IntlProvider>
</Badge>