@thunderid/vue 1.3.2 → 1.4.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 (53) 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 +912 -39
  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/presentation/accept-invite/BaseAcceptInvite.d.ts.map +1 -1
  9. package/dist/components/presentation/invite-user/BaseInviteUser.d.ts.map +1 -1
  10. package/dist/components/presentation/invite-user/InviteUser.d.ts.map +1 -1
  11. package/dist/components/primitives/AuthFlowSelect/AuthFlowSelect.d.ts +12 -0
  12. package/dist/components/primitives/AuthFlowSelect/AuthFlowSelect.d.ts.map +1 -0
  13. package/dist/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.d.ts +15 -0
  14. package/dist/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.d.ts.map +1 -0
  15. package/dist/components/primitives/CopyableText/CopyableText.css.d.ts +11 -0
  16. package/dist/components/primitives/CopyableText/CopyableText.css.d.ts.map +1 -0
  17. package/dist/components/primitives/CopyableText/CopyableText.d.ts +12 -0
  18. package/dist/components/primitives/CopyableText/CopyableText.d.ts.map +1 -0
  19. package/dist/components/primitives/CopyableText/index.d.ts +2 -0
  20. package/dist/components/primitives/CopyableText/index.d.ts.map +1 -0
  21. package/dist/components/primitives/Icons.d.ts +1 -0
  22. package/dist/components/primitives/Icons.d.ts.map +1 -1
  23. package/dist/components/primitives/PasswordField/PasswordField.d.ts +4 -0
  24. package/dist/components/primitives/PasswordField/PasswordField.d.ts.map +1 -1
  25. package/dist/components/primitives/Select/ResourceSelect.d.ts +91 -0
  26. package/dist/components/primitives/Select/ResourceSelect.d.ts.map +1 -0
  27. package/dist/components/primitives/Select/Select.css.d.ts +2 -2
  28. package/dist/components/primitives/Select/Select.css.d.ts.map +1 -1
  29. package/dist/components/primitives/Select/Select.d.ts +2 -5
  30. package/dist/components/primitives/Select/Select.d.ts.map +1 -1
  31. package/dist/components/primitives/Select/useSelectMessages.d.ts +9 -0
  32. package/dist/components/primitives/Select/useSelectMessages.d.ts.map +1 -0
  33. package/dist/components/primitives/UserSelect/BaseUserSelect.d.ts +16 -0
  34. package/dist/components/primitives/UserSelect/BaseUserSelect.d.ts.map +1 -0
  35. package/dist/components/primitives/UserSelect/UserSelect.d.ts +15 -0
  36. package/dist/components/primitives/UserSelect/UserSelect.d.ts.map +1 -0
  37. package/dist/components/primitives/UserTypeSelect/BaseUserTypeSelect.d.ts +15 -0
  38. package/dist/components/primitives/UserTypeSelect/BaseUserTypeSelect.d.ts.map +1 -0
  39. package/dist/components/primitives/UserTypeSelect/UserTypeSelect.d.ts +12 -0
  40. package/dist/components/primitives/UserTypeSelect/UserTypeSelect.d.ts.map +1 -0
  41. package/dist/composables/useFetchAuthFlows.d.ts +8 -0
  42. package/dist/composables/useFetchAuthFlows.d.ts.map +1 -0
  43. package/dist/composables/useFetchUserTypes.d.ts +5 -0
  44. package/dist/composables/useFetchUserTypes.d.ts.map +1 -0
  45. package/dist/composables/useFetchUsers.d.ts +5 -0
  46. package/dist/composables/useFetchUsers.d.ts.map +1 -0
  47. package/dist/composables/useInfiniteOptions.d.ts +32 -0
  48. package/dist/composables/useInfiniteOptions.d.ts.map +1 -0
  49. package/dist/index.d.ts +18 -1
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +904 -42
  52. package/dist/styles/injectStyles.d.ts.map +1 -1
  53. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
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, SPAUtils, 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, parseKeyValuePairs, parseKeyValuePairs as parseKeyValuePairs$1, resolveChangeCredentialPolicy, resolveFlowTemplateLiterals, resolveLogoUri, resolveResourceEndpoint, startCase, substituteTranslationParams, supportsCredential, updateMeCredentials, updateMeProfile, withVendorCSSClassPrefix } from "@thunderid/browser";
2
- import { Fragment, Teleport, computed, defineComponent, h, inject, nextTick, onBeforeUnmount, onMounted, onUnmounted, provide, readonly, ref, shallowReadonly, shallowRef, useId, watch } from "vue";
1
+ import { AuthFlowSelectConstants, 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, SPAUtils, SelectConstants, ThunderIDAPIError, ThunderIDBrowserClient, ThunderIDError, ThunderIDRuntimeError, ThunderIDRuntimeError as ThunderIDRuntimeError$1, TranslationBundleConstants, UserSelectConstants, UserTypeSelectConstants, arrayBufferToBase64url, base64urlToArrayBuffer, bem, copyTextToClipboard, createClassObserver, createClassObserver as createClassObserver$1, createHttpClientFetcher, createMediaQueryListener, createMediaQueryListener as createMediaQueryListener$1, createPackageComponentLogger, createPackageLogger, createResourceOptionsLoader, createTheme, deepMerge, detectThemeMode, detectThemeMode as detectThemeMode$1, evaluateChangePasswordForm, executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow, extractEmojiFromUri, extractUserClaimsFromIdToken, generateFlattenedUserProfile, get, getActiveTheme, getDefaultI18nBundles, getFlowMeta, getFlows, getSelectMessages, getUserTypes, getUsers, getUsersMe, getUsersMeMeta, getVendorPrefix, handleWebAuthnAuthentication, hasAuthParamsInUrl, hasAuthParamsInUrl as hasAuthParamsInUrl$1, hasCalledForThisInstanceInUrl, hasUnresolvedTranslationParams, http, isEmojiUri, isEmpty, loadUntilOptionsGrow, mapCredentialUpdateError, mergeOptionsBatch, navigate, navigate as navigate$1, normalizeBorderRadius, normalizeSelectOptions, normalizeTranslations, parseKeyValuePairs, parseKeyValuePairs as parseKeyValuePairs$1, resolveChangeCredentialPolicy, resolveFlowTemplateLiterals, resolveLogoUri, resolvePageSize, resolveResourceEndpoint, startCase, substituteTranslationParams, supportsCredential, toAuthFlowSelectPage, toError, toUserSelectPage, toUserTypeSelectPage, updateMeCredentials, updateMeProfile, withVendorCSSClassPrefix } from "@thunderid/browser";
2
+ import { Fragment, Teleport, computed, defineComponent, h, inject, nextTick, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, provide, readonly, ref, shallowReadonly, shallowRef, useId, watch } from "vue";
3
3
  import DOMPurify from "dompurify";
4
4
 
5
5
  //#region src/keys.ts
@@ -280,7 +280,7 @@ const PACKAGE_NAME = "@thunderid/vue";
280
280
  * Package-level logger for `@thunderid/vue`.
281
281
  * Use this when logging is not tied to a specific component.
282
282
  */
