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 @@
11 import * as Sentry from "@sentry/cloudflare";
2−import { Data, Effect } from "effect";
2+import { Cause, Data, Effect, Result } from "effect";
33 import {
44 HttpServerRespondable,
55 HttpServerResponse,
@@ -25,14 +25,28 @@ export class HttpResponseError extends Data.TaggedError("HttpResponseError")<{ · 19 unmodified lines
2525 }
2626 }
2727
28−const toHttpResponseError = (error: unknown): HttpResponseError =>
29− error instanceof HttpResponseError
30− ? error
28+const unwrapCause = (error: unknown): unknown => {
29+ if (!Cause.isCause(error)) return error;
30+
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+
40+const toHttpResponseError = (error: unknown): HttpResponseError => {
41+ const unwrapped = unwrapCause(error);
42+ return unwrapped instanceof HttpResponseError
43+ ? unwrapped
3144 : new HttpResponseError({
3245 status: 500,
3346 code: "internal_server_error",
3447 message: "Internal server error",
3548 });
49+};
3650
3751 export const isServerError = (error: unknown): boolean => toHttpResponseError(error).status >= 500;
3852
@@ -45,7 +59,10 @@ export const toErrorResponse = (error: unknown): Response => { · 6 unmodified lines
4559 export const toErrorServerResponse = (error: unknown): HttpServerResponse.HttpServerResponse => {
4660 const mapped = toHttpResponseError(error);
4761 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+ );
4966 Sentry.captureException(error);
5067 }
5168 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