@thunderid/vue 1.0.6 → 1.1.0

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.
Files changed (22) hide show
  1. package/dist/api/updateMeCredentials.d.ts +8 -0
  2. package/dist/api/updateMeCredentials.d.ts.map +1 -0
  3. package/dist/cjs/index.cjs +516 -65
  4. package/dist/components/presentation/change-credential/BaseChangeCredential.d.ts +22 -0
  5. package/dist/components/presentation/change-credential/BaseChangeCredential.d.ts.map +1 -0
  6. package/dist/components/presentation/change-credential/ChangeCredential.css.d.ts +7 -0
  7. package/dist/components/presentation/change-credential/ChangeCredential.css.d.ts.map +1 -0
  8. package/dist/components/presentation/change-credential/ChangeCredential.d.ts +12 -0
  9. package/dist/components/presentation/change-credential/ChangeCredential.d.ts.map +1 -0
  10. package/dist/components/presentation/user-dropdown/BaseUserDropdown.d.ts +3 -0
  11. package/dist/components/presentation/user-dropdown/BaseUserDropdown.d.ts.map +1 -1
  12. package/dist/components/presentation/user-dropdown/UserDropdown.css.d.ts +2 -1
  13. package/dist/components/presentation/user-dropdown/UserDropdown.css.d.ts.map +1 -1
  14. package/dist/components/presentation/user-dropdown/UserDropdown.d.ts.map +1 -1
  15. package/dist/components/presentation/user-profile/UserProfile.css.d.ts +1 -1
  16. package/dist/components/presentation/user-profile/UserProfile.css.d.ts.map +1 -1
  17. package/dist/components/primitives/PasswordField/PasswordField.d.ts.map +1 -1
  18. package/dist/index.d.ts +3 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +516 -67
  21. package/dist/styles/injectStyles.d.ts.map +1 -1
  22. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
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, hasUnresolvedTranslationParams, http, isEmojiUri, isEmpty, navigate, navigate as navigate$1, normalizeBorderRadius, normalizeTranslations, resolveFlowTemplateLiterals, resolveLogoUri, resolveResourceEndpoint, startCase, substituteTranslationParams, updateMeProfile, withVendorCSSClassPrefix } from "@thunderid/browser";
1
+ import { ConsentConstants, CredentialConstants, 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, createHttpClientFetcher, createMediaQueryListener, createMediaQueryListener as createMediaQueryListener$1, createPackageComponentLogger, createPackageLogger, createTheme, deepMerge, detectThemeMode, detectThemeMode as detectThemeMode$1, evaluateChangePasswordForm, executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow, extractEmojiFromUri, extractUserClaimsFromIdToken, generateFlattenedUserProfile, get, getActiveTheme, getDefaultI18nBundles, getFlowMeta, getUsersMe, getUsersMeMeta, getVendorPrefix, handleWebAuthnAuthentication, hasAuthParamsInUrl, hasAuthParamsInUrl as hasAuthParamsInUrl$1, hasCalledForThisInstanceInUrl, hasUnresolvedTranslationParams, http, isEmojiUri, isEmpty, mapCredentialUpdateError, navigate, navigate as navigate$1, normalizeBorderRadius, normalizeTranslations, resolveChangeCredentialPolicy, resolveFlowTemplateLiterals, resolveLogoUri, resolveResourceEndpoint, startCase, substituteTranslationParams, supportsCredential, updateMeCredentials, updateMeProfile, withVendorCSSClassPrefix } from "@thunderid/browser";
2
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
 
@@ -1420,6 +1420,161 @@ const DEFAULTS_CSS = `
1420
1420
  `;
1421
1421
  var defaults_css_default = DEFAULTS_CSS;
1422
1422
 
