@mxenabled/connect-widget 0.10.4 → 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 +58 -31
- 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
|
@@ -74891,46 +74891,73 @@ const getViewByStatus = (status) => {
|
|
|
74891
74891
|
const VerifyExistingMember = (props) => {
|
|
74892
74892
|
useAnalyticsPath(...PageviewInfo.CONNECT_VERIFY_EXISTING_MEMBER);
|
|
74893
74893
|
const { api } = useApi();
|
|
74894
|
+
const config = useSelector(selectConfig);
|
|
74894
74895
|
const dispatch = useDispatch();
|
|
74895
74896
|
const { members, onAddNew } = props;
|
|
74896
|
-
const iavMembers =
|
|
74897
|
-
|
|
74898
|
-
|
|
74899
|
-
|
|
74900
|
-
|
|
74901
|
-
|
|
74902
|
-
|
|
74903
|
-
|
|
74904
|
-
|
|
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);
|
|
74905
74906
|
const tokens = useTokens();
|
|
74906
74907
|
const styles = getStyles$g(tokens);
|
|
74907
|
-
const handleMemberClick = (
|
|
74908
|
-
|
|
74909
|
-
|
|
74910
|
-
|
|
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
|
+
);
|
|
74911
74921
|
useEffect(() => {
|
|
74912
74922
|
focusElement(document.getElementById("connect-select-institution"));
|
|
74913
74923
|
}, []);
|
|
74914
74924
|
useEffect(() => {
|
|
74915
|
-
|
|
74916
|
-
|
|
74917
|
-
|
|
74918
|
-
|
|
74919
|
-
|
|
74920
|
-
|
|
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
|
+
}
|
|
74921
74938
|
}
|
|
74922
|
-
|
|
74923
|
-
|
|
74924
|
-
|
|
74925
|
-
|
|
74926
|
-
|
|
74927
|
-
|
|
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;
|
|
74928
74955
|
});
|
|
74929
|
-
}, [
|
|
74930
|
-
if (
|
|
74956
|
+
}, [config, institutions, iavMembers]);
|
|
74957
|
+
if (loading) {
|
|
74931
74958
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingSpinner, { showText: true });
|
|
74932
74959
|
}
|
|
74933
|
-
if (
|
|
74960
|
+
if (error) {
|
|
74934
74961
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
74935
74962
|
GenericError,
|
|
74936
74963
|
{
|
|
@@ -74977,12 +75004,12 @@ const VerifyExistingMember = (props) => {
|
|
|
74977
75004
|
children: _n(
|
|
74978
75005
|
"%1 Connected institution",
|
|
74979
75006
|
"%1 Connected institutions",
|
|
74980
|
-
|
|
74981
|
-
|
|
75007
|
+
productSupportingMembers.length,
|
|
75008
|
+
productSupportingMembers.length
|
|
74982
75009
|
)
|
|
74983
75010
|
}
|
|
74984
75011
|
),
|
|
74985
|
-
|
|
75012
|
+
productSupportingMembers.map((member) => {
|
|
74986
75013
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
74987
75014
|
UtilityRow,
|
|
74988
75015
|
{
|