@praxium/sdk 0.2.22 → 0.3.31

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/dist/index.d.ts CHANGED
@@ -179,6 +179,19 @@ type SocialLinks = {
179
179
  * List of team members visible on the public team page
180
180
  */
181
181
  type TeamMembers = Array<PublicTeamMember>;
182
+ /**
183
+ * Custom field exposed on the public team API
184
+ */
185
+ type CustomField = {
186
+ /** Field identifier (snake_case) */
187
+ identifier: string;
188
+ /** Custom field type (e.g., STRING, LONG_TEXT, SEARCHABLE_LIST) */
189
+ type: string;
190
+ /** Localized field label */
191
+ label: LocalizedText;
192
+ /** Resolved field value (type depends on field.type) */
193
+ value: unknown;
194
+ };
182
195
  /**
183
196
  * Public team member profile
184
197
  */
@@ -196,30 +209,9 @@ type PublicTeamMember = {
196
209
  */
197
210
  publicImage: string;
198
211
  /**
199
- * List of specializations
200
- */
201
- specializations: Array<LocalizedSpecialization>;
202
- /**
203
- * Staff biography in NL and EN
204
- */
205
- bio: BilingualText | null;
206
- /**
207
- * BIG registration number (Dutch healthcare registration)
208
- */
209
- bigNumber: string | null;
210
- };
211
- /**
212
- * Specialization with bilingual names
213
- */
214
- type LocalizedSpecialization = {
215
- /**
216
- * Dutch specialization name
217
- */
218
- nl: string;
219
- /**
220
- * English specialization name
212
+ * Custom fields assigned to the public-team API access profile
221
213
  */
222
- en: string;
214
+ customFields: Array<CustomField>;
223
215
  };
224
216
  /**
225
217
  * Bilingual text with Dutch (nl) and English (en) translations
@@ -234,6 +226,8 @@ type BilingualText = {
234
226
  */
235
227
  en: string;
236
228
  };
229
+ /** Text with locale-specific values. Keys are locale codes (e.g., 'nl', 'en'). */
230
+ type LocalizedText = Record<string, string>;
237
231
  /**
238
232
  * FAQs grouped by category, ordered by category.order then faq.order
239
233
  */
@@ -628,6 +622,8 @@ interface TenantClientConfig {
628
622
  locale: string;
629
623
  }