1423
+ //#endregion
1424
+ //#region src/components/auth/sign-in/BaseSignIn.css.ts
1425
+ /**
1426
+ * Layout styles for the BaseSignIn composition.
1427
+ *
1428
+ * BEM block: `.thunderid-signin`
1429
+ *
1430
+ * Mirrors the layout constants in the React SDK's `BaseSignIn.styles.ts`
1431
+ * (min-width, content gap, logo sizing) so the sign-in card renders with the
1432
+ * same proportions across frameworks.
1433
+ */
1434
+ const BASE_SIGN_IN_CSS = `
1435
+ /* ============================================================
1436
+ BaseSignIn
1437
+ ============================================================ */
1438
+
1439
+ .thunderid-signin {
1440
+ min-width: 420px;
1441
+ margin: 0 auto;
1442
+ font-family: var(--thunderid-typography-fontFamily, inherit);
1443
+ border-radius: var(--thunderid-border-radius-large);
1444
+ }
1445
+
1446
+ .thunderid-signin__content {
1447
+ display: flex;
1448
+ flex-direction: column;
1449
+ gap: calc(var(--thunderid-spacing-unit) * 2);
1450
+ }
1451
+
1452
+ .thunderid-signin__content > img,
1453
+ .thunderid-signin__content > span[role='img'] {
1454
+ /* Flex column's default 'stretch' would otherwise force width: auto to fill
1455
+ the container instead of shrinking to the image's intrinsic size. */
1456
+ align-self: center;
1457
+ display: block;
1458
+ margin: 0 0 calc(var(--thunderid-spacing-unit) * 1) 0;
1459
+ border-radius: var(--thunderid-border-radius-small);
1460
+ }
1461
+
1462
+ .thunderid-signin__messages {
1463
+ margin-top: calc(var(--thunderid-spacing-unit) * 2);
1464
+ }
1465
+
1466
+ .thunderid-signin__messages > * + * {
1467
+ margin-top: calc(var(--thunderid-spacing-unit) * 1);
1468
+ }
1469
+ `;
1470
+ var BaseSignIn_css_default = BASE_SIGN_IN_CSS;
1471
+
1472
+ //#endregion
1473
+ //#region src/components/presentation/change-credential/ChangeCredential.css.ts
1474
+ /**
1475
+ * Styles for the ChangeCredential presentation component.
1476
+ * Parity target: `@thunderid/react` BaseChangeCredential.styles.ts
1477
+ */
1478
+ const CHANGE_CREDENTIAL_CSS = `
1479
+ /* ============================================================
1480
+ ChangeCredential (React Parity)
1481
+ ============================================================ */
1482
+
1483
+ .thunderid-change-credential {
1484
+ display: flex;
1485
+ flex-direction: column;
1486
+ gap: calc(var(--thunderid-spacing-unit) * 2);
1487
+ width: 100%;
1488
+ box-sizing: border-box;
1489
+ font-family: var(--thunderid-typography-fontFamily);
1490
+ }
1491
+
1492
+ .thunderid-change-credential--card {
1493
+ padding: calc(var(--thunderid-spacing-unit) * 3);
1494
+ border: 1px solid var(--thunderid-color-border);
1495
+ border-radius: var(--thunderid-border-radius-large, 8px);
1496
+ background: var(--thunderid-color-background-surface);
1497
+ }
1498
+
1499
+ .thunderid-change-credential__heading {
1500
+ margin: 0;
1501
+ font-size: 1.125rem;
1502
+ font-weight: 600;
1503
+ }
1504
+
1505
+ .thunderid-change-credential__fields {
1506
+ display: flex;
1507
+ flex-direction: column;
1508
+ gap: calc(var(--thunderid-spacing-unit) * 2);
1509
+ }
1510
+
1511
+ .thunderid-change-credential__requirements-heading {
1512
+ margin: 0 0 calc(var(--thunderid-spacing-unit) / 2) 0;
1513
+ font-size: 0.8125rem;
1514
+ opacity: 0.8;
1515
+ }
1516
+
1517
+ .thunderid-change-credential__requirements {
1518
+ display: flex;
1519
+ flex-direction: column;
1520
+ gap: calc(var(--thunderid-spacing-unit) / 2);
1521
+ margin: 0;
1522
+ padding: 0;
1523
+ list-style: none;
1524
+ }
1525
+
1526
+ .thunderid-change-credential__requirement {
1527
+ display: flex;
1528
+ align-items: center;
1529
+ gap: var(--thunderid-spacing-unit);
1530
+ font-size: 0.8125rem;
1531
+ opacity: 0.7;
1532
+ }
1533
+
1534
+ .thunderid-change-credential__requirement--passed {
1535
+ color: var(--thunderid-color-success-main);
1536
+ opacity: 1;
1537
+ }
1538
+
1539
+ .thunderid-change-credential__requirement-icon {
1540
+ display: inline-flex;
1541
+ flex-shrink: 0;
1542
+ width: 14px;
1543
+ height: 14px;
1544
+ }
1545
+
1546
+ .thunderid-change-credential__actions {
1547
+ display: flex;
1548
+ align-items: center;
1549
+ justify-content: flex-end;
1550
+ gap: var(--thunderid-spacing-unit);
1551
+ }
1552
+
1553
+ .thunderid-change-credential__unavailable {
1554
+ position: relative;
1555
+ display: flex;
1556
+ width: 100%;
1557
+ }
1558
+
1559
+ .thunderid-change-credential__unavailable-content {
1560
+ width: 100%;
1561
+ filter: blur(3px);
1562
+ opacity: 0.55;
1563
+ pointer-events: none;
1564
+ user-select: none;
1565
+ }
1566
+
1567
+ .thunderid-change-credential__unavailable-overlay {
1568
+ position: absolute;
1569
+ inset: 0;
1570
+ display: flex;
1571
+ align-items: center;
1572
+ justify-content: center;
1573
+ padding: calc(var(--thunderid-spacing-unit) * 2);
1574
+ }
1575
+ `;
1576
+ var ChangeCredential_css_default = CHANGE_CREDENTIAL_CSS;
1577
+
1423
1578
  //#endregion
