@openedx/frontend-app-authn 2.0.0-alpha.1 → 2.0.0-alpha.2

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.
Files changed (48) hide show
  1. package/README.rst +68 -26
  2. package/dist/app.js +1 -27
  3. package/dist/app.js.map +1 -1
  4. package/dist/base-container/components/BrandLogo.d.ts +24 -0
  5. package/dist/base-container/components/BrandLogo.js +28 -0
  6. package/dist/base-container/components/BrandLogo.js.map +1 -0
  7. package/dist/base-container/components/default-layout/LargeLayout.js +3 -3
  8. package/dist/base-container/components/default-layout/LargeLayout.js.map +1 -1
  9. package/dist/base-container/components/default-layout/MediumLayout.js +3 -3
  10. package/dist/base-container/components/default-layout/MediumLayout.js.map +1 -1
  11. package/dist/base-container/components/default-layout/SmallLayout.js +3 -3
  12. package/dist/base-container/components/default-layout/SmallLayout.js.map +1 -1
  13. package/dist/base-container/components/image-layout/ExtraSmallLayout.js +4 -3
  14. package/dist/base-container/components/image-layout/ExtraSmallLayout.js.map +1 -1
  15. package/dist/base-container/components/image-layout/LargeLayout.js +4 -3
  16. package/dist/base-container/components/image-layout/LargeLayout.js.map +1 -1
  17. package/dist/base-container/components/image-layout/MediumLayout.js +4 -3
  18. package/dist/base-container/components/image-layout/MediumLayout.js.map +1 -1
  19. package/dist/base-container/components/image-layout/SmallLayout.js +4 -3
  20. package/dist/base-container/components/image-layout/SmallLayout.js.map +1 -1
  21. package/dist/base-container/components/welcome-page-layout/LargeLayout.js +3 -3
  22. package/dist/base-container/components/welcome-page-layout/LargeLayout.js.map +1 -1
  23. package/dist/base-container/components/welcome-page-layout/MediumLayout.js +3 -3
  24. package/dist/base-container/components/welcome-page-layout/MediumLayout.js.map +1 -1
  25. package/dist/base-container/components/welcome-page-layout/SmallLayout.js +3 -3
  26. package/dist/base-container/components/welcome-page-layout/SmallLayout.js.map +1 -1
  27. package/dist/common-components/components/ThirdPartyAuthContext.js.map +1 -1
  28. package/dist/forgot-password/ForgotPasswordAlert.js +5 -1
  29. package/dist/forgot-password/ForgotPasswordAlert.js.map +1 -1
  30. package/dist/forgot-password/ForgotPasswordPage.js +1 -1
  31. package/dist/forgot-password/ForgotPasswordPage.js.map +1 -1
  32. package/dist/forgot-password/data/apiHook.js.map +1 -1
  33. package/dist/login/AccountActivationMessage.js +5 -1
  34. package/dist/login/AccountActivationMessage.js.map +1 -1
  35. package/dist/login/components/LoginContext.js.map +1 -1
  36. package/dist/login/data/apiHook.js.map +1 -1
  37. package/dist/progressive-profiling/ProgressiveProfiling.js +1 -1
  38. package/dist/progressive-profiling/ProgressiveProfiling.js.map +1 -1
  39. package/dist/progressive-profiling/ProgressiveProfilingPageModal.d.ts +3 -1
  40. package/dist/progressive-profiling/ProgressiveProfilingPageModal.js +7 -4
  41. package/dist/progressive-profiling/ProgressiveProfilingPageModal.js.map +1 -1
  42. package/dist/progressive-profiling/components/ProgressiveProfilingContext.js.map +1 -1
  43. package/dist/progressive-profiling/data/apiHook.js.map +1 -1
  44. package/dist/register/components/RegisterContext.js.map +1 -1
  45. package/dist/register/data/apiHook.js.map +1 -1
  46. package/dist/register/types.js.map +1 -1
  47. package/dist/reset-password/data/apiHook.js.map +1 -1
  48. package/package.json +2 -2
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useAppConfig, getSiteConfig, useIntl } from '@openedx/frontend-base';
3
- import { Hyperlink, Image } from '@openedx/paragon';
2
+ import { getSiteConfig, useIntl } from '@openedx/frontend-base';
4
3
  import PropTypes from 'prop-types';
4
+ import BrandLogo from '../BrandLogo';
5
5
  import messages from './messages';
6
6
  const SmallLayout = ({ fullName }) => {
7
7
  const { formatMessage } = useIntl();
8
- return (_jsxs("div", { className: "min-vw-100 bg-light-200", children: [_jsx("div", { className: "col-md-12 small-screen-top-stripe" }), _jsx(Hyperlink, { destination: useAppConfig().MARKETING_SITE_BASE_URL, children: _jsx(Image, { className: "logo-small", alt: getSiteConfig().siteName, src: useAppConfig().LOGO_URL }) }), _jsxs("div", { className: "d-flex align-items-center m-3.5", children: [_jsx("div", { className: "small-yellow-line mt-4.5" }), _jsxs("div", { children: [_jsx("h1", { className: "h5 data-hj-suppress", children: formatMessage(messages['welcome.to.platform'], { siteName: getSiteConfig().siteName, fullName }) }), _jsxs("h2", { className: "h1", children: [formatMessage(messages['complete.your.profile.1']), _jsx("div", { className: "text-accent-a", children: formatMessage(messages['complete.your.profile.2']) })] })] })] })] }));
8
+ return (_jsxs("div", { className: "min-vw-100 bg-light-200", children: [_jsx("div", { className: "col-md-12 small-screen-top-stripe" }), _jsx(BrandLogo, { className: "logo-small", variant: "default" }), _jsxs("div", { className: "d-flex align-items-center m-3.5", children: [_jsx("div", { className: "small-yellow-line mt-4.5" }), _jsxs("div", { children: [_jsx("h1", { className: "h5 data-hj-suppress", children: formatMessage(messages['welcome.to.platform'], { siteName: getSiteConfig().siteName, fullName }) }), _jsxs("h2", { className: "h1", children: [formatMessage(messages['complete.your.profile.1']), _jsx("div", { className: "text-accent-a", children: formatMessage(messages['complete.your.profile.2']) })] })] })] })] }));
9
9
  };