630
624
  declare function createTenantClient(config: TenantClientConfig): {
625
+ /** Resolve a LocalizedText to a string using the client's configured locale. */
626
+ localize: (text: LocalizedText | null | undefined) => string;
631
627
  getOpeningHours: () => Promise<OpeningHours>;
632
628
  getContactDetails: () => Promise<ContactDetails>;
633
629
  getLocation: () => Promise<Location>;
@@ -704,4 +700,46 @@ declare class PraxiumRateLimitError extends PraxiumError {
704
700
  constructor(errorCode: string, message: string);
705
701
  }
706
702
 
707
- export { type ApiError, type BilingualText, type BookableService, type BookableServices, type BookableVariantInfo, type BusinessName, type ContactDetails, type ContactFormResult, type FaqCategory, type FaqContent, type FaqGroup, type FaqItem, type FeatureItem, type FeatureList, type InsuranceInfo, type InsuranceList, type LocalizedSpecialization, type Location, type OpeningHours, type PaymentMethod, type PaymentMethodList, type PolicyInfo, type PolicyList, PraxiumAuthError, PraxiumError, PraxiumForbiddenError, PraxiumNotFoundError, PraxiumRateLimitError, PraxiumValidationError, type PricingVariant, type PricingVariants, type PublicDaySchedule, type PublicTeamMember, type ServiceCategoryInfo, type SocialLinks, type TeamMembers, type TenantClient, type TenantClientConfig, type ValidationDetail, createTenantClient };
703
+ /**
704
+ * Helper functions for working with the public team API custom fields.
705
+ */
706
+
707
+ /**
708
+ * Get a custom field value by identifier from a team member's custom fields.
709
+ *
710
+ * **Type safety warning:** The generic `T` is a cast (`as T`) — the caller is
711
+ * responsible for ensuring `T` matches the actual runtime value shape for the
712
+ * given field type. No runtime validation is performed.
713
+ *
714
+ * Runtime value shapes by custom field type:
715
+ * - `STRING` → `string`
716
+ * - `LONG_TEXT` → `string`
717
+ * - `NUMBER` → `number`
718
+ * - `BOOLEAN` → `boolean`
719
+ * - `SINGLE_SELECT` → `BilingualText` (`{ nl: string; en: string }`)
720
+ * - `MULTI_SELECT` → `BilingualText[]`
721
+ * - `SEARCHABLE_LIST` → `BilingualText[]`
722
+ * - `DATE` → `string` (ISO 8601 date)
723
+ *
724
+ * @example
725
+ * ```ts
726
+ * // Caller must match T to the field's actual type:
727
+ * const specs = getCustomFieldValue<BilingualText[]>(member, 'specializations')
728
+ * const bigNr = getCustomFieldValue<string>(member, 'big_number')
729
+ * ```
730
+ *
731
+ * @param member - Public team member
732
+ * @param identifier - Field identifier to look up
733
+ * @returns The field value cast to `T`, or `null` if no field with that identifier exists
734
+ */
735
+ declare function getCustomFieldValue<T = unknown>(member: PublicTeamMember, identifier: string): T | null;
736
+ /**
737
+ * Get a custom field by identifier.
738
+ *
739
+ * @param member - Public team member
740
+ * @param identifier - Field identifier to look up
741
+ * @returns The full custom field, or undefined if not found
742
+ */
743
+ declare function getCustomField(member: PublicTeamMember, identifier: string): CustomField | undefined;
744
+
745
+ export { type ApiError, type BilingualText, type BookableService, type BookableServices, type BookableVariantInfo, type BusinessName, type ContactDetails, type ContactFormResult, type CustomField, type FaqCategory, type FaqContent, type FaqGroup, type FaqItem, type FeatureItem, type FeatureList, type InsuranceInfo, type InsuranceList, type LocalizedText, type Location, type OpeningHours, type PaymentMethod, type PaymentMethodList, type PolicyInfo, type PolicyList, PraxiumAuthError, PraxiumError, PraxiumForbiddenError, PraxiumNotFoundError, PraxiumRateLimitError, PraxiumValidationError, type PricingVariant, type PricingVariants, type PublicDaySchedule, type PublicTeamMember, type ServiceCategoryInfo, type SocialLinks, type TeamMembers, type TenantClient, type TenantClientConfig, type ValidationDetail, createTenantClient, getCustomField, getCustomFieldValue };
package/dist/index.js CHANGED
@@ -928,6 +928,19 @@ var STATUS_ERROR_MAP = {
928
928
  429: PraxiumRateLimitError
929
929
  };
930
930
 
931
+ // src/helpers.ts
932
+ function getCustomFieldValue(member, identifier) {
933
+ const field = member.customFields.find((f) => f.identifier === identifier);
934
+ return field ? field.value : null;
935
+ }
936
+ function getCustomField(member, identifier) {
937
+ return member.customFields.find((f) => f.identifier === identifier);
938
+ }
939
+ function getLocalizedText(text, locale) {
940
+ if (!text) return "";
941
+ return text[locale] || text["en"] || Object.values(text)[0] || "";
942
+ }
943
+
931
944
  // src/tenant-client.ts
932
945
  function unwrapOrThrow(result) {
933
946
  if (result.data !== void 0 && result.error === void 0) {
@@ -957,6 +970,9 @@ function createTenantClient(config) {
957
970
  });
958
971
  const path = { tenantSlug: config.tenantSlug };
959
972
  return {
973
+ // ─── Locale Helper ───
974
+ /** Resolve a LocalizedText to a string using the client's configured locale. */
975
+ localize: (text) => getLocalizedText(text, config.locale),
960
976
  // ─── Layout Endpoints ───
961
977
  getOpeningHours: () => getOpeningHours({ client: clientInstance, path }).then(unwrapOrThrow),
962
978
  getContactDetails: () => getContactDetails({ client: clientInstance, path }).then(unwrapOrThrow),
@@ -983,5 +999,7 @@ export {
983
999
  PraxiumNotFoundError,
984
1000
  PraxiumRateLimitError,
985
1001
  PraxiumValidationError,
986
- createTenantClient
1002
+ createTenantClient,
1003
+ getCustomField,
1004
+ getCustomFieldValue
987
1005
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@praxium/sdk",
3
- "version": "0.2.22",
3
+ "version": "0.3.31",
4
4
  "description": "Official TypeScript SDK for the Praxium platform API",
5
5
  "type": "module",
6
6
  "exports": {