feat: atoms as npm package (#14160)

* fix: getEnv not returning fallback API_URL breaking examples app

* refactor: use vite as the only way to build atoms

* refactor: web use atoms from web.ts and rest from dist

* refactor: update atoms version, description and set privacy to public

* fix: lib and ui import from web atoms

* refactor: rename @calcom/platform-atoms to @calcom/atoms

* feat: atoms as npm works with example app outside monorepo

* start atoms from v1.0.0

* refactor: monorepo atoms for internal use

* document atoms publishing

* refactor: remove unused import in v2

* fix: mistakes made during main merge

* refactor: move back examples app while still having it in atoms-examples repo

* refactor: monorepo examples readme

* feat: atoms yarn publish command

* refactor: atoms css file simplify

* fix: mocking atoms in ui unit test

* fix: mocking atoms in app-store unit test
This commit is contained in:
Lauris Skraucis authored and GitHub committed 2024-03-21 14:33:10 -03:00
1 parent 61a8543e08
commit 74e5f4bf37
34 files changed
+234 -183

No files matched your search

+2 -2
View File
@@ -17,8 +17,8 @@ export type Environment = {
export const getEnv = <K extends keyof Environment>(key: K, fallback?: Environment[K]): Environment[K] => {
const value = process.env[key] as Environment[K] | undefined;
if (typeof value === "undefined") {
if (typeof fallback !== "undefined") {
if (!value) {
if (fallback) {
return fallback;
}
throw new Error(`Missing environment variable: ${key}.`);
@@ -22,7 +22,6 @@ import {
Delete,
} from "@nestjs/common";
import { User } from "@prisma/client";
import * as crypto from "crypto";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
import { ApiResponse } from "@calcom/platform-types";
+119 -30
View File
@@ -213,7 +213,9 @@
}
}
},
"tags": ["Development only"]
"tags": [
"Development only"
]
},
"get": {
"operationId": "OAuthClientsController_getOAuthClients",
@@ -232,7 +234,9 @@
}
}
},
"tags": ["Development only"]
"tags": [
"Development only"
]
}
},
"/api/v2/oauth-clients/{clientId}": {
@@ -262,7 +266,9 @@
}
}
},
"tags": ["Development only"]
"tags": [
"Development only"
]
},
"patch": {
"operationId": "OAuthClientsController_updateOAuthClient",
@@ -300,7 +306,9 @@
}
}
},
"tags": ["Development only"]
"tags": [
"Development only"
]
},
"delete": {
"operationId": "OAuthClientsController_deleteOAuthClient",
@@ -328,7 +336,9 @@
}
}
},
"tags": ["Development only"]
"tags": [
"Development only"
]
}
},
"/api/v2/oauth/{clientId}/authorize": {
@@ -364,7 +374,9 @@
"description": "Bad request if the OAuth client is not found, if the redirect URI is invalid, or if the user has already authorized the client."
}
},
"tags": ["Development only"]
"tags": [
"Development only"
]
}
},
"/api/v2/oauth/{clientId}/exchange": {
@@ -415,7 +427,9 @@
"description": "Bad request if the authorization code is missing, invalid, or if the client ID and secret do not match."
}
},
"tags": ["Development only"]
"tags": [
"Development only"
]
}
},
"/api/v2/oauth/{clientId}/refresh": {
@@ -461,7 +475,9 @@
}
}
},
"tags": ["Development only"]
"tags": [
"Development only"
]
}
},
"/api/v2/event-types": {
@@ -1059,6 +1075,9 @@
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"timeFormat": {
"type": "number"
},
@@ -1072,7 +1091,9 @@
"type": "string"
}
},
"required": ["email"]
"required": [
"email"
]
},
"UpdateUserInput": {
"type": "object",
@@ -1080,6 +1101,9 @@
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"timeFormat": {
"type": "number"
},
@@ -1110,7 +1134,10 @@
"example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoib2F1dGgtY2xpZW50Iiwi"
}
},
"required": ["clientId", "clientSecret"]
"required": [
"clientId",
"clientSecret"
]
},
"CreateOAuthClientResponseDto": {
"type": "object",
@@ -1118,7 +1145,10 @@
"status": {
"type": "string",
"example": "success",
"enum": ["success", "error"]
"enum": [
"success",
"error"
]
},
"data": {
"example": {
@@ -1132,7 +1162,10 @@
]
}
},
"required": ["status", "data"]
"required": [
"status",
"data"
]
},
"PlatformOAuthClientDto": {
"type": "object",
@@ -1158,7 +1191,9 @@
"example": "https://example.com/logo.png"
},
"redirectUris": {
"example": ["https://example.com/callback"],
"example": [
"https://example.com/callback"
],
"type": "array",
"items": {
"type": "string"
@@ -1171,10 +1206,18 @@
"createdAt": {
"format": "date-time",
"type": "string",
"example": "2024-03-08T14:10:38.418Z"
"example": "2024-03-21T16:58:29.130Z"
}
},
"required": ["id", "name", "secret", "permissions", "redirectUris", "organizationId", "createdAt"]
"required": [
"id",
"name",
"secret",
"permissions",
"redirectUris",
"organizationId",
"createdAt"
]
},
"GetOAuthClientsResponseDto": {
"type": "object",
@@ -1182,7 +1225,10 @@
"status": {
"type": "string",
"example": "success",
"enum": ["success", "error"]
"enum": [
"success",
"error"
]
},
"data": {
"type": "array",
@@ -1191,7 +1237,10 @@
}
}
},
"required": ["status", "data"]
"required": [
"status",
"data"
]
},
"GetOAuthClientResponseDto": {
"type": "object",
@@ -1199,13 +1248,19 @@
"status": {
"type": "string",
"example": "success",
"enum": ["success", "error"]
"enum": [
"success",
"error"
]
},
"data": {
"$ref": "#/components/schemas/PlatformOAuthClientDto"
}
},
"required": ["status", "data"]
"required": [
"status",
"data"
]
},
"UpdateOAuthClientInput": {
"type": "object",
@@ -1232,7 +1287,9 @@
"type": "string"
}
},
"required": ["redirectUri"]
"required": [
"redirectUri"
]
},
"ExchangeAuthorizationCodeInput": {
"type": "object",
@@ -1241,7 +1298,9 @@
"type": "string"
}
},
"required": ["clientSecret"]
"required": [
"clientSecret"
]
},
"KeysDto": {
"type": "object",
@@ -1255,7 +1314,10 @@
"example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
},
"required": ["accessToken", "refreshToken"]
"required": [
"accessToken",
"refreshToken"
]
},
"KeysResponseDto": {
"type": "object",
@@ -1263,13 +1325,19 @@
"status": {
"type": "string",
"example": "success",
"enum": ["success", "error"]
"enum": [
"success",
"error"
]
},
"data": {
"$ref": "#/components/schemas/KeysDto"
}
},
"required": ["status", "data"]
"required": [
"status",
"data"
]
},
"RefreshTokenInput": {
"type": "object",
@@ -1278,7 +1346,9 @@
"type": "string"
}
},
"required": ["refreshToken"]
"required": [
"refreshToken"
]
},
"CreateEventTypeInput": {
"type": "object",
@@ -1294,7 +1364,11 @@
"type": "string"
}
},
"required": ["length", "slug", "title"]
"required": [
"length",
"slug",
"title"
]
},
"CreateAvailabilityInput": {
"type": "object",
@@ -1314,7 +1388,11 @@
"type": "string"
}
},
"required": ["days", "startTime", "endTime"]
"required": [
"days",
"startTime",
"endTime"
]
},
"CreateScheduleInput": {
"type": "object",
@@ -1336,7 +1414,11 @@
"default": true
}
},
"required": ["name", "timeZone", "isDefault"]
"required": [
"name",
"timeZone",
"isDefault"
]
},
"UpdateScheduleInput": {
"type": "object",
@@ -1392,7 +1474,14 @@
"type": "string"
}
},
"required": ["start", "eventTypeId", "timeZone", "language", "metadata", "hashedLink"]
"required": [
"start",
"eventTypeId",
"timeZone",
"language",
"metadata",
"hashedLink"
]
},
"ReserveSlotInput": {
"type": "object",
@@ -1400,4 +1489,4 @@
}
}
}
}
}
@@ -2,9 +2,9 @@
import { useSearchParams } from "next/navigation";
import { Booker } from "@calcom/atoms/monorepo";
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
import { BookerSeo } from "@calcom/features/bookings/components/BookerSeo";
import { Booker } from "@calcom/platform-atoms";
import { type PageProps } from "./users-type-public-view.getServerSideProps";
+1 -1
View File
@@ -1,4 +1,4 @@
import { AvailabilitySettings } from "@calcom/platform-atoms";
import { AvailabilitySettings } from "@calcom/atoms/monorepo";
import PageWrapper from "@components/PageWrapper";
+1 -1
View File
@@ -1,8 +1,8 @@
"use client";
import { Booker } from "@calcom/atoms/monorepo";
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
import { BookerSeo } from "@calcom/features/bookings/components/BookerSeo";
import { Booker } from "@calcom/platform-atoms";
import { getServerSideProps, type PageProps } from "@lib/d/[link]/[slug]/getServerSideProps";
@@ -1,13 +1,13 @@
import type { GetServerSidePropsContext } from "next";
import { z } from "zod";
import { Booker } from "@calcom/atoms/monorepo";
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
import { BookerSeo } from "@calcom/features/bookings/components/BookerSeo";
import { getMultipleDurationValue } from "@calcom/features/bookings/lib/get-booking";
import { getSlugOrRequestedSlug } from "@calcom/features/ee/organizations/lib/orgDomains";
import { orgDomainConfig } from "@calcom/features/ee/organizations/lib/orgDomains";
import slugify from "@calcom/lib/slugify";
import { Booker } from "@calcom/platform-atoms";
import prisma from "@calcom/prisma";
import type { inferSSRProps } from "@lib/types/inferSSRProps";
+1 -1
View File
@@ -2,9 +2,9 @@
import { useSearchParams } from "next/navigation";
import { Booker } from "@calcom/atoms/monorepo";
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
import { BookerSeo } from "@calcom/features/bookings/components/BookerSeo";
import { Booker } from "@calcom/platform-atoms";
import { getServerSideProps } from "@lib/team/[slug]/[type]/getServerSideProps";
import type { inferSSRProps } from "@lib/types/inferSSRProps";