10
10
  SmallLayout.propTypes = {
11
11
  fullName: PropTypes.string.isRequired,
@@ -1 +1 @@
1
- {"version":3,"file":"SmallLayout.js","sourceRoot":"","sources":["../../../../src/base-container/components/welcome-page-layout/SmallLayout.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,WAAW,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACnC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,OAAO,CACL,eAAK,SAAS,EAAC,yBAAyB,aACtC,cAAK,SAAS,EAAC,mCAAmC,GAAG,EACrD,KAAC,SAAS,IAAC,WAAW,EAAE,YAAY,EAAE,CAAC,uBAAuB,YAC5D,KAAC,KAAK,IAAC,SAAS,EAAC,YAAY,EAAC,GAAG,EAAE,aAAa,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,QAAQ,GAAI,GACnF,EACZ,eAAK,SAAS,EAAC,iCAAiC,aAC9C,cAAK,SAAS,EAAC,0BAA0B,GAAG,EAC5C,0BACE,aAAI,SAAS,EAAC,qBAAqB,YAChC,aAAa,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,GAC9F,EACL,cAAI,SAAS,EAAC,IAAI,aACf,aAAa,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC,EACnD,cAAK,SAAS,EAAC,eAAe,YAC3B,aAAa,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC,GAC/C,IACH,IACD,IACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,WAAW,CAAC,SAAS,GAAG;IACtB,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;CACtC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { useAppConfig, getSiteConfig, useIntl } from '@openedx/frontend-base';\nimport { Hyperlink, Image } from '@openedx/paragon';\nimport PropTypes from 'prop-types';\n\nimport messages from './messages';\n\nconst SmallLayout = ({ fullName }) => {\n const { formatMessage } = useIntl();\n\n return (\n <div className=\"min-vw-100 bg-light-200\">\n <div className=\"col-md-12 small-screen-top-stripe\" />\n <Hyperlink destination={useAppConfig().MARKETING_SITE_BASE_URL}>\n <Image className=\"logo-small\" alt={getSiteConfig().siteName} src={useAppConfig().LOGO_URL} />\n </Hyperlink>\n <div className=\"d-flex align-items-center m-3.5\">\n <div className=\"small-yellow-line mt-4.5\" />\n <div>\n <h1 className=\"h5 data-hj-suppress\">\n {formatMessage(messages['welcome.to.platform'], { siteName: getSiteConfig().siteName, fullName })}\n </h1>\n <h2 className=\"h1\">\n {formatMessage(messages['complete.your.profile.1'])}\n <div className=\"text-accent-a\">\n {formatMessage(messages['complete.your.profile.2'])}\n </div>\n </h2>\n </div>\n </div>\n </div>\n );\n};\n\nSmallLayout.propTypes = {\n fullName: PropTypes.string.isRequired,\n};\n\nexport default SmallLayout;\n"]}
1
+ {"version":3,"file":"SmallLayout.js","sourceRoot":"","sources":["../../../../src/base-container/components/welcome-page-layout/SmallLayout.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,WAAW,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACnC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,OAAO,CACL,eAAK,SAAS,EAAC,yBAAyB,aACtC,cAAK,SAAS,EAAC,mCAAmC,GAAG,EACrD,KAAC,SAAS,IAAC,SAAS,EAAC,YAAY,EAAC,OAAO,EAAC,SAAS,GAAG,EACtD,eAAK,SAAS,EAAC,iCAAiC,aAC9C,cAAK,SAAS,EAAC,0BAA0B,GAAG,EAC5C,0BACE,aAAI,SAAS,EAAC,qBAAqB,YAChC,aAAa,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,GAC9F,EACL,cAAI,SAAS,EAAC,IAAI,aACf,aAAa,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC,EACnD,cAAK,SAAS,EAAC,eAAe,YAC3B,aAAa,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC,GAC/C,IACH,IACD,IACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,WAAW,CAAC,SAAS,GAAG;IACtB,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;CACtC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { getSiteConfig, useIntl } from '@openedx/frontend-base';\nimport PropTypes from 'prop-types';\n\nimport BrandLogo from '../BrandLogo';\nimport messages from './messages';\n\nconst SmallLayout = ({ fullName }) => {\n const { formatMessage } = useIntl();\n\n return (\n <div className=\"min-vw-100 bg-light-200\">\n <div className=\"col-md-12 small-screen-top-stripe\" />\n <BrandLogo className=\"logo-small\" variant=\"default\" />\n <div className=\"d-flex align-items-center m-3.5\">\n <div className=\"small-yellow-line mt-4.5\" />\n <div>\n <h1 className=\"h5 data-hj-suppress\">\n {formatMessage(messages['welcome.to.platform'], { siteName: getSiteConfig().siteName, fullName })}\n </h1>\n <h2 className=\"h1\">\n {formatMessage(messages['complete.your.profile.1'])}\n <div className=\"text-accent-a\">\n {formatMessage(messages['complete.your.profile.2'])}\n </div>\n </h2>\n </div>\n </div>\n </div>\n );\n};\n\nSmallLayout.propTypes = {\n fullName: PropTypes.string.isRequired,\n};\n\nexport default SmallLayout;\n"]}
@@ -1 +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,QAAQ,GACzE,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA2BpF,MAAM,qBAAqB,GAAG,aAAa,CAAwC,SAAS,CAAC,CAAC;AAM9F,MAAM,CAAC,MAAM,sBAAsB,GAAoC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACtF,MAAM,CAAC,iBAAiB,EAAE,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AI,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"]}
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,QAAQ,GACzE,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA2BpF,MAAM,qBAAqB,GAAG,aAAa,CAAwC,SAAS,CAAC,CAAC;AAM9F,MAAM,CAAC,MAAM,sBAAsB,GAAoC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACtF,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC;QACnD,MAAM,EAAE,EAAE;QACV,gBAAgB,EAAE,EAAE;KACrB,CAAC,CAAC;IACH,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC5F,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAAC;QACjE,YAAY,EAAE,IAAI;QAClB,iBAAiB,EAAE,KAAK;QACxB,eAAe,EAAE,IAAI;QACrB,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,IAAI;QACjB,SAAS,EAAE,EAAE;QACb,kBAAkB,EAAE,EAAE;QACtB,mBAAmB,EAAE,IAAI;QACzB,YAAY,EAAE,IAAI;QAClB,sBAAsB,EAAE,IAAI;KAC7B,CAAC,CAAC;IAEH,0EAA0E;IAC1E,MAAM,6BAA6B,GAAG,WAAW,CAA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E,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC3B,iBAAiB;QACjB,cAAc;QACd,uBAAuB;QACvB,qBAAqB;QACrB,6BAA6B;QAC7B,+BAA+B;QAC/B,+BAA+B;QAC/B,+BAA+B;KAChC,CAAC,EAAE;QACF,iBAAiB;QACjB,cAAc;QACd,uBAAuB;QACvB,qBAAqB;QACrB,6BAA6B;QAC7B,+BAA+B;QAC/B,+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"]}
@@ -9,6 +9,10 @@ import messages from './messages';
9
9
  const ForgotPasswordAlert = (props) => {
10
10
  const { formatMessage } = useIntl();
11
11
  const { email, emailError } = props;
12
+ // Without a support link configured there is nowhere to point; the sentence still
13
+ // reads correctly with the phrase as plain text.
14
+ const passwordResetSupportLink = useAppConfig().PASSWORD_RESET_SUPPORT_LINK;
15
+ const supportLinkText = formatMessage(messages['confirmation.support.link']);
12
16
  let message = '';
13
17
  let heading = formatMessage(messages['forgot.password.error.alert.title']);
14
18
  let { status } = props;
@@ -20,7 +24,7 @@ const ForgotPasswordAlert = (props) => {
20
24
  heading = formatMessage(messages['confirmation.message.title']);
21
25
  message = (_jsx(FormattedMessage, { id: "forgot.password.confirmation.message", defaultMessage: "We sent an email to {email} with instructions to reset your password.\n If you do not receive a password reset message after 1 minute, verify that you entered\n the correct email address, or check your spam folder. If you need further assistance, {supportLink}.", description: "Forgot password confirmation message", values: {
22
26
  email: _jsx("span", { className: "data-hj-suppress", children: email }),
23
- supportLink: (_jsx(Alert.Link, { href: useAppConfig().PASSWORD_RESET_SUPPORT_LINK, target: "_blank", children: formatMessage(messages['confirmation.support.link']) })),
27
+ supportLink: passwordResetSupportLink ? (_jsx(Alert.Link, { href: passwordResetSupportLink, target: "_blank", children: supportLinkText })) : supportLinkText,
24
28
  } }));
25
29
  break;
26
30
  case INTERNAL_SERVER_ERROR:
@@ -1 +1 @@
1
- {"version":3,"file":"ForgotPasswordAlert.js","sourceRoot":"","sources":["../../src/forgot-password/ForgotPasswordAlert.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EACL,cAAc,EAAE,eAAe,EAAE,qBAAqB,EAAE,qBAAqB,GAC9E,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,EAAE;IACpC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IACpC,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAC,CAAC;IAC3E,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEvB,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,GAAG,qBAAqB,CAAC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AO,GAAG,aAAa,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAC,CAAC;YACvE,MAAM;QACR,KAAK,cAAc,CAAC,qBAAqB;YACvC,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,+CAA+C,CAAC,CAAC,CAAC;YACnF,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,uCAAuC,CAAC,CAAC,CAAC;YAC3E,MAAM;QACR;YACE,MAAM;IACV,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CACL,MAAC,KAAK,IACJ,EAAE,EAAC,mBAAmB,EACtB,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,GAAG,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,EAC1D,IAAI,EAAE,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,aAEjD,KAAC,KAAK,CAAC,OAAO,cAAE,OAAO,GAAiB,EACxC,sBAAI,OAAO,GAAK,IACV,CACT,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG;IACjC,KAAK,EAAE,EAAE;IACT,UAAU,EAAE,EAAE;CACf,CAAC;AAEF,mBAAmB,CAAC,SAAS,GAAG;IAC9B,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACnC,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,UAAU,EAAE,SAAS,CAAC,MAAM;CAC7B,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { FormattedMessage, useAppConfig, useIntl } from '@openedx/frontend-base';\nimport { Alert } from '@openedx/paragon';\nimport { CheckCircle, Error } from '@openedx/paragon/icons';\nimport PropTypes from 'prop-types';\n\nimport {\n COMPLETE_STATE, FORBIDDEN_STATE, FORM_SUBMISSION_ERROR, INTERNAL_SERVER_ERROR,\n} from '../data/constants';\nimport { PASSWORD_RESET } from '../reset-password/data/constants';\nimport messages from './messages';\n\nconst ForgotPasswordAlert = (props) => {\n const { formatMessage } = useIntl();\n const { email, emailError } = props;\n let message = '';\n let heading = formatMessage(messages['forgot.password.error.alert.title']);\n let { status } = props;\n\n if (emailError) {\n status = FORM_SUBMISSION_ERROR;\n }\n\n switch (status) {\n case COMPLETE_STATE:\n heading = formatMessage(messages['confirmation.message.title']);\n message = (\n <FormattedMessage\n id=\"forgot.password.confirmation.message\"\n defaultMessage=\"We sent an email to {email} with instructions to reset your password.\n If you do not receive a password reset message after 1 minute, verify that you entered\n the correct email address, or check your spam folder. If you need further assistance, {supportLink}.\"\n description=\"Forgot password confirmation message\"\n values={{\n email: <span className=\"data-hj-suppress\">{email}</span>,\n supportLink: (\n <Alert.Link href={useAppConfig().PASSWORD_RESET_SUPPORT_LINK} target=\"_blank\">\n {formatMessage(messages['confirmation.support.link'])}\n </Alert.Link>\n ),\n }}\n />\n );\n break;\n case INTERNAL_SERVER_ERROR:\n message = formatMessage(messages['internal.server.error']);\n break;\n case FORBIDDEN_STATE:\n heading = formatMessage(messages['forgot.password.error.message.title']);\n message = formatMessage(messages['forgot.password.request.in.progress.message']);\n break;\n case FORM_SUBMISSION_ERROR:\n message = formatMessage(messages['extend.field.errors'], { emailError });\n break;\n case PASSWORD_RESET.INVALID_TOKEN:\n heading = formatMessage(messages['invalid.token.heading']);\n message = formatMessage(messages['invalid.token.error.message']);\n break;\n case PASSWORD_RESET.FORBIDDEN_REQUEST:\n heading = formatMessage(messages['token.validation.rate.limit.error.heading']);\n message = formatMessage(messages['token.validation.rate.limit.error']);\n break;\n case PASSWORD_RESET.INTERNAL_SERVER_ERROR:\n heading = formatMessage(messages['token.validation.internal.sever.error.heading']);\n message = formatMessage(messages['token.validation.internal.sever.error']);\n break;\n default:\n break;\n }\n\n if (message) {\n return (\n <Alert\n id=\"validation-errors\"\n className=\"mb-4\"\n variant={`${status === 'complete' ? 'success' : 'danger'}`}\n icon={status === 'complete' ? CheckCircle : Error}\n >\n <Alert.Heading>{heading}</Alert.Heading>\n <p>{message}</p>\n </Alert>\n );\n }\n return null;\n};\n\nForgotPasswordAlert.defaultProps = {\n email: '',\n emailError: '',\n};\n\nForgotPasswordAlert.propTypes = {\n status: PropTypes.string.isRequired,\n email: PropTypes.string,\n emailError: PropTypes.string,\n};\n\nexport default ForgotPasswordAlert;\n"]}
1
+ {"version":3,"file":"ForgotPasswordAlert.js","sourceRoot":"","sources":["../../src/forgot-password/ForgotPasswordAlert.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EACL,cAAc,EAAE,eAAe,EAAE,qBAAqB,EAAE,qBAAqB,GAC9E,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,EAAE;IACpC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IACpC,kFAAkF;IAClF,iDAAiD;IACjD,MAAM,wBAAwB,GAAG,YAAY,EAAE,CAAC,2BAA2B,CAAC;IAC5E,MAAM,eAAe,GAAG,aAAa,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC,CAAC;IAC7E,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAC,CAAC;IAC3E,IAAI,EAAE,MAAM,EAAE,GAAG,K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G,aAAa,CAAC,QAAQ,CAAC,2CAA2C,CAAC,CAAC,CAAC;YAC/E,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAC,CAAC;YACvE,MAAM;QACR,KAAK,cAAc,CAAC,qBAAqB;YACvC,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,+CAA+C,CAAC,CAAC,CAAC;YACnF,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,uCAAuC,CAAC,CAAC,CAAC;YAC3E,MAAM;QACR;YACE,MAAM;IACV,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CACL,MAAC,KAAK,IACJ,EAAE,EAAC,mBAAmB,EACtB,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,GAAG,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,EAC1D,IAAI,EAAE,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,aAEjD,KAAC,KAAK,CAAC,OAAO,cAAE,OAAO,GAAiB,EACxC,sBAAI,OAAO,GAAK,IACV,CACT,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG;IACjC,KAAK,EAAE,EAAE;IACT,UAAU,EAAE,EAAE;CACf,CAAC;AAEF,mBAAmB,CAAC,SAAS,GAAG;IAC9B,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACnC,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,UAAU,EAAE,SAAS,CAAC,MAAM;CAC7B,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { FormattedMessage, useAppConfig, useIntl } from '@openedx/frontend-base';\nimport { Alert } from '@openedx/paragon';\nimport { CheckCircle, Error } from '@openedx/paragon/icons';\nimport PropTypes from 'prop-types';\n\nimport {\n COMPLETE_STATE, FORBIDDEN_STATE, FORM_SUBMISSION_ERROR, INTERNAL_SERVER_ERROR,\n} from '../data/constants';\nimport { PASSWORD_RESET } from '../reset-password/data/constants';\nimport messages from './messages';\n\nconst ForgotPasswordAlert = (props) => {\n const { formatMessage } = useIntl();\n const { email, emailError } = props;\n // Without a support link configured there is nowhere to point; the sentence still\n // reads correctly with the phrase as plain text.\n const passwordResetSupportLink = useAppConfig().PASSWORD_RESET_SUPPORT_LINK;\n const supportLinkText = formatMessage(messages['confirmation.support.link']);\n let message = '';\n let heading = formatMessage(messages['forgot.password.error.alert.title']);\n let { status } = props;\n\n if (emailError) {\n status = FORM_SUBMISSION_ERROR;\n }\n\n switch (status) {\n case COMPLETE_STATE:\n heading = formatMessage(messages['confirmation.message.title']);\n message = (\n <FormattedMessage\n id=\"forgot.password.confirmation.message\"\n defaultMessage=\"We sent an email to {email} with instructions to reset your password.\n If you do not receive a password reset message after 1 minute, verify that you entered\n the correct email address, or check your spam folder. If you need further assistance, {supportLink}.\"\n description=\"Forgot password confirmation message\"\n values={{\n email: <span className=\"data-hj-suppress\">{email}</span>,\n supportLink: passwordResetSupportLink ? (\n <Alert.Link href={passwordResetSupportLink} target=\"_blank\">\n {supportLinkText}\n </Alert.Link>\n ) : supportLinkText,\n }}\n />\n );\n break;\n case INTERNAL_SERVER_ERROR:\n message = formatMessage(messages['internal.server.error']);\n break;\n case FORBIDDEN_STATE:\n heading = formatMessage(messages['forgot.password.error.message.title']);\n message = formatMessage(messages['forgot.password.request.in.progress.message']);\n break;\n case FORM_SUBMISSION_ERROR:\n message = formatMessage(messages['extend.field.errors'], { emailError });\n break;\n case PASSWORD_RESET.INVALID_TOKEN:\n heading = formatMessage(messages['invalid.token.heading']);\n message = formatMessage(messages['invalid.token.error.message']);\n break;\n case PASSWORD_RESET.FORBIDDEN_REQUEST:\n heading = formatMessage(messages['token.validation.rate.limit.error.heading']);\n message = formatMessage(messages['token.validation.rate.limit.error']);\n break;\n case PASSWORD_RESET.INTERNAL_SERVER_ERROR:\n heading = formatMessage(messages['token.validation.internal.sever.error.heading']);\n message = formatMessage(messages['token.validation.internal.sever.error']);\n break;\n default:\n break;\n }\n\n if (message) {\n return (\n <Alert\n id=\"validation-errors\"\n className=\"mb-4\"\n variant={`${status === 'complete' ? 'success' : 'danger'}`}\n icon={status === 'complete' ? CheckCircle : Error}\n >\n <Alert.Heading>{heading}</Alert.Heading>\n <p>{message}</p>\n </Alert>\n );\n }\n return null;\n};\n\nForgotPasswordAlert.defaultProps = {\n email: '',\n emailError: '',\n};\n\nForgotPasswordAlert.propTypes = {\n status: PropTypes.string.isRequired,\n email: PropTypes.string,\n emailError: PropTypes.string,\n};\n\nexport default ForgotPasswordAlert;\n"]}
@@ -86,7 +86,7 @@ const ForgotPasswordPage = () => {
86
86
  return (_jsxs(BaseContainer, { children: [_jsx(Helmet, { children: _jsx("title", { children: formatMessage(messages['forgot.password.page.title'], { siteName: getSiteConfig().siteName }) }) }), _jsxs("div", { children: [_jsx(Tabs, { activeKey: "", id: "controlled-tab", onSelect: () => navigate(updatePathWithQueryParams(getUrlByRouteRole(loginRole))), children: _jsx(Tab, { title: tabTitle, eventKey: loginPath }) }), _jsx("div", { id: "main-content", className: "main-content", children: _jsxs(Form, { id: "forget-password-form", name: "forget-password-form", className: "mw-xs", children: [_jsx(ForgotPasswordAlert, { email: bannerEmail, emailError: formErrors, status: status }), _jsx("h2", { className: "h4", children: formatMessage(messages['forgot.password.page.heading']) }), _jsx("p", { className: "mb-4", children: formatMessage(messages['forgot.password.page.instructions']) }), _jsx(FormGroup, { floatingLabel: formatMessage(messages['forgot.password.page.email.field.label']), name: "email", value: email, autoComplete: "on", errorMessage: validationError, handleChange: (e) => setEmail(e.target.value), handleBlur: handleBlur, handleFocus: handleFocus, helpText: [formatMessage(messages['forgot.password.email.help.text'], { platformName })] }), _jsx(StatefulButton, { id: "submit-forget-password", name: "submit-forget-password", type: "submit", variant: "brand", className: "forgot-password--button", state: submitState, labels: {
87
87
  default: formatMessage(messages['forgot.password.page.submit.button']),
88
88
  pending: '',
89
- }, onClick: handleSubmit, onMouseDown: (e) => e.preventDefault() }), (appConfig.LOGIN_ISSUE_SUPPORT_LINK) && (_jsx(Hyperlink, { id: "forgot-password", name: "forgot-password", className: "ml-4 font-weight-500 text-body", destination: appConfig.LOGIN_ISSUE_SUPPORT_LINK, target: "_blank", showLaunchIcon: false, children: formatMessage(messages['need.help.sign.in.text']) })), _jsxs("p", { className: "mt-5.5 small text-gray-700", children: [formatMessage(messages['additional.help.text'], { platformName }), _jsx("span", { className: "mx-1", children: _jsx(Hyperlink, { isInline: true, destination: `mailto:${appConfig.INFO_EMAIL}`, children: appConfig.INFO_EMAIL }) })] })] }) })] })] }));
89
+ }, onClick: handleSubmit, onMouseDown: (e) => e.preventDefault() }), (appConfig.LOGIN_ISSUE_SUPPORT_LINK) && (_jsx(Hyperlink, { id: "forgot-password", name: "forgot-password", className: "ml-4 font-weight-500 text-body", destination: appConfig.LOGIN_ISSUE_SUPPORT_LINK, target: "_blank", showLaunchIcon: false, children: formatMessage(messages['need.help.sign.in.text']) })), (appConfig.INFO_EMAIL) && (_jsxs("p", { className: "mt-5.5 small text-gray-700", children: [formatMessage(messages['additional.help.text'], { platformName }), _jsx("span", { className: "mx-1", children: _jsx(Hyperlink, { isInline: true, destination: `mailto:${appConfig.INFO_EMAIL}`, children: appConfig.INFO_EMAIL }) })] }))] }) })] })] }));
90
90
  };
