@thunderid/vue 1.19.0 → 1.20.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/cjs/index.cjs +700 -85
- package/dist/components/account/user-profile/BaseUserProfile.d.ts.map +1 -1
- package/dist/components/account/verify-attribute/BaseVerifyAttribute.d.ts.map +1 -1
- package/dist/components/account/verify-attribute/VerifyAttribute.css.d.ts +1 -1
- package/dist/components/account/verify-attribute/VerifyAttribute.css.d.ts.map +1 -1
- package/dist/components/auth/flow/FlowExpired.css.d.ts +3 -0
- package/dist/components/auth/flow/FlowExpired.css.d.ts.map +1 -0
- package/dist/components/auth/flow/FlowExpired.d.ts +15 -0
- package/dist/components/auth/flow/FlowExpired.d.ts.map +1 -0
- package/dist/components/auth/sign-in/BaseSignIn.d.ts.map +1 -1
- package/dist/components/auth/sign-in/SignIn.d.ts +16 -0
- package/dist/components/auth/sign-in/SignIn.d.ts.map +1 -1
- package/dist/components/auth/sign-up/BaseSignUp.d.ts +21 -0
- package/dist/components/auth/sign-up/BaseSignUp.d.ts.map +1 -1
- package/dist/components/auth/sign-up/SignUp.d.ts.map +1 -1
- package/dist/components/management/UserDetails/BaseUserDetails.d.ts +15 -1
- package/dist/components/management/UserDetails/BaseUserDetails.d.ts.map +1 -1
- package/dist/components/management/UserDetails/UserDetails.d.ts +2 -1
- package/dist/components/management/UserDetails/UserDetails.d.ts.map +1 -1
- package/dist/components/management/shared/Admin.css.d.ts +2 -2
- package/dist/components/management/shared/Admin.css.d.ts.map +1 -1
- package/dist/components/primitives/Icons.d.ts +1 -0
- package/dist/components/primitives/Icons.d.ts.map +1 -1
- package/dist/composables/auth/useFlowExpiry.d.ts +28 -0
- package/dist/composables/auth/useFlowExpiry.d.ts.map +1 -0
- package/dist/composables/auth/useFlowExpiryHandling.d.ts +37 -0
- package/dist/composables/auth/useFlowExpiryHandling.d.ts.map +1 -0
- package/dist/composables/auth/useFlowExpiryRedirect.d.ts +33 -0
- package/dist/composables/auth/useFlowExpiryRedirect.d.ts.map +1 -0
- package/dist/composables/auth/useWhenUserPresent.d.ts +12 -0
- package/dist/composables/auth/useWhenUserPresent.d.ts.map +1 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +694 -87
- package/dist/providers/FlowMetaProvider.d.ts.map +1 -1
- package/dist/providers/ThunderIDProvider.d.ts.map +1 -1
- package/dist/styles/injectStyles.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -86,6 +86,26 @@ const FlowMetaProvider = (0, vue.defineComponent)({
|
|
|
86
86
|
const baseUrl = thunderIDContext?.baseUrl;
|
|
87
87
|
const applicationId = thunderIDContext?.applicationId;
|
|
88
88
|
const flowMetaUrl = (0, __thunderid_browser.resolveResourceEndpoint)("flowMeta", { endpoints: thunderIDContext?.endpoints });
|
|
89
|
+
const loadMeta = async (language) => {
|
|
90
|
+
try {
|
|
91
|
+
if (props.fetchMeta) return await props.fetchMeta({
|
|
92
|
+
applicationId,
|
|
93
|
+
...language ? { language } : {}
|
|
94
|
+
}) ?? null;
|
|
95
|
+
return await (0, __thunderid_browser.getFlowMeta)({
|
|
96
|
+
baseUrl,
|
|
97
|
+
url: flowMetaUrl,
|
|
98
|
+
...applicationId ? {
|
|
99
|
+
id: applicationId,
|
|
100
|
+
type: __thunderid_browser.FlowMetaType.App
|
|
101
|
+
} : {},
|
|
102
|
+
...language ? { language } : {}
|
|
103
|
+
});
|
|
104
|
+
} catch (err) {
|
|
105
|
+
if ((0, __thunderid_browser.isFlowMetaUnavailableError)(err)) return null;
|
|
106
|
+
throw err;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
89
109
|
const fetchFlowMeta = async () => {
|
|
90
110
|
if (!props.enabled) {
|
|
91
111
|
meta.value = null;
|
|
@@ -94,14 +114,7 @@ const FlowMetaProvider = (0, vue.defineComponent)({
|
|
|
94
114
|
isLoading.value = true;
|
|
95
115
|
error.value = null;
|
|
96
116
|
try {
|
|
97
|
-
meta.value =
|
|
98
|
-
baseUrl,
|
|
99
|
-
url: flowMetaUrl,
|
|
100
|
-
...applicationId ? {
|
|
101
|
-
id: applicationId,
|
|
102
|
-
type: __thunderid_browser.FlowMetaType.App
|
|
103
|
-
} : {}
|
|
104
|
-
});
|
|
117
|
+
meta.value = await loadMeta();
|
|
105
118
|
} catch (err) {
|
|
106
119
|
error.value = err instanceof Error ? err : new Error(String(err));
|
|
107
120
|
} finally {
|
|
@@ -113,19 +126,8 @@ const FlowMetaProvider = (0, vue.defineComponent)({
|
|
|
113
126
|
isLoading.value = true;
|
|
114
127
|
error.value = null;
|
|
115
128
|
try {
|
|
116
|
-
const result =
|
|
117
|
-
|
|
118
|
-
language
|
|
119
|
-
}) : await (0, __thunderid_browser.getFlowMeta)({
|
|
120
|
-
baseUrl,
|
|
121
|
-
url: flowMetaUrl,
|
|
122
|
-
...applicationId ? {
|
|
123
|
-
id: applicationId,
|
|
124
|
-
type: __thunderid_browser.FlowMetaType.App
|
|
125
|
-
} : {},
|
|
126
|
-
language
|
|
127
|
-
});
|
|
128
|
-
if (result.i18n?.translations && i18nContext?.injectBundles) {
|
|
129
|
+
const result = await loadMeta(language);
|
|
130
|
+
if (result?.i18n?.translations && i18nContext?.injectBundles) {
|
|
129
131
|
const flatTranslations = {};
|
|
130
132
|
Object.entries(result.i18n.translations).forEach(([namespace, keys]) => {
|
|
131
133
|
Object.entries(keys).forEach(([key, value]) => {
|
|
@@ -1161,6 +1163,7 @@ const ThunderIDProvider = (0, vue.defineComponent)({
|
|
|
1161
1163
|
}
|
|
1162
1164
|
return await client.signIn(...args);
|
|
1163
1165
|
} catch (error) {
|
|
1166
|
+
if (error instanceof __thunderid_browser.ThunderIDAPIError) throw error;
|
|
1164
1167
|
throw new __thunderid_browser.ThunderIDRuntimeError(`Sign in failed: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`, "thunderid-signIn-Error", "vue", "An error occurred while trying to sign in.");
|
|
1165
1168
|
} finally {
|
|
1166
1169
|
if (!isV2FlowRequest) {
|
|
@@ -2612,16 +2615,6 @@ const VERIFY_ATTRIBUTE_CSS = `
|
|
|
2612
2615
|
gap: calc(var(--thunderid-spacing-unit) * 1.5);
|
|
2613
2616
|
}
|
|
2614
2617
|
|
|
2615
|
-
.thunderid-verify-attribute__content .thunderid-otp-field__inputs {
|
|
2616
|
-
justify-content: flex-start;
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2619
|
-
.thunderid-verify-attribute__content .thunderid-otp-field__digit {
|
|
2620
|
-
flex: 1 1 calc(var(--thunderid-spacing-unit) * 4);
|
|
2621
|
-
max-width: calc(var(--thunderid-spacing-unit) * 6);
|
|
2622
|
-
min-width: 0;
|
|
2623
|
-
}
|
|
2624
|
-
|
|
2625
2618
|
.thunderid-verify-attribute__alert {
|
|
2626
2619
|
width: 100%;
|
|
2627
2620
|
}
|
|
@@ -2652,7 +2645,7 @@ var VerifyAttribute_css_default = VERIFY_ATTRIBUTE_CSS;
|
|
|
2652
2645
|
* Section: __header | __heading | __title | __description | __actions
|
|
2653
2646
|
* Forms: __form | __form-actions
|
|
2654
2647
|
* Parts: __panel | __panel-header | __panel-title | __detail | __detail-label | __detail-value
|
|
2655
|
-
* __chip-list | __chip | __confirm | __muted | __row | __avatar | __picker
|
|
2648
|
+
* __chip-list | __chip | __status-chip | __confirm | __muted | __row | __avatar | __picker
|
|
2656
2649
|
*
|
|
2657
2650
|
* Each component root also carries its own block class (for example `.thunderid-user-list`), so an
|
|
2658
2651
|
* application can target a single component.
|
|
@@ -2773,6 +2766,35 @@ const ADMIN_CSS = `
|
|
|
2773
2766
|
color: var(--thunderid-color-text-primary);
|
|
2774
2767
|
}
|
|
2775
2768
|
|
|
2769
|
+
.thunderid-admin__status-chip {
|
|
2770
|
+
display: inline-flex;
|
|
2771
|
+
flex-shrink: 0;
|
|
2772
|
+
gap: calc(var(--thunderid-spacing-unit) * 0.5);
|
|
2773
|
+
align-items: center;
|
|
2774
|
+
padding: 0 var(--thunderid-spacing-unit);
|
|
2775
|
+
border-radius: 999px;
|
|
2776
|
+
font-size: 0.75rem;
|
|
2777
|
+
font-weight: 500;
|
|
2778
|
+
line-height: 22px;
|
|
2779
|
+
white-space: nowrap;
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2782
|
+
.thunderid-admin__status-chip svg {
|
|
2783
|
+
width: 12px;
|
|
2784
|
+
height: 12px;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
.thunderid-admin__status-chip--success {
|
|
2788
|
+
color: var(--thunderid-color-success-dark, var(--thunderid-color-success-main));
|
|
2789
|
+
background: color-mix(in srgb, var(--thunderid-color-success-main) 12%, transparent);
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
/* Amber marks an action the administrator can take. */
|
|
2793
|
+
.thunderid-admin__status-chip--warning {
|
|
2794
|
+
color: var(--thunderid-color-warning-contrastText);
|
|
2795
|
+
background: color-mix(in srgb, var(--thunderid-color-warning-main) 14%, transparent);
|
|
2796
|
+
}
|
|
2797
|
+
|
|
2776
2798
|
.thunderid-admin__confirm {
|
|
2777
2799
|
display: inline-flex;
|
|
2778
2800
|
flex-wrap: wrap;
|
|
@@ -2796,6 +2818,32 @@ const ADMIN_CSS = `
|
|
|
2796
2818
|
gap: calc(var(--thunderid-spacing-unit) * 1.5);
|
|
2797
2819
|
}
|
|
2798
2820
|
|
|
2821
|
+
/* The value and its status on the left, the send action at the row's end. */
|
|
2822
|
+
.thunderid-admin__verification-row {
|
|
2823
|
+
display: flex;
|
|
2824
|
+
align-items: center;
|
|
2825
|
+
justify-content: space-between;
|
|
2826
|
+
gap: calc(var(--thunderid-spacing-unit) * 1.5);
|
|
2827
|
+
}
|
|
2828
|
+
|
|
2829
|
+
/* The action's padding must not make the row taller than its label. */
|
|
2830
|
+
.thunderid-admin__verification-row > button {
|
|
2831
|
+
margin-block: calc(var(--thunderid-spacing-unit) * -0.75);
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
.thunderid-admin__verification-value {
|
|
2835
|
+
display: inline-flex;
|
|
2836
|
+
flex-wrap: wrap;
|
|
2837
|
+
align-items: center;
|
|
2838
|
+
gap: var(--thunderid-spacing-unit);
|
|
2839
|
+
min-width: 0;
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
.thunderid-admin__verification-row svg {
|
|
2843
|
+
width: 14px;
|
|
2844
|
+
height: 14px;
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2799
2847
|
.thunderid-admin__name {
|
|
2800
2848
|
display: inline-flex;
|
|
2801
2849
|
align-items: center;
|
|
@@ -2999,6 +3047,56 @@ const CONSENT_CSS = `
|
|
|
2999
3047
|
`;
|
|
3000
3048
|
var Consent_css_default = CONSENT_CSS;
|
|
3001
3049
|
|
|
3050
|
+
//#endregion
|
|
3051
|
+
//#region src/components/auth/flow/FlowExpired.css.ts
|
|
3052
|
+
const FLOW_EXPIRED_CSS = `
|
|
3053
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired")} {
|
|
3054
|
+
align-items: center;
|
|
3055
|
+
display: flex;
|
|
3056
|
+
flex-direction: column;
|
|
3057
|
+
gap: calc(var(--thunderid-spacing-unit) * 1.5);
|
|
3058
|
+
padding-block: var(--thunderid-spacing-unit);
|
|
3059
|
+
text-align: center;
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
/* Focused only for a screen reader to read it, so it shows no ring. It is not a control. */
|
|
3063
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired")}:focus {
|
|
3064
|
+
outline: none;
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3067
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__icon")} {
|
|
3068
|
+
color: var(--thunderid-color-warning-main);
|
|
3069
|
+
display: flex;
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__action")} {
|
|
3073
|
+
margin-top: var(--thunderid-spacing-unit);
|
|
3074
|
+
}
|
|
3075
|
+
|
|
3076
|
+
/* Keeps the text on one line, with its own spaces. */
|
|
3077
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__link")} {
|
|
3078
|
+
color: var(--thunderid-color-primary-main);
|
|
3079
|
+
display: inline-flex;
|
|
3080
|
+
font-weight: var(--thunderid-typography-fontWeight-semibold);
|
|
3081
|
+
margin-top: var(--thunderid-spacing-unit);
|
|
3082
|
+
max-width: 100%;
|
|
3083
|
+
text-decoration: none;
|
|
3084
|
+
white-space: pre;
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__link")}:hover {
|
|
3088
|
+
text-decoration: underline;
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__name")} {
|
|
3092
|
+
min-width: 0;
|
|
3093
|
+
overflow: hidden;
|
|
3094
|
+
text-overflow: ellipsis;
|
|
3095
|
+
white-space: nowrap;
|
|
3096
|
+
}
|
|
3097
|
+
`;
|
|
3098
|
+
var FlowExpired_css_default = FLOW_EXPIRED_CSS;
|
|
3099
|
+
|
|
3002
3100
|
//#endregion
|
|
3003
3101
|
//#region src/components/auth/sign-in/BaseSignIn.css.ts
|
|
3004
3102
|
/**
|
|
@@ -4723,6 +4821,7 @@ const STYLES = [
|
|
|
4723
4821
|
DataTable_css_default,
|
|
4724
4822
|
BaseSignIn_css_default,
|
|
4725
4823
|
Consent_css_default,
|
|
4824
|
+
FlowExpired_css_default,
|
|
4726
4825
|
BaseDeviceGrant_css_default,
|
|
4727
4826
|
ChangeCredential_css_default,
|
|
4728
4827
|
OrganizationUnitSwitcher_css_default,
|
|
@@ -5097,6 +5196,201 @@ const useFetchAuthFlows = () => {
|
|
|
5097
5196
|
};
|
|
5098
5197
|
var useFetchAuthFlows_default = useFetchAuthFlows;
|
|
5099
5198
|
|
|
5199
|
+
//#endregion
|
|
5200
|
+
//#region src/composables/auth/useFlowExpiry.ts
|
|
5201
|
+
const MAX_TIMEOUT_MS = 2147483647;
|
|
5202
|
+
/**
|
|
5203
|
+
* Expiry of a flow execution, from the `expiresIn` of its latest step response or a refusal the caller
|
|
5204
|
+
* reports with `expireFlow()`. `expiresIn` is counted from when the response arrived, on this device's own
|
|
5205
|
+
* clock, so a device clock that differs from the server's does not move the expiry. The expiry is raised
|
|
5206
|
+
* when that time passes, and re-checked when the page becomes visible again, since a timer can fire late in
|
|
5207
|
+
* a background tab or after the device sleeps. It is keyed to `step`, so a new step response clears it.
|
|
5208
|
+
*
|
|
5209
|
+
* @param step - The latest step response, a new object for each response. Null or undefined before one.
|
|
5210
|
+
*/
|
|
5211
|
+
const useFlowExpiry = (step) => {
|
|
5212
|
+
const expiredFor = (0, vue.shallowRef)(null);
|
|
5213
|
+
const isFlowExpired = (0, vue.computed)(() => expiredFor.value !== null && expiredFor.value.step === (0, vue.toValue)(step));
|
|
5214
|
+
const expireFlow = () => {
|
|
5215
|
+
if (!isFlowExpired.value) expiredFor.value = { step: (0, vue.toValue)(step) };
|
|
5216
|
+
};
|
|
5217
|
+
const resetFlowExpiry = () => {
|
|
5218
|
+
expiredFor.value = null;
|
|
5219
|
+
};
|
|
5220
|
+
(0, vue.watch)(() => (0, vue.toValue)(step), (current, _previous, onCleanup) => {
|
|
5221
|
+
const expiresIn = current?.expiresIn;
|
|
5222
|
+
if (expiresIn === void 0) return;
|
|
5223
|
+
const delay = Math.max(expiresIn * 1e3, 0);
|
|
5224
|
+
const deadline = Date.now() + delay;
|
|
5225
|
+
const checkExpiry = () => {
|
|
5226
|
+
if (Date.now() >= deadline) expireFlow();
|
|
5227
|
+
};
|
|
5228
|
+
const onVisibilityChange = () => {
|
|
5229
|
+
if (document.visibilityState === "visible") checkExpiry();
|
|
5230
|
+
};
|
|
5231
|
+
const timerId = delay <= MAX_TIMEOUT_MS ? setTimeout(checkExpiry, delay) : void 0;
|
|
5232
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
5233
|
+
onCleanup(() => {
|
|
5234
|
+
clearTimeout(timerId);
|
|
5235
|
+
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
5236
|
+
});
|
|
5237
|
+
}, { immediate: true });
|
|
5238
|
+
return {
|
|
5239
|
+
expireFlow,
|
|
5240
|
+
expiry: (0, vue.computed)(() => isFlowExpired.value ? expiredFor.value : null),
|
|
5241
|
+
isFlowExpired,
|
|
5242
|
+
resetFlowExpiry
|
|
5243
|
+
};
|
|
5244
|
+
};
|
|
5245
|
+
var useFlowExpiry_default = useFlowExpiry;
|
|
5246
|
+
|
|
5247
|
+
//#endregion
|
|
5248
|
+
//#region src/composables/auth/useWhenUserPresent.ts
|
|
5249
|
+
/** Whether the user is looking at the page now, i.e. it is visible and has focus. */
|
|
5250
|
+
const isUserPresent = () => document.visibilityState === "visible" && document.hasFocus();
|
|
5251
|
+
/**
|
|
5252
|
+
* Runs `action` once while `enabled`, as soon as the user is on the page: at once when they already are, or
|
|
5253
|
+
* when they come back to the tab or the window. Lets an expired flow wait for the user before it acts, so a
|
|
5254
|
+
* user who left the tab still sees what happened.
|
|
5255
|
+
*
|
|
5256
|
+
* @param enabled - Whether to run the action. A change to `true` arms it again.
|
|
5257
|
+
* @param action - What to run. The latest one runs.
|
|
5258
|
+
*/
|
|
5259
|
+
const useWhenUserPresent = (enabled, action) => {
|
|
5260
|
+
(0, vue.watch)(() => (0, vue.toValue)(enabled), (isEnabled, _previous, onCleanup) => {
|
|
5261
|
+
if (!isEnabled) return;
|
|
5262
|
+
let done = false;
|
|
5263
|
+
const run = () => {
|
|
5264
|
+
if (!done) {
|
|
5265
|
+
done = true;
|
|
5266
|
+
action();
|
|
5267
|
+
}
|
|
5268
|
+
};
|
|
5269
|
+
const runOnReturn = () => {
|
|
5270
|
+
if (document.visibilityState === "visible") run();
|
|
5271
|
+
};
|
|
5272
|
+
const timerId = setTimeout(() => {
|
|
5273
|
+
if (isUserPresent()) run();
|
|
5274
|
+
}, 0);
|
|
5275
|
+
document.addEventListener("visibilitychange", runOnReturn);
|
|
5276
|
+
window.addEventListener("focus", runOnReturn);
|
|
5277
|
+
onCleanup(() => {
|
|
5278
|
+
clearTimeout(timerId);
|
|
5279
|
+
document.removeEventListener("visibilitychange", runOnReturn);
|
|
5280
|
+
window.removeEventListener("focus", runOnReturn);
|
|
5281
|
+
});
|
|
5282
|
+
}, { immediate: true });
|
|
5283
|
+
};
|
|
5284
|
+
var useWhenUserPresent_default = useWhenUserPresent;
|
|
5285
|
+
|
|
5286
|
+
//#endregion
|
|
5287
|
+
//#region src/composables/auth/useFlowExpiryRedirect.ts
|
|
5288
|
+
/** How long an expired flow counts down before it sends the user back to the application. */
|
|
5289
|
+
const FLOW_EXPIRY_REDIRECT_SECONDS = 10;
|
|
5290
|
+
/** How long the page waits after the redirect before it treats the redirect as not having happened. */
|
|
5291
|
+
const REDIRECT_FALLBACK_MS = 3e3;
|
|
5292
|
+
/**
|
|
5293
|
+
* Counts down and sends the user back to `url` once a flow expires. The countdown starts only while the user
|
|
5294
|
+
* is on the page, so a user who comes back to the tab still sees why they are being sent back. The state is
|
|
5295
|
+
* keyed to `expiry`, so a new expiry starts over.
|
|
5296
|
+
*
|
|
5297
|
+
* @param expiry - The expiry being handled, from `useFlowExpiry`, or null while the flow is active.
|
|
5298
|
+
* @param url - Where to send the user back to. Without it there is no redirect.
|
|
5299
|
+
* @returns The countdown, or null when there is nothing to count down.
|
|
5300
|
+
*/
|
|
5301
|
+
const useFlowExpiryRedirect = (expiry, url) => {
|
|
5302
|
+
const started = (0, vue.shallowRef)(null);
|
|
5303
|
+
const failedFor = (0, vue.shallowRef)(null);
|
|
5304
|
+
const now = (0, vue.ref)(Date.now());
|
|
5305
|
+
const isActive = (0, vue.computed)(() => (0, vue.toValue)(expiry) !== null && Boolean((0, vue.toValue)(url)));
|
|
5306
|
+
const isStarted = (0, vue.computed)(() => isActive.value && started.value !== null && started.value.expiry === (0, vue.toValue)(expiry));
|
|
5307
|
+
const isRedirectFailed = (0, vue.computed)(() => isActive.value && failedFor.value !== null && failedFor.value === (0, vue.toValue)(expiry));
|
|
5308
|
+
useWhenUserPresent_default(isActive, () => {
|
|
5309
|
+
const current = (0, vue.toValue)(expiry);
|
|
5310
|
+
if (current !== null) started.value = {
|
|
5311
|
+
at: Date.now(),
|
|
5312
|
+
expiry: current
|
|
5313
|
+
};
|
|
5314
|
+
});
|
|
5315
|
+
(0, vue.watch)([
|
|
5316
|
+
isStarted,
|
|
5317
|
+
started,
|
|
5318
|
+
() => (0, vue.toValue)(url)
|
|
5319
|
+
], (_values, _previous, onCleanup) => {
|
|
5320
|
+
const target = (0, vue.toValue)(url);
|
|
5321
|
+
if (!isStarted.value || started.value === null || !target) return;
|
|
5322
|
+
const { at, expiry: startedFor } = started.value;
|
|
5323
|
+
const intervalId = setInterval(() => {
|
|
5324
|
+
now.value = Date.now();
|
|
5325
|
+
}, 1e3);
|
|
5326
|
+
let fallbackId;
|
|
5327
|
+
const redirectId = setTimeout(() => {
|
|
5328
|
+
clearInterval(intervalId);
|
|
5329
|
+
now.value = Date.now();
|
|
5330
|
+
try {
|
|
5331
|
+
window.location.replace(target);
|
|
5332
|
+
} catch {
|
|
5333
|
+
failedFor.value = startedFor;
|
|
5334
|
+
return;
|
|
5335
|
+
}
|
|
5336
|
+
fallbackId = setTimeout(() => {
|
|
5337
|
+
failedFor.value = startedFor;
|
|
5338
|
+
}, REDIRECT_FALLBACK_MS);
|
|
5339
|
+
}, Math.max(at + FLOW_EXPIRY_REDIRECT_SECONDS * 1e3 - Date.now(), 0));
|
|
5340
|
+
onCleanup(() => {
|
|
5341
|
+
clearInterval(intervalId);
|
|
5342
|
+
clearTimeout(redirectId);
|
|
5343
|
+
clearTimeout(fallbackId);
|
|
5344
|
+
});
|
|
5345
|
+
}, { immediate: true });
|
|
5346
|
+
return (0, vue.computed)(() => {
|
|
5347
|
+
const target = (0, vue.toValue)(url);
|
|
5348
|
+
if (!isActive.value || !target) return null;
|
|
5349
|
+
const remainingMs = isStarted.value && started.value ? started.value.at + FLOW_EXPIRY_REDIRECT_SECONDS * 1e3 - now.value : Infinity;
|
|
5350
|
+
return {
|
|
5351
|
+
countdownSeconds: FLOW_EXPIRY_REDIRECT_SECONDS,
|
|
5352
|
+
isCountingDown: isStarted.value && !isRedirectFailed.value,
|
|
5353
|
+
isRedirectFailed: isRedirectFailed.value,
|
|
5354
|
+
secondsLeft: Math.min(Math.max(Math.ceil(remainingMs / 1e3), 0), FLOW_EXPIRY_REDIRECT_SECONDS),
|
|
5355
|
+
url: target
|
|
5356
|
+
};
|
|
5357
|
+
});
|
|
5358
|
+
};
|
|
5359
|
+
var useFlowExpiryRedirect_default = useFlowExpiryRedirect;
|
|
5360
|
+
|
|
5361
|
+
//#endregion
|
|
5362
|
+
//#region src/composables/auth/useFlowExpiryHandling.ts
|
|
5363
|
+
/**
|
|
5364
|
+
* What a flow component does once its execution expires. With `afterFlowExpiredUrl`, it counts down and sends
|
|
5365
|
+
* the user back there. Otherwise, when it can, it starts the flow again in place once the user is on the page,
|
|
5366
|
+
* and says so. When it can do neither, the user is left to go back to the application.
|
|
5367
|
+
*/
|
|
5368
|
+
const useFlowExpiryHandling = ({ afterFlowExpiredUrl = void 0, canRestart, restart, step = void 0 }) => {
|
|
5369
|
+
const { expireFlow, expiry, isFlowExpired, resetFlowExpiry } = useFlowExpiry_default(step);
|
|
5370
|
+
const flowExpiryRedirect = useFlowExpiryRedirect_default(expiry, () => (0, vue.toValue)(afterFlowExpiredUrl));
|
|
5371
|
+
const isFlowRestarted = (0, vue.ref)(false);
|
|
5372
|
+
const restartsInPlace = (0, vue.computed)(() => !(0, vue.toValue)(afterFlowExpiredUrl) && (0, vue.toValue)(canRestart));
|
|
5373
|
+
const restartFlow = () => {
|
|
5374
|
+
resetFlowExpiry();
|
|
5375
|
+
isFlowRestarted.value = true;
|
|
5376
|
+
restart();
|
|
5377
|
+
};
|
|
5378
|
+
const clearFlowRestarted = () => {
|
|
5379
|
+
isFlowRestarted.value = false;
|
|
5380
|
+
};
|
|
5381
|
+
useWhenUserPresent_default(() => isFlowExpired.value && restartsInPlace.value, restartFlow);
|
|
5382
|
+
return {
|
|
5383
|
+
clearFlowRestarted,
|
|
5384
|
+
expireFlow,
|
|
5385
|
+
flowExpiryRedirect,
|
|
5386
|
+
isFlowExpired,
|
|
5387
|
+
isFlowRestarted,
|
|
5388
|
+
restartFlow,
|
|
5389
|
+
restartsInPlace
|
|
5390
|
+
};
|
|
5391
|
+
};
|
|
5392
|
+
var useFlowExpiryHandling_default = useFlowExpiryHandling;
|
|
5393
|
+
|
|
5100
5394
|
//#endregion
|
|
5101
5395
|
//#region src/composables/management/useInfiniteOptions.ts
|
|
5102
5396
|
const logger$5 = (0, __thunderid_browser.createPackageComponentLogger)("@thunderid/vue", "useInfiniteOptions");
|
|
@@ -5760,6 +6054,7 @@ const TriangleAlertIcon = () => icon([
|
|
|
5760
6054
|
y2: "17"
|
|
5761
6055
|
})
|
|
5762
6056
|
]);
|
|
6057
|
+
const SendIcon = () => icon([(0, vue.h)("path", { d: "m22 2-7 20-4-9-9-4Z" }), (0, vue.h)("path", { d: "M22 2 11 13" })]);
|
|
5763
6058
|
const PlusIcon = () => icon([(0, vue.h)("line", {
|
|
5764
6059
|
x1: "12",
|
|
5765
6060
|
x2: "12",
|
|
@@ -8971,6 +9266,113 @@ const renderInviteUserComponents = (components, formValues, touchedFields, formE
|
|
|
8971
9266
|
key: component.id || index
|
|
8972
9267
|
})).filter((v) => v !== null);
|
|
8973
9268
|
|
|
9269
|
+
//#endregion
|
|
9270
|
+
//#region src/components/auth/flow/FlowExpired.ts
|
|
9271
|
+
const APPLICATION_MARKER = "\0";
|
|
9272
|
+
const TimerIcon = () => (0, vue.h)("svg", {
|
|
9273
|
+
fill: "none",
|
|
9274
|
+
height: "44",
|
|
9275
|
+
stroke: "currentColor",
|
|
9276
|
+
"stroke-linecap": "round",
|
|
9277
|
+
"stroke-linejoin": "round",
|
|
9278
|
+
"stroke-width": "1.6",
|
|
9279
|
+
viewBox: "0 0 24 24",
|
|
9280
|
+
width: "44",
|
|
9281
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9282
|
+
}, [
|
|
9283
|
+
(0, vue.h)("line", {
|
|
9284
|
+
x1: "10",
|
|
9285
|
+
x2: "14",
|
|
9286
|
+
y1: "2",
|
|
9287
|
+
y2: "2"
|
|
9288
|
+
}),
|
|
9289
|
+
(0, vue.h)("line", {
|
|
9290
|
+
x1: "12",
|
|
9291
|
+
x2: "15",
|
|
9292
|
+
y1: "14",
|
|
9293
|
+
y2: "11"
|
|
9294
|
+
}),
|
|
9295
|
+
(0, vue.h)("circle", {
|
|
9296
|
+
cx: "12",
|
|
9297
|
+
cy: "14",
|
|
9298
|
+
r: "8"
|
|
9299
|
+
})
|
|
9300
|
+
]);
|
|
9301
|
+
/**
|
|
9302
|
+
* Shown in place of a sign-in or sign-up flow whose execution expired. The flow cannot continue, so it counts
|
|
9303
|
+
* down to the application, offers to start again, or tells the user to go back to the application.
|
|
9304
|
+
*/
|
|
9305
|
+
const FlowExpired = (0, vue.defineComponent)({
|
|
9306
|
+
name: "FlowExpired",
|
|
9307
|
+
props: {
|
|
9308
|
+
onRestart: {
|
|
9309
|
+
default: void 0,
|
|
9310
|
+
type: Function
|
|
9311
|
+
},
|
|
9312
|
+
redirect: {
|
|
9313
|
+
default: null,
|
|
9314
|
+
type: Object
|
|
9315
|
+
}
|
|
9316
|
+
},
|
|
9317
|
+
setup(props) {
|
|
9318
|
+
const { meta } = useFlowMeta_default();
|
|
9319
|
+
const { t } = useI18n_default();
|
|
9320
|
+
const rootRef = (0, vue.ref)(null);
|
|
9321
|
+
(0, vue.onMounted)(() => {
|
|
9322
|
+
rootRef.value?.focus();
|
|
9323
|
+
});
|
|
9324
|
+
return () => {
|
|
9325
|
+
const { redirect, onRestart } = props;
|
|
9326
|
+
const name = meta.value?.application?.name;
|
|
9327
|
+
const application = name !== void 0 && name !== "" ? name : t("flow.expired.application");
|
|
9328
|
+
const renderAction = () => {
|
|
9329
|
+
if (redirect) {
|
|
9330
|
+
const [before = "", after = ""] = t(redirect.isCountingDown ? "flow.expired.redirect.now" : "flow.expired.redirect.link", { application: APPLICATION_MARKER }).split(APPLICATION_MARKER);
|
|
9331
|
+
return (0, vue.h)("a", {
|
|
9332
|
+
class: (0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__link"),
|
|
9333
|
+
href: redirect.url
|
|
9334
|
+
}, [
|
|
9335
|
+
before,
|
|
9336
|
+
(0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__name") }, application),
|
|
9337
|
+
after
|
|
9338
|
+
]);
|
|
9339
|
+
}
|
|
9340
|
+
if (onRestart) return (0, vue.h)(Button_default, {
|
|
9341
|
+
class: (0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__action"),
|
|
9342
|
+
onClick: onRestart,
|
|
9343
|
+
variant: "outline"
|
|
9344
|
+
}, () => t("flow.expired.restart"));
|
|
9345
|
+
return null;
|
|
9346
|
+
};
|
|
9347
|
+
const description = () => {
|
|
9348
|
+
if (redirect?.isCountingDown) return t("flow.expired.redirecting", {
|
|
9349
|
+
application,
|
|
9350
|
+
seconds: redirect.secondsLeft
|
|
9351
|
+
});
|
|
9352
|
+
if (!redirect && onRestart) return t("flow.expired.restart.description");
|
|
9353
|
+
return t("flow.expired.return.description", { application });
|
|
9354
|
+
};
|
|
9355
|
+
return (0, vue.h)("div", {
|
|
9356
|
+
class: (0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired"),
|
|
9357
|
+
ref: rootRef,
|
|
9358
|
+
tabindex: -1
|
|
9359
|
+
}, [
|
|
9360
|
+
(0, vue.h)("span", {
|
|
9361
|
+
"aria-hidden": "true",
|
|
9362
|
+
class: (0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__icon")
|
|
9363
|
+
}, [TimerIcon()]),
|
|
9364
|
+
(0, vue.h)(Typography_default, {
|
|
9365
|
+
component: "h1",
|
|
9366
|
+
variant: "h5"
|
|
9367
|
+
}, () => t("flow.expired.heading")),
|
|
9368
|
+
(0, vue.h)(Typography_default, { variant: "body1" }, () => description()),
|
|
9369
|
+
renderAction()
|
|
9370
|
+
]);
|
|
9371
|
+
};
|
|
9372
|
+
}
|
|
9373
|
+
});
|
|
9374
|
+
var FlowExpired_default = FlowExpired;
|
|
9375
|
+
|
|
8974
9376
|
//#endregion
|
|
8975
9377
|
//#region src/components/auth/sign-in/BaseSignIn.ts
|
|
8976
9378
|
const extractFormFields$1 = (flowComponents) => {
|
|
@@ -9035,6 +9437,10 @@ const BaseSignIn = (0, vue.defineComponent)({
|
|
|
9035
9437
|
default: "",
|
|
9036
9438
|
type: String
|
|
9037
9439
|
},
|
|
9440
|
+
flowExpiryRedirect: {
|
|
9441
|
+
default: null,
|
|
9442
|
+
type: Object
|
|
9443
|
+
},
|
|
9038
9444
|
inputClassName: {
|
|
9039
9445
|
default: "",
|
|
9040
9446
|
type: String
|
|
@@ -9043,6 +9449,14 @@ const BaseSignIn = (0, vue.defineComponent)({
|
|
|
9043
9449
|
default: () => ({}),
|
|
9044
9450
|
type: Object
|
|
9045
9451
|
},
|
|
9452
|
+
isFlowExpired: {
|
|
9453
|
+
default: false,
|
|
9454
|
+
type: Boolean
|
|
9455
|
+
},
|
|
9456
|
+
isFlowRestarted: {
|
|
9457
|
+
default: false,
|
|
9458
|
+
type: Boolean
|
|
9459
|
+
},
|
|
9046
9460
|
isLoading: {
|
|
9047
9461
|
default: false,
|
|
9048
9462
|
type: Boolean
|
|
@@ -9055,6 +9469,10 @@ const BaseSignIn = (0, vue.defineComponent)({
|
|
|
9055
9469
|
default: "",
|
|
9056
9470
|
type: String
|
|
9057
9471
|
},
|
|
9472
|
+
onRestart: {
|
|
9473
|
+
default: void 0,
|
|
9474
|
+
type: Function
|
|
9475
|
+
},
|
|
9058
9476
|
onSubmit: {
|
|
9059
9477
|
default: void 0,
|
|
9060
9478
|
type: Function
|
|
@@ -9257,6 +9675,13 @@ const BaseSignIn = (0, vue.defineComponent)({
|
|
|
9257
9675
|
class: [containerClass, attrs.class].filter(Boolean).join(" ")
|
|
9258
9676
|
}, slots["default"](renderProps));
|
|
9259
9677
|
}
|
|
9678
|
+
if (props.isFlowExpired) return (0, vue.h)(Card_default, {
|
|
9679
|
+
class: containerClass,
|
|
9680
|
+
variant: props.variant
|
|
9681
|
+
}, () => (0, vue.h)(FlowExpired_default, {
|
|
9682
|
+
onRestart: props.onRestart,
|
|
9683
|
+
redirect: props.flowExpiryRedirect
|
|
9684
|
+
}));
|
|
9260
9685
|
if (isLoading.value && (!props.components || props.components.length === 0)) return (0, vue.h)(Card_default, {
|
|
9261
9686
|
class: containerClass,
|
|
9262
9687
|
variant: props.variant
|
|
@@ -9271,10 +9696,14 @@ const BaseSignIn = (0, vue.defineComponent)({
|
|
|
9271
9696
|
...attrs,
|
|
9272
9697
|
class: [containerClass, attrs.class].filter(Boolean).join(" "),
|
|
9273
9698
|
variant: props.variant
|
|
9274
|
-
}, () => [(externalError || messages.length > 0) && (0, vue.h)("div", { class: [(0, __thunderid_browser.withVendorCSSClassPrefix)("signin__messages"), props.messageClassName].filter(Boolean).join(" ") }, [
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9699
|
+
}, () => [(props.isFlowRestarted || externalError || messages.length > 0) && (0, vue.h)("div", { class: [(0, __thunderid_browser.withVendorCSSClassPrefix)("signin__messages"), props.messageClassName].filter(Boolean).join(" ") }, [
|
|
9700
|
+
props.isFlowRestarted && (0, vue.h)(Alert_default, { severity: "info" }, () => (0, vue.h)(Typography_default, { variant: "body2" }, () => t("flow.expired.restarted"))),
|
|
9701
|
+
externalError && (0, vue.h)(Alert_default, { severity: "error" }, () => (0, vue.h)(Typography_default, { variant: "body2" }, () => externalError.message)),
|
|
9702
|
+
...messages.map((msg, index) => (0, vue.h)(Alert_default, {
|
|
9703
|
+
key: index,
|
|
9704
|
+
severity: msg.type === "error" ? "error" : "info"
|
|
9705
|
+
}, () => (0, vue.h)(Typography_default, { variant: "body2" }, () => msg.message)))
|
|
9706
|
+
]), (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__content") }, renderComponents())]);
|
|
9278
9707
|
};
|
|
9279
9708
|
}
|
|
9280
9709
|
});
|
|
@@ -9414,6 +9843,10 @@ const handlePasskeyAuthentication = async (challengeData) => {
|
|
|
9414
9843
|
const SignIn = (0, vue.defineComponent)({
|
|
9415
9844
|
name: "SignIn",
|
|
9416
9845
|
props: {
|
|
9846
|
+
afterFlowExpiredUrl: {
|
|
9847
|
+
default: void 0,
|
|
9848
|
+
type: String
|
|
9849
|
+
},
|
|
9417
9850
|
className: {
|
|
9418
9851
|
default: "",
|
|
9419
9852
|
type: String
|
|
@@ -9454,6 +9887,17 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9454
9887
|
executionId: null,
|
|
9455
9888
|
isActive: false
|
|
9456
9889
|
});
|
|
9890
|
+
const flowExpiryStep = (0, vue.shallowRef)(null);
|
|
9891
|
+
const startedApplicationId = (0, vue.ref)(null);
|
|
9892
|
+
const isStartedByAuthorizeRequest = (0, vue.ref)(false);
|
|
9893
|
+
const { clearFlowRestarted, expireFlow, flowExpiryRedirect, isFlowExpired, isFlowRestarted, restartFlow, restartsInPlace } = useFlowExpiryHandling_default({
|
|
9894
|
+
afterFlowExpiredUrl: () => props.afterFlowExpiredUrl,
|
|
9895
|
+
canRestart: () => Boolean(applicationId || startedApplicationId.value) && !isStartedByAuthorizeRequest.value,
|
|
9896
|
+
restart: () => {
|
|
9897
|
+
startFlowAgain();
|
|
9898
|
+
},
|
|
9899
|
+
step: flowExpiryStep
|
|
9900
|
+
});
|
|
9457
9901
|
let initializationAttempted = false;
|
|
9458
9902
|
const oauthCodeProcessedFlag = { value: false };
|
|
9459
9903
|
let passkeyProcessed = false;
|
|
@@ -9523,6 +9967,18 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9523
9967
|
isFlowInitialized.value = true;
|
|
9524
9968
|
emit("error", flowError.value);
|
|
9525
9969
|
};
|
|
9970
|
+
const sessionExpiredError = (translate) => new __thunderid_browser.ThunderIDRuntimeError(translate("errors.signin.session.expired") || "Your session has expired. Please return to the application and sign in again.", "SIGN_IN_ERROR", "vue");
|
|
9971
|
+
/**
|
|
9972
|
+
* Marks the flow as expired. Unless the flow is started again in place, the error follows from the expiry,
|
|
9973
|
+
* set by the watcher below; once already expired, it is set again here since a new submission clears it.
|
|
9974
|
+
*/
|
|
9975
|
+
const handleFlowExpired = () => {
|
|
9976
|
+
if (isFlowExpired.value && !restartsInPlace.value) setError(sessionExpiredError);
|
|
9977
|
+
else expireFlow();
|
|
9978
|
+
};
|
|
9979
|
+
(0, vue.watch)(() => isFlowExpired.value && !restartsInPlace.value, (isExpiredForGood) => {
|
|
9980
|
+
if (isExpiredForGood) setError(sessionExpiredError);
|
|
9981
|
+
});
|
|
9526
9982
|
/**
|
|
9527
9983
|
* Updates challengeTokenRef immediately and persists via the provider's
|
|
9528
9984
|
* StorageManager so the token survives OAuth redirects.
|
|
@@ -9539,7 +9995,9 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9539
9995
|
const urlParams = getUrlParams$1();
|
|
9540
9996
|
oauthCodeProcessedFlag.value = false;
|
|
9541
9997
|
await storeAuthId(urlParams.authId, urlParams.executionId);
|
|
9542
|
-
const effectiveApplicationId = applicationId || urlParams.applicationId;
|
|
9998
|
+
const effectiveApplicationId = applicationId || urlParams.applicationId || startedApplicationId.value;
|
|
9999
|
+
if (effectiveApplicationId) startedApplicationId.value = effectiveApplicationId;
|
|
10000
|
+
if (urlParams.authId) isStartedByAuthorizeRequest.value = true;
|
|
9543
10001
|
if (!urlParams.executionId && !effectiveApplicationId) {
|
|
9544
10002
|
setError(new __thunderid_browser.ThunderIDRuntimeError("Either executionId or applicationId is required for authentication", "SIGN_IN_ERROR", "vue"));
|
|
9545
10003
|
return;
|
|
@@ -9571,16 +10029,31 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9571
10029
|
additionalData.value = normalizedAdditionalData ?? {};
|
|
9572
10030
|
isFlowInitialized.value = true;
|
|
9573
10031
|
isTimeoutDisabled.value = false;
|
|
10032
|
+
flowExpiryStep.value = { expiresIn: response.expiresIn };
|
|
9574
10033
|
await storeAuthId(urlParams.authId, normalizedExecutionId);
|
|
9575
10034
|
cleanupFlowUrlParams();
|
|
9576
10035
|
}
|
|
9577
10036
|
} catch (error) {
|
|
10037
|
+
if ((0, __thunderid_browser.isFlowExpiredError)(error)) {
|
|
10038
|
+
handleFlowExpired();
|
|
10039
|
+
return;
|
|
10040
|
+
}
|
|
9578
10041
|
const err = error;
|
|
9579
10042
|
clearFlowState();
|
|
9580
10043
|
setError(err);
|
|
9581
10044
|
initializationAttempted = false;
|
|
9582
10045
|
}
|
|
9583
10046
|
};
|
|
10047
|
+
/**
|
|
10048
|
+
* Starts an expired flow again for the application it was started for. The expired execution is dropped
|
|
10049
|
+
* from the URL and storage first, so the new flow does not resume it.
|
|
10050
|
+
*/
|
|
10051
|
+
const startFlowAgain = async () => {
|
|
10052
|
+
await clearFlowState();
|
|
10053
|
+
cleanupFlowUrlParams();
|
|
10054
|
+
flowExpiryStep.value = null;
|
|
10055
|
+
await initializeFlow();
|
|
10056
|
+
};
|
|
9584
10057
|
const handleSubmit = async (payload) => {
|
|
9585
10058
|
const effectiveExecutionId = payload.executionId || currentExecutionId.value;
|
|
9586
10059
|
if (!effectiveExecutionId) throw new Error("No active flow ID");
|
|
@@ -9604,6 +10077,7 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9604
10077
|
...isDeny ? { reason: __thunderid_browser.ConsentConstants.REASON_USER_DENIED } : {}
|
|
9605
10078
|
});
|
|
9606
10079
|
} catch {}
|
|
10080
|
+
clearFlowRestarted();
|
|
9607
10081
|
try {
|
|
9608
10082
|
isSubmitting.value = true;
|
|
9609
10083
|
flowErrorSource.value = null;
|
|
@@ -9665,12 +10139,17 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9665
10139
|
additionalData.value = normalizedAdditionalData ?? {};
|
|
9666
10140
|
isTimeoutDisabled.value = false;
|
|
9667
10141
|
isFlowInitialized.value = true;
|
|
10142
|
+
flowExpiryStep.value = { expiresIn: response.expiresIn };
|
|
9668
10143
|
cleanupFlowUrlParams();
|
|
9669
10144
|
if (response?.error) flowErrorSource.value = response;
|
|
9670
10145
|
}
|
|
9671
10146
|
} catch (error) {
|
|
9672
10147
|
const err = error;
|
|
9673
10148
|
if (err instanceof Error && flowError.value === err) throw err;
|
|
10149
|
+
if ((0, __thunderid_browser.isFlowExpiredError)(err)) {
|
|
10150
|
+
handleFlowExpired();
|
|
10151
|
+
return;
|
|
10152
|
+
}
|
|
9674
10153
|
clearFlowState();
|
|
9675
10154
|
setError(err);
|
|
9676
10155
|
} finally {
|
|
@@ -9798,7 +10277,10 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9798
10277
|
additionalData: additionalData.value,
|
|
9799
10278
|
components: components.value,
|
|
9800
10279
|
error: flowError.value,
|
|
10280
|
+
flowExpiryRedirect: flowExpiryRedirect.value,
|
|
9801
10281
|
initialize: initializeFlow,
|
|
10282
|
+
isFlowExpired: isFlowExpired.value,
|
|
10283
|
+
isFlowRestarted: isFlowRestarted.value,
|
|
9802
10284
|
isInitialized: isFlowInitialized.value,
|
|
9803
10285
|
isLoading: combinedIsLoading,
|
|
9804
10286
|
isTimeoutDisabled: isTimeoutDisabled.value,
|
|
@@ -9813,9 +10295,13 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9813
10295
|
class: props.className,
|
|
9814
10296
|
components: components.value,
|
|
9815
10297
|
error: flowError.value,
|
|
10298
|
+
flowExpiryRedirect: flowExpiryRedirect.value,
|
|
10299
|
+
isFlowExpired: isFlowExpired.value,
|
|
10300
|
+
isFlowRestarted: isFlowRestarted.value,
|
|
9816
10301
|
isLoading: combinedIsLoading || !isFlowInitialized.value,
|
|
9817
10302
|
isTimeoutDisabled: isTimeoutDisabled.value,
|
|
9818
10303
|
onError: (err) => emit("error", err),
|
|
10304
|
+
onRestart: restartsInPlace.value ? restartFlow : void 0,
|
|
9819
10305
|
onSubmit: handleSubmit,
|
|
9820
10306
|
size: props.size,
|
|
9821
10307
|
variant: props.variant
|
|
@@ -10348,6 +10834,10 @@ const extractFormFields = (components) => {
|
|
|
10348
10834
|
const BaseSignUp = (0, vue.defineComponent)({
|
|
10349
10835
|
name: "BaseSignUp",
|
|
10350
10836
|
props: {
|
|
10837
|
+
afterFlowExpiredUrl: {
|
|
10838
|
+
default: void 0,
|
|
10839
|
+
type: String
|
|
10840
|
+
},
|
|
10351
10841
|
afterSignUpUrl: {
|
|
10352
10842
|
default: void 0,
|
|
10353
10843
|
type: String
|
|
@@ -10428,6 +10918,15 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10428
10918
|
const isLoading = (0, vue.ref)(false);
|
|
10429
10919
|
const isFlowInitialized = (0, vue.ref)(false);
|
|
10430
10920
|
const currentFlow = (0, vue.ref)(null);
|
|
10921
|
+
const restartCount = (0, vue.ref)(0);
|
|
10922
|
+
const { clearFlowRestarted, expireFlow, flowExpiryRedirect, isFlowExpired, isFlowRestarted, restartFlow, restartsInPlace } = useFlowExpiryHandling_default({
|
|
10923
|
+
afterFlowExpiredUrl: () => props.afterFlowExpiredUrl,
|
|
10924
|
+
canRestart: true,
|
|
10925
|
+
restart: () => {
|
|
10926
|
+
startFlowAgain();
|
|
10927
|
+
},
|
|
10928
|
+
step: () => currentFlow.value
|
|
10929
|
+
});
|
|
10431
10930
|
const apiErrorSource = (0, vue.shallowRef)(null);
|
|
10432
10931
|
const apiError = (0, vue.computed)(() => apiErrorSource.value === null ? null : resolveFlowError(apiErrorSource.value, t));
|
|
10433
10932
|
const flowMessages = (0, vue.ref)([]);
|
|
@@ -10445,12 +10944,17 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10445
10944
|
let initializationAttempted = false;
|
|
10446
10945
|
let passkeyProcessed = false;
|
|
10447
10946
|
const handleError = (error) => {
|
|
10947
|
+
if ((0, __thunderid_browser.isFlowExpiredError)(error)) expireFlow();
|
|
10448
10948
|
apiErrorSource.value = error;
|
|
10449
10949
|
flowMessages.value = [{
|
|
10450
10950
|
message: apiError.value.message,
|
|
10451
10951
|
type: "error"
|
|
10452
10952
|
}];
|
|
10453
10953
|
};
|
|
10954
|
+
const reportError = (error) => {
|
|
10955
|
+
if (restartsInPlace.value && (0, __thunderid_browser.isFlowExpiredError)(error)) return;
|
|
10956
|
+
props.onError?.(error);
|
|
10957
|
+
};
|
|
10454
10958
|
(0, vue.watch)(() => apiError.value?.message, (message) => {
|
|
10455
10959
|
if (message) flowMessages.value = [{
|
|
10456
10960
|
message,
|
|
@@ -10596,7 +11100,7 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10596
11100
|
popup.close();
|
|
10597
11101
|
} catch (err) {
|
|
10598
11102
|
handleError(err);
|
|
10599
|
-
|
|
11103
|
+
reportError(err);
|
|
10600
11104
|
popup.close();
|
|
10601
11105
|
cleanup();
|
|
10602
11106
|
}
|
|
@@ -10649,6 +11153,7 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10649
11153
|
if (!validateForm().isValid) return;
|
|
10650
11154
|
}
|
|
10651
11155
|
isLoading.value = true;
|
|
11156
|
+
clearFlowRestarted();
|
|
10652
11157
|
apiErrorSource.value = null;
|
|
10653
11158
|
flowMessages.value = [];
|
|
10654
11159
|
try {
|
|
@@ -10690,7 +11195,7 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10690
11195
|
}
|
|
10691
11196
|
} catch (err) {
|
|
10692
11197
|
handleError(err);
|
|
10693
|
-
|
|
11198
|
+
reportError(err);
|
|
10694
11199
|
} finally {
|
|
10695
11200
|
isLoading.value = false;
|
|
10696
11201
|
}
|
|
@@ -10735,10 +11240,14 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10735
11240
|
isActive: false
|
|
10736
11241
|
};
|
|
10737
11242
|
handleError(error);
|
|
10738
|
-
|
|
11243
|
+
reportError(error);
|
|
10739
11244
|
}
|
|
10740
11245
|
}, { deep: true });
|
|
10741
|
-
(0, vue.watch)(() => [
|
|
11246
|
+
(0, vue.watch)(() => [
|
|
11247
|
+
props.isInitialized,
|
|
11248
|
+
isFlowInitialized.value,
|
|
11249
|
+
restartCount.value
|
|
11250
|
+
], ([initialized, flowInit]) => {
|
|
10742
11251
|
if (typeof window !== "undefined") {
|
|
10743
11252
|
const urlParams = new URL(window.location.href).searchParams;
|
|
10744
11253
|
if (urlParams.get("code") || urlParams.get("state")) return;
|
|
@@ -10764,13 +11273,30 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10764
11273
|
}
|
|
10765
11274
|
} catch (err) {
|
|
10766
11275
|
handleError(err);
|
|
10767
|
-
|
|
11276
|
+
reportError(err);
|
|
10768
11277
|
} finally {
|
|
10769
11278
|
isLoading.value = false;
|
|
10770
11279
|
}
|
|
10771
11280
|
})();
|
|
10772
11281
|
}
|
|
10773
11282
|
}, { immediate: true });
|
|
11283
|
+
/**
|
|
11284
|
+
* Starts an expired flow again: clears it, drops the expired execution from the URL so it is not resumed,
|
|
11285
|
+
* and runs the initialization once more.
|
|
11286
|
+
*/
|
|
11287
|
+
const startFlowAgain = () => {
|
|
11288
|
+
currentFlow.value = null;
|
|
11289
|
+
apiErrorSource.value = null;
|
|
11290
|
+
flowMessages.value = [];
|
|
11291
|
+
if (typeof window !== "undefined" && window.location?.href) {
|
|
11292
|
+
const url = new URL(window.location.href);
|
|
11293
|
+
url.searchParams.delete("executionId");
|
|
11294
|
+
window.history.replaceState({}, "", url.toString());
|
|
11295
|
+
}
|
|
11296
|
+
initializationAttempted = false;
|
|
11297
|
+
isFlowInitialized.value = false;
|
|
11298
|
+
restartCount.value += 1;
|
|
11299
|
+
};
|
|
10774
11300
|
return () => {
|
|
10775
11301
|
const containerClass = [
|
|
10776
11302
|
(0, __thunderid_browser.withVendorCSSClassPrefix)("signup"),
|
|
@@ -10784,8 +11310,11 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10784
11310
|
components: currentFlow.value?.data?.components || [],
|
|
10785
11311
|
error: apiError.value,
|
|
10786
11312
|
fieldErrors: formErrors.value,
|
|
11313
|
+
flowExpiryRedirect: flowExpiryRedirect.value,
|
|
10787
11314
|
handleInputChange,
|
|
10788
11315
|
handleSubmit,
|
|
11316
|
+
isFlowExpired: isFlowExpired.value,
|
|
11317
|
+
isFlowRestarted: isFlowRestarted.value,
|
|
10789
11318
|
isLoading: isLoading.value,
|
|
10790
11319
|
isValid: isFormValid.value,
|
|
10791
11320
|
messages: flowMessages.value,
|
|
@@ -10803,6 +11332,13 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10803
11332
|
};
|
|
10804
11333
|
return (0, vue.h)("div", { class: containerClass }, slots["default"](renderProps));
|
|
10805
11334
|
}
|
|
11335
|
+
if (isFlowExpired.value) return (0, vue.h)(Card_default, {
|
|
11336
|
+
class: containerClass,
|
|
11337
|
+
variant: props.variant
|
|
11338
|
+
}, () => (0, vue.h)(FlowExpired_default, {
|
|
11339
|
+
onRestart: restartsInPlace.value ? restartFlow : void 0,
|
|
11340
|
+
redirect: flowExpiryRedirect.value
|
|
11341
|
+
}));
|
|
10806
11342
|
if (!isFlowInitialized.value && isLoading.value) return (0, vue.h)(Card_default, {
|
|
10807
11343
|
class: containerClass,
|
|
10808
11344
|
variant: props.variant
|
|
@@ -10833,6 +11369,7 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10833
11369
|
style: "margin-top: 0.25rem",
|
|
10834
11370
|
variant: "body1"
|
|
10835
11371
|
}, () => subtitle) : null]) : null,
|
|
11372
|
+
isFlowRestarted.value ? (0, vue.h)("div", { style: "padding: 0 1rem" }, (0, vue.h)(Alert_default, { severity: "info" }, () => t("flow.expired.restarted"))) : null,
|
|
10836
11373
|
props.error ? (0, vue.h)("div", { style: "padding: 0 1rem" }, (0, vue.h)(Alert_default, { variant: "error" }, () => props.error.message)) : null,
|
|
10837
11374
|
flowMessages.value.length > 0 ? (0, vue.h)("div", { style: "padding: 0 1rem" }, flowMessages.value.map((msg, i) => (0, vue.h)(Alert_default, {
|
|
10838
11375
|
key: i,
|
|
@@ -10853,6 +11390,10 @@ var BaseSignUp_default = BaseSignUp;
|
|
|
10853
11390
|
const SignUp = (0, vue.defineComponent)({
|
|
10854
11391
|
name: "SignUp",
|
|
10855
11392
|
props: {
|
|
11393
|
+
afterFlowExpiredUrl: {
|
|
11394
|
+
default: void 0,
|
|
11395
|
+
type: String
|
|
11396
|
+
},
|
|
10856
11397
|
afterSignUpUrl: {
|
|
10857
11398
|
default: void 0,
|
|
10858
11399
|
type: String
|
|
@@ -10929,6 +11470,7 @@ const SignUp = (0, vue.defineComponent)({
|
|
|
10929
11470
|
if (props.shouldRedirectAfterSignUp && response?.type === __thunderid_browser.EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL && !response.data.redirectURL.includes("oauth") && !response.data.redirectURL.includes("auth")) window.location.href = response.data.redirectURL;
|
|
10930
11471
|
};
|
|
10931
11472
|
return () => (0, vue.h)(BaseSignUp_default, {
|
|
11473
|
+
afterFlowExpiredUrl: props.afterFlowExpiredUrl,
|
|
10932
11474
|
afterSignUpUrl: props.afterSignUpUrl,
|
|
10933
11475
|
buttonClassName: props.buttonClassName,
|
|
10934
11476
|
className: props.className,
|
|
@@ -11188,7 +11730,6 @@ const AVATAR_GRADIENTS$1 = [
|
|
|
11188
11730
|
"linear-gradient(135deg, #f97316 0%, #ec4899 100%)"
|
|
11189
11731
|
];
|
|
11190
11732
|
const isVerificationType = (type) => !!type && __thunderid_browser.AttributeVerificationConstants.VERIFIABLE_ATTRIBUTE_TYPES.includes(type.toLowerCase());
|
|
11191
|
-
const isVerifiedAfterSave = (type) => !!type && __thunderid_browser.AttributeVerificationConstants.VERIFY_AFTER_SAVE_ATTRIBUTE_TYPES.includes(type.toLowerCase());
|
|
11192
11733
|
const storedValueOf = (user, name) => {
|
|
11193
11734
|
return (user?.["attributes"])?.[name] ?? user?.[name];
|
|
11194
11735
|
};
|
|
@@ -11332,26 +11873,8 @@ const BaseUserProfile = (0, vue.defineComponent)({
|
|
|
11332
11873
|
focusBeforeDialog = null;
|
|
11333
11874
|
}
|
|
11334
11875
|
});
|
|
11335
|
-
const pendingVerification = (0, vue.ref)(null);
|
|
11336
11876
|
const storedUser = () => props.flattenedProfile ?? props.profile ?? null;
|
|
11337
11877
|
const reportedVerifiedAttributes = () => (0, __thunderid_browser.getVerifiedAttributes)(props.profile ?? props.flattenedProfile);
|
|
11338
|
-
(0, vue.watch)(() => [
|
|
11339
|
-
props.profile,
|
|
11340
|
-
props.flattenedProfile,
|
|
11341
|
-
props.error
|
|
11342
|
-
], () => {
|
|
11343
|
-
const pending = pendingVerification.value;
|
|
11344
|
-
if (!pending) return;
|
|
11345
|
-
if (props.error) {
|
|
11346
|
-
pendingVerification.value = null;
|
|
11347
|
-
return;
|
|
11348
|
-
}
|
|
11349
|
-
const storedValue = storedValueOf(storedUser(), pending.name);
|
|
11350
|
-
if (storedValue === pending.previousValue) return;
|
|
11351
|
-
const verified = reportedVerifiedAttributes();
|
|
11352
|
-
if (verified && typeof storedValue === "string" && storedValue.trim() !== "" && !verified[pending.name]) openVerification(pending.name);
|
|
11353
|
-
pendingVerification.value = null;
|
|
11354
|
-
});
|
|
11355
11878
|
function shouldShowField(fieldName, isSchemaBased = false) {
|
|
11356
11879
|
if (!isSchemaBased && FIELDS_TO_SKIP.includes(fieldName)) return false;
|
|
11357
11880
|
if (props.hideFields && props.hideFields.length > 0 && props.hideFields.includes(fieldName)) return false;
|
|
@@ -11429,13 +11952,7 @@ const BaseUserProfile = (0, vue.defineComponent)({
|
|
|
11429
11952
|
...fieldErrors.value,
|
|
11430
11953
|
[fieldName]: ""
|
|
11431
11954
|
};
|
|
11432
|
-
const
|
|
11433
|
-
const payload = buildPatchValue(fieldName, submitVal, schema.schemaId, schema.multiValued);
|
|
11434
|
-
const previousValue = storedValueOf(storedUser(), fieldName);
|
|
11435
|
-
pendingVerification.value = slots["verification"] && isVerifiedAfterSave(schema.type) && (0, __thunderid_browser.isVerifiableAttribute)(props.userSchema, fieldName) && typeof submitVal === "string" && submitVal !== "" && submitVal !== previousValue ? {
|
|
11436
|
-
name: fieldName,
|
|
11437
|
-
previousValue
|
|
11438
|
-
} : null;
|
|
11955
|
+
const payload = buildPatchValue(fieldName, typeof value === "string" ? strVal : value, schema.schemaId, schema.multiValued);
|
|
11439
11956
|
try {
|
|
11440
11957
|
await props.onUpdate(payload);
|
|
11441
11958
|
editingFields.value = {
|
|
@@ -11443,9 +11960,7 @@ const BaseUserProfile = (0, vue.defineComponent)({
|
|
|
11443
11960
|
[fieldName]: false
|
|
11444
11961
|
};
|
|
11445
11962
|
clearEditedValue(fieldName);
|
|
11446
|
-
} catch {
|
|
11447
|
-
pendingVerification.value = null;
|
|
11448
|
-
}
|
|
11963
|
+
} catch {}
|
|
11449
11964
|
}
|
|
11450
11965
|
function renderVerificationStatus(name) {
|
|
11451
11966
|
const verification = reportedVerifiedAttributes()?.[name];
|
|
@@ -12143,20 +12658,21 @@ const BaseVerifyAttribute = (0, vue.defineComponent)({
|
|
|
12143
12658
|
t,
|
|
12144
12659
|
variant: props.variant
|
|
12145
12660
|
}).map((node) => withFlowTestIds(node, flowIds))) : null,
|
|
12146
|
-
props.onCancel || showDone ? (0, vue.h)("div", { class: px("verify-attribute__actions") }, [
|
|
12147
|
-
color: "primary",
|
|
12148
|
-
"data-testid": "thunderid-action-verificationDone",
|
|
12149
|
-
onClick: () => props.onDone?.(),
|
|
12150
|
-
size: "small",
|
|
12151
|
-
variant: "solid"
|
|
12152
|
-
}, () => t("user.verification.buttons.done.text")) : null, props.onCancel ? (0, vue.h)(Button_default, {
|
|
12661
|
+
props.onCancel || showDone ? (0, vue.h)("div", { class: px("verify-attribute__actions") }, [props.onCancel ? (0, vue.h)(Button_default, {
|
|
12153
12662
|
color: "secondary",
|
|
12154
12663
|
"data-testid": "thunderid-action-verificationCancel",
|
|
12155
12664
|
disabled: isSubmitting.value,
|
|
12156
12665
|
onClick: () => props.onCancel?.(),
|
|
12157
12666
|
size: "small",
|
|
12158
|
-
|
|
12159
|
-
|
|
12667
|
+
type: "button",
|
|
12668
|
+
variant: "text"
|
|
12669
|
+
}, () => state.value === "active" || state.value === "loading" ? t("user.verification.buttons.cancel.text") : t("user.verification.buttons.close.text")) : null, showDone ? (0, vue.h)(Button_default, {
|
|
12670
|
+
color: "primary",
|
|
12671
|
+
"data-testid": "thunderid-action-verificationDone",
|
|
12672
|
+
onClick: () => props.onDone?.(),
|
|
12673
|
+
size: "small",
|
|
12674
|
+
variant: "solid"
|
|
12675
|
+
}, () => t("user.verification.buttons.done.text")) : null]) : null
|
|
12160
12676
|
]);
|
|
12161
12677
|
};
|
|
12162
12678
|
}
|
|
@@ -16049,6 +16565,10 @@ const BaseUserDetails = (0, vue.defineComponent)({
|
|
|
16049
16565
|
default: false,
|
|
16050
16566
|
type: Boolean
|
|
16051
16567
|
},
|
|
16568
|
+
isSendingVerification: {
|
|
16569
|
+
default: false,
|
|
16570
|
+
type: Boolean
|
|
16571
|
+
},
|
|
16052
16572
|
isUpdating: {
|
|
16053
16573
|
default: false,
|
|
16054
16574
|
type: Boolean
|
|
@@ -16065,6 +16585,10 @@ const BaseUserDetails = (0, vue.defineComponent)({
|
|
|
16065
16585
|
default: void 0,
|
|
16066
16586
|
type: Function
|
|
16067
16587
|
},
|
|
16588
|
+
onSendVerification: {
|
|
16589
|
+
default: void 0,
|
|
16590
|
+
type: Function
|
|
16591
|
+
},
|
|
16068
16592
|
onUpdate: {
|
|
16069
16593
|
default: void 0,
|
|
16070
16594
|
type: Function
|
|
@@ -16073,17 +16597,29 @@ const BaseUserDetails = (0, vue.defineComponent)({
|
|
|
16073
16597
|
default: void 0,
|
|
16074
16598
|
type: Object
|
|
16075
16599
|
},
|
|
16600
|
+
sentVerification: {
|
|
16601
|
+
default: null,
|
|
16602
|
+
type: Object
|
|
16603
|
+
},
|
|
16076
16604
|
user: {
|
|
16077
16605
|
default: void 0,
|
|
16078
16606
|
type: Object
|
|
16607
|
+
},
|
|
16608
|
+
userSchema: {
|
|
16609
|
+
default: void 0,
|
|
16610
|
+
type: Object
|
|
16079
16611
|
}
|
|
16080
16612
|
},
|
|
16081
16613
|
setup(props, { slots }) {
|
|
16082
16614
|
const t = useAdminTranslation_default(() => props.preferences);
|
|
16083
16615
|
const uid = (0, vue.useId)();
|
|
16084
16616
|
const draft = (0, vue.ref)(null);
|
|
16617
|
+
const sendingAttribute = (0, vue.ref)(null);
|
|
16085
16618
|
return () => {
|
|
16086
16619
|
const { user } = props;
|
|
16620
|
+
const visibleAttributeNames = Object.keys(user?.attributes ?? {}).filter((name) => !props.hiddenAttributes.includes(name));
|
|
16621
|
+
const verifiableAttributes = visibleAttributeNames.filter((name) => (0, __thunderid_browser.isAdminVerifiableAttribute)(user, name, props.userSchema));
|
|
16622
|
+
const verificationStatusAttributes = visibleAttributeNames.filter((name) => (0, __thunderid_browser.hasAdminVerificationStatus)(user, name, props.userSchema));
|
|
16087
16623
|
if (slots["default"]) {
|
|
16088
16624
|
const isWritable = Boolean(user) && !user?.isReadOnly;
|
|
16089
16625
|
const renderProps = {
|
|
@@ -16094,12 +16630,20 @@ const BaseUserDetails = (0, vue.defineComponent)({
|
|
|
16094
16630
|
isDeleting: props.isDeleting,
|
|
16095
16631
|
isLoading: props.isLoading,
|
|
16096
16632
|
isRunningLifecycleAction: props.isRunningLifecycleAction,
|
|
16633
|
+
isSendingVerification: props.isSendingVerification,
|
|
16097
16634
|
isUpdating: props.isUpdating,
|
|
16098
16635
|
lifecycleActions: props.onLifecycleAction && user ? props.lifecycleActions : [],
|
|
16099
16636
|
onDelete: isWritable ? props.onDelete : void 0,
|
|
16100
16637
|
onLifecycleAction: user ? props.onLifecycleAction : void 0,
|
|
16638
|
+
onSendVerification: isWritable && !props.isUpdating && props.onSendVerification ? (name) => {
|
|
16639
|
+
if (verifiableAttributes.includes(name) && !user?.verifiedAttributes?.[name]) props.onSendVerification?.(name);
|
|
16640
|
+
} : void 0,
|
|
16101
16641
|
onUpdate: isWritable ? props.onUpdate : void 0,
|
|
16102
|
-
|
|
16642
|
+
sentVerification: props.sentVerification,
|
|
16643
|
+
user,
|
|
16644
|
+
verifiableAttributes,
|
|
16645
|
+
verificationStatusAttributes,
|
|
16646
|
+
verifiedAttributes: user?.verifiedAttributes
|
|
16103
16647
|
};
|
|
16104
16648
|
return (0, vue.h)("div", { class: props.className }, slots["default"](renderProps));
|
|
16105
16649
|
}
|
|
@@ -16121,6 +16665,26 @@ const BaseUserDetails = (0, vue.defineComponent)({
|
|
|
16121
16665
|
const attributes = Object.entries(user.attributes ?? {}).filter(([name]) => !props.hiddenAttributes.includes(name));
|
|
16122
16666
|
const editableAttributes = attributes.filter((entry) => typeof entry[1] === "string");
|
|
16123
16667
|
const canEdit = Boolean(props.onUpdate) && !user.isReadOnly && editableAttributes.length > 0;
|
|
16668
|
+
const renderVerificationStatus = (name) => {
|
|
16669
|
+
const isVerified = user.verifiedAttributes?.[name] !== void 0;
|
|
16670
|
+
return (0, vue.h)("span", { class: [cls$10("status-chip"), isVerified ? cls$10("status-chip--success") : cls$10("status-chip--warning")] }, [(0, vue.h)(isVerified ? CircleCheckIcon : CircleAlertIcon, { "aria-hidden": "true" }), isVerified ? t("admin.users.details.verification.status.verified") : t("admin.users.details.verification.status.unverified")]);
|
|
16671
|
+
};
|
|
16672
|
+
const renderAttributeValue = (name, value) => {
|
|
16673
|
+
if (!verificationStatusAttributes.includes(name)) return stringify(value);
|
|
16674
|
+
const canSend = props.onSendVerification && !user.isReadOnly && verifiableAttributes.includes(name) && user.verifiedAttributes?.[name] === void 0;
|
|
16675
|
+
return (0, vue.h)("span", { class: cls$10("verification-row") }, [(0, vue.h)("span", { class: cls$10("verification-value") }, [(0, vue.h)("span", stringify(value)), renderVerificationStatus(name)]), canSend ? (0, vue.h)(Button_default, {
|
|
16676
|
+
"aria-label": `${t("admin.users.details.verification.verify")} ${name}`,
|
|
16677
|
+
disabled: props.isSendingVerification || props.isUpdating,
|
|
16678
|
+
loading: props.isSendingVerification && sendingAttribute.value === name,
|
|
16679
|
+
onClick: () => {
|
|
16680
|
+
sendingAttribute.value = name;
|
|
16681
|
+
props.onSendVerification?.(name);
|
|
16682
|
+
},
|
|
16683
|
+
size: "small",
|
|
16684
|
+
startIcon: (0, vue.h)(SendIcon, { "aria-hidden": "true" }),
|
|
16685
|
+
variant: "text"
|
|
16686
|
+
}, { default: () => t("admin.users.details.verification.verify") }) : null]);
|
|
16687
|
+
};
|
|
16124
16688
|
const renderAttributes = () => {
|
|
16125
16689
|
if (draft.value) {
|
|
16126
16690
|
const current = draft.value;
|
|
@@ -16160,7 +16724,7 @@ const BaseUserDetails = (0, vue.defineComponent)({
|
|
|
16160
16724
|
}
|
|
16161
16725
|
if (attributes.length > 0) return (0, vue.h)(DetailList_default, { items: attributes.map(([name, value]) => ({
|
|
16162
16726
|
label: name,
|
|
16163
|
-
value:
|
|
16727
|
+
value: renderAttributeValue(name, value)
|
|
16164
16728
|
})) });
|
|
16165
16729
|
return (0, vue.h)("span", { class: cls$10("muted") }, t("admin.users.details.no_attributes"));
|
|
16166
16730
|
};
|
|
@@ -16189,6 +16753,7 @@ const BaseUserDetails = (0, vue.defineComponent)({
|
|
|
16189
16753
|
],
|
|
16190
16754
|
default: () => [
|
|
16191
16755
|
props.error ? (0, vue.h)(Alert_default, { severity: "error" }, { default: () => [props.error] }) : null,
|
|
16756
|
+
props.sentVerification && !props.error ? (0, vue.h)(Alert_default, { severity: props.sentVerification.emailSent === false ? "error" : "success" }, { default: () => [props.sentVerification?.emailSent === false ? t("admin.users.details.verification.error") : props.sentVerification?.maskedDestination ? t("admin.users.details.verification.sent", { destination: props.sentVerification.maskedDestination }) : t("admin.users.details.verification.sent_generic")] }) : null,
|
|
16192
16757
|
(0, vue.h)("div", { class: cls$10("row") }, [
|
|
16193
16758
|
(0, vue.h)(AdminAvatar_default, {
|
|
16194
16759
|
name: displayName,
|
|
@@ -16278,7 +16843,8 @@ var useAccountLifecycle_default = useAccountLifecycle;
|
|
|
16278
16843
|
//#region src/components/management/UserDetails/UserDetails.ts
|
|
16279
16844
|
/**
|
|
16280
16845
|
* Shows a user and the groups they belong to, and optionally lets the signed-in user edit or delete
|
|
16281
|
-
* them. Emits `deleted` after
|
|
16846
|
+
* them, run account lifecycle actions or send them a link to verify their email. Emits `deleted` after
|
|
16847
|
+
* the user has been deleted.
|
|
16282
16848
|
*
|
|
16283
16849
|
* Slots: `actions`, rendered next to the user's name.
|
|
16284
16850
|
*
|
|
@@ -16294,6 +16860,10 @@ const UserDetails = (0, vue.defineComponent)({
|
|
|
16294
16860
|
default: void 0,
|
|
16295
16861
|
type: String
|
|
16296
16862
|
},
|
|
16863
|
+
attributeVerification: {
|
|
16864
|
+
default: false,
|
|
16865
|
+
type: Boolean
|
|
16866
|
+
},
|
|
16297
16867
|
className: {
|
|
16298
16868
|
default: "",
|
|
16299
16869
|
type: String
|
|
@@ -16333,6 +16903,13 @@ const UserDetails = (0, vue.defineComponent)({
|
|
|
16333
16903
|
fetcher,
|
|
16334
16904
|
userId: props.userId
|
|
16335
16905
|
}), { enabled: hasUserId });
|
|
16906
|
+
const userTypesEndpoint = useManagementEndpoint_default("userTypes");
|
|
16907
|
+
const typeHandle = () => user.data.value?.id === props.userId ? user.data.value.type : void 0;
|
|
16908
|
+
const userType = useResourceQuery_default(() => [__thunderid_browser.UserQueryKeys.USER_TYPES, { handle: typeHandle() }], (fetcher) => (0, __thunderid_browser.getUserTypeByHandle)({
|
|
16909
|
+
...userTypesEndpoint,
|
|
16910
|
+
fetcher,
|
|
16911
|
+
handle: typeHandle()
|
|
16912
|
+
}), { enabled: () => props.attributeVerification && Boolean(typeHandle() && user.data.value?.verifiedAttributes) });
|
|
16336
16913
|
const groups = useResourceQuery_default(() => [
|
|
16337
16914
|
__thunderid_browser.GroupQueryKeys.MEMBERSHIPS,
|
|
16338
16915
|
"user",
|
|
@@ -16356,6 +16933,20 @@ const UserDetails = (0, vue.defineComponent)({
|
|
|
16356
16933
|
payload: data,
|
|
16357
16934
|
userId
|
|
16358
16935
|
}), ({ userId }) => [[__thunderid_browser.UserQueryKeys.USER, userId], [__thunderid_browser.UserQueryKeys.USERS]]);
|
|
16936
|
+
const { baseUrl } = useThunderID_default();
|
|
16937
|
+
const verificationFlow = useResourceQuery_default(() => ["administration-flows", "attribute-verification"], (fetcher) => (0, __thunderid_browser.resolveAdministrationFlowHandles)({
|
|
16938
|
+
baseUrl,
|
|
16939
|
+
fetcher
|
|
16940
|
+
}, [__thunderid_browser.AdministrationFlowConfigKey.ADMIN_ATTRIBUTE_VERIFICATION]), { enabled: () => props.attributeVerification });
|
|
16941
|
+
const verificationHandle = () => verificationFlow.data.value?.[__thunderid_browser.AdministrationFlowConfigKey.ADMIN_ATTRIBUTE_VERIFICATION];
|
|
16942
|
+
const verificationTarget = (0, vue.shallowRef)(null);
|
|
16943
|
+
const verification = useResourceMutation_default(({ attribute, userId }, fetcher) => (0, __thunderid_browser.sendUserAttributeVerification)({
|
|
16944
|
+
...endpoint,
|
|
16945
|
+
attribute,
|
|
16946
|
+
fetcher,
|
|
16947
|
+
handle: verificationHandle(),
|
|
16948
|
+
userId
|
|
16949
|
+
}), ({ userId }) => [[__thunderid_browser.UserQueryKeys.USER, userId]]);
|
|
16359
16950
|
const lifecycle = useAccountLifecycle_default({
|
|
16360
16951
|
enabled: () => props.lifecycleActions,
|
|
16361
16952
|
invalidatedKeys: () => [[__thunderid_browser.UserQueryKeys.USER, props.userId], [__thunderid_browser.UserQueryKeys.USERS]],
|
|
@@ -16365,18 +16956,32 @@ const UserDetails = (0, vue.defineComponent)({
|
|
|
16365
16956
|
});
|
|
16366
16957
|
return () => {
|
|
16367
16958
|
const current = user.data.value;
|
|
16959
|
+
const userSchema = userType.data.value?.handle === typeHandle() ? userType.data.value?.schema : void 0;
|
|
16960
|
+
const target = verificationTarget.value;
|
|
16961
|
+
const showVerificationResult = props.attributeVerification && target?.userId === props.userId && current?.attributes?.[target.attribute] === target.value;
|
|
16368
16962
|
return (0, vue.h)(BaseUserDetails_default, {
|
|
16369
16963
|
className: props.className,
|
|
16370
|
-
error: (0, __thunderid_browser.toManagementErrorMessage)(t, user.error.value, "admin.users.details.error") ?? (0, __thunderid_browser.toManagementErrorMessage)(t, deletion.error.value, "admin.users.details.delete.error") ?? (0, __thunderid_browser.toManagementErrorMessage)(t, update.error.value, "admin.users.details.edit.error") ?? (0, __thunderid_browser.toManagementErrorMessage)(t, lifecycle.error.value, "admin.common.lifecycle.error") ?? (0, __thunderid_browser.toManagementErrorMessage)(t, lifecycle.loadError.value, "admin.common.lifecycle.load_error"),
|
|
16964
|
+
error: (0, __thunderid_browser.toManagementErrorMessage)(t, user.error.value, "admin.users.details.error") ?? (0, __thunderid_browser.toManagementErrorMessage)(t, deletion.error.value, "admin.users.details.delete.error") ?? (0, __thunderid_browser.toManagementErrorMessage)(t, update.error.value, "admin.users.details.edit.error") ?? (0, __thunderid_browser.toManagementErrorMessage)(t, showVerificationResult ? verification.error.value : null, "admin.users.details.verification.error") ?? (0, __thunderid_browser.toManagementErrorMessage)(t, lifecycle.error.value, "admin.common.lifecycle.error") ?? (0, __thunderid_browser.toManagementErrorMessage)(t, lifecycle.loadError.value, "admin.common.lifecycle.load_error") ?? (0, __thunderid_browser.toManagementErrorMessage)(t, verificationFlow.error.value ?? userType.error.value, "admin.users.details.verification.load_error"),
|
|
16371
16965
|
groups: groups.data.value?.groups ?? [],
|
|
16372
16966
|
hiddenAttributes: props.hiddenAttributes,
|
|
16373
16967
|
isDeleting: deletion.isLoading.value,
|
|
16374
16968
|
isLoading: user.isLoading.value,
|
|
16375
16969
|
isRunningLifecycleAction: lifecycle.isRunning.value,
|
|
16970
|
+
isSendingVerification: verification.isLoading.value,
|
|
16376
16971
|
isUpdating: update.isLoading.value,
|
|
16377
16972
|
lifecycleActions: lifecycle.actions.value,
|
|
16378
16973
|
onDelete: props.deletable ? () => void deletion.mutate(props.userId) : void 0,
|
|
16379
16974
|
onLifecycleAction: props.lifecycleActions ? lifecycle.run : void 0,
|
|
16975
|
+
onSendVerification: props.attributeVerification && verificationHandle() && userSchema && current?.id === props.userId ? (attribute) => {
|
|
16976
|
+
const target$1 = {
|
|
16977
|
+
attribute,
|
|
16978
|
+
userId: props.userId,
|
|
16979
|
+
value: current?.attributes?.[attribute]
|
|
16980
|
+
};
|
|
16981
|
+
verificationTarget.value = target$1;
|
|
16982
|
+
verification.reset();
|
|
16983
|
+
verification.mutate(target$1);
|
|
16984
|
+
} : void 0,
|
|
16380
16985
|
onUpdate: props.editable && current ? (attributes) => void update.mutate({
|
|
16381
16986
|
data: {
|
|
16382
16987
|
attributes,
|
|
@@ -16386,7 +16991,9 @@ const UserDetails = (0, vue.defineComponent)({
|
|
|
16386
16991
|
userId: props.userId
|
|
16387
16992
|
}) : void 0,
|
|
16388
16993
|
preferences: props.preferences,
|
|
16389
|
-
|
|
16994
|
+
sentVerification: showVerificationResult ? verification.data.value ?? null : null,
|
|
16995
|
+
user: current,
|
|
16996
|
+
userSchema
|
|
16390
16997
|
}, { ...slots });
|
|
16391
16998
|
};
|
|
16392
16999
|
}
|
|
@@ -21836,6 +22443,7 @@ Object.defineProperty(exports, 'FieldType', {
|
|
|
21836
22443
|
return __thunderid_browser.FieldType;
|
|
21837
22444
|
}
|
|
21838
22445
|
});
|
|
22446
|
+
exports.FlowExpired = FlowExpired_default;
|
|
21839
22447
|
exports.FlowMetaProvider = FlowMetaProvider_default;
|
|
21840
22448
|
exports.FlowProvider = FlowProvider_default;
|
|
21841
22449
|
exports.GitHubButton = GitHubButton_default;
|
|
@@ -23177,6 +23785,12 @@ Object.defineProperty(exports, 'runAdministrationFlow', {
|
|
|
23177
23785
|
return __thunderid_browser.runAdministrationFlow;
|
|
23178
23786
|
}
|
|
23179
23787
|
});
|
|
23788
|
+
Object.defineProperty(exports, 'sendUserAttributeVerification', {
|
|
23789
|
+
enumerable: true,
|
|
23790
|
+
get: function () {
|
|
23791
|
+
return __thunderid_browser.sendUserAttributeVerification;
|
|
23792
|
+
}
|
|
23793
|
+
});
|
|
23180
23794
|
Object.defineProperty(exports, 'setTranslation', {
|
|
23181
23795
|
enumerable: true,
|
|
23182
23796
|
get: function () {
|
|
@@ -23446,6 +24060,7 @@ exports.useFetchAuthFlows = useFetchAuthFlows_default;
|
|
|
23446
24060
|
exports.useFetchUserTypes = useFetchUserTypes_default;
|
|
23447
24061
|
exports.useFetchUsers = useFetchUsers_default;
|
|
23448
24062
|
exports.useFlow = useFlow_default;
|
|
24063
|
+
exports.useFlowExpiryHandling = useFlowExpiryHandling_default;
|
|
23449
24064
|
exports.useFlowMeta = useFlowMeta_default;
|
|
23450
24065
|
exports.useGrantedPermissions = useGrantedPermissions_default;
|
|
23451
24066
|
exports.useI18n = useI18n_default;
|