@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
@@ -1446,6 +1446,161 @@ const DEFAULTS_CSS = `
1446
1446
  `;
1447
1447
  var defaults_css_default = DEFAULTS_CSS;
1448
1448
 
1449
+ //#endregion
1450
+ //#region src/components/auth/sign-in/BaseSignIn.css.ts
1451
+ /**
1452
+ * Layout styles for the BaseSignIn composition.
1453
+ *
1454
+ * BEM block: `.thunderid-signin`
1455
+ *
1456
+ * Mirrors the layout constants in the React SDK's `BaseSignIn.styles.ts`
1457
+ * (min-width, content gap, logo sizing) so the sign-in card renders with the
1458
+ * same proportions across frameworks.
1459
+ */
1460
+ const BASE_SIGN_IN_CSS = `
1461
+ /* ============================================================
1462
+ BaseSignIn
1463
+ ============================================================ */
1464
+
1465
+ .thunderid-signin {
1466
+ min-width: 420px;
1467
+ margin: 0 auto;
1468
+ font-family: var(--thunderid-typography-fontFamily, inherit);
1469
+ border-radius: var(--thunderid-border-radius-large);
1470
+ }
1471
+
1472
+ .thunderid-signin__content {
1473
+ display: flex;
1474
+ flex-direction: column;
1475
+ gap: calc(var(--thunderid-spacing-unit) * 2);
1476
+ }
1477
+
1478
+ .thunderid-signin__content > img,
1479
+ .thunderid-signin__content > span[role='img'] {
1480
+ /* Flex column's default 'stretch' would otherwise force width: auto to fill
1481
+ the container instead of shrinking to the image's intrinsic size. */
1482
+ align-self: center;
1483
+ display: block;
1484
+ margin: 0 0 calc(var(--thunderid-spacing-unit) * 1) 0;
1485
+ border-radius: var(--thunderid-border-radius-small);
1486
+ }
1487
+
1488
+ .thunderid-signin__messages {
1489
+ margin-top: calc(var(--thunderid-spacing-unit) * 2);
1490
+ }
1491
+
1492
+ .thunderid-signin__messages > * + * {
1493
+ margin-top: calc(var(--thunderid-spacing-unit) * 1);
1494
+ }
1495
+ `;
1496
+ var BaseSignIn_css_default = BASE_SIGN_IN_CSS;
1497
+
1498
+ //#endregion
1499
+ //#region src/components/presentation/change-credential/ChangeCredential.css.ts
1500
+ /**
1501
+ * Styles for the ChangeCredential presentation component.
1502
+ * Parity target: `@thunderid/react` BaseChangeCredential.styles.ts
1503
+ */
1504
+ const CHANGE_CREDENTIAL_CSS = `
1505
+ /* ============================================================
1506
+ ChangeCredential (React Parity)
1507
+ ============================================================ */
1508
+
1509
+ .thunderid-change-credential {
1510
+ display: flex;
1511
+ flex-direction: column;
1512
+ gap: calc(var(--thunderid-spacing-unit) * 2);
1513
+ width: 100%;
1514
+ box-sizing: border-box;
1515
+ font-family: var(--thunderid-typography-fontFamily);
1516
+ }
1517
+
1518
+ .thunderid-change-credential--card {
1519
+ padding: calc(var(--thunderid-spacing-unit) * 3);
1520
+ border: 1px solid var(--thunderid-color-border);
1521
+ border-radius: var(--thunderid-border-radius-large, 8px);
1522
+ background: var(--thunderid-color-background-surface);
1523
+ }
1524
+
1525
+ .thunderid-change-credential__heading {
1526
+ margin: 0;
1527
+ font-size: 1.125rem;
1528
+ font-weight: 600;
1529
+ }
1530
+
1531
+ .thunderid-change-credential__fields {
1532
+ display: flex;
1533
+ flex-direction: column;
1534
+ gap: calc(var(--thunderid-spacing-unit) * 2);
1535
+ }
1536
+
1537
+ .thunderid-change-credential__requirements-heading {
1538
+ margin: 0 0 calc(var(--thunderid-spacing-unit) / 2) 0;
1539
+ font-size: 0.8125rem;
1540
+ opacity: 0.8;
1541
+ }
1542
+
1543
+ .thunderid-change-credential__requirements {
1544
+ display: flex;
1545
+ flex-direction: column;
1546
+ gap: calc(var(--thunderid-spacing-unit) / 2);
1547
+ margin: 0;
1548
+ padding: 0;
1549
+ list-style: none;
1550
+ }
1551
+
1552
+ .thunderid-change-credential__requirement {
1553
+ display: flex;
1554
+ align-items: center;
1555
+ gap: var(--thunderid-spacing-unit);
1556
+ font-size: 0.8125rem;
1557
+ opacity: 0.7;
1558
+ }
1559
+
1560
+ .thunderid-change-credential__requirement--passed {
1561
+ color: var(--thunderid-color-success-main);
1562
+ opacity: 1;
1563
+ }
1564
+
1565
+ .thunderid-change-credential__requirement-icon {
1566
+ display: inline-flex;
1567
+ flex-shrink: 0;
1568
+ width: 14px;
1569
+ height: 14px;
1570
+ }
1571
+
1572
+ .thunderid-change-credential__actions {
1573
+ display: flex;
1574
+ align-items: center;
1575
+ justify-content: flex-end;
1576
+ gap: var(--thunderid-spacing-unit);
1577
+ }
1578
+
1579
+ .thunderid-change-credential__unavailable {
1580
+ position: relative;
1581
+ display: flex;
1582
+ width: 100%;
1583
+ }
1584
+
1585
+ .thunderid-change-credential__unavailable-content {
1586
+ width: 100%;
1587
+ filter: blur(3px);
1588
+ opacity: 0.55;
1589
+ pointer-events: none;
1590
+ user-select: none;
1591
+ }
1592
+
1593
+ .thunderid-change-credential__unavailable-overlay {
1594
+ position: absolute;
1595
+ inset: 0;
1596
+ display: flex;
1597
+ align-items: center;
1598
+ justify-content: center;
1599
+ padding: calc(var(--thunderid-spacing-unit) * 2);
1600
+ }
1601
+ `;
1602
+ var ChangeCredential_css_default = CHANGE_CREDENTIAL_CSS;
1603
+
1449
1604
  //#endregion
