@praxium/sdk 0.4.83 → 0.4.87

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
@@ -73,6 +73,7 @@ const result = await client.submitContactForm({
73
73
  phone: '+31612345678',
74
74
  subject: 'Appointment request',
75
75
  message: 'I would like to book an appointment.',
76
+ acceptTerms: true, // required — must reflect the visitor's explicit consent
76
77
  })
77
78
  // → { success: true, emailStatus: 'sent' }
78
79
  ```
@@ -86,7 +87,7 @@ Your website needs two environment variables to connect to the Praxium platform,
86
87
  | Variable | Purpose | Example |
87
88
  |----------|---------|---------|
88
89
  | `PRAXIUM_API_URL` | Your tenant's admin portal URL. The SDK sends API requests to this host. | `https://mypractice.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. | `praxium_v1_mypractice_default_17..._abc...` |
90
+ | `PRAXIUM_API_KEY` | HMAC API key for authentication. Generated in the admin portal under API Profiles. The tenant slug AND the API profile slug are both embedded in the key — no need to configure them separately. | `praxium_v1_mypractice_public-team_17..._abc...` |
90
91
 
91
92
  **Optional (only if using ISR revalidation webhooks):**
92
93
 
@@ -97,7 +98,7 @@ Your website needs two environment variables to connect to the Praxium platform,
97
98
  ```bash
98
99
  # .env.local
99
100
  PRAXIUM_API_URL="https://mypractice.admin.praxium.nl"
100
- PRAXIUM_API_KEY="praxium_v1_mypractice_default_1234567890_abcdef..."
101
+ PRAXIUM_API_KEY="praxium_v1_mypractice_public-team_1234567890_abcdef..."
101
102
  PRAXIUM_WEBHOOK_SECRET="your-webhook-secret-from-admin-portal" # optional
102
103
  ```
103
104
 
package/dist/index.d.ts CHANGED
@@ -674,7 +674,7 @@ type ClientLocale = SupportedLocale | '*';
674
674
  /**
675
675
  * Extract the tenant slug from a profile-scoped API key.
676
676
  *
677
- * Key format: praxium_v1_{tenantSlug}_{profileSlug}_{timestamp}_{signature}
677
+ * Key format: `${API_KEY_PREFIX}_{tenantSlug}_{profileSlug}_{timestamp}_{signature}`
678
678
  * Parts: [0]praxium [1]v1 [2]tenantSlug [3]profileSlug [4]timestamp [5]signature
679
679
  *
680
680
  * @throws Error if key format is invalid (wrong prefix or insufficient parts)
@@ -719,6 +719,20 @@ declare function createPraxiumClient(config: PraxiumClientConfig & {
719
719
  /** Locale-specific mode: returns PublicTeamMember[] with resolved labels/values */
720
720
  declare function createPraxiumClient(config: PraxiumClientConfig): PraxiumClient;
721
721
 
722
+ /** Version-prefixed identifier at the start of every Praxium API key. */
723
+ declare const API_KEY_PREFIX: "praxium_v1";
724
+ /** Separator used between all key segments. */
725
+ declare const API_KEY_SEPARATOR: "_";
726
+ /**
727
+ * Convenience composition: `praxium_v1_` (prefix + separator).
728
+ *
729
+ * Use this when validating that a string starts with the full Praxium API
730
+ * key prefix. Avoids re-composing `${API_KEY_PREFIX}${API_KEY_SEPARATOR}`
731
+ * at every call site. Compile-time `as const` so consumer Zod schemas can
732
+ * pass it to `.startsWith()` without widening to `string`.
733
+ */
734
+ declare const API_KEY_PREFIX_WITH_SEPARATOR: "praxium_v1_";
735
+
722
736
  /**
723
737
  * Typed error hierarchy for the Praxium SDK.
724
738
  *
@@ -849,4 +863,4 @@ declare function getCustomField(member: MultilingualTeamMember, identifier: stri
849
863
  */
850
864
  declare function localizeText(text: MultilingualText | null | undefined, locale: SupportedLocale): string;
851
865
 
