@praxium/sdk 0.3.56 → 0.3.61
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 +38 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Official TypeScript SDK for the [Praxium](https://praxium.nl) platform API. Build tenant websites that display practice data (team, services, FAQ, opening hours) with full locale support.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- [Quick Start](#quick-start) — Installation and usage examples
|
|
6
|
+
- [Configuration](#configuration) — Environment variables and tenant routing
|
|
7
|
+
- [Available Methods](#available-methods) — All API endpoints
|
|
8
|
+
- [Error Handling](#error-handling) — Typed error classes
|
|
9
|
+
- [Next.js ISR Revalidation](#nextjs-isr-revalidation) — Webhook-based cache invalidation
|
|
10
|
+
- [Contributing](#contributing) — Development commands
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
6
13
|
|
|
7
14
|
```bash
|
|
8
15
|
npm install @praxium/sdk
|
|
9
16
|
```
|
|
10
17
|
|
|
11
|
-
## Quick Start
|
|
12
|
-
|
|
13
18
|
### Locale-Specific Mode
|
|
14
19
|
|
|
15
20
|
Pass a locale to get pre-resolved labels and values in that language:
|
|
@@ -72,6 +77,32 @@ const result = await client.submitContactForm({
|
|
|
72
77
|
// → { success: true, emailStatus: 'sent' }
|
|
73
78
|
```
|
|
74
79
|
|
|
80
|
+
## Configuration
|
|
81
|
+
|
|
82
|
+
Your website needs two environment variables to connect to the Praxium platform, plus an optional third for webhook-based cache revalidation:
|
|
83
|
+
|
|
84
|
+
**Required:**
|
|
85
|
+
|
|
86
|
+
| Variable | Purpose | Example |
|
|
87
|
+
|----------|---------|---------|
|
|
88
|
+
| `PRAXIUM_API_URL` | Your tenant's admin portal URL. The SDK sends API requests to this host. | `https://ijfysio.admin.praxium.nl` |
|
|
89
|
+
| `PRAXIUM_API_KEY` | HMAC API key for authentication. Generated in the admin portal under API Profiles. The tenant slug is embedded in the key — no need to configure it separately. | `hmac_v1_ijfysio_default_17..._abc...` |
|
|
90
|
+
|
|
91
|
+
**Optional (only if using ISR revalidation webhooks):**
|
|
92
|
+
|
|
93
|
+
| Variable | Purpose | Example |
|
|
94
|
+
|----------|---------|---------|
|
|
95
|
+
| `PRAXIUM_REVALIDATION_SECRET` | Shared secret for webhook signature verification. Only needed if your website uses ISR and you want the platform to notify your site when data changes (team, FAQ, opening hours). See [Next.js ISR Revalidation](#nextjs-isr-revalidation). | (32+ character random string) |
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# .env.local
|
|
99
|
+
PRAXIUM_API_URL="https://mypractice.admin.praxium.nl"
|
|
100
|
+
PRAXIUM_API_KEY="hmac_v1_mypractice_default_1234567890_abcdef..."
|
|
101
|
+
PRAXIUM_REVALIDATION_SECRET="your-webhook-secret-from-admin-portal" # optional
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
> **How tenant routing works:** Each tenant has its own admin subdomain (`{slug}.admin.praxium.nl`). The platform identifies your tenant from both the hostname AND the API key's embedded slug, cross-validating them for security. You don't need to configure the tenant slug separately — it's derived from your API key automatically.
|
|
105
|
+
|
|
75
106
|
## Available Methods
|
|
76
107
|
|
|
77
108
|
| Method | Description |
|
|
@@ -143,7 +174,10 @@ export const POST = createRevalidationHandler({
|
|
|
143
174
|
})
|
|
144
175
|
```
|
|
145
176
|
|
|
146
|
-
**Prerequisites:**
|
|
177
|
+
**Prerequisites:**
|
|
178
|
+
|
|
179
|
+
1. Register your revalidation endpoint URL in the admin portal (Settings → Webhooks)
|
|
180
|
+
2. Set the `PRAXIUM_REVALIDATION_SECRET` env var to match the webhook secret from the admin portal
|
|
147
181
|
|
|
148
182
|
The handler includes HMAC-SHA256 signature verification, timestamp-based replay protection (5-minute window), and timing-safe comparison. Requires `next` as a peer dependency.
|
|
149
183
|
|