@productcraft/waitlist 0.1.2 → 0.2.1

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
@@ -972,10 +972,16 @@ interface components {
972
972
  */
973
973
  message: string | string[];
974
974
  /**
975
- * @description HTTP status code echoed in the body. Spelled `statusCode` (camelCase) in every ProductCraft API.
975
+ * @deprecated
976
+ * @description Deprecated alias of `status_code`, same value. Kept so existing clients keep working; read `status_code`. Error responses carry `Deprecation: true` while it is sent.
977
+ * @example 403
978
+ */
979
+ statusCode?: number;
980
+ /**
981
+ * @description HTTP status code echoed in the body (`status_code`). `statusCode` carries the same value as a deprecated alias.
976
982
  * @example 403
977
983
  */
978
- statusCode: number;
984
+ status_code: number;
979
985
  };
980
986
  InviteToAppDto: {
981
987
  /** @description Auth app slug to invite into; defaults to the workspace Waitlist settings default (`default_heimdall_app_slug`) */
@@ -1062,8 +1068,14 @@ interface components {
1062
1068
  * @example https://evil.test
1063
1069
  */
1064
1070
  origin: string;
1071
+ /**
1072
+ * @deprecated
1073
+ * @description Deprecated alias of `status_code`, same value. Kept so existing clients keep working; read `status_code`. Error responses carry `Deprecation: true` while it is sent.
1074
+ * @example 403
1075
+ */
1076
+ statusCode?: number;
1065
1077
  /** @example 403 */
1066
- statusCode: number;
1078
+ status_code: number;
1067
1079
  };
1068
1080
  PaginationDto: {
1069
1081
  /**
@@ -1853,7 +1865,7 @@ interface operations {
1853
1865
  "application/json": components["schemas"]["PublicWaitlistInfoDto"];
1854
1866
  };
1855
1867
  };
1856
- /** @description Waitlist not found or not active */
1868
+ /** @description Code `WAITLIST_NOT_FOUND`: no such waitlist, not active, or its workspace was deleted. The answer is the same in every case. */
1857
1869
  404: {
1858
1870
  headers: {
1859
1871
  [name: string]: unknown;
@@ -1907,7 +1919,7 @@ interface operations {
1907
1919
  "application/json": components["schemas"]["OriginNotAllowedErrorDto"];
1908
1920
  };
1909
1921
  };
1910
- /** @description Waitlist not found */
1922
+ /** @description Code `WAITLIST_NOT_FOUND`: no such waitlist, or its workspace was deleted. The answer is the same in both cases. */
1911
1923
  404: {
1912
1924
  headers: {
1913
1925
  [name: string]: unknown;
@@ -1969,7 +1981,7 @@ interface operations {
1969
1981
  "application/json": components["schemas"]["PublicLeaderboardEntryDto"][];
1970
1982
  };
1971
1983
  };
1972
- /** @description Waitlist not found or not active */
1984
+ /** @description Code `WAITLIST_NOT_FOUND`: no such waitlist, not active, or its workspace was deleted. The answer is the same in every case. */
1973
1985
  404: {
1974
1986
  headers: {
1975
1987
  [name: string]: unknown;
package/dist/index.d.ts CHANGED
@@ -972,10 +972,16 @@ interface components {
972
972
  */
973
973
  message: string | string[];
974
974
  /**
975
- * @description HTTP status code echoed in the body. Spelled `statusCode` (camelCase) in every ProductCraft API.
975
+ * @deprecated
976
+ * @description Deprecated alias of `status_code`, same value. Kept so existing clients keep working; read `status_code`. Error responses carry `Deprecation: true` while it is sent.
977
+ * @example 403
978
+ */
979
+ statusCode?: number;
980
+ /**
981
+ * @description HTTP status code echoed in the body (`status_code`). `statusCode` carries the same value as a deprecated alias.
976
982
  * @example 403
977
983
  */
978
- statusCode: number;
984
+ status_code: number;
979
985
  };
980
986
  InviteToAppDto: {
981
987
  /** @description Auth app slug to invite into; defaults to the workspace Waitlist settings default (`default_heimdall_app_slug`) */
@@ -1062,8 +1068,14 @@ interface components {
1062
1068
  * @example https://evil.test
1063
1069
  */
1064
1070
  origin: string;
1071
+ /**
1072
+ * @deprecated
1073
+ * @description Deprecated alias of `status_code`, same value. Kept so existing clients keep working; read `status_code`. Error responses carry `Deprecation: true` while it is sent.
1074
+ * @example 403
1075
+ */
1076
+ statusCode?: number;
1065
1077
  /** @example 403 */
1066
- statusCode: number;
1078
+ status_code: number;
1067
1079
  };
1068
1080
  PaginationDto: {
1069
1081
  /**
@@ -1853,7 +1865,7 @@ interface operations {
1853
1865
  "application/json": components["schemas"]["PublicWaitlistInfoDto"];
1854
1866
  };
1855
1867
  };
1856
- /** @description Waitlist not found or not active */
1868
+ /** @description Code `WAITLIST_NOT_FOUND`: no such waitlist, not active, or its workspace was deleted. The answer is the same in every case. */
1857
1869
  404: {
1858
1870
  headers: {
1859
1871
  [name: string]: unknown;
@@ -1907,7 +1919,7 @@ interface operations {
1907
1919
  "application/json": components["schemas"]["OriginNotAllowedErrorDto"];
1908
1920
  };
1909
1921
  };
1910
- /** @description Waitlist not found */
1922
+ /** @description Code `WAITLIST_NOT_FOUND`: no such waitlist, or its workspace was deleted. The answer is the same in both cases. */
1911
1923
  404: {
1912
1924
  headers: {
1913
1925
  [name: string]: unknown;
@@ -1969,7 +1981,7 @@ interface operations {
1969
1981
  "application/json": components["schemas"]["PublicLeaderboardEntryDto"][];
1970
1982
  };
1971
1983
  };
1972
- /** @description Waitlist not found or not active */
1984
+ /** @description Code `WAITLIST_NOT_FOUND`: no such waitlist, not active, or its workspace was deleted. The answer is the same in every case. */
1973
1985
  404: {
1974
1986
  headers: {
1975
1987
  [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.1",
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"