waitkit 0.2.0 → 0.3.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 +25 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,9 +18,12 @@ const wk = new WaitKit({
|
|
|
18
18
|
projectSlug: "my-project",
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
// Add a subscriber
|
|
21
|
+
// Add a subscriber (source defaults to "landing-page")
|
|
22
22
|
await wk.subscribers.create({ email: "user@example.com" });
|
|
23
23
|
|
|
24
|
+
// Override source per-signup
|
|
25
|
+
await wk.subscribers.create({ email: "user@example.com", source: "referral" });
|
|
26
|
+
|
|
24
27
|
// Get subscriber count
|
|
25
28
|
const count = await wk.subscribers.count();
|
|
26
29
|
```
|
|
@@ -50,14 +53,29 @@ function WaitlistForm() {
|
|
|
50
53
|
|
|
51
54
|
## API
|
|
52
55
|
|
|
56
|
+
### `WaitKitConfig`
|
|
57
|
+
|
|
58
|
+
| Param | Type | Default | Description |
|
|
59
|
+
| ------------- | -------- | ------------------------- | ------------------------------ |
|
|
60
|
+
| `apiKey` | `string` | — | API key |
|
|
61
|
+
| `projectSlug` | `string` | — | Project slug |
|
|
62
|
+
| `baseUrl` | `string` | `https://api.waitkit.dev` | API base URL |
|
|
63
|
+
| `source` | `string` | `landing-page` | Default source for all signups |
|
|
64
|
+
|
|
53
65
|
### `wk.subscribers.create(options)`
|
|
54
66
|
|
|
55
|
-
| Param | Type | Required |
|
|
56
|
-
| ---------- | ------------------------- | -------- |
|
|
57
|
-
| `email` | `string` | yes |
|
|
58
|
-
| `name` | `string` | no |
|
|
59
|
-
| `source` | `string` | no |
|
|
60
|
-
| `metadata` | `Record<string, unknown>` | no |
|
|
67
|
+
| Param | Type | Required | Description |
|
|
68
|
+
| ---------- | ------------------------- | -------- | -------------------------------------------- |
|
|
69
|
+
| `email` | `string` | yes | Subscriber email |
|
|
70
|
+
| `name` | `string` | no | Subscriber name |
|
|
71
|
+
| `source` | `string` | no | Overrides the default source for this signup |
|
|
72
|
+
| `metadata` | `Record<string, unknown>` | no | Arbitrary metadata |
|
|
73
|
+
|
|
74
|
+
The `source` value is resolved with this precedence:
|
|
75
|
+
|
|
76
|
+
1. `create({ source })` — per-call override
|
|
77
|
+
2. `new WaitKit({ source })` — instance default
|
|
78
|
+
3. `"landing-page"` — built-in fallback
|
|
61
79
|
|
|
62
80
|
### `wk.subscribers.count(projectSlug?)`
|
|
63
81
|
|