History

Switch billing from per-seat to flat-fee per org + add Slack/email contact

Pricing model - Replace seat-based pricing with org-flat-fee plans: Free (10k execs/mo, 3 members), Free PAYG (10k included + $0.20/1k overage), Team ($49/mo, 250k incl, unlimited members, $0.20/1k overage). Bumped Free included executions from 5k -> 10k for top-of-funnel. - Mark `seats` feature archived; introduce `members` (non-consumable metered) and `domain-verification` (boolean) features. - Update privacy/terms copy from "seat counts" to "membership" / "organization-level" pricing language. - Refresh /billing and /billing/plans UI: trim per-seat add-ons, render Free/Team/Enterprise cards, fix button alignment under conditional badges. Slack/email contact CTA on pricing page - New SlackService wraps Slack Web API: creates `#shared-<email-slug>` channel (retries with random suffix on `name_taken`), posts a hello message, and calls `conversations.inviteShared` with `external_limited`. - POST /api/contact/slack: public endpoint, validates email, verifies a Cloudflare Turnstile token, gates on a 5/min global ratelimit binding, then calls SlackService. Internal SlackError details are logged server-side; the client only sees a generic message. - Pricing page CTA: dialog with Turnstile widget + email/name/note form, prefilled from useAuth() when signed in. Sibling "Email us" mailto: link to rhys@executor.sh. - Wrangler bindings: ratelimit (5/60s), VITE_PUBLIC_TURNSTILE_SITEKEY vars; .env.op gets dev test keys + SLACK_BOT_TOKEN op:// reference.

Rhys Sullivan committed 6 months ago

Commit 47dfd6b1 parent c5d93a317 files · +919 −189Browse files

Showing the changes to apps/cloud/src/api/error-response.ts (1 of 17 files). Show all

Unified · Split

apps/cloud/src/api/error-response.ts+22−5
@@ -1,5 +1,5 @@
1import * as Sentry from "@sentry/cloudflare";1import * as Sentry from "@sentry/cloudflare";
2import { Data, Effect } from "effect";2import { Cause, Data, Effect, Result } from "effect";
3import {3import {
4 HttpServerRespondable,4 HttpServerRespondable,
5 HttpServerResponse,5 HttpServerResponse,
@@ -25,14 +25,28 @@ export class HttpResponseError extends Data.TaggedError("HttpResponseError")<{ · 19 unmodified lines
25 }25 }
26}26}
27 27
28const toHttpResponseError = (error: unknown): HttpResponseError =>28const unwrapCause = (error: unknown): unknown => {
29 error instanceof HttpResponseError29 if (!Cause.isCause(error)) return error;
30 ? error30
31 const failure = Cause.findError(error);
32 if (Result.isSuccess(failure)) return failure.success;
33
34 const defect = Cause.findDefect(error);
35 if (Result.isSuccess(defect)) return defect.success;
36
37 return error;
38};
39
40const toHttpResponseError = (error: unknown): HttpResponseError => {
41 const unwrapped = unwrapCause(error);
42 return unwrapped instanceof HttpResponseError
43 ? unwrapped
31 : new HttpResponseError({44 : new HttpResponseError({
32 status: 500,45 status: 500,
33 code: "internal_server_error",46 code: "internal_server_error",
34 message: "Internal server error",47 message: "Internal server error",
35 });48 });
49};
36 50
37export const isServerError = (error: unknown): boolean => toHttpResponseError(error).status >= 500;51export const isServerError = (error: unknown): boolean => toHttpResponseError(error).status >= 500;
38 52
@@ -45,7 +59,10 @@ export const toErrorResponse = (error: unknown): Response => { · 6 unmodified lines
45export const toErrorServerResponse = (error: unknown): HttpServerResponse.HttpServerResponse => {59export const toErrorServerResponse = (error: unknown): HttpServerResponse.HttpServerResponse => {
46 const mapped = toHttpResponseError(error);60 const mapped = toHttpResponseError(error);
47 if (mapped.status >= 500) {61 if (mapped.status >= 500) {
48 console.error("[api] toErrorServerResponse error:", error instanceof Error ? error.stack : error);62 console.error(
63 "[api] toErrorServerResponse error:",
64 error instanceof Error ? error.stack : error,
65 );
49 Sentry.captureException(error);66 Sentry.captureException(error);
50 }67 }
51 return HttpServerResponse.jsonUnsafe(68 return HttpServerResponse.jsonUnsafe(

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t