@mxenabled/connect-widget 0.10.3 → 0.11.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/index.es.js +61 -32
- package/dist/index.es.js.map +1 -1
- package/dist/lastBuild.txt +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -74061,8 +74061,10 @@ const getStyles$l = (tokens) => ({
|
|
|
74061
74061
|
flexDirection: "column"
|
|
74062
74062
|
},
|
|
74063
74063
|
svg: {
|
|
74064
|
+
display: "flex",
|
|
74065
|
+
alignItems: "center",
|
|
74064
74066
|
margin: "0 auto",
|
|
74065
|
-
width:
|
|
74067
|
+
width: 240
|
|
74066
74068
|
},
|
|
74067
74069
|
title: {
|
|
74068
74070
|
marginBottom: tokens.Spacing.XSmall
|
|
@@ -74889,46 +74891,73 @@ const getViewByStatus = (status) => {
|
|
|
74889
74891
|
const VerifyExistingMember = (props) => {
|
|
74890
74892
|
useAnalyticsPath(...PageviewInfo.CONNECT_VERIFY_EXISTING_MEMBER);
|
|
74891
74893
|
const { api } = useApi();
|
|
74894
|
+
const config = useSelector(selectConfig);
|
|
74892
74895
|
const dispatch = useDispatch();
|
|
74893
74896
|
const { members, onAddNew } = props;
|
|
74894
|
-
const iavMembers =
|
|
74895
|
-
|
|
74896
|
-
|
|
74897
|
-
|
|
74898
|
-
|
|
74899
|
-
|
|
74900
|
-
|
|
74901
|
-
|
|
74902
|
-
|
|
74897
|
+
const iavMembers = useMemo(() => {
|
|
74898
|
+
return members.filter(
|
|
74899
|
+
(member) => member.verification_is_enabled && member.is_managed_by_user
|
|
74900
|
+
// Only show user-managed members that support verification
|
|
74901
|
+
);
|
|
74902
|
+
}, [members]);
|
|
74903
|
+
const [institutions, setInstitutions] = useState(/* @__PURE__ */ new Map());
|
|
74904
|
+
const [loading, setLoading] = useState(true);
|
|
74905
|
+
const [error, setError] = useState(null);
|
|
74903
74906
|
const tokens = useTokens();
|
|
74904
74907
|
const styles = getStyles$g(tokens);
|
|
74905
|
-
const handleMemberClick = (
|
|
74906
|
-
|
|
74907
|
-
|
|
74908
|
-
|
|
74908
|
+
const handleMemberClick = useCallback(
|
|
74909
|
+
(selectedMember) => {
|
|
74910
|
+
const institution = institutions.get(selectedMember.institution_guid);
|
|
74911
|
+
if (institution) {
|
|
74912
|
+
if (selectedMember.is_oauth) {
|
|
74913
|
+
dispatch(startOauth$1(selectedMember, institution));
|
|
74914
|
+
} else {
|
|
74915
|
+
dispatch(verifyExistingConnection$1(selectedMember, institution));
|
|
74916
|
+
}
|
|
74917
|
+
}
|
|
74918
|
+
},
|
|
74919
|
+
[dispatch, institutions]
|
|
74920
|
+
);
|
|
74909
74921
|
useEffect(() => {
|
|
74910
74922
|
focusElement(document.getElementById("connect-select-institution"));
|
|
74911
74923
|
}, []);
|
|
74912
74924
|
useEffect(() => {
|
|
74913
|
-
|
|
74914
|
-
|
|
74915
|
-
|
|
74916
|
-
|
|
74917
|
-
|
|
74918
|
-
|
|
74925
|
+
const fetchInstitutionsProgressively = async () => {
|
|
74926
|
+
setLoading(true);
|
|
74927
|
+
setError(null);
|
|
74928
|
+
const institutionMap = /* @__PURE__ */ new Map();
|
|
74929
|
+
for (const member of iavMembers) {
|
|
74930
|
+
try {
|
|
74931
|
+
const institution = await api.loadInstitutionByGuid(member.institution_guid);
|
|
74932
|
+
if (institution) {
|
|
74933
|
+
institutionMap.set(member.institution_guid, institution);
|
|
74934
|
+
}
|
|
74935
|
+
} catch (err) {
|
|
74936
|
+
setError(err);
|
|
74937
|
+
}
|
|
74919
74938
|
}
|
|
74920
|
-
|
|
74921
|
-
|
|
74922
|
-
|
|
74923
|
-
|
|
74924
|
-
|
|
74925
|
-
|
|
74939
|
+
setInstitutions(new Map(institutionMap));
|
|
74940
|
+
setLoading(false);
|
|
74941
|
+
};
|
|
74942
|
+
if (iavMembers.length > 0) {
|
|
74943
|
+
fetchInstitutionsProgressively();
|
|
74944
|
+
} else {
|
|
74945
|
+
setLoading(false);
|
|
74946
|
+
}
|
|
74947
|
+
}, [api, iavMembers]);
|
|
74948
|
+
const productSupportingMembers = useMemo(() => {
|
|
74949
|
+
return iavMembers.filter((member) => {
|
|
74950
|
+
const institution = institutions.get(member.institution_guid);
|
|
74951
|
+
if (institution) {
|
|
74952
|
+
return instutionSupportRequestedProducts(config, institution);
|
|
74953
|
+
}
|
|
74954
|
+
return false;
|
|
74926
74955
|
});
|
|
74927
|
-
}, [
|
|
74928
|
-
if (
|
|
74956
|
+
}, [config, institutions, iavMembers]);
|
|
74957
|
+
if (loading) {
|
|
74929
74958
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingSpinner, { showText: true });
|
|
74930
74959
|
}
|
|
74931
|
-
if (
|
|
74960
|
+
if (error) {
|
|
74932
74961
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
74933
74962
|
GenericError,
|
|
74934
74963
|
{
|
|
@@ -74975,12 +75004,12 @@ const VerifyExistingMember = (props) => {
|
|
|
74975
75004
|
children: _n(
|
|
74976
75005
|
"%1 Connected institution",
|
|
74977
75006
|
"%1 Connected institutions",
|
|
74978
|
-
|
|
74979
|
-
|
|
75007
|
+
productSupportingMembers.length,
|
|
75008
|
+
productSupportingMembers.length
|
|
74980
75009
|
)
|
|
74981
75010
|
}
|
|
74982
75011
|
),
|
|
74983
|
-
|
|
75012
|
+
productSupportingMembers.map((member) => {
|
|
74984
75013
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
74985
75014
|
UtilityRow,
|
|
74986
75015
|
{
|