@productcraft/waitlist 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,9 +40,8 @@ If the waitlist has `settings.recaptcha_site_key` set, also pass a `recaptcha_to
40
40
  ```ts
41
41
  import { Waitlist } from "@productcraft/waitlist";
42
42
 
43
- const waitlist = new Waitlist({
44
- auth: { type: "apiKey", key: process.env.PCFT_KEY! },
45
- });
43
+ // Reads PRODUCTCRAFT_API_KEY from the environment
44
+ const waitlist = new Waitlist();
46
45
 
47
46
  // Create a waitlist — body uses `display_name`, not `name`.
48
47
  const { data } = await waitlist.client.POST(
@@ -56,11 +55,25 @@ const { data } = await waitlist.client.POST(
56
55
 
57
56
  `{workspace_id}` is the workspace UUID returned by `@productcraft/platform-auth`'s introspect endpoint.
58
57
 
58
+ ## Credentials from the environment
59
+
60
+ Server-side, omit `auth` and the client reads your workspace key from the environment:
61
+
62
+ ```bash
63
+ # .env
64
+ PRODUCTCRAFT_API_KEY=pcft_live_...
65
+ ```
66
+
67
+ - An explicit `auth` always wins over the environment.
68
+ - Hosts are never read from the environment. Override them in code with `baseUrl`.
69
+ - This is a server-only fallback. Never put a key in `NEXT_PUBLIC_*` or any other variable a bundler inlines into browser code.
70
+
59
71
  ## Configuration
60
72
 
61
73
  ```ts
62
74
  new Waitlist({
63
75
  // Optional: required for workspace-admin calls. Public submit works without auth.
76
+ // Omit to use PRODUCTCRAFT_API_KEY from the environment
64
77
  auth: { type: "apiKey", key: "pcft_live_..." }
65
78
  | { type: "bearer", token: "eyJ..." }
66
79
  | { type: "cookie", value: "auth_token=..." },
package/dist/index.d.cts CHANGED
@@ -1853,7 +1853,7 @@ interface operations {
1853
1853
  "application/json": components["schemas"]["PublicWaitlistInfoDto"];
1854
1854
  };
1855
1855
  };
1856
- /** @description Waitlist not found or not active */
1856
+ /** @description Code `WAITLIST_NOT_FOUND`: no such waitlist, not active, or its workspace was deleted. The answer is the same in every case. */
1857
1857
  404: {
1858
1858
  headers: {
1859
1859
  [name: string]: unknown;
@@ -1907,7 +1907,7 @@ interface operations {
1907
1907
  "application/json": components["schemas"]["OriginNotAllowedErrorDto"];
1908
1908
  };
1909
1909
  };
1910
- /** @description Waitlist not found */
1910
+ /** @description Code `WAITLIST_NOT_FOUND`: no such waitlist, or its workspace was deleted. The answer is the same in both cases. */
1911
1911
  404: {
1912
1912
  headers: {
1913
1913
  [name: string]: unknown;
@@ -1969,7 +1969,7 @@ interface operations {
1969
1969
  "application/json": components["schemas"]["PublicLeaderboardEntryDto"][];
1970
1970
  };
1971
1971
  };
1972
- /** @description Waitlist not found or not active */
1972
+ /** @description Code `WAITLIST_NOT_FOUND`: no such waitlist, not active, or its workspace was deleted. The answer is the same in every case. */
1973
1973
  404: {
1974
1974
  headers: {
1975
1975
  [name: string]: unknown;
package/dist/index.d.ts CHANGED
@@ -1853,7 +1853,7 @@ interface operations {
1853
1853
  "application/json": components["schemas"]["PublicWaitlistInfoDto"];
1854
1854
  };
1855
1855
  };
1856
- /** @description Waitlist not found or not active */
1856
+ /** @description Code `WAITLIST_NOT_FOUND`: no such waitlist, not active, or its workspace was deleted. The answer is the same in every case. */
1857
1857
  404: {
1858
1858
  headers: {
1859
1859
  [name: string]: unknown;
@@ -1907,7 +1907,7 @@ interface operations {
1907
1907
  "application/json": components["schemas"]["OriginNotAllowedErrorDto"];
1908
1908
  };
1909
1909
  };
1910
- /** @description Waitlist not found */
1910
+ /** @description Code `WAITLIST_NOT_FOUND`: no such waitlist, or its workspace was deleted. The answer is the same in both cases. */
1911
1911
  404: {
1912
1912
  headers: {
1913
1913
  [name: string]: unknown;
@@ -1969,7 +1969,7 @@ interface operations {
1969
1969
  "application/json": components["schemas"]["PublicLeaderboardEntryDto"][];
1970
1970
  };
1971
1971
  };
1972
- /** @description Waitlist not found or not active */
1972
+ /** @description Code `WAITLIST_NOT_FOUND`: no such waitlist, not active, or its workspace was deleted. The answer is the same in every case. */
1973
1973
  404: {
1974
1974
  headers: {
1975
1975
  [name: string]: unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@productcraft/waitlist",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Waitlist management — public-form signups, variants for A/B/n landing pages, referrals, position + leaderboard, approval workflow with invite-to-app, signed outbound webhooks, CSV export. Generated from the production OpenAPI spec.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "openapi-fetch": "^0.13.0",
46
- "@productcraft/core": "^0.2.1"
46
+ "@productcraft/core": "^0.3.0"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsup"