@openedx/frontend-app-authn 1.0.0-alpha.6 → 1.0.0-alpha.8
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/Main.js +1 -3
- package/dist/Main.js.map +1 -1
- package/dist/app.js +0 -2
- package/dist/app.js.map +1 -1
- package/dist/common-components/EmbeddedRegistrationRoute.js +2 -2
- package/dist/common-components/EmbeddedRegistrationRoute.js.map +1 -1
- package/dist/common-components/EnterpriseSSO.js +6 -3
- package/dist/common-components/EnterpriseSSO.js.map +1 -1
- package/dist/common-components/PasswordField.d.ts +17 -9
- package/dist/common-components/PasswordField.js +10 -6
- package/dist/common-components/PasswordField.js.map +1 -1
- package/dist/common-components/RedirectLogistration.js +7 -3
- package/dist/common-components/RedirectLogistration.js.map +1 -1
- package/dist/common-components/SocialAuthProviders.d.ts +2 -2
- package/dist/common-components/SocialAuthProviders.js +5 -4
- package/dist/common-components/SocialAuthProviders.js.map +1 -1
- package/dist/common-components/ThirdPartyAuth.js +3 -2
- package/dist/common-components/ThirdPartyAuth.js.map +1 -1
- package/dist/common-components/ThirdPartyAuthAlert.d.ts +2 -2
- package/dist/common-components/ThirdPartyAuthAlert.js +4 -4
- package/dist/common-components/ThirdPartyAuthAlert.js.map +1 -1
- package/dist/common-components/UnAuthOnlyRoute.js +5 -4
- package/dist/common-components/UnAuthOnlyRoute.js.map +1 -1
- package/dist/common-components/components/ThirdPartyAuthContext.d.ts +31 -0
- package/dist/common-components/components/ThirdPartyAuthContext.js +84 -0
- package/dist/common-components/components/ThirdPartyAuthContext.js.map +1 -0
- package/dist/common-components/data/api.d.ts +6 -0
- package/dist/common-components/data/api.js +26 -0
- package/dist/common-components/data/api.js.map +1 -0
- package/dist/common-components/data/apiHook.d.ts +9 -0
- package/dist/common-components/data/apiHook.js +14 -0
- package/dist/common-components/data/apiHook.js.map +1 -0
- package/dist/common-components/data/queryKeys.d.ts +4 -0
- package/dist/common-components/data/queryKeys.js +6 -0
- package/dist/common-components/data/queryKeys.js.map +1 -0
- package/dist/common-components/index.d.ts +0 -3
- package/dist/common-components/index.js +0 -3
- package/dist/common-components/index.js.map +1 -1
- package/dist/constants.d.ts +13 -0
- package/dist/constants.js +15 -0
- package/dist/constants.js.map +1 -1
- package/dist/data/constants.d.ts +0 -8
- package/dist/data/constants.js +0 -9
- package/dist/data/constants.js.map +1 -1
- package/dist/data/utils/dataUtils.d.ts +1 -0
- package/dist/data/utils/dataUtils.js +14 -0
- package/dist/data/utils/dataUtils.js.map +1 -1
- package/dist/data/utils/index.d.ts +1 -2
- package/dist/data/utils/index.js +1 -2
- package/dist/data/utils/index.js.map +1 -1
- package/dist/forgot-password/ForgotPasswordPage.d.ts +2 -36
- package/dist/forgot-password/ForgotPasswordPage.js +45 -44
- package/dist/forgot-password/ForgotPasswordPage.js.map +1 -1
- package/dist/forgot-password/data/api.d.ts +2 -0
- package/dist/forgot-password/data/{service.js → api.js} +13 -14
- package/dist/forgot-password/data/api.js.map +1 -0
- package/dist/forgot-password/data/apiHook.d.ts +16 -0
- package/dist/forgot-password/data/apiHook.js +26 -0
- package/dist/forgot-password/data/apiHook.js.map +1 -0
- package/dist/forgot-password/index.d.ts +0 -4
- package/dist/forgot-password/index.js +0 -4
- package/dist/forgot-password/index.js.map +1 -1
- package/dist/forgot-password/messages.js +1 -1
- package/dist/forgot-password/messages.js.map +1 -1
- package/dist/i18n/index.d.ts +1 -25
- package/dist/i18n/index.js +1 -25
- package/dist/i18n/index.js.map +1 -1
- package/dist/login/ChangePasswordPrompt.js +11 -5
- package/dist/login/ChangePasswordPrompt.js.map +1 -1
- package/dist/login/LoginPage.d.ts +12 -10
- package/dist/login/LoginPage.js +85 -127
- package/dist/login/LoginPage.js.map +1 -1
- package/dist/login/components/LoginContext.d.ts +21 -0
- package/dist/login/components/LoginContext.js +28 -0
- package/dist/login/components/LoginContext.js.map +1 -0
- package/dist/login/data/api.d.ts +2 -0
- package/dist/login/data/api.js +27 -0
- package/dist/login/data/api.js.map +1 -0
- package/dist/login/data/apiHook.d.ts +13 -0
- package/dist/login/data/apiHook.js +57 -0
- package/dist/login/data/apiHook.js.map +1 -0
- package/dist/login/index.d.ts +0 -3
- package/dist/login/index.js +0 -3
- package/dist/login/index.js.map +1 -1
- package/dist/logistration/Logistration.d.ts +5 -32
- package/dist/logistration/Logistration.js +28 -54
- package/dist/logistration/Logistration.js.map +1 -1
- package/dist/progressive-profiling/ProgressiveProfiling.d.ts +2 -46
- package/dist/progressive-profiling/ProgressiveProfiling.js +47 -71
- package/dist/progressive-profiling/ProgressiveProfiling.js.map +1 -1
- package/dist/progressive-profiling/ProgressiveProfilingPageModal.js +8 -1
- package/dist/progressive-profiling/ProgressiveProfilingPageModal.js.map +1 -1
- package/dist/progressive-profiling/components/ProgressiveProfilingContext.d.ts +18 -0
- package/dist/progressive-profiling/components/ProgressiveProfilingContext.js +52 -0
- package/dist/progressive-profiling/components/ProgressiveProfilingContext.js.map +1 -0
- package/dist/progressive-profiling/data/api.d.ts +2 -0
- package/dist/progressive-profiling/data/{service.js → api.js} +11 -12
- package/dist/progressive-profiling/data/api.js.map +1 -0
- package/dist/progressive-profiling/data/apiHook.d.ts +10 -0
- package/dist/progressive-profiling/data/apiHook.js +36 -0
- package/dist/progressive-profiling/data/apiHook.js.map +1 -0
- package/dist/progressive-profiling/index.d.ts +0 -2
- package/dist/progressive-profiling/index.js +0 -2
- package/dist/progressive-profiling/index.js.map +1 -1
- package/dist/register/RegistrationFields/CountryField/CountryField.d.ts +1 -1
- package/dist/register/RegistrationFields/CountryField/CountryField.js +5 -7
- package/dist/register/RegistrationFields/CountryField/CountryField.js.map +1 -1
- package/dist/register/RegistrationFields/EmailField/EmailField.js +17 -9
- package/dist/register/RegistrationFields/EmailField/EmailField.js.map +1 -1
- package/dist/register/RegistrationFields/NameField/NameField.js +14 -7
- package/dist/register/RegistrationFields/NameField/NameField.js.map +1 -1
- package/dist/register/RegistrationFields/NameField/validator.d.ts +1 -0
- package/dist/register/RegistrationFields/NameField/validator.js +4 -0
- package/dist/register/RegistrationFields/NameField/validator.js.map +1 -1
- package/dist/register/RegistrationFields/UsernameField/UsernameField.js +20 -14
- package/dist/register/RegistrationFields/UsernameField/UsernameField.js.map +1 -1
- package/dist/register/RegistrationPage.d.ts +1 -1
- package/dist/register/RegistrationPage.js +102 -59
- package/dist/register/RegistrationPage.js.map +1 -1
- package/dist/register/components/RegisterContext.d.ts +8 -0
- package/dist/register/components/RegisterContext.js +167 -0
- package/dist/register/components/RegisterContext.js.map +1 -0
- package/dist/register/components/RegistrationFailure.js +4 -1
- package/dist/register/components/RegistrationFailure.js.map +1 -1
- package/dist/register/data/api.d.ts +9 -0
- package/dist/register/data/api.js +45 -0
- package/dist/register/data/api.js.map +1 -0
- package/dist/register/data/apiHook.d.ts +33 -0
- package/dist/register/data/apiHook.js +66 -0
- package/dist/register/data/apiHook.js.map +1 -0
- package/dist/register/data/constants.d.ts +1 -0
- package/dist/register/data/constants.js +1 -0
- package/dist/register/data/constants.js.map +1 -1
- package/dist/register/index.d.ts +0 -2
- package/dist/register/index.js +0 -3
- package/dist/register/index.js.map +1 -1
- package/dist/register/messages.d.ts +10 -0
- package/dist/register/messages.js +10 -0
- package/dist/register/messages.js.map +1 -1
- package/dist/register/types.d.ts +74 -0
- package/dist/register/types.js +2 -0
- package/dist/register/types.js.map +1 -0
- package/dist/reset-password/ResetPasswordPage.d.ts +2 -32
- package/dist/reset-password/ResetPasswordPage.js +90 -58
- package/dist/reset-password/ResetPasswordPage.js.map +1 -1
- package/dist/reset-password/data/api.d.ts +4 -0
- package/dist/reset-password/data/api.js +57 -0
- package/dist/reset-password/data/api.js.map +1 -0
- package/dist/reset-password/data/apiHook.d.ts +31 -0
- package/dist/reset-password/data/apiHook.js +74 -0
- package/dist/reset-password/data/apiHook.js.map +1 -0
- package/dist/reset-password/index.d.ts +0 -4
- package/dist/reset-password/index.js +0 -4
- package/dist/reset-password/index.js.map +1 -1
- package/dist/routes.d.ts +1 -0
- package/dist/routes.js +15 -14
- package/dist/routes.js.map +1 -1
- package/dist/sass/_registration.scss +8 -10
- package/dist/slots/LoginComponentSlot/index.d.ts +12 -0
- package/dist/slots/LoginComponentSlot/index.js +11 -0
- package/dist/slots/LoginComponentSlot/index.js.map +1 -0
- package/package.json +25 -14
- package/dist/common-components/data/actions.d.ts +0 -26
- package/dist/common-components/data/actions.js +0 -22
- package/dist/common-components/data/actions.js.map +0 -1
- package/dist/common-components/data/reducers.d.ts +0 -62
- package/dist/common-components/data/reducers.js +0 -39
- package/dist/common-components/data/reducers.js.map +0 -1
- package/dist/common-components/data/sagas.d.ts +0 -12
- package/dist/common-components/data/sagas.js +0 -21
- package/dist/common-components/data/sagas.js.map +0 -1
- package/dist/common-components/data/selectors.d.ts +0 -98
- package/dist/common-components/data/selectors.js +0 -11
- package/dist/common-components/data/selectors.js.map +0 -1
- package/dist/common-components/data/service.d.ts +0 -5
- package/dist/common-components/data/service.js +0 -31
- package/dist/common-components/data/service.js.map +0 -1
- package/dist/data/configureStore.d.ts +0 -3
- package/dist/data/configureStore.js +0 -24
- package/dist/data/configureStore.js.map +0 -1
- package/dist/data/reducers.d.ts +0 -254
- package/dist/data/reducers.js +0 -17
- package/dist/data/reducers.js.map +0 -1
- package/dist/data/sagas.d.ts +0 -1
- package/dist/data/sagas.js +0 -18
- package/dist/data/sagas.js.map +0 -1
- package/dist/data/utils/reduxUtils.d.ts +0 -15
- package/dist/data/utils/reduxUtils.js +0 -29
- package/dist/data/utils/reduxUtils.js.map +0 -1
- package/dist/forgot-password/data/actions.d.ts +0 -30
- package/dist/forgot-password/data/actions.js +0 -26
- package/dist/forgot-password/data/actions.js.map +0 -1
- package/dist/forgot-password/data/reducers.d.ts +0 -13
- package/dist/forgot-password/data/reducers.js +0 -46
- package/dist/forgot-password/data/reducers.js.map +0 -1
- package/dist/forgot-password/data/sagas.d.ts +0 -4
- package/dist/forgot-password/data/sagas.js +0 -28
- package/dist/forgot-password/data/sagas.js.map +0 -1
- package/dist/forgot-password/data/selectors.d.ts +0 -23
- package/dist/forgot-password/data/selectors.js +0 -5
- package/dist/forgot-password/data/selectors.js.map +0 -1
- package/dist/forgot-password/data/service.d.ts +0 -1
- package/dist/forgot-password/data/service.js.map +0 -1
- package/dist/login/data/actions.d.ts +0 -36
- package/dist/login/data/actions.js +0 -32
- package/dist/login/data/actions.js.map +0 -1
- package/dist/login/data/reducers.d.ts +0 -82
- package/dist/login/data/reducers.js +0 -44
- package/dist/login/data/reducers.js.map +0 -1
- package/dist/login/data/sagas.d.ts +0 -10
- package/dist/login/data/sagas.js +0 -34
- package/dist/login/data/sagas.js.map +0 -1
- package/dist/login/data/service.d.ts +0 -4
- package/dist/login/data/service.js +0 -32
- package/dist/login/data/service.js.map +0 -1
- package/dist/progressive-profiling/data/actions.d.ts +0 -19
- package/dist/progressive-profiling/data/actions.js +0 -18
- package/dist/progressive-profiling/data/actions.js.map +0 -1
- package/dist/progressive-profiling/data/reducers.d.ts +0 -22
- package/dist/progressive-profiling/data/reducers.js +0 -23
- package/dist/progressive-profiling/data/reducers.js.map +0 -1
- package/dist/progressive-profiling/data/sagas.d.ts +0 -4
- package/dist/progressive-profiling/data/sagas.js +0 -17
- package/dist/progressive-profiling/data/sagas.js.map +0 -1
- package/dist/progressive-profiling/data/selectors.d.ts +0 -39
- package/dist/progressive-profiling/data/selectors.js +0 -9
- package/dist/progressive-profiling/data/selectors.js.map +0 -1
- package/dist/progressive-profiling/data/service.d.ts +0 -1
- package/dist/progressive-profiling/data/service.js.map +0 -1
- package/dist/register/data/actions.d.ts +0 -80
- package/dist/register/data/actions.js +0 -69
- package/dist/register/data/actions.js.map +0 -1
- package/dist/register/data/reducers.d.ts +0 -237
- package/dist/register/data/reducers.js +0 -86
- package/dist/register/data/reducers.js.map +0 -1
- package/dist/register/data/sagas.d.ts +0 -19
- package/dist/register/data/sagas.js +0 -45
- package/dist/register/data/sagas.js.map +0 -1
- package/dist/register/data/selectors.d.ts +0 -26
- package/dist/register/data/selectors.js +0 -25
- package/dist/register/data/selectors.js.map +0 -1
- package/dist/register/data/service.d.ts +0 -8
- package/dist/register/data/service.js +0 -46
- package/dist/register/data/service.js.map +0 -1
- package/dist/reset-password/data/actions.d.ts +0 -56
- package/dist/reset-password/data/actions.js +0 -41
- package/dist/reset-password/data/actions.js.map +0 -1
- package/dist/reset-password/data/reducers.d.ts +0 -19
- package/dist/reset-password/data/reducers.js +0 -25
- package/dist/reset-password/data/reducers.js.map +0 -1
- package/dist/reset-password/data/sagas.d.ts +0 -7
- package/dist/reset-password/data/sagas.js +0 -63
- package/dist/reset-password/data/sagas.js.map +0 -1
- package/dist/reset-password/data/selectors.d.ts +0 -23
- package/dist/reset-password/data/selectors.js +0 -5
- package/dist/reset-password/data/selectors.js.map +0 -1
- package/dist/reset-password/data/service.d.ts +0 -3
- package/dist/reset-password/data/service.js +0 -62
- package/dist/reset-password/data/service.js.map +0 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import { fetchAuthenticatedUser, getAuthenticatedUser,
|
|
3
|
+
import { fetchAuthenticatedUser, getAuthenticatedUser, getUrlByRouteRole } from '@openedx/frontend-base';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
|
-
import {
|
|
5
|
+
import { Navigate } from 'react-router-dom';
|
|
6
|
+
import { dashboardRole } from '../constants';
|
|
5
7
|
/**
|
|
6
8
|
* This wrapper redirects the requester to our default redirect url if they are
|
|
7
9
|
* already authenticated.
|
|
@@ -17,8 +19,7 @@ const UnAuthOnlyRoute = ({ children }) => {
|
|
|
17
19
|
}, []);
|
|
18
20
|
if (isReady) {
|
|
19
21
|
if (authUser && authUser.username) {
|
|
20
|
-
|
|
21
|
-
return null;
|
|
22
|
+
return _jsx(Navigate, { to: getUrlByRouteRole(dashboardRole) || '/', replace: true });
|
|
22
23
|
}
|
|
23
24
|
return children;
|
|
24
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnAuthOnlyRoute.js","sourceRoot":"","sources":["../../src/common-components/UnAuthOnlyRoute.jsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"UnAuthOnlyRoute.js","sourceRoot":"","sources":["../../src/common-components/UnAuthOnlyRoute.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACzG,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;GAGG;AACH,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACvC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC7C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,SAAS,CAAC,GAAG,EAAE;QACb,sBAAsB,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,EAAE;YAC5F,WAAW,CAAC,iBAAiB,CAAC,CAAC;YAC/B,UAAU,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,QAAQ,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YAClC,OAAO,KAAC,QAAQ,IAAC,EAAE,EAAE,iBAAiB,CAAC,aAAa,CAAC,IAAI,GAAG,EAAE,OAAO,SAAG,CAAC;QAC3E,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,eAAe,CAAC,SAAS,GAAG;IAC1B,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;CACpC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { fetchAuthenticatedUser, getAuthenticatedUser, getUrlByRouteRole } from '@openedx/frontend-base';\nimport PropTypes from 'prop-types';\nimport { Navigate } from 'react-router-dom';\n\nimport { dashboardRole } from '../constants';\n\n/**\n * This wrapper redirects the requester to our default redirect url if they are\n * already authenticated.\n */\nconst UnAuthOnlyRoute = ({ children }) => {\n const [authUser, setAuthUser] = useState({});\n const [isReady, setIsReady] = useState(false);\n\n useEffect(() => {\n fetchAuthenticatedUser({ forceRefresh: !!getAuthenticatedUser() }).then((authenticatedUser) => {\n setAuthUser(authenticatedUser);\n setIsReady(true);\n });\n }, []);\n\n if (isReady) {\n if (authUser && authUser.username) {\n return <Navigate to={getUrlByRouteRole(dashboardRole) || '/'} replace />;\n }\n\n return children;\n }\n\n return null;\n};\n\nUnAuthOnlyRoute.propTypes = {\n children: PropTypes.node.isRequired,\n};\n\nexport default UnAuthOnlyRoute;\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
interface ThirdPartyAuthContextType {
|
|
3
|
+
fieldDescriptions: any;
|
|
4
|
+
optionalFields: {
|
|
5
|
+
fields: any;
|
|
6
|
+
extended_profile: any[];
|
|
7
|
+
};
|
|
8
|
+
thirdPartyAuthApiStatus: string | null;
|
|
9
|
+
thirdPartyAuthContext: {
|
|
10
|
+
platformName: string | null;
|
|
11
|
+
autoSubmitRegForm: boolean;
|
|
12
|
+
currentProvider: string | null;
|
|
13
|
+
finishAuthUrl: string | null;
|
|
14
|
+
countryCode: string | null;
|
|
15
|
+
providers: any[];
|
|
16
|
+
secondaryProviders: any[];
|
|
17
|
+
pipelineUserDetails: any | null;
|
|
18
|
+
errorMessage: string | null;
|
|
19
|
+
welcomePageRedirectUrl: string | null;
|
|
20
|
+
};
|
|
21
|
+
setThirdPartyAuthContextBegin: () => void;
|
|
22
|
+
setThirdPartyAuthContextSuccess: (fieldDescData: any, optionalFieldsData: any, contextData: any) => void;
|
|
23
|
+
setThirdPartyAuthContextFailure: () => void;
|
|
24
|
+
clearThirdPartyAuthErrorMessage: () => void;
|
|
25
|
+
}
|
|
26
|
+
interface ThirdPartyAuthProviderProps {
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
export declare const ThirdPartyAuthProvider: FC<ThirdPartyAuthProviderProps>;
|
|
30
|
+
export declare const useThirdPartyAuthContext: () => ThirdPartyAuthContextType;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo, useState, } from 'react';
|
|
3
|
+
import { COMPLETE_STATE, FAILURE_STATE, PENDING_STATE } from '../../data/constants';
|
|
4
|
+
const ThirdPartyAuthContext = createContext(undefined);
|
|
5
|
+
export const ThirdPartyAuthProvider = ({ children }) => {
|
|
6
|
+
const [fieldDescriptions, setFieldDescriptions] = useState({});
|
|
7
|
+
const [optionalFields, setOptionalFields] = useState({
|
|
8
|
+
fields: {},
|
|
9
|
+
extended_profile: [],
|
|
10
|
+
});
|
|
11
|
+
const [thirdPartyAuthApiStatus, setThirdPartyAuthApiStatus] = useState(null);
|
|
12
|
+
const [thirdPartyAuthContext, setThirdPartyAuthContext] = useState({
|
|
13
|
+
platformName: null,
|
|
14
|
+
autoSubmitRegForm: false,
|
|
15
|
+
currentProvider: null,
|
|
16
|
+
finishAuthUrl: null,
|
|
17
|
+
countryCode: null,
|
|
18
|
+
providers: [],
|
|
19
|
+
secondaryProviders: [],
|
|
20
|
+
pipelineUserDetails: null,
|
|
21
|
+
errorMessage: null,
|
|
22
|
+
welcomePageRedirectUrl: null,
|
|
23
|
+
});
|
|
24
|
+
// Function to handle begin state - mirrors THIRD_PARTY_AUTH_CONTEXT.BEGIN
|
|
25
|
+
const setThirdPartyAuthContextBegin = useCallback(() => {
|
|
26
|
+
setThirdPartyAuthApiStatus(PENDING_STATE);
|
|
27
|
+
}, []);
|
|
28
|
+
// Function to handle success - mirrors THIRD_PARTY_AUTH_CONTEXT.SUCCESS
|
|
29
|
+
const setThirdPartyAuthContextSuccess = useCallback((fieldDescData, optionalFieldsData, contextData) => {
|
|
30
|
+
setFieldDescriptions((fieldDescData === null || fieldDescData === void 0 ? void 0 : fieldDescData.fields) || {});
|
|
31
|
+
setOptionalFields(optionalFieldsData || { fields: {}, extended_profile: [] });
|
|
32
|
+
setThirdPartyAuthContext(contextData || {
|
|
33
|
+
platformName: null,
|
|
34
|
+
autoSubmitRegForm: false,
|
|
35
|
+
currentProvider: null,
|
|
36
|
+
finishAuthUrl: null,
|
|
37
|
+
countryCode: null,
|
|
38
|
+
providers: [],
|
|
39
|
+
secondaryProviders: [],
|
|
40
|
+
pipelineUserDetails: null,
|
|
41
|
+
errorMessage: null,
|
|
42
|
+
welcomePageRedirectUrl: null,
|
|
43
|
+
});
|
|
44
|
+
setThirdPartyAuthApiStatus(COMPLETE_STATE);
|
|
45
|
+
}, []);
|
|
46
|
+
// Function to handle failure - mirrors THIRD_PARTY_AUTH_CONTEXT.FAILURE
|
|
47
|
+
const setThirdPartyAuthContextFailure = useCallback(() => {
|
|
48
|
+
setThirdPartyAuthApiStatus(FAILURE_STATE);
|
|
49
|
+
setThirdPartyAuthContext(prev => (Object.assign(Object.assign({}, prev), { errorMessage: null })));
|
|
50
|
+
}, []);
|
|
51
|
+
// Function to clear error message - mirrors THIRD_PARTY_AUTH_CONTEXT_CLEAR_ERROR_MSG
|
|
52
|
+
const clearThirdPartyAuthErrorMessage = useCallback(() => {
|
|
53
|
+
setThirdPartyAuthApiStatus(PENDING_STATE);
|
|
54
|
+
setThirdPartyAuthContext(prev => (Object.assign(Object.assign({}, prev), { errorMessage: null })));
|
|
55
|
+
}, []);
|
|
56
|
+
const value = useMemo(() => ({
|
|
57
|
+
fieldDescriptions,
|
|
58
|
+
optionalFields,
|
|
59
|
+
thirdPartyAuthApiStatus,
|
|
60
|
+
thirdPartyAuthContext,
|
|
61
|
+
setThirdPartyAuthContextBegin,
|
|
62
|
+
setThirdPartyAuthContextSuccess,
|
|
63
|
+
setThirdPartyAuthContextFailure,
|
|
64
|
+
clearThirdPartyAuthErrorMessage,
|
|
65
|
+
}), [
|
|
66
|
+
fieldDescriptions,
|
|
67
|
+
optionalFields,
|
|
68
|
+
thirdPartyAuthApiStatus,
|
|
69
|
+
thirdPartyAuthContext,
|
|
70
|
+
setThirdPartyAuthContextBegin,
|
|
71
|
+
setThirdPartyAuthContextSuccess,
|
|
72
|
+
setThirdPartyAuthContextFailure,
|
|
73
|
+
clearThirdPartyAuthErrorMessage,
|
|
74
|
+
]);
|
|
75
|
+
return (_jsx(ThirdPartyAuthContext.Provider, { value: value, children: children }));
|
|
76
|
+
};
|
|
77
|
+
export const useThirdPartyAuthContext = () => {
|
|
78
|
+
const context = useContext(ThirdPartyAuthContext);
|
|
79
|
+
if (context === undefined) {
|
|
80
|
+
throw new Error('useThirdPartyAuthContext must be used within a ThirdPartyAuthProvider');
|
|
81
|
+
}
|
|
82
|
+
return context;
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=ThirdPartyAuthContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThirdPartyAuthContext.js","sourceRoot":"","sources":["../../../src/common-components/components/ThirdPartyAuthContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAAiB,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE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,+BAA+B;QAC/B,+BAA+B;KAChC,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACzC,QAAQ,GACsB,CAClC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAA8B,EAAE;IACtE,MAAM,OAAO,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n createContext, FC, ReactNode, useCallback, useContext, useMemo, useState,\n} from 'react';\n\nimport { COMPLETE_STATE, FAILURE_STATE, PENDING_STATE } from '../../data/constants';\n\ninterface ThirdPartyAuthContextType {\n fieldDescriptions: any,\n optionalFields: {\n fields: any,\n extended_profile: any[],\n },\n thirdPartyAuthApiStatus: string | null,\n thirdPartyAuthContext: {\n platformName: string | null,\n autoSubmitRegForm: boolean,\n currentProvider: string | null,\n finishAuthUrl: string | null,\n countryCode: string | null,\n providers: any[],\n secondaryProviders: any[],\n pipelineUserDetails: any | null,\n errorMessage: string | null,\n welcomePageRedirectUrl: string | null,\n },\n setThirdPartyAuthContextBegin: () => void,\n setThirdPartyAuthContextSuccess: (fieldDescData: any, optionalFieldsData: any, contextData: any) => void,\n setThirdPartyAuthContextFailure: () => void,\n clearThirdPartyAuthErrorMessage: () => void,\n}\n\nconst ThirdPartyAuthContext = createContext<ThirdPartyAuthContextType | undefined>(undefined);\n\ninterface ThirdPartyAuthProviderProps {\n children: ReactNode,\n}\n\nexport const ThirdPartyAuthProvider: FC<ThirdPartyAuthProviderProps> = ({ children }) => {\n const [fieldDescriptions, setFieldDescriptions] = useState({});\n const [optionalFields, setOptionalFields] = useState({\n fields: {},\n extended_profile: [],\n });\n const [thirdPartyAuthApiStatus, setThirdPartyAuthApiStatus] = useState<string | null>(null);\n const [thirdPartyAuthContext, setThirdPartyAuthContext] = useState({\n platformName: null,\n autoSubmitRegForm: false,\n currentProvider: null,\n finishAuthUrl: null,\n countryCode: null,\n providers: [],\n secondaryProviders: [],\n pipelineUserDetails: null,\n errorMessage: null,\n welcomePageRedirectUrl: null,\n });\n\n // Function to handle begin state - mirrors THIRD_PARTY_AUTH_CONTEXT.BEGIN\n const setThirdPartyAuthContextBegin = useCallback(() => {\n setThirdPartyAuthApiStatus(PENDING_STATE);\n }, []);\n\n // Function to handle success - mirrors THIRD_PARTY_AUTH_CONTEXT.SUCCESS\n const setThirdPartyAuthContextSuccess = useCallback((fieldDescData, optionalFieldsData, contextData) => {\n setFieldDescriptions(fieldDescData?.fields || {});\n setOptionalFields(optionalFieldsData || { fields: {}, extended_profile: [] });\n setThirdPartyAuthContext(contextData || {\n platformName: null,\n autoSubmitRegForm: false,\n currentProvider: null,\n finishAuthUrl: null,\n countryCode: null,\n providers: [],\n secondaryProviders: [],\n pipelineUserDetails: null,\n errorMessage: null,\n welcomePageRedirectUrl: null,\n });\n setThirdPartyAuthApiStatus(COMPLETE_STATE);\n }, []);\n\n // Function to handle failure - mirrors THIRD_PARTY_AUTH_CONTEXT.FAILURE\n const setThirdPartyAuthContextFailure = useCallback(() => {\n setThirdPartyAuthApiStatus(FAILURE_STATE);\n setThirdPartyAuthContext(prev => ({\n ...prev,\n errorMessage: null,\n }));\n }, []);\n\n // Function to clear error message - mirrors THIRD_PARTY_AUTH_CONTEXT_CLEAR_ERROR_MSG\n const clearThirdPartyAuthErrorMessage = useCallback(() => {\n setThirdPartyAuthApiStatus(PENDING_STATE);\n setThirdPartyAuthContext(prev => ({\n ...prev,\n errorMessage: null,\n }));\n }, []);\n\n const value = useMemo(() => ({\n fieldDescriptions,\n optionalFields,\n thirdPartyAuthApiStatus,\n thirdPartyAuthContext,\n setThirdPartyAuthContextBegin,\n setThirdPartyAuthContextSuccess,\n setThirdPartyAuthContextFailure,\n clearThirdPartyAuthErrorMessage,\n }), [\n fieldDescriptions,\n optionalFields,\n thirdPartyAuthApiStatus,\n thirdPartyAuthContext,\n setThirdPartyAuthContextBegin,\n setThirdPartyAuthContextSuccess,\n setThirdPartyAuthContextFailure,\n clearThirdPartyAuthErrorMessage,\n ]);\n\n return (\n <ThirdPartyAuthContext.Provider value={value}>\n {children}\n </ThirdPartyAuthContext.Provider>\n );\n};\n\nexport const useThirdPartyAuthContext = (): ThirdPartyAuthContextType => {\n const context = useContext(ThirdPartyAuthContext);\n if (context === undefined) {\n throw new Error('useThirdPartyAuthContext must be used within a ThirdPartyAuthProvider');\n }\n return context;\n};\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getAuthenticatedHttpClient, getSiteConfig } from '@openedx/frontend-base';
|
|
11
|
+
const getThirdPartyAuthContext = (urlParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
+
const requestConfig = {
|
|
13
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
14
|
+
params: urlParams,
|
|
15
|
+
isPublic: true,
|
|
16
|
+
};
|
|
17
|
+
const { data } = yield getAuthenticatedHttpClient()
|
|
18
|
+
.get(`${getSiteConfig().lmsBaseUrl}/api/mfe_context`, requestConfig);
|
|
19
|
+
return {
|
|
20
|
+
fieldDescriptions: data.registrationFields || {},
|
|
21
|
+
optionalFields: data.optionalFields || {},
|
|
22
|
+
thirdPartyAuthContext: data.contextData || {},
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
export { getThirdPartyAuthContext, };
|
|
26
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/common-components/data/api.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEnF,MAAM,wBAAwB,GAAG,CAAO,SAAiB,EAAE,EAAE;IAC3D,MAAM,aAAa,GAAG;QACpB,OAAO,EAAE,EAAE,cAAc,EAAE,mCAAmC,EAAE;QAChE,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,IAAI;KACf,CAAC;IAEF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE;SAChD,GAAG,CACF,GAAG,aAAa,EAAE,CAAC,UAAU,kBAAkB,EAC/C,aAAa,CACd,CAAC;IACJ,OAAO;QACL,iBAAiB,EAAE,IAAI,CAAC,kBAAkB,IAAI,EAAE;QAChD,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,EAAE;QACzC,qBAAqB,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;KAC9C,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,OAAO,EACL,wBAAwB,GACzB,CAAC","sourcesContent":["import { getAuthenticatedHttpClient, getSiteConfig } from '@openedx/frontend-base';\n\nconst getThirdPartyAuthContext = async (urlParams: string) => {\n const requestConfig = {\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n params: urlParams,\n isPublic: true,\n };\n\n const { data } = await getAuthenticatedHttpClient()\n .get(\n `${getSiteConfig().lmsBaseUrl}/api/mfe_context`,\n requestConfig,\n );\n return {\n fieldDescriptions: data.registrationFields || {},\n optionalFields: data.optionalFields || {},\n thirdPartyAuthContext: data.contextData || {},\n };\n};\n\nexport {\n getThirdPartyAuthContext,\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const THIRD_PARTY_AUTH_ERROR = "third-party-auth-error";
|
|
2
|
+
declare const useThirdPartyAuthHook: (pageId: any, payload: any, { enabled }?: {
|
|
3
|
+
enabled?: boolean | undefined;
|
|
4
|
+
}) => import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
fieldDescriptions: any;
|
|
6
|
+
optionalFields: any;
|
|
7
|
+
thirdPartyAuthContext: any;
|
|
8
|
+
}, Error>;
|
|
9
|
+
export { useThirdPartyAuthHook, };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { getThirdPartyAuthContext } from './api';
|
|
3
|
+
import { ThirdPartyAuthQueryKeys } from './queryKeys';
|
|
4
|
+
// Error constants
|
|
5
|
+
export const THIRD_PARTY_AUTH_ERROR = 'third-party-auth-error';
|
|
6
|
+
const useThirdPartyAuthHook = (pageId, payload, { enabled = true } = {}) => useQuery({
|
|
7
|
+
queryKey: ThirdPartyAuthQueryKeys.byPage(pageId, payload),
|
|
8
|
+
queryFn: () => getThirdPartyAuthContext(payload),
|
|
9
|
+
retry: false,
|
|
10
|
+
staleTime: 5 * 60 * 1000, // 5 minutes — TPA context is effectively static per session
|
|
11
|
+
enabled,
|
|
12
|
+
});
|
|
13
|
+
export { useThirdPartyAuthHook, };
|
|
14
|
+
//# sourceMappingURL=apiHook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiHook.js","sourceRoot":"","sources":["../../../src/common-components/data/apiHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,kBAAkB;AAClB,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAE/D,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,OAAO,GAAG,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC;IACnF,QAAQ,EAAE,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,OAAO,EAAE,GAAG,EAAE,CAAC,wBAAwB,CAAC,OAAO,CAAC;IAChD,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,4DAA4D;IACtF,OAAO;CACR,CAAC,CAAC;AAEH,OAAO,EACL,qBAAqB,GACtB,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query';\n\nimport { getThirdPartyAuthContext } from './api';\nimport { ThirdPartyAuthQueryKeys } from './queryKeys';\n\n// Error constants\nexport const THIRD_PARTY_AUTH_ERROR = 'third-party-auth-error';\n\nconst useThirdPartyAuthHook = (pageId, payload, { enabled = true } = {}) => useQuery({\n queryKey: ThirdPartyAuthQueryKeys.byPage(pageId, payload),\n queryFn: () => getThirdPartyAuthContext(payload),\n retry: false,\n staleTime: 5 * 60 * 1000, // 5 minutes — TPA context is effectively static per session\n enabled,\n});\n\nexport {\n useThirdPartyAuthHook,\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryKeys.js","sourceRoot":"","sources":["../../../src/common-components/data/queryKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,GAAG,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAU;IACvC,MAAM,EAAE,CAAC,MAAc,EAAE,OAAiB,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,CAAU;CACnG,CAAC","sourcesContent":["import { appId } from '../../constants';\n\nexport const ThirdPartyAuthQueryKeys = {\n all: [appId, 'ThirdPartyAuth'] as const,\n byPage: (pageId: string, payload?: unknown) => [appId, 'ThirdPartyAuth', pageId, payload] as const,\n};\n"]}
|
|
@@ -5,9 +5,6 @@ export { default as UnAuthOnlyRoute } from "./UnAuthOnlyRoute";
|
|
|
5
5
|
export { default as NotFoundPage } from "./NotFoundPage";
|
|
6
6
|
export { default as SocialAuthProviders } from "./SocialAuthProviders";
|
|
7
7
|
export { default as ThirdPartyAuthAlert } from "./ThirdPartyAuthAlert";
|
|
8
|
-
export { default as reducer } from "./data/reducers";
|
|
9
|
-
export { default as saga } from "./data/sagas";
|
|
10
|
-
export { storeName } from "./data/selectors";
|
|
11
8
|
export { default as FormGroup } from "./FormGroup";
|
|
12
9
|
export { default as PasswordField } from "./PasswordField";
|
|
13
10
|
export { default as InstitutionLogistration, RenderInstitutionButton } from "./InstitutionLogistration";
|
|
@@ -7,9 +7,6 @@ export { default as SocialAuthProviders } from './SocialAuthProviders';
|
|
|
7
7
|
export { default as ThirdPartyAuthAlert } from './ThirdPartyAuthAlert';
|
|
8
8
|
export { default as InstitutionLogistration } from './InstitutionLogistration';
|
|
9
9
|
export { RenderInstitutionButton } from './InstitutionLogistration';
|
|
10
|
-
export { default as reducer } from './data/reducers';
|
|
11
|
-
export { default as saga } from './data/sagas';
|
|
12
|
-
export { storeName } from './data/selectors';
|
|
13
10
|
export { default as FormGroup } from './FormGroup';
|
|
14
11
|
export { default as PasswordField } from './PasswordField';
|
|
15
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common-components/index.jsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common-components/index.jsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { default as RedirectLogistration } from './RedirectLogistration';\nexport { default as registerIcons } from './RegisterFaIcons';\nexport { default as EmbeddedRegistrationRoute } from './EmbeddedRegistrationRoute';\nexport { default as UnAuthOnlyRoute } from './UnAuthOnlyRoute';\nexport { default as NotFoundPage } from './NotFoundPage';\nexport { default as SocialAuthProviders } from './SocialAuthProviders';\nexport { default as ThirdPartyAuthAlert } from './ThirdPartyAuthAlert';\nexport { default as InstitutionLogistration } from './InstitutionLogistration';\nexport { RenderInstitutionButton } from './InstitutionLogistration';\nexport { default as FormGroup } from './FormGroup';\nexport { default as PasswordField } from './PasswordField';\n"]}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
1
|
export declare const appId = "org.openedx.frontend.app.authn";
|
|
2
|
+
export declare const loginRole = "org.openedx.frontend.role.login";
|
|
3
|
+
export declare const registerRole = "org.openedx.frontend.role.register";
|
|
4
|
+
export declare const resetPasswordRole = "org.openedx.frontend.role.resetPassword";
|
|
5
|
+
export declare const confirmPasswordRole = "org.openedx.frontend.role.confirmPassword";
|
|
6
|
+
export declare const welcomeRole = "org.openedx.frontend.role.welcome";
|
|
7
|
+
export declare const dashboardRole = "org.openedx.frontend.role.dashboard";
|
|
8
|
+
export declare const loginPath = "login";
|
|
9
|
+
export declare const registerPath = "register";
|
|
10
|
+
export declare const registerEmbeddedPath = "register-embedded";
|
|
11
|
+
export declare const resetPath = "reset";
|
|
12
|
+
export declare const welcomePath = "welcome";
|
|
13
|
+
export declare const passwordResetConfirmPath = "password_reset_confirm";
|
|
14
|
+
export declare const notFoundPath = "notfound";
|
package/dist/constants.js
CHANGED
|
@@ -1,2 +1,17 @@
|
|
|
1
1
|
export const appId = 'org.openedx.frontend.app.authn';
|
|
2
|
+
// Route roles
|
|
3
|
+
export const loginRole = 'org.openedx.frontend.role.login';
|
|
4
|
+
export const registerRole = 'org.openedx.frontend.role.register';
|
|
5
|
+
export const resetPasswordRole = 'org.openedx.frontend.role.resetPassword';
|
|
6
|
+
export const confirmPasswordRole = 'org.openedx.frontend.role.confirmPassword';
|
|
7
|
+
export const welcomeRole = 'org.openedx.frontend.role.welcome';
|
|
8
|
+
export const dashboardRole = 'org.openedx.frontend.role.dashboard';
|
|
9
|
+
// Route path segments
|
|
10
|
+
export const loginPath = 'login';
|
|
11
|
+
export const registerPath = 'register';
|
|
12
|
+
export const registerEmbeddedPath = 'register-embedded';
|
|
13
|
+
export const resetPath = 'reset';
|
|
14
|
+
export const welcomePath = 'welcome';
|
|
15
|
+
export const passwordResetConfirmPath = 'password_reset_confirm';
|
|
16
|
+
export const notFoundPath = 'notfound';
|
|
2
17
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,gCAAgC,CAAC","sourcesContent":["export const appId = 'org.openedx.frontend.app.authn';\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,gCAAgC,CAAC;AAEtD,cAAc;AACd,MAAM,CAAC,MAAM,SAAS,GAAG,iCAAiC,CAAC;AAC3D,MAAM,CAAC,MAAM,YAAY,GAAG,oCAAoC,CAAC;AACjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,yCAAyC,CAAC;AAC3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,2CAA2C,CAAC;AAC/E,MAAM,CAAC,MAAM,WAAW,GAAG,mCAAmC,CAAC;AAC/D,MAAM,CAAC,MAAM,aAAa,GAAG,qCAAqC,CAAC;AAEnE,sBAAsB;AACtB,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC;AACjC,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AACvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AACxD,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC;AACjC,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;AACrC,MAAM,CAAC,MAAM,wBAAwB,GAAG,wBAAwB,CAAC;AACjE,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC","sourcesContent":["export const appId = 'org.openedx.frontend.app.authn';\n\n// Route roles\nexport const loginRole = 'org.openedx.frontend.role.login';\nexport const registerRole = 'org.openedx.frontend.role.register';\nexport const resetPasswordRole = 'org.openedx.frontend.role.resetPassword';\nexport const confirmPasswordRole = 'org.openedx.frontend.role.confirmPassword';\nexport const welcomeRole = 'org.openedx.frontend.role.welcome';\nexport const dashboardRole = 'org.openedx.frontend.role.dashboard';\n\n// Route path segments\nexport const loginPath = 'login';\nexport const registerPath = 'register';\nexport const registerEmbeddedPath = 'register-embedded';\nexport const resetPath = 'reset';\nexport const welcomePath = 'welcome';\nexport const passwordResetConfirmPath = 'password_reset_confirm';\nexport const notFoundPath = 'notfound';\n"]}
|
package/dist/data/constants.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
export const LOGIN_PAGE: "/login";
|
|
2
|
-
export const REGISTER_PAGE: "/register";
|
|
3
|
-
export const REGISTER_EMBEDDED_PAGE: "/register-embedded";
|
|
4
|
-
export const RESET_PAGE: "/reset";
|
|
5
|
-
export const AUTHN_PROGRESSIVE_PROFILING: "/welcome";
|
|
6
|
-
export const DEFAULT_REDIRECT_URL: "/dashboard";
|
|
7
|
-
export const PASSWORD_RESET_CONFIRM: "/password_reset_confirm/:token/";
|
|
8
|
-
export const PAGE_NOT_FOUND: "/notfound";
|
|
9
1
|
export const ENTERPRISE_LOGIN_URL: "/enterprise/login";
|
|
10
2
|
export const SUPPORTED_ICON_CLASSES: string[];
|
|
11
3
|
export const FORM_SUBMISSION_ERROR: "form-submission-error";
|
package/dist/data/constants.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
// URL Paths
|
|
2
|
-
export const LOGIN_PAGE = '/login';
|
|
3
|
-
export const REGISTER_PAGE = '/register';
|
|
4
|
-
export const REGISTER_EMBEDDED_PAGE = '/register-embedded';
|
|
5
|
-
export const RESET_PAGE = '/reset';
|
|
6
|
-
export const AUTHN_PROGRESSIVE_PROFILING = '/welcome';
|
|
7
|
-
export const DEFAULT_REDIRECT_URL = '/dashboard';
|
|
8
|
-
export const PASSWORD_RESET_CONFIRM = '/password_reset_confirm/:token/';
|
|
9
|
-
export const PAGE_NOT_FOUND = '/notfound';
|
|
10
1
|
export const ENTERPRISE_LOGIN_URL = '/enterprise/login';
|
|
11
2
|
// Constants
|
|
12
3
|
export const SUPPORTED_ICON_CLASSES = ['apple', 'facebook', 'google', 'microsoft'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/data/constants.js"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/data/constants.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAExD,YAAY;AACZ,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAEnF,cAAc;AACd,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAEzD,gBAAgB;AAChB,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AACvC,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AACvC,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AACzC,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAC3C,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AACvC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AACjC,MAAM,CAAC,MAAM,iBAAiB,GAAG,oEAAoE;MACjG,iGAAiG;MACjG,qEAAqE;MACrE,oFAAoF,CAAC;AAEzF,8DAA8D;AAC9D,2DAA2D;AAC3D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,mBAAmB,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACzM,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC","sourcesContent":["export const ENTERPRISE_LOGIN_URL = '/enterprise/login';\n\n// Constants\nexport const SUPPORTED_ICON_CLASSES = ['apple', 'facebook', 'google', 'microsoft'];\n\n// Error Codes\nexport const FORM_SUBMISSION_ERROR = 'form-submission-error';\nexport const INTERNAL_SERVER_ERROR = 'internal-server-error';\nexport const API_RATELIMIT_ERROR = 'api-ratelimit-error';\n\n// Common States\nexport const DEFAULT_STATE = 'default';\nexport const PENDING_STATE = 'pending';\nexport const COMPLETE_STATE = 'complete';\nexport const FAILURE_STATE = 'failure';\nexport const FORBIDDEN_STATE = 'forbidden';\nexport const EMBEDDED = 'embedded';\n\nexport const LETTER_REGEX = /[a-zA-Z]/;\nexport const NUMBER_REGEX = /\\d/;\nexport const VALID_EMAIL_REGEX = '(^[-!#$%&\\'*+/=?^_`{}|~0-9A-Z]+(\\\\.[-!#$%&\\'*+/=?^_`{}|~0-9A-Z]+)*'\n + '|^\"([\\\\001-\\\\010\\\\013\\\\014\\\\016-\\\\037!#-\\\\[\\\\]-\\\\177]|\\\\\\\\[\\\\001-\\\\011\\\\013\\\\014\\\\016-\\\\177])*\"'\n + ')@((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\\\.)+)(?:[A-Z0-9-]{2,63})'\n + '|\\\\[(25[0-5]|2[0-4]\\\\d|[0-1]?\\\\d?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|[0-1]?\\\\d?\\\\d)){3}\\\\]$';\n\n// Query string parameters that can be passed to LMS to manage\n// things like auto-enrollment upon login and registration.\nexport const AUTH_PARAMS = ['course_id', 'enrollment_action', 'course_mode', 'email_opt_in', 'purchase_workflow', 'next', 'register_for_free', 'track', 'is_account_recovery', 'variant', 'host', 'cta'];\nexport const REDIRECT = 'redirect';\n"]}
|
|
@@ -8,4 +8,5 @@ export function getAllPossibleQueryParams(locationURl?: null): {};
|
|
|
8
8
|
export function getActivationStatus(): string | (string | null)[] | null;
|
|
9
9
|
export function isScrollBehaviorSupported(): boolean;
|
|
10
10
|
export function windowScrollTo(options: any): void;
|
|
11
|
+
export function normalizeRedirectUrl(backendUrl: any): any;
|
|
11
12
|
export function isHostAvailableInQueryParams(): boolean;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Utility functions
|
|
2
|
+
import { getSiteConfig, getUrlByRouteRole } from '@openedx/frontend-base';
|
|
2
3
|
import * as QueryString from 'query-string';
|
|
4
|
+
import { dashboardRole } from '../../constants';
|
|
3
5
|
import { AUTH_PARAMS } from '../constants';
|
|
4
6
|
export const getTpaProvider = (tpaHintProvider, primaryProviders, secondaryProviders) => {
|
|
5
7
|
let tpaProvider = null;
|
|
@@ -60,6 +62,18 @@ export const windowScrollTo = (options) => {
|
|
|
60
62
|
}
|
|
61
63
|
return window.scrollTo(options.top, options.left);
|
|
62
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Normalize a backend redirect URL: if the backend returns the LMS dashboard
|
|
67
|
+
* URL (or nothing), replace it with the role-based dashboard URL so that SPA
|
|
68
|
+
* navigation can be used when the dashboard lives in the same shell.
|
|
69
|
+
*/
|
|
70
|
+
export const normalizeRedirectUrl = (backendUrl) => {
|
|
71
|
+
const dashboardUrl = getUrlByRouteRole(dashboardRole) || '/';
|
|
72
|
+
const lmsDashboardUrl = `${getSiteConfig().lmsBaseUrl}/dashboard`;
|
|
73
|
+
return (!backendUrl || backendUrl.startsWith(lmsDashboardUrl))
|
|
74
|
+
? dashboardUrl
|
|
75
|
+
: backendUrl;
|
|
76
|
+
};
|
|
63
77
|
export const isHostAvailableInQueryParams = () => {
|
|
64
78
|
const queryParams = getAllPossibleQueryParams();
|
|
65
79
|
return 'host' in queryParams;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataUtils.js","sourceRoot":"","sources":["../../../src/data/utils/dataUtils.js"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,EAAE;IACtF,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,eAAe,GAAG,KAAK,CAAC;IAC5B,CAAC,GAAG,gBAAgB,EAAE,GAAG,kBAAkB,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAChE,IAAI,QAAQ,CAAC,EAAE,KAAK,eAAe,EAAE,CAAC;YACpC,WAAW,GAAG,QAAQ,CAAC;YACvB,IAAI,QAAQ,CAAC,eAAe,EAAE,CAAC;gBAC7B,eAAe,GAAG,IAAI,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CA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,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpH,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACjD,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEzD,OAAO,MAAM,CAAC,yBAAyB,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE,CAAC,gBAAgB,IAAI,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC;AAElG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,EAAE;IACxC,IAAI,yBAAyB,EAAE,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,MAAM,WAAW,GAAG,yBAAyB,EAAE,CAAC;IAChD,OAAO,MAAM,IAAI,WAAW,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["// Utility functions\nimport * as QueryString from 'query-string';\n\nimport { AUTH_PARAMS } from '../constants';\n\nexport const getTpaProvider = (tpaHintProvider, primaryProviders, secondaryProviders) => {\n let tpaProvider = null;\n let skipHintedLogin = false;\n [...primaryProviders, ...secondaryProviders].forEach((provider) => {\n if (provider.id === tpaHintProvider) {\n tpaProvider = provider;\n if (provider.skipHintedLogin) {\n skipHintedLogin = true;\n }\n }\n });\n return { provider: tpaProvider, skipHintedLogin };\n};\n\nexport const getTpaHint = () => {\n const params = QueryString.parse(window.location.search);\n let tpaHint = null;\n tpaHint = params.tpa_hint;\n if (!tpaHint) {\n const { next } = params;\n if (next) {\n const index = next.indexOf('tpa_hint=');\n if (index !== -1) {\n tpaHint = next.substring(index + 'tpa_hint='.length, next.length);\n }\n }\n }\n return tpaHint;\n};\n\nexport const updatePathWithQueryParams = (path) => {\n let queryParams = window.location.search;\n\n if (!queryParams) {\n return path;\n }\n\n if (queryParams.includes('track=pwreset')) {\n queryParams = queryParams.replace('?track=pwreset&', '?',).replace('?track=pwreset', '').replace('&track=pwreset', '').replace('?&', '?');\n }\n\n return `${path}${queryParams}`;\n};\n\nexport const getAllPossibleQueryParams = (locationURl = null) => {\n const urlParams = locationURl ? QueryString.parseUrl(locationURl).query : QueryString.parse(window.location.search);\n const params = {};\n Object.entries(urlParams).forEach(([key, value]) => {\n if (AUTH_PARAMS.includes(key)) {\n params[key] = value;\n }\n });\n\n return params;\n};\n\nexport const getActivationStatus = () => {\n const params = QueryString.parse(window.location.search);\n\n return params.account_activation_status;\n};\n\nexport const isScrollBehaviorSupported = () => 'scrollBehavior' in document.documentElement.style;\n\nexport const windowScrollTo = (options) => {\n if (isScrollBehaviorSupported()) {\n return window.scrollTo(options);\n }\n\n return window.scrollTo(options.top, options.left);\n};\n\nexport const isHostAvailableInQueryParams = () => {\n const queryParams = getAllPossibleQueryParams();\n return 'host' in queryParams;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"dataUtils.js","sourceRoot":"","sources":["../../../src/data/utils/dataUtils.js"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,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AC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEzD,OAAO,MAAM,CAAC,yBAAyB,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE,CAAC,gBAAgB,IAAI,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC;AAElG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,EAAE;IACxC,IAAI,yBAAyB,EAAE,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,UAAU,EAAE,EAAE;IACjD,MAAM,YAAY,GAAG,iBAAiB,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC;IAC7D,MAAM,eAAe,GAAG,GAAG,aAAa,EAAE,CAAC,UAAU,YAAY,CAAC;IAClE,OAAO,CAAC,CAAC,UAAU,IAAI,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;QAC5D,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,UAAU,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,MAAM,WAAW,GAAG,yBAAyB,EAAE,CAAC;IAChD,OAAO,MAAM,IAAI,WAAW,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["// Utility functions\nimport { getSiteConfig, getUrlByRouteRole } from '@openedx/frontend-base';\nimport * as QueryString from 'query-string';\n\nimport { dashboardRole } from '../../constants';\nimport { AUTH_PARAMS } from '../constants';\n\nexport const getTpaProvider = (tpaHintProvider, primaryProviders, secondaryProviders) => {\n let tpaProvider = null;\n let skipHintedLogin = false;\n [...primaryProviders, ...secondaryProviders].forEach((provider) => {\n if (provider.id === tpaHintProvider) {\n tpaProvider = provider;\n if (provider.skipHintedLogin) {\n skipHintedLogin = true;\n }\n }\n });\n return { provider: tpaProvider, skipHintedLogin };\n};\n\nexport const getTpaHint = () => {\n const params = QueryString.parse(window.location.search);\n let tpaHint = null;\n tpaHint = params.tpa_hint;\n if (!tpaHint) {\n const { next } = params;\n if (next) {\n const index = next.indexOf('tpa_hint=');\n if (index !== -1) {\n tpaHint = next.substring(index + 'tpa_hint='.length, next.length);\n }\n }\n }\n return tpaHint;\n};\n\nexport const updatePathWithQueryParams = (path) => {\n let queryParams = window.location.search;\n\n if (!queryParams) {\n return path;\n }\n\n if (queryParams.includes('track=pwreset')) {\n queryParams = queryParams.replace('?track=pwreset&', '?',).replace('?track=pwreset', '').replace('&track=pwreset', '').replace('?&', '?');\n }\n\n return `${path}${queryParams}`;\n};\n\nexport const getAllPossibleQueryParams = (locationURl = null) => {\n const urlParams = locationURl ? QueryString.parseUrl(locationURl).query : QueryString.parse(window.location.search);\n const params = {};\n Object.entries(urlParams).forEach(([key, value]) => {\n if (AUTH_PARAMS.includes(key)) {\n params[key] = value;\n }\n });\n\n return params;\n};\n\nexport const getActivationStatus = () => {\n const params = QueryString.parse(window.location.search);\n\n return params.account_activation_status;\n};\n\nexport const isScrollBehaviorSupported = () => 'scrollBehavior' in document.documentElement.style;\n\nexport const windowScrollTo = (options) => {\n if (isScrollBehaviorSupported()) {\n return window.scrollTo(options);\n }\n\n return window.scrollTo(options.top, options.left);\n};\n\n/**\n * Normalize a backend redirect URL: if the backend returns the LMS dashboard\n * URL (or nothing), replace it with the role-based dashboard URL so that SPA\n * navigation can be used when the dashboard lives in the same shell.\n */\nexport const normalizeRedirectUrl = (backendUrl) => {\n const dashboardUrl = getUrlByRouteRole(dashboardRole) || '/';\n const lmsDashboardUrl = `${getSiteConfig().lmsBaseUrl}/dashboard`;\n return (!backendUrl || backendUrl.startsWith(lmsDashboardUrl))\n ? dashboardUrl\n : backendUrl;\n};\n\nexport const isHostAvailableInQueryParams = () => {\n const queryParams = getAllPossibleQueryParams();\n return 'host' in queryParams;\n};\n"]}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export { default as AsyncActionType } from "./reduxUtils";
|
|
2
1
|
export { default as setCookie } from "./cookies";
|
|
3
|
-
export { getTpaProvider, getTpaHint, getAllPossibleQueryParams, getActivationStatus, isHostAvailableInQueryParams, updatePathWithQueryParams, windowScrollTo } from "./dataUtils";
|
|
2
|
+
export { getTpaProvider, getTpaHint, getAllPossibleQueryParams, getActivationStatus, isHostAvailableInQueryParams, updatePathWithQueryParams, normalizeRedirectUrl, windowScrollTo } from "./dataUtils";
|
package/dist/data/utils/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { getTpaProvider, getTpaHint, getAllPossibleQueryParams, getActivationStatus, isHostAvailableInQueryParams, updatePathWithQueryParams, windowScrollTo, } from './dataUtils';
|
|
2
|
-
export { default as AsyncActionType } from './reduxUtils';
|
|
1
|
+
export { getTpaProvider, getTpaHint, getAllPossibleQueryParams, getActivationStatus, isHostAvailableInQueryParams, updatePathWithQueryParams, normalizeRedirectUrl, windowScrollTo, } from './dataUtils';
|
|
3
2
|
export { default as setCookie } from './cookies';
|
|
4
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data/utils/index.js"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,UAAU,EACV,yBAAyB,EACzB,mBAAmB,EACnB,4BAA4B,EAC5B,yBAAyB,EACzB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data/utils/index.js"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,UAAU,EACV,yBAAyB,EACzB,mBAAmB,EACnB,4BAA4B,EAC5B,yBAAyB,EACzB,oBAAoB,EACpB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export {\n getTpaProvider,\n getTpaHint,\n getAllPossibleQueryParams,\n getActivationStatus,\n isHostAvailableInQueryParams,\n updatePathWithQueryParams,\n normalizeRedirectUrl,\n windowScrollTo,\n} from './dataUtils';\nexport { default as setCookie } from './cookies';\n"]}
|
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
propTypes: {
|
|
4
|
-
email: PropTypes.Requireable<string>;
|
|
5
|
-
emailValidationError: PropTypes.Requireable<string>;
|
|
6
|
-
forgotPassword: PropTypes.Validator<(...args: any[]) => any>;
|
|
7
|
-
setForgotPasswordFormData: PropTypes.Validator<(...args: any[]) => any>;
|
|
8
|
-
status: PropTypes.Requireable<string>;
|
|
9
|
-
submitState: PropTypes.Requireable<string>;
|
|
10
|
-
};
|
|
11
|
-
defaultProps: {
|
|
12
|
-
email: string;
|
|
13
|
-
emailValidationError: string;
|
|
14
|
-
status: null;
|
|
15
|
-
submitState: string;
|
|
16
|
-
};
|
|
17
|
-
}, {
|
|
18
|
-
email?: string | null | undefined;
|
|
19
|
-
forgotPassword: (...args: any[]) => any;
|
|
20
|
-
status?: string | null | undefined;
|
|
21
|
-
setForgotPasswordFormData: (...args: any[]) => any;
|
|
22
|
-
emailValidationError?: string | null | undefined;
|
|
23
|
-
submitState?: string | null | undefined;
|
|
24
|
-
context?: import("react-redux/es/components/Context").ReactReduxContextInstance | undefined;
|
|
25
|
-
store?: import("redux").Store | undefined;
|
|
26
|
-
} | {
|
|
27
|
-
email?: string | null | undefined;
|
|
28
|
-
forgotPassword: (...args: any[]) => any;
|
|
29
|
-
status?: string | null | undefined;
|
|
30
|
-
setForgotPasswordFormData: (...args: any[]) => any;
|
|
31
|
-
emailValidationError?: string | null | undefined;
|
|
32
|
-
submitState?: string | null | undefined;
|
|
33
|
-
store?: import("redux").Store | undefined;
|
|
34
|
-
}>;
|
|
35
|
-
export default _default;
|
|
36
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
export default ForgotPasswordPage;
|
|
2
|
+
declare function ForgotPasswordPage(): import("react/jsx-runtime").JSX.Element;
|