@thunderid/vue 1.3.2 → 1.4.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.
Files changed (61) hide show
  1. package/dist/__tests__/helpers/selectControl.d.ts +12 -0
  2. package/dist/__tests__/helpers/selectControl.d.ts.map +1 -0
  3. package/dist/api/getUsers.d.ts +33 -0
  4. package/dist/api/getUsers.d.ts.map +1 -0
  5. package/dist/cjs/index.cjs +931 -47
  6. package/dist/components/auth/sign-in/AuthOptionFactoryCore.d.ts +9 -0
  7. package/dist/components/auth/sign-in/AuthOptionFactoryCore.d.ts.map +1 -1
  8. package/dist/components/auth/sign-in/BaseSignIn.d.ts +1 -0
  9. package/dist/components/auth/sign-in/BaseSignIn.d.ts.map +1 -1
  10. package/dist/components/auth/sign-up/BaseSignUp.d.ts +1 -0
  11. package/dist/components/auth/sign-up/BaseSignUp.d.ts.map +1 -1
  12. package/dist/components/presentation/accept-invite/BaseAcceptInvite.d.ts.map +1 -1
  13. package/dist/components/presentation/invite-user/BaseInviteUser.d.ts.map +1 -1
  14. package/dist/components/presentation/invite-user/InviteUser.d.ts.map +1 -1
  15. package/dist/components/primitives/AuthFlowSelect/AuthFlowSelect.d.ts +12 -0
  16. package/dist/components/primitives/AuthFlowSelect/AuthFlowSelect.d.ts.map +1 -0
  17. package/dist/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.d.ts +15 -0
  18. package/dist/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.d.ts.map +1 -0
  19. package/dist/components/primitives/CopyableText/CopyableText.css.d.ts +11 -0
  20. package/dist/components/primitives/CopyableText/CopyableText.css.d.ts.map +1 -0
  21. package/dist/components/primitives/CopyableText/CopyableText.d.ts +12 -0
  22. package/dist/components/primitives/CopyableText/CopyableText.d.ts.map +1 -0
  23. package/dist/components/primitives/CopyableText/index.d.ts +2 -0
  24. package/dist/components/primitives/CopyableText/index.d.ts.map +1 -0
  25. package/dist/components/primitives/Icons.d.ts +1 -0
  26. package/dist/components/primitives/Icons.d.ts.map +1 -1
  27. package/dist/components/primitives/PasswordField/PasswordField.d.ts +4 -0
  28. package/dist/components/primitives/PasswordField/PasswordField.d.ts.map +1 -1
  29. package/dist/components/primitives/Select/ResourceSelect.d.ts +91 -0
  30. package/dist/components/primitives/Select/ResourceSelect.d.ts.map +1 -0
  31. package/dist/components/primitives/Select/Select.css.d.ts +2 -2
  32. package/dist/components/primitives/Select/Select.css.d.ts.map +1 -1
  33. package/dist/components/primitives/Select/Select.d.ts +2 -5
  34. package/dist/components/primitives/Select/Select.d.ts.map +1 -1
  35. package/dist/components/primitives/Select/useSelectMessages.d.ts +9 -0
  36. package/dist/components/primitives/Select/useSelectMessages.d.ts.map +1 -0
  37. package/dist/components/primitives/UserSelect/BaseUserSelect.d.ts +16 -0
  38. package/dist/components/primitives/UserSelect/BaseUserSelect.d.ts.map +1 -0
  39. package/dist/components/primitives/UserSelect/UserSelect.d.ts +15 -0
  40. package/dist/components/primitives/UserSelect/UserSelect.d.ts.map +1 -0
  41. package/dist/components/primitives/UserTypeSelect/BaseUserTypeSelect.d.ts +15 -0
  42. package/dist/components/primitives/UserTypeSelect/BaseUserTypeSelect.d.ts.map +1 -0
  43. package/dist/components/primitives/UserTypeSelect/UserTypeSelect.d.ts +12 -0
  44. package/dist/components/primitives/UserTypeSelect/UserTypeSelect.d.ts.map +1 -0
  45. package/dist/composables/useFetchAuthFlows.d.ts +8 -0
  46. package/dist/composables/useFetchAuthFlows.d.ts.map +1 -0
  47. package/dist/composables/useFetchUserTypes.d.ts +5 -0
  48. package/dist/composables/useFetchUserTypes.d.ts.map +1 -0
  49. package/dist/composables/useFetchUsers.d.ts +5 -0
  50. package/dist/composables/useFetchUsers.d.ts.map +1 -0
  51. package/dist/composables/useInfiniteOptions.d.ts +32 -0
  52. package/dist/composables/useInfiniteOptions.d.ts.map +1 -0
  53. package/dist/index.d.ts +19 -2
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +923 -50
  56. package/dist/providers/ThemeProvider.d.ts.map +1 -1
  57. package/dist/providers/ThunderIDProvider.d.ts.map +1 -1
  58. package/dist/styles/injectStyles.d.ts.map +1 -1
  59. package/dist/theme/themeDetection.d.ts +1 -1
  60. package/dist/theme/themeDetection.d.ts.map +1 -1
  61. package/package.json +3 -3
@@ -306,7 +306,7 @@ const PACKAGE_NAME = "@thunderid/vue";
306
306
  * Package-level logger for `@thunderid/vue`.
307
307
  * Use this when logging is not tied to a specific component.
308
308
  */
309
- const logger$5 = (0, __thunderid_browser.createPackageLogger)(PACKAGE_NAME);
309
+ const logger$7 = (0, __thunderid_browser.createPackageLogger)(PACKAGE_NAME);
310
310
  /**
311
311
  * Creates a component-scoped logger prefixed with `@thunderid/vue - <component>`.
312
312
  *
@@ -316,7 +316,7 @@ const createVueLogger = (component) => (0, __thunderid_browser.createPackageComp
316
316
 
317
317
  //#endregion
318
318
  //#region src/providers/I18nProvider.ts
319
- const logger$4 = createVueLogger("I18nProvider");
319
+ const logger$6 = createVueLogger("I18nProvider");
320
320
  const DEFAULT_URL_PARAM = "lang";
321
321
  const deriveRootDomain = (hostname) => {
322
322
  const parts = hostname.split(".");
@@ -356,7 +356,7 @@ const createStorageAdapter = (strategy, key, cookieDomain) => {
356
356
  try {
357
357
  window.localStorage.setItem(key, language);
358
358
  } catch {
359
- logger$4.warn("Failed to persist language preference to localStorage.");
359
+ logger$6.warn("Failed to persist language preference to localStorage.");
360
360
  }
361
361
  }
362
362
  };
@@ -483,7 +483,7 @@ const I18nProvider = (0, vue.defineComponent)({
483
483
  };
484
484
  const setLanguage = (language) => {
485
485
  if (mergedBundlesComputed.value[language]) currentLanguage.value = language;
486
- else logger$4.warn(`Language '${language}' is not available. Available languages: ${Object.keys(mergedBundlesComputed.value).join(", ")}`);
486
+ else logger$6.warn(`Language '${language}' is not available. Available languages: ${Object.keys(mergedBundlesComputed.value).join(", ")}`);
487
487
  };
488
488
  (0, vue.provide)(I18N_KEY, {
489
489
  bundles: (0, vue.readonly)(mergedBundlesComputed),
@@ -615,7 +615,7 @@ const ThemeProvider = (0, vue.defineComponent)({
615
615
  });
616
616
  (0, vue.onBeforeUnmount)(() => {
617
617
  if (classObserver) classObserver.disconnect();
618
- if (mediaQuery?.removeEventListener) mediaQuery.removeEventListener("change", handleThemeChange);
618
+ mediaQuery?.disconnect();
619
619
  });
620
620
  (0, vue.provide)(THEME_KEY, {
621
621
  colorScheme: (0, vue.readonly)(colorScheme),
@@ -908,6 +908,7 @@ var ThunderIDVueClient_default = ThunderIDVueClient;
908
908
 
909
909
  //#endregion
910
910
  //#region src/providers/ThunderIDProvider.ts
911
+ const logger$5 = createVueLogger("ThunderIDProvider");
911
912
  /**
912
913
  * Checks if the current URL contains authentication parameters.
913
914
  */
@@ -1119,7 +1120,7 @@ const ThunderIDProvider = (0, vue.defineComponent)({
1119
1120
  isLoading.value = client.isLoading();
1120
1121
  }
1121
1122
  }
