@thunderid/vue 1.12.0 → 1.13.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.
- package/dist/api/auth/executeEmbeddedSelfFlow.d.ts +22 -0
- package/dist/api/auth/executeEmbeddedSelfFlow.d.ts.map +1 -0
- package/dist/cjs/index.cjs +1026 -105
- package/dist/components/account/user-profile/BaseUserProfile.d.ts +42 -2
- package/dist/components/account/user-profile/BaseUserProfile.d.ts.map +1 -1
- package/dist/components/account/user-profile/UserProfile.css.d.ts +1 -1
- package/dist/components/account/user-profile/UserProfile.css.d.ts.map +1 -1
- package/dist/components/account/user-profile/UserProfile.d.ts.map +1 -1
- package/dist/components/account/verify-attribute/BaseVerifyAttribute.d.ts +83 -0
- package/dist/components/account/verify-attribute/BaseVerifyAttribute.d.ts.map +1 -0
- package/dist/components/account/verify-attribute/VerifyAttribute.css.d.ts +7 -0
- package/dist/components/account/verify-attribute/VerifyAttribute.css.d.ts.map +1 -0
- package/dist/components/account/verify-attribute/VerifyAttribute.d.ts +23 -0
- package/dist/components/account/verify-attribute/VerifyAttribute.d.ts.map +1 -0
- package/dist/components/auth/flow/AuthOptionFactory.d.ts +1 -1
- package/dist/components/auth/flow/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/auth/flow/AuthOptionFactoryCore.d.ts +5 -0
- package/dist/components/auth/flow/AuthOptionFactoryCore.d.ts.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1001 -107
- package/dist/styles/injectStyles.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -310,7 +310,7 @@ const PACKAGE_NAME = "@thunderid/vue";
|
|
|
310
310
|
* Package-level logger for `@thunderid/vue`.
|
|
311
311
|
* Use this when logging is not tied to a specific component.
|
|
312
312
|
*/
|
|
313
|
-
const logger$
|
|
313
|
+
const logger$8 = (0, __thunderid_browser.createPackageLogger)(PACKAGE_NAME);
|
|
314
314
|
/**
|
|
315
315
|
* Creates a component-scoped logger prefixed with `@thunderid/vue - <component>`.
|
|
316
316
|
*
|
|
@@ -320,7 +320,7 @@ const createVueLogger = (component) => (0, __thunderid_browser.createPackageComp
|
|
|
320
320
|
|
|
321
321
|
//#endregion
|
|
322
322
|
//#region src/providers/I18nProvider.ts
|
|
323
|
-
const logger$
|
|
323
|
+
const logger$7 = createVueLogger("I18nProvider");
|
|
324
324
|
const DEFAULT_URL_PARAM = "lang";
|
|
325
325
|
const deriveRootDomain = (hostname) => {
|
|
326
326
|
const parts = hostname.split(".");
|
|
@@ -360,7 +360,7 @@ const createStorageAdapter = (strategy, key, cookieDomain) => {
|
|
|
360
360
|
try {
|
|
361
361
|
window.localStorage.setItem(key, language);
|
|
362
362
|
} catch {
|
|
363
|
-
logger$
|
|
363
|
+
logger$7.warn("Failed to persist language preference to localStorage.");
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
};
|
|
@@ -487,7 +487,7 @@ const I18nProvider = (0, vue.defineComponent)({
|
|
|
487
487
|
};
|
|
488
488
|
const setLanguage = (language) => {
|
|
489
489
|
if (mergedBundlesComputed.value[language]) currentLanguage.value = language;
|
|
490
|
-
else logger$
|
|
490
|
+
else logger$7.warn(`Language '${language}' is not available. Available languages: ${Object.keys(mergedBundlesComputed.value).join(", ")}`);
|
|
491
491
|
};
|
|
492
492
|
(0, vue.provide)(I18N_KEY, {
|
|
493
493
|
bundles: (0, vue.readonly)(mergedBundlesComputed),
|
|
@@ -934,7 +934,7 @@ var ThunderIDVueClient_default = ThunderIDVueClient;
|
|
|
934
934
|
|
|
935
935
|
//#endregion
|
|
936
936
|
//#region src/providers/ThunderIDProvider.ts
|
|
937
|
-
const logger$
|
|
937
|
+
const logger$6 = createVueLogger("ThunderIDProvider");
|
|
938
938
|
/**
|
|
939
939
|
* Checks if the current URL contains authentication parameters.
|
|
940
940
|
*/
|
|
@@ -1208,7 +1208,7 @@ const ThunderIDProvider = (0, vue.defineComponent)({
|
|
|
1208
1208
|
try {
|
|
1209
1209
|
await client.getDiscoveryResponse();
|
|
1210
1210
|
} catch (error) {
|
|
1211
|
-
logger$
|
|
1211
|
+
logger$6.warn("Could not load the OIDC discovery metadata on mount.", error);
|
|
1212
1212
|
}
|
|
1213
1213
|
const initializedConfig = await client.getConfiguration();
|
|
1214
1214
|
if (initializedConfig?.baseUrl) sessionStorage.setItem(`${vendor}_base_url`, initializedConfig.baseUrl);
|
|
@@ -2241,6 +2241,87 @@ img.thunderid-user-profile__avatar {
|
|
|
2241
2241
|
gap: calc(var(--thunderid-spacing-unit) * 0.5);
|
|
2242
2242
|
}
|
|
2243
2243
|
|
|
2244
|
+
.thunderid-user-profile__verification-status {
|
|
2245
|
+
display: inline-flex;
|
|
2246
|
+
flex-shrink: 0;
|
|
2247
|
+
gap: calc(var(--thunderid-spacing-unit) * 0.5);
|
|
2248
|
+
align-items: center;
|
|
2249
|
+
padding: 0 var(--thunderid-spacing-unit);
|
|
2250
|
+
border-radius: 999px;
|
|
2251
|
+
font-size: 0.75rem;
|
|
2252
|
+
font-weight: 500;
|
|
2253
|
+
line-height: 22px;
|
|
2254
|
+
white-space: nowrap;
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
.thunderid-user-profile__verification-status svg {
|
|
2258
|
+
width: 12px;
|
|
2259
|
+
height: 12px;
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
.thunderid-user-profile__verification-status--verified {
|
|
2263
|
+
color: var(--thunderid-color-success-dark, var(--thunderid-color-success-main));
|
|
2264
|
+
background: color-mix(in srgb, var(--thunderid-color-success-main) 12%, transparent);
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
/* Amber marks an action the user can take. */
|
|
2268
|
+
.thunderid-user-profile__verification-status--unverified {
|
|
2269
|
+
color: var(--thunderid-color-warning-contrastText);
|
|
2270
|
+
background: color-mix(in srgb, var(--thunderid-color-warning-main) 14%, transparent);
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
.thunderid-user-profile__verification {
|
|
2274
|
+
padding: var(--thunderid-spacing-unit) 0;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
/* Starts where the value column starts: the label's width plus the row gap. */
|
|
2278
|
+
.thunderid-user-profile__verification--inline {
|
|
2279
|
+
margin-inline-start: calc(120px + var(--thunderid-spacing-unit));
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
.thunderid-user-profile__verification-overlay {
|
|
2283
|
+
position: fixed;
|
|
2284
|
+
inset: 0;
|
|
2285
|
+
z-index: 9999;
|
|
2286
|
+
display: flex;
|
|
2287
|
+
align-items: center;
|
|
2288
|
+
justify-content: center;
|
|
2289
|
+
background-color: rgba(0, 0, 0, 0.45);
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
.thunderid-user-profile__verification-dialog {
|
|
2293
|
+
box-sizing: border-box;
|
|
2294
|
+
width: min(448px, calc(100vw - calc(var(--thunderid-spacing-unit) * 4)));
|
|
2295
|
+
max-height: 90vh;
|
|
2296
|
+
overflow-y: auto;
|
|
2297
|
+
padding: calc(var(--thunderid-spacing-unit) * 2);
|
|
2298
|
+
background: var(--thunderid-color-background-surface);
|
|
2299
|
+
border-radius: var(--thunderid-border-radius-large);
|
|
2300
|
+
box-shadow: var(--thunderid-shadow-large);
|
|
2301
|
+
font-family: var(--thunderid-typography-fontFamily);
|
|
2302
|
+
outline: none;
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
.thunderid-user-profile__verification-dialog > .thunderid-user-profile__verification {
|
|
2306
|
+
padding: 0;
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
.thunderid-user-profile__verification-notice {
|
|
2310
|
+
margin-bottom: calc(var(--thunderid-spacing-unit) * 2);
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
.thunderid-user-profile__visually-hidden {
|
|
2314
|
+
position: absolute;
|
|
2315
|
+
width: 1px;
|
|
2316
|
+
height: 1px;
|
|
2317
|
+
padding: 0;
|
|
2318
|
+
margin: -1px;
|
|
2319
|
+
overflow: hidden;
|
|
2320
|
+
clip: rect(0, 0, 0, 0);
|
|
2321
|
+
white-space: nowrap;
|
|
2322
|
+
border: 0;
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2244
2325
|
.thunderid-user-profile__field-error {
|
|
2245
2326
|
color: var(--thunderid-color-error, #d32f2f);
|
|
2246
2327
|
font-size: var(--thunderid-typography-fontSize-xs, 0.8rem);
|
|
@@ -2264,6 +2345,83 @@ img.thunderid-user-profile__avatar {
|
|
|
2264
2345
|
`;
|
|
2265
2346
|
var UserProfile_css_default = USER_PROFILE_CSS;
|
|
2266
2347
|
|
|
2348
|
+
//#endregion
|
|
2349
|
+
//#region src/components/account/verify-attribute/VerifyAttribute.css.ts
|
|
2350
|
+
/**
|
|
2351
|
+
* Styles for the VerifyAttribute presentation component.
|
|
2352
|
+
* Parity target: `@thunderid/react` BaseVerifyAttribute.styles.ts
|
|
2353
|
+
*/
|
|
2354
|
+
const VERIFY_ATTRIBUTE_CSS = `
|
|
2355
|
+
/* ============================================================
|
|
2356
|
+
VerifyAttribute (React Parity)
|
|
2357
|
+
============================================================ */
|
|
2358
|
+
|
|
2359
|
+
.thunderid-verify-attribute {
|
|
2360
|
+
display: flex;
|
|
2361
|
+
flex-direction: column;
|
|
2362
|
+
gap: calc(var(--thunderid-spacing-unit) * 2);
|
|
2363
|
+
width: 100%;
|
|
2364
|
+
box-sizing: border-box;
|
|
2365
|
+
font-family: var(--thunderid-typography-fontFamily);
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
.thunderid-verify-attribute--outlined {
|
|
2369
|
+
padding: calc(var(--thunderid-spacing-unit) * 2);
|
|
2370
|
+
border: 1px solid var(--thunderid-color-border);
|
|
2371
|
+
border-radius: var(--thunderid-border-radius-medium, 6px);
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2374
|
+
.thunderid-verify-attribute__header {
|
|
2375
|
+
display: flex;
|
|
2376
|
+
flex-direction: column;
|
|
2377
|
+
gap: calc(var(--thunderid-spacing-unit) / 2);
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
.thunderid-verify-attribute__heading {
|
|
2381
|
+
margin: 0;
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
.thunderid-verify-attribute__subheading,
|
|
2385
|
+
.thunderid-verify-attribute__destination {
|
|
2386
|
+
margin: 0;
|
|
2387
|
+
color: var(--thunderid-color-text-secondary);
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
.thunderid-verify-attribute__content {
|
|
2391
|
+
display: flex;
|
|
2392
|
+
flex-direction: column;
|
|
2393
|
+
gap: calc(var(--thunderid-spacing-unit) * 1.5);
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
.thunderid-verify-attribute__content .thunderid-otp-field__inputs {
|
|
2397
|
+
justify-content: flex-start;
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
.thunderid-verify-attribute__content .thunderid-otp-field__digit {
|
|
2401
|
+
flex: 1 1 calc(var(--thunderid-spacing-unit) * 4);
|
|
2402
|
+
max-width: calc(var(--thunderid-spacing-unit) * 6);
|
|
2403
|
+
min-width: 0;
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
.thunderid-verify-attribute__alert {
|
|
2407
|
+
width: 100%;
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
.thunderid-verify-attribute__loading {
|
|
2411
|
+
display: flex;
|
|
2412
|
+
justify-content: center;
|
|
2413
|
+
padding: calc(var(--thunderid-spacing-unit) * 2);
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
.thunderid-verify-attribute__actions {
|
|
2417
|
+
display: flex;
|
|
2418
|
+
align-items: center;
|
|
2419
|
+
justify-content: flex-end;
|
|
2420
|
+
gap: var(--thunderid-spacing-unit);
|
|
2421
|
+
}
|
|
2422
|
+
`;
|
|
2423
|
+
var VerifyAttribute_css_default = VERIFY_ATTRIBUTE_CSS;
|
|
2424
|
+
|
|
2267
2425
|
//#endregion
|
|
2268
2426
|
//#region src/components/admin/shared/Admin.css.ts
|
|
2269
2427
|
/**
|
|
@@ -4352,7 +4510,8 @@ const STYLES = [
|
|
|
4352
4510
|
UserDropdown_css_default,
|
|
4353
4511
|
UserProfile_css_default,
|
|
4354
4512
|
Admin_css_default,
|
|
4355
|
-
Attribution_css_default
|
|
4513
|
+
Attribution_css_default,
|
|
4514
|
+
VerifyAttribute_css_default
|
|
4356
4515
|
].join("\n");
|
|
4357
4516
|
/**
|
|
4358
4517
|
* Injects ThunderID Vue component styles into the document `<head>` once.
|
|
@@ -4720,7 +4879,7 @@ var useFetchAuthFlows_default = useFetchAuthFlows;
|
|
|
4720
4879
|
|
|
4721
4880
|
//#endregion
|
|
4722
4881
|
//#region src/composables/management/useInfiniteOptions.ts
|
|
4723
|
-
const logger$
|
|
4882
|
+
const logger$5 = (0, __thunderid_browser.createPackageComponentLogger)("@thunderid/vue", "useInfiniteOptions");
|
|
4724
4883
|
/**
|
|
4725
4884
|
* Keeps the option list of a `Select` that loads more options when the user asks for them. It owns the cursor,
|
|
4726
4885
|
* appends each batch without duplicates, and stops at the end of the data. Vue counterpart of the React
|
|
@@ -4745,10 +4904,10 @@ const useInfiniteOptions = (args) => {
|
|
|
4745
4904
|
cursor,
|
|
4746
4905
|
options: options.value
|
|
4747
4906
|
}, batch);
|
|
4748
|
-
if (merged.issue === "cursor-stuck") logger$
|
|
4907
|
+
if (merged.issue === "cursor-stuck") logger$5.warn("A load returned no new options and the same cursor; the list was treated as finished.");
|
|
4749
4908
|
else if (merged.issue === "not-a-list" && !nonListLogged) {
|
|
4750
4909
|
nonListLogged = true;
|
|
4751
|
-
logger$
|
|
4910
|
+
logger$5.warn("A load returned something other than a list of options; it was treated as an empty batch.");
|
|
4752
4911
|
}
|
|
4753
4912
|
const addedNothing = merged.options.length === options.value.length;
|
|
4754
4913
|
cursor = merged.cursor;
|
|
@@ -4777,7 +4936,7 @@ const useInfiniteOptions = (args) => {
|
|
|
4777
4936
|
try {
|
|
4778
4937
|
args.onError?.(failureError);
|
|
4779
4938
|
} catch (callbackFailure) {
|
|
4780
|
-
logger$
|
|
4939
|
+
logger$5.error("The onError callback threw.", callbackFailure);
|
|
4781
4940
|
}
|
|
4782
4941
|
}
|
|
4783
4942
|
} finally {
|
|
@@ -7010,7 +7169,7 @@ var SignUpButton_default = SignUpButton;
|
|
|
7010
7169
|
|
|
7011
7170
|
//#endregion
|
|
7012
7171
|
//#region src/components/auth/Callback.ts
|
|
7013
|
-
const logger$
|
|
7172
|
+
const logger$4 = createVueLogger("Callback");
|
|
7014
7173
|
/**
|
|
7015
7174
|
* Callback — headless component that handles OAuth callback parameter forwarding.
|
|
7016
7175
|
*
|
|
@@ -7099,7 +7258,7 @@ const Callback = (0, vue.defineComponent)({
|
|
|
7099
7258
|
navigate$4(`${returnPath}?${params.toString()}`);
|
|
7100
7259
|
} catch (err) {
|
|
7101
7260
|
const errorMessage = err instanceof Error ? err.message : "OAuth callback processing failed";
|
|
7102
|
-
logger$
|
|
7261
|
+
logger$4.error("OAuth callback error:", err);
|
|
7103
7262
|
props.onError?.(err instanceof Error ? err : new Error(errorMessage));
|
|
7104
7263
|
const params = new URLSearchParams();
|
|
7105
7264
|
params.set("error", "callback_error");
|
|
@@ -8111,7 +8270,7 @@ var MicrosoftButton_default = MicrosoftButton;
|
|
|
8111
8270
|
|
|
8112
8271
|
//#endregion
|
|
8113
8272
|
//#region src/components/auth/flow/AuthOptionFactoryCore.ts
|
|
8114
|
-
const logger$
|
|
8273
|
+
const logger$3 = createVueLogger("AuthOptionFactory");
|
|
8115
8274
|
/**
|
|
8116
8275
|
* Replaces `emoji:` URIs embedded in HTML before DOMPurify sanitization.
|
|
8117
8276
|
*
|
|
@@ -8214,9 +8373,20 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
8214
8373
|
};
|
|
8215
8374
|
};
|
|
8216
8375
|
const skipUnsupported = (typeName) => {
|
|
8217
|
-
logger$
|
|
8376
|
+
logger$3.warn(`Unsupported component type: ${typeName}. Skipping render.`);
|
|
8218
8377
|
return null;
|
|
8219
8378
|
};
|
|
8379
|
+
if (component.type === __thunderid_browser.EmbeddedFlowComponentType.Resend && options.renderResend) return (0, vue.h)(Button_default, {
|
|
8380
|
+
class: options.buttonClassName,
|
|
8381
|
+
color: "primary",
|
|
8382
|
+
disabled: isLoading || options.isTimeoutDisabled,
|
|
8383
|
+
fullWidth: true,
|
|
8384
|
+
id: component.id,
|
|
8385
|
+
key,
|
|
8386
|
+
onClick: () => options.onSubmit?.(component, {}, true),
|
|
8387
|
+
type: "button",
|
|
8388
|
+
variant: "text"
|
|
8389
|
+
}, { default: () => resolve(component.label) });
|
|
8220
8390
|
switch (component.type) {
|
|
8221
8391
|
case __thunderid_browser.EmbeddedFlowComponentType.TextInput:
|
|
8222
8392
|
case __thunderid_browser.EmbeddedFlowComponentType.PasswordInput:
|
|
@@ -8469,7 +8639,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
8469
8639
|
});
|
|
8470
8640
|
}
|
|
8471
8641
|
case __thunderid_browser.EmbeddedFlowComponentType.Icon:
|
|
8472
|
-
logger$
|
|
8642
|
+
logger$3.warn(`Icon component type is not yet supported in the Vue SDK. Skipping render.`);
|
|
8473
8643
|
return null;
|
|
8474
8644
|
case __thunderid_browser.EmbeddedFlowComponentType.Stack: {
|
|
8475
8645
|
const direction = component.direction || "row";
|
|
@@ -8535,7 +8705,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
8535
8705
|
});
|
|
8536
8706
|
}
|
|
8537
8707
|
default:
|
|
8538
|
-
logger$
|
|
8708
|
+
logger$3.warn(`Unsupported component type: ${component.type}. Skipping render.`);
|
|
8539
8709
|
return null;
|
|
8540
8710
|
}
|
|
8541
8711
|
};
|
|
@@ -8555,6 +8725,15 @@ const renderSignUpComponents = (components, formValues, touchedFields, formError
|
|
|
8555
8725
|
key: component.id || index
|
|
8556
8726
|
})).filter((v) => v !== null);
|
|
8557
8727
|
/**
|
|
8728
|
+
* Processes an array of components and renders them as VNodes for self attribute verification.
|
|
8729
|
+
* Identical to renderSignUpComponents, except that it renders RESEND actions.
|
|
8730
|
+
*/
|
|
8731
|
+
const renderVerificationComponents = (components, formValues, touchedFields, formErrors, isLoading, isFormValid, resetForm, onInputChange, options) => components.map((component, index) => createAuthComponentFromFlow(component, formValues, touchedFields, formErrors, isLoading, isFormValid, resetForm, onInputChange, {
|
|
8732
|
+
...options,
|
|
8733
|
+
key: component.id ?? index,
|
|
8734
|
+
renderResend: true
|
|
8735
|
+
})).filter((v) => v !== null);
|
|
8736
|
+
/**
|
|
8558
8737
|
* Processes an array of components and renders them as VNodes for invite-user flows.
|
|
8559
8738
|
* Identical to renderSignInComponents — separated for semantic clarity.
|
|
8560
8739
|
*/
|
|
@@ -9904,7 +10083,7 @@ var getAuthComponentHeadings_default = getAuthComponentHeadings;
|
|
|
9904
10083
|
|
|
9905
10084
|
//#endregion
|
|
9906
10085
|
//#region src/components/auth/sign-up/BaseSignUp.ts
|
|
9907
|
-
const logger$
|
|
10086
|
+
const logger$2 = createVueLogger("BaseSignUp");
|
|
9908
10087
|
const extractFormFields = (components) => {
|
|
9909
10088
|
const fields = [];
|
|
9910
10089
|
const process = (comps) => {
|
|
@@ -10131,7 +10310,7 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10131
10310
|
if (reusablePopup) reusablePopup.location.href = redirectUrl;
|
|
10132
10311
|
const popup = reusablePopup ?? window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
|
|
10133
10312
|
if (!popup) {
|
|
10134
|
-
logger$
|
|
10313
|
+
logger$2.error("Failed to open popup window");
|
|
10135
10314
|
return false;
|
|
10136
10315
|
}
|
|
10137
10316
|
let hasProcessedCallback = false;
|
|
@@ -10207,7 +10386,7 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10207
10386
|
if (!isThisRound(state)) return;
|
|
10208
10387
|
hasProcessedCallback = true;
|
|
10209
10388
|
if (error) {
|
|
10210
|
-
logger$
|
|
10389
|
+
logger$2.error("OAuth error");
|
|
10211
10390
|
popup.close();
|
|
10212
10391
|
cleanup();
|
|
10213
10392
|
return;
|
|
@@ -10216,7 +10395,7 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10216
10395
|
}
|
|
10217
10396
|
} catch {}
|
|
10218
10397
|
} catch {
|
|
10219
|
-
logger$
|
|
10398
|
+
logger$2.error("Error monitoring popup");
|
|
10220
10399
|
}
|
|
10221
10400
|
}, 1e3);
|
|
10222
10401
|
return true;
|
|
@@ -10724,7 +10903,8 @@ const FIELDS_TO_SKIP = [
|
|
|
10724
10903
|
"preferredMFAOption",
|
|
10725
10904
|
"attributes",
|
|
10726
10905
|
"isReadOnly",
|
|
10727
|
-
"isReadonly"
|
|
10906
|
+
"isReadonly",
|
|
10907
|
+
__thunderid_browser.AttributeVerificationConstants.VERIFIED_ATTRIBUTES_KEY
|
|
10728
10908
|
];
|
|
10729
10909
|
const READONLY_FIELDS = [
|
|
10730
10910
|
"username",
|
|
@@ -10763,6 +10943,11 @@ const AVATAR_GRADIENTS$1 = [
|
|
|
10763
10943
|
"linear-gradient(135deg, #14b8a6 0%, #0ea5e9 100%)",
|
|
10764
10944
|
"linear-gradient(135deg, #f97316 0%, #ec4899 100%)"
|
|
10765
10945
|
];
|
|
10946
|
+
const isVerificationType = (type) => !!type && __thunderid_browser.AttributeVerificationConstants.VERIFIABLE_ATTRIBUTE_TYPES.includes(type.toLowerCase());
|
|
10947
|
+
const isVerifiedAfterSave = (type) => !!type && __thunderid_browser.AttributeVerificationConstants.VERIFY_AFTER_SAVE_ATTRIBUTE_TYPES.includes(type.toLowerCase());
|
|
10948
|
+
const storedValueOf = (user, name) => {
|
|
10949
|
+
return (user?.["attributes"])?.[name] ?? user?.[name];
|
|
10950
|
+
};
|
|
10766
10951
|
function getAvatarGradient$1(seed) {
|
|
10767
10952
|
if (!seed) return AVATAR_GRADIENTS$1[0];
|
|
10768
10953
|
let hash = 0;
|
|
@@ -10877,6 +11062,52 @@ const BaseUserProfile = (0, vue.defineComponent)({
|
|
|
10877
11062
|
}
|
|
10878
11063
|
return fallback ?? key;
|
|
10879
11064
|
};
|
|
11065
|
+
const tp = (key, params = {}) => {
|
|
11066
|
+
const translate = props.t;
|
|
11067
|
+
const res = translate?.(key, params);
|
|
11068
|
+
if (res && res !== key) return res;
|
|
11069
|
+
const fallback = ((0, __thunderid_browser.getDefaultI18nBundles)()["en-US"]?.translations)?.[key];
|
|
11070
|
+
return fallback ? (0, __thunderid_browser.substituteTranslationParams)(fallback, params) : key;
|
|
11071
|
+
};
|
|
11072
|
+
const i18n = (0, vue.inject)(I18N_KEY, null);
|
|
11073
|
+
const verifyingField = (0, vue.ref)(null);
|
|
11074
|
+
const verifiedNotice = (0, vue.ref)(null);
|
|
11075
|
+
const verificationDialogRef = (0, vue.ref)(null);
|
|
11076
|
+
let focusBeforeDialog = null;
|
|
11077
|
+
const openVerification = (name) => {
|
|
11078
|
+
verifiedNotice.value = null;
|
|
11079
|
+
verifyingField.value = name;
|
|
11080
|
+
};
|
|
11081
|
+
(0, vue.watch)(verifyingField, (name, previous) => {
|
|
11082
|
+
if (props.compact) return;
|
|
11083
|
+
if (name && !previous) {
|
|
11084
|
+
focusBeforeDialog = document.activeElement;
|
|
11085
|
+
(0, vue.nextTick)(() => verificationDialogRef.value?.focus());
|
|
11086
|
+
} else if (!name && previous) {
|
|
11087
|
+
focusBeforeDialog?.focus();
|
|
11088
|
+
focusBeforeDialog = null;
|
|
11089
|
+
}
|
|
11090
|
+
});
|
|
11091
|
+
const pendingVerification = (0, vue.ref)(null);
|
|
11092
|
+
const storedUser = () => props.flattenedProfile ?? props.profile ?? null;
|
|
11093
|
+
const reportedVerifiedAttributes = () => (0, __thunderid_browser.getVerifiedAttributes)(props.profile ?? props.flattenedProfile);
|
|
11094
|
+
(0, vue.watch)(() => [
|
|
11095
|
+
props.profile,
|
|
11096
|
+
props.flattenedProfile,
|
|
11097
|
+
props.error
|
|
11098
|
+
], () => {
|
|
11099
|
+
const pending = pendingVerification.value;
|
|
11100
|
+
if (!pending) return;
|
|
11101
|
+
if (props.error) {
|
|
11102
|
+
pendingVerification.value = null;
|
|
11103
|
+
return;
|
|
11104
|
+
}
|
|
11105
|
+
const storedValue = storedValueOf(storedUser(), pending.name);
|
|
11106
|
+
if (storedValue === pending.previousValue) return;
|
|
11107
|
+
const verified = reportedVerifiedAttributes();
|
|
11108
|
+
if (verified && typeof storedValue === "string" && storedValue.trim() !== "" && !verified[pending.name]) openVerification(pending.name);
|
|
11109
|
+
pendingVerification.value = null;
|
|
11110
|
+
});
|
|
10880
11111
|
function shouldShowField(fieldName, isSchemaBased = false) {
|
|
10881
11112
|
if (!isSchemaBased && FIELDS_TO_SKIP.includes(fieldName)) return false;
|
|
10882
11113
|
if (props.hideFields && props.hideFields.length > 0 && props.hideFields.includes(fieldName)) return false;
|
|
@@ -10898,6 +11129,11 @@ const BaseUserProfile = (0, vue.defineComponent)({
|
|
|
10898
11129
|
[fieldName]: ""
|
|
10899
11130
|
};
|
|
10900
11131
|
}
|
|
11132
|
+
function clearEditedValue(fieldName) {
|
|
11133
|
+
const next = { ...editedValues.value };
|
|
11134
|
+
delete next[fieldName];
|
|
11135
|
+
editedValues.value = next;
|
|
11136
|
+
}
|
|
10901
11137
|
function cancelEditing(fieldName) {
|
|
10902
11138
|
const data = props.flattenedProfile ?? props.profile ?? null;
|
|
10903
11139
|
const originalValue = data?.[fieldName] ?? data?.attributes?.[fieldName] ?? "";
|
|
@@ -10949,14 +11185,124 @@ const BaseUserProfile = (0, vue.defineComponent)({
|
|
|
10949
11185
|
...fieldErrors.value,
|
|
10950
11186
|
[fieldName]: ""
|
|
10951
11187
|
};
|
|
10952
|
-
const
|
|
11188
|
+
const submitVal = typeof value === "string" ? strVal : value;
|
|
11189
|
+
const payload = buildPatchValue(fieldName, submitVal, schema.schemaId, schema.multiValued);
|
|
11190
|
+
const previousValue = storedValueOf(storedUser(), fieldName);
|
|
11191
|
+
pendingVerification.value = slots["verification"] && isVerifiedAfterSave(schema.type) && (0, __thunderid_browser.isVerifiableAttribute)(props.userSchema, fieldName) && typeof submitVal === "string" && submitVal !== "" && submitVal !== previousValue ? {
|
|
11192
|
+
name: fieldName,
|
|
11193
|
+
previousValue
|
|
11194
|
+
} : null;
|
|
10953
11195
|
try {
|
|
10954
11196
|
await props.onUpdate(payload);
|
|
10955
11197
|
editingFields.value = {
|
|
10956
11198
|
...editingFields.value,
|
|
10957
11199
|
[fieldName]: false
|
|
10958
11200
|
};
|
|
10959
|
-
|
|
11201
|
+
clearEditedValue(fieldName);
|
|
11202
|
+
} catch {
|
|
11203
|
+
pendingVerification.value = null;
|
|
11204
|
+
}
|
|
11205
|
+
}
|
|
11206
|
+
function renderVerificationStatus(name) {
|
|
11207
|
+
const verification = reportedVerifiedAttributes()?.[name];
|
|
11208
|
+
let verifiedAtText;
|
|
11209
|
+
if (verification?.verifiedAt) {
|
|
11210
|
+
const verifiedAt = new Date(verification.verifiedAt);
|
|
11211
|
+
verifiedAtText = tp("user.verification.status.verified_at", { date: Number.isNaN(verifiedAt.getTime()) ? verification.verifiedAt : verifiedAt.toLocaleString(i18n?.currentLanguage?.value ?? props.preferences?.i18n?.language) });
|
|
11212
|
+
}
|
|
11213
|
+
const modifier = verification ? "verified" : "unverified";
|
|
11214
|
+
return (0, vue.h)("span", {
|
|
11215
|
+
class: [px("user-profile__verification-status"), px(`user-profile__verification-status--${modifier}`)].join(" "),
|
|
11216
|
+
"data-testid": `thunderid-verification-status-${name}`,
|
|
11217
|
+
title: verifiedAtText
|
|
11218
|
+
}, [
|
|
11219
|
+
(0, vue.h)(verification ? CircleCheckIcon : CircleAlertIcon),
|
|
11220
|
+
tp(`user.verification.status.${modifier}`),
|
|
11221
|
+
verifiedAtText ? (0, vue.h)("span", { class: px("user-profile__visually-hidden") }, ` (${verifiedAtText})`) : null
|
|
11222
|
+
]);
|
|
11223
|
+
}
|
|
11224
|
+
const verificationStatusOf = (name) => {
|
|
11225
|
+
const verified = reportedVerifiedAttributes();
|
|
11226
|
+
const stored = storedValueOf(storedUser(), name);
|
|
11227
|
+
if (!verified || !(0, __thunderid_browser.isVerifiableAttribute)(props.userSchema, name)) return null;
|
|
11228
|
+
if (typeof stored !== "string" || stored.trim() === "") return null;
|
|
11229
|
+
return verified[name] ? "verified" : "unverified";
|
|
11230
|
+
};
|
|
11231
|
+
const verificationRenderProps = () => {
|
|
11232
|
+
const canVerify = (name) => Boolean(props.editable) && !!slots["verification"] && verificationStatusOf(name) === "unverified";
|
|
11233
|
+
return {
|
|
11234
|
+
canVerify,
|
|
11235
|
+
cancelVerification: () => {
|
|
11236
|
+
verifyingField.value = null;
|
|
11237
|
+
},
|
|
11238
|
+
renderVerification: () => {
|
|
11239
|
+
const name = verifyingField.value;
|
|
11240
|
+
if (!name) return null;
|
|
11241
|
+
return buildVerificationPanel({
|
|
11242
|
+
displayName: props.userSchema?.[name]?.displayName,
|
|
11243
|
+
name
|
|
11244
|
+
});
|
|
11245
|
+
},
|
|
11246
|
+
verificationStatus: verificationStatusOf,
|
|
11247
|
+
verifiedAttributes: reportedVerifiedAttributes(),
|
|
11248
|
+
verify: (name) => {
|
|
11249
|
+
if (canVerify(name)) openVerification(name);
|
|
11250
|
+
},
|
|
11251
|
+
verifyingAttribute: verifyingField.value
|
|
11252
|
+
};
|
|
11253
|
+
};
|
|
11254
|
+
function buildVerificationPanel(schema) {
|
|
11255
|
+
const name = schema.name;
|
|
11256
|
+
if (!slots["verification"] || !name || verifyingField.value !== name) return null;
|
|
11257
|
+
const attributeDisplayName = schema.displayName ?? (0, __thunderid_browser.startCase)(name);
|
|
11258
|
+
return (0, vue.h)("div", { class: [px("user-profile__verification"), props.compact ? px("user-profile__verification--inline") : ""].filter(Boolean).join(" ") }, slots["verification"]({
|
|
11259
|
+
attribute: name,
|
|
11260
|
+
attributeDisplayName,
|
|
11261
|
+
onCancel: () => {
|
|
11262
|
+
verifyingField.value = null;
|
|
11263
|
+
},
|
|
11264
|
+
onComplete: () => {
|
|
11265
|
+
verifyingField.value = null;
|
|
11266
|
+
verifiedNotice.value = attributeDisplayName;
|
|
11267
|
+
}
|
|
11268
|
+
}));
|
|
11269
|
+
}
|
|
11270
|
+
function handleDialogKeydown(event) {
|
|
11271
|
+
if (event.key === "Escape") {
|
|
11272
|
+
event.stopPropagation();
|
|
11273
|
+
verifyingField.value = null;
|
|
11274
|
+
return;
|
|
11275
|
+
}
|
|
11276
|
+
if (event.key !== "Tab" || !verificationDialogRef.value) return;
|
|
11277
|
+
const focusables = Array.from(verificationDialogRef.value.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])"));
|
|
11278
|
+
if (focusables.length === 0) return;
|
|
11279
|
+
const first = focusables[0];
|
|
11280
|
+
const last = focusables[focusables.length - 1];
|
|
11281
|
+
if (event.shiftKey && (document.activeElement === first || document.activeElement === verificationDialogRef.value)) {
|
|
11282
|
+
event.preventDefault();
|
|
11283
|
+
last.focus();
|
|
11284
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
11285
|
+
event.preventDefault();
|
|
11286
|
+
first.focus();
|
|
11287
|
+
}
|
|
11288
|
+
}
|
|
11289
|
+
function renderVerificationPanel(schema) {
|
|
11290
|
+
const panel = buildVerificationPanel(schema);
|
|
11291
|
+
if (!panel || props.compact) return panel;
|
|
11292
|
+
return (0, vue.h)(vue.Teleport, { to: "body" }, [(0, vue.h)("div", {
|
|
11293
|
+
class: px("user-profile__verification-overlay"),
|
|
11294
|
+
onClick: (event) => {
|
|
11295
|
+
if (event.target === event.currentTarget) verifyingField.value = null;
|
|
11296
|
+
}
|
|
11297
|
+
}, [(0, vue.h)("div", {
|
|
11298
|
+
"aria-label": tp("user.verification.heading", { attribute: schema.displayName ?? (0, __thunderid_browser.startCase)(schema.name) }),
|
|
11299
|
+
"aria-modal": "true",
|
|
11300
|
+
class: px("user-profile__verification-dialog"),
|
|
11301
|
+
onKeydown: handleDialogKeydown,
|
|
11302
|
+
ref: verificationDialogRef,
|
|
11303
|
+
role: "dialog",
|
|
11304
|
+
tabindex: -1
|
|
11305
|
+
}, [panel])])]);
|
|
10960
11306
|
}
|
|
10961
11307
|
function renderInput(schema) {
|
|
10962
11308
|
const fieldName = schema.name ?? "";
|
|
@@ -11005,6 +11351,9 @@ const BaseUserProfile = (0, vue.defineComponent)({
|
|
|
11005
11351
|
const isEditing = Boolean(editingFields.value[name]);
|
|
11006
11352
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
11007
11353
|
if (!hasValue && !isEditing && !(isEditable && mutability === "READ_WRITE")) return null;
|
|
11354
|
+
const verified = reportedVerifiedAttributes();
|
|
11355
|
+
const showsVerificationStatus = verified !== void 0 && hasValue && !isEditing && isVerificationType(schema.type);
|
|
11356
|
+
const canVerify = Boolean(props.editable) && !!slots["verification"] && showsVerificationStatus && !verified?.[name] && verifyingField.value !== name && (0, __thunderid_browser.isVerifiableAttribute)(props.userSchema, name) && typeof value === "string";
|
|
11008
11357
|
const editablePlaceholder = isEditable ? (0, vue.h)("span", {
|
|
11009
11358
|
class: px("user-profile__field-placeholder"),
|
|
11010
11359
|
onClick: () => startEditing(name, value)
|
|
@@ -11013,25 +11362,44 @@ const BaseUserProfile = (0, vue.defineComponent)({
|
|
|
11013
11362
|
return (0, vue.h)("div", {
|
|
11014
11363
|
class: px("user-profile__field"),
|
|
11015
11364
|
key: name
|
|
11016
|
-
}, [
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11365
|
+
}, [
|
|
11366
|
+
(0, vue.h)("div", { class: px("user-profile__field-inner") }, [
|
|
11367
|
+
(0, vue.h)("span", { class: px("user-profile__field-label") }, label),
|
|
11368
|
+
isEditing ? (0, vue.h)("div", { class: px("user-profile__field-edit") }, [renderInput(schema), fieldErrors.value[name] ? (0, vue.h)("div", { class: px("user-profile__field-error") }, fieldErrors.value[name]) : null]) : displayValueNode,
|
|
11369
|
+
showsVerificationStatus ? renderVerificationStatus(name) : null
|
|
11370
|
+
]),
|
|
11371
|
+
canVerify ? (0, vue.h)("div", { class: px("user-profile__field-actions") }, [(0, vue.h)(Button_default, {
|
|
11372
|
+
class: px("user-profile__verify-button"),
|
|
11373
|
+
color: "primary",
|
|
11374
|
+
"data-testid": `thunderid-verify-${name}`,
|
|
11375
|
+
onClick: () => openVerification(name),
|
|
11376
|
+
size: "small",
|
|
11377
|
+
variant: "outline"
|
|
11378
|
+
}, () => tp("user.verification.buttons.verify.text"))]) : null,
|
|
11379
|
+
isEditable && !isReadonly ? (0, vue.h)("div", { class: px("user-profile__field-actions") }, [isEditing ? [(0, vue.h)(Button_default, {
|
|
11380
|
+
color: "primary",
|
|
11381
|
+
onClick: () => saveField(schema),
|
|
11382
|
+
size: "small",
|
|
11383
|
+
variant: "solid"
|
|
11384
|
+
}, () => t("userProfile.actions.save", "Save")), (0, vue.h)(Button_default, {
|
|
11385
|
+
color: "secondary",
|
|
11386
|
+
onClick: () => cancelEditing(name),
|
|
11387
|
+
size: "small",
|
|
11388
|
+
variant: "solid"
|
|
11389
|
+
}, () => t("userProfile.actions.cancel", "Cancel"))] : hasValue ? (0, vue.h)(Button_default, {
|
|
11390
|
+
class: px("user-profile__field-edit-btn"),
|
|
11391
|
+
color: "secondary",
|
|
11392
|
+
onClick: () => {
|
|
11393
|
+
if (verifyingField.value === name) verifyingField.value = null;
|
|
11394
|
+
verifiedNotice.value = null;
|
|
11395
|
+
startEditing(name, value);
|
|
11396
|
+
},
|
|
11397
|
+
size: "small",
|
|
11398
|
+
startIcon: (0, vue.h)(PencilIcon),
|
|
11399
|
+
title: t("userProfile.actions.edit", "Edit"),
|
|
11400
|
+
variant: "ghost"
|
|
11401
|
+
}) : null]) : null
|
|
11402
|
+
]);
|
|
11035
11403
|
}
|
|
11036
11404
|
function renderProfileWithoutSchemas() {
|
|
11037
11405
|
const data = props.flattenedProfile || props.profile;
|
|
@@ -11065,12 +11433,14 @@ const BaseUserProfile = (0, vue.defineComponent)({
|
|
|
11065
11433
|
if (!data && !props.isLoading) return slots["default"] ? slots["default"]({
|
|
11066
11434
|
error: props.error,
|
|
11067
11435
|
isLoading: props.isLoading,
|
|
11068
|
-
profile: null
|
|
11436
|
+
profile: null,
|
|
11437
|
+
...verificationRenderProps()
|
|
11069
11438
|
}) : null;
|
|
11070
11439
|
if (slots["default"]) return slots["default"]({
|
|
11071
11440
|
error: props.error,
|
|
11072
11441
|
isLoading: props.isLoading,
|
|
11073
|
-
profile: data
|
|
11442
|
+
profile: data,
|
|
11443
|
+
...verificationRenderProps()
|
|
11074
11444
|
});
|
|
11075
11445
|
const currentUser = data;
|
|
11076
11446
|
const schemas = props.schemas ?? [];
|
|
@@ -11086,6 +11456,14 @@ const BaseUserProfile = (0, vue.defineComponent)({
|
|
|
11086
11456
|
class: px("user-profile__error"),
|
|
11087
11457
|
severity: "error"
|
|
11088
11458
|
}, () => props.error));
|
|
11459
|
+
if (verifiedNotice.value) {
|
|
11460
|
+
const attribute = verifiedNotice.value;
|
|
11461
|
+
children.push((0, vue.h)(Alert_default, {
|
|
11462
|
+
class: px("user-profile__verification-notice"),
|
|
11463
|
+
"data-testid": "thunderid-verification-notice",
|
|
11464
|
+
severity: "success"
|
|
11465
|
+
}, () => tp("user.verification.success", { attribute })));
|
|
11466
|
+
}
|
|
11089
11467
|
if (props.isLoading) children.push((0, vue.h)("div", { class: px("user-profile__loading") }, [(0, vue.h)(Spinner_default)]));
|
|
11090
11468
|
else if (props.userSchema && typeof props.userSchema === "object" && Object.keys(props.userSchema).length > 0) {
|
|
11091
11469
|
const fieldRows = Object.entries(props.userSchema).filter(([key, metaAttr]) => {
|
|
@@ -11103,7 +11481,11 @@ const BaseUserProfile = (0, vue.defineComponent)({
|
|
|
11103
11481
|
type: (metaAttr.type ?? "STRING").toUpperCase(),
|
|
11104
11482
|
value: val
|
|
11105
11483
|
};
|
|
11106
|
-
}).map((schema) =>
|
|
11484
|
+
}).map((schema) => {
|
|
11485
|
+
const row = renderSchemaFieldRow(schema);
|
|
11486
|
+
const panel = row ? renderVerificationPanel(schema) : null;
|
|
11487
|
+
return panel ? (0, vue.h)(vue.Fragment, { key: schema.name }, [row, panel]) : row;
|
|
11488
|
+
}).filter((node) => node !== null);
|
|
11107
11489
|
children.push((0, vue.h)("div", { class: px("user-profile__fields") }, fieldRows));
|
|
11108
11490
|
} else if (hasSchemas) {
|
|
11109
11491
|
const fieldRows = schemas.filter((s) => s.name && shouldShowField(s.name)).sort((a, b) => {
|
|
@@ -11154,54 +11536,580 @@ const updateMeProfile = async ({ fetcher, instanceId = 0,...requestConfig }) =>
|
|
|
11154
11536
|
var updateMeProfile_default = updateMeProfile;
|
|
11155
11537
|
|
|
11156
11538
|
//#endregion
|
|
11157
|
-
//#region src/components/
|
|
11158
|
-
|
|
11159
|
-
|
|
11539
|
+
//#region src/components/admin/shared/useAdminTranslation.ts
|
|
11540
|
+
/**
|
|
11541
|
+
* Returns a translation function that honors component-level `preferences.i18n.bundles` over the
|
|
11542
|
+
* provider's bundles, falling back to the configured fallback language and then to the provider.
|
|
11543
|
+
* Reactive when called from a render function, since it reads the current language.
|
|
11544
|
+
*
|
|
11545
|
+
* @param getPreferences - Getter for the component's `preferences` prop.
|
|
11546
|
+
* @returns The translation function.
|
|
11547
|
+
*/
|
|
11548
|
+
const useAdminTranslation = (getPreferences) => {
|
|
11549
|
+
const i18n = useI18n_default();
|
|
11550
|
+
return (key, params) => {
|
|
11551
|
+
const bundles = getPreferences()?.i18n?.bundles;
|
|
11552
|
+
if (bundles) {
|
|
11553
|
+
const lookup = (language) => {
|
|
11554
|
+
const bundle = bundles[language];
|
|
11555
|
+
if (!bundle) return;
|
|
11556
|
+
return (0, __thunderid_browser.normalizeTranslations)(bundle.translations)[key];
|
|
11557
|
+
};
|
|
11558
|
+
const translation = lookup(i18n.currentLanguage.value) ?? lookup(i18n.fallbackLanguage);
|
|
11559
|
+
if (translation) return (0, __thunderid_browser.substituteTranslationParams)(translation, params);
|
|
11560
|
+
}
|
|
11561
|
+
return i18n.t(key, params);
|
|
11562
|
+
};
|
|
11563
|
+
};
|
|
11564
|
+
var useAdminTranslation_default = useAdminTranslation;
|
|
11565
|
+
|
|
11566
|
+
//#endregion
|
|
11567
|
+
//#region src/components/account/verify-attribute/BaseVerifyAttribute.ts
|
|
11568
|
+
const collectFlowIds = ({ actions, inputs }) => ({
|
|
11569
|
+
actions: new Set(actions.map((component) => component.id)),
|
|
11570
|
+
fields: new Set(inputs.map((component) => component.ref ?? component.id))
|
|
11571
|
+
});
|
|
11572
|
+
const withFlowTestIds = (node, ids) => {
|
|
11573
|
+
const name = node.props?.["name"];
|
|
11574
|
+
let testId;
|
|
11575
|
+
if (typeof name === "string" && ids.fields.has(name)) testId = `thunderid-field-${name}`;
|
|
11576
|
+
else if (node.key !== null && ids.actions.has(String(node.key))) testId = `thunderid-action-${String(node.key)}`;
|
|
11577
|
+
const children = Array.isArray(node.children) ? node.children.map((child) => (0, vue.isVNode)(child) ? withFlowTestIds(child, ids) : child) : node.children;
|
|
11578
|
+
if (!testId && children === node.children) return node;
|
|
11579
|
+
const tagged = (0, vue.cloneVNode)(node, testId ? { "data-testid": testId } : null);
|
|
11580
|
+
tagged.children = children;
|
|
11581
|
+
return tagged;
|
|
11582
|
+
};
|
|
11583
|
+
/**
|
|
11584
|
+
* BaseVerifyAttribute renders the server-described steps of a self attribute verification flow.
|
|
11585
|
+
* It takes the flow calls as props, so it stays independent of how the request reaches the server.
|
|
11586
|
+
*
|
|
11587
|
+
* It starts the flow once per mount, since starting one sends a message, and never retries a start
|
|
11588
|
+
* that failed.
|
|
11589
|
+
*/
|
|
11590
|
+
const BaseVerifyAttribute = (0, vue.defineComponent)({
|
|
11591
|
+
name: "BaseVerifyAttribute",
|
|
11160
11592
|
props: {
|
|
11161
|
-
|
|
11162
|
-
default: "
|
|
11593
|
+
attributeDisplayName: {
|
|
11594
|
+
default: "",
|
|
11163
11595
|
type: String
|
|
11164
11596
|
},
|
|
11165
|
-
|
|
11166
|
-
default:
|
|
11167
|
-
type: Boolean
|
|
11168
|
-
},
|
|
11169
|
-
cardVariant: {
|
|
11170
|
-
default: "elevated",
|
|
11597
|
+
buttonClassName: {
|
|
11598
|
+
default: "",
|
|
11171
11599
|
type: String
|
|
11172
11600
|
},
|
|
11173
11601
|
className: {
|
|
11174
11602
|
default: "",
|
|
11175
11603
|
type: String
|
|
11176
11604
|
},
|
|
11177
|
-
|
|
11178
|
-
default:
|
|
11179
|
-
type:
|
|
11605
|
+
inputClassName: {
|
|
11606
|
+
default: "",
|
|
11607
|
+
type: String
|
|
11180
11608
|
},
|
|
11181
|
-
|
|
11609
|
+
isInitialized: {
|
|
11182
11610
|
default: true,
|
|
11183
11611
|
type: Boolean
|
|
11184
11612
|
},
|
|
11185
|
-
|
|
11186
|
-
default:
|
|
11187
|
-
type:
|
|
11613
|
+
onCancel: {
|
|
11614
|
+
default: void 0,
|
|
11615
|
+
type: Function
|
|
11188
11616
|
},
|
|
11189
|
-
|
|
11617
|
+
onComplete: {
|
|
11190
11618
|
default: void 0,
|
|
11191
|
-
type:
|
|
11619
|
+
type: Function
|
|
11192
11620
|
},
|
|
11193
|
-
|
|
11194
|
-
default:
|
|
11195
|
-
type:
|
|
11621
|
+
onDone: {
|
|
11622
|
+
default: void 0,
|
|
11623
|
+
type: Function
|
|
11196
11624
|
},
|
|
11197
|
-
|
|
11198
|
-
default:
|
|
11199
|
-
type:
|
|
11625
|
+
onError: {
|
|
11626
|
+
default: void 0,
|
|
11627
|
+
type: Function
|
|
11200
11628
|
},
|
|
11201
|
-
|
|
11202
|
-
default:
|
|
11203
|
-
type:
|
|
11204
|
-
}
|
|
11629
|
+
onFlowChange: {
|
|
11630
|
+
default: void 0,
|
|
11631
|
+
type: Function
|
|
11632
|
+
},
|
|
11633
|
+
onInitialize: {
|
|
11634
|
+
default: void 0,
|
|
11635
|
+
type: Function
|
|
11636
|
+
},
|
|
11637
|
+
onSubmit: {
|
|
11638
|
+
default: void 0,
|
|
11639
|
+
type: Function
|
|
11640
|
+
},
|
|
11641
|
+
preferences: {
|
|
11642
|
+
default: void 0,
|
|
11643
|
+
type: Object
|
|
11644
|
+
},
|
|
11645
|
+
showSubtitle: {
|
|
11646
|
+
default: true,
|
|
11647
|
+
type: Boolean
|
|
11648
|
+
},
|
|
11649
|
+
showTitle: {
|
|
11650
|
+
default: true,
|
|
11651
|
+
type: Boolean
|
|
11652
|
+
},
|
|
11653
|
+
size: {
|
|
11654
|
+
default: "medium",
|
|
11655
|
+
type: String
|
|
11656
|
+
},
|
|
11657
|
+
variant: {
|
|
11658
|
+
default: "outlined",
|
|
11659
|
+
type: String
|
|
11660
|
+
}
|
|
11661
|
+
},
|
|
11662
|
+
setup(props, { slots }) {
|
|
11663
|
+
const { meta: flowMetaRef } = useFlowMeta_default();
|
|
11664
|
+
const t = useAdminTranslation_default(() => props.preferences);
|
|
11665
|
+
const state = (0, vue.ref)("loading");
|
|
11666
|
+
const isSubmitting = (0, vue.ref)(false);
|
|
11667
|
+
const currentFlow = (0, vue.ref)(null);
|
|
11668
|
+
const error = (0, vue.ref)(null);
|
|
11669
|
+
const formValues = (0, vue.ref)({});
|
|
11670
|
+
const touchedFields = (0, vue.ref)({});
|
|
11671
|
+
const formErrors = (0, vue.ref)({});
|
|
11672
|
+
const isFormValid = (0, vue.ref)(true);
|
|
11673
|
+
let initializationAttempted = false;
|
|
11674
|
+
let challengeToken = null;
|
|
11675
|
+
const meta = () => flowMetaRef?.value ?? null;
|
|
11676
|
+
const labelParams = () => ({ attribute: props.attributeDisplayName ?? "" });
|
|
11677
|
+
const normalize = (response) => {
|
|
11678
|
+
if (!response?.data || Array.isArray(response.data.components)) return response;
|
|
11679
|
+
const { components } = normalizeFlowResponse(response, t, {
|
|
11680
|
+
defaultErrorKey: "user.verification.error",
|
|
11681
|
+
resolveTranslations: false,
|
|
11682
|
+
throwOnError: false
|
|
11683
|
+
}, meta());
|
|
11684
|
+
return {
|
|
11685
|
+
...response,
|
|
11686
|
+
data: {
|
|
11687
|
+
...response.data,
|
|
11688
|
+
components
|
|
11689
|
+
}
|
|
11690
|
+
};
|
|
11691
|
+
};
|
|
11692
|
+
const inputs = () => (0, __thunderid_browser.getFlowStepComponents)(currentFlow.value?.data?.components ?? []).inputs;
|
|
11693
|
+
const validate = () => {
|
|
11694
|
+
const errors = {};
|
|
11695
|
+
const touched = {};
|
|
11696
|
+
inputs().forEach((component) => {
|
|
11697
|
+
const name = component.ref ?? component.id;
|
|
11698
|
+
const value = formValues.value[name] ?? "";
|
|
11699
|
+
const ruleValidator = (0, __thunderid_browser.buildValidatorFromRules)(component.validation);
|
|
11700
|
+
touched[name] = true;
|
|
11701
|
+
if (component.required && value.trim() === "") errors[name] = t("validations.required.field.error");
|
|
11702
|
+
else if (ruleValidator && value) {
|
|
11703
|
+
const ruleMessage = ruleValidator(value);
|
|
11704
|
+
if (ruleMessage) errors[name] = t(ruleMessage);
|
|
11705
|
+
}
|
|
11706
|
+
});
|
|
11707
|
+
touchedFields.value = touched;
|
|
11708
|
+
formErrors.value = errors;
|
|
11709
|
+
isFormValid.value = Object.keys(errors).length === 0;
|
|
11710
|
+
return isFormValid.value;
|
|
11711
|
+
};
|
|
11712
|
+
const resetForm = () => {
|
|
11713
|
+
formValues.value = {};
|
|
11714
|
+
touchedFields.value = {};
|
|
11715
|
+
isFormValid.value = true;
|
|
11716
|
+
const errors = {};
|
|
11717
|
+
const touched = {};
|
|
11718
|
+
(currentFlow.value?.data?.fieldErrors ?? []).forEach((fieldError) => {
|
|
11719
|
+
if (!(fieldError.identifier in errors)) {
|
|
11720
|
+
errors[fieldError.identifier] = fieldError.message;
|
|
11721
|
+
touched[fieldError.identifier] = true;
|
|
11722
|
+
}
|
|
11723
|
+
});
|
|
11724
|
+
formErrors.value = errors;
|
|
11725
|
+
touchedFields.value = touched;
|
|
11726
|
+
};
|
|
11727
|
+
const handleResponse = (rawResponse) => {
|
|
11728
|
+
const response = normalize(rawResponse);
|
|
11729
|
+
props.onFlowChange?.(response);
|
|
11730
|
+
if (response.challengeToken !== void 0) challengeToken = response.challengeToken ?? null;
|
|
11731
|
+
if (response.flowStatus === __thunderid_browser.EmbeddedSelfFlowStatus.Error) {
|
|
11732
|
+
const message = extractErrorMessage(response, t, "user.verification.error");
|
|
11733
|
+
error.value = message;
|
|
11734
|
+
state.value = "failed";
|
|
11735
|
+
props.onError?.(new Error(message));
|
|
11736
|
+
return;
|
|
11737
|
+
}
|
|
11738
|
+
if (response.flowStatus === __thunderid_browser.EmbeddedSelfFlowStatus.Complete) {
|
|
11739
|
+
error.value = null;
|
|
11740
|
+
state.value = "complete";
|
|
11741
|
+
props.onComplete?.(response);
|
|
11742
|
+
return;
|
|
11743
|
+
}
|
|
11744
|
+
const previous = currentFlow.value;
|
|
11745
|
+
currentFlow.value = response.data?.additionalData || !previous?.data?.additionalData ? response : {
|
|
11746
|
+
...response,
|
|
11747
|
+
data: {
|
|
11748
|
+
...response.data,
|
|
11749
|
+
additionalData: previous.data.additionalData
|
|
11750
|
+
}
|
|
11751
|
+
};
|
|
11752
|
+
resetForm();
|
|
11753
|
+
error.value = response.error ? extractErrorMessage(response, t, "user.verification.error") : null;
|
|
11754
|
+
state.value = "active";
|
|
11755
|
+
};
|
|
11756
|
+
const handleFailure = (caughtError) => {
|
|
11757
|
+
error.value = t("user.verification.error");
|
|
11758
|
+
state.value = "failed";
|
|
11759
|
+
props.onError?.(caughtError instanceof Error ? caughtError : new Error(String(caughtError)));
|
|
11760
|
+
};
|
|
11761
|
+
(0, vue.watch)(() => props.isInitialized, (initialized) => {
|
|
11762
|
+
if (!initialized || initializationAttempted) return;
|
|
11763
|
+
initializationAttempted = true;
|
|
11764
|
+
(async () => {
|
|
11765
|
+
try {
|
|
11766
|
+
const response = await props.onInitialize?.();
|
|
11767
|
+
if (response) handleResponse(response);
|
|
11768
|
+
} catch (caughtError) {
|
|
11769
|
+
handleFailure(caughtError);
|
|
11770
|
+
}
|
|
11771
|
+
})();
|
|
11772
|
+
}, { immediate: true });
|
|
11773
|
+
const handleInputChange = (name, value) => {
|
|
11774
|
+
formValues.value = {
|
|
11775
|
+
...formValues.value,
|
|
11776
|
+
[name]: value
|
|
11777
|
+
};
|
|
11778
|
+
if (!isFormValid.value) validate();
|
|
11779
|
+
};
|
|
11780
|
+
const handleInputBlur = (name) => {
|
|
11781
|
+
touchedFields.value = {
|
|
11782
|
+
...touchedFields.value,
|
|
11783
|
+
[name]: true
|
|
11784
|
+
};
|
|
11785
|
+
};
|
|
11786
|
+
const handleSubmit = async (component, data, skipValidation) => {
|
|
11787
|
+
if (!currentFlow.value || isSubmitting.value) return;
|
|
11788
|
+
if (!skipValidation && !validate()) return;
|
|
11789
|
+
isSubmitting.value = true;
|
|
11790
|
+
error.value = null;
|
|
11791
|
+
try {
|
|
11792
|
+
const stepInputs = Object.fromEntries(Object.entries(data ?? {}).filter(([, value]) => value !== null && value !== void 0 && value !== ""));
|
|
11793
|
+
const response = await props.onSubmit?.({
|
|
11794
|
+
executionId: currentFlow.value.executionId,
|
|
11795
|
+
...component.id && { action: component.id },
|
|
11796
|
+
...challengeToken ? { challengeToken } : {},
|
|
11797
|
+
inputs: stepInputs
|
|
11798
|
+
});
|
|
11799
|
+
if (response) handleResponse(response);
|
|
11800
|
+
} catch (caughtError) {
|
|
11801
|
+
handleFailure(caughtError);
|
|
11802
|
+
} finally {
|
|
11803
|
+
isSubmitting.value = false;
|
|
11804
|
+
}
|
|
11805
|
+
};
|
|
11806
|
+
return () => {
|
|
11807
|
+
const additionalData = currentFlow.value?.data?.additionalData ?? {};
|
|
11808
|
+
const maskedDestination = additionalData[__thunderid_browser.AttributeVerificationConstants.MASKED_DESTINATION_KEY];
|
|
11809
|
+
const destination = typeof maskedDestination === "string" && maskedDestination ? maskedDestination : null;
|
|
11810
|
+
const headings = getAuthComponentHeadings_default(currentFlow.value?.data?.components ?? [], void 0, void 0, t("user.verification.heading", labelParams()), t("user.verification.subheading.generic"));
|
|
11811
|
+
const { componentsWithoutHeadings } = headings;
|
|
11812
|
+
const step = (0, __thunderid_browser.getFlowStepComponents)(componentsWithoutHeadings);
|
|
11813
|
+
const flowIds = collectFlowIds(step);
|
|
11814
|
+
const isAwaitingLink = state.value === "active" && inputs().length === 0 && step.actions.length === 0;
|
|
11815
|
+
const title = (0, __thunderid_browser.resolveFlowTemplateLiterals)(headings.title, {
|
|
11816
|
+
meta: meta(),
|
|
11817
|
+
t
|
|
11818
|
+
});
|
|
11819
|
+
let subtitle = (0, __thunderid_browser.resolveFlowTemplateLiterals)(headings.subtitle, {
|
|
11820
|
+
meta: meta(),
|
|
11821
|
+
t
|
|
11822
|
+
});
|
|
11823
|
+
let destinationText = null;
|
|
11824
|
+
if (destination && headings.headingComponents.subheading) destinationText = t("user.verification.destination", { destination });
|
|
11825
|
+
else if (destination) subtitle = t(isAwaitingLink ? "user.verification.subheading.link" : "user.verification.subheading", { destination });
|
|
11826
|
+
const isLoading = state.value === "loading" || isSubmitting.value;
|
|
11827
|
+
const px = __thunderid_browser.withVendorCSSClassPrefix;
|
|
11828
|
+
const containerClass = [
|
|
11829
|
+
px("verify-attribute"),
|
|
11830
|
+
px(`verify-attribute--${props.size}`),
|
|
11831
|
+
px(`verify-attribute--${props.variant}`),
|
|
11832
|
+
props.className
|
|
11833
|
+
].filter(Boolean).join(" ");
|
|
11834
|
+
if (slots["default"]) {
|
|
11835
|
+
const resend = state.value === "active" ? step.resend : void 0;
|
|
11836
|
+
const renderProps = {
|
|
11837
|
+
additionalData,
|
|
11838
|
+
components: componentsWithoutHeadings,
|
|
11839
|
+
destination,
|
|
11840
|
+
destinationText,
|
|
11841
|
+
error: error.value,
|
|
11842
|
+
fieldErrors: formErrors.value,
|
|
11843
|
+
handleInputChange,
|
|
11844
|
+
handleResend: resend ? () => handleSubmit(resend, void 0, true) : void 0,
|
|
11845
|
+
handleSubmit,
|
|
11846
|
+
isAwaitingLink,
|
|
11847
|
+
isComplete: state.value === "complete",
|
|
11848
|
+
isFailed: state.value === "failed",
|
|
11849
|
+
isLoading,
|
|
11850
|
+
isValid: isFormValid.value,
|
|
11851
|
+
onCancel: props.onCancel,
|
|
11852
|
+
onDone: isAwaitingLink ? props.onDone : void 0,
|
|
11853
|
+
subtitle,
|
|
11854
|
+
successMessage: t("user.verification.success", labelParams()),
|
|
11855
|
+
title,
|
|
11856
|
+
touched: touchedFields.value,
|
|
11857
|
+
values: formValues.value
|
|
11858
|
+
};
|
|
11859
|
+
return (0, vue.h)("div", { class: containerClass }, slots["default"](renderProps));
|
|
11860
|
+
}
|
|
11861
|
+
const showDone = isAwaitingLink && !!props.onDone;
|
|
11862
|
+
return (0, vue.h)("div", {
|
|
11863
|
+
"aria-busy": isLoading,
|
|
11864
|
+
class: containerClass
|
|
11865
|
+
}, [
|
|
11866
|
+
state.value === "active" && (props.showTitle || props.showSubtitle) ? (0, vue.h)("div", { class: px("verify-attribute__header") }, [props.showTitle ? (0, vue.h)(Typography_default, {
|
|
11867
|
+
class: px("verify-attribute__heading"),
|
|
11868
|
+
variant: "h5"
|
|
11869
|
+
}, () => title) : null, props.showSubtitle ? (0, vue.h)(Typography_default, {
|
|
11870
|
+
class: px("verify-attribute__subheading"),
|
|
11871
|
+
variant: "body2"
|
|
11872
|
+
}, () => [subtitle, destinationText ? (0, vue.h)("span", { class: px("verify-attribute__destination") }, ` ${destinationText}`) : null]) : null]) : null,
|
|
11873
|
+
state.value === "loading" ? (0, vue.h)("div", { class: px("verify-attribute__loading") }, [(0, vue.h)(Spinner_default)]) : null,
|
|
11874
|
+
error.value ? (0, vue.h)(Alert_default, {
|
|
11875
|
+
class: px("verify-attribute__alert"),
|
|
11876
|
+
severity: "error"
|
|
11877
|
+
}, () => error.value) : null,
|
|
11878
|
+
state.value === "complete" ? (0, vue.h)(Alert_default, {
|
|
11879
|
+
class: px("verify-attribute__alert"),
|
|
11880
|
+
severity: "success"
|
|
11881
|
+
}, () => t("user.verification.success", labelParams())) : null,
|
|
11882
|
+
state.value === "active" ? (0, vue.h)("div", { class: px("verify-attribute__content") }, renderVerificationComponents(componentsWithoutHeadings, formValues.value, touchedFields.value, formErrors.value, isLoading, isFormValid.value, resetForm, handleInputChange, {
|
|
11883
|
+
additionalData,
|
|
11884
|
+
buttonClassName: [px("verify-attribute__button"), props.buttonClassName].filter(Boolean).join(" "),
|
|
11885
|
+
inputClassName: [px("verify-attribute__input"), props.inputClassName].filter(Boolean).join(" "),
|
|
11886
|
+
meta: meta(),
|
|
11887
|
+
onInputBlur: handleInputBlur,
|
|
11888
|
+
onSubmit: (component, data, skip) => {
|
|
11889
|
+
handleSubmit(component, data, skip);
|
|
11890
|
+
},
|
|
11891
|
+
size: props.size,
|
|
11892
|
+
t,
|
|
11893
|
+
variant: props.variant
|
|
11894
|
+
}).map((node) => withFlowTestIds(node, flowIds))) : null,
|
|
11895
|
+
props.onCancel || showDone ? (0, vue.h)("div", { class: px("verify-attribute__actions") }, [showDone ? (0, vue.h)(Button_default, {
|
|
11896
|
+
color: "primary",
|
|
11897
|
+
"data-testid": "thunderid-action-verificationDone",
|
|
11898
|
+
onClick: () => props.onDone?.(),
|
|
11899
|
+
size: "small",
|
|
11900
|
+
variant: "solid"
|
|
11901
|
+
}, () => t("user.verification.buttons.done.text")) : null, props.onCancel ? (0, vue.h)(Button_default, {
|
|
11902
|
+
color: "secondary",
|
|
11903
|
+
"data-testid": "thunderid-action-verificationCancel",
|
|
11904
|
+
disabled: isSubmitting.value,
|
|
11905
|
+
onClick: () => props.onCancel?.(),
|
|
11906
|
+
size: "small",
|
|
11907
|
+
variant: "outline"
|
|
11908
|
+
}, () => state.value === "active" || state.value === "loading" ? t("user.verification.buttons.cancel.text") : t("user.verification.buttons.close.text")) : null]) : null
|
|
11909
|
+
]);
|
|
11910
|
+
};
|
|
11911
|
+
}
|
|
11912
|
+
});
|
|
11913
|
+
var BaseVerifyAttribute_default = BaseVerifyAttribute;
|
|
11914
|
+
|
|
11915
|
+
//#endregion
|
|
11916
|
+
//#region src/api/auth/executeEmbeddedSelfFlow.ts
|
|
11917
|
+
/**
|
|
11918
|
+
* Executes one step of a `SELF` flow for the signed-in user, through the authenticated
|
|
11919
|
+
* transport that attaches the access token the flow identifies the user by.
|
|
11920
|
+
*
|
|
11921
|
+
* @param config - Configuration object with URL, payload and optional request config.
|
|
11922
|
+
* @returns A promise that resolves with the flow step.
|
|
11923
|
+
*/
|
|
11924
|
+
const executeEmbeddedSelfFlow = async ({ fetcher, instanceId = 0,...requestConfig }) => (0, __thunderid_browser.executeEmbeddedSelfFlow)({
|
|
11925
|
+
...requestConfig,
|
|
11926
|
+
fetcher: fetcher ?? (0, __thunderid_browser.createHttpClientFetcher)(instanceId)
|
|
11927
|
+
});
|
|
11928
|
+
var executeEmbeddedSelfFlow_default = executeEmbeddedSelfFlow;
|
|
11929
|
+
|
|
11930
|
+
//#endregion
|
|
11931
|
+
//#region src/components/account/verify-attribute/VerifyAttribute.ts
|
|
11932
|
+
const logger$1 = createVueLogger("VerifyAttribute");
|
|
11933
|
+
/**
|
|
11934
|
+
* VerifyAttribute verifies one of the signed-in user's attributes, such as their email address, by
|
|
11935
|
+
* running a self attribute verification flow named by `flowHandle`. The flow picks the email or mobile
|
|
11936
|
+
* path from the attribute's type, sends a code or a link to the attribute's current value, and the
|
|
11937
|
+
* component renders the steps it describes; for a link it shows a Done action. Every request carries
|
|
11938
|
+
* the user's access token. Once the server records the verification, and when the user selects Done,
|
|
11939
|
+
* it re-reads the user's profile so `useUser()` shows the new status.
|
|
11940
|
+
*
|
|
11941
|
+
* It waits for the user schema to load, and refuses an attribute the schema does not declare as an
|
|
11942
|
+
* `email` or `mobile` property, since starting a verification sends a message.
|
|
11943
|
+
*
|
|
11944
|
+
* Mount it with a `key` per attribute: each mount starts a new verification and sends a new code or
|
|
11945
|
+
* link.
|
|
11946
|
+
*
|
|
11947
|
+
* @example
|
|
11948
|
+
* ```vue
|
|
11949
|
+
* <VerifyAttribute attribute="email" @complete="open = false" @cancel="open = false" />
|
|
11950
|
+
* ```
|
|
11951
|
+
*/
|
|
11952
|
+
const VerifyAttribute = (0, vue.defineComponent)({
|
|
11953
|
+
name: "VerifyAttribute",
|
|
11954
|
+
props: {
|
|
11955
|
+
attribute: {
|
|
11956
|
+
required: true,
|
|
11957
|
+
type: String
|
|
11958
|
+
},
|
|
11959
|
+
attributeDisplayName: {
|
|
11960
|
+
default: void 0,
|
|
11961
|
+
type: String
|
|
11962
|
+
},
|
|
11963
|
+
className: {
|
|
11964
|
+
default: "",
|
|
11965
|
+
type: String
|
|
11966
|
+
},
|
|
11967
|
+
flowHandle: {
|
|
11968
|
+
default: __thunderid_browser.AttributeVerificationConstants.DEFAULT_FLOW_HANDLE,
|
|
11969
|
+
type: String
|
|
11970
|
+
},
|
|
11971
|
+
onCancel: {
|
|
11972
|
+
default: void 0,
|
|
11973
|
+
type: Function
|
|
11974
|
+
},
|
|
11975
|
+
onComplete: {
|
|
11976
|
+
default: void 0,
|
|
11977
|
+
type: Function
|
|
11978
|
+
},
|
|
11979
|
+
onDone: {
|
|
11980
|
+
default: void 0,
|
|
11981
|
+
type: Function
|
|
11982
|
+
},
|
|
11983
|
+
onError: {
|
|
11984
|
+
default: void 0,
|
|
11985
|
+
type: Function
|
|
11986
|
+
},
|
|
11987
|
+
preferences: {
|
|
11988
|
+
default: void 0,
|
|
11989
|
+
type: Object
|
|
11990
|
+
},
|
|
11991
|
+
showSubtitle: {
|
|
11992
|
+
default: true,
|
|
11993
|
+
type: Boolean
|
|
11994
|
+
},
|
|
11995
|
+
showTitle: {
|
|
11996
|
+
default: true,
|
|
11997
|
+
type: Boolean
|
|
11998
|
+
},
|
|
11999
|
+
size: {
|
|
12000
|
+
default: "medium",
|
|
12001
|
+
type: String
|
|
12002
|
+
},
|
|
12003
|
+
variant: {
|
|
12004
|
+
default: "outlined",
|
|
12005
|
+
type: String
|
|
12006
|
+
}
|
|
12007
|
+
},
|
|
12008
|
+
setup(props, { slots }) {
|
|
12009
|
+
const { baseUrl, endpoints, instanceId, isInitialized, isLoading } = useThunderID_default();
|
|
12010
|
+
const { revalidateProfile, userSchema } = useUser_default();
|
|
12011
|
+
const flowExecuteUrl = (0, __thunderid_browser.resolveResourceEndpoint)("flowExecute", { endpoints }) ?? `${baseUrl}/flow/execute`;
|
|
12012
|
+
const execute = (payload) => executeEmbeddedSelfFlow_default({
|
|
12013
|
+
baseUrl,
|
|
12014
|
+
instanceId,
|
|
12015
|
+
payload,
|
|
12016
|
+
url: flowExecuteUrl
|
|
12017
|
+
});
|
|
12018
|
+
const handleInitialize = () => {
|
|
12019
|
+
if (!(0, __thunderid_browser.isVerifiableAttribute)(userSchema?.value, props.attribute)) return Promise.reject(new __thunderid_browser.ThunderIDRuntimeError(`Attribute "${props.attribute}" is not a verifiable email or mobile attribute.`, "VerifyAttribute-handleInitialize-RuntimeError-001", "vue", "Only a top-level, single-valued email or mobile attribute of the user schema can be verified."));
|
|
12020
|
+
return execute({
|
|
12021
|
+
flowType: __thunderid_browser.EmbeddedFlowType.Self,
|
|
12022
|
+
handle: props.flowHandle,
|
|
12023
|
+
inputs: { [__thunderid_browser.AttributeVerificationConstants.ATTRIBUTE_INPUT]: props.attribute }
|
|
12024
|
+
});
|
|
12025
|
+
};
|
|
12026
|
+
const refreshProfile = async () => {
|
|
12027
|
+
try {
|
|
12028
|
+
await revalidateProfile?.();
|
|
12029
|
+
} catch (caughtError) {
|
|
12030
|
+
logger$1.warn("Failed to re-read the user profile after verification:", caughtError);
|
|
12031
|
+
}
|
|
12032
|
+
};
|
|
12033
|
+
return () => (0, vue.h)(BaseVerifyAttribute_default, {
|
|
12034
|
+
attributeDisplayName: props.attributeDisplayName ?? userSchema?.value?.[props.attribute]?.displayName ?? (0, __thunderid_browser.startCase)(props.attribute),
|
|
12035
|
+
class: (0, __thunderid_browser.withVendorCSSClassPrefix)("verify-attribute--styled"),
|
|
12036
|
+
className: props.className,
|
|
12037
|
+
isInitialized: isInitialized.value && !isLoading.value && !!userSchema?.value,
|
|
12038
|
+
onCancel: props.onCancel,
|
|
12039
|
+
onComplete: (response) => {
|
|
12040
|
+
refreshProfile();
|
|
12041
|
+
props.onComplete?.(response);
|
|
12042
|
+
},
|
|
12043
|
+
onDone: () => {
|
|
12044
|
+
refreshProfile();
|
|
12045
|
+
props.onDone?.();
|
|
12046
|
+
},
|
|
12047
|
+
onError: props.onError,
|
|
12048
|
+
onInitialize: handleInitialize,
|
|
12049
|
+
onSubmit: execute,
|
|
12050
|
+
preferences: props.preferences,
|
|
12051
|
+
showSubtitle: props.showSubtitle,
|
|
12052
|
+
showTitle: props.showTitle,
|
|
12053
|
+
size: props.size,
|
|
12054
|
+
variant: props.variant
|
|
12055
|
+
}, slots);
|
|
12056
|
+
}
|
|
12057
|
+
});
|
|
12058
|
+
var VerifyAttribute_default = VerifyAttribute;
|
|
12059
|
+
|
|
12060
|
+
//#endregion
|
|
12061
|
+
//#region src/components/account/user-profile/UserProfile.ts
|
|
12062
|
+
const UserProfile = (0, vue.defineComponent)({
|
|
12063
|
+
name: "UserProfile",
|
|
12064
|
+
props: {
|
|
12065
|
+
avatarSize: {
|
|
12066
|
+
default: "lg",
|
|
12067
|
+
type: String
|
|
12068
|
+
},
|
|
12069
|
+
cardLayout: {
|
|
12070
|
+
default: true,
|
|
12071
|
+
type: Boolean
|
|
12072
|
+
},
|
|
12073
|
+
cardVariant: {
|
|
12074
|
+
default: "elevated",
|
|
12075
|
+
type: String
|
|
12076
|
+
},
|
|
12077
|
+
className: {
|
|
12078
|
+
default: "",
|
|
12079
|
+
type: String
|
|
12080
|
+
},
|
|
12081
|
+
compact: {
|
|
12082
|
+
default: false,
|
|
12083
|
+
type: Boolean
|
|
12084
|
+
},
|
|
12085
|
+
editable: {
|
|
12086
|
+
default: true,
|
|
12087
|
+
type: Boolean
|
|
12088
|
+
},
|
|
12089
|
+
hideFields: {
|
|
12090
|
+
default: () => [],
|
|
12091
|
+
type: Array
|
|
12092
|
+
},
|
|
12093
|
+
preferences: {
|
|
12094
|
+
default: void 0,
|
|
12095
|
+
type: Object
|
|
12096
|
+
},
|
|
12097
|
+
showAvatar: {
|
|
12098
|
+
default: true,
|
|
12099
|
+
type: Boolean
|
|
12100
|
+
},
|
|
12101
|
+
showFields: {
|
|
12102
|
+
default: () => [],
|
|
12103
|
+
type: Array
|
|
12104
|
+
},
|
|
12105
|
+
title: {
|
|
12106
|
+
default: "Profile",
|
|
12107
|
+
type: String
|
|
12108
|
+
},
|
|
12109
|
+
verificationFlowHandle: {
|
|
12110
|
+
default: __thunderid_browser.AttributeVerificationConstants.DEFAULT_FLOW_HANDLE,
|
|
12111
|
+
type: String
|
|
12112
|
+
}
|
|
11205
12113
|
},
|
|
11206
12114
|
setup(props, { slots }) {
|
|
11207
12115
|
const { baseUrl, endpoints, instanceId, preferences: contextPreferences } = useThunderID_default();
|
|
@@ -11242,6 +12150,17 @@ const UserProfile = (0, vue.defineComponent)({
|
|
|
11242
12150
|
error.value = message;
|
|
11243
12151
|
}
|
|
11244
12152
|
}
|
|
12153
|
+
const renderVerification = ({ attribute, attributeDisplayName, onCancel, onComplete }) => (0, vue.h)(VerifyAttribute_default, {
|
|
12154
|
+
attribute,
|
|
12155
|
+
attributeDisplayName,
|
|
12156
|
+
flowHandle: props.verificationFlowHandle,
|
|
12157
|
+
key: attribute,
|
|
12158
|
+
onCancel,
|
|
12159
|
+
onComplete,
|
|
12160
|
+
onDone: onCancel,
|
|
12161
|
+
preferences: resolvedPreferences.value,
|
|
12162
|
+
variant: props.compact ? "outlined" : "flat"
|
|
12163
|
+
});
|
|
11245
12164
|
return () => (0, vue.h)(BaseUserProfile_default, {
|
|
11246
12165
|
avatarSize: props.avatarSize,
|
|
11247
12166
|
cardLayout: props.cardLayout,
|
|
@@ -11261,39 +12180,14 @@ const UserProfile = (0, vue.defineComponent)({
|
|
|
11261
12180
|
t,
|
|
11262
12181
|
title: props.title,
|
|
11263
12182
|
userSchema: userSchema?.value
|
|
11264
|
-
},
|
|
12183
|
+
}, isEditableProfile.value ? {
|
|
12184
|
+
verification: renderVerification,
|
|
12185
|
+
...slots
|
|
12186
|
+
} : slots);
|
|
11265
12187
|
}
|
|
11266
12188
|
});
|
|
11267
12189
|
var UserProfile_default = UserProfile;
|
|
11268
12190
|
|
|
11269
|
-
//#endregion
|
|
11270
|
-
//#region src/components/admin/shared/useAdminTranslation.ts
|
|
11271
|
-
/**
|
|
11272
|
-
* Returns a translation function that honors component-level `preferences.i18n.bundles` over the
|
|
11273
|
-
* provider's bundles, falling back to the configured fallback language and then to the provider.
|
|
11274
|
-
* Reactive when called from a render function, since it reads the current language.
|
|
11275
|
-
*
|
|
11276
|
-
* @param getPreferences - Getter for the component's `preferences` prop.
|
|
11277
|
-
* @returns The translation function.
|
|
11278
|
-
*/
|
|
11279
|
-
const useAdminTranslation = (getPreferences) => {
|
|
11280
|
-
const i18n = useI18n_default();
|
|
11281
|
-
return (key, params) => {
|
|
11282
|
-
const bundles = getPreferences()?.i18n?.bundles;
|
|
11283
|
-
if (bundles) {
|
|
11284
|
-
const lookup = (language) => {
|
|
11285
|
-
const bundle = bundles[language];
|
|
11286
|
-
if (!bundle) return;
|
|
11287
|
-
return (0, __thunderid_browser.normalizeTranslations)(bundle.translations)[key];
|
|
11288
|
-
};
|
|
11289
|
-
const translation = lookup(i18n.currentLanguage.value) ?? lookup(i18n.fallbackLanguage);
|
|
11290
|
-
if (translation) return (0, __thunderid_browser.substituteTranslationParams)(translation, params);
|
|
11291
|
-
}
|
|
11292
|
-
return i18n.t(key, params);
|
|
11293
|
-
};
|
|
11294
|
-
};
|
|
11295
|
-
var useAdminTranslation_default = useAdminTranslation;
|
|
11296
|
-
|
|
11297
12191
|
//#endregion
|
|
11298
12192
|
//#region src/components/common/attribution/Attribution.ts
|
|
11299
12193
|
const cls$13 = (suffix) => (0, __thunderid_browser.withVendorCSSClassPrefix)(`attribution${suffix}`);
|
|
@@ -17634,6 +18528,12 @@ Object.defineProperty(exports, 'ApplicationQueryKeys', {
|
|
|
17634
18528
|
}
|
|
17635
18529
|
});
|
|
17636
18530
|
exports.ArrowLeftRightIcon = ArrowLeftRightIcon;
|
|
18531
|
+
Object.defineProperty(exports, 'AttributeVerificationConstants', {
|
|
18532
|
+
enumerable: true,
|
|
18533
|
+
get: function () {
|
|
18534
|
+
return __thunderid_browser.AttributeVerificationConstants;
|
|
18535
|
+
}
|
|
18536
|
+
});
|
|
17637
18537
|
exports.Attribution = Attribution_default;
|
|
17638
18538
|
exports.AuthFlowSelect = AuthFlowSelect_default;
|
|
17639
18539
|
exports.BaseAcceptInvite = BaseAcceptInvite_default;
|
|
@@ -17667,6 +18567,7 @@ exports.BaseUserList = BaseUserList_default;
|
|
|
17667
18567
|
exports.BaseUserProfile = BaseUserProfile_default;
|
|
17668
18568
|
exports.BaseUserSelect = BaseUserSelect_default;
|
|
17669
18569
|
exports.BaseUserTypeSelect = BaseUserTypeSelect_default;
|
|
18570
|
+
exports.BaseVerifyAttribute = BaseVerifyAttribute_default;
|
|
17670
18571
|
exports.BuildingIcon = BuildingIcon;
|
|
17671
18572
|
exports.Button = Button_default;
|
|
17672
18573
|
exports.Callback = Callback_default;
|
|
@@ -17708,6 +18609,12 @@ Object.defineProperty(exports, 'EmbeddedFlowTextVariant', {
|
|
|
17708
18609
|
return __thunderid_browser.EmbeddedFlowTextVariant;
|
|
17709
18610
|
}
|
|
17710
18611
|
});
|
|
18612
|
+
Object.defineProperty(exports, 'EmbeddedSelfFlowStatus', {
|
|
18613
|
+
enumerable: true,
|
|
18614
|
+
get: function () {
|
|
18615
|
+
return __thunderid_browser.EmbeddedSelfFlowStatus;
|
|
18616
|
+
}
|
|
18617
|
+
});
|
|
17711
18618
|
Object.defineProperty(exports, 'EmbeddedSignInFlowStatus', {
|
|
17712
18619
|
enumerable: true,
|
|
17713
18620
|
get: function () {
|
|
@@ -17829,6 +18736,7 @@ Object.defineProperty(exports, 'UserQueryKeys', {
|
|
|
17829
18736
|
});
|
|
17830
18737
|
exports.UserSelect = UserSelect_default;
|
|
17831
18738
|
exports.UserTypeSelect = UserTypeSelect_default;
|
|
18739
|
+
exports.VerifyAttribute = VerifyAttribute_default;
|
|
17832
18740
|
exports.XIcon = XIcon;
|
|
17833
18741
|
Object.defineProperty(exports, 'addGroupMembers', {
|
|
17834
18742
|
enumerable: true,
|
|
@@ -18194,6 +19102,7 @@ Object.defineProperty(exports, 'executeAdministrationFlow', {
|
|
|
18194
19102
|
return __thunderid_browser.executeAdministrationFlow;
|
|
18195
19103
|
}
|
|
18196
19104
|
});
|
|
19105
|
+
exports.executeEmbeddedSelfFlow = executeEmbeddedSelfFlow_default;
|
|
18197
19106
|
Object.defineProperty(exports, 'exportConfiguration', {
|
|
18198
19107
|
enumerable: true,
|
|
18199
19108
|
get: function () {
|
|
@@ -18683,6 +19592,12 @@ Object.defineProperty(exports, 'getVariables', {
|
|
|
18683
19592
|
return __thunderid_browser.getVariables;
|
|
18684
19593
|
}
|
|
18685
19594
|
});
|
|
19595
|
+
Object.defineProperty(exports, 'getVerifiedAttributes', {
|
|
19596
|
+
enumerable: true,
|
|
19597
|
+
get: function () {
|
|
19598
|
+
return __thunderid_browser.getVerifiedAttributes;
|
|
19599
|
+
}
|
|
19600
|
+
});
|
|
18686
19601
|
exports.handlePasskeyAuthentication = handlePasskeyAuthentication;
|
|
18687
19602
|
exports.handlePasskeyRegistration = handlePasskeyRegistration;
|
|
18688
19603
|
Object.defineProperty(exports, 'handleWebAuthnAuthentication', {
|
|
@@ -18716,6 +19631,12 @@ Object.defineProperty(exports, 'importConfiguration', {
|
|
|
18716
19631
|
}
|
|
18717
19632
|
});
|
|
18718
19633
|
exports.initiateOAuthRedirect = initiateOAuthRedirect;
|
|
19634
|
+
Object.defineProperty(exports, 'isVerifiableAttribute', {
|
|
19635
|
+
enumerable: true,
|
|
19636
|
+
get: function () {
|
|
19637
|
+
return __thunderid_browser.isVerifiableAttribute;
|
|
19638
|
+
}
|
|
19639
|
+
});
|
|
18719
19640
|
Object.defineProperty(exports, 'navigate', {
|
|
18720
19641
|
enumerable: true,
|
|
18721
19642
|
get: function () {
|