diff --git a/apps/web/pages/success.tsx b/apps/web/pages/success.tsx index e729116c6d..a25ca7d22e 100644 --- a/apps/web/pages/success.tsx +++ b/apps/web/pages/success.tsx @@ -16,7 +16,6 @@ import { useEffect, useRef, useState } from "react"; import RRule from "rrule"; import { z } from "zod"; -import { SpaceBookingSuccessPage } from "@calcom/app-store/spacebooking/components"; import { sdkActionManager, useEmbedNonStylesConfig, @@ -265,345 +264,324 @@ export default function Success(props: SuccessProps) { const customInputs = bookingInfo?.customInputs; return ( (isReady && ( - <> -
- {userIsOwner && !isEmbed && ( -
- - - {t("back_to_bookings")} - - -
- )} - - - -
-
- {isSuccessRedirectAvailable(eventType) && eventType.successRedirectUrl ? ( - - ) : null}{" "} +
+ {userIsOwner && !isEmbed && ( + + )} + + + +
+
+ {isSuccessRedirectAvailable(eventType) && eventType.successRedirectUrl ? ( + + ) : null}{" "} +
+ className={classNames("my-4 transition-opacity sm:my-0", isEmbed ? "" : " inset-0")} + aria-hidden="true">
-
- {/* SPACE BOOKING APP */} - {props.userHasSpaceBooking && ( - - )} - +
+
+
)) || null ); @@ -771,19 +749,6 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { }; } - let userHasSpaceBooking = false; - if (eventTypeRaw.users[0] && eventTypeRaw.users[0].id) { - const credential = await prisma.credential.findFirst({ - where: { - type: "spacebooking_other", - userId: eventTypeRaw.users[0].id, - }, - }); - if (credential && credential.type === "spacebooking_other") { - userHasSpaceBooking = true; - } - } - if (!eventTypeRaw.users.length && eventTypeRaw.userId) { // TODO we should add `user User` relation on `EventType` so this extra query isn't needed const user = await prisma.user.findUnique({ @@ -889,7 +854,6 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { recurringBookings: recurringBookings ? recurringBookings.map((obj) => obj.startTime.toString()) : null, trpcState: ssr.dehydrate(), dynamicEventName, - userHasSpaceBooking, bookingInfo, }, }; diff --git a/packages/app-store/index.ts b/packages/app-store/index.ts index 230ffc3ae7..d3de3c05a0 100644 --- a/packages/app-store/index.ts +++ b/packages/app-store/index.ts @@ -14,7 +14,6 @@ import * as metamask from "./metamask"; import * as office365calendar from "./office365calendar"; import * as office365video from "./office365video"; import * as slackmessaging from "./slackmessaging"; -import * as spacebooking from "./spacebooking"; import * as stripepayment from "./stripepayment"; import * as tandemvideo from "./tandemvideo"; import * as vital from "./vital"; @@ -36,7 +35,6 @@ const appStore = { office365video, slackmessaging, stripepayment, - spacebooking, tandemvideo, vital, zoomvideo, diff --git a/packages/app-store/spacebooking/README.mdx b/packages/app-store/spacebooking/README.mdx deleted file mode 100644 index af4c367c35..0000000000 --- a/packages/app-store/spacebooking/README.mdx +++ /dev/null @@ -1,10 +0,0 @@ - - -Looking to honor May 4th? Search no further. Download this app to make your booking success page resemble a long time ago in a galaxy far far away. diff --git a/packages/app-store/spacebooking/_metadata.ts b/packages/app-store/spacebooking/_metadata.ts deleted file mode 100644 index 5199ad95ae..0000000000 --- a/packages/app-store/spacebooking/_metadata.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { App } from "@calcom/types/App"; - -import _package from "./package.json"; - -export const metadata = { - name: "SpaceBooking", - description: _package.description, - installed: true, - category: "other", - // If using static next public folder, can then be referenced from the base URL (/). - imageSrc: "/api/app-store/spacebooking/spacebooking.webp", - logo: "/api/app-store/spacebooking/spacebooking.webp", - publisher: "Cal.com", - rating: 0, - reviews: 0, - slug: "space-booking", - title: "SpaceBooking", - trending: true, - type: "spacebooking_other", - url: "https://cal.com/apps/spacebooking", - variant: "other", - verified: true, - email: "help@cal.com", -} as App; - -export default metadata; diff --git a/packages/app-store/spacebooking/api/add.ts b/packages/app-store/spacebooking/api/add.ts deleted file mode 100644 index d185f6248b..0000000000 --- a/packages/app-store/spacebooking/api/add.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { NextApiRequest, NextApiResponse } from "next"; - -import prisma from "@calcom/prisma"; - -/** - * @param req - * @param res - */ -export default async function handler(req: NextApiRequest, res: NextApiResponse) { - if (!req.session?.user?.id) { - return res.status(401).json({ message: "You must be logged in to do this" }); - } - const appType = "spacebooking_other"; - try { - const alreadyInstalled = await prisma.credential.findFirst({ - where: { - type: appType, - userId: req.session.user.id, - }, - }); - if (alreadyInstalled) { - throw new Error("Already installed"); - } - const installation = await prisma.credential.create({ - data: { - type: appType, - key: {}, - userId: req.session.user.id, - appId: "space-booking", - }, - }); - if (!installation) { - throw new Error("Unable to create user credential for spacebooking"); - } - } catch (error: unknown) { - if (error instanceof Error) { - return res.status(500).json({ message: error.message }); - } - return res.status(500); - } - - return res.status(200).json({ url: "/apps/installed" }); -} diff --git a/packages/app-store/spacebooking/api/index.ts b/packages/app-store/spacebooking/api/index.ts deleted file mode 100644 index 4c0d2ead01..0000000000 --- a/packages/app-store/spacebooking/api/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as add } from "./add"; diff --git a/packages/app-store/spacebooking/components/FullScreenDialog.tsx b/packages/app-store/spacebooking/components/FullScreenDialog.tsx deleted file mode 100644 index 1229abe75b..0000000000 --- a/packages/app-store/spacebooking/components/FullScreenDialog.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { XIcon } from "@heroicons/react/solid"; -import { useState } from "react"; - -import { Dialog, DialogContent } from "@calcom/ui/Dialog"; - -const FullScreenDialog = (props: React.PropsWithChildren<{ open: boolean }>) => { - const [open, setOpen] = useState(props.open); - return ( - <> - setOpen(false)}> - -
setOpen(false)} - style={{ - position: "absolute", - top: 16, - right: 16, - zIndex: "inherit", - }}> - -
- {props.children} -
-
- - ); -}; - -export { FullScreenDialog }; diff --git a/packages/app-store/spacebooking/components/InstallAppButton.tsx b/packages/app-store/spacebooking/components/InstallAppButton.tsx deleted file mode 100644 index bb535357bd..0000000000 --- a/packages/app-store/spacebooking/components/InstallAppButton.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import useAddAppMutation from "../../_utils/useAddAppMutation"; -import { InstallAppButtonProps } from "../../types"; - -export default function InstallAppButton(props: InstallAppButtonProps) { - const mutation = useAddAppMutation("spacebooking_other"); - - return ( - <> - {props.render({ - onClick() { - mutation.mutate(""); - }, - loading: mutation.isLoading, - })} - - ); -} diff --git a/packages/app-store/spacebooking/components/SpaceBookingSuccessPage.tsx b/packages/app-store/spacebooking/components/SpaceBookingSuccessPage.tsx deleted file mode 100644 index 5fc8b77b92..0000000000 --- a/packages/app-store/spacebooking/components/SpaceBookingSuccessPage.tsx +++ /dev/null @@ -1,230 +0,0 @@ -import { useEffect } from "react"; - -import { FullScreenDialog } from "./FullScreenDialog"; - -const SpaceBookingSuccessPage = (props: { what: string; where: string; when: string; open: boolean }) => { - const { what, where, when, open } = props; - - useEffect(() => { - const canvas = document.getElementById("canvas") as HTMLCanvasElement; - const c = canvas.getContext("2d") as CanvasRenderingContext2D; - - let w: number; - let h: number; - - const setCanvasExtents = () => { - w = document.body.clientWidth; - h = document.body.clientHeight; - canvas.width = Math.min(1600, w); - canvas.height = Math.min(900, h); - }; - - setCanvasExtents(); - - const crawl = document.getElementById("crawl") as HTMLDivElement; - const crawlContent = document.getElementById("crawl-content") as HTMLDivElement; - const crawlContentStyle = crawlContent.style; - - // start crawl at bottom of 3d plane - let crawlPos = crawl.clientHeight; - - const makeStars = (count: number) => { - const out = []; - for (let i = 0; i < count; i++) { - const s = { - x: Math.random() * 1600 - 800, - y: Math.random() * 900 - 450, - z: Math.random() * 1000, - }; - out.push(s); - } - return out; - }; - - let stars = makeStars(2000); - - window.onresize = () => { - setCanvasExtents(); - }; - - const clear = () => { - c.fillStyle = "black"; - c.fillRect(0, 0, canvas.width, canvas.height); - }; - - const putPixel = (x: number, y: number, brightness: number) => { - const intensity = brightness * 255; - const rgb = "rgb(" + intensity + "," + intensity + "," + intensity + ")"; - c.fillStyle = rgb; - c.fillRect(x, y, 1, 1); - }; - - const moveStars = (distance: number) => { - const count = stars.length; - for (var i = 0; i < count; i++) { - const s = stars[i]; - s.z -= distance; - if (s.z <= 1) { - s.z += 999; - } - } - }; - - const moveCrawl = (distance: number) => { - crawlPos -= distance; - crawlContentStyle.top = crawlPos + "px"; - - // if we've scrolled all content past the top edge - // of the plane, reposition content at bottom of plane - if (crawlPos < -crawlContent.clientHeight) { - crawlPos = crawl.clientHeight; - } - }; - - const paintStars = () => { - const cx = canvas.width / 2; - const cy = canvas.height / 2; - - const count = stars.length; - for (var i = 0; i < count; i++) { - const star = stars[i]; - - const x = cx + star.x / (star.z * 0.001); - const y = cy + star.y / (star.z * 0.001); - - if (x < 0 || x >= w || y < 0 || y >= h) { - continue; - } - - const d = star.z / 1000.0; - const b = 1 - d * d; - - putPixel(x, y, b); - } - }; - - let prevTime: number; - const init = (time: number) => { - prevTime = time; - requestAnimationFrame(tick); - }; - - const tick = (time: number) => { - let elapsed = time - prevTime; - prevTime = time; - - moveStars(elapsed * 0.02); - - // time-scale of crawl, increase factor to go faster - moveCrawl(elapsed * 0.06); - - clear(); - paintStars(); - - requestAnimationFrame(tick); - }; - - requestAnimationFrame(init); - }, []); - - const episodeDetails = [ - { number: "IV", name: "A new hope" }, - { number: "V", name: "The Empire" }, - { number: "VI", name: "Return of the Jedi" }, - { number: "I", name: "The Phantom menace" }, - { number: "II", name: "Attack of the Clones" }, - { number: "III", name: "Revenge of the Sith" }, - ]; - const randomEpisodeNumber = episodeDetails[Math.floor(Math.random() * episodeDetails.length)]; - - const css = ` - #crawl-container { - perspective: calc(100vh * 0.4); - } - #crawl { - color: #f5c91c; - position: absolute; - width: 110%; - left: -5%; - bottom: -5%; - height: 200%; - overflow: hidden; - - transform: rotate3d(1, 0, 0, 45deg); - transform-origin: 50% 100%; - - mask-image: linear-gradient( - rgba(0, 0, 0, 0), - rgba(0, 0, 0, 0.66), - rgba(0, 0, 0, 1) - ); - - -webkit-mask-image: -webkit-linear-gradient( - rgba(0, 0, 0, 0), - rgba(0, 0, 0, 0.66), - rgba(0, 0, 0, 1) - ); - } - - #crawl-content { - font-family: "Roboto"; - font-size: calc(100vw * 0.074); - letter-spacing: 0.09em; - position: absolute; - top: 0px; - left: 0px; - right: 0px; - } - - #crawl p { - text-align: justify; - width: 100%; - margin: 0 0 1.25em 0; - line-height: 1.25em; - } - - #crawl h1 { - font-size: 1em; - margin: 0 0 0.3em 0; - } - - #crawl h2 { - font-size: 1.5em; - margin: 0 0 0.7em 0; - } - - #crawl h1, - #crawl h2 { - text-align: center; - } -`; - - return ( - <> - - -
-
-
-

Episode {randomEpisodeNumber.number}

-

{randomEpisodeNumber.name}

-

{what}

-

- {when} -
-

-

{where}

-
-
-
- -
- - ); -}; - -export default SpaceBookingSuccessPage; diff --git a/packages/app-store/spacebooking/components/index.ts b/packages/app-store/spacebooking/components/index.ts deleted file mode 100644 index 40e82ee54e..0000000000 --- a/packages/app-store/spacebooking/components/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import dynamic from "next/dynamic"; - -export { default as InstallAppButton } from "./InstallAppButton"; -/** These are like 12kb that not every user needs */ -export const SpaceBookingSuccessPage = dynamic(() => import("./SpaceBookingSuccessPage")); diff --git a/packages/app-store/spacebooking/index.ts b/packages/app-store/spacebooking/index.ts deleted file mode 100644 index db3c2b10b2..0000000000 --- a/packages/app-store/spacebooking/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * as api from "./api"; -export * as components from "./components"; -export * as lib from "./lib"; -export { metadata } from "./_metadata"; diff --git a/packages/app-store/spacebooking/lib/index.ts b/packages/app-store/spacebooking/lib/index.ts deleted file mode 100644 index cb0ff5c3b5..0000000000 --- a/packages/app-store/spacebooking/lib/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/app-store/spacebooking/package.json b/packages/app-store/spacebooking/package.json deleted file mode 100644 index c299e2d79b..0000000000 --- a/packages/app-store/spacebooking/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/package.json", - "private": true, - "name": "@calcom/spacebooking", - "version": "0.1.0", - "main": "./index.ts", - "description": "Looking to honor May 4th? Search no further. Install this app to make your booking success page resemble a long time ago in a galaxy far far away.", - "dependencies": {}, - "devDependencies": { - "@calcom/types": "*" - } -} diff --git a/packages/app-store/spacebooking/static/spacebooking.webp b/packages/app-store/spacebooking/static/spacebooking.webp deleted file mode 100644 index 3da82b8310..0000000000 Binary files a/packages/app-store/spacebooking/static/spacebooking.webp and /dev/null differ diff --git a/packages/prisma/seed-app-store.ts b/packages/prisma/seed-app-store.ts index a727922963..be106bcc89 100644 --- a/packages/prisma/seed-app-store.ts +++ b/packages/prisma/seed-app-store.ts @@ -93,7 +93,7 @@ async function main() { api_key: process.env.GIPHY_API_KEY, }); } - await createApp("space-booking", "spacebooking", ["other"], "spacebooking_other"); + if (process.env.VITAL_API_KEY && process.env.VITAL_WEBHOOK_SECRET) { await createApp("vital-automation", "vital", ["other"], "vital_other", { mode: process.env.VITAL_DEVELOPMENT_MODE || "sandbox",