1424
1579
  //#region src/components/presentation/language-switcher/LanguageSwitcher.css.ts
1425
1580
  /**
@@ -1556,6 +1711,7 @@ var LanguageSwitcher_css_default = LANGUAGE_SWITCHER_CSS;
1556
1711
  * __item--danger – destructive action (red text/hover)
1557
1712
  *
1558
1713
  * Elements:
1714
+ * __trigger-label – display name beside the trigger avatar (showTriggerLabel)
1559
1715
  * __chevron – rotates 180° when menu is open
1560
1716
  * __menu-header – user identity section at top of menu
1561
1717
  * __menu-header-avatar – gradient avatar circle in header
@@ -1603,6 +1759,17 @@ const USER_DROPDOWN_CSS = `
1603
1759
  box-shadow: 0 0 0 3px var(--thunderid-focus-ring-color);
1604
1760
  }
1605
1761
 
1762
+ .thunderid-user-dropdown__trigger-label {
1763
+ color: var(--thunderid-color-text-primary);
1764
+ font-size: 0.875rem;
1765
+ font-weight: 500;
1766
+ max-width: 150px;
1767
+ overflow: hidden;
1768
+ text-overflow: ellipsis;
1769
+ white-space: nowrap;
1770
+ padding-right: calc(var(--thunderid-spacing-unit) * 0.5);
1771
+ }
1772
+
1606
1773
  .thunderid-user-dropdown__trigger:focus-visible {
1607
1774
  border-color: var(--thunderid-color-primary-main);
1608
1775
  box-shadow: 0 0 0 var(--thunderid-focus-ring-width) var(--thunderid-focus-ring-color);
@@ -1946,9 +2113,7 @@ const USER_PROFILE_CSS = `
1946
2113
  display: flex;
1947
2114
  flex-direction: column;
1948
2115
  padding: calc(var(--thunderid-spacing-unit) * 4);
1949
- width: 100%;
1950
- max-width: 600px;
1951
- margin: 0 auto;
2116
+ min-width: 600px;
1952
2117
  font-family: var(--thunderid-typography-fontFamily);
1953
2118
  background: var(--thunderid-color-background-surface);
1954
2119
  border-radius: var(--thunderid-border-radius-large, 8px);
@@ -2085,6 +2250,7 @@ img.thunderid-user-profile__avatar {
2085
2250
  display: flex;
2086
2251
  align-items: center;
2087
2252
  gap: var(--thunderid-spacing-unit);
2253
+ min-width: 0;
2088
2254
  }
2089
2255
 
2090
2256
  .thunderid-user-profile__field-label {
@@ -2108,6 +2274,7 @@ img.thunderid-user-profile__avatar {
2108
2274
  text-overflow: ellipsis;
2109
2275
  white-space: nowrap;
2110
2276
  max-width: 350px;
2277
+ min-width: 0;
2111
2278
  text-align: start;
2112
2279
  overflow: hidden;
2113
2280
  }
@@ -3371,55 +3538,6 @@ const TYPOGRAPHY_CSS = `
3371
3538
  `;
3372
3539
  var Typography_css_default = TYPOGRAPHY_CSS;
3373
3540
 
3374
- //#endregion
3375
- //#region src/components/auth/sign-in/BaseSignIn.css.ts
3376
- /**
3377
- * Layout styles for the BaseSignIn composition.
3378
- *
3379
- * BEM block: `.thunderid-signin`
3380
- *
3381
- * Mirrors the layout constants in the React SDK's `BaseSignIn.styles.ts`
3382
- * (min-width, content gap, logo sizing) so the sign-in card renders with the
3383
- * same proportions across frameworks.
3384
- */
3385
- const BASE_SIGN_IN_CSS = `
3386
- /* ============================================================
3387
- BaseSignIn
3388
- ============================================================ */
3389
-
3390
- .thunderid-signin {
3391
- min-width: 420px;
3392
- margin: 0 auto;
3393
- font-family: var(--thunderid-typography-fontFamily, inherit);
3394
- border-radius: var(--thunderid-border-radius-large);
3395
- }
3396
-
3397
- .thunderid-signin__content {
3398
- display: flex;
3399
- flex-direction: column;
3400
- gap: calc(var(--thunderid-spacing-unit) * 2);
3401
- }
3402
-
3403
- .thunderid-signin__content > img,
3404
- .thunderid-signin__content > span[role='img'] {
3405
- /* Flex column's default 'stretch' would otherwise force width: auto to fill
3406
- the container instead of shrinking to the image's intrinsic size. */
3407
- align-self: center;
3408
- display: block;
3409
- margin: 0 0 calc(var(--thunderid-spacing-unit) * 1) 0;
3410
- border-radius: var(--thunderid-border-radius-small);
3411
- }
3412
-
3413
- .thunderid-signin__messages {
3414
- margin-top: calc(var(--thunderid-spacing-unit) * 2);
3415
- }
3416
-
3417
- .thunderid-signin__messages > * + * {
3418
- margin-top: calc(var(--thunderid-spacing-unit) * 1);
3419
- }
3420
- `;
3421
- var BaseSignIn_css_default = BASE_SIGN_IN_CSS;
3422
-
3423
3541
  //#endregion