852
- export { type ApiError, type BilingualText, type BookableService, type BookableServices, type BookableVariantInfo, type BusinessName, type ClientLocale, type ContactDetails, type ContactFormResult, type CustomField, type FaqCategory, type FaqContent, type FaqGroup, type FaqItem, type FeatureItem, type FeatureList, type InsuranceInfo, type InsuranceList, type Location, type MultilingualCustomField, type MultilingualPraxiumClient, type MultilingualTeamMember, type MultilingualText, type OpeningHours, type PaymentMethod, type PaymentMethodList, type PolicyInfo, type PolicyList, PraxiumAuthError, type PraxiumClient, type PraxiumClientConfig, PraxiumError, PraxiumForbiddenError, PraxiumNotFoundError, PraxiumRateLimitError, PraxiumValidationError, type PricingVariant, type PricingVariants, type PublicDaySchedule, type PublicTeamMember, type ServiceCategoryInfo, type SocialLinks, type SupportedLocale, type TeamMembers, type ValidationDetail, createPraxiumClient, extractTenantSlugFromApiKey, getCustomField, getCustomFieldValue, localizeText };
866
+ export { API_KEY_PREFIX, API_KEY_PREFIX_WITH_SEPARATOR, API_KEY_SEPARATOR, type ApiError, type BilingualText, type BookableService, type BookableServices, type BookableVariantInfo, type BusinessName, type ClientLocale, type ContactDetails, type ContactFormResult, type CustomField, type FaqCategory, type FaqContent, type FaqGroup, type FaqItem, type FeatureItem, type FeatureList, type InsuranceInfo, type InsuranceList, type Location, type MultilingualCustomField, type MultilingualPraxiumClient, type MultilingualTeamMember, type MultilingualText, type OpeningHours, type PaymentMethod, type PaymentMethodList, type PolicyInfo, type PolicyList, PraxiumAuthError, type PraxiumClient, type PraxiumClientConfig, PraxiumError, PraxiumForbiddenError, PraxiumNotFoundError, PraxiumRateLimitError, PraxiumValidationError, type PricingVariant, type PricingVariants, type PublicDaySchedule, type PublicTeamMember, type ServiceCategoryInfo, type SocialLinks, type SupportedLocale, type TeamMembers, type ValidationDetail, createPraxiumClient, extractTenantSlugFromApiKey, getCustomField, getCustomFieldValue, localizeText };
package/dist/index.js CHANGED
@@ -928,16 +928,19 @@ var STATUS_ERROR_MAP = {
928
928
  429: PraxiumRateLimitError
929
929
  };
930
930
 
931
- // src/tenant-client.ts
931
+ // src/api-key.constants.ts
932
932
  var API_KEY_PREFIX = "praxium_v1";
933
933
  var API_KEY_SEPARATOR = "_";
934
+ var API_KEY_PREFIX_WITH_SEPARATOR = `${API_KEY_PREFIX}${API_KEY_SEPARATOR}`;
935
+
936
+ // src/tenant-client.ts
934
937
  function extractTenantSlugFromApiKey(apiKey) {
935
938
  const parts = apiKey.split(API_KEY_SEPARATOR);
936
939
  if (parts.length < 6 || `${parts[0]}${API_KEY_SEPARATOR}${parts[1]}` !== API_KEY_PREFIX) {
937
940
  throw new PraxiumError(
938
941
  400,
939
942
  "INVALID_API_KEY_FORMAT",
940
- `API key must start with '${API_KEY_PREFIX}' and contain at least 6 segments. Format: praxium_v1_{tenantSlug}_{profileSlug}_{timestamp}_{signature}`
943
+ `API key must start with '${API_KEY_PREFIX}' and contain at least 6 segments. Format: ${API_KEY_PREFIX}${API_KEY_SEPARATOR}{tenantSlug}${API_KEY_SEPARATOR}{profileSlug}${API_KEY_SEPARATOR}{timestamp}${API_KEY_SEPARATOR}{signature}`
941
944
  );
942
945
  }
943
946
  return parts[2];
@@ -1013,6 +1016,9 @@ function localizeText(text, locale) {
1013
1016
  return text[locale] || text["en"] || Object.values(text)[0] || "";
1014
1017
  }
1015
1018
  export {
1019
+ API_KEY_PREFIX,
1020
+ API_KEY_PREFIX_WITH_SEPARATOR,
1021
+ API_KEY_SEPARATOR,
1016
1022
  PraxiumAuthError,
1017
1023
  PraxiumError,
1018
1024
  PraxiumForbiddenError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@praxium/sdk",
3
- "version": "0.4.83",
3
+ "version": "0.4.87",
4
4
  "description": "Official TypeScript SDK for the Praxium platform API",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,14 +19,18 @@
19
19
  "scripts": {
20
20
  "generate": "openapi-ts",
21
21
  "build": "tsup",
22
+ "lint": "eslint src/ tests/",
22
23
  "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json",
23
24
  "test": "vitest run",
24
25
  "test:watch": "vitest"
25
26
  },
26
27
  "devDependencies": {
28
+ "@eslint/js": "^9.0.0",
27
29
  "@hey-api/openapi-ts": "^0.92.4",
30
+ "eslint": "^9.0.0",
28
31
  "tsup": "^8.0.0",
29
32
  "typescript": "^5.7.0",
33
+ "typescript-eslint": "^8.0.0",
30
34
  "vitest": "^4.0.18"
31
35
  },
32
36
  "peerDependencies": {