91
91
  export default ForgotPasswordPage;
92
92
  //# sourceMappingURL=ForgotPasswordPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ForgotPasswordPage.js","sourceRoot":"","sources":["../../src/forgot-password/ForgotPasswordPage.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EACL,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,GACvF,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,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RouteRole, sendPageEvent, sendTrackEvent, useAppConfig, useIntl,\n} from '@openedx/frontend-base';\nimport {\n Form,\n Hyperlink,\n Icon,\n StatefulButton,\n Tab,\n Tabs,\n} from '@openedx/paragon';\nimport { ChevronLeft } from '@openedx/paragon/icons';\nimport { Helmet } from 'react-helmet';\nimport { useLocation, useNavigate } from 'react-router-dom';\n\nimport { useForgotPassword } from './data/apiHook';\nimport ForgotPasswordAlert from './ForgotPasswordAlert';\nimport messages from './messages';\nimport BaseContainer from '../base-container';\nimport { FormGroup } from '../common-components';\nimport { loginPath, loginRole } from '../constants';\nimport { VALID_EMAIL_REGEX } from '../data/constants';\nimport { updatePathWithQueryParams, windowScrollTo } from '../data/utils';\n\nconst ForgotPasswordPage = () => {\n const platformName = getSiteConfig().siteName;\n const emailRegex = new RegExp(VALID_EMAIL_REGEX, 'i');\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const location = useLocation();\n const appConfig = useAppConfig();\n const [email, setEmail] = useState('');\n const [bannerEmail, setBannerEmail] = useState('');\n const [formErrors, setFormErrors] = useState('');\n const [validationError, setValidationError] = useState('');\n const [status, setStatus] = useState(location.state?.status || null);\n\n // React Query hook for forgot password\n const { mutate: sendForgotPassword, isPending: isSending } = useForgotPassword();\n\n const submitState = isSending ? 'pending' : 'default';\n\n useEffect(() => {\n sendPageEvent('login_and_registration', 'reset');\n sendTrackEvent('edx.bi.password_reset_form.viewed', { category: 'user-engagement' });\n }, []);\n\n useEffect(() => {\n if (status === 'complete') {\n setEmail('');\n }\n }, [status]);\n\n const getValidationMessage = (value) => {\n let error = '';\n\n if (value === '') {\n error = formatMessage(messages['forgot.password.empty.email.field.error']);\n } else if (!emailRegex.test(value)) {\n error = formatMessage(messages['forgot.password.page.invalid.email.message']);\n }\n\n return error;\n };\n\n const handleBlur = () => {\n setValidationError(getValidationMessage(email));\n };\n\n const handleFocus = () => {\n setValidationError('');\n };\n\n const handleSubmit = (e) => {\n e.preventDefault();\n setBannerEmail(email);\n\n const validateError = getValidationMessage(email);\n if (validateError) {\n setFormErrors(validateError);\n setValidationError(validateError);\n windowScrollTo({ left: 0, top: 0, behavior: 'smooth' });\n } else {\n setFormErrors('');\n sendForgotPassword(email, {\n onSuccess: (data, emailUsed) => {\n setStatus('complete');\n setBannerEmail(emailUsed);\n setFormErrors('');\n },\n onError: (error) => {\n if (error.response && error.response.status === 403) {\n setStatus('forbidden');\n } else {\n setStatus('server-error');\n }\n },\n });\n }\n };\n\n const tabTitle = (\n <div className=\"d-inline-flex flex-wrap align-items-center\">\n <Icon src={ChevronLeft} />\n <span className=\"ml-2\">{formatMessage(messages['sign.in.text'])}</span>\n </div>\n );\n\n return (\n <BaseContainer>\n <Helmet>\n <title>{formatMessage(messages['forgot.password.page.title'],\n { siteName: getSiteConfig().siteName })}\n </title>\n </Helmet>\n <div>\n <Tabs activeKey=\"\" id=\"controlled-tab\" onSelect={() => navigate(updatePathWithQueryParams(getUrlByRouteRole(loginRole)))}>\n <Tab title={tabTitle} eventKey={loginPath} />\n </Tabs>\n <div id=\"main-content\" className=\"main-content\">\n <Form id=\"forget-password-form\" name=\"forget-password-form\" className=\"mw-xs\">\n <ForgotPasswordAlert email={bannerEmail} emailError={formErrors} status={status} />\n <h2 className=\"h4\">\n {formatMessage(messages['forgot.password.page.heading'])}\n </h2>\n <p className=\"mb-4\">\n {formatMessage(messages['forgot.password.page.instructions'])}\n </p>\n <FormGroup\n floatingLabel={formatMessage(messages['forgot.password.page.email.field.label'])}\n name=\"email\"\n value={email}\n autoComplete=\"on\"\n errorMessage={validationError}\n handleChange={(e) => setEmail(e.target.value)}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n helpText={[formatMessage(messages['forgot.password.email.help.text'], { platformName })]}\n />\n <StatefulButton\n id=\"submit-forget-password\"\n name=\"submit-forget-password\"\n type=\"submit\"\n variant=\"brand\"\n className=\"forgot-password--button\"\n state={submitState}\n labels={{\n default: formatMessage(messages['forgot.password.page.submit.button']),\n pending: '',\n }}\n onClick={handleSubmit}\n onMouseDown={(e) => e.preventDefault()}\n />\n {(appConfig.LOGIN_ISSUE_SUPPORT_LINK) && (\n <Hyperlink\n id=\"forgot-password\"\n name=\"forgot-password\"\n className=\"ml-4 font-weight-500 text-body\"\n destination={appConfig.LOGIN_ISSUE_SUPPORT_LINK}\n target=\"_blank\"\n showLaunchIcon={false}\n >\n {formatMessage(messages['need.help.sign.in.text'])}\n </Hyperlink>\n )}\n <p className=\"mt-5.5 small text-gray-700\">\n {formatMessage(messages['additional.help.text'], { platformName })}\n <span className=\"mx-1\">\n <Hyperlink isInline destination={`mailto:${appConfig.INFO_EMAIL}`}>{appConfig.INFO_EMAIL}</Hyperlink>\n </span>\n </p>\n </Form>\n </div>\n </div>\n </BaseContainer>\n );\n};\n\nexport default ForgotPasswordPage;\n"]}