1450
1605
  //#region src/components/presentation/language-switcher/LanguageSwitcher.css.ts
1451
1606
  /**
@@ -1582,6 +1737,7 @@ var LanguageSwitcher_css_default = LANGUAGE_SWITCHER_CSS;
1582
1737
  * __item--danger – destructive action (red text/hover)
1583
1738
  *
1584
1739
  * Elements:
1740
+ * __trigger-label – display name beside the trigger avatar (showTriggerLabel)
1585
1741
  * __chevron – rotates 180° when menu is open
1586
1742
  * __menu-header – user identity section at top of menu
1587
1743
  * __menu-header-avatar – gradient avatar circle in header
@@ -1629,6 +1785,17 @@ const USER_DROPDOWN_CSS = `
1629
1785
  box-shadow: 0 0 0 3px var(--thunderid-focus-ring-color);
1630
1786
  }
1631
1787
 
1788
+ .thunderid-user-dropdown__trigger-label {
1789
+ color: var(--thunderid-color-text-primary);
1790
+ font-size: 0.875rem;
1791
+ font-weight: 500;
1792
+ max-width: 150px;
1793
+ overflow: hidden;
1794
+ text-overflow: ellipsis;
1795
+ white-space: nowrap;
1796
+ padding-right: calc(var(--thunderid-spacing-unit) * 0.5);
1797
+ }
1798
+
1632
1799
  .thunderid-user-dropdown__trigger:focus-visible {
1633
1800
  border-color: var(--thunderid-color-primary-main);
1634
1801
  box-shadow: 0 0 0 var(--thunderid-focus-ring-width) var(--thunderid-focus-ring-color);
@@ -1972,9 +2139,7 @@ const USER_PROFILE_CSS = `
1972
2139
  display: flex;
1973
2140
  flex-direction: column;
1974
2141
  padding: calc(var(--thunderid-spacing-unit) * 4);
1975
- width: 100%;
1976
- max-width: 600px;
1977
- margin: 0 auto;
2142
+ min-width: 600px;
1978
2143
  font-family: var(--thunderid-typography-fontFamily);
1979
2144
  background: var(--thunderid-color-background-surface);
1980
2145
  border-radius: var(--thunderid-border-radius-large, 8px);
@@ -2111,6 +2276,7 @@ img.thunderid-user-profile__avatar {
2111
2276
  display: flex;
2112
2277
  align-items: center;
2113
2278
  gap: var(--thunderid-spacing-unit);
2279
+ min-width: 0;
2114
2280
  }
2115
2281
 
2116
2282
  .thunderid-user-profile__field-label {
@@ -2134,6 +2300,7 @@ img.thunderid-user-profile__avatar {
2134
2300
  text-overflow: ellipsis;
2135
2301
  white-space: nowrap;
2136
2302
  max-width: 350px;
2303
+ min-width: 0;
2137
2304
  text-align: start;
2138
2305
  overflow: hidden;
2139
2306
  }
@@ -3397,55 +3564,6 @@ const TYPOGRAPHY_CSS = `
3397
3564
  `;
3398
3565
  var Typography_css_default = TYPOGRAPHY_CSS;
3399
3566
 
3400
- //#endregion
3401
- //#region src/components/auth/sign-in/BaseSignIn.css.ts
3402
- /**
3403
- * Layout styles for the BaseSignIn composition.
3404
- *
3405
- * BEM block: `.thunderid-signin`
3406
- *
3407
- * Mirrors the layout constants in the React SDK's `BaseSignIn.styles.ts`
3408
- * (min-width, content gap, logo sizing) so the sign-in card renders with the
3409
- * same proportions across frameworks.
3410
- */
3411
- const BASE_SIGN_IN_CSS = `
3412
- /* ============================================================
3413
- BaseSignIn
3414
- ============================================================ */
3415
-
3416
- .thunderid-signin {
3417
- min-width: 420px;
3418
- margin: 0 auto;
3419
- font-family: var(--thunderid-typography-fontFamily, inherit);
3420
- border-radius: var(--thunderid-border-radius-large);
3421
- }
3422
-
3423
- .thunderid-signin__content {
3424
- display: flex;
3425
- flex-direction: column;
3426
- gap: calc(var(--thunderid-spacing-unit) * 2);
3427
- }
3428
-
3429
- .thunderid-signin__content > img,
3430
- .thunderid-signin__content > span[role='img'] {
3431
- /* Flex column's default 'stretch' would otherwise force width: auto to fill
3432
- the container instead of shrinking to the image's intrinsic size. */
3433
- align-self: center;
3434
- display: block;
3435
- margin: 0 0 calc(var(--thunderid-spacing-unit) * 1) 0;
3436
- border-radius: var(--thunderid-border-radius-small);
3437
- }
3438
-
3439
- .thunderid-signin__messages {
3440
- margin-top: calc(var(--thunderid-spacing-unit) * 2);
3441
- }
3442
-
3443
- .thunderid-signin__messages > * + * {
3444
- margin-top: calc(var(--thunderid-spacing-unit) * 1);
3445
- }
3446
- `;
3447
- var BaseSignIn_css_default = BASE_SIGN_IN_CSS;
3448
-
3449
3567
  //#endregion