3424
3542
  //#region src/styles/injectStyles.ts
3425
3543
  /**
@@ -3446,6 +3564,7 @@ const STYLES = [
3446
3564
  Logo_css_default,
3447
3565
  Spinner_css_default,
3448
3566
  BaseSignIn_css_default,
3567
+ ChangeCredential_css_default,
3449
3568
  LanguageSwitcher_css_default,
3450
3569
  UserDropdown_css_default,
3451
3570
  UserProfile_css_default
@@ -4219,6 +4338,10 @@ const PencilIcon = () => icon([h("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 2
4219
4338
  const PasswordField = defineComponent({
4220
4339
  name: "PasswordField",
4221
4340
  props: {
4341
+ autocomplete: {
4342
+ default: "current-password",
4343
+ type: String
4344
+ },
4222
4345
  disabled: {
4223
4346
  default: false,
4224
4347
  type: Boolean
@@ -4266,6 +4389,7 @@ const PasswordField = defineComponent({
4266
4389
  for: props.name
4267
4390
  }, [props.label, props.required ? h("span", { class: withVendorCSSClassPrefix("password-field__required") }, " *") : null]) : null,
4268
4391
  h("div", { class: withVendorCSSClassPrefix("password-field__wrapper") }, [h("input", {
4392
+ autocomplete: props.autocomplete,
4269
4393
  class: withVendorCSSClassPrefix("password-field__input"),
4270
4394
  "data-testid": attrs["data-testid"],
4271
4395
  disabled: props.disabled,
@@ -8745,6 +8869,301 @@ const UserProfile = defineComponent({
8745
8869
  });
8746
8870
  var UserProfile_default = UserProfile;
8747
8871
 
8872
+ //#endregion
8873
+ //#region src/components/presentation/change-credential/BaseChangeCredential.ts
8874
+ const ruleIcon = (passed) => passed ? CheckIcon() : XIcon();
8875
+ /**
8876
+ * Presentational change-credential form with just the two fields a first-time or
8877
+ * unverified credential change needs: new value and confirmation.
8878
+ *
8879
+ * Holds no context and performs no network calls: it renders the fields, evaluates the
8880
+ * policy for the checklist and the submit gate, and emits `submit` with the validated
8881
+ * values. Use `ChangeCredential` for the context-wired variant.
8882
+ */
8883
+ const BaseChangeCredential = defineComponent({
8884
+ name: "BaseChangeCredential",
8885
+ props: {
8886
+ cardLayout: {
8887
+ default: false,
8888
+ type: Boolean
8889
+ },
8890
+ className: {
8891
+ default: "",
8892
+ type: String
8893
+ },
8894
+ credentialDisplayName: {
8895
+ default: "Password",
8896
+ type: String
8897
+ },
8898
+ error: {
8899
+ default: null,
8900
+ type: String
8901
+ },
8902
+ fieldErrors: {
8903
+ default: () => ({}),
8904
+ type: Object
8905
+ },
8906
+ loading: {
8907
+ default: false,
8908
+ type: Boolean
8909
+ },
8910
+ policy: {
8911
+ default: () => ({}),
8912
+ type: Object
8913
+ },
8914
+ preferences: {
8915
+ default: void 0,
8916
+ type: Object
8917
+ },
8918
+ showRequirements: {
8919
+ default: true,
8920
+ type: Boolean
8921
+ },
8922
+ success: {
8923
+ default: false,
8924
+ type: Boolean
8925
+ },
8926
+ t: {
8927
+ default: void 0,
8928
+ type: Function
8929
+ },
8930
+ title: {
8931
+ default: void 0,
8932
+ type: String
8933
+ },
8934
+ unavailable: {
8935
+ default: false,
8936
+ type: Boolean
8937
+ }
8938
+ },
8939
+ emits: ["submit"],
8940
+ setup(props, { emit }) {
8941
+ const { t: fallbackT } = useI18n_default();
8942
+ const labelParams = computed(() => ({
8943
+ credential: props.credentialDisplayName,
8944
+ credentialLower: props.credentialDisplayName.toLowerCase()
8945
+ }));
8946
+ const translate = (key, params) => (props.t ?? fallbackT)(key, {
8947
+ ...labelParams.value,
8948
+ ...params
8949
+ });
8950
+ const resolvedTitle = computed(() => props.title ?? translate("user.change_password.heading"));
8951
+ const newPassword = ref("");
8952
+ const confirmPassword = ref("");
8953
+ const submitted = ref(false);
8954
+ watch(() => props.success, (succeeded) => {
8955
+ if (!succeeded) return;
8956
+ newPassword.value = "";
8957
+ confirmPassword.value = "";
8958
+ submitted.value = false;
8959
+ });
8960
+ const evaluation = computed(() => evaluateChangePasswordForm({
8961
+ confirmPassword: confirmPassword.value,
8962
+ newPassword: newPassword.value
8963
+ }, props.policy));
8964
+ const ruleResults = computed(() => evaluation.value.ruleResults);
8965
+ const confirmMatches = computed(() => evaluation.value.confirmMatches);
8966
+ const interactionDisabled = computed(() => props.loading || props.unavailable);
8967
+ const canSubmit = computed(() => !interactionDisabled.value && evaluation.value.isValid);
8968
+ function handleSubmit(event) {
8969
+ event.preventDefault();
8970
+ submitted.value = true;
8971
+ if (!canSubmit.value) return;
8972
+ emit("submit", { newPassword: newPassword.value });
8973
+ }
8974
+ return () => {
8975
+ const rootClass = [
8976
+ withVendorCSSClassPrefix("change-credential"),
8977
+ props.cardLayout ? withVendorCSSClassPrefix("change-credential--card") : "",
8978
+ props.className
8979
+ ].filter(Boolean).join(" ");
8980
+ const confirmError = submitted.value && !confirmMatches.value ? translate("user.change_password.mismatch.error") : void 0;
8981
+ const newPasswordError = props.fieldErrors["newPassword"];
8982
+ const form = h("form", {
8983
+ class: rootClass,
8984
+ novalidate: true,
8985
+ onSubmit: handleSubmit
8986
+ }, [
8987
+ resolvedTitle.value ? h("h3", { class: withVendorCSSClassPrefix("change-credential__heading") }, resolvedTitle.value) : null,
8988
+ props.error ? h(Alert_default, { severity: "error" }, { default: () => [props.error] }) : null,
8989
+ props.success ? h(Alert_default, { severity: "success" }, { default: () => [translate("user.change_password.success")] }) : null,
8990
+ h("div", { class: withVendorCSSClassPrefix("change-credential__fields") }, [
8991
+ h(PasswordField_default, {
8992
+ autocomplete: "new-password",
8993
+ disabled: interactionDisabled.value,
8994
+ error: newPasswordError,
8995
+ label: translate("user.change_password.new.label"),
8996
+ modelValue: newPassword.value,
8997
+ name: "newPassword",
8998
+ "onUpdate:modelValue": (value) => {
8999
+ newPassword.value = value;
9000
+ },
9001
+ placeholder: translate("user.change_password.new.placeholder"),
9002
+ required: true
9003
+ }),
9004
+ props.showRequirements && ruleResults.value.length > 0 ? h("div", {}, [h("p", { class: withVendorCSSClassPrefix("change-credential__requirements-heading") }, translate("user.change_password.requirements.heading")), h("ul", { class: withVendorCSSClassPrefix("change-credential__requirements") }, ruleResults.value.map((rule) => h("li", {
9005
+ class: [withVendorCSSClassPrefix("change-credential__requirement"), rule.passed ? withVendorCSSClassPrefix("change-credential__requirement--passed") : ""].filter(Boolean).join(" "),
9006
+ "data-passed": String(rule.passed),
9007
+ key: rule.key
9008
+ }, [h("span", { class: withVendorCSSClassPrefix("change-credential__requirement-icon") }, [ruleIcon(rule.passed)]), h("span", {}, translate(rule.messageKey, rule.params))])))]) : null,
9009
+ h(PasswordField_default, {
9010
+ autocomplete: "new-password",
9011
+ disabled: interactionDisabled.value,
9012
+ error: confirmError,
9013
+ label: translate("user.change_password.confirm.label"),
9014
+ modelValue: confirmPassword.value,
9015
+ name: "confirmPassword",
9016
+ "onUpdate:modelValue": (value) => {
9017
+ confirmPassword.value = value;
9018
+ },
9019
+ placeholder: translate("user.change_password.confirm.placeholder"),
9020
+ required: true
9021
+ })
9022
+ ]),
9023
+ h("div", { class: withVendorCSSClassPrefix("change-credential__actions") }, [h(Button_default, {
9024
+ color: "primary",
9025
+ disabled: !canSubmit.value,
9026
+ loading: props.loading,
9027
+ type: "submit",
9028
+ variant: "solid"
9029
+ }, { default: () => [translate("user.change_password.submit")] })])
9030
+ ]);
9031
+ if (!props.unavailable) return form;
9032
+ return h("div", { class: withVendorCSSClassPrefix("change-credential__unavailable") }, [h("div", {
9033
+ "aria-hidden": "true",
9034
+ class: withVendorCSSClassPrefix("change-credential__unavailable-content")
9035
+ }, [form]), h("div", {
9036
+ class: withVendorCSSClassPrefix("change-credential__unavailable-overlay"),
9037
+ role: "status"
9038
+ }, [h(Alert_default, { severity: "warning" }, { default: () => [h("strong", translate("user.change_password.unavailable.heading")), h("div", translate("user.change_password.unavailable.description"))] })])]);
9039
+ };
9040
+ }
9041
+ });
9042
+ var BaseChangeCredential_default = BaseChangeCredential;
9043
+
9044
+ //#endregion
9045
+ //#region src/api/updateMeCredentials.ts
9046
+ const updateMeCredentials$1 = async ({ fetcher, instanceId = 0,...requestConfig }) => {
9047
+ return updateMeCredentials({
9048
+ ...requestConfig,
9049
+ fetcher: fetcher || createHttpClientFetcher(instanceId)
9050
+ });
9051
+ };
9052
+ var updateMeCredentials_default = updateMeCredentials$1;
9053
+
9054
+ //#endregion
9055
+ //#region src/components/presentation/change-credential/ChangeCredential.ts
9056
+ /**
9057
+ * Title-cases a credential attribute name for use as a display-name fallback when the schema
9058
+ * declares no `displayName` for it, e.g. `pin` -> `Pin`.
9059
+ */
9060
+ const defaultDisplayName = (attribute) => attribute.charAt(0).toUpperCase() + attribute.slice(1);
9061
+ /**
9062
+ * ChangeCredential lets the signed-in user set a new value for one of their own credentials.
9063
+ *
9064
+ * It collects only a new value and its confirmation. The self-service credential write path
9065
+ * does not verify the account's existing value today, so this component does not ask for one;
9066
+ * once server-side current-value verification ships, that field returns without a breaking
9067
+ * change to this component's public props.
9068
+ */
9069
+ const ChangeCredential = defineComponent({
9070
+ name: "ChangeCredential",
9071
+ props: {
9072
+ attribute: {
9073
+ default: CredentialConstants.PASSWORD,
9074
+ type: String
9075
+ },
9076
+ cardLayout: {
9077
+ default: false,
9078
+ type: Boolean
9079
+ },
9080
+ className: {
9081
+ default: "",
9082
+ type: String
9083
+ },
9084
+ policy: {
9085
+ default: void 0,
9086
+ type: Object
9087
+ },
9088
+ preferences: {
9089
+ default: void 0,
9090
+ type: Object
9091
+ },
9092
+ showRequirements: {
9093
+ default: true,
9094
+ type: Boolean
9095
+ },
9096
+ title: {
9097
+ default: void 0,
9098
+ type: String
9099
+ }
9100
+ },
9101
+ emits: ["success"],
9102
+ setup(props, { emit }) {
9103
+ const { baseUrl, endpoints, instanceId, preferences: contextPreferences } = useThunderID_default();
9104
+ const { userSchema } = useUser_default();
9105
+ const { t } = useI18n_default();
9106
+ const resolvedDisplayName = computed(() => userSchema?.value?.[props.attribute]?.displayName ?? defaultDisplayName(props.attribute));
9107
+ const resolvedPreferences = computed(() => ({
9108
+ ...contextPreferences,
9109
+ ...props.preferences,
9110
+ user: {
9111
+ ...contextPreferences?.user,
9112
+ ...props.preferences?.user
9113
+ }
9114
+ }));
9115
+ const error = ref(null);
9116
+ const fieldErrors = ref({});
9117
+ const loading = ref(false);
9118
+ const success = ref(false);
9119
+ const resolvedPolicy = computed(() => resolveChangeCredentialPolicy(userSchema?.value, props.attribute, props.policy));
9120
+ async function handleSubmit({ newPassword }) {
9121
+ error.value = null;
9122
+ fieldErrors.value = {};
9123
+ success.value = false;
9124
+ loading.value = true;
9125
+ try {
9126
+ await updateMeCredentials_default({
9127
+ baseUrl,
9128
+ instanceId,
9129
+ payload: { [props.attribute]: newPassword },
9130
+ url: resolveResourceEndpoint("usersMeCredentials", { endpoints })
9131
+ });
9132
+ success.value = true;
9133
+ emit("success");
9134
+ } catch (caughtError) {
9135
+ const { field, message, messageKey } = mapCredentialUpdateError(caughtError);
9136
+ const text = message ?? t(messageKey, {
9137
+ credential: resolvedDisplayName.value,
9138
+ credentialLower: resolvedDisplayName.value.toLowerCase()
9139
+ });
9140
+ if (field) fieldErrors.value = { [field]: text };
9141
+ else error.value = text;
9142
+ } finally {
9143
+ loading.value = false;
9144
+ }
9145
+ }
9146
+ return () => h(BaseChangeCredential_default, {
9147
+ cardLayout: props.cardLayout,
9148
+ class: withVendorCSSClassPrefix("change-credential--styled"),
9149
+ className: props.className,
9150
+ credentialDisplayName: resolvedDisplayName.value,
9151
+ error: error.value,
9152
+ fieldErrors: fieldErrors.value,
9153
+ loading: loading.value,
9154
+ onSubmit: handleSubmit,
9155
+ policy: resolvedPolicy.value,
9156
+ preferences: resolvedPreferences.value,
9157
+ showRequirements: props.showRequirements,
9158
+ success: success.value,
9159
+ t,
9160
+ title: props.title,
9161
+ unavailable: !supportsCredential(userSchema?.value, props.attribute)
9162
+ });
9163
+ }
9164
+ });
9165
+ var ChangeCredential_default = ChangeCredential;
9166
+
8748
9167
  //#endregion
