@thunderid/vue 0.12.0 → 0.13.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/api/getUsersMeMeta.d.ts +22 -0
- package/dist/api/getUsersMeMeta.d.ts.map +1 -0
- package/dist/cjs/index.cjs +430 -239
- package/dist/components/presentation/user-dropdown/BaseUserDropdown.d.ts.map +1 -1
- package/dist/components/presentation/user-dropdown/UserDropdown.css.d.ts +1 -1
- package/dist/components/presentation/user-dropdown/UserDropdown.css.d.ts.map +1 -1
- package/dist/components/presentation/user-profile/BaseUserProfile.d.ts +4 -1
- package/dist/components/presentation/user-profile/BaseUserProfile.d.ts.map +1 -1
- package/dist/components/presentation/user-profile/UserProfile.css.d.ts +2 -12
- package/dist/components/presentation/user-profile/UserProfile.css.d.ts.map +1 -1
- package/dist/components/presentation/user-profile/UserProfile.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +432 -242
- package/dist/models/contexts.d.ts +9 -5
- package/dist/models/contexts.d.ts.map +1 -1
- package/dist/plugins/ThunderIDPlugin.d.ts +5 -0
- package/dist/plugins/ThunderIDPlugin.d.ts.map +1 -1
- package/dist/providers/ThunderIDProvider.d.ts.map +1 -1
- package/dist/providers/UserProvider.d.ts.map +1 -1
- package/dist/styles/injectStyles.d.ts +4 -1
- package/dist/styles/injectStyles.d.ts.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConsentConstants, DEFAULT_THEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowComponentType as EmbeddedFlowComponentType$1, EmbeddedFlowEventType, EmbeddedFlowEventType as EmbeddedFlowEventType$1, EmbeddedFlowResponseType, EmbeddedFlowTextVariant, EmbeddedFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowStatus as EmbeddedSignInFlowStatus$1, EmbeddedSignInFlowType, EmbeddedSignInFlowType as EmbeddedSignInFlowType$1, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowStatus as EmbeddedSignUpFlowStatus$1, EmbeddedSignUpFlowType, FetchHttpClient, FieldType, FieldType as FieldType$1, FlowMetaType, ThunderIDAPIError, ThunderIDBrowserClient, ThunderIDError, ThunderIDRuntimeError, ThunderIDRuntimeError as ThunderIDRuntimeError$1, TranslationBundleConstants, arrayBufferToBase64url, base64urlToArrayBuffer, createClassObserver, createClassObserver as createClassObserver$1, createMediaQueryListener, createMediaQueryListener as createMediaQueryListener$1, createPackageComponentLogger, createPackageLogger, createTheme, deepMerge, detectThemeMode, detectThemeMode as detectThemeMode$1, executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow, extractEmojiFromUri, extractUserClaimsFromIdToken, generateFlattenedUserProfile, get, getActiveTheme, getDefaultI18nBundles, getFlowMeta, getUsersMe, getVendorPrefix, handleWebAuthnAuthentication, hasAuthParamsInUrl, hasAuthParamsInUrl as hasAuthParamsInUrl$1, hasCalledForThisInstanceInUrl, http, isEmojiUri, isEmpty, navigate, navigate as navigate$1, normalizeBorderRadius, normalizeTranslations, resolveFlowTemplateLiterals, resolveLogoUri, resolveResourceEndpoint, updateMeProfile, withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
2
|
-
import { Fragment, computed, defineComponent, h, inject, nextTick, onBeforeUnmount, onMounted, onUnmounted, provide, readonly, ref, shallowReadonly, shallowRef, watch } from "vue";
|
|
1
|
+
import { ConsentConstants, DEFAULT_THEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowComponentType as EmbeddedFlowComponentType$1, EmbeddedFlowEventType, EmbeddedFlowEventType as EmbeddedFlowEventType$1, EmbeddedFlowResponseType, EmbeddedFlowTextVariant, EmbeddedFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowStatus as EmbeddedSignInFlowStatus$1, EmbeddedSignInFlowType, EmbeddedSignInFlowType as EmbeddedSignInFlowType$1, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowStatus as EmbeddedSignUpFlowStatus$1, EmbeddedSignUpFlowType, FetchHttpClient, FieldType, FieldType as FieldType$1, FlowMetaType, ThunderIDAPIError, ThunderIDBrowserClient, ThunderIDError, ThunderIDRuntimeError, ThunderIDRuntimeError as ThunderIDRuntimeError$1, TranslationBundleConstants, arrayBufferToBase64url, base64urlToArrayBuffer, createClassObserver, createClassObserver as createClassObserver$1, createMediaQueryListener, createMediaQueryListener as createMediaQueryListener$1, createPackageComponentLogger, createPackageLogger, createTheme, deepMerge, detectThemeMode, detectThemeMode as detectThemeMode$1, executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow, extractEmojiFromUri, extractUserClaimsFromIdToken, generateFlattenedUserProfile, get, getActiveTheme, getDefaultI18nBundles, getFlowMeta, getUsersMe, getUsersMeMeta, getVendorPrefix, handleWebAuthnAuthentication, hasAuthParamsInUrl, hasAuthParamsInUrl as hasAuthParamsInUrl$1, hasCalledForThisInstanceInUrl, http, isEmojiUri, isEmpty, navigate, navigate as navigate$1, normalizeBorderRadius, normalizeTranslations, resolveFlowTemplateLiterals, resolveLogoUri, resolveResourceEndpoint, startCase, updateMeProfile, withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
2
|
+
import { Fragment, Teleport, computed, defineComponent, h, inject, nextTick, onBeforeUnmount, onMounted, onUnmounted, provide, readonly, ref, shallowReadonly, shallowRef, watch } from "vue";
|
|
3
3
|
import DOMPurify from "dompurify";
|
|
4
4
|
|
|
5
5
|
//#region src/keys.ts
|
|
@@ -548,20 +548,23 @@ const UserProvider = defineComponent({
|
|
|
548
548
|
updateProfile: {
|
|
549
549
|
default: void 0,
|
|
550
550
|
type: Function
|
|
551
|
+
},
|
|
552
|
+
userSchema: {
|
|
553
|
+
default: null,
|
|
554
|
+
type: Object
|
|
551
555
|
}
|
|
552
556
|
},
|
|
553
557
|
setup(props, { slots }) {
|
|
554
558
|
const profileRef = computed(() => props.profile);
|
|
559
|
+
const flattenedProfileRef = computed(() => props.profile?.flattenedProfile ?? null);
|
|
560
|
+
const userSchemaRef = computed(() => props.profile?.userSchema ?? props.userSchema ?? null);
|
|
555
561
|
provide(USER_KEY, {
|
|
556
|
-
flattenedProfile:
|
|
562
|
+
flattenedProfile: flattenedProfileRef,
|
|
557
563
|
onUpdateProfile: props.onUpdateProfile ?? (() => {}),
|
|
558
564
|
profile: profileRef,
|
|
559
565
|
revalidateProfile: props.revalidateProfile,
|
|
560
|
-
updateProfile: props.updateProfile
|
|
561
|
-
|
|
562
|
-
error: "updateProfile callback not provided",
|
|
563
|
-
success: false
|
|
564
|
-
}))
|
|
566
|
+
updateProfile: props.updateProfile,
|
|
567
|
+
userSchema: userSchemaRef
|
|
565
568
|
});
|
|
566
569
|
return () => h("div", { style: "display:contents" }, slots["default"]?.());
|
|
567
570
|
}
|
|
@@ -592,6 +595,34 @@ const getUsersMe$1 = async ({ fetcher, instanceId = 0,...requestConfig }) => {
|
|
|
592
595
|
};
|
|
593
596
|
var getUsersMe_default = getUsersMe$1;
|
|
594
597
|
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region src/api/getUsersMeMeta.ts
|
|
600
|
+
/**
|
|
601
|
+
* Retrieves the user schema metadata from the specified /users/me/meta endpoint.
|
|
602
|
+
* Uses ThunderID SPA client FetchHttpClient by default with multi-instance support.
|
|
603
|
+
*/
|
|
604
|
+
const getUsersMeMeta$1 = async ({ fetcher, instanceId = 0,...requestConfig }) => {
|
|
605
|
+
const defaultFetcher = async (url, config) => {
|
|
606
|
+
const response = await FetchHttpClient.getInstance(instanceId).request({
|
|
607
|
+
headers: config.headers,
|
|
608
|
+
method: config.method ?? "GET",
|
|
609
|
+
url
|
|
610
|
+
});
|
|
611
|
+
return {
|
|
612
|
+
json: () => Promise.resolve(response.data),
|
|
613
|
+
ok: response.status >= 200 && response.status < 300,
|
|
614
|
+
status: response.status,
|
|
615
|
+
statusText: response.statusText || "",
|
|
616
|
+
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
617
|
+
};
|
|
618
|
+
};
|
|
619
|
+
return getUsersMeMeta({
|
|
620
|
+
...requestConfig,
|
|
621
|
+
fetcher: fetcher ?? defaultFetcher
|
|
622
|
+
});
|
|
623
|
+
};
|
|
624
|
+
var getUsersMeMeta_default = getUsersMeMeta$1;
|
|
625
|
+
|
|
595
626
|
//#endregion
|
|
596
627
|
//#region src/ThunderIDVueClient.ts
|
|
597
628
|
/**
|
|
@@ -837,6 +868,10 @@ const ThunderIDProvider = defineComponent({
|
|
|
837
868
|
default: void 0,
|
|
838
869
|
type: String
|
|
839
870
|
},
|
|
871
|
+
preferences: {
|
|
872
|
+
default: void 0,
|
|
873
|
+
type: Object
|
|
874
|
+
},
|
|
840
875
|
scopes: {
|
|
841
876
|
default: void 0,
|
|
842
877
|
type: [Array, String]
|
|
@@ -874,6 +909,7 @@ const ThunderIDProvider = defineComponent({
|
|
|
874
909
|
const isLoading = ref(true);
|
|
875
910
|
const user = shallowRef(null);
|
|
876
911
|
const userProfile = shallowRef(null);
|
|
912
|
+
const userSchema = ref(null);
|
|
877
913
|
const resolvedBaseUrl = ref(props.baseUrl);
|
|
878
914
|
let isUpdatingSession = false;
|
|
879
915
|
let signInCheckInterval;
|
|
@@ -888,6 +924,7 @@ const ThunderIDProvider = defineComponent({
|
|
|
888
924
|
endpoints: props.endpoints,
|
|
889
925
|
organizationChain: props.organizationChain,
|
|
890
926
|
organizationHandle: props.organizationHandle,
|
|
927
|
+
preferences: props.preferences,
|
|
891
928
|
scopes: props.scopes,
|
|
892
929
|
signInOptions: props.signInOptions,
|
|
893
930
|
signInUrl: props.signInUrl,
|
|
@@ -907,13 +944,40 @@ const ThunderIDProvider = defineComponent({
|
|
|
907
944
|
baseUrl = `${(await client.getConfiguration()).baseUrl}/o`;
|
|
908
945
|
resolvedBaseUrl.value = baseUrl;
|
|
909
946
|
}
|
|
947
|
+
const shouldFetchProfile = props.preferences?.user?.fetchUserProfile !== false;
|
|
910
948
|
const claims = extractUserClaimsFromIdToken(decodedToken);
|
|
911
|
-
|
|
949
|
+
let profileData = claims;
|
|
950
|
+
const currentSignInStatus = await client.isSignedIn();
|
|
951
|
+
if (currentSignInStatus && shouldFetchProfile) {
|
|
952
|
+
try {
|
|
953
|
+
const fetchedProfile = await getUsersMe_default({
|
|
954
|
+
baseUrl,
|
|
955
|
+
url: resolveResourceEndpoint("usersMe", { endpoints: props.endpoints }),
|
|
956
|
+
instanceId: props.instanceId
|
|
957
|
+
});
|
|
958
|
+
profileData = {
|
|
959
|
+
...claims,
|
|
960
|
+
...fetchedProfile
|
|
961
|
+
};
|
|
962
|
+
} catch {}
|
|
963
|
+
try {
|
|
964
|
+
const metaRes = await getUsersMeMeta_default({
|
|
965
|
+
baseUrl,
|
|
966
|
+
url: resolveResourceEndpoint("usersMeMeta", { endpoints: props.endpoints }),
|
|
967
|
+
instanceId: props.instanceId
|
|
968
|
+
});
|
|
969
|
+
if (metaRes?.schema) userSchema.value = metaRes.schema;
|
|
970
|
+
else userSchema.value = null;
|
|
971
|
+
} catch {
|
|
972
|
+
userSchema.value = null;
|
|
973
|
+
}
|
|
974
|
+
} else userSchema.value = null;
|
|
975
|
+
user.value = profileData;
|
|
912
976
|
userProfile.value = {
|
|
913
|
-
flattenedProfile:
|
|
914
|
-
profile:
|
|
977
|
+
flattenedProfile: generateFlattenedUserProfile(profileData),
|
|
978
|
+
profile: profileData
|
|
915
979
|
};
|
|
916
|
-
isSignedIn.value =
|
|
980
|
+
isSignedIn.value = currentSignInStatus;
|
|
917
981
|
} catch {} finally {
|
|
918
982
|
isUpdatingSession = false;
|
|
919
983
|
isLoading.value = client.isLoading();
|
|
@@ -979,6 +1043,7 @@ const ThunderIDProvider = defineComponent({
|
|
|
979
1043
|
isLoading,
|
|
980
1044
|
isSignedIn,
|
|
981
1045
|
organizationHandle: props.organizationHandle,
|
|
1046
|
+
preferences: props.preferences,
|
|
982
1047
|
reInitialize: async (config) => {
|
|
983
1048
|
const result = await client.reInitialize(config);
|
|
984
1049
|
return typeof result === "boolean" ? result : true;
|
|
@@ -992,6 +1057,7 @@ const ThunderIDProvider = defineComponent({
|
|
|
992
1057
|
signUpUrl: props.signUpUrl,
|
|
993
1058
|
storage: props.storage,
|
|
994
1059
|
user,
|
|
1060
|
+
userSchema,
|
|
995
1061
|
vendor
|
|
996
1062
|
});
|
|
997
1063
|
onMounted(async () => {
|
|
@@ -1057,15 +1123,9 @@ const ThunderIDProvider = defineComponent({
|
|
|
1057
1123
|
},
|
|
1058
1124
|
profile: userProfile.value,
|
|
1059
1125
|
revalidateProfile: async () => {
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
userProfile.value = {
|
|
1064
|
-
flattenedProfile: claims,
|
|
1065
|
-
profile: claims
|
|
1066
|
-
};
|
|
1067
|
-
} catch {}
|
|
1068
|
-
}
|
|
1126
|
+
await updateSession();
|
|
1127
|
+
},
|
|
1128
|
+
userSchema: userSchema.value
|
|
1069
1129
|
}, { default: () => slots["default"]?.() }) }) }) }) });
|
|
1070
1130
|
}
|
|
1071
1131
|
});
|
|
@@ -1482,6 +1542,8 @@ const USER_DROPDOWN_CSS = `
|
|
|
1482
1542
|
justify-content: center;
|
|
1483
1543
|
width: 32px;
|
|
1484
1544
|
height: 32px;
|
|
1545
|
+
max-width: 32px;
|
|
1546
|
+
max-height: 32px;
|
|
1485
1547
|
border-radius: 50%;
|
|
1486
1548
|
color: #ffffff;
|
|
1487
1549
|
flex-shrink: 0;
|
|
@@ -1490,12 +1552,20 @@ const USER_DROPDOWN_CSS = `
|
|
|
1490
1552
|
line-height: 1;
|
|
1491
1553
|
user-select: none;
|
|
1492
1554
|
pointer-events: none;
|
|
1555
|
+
object-fit: cover;
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
img.thunderid-user-dropdown__avatar {
|
|
1559
|
+
object-fit: cover;
|
|
1560
|
+
border-radius: 50%;
|
|
1493
1561
|
}
|
|
1494
1562
|
|
|
1495
1563
|
/* sm — 28 px */
|
|
1496
1564
|
.thunderid-user-dropdown__avatar--sm {
|
|
1497
1565
|
width: 28px;
|
|
1498
1566
|
height: 28px;
|
|
1567
|
+
max-width: 28px;
|
|
1568
|
+
max-height: 28px;
|
|
1499
1569
|
font-size: var(--thunder-typography-fontSize-xs);
|
|
1500
1570
|
}
|
|
1501
1571
|
|
|
@@ -1503,6 +1573,8 @@ const USER_DROPDOWN_CSS = `
|
|
|
1503
1573
|
.thunderid-user-dropdown__avatar--lg {
|
|
1504
1574
|
width: 38px;
|
|
1505
1575
|
height: 38px;
|
|
1576
|
+
max-width: 38px;
|
|
1577
|
+
max-height: 38px;
|
|
1506
1578
|
font-size: var(--thunder-typography-fontSize-md);
|
|
1507
1579
|
}
|
|
1508
1580
|
|
|
@@ -1622,6 +1694,12 @@ const USER_DROPDOWN_CSS = `
|
|
|
1622
1694
|
font-weight: var(--thunder-typography-fontWeight-semibold);
|
|
1623
1695
|
line-height: 1;
|
|
1624
1696
|
user-select: none;
|
|
1697
|
+
object-fit: cover;
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
img.thunderid-user-dropdown__menu-header-avatar {
|
|
1701
|
+
object-fit: cover;
|
|
1702
|
+
border-radius: 50%;
|
|
1625
1703
|
}
|
|
1626
1704
|
|
|
1627
1705
|
.thunderid-user-dropdown__menu-header-info {
|
|
@@ -1708,6 +1786,7 @@ const USER_DROPDOWN_CSS = `
|
|
|
1708
1786
|
justify-content: center;
|
|
1709
1787
|
z-index: 9999;
|
|
1710
1788
|
backdrop-filter: blur(3px);
|
|
1789
|
+
box-sizing: border-box;
|
|
1711
1790
|
animation: thunderid-overlay-enter var(--thunder-transition-fast) ease;
|
|
1712
1791
|
}
|
|
1713
1792
|
|
|
@@ -1722,11 +1801,14 @@ const USER_DROPDOWN_CSS = `
|
|
|
1722
1801
|
background: var(--thunder-color-background-surface);
|
|
1723
1802
|
border-radius: var(--thunder-border-radius-large);
|
|
1724
1803
|
box-shadow: var(--thunder-shadow-large);
|
|
1725
|
-
max-width:
|
|
1804
|
+
max-width: 640px;
|
|
1726
1805
|
width: 92%;
|
|
1727
1806
|
max-height: 90vh;
|
|
1728
1807
|
overflow-y: auto;
|
|
1729
1808
|
position: relative;
|
|
1809
|
+
margin: auto;
|
|
1810
|
+
padding: calc(var(--thunder-spacing-unit) * 3);
|
|
1811
|
+
box-sizing: border-box;
|
|
1730
1812
|
animation: thunderid-modal-enter var(--thunder-transition-normal) ease;
|
|
1731
1813
|
}
|
|
1732
1814
|
|
|
@@ -1779,51 +1861,24 @@ var UserDropdown_css_default = USER_DROPDOWN_CSS;
|
|
|
1779
1861
|
//#region src/components/presentation/user-profile/UserProfile.css.ts
|
|
1780
1862
|
/**
|
|
1781
1863
|
* Styles for the UserProfile presentation component.
|
|
1782
|
-
*
|
|
1783
|
-
* BEM block: `.thunderid-user-profile`
|
|
1784
|
-
*
|
|
1785
|
-
* Modifiers:
|
|
1786
|
-
* --compact – reduced field padding for modal / dropdown embedding
|
|
1787
|
-
*
|
|
1788
|
-
* New elements in this version:
|
|
1789
|
-
* __hero – avatar + name + subtitle banner
|
|
1790
|
-
* __avatar--sm/md/lg – avatar size variants
|
|
1791
|
-
* __hero-name – prominent display name
|
|
1792
|
-
* __hero-subtitle – secondary line (email / username)
|
|
1864
|
+
* Parity target: `@thunderid/react` BaseUserProfile.styles.ts
|
|
1793
1865
|
*/
|
|
1794
1866
|
const USER_PROFILE_CSS = `
|
|
1795
1867
|
/* ============================================================
|
|
1796
|
-
UserProfile
|
|
1868
|
+
UserProfile (React Parity)
|
|
1797
1869
|
============================================================ */
|
|
1798
1870
|
|
|
1799
1871
|
.thunderid-user-profile {
|
|
1800
1872
|
display: flex;
|
|
1801
1873
|
flex-direction: column;
|
|
1802
|
-
|
|
1803
|
-
|
|
1874
|
+
padding: calc(var(--thunder-spacing-unit) * 4);
|
|
1875
|
+
width: 100%;
|
|
1876
|
+
max-width: 600px;
|
|
1877
|
+
margin: 0 auto;
|
|
1804
1878
|
font-family: var(--thunder-typography-fontFamily);
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
.thunderid-user-profile__header {
|
|
1810
|
-
display: flex;
|
|
1811
|
-
align-items: center;
|
|
1812
|
-
justify-content: space-between;
|
|
1813
|
-
padding: calc(var(--thunder-spacing-unit) * 2) calc(var(--thunder-spacing-unit) * 2.5)
|
|
1814
|
-
calc(var(--thunder-spacing-unit) * 1.75);
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
.thunderid-user-profile__title {
|
|
1818
|
-
margin: 0;
|
|
1819
|
-
font-size: var(--thunder-typography-fontSize-md);
|
|
1820
|
-
font-weight: var(--thunder-typography-fontWeight-semibold);
|
|
1821
|
-
color: var(--thunder-color-text-primary);
|
|
1822
|
-
letter-spacing: var(--thunder-typography-letterSpacing-tight);
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
.thunderid-user-profile__header-divider {
|
|
1826
|
-
margin: 0;
|
|
1879
|
+
background: var(--thunder-color-background-surface);
|
|
1880
|
+
border-radius: var(--thunder-border-radius-large, 8px);
|
|
1881
|
+
box-sizing: border-box;
|
|
1827
1882
|
}
|
|
1828
1883
|
|
|
1829
1884
|
/* ── Hero (avatar + name + subtitle) ────────────────────────── */
|
|
@@ -1831,43 +1886,35 @@ const USER_PROFILE_CSS = `
|
|
|
1831
1886
|
.thunderid-user-profile__hero {
|
|
1832
1887
|
display: flex;
|
|
1833
1888
|
flex-direction: column;
|
|
1834
|
-
align-items:
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
background: linear-gradient(
|
|
1839
|
-
180deg,
|
|
1840
|
-
var(--thunder-color-primary-light) 0%,
|
|
1841
|
-
var(--thunder-color-background-surface) 100%
|
|
1842
|
-
);
|
|
1889
|
+
align-items: flex-start;
|
|
1890
|
+
gap: calc(var(--thunder-spacing-unit) * 1);
|
|
1891
|
+
padding-bottom: calc(var(--thunder-spacing-unit) * 2);
|
|
1892
|
+
margin-bottom: calc(var(--thunder-spacing-unit) * 2);
|
|
1843
1893
|
border-bottom: 1px solid var(--thunder-color-border);
|
|
1844
1894
|
}
|
|
1845
1895
|
|
|
1846
1896
|
.thunderid-user-profile__avatar-wrapper {
|
|
1847
1897
|
position: relative;
|
|
1848
1898
|
border-radius: 50%;
|
|
1849
|
-
padding: 3px;
|
|
1850
|
-
background: linear-gradient(
|
|
1851
|
-
135deg,
|
|
1852
|
-
var(--thunder-color-primary-main),
|
|
1853
|
-
var(--thunder-color-primary-dark)
|
|
1854
|
-
);
|
|
1855
|
-
box-shadow: 0 4px 14px rgba(75, 110, 245, 0.28);
|
|
1856
1899
|
}
|
|
1857
1900
|
|
|
1858
1901
|
.thunderid-user-profile__avatar {
|
|
1859
|
-
|
|
1860
|
-
|
|
1902
|
+
border-radius: 50%;
|
|
1903
|
+
object-fit: cover;
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
img.thunderid-user-profile__avatar {
|
|
1907
|
+
border-radius: 50%;
|
|
1908
|
+
object-fit: cover;
|
|
1909
|
+
width: 70px;
|
|
1910
|
+
height: 70px;
|
|
1861
1911
|
border-radius: 50%;
|
|
1862
1912
|
display: flex;
|
|
1863
1913
|
align-items: center;
|
|
1864
1914
|
justify-content: center;
|
|
1865
1915
|
flex-shrink: 0;
|
|
1866
|
-
border: 2px solid var(--thunder-color-background-surface);
|
|
1867
1916
|
}
|
|
1868
1917
|
|
|
1869
|
-
/* Avatar size variants */
|
|
1870
|
-
|
|
1871
1918
|
.thunderid-user-profile__avatar--sm {
|
|
1872
1919
|
width: 48px;
|
|
1873
1920
|
height: 48px;
|
|
@@ -1887,17 +1934,17 @@ const USER_PROFILE_CSS = `
|
|
|
1887
1934
|
}
|
|
1888
1935
|
|
|
1889
1936
|
.thunderid-user-profile__avatar--lg {
|
|
1890
|
-
width:
|
|
1891
|
-
height:
|
|
1937
|
+
width: 70px;
|
|
1938
|
+
height: 70px;
|
|
1892
1939
|
}
|
|
1893
1940
|
|
|
1894
1941
|
.thunderid-user-profile__avatar--lg .thunderid-user-profile__avatar-initials {
|
|
1895
|
-
font-size: 1.
|
|
1942
|
+
font-size: 1.5rem;
|
|
1896
1943
|
}
|
|
1897
1944
|
|
|
1898
1945
|
.thunderid-user-profile__avatar-initials {
|
|
1899
1946
|
color: #ffffff;
|
|
1900
|
-
font-weight: var(--thunder-typography-fontWeight-semibold);
|
|
1947
|
+
font-weight: var(--thunder-typography-fontWeight-semibold, 600);
|
|
1901
1948
|
line-height: 1;
|
|
1902
1949
|
letter-spacing: 0.02em;
|
|
1903
1950
|
pointer-events: none;
|
|
@@ -1907,37 +1954,36 @@ const USER_PROFILE_CSS = `
|
|
|
1907
1954
|
.thunderid-user-profile__hero-info {
|
|
1908
1955
|
display: flex;
|
|
1909
1956
|
flex-direction: column;
|
|
1910
|
-
align-items:
|
|
1911
|
-
|
|
1912
|
-
text-align: center;
|
|
1957
|
+
align-items: flex-start;
|
|
1958
|
+
margin-top: calc(var(--thunder-spacing-unit) * 0.5);
|
|
1913
1959
|
}
|
|
1914
1960
|
|
|
1915
1961
|
.thunderid-user-profile__hero-name {
|
|
1916
|
-
font-size: var(--thunder-typography-fontSize-
|
|
1917
|
-
font-weight: var(--thunder-typography-fontWeight-semibold);
|
|
1962
|
+
font-size: var(--thunder-typography-fontSize-xl, 1.5rem);
|
|
1963
|
+
font-weight: var(--thunder-typography-fontWeight-semibold, 600);
|
|
1918
1964
|
color: var(--thunder-color-text-primary);
|
|
1919
|
-
|
|
1920
|
-
|
|
1965
|
+
margin: 0;
|
|
1966
|
+
line-height: var(--thunder-typography-lineHeight-tight, 1.2);
|
|
1921
1967
|
}
|
|
1922
1968
|
|
|
1923
1969
|
.thunderid-user-profile__hero-subtitle {
|
|
1924
|
-
font-size: var(--thunder-typography-fontSize-sm);
|
|
1970
|
+
font-size: var(--thunder-typography-fontSize-sm, 0.875rem);
|
|
1925
1971
|
color: var(--thunder-color-text-secondary);
|
|
1926
|
-
|
|
1972
|
+
margin-top: calc(var(--thunder-spacing-unit) * 0.5);
|
|
1973
|
+
line-height: var(--thunder-typography-lineHeight-normal, 1.4);
|
|
1927
1974
|
}
|
|
1928
1975
|
|
|
1929
1976
|
/* ── Alerts & loading ────────────────────────────────────────── */
|
|
1930
1977
|
|
|
1931
1978
|
.thunderid-user-profile__error {
|
|
1932
|
-
margin: calc(var(--thunder-spacing-unit) *
|
|
1933
|
-
calc(var(--thunder-spacing-unit) * 0.5);
|
|
1979
|
+
margin-bottom: calc(var(--thunder-spacing-unit) * 3);
|
|
1934
1980
|
}
|
|
1935
1981
|
|
|
1936
1982
|
.thunderid-user-profile__loading {
|
|
1937
1983
|
display: flex;
|
|
1938
1984
|
align-items: center;
|
|
1939
1985
|
justify-content: center;
|
|
1940
|
-
padding: calc(var(--thunder-spacing-unit) *
|
|
1986
|
+
padding: calc(var(--thunder-spacing-unit) * 4) 0;
|
|
1941
1987
|
}
|
|
1942
1988
|
|
|
1943
1989
|
/* ── Fields ──────────────────────────────────────────────────── */
|
|
@@ -1948,141 +1994,119 @@ const USER_PROFILE_CSS = `
|
|
|
1948
1994
|
}
|
|
1949
1995
|
|
|
1950
1996
|
.thunderid-user-profile__field {
|
|
1951
|
-
display:
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
padding: calc(var(--thunder-spacing-unit) * 1.5)
|
|
1955
|
-
|
|
1997
|
+
display: flex;
|
|
1998
|
+
align-items: center;
|
|
1999
|
+
justify-content: space-between;
|
|
2000
|
+
padding: calc(var(--thunder-spacing-unit) * 1.5) 0;
|
|
2001
|
+
border-bottom: 1px solid var(--thunder-color-border);
|
|
2002
|
+
min-height: 28px;
|
|
1956
2003
|
box-sizing: border-box;
|
|
1957
|
-
transition: background-color var(--thunder-transition-fast);
|
|
1958
2004
|
}
|
|
1959
2005
|
|
|
1960
|
-
.thunderid-user-profile__field:
|
|
1961
|
-
|
|
2006
|
+
.thunderid-user-profile__field:last-child {
|
|
2007
|
+
border-bottom: none;
|
|
1962
2008
|
}
|
|
1963
2009
|
|
|
1964
|
-
.thunderid-user-profile__field
|
|
1965
|
-
|
|
2010
|
+
.thunderid-user-profile__field-inner {
|
|
2011
|
+
flex: 1;
|
|
2012
|
+
display: flex;
|
|
2013
|
+
align-items: center;
|
|
2014
|
+
gap: var(--thunder-spacing-unit);
|
|
1966
2015
|
}
|
|
1967
2016
|
|
|
1968
2017
|
.thunderid-user-profile__field-label {
|
|
2018
|
+
font-size: var(--thunder-typography-fontSize-sm, 0.875rem);
|
|
2019
|
+
font-weight: var(--thunder-typography-fontWeight-medium, 500);
|
|
1969
2020
|
color: var(--thunder-color-text-secondary);
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
.thunderid-user-profile__field-display {
|
|
1976
|
-
display: flex;
|
|
1977
|
-
align-items: center;
|
|
1978
|
-
justify-content: space-between;
|
|
1979
|
-
gap: calc(var(--thunder-spacing-unit) * 0.5);
|
|
1980
|
-
min-height: 1.5rem;
|
|
2021
|
+
width: 120px;
|
|
2022
|
+
flex-shrink: 0;
|
|
2023
|
+
line-height: 28px;
|
|
2024
|
+
text-align: start;
|
|
1981
2025
|
}
|
|
1982
2026
|
|
|
1983
2027
|
.thunderid-user-profile__field-value {
|
|
1984
2028
|
color: var(--thunder-color-text-primary);
|
|
1985
|
-
word-break: break-word;
|
|
1986
2029
|
flex: 1;
|
|
1987
|
-
|
|
2030
|
+
display: inline-block;
|
|
2031
|
+
align-items: center;
|
|
2032
|
+
font-size: var(--thunder-typography-fontSize-sm, 0.875rem);
|
|
2033
|
+
line-height: 28px;
|
|
2034
|
+
word-break: break-word;
|
|
2035
|
+
text-overflow: ellipsis;
|
|
2036
|
+
white-space: nowrap;
|
|
2037
|
+
max-width: 350px;
|
|
2038
|
+
text-align: start;
|
|
2039
|
+
overflow: hidden;
|
|
1988
2040
|
}
|
|
1989
2041
|
|
|
1990
2042
|
.thunderid-user-profile__field-placeholder {
|
|
1991
|
-
|
|
1992
|
-
font-size: var(--thunder-typography-fontSize-sm);
|
|
2043
|
+
font-size: var(--thunder-typography-fontSize-sm, 0.875rem);
|
|
1993
2044
|
font-style: italic;
|
|
1994
|
-
|
|
2045
|
+
color: var(--thunder-color-text-secondary);
|
|
2046
|
+
opacity: 0.7;
|
|
1995
2047
|
cursor: pointer;
|
|
1996
2048
|
text-decoration: underline;
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
opacity: 0.8;
|
|
2000
|
-
transition: opacity var(--thunder-transition-fast);
|
|
2049
|
+
white-space: nowrap;
|
|
2050
|
+
line-height: 28px;
|
|
2001
2051
|
}
|
|
2002
2052
|
|
|
2003
2053
|
.thunderid-user-profile__field-placeholder:hover {
|
|
2004
2054
|
opacity: 1;
|
|
2005
2055
|
}
|
|
2006
2056
|
|
|
2007
|
-
|
|
2057
|
+
.thunderid-user-profile__field-actions {
|
|
2058
|
+
display: flex;
|
|
2059
|
+
gap: calc(var(--thunder-spacing-unit) * 0.5);
|
|
2060
|
+
align-items: center;
|
|
2061
|
+
margin-inline-start: calc(var(--thunder-spacing-unit) * 4);
|
|
2062
|
+
}
|
|
2008
2063
|
|
|
2009
2064
|
.thunderid-user-profile__field-edit-btn {
|
|
2010
2065
|
display: inline-flex;
|
|
2011
2066
|
align-items: center;
|
|
2012
2067
|
justify-content: center;
|
|
2013
|
-
background:
|
|
2068
|
+
background: transparent;
|
|
2014
2069
|
border: none;
|
|
2015
2070
|
cursor: pointer;
|
|
2016
2071
|
color: var(--thunder-color-text-secondary);
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
transition:
|
|
2021
|
-
color var(--thunder-transition-fast),
|
|
2022
|
-
background-color var(--thunder-transition-fast),
|
|
2023
|
-
opacity var(--thunder-transition-fast);
|
|
2024
|
-
opacity: 0;
|
|
2072
|
+
padding: 0;
|
|
2073
|
+
min-height: auto;
|
|
2074
|
+
opacity: 0.7;
|
|
2025
2075
|
line-height: 0;
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
.thunderid-user-profile__field:hover .thunderid-user-profile__field-edit-btn {
|
|
2029
|
-
opacity: 1;
|
|
2076
|
+
transition: opacity var(--thunder-transition-fast, 0.15s ease);
|
|
2030
2077
|
}
|
|
2031
2078
|
|
|
2032
2079
|
.thunderid-user-profile__field-edit-btn:hover {
|
|
2033
|
-
color: var(--thunder-color-primary-main);
|
|
2034
|
-
background-color: var(--thunder-color-primary-light);
|
|
2035
|
-
}
|
|
2036
|
-
|
|
2037
|
-
.thunderid-user-profile__field-edit-btn:focus-visible {
|
|
2038
2080
|
opacity: 1;
|
|
2039
|
-
|
|
2040
|
-
box-shadow: 0 0 0 var(--thunder-focus-ring-width) var(--thunder-focus-ring-color);
|
|
2081
|
+
background: transparent;
|
|
2041
2082
|
}
|
|
2042
2083
|
|
|
2043
|
-
/* ── Edit mode ───────────────────────────────────────────────── */
|
|
2044
|
-
|
|
2045
2084
|
.thunderid-user-profile__field-edit {
|
|
2085
|
+
flex: 1;
|
|
2046
2086
|
display: flex;
|
|
2047
2087
|
flex-direction: column;
|
|
2048
|
-
gap: calc(var(--thunder-spacing-unit) * 0.
|
|
2049
|
-
padding: calc(var(--thunder-spacing-unit) * 0.25) 0;
|
|
2088
|
+
gap: calc(var(--thunder-spacing-unit) * 0.5);
|
|
2050
2089
|
}
|
|
2051
2090
|
|
|
2052
|
-
.thunderid-user-profile__field-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2091
|
+
.thunderid-user-profile__field-error {
|
|
2092
|
+
color: var(--thunder-color-error, #d32f2f);
|
|
2093
|
+
font-size: var(--thunder-typography-fontSize-xs, 0.8rem);
|
|
2094
|
+
font-weight: var(--thunder-typography-fontWeight-medium, 500);
|
|
2095
|
+
margin-top: calc(var(--thunder-spacing-unit) * 0.5);
|
|
2056
2096
|
}
|
|
2057
2097
|
|
|
2058
|
-
/* ── Footer
|
|
2098
|
+
/* ── Footer ──────────────────────────────────────────────────── */
|
|
2059
2099
|
|
|
2060
2100
|
.thunderid-user-profile__footer {
|
|
2061
|
-
padding: calc(var(--thunder-spacing-unit) *
|
|
2101
|
+
padding-top: calc(var(--thunder-spacing-unit) * 2);
|
|
2062
2102
|
border-top: 1px solid var(--thunder-color-border);
|
|
2063
2103
|
}
|
|
2064
2104
|
|
|
2065
2105
|
/* ── Compact modifier ────────────────────────────────────────── */
|
|
2066
2106
|
|
|
2067
|
-
.thunderid-user-profile--compact
|
|
2068
|
-
padding: calc(var(--thunder-spacing-unit) * 2)
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
.thunderid-user-profile--compact .thunderid-user-profile__avatar--lg {
|
|
2072
|
-
width: 56px;
|
|
2073
|
-
height: 56px;
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
|
-
.thunderid-user-profile--compact .thunderid-user-profile__avatar--lg .thunderid-user-profile__avatar-initials {
|
|
2077
|
-
font-size: 1.125rem;
|
|
2078
|
-
}
|
|
2079
|
-
|
|
2080
|
-
.thunderid-user-profile--compact .thunderid-user-profile__field {
|
|
2081
|
-
padding: calc(var(--thunder-spacing-unit) * 1) calc(var(--thunder-spacing-unit) * 2);
|
|
2082
|
-
}
|
|
2083
|
-
|
|
2084
|
-
.thunderid-user-profile--compact .thunderid-user-profile__hero-name {
|
|
2085
|
-
font-size: var(--thunder-typography-fontSize-md);
|
|
2107
|
+
.thunderid-user-profile--compact {
|
|
2108
|
+
padding: calc(var(--thunder-spacing-unit) * 2);
|
|
2109
|
+
width: 100%;
|
|
2086
2110
|
}
|
|
2087
2111
|
`;
|
|
2088
2112
|
var UserProfile_css_default = USER_PROFILE_CSS;
|
|
@@ -3301,13 +3325,17 @@ const STYLES = [
|
|
|
3301
3325
|
*
|
|
3302
3326
|
* @param vendor - Vendor/brand namespace used to derive the dedupe `<style>` element id
|
|
3303
3327
|
* (e.g. `${vendor}-vue-styles`). Defaults to `VendorConstants.VENDOR_PREFIX`.
|
|
3328
|
+
* @param nonce - CSP nonce applied to the injected `<style>` element via a `nonce` attribute,
|
|
3329
|
+
* so consuming apps can enforce a strict `style-src` Content-Security-Policy (i.e. without
|
|
3330
|
+
* `'unsafe-inline'`) for this runtime-injected stylesheet.
|
|
3304
3331
|
*/
|
|
3305
|
-
function injectStyles(vendor) {
|
|
3332
|
+
function injectStyles(vendor, nonce) {
|
|
3306
3333
|
if (typeof document === "undefined") return;
|
|
3307
3334
|
const styleId = `${getVendorPrefix(vendor)}-vue-styles`;
|
|
3308
3335
|
if (document.getElementById(styleId)) return;
|
|
3309
3336
|
const style = document.createElement("style");
|
|
3310
3337
|
style.id = styleId;
|
|
3338
|
+
if (nonce) style.setAttribute("nonce", nonce);
|
|
3311
3339
|
style.textContent = STYLES;
|
|
3312
3340
|
document.head.appendChild(style);
|
|
3313
3341
|
}
|
|
@@ -3341,7 +3369,7 @@ function injectStyles(vendor) {
|
|
|
3341
3369
|
* ```
|
|
3342
3370
|
*/
|
|
3343
3371
|
const ThunderIDPlugin = { install(app, options) {
|
|
3344
|
-
injectStyles(options?.vendor);
|
|
3372
|
+
injectStyles(options?.vendor, options?.cspNonce);
|
|
3345
3373
|
if (options?.mode === "delegated") return;
|
|
3346
3374
|
app.component("ThunderIDProvider", ThunderIDProvider_default);
|
|
3347
3375
|
} };
|
|
@@ -7520,22 +7548,31 @@ const FIELDS_TO_SKIP = [
|
|
|
7520
7548
|
"verifiedEmailAddresses",
|
|
7521
7549
|
"phoneNumbers.mobile",
|
|
7522
7550
|
"emailAddresses",
|
|
7523
|
-
"preferredMFAOption"
|
|
7551
|
+
"preferredMFAOption",
|
|
7552
|
+
"attributes",
|
|
7553
|
+
"isReadOnly",
|
|
7554
|
+
"isReadonly"
|
|
7524
7555
|
];
|
|
7525
7556
|
const READONLY_FIELDS = [
|
|
7526
7557
|
"username",
|
|
7527
7558
|
"userName",
|
|
7528
|
-
"user_name"
|
|
7559
|
+
"user_name",
|
|
7560
|
+
"sub",
|
|
7561
|
+
"id",
|
|
7562
|
+
"ouId",
|
|
7563
|
+
"attributes",
|
|
7564
|
+
"isReadOnly",
|
|
7565
|
+
"isReadonly"
|
|
7529
7566
|
];
|
|
7530
7567
|
const DEFAULT_ATTRIBUTE_MAPPINGS$1 = {
|
|
7531
7568
|
email: ["emails", "email"],
|
|
7532
7569
|
firstName: ["name.givenName", "given_name"],
|
|
7533
7570
|
lastName: ["name.familyName", "family_name"],
|
|
7534
7571
|
picture: [
|
|
7535
|
-
"profile",
|
|
7536
|
-
"profileUrl",
|
|
7537
7572
|
"picture",
|
|
7538
|
-
"
|
|
7573
|
+
"avatar",
|
|
7574
|
+
"pictureUrl",
|
|
7575
|
+
"attributes.picture"
|
|
7539
7576
|
],
|
|
7540
7577
|
username: [
|
|
7541
7578
|
"userName",
|
|
@@ -7622,6 +7659,10 @@ const BaseUserProfile = defineComponent({
|
|
|
7622
7659
|
default: void 0,
|
|
7623
7660
|
type: Function
|
|
7624
7661
|
},
|
|
7662
|
+
preferences: {
|
|
7663
|
+
default: void 0,
|
|
7664
|
+
type: Object
|
|
7665
|
+
},
|
|
7625
7666
|
profile: {
|
|
7626
7667
|
default: null,
|
|
7627
7668
|
type: Object
|
|
@@ -7638,21 +7679,38 @@ const BaseUserProfile = defineComponent({
|
|
|
7638
7679
|
default: () => [],
|
|
7639
7680
|
type: Array
|
|
7640
7681
|
},
|
|
7682
|
+
t: {
|
|
7683
|
+
default: void 0,
|
|
7684
|
+
type: Function
|
|
7685
|
+
},
|
|
7641
7686
|
title: {
|
|
7642
7687
|
default: "Profile",
|
|
7643
7688
|
type: String
|
|
7689
|
+
},
|
|
7690
|
+
userSchema: {
|
|
7691
|
+
default: null,
|
|
7692
|
+
type: Object
|
|
7644
7693
|
}
|
|
7645
7694
|
},
|
|
7646
7695
|
setup(props, { slots }) {
|
|
7647
7696
|
const editingFields = ref({});
|
|
7648
7697
|
const editedValues = ref({});
|
|
7649
7698
|
const px = withVendorCSSClassPrefix;
|
|
7650
|
-
|
|
7651
|
-
|
|
7699
|
+
const regexCache = /* @__PURE__ */ new Map();
|
|
7700
|
+
const t = (key, fallback) => {
|
|
7701
|
+
if (props.t) {
|
|
7702
|
+
const res = props.t(key);
|
|
7703
|
+
if (res && res !== key) return res;
|
|
7704
|
+
}
|
|
7705
|
+
return fallback ?? key;
|
|
7706
|
+
};
|
|
7707
|
+
function shouldShowField(fieldName, isSchemaBased = false) {
|
|
7708
|
+
if (!isSchemaBased && FIELDS_TO_SKIP.includes(fieldName)) return false;
|
|
7652
7709
|
if (props.hideFields && props.hideFields.length > 0 && props.hideFields.includes(fieldName)) return false;
|
|
7653
7710
|
if (props.showFields && props.showFields.length > 0) return props.showFields.includes(fieldName);
|
|
7654
7711
|
return true;
|
|
7655
7712
|
}
|
|
7713
|
+
const fieldErrors = ref({});
|
|
7656
7714
|
function startEditing(fieldName, currentValue) {
|
|
7657
7715
|
editedValues.value = {
|
|
7658
7716
|
...editedValues.value,
|
|
@@ -7662,9 +7720,14 @@ const BaseUserProfile = defineComponent({
|
|
|
7662
7720
|
...editingFields.value,
|
|
7663
7721
|
[fieldName]: true
|
|
7664
7722
|
};
|
|
7723
|
+
fieldErrors.value = {
|
|
7724
|
+
...fieldErrors.value,
|
|
7725
|
+
[fieldName]: ""
|
|
7726
|
+
};
|
|
7665
7727
|
}
|
|
7666
7728
|
function cancelEditing(fieldName) {
|
|
7667
|
-
const
|
|
7729
|
+
const data = props.flattenedProfile ?? props.profile ?? null;
|
|
7730
|
+
const originalValue = data?.[fieldName] ?? data?.attributes?.[fieldName] ?? "";
|
|
7668
7731
|
editedValues.value = {
|
|
7669
7732
|
...editedValues.value,
|
|
7670
7733
|
[fieldName]: originalValue
|
|
@@ -7673,16 +7736,54 @@ const BaseUserProfile = defineComponent({
|
|
|
7673
7736
|
...editingFields.value,
|
|
7674
7737
|
[fieldName]: false
|
|
7675
7738
|
};
|
|
7739
|
+
fieldErrors.value = {
|
|
7740
|
+
...fieldErrors.value,
|
|
7741
|
+
[fieldName]: ""
|
|
7742
|
+
};
|
|
7676
7743
|
}
|
|
7677
|
-
function saveField(schema) {
|
|
7744
|
+
async function saveField(schema) {
|
|
7678
7745
|
if (!props.onUpdate || !schema.name) return;
|
|
7679
|
-
const
|
|
7680
|
-
const
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7746
|
+
const fieldName = schema.name;
|
|
7747
|
+
const value = editedValues.value[fieldName] ?? "";
|
|
7748
|
+
const strVal = String(value ?? "").trim();
|
|
7749
|
+
const fieldLabel = schema.displayName || formatLabel(fieldName);
|
|
7750
|
+
if (schema.required && !strVal) {
|
|
7751
|
+
fieldErrors.value = {
|
|
7752
|
+
...fieldErrors.value,
|
|
7753
|
+
[fieldName]: t("userProfile.field.required", `${fieldLabel} is required.`)
|
|
7754
|
+
};
|
|
7755
|
+
return;
|
|
7756
|
+
}
|
|
7757
|
+
if (schema.regex && strVal) if (schema.regex.length > 250) console.warn(`Regex pattern for field "${fieldName}" exceeds maximum length limit (250 chars).`);
|
|
7758
|
+
else {
|
|
7759
|
+
let reg = regexCache.get(schema.regex);
|
|
7760
|
+
if (reg === void 0) try {
|
|
7761
|
+
reg = new RegExp(schema.regex);
|
|
7762
|
+
regexCache.set(schema.regex, reg);
|
|
7763
|
+
} catch (err) {
|
|
7764
|
+
regexCache.set(schema.regex, null);
|
|
7765
|
+
console.warn(`Invalid regular expression syntax in user schema for field "${fieldName}":`, err);
|
|
7766
|
+
}
|
|
7767
|
+
if (reg && !reg.test(strVal)) {
|
|
7768
|
+
fieldErrors.value = {
|
|
7769
|
+
...fieldErrors.value,
|
|
7770
|
+
[fieldName]: t("userProfile.field.invalidFormat", `${fieldLabel} has an invalid format.`)
|
|
7771
|
+
};
|
|
7772
|
+
return;
|
|
7773
|
+
}
|
|
7774
|
+
}
|
|
7775
|
+
fieldErrors.value = {
|
|
7776
|
+
...fieldErrors.value,
|
|
7777
|
+
[fieldName]: ""
|
|
7685
7778
|
};
|
|
7779
|
+
const payload = buildPatchValue(fieldName, typeof value === "string" ? strVal : value, schema.schemaId, schema.multiValued);
|
|
7780
|
+
try {
|
|
7781
|
+
await props.onUpdate(payload);
|
|
7782
|
+
editingFields.value = {
|
|
7783
|
+
...editingFields.value,
|
|
7784
|
+
[fieldName]: false
|
|
7785
|
+
};
|
|
7786
|
+
} catch {}
|
|
7686
7787
|
}
|
|
7687
7788
|
function renderInput(schema) {
|
|
7688
7789
|
const fieldName = schema.name ?? "";
|
|
@@ -7735,30 +7836,29 @@ const BaseUserProfile = defineComponent({
|
|
|
7735
7836
|
class: px("user-profile__field-placeholder"),
|
|
7736
7837
|
onClick: () => startEditing(name, value)
|
|
7737
7838
|
}, `Enter your ${label.toLowerCase()}`) : null;
|
|
7738
|
-
const displayValueNode = hasValue ? h(
|
|
7739
|
-
class: px("user-profile__field-value"),
|
|
7740
|
-
variant: "body1"
|
|
7741
|
-
}, () => String(value)) : editablePlaceholder;
|
|
7839
|
+
const displayValueNode = hasValue ? h("span", { class: px("user-profile__field-value") }, String(value)) : editablePlaceholder;
|
|
7742
7840
|
return h("div", {
|
|
7743
7841
|
class: px("user-profile__field"),
|
|
7744
7842
|
key: name
|
|
7745
|
-
}, [h("div", { class: px("user-profile__field-label-
|
|
7746
|
-
|
|
7747
|
-
variant: "body2"
|
|
7748
|
-
}, () => label)]), h("div", { class: px("user-profile__field-value-col") }, [isEditing ? h("div", { class: px("user-profile__field-edit") }, [renderInput(schema), h("div", { class: px("user-profile__field-edit-actions") }, [h(Button_default, {
|
|
7843
|
+
}, [h("div", { class: px("user-profile__field-inner") }, [h("span", { class: px("user-profile__field-label") }, label), isEditing ? h("div", { class: px("user-profile__field-edit") }, [renderInput(schema), fieldErrors.value[name] ? h("div", { class: px("user-profile__field-error") }, fieldErrors.value[name]) : null]) : displayValueNode]), isEditable && !isReadonly ? h("div", { class: px("user-profile__field-actions") }, [isEditing ? [h(Button_default, {
|
|
7844
|
+
color: "primary",
|
|
7749
7845
|
onClick: () => saveField(schema),
|
|
7750
7846
|
size: "small",
|
|
7751
7847
|
variant: "solid"
|
|
7752
|
-
}, () => "Save"), h(Button_default, {
|
|
7848
|
+
}, () => t("userProfile.actions.save", "Save")), h(Button_default, {
|
|
7849
|
+
color: "secondary",
|
|
7753
7850
|
onClick: () => cancelEditing(name),
|
|
7754
7851
|
size: "small",
|
|
7755
|
-
variant: "
|
|
7756
|
-
}, () =>
|
|
7757
|
-
"aria-label": `Edit ${label}`,
|
|
7852
|
+
variant: "solid"
|
|
7853
|
+
}, () => t("userProfile.actions.cancel", "Cancel"))] : hasValue ? h(Button_default, {
|
|
7758
7854
|
class: px("user-profile__field-edit-btn"),
|
|
7855
|
+
color: "secondary",
|
|
7759
7856
|
onClick: () => startEditing(name, value),
|
|
7760
|
-
|
|
7761
|
-
|
|
7857
|
+
size: "small",
|
|
7858
|
+
startIcon: h(PencilIcon),
|
|
7859
|
+
title: t("userProfile.actions.edit", "Edit"),
|
|
7860
|
+
variant: "ghost"
|
|
7861
|
+
}) : null]) : null]);
|
|
7762
7862
|
}
|
|
7763
7863
|
function renderProfileWithoutSchemas() {
|
|
7764
7864
|
const data = props.flattenedProfile || props.profile;
|
|
@@ -7769,21 +7869,20 @@ const BaseUserProfile = defineComponent({
|
|
|
7769
7869
|
}).sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => h("div", {
|
|
7770
7870
|
class: px("user-profile__field"),
|
|
7771
7871
|
key
|
|
7772
|
-
}, [h("div", { class: px("user-profile__field-
|
|
7773
|
-
class: px("user-profile__field-label"),
|
|
7774
|
-
variant: "body2"
|
|
7775
|
-
}, () => formatLabel(key))]), h("div", { class: px("user-profile__field-value-col") }, [h(Typography_default, {
|
|
7776
|
-
class: px("user-profile__field-value"),
|
|
7777
|
-
variant: "body1"
|
|
7778
|
-
}, () => typeof value === "object" ? JSON.stringify(value) : String(value))])]));
|
|
7872
|
+
}, [h("div", { class: px("user-profile__field-inner") }, [h("span", { class: px("user-profile__field-label") }, formatLabel(key)), h("span", { class: px("user-profile__field-value") }, typeof value === "object" ? JSON.stringify(value) : String(value))])]));
|
|
7779
7873
|
}
|
|
7780
7874
|
function renderHero(currentUser) {
|
|
7781
7875
|
const displayName = getDisplayName_default(DEFAULT_ATTRIBUTE_MAPPINGS$1, currentUser);
|
|
7782
7876
|
const email = getMappedUserProfileValue_default("email", DEFAULT_ATTRIBUTE_MAPPINGS$1, currentUser) || getMappedUserProfileValue_default("username", DEFAULT_ATTRIBUTE_MAPPINGS$1, currentUser);
|
|
7877
|
+
const picture = getMappedUserProfileValue_default("picture", DEFAULT_ATTRIBUTE_MAPPINGS$1, currentUser) || null;
|
|
7783
7878
|
const avatarGradient = getAvatarGradient$1(String(currentUser["username"] || currentUser["userName"] || currentUser["email"] || currentUser["sub"] || displayName));
|
|
7784
7879
|
const initials = displayName.split(" ").map((w) => w.charAt(0)).slice(0, 2).join("").toUpperCase() || "?";
|
|
7785
7880
|
const avatarSizeClass = px(`user-profile__avatar--${props.avatarSize ?? "lg"}`);
|
|
7786
|
-
return h("div", { class: px("user-profile__hero") }, [h("div", { class: px("user-profile__avatar-wrapper") }, [h("
|
|
7881
|
+
return h("div", { class: px("user-profile__hero") }, [h("div", { class: px("user-profile__avatar-wrapper") }, [picture ? h("img", {
|
|
7882
|
+
alt: displayName,
|
|
7883
|
+
class: [px("user-profile__avatar"), avatarSizeClass].join(" "),
|
|
7884
|
+
src: picture
|
|
7885
|
+
}) : h("div", {
|
|
7787
7886
|
class: [px("user-profile__avatar"), avatarSizeClass].join(" "),
|
|
7788
7887
|
style: { background: avatarGradient }
|
|
7789
7888
|
}, [h("span", { class: px("user-profile__avatar-initials") }, initials)])]), h("div", { class: px("user-profile__hero-info") }, [h("span", { class: px("user-profile__hero-name") }, displayName), email ? h("span", { class: px("user-profile__hero-subtitle") }, String(email)) : null])]);
|
|
@@ -7809,15 +7908,31 @@ const BaseUserProfile = defineComponent({
|
|
|
7809
7908
|
props.className ?? ""
|
|
7810
7909
|
].filter(Boolean).join(" ");
|
|
7811
7910
|
const children = [];
|
|
7812
|
-
children.push(h("div", { class: px("user-profile__header") }, [h("span", { class: px("user-profile__title") }, props.title ?? "Profile")]));
|
|
7813
|
-
children.push(h(Divider_default, { class: px("user-profile__header-divider") }));
|
|
7814
7911
|
if (props.showAvatar !== false && currentUser) children.push(renderHero(currentUser));
|
|
7815
7912
|
if (props.error) children.push(h(Alert_default, {
|
|
7816
7913
|
class: px("user-profile__error"),
|
|
7817
7914
|
severity: "error"
|
|
7818
7915
|
}, () => props.error));
|
|
7819
7916
|
if (props.isLoading) children.push(h("div", { class: px("user-profile__loading") }, [h(Spinner_default)]));
|
|
7820
|
-
else if (
|
|
7917
|
+
else if (props.userSchema && typeof props.userSchema === "object" && Object.keys(props.userSchema).length > 0) {
|
|
7918
|
+
const fieldRows = Object.entries(props.userSchema).filter(([key, metaAttr]) => {
|
|
7919
|
+
if (metaAttr?.credential) return false;
|
|
7920
|
+
return shouldShowField(key, true);
|
|
7921
|
+
}).map(([key, metaAttr]) => {
|
|
7922
|
+
const val = editedValues.value?.[key] ?? currentUser?.attributes?.[key] ?? currentUser?.[key] ?? "";
|
|
7923
|
+
const isReadonly = metaAttr.readOnly === true || metaAttr.mutability === "READ_ONLY" || READONLY_FIELDS.includes(key);
|
|
7924
|
+
return {
|
|
7925
|
+
displayName: metaAttr.displayName ?? (key ? startCase(key) : ""),
|
|
7926
|
+
mutability: isReadonly ? "READ_ONLY" : "READ_WRITE",
|
|
7927
|
+
name: key,
|
|
7928
|
+
regex: metaAttr.regex,
|
|
7929
|
+
required: !!metaAttr.required,
|
|
7930
|
+
type: (metaAttr.type ?? "STRING").toUpperCase(),
|
|
7931
|
+
value: val
|
|
7932
|
+
};
|
|
7933
|
+
}).map((schema) => renderSchemaFieldRow(schema)).filter((node) => node !== null);
|
|
7934
|
+
children.push(h("div", { class: px("user-profile__fields") }, fieldRows));
|
|
7935
|
+
} else if (hasSchemas) {
|
|
7821
7936
|
const fieldRows = schemas.filter((s) => s.name && shouldShowField(s.name)).sort((a, b) => {
|
|
7822
7937
|
return (a.displayOrder ? parseInt(a.displayOrder, 10) : 999) - (b.displayOrder ? parseInt(b.displayOrder, 10) : 999);
|
|
7823
7938
|
}).map((schema) => {
|
|
@@ -7847,7 +7962,7 @@ const updateMeProfile$1 = async ({ fetcher, instanceId = 0,...requestConfig }) =
|
|
|
7847
7962
|
const response = await FetchHttpClient.getInstance(instanceId).request({
|
|
7848
7963
|
data: config.body ? JSON.parse(config.body) : void 0,
|
|
7849
7964
|
headers: config.headers,
|
|
7850
|
-
method: config.method || "
|
|
7965
|
+
method: config.method || "PUT",
|
|
7851
7966
|
url
|
|
7852
7967
|
});
|
|
7853
7968
|
return {
|
|
@@ -7898,6 +8013,10 @@ const UserProfile = defineComponent({
|
|
|
7898
8013
|
default: () => [],
|
|
7899
8014
|
type: Array
|
|
7900
8015
|
},
|
|
8016
|
+
preferences: {
|
|
8017
|
+
default: void 0,
|
|
8018
|
+
type: Object
|
|
8019
|
+
},
|
|
7901
8020
|
showAvatar: {
|
|
7902
8021
|
default: true,
|
|
7903
8022
|
type: Boolean
|
|
@@ -7912,19 +8031,37 @@ const UserProfile = defineComponent({
|
|
|
7912
8031
|
}
|
|
7913
8032
|
},
|
|
7914
8033
|
setup(props, { slots }) {
|
|
7915
|
-
const { baseUrl, endpoints, instanceId } = useThunderID_default();
|
|
7916
|
-
const { flattenedProfile, profile, onUpdateProfile } = useUser_default();
|
|
8034
|
+
const { baseUrl, endpoints, instanceId, preferences: contextPreferences } = useThunderID_default();
|
|
8035
|
+
const { flattenedProfile, profile, onUpdateProfile, updateProfile, userSchema } = useUser_default();
|
|
7917
8036
|
const { t } = useI18n_default();
|
|
8037
|
+
const resolvedPreferences = computed(() => ({
|
|
8038
|
+
...contextPreferences,
|
|
8039
|
+
...props.preferences,
|
|
8040
|
+
user: {
|
|
8041
|
+
...contextPreferences?.user,
|
|
8042
|
+
...props.preferences?.user
|
|
8043
|
+
}
|
|
8044
|
+
}));
|
|
8045
|
+
const isEditableProfile = computed(() => resolvedPreferences.value?.user?.fetchUserProfile === false ? false : props.editable);
|
|
7918
8046
|
const error = ref(null);
|
|
7919
8047
|
async function handleProfileUpdate(payload) {
|
|
7920
|
-
if (!baseUrl) return;
|
|
7921
8048
|
error.value = null;
|
|
7922
8049
|
try {
|
|
8050
|
+
const updatedAttributes = deepMerge((profile?.value?.profile ?? profile?.value)?.["attributes"] ?? {}, payload);
|
|
8051
|
+
Object.keys(updatedAttributes).forEach((key) => {
|
|
8052
|
+
if (updatedAttributes[key] === void 0 || updatedAttributes[key] === null) delete updatedAttributes[key];
|
|
8053
|
+
});
|
|
8054
|
+
if (updateProfile) {
|
|
8055
|
+
const res = await updateProfile({ payload: updatedAttributes });
|
|
8056
|
+
if (res && !res.success && res.error) error.value = res.error;
|
|
8057
|
+
return;
|
|
8058
|
+
}
|
|
8059
|
+
if (!baseUrl) return;
|
|
7923
8060
|
onUpdateProfile(await updateMeProfile_default({
|
|
7924
8061
|
baseUrl,
|
|
7925
8062
|
url: resolveResourceEndpoint("usersMe", { endpoints }),
|
|
7926
8063
|
instanceId,
|
|
7927
|
-
payload
|
|
8064
|
+
payload: updatedAttributes
|
|
7928
8065
|
}));
|
|
7929
8066
|
} catch (caughtError) {
|
|
7930
8067
|
let message = t("user.profile.update.generic.error") || "Failed to update profile. Please try again.";
|
|
@@ -7939,15 +8076,18 @@ const UserProfile = defineComponent({
|
|
|
7939
8076
|
class: withVendorCSSClassPrefix("user-profile--styled"),
|
|
7940
8077
|
className: props.className,
|
|
7941
8078
|
compact: props.compact,
|
|
7942
|
-
editable:
|
|
8079
|
+
editable: isEditableProfile.value,
|
|
7943
8080
|
error: error.value,
|
|
7944
8081
|
flattenedProfile: flattenedProfile?.value,
|
|
7945
8082
|
hideFields: props.hideFields,
|
|
7946
|
-
onUpdate: handleProfileUpdate,
|
|
8083
|
+
onUpdate: isEditableProfile.value ? handleProfileUpdate : void 0,
|
|
8084
|
+
preferences: resolvedPreferences.value,
|
|
7947
8085
|
profile: profile?.value?.profile ?? flattenedProfile?.value,
|
|
7948
8086
|
showAvatar: props.showAvatar,
|
|
7949
8087
|
showFields: props.showFields,
|
|
7950
|
-
|
|
8088
|
+
t,
|
|
8089
|
+
title: props.title,
|
|
8090
|
+
userSchema: userSchema?.value
|
|
7951
8091
|
}, slots);
|
|
7952
8092
|
}
|
|
7953
8093
|
});
|
|
@@ -7959,18 +8099,18 @@ const DEFAULT_ATTRIBUTE_MAPPINGS = {
|
|
|
7959
8099
|
email: ["emails", "email"],
|
|
7960
8100
|
firstName: ["name.givenName", "given_name"],
|
|
7961
8101
|
lastName: ["name.familyName", "family_name"],
|
|
8102
|
+
picture: [
|
|
8103
|
+
"picture",
|
|
8104
|
+
"avatar",
|
|
8105
|
+
"pictureUrl",
|
|
8106
|
+
"attributes.picture"
|
|
8107
|
+
],
|
|
7962
8108
|
username: [
|
|
7963
8109
|
"userName",
|
|
7964
8110
|
"username",
|
|
7965
8111
|
"user_name"
|
|
7966
8112
|
]
|
|
7967
8113
|
};
|
|
7968
|
-
/** Approximate min-width for each size, used for auto-alignment decisions. */
|
|
7969
|
-
const MENU_MIN_WIDTHS = {
|
|
7970
|
-
lg: 280,
|
|
7971
|
-
md: 220,
|
|
7972
|
-
sm: 180
|
|
7973
|
-
};
|
|
7974
8114
|
const AVATAR_GRADIENTS = [
|
|
7975
8115
|
"linear-gradient(135deg, #4b6ef5 0%, #7c3aed 100%)",
|
|
7976
8116
|
"linear-gradient(135deg, #0ea5e9 0%, #4b6ef5 100%)",
|
|
@@ -7992,16 +8132,19 @@ function resolveUserInfo(user) {
|
|
|
7992
8132
|
displayName: "User",
|
|
7993
8133
|
gradient: AVATAR_GRADIENTS[0],
|
|
7994
8134
|
initials: "?",
|
|
8135
|
+
picture: null,
|
|
7995
8136
|
subtitle: ""
|
|
7996
8137
|
};
|
|
7997
8138
|
const displayName = getDisplayName_default(DEFAULT_ATTRIBUTE_MAPPINGS, user) || "User";
|
|
7998
8139
|
const initials = displayName.split(" ").map((w) => w.charAt(0)).slice(0, 2).join("").toUpperCase() || "?";
|
|
8140
|
+
const picture = getMappedUserProfileValue_default("picture", DEFAULT_ATTRIBUTE_MAPPINGS, user) || null;
|
|
7999
8141
|
const seed = String(getMappedUserProfileValue_default("username", DEFAULT_ATTRIBUTE_MAPPINGS, user) || getMappedUserProfileValue_default("email", DEFAULT_ATTRIBUTE_MAPPINGS, user) || displayName);
|
|
8000
8142
|
const subtitle = String(getMappedUserProfileValue_default("email", DEFAULT_ATTRIBUTE_MAPPINGS, user) || getMappedUserProfileValue_default("username", DEFAULT_ATTRIBUTE_MAPPINGS, user) || "");
|
|
8001
8143
|
return {
|
|
8002
8144
|
displayName,
|
|
8003
8145
|
gradient: getAvatarGradient(seed),
|
|
8004
8146
|
initials,
|
|
8147
|
+
picture,
|
|
8005
8148
|
subtitle
|
|
8006
8149
|
};
|
|
8007
8150
|
}
|
|
@@ -8057,13 +8200,46 @@ const BaseUserDropdown = defineComponent({
|
|
|
8057
8200
|
setup(props, { slots }) {
|
|
8058
8201
|
const isOpen = ref(false);
|
|
8059
8202
|
const containerRef = ref(null);
|
|
8203
|
+
const modalOverlayRef = ref(null);
|
|
8204
|
+
const avatarImageError = ref(false);
|
|
8060
8205
|
const px = withVendorCSSClassPrefix;
|
|
8206
|
+
watch(() => resolveUserInfo(props.user ?? null).picture, () => {
|
|
8207
|
+
avatarImageError.value = false;
|
|
8208
|
+
});
|
|
8061
8209
|
function handleClickOutside(event) {
|
|
8062
8210
|
if (containerRef.value && !containerRef.value.contains(event.target)) isOpen.value = false;
|
|
8063
8211
|
}
|
|
8212
|
+
function handleModalClose() {
|
|
8213
|
+
props.onProfileModalClose?.();
|
|
8214
|
+
(containerRef.value?.querySelector(`.${px("user-dropdown__trigger")}`))?.focus();
|
|
8215
|
+
}
|
|
8064
8216
|
function handleKeyDown(event) {
|
|
8065
|
-
if (
|
|
8217
|
+
if (props.isProfileModalOpen) {
|
|
8218
|
+
if (event.key === "Escape") handleModalClose();
|
|
8219
|
+
else if (event.key === "Tab") {
|
|
8220
|
+
const overlay = modalOverlayRef.value;
|
|
8221
|
+
if (overlay) {
|
|
8222
|
+
const focusables = overlay.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])");
|
|
8223
|
+
if (focusables.length > 0) {
|
|
8224
|
+
const first = focusables[0];
|
|
8225
|
+
const last = focusables[focusables.length - 1];
|
|
8226
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
8227
|
+
event.preventDefault();
|
|
8228
|
+
last.focus();
|
|
8229
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
8230
|
+
event.preventDefault();
|
|
8231
|
+
first.focus();
|
|
8232
|
+
}
|
|
8233
|
+
}
|
|
8234
|
+
}
|
|
8235
|
+
}
|
|
8236
|
+
} else if (event.key === "Escape") isOpen.value = false;
|
|
8066
8237
|
}
|
|
8238
|
+
watch(() => props.isProfileModalOpen, (open) => {
|
|
8239
|
+
if (open) nextTick(() => {
|
|
8240
|
+
(modalOverlayRef.value?.querySelector(`.${px("user-dropdown__modal-close")}`))?.focus();
|
|
8241
|
+
});
|
|
8242
|
+
});
|
|
8067
8243
|
onMounted(() => {
|
|
8068
8244
|
document.addEventListener("click", handleClickOutside);
|
|
8069
8245
|
document.addEventListener("keydown", handleKeyDown);
|
|
@@ -8076,8 +8252,7 @@ const BaseUserDropdown = defineComponent({
|
|
|
8076
8252
|
if (props.menuAlign !== "auto") return props.menuAlign ?? "right";
|
|
8077
8253
|
if (!containerRef.value) return "right";
|
|
8078
8254
|
const rect = containerRef.value.getBoundingClientRect();
|
|
8079
|
-
|
|
8080
|
-
return window.innerWidth - rect.right >= menuWidth ? "right" : "left";
|
|
8255
|
+
return window.innerWidth - rect.left >= rect.right ? "left" : "right";
|
|
8081
8256
|
}
|
|
8082
8257
|
return () => {
|
|
8083
8258
|
if (slots.default) return slots.default({
|
|
@@ -8087,7 +8262,7 @@ const BaseUserDropdown = defineComponent({
|
|
|
8087
8262
|
},
|
|
8088
8263
|
user: props.user
|
|
8089
8264
|
});
|
|
8090
|
-
const { displayName, initials, gradient, subtitle } = resolveUserInfo(props.user ?? null);
|
|
8265
|
+
const { displayName, initials, gradient, picture, subtitle } = resolveUserInfo(props.user ?? null);
|
|
8091
8266
|
const size = props.size ?? "md";
|
|
8092
8267
|
const avatarSizeClass = size !== "md" ? px(`user-dropdown__avatar--${size}`) : "";
|
|
8093
8268
|
const triggerClass = [px("user-dropdown__trigger"), isOpen.value ? px("user-dropdown__trigger--open") : ""].filter(Boolean).join(" ");
|
|
@@ -8100,7 +8275,14 @@ const BaseUserDropdown = defineComponent({
|
|
|
8100
8275
|
isOpen.value = !isOpen.value;
|
|
8101
8276
|
},
|
|
8102
8277
|
type: "button"
|
|
8103
|
-
}, [h("
|
|
8278
|
+
}, [picture && !avatarImageError.value ? h("img", {
|
|
8279
|
+
alt: displayName,
|
|
8280
|
+
class: [px("user-dropdown__avatar"), avatarSizeClass].filter(Boolean).join(" "),
|
|
8281
|
+
onError: () => {
|
|
8282
|
+
avatarImageError.value = true;
|
|
8283
|
+
},
|
|
8284
|
+
src: picture
|
|
8285
|
+
}) : h("span", {
|
|
8104
8286
|
class: [px("user-dropdown__avatar"), avatarSizeClass].filter(Boolean).join(" "),
|
|
8105
8287
|
style: { background: gradient }
|
|
8106
8288
|
}, initials), props.showChevron ? h("span", { class: px("user-dropdown__chevron") }, [h(ChevronDownIcon, { size: 14 })]) : null]);
|
|
@@ -8114,7 +8296,11 @@ const BaseUserDropdown = defineComponent({
|
|
|
8114
8296
|
sizeClass
|
|
8115
8297
|
].filter(Boolean).join(" ");
|
|
8116
8298
|
const menuChildren = [];
|
|
8117
|
-
menuChildren.push(h("div", { class: px("user-dropdown__menu-header") }, [h("
|
|
8299
|
+
menuChildren.push(h("div", { class: px("user-dropdown__menu-header") }, [picture ? h("img", {
|
|
8300
|
+
alt: displayName,
|
|
8301
|
+
class: px("user-dropdown__menu-header-avatar"),
|
|
8302
|
+
src: picture
|
|
8303
|
+
}) : h("div", {
|
|
8118
8304
|
class: px("user-dropdown__menu-header-avatar"),
|
|
8119
8305
|
style: { background: gradient }
|
|
8120
8306
|
}, initials), h("div", { class: px("user-dropdown__menu-header-info") }, [h("span", { class: px("user-dropdown__menu-header-name") }, displayName), subtitle ? h("span", { class: px("user-dropdown__menu-header-subtitle") }, subtitle) : null])]));
|
|
@@ -8160,17 +8346,21 @@ const BaseUserDropdown = defineComponent({
|
|
|
8160
8346
|
class: [px("user-dropdown"), props.className].filter(Boolean).join(" "),
|
|
8161
8347
|
ref: containerRef
|
|
8162
8348
|
}, [trigger, menu]);
|
|
8163
|
-
if (props.isProfileModalOpen) return h("div", [container, h("div", {
|
|
8349
|
+
if (props.isProfileModalOpen) return h("div", [container, h(Teleport, { to: "body" }, [h("div", {
|
|
8350
|
+
"aria-label": "User profile",
|
|
8351
|
+
"aria-modal": "true",
|
|
8164
8352
|
class: px("user-dropdown__modal-overlay"),
|
|
8353
|
+
ref: modalOverlayRef,
|
|
8354
|
+
role: "dialog",
|
|
8165
8355
|
onClick: (e) => {
|
|
8166
|
-
if (e.target.classList.contains(px("user-dropdown__modal-overlay")))
|
|
8356
|
+
if (e.target.classList.contains(px("user-dropdown__modal-overlay"))) handleModalClose();
|
|
8167
8357
|
}
|
|
8168
8358
|
}, [h("div", { class: px("user-dropdown__modal-content") }, [h("button", {
|
|
8169
8359
|
"aria-label": "Close profile",
|
|
8170
8360
|
class: px("user-dropdown__modal-close"),
|
|
8171
|
-
onClick:
|
|
8361
|
+
onClick: handleModalClose,
|
|
8172
8362
|
type: "button"
|
|
8173
|
-
}, [h(XIcon, { size: 18 })]), props.profileContent])])]);
|
|
8363
|
+
}, [h(XIcon, { size: 18 })]), props.profileContent])])])]);
|
|
8174
8364
|
return container;
|
|
8175
8365
|
};
|
|
8176
8366
|
}
|
|
@@ -9512,4 +9702,4 @@ const createCallbackRoute = (options = {}) => {
|
|
|
9512
9702
|
};
|
|
9513
9703
|
|
|
9514
9704
|
//#endregion
|
|
9515
|
-
export { AcceptInvite_default as AcceptInvite, Alert_default as Alert, ArrowLeftRightIcon, BaseAcceptInvite_default as BaseAcceptInvite, BaseInviteUser_default as BaseInviteUser, BaseLanguageSwitcher_default as BaseLanguageSwitcher, BaseSignIn_default as BaseSignIn, BaseSignInButton_default as BaseSignInButton, BaseSignOutButton_default as BaseSignOutButton, BaseSignUp_default as BaseSignUp, BaseSignUpButton_default as BaseSignUpButton, BaseUserDropdown_default as BaseUserDropdown, BaseUserProfile_default as BaseUserProfile, BuildingIcon, Button_default as Button, Callback_default as Callback, Card_default as Card, CheckIcon, Checkbox_default as Checkbox, ChevronDownIcon, CircleAlertIcon, CircleCheckIcon, DatePicker_default as DatePicker, Divider_default as Divider, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowEventType, EmbeddedFlowTextVariant, EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowType, EyeIcon, EyeOffIcon, FLOW_KEY, FLOW_META_KEY, FacebookButton_default as FacebookButton, FieldFactory_default as FieldFactory, FieldType, FlowMetaProvider_default as FlowMetaProvider, FlowProvider_default as FlowProvider, GitHubButton_default as GitHubButton, GlobeIcon, GoogleButton_default as GoogleButton, I18N_KEY, I18nProvider_default as I18nProvider, InfoIcon, InviteUser_default as InviteUser, LanguageSwitcher_default as LanguageSwitcher, Loading_default as Loading, LogOutIcon, Logo_default as Logo, MicrosoftButton_default as MicrosoftButton, OtpField_default as OtpField, PasswordField_default as PasswordField, PencilIcon, PlusIcon, Select_default as Select, SignIn_default as SignIn, SignInButton_default as SignInButton, SignOutButton_default as SignOutButton, SignUp_default as SignUp, SignUpButton_default as SignUpButton, SignedIn_default as SignedIn, SignedOut_default as SignedOut, Spinner_default as Spinner, THEME_KEY, THUNDERID_KEY, TextField_default as TextField, ThemeProvider_default as ThemeProvider, ThunderIDPlugin_default as ThunderIDPlugin, ThunderIDProvider_default as ThunderIDProvider, ThunderIDRuntimeError, ThunderIDVueClient_default as ThunderIDVueClient, TriangleAlertIcon, Typography_default as Typography, USER_KEY, User_default as User, UserDropdown_default as UserDropdown, UserIcon, UserProfile_default as UserProfile, UserProvider_default as UserProvider, XIcon, buildThemeConfigFromFlowMeta_default as buildThemeConfigFromFlowMeta, createCallbackRoute, createClassObserver, createField, createMediaQueryListener, createThunderIDGuard, detectThemeMode, getActiveTheme, getAuthComponentHeadings_default as getAuthComponentHeadings, handleWebAuthnAuthentication, hasAuthParamsInUrl, http, initiateOAuthRedirect, navigate, useFlow_default as useFlow, useFlowMeta_default as useFlowMeta, useI18n_default as useI18n, useOAuthCallback, useTheme_default as useTheme, useThunderID_default as useThunderID, useUser_default as useUser, validateFieldValue };
|
|
9705
|
+
export { AcceptInvite_default as AcceptInvite, Alert_default as Alert, ArrowLeftRightIcon, BaseAcceptInvite_default as BaseAcceptInvite, BaseInviteUser_default as BaseInviteUser, BaseLanguageSwitcher_default as BaseLanguageSwitcher, BaseSignIn_default as BaseSignIn, BaseSignInButton_default as BaseSignInButton, BaseSignOutButton_default as BaseSignOutButton, BaseSignUp_default as BaseSignUp, BaseSignUpButton_default as BaseSignUpButton, BaseUserDropdown_default as BaseUserDropdown, BaseUserProfile_default as BaseUserProfile, BuildingIcon, Button_default as Button, Callback_default as Callback, Card_default as Card, CheckIcon, Checkbox_default as Checkbox, ChevronDownIcon, CircleAlertIcon, CircleCheckIcon, DatePicker_default as DatePicker, Divider_default as Divider, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowEventType, EmbeddedFlowTextVariant, EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowType, EyeIcon, EyeOffIcon, FLOW_KEY, FLOW_META_KEY, FacebookButton_default as FacebookButton, FieldFactory_default as FieldFactory, FieldType, FlowMetaProvider_default as FlowMetaProvider, FlowProvider_default as FlowProvider, GitHubButton_default as GitHubButton, GlobeIcon, GoogleButton_default as GoogleButton, I18N_KEY, I18nProvider_default as I18nProvider, InfoIcon, InviteUser_default as InviteUser, LanguageSwitcher_default as LanguageSwitcher, Loading_default as Loading, LogOutIcon, Logo_default as Logo, MicrosoftButton_default as MicrosoftButton, OtpField_default as OtpField, PasswordField_default as PasswordField, PencilIcon, PlusIcon, Select_default as Select, SignIn_default as SignIn, SignInButton_default as SignInButton, SignOutButton_default as SignOutButton, SignUp_default as SignUp, SignUpButton_default as SignUpButton, SignedIn_default as SignedIn, SignedOut_default as SignedOut, Spinner_default as Spinner, THEME_KEY, THUNDERID_KEY, TextField_default as TextField, ThemeProvider_default as ThemeProvider, ThunderIDPlugin_default as ThunderIDPlugin, ThunderIDProvider_default as ThunderIDProvider, ThunderIDRuntimeError, ThunderIDVueClient_default as ThunderIDVueClient, TriangleAlertIcon, Typography_default as Typography, USER_KEY, User_default as User, UserDropdown_default as UserDropdown, UserIcon, UserProfile_default as UserProfile, UserProvider_default as UserProvider, XIcon, buildThemeConfigFromFlowMeta_default as buildThemeConfigFromFlowMeta, createCallbackRoute, createClassObserver, createField, createMediaQueryListener, createThunderIDGuard, detectThemeMode, getActiveTheme, getAuthComponentHeadings_default as getAuthComponentHeadings, getUsersMeMeta_default as getUsersMeMeta, handleWebAuthnAuthentication, hasAuthParamsInUrl, http, initiateOAuthRedirect, navigate, useFlow_default as useFlow, useFlowMeta_default as useFlowMeta, useI18n_default as useI18n, useOAuthCallback, useTheme_default as useTheme, useThunderID_default as useThunderID, useUser_default as useUser, validateFieldValue };
|