283
- const logger$5 = createPackageLogger(PACKAGE_NAME);
283
+ const logger$6 = createPackageLogger(PACKAGE_NAME);
284
284
  /**
285
285
  * Creates a component-scoped logger prefixed with `@thunderid/vue - <component>`.
286
286
  *
@@ -290,7 +290,7 @@ const createVueLogger = (component) => createPackageComponentLogger(PACKAGE_NAME
290
290
 
291
291
  //#endregion
292
292
  //#region src/providers/I18nProvider.ts
293
- const logger$4 = createVueLogger("I18nProvider");
293
+ const logger$5 = createVueLogger("I18nProvider");
294
294
  const DEFAULT_URL_PARAM = "lang";
295
295
  const deriveRootDomain = (hostname) => {
296
296
  const parts = hostname.split(".");
@@ -330,7 +330,7 @@ const createStorageAdapter = (strategy, key, cookieDomain) => {
330
330
  try {
331
331
  window.localStorage.setItem(key, language);
332
332
  } catch {
333
- logger$4.warn("Failed to persist language preference to localStorage.");
333
+ logger$5.warn("Failed to persist language preference to localStorage.");
334
334
  }
335
335
  }
336
336
  };
@@ -457,7 +457,7 @@ const I18nProvider = defineComponent({
457
457
  };
458
458
  const setLanguage = (language) => {
459
459
  if (mergedBundlesComputed.value[language]) currentLanguage.value = language;
460
- else logger$4.warn(`Language '${language}' is not available. Available languages: ${Object.keys(mergedBundlesComputed.value).join(", ")}`);
460
+ else logger$5.warn(`Language '${language}' is not available. Available languages: ${Object.keys(mergedBundlesComputed.value).join(", ")}`);
461
461
  };
462
462
  provide(I18N_KEY, {
463
463
  bundles: readonly(mergedBundlesComputed),
@@ -2805,6 +2805,68 @@ const CHECKBOX_CSS = `
2805
2805
  `;
2806
2806
  var Checkbox_css_default = CHECKBOX_CSS;
2807
2807
 
2808
+ //#endregion
2809
+ //#region src/components/primitives/CopyableText/CopyableText.css.ts
2810
+ /**
2811
+ * Styles for the CopyableText primitive component.
2812
+ *
2813
+ * BEM block: `.thunderid-copyable-text`
2814
+ *
2815
+ * Elements:
2816
+ * __label | __box | __value | __copy
2817
+ */
2818
+ const COPYABLE_TEXT_CSS = `
2819
+ /* ============================================================
2820
+ CopyableText
2821
+ ============================================================ */
2822
+
2823
+ .thunderid-copyable-text {
2824
+ display: flex;
2825
+ flex-direction: column;
2826
+ gap: calc(var(--thunderid-spacing-unit) * 0.5);
2827
+ width: 100%;
2828
+ }
2829
+
2830
+ .thunderid-copyable-text__label {
2831
+ color: var(--thunderid-color-text-secondary);
2832
+ font-size: 0.875rem;
2833
+ font-weight: 500;
2834
+ }
2835
+
2836
+ .thunderid-copyable-text__box {
2837
+ display: flex;
2838
+ align-items: center;
2839
+ gap: calc(var(--thunderid-spacing-unit) * 1);
2840
+ padding: calc(var(--thunderid-spacing-unit) * 0.75) calc(var(--thunderid-spacing-unit) * 1);
2841
+ background-color: var(--thunderid-color-background-surface);
2842
+ border: 1px solid var(--thunderid-input-borderColor);
2843
+ border-radius: var(--thunderid-border-radius-small);
2844
+ }
2845
+
2846
+ .thunderid-copyable-text__value {
2847
+ flex: 1;
2848
+ min-width: 0;
2849
+ overflow: hidden;
2850
+ text-overflow: ellipsis;
2851
+ white-space: nowrap;
2852
+ word-break: break-all;
2853
+ font-family: monospace;
2854
+ font-size: 0.85rem;
2855
+ color: var(--thunderid-color-text-primary);
2856
+ }
2857
+
2858
+ .thunderid-copyable-text .thunderid-copyable-text__copy {
2859
+ flex-shrink: 0;
2860
+ padding: 0;
2861
+ width: var(--thunderid-button-sm-height);
2862
+ color: var(--thunderid-color-text-secondary);
2863
+ }
2864
+ .thunderid-copyable-text .thunderid-copyable-text__copy:hover {
2865
+ color: var(--thunderid-color-text-primary);
2866
+ }
2867
+ `;
2868
+ var CopyableText_css_default = COPYABLE_TEXT_CSS;
2869
+
2808
2870
  //#endregion
2809
2871
  //#region src/components/primitives/DatePicker/DatePicker.css.ts
2810
2872
  /**
@@ -3262,7 +3324,7 @@ var PasswordField_css_default = PASSWORD_FIELD_CSS;
3262
3324
  * --error – shows validation error state
3263
3325
  *
3264
3326
  * Elements:
3265
- * __label | __required | __input | __error | __helper
3327
+ * __label | __required | __input | __error | __helper | __status | __load-more
3266
3328
  */
3267
3329
  const SELECT_CSS = `
3268
3330
  /* ============================================================
@@ -3342,6 +3404,20 @@ const SELECT_CSS = `
3342
3404
  color: var(--thunderid-color-text-secondary);
3343
3405
  line-height: var(--thunderid-typography-lineHeight-normal);
3344
3406
  }
3407
+
3408
+ .thunderid-select__status {
3409
+ font-size: var(--thunderid-typography-fontSize-xs);
3410
+ color: var(--thunderid-color-text-secondary);
3411
+ line-height: var(--thunderid-typography-lineHeight-normal);
3412
+ }
3413
+ .thunderid-select__status:empty {
3414
+ display: none;
3415
+ }
3416
+
3417
+ .thunderid-select__load-more {
3418
+ color: var(--thunderid-color-primary-main);
3419
+ font-weight: var(--thunderid-typography-fontWeight-medium);
3420
+ }
3345
3421
  `;
3346
3422
  var Select_css_default = SELECT_CSS;
3347
3423
 
@@ -3621,6 +3697,7 @@ const STYLES = [
3621
3697
  Divider_css_default,
3622
3698
  KeyValueList_css_default,
3623
3699
  Logo_css_default,
3700
+ CopyableText_css_default,
3624
3701
  Spinner_css_default,
3625
3702
  BaseSignIn_css_default,
3626
3703
  ChangeCredential_css_default,
@@ -3971,6 +4048,189 @@ function useOAuthCallback({ currentFlowId, flowIdStorageKey = "thunderid_flow_id
3971
4048
  }, { immediate: true });
3972
4049
  }
3973
4050
 
4051
+ //#endregion
4052
+ //#region src/composables/useInfiniteOptions.ts
4053
+ const logger$4 = createPackageComponentLogger("@thunderid/vue", "useInfiniteOptions");
4054
+ /**
4055
+ * Keeps the option list of a `Select` that loads more options when the user asks for them. It owns the cursor,
4056
+ * appends each batch without duplicates, and stops at the end of the data. Vue counterpart of the React
4057
+ * `useInfiniteOptions`.
4058
+ *
4059
+ * `args` is read live, so a changing `load` or `onError` is picked up without passing refs.
4060
+ */
4061
+ const useInfiniteOptions = (args) => {
4062
+ const options = shallowRef(normalizeSelectOptions(args.initialOptions));
4063
+ const loading = ref(false);
4064
+ const error = shallowRef(null);
4065
+ const hasMore = ref(true);
4066
+ let cursor;
4067
+ let finished = false;
4068
+ let inFlight = false;
4069
+ let requested = false;
4070
+ let generation = 0;
4071
+ let controller = null;
4072
+ let nonListLogged = false;
4073
+ const applyBatch = (batch) => {
4074
+ const merged = mergeOptionsBatch({
4075
+ cursor,
4076
+ options: options.value
4077
+ }, batch);
4078
+ if (merged.issue === "cursor-stuck") logger$4.warn("A load returned no new options and the same cursor; the list was treated as finished.");
4079
+ else if (merged.issue === "not-a-list" && !nonListLogged) {
4080
+ nonListLogged = true;
4081
+ logger$4.warn("A load returned something other than a list of options; it was treated as an empty batch.");
4082
+ }
4083
+ const addedNothing = merged.options.length === options.value.length;
4084
+ cursor = merged.cursor;
4085
+ finished = merged.finished;
4086
+ options.value = merged.options;
4087
+ hasMore.value = !merged.finished;
4088
+ error.value = null;
4089
+ return addedNothing && !merged.finished;
4090
+ };
4091
+ const startLoad = async () => {
4092
+ const startedGeneration = generation;
4093
+ const startedController = new AbortController();
4094
+ controller = startedController;
4095
+ inFlight = true;
4096
+ loading.value = true;
4097
+ try {
4098
+ await loadUntilOptionsGrow(() => args.load({
4099
+ cursor,
4100
+ options: options.value,
4101
+ signal: startedController.signal
4102
+ }), applyBatch, () => startedGeneration === generation);
4103
+ } catch (failure) {
4104
+ if (startedGeneration === generation && !startedController.signal.aborted) {
4105
+ const failureError = toError(failure);
4106
+ error.value = failureError;
4107
+ try {
4108
+ args.onError?.(failureError);
4109
+ } catch (callbackFailure) {
4110
+ logger$4.error("The onError callback threw.", callbackFailure);
4111
+ }
4112
+ }
4113
+ } finally {
4114
+ if (startedGeneration === generation) {
4115
+ controller = null;
4116
+ inFlight = false;
4117
+ loading.value = false;
4118
+ }
4119
+ }
4120
+ };
4121
+ const onLoadMore = () => {
4122
+ if (inFlight || finished) return;
4123
+ requested = true;
4124
+ startLoad();
4125
+ };
4126
+ const reset = () => {
4127
+ const shouldReload = requested;
4128
+ generation += 1;
4129
+ controller?.abort();
4130
+ controller = null;
4131
+ cursor = void 0;
4132
+ finished = false;
4133
+ inFlight = false;
4134
+ options.value = normalizeSelectOptions(args.initialOptions);
4135
+ hasMore.value = true;
4136
+ error.value = null;
4137
+ loading.value = false;
4138
+ if (shouldReload) startLoad();
4139
+ };
4140
+ onScopeDispose(() => {
4141
+ generation += 1;
4142
+ controller?.abort();
4143
+ });
4144
+ return {
4145
+ error,
4146
+ hasMore,
4147
+ loading,
4148
+ onLoadMore,
4149
+ options,
4150
+ reset
4151
+ };
4152
+ };
4153
+ var useInfiniteOptions_default = useInfiniteOptions;
4154
+
4155
+ //#endregion
4156
+ //#region src/api/getUsers.ts
4157
+ /**
4158
+ * Retrieves one page of the user directory. Uses the ThunderID SPA client's httpClient by default,
4159
+ * which attaches the access token, but allows a custom fetcher.
4160
+ *
4161
+ * @param config - Configuration object with URL, paging options and optional request config.
4162
+ * @returns A promise that resolves with one page of the user directory.
4163
+ * @example
4164
+ * ```typescript
4165
+ * const page = await getUsers({
4166
+ * baseUrl: "https://localhost:8090",
4167
+ * limit: 30,
4168
+ * offset: 0,
4169
+ * });
4170
+ * ```
4171
+ */
4172
+ const getUsers$1 = async ({ fetcher, instanceId = 0,...requestConfig }) => getUsers({
4173
+ ...requestConfig,
4174
+ fetcher: fetcher ?? createHttpClientFetcher(instanceId)
4175
+ });
4176
+ var getUsers_default = getUsers$1;
4177
+
4178
+ //#endregion
4179
+ //#region src/composables/useFetchUsers.ts
4180
+ /** A `FetchUsers` backed by the user directory, authenticated with the signed-in user's access token. */
4181
+ const useFetchUsers = () => {
4182
+ const { baseUrl, endpoints, instanceId } = useThunderID_default();
4183
+ const usersUrl = resolveResourceEndpoint("users", { endpoints });
4184
+ return async ({ filter, limit, offset, signal }) => toUserSelectPage(await getUsers_default({
4185
+ baseUrl,
4186
+ filter,
4187
+ instanceId,
4188
+ limit,
4189
+ offset,
4190
+ signal,
4191
+ url: usersUrl
4192
+ }), offset);
4193
+ };
4194
+ var useFetchUsers_default = useFetchUsers;
4195
+
4196
+ //#endregion
4197
+ //#region src/composables/useFetchAuthFlows.ts
4198
+ /**
4199
+ * A `FetchAuthFlows` backed by the flow list, restricted to authentication flows and authenticated with
4200
+ * the signed-in user's access token.
4201
+ */
4202
+ const useFetchAuthFlows = () => {
4203
+ const { baseUrl, endpoints, instanceId } = useThunderID_default();
4204
+ const flowsUrl = resolveResourceEndpoint("flows", { endpoints });
4205
+ return async ({ limit, offset, signal }) => toAuthFlowSelectPage(await getFlows({
4206
+ baseUrl,
4207
+ fetcher: createHttpClientFetcher(instanceId),
4208
+ flowType: AuthFlowSelectConstants.FLOW_TYPE,
4209
+ limit: Math.min(limit, SelectConstants.MAX_PAGE_SIZE),
4210
+ offset,
4211
+ signal,
4212
+ url: flowsUrl
4213
+ }), offset);
4214
+ };
4215
+ var useFetchAuthFlows_default = useFetchAuthFlows;
4216
+
4217
+ //#endregion
4218
+ //#region src/composables/useFetchUserTypes.ts
4219
+ /** A `FetchUserTypes` backed by the user type list, authenticated with the signed-in user's access token. */
4220
+ const useFetchUserTypes = () => {
4221
+ const { baseUrl, endpoints, instanceId } = useThunderID_default();
4222
+ const userTypesUrl = resolveResourceEndpoint("userTypes", { endpoints });
4223
+ return async ({ limit, offset, signal }) => toUserTypeSelectPage(await getUserTypes({
4224
+ baseUrl,
4225
+ fetcher: createHttpClientFetcher(instanceId),
4226
+ limit: Math.min(limit, SelectConstants.MAX_PAGE_SIZE),
4227
+ offset,
4228
+ signal,
4229
+ url: userTypesUrl
4230
+ }), offset);
4231
+ };
4232
+ var useFetchUserTypes_default = useFetchUserTypes;
4233
+
3974
4234
  //#endregion
3975
4235
  //#region src/components/primitives/Button/Button.ts
3976
4236
  const Button = defineComponent({
@@ -4207,6 +4467,14 @@ const defaultProps = {
4207
4467
  };
4208
4468
  const icon = (paths) => h("svg", { ...defaultProps }, paths);
4209
4469
  const CheckIcon = () => icon([h("polyline", { points: "20 6 9 17 4 12" })]);
4470
+ const CopyIcon = () => icon([h("rect", {
4471
+ height: "14",
4472
+ rx: "2",
4473
+ ry: "2",
4474
+ width: "14",
4475
+ x: "8",
4476
+ y: "8"
4477
+ }), h("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })]);
4210
4478
  const XIcon = () => icon([h("line", {
4211
4479
  x1: "18",
4212
4480
  x2: "6",
@@ -4394,9 +4662,17 @@ const PencilIcon = () => icon([h("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 2
4394
4662
 
4395
4663
  //#endregion
4396
4664
  //#region src/components/primitives/PasswordField/PasswordField.ts
4665
+ /**
4666
+ * A password input with a show and hide button. The `append` slot holds extra content inside the field, after the
4667
+ * button, such as an action button.
4668
+ */
4397
4669
  const PasswordField = defineComponent({
4398
4670
  name: "PasswordField",
4399
4671
  props: {
4672
+ ariaLabel: {
4673
+ default: void 0,
4674
+ type: String
4675
+ },
4400
4676
  autocomplete: {
4401
4677
  default: "current-password",
4402
4678
  type: String
@@ -4409,6 +4685,10 @@ const PasswordField = defineComponent({
4409
4685
  default: void 0,
4410
4686
  type: String
4411
4687
  },
4688
+ hideLabel: {
4689
+ default: "Hide password",
4690
+ type: String
4691
+ },
4412
4692
  label: {
4413
4693
  default: void 0,
4414
4694
  type: String
@@ -4425,13 +4705,21 @@ const PasswordField = defineComponent({
4425
4705
  default: void 0,
4426
4706
  type: String
4427
4707
  },
4708
+ readonly: {
4709
+ default: false,
4710
+ type: Boolean
4711
+ },
4428
4712
  required: {
4429
4713
  default: false,
4430
4714
  type: Boolean
4715
+ },
4716
+ showLabel: {
4717
+ default: "Show password",
4718
+ type: String
4431
4719
  }
4432
4720
  },
4433
4721
  emits: ["update:modelValue", "blur"],
4434
- setup(props, { emit, attrs }) {
4722
+ setup(props, { emit, attrs, slots }) {
4435
4723
  const visible = ref(false);
4436
4724
  return () => {
4437
4725
  const hasError = !!props.error;
@@ -4447,28 +4735,34 @@ const PasswordField = defineComponent({
4447
4735
  class: withVendorCSSClassPrefix("password-field__label"),
4448
4736
  for: props.name
4449
4737
  }, [props.label, props.required ? h("span", { class: withVendorCSSClassPrefix("password-field__required") }, " *") : null]) : null,
4450
- h("div", { class: withVendorCSSClassPrefix("password-field__wrapper") }, [h("input", {
4451
- autocomplete: props.autocomplete,
4452
- class: withVendorCSSClassPrefix("password-field__input"),
4453
- "data-testid": attrs["data-testid"],
4454
- disabled: props.disabled,
4455
- id: props.name,
4456
- name: props.name,
4457
- onBlur: () => emit("blur"),
4458
- onInput: (e) => emit("update:modelValue", e.target.value),
4459
- placeholder: props.placeholder,
4460
- required: props.required,
4461
- type: visible.value ? "text" : "password",
4462
- value: props.modelValue
4463
- }), h("button", {
4464
- "aria-label": visible.value ? "Hide password" : "Show password",
4465
- class: withVendorCSSClassPrefix("password-field__toggle"),
4466
- onClick: () => {
4467
- visible.value = !visible.value;
4468
- },
4469
- tabindex: -1,
4470
- type: "button"
4471
- }, visible.value ? EyeOffIcon() : EyeIcon())]),
4738
+ h("div", { class: withVendorCSSClassPrefix("password-field__wrapper") }, [
4739
+ h("input", {
4740
+ "aria-label": props.ariaLabel,
4741
+ autocomplete: props.autocomplete,
4742
+ class: withVendorCSSClassPrefix("password-field__input"),
4743
+ "data-testid": attrs["data-testid"],
4744
+ disabled: props.disabled,
4745
+ id: props.name,
4746
+ name: props.name,
4747
+ onBlur: () => emit("blur"),
4748
+ onInput: (e) => emit("update:modelValue", e.target.value),
4749
+ placeholder: props.placeholder,
4750
+ readonly: props.readonly,
4751
+ required: props.required,
4752
+ type: visible.value ? "text" : "password",
4753
+ value: props.modelValue
4754
+ }),
4755
+ h("button", {
4756
+ "aria-label": visible.value ? props.hideLabel : props.showLabel,
4757
+ class: withVendorCSSClassPrefix("password-field__toggle"),
4758
+ onClick: () => {
4759
+ visible.value = !visible.value;
4760
+ },
4761
+ tabindex: props.readonly ? 0 : -1,
4762
+ type: "button"
4763
+ }, visible.value ? EyeOffIcon() : EyeIcon()),
4764
+ slots["append"]?.()
4765
+ ]),
4472
4766
  hasError ? h("span", { class: withVendorCSSClassPrefix("password-field__error") }, props.error) : null
4473
4767
  ]);
4474
4768
  };
@@ -4476,15 +4770,35 @@ const PasswordField = defineComponent({
4476
4770
  });
4477
4771
  var PasswordField_default = PasswordField;
4478
4772
 
4773
+ //#endregion
4774
+ //#region src/components/primitives/Select/useSelectMessages.ts
4775
+ /**
4776
+ * The wording of `Select`: the active translations when there is an I18n provider, English otherwise, so `Select`
4777
+ * works without a provider. Call the result in a render function so a change of language is picked up.
4778
+ */
4779
+ const useSelectMessages = () => {
4780
+ const i18n = inject(I18N_KEY, null);
4781
+ return () => getSelectMessages(i18n ? (key) => i18n.t(key) : void 0);
4782
+ };
4783
+ var useSelectMessages_default = useSelectMessages;
4784
+
4479
4785
  //#endregion
4480
4786
  //#region src/components/primitives/Select/Select.ts
4481
4787
  const Select = defineComponent({
4482
4788
  name: "Select",
4483
4789
  props: {
4790
+ ariaLabel: {
4791
+ default: void 0,
4792
+ type: String
4793
+ },
4484
4794
  disabled: {
4485
4795
  default: false,
4486
4796
  type: Boolean
4487
4797
  },
4798
+ emptyText: {
4799
+ default: void 0,
4800
+ type: String
4801
+ },
4488
4802
  error: {
4489
4803
  default: void 0,
4490
4804
  type: String
@@ -4497,6 +4811,10 @@ const Select = defineComponent({
4497
4811
  default: void 0,
4498
4812
  type: String
4499
4813
  },
4814
+ loading: {
4815
+ default: false,
4816
+ type: Boolean
4817
+ },
4500
4818
  modelValue: {
4501
4819
  default: "",
4502
4820
  type: String
@@ -4505,6 +4823,10 @@ const Select = defineComponent({
4505
4823
  default: void 0,
4506
4824
  type: String
4507
4825
  },
4826
+ onLoadMore: {
4827
+ default: void 0,
4828
+ type: Function
4829
+ },
4508
4830
  options: {
4509
4831
  default: () => [],
4510
4832
  type: Array
@@ -4516,12 +4838,19 @@ const Select = defineComponent({
4516
4838
  required: {
4517
4839
  default: false,
4518
4840
  type: Boolean
4841
+ },
4842
+ selectedOption: {
4843
+ default: void 0,
4844
+ type: Object
4519
4845
  }
4520
4846
  },
4521
- emits: ["update:modelValue"],
4847
+ emits: ["blur", "update:modelValue"],
4522
4848
  setup(props, { emit, attrs }) {
4849
+ const messages = useSelectMessages_default();
4523
4850
  return () => {
4524
4851
  const hasError = !!props.error;
4852
+ const items = normalizeSelectOptions(props.options);
4853
+ const text = messages();
4525
4854
  const wrapperClass = [
4526
4855
  withVendorCSSClassPrefix("select"),
4527
4856
  hasError ? withVendorCSSClassPrefix("select--error") : "",
@@ -4531,6 +4860,13 @@ const Select = defineComponent({
4531
4860
  if (hasError) helperContent = h("span", { class: withVendorCSSClassPrefix("select__error") }, props.error);
4532
4861
  else if (props.helperText) helperContent = h("span", { class: withVendorCSSClassPrefix("select__helper") }, props.helperText);
4533
4862
  else helperContent = null;
4863
+ const { selectedOption } = props;
4864
+ const showsSelectedOption = selectedOption?.value === props.modelValue && !items.some((item) => item.value === props.modelValue);
4865
+ let statusText;
4866
+ if (props.loading) statusText = items.length === 0 ? text.loading : text.loadingMore;
4867
+ else if (items.length === 0 && !props.onLoadMore) statusText = props.emptyText;
4868
+ const hasStatus = props.onLoadMore !== void 0 || props.emptyText !== void 0 || props.loading;
4869
+ const showsLoadMore = props.onLoadMore !== void 0 && (items.length > 0 || !props.loading);
4534
4870
  return h("div", {
4535
4871
  class: wrapperClass,
4536
4872
  style: attrs.style
@@ -4540,21 +4876,46 @@ const Select = defineComponent({
4540
4876
  for: props.name
4541
4877
  }, [props.label, props.required ? h("span", { class: withVendorCSSClassPrefix("select__required") }, " *") : null]) : null,
4542
4878
  h("select", {
4879
+ "aria-busy": props.loading || void 0,
4880
+ "aria-label": props.ariaLabel,
4543
4881
  class: withVendorCSSClassPrefix("select__input"),
4544
4882
  "data-testid": attrs["data-testid"],
4545
4883
  disabled: props.disabled,
4546
4884
  id: props.name,
4547
4885
  name: props.name,
4548
- onChange: (e) => emit("update:modelValue", e.target.value),
4886
+ onBlur: () => emit("blur"),
4887
+ onChange: (e) => {
4888
+ const control = e.target;
4889
+ if (control.value !== SelectConstants.LOAD_MORE_OPTION_VALUE) {
4890
+ emit("update:modelValue", control.value);
4891
+ return;
4892
+ }
4893
+ control.value = props.modelValue;
4894
+ props.onLoadMore?.();
4895
+ },
4549
4896
  required: props.required,
4550
4897
  value: props.modelValue
4551
- }, [props.placeholder ? h("option", {
4552
- disabled: true,
4553
- value: ""
4554
- }, props.placeholder) : null, ...props.options.map((opt) => h("option", {
4555
- key: opt.value,
4556
- value: opt.value
4557
- }, opt.label))]),
4898
+ }, [
4899
+ props.placeholder ? h("option", {
4900
+ disabled: props.required,
4901
+ value: ""
4902
+ }, props.placeholder) : null,
4903
+ showsSelectedOption && selectedOption ? h("option", { value: selectedOption.value }, selectedOption.label) : null,
4904
+ ...items.map((opt) => h("option", {
4905
+ disabled: opt.disabled,
4906
+ key: opt.value,
4907
+ value: opt.value
4908
+ }, opt.label)),
4909
+ showsLoadMore ? h("option", {
4910
+ class: withVendorCSSClassPrefix("select__load-more"),
4911
+ disabled: props.loading,
4912
+ value: SelectConstants.LOAD_MORE_OPTION_VALUE
4913
+ }, props.loading ? text.loadingMore : text.loadMore) : null
4914
+ ]),
4915
+ hasStatus ? h("span", {
4916
+ class: withVendorCSSClassPrefix("select__status"),
4917
+ role: "status"
4918
+ }, statusText) : null,
4558
4919
  helperContent
4559
4920
  ]);
4560
4921
  };
@@ -4562,6 +4923,374 @@ const Select = defineComponent({
4562
4923
  });
4563
4924
  var Select_default = Select;
4564
4925
 
4926
+ //#endregion
4927
+ //#region src/components/primitives/Select/ResourceSelect.ts
4928
+ const NO_PAGES = () => Promise.resolve({
4929
+ nextOffset: null,
4930
+ options: []
4931
+ });
4932
+ /** The props every resource picker (users, authentication flows, user types) passes straight through. */
4933
+ const commonSelectProps = {
4934
+ component: {
4935
+ default: void 0,
4936
+ type: Object
4937
+ },
4938
+ disabled: {
4939
+ default: false,
4940
+ type: Boolean
4941
+ },
4942
+ emptyText: {
4943
+ default: void 0,
4944
+ type: String
4945
+ },
4946
+ error: {
4947
+ default: void 0,
4948
+ type: String
4949
+ },
4950
+ filter: {
4951
+ default: void 0,
4952
+ type: String
4953
+ },
4954
+ helperText: {
4955
+ default: void 0,
4956
+ type: String
4957
+ },
4958
+ id: {
4959
+ default: void 0,
4960
+ type: String
4961
+ },
4962
+ label: {
4963
+ default: void 0,
4964
+ type: String
4965
+ },
4966
+ modelValue: {
4967
+ default: "",
4968
+ type: String
4969
+ },
4970
+ name: {
4971
+ default: void 0,
4972
+ type: String
4973
+ },
4974
+ onError: {
4975
+ default: void 0,
4976
+ type: Function
4977
+ },
4978
+ pageSize: {
4979
+ default: void 0,
4980
+ type: Number
4981
+ },
4982
+ placeholder: {
4983
+ default: void 0,
4984
+ type: String
4985
+ },
4986
+ required: {
4987
+ default: false,
4988
+ type: Boolean
4989
+ },
4990
+ selectedOption: {
4991
+ default: void 0,
4992
+ type: Object
4993
+ }
4994
+ };
4995
+ /**
4996
+ * The part the `USER_SELECT`, `AUTH_FLOW_SELECT` and `USER_TYPE_SELECT` pickers share: a {@link Select} that loads
4997
+ * one resource page by page. The list restarts when the page function, filter or page size changes.
4998
+ */
4999
+ const ResourceSelect = defineComponent({
5000
+ name: "ResourceSelect",
5001
+ props: {
5002
+ ...commonSelectProps,
5003
+ bemBlock: {
5004
+ required: true,
5005
+ type: String
5006
+ },
5007
+ defaults: {
5008
+ default: void 0,
5009
+ type: Object
5010
+ },
5011
+ fallbackMessages: {
5012
+ required: true,
5013
+ type: Object
5014
+ },
5015
+ fetchPage: {
5016
+ default: void 0,
5017
+ type: Function
5018
+ },
5019
+ mapping: {
5020
+ default: void 0,
5021
+ type: Object
5022
+ },
5023
+ messageKey: {
5024
+ required: true,
5025
+ type: String
5026
+ },
5027
+ resource: {
5028
+ required: true,
5029
+ type: String
5030
+ },
5031
+ type: {
5032
+ required: true,
5033
+ type: String
5034
+ }
5035
+ },
5036
+ emits: ["blur", "update:modelValue"],
5037
+ setup(props, { emit }) {
5038
+ const { t } = useI18n_default();
5039
+ const loader = computed(() => createResourceOptionsLoader({
5040
+ get component() {
5041
+ return props.component ?? {
5042
+ id: props.id ?? props.name ?? props.bemBlock,
5043
+ type: props.type
5044
+ };
5045
+ },
5046
+ get defaults() {
5047
+ return props.defaults;
5048
+ },
5049
+ fetchPage: props.fetchPage ?? NO_PAGES,
5050
+ filter: props.filter,
5051
+ get mapping() {
5052
+ return props.mapping;
5053
+ },
5054
+ pageSize: resolvePageSize(props.pageSize),
5055
+ resource: props.resource
5056
+ }));
5057
+ const { hasMore, loading, onLoadMore, options, reset } = useInfiniteOptions_default({
5058
+ load: (context) => loader.value(context),
5059
+ onError: (error) => props.onError?.(error)
5060
+ });
5061
+ onMounted(() => {
5062
+ if (props.fetchPage) onLoadMore();
5063
+ });
5064
+ watch(loader, () => {
5065
+ reset();
5066
+ if (props.fetchPage) onLoadMore();
5067
+ });
5068
+ return () => {
5069
+ return h(Select_default, {
5070
+ "aria-label": [
5071
+ props.label,
5072
+ props.placeholder,
5073
+ t(`elements.fields.${props.messageKey}.aria_label`)
5074
+ ].find((text) => Boolean(text)) ?? props.fallbackMessages.ariaLabel,
5075
+ class: withVendorCSSClassPrefix(bem(props.bemBlock)),
5076
+ disabled: props.disabled,
5077
+ emptyText: props.emptyText ?? (t(`elements.fields.${props.messageKey}.empty`) || props.fallbackMessages.empty),
5078
+ error: props.error,
5079
+ helperText: props.helperText,
5080
+ id: props.id,
5081
+ label: props.label,
5082
+ loading: loading.value,
5083
+ modelValue: props.modelValue,
5084
+ name: props.name,
5085
+ onBlur: () => emit("blur"),
5086
+ onLoadMore: props.fetchPage && hasMore.value ? onLoadMore : void 0,
5087
+ options: options.value,
5088
+ placeholder: props.placeholder,
5089
+ required: props.required,
5090
+ selectedOption: props.selectedOption,
5091
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value)
5092
+ });
5093
+ };
5094
+ }
5095
+ });
5096
+ var ResourceSelect_default = ResourceSelect;
5097
+
5098
+ //#endregion
5099
+ //#region src/components/primitives/UserSelect/BaseUserSelect.ts
5100
+ const USER_DEFAULTS = { labelAttributes: UserSelectConstants.LABEL_ATTRIBUTES };
5101
+ /**
5102
+ * Single-user picker: a `Select` that loads from the given `fetchUsers` and submits the user's ID.
5103
+ * Labels come from `display`, `username`, or `email` unless `mapping` says otherwise.
5104
+ * Building block for `UserSelect`; for a custom data source use `Select` with `useInfiniteOptions`.
5105
+ */
5106
+ const BaseUserSelect = defineComponent({
5107
+ name: "BaseUserSelect",
5108
+ props: {
5109
+ ...commonSelectProps,
5110
+ fetchUsers: {
5111
+ default: void 0,
5112
+ type: Function
5113
+ },
5114
+ mapping: {
5115
+ default: void 0,
5116
+ type: Object
5117
+ }
5118
+ },
5119
+ emits: ["update:modelValue"],
5120
+ setup(props, { emit }) {
5121
+ return () => {
5122
+ const { fetchUsers, mapping,...common } = props;
5123
+ return h(ResourceSelect_default, {
5124
+ ...common,
5125
+ bemBlock: "user-select",
5126
+ defaults: USER_DEFAULTS,
5127
+ fallbackMessages: {
5128
+ ariaLabel: "Select a user",
5129
+ empty: "No users found."
5130
+ },
5131
+ fetchPage: fetchUsers,
5132
+ mapping,
5133
+ messageKey: "user_select",
5134
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value),
5135
+ resource: "users",
5136
+ type: EmbeddedFlowComponentType$1.UserSelect
5137
+ });
5138
+ };
5139
+ }
5140
+ });
5141
+ var BaseUserSelect_default = BaseUserSelect;
5142
+
5143
+ //#endregion
5144
+ //#region src/components/primitives/UserSelect/UserSelect.ts
5145
+ /**
5146
+ * Single-user picker for signed-in screens. It loads the user directory itself with the signed-in
5147
+ * user's access token and submits the chosen user's ID, so it takes no data source. For any other
5148
+ * data source use {@link Select} with {@link useInfiniteOptions}.
5149
+ */
5150
+ const UserSelect = defineComponent({
5151
+ name: "UserSelect",
5152
+ props: {
5153
+ ...commonSelectProps,
5154
+ mapping: {
5155
+ default: void 0,
5156
+ type: Object
5157
+ }
5158
+ },
5159
+ emits: ["update:modelValue"],
5160
+ setup(props, { emit }) {
5161
+ const fetchUsers = useFetchUsers_default();
5162
+ return () => h(BaseUserSelect_default, {
5163
+ ...props,
5164
+ fetchUsers,
5165
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value)
5166
+ });
5167
+ }
5168
+ });
5169
+ var UserSelect_default = UserSelect;
5170
+
5171
+ //#endregion
5172
+ //#region src/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.ts
5173
+ const AUTH_FLOW_DEFAULTS = { labelAttributes: AuthFlowSelectConstants.LABEL_ATTRIBUTES };
5174
+ /**
5175
+ * Authentication-flow picker: a `Select` that loads from the given `fetchAuthFlows`, showing each flow by
5176
+ * its name and submitting its ID. Building block for `AuthFlowSelect`; for a custom data source use
5177
+ * `Select` with `useInfiniteOptions`.
5178
+ */
5179
+ const BaseAuthFlowSelect = defineComponent({
5180
+ name: "BaseAuthFlowSelect",
5181
+ props: {
5182
+ ...commonSelectProps,
5183
+ fetchAuthFlows: {
5184
+ default: void 0,
5185
+ type: Function
5186
+ }
5187
+ },
5188
+ emits: ["update:modelValue"],
5189
+ setup(props, { emit }) {
5190
+ return () => {
5191
+ const { fetchAuthFlows,...common } = props;
5192
+ return h(ResourceSelect_default, {
5193
+ ...common,
5194
+ bemBlock: "auth-flow-select",
5195
+ defaults: AUTH_FLOW_DEFAULTS,
5196
+ fallbackMessages: {
5197
+ ariaLabel: "Select a login flow",
5198
+ empty: "No login flows found."
5199
+ },
5200
+ fetchPage: fetchAuthFlows,
5201
+ messageKey: "auth_flow_select",
5202
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value),
5203
+ resource: "auth flows",
5204
+ type: EmbeddedFlowComponentType$1.AuthFlowSelect
5205
+ });
5206
+ };
5207
+ }
5208
+ });
5209
+ var BaseAuthFlowSelect_default = BaseAuthFlowSelect;
5210
+
5211
+ //#endregion
5212
+ //#region src/components/primitives/AuthFlowSelect/AuthFlowSelect.ts
5213
+ /**
5214
+ * Authentication-flow picker for signed-in screens. It loads the authentication flows itself with the
5215
+ * signed-in user's access token and submits the chosen flow's ID, so it takes no data source. For any
5216
+ * other data source use `Select` with `useInfiniteOptions`.
5217
+ */
5218
+ const AuthFlowSelect = defineComponent({
5219
+ name: "AuthFlowSelect",
5220
+ props: { ...commonSelectProps },
5221
+ emits: ["update:modelValue"],
5222
+ setup(props, { emit }) {
5223
+ const fetchAuthFlows = useFetchAuthFlows_default();
5224
+ return () => h(BaseAuthFlowSelect_default, {
5225
+ ...props,
5226
+ fetchAuthFlows,
5227
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value)
5228
+ });
5229
+ }
5230
+ });
5231
+ var AuthFlowSelect_default = AuthFlowSelect;
5232
+
5233
+ //#endregion
5234
+ //#region src/components/primitives/UserTypeSelect/BaseUserTypeSelect.ts
5235
+ /**
5236
+ * User-type picker: a `Select` that loads from the given `fetchUserTypes`, showing and submitting each
5237
+ * user type's handle. Building block for `UserTypeSelect`; for a custom data source use `Select` with
5238
+ * `useInfiniteOptions`.
5239
+ */
5240
+ const BaseUserTypeSelect = defineComponent({
5241
+ name: "BaseUserTypeSelect",
5242
+ props: {
5243
+ ...commonSelectProps,
5244
+ fetchUserTypes: {
5245
+ default: void 0,
5246
+ type: Function
5247
+ }
5248
+ },
5249
+ emits: ["update:modelValue"],
5250
+ setup(props, { emit }) {
5251
+ return () => {
5252
+ const { fetchUserTypes,...common } = props;
5253
+ return h(ResourceSelect_default, {
5254
+ ...common,
5255
+ bemBlock: "user-type-select",
5256
+ fallbackMessages: {
5257
+ ariaLabel: "Select a user type",
5258
+ empty: "No user types found."
5259
+ },
5260
+ fetchPage: fetchUserTypes,
5261
+ mapping: UserTypeSelectConstants.MAPPING,
5262
+ messageKey: "user_type_select",
5263
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value),
5264
+ resource: "user types",
5265
+ type: EmbeddedFlowComponentType$1.UserTypeSelect
5266
+ });
5267
+ };
5268
+ }
5269
+ });
5270
+ var BaseUserTypeSelect_default = BaseUserTypeSelect;
5271
+
5272
+ //#endregion
5273
+ //#region src/components/primitives/UserTypeSelect/UserTypeSelect.ts
5274
+ /**
5275
+ * User-type picker for signed-in screens. It loads the user types itself with the signed-in user's
5276
+ * access token and submits the chosen type's handle, so it takes no data source. For any other data
5277
+ * source use `Select` with `useInfiniteOptions`.
5278
+ */
5279
+ const UserTypeSelect = defineComponent({
5280
+ name: "UserTypeSelect",
5281
+ props: { ...commonSelectProps },
5282
+ emits: ["update:modelValue"],
5283
+ setup(props, { emit }) {
5284
+ const fetchUserTypes = useFetchUserTypes_default();
5285
+ return () => h(BaseUserTypeSelect_default, {
5286
+ ...props,
5287
+ fetchUserTypes,
5288
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value)
5289
+ });
5290
+ }
5291
+ });
5292
+ var UserTypeSelect_default = UserTypeSelect;
5293
+
4565
5294
  //#endregion
4566
5295
  //#region src/components/primitives/Checkbox/Checkbox.ts
4567
5296
  const Checkbox = defineComponent({
@@ -4870,6 +5599,71 @@ const Divider = defineComponent({
4870
5599
  });
4871
5600
  var Divider_default = Divider;
4872
5601
 
5602
+ //#endregion
5603
+ //#region src/components/primitives/CopyableText/CopyableText.ts
5604
+ /**
5605
+ * Shows a text value with an optional label and a button that copies it to the clipboard. It uses the Clipboard
5606
+ * API and falls back to a textarea when that is not available, then shows "Copied!" for 3 seconds. With `masked`
5607
+ * the value sits in a read-only password field with the same show and hide control as `PasswordField`, and copying
5608
+ * always copies the real value. The copy control is an icon button inside the box in both layouts. A browser does
5609
+ * not copy out of a password field, which is why copying is a button of its own. Vue counterpart of the React
5610
+ * `CopyableText`.
5611
+ */
5612
+ const CopyableText = defineComponent({
5613
+ name: "CopyableText",
5614
+ props: {
5615
+ label: {
5616
+ default: "",
5617
+ type: String
5618
+ },
5619
+ masked: {
5620
+ default: false,
5621
+ type: Boolean
5622
+ },
5623
+ value: {
5624
+ required: true,
5625
+ type: String
5626
+ }
5627
+ },
5628
+ setup(props, { attrs }) {
5629
+ const { t } = useI18n_default();
5630
+ const copied = ref(false);
5631
+ const handleCopy = async () => {
5632
+ await copyTextToClipboard(props.value);
5633
+ copied.value = true;
5634
+ setTimeout(() => {
5635
+ copied.value = false;
5636
+ }, 3e3);
5637
+ };
5638
+ return () => {
5639
+ const rootClass = [withVendorCSSClassPrefix("copyable-text"), attrs.class || ""].filter(Boolean).join(" ");
5640
+ const copyLabel = copied.value ? t("elements.display.copyable_text.copied") : t("elements.display.copyable_text.copy");
5641
+ const copyButton = h(Button_default, {
5642
+ "aria-label": copyLabel,
5643
+ class: withVendorCSSClassPrefix("copyable-text__copy"),
5644
+ onClick: () => {
5645
+ handleCopy().catch(() => void 0);
5646
+ },
5647
+ size: "small",
5648
+ title: copyLabel,
5649
+ variant: "ghost"
5650
+ }, () => copied.value ? CheckIcon() : CopyIcon());
5651
+ return h("div", {
5652
+ class: rootClass,
5653
+ style: attrs.style
5654
+ }, [props.label ? h("span", { class: withVendorCSSClassPrefix("copyable-text__label") }, props.label) : null, props.masked ? h(PasswordField_default, {
5655
+ ariaLabel: props.label || void 0,
5656
+ autocomplete: "off",
5657
+ hideLabel: t("elements.display.copyable_text.hide"),
5658
+ modelValue: props.value,
5659
+ readonly: true,
5660
+ showLabel: t("elements.display.copyable_text.show")
5661
+ }, { append: () => copyButton }) : h("div", { class: withVendorCSSClassPrefix("copyable-text__box") }, [h("span", { class: withVendorCSSClassPrefix("copyable-text__value") }, props.value), copyButton])]);
5662
+ };
5663
+ }
5664
+ });
5665
+ var CopyableText_default = CopyableText;
5666
+
4873
5667
  //#endregion
4874
5668
  //#region src/components/primitives/Logo/Logo.ts
4875
5669
  const Logo = defineComponent({
@@ -6264,6 +7058,28 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
6264
7058
  t: options.t || ((k) => k)
6265
7059
  });
6266
7060
  };
7061
+ const resourceSelectProps = () => {
7062
+ const identifier = component.ref ?? "";
7063
+ const isTouched = touchedFields[identifier] || false;
7064
+ return {
7065
+ class: options.inputClassName,
7066
+ component,
7067
+ error: isTouched ? formErrors[identifier] : void 0,
7068
+ key,
7069
+ label: resolve(component.label) || "",
7070
+ modelValue: formValues[identifier] || "",
7071
+ name: identifier,
7072
+ onBlur: () => options.onInputBlur?.(identifier),
7073
+ onError: options.onPickerError,
7074
+ "onUpdate:modelValue": (val) => onInputChange(identifier, val),
7075
+ placeholder: resolve(component.placeholder),
7076
+ required: component.required
7077
+ };
7078
+ };
7079
+ const skipUnsupported = (typeName) => {
7080
+ logger$2.warn(`Unsupported component type: ${typeName}. Skipping render.`);
7081
+ return null;
7082
+ };
6267
7083
  switch (component.type) {
6268
7084
  case EmbeddedFlowComponentType$1.TextInput:
6269
7085
  case EmbeddedFlowComponentType$1.PasswordInput:
@@ -6445,6 +7261,18 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
6445
7261
  required: component.required
6446
7262
  });
6447
7263
  }
7264
+ case EmbeddedFlowComponentType$1.UserSelect: return options.fetchUsers ? h(BaseUserSelect_default, {
7265
+ ...resourceSelectProps(),
7266
+ fetchUsers: options.fetchUsers
7267
+ }) : skipUnsupported("USER_SELECT");
7268
+ case EmbeddedFlowComponentType$1.AuthFlowSelect: return options.fetchAuthFlows ? h(BaseAuthFlowSelect_default, {
7269
+ ...resourceSelectProps(),
7270
+ fetchAuthFlows: options.fetchAuthFlows
7271
+ }) : skipUnsupported("AUTH_FLOW_SELECT");
7272
+ case EmbeddedFlowComponentType$1.UserTypeSelect: return options.fetchUserTypes ? h(BaseUserTypeSelect_default, {
7273
+ ...resourceSelectProps(),
7274
+ fetchUserTypes: options.fetchUserTypes
7275
+ }) : skipUnsupported("USER_TYPE_SELECT");
6448
7276
  case EmbeddedFlowComponentType$1.Block:
6449
7277
  if (component.components && component.components.length > 0) {
6450
7278
  const blockChildren = component.components.map((childComponent, index) => createAuthComponentFromFlow(childComponent, formValues, touchedFields, formErrors, isLoading, isFormValid, resetForm, onInputChange, {
@@ -6551,6 +7379,16 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
6551
7379
  pairs
6552
7380
  });
6553
7381
  }
7382
+ case EmbeddedFlowComponentType$1.CopyableText: {
7383
+ const sourceKey = component.source;
7384
+ const value = sourceKey && options.additionalData ? String(options.additionalData[sourceKey] ?? "") : "";
7385
+ return h(CopyableText_default, {
7386
+ key,
7387
+ label: resolve(component.label),
7388
+ masked: Boolean(component.masked),
7389
+ value
7390
+ });
7391
+ }
6554
7392
  default:
6555
7393
  logger$2.warn(`Unsupported component type: ${component.type}. Skipping render.`);
6556
7394
  return null;
@@ -9823,7 +10661,7 @@ const BaseAcceptInvite = defineComponent({
9823
10661
  const errors = {};
9824
10662
  const validateComponents = (comps) => {
9825
10663
  comps.forEach((comp) => {
9826
- if ((comp.type === "PASSWORD_INPUT" || comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT") && comp.required && comp.ref) {
10664
+ if ((comp.type === "PASSWORD_INPUT" || comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT" || comp.type === "SELECT") && comp.required && comp.ref) {
9827
10665
  const value = formValues.value[comp.ref] || "";
9828
10666
  if (!value || value.trim() === "") errors[comp.ref] = `${comp.label || comp.ref} is required`;
9829
10667
  }
@@ -10022,6 +10860,7 @@ const BaseAcceptInvite = defineComponent({
10022
10860
  }, () => "Sign In")]) : null
10023
10861
  ])]);
10024
10862
  const renderedComponents = componentsWithoutHeadings.length > 0 ? renderInviteUserComponents(componentsWithoutHeadings, formValues.value, touchedFields.value, formErrors.value, isLoading.value, isFormValid.value, resetForm, handleInputChange, {
10863
+ additionalData: currentFlow.value?.data?.additionalData ?? {},
10025
10864
  meta,
10026
10865
  onInputBlur: handleInputBlur,
10027
10866
  onSubmit: handleSubmit,
@@ -10179,6 +11018,18 @@ const BaseInviteUser = defineComponent({
10179
11018
  default: "",
10180
11019
  type: String
10181
11020
  },
11021
+ fetchAuthFlows: {
11022
+ default: void 0,
11023
+ type: Function
11024
+ },
11025
+ fetchUsers: {
11026
+ default: void 0,
11027
+ type: Function
11028
+ },
11029
+ fetchUserTypes: {
11030
+ default: void 0,
11031
+ type: Function
11032
+ },
10182
11033
  isInitialized: {
10183
11034
  default: true,
10184
11035
  type: Boolean
@@ -10277,7 +11128,7 @@ const BaseInviteUser = defineComponent({
10277
11128
  const errors = {};
10278
11129
  const validateComponents = (comps) => {
10279
11130
  comps.forEach((comp) => {
10280
- if ((comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT" || comp.type === "SELECT") && comp.required && comp.ref) {
11131
+ 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) {
10281
11132
  const value = formValues.value[comp.ref] || "";
10282
11133
  if (!value || value.trim() === "") errors[comp.ref] = `${comp.label || comp.ref} is required`;
10283
11134
  if (comp.type === "EMAIL_INPUT" && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) errors[comp.ref] = "Please enter a valid email address";
@@ -10505,8 +11356,13 @@ const BaseInviteUser = defineComponent({
10505
11356
  }, () => "Invite Another User")])
10506
11357
  ])]);
10507
11358
  const renderedComponents = componentsWithoutHeadings.length > 0 ? renderInviteUserComponents(componentsWithoutHeadings, formValues.value, touchedFields.value, formErrors.value, isLoading.value, isFormValid.value, resetForm, handleInputChange, {
11359
+ additionalData: currentFlow.value?.data?.additionalData,
11360
+ fetchAuthFlows: props.fetchAuthFlows,
11361
+ fetchUsers: props.fetchUsers,
11362
+ fetchUserTypes: props.fetchUserTypes,
10508
11363
  meta,
10509
11364
  onInputBlur: handleInputBlur,
11365
+ onPickerError: props.onError,
10510
11366
  onSubmit: handleSubmit,
10511
11367
  size: props.size,
10512
11368
  t,
@@ -10577,6 +11433,9 @@ const InviteUser = defineComponent({
10577
11433
  },
10578
11434
  setup(props, { slots }) {
10579
11435
  const { http: http$1, baseUrl, isInitialized } = useThunderID_default();
11436
+ const fetchAuthFlows = useFetchAuthFlows_default();
11437
+ const fetchUsers = useFetchUsers_default();
11438
+ const fetchUserTypes = useFetchUserTypes_default();
10580
11439
  const handleInitialize = async (payload) => {
10581
11440
  return (await http$1.request({
10582
11441
  data: {
@@ -10608,6 +11467,9 @@ const InviteUser = defineComponent({
10608
11467
  };
10609
11468
  return () => h(BaseInviteUser_default, {
10610
11469
  className: props.className,
11470
+ fetchAuthFlows,
11471
+ fetchUsers,
11472
+ fetchUserTypes,
10611
11473
  isInitialized: isInitialized?.value ?? false,
10612
11474
  onError: props.onError,
10613
11475
  onFlowChange: props.onFlowChange,
@@ -10891,4 +11753,4 @@ const createCallbackRoute = (options = {}) => {
10891
11753
  };
10892
11754
 
10893
11755
  //#endregion
10894
- 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, KeyValueList_default as KeyValueList, 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, parseKeyValuePairs, 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 };
11756
+ export { AcceptInvite_default as AcceptInvite, Alert_default as Alert, ArrowLeftRightIcon, AuthFlowSelect_default as AuthFlowSelect, BaseAcceptInvite_default as BaseAcceptInvite, BaseAuthFlowSelect_default as BaseAuthFlowSelect, 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, BaseUserSelect_default as BaseUserSelect, BaseUserTypeSelect_default as BaseUserTypeSelect, 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, CopyableText_default as CopyableText, 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, KeyValueList_default as KeyValueList, 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, UserSelect_default as UserSelect, UserTypeSelect_default as UserTypeSelect, 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, parseKeyValuePairs, useFetchAuthFlows_default as useFetchAuthFlows, useFetchUserTypes_default as useFetchUserTypes, useFetchUsers_default as useFetchUsers, useFlow_default as useFlow, useFlowMeta_default as useFlowMeta, useI18n_default as useI18n, useInfiniteOptions_default as useInfiniteOptions, useOAuthCallback, useTheme_default as useTheme, useThunderID_default as useThunderID, useUser_default as useUser, validateFieldValue };