1122
- (0, vue.provide)(THUNDERID_KEY, {
1123
+ const context = {
1123
1124
  afterSignInUrl: props.afterSignInUrl,
1124
1125
  applicationId: props.applicationId,
1125
1126
  baseUrl: props.baseUrl,
@@ -1159,11 +1160,19 @@ const ThunderIDProvider = (0, vue.defineComponent)({
1159
1160
  user,
1160
1161
  userSchema,
1161
1162
  vendor
1162
- });
1163
+ };
1164
+ (0, vue.provide)(THUNDERID_KEY, context);
1165
+ const appContext = (0, vue.getCurrentInstance)()?.appContext;
1166
+ const providesAtAppLevel = !!appContext && !(THUNDERID_KEY in appContext.provides);
1167
+ if (appContext && providesAtAppLevel) appContext.app.provide(THUNDERID_KEY, context);
1163
1168
  (0, vue.onMounted)(async () => {
1164
1169
  const config = buildConfig();
1165
1170
  await client.initialize(config);
1166
- await client.getDiscoveryResponse();
1171
+ try {
1172
+ await client.getDiscoveryResponse();
1173
+ } catch (error) {
1174
+ logger$5.warn("Could not load the OIDC discovery metadata on mount.", error);
1175
+ }
1167
1176
  const initializedConfig = await client.getConfiguration();
1168
1177
  if (initializedConfig?.baseUrl) sessionStorage.setItem(`${vendor}_base_url`, initializedConfig.baseUrl);
1169
1178
  try {
@@ -1210,6 +1219,7 @@ const ThunderIDProvider = (0, vue.defineComponent)({
1210
1219
  }, 100);
1211
1220
  });
1212
1221
  (0, vue.onUnmounted)(() => {
1222
+ if (appContext && providesAtAppLevel && appContext.provides[THUNDERID_KEY] === context) delete appContext.provides[THUNDERID_KEY];
1213
1223
  if (signInCheckInterval) clearInterval(signInCheckInterval);
1214
1224
  if (loadingCheckInterval) clearInterval(loadingCheckInterval);
1215
1225
  });
@@ -2831,6 +2841,68 @@ const CHECKBOX_CSS = `
2831
2841
  `;
2832
2842
  var Checkbox_css_default = CHECKBOX_CSS;
2833
2843
 
2844
+ //#endregion
2845
+ //#region src/components/primitives/CopyableText/CopyableText.css.ts
2846
+ /**
2847
+ * Styles for the CopyableText primitive component.
2848
+ *
2849
+ * BEM block: `.thunderid-copyable-text`
2850
+ *
2851
+ * Elements:
2852
+ * __label | __box | __value | __copy
2853
+ */
2854
+ const COPYABLE_TEXT_CSS = `
2855
+ /* ============================================================
2856
+ CopyableText
2857
+ ============================================================ */
2858
+
2859
+ .thunderid-copyable-text {
2860
+ display: flex;
2861
+ flex-direction: column;
2862
+ gap: calc(var(--thunderid-spacing-unit) * 0.5);
2863
+ width: 100%;
2864
+ }
2865
+
2866
+ .thunderid-copyable-text__label {
2867
+ color: var(--thunderid-color-text-secondary);
2868
+ font-size: 0.875rem;
2869
+ font-weight: 500;
2870
+ }
2871
+
2872
+ .thunderid-copyable-text__box {
2873
+ display: flex;
2874
+ align-items: center;
2875
+ gap: calc(var(--thunderid-spacing-unit) * 1);
2876
+ padding: calc(var(--thunderid-spacing-unit) * 0.75) calc(var(--thunderid-spacing-unit) * 1);
2877
+ background-color: var(--thunderid-color-background-surface);
2878
+ border: 1px solid var(--thunderid-input-borderColor);
2879
+ border-radius: var(--thunderid-border-radius-small);
2880
+ }
2881
+
2882
+ .thunderid-copyable-text__value {
2883
+ flex: 1;
2884
+ min-width: 0;
2885
+ overflow: hidden;
2886
+ text-overflow: ellipsis;
2887
+ white-space: nowrap;
2888
+ word-break: break-all;
2889
+ font-family: monospace;
2890
+ font-size: 0.85rem;
2891
+ color: var(--thunderid-color-text-primary);
2892
+ }
2893
+
2894
+ .thunderid-copyable-text .thunderid-copyable-text__copy {
2895
+ flex-shrink: 0;
2896
+ padding: 0;
2897
+ width: var(--thunderid-button-sm-height);
2898
+ color: var(--thunderid-color-text-secondary);
2899
+ }
2900
+ .thunderid-copyable-text .thunderid-copyable-text__copy:hover {
2901
+ color: var(--thunderid-color-text-primary);
2902
+ }
2903
+ `;
2904
+ var CopyableText_css_default = COPYABLE_TEXT_CSS;
2905
+
2834
2906
  //#endregion
2835
2907
  //#region src/components/primitives/DatePicker/DatePicker.css.ts
2836
2908
  /**
@@ -3288,7 +3360,7 @@ var PasswordField_css_default = PASSWORD_FIELD_CSS;
3288
3360
  * --error – shows validation error state
3289
3361
  *
3290
3362
  * Elements:
3291
- * __label | __required | __input | __error | __helper
3363
+ * __label | __required | __input | __error | __helper | __status | __load-more
3292
3364
  */
3293
3365
  const SELECT_CSS = `
3294
3366
  /* ============================================================
@@ -3368,6 +3440,20 @@ const SELECT_CSS = `
3368
3440
  color: var(--thunderid-color-text-secondary);
3369
3441
  line-height: var(--thunderid-typography-lineHeight-normal);
3370
3442
  }
3443
+
3444
+ .thunderid-select__status {
3445
+ font-size: var(--thunderid-typography-fontSize-xs);
3446
+ color: var(--thunderid-color-text-secondary);
3447
+ line-height: var(--thunderid-typography-lineHeight-normal);
3448
+ }
3449
+ .thunderid-select__status:empty {
3450
+ display: none;
3451
+ }
3452
+
3453
+ .thunderid-select__load-more {
3454
+ color: var(--thunderid-color-primary-main);
3455
+ font-weight: var(--thunderid-typography-fontWeight-medium);
3456
+ }
3371
3457
  `;
3372
3458
  var Select_css_default = SELECT_CSS;
3373
3459
 
@@ -3647,6 +3733,7 @@ const STYLES = [
3647
3733
  Divider_css_default,
3648
3734
  KeyValueList_css_default,
3649
3735
  Logo_css_default,
3736
+ CopyableText_css_default,
3650
3737
  Spinner_css_default,
3651
3738
  BaseSignIn_css_default,
3652
3739
  ChangeCredential_css_default,
@@ -3997,6 +4084,189 @@ function useOAuthCallback({ currentFlowId, flowIdStorageKey = "thunderid_flow_id
3997
4084
  }, { immediate: true });
3998
4085
  }
3999
4086
 
4087
+ //#endregion
4088
+ //#region src/composables/useInfiniteOptions.ts
4089
+ const logger$4 = (0, __thunderid_browser.createPackageComponentLogger)("@thunderid/vue", "useInfiniteOptions");
4090
+ /**
4091
+ * Keeps the option list of a `Select` that loads more options when the user asks for them. It owns the cursor,
4092
+ * appends each batch without duplicates, and stops at the end of the data. Vue counterpart of the React
4093
+ * `useInfiniteOptions`.
4094
+ *
4095
+ * `args` is read live, so a changing `load` or `onError` is picked up without passing refs.
4096
+ */
4097
+ const useInfiniteOptions = (args) => {
4098
+ const options = (0, vue.shallowRef)((0, __thunderid_browser.normalizeSelectOptions)(args.initialOptions));
4099
+ const loading = (0, vue.ref)(false);
4100
+ const error = (0, vue.shallowRef)(null);
4101
+ const hasMore = (0, vue.ref)(true);
4102
+ let cursor;
4103
+ let finished = false;
4104
+ let inFlight = false;
4105
+ let requested = false;
4106
+ let generation = 0;
4107
+ let controller = null;
4108
+ let nonListLogged = false;
4109
+ const applyBatch = (batch) => {
4110
+ const merged = (0, __thunderid_browser.mergeOptionsBatch)({
4111
+ cursor,
4112
+ options: options.value
4113
+ }, batch);
4114
+ if (merged.issue === "cursor-stuck") logger$4.warn("A load returned no new options and the same cursor; the list was treated as finished.");
4115
+ else if (merged.issue === "not-a-list" && !nonListLogged) {
4116
+ nonListLogged = true;
4117
+ logger$4.warn("A load returned something other than a list of options; it was treated as an empty batch.");
4118
+ }
4119
+ const addedNothing = merged.options.length === options.value.length;
4120
+ cursor = merged.cursor;
4121
+ finished = merged.finished;
4122
+ options.value = merged.options;
4123
+ hasMore.value = !merged.finished;
4124
+ error.value = null;
4125
+ return addedNothing && !merged.finished;
4126
+ };
4127
+ const startLoad = async () => {
4128
+ const startedGeneration = generation;
4129
+ const startedController = new AbortController();
4130
+ controller = startedController;
4131
+ inFlight = true;
4132
+ loading.value = true;
4133
+ try {
4134
+ await (0, __thunderid_browser.loadUntilOptionsGrow)(() => args.load({
4135
+ cursor,
4136
+ options: options.value,
4137
+ signal: startedController.signal
4138
+ }), applyBatch, () => startedGeneration === generation);
4139
+ } catch (failure) {
4140
+ if (startedGeneration === generation && !startedController.signal.aborted) {
4141
+ const failureError = (0, __thunderid_browser.toError)(failure);
4142
+ error.value = failureError;
4143
+ try {
4144
+ args.onError?.(failureError);
4145
+ } catch (callbackFailure) {
4146
+ logger$4.error("The onError callback threw.", callbackFailure);
4147
+ }
4148
+ }
4149
+ } finally {
4150
+ if (startedGeneration === generation) {
4151
+ controller = null;
4152
+ inFlight = false;
4153
+ loading.value = false;
4154
+ }
4155
+ }
4156
+ };
4157
+ const onLoadMore = () => {
4158
+ if (inFlight || finished) return;
4159
+ requested = true;
4160
+ startLoad();
4161
+ };
4162
+ const reset = () => {
4163
+ const shouldReload = requested;
4164
+ generation += 1;
4165
+ controller?.abort();
4166
+ controller = null;
4167
+ cursor = void 0;
4168
+ finished = false;
4169
+ inFlight = false;
4170
+ options.value = (0, __thunderid_browser.normalizeSelectOptions)(args.initialOptions);
4171
+ hasMore.value = true;
4172
+ error.value = null;
4173
+ loading.value = false;
4174
+ if (shouldReload) startLoad();
4175
+ };
4176
+ (0, vue.onScopeDispose)(() => {
4177
+ generation += 1;
4178
+ controller?.abort();
4179
+ });
4180
+ return {
4181
+ error,
4182
+ hasMore,
4183
+ loading,
4184
+ onLoadMore,
4185
+ options,
4186
+ reset
4187
+ };
4188
+ };
4189
+ var useInfiniteOptions_default = useInfiniteOptions;
4190
+
4191
+ //#endregion
4192
+ //#region src/api/getUsers.ts
4193
+ /**
4194
+ * Retrieves one page of the user directory. Uses the ThunderID SPA client's httpClient by default,
4195
+ * which attaches the access token, but allows a custom fetcher.
4196
+ *
4197
+ * @param config - Configuration object with URL, paging options and optional request config.
4198
+ * @returns A promise that resolves with one page of the user directory.
4199
+ * @example
4200
+ * ```typescript
4201
+ * const page = await getUsers({
4202
+ * baseUrl: "https://localhost:8090",
4203
+ * limit: 30,
4204
+ * offset: 0,
4205
+ * });
4206
+ * ```
4207
+ */
4208
+ const getUsers = async ({ fetcher, instanceId = 0,...requestConfig }) => (0, __thunderid_browser.getUsers)({
4209
+ ...requestConfig,
4210
+ fetcher: fetcher ?? (0, __thunderid_browser.createHttpClientFetcher)(instanceId)
4211
+ });
4212
+ var getUsers_default = getUsers;
4213
+
4214
+ //#endregion
4215
+ //#region src/composables/useFetchUsers.ts
4216
+ /** A `FetchUsers` backed by the user directory, authenticated with the signed-in user's access token. */
4217
+ const useFetchUsers = () => {
4218
+ const { baseUrl, endpoints, instanceId } = useThunderID_default();
4219
+ const usersUrl = (0, __thunderid_browser.resolveResourceEndpoint)("users", { endpoints });
4220
+ return async ({ filter, limit, offset, signal }) => (0, __thunderid_browser.toUserSelectPage)(await getUsers_default({
4221
+ baseUrl,
4222
+ filter,
4223
+ instanceId,
4224
+ limit,
4225
+ offset,
4226
+ signal,
4227
+ url: usersUrl
4228
+ }), offset);
4229
+ };
4230
+ var useFetchUsers_default = useFetchUsers;
4231
+
4232
+ //#endregion
4233
+ //#region src/composables/useFetchAuthFlows.ts
4234
+ /**
4235
+ * A `FetchAuthFlows` backed by the flow list, restricted to authentication flows and authenticated with
4236
+ * the signed-in user's access token.
4237
+ */
4238
+ const useFetchAuthFlows = () => {
4239
+ const { baseUrl, endpoints, instanceId } = useThunderID_default();
4240
+ const flowsUrl = (0, __thunderid_browser.resolveResourceEndpoint)("flows", { endpoints });
4241
+ return async ({ limit, offset, signal }) => (0, __thunderid_browser.toAuthFlowSelectPage)(await (0, __thunderid_browser.getFlows)({
4242
+ baseUrl,
4243
+ fetcher: (0, __thunderid_browser.createHttpClientFetcher)(instanceId),
4244
+ flowType: __thunderid_browser.AuthFlowSelectConstants.FLOW_TYPE,
4245
+ limit: Math.min(limit, __thunderid_browser.SelectConstants.MAX_PAGE_SIZE),
4246
+ offset,
4247
+ signal,
4248
+ url: flowsUrl
4249
+ }), offset);
4250
+ };
4251
+ var useFetchAuthFlows_default = useFetchAuthFlows;
4252
+
4253
+ //#endregion
4254
+ //#region src/composables/useFetchUserTypes.ts
4255
+ /** A `FetchUserTypes` backed by the user type list, authenticated with the signed-in user's access token. */
4256
+ const useFetchUserTypes = () => {
4257
+ const { baseUrl, endpoints, instanceId } = useThunderID_default();
4258
+ const userTypesUrl = (0, __thunderid_browser.resolveResourceEndpoint)("userTypes", { endpoints });
4259
+ return async ({ limit, offset, signal }) => (0, __thunderid_browser.toUserTypeSelectPage)(await (0, __thunderid_browser.getUserTypes)({
4260
+ baseUrl,
4261
+ fetcher: (0, __thunderid_browser.createHttpClientFetcher)(instanceId),
4262
+ limit: Math.min(limit, __thunderid_browser.SelectConstants.MAX_PAGE_SIZE),
4263
+ offset,
4264
+ signal,
4265
+ url: userTypesUrl
4266
+ }), offset);
4267
+ };
4268
+ var useFetchUserTypes_default = useFetchUserTypes;
4269
+
4000
4270
  //#endregion
4001
4271
  //#region src/components/primitives/Button/Button.ts
4002
4272
  const Button = (0, vue.defineComponent)({
@@ -4233,6 +4503,14 @@ const defaultProps = {
4233
4503
  };
4234
4504
  const icon = (paths) => (0, vue.h)("svg", { ...defaultProps }, paths);
4235
4505
  const CheckIcon = () => icon([(0, vue.h)("polyline", { points: "20 6 9 17 4 12" })]);
4506
+ const CopyIcon = () => icon([(0, vue.h)("rect", {
4507
+ height: "14",
4508
+ rx: "2",
4509
+ ry: "2",
4510
+ width: "14",
4511
+ x: "8",
4512
+ y: "8"
4513
+ }), (0, vue.h)("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })]);
4236
4514
  const XIcon = () => icon([(0, vue.h)("line", {
4237
4515
  x1: "18",
4238
4516
  x2: "6",
@@ -4420,9 +4698,17 @@ const PencilIcon = () => icon([(0, vue.h)("path", { d: "M17 3a2.828 2.828 0 1 1
4420
4698
 
4421
4699
  //#endregion
4422
4700
  //#region src/components/primitives/PasswordField/PasswordField.ts
4701
+ /**
4702
+ * A password input with a show and hide button. The `append` slot holds extra content inside the field, after the
4703
+ * button, such as an action button.
4704
+ */
4423
4705
  const PasswordField = (0, vue.defineComponent)({
4424
4706
  name: "PasswordField",
4425
4707
  props: {
4708
+ ariaLabel: {
4709
+ default: void 0,
4710
+ type: String
4711
+ },
4426
4712
  autocomplete: {
4427
4713
  default: "current-password",
4428
4714
  type: String
@@ -4435,6 +4721,10 @@ const PasswordField = (0, vue.defineComponent)({
4435
4721
  default: void 0,
4436
4722
  type: String
4437
4723
  },
4724
+ hideLabel: {
4725
+ default: "Hide password",
4726
+ type: String
4727
+ },
4438
4728
  label: {
4439
4729
  default: void 0,
4440
4730
  type: String
@@ -4451,13 +4741,21 @@ const PasswordField = (0, vue.defineComponent)({
4451
4741
  default: void 0,
4452
4742
  type: String
4453
4743
  },
4744
+ readonly: {
4745
+ default: false,
4746
+ type: Boolean
4747
+ },
4454
4748
  required: {
4455
4749
  default: false,
4456
4750
  type: Boolean
4751
+ },
4752
+ showLabel: {
4753
+ default: "Show password",
4754
+ type: String
4457
4755
  }
4458
4756
  },
4459
4757
  emits: ["update:modelValue", "blur"],
4460
- setup(props, { emit, attrs }) {
4758
+ setup(props, { emit, attrs, slots }) {
4461
4759
  const visible = (0, vue.ref)(false);
4462
4760
  return () => {
4463
4761
  const hasError = !!props.error;
@@ -4473,28 +4771,34 @@ const PasswordField = (0, vue.defineComponent)({
4473
4771
  class: (0, __thunderid_browser.withVendorCSSClassPrefix)("password-field__label"),
4474
4772
  for: props.name
4475
4773
  }, [props.label, props.required ? (0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("password-field__required") }, " *") : null]) : null,
4476
- (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("password-field__wrapper") }, [(0, vue.h)("input", {
4477
- autocomplete: props.autocomplete,
4478
- class: (0, __thunderid_browser.withVendorCSSClassPrefix)("password-field__input"),
4479
- "data-testid": attrs["data-testid"],
4480
- disabled: props.disabled,
4481
- id: props.name,
4482
- name: props.name,
4483
- onBlur: () => emit("blur"),
4484
- onInput: (e) => emit("update:modelValue", e.target.value),
4485
- placeholder: props.placeholder,
4486
- required: props.required,
4487
- type: visible.value ? "text" : "password",
4488
- value: props.modelValue
4489
- }), (0, vue.h)("button", {
4490
- "aria-label": visible.value ? "Hide password" : "Show password",
4491
- class: (0, __thunderid_browser.withVendorCSSClassPrefix)("password-field__toggle"),
4492
- onClick: () => {
4493
- visible.value = !visible.value;
4494
- },
4495
- tabindex: -1,
4496
- type: "button"
4497
- }, visible.value ? EyeOffIcon() : EyeIcon())]),
4774
+ (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("password-field__wrapper") }, [
4775
+ (0, vue.h)("input", {
4776
+ "aria-label": props.ariaLabel,
4777
+ autocomplete: props.autocomplete,
4778
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("password-field__input"),
4779
+ "data-testid": attrs["data-testid"],
4780
+ disabled: props.disabled,
4781
+ id: props.name,
4782
+ name: props.name,
4783
+ onBlur: () => emit("blur"),
4784
+ onInput: (e) => emit("update:modelValue", e.target.value),
4785
+ placeholder: props.placeholder,
4786
+ readonly: props.readonly,
4787
+ required: props.required,
4788
+ type: visible.value ? "text" : "password",
4789
+ value: props.modelValue
4790
+ }),
4791
+ (0, vue.h)("button", {
4792
+ "aria-label": visible.value ? props.hideLabel : props.showLabel,
4793
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("password-field__toggle"),
4794
+ onClick: () => {
4795
+ visible.value = !visible.value;
4796
+ },
4797
+ tabindex: props.readonly ? 0 : -1,
4798
+ type: "button"
4799
+ }, visible.value ? EyeOffIcon() : EyeIcon()),
4800
+ slots["append"]?.()
4801
+ ]),
4498
4802
  hasError ? (0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("password-field__error") }, props.error) : null
4499
4803
  ]);
4500
4804
  };
@@ -4502,15 +4806,35 @@ const PasswordField = (0, vue.defineComponent)({
4502
4806
  });
4503
4807
  var PasswordField_default = PasswordField;
4504
4808
 
4809
+ //#endregion
4810
+ //#region src/components/primitives/Select/useSelectMessages.ts
4811
+ /**
4812
+ * The wording of `Select`: the active translations when there is an I18n provider, English otherwise, so `Select`
4813
+ * works without a provider. Call the result in a render function so a change of language is picked up.
4814
+ */
4815
+ const useSelectMessages = () => {
4816
+ const i18n = (0, vue.inject)(I18N_KEY, null);
4817
+ return () => (0, __thunderid_browser.getSelectMessages)(i18n ? (key) => i18n.t(key) : void 0);
4818
+ };
4819
+ var useSelectMessages_default = useSelectMessages;
4820
+
4505
4821
  //#endregion
4506
4822
  //#region src/components/primitives/Select/Select.ts
4507
4823
  const Select = (0, vue.defineComponent)({
4508
4824
  name: "Select",
4509
4825
  props: {
4826
+ ariaLabel: {
4827
+ default: void 0,
4828
+ type: String
4829
+ },
4510
4830
  disabled: {
4511
4831
  default: false,
4512
4832
  type: Boolean
4513
4833
  },
4834
+ emptyText: {
4835
+ default: void 0,
4836
+ type: String
4837
+ },
4514
4838
  error: {
4515
4839
  default: void 0,
4516
4840
  type: String
@@ -4523,6 +4847,10 @@ const Select = (0, vue.defineComponent)({
4523
4847
  default: void 0,
4524
4848
  type: String
4525
4849
  },
4850
+ loading: {
4851
+ default: false,
4852
+ type: Boolean
4853
+ },
4526
4854
  modelValue: {
4527
4855
  default: "",
4528
4856
  type: String
@@ -4531,6 +4859,10 @@ const Select = (0, vue.defineComponent)({
4531
4859
  default: void 0,
4532
4860
  type: String
4533
4861
  },
4862
+ onLoadMore: {
4863
+ default: void 0,
4864
+ type: Function
4865
+ },
4534
4866
  options: {
4535
4867
  default: () => [],
4536
4868
  type: Array
@@ -4542,12 +4874,19 @@ const Select = (0, vue.defineComponent)({
4542
4874
  required: {
4543
4875
  default: false,
4544
4876
  type: Boolean
4877
+ },
4878
+ selectedOption: {
4879
+ default: void 0,
4880
+ type: Object
4545
4881
  }
4546
4882
  },
4547
- emits: ["update:modelValue"],
4883
+ emits: ["blur", "update:modelValue"],
4548
4884
  setup(props, { emit, attrs }) {
4885
+ const messages = useSelectMessages_default();
4549
4886
  return () => {
4550
4887
  const hasError = !!props.error;
4888
+ const items = (0, __thunderid_browser.normalizeSelectOptions)(props.options);
4889
+ const text = messages();
4551
4890
  const wrapperClass = [
4552
4891
  (0, __thunderid_browser.withVendorCSSClassPrefix)("select"),
4553
4892
  hasError ? (0, __thunderid_browser.withVendorCSSClassPrefix)("select--error") : "",
@@ -4557,6 +4896,13 @@ const Select = (0, vue.defineComponent)({
4557
4896
  if (hasError) helperContent = (0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("select__error") }, props.error);
4558
4897
  else if (props.helperText) helperContent = (0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("select__helper") }, props.helperText);
4559
4898
  else helperContent = null;
4899
+ const { selectedOption } = props;
4900
+ const showsSelectedOption = selectedOption?.value === props.modelValue && !items.some((item) => item.value === props.modelValue);
4901
+ let statusText;
4902
+ if (props.loading) statusText = items.length === 0 ? text.loading : text.loadingMore;
4903
+ else if (items.length === 0 && !props.onLoadMore) statusText = props.emptyText;
4904
+ const hasStatus = props.onLoadMore !== void 0 || props.emptyText !== void 0 || props.loading;
4905
+ const showsLoadMore = props.onLoadMore !== void 0 && (items.length > 0 || !props.loading);
4560
4906
  return (0, vue.h)("div", {
4561
4907
  class: wrapperClass,
4562
4908
  style: attrs.style
@@ -4566,21 +4912,46 @@ const Select = (0, vue.defineComponent)({
4566
4912
  for: props.name
4567
4913
  }, [props.label, props.required ? (0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("select__required") }, " *") : null]) : null,
4568
4914
  (0, vue.h)("select", {
4915
+ "aria-busy": props.loading || void 0,
4916
+ "aria-label": props.ariaLabel,
4569
4917
  class: (0, __thunderid_browser.withVendorCSSClassPrefix)("select__input"),
4570
4918
  "data-testid": attrs["data-testid"],
4571
4919
  disabled: props.disabled,
4572
4920
  id: props.name,
4573
4921
  name: props.name,
4574
- onChange: (e) => emit("update:modelValue", e.target.value),
4922
+ onBlur: () => emit("blur"),
4923
+ onChange: (e) => {
4924
+ const control = e.target;
4925
+ if (control.value !== __thunderid_browser.SelectConstants.LOAD_MORE_OPTION_VALUE) {
4926
+ emit("update:modelValue", control.value);
4927
+ return;
4928
+ }
4929
+ control.value = props.modelValue;
4930
+ props.onLoadMore?.();
4931
+ },
4575
4932
  required: props.required,
4576
4933
  value: props.modelValue
4577
- }, [props.placeholder ? (0, vue.h)("option", {
4578
- disabled: true,
4579
- value: ""
4580
- }, props.placeholder) : null, ...props.options.map((opt) => (0, vue.h)("option", {
4581
- key: opt.value,
4582
- value: opt.value
4583
- }, opt.label))]),
4934
+ }, [
4935
+ props.placeholder ? (0, vue.h)("option", {
4936
+ disabled: props.required,
4937
+ value: ""
4938
+ }, props.placeholder) : null,
4939
+ showsSelectedOption && selectedOption ? (0, vue.h)("option", { value: selectedOption.value }, selectedOption.label) : null,
4940
+ ...items.map((opt) => (0, vue.h)("option", {
4941
+ disabled: opt.disabled,
4942
+ key: opt.value,
4943
+ value: opt.value
4944
+ }, opt.label)),
4945
+ showsLoadMore ? (0, vue.h)("option", {
4946
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("select__load-more"),
4947
+ disabled: props.loading,
4948
+ value: __thunderid_browser.SelectConstants.LOAD_MORE_OPTION_VALUE
4949
+ }, props.loading ? text.loadingMore : text.loadMore) : null
4950
+ ]),
4951
+ hasStatus ? (0, vue.h)("span", {
4952
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("select__status"),
4953
+ role: "status"
4954
+ }, statusText) : null,
4584
4955
  helperContent
4585
4956
  ]);
4586
4957
  };
@@ -4588,6 +4959,374 @@ const Select = (0, vue.defineComponent)({
4588
4959
  });
4589
4960
  var Select_default = Select;
4590
4961
 
4962
+ //#endregion
4963
+ //#region src/components/primitives/Select/ResourceSelect.ts
4964
+ const NO_PAGES = () => Promise.resolve({
4965
+ nextOffset: null,
4966
+ options: []
4967
+ });
4968
+ /** The props every resource picker (users, authentication flows, user types) passes straight through. */
4969
+ const commonSelectProps = {
4970
+ component: {
4971
+ default: void 0,
4972
+ type: Object
4973
+ },
4974
+ disabled: {
4975
+ default: false,
4976
+ type: Boolean
4977
+ },
4978
+ emptyText: {
4979
+ default: void 0,
4980
+ type: String
4981
+ },
4982
+ error: {
4983
+ default: void 0,
4984
+ type: String
4985
+ },
4986
+ filter: {
4987
+ default: void 0,
4988
+ type: String
4989
+ },
4990
+ helperText: {
4991
+ default: void 0,
4992
+ type: String
4993
+ },
4994
+ id: {
4995
+ default: void 0,
4996
+ type: String
4997
+ },
4998
+ label: {
4999
+ default: void 0,
5000
+ type: String
5001
+ },
5002
+ modelValue: {
5003
+ default: "",
5004
+ type: String
5005
+ },
5006
+ name: {
5007
+ default: void 0,
5008
+ type: String
5009
+ },
5010
+ onError: {
5011
+ default: void 0,
5012
+ type: Function
5013
+ },
5014
+ pageSize: {
5015
+ default: void 0,
5016
+ type: Number
5017
+ },
5018
+ placeholder: {
5019
+ default: void 0,
5020
+ type: String
5021
+ },
5022
+ required: {
5023
+ default: false,
5024
+ type: Boolean
5025
+ },
5026
+ selectedOption: {
5027
+ default: void 0,
5028
+ type: Object
5029
+ }
5030
+ };
5031
+ /**
5032
+ * The part the `USER_SELECT`, `AUTH_FLOW_SELECT` and `USER_TYPE_SELECT` pickers share: a {@link Select} that loads
5033
+ * one resource page by page. The list restarts when the page function, filter or page size changes.
5034
+ */
5035
+ const ResourceSelect = (0, vue.defineComponent)({
5036
+ name: "ResourceSelect",
5037
+ props: {
5038
+ ...commonSelectProps,
5039
+ bemBlock: {
5040
+ required: true,
5041
+ type: String
5042
+ },
5043
+ defaults: {
5044
+ default: void 0,
5045
+ type: Object
5046
+ },
5047
+ fallbackMessages: {
5048
+ required: true,
5049
+ type: Object
5050
+ },
5051
+ fetchPage: {
5052
+ default: void 0,
5053
+ type: Function
5054
+ },
5055
+ mapping: {
5056
+ default: void 0,
5057
+ type: Object
5058
+ },
5059
+ messageKey: {
5060
+ required: true,
5061
+ type: String
5062
+ },
5063
+ resource: {
5064
+ required: true,
5065
+ type: String
5066
+ },
5067
+ type: {
5068
+ required: true,
5069
+ type: String
5070
+ }
5071
+ },
5072
+ emits: ["blur", "update:modelValue"],
5073
+ setup(props, { emit }) {
5074
+ const { t } = useI18n_default();
5075
+ const loader = (0, vue.computed)(() => (0, __thunderid_browser.createResourceOptionsLoader)({
5076
+ get component() {
5077
+ return props.component ?? {
5078
+ id: props.id ?? props.name ?? props.bemBlock,
5079
+ type: props.type
5080
+ };
5081
+ },
5082
+ get defaults() {
5083
+ return props.defaults;
5084
+ },
5085
+ fetchPage: props.fetchPage ?? NO_PAGES,
5086
+ filter: props.filter,
5087
+ get mapping() {
5088
+ return props.mapping;
5089
+ },
5090
+ pageSize: (0, __thunderid_browser.resolvePageSize)(props.pageSize),
5091
+ resource: props.resource
5092
+ }));
5093
+ const { hasMore, loading, onLoadMore, options, reset } = useInfiniteOptions_default({
5094
+ load: (context) => loader.value(context),
5095
+ onError: (error) => props.onError?.(error)
5096
+ });
5097
+ (0, vue.onMounted)(() => {
5098
+ if (props.fetchPage) onLoadMore();
5099
+ });
5100
+ (0, vue.watch)(loader, () => {
5101
+ reset();
5102
+ if (props.fetchPage) onLoadMore();
5103
+ });
5104
+ return () => {
5105
+ return (0, vue.h)(Select_default, {
5106
+ "aria-label": [
5107
+ props.label,
5108
+ props.placeholder,
5109
+ t(`elements.fields.${props.messageKey}.aria_label`)
5110
+ ].find((text) => Boolean(text)) ?? props.fallbackMessages.ariaLabel,
5111
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)(props.bemBlock)),
5112
+ disabled: props.disabled,
5113
+ emptyText: props.emptyText ?? (t(`elements.fields.${props.messageKey}.empty`) || props.fallbackMessages.empty),
5114
+ error: props.error,
5115
+ helperText: props.helperText,
5116
+ id: props.id,
5117
+ label: props.label,
5118
+ loading: loading.value,
5119
+ modelValue: props.modelValue,
5120
+ name: props.name,
5121
+ onBlur: () => emit("blur"),
5122
+ onLoadMore: props.fetchPage && hasMore.value ? onLoadMore : void 0,
5123
+ options: options.value,
5124
+ placeholder: props.placeholder,
5125
+ required: props.required,
5126
+ selectedOption: props.selectedOption,
5127
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value)
5128
+ });
5129
+ };
5130
+ }
5131
+ });
5132
+ var ResourceSelect_default = ResourceSelect;
5133
+
5134
+ //#endregion
5135
+ //#region src/components/primitives/UserSelect/BaseUserSelect.ts
5136
+ const USER_DEFAULTS = { labelAttributes: __thunderid_browser.UserSelectConstants.LABEL_ATTRIBUTES };
5137
+ /**
5138
+ * Single-user picker: a `Select` that loads from the given `fetchUsers` and submits the user's ID.
5139
+ * Labels come from `display`, `username`, or `email` unless `mapping` says otherwise.
5140
+ * Building block for `UserSelect`; for a custom data source use `Select` with `useInfiniteOptions`.
5141
+ */
5142
+ const BaseUserSelect = (0, vue.defineComponent)({
5143
+ name: "BaseUserSelect",
5144
+ props: {
5145
+ ...commonSelectProps,
5146
+ fetchUsers: {
5147
+ default: void 0,
5148
+ type: Function
5149
+ },
5150
+ mapping: {
5151
+ default: void 0,
5152
+ type: Object
5153
+ }
5154
+ },
5155
+ emits: ["update:modelValue"],
5156
+ setup(props, { emit }) {
5157
+ return () => {
5158
+ const { fetchUsers, mapping,...common } = props;
5159
+ return (0, vue.h)(ResourceSelect_default, {
5160
+ ...common,
5161
+ bemBlock: "user-select",
5162
+ defaults: USER_DEFAULTS,
5163
+ fallbackMessages: {
5164
+ ariaLabel: "Select a user",
5165
+ empty: "No users found."
5166
+ },
5167
+ fetchPage: fetchUsers,
5168
+ mapping,
5169
+ messageKey: "user_select",
5170
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value),
5171
+ resource: "users",
5172
+ type: __thunderid_browser.EmbeddedFlowComponentType.UserSelect
5173
+ });
5174
+ };
5175
+ }
5176
+ });
5177
+ var BaseUserSelect_default = BaseUserSelect;
5178
+
5179
+ //#endregion
5180
+ //#region src/components/primitives/UserSelect/UserSelect.ts
5181
+ /**
5182
+ * Single-user picker for signed-in screens. It loads the user directory itself with the signed-in
5183
+ * user's access token and submits the chosen user's ID, so it takes no data source. For any other
5184
+ * data source use {@link Select} with {@link useInfiniteOptions}.
5185
+ */
5186
+ const UserSelect = (0, vue.defineComponent)({
5187
+ name: "UserSelect",
5188
+ props: {
5189
+ ...commonSelectProps,
5190
+ mapping: {
5191
+ default: void 0,
5192
+ type: Object
5193
+ }
5194
+ },
5195
+ emits: ["update:modelValue"],
5196
+ setup(props, { emit }) {
5197
+ const fetchUsers = useFetchUsers_default();
5198
+ return () => (0, vue.h)(BaseUserSelect_default, {
5199
+ ...props,
5200
+ fetchUsers,
5201
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value)
5202
+ });
5203
+ }
5204
+ });
5205
+ var UserSelect_default = UserSelect;
5206
+
5207
+ //#endregion
5208
+ //#region src/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.ts
5209
+ const AUTH_FLOW_DEFAULTS = { labelAttributes: __thunderid_browser.AuthFlowSelectConstants.LABEL_ATTRIBUTES };
5210
+ /**
5211
+ * Authentication-flow picker: a `Select` that loads from the given `fetchAuthFlows`, showing each flow by
5212
+ * its name and submitting its ID. Building block for `AuthFlowSelect`; for a custom data source use
5213
+ * `Select` with `useInfiniteOptions`.
5214
+ */
5215
+ const BaseAuthFlowSelect = (0, vue.defineComponent)({
5216
+ name: "BaseAuthFlowSelect",
5217
+ props: {
5218
+ ...commonSelectProps,
5219
+ fetchAuthFlows: {
5220
+ default: void 0,
5221
+ type: Function
5222
+ }
5223
+ },
5224
+ emits: ["update:modelValue"],
5225
+ setup(props, { emit }) {
5226
+ return () => {
5227
+ const { fetchAuthFlows,...common } = props;
5228
+ return (0, vue.h)(ResourceSelect_default, {
5229
+ ...common,
5230
+ bemBlock: "auth-flow-select",
5231
+ defaults: AUTH_FLOW_DEFAULTS,
5232
+ fallbackMessages: {
5233
+ ariaLabel: "Select a login flow",
5234
+ empty: "No login flows found."
5235
+ },
5236
+ fetchPage: fetchAuthFlows,
5237
+ messageKey: "auth_flow_select",
5238
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value),
5239
+ resource: "auth flows",
5240
+ type: __thunderid_browser.EmbeddedFlowComponentType.AuthFlowSelect
5241
+ });
5242
+ };
5243
+ }
5244
+ });
5245
+ var BaseAuthFlowSelect_default = BaseAuthFlowSelect;
5246
+
5247
+ //#endregion
5248
+ //#region src/components/primitives/AuthFlowSelect/AuthFlowSelect.ts
5249
+ /**
5250
+ * Authentication-flow picker for signed-in screens. It loads the authentication flows itself with the
5251
+ * signed-in user's access token and submits the chosen flow's ID, so it takes no data source. For any
5252
+ * other data source use `Select` with `useInfiniteOptions`.
5253
+ */
5254
+ const AuthFlowSelect = (0, vue.defineComponent)({
5255
+ name: "AuthFlowSelect",
5256
+ props: { ...commonSelectProps },
5257
+ emits: ["update:modelValue"],
5258
+ setup(props, { emit }) {
5259
+ const fetchAuthFlows = useFetchAuthFlows_default();
5260
+ return () => (0, vue.h)(BaseAuthFlowSelect_default, {
5261
+ ...props,
5262
+ fetchAuthFlows,
5263
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value)
5264
+ });
5265
+ }
5266
+ });
5267
+ var AuthFlowSelect_default = AuthFlowSelect;
5268
+
5269
+ //#endregion
5270
+ //#region src/components/primitives/UserTypeSelect/BaseUserTypeSelect.ts
5271
+ /**
5272
+ * User-type picker: a `Select` that loads from the given `fetchUserTypes`, showing and submitting each
5273
+ * user type's handle. Building block for `UserTypeSelect`; for a custom data source use `Select` with
5274
+ * `useInfiniteOptions`.
5275
+ */
5276
+ const BaseUserTypeSelect = (0, vue.defineComponent)({
5277
+ name: "BaseUserTypeSelect",
5278
+ props: {
5279
+ ...commonSelectProps,
5280
+ fetchUserTypes: {
5281
+ default: void 0,
5282
+ type: Function
5283
+ }
5284
+ },
5285
+ emits: ["update:modelValue"],
5286
+ setup(props, { emit }) {
5287
+ return () => {
5288
+ const { fetchUserTypes,...common } = props;
5289
+ return (0, vue.h)(ResourceSelect_default, {
5290
+ ...common,
5291
+ bemBlock: "user-type-select",
5292
+ fallbackMessages: {
5293
+ ariaLabel: "Select a user type",
5294
+ empty: "No user types found."
5295
+ },
5296
+ fetchPage: fetchUserTypes,
5297
+ mapping: __thunderid_browser.UserTypeSelectConstants.MAPPING,
5298
+ messageKey: "user_type_select",
5299
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value),
5300
+ resource: "user types",
5301
+ type: __thunderid_browser.EmbeddedFlowComponentType.UserTypeSelect
5302
+ });
5303
+ };
5304
+ }
5305
+ });
5306
+ var BaseUserTypeSelect_default = BaseUserTypeSelect;
5307
+
5308
+ //#endregion
5309
+ //#region src/components/primitives/UserTypeSelect/UserTypeSelect.ts
5310
+ /**
5311
+ * User-type picker for signed-in screens. It loads the user types itself with the signed-in user's
5312
+ * access token and submits the chosen type's handle, so it takes no data source. For any other data
5313
+ * source use `Select` with `useInfiniteOptions`.
5314
+ */
5315
+ const UserTypeSelect = (0, vue.defineComponent)({
5316
+ name: "UserTypeSelect",
5317
+ props: { ...commonSelectProps },
5318
+ emits: ["update:modelValue"],
5319
+ setup(props, { emit }) {
5320
+ const fetchUserTypes = useFetchUserTypes_default();
5321
+ return () => (0, vue.h)(BaseUserTypeSelect_default, {
5322
+ ...props,
5323
+ fetchUserTypes,
5324
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value)
5325
+ });
5326
+ }
5327
+ });
5328
+ var UserTypeSelect_default = UserTypeSelect;
5329
+
4591
5330
  //#endregion
4592
5331
  //#region src/components/primitives/Checkbox/Checkbox.ts
4593
5332
  const Checkbox = (0, vue.defineComponent)({
@@ -4896,6 +5635,71 @@ const Divider = (0, vue.defineComponent)({
4896
5635
  });
4897
5636
  var Divider_default = Divider;
4898
5637
 
5638
+ //#endregion
5639
+ //#region src/components/primitives/CopyableText/CopyableText.ts
5640
+ /**
5641
+ * Shows a text value with an optional label and a button that copies it to the clipboard. It uses the Clipboard
5642
+ * API and falls back to a textarea when that is not available, then shows "Copied!" for 3 seconds. With `masked`
5643
+ * the value sits in a read-only password field with the same show and hide control as `PasswordField`, and copying
5644
+ * always copies the real value. The copy control is an icon button inside the box in both layouts. A browser does
5645
+ * not copy out of a password field, which is why copying is a button of its own. Vue counterpart of the React
5646
+ * `CopyableText`.
5647
+ */
5648
+ const CopyableText = (0, vue.defineComponent)({
5649
+ name: "CopyableText",
5650
+ props: {
5651
+ label: {
5652
+ default: "",
5653
+ type: String
5654
+ },
5655
+ masked: {
5656
+ default: false,
5657
+ type: Boolean
5658
+ },
5659
+ value: {
5660
+ required: true,
5661
+ type: String
5662
+ }
5663
+ },
5664
+ setup(props, { attrs }) {
5665
+ const { t } = useI18n_default();
5666
+ const copied = (0, vue.ref)(false);
5667
+ const handleCopy = async () => {
5668
+ await (0, __thunderid_browser.copyTextToClipboard)(props.value);
5669
+ copied.value = true;
5670
+ setTimeout(() => {
5671
+ copied.value = false;
5672
+ }, 3e3);
5673
+ };
5674
+ return () => {
5675
+ const rootClass = [(0, __thunderid_browser.withVendorCSSClassPrefix)("copyable-text"), attrs.class || ""].filter(Boolean).join(" ");
5676
+ const copyLabel = copied.value ? t("elements.display.copyable_text.copied") : t("elements.display.copyable_text.copy");
5677
+ const copyButton = (0, vue.h)(Button_default, {
5678
+ "aria-label": copyLabel,
5679
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("copyable-text__copy"),
5680
+ onClick: () => {
5681
+ handleCopy().catch(() => void 0);
5682
+ },
5683
+ size: "small",
5684
+ title: copyLabel,
5685
+ variant: "ghost"
5686
+ }, () => copied.value ? CheckIcon() : CopyIcon());
5687
+ return (0, vue.h)("div", {
5688
+ class: rootClass,
5689
+ style: attrs.style
5690
+ }, [props.label ? (0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("copyable-text__label") }, props.label) : null, props.masked ? (0, vue.h)(PasswordField_default, {
5691
+ ariaLabel: props.label || void 0,
5692
+ autocomplete: "off",
5693
+ hideLabel: t("elements.display.copyable_text.hide"),
5694
+ modelValue: props.value,
5695
+ readonly: true,
5696
+ showLabel: t("elements.display.copyable_text.show")
5697
+ }, { append: () => copyButton }) : (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("copyable-text__box") }, [(0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("copyable-text__value") }, props.value), copyButton])]);
5698
+ };
5699
+ }
5700
+ });
5701
+ var CopyableText_default = CopyableText;
5702
+
4899
5703
  //#endregion
4900
5704
  //#region src/components/primitives/Logo/Logo.ts
4901
5705
  const Logo = (0, vue.defineComponent)({
@@ -6290,6 +7094,28 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
6290
7094
  t: options.t || ((k) => k)
6291
7095
  });
6292
7096
  };
7097
+ const resourceSelectProps = () => {
7098
+ const identifier = component.ref ?? "";
7099
+ const isTouched = touchedFields[identifier] || false;
7100
+ return {
7101
+ class: options.inputClassName,
7102
+ component,
7103
+ error: isTouched ? formErrors[identifier] : void 0,
7104
+ key,
7105
+ label: resolve(component.label) || "",
7106
+ modelValue: formValues[identifier] || "",
7107
+ name: identifier,
7108
+ onBlur: () => options.onInputBlur?.(identifier),
7109
+ onError: options.onPickerError,
7110
+ "onUpdate:modelValue": (val) => onInputChange(identifier, val),
7111
+ placeholder: resolve(component.placeholder),
7112
+ required: component.required
7113
+ };
7114
+ };
7115
+ const skipUnsupported = (typeName) => {
7116
+ logger$2.warn(`Unsupported component type: ${typeName}. Skipping render.`);
7117
+ return null;
7118
+ };
6293
7119
  switch (component.type) {
6294
7120
  case __thunderid_browser.EmbeddedFlowComponentType.TextInput:
6295
7121
  case __thunderid_browser.EmbeddedFlowComponentType.PasswordInput:
@@ -6471,6 +7297,18 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
6471
7297
  required: component.required
6472
7298
  });
6473
7299
  }
7300
+ case __thunderid_browser.EmbeddedFlowComponentType.UserSelect: return options.fetchUsers ? (0, vue.h)(BaseUserSelect_default, {
7301
+ ...resourceSelectProps(),
7302
+ fetchUsers: options.fetchUsers
7303
+ }) : skipUnsupported("USER_SELECT");
7304
+ case __thunderid_browser.EmbeddedFlowComponentType.AuthFlowSelect: return options.fetchAuthFlows ? (0, vue.h)(BaseAuthFlowSelect_default, {
7305
+ ...resourceSelectProps(),
7306
+ fetchAuthFlows: options.fetchAuthFlows
7307
+ }) : skipUnsupported("AUTH_FLOW_SELECT");
7308
+ case __thunderid_browser.EmbeddedFlowComponentType.UserTypeSelect: return options.fetchUserTypes ? (0, vue.h)(BaseUserTypeSelect_default, {
7309
+ ...resourceSelectProps(),
7310
+ fetchUserTypes: options.fetchUserTypes
7311
+ }) : skipUnsupported("USER_TYPE_SELECT");
6474
7312
  case __thunderid_browser.EmbeddedFlowComponentType.Block:
6475
7313
  if (component.components && component.components.length > 0) {
6476
7314
  const blockChildren = component.components.map((childComponent, index) => createAuthComponentFromFlow(childComponent, formValues, touchedFields, formErrors, isLoading, isFormValid, resetForm, onInputChange, {
@@ -6577,6 +7415,16 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
6577
7415
  pairs
6578
7416
  });
6579
7417
  }
7418
+ case __thunderid_browser.EmbeddedFlowComponentType.CopyableText: {
7419
+ const sourceKey = component.source;
7420
+ const value = sourceKey && options.additionalData ? String(options.additionalData[sourceKey] ?? "") : "";
7421
+ return (0, vue.h)(CopyableText_default, {
7422
+ key,
7423
+ label: resolve(component.label),
7424
+ masked: Boolean(component.masked),
7425
+ value
7426
+ });
7427
+ }
6580
7428
  default:
6581
7429
  logger$2.warn(`Unsupported component type: ${component.type}. Skipping render.`);
6582
7430
  return null;
@@ -6990,6 +7838,7 @@ const BaseSignIn = (0, vue.defineComponent)({
6990
7838
  ].filter(Boolean).join(" ");
6991
7839
  if (slots["default"]) {
6992
7840
  const renderProps = {
7841
+ additionalData: props.additionalData,
6993
7842
  components: props.components || [],
6994
7843
  error: apiError.value,
6995
7844
  fieldErrors: formErrors.value,
@@ -7281,9 +8130,8 @@ const SignIn = (0, vue.defineComponent)({
7281
8130
  }
7282
8131
  const effectiveApplicationId = applicationId || urlParams.applicationId;
7283
8132
  if (!urlParams.executionId && !effectiveApplicationId) {
7284
- const err = new __thunderid_browser.ThunderIDRuntimeError("Either executionId or applicationId is required for authentication", "SIGN_IN_ERROR", "vue");
7285
- setError(err);
7286
- throw err;
8133
+ setError(new __thunderid_browser.ThunderIDRuntimeError("Either executionId or applicationId is required for authentication", "SIGN_IN_ERROR", "vue"));
8134
+ return;
7287
8135
  }
7288
8136
  try {
7289
8137
  flowError.value = null;
@@ -8112,6 +8960,7 @@ const BaseSignUp = (0, vue.defineComponent)({
8112
8960
  ].filter(Boolean).join(" ");
8113
8961
  if (slots["default"]) {
8114
8962
  const renderProps = {
8963
+ additionalData: currentFlow.value?.data?.additionalData ?? {},
8115
8964
  components: currentFlow.value?.data?.components || [],
8116
8965
  error: apiError.value,
8117
8966
  fieldErrors: formErrors.value,
@@ -9849,7 +10698,7 @@ const BaseAcceptInvite = (0, vue.defineComponent)({
9849
10698
  const errors = {};
9850
10699
  const validateComponents = (comps) => {
9851
10700
  comps.forEach((comp) => {
9852
- if ((comp.type === "PASSWORD_INPUT" || comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT") && comp.required && comp.ref) {
10701
+ if ((comp.type === "PASSWORD_INPUT" || comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT" || comp.type === "SELECT") && comp.required && comp.ref) {
9853
10702
  const value = formValues.value[comp.ref] || "";
9854
10703
  if (!value || value.trim() === "") errors[comp.ref] = `${comp.label || comp.ref} is required`;
9855
10704
  }
@@ -10048,6 +10897,7 @@ const BaseAcceptInvite = (0, vue.defineComponent)({
10048
10897
  }, () => "Sign In")]) : null
10049
10898
  ])]);
10050
10899
  const renderedComponents = componentsWithoutHeadings.length > 0 ? renderInviteUserComponents(componentsWithoutHeadings, formValues.value, touchedFields.value, formErrors.value, isLoading.value, isFormValid.value, resetForm, handleInputChange, {
10900
+ additionalData: currentFlow.value?.data?.additionalData ?? {},
10051
10901
  meta,
10052
10902
  onInputBlur: handleInputBlur,
10053
10903
  onSubmit: handleSubmit,
@@ -10205,6 +11055,18 @@ const BaseInviteUser = (0, vue.defineComponent)({
10205
11055
  default: "",
10206
11056
  type: String
10207
11057
  },
11058
+ fetchAuthFlows: {
11059
+ default: void 0,
11060
+ type: Function
11061
+ },
11062
+ fetchUsers: {
11063
+ default: void 0,
11064
+ type: Function
11065
+ },
11066
+ fetchUserTypes: {
11067
+ default: void 0,
11068
+ type: Function
11069
+ },
10208
11070
  isInitialized: {
10209
11071
  default: true,
10210
11072
  type: Boolean
@@ -10303,7 +11165,7 @@ const BaseInviteUser = (0, vue.defineComponent)({
10303
11165
  const errors = {};
10304
11166
  const validateComponents = (comps) => {
10305
11167
  comps.forEach((comp) => {
10306
- if ((comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT" || comp.type === "SELECT") && comp.required && comp.ref) {
11168
+ if ((comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT" || comp.type === "SELECT" || comp.type === "USER_SELECT" || comp.type === "AUTH_FLOW_SELECT" || comp.type === "USER_TYPE_SELECT") && comp.required && comp.ref) {
10307
11169
  const value = formValues.value[comp.ref] || "";
10308
11170
  if (!value || value.trim() === "") errors[comp.ref] = `${comp.label || comp.ref} is required`;
10309
11171
  if (comp.type === "EMAIL_INPUT" && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) errors[comp.ref] = "Please enter a valid email address";
@@ -10531,8 +11393,13 @@ const BaseInviteUser = (0, vue.defineComponent)({
10531
11393
  }, () => "Invite Another User")])
10532
11394
  ])]);
10533
11395
  const renderedComponents = componentsWithoutHeadings.length > 0 ? renderInviteUserComponents(componentsWithoutHeadings, formValues.value, touchedFields.value, formErrors.value, isLoading.value, isFormValid.value, resetForm, handleInputChange, {
11396
+ additionalData: currentFlow.value?.data?.additionalData,
11397
+ fetchAuthFlows: props.fetchAuthFlows,
11398
+ fetchUsers: props.fetchUsers,
11399
+ fetchUserTypes: props.fetchUserTypes,
10534
11400
  meta,
10535
11401
  onInputBlur: handleInputBlur,
11402
+ onPickerError: props.onError,
10536
11403
  onSubmit: handleSubmit,
10537
11404
  size: props.size,
10538
11405
  t,
@@ -10603,6 +11470,9 @@ const InviteUser = (0, vue.defineComponent)({
10603
11470
  },
10604
11471
  setup(props, { slots }) {
10605
11472
  const { http: http$1, baseUrl, isInitialized } = useThunderID_default();
11473
+ const fetchAuthFlows = useFetchAuthFlows_default();
11474
+ const fetchUsers = useFetchUsers_default();
11475
+ const fetchUserTypes = useFetchUserTypes_default();
10606
11476
  const handleInitialize = async (payload) => {
10607
11477
  return (await http$1.request({
10608
11478
  data: {
@@ -10634,6 +11504,9 @@ const InviteUser = (0, vue.defineComponent)({
10634
11504
  };
10635
11505
  return () => (0, vue.h)(BaseInviteUser_default, {
10636
11506
  className: props.className,
11507
+ fetchAuthFlows,
11508
+ fetchUsers,
11509
+ fetchUserTypes,
10637
11510
  isInitialized: isInitialized?.value ?? false,
10638
11511
  onError: props.onError,
10639
11512
  onFlowChange: props.onFlowChange,
@@ -10823,7 +11696,7 @@ const createThunderIDGuard = (options = {}) => {
10823
11696
  return async (_to, _from, next) => {
10824
11697
  const ctx = (0, vue.inject)(THUNDERID_KEY);
10825
11698
  if (!ctx) {
10826
- logger.error("createThunderIDGuard: ThunderID context not found. Ensure the ThunderIDPlugin is installed before using the router guard.");
11699
+ logger.error("createThunderIDGuard: ThunderID context not found. Ensure <ThunderIDProvider> is mounted (or the context is provided at app level) before using the router guard.");
10827
11700
  next({ path: redirectTo });
10828
11701
  return;
10829
11702
  }
@@ -10920,7 +11793,9 @@ const createCallbackRoute = (options = {}) => {
10920
11793
  exports.AcceptInvite = AcceptInvite_default;
10921
11794
  exports.Alert = Alert_default;
10922
11795
  exports.ArrowLeftRightIcon = ArrowLeftRightIcon;
11796
+ exports.AuthFlowSelect = AuthFlowSelect_default;
10923
11797
  exports.BaseAcceptInvite = BaseAcceptInvite_default;
11798
+ exports.BaseAuthFlowSelect = BaseAuthFlowSelect_default;
10924
11799
  exports.BaseChangeCredential = BaseChangeCredential_default;
10925
11800
  exports.BaseInviteUser = BaseInviteUser_default;
10926
11801
  exports.BaseLanguageSwitcher = BaseLanguageSwitcher_default;
@@ -10931,6 +11806,8 @@ exports.BaseSignUp = BaseSignUp_default;
10931
11806
  exports.BaseSignUpButton = BaseSignUpButton_default;
10932
11807
  exports.BaseUserDropdown = BaseUserDropdown_default;
10933
11808
  exports.BaseUserProfile = BaseUserProfile_default;
11809
+ exports.BaseUserSelect = BaseUserSelect_default;
11810
+ exports.BaseUserTypeSelect = BaseUserTypeSelect_default;
10934
11811
  exports.BuildingIcon = BuildingIcon;
10935
11812
  exports.Button = Button_default;
10936
11813
  exports.Callback = Callback_default;
@@ -10941,6 +11818,7 @@ exports.Checkbox = Checkbox_default;
10941
11818
  exports.ChevronDownIcon = ChevronDownIcon;
10942
11819
  exports.CircleAlertIcon = CircleAlertIcon;
10943
11820
  exports.CircleCheckIcon = CircleCheckIcon;
11821
+ exports.CopyableText = CopyableText_default;
10944
11822
  exports.DatePicker = DatePicker_default;
10945
11823
  exports.Divider = Divider_default;
10946
11824
  Object.defineProperty(exports, 'EmbeddedFlowActionVariant', {
@@ -11052,6 +11930,8 @@ exports.UserDropdown = UserDropdown_default;
11052
11930
  exports.UserIcon = UserIcon;
11053
11931
  exports.UserProfile = UserProfile_default;
11054
11932
  exports.UserProvider = UserProvider_default;
11933
+ exports.UserSelect = UserSelect_default;
11934
+ exports.UserTypeSelect = UserTypeSelect_default;
11055
11935
  exports.XIcon = XIcon;
11056
11936
  exports.buildThemeConfigFromFlowMeta = buildThemeConfigFromFlowMeta_default;
11057
11937
  exports.createCallbackRoute = createCallbackRoute;
@@ -11118,9 +11998,13 @@ Object.defineProperty(exports, 'parseKeyValuePairs', {
11118
11998
  return __thunderid_browser.parseKeyValuePairs;
11119
11999
  }
11120
12000
  });
12001
+ exports.useFetchAuthFlows = useFetchAuthFlows_default;
12002
+ exports.useFetchUserTypes = useFetchUserTypes_default;
12003
+ exports.useFetchUsers = useFetchUsers_default;
11121
12004
  exports.useFlow = useFlow_default;
11122
12005
  exports.useFlowMeta = useFlowMeta_default;
11123
12006
  exports.useI18n = useI18n_default;
12007
+ exports.useInfiniteOptions = useInfiniteOptions_default;
11124
12008
  exports.useOAuthCallback = useOAuthCallback;
11125
12009
  exports.useTheme = useTheme_default;
11126
12010
  exports.useThunderID = useThunderID_default;