@axiom-lattice/client-sdk 8.3.0 → 8.4.1

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.mjs CHANGED
@@ -4729,6 +4729,10 @@ var OidcProvidersClient = class {
4729
4729
  };
4730
4730
 
4731
4731
  // src/platform.ts
4732
+ import {
4733
+ PLATFORM_BRANDING_FIELDS,
4734
+ PLATFORM_BRANDING_FIELD_KEYS
4735
+ } from "@axiom-lattice/protocols";
4732
4736
  var PlatformClientError = class extends Error {
4733
4737
  constructor(message, status, code, retryable = false, details) {
4734
4738
  super(message);
@@ -4775,28 +4779,26 @@ function hydrateEnvironment(value) {
4775
4779
  }
4776
4780
  return value;
4777
4781
  }
4778
- var BRANDING_TEXT_KEYS = [
4779
- "brandName",
4780
- "logoUrl",
4781
- "faviconUrl",
4782
- "primaryColor",
4783
- "backgroundColor",
4784
- "loginTitle",
4785
- "loginSubtitle"
4786
- ];
4787
4782
  function hydrateBranding(value) {
4788
4783
  if (!isRecord5(value)) throw invalidResponse2("Invalid branding");
4789
4784
  const branding = {};
4790
- for (const key of BRANDING_TEXT_KEYS) {
4785
+ const target = branding;
4786
+ for (const key of PLATFORM_BRANDING_FIELD_KEYS) {
4791
4787
  const field = value[key];
4792
4788
  if (field === void 0) continue;
4789
+ const kind = PLATFORM_BRANDING_FIELDS[key].kind;
4790
+ if (kind === "integer" || kind === "percent") {
4791
+ if (typeof field !== "number" || !Number.isInteger(field)) {
4792
+ throw invalidResponse2(`Invalid branding.${key}`);
4793
+ }
4794
+ target[key] = field;
4795
+ continue;
4796
+ }
4793
4797
  if (typeof field !== "string") {
4794
4798
  throw invalidResponse2(`Invalid branding.${key}`);
4795
4799
  }
4796
- branding[key] = field;
4800
+ target[key] = field;
4797
4801
  }
4798
- const customCss = optionalString(value, "customCss");
4799
- if (customCss !== void 0) branding.customCss = customCss;
4800
4802
  return branding;
4801
4803
  }
4802
4804
  function hydrateBrandingDomain(value) {