@mxenabled/connect-widget 2.10.1 → 2.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 +32 -19
- 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
|
@@ -86615,6 +86615,37 @@ class InstitutionConfigNotEnabled extends Error {
|
|
|
86615
86615
|
}
|
|
86616
86616
|
}
|
|
86617
86617
|
|
|
86618
|
+
const useNavigationPostMessage = () => {
|
|
86619
|
+
const postMessageFunctions = useContext(PostMessageContext);
|
|
86620
|
+
const dispatch = useDispatch();
|
|
86621
|
+
const connectConfig = useSelector(selectConnectConfig);
|
|
86622
|
+
const initialConfig = useSelector(selectInitialConfig);
|
|
86623
|
+
const step = useSelector(
|
|
86624
|
+
(state) => state.connect.location[state.connect.location.length - 1]?.step ?? STEPS.SEARCH
|
|
86625
|
+
);
|
|
86626
|
+
useEffect(() => {
|
|
86627
|
+
window.addEventListener("message", _handleNavigationPostMessage);
|
|
86628
|
+
return () => window.removeEventListener("message", _handleNavigationPostMessage);
|
|
86629
|
+
}, []);
|
|
86630
|
+
const _handleNavigationPostMessage = (event) => {
|
|
86631
|
+
const eventData = PostMessage.parse(event.data);
|
|
86632
|
+
if (eventData.type === "mx/navigation") {
|
|
86633
|
+
if (eventData.payload.action === "back") {
|
|
86634
|
+
const dontChangeConnectStep = step === STEPS.SEARCH || step === STEPS.DISCLOSURE || step === STEPS.VERIFY_EXISTING_MEMBER || connectConfig.disable_institution_search;
|
|
86635
|
+
if (dontChangeConnectStep) {
|
|
86636
|
+
postMessageFunctions.onPostMessage("navigation", { did_go_back: false });
|
|
86637
|
+
} else {
|
|
86638
|
+
dispatch({
|
|
86639
|
+
type: ActionTypes$2.GO_BACK_POST_MESSAGE,
|
|
86640
|
+
payload: initialConfig
|
|
86641
|
+
});
|
|
86642
|
+
postMessageFunctions.onPostMessage("navigation", { did_go_back: true });
|
|
86643
|
+
}
|
|
86644
|
+
}
|
|
86645
|
+
}
|
|
86646
|
+
};
|
|
86647
|
+
};
|
|
86648
|
+
|
|
86618
86649
|
const AnalyticContext = createContext({
|
|
86619
86650
|
onAnalyticEvent: () => {
|
|
86620
86651
|
},
|
|
@@ -86643,6 +86674,7 @@ const Connect$2 = ({
|
|
|
86643
86674
|
},
|
|
86644
86675
|
...props
|
|
86645
86676
|
}) => {
|
|
86677
|
+
useNavigationPostMessage();
|
|
86646
86678
|
const connectConfig = useSelector(selectConnectConfig);
|
|
86647
86679
|
const initialConfig = useSelector(selectInitialConfig);
|
|
86648
86680
|
const loadError = useSelector((state2) => state2.connect.loadError);
|
|
@@ -86689,7 +86721,6 @@ const Connect$2 = ({
|
|
|
86689
86721
|
};
|
|
86690
86722
|
}, []);
|
|
86691
86723
|
useEffect(() => {
|
|
86692
|
-
window.addEventListener("message", _handleNavigationPostMessage);
|
|
86693
86724
|
loadConnect(props.clientConfig);
|
|
86694
86725
|
dispatch(loadProfiles(props.profiles));
|
|
86695
86726
|
dispatch(loadUserFeatures(props.userFeatures));
|
|
@@ -86700,7 +86731,6 @@ const Connect$2 = ({
|
|
|
86700
86731
|
}
|
|
86701
86732
|
return () => {
|
|
86702
86733
|
dispatch(resetConnect$1());
|
|
86703
|
-
window.removeEventListener("message", _handleNavigationPostMessage);
|
|
86704
86734
|
};
|
|
86705
86735
|
}, []);
|
|
86706
86736
|
useEffect(() => {
|
|
@@ -86745,23 +86775,6 @@ const Connect$2 = ({
|
|
|
86745
86775
|
loadConnect(props.clientConfig);
|
|
86746
86776
|
}
|
|
86747
86777
|
}, [isLoading, step, props.clientConfig]);
|
|
86748
|
-
const _handleNavigationPostMessage = (event) => {
|
|
86749
|
-
const eventData = PostMessage.parse(event.data);
|
|
86750
|
-
if (eventData.type === "mx/navigation") {
|
|
86751
|
-
if (eventData.payload.action === "back") {
|
|
86752
|
-
const dontChangeConnectStep = step === STEPS.SEARCH || step === STEPS.DISCLOSURE || step === STEPS.VERIFY_EXISTING_MEMBER || connectConfig.disable_institution_search;
|
|
86753
|
-
if (dontChangeConnectStep) {
|
|
86754
|
-
postMessageFunctions.onPostMessage("navigation", { did_go_back: false });
|
|
86755
|
-
} else {
|
|
86756
|
-
dispatch({
|
|
86757
|
-
type: ActionTypes$2.GO_BACK_POST_MESSAGE,
|
|
86758
|
-
payload: initialConfig
|
|
86759
|
-
});
|
|
86760
|
-
postMessageFunctions.onPostMessage("navigation", { did_go_back: true });
|
|
86761
|
-
}
|
|
86762
|
-
}
|
|
86763
|
-
}
|
|
86764
|
-
};
|
|
86765
86778
|
const _handleAddManualAccountClick = () => {
|
|
86766
86779
|
dispatch(stepToAddManualAccount$1());
|
|
86767
86780
|
};
|