1
+ {"version":3,"file":"ForgotPasswordPage.js","sourceRoot":"","sources":["../../src/forgot-password/ForgotPasswordPage.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EACL,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,GACvF,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,cAAc,EACd,GAAG,EACH,IAAI,GACL,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,E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,EACD,OAAO,EAAE,YAAY,EACrB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,GACtC,EACD,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CACvC,KAAC,SAAS,IACR,EAAE,EAAC,iBAAiB,EACpB,IAAI,EAAC,iBAAiB,EACtB,SAAS,EAAC,gCAAgC,EAC1C,WAAW,EAAE,SAAS,CAAC,wBAAwB,EAC/C,MAAM,EAAC,QAAQ,EACf,cAAc,EAAE,KAAK,YAEpB,aAAa,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC,GACxC,CACb,EACA,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CACzB,aAAG,SAAS,EAAC,4BAA4B,aACtC,aAAa,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,EAAE,YAAY,EAAE,CAAC,EAClE,eAAM,SAAS,EAAC,MAAM,YACpB,KAAC,SAAS,IAAC,QAAQ,QAAC,WAAW,EAAE,UAAU,SAAS,CAAC,UAAU,EAAE,YAAG,SAAS,CAAC,UAAU,GAAa,GAChG,IACL,CACL,IACI,GACH,IACF,IACQ,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport {\n getSiteConfig, getUrlByRouteRole, sendPageEvent, sendTrackEvent, useAppConfig, useIntl,\n} from '@openedx/frontend-base';\nimport {\n Form,\n Hyperlink,\n Icon,\n StatefulButton,\n Tab,\n Tabs,\n} from '@openedx/paragon';\nimport { ChevronLeft } from '@openedx/paragon/icons';\nimport { Helmet } from 'react-helmet';\nimport { useLocation, useNavigate } from 'react-router-dom';\n\nimport { useForgotPassword } from './data/apiHook';\nimport ForgotPasswordAlert from './ForgotPasswordAlert';\nimport messages from './messages';\nimport BaseContainer from '../base-container';\nimport { FormGroup } from '../common-components';\nimport { loginPath, loginRole } from '../constants';\nimport { VALID_EMAIL_REGEX } from '../data/constants';\nimport { updatePathWithQueryParams, windowScrollTo } from '../data/utils';\n\nconst ForgotPasswordPage = () => {\n const platformName = getSiteConfig().siteName;\n const emailRegex = new RegExp(VALID_EMAIL_REGEX, 'i');\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const location = useLocation();\n const appConfig = useAppConfig();\n const [email, setEmail] = useState('');\n const [bannerEmail, setBannerEmail] = useState('');\n const [formErrors, setFormErrors] = useState('');\n const [validationError, setValidationError] = useState('');\n const [status, setStatus] = useState(location.state?.status || null);\n\n // React Query hook for forgot password\n const { mutate: sendForgotPassword, isPending: isSending } = useForgotPassword();\n\n const submitState = isSending ? 'pending' : 'default';\n\n useEffect(() => {\n sendPageEvent('login_and_registration', 'reset');\n sendTrackEvent('edx.bi.password_reset_form.viewed', { category: 'user-engagement' });\n }, []);\n\n useEffect(() => {\n if (status === 'complete') {\n setEmail('');\n }\n }, [status]);\n\n const getValidationMessage = (value) => {\n let error = '';\n\n if (value === '') {\n error = formatMessage(messages['forgot.password.empty.email.field.error']);\n } else if (!emailRegex.test(value)) {\n error = formatMessage(messages['forgot.password.page.invalid.email.message']);\n }\n\n return error;\n };\n\n const handleBlur = () => {\n setValidationError(getValidationMessage(email));\n };\n\n const handleFocus = () => {\n setValidationError('');\n };\n\n const handleSubmit = (e) => {\n e.preventDefault();\n setBannerEmail(email);\n\n const validateError = getValidationMessage(email);\n if (validateError) {\n setFormErrors(validateError);\n setValidationError(validateError);\n windowScrollTo({ left: 0, top: 0, behavior: 'smooth' });\n } else {\n setFormErrors('');\n sendForgotPassword(email, {\n onSuccess: (data, emailUsed) => {\n setStatus('complete');\n setBannerEmail(emailUsed);\n setFormErrors('');\n },\n onError: (error) => {\n if (error.response && error.response.status === 403) {\n setStatus('forbidden');\n } else {\n setStatus('server-error');\n }\n },\n });\n }\n };\n\n const tabTitle = (\n <div className=\"d-inline-flex flex-wrap align-items-center\">\n <Icon src={ChevronLeft} />\n <span className=\"ml-2\">{formatMessage(messages['sign.in.text'])}</span>\n </div>\n );\n\n return (\n <BaseContainer>\n <Helmet>\n <title>{formatMessage(messages['forgot.password.page.title'],\n { siteName: getSiteConfig().siteName })}\n </title>\n </Helmet>\n <div>\n <Tabs activeKey=\"\" id=\"controlled-tab\" onSelect={() => navigate(updatePathWithQueryParams(getUrlByRouteRole(loginRole)))}>\n <Tab title={tabTitle} eventKey={loginPath} />\n </Tabs>\n <div id=\"main-content\" className=\"main-content\">\n <Form id=\"forget-password-form\" name=\"forget-password-form\" className=\"mw-xs\">\n <ForgotPasswordAlert email={bannerEmail} emailError={formErrors} status={status} />\n <h2 className=\"h4\">\n {formatMessage(messages['forgot.password.page.heading'])}\n </h2>\n <p className=\"mb-4\">\n {formatMessage(messages['forgot.password.page.instructions'])}\n </p>\n <FormGroup\n floatingLabel={formatMessage(messages['forgot.password.page.email.field.label'])}\n name=\"email\"\n value={email}\n autoComplete=\"on\"\n errorMessage={validationError}\n handleChange={(e) => setEmail(e.target.value)}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n helpText={[formatMessage(messages['forgot.password.email.help.text'], { platformName })]}\n />\n <StatefulButton\n id=\"submit-forget-password\"\n name=\"submit-forget-password\"\n type=\"submit\"\n variant=\"brand\"\n className=\"forgot-password--button\"\n state={submitState}\n labels={{\n default: formatMessage(messages['forgot.password.page.submit.button']),\n pending: '',\n }}\n onClick={handleSubmit}\n onMouseDown={(e) => e.preventDefault()}\n />\n {(appConfig.LOGIN_ISSUE_SUPPORT_LINK) && (\n <Hyperlink\n id=\"forgot-password\"\n name=\"forgot-password\"\n className=\"ml-4 font-weight-500 text-body\"\n destination={appConfig.LOGIN_ISSUE_SUPPORT_LINK}\n target=\"_blank\"\n showLaunchIcon={false}\n >\n {formatMessage(messages['need.help.sign.in.text'])}\n </Hyperlink>\n )}\n {(appConfig.INFO_EMAIL) && (\n <p className=\"mt-5.5 small text-gray-700\">\n {formatMessage(messages['additional.help.text'], { platformName })}\n <span className=\"mx-1\">\n <Hyperlink isInline destination={`mailto:${appConfig.INFO_EMAIL}`}>{appConfig.INFO_EMAIL}</Hyperlink>\n </span>\n </p>\n )}\n </Form>\n </div>\n </div>\n </BaseContainer>\n );\n};\n\nexport default ForgotPasswordPage;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"apiHook.js","sourceRoot":"","sources":["../../../src/forgot-password/data/apiHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAmBvC,MAAM,iBAAiB,GAAG,CAAC,UAAoC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC;IAChF,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,CAC7B,cAAc,CAAC,KAAK,CAAC,CACtB;IACD,SAAS,EAAE,CAAC,IAA0B,EAAE,KAAa,EAAE,EAAE;QACvD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC,KAAe,EAAE,EAAE;;QAC3B,iDAAiD;QACjD,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;YACnC,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,OAAO,EACL,iBAAiB,GAClB,CAAC","sourcesContent":["import { logError, logInfo } from '@openedx/frontend-base';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { forgotPassword } from './api';\n\ninterface ForgotPasswordResult {\n success: boolean,\n message?: string,\n}\n\ninterface UseForgotPasswordOptions {\n onSuccess?: (data: ForgotPasswordResult, email: string) => void,\n onError?: (error: Error) => void,\n}\n\ninterface ApiError extends Error {\n response?: {\n status: number,\n data: Record<string, unknown>,\n },\n}\n\nconst useForgotPassword = (options: UseForgotPasswordOptions = {}) => useMutation({\n mutationFn: (email: string) => (\n forgotPassword(email)\n ),\n onSuccess: (data: ForgotPasswordResult, email: string) => {\n if (options.onSuccess) {\n options.onSuccess(data, email);\n }\n },\n onError: (error: ApiError) => {\n // Handle different error types like the saga did\n if (error.response?.status === 403) {\n logInfo(error);\n } else {\n logError(error);\n }\n if (options.onError) {\n options.onError(error);\n }\n },\n});\n\nexport {\n useForgotPassword,\n};\n"]}
1
+ {"version":3,"file":"apiHook.js","sourceRoot":"","sources":["../../../src/forgot-password/data/apiHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAmBvC,MAAM,iBAAiB,GAAG,CAAC,UAAoC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC;IAChF,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,CAC7B,cAAc,CAAC,KAAK,CAAC,CACtB;IACD,SAAS,EAAE,CAAC,IAA0B,EAAE,KAAa,EAAE,EAAE;QACvD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC,KAAe,EAAE,EAAE;;QAC3B,iDAAiD;QACjD,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;YACnC,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,OAAO,EACL,iBAAiB,GAClB,CAAC","sourcesContent":["import { logError, logInfo } from '@openedx/frontend-base';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { forgotPassword } from './api';\n\ninterface ForgotPasswordResult {\n success: boolean;\n message?: string;\n}\n\ninterface UseForgotPasswordOptions {\n onSuccess?: (data: ForgotPasswordResult, email: string) => void;\n onError?: (error: Error) => void;\n}\n\ninterface ApiError extends Error {\n response?: {\n status: number;\n data: Record<string, unknown>;\n };\n}\n\nconst useForgotPassword = (options: UseForgotPasswordOptions = {}) => useMutation({\n mutationFn: (email: string) => (\n forgotPassword(email)\n ),\n onSuccess: (data: ForgotPasswordResult, email: string) => {\n if (options.onSuccess) {\n options.onSuccess(data, email);\n }\n },\n onError: (error: ApiError) => {\n // Handle different error types like the saga did\n if (error.response?.status === 403) {\n logInfo(error);\n } else {\n logError(error);\n }\n if (options.onError) {\n options.onError(error);\n }\n },\n});\n\nexport {\n useForgotPassword,\n};\n"]}
@@ -29,7 +29,11 @@ const AccountActivationMessage = ({ messageType }) => {
29
29
  break;
30
30
  }
31
31
  case ACCOUNT_ACTIVATION_MESSAGE.ERROR: {
32
- const supportLink = (_jsx(Alert.Link, { href: useAppConfig().ACTIVATION_EMAIL_SUPPORT_LINK, children: formatMessage(messages['account.activation.support.link']) }));
32
+ // Without a support link configured there is nowhere to point; the sentence
33
+ // still reads correctly with the phrase as plain text.
34
+ const activationEmailSupportLink = useAppConfig().ACTIVATION_EMAIL_SUPPORT_LINK;
35
+ const supportLinkText = formatMessage(messages['account.activation.support.link']);
36
+ const supportLink = activationEmailSupportLink ? (_jsx(Alert.Link, { href: activationEmailSupportLink, children: supportLinkText })) : supportLinkText;
33
37
  heading = formatMessage(messages[`account.${activationOrConfirmation}.error.message.title`]);
34
38
  activationMessage = (_jsx(FormattedMessage, { id: "account.activation.error.message", defaultMessage: "Something went wrong, please {supportLink} to resolve this issue.", description: "Account activation error message", values: { supportLink } }));
35
39
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"AccountActivationMessage.js","sourceRoot":"","sources":["../../src/login/AccountActivationMessage.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,wBAAwB,GAAG,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE;IACnD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,WAAW,KAAK,0BAA0B,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC;IAC1F,MAAM,wBAAwB,GAAG,YAAY,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC;IACxG,MAAM,WAAW,GAAG;QAClB,CAAC,0BAA0B,CAAC,OAAO,CAAC,EAAE,WAAW;QACjD,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,KAAK;KAC1C,CAAC;IAEF,IAAI,iBAAiB,CAAC;IACtB,IAAI,OAAO,CAAC;IACZ,QAAQ,WA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AC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,wBAAwB,CAAC,SAAS,GAAG;IACnC,WAAW,EAAE,SAAS,CAAC,MAAM;CAC9B,CAAC;AAEF,wBAAwB,CAAC,YAAY,GAAG;IACtC,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF,eAAe,wBAAwB,CAAC","sourcesContent":["import { FormattedMessage, useAppConfig, useIntl } from '@openedx/frontend-base';\nimport { Alert } from '@openedx/paragon';\nimport { CheckCircle, Error } from '@openedx/paragon/icons';\nimport PropTypes from 'prop-types';\n\nimport { ACCOUNT_ACTIVATION_MESSAGE } from './data/constants';\nimport messages from './messages';\n\nconst AccountActivationMessage = ({ messageType }) => {\n const { formatMessage } = useIntl();\n\n if (!messageType) {\n return null;\n }\n\n const variant = messageType === ACCOUNT_ACTIVATION_MESSAGE.ERROR ? 'danger' : messageType;\n const activationOrConfirmation = useAppConfig().MARKETING_EMAILS_OPT_IN ? 'confirmation' : 'activation';\n const iconMapping = {\n [ACCOUNT_ACTIVATION_MESSAGE.SUCCESS]: CheckCircle,\n [ACCOUNT_ACTIVATION_MESSAGE.ERROR]: Error,\n };\n\n let activationMessage;\n let heading;\n switch (messageType) {\n case ACCOUNT_ACTIVATION_MESSAGE.SUCCESS: {\n heading = formatMessage(messages[`account.${activationOrConfirmation}.success.message.title`]);\n activationMessage = <span>{formatMessage(messages[`account.${activationOrConfirmation}.success.message`])}</span>;\n break;\n }\n case ACCOUNT_ACTIVATION_MESSAGE.INFO: {\n activationMessage = formatMessage(messages[`account.${activationOrConfirmation}.info.message`]);\n break;\n }\n case ACCOUNT_ACTIVATION_MESSAGE.ERROR: {\n const supportLink = (\n <Alert.Link href={useAppConfig().ACTIVATION_EMAIL_SUPPORT_LINK}>\n {formatMessage(messages['account.activation.support.link'])}\n </Alert.Link>\n );\n\n heading = formatMessage(messages[`account.${activationOrConfirmation}.error.message.title`]);\n activationMessage = (\n <FormattedMessage\n id=\"account.activation.error.message\"\n defaultMessage=\"Something went wrong, please {supportLink} to resolve this issue.\"\n description=\"Account activation error message\"\n values={{ supportLink }}\n />\n );\n break;\n }\n default:\n break;\n }\n\n return activationMessage ? (\n <Alert\n id=\"account-activation-message\"\n className=\"mb-5\"\n variant={variant}\n icon={iconMapping[messageType]}\n >\n {heading && <Alert.Heading>{heading}</Alert.Heading>}\n {activationMessage}\n </Alert>\n ) : null;\n};\n\nAccountActivationMessage.propTypes = {\n messageType: PropTypes.string,\n};\n\nAccountActivationMessage.defaultProps = {\n messageType: null,\n};\n\nexport default AccountActivationMessage;\n"]}
1
+ {"version":3,"file":"AccountActivationMessage.js","sourceRoot":"","sources":["../../src/login/AccountActivationMessage.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,wBAAwB,GAAG,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE;IACnD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,WAAW,KAAK,0BAA0B,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC;IAC1F,MAAM,wBAAwB,GAAG,YAAY,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC;IACxG,MAAM,WAAW,GAAG;QAClB,CAAC,0BAA0B,CAAC,OAAO,CAAC,EAAE,WAA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AM;IACV,CAAC;IAED,OAAO,iBAAiB,CAAC,CAAC,CAAC,CACzB,MAAC,KAAK,IACJ,EAAE,EAAC,4BAA4B,EAC/B,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,CAAC,WAAW,CAAC,aAE7B,OAAO,IAAI,KAAC,KAAK,CAAC,OAAO,cAAE,OAAO,GAAiB,EACnD,iBAAiB,IACZ,CACT,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,wBAAwB,CAAC,SAAS,GAAG;IACnC,WAAW,EAAE,SAAS,CAAC,MAAM;CAC9B,CAAC;AAEF,wBAAwB,CAAC,YAAY,GAAG;IACtC,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF,eAAe,wBAAwB,CAAC","sourcesContent":["import { FormattedMessage, useAppConfig, useIntl } from '@openedx/frontend-base';\nimport { Alert } from '@openedx/paragon';\nimport { CheckCircle, Error } from '@openedx/paragon/icons';\nimport PropTypes from 'prop-types';\n\nimport { ACCOUNT_ACTIVATION_MESSAGE } from './data/constants';\nimport messages from './messages';\n\nconst AccountActivationMessage = ({ messageType }) => {\n const { formatMessage } = useIntl();\n\n if (!messageType) {\n return null;\n }\n\n const variant = messageType === ACCOUNT_ACTIVATION_MESSAGE.ERROR ? 'danger' : messageType;\n const activationOrConfirmation = useAppConfig().MARKETING_EMAILS_OPT_IN ? 'confirmation' : 'activation';\n const iconMapping = {\n [ACCOUNT_ACTIVATION_MESSAGE.SUCCESS]: CheckCircle,\n [ACCOUNT_ACTIVATION_MESSAGE.ERROR]: Error,\n };\n\n let activationMessage;\n let heading;\n switch (messageType) {\n case ACCOUNT_ACTIVATION_MESSAGE.SUCCESS: {\n heading = formatMessage(messages[`account.${activationOrConfirmation}.success.message.title`]);\n activationMessage = <span>{formatMessage(messages[`account.${activationOrConfirmation}.success.message`])}</span>;\n break;\n }\n case ACCOUNT_ACTIVATION_MESSAGE.INFO: {\n activationMessage = formatMessage(messages[`account.${activationOrConfirmation}.info.message`]);\n break;\n }\n case ACCOUNT_ACTIVATION_MESSAGE.ERROR: {\n // Without a support link configured there is nowhere to point; the sentence\n // still reads correctly with the phrase as plain text.\n const activationEmailSupportLink = useAppConfig().ACTIVATION_EMAIL_SUPPORT_LINK;\n const supportLinkText = formatMessage(messages['account.activation.support.link']);\n const supportLink = activationEmailSupportLink ? (\n <Alert.Link href={activationEmailSupportLink}>\n {supportLinkText}\n </Alert.Link>\n ) : supportLinkText;\n\n heading = formatMessage(messages[`account.${activationOrConfirmation}.error.message.title`]);\n activationMessage = (\n <FormattedMessage\n id=\"account.activation.error.message\"\n defaultMessage=\"Something went wrong, please {supportLink} to resolve this issue.\"\n description=\"Account activation error message\"\n values={{ supportLink }}\n />\n );\n break;\n }\n default:\n break;\n }\n\n return activationMessage ? (\n <Alert\n id=\"account-activation-message\"\n className=\"mb-5\"\n variant={variant}\n icon={iconMapping[messageType]}\n >\n {heading && <Alert.Heading>{heading}</Alert.Heading>}\n {activationMessage}\n </Alert>\n ) : null;\n};\n\nAccountActivationMessage.propTypes = {\n messageType: PropTypes.string,\n};\n\nAccountActivationMessage.defaultProps = {\n messageType: null,\n};\n\nexport default AccountActivationMessage;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LoginContext.js","sourceRoot":"","sources":["../../../src/login/components/LoginContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAA2C,UAAU,EAAE,OAAO,EAAE,QAAQ,GACtF,MAAM,OAAO,CAAC;AAmBf,MAAM,YAAY,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAC;AAM5E,MAAM,CAAC,MAAM,aAAa,GAA2B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACpE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC;QAC3C,eAAe,EAAE,EAAE;QACnB,QAAQ,EAAE,EAAE;KACb,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC;QACnC,eAAe,EAAE,EAAE;QACnB,QAAQ,EAAE,EAAE;KACb,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAClC,UAAU;QACV,aAAa;QACb,MAAM;QACN,SAAS;KACV,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IAE1B,OAAO,CACL,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YACvC,QAAQ,GACa,CACzB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n createContext, Dispatch, FC, ReactNode, SetStateAction, useContext, useMemo, useState,\n} from 'react';\n\nexport interface FormFields {\n emailOrUsername: string,\n password: string,\n}\n\nexport interface FormErrors {\n emailOrUsername: string,\n password: string,\n}\n\ninterface LoginContextType {\n formFields: FormFields,\n setFormFields: Dispatch<SetStateAction<FormFields>>,\n errors: FormErrors,\n setErrors: Dispatch<SetStateAction<FormErrors>>,\n}\n\nconst LoginContext = createContext<LoginContextType | undefined>(undefined);\n\ninterface LoginProviderProps {\n children: ReactNode,\n}\n\nexport const LoginProvider: FC<LoginProviderProps> = ({ children }) => {\n const [formFields, setFormFields] = useState({\n emailOrUsername: '',\n password: '',\n });\n const [errors, setErrors] = useState({\n emailOrUsername: '',\n password: '',\n });\n\n const contextValue = useMemo(() => ({\n formFields,\n setFormFields,\n errors,\n setErrors,\n }), [formFields, errors]);\n\n return (\n <LoginContext.Provider value={contextValue}>\n {children}\n </LoginContext.Provider>\n );\n};\n\nexport const useLoginContext = () => {\n const context = useContext(LoginContext);\n if (context === undefined) {\n throw new Error('useLoginContext must be used within a LoginProvider');\n }\n return context;\n};\n"]}
1
+ {"version":3,"file":"LoginContext.js","sourceRoot":"","sources":["../../../src/login/components/LoginContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAA2C,UAAU,EAAE,OAAO,EAAE,QAAQ,GACtF,MAAM,OAAO,CAAC;AAmBf,MAAM,YAAY,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAC;AAM5E,MAAM,CAAC,MAAM,aAAa,GAA2B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACpE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC;QAC3C,eAAe,EAAE,EAAE;QACnB,QAAQ,EAAE,EAAE;KACb,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC;QACnC,eAAe,EAAE,EAAE;QACnB,QAAQ,EAAE,EAAE;KACb,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAClC,UAAU;QACV,aAAa;QACb,MAAM;QACN,SAAS;KACV,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IAE1B,OAAO,CACL,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YACvC,QAAQ,GACa,CACzB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n createContext, Dispatch, FC, ReactNode, SetStateAction, useContext, useMemo, useState,\n} from 'react';\n\nexport interface FormFields {\n emailOrUsername: string;\n password: string;\n}\n\nexport interface FormErrors {\n emailOrUsername: string;\n password: string;\n}\n\ninterface LoginContextType {\n formFields: FormFields;\n setFormFields: Dispatch<SetStateAction<FormFields>>;\n errors: FormErrors;\n setErrors: Dispatch<SetStateAction<FormErrors>>;\n}\n\nconst LoginContext = createContext<LoginContextType | undefined>(undefined);\n\ninterface LoginProviderProps {\n children: ReactNode;\n}\n\nexport const LoginProvider: FC<LoginProviderProps> = ({ children }) => {\n const [formFields, setFormFields] = useState({\n emailOrUsername: '',\n password: '',\n });\n const [errors, setErrors] = useState({\n emailOrUsername: '',\n password: '',\n });\n\n const contextValue = useMemo(() => ({\n formFields,\n setFormFields,\n errors,\n setErrors,\n }), [formFields, errors]);\n\n return (\n <LoginContext.Provider value={contextValue}>\n {children}\n </LoginContext.Provider>\n );\n};\n\nexport const useLoginContext = () => {\n const context = useContext(LoginContext);\n if (context === undefined) {\n throw new Error('useLoginContext must be used within a LoginProvider');\n }\n return context;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"apiHook.js","sourceRoot":"","sources":["../../../src/login/data/apiHook.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAiBvE,MAAM,QAAQ,GAAG,CAAC,UAA2B,EAAE,EAAE,EAAE,CAAC,WAAW,CAAoC;IACjG,UAAU,EAAE,CAAO,SAAoB,EAAE,EAAE,kDAAC,OAAA,KAAK,CAAC,SAAS,CAA2B,CAAA,GAAA;IACtF,SAAS,EAAE,CAAC,IAAmB,EAAE,EAAE;QACjC,OAAO,CAAC,kB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C,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AACH,OAAO,EACL,QAAQ,GACT,CAAC","sourcesContent":["import { camelCaseObject, logError, logInfo } from '@openedx/frontend-base';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { login } from './api';\nimport { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR } from './constants';\n\n// Type definitions\ninterface LoginData {\n email_or_username: string,\n password: string,\n}\n\ninterface LoginResponse {\n redirectUrl?: string,\n}\n\ninterface UseLoginOptions {\n onSuccess?: (data: LoginResponse) => void,\n onError?: (error: unknown) => void,\n}\n\nconst useLogin = (options: UseLoginOptions = {}) => useMutation<LoginResponse, unknown, LoginData>({\n mutationFn: async (loginData: LoginData) => login(loginData) as Promise<LoginResponse>,\n onSuccess: (data: LoginResponse) => {\n logInfo('Login successful', data);\n if (options.onSuccess) {\n options.onSuccess(data);\n }\n },\n onError: (error: unknown) => {\n logError('Login failed', error);\n let formattedError = {\n type: INTERNAL_SERVER_ERROR,\n context: {},\n count: 0,\n };\n if (error && typeof error === 'object' && 'response' in error && error.response) {\n const response = error.response as { status?: number, data?: unknown };\n const { status, data } = camelCaseObject(response);\n if (data && typeof data === 'object') {\n const errorData = data as { errorCode?: string, context?: { failureCount?: number } };\n formattedError = {\n type: errorData.errorCode || FORBIDDEN_REQUEST,\n context: errorData.context || {},\n count: errorData.context?.failureCount || 0,\n };\n if (status === 400) {\n logInfo('Login failed with validation error', error);\n } else if (status === 403) {\n logInfo('Login failed with forbidden error', error);\n } else {\n logError('Login failed with server error', error);\n }\n }\n }\n if (options.onError) {\n options.onError(formattedError);\n }\n },\n});\nexport {\n useLogin,\n};\n"]}
1
+ {"version":3,"file":"apiHook.js","sourceRoot":"","sources":["../../../src/login/data/apiHook.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,E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E;oBAChC,KAAK,EAAE,CAAA,MAAA,SAAS,CAAC,OAAO,0CAAE,YAAY,KAAI,CAAC;iBAC5C,CAAC;gBACF,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;oBACnB,OAAO,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;gBACvD,CAAC;qBAAM,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;oBAC1B,OAAO,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;gBACtD,CAAC;qBAAM,CAAC;oBACN,QAAQ,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;gBACpD,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AACH,OAAO,EACL,QAAQ,GACT,CAAC","sourcesContent":["import { camelCaseObject, logError, logInfo } from '@openedx/frontend-base';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { login } from './api';\nimport { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR } from './constants';\n\n// Type definitions\ninterface LoginData {\n email_or_username: string;\n password: string;\n}\n\ninterface LoginResponse {\n redirectUrl?: string;\n}\n\ninterface UseLoginOptions {\n onSuccess?: (data: LoginResponse) => void;\n onError?: (error: unknown) => void;\n}\n\nconst useLogin = (options: UseLoginOptions = {}) => useMutation<LoginResponse, unknown, LoginData>({\n mutationFn: async (loginData: LoginData) => login(loginData) as Promise<LoginResponse>,\n onSuccess: (data: LoginResponse) => {\n logInfo('Login successful', data);\n if (options.onSuccess) {\n options.onSuccess(data);\n }\n },\n onError: (error: unknown) => {\n logError('Login failed', error);\n let formattedError = {\n type: INTERNAL_SERVER_ERROR,\n context: {},\n count: 0,\n };\n if (error && typeof error === 'object' && 'response' in error && error.response) {\n const response = error.response as { status?: number; data?: unknown };\n const { status, data } = camelCaseObject(response);\n if (data && typeof data === 'object') {\n const errorData = data as { errorCode?: string; context?: { failureCount?: number } };\n formattedError = {\n type: errorData.errorCode || FORBIDDEN_REQUEST,\n context: errorData.context || {},\n count: errorData.context?.failureCount || 0,\n };\n if (status === 400) {\n logInfo('Login failed with validation error', error);\n } else if (status === 403) {\n logInfo('Login failed with forbidden error', error);\n } else {\n logError('Login failed with server error', error);\n }\n }\n }\n if (options.onError) {\n options.onError(formattedError);\n }\n },\n});\nexport {\n useLogin,\n};\n"]}
@@ -68,7 +68,7 @@ const ProgressiveProfilingInner = () => {
68
68
  fields: welcomePageContext.fields,
69
69
  extendedProfile: welcomePageContext.extended_profile,
70
70
  });
71
- const nextUrl = welcomePageContext.nextUrl ? welcomePageContext.nextUrl : appConfig.SEARCH_CATALOG_URL;
71
+ const nextUrl = welcomePageContext.nextUrl || appConfig.SEARCH_CATALOG_URL || '';
72
72
  setRegistrationResult({ redirectUrl: nextUrl });
73
73
  }
74
74
  }, [registrationEmbedded, welcomePageContext, appConfig.SEARCH_CATALOG_URL]);
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressiveProfiling.js","sourceRoot":"","sources":["../../src/progressive-profiling/ProgressiveProfiling.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,OAAO,GACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,EACL,IAAI,EACJ,SAAS,EACT,OAAO,EACP,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBA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,aAAa,CAAC,QAAQ,CAAC,kCAAkC,CAAC,CAAC,GAClD,GACP,CACR,EACD,eAAK,SAAS,EAAC,kBAAkB,aAC/B,KAAC,cAAc,IACb,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,OAAO,EACf,SAAS,EAAC,uBAAuB,EACjC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE;gDACN,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,+BAA+B,CAAC,CAAC;gDACjE,OAAO,EAAE,EAAE;6CACZ,EACD,OAAO,EAAE,YAAY,EACrB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,GACtC,EACF,KAAC,cAAc,IACb,SAAS,EAAC,+BAA+B,EACzC,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,MAAM,EACd,MAAM,EAAE;gDACN,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;6CAChE,EACD,OAAO,EAAE,UAAU,EACnB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,GACtC,IACE,IACD,IACN,CACJ,GAEG,IACQ,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CACtC,KAAC,sBAAsB,cACrB,KAAC,4BAA4B,cAC3B,KAAC,yBAAyB,oBAAK,KAAK,EAAI,GACX,GACR,CAC1B,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport {\n AxiosJwtAuthService,\n configureAuth,\n getAuthenticatedUser,\n getLoggingService,\n getSiteConfig,\n getUrlByRouteRole,\n identifyAuthenticatedUser,\n sendPageEvent,\n sendTrackEvent,\n snakeCaseObject,\n useAppConfig,\n useIntl,\n} from '@openedx/frontend-base';\nimport {\n Alert,\n Form,\n Hyperlink,\n Spinner,\n StatefulButton,\n} from '@openedx/paragon';\nimport { Error } from '@openedx/paragon/icons';\nimport { Helmet } from 'react-helmet';\nimport { Navigate, useLocation } from 'react-router-dom';\n\nimport { ProgressiveProfilingProvider, useProgressiveProfilingContext } from './components/ProgressiveProfilingContext';\nimport messages from './messages';\nimport ProgressiveProfilingPageModal from './ProgressiveProfilingPageModal';\nimport BaseContainer from '../base-container';\nimport { RedirectLogistration } from '../common-components';\nimport { useSaveUserProfile } from './data/apiHook';\nimport { ThirdPartyAuthProvider, useThirdPartyAuthContext } from '../common-components/components/ThirdPartyAuthContext';\nimport { useThirdPartyAuthHook } from '../common-components/data/apiHook';\nimport { dashboardRole, welcomePath } from '../constants';\nimport {\n COMPLETE_STATE,\n FAILURE_STATE,\n PENDING_STATE,\n} from '../data/constants';\nimport isOneTrustFunctionalCookieEnabled from '../data/oneTrust';\nimport { getAllPossibleQueryParams, isHostAvailableInQueryParams } from '../data/utils';\nimport { FormFieldRenderer } from '../field-renderer';\n\nconst ProgressiveProfilingInner = () => {\n const { formatMessage } = useIntl();\n const appConfig = useAppConfig();\n\n const {\n thirdPartyAuthApiStatus,\n setThirdPartyAuthContextSuccess,\n setThirdPartyAuthContextFailure,\n optionalFields,\n } = useThirdPartyAuthContext();\n\n const welcomePageContext = optionalFields;\n const {\n submitState,\n showError,\n success,\n } = useProgressiveProfilingContext();\n\n // Hook for saving user profile\n const saveUserProfileMutation = useSaveUserProfile();\n\n const location = useLocation();\n const registrationEmbedded = isHostAvailableInQueryParams();\n\n const queryParams = getAllPossibleQueryParams();\n const authenticatedUser = getAuthenticatedUser() || location.state?.authenticatedUser;\n const functionalCookiesConsent = isOneTrustFunctionalCookieEnabled();\n\n const [registrationResult, setRegistrationResult] = useState({ redirectUrl: '' });\n const [formFieldData, setFormFieldData] = useState({ fields: {}, extendedProfile: [] });\n const [values, setValues] = useState({});\n const [showModal, setShowModal] = useState(false);\n\n const { data, isSuccess, error } = useThirdPartyAuthHook(welcomePath,\n { is_welcome_page: true, next: queryParams?.next }, { enabled: registrationEmbedded });\n\n useEffect(() => {\n if (registrationEmbedded) {\n if (isSuccess && data) {\n setThirdPartyAuthContextSuccess(\n data.fieldDescriptions,\n data.optionalFields,\n data.thirdPartyAuthContext,\n );\n }\n if (error) {\n setThirdPartyAuthContextFailure();\n }\n } else {\n configureAuth(AxiosJwtAuthService, { loggingService: getLoggingService(), config: getSiteConfig() });\n }\n }, [registrationEmbedded, queryParams?.next, isSuccess, data, error,\n setThirdPartyAuthContextSuccess, setThirdPartyAuthContextFailure]);\n\n useEffect(() => {\n const registrationResponse = location.state?.registrationResult;\n if (registrationResponse) {\n setRegistrationResult(registrationResponse);\n setFormFieldData({\n fields: location.state?.optionalFields.fields || {},\n extendedProfile: location.state?.optionalFields.extended_profile || [],\n });\n }\n }, [location.state?.registrationResult, location.state?.optionalFields]);\n\n useEffect(() => {\n if (registrationEmbedded && welcomePageContext && Object.keys(welcomePageContext).includes('fields')) {\n setFormFieldData({\n fields: welcomePageContext.fields,\n extendedProfile: welcomePageContext.extended_profile,\n });\n const nextUrl = welcomePageContext.nextUrl ? welcomePageContext.nextUrl : appConfig.SEARCH_CATALOG_URL;\n setRegistrationResult({ redirectUrl: nextUrl });\n }\n }, [registrationEmbedded, welcomePageContext, appConfig.SEARCH_CATALOG_URL]);\n\n useEffect(() => {\n if (authenticatedUser?.userId) {\n identifyAuthenticatedUser(authenticatedUser.userId);\n sendPageEvent('login_and_registration', 'welcome');\n }\n }, [authenticatedUser]);\n\n if (\n !authenticatedUser\n || !(location.state?.registrationResult || registrationEmbedded)\n || thirdPartyAuthApiStatus === FAILURE_STATE\n || (thirdPartyAuthApiStatus === COMPLETE_STATE && !Object.keys(welcomePageContext).includes('fields'))\n ) {\n const dashboardUrl = getUrlByRouteRole(dashboardRole) || '/';\n if (dashboardUrl.startsWith('/')) {\n return <Navigate to={dashboardUrl} replace />;\n }\n window.location.href = dashboardUrl;\n return null;\n }\n\n const handleSubmit = (e) => {\n e.preventDefault();\n window.history.replaceState(location.state, null, '');\n const payload = { ...values, extendedProfile: [] };\n if (Object.keys(formFieldData.extendedProfile).length > 0) {\n formFieldData.extendedProfile.forEach(fieldName => {\n if (values[fieldName]) {\n payload.extendedProfile.push({ fieldName, fieldValue: values[fieldName] });\n }\n delete payload[fieldName];\n });\n }\n saveUserProfileMutation.mutate({ username: authenticatedUser.username, data: snakeCaseObject(payload) });\n\n sendTrackEvent(\n 'edx.bi.welcome.page.submit.clicked',\n {\n isGenderSelected: !!values.gender,\n isYearOfBirthSelected: !!values.year_of_birth,\n isLevelOfEducationSelected: !!values.level_of_education,\n isWorkExperienceSelected: !!values.work_experience,\n host: queryParams?.host || '',\n },\n );\n };\n\n const handleSkip = (e) => {\n e.preventDefault();\n window.history.replaceState(location.state, null, '');\n setShowModal(true);\n sendTrackEvent(\n 'edx.bi.welcome.page.skip.link.clicked',\n {\n host: queryParams?.host || '',\n },\n );\n };\n\n const onChangeHandler = (e) => {\n if (e.target.type === 'checkbox') {\n setValues({ ...values, [e.target.name]: e.target.checked });\n } else {\n setValues({ ...values, [e.target.name]: e.target.value });\n }\n };\n\n const formFields = Object.keys(formFieldData.fields).map((fieldName) => {\n const fieldData = formFieldData.fields[fieldName];\n return (\n <span key={fieldData.name}>\n <FormFieldRenderer\n fieldData={fieldData}\n value={values[fieldData.name]}\n onChangeHandler={onChangeHandler}\n />\n </span>\n );\n });\n\n const shouldRedirect = success;\n return (\n <BaseContainer showWelcomeBanner fullName={authenticatedUser?.fullName || authenticatedUser?.name}>\n <Helmet>\n <title>{formatMessage(messages['progressive.profiling.page.title'],\n { siteName: getSiteConfig().siteName })}\n </title>\n </Helmet>\n <ProgressiveProfilingPageModal isOpen={showModal} redirectUrl={registrationResult.redirectUrl} />\n {shouldRedirect && (\n <RedirectLogistration\n success\n redirectUrl={registrationResult.redirectUrl}\n educationLevel={values?.level_of_education}\n userId={authenticatedUser?.userId}\n />\n )}\n <div className=\"mw-xs m-4 pp-page-content\">\n {registrationEmbedded && thirdPartyAuthApiStatus === PENDING_STATE ? (\n <Spinner animation=\"border\" variant=\"primary\" id=\"tpa-spinner\" />\n ) : (\n <>\n <div>\n <h2 className=\"pp-page__heading text-primary\">{formatMessage(messages['progressive.profiling.page.heading'])}</h2>\n </div><hr className=\"border-light-700 mb-4\" />\n {showError ? (\n <Alert id=\"pp-page-errors\" className=\"mb-3\" variant=\"danger\" icon={Error}>\n <Alert.Heading>{formatMessage(messages['welcome.page.error.heading'])}</Alert.Heading>\n <p>{formatMessage(messages['welcome.page.error.message'])}</p>\n </Alert>\n ) : null}\n <Form>\n {formFields}\n {(appConfig.AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK) && (\n <span className=\"pp-page__support-link\">\n <Hyperlink\n isInline\n variant=\"muted\"\n destination={appConfig.AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK}\n target=\"_blank\"\n showLaunchIcon={false}\n onClick={() => (sendTrackEvent('edx.bi.welcome.page.support.link.clicked'))}\n >\n {formatMessage(messages['optional.fields.information.link'])}\n </Hyperlink>\n </span>\n )}\n <div className=\"d-flex mt-4 mb-3\">\n <StatefulButton\n type=\"submit\"\n variant=\"brand\"\n className=\"pp-page__button-width\"\n state={submitState}\n labels={{\n default: formatMessage(messages['optional.fields.submit.button']),\n pending: '',\n }}\n onClick={handleSubmit}\n onMouseDown={(e) => e.preventDefault()}\n />\n <StatefulButton\n className=\"text-gray-700 font-weight-500\"\n type=\"submit\"\n variant=\"link\"\n labels={{\n default: formatMessage(messages['optional.fields.skip.button']),\n }}\n onClick={handleSkip}\n onMouseDown={(e) => e.preventDefault()}\n />\n </div>\n </Form>\n </>\n )}\n\n </div>\n </BaseContainer>\n );\n};\n\nconst ProgressiveProfiling = (props) => (\n <ThirdPartyAuthProvider>\n <ProgressiveProfilingProvider>\n <ProgressiveProfilingInner {...props} />\n </ProgressiveProfilingProvider>\n </ThirdPartyAuthProvider>\n);\n\nexport default ProgressiveProfiling;\n"]}
1
+ {"version":3,"file":"ProgressiveProfiling.js","sourceRoot":"","sources":["../../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IACQ,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CACtC,KAAC,sBAAsB,cACrB,KAAC,4BAA4B,cAC3B,KAAC,yBAAyB,oBAAK,KAAK,EAAI,GACX,GACR,CAC1B,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport {\n AxiosJwtAuthService,\n configureAuth,\n getAuthenticatedUser,\n getLoggingService,\n getSiteConfig,\n getUrlByRouteRole,\n identifyAuthenticatedUser,\n sendPageEvent,\n sendTrackEvent,\n snakeCaseObject,\n useAppConfig,\n useIntl,\n} from '@openedx/frontend-base';\nimport {\n Alert,\n Form,\n Hyperlink,\n Spinner,\n StatefulButton,\n} from '@openedx/paragon';\nimport { Error } from '@openedx/paragon/icons';\nimport { Helmet } from 'react-helmet';\nimport { Navigate, useLocation } from 'react-router-dom';\n\nimport { ProgressiveProfilingProvider, useProgressiveProfilingContext } from './components/ProgressiveProfilingContext';\nimport messages from './messages';\nimport ProgressiveProfilingPageModal from './ProgressiveProfilingPageModal';\nimport BaseContainer from '../base-container';\nimport { RedirectLogistration } from '../common-components';\nimport { useSaveUserProfile } from './data/apiHook';\nimport { ThirdPartyAuthProvider, useThirdPartyAuthContext } from '../common-components/components/ThirdPartyAuthContext';\nimport { useThirdPartyAuthHook } from '../common-components/data/apiHook';\nimport { dashboardRole, welcomePath } from '../constants';\nimport {\n COMPLETE_STATE,\n FAILURE_STATE,\n PENDING_STATE,\n} from '../data/constants';\nimport isOneTrustFunctionalCookieEnabled from '../data/oneTrust';\nimport { getAllPossibleQueryParams, isHostAvailableInQueryParams } from '../data/utils';\nimport { FormFieldRenderer } from '../field-renderer';\n\nconst ProgressiveProfilingInner = () => {\n const { formatMessage } = useIntl();\n const appConfig = useAppConfig();\n\n const {\n thirdPartyAuthApiStatus,\n setThirdPartyAuthContextSuccess,\n setThirdPartyAuthContextFailure,\n optionalFields,\n } = useThirdPartyAuthContext();\n\n const welcomePageContext = optionalFields;\n const {\n submitState,\n showError,\n success,\n } = useProgressiveProfilingContext();\n\n // Hook for saving user profile\n const saveUserProfileMutation = useSaveUserProfile();\n\n const location = useLocation();\n const registrationEmbedded = isHostAvailableInQueryParams();\n\n const queryParams = getAllPossibleQueryParams();\n const authenticatedUser = getAuthenticatedUser() || location.state?.authenticatedUser;\n const functionalCookiesConsent = isOneTrustFunctionalCookieEnabled();\n\n const [registrationResult, setRegistrationResult] = useState({ redirectUrl: '' });\n const [formFieldData, setFormFieldData] = useState({ fields: {}, extendedProfile: [] });\n const [values, setValues] = useState({});\n const [showModal, setShowModal] = useState(false);\n\n const { data, isSuccess, error } = useThirdPartyAuthHook(welcomePath,\n { is_welcome_page: true, next: queryParams?.next }, { enabled: registrationEmbedded });\n\n useEffect(() => {\n if (registrationEmbedded) {\n if (isSuccess && data) {\n setThirdPartyAuthContextSuccess(\n data.fieldDescriptions,\n data.optionalFields,\n data.thirdPartyAuthContext,\n );\n }\n if (error) {\n setThirdPartyAuthContextFailure();\n }\n } else {\n configureAuth(AxiosJwtAuthService, { loggingService: getLoggingService(), config: getSiteConfig() });\n }\n }, [registrationEmbedded, queryParams?.next, isSuccess, data, error,\n setThirdPartyAuthContextSuccess, setThirdPartyAuthContextFailure]);\n\n useEffect(() => {\n const registrationResponse = location.state?.registrationResult;\n if (registrationResponse) {\n setRegistrationResult(registrationResponse);\n setFormFieldData({\n fields: location.state?.optionalFields.fields || {},\n extendedProfile: location.state?.optionalFields.extended_profile || [],\n });\n }\n }, [location.state?.registrationResult, location.state?.optionalFields]);\n\n useEffect(() => {\n if (registrationEmbedded && welcomePageContext && Object.keys(welcomePageContext).includes('fields')) {\n setFormFieldData({\n fields: welcomePageContext.fields,\n extendedProfile: welcomePageContext.extended_profile,\n });\n const nextUrl = welcomePageContext.nextUrl || appConfig.SEARCH_CATALOG_URL || '';\n setRegistrationResult({ redirectUrl: nextUrl });\n }\n }, [registrationEmbedded, welcomePageContext, appConfig.SEARCH_CATALOG_URL]);\n\n useEffect(() => {\n if (authenticatedUser?.userId) {\n identifyAuthenticatedUser(authenticatedUser.userId);\n sendPageEvent('login_and_registration', 'welcome');\n }\n }, [authenticatedUser]);\n\n if (\n !authenticatedUser\n || !(location.state?.registrationResult || registrationEmbedded)\n || thirdPartyAuthApiStatus === FAILURE_STATE\n || (thirdPartyAuthApiStatus === COMPLETE_STATE && !Object.keys(welcomePageContext).includes('fields'))\n ) {\n const dashboardUrl = getUrlByRouteRole(dashboardRole) || '/';\n if (dashboardUrl.startsWith('/')) {\n return <Navigate to={dashboardUrl} replace />;\n }\n window.location.href = dashboardUrl;\n return null;\n }\n\n const handleSubmit = (e) => {\n e.preventDefault();\n window.history.replaceState(location.state, null, '');\n const payload = { ...values, extendedProfile: [] };\n if (Object.keys(formFieldData.extendedProfile).length > 0) {\n formFieldData.extendedProfile.forEach(fieldName => {\n if (values[fieldName]) {\n payload.extendedProfile.push({ fieldName, fieldValue: values[fieldName] });\n }\n delete payload[fieldName];\n });\n }\n saveUserProfileMutation.mutate({ username: authenticatedUser.username, data: snakeCaseObject(payload) });\n\n sendTrackEvent(\n 'edx.bi.welcome.page.submit.clicked',\n {\n isGenderSelected: !!values.gender,\n isYearOfBirthSelected: !!values.year_of_birth,\n isLevelOfEducationSelected: !!values.level_of_education,\n isWorkExperienceSelected: !!values.work_experience,\n host: queryParams?.host || '',\n },\n );\n };\n\n const handleSkip = (e) => {\n e.preventDefault();\n window.history.replaceState(location.state, null, '');\n setShowModal(true);\n sendTrackEvent(\n 'edx.bi.welcome.page.skip.link.clicked',\n {\n host: queryParams?.host || '',\n },\n );\n };\n\n const onChangeHandler = (e) => {\n if (e.target.type === 'checkbox') {\n setValues({ ...values, [e.target.name]: e.target.checked });\n } else {\n setValues({ ...values, [e.target.name]: e.target.value });\n }\n };\n\n const formFields = Object.keys(formFieldData.fields).map((fieldName) => {\n const fieldData = formFieldData.fields[fieldName];\n return (\n <span key={fieldData.name}>\n <FormFieldRenderer\n fieldData={fieldData}\n value={values[fieldData.name]}\n onChangeHandler={onChangeHandler}\n />\n </span>\n );\n });\n\n const shouldRedirect = success;\n return (\n <BaseContainer showWelcomeBanner fullName={authenticatedUser?.fullName || authenticatedUser?.name}>\n <Helmet>\n <title>{formatMessage(messages['progressive.profiling.page.title'],\n { siteName: getSiteConfig().siteName })}\n </title>\n </Helmet>\n <ProgressiveProfilingPageModal isOpen={showModal} redirectUrl={registrationResult.redirectUrl} />\n {shouldRedirect && (\n <RedirectLogistration\n success\n redirectUrl={registrationResult.redirectUrl}\n educationLevel={values?.level_of_education}\n userId={authenticatedUser?.userId}\n />\n )}\n <div className=\"mw-xs m-4 pp-page-content\">\n {registrationEmbedded && thirdPartyAuthApiStatus === PENDING_STATE ? (\n <Spinner animation=\"border\" variant=\"primary\" id=\"tpa-spinner\" />\n ) : (\n <>\n <div>\n <h2 className=\"pp-page__heading text-primary\">{formatMessage(messages['progressive.profiling.page.heading'])}</h2>\n </div><hr className=\"border-light-700 mb-4\" />\n {showError ? (\n <Alert id=\"pp-page-errors\" className=\"mb-3\" variant=\"danger\" icon={Error}>\n <Alert.Heading>{formatMessage(messages['welcome.page.error.heading'])}</Alert.Heading>\n <p>{formatMessage(messages['welcome.page.error.message'])}</p>\n </Alert>\n ) : null}\n <Form>\n {formFields}\n {(appConfig.AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK) && (\n <span className=\"pp-page__support-link\">\n <Hyperlink\n isInline\n variant=\"muted\"\n destination={appConfig.AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK}\n target=\"_blank\"\n showLaunchIcon={false}\n onClick={() => (sendTrackEvent('edx.bi.welcome.page.support.link.clicked'))}\n >\n {formatMessage(messages['optional.fields.information.link'])}\n </Hyperlink>\n </span>\n )}\n <div className=\"d-flex mt-4 mb-3\">\n <StatefulButton\n type=\"submit\"\n variant=\"brand\"\n className=\"pp-page__button-width\"\n state={submitState}\n labels={{\n default: formatMessage(messages['optional.fields.submit.button']),\n pending: '',\n }}\n onClick={handleSubmit}\n onMouseDown={(e) => e.preventDefault()}\n />\n <StatefulButton\n className=\"text-gray-700 font-weight-500\"\n type=\"submit\"\n variant=\"link\"\n labels={{\n default: formatMessage(messages['optional.fields.skip.button']),\n }}\n onClick={handleSkip}\n onMouseDown={(e) => e.preventDefault()}\n />\n </div>\n </Form>\n </>\n )}\n\n </div>\n </BaseContainer>\n );\n};\n\nconst ProgressiveProfiling = (props) => (\n <ThirdPartyAuthProvider>\n <ProgressiveProfilingProvider>\n <ProgressiveProfilingInner {...props} />\n </ProgressiveProfilingProvider>\n </ThirdPartyAuthProvider>\n);\n\nexport default ProgressiveProfiling;\n"]}
@@ -3,11 +3,13 @@ declare function ProgressiveProfilingPageModal(props: any): import("react/jsx-ru
3
3
  declare namespace ProgressiveProfilingPageModal {
4
4
  namespace propTypes {
5
5
  let isOpen: PropTypes.Requireable<boolean>;
6
- let redirectUrl: PropTypes.Validator<string>;
6
+ let redirectUrl: PropTypes.Requireable<string>;
7
7
  }
8
8
  namespace defaultProps {
9
9
  let isOpen_1: boolean;
10
10
  export { isOpen_1 as isOpen };
11
+ let redirectUrl_1: string;
12
+ export { redirectUrl_1 as redirectUrl };
11
13
  }
12
14
  }
13
15
  import PropTypes from 'prop-types';
@@ -11,21 +11,24 @@ const ProgressiveProfilingPageModal = (props) => {
11
11
  const platformName = getSiteConfig().siteName;
12
12
  const handleSubmit = (e) => {
13
13
  e.preventDefault();
14
- if (redirectUrl.startsWith('/')) {
15
- navigate(redirectUrl);
14
+ // With no redirect configured, "continue to the platform" means the site itself.
15
+ const destination = redirectUrl || getSiteConfig().baseUrl;
16
+ if (destination.startsWith('/')) {
17
+ navigate(destination);
16
18
  }
17
19
  else {
18
- window.location.href = redirectUrl;
20
+ window.location.href = destination;
19
21
  }
20
22
  };
21
23
  return (_jsxs(ModalDialog, { title: formatMessage(messages['modal.title']), isOpen: isOpen, onClose: () => { }, size: "sm", variant: "default", hasCloseButton: false, children: [_jsx(ModalDialog.Header, { children: _jsx(ModalDialog.Title, { children: formatMessage(messages['modal.title']) }) }), _jsx(ModalDialog.Body, { children: formatMessage(messages['modal.description']) }), _jsx(ModalDialog.Footer, { children: _jsx(ActionRow, { children: _jsx(Button, { onClick: handleSubmit, variant: "primary", children: formatMessage(messages['continue.to.platform'], { platformName }) }) }) })] }));
22
24
  };
23
25
  ProgressiveProfilingPageModal.propTypes = {
24
26
  isOpen: PropTypes.bool,
25
- redirectUrl: PropTypes.string.isRequired,
27
+ redirectUrl: PropTypes.string,
26
28
  };
27
29
  ProgressiveProfilingPageModal.defaultProps = {
28
30
  isOpen: false,
31
+ redirectUrl: '',
29
32
  };
30
33
  export default ProgressiveProfilingPageModal;
31
34
  //# sourceMappingURL=ProgressiveProfilingPageModal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressiveProfilingPageModal.js","sourceRoot":"","sources":["../../src/progressive-profiling/ProgressiveProfilingPageModal.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,6BAA6B,GAAG,CAAC,KAAK,EAAE,EAAE;IAC9C,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IACtC,MAAM,YAAY,GAAG,aAAa,EAAE,CAAC,QAAQ,CAAC;IAE9C,MAAM,YAAY,GAAG,CAAC,CAAC,EAAE,EAAE;QACzB,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,WAAW,CAAC;QACrC,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,MAAC,WAAW,IACV,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,EAC7C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,EAClB,IAAI,EAAC,IAAI,EACT,OAAO,EAAC,SAAS,EACjB,cAAc,EAAE,KAAK,aAErB,KAAC,WAAW,CAAC,MAAM,cACjB,KAAC,WAAW,CAAC,KAAK,cACf,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,GACrB,GACD,EAErB,KAAC,WAAW,CAAC,IAAI,cACd,aAAa,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,GAC5B,EAEnB,KAAC,WAAW,CAAC,MAAM,cACjB,KAAC,SAAS,cACR,KAAC,MAAM,IAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAC,SAAS,YAC7C,aAAa,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,EAAE,YAAY,EAAE,CAAC,GAC3D,GACC,GACO,IACT,CACf,CAAC;AACJ,CAAC,CAAC;AAEF,6BAA6B,CAAC,SAAS,GAAG;IACxC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;CACzC,CAAC;AAEF,6BAA6B,CAAC,YAAY,GAAG;IAC3C,MAAM,EAAE,KAAK;CACd,CAAC;AAEF,eAAe,6BAA6B,CAAC","sourcesContent":["import { getSiteConfig, useIntl } from '@openedx/frontend-base';\nimport { ActionRow, Button, ModalDialog } from '@openedx/paragon';\nimport PropTypes from 'prop-types';\nimport { useNavigate } from 'react-router-dom';\n\nimport messages from './messages';\n\nconst ProgressiveProfilingPageModal = (props) => {\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const { isOpen, redirectUrl } = props;\n const platformName = getSiteConfig().siteName;\n\n const handleSubmit = (e) => {\n e.preventDefault();\n if (redirectUrl.startsWith('/')) {\n navigate(redirectUrl);\n } else {\n window.location.href = redirectUrl;\n }\n };\n\n return (\n <ModalDialog\n title={formatMessage(messages['modal.title'])}\n isOpen={isOpen}\n onClose={() => { }}\n size=\"sm\"\n variant=\"default\"\n hasCloseButton={false}\n >\n <ModalDialog.Header>\n <ModalDialog.Title>\n {formatMessage(messages['modal.title'])}\n </ModalDialog.Title>\n </ModalDialog.Header>\n\n <ModalDialog.Body>\n {formatMessage(messages['modal.description'])}\n </ModalDialog.Body>\n\n <ModalDialog.Footer>\n <ActionRow>\n <Button onClick={handleSubmit} variant=\"primary\">\n {formatMessage(messages['continue.to.platform'], { platformName })}\n </Button>\n </ActionRow>\n </ModalDialog.Footer>\n </ModalDialog>\n );\n};\n\nProgressiveProfilingPageModal.propTypes = {\n isOpen: PropTypes.bool,\n redirectUrl: PropTypes.string.isRequired,\n};\n\nProgressiveProfilingPageModal.defaultProps = {\n isOpen: false,\n};\n\nexport default ProgressiveProfilingPageModal;\n"]}
1
+ {"version":3,"file":"ProgressiveProfilingPageModal.js","sourceRoot":"","sources":["../../src/progressive-profiling/ProgressiveProfilingPageModal.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,6BAA6B,GAAG,CAAC,KAAK,EAAE,EAAE;IAC9C,MAAM,EAAE,aAAa,EAA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;AAEF,6BAA6B,CAAC,SAAS,GAAG;IACxC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,WAAW,EAAE,SAAS,CAAC,MAAM;CAC9B,CAAC;AAEF,6BAA6B,CAAC,YAAY,GAAG;IAC3C,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,EAAE;CAChB,CAAC;AAEF,eAAe,6BAA6B,CAAC","sourcesContent":["import { getSiteConfig, useIntl } from '@openedx/frontend-base';\nimport { ActionRow, Button, ModalDialog } from '@openedx/paragon';\nimport PropTypes from 'prop-types';\nimport { useNavigate } from 'react-router-dom';\n\nimport messages from './messages';\n\nconst ProgressiveProfilingPageModal = (props) => {\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const { isOpen, redirectUrl } = props;\n const platformName = getSiteConfig().siteName;\n\n const handleSubmit = (e) => {\n e.preventDefault();\n // With no redirect configured, \"continue to the platform\" means the site itself.\n const destination = redirectUrl || getSiteConfig().baseUrl;\n if (destination.startsWith('/')) {\n navigate(destination);\n } else {\n window.location.href = destination;\n }\n };\n\n return (\n <ModalDialog\n title={formatMessage(messages['modal.title'])}\n isOpen={isOpen}\n onClose={() => { }}\n size=\"sm\"\n variant=\"default\"\n hasCloseButton={false}\n >\n <ModalDialog.Header>\n <ModalDialog.Title>\n {formatMessage(messages['modal.title'])}\n </ModalDialog.Title>\n </ModalDialog.Header>\n\n <ModalDialog.Body>\n {formatMessage(messages['modal.description'])}\n </ModalDialog.Body>\n\n <ModalDialog.Footer>\n <ActionRow>\n <Button onClick={handleSubmit} variant=\"primary\">\n {formatMessage(messages['continue.to.platform'], { platformName })}\n </Button>\n </ActionRow>\n </ModalDialog.Footer>\n </ModalDialog>\n );\n};\n\nProgressiveProfilingPageModal.propTypes = {\n isOpen: PropTypes.bool,\n redirectUrl: PropTypes.string,\n};\n\nProgressiveProfilingPageModal.defaultProps = {\n isOpen: false,\n redirectUrl: '',\n};\n\nexport default ProgressiveProfilingPageModal;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressiveProfilingContext.js","sourceRoot":"","sources":["../../../src/progressive-profiling/components/ProgressiveProfilingContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAiB,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEjG,OAAO,EACL,aAAa,GACd,MAAM,sBAAsB,CAAC;AAc9B,MAAM,2BAA2B,GAAG,aAAa,CAA8C,SAAS,CAAC,CAAC;AAM1G,MAAM,CAAC,MAAM,4BAA4B,GAA0C,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClG,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAS,aAAa,CAAC,CAAC;IAEtE,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,OAAgB,EAAE,EAAE;QAClD,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,IAAI,OAAO,EAAE,CAAC;YACZ,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,UAAU,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC3B,SAAS;QACT,SAAS;QACT,OAAO;QACP,UAAU;QACV,YAAY;QACZ,UAAU;QACV,UAAU;QACV,WAAW;QACX,cAAc;KACf,CAAC,EAAE;QACF,SAAS;QACT,SAAS;QACT,OAAO;QACP,UAAU;QACV,YAAY;QACZ,UAAU;QACV,UAAU;QACV,WAAW;QACX,cAAc;KACf,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC/C,QAAQ,GAC4B,CACxC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAoC,EAAE;IAClF,MAAM,OAAO,GAAG,UAAU,CAAC,2BAA2B,CAAC,CAAC;IACxD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;IACvG,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import { createContext, FC, ReactNode, useContext, useMemo, useState, useCallback } from 'react';\n\nimport {\n DEFAULT_STATE,\n} from '../../data/constants';\n\ninterface ProgressiveProfilingContextType {\n isLoading: boolean,\n showError: boolean,\n success: boolean,\n submitState?: string,\n setLoading: (loading: boolean) => void,\n setShowError: (showError: boolean) => void,\n setSuccess: (success: boolean) => void,\n setSubmitState: (state: string) => void,\n clearState: () => void,\n}\n\nconst ProgressiveProfilingContext = createContext<ProgressiveProfilingContextType | undefined>(undefined);\n\ninterface ProgressiveProfilingProviderProps {\n children: ReactNode,\n}\n\nexport const ProgressiveProfilingProvider: FC<ProgressiveProfilingProviderProps> = ({ children }) => {\n const [isLoading, setIsLoading] = useState(false);\n const [showError, setShowError] = useState(false);\n const [success, setSuccess] = useState(false);\n const [submitState, setSubmitState] = useState<string>(DEFAULT_STATE);\n\n const setLoading = useCallback((loading: boolean) => {\n setIsLoading(loading);\n if (loading) {\n setShowError(false);\n setSuccess(false);\n }\n }, []);\n\n const clearState = useCallback(() => {\n setIsLoading(false);\n setShowError(false);\n setSuccess(false);\n }, []);\n\n const value = useMemo(() => ({\n isLoading,\n showError,\n success,\n setLoading,\n setShowError,\n setSuccess,\n clearState,\n submitState,\n setSubmitState,\n }), [\n isLoading,\n showError,\n success,\n setLoading,\n setShowError,\n setSuccess,\n clearState,\n submitState,\n setSubmitState,\n ]);\n\n return (\n <ProgressiveProfilingContext.Provider value={value}>\n {children}\n </ProgressiveProfilingContext.Provider>\n );\n};\n\nexport const useProgressiveProfilingContext = (): ProgressiveProfilingContextType => {\n const context = useContext(ProgressiveProfilingContext);\n if (context === undefined) {\n throw new Error('useProgressiveProfilingContext must be used within a ProgressiveProfilingProvider');\n }\n return context;\n};\n"]}
1
+ {"version":3,"file":"ProgressiveProfilingContext.js","sourceRoot":"","sources":["../../../src/progressive-profiling/components/ProgressiveProfilingContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAiB,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEjG,OAAO,EACL,aAAa,GACd,MAAM,sBAAsB,CAAC;AAc9B,MAAM,2BAA2B,GAAG,aAAa,CAA8C,SAAS,CAAC,CAAC;AAM1G,MAAM,CAAC,MAAM,4BAA4B,GAA0C,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClG,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAS,aAAa,CAAC,CAAC;IAEtE,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,OAAgB,EAAE,EAAE;QAClD,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,IAAI,OAAO,EAAE,CAAC;YACZ,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,UAAU,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC3B,SAAS;QACT,SAAS;QACT,OAAO;QACP,UAAU;QACV,YAAY;QACZ,UAAU;QACV,UAAU;QACV,WAAW;QACX,cAAc;KACf,CAAC,EAAE;QACF,SAAS;QACT,SAAS;QACT,OAAO;QACP,UAAU;QACV,YAAY;QACZ,UAAU;QACV,UAAU;QACV,WAAW;QACX,cAAc;KACf,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC/C,QAAQ,GAC4B,CACxC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAoC,EAAE;IAClF,MAAM,OAAO,GAAG,UAAU,CAAC,2BAA2B,CAAC,CAAC;IACxD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;IACvG,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import { createContext, FC, ReactNode, useContext, useMemo, useState, useCallback } from 'react';\n\nimport {\n DEFAULT_STATE,\n} from '../../data/constants';\n\ninterface ProgressiveProfilingContextType {\n isLoading: boolean;\n showError: boolean;\n success: boolean;\n submitState?: string;\n setLoading: (loading: boolean) => void;\n setShowError: (showError: boolean) => void;\n setSuccess: (success: boolean) => void;\n setSubmitState: (state: string) => void;\n clearState: () => void;\n}\n\nconst ProgressiveProfilingContext = createContext<ProgressiveProfilingContextType | undefined>(undefined);\n\ninterface ProgressiveProfilingProviderProps {\n children: ReactNode;\n}\n\nexport const ProgressiveProfilingProvider: FC<ProgressiveProfilingProviderProps> = ({ children }) => {\n const [isLoading, setIsLoading] = useState(false);\n const [showError, setShowError] = useState(false);\n const [success, setSuccess] = useState(false);\n const [submitState, setSubmitState] = useState<string>(DEFAULT_STATE);\n\n const setLoading = useCallback((loading: boolean) => {\n setIsLoading(loading);\n if (loading) {\n setShowError(false);\n setSuccess(false);\n }\n }, []);\n\n const clearState = useCallback(() => {\n setIsLoading(false);\n setShowError(false);\n setSuccess(false);\n }, []);\n\n const value = useMemo(() => ({\n isLoading,\n showError,\n success,\n setLoading,\n setShowError,\n setSuccess,\n clearState,\n submitState,\n setSubmitState,\n }), [\n isLoading,\n showError,\n success,\n setLoading,\n setShowError,\n setSuccess,\n clearState,\n submitState,\n setSubmitState,\n ]);\n\n return (\n <ProgressiveProfilingContext.Provider value={value}>\n {children}\n </ProgressiveProfilingContext.Provider>\n );\n};\n\nexport const useProgressiveProfilingContext = (): ProgressiveProfilingContextType => {\n const context = useContext(ProgressiveProfilingContext);\n if (context === undefined) {\n throw new Error('useProgressiveProfilingContext must be used within a ProgressiveProfilingProvider');\n }\n return context;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"apiHook.js","sourceRoot":"","sources":["../../../src/progressive-profiling/data/apiHook.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EACL,cAAc,EAAE,aAAa,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAY3F,MAAM,kBAAkB,GAAG,CAAC,UAAqC,EAAE,EAAE,EAAE;IACrE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,8BAA8B,EAAE,CAAC;IACxE,OAAO,WAAW,CAAC;QACjB,UAAU,EAAE,KAAmD,EAAE,4CAA9C,EAAE,QAAQ,EAAE,IAAI,EAA0B;YAAK,OAAA,CAChE,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAC7B,CAAA;UAAA;QACD,SAAS,EAAE,GAAG,EAAE;YACd,UAAU,CAAC,IAAI,CAAC,CAAC;YACjB,cAAc,CAAC,cAAc,CAAC,CAAC;YAC/B,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;gBACtB,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAC,KAAc,EAAE,EAAE;YAC1B,cAAc,CAAC,aAAa,CAAC,CAAC;YAC9B,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACpB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EACL,kBAAkB,GACnB,CAAC","sourcesContent":["import { useMutation } from '@tanstack/react-query';\n\nimport { patchAccount } from './api';\nimport {\n COMPLETE_STATE, DEFAULT_STATE,\n} from '../../data/constants';\nimport { useProgressiveProfilingContext } from '../components/ProgressiveProfilingContext';\n\ninterface SaveUserProfilePayload {\n username: string,\n data: Record<string, any>,\n}\n\ninterface UseSaveUserProfileOptions {\n onSuccess?: () => void,\n onError?: (error: unknown) => void,\n}\n\nconst useSaveUserProfile = (options: UseSaveUserProfileOptions = {}) => {\n const { setSuccess, setSubmitState } = useProgressiveProfilingContext();\n return useMutation({\n mutationFn: async ({ username, data }: SaveUserProfilePayload) => (\n patchAccount(username, data)\n ),\n onSuccess: () => {\n setSuccess(true);\n setSubmitState(COMPLETE_STATE);\n if (options.onSuccess) {\n options.onSuccess();\n }\n },\n onError: (error: unknown) => {\n setSubmitState(DEFAULT_STATE);\n if (options.onError) {\n options.onError(error);\n }\n },\n });\n};\n\nexport {\n useSaveUserProfile,\n};\n"]}
1
+ {"version":3,"file":"apiHook.js","sourceRoot":"","sources":["../../../src/progressive-profiling/data/apiHook.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EACL,cAAc,EAAE,aAAa,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAY3F,MAAM,kBAAkB,GAAG,CAAC,UAAqC,EAAE,EAAE,EAAE;IACrE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,8BAA8B,EAAE,CAAC;IACxE,OAAO,WAAW,CAAC;QACjB,UAAU,EAAE,KAAmD,EAAE,4CAA9C,EAAE,QAAQ,EAAE,IAAI,EAA0B;YAAK,OAAA,CAChE,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAC7B,CAAA;UAAA;QACD,SAAS,EAAE,GAAG,EAAE;YACd,UAAU,CAAC,IAAI,CAAC,CAAC;YACjB,cAAc,CAAC,cAAc,CAAC,CAAC;YAC/B,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;gBACtB,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAC,KAAc,EAAE,EAAE;YAC1B,cAAc,CAAC,aAAa,CAAC,CAAC;YAC9B,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACpB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EACL,kBAAkB,GACnB,CAAC","sourcesContent":["import { useMutation } from '@tanstack/react-query';\n\nimport { patchAccount } from './api';\nimport {\n COMPLETE_STATE, DEFAULT_STATE,\n} from '../../data/constants';\nimport { useProgressiveProfilingContext } from '../components/ProgressiveProfilingContext';\n\ninterface SaveUserProfilePayload {\n username: string;\n data: Record<string, any>;\n}\n\ninterface UseSaveUserProfileOptions {\n onSuccess?: () => void;\n onError?: (error: unknown) => void;\n}\n\nconst useSaveUserProfile = (options: UseSaveUserProfileOptions = {}) => {\n const { setSuccess, setSubmitState } = useProgressiveProfilingContext();\n return useMutation({\n mutationFn: async ({ username, data }: SaveUserProfilePayload) => (\n patchAccount(username, data)\n ),\n onSuccess: () => {\n setSuccess(true);\n setSubmitState(COMPLETE_STATE);\n if (options.onSuccess) {\n options.onSuccess();\n }\n },\n onError: (error: unknown) => {\n setSubmitState(DEFAULT_STATE);\n if (options.onError) {\n options.onError(error);\n }\n },\n });\n};\n\nexport {\n useSaveUserProfile,\n};\n"]}