Files
calendar/packages/features/flags/hooks/index.ts
T
Peer RichelsenGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>Amit Sharmasean-brydoncoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
20b7ac8c0d feat: implement tiered Intercom chat system replacing Plain (#23285)
* feat: implement tiered Intercom chat system replacing Plain

- Add TieredIntercomChat component with customer tier detection
- Add IntercomContactForm for free users using Intercom API
- Add /api/intercom-conversation endpoint for free user support
- Update UserDropdown to use tiered chat logic
- Replace Plain chat with Intercom in app providers
- Remove all Plain chat components and related files
- Use useHasPaidPlan hook for customer tier detection

Paying customers see Intercom widget, free users see contact form
that creates conversations via Intercom API.

Co-Authored-By: peer@cal.com <peer@cal.com>

* fix: add missing environment variables to turbo.json globalEnv

- Add NEXT_PUBLIC_WEBAPP_URL, NEXT_PUBLIC_WEBSITE_URL, NEXT_PUBLIC_STRIPE_PUBLIC_KEY
- Add NEXT_PUBLIC_IS_E2E, NEXT_PUBLIC_STRIPE_PREMIUM_PLAN_PRICE_MONTHLY
- Add NEXT_PUBLIC_BOOKER_NUMBER_OF_DAYS_TO_LOAD, NEXT_PUBLIC_STRIPE_CREDITS_PRICE_ID
- Resolves turbo/no-undeclared-env-vars ESLint errors blocking commits

Co-Authored-By: peer@cal.com <peer@cal.com>

* fix: resolve linting errors in platform examples base package

- Fix prettier/prettier formatting (quotes and comma)
- Add underscore prefix to unused variables
- Resolves CI failure in @calcom/base#lint check

Co-Authored-By: peer@cal.com <peer@cal.com>

* remove plain usage

* placement fixes

* fix: pop closing immediately issue

* stuff

* proper error and additional user info

* add key to .env.example and remove unused plain route

* fix conversation route

* refactor intercom dynamic provider

* code rabbit fixes

* feat: introduce tiered support feature flag

* fix: type check

* Apply suggestion from @coderabbitai[bot]

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Amit Sharma <74371312+Amit91848@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-09-09 18:20:22 +09:00

39 lines
1.0 KiB
TypeScript

import type { AppFlags } from "@calcom/features/flags/config";
import { trpc } from "@calcom/trpc/react";
const initialData: AppFlags = {
organizations: false,
teams: false,
"calendar-cache": false,
"calendar-cache-serve": false,
emails: false,
insights: false,
webhooks: false,
workflows: false,
"email-verification": false,
"google-workspace-directory": false,
"disable-signup": false,
attributes: false,
"organizer-request-email-v2": false,
"delegation-credential": false,
"salesforce-crm-tasker": false,
"workflow-smtp-emails": false,
"cal-video-log-in-overlay": false,
"use-api-v2-for-team-slots": false,
pbac: false,
"restriction-schedule": false,
"team-booking-page-cache": false,
"cal-ai-voice-agents": false,
"tiered-support-chat": false,
};
if (process.env.NEXT_PUBLIC_IS_E2E) {
initialData.organizations = true;
initialData.teams = true;
}
export function useFlags(): Partial<AppFlags> {
const query = trpc.viewer.features.map.useQuery();
return query.data ?? initialData;
}