From 2a8eca788501f16b339874ebd68c59e9287d1090 Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Fri, 21 Jul 2023 16:46:18 +0530 Subject: [PATCH] chore: Update version in main for embeds that are already released. (#9822) * Release latest embeds * Release latest embeds * Ensure that unpublished packages arent imported * linter is important to catch unexpected imports * Create new release * Add a new patch --- apps/web/CHANGELOG.md | 34 ++++++++++++++++++ packages/embeds/.eslintrc.js | 12 +++++++ packages/embeds/embed-core/CHANGELOG.md | 18 ++++++++++ packages/embeds/embed-core/package.json | 4 +-- .../embeds/embed-core/src/embed-iframe.ts | 8 ++--- packages/embeds/embed-core/src/embed.ts | 14 +++++--- packages/embeds/embed-react/CHANGELOG.md | 36 +++++++++++++++++++ packages/embeds/embed-react/package.json | 10 +++--- .../embed-react/test/packaged/api.test.ts | 10 +++++- packages/embeds/embed-snippet/CHANGELOG.md | 27 ++++++++++++++ packages/embeds/embed-snippet/package.json | 4 +-- packages/embeds/embed-snippet/src/index.ts | 3 ++ .../features/bookings/Booker/utils/layout.ts | 3 +- 13 files changed, 162 insertions(+), 21 deletions(-) create mode 100644 packages/embeds/.eslintrc.js diff --git a/apps/web/CHANGELOG.md b/apps/web/CHANGELOG.md index 795250d0df..ef0070cf20 100644 --- a/apps/web/CHANGELOG.md +++ b/apps/web/CHANGELOG.md @@ -1,5 +1,39 @@ # @calcom/web +## 3.1.3 + +### Patch Changes + +- Updated dependencies + - @calcom/embed-react@1.3.0 + +## 3.0.10 + +### Patch Changes + +- Updated dependencies + - @calcom/embed-snippet@1.1.2 + - @calcom/embed-react@1.2.2 + - @calcom/embed-core@1.3.2 + +## 3.0.9 + +### Patch Changes + +- Updated dependencies + - @calcom/embed-snippet@1.1.1 + - @calcom/embed-react@1.2.1 + - @calcom/embed-core@1.3.1 + +## 3.0.8 + +### Patch Changes + +- Updated dependencies + - @calcom/embed-core@1.3.0 + - @calcom/embed-react@1.2.0 + - @calcom/embed-snippet@1.1.0 + ## 2.9.4 ### Patch Changes diff --git a/packages/embeds/.eslintrc.js b/packages/embeds/.eslintrc.js new file mode 100644 index 0000000000..59165894d4 --- /dev/null +++ b/packages/embeds/.eslintrc.js @@ -0,0 +1,12 @@ +module.exports = { + extends: ["../../.eslintrc.js"], + rules: { + "no-restricted-imports": [ + "error", + { + // Ensure that embed packages(They are published) can't access unpublished packages which is basically all @calcom/* packages except embed packages + patterns: ["@calcom/*", "!@calcom/embed-*"], + }, + ], + }, +}; diff --git a/packages/embeds/embed-core/CHANGELOG.md b/packages/embeds/embed-core/CHANGELOG.md index e01551960c..0331d54406 100644 --- a/packages/embeds/embed-core/CHANGELOG.md +++ b/packages/embeds/embed-core/CHANGELOG.md @@ -1,5 +1,23 @@ # @calcom/embed-core +## 1.3.2 + +### Patch Changes + +- Improve UI instruction layout typings + +## 1.3.1 + +### Patch Changes + +- layout type fix as zod-utils can't be used in npm package + +## 1.3.0 + +### Minor Changes + +- Supports new booker layout + ## 1.2.1 ### Patch Changes diff --git a/packages/embeds/embed-core/package.json b/packages/embeds/embed-core/package.json index 41ea214e5b..222ee9d749 100644 --- a/packages/embeds/embed-core/package.json +++ b/packages/embeds/embed-core/package.json @@ -1,6 +1,6 @@ { "name": "@calcom/embed-core", - "version": "1.2.1", + "version": "1.3.2", "description": "This is the vanilla JS core script that embeds Cal Link", "main": "./dist/embed/embed.js", "types": "./dist/index.d.ts", @@ -30,7 +30,7 @@ "embed-tests-quick": "QUICK=true yarn embed-tests", "embed-tests-update-snapshots:ci": "yarn embed-tests-quick --update-snapshots", "withEmbedPublishEnv": "NEXT_PUBLIC_EMBED_LIB_URL='https://app.cal.com/embed/embed.js' NEXT_PUBLIC_WEBAPP_URL='https://app.cal.com' yarn", - "prepack": "yarn withEmbedPublishEnv build", + "prepack": "yarn ../../../ lint --filter='@calcom/embed-core' && yarn withEmbedPublishEnv build", "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf ../../../apps/web/public/embed" }, "files": [ diff --git a/packages/embeds/embed-core/src/embed-iframe.ts b/packages/embeds/embed-core/src/embed-iframe.ts index 47b87b0272..12f7658719 100644 --- a/packages/embeds/embed-core/src/embed-iframe.ts +++ b/packages/embeds/embed-core/src/embed-iframe.ts @@ -2,13 +2,13 @@ import { useRouter } from "next/router"; import type { CSSProperties } from "react"; import { useState, useEffect } from "react"; -import type { BookerStore } from "@calcom/features/bookings/Booker/store"; -import { BookerLayouts } from "@calcom/prisma/zod-utils"; - import type { Message } from "./embed"; import { sdkActionManager } from "./sdk-event"; type Theme = "dark" | "light"; + +export type BookerLayouts = "month_view" | "week_view" | "column_view"; + export type EmbedThemeConfig = Theme | "auto"; export type UiConfig = { hideEventTypeDetails?: boolean; @@ -45,7 +45,6 @@ const embedStore = { * We maintain a list of all setUiConfig setters that are in use at the moment so that we can update all those components. */ setUiConfig: [] as ((arg0: UiConfig) => void)[], - layout: BookerLayouts, }; declare global { @@ -54,7 +53,6 @@ declare global { __logQueue?: unknown[]; embedStore: typeof embedStore; applyCssVars: (cssVarsPerTheme: UiConfig["cssVarsPerTheme"]) => void; - setLayout?: BookerStore["setLayout"]; }; CalComPageStatus: string; isEmbed?: () => boolean; diff --git a/packages/embeds/embed-core/src/embed.ts b/packages/embeds/embed-core/src/embed.ts index 79015bbe4b..70b3bf9b66 100644 --- a/packages/embeds/embed-core/src/embed.ts +++ b/packages/embeds/embed-core/src/embed.ts @@ -1,10 +1,14 @@ /// -import type { BookerLayouts } from "@calcom/prisma/zod-utils"; - import { FloatingButton } from "./FloatingButton/FloatingButton"; import { Inline } from "./Inline/inline"; import { ModalBox } from "./ModalBox/ModalBox"; -import type { InterfaceWithParent, interfaceWithParent, UiConfig, EmbedThemeConfig } from "./embed-iframe"; +import type { + InterfaceWithParent, + interfaceWithParent, + UiConfig, + EmbedThemeConfig, + BookerLayouts, +} from "./embed-iframe"; import css from "./embed.css"; import type { EventData, EventDataMap } from "./sdk-action-manager"; import { SdkActionManager } from "./sdk-action-manager"; @@ -164,9 +168,11 @@ export type PrefillAndIframeAttrsConfig = Record { +test("Check that the API is available", async () => { expect(api).toBeDefined() + const awaitedApi = await api; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + awaitedApi('floatingButton', { + config: { + // @ts-expect-error We are intentionaly testing invalid value + layout: 'wrongview' + } + }) }); diff --git a/packages/embeds/embed-snippet/CHANGELOG.md b/packages/embeds/embed-snippet/CHANGELOG.md index ff1fa62708..148e869183 100644 --- a/packages/embeds/embed-snippet/CHANGELOG.md +++ b/packages/embeds/embed-snippet/CHANGELOG.md @@ -1,5 +1,32 @@ # @calcom/embed-snippet +## 1.1.2 + +### Patch Changes + +- Improve UI instruction layout typings +- Updated dependencies + - @calcom/embed-core@1.3.2 + +## 1.1.1 + +### Patch Changes + +- layout type fix as zod-utils can't be used in npm package +- Updated dependencies + - @calcom/embed-core@1.3.1 + +## 1.1.0 + +### Minor Changes + +- Supports new booker layout + +### Patch Changes + +- Updated dependencies + - @calcom/embed-core@1.3.0 + ## 1.0.9 ### Patch Changes diff --git a/packages/embeds/embed-snippet/package.json b/packages/embeds/embed-snippet/package.json index b4d17750cd..53baa56623 100644 --- a/packages/embeds/embed-snippet/package.json +++ b/packages/embeds/embed-snippet/package.json @@ -1,7 +1,7 @@ { "name": "@calcom/embed-snippet", "sideEffects": false, - "version": "1.0.9", + "version": "1.1.2", "main": "./dist/snippet.umd.js", "module": "./dist/snippet.es.js", "description": "Vanilla JS embed snippet that is responsible to fetch @calcom/embed-core and thus show Cal Link as an embed on a page.", @@ -17,7 +17,7 @@ "type-check:ci": "tsc-absolute --pretty --noEmit", "lint": "eslint --ext .ts,.js src", "withEmbedPublishEnv": "NEXT_PUBLIC_EMBED_LIB_URL='https://app.cal.com/embed/embed.js' NEXT_PUBLIC_WEBAPP_URL='https://app.cal.com' yarn", - "prepack": "yarn withEmbedPublishEnv build", + "prepack": "yarn ../../../ lint --filter='@calcom/embed-snippet' && yarn withEmbedPublishEnv build", "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist" }, "files": [ diff --git a/packages/embeds/embed-snippet/src/index.ts b/packages/embeds/embed-snippet/src/index.ts index 3652f002a3..6ebe0b38f5 100644 --- a/packages/embeds/embed-snippet/src/index.ts +++ b/packages/embeds/embed-snippet/src/index.ts @@ -1,5 +1,8 @@ /* eslint-disable @typescript-eslint/ban-ts-comment,prefer-rest-params,prefer-const */ import type { GlobalCal, GlobalCalWithoutNs } from "@calcom/embed-core"; +// FIXME: embed-snippet is a published package and shouldn't import from @calcom/types which is unpublished +// This isn't a problem at the moment because embed-snippet isn't directly imported and embed-react which uses it doesn't depend on this +// eslint-disable-next-line no-restricted-imports import type { Optional } from "@calcom/types/utils"; /** diff --git a/packages/features/bookings/Booker/utils/layout.ts b/packages/features/bookings/Booker/utils/layout.ts index 895ebbdb51..52f7119a0f 100644 --- a/packages/features/bookings/Booker/utils/layout.ts +++ b/packages/features/bookings/Booker/utils/layout.ts @@ -1,6 +1,5 @@ -import type { BookerLayouts } from "@calcom/prisma/zod-utils"; import { bookerLayoutOptions } from "@calcom/prisma/zod-utils"; -export const validateLayout = (layout?: BookerLayouts | null) => { +export const validateLayout = (layout?: "week_view" | "month_view" | "column_view" | null) => { return bookerLayoutOptions.find((validLayout) => validLayout === layout); };