@streamoid/settings 0.1.4 → 0.1.5

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.mts CHANGED
@@ -58,11 +58,13 @@ interface SettingsAuthUser {
58
58
  userSpecialization?: string;
59
59
  }
60
60
  /** Option shape returned by `auth.getSpecializations` — drives the
61
- Specialization dropdown in Settings → Account. */
61
+ Specialization dropdown in Settings → Account. The host adapter is the
62
+ source of truth: name comes from the CMS, icon from `iconUrl`. */
62
63
  interface SettingsUserSpecialization {
63
64
  id: string;
64
65
  name: string;
65
66
  description?: string;
67
+ iconUrl?: string;
66
68
  }
67
69
  interface SettingsAuthAdapter {
68
70
  user: SettingsAuthUser | null;
package/dist/index.d.ts CHANGED
@@ -58,11 +58,13 @@ interface SettingsAuthUser {
58
58
  userSpecialization?: string;
59
59
  }
60
60
  /** Option shape returned by `auth.getSpecializations` — drives the
61
- Specialization dropdown in Settings → Account. */
61
+ Specialization dropdown in Settings → Account. The host adapter is the
62
+ source of truth: name comes from the CMS, icon from `iconUrl`. */
62
63
  interface SettingsUserSpecialization {
63
64
  id: string;
64
65
  name: string;
65
66
  description?: string;
67
+ iconUrl?: string;
66
68
  }
67
69
  interface SettingsAuthAdapter {
68
70
  user: SettingsAuthUser | null;
package/dist/index.js CHANGED
@@ -6875,51 +6875,31 @@ function SettingsNav({
6875
6875
  );
6876
6876
  }
6877
6877
  var SPECIALIZATION_ICON_SIZE = 20;
6878
- var SPECIALIZATION_ICON_PROPS = {
6879
- style: {
6880
- width: SPECIALIZATION_ICON_SIZE,
6881
- height: SPECIALIZATION_ICON_SIZE
6882
- }
6883
- };
6884
- function iconForSpecialization(id) {
6885
- switch (id) {
6886
- case "design":
6887
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons7.SiconSwatch, { ...SPECIALIZATION_ICON_PROPS });
6888
- case "merchandising":
6889
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons7.SiconBag, { ...SPECIALIZATION_ICON_PROPS });
6890
- case "planning":
6891
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons7.SiconInsights, { ...SPECIALIZATION_ICON_PROPS });
6892
- case "marketing_brand":
6893
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons7.SiconAdCreator, { ...SPECIALIZATION_ICON_PROPS });
6894
- case "founder_operator":
6895
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons7.SiconCrown, { ...SPECIALIZATION_ICON_PROPS });
6896
- default:
6897
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons7.SiconBolt, { ...SPECIALIZATION_ICON_PROPS });
6878
+ function SpecializationIcon({ iconUrl }) {
6879
+ if (iconUrl) {
6880
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
6881
+ "img",
6882
+ {
6883
+ src: iconUrl,
6884
+ alt: "",
6885
+ style: {
6886
+ width: SPECIALIZATION_ICON_SIZE,
6887
+ height: SPECIALIZATION_ICON_SIZE,
6888
+ objectFit: "contain"
6889
+ }
6890
+ }
6891
+ );
6898
6892
  }
6893
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
6894
+ import_icons7.SiconBolt,
6895
+ {
6896
+ style: {
6897
+ width: SPECIALIZATION_ICON_SIZE,
6898
+ height: SPECIALIZATION_ICON_SIZE
6899
+ }
6900
+ }
6901
+ );
6899
6902
  }