3450
3568
  //#region src/styles/injectStyles.ts
3451
3569
  /**
@@ -3472,6 +3590,7 @@ const STYLES = [
3472
3590
  Logo_css_default,
3473
3591
  Spinner_css_default,
3474
3592
  BaseSignIn_css_default,
3593
+ ChangeCredential_css_default,
3475
3594
  LanguageSwitcher_css_default,
3476
3595
  UserDropdown_css_default,
3477
3596
  UserProfile_css_default
@@ -4245,6 +4364,10 @@ const PencilIcon = () => icon([(0, vue.h)("path", { d: "M17 3a2.828 2.828 0 1 1
4245
4364
  const PasswordField = (0, vue.defineComponent)({
4246
4365
  name: "PasswordField",
4247
4366
  props: {
4367
+ autocomplete: {
4368
+ default: "current-password",
4369
+ type: String
4370
+ },
4248
4371
  disabled: {
4249
4372
  default: false,
4250
4373
  type: Boolean
@@ -4292,6 +4415,7 @@ const PasswordField = (0, vue.defineComponent)({
4292
4415
  for: props.name
4293
4416
  }, [props.label, props.required ? (0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("password-field__required") }, " *") : null]) : null,
4294
4417
  (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("password-field__wrapper") }, [(0, vue.h)("input", {
4418
+ autocomplete: props.autocomplete,
4295
4419
  class: (0, __thunderid_browser.withVendorCSSClassPrefix)("password-field__input"),
4296
4420
  "data-testid": attrs["data-testid"],
4297
4421
  disabled: props.disabled,
@@ -8771,6 +8895,301 @@ const UserProfile = (0, vue.defineComponent)({
8771
8895
  });
8772
8896
  var UserProfile_default = UserProfile;
8773
8897
 
8898
+ //#endregion
8899
+ //#region src/components/presentation/change-credential/BaseChangeCredential.ts
8900
+ const ruleIcon = (passed) => passed ? CheckIcon() : XIcon();
8901
+ /**
8902
+ * Presentational change-credential form with just the two fields a first-time or
8903
+ * unverified credential change needs: new value and confirmation.
8904
+ *
8905
+ * Holds no context and performs no network calls: it renders the fields, evaluates the
8906
+ * policy for the checklist and the submit gate, and emits `submit` with the validated
8907
+ * values. Use `ChangeCredential` for the context-wired variant.
8908
+ */
8909
+ const BaseChangeCredential = (0, vue.defineComponent)({
8910
+ name: "BaseChangeCredential",
8911
+ props: {
8912
+ cardLayout: {
8913
+ default: false,
8914
+ type: Boolean
8915
+ },
8916
+ className: {
8917
+ default: "",
8918
+ type: String
8919
+ },
8920
+ credentialDisplayName: {
8921
+ default: "Password",
8922
+ type: String
8923
+ },
8924
+ error: {
8925
+ default: null,
8926
+ type: String
8927
+ },
8928
+ fieldErrors: {
8929
+ default: () => ({}),
8930
+ type: Object
8931
+ },
8932
+ loading: {
8933
+ default: false,
8934
+ type: Boolean
8935
+ },
8936
+ policy: {
8937
+ default: () => ({}),
8938
+ type: Object
8939
+ },
8940
+ preferences: {
8941
+ default: void 0,
8942
+ type: Object
8943
+ },
8944
+ showRequirements: {
8945
+ default: true,
8946
+ type: Boolean
8947
+ },
8948
+ success: {
8949
+ default: false,
8950
+ type: Boolean
8951
+ },
8952
+ t: {
8953
+ default: void 0,
8954
+ type: Function
8955
+ },
8956
+ title: {
8957
+ default: void 0,
8958
+ type: String
8959
+ },
8960
+ unavailable: {
8961
+ default: false,
8962
+ type: Boolean
8963
+ }
8964
+ },
8965
+ emits: ["submit"],
8966
+ setup(props, { emit }) {
8967
+ const { t: fallbackT } = useI18n_default();
8968
+ const labelParams = (0, vue.computed)(() => ({
8969
+ credential: props.credentialDisplayName,
8970
+ credentialLower: props.credentialDisplayName.toLowerCase()
8971
+ }));
8972
+ const translate = (key, params) => (props.t ?? fallbackT)(key, {
8973
+ ...labelParams.value,
8974
+ ...params
8975
+ });
8976
+ const resolvedTitle = (0, vue.computed)(() => props.title ?? translate("user.change_password.heading"));
8977
+ const newPassword = (0, vue.ref)("");
8978
+ const confirmPassword = (0, vue.ref)("");
8979
+ const submitted = (0, vue.ref)(false);
8980
+ (0, vue.watch)(() => props.success, (succeeded) => {
8981
+ if (!succeeded) return;
8982
+ newPassword.value = "";
8983
+ confirmPassword.value = "";
8984
+ submitted.value = false;
8985
+ });
8986
+ const evaluation = (0, vue.computed)(() => (0, __thunderid_browser.evaluateChangePasswordForm)({
8987
+ confirmPassword: confirmPassword.value,
8988
+ newPassword: newPassword.value
8989
+ }, props.policy));
8990
+ const ruleResults = (0, vue.computed)(() => evaluation.value.ruleResults);
8991
+ const confirmMatches = (0, vue.computed)(() => evaluation.value.confirmMatches);
8992
+ const interactionDisabled = (0, vue.computed)(() => props.loading || props.unavailable);
8993
+ const canSubmit = (0, vue.computed)(() => !interactionDisabled.value && evaluation.value.isValid);
8994
+ function handleSubmit(event) {
8995
+ event.preventDefault();
8996
+ submitted.value = true;
8997
+ if (!canSubmit.value) return;
8998
+ emit("submit", { newPassword: newPassword.value });
8999
+ }
9000
+ return () => {
9001
+ const rootClass = [
9002
+ (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential"),
9003
+ props.cardLayout ? (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential--card") : "",
9004
+ props.className
9005
+ ].filter(Boolean).join(" ");
9006
+ const confirmError = submitted.value && !confirmMatches.value ? translate("user.change_password.mismatch.error") : void 0;
9007
+ const newPasswordError = props.fieldErrors["newPassword"];
9008
+ const form = (0, vue.h)("form", {
9009
+ class: rootClass,
9010
+ novalidate: true,
9011
+ onSubmit: handleSubmit
9012
+ }, [
9013
+ resolvedTitle.value ? (0, vue.h)("h3", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential__heading") }, resolvedTitle.value) : null,
9014
+ props.error ? (0, vue.h)(Alert_default, { severity: "error" }, { default: () => [props.error] }) : null,
9015
+ props.success ? (0, vue.h)(Alert_default, { severity: "success" }, { default: () => [translate("user.change_password.success")] }) : null,
9016
+ (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential__fields") }, [
9017
+ (0, vue.h)(PasswordField_default, {
9018
+ autocomplete: "new-password",
9019
+ disabled: interactionDisabled.value,
9020
+ error: newPasswordError,
9021
+ label: translate("user.change_password.new.label"),
9022
+ modelValue: newPassword.value,
9023
+ name: "newPassword",
9024
+ "onUpdate:modelValue": (value) => {
9025
+ newPassword.value = value;
9026
+ },
9027
+ placeholder: translate("user.change_password.new.placeholder"),
9028
+ required: true
9029
+ }),
9030
+ props.showRequirements && ruleResults.value.length > 0 ? (0, vue.h)("div", {}, [(0, vue.h)("p", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential__requirements-heading") }, translate("user.change_password.requirements.heading")), (0, vue.h)("ul", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential__requirements") }, ruleResults.value.map((rule) => (0, vue.h)("li", {
9031
+ class: [(0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential__requirement"), rule.passed ? (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential__requirement--passed") : ""].filter(Boolean).join(" "),
9032
+ "data-passed": String(rule.passed),
9033
+ key: rule.key
9034
+ }, [(0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential__requirement-icon") }, [ruleIcon(rule.passed)]), (0, vue.h)("span", {}, translate(rule.messageKey, rule.params))])))]) : null,
9035
+ (0, vue.h)(PasswordField_default, {
9036
+ autocomplete: "new-password",
9037
+ disabled: interactionDisabled.value,
9038
+ error: confirmError,
9039
+ label: translate("user.change_password.confirm.label"),
9040
+ modelValue: confirmPassword.value,
9041
+ name: "confirmPassword",
9042
+ "onUpdate:modelValue": (value) => {
9043
+ confirmPassword.value = value;
9044
+ },
9045
+ placeholder: translate("user.change_password.confirm.placeholder"),
9046
+ required: true
9047
+ })
9048
+ ]),
9049
+ (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential__actions") }, [(0, vue.h)(Button_default, {
9050
+ color: "primary",
9051
+ disabled: !canSubmit.value,
9052
+ loading: props.loading,
9053
+ type: "submit",
9054
+ variant: "solid"
9055
+ }, { default: () => [translate("user.change_password.submit")] })])
9056
+ ]);
9057
+ if (!props.unavailable) return form;
9058
+ return (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential__unavailable") }, [(0, vue.h)("div", {
9059
+ "aria-hidden": "true",
9060
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential__unavailable-content")
9061
+ }, [form]), (0, vue.h)("div", {
9062
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential__unavailable-overlay"),
9063
+ role: "status"
9064
+ }, [(0, vue.h)(Alert_default, { severity: "warning" }, { default: () => [(0, vue.h)("strong", translate("user.change_password.unavailable.heading")), (0, vue.h)("div", translate("user.change_password.unavailable.description"))] })])]);
9065
+ };
9066
+ }
9067
+ });
9068
+ var BaseChangeCredential_default = BaseChangeCredential;
9069
+
9070
+ //#endregion
9071
+ //#region src/api/updateMeCredentials.ts
9072
+ const updateMeCredentials = async ({ fetcher, instanceId = 0,...requestConfig }) => {
9073
+ return (0, __thunderid_browser.updateMeCredentials)({
9074
+ ...requestConfig,
9075
+ fetcher: fetcher || (0, __thunderid_browser.createHttpClientFetcher)(instanceId)
9076
+ });
9077
+ };
9078
+ var updateMeCredentials_default = updateMeCredentials;
9079
+
9080
+ //#endregion
9081
+ //#region src/components/presentation/change-credential/ChangeCredential.ts
9082
+ /**
9083
+ * Title-cases a credential attribute name for use as a display-name fallback when the schema
9084
+ * declares no `displayName` for it, e.g. `pin` -> `Pin`.
9085
+ */
9086
+ const defaultDisplayName = (attribute) => attribute.charAt(0).toUpperCase() + attribute.slice(1);
9087
+ /**
9088
+ * ChangeCredential lets the signed-in user set a new value for one of their own credentials.
9089
+ *
9090
+ * It collects only a new value and its confirmation. The self-service credential write path
9091
+ * does not verify the account's existing value today, so this component does not ask for one;
9092
+ * once server-side current-value verification ships, that field returns without a breaking
9093
+ * change to this component's public props.
9094
+ */
9095
+ const ChangeCredential = (0, vue.defineComponent)({
9096
+ name: "ChangeCredential",
9097
+ props: {
9098
+ attribute: {
9099
+ default: __thunderid_browser.CredentialConstants.PASSWORD,
9100
+ type: String
9101
+ },
9102
+ cardLayout: {
9103
+ default: false,
9104
+ type: Boolean
9105
+ },
9106
+ className: {
9107
+ default: "",
9108
+ type: String
9109
+ },
9110
+ policy: {
9111
+ default: void 0,
9112
+ type: Object
9113
+ },
9114
+ preferences: {
9115
+ default: void 0,
9116
+ type: Object
9117
+ },
9118
+ showRequirements: {
9119
+ default: true,
9120
+ type: Boolean
9121
+ },
9122
+ title: {
9123
+ default: void 0,
9124
+ type: String
9125
+ }
9126
+ },
9127
+ emits: ["success"],
9128
+ setup(props, { emit }) {
9129
+ const { baseUrl, endpoints, instanceId, preferences: contextPreferences } = useThunderID_default();
9130
+ const { userSchema } = useUser_default();
9131
+ const { t } = useI18n_default();
9132
+ const resolvedDisplayName = (0, vue.computed)(() => userSchema?.value?.[props.attribute]?.displayName ?? defaultDisplayName(props.attribute));
9133
+ const resolvedPreferences = (0, vue.computed)(() => ({
9134
+ ...contextPreferences,
9135
+ ...props.preferences,
9136
+ user: {
9137
+ ...contextPreferences?.user,
9138
+ ...props.preferences?.user
9139
+ }
9140
+ }));
9141
+ const error = (0, vue.ref)(null);
9142
+ const fieldErrors = (0, vue.ref)({});
9143
+ const loading = (0, vue.ref)(false);
9144
+ const success = (0, vue.ref)(false);
9145
+ const resolvedPolicy = (0, vue.computed)(() => (0, __thunderid_browser.resolveChangeCredentialPolicy)(userSchema?.value, props.attribute, props.policy));
9146
+ async function handleSubmit({ newPassword }) {
9147
+ error.value = null;
9148
+ fieldErrors.value = {};
9149
+ success.value = false;
9150
+ loading.value = true;
9151
+ try {
9152
+ await updateMeCredentials_default({
9153
+ baseUrl,
9154
+ instanceId,
9155
+ payload: { [props.attribute]: newPassword },
9156
+ url: (0, __thunderid_browser.resolveResourceEndpoint)("usersMeCredentials", { endpoints })
9157
+ });
9158
+ success.value = true;
9159
+ emit("success");
9160
+ } catch (caughtError) {
9161
+ const { field, message, messageKey } = (0, __thunderid_browser.mapCredentialUpdateError)(caughtError);
9162
+ const text = message ?? t(messageKey, {
9163
+ credential: resolvedDisplayName.value,
9164
+ credentialLower: resolvedDisplayName.value.toLowerCase()
9165
+ });
9166
+ if (field) fieldErrors.value = { [field]: text };
9167
+ else error.value = text;
9168
+ } finally {
9169
+ loading.value = false;
9170
+ }
9171
+ }
9172
+ return () => (0, vue.h)(BaseChangeCredential_default, {
9173
+ cardLayout: props.cardLayout,
9174
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("change-credential--styled"),
9175
+ className: props.className,
9176
+ credentialDisplayName: resolvedDisplayName.value,
9177
+ error: error.value,
9178
+ fieldErrors: fieldErrors.value,
9179
+ loading: loading.value,
9180
+ onSubmit: handleSubmit,
9181
+ policy: resolvedPolicy.value,
9182
+ preferences: resolvedPreferences.value,
9183
+ showRequirements: props.showRequirements,
9184
+ success: success.value,
9185
+ t,
9186
+ title: props.title,
9187
+ unavailable: !(0, __thunderid_browser.supportsCredential)(userSchema?.value, props.attribute)
9188
+ });
9189
+ }
9190
+ });
9191
+ var ChangeCredential_default = ChangeCredential;
9192
+
8774
9193
  //#endregion
8775
9194
  //#region src/components/presentation/user-dropdown/BaseUserDropdown.ts
8776
9195
  const DEFAULT_ATTRIBUTE_MAPPINGS = {
@@ -8862,10 +9281,18 @@ const BaseUserDropdown = (0, vue.defineComponent)({
8862
9281
  default: null,
8863
9282
  type: Object
8864
9283
  },
9284
+ profileLabel: {
9285
+ default: "Profile",
9286
+ type: String
9287
+ },
8865
9288
  showChevron: {
8866
9289
  default: false,
8867
9290
  type: Boolean
8868
9291
  },
9292
+ showTriggerLabel: {
9293
+ default: false,
9294
+ type: Boolean
9295
+ },
8869
9296
  size: {
8870
9297
  default: "md",
8871
9298
  type: String
@@ -8953,17 +9380,21 @@ const BaseUserDropdown = (0, vue.defineComponent)({
8953
9380
  isOpen.value = !isOpen.value;
8954
9381
  },
8955
9382
  type: "button"
8956
- }, [picture && !avatarImageError.value ? (0, vue.h)("img", {
8957
- alt: displayName,
8958
- class: [px("user-dropdown__avatar"), avatarSizeClass].filter(Boolean).join(" "),
8959
- onError: () => {
8960
- avatarImageError.value = true;
8961
- },
8962
- src: picture
8963
- }) : (0, vue.h)("span", {
8964
- class: [px("user-dropdown__avatar"), avatarSizeClass].filter(Boolean).join(" "),
8965
- style: { background: gradient }
8966
- }, initials), props.showChevron ? (0, vue.h)("span", { class: px("user-dropdown__chevron") }, [(0, vue.h)(ChevronDownIcon, { size: 14 })]) : null]);
9383
+ }, [
9384
+ picture && !avatarImageError.value ? (0, vue.h)("img", {
9385
+ alt: displayName,
9386
+ class: [px("user-dropdown__avatar"), avatarSizeClass].filter(Boolean).join(" "),
9387
+ onError: () => {
9388
+ avatarImageError.value = true;
9389
+ },
9390
+ src: picture
9391
+ }) : (0, vue.h)("span", {
9392
+ class: [px("user-dropdown__avatar"), avatarSizeClass].filter(Boolean).join(" "),
9393
+ style: { background: gradient }
9394
+ }, initials),
9395
+ props.showTriggerLabel ? (0, vue.h)("span", { class: px("user-dropdown__trigger-label") }, displayName) : null,
9396
+ props.showChevron ? (0, vue.h)("span", { class: px("user-dropdown__chevron") }, [(0, vue.h)(ChevronDownIcon, { size: 14 })]) : null
9397
+ ]);
8967
9398
  let menu = null;
8968
9399
  if (isOpen.value) {
8969
9400
  const alignClass = resolveMenuAlign() === "left" ? px("user-dropdown__menu--align-left") : "";
@@ -8990,7 +9421,7 @@ const BaseUserDropdown = (0, vue.defineComponent)({
8990
9421
  props.onProfileClick();
8991
9422
  },
8992
9423
  type: "button"
8993
- }, [(0, vue.h)(UserIcon, { size: 15 }), (0, vue.h)("span", null, "Profile")]));
9424
+ }, [(0, vue.h)(UserIcon, { size: 15 }), (0, vue.h)("span", null, props.profileLabel ?? "Profile")]));
8994
9425
  if (props.menuItems && props.menuItems.length > 0) props.menuItems.forEach((item, idx) => {
8995
9426
  if (item.separatorBefore) menuChildren.push((0, vue.h)("div", {
8996
9427
  class: px("user-dropdown__menu-divider"),
@@ -9085,6 +9516,14 @@ const UserDropdown = (0, vue.defineComponent)({
9085
9516
  default: void 0,
9086
9517
  type: Array
9087
9518
  },
9519
+ onManageProfile: {
9520
+ default: void 0,
9521
+ type: Function
9522
+ },
9523
+ profileLabel: {
9524
+ default: void 0,
9525
+ type: String
9526
+ },
9088
9527
  showChevron: {
9089
9528
  default: false,
9090
9529
  type: Boolean
@@ -9092,6 +9531,10 @@ const UserDropdown = (0, vue.defineComponent)({
9092
9531
  size: {
9093
9532
  default: "md",
9094
9533
  type: String
9534
+ },
9535
+ showTriggerLabel: {
9536
+ default: false,
9537
+ type: Boolean
9095
9538
  }
9096
9539
  },
9097
9540
  emits: ["profileClick"],
@@ -9105,6 +9548,10 @@ const UserDropdown = (0, vue.defineComponent)({
9105
9548
  menuAlign: props.menuAlign,
9106
9549
  menuItems: props.menuItems,
9107
9550
  onProfileClick: () => {
9551
+ if (props.onManageProfile) {
9552
+ props.onManageProfile();
9553
+ return;
9554
+ }
9108
9555
  isProfileModalOpen.value = true;
9109
9556
  emit("profileClick");
9110
9557
  },
@@ -9114,12 +9561,14 @@ const UserDropdown = (0, vue.defineComponent)({
9114
9561
  onSignOut: () => {
9115
9562
  signOut();
9116
9563
  },
9117
- profileContent: isProfileModalOpen.value ? (0, vue.h)(UserProfile_default, {
9564
+ profileContent: !props.onManageProfile && isProfileModalOpen.value ? (0, vue.h)(UserProfile_default, {
9118
9565
  cardLayout: false,
9119
9566
  compact: true,
9120
9567
  editable: true
9121
9568
  }) : null,
9569
+ profileLabel: props.profileLabel,
9122
9570
  showChevron: props.showChevron,
9571
+ showTriggerLabel: props.showTriggerLabel,
9123
9572
  size: props.size,
9124
9573
  user: user.value
9125
9574
  }, slots);
@@ -10348,6 +10797,7 @@ exports.AcceptInvite = AcceptInvite_default;
10348
10797
  exports.Alert = Alert_default;
10349
10798
  exports.ArrowLeftRightIcon = ArrowLeftRightIcon;
10350
10799
  exports.BaseAcceptInvite = BaseAcceptInvite_default;
10800
+ exports.BaseChangeCredential = BaseChangeCredential_default;
10351
10801
  exports.BaseInviteUser = BaseInviteUser_default;
10352
10802
  exports.BaseLanguageSwitcher = BaseLanguageSwitcher_default;
10353
10803
  exports.BaseSignIn = BaseSignIn_default;
@@ -10361,6 +10811,7 @@ exports.BuildingIcon = BuildingIcon;
10361
10811
  exports.Button = Button_default;
10362
10812
  exports.Callback = Callback_default;
10363
10813
  exports.Card = Card_default;
10814
+ exports.ChangeCredential = ChangeCredential_default;
10364
10815
  exports.CheckIcon = CheckIcon;
10365
10816
  exports.Checkbox = Checkbox_default;
10366
10817
  exports.ChevronDownIcon = ChevronDownIcon;