@thunderid/vue 1.18.0 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +529 -31
- 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/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 +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +529 -33
- 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) {
|
|
@@ -2999,6 +3002,56 @@ const CONSENT_CSS = `
|
|
|
2999
3002
|
`;
|
|
3000
3003
|
var Consent_css_default = CONSENT_CSS;
|
|
3001
3004
|
|
|
3005
|
+
//#endregion
|
|
3006
|
+
//#region src/components/auth/flow/FlowExpired.css.ts
|
|
3007
|
+
const FLOW_EXPIRED_CSS = `
|
|
3008
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired")} {
|
|
3009
|
+
align-items: center;
|
|
3010
|
+
display: flex;
|
|
3011
|
+
flex-direction: column;
|
|
3012
|
+
gap: calc(var(--thunderid-spacing-unit) * 1.5);
|
|
3013
|
+
padding-block: var(--thunderid-spacing-unit);
|
|
3014
|
+
text-align: center;
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3017
|
+
/* Focused only for a screen reader to read it, so it shows no ring. It is not a control. */
|
|
3018
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired")}:focus {
|
|
3019
|
+
outline: none;
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__icon")} {
|
|
3023
|
+
color: var(--thunderid-color-warning-main);
|
|
3024
|
+
display: flex;
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__action")} {
|
|
3028
|
+
margin-top: var(--thunderid-spacing-unit);
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
/* Keeps the text on one line, with its own spaces. */
|
|
3032
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__link")} {
|
|
3033
|
+
color: var(--thunderid-color-primary-main);
|
|
3034
|
+
display: inline-flex;
|
|
3035
|
+
font-weight: var(--thunderid-typography-fontWeight-semibold);
|
|
3036
|
+
margin-top: var(--thunderid-spacing-unit);
|
|
3037
|
+
max-width: 100%;
|
|
3038
|
+
text-decoration: none;
|
|
3039
|
+
white-space: pre;
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__link")}:hover {
|
|
3043
|
+
text-decoration: underline;
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
.${(0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__name")} {
|
|
3047
|
+
min-width: 0;
|
|
3048
|
+
overflow: hidden;
|
|
3049
|
+
text-overflow: ellipsis;
|
|
3050
|
+
white-space: nowrap;
|
|
3051
|
+
}
|
|
3052
|
+
`;
|
|
3053
|
+
var FlowExpired_css_default = FLOW_EXPIRED_CSS;
|
|
3054
|
+
|
|
3002
3055
|
//#endregion
|
|
3003
3056
|
//#region src/components/auth/sign-in/BaseSignIn.css.ts
|
|
3004
3057
|
/**
|
|
@@ -4723,6 +4776,7 @@ const STYLES = [
|
|
|
4723
4776
|
DataTable_css_default,
|
|
4724
4777
|
BaseSignIn_css_default,
|
|
4725
4778
|
Consent_css_default,
|
|
4779
|
+
FlowExpired_css_default,
|
|
4726
4780
|
BaseDeviceGrant_css_default,
|
|
4727
4781
|
ChangeCredential_css_default,
|
|
4728
4782
|
OrganizationUnitSwitcher_css_default,
|
|
@@ -5097,6 +5151,201 @@ const useFetchAuthFlows = () => {
|
|
|
5097
5151
|
};
|
|
5098
5152
|
var useFetchAuthFlows_default = useFetchAuthFlows;
|
|
5099
5153
|
|
|
5154
|
+
//#endregion
|
|
5155
|
+
//#region src/composables/auth/useFlowExpiry.ts
|
|
5156
|
+
const MAX_TIMEOUT_MS = 2147483647;
|
|
5157
|
+
/**
|
|
5158
|
+
* Expiry of a flow execution, from the `expiresIn` of its latest step response or a refusal the caller
|
|
5159
|
+
* reports with `expireFlow()`. `expiresIn` is counted from when the response arrived, on this device's own
|
|
5160
|
+
* clock, so a device clock that differs from the server's does not move the expiry. The expiry is raised
|
|
5161
|
+
* when that time passes, and re-checked when the page becomes visible again, since a timer can fire late in
|
|
5162
|
+
* a background tab or after the device sleeps. It is keyed to `step`, so a new step response clears it.
|
|
5163
|
+
*
|
|
5164
|
+
* @param step - The latest step response, a new object for each response. Null or undefined before one.
|
|
5165
|
+
*/
|
|
5166
|
+
const useFlowExpiry = (step) => {
|
|
5167
|
+
const expiredFor = (0, vue.shallowRef)(null);
|
|
5168
|
+
const isFlowExpired = (0, vue.computed)(() => expiredFor.value !== null && expiredFor.value.step === (0, vue.toValue)(step));
|
|
5169
|
+
const expireFlow = () => {
|
|
5170
|
+
if (!isFlowExpired.value) expiredFor.value = { step: (0, vue.toValue)(step) };
|
|
5171
|
+
};
|
|
5172
|
+
const resetFlowExpiry = () => {
|
|
5173
|
+
expiredFor.value = null;
|
|
5174
|
+
};
|
|
5175
|
+
(0, vue.watch)(() => (0, vue.toValue)(step), (current, _previous, onCleanup) => {
|
|
5176
|
+
const expiresIn = current?.expiresIn;
|
|
5177
|
+
if (expiresIn === void 0) return;
|
|
5178
|
+
const delay = Math.max(expiresIn * 1e3, 0);
|
|
5179
|
+
const deadline = Date.now() + delay;
|
|
5180
|
+
const checkExpiry = () => {
|
|
5181
|
+
if (Date.now() >= deadline) expireFlow();
|
|
5182
|
+
};
|
|
5183
|
+
const onVisibilityChange = () => {
|
|
5184
|
+
if (document.visibilityState === "visible") checkExpiry();
|
|
5185
|
+
};
|
|
5186
|
+
const timerId = delay <= MAX_TIMEOUT_MS ? setTimeout(checkExpiry, delay) : void 0;
|
|
5187
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
5188
|
+
onCleanup(() => {
|
|
5189
|
+
clearTimeout(timerId);
|
|
5190
|
+
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
5191
|
+
});
|
|
5192
|
+
}, { immediate: true });
|
|
5193
|
+
return {
|
|
5194
|
+
expireFlow,
|
|
5195
|
+
expiry: (0, vue.computed)(() => isFlowExpired.value ? expiredFor.value : null),
|
|
5196
|
+
isFlowExpired,
|
|
5197
|
+
resetFlowExpiry
|
|
5198
|
+
};
|
|
5199
|
+
};
|
|
5200
|
+
var useFlowExpiry_default = useFlowExpiry;
|
|
5201
|
+
|
|
5202
|
+
//#endregion
|
|
5203
|
+
//#region src/composables/auth/useWhenUserPresent.ts
|
|
5204
|
+
/** Whether the user is looking at the page now, i.e. it is visible and has focus. */
|
|
5205
|
+
const isUserPresent = () => document.visibilityState === "visible" && document.hasFocus();
|
|
5206
|
+
/**
|
|
5207
|
+
* Runs `action` once while `enabled`, as soon as the user is on the page: at once when they already are, or
|
|
5208
|
+
* when they come back to the tab or the window. Lets an expired flow wait for the user before it acts, so a
|
|
5209
|
+
* user who left the tab still sees what happened.
|
|
5210
|
+
*
|
|
5211
|
+
* @param enabled - Whether to run the action. A change to `true` arms it again.
|
|
5212
|
+
* @param action - What to run. The latest one runs.
|
|
5213
|
+
*/
|
|
5214
|
+
const useWhenUserPresent = (enabled, action) => {
|
|
5215
|
+
(0, vue.watch)(() => (0, vue.toValue)(enabled), (isEnabled, _previous, onCleanup) => {
|
|
5216
|
+
if (!isEnabled) return;
|
|
5217
|
+
let done = false;
|
|
5218
|
+
const run = () => {
|
|
5219
|
+
if (!done) {
|
|
5220
|
+
done = true;
|
|
5221
|
+
action();
|
|
5222
|
+
}
|
|
5223
|
+
};
|
|
5224
|
+
const runOnReturn = () => {
|
|
5225
|
+
if (document.visibilityState === "visible") run();
|
|
5226
|
+
};
|
|
5227
|
+
const timerId = setTimeout(() => {
|
|
5228
|
+
if (isUserPresent()) run();
|
|
5229
|
+
}, 0);
|
|
5230
|
+
document.addEventListener("visibilitychange", runOnReturn);
|
|
5231
|
+
window.addEventListener("focus", runOnReturn);
|
|
5232
|
+
onCleanup(() => {
|
|
5233
|
+
clearTimeout(timerId);
|
|
5234
|
+
document.removeEventListener("visibilitychange", runOnReturn);
|
|
5235
|
+
window.removeEventListener("focus", runOnReturn);
|
|
5236
|
+
});
|
|
5237
|
+
}, { immediate: true });
|
|
5238
|
+
};
|
|
5239
|
+
var useWhenUserPresent_default = useWhenUserPresent;
|
|
5240
|
+
|
|
5241
|
+
//#endregion
|
|
5242
|
+
//#region src/composables/auth/useFlowExpiryRedirect.ts
|
|
5243
|
+
/** How long an expired flow counts down before it sends the user back to the application. */
|
|
5244
|
+
const FLOW_EXPIRY_REDIRECT_SECONDS = 10;
|
|
5245
|
+
/** How long the page waits after the redirect before it treats the redirect as not having happened. */
|
|
5246
|
+
const REDIRECT_FALLBACK_MS = 3e3;
|
|
5247
|
+
/**
|
|
5248
|
+
* Counts down and sends the user back to `url` once a flow expires. The countdown starts only while the user
|
|
5249
|
+
* is on the page, so a user who comes back to the tab still sees why they are being sent back. The state is
|
|
5250
|
+
* keyed to `expiry`, so a new expiry starts over.
|
|
5251
|
+
*
|
|
5252
|
+
* @param expiry - The expiry being handled, from `useFlowExpiry`, or null while the flow is active.
|
|
5253
|
+
* @param url - Where to send the user back to. Without it there is no redirect.
|
|
5254
|
+
* @returns The countdown, or null when there is nothing to count down.
|
|
5255
|
+
*/
|
|
5256
|
+
const useFlowExpiryRedirect = (expiry, url) => {
|
|
5257
|
+
const started = (0, vue.shallowRef)(null);
|
|
5258
|
+
const failedFor = (0, vue.shallowRef)(null);
|
|
5259
|
+
const now = (0, vue.ref)(Date.now());
|
|
5260
|
+
const isActive = (0, vue.computed)(() => (0, vue.toValue)(expiry) !== null && Boolean((0, vue.toValue)(url)));
|
|
5261
|
+
const isStarted = (0, vue.computed)(() => isActive.value && started.value !== null && started.value.expiry === (0, vue.toValue)(expiry));
|
|
5262
|
+
const isRedirectFailed = (0, vue.computed)(() => isActive.value && failedFor.value !== null && failedFor.value === (0, vue.toValue)(expiry));
|
|
5263
|
+
useWhenUserPresent_default(isActive, () => {
|
|
5264
|
+
const current = (0, vue.toValue)(expiry);
|
|
5265
|
+
if (current !== null) started.value = {
|
|
5266
|
+
at: Date.now(),
|
|
5267
|
+
expiry: current
|
|
5268
|
+
};
|
|
5269
|
+
});
|
|
5270
|
+
(0, vue.watch)([
|
|
5271
|
+
isStarted,
|
|
5272
|
+
started,
|
|
5273
|
+
() => (0, vue.toValue)(url)
|
|
5274
|
+
], (_values, _previous, onCleanup) => {
|
|
5275
|
+
const target = (0, vue.toValue)(url);
|
|
5276
|
+
if (!isStarted.value || started.value === null || !target) return;
|
|
5277
|
+
const { at, expiry: startedFor } = started.value;
|
|
5278
|
+
const intervalId = setInterval(() => {
|
|
5279
|
+
now.value = Date.now();
|
|
5280
|
+
}, 1e3);
|
|
5281
|
+
let fallbackId;
|
|
5282
|
+
const redirectId = setTimeout(() => {
|
|
5283
|
+
clearInterval(intervalId);
|
|
5284
|
+
now.value = Date.now();
|
|
5285
|
+
try {
|
|
5286
|
+
window.location.replace(target);
|
|
5287
|
+
} catch {
|
|
5288
|
+
failedFor.value = startedFor;
|
|
5289
|
+
return;
|
|
5290
|
+
}
|
|
5291
|
+
fallbackId = setTimeout(() => {
|
|
5292
|
+
failedFor.value = startedFor;
|
|
5293
|
+
}, REDIRECT_FALLBACK_MS);
|
|
5294
|
+
}, Math.max(at + FLOW_EXPIRY_REDIRECT_SECONDS * 1e3 - Date.now(), 0));
|
|
5295
|
+
onCleanup(() => {
|
|
5296
|
+
clearInterval(intervalId);
|
|
5297
|
+
clearTimeout(redirectId);
|
|
5298
|
+
clearTimeout(fallbackId);
|
|
5299
|
+
});
|
|
5300
|
+
}, { immediate: true });
|
|
5301
|
+
return (0, vue.computed)(() => {
|
|
5302
|
+
const target = (0, vue.toValue)(url);
|
|
5303
|
+
if (!isActive.value || !target) return null;
|
|
5304
|
+
const remainingMs = isStarted.value && started.value ? started.value.at + FLOW_EXPIRY_REDIRECT_SECONDS * 1e3 - now.value : Infinity;
|
|
5305
|
+
return {
|
|
5306
|
+
countdownSeconds: FLOW_EXPIRY_REDIRECT_SECONDS,
|
|
5307
|
+
isCountingDown: isStarted.value && !isRedirectFailed.value,
|
|
5308
|
+
isRedirectFailed: isRedirectFailed.value,
|
|
5309
|
+
secondsLeft: Math.min(Math.max(Math.ceil(remainingMs / 1e3), 0), FLOW_EXPIRY_REDIRECT_SECONDS),
|
|
5310
|
+
url: target
|
|
5311
|
+
};
|
|
5312
|
+
});
|
|
5313
|
+
};
|
|
5314
|
+
var useFlowExpiryRedirect_default = useFlowExpiryRedirect;
|
|
5315
|
+
|
|
5316
|
+
//#endregion
|
|
5317
|
+
//#region src/composables/auth/useFlowExpiryHandling.ts
|
|
5318
|
+
/**
|
|
5319
|
+
* What a flow component does once its execution expires. With `afterFlowExpiredUrl`, it counts down and sends
|
|
5320
|
+
* the user back there. Otherwise, when it can, it starts the flow again in place once the user is on the page,
|
|
5321
|
+
* and says so. When it can do neither, the user is left to go back to the application.
|
|
5322
|
+
*/
|
|
5323
|
+
const useFlowExpiryHandling = ({ afterFlowExpiredUrl = void 0, canRestart, restart, step = void 0 }) => {
|
|
5324
|
+
const { expireFlow, expiry, isFlowExpired, resetFlowExpiry } = useFlowExpiry_default(step);
|
|
5325
|
+
const flowExpiryRedirect = useFlowExpiryRedirect_default(expiry, () => (0, vue.toValue)(afterFlowExpiredUrl));
|
|
5326
|
+
const isFlowRestarted = (0, vue.ref)(false);
|
|
5327
|
+
const restartsInPlace = (0, vue.computed)(() => !(0, vue.toValue)(afterFlowExpiredUrl) && (0, vue.toValue)(canRestart));
|
|
5328
|
+
const restartFlow = () => {
|
|
5329
|
+
resetFlowExpiry();
|
|
5330
|
+
isFlowRestarted.value = true;
|
|
5331
|
+
restart();
|
|
5332
|
+
};
|
|
5333
|
+
const clearFlowRestarted = () => {
|
|
5334
|
+
isFlowRestarted.value = false;
|
|
5335
|
+
};
|
|
5336
|
+
useWhenUserPresent_default(() => isFlowExpired.value && restartsInPlace.value, restartFlow);
|
|
5337
|
+
return {
|
|
5338
|
+
clearFlowRestarted,
|
|
5339
|
+
expireFlow,
|
|
5340
|
+
flowExpiryRedirect,
|
|
5341
|
+
isFlowExpired,
|
|
5342
|
+
isFlowRestarted,
|
|
5343
|
+
restartFlow,
|
|
5344
|
+
restartsInPlace
|
|
5345
|
+
};
|
|
5346
|
+
};
|
|
5347
|
+
var useFlowExpiryHandling_default = useFlowExpiryHandling;
|
|
5348
|
+
|
|
5100
5349
|
//#endregion
|
|
5101
5350
|
//#region src/composables/management/useInfiniteOptions.ts
|
|
5102
5351
|
const logger$5 = (0, __thunderid_browser.createPackageComponentLogger)("@thunderid/vue", "useInfiniteOptions");
|
|
@@ -8971,6 +9220,113 @@ const renderInviteUserComponents = (components, formValues, touchedFields, formE
|
|
|
8971
9220
|
key: component.id || index
|
|
8972
9221
|
})).filter((v) => v !== null);
|
|
8973
9222
|
|
|
9223
|
+
//#endregion
|
|
9224
|
+
//#region src/components/auth/flow/FlowExpired.ts
|
|
9225
|
+
const APPLICATION_MARKER = "\0";
|
|
9226
|
+
const TimerIcon = () => (0, vue.h)("svg", {
|
|
9227
|
+
fill: "none",
|
|
9228
|
+
height: "44",
|
|
9229
|
+
stroke: "currentColor",
|
|
9230
|
+
"stroke-linecap": "round",
|
|
9231
|
+
"stroke-linejoin": "round",
|
|
9232
|
+
"stroke-width": "1.6",
|
|
9233
|
+
viewBox: "0 0 24 24",
|
|
9234
|
+
width: "44",
|
|
9235
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9236
|
+
}, [
|
|
9237
|
+
(0, vue.h)("line", {
|
|
9238
|
+
x1: "10",
|
|
9239
|
+
x2: "14",
|
|
9240
|
+
y1: "2",
|
|
9241
|
+
y2: "2"
|
|
9242
|
+
}),
|
|
9243
|
+
(0, vue.h)("line", {
|
|
9244
|
+
x1: "12",
|
|
9245
|
+
x2: "15",
|
|
9246
|
+
y1: "14",
|
|
9247
|
+
y2: "11"
|
|
9248
|
+
}),
|
|
9249
|
+
(0, vue.h)("circle", {
|
|
9250
|
+
cx: "12",
|
|
9251
|
+
cy: "14",
|
|
9252
|
+
r: "8"
|
|
9253
|
+
})
|
|
9254
|
+
]);
|
|
9255
|
+
/**
|
|
9256
|
+
* Shown in place of a sign-in or sign-up flow whose execution expired. The flow cannot continue, so it counts
|
|
9257
|
+
* down to the application, offers to start again, or tells the user to go back to the application.
|
|
9258
|
+
*/
|
|
9259
|
+
const FlowExpired = (0, vue.defineComponent)({
|
|
9260
|
+
name: "FlowExpired",
|
|
9261
|
+
props: {
|
|
9262
|
+
onRestart: {
|
|
9263
|
+
default: void 0,
|
|
9264
|
+
type: Function
|
|
9265
|
+
},
|
|
9266
|
+
redirect: {
|
|
9267
|
+
default: null,
|
|
9268
|
+
type: Object
|
|
9269
|
+
}
|
|
9270
|
+
},
|
|
9271
|
+
setup(props) {
|
|
9272
|
+
const { meta } = useFlowMeta_default();
|
|
9273
|
+
const { t } = useI18n_default();
|
|
9274
|
+
const rootRef = (0, vue.ref)(null);
|
|
9275
|
+
(0, vue.onMounted)(() => {
|
|
9276
|
+
rootRef.value?.focus();
|
|
9277
|
+
});
|
|
9278
|
+
return () => {
|
|
9279
|
+
const { redirect, onRestart } = props;
|
|
9280
|
+
const name = meta.value?.application?.name;
|
|
9281
|
+
const application = name !== void 0 && name !== "" ? name : t("flow.expired.application");
|
|
9282
|
+
const renderAction = () => {
|
|
9283
|
+
if (redirect) {
|
|
9284
|
+
const [before = "", after = ""] = t(redirect.isCountingDown ? "flow.expired.redirect.now" : "flow.expired.redirect.link", { application: APPLICATION_MARKER }).split(APPLICATION_MARKER);
|
|
9285
|
+
return (0, vue.h)("a", {
|
|
9286
|
+
class: (0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__link"),
|
|
9287
|
+
href: redirect.url
|
|
9288
|
+
}, [
|
|
9289
|
+
before,
|
|
9290
|
+
(0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__name") }, application),
|
|
9291
|
+
after
|
|
9292
|
+
]);
|
|
9293
|
+
}
|
|
9294
|
+
if (onRestart) return (0, vue.h)(Button_default, {
|
|
9295
|
+
class: (0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__action"),
|
|
9296
|
+
onClick: onRestart,
|
|
9297
|
+
variant: "outline"
|
|
9298
|
+
}, () => t("flow.expired.restart"));
|
|
9299
|
+
return null;
|
|
9300
|
+
};
|
|
9301
|
+
const description = () => {
|
|
9302
|
+
if (redirect?.isCountingDown) return t("flow.expired.redirecting", {
|
|
9303
|
+
application,
|
|
9304
|
+
seconds: redirect.secondsLeft
|
|
9305
|
+
});
|
|
9306
|
+
if (!redirect && onRestart) return t("flow.expired.restart.description");
|
|
9307
|
+
return t("flow.expired.return.description", { application });
|
|
9308
|
+
};
|
|
9309
|
+
return (0, vue.h)("div", {
|
|
9310
|
+
class: (0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired"),
|
|
9311
|
+
ref: rootRef,
|
|
9312
|
+
tabindex: -1
|
|
9313
|
+
}, [
|
|
9314
|
+
(0, vue.h)("span", {
|
|
9315
|
+
"aria-hidden": "true",
|
|
9316
|
+
class: (0, __thunderid_browser.withVendorCSSClassPrefix)("flow-expired__icon")
|
|
9317
|
+
}, [TimerIcon()]),
|
|
9318
|
+
(0, vue.h)(Typography_default, {
|
|
9319
|
+
component: "h1",
|
|
9320
|
+
variant: "h5"
|
|
9321
|
+
}, () => t("flow.expired.heading")),
|
|
9322
|
+
(0, vue.h)(Typography_default, { variant: "body1" }, () => description()),
|
|
9323
|
+
renderAction()
|
|
9324
|
+
]);
|
|
9325
|
+
};
|
|
9326
|
+
}
|
|
9327
|
+
});
|
|
9328
|
+
var FlowExpired_default = FlowExpired;
|
|
9329
|
+
|
|
8974
9330
|
//#endregion
|
|
8975
9331
|
//#region src/components/auth/sign-in/BaseSignIn.ts
|
|
8976
9332
|
const extractFormFields$1 = (flowComponents) => {
|
|
@@ -9035,6 +9391,10 @@ const BaseSignIn = (0, vue.defineComponent)({
|
|
|
9035
9391
|
default: "",
|
|
9036
9392
|
type: String
|
|
9037
9393
|
},
|
|
9394
|
+
flowExpiryRedirect: {
|
|
9395
|
+
default: null,
|
|
9396
|
+
type: Object
|
|
9397
|
+
},
|
|
9038
9398
|
inputClassName: {
|
|
9039
9399
|
default: "",
|
|
9040
9400
|
type: String
|
|
@@ -9043,6 +9403,14 @@ const BaseSignIn = (0, vue.defineComponent)({
|
|
|
9043
9403
|
default: () => ({}),
|
|
9044
9404
|
type: Object
|
|
9045
9405
|
},
|
|
9406
|
+
isFlowExpired: {
|
|
9407
|
+
default: false,
|
|
9408
|
+
type: Boolean
|
|
9409
|
+
},
|
|
9410
|
+
isFlowRestarted: {
|
|
9411
|
+
default: false,
|
|
9412
|
+
type: Boolean
|
|
9413
|
+
},
|
|
9046
9414
|
isLoading: {
|
|
9047
9415
|
default: false,
|
|
9048
9416
|
type: Boolean
|
|
@@ -9055,6 +9423,10 @@ const BaseSignIn = (0, vue.defineComponent)({
|
|
|
9055
9423
|
default: "",
|
|
9056
9424
|
type: String
|
|
9057
9425
|
},
|
|
9426
|
+
onRestart: {
|
|
9427
|
+
default: void 0,
|
|
9428
|
+
type: Function
|
|
9429
|
+
},
|
|
9058
9430
|
onSubmit: {
|
|
9059
9431
|
default: void 0,
|
|
9060
9432
|
type: Function
|
|
@@ -9257,6 +9629,13 @@ const BaseSignIn = (0, vue.defineComponent)({
|
|
|
9257
9629
|
class: [containerClass, attrs.class].filter(Boolean).join(" ")
|
|
9258
9630
|
}, slots["default"](renderProps));
|
|
9259
9631
|
}
|
|
9632
|
+
if (props.isFlowExpired) return (0, vue.h)(Card_default, {
|
|
9633
|
+
class: containerClass,
|
|
9634
|
+
variant: props.variant
|
|
9635
|
+
}, () => (0, vue.h)(FlowExpired_default, {
|
|
9636
|
+
onRestart: props.onRestart,
|
|
9637
|
+
redirect: props.flowExpiryRedirect
|
|
9638
|
+
}));
|
|
9260
9639
|
if (isLoading.value && (!props.components || props.components.length === 0)) return (0, vue.h)(Card_default, {
|
|
9261
9640
|
class: containerClass,
|
|
9262
9641
|
variant: props.variant
|
|
@@ -9271,10 +9650,14 @@ const BaseSignIn = (0, vue.defineComponent)({
|
|
|
9271
9650
|
...attrs,
|
|
9272
9651
|
class: [containerClass, attrs.class].filter(Boolean).join(" "),
|
|
9273
9652
|
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
|
-
|
|
9653
|
+
}, () => [(props.isFlowRestarted || externalError || messages.length > 0) && (0, vue.h)("div", { class: [(0, __thunderid_browser.withVendorCSSClassPrefix)("signin__messages"), props.messageClassName].filter(Boolean).join(" ") }, [
|
|
9654
|
+
props.isFlowRestarted && (0, vue.h)(Alert_default, { severity: "info" }, () => (0, vue.h)(Typography_default, { variant: "body2" }, () => t("flow.expired.restarted"))),
|
|
9655
|
+
externalError && (0, vue.h)(Alert_default, { severity: "error" }, () => (0, vue.h)(Typography_default, { variant: "body2" }, () => externalError.message)),
|
|
9656
|
+
...messages.map((msg, index) => (0, vue.h)(Alert_default, {
|
|
9657
|
+
key: index,
|
|
9658
|
+
severity: msg.type === "error" ? "error" : "info"
|
|
9659
|
+
}, () => (0, vue.h)(Typography_default, { variant: "body2" }, () => msg.message)))
|
|
9660
|
+
]), (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__content") }, renderComponents())]);
|
|
9278
9661
|
};
|
|
9279
9662
|
}
|
|
9280
9663
|
});
|
|
@@ -9414,6 +9797,10 @@ const handlePasskeyAuthentication = async (challengeData) => {
|
|
|
9414
9797
|
const SignIn = (0, vue.defineComponent)({
|
|
9415
9798
|
name: "SignIn",
|
|
9416
9799
|
props: {
|
|
9800
|
+
afterFlowExpiredUrl: {
|
|
9801
|
+
default: void 0,
|
|
9802
|
+
type: String
|
|
9803
|
+
},
|
|
9417
9804
|
className: {
|
|
9418
9805
|
default: "",
|
|
9419
9806
|
type: String
|
|
@@ -9454,6 +9841,17 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9454
9841
|
executionId: null,
|
|
9455
9842
|
isActive: false
|
|
9456
9843
|
});
|
|
9844
|
+
const flowExpiryStep = (0, vue.shallowRef)(null);
|
|
9845
|
+
const startedApplicationId = (0, vue.ref)(null);
|
|
9846
|
+
const isStartedByAuthorizeRequest = (0, vue.ref)(false);
|
|
9847
|
+
const { clearFlowRestarted, expireFlow, flowExpiryRedirect, isFlowExpired, isFlowRestarted, restartFlow, restartsInPlace } = useFlowExpiryHandling_default({
|
|
9848
|
+
afterFlowExpiredUrl: () => props.afterFlowExpiredUrl,
|
|
9849
|
+
canRestart: () => Boolean(applicationId || startedApplicationId.value) && !isStartedByAuthorizeRequest.value,
|
|
9850
|
+
restart: () => {
|
|
9851
|
+
startFlowAgain();
|
|
9852
|
+
},
|
|
9853
|
+
step: flowExpiryStep
|
|
9854
|
+
});
|
|
9457
9855
|
let initializationAttempted = false;
|
|
9458
9856
|
const oauthCodeProcessedFlag = { value: false };
|
|
9459
9857
|
let passkeyProcessed = false;
|
|
@@ -9523,6 +9921,18 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9523
9921
|
isFlowInitialized.value = true;
|
|
9524
9922
|
emit("error", flowError.value);
|
|
9525
9923
|
};
|
|
9924
|
+
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");
|
|
9925
|
+
/**
|
|
9926
|
+
* Marks the flow as expired. Unless the flow is started again in place, the error follows from the expiry,
|
|
9927
|
+
* set by the watcher below; once already expired, it is set again here since a new submission clears it.
|
|
9928
|
+
*/
|
|
9929
|
+
const handleFlowExpired = () => {
|
|
9930
|
+
if (isFlowExpired.value && !restartsInPlace.value) setError(sessionExpiredError);
|
|
9931
|
+
else expireFlow();
|
|
9932
|
+
};
|
|
9933
|
+
(0, vue.watch)(() => isFlowExpired.value && !restartsInPlace.value, (isExpiredForGood) => {
|
|
9934
|
+
if (isExpiredForGood) setError(sessionExpiredError);
|
|
9935
|
+
});
|
|
9526
9936
|
/**
|
|
9527
9937
|
* Updates challengeTokenRef immediately and persists via the provider's
|
|
9528
9938
|
* StorageManager so the token survives OAuth redirects.
|
|
@@ -9539,7 +9949,9 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9539
9949
|
const urlParams = getUrlParams$1();
|
|
9540
9950
|
oauthCodeProcessedFlag.value = false;
|
|
9541
9951
|
await storeAuthId(urlParams.authId, urlParams.executionId);
|
|
9542
|
-
const effectiveApplicationId = applicationId || urlParams.applicationId;
|
|
9952
|
+
const effectiveApplicationId = applicationId || urlParams.applicationId || startedApplicationId.value;
|
|
9953
|
+
if (effectiveApplicationId) startedApplicationId.value = effectiveApplicationId;
|
|
9954
|
+
if (urlParams.authId) isStartedByAuthorizeRequest.value = true;
|
|
9543
9955
|
if (!urlParams.executionId && !effectiveApplicationId) {
|
|
9544
9956
|
setError(new __thunderid_browser.ThunderIDRuntimeError("Either executionId or applicationId is required for authentication", "SIGN_IN_ERROR", "vue"));
|
|
9545
9957
|
return;
|
|
@@ -9571,16 +9983,31 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9571
9983
|
additionalData.value = normalizedAdditionalData ?? {};
|
|
9572
9984
|
isFlowInitialized.value = true;
|
|
9573
9985
|
isTimeoutDisabled.value = false;
|
|
9986
|
+
flowExpiryStep.value = { expiresIn: response.expiresIn };
|
|
9574
9987
|
await storeAuthId(urlParams.authId, normalizedExecutionId);
|
|
9575
9988
|
cleanupFlowUrlParams();
|
|
9576
9989
|
}
|
|
9577
9990
|
} catch (error) {
|
|
9991
|
+
if ((0, __thunderid_browser.isFlowExpiredError)(error)) {
|
|
9992
|
+
handleFlowExpired();
|
|
9993
|
+
return;
|
|
9994
|
+
}
|
|
9578
9995
|
const err = error;
|
|
9579
9996
|
clearFlowState();
|
|
9580
9997
|
setError(err);
|
|
9581
9998
|
initializationAttempted = false;
|
|
9582
9999
|
}
|
|
9583
10000
|
};
|
|
10001
|
+
/**
|
|
10002
|
+
* Starts an expired flow again for the application it was started for. The expired execution is dropped
|
|
10003
|
+
* from the URL and storage first, so the new flow does not resume it.
|
|
10004
|
+
*/
|
|
10005
|
+
const startFlowAgain = async () => {
|
|
10006
|
+
await clearFlowState();
|
|
10007
|
+
cleanupFlowUrlParams();
|
|
10008
|
+
flowExpiryStep.value = null;
|
|
10009
|
+
await initializeFlow();
|
|
10010
|
+
};
|
|
9584
10011
|
const handleSubmit = async (payload) => {
|
|
9585
10012
|
const effectiveExecutionId = payload.executionId || currentExecutionId.value;
|
|
9586
10013
|
if (!effectiveExecutionId) throw new Error("No active flow ID");
|
|
@@ -9604,6 +10031,7 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9604
10031
|
...isDeny ? { reason: __thunderid_browser.ConsentConstants.REASON_USER_DENIED } : {}
|
|
9605
10032
|
});
|
|
9606
10033
|
} catch {}
|
|
10034
|
+
clearFlowRestarted();
|
|
9607
10035
|
try {
|
|
9608
10036
|
isSubmitting.value = true;
|
|
9609
10037
|
flowErrorSource.value = null;
|
|
@@ -9665,12 +10093,17 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9665
10093
|
additionalData.value = normalizedAdditionalData ?? {};
|
|
9666
10094
|
isTimeoutDisabled.value = false;
|
|
9667
10095
|
isFlowInitialized.value = true;
|
|
10096
|
+
flowExpiryStep.value = { expiresIn: response.expiresIn };
|
|
9668
10097
|
cleanupFlowUrlParams();
|
|
9669
10098
|
if (response?.error) flowErrorSource.value = response;
|
|
9670
10099
|
}
|
|
9671
10100
|
} catch (error) {
|
|
9672
10101
|
const err = error;
|
|
9673
10102
|
if (err instanceof Error && flowError.value === err) throw err;
|
|
10103
|
+
if ((0, __thunderid_browser.isFlowExpiredError)(err)) {
|
|
10104
|
+
handleFlowExpired();
|
|
10105
|
+
return;
|
|
10106
|
+
}
|
|
9674
10107
|
clearFlowState();
|
|
9675
10108
|
setError(err);
|
|
9676
10109
|
} finally {
|
|
@@ -9798,7 +10231,10 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9798
10231
|
additionalData: additionalData.value,
|
|
9799
10232
|
components: components.value,
|
|
9800
10233
|
error: flowError.value,
|
|
10234
|
+
flowExpiryRedirect: flowExpiryRedirect.value,
|
|
9801
10235
|
initialize: initializeFlow,
|
|
10236
|
+
isFlowExpired: isFlowExpired.value,
|
|
10237
|
+
isFlowRestarted: isFlowRestarted.value,
|
|
9802
10238
|
isInitialized: isFlowInitialized.value,
|
|
9803
10239
|
isLoading: combinedIsLoading,
|
|
9804
10240
|
isTimeoutDisabled: isTimeoutDisabled.value,
|
|
@@ -9813,9 +10249,13 @@ const SignIn = (0, vue.defineComponent)({
|
|
|
9813
10249
|
class: props.className,
|
|
9814
10250
|
components: components.value,
|
|
9815
10251
|
error: flowError.value,
|
|
10252
|
+
flowExpiryRedirect: flowExpiryRedirect.value,
|
|
10253
|
+
isFlowExpired: isFlowExpired.value,
|
|
10254
|
+
isFlowRestarted: isFlowRestarted.value,
|
|
9816
10255
|
isLoading: combinedIsLoading || !isFlowInitialized.value,
|
|
9817
10256
|
isTimeoutDisabled: isTimeoutDisabled.value,
|
|
9818
10257
|
onError: (err) => emit("error", err),
|
|
10258
|
+
onRestart: restartsInPlace.value ? restartFlow : void 0,
|
|
9819
10259
|
onSubmit: handleSubmit,
|
|
9820
10260
|
size: props.size,
|
|
9821
10261
|
variant: props.variant
|
|
@@ -10348,6 +10788,10 @@ const extractFormFields = (components) => {
|
|
|
10348
10788
|
const BaseSignUp = (0, vue.defineComponent)({
|
|
10349
10789
|
name: "BaseSignUp",
|
|
10350
10790
|
props: {
|
|
10791
|
+
afterFlowExpiredUrl: {
|
|
10792
|
+
default: void 0,
|
|
10793
|
+
type: String
|
|
10794
|
+
},
|
|
10351
10795
|
afterSignUpUrl: {
|
|
10352
10796
|
default: void 0,
|
|
10353
10797
|
type: String
|
|
@@ -10428,6 +10872,15 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10428
10872
|
const isLoading = (0, vue.ref)(false);
|
|
10429
10873
|
const isFlowInitialized = (0, vue.ref)(false);
|
|
10430
10874
|
const currentFlow = (0, vue.ref)(null);
|
|
10875
|
+
const restartCount = (0, vue.ref)(0);
|
|
10876
|
+
const { clearFlowRestarted, expireFlow, flowExpiryRedirect, isFlowExpired, isFlowRestarted, restartFlow, restartsInPlace } = useFlowExpiryHandling_default({
|
|
10877
|
+
afterFlowExpiredUrl: () => props.afterFlowExpiredUrl,
|
|
10878
|
+
canRestart: true,
|
|
10879
|
+
restart: () => {
|
|
10880
|
+
startFlowAgain();
|
|
10881
|
+
},
|
|
10882
|
+
step: () => currentFlow.value
|
|
10883
|
+
});
|
|
10431
10884
|
const apiErrorSource = (0, vue.shallowRef)(null);
|
|
10432
10885
|
const apiError = (0, vue.computed)(() => apiErrorSource.value === null ? null : resolveFlowError(apiErrorSource.value, t));
|
|
10433
10886
|
const flowMessages = (0, vue.ref)([]);
|
|
@@ -10445,12 +10898,17 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10445
10898
|
let initializationAttempted = false;
|
|
10446
10899
|
let passkeyProcessed = false;
|
|
10447
10900
|
const handleError = (error) => {
|
|
10901
|
+
if ((0, __thunderid_browser.isFlowExpiredError)(error)) expireFlow();
|
|
10448
10902
|
apiErrorSource.value = error;
|
|
10449
10903
|
flowMessages.value = [{
|
|
10450
10904
|
message: apiError.value.message,
|
|
10451
10905
|
type: "error"
|
|
10452
10906
|
}];
|
|
10453
10907
|
};
|
|
10908
|
+
const reportError = (error) => {
|
|
10909
|
+
if (restartsInPlace.value && (0, __thunderid_browser.isFlowExpiredError)(error)) return;
|
|
10910
|
+
props.onError?.(error);
|
|
10911
|
+
};
|
|
10454
10912
|
(0, vue.watch)(() => apiError.value?.message, (message) => {
|
|
10455
10913
|
if (message) flowMessages.value = [{
|
|
10456
10914
|
message,
|
|
@@ -10596,7 +11054,7 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10596
11054
|
popup.close();
|
|
10597
11055
|
} catch (err) {
|
|
10598
11056
|
handleError(err);
|
|
10599
|
-
|
|
11057
|
+
reportError(err);
|
|
10600
11058
|
popup.close();
|
|
10601
11059
|
cleanup();
|
|
10602
11060
|
}
|
|
@@ -10649,6 +11107,7 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10649
11107
|
if (!validateForm().isValid) return;
|
|
10650
11108
|
}
|
|
10651
11109
|
isLoading.value = true;
|
|
11110
|
+
clearFlowRestarted();
|
|
10652
11111
|
apiErrorSource.value = null;
|
|
10653
11112
|
flowMessages.value = [];
|
|
10654
11113
|
try {
|
|
@@ -10690,7 +11149,7 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10690
11149
|
}
|
|
10691
11150
|
} catch (err) {
|
|
10692
11151
|
handleError(err);
|
|
10693
|
-
|
|
11152
|
+
reportError(err);
|
|
10694
11153
|
} finally {
|
|
10695
11154
|
isLoading.value = false;
|
|
10696
11155
|
}
|
|
@@ -10735,10 +11194,14 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10735
11194
|
isActive: false
|
|
10736
11195
|
};
|
|
10737
11196
|
handleError(error);
|
|
10738
|
-
|
|
11197
|
+
reportError(error);
|
|
10739
11198
|
}
|
|
10740
11199
|
}, { deep: true });
|
|
10741
|
-
(0, vue.watch)(() => [
|
|
11200
|
+
(0, vue.watch)(() => [
|
|
11201
|
+
props.isInitialized,
|
|
11202
|
+
isFlowInitialized.value,
|
|
11203
|
+
restartCount.value
|
|
11204
|
+
], ([initialized, flowInit]) => {
|
|
10742
11205
|
if (typeof window !== "undefined") {
|
|
10743
11206
|
const urlParams = new URL(window.location.href).searchParams;
|
|
10744
11207
|
if (urlParams.get("code") || urlParams.get("state")) return;
|
|
@@ -10764,13 +11227,30 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10764
11227
|
}
|
|
10765
11228
|
} catch (err) {
|
|
10766
11229
|
handleError(err);
|
|
10767
|
-
|
|
11230
|
+
reportError(err);
|
|
10768
11231
|
} finally {
|
|
10769
11232
|
isLoading.value = false;
|
|
10770
11233
|
}
|
|
10771
11234
|
})();
|
|
10772
11235
|
}
|
|
10773
11236
|
}, { immediate: true });
|
|
11237
|
+
/**
|
|
11238
|
+
* Starts an expired flow again: clears it, drops the expired execution from the URL so it is not resumed,
|
|
11239
|
+
* and runs the initialization once more.
|
|
11240
|
+
*/
|
|
11241
|
+
const startFlowAgain = () => {
|
|
11242
|
+
currentFlow.value = null;
|
|
11243
|
+
apiErrorSource.value = null;
|
|
11244
|
+
flowMessages.value = [];
|
|
11245
|
+
if (typeof window !== "undefined" && window.location?.href) {
|
|
11246
|
+
const url = new URL(window.location.href);
|
|
11247
|
+
url.searchParams.delete("executionId");
|
|
11248
|
+
window.history.replaceState({}, "", url.toString());
|
|
11249
|
+
}
|
|
11250
|
+
initializationAttempted = false;
|
|
11251
|
+
isFlowInitialized.value = false;
|
|
11252
|
+
restartCount.value += 1;
|
|
11253
|
+
};
|
|
10774
11254
|
return () => {
|
|
10775
11255
|
const containerClass = [
|
|
10776
11256
|
(0, __thunderid_browser.withVendorCSSClassPrefix)("signup"),
|
|
@@ -10784,8 +11264,11 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10784
11264
|
components: currentFlow.value?.data?.components || [],
|
|
10785
11265
|
error: apiError.value,
|
|
10786
11266
|
fieldErrors: formErrors.value,
|
|
11267
|
+
flowExpiryRedirect: flowExpiryRedirect.value,
|
|
10787
11268
|
handleInputChange,
|
|
10788
11269
|
handleSubmit,
|
|
11270
|
+
isFlowExpired: isFlowExpired.value,
|
|
11271
|
+
isFlowRestarted: isFlowRestarted.value,
|
|
10789
11272
|
isLoading: isLoading.value,
|
|
10790
11273
|
isValid: isFormValid.value,
|
|
10791
11274
|
messages: flowMessages.value,
|
|
@@ -10803,6 +11286,13 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10803
11286
|
};
|
|
10804
11287
|
return (0, vue.h)("div", { class: containerClass }, slots["default"](renderProps));
|
|
10805
11288
|
}
|
|
11289
|
+
if (isFlowExpired.value) return (0, vue.h)(Card_default, {
|
|
11290
|
+
class: containerClass,
|
|
11291
|
+
variant: props.variant
|
|
11292
|
+
}, () => (0, vue.h)(FlowExpired_default, {
|
|
11293
|
+
onRestart: restartsInPlace.value ? restartFlow : void 0,
|
|
11294
|
+
redirect: flowExpiryRedirect.value
|
|
11295
|
+
}));
|
|
10806
11296
|
if (!isFlowInitialized.value && isLoading.value) return (0, vue.h)(Card_default, {
|
|
10807
11297
|
class: containerClass,
|
|
10808
11298
|
variant: props.variant
|
|
@@ -10833,6 +11323,7 @@ const BaseSignUp = (0, vue.defineComponent)({
|
|
|
10833
11323
|
style: "margin-top: 0.25rem",
|
|
10834
11324
|
variant: "body1"
|
|
10835
11325
|
}, () => subtitle) : null]) : null,
|
|
11326
|
+
isFlowRestarted.value ? (0, vue.h)("div", { style: "padding: 0 1rem" }, (0, vue.h)(Alert_default, { severity: "info" }, () => t("flow.expired.restarted"))) : null,
|
|
10836
11327
|
props.error ? (0, vue.h)("div", { style: "padding: 0 1rem" }, (0, vue.h)(Alert_default, { variant: "error" }, () => props.error.message)) : null,
|
|
10837
11328
|
flowMessages.value.length > 0 ? (0, vue.h)("div", { style: "padding: 0 1rem" }, flowMessages.value.map((msg, i) => (0, vue.h)(Alert_default, {
|
|
10838
11329
|
key: i,
|
|
@@ -10853,6 +11344,10 @@ var BaseSignUp_default = BaseSignUp;
|
|
|
10853
11344
|
const SignUp = (0, vue.defineComponent)({
|
|
10854
11345
|
name: "SignUp",
|
|
10855
11346
|
props: {
|
|
11347
|
+
afterFlowExpiredUrl: {
|
|
11348
|
+
default: void 0,
|
|
11349
|
+
type: String
|
|
11350
|
+
},
|
|
10856
11351
|
afterSignUpUrl: {
|
|
10857
11352
|
default: void 0,
|
|
10858
11353
|
type: String
|
|
@@ -10929,6 +11424,7 @@ const SignUp = (0, vue.defineComponent)({
|
|
|
10929
11424
|
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
11425
|
};
|
|
10931
11426
|
return () => (0, vue.h)(BaseSignUp_default, {
|
|
11427
|
+
afterFlowExpiredUrl: props.afterFlowExpiredUrl,
|
|
10932
11428
|
afterSignUpUrl: props.afterSignUpUrl,
|
|
10933
11429
|
buttonClassName: props.buttonClassName,
|
|
10934
11430
|
className: props.className,
|
|
@@ -21836,6 +22332,7 @@ Object.defineProperty(exports, 'FieldType', {
|
|
|
21836
22332
|
return __thunderid_browser.FieldType;
|
|
21837
22333
|
}
|
|
21838
22334
|
});
|
|
22335
|
+
exports.FlowExpired = FlowExpired_default;
|
|
21839
22336
|
exports.FlowMetaProvider = FlowMetaProvider_default;
|
|
21840
22337
|
exports.FlowProvider = FlowProvider_default;
|
|
21841
22338
|
exports.GitHubButton = GitHubButton_default;
|
|
@@ -23446,6 +23943,7 @@ exports.useFetchAuthFlows = useFetchAuthFlows_default;
|
|
|
23446
23943
|
exports.useFetchUserTypes = useFetchUserTypes_default;
|
|
23447
23944
|
exports.useFetchUsers = useFetchUsers_default;
|
|
23448
23945
|
exports.useFlow = useFlow_default;
|
|
23946
|
+
exports.useFlowExpiryHandling = useFlowExpiryHandling_default;
|
|
23449
23947
|
exports.useFlowMeta = useFlowMeta_default;
|
|
23450
23948
|
exports.useGrantedPermissions = useGrantedPermissions_default;
|
|
23451
23949
|
exports.useI18n = useI18n_default;
|