Scheduling infrastructure for absolutely everyone.
fix: atoms icons and build issues (#16248)
Morgan27e421069391
diff --git a/.github/workflows/all-checks.yml b/.github/workflows/all-checks.ymlindex 5c7e98be814..8d033f754c6 100644--- a/.github/workflows/all-checks.yml+++ b/.github/workflows/all-checks.yml@@ -34,6 +34,11 @@ jobs:uses: ./.github/workflows/api-v2-production-build.ymlsecrets: inherit+ build-atoms:+ name: Production builds+ uses: ./.github/workflows/atoms-production-build.yml+ secrets: inherit+build:name: Production buildsuses: ./.github/workflows/production-build-without-database.ymldiff --git a/.github/workflows/atoms-production-build.yml b/.github/workflows/atoms-production-build.ymlnew file mode 100644index 00000000000..bf56083ad96--- /dev/null+++ b/.github/workflows/atoms-production-build.yml@@ -0,0 +1,40 @@+name: Atoms production Build++on:+ workflow_call:++jobs:+ build:+ name: Build atoms+ permissions:+ contents: read+ runs-on: buildjet-4vcpu-ubuntu-2204+ timeout-minutes: 30+ steps:+ - uses: actions/checkout@v4+ - uses: ./.github/actions/dangerous-git-checkout+ - uses: ./.github/actions/yarn-install+ - name: Cache atoms production build+ uses: buildjet/cache@v4+ id: cache-atoms-build+ env:+ cache-name: atoms-build+ key-1: ${{ hashFiles('yarn.lock') }}+ key-2: ${{ hashFiles('packages/platform/atoms/**.[jt]s', 'packages/platform/atoms/**.[jt]sx', '!**/node_modules') }}+ key-3: ${{ github.event.pull_request.number || github.ref }}+ # Ensures production-build.yml will always be fresh+ key-4: ${{ github.sha }}+ with:+ path: |+ **/dist/**+ key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }}-${{ env.key-4 }}+ - run: |+ export NODE_OPTIONS="--max_old_space_size=8192"+ if [ ${{ steps.cache-atoms-build.outputs.cache-hit }} == 'true' ]; then+ echo "Cache hit for atoms build. Skipping build."+ else+ rm -rf packages/platform/atoms/node_modules+ yarn install+ yarn workspace @calcom/atoms run build+ fi+ shell: bashdiff --git a/.github/workflows/pr.yml b/.github/workflows/pr.ymlindex eb2998c2fa8..0dff38fd34f 100644--- a/.github/workflows/pr.yml+++ b/.github/workflows/pr.yml@@ -131,6 +131,13 @@ jobs:if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}uses: ./.github/workflows/api-v2-production-build.ymlsecrets: inherit++ build-atoms:+ name: Production builds+ needs: [changes, check-label, deps]+ if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}+ uses: ./.github/workflows/atoms-production-build.yml+ secrets: inheritbuild:name: Production buildsdiff --git a/apps/api/v2/package.json b/apps/api/v2/package.jsonindex 95d521e2fdc..ab4ab77b9d8 100644--- a/apps/api/v2/package.json+++ b/apps/api/v2/package.json@@ -10,7 +10,7 @@"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"","start": "nest start","dev:build:watch": "yarn workspace @calcom/platform-constants build:watch & yarn workspace @calcom/platform-utils build:watch & yarn workspace @calcom/platform-types build:watch",- "dev:build": "yarn workspace @calcom/platform-constants build && yarn workspace @calcom/platform-utils build && yarn workspace @calcom/platform-types build",+ "dev:build": "yarn workspace @calcom/platform-constants build && yarn workspace @calcom/platform-utils build && yarn workspace @calcom/platform-types build && yarn workspace @calcom/platform-enums build","dev": "yarn dev:build && docker-compose up -d && yarn copy-swagger-module && yarn start --watch","start:debug": "nest start --debug --watch","start:prod": "node ./dist/apps/api/v2/src/main.js",@@ -25,6 +25,7 @@},"dependencies": {"@calcom/platform-constants": "*",+ "@calcom/platform-enums": "*","@calcom/platform-libraries": "npm:@calcom/[email protected]","@calcom/platform-libraries-0.0.2": "npm:@calcom/[email protected]","@calcom/platform-types": "*",diff --git a/apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts b/apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.tsindex e84c339c69b..af4377bf6cb 100644--- a/apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts+++ b/apps/api/v2/src/ee/event-types/event-types_2024_06_14/controllers/event-types.controller.e2e-spec.ts@@ -20,13 +20,13 @@ import { UserRepositoryFixture } from "test/fixtures/repository/users.repositoryimport { withApiAuth } from "test/utils/withApiAuth";import { CAL_API_VERSION_HEADER, SUCCESS_STATUS, VERSION_2024_06_14 } from "@calcom/platform-constants";+import { BookingWindowPeriodInputTypeEnum_2024_06_14 } from "@calcom/platform-enums";import {ApiSuccessResponse,CreateEventTypeInput_2024_06_14,EventTypeOutput_2024_06_14,UpdateEventTypeInput_2024_06_14,} from "@calcom/platform-types";-import { BookingWindowPeriodInputTypeEnum_2024_06_14 } from "@calcom/platform-types/dist/event-types/event-types_2024_06_14/inputs/enums/booking-window.enum";import { SchedulingType } from "@calcom/prisma/enums";describe("Event types Endpoints", () => {diff --git a/apps/api/v2/src/modules/organizations/controllers/event-types/organizations-event-types.e2e-spec.ts b/apps/api/v2/src/modules/organizations/controllers/event-types/organizations-event-types.e2e-spec.tsindex 7e24699cdea..a95e32cc20d 100644--- a/apps/api/v2/src/modules/organizations/controllers/event-types/organizations-event-types.e2e-spec.ts+++ b/apps/api/v2/src/modules/organizations/controllers/event-types/organizations-event-types.e2e-spec.ts@@ -17,6 +17,7 @@ import { UserRepositoryFixture } from "test/fixtures/repository/users.repositoryimport { withApiAuth } from "test/utils/withApiAuth";import { SUCCESS_STATUS } from "@calcom/platform-constants";+import { BookingWindowPeriodInputTypeEnum_2024_06_14 } from "@calcom/platform-enums";import {ApiSuccessResponse,CreateTeamEventTypeInput_2024_06_14,@@ -24,7 +25,6 @@ import {TeamEventTypeOutput_2024_06_14,UpdateTeamEventTypeInput_2024_06_14,} from "@calcom/platform-types";-import { BookingWindowPeriodInputTypeEnum_2024_06_14 } from "@calcom/platform-types/event-types/event-types_2024_06_14/inputs/enums/booking-window.enum";import { Team } from "@calcom/prisma/client";describe("Organizations Event Types Endpoints", () => {diff --git a/apps/api/v2/src/modules/organizations/services/event-types/input.service.ts b/apps/api/v2/src/modules/organizations/services/event-types/input.service.tsindex f421a9dd6d7..0e8c084fefe 100644--- a/apps/api/v2/src/modules/organizations/services/event-types/input.service.ts+++ b/apps/api/v2/src/modules/organizations/services/event-types/input.service.ts@@ -8,8 +8,8 @@ import {CreateTeamEventTypeInput_2024_06_14,UpdateTeamEventTypeInput_2024_06_14,HostPriority,- SchedulingType,} from "@calcom/platform-types";+import { SchedulingType } from "@calcom/prisma/client";@Injectable()export class InputOrganizationsEventTypesService {diff --git a/apps/api/v2/swagger/documentation.json b/apps/api/v2/swagger/documentation.jsonindex fb0e0039618..54a00de6dbe 100644--- a/apps/api/v2/swagger/documentation.json+++ b/apps/api/v2/swagger/documentation.json@@ -4955,6 +4955,9 @@"items": {"$ref": "#/components/schemas/Source"}+ },+ "disableOnPrefill": {+ "type": "boolean"}},"required": [@@ -5529,6 +5532,9 @@"items": {"$ref": "#/components/schemas/Source"}+ },+ "disableOnPrefill": {+ "type": "boolean"}},"required": [diff --git a/apps/web/package.json b/apps/web/package.jsonindex 80dd202e134..f2b371cea61 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -36,6 +36,7 @@"@calcom/embed-snippet": "workspace:*","@calcom/features": "*","@calcom/lib": "*",+ "@calcom/platform-enums": "*","@calcom/platform-types": "*","@calcom/prisma": "*","@calcom/trpc": "*",diff --git a/apps/web/public/icons/sprite.svg b/apps/web/public/icons/sprite.svgindex e50f98860f1..5d0c578415f 100644--- a/apps/web/public/icons/sprite.svg+++ b/apps/web/public/icons/sprite.svg@@ -92,6 +92,18 @@<path d="M3 10h18" ></path><path d="m16 20 2 2 4-4" ></path></symbol>+<symbol class="lucide lucide-calendar-days" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="calendar-days">+ <path d="M8 2v4" ></path>+ <path d="M16 2v4" ></path>+ <rect width="18" height="18" x="3" y="4" rx="2" ></rect>+ <path d="M3 10h18" ></path>+ <path d="M8 14h.01" ></path>+ <path d="M12 14h.01" ></path>+ <path d="M16 14h.01" ></path>+ <path d="M8 18h.01" ></path>+ <path d="M12 18h.01" ></path>+ <path d="M16 18h.01" ></path>+</symbol><symbol class="lucide lucide-calendar-heart" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="calendar-heart"><path d="M3 10h18V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7" ></path><path d="M8 2v4" ></path>diff --git a/packages/lib/event-types/transformers/api-request.ts b/packages/lib/event-types/transformers/api-request.tsindex da5a3cdf978..2e29c976f79 100644--- a/packages/lib/event-types/transformers/api-request.ts+++ b/packages/lib/event-types/transformers/api-request.ts@@ -1,21 +1,19 @@import { z } from "zod";-import type {- BookingLimitsKeyOutputType_2024_06_14,- TransformBookingLimitsSchema_2024_06_14,-} from "@calcom/platform-types";+import {+ BookingWindowPeriodInputTypeEnum_2024_06_14,+ BookingWindowPeriodOutputTypeEnum_2024_06_14,+ BookingLimitsEnum_2024_06_14,+} from "@calcom/platform-enums/monorepo";import {type CreateEventTypeInput_2024_06_14,type Integration_2024_06_14,type BusinessDaysWindow_2024_06_14,type RangeWindow_2024_06_14,type TransformFutureBookingsLimitSchema_2024_06_14,+ type BookingLimitsKeyOutputType_2024_06_14,+ type TransformBookingLimitsSchema_2024_06_14,} from "@calcom/platform-types";-import {- BookingWindowPeriodInputTypeEnum_2024_06_14,- BookingWindowPeriodOutputTypeEnum_2024_06_14,-} from "@calcom/platform-types/event-types/event-types_2024_06_14/inputs/enums/booking-window.enum";-import { BookingLimitsEnum_2024_06_14 } from "@calcom/platform-types/event-types/event-types_2024_06_14/inputs/enums/interval-limits.enum";const integrationsMapping: Record<Integration_2024_06_14, string> = {"cal-video": "integrations:daily",diff --git a/packages/lib/event-types/transformers/api-response.ts b/packages/lib/event-types/transformers/api-response.tsindex 69d6e10d5ec..46d402cb190 100644--- a/packages/lib/event-types/transformers/api-response.ts+++ b/packages/lib/event-types/transformers/api-response.ts@@ -1,3 +1,8 @@+import {+ BookingWindowPeriodInputTypeEnum_2024_06_14,+ BookingWindowPeriodOutputTypeEnum_2024_06_14,+ BookingLimitsEnum_2024_06_14,+} from "@calcom/platform-enums/monorepo";import type {AddressLocation_2024_06_14,IntegrationLocation_2024_06_14,@@ -13,11 +18,6 @@ import type {BusinessDaysWindow_2024_06_14,BookingField_2024_06_14,} from "@calcom/platform-types";-import {- BookingWindowPeriodInputTypeEnum_2024_06_14,- BookingWindowPeriodOutputTypeEnum_2024_06_14,-} from "@calcom/platform-types/event-types/event-types_2024_06_14/inputs/enums/booking-window.enum";-import { BookingLimitsEnum_2024_06_14 } from "@calcom/platform-types/event-types/event-types_2024_06_14/inputs/enums/interval-limits.enum";import type { transformApiEventTypeBookingFields, transformApiEventTypeLocations } from "./api-request";diff --git a/packages/platform/atoms/connect/apple/AppleConnect.tsx b/packages/platform/atoms/connect/apple/AppleConnect.tsxindex 83e655f58ab..128cd970996 100644--- a/packages/platform/atoms/connect/apple/AppleConnect.tsx+++ b/packages/platform/atoms/connect/apple/AppleConnect.tsx@@ -76,7 +76,7 @@ export const AppleConnect: FC<Partial<Omit<OAuthConnectProps, "redir">>> = ({<Dialog open={isDialogOpen}><DialogTrigger><Button- StartIcon="calendar-days"+ StartIcon="calendar"color="primary"disabled={isDisabled}className={cn("", className, isDisabled && "cursor-not-allowed", !isDisabled && "cursor-pointer")}diff --git a/packages/platform/atoms/package.json b/packages/platform/atoms/package.jsonindex 9958e91fc1c..636d67efa82 100644--- a/packages/platform/atoms/package.json+++ b/packages/platform/atoms/package.json@@ -31,7 +31,8 @@"typescript": "^4.9.4","vite": "^5.0.10","vite-plugin-dts": "^3.7.3",- "vite-plugin-inspect": "^0.8.4"+ "vite-plugin-inspect": "^0.8.4",+ "vite-plugin-node-polyfills": "^0.22.0"},"files": ["dist",diff --git a/packages/platform/atoms/vite.config.ts b/packages/platform/atoms/vite.config.tsindex efc4d68a7c9..8e4e2013a59 100644--- a/packages/platform/atoms/vite.config.ts+++ b/packages/platform/atoms/vite.config.ts@@ -1,59 +1,66 @@import react from "@vitejs/plugin-react-swc";import path from "path";import { resolve } from "path";-import { defineConfig } from "vite";+import { defineConfig, loadEnv } from "vite";import dts from "vite-plugin-dts";import Inspect from "vite-plugin-inspect";-export default defineConfig({- optimizeDeps: {- include: [- "@calcom/lib",- "@calcom/features",- "@calcom/prisma",- "@calcom/dayjs",- "@calcom/platform-constants",- "@calcom/platform-types",- "@calcom/platform-utils",- ],- },- plugins: [Inspect(), react(), dts({ insertTypesEntry: true })],- build: {- commonjsOptions: {- include: [/@calcom\/lib/, /@calcom\/features/, /node_modules/],+export default defineConfig(({ mode }) => {+ const env = loadEnv(mode, process.cwd(), ""); // .env inside of packages/platform/atoms+ const webAppUrl = env.NEXT_PUBLIC_WEBAPP_URL ?? "https://app.cal.com";+ return {+ optimizeDeps: {+ include: [+ "@calcom/lib",+ "@calcom/features",+ "@calcom/prisma",+ "@calcom/dayjs",+ "@calcom/platform-constants",+ "@calcom/platform-types",+ "@calcom/platform-utils",+ ],},- lib: {- entry: [resolve(__dirname, "index.ts")],- name: "CalAtoms",- fileName: "cal-atoms",+ plugins: [Inspect(), react(), dts({ insertTypesEntry: true })],+ define: {+ "process.env.NEXT_PUBLIC_WEBAPP_URL": `"${webAppUrl}"`,},- rollupOptions: {- external: ["react", "fs", "path", "os", "react-dom"],- output: {- globals: {- react: "React",- "react-dom": "ReactDOM",+ build: {+ commonjsOptions: {+ include: [/@calcom\/lib/, /@calcom\/features/, /node_modules/],+ },+ lib: {+ entry: [resolve(__dirname, "index.ts")],+ name: "CalAtoms",+ fileName: "cal-atoms",+ },+ rollupOptions: {+ external: ["react", "fs", "path", "os", "react-dom"],+ output: {+ globals: {+ react: "React",+ "react-dom": "ReactDOM",+ },},},},- },- resolve: {- alias: {- fs: resolve("../../../node_modules/rollup-plugin-node-builtins"),- path: resolve("../../../node_modules/rollup-plugin-node-builtins"),- os: resolve("../../../node_modules/rollup-plugin-node-builtins"),- "@": path.resolve(__dirname, "./src"),- ".prisma/client": path.resolve(__dirname, "../../prisma-client"),- "@prisma/client": path.resolve(__dirname, "../../prisma-client"),- "@calcom/prisma": path.resolve(__dirname, "../../prisma"),- "@calcom/dayjs": path.resolve(__dirname, "../../dayjs"),- "@calcom/platform-constants": path.resolve(__dirname, "../constants/index.ts"),- "@calcom/platform-types": path.resolve(__dirname, "../types/index.ts"),- "@calcom/platform-utils": path.resolve(__dirname, "../constants/index.ts"),- "@calcom/web/public/static/locales/en/common.json": path.resolve(- __dirname,- "../../../apps/web/public/static/locales/en/common.json"- ),+ resolve: {+ alias: {+ fs: resolve("../../../node_modules/rollup-plugin-node-builtins"),+ path: resolve("../../../node_modules/rollup-plugin-node-builtins"),+ os: resolve("../../../node_modules/rollup-plugin-node-builtins"),+ "@": path.resolve(__dirname, "./src"),+ ".prisma/client": path.resolve(__dirname, "../../prisma-client"),+ "@prisma/client": path.resolve(__dirname, "../../prisma-client"),+ "@calcom/prisma": path.resolve(__dirname, "../../prisma"),+ "@calcom/dayjs": path.resolve(__dirname, "../../dayjs"),+ "@calcom/platform-constants": path.resolve(__dirname, "../constants/index.ts"),+ "@calcom/platform-types": path.resolve(__dirname, "../types/index.ts"),+ "@calcom/platform-utils": path.resolve(__dirname, "../constants/index.ts"),+ "@calcom/web/public/static/locales/en/common.json": path.resolve(+ __dirname,+ "../../../apps/web/public/static/locales/en/common.json"+ ),+ },},- },+ };});diff --git a/packages/platform/enums/README.md b/packages/platform/enums/README.mdnew file mode 100644index 00000000000..f68cfe193b6--- /dev/null+++ b/packages/platform/enums/README.md@@ -0,0 +1,5 @@+Contains enums shared by platform api and packages++from api-v2 please import from @calcom/platform-enums++from any other package please import from @calcom/platform-enums/monorepo\ No newline at end of filediff --git a/packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/booking-window.enum.ts b/packages/platform/enums/event-types/booking-window.enum.tssimilarity index 100%rename from packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/booking-window.enum.tsrename to packages/platform/enums/event-types/booking-window.enum.tsdiff --git a/packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/editable.ts b/packages/platform/enums/event-types/editable.tssimilarity index 100%rename from packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/editable.tsrename to packages/platform/enums/event-types/editable.tsdiff --git a/packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/field-type.ts b/packages/platform/enums/event-types/field-type.tssimilarity index 100%rename from packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/field-type.tsrename to packages/platform/enums/event-types/field-type.tsdiff --git a/packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/frequency.ts b/packages/platform/enums/event-types/frequency.tssimilarity index 100%rename from packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/frequency.tsrename to packages/platform/enums/event-types/frequency.tsdiff --git a/packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/interval-limits.enum.ts b/packages/platform/enums/event-types/interval-limits.enum.tssimilarity index 100%rename from packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/interval-limits.enum.tsrename to packages/platform/enums/event-types/interval-limits.enum.tsdiff --git a/packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/period-type.ts b/packages/platform/enums/event-types/period-type.tssimilarity index 100%rename from packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/period-type.tsrename to packages/platform/enums/event-types/period-type.tsdiff --git a/packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/scheduling-type.ts b/packages/platform/enums/event-types/scheduling-type.tssimilarity index 100%rename from packages/platform/types/event-types/event-types_2024_06_14/inputs/enums/scheduling-type.tsrename to packages/platform/enums/event-types/scheduling-type.tsdiff --git a/packages/platform/enums/index.ts b/packages/platform/enums/index.tsnew file mode 100644index 00000000000..2eec9fe1f3c--- /dev/null+++ b/packages/platform/enums/index.ts@@ -0,0 +1,7 @@+export * from "./event-types/booking-window.enum";+export * from "./event-types/editable";+export * from "./event-types/field-type";+export * from "./event-types/interval-limits.enum";+export * from "./event-types/period-type";+export * from "./event-types/scheduling-type";+export * from "./event-types/frequency";diff --git a/packages/platform/enums/monorepo.ts b/packages/platform/enums/monorepo.tsnew file mode 100644index 00000000000..2eec9fe1f3c--- /dev/null+++ b/packages/platform/enums/monorepo.ts@@ -0,0 +1,7 @@+export * from "./event-types/booking-window.enum";+export * from "./event-types/editable";+export * from "./event-types/field-type";+export * from "./event-types/interval-limits.enum";+export * from "./event-types/period-type";+export * from "./event-types/scheduling-type";+export * from "./event-types/frequency";diff --git a/packages/platform/enums/package.json b/packages/platform/enums/package.jsonnew file mode 100644index 00000000000..39b24c11a17--- /dev/null+++ b/packages/platform/enums/package.json@@ -0,0 +1,26 @@+{+ "name": "@calcom/platform-enums",+ "version": "0.0.0",+ "main": "./dist/index.ts",+ "types": "./dist/index.ts",+ "exports": {+ ".": {+ "require": "./dist/index.js",+ "import": "./dist/index.js",+ "types": "./dist/index.d.ts.map"+ },+ "./monorepo": {+ "import": "./monorepo.ts",+ "require": "./monorepo.ts"+ }+ },+ "scripts": {+ "test": "jest ./tests",+ "build": "rm -rf ./dist && tsc --build --force tsconfig.json",+ "build:watch": "tsc --build --force ./tsconfig.json --watch",+ "post-install": "yarn build"+ },+ "dependencies": {+ "@calcom/platform-constants": "*"+ }+}diff --git a/packages/platform/enums/permissions.ts b/packages/platform/enums/permissions.tsnew file mode 100644index 00000000000..926b7300cd3--- /dev/null+++ b/packages/platform/enums/permissions.ts@@ -0,0 +1,73 @@+import {+ BOOKING_READ,+ BOOKING_WRITE,+ EVENT_TYPE_READ,+ EVENT_TYPE_WRITE,+ PERMISSIONS,+ SCHEDULE_READ,+ SCHEDULE_WRITE,+ APPS_READ,+ APPS_WRITE,+ PROFILE_READ,+ PROFILE_WRITE,+} from "@calcom/platform-constants";+import type { PLATFORM_PERMISSION } from "@calcom/platform-types";++export const hasPermission = (userPermissions: number, permission: PLATFORM_PERMISSION): boolean => {+ // use bitwise AND to check if user has the permission+ return (userPermissions & permission) === permission;+};++export const hasPermissions = (userPermissions: number, permissions: PLATFORM_PERMISSION[]): boolean => {+ // use bitwise AND to check if each required permission is present+ return permissions.every((permission) => hasPermission(userPermissions, permission));+};++export const hasEventTypeReadPermission = (userPermissions: number): boolean => {+ return hasPermission(userPermissions, EVENT_TYPE_READ);+};++export const hasEventTypeWritePermission = (userPermissions: number): boolean => {+ return hasPermission(userPermissions, EVENT_TYPE_WRITE);+};++export const hasBookingReadPermission = (userPermissions: number): boolean => {+ return hasPermission(userPermissions, BOOKING_READ);+};++export const hasBookingWritePermission = (userPermissions: number): boolean => {+ return hasPermission(userPermissions, BOOKING_WRITE);+};++export const hasScheduleReadPermission = (userPermissions: number): boolean => {+ return hasPermission(userPermissions, SCHEDULE_READ);+};++export const hasScheduleWritePermission = (userPermissions: number): boolean => {+ return hasPermission(userPermissions, SCHEDULE_WRITE);+};++export const hasAppsReadPermission = (userPermissions: number): boolean => {+ return hasPermission(userPermissions, APPS_READ);+};++export const hasAppsWritePermission = (userPermissions: number): boolean => {+ return hasPermission(userPermissions, APPS_WRITE);+};++export const hasProfileReadPermission = (userPermissions: number): boolean => {+ return hasPermission(userPermissions, PROFILE_READ);+};++export const hasProfileWritePermission = (userPermissions: number): boolean => {+ return hasPermission(userPermissions, PROFILE_WRITE);+};++export const listPermissions = (userPermissions: number): PLATFORM_PERMISSION[] => {+ return PERMISSIONS.reduce((acc, permission) => {+ if (hasPermission(userPermissions, permission)) {+ return [...acc, permission];+ }+ return acc;+ }, [] as PLATFORM_PERMISSION[]);+};diff --git a/packages/platform/enums/tsconfig.json b/packages/platform/enums/tsconfig.jsonnew file mode 100644index 00000000000..18374f0d193--- /dev/null+++ b/packages/platform/enums/tsconfig.json@@ -0,0 +1,12 @@+{+ "extends": "@calcom/tsconfig/base.json",+ "compilerOptions": {+ "target": "ES5",+ "resolveJsonModule": true,+ "experimentalDecorators": true,+ "baseUrl": "./",+ "outDir": "./dist"+ },+ "include": ["."],+ "exclude": ["dist", "node_modules"]+}diff --git a/packages/platform/types/event-types/event-types_2024_06_14/inputs/booking-window.input.ts b/packages/platform/types/event-types/event-types_2024_06_14/inputs/booking-window.input.tsindex bbec6ba8c6d..1a41e264c07 100644--- a/packages/platform/types/event-types/event-types_2024_06_14/inputs/booking-window.input.ts+++ b/packages/platform/types/event-types/event-types_2024_06_14/inputs/booking-window.input.ts@@ -13,7 +13,7 @@ import {IsBoolean,} from "class-validator";-import { BookingWindowPeriodInputTypeEnum_2024_06_14 } from "./enums/booking-window.enum";+import { BookingWindowPeriodInputTypeEnum_2024_06_14 } from "@calcom/platform-enums";export type BookingWindowPeriodInputType_2024_06_14 = "businessDays" | "calendarDays" | "range";export type BookingWindowPeriodOutputType_2024_06_14 = "RANGE" | "ROLLING_WINDOW" | "ROLLING";diff --git a/packages/platform/types/event-types/event-types_2024_06_14/inputs/create-event-type.input.ts b/packages/platform/types/event-types/event-types_2024_06_14/inputs/create-event-type.input.tsindex e371a5524e9..aaf9a414627 100644--- a/packages/platform/types/event-types/event-types_2024_06_14/inputs/create-event-type.input.ts+++ b/packages/platform/types/event-types/event-types_2024_06_14/inputs/create-event-type.input.ts@@ -11,6 +11,8 @@ import {ValidateNested,} from "class-validator";+import { SchedulingType } from "@calcom/platform-enums";+import type { BookingField_2024_06_14 } from "./booking-fields.input";import { ValidateBookingFields_2024_06_14 } from "./booking-fields.input";import { BookingLimitsCount_2024_06_14, ValidateBookingLimistsCount } from "./booking-limits-count.input";@@ -20,7 +22,6 @@ import {} from "./booking-limits-duration.input";import type { BookingWindow_2024_06_14 } from "./booking-window.input";import { ValidateBookingWindow } from "./booking-window.input";-import { SchedulingType } from "./enums/scheduling-type";import { ValidateLocations_2024_06_14 } from "./locations.input";import type { Location_2024_06_14 } from "./locations.input";diff --git a/packages/platform/types/event-types/event-types_2024_06_14/outputs/event-type.output.ts b/packages/platform/types/event-types/event-types_2024_06_14/outputs/event-type.output.tsindex 0d01f6a5e22..f79b0b3cc21 100644--- a/packages/platform/types/event-types/event-types_2024_06_14/outputs/event-type.output.ts+++ b/packages/platform/types/event-types/event-types_2024_06_14/outputs/event-type.output.ts@@ -24,7 +24,7 @@ enum SchedulingTypeEnum {MANAGED = "MANAGED",}-export type SchedulingType = "ROUND_ROBIN" | "COLLECTIVE" | "MANAGED";+export type EventTypesOutputSchedulingType = "ROUND_ROBIN" | "COLLECTIVE" | "MANAGED";class User_2024_06_14 {@IsInt()@@ -99,7 +99,7 @@ export class EventTypeOutput_2024_06_14 {afterEventBuffer?: number;@IsEnum(SchedulingTypeEnum)- schedulingType!: SchedulingType | null;+ schedulingType!: EventTypesOutputSchedulingType | null;@Type(() => RecurringEvent_2024_06_14)recurringEvent!: RecurringEvent_2024_06_14 | null;@@ -209,7 +209,7 @@ export class TeamEventTypeOutput_2024_06_14 {afterEventBuffer?: number;@IsEnum(SchedulingTypeEnum)- schedulingType!: SchedulingType | null;+ schedulingType!: EventTypesOutputSchedulingType | null;@Type(() => RecurringEvent_2024_06_14)recurringEvent!: RecurringEvent_2024_06_14 | null;diff --git a/packages/platform/types/package.json b/packages/platform/types/package.jsonindex 8a4ba5c01af..7228b41feeb 100644--- a/packages/platform/types/package.json+++ b/packages/platform/types/package.json@@ -10,6 +10,7 @@},"dependencies": {"@calcom/platform-constants": "*",+ "@calcom/platform-enums": "*","@types/express": "^4.17.21","class-validator": "^0.14.0"}diff --git a/packages/trpc/tsconfig.json b/packages/trpc/tsconfig.jsonindex 383cd46893a..e75cc122266 100644--- a/packages/trpc/tsconfig.json+++ b/packages/trpc/tsconfig.json@@ -11,6 +11,7 @@"@calcom/lib": ["../lib"],"@calcom/lib/*": ["../lib/*"],"@calcom/platform-constants": ["../platform/constants/index.ts"],+ "@calcom/platform-enums": ["../platform/enums/index.ts"],"@calcom/platform-types": ["../platform/types/index.ts"],"@calcom/platform-utils": ["../platform/utils/index.ts"],"@calcom/prisma": ["../prisma"],diff --git a/packages/ui/components/icon/icon-list.mjs b/packages/ui/components/icon/icon-list.mjsindex ce41b487993..9c2dbf107b2 100644--- a/packages/ui/components/icon/icon-list.mjs+++ b/packages/ui/components/icon/icon-list.mjs@@ -13,6 +13,7 @@ export const lucideIconList = new Set(["badge-check","ban","bell",+ "blocks","bold","book-open-check","book-open",@@ -137,5 +138,4 @@ export const lucideIconList = new Set(["webhook","x","zap",- "blocks",]);diff --git a/packages/ui/components/icon/icon-names.ts b/packages/ui/components/icon/icon-names.tsindex 43db493bcf7..c5775f7969f 100644--- a/packages/ui/components/icon/icon-names.ts+++ b/packages/ui/components/icon/icon-names.ts@@ -20,6 +20,7 @@ export type IconName =| "book-user"| "building"| "calendar-check-2"+ | "calendar-days"| "calendar-heart"| "calendar-search"| "calendar-x-2"