8749
9168
  //#region src/components/presentation/user-dropdown/BaseUserDropdown.ts
8750
9169
  const DEFAULT_ATTRIBUTE_MAPPINGS = {
@@ -8836,10 +9255,18 @@ const BaseUserDropdown = defineComponent({
8836
9255
  default: null,
8837
9256
  type: Object
8838
9257
  },
9258
+ profileLabel: {
9259
+ default: "Profile",
9260
+ type: String
9261
+ },
8839
9262
  showChevron: {
8840
9263
  default: false,
8841
9264
  type: Boolean
8842
9265
  },
9266
+ showTriggerLabel: {
9267
+ default: false,
9268
+ type: Boolean
9269
+ },
8843
9270
  size: {
8844
9271
  default: "md",
8845
9272
  type: String
@@ -8927,17 +9354,21 @@ const BaseUserDropdown = defineComponent({
8927
9354
  isOpen.value = !isOpen.value;
8928
9355
  },
8929
9356
  type: "button"
8930
- }, [picture && !avatarImageError.value ? h("img", {
8931
- alt: displayName,
8932
- class: [px("user-dropdown__avatar"), avatarSizeClass].filter(Boolean).join(" "),
8933
- onError: () => {
8934
- avatarImageError.value = true;
8935
- },
8936
- src: picture
8937
- }) : h("span", {
8938
- class: [px("user-dropdown__avatar"), avatarSizeClass].filter(Boolean).join(" "),
8939
- style: { background: gradient }
8940
- }, initials), props.showChevron ? h("span", { class: px("user-dropdown__chevron") }, [h(ChevronDownIcon, { size: 14 })]) : null]);
9357
+ }, [
9358
+ picture && !avatarImageError.value ? h("img", {
9359
+ alt: displayName,
9360
+ class: [px("user-dropdown__avatar"), avatarSizeClass].filter(Boolean).join(" "),
9361
+ onError: () => {
9362
+ avatarImageError.value = true;
9363
+ },
9364
+ src: picture
9365
+ }) : h("span", {
9366
+ class: [px("user-dropdown__avatar"), avatarSizeClass].filter(Boolean).join(" "),
9367
+ style: { background: gradient }
9368
+ }, initials),
9369
+ props.showTriggerLabel ? h("span", { class: px("user-dropdown__trigger-label") }, displayName) : null,
9370
+ props.showChevron ? h("span", { class: px("user-dropdown__chevron") }, [h(ChevronDownIcon, { size: 14 })]) : null
9371
+ ]);
8941
9372
  let menu = null;