6900
- var FALLBACK_SPECIALIZATIONS = [
6901
- { id: "design", label: "Design", icon: iconForSpecialization("design") },
6902
- {
6903
- id: "merchandising",
6904
- label: "Merchandising",
6905
- icon: iconForSpecialization("merchandising")
6906
- },
6907
- {
6908
- id: "planning",
6909
- label: "Planning",
6910
- icon: iconForSpecialization("planning")
6911
- },
6912
- {
6913
- id: "marketing_brand",
6914
- label: "Marketing & brand",
6915
- icon: iconForSpecialization("marketing_brand")
6916
- },
6917
- {
6918
- id: "founder_operator",
6919
- label: "Founder & operator",
6920
- icon: iconForSpecialization("founder_operator")
6921
- }
6922
- ];
6923
6903
  function SpecializationDropdown({
6924
6904
  value,
6925
6905
  onChange,
@@ -6928,20 +6908,18 @@ function SpecializationDropdown({
6928
6908
  const { auth } = useSettingsAdapters();
6929
6909
  const [open, setOpen] = (0, import_react10.useState)(false);
6930
6910
  const containerRef = (0, import_react10.useRef)(null);
6931
- const [options, setOptions] = (0, import_react10.useState)(
6932
- FALLBACK_SPECIALIZATIONS
6933
- );
6911
+ const [options, setOptions] = (0, import_react10.useState)([]);
6934
6912
  (0, import_react10.useEffect)(() => {
6935
6913
  if (!auth.getSpecializations) return;
6936
6914
  let cancelled = false;
6937
6915
  auth.getSpecializations().then((items) => {
6938
6916
  if (cancelled) return;
6939
- if (Array.isArray(items) && items.length > 0) {
6917
+ if (Array.isArray(items)) {
6940
6918
  setOptions(
6941
6919
  items.map((item) => ({
6942
6920
  id: item.id,
6943
6921
  label: item.name,
6944
- icon: iconForSpecialization(item.id)
6922
+ iconUrl: item.iconUrl
6945
6923
  }))
6946
6924
  );
6947
6925
  }
@@ -7027,7 +7005,7 @@ function SpecializationDropdown({
7027
7005
  height: 24,
7028
7006
  color: selected ? "var(--alias-text---icons-primary)" : "var(--alias-text---icons-muted)"
7029
7007
  },
7030
- children: selected ? selected.icon : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons7.SiconBolt, {})
7008
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SpecializationIcon, { iconUrl: selected?.iconUrl })
7031
7009
  }
7032
7010
  ),
7033
7011
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
@@ -7122,7 +7100,7 @@ function SpecializationDropdown({
7122
7100
  width: 24,
7123
7101
  height: 24
7124
7102
  },
7125
- children: opt.icon
7103
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SpecializationIcon, { iconUrl: opt.iconUrl })
7126
7104
  }
7127
7105
  ),
7128
7106
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { flex: 1 }, children: opt.label })
package/dist/index.mjs CHANGED
@@ -27,12 +27,7 @@ import {
27
27
  SiconRight as SiconRight2,
28
28
  SiconUserAdd as SiconUserAdd2,
29
29
  SiconLock,
30
- SiconDown,
31
- SiconSwatch,
32
- SiconBag,
33
- SiconInsights,
34
- SiconAdCreator,
35
- SiconCrown
30
+ SiconDown
36
31
  } from "@streamoid/icons";
37
32
 
38
33
  // src/icons/SiconKey.tsx
@@ -6900,51 +6895,31 @@ function SettingsNav({
6900
6895
  );
6901
6896
  }
6902
6897
  var SPECIALIZATION_ICON_SIZE = 20;
6903
- var SPECIALIZATION_ICON_PROPS = {
6904
- style: {
6905
- width: SPECIALIZATION_ICON_SIZE,
6906
- height: SPECIALIZATION_ICON_SIZE
6907
- }
6908
- };
6909
- function iconForSpecialization(id) {
6910
- switch (id) {
6911
- case "design":
6912
- return /* @__PURE__ */ jsx13(SiconSwatch, { ...SPECIALIZATION_ICON_PROPS });
6913
- case "merchandising":
6914
- return /* @__PURE__ */ jsx13(SiconBag, { ...SPECIALIZATION_ICON_PROPS });
6915
- case "planning":
6916
- return /* @__PURE__ */ jsx13(SiconInsights, { ...SPECIALIZATION_ICON_PROPS });
6917
- case "marketing_brand":
6918
- return /* @__PURE__ */ jsx13(SiconAdCreator, { ...SPECIALIZATION_ICON_PROPS });
6919
- case "founder_operator":
6920
- return /* @__PURE__ */ jsx13(SiconCrown, { ...SPECIALIZATION_ICON_PROPS });
6921
- default:
6922
- return /* @__PURE__ */ jsx13(SiconBolt, { ...SPECIALIZATION_ICON_PROPS });
6898
+ function SpecializationIcon({ iconUrl }) {
6899
+ if (iconUrl) {
6900
+ return /* @__PURE__ */ jsx13(
6901
+ "img",
6902
+ {
6903
+ src: iconUrl,
6904
+ alt: "",
6905
+ style: {
6906
+ width: SPECIALIZATION_ICON_SIZE,
6907
+ height: SPECIALIZATION_ICON_SIZE,
6908
+ objectFit: "contain"
6909
+ }
6910
+ }
6911
+ );
6923
6912
  }
6913
+ return /* @__PURE__ */ jsx13(
6914
+ SiconBolt,
6915
+ {
6916
+ style: {
6917
+ width: SPECIALIZATION_ICON_SIZE,
6918
+ height: SPECIALIZATION_ICON_SIZE
6919
+ }
6920
+ }
6921
+ );
6924
6922
  }
6925
- var FALLBACK_SPECIALIZATIONS = [
6926
- { id: "design", label: "Design", icon: iconForSpecialization("design") },
6927
- {
6928
- id: "merchandising",
6929
- label: "Merchandising",
6930
- icon: iconForSpecialization("merchandising")
6931
- },
6932
- {
6933
- id: "planning",
6934
- label: "Planning",
6935
- icon: iconForSpecialization("planning")
6936
- },
6937
- {
6938
- id: "marketing_brand",
6939
- label: "Marketing & brand",
6940
- icon: iconForSpecialization("marketing_brand")
6941
- },
6942
- {
6943
- id: "founder_operator",
6944
- label: "Founder & operator",
6945
- icon: iconForSpecialization("founder_operator")
6946
- }
6947
- ];
6948
6923
  function SpecializationDropdown({
6949
6924
  value,
6950
6925
  onChange,
@@ -6953,20 +6928,18 @@ function SpecializationDropdown({
6953
6928
  const { auth } = useSettingsAdapters();
6954
6929
  const [open, setOpen] = useState9(false);
6955
6930
  const containerRef = useRef3(null);
6956
- const [options, setOptions] = useState9(
6957
- FALLBACK_SPECIALIZATIONS
6958
- );
6931
+ const [options, setOptions] = useState9([]);
6959
6932
  useEffect6(() => {
6960
6933
  if (!auth.getSpecializations) return;
6961
6934
  let cancelled = false;
6962
6935
  auth.getSpecializations().then((items) => {
6963
6936
  if (cancelled) return;
6964
- if (Array.isArray(items) && items.length > 0) {
6937
+ if (Array.isArray(items)) {
6965
6938
  setOptions(
6966
6939
  items.map((item) => ({
6967
6940
  id: item.id,
6968
6941
  label: item.name,
6969
- icon: iconForSpecialization(item.id)
6942
+ iconUrl: item.iconUrl
6970
6943
  }))
6971
6944
  );
6972
6945
  }
@@ -7052,7 +7025,7 @@ function SpecializationDropdown({
7052
7025
  height: 24,
7053
7026
  color: selected ? "var(--alias-text---icons-primary)" : "var(--alias-text---icons-muted)"
7054
7027
  },
7055
- children: selected ? selected.icon : /* @__PURE__ */ jsx13(SiconBolt, {})
7028
+ children: /* @__PURE__ */ jsx13(SpecializationIcon, { iconUrl: selected?.iconUrl })
7056
7029
  }
7057
7030
  ),
7058
7031
  /* @__PURE__ */ jsx13(
@@ -7147,7 +7120,7 @@ function SpecializationDropdown({
7147
7120
  width: 24,
7148
7121
  height: 24
7149
7122
  },
7150
- children: opt.icon
7123
+ children: /* @__PURE__ */ jsx13(SpecializationIcon, { iconUrl: opt.iconUrl })
7151
7124
  }
7152
7125
  ),
7153
7126
  /* @__PURE__ */ jsx13("span", { style: { flex: 1 }, children: opt.label })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoid/settings",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",