@asgardeo/react 0.15.1 → 0.15.3
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.js +165 -175
- package/dist/cjs/index.js.map +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +88 -96
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -188,4 +188,4 @@ export { default as getSchemas, GetSchemasConfig } from './api/getSchemas';
|
|
|
188
188
|
export { default as updateMeProfile, UpdateMeProfileConfig } from './api/updateMeProfile';
|
|
189
189
|
export { default as getMeProfile } from './api/getScim2Me';
|
|
190
190
|
export * from './api/getScim2Me';
|
|
191
|
-
export { AsgardeoRuntimeError, http, getActiveTheme, navigate, EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType, EmbeddedFlowActionVariantV2 as EmbeddedFlowActionVariant, EmbeddedFlowTextVariantV2 as EmbeddedFlowTextVariant, EmbeddedFlowEventTypeV2 as EmbeddedFlowEventType, type EmbeddedFlowComponentV2 as EmbeddedFlowComponent, type EmbeddedFlowResponseDataV2 as EmbeddedFlowResponseData, type EmbeddedFlowExecuteRequestConfigV2 as EmbeddedFlowExecuteRequestConfig, EmbeddedSignInFlowStatusV2 as EmbeddedSignInFlowStatus, EmbeddedSignInFlowTypeV2 as EmbeddedSignInFlowType, type ExtendedEmbeddedSignInFlowResponseV2 as ExtendedEmbeddedSignInFlowResponse, type EmbeddedSignInFlowResponseV2 as EmbeddedSignInFlowResponse, type EmbeddedSignInFlowCompleteResponseV2 as EmbeddedSignInFlowCompleteResponse, type EmbeddedSignInFlowInitiateRequestV2 as EmbeddedSignInFlowInitiateRequest, type EmbeddedSignInFlowRequestV2 as EmbeddedSignInFlowRequest, type EmbeddedSignUpFlowStatusV2 as EmbeddedSignUpFlowStatus, type EmbeddedSignUpFlowTypeV2 as EmbeddedSignUpFlowType, type ExtendedEmbeddedSignUpFlowResponseV2 as ExtendedEmbeddedSignUpFlowResponse, type EmbeddedSignUpFlowResponseV2 as EmbeddedSignUpFlowResponse, type EmbeddedSignUpFlowCompleteResponseV2 as EmbeddedSignUpFlowCompleteResponse, type EmbeddedSignUpFlowInitiateRequestV2 as EmbeddedSignUpFlowInitiateRequest, type EmbeddedSignUpFlowRequestV2 as EmbeddedSignUpFlowRequest, type EmbeddedSignUpFlowErrorResponseV2 as EmbeddedSignUpFlowErrorResponse, } from '@asgardeo/browser';
|
|
191
|
+
export { AsgardeoRuntimeError, http, getActiveTheme, navigate, resolveEmojiUrisInHtml, isEmojiUri, EMOJI_URI_SCHEME, extractEmojiFromUri, resolveMeta, resolveFlowTemplateLiterals, countryCodeToFlagEmoji, resolveLocaleDisplayName, resolveLocaleEmoji, EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType, EmbeddedFlowActionVariantV2 as EmbeddedFlowActionVariant, EmbeddedFlowTextVariantV2 as EmbeddedFlowTextVariant, EmbeddedFlowEventTypeV2 as EmbeddedFlowEventType, type EmbeddedFlowComponentV2 as EmbeddedFlowComponent, type EmbeddedFlowResponseDataV2 as EmbeddedFlowResponseData, type EmbeddedFlowExecuteRequestConfigV2 as EmbeddedFlowExecuteRequestConfig, EmbeddedSignInFlowStatusV2 as EmbeddedSignInFlowStatus, EmbeddedSignInFlowTypeV2 as EmbeddedSignInFlowType, type ExtendedEmbeddedSignInFlowResponseV2 as ExtendedEmbeddedSignInFlowResponse, type EmbeddedSignInFlowResponseV2 as EmbeddedSignInFlowResponse, type EmbeddedSignInFlowCompleteResponseV2 as EmbeddedSignInFlowCompleteResponse, type EmbeddedSignInFlowInitiateRequestV2 as EmbeddedSignInFlowInitiateRequest, type EmbeddedSignInFlowRequestV2 as EmbeddedSignInFlowRequest, type EmbeddedSignUpFlowStatusV2 as EmbeddedSignUpFlowStatus, type EmbeddedSignUpFlowTypeV2 as EmbeddedSignUpFlowType, type ExtendedEmbeddedSignUpFlowResponseV2 as ExtendedEmbeddedSignUpFlowResponse, type EmbeddedSignUpFlowResponseV2 as EmbeddedSignUpFlowResponse, type EmbeddedSignUpFlowCompleteResponseV2 as EmbeddedSignUpFlowCompleteResponse, type EmbeddedSignUpFlowInitiateRequestV2 as EmbeddedSignUpFlowInitiateRequest, type EmbeddedSignUpFlowRequestV2 as EmbeddedSignUpFlowRequest, type EmbeddedSignUpFlowErrorResponseV2 as EmbeddedSignUpFlowErrorResponse, } from '@asgardeo/browser';
|
package/dist/index.js
CHANGED
|
@@ -1106,13 +1106,7 @@ var FlowProvider_default = FlowProvider;
|
|
|
1106
1106
|
// src/contexts/FlowMeta/FlowMetaProvider.tsx
|
|
1107
1107
|
import { FlowMetaType, getFlowMetaV2 } from "@asgardeo/browser";
|
|
1108
1108
|
import { TranslationBundleConstants } from "@asgardeo/i18n";
|
|
1109
|
-
import {
|
|
1110
|
-
useCallback as useCallback3,
|
|
1111
|
-
useContext as useContext2,
|
|
1112
|
-
useEffect as useEffect2,
|
|
1113
|
-
useRef,
|
|
1114
|
-
useState as useState3
|
|
1115
|
-
} from "react";
|
|
1109
|
+
import { useCallback as useCallback3, useEffect as useEffect2, useRef, useState as useState3 } from "react";
|
|
1116
1110
|
|
|
1117
1111
|
// src/contexts/FlowMeta/FlowMetaContext.ts
|
|
1118
1112
|
import { createContext as createContext4 } from "react";
|
|
@@ -1150,6 +1144,19 @@ var useAsgardeo = () => {
|
|
|
1150
1144
|
};
|
|
1151
1145
|
var useAsgardeo_default = useAsgardeo;
|
|
1152
1146
|
|
|
1147
|
+
// src/contexts/I18n/useI18n.ts
|
|
1148
|
+
import { useContext as useContext2 } from "react";
|
|
1149
|
+
var useI18n = () => {
|
|
1150
|
+
const context = useContext2(I18nContext_default);
|
|
1151
|
+
if (!context) {
|
|
1152
|
+
throw new Error(
|
|
1153
|
+
"useI18n must be used within an I18nProvider. Make sure your component is wrapped with AsgardeoProvider which includes I18nProvider."
|
|
1154
|
+
);
|
|
1155
|
+
}
|
|
1156
|
+
return context;
|
|
1157
|
+
};
|
|
1158
|
+
var useI18n_default = useI18n;
|
|
1159
|
+
|
|
1153
1160
|
// src/contexts/FlowMeta/FlowMetaProvider.tsx
|
|
1154
1161
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1155
1162
|
var FlowMetaProvider = ({
|
|
@@ -1157,7 +1164,7 @@ var FlowMetaProvider = ({
|
|
|
1157
1164
|
enabled = true
|
|
1158
1165
|
}) => {
|
|
1159
1166
|
const { baseUrl, applicationId } = useAsgardeo_default();
|
|
1160
|
-
const i18nContext =
|
|
1167
|
+
const i18nContext = useI18n_default();
|
|
1161
1168
|
const [meta, setMeta] = useState3(null);
|
|
1162
1169
|
const [isLoading, setIsLoading] = useState3(false);
|
|
1163
1170
|
const [error, setError] = useState3(null);
|
|
@@ -1171,14 +1178,19 @@ var FlowMetaProvider = ({
|
|
|
1171
1178
|
setIsLoading(true);
|
|
1172
1179
|
setError(null);
|
|
1173
1180
|
try {
|
|
1174
|
-
const result = await getFlowMetaV2({
|
|
1181
|
+
const result = await getFlowMetaV2({
|
|
1182
|
+
baseUrl,
|
|
1183
|
+
id: applicationId,
|
|
1184
|
+
language: i18nContext?.currentLanguage,
|
|
1185
|
+
type: FlowMetaType.App
|
|
1186
|
+
});
|
|
1175
1187
|
setMeta(result);
|
|
1176
1188
|
} catch (err) {
|
|
1177
1189
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
1178
1190
|
} finally {
|
|
1179
1191
|
setIsLoading(false);
|
|
1180
1192
|
}
|
|
1181
|
-
}, [enabled, baseUrl, applicationId]);
|
|
1193
|
+
}, [enabled, baseUrl, applicationId, i18nContext?.currentLanguage]);
|
|
1182
1194
|
const switchLanguage = useCallback3(
|
|
1183
1195
|
async (language) => {
|
|
1184
1196
|
if (!enabled) return;
|
|
@@ -2491,23 +2503,10 @@ var useFlow = () => {
|
|
|
2491
2503
|
};
|
|
2492
2504
|
var useFlow_default = useFlow;
|
|
2493
2505
|
|
|
2494
|
-
// src/contexts/I18n/useI18n.ts
|
|
2495
|
-
import { useContext as useContext8 } from "react";
|
|
2496
|
-
var useI18n = () => {
|
|
2497
|
-
const context = useContext8(I18nContext_default);
|
|
2498
|
-
if (!context) {
|
|
2499
|
-
throw new Error(
|
|
2500
|
-
"useI18n must be used within an I18nProvider. Make sure your component is wrapped with AsgardeoProvider which includes I18nProvider."
|
|
2501
|
-
);
|
|
2502
|
-
}
|
|
2503
|
-
return context;
|
|
2504
|
-
};
|
|
2505
|
-
var useI18n_default = useI18n;
|
|
2506
|
-
|
|
2507
2506
|
// src/contexts/Theme/useTheme.ts
|
|
2508
|
-
import { useContext as
|
|
2507
|
+
import { useContext as useContext8 } from "react";
|
|
2509
2508
|
var useTheme = () => {
|
|
2510
|
-
const context =
|
|
2509
|
+
const context = useContext8(ThemeContext_default);
|
|
2511
2510
|
if (!context) {
|
|
2512
2511
|
throw new Error("useTheme must be used within a ThemeProvider");
|
|
2513
2512
|
}
|
|
@@ -2518,7 +2517,7 @@ var useTheme_default = useTheme;
|
|
|
2518
2517
|
// src/hooks/useTranslation.ts
|
|
2519
2518
|
import { deepMerge as deepMerge2 } from "@asgardeo/browser";
|
|
2520
2519
|
import { normalizeTranslations as normalizeTranslations2 } from "@asgardeo/i18n";
|
|
2521
|
-
import { useContext as
|
|
2520
|
+
import { useContext as useContext9, useMemo as useMemo8 } from "react";
|
|
2522
2521
|
|
|
2523
2522
|
// src/contexts/I18n/ComponentPreferencesContext.ts
|
|
2524
2523
|
import { createContext as createContext9 } from "react";
|
|
@@ -2527,8 +2526,8 @@ var ComponentPreferencesContext_default = ComponentPreferencesContext;
|
|
|
2527
2526
|
|
|
2528
2527
|
// src/hooks/useTranslation.ts
|
|
2529
2528
|
var useTranslation = (componentPreferences) => {
|
|
2530
|
-
const context =
|
|
2531
|
-
const componentPrefs =
|
|
2529
|
+
const context = useContext9(I18nContext_default);
|
|
2530
|
+
const componentPrefs = useContext9(ComponentPreferencesContext_default);
|
|
2532
2531
|
const contextPreferences = componentPrefs?.i18n;
|
|
2533
2532
|
if (!context) {
|
|
2534
2533
|
throw new Error(
|
|
@@ -3777,7 +3776,6 @@ var useStyles4 = (theme, colorScheme, helperTextAlign, helperTextMarginLeft, has
|
|
|
3777
3776
|
const formControl = css4`
|
|
3778
3777
|
text-align: start;
|
|
3779
3778
|
font-family: ${theme.vars.typography.fontFamily};
|
|
3780
|
-
margin-bottom: calc(${theme.vars.spacing.unit} * 2);
|
|
3781
3779
|
`;
|
|
3782
3780
|
const helperText = css4`
|
|
3783
3781
|
margin-top: calc(${theme.vars.spacing.unit} / 2);
|
|
@@ -6039,7 +6037,7 @@ import { cx as cx15 } from "@emotion/css";
|
|
|
6039
6037
|
import {
|
|
6040
6038
|
forwardRef as forwardRef8,
|
|
6041
6039
|
createContext as createContext10,
|
|
6042
|
-
useContext as
|
|
6040
|
+
useContext as useContext10
|
|
6043
6041
|
} from "react";
|
|
6044
6042
|
|
|
6045
6043
|
// src/components/primitives/Alert/Alert.styles.ts
|
|
@@ -6226,7 +6224,7 @@ var getDefaultIcon = (variant) => {
|
|
|
6226
6224
|
}
|
|
6227
6225
|
};
|
|
6228
6226
|
var AlertVariantContext = createContext10("info");
|
|
6229
|
-
var useAlertVariant = () =>
|
|
6227
|
+
var useAlertVariant = () => useContext10(AlertVariantContext);
|
|
6230
6228
|
var Alert = forwardRef8(({ variant = "info", showIcon = true, children, className, style, ...rest }, ref) => {
|
|
6231
6229
|
const { theme, colorScheme } = useTheme_default();
|
|
6232
6230
|
const styles = Alert_styles_default(theme, colorScheme, variant);
|
|
@@ -7796,8 +7794,7 @@ import {
|
|
|
7796
7794
|
EmbeddedFlowEventTypeV2 as EmbeddedFlowEventType,
|
|
7797
7795
|
createPackageComponentLogger as createPackageComponentLogger5,
|
|
7798
7796
|
resolveFlowTemplateLiterals as resolveFlowTemplateLiterals3,
|
|
7799
|
-
|
|
7800
|
-
isEmojiUri as isEmojiUri2
|
|
7797
|
+
resolveEmojiUrisInHtml
|
|
7801
7798
|
} from "@asgardeo/browser";
|
|
7802
7799
|
import { css as css17 } from "@emotion/css";
|
|
7803
7800
|
import DOMPurify from "dompurify";
|
|
@@ -8109,24 +8106,6 @@ var logger5 = createPackageComponentLogger5(
|
|
|
8109
8106
|
"@asgardeo/react",
|
|
8110
8107
|
"AuthOptionFactory"
|
|
8111
8108
|
);
|
|
8112
|
-
var resolveEmojiUrisInHtml = (html) => {
|
|
8113
|
-
const withEmojiImages = html.replace(
|
|
8114
|
-
/<img([^>]*)src="(emoji:[^"]+)"([^>]*)\/?>/gi,
|
|
8115
|
-
(_match, pre, src, post) => {
|
|
8116
|
-
const emoji = extractEmojiFromUri2(src);
|
|
8117
|
-
if (!emoji) {
|
|
8118
|
-
return _match;
|
|
8119
|
-
}
|
|
8120
|
-
const altMatch = (pre + post).match(/alt="([^"]*)"/i);
|
|
8121
|
-
const label = altMatch ? altMatch[1] : emoji;
|
|
8122
|
-
return `<span role="img" aria-label="${label}">${emoji}</span>`;
|
|
8123
|
-
}
|
|
8124
|
-
);
|
|
8125
|
-
return withEmojiImages.replace(
|
|
8126
|
-
/emoji:([^\s"<>&]+)/g,
|
|
8127
|
-
(_, rest) => isEmojiUri2(`emoji:${rest}`) ? rest : `emoji:${rest}`
|
|
8128
|
-
);
|
|
8129
|
-
};
|
|
8130
8109
|
var richTextClass = css17`
|
|
8131
8110
|
overflow-wrap: anywhere;
|
|
8132
8111
|
& * {
|
|
@@ -8194,6 +8173,7 @@ var matchesSocialProvider = (actionId, eventType, buttonText, provider, authType
|
|
|
8194
8173
|
return providerMatches;
|
|
8195
8174
|
};
|
|
8196
8175
|
var createAuthComponentFromFlow = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, authType, options = {}) => {
|
|
8176
|
+
const { theme } = useTheme_default();
|
|
8197
8177
|
const key = options.key || component.id;
|
|
8198
8178
|
const resolve = (text) => {
|
|
8199
8179
|
if (!text || !options.t && !options.meta) {
|
|
@@ -8363,6 +8343,11 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8363
8343
|
}
|
|
8364
8344
|
case EmbeddedFlowComponentType.Block: {
|
|
8365
8345
|
if (component.components && component.components.length > 0) {
|
|
8346
|
+
const formStyles = {
|
|
8347
|
+
display: "flex",
|
|
8348
|
+
flexDirection: "column",
|
|
8349
|
+
gap: `calc(${theme.vars.spacing.unit} * 2)`
|
|
8350
|
+
};
|
|
8366
8351
|
const blockComponents = component.components.map(
|
|
8367
8352
|
(childComponent, index) => createAuthComponentFromFlow(
|
|
8368
8353
|
childComponent,
|
|
@@ -8379,7 +8364,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8379
8364
|
}
|
|
8380
8365
|
)
|
|
8381
8366
|
).filter(Boolean);
|
|
8382
|
-
return /* @__PURE__ */ jsx66("form", { id: component.id, children: blockComponents }, key);
|
|
8367
|
+
return /* @__PURE__ */ jsx66("form", { id: component.id, style: formStyles, children: blockComponents }, key);
|
|
8383
8368
|
}
|
|
8384
8369
|
return null;
|
|
8385
8370
|
}
|
|
@@ -12100,6 +12085,7 @@ var BaseAcceptInvite = ({
|
|
|
12100
12085
|
delete newErrors[name];
|
|
12101
12086
|
return newErrors;
|
|
12102
12087
|
});
|
|
12088
|
+
setIsFormValid(true);
|
|
12103
12089
|
}, []);
|
|
12104
12090
|
const handleInputBlur = useCallback15((name) => {
|
|
12105
12091
|
setTouchedFields((prev) => ({ ...prev, [name]: true }));
|
|
@@ -12112,7 +12098,7 @@ var BaseAcceptInvite = ({
|
|
|
12112
12098
|
if ((comp.type === "PASSWORD_INPUT" || comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT") && comp.required && comp.ref) {
|
|
12113
12099
|
const value = formValues[comp.ref];
|
|
12114
12100
|
if (!value || value.trim() === "") {
|
|
12115
|
-
errors[comp.ref] =
|
|
12101
|
+
errors[comp.ref] = t("validations.required.field.error");
|
|
12116
12102
|
}
|
|
12117
12103
|
}
|
|
12118
12104
|
if (comp.components && Array.isArray(comp.components)) {
|
|
@@ -12123,7 +12109,7 @@ var BaseAcceptInvite = ({
|
|
|
12123
12109
|
validateComponents(components2);
|
|
12124
12110
|
return { errors, isValid: Object.keys(errors).length === 0 };
|
|
12125
12111
|
},
|
|
12126
|
-
[formValues]
|
|
12112
|
+
[formValues, t]
|
|
12127
12113
|
);
|
|
12128
12114
|
const handleSubmit = useCallback15(
|
|
12129
12115
|
async (component, data) => {
|
|
@@ -12133,8 +12119,8 @@ var BaseAcceptInvite = ({
|
|
|
12133
12119
|
const components2 = currentFlow.data?.components || [];
|
|
12134
12120
|
const validation = validateForm(components2);
|
|
12135
12121
|
if (!validation.isValid) {
|
|
12136
|
-
setFormErrors(validation.errors);
|
|
12137
12122
|
setIsFormValid(false);
|
|
12123
|
+
setFormErrors(validation.errors);
|
|
12138
12124
|
const touched = {};
|
|
12139
12125
|
Object.keys(validation.errors).forEach((key) => {
|
|
12140
12126
|
touched[key] = true;
|
|
@@ -12144,7 +12130,6 @@ var BaseAcceptInvite = ({
|
|
|
12144
12130
|
}
|
|
12145
12131
|
setIsLoading(true);
|
|
12146
12132
|
setApiError(null);
|
|
12147
|
-
setIsFormValid(true);
|
|
12148
12133
|
try {
|
|
12149
12134
|
const inputs = data || formValues;
|
|
12150
12135
|
const payload = {
|
|
@@ -12184,7 +12169,6 @@ var BaseAcceptInvite = ({
|
|
|
12184
12169
|
return;
|
|
12185
12170
|
}
|
|
12186
12171
|
setCurrentFlow(response);
|
|
12187
|
-
setFormValues({});
|
|
12188
12172
|
setFormErrors({});
|
|
12189
12173
|
setTouchedFields({});
|
|
12190
12174
|
} catch (err) {
|
|
@@ -12266,35 +12250,6 @@ var BaseAcceptInvite = ({
|
|
|
12266
12250
|
),
|
|
12267
12251
|
[]
|
|
12268
12252
|
);
|
|
12269
|
-
const renderComponents = useCallback15(
|
|
12270
|
-
(components2) => renderInviteUserComponents(
|
|
12271
|
-
components2,
|
|
12272
|
-
formValues,
|
|
12273
|
-
touchedFields,
|
|
12274
|
-
formErrors,
|
|
12275
|
-
isLoading,
|
|
12276
|
-
isFormValid,
|
|
12277
|
-
handleInputChange,
|
|
12278
|
-
{
|
|
12279
|
-
onInputBlur: handleInputBlur,
|
|
12280
|
-
onSubmit: handleSubmit,
|
|
12281
|
-
size,
|
|
12282
|
-
variant
|
|
12283
|
-
}
|
|
12284
|
-
),
|
|
12285
|
-
[
|
|
12286
|
-
formValues,
|
|
12287
|
-
touchedFields,
|
|
12288
|
-
formErrors,
|
|
12289
|
-
isLoading,
|
|
12290
|
-
isFormValid,
|
|
12291
|
-
handleInputChange,
|
|
12292
|
-
handleInputBlur,
|
|
12293
|
-
handleSubmit,
|
|
12294
|
-
size,
|
|
12295
|
-
variant
|
|
12296
|
-
]
|
|
12297
|
-
);
|
|
12298
12253
|
const components = currentFlow?.data?.components || currentFlow?.data?.meta?.components || [];
|
|
12299
12254
|
const { title, subtitle } = extractHeadings(components);
|
|
12300
12255
|
const componentsWithoutHeadings = filterHeadings(components);
|
|
@@ -12358,7 +12313,21 @@ var BaseAcceptInvite = ({
|
|
|
12358
12313
|
/* @__PURE__ */ jsxs34(Card_default.Content, { children: [
|
|
12359
12314
|
apiError && /* @__PURE__ */ jsx85("div", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ jsx85(Alert_default, { variant: "error", children: /* @__PURE__ */ jsx85(Alert_default.Description, { children: apiError.message }) }) }),
|
|
12360
12315
|
/* @__PURE__ */ jsxs34("div", { children: [
|
|
12361
|
-
componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ?
|
|
12316
|
+
componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderInviteUserComponents(
|
|
12317
|
+
componentsWithoutHeadings,
|
|
12318
|
+
formValues,
|
|
12319
|
+
touchedFields,
|
|
12320
|
+
formErrors,
|
|
12321
|
+
isLoading,
|
|
12322
|
+
isFormValid,
|
|
12323
|
+
handleInputChange,
|
|
12324
|
+
{
|
|
12325
|
+
onInputBlur: handleInputBlur,
|
|
12326
|
+
onSubmit: handleSubmit,
|
|
12327
|
+
size,
|
|
12328
|
+
variant
|
|
12329
|
+
}
|
|
12330
|
+
) : !isLoading && /* @__PURE__ */ jsx85(Alert_default, { variant: "warning", children: /* @__PURE__ */ jsx85(Typography_default, { variant: "body1", children: "No form components available" }) }),
|
|
12362
12331
|
isLoading && /* @__PURE__ */ jsx85("div", { style: { display: "flex", justifyContent: "center", padding: "1rem" }, children: /* @__PURE__ */ jsx85(Spinner_default, { size: "small" }) })
|
|
12363
12332
|
] }),
|
|
12364
12333
|
onGoToSignIn && /* @__PURE__ */ jsx85("div", { style: { marginTop: "1.5rem", textAlign: "center" }, children: /* @__PURE__ */ jsxs34(Typography_default, { variant: "body2", children: [
|
|
@@ -13024,7 +12993,7 @@ import {
|
|
|
13024
12993
|
createContext as createContext11,
|
|
13025
12994
|
forwardRef as forwardRef10,
|
|
13026
12995
|
isValidElement,
|
|
13027
|
-
useContext as
|
|
12996
|
+
useContext as useContext11,
|
|
13028
12997
|
useLayoutEffect,
|
|
13029
12998
|
useMemo as useMemo33,
|
|
13030
12999
|
useState as useState23
|
|
@@ -13226,7 +13195,7 @@ function useDialog({
|
|
|
13226
13195
|
}
|
|
13227
13196
|
var DialogContext = createContext11(null);
|
|
13228
13197
|
var useDialogContext = () => {
|
|
13229
|
-
const context =
|
|
13198
|
+
const context = useContext11(DialogContext);
|
|
13230
13199
|
if (context == null) {
|
|
13231
13200
|
throw new Error("Dialog components must be wrapped in <Dialog />");
|
|
13232
13201
|
}
|
|
@@ -17435,12 +17404,12 @@ var BaseLanguageSwitcher_default = BaseLanguageSwitcher;
|
|
|
17435
17404
|
|
|
17436
17405
|
// src/components/presentation/LanguageSwitcher/LanguageSwitcher.tsx
|
|
17437
17406
|
import { resolveLocaleDisplayName, resolveLocaleEmoji } from "@asgardeo/browser";
|
|
17438
|
-
import { useMemo as useMemo44 } from "react";
|
|
17407
|
+
import { useEffect as useEffect26, useMemo as useMemo44 } from "react";
|
|
17439
17408
|
|
|
17440
17409
|
// src/contexts/FlowMeta/useFlowMeta.ts
|
|
17441
|
-
import { useContext as
|
|
17410
|
+
import { useContext as useContext12 } from "react";
|
|
17442
17411
|
var useFlowMeta = () => {
|
|
17443
|
-
const context =
|
|
17412
|
+
const context = useContext12(FlowMetaContext_default);
|
|
17444
17413
|
if (!context) {
|
|
17445
17414
|
throw new Error("useFlowMeta must be used within a FlowMetaProvider");
|
|
17446
17415
|
}
|
|
@@ -17454,10 +17423,10 @@ var LanguageSwitcher = ({ children, className }) => {
|
|
|
17454
17423
|
const { meta, switchLanguage, isLoading } = useFlowMeta_default();
|
|
17455
17424
|
const { currentLanguage } = useTranslation_default();
|
|
17456
17425
|
const availableLanguageCodes = meta?.i18n?.languages ?? [];
|
|
17457
|
-
const effectiveLanguageCodes = useMemo44(
|
|
17458
|
-
|
|
17459
|
-
|
|
17460
|
-
|
|
17426
|
+
const effectiveLanguageCodes = useMemo44(
|
|
17427
|
+
() => availableLanguageCodes.length > 0 ? availableLanguageCodes : [currentLanguage],
|
|
17428
|
+
[availableLanguageCodes, currentLanguage]
|
|
17429
|
+
);
|
|
17461
17430
|
const languages = useMemo44(
|
|
17462
17431
|
() => effectiveLanguageCodes.map((code) => ({
|
|
17463
17432
|
code,
|
|
@@ -17467,6 +17436,11 @@ var LanguageSwitcher = ({ children, className }) => {
|
|
|
17467
17436
|
})),
|
|
17468
17437
|
[effectiveLanguageCodes]
|
|
17469
17438
|
);
|
|
17439
|
+
useEffect26(() => {
|
|
17440
|
+
if (availableLanguageCodes.length > 0 && !availableLanguageCodes.includes(currentLanguage)) {
|
|
17441
|
+
switchLanguage(availableLanguageCodes[0]);
|
|
17442
|
+
}
|
|
17443
|
+
}, [availableLanguageCodes, currentLanguage, switchLanguage]);
|
|
17470
17444
|
const handleLanguageChange = (language) => {
|
|
17471
17445
|
if (language !== currentLanguage) {
|
|
17472
17446
|
switchLanguage(language);
|
|
@@ -17492,6 +17466,15 @@ import {
|
|
|
17492
17466
|
http,
|
|
17493
17467
|
getActiveTheme as getActiveTheme2,
|
|
17494
17468
|
navigate as navigate5,
|
|
17469
|
+
resolveEmojiUrisInHtml as resolveEmojiUrisInHtml2,
|
|
17470
|
+
isEmojiUri as isEmojiUri2,
|
|
17471
|
+
EMOJI_URI_SCHEME,
|
|
17472
|
+
extractEmojiFromUri as extractEmojiFromUri2,
|
|
17473
|
+
resolveMeta,
|
|
17474
|
+
resolveFlowTemplateLiterals as resolveFlowTemplateLiterals4,
|
|
17475
|
+
countryCodeToFlagEmoji,
|
|
17476
|
+
resolveLocaleDisplayName as resolveLocaleDisplayName2,
|
|
17477
|
+
resolveLocaleEmoji as resolveLocaleEmoji2,
|
|
17495
17478
|
EmbeddedFlowComponentTypeV2,
|
|
17496
17479
|
EmbeddedFlowActionVariantV2,
|
|
17497
17480
|
EmbeddedFlowTextVariantV2,
|
|
@@ -17535,6 +17518,7 @@ export {
|
|
|
17535
17518
|
CreateOrganization,
|
|
17536
17519
|
DatePicker_default as DatePicker,
|
|
17537
17520
|
Divider_default as Divider,
|
|
17521
|
+
EMOJI_URI_SCHEME,
|
|
17538
17522
|
EmailOtp_default as EmailOtp,
|
|
17539
17523
|
EmbeddedFlowActionVariantV2 as EmbeddedFlowActionVariant,
|
|
17540
17524
|
EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType,
|
|
@@ -17600,11 +17584,13 @@ export {
|
|
|
17600
17584
|
UserProfile_default as UserProfile,
|
|
17601
17585
|
UserProvider_default as UserProvider,
|
|
17602
17586
|
UsernamePassword_default as UsernamePassword,
|
|
17587
|
+
countryCodeToFlagEmoji,
|
|
17603
17588
|
createField,
|
|
17604
17589
|
createOrganization_default as createOrganization,
|
|
17605
17590
|
createPatchOperations,
|
|
17606
17591
|
createSignInOption,
|
|
17607
17592
|
createSignInOptionFromAuthenticator,
|
|
17593
|
+
extractEmojiFromUri2 as extractEmojiFromUri,
|
|
17608
17594
|
getActiveTheme2 as getActiveTheme,
|
|
17609
17595
|
getAllOrganizations_default as getAllOrganizations,
|
|
17610
17596
|
getConsentOptionalKey,
|
|
@@ -17613,7 +17599,13 @@ export {
|
|
|
17613
17599
|
getOrganization_default as getOrganization,
|
|
17614
17600
|
getSchemas_default as getSchemas,
|
|
17615
17601
|
http,
|
|
17602
|
+
isEmojiUri2 as isEmojiUri,
|
|
17616
17603
|
navigate5 as navigate,
|
|
17604
|
+
resolveEmojiUrisInHtml2 as resolveEmojiUrisInHtml,
|
|
17605
|
+
resolveFlowTemplateLiterals4 as resolveFlowTemplateLiterals,
|
|
17606
|
+
resolveLocaleDisplayName2 as resolveLocaleDisplayName,
|
|
17607
|
+
resolveLocaleEmoji2 as resolveLocaleEmoji,
|
|
17608
|
+
resolveMeta,
|
|
17617
17609
|
updateMeProfile_default as updateMeProfile,
|
|
17618
17610
|
updateOrganization_default as updateOrganization,
|
|
17619
17611
|
useAsgardeo_default as useAsgardeo,
|