8942
9373
  if (isOpen.value) {
8943
9374
  const alignClass = resolveMenuAlign() === "left" ? px("user-dropdown__menu--align-left") : "";
@@ -8964,7 +9395,7 @@ const BaseUserDropdown = defineComponent({
8964
9395
  props.onProfileClick();
8965
9396
  },
8966
9397
  type: "button"
8967
- }, [h(UserIcon, { size: 15 }), h("span", null, "Profile")]));
9398
+ }, [h(UserIcon, { size: 15 }), h("span", null, props.profileLabel ?? "Profile")]));
8968
9399
  if (props.menuItems && props.menuItems.length > 0) props.menuItems.forEach((item, idx) => {
8969
9400
  if (item.separatorBefore) menuChildren.push(h("div", {
8970
9401
  class: px("user-dropdown__menu-divider"),
@@ -9059,6 +9490,14 @@ const UserDropdown = defineComponent({
9059
9490
  default: void 0,
9060
9491
  type: Array
9061
9492
  },
9493
+ onManageProfile: {
9494
+ default: void 0,
9495
+ type: Function
9496
+ },
9497
+ profileLabel: {
9498
+ default: void 0,
9499
+ type: String
9500
+ },
9062
9501
  showChevron: {
9063
9502
  default: false,
9064
9503
  type: Boolean
@@ -9066,6 +9505,10 @@ const UserDropdown = defineComponent({
9066
9505
  size: {
9067
9506
  default: "md",
9068
9507
  type: String
9508
+ },
9509
+ showTriggerLabel: {
9510
+ default: false,
9511
+ type: Boolean
9069
9512
  }
9070
9513
  },
9071
9514
  emits: ["profileClick"],
@@ -9079,6 +9522,10 @@ const UserDropdown = defineComponent({
9079
9522
  menuAlign: props.menuAlign,
9080
9523
  menuItems: props.menuItems,
9081
9524
  onProfileClick: () => {
9525
+ if (props.onManageProfile) {
9526
+ props.onManageProfile();
9527
+ return;
9528
+ }
9082
9529
  isProfileModalOpen.value = true;
9083
9530
  emit("profileClick");
9084
9531
  },
@@ -9088,12 +9535,14 @@ const UserDropdown = defineComponent({
9088
9535
  onSignOut: () => {
9089
9536
  signOut();
9090
9537
  },
9091
- profileContent: isProfileModalOpen.value ? h(UserProfile_default, {
9538
+ profileContent: !props.onManageProfile && isProfileModalOpen.value ? h(UserProfile_default, {
9092
9539
  cardLayout: false,
9093
9540
  compact: true,
9094
9541
  editable: true
9095
9542
  }) : null,
9543
+ profileLabel: props.profileLabel,
9096
9544
  showChevron: props.showChevron,
9545
+ showTriggerLabel: props.showTriggerLabel,
9097
9546
  size: props.size,
9098
9547
  user: user.value
9099
9548
  }, slots);
@@ -10318,4 +10767,4 @@ const createCallbackRoute = (options = {}) => {
10318
10767
  };
10319
10768
 
10320
10769
  //#endregion
10321
- 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, extractErrorMessage, getActiveTheme, getAuthComponentHeadings_default as getAuthComponentHeadings, getUsersMeMeta_default as getUsersMeMeta, handlePasskeyAuthentication, handlePasskeyRegistration, handleWebAuthnAuthentication, hasAuthParamsInUrl, http, initiateOAuthRedirect, navigate, normalizeFlowResponse, 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 };
10770
+ export { AcceptInvite_default as AcceptInvite, Alert_default as Alert, ArrowLeftRightIcon, BaseAcceptInvite_default as BaseAcceptInvite, BaseChangeCredential_default as BaseChangeCredential, 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, ChangeCredential_default as ChangeCredential, 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, extractErrorMessage, getActiveTheme, getAuthComponentHeadings_default as getAuthComponentHeadings, getUsersMeMeta_default as getUsersMeMeta, handlePasskeyAuthentication, handlePasskeyRegistration, handleWebAuthnAuthentication, hasAuthParamsInUrl, http, initiateOAuthRedirect, navigate, normalizeFlowResponse, 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 };