@praxium/sdk 0.5.91 → 0.5.94

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
@@ -2,6 +2,8 @@
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
+ Learn more on the [Praxium developer platform](https://platform.praxium.nl).
6
+
5
7
  - [Quick Start](#quick-start) — Installation and usage examples
6
8
  - [Configuration](#configuration) — Environment variables and tenant routing
7
9
  - [Available Methods](#available-methods) — All API endpoints
@@ -31,6 +33,7 @@ const client = createPraxiumClient({
31
33
  const hours = await client.getOpeningHours()
32
34
  const team = await client.getTeamMembers()
33
35
  const faq = await client.getFaq()
36
+ // FAQ category names, questions, and answers are strings in the requested locale.
34
37
  ```
35
38
 
36
39
  All methods return data directly or throw a typed `PraxiumError` on failure (see [Error Handling](#error-handling)).
@@ -39,6 +42,10 @@ All methods return data directly or throw a typed `PraxiumError` on failure (see
39
42
 
40
43
  Pass `locale: '*'` to receive all translations as objects. Resolve them at render time with `localizeText()`:
41
44
 
45
+ When a method has a different response shape in multilingual mode, the SDK exposes that shape with a `Multilingual*` type. For example, `getTeamMembers()` returns `MultilingualTeamMember[]`, and `getFaq()` returns `MultilingualFaqContent`.
46
+
47
+ `localizeText(text, locale)` resolves values in this order: requested locale, then English, then the first available value, then an empty string.
48
+
42
49
  ```typescript
43
50
  import { createPraxiumClient, localizeText } from '@praxium/sdk'
44
51
 
@@ -60,6 +67,9 @@ const team = await client.getTeamMembers()
60
67
 
61
68
  const label = localizeText(team[0].customFields[0].label, 'nl') // → "Specialisatie"
62
69
  const value = localizeText(team[0].customFields[0].value, 'nl') // → "Sport"
70
+
71
+ const faq = await client.getFaq()
72
+ const question = localizeText(faq[0].faqs[0].question, 'nl')
63
73
  ```
64
74
 
65
75
  ### Contact Form
package/dist/index.d.ts CHANGED
@@ -239,7 +239,7 @@ type FaqGroup = {
239
239
  faqs: Array<FaqItem>;
240
240
  };
241
241
  /**
242
- * FAQ category with bilingual name
242
+ * FAQ category
243
243
  */
244
244
  type FaqCategory = {
245
245
  /**
@@ -247,11 +247,9 @@ type FaqCategory = {
247
247
  */
248
248
  id: string;
249
249
  /**
250
- * Category name per locale
250
+ * Category name resolved to requested locale
251
251
  */
252
- name: {
253
- [key: string]: string;
254
- };
252
+ name: string;
255
253
  /**
256
254
  * Display order (ascending)
257
255
  */
@@ -266,17 +264,13 @@ type FaqItem = {
266
264
  */
267
265
  id: string;
268
266
  /**
269
- * Question text per locale
267
+ * Question text resolved to requested locale
270
268
  */
271
- question: {
272
- [key: string]: string;
273
- };
269
+ question: string;
274
270
  /**
275
- * Answer text per locale (may contain HTML)
271
+ * Answer text resolved to requested locale (may contain HTML)
276
272
  */
277
- answer: {
278
- [key: string]: string;
279
- };
273
+ answer: string;
280
274
  /**
281
275
  * Parent category UUID
282
276
  */
@@ -659,6 +653,39 @@ type MultilingualTeamMember = {
659
653
  /** Custom fields with multilingual labels and values */
660
654
  customFields: Array<MultilingualCustomField>;
661
655
  };
656
+ /** FAQ category in locale='*' mode. */
657
+ type MultilingualFaqCategory = {
658
+ /** Category UUID */
659
+ id: string;
660
+ /** Category name in all available locales */
661
+ name: MultilingualText;
662
+ /** Display order (ascending) */
663
+ order: number;
664
+ };
665
+ /** FAQ item in locale='*' mode. */
666
+ type MultilingualFaqItem = {
667
+ /** FAQ item UUID */
668
+ id: string;
669
+ /** Question text in all available locales */
670
+ question: MultilingualText;
671
+ /** Answer text in all available locales (may contain HTML) */
672
+ answer: MultilingualText;
673
+ /** Parent category UUID */
674
+ categoryId: string;
675
+ /** Display order within category (ascending) */
676
+ order: number;
677
+ /** Whether this FAQ item is currently visible */
678
+ visible: boolean;
679
+ };
680
+ /** FAQ category group in locale='*' mode. */
681
+ type MultilingualFaqGroup = {
682
+ /** The FAQ category */
683
+ category: MultilingualFaqCategory;
684
+ /** FAQ items in this category */
685
+ faqs: Array<MultilingualFaqItem>;
686
+ };
687
+ /** FAQ content in locale='*' mode. */
688
+ type MultilingualFaqContent = Array<MultilingualFaqGroup>;
662
689
 
663
690
  /**
664
691
  * Supported locale codes for server-side content resolution.
@@ -695,7 +722,6 @@ interface PraxiumClientBase {
695
722
  getLocation: () => Promise<Location>;
696
723
  getBusinessName: () => Promise<BusinessName>;
697
724
  getSocialLinks: () => Promise<SocialLinks>;
698
- getFaq: () => Promise<FaqContent>;
699
725
  getServiceVariants: () => Promise<PricingVariants>;
700
726
  getInsuranceInfo: () => Promise<InsuranceList>;
701
727
  getFeatures: () => Promise<FeatureList>;
@@ -706,10 +732,12 @@ interface PraxiumClientBase {
706
732
  }
707
733
  /** Client for locale-specific responses (locale='nl', 'en', etc.) */
708
734
  interface PraxiumClient extends PraxiumClientBase {
735
+ getFaq: () => Promise<FaqContent>;
709
736
  getTeamMembers: () => Promise<TeamMembers>;
710
737
  }
711
738
  /** Client for multilingual responses (locale='*') */
712
739
  interface MultilingualPraxiumClient extends PraxiumClientBase {
740
+ getFaq: () => Promise<MultilingualFaqContent>;
713
741
  getTeamMembers: () => Promise<MultilingualTeamMember[]>;
714
742
  }
715
743
  /** Multilingual mode: returns MultilingualTeamMember[] (use localizeText() helper for resolution) */
@@ -863,4 +891,4 @@ declare function getCustomField(member: MultilingualTeamMember, identifier: stri
863
891
  */
864
892
  declare function localizeText(text: MultilingualText | null | undefined, locale: SupportedLocale): string;
865
893
 
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 };
894
+ 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 MultilingualFaqCategory, type MultilingualFaqContent, type MultilingualFaqGroup, type MultilingualFaqItem, 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
@@ -981,7 +981,6 @@ function createPraxiumClient(config) {
981
981
  getBusinessName: () => getBusinessName({ client: clientInstance, path }).then(unwrapOrThrow),
982
982
  getSocialLinks: () => getSocialLinks({ client: clientInstance, path }).then(unwrapOrThrow),
983
983
  // ─── Content Endpoints ───
984
- getFaq: () => getFaq({ client: clientInstance, path }).then(unwrapOrThrow),
985
984
  getServiceVariants: () => getServiceVariants({ client: clientInstance, path }).then(unwrapOrThrow),
986
985
  getInsuranceInfo: () => getInsuranceInfo({ client: clientInstance, path }).then(unwrapOrThrow),
987
986
  getFeatures: () => getFeatures({ client: clientInstance, path }).then(unwrapOrThrow),
@@ -994,11 +993,13 @@ function createPraxiumClient(config) {
994
993
  if (config.locale === "*") {
995
994
  return {
996
995
  ...baseMethods,
996
+ getFaq: () => getFaq({ client: clientInstance, path }).then(unwrapOrThrow),
997
997
  getTeamMembers: () => getTeamMembers({ client: clientInstance, path }).then(unwrapOrThrow)
998
998
  };
999
999
  }
1000
1000
  return {
1001
1001
  ...baseMethods,
1002
+ getFaq: () => getFaq({ client: clientInstance, path }).then(unwrapOrThrow),
1002
1003
  getTeamMembers: () => getTeamMembers({ client: clientInstance, path }).then(unwrapOrThrow)
1003
1004
  };
1004
1005
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@praxium/sdk",
3
- "version": "0.5.91",
3
+ "version": "0.5.94",
4
4
  "description": "Official TypeScript SDK for the Praxium platform API",
5
5
  "type": "module",
6
6
  "exports": {