@streamoid/settings 0.1.3 → 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 +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +45 -65
- package/dist/index.mjs +46 -71
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -57,6 +57,15 @@ interface SettingsAuthUser {
|
|
|
57
57
|
(e.g. "design", "merchandising"). */
|
|
58
58
|
userSpecialization?: string;
|
|
59
59
|
}
|
|
60
|
+
/** Option shape returned by `auth.getSpecializations` — drives the
|
|
61
|
+
Specialization dropdown in Settings → Account. The host adapter is the
|
|
62
|
+
source of truth: name comes from the CMS, icon from `iconUrl`. */
|
|
63
|
+
interface SettingsUserSpecialization {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
iconUrl?: string;
|
|
68
|
+
}
|
|
60
69
|
interface SettingsAuthAdapter {
|
|
61
70
|
user: SettingsAuthUser | null;
|
|
62
71
|
refreshProfile: () => Promise<void>;
|
|
@@ -67,6 +76,9 @@ interface SettingsAuthAdapter {
|
|
|
67
76
|
}) => Promise<void>;
|
|
68
77
|
clearAuth: () => void;
|
|
69
78
|
logout: () => Promise<void>;
|
|
79
|
+
/** Optional. When present, the Specialization dropdown is populated from
|
|
80
|
+
the host's API; otherwise the package falls back to a built-in list. */
|
|
81
|
+
getSpecializations?: () => Promise<SettingsUserSpecialization[]>;
|
|
70
82
|
}
|
|
71
83
|
interface SettingsWorkspaceCurrent {
|
|
72
84
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,15 @@ interface SettingsAuthUser {
|
|
|
57
57
|
(e.g. "design", "merchandising"). */
|
|
58
58
|
userSpecialization?: string;
|
|
59
59
|
}
|
|
60
|
+
/** Option shape returned by `auth.getSpecializations` — drives the
|
|
61
|
+
Specialization dropdown in Settings → Account. The host adapter is the
|
|
62
|
+
source of truth: name comes from the CMS, icon from `iconUrl`. */
|
|
63
|
+
interface SettingsUserSpecialization {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
iconUrl?: string;
|
|
68
|
+
}
|
|
60
69
|
interface SettingsAuthAdapter {
|
|
61
70
|
user: SettingsAuthUser | null;
|
|
62
71
|
refreshProfile: () => Promise<void>;
|
|
@@ -67,6 +76,9 @@ interface SettingsAuthAdapter {
|
|
|
67
76
|
}) => Promise<void>;
|
|
68
77
|
clearAuth: () => void;
|
|
69
78
|
logout: () => Promise<void>;
|
|
79
|
+
/** Optional. When present, the Specialization dropdown is populated from
|
|
80
|
+
the host's API; otherwise the package falls back to a built-in list. */
|
|
81
|
+
getSpecializations?: () => Promise<SettingsUserSpecialization[]>;
|
|
70
82
|
}
|
|
71
83
|
interface SettingsWorkspaceCurrent {
|
|
72
84
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -6875,80 +6875,60 @@ function SettingsNav({
|
|
|
6875
6875
|
);
|
|
6876
6876
|
}
|
|
6877
6877
|
var SPECIALIZATION_ICON_SIZE = 20;
|
|
6878
|
-
|
|
6879
|
-
{
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6883
|
-
import_icons7.SiconSwatch,
|
|
6884
|
-
{
|
|
6885
|
-
style: {
|
|
6886
|
-
width: SPECIALIZATION_ICON_SIZE,
|
|
6887
|
-
height: SPECIALIZATION_ICON_SIZE
|
|
6888
|
-
}
|
|
6889
|
-
}
|
|
6890
|
-
)
|
|
6891
|
-
},
|
|
6892
|
-
{
|
|
6893
|
-
id: "merchandising",
|
|
6894
|
-
label: "Merchandising",
|
|
6895
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6896
|
-
import_icons7.SiconBag,
|
|
6897
|
-
{
|
|
6898
|
-
style: {
|
|
6899
|
-
width: SPECIALIZATION_ICON_SIZE,
|
|
6900
|
-
height: SPECIALIZATION_ICON_SIZE
|
|
6901
|
-
}
|
|
6902
|
-
}
|
|
6903
|
-
)
|
|
6904
|
-
},
|
|
6905
|
-
{
|
|
6906
|
-
id: "planning",
|
|
6907
|
-
label: "Planning",
|
|
6908
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6909
|
-
import_icons7.SiconInsights,
|
|
6910
|
-
{
|
|
6911
|
-
style: {
|
|
6912
|
-
width: SPECIALIZATION_ICON_SIZE,
|
|
6913
|
-
height: SPECIALIZATION_ICON_SIZE
|
|
6914
|
-
}
|
|
6915
|
-
}
|
|
6916
|
-
)
|
|
6917
|
-
},
|
|
6918
|
-
{
|
|
6919
|
-
id: "marketing_brand",
|
|
6920
|
-
label: "Marketing & brand",
|
|
6921
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6922
|
-
import_icons7.SiconAdCreator,
|
|
6923
|
-
{
|
|
6924
|
-
style: {
|
|
6925
|
-
width: SPECIALIZATION_ICON_SIZE,
|
|
6926
|
-
height: SPECIALIZATION_ICON_SIZE
|
|
6927
|
-
}
|
|
6928
|
-
}
|
|
6929
|
-
)
|
|
6930
|
-
},
|
|
6931
|
-
{
|
|
6932
|
-
id: "founder_operator",
|
|
6933
|
-
label: "Founder & operator",
|
|
6934
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6935
|
-
import_icons7.SiconCrown,
|
|
6878
|
+
function SpecializationIcon({ iconUrl }) {
|
|
6879
|
+
if (iconUrl) {
|
|
6880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6881
|
+
"img",
|
|
6936
6882
|
{
|
|
6883
|
+
src: iconUrl,
|
|
6884
|
+
alt: "",
|
|
6937
6885
|
style: {
|
|
6938
6886
|
width: SPECIALIZATION_ICON_SIZE,
|
|
6939
|
-
height: SPECIALIZATION_ICON_SIZE
|
|
6887
|
+
height: SPECIALIZATION_ICON_SIZE,
|
|
6888
|
+
objectFit: "contain"
|
|
6940
6889
|
}
|
|
6941
6890
|
}
|
|
6942
|
-
)
|
|
6891
|
+
);
|
|
6943
6892
|
}
|
|
6944
|
-
|
|
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
|
+
);
|
|
6902
|
+
}
|
|
6945
6903
|
function SpecializationDropdown({
|
|
6946
6904
|
value,
|
|
6947
6905
|
onChange,
|
|
6948
6906
|
disabled
|
|
6949
6907
|
}) {
|
|
6908
|
+
const { auth } = useSettingsAdapters();
|
|
6950
6909
|
const [open, setOpen] = (0, import_react10.useState)(false);
|
|
6951
6910
|
const containerRef = (0, import_react10.useRef)(null);
|
|
6911
|
+
const [options, setOptions] = (0, import_react10.useState)([]);
|
|
6912
|
+
(0, import_react10.useEffect)(() => {
|
|
6913
|
+
if (!auth.getSpecializations) return;
|
|
6914
|
+
let cancelled = false;
|
|
6915
|
+
auth.getSpecializations().then((items) => {
|
|
6916
|
+
if (cancelled) return;
|
|
6917
|
+
if (Array.isArray(items)) {
|
|
6918
|
+
setOptions(
|
|
6919
|
+
items.map((item) => ({
|
|
6920
|
+
id: item.id,
|
|
6921
|
+
label: item.name,
|
|
6922
|
+
iconUrl: item.iconUrl
|
|
6923
|
+
}))
|
|
6924
|
+
);
|
|
6925
|
+
}
|
|
6926
|
+
}).catch(() => {
|
|
6927
|
+
});
|
|
6928
|
+
return () => {
|
|
6929
|
+
cancelled = true;
|
|
6930
|
+
};
|
|
6931
|
+
}, [auth]);
|
|
6952
6932
|
(0, import_react10.useEffect)(() => {
|
|
6953
6933
|
if (!open) return;
|
|
6954
6934
|
function handleMouseDown(e) {
|
|
@@ -6966,7 +6946,7 @@ function SpecializationDropdown({
|
|
|
6966
6946
|
document.removeEventListener("keydown", handleKeyDown);
|
|
6967
6947
|
};
|
|
6968
6948
|
}, [open]);
|
|
6969
|
-
const selected =
|
|
6949
|
+
const selected = options.find((o) => o.id === value);
|
|
6970
6950
|
const labelText = selected ? selected.label : value === "unspecified" ? "Not specified" : "Select specialization";
|
|
6971
6951
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
6972
6952
|
"div",
|
|
@@ -7025,7 +7005,7 @@ function SpecializationDropdown({
|
|
|
7025
7005
|
height: 24,
|
|
7026
7006
|
color: selected ? "var(--alias-text---icons-primary)" : "var(--alias-text---icons-muted)"
|
|
7027
7007
|
},
|
|
7028
|
-
children:
|
|
7008
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SpecializationIcon, { iconUrl: selected?.iconUrl })
|
|
7029
7009
|
}
|
|
7030
7010
|
),
|
|
7031
7011
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -7079,7 +7059,7 @@ function SpecializationDropdown({
|
|
|
7079
7059
|
gap: 2,
|
|
7080
7060
|
boxShadow: "0 8px 24px rgba(0,0,0,0.4)"
|
|
7081
7061
|
},
|
|
7082
|
-
children:
|
|
7062
|
+
children: options.map((opt) => {
|
|
7083
7063
|
const isActive = opt.id === value;
|
|
7084
7064
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
7085
7065
|
"button",
|
|
@@ -7120,7 +7100,7 @@ function SpecializationDropdown({
|
|
|
7120
7100
|
width: 24,
|
|
7121
7101
|
height: 24
|
|
7122
7102
|
},
|
|
7123
|
-
children: opt.
|
|
7103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SpecializationIcon, { iconUrl: opt.iconUrl })
|
|
7124
7104
|
}
|
|
7125
7105
|
),
|
|
7126
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,80 +6895,60 @@ function SettingsNav({
|
|
|
6900
6895
|
);
|
|
6901
6896
|
}
|
|
6902
6897
|
var SPECIALIZATION_ICON_SIZE = 20;
|
|
6903
|
-
|
|
6904
|
-
{
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
icon: /* @__PURE__ */ jsx13(
|
|
6908
|
-
SiconSwatch,
|
|
6909
|
-
{
|
|
6910
|
-
style: {
|
|
6911
|
-
width: SPECIALIZATION_ICON_SIZE,
|
|
6912
|
-
height: SPECIALIZATION_ICON_SIZE
|
|
6913
|
-
}
|
|
6914
|
-
}
|
|
6915
|
-
)
|
|
6916
|
-
},
|
|
6917
|
-
{
|
|
6918
|
-
id: "merchandising",
|
|
6919
|
-
label: "Merchandising",
|
|
6920
|
-
icon: /* @__PURE__ */ jsx13(
|
|
6921
|
-
SiconBag,
|
|
6922
|
-
{
|
|
6923
|
-
style: {
|
|
6924
|
-
width: SPECIALIZATION_ICON_SIZE,
|
|
6925
|
-
height: SPECIALIZATION_ICON_SIZE
|
|
6926
|
-
}
|
|
6927
|
-
}
|
|
6928
|
-
)
|
|
6929
|
-
},
|
|
6930
|
-
{
|
|
6931
|
-
id: "planning",
|
|
6932
|
-
label: "Planning",
|
|
6933
|
-
icon: /* @__PURE__ */ jsx13(
|
|
6934
|
-
SiconInsights,
|
|
6935
|
-
{
|
|
6936
|
-
style: {
|
|
6937
|
-
width: SPECIALIZATION_ICON_SIZE,
|
|
6938
|
-
height: SPECIALIZATION_ICON_SIZE
|
|
6939
|
-
}
|
|
6940
|
-
}
|
|
6941
|
-
)
|
|
6942
|
-
},
|
|
6943
|
-
{
|
|
6944
|
-
id: "marketing_brand",
|
|
6945
|
-
label: "Marketing & brand",
|
|
6946
|
-
icon: /* @__PURE__ */ jsx13(
|
|
6947
|
-
SiconAdCreator,
|
|
6948
|
-
{
|
|
6949
|
-
style: {
|
|
6950
|
-
width: SPECIALIZATION_ICON_SIZE,
|
|
6951
|
-
height: SPECIALIZATION_ICON_SIZE
|
|
6952
|
-
}
|
|
6953
|
-
}
|
|
6954
|
-
)
|
|
6955
|
-
},
|
|
6956
|
-
{
|
|
6957
|
-
id: "founder_operator",
|
|
6958
|
-
label: "Founder & operator",
|
|
6959
|
-
icon: /* @__PURE__ */ jsx13(
|
|
6960
|
-
SiconCrown,
|
|
6898
|
+
function SpecializationIcon({ iconUrl }) {
|
|
6899
|
+
if (iconUrl) {
|
|
6900
|
+
return /* @__PURE__ */ jsx13(
|
|
6901
|
+
"img",
|
|
6961
6902
|
{
|
|
6903
|
+
src: iconUrl,
|
|
6904
|
+
alt: "",
|
|
6962
6905
|
style: {
|
|
6963
6906
|
width: SPECIALIZATION_ICON_SIZE,
|
|
6964
|
-
height: SPECIALIZATION_ICON_SIZE
|
|
6907
|
+
height: SPECIALIZATION_ICON_SIZE,
|
|
6908
|
+
objectFit: "contain"
|
|
6965
6909
|
}
|
|
6966
6910
|
}
|
|
6967
|
-
)
|
|
6911
|
+
);
|
|
6968
6912
|
}
|
|
6969
|
-
|
|
6913
|
+
return /* @__PURE__ */ jsx13(
|
|
6914
|
+
SiconBolt,
|
|
6915
|
+
{
|
|
6916
|
+
style: {
|
|
6917
|
+
width: SPECIALIZATION_ICON_SIZE,
|
|
6918
|
+
height: SPECIALIZATION_ICON_SIZE
|
|
6919
|
+
}
|
|
6920
|
+
}
|
|
6921
|
+
);
|
|
6922
|
+
}
|
|
6970
6923
|
function SpecializationDropdown({
|
|
6971
6924
|
value,
|
|
6972
6925
|
onChange,
|
|
6973
6926
|
disabled
|
|
6974
6927
|
}) {
|
|
6928
|
+
const { auth } = useSettingsAdapters();
|
|
6975
6929
|
const [open, setOpen] = useState9(false);
|
|
6976
6930
|
const containerRef = useRef3(null);
|
|
6931
|
+
const [options, setOptions] = useState9([]);
|
|
6932
|
+
useEffect6(() => {
|
|
6933
|
+
if (!auth.getSpecializations) return;
|
|
6934
|
+
let cancelled = false;
|
|
6935
|
+
auth.getSpecializations().then((items) => {
|
|
6936
|
+
if (cancelled) return;
|
|
6937
|
+
if (Array.isArray(items)) {
|
|
6938
|
+
setOptions(
|
|
6939
|
+
items.map((item) => ({
|
|
6940
|
+
id: item.id,
|
|
6941
|
+
label: item.name,
|
|
6942
|
+
iconUrl: item.iconUrl
|
|
6943
|
+
}))
|
|
6944
|
+
);
|
|
6945
|
+
}
|
|
6946
|
+
}).catch(() => {
|
|
6947
|
+
});
|
|
6948
|
+
return () => {
|
|
6949
|
+
cancelled = true;
|
|
6950
|
+
};
|
|
6951
|
+
}, [auth]);
|
|
6977
6952
|
useEffect6(() => {
|
|
6978
6953
|
if (!open) return;
|
|
6979
6954
|
function handleMouseDown(e) {
|
|
@@ -6991,7 +6966,7 @@ function SpecializationDropdown({
|
|
|
6991
6966
|
document.removeEventListener("keydown", handleKeyDown);
|
|
6992
6967
|
};
|
|
6993
6968
|
}, [open]);
|
|
6994
|
-
const selected =
|
|
6969
|
+
const selected = options.find((o) => o.id === value);
|
|
6995
6970
|
const labelText = selected ? selected.label : value === "unspecified" ? "Not specified" : "Select specialization";
|
|
6996
6971
|
return /* @__PURE__ */ jsxs11(
|
|
6997
6972
|
"div",
|
|
@@ -7050,7 +7025,7 @@ function SpecializationDropdown({
|
|
|
7050
7025
|
height: 24,
|
|
7051
7026
|
color: selected ? "var(--alias-text---icons-primary)" : "var(--alias-text---icons-muted)"
|
|
7052
7027
|
},
|
|
7053
|
-
children:
|
|
7028
|
+
children: /* @__PURE__ */ jsx13(SpecializationIcon, { iconUrl: selected?.iconUrl })
|
|
7054
7029
|
}
|
|
7055
7030
|
),
|
|
7056
7031
|
/* @__PURE__ */ jsx13(
|
|
@@ -7104,7 +7079,7 @@ function SpecializationDropdown({
|
|
|
7104
7079
|
gap: 2,
|
|
7105
7080
|
boxShadow: "0 8px 24px rgba(0,0,0,0.4)"
|
|
7106
7081
|
},
|
|
7107
|
-
children:
|
|
7082
|
+
children: options.map((opt) => {
|
|
7108
7083
|
const isActive = opt.id === value;
|
|
7109
7084
|
return /* @__PURE__ */ jsxs11(
|
|
7110
7085
|
"button",
|
|
@@ -7145,7 +7120,7 @@ function SpecializationDropdown({
|
|
|
7145
7120
|
width: 24,
|
|
7146
7121
|
height: 24
|
|
7147
7122
|
},
|
|
7148
|
-
children: opt.
|
|
7123
|
+
children: /* @__PURE__ */ jsx13(SpecializationIcon, { iconUrl: opt.iconUrl })
|
|
7149
7124
|
}
|
|
7150
7125
|
),
|
|
7151
7126
|
/* @__PURE__ */ jsx13("span", { style: { flex: 1 }, children: opt.label })
|