@asgardeo/react 0.14.4 → 0.15.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.
|
@@ -159,18 +159,6 @@ export interface BaseSignInProps {
|
|
|
159
159
|
* taking precedence. Affects this component and all its descendants.
|
|
160
160
|
*/
|
|
161
161
|
preferences?: Preferences;
|
|
162
|
-
/**
|
|
163
|
-
* Whether to show the logo.
|
|
164
|
-
*/
|
|
165
|
-
showLogo?: boolean;
|
|
166
|
-
/**
|
|
167
|
-
* Whether to show the subtitle.
|
|
168
|
-
*/
|
|
169
|
-
showSubtitle?: boolean;
|
|
170
|
-
/**
|
|
171
|
-
* Whether to show the title.
|
|
172
|
-
*/
|
|
173
|
-
showTitle?: boolean;
|
|
174
162
|
/**
|
|
175
163
|
* Size variant for the component.
|
|
176
164
|
*/
|
|
@@ -112,11 +112,11 @@ export type AsgardeoContextProps = {
|
|
|
112
112
|
* that come from the server (e.g. component labels, placeholders, headings).
|
|
113
113
|
*
|
|
114
114
|
* @example
|
|
115
|
-
* const {
|
|
116
|
-
*
|
|
117
|
-
*
|
|
115
|
+
* const {resolveFlowTemplateLiterals} = useAsgardeo();
|
|
116
|
+
* resolveFlowTemplateLiterals('{{ t(signin.heading.label) }}') // → 'Sign In'
|
|
117
|
+
* resolveFlowTemplateLiterals('Login to {{ meta(application.name) }}') // → 'Login to My App'
|
|
118
118
|
*/
|
|
119
|
-
|
|
119
|
+
resolveFlowTemplateLiterals: (text: string | undefined) => string;
|
|
120
120
|
/**
|
|
121
121
|
* Sign-in function to initiate the authentication process.
|
|
122
122
|
* @remark This is the programmatic version of the `SignInButton` component.
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ var AsgardeoContext = createContext({
|
|
|
39
39
|
organizationHandle: void 0,
|
|
40
40
|
platform: void 0,
|
|
41
41
|
reInitialize: null,
|
|
42
|
-
|
|
42
|
+
resolveFlowTemplateLiterals: (text) => text ?? "",
|
|
43
43
|
signIn: () => Promise.resolve({}),
|
|
44
44
|
signInOptions: {},
|
|
45
45
|
signInSilently: () => Promise.resolve({}),
|
|
@@ -1121,7 +1121,7 @@ FlowMetaContext.displayName = "FlowMetaContext";
|
|
|
1121
1121
|
var FlowMetaContext_default = FlowMetaContext;
|
|
1122
1122
|
|
|
1123
1123
|
// src/contexts/Asgardeo/useAsgardeo.ts
|
|
1124
|
-
import {
|
|
1124
|
+
import { resolveFlowTemplateLiterals } from "@asgardeo/browser";
|
|
1125
1125
|
import { useContext } from "react";
|
|
1126
1126
|
|
|
1127
1127
|
// src/contexts/I18n/I18nContext.ts
|
|
@@ -1142,7 +1142,7 @@ var useAsgardeo = () => {
|
|
|
1142
1142
|
return {
|
|
1143
1143
|
...context,
|
|
1144
1144
|
meta,
|
|
1145
|
-
|
|
1145
|
+
resolveFlowTemplateLiterals: (text) => resolveFlowTemplateLiterals(text, {
|
|
1146
1146
|
meta,
|
|
1147
1147
|
t: i18nContext?.t ?? ((key) => key)
|
|
1148
1148
|
})
|
|
@@ -7659,19 +7659,18 @@ var BaseSignIn_default = BaseSignIn;
|
|
|
7659
7659
|
|
|
7660
7660
|
// src/components/presentation/auth/SignIn/v2/BaseSignIn.tsx
|
|
7661
7661
|
import {
|
|
7662
|
-
withVendorCSSClassPrefix as withVendorCSSClassPrefix20
|
|
7663
|
-
resolveVars as resolveVars3
|
|
7662
|
+
withVendorCSSClassPrefix as withVendorCSSClassPrefix20
|
|
7664
7663
|
} from "@asgardeo/browser";
|
|
7665
7664
|
import { cx as cx20 } from "@emotion/css";
|
|
7666
7665
|
import { useState as useState17, useCallback as useCallback11 } from "react";
|
|
7667
7666
|
|
|
7668
7667
|
// src/utils/v2/resolveTranslationsInObject.ts
|
|
7669
|
-
import {
|
|
7668
|
+
import { resolveFlowTemplateLiterals as resolveFlowTemplateLiterals2 } from "@asgardeo/browser";
|
|
7670
7669
|
var resolveTranslationsInObject = (obj, t, properties = ["label", "placeholder", "text", "title", "subtitle"], meta) => {
|
|
7671
7670
|
const resolved = { ...obj };
|
|
7672
7671
|
properties.forEach((prop) => {
|
|
7673
7672
|
if (resolved[prop] && typeof resolved[prop] === "string") {
|
|
7674
|
-
resolved[prop] =
|
|
7673
|
+
resolved[prop] = resolveFlowTemplateLiterals2(resolved[prop], { meta, t });
|
|
7675
7674
|
}
|
|
7676
7675
|
});
|
|
7677
7676
|
return resolved;
|
|
@@ -7790,73 +7789,15 @@ var normalizeFlowResponse = (response, t, options = {}, meta) => {
|
|
|
7790
7789
|
};
|
|
7791
7790
|
};
|
|
7792
7791
|
|
|
7793
|
-
// src/utils/v2/getAuthComponentHeadings.ts
|
|
7794
|
-
var getAuthComponentHeadings = (components, flowTitle, flowSubtitle, defaultTitle, defaultSubtitle) => {
|
|
7795
|
-
let heading = null;
|
|
7796
|
-
let subheading = null;
|
|
7797
|
-
const findHeadings = (comps) => {
|
|
7798
|
-
for (const component of comps) {
|
|
7799
|
-
if (component.type === "TEXT" && component.variant && component.variant.startsWith("HEADING_")) {
|
|
7800
|
-
if (!heading) {
|
|
7801
|
-
heading = component;
|
|
7802
|
-
} else if (!subheading) {
|
|
7803
|
-
subheading = component;
|
|
7804
|
-
break;
|
|
7805
|
-
}
|
|
7806
|
-
}
|
|
7807
|
-
if (component.components && component.components.length > 0) {
|
|
7808
|
-
findHeadings(component.components);
|
|
7809
|
-
if (heading && subheading) break;
|
|
7810
|
-
}
|
|
7811
|
-
}
|
|
7812
|
-
};
|
|
7813
|
-
const filterComponents = (comps) => {
|
|
7814
|
-
let foundHeadings = 0;
|
|
7815
|
-
const maxHeadings = 2;
|
|
7816
|
-
const filter = (items) => items.reduce((acc, component) => {
|
|
7817
|
-
if (foundHeadings < maxHeadings && component.type === "TEXT" && component.variant && component.variant.startsWith("HEADING_")) {
|
|
7818
|
-
foundHeadings += 1;
|
|
7819
|
-
return acc;
|
|
7820
|
-
}
|
|
7821
|
-
if (component.components && component.components.length > 0) {
|
|
7822
|
-
const filteredNestedComponents = filter(component.components);
|
|
7823
|
-
if (filteredNestedComponents.length > 0) {
|
|
7824
|
-
acc.push({
|
|
7825
|
-
...component,
|
|
7826
|
-
components: filteredNestedComponents
|
|
7827
|
-
});
|
|
7828
|
-
}
|
|
7829
|
-
} else {
|
|
7830
|
-
acc.push(component);
|
|
7831
|
-
}
|
|
7832
|
-
return acc;
|
|
7833
|
-
}, []);
|
|
7834
|
-
return filter(comps);
|
|
7835
|
-
};
|
|
7836
|
-
const getComponentText = (component) => {
|
|
7837
|
-
if (!component) return "";
|
|
7838
|
-
return component.label || "";
|
|
7839
|
-
};
|
|
7840
|
-
findHeadings(components);
|
|
7841
|
-
const headingText = getComponentText(heading);
|
|
7842
|
-
const subheadingText = getComponentText(subheading);
|
|
7843
|
-
const result = {
|
|
7844
|
-
componentsWithoutHeadings: filterComponents(components),
|
|
7845
|
-
headingComponents: { heading, subheading },
|
|
7846
|
-
subtitle: flowSubtitle || subheadingText || defaultSubtitle || "",
|
|
7847
|
-
title: flowTitle || headingText || defaultTitle || ""
|
|
7848
|
-
};
|
|
7849
|
-
return result;
|
|
7850
|
-
};
|
|
7851
|
-
var getAuthComponentHeadings_default = getAuthComponentHeadings;
|
|
7852
|
-
|
|
7853
7792
|
// src/components/presentation/auth/AuthOptionFactory.tsx
|
|
7854
7793
|
import {
|
|
7855
7794
|
FieldType as FieldType7,
|
|
7856
7795
|
EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType,
|
|
7857
7796
|
EmbeddedFlowEventTypeV2 as EmbeddedFlowEventType,
|
|
7858
7797
|
createPackageComponentLogger as createPackageComponentLogger5,
|
|
7859
|
-
|
|
7798
|
+
resolveFlowTemplateLiterals as resolveFlowTemplateLiterals3,
|
|
7799
|
+
extractEmojiFromUri as extractEmojiFromUri2,
|
|
7800
|
+
isEmojiUri as isEmojiUri2
|
|
7860
7801
|
} from "@asgardeo/browser";
|
|
7861
7802
|
import { css as css17 } from "@emotion/css";
|
|
7862
7803
|
import DOMPurify from "dompurify";
|
|
@@ -8011,7 +7952,9 @@ var FlowTimer = ({
|
|
|
8011
7952
|
var FlowTimer_default = FlowTimer;
|
|
8012
7953
|
|
|
8013
7954
|
// src/components/adapters/ImageComponent.tsx
|
|
7955
|
+
import { extractEmojiFromUri, isEmojiUri } from "@asgardeo/browser";
|
|
8014
7956
|
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
7957
|
+
var DEFAULT_EMOJI_CONTAINER_HEIGHT = "4em";
|
|
8015
7958
|
var ImageComponent = ({ component }) => {
|
|
8016
7959
|
const { theme } = useTheme_default();
|
|
8017
7960
|
const config = component.config || {};
|
|
@@ -8028,6 +7971,34 @@ var ImageComponent = ({ component }) => {
|
|
|
8028
7971
|
if (!src) {
|
|
8029
7972
|
return null;
|
|
8030
7973
|
}
|
|
7974
|
+
if (isEmojiUri(src)) {
|
|
7975
|
+
const toCSSLength = (value) => /^\d+(\.\d+)?$/.test(value) ? `${value}px` : value;
|
|
7976
|
+
const cssWidth = toCSSLength(width);
|
|
7977
|
+
const cssHeight = toCSSLength(height);
|
|
7978
|
+
const isConcrete = (v) => v !== "auto" && !v.endsWith("%");
|
|
7979
|
+
let containerHeight;
|
|
7980
|
+
if (isConcrete(cssHeight)) {
|
|
7981
|
+
containerHeight = cssHeight;
|
|
7982
|
+
} else if (isConcrete(cssWidth)) {
|
|
7983
|
+
containerHeight = cssWidth;
|
|
7984
|
+
} else {
|
|
7985
|
+
containerHeight = DEFAULT_EMOJI_CONTAINER_HEIGHT;
|
|
7986
|
+
}
|
|
7987
|
+
return /* @__PURE__ */ jsx62("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ jsx62(
|
|
7988
|
+
"span",
|
|
7989
|
+
{
|
|
7990
|
+
style: {
|
|
7991
|
+
...imageStyle,
|
|
7992
|
+
containerType: "size",
|
|
7993
|
+
display: "inline-grid",
|
|
7994
|
+
height: containerHeight,
|
|
7995
|
+
placeItems: "center",
|
|
7996
|
+
width: cssWidth
|
|
7997
|
+
},
|
|
7998
|
+
children: /* @__PURE__ */ jsx62("span", { "aria-label": alt, role: "img", style: { fontSize: "100cqmin", lineHeight: 1 }, children: extractEmojiFromUri(src) })
|
|
7999
|
+
}
|
|
8000
|
+
) }, component.id);
|
|
8001
|
+
}
|
|
8031
8002
|
return /* @__PURE__ */ jsx62("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ jsx62(
|
|
8032
8003
|
"img",
|
|
8033
8004
|
{
|
|
@@ -8138,12 +8109,49 @@ var logger5 = createPackageComponentLogger5(
|
|
|
8138
8109
|
"@asgardeo/react",
|
|
8139
8110
|
"AuthOptionFactory"
|
|
8140
8111
|
);
|
|
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
|
+
};
|
|
8141
8130
|
var richTextClass = css17`
|
|
8142
8131
|
overflow-wrap: anywhere;
|
|
8143
8132
|
& * {
|
|
8144
8133
|
overflow-wrap: anywhere;
|
|
8145
8134
|
word-break: break-word;
|
|
8146
8135
|
}
|
|
8136
|
+
& .rich-text-align-left {
|
|
8137
|
+
text-align: left;
|
|
8138
|
+
}
|
|
8139
|
+
& .rich-text-align-center {
|
|
8140
|
+
text-align: center;
|
|
8141
|
+
}
|
|
8142
|
+
& .rich-text-align-right {
|
|
8143
|
+
text-align: right;
|
|
8144
|
+
}
|
|
8145
|
+
& .rich-text-align-justify {
|
|
8146
|
+
text-align: justify;
|
|
8147
|
+
}
|
|
8148
|
+
& a,
|
|
8149
|
+
& .rich-text-link {
|
|
8150
|
+
text-decoration: underline;
|
|
8151
|
+
}
|
|
8152
|
+
& span[role='img'] {
|
|
8153
|
+
display: inline-block;
|
|
8154
|
+
}
|
|
8147
8155
|
`;
|
|
8148
8156
|
var getFieldType = (variant) => {
|
|
8149
8157
|
switch (variant) {
|
|
@@ -8191,7 +8199,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8191
8199
|
if (!text || !options.t && !options.meta) {
|
|
8192
8200
|
return text || "";
|
|
8193
8201
|
}
|
|
8194
|
-
return
|
|
8202
|
+
return resolveFlowTemplateLiterals3(text, { meta: options.meta, t: options.t || ((k) => k) });
|
|
8195
8203
|
};
|
|
8196
8204
|
switch (component.type) {
|
|
8197
8205
|
case EmbeddedFlowComponentType.TextInput:
|
|
@@ -8311,7 +8319,18 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8311
8319
|
}
|
|
8312
8320
|
case EmbeddedFlowComponentType.Text: {
|
|
8313
8321
|
const variant = getTypographyVariant(component.variant);
|
|
8314
|
-
return /* @__PURE__ */ jsx66(
|
|
8322
|
+
return /* @__PURE__ */ jsx66(
|
|
8323
|
+
Typography_default,
|
|
8324
|
+
{
|
|
8325
|
+
variant,
|
|
8326
|
+
style: {
|
|
8327
|
+
marginBottom: 2,
|
|
8328
|
+
textAlign: typeof component?.["align"] === "string" ? component["align"] : "left"
|
|
8329
|
+
},
|
|
8330
|
+
children: resolve(component.label)
|
|
8331
|
+
},
|
|
8332
|
+
key
|
|
8333
|
+
);
|
|
8315
8334
|
}
|
|
8316
8335
|
case EmbeddedFlowComponentType.Divider: {
|
|
8317
8336
|
return /* @__PURE__ */ jsx66(Divider_default, { children: resolve(component.label) || "" }, key);
|
|
@@ -8369,7 +8388,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8369
8388
|
"div",
|
|
8370
8389
|
{
|
|
8371
8390
|
className: richTextClass,
|
|
8372
|
-
dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(resolve(component.label)) }
|
|
8391
|
+
dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(resolveEmojiUrisInHtml(resolve(component.label))) }
|
|
8373
8392
|
},
|
|
8374
8393
|
key
|
|
8375
8394
|
);
|
|
@@ -8528,8 +8547,6 @@ var BaseSignInContent2 = ({
|
|
|
8528
8547
|
variant = "outlined",
|
|
8529
8548
|
isLoading: externalIsLoading,
|
|
8530
8549
|
children,
|
|
8531
|
-
showTitle = true,
|
|
8532
|
-
showSubtitle = true,
|
|
8533
8550
|
additionalData = {},
|
|
8534
8551
|
isTimeoutDisabled = false
|
|
8535
8552
|
}) => {
|
|
@@ -8737,40 +8754,22 @@ var BaseSignInContent2 = ({
|
|
|
8737
8754
|
if (!components || components.length === 0) {
|
|
8738
8755
|
return /* @__PURE__ */ jsx67(Card_default, { className: cx20(containerClasses, styles.card), "data-testid": "asgardeo-signin", variant, children: /* @__PURE__ */ jsx67(Card_default.Content, { children: /* @__PURE__ */ jsx67(Alert_default, { variant: "warning", children: /* @__PURE__ */ jsx67(Typography_default, { variant: "body1", children: t("errors.signin.components.not.available") }) }) }) });
|
|
8739
8756
|
}
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
externalError && /* @__PURE__ */ jsx67("div", { className: styles.flowMessagesContainer, children: /* @__PURE__ */ jsx67(Alert_default, { variant: "error", className: cx20(styles.flowMessageItem, messageClasses), children: /* @__PURE__ */ jsx67(Alert_default.Description, { children: externalError.message }) }) }),
|
|
8754
|
-
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ jsx67("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ jsx67(
|
|
8755
|
-
Alert_default,
|
|
8756
|
-
{
|
|
8757
|
-
variant: message.type === "error" ? "error" : "info",
|
|
8758
|
-
className: cx20(styles.flowMessageItem, messageClasses),
|
|
8759
|
-
children: /* @__PURE__ */ jsx67(Alert_default.Description, { children: message.message })
|
|
8760
|
-
},
|
|
8761
|
-
index
|
|
8762
|
-
)) }),
|
|
8763
|
-
/* @__PURE__ */ jsx67("div", { className: styles.contentContainer, children: componentsWithoutHeadings && renderComponents(componentsWithoutHeadings) })
|
|
8764
|
-
] })
|
|
8765
|
-
] });
|
|
8757
|
+
return /* @__PURE__ */ jsx67(Card_default, { className: cx20(containerClasses, styles.card), "data-testid": "asgardeo-signin", variant, children: /* @__PURE__ */ jsxs30(Card_default.Content, { children: [
|
|
8758
|
+
externalError && /* @__PURE__ */ jsx67("div", { className: styles.flowMessagesContainer, children: /* @__PURE__ */ jsx67(Alert_default, { variant: "error", className: cx20(styles.flowMessageItem, messageClasses), children: /* @__PURE__ */ jsx67(Alert_default.Description, { children: externalError.message }) }) }),
|
|
8759
|
+
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ jsx67("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ jsx67(
|
|
8760
|
+
Alert_default,
|
|
8761
|
+
{
|
|
8762
|
+
variant: message.type === "error" ? "error" : "info",
|
|
8763
|
+
className: cx20(styles.flowMessageItem, messageClasses),
|
|
8764
|
+
children: /* @__PURE__ */ jsx67(Alert_default.Description, { children: message.message })
|
|
8765
|
+
},
|
|
8766
|
+
index
|
|
8767
|
+
)) }),
|
|
8768
|
+
/* @__PURE__ */ jsx67("div", { className: styles.contentContainer, children: renderComponents(components) })
|
|
8769
|
+
] }) });
|
|
8766
8770
|
};
|
|
8767
|
-
var BaseSignIn2 = ({ preferences,
|
|
8768
|
-
const {
|
|
8769
|
-
const styles = BaseSignIn_styles_default(theme, theme.vars.colors.text.primary);
|
|
8770
|
-
const content = /* @__PURE__ */ jsxs30("div", { children: [
|
|
8771
|
-
showLogo && /* @__PURE__ */ jsx67("div", { className: styles.logoContainer, children: /* @__PURE__ */ jsx67(Logo_default, { size: "large" }) }),
|
|
8772
|
-
/* @__PURE__ */ jsx67(FlowProvider_default, { children: /* @__PURE__ */ jsx67(BaseSignInContent2, { showLogo, ...rest }) })
|
|
8773
|
-
] });
|
|
8771
|
+
var BaseSignIn2 = ({ preferences, ...rest }) => {
|
|
8772
|
+
const content = /* @__PURE__ */ jsx67(FlowProvider_default, { children: /* @__PURE__ */ jsx67(BaseSignInContent2, { ...rest }) });
|
|
8774
8773
|
if (!preferences) return content;
|
|
8775
8774
|
return /* @__PURE__ */ jsx67(ComponentPreferencesContext_default.Provider, { value: preferences, children: content });
|
|
8776
8775
|
};
|
|
@@ -10691,6 +10690,68 @@ import {
|
|
|
10691
10690
|
} from "@asgardeo/browser";
|
|
10692
10691
|
import { cx as cx22 } from "@emotion/css";
|
|
10693
10692
|
import { useEffect as useEffect19, useState as useState20, useCallback as useCallback13, useRef as useRef9 } from "react";
|
|
10693
|
+
|
|
10694
|
+
// src/utils/v2/getAuthComponentHeadings.ts
|
|
10695
|
+
var getAuthComponentHeadings = (components, flowTitle, flowSubtitle, defaultTitle, defaultSubtitle) => {
|
|
10696
|
+
let heading = null;
|
|
10697
|
+
let subheading = null;
|
|
10698
|
+
const findHeadings = (comps) => {
|
|
10699
|
+
for (const component of comps) {
|
|
10700
|
+
if (component.type === "TEXT" && component.variant && component.variant.startsWith("HEADING_")) {
|
|
10701
|
+
if (!heading) {
|
|
10702
|
+
heading = component;
|
|
10703
|
+
} else if (!subheading) {
|
|
10704
|
+
subheading = component;
|
|
10705
|
+
break;
|
|
10706
|
+
}
|
|
10707
|
+
}
|
|
10708
|
+
if (component.components && component.components.length > 0) {
|
|
10709
|
+
findHeadings(component.components);
|
|
10710
|
+
if (heading && subheading) break;
|
|
10711
|
+
}
|
|
10712
|
+
}
|
|
10713
|
+
};
|
|
10714
|
+
const filterComponents = (comps) => {
|
|
10715
|
+
let foundHeadings = 0;
|
|
10716
|
+
const maxHeadings = 2;
|
|
10717
|
+
const filter = (items) => items.reduce((acc, component) => {
|
|
10718
|
+
if (foundHeadings < maxHeadings && component.type === "TEXT" && component.variant && component.variant.startsWith("HEADING_")) {
|
|
10719
|
+
foundHeadings += 1;
|
|
10720
|
+
return acc;
|
|
10721
|
+
}
|
|
10722
|
+
if (component.components && component.components.length > 0) {
|
|
10723
|
+
const filteredNestedComponents = filter(component.components);
|
|
10724
|
+
if (filteredNestedComponents.length > 0) {
|
|
10725
|
+
acc.push({
|
|
10726
|
+
...component,
|
|
10727
|
+
components: filteredNestedComponents
|
|
10728
|
+
});
|
|
10729
|
+
}
|
|
10730
|
+
} else {
|
|
10731
|
+
acc.push(component);
|
|
10732
|
+
}
|
|
10733
|
+
return acc;
|
|
10734
|
+
}, []);
|
|
10735
|
+
return filter(comps);
|
|
10736
|
+
};
|
|
10737
|
+
const getComponentText = (component) => {
|
|
10738
|
+
if (!component) return "";
|
|
10739
|
+
return component.label || "";
|
|
10740
|
+
};
|
|
10741
|
+
findHeadings(components);
|
|
10742
|
+
const headingText = getComponentText(heading);
|
|
10743
|
+
const subheadingText = getComponentText(subheading);
|
|
10744
|
+
const result = {
|
|
10745
|
+
componentsWithoutHeadings: filterComponents(components),
|
|
10746
|
+
headingComponents: { heading, subheading },
|
|
10747
|
+
subtitle: flowSubtitle || subheadingText || defaultSubtitle || "",
|
|
10748
|
+
title: flowTitle || headingText || defaultTitle || ""
|
|
10749
|
+
};
|
|
10750
|
+
return result;
|
|
10751
|
+
};
|
|
10752
|
+
var getAuthComponentHeadings_default = getAuthComponentHeadings;
|
|
10753
|
+
|
|
10754
|
+
// src/components/presentation/auth/SignUp/v2/BaseSignUp.tsx
|
|
10694
10755
|
import { jsx as jsx78, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
10695
10756
|
var logger7 = createPackageComponentLogger7(
|
|
10696
10757
|
"@asgardeo/react",
|
|
@@ -11370,7 +11431,6 @@ var SignUp2 = ({
|
|
|
11370
11431
|
size,
|
|
11371
11432
|
isInitialized,
|
|
11372
11433
|
children,
|
|
11373
|
-
showLogo: true,
|
|
11374
11434
|
showTitle: true,
|
|
11375
11435
|
showSubtitle: true,
|
|
11376
11436
|
...rest
|