Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
3.1 KiB
Scratchpad
- User selected no backfill: existing tier-entitled tenants do not automatically receive add-on rows.
- Existing AI add-on infrastructure uses
tenant_addons, sessionaddons,TierContext.hasAddOn,assertAddOnAccess, and Stripe metadataaddon_key. - Key files identified:
packages/types/src/constants/addOns.tsserver/src/context/TierContext.tsxserver/src/components/settings/SettingsPage.tsxee/server/src/app/api/integrations/entra/_guards.tsee/packages/microsoft-teams/src/lib/teams/teamsAvailability.tsee/server/src/lib/stripe/StripeService.tsee/server/src/components/settings/account/AccountManagement.tsx
Implementation notes
- Added
ADD_ONS.TEAMS = 'teams'andADD_ONS.ENTERPRISE = 'enterprise'. - Made
ENTRA_SYNCandTEAMS_INTEGRATIONadd-on-only for tier utilities by excluding them from derived tier maps and returning false fromtierHasFeature. - Settings now computes Entra access from
hasAddOn(ADD_ONS.ENTERPRISE)and Teams access fromhasAddOn(ADD_ONS.TEAMS). - Entra API guard keeps the base
INTEGRATIONScheck and now also callsassertAddOnAccess(ADD_ONS.ENTERPRISE). - Teams runtime availability and Teams notification delivery check the active
teamsadd-on row. - Stripe add-on price lookup now supports AI, Teams, and Enterprise add-ons via monthly/annual env vars.
- Account Management renders all three add-ons through one generic purchase/cancel card flow.
Validation
-
Attempted focused Vitest run with
pnpm exec vitest run ...; startup failed before tests because the repo-local Vitest config importsdotenv, but this checkout has no localnode_modules/dotenvavailable. -
Added Enterprise add-on filtering to Entra recurring Temporal schedule setup so scheduled syncs are deleted/skipped when the add-on is inactive.
-
Reviewer found the Teams Microsoft-provider binding bypass; fixed by hiding Teams consumer UI unless
canUseTeamsis true and by rejectingsetMicrosoftConsumerBinding({ consumerType: 'teams' })without an active Teams add-on. -
Added missing package dependencies for new
@alga-psa/typesruntime imports inee/packages/microsoft-teamsandee/temporal-workflows; refreshedpackage-lock.jsonwithnpm install --package-lock-only --ignore-scripts. -
pnpm exec tsc --noEmit --pretty false --skipLibCheckcompleted successfully. -
Focused Vitest initially could not start without local dependencies; after wiring/installing dependencies, the focused Teams/add-on regression set passed:
../packages/integrations/src/lib/teamsAvailability.test.tssrc/test/unit/teamsMeetingHelpers.test.tssrc/test/unit/internal-notifications/teamsNotificationDelivery.test.ts../packages/integrations/src/actions/integrations/teamsActions.test.ts../packages/integrations/src/actions/integrations/teamsPackageActions.test.ts../packages/integrations/src/actions/integrations/microsoftActions.test.ts../packages/scheduling/tests/availabilitySettingsActions.permission.test.ts
-
cd server && npx tsc --noEmit --pretty false --project tsconfig.jsoncompleted successfully.